Skip to content

Generate regular expressions for locations during alias_traversal checks#46

Closed
MegaManSec wants to merge 1 commit intodvershinin:masterfrom
MegaManSec:alias_regex
Closed

Generate regular expressions for locations during alias_traversal checks#46
MegaManSec wants to merge 1 commit intodvershinin:masterfrom
MegaManSec:alias_regex

Conversation

@MegaManSec
Copy link

@MegaManSec MegaManSec commented May 7, 2025

This patch allows us to catch any incorrect alias usage inside location blocks with regex.

It also changes a probably-not-vulnerable report to LOW severity.

@MegaManSec
Copy link
Author

MegaManSec commented May 7, 2025

Notes:

Not vulnerable:

location ~ /images/(.*) {
  alias /app/static/$1;
}

Not vulnerable:

location ~ /image(s) {
  alias /app/static/;

Note vulnerable:

location ~ /image {
  alias /app/static/;

Vulnerable:

location ~ /images(.*) {
  alias /app/static/$1;
}

Vulnerable:

location ~ /images(.*)/lol {
  alias /app/static/$1;
}

@sonarqubecloud
Copy link

sonarqubecloud bot commented May 8, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability 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

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