alexgreensh/repo-forensics / skills/repo-forensics
repo-forensics
FlaggedSecurity forensics for git repos, AI skills, and MCP servers. Audits dependencies, detects prompt injection, credential theft, runtime dynamism, manifest drift, known CVEs, CISA KEV (actively exploited) vulns, and 2026 attack patterns. Not for fixing vulnerabilities or pentesting.
tests/test_manifest_validity.py
View on GitHubimport json
from pathlib import Path
from validate_manifests import validate_manifests
REPO_ROOT = Path(__file__).resolve().parents[3]
def write_manifest(root, relative, content):
path = root / relative
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(json.dumps(content), encoding="utf-8")
def valid_root(tmp_path):
write_manifest(tmp_path, ".claude-plugin/plugin.json", {
"name": "repo-forensics", "version": "1.0.0", "author": {"name": "Example"},
})
def errors_for(tmp_path):
_, violations = validate_manifests(tmp_path)
return ["{}: {}".format(item["field"], item["message"]) for item in violations]
def test_real_manifests_are_valid():
"""Every shipped manifest and SKILL.md in this repo passes the gate.
Detection behaviour itself is covered hermetically with temporary files in
test_frontmatter_validity.py; this test only asserts the repo is clean.
"""
_, violations = validate_manifests(REPO_ROOT)
assert violations == []
def test_rejects_string_author(tmp_path):
valid_root(tmp_path)
write_manifest(tmp_path, ".codex-plugin/plugin.json", {
"name": "repo-forensics", "version": "1.0.0", "author": "Example",
})
assert any("author: must be an object with a string name" in error for error in errors_for(tmp_path))
def test_rejects_string_marketplace_author_and_owner(tmp_path):
valid_root(tmp_path)
write_manifest(tmp_path, ".claude-plugin/marketplace.json", {
"name": "example-marketplace", "owner": "Example", "plugins": [{
"name": "repo-forensics", "version": "1.0.0", "author": "Example",
}],
})
errors = errors_for(tmp_path)
assert any("owner: must be an object" in error for error in errors)
assert any("plugins[0].author: must be an object with a string name" in error for error in errors)
def test_rejects_invalid_json(tmp_path):
valid_root(tmp_path)
path = tmp_path / ".codex-plugin/plugin.json"
path.parent.mkdir()
path.write_text("{invalid", encoding="utf-8")
assert any("JSON: invalid JSON" in error for error in errors_for(tmp_path))
def test_rejects_uppercase_or_space_name(tmp_path):
valid_root(tmp_path)
write_manifest(tmp_path, ".codex-plugin/plugin.json", {"name": "Bad Name", "version": "1.0.0"})
assert any("name: must be kebab-case" in error for error in errors_for(tmp_path))
def test_rejects_reserved_name_prefix(tmp_path):
valid_root(tmp_path)
write_manifest(tmp_path, ".codex-plugin/plugin.json", {"name": "claude-tool", "version": "1.0.0"})
assert any("name: must not start with claude-" in error for error in errors_for(tmp_path))
def test_rejects_version_drift(tmp_path):
valid_root(tmp_path)
write_manifest(tmp_path, ".codex-plugin/plugin.json", {"name": "repo-forensics", "version": "9.9.9"})
assert any("version 9.9.9 does not match canonical version 1.0.0" in error for error in errors_for(tmp_path))
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |