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

VSCODE-1050: PAT auth for hosted BitBucket(like for hosted Jira) #28

Conversation

bkaindl
Copy link
Contributor

@bkaindl bkaindl commented Dec 12, 2024

Re-submit of #22 because of the SLA issue

Like the API of Jira and Bitbucket, the API of Bitbucket supports Bearer Auth using PAT instead of Basic Auth:
https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html

A number of other customers have expressed a need for this feature, not just us (Cloud Software Group): We disallow the use of HTTP Basic Auth for security reasons for the Confluence, Jira and Bitbucket APIs of our self-hosted services. Instead, we require the use of Bearer Auth using a PAT by the users.

A background information for this is that, that your security policy requires 2FA or alternatively tokens, password authentication without a 2nd factor as implemented in HTTP Basic Authentication is prohibited by company security policy, and therefore HTTP Basic Authentication is prohibited.

Also, by security policy, passwords have to be changed frequently, so even without that prohibition, password authentication would be very cumbersome as frequent changes result in frequent breakdown of the Atlascode login in VS Code.

Right now, the Atlascloud plugin supports authenticating to Jira using PAT because of a requirement by a customer, but the same has not been extended to Bitbucket, it only supports using username/password (Basic Authentication).

curl -v --oauth2-bearer $PAT https:///rest/api/1.0/users/userslug?avatarSize=48

Bearer Authorization is already available in atlascode, but not yet enabled for Bitbucket, it just was requested for Jira and not for Bitbucket:
https://bitbucket.org/atlassianlabs/atlascode/issues/237/allow-saml-sso-as-authentication-method

All that remains for Atlascode is to allow Bearer Authorization for Bitbucket as well.

This is what this PR does. It adds the same option to alternatively use PAT auth for self-hosted Bitbucket like the Jira client of Atlascode already implements.

Like the API of Jira and Bitbucket, the API of Bitbucket supports Bearer
Auth using PAT instead of Basic Auth:
https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html

A number of other customers have expressed a need for this feature, not
just us (Cloud Software Group): We disallow the use of HTTP Basic Auth
for security reasons for the Confluence, Jira and Bitbucket APIs of our
self-hosted services. Instead, we require the use of Bearer Auth using a
PAT by the users.

A background information for this is that, that your security policy
requires 2FA or alternatively tokens, password authentication without a
2nd factor as implemented in HTTP Basic Authentication is prohibited by
company security policy, and therefore HTTP Basic Authentication is
prohibited.

Also, by security policy, passwords have to be changed frequently, so
even without that prohibition, password authentication would be very
cumbersome as frequent changes result in frequent breakdown of the
Atlascode login in VS Code.

Right now, the Atlascloud plugin supports authenticating to Jira using
PAT because of a requirement by a customer, but the same has not been
extended to Bitbucket, it only supports using username/password (Basic
Authentication).

curl -v --oauth2-bearer $PAT https://<self-hosted bitbucket server>/rest/api/1.0/users/userslug?avatarSize=48

Bearer Authorization is already available in atlascode, but not yet
enabled for Bitbucket, it just was requested for Jira and not for
Bitbucket:
https://bitbucket.org/atlassianlabs/atlascode/issues/237/allow-saml-sso-as-authentication-method

All that remains for Atlascode is to allow Bearer Authorization for Bitbucket as well.

This is what this PR does. It adds the same option to alternatively use
PAT auth for self-hosted Bitbucket like the Jira client of Atlascode
already implements.

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@gmx.de>
@sdzh-atlassian
Copy link
Member

Hi @bkaindl!

Thank you for resubmitting the PR - and once again, sorry for the trouble you experienced with CLA 🙏

The change itself looks good to me - let me get a second pair of eyes on it (per policy 😉) and we'll see if we can roll it into our new nightly pre-releases.

For @atlassian/axon - CI didn't run here:

  • To be proper, let's make sure the build doesn't break
  • TODO: set up build pipelines for PRs coming from forks?

Copy link
Collaborator

@bwieger-atlassian-com bwieger-atlassian-com left a comment

Choose a reason for hiding this comment

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

Some small changes requested

@bwieger-atlassian-com
Copy link
Collaborator

bwieger-atlassian-com commented Dec 17, 2024

Addressing comments in #41

@bwieger-atlassian-com
Copy link
Collaborator

Addressing comments in #43

Thanks again @bkaindl for raising these PRs!

bwieger-atlassian-com added a commit that referenced this pull request Dec 17, 2024
* Patch 1 (#42)

* VSCODE-1050: PAT auth for hosted BitBucket(like for hosted Jira)

Like the API of Jira and Bitbucket, the API of Bitbucket supports Bearer
Auth using PAT instead of Basic Auth:
https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html

A number of other customers have expressed a need for this feature, not
just us (Cloud Software Group): We disallow the use of HTTP Basic Auth
for security reasons for the Confluence, Jira and Bitbucket APIs of our
self-hosted services. Instead, we require the use of Bearer Auth using a
PAT by the users.

A background information for this is that, that your security policy
requires 2FA or alternatively tokens, password authentication without a
2nd factor as implemented in HTTP Basic Authentication is prohibited by
company security policy, and therefore HTTP Basic Authentication is
prohibited.

Also, by security policy, passwords have to be changed frequently, so
even without that prohibition, password authentication would be very
cumbersome as frequent changes result in frequent breakdown of the
Atlascode login in VS Code.

Right now, the Atlascloud plugin supports authenticating to Jira using
PAT because of a requirement by a customer, but the same has not been
extended to Bitbucket, it only supports using username/password (Basic
Authentication).

curl -v --oauth2-bearer $PAT https://<self-hosted bitbucket server>/rest/api/1.0/users/userslug?avatarSize=48

Bearer Authorization is already available in atlascode, but not yet
enabled for Bitbucket, it just was requested for Jira and not for
Bitbucket:
https://bitbucket.org/atlassianlabs/atlascode/issues/237/allow-saml-sso-as-authentication-method

All that remains for Atlascode is to allow Bearer Authorization for Bitbucket as well.

This is what this PR does. It adds the same option to alternatively use
PAT auth for self-hosted Bitbucket like the Jira client of Atlascode
already implements.

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@gmx.de>

* Update clientManager.ts

---------

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@gmx.de>
Co-authored-by: Bernhard Kaindl <bernhard.kaindl@gmx.de>

* lint

* update .vscodeignore to not include test files

---------

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@gmx.de>
Co-authored-by: Bernhard Kaindl <bernhard.kaindl@gmx.de>
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