fix(indexer): disable IPv6 API listener by default for rate limiting (#282) #779
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!779
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "cursor/gitlab-issue-workflow-0680"
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
Addresses https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/work_items/282 per the deployment topology confirmed in issue comments:
CF-Connecting-IP/X-Forwarded-Forabsent on Render) → rate limits key on socket peer IP viaPeerIpKeyExtractor(not a spoofable SmartIp/XFF extractor).API_IPV6_ENABLEDoff) → API binds an IPv4-only socket; IPv6API_BINDvalues are rejected at config parse. Avoids IPv6/64address-rotation abuse without /64 bucketing (per PlasticDigits feedback on !776).Changes
indexer/src/api/mod.rs:bind_api_listener()(socket2, IPv4 domain when IPv6 off);PeerIpKeyExtractorreplaces custom /64 extractor.indexer/src/config.rs:api_ipv6_enabled+API_IPV6_ENABLEDenv;Ipv6BindDisabledconfig error.docs/indexer-invariants.md,skills/AGENTS_INDEXER_API_LCD_SECURITY.md,indexer/.env.example.Acceptance criteria
PeerIpKeyExtractorkeys distinct IPv4 peers independently (cargo test --lib peer_ip_extractor_keys_distinct_ipv4_peers).cargo test --lib peer_ip_extractor_ignores_forwarded_headers— X-Forwarded-For / Forwarded headers do not change bucket keyAPI_IPV6_ENABLEDdefaults off;cargo test --lib api_listener+cargo test --lib ipv6_bind_rejectedVerification checklist (third parties)
Manual: set
API_BIND=::withoutAPI_IPV6_ENABLED=1→ indexer fails at startup withIpv6BindDisabled.Follow-ups
If deployment later sits behind a proxy that injects a trusted client-IP header, swap to a SmartIp extractor with the trusted hop configured (one-line change at
apply_rate_limit_layer).Related to #282
changed the description
changed the description
mentioned in issue #282
changed the description
Security review
Commit reviewed:
17e7cfb74f5ed7f550c131e412793e517effeabaScope: IPv4-only API listener (
bind_api_listener/API_IPV6_ENABLED), rate-limit keying switch toPeerIpKeyExtractor, config validation, docs/tests.Outcome:
FINDINGS: 0medium+This MR hardens abuse controls for the documented Render deployment (direct client exposure, no trusted forwarded-client header). Reviewed the diff and traced attacker-controlled inputs to sinks:
PeerIpKeyExtractorkeys only onConnectInfosocket peer IP;Forwarded/X-Forwarded-Forare ignored (unit-tested). No spoofable header path to another bucket or bypass.API_IPV6_ENABLED=offbinds an IPv4-only socket (Domain::IPV4viasocket2); IPv6API_BINDvalues fail at config parse and bind. Mitigates the prior abuse vector without introducing a new client-controlled bypass.API_IPV6_ENABLED=1restores per-address (not /64) bucketing; this is operator-controlled and documented, not attacker-triggerable on the default path.socket2dependency is a standard listen helper.Inline threads: none (no medium+ findings).
Prior MR comments: none to re-report.
mentioned in commit
2e2de53890