Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

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

Geschlossen
#3,293 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

@ShivamSharma43 arbeitet bereits daran.

Seit 18.10.2026.

  • #3295 von @ShivamSharma43 — gemerged

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
25/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Veraltet
Tech-Stack
python
Bereich
tooling

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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
Vorherrschende Sprache
Python
Sterne
4.7k
Forks
980
Ø Merge
2 T. 9 Std.
Gemergte PRs (30 T.)
422

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

  • Kein Dockerfile und keine Docker-Compose-Datei
  • Hat eine Pull-Request-Vorlage
  • Kein Beitragsleitfaden

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus microsoft/PyRIT

Alle Issues in microsoft/PyRIT

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.