Phase 1: Fix PyRIT 0.10.0 breaking changes and add FoundryScenario strategy mapping #44477
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.
PyRIT 0.10.0 removed DuckDB support in favor of SQLite-only memory backend, breaking initialization. This PR implements Phase 1 of FoundryScenario integration: fixing the breaking change and establishing the strategy mapping infrastructure.
Changes
Fixed SQLite Initialization
DUCK_DB→SQLITEin_red_team.pymemory_db_pathparameter toinitialize_pyrit()usingoutput_dir/pyrit_memory.dbBefore:
After:
Created Strategy Mapping Layer
New
_utils/strategy_mapping.pymodule maps Azure SDKAttackStrategyenum to PyRITFoundryStrategy:convert_attack_strategy_to_foundry(): Converts strategy with validationis_foundry_supported(): Checks FoundryScenario compatibilityAdded Progress Tracking
Created
progress.mddocumenting:Added Unit Tests
New
test_strategy_mapping.pywith coverage for:is_foundry_supported()validationImpact
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
scanning-api.github.com/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Phase 1: Implement PyRIT FoundryScenario Integration
Implement the FoundryScenario integration as specified in spec.md, targeting PyRIT 0.10.0+.
Changes Required
1. Fix Breaking Change: SQLite Initialization
File:
sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/red_team/_red_team.pyCurrent (line ~234):
Updated:
Import changes:
2. Create Strategy Mapping Layer
New File:
sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/red_team/_utils/strategy_mapping.py3. Update Progress Tracking
File:
sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/red_team/progress.mdUpdate with implementation progress: