Repository navigation
fix(plugins): require auth on hume-ai routes writing memories and pushing notifications (#15089) - #23711
Conversation
|
The production change here is correct and nicely scoped - this closes a real unauthenticated write path, and I verified the guard and its tests directly. What I verified:
Security: this is the material dimension. Before this change, the three routes wrote emotion memories into any user's account or pushed notifications to any user using only a query-string Ops note: existing external callers of these routes will start receiving 401/503 until USER IMPACT: strangers can no longer write emotion memories or push notifications to an arbitrary user's Omi account; legitimate users see no change beyond operators configuring one new secret. Still open (non-blocking):
The auth design and the bounty request on #15089 need a human maintainer's sign-off before merge - leaving for maintainer review for that decision, not for code-quality concerns. Feedback generated by the repository's automated maintainer assistant on behalf of the Omi maintainers. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Hi @Git-on-my-level, Thank you for the review! Cleaned up the formatting in \plugins/hume-ai/README.md\ and .env.example\ for the \Authorization: Bearer \ header and token parameter documentation. Ready for maintainer sign-off and merge! |
|
Verdict: the fix is correct and well scoped - all three uid-keyed routes are now behind a fail-closed shared-secret guard matching the repo's existing
Security: closes an unauthenticated write surface (arbitrary-uid memory writes and notification pushes). Blast radius if misconfigured: the routes fail closed (503) rather than reopening - right direction of failure. USER IMPACT: after deploy, unauthenticated callers can no longer write emotion memories to a user's Omi account or push them notifications; legitimate callers must present the service secret. What I'd still want: confirmation that Needs a maintainer to sign off the auth approach and the deploy sequencing before merge - the guard intentionally 503s until the secret is provisioned. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
…hing notifications (BasedHardware#15089) Failure-Class: none UI-Evidence: none - In `plugins/hume-ai/hume_tools_auth.py`, add `require_hume_tools_auth` to validate incoming requests against `HUME_TOOLS_SECRET` via `Authorization: Bearer` or `?hume_tools_token=`, using constant-time `hmac.compare_digest` with UTF-8 byte encoding and failing closed with HTTP 503 when unconfigured. - Protect all three uid-keyed routes (`/audio`, `/save-emotion-memory`, `/force-send-notification`) with `dependencies=[Depends(require_hume_tools_auth)]` in `plugins/hume-ai/main.py`. - Update `plugins/hume-ai/Dockerfile` to copy `hume_tools_auth.py` so container builds start cleanly without `ModuleNotFoundError`. - Update `plugins/hume-ai/render.yaml` to declare `HUME_TOOLS_SECRET` with `sync: false`. - Update `plugins/hume-ai/.env.example` and `README.md` to document `HUME_TOOLS_SECRET`. - Register `hume-ai-route-auth-tests` in `.github/checks-manifest.yaml` and add hermetic tests in `plugins/hume-ai/test_hume_tools_auth.py` (9/9 pass). Closes BasedHardware#15089
4588cf9 to
68b7bd7
Compare
|
Since my last review: addressed (the README/.env.example Bearer formatting nits — both now render correctly with balanced backticks, verified on the new head; the branch was rewritten on Oct 31, so I re-verified the whole diff file-by-file rather than assuming: guard logic, route wiring, tests, Dockerfile/render.yaml and the checks-manifest entry are all intact and consistent) · still open (maintainer sign-off on the auth approach; Verdict: the fix remains correct and well scoped — all three uid-keyed routes are behind a fail-closed shared-secret guard, and the 9-test hermetic suite passes on this head. Security: closes the unauthenticated write surface (arbitrary-uid memory writes and notification pushes); failure direction is correct — misconfiguration surfaces as 503, never as silent open access. USER IMPACT: strangers can no longer write emotion memories into an arbitrary user's Omi account or push them notifications; legitimate callers must present the configured service secret. For the maintainer, two decisions before merge: (1) confirm the shared-secret approach and provision by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
Summary
Closes #15089
Before this fix, three routes in
plugins/hume-ai/main.pytookuidstraight from the query string without caller authentication:POST /save-emotion-memory?uid=<uid>wrote emotion memories into any user's Omi account using the app's integration key.POST /force-send-notification?uid=<uid>pushed notifications to any user on demand, bypassing cooldowns.POST /audio?uid=<uid>accepted audio bytes attributed to any user without authentication.This change implements the shared-secret authentication pattern (
HUME_TOOLS_SECRET) matching the merged shipbob/composio precedent:plugins/hume-ai/hume_tools_auth.py: providesrequire_hume_tools_authaccepting credentials viaAuthorization: Bearer <secret>orhume_tools_tokenquery parameter, using constant-timehmac.compare_digestwith UTF-8 byte encoding and failing closed with HTTP 503 when unconfigured.dependencies=[Depends(require_hume_tools_auth)]onto/audio,/save-emotion-memory, and/force-send-notificationinplugins/hume-ai/main.py.plugins/hume-ai/DockerfiletoCOPY hume_tools_auth.py .so container deployments boot withoutModuleNotFoundError.plugins/hume-ai/render.yamlwith- key: HUME_TOOLS_SECRET(sync: false).plugins/hume-ai/.env.exampleandplugins/hume-ai/README.mddocumenting service auth.hume-ai-route-auth-testsin.github/checks-manifest.yamland added hermetic test suite inplugins/hume-ai/test_hume_tools_auth.py(9/9 pass).Failure-Class: none
UI-Evidence: none
Bounty request: $150 (as proposed on #15089)