LearnNewsExamplesServices
Frontmatter
id18913
titleA secret-scan-ok marker in a closed comment passes without a reason
stateClosed
labels
bugaibuildsecurity
assigneesneo-opus-ada
createdAtSep 18, 2026, 5:57 PM
updatedAtSep 18, 2026, 6:24 PM
githubUrlhttps://github.com/neomjs/neo/issues/18913
authorneo-opus-ada
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 18, 2026, 6:24 PM

A secret-scan-ok marker in a closed comment passes without a reason

Closed v13.2.0/archive-v13-2-0-chunk-22 bugaibuildsecurity
neo-opus-ada
neo-opus-ada commented on Sep 18, 2026, 5:57 PM

Context

Successor of #18832, which PR #18906 resolved. @neo-opus-grace found this in her review of #18906 (review 5249734191). Measured at dev@3bd9c46e8f.

The Problem

check-secrets lets a line keep a credential-shaped literal if the line carries secret-scan-ok: <reason>. A marker without a reason is reported as allow-marker-without-reason (#18832, AC-5). The guard takes everything after the marker, up to the end of the line, as the reason. So a comment's own closing token counts as one.

findSecrets on a synthetic key-shaped line:

Marker on the key's line Result
// secret-scan-ok: allow-marker-without-reason
<!-- secret-scan-ok: --> nothing: the key is excused
/* secret-scan-ok: */ nothing
{/* secret-scan-ok: */} nothing
<!-- secret-scan-ok: a revoked sample --> nothing (correct)

The incident behind #18832 was in a Markdown file. There, an HTML comment is exactly the form a marker takes.

The Architectural Reality

  • buildScripts/util/check-secrets.mjs: allowRE = /secret-scan-ok:\s*(\S.*)?$/. findSecrets accepts any captured text as a reason.
  • The marker is read on every line, before the patterns and independently of them. The guard's own export const ALLOW_MARKER = 'secret-scan-ok:'; line carries it, followed by ';. A rule that only demands a letter would therefore report that line (Grace's second point).
  • No other tracked file uses the marker (git grep, outside the guard and its spec).

The Fix

  • A reason is text with at least one letter or digit. Closers and punctuation (-->, */, */}, ';) are not a reason.
  • Read the marker only on a line that carries a credential-shaped match. There, a marker with a reason excuses the line, and one without a reason is allow-marker-without-reason. On any other line a marker excuses nothing, so there is nothing to report. That also leaves the definition line alone.
  • Spec additions:
    • one row per closer: a finding;
    • a closed comment with a reason: excused;
    • a reasonless marker on a credential-free line: no finding.

Acceptance Criteria

  • AC-1: <!-- secret-scan-ok: -->, /* secret-scan-ok: */ and {/* secret-scan-ok: */} on a key's line each report allow-marker-without-reason. Each arm is red on dev.
  • AC-2: a closed comment with a reason still excuses its line, and // secret-scan-ok: still reports.
  • AC-3: --all over the tracked tree stays clean, the guard's own source included.

Out of Scope

  • A guard run through a symlinked path exits 0. node <symlinked checkout>/buildScripts/util/check-secrets.mjs <file with a key> exits 0 silently, while the same file through the real path exits 1 (measured). The CLI block compares process.argv[1] with fileURLToPath(import.meta.url) without resolving symlinks, and sibling guards use equivalent comparisons. lint-staged and CI invoke the guard by a relative path. This is captured as a defect-note, and gets its own ticket if promoted.
  • Whether a one-word reason is an honest one. A reviewer reads the reason in the diff, as #18832 designed.

Related

#18832 · PR #18906

Live latest-open sweep: latest 20 open issues at 2026-09-18T15:57Z, plus an all-state search for secret-scan-ok / check-secrets / "allow marker": no equivalent. A2A sweep (latest 15, all read-states): no claim on this scope. Memory Core: no prior decision. Own open assignments: none on this guard.

Origin Session ID: 6ed6621f-e2e4-4b9d-9a95-744679cb3c59

Retrieval Hint: "secret-scan-ok marker comment closer reason check-secrets"