Skip to content

Handle an image ref with scheme#4739

Merged
estesp merged 1 commit intocontainerd:masterfrom
kzys:handle-scheme
Dec 1, 2020
Merged

Handle an image ref with scheme#4739
estesp merged 1 commit intocontainerd:masterfrom
kzys:handle-scheme

Conversation

@kzys
Copy link
Copy Markdown
Member

@kzys kzys commented Nov 16, 2020

An image ref must be a scheme-less URI. A reference with scheme (such
as http://) must return ErrInvalid.

Signed-off-by: Kazuyoshi Kato [email protected]

@k8s-ci-robot
Copy link
Copy Markdown

Hi @kzys. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Copy Markdown
Contributor

@Zyqsempai Zyqsempai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Nov 16, 2020

Build succeeded.

Comment thread reference/reference.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering if checking for :// would be sufficient (if strings.Contains(s, "://")), as its only for detection, and we're not really interested if the scheme is "valid"

Copy link
Copy Markdown
Member Author

@kzys kzys Nov 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I was initially trying to cover schemes that don't have // such as mailto: and news: (according to https://tools.ietf.org/html/rfc1738#page-19), but eventually gave up. Let me update the PR to simplify.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think for this case, it's not important to be "fully correct"; we're only interested in "any scheme"; it's an enhancement over the current validation, so it's likely ok if a mailto:, javascript: or news: would accidentally fall through (I expect those to fail further down as well)

An image ref must be a scheme-less URI. A reference with scheme (such
as `http://`) must return ErrInvalid.

Signed-off-by: Kazuyoshi Kato <[email protected]>
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Nov 19, 2020

Build succeeded.

Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Copy link
Copy Markdown
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@estesp estesp merged commit 774cb16 into containerd:master Dec 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants