Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/admin/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ http {

set_real_ip_from 0.0.0.0/0;
real_ip_recursive on;
real_ip_header X-Forward-For;
real_ip_header X-Forwarded-For;
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/s;

access_log /dev/stdout;
Expand Down
2 changes: 1 addition & 1 deletion apps/space/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ http {

set_real_ip_from 0.0.0.0/0;
real_ip_recursive on;
real_ip_header X-Forward-For;
real_ip_header X-Forwarded-For;
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/s;
Comment on lines 12 to 15
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Confirm the same permissive trust list exists in all three nginx.conf files touched by this PR.
fd -t f 'nginx\.conf$' apps | xargs -I{} sh -c 'echo "=== {} ==="; grep -nE "set_real_ip_from|real_ip_header|real_ip_recursive|limit_req_zone" {}'

Repository: makeplane/plane

Length of output: 756


🏁 Script executed:

cd /tmp && git -C /tmp/makeplane/plane log --oneline -20 -- apps/space/nginx/nginx.conf apps/admin/nginx/nginx.conf apps/web/nginx/nginx.conf 2>/dev/null || echo "Git history unavailable; checking file content instead"

Repository: makeplane/plane

Length of output: 114


🏁 Script executed:

# Check if there are any diffs or recent changes to these files
git -C /tmp/makeplane/plane diff HEAD~5 -- apps/space/nginx/nginx.conf apps/admin/nginx/nginx.conf apps/web/nginx/nginx.conf 2>/dev/null | head -100 || echo "Unable to retrieve recent diffs"

Repository: makeplane/plane

Length of output: 41


🏁 Script executed:

# Search for 'X-Forward-For' (the alleged typo) in the current codebase to confirm it's been fixed everywhere
rg 'X-Forward-For' apps/

Repository: makeplane/plane

Length of output: 41


🏁 Script executed:

# Verify the security concern: check nginx documentation behavior for set_real_ip_from 0.0.0.0/0
# Also confirm all three files use $binary_remote_addr in rate limiting
rg -A 2 -B 2 'limit_req_zone.*\$binary_remote_addr' apps/

Repository: makeplane/plane

Length of output: 1000


set_real_ip_from 0.0.0.0/0 enables IP-spoofing attacks across all three Nginx configs.

The fix to real_ip_header X-Forwarded-For is correct, but it interacts dangerously with the trust list on line 12. Nginx is configured to trust every upstream as a legitimate proxy, so any direct client can send X-Forwarded-For: <attacker-ip> and Nginx will rewrite $remote_addr to that value. This defeats the limit_req_zone $binary_remote_addr rate limiting (trivial bypass by rotating spoofed IPs) and pollutes access logs.

This issue exists in all three affected files: apps/admin/nginx/nginx.conf, apps/space/nginx/nginx.conf, and apps/web/nginx/nginx.conf.

Restrict set_real_ip_from to actual proxy/CDN/load-balancer ranges only. For example:

-  set_real_ip_from        0.0.0.0/0;
+  set_real_ip_from        10.0.0.0/8;       # Docker/internal network
+  # set_real_ip_from      173.245.48.0/20;  # e.g. Cloudflare (if applicable)

If deployments must accept X-Forwarded-For from arbitrary sources, document this limitation clearly or make the trust list configurable.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
set_real_ip_from 0.0.0.0/0;
real_ip_recursive on;
real_ip_header X-Forward-For;
real_ip_header X-Forwarded-For;
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/s;
set_real_ip_from 10.0.0.0/8; # Docker/internal network
# set_real_ip_from 173.245.48.0/20; # e.g. Cloudflare (if applicable)
real_ip_recursive on;
real_ip_header X-Forwarded-For;
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/s;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/space/nginx/nginx.conf` around lines 12 - 15, The configuration
currently uses set_real_ip_from 0.0.0.0/0 with real_ip_header X-Forwarded-For,
which allows IP spoofing and defeats limit_req_zone using $binary_remote_addr
and $remote_addr; replace the wildcard trust with the actual
proxy/CDN/load-balancer CIDR ranges (or make set_real_ip_from values
configurable) so only trusted upstreams can set X-Forwarded-For, and document
the behavior if you must accept arbitrary sources; update the same change in the
other nginx.conf files that use set_real_ip_from, real_ip_header, and
limit_req_zone to ensure rate limits and logs remain reliable.


access_log /dev/stdout;
Expand Down
2 changes: 1 addition & 1 deletion apps/web/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ http {

set_real_ip_from 0.0.0.0/0;
real_ip_recursive on;
real_ip_header X-Forward-For;
real_ip_header X-Forwarded-For;
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/s;

access_log /dev/stdout;
Expand Down