Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFD: Introduce nested access list membership #40771

Merged
merged 8 commits into from
Aug 21, 2024
Merged

Conversation

lxea
Copy link
Contributor

@lxea lxea commented Apr 22, 2024

related pr #38738

@lxea lxea requested review from justinas and fspmarshall April 22, 2024 15:30
@lxea lxea added the rfd Request for Discussion label Apr 22, 2024
@lxea lxea added the no-changelog Indicates that a PR does not require a changelog entry label Apr 22, 2024
@gravitational gravitational deleted a comment from github-actions bot Apr 22, 2024
@gravitational gravitational deleted a comment from github-actions bot Apr 22, 2024
Copy link
Collaborator

@r0mant r0mant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call out in the RFD explicitly that we don't support cyclic memberships: #38738 (review).

Copy link
Collaborator

@r0mant r0mant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's also a bit inaccurate to call this "recursive" access lists. Let's call it "nested" instead. Same comment for the terminology used throughout the doc.

@lxea lxea force-pushed the lxea/recursive-acl-rfd branch from 39ed801 to 0225963 Compare April 24, 2024 15:20
@r0mant r0mant changed the title RFD: Introduce recursive access list membership RFD: Introduce nested access list membership Apr 24, 2024
Copy link
Collaborator

@r0mant r0mant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall makes sense but this only covers how user permissions will be calculated. We also need to think through the impact of this feature on other access list related features like access requests and access reviews.

Also, can you add a section covering IaC - will it require any work to support this, or will it work out of the box? Check with @hugoShaka if any changes to Terraform provider of Kube operator will be needed.

rfd/0XYZ-nested-accesslists.md Outdated Show resolved Hide resolved
rfd/0XYZ-nested-accesslists.md Outdated Show resolved Hide resolved

