MEDIUM - Privacy degradation (heuristic, advisory)
Detects circuits/contracts exposing more public outputs than strictly necessary for verification, potentially leaking information the ZK scheme was meant to keep private.
// ❌ BAD: Over-broad public outputs leak private data
pub fn verify_credit_score(
env: Env,
proof: Proof,
public_inputs: Vec<u64>
) {
// Public: [ssn, income, debt, score, is_above_700]
// ❌ Only need is_above_700, rest should be private!
verify_zk_proof(&env, proof, &public_inputs);
let is_qualified = public_inputs[4];
if is_qualified != 1 {
panic!("Credit check failed");
}
}Privacy leak: Exposes SSN, income, debt - defeats ZK purpose.
// ✅ GOOD: Minimal public outputs preserve privacy
pub fn verify_credit_score(
env: Env,
proof: Proof,
is_above_700: u64
) {
// Public: [is_above_700] only
// ✅ Private in circuit: SSN, income, debt, actual score
verify_zk_proof(&env, proof, &[is_above_700]);
if is_above_700 != 1 {
panic!("Credit check failed");
}
}- Privacy failure: ZK provides no protection if data public
- Compliance risk: Expose PII unnecessarily
- Security degradation: More attack surface
- Count public inputs to verification
- Compare against minimal expected set
- Flag if substantially more (advisory)
- Requires manual review to confirm
Note: This is a heuristic/advisory rule, not a hard proof of leakage.
- Only expose final boolean/commitment results
- Keep intermediate values private
- Document why each public input is necessary
- Use circuit design reviews
- #1192, #1194: ZK infrastructure
See contracts/fixtures/finding-codes/z012_public_output_overexposure.rs