Skip to content

Security preflight gate fails on tract-nnef advisory (was masked by the #654 test failure) #657

Closed

Description

@1jehuang

Summary

Security preflight (Linux) in Build & Test (ubuntu-latest) fails on a cargo-audit vulnerability in tract-nnef 0.21.10, plus several unmaintained/unsound warnings. It runs scripts/security_preflight.sh --strict, so the finding is a hard gate.

Why this has not been noticed

This step had not actually executed on recent master. The job aborts at an earlier step, Run TUI library tests (Linux only), which has failed on every push since 5c70ac4c3 (that is #654). Because Security preflight runs after it in the same job, the audit failure was masked by the test failure.

Fixing #654 in #656 lets the job reach the audit step, which then fails. Verified on run 30435943571: every test step passes and Security preflight is the only failing step. For contrast, on the last master run (30413583952) that step is skipped.

So this is not a new regression, and it is not caused by #656. It is a pre-existing dependency issue that was hidden behind an unrelated red gate.

The finding

One error-level advisory:

Crate: tract-nnef  Version: 0.21.10   error: 1 vulnerability found!

Warning-level (unmaintained/unsound): bincode, paste, rustybuzz, ttf-parser, anyhow 1.0.100 (RUSTSEC-2026-0190), lru 0.12.5 (RUSTSEC-2026-0002), memmap2 0.8.0 (RUSTSEC-2026-0186), rand 0.8.5 (RUSTSEC-2026-0097).

Why I am not fixing it

This needs a maintainer decision rather than an agent's guess:

  1. Bump tract-nnef, which may pull a breaking tract API change wherever it is used.
  2. Add a scoped ignore to the audit config, accepting the risk with a documented rationale.
  3. Drop or feature-gate the dependency if the functionality is optional.

Choosing between those depends on how the crate is used and what risk is acceptable, and the several warning-level advisories deserve a deliberate pass too. Picking one unilaterally would be the wrong call.

Suggestion

Whatever the resolution, it is worth considering whether Security preflight should run in a job that is not gated behind the full test suite. A failure that can only surface once an unrelated test passes is a blind spot, and this issue is a concrete instance of it.

--- — Jcode agent (automated triage), on behalf of @1jehuang

Activity

  1. added
    bug
    priority: high
    triage: needs-decision
    autonomous: no
    on Jul 29, 2026
  2. 1jehuang commented on Jul 29, 2026

    @1jehuang
    OwnerAuthor

    Investigated whether the tract-nnef advisory has a safe patch-level fix. It does not, and the reason is worth recording so nobody repeats the attempt.

    There are two advisories on tract-nnef 0.21.10:

    • RUSTSEC-2026-0217 (6.1 medium), integer overflow in the NNEF tensor parser. Fixed in >=0.21.16, <0.22.0, so in principle reachable without leaving the 0.21 line.
    • The 7.5-high finding in the CI log is RUSTSEC-2026-0195, which is quick-xml, not tract. Separate item.

    The 0.21.16/0.21.17 bump is blocked by a hard version conflict:

    tract-data 0.21.16  requires  half =2.4.1
    tract-data 0.21.17  requires  half =2.4.1
    

    That is an exact pin. The lockfile currently resolves half 2.7.1, required via naga -> vello_shaders -> vello -> jcode-desktop2. So cargo update -p tract-onnx --precise 0.21.17 fails with failed to select a version for half, and pinning half back to 2.4.1 fails against naga's requirement. Both directions are dead ends while jcode-desktop2 depends on vello 0.9.

    That leaves the real options as:

    1. Jump to tract 0.23.x (0.23.4 is current), which drops the half pin. This is a major-version move across tract-onnx/tract-hir and needs jcode-embedding checked against API changes.
    2. Scoped ignore for RUSTSEC-2026-0217 with a documented rationale. I checked the exposure before suggesting this and it is less comfortable than I first assumed: jcode-embedding does not load a bundled model. load_from_dir calls download_model when model.onnx is absent, fetching from huggingface.co/sentence-transformers/all-MiniLM-L6-v2 over the network, then parses it with tract_onnx::onnx().model_for_path(...). So the parser does run over a downloaded artifact. The fetch is HTTPS from a fixed URL rather than user-supplied input, which limits it considerably, but it is not the "only parses bytes we shipped" case that would make an ignore obviously safe.
    3. Feature-gate the embedding stack so the default build does not pull tract at all.

    Given that, option 1 is more clearly the right answer than I initially thought, with option 2 defensible only as a short-term unblock with the download path noted. Either way the vello/half interaction means this is a real dependency decision rather than a mechanical bump, so I have not implemented it.

    Lockfile left untouched; this was investigation only.

    --- — Jcode agent (automated triage), on behalf of @1jehuang

  3. 1jehuang commented on Jul 29, 2026

    @1jehuang
    OwnerAuthor

    Update: #663 restores the rest of CI, so this advisory is now the only remaining failure on the Linux job.

    That confirms the sequencing you described. On #663 every test step passes (including the TUI --lib gate red since 5c70ac4c3), Quality Guardrails is green for the first time, and macOS/Windows are green. Security preflight then reports exactly one error-level finding:

    Crate: tract-nnef   ID: RUSTSEC-2026-0217   error: 1 vulnerability found!
    

    Everything else in that scan is warning-level (bincode, paste, rustybuzz, and the rest already in docs/SECURITY_DEPENDENCIES.md).

    I deliberately did not touch it. This is labeled autonomous: no, and the earlier investigation established the 0.21.16 bump is blocked by tract-data's exact half =2.4.1 pin against naga's half ^2.5 via the desktop2 GPU stack. Choosing between the tract 0.23 major bump, a scoped ignore, and feature-gating the embedding stack is a real dependency decision, especially given the earlier finding that jcode-embedding parses a downloaded ONNX artifact rather than a bundled one.

    Also worth acting on separately: this issue's own suggestion that Security preflight should not sit behind the full test suite. #663 fixed two more gates that were failing invisibly for the same structural reason, including a warning-budget check that had been passing vacuously because rg is not installed on the runner and the script's fallback turned "command not found" into "zero warnings". Ordering-dependent gates keep hiding real findings here.

    --- — Jcode agent (automated triage), on behalf of @1jehuang

  4. 1jehuang commented on Jul 30, 2026

    @1jehuang
    OwnerAuthor

    Update: I revisited the tract 0.23 option and it is far cheaper than the earlier analysis suggested. PR: #666 (stacked on #663).

    Your dependency analysis was correct and I re-confirmed it: tract-data 0.21.16/0.21.17 pin half =2.4.1 exactly against naga/vello's half ^2.5, so the in-line fix really is unreachable. What changed is the cost of option 1. It is three compiler-directed renames, not a migration:

    • SimplePlan<TypedFact, Box<dyn TypedOp>, Graph<..>> becomes Arc<RunnableModel<TypedFact, Box<dyn TypedOp>>> (0.23 dropped the third type parameter, and into_runnable returns the Arc alias directly)
    • TValue::to_array_view becomes to_plain_array_view, 2 call sites

    jcode-embedding is the only consumer, so the diff is 3 files including Cargo.lock. scripts/security_preflight.sh --strict now passes, and cargo tree -i tract-nnef shows 0.23.4.

    I chose this over the scoped ignore for the reason recorded earlier in this issue: load_from_dir downloads model.onnx from huggingface.co and parses the fetched artifact, so the vulnerable NNEF parser runs over data retrieved at runtime, which is not the "only parses bytes we shipped" case that makes an ignore obviously safe.

    On verification, and its limit. A major bump of an inference dependency can compile perfectly and still produce garbage embeddings, so the compile is not the interesting evidence. The local MiniLM model happens to be present on this machine, which means minilm_related_beats_unrelated_if_present actually ran rather than taking its skip path, and its cosine-similarity assertion against the real model still holds. The --ignored latency probe also runs real inference end to end.

    The limit: that test silently skips when the model is absent, including on CI. So the embedding-quality evidence comes from my machine, not the pipeline. That is the same "gate that looks green because it never ran" pattern #663 found in the warning budget, and it is worth making the model a CI fixture separately.

    This stays your call, which is why I said so in the PR: if you would rather ship a scoped ignore and schedule the upgrade deliberately, #666 can simply be closed. But the option that looked expensive turned out not to be.

    --- — Jcode agent (automated triage), on behalf of @1jehuang

  5. 9 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    autonomous: nobugpriority: hightriage: needs-decision

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions