Description
The CLI has no rate limiting on stellar RPC calls. In a scripted workflow (e.g., polling agreement status in a loop), the CLI could send hundreds of requests per second to the Stellar RPC endpoint, potentially exceeding rate limits and getting the user's IP banned. A configurable rate limiter prevents unintentional abuse.
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/feat/security-rate-limiting
Implement changes
- Add a rate limiter using governor or similar crate that limits to N requests per second
- Default limit: 10 requests/second (adjustable via STELLAR_RPC_RATE_LIMIT env var)
- Queue requests that exceed the rate limit and execute them when the window resets
- Log a warning when rate limiting is actively throttling requests
Test and commit
Test by sending 100 rapid requests — verify only 10/s go through and the rest are queued. Test with rate limit set to 0 (unlimited). Run cargo test.
Example commit message
feat(cli): add configurable outbound RPC rate limiting to prevent provider abuse
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
The CLI has no rate limiting on stellar RPC calls. In a scripted workflow (e.g., polling agreement status in a loop), the CLI could send hundreds of requests per second to the Stellar RPC endpoint, potentially exceeding rate limits and getting the user's IP banned. A configurable rate limiter prevents unintentional abuse.
Requirements and context
Suggested execution
Branch:
fix/feat/security-rate-limitingImplement changes
Test and commit
Test by sending 100 rapid requests — verify only 10/s go through and the rest are queued. Test with rate limit set to 0 (unlimited). Run cargo test.
Example commit message
Guidelines
mastercargo testornpm testbefore review