-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[exporter/datadog] add basic API key validation on startup #36510
base: main
Are you sure you want to change the base?
[exporter/datadog] add basic API key validation on startup #36510
Conversation
|
going to look into this, not clear immediately if it's just broken/outdated test or if my change broke the intended behavior |
there may still be a discussion to be had around if we need to improve our API Key validation logic, but this keeps the behavior of v0.110.0 and prior so as to not break existing customers |
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.
This error comes from changes in the confmap and it is intentional. You can see the "0123"
row in https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/rfcs/env-vars.md#comparison-table-with-current-behavior that is this very case. I think we should not do this change and just think about how to improve the user experience (I left a concrete suggestion below).
pkg/datadog/config/config.go
Outdated
// remove leading/trailing quotation marks to avoid issues with the API key | ||
c.API.Key = configopaque.String(strings.Trim(string(c.API.Key), `"'`)) |
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.
I think we should not do this. If we want to improve user experience we should validate the API format (e.g. I think a reasonable check that we can do is to check for any character that is not an ASCII alphanumeric and error out when those are present)
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.
I have changed the approach to validate hex characters via regex
Description
adds basic hexadecimal character validation to Datadog API key on startup
Link to tracking issue
Fixes #36509
Testing
new "invalid API Key" test
Documentation
changelog file