Skip to content

Commit 6ca98f3

Browse files
authored
Merge pull request #43 from UnplugAI/dev
Release unplug-ai 0.4.0
2 parents 68f2cf3 + 5384842 commit 6ca98f3

87 files changed

Lines changed: 1780 additions & 194 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/actions/unplug-scan/README.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
Scan **agent-related files changed in a PR** with the unplug-ai regex Guard. Intended for repos that ship `AGENTS.md`, `.cursor/rules`, or MCP client configs.
44

5+
**External repos:** prefer the published Marketplace action **[UnplugAI/unplug-scan-action@v1](https://github.com/UnplugAI/unplug-scan-action)** (PyPI install, semver tags).
6+
7+
This composite action lives in the monorepo for local SDK development.
8+
59
## Usage in this repo
610

711
Already wired in [`.github/workflows/pr-scan.yml`](../workflows/pr-scan.yml).
@@ -23,7 +27,7 @@ jobs:
2327
with:
2428
base-ref: main
2529
install-mode: pypi
26-
unplug-version: ">=0.3.1"
30+
unplug-version: ">=0.4.0,<0.5"
2731
```
2832
2933
## Inputs
@@ -34,7 +38,7 @@ jobs:
3438
| `python-version` | `3.12` | Python version |
3539
| `working-directory` | `sdk` | Path to SDK tree when `install-mode: local` |
3640
| `install-mode` | `local` | `local` (uv sync) or `pypi` (install from PyPI) |
37-
| `unplug-version` | `>=0.3.1` | Version constraint for PyPI install |
41+
| `unplug-version` | `>=0.4.0,<0.5` | Version constraint for PyPI install |
3842

3943
## What gets scanned
4044

‎.github/actions/unplug-scan/action.yml‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ inputs:
2121
unplug-version:
2222
description: PyPI version constraint when install-mode is pypi
2323
required: false
24-
default: ">=0.3.1"
24+
default: ">=0.4.0,<0.5"
2525

2626
runs:
2727
using: composite
@@ -46,15 +46,21 @@ runs:
4646
- name: Install unplug-ai (PyPI)
4747
if: inputs.install-mode == 'pypi'
4848
shell: bash
49-
run: uv pip install --system "unplug-ai${{ inputs.unplug-version }}"
49+
env:
50+
UNPLUG_VERSION: ${{ inputs.unplug-version }}
51+
run: uv pip install --system "unplug-ai${UNPLUG_VERSION}"
5052

5153
- name: Scan changed agent files
5254
shell: bash
55+
env:
56+
INSTALL_MODE: ${{ inputs.install-mode }}
57+
WORK_DIR: ${{ inputs.working-directory }}
58+
BASE_REF: ${{ inputs.base-ref }}
5359
run: |
5460
set -euo pipefail
55-
if [ "${{ inputs.install-mode }}" = "local" ]; then
56-
cd "${{ inputs.working-directory }}"
57-
uv run unplug-scan-pr --base-ref "${{ inputs.base-ref }}" --repo-root "$(git rev-parse --show-toplevel)"
61+
if [ "$INSTALL_MODE" = "local" ]; then
62+
cd "$WORK_DIR"
63+
uv run unplug-scan-pr --base-ref "$BASE_REF" --repo-root "$(git rev-parse --show-toplevel)"
5864
else
59-
python -m unplug.cli.scan_pr --base-ref "${{ inputs.base-ref }}" --repo-root "$(git rev-parse --show-toplevel)"
65+
python -m unplug.cli.scan_pr --base-ref "$BASE_REF" --repo-root "$(git rev-parse --show-toplevel)"
6066
fi

‎.github/workflows/ci.yml‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ jobs:
2121
run:
2222
working-directory: sdk
2323
steps:
24-
- uses: actions/checkout@v6
24+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
2525

26-
- uses: astral-sh/setup-uv@v7
26+
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
2727
with:
2828
enable-cache: true
2929
version: "0.6.14"
3030

31-
- uses: actions/setup-python@v6
31+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
3232
with:
3333
python-version: ${{ matrix.python-version }}
3434

@@ -41,6 +41,9 @@ jobs:
4141
uv sync --all-extras --dev
4242
fi
4343
44+
- name: Type check (mypy)
45+
run: make typecheck
46+
4447
- name: CI gate (make check-ci; docker E2E is local-only)
4548
env:
4649
RUN_DOCKER_E2E: ""

‎.github/workflows/publish-pypi.yml‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: Publish to PyPI
22

33
# Releases run the full CI gate before building.
4-
# Token: GitHub Environment "pypi", secret "PYPI_TOKEN".
4+
# Auth: PyPI OIDC Trusted Publishing (no long-lived token). Configure the
5+
# trusted publisher for project "unplug-ai" in the PyPI project settings.
56

67
on:
78
release:
@@ -15,18 +16,21 @@ jobs:
1516
publish:
1617
runs-on: ubuntu-latest
1718
environment: pypi
19+
permissions:
20+
contents: read
21+
id-token: write # required for PyPI OIDC Trusted Publishing
1822
defaults:
1923
run:
2024
working-directory: sdk
2125
steps:
22-
- uses: actions/checkout@v6
26+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
2327

24-
- uses: astral-sh/setup-uv@v7
28+
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
2529
with:
2630
enable-cache: true
2731
version: "0.6.14"
2832

29-
- uses: actions/setup-python@v6
33+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
3034
with:
3135
python-version: "3.12"
3236

@@ -42,6 +46,6 @@ jobs:
4246
run: uv build
4347

4448
- name: Publish unplug-ai
45-
env:
46-
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
47-
run: uv publish --check-url https://pypi.org/pypi/unplug-ai/json
49+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
50+
with:
51+
packages-dir: sdk/dist

‎.github/workflows/reusable-agent-scan.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717
description: PyPI version when install-mode is pypi
1818
required: false
1919
type: string
20-
default: ">=0.3.1"
20+
default: ">=0.4.0,<0.5"
2121

2222
permissions:
2323
contents: read

‎.gitignore‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ __pycache__/
88

99
# Downloaded benchmark datasets (regenerate via benchmarks.download)
1010
sdk/benchmarks/data/*.jsonl
11-
# Keep the small, attributed attack corpus the CI gate depends on
11+
# Keep the small, attributed corpora the CI gate depends on
1212
!sdk/benchmarks/data/
13+
!sdk/benchmarks/data/garak_attacks.jsonl
14+
!sdk/benchmarks/data/benign_ci.jsonl
1315

1416
# Distribution / packaging
1517
.Python

‎CHANGELOG.md‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,29 @@ All notable changes to the `unplug-ai` SDK.
44

55
## [Unreleased]
66

7+
## [0.4.0] — 2026-06-24
8+
9+
### Added
10+
11+
- `ScanResult.degraded` and `ScanResult.degraded_layers` — surface when configured protection layers were unavailable
12+
- Token privacy filter (`build_privacy_filter`, `ModelPrivacyFilter`, `HeuristicPrivacyFilter`) behind optional `presidio` / ML extras
13+
- `MIGRATION.md` — API stability tiers, deprecated import paths, and v1.0 removal timeline
14+
- `refresh_scan_result` stable export at `unplug.api.results`
15+
- README benchmark table separating regex-only vs ML recall-gate metrics
16+
- `with_tiny()` recall-gate preset tuned for higher ML recall on injection
17+
18+
### Fixed
19+
20+
- Privacy filter thread-safe model load and `max_length` forwarding
21+
- Benchmark ML guard pipeline isolation and exfil demo output edge cases
22+
23+
### Changed
24+
25+
- Flat `unplug.core.*` shim imports emit `DeprecationWarning`; canonical subpackages are preferred
26+
- `unplug.guard_scan` emits deprecation warning — use `unplug.api.results`
27+
- Judge default model updated to `gpt-5.4-nano`
28+
- Audit remediation bundle (#41–#42): degradation metadata, privacy filter, scan CLI hardening
29+
730
## [0.3.1] — 2026-06-13
831

932
### Added

‎LICENSE‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright 2026 UnplugAI
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

‎Makefile‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: install test test-security lint format fix check check-ci
1+
.PHONY: install test test-security lint typecheck format fix check check-ci
22

33
install:
44
cd sdk && uv sync --all-extras --dev
@@ -8,15 +8,15 @@ test:
88

99
test-security:
1010
cd sdk && uv run pytest \
11-
tests/test_adversarial.py \
12-
tests/test_false_positives.py \
13-
tests/test_encodings.py \
14-
tests/test_secrets.py \
15-
tests/test_scan_policy.py \
16-
tests/test_security_stress.py \
17-
tests/test_sdk_coverage.py \
18-
tests/test_agent_hardening.py \
19-
tests/test_financial.py \
11+
tests/security/test_adversarial.py \
12+
tests/security/test_false_positives.py \
13+
tests/unit/core/normalize/test_encodings.py \
14+
tests/security/test_secrets.py \
15+
tests/unit/pipelines/test_scan_policy.py \
16+
tests/security/test_security_stress.py \
17+
tests/security/test_sdk_coverage.py \
18+
tests/unit/core/agent/test_agent_hardening.py \
19+
tests/unit/scanners/test_financial.py \
2020
-v
2121
@if [ -f ../repos/unplug_exp/scripts/eval_sdk_security.py ]; then \
2222
cd ../repos/unplug_exp && uv run python scripts/eval_sdk_security.py --sdk ../../jakarta/sdk; \
@@ -25,14 +25,17 @@ test-security:
2525
lint:
2626
cd sdk && uv run ruff check .
2727

28+
typecheck:
29+
cd sdk && uv run mypy
30+
2831
format:
2932
cd sdk && uv run ruff format .
3033

3134
fix:
3235
cd sdk && uv run ruff check --fix . && uv run ruff format .
3336

3437
check:
35-
cd sdk && uv run ruff check . && uv run ruff format --check . && uv run pytest -q
38+
cd sdk && uv run ruff check . && uv run mypy && uv run ruff format --check . && uv run pytest -q
3639

3740
check-ci:
3841
cd sdk && make check-ci

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Try it without installing anything: [live demo](https://huggingface.co/spaces/Un
7070
| ML span model `Guard.with_tiny()` | **Preview** ([unplug-tiny-v1](https://huggingface.co/Unplug-AI/unplug-tiny-v1)) |
7171
| Sliding-window long documents + streaming scan | **Included** |
7272

73-
Regex-only doc-level detection reaches roughly **F1 0.36 / recall 0.23** on held-out attacks: fine as a first line, not sufficient alone. The ML span model's measured per-axis numbers (including failures) are on the [model card](https://huggingface.co/Unplug-AI/unplug-tiny-v1).
73+
On the neuralchemy prompt-injection set, regex-only detection reaches **F1 0.56 / recall 0.39** — a fast first line, not sufficient alone. Adding the ML span model (`Guard.with_tiny()`) takes that to **F1 0.99 / recall 0.98**, and lifts recall on *indirect* injection from **0.05 → 0.91**. False-positive rate stays under 1% on the injection set (2.1% on a separate hard-benign corpus). Full tables, methodology, and honest caveats: [`sdk/docs/BENCHMARKS.md`](sdk/docs/BENCHMARKS.md). Per-axis model metrics (including failure modes) are on the [model card](https://huggingface.co/Unplug-AI/unplug-tiny-v1).
7474

7575
## Agent host checklist
7676

0 commit comments

Comments
 (0)