Skip to content

See how your app actually fits together. An interactive, plain-English map of your codebase, drawn by Claude or Codex.

fix: recognize public readyz and livez endpoints

Bl0ck1543d456dfb09c3
diff --git a/skills/floorplan/scripts/lib/health.mjs b/skills/floorplan/scripts/lib/health.mjs
index a5cb39e..0be2257 100644
--- a/skills/floorplan/scripts/lib/health.mjs
+++ b/skills/floorplan/scripts/lib/health.mjs
@@ -546,7 +546,7 @@ export function findIssues(src, f) {
// ======================= build: turn findings into issues =======================
const SEV_ORDER = { high: 0, medium: 1, low: 2 };
-const PUBLIC_PATH = /(^|\/)(health|healthz|healthcheck|ping|status|ready|readiness|live|liveness|version|metrics|robots\.txt|sitemap[\w.]*|favicon[\w.]*|\.well-known|login|logout|signin|pair|sign-in|signout|signup|sign-up|register|forgot[\w-]*|reset[\w-]*|verify[\w-]*|oauth\w*|callback|auth|token|refresh|static|assets|public|newsletter|contact|waitlist|unsubscribe|openapi\.json|docs|swagger[\w.]*|i|images?)(\/|$)/i;
+const PUBLIC_PATH = /(^|\/)(health|healthz|healthcheck|ping|status|ready|readyz|readiness|live|livez|liveness|version|metrics|robots\.txt|sitemap[\w.]*|favicon[\w.]*|\.well-known|login|logout|signin|pair|sign-in|signout|signup|sign-up|register|forgot[\w-]*|reset[\w-]*|verify[\w-]*|oauth\w*|callback|auth|token|refresh|static|assets|public|newsletter|contact|waitlist|unsubscribe|openapi\.json|docs|swagger[\w.]*|i|images?)(\/|$)/i;
const WEBHOOK_PATH = /webhook|\/hooks?\//i;
// endpoints under a webhook URL that manage the webhooks (create, list, test…) rather than receive them
const WEBHOOK_ADMIN = /\/(manage|admin|setup|settings|config|list|create|register|delete|test[\w-]*)(\/|$)/i;
diff --git a/tests/fixtures/fastapi-annotated/app/main.py b/tests/fixtures/fastapi-annotated/app/main.py
index e73c7ee..d8c2b5b 100644
--- a/tests/fixtures/fastapi-annotated/app/main.py
+++ b/tests/fixtures/fastapi-annotated/app/main.py
@@ -1,8 +1,9 @@
from fastapi import FastAPI
-from app.routers import comments, feedback, notes, offices, reports, things
+from app.routers import comments, feedback, notes, offices, public_health, reports, things
app = FastAPI()
+app.include_router(public_health.router)
app.include_router(things.router)
app.include_router(notes.router)
app.include_router(offices.router)
diff --git a/tests/fixtures/fastapi-annotated/app/routers/public_health.py b/tests/fixtures/fastapi-annotated/app/routers/public_health.py
new file mode 100644
index 0000000..7560350
--- /dev/null
+++ b/tests/fixtures/fastapi-annotated/app/routers/public_health.py
@@ -0,0 +1,12 @@
+"""Public Kubernetes-style health endpoints have no authentication."""
+from fastapi import APIRouter
+
+router = APIRouter()
+
+async def readyz():
+ return {"ready": True}
+
+async def livez():
+ return {"live": True}
diff --git a/tests/health.test.mjs b/tests/health.test.mjs
index 83cccb4..148f783 100644
--- a/tests/health.test.mjs
+++ b/tests/health.test.mjs
@@ -44,6 +44,15 @@ test('FastAPI: Annotated dependency aliases count as sign-in checks (#4)', () =>
assert.deepEqual(openEndpoints(graph), ['POST /comments', 'POST /feedback']);
});
+test('FastAPI: public readiness and liveness endpoints are not security warnings (#7)', () => {
+ const graph = buildFixture('fastapi-annotated');
+ const paths = graph.routes.map((r) => r.p);
+ assert.ok(paths.includes('/readyz'));
+ assert.ok(paths.includes('/livez'));
+ assert.ok(!openEndpoints(graph).includes('GET /readyz'));
+ assert.ok(!openEndpoints(graph).includes('GET /livez'));
+});
+
test('FastAPI: checks added where a router is included count as sign-in checks', () => {
const graph = buildFixture('fastapi-include-router');
assert.equal(graph.routes.length, 4, `expected the sample's 4 endpoints, found ${graph.routes.length}`);