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
60 scanned, 44 skipped (binary, oversized, or unrecognised)
Signals
0 critical · 0 warn · 10 info
Scan time
5.8 s
LLM review
Reviewed by claude-haiku-5-5 (Anthropic): 10 of 10 warn and critical signals; 10 demoted to info.
Disclude version
4.0.0
Scanned (UTC)
2026-10-14 18:08

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.90 Compatibility loop that binds urllib3 and idna into the requests.packages namespace via locals().
    Reasoning

    This is the well-known requests compatibility shim that aliases urllib3 and idna into the requests.packages namespace via locals(). The loop is over a fixed tuple of known package names, so it is a legitimate, documented idiom, not hidden behavior.

  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 two hardcoded dependency names in a compatibility shim.
    Reasoning

    __import__ receives the loop variable, but it iterates only over the hardcoded tuple ('urllib3','idna'), so the input is effectively constant and the import targets are known, vetted dependencies. The flag is a true syntactic match but the context shows benign intent.

  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"),
    dismissed LLM, confidence 0.90 Test opens its own source file to use as an upload body.
    Reasoning

    Opening __file__ in a test to upload its own bytes as multipart data is a standard test technique for file upload behavior. No decoding, exec, or payload extraction is present.

  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"),
    dismissed LLM, confidence 0.90 Test opens its own source file as multipart upload content.
    Reasoning

    Test reads its own source file as an upload fixture for unicode multipart posting. No payload extraction or execution follows.

  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(
    dismissed LLM, confidence 0.90 Test opens its own source file as a request file attachment.
    Reasoning

    Test uses its own file handle as a files argument for a request with a unicode method name. Ordinary test fixture behavior.

  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)
    dismissed LLM, confidence 0.90 Test attaches its own source file to a session request.
    Reasoning

    Session test attaching the file's own bytes to a prepared POST. Ordinary test fixture behavior with no decoding or execution.

  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})}
    dismissed LLM, confidence 0.90 Test opens its own source file twice for multipart fields.
    Reasoning

    Nested opens of __file__ are used as multipart file fields in a custom content-type test. Standard test setup, no payload extraction.

  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 = {
    dismissed LLM, confidence 0.90 Second self-open of the source file in the same multipart test.
    Reasoning

    Second open of __file__ within the same custom content-type test, used as upload data. Standard test fixture, not malicious.

  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()
    dismissed LLM, confidence 0.90 Test attaches its own source file to a prepared request for pickle checks.
    Reasoning

    Pickling test that uses the file's own contents as a request attachment. Ordinary test code.

  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()
    dismissed LLM, confidence 0.90 Test opens its own source file to verify length calculation.
    Reasoning

    Utility test opens its own source file to check super_len with a file handle and reads it back. Ordinary test code with no hidden payload handling.

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.0.0
git clone https://github.com/psf/requests requests && cd requests
git checkout v2.34.2
disclude scan --severity info --diff v2.34.1 .