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.
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>