Skip to content

Follow-ups from post-merge review of #4 - #5

Merged
SunsetDrifter merged 1 commit into
netbirdio:mainfrom
SunsetDrifter:fix/pr4-review-followups
Jul 24, 2026
Merged

SunsetDrifter merged 1 commit into
netbirdio:mainfrom
SunsetDrifter:fix/pr4-review-followups

Conversation

@SunsetDrifter

@SunsetDrifter SunsetDrifter commented Jul 24, 2026 •

Copy link
Copy Markdown
Collaborator

Addresses the three review comments left on #4 after merge.

Reject permissive NETBIRD_TRUST_PROXY values

parseTrustProxy() accepted true/yes/on and passed the resulting true straight to Express trust proxy. In that mode Express trusts the leftmost X-Forwarded-For entry — fully client-controlled — so any caller could spoof its IP and bypass the per-IP rate limits introduced in #4 (login form, per-source PAT verification, OAuth routes). An operator typing NETBIRD_TRUST_PROXY=true to mean "yes, I'm behind a proxy" silently got the unsafe mode.

Bare booleans now fail startup with a message pointing at the safe equivalents (a hop count such as 1, or an Express preset/subnet such as loopback / 10.0.0.0/8), which can always express the same intent without the spoofing exposure. false/no/off, hop counts, and presets behave as before. README and .env.example updated to match.

Fix the LRU eviction assertion

The size-cap test asserted pool.get("b")).not.toBe(a) — comparing b's limiter against a's instance, which is never equal whether or not eviction happened. It now captures b's original limiter and asserts the re-get returns a different instance, mirroring the TTL test.

Leave NETBIRD_ENABLE_DIRECT_PAT unset in .env.example

The template pinned it to false, but the config fallback (!oauthEnabled) only applies when the variable is undefined. Copying the template and later setting NETBIRD_ENABLE_OAUTH=false left the deployment with no HTTP auth path, contradicting the comment above the line. The template now leaves it blank so the documented auto-enable still applies.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

…values, fix LRU test assertion, unset direct-PAT in env template

- NETBIRD_TRUST_PROXY now rejects bare booleans (true/yes/on) at startup:
  'trust proxy: true' makes Express trust the client-controlled leftmost
  X-Forwarded-For entry, letting anyone spoof their IP past the per-IP
  rate limits. Hop counts and presets remain supported.
- The LRU eviction test compared b's fresh limiter against a's instance,
  which is never equal regardless of eviction; it now captures and
  compares b's original reference.
- .env.example leaves NETBIRD_ENABLE_DIRECT_PAT unset so the documented
  auto-enable-when-OAuth-off fallback still applies to copied templates.
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 37 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: a4dfc9ec-e590-4231-98f9-19afcca54db0

📥 Commits

Reviewing files that changed from the base of the PR and between 5a42ca2 and c5f5de3.

📒 Files selected for processing (5)
  • .env.example
  • README.md
  • src/config.ts
  • test/config.test.ts
  • test/limiterPool.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@SunsetDrifter
SunsetDrifter merged commit a4bdba4 into netbirdio:main Jul 24, 2026
2 checks passed
@SunsetDrifter
SunsetDrifter deleted the fix/pr4-review-followups branch July 24, 2026 15:09
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.

1 participant