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,37 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
annotations:
include.release.openshift.io/self-managed-high-availability: "true"
include.release.openshift.io/single-node-developer: "true"
name: config-operator-networkpolicy
namespace: openshift-config-operator
spec:
podSelector:
matchLabels:
app: openshift-config-operator
policyTypes:
- Ingress
- Egress
ingress:
# allow metrics scraping from anywhere
- ports:
- protocol: TCP
port: 8443
egress:
# allow egress to DNS
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: openshift-dns
podSelector:
matchLabels:
dns.operator.openshift.io/daemonset-dns: default
ports:
- protocol: TCP
port: 5353
- protocol: UDP
port: 5353
# allow all egress traffic
# required for egress to kube-apiserver pods
- {}
Comment on lines +35 to +37
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

egress: - {} makes egress effectively unrestricted for config-operator pods.

This rule allows all protocols/ports to all destinations, which defeats egress isolation for this workload. If the intent is hostNetwork kube-apiserver reachability, scope this to TCP at minimum.

Proposed tightening
-  # allow all egress traffic
-  # required for egress to kube-apiserver pods
-  - {}
+  # allow TCP egress (required for kube-apiserver hostNetwork connectivity)
+  - ports:
+    - protocol: TCP
As per coding guidelines, "-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# allow all egress traffic
# required for egress to kube-apiserver pods
- {}
# allow TCP egress (required for kube-apiserver hostNetwork connectivity)
- ports:
- protocol: TCP
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@manifests/0000_10_config-operator_00_networkpolicy_config-operator.yaml`
around lines 35 - 37, The NetworkPolicy egress rule "egress: - {}" for the
config-operator pods is overly permissive; replace this catch-all with a scoped
egress rule that limits protocol/ports and destinations (e.g., TCP only to the
kube-apiserver port/IP) so egress isolation is preserved: update the
NetworkPolicy resource where "egress: - {}" appears to allow only TCP to the
kube-apiserver port(s) (typically 443/6443) and/or the specific hostNetwork
CIDRs or podSelector for kube-apiserver, rather than permitting all protocols
and destinations.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
annotations:
include.release.openshift.io/self-managed-high-availability: "true"
include.release.openshift.io/single-node-developer: "true"
name: default-deny-all
namespace: openshift-config-operator
spec:
podSelector: {}
policyTypes:
- Ingress
- Egress
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
annotations:
include.release.openshift.io/self-managed-high-availability: "true"
include.release.openshift.io/single-node-developer: "true"
name: default-deny-all
namespace: openshift-config-managed
spec:
podSelector: {}
policyTypes:
- Ingress
- Egress
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
annotations:
include.release.openshift.io/self-managed-high-availability: "true"
include.release.openshift.io/single-node-developer: "true"
name: default-deny-all
namespace: openshift-config
spec:
podSelector: {}
policyTypes:
- Ingress
- Egress