aws / aws-secretsmanager-caching-net

The AWS Secrets Manager .NET caching client enables in-process caching of secrets for .NET applications.
https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieving-secrets_cache-net.html
Apache License 2.0
55 stars 23 forks source link

Do not append user agent string if it is already present in the user agent header #97

Closed simonmarty closed 1 year ago

simonmarty commented 1 year ago

Describe the bug

We've seen instances of the user agent string being repeatedly appended to the user agent header which has yielded things like

AwsSecretCache/1.1.0.0/AwsSecretCache/1.1.0.0/AwsSecretCache/1.1.0.0/AwsSecretCache/1.1.0.0/AwsSecretCache/1.1.0.0/AwsSecretCache/1.1.0.0/AwsSecretCache/1.1.0.0/AwsSecretCache/1.1.0.0/AwsSecretCache/1.1.0.0/AwsSecretCache/1.1.0.0

etc.

problem code is here

Expected behavior

AwsSecretCache/VERSION only gets appended once. Either define the user agent string at cache creation or check that the user agent string is not present in the header before appending.

Environment

.NET version, OS, etc.

Observed on .NET 6 but likely happens on other versions too.

Additional context