Skip to content

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

Open
asadeddin wants to merge 1 commit into
masterfrom
corgea_fix_9076ba6a
Open

Fix for CWE-601: URL Redirection to Untrusted Site ('Open Redirect')#58
asadeddin wants to merge 1 commit into
masterfrom
corgea_fix_9076ba6a

Conversation

@asadeddin

Copy link
Copy Markdown

🐕 Corgea issued a PR to fix a vulnerability found in data/static/codefixes/redirectCryptoCurrencyChallenge_1.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 permitted, preventing open redirects to untrusted sites.
- 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 allowed.
- This change prevents attackers from exploiting partial matches to redirect users to untrusted sites.
- The function "isRedirectAllowed" now returns "true" only if the entire URL matches an entry in the allowlist.

💡 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