-
Notifications
You must be signed in to change notification settings - Fork 1
Forhindre injection attacks #2558
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
base: main
Are you sure you want to change the base?
Conversation
|
|
||
| // Check for malicious patterns in the path | ||
| for (const pattern of MALICIOUS_PATTERNS) { | ||
| if (pattern.test(fullPath) || pattern.test(decodedPath)) { |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data High
regular expression
a user-provided value
This
regular expression
a user-provided value
This
regular expression
a user-provided value
This
regular expression
a user-provided value
This
regular expression
a user-provided value
This
regular expression
a user-provided value
This
regular expression
a user-provided value
|
|
||
| // Check for malicious patterns in the path | ||
| for (const pattern of MALICIOUS_PATTERNS) { | ||
| if (pattern.test(fullPath) || pattern.test(decodedPath)) { |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data High
regular expression
a user-provided value
This
regular expression
a user-provided value
This
regular expression
a user-provided value
This
regular expression
a user-provided value
This
regular expression
a user-provided value
This
regular expression
a user-provided value
This
regular expression
a user-provided value
|
| // Security validation already ran in middleware above | ||
| // Now redirect to XP origin | ||
| const xpUrl = `${process.env.XP_ORIGIN}${req.path}`; | ||
| return res.redirect(307, xpUrl); // 307 = Temporary Redirect, preserves method |
Check failure
Code scanning / SonarCloud
HTTP request redirections should not be open to forging attacks High




Kode for det meste skrevet av copilot. Er mye dokumentasjon osv som er overflødig, men path-valideringen virker solid. Er også lagt til en rate limit, noe som vi kan vurdere.
Har også flyttet redirecten til XP backend, så middleware kjører før vi redirecter.