PyPI / requests / 2.34.2

requests 2.34.2

Source
https://github.com/psf/requests
Tag scanned
v2.34.2
Compared with
v2.34.1 (0 signals introduced since)
Files
61 scanned, 43 skipped (binary, oversized, or unrecognised)
Signals
0 critical · 0 warn · 10 info
Scan time
6.2 s
LLM review
Reviewed by claude-haiku-5-5 (Anthropic): 10 of 10 warn and critical signals; 10 demoted to info.
Disclude version
4.1.0
Scanned (UTC)
2026-10-21 20:16

Signals

Ordered by severity, then signals introduced in this release. Hidden characters are shown as ⟨U+…⟩.

  1. info warn → info by review dynamic-attribute src/requests/packages.py:9:5

    reach-by-name through `locals` (ast pass, confidence 0.60)

    for package in ("urllib3", "idna"):
        locals()[package] = __import__(package)
        # This traversal is apparently necessary such that the identities are
        # preserved (requests.packages.urllib3.* is urllib3.*)
    likely benign LLM, confidence 0.93 Compatibility shim assigning urllib3 and idna modules into locals() under requests.packages.
    Reasoning

    This is the well-known requests compatibility shim that aliases urllib3 and idna into the requests.packages namespace by name. The locals() write is a legitimate, long-standing idiom here, with a comment explaining its purpose; the package names are a fixed literal tuple.

  2. info critical → info by review dynamic-import src/requests/packages.py:9:25

    `__import__` called on a non-literal expression (ast pass, confidence 0.70)

    for package in ("urllib3", "idna"):
        locals()[package] = __import__(package)
        # This traversal is apparently necessary such that the identities are
        # preserved (requests.packages.urllib3.* is urllib3.*)
    likely benign LLM, confidence 0.85 Dynamic __import__ of the fixed names urllib3 and idna in a compatibility shim.
    Reasoning

    __import__ is applied to the loop variable, but it iterates over a fixed literal tuple of two known dependency names, so it is not attacker-controlled input. It matches the legitimate compatibility shim in this file; the critical severity overstates the risk given the constant input.

  3. info warn → info by review dynamic-execution tests/test_requests.py:1081:14

    `open(__file__)` — file reads its own source, common pattern for extracting payloads hidden in comments (ast pass, confidence 0.85)

        def test_different_encodings_dont_break_post(self, httpbin):
            with open(__file__, "rb") as f:
                r = requests.post(
                    httpbin("post"),
    likely benign LLM, confidence 0.95 Test opens its own source file to use as an upload fixture.
    Reasoning

    Test code opening its own __file__ to upload its source as a multipart file is a normal way to get a binary file for testing uploads. The message's claim about extracting hidden payloads does not fit this test context.

  4. info warn → info by review dynamic-execution tests/test_requests.py:1100:14

    `open(__file__)` — file reads its own source, common pattern for extracting payloads hidden in comments (ast pass, confidence 0.85)

        def test_unicode_multipart_post(self, httpbin, data):
            with open(__file__, "rb") as f:
                r = requests.post(
                    httpbin("post"),
    likely benign LLM, confidence 0.95 Test reads its own source as a multipart upload body.
    Reasoning

    Same pattern: a unicode multipart POST test reads the test module's own source as file content. No execution or payload extraction occurs.

  5. info warn → info by review dynamic-execution tests/test_requests.py:1123:14

    `open(__file__)` — file reads its own source, common pattern for extracting payloads hidden in comments (ast pass, confidence 0.85)

        def test_unicode_method_name(self, httpbin):
            with open(__file__, "rb") as f:
                files = {"file": f}
                r = requests.request(
    likely benign LLM, confidence 0.95 Test attaches its own source file in a request with a unicode method name.
    Reasoning

    A test for unicode method names attaches the module's own file as an upload. Reading __file__ here is a fixture, not a dropper or hidden-payload mechanism.

  6. info warn → info by review dynamic-execution tests/test_requests.py:1134:14

    `open(__file__)` — file reads its own source, common pattern for extracting payloads hidden in comments (ast pass, confidence 0.85)

            s = requests.Session()
            with open(__file__, "rb") as f:
                files = {"file": f}
                req = requests.Request("POST", httpbin("post"), files=files)
    likely benign LLM, confidence 0.95 Test uses its own source file as an upload in a Request object test.
    Reasoning

    Session/Request test that opens __file__ as a file upload fixture. Benign test scaffolding.

  7. info warn → info by review dynamic-execution tests/test_requests.py:1153:14

    `open(__file__)` — file reads its own source, common pattern for extracting payloads hidden in comments (ast pass, confidence 0.85)

        def test_custom_content_type(self, httpbin):
            with open(__file__, "rb") as f1:
                with open(__file__, "rb") as f2:
                    data = {"stuff": json.dumps({"a": 123})}
    likely benign LLM, confidence 0.95 Test opens its own source twice to build a multipart upload with custom content type.
    Reasoning

    Nested opens of __file__ provide two file objects for a custom content-type multipart test. Benign fixture usage.

  8. info warn → info by review dynamic-execution tests/test_requests.py:1154:18

    `open(__file__)` — file reads its own source, common pattern for extracting payloads hidden in comments (ast pass, confidence 0.85)

            with open(__file__, "rb") as f1:
                with open(__file__, "rb") as f2:
                    data = {"stuff": json.dumps({"a": 123})}
                    files = {
    likely benign LLM, confidence 0.95 Second open of the module's own source file within the custom content-type test.
    Reasoning

    Inner open of __file__ in the same custom content-type test. Same benign fixture pattern.

  9. info warn → info by review dynamic-execution tests/test_requests.py:1547:14

    `open(__file__)` — file reads its own source, common pattern for extracting payloads hidden in comments (ast pass, confidence 0.85)

        def test_prepared_request_with_file_is_pickleable(self, httpbin):
            with open(__file__, "rb") as f:
                r = requests.Request("POST", httpbin("post"), files={"file": f})
                p = r.prepare()
    likely benign LLM, confidence 0.95 Test uses its own source file to check that a prepared request with a file is pickleable.
    Reasoning

    Pickling test for prepared requests with a file attachment uses the module's own file as the upload. Benign test fixture.

  10. info warn → info by review dynamic-execution tests/test_utils.py:146:14

    `open(__file__)` — file reads its own source, common pattern for extracting payloads hidden in comments (ast pass, confidence 0.85)

        def test_super_len_with_fileno(self):
            with open(__file__, "rb") as f:
                length = super_len(f)
                file_data = f.read()
    likely benign LLM, confidence 0.95 Test opens its own file to verify super_len and read behavior.
    Reasoning

    super_len test opens __file__ to exercise fileno-based length calculation and read. Standard test technique with no payload extraction.

Reproduce This Scan

Run disclude locally to verify. Add --format sarif for SARIF output. Add --llm (with an API key in the environment) to include the LLM review.

cargo install disclude --version 4.1.0
git clone https://github.com/psf/requests requests && cd requests
git checkout v2.34.2
disclude scan --severity info --diff v2.34.1 .