Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#3,293 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

@ShivamSharma43 ya está trabajando en esto.

Desde el 17/10/2026.

  • #3295 de @ShivamSharma43 — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
python
Área
tooling

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
Python
Estrellas
4.6k
Forks
944
Merge medio
2 d 18 h
PR fusionados (30 d)
369

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/PyRIT

Todos los issues de microsoft/PyRIT

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.