Add tower-governor rate limits and trim public indexer status metrics (#328) #502
No reviewers
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:open_issues
agents
agent:security_audit
agent:verify
area
timecurve
arena
arena-v2
audit
block:feature_review
block:security
bug
contracts
design
devops
docs
documentation
enhancement
epic
feature
frontend
indexer
low priority
megaeth
operations
ops
performance
QA
qa checklist
referrals
removal
security
smart-contracts
tech-debt
testing
time-arena
timecurve
visual-qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/yieldomega!502
Loading…
Reference in a new issue
No description provided.
Delete branch "issue-328-rate-limit-status-trim"
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
Implements GitLab #328 (parent #325 F-07/F-08): in-process per-peer HTTP rate limiting via
tower_governor, and a trimmed publicGET /v1/statussurface.tower_governoron all routes exceptGET /healthz(defaults:INDEXER_RATE_LIMIT_PER_MIN=600,INDEXER_RATE_LIMIT_BURST=120;0disables). Returns 429 with{"error":"rate limit exceeded"}.INDEXER_TRUST_PROXY=1usesSmartIpKeyExtractorfor reverse-proxy deployments.GET /v1/status(schema 2.13.0) exposes onlyschema_version,database_connected,max_indexed_block,ingestion_alive.GET /v1/status/opsserves fullrpc_metrics/chain_pointerwhenINDEXER_EXPOSE_OPS_METRICS=1.INV-INDEXER-328-*), verify scripts, and agent skill cross-links updated.Acceptance checklist
bash scripts/verify-indexer-rate-limit.shbash scripts/verify-podium-live-anvil.sh/v1/statusomitsrpc_metricsby defaultbash scripts/verify-indexer-rpc-metrics.sh(checks public + ops)/healthzsuitable for LB probesbash scripts/verify-indexer-rate-limit.sh(healthz=200 under throttle)cargo clippy+cargo testcd indexer && cargo clippy --all-targets -- -D warnings && cargo testcd indexer && cargo test --test integration_stage2(needsYIELDOMEGA_PG_TEST_URL)cd frontend && npm run typecheck && npm testVerification for third parties
bash scripts/bootstrap-cloud-postgres-native.sh(or existing Postgres on:5433).export PATH="$HOME/.foundry/bin:$PATH"andsource /usr/local/cargo/env.bash scripts/verify-indexer-rate-limit.shbash scripts/verify-indexer-rpc-metrics.shbash scripts/verify-podium-live-anvil.shcd indexer && cargo clippy --all-targets -- -D warnings && cargo testEnv knobs documented in
indexer/.env.exampleandindexer/README.md§328.Related
Security review — MR !502
Commit reviewed:
4b1daab6f697ffd2dc66e548229ba3c3be5cbb49Scope:
indexer/src/rate_limit.rs,indexer/src/api.rs,indexer/src/main.rs,indexer/Cargo.toml, verify scripts, docs/skill cross-links (#328).Outcome:
FINDINGS: 0medium+ — NONESummary
Reviewed added/modified code for injection, authn/authz bypass, info disclosure, SSRF/XSS, and rate-limit bypass paths. No prior security-review threads on this MR.
Rate limiting (
tower_governor):PeerIpKeyExtractor+into_make_service_with_connect_info— client IP from TCPConnectInfo, not attacker-controlledX-Forwarded-For.INDEXER_TRUST_PROXY=1enablesSmartIpKeyExtractor(documented for reverse-proxy deployments only). Spoofed XFF bypass is a known misconfiguration class when the indexer is reachable without a trusted proxy stripping client headers; default is off./healthzexemption is intentional for LB probes; handler is minimal (200 ok).retain_recent()sweep limits governor storage growth.Status surface trim:
GET /v1/statusnow omitsrpc_metrics,chain_pointer, andlast_indexed_at_ms(reduced disclosure vs pre-MR).GET /v1/status/opsreturns detailed metrics only whenINDEXER_EXPOSE_OPS_METRICS=1(default off); otherwise404. No new auth boundary — this narrows what was previously always public on/v1/status.Other: No new SQL/shell sinks, no smart-contract changes, no secret logging.
tower_governor 0.8.0is a standard axum middleware dependency.Inline threads: none (no medium+ findings).
mentioned in commit
35cecc13fementioned in issue #328