Skip to content

fix(composio): require shared secret on backend routes acting on uid-keyed credentials - #14700

Merged
kodjima33 merged 1 commit into
BasedHardware:mainfrom
kduailabs:fix/composio-backend-route-auth
Sep 19, 2026
Merged

kodjima33 merged 1 commit into
BasedHardware:mainfrom
kduailabs:fix/composio-backend-route-auth

Conversation

@kduailabs

@kduailabs kduailabs commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Four backend routes in the Composio app take uid from the request and act on that user's data with no caller authentication:

  • POST /api/omi/facts?uid=<uid> and POST /api/omi/facts/batch (uid in body) create memories in Omi for that uid using the app's own integration key (OMI_APP_ID/OMI_API_KEY).
  • POST /api/notion/blocks/{block_id} (uid in body) and GET /api/notion/page/{page_id}?uid= read the user's Notion workspace with that user's stored OAuth token.

Any caller can inject memories into an arbitrary user's Omi account (assistant memory poisoning) or read the Notion content of any user who has connected the integration, without knowing anything but the uid.

Fix

Adds composio_tools_auth.py — the same shared-secret guard idiom as the reviewed #14561 fixes — and applies it via Depends() to the four routes: Authorization: Bearer <COMPOSIO_TOOLS_SECRET> or composio_tools_token query param, hmac.compare_digest, fail-closed 503 when the secret is unset, 401 otherwise. No route logic changes.

Scope: browser-called settings routes (/search, /extract-memories, /process-pending-memories, /memories) are deliberately left untouched — same boundary as #14446/#14561, since those share the fleet-wide uid model tracked by #13463.

Tests

plugins/composio/test_tools_auth.py — 7 hermetic tests (fastapi stubbed, no third-party deps): 503 unconfigured/blank, 401 missing/wrong/non-bearer token, bearer + query token accepted. Registered in .github/checks-manifest.yaml.

Review in cubic

…keyed credentials

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 BasedHardware#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 BasedHardware#14446/BasedHardware#14561 scope boundary.
@kduailabs

Copy link
Copy Markdown
Contributor Author

Bounty proposal for this fix: #14701

@kduailabs

Copy link
Copy Markdown
Contributor Author

@josancamon19 @Git-on-my-level — security fix ready for review: shared-secret guard on the four Composio backend routes that took uid with no caller auth (memory writes into any Omi account; reads of any user's Notion workspace with their stored token). Same idiom as the reviewed #14561 guards, 7 hermetic tests, manifest entry included. Bounty proposal: #14701 (US$150 proposed).

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Well-documented, tested shared-secret auth guard on uid-keyed Composio routes, mirrors already-reviewed pattern (#14561); scoped diff, 7 hermetic tests, no CI blockers.

@kodjima33
kodjima33 merged commit 42cc024 into BasedHardware:main Sep 19, 2026
1 check passed
kduailabs added a commit to kduailabs/omi that referenced this pull request Sep 19, 2026
The shared-secret guard merged in BasedHardware#14700 added 'from .tools_auth import require_composio_tools_auth' to src/omi_api.py, which the hermetic route test (from BasedHardware#14384) could not resolve with its stub module set — composio-memory-route-tests started failing in the PR preflight lane for every PR touching plugins/composio/**.

Adds a src.tools_auth stub so the test stays hermetic. Verified: python3 plugins/composio/test_omi_api_route.py -> 7 tests pass.
Git-on-my-level added a commit that referenced this pull request Sep 20, 2026
#14700 added 'from .tools_auth import require_composio_tools_auth' to
plugins/composio/src/omi_api.py but test_omi_api_route.py's hermetic
module loader stubs only src.db, so the manifest check
composio-memory-route-tests crashed with ModuleNotFoundError and the
first-attempt Release Eligibility push run went red on main (run
35450082746) — blocking mobile release-tag admission until a green
newer main. Stub src.tools_auth with an arg-tolerant no-op guard; the
guard's real behavior remains covered by test_tools_auth.py.

Failure-Class: FC-fixture-mock-signature-drift

Verification: reproduced the identical ModuleNotFoundError at the base
SHA; after the fix test_omi_api_route.py runs 7 tests OK and
test_tools_auth.py runs 7 tests OK.
Git-on-my-level added a commit that referenced this pull request Sep 20, 2026
…#15095)

fix(composio): stub src.tools_auth in the hermetic route-test harness

## Summary
- #14700 added `from .tools_auth import require_composio_tools_auth` to
`plugins/composio/src/omi_api.py`, but `test_omi_api_route.py`'s
hermetic
  module loader stubs only `src.db`. The import crashed with
  `ModuleNotFoundError: No module named 'src.tools_auth'`, failing the
  `composio-memory-route-tests` manifest check and the first-attempt
  `Release Eligibility` push run on main (42cc024, run 35450082746).
Mobile release-tag admission requires a green `Release Eligibility`, so
the red main also blocks all new mobile release tags until a newer green
  main lands.
- Fix: add a `src.tools_auth` stub module to the harness with an
  arg-tolerant no-op `require_composio_tools_auth`. The guard's real
  behavior stays covered by `plugins/composio/test_tools_auth.py`
(manifest id `composio-backend-route-auth-tests`), which passes
unchanged.

## Failure-Class
Failure-Class: FC-fixture-mock-signature-drift

## Verification
- Reproduced at the base SHA before the fix:
  `python3 plugins/composio/test_omi_api_route.py` →
  `ModuleNotFoundError: No module named 'src.tools_auth'` (identical
  traceback to the CI failure in run 35450082746).
- After the fix: `python3 plugins/composio/test_omi_api_route.py` →
  `Ran 7 tests ... OK`; `python3 plugins/composio/test_tools_auth.py` →
  `Ran 7 tests ... OK`.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/15095?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants