Skip to content

Releases

nearsc 0.1.2

Choose a tag to compare

@vinibarbosabr vinibarbosabr released this 12 Nov 20:02
da0626d

nearsc is a deterministic security scanner for NEAR smart contracts, plus an MCP server (nearsc-mcp) that gives coding agents the scanner and a knowledge base of real NEAR audit precedent. Offline, no LLM in the scan path, byte-stable output for the same input.

Install

cargo install nearsc        # CLI
cargo install nearsc-mcp    # MCP server for coding agents

Prebuilt binaries (linux x86_64/aarch64, macOS x86_64/aarch64) are attached below with SHA-256 checksums. From source: git clone https://github.com/vinibarbosabr/nearsc-auditor && cd nearsc-auditor && cargo install --path crates/nearsc --locked.

Try it

git clone https://github.com/vinibarbosabr/nearsc-auditor
cd nearsc-auditor
cargo run -p nearsc -- scan examples/vulnerable-contract
# 12 findings (critical 2, high 4, medium 5, low 1, info 0)

What's inside v0.1.2

  • nearsc CLI: scan (text/JSON/SARIF/HTML, --only, --min-severity, --fail-on, --output), rules list|show, contract <account_id> (public RPC + audited-build registry), kb-index.
  • 13 rules (NS001–NS013): 1-yocto auth, callback privacy, unchecked promise results, unguarded init/upgrade paths, unbounded iteration, storage griefing, insecure randomness, arbitrary promise targets, deposit-refund gaps, privileged setters, repeatable balance drains. Every rule ships a vulnerable + patched fixture pair as the test oracle.
  • nearsc-mcp: five read-only tools (nearsc_scan, nearsc_patterns, nearsc_audits, nearsc_contract_info, nearsc_poc_scaffold) over stdio, with path confinement and account-id validation.
  • Embedded knowledge base: 15 pattern classes, 7 audit entries, 2 postmortems, 3-entry audited-build registry — sourced, linked, confidence-labeled.
  • GitHub Action (action/), dogfooded in CI with SARIF upload to code scanning. Agent skill (nearsc-skill/SKILL.md).

What changed since 0.1.0

  • False-positive campaign on the exhaustively audited sputnik-dao-contract snapshot: 29 findings (v0.1.0) → 6 (v0.1.1, ABI gate + matcher corrections) → 2 (v0.1.2), with no true positive lost. Details in docs/FALSE-POSITIVES.md.
  • New rule NS013 balance-drain-transfer (high, heuristic) — catches the repeatable storage_withdraw drain the baseline rule set found only by hand (the snapshot's largest rule gap).
  • ABI gate: #[near] trait-impl methods are treated as exported (they inherit the trait's publicity); delegated guard helpers (self.assert_owner()-shaped) are credited when the same file defines a guard-shaped helper.
  • docs/: false-positive policy (docs/FALSE-POSITIVES.md), per-rule detection prose updated for v0.1.2 (docs/RULES.md).

Verified

  • CI green on the tagged commit (fmt, clippy -D warnings, tests, fixture-oracle dogfood scan, action self-scan with SARIF upload).
  • cargo install nearsc --version 0.1.2 + cargo install nearsc-mcp --version 0.1.2 verified from a clean directory with a fresh target dir; scan of the bundled example reproduces the 12-finding summary. (Confirmed 2026-11-12, see the pinned install-verification issue.)

Links

Notes

  • Built at NEAR HACKATHON 2026 (Nov 9–14). Baseline: tag pre-hackathon; in-window diff: pre-hackathon...v0.1.2
  • Static analysis is not a substitute for a manual audit. False-positive notes are documented per rule in docs/RULES.md.
  • The scan path never executes scanned code and makes no network calls; only nearsc contract / nearsc_contract_info use public RPC.