Skip to content

security: Python exec/b64decode-write/marshal.loads rules (Part of #8433) - #8614

Merged
squid-shepherd[bot] merged 1 commit into
mainfrom
churn/8433-20261118T1350Z
Nov 18, 2026
Merged

squid-shepherd[bot] merged 1 commit into
mainfrom
churn/8433-20261118T1350Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #8433 (security epic #8427). Slice 1: the three Python members of the "common malware idioms with no rule" class.

What changed

Three alternatives added to high_risk_execution in gitgalaxy/security/security_lens.py, each scoped to python / embedded_python through HIGH_RISK_EXECUTION_SCOPE (#5463), so they are dropped for any other language:

  • exec( whose argument is a decoded or built string (b64decode, decompress, codecs.decode, marshal.loads, bytes.fromhex, x.decode(, an f-string, or a literal joined with % / + / .format / .join). exec('x = 1') and exec(code, ns) stay silent.
  • .write(b64decode( (decode-and-drop stagers).
  • marshal.loads(.

Tests: tests/security_auditing/test_python_malware_idioms_8433.py (planted cases that must fire, near-misses that must stay silent, a not-a-vector check in javascript/go/java/ruby/php, embedded_python, commented-out).

Class / Sibling gaps

Class: common malware idioms with no SecurityLens rule (#8433 table, six members).

Member Status
Python exec( of built/decoded string handled here
Python b64decode feeding a file write handled here (the exec(b64decode(...)) form is covered by the first rule)
Python marshal.loads( handled here
javascript-obfuscator _0x names / string-array rotation missing, later slice (JS family scope, different mechanism: identifier density, not a call shape)
Actions pull_request_target with github.head_ref / untrusted checkout partial, later slice (yaml scope, multi-line context)
Actions toJSON(secrets) missing, later slice (yaml scope)

Sibling gaps (Python, not done here): a two-statement stager (p = b64decode(x) then exec(p)) needs taint tracking, not a per-line regex; exec(compile(b64decode(...))) is not matched; f.write(b64decode(data)) also fires on a legitimate decoded-image write (accepted: the rule cannot see the destination type).

Remaining slices

  1. JS obfuscator identifiers (security_lens.py, test file; JS-family scope).
  2. Actions pull_request_target + head_ref/untrusted checkout (security_lens.py, test).
  3. Actions toJSON(secrets) (security_lens.py, test).

Facts checked

  • exec(, marshal, b64decode were absent from THREAT_SIGNATURES before; the scope table's first-match-decides rule means the new exec\b / .write\b / marshal.loads\b entries claim only these hits (no existing hit starts with them).
  • pr_gates.py --fast: 9/9 pass (ruff 0.17.4, mypy 2.4.1 pinned).
  • tests/security_auditing: 999 passed, 2 skipped, 2 xfailed.
  • Golden masters: crucible_check.py (no --update) passes on both legs (full_precision, zero_dependency): counts did not move, no rebless.
  • keyword-rosetta: no local checkout exists on this box (keyword-rosetta is not under /srv/storage_16tb/projects/gitgalaxy), so it was NOT run; CI will. If its counts move, a rebless is the tick's call.
  • pr_gates.py --ratchets: cics-spec, ports, port-surface, estate, det-mutation, time pass. fact-crosscheck, completeness and ground-truth fail because example-health-apis is not fetched at its pinned ref on this box (a mainframe corpus, untouched by a security-lens change); not re-checked against main.

Cross-repo

keyword-rosetta (plant for these idioms) is a companion, not part of this PR; if its sweep moves counts, that side re-runs after merge.

Co-Authored-By: Claude Sonnet 5.5 [email protected]

🤖 Generated with Claude Code

@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 18, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

1 similar comment
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review November 18, 2026 14:43
@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 18, 2026 14:43
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol squid-protocol added shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md labels Nov 18, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot merged commit f390b0e into main Nov 18, 2026
97 checks passed
@squid-shepherd
squid-shepherd Bot deleted the churn/8433-20261118T1350Z branch November 18, 2026 14:56
squid-protocol added a commit that referenced this pull request Nov 18, 2026
…, one more REFLECTION_METAPROGRAMMING (Part of #8431)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
squid-shepherd Bot pushed a commit that referenced this pull request Nov 18, 2026
…Part of #8431) (#8611)

* fix(security): shadow-patch flag is a manual hint, assigns no class (Part of #8431)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* tests: real-model shadow-patch test compares against the flag-less outcome (Part of #8431)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* tests: regenerate docs_read_by_tests.txt (Part of #8431)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* tests: policy-gate fixture trips secrets_risk, not a secret-named key (CodeQL clear-text source, Part of #8431)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* tests: re-bless doom-ascii golden for main's Python exec rules (#8614), one more REFLECTION_METAPROGRAMMING (Part of #8431)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

---------

Co-authored-by: Joe Esquibel <[email protected]>
Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant