Skip to content

fix(plugins): require auth on shipbob-app routes trusting body uid - #14680

Closed
onkar717 wants to merge 2 commits into
BasedHardware:mainfrom
onkar717:security/shipbob-tools-auth
Closed

onkar717 wants to merge 2 commits into
BasedHardware:mainfrom
onkar717:security/shipbob-tools-auth

Conversation

@onkar717

@onkar717 onkar717 commented Sep 19, 2026 •

Copy link
Copy Markdown

What this does

Adds a shared-secret auth guard in front of the eight chat-tool routes in omi-shipbob-app that previously acted on any uid supplied in the request body.

Vulnerability

Every chat-tool route in plugins/omi-shipbob-app/main.py takes uid from the request body, calls get_shipbob_headers(uid) (main.py:141), and acts on that user's connected ShipBob account, with no caller authentication:

  • POST /tools/get_inventory (main.py:625)
  • POST /tools/get_products (main.py:685)
  • POST /tools/create_wro (main.py:729, write)
  • POST /tools/get_wros (main.py:885)
  • POST /tools/cancel_wro (main.py:942, destructive)
  • POST /tools/get_orders (main.py:982, customer data)
  • POST /tools/get_fulfillment_centers (main.py:1044)
  • POST /select-channel (main.py:601, write)

