| name | security-review-checklist |
| description | Security review checklist for STWO. Separate from soundness review. Covers: side-channel surface, input validation, unsafe code audit, dependency security, API misuse patterns, and proof malleability. Run this for any change affecting the public API, proof format, hash functions, or memory-safety-critical code.
|
Security Review Checklist
When to Run
Run this checklist for changes touching:
- Public API surface (
prove(), verify(), CommitmentSchemeProver/Verifier)
- Hash function implementations (Blake2s, Poseidon252)
- Merkle tree operations (
vcs/, vcs_lifted/)
- Proof serialization/deserialization (
core/proof.rs)
- Memory allocation with
unsafe (see unsafe audit section)
- Dependency updates
- SIMD/FFT implementation
- Channel/Fiat-Shamir implementation
1. Input Validation
2. Proof Malleability
3. Side-Channel Resistance
Note: STWO is a prover, not a signing algorithm. Side-channel resistance
is less critical but still relevant for:
4. Unsafe Code Audit
For any new or modified unsafe block:
Known Unsafe Patterns in STWO
| Pattern | Files | Risk Level |
|---|
uninit_vec / set_len | Throughout prover | LOW — write-before-read guaranteed by fill loops |
from_simd_unchecked | SIMD backends | MEDIUM — caller must prove values < P |
| SIMD FFT raw pointers | simd/fft/rfft.rs, ifft.rs | HIGH — complex pointer arithmetic |
UnsafeMut/UnsafeConst | simd/utils.rs | MEDIUM — enables parallel FFT, requires no aliasing |
transmute for SIMD | simd/m31.rs, simd/blake2s.rs | MEDIUM — layout compatibility required |
mem::zeroed | simd/blake2s.rs | LOW — only for [u8] buffers |
5. Dependency Security
Current Crypto Dependencies
Check Cargo.toml for current versions. Key crates:
| Crate | Purpose |
|---|
| blake2 | Blake2s hash (verifier-compatible) |
| blake3 | Blake3 hash (optional) |
| starknet-crypto | Poseidon252 hash |
| starknet-ff | Felt252 field for Poseidon |
6. API Misuse Prevention
7. No-Std Compatibility
8. Denial of Service
Escalation Protocol
If ANY of the following are true, escalate to human review:
- New
unsafe code in the verifier (core/) path
- Modification to hash function usage
- New cryptographic dependency
- Change to proof serialization format
- Change that could affect no_std verifier compilation
Format:
SECURITY-ESCALATION:
File: [path]
Change: [description]
Attack surface: [what could be exploited]
Mitigation: [what protects against it]
Confidence: [percentage]