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

Design document for adding roles to manual judgment stage. #80

Merged
merged 3 commits into from
Oct 26, 2020
Merged

Design document for adding roles to manual judgment stage. #80

merged 3 commits into from
Oct 26, 2020

Conversation

sanopsmx
Copy link
Contributor

@sanopsmx sanopsmx commented Dec 12, 2019

Select roles that can execute manual judgement stage

Status Proposed, Accepted, Implemented, Obsolete
RFC # spinnaker/deck#8779 , spinnaker/orca#3988
Author(s) Sanjeev Thatiparthi (@sanopsmx) (https://github.com/sanopsmx)
SIG / WG sig-ux

Overview

Display all the roles of the user added in the application in the manual judgment stage.If there are 2 groups(dev,qa)
and qa group has the permission to deploy.If there is a manual judgment stage before the deploy stage.If there are
no groups attached to the manual judgment stage, then dev group can continue with the manual judgment stage and get
failed at the deploy stage as only qa group has the permission to deploy. This is the reason we are displaying all
the roles of the application. This is a usability feature.

Goals and Non-Goals

Display authorized groups dropdown list only when the user selects the manual judgment stage.
Display all the groups the user has selected while creating application(permissions) in the authorized groups dropdown.
When the pipeline is executed, disable the manual judgment 'continue/cancel' based on the user role selected in the authorized groups.

opsmxemp1 : ["mail-qa","sra-dev","mail-dev","sra-qa","empdev"]

Testcase No. Application Name Application Roles Application Permissions Manual Judgment Roles User Result
1 testmanualjud001 sra-dev,sra-qa sra-dev(r,w,e),sra-qa(r) sra-dev opsmxemp1 Enable Button
2 testmanualjud002 N.A ---- N.A opsmxemp1 Enable Button
3 testmanualjud003 sra-dev,sra-qa sra-dev(r,w,e),sra-qa(r) N.A opsmxemp1 Enable Button
4 testmanualjud004 sra-dev,sra-qa,mail-dev,mail-qa,emp-dev,finance sra-dev(r),sra-qa(r),mail-dev(r,w,e),mail-qa(r),emp-dev(r),finance(r) sra-qa,mail-dev,finance opsmxemp1 Enable Button
5 testmanualjud005 sra-dev,mail-qa,operations sra-dev(r),mail-qa(r),operations(r,w,e) operations opsmxemp1 Disable Button
6 testmanualjud006 sra-dev,mail-qa sra-dev(r),mail-qa(r,w,e) sra-dev opsmxemp1 Disable Button

User can opt out of this feature as stated in the testcase 2 & 3.
If authz is not enabled, it will work in the same way.
The above test cases will handle all the test scenarios.
If the role is set in the manual judgment stage, then we check the stage role both in the application roles and user roles.
If yes,we check for application permissions of that role. If yes(stage role has execute/write/create application permission),
we can approve and move to the downstream stage, if no(stage role has read application permission), then we deny
(disable the continue button in the manual judgment stage).If the pipeline is triggered from command line,
then the backend orca code checks the same above mentioned logic.If yes,we approve and moves to the
downstream stage , if no, then we deny(It will be running in the same stage).

Motivation and Rationale

Only legitimate users can approve the manual judgment stage so that it can be moved to downstream stages.

Timeline

Already Implemented

Design

  1. Enhanced stage.html to

    Get the roles of the application.
    Display the roles of the application as a list only if the stage is Manual Judgment.

  2. Enhanced stage.module.js to

    Fetch the permissions of the application from the gate application url.
    Application permissions has all the roles.
    Populate the list with only the roles of the application with no duplicates.

  3. Enhanced ApplicationReader.ts to

Fetch the permissions of the application from the gate application url.

  1. Enhanced ManualJudgmentApproval.tsx to

Fetch the roles of the application, stage and the user during the execution.
Iterate through each of the user role to check if the role exists in the stage and application.
We also check for stage role application permission.
If the stage role has execute/write/create application permission, then enable the continue button.
If the stage role has read application permission, then disable the continue button.

  1. Enhanced OperationsController.groovy to

    Get the application roles, stage roles and the user roles.
    Check each of the user roles whether they are contained in the stage and application roles.
    We also check for stage role application permission.
    If the stage role has execute/write/create application permission, then we set the isAuthorized flag to true.
    If the stage role has read application permission, then we set the isAuthorized flag to false.
    By default, all the stages except Manual Judgment are true.

  2. Enhanced ManualJudgmentStage.groovy to

    Check for the flag in ManualJudgmentStage.groovy whether to execute to the next stage or not.
    If yes/no, continue with the next stages/continues running the same stage.

  3. Enhanced ManualJudgmentStageSpec.groovy to

    Modified the testcases as per the new logic.

@ethanfrogers
Copy link
Contributor

This RFC is linked to a previous RFC where initial feedback was given - #78

@ajordens
Copy link
Contributor

ajordens commented Jan 8, 2020

This is a usability feature - was there any feedback from the Security SIG? Personally, this seems less focused on usability and more on security/compliance.

Implementation-wise, I'd suggest starting with the restrictions in orca and the ability to configure the required set of roles on the Manual Judgment stage. That may or may not uncover an issue with how we currently check auth around PATCH'ing a pipeline stage.

The fact that continue/cancel buttons are hidden is definitely a usability improvement but the important checks happen in orca.

As an aside, allowing for free-form group specification (vs only selecting from a list) seems reasonable to me but an implementation concern. It would certainly be an improvement over Edit JSON.

Overall, I'm 👍 to the idea and see it as an incremental improvement over Manual Judgment.

@sanopsmx
Copy link
Contributor Author

sanopsmx commented Jan 9, 2020

We did not hear any feedback from security SIG.

Checks happen in both UI and orca.

@robzienert
Copy link
Member

@bpowell @helenelau - Sounds like this RFC is currently in your court.

@helenelau
Copy link
Contributor

@bpowell let's discuss

@helenelau
Copy link
Contributor

@sanopsmx
Copy link
Contributor Author

sanopsmx commented Feb 27, 2020 via email

@plumpy
Copy link
Member

plumpy commented Mar 1, 2020

FYI, the security SIG meeting is actually on 3/5.

@helenelau
Copy link
Contributor

Yes thanks for catching it. @sanopsmx 03/05 it is.

@sanopsmx
Copy link
Contributor Author

sanopsmx commented Mar 3, 2020 via email

@helenelau
Copy link
Contributor

helenelau commented Mar 5, 2020 via email

@justinrlee
Copy link

Hi all. I've (internally) been working on a similar proposal, which has more of a higher-level goal discussion and less technical details - would be nice if I could get some feedback on this, and maybe somebody could work to combine the two proposals or something.

https://docs.google.com/document/d/15zlA80xCrkCn4L08YbrBDDPJsL--9lUlNeWooZy4Nk8/edit?usp=sharing=

@helenelau
Copy link
Contributor

@justinrlee please join our meeting at 11am pt ... meet.google.com/rhf-kyvh-dre @sanopsmx fyi

@justinrlee
Copy link

Hey @helenelau I was actually hoping to join but I have another prior engagement at that time. One of my coworkers will be joining to represent in my stead.

@robzienert
Copy link
Member

@helenelau Is there any update from the prior Security SIG here? Was this RFC discussed at all?

@sanopsmx
Copy link
Contributor Author

sanopsmx commented Mar 18, 2020 via email

@helenelau
Copy link
Contributor

@sanopsmx yes tomorrow at 11am pt ... @justinrlee fyi

@robzienert
Copy link
Member

@sanopsmx It looks like you moved the RFC template. Can you fix the PR so that the template is still there?

@sanopsmx sanopsmx closed this Jun 23, 2020
@sanopsmx
Copy link
Contributor Author

Raised a new pull request

@sanopsmx
Copy link
Contributor Author

created a new PR

#152

@sanopsmx
Copy link
Contributor Author

reopening this PR. Will update the PR.

@sanopsmx sanopsmx reopened this Jun 24, 2020
@sanopsmx
Copy link
Contributor Author

Updated the comments...Modified few testcases...incorporated the sig meeting feedback..

@helenelau
Copy link
Contributor

@bcornils fyi

@sanopsmx
Copy link
Contributor Author

Can you share the meeting invite. Is the meeting scheduled on Julu 23rd.

@bcornils
Copy link
Contributor

bcornils commented Jul 22, 2020 via email

@maggieneterval
Copy link
Contributor

@bcornils @sanopsmx Did the Security SIG accept this RFC? Wanted to check since the related Deck PR has been open for several weeks, which I am happy to help review, but wanted to check first to see if the Security SIG wanted further discussion on this proposal.

@helenelau
Copy link
Contributor

helenelau commented Aug 3, 2020 via email

@sanopsmx
Copy link
Contributor Author

sanopsmx commented Aug 4, 2020

@maggieneterval ...I gave the presentation to the sig meeting on July 23rd. Incorporated all the comments suggested in the earlier march meeting. I think, only merge is pending.

@maggieneterval
Copy link
Contributor

Thanks for the update, @sanopsmx. Should we update this RFC as accepted and change the SIG designation to Security? @helenelau @bcornils I've reviewed the Deck component of this change, but I'll leave it to y'all to identify an appropriate reviewer for the Orca component.

| **Status** | _**Proposed**, Accepted, Implemented, Obsolete_ |
| **RFC #** | https://github.com/spinnaker/deck/pull/8368 | https://github.com/spinnaker/orca/pull/3763
| **Author(s)** | Sanjeev Thatiparthi (@sanopsmx) (https://github.com/sanopsmx)
| **SIG / WG** | sig-ux
Copy link
Member

Choose a reason for hiding this comment

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

please update to sig-security

@link108
Copy link
Member

link108 commented Aug 14, 2020

I like the idea of this! I think the Orca PR needs some improvement, but I can give that feedback in the actual PR. One thing I did notice that is relevant to call out here - the PR checks for isTest, which is not noted in this design doc. At first glance, I don't like pushing that logic (checking if an environment is a test environment or not) into a manual judgement stage, but I could be convinced otherwise.

Copy link
Member

@robzienert robzienert left a comment

Choose a reason for hiding this comment

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

Approved with update to sig-security.

@sanopsmx
Copy link
Contributor Author

sanopsmx commented Oct 6, 2020

I like the idea of this! I think the Orca PR needs some improvement, but I can give that feedback in the actual PR. One thing I did notice that is relevant to call out here - the PR checks for isTest, which is not noted in this design doc. At first glance, I don't like pushing that logic (checking if an environment is a test environment or not) into a manual judgement stage, but I could be convinced otherwise.

I like the idea of this! I think the Orca PR needs some improvement, but I can give that feedback in the actual PR. One thing I did notice that is relevant to call out here - the PR checks for isTest, which is not noted in this design doc. At first glance, I don't like pushing that logic (checking if an environment is a test environment or not) into a manual judgement stage, but I could be convinced otherwise.

Removed 'isTest' flag according to the comments mentioned.

@sanopsmx sanopsmx closed this Oct 6, 2020
@sanopsmx sanopsmx reopened this Oct 6, 2020
@sanopsmx
Copy link
Contributor Author

sanopsmx commented Oct 6, 2020

Can you review this PR and merge.

Accommodated all the suggested changes in the sig-meeting.

@robzienert
Copy link
Member

robzienert commented Oct 23, 2020

@sanopsmx I will merge as soon as you un-delete the RFC template file and rename the RFC to manualjudgement.md (remove the leading dot from the filename).

@sanopsmx
Copy link
Contributor Author

Renamed the .manualJudgment.md to manualJudgment.md
Added .templated.md

@sanopsmx
Copy link
Contributor Author

@sanopsmx I will merge as soon as you un-delete the RFC template file and rename the RFC to manualjudgement.md (remove the leading dot from the filename).

Renamed the .manualJudgment.md to manualJudgment.md
Added .templated.md

@sanopsmx
Copy link
Contributor Author

@sanopsmx I will merge as soon as you un-delete the RFC template file and rename the RFC to manualjudgement.md (remove the leading dot from the filename).

@robzienert

Renamed the .manualJudgment.md to manualJudgment.md
Added .templated.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants