Skip to content

Fix for CWE-601: URL Redirection to Untrusted Site ('Open Redirect') - #59

Open
asadeddin wants to merge 1 commit into
masterfrom
corgea_fix_fe33184a
Open

asadeddin wants to merge 1 commit into
masterfrom
corgea_fix_fe33184a

Conversation

@asadeddin

Copy link
Copy Markdown

🐕 Corgea issued a PR to fix a vulnerability found in data/static/codefixes/redirectCryptoCurrencyChallenge_3_correct.ts.

It is CWE-601: URL Redirection to Untrusted Site ('Open Redirect') that has a severity of 🔴 High.

🪄 Fix explanation

The fix changes the URL comparison from using "includes" to "===", ensuring only exact matches from the allowlist are redirected, preventing open redirect vulnerabilities.
- The original code used "url.includes(allowedUrl)", which allowed partial matches, enabling potential redirects to malicious sites.
- The fix replaces "includes" with "===", ensuring only exact URL matches from the "redirectAllowlist" are permitted.
- This change prevents attackers from exploiting partial URL matches to redirect users to untrusted sites.
- The "redirectAllowlist" now strictly controls which URLs are considered safe for redirection.

💡 Important Instructions

Ensure the redirectAllowlist contains all necessary URLs for legitimate redirects, as only exact matches will be allowed.

See the issue and fix in Corgea.

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