Skip to content

OTA-2025: Redact proxy URL credentials from AgenticRun readiness data - #1442

Open
jrangelramos wants to merge 1 commit into
openshift:mainfrom
jrangelramos:fix-proxy-credential-redaction
Open

OTA-2025: Redact proxy URL credentials from AgenticRun readiness data#1442
jrangelramos wants to merge 1 commit into
openshift:mainfrom
jrangelramos:fix-proxy-credential-redaction

Conversation

@jrangelramos

@jrangelramos jrangelramos commented Aug 10, 2026

Copy link
Copy Markdown
Member

Summary

  • Proxy URLs from the cluster Proxy CR may contain embedded credentials (user:password@host). The NetworkCheck readiness collector forwarded these unsanitized into the AgenticRun request sent to the LLM provider.
  • Added redactProxyURL() to strip the userinfo component via net/url.Parse before including proxy URLs in readiness output. Falls back to [configured] if parsing fails (fail-closed).
  • no_proxy is unchanged — it's a host list, not a URL.

Test plan

  • TestNetworkCheck_ProxyCredentialRedaction: credentials stripped, no-credentials passthrough, empty string
  • All 30 existing readiness tests pass with no regressions

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Proxy credentials are now removed from readiness results to prevent sensitive information from being exposed.
    • Invalid proxy URLs are displayed safely as [configured], while empty and credential-free values remain unchanged.
  • Tests

    • Added coverage for HTTP and HTTPS proxy credential redaction and edge cases.

@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 10, 2026
@openshift-ci-robot

openshift-ci-robot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

@jrangelramos: This pull request references OTA-2025 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 task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Proxy URLs from the cluster Proxy CR may contain embedded credentials (user:password@host). The NetworkCheck readiness collector forwarded these unsanitized into the AgenticRun request sent to the LLM provider.
  • Added redactProxyURL() to strip the userinfo component via net/url.Parse before including proxy URLs in readiness output. Falls back to [configured] if parsing fails (fail-closed).
  • no_proxy is unchanged — it's a host list, not a URL.

Test plan

  • TestNetworkCheck_ProxyCredentialRedaction: credentials stripped, no-credentials passthrough, empty string
  • All 30 existing readiness tests pass with no regressions

🤖 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 10, 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: 6712df75-23f4-4e11-a78e-7302633e995b

📥 Commits

Reviewing files that changed from the base of the PR and between 431c81a and 09cdec7.

📒 Files selected for processing (2)
  • pkg/readiness/checks_test.go
  • pkg/readiness/network.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/readiness/network.go
  • pkg/readiness/checks_test.go

Walkthrough

The network readiness check now removes proxy credentials from HTTP and HTTPS results. It preserves empty and credential-free values, marks invalid URLs as [configured], and adds table-driven tests for these cases.

Changes

Readiness proxy redaction

Layer / File(s) Summary
Sanitize and validate proxy values
pkg/readiness/network.go, pkg/readiness/checks_test.go
redactProxyURL preserves empty values, replaces invalid or hostless URLs with [configured], and removes userinfo from valid URLs. NetworkCheck.Run applies it to HTTP and HTTPS proxy results. Tests cover credentialed, credential-free, empty, and invalid proxy values.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 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 the main change: removing proxy URL credentials from AgenticRun readiness data.
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 adds a standard Go test with four static subtest names; it adds no Ginkgo title and includes no dynamic values in test names.
Test Structure And Quality ✅ Passed The change adds standard Go table-driven subtests, not Ginkgo; each case isolates a proxy behavior, uses only an in-memory fake client, has no cluster waits/resources, and reports expected values.
Microshift Test Compatibility ✅ Passed The PR adds a standard Go table-driven test using testing.T, not a new Ginkgo e2e test; MicroShift e2e API compatibility rules therefore do not apply.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The added test is a standard Go testing unit test using fake clients; it adds no Ginkgo e2e test or multi-node/SNO topology assumption.
Topology-Aware Scheduling Compatibility ✅ Passed The patch changes only proxy redaction in pkg/readiness/network.go and adds tests; it introduces no deployment, controller, manifest, replica, affinity, taint, or node-selection constraints.
Ote Binary Stdout Contract ✅ Passed The commit changes only readiness code and tests; no added stdout or logging writes exist, and TestNetworkCheck_ProxyCredentialRedaction is an individual test case.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The added test is a standard Go unit test using testing.T and a fake dynamic client, not a Ginkgo e2e test; it performs no network or external connectivity.
No-Weak-Crypto ✅ Passed The commit adds only net/url parsing and proxy redaction; the complete patch contains no MD5, SHA1, DES, RC4, Blowfish, ECB, crypto, or secret-comparison logic.
Container-Privileges ✅ Passed The PR changes only Go code and tests. It adds no container or Kubernetes manifest changes and introduces no privilege settings.
No-Sensitive-Data-In-Logs ✅ Passed The change adds no logging. Proxy credentials are removed before readiness data is produced, and malformed proxy URLs return [configured].
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with 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.

