Require operator token for gRPC pause and resume#5
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
PauseJobandResumeJobgRPC RPCs previously allowed unauthenticated clients to change job lifecycle state, creating an availability/control vulnerability.Description
MirrorNeuron.Grpc.Authwhich readsMN_GRPC_OPERATOR_TOKENand providesauthorize_operator!/1andauthorized?/2to validate bearer or MirrorNeuron-specific token headers with a constant-time compare.PauseJobandResumeJobhandlers by callingMirrorNeuron.Grpc.Auth.authorize_operator!(stream)before invokingMirrorNeuron.pause/1orMirrorNeuron.resume/1.README.mdto document the newMN_GRPC_OPERATOR_TOKENconfiguration key.tests/unit/grpc/auth_test.exsthat exercise header extraction (including adapter/http request headers) and token matching behavior.Testing
mix format --check-formatted, which succeeded.elixir -r lib/mirror_neuron_grpc/auth.ex -e 'ExUnit.start()' tests/unit/grpc/auth_test.exs, and they completed with0 failures.mix testcould not be run to completion in this environment because Hex/dependency fetches failed (network/proxy preventedmix local.hex/ dependency installation).Codex Task