Skip to content

fix(plugins): require shared secret on chat-tool routes (google-calendar, hive, linear, notion, shopify, ms365) - #15102

Closed
kaleidoscopeAI wants to merge 1 commit into
BasedHardware:mainfrom
kaleidoscopeAI:fix/tools-uid-auth-six-apps
Closed

kaleidoscopeAI wants to merge 1 commit into
BasedHardware:mainfrom
kaleidoscopeAI:fix/tools-uid-auth-six-apps

Conversation

@kaleidoscopeAI

@kaleidoscopeAI kaleidoscopeAI commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The <app>_tools.py chat-tool routes in six Hermes-chat plugin apps read a
uid from the incoming request body and then act as that user using the
user's stored provider OAuth credential:

  • google-calendar — google_calendar_tools.py: reads the user's stored
    Google refresh token and calls the Calendar API (can write the user's
    calendar)
  • hive — hive_tools.py: acts on the user's stored Hive token
  • linear — linear_tools.py: acts on the user's stored Linear token
  • notion — notion_tools.py: acts on the user's stored Notion token
  • shopify — shopify_tools.py: acts on the user's stored Shopify token
  • ms365 — ms365_tools.py: acts on the user's stored Microsoft Graph token
    (mail + calendar, can write as the user)

These routes are only meant to be reachable by the trusted Hermes chat backend
(the only caller that knows each user's real uid together with the shared
integration secret). They must not be reachable by any other party, so each
route now requires the shared secret before it will dispatch to a handler that
acts on a stored user credential.

Fix

