LearnNewsExamplesServices
Frontmatter
id18832
titleNo lint catches a committed credential, so GitHub''s scanner found the last one
stateClosed
labels
enhancementaibuildsecurity
assigneesneo-opus-ada
createdAtSep 17, 2026, 9:26 PM
updatedAtSep 18, 2026, 5:45 PM
githubUrlhttps://github.com/neomjs/neo/issues/18832
authorneo-opus-vega
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 18, 2026, 5:45 PM

No lint catches a committed credential, so GitHub's scanner found the last one

Closed v13.2.0/archive-v13-2-0-chunk-21 enhancementaibuildsecurity
neo-opus-vega
neo-opus-vega commented on Sep 17, 2026, 9:26 PM

Context

Two Google Maps API keys sat in the tracked tree from 2022-12-28 until #18828 removed them. Nothing in this repository noticed. GitHub's secret scanner did, out-of-band, and the alerts are what started the investigation.

Proposed by @neo-opus-grace while reviewing #18830, filed separately because it is a new guard on a shared job rather than part of a content change already under review.

The Problem

The failure was silent for years, and the reason it stayed silent is instructive.

Of the two keys, the one in examples/ was dead (BillingNotEnabledMapError) and the one in learn/tutorials/Earthquakes.md was live, funded, and not origin-locked. The dead key is the one a maintainer opening the example would hit, so the visible breakage pointed away from the real exposure. A broken credential masked a working one, and only an external scanner distinguished them.

It also reached further than the repository: npm pack neo.mjs@13.1.0 contains learn/tutorials/Earthquakes.md plus 194 deck pages, with the live key inside. Registry versions are immutable, so that copy is permanent. The window between committing a credential and it becoming unrecallable is one npm publish.

A local guard would have closed that window at the commit.

The Architectural Reality

  • .husky/pre-commit runs staged-file checks through buildScripts/util/check-*.mjs. #18828's own commit was blocked by check-whitespace.mjs over five pre-existing lines, so the mechanism demonstrably has teeth on content files.
  • No existing check inspects file content for credential shapes. The closest are check-ticket-archaeology.mjs and check-content-logical-identity.mjs, both about ticket references and duplication rather than secrets.
  • The CI baseline workflow runs the same family of guards.
  • resources/content/archive/** contains the literal token AIza… — with an ellipsis, inside prose describing a redaction test. Any pattern must not match it, and its existence is why a naive AIza substring search is wrong.

The Fix

Add a content guard over staged and tracked files that fails on credential-shaped literals, run from the same place the other check-* scripts run.

The pattern set is the design question and should not be guessed:

  • AIza[0-9A-Za-z_-]{35} — Google. Note the length anchor: it is what separates a real key from the archive's AIza… prose.
  • sk-[A-Za-z0-9]{20,} / sk-ant- — OpenAI / Anthropic.
  • ghp_ / gho_ / ghs_ / github_pat_ — GitHub tokens.
  • AKIA[0-9A-Z]{16} — AWS access key ids.
  • ya29\. — Google OAuth.

An allowlist mechanism is required, not optional: tests and docs legitimately contain credential-shaped strings, and #18828 itself introduced the placeholder YOUR_GOOGLE_MAPS_API_KEY.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
new buildScripts/util/check-secrets.mjs this ticket non-zero exit naming file, line and matched pattern kind — never echoing the secret none its own module docblock sibling check-*.mjs scripts
.husky/pre-commit .husky/pre-commit runs the guard over staged files commit proceeds if unstaged — check-whitespace blocked #18828's first commit
CI baseline .github/workflows runs it over the tracked tree — — existing baseline jobs

Decision Record impact

none.

Acceptance Criteria

  • AC-1 — the guard fails on a planted credential of each supported shape, proven by planting one per pattern rather than by a green run.
  • AC-2 — the guard passes on the tree at #18828's merge commit, and specifically does not match resources/content/archive/**'s AIza… prose or the YOUR_GOOGLE_MAPS_API_KEY placeholder. Both are named in the test, so a future pattern widening cannot silently start matching them.
  • AC-3 — the guard reproduces history: run against learn/tutorials/Earthquakes.md as it stood before #18828, it reports. This is the ticket's whole premise and is the one check that proves the guard would have caught the real incident rather than a synthetic one.
  • AC-4 — failure output names file, line and pattern kind, and never prints the matched secret — otherwise the guard writes credentials into CI logs, which are themselves a published surface.
  • AC-5 — the allowlist mechanism is documented where it lives, including how a reviewer tells a legitimate placeholder from a suppressed real finding.
  • AC-6 — the guard runs in both pre-commit and CI, verified by observing it in each.

Out of Scope

  • Revoking or rotating the existing keys — account-owner action tracked on #18828.
  • Scanning git history. @tobiu ruled no rewrite on 2026-09-17; a guard that fails on every historical commit would be unusable anyway.
  • Replacing GitHub's secret scanning. This is a faster local tripwire, not a substitute — GitHub's scanner has provider-verified patterns and out-of-band reach this cannot match.
  • Scanning node_modules or build output.

Avoided Traps

  • ⛔ Do not print the matched secret in the failure message. CI logs are a published surface; a guard that echoes findings converts a private commit into a public disclosure.
  • ⛔ Do not match on prefix alone. AIza without a length anchor matches the archive's prose and would make the guard noisy on day one, which is how guards get disabled.
  • ⛔ Do not ship without an allowlist. The tree already contains a deliberate YOUR_GOOGLE_MAPS_API_KEY placeholder, and specs legitimately carry credential-shaped fixtures.
  • ⛔ Do not assume a broken-looking credential is harmless. The incident that motivated this had one dead key and one live one; the dead one was more visible, and that asymmetry is what hid the live one for years.

Related

  • #18828 — removing the keys and teaching readers to mint their own
  • #18830 — the PR where @neo-opus-grace proposed this guard, and measured the npm exposure

unowned-rationale: parked deliberately. My two Maps lanes are under review and this is a shared-guard change that wants its own design pass on the pattern set; @neo-opus-grace proposed it and has first claim if she wants it.

Origin Session ID: 2b78af80-54a8-4e14-afd8-85c6dfe41004

Retrieval Hint: "committed api key lint guard, check-secrets buildScripts, AIza length anchor vs archive prose, npm tarball immutable credential"