feat(guard,secrets): port the June 2026 detector series - #9
Merged
Conversation
Six modules that were written against diana-guard and diana-secrets in June and never landed anywhere. Diana's copy was deleted along with the branch that held them; this repository is where the guard layer lives now, so this is the port rather than a revival. autostash git stash -u before a high-blast command in a dirty tree deobfuscate AST-level base64 / eval / obfuscated-payload unwrapping findings persisted verdict envelope, content-fingerprinted injection indirect prompt-injection detection over untrusted text lockdown network-egress denial: curl, wget, nc, ssh, scp, gh api verifier live provider-side token verification, behind a feature Wiring worth naming: Lockdown runs as phase 0 of `check_detailed`, before the policy allowlist. That order is the point — a user-defined safe_command_prefixes entry must not be able to open a hole in a mode whose whole purpose is that nothing leaves. `verification` is off by default. The HTTP stack is a large dependency and a network call from inside a sync hook is a deliberate choice, never an accident of building the crate. `prompt-injection-ml` is declared because the injection module gates an ML path behind it; the deterministic rules run without it. Two inherent `default()` constructors became `at_default_path()`. Both do I/O, and an inherent `default` shadowing `Default::default` at the call site means a reader cannot tell which one they are getting. Adapted from the original: VerdictDetail::new now takes the config (post-June signature change), RuleId::LockdownEgress and the three config sections were added rather than copied wholesale, and eprintln became log::warn. 594 tests pass, clippy --all-targets clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Six modules written against
diana-guard/diana-secretsin June 2026 that never landed anywhere. Diana's branch holding them was deleted (taggedarchive/secguard-detectors-20260607in the Diana repo); the guard layer lives here now, so this is the port rather than a revival.guard::autostashgit stash -ubefore a high-blast command in a dirty treeguard::deobfuscateguard::findingsguard::injectionguard::lockdowngh apisecrets::verifierWiring worth naming
Lockdown runs as phase 0 of
check_detailed, before the policy allowlist. That order is the point: a user-definedsafe_command_prefixesentry must not be able to open a hole in a mode whose whole purpose is that nothing leaves.verificationis off by default. The HTTP stack is a large dependency and a network call from inside a sync hook is a deliberate choice, never an accident of building the crate.prompt-injection-mlis declared because the injection module gates an ML path behind it; the deterministic rules run without it.Adapted, not copied
VerdictDetail::newgained aconfigparameter after June — the lockdown call site passes it.RuleId::LockdownEgressadded with its damage mapping (D::new(3, 0): blocks exfiltration, and the target being remote means recovery is not local).AutostashConfig/LockdownConfig/InjectionConfigspliced into the existingGuardConfigrather than overwriting a config that has evolved since.eprintln!→log::warn!.default()constructors becameat_default_path(). Both do I/O, and an inherentdefaultshadowingDefault::defaultat the call site means a reader cannot tell which one they are getting.Verification
Defaults are unchanged:
lockdown.enabled = false,verificationoff,prompt-injection-mloff.autostash.enabled = trueat blast ≥ 3 — the one behaviour change worth a second look before merge.