Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
title: Ensure No Unsupported Configuration Overrides are Used

platform: not ocp4-on-hypershift-hosted

description: |-
Kubernetes API servers should not use unsupported configuration overrides that
can potentially compromise the security and stability of the cluster. This
rule checks that no unsupported configuration overrides are present in the
cluster API server configurations.

rationale: |-
Unsupported configuration overrides can introduce security vulnerabilities,
performance issues, and unexpected behaviors in the cluster. They bypass the
standard configuration mechanisms and can potentially weaken the cluster's
security posture or introduce instability.

severity: medium

identifiers:
cce@ocp4: CCE-89304-0

references:
cis@ocp4: 1.2.31

{{% set jqfilter = '[.items[] | select(.spec.unsupportedConfigOverrides != null and .spec.unsupportedConfigOverrides != {}) | .metadata.name]' %}}

ocil_clause: 'Unsupported Kubernetes API server configuration overrides are detected'

ocil: |-
Run the following commands to check for unsupported configuration overrides:
<pre>$ oc get kubeapiserver/cluster -o jsonpath='{.spec.unsupportedConfigOverrides}'</pre>
Verify that these commands return an empty object or no output.

warnings:
- general: |-
{{{ openshift_filtered_cluster_setting({'/apis/operator.openshift.io/v1/kubeapiservers': jqfilter}) | indent(4) }}}

template:
name: yamlfile_value
vars:
ocp_data: "true"
filepath: {{{ openshift_filtered_path('/apis/operator.openshift.io/v1/kubeapiservers', jqfilter) }}}
yamlpath: "[:]"
check_existence: "none_exist"
entity_check: "all"
values:
- value: "(.*?)"
operation: "pattern match"
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
title: Ensure No Unsupported Configuration Overrides are Used

platform: not ocp4-on-hypershift-hosted

description: |-
OpenShift API servers should not use unsupported configuration overrides that
can potentially compromise the security and stability of the cluster. This
rule checks that no unsupported configuration overrides are present in the
cluster API server configurations.

rationale: |-
Unsupported configuration overrides can introduce security vulnerabilities,
performance issues, and unexpected behaviors in the cluster. They bypass the
standard configuration mechanisms and can potentially weaken the cluster's
security posture or introduce instability.

severity: medium

identifiers:
cce@ocp4: CCE-89950-0

references:
cis@ocp4: 1.2.31

{{% set jqfilter = '[.items[] | select(.spec.unsupportedConfigOverrides != null and .spec.unsupportedConfigOverrides != {}) | .metadata.name]' %}}

ocil_clause: 'Unsupported OpenShift API server configuration overrides are detected'

ocil: |-
Run the following commands to check for unsupported configuration overrides:
<pre>$ oc get openshiftapiserver/cluster -o jsonpath='{.spec.unsupportedConfigOverrides}'</pre>
Verify that these commands return an empty object or no output.

warnings:
- general: |-
{{{ openshift_filtered_cluster_setting({'/apis/operator.openshift.io/v1/openshiftapiservers': jqfilter}) | indent(4) }}}

template:
name: yamlfile_value
vars:
ocp_data: "true"
filepath: {{{ openshift_filtered_path('/apis/operator.openshift.io/v1/openshiftapiservers', jqfilter) }}}
yamlpath: "[:]"
check_existence: "none_exist"
entity_check: "all"
values:
- value: "(.*?)"
operation: "pattern match"
4 changes: 3 additions & 1 deletion controls/cis_ocp/section-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,9 @@ controls:
- id: 1.2.33
title: Ensure unsupported configuration overrides are not used
status: pending
rules: []
rules:
- api_server_no_unsupported_config_overrides
- api_server_kube_no_unsupported_config_overrides
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Strange - these didn't get picked up in the OCP4 cis testing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Adding in the platform.

Copy link
Member

Choose a reason for hiding this comment

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

The rule still didn't show up in the test's artifacts.
Could it be that it is still not using the PR sources to build? Although I see the following in the logs:

2025/10/02 14:00:23 Using content image: registry.build09.ci.openshift.org/ci-op-pcld3z78/pipeline@sha256:4e75e0a42dd7be2834916360232767bee51f2b9d5af9f06b7e492c31c1ba0502

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 rule is getting build and put in the datastream, but it still doesn't seem to run in CI.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

@rhmdnd component doesn't seem to be used anywhere. Regardless, --content-image=$CONTENT_IMAGE seems correct.
From the logs:

+ go test . '-run=^TestPlatformCompliance$' -test-type=platform -content-image=registry.build11.ci.openshift.org/ci-op-mv6gph1y/pipeline@sha256:01d6114df7283f8cb722b017747c4de25eb5f42baa6d761eb34b6de17d0793f8 -content-directory=/go/src/github.com/ComplianceAsCode/content

Copy link
Member

Choose a reason for hiding this comment

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

This PR looks good to me, @rhmdnd
But would you like to use this PR as testing grounds to understand why it doesn't show up in the tests?

levels:
- level_1
- id: '1.3'
Expand Down
2 changes: 0 additions & 2 deletions shared/references/cce-redhat-avail.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,6 @@ CCE-89293-5
CCE-89294-3
CCE-89295-0
CCE-89303-2
CCE-89304-0
CCE-89305-7
CCE-89308-1
CCE-89310-7
Expand Down Expand Up @@ -1986,7 +1985,6 @@ CCE-89943-5
CCE-89946-8
CCE-89948-4
CCE-89949-2
CCE-89950-0
CCE-89951-8
CCE-89953-4
CCE-89954-2
Expand Down
Loading