Skip to content

Missing audit events for python -i and python -m asyncio #121957

Open

Description

@ambv

Modules/main.c:pymain_repl should fire cpython.run_stdin like Modules/main.c:pymain_run_stdin to allow administrators to log/block interactive use. Maybe that event firing should be moved all the way to _PyRun_InteractiveLoopObject, but its only other use is with PyRun_InteractiveLoopFlags, which is embedded, so not clear we want that. Therefore, pymain_repl is now the clear choice. Affected versions: Python 3.8+.

Similarly, the asyncio REPL didn't emit any audit events related to interactive use. Affected versions: Python 3.8+.

Note that code.InteractiveConsole also doesn't fire interactive use audit events, but my thinking here is that this is an end-user API, so the user can choose to fire that event if they want to. Similar case to PyRun_InteractiveLoopFlags.

This will require a separate fix for 3.8 - 3.12.

Linked PRs

Activity

  1. added
    type-security
    needs backport to 3.13
    topic-repl
    on Jul 18, 2024
  2. self-assigned this
    on Jul 18, 2024
  3. added a commit that references this issue on Jul 18, 2024
  4. changed the title [-]Missing audit event for `Modules/main.c:pymain_start_pyrepl_no_main`[/-] [+]Missing audit events for `python -i` and `python -m asyncio`[/+] on Jul 18, 2024
  5. added
    3.11
    3.10 (EOL)
    3.9 (EOL)
    3.8 (EOL)
    3.12
    and removed
    needs backport to 3.13
    on Jul 18, 2024
  6. 8 remaining items

  7. added 8 commits that reference this issue on Jul 22, 2024
  8. ambv commented on Jul 22, 2024

    @ambv
    ContributorAuthor

    The fix and backports landed, but I'm keeping this open, because I'd like to have a test of those audit events at least on main. It's going to be somewhat tricky since we'll have to build an audit binary for that.

  9. added a commit that references this issue on Jul 22, 2024
  10. removed
    3.9 (EOL)
    3.8 (EOL)
    on Nov 5, 2025
  11. StanFromIreland commented on Nov 5, 2025

    @StanFromIreland
    Member

    Triage: Was the test completed, can this be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

3.10 (EOL)3.113.123.133.14topic-repltype-security

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions