Skip to content

HELM-520: Warn users about insecure HTTP Helm repository URLs and aut… - #16885

Draft
sowmya-sl wants to merge 1 commit into
openshift:mainfrom
sowmya-sl:add-http-warning
Draft

HELM-520: Warn users about insecure HTTP Helm repository URLs and aut…#16885
sowmya-sl wants to merge 1 commit into
openshift:mainfrom
sowmya-sl:add-http-warning

Conversation

@sowmya-sl

@sowmya-sl sowmya-sl commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

…o-upgrade to HTTPS

Show an inline warning when users enter an HTTP repository URL, alerting them that credentials may be exposed and content may be tampered with in transit. On submit, attempt to upgrade the URL to HTTPS by probing the server; fall back to HTTP if HTTPS is unavailable.

Analysis / Root cause:

Solution description:

Screenshots / screen recording:

Test setup:

Test cases:

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:

Reviewers and assignees:

Summary by CodeRabbit

  • New Features
    • Added an inline warning when Helm chart repository URLs use unencrypted HTTP.
    • When possible, automatically upgrades HTTP repository URLs to HTTPS before saving.
    • Warns that unencrypted connections may expose credentials or allow content tampering.
  • Bug Fixes
    • Keeps the original HTTP URL when HTTPS isn’t supported or the HTTPS check times out/fails.
  • Tests
    • Added coverage for HTTPS upgrade success, non-upgrade cases, failures, and timeout handling.

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

openshift-ci-robot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

@sowmya-sl: This pull request references HELM-520 which is a valid jira issue.

Details

In response to this:

…o-upgrade to HTTPS

Show an inline warning when users enter an HTTP repository URL, alerting them that credentials may be exposed and content may be tampered with in transit. On submit, attempt to upgrade the URL to HTTPS by probing the server; fall back to HTTP if HTTPS is unavailable.

Analysis / Root cause:

Solution description:

Screenshots / screen recording:

Test setup:

Test cases:

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:

Reviewers and assignees:

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.

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 30, 2026
@openshift-ci

openshift-ci Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci

openshift-ci Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sowmya-sl

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

The pull request process is described 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 added component/helm Related to helm-plugin kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The Helm chart repository form warns when an HTTP URL is entered and probes for a reachable HTTPS equivalent during submission. The HTTPS upgrade helper includes timeout and failure handling, with tests covering supported and unsupported inputs.

Changes

Helm repository HTTPS handling

