Skip to content

fix(plugins): require auth on zapier data-plane routes keyed only by uid - #14429

Open
hridaya423 wants to merge 1 commit into
BasedHardware:mainfrom
hridaya423:fix/zapier-webhook-auth
Open

hridaya423 wants to merge 1 commit into
BasedHardware:mainfrom
hridaya423:fix/zapier-webhook-auth

Conversation

@hridaya423

@hridaya423 hridaya423 commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #14428

Summary

Six routes in plugins/zapier/conversation_created.py trusted the client-supplied uid with no credential:

Route Unauthenticated effect
GET /zapier/trigger/memory/sample Returns the uid's latest conversation incl. full transcript
POST /zapier/action/memories Writes an arbitrary conversation into the uid's Omi account
POST/DELETE /zapier/trigger/subscribe Stores/removes an attacker target_url under the uid
POST /zapier/memories Webhook accepted with no caller binding
GET /zapier/me Anonymous integration-status probe

Same contract violation as the merged mentor session fix (#13665), wider blast radius.

Fix

plugins/zapier/webhook_auth.py adds require_zapier_webhook_auth, mirroring plugins/basic/mentor_webhook_auth.py: ZAPIER_WEBHOOK_SECRET env secret, Authorization: Bearer or zapier_webhook_token query param, hmac.compare_digest, fail-closed 503 when unconfigured, 401 on missing/mismatched token. Wired via Depends onto all six routes.

Residual + deployment note

Tests

python3 plugins/zapier/test_webhook_auth.py: 10 tests, fail-closed unconfigured (503 incl. blank secret), missing/wrong/non-bearer token (401), bearer + query token accepted, uid trimmed; plus a labeled static wiring check that all six routes declare the dependency.

python3 plugins/zapier/test_zapier_hardening.py: 18/18 pass (stub extended with Depends/Query; existing positional-uid calls unchanged).

Failure-Class: new — client-supplied uid accepted as authorization on unauthenticated plugin routes

/zapier/trigger/memory/sample returned the caller-chosen uid's latest
conversation including the full transcript; /zapier/action/memories
wrote an arbitrary conversation into any uid's account; the trigger
subscribe/unsubscribe pair stored an attacker-controlled target_url
against any uid; /zapier/memories accepted webhooks with no caller
binding; /zapier/me answered status probes. All six trusted the
client-supplied uid with no credential.

Add require_zapier_webhook_auth (same fail-closed pattern as the
merged mentor session fix, BasedHardware#13685): Authorization bearer or
zapier_webhook_token query param checked against ZAPIER_WEBHOOK_SECRET
with hmac.compare_digest; 503 when unconfigured, 401 on missing or
mismatched token.

Residual, tracked in BasedHardware#14428: the browser control-plane endpoints
(/setup-zapier, /zapier/connect, /zapier/disconnect, /setup/zapier)
remain uid-keyed because the Omi app opens them without a credential;
with the data plane closed, toggling enabled state grants no data
access. Binding them needs a capability token issued by the Omi
backend link (the direction of BasedHardware#13463).

Deployment note: ZAPIER_WEBHOOK_SECRET must be set and the Zapier app
/ Omi webhook callers configured to send it, matching the mentor
precedent.

Verification: python3 test_webhook_auth.py (10 tests incl. boundary
cases) and python3 test_zapier_hardening.py (18 tests) all pass.

Failure-Class: new — client-supplied uid accepted as authorization on unauthenticated plugin routes
@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks @hridaya423 — this closes a real hole (#14428): six zapier data-plane routes were keyed only by a client-supplied uid, exposing transcript reads, cross-account writes, and webhook exfiltration subscriptions. Reviewed statically; the approach matches the merged mentor fix and looks correct.

  • plugins/zapier/webhook_auth.py — faithful port of require_mentor_webhook_auth: fail-closed 503 when ZAPIER_WEBHOOK_SECRET is unset or blank (.strip() guard), 401 via hmac.compare_digest, bearer header or zapier_webhook_token query param, uid trimmed with 422 on blank. No secret material leaks into error details.
  • plugins/zapier/conversation_created.py — all six data-plane routes (POST/DELETE /zapier/trigger/subscribe, GET /zapier/trigger/memory/sample, GET /zapier/me, POST /zapier/memories, POST /zapier/action/memories) now resolve uid through Depends(require_zapier_webhook_auth). Leaving /setup-zapier, /zapier/connect, /zapier/disconnect, /setup/zapier uid-keyed is consistent with the mentor precedent (/setup/mentor also stayed open) and correctly documented as residual risk.
  • plugins/zapier/test_webhook_auth.py — solid hermetic coverage of the trust boundary (503 unconfigured/blank, 401 missing/wrong/non-bearer, bearer + query accepted, uid trim), and the docstring is upfront that the route check is a static wiring check rather than an executed dependency. A TestClient pass would make the wiring proof stronger as a follow-up, but this matches the bar set by the mentor fix.
  • plugins/zapier/test_zapier_hardening.py — stub gains Depends/Query so the existing hardening tests keep importing cleanly; the +8 is exactly that.

One thing needs maintainer coordination before deploy (not a code change): the shipped Zapier app (plugins/zapier/omi-zap/authentication.js, triggers/on_memory_created.js, creates/create_memory.js) still authenticates with only the uid (X-UID header / uid in query) and calls /zapier/me, /zapier/trigger/subscribe, /zapier/action/memories. Once ZAPIER_WEBHOOK_SECRET is set, the published integration will 401 until it's updated to send the token — the secret rollout and the Zapier app update need to ship together. The shared-secret (vs per-user capability token, #13463 direction) trade-off is fine as a stopgap and consistent with the mentor fix.

Leaving formal sign-off to a human maintainer: this is an auth-boundary change on user transcript data, and the rollout sequencing above is a deployment decision. Code-wise this is in good shape.


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 positive-signal Automation verified a genuine fix/quality contribution backend Backend Task (python) labels Sep 18, 2026
@hridaya423

Copy link
Copy Markdown
Contributor Author

Good catch on the rollout sequencing — you're right that omi-zap still sends only the uid and would 401 once ZAPIER_WEBHOOK_SECRET is set. The cleanest companion change: add a token auth field in the Zapier app's authentication.js that gets sent as Authorization: Bearer (provisioned alongside the uid at connect time). Happy to open that PR against plugins/zapier/omi-zap/ whenever you want it — it has to ship with the env rollout either way.

@hridaya423

Copy link
Copy Markdown
Contributor Author

Companion PR for the client side: #14471 — adds an optional Integration Token auth field sent as Authorization: Bearer on all omi-zap calls, so the rollout can publish the app update before setting ZAPIER_WEBHOOK_SECRET.

@aryanorastar

Copy link
Copy Markdown
Collaborator

Verified on 1a500341a746.

Leaving this open as the remaining-hole vehicle on plugins/zapier/conversation_created.py, plugins/zapier/test_webhook_auth.py, plugins/zapier/test_zapier_hardening.py, plugins/zapier/webhook_auth.py. remaining hole: zapier uid-only data-plane auth keep; 0-checks.

Not approving from here: hosted checks are not green (0-check / UNSTABLE / FTC). kodjima APPROVE is not a merge. I am not merging.

@aryanorastar

Copy link
Copy Markdown
Collaborator

Keeping this open. Not approving 1a500341a746. origin/main:plugins/zapier/conversation_created.py subscribe_zapier_trigger(..., uid: str) has no auth dependency. Tests are static wiring. Only cubic skipping (0 CI).

— Astar, on behalf of @aryanorastar

Git-on-my-level pushed a commit that referenced this pull request Sep 27, 2026
…nts (#14471)

* fix(zapier/omi-zap): send bearer token alongside uid for gated endpoints

Companion to the server-side uid-as-auth fix (#14429): once
ZAPIER_WEBHOOK_SECRET is set, /zapier/* data-plane routes require a
shared-secret bearer token, and the published Zapier app would 401 on
every call. Adds an optional "Integration Token" auth field whose value
is sent as Authorization: Bearer on the auth test and, via
requestTemplate, on every trigger/create request. Left optional so
existing installs keep working until the secret rollout lands.

Refs #14429

* fix(zapier/omi-zap): soften token helpText until token display lands
@Git-on-my-level Git-on-my-level mentioned this pull request Oct 4, 2026

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

backend Backend Task (python) positive-signal Automation verified a genuine fix/quality contribution security-review Touches auth, provider routing, secrets, or security-sensitive surfaces

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bounty] security: zapier routes trust client-supplied uid — unauthenticated transcript read, account write, and exfiltration subscription

3 participants