PyRIT icon indicating copy to clipboard operation
PyRIT copied to clipboard

FEAT Add A Standalone "WebSockets Target"

Open j0dd03qbul3u opened this issue 4 months ago • 1 comments

Is your feature request related to a problem? Please describe.

Create a new target for WebSockets, i.e. "WebSocket Target". Many web applications in the wild use only WebSockets under the covers to communicate with backend AI systems, the backend AI systems are not exposed any other way other than WebSockets, and it would be of great use to enable testing not only against HTTP targets, but WebSockets as well.

Describe the solution you'd like

The new WebSockets target would be a peer of HTTP Target (http_target.py).

The new WebSockets target could borrow logic from the OpenAI realtime target (openai_realtime_target.py) - but not be tightly coupled to OpenAI.

Appropriate documentation surrounding how to use the WebSockets target, as with HTTP Target.

Describe alternatives you've considered, if relevant

Many white label webapps, SaaS, webapps in the wild, and fast/lowcode python app frameworks make use of WebSockets to communicate with backend AI systems. In many cases (purchased product, canned app framework) there is no out of the box alternative to WebSockets for a product, or its difficult without having developed the app or framework directly to give an alternative method to talk to the back end AI system.

Use of APIs with HttpTarget on aforementioned is one method, creating some sort of local encapsulation app that would take in pyrit http targets and then talk to the remote system is another, but ideally the ability to have a target that talks to WebSockets directly could be best for many systems.

Additional context

Nil.

j0dd03qbul3u avatar Jul 30 '25 15:07 j0dd03qbul3u

Good idea, @j0dd03qbul3u ! Would you like to give it a try?

romanlutz avatar Jul 30 '25 16:07 romanlutz