juju register fails with usernames that contain uppercase letters

Bug #1833449 reported by Felipe Reyes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Harry Pidcock

Bug Description

When user creates a user that contains uppercases (e.g. juju add-user JohnDoe), then the "juju register" step fails. It's not clear if juju shouldn't be accepting that kind of usernames in the first place or if it's juju register the one at fault here.

Steps to reproduce:

juju add-user TEST
juju register <HASH_GIVEN_BY_add-user>

Expected result:

the new user is able to login to the controller

Actual result:

juju register MF4TBFRFU1QwIRMOMTAuNS4wLjU6MTcwNzATDzI1Mi4wLjUuMToxNzA3MAQg9KyO-NGJ-
Enter a new password:
Confirm password:
Enter a name for this controller [stsstack-stsstack]:
ERROR Provided registration token may have been expired.
A controller administrator must reset your user to issue a new token.
See "juju help change-user-password" for more information.

This is how the user looks like the database:

{
        "_id" : "test",
        "name" : "TEST",
        "displayname" : "",
        "secretkey" : BinData(0,"9KyO+NGJ+EwqG7j7DClc9ysnODXWbzoRTp089iYw9tE="),
        "passwordhash" : "",
        "passwordsalt" : "",
        "createdby" : "admin",
        "datecreated" : ISODate("2019-06-19T16:58:06Z"),
        "txn-revno" : NumberLong(2),
        "txn-queue" : [
                "5d0a699e8c77460db2841f90_341d2785"
        ]
}

So I believe that this could be due to the mismatch between "name" and "_id". Here it is the transaction that jujud attempted to commit:

2019-06-19 17:06:51 TRACE juju.state.txn database.go:359 ran transaction in 0.028s (retries: 0) []txn.Op{
    {
        C: "users",
        Id: "TEST",
        Assert: "d+",
        Insert: nil,
        Update: bson.D{
            {
                Name: "$set",
                Value: bson.D{
                    {
                        Name: "passwordhash",
                        Value: "jCDPZS6gXBJe8p97rwfRv7X/",
                    },
                    {
                        Name: "passwordsalt",
                        Value: "+2kUw+9Q/Xudsdeg",
                    },
                },
            },
            {
                Name: "$unset",
                Value: bson.D{
                    {
                        Name: "secretkey",
                        Value: "",
                    },
                },
            },
        },
        Remove: false,
    },
}
err: transaction aborted

Tags: atos sts
Felipe Reyes (freyes)
tags: added: atos sts
Tim Penhey (thumper)
Changed in juju:
status: New → Triaged
importance: Undecided → High
milestone: none → 2.6.5
Harry Pidcock (hpidcock)
Changed in juju:
assignee: nobody → Harry Pidcock (hpidcock)
status: Triaged → In Progress
Revision history for this message
Harry Pidcock (hpidcock) wrote :
Harry Pidcock (hpidcock)
Changed in juju:
status: In Progress → Fix Committed
Changed in juju:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.