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
Expand Up @@ -11,6 +11,10 @@ base_images:
name: "4.19"
namespace: origin
tag: operator-sdk
tls-scanner-tool:
name: tls-scanner
namespace: tls-scanner
tag: tls-scanner-tool
upi-installer:
name: "4.22"
namespace: ocp
Expand Down Expand Up @@ -424,6 +428,108 @@ tests:
requests:
cpu: 100m
workflow: openshift-e2e-azure-manual-oidc-workload-identity
- always_run: false
as: tls-scanner
optional: true
steps:
cluster_profile: openshift-org-aws
dependencies:
OO_BUNDLE: cert-manager-operator-bundle
env:
OO_INSTALL_MODE: AllNamespaces
OO_INSTALL_NAMESPACE: cert-manager-operator
OO_SECURITY_CONTEXT: restricted
SCAN_NAMESPACE: cert-manager-operator,cert-manager
SCANNER_CPU: "1"
SCANNER_MEMORY: 1Gi
TLS_13_ENABLE_TLS_ADHERENCE: "true"
TLS_13_TLS_ADHERENCE_POLICY: StrictAllComponents
test:
- as: deploy-operand
cli: latest
commands: |-
set -o errexit
set -o nounset
set -o pipefail

echo "Waiting for default cert-manager operand deployments..."
oc wait --for=create namespace/cert-manager --timeout=5m
oc wait --for=create -n cert-manager deployment/cert-manager --timeout=5m
oc wait --for=create -n cert-manager deployment/cert-manager-webhook --timeout=5m
oc wait --for=create -n cert-manager deployment/cert-manager-cainjector --timeout=5m
oc wait --for=condition=Available -n cert-manager deployment/cert-manager --timeout=5m
oc wait --for=condition=Available -n cert-manager deployment/cert-manager-webhook --timeout=5m
oc wait --for=condition=Available -n cert-manager deployment/cert-manager-cainjector --timeout=5m

echo "Enabling TrustManager feature gate via subscription..."
# operator-sdk run bundle creates a versioned Subscription name
# (e.g. cert-manager-operator-v1-20-0-sub), not a fixed cert-manager-operator.
# Match e2e getCertManagerOperatorSubscription: list and patch the one present.
SUB=$(oc -n cert-manager-operator get subscriptions.operators.coreos.com -o jsonpath='{.items[0].metadata.name}')
if [[ -z "${SUB}" ]]; then
echo "No Subscription found in cert-manager-operator namespace"
oc -n cert-manager-operator get subscriptions.operators.coreos.com -o yaml || true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: what is the use of the command here?

exit 1
fi
echo "Patching Subscription ${SUB} (preserve existing env, match e2e patchSubscriptionWithEnvVars)"
PATCH=$(oc -n cert-manager-operator get "subscription/${SUB}" -o json | python3 -c 'import json,sys; sub=json.load(sys.stdin); cfg=(sub.get("spec") or {}).get("config") or {}; env=[e for e in (cfg.get("env") or []) if e.get("name")!="UNSUPPORTED_ADDON_FEATURES"]; env.append({"name":"UNSUPPORTED_ADDON_FEATURES","value":"TrustManager=true"}); print(json.dumps({"spec":{"config":{"env":env}}}))')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: it's always to be generic, but here I think it is not required, instead we could just patch it, since the subscription is fesh created. No harm having it though.

oc -n cert-manager-operator patch "subscription/${SUB}" --type=merge -p "${PATCH}"

echo "Waiting for TrustManager feature gate on operator deployment env and rollout..."
FOUND=false
for _ in $(seq 1 60); do
ENV_VAL=$(oc -n cert-manager-operator get deploy/cert-manager-operator-controller-manager \
-o jsonpath='{range .spec.template.spec.containers[0].env[?(@.name=="UNSUPPORTED_ADDON_FEATURES")]}{.value}{end}' 2>/dev/null || true)
if [[ "${ENV_VAL}" == "TrustManager=true" ]]; then
echo "Found UNSUPPORTED_ADDON_FEATURES=${ENV_VAL} on operator deployment"
FOUND=true
break
fi
sleep 5
done
if [[ "${FOUND}" != "true" ]]; then
echo "Timed out waiting for UNSUPPORTED_ADDON_FEATURES=TrustManager=true on operator deployment"
oc -n cert-manager-operator get deploy/cert-manager-operator-controller-manager -o yaml || true
exit 1
fi
oc -n cert-manager-operator rollout status deployment/cert-manager-operator-controller-manager --timeout=5m

