Skip to content

fix(plugins): require auth on /tools/* routes acting on uid-keyed credentials in 7 apps - #14456

Open
hridaya423 wants to merge 4 commits into
BasedHardware:mainfrom
hridaya423:fix/tools-uid-auth
Open

hridaya423 wants to merge 4 commits into
BasedHardware:mainfrom
hridaya423:fix/tools-uid-auth

Conversation

@hridaya423

@hridaya423 hridaya423 commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

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 takes uid from the JSON body and acts with that user's stored OAuth token/API credentials, no caller authentication:

App Routes Exposure
omi-google-calendar-app 6 list/create/get/update/delete events, list calendars
omi-hive-app 5 read projects/tasks, create task, update status, search
omi-linear-app 6 create/update issues, list/search/get
omi-notion-app 8 search/read/create/update/append pages, query databases
omi-shopify-app 6 orders/customers/analytics, create order/customer
omi-ms365-app 1 dispatcher → 17 tools send email, Teams messages, OneDrive upload, calendar events
omi-shipbob-app 7 inventory/orders read, create/cancel warehouse receiving orders

39 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-app and omi-github-app are already covered by the #13463 umbrella; these seven are not in its file list. ms365's _auth_guard only verifies the uid has a connected account; it does not authenticate the caller.

Fix

Per-app <mod>_tools_auth.py shared-secret guard (Authorization: Bearer or <mod>_tools_token query param → <APP>_TOOLS_SECRET env, hmac.compare_digest), applied via Depends() 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.py per app: 503 unconfigured, 401 missing/wrong, bearer + query token accepted. 14 existing test stubs gained a Depends attribute; shipbob's real-TestClient cancel_wro tests bypass via dependency_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_disambiguation collection (stale models stub).

Refs #14455

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
@hridaya423 hridaya423 changed the title fix(plugins): require auth on /tools/* routes acting on uid-keyed credentials in 5 apps fix(plugins): require auth on /tools/* routes acting on uid-keyed credentials in 7 apps Sep 18, 2026

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. 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.
  2. Adjacent, fine to leave out of this PR: POST /select-channel in plugins/omi-shipbob-app/main.py also trusts body uid (writes update_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.

@Git-on-my-level Git-on-my-level added security-review Touches auth, provider routing, secrets, or security-sensitive surfaces needs-maintainer-review Needs a human maintainer to sign off before merge python labels Sep 18, 2026
…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.
@hridaya423

Copy link
Copy Markdown
Contributor Author

Requested change addressed in 881204e787:

  • plugins/omi-linear-app/main.py — /tools/add_comment now carries Depends(require_linear_tools_auth) (f3190a0). Confirmed it was the 7th /tools/* route and the only one missed.
  • plugins/omi-shipbob-app/main.py — /select-channel now carries Depends(require_shipbob_tools_auth) — took the flagged adjacent fix in this PR since it shares the same secret and deployment note.

Verification: test_linear_tools_auth.py 5/5, test_shipbob_tools_auth.py 5/5, shipbob test_main.py 61/61 — all hermetic, all pass.

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.

@aryanorastar

Copy link
Copy Markdown
Collaborator

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

@aryanorastar

Copy link
Copy Markdown
Collaborator

Keeping this open. Not approving 881204e787a8. seven-app /tools/* auth add, not shrink-only. CONFLICTING DIRTY, 0 checks. Rebase union; do not approve.

— Astar, on behalf of @aryanorastar

@Git-on-my-level
Git-on-my-level dismissed their stale review October 1, 2026 17:11

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.

@Git-on-my-level

Copy link
Copy Markdown
Member

Both follow-ups from my earlier review are addressed on the current head — thank you for the quick turnaround.

  • plugins/omi-linear-app/main.py: POST /tools/add_comment now carries Depends(require_linear_tools_auth) — this was the blocking gap (the commentCreate mutation acting on the victim's stored Linear token).
  • plugins/omi-shipbob-app/main.py: POST /select-channel now carries Depends(require_shipbob_tools_auth) — the adjacent route I'd flagged as a follow-up; covering it here is appreciated.

I re-verified the full inventory on this head: all 39 /tools/* routes across the seven apps (google-calendar 6, hive 5, linear 7, notion 8, shopify 6, ms365 dispatcher covering 17 tools, shipbob 7) plus /select-channel are guarded. The remaining unguarded routes are OAuth callbacks, setup/status, health, and the public .well-known/omi-tools.json manifests — correct scope. The per-app guard modules mirror the merged plugins/basic/mentor_webhook_auth.py precedent (env secret, hmac.compare_digest, fail-closed 503 unconfigured, bearer-or-query token), and the seven new test_*_tools_auth.py suites cover the 503/401/bearer/query cases. The existing-test stub updates (adding Depends across the stubbed fastapi modules) and the dependency_overrides in plugins/omi-shipbob-app/test_main.py remain minimal and correct.

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 *_TOOLS_SECRET env vars are provisioned and the calling chat service presents them. That's a coordinated deploy decision rather than a code change.


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

This branch has not been deployed

No deployments
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-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