Scenario progress double-counts an attack result after its timestamp is bumped
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 25/100
Línea de trabajo
Start in ScenarioProgressReadModel._hydrate_new_deltas_async, where each page is appended with entry.deltas.extend(page) and nothing is deduplicated by attack_result_id. Then read get_scenario_attack_result_deltas_async to see how the keyset cursor over (timestamp, id) re-emits bumped rows. A re-emitted delta should update the cached copy of that attempt, not add a second one. Linked PR #3184 is already open against this, so check it before starting.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
The scenario progress read model double-counts an attack result whose row timestamp is later bumped.
get_scenario_attack_result_deltas_async pages rows in ascending keyset order over (timestamp, id), so any row whose timestamp moves forward compares greater than the stored cursor and is emitted again. That happens today: AttackService.update_attack_async and remove_human_score_async write "timestamp": datetime.now(UTC) on every edit, and promote_attack_conversation rewrites timestamps too.
ScenarioProgressReadModel._hydrate_new_deltas_async handles each page with entry.deltas.extend(page) and no dedup by attack_result_id, so the re-emitted row is appended as a second copy of the same attempt. The snapshot's results then contains the same attack twice, which inflates per-unit attempt counts and retry pressure for the lifetime of the cache entry.
Steps/Code to Reproduce
- Poll
GET /scenarios/{id}/progressonce so the read model caches the run's deltas and cursor. - Edit any attack result that belongs to that scenario (for example
PUT /attacks/{attack_result_id}), which bumps the row's timestamp. - Poll the scenario progress endpoint again.
The storage feed re-emits the edited row (keyset timestamp > cursor), and the read model appends it again.
Minimal reproduction against the read model:
memory.get_scenario_attack_result_deltas_async = AsyncMock(
side_effect=[([delta], False), ([bumped_delta_with_same_id], False)]
)
read_model = ScenarioProgressReadModel(memory=memory)
first = await read_model.get_snapshot_async(scenario_result_id="run", ...)
second = await read_model.get_snapshot_async(scenario_result_id="run", ...)
# second.results holds the same attack_result_id twice
Expected Results
A re-emitted delta updates the already cached copy of that attempt instead of adding a second one.
Actual Results
The same attack result id appears twice in the snapshot results, inflating attempt counts.
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
-
FEAT: Support PDF and file inputs via `binary_path` in OpenAI chat and response targetsPosiblemente ocupada @PranavD2905 la tomó hoy. Abiertofeature-request help wanted
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
microsoft/PyRIT#3274 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
feature-request
Dificultad 5/5 Más de una semana Aptitud para principiantes 18/100
Los mantenedores suelen responder en 2 días
-
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 2 días
Todos los issues de microsoft/PyRIT
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
PolicyEngine/policyengine-us#10262 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
kellyjonbrazil/jc#788 ·
Los mantenedores suelen responder en 2 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
`/search.json` ignores the documented `editions.sort` parameterPosiblemente ocupada @PranavD2905 la tomó hoy. AbiertoAffects: Server Good First Issue Module: Solr Needs: Triage Theme: Public APIs Theme: Search
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
internetarchive/openlibrary#13989 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug P2: misleading query
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
jeffknupp/association#478 ·