@pensar/apex 2.2.0 → 2.3.0-canary.545f12fe
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-yayy5x2a.js → agent-28g40h1h.js} +7 -7
- package/build/{agent-q5hwjdtb.js → agent-ksxqhwz8.js} +9 -9
- package/build/agent-wqk2r9q4.js +19 -0
- package/build/{apps-0es69e2s.js → apps-csx75pk9.js} +16 -16
- package/build/{auth-q73k9bh9.js → auth-xk51kbta.js} +32 -39
- package/build/authentication-92gz89ht.js +19 -0
- package/build/blackboxAgent-4s6exxja.js +19 -0
- package/build/{blackboxPentest-h28nykk5.js → blackboxPentest-yej2rznw.js} +14 -14
- package/build/{cli-2jn8104w.js → cli-08ebfe16.js} +2 -2
- package/build/{cli-n114n8mk.js → cli-1dpatpjw.js} +2 -2
- package/build/{cli-7n43wz82.js → cli-1xqq625p.js} +4 -2
- package/build/{cli-6kx46ck0.js → cli-2b1fcxrx.js} +19 -6
- package/build/{cli-xbdn034b.js → cli-3q59v60j.js} +4015 -64
- package/build/{cli-4tc6888c.js → cli-683adz4a.js} +51 -2
- package/build/{cli-xpn9tsw0.js → cli-aqn5axrc.js} +3 -3
- package/build/{cli-1f636vzd.js → cli-atjcbeyz.js} +1 -1
- package/build/{cli-1re2kv5v.js → cli-b8djymsb.js} +3 -3
- package/build/{cli-ptzy9ak5.js → cli-cj6gf45y.js} +1 -1
- package/build/{cli-vgg6h2ax.js → cli-df54tdaz.js} +1 -1
- package/build/{cli-51dkmt5p.js → cli-e2qdjmmk.js} +1 -1
- package/build/{cli-s43t5ay0.js → cli-f1fn45dm.js} +1 -1
- package/build/{cli-knqx15w6.js → cli-fdh49tvn.js} +2 -2
- package/build/{cli-7e5ad5js.js → cli-jqfbbpvp.js} +2 -2
- package/build/{cli-tz9yg4ew.js → cli-nkgncst6.js} +8 -8
- package/build/{cli-1cf5vy5m.js → cli-qq5tzdaf.js} +60 -28
- package/build/cli.js +41 -36
- package/build/{config-xcf7rc6x.js → config-tf803ygw.js} +3 -3
- package/build/{doctor-98zperf9.js → doctor-hvmgtwsv.js} +6 -6
- package/build/{fastStrike-9tm6bedh.js → fastStrike-7ptrz6qt.js} +9 -9
- package/build/{fixes-1dry8j61.js → fixes-43ex34f1.js} +16 -16
- package/build/{index-0j880wqc.js → index-05epz60s.js} +1080 -898
- package/build/{index-31rwrakh.js → index-532vvmaf.js} +2 -2
- package/build/{index-34h2nb6x.js → index-5q4g038d.js} +3 -3
- package/build/{index-4hqbyzf5.js → index-9qd1rtbs.js} +8 -8
- package/build/{index-pxwwcefn.js → index-hmf9b8jd.js} +9 -9
- package/build/{index-6dbym5jy.js → index-hnecr3bj.js} +21 -8
- package/build/{index-f6ttv7np.js → index-vvqw4r20.js} +9 -5
- package/build/{issues-wjakj8yy.js → issues-p6spqtma.js} +44 -16
- package/build/{logs-ewyzcspy.js → logs-eq2nc2k3.js} +16 -16
- package/build/{offesecAgent-7m9smy0t.js → offesecAgent-zsc5vrek.js} +8 -8
- package/build/pentest-pnz2qm5t.js +29 -0
- package/build/{pentests-1hcqjyk2.js → pentests-8tqyzj9v.js} +16 -16
- package/build/{targetedPentest-3x13kqvc.js → targetedPentest-rpwgc6wf.js} +9 -9
- package/build/{targets-nqz8w37e.js → targets-8pd483mk.js} +16 -16
- package/build/threatModel-5h24gh6m.js +27 -0
- package/build/{uninstall-p1q5pkx2.js → uninstall-tc9xqgxy.js} +1 -1
- package/build/{upload-x7etpfp4.js → upload-nskdz2y3.js} +6 -6
- package/build/{utils-kw6yh5yn.js → utils-r7ndrdsp.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,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
config,
|
|
3
3
|
init_config
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-e2qdjmmk.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,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OffensiveSecurityAgent
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-3q59v60j.js";
|
|
4
4
|
import {
|
|
5
5
|
detectOSAndEnhancePrompt
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-f1fn45dm.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-2b1fcxrx.js";
|
|
15
15
|
|
|
16
16
|
// src/core/agents/specialized/authenticationAgent/agent.ts
|
|
17
17
|
init_dist();
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OffensiveSecurityAgent
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-3q59v60j.js";
|
|
4
4
|
import {
|
|
5
5
|
detectOSAndEnhancePrompt
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-f1fn45dm.js";
|
|
7
7
|
import {
|
|
8
8
|
hasToolCall,
|
|
9
9
|
init_dist,
|
|
10
10
|
stepCountIs
|
|
11
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-2b1fcxrx.js";
|
|
12
12
|
|
|
13
13
|
// src/core/agents/specialized/attackSurface/blackboxAgent.ts
|
|
14
14
|
init_dist();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OffensiveSecurityAgent
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-3q59v60j.js";
|
|
4
4
|
import {
|
|
5
5
|
init_dist,
|
|
6
6
|
stepCountIs
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-2b1fcxrx.js";
|
|
8
8
|
|
|
9
9
|
// src/core/agents/specialized/codeAgent/agent.ts
|
|
10
10
|
init_dist();
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
EndpointTransportEnum,
|
|
3
3
|
GrpcEndpointMetadataSchema,
|
|
4
4
|
OffensiveSecurityAgent
|
|
5
|
-
} from "./cli-
|
|
5
|
+
} from "./cli-3q59v60j.js";
|
|
6
6
|
import {
|
|
7
7
|
hasToolCall,
|
|
8
8
|
init_dist
|
|
9
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-2b1fcxrx.js";
|
|
10
10
|
import {
|
|
11
11
|
exports_external,
|
|
12
12
|
init_zod,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BlackboxAttackSurfaceAgent
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-b8djymsb.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-08ebfe16.js";
|
|
11
11
|
import {
|
|
12
12
|
TargetedPentestAgent,
|
|
13
13
|
buildPentestSystemPrompt
|
|
14
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-1dpatpjw.js";
|
|
15
15
|
import {
|
|
16
16
|
CodeAgent
|
|
17
|
-
} from "./cli-
|
|
17
|
+
} from "./cli-fdh49tvn.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-jqfbbpvp.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-3q59v60j.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-2b1fcxrx.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-7ptrz6qt.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-3q59v60j.js";
|
|
8
8
|
import {
|
|
9
9
|
init_dist,
|
|
10
10
|
init_session,
|
|
11
11
|
sessions,
|
|
12
12
|
stepCountIs
|
|
13
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-2b1fcxrx.js";
|
|
14
14
|
import {
|
|
15
15
|
ensureValidToken,
|
|
16
16
|
getPensarApiUrl,
|
|
17
17
|
init_auth,
|
|
18
18
|
init_constants
|
|
19
|
-
} from "./cli-
|
|
19
|
+
} from "./cli-683adz4a.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-e2qdjmmk.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 };
|
package/build/cli.js
CHANGED
|
@@ -14,16 +14,16 @@ import {
|
|
|
14
14
|
init_toolset,
|
|
15
15
|
init_utils,
|
|
16
16
|
logger
|
|
17
|
-
} from "./cli-
|
|
18
|
-
import"./cli-
|
|
17
|
+
} from "./cli-2b1fcxrx.js";
|
|
18
|
+
import"./cli-683adz4a.js";
|
|
19
19
|
import"./cli-3k1x5rn3.js";
|
|
20
20
|
import"./cli-gpnb45ck.js";
|
|
21
|
-
import"./cli-
|
|
22
|
-
import"./cli-
|
|
21
|
+
import"./cli-e2qdjmmk.js";
|
|
22
|
+
import"./cli-1xqq625p.js";
|
|
23
23
|
import {
|
|
24
24
|
init_package,
|
|
25
25
|
package_default
|
|
26
|
-
} from "./cli-
|
|
26
|
+
} from "./cli-atjcbeyz.js";
|
|
27
27
|
import {
|
|
28
28
|
__require,
|
|
29
29
|
__toESM
|
|
@@ -144,7 +144,7 @@ var package_default2 = {
|
|
|
144
144
|
tsc: "tsc --noEmit"
|
|
145
145
|
},
|
|
146
146
|
type: "module",
|
|
147
|
-
version: "2.
|
|
147
|
+
version: "2.3.0-canary.545f12fe"
|
|
148
148
|
};
|
|
149
149
|
|
|
150
150
|
// src/core/ai/index.ts
|
|
@@ -299,13 +299,18 @@ class AgentEventBus {
|
|
|
299
299
|
});
|
|
300
300
|
break;
|
|
301
301
|
case "reasoning-start":
|
|
302
|
-
this.emit("reasoning-start", { subagentId });
|
|
302
|
+
this.emit("reasoning-start", { subagentId, sessionId, messageId });
|
|
303
303
|
break;
|
|
304
304
|
case "reasoning-delta":
|
|
305
|
-
this.emit("reasoning-delta", {
|
|
305
|
+
this.emit("reasoning-delta", {
|
|
306
|
+
text: chunk.text,
|
|
307
|
+
subagentId,
|
|
308
|
+
sessionId,
|
|
309
|
+
messageId
|
|
310
|
+
});
|
|
306
311
|
break;
|
|
307
312
|
case "reasoning-end":
|
|
308
|
-
this.emit("reasoning-end", { subagentId });
|
|
313
|
+
this.emit("reasoning-end", { subagentId, sessionId, messageId });
|
|
309
314
|
break;
|
|
310
315
|
case "tool-input-start":
|
|
311
316
|
this.emit("tool-call-start", {
|
|
@@ -587,7 +592,7 @@ function attachCliAgentStreamListeners(bus) {
|
|
|
587
592
|
async function createInstrumentedBus(session) {
|
|
588
593
|
const bus = new AgentEventBus;
|
|
589
594
|
attachCliAgentStreamListeners(bus);
|
|
590
|
-
const { attachWandbToEventBus } = await import("./upload-
|
|
595
|
+
const { attachWandbToEventBus } = await import("./upload-nskdz2y3.js");
|
|
591
596
|
const wandbCleanup = await attachWandbToEventBus(session, bus).catch((e) => {
|
|
592
597
|
console.warn("[wandb] Tracing disabled:", e.message);
|
|
593
598
|
return null;
|
|
@@ -604,7 +609,7 @@ async function resolveCliHeaders() {
|
|
|
604
609
|
const { parseHeaderLine: parseHeaderLine2, parseHeadersFromFile, formatParseError: formatParseError2 } = await import("./parse-7djk9jyf.js");
|
|
605
610
|
const merged = {};
|
|
606
611
|
if (!noGlobal) {
|
|
607
|
-
const { config: appConfig } = await import("./index-
|
|
612
|
+
const { config: appConfig } = await import("./index-532vvmaf.js");
|
|
608
613
|
const cfg = await appConfig.get();
|
|
609
614
|
if (cfg.defaultHeaders) {
|
|
610
615
|
Object.assign(merged, cfg.defaultHeaders);
|
|
@@ -638,8 +643,8 @@ async function resolveCliModel() {
|
|
|
638
643
|
const explicit = getArg("--model");
|
|
639
644
|
if (explicit)
|
|
640
645
|
return explicit;
|
|
641
|
-
const { config: appConfig } = await import("./index-
|
|
642
|
-
const { getDefaultModelForConfig } = await import("./utils-
|
|
646
|
+
const { config: appConfig } = await import("./index-532vvmaf.js");
|
|
647
|
+
const { getDefaultModelForConfig } = await import("./utils-r7ndrdsp.js");
|
|
643
648
|
const pensarConfig = await appConfig.get();
|
|
644
649
|
const defaultModel = getDefaultModelForConfig(pensarConfig);
|
|
645
650
|
if (!defaultModel) {
|
|
@@ -727,9 +732,9 @@ Global options:
|
|
|
727
732
|
async function runPentest() {
|
|
728
733
|
const { config } = await import("./main-3d7dfdvs.js").then((m)=>__toESM(m.default,1));
|
|
729
734
|
config();
|
|
730
|
-
const { runPentestAgent } = await import("./blackboxPentest-
|
|
731
|
-
const { sessions: sessions2 } = await import("./index-
|
|
732
|
-
const { config: appConfig } = await import("./index-
|
|
735
|
+
const { runPentestAgent } = await import("./blackboxPentest-yej2rznw.js");
|
|
736
|
+
const { sessions: sessions2 } = await import("./index-hnecr3bj.js");
|
|
737
|
+
const { config: appConfig } = await import("./index-532vvmaf.js");
|
|
733
738
|
const target = getArgRequired("--target");
|
|
734
739
|
const cwd = getArg("--cwd");
|
|
735
740
|
const mode = getArg("--mode");
|
|
@@ -805,9 +810,9 @@ Report: ${reportPath}` : ""}`);
|
|
|
805
810
|
async function runTargetedPentest() {
|
|
806
811
|
const { config } = await import("./main-3d7dfdvs.js").then((m)=>__toESM(m.default,1));
|
|
807
812
|
config();
|
|
808
|
-
const { runTargetedPentestAgent } = await import("./targetedPentest-
|
|
809
|
-
const { sessions: sessions2 } = await import("./index-
|
|
810
|
-
const { config: appConfig } = await import("./index-
|
|
813
|
+
const { runTargetedPentestAgent } = await import("./targetedPentest-rpwgc6wf.js");
|
|
814
|
+
const { sessions: sessions2 } = await import("./index-hnecr3bj.js");
|
|
815
|
+
const { config: appConfig } = await import("./index-532vvmaf.js");
|
|
811
816
|
const target = getArgRequired("--target");
|
|
812
817
|
const objectives = getAllArgs("--objective");
|
|
813
818
|
const pensarConfig = await appConfig.get();
|
|
@@ -859,8 +864,8 @@ POCs: ${pocsPath}`);
|
|
|
859
864
|
async function runThreatModel() {
|
|
860
865
|
const { config } = await import("./main-3d7dfdvs.js").then((m)=>__toESM(m.default,1));
|
|
861
866
|
config();
|
|
862
|
-
const { runThreatModelWorkflow } = await import("./threatModel-
|
|
863
|
-
const { config: appConfig } = await import("./index-
|
|
867
|
+
const { runThreatModelWorkflow } = await import("./threatModel-5h24gh6m.js");
|
|
868
|
+
const { config: appConfig } = await import("./index-532vvmaf.js");
|
|
864
869
|
const path2 = await import("path");
|
|
865
870
|
const pensarConfig = await appConfig.get();
|
|
866
871
|
const model = await resolveCliModel();
|
|
@@ -896,10 +901,10 @@ Threat model written to: ${resolvedPath}`);
|
|
|
896
901
|
async function runOperator() {
|
|
897
902
|
const { config } = await import("./main-3d7dfdvs.js").then((m)=>__toESM(m.default,1));
|
|
898
903
|
config();
|
|
899
|
-
const { runOffensiveSecurityAgent } = await import("./offesecAgent-
|
|
900
|
-
const { sessions: sessions2, normalizeMessages, getResumeMessages } = await import("./index-
|
|
901
|
-
const { ALL_TOOL_NAMES, SKILL_TOOL_NAMES } = await import("./index-
|
|
902
|
-
const { config: appConfig } = await import("./index-
|
|
904
|
+
const { runOffensiveSecurityAgent } = await import("./offesecAgent-zsc5vrek.js");
|
|
905
|
+
const { sessions: sessions2, normalizeMessages, getResumeMessages } = await import("./index-hnecr3bj.js");
|
|
906
|
+
const { ALL_TOOL_NAMES, SKILL_TOOL_NAMES } = await import("./index-9qd1rtbs.js");
|
|
907
|
+
const { config: appConfig } = await import("./index-532vvmaf.js");
|
|
903
908
|
const { createInterface } = await import("readline");
|
|
904
909
|
const { readFileSync: readFileSync2, existsSync } = await import("fs");
|
|
905
910
|
const path2 = await import("path");
|
|
@@ -1013,35 +1018,35 @@ if (hasFlag("-p") || command === "--prompt") {
|
|
|
1013
1018
|
await runTargetedPentest();
|
|
1014
1019
|
} else if (command === "login" || command === "auth") {
|
|
1015
1020
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
1016
|
-
await import("./auth-
|
|
1021
|
+
await import("./auth-xk51kbta.js");
|
|
1017
1022
|
} else if (command === "uninstall") {
|
|
1018
1023
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
1019
|
-
await import("./uninstall-
|
|
1024
|
+
await import("./uninstall-tc9xqgxy.js");
|
|
1020
1025
|
} else if (command === "apps") {
|
|
1021
1026
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
1022
|
-
await import("./apps-
|
|
1027
|
+
await import("./apps-csx75pk9.js");
|
|
1023
1028
|
} else if (command === "pentests") {
|
|
1024
1029
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
1025
|
-
await import("./pentests-
|
|
1030
|
+
await import("./pentests-8tqyzj9v.js");
|
|
1026
1031
|
} else if (command === "targets") {
|
|
1027
1032
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
1028
|
-
await import("./targets-
|
|
1033
|
+
await import("./targets-8pd483mk.js");
|
|
1029
1034
|
} else if (command === "issues") {
|
|
1030
1035
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
1031
|
-
await import("./issues-
|
|
1036
|
+
await import("./issues-p6spqtma.js");
|
|
1032
1037
|
} else if (command === "fixes") {
|
|
1033
1038
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
1034
|
-
await import("./fixes-
|
|
1039
|
+
await import("./fixes-43ex34f1.js");
|
|
1035
1040
|
} else if (command === "logs") {
|
|
1036
1041
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
1037
|
-
await import("./logs-
|
|
1042
|
+
await import("./logs-eq2nc2k3.js");
|
|
1038
1043
|
} else if (command === "config") {
|
|
1039
1044
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
1040
|
-
await import("./config-
|
|
1045
|
+
await import("./config-tf803ygw.js");
|
|
1041
1046
|
} else if (command === "threat-model") {
|
|
1042
1047
|
await runThreatModel();
|
|
1043
1048
|
} else if (command === "doctor") {
|
|
1044
|
-
const { runDoctor } = await import("./doctor-
|
|
1049
|
+
const { runDoctor } = await import("./doctor-hvmgtwsv.js");
|
|
1045
1050
|
await runDoctor();
|
|
1046
1051
|
} else if (args.length === 0) {
|
|
1047
1052
|
if (process.env.PENSAR_NO_TUI === "1") {
|
|
@@ -1049,7 +1054,7 @@ if (hasFlag("-p") || command === "--prompt") {
|
|
|
1049
1054
|
console.error("All other commands work with Node \u2014 run 'pensar --help'.");
|
|
1050
1055
|
process.exit(1);
|
|
1051
1056
|
}
|
|
1052
|
-
await import("./index-
|
|
1057
|
+
await import("./index-05epz60s.js");
|
|
1053
1058
|
} else {
|
|
1054
1059
|
console.error(`Error: Unknown command '${command}'`);
|
|
1055
1060
|
console.error();
|
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
config,
|
|
13
13
|
init_config
|
|
14
|
-
} from "./cli-
|
|
15
|
-
import"./cli-
|
|
16
|
-
import"./cli-
|
|
14
|
+
} from "./cli-e2qdjmmk.js";
|
|
15
|
+
import"./cli-1xqq625p.js";
|
|
16
|
+
import"./cli-atjcbeyz.js";
|
|
17
17
|
import"./cli-8rxa073f.js";
|
|
18
18
|
|
|
19
19
|
// src/cli/config.ts
|