Bug 728624 - activation keys are successfully being created with invalid chars
Summary: activation keys are successfully being created with invalid chars
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Candlepin
Classification: Community
Component: candlepin
Version: 0.5
Hardware: Unspecified
OS: Solaris
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: William Poteat
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel62
TreeView+ depends on / blocked
 
Reported: 2011-08-05 20:45 UTC by John Sefler
Modified: 2015-05-14 15:22 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-05-30 13:15:27 UTC


Attachments (Terms of Use)

Description John Sefler 2011-08-05 20:45:54 UTC
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 21:01:13 UTC
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 17:51:36 UTC
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.