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

URL schema when written in wrong case fails (not gracefully) #1047

Closed
silverhook opened this issue Jan 11, 2024 · 5 comments
Closed

URL schema when written in wrong case fails (not gracefully) #1047

silverhook opened this issue Jan 11, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@silverhook
Copy link

Describe the bug
When adding a Docker source, the URL schema seems to be case sensitive, and if it is not exactly as docker://, it fails, but does not explain why.

System configuration

  • Which version of ScanCode.io are you running? v32.7.0
  • Are you running the app using Docker? yes
  • On which OS? Linux
  • What inputs are you using? docker
  • Which pipeline are you running? docker

To Reproduce
Steps to reproduce the behavior:

  1. start a new scan
  2. add a Docker resource and do a case typo by writing e.g. Docker://postgres:12.17-alpine3.19
  3. fill in everything else correctly and set the pipeline to docker
  4. start the scan
  5. see error

Expected behavior
Either:
a) not have the schema part of the URL case sensitive, and just finish the scan; or
b) return an error, where it explains the issue was the case

@silverhook silverhook added the bug Something isn't working label Jan 11, 2024
@jayanthmahadesh
Copy link

when URL is Docker:// instead of docker it raises value error

whitelist = r"^docker://[a-zA-Z0-9_.:/@-]+$"
if not re.match(whitelist, docker_reference):
raise ValueError("Invalid Docker reference.")

should i try
whenever there is case mistake in docker:// - like Docker://
change it to docker:// automatically

@jayanthmahadesh
Copy link

@silverhook

@silverhook
Copy link
Author

whenever there is case mistake in docker:// - like Docker://
change it to docker:// automatically

That sounds like a great solution, yes. 👍

@jayanth-kumar-morem
Copy link
Contributor

Docker image names, including the part specifying the repository, image name, and tag, are case-insensitive. Therefore, whether you use uppercase or lowercase letters in the image name, repository, or tag, Docker treats them as the same.

For example, both docker://postgres:12.17-alpine3.19 and docker://Postgres:12.17-alpine3.19 refer to the same Docker image.

jayanth-kumar-morem added a commit to jayanth-kumar-morem/scancode.io that referenced this issue Jan 26, 2024
Fixes: nexB#1047
Signed-off-by: Jayanth Kumar <jknani111@gmail.com>
tdruez added a commit that referenced this issue Feb 21, 2024
Signed-off-by: tdruez <tdruez@nexb.com>
tdruez added a commit that referenced this issue Feb 22, 2024
Signed-off-by: tdruez <tdruez@nexb.com>
@tdruez
Copy link
Member

tdruez commented Feb 22, 2024

Schema validation implemented in #1085

An explicit form error is now displayed for in cases of unsupported scheme:

Screenshot 2024-02-22 at 13 54 51

@tdruez tdruez closed this as completed Feb 22, 2024
tdruez added a commit that referenced this issue Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants