StackStorm / StackStorm/st2

Ability to grant permission on all resources of a specific type

Open
#4,066 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement RBAC
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

We should add ability to grant permissions on all resources of a specific type to the RBAC permission assignment files.

Right now, user can already grant permissions on the pack basis. This works for a majority of the use cases (e.g. ability to execute all the actions in pack Y, ability to view all the rules in pack X, etc.), but in some scenarios user may want to grant permission on all the resources of a specific type which don't necessary belong to the same pack.

Some ideas how we could handle that:

Approach 1
name: "pack_search_role"
description: "Role which grants pack_search permission to all packs"
permission_grants:
    -
        resource_uid: "packs:*"
        permission_types:
           - "pack_search"
name: "view_all_rulws"
description: "Role which grants rule_view permission on all the rules in the system"
permission_grants:
    -
        resource_uid: "rule:*"
        permission_types:
           - "rule_view"
Approach 2

In this scenario no resource_id is provided.

That's how we handle global permission types right now (permission which are global and don't apply to a specific resource) so doing that for all the resources could be confusing and we should probably avoid it.

name: "pack_search_role"
description: "Role which grants pack_search permission to all packs"
permission_grants:
    -
        permission_types:
           - "pack_search"

If we go with the first approach, we should probably implement simple "all or nothing" glob matching to being with.

Down the road, we could implement more complex glob matching, but I'm not a big fan of it since it's more complex, opaque and and has negative performance implications in case of complex glob patterns.

One thing which I'm 100% against is using regular expressions instead of globs. I would argue that regular expressions should very rarely be exposed to the end user (if someone exposes it, I treat is as a bad and potentially insecure UX), they increase complexity and there are many edge cases which can result in DDoS and similar resource exhaustion attacks.

Related issue #4063 and comment https://github.com/StackStorm/st2/issues/4063#issuecomment-378837810.

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 by locating the RBAC permission assignment files and reviewing related issue #4063. Compare the proposed resource UID glob approach with the alternative, then clarify matching semantics and security constraints; the work is done when a decided design is implemented and covered by relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authorization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.