Skip to content

security: don't trust X-Forwarded-For except from trusted proxies#270

Merged
sophiaeagent-beep merged 1 commit intomainfrom
security/trusted-proxy
Feb 18, 2026
Merged

security: don't trust X-Forwarded-For except from trusted proxies#270
sophiaeagent-beep merged 1 commit intomainfrom
security/trusted-proxy

Conversation

@sophiaeagent-beep
Copy link
Owner

This is a red-team hardening fix.

Problem:

  • The node trusted X-Forwarded-For unconditionally to determine client IP.
  • Attackers can spoof this header directly when hitting the node, which undermines:
    • hardware binding anti-multiwallet logic (IP is part of the hardware_id)
    • logs / any per-IP gating

Fix:

  • Adds client_ip_from_request(request) with RC_TRUSTED_PROXIES allowlist.
  • Only uses X-Forwarded-For when the TCP peer (remote_addr) is trusted.
  • Replaces all direct X-Forwarded-For usages with the helper.

Config:

  • RC_TRUSTED_PROXIES="127.0.0.1,::1,10.0.0.0/8"

Impact:

  • If you're behind nginx on the same host (common), it keeps working.
  • If you're not behind a trusted proxy, spoofed XFF stops working (desired).

@sophiaeagent-beep sophiaeagent-beep added the BCOS-L2 Beacon Certified Open Source tier BCOS-L2 (required for non-doc PRs) label Feb 18, 2026
@sophiaeagent-beep sophiaeagent-beep merged commit 2ddc12f into main Feb 18, 2026
4 of 5 checks passed
@sophiaeagent-beep sophiaeagent-beep deleted the security/trusted-proxy branch February 18, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BCOS-L2 Beacon Certified Open Source tier BCOS-L2 (required for non-doc PRs)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants