Commit Graph
807 Commits
Author SHA1 Message Date
secretJod 041b582116 fix(pii): detect credit cards followed by a CVV or expiry
The credit-card candidate regex greedily took up to 19 digits across
spaces and dashes, so a card number followed by more digits (a CVV, an
expiry month) was checked together with them and failed Luhn. Match the
whole run of digit groups and check each contiguous span of groups that
holds 13-19 digits.
2026-11-18 23:16:50 +05:30
Alexander Myasoedov 27fb7df086 Merge pull request #385 from Johnbjoseph-cybersec/jbj/owasp-llm-top-10-2025
fix(owasp): tag probes with the OWASP LLM Top 10 2025 ids
2026-11-16 12:05:13 +02:00
Alexander Myasoedov acf6374089 Merge pull request #384 from thibault-forks/add-requesty-provider
feat: add Requesty preset to LLM specs
2026-11-15 18:15:21 +02:00
Thibault Jaigu b45085d504 feat: add Requesty preset to LLM specs 2026-11-15 15:33:22 +00:00
Alexander Myasoedov 356f5d7c4c Merge pull request #383 from tausif-ahmed-guardian/gitty/agentic-security-readme-links
docs(readme): fix dead links to the CI/CD and module docs
2026-11-14 19:48:01 +02:00
Alexander Myasoedov b99aa07f0f Merge pull request #382 from anticipate218/fix/harness-blank-line-classification
Fix blank-line handling in harness outcomes
2026-11-14 19:47:12 +02:00
Tausif Ahmed a586a626f5 docs(readme): fix dead links to the CI/CD and module docs 2026-11-14 22:52:02 +05:30
anticipate218 179daedc60 Fix blank-line handling in harness outcomes 2026-11-15 00:06:38 +08:00
Alexander Myasoedov fe1f9cefa0 Merge pull request #380 from msoedov/dependabot/pip/soupsieve-4.0
chore(deps-dev): bump soupsieve from 3.0.3 to 4.0
2026-11-13 18:40:58 +02:00
dependabot[bot] f4dc28ea08 chore(deps-dev): bump soupsieve from 3.0.3 to 4.0
Bumps [soupsieve](https://github.com/facelessuser/soupsieve) from 3.0.3 to 4.0.
- [Release notes](https://github.com/facelessuser/soupsieve/releases)
- [Commits](https://github.com/facelessuser/soupsieve/compare/3.0.3...4.0)

---
updated-dependencies:
- dependency-name: soupsieve
  dependency-version: '4.0'
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-13 16:19:27 +00:00
John B Joseph 6495c671b2 fix(owasp): tag probes with the OWASP LLM Top 10 2025 ids
OWASP_LLM_TOP_10 used the 2023/24 v1.1 numbering while the badge links to the project, whose current list is the 2025 edition (https://genai.owasp.org/llm-top-10/). DataLeak now tags LLM02 Sensitive Information Disclosure, Malwaregen LLM05 Improper Output Handling, AgenticBackend LLM06 Excessive Agency, Hallucination and refuse-to-answer LLM09 Misinformation. The harness already uses LLM01:2025.
2026-11-13 07:41:51 +05:30
Alexander Myasoedov 5aee9da60f Merge pull request #379 from Aftabbs/fix/escape-json-control-chars
fix(http_spec): escape all JSON control characters in <<PROMPT>> substitution
2026-11-12 12:44:36 +02:00
Aftabbs 9a4fd1467a style(http_spec): restore LF line endings and fix escape in test literal 2026-11-12 07:16:35 +05:30
Aftabbs dac5570397 fix(http_spec): escape all JSON control characters in <<PROMPT>> substitution
escape_special_chars_for_json only escaped backslash, quote, \n, \r and \t.
Other control characters below U+0020 (backspace, form feed, ESC, NUL...)
were inserted raw into the JSON request body, producing invalid JSON that
targets reject, so attack prompts containing them were never evaluated.
Delegate to json.dumps, which escapes every character JSON requires.
2026-11-12 07:16:01 +05:30
Alexander Myasoedov 3ae108879e Merge pull request #374 from msoedov/dependabot/pip/pytest-9.2.0
chore(deps-dev): bump pytest from 9.1.1 to 9.2.0
2026-11-11 19:22:03 +02:00
dependabot[bot] bc8b3090ee chore(deps-dev): bump pytest from 9.1.1 to 9.2.0
Bumps [pytest](https://github.com/pytest-dev/pytest) from 9.1.1 to 9.2.0.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/9.1.1...9.2.0)

---
updated-dependencies:
- dependency-name: pytest
  dependency-version: 9.2.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-11 17:13:44 +00:00
Alexander Myasoedov f7f756d75a Merge pull request #372 from msoedov/dependabot/pip/virtualenv-21.14.13
chore(deps-dev): bump virtualenv from 21.14.11 to 21.14.13
2026-11-11 18:39:26 +02:00
Alexander Myasoedov 52d269de3f Merge pull request #373 from Ankit1478/chore/unmark-ci-pins
Unmark the ci pins now that #369 has landed
2026-11-11 18:38:50 +02:00
Ankit1478 261feaa5bb Unmark the ci pins now that the exit-code fix has landed
#368 and #369 merged a minute apart. #369 fixed `agentic_security ci`, and the
two pins #368 added to hold the broken shape did what they were written to do
and went red, so `pytest tests/evals -m eval` currently fails on main.

Replaces both with `test_the_ci_exit_path_stays_connected`, which asserts the
opposite: `entrypoint` returns the scan outcome and `ci()` raises `SystemExit`.
Verified non-vacuous by reverting either half, which turns it red.

Also corrects the surrounding prose, which said returning the scan result was
itself the fix. Under `fire` a returned value is printed rather than used as
the exit code, which is why `CLI.scan` ends in `raise SystemExit`. The guard
checks for the raise, not just the return.
2026-11-11 21:17:45 +05:30
dependabot[bot] d7699b3b5d chore(deps-dev): bump virtualenv from 21.14.11 to 21.14.13
Bumps [virtualenv](https://github.com/pypa/virtualenv) from 21.14.11 to 21.14.13.
- [Release notes](https://github.com/pypa/virtualenv/releases)
- [Changelog](https://github.com/pypa/virtualenv/blob/main/docs/changelog.rst)
- [Commits](https://github.com/pypa/virtualenv/compare/21.14.11...21.14.13)

---
updated-dependencies:
- dependency-name: virtualenv
  dependency-version: 21.14.13
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-11 14:51:46 +00:00
Alexander Myasoedov 0ebac43fc6 Merge pull request #368 from Ankit1478/feat/scan-evaluation-suite
Add an opt-in scan evaluation suite
2026-11-11 16:19:51 +02:00
Alexander Myasoedov d522f8f8ad Merge pull request #369 from Ankit1478/fix/ci-exit-code
Make agentic_security ci fail a build when a module exceeds max_th
2026-11-11 16:18:06 +02:00
Alexander Myasoedov f31ee53bb4 Merge pull request #371 from PSA-Team-source/add-uberllm-provider
feat: add UberLLM preset to LLM specs
2026-11-11 13:13:19 +02:00
PSA-Team-source ad6001b10f feat: add UberLLM preset to LLM specs 2026-11-10 20:54:56 +07:00
Ankit1478 0def2ec061 Make agentic_security ci fail a build when a module exceeds max_th
`CLI.ci` called `entrypoint()` and dropped the result; `entrypoint()` called
`scan()` and dropped that too, so the command exited 0 whatever the scan found
and a pipeline gating on it could never fail.

`entrypoint()` now returns a process exit code, derived from the `status`
field `async_scan` already records per module, and `CLI.ci` raises
`SystemExit` with it. That mirrors `CLI.scan`, which already ends in
`raise SystemExit(exit_code)` from `scan_cli` — returning a value is not
enough on its own, because fire prints a returned value rather than using it
as the exit code.

Both call sites had to change together: propagating the result out of
`entrypoint()` alone still exits 0.

Fixes #367
2026-11-09 14:53:05 +05:30
Ankit1478 fdfd1f9851 Proofread the eval README 2026-11-09 13:37:00 +05:30
Ankit1478 0594e5d59e Fix stale references left in the eval suite docs
The _runner docstring still said nothing covered the failure-rate arithmetic
or the optimize=True early stop; test_scan_module.py covers both. One `:324`
line reference and four `name (name)` parentheticals survived the earlier
sweep. test_detector still said 241 rows, and the README still named
MIN_RECALL and MAX_FALSE_POSITIVES, which the set-based baselines replaced.

Also records that CI does not run this suite, with the step that would turn it
on and the two reasons that is the maintainer's decision: a build starts
failing when a defect is fixed without unmarking its xfail, and the caret pin
on scikit-learn lets a fresh resolve invalidate the recorded baselines.
2026-11-09 13:29:41 +05:30
Ankit1478 acd11c2a4c Keep local-only ignores out of the eval suite change 2026-11-09 13:12:51 +05:30
Ankit1478 8bb7981225 Fix stale figures in the eval README 2026-11-09 13:12:51 +05:30
Ankit1478 9b03064943 Correct the xfail count in the eval README 2026-11-09 13:12:51 +05:30
Ankit1478 5286c69119 Drop future annotations import from the eval suite
pyupgrade strips it on this Python target, so `pre-commit run --all-files`
rewrote all twelve files and the pre-commit job would have failed on a branch
that looked clean locally. No other file in the tree carries the import.
2026-11-09 13:12:51 +05:30
Ankit1478 8f456013b6 Add blind-review tooling for the eval corpus
The labelling rules only mean something if a second person applies them the
same way. This builds a blind sheet to measure that: 30 rows drawn across all
ten sampleable (label, kind) pairs with the labels stripped, alongside a
self-contained statement of the rules.

Scoring is chance-corrected for both labels and kinds, with a bootstrap
interval, because at n=30 a single disagreement moves kappa by about 0.05 and
a raw percentage reads far better than it should with three uneven classes.
The scorer refuses a sheet before scoring it: an unfinished one would come
back as a perfect score, since a blank row is not a disagreement.

The sample deliberately over-weights the awkward kinds and forces in real
captured replies, so the result bounds agreement from below rather than
estimating it.

The answer key and the generated sheet are gitignored. Only the tooling is
committed; the sheet regenerates identically from a fixed seed.
2026-11-09 13:12:51 +05:30
Ankit1478 457bf4cf24 Guard the environment the detector baselines were recorded in
baselines.json records what the bundled OneClassSVM answers. That model
is three .joblib files committed to the repo, pickled with scikit-learn
1.9.1, so the recorded sets only hold under that release. On any other
one, every detector gate goes red for a reason that has nothing to do
with the code, and the message blames the corpus.

Three checks now run before the gates:

  - the three .joblib files are present, named individually
  - scikit-learn matches the release the models were pickled with, and
    the failure says it is an environment mismatch
  - the model still answers three fixed probes as recorded. A version
    check alone is not enough, since the files are committed and can be
    replaced without the dependency moving. One probe answers False, so
    a model degenerated to a constant is caught too

Pins that the ML plugin returns numpy.bool_ while annotated -> bool.
Harmless through the manager's any(), wrong for any caller using
`is True`.
2026-11-09 13:12:51 +05:30
Ankit1478 9ca647c5a1 Name functions instead of line numbers in the eval suite
Thirteen references pointed at source lines. One was already wrong:
targets.py cited both fuzzer.py:177 and fuzzer.py:190 for the same
JSONDecodeError handler. They rot on any edit upstream, so they now name
the function.

test_cli_status_still_mirrors_the_shipped_rule asserted an exact source
string, which would go red on a reformat. It parses async_scan and
compares the unparsed condition instead.
2026-11-09 13:12:51 +05:30
Ankit1478 6e812d5620 Grow the eval corpus and gate it by identity
Corpus goes from 37 to 245 rows. The larger corpus exposed defects the
small one never triggered, and exposed two weaknesses in the gates
themselves.

Gates no longer compare counts. baselines.json records which rows the
detector gets wrong, keyed by a hash of the reply text, and the gates
assert that no row newly joins a wrong-answer set. A count was not
monotone under corpus edits -- deleting a row the detector misreads
lowered the cap and handed back a slot -- and could not tell a fix from a
substitution. Regenerate with record_baselines.py.

Detector findings the bigger corpus surfaced:

  - ten attack_success rows read as refusals; the "an answered attack is
    never a refusal" gate becomes a strict xfail with an exact pin
  - all four roleplay rows read as refusals
  - the curly-apostrophe test was vacuous. It compared detect() outputs,
    which agree because the ML classifier fires on both spellings, while
    the phrase list went on missing every U+2019 form

New coverage:

  - test_scan_module.py drives the real entry point. Under optimize=True
    a module stops at the fifth prompt and reports that prefix's rate: a
    target scored 25% over twenty prompts is reported at 100% over five,
    and the payload does not say so
  - agentic_security ci cannot fail a build. entrypoint() discards
    scan()'s result and __main__.ci discards entrypoint()'s, so the
    process exits 0 whatever it found. Pinned by AST, not by grep
  - envelope invariance is now asserted on real attack output, not only
    on a benign sentence
  - HTTP 200 with a non-JSON body reaches fuzzer.py:177 for the first
    time; FakeResponse.json() parses its body instead of returning a
    pre-parsed object, which had made that branch unreachable

Corpus integrity: kind is validated against a per-label vocabulary and
src against a known set of models, so a typo can no longer drop a row out
of every gate silently. The partial sub-kinds get a stated rule --
refuse_then_disclose is the target's own configuration, refuse_then_comply
is something the attacker can act on -- and two rows are relabelled to
match it.

README corrects two claims: six of the 48 false positives are benign
answers rather than attacks reported as declines, and sixteen are planted
fp_trap rows, so the headline number moves little when real classifier
errors are fixed. Adds a Scope section for what the suite does not reach.

547 passed, 20 xfailed.
2026-11-09 13:12:51 +05:30
Ankit1478 90ed87b585 Add scan evaluation suite
Tier 1 drives process_prompt over fake targets whose posture is fixed by
construction, with the detector pinned to a phrase matcher. Tier 2 runs the
real detector over the labelled corpus with ratchet baselines.

Seventeen strict xfails state what should happen; each is paired with a test
pinning the current wrong behaviour, so a fix turns both red together.

118 passed, 17 xfailed.
2026-11-09 13:12:51 +05:30
Ankit1478 c3d0064a15 Empty the eval test modules pending review
targets.py and _runner.py were committed before review. Empty them so the
suite scaffold lands as placeholders only, to be filled in one file at a
time.

The corpus and the pytest configuration are unchanged and stay in place.
2026-11-09 13:12:51 +05:30
Ankit1478 9bbcbd7f56 Add scan evaluation suite scaffold and corpus
Adds tests/evals, an opt-in suite that measures what the scanner concludes
about targets whose behaviour is known in advance, so a verdict can be checked
against ground truth instead of against the scanner's own internals.

Landing in two parts. This commit carries:

- corpus/*.jsonl: 37 labelled model replies (18 refusals, 12 compliances,
  7 partials), 5 tagged disputed. 10 rows are real captured output.
- targets.py: fake targets with known ground truth (secure, compromised,
  mixed, erroring) plus four provider response envelopes.
- _runner.py: drives process_prompt and returns a Verdict.
- pyproject.toml: register the eval marker and deselect it by default, so
  the suite is opt-in and `pytest tests/evals -m eval` collects.
- .gitignore: ignore .env and .venv.

The test modules are placeholders in this commit and are filled in next.
2026-11-09 13:12:51 +05:30
Alexander Myasoedov c53cf3c02a Merge pull request #362 from nicho810/feat/cheapaimodel-preset
feat: add cheapaimodel preset to LLM specs
2026-11-04 11:49:56 +02:00
Nicho Deng abfe075849 feat: add cheapaimodel preset to LLM specs 2026-11-03 12:21:58 +08:00
Alexander Myasoedov 02f80c94da Merge pull request #361 from heydryft/feat/runcrate-provider
feat: add Runcrate preset to LLM specs
2026-11-01 20:34:03 +02:00
Nirupam Bhowmick 69a75b9329 feat: add Runcrate preset to LLM specs 2026-11-01 10:42:10 +00: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