basecamp / basecamp/thruster

IpSpoofAttackError for some users after switching from nginx to Thruster

Open
#98 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.2k
Forks
58
Avg merge
1d 2h
Merged PRs (30d)
6

Description

After deploying Thruster to production, **some** of our customers (most likely behind a corporate VPN or other setup) started seeing our HTTP ERROR 500 page.

Our error tracking software gave us this error (IP addresses changed)
`ActionDispatch::RemoteIp::IpSpoofAttackError: IP spoofing attack?! HTTP_CLIENT_IP="5.6.7.8" HTTP_X_FORWARDED_FOR="1.2.3.4"`

Before using Thruster, I was using a simple nginx container in front with minimal config that never had this issue
https://github.com/SteveLTN/https-portal

I like using Thruster, because I just add a gem, and instead I can remove 1 Docker container.

We are using `docker-compose.yml`, these are the relevant parts:
```
services:
app: &app_base
volumes:
- thruster:/rails/storage/thruster
environment:
- FORWARD_HEADERS=0

volumes:
app-postgres:
thruster:
```

I added the FORWARD_HEADERS=0 but that did not solve my spoofing issue.

This is probably not Thruster specific issue, but any suggestions or ideas would be welcome.
Maybe Thruster needs another ENV var to remove the HTTP_CLIENT_IP if that conflict is causing this?

This is how I reproduced the issue:
```bash
curl -i https://app.mydomain.com/ \
-H 'X-Forwarded-For: 1.2.3.4' \
-H 'Client-IP: 5.6.7.8'
```

Contributor guide

Open the contributing guide

Research direction

Start with the docker-compose.yml settings for Thruster and reproduce the failure using the provided curl command with both headers. Read how Thruster handles FORWARD_HEADERS and how Rails ActionDispatch reports the request, then compare behavior with and without FORWARD_HEADERS=0. Done means the reproduction no longer produces the IP spoofing error or HTTP 500 while the intended forwarded-client information remains understood.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker-compose, go, rails
Domain
backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.