Inline comments:
In `@pkg/readiness/checks_test.go`:
- Around line 742-746: Update the proxy redaction test around the https_proxy
assertion to always compare proxy["https_proxy"] with tt.wantHTTPS, including
empty expectations. Extend the test cases with the hostless proxy input
http:admin:s3cret@proxy.corp:8080 and expect [configured], preserving coverage
of fail-closed redaction.

In `@pkg/readiness/network.go`:
- Around line 81-86: Update the proxy URL sanitization flow after url.Parse and
before returning u.String() to validate that the parsed URL has both a scheme
and host; return "[configured]" when either is missing. Preserve removing u.User
before returning valid sanitized URLs.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro Plus

Run ID: c640fbe3-6a62-4dbc-a304-8f5b15936e70

📥 Commits

Reviewing files that changed from the base of the PR and between 97ee3b7 and 431c81a.

📒 Files selected for processing (2)
  • pkg/readiness/checks_test.go
  • pkg/readiness/network.go

Comment thread pkg/readiness/checks_test.go Outdated
Comment thread pkg/readiness/network.go
@jrangelramos
jrangelramos force-pushed the fix-proxy-credential-redaction branch 2 times, most recently from f0b656d to 8d4a5a1 Compare August 10, 2026 20:34

@ankitathomas ankitathomas left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

/lgtm

Proxy URLs from the cluster Proxy CR may contain embedded credentials
(user:password@host). These were forwarded unsanitized into the
AgenticRun request, which is sent to an LLM provider. Strip the
userinfo component before including proxy URLs in readiness output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jrangelramos
jrangelramos force-pushed the fix-proxy-credential-redaction branch from 8d4a5a1 to 09cdec7 Compare August 11, 2026 13:17

@ankitathomas ankitathomas left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 11, 2026
@openshift-ci

openshift-ci Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ankitathomas, jrangelramos
Once this PR has been reviewed and has the lgtm label, please assign pratikmahajan 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-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-agnostic-operator
/test e2e-agnostic-ovn
/test e2e-agnostic-ovn-techpreview-serial-1of3
/test e2e-agnostic-ovn-techpreview-serial-2of3
/test e2e-agnostic-ovn-techpreview-serial-3of3
/test e2e-agnostic-ovn-upgrade-into-change
/test e2e-agnostic-ovn-upgrade-out-of-change
/test e2e-aws-ovn-techpreview
/test e2e-hypershift
/test e2e-hypershift-conformance

@jrangelramos

Copy link
Copy Markdown
Member Author

/retest-required

@openshift-ci

openshift-ci Bot commented Aug 11, 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.

Comment thread pkg/readiness/network.go
"http_proxy": NestedString(proxy.Object, "spec", "httpProxy"),
"https_proxy": NestedString(proxy.Object, "spec", "httpsProxy"),
"http_proxy": redactProxyURL(NestedString(proxy.Object, "spec", "httpProxy")),
"https_proxy": redactProxyURL(NestedString(proxy.Object, "spec", "httpsProxy")),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems like a good time to revisit pkg/readiness/network.go as a whole (CC @harche). It currently has:

  • An SDN warning, but SDN is gone since 4.17, so... no point in a 5.0 CVO looking around for it, right?

  • Embedding the Proxy config in the output, but:

    agentic-skills$ git grep -i proxy origin/main -- cluster-update
    ...no hits...

So maybe we can just drop that whole check, like we dropped the CRD check in #1415?

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.

I agree.

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. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants