API key double encoded in Elasticsearch metricset
- Dominant language
- Go
- Stars
- 12.7k
- Forks
- 5k
- Avg merge
- 2d 15m
- Merged PRs (30d)
- 385
Description
https://github.com/elastic/beats/blame/d8606faa49423044c9f1952b57fd486ea99c7275/metricbeat/module/elasticsearch/metricset.go#L112
A option was added to the Elasticsearch metricset to retrieve an Elasticsearch API key from the environment and use that in an `Authorization` header after base64 encoding it.
However, API keys returned by Elasticsearch are already base64 encoded. This leads to double encoding the key. Requests to Elasticsearch will subsequently be rejected with HTTP 401.
Contributor guide
Research direction
Start at metricbeat/module/elasticsearch/metricset.go around line 112 and trace how the environment-provided API key becomes the Authorization header. Confirm requests use the already base64-encoded key only once and verify Elasticsearch metricset requests no longer receive HTTP 401 responses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elasticsearch, go
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100