-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: use menlo security for gsib #1937
Conversation
// NOTE: Prepend the menlo link if this is on GSIB because | ||
// GSIBs do a security scan that will fail otherwise with a TOO_MANY_REDIRECTS | ||
// error when we access the raw link directly. | ||
if (window.name.includes(GSIB_INDICATOR)) { |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization High
menlo-view.menlosecurity.com
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 2 months ago
To fix the problem, we need to ensure that the check for GSIB_INDICATOR
is done in a more secure manner. Instead of using a substring check, we should parse the URL and verify the host against a whitelist of allowed hosts. This will prevent any arbitrary hosts from being accepted.
- Parse the
window.name
to extract the host. - Check if the host is exactly
menlo-view.menlosecurity.com
or any other allowed subdomains. - Update the code to use this more secure check.
-
Copy modified lines R7-R9
@@ -6,3 +6,5 @@ | ||
// error when we access the raw link directly. | ||
if (window.name.includes(GSIB_INDICATOR)) { | ||
const url = new URL(window.name); | ||
const allowedHosts = ['menlo-view.menlosecurity.com']; | ||
if (allowedHosts.includes(url.host)) { | ||
return `https://safe.menlosecurity.com/${link}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
6d3525e
to
4d0e1d0
Compare
problem
solution
menlosecurity
and prepend if gsib is detected