Skip to content

Commit

Permalink
Merge pull request #342 from zunda/bind-on-ipv6
Browse files Browse the repository at this point in the history
Always permit IPv4-mapped IPv6 loopback addresses
  • Loading branch information
gsamokovarov authored Dec 19, 2024
2 parents f3d437c + c66460a commit 859bc60
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/web_console/permissions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module WebConsole
class Permissions
# IPv4 and IPv6 localhost should be always allowed.
ALWAYS_PERMITTED_NETWORKS = %w( 127.0.0.0/8 ::1 )
ALWAYS_PERMITTED_NETWORKS = %w( 127.0.0.0/8 ::1 ::ffff:127.0.0.0/104 )

def initialize(networks = nil)
@networks = normalize_networks(networks).map(&method(:coerce_network_to_ipaddr)).uniq
Expand Down
3 changes: 2 additions & 1 deletion test/web_console/permissions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class PermissionsTest < ActiveSupport::TestCase

assert_includes permissions, "127.0.0.1"
assert_includes permissions, "::1"
assert_includes permissions, "::ffff:127.0.0.1"
end

test "permits single IPs" do
Expand Down Expand Up @@ -41,7 +42,7 @@ class PermissionsTest < ActiveSupport::TestCase
end

test "human readable presentation" do
assert_includes permit.to_s, "127.0.0.0/127.255.255.255, ::1"
assert_includes permit.to_s, "127.0.0.0/127.255.255.255, ::1, ::ffff:127.0.0.0/::ffff:127.255.255.255"
end

private
Expand Down

0 comments on commit 859bc60

Please sign in to comment.