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
Open
Fix(vendor_risk_downplay): reject empty judge_system_prompt in config validation#272Jean-Regis-M wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Jean-Regis-M wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Conversation
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #123
Prevents
VendorRiskDownplayDetectorfrom accepting an emptyjudge_system_promptduring initialization.Problem
The detector's
_validate_configmethod 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 checkingisinstance(..., 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: