LearnNewsExamplesServices
Frontmatter
id18828
titleRetire the shared Google Maps API keys and teach readers to mint their own
stateClosed
labels
documentationenhancementaisecurity
assigneesneo-opus-vega
createdAtSep 17, 2026, 8:48 PM
updatedAtSep 17, 2026, 10:08 PM
githubUrlhttps://github.com/neomjs/neo/issues/18828
authorneo-opus-vega
commentsCount2
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 17, 2026, 9:25 PM

Retire the shared Google Maps API keys and teach readers to mint their own

Closed v13.2.0/archive-v13-2-0-chunk-21 documentationenhancementaisecurity
neo-opus-vega
neo-opus-vega commented on Sep 17, 2026, 8:48 PM

Context

GitHub secret scanning reports alerts against Google Maps API keys committed to this repository. They were added deliberately, years ago, when a Maps key cost nothing and needed no payment method: the intent was to let a reader see the GoogleMaps wrapper work without signing up for anything. That trade no longer exists — Google requires a billing account, and a key that sits in a public repository is a key anyone can spend.

Two distinct keys are present at HEAD, and measurement on 2026-09-17 shows they are in opposite states. Both were loaded from an arbitrary local origin (http://localhost:<port>), constructed into a google.maps.Map, and observed:

key location observed result
NEO_INLINE_CODE_4 — also mirrored into two deck-training pages console Google Maps JavaScript API error: BillingNotEnabledMapError; tiles render greyed under a repeating "For development purposes only" watermark, plus Google's "This page can't load Google Maps correctly" dialog
NEO_INLINE_CODE_6 renders cleanly — full-colour tiles, Map/Satellite toggle, Street View pegman, zero console errors

Both runs used the same page, the same origin and the same minute, so the difference is the key, not the harness.

The Problem

The second key is live, and it is published as an instruction rather than as a config value.

This is the part that raises the priority above "dismiss three intentional false positives":

  1. It is attached to a funded Google Cloud project. A key with no billing account produces BillingNotEnabledMapError, which is exactly what the other key does. This one draws real tiles, so real billing is behind it.
  2. It is not origin-locked. It rendered from an arbitrary localhost port. Whatever HTTP-referrer restrictions exist on the key, they do not exclude a machine that has simply copied it out of the repository.
  3. It is on the public site as a copy-paste step. NEO_INLINE_CODE_9 registers tutorials/Earthquakes in the portal's learn tree, and the tutorial body instructs the reader to paste that exact value into their own neo-config.json. The reader is being told to reuse a shared funded credential.
  4. The broken key is what kept this quiet. The demo a maintainer is most likely to open is the examples/ one, and it fails visibly. Nothing signalled that a different key, in a different file, was working and spending.

The deck-training pages under resources/data/deck/training/pages/ carry the same instruction shape for the first key. These are build-from-scratch labs — the reader generates apps/earthquakes and apps/yelp themselves, so the absence of those directories at HEAD is correct and is not part of this ticket.

The Architectural Reality

  • NEO_INLINE_CODE_16 declares config.googleMapsApiKey. This config is not the problem and does not change. Reading a key from app config is the correct design; shipping a populated value is the defect.
  • NEO_INLINE_CODE_18 consumes Neo.config.googleMapsApiKey and interpolates it into the loader URL. Untouched here.
  • The four tracked files holding a literal key value:
    • examples/component/wrapper/googleMaps/neo-config.json
    • learn/tutorials/Earthquakes.md
    • resources/data/deck/training/pages/2022-12-31T22-11-55-555Z.md
    • resources/data/deck/training/pages/2023-01-01T21-14-45-740Z.md
  • Both content trees are served: learn/ via learn/tree.json, and resources/data/deck/<deck>/ via NEO_INLINE_CODE_27. Edits here change what neomjs.com publishes.

The Fix

  1. Remove the literal key from all four files, replacing each value with the placeholder YOUR_GOOGLE_MAPS_API_KEY — the example config included. The property stays present everywhere so its shape remains discoverable. (Corrected after measurement: this first prescribed an empty value for the example config. See Avoided Traps — an empty string produces a worse failure than a placeholder.)
  2. Add a short, linkable "get your own Maps key" passage and reference it from every place that previously handed one over. It states the four steps a reader actually needs (create a Cloud project, enable the Maps JavaScript API, enable billing, restrict the key by HTTP referrer) and links Google's own documentation rather than restating it.
  3. Correct the promised outcome in the prose. The training deck currently tells the reader they will see NoApiKeys and then, after pasting the shared key, "the starter app without any warnings". Neither half survives: with the key removed the reader must supply one, and what they will see without it is InvalidKeyMapError (measured), not NoApiKeys.

Revoking the two keys in the Google Cloud console is the load-bearing step, and it is not in this repository. It belongs to the account owner. Removing the literals from HEAD does not un-publish them — see Avoided Traps.

The npm tarball is the largest surface, and it is immutable

Found by @neo-opus-grace on #18830 and verified independently here:

npm pack --dry-run              → learn/tutorials/Earthquakes.md + 194 deck pages are IN the tarball
npm pack neo.mjs@13.1.0         → 195 key-bearing paths present in the PUBLISHED artifact
tar xzf … Earthquakes.md | grep → the LIVE key (AIzaSyD4…) is inside it

So every npm i neo.mjs since 12.1.0 has written the working, funded key into a consumer's node_modules. Registry versions are immutable — that copy cannot be withdrawn, edited or unpublished in place.

This outranks the repository, the forks and the history put together, and it is the reason revocation is urgent rather than tidy. .npmignore at both published gitHeads excludes only resources/content/** and a few named files, so neither release ever excluded these trees.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
Neo.config.googleMapsApiKey NEO_INLINE_CODE_39 unchanged — still the sole key input n/a the new passage explains how a reader fills it config read confirmed at NEO_INLINE_CODE_40
examples/component/wrapper/googleMaps/neo-config.json this ticket key property retained, value set to YOUR_GOOGLE_MAPS_API_KEY reader supplies own example carries the placeholder three-state measurement 2026-09-17, see Avoided Traps
the learn/deck passages this ticket same placeholder + an inline "get your own key" passage none the passage itself both trees confirmed served

Decision Record impact

none — no ADR governs demo credentials.

Acceptance Criteria

  • AC-1 — git grep -nE "AIza[0-9A-Za-z_-]{20,}" over tracked files returns no hit outside resources/content/archive/** (which quotes an unrelated redaction test, not a key).
  • AC-2 — the example app still starts carrying only the placeholder, and the failure a reader sees is Google's own missing-key surface (InvalidKeyMapError plus its "Oops! Something went wrong" panel) rather than a Neo stack trace. Depends on the load race being fixed — see Related; until then this AC cannot pass, and that dependency is the reason it is stated as an observation rather than a screenshot.
  • AC-3 — every prose location that previously supplied a key now tells the reader how to obtain their own, verified by enumerating the former key sites and showing each one carries guidance. Amended after filing: this first said "links the passage", assuming one shared page. learn/ and resources/data/deck/<deck>/ are separately served trees (NEO_INLINE_CODE_49), so a link from a deck lab into the learn tree does not resolve — and a tutorial that sends the reader elsewhere mid-lab is worse than a short inline passage. The two deck labs belong to one course, so the second back-references the first rather than repeating it.
  • AC-4 — the training deck's claimed outcomes match measured behaviour: no promise of "without any warnings", and no claim that a keyless run reports NoApiKeys.
  • AC-5 — the ticket records that revocation is an account-owner action and names it as unfinished here, so a reader cannot mistake a merged PR for a closed exposure.

Out of Scope

  • Rewriting git history — DECIDED, not open. @tobiu ruled on 2026-09-17: "it is ok to not fully purge the history (impossible anyway). but removing keys now does matter." No rewrite. The estimate on this ticket's thread stands as the rationale, and the npm finding above strengthens it: a rewrite could not have reached the registry copies either.
  • Revoking the keys. Account-owner action, outside the repository.
  • The main.addon.GoogleMaps load race. Separate defect with a separate mechanism — see Related.
  • Any change to Neo.config.googleMapsApiKey itself.
  • An in-app "enter your API key" input. Raised as an option; deferred until the load race is fixed, because that fix changes what a keyless reader actually sees.

Avoided Traps

  • ⛔ Do not treat removal from HEAD as remediation. The keys are in history, in 232 forks, and in every existing clone, and secret scanning proves at least one automated crawler already found them. Only revocation in the Cloud console ends the exposure.

  • ⛔ Do not replace the shared key with another shared key. The same failure returns on a longer fuse.

  • ⛔ Do not delete the googleMapsApiKey property from the example config, and do not set it to "". Keeping the property is how a reader learns it exists — but the original wording of this trap said "an empty value teaches", and measurement falsified that. Google distinguishes three cases, and only the third is a good teacher:

    value in the config what Google does
    "" → key= ApiProjectMapError + NoApiKeys — renders a greyed, watermarked map that looks half-working
    property absent → key=undefined InvalidKeyMapError — clean "Oops! Something went wrong" panel, but the property is invisible to the reader
    "YOUR_GOOGLE_MAPS_API_KEY" InvalidKeyMapError — the clean panel and a self-describing property

    Use the placeholder. An empty string is the worst of the three: a partly-drawn map invites the reader to think the tutorial worked.

  • ⛔ Do not assume both keys behave the same. They measurably do not, and the working one is the dangerous one. A fix verified only against the visibly-broken example would miss it.

Related

  • #6610 — main.addon.OpenStreetMaps: a keyless mapping path already exists in the codebase, relevant to any later decision about what the default demo should use.
  • #8152 — closed: unified DomAccess.addScript / loadScript, the API the Maps loader calls.

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

Retrieval Hint: "google maps api key removed from repo, BillingNotEnabledMapError vs working key, tutorial mint your own key, secret scanning alerts"

tobiu closed this issue on Sep 17, 2026, 9:25 PM
tobiu referenced in commit cf8aead - "docs(security): the Maps tutorials mint a key instead of sharing one (#18828) (#18830) on Sep 17, 2026, 9:25 PM