-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: check apikeys for otlp requests too (+tests) #672
Conversation
@@ -37,6 +37,25 @@ func (r *Router) queryTokenChecker(next http.Handler) http.Handler { | |||
}) | |||
} | |||
|
|||
func (r *Router) isKeyAllowed(key string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is called on every request, it could be nice to be able to check the key in a map instead of looping through a slice each time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing that would require changing the data type of the config value to a map, and writing code that parses the current configuration into it both on initial load and on reload. It's a good idea, but it's something that a) we've already lived with for a long time, b) in practice might even be more expensive because most installations just have ["*"]
as the value, and c) and I'd rather do it as a separate issue as part of the config rework.
## Which problem is this PR solving? - #671 -- Refinery's APIKeys configuration value was not being used for OTel requests ## Short description of the changes - Refactor middleware to pull out the key-validation logic - Use it in the http middleware - Call it in the OTLP handler - Add a normal (mocked) test for OTLP - Add an integration test for HTTP
## Which problem is this PR solving? - #671 -- Refinery's APIKeys configuration value was not being used for OTel requests ## Short description of the changes - Refactor middleware to pull out the key-validation logic - Use it in the http middleware - Call it in the OTLP handler - Add a normal (mocked) test for OTLP - Add an integration test for HTTP
## Which problem is this PR solving? - #671 -- Refinery's APIKeys configuration value was not being used for OTel requests ## Short description of the changes - Refactor middleware to pull out the key-validation logic - Use it in the http middleware - Call it in the OTLP handler - Add a normal (mocked) test for OTLP - Add an integration test for HTTP
Which problem is this PR solving?
Short description of the changes