apache / apache/texera

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

Open
#5,268 0 comments 0 reactions 1 assignee Claimed by @bobbai00 View on GitHub
Dominant language
Scala
Stars
314
Forks
187
Avg merge
1d 21h
Merged PRs (30d)
214

Description

### Task Summary

Agents in the agent service are not isolated per user, and the REST/WebSocket routes have no authorization. Anyone who can reach the service and supply an agent id can read or drive any agent.

Specific gaps (`agent-service/src/server.ts`, `agent-service/src/api/auth-api.ts`):

| Gap | Detail |
| --- | --- |
| No ownership check | Every `/agents/:id*` route and `WS /agents/:id/react` resolves an agent purely by id — no check that the caller owns it. |
| Enumerable ids | ids are sequential: `agent-${++agentCounter}`. Trivially guessable. |
| Global listing | `GET /agents` returns **all** agents across all users. |
| Token not bound | `userToken` is only used at creation time to load the delegate workflow; later requests need no token and the agent is never bound to an owner. |
| Signature not verified | `validateToken` only checks `exp`; `extractUserFromToken` base64-decodes the JWT payload without verifying the signature, so a forged/edited token is accepted. |

```
Before: caller + any agent id -> full read/control of that agent
After: caller + token (verified) -> only that user's own agents
```

Proposed work: verify JWT signatures (not just expiry); bind each agent to an owner at creation; authorize every `/:id` route and the websocket against the caller's identity; scope `GET /agents` to the caller; and use non-guessable agent ids.

### Task Type

- [ ] Refactor / Cleanup
- [ ] DevOps / Deployment / CI
- [ ] Testing / QA
- [ ] Documentation
- [ ] Performance
- [x] Other

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.