Skip to content

Require a token on the queue api - #481

Merged
em3s merged 1 commit into
mainfrom
feat/queue-token-auth
Aug 6, 2026
Merged

em3s merged 1 commit into
mainfrom
feat/queue-token-auth

Conversation

@em3s

@em3s em3s commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

A queue is a v3 edge table — queue/v1 lowers to edge scans and table DDL over one. But TokenAuthenticationFilter only ever guarded /graph/v2 and /graph/v3, so /queue/v1 was an unauthenticated way to the same data the token is there to protect:

  • POST/DELETE .../queues — create and delete queues, which is v3 table DDL
  • PUT .../enable, .../disable — stop a queue
  • POST .../messages — inject messages
  • GET .../partitions/{p}/poll — read another tenant's contents
  • DELETE .../partitions/{p}/messages?offset= — commit their offsets away

This was drift, not a decision. protectedPaths had not been touched since the initial open-source release; queue/v1 arrived later in #437 and nobody revisited the list. The same gap let /control through until #480. Note that /queue/v1 is already in the read-only filter's prefixes — the codebase treats it as a mutating surface everywhere except here.

Changes

  • TokenAuthenticationFilter.protectedPaths is now PathPrefixes.FILTERED, every routable prefix
  • the queue api needs no token becomes the queue api needs a token, plus a valid-token case

⚠️ Not code-only — read before merging

Any queue client that sends no Authorization header starts getting 401 the moment a deployment has kc.graph.use-token on. Audit the queue clients and roll tokens out to them first. The shipped default is use-token: false, so a deployment that never enabled tokens is unaffected either way.

Nothing in this repo calls /queue/v1 outside tests, so the blast radius is entirely in callers we cannot see from here.

How to Test

./gradlew :server:test --tests "*TokenAuthenticationFilterTest*"

The probes are covered too — /graph/health, /graph/health/liveness and / must keep answering unauthenticated or readiness fails on every pod.

AI Assistance

  • This PR was written largely with AI assistance.
    • Tool / model: Claude Code (Opus 5)

A queue is a v3 edge table, so an unauthenticated /queue/v1 was a way
around the token /graph/v3 asks for: create and delete queues, inject
messages, poll another tenant's contents, commit away their offsets. The
omission was drift rather than a decision - protectedPaths had not been
revisited since the initial release, and queue/v1 arrived later in #437.

protectedPaths is now every routable prefix, which is what PathPrefixes
already calls FILTERED.

This one is not code-only: a client that sends no token starts getting
401 the moment a deployment has kc.graph.use-token on. Audit the queue
clients and roll tokens out to them before merging.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. maintenance Maintenance work. labels Aug 6, 2026
@em3s

em3s commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Optimistic

@em3s
em3s merged commit 36f988b into main Aug 6, 2026
3 checks passed
@em3s
em3s deleted the feat/queue-token-auth branch August 6, 2026 13:57
@em3s em3s self-assigned this Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Maintenance work. size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant