MAINT: Refactor Cyber scenario to use technique registry pattern#1654
Open
rlundeen2 wants to merge 3 commits intomicrosoft:mainfrom
Open
MAINT: Refactor Cyber scenario to use technique registry pattern#1654rlundeen2 wants to merge 3 commits intomicrosoft:mainfrom
rlundeen2 wants to merge 3 commits intomicrosoft:mainfrom
Conversation
- Add red_teaming technique to SCENARIO_TECHNIQUES catalog with multi_turn tag (no core tag, so RapidResponse is unaffected) - Rewrite Cyber to use dynamic strategy class via AttackTechniqueRegistry.build_strategy_class_from_specs - Remove manual _get_atomic_attacks_async override; use base class factory/registry pattern instead - Simplify constructor: remove adversarial_chat, scorer_config, adversarial_config, seed_groups params (resolved via registry) - Preserve _get_default_objective_scorer (malware-specific scorer) - Update airt __init__.py with lazy CyberStrategy resolution - Rewrite test_cyber.py to mirror test_rapid_response.py pattern - Update test_rapid_response.py assertions for 5-technique catalog - Bump Cyber VERSION to 2 (breaking strategy enum change) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
rlundeen2
commented
Apr 24, 2026
| from pyrit.registry.tag_query import TagQuery | ||
| from pyrit.scenario.core.scenario_techniques import SCENARIO_TECHNIQUES | ||
|
|
||
| cyber_specs = [s for s in SCENARIO_TECHNIQUES if s.name in _CYBER_TECHNIQUE_NAMES] |
Contributor
Author
There was a problem hiding this comment.
I wasn't sure what strategies we really wanted. We may want these to be core? But for now I like not changing functionality
RapidResponse now includes red_teaming alongside the existing 4 core techniques. Update RapidResponse strategy tests for 5 techniques and Cyber registry test to verify core tag presence. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Extract duplicate TestCyberStrategy and TestRapidResponseStrategy classes into test_scenario_strategy_invariants.py with parametrized tests that validate structural properties for any ScenarioStrategy: values unique, ALL expands to all techniques, aggregates expand to non-empty subsets, etc. Per-scenario tests now use subset checks instead of exact equality, so adding new techniques to the catalog won't break existing tests. Also fix RapidResponse reset fixture (_strategy_class -> _cached_strategy_class). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
No description provided.