google / google/go-containerregistry

crane: Support configuring unqualified search registries instead of only docker.io

Open
#1,364 8 comments 1 reaction 0 assignees View on GitHub
bug lifecycle/frozen
Dominant language
Go
Stars
4k
Forks
686
Avg merge
2d 12h
Merged PRs (30d)
26

Description

### Describe the bug

Running `crane` commands with typos leaks data to `docker.io`

### To Reproduce

Run `crane ls secretprojectname`

### Expected behavior

`crane` does not submit `secretprojectname` to `docker.io`

### Actual behavior

```
Error: reading tags for secretprojectname: GET [https://index.docker.io/v2/library/secretprojectname/tags/list?n=1000](https://www.google.com/url?q=https://index.docker.io/v2/library/secretprojectname/tags/list?n%3D1000&sa=D&source=buganizer&usg=AOvVaw3EOpvge9bXCmcd-c9Kw34y): UNAUTHORIZED: authentication required; [map[Action:pull Class: Name:library/secretprojectname Type:repository]]
```

### Additional context

It is common for CI/CD systems to use variables in place of hostnames. Should one of these variables be misconfigured, then sensitive internal project names may be sent to `docker.io` without the users knowledge. Additionally, the hostnames themselves could be sensitive and a misconfiguration on the part of the project name could lead to the hostname leaking to `docker.io`.

This maps directly to [OWASP M4: Unintended Data Leakage](https://owasp.org/www-project-mobile-top-10/2014-risks/m4-unintended-data-leakage)

Proposed Solution:

Ensure that the user must specify a default repository on all operations. Supporting a configuration file would be ideal.

- Output of `crane version`: `v0.8.0`
- Registry used: Internal

Contributor guide

Open the contributing guide

Research direction

Start by tracing the `crane ls secretprojectname` command and how an unqualified repository name is resolved. Review where a default registry or registry configuration could be accepted. Done means unqualified names no longer fall back to docker.io without explicit configuration, with the behavior covered by relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.