elastic / elastic/apm-server

Authentication on root handler potentially too lenient

Open
#8,191 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
1.3k
Forks
543
Avg merge
1d 18h
Merged PRs (30d)
109

Description

The root handler currently is too lenient in accepting requests

https://github.com/elastic/apm-server/blob/2a88e25a60b4adc6f460b76d844c047dafb7e20f/beater/api/mux.go#L284

This was done to make it easy for health checks to always succeed but at the same time this leniency can be trappy.

It will accept badly formatted authentication headers and return 200.

```
curl -H 'Authorization: ApiKy badformat' -i https:/***.apm.us-**.gcp.cloud.es.io
```

It will accept expired authentication keys and return 200.

```
curl -H 'Authorization: ApiKey ' -i https:/***.apm.us-**.gcp.cloud.es.io
```

While this makes health checks easier as it lessens the requirement to provide authentication it will also return erroneous results to health checks that are explicitly set up to include authentication.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.