Repository navigation
fix(plugins): require auth on /tools/* routes acting on uid-keyed credentials in 7 apps - #14456
hridaya423 wants to merge 4 commits into
Conversation
google-calendar, hive, linear, notion-app, and shopify tool routes all took uid from the JSON body and acted with stored third-party credentials — delete calendar events, create Linear issues, write Notion pages, create Shopify orders/customers — no caller auth. Same uid-as-auth class as zapier (BasedHardware#14428), mentor (BasedHardware#13685), BasedHardware#14446, BasedHardware#14451, BasedHardware#14453; these five were missed by all and by the BasedHardware#13463 umbrella. Adds per-app <mod>_tools_auth.py (shared-secret bearer/query-token guard, <APP>_TOOLS_SECRET env, hmac.compare_digest) applied via Depends() to all 31 routes. Fails closed 503 unconfigured, 401 bad token. Verified: 154 plugin tests + 198 subtests pass including 25 new guard tests; 12 existing test stubs gained Depends for the hermetic path. (test_main.py::test_create_task_success in hive fails identically on clean upstream — pre-existing.) Refs BasedHardware#14455
ms365's /tools/{tool_name} dispatcher reaches 17 tools (send_email,
OneDrive upload, Teams messages) keyed by body uid — its _auth_guard
only checks the uid is connected, not that the caller is authorized.
shipbob's 7 /tools/* routes read/create/cancel warehouse orders with
per-uid tokens.
shipbob test_main.py cancel_wro tests use real TestClient — bypassed
via dependency_overrides. test_create_wro_disambiguation.py fails to
collect on clean upstream (models stub missing GetInventoryRequest) —
untouched, pre-existing.
Refs BasedHardware#14455
Git-on-my-level
left a comment
There was a problem hiding this comment.
This is a strong, well-scoped security fix — thank you. The guard is a faithful application of the merged mentor precedent (plugins/basic/mentor_webhook_auth.py): env-sourced secret, hmac.compare_digest, fail-closed 503 when unconfigured, bearer-or-query token. I verified all 39 listed routes now carry Depends(require_*_tools_auth) and ran all seven test_*_tools_auth.py suites locally — 5/5 pass each (503 unconfigured, 401 missing/wrong token, bearer + query accepted).
One gap — requesting changes for just this:
/tools/add_comment in plugins/omi-linear-app/main.py is missed. Linear has 7 /tools/* routes, not 6. tool_add_comment takes uid from the JSON body, loads the victim's stored token via get_linear_tokens(uid), and posts through the commentCreate mutation — exactly the defect class this PR closes, left unguarded. Please add the same _auth: None = Depends(require_linear_tools_auth) parameter there.
Two non-blocking notes:
- Rollout coordination (for maintainers): fail-closed means all 39 chat-tool endpoints return 503 on deploy until seven new env secrets are provisioned (
GOOGLE_CALENDAR_TOOLS_SECRET,HIVE_TOOLS_SECRET,LINEAR_TOOLS_SECRET,MS365_TOOLS_SECRET,NOTION_TOOLS_SECRET,SHIPBOB_TOOLS_SECRET,SHOPIFY_TOOLS_SECRET) and the calling service presents them. Right default, but it needs a coordinated deploy. - Adjacent, fine to leave out of this PR:
POST /select-channelinplugins/omi-shipbob-app/main.pyalso trusts bodyuid(writesupdate_shipbob_channel(uid, channel_id), no caller auth). Worth a small follow-up in the same series.
The existing-test accommodations (adding Depends to the stubbed fastapi modules across 15 test files, and the dependency_overrides in plugins/omi-shipbob-app/test_main.py) are minimal and correct.
Once the Linear route is added this should be ready quickly. Security-sensitive auth rollout across 7 production plugin apps needs maintainer sign-off on secret provisioning and caller updates before merge.
This review was posted by an automated AI maintainer assistant on behalf of the Omi maintainers. AI-generated feedback — human review is still required before merge.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
…ls_auth Missed 7th linear /tools/* route — add_comment takes uid from the JSON body and posts through the victim's stored Linear credentials. Applies the same Depends(require_linear_tools_auth) guard as the other six.
…s_auth Same defect class flagged in review: body uid writes update_shipbob_channel with no caller auth. Reuses the shipbob tools secret guard.
|
Requested change addressed in
Verification: Noted on the 503-unconfigured rollout: seven env secrets must be provisioned and the calling service updated before deploy — agreed that's maintainer-side coordination. |
|
Keeping this open on 881204e. Calendar tool_list_events on main has no Depends, and the same pattern is on the other six apps in this head. Dirty, no checks, not one defect. Not approving this SHA. — Astar, on behalf of @aryanorastar |
|
Keeping this open. Not approving — Astar, on behalf of @aryanorastar |
Resolved on the current head: commit f3190a0 adds Depends(require_linear_tools_auth) to POST /tools/add_comment in plugins/omi-linear-app/main.py — the missed route this review blocked on. All 39 /tools/* routes plus /select-channel across the seven apps are verified guarded. Remaining merge prerequisite is maintainer sign-off on the fail-closed rollout (seven *_TOOLS_SECRET env vars + calling-service updates), tracked in the open needs-maintainer-review label.
|
Both follow-ups from my earlier review are addressed on the current head — thank you for the quick turnaround.
I re-verified the full inventory on this head: all 39 The earlier change request is resolved and I've dismissed that review. What remains before merge is maintainer sign-off on rollout: fail-closed means all 40 endpoints return 503 on deploy until the seven This feedback was posted by an automated AI maintainer assistant on behalf of the Omi maintainers. AI-generated feedback — human review is still required before merge. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
Summary
The uid-as-auth defect class (zapier #14428/#14429, mentor #13685, slack/clickup/twitter #14446/#14447, twitter-chat-tools #14451/#14452, whoop #14453/#14454) has seven more instances. Every
/tools/*route takesuidfrom the JSON body and acts with that user's stored OAuth token/API credentials, no caller authentication:omi-google-calendar-appomi-hive-appomi-linear-appomi-notion-appomi-shopify-appomi-ms365-appomi-shipbob-app39 routes across 7 apps. Anyone with a uid can create calendar events, file Linear issues, write Notion pages, create Shopify orders, send email as the victim, or cancel ShipBob warehouse orders.
omi-dropbox-appandomi-github-appare already covered by the #13463 umbrella; these seven are not in its file list. ms365's_auth_guardonly verifies the uid has a connected account; it does not authenticate the caller.Fix
Per-app
<mod>_tools_auth.pyshared-secret guard (Authorization: Beareror<mod>_tools_tokenquery param →<APP>_TOOLS_SECRETenv,hmac.compare_digest), applied viaDepends()to all 39 routes. Caller authentication only; uid stays the body-level data-plane key. Fail-closed 503 unconfigured, 401 bad token. Same mechanism as the merged mentor precedent.Tests
One
test_<mod>_tools_auth.pyper app: 503 unconfigured, 401 missing/wrong, bearer + query token accepted. 14 existing test stubs gained aDependsattribute; shipbob's real-TestClient cancel_wro tests bypass viadependency_overrides.Per-app
pytest: 253 tests + 201 subtests pass (35 new). Pre-existing failures on clean upstream, untouched:omi-hive-app test_create_task_success,omi-shipbob-app test_create_wro_disambiguationcollection (stale models stub).Refs #14455