netapi modules incompatible with eauth acl
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
The SaltAPI/netapi modules as shipped with Salt 2018.3.3 (rest_cherrypy and rest_tornado) contain a perms field in the response structure to a successful POST request to /login. These perms are populated by retrieving the relevant ACLs from the (master) configuration file (there's a bit of code duplication here, by the way).
However, while this works for auth modules who have ACLs specified in the configuration file, it doesn't work for auth modules that expose an acl procedure to dynamically construct ACL lists. When using such auth module, the perms field in the /login response remains empty (I believe a similar issue may occur when using process_acl like the LDAP eauth module does).
As a work-around, I created a custom netapi module (wrapping functionality of rest_cherrypy) which does fill in these fields based on the auth_list field in the token generated using self.auth.mk_token, and sets the value of perms to this list, similar to how the current code special-cases the django auth module. However, this is a hack: it requires this auth_list to be populated, which is only the case if keep_acl_in_token is true in the configuration. There seems to be no way to retrieve the ACL list from a given token in the context of a netapi module otherwise.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the rest_cherrypy and rest_tornado netapi modules, following the successful POST /login response and its perms field. Compare their ACL retrieval with auth modules exposing acl or process_acl, including the token's auth_list and keep_acl_in_token behavior; done means dynamic ACLs appear correctly in perms without relying on the workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, authentication
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100