Repository navigation
Conversation
… show The native dlx only ran when the first-run gate was switched off, so a plain `vis dlx <package>` started Node even in CI, where the gate skips itself without any network work. The binary now decides the gate the way the Node handler does: - `--yes`, a truthy `VIS_DLX_YES`, CI, or a stdin or stdout that is not a terminal: the gate does nothing, the package manager runs natively. - a terminal outside CI without `--yes`: the gate resolves each package against the registry and looks the version up in `~/.vis/state/dlx-seen.json`. An approved version with no Socket token makes the gate silent, so it runs natively. The packument is read through the shared registry client and cache (`inspect::Packuments`). - a version that is not approved yet (the panel and the prompt), a Socket token, `--offline`, a range spec, `--info`, or a value of a gate variable that is not ASCII are handed to Node before any output. The registry cache is written only after every package is known to be approved, so a hand-off writes nothing. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
`vis attest` always started Node. Two of its paths are reproducible natively, byte for byte: - `vis attest <subject>` with no ambient OIDC token: Node hashes the artifact and skips signing, with the JSON document under `--format json` or a warning line. A run that signs (`CI` equal to `true`, a GitHub Actions or Sigstore token), `--require-signing`, and every thrown failure stay in Node. - `vis attest verify`: the locked packages of a pnpm workspace are checked against the registry's provenance and signatures, with up to eight packuments in flight (the cache of `vis inspect` is shared) and the registry's signing keys from `~/.vis/cache/registry-keys` or the registry. ECDSA P-256 signatures are verified with ring. The JSON and NDJSON reports are native, and so is the table for a run that finds nothing; a table of findings is drawn by the terminal UI, so Node prints it, after the native run has written the cache it filled so Node finds it warm. Everything this binary does not read the way Node does is handed over before any output: `--prod-only`, `MARSHALL_*`, `VIS_NPM_KEYS_URL`, a proxy or CA setting, a registry that needs a credential, a packument, key or signature in a shape the checks name, and a base64 text that is not canonical. The packument lookup of `inspect` is widened (`Packuments::read`, the view and the provenance helper) and the keys cache gets a loader that defers its write until the run is known to answer. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
PR Summary by QodoRun safe attest paths and first-run dlx gates natively
AI Description
Merge Risk
|
Code Review by Qodo
1. One bad package still costs a full registry scan
|
|
Thank you for following the naming conventions! 🙏 |
Merging this PR will not alter performance
Performance Changes
Comparing Footnotes
|
… the gate Run against the lockfile of a real workspace (2110 packages, byte-identical JSON and the same cache files as Node), a package whose packument this binary cannot read ends the scan after hundreds of fetches. The packuments that were read are now written before the hand-off, as they are for the table of findings, so Node finds them warm. The launcher gate moves after the helpers it uses and its flag reader is split, to satisfy the lint rules. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Problem
vis attestalways started Node, including the two shapes that need nothing Node-specific: the run that skips signing for lack of an OIDC token, andattest verify, which only reads the lockfile, the registry and the signing keys.Change
New
native/cli/src/attest/:vis attest <subject>(emit.rs): with no ambient OIDC token Node hashes the artifact and skips signing. Native prints the same JSON document (--format json) or warning line, hashes withsha2.CIequal totrue,ACTIONS_ID_TOKEN_REQUEST_URLorSIGSTORE_ID_TOKEN(Node signs with Sigstore),--require-signing, a predicate other thanslsaProvenanceand every thrown failure stay in Node.vis attest verify(verify.rs,signature.rs): lockfile (pnpm_lock), one packument per locked package through the shared packument cache with 8 in flight (Node'smapWithConcurrency), the provenance regression check (shared withinspect), and the registry-signature check: keys from the key cache or the registry (keys_refresh::registry_keys, which defers its cache write), ECDSA P-256/SHA-256 verified withring(new direct dependency, already in the tree via rustls). JSON and NDJSON reports are native; so is the table for a run with no finding.--prod-only(walks the workspace manifests),MARSHALL_*,VIS_NPM_KEYS_URL, proxy/CA/Node options,.npmrccredentials, non-canonical base64 (Node's decoder is lenient), a key that is not a P-256 SPKI, a key expiry that is not ISO, odd packuments.bin/route.mjs(gate),routing.json, the route snapshot and the parity test are updated together.What stays in Node (honest slice)
Tableof the terminal UI; native does not draw it. Because that is the usual result on a big tree (older versions have no signature), the native run writes the packument and key caches it filled before handing over, so Node finds them warm instead of fetching again. The bytes are the ones Node writes; the parity test checks the cache tree after such a hand-off.attest <subject>with a token) needs Sigstore.logger.info/warnhere are the toolbox console, not pail: plain text, so native only answers where the colour level is provably none.Verification
cargo fmt --all --check,cargo clippy --all-targets -- -D warnings,cargo test -p vis-cli: green (new unit tests: flag parser, base64 and ECDSA verification against generated keys, both marshalls against a loopback registry stub, reports, the key lookup).__tests__/native/attest-parity.test.ts(26 cases, real P-256 keys signed withnode:crypto, stub registry on loopback, each side with its ownHOME),inspect-parity,security-keys-refresh-parity,route,routing-fixture,command-manifest: green withFORCE_COLOR=3 CI=1 GITHUB_ACTIONS=true TERM=xterm-256color.routingintegration test failed once in a fullcargo testrun on a shared target dir while another build was running, and passed on five reruns; I could not reproduce it.Checked against real data
attest verify --format jsonon the lockfile of this repository (2110 locked packages) with a scratchHOME: byte-identical JSON (5297 lines) and the same 1886 cache files as Node. Wall time is network-bound and equal (59 s native debug build vs 56 s Node), peak RSS about 900 MB for both. A package whose packument this binary cannot read ends the scan; the packuments read so far are written before the hand-off so Node does not fetch them again (unit and parity tests cover it). Native holds the cache text until the end of the scan (the memory above includes it).🤖 Generated with Claude Code