Skip to content

resolve_technique_factories silently drops selected techniques with no registered factory #2461

Description

@feiiiiii5

Describe the bug

resolve_technique_factories() in pyrit/scenario/core/matrix_atomic_attack_builder.py silently drops selected techniques that have no registered factory:

return {
    technique.value: all_factories[technique.value]
    for technique in context.scenario_techniques
    if technique.value in all_factories
}

A scenario selecting techniques ["a", "b", "c"] where "b" lacks a factory runs with 2 of 3 techniques and gives no indication that the selection was partially ignored — the attack matrix silently shrinks.

The repo already warns on this exact semantic elsewhere: scenarios/adaptive/adaptive_scenario.py (~L260) logs a warning and records skipped techniques in skipped_incompatible when factory.create(...) fails. The matrix path just filters without any signal.

Steps/Code to Reproduce

Select a technique name that is not in the registry (e.g. via a scenario config typo) and call resolve_technique_factories; the returned dict omits it without any log output.

Expected Results

At minimum a warning listing the dropped selections, consistent with adaptive_scenario.py's handling — e.g.

missing = [t.value for t in context.scenario_techniques if t.value not in all_factories]
if missing:
    logger.warning(f"Selected techniques have no registered factory and will be skipped: {missing}")

Happy to open a PR with this plus a regression test if maintainers agree.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions