Skip to content

Fix open redirect vulnerability in action-details via URL allowlist validation#3397

Merged
olgahaha merged 6 commits intomainfrom
copilot/fix-open-redirect-vulnerability
Apr 16, 2026
Merged

Fix open redirect vulnerability in action-details via URL allowlist validation#3397
olgahaha merged 6 commits intomainfrom
copilot/fix-open-redirect-vulnerability

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

redirectToExternalUrl() passed action.ext_action_destination_text directly to Browser.open() without validation, enabling open redirect attacks via a compromised or MITM'd backend response — with CID and order_id leaked to the malicious target.

Changes

  • Allowlist validation — added ALLOWED_DOMAINS (captureapp.xyz, numbersprotocol.io) and isValidRedirectUrl() that enforces HTTPS and strict hostname matching:

    private readonly ALLOWED_DOMAINS = ['captureapp.xyz', 'numbersprotocol.io'];
    
    private isValidRedirectUrl(url: string): boolean {
      try {
        const parsed = new URL(url);
        if (parsed.protocol !== 'https:') return false;
        return this.ALLOWED_DOMAINS.some(
          d => parsed.hostname === d || parsed.hostname.endsWith(`.${d}`)
        );
      } catch {
        return false;
      }
    }

    Uses hostname === d || hostname.endsWith('.' + d) to allow legitimate subdomains while blocking spoofs like evil-captureapp.xyz or captureapp.xyz.evil.com.

  • Error handlingredirectToExternalUrl() now returns early with an error toast on invalid URLs; i18n keys added to en-us.json and zh-tw.json

  • Tests — added cases covering: valid apex/subdomain, HTTP rejection, non-allowlisted domain, subdomain confusion attack, lookalike domain, and malformed URL

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • download.cypress.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node index.js --exec install conf�� --global credential.helper cal/bin/git HooksPath (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

…list validation

Agent-Logs-Url: https://github.com/numbersprotocol/capture-cam/sessions/d25025b1-af37-4689-84c5-a319e266346e

Co-authored-by: numbers-official <181934381+numbers-official@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix open redirect vulnerability in action details page Fix open redirect vulnerability in action-details via URL allowlist validation Apr 2, 2026
Copilot AI requested a review from numbers-official April 2, 2026 21:54
Omni and others added 4 commits April 16, 2026 06:51
The redirectToExternalUrl method subscribes to id$ observable internally.
Positive tests need fakeAsync+tick to flush the observable before asserting
Browser.open was called. Also fixes Prettier formatting.
@olgahaha olgahaha marked this pull request as ready for review April 16, 2026 07:56
@olgahaha olgahaha merged commit f732665 into main Apr 16, 2026
9 checks passed
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.

[Security][High] Open redirect vulnerability via unvalidated external URL in action details

3 participants