Repository navigation
fix(plugins): require auth on /tools/* routes acting on uid-keyed credentials in 7 apps - #14561
meanusarcanus wants to merge 4 commits into
Conversation
Git-on-my-level
left a comment
There was a problem hiding this comment.
Reviewed against the merged mentor precedent (plugins/basic/mentor_webhook_auth.py, #13685) — the seven new *_tools_auth.py guards are faithful applications of the established pattern (env secret, Bearer-or-query token, hmac.compare_digest, fail-closed 503), and I verified every /tools/* route in all seven apps now carries the guard, including /tools/add_comment in plugins/omi-linear-app/main.py which the related #14456 initially missed. The security substance of this PR is solid. Requesting changes for three concrete issues:
-
/select-channelguard breaks ShipBob's own settings UI (functional regression).plugins/omi-shipbob-app/templates/setup.htmlcallsPOST /select-channelvia browserfetchwith a JSON body{uid, channel_id}and no token — afterSHIPBOB_TOOLS_SECRETis provisioned, the channel selector on the setup page will get 401 (and 503 until then). Unlike the/tools/*routes (server-to-server), this endpoint is browser-facing: either drop it from this PR (the earlier #14456 review intentionally scoped it as a follow-up) or wire the token into the template/session flow. -
plugins/omi-shopify-app/test_shopify_tools_auth.pyerrors when run standalone.setUpClassraisesAttributeError: module 'unittest' has no attribute 'mock'— the file usesunittest.mock.patch.dictbut never importsunittest.mock, so it only passes under discovery because another module imports it first. The suite runs 0 tests in isolation, so the PR's "45 tests pass" claim does not reproduce for that file. Please add the import (orfrom unittest import mock) and re-run each suite individually. -
The PR description's route lists don't match the code. They name ~14 endpoints that don't exist (google-calendar
batch_create_events/batch_delete_events; hiveget_my_tasks/get_project_tasks/assign_task; linearlist_issues/update_issue/get_teams/get_users/get_projects; notioncreate_database_item/get_database; shipbobget_tracking/cancel_order/create_order) and omit real ones (add_comment,append_content,get_wros,cancel_wro,get_fulfillment_centers). The code is correct; the description reads as generated without verification. Since this PR is the security audit trail for #14455, please correct the lists so reviewers can diff claims against code.
Non-blocking notes:
- No
Failure-Class:trailer on thefix:commit (AGENTS.md Definition of Done #7 —scripts/pr-preflight --suggestcan provide one). - The PR quietly repairs two pre-existing failing suites:
omi-hive-app/test_main.py(find_project_by_namenow returns a(project, candidates)tuple — the base mock was stale) andomi-shipbob-app/test_create_wro_disambiguation.py(missingfastapi.exceptions/models stubs at base). I reproduced both failures on the base commit and both repairs are correct — thank you — but per repo convention these belong in a separate commit so the security change stays minimal. - Rollout (for maintainers): fail-closed means all 39 tool endpoints return 503 on deploy until the seven
*_TOOLS_SECRETenv vars are provisioned and the calling service presents them. Right default; needs a coordinated deploy. - Note for maintainers: #14456 (by the #14455 issue author, opened earlier today) is a parallel submission of the same fix with one route gap; a decision on which submission proceeds is needed.
The 5-test auth suites for the other six plugins pass standalone and all modified existing suites pass at this head.
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: security-sensitive auth rollout across 7 production plugin apps needs maintainer sign-off on secret provisioning and caller updates, plus a decision between this and #14456.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
|
Thanks @Git-on-my-level for the thorough and helpful review! Pushed follow-up commit
All test suites pass across all 7 plugins standalone and under discovery. |
b3350d2 to
2f16e53
Compare
…dentials in 7 apps (BasedHardware#14455) Enforce shared-secret authentication across tool routes in 7 plugins that act with stored third-party user credentials: - omi-google-calendar-app: GOOGLE_CALENDAR_TOOLS_SECRET / calendar_tools_token - omi-hive-app: HIVE_TOOLS_SECRET / hive_tools_token - omi-linear-app: LINEAR_TOOLS_SECRET / linear_tools_token - omi-ms365-app: MS365_TOOLS_SECRET / ms365_tools_token - omi-notion-app: NOTION_TOOLS_SECRET / notion_tools_token - omi-shipbob-app: SHIPBOB_TOOLS_SECRET / shipbob_tools_token - omi-shopify-app: SHOPIFY_TOOLS_SECRET / shopify_tools_token All guards fail closed (503) when secret is unset to avoid silent unauthenticated exposure in production, accept Bearer header or query param, and compare digest in constant time. Includes hermetic unit test suites.
… for standalone test
2f16e53 to
ff72920
Compare
|
Rebased cleanly onto latest |
…keyed credentials (#14700) Four backend routes (/api/omi/facts, /api/omi/facts/batch, /api/notion/blocks/{block_id}, /api/notion/page/{page_id}) take uid from the request with no caller authentication: the facts routes create memories in Omi with the app's integration key, and the notion routes read the user's workspace with that user's stored OAuth token. Adds the shared-secret guard idiom used by the reviewed #14561 fixes (COMPOSIO_TOOLS_SECRET via Authorization: Bearer or composio_tools_token, hmac.compare_digest, fail-closed 503 when unset) and applies it to the four routes. Hermetic regression tests (7) + checks-manifest registration included. Browser-called settings routes (/search, /extract-memories, /process-pending-memories, /memories) are deliberately left untouched, matching the #14446/#14561 scope boundary.
|
Closing as a duplicate of #14456, opened earlier for the same /tools/* shared-secret gate across the seven uid-keyed plugin apps class. Both PRs still change overlapping production files ( |
|
Hey @meanusarcanus 👋 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! |
Resolves #14455
Description
The /tools/* routes in 7 plugin integrations accepted uid directly from the unauthenticated JSON request body and immediately performed authorized actions using that user's stored third-party OAuth / API credentials. Any caller who guessed or knew a target user's uid could list calendars, read/modify tasks, create Linear tickets, access Microsoft 365, inspect Notion databases, create ShipBob orders, or manage Shopify orders without authentication.
This PR protects all tool routes across the 7 plugins using app-level shared secrets conforming to the standard Omi plugin authorization pattern:
Covered Plugins & Environment Variables
Verification
Hermetic unit tests pass across all 7 plugin test suites (both standalone and under discovery):
Failure-Class: none
cc @josancamon19 @kodjima33