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

OCP4: Filter out new 4.11 SCCs that allow capabilites in addition to the privileged SCC #8996

Merged
merged 1 commit into from
Jun 29, 2022

Conversation

jhrozek
Copy link
Collaborator

@jhrozek jhrozek commented Jun 20, 2022

Description:

OCP 4.11 adds several new SCCs whose allowedCapabilities are set. All of
their names end with -v2, so let's filter them out as well from the list
of SCCs we check.

Rationale:

We need to support OCP 4.11

For the failure, see https://storage.googleapis.com/origin-ci-test/pr-logs/pull/openshift_release/29623/rehearse-29623-pull-ci-ComplianceAsCode-content-master-e2e-aws-ocp4-moderate/1538803521816629248/build-log.txt

@github-actions
Copy link

Start a new ephemeral environment with changes proposed in this pull request:

Open in Gitpod

@jhrozek
Copy link
Collaborator Author

jhrozek commented Jun 20, 2022

/retest
tests timed out

@jhrozek
Copy link
Collaborator Author

jhrozek commented Jun 21, 2022

I brought up the failures to pull the must gather image from build05 on slack on forum-testplatform, someone is looking into it.

@@ -44,13 +44,13 @@ ocil: |-

warnings:
- general: |-
{{{ openshift_filtered_cluster_setting({'/apis/security.openshift.io/v1/securitycontextconstraints': '[.items[] | select(.metadata.name != "privileged")] | map(.allowedCapabilities == null)'}) | indent(4) }}}
{{{ openshift_filtered_cluster_setting({'/apis/security.openshift.io/v1/securitycontextconstraints': '[.items[] | select(.metadata.name != "privileged") | select(.metadata.name | test("^.*-v2$"; "") | not)] | map(.allowedCapabilities == null)'}) | indent(4) }}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we exclude all SCCs ending with v2, will it give false-positive result

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, that was one of the things I was considering. And you are right that v2 is too generic to use for a filter (what if someone has myapp-v2 SCC?).
We can filter out the names of the SCCs ourselves, but a chain of selects would be ugly. I'll try to come up with a regex instead that I can use in test.
Is there anything nicer we could use?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we chained all the SCC together using selects, we'd need to update that list each time it changed, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. I'm going to research if we can filter our "system" SCCs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The short answer is "no". The only suggested filter (by Standa on Slack) was to look at some of the openshift.io annotations. I'm unsure if those are available in older releases like 4.6, going to check this.

As a fallback, I would rather use a hardcoded list, because it's a "subtraction" from the available SCC, so if some new SCCs appear in a new release then the test will fail..

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately our SCC annotations are not super consistent, most system SCCs have include.release.openshift.io/self-managed-high-availability but not all (e.g. not hostmounter). Most have release.openshift.io/create-only but not all.

So in the end, I think we could add a list.

@Vincent056 do you know if we can use a variable in the JQ filter? If yes, then it would be nice to make the list of SCCs that are OK to allow capabilities as a variable that would default to those that we ship and the customers could add their own.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for that late reply, yes, I think we can use the variable in the JQ filter, you just need to create a variable and use it as {{.var_scc_exclude_name}}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you, let me work on that

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. @Vincent056 I have one more question, do we need to document the variable somehow?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, hold the review, I'm going to add the docs either way

@jhrozek jhrozek changed the title OCP4: Filter out SCCs that end with -v2 from the allowedCapabilities list OCP4: Filter out new 4.11 SCCs that allow capabilites in addition to the privileged SCC Jun 23, 2022
@jhrozek
Copy link
Collaborator Author

jhrozek commented Jun 23, 2022

/retest

1 similar comment
@jhrozek
Copy link
Collaborator Author

jhrozek commented Jun 23, 2022

/retest

@jhrozek
Copy link
Collaborator Author

jhrozek commented Jun 23, 2022

/test e2e-aws
slowly we're getting there

@openshift-ci
Copy link

openshift-ci bot commented Jun 23, 2022

@jhrozek: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test e2e-aws-ocp4-cis
  • /test e2e-aws-ocp4-cis-node
  • /test e2e-aws-ocp4-e8
  • /test e2e-aws-ocp4-high
  • /test e2e-aws-ocp4-high-node
  • /test e2e-aws-ocp4-moderate
  • /test e2e-aws-ocp4-moderate-node
  • /test e2e-aws-ocp4-pci-dss
  • /test e2e-aws-ocp4-pci-dss-node
  • /test e2e-aws-ocp4-stig
  • /test e2e-aws-ocp4-stig-node
  • /test e2e-aws-rhcos4-e8
  • /test e2e-aws-rhcos4-high
  • /test e2e-aws-rhcos4-moderate
  • /test images

Use /test all to run the following jobs that were automatically triggered:

  • pull-ci-ComplianceAsCode-content-master-e2e-aws-ocp4-cis
  • pull-ci-ComplianceAsCode-content-master-e2e-aws-ocp4-cis-node
  • pull-ci-ComplianceAsCode-content-master-e2e-aws-ocp4-e8
  • pull-ci-ComplianceAsCode-content-master-e2e-aws-ocp4-high
  • pull-ci-ComplianceAsCode-content-master-e2e-aws-ocp4-high-node
  • pull-ci-ComplianceAsCode-content-master-e2e-aws-ocp4-moderate
  • pull-ci-ComplianceAsCode-content-master-e2e-aws-ocp4-moderate-node
  • pull-ci-ComplianceAsCode-content-master-e2e-aws-ocp4-pci-dss
  • pull-ci-ComplianceAsCode-content-master-e2e-aws-ocp4-pci-dss-node
  • pull-ci-ComplianceAsCode-content-master-e2e-aws-ocp4-stig
  • pull-ci-ComplianceAsCode-content-master-e2e-aws-ocp4-stig-node
  • pull-ci-ComplianceAsCode-content-master-images

In response to this:

/test e2e-aws
slowly we're getting there

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.

@jhrozek
Copy link
Collaborator Author

jhrozek commented Jun 23, 2022

/retest

2 similar comments
@jhrozek
Copy link
Collaborator Author

jhrozek commented Jun 24, 2022

/retest

@jhrozek
Copy link
Collaborator Author

jhrozek commented Jun 24, 2022

/retest

@jhrozek
Copy link
Collaborator Author

jhrozek commented Jun 25, 2022

I think the two remaining errors are expected with this PR.
@rhmdnd @Vincent056 PTAL

…list

OCP 4.11 adds several new SCCs whose allowedCapabilities are set. All of
their names end with -v2, so let's filter them out as well from the list
of SCCs we check.
@codeclimate
Copy link

codeclimate bot commented Jun 28, 2022

Code Climate has analyzed commit 267bcd2 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 42.7% (0.0% change).

View more on Code Climate.

@jhrozek
Copy link
Collaborator Author

jhrozek commented Jun 28, 2022

/retest

@rhmdnd
Copy link
Collaborator

rhmdnd commented Jun 28, 2022

I think the changes look good. The Automatus CI is supposed to fail because we're adding a new check that doesn't have a test, but this will be tested in e2e CI, is that correct?

@jhrozek
Copy link
Collaborator Author

jhrozek commented Jun 29, 2022

I think the changes look good. The Automatus CI is supposed to fail because we're adding a new check that doesn't have a test, but this will be tested in e2e CI, is that correct?

Correct, the rule has an expected PASS manifest

@rhmdnd
Copy link
Collaborator

rhmdnd commented Jun 29, 2022

/lgtm

Copy link
Contributor

@Vincent056 Vincent056 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@Vincent056 Vincent056 merged commit d002814 into ComplianceAsCode:master Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants