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: support placeholders in dockerconfigjson auth field #586

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

teejaded
Copy link
Contributor

@teejaded teejaded commented Dec 1, 2023

Description

Add support for placeholders in dockerconfigjson pull secrets.

Fixes: #152

Checklist

Please make sure that your PR fulfills the following requirements:

  • Reviewed the guidelines for contributing to this repository
  • The commit message follows the Conventional Commits Guidelines.
  • Tests for the changes have been updated
  • Are you adding dependencies? If so, please run go mod tidy -compat=1.21 to ensure only the minimum is pulled in.
  • Docs have been added / updated
  • Optional. My organization is added to USERS.md.

Type of Change

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • New tests
  • Build/CI related changes
  • Documentation content changes
  • Other (please describe)

Other information

Not mentioned in the issue, but this PR also resolves a problem with go marshaled dockerconfigjson. By default golang escapes <>& to mitigate html injection attacks. AVP would typically ignore the placeholders because the characters are replaced with their unicode escape sequence equivalents.

❯ kubectl create secret docker-registry test --docker-server=https://my-server.local --docker-username='<user>' --docker-password='<pass>' -o yaml --dry-run=client | yq '.data.".dockerconfigjson" | @base64d'

{"auths":{"https://my-server.local":{"username":"\u003cuser\u003e","password":"\u003cpass\u003e","auth":"PHVzZXI+OjxwYXNzPg=="}}}

@codecov-commenter
Copy link

codecov-commenter commented Dec 1, 2023

Codecov Report

Attention: 13 lines in your changes are missing coverage. Please review.

Comparison is base (b2d7f10) 71.75% compared to head (b8ea806) 71.80%.

Files Patch % Lines
pkg/kube/util.go 77.27% 6 Missing and 4 partials ⚠️
pkg/kube/template.go 50.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #586      +/-   ##
==========================================
+ Coverage   71.75%   71.80%   +0.04%     
==========================================
  Files          26       26              
  Lines        1983     2032      +49     
==========================================
+ Hits         1423     1459      +36     
- Misses        460      467       +7     
- Partials      100      106       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@miwig
Copy link

miwig commented Apr 25, 2024

I would like this feature also, how can I help get this merged?

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.

3 participants