-
Notifications
You must be signed in to change notification settings - Fork 1.1k
image pull: enforce shortnames #9401
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
image pull: enforce shortnames #9401
Conversation
/retest |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #9401 +/- ##
==========================================
- Coverage 67.07% 67.06% -0.01%
==========================================
Files 202 202
Lines 27997 28025 +28
==========================================
+ Hits 18779 18796 +17
- Misses 7644 7654 +10
- Partials 1574 1575 +1 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be a follow up, but we can change the name CandidatesForPotentiallyShortImageName
and return value type because it will always return a single image.
internal/storage/image.go
Outdated
enforcing := types.ShortNameModeEnforcing | ||
sc.ShortNameMode = &enforcing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
I'd suggest ensuring the length == 1 instead of using types.ShortNameModeEnforcing
because the error message is not user-friendly.
cri-o/vendor/github.com/containers/image/v5/pkg/shortnames/shortnames.go
Lines 351 to 353 in c36f2b5
case types.ShortNameModeEnforcing: | |
// Enforcing errors out without a prompt. | |
return nil, errors.New("short-name resolution enforced but cannot prompt without a TTY") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
/retest |
eac5417
to
cd8d336
Compare
okay I think this is good now (unless unit tests fail, I'm letting CI test that) @cri-o/cri-o-maintainers PTAL |
cd8d336
to
a026f5d
Compare
I personally thought "disable" here meant "don't allow shortnames to be resolved" actually, it means "allow any shortname to be resolved if one is found in the unqualified search registry" I think CRI-O's official position should be to discourage the use of 'unqualified-search-registries', but if there are some present, we should block if there's ambiguity in which image to pull from which, so we can prevent squatting issues Signed-off-by: Peter Hunt <pehunt@redhat.com>
a026f5d
to
a8b550a
Compare
@cri-o/cri-o-maintainers PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: haircommander, saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Is there a mechanism to override this? It's causing image pull failures when I upgrade to |
yup! a drop-in cri-o configuration would do it
anywhere in |
I personally thought "disable" here meant "don't allow shortnames to be resolved" actually, it means "allow any shortname to be resolved if one is found in the unqualified search registry"
I think CRI-O's official position should be to discourage the use of 'unqualified-search-registries', but if there are some present, we should block if there's ambiguity in which image to pull from which, so we can prevent squatting issues
What type of PR is this?
What this PR does / why we need it:
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?