Skip to content
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

priority of decrypt: kms > arn > use dd_api_key #478

Merged
merged 3 commits into from
Nov 25, 2024
Merged

Conversation

alexgallotta
Copy link
Contributor

@alexgallotta alexgallotta commented Nov 25, 2024

Current logic was ignoring kms/secret arn when dd_api was set, but from the docs and goagent behavior it should be the other way around
https://docs.datadoghq.com/serverless/libraries_integrations/cli/

Datadog API Key encrypted using KMS. Sets the DD_KMS_API_KEY environment variable on your Lambda function configuration. Note: DD_API_KEY is ignored when DD_KMS_API_KEY is set.

The ARN of the secret storing the Datadog API key in AWS Secrets Manager. Sets the DD_API_KEY_SECRET_ARN on your Lambda function configuration. Notes: DD_API_KEY_SECRET_ARN is ignored when DD_KMS_API_KEY is set. Add the secretsmanager:GetSecretValue permission to the Lambda execution role.

Also remove the 32 char hex validation

@alexgallotta alexgallotta requested a review from a team as a code owner November 25, 2024 18:46
@duncanista
Copy link
Contributor

Great catch

@@ -43,7 +40,7 @@ pub async fn resolve_secrets(config: Arc<Config>, aws_config: &AwsConfig) -> Opt
}
}
} else {
return None;
Some(config.api_key.clone())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this resolve to None since the API key wouldn't be set either?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean.
Why shouldn't it be set? And how would it resolve to None?
I moved the cleanup code inside, so maybe it's less confusing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's empty, we should send None

Copy link
Contributor

@duncanista duncanista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thing 🍎

@alexgallotta alexgallotta merged commit 859e535 into main Nov 25, 2024
24 checks passed
@alexgallotta alexgallotta deleted the kms-priority branch November 25, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants