PyPI / filelock / 4.1.2

filelock 4.1.2

Source
https://github.com/tox-dev/py-filelock
Tag scanned
4.1.2
Compared with
4.1.1 (0 signals introduced since)
Files
92 scanned, 9 skipped (binary, oversized, or unrecognised)
Signals
0 critical · 0 warn · 16 info
Scan time
11.8 s
LLM review
Reviewed by claude-haiku-5-5 (Anthropic): 16 of 16 warn and critical signals; 16 demoted to info.
Disclude version
4.0.0
Scanned (UTC)
2026-10-16 09:58

Signals

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

  1. info warn → info by review dynamic-execution compose.yaml:18:30

    [embedded bash] command name is a variable (`$$`) not set in this file — the caller or environment decides what runs (ast pass, confidence 0.70)

    "cp -a /repo \"$$HOME/work\" && cd \"$$HOME/work\" && pip install -q . && exec tox run -e py -x env.py.base_python=3.14 -x env_pkg_base.default_base_python=3.14"
    likely benign LLM, confidence 0.70 A compose.yaml embedded bash snippet copies the repo into $HOME, installs it, and runs tox tests.
    Reasoning

    The flagged command is a shell pipeline inside a compose file that copies the repo, runs pip install, and runs tox. The `$$` is compose escaping for a shell variable, not a dynamic command name. Nothing here fetches remote code or hides a payload, though a reviewer should confirm the env overrides and the copy destination are intended.

  2. info warn → info by review frame-introspection src/filelock/_api.py:1248:31

    `inspect.currentframe` — call-stack frame introspection (ast pass, confidence 0.70)

                    return
                state.releasing = inspect.currentframe()
                try:
                    _LOGGER.debug("Attempting to release lock %s on %s", id(self), self.lock_file)
    likely benign LLM, confidence 0.95 Stores the current stack frame on release state for lock bookkeeping and logging.
    Reasoning

    filelock uses inspect.currentframe() to record which frame is releasing the lock for diagnostics and reentrancy tracking. This is a standard, legitimate use in a locking library.

  3. info warn → info by review frame-introspection src/filelock/_api.py:1390:35

    `inspect.currentframe` — call-stack frame introspection (ast pass, confidence 0.70)

            attempt = 0
            self._context.acquiring = inspect.currentframe()
            try:
                while True:
    likely benign LLM, confidence 0.95 Records the acquiring call frame on the lock context during acquire.
    Reasoning

    Recording the acquiring frame in the lock context supports reentrancy and debug logging in filelock. There is no network, exec, or data exfiltration in the snippet.

  4. info warn → info by review frame-introspection src/filelock/_api.py:1644:14

    `inspect.currentframe` — call-stack frame introspection (ast pass, confidence 0.70)

            return False
        caller = inspect.currentframe()
        while caller is not None and caller is not frame:
            caller = caller.f_back
    likely benign LLM, confidence 0.95 Walks the call stack to find a caller frame matching a given frame.
    Reasoning

    Walking f_back from currentframe to locate a target frame is a common caller-detection technique used for lock ownership or logging. It is read-only introspection.

  5. info warn → info by review frame-introspection tasks/capabilities.py:181:5

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

        previous: Final = sys.getprofile()
        sys.setprofile(interrupt)
        try:
            with suppress(KeyboardInterrupt), contextmanager(probe)():
    likely benign LLM, confidence 0.80 Temporarily installs a profiling hook to inject an interrupt during a probe, then restores the old profile.
    Reasoning

    This appears to be a test-harness helper that installs a temporary profile hook to inject an interrupt at a precise point and restores the previous profile in a finally block. That fits testing interrupt safety in a locking library. The hook only raises during controlled probes.

  6. info warn → info by review frame-introspection tasks/capabilities.py:186:9

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

        finally:
            sys.setprofile(previous)
        return bool(finished)
    likely benign LLM, confidence 0.80 Restores the previous profile function after the interrupt probe.
    Reasoning

    This is the restore step in the finally block of the same probe, reinstating the previously saved profile function. It is cleanup, not an attack.

  7. info warn → info by review frame-introspection tasks/capabilities.py:229:13

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

                nested.append(True)
                sys.setprofile(sys.getprofile())
    
        sys.addaudithook(setprofile_again)
    likely benign LLM, confidence 0.75 An audit hook re-applies the current profile function as part of a capability probe.
    Reasoning

    Re-installing the profile hook from an audit hook is unusual and could be a persistence-style pattern. In this file, though, it looks like a capability probe that checks whether profile hooks survive reinstall, which fits the surrounding interrupt-testing logic. No exec, network, or file write is shown.

  8. info warn → info by review frame-introspection tasks/capabilities.py:233:9

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

        try:
            sys.setprofile(sys.getprofile())
        except RuntimeError:
            return False
    likely benign LLM, confidence 0.80 Feature-detects whether setting the profile function is permitted at runtime.
    Reasoning

    This is a try/except around setting the profile to test whether the runtime allows it, returning False on RuntimeError. It is a feature-detection check with no malicious behavior visible.

  9. info warn → info by review frame-introspection tests/test_filelock.py:1498:5

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

        entered: Final[set[FrameType]] = set()
        sys.setprofile(interrupt)
        try:
            lock.release()
    likely benign LLM, confidence 0.90 Test sets a profile hook to simulate an interrupt during lock release.
    Reasoning

    Within a test, a profile hook injects an interrupt during lock.release() to verify the lock handles KeyboardInterrupt. The try/finally restore is typical of such tests.

  10. info warn → info by review frame-introspection tests/test_filelock.py:1504:9

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

        finally:
            sys.setprofile(None)
        return False
    likely benign LLM, confidence 0.90 Clears the profile hook after an interrupt-injection test.
    Reasoning

    This resets the profile hook to None in a finally block after the interrupt test. It is standard test cleanup.

  11. info warn → info by review frame-introspection tests/test_soft_lease.py:401:9

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

        def read_compromise() -> None:
            sys.setprofile(pause_in_claim_creation)
            try:
                assert lease.compromise is None
    likely benign LLM, confidence 0.90 Test installs a profile hook to pause claim creation for a concurrency check.
    Reasoning

    The test installs a profile hook to pause during claim creation so a concurrent reader can observe intermediate state. This is a race-condition test pattern in a lock library.

  12. info warn → info by review frame-introspection tests/test_soft_lease.py:405:13

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

            finally:
                sys.setprofile(None)
    
        reader: Final = Thread(target=read_compromise)
    likely benign LLM, confidence 0.90 Clears the profile hook after the lease concurrency test.
    Reasoning

    This clears the profile hook in a finally block after the concurrency test. It is cleanup code with no risk.

  13. info warn → info by review frame-introspection tests/test_soft_lifetime_warning.py:47:28

    `sys._getframe` — call-stack frame introspection (ast pass, confidence 0.70)

            if entry_point == "constructor":
                warning_line = sys._getframe().f_lineno + 1
                lock_type(tmp_path / "test.lock", lifetime=10)
            else:
    likely benign LLM, confidence 0.95 Reads the current line number to assert where a lifetime warning is emitted.
    Reasoning

    sys._getframe().f_lineno is used to compute the expected warning line number in a test assertion. This is a common testing technique with no security impact.

  14. info warn → info by review frame-introspection tests/test_soft_lifetime_warning.py:51:28

    `sys._getframe` — call-stack frame introspection (ast pass, confidence 0.70)

                lock = lock_type(tmp_path / "test.lock")
                warning_line = sys._getframe().f_lineno + 1
                lock.lifetime = 10
    likely benign LLM, confidence 0.95 Captures the current line number to verify a lifetime warning location.
    Reasoning

    Same pattern as the other lifetime-warning test: the line number is captured to check warning location. Benign test code.

  15. info warn → info by review frame-introspection tests/test_soft_lifetime_warning.py:139:28

    `sys._getframe` — call-stack frame introspection (ast pass, confidence 0.70)

            if entry_point == "constructor":
                warning_line = sys._getframe().f_lineno + 1
                lock_type(tmp_path / "test.lock", lifetime=10)
            else:
    likely benign LLM, confidence 0.95 Captures the current line number to verify a lifetime warning location.
    Reasoning

    This is a repeat of the warning-line capture in a parametrized test. It is benign.

  16. info warn → info by review frame-introspection tests/test_soft_lifetime_warning.py:143:28

    `sys._getframe` — call-stack frame introspection (ast pass, confidence 0.70)

                lock = lock_type(tmp_path / "test.lock")
                warning_line = sys._getframe().f_lineno + 1
                lock.lifetime = 10
    likely benign LLM, confidence 0.95 Captures the current line number to verify a lifetime warning location.
    Reasoning

    Another line-number capture for warning assertions in the same test file. Benign.

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/tox-dev/py-filelock py-filelock && cd py-filelock
git checkout 4.1.2
disclude scan --severity info --diff 4.1.1 .