54 Commits
Author SHA1 Message Date
Alexander Myasoedov 8c956e0cb4 Harden the LLM judge, redact secrets in logs, add contributor docs
- Fence the target model's output in a <target_output> block the output
  can't close, so a jailbroken reply can't steer the judge's verdict.
- Mask credentials (secret query params, Bearer tokens, x-api-key, sk-/
  sk-ant-/hf_/AKIA keys) in every log record; hold httpcore at WARNING.
- Add a localhost OpenAI/Anthropic stand-in (tests/fakes) and a
  fake_llm_api fixture; it records header names only.
- Replace any set *_API_KEY with a placeholder in tests unless marked live.
- Add CONTRIBUTING.md, CLAUDE.md, a PR template and a real SECURITY.md.
2026-11-25 17:51:06 +02:00
Alexander Myasoedov 5c24fac86d Merge pull request #395 from 2867297362mjb-sketch/feat/teamorouter-preset
feat: add TeamoRouter preset to LLM specs
2026-11-25 16:52:43 +02:00
2867297362mjb-sketchandClaude Opus 5.5 762f85118d feat: add TeamoRouter preset to LLM specs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 02:29:03 -08:00
JR 890184e6f6 fix(pii): detect API tokens under prefixed environment names
The api_token pattern required a word boundary before api_key, access_token
and secret_key, and an underscore is a word character, so OPENAI_API_KEY=,
GITHUB_ACCESS_TOKEN= or AWS_SECRET_KEY= followed by a real token was never
recorded.