```

When calculating a users access roles, the tree of access lists will
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this affect the access request flow, will similar traversal happen there when calculating suggested access lists? For example, say there is an access list "Dev Team" that gives access to server S1. Then, say "Dev Team" contains another list "Core Team" that gives access to server S2.

Now Alice requests access to server S1. Will the request reviewer (if they're an owner of both lists) be able to promote her to either one or just the "Dev Team"? Can you add a section to the RFD that clarifies this.

Copy link
Contributor Author

@lxea lxea May 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not super experienced in how the access requests and access lists interact

In this case because alice is requesting server S1 which Dev team owners can give access to, is she actually requesting to be on the list or requesting the resource s1?

The way its implemented now, user permissions are calculated in IsAccessList(Member/Owner) and I have implemented it to just look up the tree in there, so its fairly transparent to access requests, as to whether a user is a member/owner via nesting or direct membership. I think this should also apply to calculating the suggested reviewers below

- name: ea4cbbc7-bee1-49b3-bf78-734b4b27ea38
# list of references to other access lists, for owners to include in this access list
owner_access_lists:
- name: 3e9df1e7-0b8a-4984-b2e8-5bc0d7b356a9
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar question to the one I left below - how does this affect "suggested reviewers" functionality? Right now we detect if there's an access list that grants resources you're requesting and puts that list owners as suggested reviewers.

With nested lists, will we take owners from the list that grants actual resource, plus owners from nested lists?

rfd/0XYZ-nested-accesslists.md Outdated Show resolved Hide resolved
@camscale camscale mentioned this pull request May 1, 2024
@r0mant r0mant requested review from jakule and removed request for probakowski and camscale May 1, 2024 16:39
- auditor
traits: {}
# list of references to other access lists, for users to include in this access list
member_access_lists:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is a basic question, but why do we need member and owners list separate? I'd assume that an access list has "child" access lists and the owners and members are inherited without modifications.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For ownership of ALs imported from Entra, it is a plan to have something simple for now, e.g. a static list of owners ["alice", "bob"] for all imported access lists, so for Entra the owner_access_lists is not particularly relevant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sens to only have the one way to include access lists 👍

Copy link
Collaborator

@r0mant r0mant May 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lxea We need to keep separate access lists for owners and members like you had originally. Otherwise, how do I set IT-Team access list as an owner, and Dev-Team as a member?

Copy link
Contributor

@smallinsky smallinsky May 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Themember_access_lists and owner_access_lists approuch looks reasonable by wonder about extensibility.

Right now the member_access_lists is static property that can refer only to access list members.

So we have:

member_access_lists
 - "access_list_id"
owner_access_lists
- "access_list_id"

Does it make sense to build a flexible solution allowing to nested access list like below where members and owners properties are crafted for extensibility so in the future we can add additional types:

dynamic_members: 
 // A user becomes a access list members if is member of access list Y
 - access_list_members
    - Y
 // A user becomes a access list member if is owner of access list Z
 - access_list_owners:
     - Z
 // A user becomes a access list member if has role editor
 - roles:
    - editor
 - user_traits:
     - name: "org"
        value: "dev"

but for now we can implement

dynamic_members: 
 - access_list_members:
    - access_list_id

and

dynamic_owners: 
 - access_list_owners:
    - access_list_id

WDYT @lxea @r0mant ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks like a good system to me 👍

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to reply here earlier but Marek's proposed structure looks good to me too.


# Implementation considerations

The implementation will not support looping within the heirarchy as
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I understand this point. What looping is? I'd assume that an access list would fetch all parents, merge them into one set of rules an run all checks against it.
Also, are we going to support cycles? If no, how are we going to prevent them?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm reading this "looping" as a synonym for cycles.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that looping has anything to do with cycles. for(i = 0; i < 10; i++) and while(true) are both loops where the first one will end and the second will loop forever.
All graph algorithms terminate on DAG, but a cycle make cause an algorithm to never terminate.
@justinas AFAIR you mentioned that Entra allows cycles in the setup? If this true, then we won't be able to import all roles.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justinas AFAIR you mentioned that Entra allows cycles in the setup? If this true, then we won't be able to import all roles.

That's true, Entra does not limit you from making cycles A -> B -> A from groups. IMO it should not be a common pattern, so I'd be fine with not supporting importing such cycles, but that would technically mean we are not producing an accurate view of the directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant looping in terms of a cycle in a graph, just misnamed it here. We just want to avoid it I think to avoid introducing overly complicated configuration options, with the hope that they're not too common, if they are required by somone, it shouldnt be too difficult to implement it

Copy link
Contributor

@justinas justinas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, looks good to me in relation with Entra groups.

@r0mant r0mant requested a review from smallinsky May 6, 2024 16:15
- auditor
traits: {}
# list of references to other access lists, for users to include in this access list
member_access_lists:
Copy link
Contributor

@smallinsky smallinsky May 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Themember_access_lists and owner_access_lists approuch looks reasonable by wonder about extensibility.

Right now the member_access_lists is static property that can refer only to access list members.

So we have:

member_access_lists
 - "access_list_id"
owner_access_lists
- "access_list_id"

Does it make sense to build a flexible solution allowing to nested access list like below where members and owners properties are crafted for extensibility so in the future we can add additional types:

dynamic_members: 
 // A user becomes a access list members if is member of access list Y
 - access_list_members
    - Y
 // A user becomes a access list member if is owner of access list Z
 - access_list_owners:
     - Z
 // A user becomes a access list member if has role editor
 - roles:
    - editor
 - user_traits:
     - name: "org"
        value: "dev"

but for now we can implement

dynamic_members: 
 - access_list_members:
    - access_list_id

and

dynamic_owners: 
 - access_list_owners:
    - access_list_id

WDYT @lxea @r0mant ?

member_access_lists:
- name: ea4cbbc7-bee1-49b3-bf78-734b4b27ea38
# list of references to other access lists, for owners to include in this access list
owner_access_lists:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does members and owners from nested access list will be verified against MembershipRequires and OwnershipRequires ?

@lxea lxea force-pushed the lxea/recursive-acl-rfd branch from 1ef6428 to cfdfdf5 Compare May 21, 2024 09:41
Copy link
Collaborator

@r0mant r0mant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, let's get your WIP PR wrapped up and updated with the point discussed in this RFD and :shipit:

@@ -0,0 +1,170 @@
---
title: RFD 0XYZ - Nested Access lists
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to assign the number, in the file name as well.

Copy link
Contributor

@smallinsky smallinsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lxea Could you align the RFD and switch to dynamic_members instead of member_access_lists field ?

Otherwise LGTM.

rfd/0XYZ-nested-accesslists.md Outdated Show resolved Hide resolved
rfd/0XYZ-nested-accesslists.md Outdated Show resolved Hide resolved
rfd/0XYZ-nested-accesslists.md Outdated Show resolved Hide resolved
rfd/0XYZ-nested-accesslists.md Outdated Show resolved Hide resolved
@lxea
Copy link
Contributor Author

lxea commented Jun 11, 2024

@r0mant @smallinsky Members of lists have the reason they were added/who they were added by in the datastore, should we encode this information in the dynamic access list section or should it be stored elsewhere, or not included at all?

@r0mant
Copy link
Collaborator

r0mant commented Jun 11, 2024

@lxea Hmm yeah you're right, they also have TTL just like other regular members right? I wonder if we need to revisit the data model a bit and instead of encoding them directly into access list resource store them separately as also a "AccessListMember" resource (or whatever it's called) with all the same metadata as individual user members.

@kiosion kiosion added this pull request to the merge queue Aug 21, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 21, 2024
@kiosion kiosion force-pushed the lxea/recursive-acl-rfd branch from e03adc1 to b97d1fb Compare August 21, 2024 22:41
@kiosion kiosion added this pull request to the merge queue Aug 21, 2024
Merged via the queue into master with commit ba07fbc Aug 21, 2024
40 checks passed
@kiosion kiosion deleted the lxea/recursive-acl-rfd branch August 21, 2024 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Indicates that a PR does not require a changelog entry rfd Request for Discussion size/md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants