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

Return empty credentials from bitbucket URL with username #466

Merged
merged 2 commits into from
Mar 17, 2023
Merged

Conversation

vinokurig
Copy link
Contributor

@vinokurig vinokurig commented Mar 16, 2023

What does this PR do?

Override the getCredentials() method in the BitbucketUrl class to intercept bitbucket URL with username e.g. https://user@bitbucket.org/eclipse/che. Return empty credentials for such urls.

Screenshot/screencast of this PR

What issues does this PR fix or reference?

https://issues.redhat.com/browse/CRW-4095

How to test this PR?

  1. Deploy Che with the test image: chectl server:deploy -p=minikube -i=quay.io/ivinokur/che-server:next
  2. Start a workspace from a public bitbucket URL e.g. https://ivinokur@bitbucket.org/ivinokur/public.git
  3. See: workspace starts successfully.

PR Checklist

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

Reviewers

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

Signed-off-by: Igor Vinokur <ivinokur@redhat.com>
@@ -147,6 +148,14 @@ public String getHostName() {
return "https://" + HOSTNAME;
}

@Override
public Optional<String> getCredentials() {
if (!isNullOrEmpty(username) && super.getUrl().getUserInfo().equals(username)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What if username is a PAT ?
How do we handle this case?

Copy link
Contributor Author

@vinokurig vinokurig Mar 16, 2023

Choose a reason for hiding this comment

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

PAT is not supposed to be here. We don't support repository URL with PAT but we do support devfile url with PAT. The devfile url e.g. https://<PAT>@bitbucket.org/ivinokur/public/raw/HEAD/devfile.yaml will not be handled by the BitbucketUrl because it doesn't meet the regex pattern rules. It is handled by the DefaultFactoryUrl which doesn't have this check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added a javadoc description

@vinokurig vinokurig merged commit 5a04496 into main Mar 17, 2023
@vinokurig vinokurig deleted the CRW-4095 branch March 17, 2023 11:24
@devstudio-release
Copy link

Build 3.6 :: server_3.x/139: Console, Changes, Git Data

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.6 :: server_3.x/139: SUCCESS

Upstream sync done; /DS_CI/sync-to-downstream_3.x/2755 triggered

@devstudio-release
Copy link

Build 3.6 :: update-digests_3.x/2528: Console, Changes, Git Data

@devstudio-release
Copy link

Build 3.6 :: update-digests_3.x/2528: UNSTABLE

No new images detected: nothing to do!

@nickboldt nickboldt added this to the 7.63 milestone Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants