PyPI / zope.interface / 8.7

zope.interface 8.7

Source
https://github.com/zopefoundation/zope.interface
Tag scanned
8.7
Compared with
8.6 (0 signals introduced since)
Files
80 scanned, 8 skipped (binary, oversized, or unrecognised)
Signals
0 critical · 0 warn · 21 info
Scan time
15.1 s
LLM review
Reviewed by claude-haiku-5-5 (Anthropic): 21 of 21 warn and critical signals; 21 demoted to info.
Disclude version
4.1.0
Scanned (UTC)
2026-10-22 08:42

Signals

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

  1. info warn → info by review frame-introspection src/zope/interface/_compat.py:120:22

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

        name = name or py_impl.__name__
        globs = globs or sys._getframe(1).f_globals
    
        def find_impl():
    likely benign LLM, confidence 0.95 Retrieves caller's globals via frame introspection in a library helper.
    Reasoning

    sys._getframe(1).f_globals is a standard idiom in zope.interface to find the calling module's globals for class/interface definitions. Legitimate.

  2. info warn → info by review dynamic-execution src/zope/interface/common/tests/test_builtins.py:49:33

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

        CONSTRUCTORS = {
            builtins.IFile: lambda: open(__file__)
        }
    likely benign LLM, confidence 0.85 Test constructor opens the test module itself to satisfy an IFile interface check.
    Reasoning

    open(__file__) in a test lambda just opens the file as an IFile example for interface conformance testing. No payload extraction or dynamic execution is evident.

  3. info warn → info by review frame-introspection src/zope/interface/common/tests/test_collections.py:101:17

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

    def _get_FrameLocalsProxy():
        return type(sys._getframe().f_locals)
    likely benign LLM, confidence 0.95 Test helper gets the type of a frame's f_locals for conformance testing.
    Reasoning

    Retrieves the frame locals proxy type to test interface registration for FrameLocalsProxy. Test code for a known CPython type.

  4. info warn → info by review frame-introspection src/zope/interface/common/tests/test_collections.py:133:44

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

            def FrameLocalsProxy_constructor():
                return _get_FrameLocalsProxy()(sys._getframe())
            FrameLocalsProxy = _get_FrameLocalsProxy()
            CONSTRUCTORS[FrameLocalsProxy] = FrameLocalsProxy_constructor
    likely benign LLM, confidence 0.95 Test constructor builds a FrameLocalsProxy from the current frame.
    Reasoning

    Constructs a FrameLocalsProxy from the current frame inside a test registry. Benign test scaffolding.

  5. info warn → info by review frame-introspection src/zope/interface/declarations.py:1039:13

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

        """
        frame = sys._getframe(1)  # pylint:disable=protected-access
        locals = frame.f_locals   # pylint:disable=redefined-builtin
    likely benign LLM, confidence 0.95 Reads caller's locals to implement interface declaration advice.
    Reasoning

    Caller-frame locals access is the documented mechanism for class advice in zope.interface (implementedBy/classImplements style APIs). Legitimate framework behavior.

  6. info warn → info by review frame-introspection src/zope/interface/interface.py:51:16

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

    def invariant(call):
        f_locals = sys._getframe(1).f_locals
        tags = f_locals.setdefault(TAGGED_DATA, {})
        invariants = tags.setdefault('invariants', [])
    likely benign LLM, confidence 0.95 Reads the class-body frame locals to register invariants.
    Reasoning

    Frame locals are used to attach invariant metadata at class-body definition time, a known zope.interface design. Not malicious.

  7. info warn → info by review frame-introspection src/zope/interface/interface.py:60:16

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

        """Attaches a tagged value to an interface at definition time."""
        f_locals = sys._getframe(1).f_locals
        tagged_values = f_locals.setdefault(TAGGED_DATA, {})
        tagged_values[key] = value
    likely benign LLM, confidence 0.95 Stores tagged values into the calling class-body namespace.
    Reasoning

    Same class-body frame-locals technique to store tagged values at definition time. Legitimate framework code.

  8. info warn → info by review frame-introspection src/zope/interface/interface.py:641:22

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

            # could be raised.
            __module__ = sys._getframe(1).f_globals['__name__']
            # Get the C optimized __module__ accessor and give it
            # to the new class.
    likely benign LLM, confidence 0.95 Copies the caller module name into the new interface's __module__.
    Reasoning

    Reads the caller's __name__ to set __module__ for a new interface class. Standard metaclass-style behavior.

  9. info warn → info by review frame-introspection src/zope/interface/interface.py:686:16

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

        """
        f_locals = sys._getframe(1).f_locals
        methods = f_locals.setdefault(INTERFACE_METHODS, {})
        methods[func.__name__] = func
    likely benign LLM, confidence 0.95 Registers interface methods in the calling class-body namespace.
    Reasoning

    Class-body frame locals used to record interface methods at definition time. Legitimate framework design.

  10. info warn → info by review frame-introspection src/zope/interface/interface.py:767:34

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

                        # a class, but of course it does it in C. :-/
                        __module__ = sys._getframe(1).f_globals['__name__']
                    except (AttributeError, KeyError):  # pragma: no cover
                        pass
    likely benign LLM, confidence 0.95 Sets __module__ from the caller's globals with a fallback on error.
    Reasoning

    Same caller __name__ lookup for __module__ with exception handling. Benign framework code.

  11. info warn → info by review frame-introspection src/zope/interface/tests/advisory_testing.py:26:40

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

        __metaclass__ = type
        classLevelFrameInfo = getFrameInfo(sys._getframe())
    likely benign LLM, confidence 0.93 Test fixture records class-level frame info for advisory tests.
    Reasoning

    Test fixture capturing frame info at class level to verify advice behavior. Benign test code.

  12. info warn → info by review frame-introspection src/zope/interface/tests/advisory_testing.py:29:37

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

    
    moduleLevelFrameInfo = getFrameInfo(sys._getframe())
    likely benign LLM, confidence 0.93 Test fixture records module-level frame info for advisory tests.
    Reasoning

    Module-level counterpart of the same advisory test fixture. Benign.

  13. info critical → info by review frame-introspection src/zope/interface/tests/test_advice.py:55:58

    `sys._getframe` — call-stack frame introspection — file also calls `sys.exit`/`exec`/`eval` (anti-analysis shape) (ast pass, confidence 0.85)

            from zope.interface.advice import getFrameInfo
            kind, module, f_locals, f_globals = getFrameInfo(sys._getframe())
            self.assertEqual(kind, "function call")
    likely benign LLM, confidence 0.85 Test passes the current frame to getFrameInfo to verify frame classification.
    Reasoning

    The critical severity stems only from the file also using exec/eval, which here is test code checking advice frame info. Sys._getframe use is the tested API, not anti-analysis.

  14. info critical → info by review frame-introspection src/zope/interface/tests/test_advice.py:58:17

    `sys._getframe` — call-stack frame introspection — file also calls `sys.exit`/`exec`/`eval` (anti-analysis shape) (ast pass, confidence 0.85)

    
            frame = sys._getframe()
            self.assertEqual(f_locals, frame.f_locals)
            self.assertEqual(f_locals, locals())
    likely benign LLM, confidence 0.85 Test compares frame locals to locals() to validate advice semantics.
    Reasoning

    Compares frame locals with locals() in a unit test of advice behavior. The critical flag is driven by co-located exec in a test file, not by evasive logic.

  15. info warn → info by review dynamic-execution src/zope/interface/tests/test_advice.py:69:9

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

            _locals = {}
            exec(_FUNKY_EXEC, _globals, _locals)
            self.assertEqual(_locals['kind'], "exec")
            self.assertIs(_locals['f_locals'], _locals)
    likely benign LLM, confidence 0.85 Test executes a fixed test string to verify exec frame reporting.
    Reasoning

    exec of a module-level constant string (_FUNKY_EXEC) with explicit globals/locals dicts in a test checking exec-based frame kind. Non-literal but controlled, benign test scaffolding.

  16. info warn → info by review decoder-import-with-exec src/zope/interface/tests/test_declarations.py:59:17

    file imports decoder module(s) pickle and calls `exec`/`eval`/`compile` — multi-stage payload shape (ast pass, confidence 0.80)

                try:
                    exec(code, globs, locs)
                except TypeError:
                    return False
    likely benign LLM, confidence 0.85 A test helper that execs test-supplied code strings, in a file that also imports pickle.
    Reasoning

    The file is a test module for zope.interface. The exec is a helper that runs test-defined source strings inside a try/except TypeError, with no decoding or network step. The pickle import is ordinary test support. The decoder-plus-exec shape is a heuristic match, not a payload chain.

  17. info warn → info by review dynamic-execution src/zope/interface/tests/test_declarations.py:59:17

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

                try:
                    exec(code, globs, locs)
                except TypeError:
                    return False
    likely benign LLM, confidence 0.85 exec on a code variable inside a zope.interface test helper.
    Reasoning

    exec is applied to a variable holding code under test in a zope.interface test helper. The code comes from the test module itself, not from untrusted input or an encoded blob.

  18. info warn → info by review dynamic-execution src/zope/interface/tests/test_declarations.py:2051:9

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

            ])
            exec(CODE, globs, locs)
            foo = locs['foo']
            self.assertRaises(TypeError, foo)
    likely benign LLM, confidence 0.92 Executes a test-defined CODE constant to verify class-advice behavior.
    Reasoning

    CODE is a module-level test constant defining a class with __provides__ and advice behavior. exec runs it to check that TypeError is raised, and locs is then read back. This is standard testing of class-scope advice.

  19. info warn → info by review dynamic-execution src/zope/interface/tests/test_declarations.py:2066:13

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

            with self.assertRaises(TypeError):
                exec(CODE, globs, locs)
    
        def test_called_once_from_module_scope(self):
    likely benign LLM, confidence 0.92 Negative test that execs a CODE constant expecting a TypeError.
    Reasoning

    Inside assertRaises(TypeError), exec runs the test's CODE constant. It is a negative test for the advice mechanism and does not touch external input.

  20. info warn → info by review dynamic-execution src/zope/interface/tests/test_declarations.py:2076:9

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

            ])
            exec(CODE, globs)
            spec = globs['__provides__']
            self.assertEqual(list(spec), [IFoo])
    likely benign LLM, confidence 0.92 Executes a test CODE constant and checks the resulting __provides__ spec.
    Reasoning

    CODE is a test constant, exec runs it into globs, and the test asserts on the __provides__ result. It is ordinary test scaffolding for the library.

  21. info warn → info by review dynamic-execution src/zope/interface/tests/test_declarations.py:2091:13

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

            with self.assertRaises(TypeError):
                exec(CODE, globs)
    likely benign LLM, confidence 0.92 Negative test that execs a CODE constant under assertRaises.
    Reasoning

    Within assertRaises(TypeError), exec runs the test's CODE constant. This is a negative test of class-scope advice usage and has no malicious shape.

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/zopefoundation/zope.interface zope.interface && cd zope.interface
git checkout 8.7
disclude scan --severity info --diff 8.6 .