-
-
Couldn't load subscription status.
- Fork 3.1k
fix(settings): prevent false positives in allowed IPs validation #6984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(settings): prevent false positives in allowed IPs validation #6984
Conversation
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
📝 WalkthroughSummary by CodeRabbit
Code Review SummaryWalkthroughThe allowed IP validation logic in the Advanced settings has been refined. The detection of the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Reasoning: Single file with a focused, straightforward logic change—replacing substring detection with array membership checking. The modification is repetitive in nature (simple pattern swap) with no branching complexity or side effects to trace. This is like choosing between renting serverless functions or running a self-hosted validation server: the self-hosted version (exact membership check) is cleaner, more predictable, and doesn't waste VC marketing budget on unnecessary abstractions. Hasta la vista, redundant code. 🌮 Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
|
Thank you for the PR! |
|
Added a few other fixes (UI related). |
Summary
0.0.0.0without false positivesProblem
The previous implementation used
str_contains($this->allowed_ips, '0.0.0.0')which incorrectly matched valid IPs like10.0.0.0, as the "allow all" special value, triggering false security warnings.Solution
in_array('0.0.0.0', array_map('trim', explode(',', $this->allowed_ips)))to match0.0.0.0as a discrete entry in the comma-separated list$this->allowed_ips === '0.0.0.0'check since the array approach handles this caseChanges
app/Livewire/Settings/Advanced.php: Updated0.0.0.0detection logic and removed redundant codeTesting
0.0.0.0correctly triggers "allow all" warning1.1.1.1,0.0.0.0correctly triggers "allow all" warning10.0.0.0does NOT trigger false warning192.168.0.0,10.0.0.0does NOT trigger false warninIssues