Conversation
🔍 Crucible Security ReviewSummaryAdds Reclaim User Map example contract for integrating with the Reclaim protocol. Stores user data based on verified Reclaim proofs. Security Assessment
Immunefi Pattern Check
False Report Risk
Code Quality
RecommendationApprove - Clean integration example with proper error handling. Add documentation clarifying this is an example contract. |
crucible-burnt
left a comment
There was a problem hiding this comment.
🔍 Crucible Security Review
Summary
New contract implementing a user→value map populated via Reclaim protocol proof verification. Users submit proofs that are verified by an external Reclaim contract, and extracted claim values are stored per-user.
Security Assessment
- Risk Level: Medium
Findings:
-
⚠️ State stored before proof verification (src/contract.rs:51-55):USER_MAP.save()is called before the Reclaim verification sub-message executes. However, this is safe because CosmWasm executes atomically — if the Reclaim contract rejects the proof, the entire transaction reverts including theUSER_MAP.save(). Not a vulnerability, but worth a comment for clarity. -
JSON parsing uses
HashMap<&str, Value>(src/contract.rs:44): Thecontextfield is parsed with borrowed string keys from thevalueinput. This is fine for lifetime management sincevaluelives for the duration of the function. -
value.to_string()onserde_json::Value(src/contract.rs:50): This will include JSON quotes for string values (e.g.,"\"hello\""instead of"hello"). If consuming contracts/queries expect unquoted strings, this could cause issues. Consider usingv.as_str().unwrap_or(&v.to_string())for string values. -
No access control on
ExecuteMsg::Update: Any address can callUpdateand store a value for themselves. This is by design (self-sovereign claims), but verify this is intentional — there's no admin override or pause mechanism. -
No value size limit: The
verified_valuestring stored per user has no size bound. A malicious Reclaim proof with an extremely large extracted parameter could cause storage bloat. Consider adding a max value length check. -
Pinned
reclaim_xiondependency (Cargo.toml:21): Uses a specific git rev5c67c33d— good for reproducibility, but should be periodically updated. -
always_failgetrandom override (src/lib.rs:13-17): Standard CosmWasm pattern, correctly implemented.
Immunefi Pattern Check
- Trust boundary is the external Reclaim verification contract — if that contract has vulnerabilities, this contract's stored values could be based on invalid proofs
- No direct cryptographic operations — delegates to Reclaim contract
- No fee/gas manipulation vectors
False Report Risk
- The "state before verification" pattern could invite incorrect bug reports about TOCTOU or state manipulation. Consider adding a comment explaining CosmWasm's atomic execution guarantees.
Code Quality Notes
- Error types are minimal but appropriate
- No unit tests included — recommend adding tests for JSON parsing edge cases, empty context, missing keys
- Consider adding an admin/pause mechanism for emergency response
Status
Functional implementation with correct security model. Main recommendations: document the atomic execution assumption, fix to_string() quoting behavior, add value size limits, and include unit tests.
Description
Contract Details
Please append all the required information below for the contract(s) being added to
contracts.json.Required fields and their descriptions:
name: Contract name (required)description: Brief description of the contract's purposecode_id: Contract code ID on mainnethash: Contract hash in UPPERCASErelease:url: URL to the release/commit (e.g., https://github.com/org/repo/releases/tag/v1.0.0)version: Version tag or first 7 chars of commit hashauthor:name: Organization nameurl: Organization website URLgovernance: "Genesis" or proposal numberdeprecated: true if contract is deprecated (mixed inline with active contracts)Example JSON structure:
{ "name": "", "description": "", "code_id": "", "hash": "", "release": { "url": "", "version": "" }, "author": { "name": "", "url": "" }, "governance": "", "deprecated": false }Finding Code ID and Hash
To find the latest code ID and hash:
Documentation Updates
The README.md is automatically generated from
contracts.json. After making changes:Ensure you have the required dependencies:
brew install jq(macOS) orapt-get install jq(Ubuntu/Debian)Run the convert script to validate and update the README:
Commit both the
contracts.jsonand generatedREADME.mdchangescontracts.json./convert.shlocally, the CI will fail with a "README out of sync" errorValidation
The
convert.shscript automatically performs these validations:If any validation fails, the script will show specific error messages to help you fix the issues.
Checklist
contracts.jsonwith all required fields./convert.shand fixed any validation errorscontracts.jsonand generatedREADME.mdare included in the commitAdditional Notes