Skip to content

fix(security): open redirect, stored XSS, and postMessage origin hardening - #96

Open
dinex-dev wants to merge 3 commits into
masterfrom
fix/security-issues
Open

fix(security): open redirect, stored XSS, and postMessage origin hardening#96
dinex-dev wants to merge 3 commits into
masterfrom
fix/security-issues

Conversation

@dinex-dev

@dinex-dev dinex-dev commented Jul 29, 2026

Copy link
Copy Markdown
Member

Summary

Fixes for several security findings from the AppSec review (umbrella: APPSEC-398). Three code changes, each self-contained.

Tickets addressed

  • RQ-2303 — Post-login open redirect (CWE-601). LoginHandler.redirect() opened any cross-origin URL via window.open; now cross-origin targets fall back to redirectToHome instead of being followed. Same-origin redirects (the normal "return to the page you were on" flow) are unaffected.
  • RQ-2304 — Stored XSS via rehype-raw in the API Client collection description (CWE-79). Removed rehypeRaw so ReactMarkdown falls back to its safe default (raw HTML escaped). Standard Markdown via remark-gfm is unaffected.
  • RQ-2310 — Same rehype-raw stored-XSS pattern in the app notification banner (BaseBanner), fixed in the same commit as RQ-2304.
  • RQ-2309 — Rule editor postMessage listener had no event.origin check (CWE-79). Now validates the sender origin against the app's own origin and the browser-extension schemes, preserving the DevTools "create rule from traffic" flow while blocking arbitrary web origins. The outbound wildcard target is documented as an accepted risk in-code (CREATE-mode default template only; tightening needs a coordinated extension change).

Testing

  • tsc --noEmit clean for all changed files (pre-existing unrelated type errors left untouched).
  • Pre-commit hooks (prettier + eslint) passed on each commit.

🤖 Generated with Claude Code

dinex-dev and others added 3 commits July 29, 2026 10:44
LoginHandler.redirect() opened any cross-origin URL via window.open,
allowing an attacker-supplied redirectURL/redirectURI to send an
authenticated user to an external phishing page after login.

Route non-same-origin targets to redirectToHome instead of opening
them. Same-origin redirects are unaffected and still preserve the
user's original request path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ReactMarkdown was configured with rehypeRaw, which re-parses raw HTML
in Markdown source into live DOM nodes. In the API Client collection
description (user-editable, persisted to Firebase, shown to teammates)
this allowed stored XSS via payloads like <img src=x onerror=...>.

Drop rehypeRaw from CollectionOverview and BaseBanner so ReactMarkdown
falls back to its safe default (raw HTML escaped). Standard Markdown via
remark-gfm is unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…WE-79)

The rule editor's message listener accepted any message whose body
contained author:"requestly"/action:"ruleEditor:loadData" with no
event.origin check, so any web page could open the editor in a popup
and inject attacker-supplied ruleData (e.g. a malicious Script rule).

Reject messages unless event.origin is the app's own origin or a
Requestly extension origin (chrome/moz/safari-web-extension scheme).
This preserves the intended DevTools "create rule from traffic" flow
(a chrome-extension:// sender) while blocking arbitrary web origins.

The outbound ready-event postMessage still uses "*", but only leaks a
blank default rule template in CREATE mode; tightening its target
origin needs a coordinated extension change and is left as follow-up.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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