@pensar/apex 2.4.0 → 2.5.0-canary.22f2eb52
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-7qtpem5z.js +12 -0
- package/build/agent-9khcyh5t.js +14 -0
- package/build/agent-bsyhck0a.js +12 -0
- package/build/{agent-5ejt5vpz.js → agent-ywewzc2h.js} +42 -42
- package/build/{apps-17wvz1d7.js → apps-11akynyv.js} +74 -43
- package/build/{auth-z3h9859n.js → auth-dd6r9mk4.js} +57 -61
- package/build/blackboxAgent-hbra4k00.js +12 -0
- package/build/blackboxPentest-bn5evs2z.js +61 -0
- package/build/{cli-xshasbwe.js → cli-3v9zs5wm.js} +31 -52
- package/build/{cli-mavved45.js → cli-4z46kyrk.js} +86 -93
- package/build/cli-7vby0hk6.js +12136 -0
- package/build/{cli-gq40s5b3.js → cli-8kkaeb70.js} +33 -46
- package/build/cli-8w8k4dph.js +15 -0
- package/build/cli-ag6jtndp.js +32 -0
- package/build/{cli-2cbwdk78.js → cli-ak78mweh.js} +4 -4
- package/build/cli-bb02pjt0.js +1485 -0
- package/build/{cli-k71t434r.js → cli-ec2hwkv3.js} +34 -76
- package/build/{cli-vnynf0js.js → cli-f5rw841m.js} +11 -5
- package/build/{cli-k8kc47pq.js → cli-gamfs2yq.js} +118 -115
- package/build/{cli-32z0017y.js → cli-gq5sk2j3.js} +36 -60
- package/build/{cli-bc05qbss.js → cli-h6y3bt60.js} +13 -21
- package/build/{cli-tkc598ey.js → cli-j1916nvj.js} +10035 -7661
- package/build/{cli-5k33webc.js → cli-jw1xftqm.js} +355 -332
- package/build/{cli-tznv8pf1.js → cli-n4h7ygp5.js} +4 -4
- package/build/{cli-b1adytsy.js → cli-q45hcq3f.js} +67 -39
- package/build/{cli-repbyhkk.js → cli-qkb3v2nw.js} +26063 -25373
- package/build/{cli-j54qa6tm.js → cli-qktcyj48.js} +1 -1
- package/build/cli-retw3rw5.js +12 -0
- package/build/cli-tjm77pmx.js +12075 -0
- package/build/{cli-dm0fc0bm.js → cli-v1sarr4y.js} +5 -9
- package/build/{cli-9rhzhgx2.js → cli-v8ph8hy2.js} +5 -5
- package/build/{cli-vq52kp7j.js → cli-vkxx4jzv.js} +147 -128
- package/build/cli-wfb4gde1.js +22 -0
- package/build/{cli-ee3axgts.js → cli-xbhr5khz.js} +1 -1
- package/build/cli-z82n3qk1.js +6 -0
- package/build/cli.js +689 -132
- package/build/{config-f1mj4nhd.js → config-kv5v9ctn.js} +29 -29
- package/build/{doctor-ekneewa3.js → doctor-xs4s5km8.js} +4 -9
- package/build/{fastStrike-8zka43xs.js → fastStrike-b8t8f916.js} +26 -28
- package/build/{fixes-b89s5haw.js → fixes-kcckqx3s.js} +22 -27
- package/build/getMachineId-bsd-zr67nd9p.js +36 -0
- package/build/getMachineId-darwin-fd1d562d.js +36 -0
- package/build/getMachineId-linux-kjmg243j.js +29 -0
- package/build/getMachineId-unsupported-n4r58vke.js +19 -0
- package/build/getMachineId-win-yzgpfsrb.js +38 -0
- package/build/index-3mzr07h0.js +9 -0
- package/build/index-63zf8jxx.js +12 -0
- package/build/index-a1bg29j1.js +1559 -0
- package/build/{index-cbwn03kz.js → index-a2xycbjs.js} +12 -31
- package/build/{index-6d22pyxt.js → index-ae81pvwg.js} +2995 -2432
- package/build/index-cbajq2xy.js +17 -0
- package/build/index-cn4p95gh.js +100 -0
- package/build/index-kas88svr.js +36 -0
- package/build/index-mr20g8k4.js +22 -0
- package/build/{index-psqjpw5m.js → index-nweqptgs.js} +7 -7
- package/build/{index-sf16jm0m.js → index-rx5jn1nz.js} +137 -162
- package/build/{issues-xx5bs4md.js → issues-jm28k288.js} +81 -35
- package/build/{logs-qtxe51w2.js → logs-r02tbz89.js} +20 -25
- package/build/{multipart-parser-g2xxkezz.js → multipart-parser-vjjdbpd1.js} +10 -10
- package/build/{offesecAgent-b9e2xm6v.js → offesecAgent-mmfejh1j.js} +6 -13
- package/build/{parse-rtccymzn.js → parse-cqecqrc5.js} +0 -4
- package/build/pentest-13jcm4cy.js +21 -0
- package/build/{pentests-6ks3szc4.js → pentests-jyn4zs7n.js} +23 -28
- package/build/{targetedPentest-s1ptvq8e.js → targetedPentest-m3qkbpv6.js} +16 -20
- package/build/{targets-sxygyj87.js → targets-rqv57as0.js} +22 -27
- package/build/threatModel-scmz36xr.js +19 -0
- package/build/{token-3bbp59y6.js → token-n0tmq8n5.js} +2 -2
- package/build/{token-util-6xjme11b.js → token-util-bv80pj47.js} +1 -2
- package/build/{uninstall-tvsh81v8.js → uninstall-bme62bdg.js} +7 -4
- package/build/{upload-7wdyyqmr.js → upload-hwpgx1ha.js} +7 -13
- package/build/{utils-7fwdkqk6.js → utils-abtz5mmk.js} +7 -29
- package/package.json +8 -2
- package/build/agent-mvpgvgks.js +0 -19
- package/build/agent-nhs1w5w0.js +0 -29
- package/build/authentication-3s97cpk4.js +0 -19
- package/build/blackboxAgent-gw0a1ca4.js +0 -19
- package/build/blackboxPentest-44333zss.js +0 -37
- package/build/cli-0n4r54hq.js +0 -414
- package/build/cli-72cvcqhg.js +0 -22
- package/build/cli-qqt4gj1w.js +0 -53
- package/build/cli-swpbx60z.js +0 -24441
- package/build/index-4ad3sdwk.js +0 -39
- package/build/index-ghwf5z3v.js +0 -12
- package/build/index-hqjdg6fg.js +0 -205
- package/build/index-mtq7kmxz.js +0 -12856
- package/build/index-rbzhk712.js +0 -33
- package/build/index-y5w6n3tb.js +0 -19
- package/build/main-mmjp338j.js +0 -324
- package/build/pentest-xtc1sjdw.js +0 -29
- package/build/threatModel-xsm6fwk5.js +0 -27
- /package/build/{cli-c8131c4q.js → cli-0wsh8j2t.js} +0 -0
- /package/build/{cli-e08r86zk.js → cli-b3dvxjgk.js} +0 -0
- /package/build/{cli-fw5r7pfj.js → cli-q126f6ef.js} +0 -0
- /package/build/{cli-9fsre5pt.js → cli-qba2x69h.js} +0 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import"./cli-wfb4gde1.js";
|
|
2
|
+
import {
|
|
3
|
+
scopedLogger,
|
|
4
|
+
init_lazyLogger,
|
|
5
|
+
createLogger,
|
|
6
|
+
init_structured
|
|
7
|
+
} from "./cli-j1916nvj.js";
|
|
8
|
+
import"./cli-qktcyj48.js";
|
|
9
|
+
|
|
10
|
+
// src/core/agents/specialized/findingJudge/index.ts
|
|
11
|
+
init_structured();
|
|
12
|
+
init_lazyLogger();
|
|
13
|
+
var log = scopedLogger(() => createLogger("FindingJudge"));
|
|
14
|
+
async function judgeFinding(input, ctx) {
|
|
15
|
+
try {
|
|
16
|
+
const { FindingJudgeAgent } = await import("./agent-ywewzc2h.js");
|
|
17
|
+
const agent = new FindingJudgeAgent({
|
|
18
|
+
finding: input,
|
|
19
|
+
model: ctx.model,
|
|
20
|
+
session: ctx.session,
|
|
21
|
+
authConfig: ctx.authConfig,
|
|
22
|
+
abortSignal: ctx.abortSignal,
|
|
23
|
+
eventBus: ctx.eventBus,
|
|
24
|
+
subagentId: ctx.subagentId,
|
|
25
|
+
subagentName: ctx.subagentName,
|
|
26
|
+
sandbox: ctx.sandbox,
|
|
27
|
+
target: input.target ?? ctx.target ?? ctx.session.targets[0],
|
|
28
|
+
enableThinking: ctx.enableThinking,
|
|
29
|
+
thinkingEffort: ctx.thinkingEffort,
|
|
30
|
+
openAIReasoningEffort: ctx.openAIReasoningEffort,
|
|
31
|
+
languageModelMiddleware: ctx.languageModelMiddleware,
|
|
32
|
+
usageRecorder: ctx.usageRecorder,
|
|
33
|
+
streamIdFactory: ctx.streamIdFactory
|
|
34
|
+
});
|
|
35
|
+
const result = await agent.consume();
|
|
36
|
+
if (!result) {
|
|
37
|
+
throw new Error("Finding judge agent finished without a response.");
|
|
38
|
+
}
|
|
39
|
+
return normalizeJudgeResult(result);
|
|
40
|
+
} catch (err) {
|
|
41
|
+
const fallback = createJudgeFailureResult(err, ctx.model);
|
|
42
|
+
log.warn("Agentic validation failed", {
|
|
43
|
+
model: fallback.error?.model,
|
|
44
|
+
type: fallback.error?.type,
|
|
45
|
+
message: fallback.error?.message
|
|
46
|
+
});
|
|
47
|
+
return fallback;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function normalizeJudgeResult(result) {
|
|
51
|
+
return {
|
|
52
|
+
valid: result.valid,
|
|
53
|
+
findingType: result.findingType,
|
|
54
|
+
confidence: result.confidence,
|
|
55
|
+
reasoning: result.reasoning,
|
|
56
|
+
concerns: result.concerns,
|
|
57
|
+
verificationSteps: result.verificationSteps,
|
|
58
|
+
toolEvidence: result.toolEvidence,
|
|
59
|
+
reproducedPoc: result.reproducedPoc,
|
|
60
|
+
webResearchUsed: result.webResearchUsed,
|
|
61
|
+
limitations: result.limitations
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function createJudgeFailureResult(err, model) {
|
|
65
|
+
const errObj = typeof err === "object" && err !== null ? err : {};
|
|
66
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
67
|
+
const type = err instanceof Error ? err.constructor.name : typeof err;
|
|
68
|
+
const stack = err instanceof Error ? err.stack : undefined;
|
|
69
|
+
const statusCode = errObj.status ?? errObj.statusCode ?? errObj.code;
|
|
70
|
+
const statusStr = statusCode != null ? ` [status=${statusCode}]` : "";
|
|
71
|
+
const isAbort = err instanceof Error && (err.name === "AbortError" || err.constructor.name === "DOMException");
|
|
72
|
+
const confidence = isAbort ? 0.3 : 0.4;
|
|
73
|
+
const diagnostic = `${type}${statusStr}: ${message.substring(0, 200)}`;
|
|
74
|
+
return {
|
|
75
|
+
valid: false,
|
|
76
|
+
findingType: "informational",
|
|
77
|
+
confidence,
|
|
78
|
+
reasoning: `Agentic finding judge could not complete (${diagnostic}). Rejecting the finding as unverified so unavailable judge infrastructure does not preserve false positives as vulnerabilities.`,
|
|
79
|
+
concerns: [
|
|
80
|
+
"Agentic judge infrastructure failed before producing a completed verification judgment.",
|
|
81
|
+
"The submitted PoC may have executed successfully, but the judge did not independently verify that it proves a material vulnerability."
|
|
82
|
+
],
|
|
83
|
+
verificationSteps: [],
|
|
84
|
+
toolEvidence: [],
|
|
85
|
+
reproducedPoc: false,
|
|
86
|
+
webResearchUsed: false,
|
|
87
|
+
limitations: [
|
|
88
|
+
"No independent judge verification was completed due to infrastructure failure."
|
|
89
|
+
],
|
|
90
|
+
error: {
|
|
91
|
+
message: `${message}${statusStr}`,
|
|
92
|
+
type,
|
|
93
|
+
model: String(model ?? "undefined"),
|
|
94
|
+
stack: stack?.substring(0, 500)
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
judgeFinding
|
|
100
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isConnected2,
|
|
3
|
+
disconnect2,
|
|
4
|
+
startDeviceFlow2,
|
|
5
|
+
pollWorkOSToken2,
|
|
6
|
+
pollLegacyToken2,
|
|
7
|
+
isTokenExpired2,
|
|
8
|
+
ensureValidToken2,
|
|
9
|
+
validateGateway2,
|
|
10
|
+
signGatewayRequest2,
|
|
11
|
+
fetchWorkspaces2,
|
|
12
|
+
pollForWorkspaceCreation2,
|
|
13
|
+
selectWorkspace2,
|
|
14
|
+
createWorkspaceSelection2,
|
|
15
|
+
pollWorkspaceSelection2,
|
|
16
|
+
init_auth
|
|
17
|
+
} from "./cli-j1916nvj.js";
|
|
18
|
+
import"./cli-wfb4gde1.js";
|
|
19
|
+
init_auth();
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
createWorkspaceSelection2 as createWorkspaceSelection,
|
|
23
|
+
disconnect2 as disconnect,
|
|
24
|
+
ensureValidToken2 as ensureValidToken,
|
|
25
|
+
fetchWorkspaces2 as fetchWorkspaces,
|
|
26
|
+
isConnected2 as isConnected,
|
|
27
|
+
isTokenExpired2 as isTokenExpired,
|
|
28
|
+
pollForWorkspaceCreation2 as pollForWorkspaceCreation,
|
|
29
|
+
pollLegacyToken2 as pollLegacyToken,
|
|
30
|
+
pollWorkOSToken2 as pollWorkOSToken,
|
|
31
|
+
pollWorkspaceSelection2 as pollWorkspaceSelection,
|
|
32
|
+
selectWorkspace2 as selectWorkspace,
|
|
33
|
+
signGatewayRequest2 as signGatewayRequest,
|
|
34
|
+
startDeviceFlow2 as startDeviceFlow,
|
|
35
|
+
validateGateway2 as validateGateway
|
|
36
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WHITEBOX_APPS_DISCOVERY_SYSTEM_PROMPT2,
|
|
3
|
+
WHITEBOX_DISCOVERY_SYSTEM_PROMPT2,
|
|
4
|
+
EndpointSchema2,
|
|
5
|
+
AppsDiscoveryResultSchema2,
|
|
6
|
+
DiscoverySummarySchema2,
|
|
7
|
+
WhiteboxAttackSurfaceAgent2
|
|
8
|
+
} from "./cli-gamfs2yq.js";
|
|
9
|
+
import"./cli-qba2x69h.js";
|
|
10
|
+
import"./cli-qkb3v2nw.js";
|
|
11
|
+
import"./cli-n4h7ygp5.js";
|
|
12
|
+
import"./cli-j1916nvj.js";
|
|
13
|
+
import"./cli-qktcyj48.js";
|
|
14
|
+
import"./cli-wfb4gde1.js";
|
|
15
|
+
export {
|
|
16
|
+
AppsDiscoveryResultSchema2 as AppsDiscoveryResultSchema,
|
|
17
|
+
DiscoverySummarySchema2 as DiscoverySummarySchema,
|
|
18
|
+
EndpointSchema2 as EndpointSchema,
|
|
19
|
+
WHITEBOX_APPS_DISCOVERY_SYSTEM_PROMPT2 as WHITEBOX_APPS_DISCOVERY_SYSTEM_PROMPT,
|
|
20
|
+
WHITEBOX_DISCOVERY_SYSTEM_PROMPT2 as WHITEBOX_DISCOVERY_SYSTEM_PROMPT,
|
|
21
|
+
WhiteboxAttackSurfaceAgent2 as WhiteboxAttackSurfaceAgent
|
|
22
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__commonJS,
|
|
3
3
|
__require
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-h6y3bt60.js";
|
|
5
5
|
|
|
6
6
|
// node_modules/ms/index.js
|
|
7
7
|
var require_ms = __commonJS(function(exports, module) {
|
|
@@ -566,8 +566,8 @@ var require_node = __commonJS(function(exports, module) {
|
|
|
566
566
|
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
567
567
|
}
|
|
568
568
|
function formatArgs(args) {
|
|
569
|
-
const { namespace: name, useColors
|
|
570
|
-
if (
|
|
569
|
+
const { namespace: name, useColors } = this;
|
|
570
|
+
if (useColors) {
|
|
571
571
|
const c = this.color;
|
|
572
572
|
const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
|
|
573
573
|
const prefix = ` ${colorCode};1m${name} \x1B[0m`;
|
|
@@ -690,12 +690,12 @@ var require_helpers = __commonJS(function(exports) {
|
|
|
690
690
|
exports.json = json;
|
|
691
691
|
function req(url, opts = {}) {
|
|
692
692
|
const href = typeof url === "string" ? url : url.href;
|
|
693
|
-
const
|
|
693
|
+
const req = (href.startsWith("https:") ? https : http).request(url, opts);
|
|
694
694
|
const promise = new Promise((resolve, reject) => {
|
|
695
|
-
|
|
695
|
+
req.once("response", resolve).once("error", reject).end();
|
|
696
696
|
});
|
|
697
|
-
|
|
698
|
-
return
|
|
697
|
+
req.then = promise.then.bind(promise);
|
|
698
|
+
return req;
|
|
699
699
|
}
|
|
700
700
|
exports.req = req;
|
|
701
701
|
});
|
|
@@ -1,38 +1,42 @@
|
|
|
1
|
+
import"./cli-wfb4gde1.js";
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
ToolsetStateSchema,
|
|
5
|
-
createDir,
|
|
3
|
+
init_zod,
|
|
4
|
+
schema,
|
|
6
5
|
descending,
|
|
6
|
+
init_id,
|
|
7
7
|
generateRandomName,
|
|
8
8
|
generateSessionName,
|
|
9
|
-
init_credentials,
|
|
10
|
-
init_id,
|
|
11
9
|
init_name,
|
|
10
|
+
CredentialManager,
|
|
11
|
+
init_credentials,
|
|
12
|
+
RateLimiter,
|
|
12
13
|
init_rateLimiter,
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
write,
|
|
15
|
+
createDir,
|
|
16
|
+
writeRaw,
|
|
15
17
|
read,
|
|
16
|
-
schema,
|
|
17
18
|
update,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
init_storage,
|
|
20
|
+
ToolsetStateSchema,
|
|
21
|
+
init_toolset
|
|
22
|
+
} from "./cli-j1916nvj.js";
|
|
22
23
|
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
string,
|
|
25
|
+
number,
|
|
26
|
+
boolean,
|
|
27
|
+
array,
|
|
28
|
+
object,
|
|
29
|
+
union,
|
|
30
|
+
discriminatedUnion,
|
|
31
|
+
record,
|
|
32
|
+
_enum,
|
|
33
|
+
literal
|
|
34
|
+
} from "./cli-tjm77pmx.js";
|
|
35
|
+
import"./cli-qktcyj48.js";
|
|
29
36
|
import {
|
|
30
37
|
getCurrentVersion,
|
|
31
38
|
init_installation
|
|
32
|
-
} from "./cli-
|
|
33
|
-
import {
|
|
34
|
-
__require
|
|
35
|
-
} from "./cli-bc05qbss.js";
|
|
39
|
+
} from "./cli-f5rw841m.js";
|
|
36
40
|
|
|
37
41
|
// src/core/session/index.ts
|
|
38
42
|
init_zod();
|
|
@@ -51,90 +55,90 @@ var EXFIL_OUTCOME_GUIDANCE = "Exfiltrate data to extract the flag value. " + "Cr
|
|
|
51
55
|
var DEFAULT_HEADER_RECORD = {
|
|
52
56
|
"User-Agent": "pensar-apex"
|
|
53
57
|
};
|
|
54
|
-
var AuthCredentialsObject =
|
|
55
|
-
username:
|
|
56
|
-
password:
|
|
57
|
-
loginUrl:
|
|
58
|
-
additionalFields:
|
|
59
|
-
apiKey:
|
|
60
|
-
role:
|
|
61
|
-
context:
|
|
62
|
-
tokens:
|
|
63
|
-
bearerToken:
|
|
64
|
-
cookies:
|
|
65
|
-
sessionToken:
|
|
66
|
-
customHeaders:
|
|
58
|
+
var AuthCredentialsObject = object({
|
|
59
|
+
username: string().optional(),
|
|
60
|
+
password: string().optional(),
|
|
61
|
+
loginUrl: string().optional(),
|
|
62
|
+
additionalFields: record(string(), string()).optional(),
|
|
63
|
+
apiKey: string().optional(),
|
|
64
|
+
role: string().optional(),
|
|
65
|
+
context: string().optional(),
|
|
66
|
+
tokens: object({
|
|
67
|
+
bearerToken: string().optional(),
|
|
68
|
+
cookies: string().optional(),
|
|
69
|
+
sessionToken: string().optional(),
|
|
70
|
+
customHeaders: record(string(), string()).optional()
|
|
67
71
|
}).optional()
|
|
68
72
|
});
|
|
69
|
-
var ScopeConstraintsObject =
|
|
70
|
-
allowedHosts:
|
|
71
|
-
allowedPorts:
|
|
72
|
-
strictScope:
|
|
73
|
+
var ScopeConstraintsObject = object({
|
|
74
|
+
allowedHosts: string().array().optional(),
|
|
75
|
+
allowedPorts: number().array().optional(),
|
|
76
|
+
strictScope: boolean().optional()
|
|
73
77
|
});
|
|
74
|
-
var SessionHeadersRecord =
|
|
75
|
-
var OffensiveHeadersConfigObject =
|
|
76
|
-
mode:
|
|
78
|
+
var SessionHeadersRecord = record(string(), string());
|
|
79
|
+
var OffensiveHeadersConfigObject = object({
|
|
80
|
+
mode: _enum(["none", "default", "custom"]).optional(),
|
|
77
81
|
headers: SessionHeadersRecord.optional()
|
|
78
82
|
});
|
|
79
|
-
var OperatorSettingsObject =
|
|
80
|
-
initialMode:
|
|
81
|
-
requireApproval:
|
|
82
|
-
enableSuggestions:
|
|
83
|
-
strikeMode:
|
|
83
|
+
var OperatorSettingsObject = object({
|
|
84
|
+
initialMode: _enum(["plan", "manual", "auto"]).default("manual"),
|
|
85
|
+
requireApproval: boolean().default(true),
|
|
86
|
+
enableSuggestions: boolean().default(true),
|
|
87
|
+
strikeMode: boolean().optional()
|
|
84
88
|
});
|
|
85
|
-
var EmailInboxConfigObject =
|
|
86
|
-
|
|
87
|
-
provider:
|
|
88
|
-
id:
|
|
89
|
-
name:
|
|
90
|
-
emailAddress:
|
|
91
|
-
accessToken:
|
|
92
|
-
refreshToken:
|
|
93
|
-
clientId:
|
|
94
|
-
clientSecret:
|
|
95
|
-
tokenExpiry:
|
|
89
|
+
var EmailInboxConfigObject = discriminatedUnion("provider", [
|
|
90
|
+
object({
|
|
91
|
+
provider: literal("gmail"),
|
|
92
|
+
id: string(),
|
|
93
|
+
name: string(),
|
|
94
|
+
emailAddress: string(),
|
|
95
|
+
accessToken: string(),
|
|
96
|
+
refreshToken: string(),
|
|
97
|
+
clientId: string().optional(),
|
|
98
|
+
clientSecret: string().optional(),
|
|
99
|
+
tokenExpiry: number().optional()
|
|
96
100
|
}),
|
|
97
|
-
|
|
98
|
-
provider:
|
|
99
|
-
id:
|
|
100
|
-
name:
|
|
101
|
-
emailAddress:
|
|
102
|
-
accessToken:
|
|
103
|
-
refreshToken:
|
|
104
|
-
clientId:
|
|
105
|
-
clientSecret:
|
|
106
|
-
tokenExpiry:
|
|
101
|
+
object({
|
|
102
|
+
provider: literal("outlook"),
|
|
103
|
+
id: string(),
|
|
104
|
+
name: string(),
|
|
105
|
+
emailAddress: string(),
|
|
106
|
+
accessToken: string(),
|
|
107
|
+
refreshToken: string(),
|
|
108
|
+
clientId: string().optional(),
|
|
109
|
+
clientSecret: string().optional(),
|
|
110
|
+
tokenExpiry: number().optional()
|
|
107
111
|
}),
|
|
108
|
-
|
|
109
|
-
provider:
|
|
110
|
-
id:
|
|
111
|
-
name:
|
|
112
|
-
emailAddress:
|
|
113
|
-
imapHost:
|
|
114
|
-
imapPort:
|
|
115
|
-
username:
|
|
116
|
-
password:
|
|
117
|
-
tls:
|
|
112
|
+
object({
|
|
113
|
+
provider: literal("imap"),
|
|
114
|
+
id: string(),
|
|
115
|
+
name: string(),
|
|
116
|
+
emailAddress: string(),
|
|
117
|
+
imapHost: string(),
|
|
118
|
+
imapPort: number(),
|
|
119
|
+
username: string(),
|
|
120
|
+
password: string(),
|
|
121
|
+
tls: boolean()
|
|
118
122
|
}),
|
|
119
|
-
|
|
120
|
-
provider:
|
|
121
|
-
id:
|
|
122
|
-
name:
|
|
123
|
-
emailAddress:
|
|
124
|
-
endpoint:
|
|
125
|
-
token:
|
|
123
|
+
object({
|
|
124
|
+
provider: literal("http"),
|
|
125
|
+
id: string(),
|
|
126
|
+
name: string(),
|
|
127
|
+
emailAddress: string(),
|
|
128
|
+
endpoint: string(),
|
|
129
|
+
token: string()
|
|
126
130
|
})
|
|
127
131
|
]);
|
|
128
|
-
var EmailIntegrationConfigObject =
|
|
129
|
-
inboxes:
|
|
132
|
+
var EmailIntegrationConfigObject = object({
|
|
133
|
+
inboxes: array(EmailInboxConfigObject)
|
|
130
134
|
});
|
|
131
|
-
var SmtpConfigObject =
|
|
132
|
-
host:
|
|
133
|
-
port:
|
|
134
|
-
username:
|
|
135
|
-
password:
|
|
136
|
-
tls:
|
|
137
|
-
fromAddress:
|
|
135
|
+
var SmtpConfigObject = object({
|
|
136
|
+
host: string(),
|
|
137
|
+
port: number(),
|
|
138
|
+
username: string(),
|
|
139
|
+
password: string(),
|
|
140
|
+
tls: boolean().default(true),
|
|
141
|
+
fromAddress: string().optional()
|
|
138
142
|
});
|
|
139
143
|
function resolveSmtpConfig(explicit) {
|
|
140
144
|
if (explicit)
|
|
@@ -167,30 +171,31 @@ function resolveSmtpConfig(explicit) {
|
|
|
167
171
|
}
|
|
168
172
|
return;
|
|
169
173
|
}
|
|
170
|
-
var SessionConfigObject =
|
|
174
|
+
var SessionConfigObject = object({
|
|
171
175
|
headers: SessionHeadersRecord.optional(),
|
|
172
176
|
offensiveHeaders: OffensiveHeadersConfigObject.optional(),
|
|
173
|
-
sessionType:
|
|
174
|
-
mode:
|
|
175
|
-
outcomeGuidance:
|
|
177
|
+
sessionType: _enum(["web-app"]).optional(),
|
|
178
|
+
mode: _enum(["auto", "driver", "operator"]).optional(),
|
|
179
|
+
outcomeGuidance: string().optional(),
|
|
176
180
|
scopeConstraints: ScopeConstraintsObject.optional(),
|
|
177
|
-
authCredentials:
|
|
178
|
-
authenticationInstructions:
|
|
179
|
-
requestsPerSecond:
|
|
180
|
-
allowDestructiveActions:
|
|
181
|
-
allowRateLimitTesting:
|
|
181
|
+
authCredentials: union([AuthCredentialsObject, array(AuthCredentialsObject)]).optional(),
|
|
182
|
+
authenticationInstructions: string().optional(),
|
|
183
|
+
requestsPerSecond: number().optional(),
|
|
184
|
+
allowDestructiveActions: boolean().optional(),
|
|
185
|
+
allowRateLimitTesting: boolean().optional(),
|
|
182
186
|
operatorSettings: OperatorSettingsObject.optional(),
|
|
183
187
|
toolsetState: ToolsetStateSchema.optional(),
|
|
184
|
-
enumerateSubdomains:
|
|
185
|
-
codebasePath:
|
|
188
|
+
enumerateSubdomains: boolean().optional(),
|
|
189
|
+
codebasePath: string().optional(),
|
|
186
190
|
emailIntegration: EmailIntegrationConfigObject.optional(),
|
|
187
191
|
smtpConfig: SmtpConfigObject.optional(),
|
|
188
|
-
exfilMode:
|
|
189
|
-
agentCwd:
|
|
190
|
-
prompt:
|
|
191
|
-
taskDriven:
|
|
192
|
-
requirePlan:
|
|
193
|
-
|
|
192
|
+
exfilMode: boolean().optional(),
|
|
193
|
+
agentCwd: string().optional(),
|
|
194
|
+
prompt: string().optional(),
|
|
195
|
+
taskDriven: boolean().optional(),
|
|
196
|
+
requirePlan: boolean().optional(),
|
|
197
|
+
disableSubagents: boolean().optional(),
|
|
198
|
+
promptInjectionLibrarySource: string().optional()
|
|
194
199
|
});
|
|
195
200
|
function getPensarDir() {
|
|
196
201
|
return path.join(os.homedir(), ".pensar");
|
|
@@ -242,8 +247,8 @@ function normalizeDeprecatedHeaders(config) {
|
|
|
242
247
|
if (!config)
|
|
243
248
|
return config;
|
|
244
249
|
if (config.offensiveHeaders == null) {
|
|
245
|
-
const { offensiveHeaders: _drop, ...
|
|
246
|
-
return
|
|
250
|
+
const { offensiveHeaders: _drop, ...rest } = config;
|
|
251
|
+
return rest;
|
|
247
252
|
}
|
|
248
253
|
const { offensiveHeaders, ...rest } = config;
|
|
249
254
|
const restWithHeaders = rest;
|
|
@@ -273,21 +278,21 @@ function migrateLegacySessionData(input) {
|
|
|
273
278
|
return input;
|
|
274
279
|
return { ...root, config: normalizeDeprecatedHeaders(cfg) };
|
|
275
280
|
}
|
|
276
|
-
var SessionInfoObject =
|
|
281
|
+
var SessionInfoObject = object({
|
|
277
282
|
id: schema("session"),
|
|
278
|
-
name:
|
|
279
|
-
version:
|
|
280
|
-
targets:
|
|
283
|
+
name: string().optional(),
|
|
284
|
+
version: string(),
|
|
285
|
+
targets: array(string()),
|
|
281
286
|
config: SessionConfigObject.optional(),
|
|
282
|
-
time:
|
|
283
|
-
created:
|
|
284
|
-
updated:
|
|
287
|
+
time: object({
|
|
288
|
+
created: number(),
|
|
289
|
+
updated: number()
|
|
285
290
|
}),
|
|
286
|
-
rootPath:
|
|
287
|
-
logsPath:
|
|
288
|
-
findingsPath:
|
|
289
|
-
scratchpadPath:
|
|
290
|
-
pocsPath:
|
|
291
|
+
rootPath: string(),
|
|
292
|
+
logsPath: string(),
|
|
293
|
+
findingsPath: string(),
|
|
294
|
+
scratchpadPath: string(),
|
|
295
|
+
pocsPath: string()
|
|
291
296
|
});
|
|
292
297
|
async function create(input) {
|
|
293
298
|
const name = input.name ?? generateRandomName();
|
|
@@ -314,7 +319,7 @@ async function create(input) {
|
|
|
314
319
|
if (normalizedConfig?.headers !== undefined) {
|
|
315
320
|
snapshotHeaders = { ...normalizedConfig.headers };
|
|
316
321
|
} else {
|
|
317
|
-
const { config: appConfig } = await import("./index-
|
|
322
|
+
const { config: appConfig } = await import("./index-3mzr07h0.js");
|
|
318
323
|
const cfg = await appConfig.get();
|
|
319
324
|
snapshotHeaders = cfg.defaultHeaders ? { ...cfg.defaultHeaders } : { ...DEFAULT_HEADER_RECORD };
|
|
320
325
|
}
|
|
@@ -350,7 +355,8 @@ async function create(input) {
|
|
|
350
355
|
targets: input.targets,
|
|
351
356
|
userMessage: input.userMessage,
|
|
352
357
|
model: input.model,
|
|
353
|
-
authConfig: input.authConfig
|
|
358
|
+
authConfig: input.authConfig,
|
|
359
|
+
sessionId: result.id
|
|
354
360
|
}).then((aiName) => {
|
|
355
361
|
if (aiName) {
|
|
356
362
|
result.name = aiName;
|
|
@@ -382,27 +388,7 @@ async function update2(id, editor) {
|
|
|
382
388
|
});
|
|
383
389
|
return result;
|
|
384
390
|
}
|
|
385
|
-
|
|
386
|
-
const sessionsDir = getSessionsDir();
|
|
387
|
-
let entries;
|
|
388
|
-
try {
|
|
389
|
-
entries = await import("node:fs/promises").then((fsp) => fsp.readdir(sessionsDir, { withFileTypes: true }));
|
|
390
|
-
} catch {
|
|
391
|
-
return;
|
|
392
|
-
}
|
|
393
|
-
for (const entry of entries) {
|
|
394
|
-
if (!entry.isDirectory())
|
|
395
|
-
continue;
|
|
396
|
-
try {
|
|
397
|
-
yield await read([
|
|
398
|
-
"sessions",
|
|
399
|
-
entry.name,
|
|
400
|
-
"session"
|
|
401
|
-
]);
|
|
402
|
-
} catch {}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
var RemoveInput = zod_default.object({
|
|
391
|
+
var RemoveInput = object({
|
|
406
392
|
sessionId: schema("session")
|
|
407
393
|
});
|
|
408
394
|
var remove2 = async (input) => {
|
|
@@ -414,7 +400,7 @@ var remove2 = async (input) => {
|
|
|
414
400
|
console.error(e);
|
|
415
401
|
}
|
|
416
402
|
};
|
|
417
|
-
var RemoveMsgInput =
|
|
403
|
+
var RemoveMsgInput = object({
|
|
418
404
|
sessionId: schema("session"),
|
|
419
405
|
messageId: schema("message")
|
|
420
406
|
});
|
|
@@ -562,18 +548,7 @@ var sessions = {
|
|
|
562
548
|
updateSessionHeaders
|
|
563
549
|
};
|
|
564
550
|
export {
|
|
565
|
-
EXFIL_OUTCOME_GUIDANCE,
|
|
566
|
-
SessionInfoObject,
|
|
567
|
-
create,
|
|
568
|
-
get,
|
|
569
551
|
getResumeMessages,
|
|
570
|
-
getSessionRoot,
|
|
571
|
-
hasOperatorState,
|
|
572
|
-
list,
|
|
573
|
-
loadOperatorState,
|
|
574
|
-
migrateLegacySessionData,
|
|
575
552
|
normalizeMessages,
|
|
576
|
-
sessions
|
|
577
|
-
updateOperatorSettings,
|
|
578
|
-
updateSessionHeaders
|
|
553
|
+
sessions
|
|
579
554
|
};
|