Task retarget keeps the old host in task scope and adds the new host in a form that matches nothing
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 62/100
調査の方向性
バグは db/retarget.go の RetargetTask にあり、147行目と154行目でホストのスコープ行を domain ではなく value 列を通じて書き込み、削除しています。まず issue の再現手順から始め、次に ListTaskScope、ListUntestedAssets、declaredScopeFilter が subdomain 行を domain でどのように照合しているかを読んでください。ARTEX_PG_DSN を設定した状態で TestRetargetTaskUpdatesGoalConstraintsScopeAndStopsStaleIntents を実行し、スコープ行に対するチェックを追加してください。1つの subdomain 行が新しいホストを domain に保持し、list_untested_assets が古いホストではなく新しいホストを返せば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Go
- スター
- 18.7k
- フォーク
- 7k
- 平均マージ
- 10時間 41分
- マージ済み PR(30日)
- 342
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
BaaRai/ARTEX のほかの issue
-
A finding reported with severity "High" is stored as-is, so it is missing from severity counts and min_severity channels drop it対応中かも @chaitanya0305 が今日担当しました。 オープンbug P2
難易度 3/5 1〜2日 初心者へのやさしさ 22/100
BaaRai/ARTEX#650 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
feature
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
BaaRai/ARTEX#648 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Stateful guard misreads curl flags: `curl -f` GET is refused, `--json` / `-d@file` / `-T` POSTs skip the lease対応中かも @chaitanya0305 が今日担当しました。 オープンbug P1
難易度 2/5 1〜3時間 初心者へのやさしさ 30/100
BaaRai/ARTEX#644 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
question
難易度 4/5 1〜2日 初心者へのやさしさ 20/100
BaaRai/ARTEX#620 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Trojanオープンquestion
難易度 2/5 1〜3時間 初心者へのやさしさ 38/100
BaaRai/ARTEX#614 · コメント 1 件 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
compiler-explorer/compiler-explorer#9710 ·
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
losisin/helm-values-schema-json#437 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
kubernetes-sigs/controller-runtime#3704 ·
メンテナーはふだん 1 日以内に返信