Skip to content

Add hackenproof-audit-scope skill (Rust + Solidity audit scoping) - #27

Open
obs441 wants to merge 1 commit into
hackenproof-public:mainfrom
obs441:feat/audit-scope-calculator
Open

obs441 wants to merge 1 commit into
hackenproof-public:mainfrom
obs441:feat/audit-scope-calculator

Conversation

@obs441

@obs441 obs441 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Addresses #7 — a pre-sales scoping skill for Sales Managers. This first version prices Rust and Solidity only; the web/mobile (API-documentation-based) part of the issue is deferred to a follow-up.

Given a repo URL or local folder (optionally a branch/commit and the client's scope folders), the skill:

  • Counts billable nSLOC with a comment- and string-aware tokenizer. Tests, mocks, scripts, interfaces, examples, generated code and vendored dependencies are listed but excluded. Rust #[cfg(test)] modules inside source files are removed from the source count (30–60 % of a file in typical CosmWasm/Anchor repos).
  • Ranks the most critical files from weighted security indicators (assembly, delegatecall, oracles, cross-chain, CPI, unsafe, precision math, …) evaluated on comment-stripped code, with plain-English reasons.
  • Suggests a complexity tier and produces an effort estimate: auditor-days by phase (core review, reporting, retest), a range, calendar weeks for a given team size, and a sensitivity table across all three tiers. Rates are documented in references/effort-model.md and overridable via --rates; they are starting values for the audit team to calibrate.
  • Screens the repository before anyone opens it: prompt-injection text in comments/docs/agent-config files, hidden Unicode (Trojan Source, homoglyphs, zero-width), and code-execution hazards (build.rs, .cargo/config overrides, proc-macro crates, ffi = true, npm lifecycle scripts, VS Code folder-open tasks, .envrc, dev-container hooks, .mcp.json, in-repo CLAUDE.md). Any HIGH finding stops the workflow with an escalation note.
  • Writes a one-page scoping summary from a template that always carries "heuristic — confirm with the audit lead before quoting".

The bundled script (scripts/audit_scope.py, stdlib only, Python 3.8+) is strictly read-only: it never builds, installs, tests or executes anything from the target repo. The skill instructs the agent never to cd into the clone or load its agent-instruction files.

Verification

  • Per-file counts compared with cloc 2.06: identical on OpenZeppelin Contracts (420 files) and CosmWasm cw-plus (87 files). The 5 differing files in coral-xyz/anchor are cloc truncating strings at // inside URLs, i.e. cloc undercounts there.
  • Tier calibration on seven public repos: OpenZeppelin, solmate, Uniswap v2-core, Raydium AMM → high; anchor, cw-plus → medium.
  • Zero HIGH false positives on those repos after avoiding domain vocabulary (Solidity override, Solana "instructions", "send tokens").
  • Planted-injection fixture fires every expected HIGH exactly once without affecting line counts.
  • Clone by branch/tag/commit SHA and client --include filters exercised end to end.

Files

plugins/hackenproof-audit-scope/
  .claude-plugin/plugin.json
  skills/hackenproof-audit-scope/
    SKILL.md
    agents/openai.yaml
    scripts/audit_scope.py
    references/counting-rules.md
    references/critical-code-heuristics.md
    references/effort-model.md
    references/injection-screening.md
    references/scope-report-template.md
.claude-plugin/marketplace.json   (new entry)
README.md                         (new section)

Follow-ups

  • Calibrate effort-model.md rates against real engagements.
  • Web/mobile scoping from API documentation (remaining bullet of Audit scope calculation #7).

🤖 Generated with Claude Code

Pre-sales scoping plugin for Sales Managers, addressing hackenproof-public#7 (Rust and
Solidity only; web/mobile deferred):

- Read-only script counts billable nSLOC (comments/blank lines excluded;
  tests, mocks, scripts, interfaces, examples, generated code and vendored
  deps separated; Rust #[cfg(test)] modules removed from source)
- Ranks security-critical files from weighted indicators on
  comment-stripped code and suggests a complexity tier
- Estimates effort (auditor-days by phase, range, calendar weeks,
  sensitivity across tiers); rates documented and overridable via --rates
- Screens the repository for prompt-injection text, hidden Unicode, and
  code-execution hazards (build.rs, .cargo/config, foundry ffi, npm
  lifecycle scripts, IDE auto-run tasks, direnv, in-repo agent configs);
  HIGH findings stop the workflow
- Counts verified identical to cloc on OpenZeppelin and cw-plus; tiers
  calibrated on seven public repos with zero HIGH false positives

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants