pyrit.executor.workflow.XPIAWorkflow#
- class XPIAWorkflow(*, attack_setup_target: ~pyrit.prompt_target.common.prompt_target.PromptTarget, scorer: ~pyrit.score.scorer.Scorer | None = None, converter_config: ~pyrit.executor.core.config.StrategyConverterConfig | None = None, prompt_normalizer: ~pyrit.prompt_normalizer.prompt_normalizer.PromptNormalizer | None = None, logger: ~logging.Logger = <Logger pyrit.executor.workflow.xpia (WARNING)>)[source]#
Bases:
WorkflowStrategy
[XPIAContext
,XPIAResult
]Implementation of Cross-Domain Prompt Injection Attack (XPIA) workflow.
This workflow orchestrates an attack where: 1. An attack prompt is generated and positioned using the attack_setup_target 2. The processing_callback is executed to trigger the target’s processing 3. The response is optionally scored to determine success
The workflow supports customization through prompt converters and scorers, allowing for various attack techniques and evaluation methods.
- __init__(*, attack_setup_target: ~pyrit.prompt_target.common.prompt_target.PromptTarget, scorer: ~pyrit.score.scorer.Scorer | None = None, converter_config: ~pyrit.executor.core.config.StrategyConverterConfig | None = None, prompt_normalizer: ~pyrit.prompt_normalizer.prompt_normalizer.PromptNormalizer | None = None, logger: ~logging.Logger = <Logger pyrit.executor.workflow.xpia (WARNING)>)[source]#
Initialize the XPIA workflow.
- Parameters:
attack_setup_target (PromptTarget) – The target that generates the attack prompt and gets it into the attack location.
scorer (Optional[Scorer]) – Optional scorer to evaluate the processing response. If no scorer is provided the workflow will skip scoring.
converter_config (Optional[StrategyConverterConfig]) – Optional converter configuration for request and response converters.
prompt_normalizer (Optional[PromptNormalizer]) – Optional PromptNormalizer instance. If not provided, a new one will be created.
logger (logging.Logger) – Logger instance for logging events.
Methods
__init__
(*, attack_setup_target[, scorer, ...])Initialize the XPIA workflow.
Execute the XPIA workflow strategy asynchronously with the provided parameters.
execute_with_context_async
(*, context)Execute strategy with complete lifecycle management.
get_identifier
()- async execute_async(*, attack_content: SeedPromptGroup, processing_callback: XPIAProcessingCallback | None = None, processing_prompt: SeedPromptGroup | None = None, memory_labels: Dict[str, str] | None = None, **kwargs) XPIAResult [source]#
- async execute_async(**kwargs) XPIAResult
Execute the XPIA workflow strategy asynchronously with the provided parameters.