Repository navigation
Description
Summary
plugins/omi-github-app/main.py exposes six settings routes that write per-user state from a bare uid query parameter with no authentication of any kind. SimpleUserStorage keys everything by that uid, so anyone who knows or guesses a uid can overwrite or delete another user’s stored data and trigger work with their stored GitHub token.
| Route | Line | Effect |
|---|---|---|
POST /save-agent-key?uid=&provider=&key= |
1628 | writes any string as the user’s LLM API key |
POST /delete-agent-key?uid=&provider= |
1653 | deletes the user’s stored key |
POST /save-agent-provider?uid=&provider= |
1604 | changes which agent provider the user’s turns run through |
POST /update-repo?uid=&repo= |
1508 | points issue creation at a different repository |
POST /refresh-repos?uid= |
1534 | refreshes the stored repo list |
POST /check-repo-access?uid= |
1560 | probes the stored token against a repo |
POST /test-agent?uid= |
1673 | runs the configured agent provider (spends the stored key / GitHub token) |
Impact
- Key replacement / deletion.
save_agent_api_key(uid, provider, key)overwrites the victim’s stored provider key; the next chat turn runs through the attacker’s key (attacker-paid or attacker-controlled endpoint), ordelete-agent-keysimply breaks the integration. - Repo redirection.
update_repo_selection(uid, repo)changes where the victim’s “Feedback Post” issues are filed; the attacker can point it at a repository they control. - Work with the victim’s GitHub token.
test-agentandrefresh-reposrun with the stored OAuth access token, so the attacker can trigger calls attributed to the victim’s GitHub account.
Why this is not covered by the existing issues
- [Bounty $400] security: seven more plugins — 39 /tools/* routes trust body uid and act with stored third-party credentials #14455 covers the
/tools/*routes that acceptuidin the body (39 routes across seven plugins). - [Bounty proposal] security: eight plugins — unauthenticated GET /disconnect?uid= deletes any user's stored OAuth tokens ($150 proposed) #15589 covers
GET /disconnectin eight plugins. - [Bounty proposal] security(github-app): require shared-secret auth on chat-tool routes ($50 proposed) #15010 (closed) covered only the github-app chat-tool routes.
The settings routes above are a separate surface and still have no guard on main.
Evidence
@app.post("/save-agent-key")
async def save_agent_key(uid: str = Query(...), provider: str = Query(...), key: str = Query(...)):
...
SimpleUserStorage.save_agent_api_key(uid, provider, key)No Depends, no signature, no cookie, no token check — uid is the only input the write is scoped by.
Root cause (broader than the six routes)
The plugin’s entry points trust uid as well: GET /?uid= renders the settings page for any uid, and GET /auth?uid= starts OAuth for any uid. auth_callback then calls save_user(uid=..., access_token=...), so an attacker can also overwrite an existing binding by running OAuth against a victim’s uid. Signing only the settings routes would close the write surface but not the binding surface.
Proposed fix
- Preferred (needs Omi backend): sign the setup URL the app receives —
uidplus an HMAC with a per-app secret — and verify it before rendering or binding, the pattern proposed for fix(plugins): require auth on whoop-app routes reading uid-keyed health data #14454 and used for the/disconnectfixes in [Bounty proposal] security: eight plugins — unauthenticated GET /disconnect?uid= deletes any user's stored OAuth tokens ($150 proposed) #15589. - Standalone mitigation in the plugin: set a signed session cookie at the OAuth callback (HMAC over
uidwith a newGITHUB_SETTINGS_SECRET, fail-closed 503 when unset), require it on every uid-keyed settings route, and refuse/auth?uid=rebinding when the uid already has a stored access token unless the session matches.
Happy to send a PR for option 2 with hermetic tests if maintainers prefer not to wait for the backend change; option 1 is the complete fix.
Reproduction (against any deployment of this plugin)
curl -X POST "https://<deployment>/save-agent-key?uid=<victim-uid>&provider=cursor&key=attacker-key"
curl -X POST "https://<deployment>/delete-agent-key?uid=<victim-uid>&provider=cursor"
curl -X POST "https://<deployment>/update-repo?uid=<victim-uid>&repo=attacker/repo"All three return {"success": true} when the uid exists.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn review
Activity
fix(security): require a signed settings session in omi-github-app
fix(plugins): authenticate against both tools and settings secrets wh…
fix(plugins): protect settings routes via per-uid signed session cook…
fix(plugins): remove query dependency decorator on /test-agent and en…
fix(plugins): stub fastapi import hermetically for github-app-coerce-…
docs(github-app): restore README from main and remove duplicate test …
fix(security): require a signed settings session in omi-github-app (#…