Description
rpc.rs and commands/mod.rs place no length limits on user-supplied strings (agreement_id, proof_uri, addresses). An attacker could provide a 1MB agreement_id string, which would be passed to the stellar CLI and submitted as a contract argument. Large contract arguments increase Soroban resource usage and could cause out-of-gas failures or RPC rejection.
Requirements and context
- Security: Standard security review required for state-mutating changes
- Testing: Full test suite must pass; new tests for changed behavior
- Documentation: Update doc comments and README if user-facing
Suggested execution
Branch: fix/fix/security-input-limits
Implement changes
- Define maximum lengths: agreement_id (64 hex chars max), proof_uri (2048 chars), addresses (56 chars for Stellar keys)
- Add validation in config.rs or a new input.rs module that checks all string inputs against limits
- Return a clear error: 'Input exceeds maximum length of X characters'
- Apply validation in every command before passing to rpc.rs
Test and commit
Test with oversized agreement_id (65+ chars) — verify clear error. Test with oversized proof_uri. Test with valid inputs — no regression. Run cargo test.
Example commit message
fix(security): enforce strict input length limits on all CLI arguments to prevent oversized payload DoS
Guidelines
- Open a PR against
master
- Keep PR focused on this single concern
- Run
cargo test or npm test before review
- Ensure no lint or typecheck warnings
Description
rpc.rs and commands/mod.rs place no length limits on user-supplied strings (agreement_id, proof_uri, addresses). An attacker could provide a 1MB agreement_id string, which would be passed to the stellar CLI and submitted as a contract argument. Large contract arguments increase Soroban resource usage and could cause out-of-gas failures or RPC rejection.
Requirements and context
Suggested execution
Branch:
fix/fix/security-input-limitsImplement changes
Test and commit
Test with oversized agreement_id (65+ chars) — verify clear error. Test with oversized proof_uri. Test with valid inputs — no regression. Run cargo test.
Example commit message
Guidelines
mastercargo testornpm testbefore review