You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently due to the limitations of oras-go the easiest (and basically the only possible, sensible way) is to deal with Dockder credentials when they are stored as a file. It doesn't provide API for supplying them in this format as a string, []byte or io.Reader, etc. Hence a temporary file is created to supply those credentials, see
// TODO: Now we create temporary file, which is not great and should be changed,
// but it's the only way to use credentials.NewFileStore(...) which robustly
// parses config.json (format used by Docker and Kubernetes).
tmpFile, err:=os.CreateTemp("", "credentials")
iferr!=nil {
returnnil, fmt.Errorf("failed to create temporary file: %w", err)
}
deferos.Remove(tmpFile.Name())
defertmpFile.Close()
if_, err=tmpFile.WriteString(s); err!=nil {
returnnil, fmt.Errorf("failed to write credentials to file: %w", err)
}
returncredentials.NewFileStore(tmpFile.Name())
}
It's not the best approach from a security, maintainability, and extensibility point of view.
Proposed Solution
Submit PR to oras-go that will extend the API of this library to be able to consume credentials in Docker's config.json format not only from a file directly but from one of string, []byte or io.Reader.
In case something like that is not an option provide an implementation in KGO codebase.
Acceptance Criteria
Temporary file is not created as a workaround for dealing with credentials in Docker's config.json format
The text was updated successfully, but these errors were encountered:
Problem Statement
Currently due to the limitations of oras-go the easiest (and basically the only possible, sensible way) is to deal with Dockder credentials when they are stored as a file. It doesn't provide API for supplying them in this format as a
string
,[]byte
orio.Reader
, etc. Hence a temporary file is created to supply those credentials, seegateway-operator/controller/kongplugininstallation/image/image.go
Lines 121 to 139 in c87be57
It's not the best approach from a security, maintainability, and extensibility point of view.
Proposed Solution
Submit PR to oras-go that will extend the API of this library to be able to consume credentials in Docker's
config.json
format not only from a file directly but from one ofstring
,[]byte
orio.Reader
.In case something like that is not an option provide an implementation in KGO codebase.
Acceptance Criteria
config.json
formatThe text was updated successfully, but these errors were encountered: