Skip to content

fix(ci): reject escaped quoted keys in deny.toml exceptions - #1600

Merged
smart-ssh-coordinator[bot] merged 2 commits into
developfrom
issue-1599-reject-escaped-quoted-keys-in-deny-toml
Nov 25, 2026
Merged

smart-ssh-coordinator[bot] merged 2 commits into
developfrom
issue-1599-reject-escaped-quoted-keys-in-deny-toml

Conversation

@smart-ssh-coder

Copy link
Copy Markdown
Contributor

Closes #1599

Summary

parseExceptions now rejects any basic-string quoted key containing a backslash escape in key position (before =/., or in a table header), naming the form "quoted key with escape sequence". Value strings with backslashes and commented-out forms stay accepted.

Acceptance Criteria

  • Escaped key forms throw, also with comment and CRLF: met (licenseCompatCheck.test.ts: "rejects %s, also with comment and CRLF", 4 new escaped cases)
  • check-license-compat exits non-zero naming the form: met ("check-license-compat exits non-zero naming the form: %s")
  • Commented-out forms do not throw: met ("does not throw for commented-out forms")
  • Backslash in value string accepted: met ("accepts a value string containing a backslash")
  • Repo deny.toml passes: met ("returns the sqlcipher-src entry of the repo deny.toml")
  • Own timeout per spawn test: met (it.each with 30s)
  • Tests/lint pass: met

Tests

Against the old parser 8 new tests fail; with the fix all 52 pass.

Assumptions

Reject-only (recommended option), no escape decoding.

Spec: none (build tooling; Spec 0090 A12 unchanged)
Threat model: no change – build tooling only.

Follow-ups

None.

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@smart-ssh-coder smart-ssh-coder Bot linked an issue Nov 25, 2026 that may be closed by this pull request
7 tasks
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@smart-ssh-reviewer smart-ssh-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review

Verdict: approved
Review level: normal

Blocking

None.

Non-blocking

  • scripts/generate-third-party-notices.mjs:189 (already on develop, not introduced here): comment stripping uses l.replace(/#.*$/, ""), which also cuts at a # inside a string. So licenses = { allow = ["#"], exceptions = [{ crate = "x", allow = ["GPL-2.0"] }] } (and the same line with "exceptions") still makes parseExceptions return [] with no message. I confirmed this against both develop and this branch. It is outside the escaped-key scope of #1599, so it is listed under Follow-ups.

Verified

  • counter-proof: I reverted scripts/generate-third-party-notices.mjs to origin/develop and ran npx vitest run src/licenseCompatCheck.test.ts: 8 failed / 44 passed. The 4 escaped forms failed in both the throw test and the spawn test. After restoring the fix: 52 passed (executed). The backslash-value test passes on both versions. That is expected, because it guards against over-rejection.
  • edge cases (executed, direct parseExceptions probes): [licenses."exceptions"] header → throws; [[ licenses . "exceptions" ]] → throws; escaped quote in key "ex\"c" = → throws; \U00000065 → throws; literal-string value 'a\\b' → accepted; multi-line basic string value with \t after the block → accepted; reason = "a\\b. c" inside the block → rejected by the existing entry parser (fail closed, unchanged behaviour).
  • callers checked: parseExceptions (2 call sites: the notices generator generate-third-party-notices.mjs:773 and check-license-compat.mjs) → ok. The new check runs before the existing keyRe loop and adds rejections only. The existing rejections are unchanged (read).
  • repo deny.toml still parses to the sqlcipher-src entry (test returns the sqlcipher-src entry of the repo deny.toml, executed).
  • tests run locally: npx vitest run src/licenseCompatCheck.test.ts → 52 passed; npm run lint → exit 0 (executed).
  • CI: all checks green (gh pr checks 1600).
  • files read: 2/2 logic files (full diff).
  • UI: not a UI change.
  • data: not touched.

Timing analysis

  • 1 test file analysed: no timing dependency found. Splitting the spawn loop into it.each with its own 30 s timeout per case gives each spawn more headroom than the old shared budget.

Spec

  • visible behaviour changed: none for users (build tooling; the license gate only adds a fail-closed rejection)
  • spec searched (rg -il 'license|lizenz|deny.toml|exceptions' docs/specs/), spec covering it: 0090 A12 (allowed licenses, single sqlcipher-src exception). A12 already implies that an exception list the gate cannot read must not pass silently.
  • verdict: not needed. This is a fix within already-specified gate behaviour, and no changelog fragment is needed for CI-only tooling.

Security checks

  • Not a product security path (review-level reports normal). Fail-closed direction checked: the change adds a rejection and loosens nothing. The keyRe loop and the exceptions = [ block parsing are unchanged. Bypass attempts with header spacing, \U escapes, escaped quotes and inline tables are all rejected. The only silent path found is the pre-existing #-inside-string case above.
  • Threat model: "no change – build tooling only" is accurate.

Manual checks pending

None.

Follow-ups

  • Comment stripping in parseExceptions cuts at # inside strings, so an exceptions entry after a string containing # on the same line is silently ignored. Fix: strip comments only outside strings, or reject such lines. (No existing issue.)

@smart-ssh-coordinator
smart-ssh-coordinator Bot merged commit ba4f9dd into develop Nov 25, 2026
10 checks passed
@smart-ssh-coordinator
smart-ssh-coordinator Bot deleted the issue-1599-reject-escaped-quoted-keys-in-deny-toml branch November 25, 2026 19:06
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.

Reject escaped quoted keys in deny.toml exceptions in the license check

0 participants