Commit Graph
3 Commits
Author SHA1 Message Date
Willie e7d1018126 feat(audit): add Finding schema fields — RuleID, Analyzer, Category, Confidence, Fingerprint
Phase 2 of the audit policy & dedupe design. Every finding now carries:

- RuleID: stable identifier (from rule.ID or derived)
- Analyzer: source analysis engine (static/dataflow/tier/integrity/structure/cross-skill)
- Category: classification (injection/exfiltration/credential/obfuscation/privilege/integrity/structure/risk)
- Confidence: 0~1 reliability score per analyzer type
- Fingerprint: sha256 stable hash for deduplication

Key changes:
- ComputeFingerprint + StampFingerprints in dedupe.go
- All 22 finding creation points populated with new fields
- SARIF output includes fingerprints and properties (analyzer/category/confidence)
- Markdown table gains Analyzer column
- Dedupe key prefers fingerprint when available, falls back to legacy composite key
- Fingerprints stamped inside ScanSkill/ScanFileWithRules so all callers benefit
2026-03-03 16:08:11 +08:00
Willie 885f072d16 feat(audit): add table-driven credential detection and 12 new security rules
Replace hardcoded credential-access YAML rules with a Go data table
(credentials.go) covering 30+ sensitive paths × 5 access methods, with
$HOME variant support, descriptive rule IDs, and an INFO-level heuristic
catch-all for unknown home dotdirs.

Add 12 new detection rules from security gap analysis:
- invisible-payload (CRITICAL): Unicode tag chars U+E0001–E007F
- prompt-injection-4 (CRITICAL): output suppression directives
- hidden-unicode-2 (HIGH): bidi control chars (Trojan Source)
- config-manipulation-0 (HIGH): AI config/memory file poisoning
- hidden-comment-injection-1 (HIGH): markdown reference-link injection
- data-exfiltration-3 (HIGH): DNS exfiltration via dig/nslookup
- self-propagation-0 (HIGH): repository worm instructions
- untrusted-install-0/1 (MEDIUM): npx -y, pip install from URL
- hidden-unicode-3 (MEDIUM): soft hyphens, directional marks

The invisible-payload pattern intentionally bypasses tutorial suppression
so CRITICAL findings are never silenced in educational contexts.
2026-03-03 16:08:11 +08:00
Willie 50e5e115c0 feat(audit): add dataflow taint tracking for cross-line exfiltration
Adds forward taint propagation analysis that detects multi-line data
exfiltration patterns where sensitive data flows through variables or
temp files before reaching a network sink.

Tracks three taint sources: credential file reads (~/.ssh, .env, etc.),
sensitive env var references ($TOKEN, $API_KEY, etc.), and command
substitution outputs. Propagates taint through variable assignments,
pipe chains, and temp file redirections. Generates HIGH-severity
dataflow-taint findings when tainted data reaches network commands.

- Add ScanShellDataflow for shell scripts and ScanMarkdownDataflow
  for fenced code blocks in markdown
- Add DeduplicateDataflow to avoid duplicate findings with existing
  per-line pattern rules
- Integrate into scanSkillImpl and ScanFileWithRules scan paths
- Can be disabled via audit-rules.yaml (id: dataflow-taint)
2026-03-02 23:01:30 +08:00