Skip to content

feat(vis): run the add marshall check natively - #267

Open
prisis wants to merge 6 commits into
nextfrom
t3/native-add-marshall
Open

prisis wants to merge 6 commits into
nextfrom
t3/native-add-marshall

Conversation

@prisis

@prisis prisis commented Nov 26, 2026

Copy link
Copy Markdown
Member

Stacked on #259 and #263 (it reuses inspect::Packuments and the attest key cache). Merge #259, then #263, then this; until then this diff also shows their commits. A squash-merge of a lower PR needs a rebase of the ones above it.

Problem

vis add <pkg> without --no-marshall-check always started Node: the pipeline looks every package up in the registry first, and native had no counterpart.

Change

native/cli/src/marshall_check/ runs that check and answers the run in which no marshall finds anything (it prints nothing). Anything else is handed to Node before output, manager run or write.

  • Versions resolve as Node resolves them: semver.coerce of the spec (node-semver's expression), else https://registry.npmjs.org/<name>/latest (fixed host, ignores .npmrc; a name that fails is dropped).
  • Packument marshalls through the shared lookup/cache: author, provenance, s1ngularity, newBin, metadata (as vis inspect), plus new deprecation and packageAge. Outside a workspace root Node ignores .npmrc and asks registry.npmjs.org; native does the same.
  • downloads (npm stats), archivedRepo (GitHub) and expiredDomains (a DNS NS lookup over UDP to 1.1.1.1/8.8.8.8, counted only when it returns an NS record) keep Node's 24 h disk caches, byte for byte. A failed GitHub lookup is no finding, as in Node.
  • Node-pipeline quirk reproduced: the pipeline passes the five author thresholds as undefined and its spread replaces the defaults, so recent-version and dormant-maintainer never report and new-publisher has no window. Found by running against the real registry; vis inspect uses real defaults, so the two differ on purpose.
  • The pipeline caches every packument even when env turns every marshall off; native does too.
  • Launcher gate: no longer requires --no-marshall-check; the blanket MARSHALL_* decline became per variable, for add only (MARSHALL_DISABLE_<marshall> of the ten checks pass; MARSHALL_DISABLE_ALL, _TYPOSQUATS, _SOCKET, anything else stays Node). Proxy/CA/Node options keep a checking run in Node.
  • bin/route.mjs, routing.json, the route snapshot and route.test.ts updated together.

What stays in Node (honest slice)

  • Any finding: Node prints the table and may prompt/countdown. Real packages often have a warning (e.g. react@19.0.0 has a metadata one), so those runs are handed over; native has already fetched and written nothing, so Node fetches again (a double fetch on that path; I did not warm the cache on hand-off here).
  • Expired/odd cache entries, GitHub redirects, non-ASCII data, signatures (opt-in), Socket/deps.dev/Snyk (config-only, so off without a security config).

Verification

  • cargo fmt/clippy -D warnings, cargo test -p vis-cli green (loopback stubs for the registry, stats API, GitHub, and a UDP DNS server).
  • add-marshall-parity.test.ts (new; stub registry, seeded service caches) and add-parity.test.ts, route, routing-fixture, whole __tests__/native at this tip with FORCE_COLOR=3 CI=1 GITHUB_ACTIONS=true TERM=xterm-256color: green except two beforeAll/afterAll hook timeouts (30 s) in unrelated run-all-hit and sort-package-json under the full parallel load; both pass when rerun.
  • Against the real registry/GitHub/DNS, native vs Node (vis add <pkg>@<exact>, <pkg>, <pkg>@latest, a range, an unknown name; inside and outside a workspace root): same stdout, same stub-manager log, same ~/.vis/cache tree for the clean ones (zod, chalk); native declined for every package where Node printed a table; no case where native answered and Node had findings.
  • Unverified locally: Linux, a firewalled network (DNS blocked makes native hand over), IPv6-only hosts.

🤖 Generated with Claude Code

prisis and others added 5 commits November 26, 2026 00:44
… 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>
… 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>
`vis add` without `--no-marshall-check` always started Node, because the
pipeline looks every package up in the registry first. The binary now
runs that check itself and answers the run in which no marshall finds
anything, which prints nothing:

- versions resolve as Node resolves them: `semver.coerce` of the spec, else
  the registry's `/<name>/latest`, and a name that does not resolve is
  dropped.
- the packument is read through the shared lookup and cache (outside a
  workspace root Node ignores `.npmrc`, so the binary asks the default
  registry there). `author`, `provenance`, `s1ngularity`, `newBin` and
  `metadata` are the ones `vis inspect` runs; `deprecation` and
  `packageAge` are new.
- `downloads` (npm stats), `archivedRepo` (GitHub) and `expiredDomains`
  (a DNS NS lookup over UDP, answered only when it finds name servers)
  keep Node's 24 hour disk caches, byte for byte. A failed GitHub lookup
  is no finding, as in Node.
- any finding, a registry or service answer the checks do not read as
  Node does, an expired or odd cache entry, a proxy or CA setting, and
  `MARSHALL_DISABLE_ALL` or any `MARSHALL_*` variable that is not the
  `DISABLE` of one of those marshalls go to Node before anything is
  printed or written. The cache the check filled is written only once
  the run is sure to answer.

The launcher gate no longer requires the flag and reads the
`MARSHALL_DISABLE_*` variables of the marshalls the check runs, per
variable.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…at finds

Checked against the real registry: the pipeline of `vis add` passes the
five author thresholds as `undefined`, and `{ ...DEFAULTS, ...thresholds }`
lets them replace the defaults. The recent-version and dormant-maintainer
checks therefore never report, and the new-publisher check has no window
that excuses a young package. The native check now does the same, where
it ran the defaults `vis inspect` runs and declined runs Node answers.

A hand-off names the check that found something, lint fixes for the
launcher gate, and the real-network case is dropped from the parity suite.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 680982b6-6bd1-4cbe-b35e-6c209144df06

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions github-actions Bot added package: vis size:XXL Size of the change, tests and generated files excluded. labels Nov 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@github-actions github-actions Bot added the vouch:trusted PR author is a collaborator, a bot or on the VOUCHED list. label Nov 26, 2026
@qodo-code-review

qodo-code-review Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Run add checks, attest verification, and dlx gates natively

✨ Enhancement 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Run vis add natively when its marshall checks find nothing; delegate findings to Node.
• Answer silent dlx first-run gates and supported attest paths without starting Node.
• Share registry caches and add parity tests for native output, routing, and delegation.
Merge Risk 🔴 High

Blast radius 🔴 High 💥 4 capabilities

  • 4 affected capabilities span independent functional scopes: dlx package execution onboarding, package attestation integration, package installation security integration.
  • The changed path resolves requested packages, runs installation-time marshall checks, commits their cache actions, and then invokes one inherited package-manager operation; the follow-up helper only constructs the same cache action.
  • This behavior hashes a build artifact and emits an attestation-status document or warning.
  • It is distinct from locked-package verification but belongs to the same bounded package-attestation integration.
  • The behavior evaluates provenance and signatures of packages in one lockfile and emits a verification report.
  • It is an independent user-visible operation within the bounded package-attestation integration.
  • The changed behavior decides whether the first-run information gate is silent, delegated, or approved before one dlx package-manager execution.
  • Its state and registry reads support that same onboarding outcome.
Sources

packages/tooling/vis/native/cli/src/dlx.rs[67-80]

    // The registry is asked last, after every reason to delegate that needs no request, and its cache is written
    // only once every package is known to be approved: a hand-off writes nothing.
    if !plan.vetted.is_empty() {
        match approved(&plan.vetted, &plan.run.cwd) {
            Ok(cache) => {
                if let Err(reason) = commit(&cache) {
                    crate::process::delegate_because(&reason, raw);
                }
            }
            Err(reason) => crate::process::delegate_because(&reason, raw),
        }
    }

    plan.run.run_inherited(raw, |code| code)
Behavioral complexity 🔴 High 🧩 Multiple interactions

  • Before, verification was handled by Node.
  • After, the native implementation coordinates concurrent package workers, indexed result collection, ordered finding aggregation, registry-key fallback, signature verification, cache writes, and report-specific delegation.
  • New correctness conditions concern worker/result association, finding order, cache commit boundaries, and mixed cache/network/key states.
  • The follow-up does not alter these conditions.
Potential damage 🔴 High 🩹 Integrity

  • A false negative could allow a consumer or release workflow to treat an unverified or altered package as acceptable; a false positive can block or divert a valid release.
  • The follow-up does not alter verification, cache semantics, ordering, or delegation.
  • Reverting stops new incorrect reports, but reports already consumed by release or dependency decisions require re-verification and possibly package or release remediation; cache data may need clearing or replacement.
Assessed commit c3ae7d7
Diagram

graph TD
  L["CLI launcher"] --> R["Native routing"] --> A["Add checks"] --> C["Shared caches"]
  R --> D["Dlx gate"] --> C
  R --> T["Attest paths"] --> C
  A --> N["Node fallback"]
  D --> N
  T --> N
  A --> M["Package manager"]
  D --> M
Loading
High-Level Assessment

Reusing the existing packument and key caches while delegating findings and unsupported behavior is appropriate for a native fast path that must preserve Node's behavior. Running Node for every check would retain parity but defeat the purpose of this PR; independently reimplementing the shared cache would increase divergence risk.

Files changed (33) +4756 / -238

Enhancement (16) +3706 / -132
route.mjsRoute supported add, dlx, and attest shapes to native +153/-59

Route supported add, dlx, and attest shapes to native

• Admits checked add runs and dlx first-run decisions to Rust, adds attest emit and verify gates, and keeps unsupported environment or network settings in Node.

packages/tooling/vis/bin/route.mjs

add.rsCheck marshalls before native installation +53/-27

Check marshalls before native installation

• Plans add runs with or without '--no-marshall-check', performs the check after other delegation gates, and commits cache changes before starting the package manager.

packages/tooling/vis/native/cli/src/add.rs

emit.rsAnswer attest's no-OIDC signing skip +169/-0

Answer attest's no-OIDC signing skip

• Hashes a supported artifact and reproduces Node's JSON skip result or warning. Signing, unsupported subjects, and failures delegate to Node.

packages/tooling/vis/native/cli/src/attest/emit.rs

mod.rsDefine native attest leaves and flag parsing +144/-0

Define native attest leaves and flag parsing

• Introduces the emit and verify modules with strict shared parsing for supported flags and output formats.

packages/tooling/vis/native/cli/src/attest/mod.rs

signature.rsVerify npm P-256 signatures +191/-0

Verify npm P-256 signatures

• Checks canonical base64 signatures against registry SPKI keys with ring; delegates key and encoding forms it cannot safely equate with Node.

packages/tooling/vis/native/cli/src/attest/signature.rs

verify.rsVerify locked-package provenance and signatures natively +785/-0

Verify locked-package provenance and signatures natively

• Scans pnpm-locked packages using cached packuments and registry keys, then emits JSON, NDJSON, or a clean table result. Finding tables and unsupported inputs delegate to Node.

packages/tooling/vis/native/cli/src/attest/verify.rs

dlx.rsDecide silent dlx first-run gates in Rust +282/-34

Decide silent dlx first-run gates in Rust

• Runs natively when the gate skips itself or every vetted version is already approved. Terminal lookups use shared packuments; panels and unsupported cases delegate without committing their cache changes.

packages/tooling/vis/native/cli/src/dlx.rs

clean.rsDetermine whether packument marshalls find anything +263/-0

Determine whether packument marshalls find anything

• Adds reusable clean-result checks for existing inspect marshalls plus deprecation and package age, including add's distinct author-threshold behavior.

packages/tooling/vis/native/cli/src/inspect/clean.rs

marshalls.rsReuse provenance and add-specific author checks +34/-10

Reuse provenance and add-specific author checks

• Exposes provenance helpers and adds the author behavior produced by add's undefined thresholds without changing inspect's defaults.

packages/tooling/vis/native/cli/src/inspect/marshalls.rs

keys_refresh.rsReuse cached registry signing keys for attest +209/-2

Reuse cached registry signing keys for attest

• Adds typed key lookup with fresh-cache, registry-fetch, and stale-cache fallback behavior; defers cache writes until the verifying run commits.

packages/tooling/vis/native/cli/src/keys_refresh.rs

main.rsRegister native attest and marshall-check modules +2/-0

Register native attest and marshall-check modules

• Includes the new command and security-check modules in the native CLI build.

packages/tooling/vis/native/cli/src/main.rs

dns.rsQuery maintainer-domain NS records natively +259/-0

Query maintainer-domain NS records natively

• Adds bounded UDP DNS lookups against Node's configured public resolvers; only a valid NS answer establishes a clean domain result.

packages/tooling/vis/native/cli/src/marshall_check/dns.rs

mod.rsCoordinate add's clean-result marshall checks +690/-0

Coordinate add's clean-result marshall checks

• Runs supported packument and external-service checks for resolved packages, honors individual disable variables, and returns cache actions only for a clean run.

packages/tooling/vis/native/cli/src/marshall_check/mod.rs

resolve.rsResolve add specifications like the Node pipeline +216/-0

Resolve add specifications like the Node pipeline

• Coerces numeric version specifications or queries the fixed npm registry latest endpoint, dropping names that cannot resolve.

packages/tooling/vis/native/cli/src/marshall_check/resolve.rs

services.rsCheck downloads, repositories, and domains with Node-compatible caches +252/-0

Check downloads, repositories, and domains with Node-compatible caches

• Adds npm download, GitHub archive, and DNS-domain checks with their 24-hour disk-cache formats; findings and uncertain results return to Node.

packages/tooling/vis/native/cli/src/marshall_check/services.rs

route.rsDispatch both attest leaves natively +4/-0

Dispatch both attest leaves natively

• Registers 'attest verify' ahead of the general 'attest' route and extends route assertions.

packages/tooling/vis/native/cli/src/route.rs

Refactor (7) +146 / -35
args.rsShare package-spec parsing with dlx +1/-1

Share package-spec parsing with dlx

• Makes the existing plain package parser available to other native CLI modules.

packages/tooling/vis/native/cli/src/inspect/args.rs

js_format.rsShare JavaScript-compatible date parsing +1/-1

Share JavaScript-compatible date parsing

• Exposes the existing date parser for package-age checks and signing-key expiry.

packages/tooling/vis/native/cli/src/inspect/js_format.rs

js_value.rsShare packument member accessors +2/-2

Share packument member accessors

• Makes JavaScript-value member and text accessors available to the new native checks.

packages/tooling/vis/native/cli/src/inspect/js_value.rs

mod.rsExpose reusable packument lookup and deferred cache writes +113/-16

Expose reusable packument lookup and deferred cache writes

• Introduces 'Packuments' for shared registry resolution and reads, including a default-registry mode outside workspaces; exposes cache actions and commit for callers.

packages/tooling/vis/native/cli/src/inspect/mod.rs

packument.rsShare packument views across native checks +14/-9

Share packument views across native checks

• Exposes version, tag, time, and entry accessors and adds iteration over publication timestamps.

packages/tooling/vis/native/cli/src/inspect/packument.rs

js.rsShare random-byte generation with DNS checks +2/-2

Share random-byte generation with DNS checks

• Makes the existing random-byte helper available for DNS query identifiers.

packages/tooling/vis/native/cli/src/js.rs

pm_run.rsPermit add-owned marshall variables through setup +13/-4

Permit add-owned marshall variables through setup

• Allows callers to name marshall environment variables they handle themselves while preserving the existing default delegation gate.

packages/tooling/vis/native/cli/src/pm_run.rs

Tests (8) +900 / -71
add-marshall-parity.test.tsCompare native and Node add-check outcomes +369/-0

Compare native and Node add-check outcomes

• Adds stub-registry parity tests for clean installations, cache contents, marshall disable variables, and delegation before manager execution or cache writes.

packages/tooling/vis/tests/native/add-marshall-parity.test.ts

add-parity.test.tsMove checked-add coverage to its dedicated suite +2/-4

Move checked-add coverage to its dedicated suite

• Removes assumptions that an add without '--no-marshall-check' must delegate; the existing suite continues to cover the explicitly skipped check.

packages/tooling/vis/tests/native/add-parity.test.ts

attest-parity.test.tsCompare native attest output and delegation with Node +344/-0

Compare native attest output and delegation with Node

• Adds end-to-end parity cases for signing skips, provenance and signature findings, report formats, cache contents, and unsupported inputs.

packages/tooling/vis/tests/native/attest-parity.test.ts

info-dlx-parity.test.tsCover silent dlx first-run gates +25/-16

Cover silent dlx first-run gates

• Adds non-interactive, CI, yes, and environment-variable cases that can run natively; retains delegation coverage for forced panels and non-ASCII gate values.

packages/tooling/vis/tests/native/info-dlx-parity.test.ts

route.test.tsTest expanded launcher admission gates +33/-22

Test expanded launcher admission gates

• Checks add routing without the skip flag, allowed marshall variables, network restrictions, and dlx shapes whose gate the binary now decides.

packages/tooling/vis/tests/native/route.test.ts

tests.rsShare registry fixtures and test default-registry lookup +37/-14

Share registry fixtures and test default-registry lookup

• Exposes the existing stub-registry helpers to new module tests and verifies that an explicit registry overrides '.npmrc' lookup.

packages/tooling/vis/native/cli/src/inspect/tests.rs

native-routes.snapSnapshot new native attest and add routes +45/-9

Snapshot new native attest and add routes

• Records attest dispatch targets and newly admitted add shapes in the native routing snapshot.

packages/tooling/vis/native/cli/tests/fixtures/native-routes.snap

routing.jsonExercise launcher and binary delegation boundaries +45/-6

Exercise launcher and binary delegation boundaries

• Adds shared routing cases for checked add, silent dlx gates, attest paths, and environment settings that must remain in Node.

packages/tooling/vis/native/cli/tests/fixtures/routing.json

Other (2) +4 / -0
Cargo.lockRecord the direct ring dependency +1/-0

Record the direct ring dependency

• Adds ring to the native CLI's locked dependency list for signature verification.

packages/tooling/vis/native/Cargo.lock

Cargo.tomlDeclare ring for ECDSA verification +3/-0

Declare ring for ECDSA verification

• Adds a direct ring dependency so native attest verification can check npm registry signatures.

packages/tooling/vis/native/cli/Cargo.toml

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@prisis
prisis deployed to benchmarks November 26, 2026 01:12 — with GitHub Actions Active
@codspeed

codspeed Bot commented Nov 26, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

🆕 3 new benchmarks
⏩ 113 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 transform/transform_ts[470] N/A 355.3 µs N/A
🆕 transform/transform_ts[47000] N/A 16 ms N/A
🆕 transform/transform_ts[9400] N/A 3.3 ms N/A

Comparing t3/native-add-marshall (739a875) with next (1078fa9)2

Open in CodSpeed

Footnotes

  1. 113 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on next (c8c3ce2) during the generation of this report, so 65c051d was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (4)

Grey Divider


Remediation recommended

1. Malformed DNS replies hide domain warnings 🐞 Bug
Description
has_name_servers returns true for an NS answer before checking whether its declared record data
exists or contains a valid name. If a resolver sends such a malformed reply, vis add treats the
domain as clean and caches that result for 24 hours instead of leaving the lookup to Node's
resolver.
Code

packages/tooling/vis/native/cli/src/marshall_check/dns.rs[R88-91]

+        let (Some(kind), Some(length)) = (word(after_name), word(after_name + 8)) else { return false };
+
+        if kind == TYPE_NS && word(after_name + 2) == Some(CLASS_IN) {
+            return true;
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The native DNS parser accepts an NS record without validating its RDATA, allowing a malformed reply to become a cached clean domain result.

## Fix Focus Areas
- packages/tooling/vis/native/cli/src/marshall_check/dns.rs[86-95]
- packages/tooling/vis/native/cli/src/marshall_check/services.rs[239-246]

## Recommended Fix
Before returning true, verify that the declared RDATA fits within the reply and decodes as a valid DNS name within the record boundary. Treat malformed records as unsuccessful lookups so the add command delegates to Node; add a truncated-NS-reply test.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


View medium (1)
2. Slow registry stalls vis add far past Node's 10 s 🐞 Bug
Description
latest_versions requests each package’s /latest sequentially with a separate 10 s TIMEOUT,
while Node’s resolveLatestVersions starts the requests in parallel under one 10 s abort. When
several names need a lookup against a slow or unreachable registry, the native path can wait roughly
N×10 s before installation and may resolve names that Node would have dropped after its shared
deadline.
Code

packages/tooling/vis/native/cli/src/marshall_check/resolve.rs[R51-61]

+    let client = HttpClient::new(fetch_config(HttpConfig::from_env(TIMEOUT, TIMEOUT), TIMEOUT));
+    let mut versions = HashMap::new();
+
+    for name in names {
+        let url = format!("{base}/{name}/latest");
+
+        if !url_is_plain(&url) {
+            return Err(format!("the URL {url:?} is not one `fetch` and the client read alike"));
+        }
+
+        let response = match client.get(&url, &[("accept", "application/json")]) {
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`latest_versions` resolves `/latest` sequentially with a 10 s timeout per request, while Node resolves names concurrently under one 10 s abort. Multiple stalled registry requests can delay native `vis add` by roughly 10 s per name and leave the two paths checking different package sets.

## Fix Focus Areas
- packages/tooling/vis/native/cli/src/marshall_check/resolve.rs[49-82]

## Recommended Fix
Issue independent latest-version requests concurrently under one 10 s overall deadline. Give each request only the time remaining, stop resolving names when the deadline passes, and preserve per-name failure handling while collecting successful versions into the existing map. Test multiple stalled names against the overall time bound.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗



View low (2)
Informational
3. DNS lookup can run past its 4 s budget 🐞 Bug
Description
In has_ns_records, the while let Ok(..) = socket.recv_from(..) loop ignores datagrams from any
address other than the server and loops again. Each recv_from gets a fresh read timeout and the
loop never compares against deadline. A steady trickle of stray UDP packets to the ephemeral port
can therefore keep the lookup waiting well past BUDGET, which delays vis add before it hands off
or installs.
Code

packages/tooling/vis/native/cli/src/marshall_check/dns.rs[R131-139]

+        while let Ok((length, from)) = socket.recv_from(&mut reply) {
+            if from == *server {
+                if has_name_servers(&reply[..length], id) {
+                    return true;
+                }
+
+                break;
+            }
+        }
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The receive loop in `has_ns_records` discards packets from other sources and calls `recv_from` again with a fresh full timeout, so the 4 s budget can be exceeded.

## Fix Focus Areas
- packages/tooling/vis/native/cli/src/marshall_check/dns.rs[123-139]

## Recommended Fix
Compute a per-server deadline. Before each `recv_from`, set the read timeout to the time left before that deadline, and break when no time is left. Optionally `connect()` the socket to the server so the OS filters out other sources.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


4. Spoofed DNS reply can clear an expired domain 🐞 Bug
Description
has_name_servers accepts any NOERROR reply whose transaction ID matches and which contains an
NS/IN record. It never checks that the echoed question, or the record's owner name, is the domain
that was queried, even though its doc comment says it does. The ID is only 16 bits and the only
other check is the source address, so a forged reply can mark a lapsed maintainer domain as ok.
That result is then cached for 24 h, which hides the exact account-takeover risk this check exists
to flag, for Node runs too.
Code

packages/tooling/vis/native/cli/src/marshall_check/dns.rs[R78-84]

+    let is_clean = reply_id == id && flags & 0x8000 != 0 && flags & 0x0200 == 0 && flags & 0x000F == 0;
+
+    if !is_clean || questions != 1 {
+        return false;
+    }
+
+    let Some(mut at) = skip_name(reply, 12).map(|end| end + 4) else { return false };
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`has_name_servers` only checks the transaction ID, flags and question count. It never confirms that the reply's question is the queried name, NS and IN, so a forged reply with a guessed 16-bit ID counts as a clean domain and is cached as `ok` for 24 h.

## Fix Focus Areas
- packages/tooling/vis/native/cli/src/marshall_check/dns.rs[69-98]
- packages/tooling/vis/native/cli/src/marshall_check/dns.rs[101-143]

## Recommended Fix
Pass the query packet (or the domain) into `has_name_servers`. Check that `reply[12..question_end]` equals the question bytes of the query (comparing names case-insensitively), and that QTYPE=NS and QCLASS=IN. Optionally require the NS record's owner to be the queried name, or a compression pointer to offset 12.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


Grey Divider

Tip of the day
💡 Did you know, you can tweak Display settings with a live preview to see your comment before it ships

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

This branch was successfully deployed

1 active deployment
benchmarks — 739a875e Deployed Nov 26, 2026 by prisis via Bench native (vis) #451
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: vis size:XXL Size of the change, tests and generated files excluded. vouch:trusted PR author is a collaborator, a bot or on the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant