Repository navigation
fix(plugins): require shared secret on chat-tool routes (google-calendar, hive, linear, notion, shopify, ms365) - #15102
Conversation
…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
|
Verified end to end — this is a clean, correct fix that mirrors the merged shipbob precedent (#14684). What I verified
Notes for maintainers
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 |
|
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:
Before your next PR, please skim:
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! |
Summary
The
<app>_tools.pychat-tool routes in six Hermes-chat plugin apps read auidfrom the incoming request body and then act as that user using theuser's stored provider OAuth credential:
google_calendar_tools.py: reads the user's storedGoogle refresh token and calls the Calendar API (can write the user's
calendar)
hive_tools.py: acts on the user's stored Hive tokenlinear_tools.py: acts on the user's stored Linear tokennotion_tools.py: acts on the user's stored Notion tokenshopify_tools.py: acts on the user's stored Shopify tokenms365_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
uidtogether with the sharedintegration 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):
<app>_tools_auth.py), wired onto every/chat/tool/*route viaDepends(require_<app>_tools_shared_secret), sothe guard is impossible to skip:
503(refuses to serve any toolroute until the shared secret is configured)
401Authorization: Bearer <secret>or as a queryparameter (
?shared_secret=..., matching how the Hermes backend passes it)test_<app>_tools_auth.py) thatimport the real production app (
main.py→ FastAPITestClient), nostubs, no mocks of the guard, no network, no credentials, no live services —
they exercise the guard and prove every
/chat/tool/*route is wired toit.
All six entries registered in
.github/checks-manifest.yaml, each carrying theexempt-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):
66 hermetic tests total, all green, all hermetic (no network / creds / live
services; the suites import production
main.pythrough FastAPITestClientand assert the wiring: every chat-tool route depends on the guard).
Manifest validated deterministically:
.github/checks-manifest.yamlparses;258 hermetic checks registered; all 6 new entries present;
exemptentrypresent; working tree clean.
Checklist (per AGENTS.md)
(no stubs/mocks/network/credentials/live services)
/chat/tool/*route)present)
Failure-Class: none— newhermetic 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