Skip to content

Conversation

@olexii4
Copy link
Contributor

@olexii4 olexii4 commented Feb 2, 2026

What does this PR do?

This change adds IPv6 support in Eclipse Che Server to enable operation in IPv6-only network environments. As Kubernetes platforms (particularly OpenShift Container Platform 4.20) migrate to IPv6, the factory resolver must handle IPv6 addresses correctly in URLs and API calls.

The implementation involved minimal, focused changes to URL validation patterns and server URL extraction, enabling full IPv6 support while maintaining complete backward compatibility with IPv4-only and dual-stack environments.

Background:

The Eclipse Che factory resolver previously failed to operate with IPv6 git server URLs due to:

  1. URL Validation Issues: Regular expressions rejected IPv6 bracket notation (e.g., http://[::1]:8080)
  2. Manual String Parsing: getServerUrl() methods used pattern matching that didn't account for IPv6 brackets
  3. Regex Escaping: Host strings from IPv6 URLs were inserted into regex patterns without properly escaping the bracket characters

IPv6 Bracket Notation:

IPv6 addresses in URLs require square brackets to distinguish the address from port numbers:

  • ✅ Correct: http://[2001:db8::1]:8080/repo.git
  • ❌ Incorrect: http://2001:db8::1:8080/repo.git (ambiguous)

Changes:

  1. AbstractGitlabUrlParser:

    • Fixed constructor to use URI.getHost() instead of manual substring extraction
    • Added IPv6 bracket escaping in getPatternMatcherByUrl()
    • Updated getServerUrl() to use URI parsing for IPv6 support
  2. AbstractGithubURLParser:

    • Added IPv6 bracket escaping in getPatternMatcherByUrl()
    • Updated getServerUrl() to use URI parsing for IPv6 support
  3. AzureDevOpsURLParser:

    • Added IPv6 bracket escaping in getPatternMatcherByUrl()
    • Updated getServerUrl() to use URI parsing for IPv6 support

Technical Details:

Java's URI.getHost() returns IPv6 addresses WITH brackets (e.g., "[2001:db8::1]"). When constructing regex patterns, these brackets must be escaped as \[ and \] because they are special regex characters. The fix uses:

  • Pattern.quote() to escape the IPv6 address (without brackets)
  • Manual escaping of the brackets themselves

Screenshot/screencast of this PR

What issues does this PR fix or reference?

fixes: eclipse-che/che#23674

How to test this PR?

PR Checklist

As the author of this Pull Request I made sure that:

Release Notes

Reviewers

Reviewers, please comment how you tested the PR when approving it.

This change adds IPv6 support in Eclipse Che Server to enable operation
in IPv6-only network environments. As Kubernetes platforms (particularly
OpenShift Container Platform 4.20) migrate to IPv6, the factory resolver
must handle IPv6 addresses correctly in URLs and API calls.

The implementation involved minimal, focused changes to URL validation
patterns and server URL extraction, enabling full IPv6 support while
maintaining complete backward compatibility with IPv4-only and dual-stack
environments.

Background:
-----------
The Eclipse Che factory resolver previously failed to operate with IPv6
git server URLs due to:

1. URL Validation Issues: Regular expressions rejected IPv6 bracket
   notation (e.g., `http://[::1]:8080`)
2. Manual String Parsing: getServerUrl() methods used pattern matching
   that didn't account for IPv6 brackets
3. Regex Escaping: Host strings from IPv6 URLs were inserted into regex
   patterns without properly escaping the bracket characters

IPv6 Bracket Notation:
----------------------
IPv6 addresses in URLs require square brackets to distinguish the
address from port numbers:
- ✅ Correct: `http://[2001:db8::1]:8080/repo.git`
- ❌ Incorrect: `http://2001:db8::1:8080/repo.git` (ambiguous)

Changes:
--------
1. AbstractGitlabUrlParser:
   - Fixed constructor to use URI.getHost() instead of manual substring
     extraction
   - Added IPv6 bracket escaping in getPatternMatcherByUrl()
   - Updated getServerUrl() to use URI parsing for IPv6 support

2. AbstractGithubURLParser:
   - Added IPv6 bracket escaping in getPatternMatcherByUrl()
   - Updated getServerUrl() to use URI parsing for IPv6 support

3. AzureDevOpsURLParser:
   - Added IPv6 bracket escaping in getPatternMatcherByUrl()
   - Updated getServerUrl() to use URI parsing for IPv6 support

Technical Details:
------------------
Java's URI.getHost() returns IPv6 addresses WITH brackets (e.g.,
"[2001:db8::1]"). When constructing regex patterns, these brackets
must be escaped as `\[` and `\]` because they are special regex
characters. The fix uses:
- Pattern.quote() to escape the IPv6 address (without brackets)
- Manual escaping of the brackets themselves

Fixes: eclipse-che/che#23674

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Oleksii Orel <oorel@redhat.com>
@olexii4 olexii4 removed the request for review from vinokurig February 2, 2026 14:35
@openshift-ci
Copy link

openshift-ci bot commented Feb 2, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: olexii4

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
Copy link

openshift-ci bot commented Feb 2, 2026

@olexii4: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/v19-azure-no-pat-oauth-flow-ssh-url 0aa27e1 link true /test v19-azure-no-pat-oauth-flow-ssh-url
ci/prow/v19-bitbucket-no-pat-oauth-flow-ssh-url 0aa27e1 link true /test v19-bitbucket-no-pat-oauth-flow-ssh-url
ci/prow/v19-azure-no-pat-oauth-flow-raw-devfile-url 0aa27e1 link true /test v19-azure-no-pat-oauth-flow-raw-devfile-url
ci/prow/v19-gitlab-no-pat-oauth-flow-raw-devfile-url 0aa27e1 link true /test v19-gitlab-no-pat-oauth-flow-raw-devfile-url
ci/prow/v19-bitbucket-no-pat-oauth-flow-raw-devfile-url 0aa27e1 link true /test v19-bitbucket-no-pat-oauth-flow-raw-devfile-url
ci/prow/v19-gitlab-with-pat-setup-flow 0aa27e1 link true /test v19-gitlab-with-pat-setup-flow
ci/prow/v19-gitea-no-pat-oauth-flow 0aa27e1 link true /test v19-gitea-no-pat-oauth-flow
ci/prow/v19-github-no-pat-oauth-flow-raw-devfile-url 0aa27e1 link true /test v19-github-no-pat-oauth-flow-raw-devfile-url
ci/prow/v19-azure-no-pat-oauth-flow 0aa27e1 link true /test v19-azure-no-pat-oauth-flow
ci/prow/v19-github-no-pat-oauth-flow-ssh-url 0aa27e1 link true /test v19-github-no-pat-oauth-flow-ssh-url
ci/prow/v19-github-with-pat-setup-flow 0aa27e1 link true /test v19-github-with-pat-setup-flow
ci/prow/v19-azure-with-pat-setup-flow 0aa27e1 link true /test v19-azure-with-pat-setup-flow
ci/prow/v19-github-no-pat-oauth-flow 0aa27e1 link true /test v19-github-no-pat-oauth-flow
ci/prow/v19-gitlab-no-pat-oauth-flow 0aa27e1 link true /test v19-gitlab-no-pat-oauth-flow
ci/prow/v19-che-smoke-test 0aa27e1 link true /test v19-che-smoke-test
ci/prow/v19-gitlab-with-oauth-setup-flow 0aa27e1 link true /test v19-gitlab-with-oauth-setup-flow
ci/prow/v19-gitlab-no-pat-oauth-flow-ssh-url 0aa27e1 link true /test v19-gitlab-no-pat-oauth-flow-ssh-url
ci/prow/v19-gitea-with-pat-setup-flow 0aa27e1 link true /test v19-gitea-with-pat-setup-flow
ci/prow/v19-bitbucket-no-pat-oauth-flow 0aa27e1 link true /test v19-bitbucket-no-pat-oauth-flow

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add IPv6 Support to the User Dashboard

2 participants