Skip to content

Conversation

@cat5inthecradle
Copy link
Contributor

@cat5inthecradle cat5inthecradle commented Sep 30, 2024

This PR does a bit too much, happy to break up if preferred.

Update aws-sdk-core

This is why I started this work. We want to update aws-sdk-autoscaling in the code-dot-org repository, and this was blocking that.

Updates other gems to their latest versions compatible with Ruby 3.0.5

Because why not?

A bunch of automatic linting

Prettier was not happy about 6 year old code.

Adds some Docker tooling for developer experience

Added this after struggling with ruby versions and other installed gems on my local workstation. Isolating the development environment while working on the gem was handy

Add a GitHub action to run tests on PR's

My decaf mocha may or may not have been decaf, clearly overreaching here. This runs tests against both the latest Ruby (3.3.x) and the version pinned in code-dot-org (3.0.5)

@cat5inthecradle cat5inthecradle changed the title WIP update aws sdk Update gem depenencies Oct 3, 2024
@cat5inthecradle cat5inthecradle changed the title Update gem depenencies Update gem dependencies Oct 3, 2024
@cat5inthecradle cat5inthecradle requested a review from a team October 3, 2024 04:06
@cat5inthecradle cat5inthecradle marked this pull request as ready for review October 3, 2024 04:06
revert rakefile changes
add final newline
Copy link

@snickell snickell left a comment

Choose a reason for hiding this comment

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

Looks good, my main ask is, if timing at all allows, to get the 3.3 pre-upgrade PR merged before this. They both change the aws-sdk-core version, and Elijah and I saw very complicated poste bugs slightly adjacent to that. The merge conflicts have been 😩

expiration = provider.expiration
_(expiration).must_equal(provider.expiration)
Timecop.travel(1.5.hours.from_now) do
provider.refresh!
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Hamms The newer versions of aws-sdk-core do not automatically refresh when you check the expiration property, so this test no longer triggers a refresh. I've added an explicit call to refresh on our provider, so what we're testing here is the handling of expired tokens in our google.rb refresh method.


# Use the AWS CLI to set the credentials in the session profile
credentials_map.each do |key, value|
system("aws configure set #{key} #{value} --profile #{@session_profile}")

Choose a reason for hiding this comment

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

Not an issue with your current code changes, just a vulnerability in general. This putting secrets on CLI arguments allows other people to sniff the creds with a simple ps auxw. This is a recommendation by ChatGPT for an alternate (untested). Should I add this as a separate PR?

require 'aws-sdk-core'

def write_credentials
  shared_credentials = Aws::SharedCredentials.new(profile_name: @session_profile)
  shared_credentials.load
  shared_credentials.update(
    access_key_id: @credentials.access_key_id,
    secret_access_key: @credentials.secret_access_key,
    session_token: @credentials.session_token,
    expiration: @expiration
  )
end

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, sounds like a good idea

@cat5inthecradle
Copy link
Contributor Author

❯ AWS_REGION=us-east-1 bundle exec rake release
aws-google 0.2.1 built to pkg/aws-google-0.2.1.gem.
Tagged v0.2.1.
Pushed git commits and release tag.
Enter your RubyGems.org credentials.
Don't have an account yet? Create one at https://rubygems.org/sign_up
   Email:   REDACTED
Password:   

You have enabled multi-factor authentication. Please enter OTP code.
Code: 
Signed in with API key: REDACTED
Pushing gem to https://rubygems.org...
Successfully registered gem: aws-google (0.2.1)
Pushed aws-google 0.2.1 to https://rubygems.org

@cat5inthecradle cat5inthecradle merged commit 090df4e into main Nov 18, 2024
2 checks passed
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.

4 participants