runAttackSurfaceAgent
Runs only the discovery phase of a pentest:
- Blackbox. When
cwdis not set, the agent probes the livetarget(domain, IP, URL, network range, or organization name). It returns the assets it found, plus the targets that warrant deep testing. - Whitebox. When
cwdis set, Apex analyzes the source code. It returns every app, page, and API endpoint it finds, each with pentest objectives and a risk score.
Feed the results into runTargetedPentestAgent to test the endpoints you care about.
Parameters
What to analyze. Required for blackbox runs.
Path to the source code. Switches the run to whitebox mode.
Session for artifacts. See sessions.create().
Model ID. See Models.
AI provider credentials.
Streaming events. See AgentEventBus.
Cancels the run.
Whitebox only. Set to false to skip deterministic @pensar/surface enumeration.
Extended-thinking setting. See Reasoning.
Returns
Blackbox: AttackSurfaceResult
Targets recommended for deep testing. Each has a target, an objective, a rationale, and optional authenticationInfo.
The full analysis: summary counts, discoveredAssets, targets, and keyFindings. null if the agent didn’t submit one.
Absolute path to attack-surface-results.json in the session.
Absolute path to the session’s assets directory.
Whitebox: WhiteboxAttackSurfaceResult
Every application found in the repository, with its name, type, framework, location, pages, and apiEndpoints. Each endpoint carries method, path, file, authRequired, pentestObjectives, and riskScore.
Counts across all apps.
Repository layout, for example monorepo or single-app.
Detected package manager.