镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

OCPBUGS-126610: Fix openshift_api_server_audit_log_path wrong namespace - #15146

Open
yashshree2002 wants to merge 1 commit into
ComplianceAsCode:masterfrom
yashshree2002:OCPBUGS-126610-openshift-api-server-audit-log-path
Open

yashshree2002 wants to merge 1 commit into
ComplianceAsCode:masterfrom
yashshree2002:OCPBUGS-126610-openshift-api-server-audit-log-path

Conversation

@yashshree2002

@yashshree2002 yashshree2002 commented Sep 26, 2026 •

Copy link
Copy Markdown

The rule text (description, OCIL, expected path) already talked about openshift-apiserver, but the check logic still pointed at openshift-kube-apiserver (copy-paste from the kube-apiserver rule).

So the scan:

Read kube-apiserver’s ConfigMap (audit-log-path = /var/log/kube-apiserver/audit.log)
Compared it to OpenShift API Server’s expected value (/var/log/openshift-apiserver/audit.log)
Always FAIL, even on a correctly configured cluster
Sibling rule api_server_audit_log_path (kube-apiserver) correctly PASSed. Same ConfigMap, different expected value → permanent false FAIL for this rule.

Correct API path:

default_api_path
Before: /api/v1/namespaces/openshift-kube-apiserver/configmaps/config
After: /api/v1/namespaces/openshift-apiserver/configmaps/config

This is the core OCPBUGS-126610 fix: inspect the OpenShift API Server ConfigMap.

Cluster setting warning
Before:

warnings:
    - general: |-
        {{{ openshift_cluster_setting("/api/v1/namespaces/openshift-apiserver/configmaps/config") | indent(8) }}}

After:

warnings:
- general: |-
    {{{ openshift_filtered_cluster_setting({custom_api_path: dump_path}) | indent(4) }}}

Expected result after fix
On a OCP cluster where:
oc get cm config -n openshift-apiserver -o json | jq -r '.data["config.yaml"]' | jq '.apiServerArguments["audit-log-path"]' → ["/var/log/openshift-apiserver/audit.log"]
ocp4-cis-openshift-api-server-audit-log-path should PASS instead of always FAIL.

File changed

applications/openshift/openshift-api-server/openshift_api_server_audit_log_path/rule.yml

The rule inspected openshift-kube-apiserver instead of openshift-apiserver,
causing a permanent false FAIL. Align the API path, Hypershift config, and
yamlfile_value check with the sibling openshift-apiserver audit rules.

Co-authored-by: Cursor <cursoragent@cursor.com>
@openshift-ci

openshift-ci Bot commented Sep 26, 2026

Copy link
Copy Markdown

Hi @yashshree2002. 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 /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.

Details

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-sigs/prow repository.

@openshift-ci openshift-ci Bot added the needs-ok-to-test Used by openshift-ci bot. label Sep 26, 2026
@macko1 macko1 added the OpenShift OpenShift product related. label Oct 2, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This datastream diff is auto generated by the check Compare DS/Generate Diff

Click here to see the full diff
New content has different text for rule 'xccdf_org.ssgproject.content_rule_openshift_api_server_audit_log_path'.
--- xccdf_org.ssgproject.content_rule_openshift_api_server_audit_log_path
+++ xccdf_org.ssgproject.content_rule_openshift_api_server_audit_log_path
@@ -17,7 +17,13 @@
 
 [warning]:
 This rule's check operates on the cluster configuration dump.
-Therefore, you need to use a tool that can query the OCP API, retrieve the /api/v1/namespaces/openshift-apiserver/configmaps/config API endpoint to the local /api/v1/namespaces/openshift-apiserver/configmaps/config file.
+Therefore, you need to use a tool that can query the OCP API, retrieve the following:
+{{if ne .hypershift_cluster "None"}}/api/v1/namespaces/{{.hypershift_namespace_prefix}}-{{.hypershift_cluster}}/configmaps/openshift-apiserver{{else}}/api/v1/namespaces/openshift-apiserver/configmaps/config{{end}}
+    API endpoint, filter with with the jq utility using the following filter
+    {{if ne .hypershift_cluster "None"}}.data."config.yaml"{{else}}.data."config.yaml" | fromjson{{end}}
+    and persist it to the local
+    /api/v1/namespaces/openshift-apiserver/configmaps/config#45ae2c88fe28d39a42f19e165a1612353224e9663eb369000e03c7efcd10ef59
+    file.
 
 [reference]:
 CIP-003-8 R6

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test Used by openshift-ci bot. OpenShift OpenShift product related.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants