Any signed-in viewer can trigger OpenAI summary spend: incident summary routes use require_service_or_firebase_token, not require_admin_token #81
Closed
opened 2026-08-26 09:31:22 -04:00 by logan
·
2 comments
No Branch/Tag Specified
Labels
Clear labels
area/ai-pipeline
area/auth
area/billing
area/correlation
area/discord
area/frontend
area/governance
area/growth
area/infra-deploy
area/legal
area/map
area/mqtt
area/node-ota
area/osint
area/recording-audio
area/sdr-radio
area/transcription
board
board:agenda
minutes:draft
minutes:final
role:ceo
role:cfo
role:cio
role:ciso
role:cmo
role:coo
role:cto
Scene/entity extraction, summarizer, AI providers, embeddings
AuthN/Z, roles, tenancy/org scoping, API keys, credentials
Plans, entitlements, AI spend accounting and caps
Incident correlation, linking, lifecycle, severity, corr_debug
Discord bot, radio bots, voice streams, bot tokens, webhooks
Web UI: Next.js app and the edge-node local dashboard
Board process, minutes, unattended runner, agent tooling
Go-to-market, outreach, cold email, discovery conversations
CI/CD, VM, registry, Firestore rules/indexes deploy, Terraform/Caddy
ToS, retention, licences/DAAs, CAN-SPAM, E&O, name suppression
Live map: pins, paths, tiles, legend, geocoding
Node-C2 MQTT, checkins, commands, node sweeper, dynsec
Node install, enrollment, OTA updater, image skew
External feeds: cameras, 511, ADS-B, AIS, outages, and their licences
Call capture, boundaries, PulseAudio, ring buffer, trimming, attribution
OP25 decode, SDR hardware/tuning, conventional, second SDR, mesh radio
STT, transcript correction, place verification, name accuracy
Board process: minutes and board-filed items
Needs board scoping at the next sitting; CEO removes the label once scoped
One exec pre-read, closed by CEO
CEO ruling; open until enacted
Filed by the CEO
Filed by the CFO
Filed by the CIO
Filed by the CISO
Filed by the CMO
Filed by the COO
Filed by the CTO
kind
behavior-bug
Wrong product behavior; the instrument reads it correctly
kind
measurement-bug
Corrupts the recording/instrument (debug data, evals, health checks), not behavior
priority
p0
Drop everything: prod broken, live exposure, or owner-ruled P0
priority
p1
Next up: blocks a gate, a customer, or core incident quality
priority
p2
Normal: real defect or planned work, schedule in turn
priority
p3
Low: minor, cosmetic, or someday
status
blocked
Waiting on an external party, spend, or another issue
status
in-progress
Branch or PR open against it
status
needs-decision
Waiting on an owner or board ruling before work
status
needs-info
Root cause or repro unknown; needs a reading first
type
bug
Something built is wrong: code, data, or a measurement
type
chore
Maintenance, refactor, tests, pinning, cleanup: no user-visible change
type
decision
A ruling to make or record: board minutes, owner calls, legal reviews
type
docs
Docs, runbooks, CLAUDE.md, skills, SOPs
type
feature
New capability or an extension of an existing one
type
security
Security, privacy, credential or tenant-isolation exposure
type
tracking
Tracker, checklist, initiative or punch-list spanning several changes
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: logan/server-26#81
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Found during the standing correlation static pass, 2026-08-26.
The incident summary routes in
routers/incidents.pyare gated byrequire_service_or_firebase_token. That accepts any authenticated Firebase user, including aviewer. Hitting them spends OpenAI credits.This is the same hole that was already closed on the call side in
routers/calls.py, which was moved torequire_admin_token. The incident side was not moved with it.Why it matters now
Fix shape
Move the summary routes to
require_admin_token, matchingcalls.py. Check first whether the frontend calls them as a signed-in non-admin — if it does, this needs an explicit operator-or-above check rather than admin-only.Also in the same file: the route that returns a silent
{"ok": true}when it did nothing becausesummaries_enabledwas off should report the flag state, so a caller can tell "done" from "skipped". That part is being fixed alongside #76.Refs #76, #45, #50, #64.
Partially addressed by
d18e4f0(unattended run 2026-08-27). Leaving this open — the main defect is untouched.Done:
{"ok": true}is gone.POST /incidents/{id}/summarizenow reportssummaries_enabledin its response, so a caller can tell "done" from "skipped"._summarize_incidentitself now checks the flag, so the guard holds at the worker and not only at the loop that schedules it.PATCH /calls/{id}/transcript, wherelearn_from_correctionwas spending withvocabulary_learning_enabledoff.Still open — the actual issue title. The incident summary routes remain on
require_service_or_firebase_token, so any authenticated Firebase user including aviewercan still trigger them. Not moved torequire_admin_tokenbecause this issue's own body flags the open question first: whether the frontend calls these routes as a signed-in non-admin. There are zero JS/TS tests in the project, so a wrong guess there breaks a live page with nothing to catch it. That check is the next step and it is a frontend read, not a backend one.One inconsistency worth resolving when this is picked up. The flags-off refusal is now expressed two different ways in adjacent files:
PATCH /calls/{id}/transcriptraises 409, whilePOST /incidents/{id}/summarizereturns 200 with{"ok": false}. A caller checking only the status code will read the second as success. The 409 is the better convention — the summarize route was left as-is in the same pass specifically because changing its status code is a frontend-visible contract change.Refs #76, #45, #50, #64.
Fixed in
8b6c170(unattended run 2026-09-01).Actual defect: POST /incidents/{id}/summarize used require_service_or_firebase_token, which accepts any authenticated Firebase user including role viewer, and that route spends OpenAI credits via the background summarizer. Moved to require_admin_token, matching calls.py.
Swept the rest of incidents.py: list_incidents and get_incident are reads with no spend and correctly stay on require_service_or_firebase_token; create/update/delete/link/unlink incident were already require_admin_token. No other route in the file needed changing.
Frontend-caller check (the mandatory step): both summarize-triggering UI elements on app/incidents/[id]/page.tsx (the Regenerate summary button and the inline Generate now link) are already wrapped in isAdmin. So locking the backend to admin-only matches existing UI behavior exactly — no frontend change made, nothing on screen breaks.
Added tests/test_incident_summarize_auth.py, which asserts the route dependency wiring directly (the convention already used in test_admin_feature_flags.py) so a revert back to the weak dependency fails a test immediately.
Tests: 293 passed (289 baseline + 4 new), 0 failed, Server/drb-c2-core suite.
Found but out of scope, filed separately: POST /trips/{trip_id}/chat (drb-c2-core/app/routers/trips.py) has the identical shape — require_service_or_firebase_token guarding a gpt-4o-mini call — but it is a deliberately-designed feature (trips-feature-intentional) already carrying its own per-caller rate limiter as the spend control, so I did not touch it. See new issue for a scoped decision on whether that limiter is sufficient or it also needs a role gate.
No pipeline files (upload.py, incident_correlator.py, llm_correlator.py, intelligence.py) were touched.