echo "Creating TrustManager CR (minimal, match e2e newTrustManagerCR)..."
oc apply -f - <<EOF
apiVersion: operator.openshift.io/v1alpha1
kind: TrustManager
metadata:
name: cluster
spec:
trustManagerConfig: {}
EOF

echo "Waiting for TrustManager Ready and trust-manager deployment..."
FOUND=false
for _ in $(seq 1 60); do
READY=$(oc get trustmanagers.operator.openshift.io cluster \
-o jsonpath='{.status.conditions[?(@.type=="Ready")].status}' 2>/dev/null || true)
if [[ "${READY}" == "True" ]]; then
echo "TrustManager CR is Ready"
FOUND=true
break
fi
sleep 5
done
if [[ "${FOUND}" != "true" ]]; then
echo "Timed out waiting for TrustManager Ready=True"
oc get trustmanagers.operator.openshift.io cluster -o yaml || true
exit 1
fi
oc wait --for=create -n cert-manager deployment/trust-manager --timeout=5m
oc wait --for=condition=Available -n cert-manager deployment/trust-manager --timeout=5m
from: src
resources:
requests:
cpu: 100m
- ref: tls-13
- ref: tls-scanner-run
Comment on lines +530 to +531

@coderabbitai coderabbitai Bot Jul 31, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

Do not use the scanner’s default privileged host mode without an explicit security decision.

This workflow does not set TLS_SCANNER_CLUSTER_LABEL. The shared tls-scanner-run step therefore uses its default host-mode path, which creates a pod with privileged: true, hostNetwork: true, hostPID: true, and runAsUser: 0. It also grants cluster-admin to the scanner service account. OO_SECURITY_CONTEXT: restricted only affects operator installation; it does not restrict this scanner pod. (raw.githubusercontent.com)

Use a supported restricted scanner mode for standard AWS clusters, or update the shared step before adding this workflow. If host mode is required, document and approve the exception.

#!/usr/bin/env bash
set -euo pipefail

fd -t f -g 'tls-scanner-run-ref.yaml' -g 'tls-scanner-run-commands.sh' \
  -x rg -n -C 4 \
  'TLS_SCANNER_CLUSTER_LABEL|privileged: true|hostNetwork|hostPID|runAsUser|cluster-admin|allowPrivilegeEscalation|runAsNonRoot|capabilities'

As per path instructions, this YAML review must flag privileged: true, hostPID, hostNetwork, and root execution.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@ci-operator/config/openshift/cert-manager-operator/openshift-cert-manager-operator-master.yaml`
around lines 468 - 469, The workflow references tls-scanner-run without
TLS_SCANNER_CLUSTER_LABEL, causing the scanner to use its privileged host-mode
configuration. Update this workflow to select a supported restricted scanner
mode for standard AWS clusters by configuring the required cluster label, or
remove the scanner reference until the shared step supports restricted
execution; do not enable host mode without documented approval.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you let us know, where are you suggesting the change to be made?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

fd -t f -g 'tls-scanner-run-ref.yaml' -g 'tls-scanner-run-commands.sh' \
  -x sh -c '
    echo "===== $1 ====="
    rg -n -C 5 "TLS_SCANNER_CLUSTER_LABEL|privileged: true|hostNetwork|hostPID|cluster-admin" "$1"
  ' sh {}

Length of output: 682


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

step_dir='ci-operator/step-registry/tls/scanner/run'

echo '===== files ====='
fd -t f . "$step_dir"

echo '===== relevant configuration ====='
fd -t f . "$step_dir" -x rg -n -C 5 \
  'TLS_SCANNER_CLUSTER_LABEL|privileged: true|hostNetwork|hostPID|cluster-admin|restricted'

Length of output: 7878


@bharath-b-rh, the workflow-local location is the env: block in ci-operator/config/openshift/cert-manager-operator/openshift-cert-manager-operator-master.yaml, next to SCAN_NAMESPACE.

For example, a HyperShift workflow would set:

env:
  TLS_SCANNER_CLUSTER_LABEL: guest

However, I verified the current tls-scanner-run step. This is not a valid fix for this standard AWS workflow:

  • The step accepts only management and guest.
  • Those values select HyperShift-specific kubeconfigs.
  • An empty value uses the default host-mode scanner.
  • The default host-mode scanner uses privileged, hostNetwork, and hostPID.

Therefore, this job cannot select a supported restricted mode only by editing its env: block. The valid options are:

  1. Document and obtain approval for the required host-mode exception, or
  2. Update the shared tls-scanner-run step to support restricted execution for standard AWS clusters before using it here.

I should have stated this limitation in the original comment.


🧠 Learnings used
Learnt from: dustman9000
Repo: openshift/release PR: 80929
File: ci-operator/config/openshift-online/rosa-e2e/openshift-online-rosa-e2e-main__ocm-fvt-rosa-hcp-production.yaml:31-39
Timestamp: 2026-06-24T02:25:16.245Z
Learning: In the openshift/release repo, when a PR makes structural changes to CI operator config (e.g., adding/renaming tests, changing the pre/post steps, or adding allow_best_effort_post_steps), require that the contributor regenerated the downstream Prow job definitions/metadata by running exactly: `make registry-metadata && make ci-operator-config && make jobs`. If the contributor confirms those commands were run successfully and the relevant CI checks passed, then treat the regeneration requirement as satisfied for review purposes.

You are interacting with an AI system.

workflow: optional-operators-ci-operator-sdk-aws
zz_generated_metadata:
branch: master
org: openshift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1382,6 +1382,96 @@ presubmits:
secret:
secretName: result-aggregator
trigger: (?m)^/test( | .* )images,?($|\s.*)
- agent: kubernetes
always_run: false
branches:
- ^master$
- ^master-
cluster: build10
context: ci/prow/tls-scanner
decorate: true
decoration_config:
sparse_checkout_files:
- .ci-operator.yaml
- images/ci/Dockerfile
- images/ci/Dockerfile.coverage
- images/ci/certmanager.Dockerfile
- images/ci/istiocsr.Dockerfile
- images/ci/trustmanager.Dockerfile
labels:
ci-operator.openshift.io/cloud: aws
ci-operator.openshift.io/cloud-cluster-profile: openshift-org-aws
ci.openshift.io/generator: prowgen
job-release: "4.22"
pj-rehearse.openshift.io/can-be-rehearsed: "true"
name: pull-ci-openshift-cert-manager-operator-master-tls-scanner
optional: true
rerun_command: /test tls-scanner
spec:
containers:
- args:
- --gcs-upload-secret=/secrets/gcs/service-account.json
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
- --lease-server-credentials-file=/etc/boskos/credentials
- --report-credentials-file=/etc/report/credentials
- --secret-dir=/secrets/ci-pull-credentials
- --target=tls-scanner
command:
- ci-operator
env:
- name: HTTP_SERVER_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
image: quay-proxy.ci.openshift.org/openshift/ci:ci_ci-operator_latest
imagePullPolicy: Always
name: ""
ports:
- containerPort: 8080
name: http
resources:
requests:
cpu: 10m
volumeMounts:
- mountPath: /etc/boskos
name: boskos
readOnly: true
- mountPath: /secrets/ci-pull-credentials
name: ci-pull-credentials
readOnly: true
- mountPath: /secrets/gcs
name: gcs-credentials
readOnly: true
- mountPath: /secrets/manifest-tool
name: manifest-tool-local-pusher
readOnly: true
- mountPath: /etc/pull-secret
name: pull-secret
readOnly: true
- mountPath: /etc/report
name: result-aggregator
readOnly: true
serviceAccountName: ci-operator
volumes:
- name: boskos
secret:
items:
- key: credentials
path: credentials
secretName: boskos-credentials
- name: ci-pull-credentials
secret:
secretName: ci-pull-credentials
- name: manifest-tool-local-pusher
secret:
secretName: manifest-tool-local-pusher
- name: pull-secret
secret:
secretName: registry-pull-credentials
- name: result-aggregator
secret:
secretName: result-aggregator
trigger: (?m)^/test( | .* )tls-scanner,?($|\s.*)
- agent: kubernetes
always_run: true
branches:
Expand Down