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

Image references passed to a CNB builder are not validated #21495

Closed
scottfrederick opened this issue May 18, 2020 · 1 comment
Closed

Image references passed to a CNB builder are not validated #21495

scottfrederick opened this issue May 18, 2020 · 1 comment
Assignees
Labels
Milestone

Comments

@scottfrederick
Copy link
Contributor

See #21483 for an example of a user providing an image name that causes a failure in the CNB builder that is difficult to diagnose (upper-case characters in the image name):

[INFO]  > Running creator
[INFO]     [creator]     ERROR: failed to all tags must have the same registry as the exported image: could not parse reference: docker.io/library/SchedulePolling:1.2

If we better understood the rules for an image reference, Boot could do some validation of the image name before invoking the builder to give a better user experience. For comparison, the pack CLI gives a more concise error message, although still missing the details of what isn't acceptable about the image name:

$ pack build docker.io/library/DemoProject:1.0 --builder gcr.io/paketo-buildpacks/builder:base-platform-api-0.3 --path build/libs/demo-0.0.1-SNAPSHOT.jar
ERROR: invalid image name 'docker.io/library/DemoProject:1.0': could not parse reference: docker.io/library/DemoProject:1.0
@scottfrederick scottfrederick added the for: team-attention An issue we'd like other members of the team to review label May 18, 2020
@scottfrederick scottfrederick added the type: enhancement A general enhancement label May 20, 2020
@scottfrederick
Copy link
Contributor Author

For reference, the Google go-containerregistry library contains some rules for elements of the image name:

@philwebb philwebb removed the for: team-attention An issue we'd like other members of the team to review label May 29, 2020
@philwebb philwebb added this to the 2.3.x milestone May 29, 2020
@philwebb philwebb added type: bug A general bug and removed type: enhancement A general enhancement labels Jun 11, 2020
@philwebb philwebb changed the title Consider validating an image reference before passing it to a CNB builder Validate the image reference before passing it to a CNB builder Jun 11, 2020
@philwebb philwebb changed the title Validate the image reference before passing it to a CNB builder Image references passed to a CNB builder are not validated Jun 11, 2020
@scottfrederick scottfrederick self-assigned this Jun 15, 2020
@scottfrederick scottfrederick modified the milestones: 2.3.x, 2.3.2 Jun 18, 2020
philwebb added a commit that referenced this issue Jun 23, 2020
Rename `ImageReferenceParser` to `Regex` and remove state. The regular
expressions are now used directly by the `ImageName` and
`ImageReference` classes with the values accessed directly from the
`Matcher`.

See gh-21495
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants