-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Github "Direct" User Repo Access (#1391)
### Summary This PR adds to the Github graph, adding repo access that is granted to all users who have a 'direct' affiliation to the repo. Cartography currently [does](https://cartography-cncf.github.io/cartography/modules/github/schema.html#id6) already map some direct user repo access, but only for collaborators with an 'outside' affiliation to the repo. This PR broadens that to include all collaborators, aka anybody with a 'direct' affiliation. This follows Github's naming for these concepts, as seen [here](https://docs.github.com/en/graphql/reference/enums#collaboratoraffiliation). In case it is unclear or for people newer to Github, note: this is focusing on access users are granted directly to a repo, as opposed to via a team. Access granted via team is outside the scope of this PR. We think this is a valuable addition to the graph for a few reasons, including: 1. Our analysts want few-to-no users to be granted access directly to repos, on the thinking that managing access via teams can make access easier to automate (ie with ABAC/RBAC type logic) and to audit. Graphing direct-access, regardless of whether a user is within the org or outside it, will help highlight who to clean up. 2. Longer term, we eventually want to know, from the graph, _all_ access a user has. This PR is a step in that direction. (In a future PR, we hope to add a user-team membership relationship. Since Cartography maps team-repo access rel, we could then have a user-team-repo graph, and that would complete the picture of user access in Github.) #### Illustration of the intention ![Cartography AMPS User Direct Repo Access (3)](https://github.com/user-attachments/assets/83a28a9b-f4f9-40fe-bdc5-153aa5196070) #### Screencaps **A REPO WITH OUTSIDE COLLABORATORS** BEFORE ![CollabsBefore](https://github.com/user-attachments/assets/6806fe08-5e7c-4ced-a8c8-ed43a39566c6) AFTER ![CollabsAfter](https://github.com/user-attachments/assets/18e9f96d-eb8e-4cad-984a-7e7056615776) **A REPO WITH NON-OUTSIDE COLLABORATORS** BEFORE (no results, because these sorts of users are not graphed) ![Screenshot 2024-11-21 at 5 54 37 PM](https://github.com/user-attachments/assets/d5b371ba-f86e-4a97-a06f-9f62c2548e76) AFTER ![Screenshot 2024-11-21 at 5 54 25 PM](https://github.com/user-attachments/assets/04941eb1-10ff-4ff9-a95d-172295744978) **GENERAL COUNTS TO GIVE A SENSE OF CONNECTIONS NOW THERE** BEFORE ![UserRepoRelsBefore](https://github.com/user-attachments/assets/08d2b96f-41ca-44b6-923d-75247ef09812) AFTER ![UserRepoRelsAfter](https://github.com/user-attachments/assets/85e3bf51-6a60-4742-865a-454bfab1ef24) ### Related issues or links None ### Checklist Provide proof that this works (this makes reviews move faster). Please perform one or more of the following: - [X] Update/add unit or integration tests. - [X] Include a screenshot showing what the graph looked like before and after your changes. - [ ] Include console log trace showing what happened before and after your changes. If you are changing a node or relationship: - [X] Update the [schema](https://github.com/lyft/cartography/tree/master/docs/root/modules) and [readme](https://github.com/lyft/cartography/blob/master/docs/schema/README.md). **N/A/** If you are implementing a new intel module: - [ ] Use the NodeSchema [data model](https://cartography-cncf.github.io/cartography/dev/writing-intel-modules.html#defining-a-node). --------- Signed-off-by: Daniel Brauer <[email protected]>
- Loading branch information
Showing
5 changed files
with
465 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.