-
Notifications
You must be signed in to change notification settings - Fork 685
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
OCPBUGS-31510: change the analysis to not include ImageStreamTag #11783
Conversation
Hi @prb112. Thanks for your PR. I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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. |
This datastream diff is auto generated by the check Click here to see the full diffNew content has different text for rule 'xccdf_org.ssgproject.content_rule_imagestream_sets_schedule'.
--- xccdf_org.ssgproject.content_rule_imagestream_sets_schedule
+++ xccdf_org.ssgproject.content_rule_imagestream_sets_schedule
@@ -22,9 +22,9 @@
Therefore, you need to use a tool that can query the OCP API, retrieve the following:
/apis/image.openshift.io/v1/imagestreams
API endpoint, filter with with the jq utility using the following filter
- [.items[]] | map(.spec.tags[]?.importPolicy.scheduled != true) | any
+ [.items[] | .spec.tags[]? | select(.from.kind != "ImageStreamTag") | (.importPolicy.scheduled != null and .importPolicy.scheduled != false)] | all
and persist it to the local
- /apis/image.openshift.io/v1/imagestreams#47d97a900e89c07d2fcec9092f067d294f3d90e7c02e37b073c60576a6fa602f
+ /apis/image.openshift.io/v1/imagestreams#fbe2637b570482a77a9b52dc0c9c94eeb918519c0b64368ffbf3acfa02fc166f
file.
[reference]:
OCIL for rule 'xccdf_org.ssgproject.content_rule_imagestream_sets_schedule' differs.
--- ocil:ssg-imagestream_sets_schedule_ocil:questionnaire:1
+++ ocil:ssg-imagestream_sets_schedule_ocil:questionnaire:1
@@ -1,8 +1,8 @@
To list all the imagestreams and identify which imagestream tags are
configured to periodically check for updates (imagePolicy = { scheduled: true }), run the following command:
-oc get imagestream --all-namespaces -o jsonpath='[.items[]] | map(.spec.tags[]?.importPolicy.scheduled != true) | any'
+oc get imagestreams -A -ojson | jq '.items[] | select(.spec.tags[]?.importPolicy.scheduled == true) | .metadata.name' | sort | uniq
Alternatively, to view a list of ImageStreams that do not schedule updates,
run:
-oc get imagestreams -A -ojson | jq '.items[] | select(.spec.tags[]?.importPolicy.scheduled != true) | .metadata.name' | sort | uniq
+oc get imagestreams -A -ojson | jq -r '.items[] | select(.spec.tags[]? | select(.from.kind != "ImageStreamTag" and (.importPolicy.scheduled == null or .importPolicy.scheduled == false))) | "\(.metadata.namespace),\(.metadata.name)"' | sort | uniq
Is it the case that imagestream is not configured to perform periodical updates?
|
🤖 A k8s content image for this PR is available at: Click here to see how to deploy itIf you alread have Compliance Operator deployed: Otherwise deploy the content and operator together by checking out ComplianceAsCode/compliance-operator and: |
/test |
@rhmdnd: The
Use
In response to this:
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. |
/test e2e-aws-ocp4-stig |
/retest |
Checked a prior run with PR 11593 - found the same failures for |
applications/openshift/registry/imagestream_sets_schedule/rule.yml
Outdated
Show resolved
Hide resolved
/hold for test |
Signed-off-by: Paul Bastide <pbastide@us.ibm.com>
Hey @Vincent056 - I've updated the command within the |
/retest |
Hi @xiaojiey have you had any updates on testing from your end? Thanks! Paul |
@prb112 I am not if there is an env issue or not. The first command in the instruction doesn't work as expected. Could you please help to check? Thanks.
|
@@ -42,22 +42,20 @@ ocil: |- | |||
<pre>oc get imagestream --all-namespaces -o jsonpath='{{{ jqfilter }}}'</pre> |
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.
can you update the command to
oc get imagestream --all-namespaces -o json | jq -r '{{{ jqfilter }}}'
Per the current command in the instruction, it will only display some non-meaning words:
% oc get imagestream --all-namespaces -o jsonpath='[.items[] | .spec.tags[]? | select(.from.kind != "ImageStreamTag") | (.importPolicy.scheduled != null and .importPolicy.scheduled != false)] | all'
[.items[] | .spec.tags[]? | select(.from.kind != "ImageStreamTag") | (.importPolicy.scheduled != null and .importPolicy.scheduled != false)] | all%
The command and output we expected is:
% oc get imagestream -A -o=json | jq -r '[.items[] | .spec.tags[]? | select(.from.kind != "ImageStreamTag") | (.importPolicy.scheduled != null and .importPolicy.scheduled != false)] | all'
false
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.
Hi @xiaojiey I think I follow you. That seems reasonable - however, it'll have to be hard coded. jsonpath does not support the filter above.
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.
This should be resolved @xiaojiey - Thank you for the diligence
Signed-off-by: Paul Bastide <pbastide@us.ibm.com>
verification pass with 4.16.0-0.nightly-2024-05-07-025557 + ghcr.io/complianceascode/k8scontent:11783. Details seen from the comment of the bug https://issues.redhat.com/browse/OCPBUGS-31510 |
Code Climate has analyzed commit fbc4a28 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 59.4% (0.0% change). View more on Code Climate. |
/unhold |
Hey @Vincent056 or @rhmdnd do you mind reviewing the PR? @xiaojiey has kindly tested. Thanks, Paul |
/ok-to-test |
/test e2e-aws-ocp4-stig |
/retest-required |
/retest |
3 similar comments
/retest |
/retest |
/retest |
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.
Thank you for the fix.
Skipping the Ansible hardening tests. |
Description:
ImageStreamTag is improperly considered with the rule.yaml
Rationale:
https://issues.redhat.com/browse/OCPBUGS-31510
Review Hints:
The logic changes are for rhcos4-disa-stig.