Repository navigation
Use --target_name as the WebSocket generator uri - #2315
Merged
jmartin-tech merged 2 commits intoOct 16, 2026
Merged
Conversation
Signed-off-by: Somay-kousis <[email protected]>
Signed-off-by: Somay-kousis <[email protected]>
jmartin-tech
approved these changes
Oct 15, 2026
jmartin-tech
left a comment
Collaborator
There was a problem hiding this comment.
This looks like a good approach though in general this particular experimental generator has significant additional requirement for configuration that may merit a future enhancement to ensure a fully usable specification of the target was provided.
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.
Fixes #2314.
--target_namereaches the WebSocket generator as thenameoption (garak/cli.py:660-663), butWebSocketGenerator.__init__only read the uri from itsuriargument or option, so it kept the defaultwss://echo.websocket.org. A run againstws://localhost:3000/chatsent every prompt to the public echo server and scored the echoes. The docs say the uri "can also be passed with--target_name" (docs/source/generators/websocket.rst:13).Now, when no
uriwas passed or configured andnameis aws://orwss://URL, it is used as theuri. An explicitly configureduristill wins, and with nothing set the echo default is unchanged (test_init_no_uri).Why this isn't a tiny one-off PR
It changes which server garak talks to, so whether a WebSocket scan tests the target at all. That's a behaviour fix for a documented CLI option, with tests (AGENTS.md:54).
Not a duplicate
gh issue list/gh pr list --repo nvidia/garak --state allfor "websocket target_name", "websocket uri", "WebSocketGenerator" and "echo.websocket.org": no issue or PR covers this. #2263 is a different WebSocket bug (empty outputs after the first prompt). #1589 changescli.pybut not the target name handling.Tests
test_init_target_name_sets_uricovers both config shapes the CLI writes (generators.websocket.nameandgenerators.websocket.WebSocketGenerator.name) and fails on main;test_init_configured_uri_wins_over_namepins the explicituri.black --checkis clean.AI tools helped write this change and the tests. I reviewed every changed line and ran the tests above myself.