Bug 669397

Summary: Enforce ID restrictions
Product: [Retired] Pulp Reporter: Jay Dobies <jason.dobies>
Component: z_otherAssignee: Sayli Karmarkar <skarmark>
Status: CLOSED CURRENTRELEASE QA Contact: Preethi Thomas <pthomas>
Severity: medium Docs Contact:
Priority: low    
Version: unspecifiedCC: cperry, skarmark, tsanders
Target Milestone: ---Keywords: Triaged
Target Release: Sprint 23   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-16 12:07:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 647488    

Description Jay Dobies 2011-01-13 15:10:27 UTC
Since we treat ID values (repo ID, consumer ID, consumer group ID, consumer/repo group names, etc) as programmatic references, we really should define and enforce a format that will be able to safely be used.

For instance, the ID is often used as a value in REST URLs. For compatibility and simplicity, we should restrict the values to easy to process characters.

Comment 1 Jay Dobies 2011-01-13 15:11:59 UTC
I suggest we only allow the following in IDs:

 * Letters
 * Numbers
 * dash (-)
 * underscore (_)
 * period (.)

We can define a regex to match these and add it to our create methods down near the database layer.

Comment 2 Sayli Karmarkar 2011-05-09 06:30:11 UTC
$ sudo pulp-admin repo create --id=abc$%%%

error: operation failed: PulpException: 'Given ID is invalid. ID may contain numbers(0-9), upper and lower case letters(A-Z, a-z), hyphens(-), underscore(_) and periods(.)'

$ sudo pulp-admin repo create --id=abc_xyz
Successfully created repository [ abc_xyz ]

Comment 3 Jeff Ortel 2011-05-09 22:25:17 UTC
build 0.174

Comment 4 Preethi Thomas 2011-05-31 19:37:28 UTC
verified

[root@preethi ~]# rpm -q pulp
pulp-0.0.181-1.fc14.noarch
[root@preethi ~]# pulp-admin repo create --id=abc$%%%
error: operation failed: PulpException: 'Given ID is invalid. ID may contain numbers(0-9), upper and lower case letters(A-Z, a-z), hyphens(-), underscore(_) and periods(.)'
[root@preethi ~]# 
[root@preethi ~]# pulp-admin repo create --id=abc**
error: operation failed: PulpException: 'Given ID is invalid. ID may contain numbers(0-9), upper and lower case letters(A-Z, a-z), hyphens(-), underscore(_) and periods(.)'
[root@preethi ~]# pulp-admin repo create --id=abc_12_AD
Successfully created repository [ abc_12_AD ]

Comment 5 Preethi Thomas 2011-08-16 12:07:13 UTC
Closing with Community Release 15

pulp-0.0.223-4.

Comment 6 Preethi Thomas 2011-08-16 12:20:56 UTC
Closing with Community Release 15

pulp-0.0.223-4.