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

feat: allow selecting aws creds from filesystem #171

Merged
merged 8 commits into from
Aug 19, 2024
Merged

Conversation

arturshadnik
Copy link
Member

Issue

Resolves #123

Description

In both direct and install mode (if not using implicit auth), the user can now select credentials stored on their filesystem in ~/.aws/credentials. They can also choose to manually input credentials. If no credentials file is found, the flow remains the same as before.

image

Credential validation is only performed in the case that no profiles are found. This ensures that if the user is authenticated in a different way (env vars, sso, etc.) it does not re-prompt them for their credentials. In all other cases (profile selected or user chooses to manually enter creds) we assume the credentials are valid.

pkg/services/clouds/aws_service.go Show resolved Hide resolved
pkg/services/validator/aws.go Outdated Show resolved Hide resolved
pkg/services/clouds/aws_service.go Outdated Show resolved Hide resolved
pkg/services/clouds/aws_service.go Show resolved Hide resolved
pkg/services/clouds/aws_service.go Outdated Show resolved Hide resolved
@arturshadnik arturshadnik marked this pull request as ready for review August 16, 2024 20:42
@arturshadnik arturshadnik requested a review from a team as a code owner August 16, 2024 20:42
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. new-feature Net-new feature labels Aug 16, 2024
Copy link
Member

@TylerGillson TylerGillson left a comment

Choose a reason for hiding this comment

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

Changes look good. Can you please add unit tests for the ini file parsing though?

Copy link

codecov bot commented Aug 17, 2024

Codecov Report

Attention: Patch coverage is 58.06452% with 39 lines in your changes missing coverage. Please review.

Files Patch % Lines
pkg/services/clouds/aws_service.go 61.64% 26 Missing and 2 partials ⚠️
pkg/services/validator/aws.go 45.00% 6 Missing and 5 partials ⚠️
@@            Coverage Diff             @@
##             main     #171      +/-   ##
==========================================
+ Coverage   53.77%   53.88%   +0.10%     
==========================================
  Files          43       44       +1     
  Lines        6086     6180      +94     
==========================================
+ Hits         3273     3330      +57     
- Misses       1994     2023      +29     
- Partials      819      827       +8     
Files Coverage Δ
pkg/services/validator/aws.go 50.71% <45.00%> (+0.27%) ⬆️
pkg/services/clouds/aws_service.go 61.64% <61.64%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6a4a704...131d88a. Read the comment docs.

@TylerGillson
Copy link
Member

Ok, last nit. Please use a PR title that conforms to the conventional commits syntax. enh: does not.

@arturshadnik arturshadnik changed the title enh: allow selecting aws creds from filesystem feat: allow selecting aws creds from filesystem Aug 19, 2024
@arturshadnik
Copy link
Member Author

Ok, last nit. Please use a PR title that conforms to the conventional commits syntax. enh: does not.

Updated @TylerGillson

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 19, 2024
@arturshadnik arturshadnik merged commit c3a714c into main Aug 19, 2024
8 checks passed
@arturshadnik arturshadnik deleted the feat/aws-profile branch August 19, 2024 17:16
ahmad-ibra pushed a commit that referenced this pull request Aug 19, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.1.2](v0.1.1...v0.1.2)
(2024-08-19)


### Features

* add maas plugin
([#160](#160))
([ab9f21a](ab9f21a))
* allow selecting aws creds from filesystem
([#171](#171))
([c3a714c](c3a714c))
* allow specifying Azure cloud to connect to
([#170](#170))
([6a4a704](6a4a704))
* read vCenter privileges from local file or editor
([#152](#152))
([94ddd90](94ddd90))
* set exit code 2 on validation failure; restore debug log file
([#150](#150))
([2a3fe4d](2a3fe4d))
* support configuring oci validationType on a rule
([#161](#161))
([8dfc501](8dfc501))
* support direct oci validation of private registries
([#173](#173))
([9cfeab9](9cfeab9))


### Bug Fixes

* correct TUI flow for `validator install -o --apply`
([#169](#169))
([0912f6e](0912f6e))
* export creds for aws and azure direct check
([#167](#167))
([5d569de](5d569de))


### Dependency Updates

* **deps:** update anchore/sbom-action action to v0.17.1
([#163](#163))
([416d23c](416d23c))
* **deps:** update github.com/validator-labs/validator-plugin-azure
digest to b4687e5
([#149](#149))
([e7ab9a6](e7ab9a6))
* **deps:** update github.com/validator-labs/validator-plugin-vsphere
digest to a93cb70
([#147](#147))
([79304b9](79304b9))
* **deps:** update module github.com/vmware/govmomi to v0.40.0
([#162](#162))
([acf4a25](acf4a25))


### Refactoring

* lazy configuration of oci auth and signature verification secrets
([#168](#168))
([cc2c056](cc2c056))
* remove explicit TypeMetas; use vapi constants
([#154](#154))
([28b321c](28b321c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer new-feature Net-new feature size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🌱 Check for ~/.aws/credentials and if found, offer profile selection
2 participants