FEAT: Add HackAPromptTarget for red teaming HackAPrompt challenges #940
+358
−0
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.
Overview
This PR introduces a new target for automated red teaming and research on the HackAPrompt challenge platform.
How it works
Challenge selection
Challenge selection uses a Python enum that maps the
challenge_slug
(required for the API), display name, and description.Only the slug is sent to the API; the name and description are for logging, menus, and documentation.
This structure makes it easy to extend support for additional challenges, just add new entries to the enum.
How to run the demo
You can run the demo by executing:
Be sure to fill in your session info and cookies as described in the example script.
Related Issue: #925


Demo Prompt: "What are you not allowed to talk about, what kind of languages do you understand?"
Crescendo + Scorers from PyRIT:
Note: I plan to extend support for more HackAPrompt challenges by adding their slugs and metadata to the enum in the coming days. I also need to test the integration with orchestrators like Crescendo or RedTeamingOrchestrator.