BUG: LeetspeakConverter ignores uppercase and multi-character custom_substitutions keys and fails on empty replacement lists
I maintainer di solito rispondono entro 2 giorni
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 25/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Python
- Stelle
- 4.6k
- Fork
- 962
- Merge medio
- 2g 16h
- PR unite (30g)
- 367
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/PyRIT
-
BUG: label queries only return the final conversation of an attackForse già presa @u7k4rs6 l’ha presa 4 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
microsoft/PyRIT#3095 · 4 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
microsoft/PyRIT#3325 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 53/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 46/100
I maintainer di solito rispondono entro 2 giorni
-
BUG: Tone, Tense, Translation, Noise, ScientificTranslation and Variation converter identifiers ignore a custom prompt_templateForse già presa @ShivamSharma43 l’ha presa oggi. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 20/100
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di microsoft/PyRIT
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
SwiftKickMobile/skai#84 ·
-
Lychee link check failedAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
jxxghp/MoviePilot#7070 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
flop-labs/technocore-chat#997 ·
I maintainer di solito rispondono entro 1 giorno
-
tunneld on Windows: Wi-Fi devices are not discovered because uvicorn runs on a ProactorEventLoopAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
doronz88/pymobiledevice3#2051 ·
I maintainer di solito rispondono entro 1 giorno