BUG: LetterBijectionConverter accepts a negative fixed_size and then leaves the prompt unchanged
Los mantenedores suelen responder en 2 días
@ShivamSharma43 ya está trabajando en esto.
Desde el 22/10/2026.
- #3436 de @ShivamSharma43 — fusionado
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 35/100
Línea de trabajo
Start at LetterBijectionConverter and inspect how fixed_size is used to split the lowercase alphabet and build the identifier. Check the existing tests for fixed_size=0 and fixed_size=26, then add coverage for invalid values and verify they raise a ValueError naming fixed_size. A pull request is already open for this issue.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
LetterBijectionConverter(fixed_size=...) uses fixed_size as a slice bound on the 26 lowercase letters (letters[:fixed_size] stay fixed, letters[fixed_size:] are shuffled) but never validates it. A negative value is read from the end of the alphabet instead of being rejected:
fixed_size=-1keeps the first 25 letters fixed and "shuffles" onlyzwith itself, so the mapping is the identity and the converter sends the prompt to the target unchanged (attack at dawn->attack at dawn).fixed_size=-3keeps 23 letters fixed and shuffles onlyx,y,z, so most prompts also go out in plaintext.fixed_size=27is accepted (identity mapping, identifier says27),Trueis accepted as1(identifier saysTrue), and2.5fails withslice indices must be integers or None or have an __index__ method.
The identifier records the invalid value, so a run looks like a bijection attack in memory while the target actually received plaintext.
Steps/Code to Reproduce
import asyncio
from pyrit.converter import LetterBijectionConverter
async def main():
for fixed_size in (-1, -3, 27, True, 2.5):
try:
converter = LetterBijectionConverter(fixed_size=fixed_size, seed=1)
unchanged = sum(1 for k, v in converter.mapping.items() if k == v)
output = (await converter.convert_async(prompt="attack at dawn")).output_text
print(repr(fixed_size), "unchanged letters:", unchanged, "->", output)
except Exception as e:
print(repr(fixed_size), "->", type(e).__name__, e)
asyncio.run(main())
Expected Results
fixed_size must be an integer from 0 to 26 (both already used: fixed_size=0 shuffles every letter and fixed_size=26 is tested as the identity mapping). Anything else raises a ValueError naming fixed_size.
Actual Results
-1 unchanged letters: 26 -> attack at dawn
-3 unchanged letters: 24 -> attack at dawn
27 unchanged letters: 26 -> attack at dawn
True unchanged letters: 3 -> axxagu ax badp
2.5 -> TypeError slice indices must be integers or None or have an __index__ method
Screenshots
N/A
Versions
- OS: Windows 11
- Python version: 3.11.9
- PyRIT version: installed from main (ac196e57) in editable mode
- Lenguaje dominante
- Python
- Estrellas
- 4.7k
- Forks
- 980
- Merge medio
- 2 d 9 h
- PR fusionados (30 d)
- 422
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: Garak and ML-VLSU loaders still load one example when max_examples is 0 or negativePosiblemente ocupada @ShivamSharma43 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días
-
BUG: ComicJailbreak max_examples counts goals that render nothing, so templates=["code"] with max_examples=10 failsPosiblemente ocupada @ShivamSharma43 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 2 días
-
BUG: SeedDatasetFilter matches harm_categories, modalities and size case-sensitively, unlike tagsPosiblemente ocupada @ShivamSharma43 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 2 días
-
Conversation drawer shows the previous attack's conversations after switching attacksPosiblemente ocupada @ManoharPaturi la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/PyRIT#3575 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
Conversation draft turns permanently dirty when applied conversions match no piecePosiblemente ocupada @ManoharPaturi la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
microsoft/PyRIT#3573 · 1 asignado ·
Los mantenedores suelen responder en 2 días
Todos los issues de microsoft/PyRIT
Issues similares
-
component:benchmark
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
agentic-os-org/ANOLISA#9177 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
distrochooser/distrochooser#520 ·
Los mantenedores suelen responder en 2 días
-
Status: Needs confirmation Status: Needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
-
[BUG] Published Docker images lack the redis extra: HEADROOM_COMPRESS_SESSION_STORE stops startupPosiblemente ocupada @AlessandroSpallina la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
headroomlabs-ai/headroom#4513 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
codespell-project/codespell#4060 ·
Los mantenedores suelen responder en 1 día