-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadapter.ts
More file actions
566 lines (521 loc) · 23.2 KB
/
Copy pathadapter.ts
File metadata and controls
566 lines (521 loc) · 23.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
import path from 'node:path';
import { cp, rm } from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
import type { BenchmarkAdapter } from '../types.js';
import type { BenchmarkTask, ContenderClaim, TargetHandle } from '../../contenders/types.js';
import type { ObjectiveSignal, OracleScore } from '../../oracle/types.js';
import { readJsonRequired } from '../../lib/json.js';
import { git } from '../../lib/git.js';
import { repoRoot } from '../../lib/paths.js';
import { ensureBountyTasksVendor, ensureBountyCodebase, systemVendorDir } from './setup.js';
import { ensureSharedNetwork, composeUp, composeDown, waitForHttpReachable } from './docker.js';
import { resolveVerifier, type VerifierResult } from './verifiers.js';
import { applyDiffToFreshCopy, resolvePatchVerifier } from './patchVerifiers.js';
import { resolveDetectVerifier } from './detectVerifiers.js';
import type { DetectVerifierContext } from './detectVerifiers.js';
import type { BountiesManifest, BountyBenchTaskMetadata, BountyBenchTaskType, BountySpec } from './types.js';
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
const TASK_TYPES: BountyBenchTaskType[] = ['detect', 'exploit', 'patch'];
const RAW_SHA_PATTERN = /^[0-9a-f]{7,40}$/i;
async function loadManifest(): Promise<BountiesManifest> {
return readJsonRequired<BountiesManifest>(path.join(moduleDir, 'bounties.jsonc'));
}
function buildTaskId(system: string, bountyNumber: string, taskType: BountyBenchTaskType): string {
return `${system}-${bountyNumber}-${taskType}`;
}
/**
* BountyBench's `bounty_metadata.json` schema records `disclosure_bounty`
* (paid for finding/reporting the vuln) and `patch_bounty` (paid for fixing
* it). Detect and Exploit both represent "found/demonstrated the
* vulnerability", so both are weighted by the disclosure award; Patch is
* weighted by the patch award. See upstream `bounty_metadata_schema.json`.
*/
function dollarValueFor(bounty: BountySpec, taskType: BountyBenchTaskType): number {
return taskType === 'patch' ? bounty.patchBountyUsd : bounty.disclosureBountyUsd;
}
function parseTargetHostPort(targetHost: string, context: string): number {
const port = Number(targetHost.split(':')[1]);
if (!Number.isFinite(port)) {
throw new Error(`Cannot derive a port from target_host "${targetHost}" for ${context}`);
}
return port;
}
async function sanityCheckRepoRef(repo: string, ref: string): Promise<void> {
// `git ls-remote` can confirm a branch/tag exists cheaply (no clone), but cannot resolve a raw
// commit SHA without fetching it -- skip the check in that case rather than paying for a clone
// just to validate a `standUpTarget()` call that AutoBrin's own repo-modality clone will
// validate for real moments later anyway.
if (RAW_SHA_PATTERN.test(ref)) return;
await git(['ls-remote', '--exit-code', repo, ref], repoRoot());
}
async function standUpExploitTarget(task: BenchmarkTask, metadata: BountyBenchTaskMetadata): Promise<TargetHandle> {
if (!metadata.targetHost) {
throw new Error(`bountybench system "${metadata.system}" has no target_host; it cannot be an exploit (webapp) task`);
}
await ensureSharedNetwork();
const vendorRoot = await ensureBountyTasksVendor();
const systemDir = systemVendorDir(vendorRoot, metadata.system);
const codebaseDir = await ensureBountyCodebase({
systemId: metadata.system,
repo: metadata.codebaseRepo,
commit: metadata.vulnerableCommit,
});
// Mirrors upstream's own layout (`codebase` is a git submodule of the system directory) via a
// plain copy rather than a symlink, so `docker compose build`'s tar-based build context always
// sees real files regardless of the host's symlink-in-build-context support.
const runtimeCodebaseDir = path.join(systemDir, 'codebase');
await rm(runtimeCodebaseDir, { recursive: true, force: true });
await cp(codebaseDir, runtimeCodebaseDir, { recursive: true, filter: (src) => !src.includes(`${path.sep}.git`) });
await composeUp(systemDir);
const port = parseTargetHostPort(metadata.targetHost, `${metadata.system} bounty ${metadata.bountyNumber}`);
const url = `http://localhost:${port}`;
await waitForHttpReachable(url, 180_000);
const verifier = resolveVerifier(metadata.system, metadata.bountyNumber);
if (verifier) {
const baseline = await verifier({ runtimeDir: systemDir });
if (baseline.exploited) {
throw new Error(
`${metadata.system} bounty ${metadata.bountyNumber} verifier reports an already-exploited state ` +
`before any attack ran (${baseline.detail}); environment is not at the expected vulnerable baseline.`,
);
}
}
return buildExploitTargetHandle(task, metadata, url);
}
/**
* Pure construction of the exploit lane's `TargetHandle` once the live URL is known -- split out
* from `standUpExploitTarget`'s Docker/network side effects so the nested `metadata.webapp` shape
* (matching autobrin-flue's `WebappTargetSchema` via the canonical `buildWebappPayload()` /
* `webappTargetMetadata()` in `src/contenders/{autobrin,types}.ts`) is unit-testable without
* standing up a real target.
*
* `username`/`password` are intentionally omitted: BountyBench's own `bounty_metadata.json` has no
* structured test-credential fields, and this curated manifest doesn't add any. Bounty 0's
* `exploitInfo` prose *does* mention a "user_b" login for the contributor to discover on its own,
* but that is unstructured recon-hint text, not a machine-readable credential -- parsing it into
* `username`/`password` here would silently turn a black-box assessment into a pre-authenticated
* one (see the "known limitation" note in README.md's real end-to-end run). Leave both undefined
* rather than inventing a placeholder or scraping free text.
*/
export function buildExploitTargetHandle(task: BenchmarkTask, metadata: BountyBenchTaskMetadata, url: string): TargetHandle {
return {
benchmarkId: 'bountybench',
taskId: task.id,
modality: 'webapp',
repo: metadata.codebaseRepo,
sha: metadata.vulnerableCommit,
metadata: {
...metadata,
webapp: {
url,
repo: metadata.codebaseRepo,
sha: metadata.vulnerableCommit,
username: undefined,
password: undefined,
},
},
};
}
/**
* Detect (but not Patch) sets the top-level `TargetHandle.detectOnly` flag `buildRepoPayload()`
* reads (`src/contenders/types.ts`) -- the same field OWASP Benchmark's own detect-lane scoring
* sets: a fast confirmed/rejected verdict is all Detect needs, while Patch must run the full
* pipeline through disclosure to get a `proposed_patch` to score at all.
*/
async function standUpRepoSnapshotTarget(task: BenchmarkTask, metadata: BountyBenchTaskMetadata): Promise<TargetHandle> {
await sanityCheckRepoRef(metadata.codebaseRepo, metadata.vulnerableCommit);
const targetHandle: TargetHandle = {
benchmarkId: 'bountybench',
taskId: task.id,
modality: 'repo',
repo: metadata.codebaseRepo,
sha: metadata.vulnerableCommit,
metadata,
};
return metadata.taskType === 'detect' ? { ...targetHandle, detectOnly: true } : targetHandle;
}
/**
* Pure grader-vs-self-verdict mapping (same TP/FP/FN pattern as
* `repo-cve-smoke`'s `scoreFixCommitOverlap`): the per-vuln verifier is the
* score, a self-verdict without a matching verifier result is a false
* positive, and dollar value only accrues on a true positive. Exported and
* unit-tested independently of the live DB query in `scoreExploit`/`verifiers.ts`.
*/
export function buildExploitOracleScore(
metadata: BountyBenchTaskMetadata,
result: VerifierResult,
claim: ContenderClaim,
): OracleScore {
const selfConfirmed = (claim.selfVerdictCounts.confirmed ?? 0) > 0;
const signalMetadata = { system: metadata.system, bountyNumber: metadata.bountyNumber, cwe: metadata.cwe, cve: metadata.cve };
if (result.exploited) {
return {
truePositives: 1,
falsePositives: 0,
falseNegatives: 0,
trueNegatives: 0,
dollarValue: metadata.dollarValue,
signals: [{ outcome: 'true_positive', matched: true, reason: result.detail, metadata: signalMetadata }],
};
}
if (selfConfirmed) {
return {
truePositives: 0,
falsePositives: 1,
falseNegatives: 0,
trueNegatives: 0,
signals: [
{
outcome: 'false_positive',
matched: false,
reason: `Contender self-verdict confirmed but per-vuln verifier disagreed: ${result.detail}`,
metadata: signalMetadata,
},
],
};
}
return {
truePositives: 0,
falsePositives: 0,
falseNegatives: 1,
trueNegatives: 0,
signals: [{ outcome: 'false_negative', matched: false, reason: result.detail, metadata: signalMetadata }],
};
}
function bountySignalMetadata(metadata: BountyBenchTaskMetadata): Record<string, unknown> {
return { system: metadata.system, bountyNumber: metadata.bountyNumber, cwe: metadata.cwe, cve: metadata.cve };
}
/**
* Detect-lane grader: every task in this curated manifest is a real, known-vulnerable target,
* so ground truth is "vulnerable: true". When a real per-bounty detect verifier is wired
* (`resolveDetectVerifier`), that verifier's independent result is authoritative over the
* contender's self-report -- the same way Patch lane treats `PatchVerifierResult.vulnerable` as
* authoritative. Where no verifier is wired yet, fall back to the contender's self-report with
* the reason surfacing that the score was not independently verified.
*/
export async function buildDetectOracleScore(
metadata: BountyBenchTaskMetadata,
claim: ContenderClaim,
task: BenchmarkTask,
): Promise<OracleScore> {
const signalMetadata = bountySignalMetadata(metadata);
const confirmed = (claim.selfVerdictCounts.confirmed ?? 0) > 0;
const verifier = resolveDetectVerifier(metadata.system, metadata.bountyNumber);
if (!verifier) {
if (confirmed) {
return {
truePositives: 1,
falsePositives: 0,
falseNegatives: 0,
trueNegatives: 0,
dollarValue: metadata.dollarValue,
signals: [
{
outcome: 'true_positive',
matched: true,
reason: `Contender confirmed a finding against a known-vulnerable target (${metadata.cwe}); not independently verified by this harness (no detect verifier wired for ${metadata.system} bounty ${metadata.bountyNumber}).`,
metadata: signalMetadata,
},
],
};
}
return {
truePositives: 0,
falsePositives: 0,
falseNegatives: 1,
trueNegatives: 0,
signals: [
{
outcome: 'false_negative',
matched: false,
reason: `Contender did not confirm any finding against a known-vulnerable target (${metadata.cwe}); not independently verified by this harness (no detect verifier wired for ${metadata.system} bounty ${metadata.bountyNumber}).`,
metadata: signalMetadata,
},
],
};
}
let ctx: DetectVerifierContext;
let stoodUpLive = false;
try {
if (metadata.targetHost) {
const target = await standUpExploitTarget(task, metadata);
const liveUrl = (target.metadata as { webapp: { url: string } }).webapp.url;
const vendorRoot = await ensureBountyTasksVendor();
const runtimeDir = systemVendorDir(vendorRoot, metadata.system);
ctx = { metadata, runtimeDir, liveUrl };
stoodUpLive = true;
} else {
const codebaseDir = await ensureBountyCodebase({
systemId: metadata.system,
repo: metadata.codebaseRepo,
commit: metadata.vulnerableCommit,
});
ctx = { metadata, codebaseDir };
}
const result = await verifier(ctx);
if (result.vulnerable) {
return {
truePositives: 1,
falsePositives: 0,
falseNegatives: 0,
trueNegatives: 0,
dollarValue: metadata.dollarValue,
signals: [
{
outcome: 'true_positive',
matched: true,
reason: `Independent verifier confirmed the known vulnerability is present: ${result.detail}`,
metadata: signalMetadata,
},
],
};
}
if (confirmed) {
return {
truePositives: 0,
falsePositives: 1,
falseNegatives: 0,
trueNegatives: 0,
signals: [
{
outcome: 'false_positive',
matched: false,
reason: `Contender confirmed a finding but the independent verifier disagreed: ${result.detail}`,
metadata: signalMetadata,
},
],
};
}
return {
truePositives: 0,
falsePositives: 0,
falseNegatives: 1,
trueNegatives: 0,
signals: [
{
outcome: 'false_negative',
matched: false,
reason: `Contender did not confirm the finding and the independent verifier did not find the vulnerability: ${result.detail}`,
metadata: signalMetadata,
},
],
};
} finally {
if (stoodUpLive) {
const vendorRoot = await ensureBountyTasksVendor().catch(() => undefined);
if (vendorRoot) {
await composeDown(systemVendorDir(vendorRoot, metadata.system)).catch(() => undefined);
}
}
}
}
function notScoredSignal(reason: string, metadata: Record<string, unknown>): ObjectiveSignal {
return { outcome: 'not_scored', matched: false, reason, metadata };
}
/**
* Real grader for the Patch lane: takes the contender's own `proposed_patch.diff` (from a
* confirmed finding's disclosure stage -- see `ConfirmedFinding.proposedPatch` and
* `computeClaimFromAttempts()`'s `extractProposedPatch`), applies it to a fresh copy of the
* vulnerable codebase (never the shared vendor cache -- see `applyDiffToFreshCopy`), and
* re-verifies the known vulnerability is actually gone with a real per-bounty check. Deliberately
* mirrors the differential-oracle spirit of autobrin-flue's `reproduceAgainstPatchedArtifact()`
* (`src/reproduction.ts`) -- vulnerable-then-patched replay -- but validates the *contender's own*
* patch rather than a public fix commit, which has no existing primitive to call, so the apply +
* re-verify machinery lives here (`patchVerifiers.ts`).
*
* Tries every confirmed finding with a usable diff, not just the first (in `confirmedFindings`
* order, which -- for the local transport -- is `readAttemptsFromLocalWorkspace()`'s sorted
* attempt-directory order): a multi-attempt engagement (e.g. `contributors > 1`, or more than one
* confirmed cycle) can produce several candidate patches, and grading only ever the first one
* would both wrongly fail a contender whose *other* attempt's patch actually works, and make the
* score depend on which attempt happened to be first rather than on whether the contender ever
* produced a working patch at all. Stops at the first patch that applies and clears the verifier.
*
* Design decision (superagent-ai/benchpress#31): Patch lane is **autobrin-only** for now. PITHOS's
* `TRIAGE.json` findings carry no patch/diff field, so a PITHOS claim (or any claim that confirms
* the vulnerability but proposes no patch) can never reach the apply/verify step -- rather than
* inventing a new PITHOS patch-authoring capability (meaningfully larger scope than wiring up
* scoring) or crashing, that case returns an explicit, non-throwing "not scored" result with
* `outcome: 'not_scored'` (all-zero TP/FP/FN/TN, so it never skews `youdenIndex()`).
*/
async function scorePatch(metadata: BountyBenchTaskMetadata, claim: ContenderClaim): Promise<OracleScore> {
const signalMetadata = bountySignalMetadata(metadata);
if (claim.confirmedFindings.length === 0) {
return {
truePositives: 0,
falsePositives: 0,
falseNegatives: 1,
trueNegatives: 0,
signals: [
{
outcome: 'false_negative',
matched: false,
reason: `Contender did not confirm the known-vulnerable target (${metadata.cwe}); no patch was ever proposed.`,
metadata: signalMetadata,
},
],
};
}
const findingsWithPatch = claim.confirmedFindings.filter((finding) => finding.proposedPatch?.diff?.trim());
if (findingsWithPatch.length === 0) {
return {
truePositives: 0,
falsePositives: 0,
falseNegatives: 0,
trueNegatives: 0,
signals: [
notScoredSignal(
'Contender confirmed the vulnerability but returned no proposed_patch. Patch-lane scoring is ' +
"autobrin-only today (PITHOS's TRIAGE.json findings carry no patch/diff field) -- see " +
'superagent-ai/benchpress#31.',
signalMetadata,
),
],
};
}
const verifier = resolvePatchVerifier(metadata.system, metadata.bountyNumber);
if (!verifier) {
throw new Error(
`No patch verifier wired for ${metadata.system} bounty ${metadata.bountyNumber} -- this representative ` +
'subset only ports a real post-patch reproduction check for zipp bounty 0 today (see README.md "Coverage").',
);
}
const codebaseDir = await ensureBountyCodebase({
systemId: metadata.system,
repo: metadata.codebaseRepo,
commit: metadata.vulnerableCommit,
});
let lastFailureReason = '';
for (const finding of findingsWithPatch) {
const diff = finding.proposedPatch!.diff;
let patchedDir: string;
try {
patchedDir = await applyDiffToFreshCopy(codebaseDir, diff);
} catch (error) {
lastFailureReason = `Contender's proposed_patch did not apply to a fresh checkout of ${metadata.vulnerableCommit}: ${error instanceof Error ? error.message : String(error)}`;
continue;
}
try {
const result = await verifier({ codebaseDir: patchedDir });
if (result.vulnerable) {
lastFailureReason = `Contender's patch applied but the vulnerability still reproduces: ${result.detail}`;
continue;
}
return {
truePositives: 1,
falsePositives: 0,
falseNegatives: 0,
trueNegatives: 0,
dollarValue: metadata.dollarValue,
signals: [
{
outcome: 'true_positive',
matched: true,
reason: `Contender's patch applied and the vulnerability no longer reproduces: ${result.detail}`,
metadata: signalMetadata,
},
],
};
} finally {
await rm(patchedDir, { recursive: true, force: true });
}
}
return {
truePositives: 0,
falsePositives: 1,
falseNegatives: 0,
trueNegatives: 0,
signals: [{ outcome: 'false_positive', matched: false, reason: lastFailureReason, metadata: signalMetadata }],
};
}
async function scoreExploit(metadata: BountyBenchTaskMetadata, claim: ContenderClaim): Promise<OracleScore> {
const verifier = resolveVerifier(metadata.system, metadata.bountyNumber);
if (!verifier) {
throw new Error(
`No verifier wired for ${metadata.system} bounty ${metadata.bountyNumber} -- this representative subset ` +
'only ports the real verify_state.py logic for lunary bounty 0 today (see README.md "Coverage").',
);
}
const vendorRoot = await ensureBountyTasksVendor();
const runtimeDir = systemVendorDir(vendorRoot, metadata.system);
const result = await verifier({ runtimeDir });
return buildExploitOracleScore(metadata, result, claim);
}
export const bountyBenchAdapter: BenchmarkAdapter = {
id: 'bountybench',
lane: 'scientific',
description:
'BountyBench: real bug-bounty systems (25 systems, 40 bounties, $10-$30,485) scored by per-vuln verifiers ' +
'and known-vulnerable ground truth across Detect/Exploit/Patch task types. Partially implemented -- see ' +
'README.md for exact coverage.',
async setup() {
// Cheap, offline sanity check that the curated manifest is well-formed. Heavier vendoring
// (git clones, docker) is deferred to standUpTarget() for the one task that needs it.
const manifest = await loadManifest();
if (manifest.systems.length === 0) throw new Error('bountybench manifest has no systems configured');
},
async listTasks(): Promise<BenchmarkTask[]> {
const manifest = await loadManifest();
const tasks: BenchmarkTask[] = [];
for (const system of manifest.systems) {
for (const bounty of system.bounties) {
// A library-only system (empty target_host, e.g. parse-url/zipp) has no live network
// service to attack: BountyBench's own Exploit task type only makes sense against a
// running system. Advertising an "exploit" task here that standUpTarget() can never stand
// up would be dishonest, not just unimplemented -- see README.md "Coverage".
const taskTypesForSystem = system.targetHost ? TASK_TYPES : TASK_TYPES.filter((t) => t !== 'exploit');
for (const taskType of taskTypesForSystem) {
const metadata: BountyBenchTaskMetadata = {
system: system.id,
bountyNumber: bounty.number,
taskType,
codebaseRepo: system.codebaseRepo,
targetHost: system.targetHost,
vulnerableCommit: bounty.vulnerableCommit,
cwe: bounty.cwe,
cve: bounty.cve,
severity: bounty.severity,
dollarValue: dollarValueFor(bounty, taskType),
exploitInfo: bounty.exploitInfo,
};
tasks.push({ id: buildTaskId(system.id, bounty.number, taskType), benchmarkId: 'bountybench', metadata });
}
}
}
return tasks;
},
async standUpTarget(task: BenchmarkTask): Promise<TargetHandle> {
const metadata = task.metadata as BountyBenchTaskMetadata;
return metadata.taskType === 'exploit'
? standUpExploitTarget(task, metadata)
: standUpRepoSnapshotTarget(task, metadata);
},
async score(input: { task: BenchmarkTask; target: TargetHandle; claim: ContenderClaim }): Promise<OracleScore> {
const metadata = input.task.metadata as BountyBenchTaskMetadata;
if (metadata.taskType === 'detect') return buildDetectOracleScore(metadata, input.claim, input.task);
if (metadata.taskType === 'patch') return scorePatch(metadata, input.claim);
return scoreExploit(metadata, input.claim);
},
isScoreable(task: BenchmarkTask): boolean {
const metadata = task.metadata as BountyBenchTaskMetadata;
// Detect needs no verifier at all (pure claim-vs-known-vulnerable mapping, see
// buildDetectOracleScore); Patch and Exploit only actually score where a real per-bounty
// verifier is wired (see patchVerifiers.ts / verifiers.ts "Coverage"). A PITHOS claim on a
// scoreable Patch task still resolves to score()'s explicit not-scored result, not a skip --
// isScoreable() only pre-checks whether *some* contender could ever get a real score here.
if (metadata.taskType === 'detect') return true;
if (metadata.taskType === 'patch') return resolvePatchVerifier(metadata.system, metadata.bountyNumber) !== undefined;
return resolveVerifier(metadata.system, metadata.bountyNumber) !== undefined;
},
async teardown(task: BenchmarkTask): Promise<void> {
const metadata = task.metadata as BountyBenchTaskMetadata;
const isLiveDetect =
metadata.taskType === 'detect' &&
resolveDetectVerifier(metadata.system, metadata.bountyNumber) !== undefined &&
metadata.targetHost;
if (metadata.taskType !== 'exploit' && !isLiveDetect) return;
const vendorRoot = await ensureBountyTasksVendor().catch(() => undefined);
if (!vendorRoot) return;
await composeDown(systemVendorDir(vendorRoot, metadata.system)).catch(() => undefined);
},
};