Move the code and terraform audits into the reviews plugin

Copy the standalone code-review and terraform-review skills into
plugins/reviews as audit-code and audit-terraform. The rename separates the
automated, linter-driven audits from the guided review-pr walkthrough that
already lived here.

Resolve bundled script paths through ${SKILL_DIR}, exported in a new step 0.
CLAUDE_PLUGIN_ROOT is not set in the Bash tool environment, so the obvious
substitution would have expanded to nothing and broken every collection
script invocation.

Replace the PLAN and DESIGN docs with READMEs written from the current
SKILL.md and scripts. The old docs had drifted badly: they named semgrep
where the code calls opengrep, scoped five review agents where there are
now eight, and predated Lua, PowerShell, and GitHub Actions support.

Add CONSISTENCY_NORMS to the audit-terraform agent inputs. The collection
script writes consistency_norms.json and the agent prompt declares it, but
SKILL.md never listed it, leaving the variable unsubstituted.

Drop the --ingest-verdicts instruction from both skills. review_stats.py
parses no arguments, so the ref-mode verdict template it told users to feed
back could never be read.

Point audit-terraform's smoke test at README.md and resolve its fixture
paths relative to the test file rather than an absolute home directory.

Tests: 197 passing (audit-code), 106 passing (audit-terraform).
This commit is contained in:
2026-07-21 11:11:05 -05:00
parent 600c1fef86
commit f5934181ec
179 changed files with 20779 additions and 3 deletions
@@ -0,0 +1,18 @@
[
{
"message": "shellcheck reported issue in this script: SC2086:info:1:6: Double quote to prevent globbing and word splitting",
"filepath": ".github/workflows/ci.yml",
"line": 22,
"column": 9,
"kind": "shellcheck",
"snippet": " run: echo $SOME_VAR"
},
{
"message": "property \"foo\" is not defined in object type {}",
"filepath": ".github/workflows/ci.yml",
"line": 15,
"column": 20,
"kind": "expression",
"snippet": " - run: echo ${{ foo }}"
}
]
@@ -0,0 +1,28 @@
{
"results": [
{
"code": "...",
"filename": "src/api.py",
"issue_confidence": "HIGH",
"issue_severity": "HIGH",
"issue_text": "Possible SQL injection vector through string-based query construction.",
"line_number": 45,
"line_range": [45, 45],
"more_info": "https://bandit.readthedocs.io/en/latest/plugins/b608_hardcoded_sql_expressions.html",
"test_id": "B608",
"test_name": "hardcoded_sql_expressions"
},
{
"code": "...",
"filename": "src/api.py",
"issue_confidence": "MEDIUM",
"issue_severity": "LOW",
"issue_text": "Use of assert detected.",
"line_number": 12,
"line_range": [12, 12],
"test_id": "B101",
"test_name": "assert_used"
}
],
"metrics": {"_totals": {"SEVERITY.HIGH": 1, "SEVERITY.LOW": 1}}
}
@@ -0,0 +1,10 @@
Microsoft (R) Build Engine version 17.0
Copyright (C) Microsoft Corporation. All rights reserved.
/repo/src/Program.cs(22,5): warning SCS0018: Path traversal: injection possible. [/repo/src/MyApp.csproj]
/repo/src/Program.cs(45,12): error CS8602: Dereference of a possibly null reference. [/repo/src/MyApp.csproj]
/repo/src/Program.cs(60,8): warning CA1834: Use 'StringBuilder.Append(char)' for single-character strings. [/repo/src/MyApp.csproj]
Build succeeded.
1 Warning(s)
0 Error(s)
@@ -0,0 +1,33 @@
[
{
"filePath": "/repo/src/auth.ts",
"messages": [
{
"ruleId": "security/detect-eval-with-expression",
"severity": 2,
"message": "eval with non-literal expression",
"line": 22,
"column": 5,
"endLine": 22,
"endColumn": 35
},
{
"ruleId": "@typescript-eslint/no-explicit-any",
"severity": 1,
"message": "Unexpected any. Specify a different type.",
"line": 8,
"column": 12,
"endLine": 8,
"endColumn": 15
}
],
"errorCount": 1,
"warningCount": 1
},
{
"filePath": "/repo/src/utils.ts",
"messages": [],
"errorCount": 0,
"warningCount": 0
}
]
@@ -0,0 +1,20 @@
[
{
"RuleID": "aws-access-token",
"Description": "AWS Access Token",
"StartLine": 12,
"EndLine": 12,
"File": "src/config.py",
"Secret": "redacted",
"Match": "aws_access_key_id assignment"
},
{
"RuleID": "generic-api-key",
"Description": "Generic API Key",
"StartLine": 30,
"EndLine": 30,
"File": "src/api.py",
"Secret": "redacted",
"Match": "API key assignment"
}
]
@@ -0,0 +1,18 @@
[
{
"RuleName": "InjectionRisk.InvokeExpression",
"Severity": "Warning",
"ScriptPath": "/repo/scripts/Deploy.ps1",
"Line": 12,
"EndLine": 12,
"Message": "Possible script injection risk via the Invoke-Expression cmdlet."
},
{
"RuleName": "InjectionRisk.AddScriptBlock",
"Severity": "Warning",
"ScriptPath": "/repo/scripts/Deploy.ps1",
"Line": 33,
"EndLine": 35,
"Message": "Possible script injection risk via the AddScript method."
}
]
@@ -0,0 +1,5 @@
src/api.py:12: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]
src/api.py:45: error: Argument 1 has incompatible type "Any"; expected "str" [arg-type]
src/utils.py:8: note: Possible overload variants:
src/api.py:60: warning: Unused "type: ignore" comment [unused-ignore]
Found 3 errors in 2 files (checked 5 source files)
@@ -0,0 +1,27 @@
{
"version": "1.25.0",
"results": [
{
"check_id": "python.lang.security.audit.dangerous-code.dangerous-code",
"path": "src/api.py",
"start": {"line": 12, "col": 5},
"end": {"line": 12, "col": 30},
"extra": {
"severity": "ERROR",
"message": "Detected use of dynamic code construction.",
"metadata": {"cwe": ["CWE-94: Improper Control of Generation of Code ('Code Injection')"]}
}
},
{
"check_id": "javascript.lang.audit.dynamic-expression",
"path": "src/auth.ts",
"start": {"line": 22, "col": 5},
"end": {"line": 22, "col": 35},
"extra": {
"severity": "WARNING",
"message": "Dynamic expression with non-literal input",
"metadata": {"cwe": ["CWE-95"]}
}
}
]
}
@@ -0,0 +1,18 @@
{
"results": [
{
"source": {"path": "package-lock.json", "type": "lockfile"},
"packages": [
{
"package": {"name": "axios", "version": "0.21.0", "ecosystem": "npm"},
"vulnerabilities": [
{
"id": "GHSA-cph5-m8f7-6c5x",
"summary": "Axios is vulnerable to Server-Side Request Forgery"
}
]
}
]
}
]
}
@@ -0,0 +1,20 @@
{
"dependencies": [
{
"name": "pyyaml",
"version": "5.4.1",
"vulns": [
{
"id": "GHSA-8q59-q68h-6hv4",
"fix_versions": ["6.0"],
"description": "PyYAML vulnerable to arbitrary code generation"
}
]
},
{
"name": "requests",
"version": "2.31.0",
"vulns": []
}
]
}
@@ -0,0 +1,42 @@
[
{
"RuleName": "PSAvoidUsingInvokeExpression",
"Severity": "Warning",
"ScriptPath": "/repo/scripts/Deploy.ps1",
"Line": 12,
"EndLine": 12,
"Message": "Invoke-Expression is used. Please remove Invoke-Expression from script and find other options instead."
},
{
"RuleName": "PSAvoidUsingConvertToSecureStringWithPlainText",
"Severity": "Error",
"ScriptPath": "/repo/scripts/Deploy.ps1",
"Line": 20,
"EndLine": 22,
"Message": "File 'Deploy.ps1' uses ConvertTo-SecureString with plaintext."
},
{
"RuleName": "PSAvoidUsingWriteHost",
"Severity": "Warning",
"ScriptPath": "/repo/module/Helpers.psm1",
"Line": 5,
"EndLine": 5,
"Message": "File 'Helpers.psm1' uses Write-Host."
},
{
"RuleName": "PSUseDeclaredVarsMoreThanAssignments",
"Severity": "Information",
"ScriptPath": "/repo/module/Helpers.psm1",
"Line": 30,
"EndLine": 30,
"Message": "The variable 'unused' is assigned but never used."
},
{
"RuleName": "TypeNotFound",
"Severity": "ParseError",
"ScriptPath": "/repo/module/Helpers.psm1",
"Line": 41,
"EndLine": 41,
"Message": "Unable to find type [Foo]."
}
]
@@ -0,0 +1,23 @@
[
{
"code": "S608",
"location": {"row": 45, "column": 12},
"end_location": {"row": 45, "column": 80},
"filename": "src/api.py",
"message": "Possible SQL injection vector through string-based query construction"
},
{
"code": "E501",
"location": {"row": 30, "column": 1},
"end_location": {"row": 30, "column": 105},
"filename": "src/api.py",
"message": "Line too long (104 > 88)"
},
{
"code": "F401",
"location": {"row": 3, "column": 1},
"end_location": {"row": 3, "column": 20},
"filename": "src/api.py",
"message": "imported but unused"
}
]
@@ -0,0 +1,44 @@
[
{
"filename": "src/game.lua",
"primary_label": "undefined variable `undefined_var`",
"secondary_labels": [],
"notes": [],
"code": {
"name": "undefined_variable",
"severity": "Error"
},
"span": {
"start": {"line": 5, "character": 1},
"end": {"line": 5, "character": 14}
}
},
{
"filename": "src/game.lua",
"primary_label": "accessing undefined field `nonexistent` on type `table`",
"secondary_labels": [],
"notes": [],
"code": {
"name": "undefined_field",
"severity": "Warning"
},
"span": {
"start": {"line": 12, "character": 3},
"end": {"line": 12, "character": 15}
}
},
{
"filename": "src/game.lua",
"primary_label": "variable `_unused` is set but never used",
"secondary_labels": [],
"notes": [],
"code": {
"name": "unused_variable",
"severity": "Note"
},
"span": {
"start": {"line": 20, "character": 5},
"end": {"line": 20, "character": 12}
}
}
]
@@ -0,0 +1,3 @@
src/auth.ts(22,5): error TS2322: Type 'string' is not assignable to type 'number'.
src/utils.ts(8,12): error TS2345: Argument of type 'unknown' is not assignable to parameter of type 'string'.
src/index.ts(3,1): error TS6133: 'fs' is declared but its value is never read.
@@ -0,0 +1,65 @@
{
"version": "2.1.0",
"runs": [
{
"tool": {
"driver": {
"name": "zizmor",
"version": "1.0.0",
"rules": [
{
"id": "unpinned-uses",
"name": "Unpinned uses",
"shortDescription": {"text": "Action ref is not pinned to a SHA digest"},
"properties": {"tags": ["CWE-829"]}
},
{
"id": "excessive-permissions",
"name": "Excessive permissions",
"shortDescription": {"text": "Workflow grants write-all permissions"},
"properties": {"tags": []}
}
]
}
},
"results": [
{
"ruleId": "unpinned-uses",
"level": "warning",
"message": {"text": "uses: actions/checkout@v4 is not pinned by digest"},
"locations": [
{
"physicalLocation": {
"artifactLocation": {"uri": ".github/workflows/ci.yml"},
"region": {
"startLine": 12,
"startColumn": 9,
"endLine": 12,
"endColumn": 38
}
}
}
]
},
{
"ruleId": "excessive-permissions",
"level": "error",
"message": {"text": "Workflow uses write-all permissions; scope to minimum required"},
"locations": [
{
"physicalLocation": {
"artifactLocation": {"uri": ".github/workflows/ci.yml"},
"region": {
"startLine": 5,
"startColumn": 1,
"endLine": 5,
"endColumn": 30
}
}
}
]
}
]
}
]
}