BUG: InsertPunctuationConverter accepts multi-character and empty punctuation_list entries
Los mantenedores suelen responder en 2 días
@ShivamSharma43 ya está trabajando en esto.
Desde el 18/10/2026.
- #3294 de @ShivamSharma43 — fusionado
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 25/100
Línea de trabajo
Start by reading InsertPunctuationConverter.convert_async and _is_valid_punctuation, which the issue identifies as the relevant entry points. Check the existing converter tests and verify that multi-character entries, empty strings, and an empty list all produce the documented ValueError.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
InsertPunctuationConverter.convert_async documents punctuation_list as single characters from string.punctuation and raises ValueError for invalid entries ("Only single characters from ... are allowed"). But _is_valid_punctuation checks each entry with char in string.punctuation, which is a substring test, so it accepts:
- multi-character runs that happen to be contiguous in
string.punctuation, such as"()","<=>","{|}"or"./". These are inserted as-is, so a "double punctuation" that the docstring calls invalid ends up in the prompt. - the empty string, which inserts nothing while the converter reports its insertions as done.
- an empty list, since
all([])isTrue. The converter then fails later withIndexError: Cannot choose from an empty sequenceinstead of the documentedValueError.
Multi-character entries that are not contiguous, such as "!?" or "~~", are already rejected, so the result depends on the order of characters in string.punctuation.
Steps/Code to Reproduce
import asyncio
from pyrit.converter import InsertPunctuationConverter
async def main():
converter = InsertPunctuationConverter(word_swap_ratio=1, seed=1)
for punctuation_list in (["<=>"], ["()"], [""], []):
try:
result = await converter.convert_async(prompt="hello big world", punctuation_list=punctuation_list)
print(punctuation_list, repr(result.output_text))
except Exception as e:
print(punctuation_list, f"{type(e).__name__}: {e}")
asyncio.run(main())
Expected Results
Each call raises ValueError: Invalid punctuations: ....
Actual Results
['<=>'] '<=>hello <=>big world<=>'
['()'] '()hello ()big world()'
[''] 'hello big world'
[] IndexError: Cannot choose from an empty sequence
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
- 962
- Merge medio
- 2 d 16 h
- PR fusionados (30 d)
- 354
Preparar el entorno
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
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/PyRIT
-
Bug: triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días
-
BUG: Video scorers block the event loop while decoding frames and audioPosiblemente ocupada @Shizoqua la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
Los mantenedores suelen responder en 2 días
-
BUG: HTTPTarget turns CRLF into LF in the request bodyPosiblemente ocupada @nniiovoo la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 25/100
Los mantenedores suelen responder en 2 días
-
BUG: multimodal router drops media metadata when forwarding seeds and responsesPosiblemente ocupada @Shizoqua la tomó hoy. AbiertoBug: triage
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 2 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Los mantenedores suelen responder en 2 días
Todos los issues de microsoft/PyRIT
Issues similares
-
good first issue tools
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Commits pushed after #1095 merged did not land (ahmi/unified-nova-mcp-review-e095 @ 80fa23a)Abiertobug deferred domain:ci P1
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
get_page_thumbnail modifies cached page images, affecting later thumbnails and picture exportsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
docling-project/docling-mcp#147 ·
-
issue: A pipe model's Valves button ignores the Allow Chat Valves permissionPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertobug confirmed issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
open-webui/open-webui#32771 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Scheduled Security Scan is failing on mainPosiblemente ocupada @pkupt la tomó hoy. Abiertosecurity-scan-failure
Dificultad 1/5 1-3 horas Aptitud para principiantes 74/100
semantica-agi/semantica#2045 ·
Los mantenedores suelen responder en 2 días