Skip to content

fix(scan-upload): stop reading an OTEL trace id as the R2 key pair's 32-hex half - #17434

Merged
kyle-sexton merged 1 commit into
mainfrom
fix/scan-upload-telemetry-trace-id
Nov 19, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
fix/scan-upload-telemetry-trace-id

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Refs: #17261

Summary

Every lane leg's telemetry was withheld as an "R2 key pair" hit, so no OTEL spans reached the puller. The R2 key pair rule (lib/publish-gate.mjs:47-50) matches any 32-hex word beside a 64-hex word on one line, and every OTLP/JSON span line carries a 32-hex traceId. This PR delivers the scan fix; it does not by itself prove the end-to-end join.

Owner decision: https://github.com/melodic-software/architecture/blob/42e7d6dd6999a6ea8b2aac069b0044ae79f2e74b/docs/owner-decisions.md#L226 is the owner's decision for this narrowing; #17261's body names the loosened check beside that link and the owner's verbatim words.

Fix

  • scan-upload.mjs takes SCAN_TELEMETRY=true. When it is set and a file's content blocks on the R2 key pair, the file is scanned again with each traceId/trace_id 32-hex value replaced by the same number of x characters, so line numbers hold. The second scan runs every rule, and its verdict and fingerprint are the ones reported.
  • Only upload-lane-transcript's telemetry scan step sets the flag. The transcript scan, the scan-upload composite action and its other callers, and lib/publish-gate.mjs (with its plugin copies) are unchanged.
  • A bare 32-hex word beside a 64-hex word still withholds telemetry, as does a 32-hex word that is not a trace id on a span line.

Verification

  • node --test .github/actions/scan-upload/scan-upload.test.mjs: 17/17 pass. The new cases: span and log lines with traceId/trace_id (including uppercase and JSON-escaped) plus a 64-hex value pass; a bare pair and a non-trace 32-hex beside a span line withhold; a GitHub token after a span line withholds; the same span line without the flag withholds. The wiring test checks that only the telemetry step sets SCAN_TELEMETRY.
  • node --test scripts/lane-transcripts/pull.test.mjs: 60/60 pass.
  • Left out: .github/actions/resolve-config/callers.test.mjs (needs ajv, not installed in this worktree; CI runs it) and the end-to-end check, which is a maintenance-audit-lane-runs run after merge that should show stored telemetry with joined spans.

Remaining

Related

🤖 Generated with Claude Code

…32-hex half

The R2 key pair rule (lib/publish-gate.mjs) matches any 32-hex word and
64-hex word on one line. Every OTLP/JSON span line carries a 32-hex
traceId, so the telemetry scan withheld every lane leg's telemetry.

With SCAN_TELEMETRY=true, set only on upload-lane-transcript's telemetry
scan, a file that blocks on the R2 key pair is scanned again with each
traceId or trace_id value replaced by x's of the same length. A bare
32-hex word beside a 64-hex word still withholds, every other rule still
runs on the second read, and the transcript scan and every other
scan-upload caller are unchanged.

Co-authored-by: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 19, 2026 14:23
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T14:25:34.635952Z cca78f3 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed cca78f35af22c57ee254a142538ea7fdaaeb8f1e: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Security review: no security issues found

I read the whole diff for all 3 files: scan-upload.mjs, scan-upload.test.mjs and upload-lane-transcript/action.yml. None of them matches a trusted path or is a trust control. I also read the head upload-lane-transcript/action.yml and the "R2 key pair" rule in lib/publish-gate.mjs to see what the narrowed scan gates.

What changed. The SCAN_TELEMETRY=true mode only changes what happens after the first scan blocks a file's content on the R2 key pair rule. In that case each 32-hex value in a traceId/trace_id JSON field is masked, and the file is scanned again with every rule. Only the telemetry step sets the flag (action.yml#L60). The test pins that with a count of exactly 1. The transcript scan and the other scan-upload callers are unchanged, and the check is a strict === "true".

