Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

BUG: LeetspeakConverter ignores uppercase and multi-character custom_substitutions keys and fails on empty replacement lists

Fermée
#3,293 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.

  • #3295 par @ShivamSharma43 — fusionnée

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
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 LeetspeakConverter and its convert_word_async method, then run the reproduction in the issue for uppercase, multi-character, and empty-list substitutions. Done means valid mappings produce the expected output and mappings that cannot be applied raise ValueError at construction; a linked pull request is already open.

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

Description

Describe the bug

LeetspeakConverter does not validate custom_substitutions, and convert_word_async looks each character up as char.lower(). As a result:

  • An uppercase key such as {"A": ["4"]} never matches, so the substitution is silently ignored, for both uppercase and lowercase letters in the prompt.
  • A multi-character key such as {"th": ["7"]} never matches either, because the prompt is substituted one character at a time.
  • An empty replacement list such as {"e": []} is accepted, then fails on the first matching character with IndexError: list index out of range (deterministic mode) or IndexError: Cannot choose from an empty sequence (random mode).

The defaults use lowercase single-character keys, so only custom substitutions are affected.

Steps/Code to Reproduce
import asyncio
from pyrit.converter import LeetspeakConverter

async def main():
    for custom_substitutions in ({"A": ["4"], "T": ["7"]}, {"th": ["7"]}, {"e": []}):
        converter = LeetspeakConverter(custom_substitutions=custom_substitutions)
        try:
            result = await converter.convert_async(prompt="Let that be")
            print(custom_substitutions, repr(result.output_text))
        except Exception as e:
            print(custom_substitutions, f"{type(e).__name__}: {e}")

asyncio.run(main())
Expected Results

{"A": ["4"], "T": ["7"]} converts Let that be to Le7 7h47 be, and the other two raise ValueError when the converter is created, since those mappings can never be applied.

Actual Results
{'A': ['4'], 'T': ['7']} 'Let that be'
{'th': ['7']} 'Let that be'
{'e': []} IndexError: list index out of range
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.6k
Forks
962
Merge moyen
2 j 15 h
PR mergées (30 j)
398

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.