BUG: MathObfuscation, NegationTrap, SelectiveText and Zalgo converter identifiers ignore settings that change output

Fermée
#3,287 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

@ShivamSharma43 y travaille déjà.

Depuis le 18/10/2026.

  • #3288 par @ShivamSharma43 — fusionnée

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
25/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
À l'abandon
Stack technique
python
Domaine
tooling

Piste de recherche

Read the identifier implementations for MathObfuscationConverter, NegationTrapConverter, SelectiveTextConverter, and ZalgoConverter; compare them with seeded converters such as EmojiConverter. Use the reproduction pairs and ConverterRegistry registration shown in the issue to check the behavior. Done means differently configured instances have different identifiers and both NegationTrapConverter instances register successfully.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Describe the bug

Four text converters leave settings that change their output out of their identifiers, so differently configured instances share one hash:

  • MathObfuscationConverter: hint and suffix (only min_n and max_n are included).
  • NegationTrapConverter: wrong_value and trap_template. It does not override _build_identifier() at all, so its identifier only holds the supported input and output types.
  • SelectiveTextConverter: word_separator, which word-level strategies split and rejoin on.
  • ZalgoConverter: seed. Other seeded converters (EmojiConverter, CharSwapConverter, AskToDecodeConverter, RandomCapitalLettersConverter, ...) include seed.

Because the default registry name comes from that hash, registering a second configuration without a custom name raises a duplicate-name error, and memory and analytics cannot tell the configurations apart. This is the same problem as #3242 and #3244, for these text converters.

Steps/Code to Reproduce
from pyrit.converter import (
    Base64Converter,
    MathObfuscationConverter,
    NegationTrapConverter,
    SelectiveTextConverter,
    ZalgoConverter,
)
from pyrit.converter.text_selection_strategy import WordPositionSelectionStrategy
from pyrit.registry import ConverterRegistry

words = WordPositionSelectionStrategy(start_proportion=0, end_proportion=0.5)
pairs = [
    (MathObfuscationConverter(hint="a"), MathObfuscationConverter(hint="")),
    (MathObfuscationConverter(suffix="x"), MathObfuscationConverter(suffix="")),
    (NegationTrapConverter(wrong_value="1234"), NegationTrapConverter(wrong_value="hunter2")),
    (
        NegationTrapConverter(trap_template="A {prompt} {wrong_value}"),
        NegationTrapConverter(trap_template="B {prompt} {wrong_value}"),
    ),
    (
        SelectiveTextConverter(sub_converter=Base64Converter(), selection_strategy=words),
        SelectiveTextConverter(sub_converter=Base64Converter(), selection_strategy=words, word_separator=","),
    ),
    (ZalgoConverter(seed=1), ZalgoConverter(seed=2)),
]
for first, second in pairs:
    print(first.get_identifier().unique_name, second.get_identifier().unique_name)

registry = ConverterRegistry()
registry.instances.register(NegationTrapConverter(wrong_value="1234"))
registry.instances.register(NegationTrapConverter(wrong_value="hunter2"))
Expected Results

Each pair has two different identifiers, and both NegationTrapConverter instances register.

Actual Results
MathObfuscationConverter::81c6f15b MathObfuscationConverter::81c6f15b
MathObfuscationConverter::81c6f15b MathObfuscationConverter::81c6f15b
NegationTrapConverter::89a3d225 NegationTrapConverter::89a3d225
NegationTrapConverter::89a3d225 NegationTrapConverter::89a3d225
SelectiveTextConverter::91a088c0 SelectiveTextConverter::91a088c0
ZalgoConverter::78d075f9 ZalgoConverter::78d075f9
ValueError: Instance 'NegationTrapConverter::89a3d225' already exists
Screenshots

N/A

Versions
  • OS: Windows 11
  • Python version: 3.11.9
  • PyRIT version: installed from main (5b594e00) in editable mode
Langage dominant
Python
Étoiles
4.7k
Forks
1k
Merge moyen
2 j 4 h
PR mergées (30 j)
484

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

  • Aucun Dockerfile ni fichier Docker Compose
  • Propose un modèle de pull request
  • Aucun guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de microsoft/PyRIT

Toutes les issues de microsoft/PyRIT

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.