Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

MAINT Extract attack factory converter configuration composition

Aperta
#2,767 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
74/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend, testing

Direzione di ricerca

Start in pyrit/scenario/core/attack_technique_factory.py and read AttackConverterConfig and ConverterConfiguration, then run tests/unit/scenario/core/test_attack_technique_factory.py. Extract the existing composition rules into a private typed helper while preserving public signatures, validation, ordering, response converters, and input immutability. Extend focused factory coverage for the composition matrix and the configuration passed to the attack constructor.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

help wanted
Is your feature request related to a problem? Please describe.

AttackTechniqueFactory.create() handles both complete converter-configuration overrides and additive request-converter composition alongside unrelated scoring and adversarial setup. The distinction matters: selecting extra request converters must not discard a technique's built-in behavior or its response converters.

This is F3 of three small factory extractions. It is ready for implementation and can land without the other factory extractions.

Describe the solution you'd like

Extract the existing converter-composition rules into a small private, typed helper at the technique layer. Have the factory use it while preserving its public parameters and current behavior.

  • Keep full configuration replacement distinct from additive request-converter composition.
  • Preserve the existing ordering between the selected base request pipeline and extra request converters.
  • Preserve the response-converter pipeline from the effective base configuration.
  • Retain the explicit supports_additional_request_converters capability and existing constructor checks. A constructor accepting a converter parameter alone does not imply semantic support for additive composition.
  • Do not mutate the registered factory's stored configuration or caller-supplied converter lists during composition.

Acceptance criteria:

  • No override and no extras preserve the technique's original behavior.
  • A full override retains current replacement semantics, including an explicitly empty configuration.
  • Extras with and without an override preserve current request order and response converters.
  • Unsupported additive composition and invalid capability declarations retain their existing validation/error behavior.
  • Repeated factory creation with different extras does not accumulate converters or alter the original inputs.
  • Public signatures, component identity, and existing registered technique behavior remain unchanged.
  • Focused factory coverage verifies the composition matrix and the actual configuration passed to the attack constructor.
Describe alternatives you've considered, if relevant

Do not move converter execution into the factory, implement a second converter pipeline in the backend/UI, or create a generic configuration framework. Keep one clear internal composition helper and reuse the existing configuration types.

Additional context

Starting points: pyrit/scenario/core/attack_technique_factory.py, AttackConverterConfig, ConverterConfiguration, and tests/unit/scenario/core/test_attack_technique_factory.py. Follow doc/code/framework.md and the scenario, Python, and test instructions.

Related consumer: #2758 will expose registered techniques and ordered extra converters in the GUI. This extraction preserves the contracts it consumes and does not implement that GUI issue; #2758 is not a prerequisite for this refactor. Coordinate with #2494 where the same factory file is edited, but leave adversarial prompt assembly out of this change.

Lingua principale
Python
Stelle
4.5k
Fork
896
Merge medio
3g 8h
PR unite (30g)
191

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/PyRIT

Tutte le issue di microsoft/PyRIT

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.