fix(config): resolve Python reliably, add command-safety hook, harden CI
- Resolve Python 3.11+ through shared Resolve-Python.ps1/resolve-python.sh, which probe python, python3 and py -3 and skip the Windows Store alias. Build and capability checks fail early with an actionable message; doctor reports missing Python and the skipped hooks. - Fix check-capabilities.sh comparing only the major version. - Register Validate-CommandSafety as a PreToolUse hook for Claude and Codex; shared logic in command-safety.py catches rm -rf variants, git reset --hard, git clean -f, Remove-Item -Recurse, del/rd /s /q and nested shells. - Replace duplicated placeholder chains in both builds with adapters/placeholders.tsv. - Restore shell parity: add test-capabilities.sh, rename credentials.ps1 to with-credential.ps1 and qmd-warm.sh to start-qmd-warm.sh. - CI: build once and pass generated/ as an artifact, lint Python with ruff and JavaScript modules with node --check, require SHA pins for all actions. - Add evals for all own skills and update documentation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e19aa2e27c
commit
79694fbaa2
95 files changed
+1838
-218
No files matched your search
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"skill_name": "security-review",
|
||||
"evals": [
|
||||
{
|
||||
"id": 1,
|
||||
"prompt": "Security review this new file-download endpoint (Node/Express). Authenticated users should only download files from their own folder under `/data/uploads/<userId>/`.\n\n```js\napp.get('/download', requireAuth, (req, res) => {\n const file = req.query.name;\n const p = path.join('/data/uploads', req.user.id, file);\n res.sendFile(p);\n});\n```",
|
||||
"expected_output": "Should map the trust boundary (query parameter from an authenticated user) and the resource (filesystem). Should identify path traversal: name=../<otherUserId>/secret.pdf or ../../../etc/passwd escapes the user folder since path.join normalizes '..'. Should build a plausible attack path (attacker capability: any authenticated user; input; missing control: no containment check; impact: read other users' files or server files). Should state severity, preconditions, impact, and a practical fix (resolve the path and verify it stays within the user's base directory, or use sendFile's root option), failing closed. Should separate confirmed vulnerability from defense-in-depth suggestions.",
|
||||
"assertions": [
|
||||
"Identifies path traversal via the name query parameter",
|
||||
"Gives a concrete attack input such as ../ sequences reaching another user's folder or system files",
|
||||
"States the precondition that the attacker only needs to be authenticated",
|
||||
"States severity and impact",
|
||||
"Proposes a fix that resolves the path and verifies it stays inside the user's directory, or uses an equivalent root option",
|
||||
"The fix fails closed by rejecting paths outside the allowed directory",
|
||||
"Separates the confirmed vulnerability from defense-in-depth suggestions"
|
||||
],
|
||||
"files": []
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"prompt": "Can you check this config change for security issues?\n\n```yaml\n# docker-compose.prod.yml\nservices:\n api:\n environment:\n - DB_PASSWORD=Pr0d-S3cret!\n - CORS_ORIGINS=*\n - ASPNETCORE_ENVIRONMENT=Development\n ports:\n - \"0.0.0.0:5432:5432\"\n```\nThis file is committed to the repo.",
|
||||
"expected_output": "Should report evidence-backed findings: hardcoded production database password committed to the repository (secret exposure; requires rotation); database port exposed on all interfaces; ASPNETCORE_ENVIRONMENT=Development in production (likely detailed error pages leaking internals); CORS wildcard (impact depends on credential use; may be defense-in-depth unless credentials allowed). Each with severity, preconditions, impact, and practical fix. Should recommend rotating the leaked secret, not just removing it.",
|
||||
"assertions": [
|
||||
"Flags the committed production DB password as secret exposure",
|
||||
"Recommends rotating the exposed password in addition to removing it from the file",
|
||||
"Flags exposing port 5432 on all interfaces",
|
||||
"Flags running with ASPNETCORE_ENVIRONMENT=Development in production",
|
||||
"Discusses the CORS wildcard and qualifies its impact or classifies it appropriately",
|
||||
"States severity and preconditions for each finding"
|
||||
],
|
||||
"files": []
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"prompt": "Security review this helper. Be thorough, list every possible vulnerability.\n\n```python\nALLOWED_SORT = {'name', 'created_at'}\n\ndef list_projects(conn, user_id: int, sort: str):\n if sort not in ALLOWED_SORT:\n raise ValueError('invalid sort')\n return conn.execute(\n f\"SELECT id, name FROM projects WHERE owner_id = %s ORDER BY {sort}\",\n (user_id,),\n ).fetchall()\n```\n`user_id` comes from the authenticated session, not from the request.",
|
||||
"expected_output": "Despite the request to list every possible vulnerability, should report only evidence-backed findings. The interpolated sort is validated against an allowlist, user_id is parameterized and comes from the session, and results are scoped by owner. Should conclude there is no confirmed vulnerability and not invent attack scenarios. May list defense-in-depth notes separately and clearly labeled.",
|
||||
"assertions": [
|
||||
"Recognizes that sort is validated against an allowlist before interpolation",
|
||||
"Recognizes that user_id is parameterized and sourced from the session",
|
||||
"States that no confirmed vulnerability was found",
|
||||
"Does not report SQL injection as a confirmed vulnerability",
|
||||
"Labels any remaining suggestions as defense-in-depth rather than vulnerabilities"
|
||||
],
|
||||
"files": []
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user