-
Notifications
You must be signed in to change notification settings - Fork 905
feat: enable Terraform debug mode via deployment configuration #8260
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
Conversation
Should we: a) Only allow admins to run builds in debug mode? (That is, hide the "try in debug mode" button unless you're an admin - this would resolve the issue with not being able to get the deployment values.) |
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.
Change looks good to me mechanically, I just wonder if it's better to disable debug mode by default or only allow admins to use debug mode.
I think @johnstcn makes some good points. I would take it even further such that enable debug mode is per-provisioner (disabled by default). Another thought that comes to mind.. should the user even be allowed to see the build log from a debug-enabled build? I can foresee there being multiple knobs for this behavior. Like allow debug: never|admin|user. If set to admin, users shouldn't see the build log, etc. |
I'm working on this 👍
I would not like to increase the complexity of this PR as we have an issue to mitigate (disable unsafe logs). We can chat later about gaps we should address in the future. Here I would focus on enabling a global switch. |
Agreed, that's fair. 👍🏻 |
I refactored the PR considering the following statements:
|
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.
Looks good!
@@ -638,11 +646,19 @@ func (b *Builder) authorize(authFunc func(action rbac.Action, object rbac.Object | |||
} | |||
} | |||
|
|||
if b.logLevel != "" && !authFunc(rbac.ActionUpdate, template) { | |||
if b.logLevel != "" && !authFunc(rbac.ActionRead, rbac.ResourceDeploymentValues) { |
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.
Is this the de-facto way to check for admin? It feels like it'd be one of those things that might change in the future (esp. a read permission). Probably fine for now though.
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.
Yes, that's why I covered it on the workspace build level with tests for all crucial roles.
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.
👍
Related: #8248
This PR mitigates the security concern around the untrusted Terraform plugin: