appsec-agent 2.8.0 → 3.1.0
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/README.md +105 -31
- package/conf/appsec_agent.yaml +7 -0
- package/dist/bin/agent-run.js +14 -17
- package/dist/bin/agent-run.js.map +1 -1
- package/dist/conf/appsec_agent.yaml +7 -0
- package/dist/src/__tests__/mocks/codex_sdk.d.ts +53 -0
- package/dist/src/__tests__/mocks/codex_sdk.d.ts.map +1 -0
- package/dist/src/__tests__/mocks/codex_sdk.js +8 -0
- package/dist/src/__tests__/mocks/codex_sdk.js.map +1 -0
- package/dist/src/agent_actions.d.ts +5 -1
- package/dist/src/agent_actions.d.ts.map +1 -1
- package/dist/src/agent_actions.js +103 -27
- package/dist/src/agent_actions.js.map +1 -1
- package/dist/src/agent_options.d.ts +20 -94
- package/dist/src/agent_options.d.ts.map +1 -1
- package/dist/src/agent_options.js +219 -311
- package/dist/src/agent_options.js.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/llm_query.d.ts +4 -43
- package/dist/src/llm_query.d.ts.map +1 -1
- package/dist/src/llm_query.js +4 -145
- package/dist/src/llm_query.js.map +1 -1
- package/dist/src/main.d.ts.map +1 -1
- package/dist/src/main.js +70 -10
- package/dist/src/main.js.map +1 -1
- package/dist/src/mcp_internal.d.ts +13 -0
- package/dist/src/mcp_internal.d.ts.map +1 -0
- package/dist/src/mcp_internal.js +34 -0
- package/dist/src/mcp_internal.js.map +1 -0
- package/dist/src/providers/claude_provider.d.ts +18 -0
- package/dist/src/providers/claude_provider.d.ts.map +1 -0
- package/dist/src/providers/claude_provider.js +27 -0
- package/dist/src/providers/claude_provider.js.map +1 -0
- package/dist/src/providers/claude_role_spec.d.ts +10 -0
- package/dist/src/providers/claude_role_spec.d.ts.map +1 -0
- package/dist/src/providers/claude_role_spec.js +85 -0
- package/dist/src/providers/claude_role_spec.js.map +1 -0
- package/dist/src/providers/codex_model.d.ts +12 -0
- package/dist/src/providers/codex_model.d.ts.map +1 -0
- package/dist/src/providers/codex_model.js +45 -0
- package/dist/src/providers/codex_model.js.map +1 -0
- package/dist/src/providers/codex_provider.d.ts +30 -0
- package/dist/src/providers/codex_provider.d.ts.map +1 -0
- package/dist/src/providers/codex_provider.js +170 -0
- package/dist/src/providers/codex_provider.js.map +1 -0
- package/dist/src/providers/codex_role_spec.d.ts +16 -0
- package/dist/src/providers/codex_role_spec.d.ts.map +1 -0
- package/dist/src/providers/codex_role_spec.js +63 -0
- package/dist/src/providers/codex_role_spec.js.map +1 -0
- package/dist/src/providers/query_message.d.ts +45 -0
- package/dist/src/providers/query_message.d.ts.map +1 -0
- package/dist/src/providers/query_message.js +8 -0
- package/dist/src/providers/query_message.js.map +1 -0
- package/dist/src/providers/resolve_provider.d.ts +10 -0
- package/dist/src/providers/resolve_provider.d.ts.map +1 -0
- package/dist/src/providers/resolve_provider.js +29 -0
- package/dist/src/providers/resolve_provider.js.map +1 -0
- package/dist/src/providers/role_spec.d.ts +39 -0
- package/dist/src/providers/role_spec.d.ts.map +1 -0
- package/dist/src/providers/role_spec.js +8 -0
- package/dist/src/providers/role_spec.js.map +1 -0
- package/dist/src/providers/structured_output.d.ts +21 -0
- package/dist/src/providers/structured_output.d.ts.map +1 -0
- package/dist/src/providers/structured_output.js +61 -0
- package/dist/src/providers/structured_output.js.map +1 -0
- package/dist/src/providers/types.d.ts +18 -0
- package/dist/src/providers/types.d.ts.map +1 -0
- package/dist/src/providers/types.js +15 -0
- package/dist/src/providers/types.js.map +1 -0
- package/dist/src/schemas/threat_adversary_pass.d.ts +18 -0
- package/dist/src/schemas/threat_adversary_pass.d.ts.map +1 -0
- package/dist/src/schemas/threat_adversary_pass.js +59 -0
- package/dist/src/schemas/threat_adversary_pass.js.map +1 -0
- package/dist/src/schemas/threat_model_report.d.ts +11 -0
- package/dist/src/schemas/threat_model_report.d.ts.map +1 -1
- package/dist/src/schemas/threat_model_report.js +21 -4
- package/dist/src/schemas/threat_model_report.js.map +1 -1
- package/dist/src/utils.js +1 -1
- package/dist/src/utils.js.map +1 -1
- package/package.json +3 -3
- package/dist/src/openai_tools.d.ts +0 -26
- package/dist/src/openai_tools.d.ts.map +0 -1
- package/dist/src/openai_tools.js +0 -194
- package/dist/src/openai_tools.js.map +0 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ A TypeScript package that provides AI-powered agents for Application Security (A
|
|
|
9
9
|
## 🚀 Features
|
|
10
10
|
|
|
11
11
|
- **AI-Powered AppSec Automation**: Leverage Claude's capabilities for application security
|
|
12
|
-
- **Multiple Agent Types**: Simple query
|
|
12
|
+
- **Multiple Agent Types**: Simple query, code review, PR review, threat modeling (with adversarial second pass), code fixing, QA verification, and more
|
|
13
13
|
- **Tool Permission Management**: Advanced tool permission callbacks with bypass mode for trusted operations
|
|
14
14
|
- **Code Review Capabilities**: Automated security and privacy issue detection in code
|
|
15
15
|
- **Modular Agent Architecture**: Easy to extend and customize agents for specific use cases
|
|
@@ -92,29 +92,26 @@ $ npx agent-run -r simple_query_agent
|
|
|
92
92
|
|
|
93
93
|
The agents can be configured through environment variables and configuration files. Key configuration options include:
|
|
94
94
|
|
|
95
|
-
- `ANTHROPIC_API_KEY`: Your Anthropic API key (required)
|
|
95
|
+
- `ANTHROPIC_API_KEY`: Your Anthropic API key (required for the Claude provider)
|
|
96
96
|
- `ANTHROPIC_BASE_URL`: API endpoint URL (default: https://api.anthropic.com)
|
|
97
|
-
- `
|
|
97
|
+
- `AGENT_PROVIDER`: Model provider — `claude` (default) or `codex` (opt-in). Override with `--provider`.
|
|
98
|
+
- Per-role `max_turns` in `conf/appsec_agent.yaml` (e.g. **100** for `threat_modeler`). Override any role with `--max-turns <n>`.
|
|
98
99
|
|
|
99
100
|
Configuration file: `conf/appsec_agent.yaml`
|
|
100
101
|
|
|
101
|
-
###
|
|
102
|
+
### Model providers (v3.0.0+)
|
|
102
103
|
|
|
103
|
-
|
|
104
|
+
All roles run through a provider-neutral `RoleSpec`. Choose the backend at runtime:
|
|
104
105
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
- `OPENAI_API_KEY`: your OpenAI API key (required when failover is enabled).
|
|
109
|
-
- `OPENAI_BASE_URL`: (optional) custom OpenAI endpoint.
|
|
110
|
-
- `OPENAI_FALLBACK_MODEL`: (optional) model to use for fallback (e.g. `gpt-4o`); default is `gpt-4o`.
|
|
111
|
-
|
|
112
|
-
**CLI overrides env overrides config.** You can use:
|
|
106
|
+
```bash
|
|
107
|
+
# Claude (default) — uses Anthropic API / Claude Agent SDK
|
|
108
|
+
$ npx agent-run -r code_reviewer -s ./src -m sonnet
|
|
113
109
|
|
|
114
|
-
-
|
|
115
|
-
-
|
|
110
|
+
# Codex (opt-in) — uses @openai/codex-sdk; accepts gpt-* / o* model ids
|
|
111
|
+
$ npx agent-run -r threat_modeler -s ./src -f json --provider codex -m gpt-4.1
|
|
112
|
+
```
|
|
116
113
|
|
|
117
|
-
|
|
114
|
+
Set `AGENT_PROVIDER=codex` or pass `--provider codex`. MCP server wiring (`--mcp-server-url`) works on both providers for supported roles.
|
|
118
115
|
|
|
119
116
|
## 🤖 Available Agents
|
|
120
117
|
|
|
@@ -155,13 +152,28 @@ A specialized agent for verifying security fixes that can:
|
|
|
155
152
|
- Support custom test commands, setup commands, and environment variables
|
|
156
153
|
- Accept deployment context for environment-aware verification
|
|
157
154
|
|
|
155
|
+
### PR Reviewer (`pr_reviewer`)
|
|
156
|
+
A PR-focused variant of the code reviewer optimized for diff context:
|
|
157
|
+
- Same security analysis capabilities as `code_reviewer`, tuned for Pull Request diffs
|
|
158
|
+
- **PR diff chunking enabled by default** when using `-d/--diff-context` (see [PR chunking](#pr-chunking-large-prs))
|
|
159
|
+
- MCP-aware when `--mcp-server-url` is provided (`queryFindingsHistory`, `queryImportGraph`, `queryCodebaseGraph`, `queryRuntimeEnrichment`)
|
|
160
|
+
|
|
158
161
|
### Threat Modeler (`threat_modeler`)
|
|
159
162
|
A specialized agent for comprehensive threat modeling that can:
|
|
160
|
-
-
|
|
163
|
+
- Produce a structured **`threat_model_report` JSON** (DFD + STRIDE threats + risk registry) or legacy multi-file ASCII deliverables
|
|
161
164
|
- Perform STRIDE methodology threat modeling on DFDs
|
|
162
165
|
- Create detailed risk registry reports with remediation plans
|
|
166
|
+
- Anchor DFD nodes, threats, and risks to source code via optional **`source_locations`** (`file`, `line_numbers`, `symbol`, `snippet`) when evidence is confirmed (v3.1.0)
|
|
163
167
|
- Analyze codebases for security threats and vulnerabilities
|
|
164
|
-
-
|
|
168
|
+
- Run up to **100 tool-use turns by default** (configurable in yaml or via `--max-turns`)
|
|
169
|
+
|
|
170
|
+
### Threat Adversary (`threat_adversary`, v3.1.0)
|
|
171
|
+
Adversarial second pass for threat modeling — filters ungrounded threats from a first-pass report:
|
|
172
|
+
- Input: first-pass `threat_model_report` JSON via `--adversarial-context`
|
|
173
|
+
- Output: filtered `threat_model_report` JSON (same schema) to an explicit `-o` path
|
|
174
|
+
- Keeps only threats with a concrete attack path and confirmed `source_locations`; drops generic, mitigated, or ungrounded items
|
|
175
|
+
- Reconciles the risk registry and `metadata` counts after filtering
|
|
176
|
+
- Uses the same model provider and `max_turns` defaults as `threat_modeler`
|
|
165
177
|
|
|
166
178
|
## 📖 Usage Examples
|
|
167
179
|
|
|
@@ -469,13 +481,74 @@ The agent returns a structured `QaVerdict`:
|
|
|
469
481
|
|
|
470
482
|
### Threat Modeler Example
|
|
471
483
|
```bash
|
|
472
|
-
#
|
|
473
|
-
$ npx agent-run -r threat_modeler
|
|
484
|
+
# Structured JSON report (recommended for integrations)
|
|
485
|
+
$ npx agent-run -r threat_modeler -s /path/to/source -f json -o threat_model_report.json
|
|
474
486
|
|
|
475
|
-
#
|
|
487
|
+
# Legacy multi-file ASCII deliverables (markdown default)
|
|
476
488
|
$ npx agent-run -r threat_modeler -s /path/to/source
|
|
489
|
+
|
|
490
|
+
# With deployment context for environment-specific threats
|
|
491
|
+
$ npx agent-run -r threat_modeler -s ./api -f json \
|
|
492
|
+
-c "AWS Lambda in VPC, handles PII, SOC2 Type II scope"
|
|
493
|
+
|
|
494
|
+
# Override max tool-use turns (default 100 for threat_modeler)
|
|
495
|
+
$ npx agent-run -r threat_modeler -s ./src -f json --max-turns 50
|
|
477
496
|
```
|
|
478
497
|
|
|
498
|
+
JSON reports may include optional `source_locations` on DFD nodes, threats, and risks when the agent can ground them in Read/Grep evidence:
|
|
499
|
+
|
|
500
|
+
```json
|
|
501
|
+
{
|
|
502
|
+
"threat_model_report": {
|
|
503
|
+
"threat_model": {
|
|
504
|
+
"threats": [
|
|
505
|
+
{
|
|
506
|
+
"id": "THREAT-001",
|
|
507
|
+
"title": "SQL injection in user lookup",
|
|
508
|
+
"source_locations": [
|
|
509
|
+
{
|
|
510
|
+
"file": "src/db/users.ts",
|
|
511
|
+
"line_numbers": "42-44",
|
|
512
|
+
"symbol": "findUserById",
|
|
513
|
+
"snippet": "const q = `SELECT * FROM users WHERE id = ${id}`;"
|
|
514
|
+
}
|
|
515
|
+
]
|
|
516
|
+
}
|
|
517
|
+
]
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
#### Threat adversarial second pass (`threat_adversary`, v3.1.0)
|
|
524
|
+
|
|
525
|
+
After a `threat_modeler` run, invoke a **second pass** that drops threats without a concrete, code-grounded attack path. Input is the first-pass report; output is a filtered `threat_model_report` (same schema).
|
|
526
|
+
|
|
527
|
+
```bash
|
|
528
|
+
# Filter candidate threats (JSON in → JSON out)
|
|
529
|
+
$ npx agent-run -r threat_adversary --adversarial-context threat_model_report.json \
|
|
530
|
+
-s ./repo -f json -o threat_model_adversary_report.json
|
|
531
|
+
|
|
532
|
+
# Optional: same deployment context as the first pass
|
|
533
|
+
$ npx agent-run -r threat_adversary --adversarial-context threat_model_report.json \
|
|
534
|
+
-s ./repo -f json -c "AWS Lambda, handles PII"
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
**Input shape** (minimum: wrap the first-pass report):
|
|
538
|
+
|
|
539
|
+
```json
|
|
540
|
+
{
|
|
541
|
+
"threat_model_report": {
|
|
542
|
+
"data_flow_diagram": { "nodes": [], "flows": [], "trust_boundaries": [] },
|
|
543
|
+
"threat_model": { "executive_summary": "…", "threats": [] },
|
|
544
|
+
"risk_registry": { "summary": "…", "risks": [] },
|
|
545
|
+
"metadata": { "total_threats_identified": 0, "total_risks_identified": 0 }
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
Empty `threats` arrays short-circuit without calling the model; the input is written unchanged to `-o`.
|
|
551
|
+
|
|
479
552
|
### List Available Roles
|
|
480
553
|
```bash
|
|
481
554
|
$ npx agent-run -l
|
|
@@ -570,10 +643,12 @@ appsec-agent/
|
|
|
570
643
|
│ ├── main.ts # Main application logic
|
|
571
644
|
│ ├── utils.ts # Utility functions
|
|
572
645
|
│ ├── schemas/
|
|
573
|
-
│ │ ├── security_report.ts
|
|
574
|
-
│ │ ├── threat_model_report.ts
|
|
575
|
-
│ │
|
|
576
|
-
│ │
|
|
646
|
+
│ │ ├── security_report.ts # JSON schema for code review reports
|
|
647
|
+
│ │ ├── threat_model_report.ts # JSON schema for threat model reports (incl. source_locations)
|
|
648
|
+
│ │ ├── threat_adversary_pass.ts # Input/prompt helpers for threat_adversary second pass
|
|
649
|
+
│ │ ├── fp_adversary_pass.ts # Input/output schema for fp_adversary role
|
|
650
|
+
│ │ ├── security_fix.ts # JSON schema for code fixer output
|
|
651
|
+
│ │ └── qa_context.ts # JSON schema for QA verifier verdict
|
|
577
652
|
│ ├── tools/
|
|
578
653
|
│ │ └── bash_tool.ts # Restricted Bash tool for QA verifier
|
|
579
654
|
│ └── __tests__/
|
|
@@ -602,6 +677,7 @@ appsec-agent/
|
|
|
602
677
|
- `getSimpleQueryAgentOptions()`: Gets options for simple query agent
|
|
603
678
|
- `getCodeReviewerOptions()`: Gets options for code reviewer
|
|
604
679
|
- `getThreatModelerOptions()`: Gets options for threat modeler
|
|
680
|
+
- `getThreatAdversaryOptions()`: Gets options for threat adversary second pass
|
|
605
681
|
- `getDiffReviewerOptions()`: Gets options for PR diff-focused code reviewer
|
|
606
682
|
- `getCodeFixerOptions()`: Gets options for code fixer agent (always uses JSON schema output)
|
|
607
683
|
- `getQaVerifierOptions()`: Gets options for QA verifier agent (Read, Grep, Bash tools + JSON schema output)
|
|
@@ -698,11 +774,9 @@ $ npm test -- concurrency.test.ts
|
|
|
698
774
|
### Test Results
|
|
699
775
|
|
|
700
776
|
All tests pass including:
|
|
701
|
-
- ✅
|
|
702
|
-
- ✅
|
|
703
|
-
- ✅
|
|
704
|
-
- ✅ 9 code fixer tests (main + agent options)
|
|
705
|
-
- ✅ 5 QA verifier tests
|
|
777
|
+
- ✅ 644 total tests across 40 suites
|
|
778
|
+
- ✅ Concurrency and thread-safety coverage for web application usage
|
|
779
|
+
- ✅ Diff context validation, threat model / threat adversary schema, and provider parity tests
|
|
706
780
|
- ✅ Full coverage of core functionality
|
|
707
781
|
|
|
708
782
|
## 🔗 Related Projects
|
|
@@ -715,7 +789,7 @@ Highlights:
|
|
|
715
789
|
|
|
716
790
|
- 🐳 **One-command setup** with `docker-compose up -d --build`
|
|
717
791
|
- 🖥️ **Next.js web dashboard** with authentication (JWT, bcrypt, role-based access) and admin-managed Anthropic API credentials
|
|
718
|
-
- 🧵 **Threat Modeling workflow** — upload a repository ZIP and get a structured JSON threat model (powered by `appsec-agent` v1.6+) with:
|
|
792
|
+
- 🧵 **Threat Modeling workflow** — upload a repository ZIP and get a structured JSON threat model (powered by `appsec-agent` v1.6+) with code-grounded `source_locations` and optional adversarial filtering (`threat_adversary`, v3.1.0+):
|
|
719
793
|
- Interactive threat-aware **Data Flow Diagrams** (React Flow canvas with pan/zoom, search, filters, trust boundaries)
|
|
720
794
|
- Sortable threat tables with STRIDE category and severity badges
|
|
721
795
|
- Risk Registry with cross-referenced threat IDs
|
package/conf/appsec_agent.yaml
CHANGED
|
@@ -21,8 +21,15 @@ default: &default
|
|
|
21
21
|
threat_modeler:
|
|
22
22
|
options:
|
|
23
23
|
system_prompt: "You are an Application Security (AppSec) expert assistant. You are responsible for performing risk assessment on the source code repository for SOC2 type 2 compliance audit: 1. Start with drawing the ASCII text based Data Flow Diagrm (DFD), with output format as <codebase_data_flow_diagram_text_timestamp>; 2. then proceeding to use STRIDE methodology to perform threat modeling on the DFD, without output report in the format <codebase_threat_model_timestamp>; 3. finally, provide a seperate risk registry report including proposed remediation plan in the format <codebase_risk_registry_text_timestamp>. We're looking for 3 reports in the current working directory as the deliverable."
|
|
24
|
+
max_turns: 100
|
|
24
25
|
output_format: "markdown"
|
|
25
26
|
verbose: True
|
|
27
|
+
threat_adversary:
|
|
28
|
+
options:
|
|
29
|
+
system_prompt: "You are a senior application security engineer performing an adversarial second pass on a STRIDE threat model. Skeptically verify each threat against the real codebase using Read and Grep. Keep only threats with a concrete, demonstrable attack path and confirmed source_locations. Drop generic, mitigated, or ungrounded threats. Reconcile risks and metadata counts. Output the full filtered threat_model_report JSON."
|
|
30
|
+
output_format: "json"
|
|
31
|
+
max_turns: 100
|
|
32
|
+
verbose: True
|
|
26
33
|
pr_reviewer:
|
|
27
34
|
options:
|
|
28
35
|
diff_reviewer_system_prompt: null # Use enhanced hardcoded prompt; set here to override
|
package/dist/bin/agent-run.js
CHANGED
|
@@ -75,9 +75,7 @@ program
|
|
|
75
75
|
.option('--diff-max-files <n>', 'Max files to include in PR review; rest skipped. Overrides config.')
|
|
76
76
|
.option('--diff-exclude <pattern>', 'Exclude path pattern (repeatable). Overrides config.', (v, acc) => { acc.push(v); return acc; }, [])
|
|
77
77
|
.option('-m, --model <model>', 'Claude model: family alias (sonnet, opus, haiku), SDK model ID (claude-sonnet-4-6), or version prefix (sonnet-4-6) - default to "opus"', 'opus')
|
|
78
|
-
.option('
|
|
79
|
-
.option('-K, --openai-api-key <key>', 'OpenAI API key for failover (overrides OPENAI_API_KEY env). Only used when failover is enabled.')
|
|
80
|
-
.option('-U, --openai-base-url <url>', 'OpenAI API base URL for failover (overrides OPENAI_BASE_URL env). Only used when failover is enabled.')
|
|
78
|
+
.option('--provider <provider>', 'Model provider: claude (default) or codex (opt-in; all roles via RoleSpec)', 'claude')
|
|
81
79
|
.option('--max-turns <n>', 'Max agent turns (tool-use iterations). Overrides per-role default.')
|
|
82
80
|
.option('--no-tools', 'Disable Read/Grep tools for single-turn analysis (use with --diff-context for fastest mode)')
|
|
83
81
|
.option('--mcp-server-url <url>', 'URL of a parent-app-managed per-scan MCP server exposing queryFindingsHistory / queryImportGraph / queryRuntimeEnrichment / queryCodebaseGraph (v2.4.0 wire + v2.7.0 fourth tool). When set, agents call these tools live instead of (or in addition to) the front-loaded JSON paths.')
|
|
@@ -119,26 +117,25 @@ if (options.anthropicApiKey) {
|
|
|
119
117
|
if (options.anthropicBaseUrl) {
|
|
120
118
|
process.env.ANTHROPIC_BASE_URL = options.anthropicBaseUrl;
|
|
121
119
|
}
|
|
122
|
-
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (options.openaiApiKey !== undefined) {
|
|
127
|
-
console.warn('⚠️ SECURITY WARNING: OpenAI API key provided via command line argument.');
|
|
128
|
-
console.warn(' For better security, use the OPENAI_API_KEY environment variable instead.\n');
|
|
129
|
-
process.env.OPENAI_API_KEY = options.openaiApiKey;
|
|
130
|
-
}
|
|
131
|
-
if (options.openaiBaseUrl !== undefined) {
|
|
132
|
-
process.env.OPENAI_BASE_URL = options.openaiBaseUrl;
|
|
120
|
+
const providerId = (options.provider ?? 'claude').toLowerCase().trim();
|
|
121
|
+
if (providerId !== 'claude' && providerId !== 'codex') {
|
|
122
|
+
console.error(`Error: Invalid provider "${options.provider}". Valid values: claude, codex`);
|
|
123
|
+
process.exit(1);
|
|
133
124
|
}
|
|
134
|
-
|
|
125
|
+
process.env.AGENT_PROVIDER = providerId;
|
|
126
|
+
// Validate model option: provider-aware (Claude aliases/IDs vs Codex/OpenAI ids)
|
|
135
127
|
const FAMILY_ALIASES = ['sonnet', 'opus', 'haiku'];
|
|
136
128
|
const model = options.model.toLowerCase().trim();
|
|
137
|
-
const
|
|
129
|
+
const isClaudeModel = FAMILY_ALIASES.includes(model)
|
|
138
130
|
|| model.startsWith('claude-')
|
|
139
131
|
|| FAMILY_ALIASES.some(f => model.startsWith(`${f}-`));
|
|
132
|
+
const isCodexModel = model.startsWith('gpt-') || model.startsWith('o');
|
|
133
|
+
const isValidModel = providerId === 'codex' ? (isCodexModel || isClaudeModel) : isClaudeModel;
|
|
140
134
|
if (!isValidModel) {
|
|
141
|
-
|
|
135
|
+
const hint = providerId === 'codex'
|
|
136
|
+
? 'Codex/OpenAI id (gpt-*, o*) or Claude alias (sonnet, opus, haiku)'
|
|
137
|
+
: 'family alias (sonnet, opus, haiku), SDK model ID (claude-sonnet-4-6), or version prefix (sonnet-4-6)';
|
|
138
|
+
console.error(`Error: Invalid model "${options.model}". Valid formats for ${providerId}: ${hint}`);
|
|
142
139
|
process.exit(1);
|
|
143
140
|
}
|
|
144
141
|
// Prepare args (chunking: CLI overrides config; main will merge with conf)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-run.js","sourceRoot":"","sources":["../../bin/agent-run.ts"],"names":[],"mappings":";;AACA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAC7B,yCAAoC;AAEpC,yCAAyC;AACzC,0FAA0F;AAC1F,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC;AAChH,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CA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
|
|
|
21
21
|
threat_modeler:
|
|
22
22
|
options:
|
|
23
23
|
system_prompt: "You are an Application Security (AppSec) expert assistant. You are responsible for performing risk assessment on the source code repository for SOC2 type 2 compliance audit: 1. Start with drawing the ASCII text based Data Flow Diagrm (DFD), with output format as <codebase_data_flow_diagram_text_timestamp>; 2. then proceeding to use STRIDE methodology to perform threat modeling on the DFD, without output report in the format <codebase_threat_model_timestamp>; 3. finally, provide a seperate risk registry report including proposed remediation plan in the format <codebase_risk_registry_text_timestamp>. We're looking for 3 reports in the current working directory as the deliverable."
|
|
24
|
+
max_turns: 100
|
|
24
25
|
output_format: "markdown"
|
|
25
26
|
verbose: True
|
|
27
|
+
threat_adversary:
|
|
28
|
+
options:
|
|
29
|
+
system_prompt: "You are a senior application security engineer performing an adversarial second pass on a STRIDE threat model. Skeptically verify each threat against the real codebase using Read and Grep. Keep only threats with a concrete, demonstrable attack path and confirmed source_locations. Drop generic, mitigated, or ungrounded threats. Reconcile risks and metadata counts. Output the full filtered threat_model_report JSON."
|
|
30
|
+
output_format: "json"
|
|
31
|
+
max_turns: 100
|
|
32
|
+
verbose: True
|
|
26
33
|
pr_reviewer:
|
|
27
34
|
options:
|
|
28
35
|
diff_reviewer_system_prompt: null # Use enhanced hardcoded prompt; set here to override
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jest stub for @openai/codex-sdk (ESM-only; CI stays mock-only).
|
|
3
|
+
*/
|
|
4
|
+
export declare const Codex: jest.Mock<any, any, any>;
|
|
5
|
+
export type CodexOptions = {
|
|
6
|
+
codexPathOverride?: string;
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
apiKey?: string;
|
|
9
|
+
config?: Record<string, unknown>;
|
|
10
|
+
env?: Record<string, string>;
|
|
11
|
+
};
|
|
12
|
+
export type Input = string | Array<{
|
|
13
|
+
type: string;
|
|
14
|
+
text?: string;
|
|
15
|
+
path?: string;
|
|
16
|
+
}>;
|
|
17
|
+
export type ThreadOptions = Record<string, unknown>;
|
|
18
|
+
export type TurnOptions = {
|
|
19
|
+
outputSchema?: unknown;
|
|
20
|
+
signal?: AbortSignal;
|
|
21
|
+
};
|
|
22
|
+
export type ThreadEvent = {
|
|
23
|
+
type: 'item.updated';
|
|
24
|
+
item: {
|
|
25
|
+
id: string;
|
|
26
|
+
type: string;
|
|
27
|
+
text?: string;
|
|
28
|
+
};
|
|
29
|
+
} | {
|
|
30
|
+
type: 'item.completed';
|
|
31
|
+
item: {
|
|
32
|
+
id: string;
|
|
33
|
+
type: string;
|
|
34
|
+
text?: string;
|
|
35
|
+
};
|
|
36
|
+
} | {
|
|
37
|
+
type: 'turn.completed';
|
|
38
|
+
usage: {
|
|
39
|
+
input_tokens: number;
|
|
40
|
+
output_tokens: number;
|
|
41
|
+
cached_input_tokens: number;
|
|
42
|
+
reasoning_output_tokens: number;
|
|
43
|
+
};
|
|
44
|
+
} | {
|
|
45
|
+
type: 'turn.failed';
|
|
46
|
+
error: {
|
|
47
|
+
message: string;
|
|
48
|
+
};
|
|
49
|
+
} | {
|
|
50
|
+
type: 'error';
|
|
51
|
+
message: string;
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=codex_sdk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex_sdk.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/mocks/codex_sdk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,KAAK,0BAAY,CAAC;AAE/B,MAAM,MAAM,YAAY,GAAG;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,K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AA,KAAK,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC"}
|
|
@@ -95,7 +95,7 @@ export declare class AgentActions {
|
|
|
95
95
|
/**
|
|
96
96
|
* Threat modeler agent with options
|
|
97
97
|
*/
|
|
98
|
-
threatModelerAgentWithOptions(userPrompt: string): Promise<string>;
|
|
98
|
+
threatModelerAgentWithOptions(userPrompt: string, srcDir?: string | null): Promise<string>;
|
|
99
99
|
/**
|
|
100
100
|
* Code fixer agent with structured JSON output.
|
|
101
101
|
* Returns the structured fix JSON and prints cost to stdout.
|
|
@@ -142,6 +142,10 @@ export declare class AgentActions {
|
|
|
142
142
|
* pr_adversary: batch adversarial pass over candidate findings (structured security report out).
|
|
143
143
|
*/
|
|
144
144
|
prAdversaryWithOptions(userPrompt: string, srcDir?: string | null): Promise<string>;
|
|
145
|
+
/**
|
|
146
|
+
* threat_adversary: adversarial second pass over first-pass threat model (filtered report out).
|
|
147
|
+
*/
|
|
148
|
+
threatAdversaryWithOptions(userPrompt: string, srcDir?: string | null): Promise<string>;
|
|
145
149
|
/**
|
|
146
150
|
* PR diff-focused code reviewer with options
|
|
147
151
|
* Optimized for reviewing only changed code from a pull request
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent_actions.d.ts","sourceRoot":"","sources":["../../src/agent_actions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;I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