Bug 728624 - activation keys are successfully being created with invalid chars
activation keys are successfully being created with invalid chars
Status: CLOSED CURRENTRELEASE
Product: Candlepin
Classification: Community
Component: candlepin (Show other bugs)
0.5
Unspecified Solaris
unspecified Severity unspecified
: ---
: ---
Assigned To: William Poteat
John Sefler
:
Depends On:
Blocks: rhsm-rhel62
  Show dependency treegraph
 
Reported: 2011-08-05 16:45 EDT by John Sefler
Modified: 2015-05-14 11:22 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-05-30 09:15:27 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description John Sefler 2011-08-05 16:45:54 EDT
Description of problem:
According to the following error message, the creation of activation keys has restrictions on the characters that can be used in the activation key name:

Activation key names must be alphanumeric or the characters '-' or '_'.

However some character attempts are succeeding....

Version-Release number of selected component (if applicable):
[root@jsefler-onprem-62candlepin candlepin]# git show-ref | grep master
895fdff46e33a607d63350df9bdd7bdd275b9e17 refs/heads/master
895fdff46e33a607d63350df9bdd7bdd275b9e17 refs/remotes/origin/master


How reproducible:


Steps to Reproduce:

# curl -k --request POST --user testuser1:password --data '{"name":"[OpeningBracket["}' --header 'accept: application/json' --header 'content-type: application/json'  https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/owners/admin/activation_keys | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
109   275  100   275    0    27    578     56 --:--:-- --:--:-- --:--:--   757
{
    "created": "2011-08-05T20:33:09.521+0000", 
    "id": "8a90f8c63196bb2001319ba641913a1e", 
    "name": "[OpeningBracket[", 
    "owner": {
        "displayName": "Admin Owner", 
        "href": "/owners/admin", 
        "id": "8a90f8c63196bb20013196bb9e210006", 
        "key": "admin"
    }, 
    "pools": [], 
    "updated": "2011-08-05T20:33:09.521+0000"
}


^^^ EXPECTED THAT TO FAIL
name "[OpeningBracket[" DOES NOT SATISFY "Activation key names must be alphanumeric or the characters '-' or '_'."

Other names that are also successfully creating activation keys that don't satisfy this restriction are:

[OpeningBracket[
]ClosingBracket]
`BackTick`
^Caret^
\Backslash\


Actual results:


Expected results:


Additional info:
Comment 1 John Sefler 2011-08-05 17:01:13 EDT
An empty name value appears to be ok too.  I would assume this is acceptable.  Please confirm.  

[jsefler@jseflerT510 ~]$ curl -k --request POST --user testuser1:password --data '{"name":""}' --header 'accept: application/json' --header 'content-type: application/json'  https://jsefler-onprem-62candlepin.usersys.redhat.com:8443/candlepin/owners/admin/activation_keys | python -mjson.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
104   259  100   259    0    11    539     22 --:--:-- --:--:-- --:--:--   701
{
    "created": "2011-08-05T20:55:41.106+0000", 
    "id": "8a90f8c63196bb2001319bbae1323a24", 
    "name": "", 
    "owner": {
        "displayName": "Admin Owner", 
        "href": "/owners/admin", 
        "id": "8a90f8c63196bb20013196bb9e210006", 
        "key": "admin"
    }, 
    "pools": [], 
    "updated": "2011-08-05T20:55:41.106+0000"
}
Comment 2 J.C. Molet 2011-08-18 13:51:36 EDT
Works as expected now, all above cases fail as they should:

[jmolet@jmolet ~]$ for NAME in "" [OpeningBracket[ ]ClosingBracket] \`BackTick\` ^Caret^ \\Backslash\\; do echo "name: $NAME"; curl -k --request POST --user testuser1:password --data '{"name":"$NAME"}' --header 'accept: application/json' --header 'content-type: application/json' https://mgmt5.rhq.lab.eng.bos.redhat.com:8443/candlepin/owners/admin/activation_keys | python -mjson.tool; echo; done
name: 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   116  100   100  100    16    306     49 --:--:-- --:--:-- --:--:--   393
{
    "displayMessage": "Activation key names must be alphanumeric or the characters '-' or '_'. [$NAME]"
}

name: [OpeningBracket[
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   116  100   100  100    16    300     48 --:--:-- --:--:-- --:--:--   400
{
    "displayMessage": "Activation key names must be alphanumeric or the characters '-' or '_'. [$NAME]"
}

name: ]ClosingBracket]
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   116  100   100  100    16    311     49 --:--:-- --:--:-- --:--:--   398
{
    "displayMessage": "Activation key names must be alphanumeric or the characters '-' or '_'. [$NAME]"
}

name: `BackTick`
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   116  100   100  100    16    296     47 --:--:-- --:--:-- --:--:--   390
{
    "displayMessage": "Activation key names must be alphanumeric or the characters '-' or '_'. [$NAME]"
}

name: ^Caret^
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   116  100   100  100    16    304     48 --:--:-- --:--:-- --:--:--   392
{
    "displayMessage": "Activation key names must be alphanumeric or the characters '-' or '_'. [$NAME]"
}

name: \Backslash\
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   116  100   100  100    16    310     49 --:--:-- --:--:-- --:--:--   398
{
    "displayMessage": "Activation key names must be alphanumeric or the characters '-' or '_'. [$NAME]"
}



Tested against: "version": "0.4.10"

marking VERIFIED

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