Skip to content

OTA-2108: restrict console plugin NetworkPolicy to openshift-console namespace - #1450

Open
jrangelramos wants to merge 1 commit into
openshift:mainfrom
jrangelramos:fix/OTA-2108-restrict-console-networkpolicy
Open

OTA-2108: restrict console plugin NetworkPolicy to openshift-console namespace#1450
jrangelramos wants to merge 1 commit into
openshift:mainfrom
jrangelramos:fix/OTA-2108-restrict-console-networkpolicy

Conversation

@jrangelramos

@jrangelramos jrangelramos commented Aug 19, 2026

Copy link
Copy Markdown
Member

Summary

  • The allow-console-ingress NetworkPolicy opened port 9001/TCP to any pod in the cluster,
    despite the annotation stating it allows ingress "from the console" only.
  • Added a from: namespaceSelector matching kubernetes.io/metadata.name: openshift-console
    to enforce least-privilege networking and align the policy with its stated intent.

Fixes https://redhat.atlassian.net/browse/OTA-2108

Test plan

  • Unit tests pass (gotestsum --packages="./pkg/agenticrun/..." — 49 tests)
  • Deploy to a test cluster and verify the console plugin remains accessible from the OpenShift console
  • Verify that pods in other namespaces can no longer reach port 9001

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Updated network access rules to allow incoming traffic only from the OpenShift Console namespace.
    • Continued allowing TCP traffic on port 9001.

…nsole namespace

The allow-console-ingress NetworkPolicy opened port 9001 to any pod in
the cluster. Restrict ingress to the openshift-console namespace using a
namespaceSelector, matching the annotation's stated intent and enforcing
least-privilege networking.

Fixes OTA-2108

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 19, 2026
@openshift-ci-robot

openshift-ci-robot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

@jrangelramos: This pull request references OTA-2108 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the weakness to target the "5.1.0" version, but no target version was set.

Details

In response to this:

Summary

  • The allow-console-ingress NetworkPolicy opened port 9001/TCP to any pod in the cluster,
    despite the annotation stating it allows ingress "from the console" only.
  • Added a from: namespaceSelector matching kubernetes.io/metadata.name: openshift-console
    to enforce least-privilege networking and align the policy with its stated intent.

Fixes https://redhat.atlassian.net/browse/OTA-2108

Test plan

  • Unit tests pass (gotestsum --packages="./pkg/agenticrun/..." — 49 tests)
  • Deploy to a test cluster and verify the console plugin remains accessible from the OpenShift console
  • Verify that pods in other namespaces can no longer reach port 9001

🤖 Generated with Claude Code

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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 29713747-056b-4336-8a72-184a51b325ec

📥 Commits

Reviewing files that changed from the base of the PR and between 208b01a and 93f82e6.

📒 Files selected for processing (1)
  • pkg/agenticrun/bindata/assets/networkpolicy-allow-console.yaml

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The NetworkPolicy now allows ingress only from the openshift-console namespace and retains TCP port 9001.

Changes

NetworkPolicy ingress restriction

Layer / File(s) Summary
Restrict console ingress
pkg/agenticrun/bindata/assets/networkpolicy-allow-console.yaml
The ingress rule selects the openshift-console namespace and retains TCP port 9001.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 93f82

This localized change restricts console plugin network access to the openshift-console namespace. No actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes restricting the console plugin NetworkPolicy to the openshift-console namespace.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The PR diff changes only a NetworkPolicy YAML file; it adds a namespaceSelector and changes no Ginkgo test titles or test files.
Test Structure And Quality ✅ Passed The commit changes only a NetworkPolicy YAML asset; it adds no Ginkgo tests or test code, so these test-quality requirements are not applicable.
Microshift Test Compatibility ✅ Passed The commit changes only a NetworkPolicy YAML asset and adds no Ginkgo e2e tests or test files, so MicroShift test compatibility is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The commit changes only one NetworkPolicy YAML file; the diff adds no Ginkgo e2e tests or test paths, so SNO compatibility criteria do not apply.
Topology-Aware Scheduling Compatibility ✅ Passed The commit changes only a NetworkPolicy ingress selector, adding the openshift-console namespace; it introduces no deployment scheduling constraints covered by this check.
Ote Binary Stdout Contract ✅ Passed The PR diff changes only a NetworkPolicy YAML file; it adds a namespaceSelector and introduces no process-level stdout writes.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The diff changes only a NetworkPolicy YAML file. It adds no Ginkgo e2e tests, IPv4 assumptions, or external connectivity requirements.
No-Weak-Crypto ✅ Passed The PR changes only NetworkPolicy YAML by adding an openshift-console namespace selector; no weak-crypto algorithm, custom crypto, or secret comparison is introduced.
Container-Privileges ✅ Passed The only change adds a namespaceSelector to NetworkPolicy ingress. It introduces no privileged, host namespace, SYS_ADMIN, root, or allowPrivilegeEscalation setting.
No-Sensitive-Data-In-Logs ✅ Passed The PR only adds a NetworkPolicy namespaceSelector; it introduces no logging or sensitive-data output, and the existing annotation contains no sensitive data.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@openshift-ci

openshift-ci Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jrangelramos
Once this PR has been reviewed and has the lgtm label, please assign davidhurta for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci

openshift-ci Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

@jrangelramos: all tests passed!

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

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

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants