Security: Silent Exception Swallowing in Server Request Handler Factory#12332
Conversation
The `Server.__call__` method catches `TypeError` broadly and silently retries handler creation with filtered kwargs. This could mask legitimate configuration errors or security-relevant misconfigurations, making debugging difficult and potentially allowing the server to start with an insecure or unexpected configuration. Affected files: web_server.py Signed-off-by: Trần Bách <45133811+barttran2k@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #12332 +/- ##
==========================================
- Coverage 99.11% 98.92% -0.20%
==========================================
Files 130 133 +3
Lines 45609 46565 +956
Branches 2405 2424 +19
==========================================
+ Hits 45207 46063 +856
- Misses 272 373 +101
+ Partials 130 129 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Merging this PR will not alter performance
Comparing Footnotes
|
Backport to 3.14: 💚 backport PR created✅ Backport PR branch: Backported as #12370 🤖 @patchback |
…wing in Server Request Handler Factory (#12370) **This is a backport of PR #12332 as merged into master (06e510b).** Signed-off-by: Trần Bách <45133811+barttran2k@users.noreply.github.com> Co-authored-by: Trần Bách <45133811+barttran2k@users.noreply.github.com> Co-authored-by: Sam Bull <git@sambull.org>
Problem
The
Server.__call__method catchesTypeErrorbroadly and silently retries handler creation with filtered kwargs. This could mask legitimate configuration errors or security-relevant misconfigurations, making debugging difficult and potentially allowing the server to start with an insecure or unexpected configuration.Severity:
lowFile:
aiohttp/web_server.pySolution
Log a warning when falling back to the failsafe creation path so that misconfiguration is visible to operators. Consider narrowing the exception handling or deprecating this failsafe behavior.
Changes
aiohttp/web_server.py(modified)Testing