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

Do not encode access token for git-credentials secrets #745

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vinokurig
Copy link
Contributor

@vinokurig vinokurig commented Nov 20, 2024

What does this PR do?

Do not encode access token for git-credentials secrets

Screenshot/screencast of this PR

What issues does this PR fix or reference?

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

How to test this PR?

The fix resolves a problem that can not be reproduced permanently. Since the fix changes the oauth logic, we need to test all possible oauth related cases.

PR Checklist

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

Release Notes

This fix resolves a bug when project is not cloned if a personal access token, generated from bitbucket server, contains special characters.

Reviewers

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

Copy link

openshift-ci bot commented Nov 20, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 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

@@ -154,7 +152,7 @@ public void createOrReplace(PersonalAccessToken personalAccessToken)
"%s://%s:%s@%s%s",
scmUrl.getProtocol(),
getUsernameSegment(personalAccessToken),
URLEncoder.encode(personalAccessToken.getToken(), UTF_8),
personalAccessToken.getToken(),
Copy link
Contributor

Choose a reason for hiding this comment

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

We have to know why previously it was done in that way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was added a long time ago by @mshaposhnik, I don't think we can find the reason.

Copy link
Contributor

@mshaposhnik mshaposhnik Nov 20, 2024

Choose a reason for hiding this comment

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

Hey guys,
it was done so cuz sometimes tokens may contain symbols which are disallowed or bad to use in URL's (like @, :, # etc)
see https://serverfault.com/a/1001324

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @mshaposhnik for the explanation, looks like we would need to find a better solution

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.

3 participants