Skip to content

Conversation

@hkjersem
Copy link
Contributor

@hkjersem hkjersem commented Nov 3, 2025

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.


// 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

This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '=' and with many repetitions of '='.
This
regular expression
that depends on
a user-provided value
may run slow on strings with many repetitions of 'a'.
This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '<' and with many repetitions of '%2f'.
This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '<img' and with many repetitions of '<img'.
This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '<' and with many repetitions of '<'.
This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '.' and with many repetitions of '.'.
This
regular expression
that depends on
a user-provided value
may run slow on strings starting with 'union' and with many repetitions of 'union'.

// 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

This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '=' and with many repetitions of '='.
This
regular expression
that depends on
a user-provided value
may run slow on strings with many repetitions of 'a'.
This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '<' and with many repetitions of '%2f'.
This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '<img' and with many repetitions of '<img'.
This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '<' and with many repetitions of '<'.
This
regular expression
that depends on
a user-provided value
may run slow on strings starting with '.' and with many repetitions of '.'.
This
regular expression
that depends on
a user-provided value
may run slow on strings starting with 'union' and with many repetitions of 'union'.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 3, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
4 Security Hotspots
E Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

// 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

Change this code to not perform redirects based on user-controlled data. See more on SonarQube Cloud
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.

2 participants