BUG: LeetspeakConverter ignores uppercase and multi-character custom_substitutions keys and fails on empty replacement lists
Maintainer antworten meist innerhalb von 2 Tagen
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 25/100
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 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
- Vorherrschende Sprache
- Python
- Sterne
- 4.7k
- Forks
- 980
- Ø Merge
- 2 T. 9 Std.
- Gemergte PRs (30 T.)
- 422
Entwicklungsumgebung
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
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus microsoft/PyRIT
-
BUG: Garak and ML-VLSU loaders still load one example when max_examples is 0 or negativeEvtl. vergeben @ShivamSharma43 hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 2 Tagen
-
BUG: ComicJailbreak max_examples counts goals that render nothing, so templates=["code"] with max_examples=10 failsEvtl. vergeben @ShivamSharma43 hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 2 Tagen
-
BUG: SeedDatasetFilter matches harm_categories, modalities and size case-sensitively, unlike tagsEvtl. vergeben @ShivamSharma43 hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 2 Tagen
-
Conversation drawer shows the previous attack's conversations after switching attacksEvtl. vergeben @ManoharPaturi hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
microsoft/PyRIT#3575 · 2 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Conversation draft turns permanently dirty when applied conversions match no pieceEvtl. vergeben @ManoharPaturi hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
microsoft/PyRIT#3573 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 2 Tagen
Alle Issues in microsoft/PyRIT
Ähnliche Issues
-
component:benchmark
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
agentic-os-org/ANOLISA#9177 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
distrochooser/distrochooser#520 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Status: Needs confirmation Status: Needs triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
Maintainer antworten meist innerhalb von 1 Tag
-
[BUG] Published Docker images lack the redis extra: HEADROOM_COMPRESS_SESSION_STORE stops startupEvtl. vergeben @AlessandroSpallina hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
headroomlabs-ai/headroom#4513 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 65/100
codespell-project/codespell#4060 ·
Maintainer antworten meist innerhalb von 1 Tag