@pensar/apex 2.2.0 → 2.3.0-canary.9edb404e
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-ay2c5dr5.js +19 -0
- package/build/{agent-q5hwjdtb.js → agent-g0eevawk.js} +9 -9
- package/build/{agent-yayy5x2a.js → agent-jzdyntjq.js} +7 -7
- package/build/{apps-0es69e2s.js → apps-dhk1qw86.js} +16 -16
- package/build/{auth-q73k9bh9.js → auth-tckzn9r5.js} +32 -39
- package/build/authentication-b1r4bhnc.js +19 -0
- package/build/blackboxAgent-9r7bdabg.js +19 -0
- package/build/{blackboxPentest-h28nykk5.js → blackboxPentest-zhbemsh3.js} +14 -14
- package/build/{cli-xbdn034b.js → cli-1rv86z6y.js} +4007 -61
- package/build/{cli-xpn9tsw0.js → cli-2p85ycnd.js} +3 -3
- package/build/{cli-51dkmt5p.js → cli-3trffpp2.js} +1 -1
- package/build/{cli-1f636vzd.js → cli-a7zrapxn.js} +1 -1
- package/build/{cli-ptzy9ak5.js → cli-c06dq4hj.js} +1 -1
- package/build/{cli-6kx46ck0.js → cli-f4mfvjp4.js} +19 -6
- package/build/{cli-7n43wz82.js → cli-fxghs4c4.js} +4 -2
- package/build/{cli-tz9yg4ew.js → cli-g6v0y8zp.js} +8 -8
- package/build/{cli-1cf5vy5m.js → cli-g9kmsvhw.js} +60 -28
- package/build/{cli-vgg6h2ax.js → cli-grdzdbye.js} +1 -1
- package/build/{cli-2jn8104w.js → cli-hyv0m4sf.js} +2 -2
- package/build/{cli-s43t5ay0.js → cli-kghddcpa.js} +1 -1
- package/build/{cli-7e5ad5js.js → cli-m6d8tekt.js} +2 -2
- package/build/{cli-knqx15w6.js → cli-r3d63aym.js} +2 -2
- package/build/{cli-4tc6888c.js → cli-sgy9czg3.js} +51 -2
- package/build/{cli-1re2kv5v.js → cli-ssrtpxs4.js} +3 -3
- package/build/{cli-n114n8mk.js → cli-twxay3td.js} +2 -2
- package/build/cli.js +33 -33
- package/build/{config-xcf7rc6x.js → config-r30y6cva.js} +3 -3
- package/build/{doctor-98zperf9.js → doctor-a6g5teq9.js} +6 -6
- package/build/{fastStrike-9tm6bedh.js → fastStrike-bc7qpqzg.js} +9 -9
- package/build/{fixes-1dry8j61.js → fixes-bh4z72yk.js} +16 -16
- package/build/{index-31rwrakh.js → index-6t25hxdm.js} +2 -2
- package/build/{index-4hqbyzf5.js → index-acw0cpth.js} +8 -8
- package/build/{index-0j880wqc.js → index-bmceymmf.js} +1080 -898
- package/build/{index-pxwwcefn.js → index-dtsqq9cx.js} +9 -9
- package/build/{index-34h2nb6x.js → index-fx2ks1ym.js} +3 -3
- package/build/{index-6dbym5jy.js → index-mtcv525q.js} +21 -8
- package/build/{index-f6ttv7np.js → index-nrfwa0v4.js} +9 -5
- package/build/{issues-wjakj8yy.js → issues-bcykrext.js} +44 -16
- package/build/{logs-ewyzcspy.js → logs-7trwwqx0.js} +16 -16
- package/build/{offesecAgent-7m9smy0t.js → offesecAgent-stjyg63c.js} +8 -8
- package/build/pentest-c2264wqp.js +29 -0
- package/build/{pentests-1hcqjyk2.js → pentests-33z7wyr7.js} +16 -16
- package/build/{targetedPentest-3x13kqvc.js → targetedPentest-gbz1j2ds.js} +9 -9
- package/build/{targets-nqz8w37e.js → targets-y4k8sm5r.js} +16 -16
- package/build/threatModel-7cjmq3sh.js +27 -0
- package/build/{uninstall-p1q5pkx2.js → uninstall-78hw1vm9.js} +1 -1
- package/build/{upload-x7etpfp4.js → upload-8a7wpn2j.js} +6 -6
- package/build/{utils-kw6yh5yn.js → utils-ks6swy5x.js} +5 -5
- package/package.json +1 -1
- package/build/agent-3cdfwxcd.js +0 -19
- package/build/authentication-tqx2brcv.js +0 -19
- package/build/blackboxAgent-d0smgqt7.js +0 -19
- package/build/pentest-1cb5t0dt.js +0 -29
- package/build/threatModel-7f02av7y.js +0 -27
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OffensiveSecurityAgent
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-1rv86z6y.js";
|
|
4
4
|
import {
|
|
5
5
|
detectOSAndEnhancePrompt
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-kghddcpa.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-f4mfvjp4.js";
|
|
15
15
|
|
|
16
16
|
// src/core/agents/specialized/authenticationAgent/agent.ts
|
|
17
17
|
init_dist();
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
init_auth,
|
|
5
5
|
init_constants,
|
|
6
6
|
signGatewayRequest
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-sgy9czg3.js";
|
|
8
8
|
import {
|
|
9
9
|
AISDKError,
|
|
10
10
|
APICallError,
|
|
@@ -87,11 +87,11 @@ import {
|
|
|
87
87
|
import {
|
|
88
88
|
config,
|
|
89
89
|
init_config
|
|
90
|
-
} from "./cli-
|
|
90
|
+
} from "./cli-3trffpp2.js";
|
|
91
91
|
import {
|
|
92
92
|
getCurrentVersion,
|
|
93
93
|
init_installation
|
|
94
|
-
} from "./cli-
|
|
94
|
+
} from "./cli-a7zrapxn.js";
|
|
95
95
|
import {
|
|
96
96
|
__callDispose,
|
|
97
97
|
__commonJS,
|
|
@@ -47127,7 +47127,7 @@ async function create2(input) {
|
|
|
47127
47127
|
if (normalizedConfig?.headers !== undefined) {
|
|
47128
47128
|
snapshotHeaders = { ...normalizedConfig.headers };
|
|
47129
47129
|
} else {
|
|
47130
|
-
const { config: appConfig } = await import("./index-
|
|
47130
|
+
const { config: appConfig } = await import("./index-fx2ks1ym.js");
|
|
47131
47131
|
const cfg = await appConfig.get();
|
|
47132
47132
|
snapshotHeaders = cfg.defaultHeaders ? { ...cfg.defaultHeaders } : { ...DEFAULT_HEADER_RECORD };
|
|
47133
47133
|
}
|
|
@@ -47303,7 +47303,8 @@ async function updateOperatorSettings(sessionId, settings) {
|
|
|
47303
47303
|
session.config.operatorSettings = {
|
|
47304
47304
|
initialMode: "manual",
|
|
47305
47305
|
requireApproval: true,
|
|
47306
|
-
enableSuggestions: true
|
|
47306
|
+
enableSuggestions: true,
|
|
47307
|
+
strikeMode: false
|
|
47307
47308
|
};
|
|
47308
47309
|
}
|
|
47309
47310
|
if (settings.initialMode !== undefined) {
|
|
@@ -47315,6 +47316,9 @@ async function updateOperatorSettings(sessionId, settings) {
|
|
|
47315
47316
|
if (settings.enableSuggestions !== undefined) {
|
|
47316
47317
|
session.config.operatorSettings.enableSuggestions = settings.enableSuggestions;
|
|
47317
47318
|
}
|
|
47319
|
+
if (settings.strikeMode !== undefined) {
|
|
47320
|
+
session.config.operatorSettings.strikeMode = settings.strikeMode;
|
|
47321
|
+
}
|
|
47318
47322
|
});
|
|
47319
47323
|
}
|
|
47320
47324
|
async function updateSessionHeaders(sessionId, headers) {
|
|
@@ -47387,7 +47391,8 @@ var init_session = __esm(() => {
|
|
|
47387
47391
|
OperatorSettingsObject = zod_default.object({
|
|
47388
47392
|
initialMode: zod_default.enum(["plan", "manual", "auto"]).default("manual"),
|
|
47389
47393
|
requireApproval: zod_default.boolean().default(true),
|
|
47390
|
-
enableSuggestions: zod_default.boolean().default(true)
|
|
47394
|
+
enableSuggestions: zod_default.boolean().default(true),
|
|
47395
|
+
strikeMode: zod_default.boolean().optional()
|
|
47391
47396
|
});
|
|
47392
47397
|
EmailInboxConfigObject = zod_default.discriminatedUnion("provider", [
|
|
47393
47398
|
zod_default.object({
|
|
@@ -47422,6 +47427,14 @@ var init_session = __esm(() => {
|
|
|
47422
47427
|
username: zod_default.string(),
|
|
47423
47428
|
password: zod_default.string(),
|
|
47424
47429
|
tls: zod_default.boolean()
|
|
47430
|
+
}),
|
|
47431
|
+
zod_default.object({
|
|
47432
|
+
provider: zod_default.literal("http"),
|
|
47433
|
+
id: zod_default.string(),
|
|
47434
|
+
name: zod_default.string(),
|
|
47435
|
+
emailAddress: zod_default.string(),
|
|
47436
|
+
endpoint: zod_default.string(),
|
|
47437
|
+
token: zod_default.string()
|
|
47425
47438
|
})
|
|
47426
47439
|
]);
|
|
47427
47440
|
EmailIntegrationConfigObject = zod_default.object({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCurrentVersion,
|
|
3
3
|
init_installation
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-a7zrapxn.js";
|
|
5
5
|
import {
|
|
6
6
|
__esm
|
|
7
7
|
} from "./cli-8rxa073f.js";
|
|
@@ -38,6 +38,7 @@ function applyEnvFallbacks(parsedConfig) {
|
|
|
38
38
|
...parsedConfig,
|
|
39
39
|
responsibleUseAccepted: parsedConfig.responsibleUseAccepted ?? false,
|
|
40
40
|
defaultHeaders: parsedConfig.defaultHeaders ?? DEFAULT_CONFIG.defaultHeaders,
|
|
41
|
+
strikeMode: parsedConfig.strikeMode ?? DEFAULT_CONFIG.strikeMode,
|
|
41
42
|
surfaceIntegrationEnabled: parsedConfig.surfaceIntegrationEnabled ?? parseBoolEnv(process.env.PENSAR_SURFACE_INTEGRATION),
|
|
42
43
|
version,
|
|
43
44
|
openAiAPIKey: parsedConfig.openAiAPIKey ?? process.env.OPENAI_API_KEY,
|
|
@@ -78,7 +79,8 @@ var init_config = __esm(() => {
|
|
|
78
79
|
init_installation();
|
|
79
80
|
DEFAULT_CONFIG = {
|
|
80
81
|
responsibleUseAccepted: false,
|
|
81
|
-
defaultHeaders: { "User-Agent": "pensar-apex" }
|
|
82
|
+
defaultHeaders: { "User-Agent": "pensar-apex" },
|
|
83
|
+
strikeMode: false
|
|
82
84
|
};
|
|
83
85
|
});
|
|
84
86
|
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BlackboxAttackSurfaceAgent
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-ssrtpxs4.js";
|
|
4
4
|
import {
|
|
5
5
|
REPORT_FILENAME_JSON,
|
|
6
6
|
REPORT_FILENAME_MD,
|
|
7
7
|
buildPentestReport,
|
|
8
8
|
renderJson,
|
|
9
9
|
renderMarkdown
|
|
10
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-hyv0m4sf.js";
|
|
11
11
|
import {
|
|
12
12
|
TargetedPentestAgent,
|
|
13
13
|
buildPentestSystemPrompt
|
|
14
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-twxay3td.js";
|
|
15
15
|
import {
|
|
16
16
|
CodeAgent
|
|
17
|
-
} from "./cli-
|
|
17
|
+
} from "./cli-r3d63aym.js";
|
|
18
18
|
import {
|
|
19
19
|
AppsDiscoveryResultSchema,
|
|
20
20
|
DiscoverySummarySchema,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
WHITEBOX_APPS_DISCOVERY_SYSTEM_PROMPT,
|
|
23
23
|
WHITEBOX_DISCOVERY_SYSTEM_PROMPT,
|
|
24
24
|
WHITEBOX_ENDPOINT_DOCUMENTATION_SYSTEM_PROMPT
|
|
25
|
-
} from "./cli-
|
|
25
|
+
} from "./cli-m6d8tekt.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-1rv86z6y.js";
|
|
35
35
|
import {
|
|
36
36
|
createThreatModelPrompt
|
|
37
37
|
} from "./cli-fw5r7pfj.js";
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
init_structured,
|
|
46
46
|
newSessionId,
|
|
47
47
|
scopedLogger
|
|
48
|
-
} from "./cli-
|
|
48
|
+
} from "./cli-f4mfvjp4.js";
|
|
49
49
|
import {
|
|
50
50
|
__require
|
|
51
51
|
} from "./cli-8rxa073f.js";
|
|
@@ -7786,7 +7786,7 @@ async function runPentestSwarm(input) {
|
|
|
7786
7786
|
}
|
|
7787
7787
|
async function runPentestWorkflow(input) {
|
|
7788
7788
|
if (input.fastStrike) {
|
|
7789
|
-
const { runFastStrike } = await import("./fastStrike-
|
|
7789
|
+
const { runFastStrike } = await import("./fastStrike-bc7qpqzg.js");
|
|
7790
7790
|
return runFastStrike(input);
|
|
7791
7791
|
}
|
|
7792
7792
|
const {
|
|
@@ -4,19 +4,19 @@ import {
|
|
|
4
4
|
OffensiveSecurityAgent,
|
|
5
5
|
SKILL_TOOL_NAMES,
|
|
6
6
|
buildBaseSystemPrompt
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-1rv86z6y.js";
|
|
8
8
|
import {
|
|
9
9
|
init_dist,
|
|
10
10
|
init_session,
|
|
11
11
|
sessions,
|
|
12
12
|
stepCountIs
|
|
13
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-f4mfvjp4.js";
|
|
14
14
|
import {
|
|
15
15
|
ensureValidToken,
|
|
16
16
|
getPensarApiUrl,
|
|
17
17
|
init_auth,
|
|
18
18
|
init_constants
|
|
19
|
-
} from "./cli-
|
|
19
|
+
} from "./cli-sgy9czg3.js";
|
|
20
20
|
import {
|
|
21
21
|
exports_external,
|
|
22
22
|
init_zod
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import {
|
|
25
25
|
config,
|
|
26
26
|
init_config
|
|
27
|
-
} from "./cli-
|
|
27
|
+
} from "./cli-3trffpp2.js";
|
|
28
28
|
import {
|
|
29
29
|
__commonJS,
|
|
30
30
|
__require
|
|
@@ -7135,6 +7135,12 @@ async function updateIssue(issueId, data) {
|
|
|
7135
7135
|
async function retestIssue(issueId) {
|
|
7136
7136
|
return apiRequest("POST", `/issues/${issueId}/retest`);
|
|
7137
7137
|
}
|
|
7138
|
+
async function linkPullRequest(issueId, url) {
|
|
7139
|
+
return apiRequest("POST", `/issues/${issueId}/pull-requests`, { url });
|
|
7140
|
+
}
|
|
7141
|
+
async function listIssuePullRequests(issueId) {
|
|
7142
|
+
return apiRequest("GET", `/issues/${issueId}/pull-requests`);
|
|
7143
|
+
}
|
|
7138
7144
|
async function listFixes(issueId) {
|
|
7139
7145
|
return apiRequest("GET", `/issues/${issueId}/fixes`);
|
|
7140
7146
|
}
|
|
@@ -7322,46 +7328,60 @@ async function runOffensiveSecurityAgent(input) {
|
|
|
7322
7328
|
return { streamResult: agent.streamResult, session: agent.session };
|
|
7323
7329
|
}
|
|
7324
7330
|
// src/core/agents/specialized/patching/prompts.ts
|
|
7325
|
-
var PREAMBLE2 = `You are an expert security vulnerability patching agent. Your goal is to analyze security vulnerabilities,
|
|
7331
|
+
var PREAMBLE2 = `You are an expert security vulnerability patching agent — an autonomous coding agent specialized in fixing security issues. Your goal is to analyze security vulnerabilities, apply high-quality fixes, verify they don't break existing functionality, and return structured PR metadata.`;
|
|
7326
7332
|
var ORIENT_STEP = `1. **Orient Yourself**:
|
|
7327
|
-
-
|
|
7328
|
-
- Use list_files to explore the repository structure
|
|
7333
|
+
- Read the project instructions (AGENTS.md / CLAUDE.md) provided in your prompt in full. They are authoritative for this repository: coding conventions, architectural rules, error-handling policy, forbidden patterns, AND the exact build/lint/test commands
|
|
7334
|
+
- Use glob / list_files to explore the repository structure (prefer glob for pattern searches like "**/*.ts")
|
|
7329
7335
|
- Read package.json, Makefile, or equivalent to understand the project's toolchain
|
|
7330
|
-
- Identify the lint command, test command, type-check command, and any other verification scripts
|
|
7331
|
-
|
|
7336
|
+
- Identify the lint command, test command, type-check command, and any other verification scripts
|
|
7337
|
+
- Optionally call profile_codebase for a high-level map of the repo`;
|
|
7338
|
+
var TASK_STEP = `2. **Track Work with Tasks**:
|
|
7339
|
+
- Use create_task early to decompose the job into concrete steps (orient, understand, edit, verify, finalize)
|
|
7340
|
+
- Update tasks with update_task as you progress (in_progress → completed / failed)
|
|
7341
|
+
- Use list_tasks when you need to recall what's left
|
|
7342
|
+
- Keep tasks atomic — one clear outcome per task`;
|
|
7343
|
+
var UNDERSTAND_STEP = `3. **Understand the Vulnerability**:
|
|
7332
7344
|
- Carefully read the vulnerability description, CWE mappings, and any dataflow analysis provided
|
|
7333
7345
|
- Understand the root cause: What makes this code vulnerable?
|
|
7334
7346
|
- Identify the attack vector: How would an attacker exploit this?
|
|
7335
|
-
- Consider the context: What is the application trying to do
|
|
7336
|
-
|
|
7347
|
+
- Consider the context: What is the application trying to do?
|
|
7348
|
+
- Use web_search / get_page when you need framework-specific security guidance or CVE details`;
|
|
7349
|
+
var REVIEW_STEP = `4. **Review the Code**:
|
|
7337
7350
|
- Use read_file to read the vulnerable file(s) mentioned in the issue
|
|
7338
|
-
- Use grep
|
|
7351
|
+
- Use grep or run_code_query for structural searches (rg / ast-grep) across related patterns
|
|
7339
7352
|
- Review related files: imports, dependencies, configuration files
|
|
7340
7353
|
- Understand the data flow: Where does user input come from? Where does it go?`;
|
|
7341
|
-
var PLAN_STEP = `
|
|
7354
|
+
var PLAN_STEP = `5. **Plan Your Fix**:
|
|
7342
7355
|
- Identify the exact code that needs to change
|
|
7343
7356
|
- Determine the appropriate security control (input validation, parameterized queries, access control, etc.)
|
|
7344
7357
|
- Consider side effects: Will this break existing functionality?
|
|
7345
7358
|
- Think about edge cases: What other inputs or scenarios need to be handled?
|
|
7346
7359
|
- Look for framework-specific or language-specific best practices
|
|
7347
|
-
- State your complete plan clearly before making changes`;
|
|
7348
|
-
var APPLY_STEP = `
|
|
7349
|
-
-
|
|
7360
|
+
- State your complete plan clearly before making changes, and reflect it in your task list`;
|
|
7361
|
+
var APPLY_STEP = `6. **Apply the Patch**:
|
|
7362
|
+
- Prefer update_file for small, exact string replacements
|
|
7363
|
+
- Prefer apply_patch (unified diff) for multi-hunk or multi-file edits
|
|
7350
7364
|
- Use create_file if you need to add new security utilities or middleware
|
|
7365
|
+
- Use delete_file only when removing obsolete insecure code that is truly unused
|
|
7351
7366
|
- Make minimal, targeted changes — don't refactor unrelated code
|
|
7352
|
-
- Follow the existing code style and conventions
|
|
7367
|
+
- Follow the existing code style and conventions, and any rules stated in the project instructions
|
|
7353
7368
|
- Ensure your changes integrate cleanly with the existing codebase`;
|
|
7354
|
-
var
|
|
7369
|
+
var GIT_STEP = `7. **Self-Check with Git**:
|
|
7370
|
+
- Use git_status to see which files changed
|
|
7371
|
+
- Use git_diff to review the exact patch before verification
|
|
7372
|
+
- Do NOT commit, push, or open a PR — the host handles that after you finalize`;
|
|
7373
|
+
var RESTART_STEP = `8. **Restart Dev Environment** (if applicable):
|
|
7355
7374
|
- Use execute_command to restart any dev servers or services so your changes are loaded
|
|
7356
7375
|
- Wait for the services to become healthy`;
|
|
7357
|
-
var VERIFY_STEP = `
|
|
7376
|
+
var VERIFY_STEP = `9. **Verify the Patch**:
|
|
7358
7377
|
- Use execute_command to run the project's lint command (e.g. \`npm run lint\`, \`ruff check\`, \`cargo clippy\`)
|
|
7359
7378
|
- Use execute_command to run the project's type-check command if applicable (e.g. \`npx tsc --noEmit\`, \`mypy\`)
|
|
7360
7379
|
- Use execute_command to run the project's test suite (e.g. \`npm test\`, \`pytest\`, \`cargo test\`)
|
|
7361
7380
|
- If a Proof of Concept (POC) is provided, run it to verify the vulnerability is fixed — the POC should FAIL (non-zero exit code) after a successful patch
|
|
7362
7381
|
- If any check fails, read the error output carefully, fix the issues, and re-run until all checks pass
|
|
7363
7382
|
- If the project has no clear lint/test commands, at minimum verify the changed files parse correctly (e.g. \`node -c file.js\`, \`python -m py_compile file.py\`)`;
|
|
7364
|
-
var FINALIZE_STEP = `
|
|
7383
|
+
var FINALIZE_STEP = `10. **Finalize**:
|
|
7384
|
+
- Mark remaining tasks completed
|
|
7365
7385
|
- Use the response tool to complete the patching process
|
|
7366
7386
|
- Provide a clear, detailed summary of:
|
|
7367
7387
|
* Each file you changed and why
|
|
@@ -7428,12 +7448,18 @@ var SECURITY_BEST_PRACTICES = `# Security Best Practices by Vulnerability Type
|
|
|
7428
7448
|
- Remove sensitive data from client-side code`;
|
|
7429
7449
|
var TOOL_USAGE2 = `# Tool Usage
|
|
7430
7450
|
|
|
7431
|
-
- **
|
|
7451
|
+
- **glob**: Find files by pattern (e.g. "**/*.ts", "**/package.json")
|
|
7452
|
+
- **list_files**: Explore directory structure
|
|
7432
7453
|
- **read_file**: Read file contents to understand code
|
|
7433
|
-
- **grep**: Search for patterns
|
|
7434
|
-
- **
|
|
7435
|
-
- **
|
|
7436
|
-
- **
|
|
7454
|
+
- **grep** / **run_code_query**: Search for patterns (run_code_query supports rg / ast-grep / comby)
|
|
7455
|
+
- **profile_codebase**: High-level codebase map when orientation is hard
|
|
7456
|
+
- **web_search** / **get_page**: Look up CVE details, framework security docs
|
|
7457
|
+
- **create_task** / **update_task** / **list_tasks**: Todo tracking for the run
|
|
7458
|
+
- **update_file**: Small exact search-and-replace edits
|
|
7459
|
+
- **apply_patch**: Multi-hunk / multi-file unified diffs
|
|
7460
|
+
- **create_file** / **delete_file**: Add or remove files when needed
|
|
7461
|
+
- **git_status** / **git_diff**: Self-check changes (do not commit/push/PR)
|
|
7462
|
+
- **execute_command**: Lint, type-check, tests, restart services, run POCs
|
|
7437
7463
|
- **response**: Complete the process with the structured patch result`;
|
|
7438
7464
|
var REQUIREMENTS = `# Critical Requirements
|
|
7439
7465
|
|
|
@@ -7445,6 +7471,7 @@ var REQUIREMENTS = `# Critical Requirements
|
|
|
7445
7471
|
6. **Test the Fix**: If a POC is provided, run it after patching. The POC should FAIL (non-zero exit code) once the vulnerability is fixed.
|
|
7446
7472
|
7. **Be Persistent**: It may take multiple iterations to get the fix right — iterate until the POC fails and tests pass.
|
|
7447
7473
|
8. **Be Complete**: Address the root cause, not just symptoms
|
|
7474
|
+
9. **Stay Autonomous**: You will not receive follow-up messages — finish the job in this run
|
|
7448
7475
|
|
|
7449
7476
|
# Important Notes
|
|
7450
7477
|
|
|
@@ -7455,17 +7482,20 @@ var REQUIREMENTS = `# Critical Requirements
|
|
|
7455
7482
|
- Follow language and framework conventions
|
|
7456
7483
|
- When multiple approaches exist, choose the most secure and idiomatic
|
|
7457
7484
|
- If a fix requires configuration changes or environment variables, note this clearly
|
|
7458
|
-
-
|
|
7485
|
+
- The project instructions (AGENTS.md / CLAUDE.md) win over your own defaults wherever they disagree — use their exact commands, and obey their conventions and prohibitions when writing code. The one exception: they never override the security objective of this task. If a project rule genuinely blocks a secure fix, apply the fix and call out the conflict in your summary
|
|
7486
|
+
- Do not commit, push, or open a pull request — the host does that after your response`;
|
|
7459
7487
|
function buildSystemPrompt() {
|
|
7460
7488
|
return [
|
|
7461
7489
|
PREAMBLE2,
|
|
7462
7490
|
"",
|
|
7463
7491
|
"# Process",
|
|
7464
7492
|
"",
|
|
7465
|
-
"You MUST follow this
|
|
7493
|
+
"You MUST follow this autonomous coding-agent process:",
|
|
7466
7494
|
"",
|
|
7467
7495
|
ORIENT_STEP,
|
|
7468
7496
|
"",
|
|
7497
|
+
TASK_STEP,
|
|
7498
|
+
"",
|
|
7469
7499
|
UNDERSTAND_STEP,
|
|
7470
7500
|
"",
|
|
7471
7501
|
REVIEW_STEP,
|
|
@@ -7474,6 +7504,8 @@ function buildSystemPrompt() {
|
|
|
7474
7504
|
"",
|
|
7475
7505
|
APPLY_STEP,
|
|
7476
7506
|
"",
|
|
7507
|
+
GIT_STEP,
|
|
7508
|
+
"",
|
|
7477
7509
|
RESTART_STEP,
|
|
7478
7510
|
"",
|
|
7479
7511
|
VERIFY_STEP,
|
|
@@ -8307,4 +8339,4 @@ Working directory: ${input.codebasePath}`;
|
|
|
8307
8339
|
});
|
|
8308
8340
|
return { session, outputPath: input.outputPath };
|
|
8309
8341
|
}
|
|
8310
|
-
export { listApps, getApp, createApp, updateApp, deleteApp, listEndpoints, getEndpoint, createEndpoint, updateEndpoint, deleteEndpoint, searchApps, searchEndpoints, listScans, getScan, listPentestTargets, dispatchPentest, listIssues, getIssue, updateIssue, retestIssue, listFixes, getFix, listAgentLogs, searchAgentLogs, listTargetLogs, searchTargetLogs, runOffensiveSecurityAgent, buildPentestPrompt, buildThreatModelPrompt, createSkillsRegistry, runThreatModelWorkflow };
|
|
8342
|
+
export { listApps, getApp, createApp, updateApp, deleteApp, listEndpoints, getEndpoint, createEndpoint, updateEndpoint, deleteEndpoint, searchApps, searchEndpoints, listScans, getScan, listPentestTargets, dispatchPentest, listIssues, getIssue, updateIssue, retestIssue, linkPullRequest, listIssuePullRequests, listFixes, getFix, listAgentLogs, searchAgentLogs, listTargetLogs, searchTargetLogs, runOffensiveSecurityAgent, buildPentestPrompt, buildThreatModelPrompt, createSkillsRegistry, runThreatModelWorkflow };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EvidenceFileEntrySchema
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-c06dq4hj.js";
|
|
4
4
|
import {
|
|
5
5
|
CweEntrySchema,
|
|
6
6
|
ValidatedCweEntrySchema,
|
|
7
7
|
hasCanonicalName
|
|
8
|
-
} from "./cli-
|
|
8
|
+
} from "./cli-1rv86z6y.js";
|
|
9
9
|
import {
|
|
10
10
|
exports_external,
|
|
11
11
|
init_zod
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
EndpointTransportEnum,
|
|
3
3
|
GrpcEndpointMetadataSchema,
|
|
4
4
|
OffensiveSecurityAgent
|
|
5
|
-
} from "./cli-
|
|
5
|
+
} from "./cli-1rv86z6y.js";
|
|
6
6
|
import {
|
|
7
7
|
hasToolCall,
|
|
8
8
|
init_dist
|
|
9
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-f4mfvjp4.js";
|
|
10
10
|
import {
|
|
11
11
|
exports_external,
|
|
12
12
|
init_zod,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OffensiveSecurityAgent
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-1rv86z6y.js";
|
|
4
4
|
import {
|
|
5
5
|
init_dist,
|
|
6
6
|
stepCountIs
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-f4mfvjp4.js";
|
|
8
8
|
|
|
9
9
|
// src/core/agents/specialized/codeAgent/agent.ts
|
|
10
10
|
init_dist();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
config,
|
|
3
3
|
init_config
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-3trffpp2.js";
|
|
5
5
|
import {
|
|
6
6
|
__esm
|
|
7
7
|
} from "./cli-8rxa073f.js";
|
|
@@ -350,6 +350,55 @@ async function selectWorkspace(apiUrl, accessToken, workspaceId) {
|
|
|
350
350
|
}
|
|
351
351
|
return await response.json();
|
|
352
352
|
}
|
|
353
|
+
async function createWorkspaceSelection(apiUrl, accessToken) {
|
|
354
|
+
const response = await fetch(`${apiUrl}/api/cli/workspace-selection`, {
|
|
355
|
+
method: "POST",
|
|
356
|
+
headers: {
|
|
357
|
+
"Content-Type": "application/json",
|
|
358
|
+
Authorization: `Bearer ${accessToken}`
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
if (!response.ok) {
|
|
362
|
+
throw new Error("Failed to start workspace selection");
|
|
363
|
+
}
|
|
364
|
+
return await response.json();
|
|
365
|
+
}
|
|
366
|
+
async function pollWorkspaceSelection(apiUrl, accessToken, selectionId, signal) {
|
|
367
|
+
const POLL_INTERVAL = 3000;
|
|
368
|
+
const TIMEOUT = 10 * 60 * 1000;
|
|
369
|
+
const deadline = Date.now() + TIMEOUT;
|
|
370
|
+
while (Date.now() < deadline) {
|
|
371
|
+
if (signal?.aborted)
|
|
372
|
+
throw new Error("Cancelled");
|
|
373
|
+
await sleep2(POLL_INTERVAL);
|
|
374
|
+
if (signal?.aborted)
|
|
375
|
+
throw new Error("Cancelled");
|
|
376
|
+
try {
|
|
377
|
+
const response = await fetch(`${apiUrl}/api/cli/workspace-selection?id=${encodeURIComponent(selectionId)}`, {
|
|
378
|
+
headers: { Authorization: `Bearer ${accessToken}` }
|
|
379
|
+
});
|
|
380
|
+
if (!response.ok)
|
|
381
|
+
continue;
|
|
382
|
+
const data = await response.json();
|
|
383
|
+
if (data.status === "complete" && data.workspaceId) {
|
|
384
|
+
return data.workspaceId;
|
|
385
|
+
}
|
|
386
|
+
if (data.status === "expired") {
|
|
387
|
+
throw new Error("Workspace selection expired. Please run `pensar login` again.");
|
|
388
|
+
}
|
|
389
|
+
} catch (err) {
|
|
390
|
+
if (signal?.aborted)
|
|
391
|
+
throw new Error("Cancelled");
|
|
392
|
+
if (err instanceof Error && err.message.includes("Please try again")) {
|
|
393
|
+
throw err;
|
|
394
|
+
}
|
|
395
|
+
if (err instanceof Error && err.message.includes("expired")) {
|
|
396
|
+
throw err;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
throw new Error("Workspace selection timed out. Please try again.");
|
|
401
|
+
}
|
|
353
402
|
var init_workspaces = () => {};
|
|
354
403
|
|
|
355
404
|
// src/core/auth/index.ts
|
|
@@ -362,4 +411,4 @@ var init_auth = __esm(() => {
|
|
|
362
411
|
init_workspaces();
|
|
363
412
|
});
|
|
364
413
|
|
|
365
|
-
export { getPensarApiUrl, getPensarGatewayUrl, getPensarConsoleUrl, init_constants, isConnected, disconnect, startDeviceFlow, pollWorkOSToken, pollLegacyToken, isTokenExpired, ensureValidToken, validateGateway, signGatewayRequest, fetchWorkspaces, pollForWorkspaceCreation, selectWorkspace, init_auth };
|
|
414
|
+
export { getPensarApiUrl, getPensarGatewayUrl, getPensarConsoleUrl, init_constants, isConnected, disconnect, startDeviceFlow, pollWorkOSToken, pollLegacyToken, isTokenExpired, ensureValidToken, validateGateway, signGatewayRequest, fetchWorkspaces, pollForWorkspaceCreation, selectWorkspace, createWorkspaceSelection, pollWorkspaceSelection, init_auth };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OffensiveSecurityAgent
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-1rv86z6y.js";
|
|
4
4
|
import {
|
|
5
5
|
detectOSAndEnhancePrompt
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-kghddcpa.js";
|
|
7
7
|
import {
|
|
8
8
|
hasToolCall,
|
|
9
9
|
init_dist,
|
|
10
10
|
stepCountIs
|
|
11
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-f4mfvjp4.js";
|
|
12
12
|
|
|
13
13
|
// src/core/agents/specialized/attackSurface/blackboxAgent.ts
|
|
14
14
|
init_dist();
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
createReportErrorTool,
|
|
6
6
|
isMemoryEnabled,
|
|
7
7
|
readPlan
|
|
8
|
-
} from "./cli-
|
|
8
|
+
} from "./cli-1rv86z6y.js";
|
|
9
9
|
import {
|
|
10
10
|
createLogger,
|
|
11
11
|
hasToolCall,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
init_lazyLogger,
|
|
14
14
|
init_structured,
|
|
15
15
|
scopedLogger
|
|
16
|
-
} from "./cli-
|
|
16
|
+
} from "./cli-f4mfvjp4.js";
|
|
17
17
|
import {
|
|
18
18
|
exports_external,
|
|
19
19
|
init_zod
|