Layer / File(s) Summary
HTTPS probe utility and validation
frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/helmchartrepository-create-utils.ts, frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/__tests__/*
Adds tryHttpsUpgrade, which performs a timed HTTPS HEAD probe and returns null for unsupported inputs or failed probes; tests cover success, failures, passthrough cases, and timeouts.
Form warning and submission integration
frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/CreateHelmChartRepositoryFormEditor.tsx, frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/CreateHelmChartRepository.tsx, frontend/packages/helm-plugin/locales/en/helm-plugin.json
Displays a translated warning for HTTP repository URLs and applies a successful HTTPS upgrade before creating or updating the HelmChartRepository resource.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant RepositoryForm
  participant CreateHelmChartRepository
  participant tryHttpsUpgrade
  participant KubernetesResource
  RepositoryForm->>CreateHelmChartRepository: Submit repository configuration
  CreateHelmChartRepository->>tryHttpsUpgrade: Probe HTTP URL
  tryHttpsUpgrade-->>CreateHelmChartRepository: HTTPS URL or null
  CreateHelmChartRepository->>KubernetesResource: Create or update repository
Loading
🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description only gives a short summary and leaves all required template sections essentially empty. Fill in Analysis/Root cause, Solution description, Test setup, Test cases, Browser conformance, Additional info, and Reviewers/assignees.
✅ Passed checks (14 passed)
Check name Status Explanation
Title check ✅ Passed The title is specific and matches the main change: HTTP Helm repo warnings and HTTPS auto-upgrade.
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 No Ginkgo tests were added; the new Jest titles are static and contain no dynamic names, suffixes, timestamps, or generated identifiers.
Test Structure And Quality ✅ Passed No Ginkgo tests were added; the PR adds Jest unit tests and repo search found no Ginkgo/Gomega usage in the changed helm-plugin files.
Microshift Test Compatibility ✅ Passed Only a Jest unit spec was added; no new Ginkgo e2e tests or MicroShift-unsupported OpenShift APIs/resources were introduced.
Single Node Openshift (Sno) Test Compatibility ✅ Passed Only UI/helper code and a Jest unit spec were added; no Ginkgo e2e tests or multi-node/SNO-sensitive assumptions appear in the diff.
Topology-Aware Scheduling Compatibility ✅ Passed Only Helm repo form/UI and URL probe helper changed; no manifests, controllers, replicas, node selectors, anti-affinity, or PDBs were added.
Ote Binary Stdout Contract ✅ Passed Touched files are frontend-only and contain no main/init/TestMain/suite setup or stdout writes, so the OTE stdout contract isn’t affected.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the only new test is a mocked Jest unit spec, with no IPv4-only or public-internet dependency.
No-Weak-Crypto ✅ Passed Touched code only adds HTTPS probing and HTTP warnings; searches found no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret comparisons.
Container-Privileges ✅ Passed The PR only touches frontend TS/JSON/test files; no container/K8s manifests or privileged/root securityContext settings were changed.
No-Sensitive-Data-In-Logs ✅ Passed No new console/logger calls or other logging in the touched HelmChartRepository code paths; sensitive values are not written to logs.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

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.

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
`@frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/helmchartrepository-create-utils.ts`:
- Around line 77-81: Normalize the HTTP scheme comparison case-insensitively so
tryHttpsUpgrade handles uppercase and mixed-case HTTP URLs while preserving the
existing HTTPS conversion behavior. Apply the same normalized check in
frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/CreateHelmChartRepositoryFormEditor.tsx
at lines 145-156 so warnings and upgrades remain consistent. Extend
frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/__tests__/helmchartrepository-create-utils-https-upgrade.spec.ts
at lines 26-39 with an uppercase-scheme test case.
- Around line 85-86: Update the HTTPS probe in the Helm chart repository upgrade
utility to upgrade only when the response is observably successful; avoid
treating opaque or resolved non-OK no-cors responses as success, otherwise
retain the original HTTP URL. In
frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/helmchartrepository-create-utils.ts:85-86,
adjust the fetch validation while preserving the persisted URL behavior in
CreateHelmChartRepository.tsx. In
frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/__tests__/helmchartrepository-create-utils-https-upgrade.spec.ts:10-24,
add resolved non-OK probe cases and assert that no HTTPS upgrade occurs.
🪄 Autofix (Beta)

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: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 9fee68d5-7901-448d-b146-febc0a18ca80

📥 Commits

Reviewing files that changed from the base of the PR and between 2390f86 and 60bbd46.

📒 Files selected for processing (5)
  • frontend/packages/helm-plugin/locales/en/helm-plugin.json
  • frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/CreateHelmChartRepository.tsx
  • frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/CreateHelmChartRepositoryFormEditor.tsx
  • frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/__tests__/helmchartrepository-create-utils-https-upgrade.spec.ts
  • frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/helmchartrepository-create-utils.ts

Comment on lines +77 to +81
export const tryHttpsUpgrade = async (httpUrl: string): Promise<string | null> => {
if (!httpUrl?.startsWith('http://')) {
return null;
}
const httpsUrl = httpUrl.replace(/^http:\/\//, 'https://');

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 | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

for f in \
  frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/helmchartrepository-create-utils.ts \
  frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/CreateHelmChartRepositoryFormEditor.tsx \
  frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/__tests__/helmchartrepository-create-utils-https-upgrade.spec.ts
do
  echo "### $f"
  wc -l "$f"
  echo
done

echo "### utils excerpt"
sed -n '1,180p' frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/helmchartrepository-create-utils.ts

echo "### form excerpt"
sed -n '120,190p' frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/CreateHelmChartRepositoryFormEditor.tsx

echo "### test excerpt"
sed -n '1,220p' frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/__tests__/helmchartrepository-create-utils-https-upgrade.spec.ts

Repository: openshift/console

Length of output: 9159


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
files = [
    Path('frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/helmchartrepository-create-utils.ts'),
    Path('frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/CreateHelmChartRepositoryFormEditor.tsx'),
    Path('frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/__tests__/helmchartrepository-create-utils-https-upgrade.spec.ts'),
]
for p in files:
    text = p.read_text()
    print(f"\n### {p}")
    for i, line in enumerate(text.splitlines(), 1):
        if 'tryHttpsUpgrade' in line or "startsWith('http://')" in line or 'Alert' in line or 'HTTP is unencrypted' in line or 'https-upgrade' in line:
            start = max(1, i-8)
            end = min(len(text.splitlines()), i+20)
            for j in range(start, end+1):
                print(f"{j:4}: {text.splitlines()[j-1]}")
            break
PY

Repository: openshift/console

Length of output: 3792


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n "startsWith\\('http://'\)|startsWith\\(\"http://\"\\)|tryHttpsUpgrade|HTTP is unencrypted" \
  frontend/packages/helm-plugin/src/components/forms/HelmChartRepository

Repository: openshift/console

Length of output: 3032


Normalize HTTP scheme checks

startsWith('http://') misses case variants like HTTP://repo.example, so both the warning and HTTPS upgrade path can be skipped. Reuse a normalized scheme check in helmchartrepository-create-utils.ts and CreateHelmChartRepositoryFormEditor.tsx, and add an uppercase-scheme test case.

📍 Affects 3 files
  • frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/helmchartrepository-create-utils.ts#L77-L81 (this comment)
  • frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/CreateHelmChartRepositoryFormEditor.tsx#L145-L156
  • frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/__tests__/helmchartrepository-create-utils-https-upgrade.spec.ts#L26-L39
🤖 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
`@frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/helmchartrepository-create-utils.ts`
around lines 77 - 81, Normalize the HTTP scheme comparison case-insensitively so
tryHttpsUpgrade handles uppercase and mixed-case HTTP URLs while preserving the
existing HTTPS conversion behavior. Apply the same normalized check in
frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/CreateHelmChartRepositoryFormEditor.tsx
at lines 145-156 so warnings and upgrades remain consistent. Extend
frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/__tests__/helmchartrepository-create-utils-https-upgrade.spec.ts
at lines 26-39 with an uppercase-scheme test case.

…o-upgrade to HTTPS

Show an inline warning when users enter an HTTP repository URL, alerting
them that credentials may be exposed and content may be tampered with in
transit. On submit, attempt to upgrade the URL to HTTPS by probing the
server; fall back to HTTP if HTTPS is unavailable.

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

@coderabbitai coderabbitai Bot left a comment

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.

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
`@frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/__tests__/helmchartrepository-create-utils-https-upgrade.spec.ts`:
- Around line 53-66: Move Jest timer cleanup for the “should return null when
fetch times out” test into an afterEach hook or a finally block so it always
executes, including when assertions fail. Remove the test-local
jest.useRealTimers() call after the assertions while preserving the existing
fake-timer setup and timeout assertions.

In
`@frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/CreateHelmChartRepository.tsx`:
- Around line 114-115: Validate that
HelmChartRepositoryRes.spec?.connectionConfig?.url is a string before passing it
to tryHttpsUpgrade in the submission flow. If it is missing or invalid, set the
form error through the existing error-handling path and stop processing; only
invoke tryHttpsUpgrade for a valid URL.
🪄 Autofix (Beta)

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: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 205dd47d-da6d-4d2c-b970-8addd4160abe

📥 Commits

Reviewing files that changed from the base of the PR and between 60bbd46 and d5e7cc7.

📒 Files selected for processing (5)
  • frontend/packages/helm-plugin/locales/en/helm-plugin.json
  • frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/CreateHelmChartRepository.tsx
  • frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/CreateHelmChartRepositoryFormEditor.tsx
  • frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/__tests__/helmchartrepository-create-utils-https-upgrade.spec.ts
  • frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/helmchartrepository-create-utils.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • frontend/packages/helm-plugin/locales/en/helm-plugin.json
  • frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/CreateHelmChartRepositoryFormEditor.tsx

Comment on lines +53 to +66
it('should return null when fetch times out', async () => {
global.fetch = jest.fn().mockImplementation(
(_url, options) =>
new Promise((_resolve, reject) => {
options.signal.addEventListener('abort', () => reject(new DOMException('Aborted')));
}),
);
jest.useFakeTimers();
const promise = tryHttpsUpgrade('http://slow-server.com/repo');
jest.advanceTimersByTime(3000);
const result = await promise;
expect(result).toBeNull();
jest.useRealTimers();
});

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.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Restore Jest timers in afterEach.

jest.useRealTimers() runs after the assertions, so a failure can leave fake timers installed and affect subsequent tests. Move timer cleanup into afterEach or a finally block.

🤖 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
`@frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/__tests__/helmchartrepository-create-utils-https-upgrade.spec.ts`
around lines 53 - 66, Move Jest timer cleanup for the “should return null when
fetch times out” test into an afterEach hook or a finally block so it always
executes, including when assertions fail. Remove the test-local
jest.useRealTimers() call after the assertions while preserving the existing
fake-timer setup and timeout assertions.

Comment on lines +114 to +115
const currentUrl = HelmChartRepositoryRes.spec?.connectionConfig?.url;
const upgradedUrl = await tryHttpsUpgrade(currentUrl);

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show file sizes and relevant excerpts with line numbers
wc -l frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/CreateHelmChartRepository.tsx
sed -n '1,220p' frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/CreateHelmChartRepository.tsx

printf '\n--- helper search ---\n'
rg -n "tryHttpsUpgrade|safeLoad|connectionConfig?.url|setStatus|resourceCall" frontend/packages/helm-plugin -S

Repository: openshift/console

Length of output: 14649


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the helper implementation and any related types if present
helper_file=$(rg -l "function tryHttpsUpgrade|const tryHttpsUpgrade|export .*tryHttpsUpgrade" frontend/packages/helm-plugin -S | head -n 1 || true)
printf 'helper_file=%s\n' "${helper_file:-<none>}"
if [ -n "${helper_file:-}" ]; then
  wc -l "$helper_file"
  sed -n '1,220p' "$helper_file"
fi

printf '\n--- type definitions search ---\n'
rg -n "type HelmChartRepositoryType|interface HelmChartRepositoryType|connectionConfig" frontend/packages/helm-plugin -S

Repository: openshift/console

Length of output: 9023


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# If the helper uses string operations, inspect for explicit guards
rg -n "startsWith\\(|typeof .*url|isString|URL\\(" frontend/packages/helm-plugin/src -S

Repository: openshift/console

Length of output: 2336


Validate spec.connectionConfig.url before tryHttpsUpgrade. safeLoad(values.yamlData) as HelmChartRepositoryType doesn’t enforce runtime shape, so a non-string URL can hit .startsWith() and abort submission before the form sets an error.

🤖 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
`@frontend/packages/helm-plugin/src/components/forms/HelmChartRepository/CreateHelmChartRepository.tsx`
around lines 114 - 115, Validate that
HelmChartRepositoryRes.spec?.connectionConfig?.url is a string before passing it
to tryHttpsUpgrade in the submission flow. If it is missing or invalid, set the
form error through the existing error-handling path and stop processing; only
invoke tryHttpsUpgrade for a valid URL.

Source: Path instructions

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/helm Related to helm-plugin do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants