Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Bitbucket Server Urls validation by pattern match #761

Merged
merged 1 commit into from
Feb 12, 2025
Merged

Conversation

vinokurig
Copy link
Contributor

What does this PR do?

When we validate a Bitbucket Server url but neither oauth nor Personal Access Token is set up, we do a test Bitbucket Server Api request and if we get response with status 200 or 401 unauthorized, it means that the url is a Bitbucket Server url. The problem is that other unsupported git providers may also return such response on the test request. To make the check more specific, additionally test the url to match the Bitbucket Server url pattern.

Screenshot/screencast of this PR

What issues does this PR fix or reference?

fixes eclipse-che/che#23303

How to test this PR?

see eclipse-che/che#23303

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.

t -> {
String scheme = t.contains("git@") ? "ssh" : uri.getScheme();
String host = uri.getHost() + (uri.getPort() > 0 ? ":" + uri.getPort() : "");
patterns.add(Pattern.compile(format(t, scheme, host)));

Check failure

Code scanning / CodeQL

Regular expression injection High

This regular expression is constructed from a
user-provided value
.
@vinokurig
Copy link
Contributor Author

/retest

1 similar comment
@vinokurig
Copy link
Contributor Author

/retest

@artaleks9
Copy link
Contributor

/retest

Copy link

openshift-ci bot commented Feb 11, 2025

@vinokurig: The following test 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/v14-gitlab-with-oauth-setup-flow ec8344b link true /test v14-gitlab-with-oauth-setup-flow

Full PR test history. Your PR dashboard.

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.

@artaleks9
Copy link
Contributor

artaleks9 commented Feb 11, 2025

So...the gitlab-with-oauth-setup-flow failed due to the known issue (already closed):
eclipse-che/che#23323 which is still reproduced here.
For check this PR che-next was deployed using chectl -next:

chectl/0.0.20250205-next.826613d linux-x64

And che-code has the image with latest tag, which was built on the Jan 23 2025, and definitely doesn't have the fix:
https://quay.io/repository/che-incubator/che-code?tab=tags

che-next-che-code

@dmytro-ndp
Copy link
Contributor

@vinokurig , @artaleks9 : Eclipse Che Next with quay.io/eclipse/che-server@sha256:aa1eed8f02e62b505b792e1adda90538f7a9283a2ce0439ad40149c64d38a7c2 built from this PR as che-server has successfully started workspace from gogs server Git public repository.
Screencast: scrnli_XIUox0czZZ4HeM.webm

Copy link

openshift-ci bot commented Feb 11, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dmytro-ndp, tolusha, vinokurig

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

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

@vinokurig vinokurig merged commit e531c3c into main Feb 12, 2025
26 of 28 checks passed
@vinokurig vinokurig deleted the che-23303 branch February 12, 2025 07:49
@devspacesbuild
Copy link

Build 3.20 :: server_3.x/381: Console, Changes, Git Data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants