@pensar/apex 2.2.0 → 2.3.0-canary.15ec17ea
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-00rjnxth.js} +7 -7
- package/build/agent-65jzj95h.js +19 -0
- package/build/{agent-q5hwjdtb.js → agent-q3yvg7qp.js} +9 -9
- package/build/{apps-0es69e2s.js → apps-f3snzs8b.js} +16 -16
- package/build/{auth-q73k9bh9.js → auth-5pqmq5x9.js} +32 -39
- package/build/authentication-cx4fr1jm.js +19 -0
- package/build/blackboxAgent-t4kd841t.js +19 -0
- package/build/{blackboxPentest-h28nykk5.js → blackboxPentest-bwj95jra.js} +14 -14
- package/build/{cli-51dkmt5p.js → cli-3b5rh4nn.js} +1 -1
- package/build/{cli-xbdn034b.js → cli-3q27f7wb.js} +4158 -102
- package/build/{cli-2jn8104w.js → cli-b27w98bz.js} +2 -2
- package/build/{cli-6kx46ck0.js → cli-ef2c0sm6.js} +216 -38
- package/build/{cli-1re2kv5v.js → cli-fkkkkf49.js} +3 -3
- package/build/{cli-tz9yg4ew.js → cli-nsc30rcx.js} +24 -8
- package/build/{cli-vgg6h2ax.js → cli-q7123drf.js} +1 -1
- package/build/{cli-7n43wz82.js → cli-sf878p6j.js} +5 -2
- package/build/{cli-xpn9tsw0.js → cli-v8q0djvy.js} +3 -3
- package/build/{cli-ptzy9ak5.js → cli-vbz5qm07.js} +1 -1
- package/build/{cli-s43t5ay0.js → cli-vfsxxnmr.js} +1 -1
- package/build/{cli-n114n8mk.js → cli-wp59e6eq.js} +2 -2
- package/build/{cli-7e5ad5js.js → cli-x5gd8b11.js} +2 -2
- package/build/{cli-1cf5vy5m.js → cli-x7tqybza.js} +60 -28
- package/build/{cli-4tc6888c.js → cli-xw6xh0c2.js} +51 -2
- package/build/{cli-yz80qkzn.js → cli-ycj65kyw.js} +6 -0
- package/build/{cli-knqx15w6.js → cli-ztk7j1rd.js} +2 -2
- package/build/{cli-1f636vzd.js → cli-ztvkmav5.js} +1 -1
- package/build/cli.js +42 -36
- package/build/{config-xcf7rc6x.js → config-4bxc6cvx.js} +3 -3
- package/build/{doctor-98zperf9.js → doctor-njjx9pc4.js} +7 -6
- package/build/{fastStrike-9tm6bedh.js → fastStrike-zcyrev2c.js} +34 -14
- package/build/{fixes-1dry8j61.js → fixes-4gsx59zz.js} +16 -16
- package/build/{index-f6ttv7np.js → index-05cb7ddj.js} +9 -5
- package/build/{index-34h2nb6x.js → index-0kd686e2.js} +3 -3
- package/build/{index-pxwwcefn.js → index-1swzf5ha.js} +9 -9
- package/build/{index-31rwrakh.js → index-kamp2pwf.js} +2 -2
- package/build/{index-6dbym5jy.js → index-nwx21gnf.js} +29 -12
- package/build/{index-0j880wqc.js → index-tesn1wem.js} +1106 -901
- package/build/{index-4hqbyzf5.js → index-vgp133kt.js} +8 -8
- package/build/{issues-wjakj8yy.js → issues-fdqzva1g.js} +44 -16
- package/build/{logs-ewyzcspy.js → logs-hy3kvx1m.js} +16 -16
- package/build/{offesecAgent-7m9smy0t.js → offesecAgent-x1ap18zc.js} +8 -8
- package/build/pentest-v886reb6.js +29 -0
- package/build/{pentests-1hcqjyk2.js → pentests-38363a42.js} +16 -16
- package/build/{targetedPentest-3x13kqvc.js → targetedPentest-td5hts5a.js} +9 -9
- package/build/{targets-nqz8w37e.js → targets-ys9ezcjn.js} +16 -16
- package/build/threatModel-8ygdfkqx.js +27 -0
- package/build/{uninstall-p1q5pkx2.js → uninstall-pszt5mdd.js} +1 -1
- package/build/{upload-x7etpfp4.js → upload-61bcszx8.js} +6 -6
- package/build/{utils-kw6yh5yn.js → utils-fhqds1ws.js} +11 -7
- 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
|
@@ -4,19 +4,19 @@ import {
|
|
|
4
4
|
OffensiveSecurityAgent,
|
|
5
5
|
SKILL_TOOL_NAMES,
|
|
6
6
|
buildBaseSystemPrompt
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-3q27f7wb.js";
|
|
8
8
|
import {
|
|
9
9
|
init_dist,
|
|
10
10
|
init_session,
|
|
11
11
|
sessions,
|
|
12
12
|
stepCountIs
|
|
13
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-ef2c0sm6.js";
|
|
14
14
|
import {
|
|
15
15
|
ensureValidToken,
|
|
16
16
|
getPensarApiUrl,
|
|
17
17
|
init_auth,
|
|
18
18
|
init_constants
|
|
19
|
-
} from "./cli-
|
|
19
|
+
} from "./cli-xw6xh0c2.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-3b5rh4nn.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,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
config,
|
|
3
3
|
init_config
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-3b5rh4nn.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 };
|
|
@@ -30,6 +30,12 @@ var init_types = __esm(() => {
|
|
|
30
30
|
description: "Access multiple AI models through one API",
|
|
31
31
|
requiresAPIKey: true
|
|
32
32
|
},
|
|
33
|
+
{
|
|
34
|
+
id: "concentrate",
|
|
35
|
+
name: "Concentrate",
|
|
36
|
+
description: "Access multiple AI models through one API",
|
|
37
|
+
requiresAPIKey: true
|
|
38
|
+
},
|
|
33
39
|
{
|
|
34
40
|
id: "inception",
|
|
35
41
|
name: "Inception",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OffensiveSecurityAgent
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-3q27f7wb.js";
|
|
4
4
|
import {
|
|
5
5
|
init_dist,
|
|
6
6
|
stepCountIs
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-ef2c0sm6.js";
|
|
8
8
|
|
|
9
9
|
// src/core/agents/specialized/codeAgent/agent.ts
|
|
10
10
|
init_dist();
|
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-ef2c0sm6.js";
|
|
18
|
+
import"./cli-xw6xh0c2.js";
|
|
19
19
|
import"./cli-3k1x5rn3.js";
|
|
20
20
|
import"./cli-gpnb45ck.js";
|
|
21
|
-
import"./cli-
|
|
22
|
-
import"./cli-
|
|
21
|
+
import"./cli-3b5rh4nn.js";
|
|
22
|
+
import"./cli-sf878p6j.js";
|
|
23
23
|
import {
|
|
24
24
|
init_package,
|
|
25
25
|
package_default
|
|
26
|
-
} from "./cli-
|
|
26
|
+
} from "./cli-ztvkmav5.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.15ec17ea"
|
|
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-61bcszx8.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-kamp2pwf.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-kamp2pwf.js");
|
|
647
|
+
const { getDefaultModelForConfig } = await import("./utils-fhqds1ws.js");
|
|
643
648
|
const pensarConfig = await appConfig.get();
|
|
644
649
|
const defaultModel = getDefaultModelForConfig(pensarConfig);
|
|
645
650
|
if (!defaultModel) {
|
|
@@ -648,6 +653,7 @@ async function resolveCliModel() {
|
|
|
648
653
|
` + ` ANTHROPIC_API_KEY \u2014 Anthropic direct
|
|
649
654
|
` + ` OPENAI_API_KEY \u2014 OpenAI
|
|
650
655
|
` + ` OPENROUTER_API_KEY \u2014 OpenRouter
|
|
656
|
+
` + ` CONCENTRATE_API_KEY \u2014 Concentrate
|
|
651
657
|
` + `
|
|
652
658
|
Or run 'pensar login' to connect to Pensar Console.`);
|
|
653
659
|
process.exit(1);
|
|
@@ -727,9 +733,9 @@ Global options:
|
|
|
727
733
|
async function runPentest() {
|
|
728
734
|
const { config } = await import("./main-3d7dfdvs.js").then((m)=>__toESM(m.default,1));
|
|
729
735
|
config();
|
|
730
|
-
const { runPentestAgent } = await import("./blackboxPentest-
|
|
731
|
-
const { sessions: sessions2 } = await import("./index-
|
|
732
|
-
const { config: appConfig } = await import("./index-
|
|
736
|
+
const { runPentestAgent } = await import("./blackboxPentest-bwj95jra.js");
|
|
737
|
+
const { sessions: sessions2 } = await import("./index-nwx21gnf.js");
|
|
738
|
+
const { config: appConfig } = await import("./index-kamp2pwf.js");
|
|
733
739
|
const target = getArgRequired("--target");
|
|
734
740
|
const cwd = getArg("--cwd");
|
|
735
741
|
const mode = getArg("--mode");
|
|
@@ -805,9 +811,9 @@ Report: ${reportPath}` : ""}`);
|
|
|
805
811
|
async function runTargetedPentest() {
|
|
806
812
|
const { config } = await import("./main-3d7dfdvs.js").then((m)=>__toESM(m.default,1));
|
|
807
813
|
config();
|
|
808
|
-
const { runTargetedPentestAgent } = await import("./targetedPentest-
|
|
809
|
-
const { sessions: sessions2 } = await import("./index-
|
|
810
|
-
const { config: appConfig } = await import("./index-
|
|
814
|
+
const { runTargetedPentestAgent } = await import("./targetedPentest-td5hts5a.js");
|
|
815
|
+
const { sessions: sessions2 } = await import("./index-nwx21gnf.js");
|
|
816
|
+
const { config: appConfig } = await import("./index-kamp2pwf.js");
|
|
811
817
|
const target = getArgRequired("--target");
|
|
812
818
|
const objectives = getAllArgs("--objective");
|
|
813
819
|
const pensarConfig = await appConfig.get();
|
|
@@ -859,8 +865,8 @@ POCs: ${pocsPath}`);
|
|
|
859
865
|
async function runThreatModel() {
|
|
860
866
|
const { config } = await import("./main-3d7dfdvs.js").then((m)=>__toESM(m.default,1));
|
|
861
867
|
config();
|
|
862
|
-
const { runThreatModelWorkflow } = await import("./threatModel-
|
|
863
|
-
const { config: appConfig } = await import("./index-
|
|
868
|
+
const { runThreatModelWorkflow } = await import("./threatModel-8ygdfkqx.js");
|
|
869
|
+
const { config: appConfig } = await import("./index-kamp2pwf.js");
|
|
864
870
|
const path2 = await import("path");
|
|
865
871
|
const pensarConfig = await appConfig.get();
|
|
866
872
|
const model = await resolveCliModel();
|
|
@@ -896,10 +902,10 @@ Threat model written to: ${resolvedPath}`);
|
|
|
896
902
|
async function runOperator() {
|
|
897
903
|
const { config } = await import("./main-3d7dfdvs.js").then((m)=>__toESM(m.default,1));
|
|
898
904
|
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-
|
|
905
|
+
const { runOffensiveSecurityAgent } = await import("./offesecAgent-x1ap18zc.js");
|
|
906
|
+
const { sessions: sessions2, normalizeMessages, getResumeMessages } = await import("./index-nwx21gnf.js");
|
|
907
|
+
const { ALL_TOOL_NAMES, SKILL_TOOL_NAMES } = await import("./index-vgp133kt.js");
|
|
908
|
+
const { config: appConfig } = await import("./index-kamp2pwf.js");
|
|
903
909
|
const { createInterface } = await import("readline");
|
|
904
910
|
const { readFileSync: readFileSync2, existsSync } = await import("fs");
|
|
905
911
|
const path2 = await import("path");
|
|
@@ -1013,35 +1019,35 @@ if (hasFlag("-p") || command === "--prompt") {
|
|
|
1013
1019
|
await runTargetedPentest();
|
|
1014
1020
|
} else if (command === "login" || command === "auth") {
|
|
1015
1021
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
1016
|
-
await import("./auth-
|
|
1022
|
+
await import("./auth-5pqmq5x9.js");
|
|
1017
1023
|
} else if (command === "uninstall") {
|
|
1018
1024
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
1019
|
-
await import("./uninstall-
|
|
1025
|
+
await import("./uninstall-pszt5mdd.js");
|
|
1020
1026
|
} else if (command === "apps") {
|
|
1021
1027
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
1022
|
-
await import("./apps-
|
|
1028
|
+
await import("./apps-f3snzs8b.js");
|
|
1023
1029
|
} else if (command === "pentests") {
|
|
1024
1030
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
1025
|
-
await import("./pentests-
|
|
1031
|
+
await import("./pentests-38363a42.js");
|
|
1026
1032
|
} else if (command === "targets") {
|
|
1027
1033
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
1028
|
-
await import("./targets-
|
|
1034
|
+
await import("./targets-ys9ezcjn.js");
|
|
1029
1035
|
} else if (command === "issues") {
|
|
1030
1036
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
1031
|
-
await import("./issues-
|
|
1037
|
+
await import("./issues-fdqzva1g.js");
|
|
1032
1038
|
} else if (command === "fixes") {
|
|
1033
1039
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
1034
|
-
await import("./fixes-
|
|
1040
|
+
await import("./fixes-4gsx59zz.js");
|
|
1035
1041
|
} else if (command === "logs") {
|
|
1036
1042
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
1037
|
-
await import("./logs-
|
|
1043
|
+
await import("./logs-hy3kvx1m.js");
|
|
1038
1044
|
} else if (command === "config") {
|
|
1039
1045
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
1040
|
-
await import("./config-
|
|
1046
|
+
await import("./config-4bxc6cvx.js");
|
|
1041
1047
|
} else if (command === "threat-model") {
|
|
1042
1048
|
await runThreatModel();
|
|
1043
1049
|
} else if (command === "doctor") {
|
|
1044
|
-
const { runDoctor } = await import("./doctor-
|
|
1050
|
+
const { runDoctor } = await import("./doctor-njjx9pc4.js");
|
|
1045
1051
|
await runDoctor();
|
|
1046
1052
|
} else if (args.length === 0) {
|
|
1047
1053
|
if (process.env.PENSAR_NO_TUI === "1") {
|
|
@@ -1049,7 +1055,7 @@ if (hasFlag("-p") || command === "--prompt") {
|
|
|
1049
1055
|
console.error("All other commands work with Node \u2014 run 'pensar --help'.");
|
|
1050
1056
|
process.exit(1);
|
|
1051
1057
|
}
|
|
1052
|
-
await import("./index-
|
|
1058
|
+
await import("./index-tesn1wem.js");
|
|
1053
1059
|
} else {
|
|
1054
1060
|
console.error(`Error: Unknown command '${command}'`);
|
|
1055
1061
|
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-3b5rh4nn.js";
|
|
15
|
+
import"./cli-sf878p6j.js";
|
|
16
|
+
import"./cli-ztvkmav5.js";
|
|
17
17
|
import"./cli-8rxa073f.js";
|
|
18
18
|
|
|
19
19
|
// src/cli/config.ts
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
toolExists
|
|
3
|
-
} from "./cli-
|
|
4
|
-
import"./cli-
|
|
5
|
-
import"./cli-
|
|
3
|
+
} from "./cli-vfsxxnmr.js";
|
|
4
|
+
import"./cli-ef2c0sm6.js";
|
|
5
|
+
import"./cli-xw6xh0c2.js";
|
|
6
6
|
import"./cli-3k1x5rn3.js";
|
|
7
7
|
import"./cli-gpnb45ck.js";
|
|
8
|
-
import"./cli-
|
|
9
|
-
import"./cli-
|
|
10
|
-
import"./cli-
|
|
8
|
+
import"./cli-3b5rh4nn.js";
|
|
9
|
+
import"./cli-sf878p6j.js";
|
|
10
|
+
import"./cli-ztvkmav5.js";
|
|
11
11
|
import"./cli-8rxa073f.js";
|
|
12
12
|
|
|
13
13
|
// src/core/doctor.ts
|
|
@@ -50,6 +50,7 @@ function checkApiKeys() {
|
|
|
50
50
|
{ provider: "OpenAI", env: "OPENAI_API_KEY" },
|
|
51
51
|
{ provider: "Google", env: "GOOGLE_GENERATIVE_AI_API_KEY" },
|
|
52
52
|
{ provider: "OpenRouter", env: "OPENROUTER_API_KEY" },
|
|
53
|
+
{ provider: "Concentrate", env: "CONCENTRATE_API_KEY" },
|
|
53
54
|
{ provider: "AWS Bedrock", env: "BEDROCK_API_KEY" },
|
|
54
55
|
{ provider: "AWS IAM", env: "AWS_ACCESS_KEY_ID" },
|
|
55
56
|
{ provider: "vLLM (local)", env: "LOCAL_MODEL_URL" }
|
|
@@ -4,28 +4,28 @@ import {
|
|
|
4
4
|
buildPentestReport,
|
|
5
5
|
renderJson,
|
|
6
6
|
renderMarkdown
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-b27w98bz.js";
|
|
8
8
|
import"./cli-9fsre5pt.js";
|
|
9
|
-
import"./cli-
|
|
9
|
+
import"./cli-vbz5qm07.js";
|
|
10
10
|
import {
|
|
11
11
|
FindingsRegistry,
|
|
12
12
|
OffensiveSecurityAgent
|
|
13
|
-
} from "./cli-
|
|
14
|
-
import"./cli-
|
|
13
|
+
} from "./cli-3q27f7wb.js";
|
|
14
|
+
import"./cli-vfsxxnmr.js";
|
|
15
15
|
import {
|
|
16
16
|
createThreatModelPrompt
|
|
17
17
|
} from "./cli-fw5r7pfj.js";
|
|
18
18
|
import"./cli-c8131c4q.js";
|
|
19
|
-
import"./cli-
|
|
20
|
-
import"./cli-
|
|
19
|
+
import"./cli-ef2c0sm6.js";
|
|
20
|
+
import"./cli-xw6xh0c2.js";
|
|
21
21
|
import {
|
|
22
22
|
exports_external,
|
|
23
23
|
init_zod
|
|
24
24
|
} from "./cli-3k1x5rn3.js";
|
|
25
25
|
import"./cli-gpnb45ck.js";
|
|
26
|
-
import"./cli-
|
|
27
|
-
import"./cli-
|
|
28
|
-
import"./cli-
|
|
26
|
+
import"./cli-3b5rh4nn.js";
|
|
27
|
+
import"./cli-sf878p6j.js";
|
|
28
|
+
import"./cli-ztvkmav5.js";
|
|
29
29
|
import"./cli-8rxa073f.js";
|
|
30
30
|
|
|
31
31
|
// src/core/workflows/fastStrike.ts
|
|
@@ -42,14 +42,15 @@ Run this loop, tightly:
|
|
|
42
42
|
|
|
43
43
|
1. OBSERVE — Read every response for signal before you act. Note the stack, headers, cookies, tokens, form fields, error messages, redirects, disabled controls, ID patterns. State what you just learned in one line before the next move.
|
|
44
44
|
2. HYPOTHESIZE — From that signal and your deep knowledge of web/app vulnerability classes, name the single most likely vulnerability and why the evidence points to it. Rank leads by signal strength and go for the strongest first. A disabled form field, an ID in a URL or JWT, advertised demo creds, an exposed schema — these are tells; read them.
|
|
45
|
-
3. ACT — Test that one hypothesis with the
|
|
45
|
+
3. ACT — Test that one hypothesis with the strongest available technique. Use direct tools for quick probes, but treat the shell as a working environment rather than merely a way to issue one-off commands. When the work becomes stateful, repetitive, concurrent, protocol-heavy, or multi-stage, externalize it into an editable script in the session scratchpad directory identified in the workspace instructions. Never create a scratchpad/ directory inside the target repository. Run the script, inspect the results, modify it, and rerun it as the attack develops.
|
|
46
46
|
4. PRUNE — If the evidence disproves a lead, drop it and move to the next-strongest. Do NOT re-run a disproven approach or grind a dead end. Do NOT enumerate, brute-force, or run wordlists unless a specific signal demands it — choose techniques from evidence, not from a checklist.
|
|
47
|
-
5. EXPLOIT — When a vulnerability is confirmed, exploit it: capture the flag, extract the sensitive data, and pivot through it if the objective requires more.
|
|
48
|
-
6. DOCUMENT & FINISH — Record each confirmed vulnerability with the document_vulnerability tool as you go.
|
|
47
|
+
5. EXPLOIT — When a vulnerability is confirmed, exploit it: capture the flag, extract the sensitive data, and pivot through it if the objective requires more. Preserve viable primitives and build on them. Prefer extending a working script into an end-to-end exploit over rebuilding the chain with repeated one-off tool calls or stopping at the next network or protocol boundary.
|
|
48
|
+
6. DOCUMENT & FINISH — Record each confirmed vulnerability with the document_vulnerability tool as you go. Before concluding that every credible lead is exhausted, account for each viable primitive and pursue any concrete path that could still close the objective. After this check, whether the objective was met or every credible lead was genuinely exhausted, call the response tool with the correct solved value and a concise summary.
|
|
49
49
|
|
|
50
50
|
Rules:
|
|
51
51
|
- You are one operator. Plan in your head and in short text notes — never via planning tools, task lists, or sub-agents.
|
|
52
52
|
- Recon and exploitation are the same loop. Do just enough recon to form the first hypothesis, then start testing. Do not map the entire surface before acting.
|
|
53
|
+
- Spend your reasoning on choosing techniques and interpreting evidence; use scripts for deterministic mechanics, iteration, and chain execution.
|
|
53
54
|
- Bias toward the shortest path that proves impact. Speed comes from picking the right lead, not from skipping verification — always confirm a finding before you claim it.
|
|
54
55
|
- Stay in scope. Only touch the target you were given and hosts it legitimately depends on.`;
|
|
55
56
|
async function runFastStrike(input) {
|
|
@@ -121,7 +122,25 @@ ${combined}` : combined;
|
|
|
121
122
|
enableThinking,
|
|
122
123
|
openAIReasoningEffort
|
|
123
124
|
});
|
|
124
|
-
|
|
125
|
+
eventBus?.emit("subagent-spawn", {
|
|
126
|
+
subagentId: "fast-strike",
|
|
127
|
+
name: "Fast Strike",
|
|
128
|
+
input: { target }
|
|
129
|
+
});
|
|
130
|
+
let strikeResult;
|
|
131
|
+
try {
|
|
132
|
+
strikeResult = await agent.consume();
|
|
133
|
+
eventBus?.emit("subagent-complete", {
|
|
134
|
+
subagentId: "fast-strike",
|
|
135
|
+
status: "completed"
|
|
136
|
+
});
|
|
137
|
+
} catch (e) {
|
|
138
|
+
eventBus?.emit("subagent-complete", {
|
|
139
|
+
subagentId: "fast-strike",
|
|
140
|
+
status: "failed"
|
|
141
|
+
});
|
|
142
|
+
throw e;
|
|
143
|
+
}
|
|
125
144
|
if (abortSignal?.aborted) {
|
|
126
145
|
throw new DOMException("Pentest aborted by user", "AbortError");
|
|
127
146
|
}
|
|
@@ -152,5 +171,6 @@ ${combined}` : combined;
|
|
|
152
171
|
};
|
|
153
172
|
}
|
|
154
173
|
export {
|
|
155
|
-
runFastStrike
|
|
174
|
+
runFastStrike,
|
|
175
|
+
FAST_STRIKE_SYSTEM_PROMPT
|
|
156
176
|
};
|