Skip to content

feat(canary): local honeytoken decoys (rebased #491, refs #293) - #496

Merged
blitzcrieg1 merged 3 commits into
masterfrom
contrib/pr-491
Nov 26, 2026
Merged

blitzcrieg1 merged 3 commits into
masterfrom
contrib/pr-491

Conversation

@blitzcrieg1

Copy link
Copy Markdown
Owner

Rebased version of #491 by @im02-crypto onto master after #495. Fixed the two Ruff errors that failed CI (S506 noqa on the safe YAML loader, matching loader.py; removed unused import), README recounted to 3013 locally (canary 9 passed, readme-claims 16 passed, ruff clean). Closes #491. Refs #293.

im02-crypto and others added 3 commits November 26, 2026 21:16
Adds docs/canary.md: why a planted value beats a guessed one, how to plant and
remove, the five guarantees (local only, rule id not value, never overwrites,
reversible, off by default), and the limits worth knowing (only while the
recorder runs, not a filesystem tripwire, the values are recognisably fake on
purpose).

Links it from the README CLI Reference entry.
An opt-in `agentmetry canary` command plants decoy credentials whose use is a
finding at the tool boundary, with nothing leaving the machine.

- `core/canary.py`: plant / list / remove / forget. State and the generated
  DLP rules live under `~/.agentmetry/canary/`, so the packaged manifest stays
  unchanged and an opt-in feature never ships in the default ruleset.
- `core/audit/dlp/loader.py`: merge `~/.agentmetry/canary/*.yaml` after the
  built-in manifest, and only when the directory exists. The hook reads this on
  every tool call (#171), so that path stays cheap.
- `cli`: `agentmetry canary {plant,list,remove,forget}` with `--kind aws|env`,
  `--scope home|project`, `--project` and `--name`.
- README: CLI Reference entry and the collected-test count.

How the issue's constraints are held:
- Local only: detection is a DLP regex over what the agent already submitted,
  so there is no callback and no network.
- The trail records the rule id, never the value: the rule is anchored on the
  planted value and the scanner redacts matches like any other token.
- Never overwrites a real credential: planting refuses when the profile or key
  already exists.
- Reversible: `remove` deletes exactly what was appended and refuses when the
  file changed underneath it; `forget` drops bookkeeping for that case.
- Off by default: nothing exists until the command runs.

No frozen detection file is touched (rules.py, traits.py, engine.py, mitre.py,
policies/detection/manifest.yaml).

9 new tests in tests/test_canary.py; full suite 2984 passed, 7 skipped.

Closes #293
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <[email protected]>
@blitzcrieg1
blitzcrieg1 merged commit c20f9b0 into master Nov 26, 2026
10 checks passed
@blitzcrieg1
blitzcrieg1 deleted the contrib/pr-491 branch November 26, 2026 19:23
@blitzcrieg1 blitzcrieg1 mentioned this pull request Nov 26, 2026
blitzcrieg1 added a commit that referenced this pull request Nov 26, 2026
#497)

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