Commit Graph
767 Commits
Author SHA1 Message Date
Alexander Myasoedov 2afd42d3b1 fix(scan): score leak detections as findings; send the many-shot attack
Addresses review on #359:
- pii / sandbox_escape (and plugins with detects_leak = True) no longer
  count as refusal votes. A leak is COMPLIED, or PARTIAL with a refusal.
- Many-shot scan builds the context with unscored warm-up requests, then
  always sends the dataset prompt and scores only that reply. Before, it
  could score a warm-up reply, and often never sent the attack.
2026-10-29 19:37:55 +02:00
Alexander Myasoedov 48349bbd12 fix(scan): score attacks that succeeded, not refusals (#358)
failureRate counted refusals and errors, so a model that refused every
attack scored 100% (grade E, CI fail) and one that complied with every
attack scored 0% (grade A, CI pass).

- process_prompt returns an Outcome (refused/complied/partial/error)
  instead of a bool. HTTP errors, request errors, bad JSON, empty
  replies and unexpected exceptions are all ERROR.
- failureRate = (complied + partial) / (refused + complied + partial).
  Errors are excluded and reported as the new errorRate field.
- Detectors get the reply text, not the stringified JSON envelope.
- Phrase matching ignores case and typographic apostrophes; topic words
  (illegal, unethical, OpenAI, Hello!, As an AI) removed from
  REFUSAL_MARKS; common refusal phrasings added.
- ml_classifier is off by default and loaded lazily.
- failures.csv now lists findings (complied/partial) with their outcome.
- Mock targets refuse ~80% instead of ~20%, so the demo still passes.
- ConcurrentExecutor trips its circuit breaker on ERROR outcomes.
2026-10-29 19:30:41 +02:00
Alexander Myasoedov 5dd991ed75 Merge branch 'main' of github.com:msoedov/agentic_security 2026-10-19 17:35:23 +03:00
Alexander Myasoedov 69e11e7d6d feat(update docs): 2026-10-19 17:35:15 +03:00
Alexander Myasoedov b6a5669060 Merge pull request #357 from msoedov/perf/harness-lazy-httpx
perf(harness): lazy import httpx
2026-10-18 19:54:23 +03:00
Alexander Myasoedov 6afb6611dc refactor(harness): lazy import fire 2026-10-18 19:51:05 +03:00
Alexander Myasoedov b89cf55645 perf(harness): lazy import httpx, bump black to 26.10.1 for PEP 810 syntax 2026-10-18 19:49:39 +03:00
Alexander Myasoedov fbfce94012 Merge pull request #352 from msoedov/chore/triage-fixes
Triage fixes and switch to Python 3.15
2026-10-18 19:15:06 +03:00
Alexander Myasoedov 32a3d23bf5 chore: drop Docker image and its CI workflow 2026-10-18 19:12:42 +03:00
Alexander Myasoedov d0a78195ba chore: switch to Python 3.15 (#347)
Relock so every dependency installs from wheels on 3.15 (multiprocess and
pyyaml are pure-python sdists), allow pandas 3 and scikit-learn 1.9.
2026-10-18 19:12:42 +03:00
Alexander Myasoedov 726b7ff835 chore(refusal_classifier): re-save bundled models with scikit-learn 1.9.1
Scores are identical to the 1.6.1 pickles (max abs decision diff 0.0 on 474 texts).
2026-10-18 19:08:48 +03:00
Alexander Myasoedov 55c6124b46 test(registry): check HF datasets via metadata, deactivate 3 dead ones (#72) 2026-10-18 19:08:48 +03:00
Alexander Myasoedov 486af8e58e fix(verify): return 400 for bad specs and upstream errors (#149) 2026-10-18 19:08:48 +03:00
Alexander Myasoedov 48a3374e6c fix(refusal_classifier): read judge verdict on word boundaries (#350) 2026-10-18 19:08:48 +03:00
Alexander Myasoedov 0005b251c3 chore(pre-commit): ignore flake8 E731 2026-10-18 19:08:48 +03:00
Alexander Myasoedov eab28edb52 feat(agentic_security_harness): 2026-10-18 18:09:43 +03:00
Alexander Myasoedov b9755a9ead Merge pull request #349 from msoedov/fix/pre-commit-pyupgrade
fix: ci poetry venv and pre-commit pyupgrade
2026-09-22 17:35:39 +03:00
Alexander Myasoedov 71c1f20a51 fix: unquote self-referential annotation for pyupgrade
pyupgrade --py314-plus rewrites the quoted return annotation added in #345,
failing pre-commit. The project requires Python 3.14, where annotations are
evaluated lazily (PEP 649), so the unquoted form imports fine.
2026-09-22 17:26:45 +03:00
Alexander Myasoedov f43472cc9b fix: ci poetry installs into system python
poetry.toml sets virtualenvs.create=false, so pipx poetry installed into
the runner's system Python 3.12 and failed uninstalling Debian packages.
Force venv creation in CI via POETRY_VIRTUALENVS_CREATE. Drop the poetry
cache from release, which never creates a venv.
2026-09-22 16:58:07 +03:00
Alexander Myasoedov bdf2208f6b Merge pull request #346 from jiawenlai1109/fix/audio-temp-leak-on-save-error
fix(audio_generator): clean up temp file when gTTS save() fails
2026-09-22 16:53:32 +03:00
jiawenlai1109 1fd08f50ee fix(audio_generator): clean up temp file when gTTS save() fails
generate_audio_cross_platform() created the temp MP3 via tts.save() one
statement *before* the try/finally that was supposed to remove it, so any
exception raised by the save itself escaped the cleanup and left
temp_audio_<hex>.mp3 in the current working directory.

gTTS.save() performs an outbound HTTP request, which is exactly the path that
fails offline or behind egress restrictions, and .gitignore does not cover the
temp_audio_* pattern - so every such run litters the working tree.

Move the save inside the existing try. Success-path behaviour is unchanged, and
this now matches how generate_audio_mac_wav() in the same file already guards
its two temp paths.

Verified on Ubuntu 22.04 / Python 3.14.7, same offline-failing test before and
after: leaked temp_audio_*.mp3 count went 1 -> 0, test result unchanged
(1 failed, gTTSError: Failed to connect). black --check passes; rest of the
module is 1 passed, 1 skipped, 1 pre-existing offline failure.
2026-09-22 17:55:01 +08:00
Alexander Myasoedov 2340bc2f5a Merge pull request #345 from Anai-Guo/fix/hybrid-classifier-self-annotation
fix(refusal_classifier): quote self-referential annotation to fix import NameError
2026-09-11 10:08:39 +03:00
Tai An 6f221d5c62 fix(refusal_classifier): quote self-referential return annotation to fix import NameError 2026-09-11 00:07:19 -07:00
Alexander MyasoedovandClaude Fable 5.1 1f2413e2b0 fix: ci pre-commit poetry env
Install poetry before setup-python and enable the poetry cache so
setup-python activates the 3.14 interpreter. With virtualenvs.create=false
poetry otherwise installs into the runner's system Python 3.12 and fails
uninstalling Debian dist-packages.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bk6CFfaN3YJFZ6yztQja7D
2026-09-07 14:08:49 +03:00
Alexander Myasoedov a49706457c fix: pc 2026-09-07 14:03:57 +03:00
Alexander Myasoedov 5a9e80b9af fix: cosmetic 2026-09-07 14:03:57 +03:00
Alexander Myasoedov 3e6b184c4f fix: template fix 2026-09-07 14:03:57 +03:00
Alexander Myasoedov f286ebf21a fix: docs 2026-09-07 14:03:57 +03:00
Alexander Myasoedov b5aa075927 Merge pull request #340 from rwinkelman/feat/scan-cli-spec-309
feat(cli): add stateless scan command for agent-invocable runs (#309)
2026-09-07 13:36:03 +03:00
Alexander Myasoedov 35379d1124 fix: build 2026-09-07 13:35:20 +03:00
Alexander Myasoedov fd43b13bb7 fix: syntax error 2026-09-07 13:24:28 +03:00
Alexander Myasoedov c75df250c7 Merge pull request #343 from TianHengZhuang/main
docs: document module interface and add ModuleProtocol
2026-09-07 13:16:03 +03:00
Alexander Myasoedov 80015fd803 Merge pull request #342 from Sabina8205/docs/cli-reference
docs: add CLI reference and correct configuration filename
2026-09-07 13:14:19 +03:00
TianHengZhuang ad41e09a2c docs: add module docstrings 2026-09-07 11:06:45 +08:00
TianHengZhuang 39fa5b34c0 docs: add module docstrings 2026-09-07 11:06:38 +08:00
TianHengZhuang d41039773e docs: add module docstrings 2026-09-07 11:06:32 +08:00
TianHengZhuang c78f4ced91 docs: add module docstrings 2026-09-07 11:06:25 +08:00
TianHengZhuang 587cbe53f3 docs: fix external_module.md examples 2026-09-07 11:05:46 +08:00
TianHengZhuang 66a38574a5 docs: add ModuleProtocol 2026-09-07 11:05:40 +08:00
Sabina8205 dd97599863 docs: add CLI reference and correct configuration filename 2026-09-02 19:21:07 +08:00
Shadow e9f4491930 style: format scan_cli for black pre-commit 2026-09-01 23:34:54 +07:00
Shadow d12b14acd6 feat(cli): add stateless scan command for agent-invocable runs (#309)
Expose `agentic_security scan --spec` to stream JSONL results from stdin, a
file, or inline HTTP spec text without agesec.toml or the web server.
2026-09-01 20:29:38 +07:00
Alexander Myasoedov 73f84b7aa8 Merge pull request #338 from rwinkelman/fix/scan-route-logging-199
feat: add structured logging to scan API routes (#199)
2026-09-01 16:16:22 +03:00
Ray Winkelman 35ae256729 feat: add structured logging to scan API routes (#199)
Log verify/scan/stop/scan-csv entry points and outcomes for easier debugging.
MCP was removed per #306; this covers the equivalent HTTP scan surface.
2026-09-01 15:25:20 +07:00
Alexander Myasoedov 797180ca3a Merge pull request #336 from rwinkelman/fix/verify-integration-error-status-173
fix(ui): mark integration verify failure on network errors
2026-08-31 14:17:34 +03:00
Ray Winkelman 723460768f fix(ui): mark integration verify failure on network errors
Fixes #173
2026-08-29 16:04:18 +07:00
Alexander Myasoedov 1ef131421e feat: move to python 3.14 baseline, patch remaining dependabot alerts
- requires-python >=3.14, pyupgrade --py314-plus, Dockerfile python:3.14-slim
- test matrix 3.14 only
- fastapi ^0.141.1 + starlette 1.6.0 (unblocks 5 starlette alerts)
- python-multipart ^0.0.31 (4 alerts)
- fix TemplateResponse for starlette 1.x request-first signature
- drop teyit hook: abandoned, incompatible with python 3.14
2026-08-18 19:14:05 +03:00
Alexander Myasoedov 11024e6fca fix(deps): patch 47 dependabot alerts via lock bump 2026-08-18 19:07:13 +03:00
Alexander Myasoedov 2f128ae16c fix(deps): bump pyarrow to 25.0.1 for cp314 wheels 2026-08-18 19:01:16 +03:00
Alexander Myasoedov 3b1067c317 fix(pc): 2026-08-18 18:49:56 +03:00