fix: Prevent any users from approving custom policy sets #5331
fix: Prevent any users from approving custom policy sets #5331bgalkows wants to merge 23 commits intorunatlantis:mainfrom
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 <bgalkows@uci.edu>
Signed-off-by: Brett Galkowski <bgalkows@uci.edu>
Signed-off-by: Brett Galkowski <bgalkows@uci.edu>
|
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 🚀 |
|
The policy check tests in |
When using custom policy checks, ensure we don't access inputPolicySets out of bounds when iterating over outputs. If there are more outputs than policy sets, fallback to 'Custom' as the policy set name. This prevents potential index out of range panics when the number of outputs exceeds the number of configured policy sets. Signed-off-by: Pepe Amengual <pepe.amengual@example.com> Signed-off-by: PePe Amengual <2208324+jamengual@users.noreply.github.com>
|
This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month. |
|
Waiting for this to be merged, much needed. 🙏 |
|
This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month. |
|
bump |
|
bump |
|
the test will need to pass for this pr to be merged. |
|
Can you check this one here please and let me know if this is fine in terms of tests additions and fixes? #5915 Thanks 🙏 |
|
This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month. |
|
This can now be closed as this one is merged: #5915 |
what
why
atlantis approve_policieson the policy checktests
references
v0.26.0- feat: Add option allowing usage of custom policy check tools #3765