BUG: LeetspeakConverter ignores uppercase and multi-character custom_substitutions keys and fails on empty replacement lists
Les mainteneurs répondent en général sous 2 jours
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 25/100
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 withIndexError: list index out of range(deterministic mode) orIndexError: 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
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
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de microsoft/PyRIT
-
BUG: Overlapping scorer-evaluation globs duplicate CSVs and change accuracyPeut-être pris @its-amann l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
microsoft/PyRIT#3430 · 1 commentaire ·
Les mainteneurs répondent en général sous 2 jours
-
BUG: MarkdownInjectionScorer misses shortcut-reference images with path-based exfiltration, and raw HTML <img>Peut-être pris @aatif101 l’a pris il y a 1 jour. OuverteBug: triage
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
microsoft/PyRIT#3343 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 2 jours
-
BUG: OpenAITTSTarget accepts any speed, so an out-of-range value is only sent to the API on every requestPeut-être pris @ShivamSharma43 l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 25/100
Les mainteneurs répondent en général sous 2 jours
-
BUG: KeywordSelectionStrategy accepts a negative context, so SelectiveTextConverter duplicates or truncates the promptPeut-être pris @ShivamSharma43 l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 35/100
Les mainteneurs répondent en général sous 2 jours
-
BUG: PackageHallucinationScorer flags Rust std paths, type names and hyphenated crates as hallucinatedPeut-être pris @nniiovoo l’a pris aujourd’hui. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de microsoft/PyRIT
Issues similaires
-
bug good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
yunaremaia/proto-drift#22 ·
-
bug good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
yunaremaia/memwatch#96 ·
-
bug good first issue
Difficulté 1/5 Moins d'une heure Accessibilité débutants 91/100
yunaremaia/ci-gate-watch#34 ·
-
bug good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
yunaremaia/agent-capability-attestation#64 ·
Les mainteneurs répondent en général sous 1 jour
-
bug good first issue
Difficulté 1/5 Moins d'une heure Accessibilité débutants 86/100
yunaremaia/agent-call-graph#43 ·
Les mainteneurs répondent en général sous 1 jour