Skip to content

[Security] omi-github-app: settings routes trust a bare uid — anyone can overwrite another user’s agent key, provider, or repo binding #23177

Description

@1132dadf

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), or delete-agent-key simply 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-agent and refresh-repos run 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

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

  1. Preferred (needs Omi backend): sign the setup URL the app receives — uid plus 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 /disconnect fixes in [Bounty proposal] security: eight plugins — unauthenticated GET /disconnect?uid= deletes any user's stored OAuth tokens ($150 proposed) #15589.
  2. Standalone mitigation in the plugin: set a signed session cookie at the OAuth callback (HMAC over uid with a new GITHUB_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.

cc @josancamon19 @kodjima33

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions