Advisory

GHSA-jm3v-qxmh-hxwv

Also known as: None

Summary

Scrapy's redirects ignoring scheme-specific proxy settings

Details

Impact

When using system proxy settings, which are scheme-specific (i.e. specific to http:// or https:// URLs), Scrapy was not accounting for scheme changes during redirects.

For example, an HTTP request would use the proxy configured for HTTP and, when redirected to an HTTPS URL, the new HTTPS request would still use the proxy configured for HTTP instead of switching to the proxy configured for HTTPS. Same the other way around.

If you have different proxy configurations for HTTP and HTTPS in your system for security reasons (e.g., maybe you don’t want one of your proxy providers to be aware of the URLs that you visit with the other one), this would be a security issue.

Patches

Upgrade to Scrapy 2.11.2.

Workarounds

Replace the built-in retry middlewares (RedirectMiddleware and MetaRefreshMiddleware) and the HttpProxyMiddleware middleware with custom ones that implement the fix from Scrapy 2.11.2, and verify that they work as intended.

References

This security issue was reported by @redapple at https://github.com/scrapy/scrapy/issues/767.

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2024-05-14 20:14 UTC
Modified
2024-11-28 05:39 UTC

Affected packages and fixes

scrapy

PyPI · All systems

Affected

  • introduced 0, fixed 2.11.2 (ecosystem)

Fixed versions

2.11.2

Fix

  • Fixed version 2.11.2
    pip install --upgrade scrapy==2.11.2

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences