See how your app actually fits together. An interactive, plain-English map of your codebase, drawn by Claude or Codex.
JavaScript ai-codingarchitecture-diagramclaudeclaude-codeclaude-code-plugincodebase-visualizationcodexcodex-plugindeveloper-toolsonboardingopenaivibe-coding
Health: don't flag tokens that are public by design
Hayden Smithba8a2149045f
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d4d87ab..865aab9 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,6 +5,7 @@- **Asking on a map works again on Windows with the current Claude Code install:** the map's server found only the shell shim of an npm install and failed with `spawn ...\claude ENOENT`; it now finds the real `claude.exe` inside the package. Reported and fixed by @menachem-kurkus in #20 and #21.- **Fewer false Health alarms on FastAPI:** a check added where a router is included, like `app.include_router(admin.router, dependencies=[Depends(require_admin)])`, now protects every endpoint of that router, as `app.use('/admin', requireStaff, adminRouter)` already did on Express. A database session added there still doesn't count as a sign-in check. Fixed by @stevensiht in #15.- **FastAPI routers found by the name they're imported under:** a router imported under another name (`from app.routes import campaigns as campaign_routes`) gets its prefix and its checks, and a package that shares a router's name (`from app.platform import pricing` beside a `platform` router) is no longer mistaken for it. Fixed by @stevensiht in #15.+- **No more false alarm for analytics and map tokens:** Health no longer calls Cloudflare Web Analytics' beacon token or a Mapbox public token (`pk.…`) a leaked secret. Both are public by design: the page has to send them for analytics or maps to work. Reported by @CplSyx in #23.## 0.3.0 (2026-10-29)diff --git a/skills/floorplan/scripts/lib/health.mjs b/skills/floorplan/scripts/lib/health.mjsindex db66d59..ed13ff5 100644--- a/skills/floorplan/scripts/lib/health.mjs+++ b/skills/floorplan/scripts/lib/health.mjs@@ -105,6 +105,11 @@ function valueLooksReal(v, name) {return v.length >= 16 && entropy(v) >= 3.2 && /\d/.test(v) && /[a-zA-Z]/.test(v);}+// Tokens that are public by design, because the browser has to send them: Cloudflare Web Analytics'+// beacon (data-cf-beacon='{"token":"…"}') and Mapbox public tokens (pk.…)+const PUBLIC_TOKEN_LINE = /data-cf-beacon|cloudflareinsights\.com/i;+const PUBLIC_TOKEN_VALUE = /^pk\.[\w-]{20,}\.[\w-]{10,}$/;+/** 1-based line numbers inside docstrings or block comments (examples there aren't real config). */function docLines(src, lang) {const set = new Set();@@ -153,12 +158,12 @@ function findSecrets(src, f, out) {const quoted = /(["']?)([A-Za-z_][\w.-]*)\1\s*(?::=|=>|=|:)\s*(?:[rbuRBU]{1,2})?(["'`])([^"'`\n]{6,200})\3/g;const unquoted = /^\s*(?:export\s+)?([A-Za-z_][\w.-]*)\s*[:=]\s*([^\s#'"]{6,200})\s*(?:#.*)?$/;lines.forEach((text, i) => {- if (text.length > 400 || ENV_LOOKUP.test(text) || inDoc.has(i + 1) || /^\s*(#|\/\/|\*|\/\*|<!--)/.test(text)) return;+ if (text.length > 400 || ENV_LOOKUP.test(text) || PUBLIC_TOKEN_LINE.test(text) || inDoc.has(i + 1) || /^\s*(#|\/\/|\*|\/\*|<!--)/.test(text)) return;const pairs = [...text.matchAll(quoted)].map((m) => [m[2], m[4]]);if (!pairs.length && (f.category === 'config' && CONFIG_LANGS.has(f.lang))) { const u = unquoted.exec(text); if (u) pairs.push([u[1], u[2]]); }for (const [name, value] of pairs) {const n = snake(name.split('.').pop());- if (!SECRET_NAME.test(n) || PUBLIC_NAME.test(n) || !valueLooksReal(value, n)) continue;+ if (!SECRET_NAME.test(n) || PUBLIC_NAME.test(n) || PUBLIC_TOKEN_VALUE.test(value) || !valueLooksReal(value, n)) continue;if (throwawayDb && /^(postgres|mysql|mariadb|mongo(_initdb_root)?|redis|pg|rabbitmq_default|db|database)_(root_)?(password|pass|pwd)$/.test(n)) continue;add(i + 1, { what: kindFromName(name), name: name.split('.').pop(), sev: 'high', hint: mask(value, PASSWORD_NAME.test(n)), generic: true });}diff --git a/tests/secrets.test.mjs b/tests/secrets.test.mjsindex 107fc92..964a4a7 100644--- a/tests/secrets.test.mjs+++ b/tests/secrets.test.mjs@@ -36,3 +36,14 @@ test('placeholders, values read from the environment and public settings are notassert.deepEqual(secrets('DB_PASSWORD = os.environ["DB_PASSWORD"]\nAPI_KEY = os.getenv("API_KEY")\n'), []);assert.deepEqual(secrets('API_URL = "https://api.example.com/v1/orders"\n'), []);});++test('tokens that are public by design are not flagged (#23)', () => {+ const hex = [...Array(32)].map((_, i) => '01234567890abcdef'[(i * 7 + 3) % 16]).join('');+ // Cloudflare Web Analytics' beacon token has to be in the page for analytics to work+ const beacon = `<script defer src="https://static.cloudflareinsights.com/beacon.min.js" data-cf-beacon='{"token": "${hex}"}'></script>`;+ assert.deepEqual(secrets(beacon, 'site/index.html', 'html'), []);+ // the same value under a secret-sounding name elsewhere is still flagged+ assert.equal(secrets(`ACCESS_TOKEN = "${hex}"`).length, 1);+ // a Mapbox public token+ assert.deepEqual(secrets(`mapboxToken = "pk.${'eyJ1IjoiZXhhbXBsZSIsImEiOiJ'}${hex}.${hex.slice(0, 22)}"`, 'web/map.ts', 'typescript'), []);+});