Skip to content

Fix(vendor_risk_downplay): reject empty judge_system_prompt in config validation#272

Open
Jean-Regis-M wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Jean-Regis-M:patch-22
Open

Fix(vendor_risk_downplay): reject empty judge_system_prompt in config validation#272
Jean-Regis-M wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Jean-Regis-M:patch-22

Conversation

@Jean-Regis-M
Copy link

Summary

Fixes #123
Prevents VendorRiskDownplayDetector from accepting an empty judge_system_prompt during initialization.

Problem

The detector's _validate_config method ensures the prompt exists and is a string, but does not reject empty strings. This allows a detector with an empty prompt to be created, leading to silent runtime failures when the LLM judge is invoked with no system instructions.

Root Cause

A validation gap in _validate_config: after checking isinstance(..., str), there is no check for non‑emptiness. The empty string is a valid string type but semantically invalid.

Solution

Add a single line after the type check:

if not self.config["judge_system_prompt"].strip():
    raise ValueError("judge_system_prompt must not be empty")

… validation

Root cause:
The _validate_config method only checks for presence and string type,
allowing an empty or whitespace-only string to pass. This leads to a
silently misconfigured detector that may fail unpredictably at runtime.

Solution:
Add an explicit emptiness check using .strip() after the type check.
Now, an empty or whitespace-only prompt raises ValueError with a
clear message.

Impact:
- No breaking changes for existing valid configurations.
- Minimal diff (one line added).
- Improves correctness by catching invalid config early.

Signed-off-by: JEAN REGIS <240509606@firat.edu.tr>
@Jean-Regis-M Jean-Regis-M changed the title Fix(vendor_risk_downplay): reject empty judge_system_prompt in config… Fix(vendor_risk_downplay): reject empty judge_system_prompt in config validation Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug_026_MUST_FIX: Test Case DET-VRD-NEG-001 VendorRiskDownplayDetector silently accepts judge_system_prompt=""

1 participant