Fix allowlist to honor IP addresses and CIDR ranges#78
Draft
ACK-J wants to merge 3 commits into
Draft
Conversation
IP addresses could be added to the allowlist but were never matched because origin hosts include ports (e.g. 127.0.0.1:8080) while entries were stored without them. Add host matching that treats portless IP entries as matching any port on the same address, and update settings UI to document IP support. Fixes #66 Co-authored-by: Hacks and Hops <ACK-J@users.noreply.github.com>
Extend allowlist matching so entries like 192.168.1.0/24 match any origin IP within the range. This supports homelab setups such as Proxmox web UIs that need to make local network requests without disabling the extension. Also centralize allowlist entry normalization in hostUtils.js. Fixes #64 Co-authored-by: Hacks and Hops <ACK-J@users.noreply.github.com>
The allowlist only checked the page origin, so whitelisting 127.0.0.1 did not help TestPortScans.html opened from file:// or localhost. IP and CIDR entries now also match local/private request targets. localhost is treated as equivalent to 127.0.0.1 for matching. Co-authored-by: Hacks and Hops <ACK-J@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #66 and #64 by making IP address and CIDR allowlist entries actually take effect.
Also fixes a follow-up issue where whitelisting
127.0.0.1did not stopTestPortScans.htmlfrom being blocked.Problem
127.0.0.1:8080) while entries were stored without them.TestPortScans.htmlfromfile://orlocalhostscans127.0.0.1as a third-party request, so whitelisting127.0.0.1had no effect on the destination.Solution
localhostis treated as equivalent to127.0.0.1discord.com)Example
file://(empty host)127.0.0.1:80127.0.0.1localhost127.0.0.1:80127.0.0.1evil.com127.0.0.1:80127.0.0.1evil.com10.0.0.1:80127.0.0.1evil.com127.0.0.1:80discord.comdiscord.com127.0.0.1:80discord.comTest plan
127.0.0.1to allowlist, openTestPortScans.htmlfrom disk, confirm127.0.0.1scans are not blocked192.168.1.0/24) and confirm Proxmox shell/console connections workdiscord.comallowlist still only applies to pages on discord.com, not all scans to local IPs