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

Stricter charset handling and escaping of request URLs #2710

Merged
merged 12 commits into from
Mar 21, 2023
Merged

Conversation

Tronic
Copy link
Member

@Tronic Tronic commented Mar 9, 2023

  • HTTP1 and HTTP3 built-in servers now enforce ASCII (%-quotes should be used for UTF-8).
  • ASGI uses raw_path to avoid quote/encode cycle and unquoting of %2F into / early on.
  • ASGI no longer prepends root_path to path used in Sanic.
  • Using backslash escapes in logging and BadURL messages to print invalid characters.

@Tronic Tronic requested a review from a team as a code owner March 9, 2023 19:08
@Tronic
Copy link
Member Author

Tronic commented Mar 9, 2023

Note: earlier discussion in #1837 (comment)

@ahopkins
Copy link
Member

Can we add some tests to catch regressions?

@Tronic Tronic requested a review from a team as a code owner March 21, 2023 13:21
@codecov
Copy link

codecov bot commented Mar 21, 2023

Codecov Report

Patch coverage: 84.615% and project coverage change: -0.078 ⚠️

Comparison is base (1a63b9b) 88.912% compared to head (ef769d3) 88.835%.

❗ Current head ef769d3 differs from pull request most recent head 1520bf0. Consider uploading reports for the commit 1520bf0 to get more accurate results

Additional details and impacted files
@@              Coverage Diff              @@
##              main     #2710       +/-   ##
=============================================
- Coverage   88.912%   88.835%   -0.078%     
=============================================
  Files           92        92               
  Lines         7017      7022        +5     
  Branches      1196      1197        +1     
=============================================
- Hits          6239      6238        -1     
- Misses         533       537        +4     
- Partials       245       247        +2     
Impacted Files Coverage Δ
sanic/http/http3.py 79.891% <66.666%> (-0.665%) ⬇️
sanic/asgi.py 91.666% <100.000%> (-0.063%) ⬇️
sanic/http/http1.py 84.353% <100.000%> (+0.107%) ⬆️
sanic/request/types.py 94.236% <100.000%> (+0.016%) ⬆️

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ahopkins ahopkins merged commit 932088e into main Mar 21, 2023
@ahopkins ahopkins deleted the url-charset branch March 21, 2023 17:55
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