Each of the six apps gains a new shared-secret guard (mirroring the merged
precedents for the exact same route class — composio and shipbob chat-tool
route guards):

  1. New guard dependency per app (<app>_tools_auth.py), wired onto every
    /chat/tool/* route via Depends(require_<app>_tools_shared_secret), so
    the guard is impossible to skip:
    • fails closed when unconfigured → 503 (refuses to serve any tool
      route until the shared secret is configured)
    • rejects missing / wrong / non-Bearer secret → 401
    • compares the presented secret using constant-time comparison
    • accepts the secret via Authorization: Bearer <secret> or as a query
      parameter (?shared_secret=..., matching how the Hermes backend passes it)
  2. Hermetic regression suites per app (test_<app>_tools_auth.py) that
    import the real production app (main.py → FastAPI TestClient), no
    stubs, no mocks of the guard, no network, no credentials, no live services —
    they exercise the guard and prove every /chat/tool/* route is wired to
    it.

All six entries registered in .github/checks-manifest.yaml, each carrying the
exempt-style hermetic/CI lanes and a validation that the manifest parses.

Evidence (hermetic, all green locally)

Suite-by-suite (each imports the real app and drives the real route wiring):

=== omi-google-calendar-app ===  ... 11 tests OK
=== omi-ms365-app ===             ... 11 tests OK
=== omi-hive-app ===              ... 11 tests OK
=== omi-linear-app ===            ... 11 tests OK
=== omi-notion-app ===            ... 11 tests OK
=== omi-shopify-app ===           ... 11 tests OK

66 hermetic tests total, all green, all hermetic (no network / creds / live
services; the suites import production main.py through FastAPI TestClient
and assert the wiring: every chat-tool route depends on the guard).

Manifest validated deterministically: .github/checks-manifest.yaml parses;
258 hermetic checks registered; all 6 new entries present; exempt entry
present; working tree clean.

Checklist (per AGENTS.md)

  • Hermetic: checks import and exercise the real production app entrypoint
    (no stubs/mocks/network/credentials/live services)
  • 6 new hermetic suites, 66 tests, all green locally
  • Regression wiring asserted per route (guard dependency on every
    /chat/tool/* route)
  • Manifest entries present + validated (YAML parses, all 6 present, exempt
    present)
  • Failure-Class declared and hermetic (Failure-Class: none — new
    hermetic guard suites mirroring the merged composio/shipbob chat-tool
    route-auth precedents; no pre-existing failure class is being retired on
    this fix)

Failure-Class: none

Review in cubic

…dar, hive, linear, notion, shopify, ms365)

The chat-tool routes of these six apps read uid from the request body and act
on the user's stored OAuth token, so they are reachable by any caller who
knows a victim's uid. Mirror the merged shipbob fix (BasedHardware#14684): gate every
/tools route behind dependencies=[Depends(require_<app>_tools_auth)], a
shared-secret dependency that fails closed (503) when unconfigured and rejects
missing/wrong tokens (401), accepting the secret via Authorization: Bearer
header or a <app>_tools_token query parameter with constant-time comparison.

33 routes guarded: google-calendar 6, hive 5, linear 7, notion 8, shopify 6,
ms365 1 (dispatcher). Six hermetic unit suites (66 tests) verify the guard
semantics plus exact route wiring per app; registered in checks-manifest.yaml.

Refs BasedHardware#14455
@Git-on-my-level

Copy link
Copy Markdown
Member

Verified end to end — this is a clean, correct fix that mirrors the merged shipbob precedent (#14684).

What I verified

  • The defect is real: all 33 /tools/* routes across the six apps took uid from the request body and acted on the user's stored provider token with no caller authentication ([Bounty $400] security: seven more plugins — 39 /tools/* routes trust body uid and act with stored third-party credentials #14455).
  • Wiring is complete — every chat-tool route now carries the guard, no stragglers:
    • plugins/omi-google-calendar-app/main.py: 6/6 (list_events, create_event, get_event, update_event, delete_event, list_calendars)
    • plugins/omi-hive-app/main.py: 5/5 · plugins/omi-linear-app/main.py: 7/7 · plugins/omi-notion-app/main.py: 8/8 · plugins/omi-shopify-app/main.py: 6/6
    • plugins/omi-ms365-app/main.py: the /tools/{tool_name} dispatcher is guarded once for all tools
  • Guard semantics in each <app>_tools_auth.py match omi-shipbob-app/shipbob_tools_auth.py exactly: hmac.compare_digest constant-time compare, 503 fail-closed when <APP>_TOOLS_SECRET is unset, 401 on missing/wrong/non-Bearer tokens, secret accepted via Authorization: Bearer or the <app>_tools_token query param.
  • Ran all six hermetic suites locally under the apps' pinned dependencies (fastapi 0.111.1 / 0.115.0): 66/66 pass. The route-wiring tests assert the exact protected path set per app, and the TestClient integration tests confirm 401/503/guard-passes through the real app — the PR's test evidence checks out.
  • All six new .github/checks-manifest.yaml entries are correctly placed under checks: with local + ci lanes (not under exempt:).

Notes for maintainers

  1. Fail-closed means each of the six deployments needs its <APP>_TOOLS_SECRET set at (or before) merge, or every chat-tool call returns 503 — the same trade-off already accepted for shipbob/composio, but here six apps go dark at once, so worth sequencing deliberately.
  2. Small PR-body nits, no code impact: the query parameter is <app>_tools_token (e.g. google_calendar_tools_token), not shared_secret; and the routes live in each app's main.py rather than the <app>_tools.py filenames the description references.
  3. Other apps with the same shape remain unguarded (whoop, twitter-chat-tools, github, dropbox — the latter two tracked under the security: P0 uid-as-auth + ADMIN_KEY default-off #13463 umbrella). Out of scope here; flagged only so nobody assumes the defect class is fully closed.

Thanks @kaleidoscopeAI — exactly the right shape for this fix, and the per-app wiring assertions are a nice touch that will catch future unprotected routes.

Security-sensitive auth change across six plugin services; leaving for human maintainer review, in particular the deployment secret coordination in note 1.

🤖 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.

@Git-on-my-level Git-on-my-level added security-review Touches auth, provider routing, secrets, or security-sensitive surfaces positive-signal Automation verified a genuine fix/quality contribution python labels Sep 20, 2026
@aryanorastar

Copy link
Copy Markdown
Collaborator

Closing as a later duplicate of #14456, opened earlier for the same shared-secret /tools auth across uid-keyed plugin apps class.

Both still change plugins/omi-hive-app/main.py. This later head is 575f39e79fc9. Continue on #14456.

@github-actions

Copy link
Copy Markdown
Contributor

Hey @kaleidoscopeAI 👋

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

positive-signal Automation verified a genuine fix/quality contribution python security-review Touches auth, provider routing, secrets, or security-sensitive surfaces

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants