Empty auth-scheme support
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- go
- Domain
- authentication
Research direction
Start in config/http_config.go at the validation code linked in the issue, then reproduce the scrape configuration with an explicitly empty authorization type and credentials. Verify the generated Authorization header against the expected curl form, ensuring an empty scheme does not add the default Bearer prefix.
Written by the indexing model from the issue text.
Description
What did you do?
I want to scrape target secured via Authorization header, curl example:
curl -H "Authorization: $token" ...
Per docs i should be able to not use Bearer
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config
authorization:
# Sets the authentication type of the request.
[ type: <string> | default: Bearer ]
So i've set:
authorization:
type: ''
But in tcpdump i still see that Bearer prefix is added before token.
Validation code:
https://github.com/prometheus/common/blob/f57586dab602b7ae2607c552438a23a551f38773/config/http_config.go#L232
What did you expect to see?
I expect to being able to choose any auth-scheme, including nil one.
What did you see instead? Under which circumstances?
I see that Bearer auth-scheme is forced, i.e.:
curl -H "Authorization: Bearer $token" ...
instead of:
curl -H "Authorization: $token" ...
Environment
- Prometheus version:
prometheus, version 2.31.1 (branch: HEAD, revision: 411021ada9ab41095923b8d2df9365b632fd40c3)
build user: root@9419c9c2d4e0
build date: 20211105-20:35:02
go version: go1.17.3
platform: linux/amd64
- Prometheus configuration file:
scrape_configs:
- job_name: "auth"
authorization:
type: ''
credentials: SECRET_TOKEN
static_configs:
- targets:
- a.b.c:443
This could be fixed by verifying that type is explicitly set to empty string before callingTrimSpace. I can send PR if such a solution is fine.
- Dominant language
- Go
- Stars
- 297
- Forks
- 380
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 12
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from prometheus/common
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
prometheus/common#1051 ·
Maintainers usually reply within 2 days
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
prometheus/common#1023 ·
Maintainers usually reply within 2 days
-
expfmt: OpenMetrics 1.0 output with a unit that is not a name suffix fails the whole scrape in PrometheusPossibly taken @itsmeasadali claimed this 43 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 58/100
prometheus/common#1005 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
prometheus/common#876 · 1 comment ·
Maintainers usually reply within 2 days
-
Feature request: Add client_assertion field for oauth2 jwt-bearer grant typePossibly taken @alliasgher claimed this 220 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
prometheus/common#869 ·
Maintainers usually reply within 2 days
All issues in prometheus/common
Similar issues
-
Difficulty 2/5 Half a day Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
keyxmakerx/Chronicle#2616 ·
Maintainers usually reply within 1 day
-
tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
internal/mcp: an exported-but-empty env var is reported as configured but never injectedPossibly taken A pull request linked to this issue is open or already merged. Opengo good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day