Skip to content

fix(hume-ai): require shared-secret auth on uid-keyed routes - #15091

Closed
harmonygemini8-collab wants to merge 3 commits into
BasedHardware:mainfrom
harmonygemini8-collab:hume-tools-auth-guard
Closed

harmonygemini8-collab wants to merge 3 commits into
BasedHardware:mainfrom
harmonygemini8-collab:hume-tools-auth-guard

Conversation

@harmonygemini8-collab

@harmonygemini8-collab harmonygemini8-collab commented Sep 20, 2026 •

Copy link
Copy Markdown

Summary

Three routes in the standalone hume-ai service take uid straight from the query string with no caller authentication and act on that uid with the app's integration key:

  • POST /save-emotion-memory?uid=<uid> (main.py) → save_emotion_memory(uid) → create_omi_memory → POST api.omi.me/v2/integrations/{app_id}/user/memories?uid=<uid> — writes an emotion-summary memory into any user's Omi account.
  • POST /force-send-notification?uid=<uid> (main.py) → send_omi_notification(uid, message) — pushes a notification to any user, cooldown bypass by design.
  • POST /audio?uid=<uid> (main.py) — ingestion keyed by raw uid; attacker audio is attributed to the victim's emotion stats and can trigger that user's notifications.

Same defect class as the already-reviewed guards (mentor webhook, composio backend routes #14700, ms365 dispatch #14686).

Fix

Shared-secret guard, same idiom as the reviewed precedents:

  • plugins/hume-ai/tools_auth.py — require_hume_tools_auth: secret from HUME_TOOLS_SECRET, presented via Authorization: Bearer <secret> or the hume_tools_token query param, checked with hmac.compare_digest; fail-closed 503 when the secret is unset/blank so the surface is never silently unauthenticated in production.
  • Applied via Depends() to all three routes in plugins/hume-ai/main.py.
  • plugins/hume-ai/test_tools_auth.py — 9 hermetic tests (fastapi stubbed, stdlib only): 503 unconfigured/blank, 401 missing/wrong/non-bearer/blank-token, bearer + query accepted, bearer preferred over query.
  • .github/checks-manifest.yaml — registered as hume-tools-auth-tests (local + ci lanes).

Deployment note

/audio is the device/bridge ingestion path: callers must now present the shared secret (header or query param) — the caller update needs to ship with HUME_TOOLS_SECRET in the deploy env, in the same window as this merge, or ingestion will 503 until configured. The two management routes have no automated callers.

Bounty filing: #15089

cc @kodjima33 @josancamon19

Review in cubic

Failure-Class: none

/save-emotion-memory, /force-send-notification and /audio take uid from
the query string and act on that uid with the app's integration key
(write an emotion memory into that user's Omi account, push that user a
notification, attribute posted audio to that uid's stats) with no caller
authentication. Add the HUME_TOOLS_SECRET shared-secret guard
(Authorization: Bearer or hume_tools_token query param,
hmac.compare_digest, fail-closed 503 when unset) via Depends() on all
three routes, same idiom as the reviewed mentor webhook guard and the
composio backend-route guard. Hermetic tests + checks-manifest
registration included.

Bounty filing: BasedHardware#15089
@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks @harmonygemini8-collab — verified end to end. The guard faithfully follows the composio (#14700) / ms365 (#14686) idiom, and the analysis in #15089 checks out against the code.

What I verified on head a9c628e:

  • plugins/hume-ai/tools_auth.py — require_hume_tools_auth fails closed (503) when HUME_TOOLS_SECRET is unset/blank, rejects missing/wrong/non-bearer tokens with 401, and compares via hmac.compare_digest. Bearer is preferred over the query token, and a wrong bearer isn't rescued by a valid query token.
  • plugins/hume-ai/main.py — Depends(require_hume_tools_auth) is applied to all three uid-keyed routes (/audio, /save-emotion-memory, /force-send-notification). FastAPI resolves dependencies before the handler body, so save_emotion_memory(uid) (main.py:511) and send_omi_notification(target_uid, ...) (main.py:569) now sit behind the guard. Scope looks right: /analyze-text is stateless analysis, /emotion-config is global config already gated off in cloud deploys, and /reset-stats resets global single-tenant stats — none act on uid-keyed user state.
  • plugins/hume-ai/test_tools_auth.py — ran the suite hermetically (fastapi stubbed, stdlib only): 9/9 pass, covering 503 unconfigured/blank, 401 missing/wrong/non-bearer/blank query token, bearer + query accepted, bearer preferred.
  • .github/checks-manifest.yaml — hume-tools-auth-tests registered in the same shape as the adjacent composio entry, with triggers on plugins/hume-ai/** and the manifest itself.

Two non-blocking notes:

  1. plugins/hume-ai/.env.example doesn't mention HUME_TOOLS_SECRET yet — a commented entry would help deployments discover it (the fail-closed 503 makes a missing secret loud rather than silent, but discoverability still helps).
  2. The hume_tools_token query param can appear in access logs where a header wouldn't; that's the same accepted tradeoff as the composio guard for callers that can't set headers — noting it for the record.

The one thing needing a maintainer call before merge: /audio is the ingestion path, and with this change all three routes 503 until HUME_TOOLS_SECRET is set in the deploy environment. Merging should be paired with setting that secret in the hume-ai deployment so ingestion doesn't gap. Leaving for maintainer review for that sign-off rather than approving.

🤖 Automated review on behalf of the maintainers.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

Per review note on BasedHardware#15091: a discoverable entry helps deployments learn
about the shared secret before the fail-closed 503 makes it loud; the
comment spells out the deploy-window pairing with the /audio caller.
@harmonygemini8-collab

Copy link
Copy Markdown
Author

Thanks @Git-on-my-level for the thorough end-to-end pass — and for catching the scope question on the unguarded routes (/analyze-text, /emotion-config, /reset-stats), which matches the filing's threat model: only uid-keyed state is guarded.

On the two notes:

  • .env.example: addressed in 9331e2c — HUME_TOOLS_SECRET entry added in the file's existing style, with the comment spelling out the fail-closed behavior and the deploy-window pairing with the /audio caller.
  • query token in logs: acknowledged — same accepted tradeoff as the composio guard (composio_tools_token), kept for callers that can't set headers; the Bearer path is preferred wherever the caller can use it.

On the merge precondition: agreed — the PR description and the new .env.example comment both call out that merging should be paired with setting HUME_TOOLS_SECRET in the hume-ai deployment (and updating the /audio caller to present it) so ingestion doesn't gap. Awaiting maintainer sign-off on that coordination.

main.py imports tools_auth at module scope, but the runner stage only
copied main.py/app.py/emotion_config.json/templates — Docker deploys
crashed at startup with ModuleNotFoundError. Copy the module alongside
the app code. render.yaml gains a sync:false HUME_TOOLS_SECRET entry so
a Render deploy created from the blueprint surfaces the fail-closed 503
state at setup time instead of after boot.
@harmonygemini8-collab

Copy link
Copy Markdown
Author

Two fixes prompted by the review pass on the sibling PRs (#15090/#15092), which apply identically here — pushed in 1a9befa:

  • Dockerfile shipping gap: main.py imports the guard at module scope, but the runner stage only copied main.py/app.py/emotion_config.json/templates, so the README-documented docker build path would crash at startup with ModuleNotFoundError: No module named 'tools_auth'. Added COPY tools_auth.py ..
  • render.yaml blueprint: added HUME_TOOLS_SECRET (sync: false) so a Render deploy created from the blueprint surfaces the fail-closed state at setup time rather than after boot.

Also added the Failure-Class: none declaration to the PR body for the failure-class-protocol preflight, same as the sibling PRs.

@aryanorastar

Copy link
Copy Markdown
Collaborator

Closing as a later duplicate of #15090, opened earlier for the same hume-ai shared-secret auth on uid-keyed routes class.

Both still change plugins/hume-ai/main.py. This later head is 1a9befa2e9ae. David commenting or extra tests on this tip do not replace the earlier vehicle. Continue on #15090.

@github-actions

Copy link
Copy Markdown
Contributor

Hey @harmonygemini8-collab 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

harmonygemini8-collab added a commit to harmonygemini8-collab/omi that referenced this pull request Sep 23, 2026
Per review note on BasedHardware#15091: a discoverable entry helps deployments learn
about the shared secret before the fail-closed 503 makes it loud; the
comment spells out the deploy-window pairing with the /audio caller.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend Task (python) needs-maintainer-review Needs a human maintainer to sign off before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants