Skip to content
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

Validate redirection location and restrict status codes #310

Merged
merged 6 commits into from
Jun 24, 2024

Conversation

Anilm3
Copy link
Collaborator

@Anilm3 Anilm3 commented Jun 17, 2024

Extra validations for redirect actions:

  • Valid status codes are now 301, 302, 303 or 307
  • The location must now:
    • Be a valid URL
    • If it contains a scheme, it must be either http or https
    • if it doesn't, it must be an absolute-path reference starting with /

The URI parser has been updated to support:

  • Fragments and query on URLs without authority
  • Network-path references
  • Absolute-path references
  • Relative-path references are not yet supported

Related Jira: APPSEC-53568

@codecov-commenter
Copy link

codecov-commenter commented Jun 17, 2024

Codecov Report

Attention: Patch coverage is 84.21053% with 3 lines in your changes missing coverage. Please review.

Project coverage is 83.61%. Comparing base (15a3588) to head (b399d9e).

Files Patch % Lines
src/parser/actions_parser.cpp 75.00% 0 Missing and 2 partials ⚠️
src/uri_utils.cpp 90.90% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #310   +/-   ##
=======================================
  Coverage   83.61%   83.61%           
=======================================
  Files         137      137           
  Lines        6047     6054    +7     
  Branches     2854     2859    +5     
=======================================
+ Hits         5056     5062    +6     
+ Misses        370      369    -1     
- Partials      621      623    +2     
Flag Coverage Δ
waf_test 83.61% <84.21%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pr-commenter
Copy link

pr-commenter bot commented Jun 17, 2024

Benchmarks

Benchmark execution time: 2024-06-22 00:22:04

Comparing candidate commit 589548c in PR branch anilm3/redirection-validations with baseline commit 2fbc676 in branch master.

Found 5 performance improvements and 1 performance regressions! Performance is the same for 13 metrics, 0 unstable metrics.

scenario:bool_equals_matcher.random

  • 🟩 execution_time [-41.384µs; -38.959µs] or [-3.389%; -3.191%]

scenario:float_equals_matcher.random

  • 🟩 execution_time [-45.527µs; -44.555µs] or [-3.724%; -3.645%]

scenario:phrase_match_matcher.enforce_word_boundary.random

  • 🟥 execution_time [+434.425µs; +437.488µs] or [+6.065%; +6.108%]

scenario:phrase_match_matcher.random

  • 🟩 execution_time [-709.187µs; -705.256µs] or [-9.126%; -9.076%]

scenario:signed_equals_matcher.random

  • 🟩 execution_time [-41.880µs; -40.956µs] or [-3.430%; -3.354%]

scenario:unsigned_equals_matcher.random

  • 🟩 execution_time [-44.272µs; -43.257µs] or [-3.621%; -3.538%]

@Anilm3 Anilm3 marked this pull request as ready for review June 17, 2024 20:58
@Anilm3 Anilm3 requested a review from a team as a code owner June 17, 2024 20:58
@Anilm3 Anilm3 merged commit 445c1a8 into master Jun 24, 2024
43 of 44 checks passed
@Anilm3 Anilm3 deleted the anilm3/redirection-validations branch June 24, 2024 16:15
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.

4 participants