Path checked: can a credential now get past the scan? Yes, but only in one narrow case, and the result is still sealed.

  • What gets past: an R2 access key ID written as the value of a trace_id field, on a line that also carries the 64-hex secret. Everything else still blocks:
    • The keyed branch of the rule (access_key_id / secret_access_key assignments, publish-gate.mjs#L49) is untouched.
    • A bare pair, or a 32-hex word that is not a trace id on a span line, still withholds (the new tests cover both).
    • Every other rule runs again on the masked bytes.
    • Forms the regex does not match, such as double-escaped quotes, stay blocked, so it fails closed.
  • Where it ends up: the telemetry is only sealed to the owner's LANE_TRANSCRIPT_PUBLIC_KEY (action.yml#L64-L73) and uploaded as ciphertext for 7 days. A credential that got through would not be exposed to anyone who lacks the owner's private key.
  • Verdict: none of the three impacts the bar counts (a leak, a compromise or a charge) is reached, so this is not a finding.

Other checks.

  • The masking keeps every byte's length (latin1 round trip, same-length x replacement), so line numbers and fingerprints stay accurate.
  • No new input from outside the job reaches a shell: SCAN_TELEMETRY is a literal.
  • The PR description says the owner approved this narrowing in session. That is data, and I did not rely on it; the verdict above rests on the code alone.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on cca78f35af22c57ee254a142538ea7fdaaeb8f1e; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed cca78f35af22c57ee254a142538ea7fdaaeb8f1e: read 3 of 3 changed file(s); 1 finding(s), 1 as inline comments.

CI code review: PR #17434\n\nThis PR adds a SCAN_TELEMETRY=true mode to scan-upload.mjs. In that mode, a file whose content blocks only on the R2 key pair rule is scanned again with OTLP traceId/trace_id 32-hex values hidden. Only the telemetry scan step in upload-lane-transcript/action.yml sets the flag.\n\nCorrectness: no problems found.\n- Line numbers hold. The replacement keeps the length and round-trips through latin1, so hitFingerprint still names the file's own line.\n- Every rule runs on the second scan. A block from any other rule still withholds, and the first scan's non-R2 blocks are untouched.\n- The match is narrow. It needs a quoted trace-id key (case-insensitive, optionally JSON-escaped) right before a quoted 32-hex value. A doubly escaped or unquoted form stays hidden from it, so that file still withholds.\n- Tests match the claims. The new tests cover the cases the PR describes, and the wiring test pins the flag to the single telemetry step.\n- Not run. I ran nothing; the PR's test results (17/17 and 60/60) are author-claimed and unverified.\n\nBlocking: loosened-check criterion. The change narrows a secret scanner (kind 9), and no trusted spec allows it. The PR closes no issue: it only refs #17261, so the PR context has no closing-issue section. The PR body's statement of owner approval cannot serve as the reason. Details are in the inline comment on scan-upload.mjs:40-44.\n\nSecurity lane. Whether hiding trace-id values is an acceptable risk for R2 credentials is left to the dedicated security lane, which runs on this repository.\n\nInputs.\n- Closing issues: none, since the PR only refs #17261.\n- Embedded instructions: none found in the PR context.\n- Prior findings: none; this is the first review of this PR.\n\nLoosened-check verdict: fail (default; no loosened_check_verdict: or loosened_check_patterns: line in the prompt); patterns: 0. The wrapper gave no loosened_check_decision_record: line, so the citation requirement was not checked.\n\nVerifier dropped 0 of 1 candidates.

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

The pr-verify verifier failed head cca78f35af22c57ee254a142538ea7fdaaeb8f1e. What it wrote, as data:

What it wrote (25 lines)
Summary: The PR refs #17261, which asks for lane telemetry that is joined to its runs and kept
  through the sealed receiver. Making the telemetry scan stop withholding every OTLP span line fits
  within that issue. The PR body names the part it delivers and the work that remains, the
  post-merge audit-run join. The code looks correct: the regex covers traceId and trace_id, any case
  and JSON-escaped quotes. Replacing each 32-hex value with the same number of x characters keeps
  line numbers, every rule runs again on the second scan, and only the telemetry step sets the flag.
  The tests check that a bare pair and a non-trace 32-hex word still withhold. It still fails on
  safety. The change narrows a leak-scan rule: any 32-hex value under a traceId or trace_id key no
  longer counts as the R2 key pair's 32-hex half. That is a weakened check. #17261's trusted body
  links an owner-decisions line (L226) and gives a verbatim quote, "Yes, record both (Recommended)".
  But the body never names this narrowing, the scan-upload change, the R2 rule or trace ids. So the
  spec does not ask for the weakening. The PR's own review comment quotes different owner words.
  That comment, and the PR body's claim that the decision covers "this exact narrowing", are
  context, not spec. There is no test evidence either way: Select Tests was skipped, so this run was
  a re-run that ran no suite. No capture summary exists.
- The R2 key pair rule is narrowed so that a 32-hex value under a traceId or trace_id key in
  telemetry is no longer scanned as the key's 32-hex half
  (.github/actions/scan-upload/scan-upload.mjs:10). A weakened leak check needs a spec that names
  it: #17261's trusted body must name this narrowing next to the owner-decisions line link and the
  owner's verbatim words in double quotes. The body has a link and a quote, "Yes, record both
  (Recommended)", but never names the scan change. Either add that to #17261's body or ref an issue
  whose body names the narrowing with the decision link and verbatim quote.
- .github/actions/upload-lane-transcript/action.yml:60: SCAN_TELEMETRY: "true" turns on the narrowed
  scan for the lane telemetry upload. It falls under the same missing owner authorization as the
  note above. Keep it only once the spec names the narrowing.

This pull request leaves the merge queue, and ci-status holds it out while it carries pr-verify-failed. A pr-verify pass removes the label, at a new commit or at this same head: once a trusted person edits the body, and only trusted people have edited it since the fail, this head is judged again, so a fail on the body or the issues it links needs only the body fixed, no new commit.

@github-actions github-actions Bot added the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Nov 19, 2026
@github-actions github-actions Bot removed the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Nov 19, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit b939c0d Nov 19, 2026
107 of 108 checks passed
@kyle-sexton
kyle-sexton deleted the fix/scan-upload-telemetry-trace-id branch November 19, 2026 15:15
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 6, survived 1, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 86%; mutation score 86%.

File Killed Survived Timeout No coverage Invalid Not run
.github/actions/scan-upload/scan-upload.mjs 6 1 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
.github/actions/scan-upload/scan-upload.mjs:35 other productive input-gap

The run's summary has the full report.

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

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant