Skip to content

fix(publish-gate): match a credential split across a line break - #11615

Merged
kyle-sexton merged 3 commits into
mainfrom
work-resolve-issue/issue-8806-41215903687-1
Oct 31, 2026
Merged

kyle-sexton merged 3 commits into
mainfrom
work-resolve-issue/issue-8806-41215903687-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #8806

Summary

Opened by the work-resolve-issue lane. The run's own summary:

findSecret now also reads each pair of adjacent lines joined, raw and normalized, using a new JOINABLE list, and a hit names the pair's first line. JOINABLE is the blocking set the leak scan's straddles already used: every secret pattern except the OpenAI key, the R2 key pair and the warn-only assignment. straddles now reads that same list. I followed the recorded decision (leave out the OpenAI key and the R2 key pair, as straddles does) rather than the body's plan to split the R2 regex, so a split secretAccessKey assignment is still read one line at a time. MACHINE_PATTERNS stay per-line, as the body asks. The leak scan's classify and credentialIn now call the per-line firstHit, so scanLeak behaves as before (deeperLeak still joins lines raw). This keeps the joined, normalized pass out of latin1 text, where NFKC turns UTF-8 continuation bytes into letters, and out of raw diffs that still carry their hunk prefixes. #8811, which this issue was blocked by, is closed as completed by #11570.

