-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix: Prevent any users from approving custom policy sets #5331
base: main
Are you sure you want to change the base?
Conversation
@bgalkows Amazing, thanks a lot for the contribution. Let me know if I can help in any way, so that this gets merged and released asap! |
…n .github/workflows/lint.yml (main) (runatlantis#5330) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Signed-off-by: Brett Galkowski <[email protected]>
Signed-off-by: Brett Galkowski <[email protected]>
Signed-off-by: Brett Galkowski <[email protected]>
Signed-off-by: Brett Galkowski <[email protected]>
Hey all, from what I can tell the failing unit test is erroring after it can't find Conftest installed in the GitHub runner environment. I see this matching error output in the logs: atlantis/server/controllers/events/events_controller_e2e_test.go Lines 1874 to 1886 in d99c66a
Would anyone be able to help resolve this? testing/Dockerfile does have commands to install Conftest. And @dimisjim, any input is appreciated if you're interested! Feel free to add commits or create your own PR if that's the easier |
@bgalkows Would this still fix the issue with approvals (should only mark the policy as approved if an owner approves it), even if the My conftest cmd looks like: |
@dimisjim The custom policy checks are intended for non-Conftest policy tooling, so i've never actually used a custom check which runs Conftest. If you're using Conftest and getting To answer your question though, yes - this change will fix any user being able to approve the custom policy check regardless of what the run step actually contains. |
actually The reason why I am using a custom policy, but still conftest is to include more than one input into the rego policy, basically following this example: https://www.runatlantis.io/docs/policy-checking#running-policy-check-against-terraform-source-code In my case it's not to test against terraform code directly but rather inject an input concerning multiple custom workflows, taken by a pre-workflow script. |
@jamengual , @X-Guardian , @nitrocode, @chenrui333 Could you help out? I would like to test this before merging. Is there any atlantis image I could use built from this PR? |
For your own container
This will create a container and upload it to your fork's ghcr and allow you to test that container e2e in your deployment. |
I can confirm that it works with my setup too, after forking the repo, basing it on v0.33.0 and cherry picking the changes of this branch 🚀 |
what
why
Currently, using custom policy tools with Atlantis inadvertently allows any user to successfully execute
atlantis approve_policies
on the policy checkPolicy set naming is used to map user permissions for who can approve what, and as a result all users are able to approve the default name which has no restrictions specified
For the small community of Atlantis folks leveraging Terraform policy tools other than the integrated Conftest, this change is extremely important
tests
references
Bugs:
Wish I'd seen these sooner! I contributed the custom policy check logic in
v0.26.0
- #3765