Bug 1148556 - Pulp allows creation of docker repos that have invalid names
Summary: Pulp allows creation of docker repos that have invalid names
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Pulp
Classification: Retired
Component: docker-support
Version: Master
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 2.6.1
Assignee: amacdona@redhat.com
QA Contact: Irina Gulina
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-01 17:43 UTC by Brad Buckingham
Modified: 2015-02-19 16:44 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-19 16:44:21 UTC
Embargoed:


Attachments (Terms of Use)

Description Brad Buckingham 2014-10-01 17:43:15 UTC
Description of problem:

The docker client that is used to pull docker containers appears to enforce a restriction on the naming of docker repositories; however, pulp does not enforce those restrictions.  As a result, a user can create, sync and publish a repository to later find that they cannot pull the content from it.

Version-Release number of selected component (if applicable):
pulp-docker-plugins-0.2.1-0.1.alpha.el6.noarch

How reproducible:
always

Steps to Reproduce:
1. create a docker repository with a pulp id that contains a capital letter (e.g. Default_Organization-docker-busybox)
2. sync & publish the repo

for example:

Id:                  Default_Organization-docker-busybox
Display Name:        busybox
Description:         None
Content Unit Counts: 
  Docker Image: 10

3. attempt to pull the repo from a client using 'docker pull'

Actual results:

# docker pull fortello-docker.devel:5000/Default_Organization-docker-busybox
2014/10/01 13:33:41 Invalid repository name (Default_Organization-docker-busybox), only [a-z0-9-_.] are allowed


Expected results:

Either the docker pull should successfully pull the repository or pulp should not allow the user to create the invalid repository.

The following is an example of a successful case:

# docker pull fortello-docker.devel:5000/org-docker_product-busybox
Pulling repository fortello-docker.devel:5000/org-docker_product-busybox
9e2c56202029: Download complete 
b1c51f7d9f04: Download complete 
35fcdc96c01b: Download complete 
d473e653126b: Download complete 
511136ea3c5a: Download complete 
388abcde152c: Download complete 
93a914beb87c: Download complete 
c1853e76a63d: Download complete 
e3c64994cc50: Download complete 
7e8bd5521539: Download complete 

Additional info:

Comment 1 Michael Hrivnak 2014-10-08 16:11:22 UTC
we will validate the repo-registry-id during repo create and update, including if the repo-registry-id is not provided and we use a default.

Comment 2 amacdona@redhat.com 2015-01-06 20:27:27 UTC
https://github.com/pulp/pulp_docker/pull/52

Comment 3 Chris Duryee 2015-01-16 23:00:03 UTC
pulp 2.6.0 beta 5

Comment 4 Preethi Thomas 2015-01-20 21:27:16 UTC
Fails-qa
[root@cloud-qe-17 docker]# rpm -qa pulp-server
pulp-server-2.6.0-0.5.beta.el7.noarch
[root@cloud-qe-17 docker]# 

[root@cloud-qe-17 docker]# pulp-admin docker repo update --repo-id=busybox --repo-registry-id=pulpdemo/busybox
This command may be exited via ctrl+c without affecting the request.


[\]
Running...
Updating distributor: docker_web_distributor_name_cli

Task Failed

Pulp exception occurred: PulpDataException

Comment 5 amacdona@redhat.com 2015-01-22 15:49:27 UTC
Updated to allow a single slash to allow the namespace.

https://github.com/pulp/pulp_docker/pull/54/files

Comment 6 Chris Duryee 2015-01-22 21:11:08 UTC
this should be in POST since PR is not merged, not MODIFIED

Comment 7 Michael Hrivnak 2015-02-02 04:25:24 UTC
It appears to have been merged now.

Comment 8 Chris Duryee 2015-02-10 22:33:03 UTC
2.6.0-0.7.beta

Comment 9 Irina Gulina 2015-02-18 11:27:33 UTC
Failed QA 

>> rpm -qa pulp-server
pulp-server-2.6.0-0.7.beta.el7.noarch

>> rpm -qa pulp-docker*
pulp-docker-plugins-0.2.2-1.el7.noarch
pulp-docker-admin-extensions-0.2.2-1.el7.noarch

1) If capitals are not allowed in repo-id there should be an Error message: 

like for 
>> pulp-admin rpm repo create --repo-id R?epo
Validation failed for argument [--repo-id]: value must contain only letters,
numbers, underscores, periods and hyphens

and not a PulpDataException:

>> pulp-admin docker repo create --repo-id "Busybox" --feed=https://index.docker.io 
The server indicated one or more values were incorrect. The server provided the
following error message:

   Pulp exception occurred: PulpDataException

More information can be found in the client log file ~/.pulp/admin.log.


2) Exception here

>> pulp-admin docker repo create --repo-id "busybox" --feed=https://index.docker.io --upstream-name=busybox 
Repository [busybox] successfully created

>>  pulp-admin docker repo update --repo-id=busybox --repo-registry-id=pulpdemo/busybox
This command may be exited via ctrl+c without affecting the request.


[\]
Running...
Updating distributor: docker_web_distributor_name_cli

Task Failed

Pulp exception occurred: PulpDataException

>> less /var/log/messages

Feb 18 06:06:46 localhost pulp: pulp.server.managers.repo.distributor:ERROR: (9960-85248) Exception raised from distributor [docker_distributor_export] while validating config for repo [busybox]
Feb 18 06:06:46 localhost pulp: pulp.server.managers.repo.distributor:ERROR: (9960-85248) Traceback (most recent call last):
Feb 18 06:06:46 localhost pulp: pulp.server.managers.repo.distributor:ERROR: (9960-85248)   File "/usr/lib/python2.7/site-packages/pulp/server/managers/repo/distributor.py", line 317, in update_distributor_config
Feb 18 06:06:46 localhost pulp: pulp.server.managers.repo.distributor:ERROR: (9960-85248)     config_conduit)
Feb 18 06:06:46 localhost pulp: pulp.server.managers.repo.distributor:ERROR: (9960-85248)   File "/usr/lib/python2.7/site-packages/pulp_docker/plugins/distributors/distributor_export.py", line 95, in validate_config
Feb 18 06:06:46 localhost pulp: pulp.server.managers.repo.distributor:ERROR: (9960-85248)     return configuration.validate_config(config, repo)
Feb 18 06:06:46 localhost pulp: pulp.server.managers.repo.distributor:ERROR: (9960-85248)   File "/usr/lib/python2.7/site-packages/pulp_docker/plugins/distributors/configuration.py", line 60, in validate_config
Feb 18 06:06:46 localhost pulp: pulp.server.managers.repo.distributor:ERROR: (9960-85248)     raise PulpCodedValidationException(validation_exceptions=errors)
Feb 18 06:06:46 localhost pulp: pulp.server.managers.repo.distributor:ERROR: (9960-85248) PulpCodedValidationException: A validation error occurred.
Feb 18 06:06:46 localhost pulp: celery.worker.job:ERROR: (9929-85248) Task pulp.server.tasks.repository.distributor_update[84e3a37e-b6a8-487c-846c-f076a19dd9f2] raised unexpected: PulpDataException((),)
Feb 18 06:06:46 localhost pulp: celery.worker.job:ERROR: (9929-85248) Traceback (most recent call last):
Feb 18 06:06:46 localhost pulp: celery.worker.job:ERROR: (9929-85248)   File "/usr/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
Feb 18 06:06:46 localhost pulp: celery.worker.job:ERROR: (9929-85248)     R = retval = fun(*args, **kwargs)
Feb 18 06:06:46 localhost pulp: celery.worker.job:ERROR: (9929-85248)   File "/usr/lib/python2.7/site-packages/pulp/server/async/tasks.py", line 328, in __call__
Feb 18 06:06:46 localhost pulp: celery.worker.job:ERROR: (9929-85248)     return super(Task, self).__call__(*args, **kwargs)
Feb 18 06:06:46 localhost pulp: celery.worker.job:ERROR: (9929-85248)   File "/usr/lib/python2.7/site-packages/celery/app/trace.py", line 437, in __protected_call__
Feb 18 06:06:46 localhost pulp: celery.worker.job:ERROR: (9929-85248)     return self.run(*args, **kwargs)
Feb 18 06:06:46 localhost pulp: celery.worker.job:ERROR: (9929-85248)   File "/usr/lib/python2.7/site-packages/pulp/server/tasks/repository.py", line 141, in distributor_update
Feb 18 06:06:46 localhost pulp: celery.worker.job:ERROR: (9929-85248)     distributor = manager.update_distributor_config(repo_id, distributor_id, config, auto_publish)
Feb 18 06:06:46 localhost pulp: celery.worker.job:ERROR: (9929-85248)   File "/usr/lib/python2.7/site-packages/pulp/server/managers/repo/distributor.py", line 317, in update_distributor_config
Feb 18 06:06:46 localhost pulp: celery.worker.job:ERROR: (9929-85248)     config_conduit)
Feb 18 06:06:46 localhost pulp: celery.worker.job:ERROR: (9929-85248)   File "/usr/lib/python2.7/site-packages/pulp_docker/plugins/distributors/distributor_export.py", line 95, in validate_config
Feb 18 06:06:46 localhost pulp: celery.worker.job:ERROR: (9929-85248)     return configuration.validate_config(config, repo)
Feb 18 06:06:46 localhost pulp: celery.worker.job:ERROR: (9929-85248)   File "/usr/lib/python2.7/site-packages/pulp_docker/plugins/distributors/configuration.py", line 60, in validate_config
Feb 18 06:06:46 localhost pulp: celery.worker.job:ERROR: (9929-85248)     raise PulpCodedValidationException(validation_exceptions=errors)
Feb 18 06:06:46 localhost pulp: celery.worker.job:ERROR: (9929-85248) PulpDataException: Pulp exception occurred: PulpDataException
Feb 18 06:06:46 localhost pulp: celery.worker.job:INFO: Task pulp.server.async.tasks._release_resource[657cea86-3f5c-4272-804b-f39353b9449f] succeeded in 0.068188174002s: None

>> pulp-admin docker repo list --details
+----------------------------------------------------------------------+
                          Docker Repositories
+----------------------------------------------------------------------+

Id:                  busybox
Display Name:        busybox
Description:         None
Content Unit Counts: 
Notes:               
Importers:           
  Config:           
    Feed:          https://index.docker.io
    Upstream Name: busybox
  Id:               docker_importer
  Importer Type Id: docker_importer
  Last Sync:        None
  Repo Id:          busybox
  Scheduled Syncs:  
Distributors:        
  Auto Publish:        True
  Config:              
  Distributor Type Id: docker_distributor_web
  Id:                  docker_web_distributor_name_cli
  Last Publish:        None
  Repo Id:             busybox
  Scheduled Publishes: 
  Auto Publish:        False
  Config:              
  Distributor Type Id: docker_distributor_export
  Id:                  docker_export_distributor_name_cli
  Last Publish:        None
  Repo Id:             busybox
  Scheduled Publishes: 


>> pulp-admin docker repo update --repo-id=busybox --repo-registry-id=pulpdemo_busybox
This command may be exited via ctrl+c without affecting the request.


[\]
Running...
Updating distributor: docker_web_distributor_name_cli

Task Succeeded



[\]
Running...
Updating distributor: docker_export_distributor_name_cli

Task Succeeded

>> pulp-admin docker repo list --details
+----------------------------------------------------------------------+
                          Docker Repositories
+----------------------------------------------------------------------+

Id:                  busybox
Display Name:        busybox
Description:         None
Content Unit Counts: 
Notes:               
Importers:           
  Config:           
    Feed:          https://index.docker.io
    Upstream Name: busybox
  Id:               docker_importer
  Importer Type Id: docker_importer
  Last Sync:        None
  Repo Id:          busybox
  Scheduled Syncs:  
Distributors:        
  Auto Publish:        True
  Config:              
    Auto Publish:     True
    Repo-registry-id: pulpdemo_busybox
  Distributor Type Id: docker_distributor_web
  Id:                  docker_web_distributor_name_cli
  Last Publish:        None
  Repo Id:             busybox
  Scheduled Publishes: 
  Auto Publish:        False
  Config:              
    Repo-registry-id: pulpdemo_busybox
  Distributor Type Id: docker_distributor_export
  Id:                  docker_export_distributor_name_cli
  Last Publish:        None
  Repo Id:             busybox
  Scheduled Publishes: 

Task also failed for --repo-registry-id='busybox/' and --repo-registry-id='/busybox'

Comment 10 amacdona@redhat.com 2015-02-18 15:19:29 UTC
The behavior is correct, but the error message is bad. This is due to this bug in core pulp:

https://bugzilla.redhat.com/show_bug.cgi?id=1187200

1187200 has been fixed and will make it into 2.6.1, so I am going to bump this one to 2.6.1.

Comment 11 amacdona@redhat.com 2015-02-19 16:44:21 UTC
This is actually a pulp_docker issue that will be fixed in pulp_docker 1.0.0, so I am moving this to Redmine.

https://pulp.plan.io/issues/291


Note You need to log in before you can comment on or make changes to this bug.