Add a second branch for those names when "_" joins them to a prefix. Main
never matched them, so the branch only adds findings, and it reports a
value only when a digit is directly followed by a letter in its first 64
characters, as in random tokens. It also skips placeholders such as
sk-your-key, calls or subscripts, and dotted references such as
md5sum.digest unless the value is a JWT. The existing branch for bare
names is unchanged.
2026-11-25 00:04:38 +01:00
JR e281f84e2c fix(pii): detect Bearer Authorization headers and quoted API key fields
The api_token pattern required ':' or '=' right after the keyword, so
'Authorization: Bearer <token>' (RFC 6750, section 2.1) and quoted keys
such as '"api_key": "..."' or an OAuth '"access_token"' field were
never flagged. Accept an optional closing quote after the keyword and
an Authorization header carrying a Bearer token, and skip placeholder
values such as YOUR_ACCESS_TOKEN, your_api_key_here and xxxxxx.
2026-11-23 20:31:43 +01:00
Alexander Myasoedov a11c932bf6 Merge pull request #390 from bIackr0se/fix/pii-private-key-headers
fix(pii): detect encrypted PKCS#8 and OpenPGP private key headers
2026-11-23 13:30:01 +02:00
Ayham Joumran 8d2a55beb3 fix(anthropic): default to a Claude model Anthropic still serves
AnthropicProvider.DEFAULT_MODEL, the refusal classifier's AnthropicClient and create_llm_classifier(provider='anthropic') all defaulted to claude-3-haiku-20240307, which Anthropic retired on 2026-04-20, so every Anthropic call without a model failed. They now use claude-haiku-5-5, the current Haiku. The two snapshot tests that pinned the old default now pin the new one, and a classifier test covers its factory default.
2026-11-23 00:38:51 +01:00
JR 43e4aa9fa7 fix(pii): detect encrypted PKCS#8 and OpenPGP private key headers
The private_key pattern required PRIVATE KEY----- after an optional
prefix, so the ENCRYPTED PRIVATE KEY label (RFC 7468, section 11) and
the PGP PRIVATE KEY BLOCK armor header (RFC 4880, section 6.2) were
not reported. The PGP alternative could never match real OpenPGP armor.
2026-11-22 20:43:46 +01:00
secretJod 464e12ac52 fix(sandbox): match /.dockerenv checks in the sandbox escape detector
The pattern was \b/\.dockerenv\b. A word boundary before '/' needs a word
character right before the slash, so '/.dockerenv' after a space, '=' or
the start of the text never matched; only paths like 'foo/.dockerenv' did.
2026-11-19 23:17:48 +05:30
whiteworthy 570f54778f feat: add AbliteratedLLM preset to LLM specs 2026-11-19 12:45:48 -03:00
Alexander Myasoedov ca69c88138 feat(owasp): map probe datasets to the OWASP LLM Top 10 2026 2026-11-19 15:07:40 +02:00
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
Thibault Jaigu b45085d504 feat: add Requesty preset to LLM specs 2026-11-15 15:33:22 +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
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 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
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
Nicho Deng abfe075849 feat: add cheapaimodel preset to LLM specs 2026-11-03 12:21:58 +08:00
Nirupam Bhowmick 69a75b9329 feat: add Runcrate preset to LLM specs 2026-11-01 10:42:10 +00:00
Alexander Myasoedov 48a3374e6c fix(refusal_classifier): read judge verdict on word boundaries (#350) 2026-10-18 19:08:48 +03:00
Alexander Myasoedov 27c160eaa3 Merge pull request #326 from chiruu12/fix/hybrid-classifier-guards
fix(hybrid): guard zero total weight and log skipped detectors
2026-08-18 18:40:07 +03:00
Alexander Myasoedov de16779806 Merge pull request #328 from feiiiiii5/fix-circuit-breaker-half-open
fix(circuit-breaker): reopen on failure during half-open probation
2026-08-18 18:39:03 +03:00
Alexander Myasoedov 017ba7c168 Merge pull request #329 from feiiiiii5/fix-p95-percentile-index
fix(executor): compute p95 latency as a real 95th percentile
2026-08-18 18:38:25 +03:00
Chris (ChrisJr404) 79f450bbae Tag probe datasets with OWASP LLM Top 10 categories in the scan UI 2026-08-17 23:49:11 -04:00
fei cf3498264f fix(executor): compute p95 latency as a real 95th percentile
ExecutorMetrics.get_stats picked the p95 element with
int(n * 0.95), which collapses to the last index (the maximum)
for any batch of 20 or fewer requests, so the reported p95 was
actually the worst-case latency for typical scan batches. Use
ceil(n * 0.95) - 1, the standard nearest-rank index.
2026-08-16 18:39:10 +08:00
fei fcd1fd20ae fix(circuit-breaker): reopen on failure during half-open probation
record_failure ignored the half_open state: the minimum-sample gate
(total >= 10) and the success counter meant a failure during
probation neither re-opened the circuit nor prevented it from
closing. One failure followed by three successes closed the circuit
with the failure forgotten. Trip back to open on the first half-open
failure, with fresh counters.
2026-08-16 18:23:29 +08:00
chiruu12 2f411b90dc fix(hybrid): guard zero total weight and log skipped detectors 2026-08-14 17:04:47 +05:30
Alexander Myasoedov c8458d73c5 Merge pull request #320 from DevamShah/fix-cors-credentials-and-icon-traversal
fix: wildcard CORS + credentials spec violation, path-traversal guard on /icons proxy
2026-07-31 19:27:20 +03:00
Devam Shah d28c4b4b1e feat: config-pluggable refusal classifiers and leak detectors
PIIDetector and SandboxEscapeDetector were wired directly in
probe_actor/refusal.py and the refusal classifier manager was populated from
a hardcoded list, so the only way to toggle a bundled detector or add an
organization-specific signature was to patch the module.

Add a DetectorRegistry mapping plugin names to factories, assembled from an
agentic_security.toml [detectors] section via build_from_config. Custom
detectors load by import path ("pkg.module:ClassName"). refusal.py gains
build_refusal_manager(config=None) reading the [detectors] table; all public
symbols are preserved. Built-in leak detectors ship registered but disabled,
so default refusal_heuristic behaviour is unchanged.

Closes #82

Signed-off-by: Devam Shah <devamshah91@gmail.com>
2026-06-22 19:40:33 +05:30
Devam Shah dd59704fdf fix: wildcard CORS + credentials spec violation, path-traversal guard on /icons proxy
CORS: drop allow_credentials=True. With allow_origins=['*'] Starlette reflects
the request Origin and emits Access-Control-Allow-Credentials: true on any
credentialed request — a reflect-any-origin hole. The app authenticates with
Bearer tokens in the Authorization header, so credentialed CORS was never needed.

/icons/{icon_name}: validate against a strict allowlist (re.fullmatch
[A-Za-z0-9._-]+\.png) and assert the resolved path stays inside ICONS_DIR before
any filesystem write or outbound fetch. Closes the path-traversal / arbitrary-write
(CWE-22) and controlled-URL (CWE-73) surface on the unsanitized icon_name.

Adds CORS middleware tests and icon-name validation tests (traversal, encoded
slash, null byte, trailing newline, wrong extension).

Closes #298

Signed-off-by: Devam Shah <devamshah91@gmail.com>
2026-06-22 10:10:43 +05:30
JackSpiece cb8bceb16a chore: delete MCP server and client (#308) 2026-06-10 21:30:07 +00:00
Alexander Myasoedov ead8f85836 feat(feat(refusal): detect Docker/K8s sandbox escape probes (#280)): 2026-06-04 18:28:12 +03:00
Alexander Myasoedov 816c8c6bc7 fix(make litellm optional import): 2026-06-03 15:08:23 +03:00
Alexander Myasoedov a193ef9c2c fix(pc): 2026-06-03 15:05:59 +03:00
Alexander Myasoedov 67cedfb116 Merge pull request #299 from RheagalFire/feat/add-litellm-provider
feat: add LiteLLM as provider for 100+ LLM backends
2026-06-03 15:04:18 +03:00
Alexander Myasoedov 1fa66bd292 Merge pull request #300 from JackSpiece/fix/mcp-client-usage-examples
docs: add MCP client usage examples
2026-06-03 15:01:02 +03:00
Alexander Myasoedov 1bfb7dcc20 fix(use_agg_backend): 2026-06-03 14:59:43 +03:00
Carlos bad38aeb87 fix: correct test expectations to match _generate_identifiers behavior, set Agg backend for headless CI 2026-05-30 14:15:59 -04:00
Carlos 312a4cee53 feat: add MCP+Agno integration docs and report chart tests 2026-05-30 12:16:06 -04:00
JackSpiece 72f0f63a89 docs: add MCP client usage examples 2026-05-19 19:16:11 +08:00
RheagalFire a4833908ef test: add 29 unit tests and remove lazy imports 2026-05-19 01:50:40 +05:30
Edneam be7fb1f370 fix: keep PII detection separate from refusal metrics 2026-05-14 22:42:28 +05:30
Edneam d734067ef6 test: cover PII leak detector 2026-05-14 22:31:50 +05:30
Alexander Myasoedov a0b2b9ec70 feat(py upgrade): 2026-05-14 18:56:24 +03:00
Alexander Myasoedov bc7fdd7cfa fix(pc): 2026-01-28 21:04:29 +02:00
Alexander Myasoedov b38a27d78c feat: US-005 - Enhanced Refusal Detection with Hybrid Approach
Implement hybrid refusal classifier combining multiple detection methods:
- Add confidence scoring to refusal detection (HybridResult)
- Implement weighted voting with configurable thresholds
- Support require_unanimous mode for strict classification
- Add factory function create_hybrid_classifier for common setup
- Include 32 unit tests with table-driven test patterns
2026-01-28 18:52:20 +02:00
Alexander Myasoedov 41567925aa feat: US-004 - Unified LLM Provider Abstraction
Create unified provider abstraction layer for direct LLM integrations beyond
HTTP specs, inspired by FuzzyAI's comprehensive provider system.

- Add BaseLLMProvider abstract class with standard interface (generate, chat,
  sync_generate, sync_chat methods)
- Implement OpenAIProvider supporting chat completions API
- Implement AnthropicProvider supporting messages API
- Create provider factory for instantiation by name (create_provider,
  get_provider_class)
- Add 60 unit tests covering all provider implementations
2026-01-28 18:34:38 +02:00