Skip to content

Improve origin/referer checks#45

Merged
dvershinin merged 3 commits intodvershinin:masterfrom
MegaManSec:originchecks3
Oct 3, 2025
Merged

Improve origin/referer checks#45
dvershinin merged 3 commits intodvershinin:masterfrom
MegaManSec:originchecks3

Conversation

@MegaManSec
Copy link

@MegaManSec MegaManSec commented May 4, 2025

  • Separate checks between invalid origin/referer, and insecure.
  • Use PSL to check for too-permissive, cross-domain regex patterns.
  • Fix some tests, fix the example in the docstring.
  • Add check for hostnames being lowercase (conforms to real-world browser situations).
  • Report theoretical but impossible for modern browsers as invalid not insecure.
  • Add some more tests
  • Alerts on invalid $http_referrer usage.

Fixes #41.

@MegaManSec MegaManSec changed the title Originchecks3 Improve origin/referer checks May 4, 2025
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
2 Security Hotspots

See analysis details on SonarQube Cloud

@MegaManSec
Copy link
Author

Note: doesn't pick up the configuration:

map $http_origin $allow_origin {
    ~^https://(.*\.)?example.com$ $http_origin;
    default "";
}
add_header Access-Control-Allow-Origin $allow_origin always;

We can do that once #58 lands.

…gin FPs; support map-based CORS allowlist; fix docs; harden drop-in parser
@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 3, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
2 Security Hotspots

See analysis details on SonarQube Cloud

@dvershinin dvershinin merged commit 5abf366 into dvershinin:master Oct 3, 2025
10 of 11 checks passed
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.

false positives in http_origin

2 participants