Repository navigation
Add IP-based access control to web server - #3
Merged
Merged
Conversation
Link MusicBrainz Picard, Czkawka, dupeGuru, Duplicate Cleaner, and MusicBrainz to their respective websites.
- Default bind to 127.0.0.1:8080 (localhost only) instead of 0.0.0.0 - Add --allow-ip flag (repeatable, CIDR notation) with DUPSONIC_ALLOW_IP env var - Add --bind env var support via DUPSONIC_BIND - Implement IP middleware: checks client IP against allow list, returns 403 for non-matching IPs. Handles IPv4-mapped IPv6 addresses. - When --allow-ip is not set, all connections are permitted (no filtering) - Add 10 unit tests for IP access control (IPv4, IPv6, CIDR, mapped addresses) - Update README and ADVANCED.md with access control documentation
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
Add security features to the built-in web server: localhost-only by default and IP/CIDR-based access control.
Changes
Breaking change: the default bind address is now
127.0.0.1:8080(was0.0.0.0:8080). Users who expose the server on the network need to explicitly pass--bind 0.0.0.0:8080.New flags:
--bindDUPSONIC_BIND127.0.0.1:8080--allow-ipDUPSONIC_ALLOW_IPExamples:
Implementation:
ConnectInfo<SocketAddr>+ipnetcrate for CIDR matching::ffff:x.x.x.x→x.x.x.x)Testing
cargo test)Docs