don't allow grants for non-existent users

Bug #1895545 reported by james beedy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Triaged
Low
Unassigned

Bug Description

Just ran into a scenario where a user made a typo when granting another user access to a model. The juju command succeeded even though there is no actual user with the username that was the grant command was ran with. Possibly juju can return a simple error informing the granting user that there is no user with "<username>".

Thanks!

Revision history for this message
Pen Gale (pengale) wrote :

@jamesbeedy: thank you for filing the bug! Are these local or external users?

For local users, you should get an error when the user does't exist. For example, if I create a user "foo" on my localhost controller, I can grant access to a model for that user, but not for a non-existent user "bar":

```
petevg@badjanet:~$ juju add-user foo
User "foo" added
Please send this command to foo:
    juju register <hash redacted>

"foo" has not been granted access to any models. You can use "juju grant" to grant access.
petevg@badjanet:~$ juju models
Controller: raven

Model Cloud/Region Type Status Machines Units Access Last connection
controller localhost/localhost lxd available 1 - admin just now
test-run* localhost/localhost lxd available 1 1 admin 2020-09-15

1 petevg@badjanet:~$ juju grant foo read test-run
1 petevg@badjanet:~$ juju grant bar read test-run
ERROR could not grant model access: user "bar" does not exist locally: user "bar" not found

```

However, I can add access for the external user bar. The following succeeds, without an error message:

``
petevg@badjanet:~$ juju grant bar@external read test-run
```

This is intended behavior, as we don't really know what external users exist.

With JAAS, we do have a better shot at looking up whether a user is valid. This might be a feature request against JAAS, to add functionality to treat "external" users w/in JAAS in the same way that we treat internal users. I don't know off the top of my hand how complex this would be.

Changed in juju:
status: New → Triaged
importance: Undecided → Wishlist
Revision history for this message
John A Meinel (jameinel) wrote :

I'm not sure whether Candid (as the API for talking about external users) allows a way to probe for the existing of a user, or whether that was explicitly hidden (so that arbitrary users can't see if other arbitrary users exist).
It certainly is nicer UX to be told your grant won't succeed because that user doesn't exist.

Revision history for this message
Canonical Juju QA Bot (juju-qa-bot) wrote :

This bug has not been updated in 2 years, so we're marking it Low importance. If you believe this is incorrect, please update the importance.

Changed in juju:
importance: Wishlist → Low
tags: added: expirebugs-bot
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.