fix(scan): GOAT/Crescendo generators crash on empty languages list#2602
Merged
kevinmessiaen merged 1 commit intoJul 16, 2026
Conversation
Both GOATAttackScenarioGenerator._select_objectives and CrescendoAttackScenarioGenerator._select_objectives pick a random language via `languages[int(rng.integers(len(languages)))]` with no guard for an empty `languages` list. vulnerability_scan() accepts languages: list[str] with no validation, so an empty list raises `ValueError: high <= 0` from numpy instead of producing scenarios. The sibling KnowledgeBaseScenarioGenerator._sample_languages already handles this exact case correctly: `if not languages: return ["en"] * scenario_count`. GOAT/Crescendo look like copy-pasted siblings (same objectives-dict structure, same _select_objectives body) that never received this guard. Fix: `languages = languages or ["en"]` in both generators, mirroring the existing correct fallback. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds a fallback to English (["en"]) when the languages list is empty or falsy in both the Crescendo and GOAT attack scenario generators, preventing potential crashes during scenario generation. Corresponding unit tests have been added to verify this fallback behavior. There are no review comments provided, and I have no additional feedback as the changes are clean and well-tested.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
kevinmessiaen
enabled auto-merge (squash)
July 16, 2026 03:50
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.
What
Both
GOATAttackScenarioGenerator._select_objectivesandCrescendoAttackScenarioGenerator._select_objectivespick a random language vialanguages[int(rng.integers(len(languages)))], with no guard for an emptylanguageslist.vulnerability_scan()acceptslanguages: list[str]with no validation, so an empty list is easy to hit (e.g. a caller building the list programmatically), and raisesValueError: high <= 0from numpy instead of producing scenarios.The sibling
KnowledgeBaseScenarioGenerator._sample_languagesalready handles this exact case correctly:GOAT and Crescendo look like copy-pasted siblings (same objectives-dict structure, same
_select_objectivesbody) that never received this guard.Repro:
Fix
languages = languages or ["en"]in both generators, mirroring the existing correct fallback inKnowledgeBaseScenarioGenerator.Test plan
test_goat.pyandtest_crescendo.pyassertinglanguages=[]falls back to"en"instead of raising.ValueError: high <= 0; restored the fix, confirmed all 14 tests in both files pass.giskard-scanpackage test suite (155 tests) — all pass.make format/make lint/ pre-commit (ruff, basedpyright, detect-secrets) — all clean.AI-Generated disclosure
Found and fixed with AI-assisted code review (Claude Code), used with a human in the loop per this repo's
AGENTS.md. I personally reproduced the crash, verified the fix against the sibling generator's existing correct pattern, and reviewed the diff before opening this PR.