Commit 15ec5f9
security: force Accept-Encoding identity to mitigate urllib3 decompression bomb (CTO-4807)
GHSA-mf9v-mfxr-j63j flags a decompression-bomb safeguard bypass in
urllib3 < 2.7.0's streaming API. urllib3 2.7.0 requires Python >= 3.10
but the CI matrix still includes Python 3.9, so we cannot bump the pin.
This patch installs a small monkey-patch on requests.adapters.HTTPAdapter
that sets `Accept-Encoding: identity` on every outbound HTTP request.
With no compressed responses ever arriving, urllib3's decompression code
path is never exercised at runtime and the bug cannot trigger.
- New module: EnigmaAutomation/security_mitigations.py
- Imported once from EnigmaAutomation/__init__.py so it loads in every
process (Django web, manage.py CLI, celery workers, pytest with
DJANGO_SETTINGS_MODULE set).
Note: SCA scanners detect by version, not behavior, so CTO-4807 will
still flag urllib3==2.6.3. Requesting a risk-acceptance from security
with this mitigation as justification, pending the Python upgrade that
unblocks urllib3 2.7.0.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent e4dc144 commit 15ec5f9
2 files changed
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
0 commit comments