Skip to content

fix: tolerate quotes and host bits in HP_TRUSTED_PROXY_IPS and keep valid entries - #112

Open
oleksandr-nc wants to merge 1 commit into
mainfrom
fix/trusted-proxy-ips-parsing
Open

fix: tolerate quotes and host bits in HP_TRUSTED_PROXY_IPS and keep valid entries#112
oleksandr-nc wants to merge 1 commit into
mainfrom
fix/trusted-proxy-ips-parsing

Conversation

@oleksandr-nc

Copy link
Copy Markdown
Contributor

Values for HP_TRUSTED_PROXY_IPS often arrive with literal quotes (env files, compose list syntax, systemd units) and are then rejected, which silently disables client IP detection and lets bruteforce protection ban the reverse proxy for everyone behind it. Quotes are now stripped, ranges with host bits set are masked to their network the same way Nextcloud handles trusted_proxies, and invalid entries are skipped individually instead of discarding the whole list. Fixes #108.

@oleksandr-nc
oleksandr-nc requested a review from kyteinsky as a code owner July 28, 2026 13:26
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@oleksandr-nc, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f0c8ea9c-ee86-4c51-9d5b-6351950d3834

📥 Commits

Reviewing files that changed from the base of the PR and between 44eeb38 and cd65ab7.

📒 Files selected for processing (2)
  • README.md
  • haproxy_agent.py
📝 Walkthrough

Walkthrough

Trusted proxy parsing now tokenizes comma-separated environment values, strips surrounding quotes and whitespace, normalizes network entries with host bits, and logs ignored invalid entries. TRUSTED_PROXIES is initialized from the new parser, with header-based client IP detection disabled when no valid networks are found. The README documents these behaviors.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change to HP_TRUSTED_PROXY_IPS parsing and retaining valid entries.
Description check ✅ Passed The description matches the implemented changes and the linked issue context.
Linked Issues check ✅ Passed The PR addresses #108 by handling quoted HP_TRUSTED_PROXY_IPS values instead of rejecting them.
Out of Scope Changes check ✅ Passed The extra host-bit normalization and per-entry invalid filtering are consistent with the stated PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
haproxy_agent.py (1)

78-114: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression tests for the trusted-proxy parser.

This security-sensitive path should cover quoted comma-separated values, host-bit normalization, mixed valid/invalid entries, and the no-valid-entry fallback that disables forwarded-header trust.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 66481226-e3a5-44b0-9292-a9c91ef104f7

📥 Commits

Reviewing files that changed from the base of the PR and between e0cb449 and 44eeb38.

📒 Files selected for processing (2)
  • README.md
  • haproxy_agent.py

…alid entries

Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
@oleksandr-nc
oleksandr-nc force-pushed the fix/trusted-proxy-ips-parsing branch from 44eeb38 to cd65ab7 Compare July 28, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs for HP_TRUSTED_PROXY_IPS should remove double quotes or handle them in the bash script

1 participant