Fix gRPC bind host fail-open#2
Merged
Merged
Conversation
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.
Motivation
MN_CORE_HOSTvalues as no bind restriction, which could expose unauthenticated control APIs to all interfaces.localhostvalues do not silently remove the loopback binding and instead fail closed to loopback.Description
MN_CORE_HOST(trim and to_string) and centralize parsing ingrpc_bind_opts/1so empty and whitespace variants bind to127.0.0.1.:inet.parse_address/1and treat any parse failure as a loopback-binding decision viagrpc_loopback_opts/1.Logger.warning/1when a non-literal, non-localhosthost is provided to notify operators that the listener is being restricted to loopback.tests/unit/application_test.exsto cover localhost variants, IP literals, and invalid hostnames, and updateREADME.mdto document the binding behavior.Testing
mix format --check-formattedcompleted successfully.lib/mirror_neuron/application.exand exercisedMirrorNeuron.Application.grpc_bind_opts/1, which validated localhost normalization, IP literal passthrough, and fail-closed behavior and emitted the expected warning.mix deps.get/mix testcould not be run due to environment/network restrictions preventing Hex from being fetched, so the new unit test file was added but could not be executed in this environment.Codex Task