Skip to content

fix(plugins): require auth on hume-ai routes writing memories and pushing notifications (#15089) - #23711

Merged
Git-on-my-level merged 2 commits into
BasedHardware:mainfrom
hardik4love-lang:fix/hume-ai-route-auth-15089
Nov 8, 2026
Merged

Git-on-my-level merged 2 commits into
BasedHardware:mainfrom
hardik4love-lang:fix/hume-ai-route-auth-15089

Conversation

@hardik4love-lang

Copy link
Copy Markdown
Contributor

Summary

Closes #15089

Before this fix, three routes in plugins/hume-ai/main.py took uid straight 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:

  • Added plugins/hume-ai/hume_tools_auth.py: provides require_hume_tools_auth accepting credentials via Authorization: Bearer <secret> or hume_tools_token query parameter, using constant-time hmac.compare_digest with UTF-8 byte encoding and failing closed with HTTP 503 when unconfigured.
  • Wired dependencies=[Depends(require_hume_tools_auth)] onto /audio, /save-emotion-memory, and /force-send-notification in plugins/hume-ai/main.py.
  • Updated plugins/hume-ai/Dockerfile to COPY hume_tools_auth.py . so container deployments boot without ModuleNotFoundError.
  • Updated plugins/hume-ai/render.yaml with - key: HUME_TOOLS_SECRET (sync: false).
  • Updated plugins/hume-ai/.env.example and plugins/hume-ai/README.md documenting service auth.
  • Registered hume-ai-route-auth-tests in .github/checks-manifest.yaml and added hermetic test suite in plugins/hume-ai/test_hume_tools_auth.py (9/9 pass).

Failure-Class: none
UI-Evidence: none

Bounty request: $150 (as proposed on #15089)

@Git-on-my-level

Copy link
Copy Markdown
Member

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:

  • plugins/hume-ai/hume_tools_auth.py - the new guard fails closed (503) when HUME_TOOLS_SECRET is unset or blank, rejects missing/wrong/non-Bearer tokens with 401 + WWW-Authenticate, and compares tokens with hmac.compare_digest on UTF-8 bytes - constant-time, and it sidesteps the str-comparison TypeError edge case present in the plugins/basic/mentor_webhook_auth.py precedent it mirrors. Good touch.
  • plugins/hume-ai/main.py - Depends(require_hume_tools_auth) is wired onto exactly /audio, /save-emotion-memory and /force-send-notification; the remaining routes are untouched.
  • plugins/hume-ai/test_hume_tools_auth.py - genuinely hermetic (fastapi stubbed), and I ran it: 9/9 pass, including fail-closed and route-wiring assertions.
  • plugins/hume-ai/Dockerfile (COPY added), plugins/hume-ai/render.yaml (secret with sync: false), plugins/hume-ai/.env.example, plugins/hume-ai/README.md, and the .github/checks-manifest.yaml check registration are all consistent with each other and with the existing hume-ai check pattern.

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 uid. Blast radius if the guard were wrong: either locking out or opening up those routes; the fail-closed default means a misconfigured deployment surfaces as 503 rather than silently unauthenticated access.

Ops note: existing external callers of these routes will start receiving 401/503 until HUME_TOOLS_SECRET is configured and distributed - deliberate, but the deployment needs the secret at rollout time.

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):

  • /analyze-text (main.py:315) and /reset-stats remain unauthenticated; /analyze-text lets anonymous callers burn Hume API quota. Worth a follow-up guard.
  • The README and .env.example Bearer examples render a stray *** (broken backticks around Authorization: Bearer <token>); cosmetic fix.

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 need human response.

@hardik4love-lang

Copy link
Copy Markdown
Contributor Author

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!

@Git-on-my-level Git-on-my-level added the needs-maintainer-review Needs a human maintainer to sign off before merge label Oct 27, 2026
@Git-on-my-level

Copy link
Copy Markdown
Member

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 mentor_webhook_auth pattern. Leaving formal sign-off to a human maintainer since this changes the plugin's auth surface.

  • plugins/hume-ai/hume_tools_auth.py: _configured_secret() treats unset and whitespace-only secrets as unconfigured, and require_hume_tools_auth then raises 503, so the service never silently runs unauthenticated. Comparison uses hmac.compare_digest on UTF-8 bytes (constant time); Bearer scheme matching is case-insensitive and non-Bearer schemes are rejected with 401 + WWW-Authenticate.
  • plugins/hume-ai/main.py: /audio, /save-emotion-memory and /force-send-notification are each wired with dependencies=[Depends(require_hume_tools_auth)] and the import is added at the top. I checked the remaining routes: /analyze-text only echoes uid back (no Omi writes), and /emotion-config / /reset-stats are global config/stats knobs documented as local-dev-only - so the three guarded routes are exactly the user-data write surface.
  • plugins/hume-ai/test_hume_tools_auth.py: I ran the suite in an isolated container - 9/9 pass. Good coverage: 503 fail-closed (unset and blank secret), 401 on missing/wrong/non-bearer token, bearer and query-param acceptance, plus an assertion that the decorators actually exist in main.py.
  • Dockerfile / render.yaml / .env.example / README.md: COPY hume_tools_auth.py . added so the image boots; render.yaml declares HUME_TOOLS_SECRET (sync: false); docs accurately describe both token channels and the 401/503 semantics.

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.
Rollout (action needed before merge): the guard fails closed, so HUME_TOOLS_SECRET must be provisioned in Render when this ships, otherwise all three routes return 503.
Cost (minor, follow-up): /analyze-text remains unauthenticated and spends Hume API credits per call; no user-data writes there, but worth guarding or rate-limiting later.
Nit: the hume_tools_token query channel can leak the secret into access logs; the Bearer header is the safer channel and already supported - consider deprecating the query param later.

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 HUME_TOOLS_SECRET is provisioned in Render at deploy time, and (optional follow-up) a guard or rate limit on /analyze-text plus eventual deprecation of the query-param token channel.

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 need human response.

hardik4love-lang added 2 commits October 31, 2026 09:49
…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
@hardik4love-lang
hardik4love-lang force-pushed the fix/hume-ai-route-auth-15089 branch from 4588cf9 to 68b7bd7 Compare October 31, 2026 04:20
@Git-on-my-level

Copy link
Copy Markdown
Member

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; HUME_TOOLS_SECRET must be provisioned in Render before/at rollout since the guard fails closed with 503; optional follow-ups from last time remain: a guard or rate limit on /analyze-text, which still spends Hume API quota unauthenticated, and eventual deprecation of the query-param token channel in favor of the Bearer header) · newly introduced (none found).

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.
Blast radius: if HUME_TOOLS_SECRET is not set at deploy time, /audio, /save-emotion-memory and /force-send-notification return 503 until it is — deliberate, but rollout must sequence the secret.

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 HUME_TOOLS_SECRET in Render at rollout, and (2) pick between this PR and the older open #15090, which implements the same guard — and note #15089 was closed with "we aren't doing bounties at the moment", so the bounty request in the PR description will not be honored.


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

@Git-on-my-level
Git-on-my-level merged commit 0b49927 into BasedHardware:main Nov 8, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-maintainer-review Needs a human maintainer to sign off before merge python Security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bounty $150] security: hume-ai — unauthenticated uid-keyed routes write memories into any Omi account and push notifications to any user

2 participants