SDK 0.3: agent hardening, ML span model, audit CLI - #5
Merged
Conversation
Expand scanner normalization (destructive, leakage, financial), jailbreak patterns, encoding FP fix, security CI gate, and 431 tests.
There was a problem hiding this comment.
Pull request overview
This PR ships SDK 0.3, a large security and agent-hardening release. It wires OpenClaw-style boundaries, CaMeL-lite session taint with tool profiles, crescendo trajectory and intent gates, a local ML span model (injection_ml) with composite encoding classifier, a new unplug-audit CLI, and a renamed PyPI package (unplug-ai). It also reworks redaction (new RedactionMode with [BLOCKED:*] tags) and expands evasion patterns and test coverage to 508 tests.
Changes:
- Agent hardening: spoof-resistant
<<<UNTRUSTED>>>boundaries, session taint + tool profiles, crescendo trajectory slope detection, intent/side-effect mismatch findings, Hermes/persona/red-team injection patterns. - ML pipeline: optional Transformers BIOES span model behind
ModelProvider, composite encoding classifier, safe-prefix cache versioning, base64 size limits, secret-prefix blob skipping. - Tooling/packaging:
unplug-auditCLI with FP/encoding/boundary probe suites; PyPI rename tounplug-ai; new publish workflow; Guard singleton becomes thread-safe.
Reviewed changes
Copilot reviewed 83 out of 85 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/src/unplug/guard.py | Adds ML wiring, approval flow, session taint hooks, threadsafe init, profile enforcement |
| sdk/src/unplug/pipelines/{input,output,toolcall,base}.py | Boundary wrap, ML-after-regex order, redaction via apply_span_redactions, trajectory findings, taint/intent in toolcall |
| sdk/src/unplug/core/{boundaries,approval,intent,trajectory,redaction,model_runtime}.py | New modules implementing each subsystem |
| sdk/src/unplug/core/{encodings,normalize,secrets,policy,stats,context,cache}.py | Composite classifier, evasion-only stages, ReDoS-guarded registry, RedactionMode plumbing, taint state on context |
| sdk/src/unplug/scanners/{injection,destructive,harmful,leakage,financial,secrets}.py | Normalization in scanners, span mapping fixes, reversed text, SSN/email evasions, replacement deferred to pipeline |
| sdk/src/unplug/safeguards/injection/patterns.py, injection_ml.py, registry.py | New Hermes/persona/fake-chat patterns + ML span scanner registration |
| sdk/src/unplug/ml/* | New optional ML package: BIOES decoder, span model, providers, registry, device selection |
| sdk/src/unplug/config/{agent_policy,tools,policy,guard,loader}.py | New TOML sections (boundaries, trajectory, intent, tools, models) |
| sdk/src/unplug/audit/*, sdk/src/unplug/cli/audit.py | New audit runner + probe suites + CLI entrypoint |
| sdk/src/unplug/api/types.py, models.py | ApprovalRequest, span validators, RedactionMode on ScanRequest |
| sdk/tests/* | 15 new test modules covering agent hardening, boundaries, taint, encoding probes, redaction, FPs, adversarial, stress |
| sdk/pyproject.toml, README.md, PUBLISH.md, .github/workflows/*.yml | Rename to unplug-ai, add unplug-audit script, publish workflow, security regression CI step |
| sdk/unplug.example.toml, benchmarks/builtin_samples.py, Makefile, context/product/decisions.md | Config example, benchmark samples, security make target, decision log |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
<<<UNTRUSTED>>>boundary markersinjection_ml), encoding classifier, safe-prefix scan cache, andunplug-auditCLITest plan
cd sdk && uv run pytest -q(508 passed)uv run ruff check src/unplugunplug-audit --require-ml --probeswith v11 checkpoint when availableNotes
RETRIEVED/TOOL_OUTPUT— configure via[boundaries]in TOML