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

No image name validation on the CLI/SDK side #2191

Closed
YevheniiSemendiak opened this issue Jun 30, 2021 · 3 comments · Fixed by #2525
Closed

No image name validation on the CLI/SDK side #2191

YevheniiSemendiak opened this issue Jun 30, 2021 · 3 comments · Fixed by #2525
Assignees
Labels
bug Something isn't working

Comments

@YevheniiSemendiak
Copy link
Contributor

Description:

Registry cannot handle requests if the image name is invalid. However, we do not perform such validation causing erros on the server side.
According to the docker docs:

Name components may contain lowercase letters, digits and separators. A separator is defined as a period, one or two underscores, or one or more dashes. A name component may not start or end with a separator.

A tag name must be valid ASCII and may contain lowercase and uppercase letters, digits, underscores, periods and dashes. A tag name may not start with a period or a dash and may contain a maximum of 128 characters.

Example:

Perform neuro image tags image:Hello and get error responce from CLI:

ERROR: Illegal argument(s) (500 Internal Server Error

Server got itself in trouble)

Meanwhile on the server side:

2021-06-30 09:24:12,826 - platform_registry_api.api - INFO - converted registry repo URL to upstream repo URL: RepoURL(repo='yevheniisemendiak/Hello', url=URL('https://registry.neuro-compute.org.neu.ro/v2/yevheniisemendiak/Hello/tags/list?n=30'), mounted_repo='') -> RepoURL(repo='neuro/yevheniisemendiak/Hello', url=URL('https://cr434a0a52e01411cf3de2558b450e45ca.azurecr.io/v2/neuro/yevheniisemendiak/Hello/tags/list?n=30'), mounted_repo='')
2021-06-30 09:24:12,939 - platform_registry_api.api - DEBUG - upstream response: <ClientResponse(https://cr434a0a52e01411cf3de2558b450e45ca.azurecr.io/v2/neuro/yevheniisemendiak/Hello/tags/list?n=30) [404 Not Found]>
<CIMultiDictProxy('Server': 'openresty', 'Date': 'Wed, 30 Jun 2021 09:24:12 GMT', 'Content-Type': 'text/plain; charset=utf-8', 'Content-Length': '19', 'Connection': 'keep-alive', 'Docker-Distribution-Api-Version': 'registry/2.0', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'X-Content-Type-Options': 'nosniff', 'X-Ms-Correlation-Request-Id': 'f7511228-ca58-41dd-a6a8-e3ce50498299', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains')>

2021-06-30 09:24:12,939 - aiohttp.server - ERROR - Error handling request
Traceback (most recent call last):
  File "/root/.local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/root/.local/lib/python3.7/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/root/.local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/root/.local/lib/python3.7/site-packages/aiohttp_remotes/x_forwarded.py", line 94, in middleware
    return await handler(request)
  File "/root/.local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/root/.local/lib/python3.7/site-packages/platform_registry_api/api.py", line 441, in handle_repo_tags_list
    registry_repo_url, request, url_factory
  File "/root/.local/lib/python3.7/site-packages/platform_registry_api/api.py", line 493, in _handle_generic_tags_list
    data = await client_response.json(content_type=None)
  File "/root/.local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 1113, in json
    return loads(stripped.decode(encoding))
  File "/usr/local/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.7/json/decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 5 (char 4)
2021-06-30 09:24:12,940 - aiohttp.access - INFO - 10.244.1.33 [30/Jun/2021:09:24:12 +0000] "GET /v2/yevheniisemendiak/Hello/tags/list?n=30 HTTP/1.1" 500 300 "-" "NeuroCLI/21.6.23 (darwin)"

Expected behavior:

CLI/SDK responds with the error without forwarding the request to API.

Additional context:

Neuro Platform Client 21.6.23

@YevheniiSemendiak YevheniiSemendiak added the bug Something isn't working label Jun 30, 2021
@asvetlov
Copy link
Contributor

The request makes sense; we have similar validators for other SDK parts.

@github-actions
Copy link

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 14 days

@github-actions
Copy link

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 14 days

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.

3 participants