-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[ui] Read-based checks for viewing templates and write-based checks for saving them #23458
[ui] Read-based checks for viewing templates and write-based checks for saving them #23458
Conversation
Ember Test Audit comparison
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
@@ -16,7 +16,7 @@ | |||
Paste or author HCL or JSON to submit to your cluster, or select from a list of templates. A plan will be requested before the job is submitted. You can also attach a job spec by uploading a job file or dragging & dropping a file to the editor. | |||
</p> | |||
|
|||
{{#if (can "write variable" path="*" namespace="*")}} | |||
{{#if (can "read variable" path="nomad/job-templates/*" namespace="*")}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first glance I thought this would get us into trouble, but the write
policy for Variables is a little different than it is for anything else:
Create or update Variables at this path. Includes the "list" capability but not the "read" or "destroy" capabilities.
👍
1d8936a
to
e05c580
Compare
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
This adds nuance to the ACL policy checks for a user to be able to see Job Templates (which are specifically-named Nomad Variables behind the scenes).
The way it works today has some specific checks in place:
submit-job
ACL capability, or a general"write"
policy.*
.I think the original intent here was to do up-front checks for full CRUD access, but this PR moves that access check a little downstream. Here, you'll see that the check to see the "Choose from template" button requires specifically
read variable
access (and I could be convinced to make itlist variables
, but that would make the subsequent page pretty useless), and thewrite variable
check is moved downstream to the "save as template" button, and to manually edit a given job template via the Management page.Here is a sample ACL policy to test with:
^--- the
submit-job
capability is in place, so the "Run Job" button will be present. Also, thenomad/job-templates/*
rule has bothread
andwrite
, which will show both a "Choose from template" and a "Save as template" button. Remove either read or write to see how buttons disappear accordingly.User has read and write, but not delete, variable capability:
User has
read variables
fornomad/job-templates/*
:User has
write variables
fornomad/job-templates/*
:Resolves #23438