Skip to content

chore(agent): //agent:security:image red on 14 fixable HIGH/CRITICAL — bundled gh/uv/npm binaries, hidden behind the masking short-circuit #897

Open

Description

@scottschreckengaust

Summary

mise run security — the task the pre-push hook runs (hooks:pre-push:security) — has a
failing leg that nobody has seen, because the aggregate stops at the first failure and
security:sast:masking (4th of 8) fails first. Running the legs individually exposes it:

MISE_EXPERIMENTAL=1 mise //agent:security → rc=1, at its security:image step. bandit
passes ("No issues identified"). Trivy reports 14 HIGH/CRITICAL fixable vulnerabilities, none
of them in this repo's own source, and none in the Debian base (debian 13.7 → 0 findings).

Measured 2026-09-15 on fix/879-insecure-object-assign @ a382fca2 (a merge of main
25330c72), mise 2026.9.9, trivy 0.70.0. That branch's diff vs main is two files, both under
cdk/ — zero files under agent/ or any Dockerfile — so the image inputs are byte-identical
to main and this is a main-state finding, not a PR regression.

Scanner invocation (from agent/mise.toml):

docker build --build-arg TARGETPLATFORM=linux/arm64 -f Dockerfile -t bgagent-local:latest ..
trivy image --scanners vuln --ignore-unfixed --ignorefile .trivyignore --severity HIGH,CRITICAL --exit-code 1 bgagent-local:latest

Findings, grouped by what actually ships them

# Target Type Provenance
9 usr/local/bin/gh gobinary agent/Dockerfile:2 ARG GH_VERSION=2.93.0, built from source in the gh-builder stage (line 27)
1 usr/local/bin/uv rustbinary agent/Dockerfile:99 COPY --from=ghcr.io/astral-sh/uv:0.11.14@sha256:1025398…
4 usr/lib/node_modules/npm/** node-pkg agent/Dockerfile:89 npm install -g npm@latest — npm's own bundled deps

gh 2.93.0 — vendored Go modules (9)

Library Advisory Installed Fixed
github.com/sigstore/rekor CVE-2026-48702 v1.5.0 1.5.2
golang.org/x/crypto CVE-2026-56854 v0.52.0 0.55.0
golang.org/x/mod CVE-2026-56864, CVE-2026-56865 v0.36.0 0.40.0
golang.org/x/net CVE-2026-46600 v0.55.0 0.56.0
golang.org/x/text CVE-2026-56852 v0.37.0 0.39.0
google.golang.org/grpc CVE-2026-84304, CVE-2026-84445, GHSA-hrxh-6v49-42gf v1.81.1 1.83.1 / 1.82.2 / 1.82.1

uv 0.11.14 (1)

Library Advisory Installed Fixed
quinn-proto GHSA-4w2j-m93h-cj5j (remote memory exhaustion, unbounded out-of-order stream reassembly) 0.11.14 0.11.15

npm's bundled dependencies (4)

Package Advisory Installed Fixed
brace-expansion CVE-2026-14257, CVE-2026-69152 5.0.7 5.0.8 / 5.0.9
ip-address CVE-2026-69192 10.2.0 10.3.1
tar CVE-2026-73566 7.5.19 7.5.21

Why this has stayed invisible

Three independent reasons, which is why it needs its own issue rather than a note on an existing one:

  1. Aggregate short-circuit. mise run security runs security:secrets → deps → sast →
    sast:masking → grype → retire → gh-actions → //agent:security. Whole-repo
    sast:masking is red on main (6 pre-existing findings, chore(security): clean up 21 pre-existing silent-success-masking findings on main #756/25 pre-existing masking findings on main fail the pre-push gate, forcing --no-verify for every contributor #766), so execution never reaches
    the last leg. The practical consequence: "fix the masking findings and pre-push goes green" is
    false
    — the next wall is this one.
  2. CI never runs it on a PR. Per feat(ci): scan container image + SAST on PRs — weekly-only cadence let a HIGH CVE sit on main for 6 days #235, build.yml sets
    MISE_DISABLE_TOOLS: "aqua:aquasecurity/trivy,grype,semgrep", and image scanning happens only in
    the weekly security.yml cron. So PR checks are 8/8 green with these 14 live.
  3. --ignore-unfixed means every one of these has a published fix. They are not
    wait-for-upstream noise.

Proposed remedies

Per target, because they are three different kinds of problem:

  • gh — bump ARG GH_VERSION past 2.93.0 to a release whose go.mod carries the fixed
    golang.org/x/*, grpc, and rekor versions, and confirm by re-scanning rather than by
    changelog. Because the binary is compiled from source in-image (go install …@vX), the vendored
    set is whatever that tag pins — a version bump is the only lever; there is no separate dep file
    to patch.
  • uv — bump the pinned digest to ≥ 0.11.15 (ghcr.io/astral-sh/uv:0.11.15@sha256:…).
    Smallest, most mechanical fix of the three.
  • npm's bundled deps — npm@latest already ships them, so there is nothing to bump. The repo
    already has a precedent for exactly this at agent/Dockerfile:92
    (npm --prefix "${CLAUDE_NPM_ROOT}" update tar minimatch glob cross-spawn picomatch for the
    claude-code tree). Extending that treatment to npm's own node_modules, or dropping targeted
    .trivyignore entries with an expiry and a linked upstream issue (the lifecycle feat(agent): CVE suppression lifecycle — scheduled re-scan of .grype.yaml ignores #131 asks
    for), are the two honest options.

Acceptance criteria

  • MISE_EXPERIMENTAL=1 mise //agent:security exits 0 on main.
  • Any residual suppression lives in .trivyignore with a justification, an upstream link, and
    an expiry date — not a blanket severity downgrade.
  • A regression note records that mise run security's short-circuit hides later legs, so future
    "the security gate passes" claims are made leg-by-leg.

Related

Activity

  1. added
    bugSomething isn't working
    securityCedar/HITL, IAM least-privilege, secrets, PII/DLP, guardrails, supply-chain/CVE
    v1Version 1
    on Sep 15, 2026
  2. laithalsaadoon commented on Sep 19, 2026

    @laithalsaadoon
    Contributor

    Ran the aggregate leg-by-leg on main @ 9d4beda8 tonight, which is what acceptance criterion 3 asks for. Two corrections to the short-circuit section, and one thing that changes the order of work.

    The first wall on main is step 3, not step 4

    [tasks.security] (mise.toml:223) is secrets (1), deps (2), sast (3), sast:masking (4), grype (5), retire (6), gh-actions (7), //agent:security (8). Measured at 9d4beda8 with semgrep 1.176.1, gitleaks and osv-scanner from the repo's own pins:

    Step Task Result at 9d4beda8
    1 security:secrets exit 0. 322 commits scanned, no leaks
    2 security:deps exit 0. 1,393 packages across the 3 lockfiles, no issues
    3 security:sast exit 1. 1 finding, 214 rules, 719 files
    4 security:sast:masking exit 1. semgrep test .semgrep/ 2/2 pass, placement checker passes, whole-tree scan reports 3
    5-8 grype, retire, gh-actions, //agent:security never execute

    Step 3's single finding is javascript.lang.security.insecure-object-assign.insecure-object-assign at cdk/src/handlers/linear-webhook-processor.ts:928, which is #879. The 2026-09-14 security.yml run agrees: run 34842090188 prints 1 Code Finding, the same rule at line 926 for that SHA, then [//:security:sast] ERROR task failed. Its task list shows secrets, deps and sast only.

    So the summary's sast:masking (4th of 8) fails first is branch state, not main state. It holds on a382fca2, which carries the #879 fix, so sast passes there and masking is genuinely first. On main there are three walls ahead of your leg, not two: #879/#880, then masking, then the image scan. The rest of the issue's framing is unaffected, since the branch diff really is two files under cdk/ and the image inputs really are byte-identical to main.

    Masking is 3 unsuppressed findings at HEAD, not 6

    agent/src/server.py:1447, cdk/src/handlers/shared/linear-oauth-resolver.ts:525, cdk/src/handlers/shared/orchestration-store.ts:350. #756 enumerates 21 items, of which one is still live (orchestration-store, then :344); the other two post-date that issue and arrived with #733 and #831. Worth pinning here because "6" sets the wrong size for wall 2.

    Wall 1 has a green fix that cannot merge

    Applied #880's change alone to 9d4beda8 (the const to let on the declaration plus channelMetadata = { ...channelMetadata, ...vaultMetadata(resolved) }) and re-ran step 3 over the same 719 files: 1 finding to 0, exit 1 to 0. Restored from a SHA-verified backup and confirmed an empty diff. So #880 on its own clears wall 1 and advances the chain to step 4.

    #880 is not draft, all 8 checks pass, and auto-merge (squash) has been armed since 2026-09-15T20:01:52Z. It still reports REVIEW_REQUIRED, and the ruleset explains why rather than any check:

    • The only approval, isadeks at 2026-09-14T17:00:34Z, was dismissed at 17:06:39Z. The main ruleset sets dismiss_stale_reviews_on_push: true.
    • Commits landed after that dismissal (1e7dcfd2..d4ec661b, then the main merge). With required_approving_review_count: 1 and require_last_push_approval: true, the author cannot satisfy it.
    • dismissal_restriction is disabled with zero allowed actors, so nothing bypasses it.

    Net: auto-merge is armed on a PR that cannot fire it, and it needs one approval from somebody other than its author. Nothing on this issue blocks on that, but it is the cheapest of the three walls and the only one already written.

    Two related artifacts nobody has connected to it: the auto-filed canaries #886 (main @ 5e10038) and #861 (main @ 12c9b63) are both open, and both are this same step-3 red.

    Two empty controls were caught while measuring this, in case anyone reproduces it. const channelMetadata: Record<string, string> = { appears 5 times in that file, one per builder, so a string-replace patch keyed on it silently does nothing and the re-scan reports the unchanged 1 finding, which reads exactly like a failed fix. Patch by line number (861 and 927-928 at this SHA) and assert the tree went dirty before believing the second number.

    drafted by Bonk

  3. scottschreckengaust commented on Sep 21, 2026

    @scottschreckengaust
    ContributorAuthor

    Implementing this — PR #910 (draft). MISE_EXPERIMENTAL=1 mise //agent:security is rc=0 locally; all 14 fixable HIGH/CRITICAL are cleared and agent/.trivyignore is untouched and still empty, so acceptance criterion 2 is met with nothing to expire.

    Two things in this issue's analysis did not survive measurement. Recording them here because both would have produced a fix that looked right and wasn't.

    1. npm install -g npm@latest does not ship the fixes. The issue reasoned that npm@latest already carries them, so there was nothing to bump. Measured on the built image: npm 12.0.2, today's latest, still bundles brace-expansion 5.0.7, ip-address 10.2.0 and tar 7.5.19 — the exact versions flagged. npm@latest is not a security control here.

    2. The npm --prefix <tree> update … precedent cannot be extended to npm's own tree. Not merely awkward — impossible. npm's published package.json declares @npmcli/docs@^1.0.0, a workspace-internal package that was never published, and Arborist resolves the whole declared graph before touching anything, so every npm-native operation inside npm's own node_modules dies at E404 @npmcli/docs. Verified for update, update --omit=dev, and install --no-save. npm's bundled node_modules is a build artifact, not an installable project. The fix is therefore a direct npm pack tarball overlay, with the pinned version treated as a floor (npm@latest floats, so a blind overwrite could silently walk a newer bundled dep backwards) and both failure modes hard-gated so it cannot decay into a silent no-op.

    Also worth correcting in the uv remedy: the advisory's "fixed in 0.11.15" is quinn-proto's version, not uv's. uv 0.11.14 happens to vendor quinn-proto 0.11.14, which makes the two look like a single number and invites a bump to "uv 0.11.15" that would fix nothing. The floor is a uv release vendoring quinn-proto ≥ 0.11.15; 0.12.17 vendors 0.11.18.

    A third invisibility mechanism, not in the issue

    The issue gives two reasons this went unseen — the local aggregate short-circuits, and PR CI does not run the image scan. There is a third, and it is the one that actually mattered:

    The weekly security.yml cron — the only surface that runs the container scan — invokes the same aggregate (mise run security, security.yml:67). A red early leg suppressed the image leg there too, and the issue that job auto-files names only the first failure. So the scan was not "unrun because nobody looked"; it was unreachable on every surface simultaneously.

    Demonstrated live while preparing this PR — mise run security from the branch stops at leg 3 of 8:

    [//:security:secrets]  no leaks found
    [//:security:deps]     No issues found
    [//:security:sast]     1 Code Finding  (cdk/.../linear-webhook-processor.ts:928)  ← #879, fixed by unmerged #880
    [//:security:sast] ERROR task failed
    

    security:sast:masking (leg 4) never ran; the image scan is inside leg 8. Which leg is red is therefore not stable — fixing the earlier one just uncovers the next — so the AGENTS.md note criterion 3 asks for documents the mechanism and the per-surface leg inventory rather than naming one leg.

    I did not change security.yml to de-short-circuit it: that is a CI edit, which AGENTS.md puts under "ask first", and it is outside this issue's scope. Recommend a follow-up to run the legs independently there so the auto-filed issue enumerates every failing leg.

    Scope note

    This PR claims only that the fixable set is empty. --ignore-unfixed is unchanged, so findings without a published fix remain hidden by design. And mise run security as a whole is still red pending #880 and #909 — stated leg-by-leg rather than as "the security gate passes", which is the habit this issue exists to break.

  4. krokoko commented on Nov 20, 2026

    @krokoko
    Contributor

    Triage: what this issue asks for is on main; a small leftover is noted at the end.

    The 14 findings are gone on main: #1048 (57b9aec) builds gh 2.103.3 with Go 1.27.4 and copies uv 0.13.7, #1052 (bf52b90) installs pip 26.3 and pins trivy 0.76.2, and npm@latest (12.2.3) now bundles fixed versions of brace-expansion, ip-address and tar. With the flags of //agent:security:image, an image built from the Dockerfile and lock file that are on main has no fixable HIGH or CRITICAL finding, and bandit passes; the first scheduled run of the weekly workflow after these merges is on 2026-11-23. Two later findings are accepted in agent/.trivyignore, each with a reason and an expiry of 2026-12-16, after which the scan fails again until the entry is removed or renewed. #1035 (7539ba1) makes the weekly workflow run every scanner after a failure and list each failed one in its rolling issue; a plain mise run security, as the pre-push hook runs it, still stops at the first failure, which the comment on the task in mise.toml records. Not done: the two entries have no upstream link and AGENTS.md has no note on that stop; scanning the image on pull requests remains #235 and the lifecycle of suppressions #131.

    Posted from an automated sweep of the open issues. Each pull request, commit and file named above was checked against main at 3dbfada1. The issue is left open for a maintainer to close.

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

Metadata

Metadata

Labels

approvedWhen an issue has been approved and readybugSomething isn't workingsecurityCedar/HITL, IAM least-privilege, secrets, PII/DLP, guardrails, supply-chain/CVEv1Version 1

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions