Bug 672233

Summary: consumer names with ',' or '#' in name not allowed, possibly other chars
Product: [Community] Candlepin Reporter: Adrian Likins <alikins>
Component: candlepinAssignee: Justin Harris <jharris>
Status: CLOSED CURRENTRELEASE QA Contact: John Sefler <jsefler>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 0.5CC: cduryee, jharris, jkeck
Target Milestone: ---Keywords: QA-Closed
Target Release: ---   
Hardware: Unspecified   
OS: Solaris   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-02-23 21:51:31 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: 639436    
Attachments:
Description Flags
verified 250 char limit name test through the gui
none
verified invalid chars test through the gui none

Description Adrian Likins 2011-01-24 14:30:39 UTC
Description of problem:


If you try to register a system with a consumer name that includes a ',' char or a '#' char, candlepin
rejects the name, It looks like it is related to what is an acceptable name for the Altername section of the consumer cert.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Justin Harris 2011-01-26 21:03:51 UTC
Consumer names are now limited to:
alphanumeric, period, dash, underscore

Names are also limited to 250 characters max.

Comment 2 John Sefler 2011-01-28 20:52:29 UTC
Verifying candlepin version (0.1.32)....
[root@jsefler-dev2-1 ~]# curl -k  -u foo:bar --request GET https://candlepin1.devlab.phx1.redhat.com:443/candlepin/status | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0    56    0    56    0     0    103      0 --:--:-- --:--:-- --:--:--   666
{
    "release": "1%{?dist}", 
    "result": true, 
    "version": "0.1.32"
}


[root@jsefler-dev2-1 ~]# subscription-manager register --username=xeops --password=redhat --force --name=periods.dashes-underscores_alphanumeric123
The system with UUID ba2c99e6-7a7e-4302-833a-77184ac95513 has been unregistered
d9b00b6d-b668-47f9-a017-69a4c71b42f2 periods.dashes-underscores_alphanumeric123
[root@jsefler-dev2-1 ~]# subscription-manager identity
Current identity is: d9b00b6d-b668-47f9-a017-69a4c71b42f2 name: periods.dashes-underscores_alphanumeric123

^^^ VERIFIED SUCCESS AS EXPECTED


[root@jsefler-dev2-1 ~]# subscription-manager register --username=xeops --password=redhat --force --name=a!
System name must consist of only alphanumeric characters, periods, dashes and underscores.

[root@jsefler-dev2-1 ~]# subscription-manager register --username=xeops --password=redhat --force --name=a@
System name must consist of only alphanumeric characters, periods, dashes and underscores.

[root@jsefler-dev2-1 ~]# subscription-manager register --username=xeops --password=redhat --force --name=a#
System name must consist of only alphanumeric characters, periods, dashes and underscores.

[root@jsefler-dev2-1 ~]# subscription-manager register --username=xeops --password=redhat --force --name=a,
System name must consist of only alphanumeric characters, periods, dashes and underscores.

[root@jsefler-dev2-1 ~]# subscription-manager register --username=xeops --password=redhat --force --name=a*
System name must consist of only alphanumeric characters, periods, dashes and underscores.

[root@jsefler-dev2-1 ~]# subscription-manager register --username=xeops --password=redhat --force --name=a=
System name must consist of only alphanumeric characters, periods, dashes and underscores.

[root@jsefler-dev2-1 ~]# subscription-manager register --username=xeops --password=redhat --force --name="&"
System name must consist of only alphanumeric characters, periods, dashes and underscores.

[root@jsefler-dev2-1 ~]# subscription-manager register --username=xeops --password=redhat --force --name=?
System name must consist of only alphanumeric characters, periods, dashes and underscores.

[root@jsefler-dev2-1 ~]# subscription-manager register --username=xeops --password=redhat --force --name="|"
System name must consist of only alphanumeric characters, periods, dashes and underscores.

^^^ REGISTER WITH INVALID CHARACTERS IN THE NAME WAS BLOCKED AS EXPECTED


[root@jsefler-dev2-1 ~]# subscription-manager register --username=xeops --password=redhat --force --name=123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
97f41ef3-2036-4c9d-b7df-d78df8d9b05e 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789

^^^ REGISTER WITH A NAME OF 249 CHARACTERS WAS A SUCCESS AS EXPECTED



[root@jsefler-dev2-1 ~]# subscription-manager register --username=xeops --password=redhat --force --name=1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
The system with UUID 97f41ef3-2036-4c9d-b7df-d78df8d9b05e has been unregistered
Name of the consumer should be shorter than 250 characters

^^^ REGISTER WITH A NAME OF 250 CHARACTERS WAS BLOCKED AS EXPECTED


moving to VERIFIED

Comment 3 John Sefler 2011-01-28 21:50:15 UTC
Name of the consumer should be shorter than 250 characters
                                                          ^ MISSING PERIOD

Comment 4 John Sefler 2011-01-28 22:15:07 UTC
Created attachment 475882 [details]
verified 250 char limit name test through the gui

Comment 5 John Sefler 2011-01-28 22:15:40 UTC
Created attachment 475884 [details]
verified invalid chars test through the gui

Comment 6 Justin Harris 2011-01-31 21:13:05 UTC
Period has been added.  Was that the only issue so far?

Comment 7 John Sefler 2011-01-31 21:27:35 UTC
Yes - your implementation for the character limitations for consumer names looks good.  The tests in comment #2 all passed and I've already built some automated tests around this for our nightly test runs.

Comment 8 John Sefler 2011-02-03 02:50:18 UTC
[root@jsefler-f12-candlepin candlepin]# git show-ref BETA
3b0042c82f8277ef3cc1e81771b0c19181721fa7 refs/heads/BETA
d32f011d86b900370d80ddb5518f584689044b87 refs/remotes/origin/BETA

[root@jsefler-onprem01 ~]# grep hostname= /etc/rhsm/rhsm.conf
hostname=jsefler-f12-candlepin.usersys.redhat.com

[root@jsefler-onprem01 ~]# subscription-manager register --username=testuser1 --password=password --force --name=1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
Name of the consumer should be shorter than 250 characters.
                                                          ^ PERIOD WAS ADDED

moving back to VERIFIED

Comment 9 John Sefler 2014-04-28 19:12:42 UTC
Update...

Names are now limited to 255 characters max due to the following:

commit a0db7c35f8d7ee71daeabaf39788b3f47206e0e0
Author: William Poteat <wpoteat>
Date:   Wed Apr 9 14:34:20 2014 -0400

    1065369: Use Hibernate Validation to supersede database error reporting.
    
    Current violations of 'not null' and size constraints result in runtime errors.
    Hibernate validation checks annotated fields prior to database interaction.