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

Add policy to check for scratch images running privileged #779

Conversation

hbrueckner
Copy link

@hbrueckner hbrueckner commented Sep 1, 2022

The policy for scratch container images includes the check for RunAsNonRoot and does not consider the privileged setting in the container project. This PR is about to introduce a scratch container image policy to consider running privileged containers.

This PR arises from discussions on the RH support case 03250672 which triggered issue #766.

Testing the latest preflight (main branch) with issue #766 corrected, solved the parsing problem but introduced the RunAsNonRoot check again as part of the scratch policy. In preflight v1.4.0, the check has been skipped based on the project setting. This behavior might have been introduced by PR #776 which correctly detects scratch images.

Signed-off-by: Hendrik Brueckner brueckner@linux.ibm.com

@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 1, 2022
@openshift-ci
Copy link

openshift-ci bot commented Sep 1, 2022

Hi @hbrueckner. Thanks for your PR.

I'm waiting for a redhat-openshift-ecosystem member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@komish
Copy link
Contributor

komish commented Sep 1, 2022

/ok-to-test

Thanks @hbrueckner! I'll start tests here for now, I have a few nits I'll throw into a review soon.

@openshift-ci openshift-ci bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 1, 2022
cmd/check_container.go Outdated Show resolved Hide resolved
@acornett21
Copy link
Contributor

I don't think we have ever supported this use case, we'll check with the business to see if we should support it going forward.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 26, 2022
@openshift-ci
Copy link

openshift-ci bot commented Oct 26, 2022

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: hbrueckner
Once this PR has been reviewed and has the lgtm label, please assign skattoju for approval by writing /assign @skattoju in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 26, 2022
@acornett21
Copy link
Contributor

/ok-to-test

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 2, 2022
hbrueckner and others added 2 commits November 2, 2022 10:14
Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Scratch projects might run privileged and, thus, introduce a new
policy based on the scratch policy but without checking for
RunAsNonRoot.

Co-authored-by: Adam D. Cornett <adc@redhat.com>
Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 2, 2022
@acornett21
Copy link
Contributor

/ok-to-test

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 7, 2023
@openshift-merge-robot
Copy link

@hbrueckner: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@komish
Copy link
Contributor

komish commented Mar 21, 2023

We very much appreciate the contributions here, but we've not heard any confirmation from the Certification policy makers that this combination needs to be handled within Preflight. For now, we'll mark this closed. If the policy stance changes, we'll revisit then.

@komish komish closed this Mar 21, 2023
@hbrueckner
Copy link
Author

hbrueckner commented Dec 4, 2023

This PR could help to solve RH support ticket #03678508

cc: @jfrancin

@hbrueckner hbrueckner changed the title [RFC] Add policy to check for scratch images running privileged Add policy to check for scratch images running privileged Dec 4, 2023
@hbrueckner
Copy link
Author

/reopen

Rebased my branch to latest main: https://github.com/hbrueckner/openshift-preflight/tree/pr-scratch-privileged

Copy link

openshift-ci bot commented Dec 4, 2023

@hbrueckner: Failed to re-open PR: state cannot be changed. The pr-scratch-privileged branch was force-pushed or recreated.

In response to this:

/reopen

Rebased my branch to latest main: https://github.com/hbrueckner/openshift-preflight/tree/pr-scratch-privileged

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@jfrancin
Copy link
Contributor

jfrancin commented Dec 4, 2023

I'd absolutely like to see this moved forward. Preflight needs to properly handle the situation where a container is privileged but is also 'scratch'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants