Repository navigation
feat(agent-service): scope agents to their verified owner - #9580
Merged
Merged
Conversation
Contributor
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9580 +/- ##
=========================================
Coverage 91.68% 91.69%
Complexity 5132 5132
=========================================
Files 1305 1306 +1
Lines 58252 58296 +44
Branches 7604 7605 +1
=========================================
+ Hits 53408 53453 +45
Misses 2937 2937
+ Partials 1907 1906 -1
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
bobbai00
marked this pull request as ready for review
November 21, 2026 07:39
kunwp1
reviewed
Nov 23, 2026
bobbai00
force-pushed
the
feat/agent-ownership
branch
from
November 24, 2026 06:54
f35dce3 to
5ce9e7f
Compare
Any caller could list every user's agents and read or drive any of them: the agent list was not per user, routes and the websocket looked an agent up by id alone, and the one token check, at creation, only decoded the token. The service now verifies a token's HS256 signature with the secret the dashboard service signs it with (AUTH_JWT_SECRET, defaulting to auth.conf's value as the backend does) before trusting its claims. Each agent records the user who created it. Every /agents route requires the token, the list returns the caller's agents only, and a route or websocket naming another user's agent answers as for an agent that does not exist. The frontend sends the token in the agent websocket's query, as the workflow websocket does, and the Kubernetes chart passes the secret to the service.
Seven of the ownership tests timed out in CI. Their table rows had two entries where the test takes three parameters, and Bun fills a missing parameter with a `done` callback. With no dashboard service answering, as in CI, the tests waited for that callback. Their requests also carried a JSON content type without a body. Each row now names its body.
AuthConfig.scala lowercases AUTH_JWT_SECRET before signing, and treats "random" as a request for a key of its own. The agent service used the value as written, so a secret with a capital letter made it reject every login token, and "random" started a service that could verify none. The secret is now lowercased, and "random" stops the service at startup with a message saying what to set instead.
Every route reaches its agent through getAgent(id, user), which serves the agent to its owner alone, so the check holds whatever a route names its parameter, and the guard only authenticates. verifyToken returns a signed, unexpired token's user from one decode, in place of validateToken and extractUserFromToken. The tests sign their tokens with one shared helper, and the "created agent" log records the owner's id.
bobbai00
force-pushed
the
feat/agent-ownership
branch
from
November 24, 2026 23:02
435e4d2 to
adac83e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
Each user now sees and opens only their own agents, and a login token needs a valid signature.
GET /api/agents)Another user's agent. e2e-reader opens "Penguin species comparison", which texera shared read-only. Before, the panel lists texera's "Penguin analyst" and shows its chat, texera's question marked "You":
After, it lists only e2e-reader's own agent:
AUTH_JWT_SECRET, read as the dashboard service reads it (auth.conf's default, lowercased, neverrandom). Kubernetes passes it in.#9043 adds a gateway check and will follow this PR, taking over the token check.
Any related issues, documentation, discussions?
Closes #5268
Agent ids stay sequential: a guessed id gets the same 404 as a missing one.
How was this PR tested?
Agent-service tests cover every route and the websocket with another user's token, no token and forged tokens, and how the secret is read. Also tested in headless Chromium as two users with a real model. The second sees none of the first's agents or chat, and the owner's agent still builds and executes a workflow.
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Fable 5.2, Claude Opus 5.5)