agentaudit 3.12.1 → 3.12.3
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/cli.mjs +706 -300
- package/index.mjs +1 -1
- package/package.json +1 -1
- package/prompts/audit-prompt.md +65 -27
package/index.mjs
CHANGED
|
@@ -343,7 +343,7 @@ async function checkRegistry(slug) {
|
|
|
343
343
|
// ── MCP Server ───────────────────────────────────────────
|
|
344
344
|
|
|
345
345
|
const server = new Server(
|
|
346
|
-
{ name: 'agentaudit', version: '3.12.
|
|
346
|
+
{ name: 'agentaudit', version: '3.12.3' },
|
|
347
347
|
{ capabilities: { tools: {} } }
|
|
348
348
|
);
|
|
349
349
|
|
package/package.json
CHANGED
package/prompts/audit-prompt.md
CHANGED
|
@@ -4,7 +4,7 @@ You are a security auditor analyzing a software package. Follow the three phases
|
|
|
4
4
|
|
|
5
5
|
**LANGUAGE REQUIREMENT: Write ALL findings in ENGLISH. This includes `title`, `description`, `remediation` fields in the JSON report.**
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**YOU must extract `package_version` from manifest files (package.json, pyproject.toml, setup.py). The backend enriches `commit_sha`, PURL, SWHID, and content hashes — but `package_version` must come from YOU.**
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -452,43 +452,70 @@ For every README, package.json description, tool description, and SKILL.md: comp
|
|
|
452
452
|
## source_url Rules
|
|
453
453
|
The `source_url` field MUST point to a **source code repository** — never a product website, API endpoint, or marketing page.
|
|
454
454
|
- **Best:** GitHub/GitLab repository URL
|
|
455
|
-
- **OK:**
|
|
455
|
+
- **OK:** AgentAudit package URL (`https://agentaudit.dev/packages/package-slug`)
|
|
456
456
|
- **OK:** npm/PyPI package URL as last resort
|
|
457
457
|
- **NEVER:** Company websites, API URLs, app URLs
|
|
458
458
|
|
|
459
|
-
To find source_url: check `package.json` → `repository.url`, `_meta.json` → `source`/`repository`, `README.md` → GitHub links. If none found, use `https://
|
|
459
|
+
To find source_url: check `package.json` → `repository.url`, `_meta.json` → `source`/`repository`, `README.md` → GitHub links. If none found, use `https://agentaudit.dev/packages/{slug}`.
|
|
460
460
|
|
|
461
461
|
## JSON Report Format
|
|
462
462
|
|
|
463
|
+
**EVERY field shown below is REQUIRED. A finding missing ANY field (especially `cwe_id`, `content`, `remediation`) is INVALID — do not emit it.**
|
|
464
|
+
|
|
463
465
|
```json
|
|
464
466
|
{
|
|
465
467
|
"skill_slug": "package-name",
|
|
466
468
|
"source_url": "https://github.com/owner/repo",
|
|
467
|
-
"
|
|
469
|
+
"package_type": "mcp-server",
|
|
470
|
+
"package_version": "1.2.3",
|
|
471
|
+
"risk_score": 23,
|
|
472
|
+
"max_severity": "high",
|
|
468
473
|
"result": "safe",
|
|
469
474
|
"findings_count": 2,
|
|
470
475
|
"findings": [
|
|
471
476
|
{
|
|
472
|
-
"severity": "high",
|
|
473
477
|
"pattern_id": "CMD_INJECT_001",
|
|
474
478
|
"cwe_id": "CWE-78",
|
|
479
|
+
"severity": "high",
|
|
475
480
|
"title": "Unescaped user input passed to exec()",
|
|
476
|
-
"description": "User-controlled input from
|
|
481
|
+
"description": "User-controlled input from the 'command' tool argument is passed directly to child_process.exec() without sanitization at runner.js:42. An attacker can inject arbitrary shell commands via the MCP tool call.",
|
|
477
482
|
"file": "src/runner.js",
|
|
478
|
-
"file_hash": "e3b0c442...",
|
|
479
483
|
"line": 42,
|
|
480
484
|
"content": "exec(req.body.command)",
|
|
485
|
+
"remediation": "Validate input against an allowlist of permitted commands; use execFile() with explicit argument array instead of exec()",
|
|
481
486
|
"confidence": "high",
|
|
482
|
-
"remediation": "Validate and sanitize input; use allowlist of permitted commands",
|
|
483
487
|
"by_design": false,
|
|
484
488
|
"score_impact": -15
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
"pattern_id": "INFO_LEAK_001",
|
|
492
|
+
"cwe_id": "CWE-200",
|
|
493
|
+
"severity": "medium",
|
|
494
|
+
"title": "Stack trace exposed in error response",
|
|
495
|
+
"description": "Unhandled errors in the /api/query endpoint return the full stack trace to the client at handler.js:87, potentially revealing internal file paths and dependency versions.",
|
|
496
|
+
"file": "src/handler.js",
|
|
497
|
+
"line": 87,
|
|
498
|
+
"content": "res.status(500).json({ error: err.stack })",
|
|
499
|
+
"remediation": "Return a generic error message to the client; log the full stack trace server-side only",
|
|
500
|
+
"confidence": "high",
|
|
501
|
+
"by_design": false,
|
|
502
|
+
"score_impact": -5
|
|
485
503
|
}
|
|
486
504
|
]
|
|
487
505
|
}
|
|
488
506
|
```
|
|
489
507
|
|
|
490
508
|
### Required Top-Level Fields
|
|
491
|
-
`skill_slug`, `risk_score`, `result`, `findings_count`, `findings`.
|
|
509
|
+
`skill_slug`, `source_url`, `package_type`, `risk_score`, `max_severity`, `result`, `findings_count`, `findings`.
|
|
510
|
+
- `package_version`: Extract from `package.json` → `version`, `pyproject.toml` → `[project] version`, `setup.py` → `version=`. Use `"unknown"` only if no version file exists.
|
|
511
|
+
- `max_severity`: Highest severity across all findings. Use `"none"` if no findings.
|
|
512
|
+
- Do NOT nest `risk_score` or `result` inside a summary object.
|
|
513
|
+
|
|
514
|
+
### Required Finding Fields (ALL mandatory)
|
|
515
|
+
Every finding MUST include ALL of these fields:
|
|
516
|
+
`pattern_id`, `cwe_id`, `severity`, `title`, `description`, `file`, `line`, `content`, `remediation`, `confidence`, `by_design`, `score_impact`
|
|
517
|
+
|
|
518
|
+
**A finding without `cwe_id` or `content` or `remediation` is INVALID. Do not emit incomplete findings.**
|
|
492
519
|
|
|
493
520
|
### Field Defaults
|
|
494
521
|
- `by_design`: default `false` (set `true` only when all 4 criteria in §3.9 met)
|
|
@@ -504,21 +531,32 @@ To find source_url: check `package.json` → `repository.url`, `_meta.json` →
|
|
|
504
531
|
|
|
505
532
|
**Only use:** `safe`, `caution`, or `unsafe`.
|
|
506
533
|
|
|
507
|
-
### Version
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
534
|
+
### Version & Provenance
|
|
535
|
+
- `package_version`: YOU must extract this from `package.json` → `version`, `pyproject.toml` → `[project] version`, `setup.py` → `version=`, or `Cargo.toml` → `version`. Use `"unknown"` only if no version file exists.
|
|
536
|
+
- `commit_sha`, `content_hash`: Auto-enriched by backend. Do not include unless available.
|
|
537
|
+
- Per-finding `file_hash` (SHA-256) is optional but recommended for staleness detection.
|
|
538
|
+
|
|
539
|
+
### CWE ID (REQUIRED — findings without cwe_id are INVALID)
|
|
540
|
+
Every finding MUST include `cwe_id`. Use the most specific CWE. If unsure, use the closest parent.
|
|
541
|
+
|
|
542
|
+
**Pattern ID → CWE mapping (use as default, override if more specific CWE applies):**
|
|
543
|
+
| Pattern | Default CWE | Pattern | Default CWE |
|
|
544
|
+
|---------|------------|---------|------------|
|
|
545
|
+
| CMD_INJECT | CWE-78 | CRED_THEFT | CWE-522 |
|
|
546
|
+
| DATA_EXFIL | CWE-200 | DESTRUCT | CWE-912 |
|
|
547
|
+
| OBF | CWE-506 | SANDBOX_ESC | CWE-693 |
|
|
548
|
+
| SUPPLY_CHAIN | CWE-1357 | SOCIAL_ENG | CWE-451 |
|
|
549
|
+
| PRIV_ESC | CWE-269 | INFO_LEAK | CWE-200 |
|
|
550
|
+
| CRYPTO_WEAK | CWE-327 | DESER | CWE-502 |
|
|
551
|
+
| PATH_TRAV | CWE-22 | SEC_BYPASS | CWE-693 |
|
|
552
|
+
| PERSIST | CWE-912 | AI_PROMPT | CWE-1426 |
|
|
553
|
+
| MCP_POISON | CWE-1426 | MCP_INJECT | CWE-94 |
|
|
554
|
+
| MCP_TRAVERSAL | CWE-22 | MCP_SUPPLY | CWE-1357 |
|
|
555
|
+
| MCP_PERM | CWE-269 | WORM | CWE-912 |
|
|
556
|
+
| CICD | CWE-912 | CORR | CWE-829 |
|
|
557
|
+
|
|
558
|
+
**More specific CWEs (use when applicable):**
|
|
559
|
+
`CWE-79` XSS, `CWE-89` SQL Injection, `CWE-94` Code Injection, `CWE-918` SSRF, `CWE-798` Hardcoded Credentials, `CWE-321` Hardcoded Crypto Key, `CWE-862` Missing Authorization, `CWE-532` Log Injection, `CWE-362` Race Condition, `CWE-601` Open Redirect, `CWE-434` Unrestricted Upload, `CWE-1321` Prototype Pollution, `CWE-338` Weak PRNG, `CWE-1333` ReDoS
|
|
522
560
|
|
|
523
561
|
### Pattern ID Prefixes
|
|
524
562
|
Use: `CMD_INJECT`, `CRED_THEFT`, `DATA_EXFIL`, `DESTRUCT`, `OBF`, `SANDBOX_ESC`, `SUPPLY_CHAIN`, `SOCIAL_ENG`, `PRIV_ESC`, `INFO_LEAK`, `CRYPTO_WEAK`, `DESER`, `PATH_TRAV`, `SEC_BYPASS`, `PERSIST`, `AI_PROMPT`, `CORR`, `MCP_POISON`, `MCP_INJECT`, `MCP_TRAVERSAL`, `MCP_SUPPLY`, `MCP_PERM`, `WORM`, `CICD`, `MANUAL`.
|
|
@@ -526,12 +564,12 @@ Use: `CMD_INJECT`, `CRED_THEFT`, `DATA_EXFIL`, `DESTRUCT`, `OBF`, `SANDBOX_ESC`,
|
|
|
526
564
|
---
|
|
527
565
|
|
|
528
566
|
# ═══════════════════════════════════════════════
|
|
529
|
-
#
|
|
567
|
+
# OUTPUT
|
|
530
568
|
# ═══════════════════════════════════════════════
|
|
531
569
|
|
|
532
|
-
|
|
570
|
+
Respond with ONLY the JSON report. No markdown fences, no explanation, no text before or after. The CLI handles upload automatically.
|
|
533
571
|
|
|
534
|
-
If no findings: still
|
|
572
|
+
If no findings: still output the report with empty `findings` array, `result: "safe"`, `risk_score: 0`, `max_severity: "none"` — clean audits are valuable data.
|
|
535
573
|
|
|
536
574
|
---
|
|
537
575
|
|