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

fix: export creds for aws and azure direct check #167

Merged
merged 4 commits into from
Aug 15, 2024

Conversation

arturshadnik
Copy link
Member

Issue

Resolves #164

Description

  • In direct mode, AWS and Azure creds will now be exported as env variables before validator is invoked
  • In direct mode, user will no longer be prompted for Implicit Auth

feat: remove "implicit" prompt for direct checks
@arturshadnik arturshadnik requested a review from a team as a code owner August 14, 2024 15:40
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Aug 14, 2024
Copy link

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 26.01626% with 91 lines in your changes missing coverage. Please review.

Files Patch % Lines
pkg/services/validator/azure.go 19.35% 41 Missing and 9 partials ⚠️
pkg/services/validator/aws.go 32.78% 30 Missing and 11 partials ⚠️
@@            Coverage Diff             @@
##             main     #167      +/-   ##
==========================================
- Coverage   37.40%   37.19%   -0.21%     
==========================================
  Files          43       43              
  Lines        6012     6078      +66     
==========================================
+ Hits         2249     2261      +12     
- Misses       3350     3399      +49     
- Partials      413      418       +5     
Files Coverage Δ
pkg/services/validator/aws.go 14.78% <32.78%> (+0.38%) ⬆️
pkg/services/validator/azure.go 10.30% <19.35%> (+0.61%) ⬆️

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 acf4a25...258b5b1. Read the comment docs.

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.

Thanks Artur. This looks good, but it would be even better if we skip the prompts altogether if we’re able to instantiate an AWS / Azure SDK client successfully.

We don’t want to just check environment variables, since the auth keychains for those clouds check various things, including credential files on the file system.

The AWS and Azure plugins already have public packages for initializing clients:

So let’s use those from validatorctl.

pkg/services/validator/aws.go Outdated Show resolved Hide resolved
@arturshadnik
Copy link
Member Author

Thanks, i'll make these changes. While im at it im also gonna factor out the read*Credentials into a few smaller functions if you dont mind. We're starting to have too many ifs in one place

pkg/services/validator/aws.go Outdated Show resolved Hide resolved
pkg/services/validator/aws.go Outdated Show resolved Hide resolved
pkg/services/validator/aws.go Show resolved Hide resolved
pkg/services/validator/azure.go Show resolved Hide resolved
pkg/services/validator/azure.go Outdated Show resolved Hide resolved
pkg/services/validator/azure.go Outdated Show resolved Hide resolved
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 15, 2024
@TylerGillson TylerGillson merged commit 5d569de into main Aug 15, 2024
7 of 8 checks passed
@TylerGillson TylerGillson deleted the fix/aws-azure-auth branch August 15, 2024 19:07
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
bug Something isn't working lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
2 participants