@pensar/apex 2.3.0 → 2.4.0-canary.01e519de
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-9xna7jhw.js → agent-0h5eec5c.js} +12 -11
- package/build/agent-31reckde.js +20 -0
- package/build/agent-5mr8620j.js +30 -0
- package/build/{apps-43pqbz7r.js → apps-6595cxzf.js} +75 -34
- package/build/{auth-c1z670rx.js → auth-3k12kd2j.js} +46 -23
- package/build/authentication-4090egvp.js +20 -0
- package/build/blackboxAgent-gz4y6mcv.js +20 -0
- package/build/blackboxPentest-3nass7dk.js +70 -0
- package/build/{cli-baqhqbe5.js → cli-0e3qxh7j.js} +3 -3
- package/build/{cli-bv2807tj.js → cli-4aakh7qb.js} +5 -3
- package/build/{cli-j0n189ee.js → cli-51g5fkhp.js} +2 -2
- package/build/cli-53rm0rrz.js +15 -0
- package/build/cli-68260ckj.js +12136 -0
- package/build/cli-7q3ae3ft.js +6 -0
- package/build/cli-9pbk8m32.js +32 -0
- package/build/{cli-3k1x5rn3.js → cli-avmhkjtv.js} +2970 -4450
- package/build/{cli-8rxa073f.js → cli-bc05qbss.js} +8 -6
- package/build/{cli-n2m2yy5b.js → cli-c5wcg4h3.js} +2103 -956
- package/build/{cli-q24twygk.js → cli-dm0fc0bm.js} +1 -1
- package/build/{cli-yz80qkzn.js → cli-ee3axgts.js} +7 -1
- package/build/{cli-zx8gk8xv.js → cli-er8qc2y9.js} +661 -328
- package/build/{cli-bnkgdywr.js → cli-f4d9h659.js} +1 -1
- package/build/{cli-barsn8br.js → cli-g106a565.js} +11 -5
- package/build/{cli-72b18z0n.js → cli-j18by3n1.js} +28 -5
- package/build/{cli-gpnb45ck.js → cli-j54qa6tm.js} +7 -7
- package/build/{cli-50906d27.js → cli-jxnwyczj.js} +122 -43
- package/build/{cli-wszshs5e.js → cli-k71t434r.js} +4 -4
- package/build/cli-knd276ed.js +1485 -0
- package/build/{cli-f71s6kcw.js → cli-nbz7034e.js} +81 -215
- package/build/{cli-7tw4xfnw.js → cli-nyj54g4k.js} +1 -1
- package/build/{cli-zm8tfpv7.js → cli-r2cvbp82.js} +62 -44
- package/build/{cli-f7hanqbw.js → cli-r4z9n4q4.js} +2 -2
- package/build/{cli-eveg9djy.js → cli-rnwxtghc.js} +3 -2
- package/build/{cli-vckbhnyk.js → cli-tam9trnb.js} +2 -2
- package/build/{cli-zk1ch6qf.js → cli-xz5thhya.js} +61 -10
- package/build/{cli-jyp2c6th.js → cli-y6tyk0ms.js} +5 -3
- package/build/cli.js +546 -98
- package/build/{config-jzqjz606.js → config-52zkpmx4.js} +20 -17
- package/build/{doctor-q3qws68e.js → doctor-5eyfxzvy.js} +11 -9
- package/build/{fastStrike-ebz1ph9a.js → fastStrike-z2917eqj.js} +39 -16
- package/build/{fixes-86yebsj0.js → fixes-3rvsps8m.js} +27 -22
- package/build/getMachineId-bsd-xj3bn2fv.js +36 -0
- package/build/getMachineId-darwin-07jzjcx6.js +36 -0
- package/build/getMachineId-linux-ahngynxd.js +29 -0
- package/build/getMachineId-unsupported-vy43b44z.js +19 -0
- package/build/getMachineId-win-8x66cynz.js +38 -0
- package/build/{index-468j74f3.js → index-50aysats.js} +121 -97
- package/build/{index-gq9h8j5j.js → index-5wh7gq37.js} +135 -133
- package/build/{index-h2hj2hj9.js → index-cbwn03kz.js} +16 -16
- package/build/{index-32hn8rrw.js → index-cf1rrakg.js} +3 -3
- package/build/{index-tke6896d.js → index-psqjpw5m.js} +10 -10
- package/build/index-qf8trkme.js +12 -0
- package/build/{index-e8c8zcrf.js → index-t9q6d8ff.js} +32 -26
- package/build/{index-8db1d2q3.js → index-trccwx07.js} +18 -18
- package/build/{index-mr2cseg4.js → index-yy1fdh9w.js} +20 -19
- package/build/{index-97vx1a24.js → index-zhscmpd1.js} +2774 -2236
- package/build/{issues-kh4wg8c5.js → issues-015zf705.js} +36 -28
- package/build/{logs-bj28xmbf.js → logs-ra7c7my0.js} +27 -22
- package/build/{multipart-parser-6zd16497.js → multipart-parser-g2xxkezz.js} +2 -2
- package/build/{offesecAgent-8ky7gccp.js → offesecAgent-cvjy788j.js} +12 -11
- package/build/{parse-7djk9jyf.js → parse-rtccymzn.js} +3 -3
- package/build/pentest-kkw7zgge.js +30 -0
- package/build/{pentests-62d6zw6p.js → pentests-cs7km4sy.js} +28 -23
- package/build/{targetedPentest-me4jnr3z.js → targetedPentest-n33mm8bp.js} +15 -14
- package/build/{targets-e5k1mrky.js → targets-8nq8d33w.js} +29 -24
- package/build/threatModel-wmp658sv.js +29 -0
- package/build/{token-rdcbn380.js → token-3bbp59y6.js} +3 -3
- package/build/{token-util-sxb85ahn.js → token-util-6xjme11b.js} +2 -2
- package/build/{uninstall-jt1bca2p.js → uninstall-jvk3gtnx.js} +7 -4
- package/build/{upload-krd8bnex.js → upload-vwnzgrh6.js} +12 -11
- package/build/{utils-skmqhyfg.js → utils-132nk1dd.js} +18 -13
- package/package.json +8 -2
- package/build/agent-71z4e7jg.js +0 -19
- package/build/agent-ga5fecfs.js +0 -27
- package/build/authentication-hgs7ym0m.js +0 -19
- package/build/blackboxAgent-gem3mxa9.js +0 -19
- package/build/blackboxPentest-tgc2t3y6.js +0 -37
- package/build/index-ag14v3sg.js +0 -12
- package/build/main-3d7dfdvs.js +0 -324
- package/build/pentest-rs0181nf.js +0 -29
- package/build/threatModel-k4f3zgqd.js +0 -27
|
@@ -1,28 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AppsDiscoveryResultSchema,
|
|
3
|
+
DiscoverySummarySchema,
|
|
4
|
+
EndpointSchema,
|
|
5
|
+
WHITEBOX_APPS_DISCOVERY_SYSTEM_PROMPT,
|
|
6
|
+
WHITEBOX_DISCOVERY_SYSTEM_PROMPT,
|
|
7
|
+
WHITEBOX_ENDPOINT_DOCUMENTATION_SYSTEM_PROMPT
|
|
8
|
+
} from "./cli-0e3qxh7j.js";
|
|
1
9
|
import {
|
|
2
10
|
BlackboxAttackSurfaceAgent
|
|
3
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-4aakh7qb.js";
|
|
12
|
+
import {
|
|
13
|
+
TargetedPentestAgent,
|
|
14
|
+
buildPentestSystemPrompt
|
|
15
|
+
} from "./cli-jxnwyczj.js";
|
|
4
16
|
import {
|
|
5
17
|
REPORT_FILENAME_JSON,
|
|
6
18
|
REPORT_FILENAME_MD,
|
|
7
19
|
buildPentestReport,
|
|
8
20
|
renderJson,
|
|
9
21
|
renderMarkdown
|
|
10
|
-
} from "./cli-
|
|
11
|
-
import {
|
|
12
|
-
TargetedPentestAgent,
|
|
13
|
-
buildPentestSystemPrompt
|
|
14
|
-
} from "./cli-50906d27.js";
|
|
22
|
+
} from "./cli-j18by3n1.js";
|
|
15
23
|
import {
|
|
16
24
|
CodeAgent
|
|
17
|
-
} from "./cli-
|
|
18
|
-
import {
|
|
19
|
-
AppsDiscoveryResultSchema,
|
|
20
|
-
DiscoverySummarySchema,
|
|
21
|
-
EndpointSchema,
|
|
22
|
-
WHITEBOX_APPS_DISCOVERY_SYSTEM_PROMPT,
|
|
23
|
-
WHITEBOX_DISCOVERY_SYSTEM_PROMPT,
|
|
24
|
-
WHITEBOX_ENDPOINT_DOCUMENTATION_SYSTEM_PROMPT
|
|
25
|
-
} from "./cli-baqhqbe5.js";
|
|
25
|
+
} from "./cli-51g5fkhp.js";
|
|
26
26
|
import {
|
|
27
27
|
FindingsRegistry,
|
|
28
28
|
OffensiveSecurityAgent,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
pLimit,
|
|
32
32
|
runWithBoundedConcurrency,
|
|
33
33
|
toGrpcPentestContext
|
|
34
|
-
} from "./cli-
|
|
34
|
+
} from "./cli-c5wcg4h3.js";
|
|
35
35
|
import {
|
|
36
36
|
createThreatModelPrompt
|
|
37
37
|
} from "./cli-fw5r7pfj.js";
|
|
@@ -45,10 +45,10 @@ import {
|
|
|
45
45
|
init_structured,
|
|
46
46
|
newSessionId,
|
|
47
47
|
scopedLogger
|
|
48
|
-
} from "./cli-
|
|
48
|
+
} from "./cli-er8qc2y9.js";
|
|
49
49
|
import {
|
|
50
50
|
__require
|
|
51
|
-
} from "./cli-
|
|
51
|
+
} from "./cli-bc05qbss.js";
|
|
52
52
|
|
|
53
53
|
// src/core/workflows/pentest.ts
|
|
54
54
|
init_dist();
|
|
@@ -126,9 +126,23 @@ function normalizeTokenUsage(value) {
|
|
|
126
126
|
return {
|
|
127
127
|
inputTokens,
|
|
128
128
|
outputTokens,
|
|
129
|
+
cacheReadTokens: toNonNegativeInteger(value?.cacheReadTokens),
|
|
130
|
+
cacheWriteTokens: toNonNegativeInteger(value?.cacheWriteTokens),
|
|
129
131
|
totalTokens: explicitTotal > 0 ? explicitTotal : derivedTotal
|
|
130
132
|
};
|
|
131
133
|
}
|
|
134
|
+
function normalizeContextUsage(value) {
|
|
135
|
+
if (typeof value !== "object" || value === null)
|
|
136
|
+
return;
|
|
137
|
+
const v = value;
|
|
138
|
+
if (typeof v.modelId !== "string" || v.modelId.length === 0)
|
|
139
|
+
return;
|
|
140
|
+
return {
|
|
141
|
+
modelId: v.modelId,
|
|
142
|
+
usedTokens: toNonNegativeInteger(v.usedTokens),
|
|
143
|
+
contextLimit: toNonNegativeInteger(v.contextLimit)
|
|
144
|
+
};
|
|
145
|
+
}
|
|
132
146
|
function metricsPath(sessionRootPath) {
|
|
133
147
|
return join(sessionRootPath, EXECUTION_METRICS_FILENAME);
|
|
134
148
|
}
|
|
@@ -143,6 +157,7 @@ function readExecutionMetrics(sessionRootPath) {
|
|
|
143
157
|
const parsed = JSON.parse(readFileSync(path, "utf-8"));
|
|
144
158
|
return {
|
|
145
159
|
tokenUsage: normalizeTokenUsage(parsed.tokenUsage),
|
|
160
|
+
contextUsage: normalizeContextUsage(parsed.contextUsage),
|
|
146
161
|
runtime: typeof parsed.runtime === "string" ? parsed.runtime : undefined,
|
|
147
162
|
elapsedSeconds: toNonNegativeInteger(parsed.elapsedSeconds) || undefined,
|
|
148
163
|
updatedAt: typeof parsed.updatedAt === "string" ? parsed.updatedAt : new Date().toISOString()
|
|
@@ -167,10 +182,13 @@ function writeExecutionMetrics(input) {
|
|
|
167
182
|
const nextTokenUsage = input.tokenUsage ? normalizeTokenUsage(input.tokenUsage) : existing?.tokenUsage ?? {
|
|
168
183
|
inputTokens: 0,
|
|
169
184
|
outputTokens: 0,
|
|
185
|
+
cacheReadTokens: 0,
|
|
186
|
+
cacheWriteTokens: 0,
|
|
170
187
|
totalTokens: 0
|
|
171
188
|
};
|
|
172
189
|
const next = {
|
|
173
190
|
tokenUsage: nextTokenUsage,
|
|
191
|
+
contextUsage: input.contextUsage ?? existing?.contextUsage,
|
|
174
192
|
runtime: input.runtime ?? existing?.runtime,
|
|
175
193
|
elapsedSeconds: input.elapsedSeconds ?? existing?.elapsedSeconds,
|
|
176
194
|
updatedAt: new Date().toISOString()
|
|
@@ -7639,16 +7657,6 @@ When finished, call \`response\` with a summary of how many entry points you doc
|
|
|
7639
7657
|
// src/core/workflows/pentest.ts
|
|
7640
7658
|
var log5 = scopedLogger(() => createLogger("pentest-swarm"));
|
|
7641
7659
|
var DEFAULT_CONCURRENCY2 = 10;
|
|
7642
|
-
function addUsageTotals(totals, usage) {
|
|
7643
|
-
if (!usage)
|
|
7644
|
-
return;
|
|
7645
|
-
const inputTokens = usage.inputTokens ?? 0;
|
|
7646
|
-
const outputTokens = usage.outputTokens ?? 0;
|
|
7647
|
-
const totalTokens = usage.totalTokens ?? inputTokens + outputTokens;
|
|
7648
|
-
totals.inputTokens += inputTokens;
|
|
7649
|
-
totals.outputTokens += outputTokens;
|
|
7650
|
-
totals.totalTokens += totalTokens;
|
|
7651
|
-
}
|
|
7652
7660
|
async function runPentestSwarm(input) {
|
|
7653
7661
|
const {
|
|
7654
7662
|
targets,
|
|
@@ -7661,6 +7669,7 @@ async function runPentestSwarm(input) {
|
|
|
7661
7669
|
onError,
|
|
7662
7670
|
concurrency = DEFAULT_CONCURRENCY2,
|
|
7663
7671
|
onStepFinish,
|
|
7672
|
+
onCacheMetrics,
|
|
7664
7673
|
enableThinking,
|
|
7665
7674
|
thinkingEffort,
|
|
7666
7675
|
openAIReasoningEffort,
|
|
@@ -7692,6 +7701,12 @@ async function runPentestSwarm(input) {
|
|
|
7692
7701
|
});
|
|
7693
7702
|
if (session.config?.requirePlan && session.config?.taskDriven && previousMessages.length === 0) {
|
|
7694
7703
|
try {
|
|
7704
|
+
eventBus?.emit("subagent-spawn", {
|
|
7705
|
+
subagentId: `${subagentId}-plan`,
|
|
7706
|
+
name: `${subagentName} (plan)`,
|
|
7707
|
+
input: { target: target.target, objectives: target.objectives },
|
|
7708
|
+
parentSubagentId: subagentId
|
|
7709
|
+
});
|
|
7695
7710
|
const executionTasksDir = join18(session.rootPath, "subagents", `${subagentId}-tasks`);
|
|
7696
7711
|
const planAgent = new OffensiveSecurityAgent({
|
|
7697
7712
|
system: PLAN_PHASE_SYSTEM_PROMPT,
|
|
@@ -7711,13 +7726,25 @@ async function runPentestSwarm(input) {
|
|
|
7711
7726
|
tasksDir: executionTasksDir,
|
|
7712
7727
|
planSubagentId: subagentId,
|
|
7713
7728
|
eventBus,
|
|
7729
|
+
onStepFinish,
|
|
7730
|
+
onCacheMetrics,
|
|
7714
7731
|
enableThinking,
|
|
7715
7732
|
thinkingEffort,
|
|
7716
7733
|
openAIReasoningEffort,
|
|
7717
7734
|
display
|
|
7718
7735
|
});
|
|
7719
7736
|
await planAgent.consume();
|
|
7737
|
+
eventBus?.emit("subagent-complete", {
|
|
7738
|
+
subagentId: `${subagentId}-plan`,
|
|
7739
|
+
status: "completed",
|
|
7740
|
+
parentSubagentId: subagentId
|
|
7741
|
+
});
|
|
7720
7742
|
} catch (planErr) {
|
|
7743
|
+
eventBus?.emit("subagent-complete", {
|
|
7744
|
+
subagentId: `${subagentId}-plan`,
|
|
7745
|
+
status: "failed",
|
|
7746
|
+
parentSubagentId: subagentId
|
|
7747
|
+
});
|
|
7721
7748
|
log5.warn(`Plan phase failed for ${subagentId}: ${planErr}`);
|
|
7722
7749
|
}
|
|
7723
7750
|
}
|
|
@@ -7734,6 +7761,8 @@ async function runPentestSwarm(input) {
|
|
|
7734
7761
|
abortSignal,
|
|
7735
7762
|
findingsRegistry,
|
|
7736
7763
|
onStepFinish: handleStepFinish,
|
|
7764
|
+
onCacheMetrics,
|
|
7765
|
+
forwardUsageCallbacksToSpawnedAgents: true,
|
|
7737
7766
|
messages: previousMessages.length > 0 ? previousMessages : undefined,
|
|
7738
7767
|
eventBus,
|
|
7739
7768
|
subagentId,
|
|
@@ -7786,7 +7815,7 @@ async function runPentestSwarm(input) {
|
|
|
7786
7815
|
}
|
|
7787
7816
|
async function runPentestWorkflow(input) {
|
|
7788
7817
|
if (input.fastStrike) {
|
|
7789
|
-
const { runFastStrike } = await import("./fastStrike-
|
|
7818
|
+
const { runFastStrike } = await import("./fastStrike-z2917eqj.js");
|
|
7790
7819
|
return runFastStrike(input);
|
|
7791
7820
|
}
|
|
7792
7821
|
const {
|
|
@@ -7823,17 +7852,6 @@ async function runPentestWorkflow(input) {
|
|
|
7823
7852
|
${combined}` : combined;
|
|
7824
7853
|
}
|
|
7825
7854
|
const startedAt = Date.now();
|
|
7826
|
-
const tokenUsageTotals = {
|
|
7827
|
-
inputTokens: 0,
|
|
7828
|
-
outputTokens: 0,
|
|
7829
|
-
totalTokens: 0
|
|
7830
|
-
};
|
|
7831
|
-
const wrappedOnStepFinish = (event) => {
|
|
7832
|
-
addUsageTotals(tokenUsageTotals, event.usage);
|
|
7833
|
-
if (onStepFinish) {
|
|
7834
|
-
onStepFinish(event);
|
|
7835
|
-
}
|
|
7836
|
-
};
|
|
7837
7855
|
try {
|
|
7838
7856
|
const mode = cwd ? "whitebox" : "blackbox";
|
|
7839
7857
|
let swarmTargets;
|
|
@@ -7870,7 +7888,7 @@ ${combined}` : combined;
|
|
|
7870
7888
|
authConfig,
|
|
7871
7889
|
abortSignal,
|
|
7872
7890
|
eventBus,
|
|
7873
|
-
onStepFinish
|
|
7891
|
+
onStepFinish,
|
|
7874
7892
|
onCacheMetrics,
|
|
7875
7893
|
openAIReasoningEffort,
|
|
7876
7894
|
surfaceIntegrationEnabled
|
|
@@ -7883,7 +7901,7 @@ ${combined}` : combined;
|
|
|
7883
7901
|
authConfig,
|
|
7884
7902
|
abortSignal,
|
|
7885
7903
|
eventBus,
|
|
7886
|
-
onStepFinish
|
|
7904
|
+
onStepFinish,
|
|
7887
7905
|
onCacheMetrics,
|
|
7888
7906
|
openAIReasoningEffort
|
|
7889
7907
|
});
|
|
@@ -7936,7 +7954,8 @@ ${combined}` : combined;
|
|
|
7936
7954
|
abortSignal,
|
|
7937
7955
|
findingsRegistry,
|
|
7938
7956
|
eventBus,
|
|
7939
|
-
onStepFinish
|
|
7957
|
+
onStepFinish,
|
|
7958
|
+
onCacheMetrics,
|
|
7940
7959
|
enableThinking,
|
|
7941
7960
|
thinkingEffort,
|
|
7942
7961
|
openAIReasoningEffort
|
|
@@ -7984,7 +8003,6 @@ ${combined}` : combined;
|
|
|
7984
8003
|
const runtime = formatDurationHmsFromMs(Date.now() - startedAt);
|
|
7985
8004
|
writeExecutionMetrics({
|
|
7986
8005
|
sessionRootPath: session.rootPath,
|
|
7987
|
-
tokenUsage: tokenUsageTotals,
|
|
7988
8006
|
runtime
|
|
7989
8007
|
});
|
|
7990
8008
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCurrentVersion,
|
|
3
3
|
init_installation
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-g106a565.js";
|
|
5
5
|
import {
|
|
6
6
|
__esm
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-bc05qbss.js";
|
|
8
8
|
|
|
9
9
|
// src/core/config/config.ts
|
|
10
10
|
import fs from "node:fs/promises";
|
|
@@ -45,6 +45,7 @@ function applyEnvFallbacks(parsedConfig) {
|
|
|
45
45
|
anthropicAPIKey: parsedConfig.anthropicAPIKey ?? process.env.ANTHROPIC_API_KEY,
|
|
46
46
|
googleAPIKey: parsedConfig.googleAPIKey ?? process.env.GOOGLE_GENERATIVE_AI_API_KEY,
|
|
47
47
|
openRouterAPIKey: parsedConfig.openRouterAPIKey ?? process.env.OPENROUTER_API_KEY,
|
|
48
|
+
concentrateAPIKey: parsedConfig.concentrateAPIKey ?? process.env.CONCENTRATE_API_KEY,
|
|
48
49
|
inceptionAPIKey: parsedConfig.inceptionAPIKey ?? process.env.INCEPTION_API_KEY,
|
|
49
50
|
bedrockAPIKey: parsedConfig.bedrockAPIKey ?? process.env.BEDROCK_API_KEY,
|
|
50
51
|
pensarAPIKey: parsedConfig.pensarAPIKey ?? process.env.PENSAR_API_KEY,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OffensiveSecurityAgent
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-c5wcg4h3.js";
|
|
4
4
|
import {
|
|
5
5
|
detectOSAndEnhancePrompt
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-nyj54g4k.js";
|
|
7
7
|
import {
|
|
8
8
|
createLogger,
|
|
9
9
|
hasToolCall,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
init_lazyLogger,
|
|
12
12
|
init_structured,
|
|
13
13
|
scopedLogger
|
|
14
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-er8qc2y9.js";
|
|
15
15
|
|
|
16
16
|
// src/core/agents/specialized/authenticationAgent/agent.ts
|
|
17
17
|
init_dist();
|
|
@@ -31,7 +31,7 @@ Obtain valid credentials/sessions that other agents can use for authenticated te
|
|
|
31
31
|
# Operating Mode
|
|
32
32
|
|
|
33
33
|
- Fully autonomous — no human intervention
|
|
34
|
-
- If you encounter barriers (CAPTCHA, MFA), report failure with details
|
|
34
|
+
- If you encounter barriers (CAPTCHA, or MFA with no TOTP seed available), report failure with details
|
|
35
35
|
- Call \`complete_authentication\` when done (success or failure)
|
|
36
36
|
|
|
37
37
|
# Available Tools
|
|
@@ -125,6 +125,39 @@ These are the ONLY way downstream agents receive the session credentials.
|
|
|
125
125
|
|
|
126
126
|
**Then**, call the \`response\` tool with your final summary to end the run. This is required — complete_authentication persists the data, response terminates the agent.
|
|
127
127
|
|
|
128
|
+
# MFA / TOTP Codes
|
|
129
|
+
|
|
130
|
+
If the login asks for a 6-digit authenticator code, check whether a TOTP seed was provided for this
|
|
131
|
+
account — it appears as an extra secret field on the credential and as a matching environment variable
|
|
132
|
+
(look for a name containing TOTP, MFA, OTP, or 2FA). If one exists, do NOT report an MFA barrier —
|
|
133
|
+
compute the code yourself:
|
|
134
|
+
|
|
135
|
+
\`\`\`
|
|
136
|
+
python3 -c "import base64,hmac,hashlib,struct,time,os;s=os.environ['<ENV_VAR>'].replace(' ','').upper();k=base64.b32decode(s+'='*(-len(s)%8));d=hmac.new(k,struct.pack('>Q',int(time.time())//30),hashlib.sha1).digest();o=d[-1]&15;print('%06d'%((struct.unpack('>I',d[o:o+4])[0]&0x7fffffff)%1000000))"
|
|
137
|
+
\`\`\`
|
|
138
|
+
|
|
139
|
+
Read the seed from the environment variable — never paste a seed literal into a command. Codes rotate
|
|
140
|
+
every 30 seconds, so run this immediately before filling the field. If the code is rejected, re-run and
|
|
141
|
+
retry once (you may have crossed a period boundary). Only report an MFA barrier if no seed is available
|
|
142
|
+
or two fresh codes are both rejected.
|
|
143
|
+
|
|
144
|
+
# SMS passwordless (phone as login)
|
|
145
|
+
|
|
146
|
+
If a credential has a \`phoneNumber\` additional field, the phone number IS the login identifier — not MFA
|
|
147
|
+
after a password. Do **not** report \`phone_verification\` as a barrier for this flow.
|
|
148
|
+
|
|
149
|
+
1. \`browser_fill\` with \`credentialId\` and \`credentialField="phoneNumber"\` (never type the number).
|
|
150
|
+
2. Click the target's send-code / text-me control. Note \`Date.now()\` at that click as \`sinceMs\`.
|
|
151
|
+
3. \`execute_command\` \`sleep 5\`, then call \`sms_list_messages\` with that \`credentialId\` and \`sinceMs\`.
|
|
152
|
+
If the list is empty, sleep and list again a few times. If it stays empty or returns an error, stop
|
|
153
|
+
and report what you observed — do not hang in a wait loop. Set \`claim=true\` once a message is present
|
|
154
|
+
so other runs cannot reuse the OTP.
|
|
155
|
+
4. \`browser_fill\` the OTP from the claimed/listed result (\`code\`, or parse \`body\` if \`code\` is null).
|
|
156
|
+
5. Continue the login and call \`complete_authentication\`.
|
|
157
|
+
|
|
158
|
+
TOTP-via-environment-variable above is unchanged and still applies when the login asks for an authenticator
|
|
159
|
+
app code.
|
|
160
|
+
|
|
128
161
|
# Error Recovery
|
|
129
162
|
|
|
130
163
|
If authentication fails, try these mechanical fixes (they are login mechanics, not credential changes):
|
|
@@ -136,7 +169,8 @@ If authentication fails, try these mechanical fixes (they are login mechanics, n
|
|
|
136
169
|
|
|
137
170
|
If credentials were provided to you, they are already verified and SHARED — do not modify them or their
|
|
138
171
|
account settings. When such provided credentials are genuinely rejected — wrong password, account locked, a
|
|
139
|
-
forced password change is required, MFA is required, or the email is not
|
|
172
|
+
forced password change is required, MFA is required and no TOTP seed was provided, or the email is not
|
|
173
|
+
confirmed — do NOT try to recover by resetting or changing
|
|
140
174
|
the password, modifying MFA/2FA settings, or running any account-recovery flow. Fail fast: call
|
|
141
175
|
\`complete_authentication\` with success=false and a summary naming the reason. Do NOT register a new account
|
|
142
176
|
or self-sign-up to get around a rejected provided credential — that is a different account than the one
|
|
@@ -194,7 +228,7 @@ class AuthenticationAgent extends OffensiveSecurityAgent {
|
|
|
194
228
|
const cm = session.credentialManager;
|
|
195
229
|
super({
|
|
196
230
|
system: detectOSAndEnhancePrompt(AUTH_SUBAGENT_SYSTEM_PROMPT),
|
|
197
|
-
prompt: buildAuthPrompt(target, authHints, cm, context),
|
|
231
|
+
prompt: buildAuthPrompt(target, authHints, cm, context, environmentVariables ? Object.keys(environmentVariables) : undefined),
|
|
198
232
|
model,
|
|
199
233
|
session,
|
|
200
234
|
target,
|
|
@@ -226,6 +260,7 @@ class AuthenticationAgent extends OffensiveSecurityAgent {
|
|
|
226
260
|
"email_search_messages",
|
|
227
261
|
"email_get_message",
|
|
228
262
|
"send_email",
|
|
263
|
+
"sms_list_messages",
|
|
229
264
|
"web_search",
|
|
230
265
|
"get_page"
|
|
231
266
|
],
|
|
@@ -272,7 +307,7 @@ function loadAuthResult(authDataPath) {
|
|
|
272
307
|
};
|
|
273
308
|
}
|
|
274
309
|
}
|
|
275
|
-
function buildAuthPrompt(target, authHints, credentialManager, context) {
|
|
310
|
+
function buildAuthPrompt(target, authHints, credentialManager, context, envVarNames) {
|
|
276
311
|
const parts = [`TARGET: ${target}
|
|
277
312
|
`];
|
|
278
313
|
if (context) {
|
|
@@ -290,6 +325,13 @@ function buildAuthPrompt(target, authHints, credentialManager, context) {
|
|
|
290
325
|
parts.push(`No credentials provided. Probe the target to discover auth requirements.
|
|
291
326
|
`);
|
|
292
327
|
}
|
|
328
|
+
if (envVarNames?.length) {
|
|
329
|
+
parts.push("ENVIRONMENT VARIABLES:");
|
|
330
|
+
parts.push(`These are pre-loaded in your shell and available in every execute_command call. Reference them (e.g. $${envVarNames[0]}) — their values are hidden from you and redacted from command output, so never try to print one.`);
|
|
331
|
+
parts.push(envVarNames.map((n) => `- ${n}`).join(`
|
|
332
|
+
`));
|
|
333
|
+
parts.push("");
|
|
334
|
+
}
|
|
293
335
|
if (authHints) {
|
|
294
336
|
parts.push("AUTH HINTS:");
|
|
295
337
|
if (authHints.authScheme)
|
|
@@ -304,6 +346,14 @@ function buildAuthPrompt(target, authHints, credentialManager, context) {
|
|
|
304
346
|
parts.push("");
|
|
305
347
|
}
|
|
306
348
|
if (credBlock) {
|
|
349
|
+
const hasSmsPasswordless = credentialManager?.listReferences().some((ref) => ref.additionalFieldKeys?.includes("phoneNumber"));
|
|
350
|
+
const smsInstructions = hasSmsPasswordless ? `
|
|
351
|
+
If a credential has a phoneNumber additional field (Mobile OTP / sms-passwordless), phone is the login
|
|
352
|
+
identifier — not MFA-after-password. browser_fill credentialField="phoneNumber", click send-code, then
|
|
353
|
+
execute_command \`sleep 5\` and call sms_list_messages with sinceMs = Date.now() at that click (claim=true
|
|
354
|
+
once a message is present). If the list is empty, sleep and list again; if it stays empty, fail with what
|
|
355
|
+
you observed — do not hang waiting. Then browser_fill the OTP. Do NOT report phone_verification as a
|
|
356
|
+
barrier for this flow. TOTP-via-env for authenticator MFA is unchanged.` : "";
|
|
307
357
|
parts.push(`INSTRUCTIONS:
|
|
308
358
|
You have credentials available via credential IDs — authenticate immediately.
|
|
309
359
|
1. For API/form logins, use execute_command (curl) to submit credentials and capture the Set-Cookie / token response
|
|
@@ -311,13 +361,14 @@ You have credentials available via credential IDs — authenticate immediately.
|
|
|
311
361
|
pass credentialId + credentialField (e.g. credentialField="password") instead of the raw value —
|
|
312
362
|
the secret is resolved securely at execution time. NEVER type a password directly.
|
|
313
363
|
3. Call complete_authentication with exported cookies/headers to persist credentials and end the run
|
|
314
|
-
|
|
364
|
+
${smsInstructions}
|
|
315
365
|
The credentials above were provided to you and have already been verified — they are SHARED across runs, so
|
|
316
366
|
do not modify them or their account settings. NEVER change the password, complete a password reset /
|
|
317
367
|
forced-password-change / account-recovery flow, or modify MFA/2FA settings (enrolling, disabling, or
|
|
318
368
|
resetting a second factor) for this account. If they do not authenticate (rejected, locked out, forced
|
|
319
|
-
password change required,
|
|
320
|
-
success=false and a clear summary of why — do not attempt to recover, reset,
|
|
369
|
+
password change required, email not confirmed, or an MFA prompt with no TOTP seed available), call
|
|
370
|
+
complete_authentication with success=false and a clear summary of why — do not attempt to recover, reset,
|
|
371
|
+
or rotate them. When a TOTP seed IS available, generate the code and continue; that is not a barrier. Do NOT
|
|
321
372
|
register a new account or self-sign-up to work around a failed login: that is not the credential under test
|
|
322
373
|
and only pollutes results — fail fast with success=false instead.`);
|
|
323
374
|
} else {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AttackPathSchema,
|
|
2
3
|
CweEntrySchema,
|
|
3
4
|
ValidatedCweEntrySchema
|
|
4
|
-
} from "./cli-
|
|
5
|
+
} from "./cli-c5wcg4h3.js";
|
|
5
6
|
import {
|
|
6
7
|
exports_external,
|
|
7
8
|
init_zod
|
|
8
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-avmhkjtv.js";
|
|
9
10
|
|
|
10
11
|
// src/core/agents/offSecAgent/types.ts
|
|
11
12
|
init_zod();
|
|
@@ -47,7 +48,8 @@ var ApexFindingObject = exports_external.object({
|
|
|
47
48
|
rootCauseGroup: exports_external.string().optional(),
|
|
48
49
|
relatedFindings: exports_external.array(exports_external.string()).optional(),
|
|
49
50
|
rootCauseLead: exports_external.boolean().optional(),
|
|
50
|
-
evidenceFiles: exports_external.array(EvidenceFileEntrySchema).optional()
|
|
51
|
+
evidenceFiles: exports_external.array(EvidenceFileEntrySchema).optional(),
|
|
52
|
+
attackPath: AttackPathSchema.optional()
|
|
51
53
|
});
|
|
52
54
|
|
|
53
55
|
export { EvidenceFileEntrySchema, ApexFindingObject };
|