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

refactor(deps): upgrade to aws-sdk-go-v2 #529

Merged
merged 6 commits into from
Nov 2, 2023

Commits on Oct 20, 2023

  1. refactor(deps): upgrade to aws-sdk-go-v2

    - `aws-sdk-go` has [a vuln](https://osv.dev/vulnerability/GO-2022-0646) in the v1 EncryptionClient
      - it's fixed in the v2 client
      - we don't use this functionality, but still get reported this vuln
        - instead add an ignore for the vuln, figured I might as well make the upgrade to v2
    - confirmed that `go.mod` has latest versions (e.g. `config` [released v1.19.0](https://github.com/aws/aws-sdk-go-v2/releases/tag/release-2023-10-16) this week)
    
    - follow the [migration instructions](https://aws.github.io/aws-sdk-go-v2/docs/migrating/)
      - migrate all `session` usage to `config.LoadDefaultConfig` per [instructions](https://aws.github.io/aws-sdk-go-v2/docs/migrating/#configuration-loading)
        - this includes shared config handling, so I believe `session.SharedConfigEnable` is no longer necessary per [instructions](https://aws.github.io/aws-sdk-go-v2/docs/migrating/#migrating-from-newsessionwithoptions)
          - the docs on ["Speciyfing Credentials"](https://aws.github.io/aws-sdk-go-v2/docs/configuring-sdk/#specifying-credentials) seem to state this as well, if I'm understanding correctly
        - see also `config.WithRegion` mention in the [instructions](https://aws.github.io/aws-sdk-go-v2/docs/migrating/#migrating-from-newsession-with-awsconfig-options)
      - migrate credential usage
        - [`Config.Credentials`](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/aws#Config) still exists, but the function is now [`Retrieve(context)`](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/aws#CredentialsProvider) instead of `Get`
          - the [`Credentials` struct](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/aws#Credentials) otherwise looks the same, has the `AccessKeyId`, `SecretAccessKey`, and `SessionToken` that were used in v1
        - STS credentials are retrieved a bit differently now [per instructions](https://aws.github.io/aws-sdk-go-v2/docs/migrating/#aws-security-token-service-credentials)
          - use a `config` instead of a `session` to create a client, then use `NewAssumeRoleProvider` instead of `NewCredentials
    
    - NOTE: I used `context.Background()` for all of the contexts that are now required
      - it may make more sense for context to be passed into these functions, but that would be a breaking change and require downstream changes in Argo projects, so I left that out for now and just went with `Background` as a default
    
    Signed-off-by: Anton Gilgur <[email protected]>
    agilgur5 committed Oct 20, 2023
    Configuration menu
    Copy the full SHA
    ff0e768 View commit details
    Browse the repository at this point in the history
  2. add sts service import

    - this was just straight up missing from the migration guide's imports
      - found it myself: https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/sts
    
    Signed-off-by: Anton Gilgur <[email protected]>
    agilgur5 committed Oct 20, 2023
    Configuration menu
    Copy the full SHA
    af8205e View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2023

  1. move context into a variable

    - more idiomatic Go, less memory use, and makes it easier to replace with an argument later
    
    Signed-off-by: Anton Gilgur <[email protected]>
    agilgur5 committed Oct 30, 2023
    Configuration menu
    Copy the full SHA
    de319d1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6395467 View commit details
    Browse the repository at this point in the history

Commits on Oct 31, 2023

  1. Configuration menu
    Copy the full SHA
    9c6a1a7 View commit details
    Browse the repository at this point in the history

Commits on Nov 2, 2023

  1. Configuration menu
    Copy the full SHA
    01d5602 View commit details
    Browse the repository at this point in the history