Add security.rs lower-bound limit tests for capped list routes (#431) #959
No reviewers
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic!959
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-431-limit-lower-bound-security-tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
GitLab #431 (SEC-F05): the seven capped list routes in
indexer/tests/security.rsalready had upper-bound tests (limit=99999) but no lower-bound coverage forlimit=-1orlimit=0.This MR adds seven integration tests (one per route) asserting the defined contract: negative/zero
limitvalues clamp to 1 via.clamp(1, max)→ HTTP 200 with at most one row (never a negative SQLLIMIT→ 500, per #284). Docs and the LCD security skill cross-link the new tests.Routes covered: pair trades, pair candles, oracle history, trader trades, limit-fills, limit-placements, limit-cancellations.
Acceptance checklist
security.rshaslimit=-1test on all seven capped list routescd indexer && cargo test --test security -j 1 -- --test-threads=1 pair_trades_negative pair_candles_negative oracle_history_negative trader_trades_negative limit_fills_negative limit_placements_negative limit_cancellations_negativesecurity.rshaslimit=0test on all seven capped list routes-1and0)indexer/tests/security.rs*_negative_and_zero_limit_clamp_to_onetestsVerification checklist (third parties)
make setup-indexer-postgres(or existing Postgres +indexer/.env)cd indexer && cargo test --test security -j 1 -- --test-threads=1— all 35 tests passcd indexer && cargo test --test api_limit_lower_bound -j 1 -- --test-threads=1— 16 tests pass (every SQL-backed list endpoint, #317)Related context
docs/indexer-invariants.md(Numeric query caps row)indexer/tests/api_limit_lower_bound.rs(#317)indexer/tests/limit_clamp_guardrail.rsSecurity review — MR !959
Commit reviewed:
536ff00cc15846244262c2982094c555df448e21Scope:
indexer/tests/security.rs(7 lower-boundlimitintegration tests + shared helper),docs/indexer-invariants.md,skills/AGENTS_INDEXER_API_LCD_SECURITY.mdOutcome:
FINDINGS: 0medium+Summary
Security review: no medium+ findings on this diff.
This MR is test-and-documentation only — no production indexer, CosmWasm, or frontend code changes. The added tests assert the existing
.clamp(1, max)contract on seven capped list routes (limit=-1/limit=0→ HTTP 200, at most one row) and align with the production handlers inpairs.rs,traders.rs, andoracle.rswherelimitis bound before parameterized SQL.Attack-path trace (reviewed routes): attacker-controlled
limitquery param →Option<i64>deserialize →.clamp(1, MAX)→i64bind to SQLLIMIT. Negative/zero values cannot reach Postgres as invalidLIMIT(historical #284 class). No new injection surface, auth bypass, secret leakage, SSRF, or deserialization risk introduced by the diff.Inline threads: none (no findings to anchor).
Prior security-review notes on this MR: none found.
mentioned in commit
55cf80af2ementioned in issue #431