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

Allow env vars to skip vendor specific keychain #1315

Merged
merged 2 commits into from
Apr 1, 2024

Conversation

jabrown85
Copy link
Contributor

Summary

Vendor keychains can be slow or fail. This allows platform operators to skip them entirely.

Release notes

Allow platform operators the ability to skip vendor specific keychain implementations by setting CNB_REGISTRY_AUTH_KEYCHAIN_SKIP_AMAZON or CNB_REGISTRY_AUTH_KEYCHAIN_SKIP_AZURE.


Related

Resolves #1007 (comment)


Context

The Amazon/ECR one is terribly inefficient. It tries to query the metadata service and eventually fails after a few tries. This is not needed if the platform is providing the credentials via Default/Env. Selectively disabling seemed liked a decent enough idea.

@jabrown85 jabrown85 self-assigned this Mar 8, 2024
@jabrown85 jabrown85 requested a review from a team as a code owner March 8, 2024 18:05
@jabrown85 jabrown85 force-pushed the jab/keychain-allow-vendor-skip branch from 1c42b78 to 945fa8e Compare March 8, 2024 18:09
Vendor keychains can be slow or fail. This allows platform operators to skip them entirely.

Signed-off-by: Jesse Brown <[email protected]>
@jabrown85 jabrown85 force-pushed the jab/keychain-allow-vendor-skip branch from 945fa8e to 5128c13 Compare March 8, 2024 18:11
Copy link

codecov bot commented Mar 8, 2024

Codecov Report

Attention: Patch coverage is 0% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 64.53%. Comparing base (3a05fde) to head (dff6494).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1315      +/-   ##
==========================================
- Coverage   64.60%   64.53%   -0.06%     
==========================================
  Files         101      101              
  Lines        7007     7016       +9     
==========================================
+ Hits         4526     4527       +1     
- Misses       2069     2077       +8     
  Partials      412      412              
Flag Coverage Δ
os_linux 64.01% <0.00%> (-0.06%) ⬇️
os_windows 56.61% <0.00%> (-0.06%) ⬇️
unit 64.01% <0.00%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@natalieparellano
Copy link
Member

@jabrown85 I think this makes a lot of sense - and, this would allow us to merge #887 with less trepidation that it could break certain environments (I think the original underlying issue there was fixed, and we just forgot about the PR, but still...).

Signed-off-by: Jesse Brown <[email protected]>

Signed-off-by: Jesse Brown <[email protected]>
@jabrown85 jabrown85 merged commit 9c83401 into main Apr 1, 2024
9 of 10 checks passed
@jabrown85 jabrown85 deleted the jab/keychain-allow-vendor-skip branch April 1, 2024 13:55
Comment on lines +41 to +48
keychains := []authn.Keychain{envKeychain, authn.DefaultKeychain}

if vendorKeychainEnabled("amazon") {
keychains = append(keychains, amazonKeychain)
}
if vendorKeychainEnabled("azure") {
keychains = append(keychains, azureKeychain)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Were the calls to NewResolvedKeychain() omitted deliberately?

natalieparellano added a commit that referenced this pull request Apr 9, 2024
Prior to #1315, all keychains
passed to NewMultiKeychain were resolved keychains,
which prevented the credentials from becoming inaccessible after the lifecycle dropped privileges.

Signed-off-by: Natalie Arellano <[email protected]>
natalieparellano added a commit that referenced this pull request Apr 10, 2024
Prior to #1315, all keychains
passed to NewMultiKeychain were resolved keychains,
which prevented the credentials from becoming inaccessible after the lifecycle dropped privileges.

Signed-off-by: Natalie Arellano <[email protected]>
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.

build analyze/export phase cost too much time
3 participants