feat(proxy): add allow_hosts whitelist for restricting relay access#39
Open
mkarim1378 wants to merge 1 commit intomasterking32:python_testingfrom
Open
feat(proxy): add allow_hosts whitelist for restricting relay access#39mkarim1378 wants to merge 1 commit intomasterking32:python_testingfrom
mkarim1378 wants to merge 1 commit intomasterking32:python_testingfrom
Conversation
Add an opt-in per-host whitelist that, when non-empty, causes the proxy to return HTTP 403 for any host not explicitly listed. Empty by default so existing behavior is unchanged. - Add `allow_hosts` config key to config.example.json (default: []) - Load `_allow_hosts` rules in ProxyServer.__init__ alongside block/bypass - Add _is_whitelisted() method using the existing _host_matches_rules() engine (supports exact hostnames and leading-dot suffix patterns) - Insert whitelist check in _handle_target_tunnel() *after* the bypass check so bypass_hosts entries (e.g. .local, .lan) are always reachable regardless of whitelist contents Routing order is now: block → bypass → whitelist → normal routing
MOJISELFISH
reviewed
May 3, 2026
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.
Add an opt-in per-host whitelist that, when non-empty, causes the proxy to return HTTP 403 for any host not explicitly listed. Empty by default so existing behavior is unchanged.
allow_hostsconfig key to config.example.json (default: [])_allow_hostsrules in ProxyServer.init alongside block/bypassRouting order is now: block → bypass → whitelist → normal routing