Task retarget keeps the old host in task scope and adds the new host in a form that matches nothing
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 62/100
Línea de trabajo
El error está en RetargetTask en db/retarget.go, donde las líneas 147 y 154 escriben y eliminan filas de alcance de host a través de la columna value en lugar de domain. Empieza con la reproducción del issue y luego lee cómo ListTaskScope, ListUntestedAssets y declaredScopeFilter emparejan filas de subdomain por domain. Ejecuta TestRetargetTaskUpdatesGoalConstraintsScopeAndStopsStaleIntents con ARTEX_PG_DSN definido y añade una comprobación sobre la fila de alcance. Está terminado cuando una fila subdomain contiene el nuevo host en domain y list_untested_assets devuelve el nuevo host y no el antiguo.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
POST /api/tasks/{id}/retarget (db.RetargetTask, #623) is meant to replace the old host with the new one in task_scope. It reads and writes the wrong column.
Host scope rows (root_domain, subdomain) keep the host in task_scope.domain. value is only used by icp and keyword rows. RetargetTask:
- deletes
WHERE task_id=$1 AND LOWER(value)=$2, which never matches a host row, so the old host stays in the declared scope; - inserts
(kind='subdomain', value=newHost)withdomainNULL. The coverage queries matchsubdomainrows ona.domain = ts.domain, anddeclaredScopeFilteronly accepts auto rows under a declareddomain. That row matches no asset.
After a retarget, the coverage figure, list_untested_assets and the task's scope view still point at the old instance. Assets of the new instance are left out, and the new host is not a declared root, so its auto scope rows are filtered out as well.
Reproduce
Against a test database (ARTEX_PG_DSN set), in package server:
task, _ := m.CreateTaskWithOptions("rt", "Capture flags on https://old-0c3f.ctf.local/docs", db.TaskCreateOptions{})
tid := mustTaskID(t, task.ID)
m.Assets().AddAgentScope(tid, "subdomain", "old-0c3f.ctf.local", "seed", "manual")
s.RetargetTask(ctx, task.ID, "old-0c3f.ctf.local", "https://new-4791.ctf.local")
m.Assets().UpsertSubdomain(db.UpsertSubdomainReq{Domain: "new-4791.ctf.local", TaskID: tid})
m.Assets().UpsertSubdomain(db.UpsertSubdomainReq{Domain: "old-0c3f.ctf.local", TaskID: tid})
rows, _ := m.Assets().ListTaskScope(tid)
untested, _, _ := m.Assets().ListUntestedAssets(tid, task.ExpID, "", 50, 0)
Output on main (b8cd251):
scope row: kind=subdomain domain="old-0c3f.ctf.local" value=""
scope row: kind=subdomain domain="" value="new-4791.ctf.local"
untested: old-0c3f.ctf.local
Expected: one subdomain row with domain="new-4791.ctf.local", and list_untested_assets lists the new host, not the old one.
The existing TestRetargetTaskUpdatesGoalConstraintsScopeAndStopsStaleIntents seeds a scope row but does not check it after the retarget.
Cause
db/retarget.go:147 and db/retarget.go:154 use the value column for a host.
Version: main at b8cd251.
A tested fix is ready on branch chaitanya0305:fix/retarget-task-scope.
- Lenguaje dominante
- Go
- Estrellas
- 18.7k
- Forks
- 7k
- Merge medio
- 10 h 41 min
- PR fusionados (30 d)
- 342
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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 BaaRai/ARTEX
-
A finding reported with severity "High" is stored as-is, so it is missing from severity counts and min_severity channels drop itPosiblemente ocupada @chaitanya0305 la tomó hoy. Abiertobug P2
Dificultad 3/5 1-2 días Aptitud para principiantes 22/100
BaaRai/ARTEX#650 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
feature
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
BaaRai/ARTEX#648 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Stateful guard misreads curl flags: `curl -f` GET is refused, `--json` / `-d@file` / `-T` POSTs skip the leasePosiblemente ocupada @chaitanya0305 la tomó hoy. Abiertobug P1
Dificultad 2/5 1-3 horas Aptitud para principiantes 30/100
BaaRai/ARTEX#644 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
question
Dificultad 4/5 1-2 días Aptitud para principiantes 20/100
BaaRai/ARTEX#620 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
TrojanAbiertoquestion
Dificultad 2/5 1-3 horas Aptitud para principiantes 38/100
BaaRai/ARTEX#614 · 1 comentario · 2 reacciones ·
Los mantenedores suelen responder en 1 día
Todos los issues de BaaRai/ARTEX
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
compiler-explorer/compiler-explorer#9710 ·
Los mantenedores suelen responder en 1 día
-
Add govulncheck workflowAbiertoenhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
losisin/helm-values-schema-json#437 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
kubernetes-sigs/controller-runtime#3704 ·
Los mantenedores suelen responder en 1 día