agent: introduce path allow list for requests going through the metrics proxy #9059
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.
Added a new option
ui_config.metrics_proxy.path_allowlist
. This defaults to["/api/v1/query", "/api/v1/query_range"]
when the metrics provider is set toprometheus
.Requests that do not use one of the allow-listed paths (via exact match) get a 403 Forbidden response instead.
checklist
agent/config/config.go
.agent/config/runtime.go
.agent/config/builder.go
totranslate.
TestFullConfig
inagent/config/runtime_test.go
, it should fail now, thenadd the same random value to the expected struct in that test so it passes
again.
TestSanitize
in the samefile. (Running the test first gives you a nice diff which can save working
out where etc.)
some cases or with some values (often true).
agent/config/builder.go
.TestConfigFlagsAndEdgeCases
inagent/config/runtime_test.go
.DefaultSource
inagent/config/defaults.go
.TestConfigFlagsAndEdgeCases
inagent/config/runtime_test.go
.any state the feature needs changing. This needs to be added to one or
more of the following places:
ReloadConfig
inagent/agent.go
if it needs to affect the localclient state or another client agent component.
ReloadConfig
inagent/consul/client.go
if it needs to affectstate for client agent's RPC client.
agent/agent_test.go
similar to others with prefixTestAgent_reloadConfig*
.website/pages/docs/agent/options.mdx
.