aws-sdk-kotlin icon indicating copy to clipboard operation
aws-sdk-kotlin copied to clipboard

feat(rt): add ProcessCredentialsProvider

Open lauzadis opened this issue 3 years ago • 8 comments

Adds a ProcessCredentialsProvider which will be used to support process credentials resolution

Issue #

N/A

Description of changes

This change is required to achieve feature parity with existing SDKs. It allows more customization on where the SDK gets users' credentials from.

Process credentials may be returned without an expiration field. In this case, we are expected to treat the credentials as non-expiring, and no credential refreshes should be attempted. To support this behavior, the concept of NonExpiringCredentials was added to the JSON deserializer used for credentials. If we receive non-expiring credentials, we set the expiration to Instant.MAX_VALUE to ensure they "never" expire.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

lauzadis avatar Oct 14 '22 19:10 lauzadis

A new generated diff is ready to view: https://github.com/awslabs/aws-sdk-kotlin/compare/__generated-main...__generated-feat-extensible-credential-providers

github-actions[bot] avatar Oct 14 '22 19:10 github-actions[bot]

Question: should I add @InternalSdkAPI decorators to the new functions such as executeCommand? It's not really intended for SDK users and could be subject to breaking changes in the future (i.e if we want to return stdout and stderr instead of just one of them, or generalize it even more with a larger refactor)

lauzadis avatar Oct 17 '22 16:10 lauzadis

Question: should I add @InternalSdkAPI decorators to the new functions such as executeCommand? It's not really intended for SDK users and could be subject to breaking changes in the future (i.e if we want to return stdout and stderr instead of just one of them, or generalize it even more with a larger refactor)

It's marked internal already so it isn't consumable by anything other than from this project/compilation unit.

InternalApi/InternalSdkApi are for functions that have to be public to be consumable from generated code but aren't meant for general consumption (i.e. it's an internal detail of generated code)

aajtodd avatar Oct 17 '22 17:10 aajtodd

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

github-actions[bot] avatar Oct 17 '22 18:10 github-actions[bot]

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

github-actions[bot] avatar Oct 17 '22 19:10 github-actions[bot]

Looks great. Nice work. Have you tested this out with real CLI process on different OS (e.g. linux + windows)?

Yeah, I just finished manual testing on all platforms (mac, linux, windows) and it works everywhere. I tested for command successes and failures (where stderr message is expected) for both absolute command paths and resolving the command from the system's PATH.

lauzadis avatar Oct 20 '22 15:10 lauzadis

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 9 Code Smells

No Coverage information No Coverage information
12.9% 12.9% Duplication

sonarqubecloud[bot] avatar Oct 20 '22 15:10 sonarqubecloud[bot]

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

github-actions[bot] avatar Oct 20 '22 15:10 github-actions[bot]

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

github-actions[bot] avatar Jan 11 '23 23:01 github-actions[bot]

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

github-actions[bot] avatar Jan 17 '23 15:01 github-actions[bot]

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

github-actions[bot] avatar Jan 17 '23 16:01 github-actions[bot]

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

github-actions[bot] avatar Jan 17 '23 20:01 github-actions[bot]

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

github-actions[bot] avatar Jan 17 '23 20:01 github-actions[bot]

Changes since last review:

  • Add a configurable max bytes read from stdout
  • Add a configurable command timeout
  • Handle spaces in command by wrapping the entire string in quotes
  • Add security warning to the KDocs
  • Prevent calling getCredentials() after close() in CachedCredentialsProvider

lauzadis avatar Jan 17 '23 22:01 lauzadis

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 11 Code Smells

No Coverage information No Coverage information
9.1% 9.1% Duplication

sonarqubecloud[bot] avatar Jan 19 '23 19:01 sonarqubecloud[bot]

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

github-actions[bot] avatar Jan 19 '23 19:01 github-actions[bot]

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

github-actions[bot] avatar Jan 19 '23 21:01 github-actions[bot]

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK

github-actions[bot] avatar Jan 20 '23 16:01 github-actions[bot]

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 11 Code Smells

No Coverage information No Coverage information
9.0% 9.0% Duplication

sonarqubecloud[bot] avatar Jan 20 '23 16:01 sonarqubecloud[bot]