Metadata filters crash on keys containing dots or other special characters
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 25/100
Línea de trabajo
The bug is in the metadata condition builders in pyrit/memory/sqlite_memory.py and pyrit/memory/azure_sql_memory.py, specifically _get_seed_metadata_conditions and _get_message_pieces_prompt_metadata_conditions, where the key is interpolated into the JSON path and the bind name. Read the label fix from #3063 for the pattern. PR #3180 is already open against this, so check it before starting. Done means a dotted key like a.b filters correctly in both backends.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
Filtering seeds or message pieces by a prompt_metadata key that contains a dot (or any character outside a plain SQL bind name, like a hyphen or a space) crashes the query instead of filtering.
In sqlite_memory.py and azure_sql_memory.py, _get_seed_metadata_conditions and _get_message_pieces_prompt_metadata_conditions build the SQL with the key interpolated into both the JSON path and the bind parameter name:
f"JSON_EXTRACT(prompt_metadata, '$.{key}') = :{key}"
For a key like a.b, SQLAlchemy parses :a.b as a parameter named a followed by literal text, so the later bindparams() call raises ArgumentError: This text() construct doesn't define a bound parameter named 'a.b'.
This is the same class of problem #3063 fixed for memory labels, where the accepted fix quotes the JSON path and uses indexed parameter names.
Steps/Code to Reproduce
import asyncio, tempfile
from pyrit.memory.sqlite_memory import SQLiteMemory
from pyrit.models import SeedPrompt
async def main():
memory = SQLiteMemory(db_path=tempfile.mktemp(suffix=".db"), verbose=False)
await memory.add_seeds_to_memory_async(seeds=[
SeedPrompt(value="dotted", data_type="text", dataset_name="t", metadata={"a.b": "v1"}),
], added_by="repro")
got = await memory.get_seeds_async(metadata={"a.b": "v1"}) # raises ArgumentError
print(got)
asyncio.run(main())
Expected Results
The filter matches the stored seed by the literal metadata key a.b and returns it.
Actual Results
sqlalchemy.exc.ArgumentError: This text() construct doesn't define a bound parameter named 'a.b'
Screenshots
N/A
Versions
OS: macOS
Python version: 3.14
PyRIT version: installed from main (66c41fa)
- Lenguaje dominante
- Python
- Estrellas
- 4.6k
- Forks
- 944
- Merge medio
- 2 d 18 h
- PR fusionados (30 d)
- 358
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: label queries only return the final conversation of an attackPosiblemente ocupada @u7k4rs6 la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
microsoft/PyRIT#3095 · 4 comentarios · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
BUG Configuration keeps runtime-status errors after polling recoversPosiblemente ocupada @joeyvictorino la tomó hace 6 días. AbiertoBug: triage GUI help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
microsoft/PyRIT#2868 · 6 comentarios ·
Los mantenedores suelen responder en 2 días
-
Crescendo backtracking keeps the refused prompt when the objective target made a tool callPosiblemente ocupada @RachelWanggg la tomó hace 1 día. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 30/100
Los mantenedores suelen responder en 2 días
-
BUG BinAsciiConverter UUencode output cannot be decoded when all words are convertedPosiblemente ocupada @barkha1research-ai la tomó hace 1 día. AbiertoBug: triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 25/100
Los mantenedores suelen responder en 2 días
-
FEAT Proposal: red-team decision models as targets (decision flip-rate testing)Posiblemente ocupada @shashank03-dev la tomó hace 1 día. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
microsoft/PyRIT#3246 · 2 comentarios ·
Los mantenedores suelen responder en 2 días
Todos los issues de microsoft/PyRIT
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
aws-samples/sample-per-model-bedrock#261 ·
Los mantenedores suelen responder en 1 día
-
[UI/Accessibility] Low contrast text visibility in country selection dropdown on settings pageAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
pwncollege/dojo#1188 ·
Los mantenedores suelen responder en 1 día
-
bug launcher packaging
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
tenstorrent/tt-studio#1426 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
python-attrs/cattrs#796 ·
Los mantenedores suelen responder en 1 día