Skip to content

fix(scripts): stop tracking compiled Python under scripts/__pycache__ - #744

Merged
tuna-reef-hive[bot] merged 1 commit into
mainfrom
sec/fix-tracked-pyc
Nov 19, 2026
Merged

tuna-reef-hive[bot] merged 1 commit into
mainfrom
sec/fix-tracked-pyc

Conversation

@tuna-reef-hive

Copy link
Copy Markdown
Contributor

Security Fix

Fixes #743

Pull request 738 committed scripts/__pycache__/*.pyc because nothing ignores compiled Python here. Python reads that directory before the source beside it, and a compiled file in the unchecked-hash mode (PEP 552) is loaded with no look at the source. A review shows such a file only as a binary change, so a tracked __pycache__ is a place where code can run that nobody read.

The two files match their sources (compared code objects against a fresh Python 3.13 compile), so nothing unreviewed ran. This removes them so that a later binary change in that directory does not look routine.

The test sits in scripts/test_regen_catalog.py because catalog-refresh.yml already runs it on catalog pull requests and before the weekly refresh job, which holds a write token. It asks git for tracked *.pyc, *.pyo and *.pyd files across the repository, not only under scripts/.

Checked locally with Python 3.13.5: 17 tests pass on this branch; with the two files restored, test_no_compiled_python_is_tracked fails and names them.

Limit: a pull request that adds only a forced .pyc file does not start catalog-refresh.yml (its path filter names the two scripts), so the test catches that at the next weekly run. The ignore rule covers the accidental path, which is the one that happened.


Filed by sec-check agent (ACMM L6 — full mode)

— hive: agent=sec-check backend=claude model=claude-fable-5-2 effort=high claude=2.1.322

Python reads scripts/__pycache__ before the source beside it. A compiled
file in the unchecked-hash mode (PEP 552) is loaded with no look at the
source, and a review shows it only as a binary change. The two files that
#738 added match their sources, so nothing ran that was not reviewed; the
directory should still not be tracked.

Remove both files, ignore compiled Python, and add a test that fails when
a compiled Python file is tracked.

Signed-off-by: sec-check <350451359+tuna-reef-hive[bot]@users.noreply.github.com>
@tuna-reef-hive
tuna-reef-hive Bot requested a review from hanthor as a code owner November 19, 2026 10:16
@github-actions
github-actions Bot removed the request for review from hanthor November 19, 2026 10:16
@tuna-reef-hive tuna-reef-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 19, 2026
@tuna-reef-hive
tuna-reef-hive Bot merged commit 87274e7 into main Nov 19, 2026
16 checks passed
@tuna-reef-hive

Copy link
Copy Markdown
Contributor Author

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

Evidence bundle `#744d953271` sha256:c16cd89da7e8938f46c0cd21435d2276c13e88b7fa4fb42f6b4fe31e3d295030 — download from the dashboard or `hivectl review evidence #744`.

@tuna-reef-hive tuna-reef-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[sec-check] Compiled Python files are tracked under scripts/__pycache__ and nothing ignores them

0 participants