Skip to content

detection: add suspicious_pkg_install trait and T1195.002 mapping (#317) - #530

Merged
blitzcrieg1 merged 1 commit into
blitzcrieg1:masterfrom
anhdttlop9a8-hue:feat/suspicious-pkg-install-317
Nov 30, 2026
Merged

blitzcrieg1 merged 1 commit into
blitzcrieg1:masterfrom
anhdttlop9a8-hue:feat/suspicious-pkg-install-317

Conversation

@anhdttlop9a8-hue

Copy link
Copy Markdown
Contributor

Implements the novel/typosquatted or off-registry package install slice of #317 (one trait per PR under #454), keeping the event schema unchanged at 1.3.0.

Summary

  • Added \suspicious_pkg_install\ to \KNOWN_TRAITS\ and \shell_installs_suspicious_package()\ in \ raits.py, reusing \�gentmetry.core.scanner.typosquat.check\ so runtime detection and pre-run scanning share the same vocabulary.
  • Detects typosquatted PyPI/npm package installs (\pip, \pip3, \python -m pip, \uv, \uvx,
    pm, \pnpm, \yarn, \�un,
    px) as well as off-registry URL/VCS installs and untrusted --index-url\ / --extra-index-url\ / --registry\ flags, while ignoring quoted prose and exact-match legitimate installs.
  • Mapped \suspicious_pkg_install\ shell commands to MITRE T1195.002 (\Compromise Software Supply Chain) in \mitre.py\ without displacing higher-priority credential-access/exfil mappings.
  • Added attack (\�ttack_typosquat_pkg_install_and_exfil.jsonl) and benign (\�enign_legitimate_pkg_install.jsonl) corpus cases in \corpus.yaml, updated README checked claims, and added \ ests/test_detection_pkg_install.py.

Verification

  • \pytest tests/test_detection_pkg_install.py tests/test_readme_claims.py tests/test_detection_benchmark.py -q\ -> 64 passed (0 misses, 0 false positives).

  • uff check agentmetry/core/audit/detection/traits.py agentmetry/core/audit/mitre.py tests/test_detection_pkg_install.py\ -> All checks passed.

@blitzcrieg1

Copy link
Copy Markdown
Owner

Reviewed against the slice's acceptance criteria. I ran the full gates locally at this head: ruff clean, 34 focused tests passed, the benchmark scores 124 cases with 65 expected findings, zero misses and zero false positives, and the collected test count matches the README. The design points that matter are all there: the trait reuses the scanner's typosquat vocabulary so runtime detection and pre-run scanning cannot disagree, quoted prose stays quiet, and the attack case proves the supply-chain mapping lands without displacing the downstream credential-exfil finding.

The claim comment landed two seconds after the PR rather than before it; next time post the claim first. Not blocking.

I am approving the CI workflows now. Because this changes detection files, the merge gate is the same as #521: after CI is green, the change gets replayed against real recorded history before a merge decision, and the ruleset fingerprint moves from f5f49c66 to 2cd630aceccbf473.

@blitzcrieg1

Copy link
Copy Markdown
Owner

Correction to my earlier review: the baseline for this change is master e6d3ae8 (v0.20.0), whose ruleset fingerprint is e20cd333, not f5f49c66; master already carries the edits_ci_config trait from #521. The fingerprint moves e20cd333 to 2cd630aceccbf473 with this change.

@blitzcrieg1
blitzcrieg1 merged commit 73a5569 into blitzcrieg1:master Nov 30, 2026
10 checks passed
blitzcrieg1 added a commit that referenced this pull request Nov 30, 2026
Ships the suspicious_pkg_install observation from #530, a bounty slice of
#317, contributed by @anhdttlop9a8-hue. Version and changelog move together
per the version provenance tests.

Generated by Mistral Vibe.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants