@pensar/apex 2.6.1 → 2.7.0-canary.21cb83dc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/{agent-yby11zaq.js → agent-68t2wzmc.js} +6 -6
- package/build/agent-jhekpern.js +13 -0
- package/build/{agent-ayreaj6z.js → agent-qvreg8a4.js} +5 -5
- package/build/{agent-runs-g37vkrjr.js → agent-runs-30dvbvmm.js} +18 -18
- package/build/agent-vybw255f.js +13 -0
- package/build/{apps-xn6km9yn.js → apps-na0y0992.js} +13 -13
- package/build/{auth-d105wc64.js → auth-dz2c5thx.js} +13 -13
- package/build/{blackboxAgent-s56sgx9b.js → blackboxAgent-2mwvaajb.js} +6 -6
- package/build/{blackboxPentest-ps78v3w7.js → blackboxPentest-s2mfze9p.js} +17 -12
- package/build/{cli-kb21qhvm.js → cli-1pmfnz1a.js} +4 -3
- package/build/{cli-ae8jqxqr.js → cli-563yntrb.js} +2 -2
- package/build/{cli-7eea4e2y.js → cli-5ab346kd.js} +6 -6
- package/build/{cli-1ve18npr.js → cli-72y76bpg.js} +3 -2
- package/build/{cli-fy6vh2a7.js → cli-98wmmphf.js} +1 -1
- package/build/{cli-c05y640n.js → cli-9jscnhtg.js} +1 -1
- package/build/{cli-3sp6nd8d.js → cli-9kk9tm58.js} +2 -2
- package/build/{cli-d37a42dc.js → cli-9pz9wjt2.js} +101 -18
- package/build/{cli-dpsw2fe6.js → cli-a6x4jm5a.js} +476 -193
- package/build/{cli-az3xq70v.js → cli-cfrdr25z.js} +1 -1
- package/build/{cli-ngq9dr8n.js → cli-fdrrbb9p.js} +3 -3
- package/build/{cli-k2nwxta0.js → cli-t09zj814.js} +2 -2
- package/build/{cli-qgz1q9g5.js → cli-t4q4t4dx.js} +223 -76
- package/build/{cli-xtc2t6me.js → cli-vdd1s3x9.js} +103 -39
- package/build/{cli-gx71jcke.js → cli-vn4cwac3.js} +1 -1
- package/build/{cli-65g6rcat.js → cli-w9nw2a4z.js} +1 -1
- package/build/{cli-n2en7j5b.js → cli-z7ysyrr4.js} +1 -1
- package/build/{cli-709rvekb.js → cli-zbbtr4sb.js} +4 -2
- package/build/cli.js +70 -40
- package/build/{config-zpqkd5cz.js → config-nkzm9arw.js} +1 -1
- package/build/{fastStrike-mcjdvwez.js → fastStrike-16jw1s61.js} +67 -15
- package/build/{fixes-kytx5dmj.js → fixes-6wxk22v5.js} +13 -13
- package/build/{index-4vqdgb42.js → index-36p56pcf.js} +1473 -1217
- package/build/{index-je6hcsqr.js → index-6nejymsc.js} +1 -1
- package/build/{index-fv64eb32.js → index-asm4y7e4.js} +2 -2
- package/build/{index-n65z6v7b.js → index-bfmn52za.js} +6 -6
- package/build/{index-qv4cc65p.js → index-bt4r13q7.js} +13 -13
- package/build/{index-dr3tg1w3.js → index-gfq1rp1q.js} +1 -1
- package/build/{index-wqetp6gq.js → index-j9pxgrzd.js} +12 -7
- package/build/{index-r9yjkfrv.js → index-n9kapn1x.js} +4 -4
- package/build/{index-ns4m4s01.js → index-tr6evhyg.js} +4 -4
- package/build/{issues-eb3q9d3a.js → issues-7rmf4ker.js} +13 -13
- package/build/{knowledge-fqsvtx0f.js → knowledge-s2sxh8nb.js} +13 -13
- package/build/lib/{chunk-1azdancq.js → chunk-0dnx79b1.js} +1 -1
- package/build/lib/{chunk-4hwzqthr.js → chunk-161ak2am.js} +3 -2
- package/build/lib/{chunk-z137x08b.js → chunk-1rqbhx4b.js} +7 -5
- package/build/lib/{chunk-1yct6cra.js → chunk-3hjvdf67.js} +1 -1
- package/build/lib/{chunk-r2dkp4tb.js → chunk-5j8pp0xf.js} +1 -1
- package/build/lib/{chunk-3c00n0cy.js → chunk-77se1d35.js} +8 -3
- package/build/lib/{chunk-yrnrbjes.js → chunk-7tft4b8b.js} +4 -2
- package/build/lib/{chunk-w66ce82a.js → chunk-8njjwwcw.js} +4 -2
- package/build/lib/{chunk-v3dk9j7k.js → chunk-aq9eyxas.js} +80 -21
- package/build/lib/{chunk-9tt2021m.js → chunk-d05cvnv8.js} +9 -9
- package/build/lib/{chunk-e8yy2k73.js → chunk-f3sq4896.js} +28 -2
- package/build/lib/{chunk-1fy8azee.js → chunk-fasqtjq1.js} +1 -1
- package/build/lib/{chunk-1jvwqnem.js → chunk-gm3b9j4y.js} +104 -40
- package/build/lib/{chunk-r4j8ybn9.js → chunk-hys7nemr.js} +87 -36
- package/build/lib/{chunk-7pwa92rn.js → chunk-j9668h16.js} +1 -1
- package/build/lib/{chunk-ba41jh41.js → chunk-kcw4cpr3.js} +418 -133
- package/build/lib/{chunk-z96pbjhd.js → chunk-m4swxy5r.js} +13 -6
- package/build/lib/{chunk-xhdpgpkm.js → chunk-mbsde9d0.js} +2 -2
- package/build/lib/{chunk-9yksqgzr.js → chunk-mpvjfvz0.js} +20 -13
- package/build/lib/{chunk-2qsq76xq.js → chunk-qkz5sm0d.js} +128 -34
- package/build/lib/{chunk-nhfax4gb.js → chunk-rfyjqybp.js} +1 -1
- package/build/lib/{chunk-mg03jdmt.js → chunk-vsnwzne5.js} +1 -1
- package/build/lib/{chunk-acgbyf5h.js → chunk-ydxhkgjw.js} +3 -2
- package/build/lib/{chunk-bb0ekhkw.js → chunk-z8kej0sp.js} +69 -18
- package/build/lib/core/agents/agentRuntime.d.ts +2 -1
- package/build/lib/core/agents/defineAgent.d.ts +3 -2
- package/build/lib/core/agents/offSecAgent/index.d.ts +3 -1
- package/build/lib/core/agents/offSecAgent/index.js +10 -8
- package/build/lib/core/agents/offSecAgent/prompt.d.ts +3 -1
- package/build/lib/core/agents/offSecAgent/subagentSpawner.d.ts +2 -1
- package/build/lib/core/agents/offSecAgent/subagentSpawner.js +5 -5
- package/build/lib/core/agents/offSecAgent/tools/index.js +4 -4
- package/build/lib/core/agents/offSecAgent/tools/listMemories.d.ts +11 -1
- package/build/lib/core/agents/offSecAgent/tools/reportError.d.ts +2 -1
- package/build/lib/core/agents/offSecAgent/tools/runPentestWorkflow.d.ts +20 -1
- package/build/lib/core/agents/offSecAgent/tools/spawnPentestAgent.d.ts +4 -7
- package/build/lib/core/agents/offSecAgent/tools/spawnPentestSwarm.d.ts +7 -1
- package/build/lib/core/agents/offSecAgent/tools/types.d.ts +2 -1
- package/build/lib/core/agents/offSecAgent/types.d.ts +7 -1
- package/build/lib/core/agents/specialized/attackSurface/blackboxAgent.js +9 -9
- package/build/lib/core/agents/specialized/attackSurface/schemas.js +9 -9
- package/build/lib/core/agents/specialized/authenticationAgent/index.js +10 -10
- package/build/lib/core/agents/specialized/codeAgent/agent.js +9 -9
- package/build/lib/core/agents/specialized/codeAgent/prompts.d.ts +1 -0
- package/build/lib/core/agents/specialized/findingJudge/agent.js +8 -8
- package/build/lib/core/agents/specialized/findingJudge/index.js +3 -3
- package/build/lib/core/agents/specialized/patching/index.js +10 -10
- package/build/lib/core/agents/specialized/pentest/agent.d.ts +18 -4
- package/build/lib/core/agents/specialized/pentest/agent.js +11 -9
- package/build/lib/core/agents/specialized/whiteboxAttackSurface/index.js +9 -9
- package/build/lib/core/ai/ai.d.ts +23 -6
- package/build/lib/core/ai/ai.js +2 -2
- package/build/lib/core/ai/index.js +2 -2
- package/build/lib/core/ai/models/claude-capabilities.d.ts +3 -2
- package/build/lib/core/ai/models/concentrate.d.ts +1 -0
- package/build/lib/core/ai/models/index.d.ts +1 -1
- package/build/lib/core/ai/providers/concentrate.d.ts +1 -0
- package/build/lib/core/ai/utils.d.ts +2 -0
- package/build/lib/core/ai/utils.js +4 -2
- package/build/lib/core/api/index.d.ts +3 -0
- package/build/lib/core/api/index.js +22 -19
- package/build/lib/core/api/targetedPentest.d.ts +1 -0
- package/build/lib/core/api/targetedPentest.js +10 -10
- package/build/lib/core/config/config.d.ts +3 -0
- package/build/lib/core/config/index.js +1 -1
- package/build/lib/core/findings/registry.js +3 -3
- package/build/lib/core/session/index.d.ts +12 -0
- package/build/lib/core/session/index.js +2 -2
- package/build/lib/core/session/persistence.d.ts +7 -0
- package/build/lib/core/session/persistence.js +7 -3
- package/build/lib/core/workflows/fastStrike.d.ts +3 -1
- package/build/lib/core/workflows/pentest.d.ts +8 -1
- package/build/lib/core/workflows/pentest.js +15 -15
- package/build/lib/core/workflows/seams.js +4 -4
- package/build/lib/core/workflows/whiteboxAttackSurface.js +11 -11
- package/build/lib/index.js +22 -22
- package/build/{logs-x62b7hk1.js → logs-70fyr848.js} +13 -13
- package/build/{native-rollout-evidence-c9yhfqcs.js → native-rollout-evidence-ntensvzb.js} +3 -3
- package/build/{offesecAgent-5whnpeta.js → offesecAgent-kk62tf60.js} +4 -4
- package/build/pentest-4jgznn7h.js +22 -0
- package/build/{pentests-e0f32aqx.js → pentests-3e41hj08.js} +13 -13
- package/build/recordedRunClient-w34kcch1.js +11 -0
- package/build/{targetedPentest-rcbs4nvp.js → targetedPentest-t9snxcj2.js} +18 -11
- package/build/{targets-xj9g3q0z.js → targets-1pyf21c7.js} +13 -13
- package/build/threatModel-48y5qjze.js +21 -0
- package/build/{uninstall-7s784q4a.js → uninstall-fbydd9t6.js} +1 -1
- package/build/{upload-4gvhwmvr.js → upload-sbhwe2fq.js} +4 -4
- package/build/{utils-cjrz64pc.js → utils-23903gcj.js} +3 -3
- package/package.json +1 -1
- package/src/cli.ts +48 -14
- package/src/core/agents/agentRuntime.test.ts +38 -0
- package/src/core/agents/agentRuntime.ts +5 -2
- package/src/core/agents/defineAgent.ts +3 -1
- package/src/core/agents/offSecAgent/index.ts +3 -0
- package/src/core/agents/offSecAgent/offensiveSecurityAgent.test.ts +92 -5
- package/src/core/agents/offSecAgent/offensiveSecurityAgent.ts +70 -31
- package/src/core/agents/offSecAgent/prompt.test.ts +46 -0
- package/src/core/agents/offSecAgent/prompt.ts +52 -8
- package/src/core/agents/offSecAgent/selectiveConstruction.publicPath.test.ts +38 -0
- package/src/core/agents/offSecAgent/selectiveConstruction.test.ts +64 -0
- package/src/core/agents/offSecAgent/subagentSpawner.ts +12 -1
- package/src/core/agents/offSecAgent/tools/delegateAuth.ts +1 -0
- package/src/core/agents/offSecAgent/tools/listMemories.test.ts +230 -0
- package/src/core/agents/offSecAgent/tools/listMemories.ts +73 -6
- package/src/core/agents/offSecAgent/tools/reportError.test.ts +6 -0
- package/src/core/agents/offSecAgent/tools/reportError.ts +10 -2
- package/src/core/agents/offSecAgent/tools/runAttackSurface.ts +2 -0
- package/src/core/agents/offSecAgent/tools/runPentestWorkflow.test.ts +57 -0
- package/src/core/agents/offSecAgent/tools/runPentestWorkflow.ts +19 -1
- package/src/core/agents/offSecAgent/tools/runWhiteboxScan.ts +5 -2
- package/src/core/agents/offSecAgent/tools/spawnCodingAgent.ts +1 -0
- package/src/core/agents/offSecAgent/tools/spawnPentestAgent.test.ts +72 -2
- package/src/core/agents/offSecAgent/tools/spawnPentestAgent.ts +32 -11
- package/src/core/agents/offSecAgent/tools/spawnPentestSwarm.ts +25 -5
- package/src/core/agents/offSecAgent/tools/threatModelGenerator.ts +1 -0
- package/src/core/agents/offSecAgent/tools/types.ts +6 -1
- package/src/core/agents/offSecAgent/tools/updateTask.ts +5 -1
- package/src/core/agents/offSecAgent/tools/whiteboxCandidates.ts +11 -4
- package/src/core/agents/offSecAgent/types.ts +9 -0
- package/src/core/agents/specialized/codeAgent/agent.test.ts +7 -0
- package/src/core/agents/specialized/codeAgent/agent.ts +9 -2
- package/src/core/agents/specialized/codeAgent/prompts.ts +6 -0
- package/src/core/agents/specialized/pentest/agent.test.ts +116 -0
- package/src/core/agents/specialized/pentest/agent.ts +178 -49
- package/src/core/agents/specialized/pentest/results.test.ts +59 -4
- package/src/core/agents/specialized/whiteboxAttackSurface/endpointDocumentationAgent.ts +1 -0
- package/src/core/ai/ai.operator-context.bench.test.ts +1408 -0
- package/src/core/ai/ai.recorded-context.test.ts +74 -0
- package/src/core/ai/ai.test.ts +54 -0
- package/src/core/ai/ai.ts +312 -82
- package/src/core/ai/compactionTelemetry.test.ts +2 -2
- package/src/core/ai/models/anthropic.ts +6 -0
- package/src/core/ai/models/bedrock.ts +18 -0
- package/src/core/ai/models/claude-capabilities.ts +29 -8
- package/src/core/ai/models/concentrate.ts +52 -0
- package/src/core/ai/models/index.ts +25 -4
- package/src/core/ai/models/models.test.ts +154 -0
- package/src/core/ai/models/openrouter.ts +43 -1
- package/src/core/ai/providers/anthropic-models.test.ts +60 -1
- package/src/core/ai/providers/bedrock-models.test.ts +81 -0
- package/src/core/ai/providers/concentrate.test.ts +31 -0
- package/src/core/ai/providers/concentrate.ts +11 -0
- package/src/core/ai/providers/gateway-models.test.ts +16 -6
- package/src/core/ai/utils.native-rollout-evidence.test.ts +1 -0
- package/src/core/ai/utils.ts +189 -143
- package/src/core/api/blackboxPentest.ts +9 -1
- package/src/core/api/index.ts +9 -0
- package/src/core/api/targetedPentest.ts +19 -5
- package/src/core/config/config.test.ts +35 -0
- package/src/core/config/config.ts +5 -0
- package/src/core/observability/telemetry.test.ts +2 -3
- package/src/core/session/index.ts +5 -0
- package/src/core/session/persistence.test.ts +62 -0
- package/src/core/session/persistence.ts +56 -0
- package/src/core/workflows/fastStrike.seams.test.ts +149 -0
- package/src/core/workflows/fastStrike.test.ts +18 -1
- package/src/core/workflows/fastStrike.ts +103 -11
- package/src/core/workflows/pentest.test.ts +104 -0
- package/src/core/workflows/pentest.ts +110 -7
- package/src/core/workflows/seams.test.ts +13 -0
- package/src/core/workflows/seams.ts +5 -1
- package/src/core/workflows/whiteboxAttackSurface.ts +1 -0
- package/src/tui/components/chat/loading-indicator.tsx +20 -4
- package/src/tui/components/chat/message-list.tsx +1 -0
- package/src/tui/components/commands/__tests__/advanced-settings-lifecycle.tsx +176 -0
- package/src/tui/components/commands/advanced-settings.test.ts +28 -0
- package/src/tui/components/commands/advanced-settings.tsx +237 -19
- package/src/tui/components/operator-dashboard/index.tsx +46 -9
- package/src/tui/components/operator-dashboard/logic.test.ts +106 -0
- package/src/tui/components/operator-dashboard/logic.ts +42 -2
- package/src/tui/components/operator-dashboard/run-events.test.ts +3 -1
- package/src/tui/components/shared/__tests__/tool-renderer-lifecycle.tsx +18 -0
- package/src/tui/components/shared/action-label.test.ts +9 -0
- package/src/tui/components/shared/compacting-icon.tsx +18 -0
- package/src/tui/components/shared/index.ts +1 -0
- package/src/tui/components/shared/tool-registry.ts +1 -0
- package/src/tui/components/shared/tool-renderer.tsx +21 -7
- package/src/tui/context/route.tsx +1 -0
- package/src/tui/keybindings/registry.ts +2 -0
- package/build/agent-6w7egcf1.js +0 -13
- package/build/agent-9zx75feh.js +0 -13
- package/build/pentest-e61hc38s.js +0 -22
- package/build/recordedRunClient-dp032c32.js +0 -11
- package/build/threatModel-jkxfa40s.js +0 -21
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TargetedPentestAgent2
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-gm3b9j4y.js";
|
|
4
4
|
|
|
5
5
|
// src/core/runtime/agentExecution.ts
|
|
6
6
|
function startAgentExecution(agent) {
|
|
@@ -13,18 +13,25 @@ function startAgentExecution(agent) {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
// src/core/api/targetedPentest.ts
|
|
16
|
-
function normalizeResult(result) {
|
|
16
|
+
function normalizeResult(result, findingPolicy) {
|
|
17
17
|
const r = result;
|
|
18
18
|
if (!r || !Array.isArray(r.findings)) {
|
|
19
19
|
console.error("runTargetedPentestAgent: consume() returned unexpected shape", { keys: result ? Object.keys(result) : null });
|
|
20
20
|
}
|
|
21
21
|
const findings = Array.isArray(r?.findings) ? r.findings : [];
|
|
22
|
-
|
|
22
|
+
const reportedFindings = Array.isArray(r?.reportedFindings) ? r.reportedFindings : [];
|
|
23
|
+
if (findingPolicy === "external") {
|
|
24
|
+
console.log(`
|
|
25
|
+
Reported ${reportedFindings.length} finding(s) for external evaluation`);
|
|
26
|
+
} else {
|
|
27
|
+
console.log(`
|
|
23
28
|
Found ${findings.length} vulnerabilities`);
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
console.log(`Findings: ${r?.findingsPath}`);
|
|
30
|
+
console.log(`POCs: ${r?.pocsPath}`);
|
|
31
|
+
}
|
|
26
32
|
return {
|
|
27
33
|
findings,
|
|
34
|
+
...findingPolicy === "external" ? { reportedFindings } : {},
|
|
28
35
|
findingsPath: r?.findingsPath,
|
|
29
36
|
pocsPath: r?.pocsPath,
|
|
30
37
|
objectiveResults: r?.objectiveResults,
|
|
@@ -41,7 +48,7 @@ function startTargetedPentestAgent2(input) {
|
|
|
41
48
|
}
|
|
42
49
|
const { result, abortAndDrain, drained } = startAgentExecution(agent);
|
|
43
50
|
return {
|
|
44
|
-
result: result.then(normalizeResult),
|
|
51
|
+
result: result.then((value) => normalizeResult(value, input.findingPolicy)),
|
|
45
52
|
abortAndDrain,
|
|
46
53
|
drained
|
|
47
54
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLogger,
|
|
3
3
|
scopedLogger
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-kcw4cpr3.js";
|
|
5
5
|
import {
|
|
6
6
|
GOOGLE_SIGNIN_PROMPT_GUIDANCE,
|
|
7
7
|
browserEngineForGoogleSignIn
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
AgentRuntime,
|
|
14
14
|
defineAgent
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ydxhkgjw.js";
|
|
16
16
|
|
|
17
17
|
// src/core/agents/specialized/authenticationAgent/agent.ts
|
|
18
18
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCurrentVersion,
|
|
3
3
|
config2
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-8njjwwcw.js";
|
|
5
5
|
import {
|
|
6
6
|
newSessionId2,
|
|
7
7
|
isSessionId2
|
|
@@ -34,12 +34,13 @@ import {
|
|
|
34
34
|
getPensarConsoleUrl2,
|
|
35
35
|
buildAuthConfig2,
|
|
36
36
|
normalizeStepUsage2
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-kcw4cpr3.js";
|
|
38
38
|
import {
|
|
39
39
|
buildSessionWorkspaceSection2,
|
|
40
40
|
buildBaseSystemPrompt2,
|
|
41
|
-
OffensiveSecurityAgent2
|
|
42
|
-
|
|
41
|
+
OffensiveSecurityAgent2,
|
|
42
|
+
EXTERNAL_FINDING_POLICY_CAPABILITY2
|
|
43
|
+
} from "./chunk-hys7nemr.js";
|
|
43
44
|
import {
|
|
44
45
|
ASK_USER_QUESTIONS_TOOL_NAME2,
|
|
45
46
|
apiRequest,
|
|
@@ -62,32 +63,32 @@ import {
|
|
|
62
63
|
createDomain2,
|
|
63
64
|
ALL_TOOL_NAMES2,
|
|
64
65
|
SKILL_TOOL_NAMES2
|
|
65
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-qkz5sm0d.js";
|
|
66
67
|
import {
|
|
67
68
|
BlackboxAttackSurfaceAgent2
|
|
68
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-fasqtjq1.js";
|
|
69
70
|
import {
|
|
70
71
|
runWhiteboxAttackSurfaceWorkflow2
|
|
71
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-1rqbhx4b.js";
|
|
72
73
|
import {
|
|
73
74
|
runAuthenticationAgent3
|
|
74
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-mbsde9d0.js";
|
|
75
76
|
import {
|
|
76
77
|
readExecutionMetrics,
|
|
77
78
|
writeExecutionMetrics,
|
|
78
79
|
runPentestWorkflow2
|
|
79
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-aq9eyxas.js";
|
|
80
81
|
import {
|
|
81
82
|
PatchingAgent2
|
|
82
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-3hjvdf67.js";
|
|
83
84
|
import {
|
|
84
85
|
startAgentExecution,
|
|
85
86
|
runTargetedPentestAgent2
|
|
86
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-m4swxy5r.js";
|
|
87
88
|
import {
|
|
88
89
|
AgentRuntime,
|
|
89
90
|
defineAgent
|
|
90
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-ydxhkgjw.js";
|
|
91
92
|
import {
|
|
92
93
|
__export
|
|
93
94
|
} from "./chunk-n0ba7khr.js";
|
|
@@ -98,6 +99,7 @@ __export(exports_api, {
|
|
|
98
99
|
CLOSED_DISPOSITIONS: () => CLOSED_DISPOSITIONS2,
|
|
99
100
|
DEFAULT_NATIVE_ROLLOUT_CAPTURE_LIMITS: () => DEFAULT_NATIVE_ROLLOUT_CAPTURE_LIMITS2,
|
|
100
101
|
ENDPOINT_TRANSPORTS: () => ENDPOINT_TRANSPORTS2,
|
|
102
|
+
EXTERNAL_FINDING_POLICY_CAPABILITY: () => EXTERNAL_FINDING_POLICY_CAPABILITY2,
|
|
101
103
|
KNOWLEDGE_CATEGORIES: () => KNOWLEDGE_CATEGORIES2,
|
|
102
104
|
KNOWLEDGE_STATUSES: () => KNOWLEDGE_STATUSES2,
|
|
103
105
|
PENSAR_API_BASE_URL: () => PENSAR_API_BASE_URL2,
|
|
@@ -2237,7 +2239,12 @@ async function runPentestAgent2(input) {
|
|
|
2237
2239
|
tokenUsage
|
|
2238
2240
|
});
|
|
2239
2241
|
}
|
|
2240
|
-
const { findings, findingsPath, pocsPath, reportPath } = result;
|
|
2242
|
+
const { findings, findingsPath, pocsPath, reportPath, reportedFindings } = result;
|
|
2243
|
+
if ((input.hooks?.findingPolicy ?? input.findingPolicy) === "external") {
|
|
2244
|
+
console.log(`
|
|
2245
|
+
Reported ${reportedFindings?.length ?? 0} finding(s) for external evaluation`);
|
|
2246
|
+
return result;
|
|
2247
|
+
}
|
|
2241
2248
|
console.log(`
|
|
2242
2249
|
Found ${findings.length} vulnerabilities`);
|
|
2243
2250
|
console.log(`Findings: ${findingsPath}`);
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
import {
|
|
45
45
|
getCurrentVersion,
|
|
46
46
|
config2
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-8njjwwcw.js";
|
|
48
48
|
import {
|
|
49
49
|
CredentialManager,
|
|
50
50
|
createLogger,
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
ensureValidToken,
|
|
54
54
|
signGatewayRequest,
|
|
55
55
|
generateObjectResponse2
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-kcw4cpr3.js";
|
|
57
57
|
import {
|
|
58
58
|
EndpointTransportEnum2,
|
|
59
59
|
GrpcEndpointMetadataSchema2,
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
} from "./chunk-zrbqn62x.js";
|
|
75
75
|
import {
|
|
76
76
|
FindingsRegistry2
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-0dnx79b1.js";
|
|
78
78
|
|
|
79
79
|
// src/core/agents/offSecAgent/tools/addMemory.ts
|
|
80
80
|
import { tool } from "ai";
|
|
@@ -3651,6 +3651,7 @@ IMPORTANT: Pass protectedEndpoints in authHints when you've discovered 401/403 e
|
|
|
3651
3651
|
const result = await spawner.spawn({
|
|
3652
3652
|
spec: { type: "authentication", target, authHints },
|
|
3653
3653
|
runtime: {
|
|
3654
|
+
findingPolicy: ctx.findingPolicy,
|
|
3654
3655
|
session: ctx.session,
|
|
3655
3656
|
model: ctx.model,
|
|
3656
3657
|
authConfig: ctx.authConfig,
|
|
@@ -4286,6 +4287,7 @@ async function generateThreatModelForEndpoint(ctx, input) {
|
|
|
4286
4287
|
excludeTools: ["document_endpoint", "document_app"]
|
|
4287
4288
|
},
|
|
4288
4289
|
runtime: {
|
|
4290
|
+
findingPolicy: ctx.findingPolicy,
|
|
4289
4291
|
session: ctx.session,
|
|
4290
4292
|
model,
|
|
4291
4293
|
authConfig: ctx.authConfig,
|
|
@@ -7710,34 +7712,86 @@ Each directory entry is suffixed with "/" for easy identification.`,
|
|
|
7710
7712
|
// src/core/agents/offSecAgent/tools/listMemories.ts
|
|
7711
7713
|
import { tool as tool35 } from "ai";
|
|
7712
7714
|
import { z as z37 } from "zod";
|
|
7715
|
+
var PAGE_SIZE = 20;
|
|
7716
|
+
var PAGE_CHAR_BUDGET = 12000;
|
|
7713
7717
|
var listMemoriesInputSchema = z37.object({
|
|
7714
7718
|
category: z37.enum(MEMORY_CATEGORIES2).optional().describe('Filter by category: "app", "framework", or "general". ' + "Omit to list memories across all categories."),
|
|
7715
7719
|
tag: z37.string().optional().describe("Optional tag to filter memories by (exact match)"),
|
|
7720
|
+
cursor: z37.object({
|
|
7721
|
+
createdAt: z37.string(),
|
|
7722
|
+
category: z37.enum(MEMORY_CATEGORIES2),
|
|
7723
|
+
id: z37.string()
|
|
7724
|
+
}).optional().describe("Pass the previous nextCursor to continue a listing"),
|
|
7716
7725
|
toolCallDescription: z37.string().describe("A concise, human-readable description of what this tool call is doing (e.g., 'Listing stored recon notes')")
|
|
7717
7726
|
});
|
|
7727
|
+
function compareMemories(a, b) {
|
|
7728
|
+
const byCreatedAt = Date.parse(b.createdAt) - Date.parse(a.createdAt);
|
|
7729
|
+
if (byCreatedAt > 0 || byCreatedAt < 0)
|
|
7730
|
+
return byCreatedAt;
|
|
7731
|
+
return a.category.localeCompare(b.category) || a.id.localeCompare(b.id);
|
|
7732
|
+
}
|
|
7733
|
+
function previewSummary(memory) {
|
|
7734
|
+
const title = memory.title.slice(0, 160);
|
|
7735
|
+
const tags = memory.tags.slice(0, 8).map((tag) => tag.slice(0, 48));
|
|
7736
|
+
const truncated = title.length < memory.title.length || tags.length < memory.tags.length || tags.some((tag, index) => tag.length < (memory.tags[index]?.length ?? tag.length));
|
|
7737
|
+
return {
|
|
7738
|
+
id: memory.id,
|
|
7739
|
+
category: memory.category,
|
|
7740
|
+
title,
|
|
7741
|
+
tags,
|
|
7742
|
+
createdAt: memory.createdAt,
|
|
7743
|
+
...truncated ? { truncated: true } : {}
|
|
7744
|
+
};
|
|
7745
|
+
}
|
|
7718
7746
|
function listMemories2(ctx) {
|
|
7719
7747
|
return tool35({
|
|
7720
7748
|
description: `List saved memories, optionally filtered by category and/or tag.
|
|
7721
7749
|
|
|
7722
|
-
Returns lightweight summaries (id, category, title, tags, createdAt)
|
|
7723
|
-
most recent first. Use
|
|
7724
|
-
|
|
7750
|
+
Returns up to 20 lightweight summaries (id, category, title, tags, createdAt)
|
|
7751
|
+
sorted by most recent first. Use nextCursor to continue until it is null;
|
|
7752
|
+
count is the current total matching memories. A fresh listing includes newer
|
|
7753
|
+
memories added ahead of a cursor. Titles and tags may be abbreviated in the
|
|
7754
|
+
listing. Use category + id with get_memory to retrieve full content.`,
|
|
7725
7755
|
inputSchema: listMemoriesInputSchema,
|
|
7726
|
-
execute: async ({ category, tag }, { toolCallId }) => {
|
|
7756
|
+
execute: async ({ category, tag, cursor }, { toolCallId }) => {
|
|
7727
7757
|
try {
|
|
7728
7758
|
const memories = await listMemories3({ category, tag }, { sessionId: ctx.session.id, toolCallId });
|
|
7759
|
+
const ordered = [...memories].sort(compareMemories);
|
|
7760
|
+
let start = 0;
|
|
7761
|
+
if (cursor) {
|
|
7762
|
+
start = ordered.findIndex((memory) => compareMemories(memory, cursor) > 0);
|
|
7763
|
+
if (start < 0)
|
|
7764
|
+
start = ordered.length;
|
|
7765
|
+
}
|
|
7766
|
+
const page = [];
|
|
7767
|
+
let pageChars = 0;
|
|
7768
|
+
for (const memory of ordered.slice(start, start + PAGE_SIZE)) {
|
|
7769
|
+
const summary = previewSummary(memory);
|
|
7770
|
+
const chars = JSON.stringify(summary).length + 1;
|
|
7771
|
+
if (page.length > 0 && pageChars + chars > PAGE_CHAR_BUDGET)
|
|
7772
|
+
break;
|
|
7773
|
+
page.push(summary);
|
|
7774
|
+
pageChars += chars;
|
|
7775
|
+
}
|
|
7776
|
+
const last = page.at(-1);
|
|
7729
7777
|
return {
|
|
7730
7778
|
success: true,
|
|
7731
7779
|
error: "",
|
|
7732
|
-
memories,
|
|
7733
|
-
count: memories.length
|
|
7780
|
+
memories: page,
|
|
7781
|
+
count: memories.length,
|
|
7782
|
+
nextCursor: start + page.length < ordered.length && last ? {
|
|
7783
|
+
createdAt: last.createdAt,
|
|
7784
|
+
category: last.category,
|
|
7785
|
+
id: last.id
|
|
7786
|
+
} : null
|
|
7734
7787
|
};
|
|
7735
7788
|
} catch (err) {
|
|
7736
7789
|
return {
|
|
7737
7790
|
success: false,
|
|
7738
7791
|
error: err instanceof Error ? err.message : String(err),
|
|
7739
7792
|
memories: [],
|
|
7740
|
-
count: 0
|
|
7793
|
+
count: 0,
|
|
7794
|
+
nextCursor: null
|
|
7741
7795
|
};
|
|
7742
7796
|
}
|
|
7743
7797
|
}
|
|
@@ -8381,7 +8435,8 @@ var ReportErrorReasonSchema2 = z46.enum([
|
|
|
8381
8435
|
"blocked",
|
|
8382
8436
|
"other"
|
|
8383
8437
|
]);
|
|
8384
|
-
function createReportErrorTool2(onError) {
|
|
8438
|
+
function createReportErrorTool2(onError, findingPolicy = "native") {
|
|
8439
|
+
const vulnerabilityGuidance = findingPolicy === "external" ? "Do NOT use this for vulnerabilities (include them in your final response)" : "Do NOT use this for vulnerabilities (use document_vulnerability)";
|
|
8385
8440
|
return tool44({
|
|
8386
8441
|
description: `Report a blocking error that prevents you from completing the pentest, and END your run.
|
|
8387
8442
|
|
|
@@ -8390,7 +8445,7 @@ Call this ONLY when you genuinely cannot continue, for example:
|
|
|
8390
8445
|
- The target is unreachable or responds in a way that makes testing impossible.
|
|
8391
8446
|
- Some other runtime condition blocks you from carrying out the objectives.
|
|
8392
8447
|
|
|
8393
|
-
|
|
8448
|
+
${vulnerabilityGuidance} or for normal completion (use response). Provide a clear, specific message describing exactly what blocked you — include the failing URL, status codes, or the auth step that failed where relevant — so it can be surfaced to the operator.`,
|
|
8394
8449
|
inputSchema: z46.object({
|
|
8395
8450
|
reason: ReportErrorReasonSchema2.describe("Coarse category of the blocking error."),
|
|
8396
8451
|
message: z46.string().min(1).describe("Clear, specific explanation of what blocked you (the failing URL, status codes, or auth step where relevant).")
|
|
@@ -8472,6 +8527,7 @@ should be passed directly to spawn_pentest_swarm for deep testing.`,
|
|
|
8472
8527
|
attackSurfaceRegistry: ctx.attackSurfaceRegistry
|
|
8473
8528
|
},
|
|
8474
8529
|
runtime: {
|
|
8530
|
+
findingPolicy: ctx.findingPolicy,
|
|
8475
8531
|
session: ctx.session,
|
|
8476
8532
|
model: ctx.model,
|
|
8477
8533
|
authConfig: ctx.authConfig,
|
|
@@ -8524,6 +8580,7 @@ should be passed directly to spawn_pentest_swarm for deep testing.`,
|
|
|
8524
8580
|
attackSurfaceRegistry: ctx.attackSurfaceRegistry
|
|
8525
8581
|
},
|
|
8526
8582
|
runtime: {
|
|
8583
|
+
findingPolicy: ctx.findingPolicy,
|
|
8527
8584
|
session: ctx.session,
|
|
8528
8585
|
model: ctx.model,
|
|
8529
8586
|
authConfig: ctx.authConfig,
|
|
@@ -8721,13 +8778,14 @@ ${output.stderr}` : "");
|
|
|
8721
8778
|
import { tool as tool48 } from "ai";
|
|
8722
8779
|
import { z as z50 } from "zod";
|
|
8723
8780
|
function runPentestWorkflow3(ctx) {
|
|
8781
|
+
const resultStep = ctx.findingPolicy === "external" ? "3. Return evidence-backed findings for the caller's evaluation" : "3. Aggregate findings and generate the final report";
|
|
8724
8782
|
return tool48({
|
|
8725
8783
|
description: `Run the full autonomous penetration test pipeline against a target.
|
|
8726
8784
|
|
|
8727
8785
|
This single tool call executes the entire pentest workflow:
|
|
8728
8786
|
1. Attack surface discovery (blackbox or whitebox)
|
|
8729
8787
|
2. Spawn a swarm of targeted pentest agents
|
|
8730
|
-
|
|
8788
|
+
${resultStep}
|
|
8731
8789
|
|
|
8732
8790
|
Use this when you want to run a complete, end-to-end pentest. The workflow
|
|
8733
8791
|
handles session creation, concurrency, persistence, and reporting automatically.
|
|
@@ -8750,6 +8808,7 @@ Omit \`cwd\` for blackbox mode (live target probing only).`,
|
|
|
8750
8808
|
const startedAt = Date.now();
|
|
8751
8809
|
try {
|
|
8752
8810
|
const result = await workflow({
|
|
8811
|
+
findingPolicy: ctx.findingPolicy,
|
|
8753
8812
|
target,
|
|
8754
8813
|
cwd,
|
|
8755
8814
|
model: ctx.model,
|
|
@@ -8762,6 +8821,7 @@ Omit \`cwd\` for blackbox mode (live target probing only).`,
|
|
|
8762
8821
|
openAIReasoningEffort: ctx.openAIReasoningEffort,
|
|
8763
8822
|
surfaceIntegrationEnabled: ctx.surfaceIntegrationEnabled,
|
|
8764
8823
|
hooks: {
|
|
8824
|
+
findingPolicy: ctx.findingPolicy,
|
|
8765
8825
|
backends: ctx.backends,
|
|
8766
8826
|
subagentSpawner: ctx.subagentSpawner,
|
|
8767
8827
|
languageModelMiddleware: ctx.languageModelMiddleware,
|
|
@@ -8775,6 +8835,17 @@ Omit \`cwd\` for blackbox mode (live target probing only).`,
|
|
|
8775
8835
|
const elapsedSeconds = Math.round((Date.now() - startedAt) / 1000);
|
|
8776
8836
|
const minutes = Math.floor(elapsedSeconds / 60);
|
|
8777
8837
|
const seconds = elapsedSeconds % 60;
|
|
8838
|
+
if (ctx.findingPolicy === "external") {
|
|
8839
|
+
const reportedFindings = result.reportedFindings ?? [];
|
|
8840
|
+
return {
|
|
8841
|
+
success: true,
|
|
8842
|
+
totalFindings: reportedFindings.length,
|
|
8843
|
+
reportedFindings,
|
|
8844
|
+
objectiveResults: result.objectiveResults ?? [],
|
|
8845
|
+
duration: `${minutes}m ${seconds}s`,
|
|
8846
|
+
message: `Pentest complete. ${reportedFindings.length} finding(s) returned for external evaluation.`
|
|
8847
|
+
};
|
|
8848
|
+
}
|
|
8778
8849
|
return {
|
|
8779
8850
|
success: true,
|
|
8780
8851
|
totalFindings: result.findings.length,
|
|
@@ -8821,13 +8892,14 @@ var ScanKindSchema = z51.enum([
|
|
|
8821
8892
|
"fuzzing"
|
|
8822
8893
|
]);
|
|
8823
8894
|
function runWhiteboxScan2(ctx) {
|
|
8895
|
+
const verificationGuidance = ctx.findingPolicy === "external" ? "as recoverable conditions. Static results are candidates only; assess them against the caller's evidence requirements." : `as recoverable conditions. Static results are candidates only; verify before
|
|
8896
|
+
calling document_vulnerability.`;
|
|
8824
8897
|
return tool49({
|
|
8825
8898
|
description: `Run installed whitebox security scanners with bounded output.
|
|
8826
8899
|
|
|
8827
8900
|
The tool detects applicable scanner adapters for the repository and normalizes
|
|
8828
8901
|
results into concise summaries plus artifact paths. Missing tools are reported
|
|
8829
|
-
|
|
8830
|
-
calling document_vulnerability.`,
|
|
8902
|
+
${verificationGuidance}`,
|
|
8831
8903
|
inputSchema: z51.object({
|
|
8832
8904
|
path: z51.string().optional().describe("Repository root to scan; must stay under the configured codebase root."),
|
|
8833
8905
|
kind: ScanKindSchema.optional().describe("Restrict scan family"),
|
|
@@ -9113,6 +9185,7 @@ async function runSingleCodingAgent(ctx, spawner, codebasePath, objective, _agen
|
|
|
9113
9185
|
const result = await spawner.spawn({
|
|
9114
9186
|
spec: { type: "code", codebasePath, objective },
|
|
9115
9187
|
runtime: {
|
|
9188
|
+
findingPolicy: ctx.findingPolicy,
|
|
9116
9189
|
session: ctx.session,
|
|
9117
9190
|
model: ctx.model,
|
|
9118
9191
|
authConfig: ctx.authConfig,
|
|
@@ -9154,6 +9227,14 @@ import { z as z54 } from "zod";
|
|
|
9154
9227
|
var WORKER_DRAIN_GRACE_MS = 30000;
|
|
9155
9228
|
var ORIGIN_AUTH_FAILURE_GUIDANCE = `A 401/403 from one resource does not by itself prove authentication failure. Verify the session against a known protected or session endpoint and re-authenticate on the assigned origin only if needed. Call report_error with reason "authentication_failed" only if required authentication cannot be established and this blocks the assigned objective or all further testing; otherwise continue any reachable testing.`;
|
|
9156
9229
|
function spawnPentestAgent2(ctx) {
|
|
9230
|
+
const externalFindings = ctx.findingPolicy === "external";
|
|
9231
|
+
const findingSteps = externalFindings ? `2. Reports concise evidence-backed findings in its response
|
|
9232
|
+
3. Leaves acceptance to the caller's external evaluator` : `2. Confirms vulnerabilities with POC scripts
|
|
9233
|
+
3. Documents findings to the shared findings registry only when the exploit path and material security impact are proven`;
|
|
9234
|
+
const findingGuidance = externalFindings ? "False-positive discipline: report a security weakness only when observations support a material abuse path. Include the affected target, evidence, and impact; do not add a separate in-run finding review." : "False-positive discipline: workers should not call document_vulnerability for public/unauthenticated behavior, missing best-practice controls, generic errors, local HTTP deployment context, or other low-signal observations unless they prove a material abuse path such as non-public data access, credentialed cross-origin abuse, state change, denial of service, account takeover, or another concrete exploit chain.";
|
|
9235
|
+
const returnGuidance = externalFindings ? "Returns the worker's summary, objective results, and reported findings so the parent can investigate chains." : "Returns the worker's summary, objective results, and finding count — but NOT the findings themselves (those land in the shared registry).";
|
|
9236
|
+
const exploratoryGuidance = externalFindings ? "Spawn a follow-up exploratory worker only when the assigned objective requires broader coverage or a credible untested lead remains. For detection-only work, finish once the requested evidence is sufficient." : 'After fanning out one worker per objective, call this tool ONE MORE TIME for a final "exploratory" worker. Pass it the URLs of any suspicious behaviors discovered by earlier workers and ask it to chain findings together and probe for additional, unspecified vulnerabilities.';
|
|
9237
|
+
const objectiveGuidance = externalFindings ? "Pass one focused objective per worker. A follow-up objective may cover a concrete chain or untested lead when the assignment calls for it." : "For per-objective fan-out, pass exactly one objective. For the final exploratory pass, pass a single composite objective describing chaining + exploration.";
|
|
9157
9238
|
const targetScopeGuidance = ctx.systemScope && ctx.systemScope.memberHosts.length > 0 ? `For a cross-service follow-up, you may instead use a full URL on one of these authorized System Scope members: ${ctx.systemScope.memberHosts.join(", ")}.` : "No structured System Scope is present, so keep the assigned host unchanged.";
|
|
9158
9239
|
return tool52({
|
|
9159
9240
|
description: `Spawn a single focused pentest sub-agent (worker) to test ONE objective at a time.
|
|
@@ -9166,22 +9247,21 @@ Authentication state is origin-specific. Before spawning a cross-service worker
|
|
|
9166
9247
|
|
|
9167
9248
|
Each spawn produces an independent TargetedPentestAgent that:
|
|
9168
9249
|
1. Tests the assigned objective(s) deeply (execute_command, http_request, browser tools)
|
|
9169
|
-
|
|
9170
|
-
3. Documents findings to the shared findings registry only when the exploit path and material security impact are proven
|
|
9250
|
+
${findingSteps}
|
|
9171
9251
|
|
|
9172
9252
|
Cloned browser session — the worker gets its OWN isolated Chromium instance, but it is seeded at spawn time with a snapshot of your current cookies and localStorage. If you've already authenticated in your browser (or recon set up useful state), the worker starts already authenticated for the same origins. Critically, the worker's browser is a COPY: its navigations, form fills, \`localStorage.setItem\`, alerts, and any other browser-side mutations stay inside the worker's own browser and do NOT leak back to you or to sibling workers. If you want state to be visible to the next worker, set it up in YOUR browser before spawning.
|
|
9173
9253
|
|
|
9174
9254
|
The worker has no further spawn capability — it cannot recursively spawn other pentest agents.
|
|
9175
9255
|
|
|
9176
|
-
|
|
9256
|
+
${exploratoryGuidance}
|
|
9177
9257
|
|
|
9178
|
-
|
|
9258
|
+
${findingGuidance}
|
|
9179
9259
|
|
|
9180
|
-
|
|
9260
|
+
${returnGuidance}`,
|
|
9181
9261
|
inputSchema: z54.object({
|
|
9182
9262
|
name: z54.string().describe("Short human-readable label for this sub-agent shown in the UI (e.g. 'SQLi /api/users', 'IDOR orders', 'Final chain & explore')."),
|
|
9183
9263
|
target: z54.string().describe(`Full target URL INCLUDING the endpoint path you want this worker to focus on (e.g. 'https://example.com/api/users/{id}', 'https://example.com/login'). Use the orchestrator's assigned URL by default and never strip it to a bare domain. A recon-supported sibling endpoint is allowed when it belongs to the objective. ${targetScopeGuidance} Never invent a host or endpoint.`),
|
|
9184
|
-
objectives: z54.array(z54.string()).min(1).describe(
|
|
9264
|
+
objectives: z54.array(z54.string()).min(1).describe(`Testing objectives for this worker. ${objectiveGuidance}`),
|
|
9185
9265
|
context: z54.string().optional().describe("Additional grounding context for the worker — e.g. summaries of what earlier workers found, suspicious endpoints to chain, or application-specific guidance. Treated as guidance, not as code to read."),
|
|
9186
9266
|
toolCallDescription: z54.string().describe("Concise, human-readable description of what this spawn is doing (shown in the UI).")
|
|
9187
9267
|
}),
|
|
@@ -9217,7 +9297,7 @@ Returns the worker's summary, objective results, and finding count — but NOT t
|
|
|
9217
9297
|
const spawner = ctx.subagentSpawner;
|
|
9218
9298
|
let subagentId = "";
|
|
9219
9299
|
try {
|
|
9220
|
-
const { findings, objectiveResults } = await spawner.spawn({
|
|
9300
|
+
const { findings, reportedFindings, objectiveResults } = await spawner.spawn({
|
|
9221
9301
|
spec: {
|
|
9222
9302
|
type: "pentest",
|
|
9223
9303
|
target,
|
|
@@ -9230,6 +9310,7 @@ Returns the worker's summary, objective results, and finding count — but NOT t
|
|
|
9230
9310
|
browserSession: sharedBrowserSession
|
|
9231
9311
|
},
|
|
9232
9312
|
runtime: {
|
|
9313
|
+
findingPolicy: ctx.findingPolicy,
|
|
9233
9314
|
session: ctx.session,
|
|
9234
9315
|
model: ctx.model,
|
|
9235
9316
|
authConfig: ctx.authConfig,
|
|
@@ -9262,9 +9343,10 @@ Returns the worker's summary, objective results, and finding count — but NOT t
|
|
|
9262
9343
|
return {
|
|
9263
9344
|
success: true,
|
|
9264
9345
|
subagentId,
|
|
9265
|
-
findingsCount: findings.length,
|
|
9346
|
+
findingsCount: externalFindings ? reportedFindings?.length ?? 0 : findings.length,
|
|
9347
|
+
...externalFindings ? { reportedFindings: reportedFindings ?? [] } : {},
|
|
9266
9348
|
objectiveResults,
|
|
9267
|
-
message: `Worker '${name}' complete. Documented ${findings.length} finding(s).`
|
|
9349
|
+
message: externalFindings ? `Worker '${name}' complete. Reported ${reportedFindings?.length ?? 0} finding(s) for external evaluation.` : `Worker '${name}' complete. Documented ${findings.length} finding(s).`
|
|
9268
9350
|
};
|
|
9269
9351
|
} catch (error) {
|
|
9270
9352
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -9302,15 +9384,19 @@ import { tool as tool53 } from "ai";
|
|
|
9302
9384
|
import { z as z55 } from "zod";
|
|
9303
9385
|
var log7 = scopedLogger(() => createLogger("spawn-pentest-swarm"));
|
|
9304
9386
|
function spawnPentestSwarm2(ctx) {
|
|
9387
|
+
const externalFindings = ctx.findingPolicy === "external";
|
|
9388
|
+
const findingSteps = externalFindings ? `2. Surface concise evidence-backed findings in its response
|
|
9389
|
+
3. Leave finding acceptance to the caller's evaluator` : `2. Create POC scripts for confirmed vulnerabilities
|
|
9390
|
+
3. Document findings with evidence and remediation`;
|
|
9391
|
+
const findingDestination = externalFindings ? "Reported findings are returned to this caller; no native finding review runs." : "All findings are written to the shared session directory.";
|
|
9305
9392
|
return tool53({
|
|
9306
9393
|
description: `Launch a swarm of targeted pentest sub-agents to test multiple targets in parallel.
|
|
9307
9394
|
|
|
9308
9395
|
Call this AFTER completing attack surface discovery. Each entry in 'targets' spawns an independent TargetedPentestAgent that will:
|
|
9309
9396
|
1. Test the specified target for the given objectives
|
|
9310
|
-
|
|
9311
|
-
3. Document findings with evidence and remediation
|
|
9397
|
+
${findingSteps}
|
|
9312
9398
|
|
|
9313
|
-
|
|
9399
|
+
${findingDestination}
|
|
9314
9400
|
|
|
9315
9401
|
Pass every target you want tested — the swarm handles concurrency automatically.`,
|
|
9316
9402
|
inputSchema: z55.object({
|
|
@@ -9339,6 +9425,7 @@ Pass every target you want tested — the swarm handles concurrency automaticall
|
|
|
9339
9425
|
const total = targets.length;
|
|
9340
9426
|
log7.info(`Spawning pentest swarm: ${total} agents (concurrency: ${DEFAULT_CONCURRENCY})`);
|
|
9341
9427
|
const swarmResults = await runPentestSwarm({
|
|
9428
|
+
findingPolicy: ctx.findingPolicy,
|
|
9342
9429
|
targets,
|
|
9343
9430
|
model: ctx.model,
|
|
9344
9431
|
session: ctx.session,
|
|
@@ -9354,6 +9441,7 @@ Pass every target you want tested — the swarm handles concurrency automaticall
|
|
|
9354
9441
|
openAIReasoningEffort: ctx.openAIReasoningEffort,
|
|
9355
9442
|
display: ctx.display,
|
|
9356
9443
|
hooks: {
|
|
9444
|
+
findingPolicy: ctx.findingPolicy,
|
|
9357
9445
|
backends: ctx.backends,
|
|
9358
9446
|
subagentSpawner: ctx.subagentSpawner,
|
|
9359
9447
|
languageModelMiddleware: ctx.languageModelMiddleware,
|
|
@@ -9364,7 +9452,7 @@ Pass every target you want tested — the swarm handles concurrency automaticall
|
|
|
9364
9452
|
sandbox: ctx.sandbox
|
|
9365
9453
|
}
|
|
9366
9454
|
});
|
|
9367
|
-
const totalFindings = swarmResults.reduce((sum, r) => sum + (r?.findings.length ?? 0), 0);
|
|
9455
|
+
const totalFindings = swarmResults.reduce((sum, r) => sum + (externalFindings ? r?.reportedFindings?.length ?? 0 : r?.findings.length ?? 0), 0);
|
|
9368
9456
|
const failedCount = swarmResults.filter((r) => r == null).length;
|
|
9369
9457
|
return {
|
|
9370
9458
|
success: true,
|
|
@@ -9373,7 +9461,11 @@ Pass every target you want tested — the swarm handles concurrency automaticall
|
|
|
9373
9461
|
failedTargets: failedCount,
|
|
9374
9462
|
results: targets.map((t, i) => ({
|
|
9375
9463
|
target: t.target,
|
|
9376
|
-
findingsCount: swarmResults[i]?.findings.length ?? 0,
|
|
9464
|
+
findingsCount: externalFindings ? swarmResults[i]?.reportedFindings?.length ?? 0 : swarmResults[i]?.findings.length ?? 0,
|
|
9465
|
+
...externalFindings ? {
|
|
9466
|
+
reportedFindings: swarmResults[i]?.reportedFindings ?? [],
|
|
9467
|
+
objectiveResults: swarmResults[i]?.objectiveResults ?? []
|
|
9468
|
+
} : {},
|
|
9377
9469
|
error: swarmResults[i] == null ? "Agent failed" : undefined
|
|
9378
9470
|
})),
|
|
9379
9471
|
message: `Swarm complete. ${totalFindings} findings across ${total} targets. ${failedCount > 0 ? `${failedCount} targets failed.` : "All targets tested successfully."}`
|
|
@@ -9623,12 +9715,13 @@ var updateTaskInputSchema = z59.object({
|
|
|
9623
9715
|
observation: z59.string().optional().describe("Intermediate observations or notes from testing")
|
|
9624
9716
|
});
|
|
9625
9717
|
function updateTask2(ctx) {
|
|
9718
|
+
const completedGuidance = ctx.findingPolicy === "external" ? "vulnerability identified with supporting evidence, OR conclusively determined the endpoint is not vulnerable / materiality is not met for this technique." : "vulnerability found and documented via document_vulnerability, OR conclusively determined the endpoint is not vulnerable / materiality is not met for this technique. Documentation is NOT required to complete a non-vulnerable task.";
|
|
9626
9719
|
return tool57({
|
|
9627
9720
|
description: `Update a task's status and record results.
|
|
9628
9721
|
|
|
9629
9722
|
Status transitions:
|
|
9630
9723
|
- "in_progress" — Set when you START testing a task. Pick one pending task at a time.
|
|
9631
|
-
- "completed" — Set when testing is done:
|
|
9724
|
+
- "completed" — Set when testing is done: ${completedGuidance}
|
|
9632
9725
|
- "failed" — Set when the technique didn't work: rate limited, blocked by WAF, dead end, or approach not applicable. Then create a NEW task with an alternative technique.
|
|
9633
9726
|
|
|
9634
9727
|
Always include a result or observation explaining the outcome.`,
|
|
@@ -9977,12 +10070,13 @@ var CandidateStateSchema = z62.enum([
|
|
|
9977
10070
|
"deferred"
|
|
9978
10071
|
]);
|
|
9979
10072
|
function createWhiteboxCandidate2(ctx) {
|
|
10073
|
+
const candidateGuidance = ctx.findingPolicy === "external" ? "for the caller's final evaluation. Candidates keep hypotheses, source-to-sink traces, scanner artifacts, fuzzing logs, and verification status separate from reported findings." : `for document_vulnerability. Candidates keep hypotheses, source-to-sink traces,
|
|
10074
|
+
scanner artifacts, fuzzing logs, and verification status out of official findings.`;
|
|
9980
10075
|
return tool60({
|
|
9981
10076
|
description: `Create a whitebox vulnerability candidate.
|
|
9982
10077
|
|
|
9983
10078
|
Use this for plausible source-code findings that are not yet confirmed enough
|
|
9984
|
-
|
|
9985
|
-
scanner artifacts, fuzzing logs, and verification status out of official findings.`,
|
|
10079
|
+
${candidateGuidance}`,
|
|
9986
10080
|
inputSchema: z62.object({
|
|
9987
10081
|
title: z62.string(),
|
|
9988
10082
|
vulnerabilityClass: z62.string(),
|
|
@@ -10009,7 +10103,7 @@ scanner artifacts, fuzzing logs, and verification status out of official finding
|
|
|
10009
10103
|
artifactPaths: candidate.artifacts.map((artifact) => artifact.path),
|
|
10010
10104
|
nextActions: [
|
|
10011
10105
|
"Move candidate to investigating after reading source context.",
|
|
10012
|
-
"Attempt a reproducer or dynamic verification before document_vulnerability."
|
|
10106
|
+
ctx.findingPolicy === "external" ? "Gather the evidence required by the caller before reporting this candidate." : "Attempt a reproducer or dynamic verification before document_vulnerability."
|
|
10013
10107
|
],
|
|
10014
10108
|
truncated: false
|
|
10015
10109
|
};
|
|
@@ -10053,7 +10147,7 @@ State machine: hypothesis -> investigating -> repro_attempted -> confirmed (requ
|
|
|
10053
10147
|
data: { candidate },
|
|
10054
10148
|
artifactPaths: candidate.artifacts.map((artifact) => artifact.path),
|
|
10055
10149
|
nextActions: candidate.state === "confirmed" ? [
|
|
10056
|
-
"Use document_vulnerability only if the proof demonstrates exploitability."
|
|
10150
|
+
ctx.findingPolicy === "external" ? "Report only the evidence-backed conclusion to the caller." : "Use document_vulnerability only if the proof demonstrates exploitability."
|
|
10057
10151
|
] : [
|
|
10058
10152
|
"Continue tracing or verification based on the candidate state."
|
|
10059
10153
|
],
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OffensiveSecurityAgent2
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-hys7nemr.js";
|
|
4
4
|
|
|
5
5
|
// src/core/agents/agentRuntime.ts
|
|
6
6
|
function assembleAgentHooks(opts) {
|
|
7
7
|
return {
|
|
8
|
+
findingPolicy: opts.findingPolicy,
|
|
8
9
|
backends: opts.backends,
|
|
9
10
|
subagentSpawner: opts.subagentSpawner,
|
|
10
11
|
languageModelMiddleware: opts.languageModelMiddleware,
|
|
@@ -39,7 +40,7 @@ class AgentRuntime extends OffensiveSecurityAgent2 {
|
|
|
39
40
|
responseSchema: definition.responseSchema?.(opts, state),
|
|
40
41
|
stopWhen: definition.stopWhen?.(opts, state) ?? opts.stopWhen,
|
|
41
42
|
extraTools: mergeExtraTools(opts.extraTools, definition.extraTools?.(opts, state)),
|
|
42
|
-
resolveResult: resolveResult ? (streamResult) => resolveResult(opts, state, streamResult) : undefined,
|
|
43
|
+
resolveResult: resolveResult ? (streamResult, validatedResponse) => resolveResult(opts, state, streamResult, validatedResponse) : undefined,
|
|
43
44
|
target: definition.target?.(opts, state) ?? opts.target,
|
|
44
45
|
grpc: definition.grpc?.(opts, state) ?? opts.grpc,
|
|
45
46
|
browserEngine: definition.browserEngine?.(opts, state) ?? opts.browserEngine,
|