backport PR 3016 from v5 to v4#3019
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v4 #3019 +/- ##
==========================================
- Coverage 93.55% 93.53% -0.02%
==========================================
Files 43 42 -1
Lines 4312 4299 -13
==========================================
- Hits 4034 4021 -13
Misses 159 159
Partials 119 119 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
backport PR #3016 from v5 for GHSA-vfp3-v2gw-7wfq
Make serving static file releated methods and middleware not unescape path by default - so how the way Router interprets paths and Static methods/middleware is consistent.
Given following situation:
Then requests to
/admin%2fprivate.txtwould not be matched toGET /admin/*route (routing does not look unescaped path) and static file serving will use unescaped path to serve the file.Note: this way of "guarding" subfolders will never work for for paths like
/assets/../admin%2fprivate.txtwhich willpath.Clean("/assets/../admin%2fprivate.txt")to/admin/private.txtand are servable if static file serving is configured to unescape paths.If you want to guard routes - use middlewares on
Static*methods and beforeStaticmiddleware.Breaking change / migration: If you serve files whose names contain URL-encoded characters (e.g.,
/hello%20world.txt→hello world.txt), you must now opt in:for static middleware