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

Create Docker registry auth detector #2677

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

Conversation

rgmz
Copy link
Contributor

@rgmz rgmz commented Apr 5, 2024

Description:

This implements a detector to find Docker registry credentials, inspired by this suggestion from @bgoareguer.

The current code works, but is a bit messy and requires more feedback + testing.

Questions/TODO

  • Should this also match and decode Kubernetes .dockerconfigjson results, or rely on the base64 decoder?
  • Add or remove logging? IMO, there are a few potential failures (e.g., json.Unmarshal) that are worth noting, as it could be indicative of a bug.
  • Test against a live gcr.io credential, as that registry uses base64-encoded GCP service principals as the password. It's possible that this doesn't work with the current logic (e.g., encoded newlines.)
  • Add username to extradata
  • Handle username for GCR credentials? (It's a static _json_key, the real username is in the auth)
  • Are there any other potential formats this data gets stored in? (e.g., YAML)
  • Should this handle encoded \n as well as literal?
  • Update comments to add relevant pointers to the spec https://distribution.github.io/distribution/spec/auth/token/
  • Handle docker.io which is a special case (https://stackoverflow.com/a/68654659)

Future work?

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

@rgmz rgmz requested a review from a team as a code owner April 5, 2024 17:39
@rgmz rgmz force-pushed the feat/docker-detector branch 7 times, most recently from 2d4d336 to 3d0aa96 Compare April 8, 2024 18:09
@rgmz rgmz force-pushed the feat/docker-detector branch 2 times, most recently from 2cb905e to 87c6a62 Compare May 21, 2024 12:06
@rgmz rgmz changed the title Create Docker auth credentials detector Create Docker registry auth detector May 21, 2024
@rgmz rgmz marked this pull request as draft May 21, 2024 12:12
@rgmz rgmz force-pushed the feat/docker-detector branch 10 times, most recently from 1633ac6 to a8c6c9f Compare May 22, 2024 02:37
@rgmz rgmz marked this pull request as ready for review June 5, 2024 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant