Skip to content

MAINT: Refactor Cyber scenario to use technique registry pattern#1654

Open
rlundeen2 wants to merge 3 commits intomicrosoft:mainfrom
rlundeen2:users/rlundeen/2026_04_24_jailbreak
Open

MAINT: Refactor Cyber scenario to use technique registry pattern#1654
rlundeen2 wants to merge 3 commits intomicrosoft:mainfrom
rlundeen2:users/rlundeen/2026_04_24_jailbreak

Conversation

@rlundeen2
Copy link
Copy Markdown
Contributor

No description provided.

- 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>
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]
Copy link
Copy Markdown
Contributor Author

@rlundeen2 rlundeen2 Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure what strategies we really wanted. We may want these to be core? But for now I like not changing functionality

rlundeen2 and others added 2 commits April 24, 2026 12:23
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>
@rlundeen2 rlundeen2 marked this pull request as ready for review April 24, 2026 21:31
@ValbuenaVC ValbuenaVC self-requested a review April 24, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant