saltstack / saltstack/salt

netapi modules incompatible with eauth acl

Open
#51,515 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Salt-API severity-medium
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.