Skip to content

feat(agent-service): scope agents to their verified owner - #9580

Draft
bobbai00 wants to merge 1 commit into
apache:mainfrom
bobbai00:feat/agent-ownership
Draft

bobbai00 wants to merge 1 commit into
apache:mainfrom
bobbai00:feat/agent-ownership

Conversation

@bobbai00

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Any user could list every user's agents and read or drive them. GET /api/agents returned all agents, and the other routes and the websocket found an agent by id alone. The one token check, at creation, did not verify the token.

  • The agent service verifies a token's HS256 signature with AUTH_JWT_SECRET before trusting its claims. The default is auth.conf's, and the Kubernetes chart passes the value in.
  • Each agent records its creator. Every /api/agents route needs the token and the list returns the caller's agents. A route or websocket naming another user's agent answers as for an unknown id.
  • The frontend sends the token in the agent websocket's query, as the workflow websocket does.

#9043 authenticates every agent request but lets any signed-in user reach any agent. This PR adds the owner check, and overlaps with it on verifying the token.

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?

New agent-service tests cover every route and the websocket with another user's token, no token, and forged tokens. Run in headless Chromium on a local stack, as two users with a real model. The second user sees none of the first user's agents or chat, and the owner's agent still builds and runs a workflow.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Fable 5.2)

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.
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @oliarmak-web, @aglinxinyuan, @dzueck
    You can notify them by mentioning @oliarmak-web, @aglinxinyuan, @dzueck in a comment.

@github-actions github-actions Bot added feature frontend Changes related to the frontend GUI infra agent-service labels Nov 20, 2026
@codecov-commenter

codecov-commenter commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.57%. Comparing base (7f9bdf3) to head (91b7223).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9580      +/-   ##
============================================
- Coverage     91.57%   91.57%   -0.01%     
  Complexity     5158     5158              
============================================
  Files          1300     1300              
  Lines         58092    58126      +34     
  Branches       7615     7616       +1     
============================================
+ Hits          53195    53226      +31     
- Misses         2959     2962       +3     
  Partials       1938     1938              
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø) Carriedforward from 7f9bdf3
agent-service 99.46% <100.00%> (-0.10%) ⬇️
amber 85.43% <ø> (ø) Carriedforward from 7f9bdf3
computing-unit-managing-service 63.88% <ø> (ø) Carriedforward from 7f9bdf3
config-service 87.50% <ø> (ø) Carriedforward from 7f9bdf3
file-service 82.16% <ø> (ø) Carriedforward from 7f9bdf3
frontend 96.45% <100.00%> (+<0.01%) ⬆️
notebook-migration-service 83.77% <ø> (ø) Carriedforward from 7f9bdf3
pyamber 98.38% <ø> (ø) Carriedforward from 7f9bdf3
result-service 85.71% <ø> (ø) Carriedforward from 7f9bdf3
workflow-compiling-service 78.30% <ø> (ø) Carriedforward from 7f9bdf3

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-service feature frontend Changes related to the frontend GUI infra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add access control and per-user isolation to the agent service

2 participants