Not verified

  • lib/publish-gate.test.sh (the new split-line cases, the controls and the tracked-tree false-positive test) was not run: this lane cannot run node. Left to the PR's CI
  • The CI shared-copy sync check and scripts/check-changelog-fragments.sh --check were not run as CI runs them; the local wrappers above passed. Left to the PR's CI
  • The changelog fragments were written by hand: scripts/new-changelog-fragment.sh --carriers-of lib/publish-gate.mjs patch refuses on a detached HEAD. They follow its format and check-changelog-fragments validates them
  • Tidy skipped: the change touches lib/, a listed shared path, and spans 3 areas (lib, plugins/review, plugins/visualization), over the 1-area cutoff
  • Review note not acted on: a line ending in sk-ant- followed by 20 or more token characters on the next line now hits the Anthropic key pattern in findSecret. The decision excludes only the OpenAI and R2 patterns, and the leak scan's straddles already behaved this way
  • Review note not acted on: publishGate on a raw unified diff (review's digest-policy.mjs) still misses a token split across two added lines, because the + prefixes stay in the joined text. The issue does not ask for diff-aware joining
  • Review note not acted on: a tag or entity cut by the line break itself (<span on one line, class=...> on the next) is not removed, because each line is normalized before the join

Fix

  • lib/publish-gate.mjs: adds JOINABLE and a joined-pair pass in findSecret (helpers linesOf, firstIn, pairs); straddles reads JOINABLE; classify and credentialIn call firstHit(SECRET_PATTERNS, text) so the leak scan is unchanged
  • lib/publish-gate.test.mjs: new 'split lines' cases: a GitHub and a Cloudflare token broken by LF or CRLF are caught on the pair's first line; a token broken by a line break and a tag is caught; the gate keeps such a view local and refuses the host; the leak scan blocks a split token. Controls: a 32-
  • plugins/review/lib/publish-gate.mjs: regenerated by sync-shared-copies
  • plugins/visualization/lib/publish-gate.mjs: regenerated by sync-shared-copies
  • .changes/review/fix-8806-publish-gate-split-lines-4b9d27e1.md: patch fragment (Fixed)
  • .changes/visualization/fix-8806-publish-gate-split-lines-4b9d27e1.md: patch fragment (Fixed)

Verification

The runner ran each check from the base copy against 117829e:

  • scripts/check-changelog-fragments.sh --check: passed

The run reports:

  • read https: //github.com/melodic-software/claude-code-plugins/issues /8811: closed as completed on 2026-10-31 by #11570, so the blocker has landed
  • .lane/verify/bin/sync-shared-copies: generated both plugin copies, exit 0 (run after each edit to lib/publish-gate.mjs)
  • .lane/checks/bin/check-changelog-fragments: all 29 fragments valid (run before and after the review fixes)
  • .lane/checks/bin/check-affected: 11 passed, 7 skipped, 0 failed over 6 changed files (run before and after the review fixes)
  • Grep (multiline) over the checkout for the false-positive shapes the joined pass could add: a credential prefix at line end followed by token characters, a private-key header split across lines, and an assignment keyword, = or : and quoted value split across lines. Only the assignment pattern is not
  • Fresh-context review subagent over the diff: found that the leak scan gained the joined pass through findSecret, and that the first R2 control samples would pass even with R2 joined. Both fixed; its remaining notes are listed in not_done
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/41215903687

Left out: the items under Not verified.

Related

#8806

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 5c06e2b4e65c3d60a0f441e22a25d63903c1264a: 0 finding(s), 0 as inline comments.

No security findings. I reviewed the incremental change since ac83221, which is the same edit in lib/publish-gate.mjs, plugins/review/lib/publish-gate.mjs and plugins/visualization/lib/publish-gate.mjs. It removes the load-time check that threw if WARN_ONLY or UNJOINABLE named a label missing from SECRET_PATTERNS, and rewrites the comment above it.

I read the remaining consumers in lib/publish-gate.mjs (lines 64-67, 136, 149-150, 173-223) and the test lib/publish-gate.test.mjs (lines 262-264).

  • Fails closed. A renamed UNJOINABLE label means that pattern is also read across joined adjacent lines, which is stricter. A renamed WARN_ONLY label means the assignment pattern is no longer downgraded to a warning and blocks instead, since BLOCKING and findSecret keep it. The WARN_PATTERN lookup uses ?. and if (... || !WARN_PATTERN), so a missing label does not throw or skip a block.
  • Still checked. lib/publish-gate.test.mjs:264 asserts that every one of these labels exists in SECRET_PATTERNS, so a rename still fails in CI. I did not read the test the new comment cites, callers.test.mjs.
  • No new input path. The change adds no attacker-controlled input, no widened trust, no token scope, and nothing that can bill.

The trusted-path match on lib/publish-gate.mjs is not a finding on its own. I did not check whether the other copies of this file in the repo are identical.

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 117829eabff1d051ac387fe912ee9e71565723f8; the summary is in this lane's pull request comment.

claude-lane: claude-review

Comment thread lib/publish-gate.mjs Resolved
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 5c06e2b4e65c3d60a0f441e22a25d63903c1264a: 0 finding(s), 0 as inline comments.

Incremental review of the change since 117829e: no findings.

The change makes the gate's pair pass (findSecret) read the password or secret assignment pattern on adjacent lines joined. Before this, only the OpenAI key, the R2 key pair and the assignment were left out of that pass. UNJOINABLE now holds just the OpenAI key and the R2 key pair. The leak scan's split-line pass (straddles) still leaves the assignment out, because it only warns on it. WARN_ONLY moved up and is exported. The two plugin copies match lib/publish-gate.mjs, and both changelog fragments now describe the new behaviour correctly.

I checked this by reading the code, not by running it:

  • Callers: classifyLine calls findSecret on single lines, where pairs is empty. The leak scan's behaviour is therefore unchanged, and the new test that expects {} from scanLeak on a split assignment is consistent with the code, in plain and diff mode.
  • Other findSecret callers: pr-verify/write-verdict.mjs and pr-review-main/write-verdict.mjs now also see the joined assignment. A verdict where a line ends in token: or password = and the next line opens with a quoted 8-or-more-character word would now be refused. That fits the stated intent (any label from the gate keeps a view local or refuses the host), and the committed tracked-tree test (lib/publish-gate.test.mjs:362-379) measures it. I judged it too narrow to flag.
  • New tests: the split-assignment sample joins to "password":"hunter2hunter2", which matches the pattern. It reports [WARN_ONLY, 1] and would fail if the pair pass left the assignment out. The label-existence test guards against a renamed label.
  • Closing issue fix(publish-gate): match a credential split across a line break #8806 criteria: the split-credential case, the 32-hex and 64-hex control, the sk- control, the prose control, the tracked-tree false-positive test and the sync and fragment items are all met. The test cases exist; I did not run them.

Nothing here can start a real charge, and nothing needs a person's decision.

Lane-Activity: pr-unblock/address-feedback
Lane-Thread: PRRT_kwDOTCGFQM6ySWjk
@melodic-automation-lanes

melodic-automation-lanes Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head ac83221ee9119c5bab5c4f061480f318c9126eb2. The lanes clear this reason on their own; the next scheduled run judges it again.

pr-merge's gate refuses its verifier verdict (verify:missing)

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 1 of max 4 on ac83221.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 5c06e2b4e65c3d60a0f441e22a25d63903c1264a.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 31, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 31, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot removed this pull request from the merge queue due to a manual request Oct 31, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit 97b907d Oct 31, 2026
43 checks passed
@kyle-sexton
kyle-sexton deleted the work-resolve-issue/issue-8806-41215903687-1 branch October 31, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(publish-gate): match a credential split across a line break

1 participant