Skip to content

fix(security): validate postMessage origins and fix slack middleware path#11094

Open
Mitch Goudy (mgoudy91) wants to merge 1 commit into
masterfrom
fix/security-postmessage-origin-and-slack-middleware
Open

fix(security): validate postMessage origins and fix slack middleware path#11094
Mitch Goudy (mgoudy91) wants to merge 1 commit into
masterfrom
fix/security-postmessage-origin-and-slack-middleware

Conversation

@mgoudy91

Copy link
Copy Markdown
Contributor

Summary

Slack lambda — missing leading slash (APPS-1)

  • `apps/slack/lambda/lib/app.ts`: `'api/tokens'` → `'/api/tokens'` in middleware mount. The missing slash meant `path-to-regexp@0.1.x` never matched, silently bypassing request verification on `POST /api/tokens`.

Wildcard postMessage — senders (APPS-2)
All four sender files replaced `'*'` with `document.referrer ? new URL(document.referrer).origin : window.location.origin`:

  • `apps/typeform/frontend/src/processTokenCallback.ts`
  • `apps/slack/frontend/src/index.tsx`
  • `apps/smartling/frontend/src/standalone.ts`
  • `apps/jira/jira-app/src/standalone.ts`

Wildcard postMessage — receivers (APPS-2)
Added `event.origin` checks to all receivers:

  • Typeform: `origin !== window.location.origin`
  • Slack: `message.origin !== new URL(BACKEND_BASE_URL).origin`
  • Smartling: `origin !== window.location.origin`
  • Jira: `e.origin !== new URL(constants.OAUTH_REDIRECT_URI).origin`

Test plan

  • Slack OAuth connect flow works end-to-end
  • `POST /api/tokens` now has request verification applied
  • Typeform, Smartling, Jira OAuth flows still deliver tokens correctly
  • `postMessage` from a foreign origin is ignored by each receiver

🤖 Generated with Claude Code

…path

Senders (typeform, slack, smartling, jira standalone): replaced wildcard
'*' with document.referrer-based origin so tokens are only sent to the
known opener page.

Receivers (typeform, slack, smartling, jira): added event.origin checks
so fake postMessage injections from other pages are rejected.

Slack lambda: changed 'api/tokens' to '/api/tokens' in the middleware
mount array — the missing leading slash meant path-to-regexp@0.1.x never
matched the route, silently bypassing request verification on POST /api/tokens.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mgoudy91
Mitch Goudy (mgoudy91) requested review from a team as code owners July 17, 2026 16:14
@wiz-inc-38d59fb8d7

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings 10 Low
Software Management Finding Software Management Findings -
Total 10 Low

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

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.

1 participant