get_shipbob_headers returns {"Authorization": f"Bearer {tokens['access_token']}"} for the uid's stored token, so anyone who knows a uid can read another user's orders and customer data, cancel their receiving orders, or create WROs under their account. Same defect class as the open security filings for whoop (#14453) and zapier (#14428).

Fix

New plugins/omi-shipbob-app/shipbob_tools_auth.py: require_shipbob_tools_auth checks Authorization: Bearer or a shipbob_tools_token query param against the SHIPBOB_TOOLS_SECRET env var with hmac.compare_digest, applied via Depends() to the /tools/* routes. Fail-closed 503 when unconfigured, 401 on missing or wrong token.

This follows the merged mentor guard plugins/basic/mentor_webhook_auth.py (#13685), which is the same shared-secret shape. The whoop guard PR #14454 (issue #14453) is the open sibling in this family; it is not merged yet, and no *_tools_auth.py exists on main today.

Tests

New hermetic regression test plugins/omi-shipbob-app/test_tools_auth.py (stdlib only), registered as shipbob-tools-auth-tests in .github/checks-manifest.yaml. It covers the guard behaviour (503 unconfigured, 401 missing, 401 wrong, pass on Bearer, pass on query param) and asserts all eight routes depend on the guard. 6/6 pass locally.

A follow-up commit keeps the existing suites green under the guard:

Accuracy notes: the checks-manifest entry runs only test_tools_auth.py for this plugin, not the full suite, so the two items above are not CI-visible today. test_create_wro_disambiguation.py has separate pre-existing stub gaps on main (verified: it fails on clean main with ModuleNotFoundError: No module named 'fastapi.exceptions', plus an incomplete models stub) unrelated to this change; I left those as-is rather than widen the PR. I could not run test_main.py locally (no fastapi/pip on this machine, Python 3.14); the dependency_overrides change matches the pattern named in review.

Rollout note

Guard-first: until the backend caller (backend/utils/retrieval/tools/app_tools.py, _call_tool_endpoint) sends SHIPBOB_TOOLS_SECRET and the env var is deployed, the /tools/* routes return 503/401. This is the same coordination the whoop family needs; sequencing is a maintainer decision (discussion in the review thread). /select-channel is called from the plugin's own browser page and cannot hold the secret; per review it should use a per-uid signature (whoop's disconnect_sig shape) rather than the shared secret, which I will apply on your nod.

Bounty

Proposing US$200, in line with the per-app security fixes proposed in this family (#14453, #14451).
PayPal: [email protected]

Fixes #14666

Failure-Class: none

Investigated and implemented with AI assistance; I verified the reproduction and the fix, and can speak to every line.

The eight chat-tool routes in omi-shipbob-app read uid from the request
body and act on that user's connected ShipBob account via
get_shipbob_headers(uid), with no caller authentication. Anyone who knows
a uid could read another user's orders and customer data, cancel their
receiving orders, or create WROs under their account.

Add shipbob_tools_auth.py: a shared-secret guard (Authorization: Bearer or
shipbob_tools_token query param, checked against SHIPBOB_TOOLS_SECRET with
hmac.compare_digest), applied via Depends() to all eight routes. Fail-closed
503 when unconfigured, 401 on missing or wrong token. Mirrors the merged
mentor guard (plugins/basic/mentor_webhook_auth.py).

Register shipbob-tools-auth-tests in the checks manifest. New hermetic
regression test proves the guard behaviour and that all eight routes depend
on it (red before, green after).

Fixes BasedHardware#14666

Failure-Class: none
@onkar717

Copy link
Copy Markdown
Author

Thanks for reviewing. If this is accepted and merged, what is the typical timing for the bounty payout? Happy to adjust anything you need first.

@onkar717

Copy link
Copy Markdown
Author

Flagging that #14684 targets the same issue (#14666), so you have two PRs to choose between.

Both take the same approach (shipbob_tools_auth.py, hmac.compare_digest, Depends on the eight routes). The differences that may matter for review:

  • This PR is scoped to the plugin plus its guard and regression test, and registers that test in .github/checks-manifest.yaml per DoD item 8, so it runs in CI. It touches no unrelated files.
  • fix(shipbob): require shared secret on chat-tool routes #14684 adds ~290 lines across six files, rewriting test_main.py, test_create_wro, and the README, and does not register its new test in the manifest, so as written that test would not run in CI.

For context, this is the original fix and the issue is one I filed. Happy to expand test coverage or adjust anything you'd prefer either way.

@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.

Thanks for this — the underlying issue is real and the guard itself is well built. I verified each of the eight routes in plugins/omi-shipbob-app/main.py reads uid from the body and acts with that user's stored ShipBob OAuth token via get_shipbob_headers(uid), with no caller auth on main: /select-channel (:601), /tools/get_inventory (:625), /tools/get_products (:685), /tools/create_wro (:729), /tools/get_wros (:885), /tools/cancel_wro (:942), /tools/get_orders (:982), /tools/get_fulfillment_centers (:1044). The new shipbob_tools_auth.py guard is sound: hmac.compare_digest against SHIPBOB_TOOLS_SECRET, fail-closed 503 when unconfigured, 401 on missing/wrong token — structurally the same as the merged mentor guard (plugins/basic/mentor_webhook_auth.py, #13685). Your test_tools_auth.py passes 6/6 for me too (plugin-pinned fastapi 0.111.1).

Requesting changes for two verified test regressions, both fixable in a few lines:

  1. test_main.py: 66/66 on base → 62/66 on this head. The four failures are exactly the TestCancelWroRegression13183 cases, which drive /tools/cancel_wro through fastapi.testclient.TestClient with no secret — the guard now rejects them before the handler runs, so the #13183 regression coverage is gone. The open whoop guard #14454 kept its equivalent TestClient coverage alive via app.dependency_overrides; the same approach (or a set-secret fixture + auth header in those tests) restores it here.

  2. test_create_wro_disambiguation.py: its hermetic fastapi stub (module("fastapi", FastAPI=..., HTTPException=..., Request=..., Query=...)) has no Depends, which main.py:18 now imports, so the suite is import-broken under any execution ordering. #14454 added the attribute to its equivalent stub — a one-line fix here. (To be fair: that suite is already broken standalone on main for a separate stub gap and isn't manifest-run, but this PR shouldn't widen the hole.)

Related accuracy note on the PR body: "CI runs the full suite with its pinned deps" doesn't hold — the new manifest entry shipbob-tools-auth-tests runs only test_tools_auth.py for this plugin, so neither regression above is CI-visible. Also, the whoop guard (#14454) is still open rather than merged, and #14453/#14428/#14451 are bounty issues, not merged PRs — worth softening those references.

Two items I'm flagging for maintainer sign-off rather than asking you to change unilaterally:

  • /select-channel is called from the plugin's own browser page (templates/setup.html:404, fetch('/select-channel', {uid, channel_id})). A browser page can't hold SHIPBOB_TOOLS_SECRET, so the channel-switch flow will 401 even once the backend is wired. This route may need a different auth path than the backend-called /tools/* routes.
  • Nothing in the backend sends the secret today: backend/utils/retrieval/tools/app_tools.py:_call_tool_endpoint sends only Content-Type, and its auth_required branch is a pass placeholder. So all eight tools will 401/503 post-merge until caller wiring plus the env var deploy exist. #13685 shipped guard-first too, so this can be a conscious deploy sequence — but it should be an explicit one.

Small follow-up worth its own issue (not a reason to expand this PR): GET /disconnect?uid= (:597) and GET /setup/shipbob?uid= (:589) remain unauthenticated uid-keyed reads/writes in the same class.

The security fix direction and guard implementation are right — with the two test suites repaired and the /select-channel + caller-wiring questions answered, this should be in good shape. Human maintainer review is needed for the /select-channel browser-flow auth design and the backend wiring/deploy sequencing decision 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 19, 2026
Two test regressions from adding require_shipbob_tools_auth:

- test_main.py TestCancelWroRegression13183 drives /tools/cancel_wro through
  TestClient with no secret, so the guard returned 503 before the handler ran.
  Bypass the guard in those tests with app.dependency_overrides (the approach
  the whoop guard PR BasedHardware#14454 uses), restoring the BasedHardware#13183 coverage.

- test_create_wro_disambiguation.py hermetic fastapi stub lacked Depends, which
  main.py now imports. Add Depends to the stub so the import resolves. (This
  suite has separate pre-existing stub gaps on main, fastapi.exceptions and the
  models import, that are unrelated to this change and left as-is.)
@onkar717

Copy link
Copy Markdown
Author

Thanks for the detailed review. Addressed the two test regressions:

Corrected the PR body per your accuracy note: this follows the merged mentor guard plugins/basic/mentor_webhook_auth.py (#13685); whoop #14454 is the open sibling, not merged; and the manifest runs only test_tools_auth.py, not the full suite.

On /select-channel: you are right, it is called from setup.html:404 in the browser and cannot hold the shared secret. I would keep the shared-secret guard on the seven /tools/* routes and move /select-channel to a per-uid HMAC signature (whoop's disconnect_sig/verify_disconnect_sig shape). Happy to push that. Is that the direction you want?

On rollout: guard-first takes the tools to 503/401 until the backend _call_tool_endpoint sends SHIPBOB_TOOLS_SECRET and the env var is deployed, the same coordination whoop needs. How would you like to sequence it: guard-first with the backend change staged, or backend-first?

On the /disconnect and /setup/shipbob uid-keyed routes you flagged: agreed they are the same class. I will open a separate issue for those rather than expand this PR.

@onkar717

Copy link
Copy Markdown
Author

Superseded by #14684, which fixes the same shipbob uid-trust issue and is merged. Closing this. The ms365 equivalent is in #14686.

@onkar717 onkar717 closed this Sep 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hey @onkar717 👋

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:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

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!

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.

security: shipbob: eight routes trust body uid and act with the victim's ShipBob token

2 participants