-
Suggestion
-
Resolution: Unresolved
-
None
Problem Definition
The archives on the Downloads page of the repo can be downloaded programmatically with basic authentication, as follows
curl -u BB_Username:BB_AppPassword https://bitbucket.org/<workspace-id>/<repo-slug>/get/1.0.zip -o 1.0.zip
However, this is not currently possible with a Repository access token. If someone is writing a script to download an archive, and that script can be accessed by other users as well, then their app password gets exposed to other users.
Suggested Solution
Support the download of repo archives using a Repository access token.
Workaround
A Git command can be used to clone the repo. If an archive of a certain tag or branch is needed, then the following command can be used to clone a specific tag or branch
git clone --depth 1 --branch <branch_or_tag> https://x-token-auth@bitbucket.org/<workspace-id>/<repo-slug>.git
<branch_or_tag> can be either a branch name or a tag name.
--depth 1 is optional. If we only need the source code, then it may not be useful to clone the whole history.
If only the source code files are needed and not the history, then the .git folder inside the repo can be deleted after the clone.
- relates to
-
BCLOUD-22513 Allow using RATs or WATs to a download repository archive
- Gathering Interest
-
BCLOUD-23289 Download repository archives in a Forge app
- Gathering Interest
Are credentials exposed if used in repository / workspace variables and referenced in the script with $PASSWORD?