Skip to content

b2: support authentication with new bucket restricted application keys - #8978

Merged
ncw merged 4 commits into
rclone:masterfrom
DianaNites:b2-api-versions
Nov 24, 2025
Merged

ncw merged 4 commits into
rclone:masterfrom
DianaNites:b2-api-versions

Conversation

@DianaNites

@DianaNites DianaNites commented Nov 18, 2025 •

Copy link
Copy Markdown
Contributor

What is the purpose of this change?

Backblaze has updated its b2_authorize_account API endpoint, newly created application keys are now "multi-bucket" keys, capable of being limited to multiple buckets.
These keys can only be used with the v4 endpoint,
not v1 which returns an HTTP 400.

This commit switches authorization to the v4 endpoint, and allows such keys to work with any one of the allowed buckets.

Without this change newly created application keys with even one bucket restriction no longer work. I discovered this when creating a new key with the backblaze cli tool restricted to one bucket which worked fine with rclone before, and now fails to authenticate.

With this change rclone now works with these newly created v4 keys and passes tests. No other endpoints needed to be changed.

Was the change discussed in an issue or in the forum before?

No

Checklist

  • I have read the contribution guidelines.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • I'm done, this Pull Request is ready for review :-)

@ncw ncw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is looking good - thank you for fixing this up :-)

I put one minor thing to fix inline.

Comment thread backend/b2/b2.go Resolved
Comment thread backend/b2/b2.go Resolved
Backblaze has updated its b2_authorize_account API endpoint,
newly created application keys are now "multi-bucket" keys,
capable of being limited to multiple buckets.
These keys can only be used with the v4 endpoint,
not v1 which returns an HTTP 400.

This commit switches authorization to the v4 endpoint, and
allowing such keys to work with any of the allowed buckets.
With multi-bucket keys, missing restricted buckets can be non-fatal.
@DianaNites

Copy link
Copy Markdown
Contributor Author

Rebased onto master

@ncw ncw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this looks perfect now - thank you :-)

I'll merge it once the CI goes green.

@ncw
ncw merged commit 3c40238 into rclone:master Nov 24, 2025
@ncw

ncw commented Nov 26, 2025

Copy link
Copy Markdown
Member

@DianaNites unfortunately this has broken the integration tests, eg

$ cd backend/b2
$ go test -v -run TestIntegration/FsMkdir/FsPutFiles/FsListDirRoot
=== RUN   TestIntegration
    fstests.go:438: Using remote "TestB2:"
=== RUN   TestIntegration/FsMkdir
=== RUN   TestIntegration/FsMkdir/FsPutFiles
=== RUN   TestIntegration/FsMkdir/FsPutFiles/FsListDirRoot
    fstests.go:1050: 
        	Error Trace:	/home/ncw/go/src/github.com/rclone/rclone/fstest/fstests/fstests.go:1050
        	Error:      	[]string{} does not contain "rclone-test-rokahir7fiya"
        	Test:       	TestIntegration/FsMkdir/FsPutFiles/FsListDirRoot
        	Messages:   	Remote leaf not found
--- FAIL: TestIntegration (6.98s)
    --- FAIL: TestIntegration/FsMkdir (5.58s)
        --- FAIL: TestIntegration/FsMkdir/FsPutFiles (4.32s)
            --- FAIL: TestIntegration/FsMkdir/FsPutFiles/FsListDirRoot (0.45s)
FAIL
exit status 1
FAIL	github.com/rclone/rclone/backend/b2	6.989s

Have you got time to investigate?

Thanks

(The integration tests run off a remote called TestB2 which has a full access key).

@DianaNites

Copy link
Copy Markdown
Contributor Author

I thought it passed on merge? I'll do my best to investigate soon

For my part i've been using my patch without issue across both old and new bucket-limited keys, so nothing immediately stands out

DianaNites added a commit to DianaNites/rclone that referenced this pull request Dec 2, 2025
Fixes previous pull request rclone#8978

An oversight meant that unrestricted API keys
never called b2_list_buckets,
meaning the root remote could not be listed.

The call is now made in the event there are no allowed buckets,
indicating an unrestricted API key

Fixes rclone#9007
ncw pushed a commit that referenced this pull request Dec 4, 2025
Fixes previous pull request #8978

An oversight meant that unrestricted API keys
never called b2_list_buckets,
meaning the root remote could not be listed.

The call is now made in the event there are no allowed buckets,
indicating an unrestricted API key

Fixes #9007
jzunigax2 pushed a commit to internxt/rclone that referenced this pull request Jan 21, 2026
Fixes previous pull request rclone#8978

An oversight meant that unrestricted API keys
never called b2_list_buckets,
meaning the root remote could not be listed.

The call is now made in the event there are no allowed buckets,
indicating an unrestricted API key

Fixes rclone#9007
jzunigax2 pushed a commit to internxt/rclone that referenced this pull request Jan 21, 2026
Fixes previous pull request rclone#8978

An oversight meant that unrestricted API keys
never called b2_list_buckets,
meaning the root remote could not be listed.

The call is now made in the event there are no allowed buckets,
indicating an unrestricted API key

Fixes rclone#9007
alimas7 added a commit to alimas7/rclone that referenced this pull request Feb 14, 2026
* b2: Fix listing root buckets with unrestricted API key

Fixes previous pull request rclone#8978

An oversight meant that unrestricted API keys
never called b2_list_buckets,
meaning the root remote could not be listed.

The call is now made in the event there are no allowed buckets,
indicating an unrestricted API key

Fixes rclone#9007

* Add vicerace to contributors

* Add Cliff Frey to contributors

* Add Vladislav Tropnikov to contributors

* Add Leo to contributors

* Add Johannes Rothe to contributors

* proxy: fix error handling in tests spotted by the linter

* build: adjust lint rules to exclude new errors from linter update

* fs/log: fix PID not included in JSON log output

  When using `--log-format pid,json`, the PID was not being added to the JSON log output. This fix adds PID support to JSON logging.

* configfile: add piped config support - fixes rclone#9012

* Add Tingsong Xu to contributors

* Add Jonas Tingeborn to contributors

* build: fix lint warning after linter upgrade

* log: fix backtrace not going to the --log-file rclone#9014

Before the log re-organisation in:

8d35303 log: add log rotation to --log-file

rclone would write any backtraces to the --log-file which was very
convenient for users.

This got accidentally disabled due to a typo which meant backtraces
started going to stderr even if --log-file was supplied.

This fixes the problem.

* Add Shade backend

* Add jhasse-shade to contributors

* s3: add more regions for Selectel

* Changelog updates from Version v1.72.1

* sync: fix error propagation in tests (rclone#9025)

This commit fixes the sync transform test IO errors by resetting the
error flag which stops subsequent tests failing.

* S3: Linode: updated endpoints to use ISO 3166-1 alpha-2 standard

ISO 3166-1 alpha-2 standard for countries and region short name in parentheses instead of separated by another comma

* docs: reflects the fact that pCloud supports ListR

* build: bump actions/cache from 4 to 5

Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@v4...v5)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* build: bump actions/upload-artifact from 5 to 6

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v5...v6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* build: bump actions/download-artifact from 6 to 7

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 6 to 7.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@v6...v7)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* docs: mention use of ListR feature in ls docs

* shade: Fix VFS test issues

* Add vyv03354 to contributors

* memory: add --memory-discard flag for speed testing - fixes rclone#9037

* pcloud: add support for real-time updates in mount

Co-authored-by: masrlinu <[email protected]>

* Add masrlinu to contributors

* serve s3: make errors in --s3-auth-key fatal - fixes rclone#9044

Previously if auth keys were provided without a comma then rclone
would only log an INFO message which could mean it went on to serve
without any auth.

The parsing for environment variables was changed in v1.70.0 to make
them work properly with multiple inputs. This means the input is
treated like a mini CSV file which works well except in this case when
the input has commas. This meant `user,auth` without quotes is treated
as two key pairs `user` and `quote`. The correct syntax is
`"user,auth"`. This updates the documentation accordingly.

* s3: fix Copy ignoring storage class

Co-authored-by: sys6101 <[email protected]>

* docs: fix headers hierarchy in mount docs

* docs: add cloudinary to readme

* Add vupn0712 to contributors

* Add darkdragon-001 to contributors

* Add sys6101 to contributors

* docs: update sponsor logos

* s3: add provider Bizfly Cloud Simple Storage

Co-authored-by: sys6101 <[email protected]>

* docs: update sponsors

* dircache: allow empty string as root parent id

This was causing an internal error with the drime backend which has the
root parent id as an empty string. This shouldn't affect anything else.

* lib/rest: add opts.MultipartContentType to explicitly set Content-Type of attachements

Before this the standard library set it to application/octet-stream for some reason

* Add Drime backend

Co-Authored-By: Nick Craig-Wood <[email protected]>

* sftp,ftp: add http proxy authentication support

This change supports the `http://user:pass@host:port` syntax for the
http_proxy setting.

* oracleobjectstorage, sftp: eliminate unnecessary heap allocation

Move the declaration location of variables to eliminate heap
allocation which may make rclone faster and reduce memory usage slightly.

Fixes rclone#9078

* log: fix systemd adding extra newline - fixes rclone#9086

This was broken in v1.71.0 as a typo.

* Add Nicolas Dessart to contributors

* Add Qingwei Li to contributors

* fstest: Make Copy mutation test work properly

Before this change it could miss a mutation if the Modtime was cached

* fstest: skip Copy mutation test with --sftp-copy-is-hardlink

* sftp: fix proxy initialisation

This was being done in NewFs instead of NewFsWithConnection like it
should have been which meant calls to NewFsWithConnection were not
initialising the proxy correctly.

* filen: add Filen backend - Fixes rclone#6728

* docs: update sponsor link

* rc: add operations/hashsumfile to sum a single file only

* uptobox: remove backend as service is no longer available

Uptobox was shutdown in September 2023 and does not appear to be
returning.

* docs: fix use of removed rem macro

* docs: fix typos in comments and messages

* docs: fix echo command syntax for password input

* filen: swap to blake3 hashes

* Add yy to contributors

* Add Marc-Philip to contributors

* docs: add faq entry about re-enabling old TLS ciphers

* docs: fix formatting

* mega: reverts TLS workaround

The workaround to include the obsolete cipher suite is no longer needed because storage endpoints now support TLS1.3.

* fs: fix bwlimit: use %d instead of %q for ints

Signed-off-by: Mikel Olasagasti Uranga <[email protected]>

* fs: fix bwlimit: correctly report minutes

Signed-off-by: Mikel Olasagasti Uranga <[email protected]>

* cmount: fix OpenBSD mount support.

this pulls in winfsp/cgofuse#100 to fix OpenBSD
mount support.

part of rclone#1727

* docs: fix googlephotos custom client_id instructions

The Google Photos custom client_id documentation was incomplete - it
only mentioned changing the scopes but did not mention that you need
to enable the "Photos Library API" instead of the "Google Drive API"
in step 3 of the referenced Google Drive instructions.

This fixes the documentation to clearly state both differences from
the Google Drive setup:
- Enable "Photos Library API" instead of "Google Drive API"
- Use the Google Photos specific scopes

Co-authored-by: hyusap <[email protected]>

* Add Mikel Olasagasti Uranga to contributors

* Add Nick Owens to contributors

* Add hyusap to contributors

* protondrive: update to use forks of upstream modules

This updates rclone to use forks of the upstream proton drive modules
in preparation for making changes.

The go-proton-api modules has had changes from master merged so rclone
and Proton-API-Bridge are using the same version.

* docs: improve alignment of icons

* vfs: make mount tests run on OpenBSD

* cmount: make work under OpenBSD - fixes rclone#1727

* docs: fix WinFsp link in mount documentation

* onedrive: fix cancelling multipart upload

Before this change it was giving back "401 Unauthorized" however
removing the "Authorization: XXXX" from the request fixes the problem
as the auth is in the URL already.

* onedrive: fix setting modification time on directories for onedrive Personal

Onedrive Personal started ignoring the time parameters given to create
directory in the same way as onedrive Business.

* onedrive: Onedrive Personal no longer supports description

Uploading files with description set is no longer allowed with
Onedrive personal. This brings it into line with Onedrive business.

* onedrive: fix require sign in for Onedrive Personal

require_sign_in and regain_inherited_permissions in Onedrive Personal
have been brought into line with Onedrive Business.

* onedrive: fix permissions on onedrive Personal

* test_all: allow drime more time to complete

* drive: add --drive-metadata-force-expansive-access flag - Fixes rclone#8980

This allows the permissions changes happening in Feb 2026 to be tested
in advance.

* internxt: add Internxt backend - fixes rclone#7610

Co-Authored-By: lullius <[email protected]>
Co-Authored-By: StarHack <[email protected]>

* Add jzunigax2 to contributors

* Add lullius to contributors

* Add StarHack to contributors

* internxt: fix lint problems

* internxt: use rclone's http.Client to enable more features

e.g. --bwlimit, HTTP proxies, connection timeouts, --dump headers/bodies etc

* docs: add bin/manage_backends.py for managing the backend data files

* docs: add data about each backend in YAML format

* docs: add tiering to the documentation - fixes rclone#8873

* docs: build overview page from the backend data

* docs: update making a new backend docs

* docs: fix Internxt docs after merge

* internxt: remove use of CVE laden github.com/disintegration/imaging

* docs: add Internxt as a sponsor

* build: add privatebeta Makefile target

* test: allow backends to return fs.ErrorCantListRoot to skip Root tests

* azureblob,azurefiles: factor the common auth into a library

* drive: fix crash when trying to creating shortcut to a Google doc

Before this change, we uses an unguarded type assertion which failed
when NewObject returned a google document instead of an Object.

This change uses the ID() method to read the id which works for all
types of file instead and returns a sensible error if one isn't found.

Fixes rclone#8990

* Version v1.73.0

* Start v1.74.0-DEV development

* pikpak: support custom filenames for addurl backend command - fixes rclone#9111

Extended the addurl backend command to accept an optional filename parameter, 
enabling customized naming for downloaded files.

* filen: fix 32 bit targets not being able to list directories Fixes rclone#9142

or do pretty much anything,
this was caused by timestamps not being read to 64 bit integers

* filen: fix potential panic in case of error during upload

* s3: add Fastly Object Storage provider

- Add new Fastly provider with US East, US West, and EU Central regions
- Add `etag_is_not_md5` quirk for providers with mandatory encryption
- Disable server-side copy for Fastly (not supported)

* docs: update sponsor logos

* filelu: avoid buffering entire file in memory

Avoid buffering the entire file in memory during download, especially
for large files.

* filelu: add comment for response body wrapping

* filelu: add multipart init response type

* filelu: add multipart upload support with configurable cutoff

* Set list_version to 2 for FileLu S3 configuration

* build: bump github.com/go-chi/chi/v5 from 5.2.3 to 5.2.5 to fix GO-2026-4316

* drime: implement About

* s3: remove StackPath Object Storage provider

StackPath's object storage service no longer exists and all S3
endpoints are no longer operational.

Before this change, users could select StackPath as an S3 provider
during configuration, but connections would fail as the endpoints no
longer respond and the service has been discontinued.

After this change, StackPath is removed from the list of supported
S3 providers, preventing users from attempting to configure a
non-functional service.

Fixes rclone#9148

* Add Leon Brocard to contributors

* Add Cohinem to contributors

* docs: add ExchangeRate-API as a sponsor

* internxt: implement re-login under refresh logic, improve retry logic - fixes rclone#9174

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Mikel Olasagasti Uranga <[email protected]>
Co-authored-by: DianaNites <[email protected]>
Co-authored-by: Nick Craig-Wood <[email protected]>
Co-authored-by: Tingsong Xu <[email protected]>
Co-authored-by: Jonas Tingeborn <[email protected]>
Co-authored-by: jhasse-shade <[email protected]>
Co-authored-by: dougal <[email protected]>
Co-authored-by: jbagwell-akamai <[email protected]>
Co-authored-by: vyv03354 <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: masrlinu <[email protected]>
Co-authored-by: masrlinu <[email protected]>
Co-authored-by: vupn0712 <[email protected]>
Co-authored-by: sys6101 <[email protected]>
Co-authored-by: darkdragon-001 <[email protected]>
Co-authored-by: yuval-cloudinary <[email protected]>
Co-authored-by: dougal <[email protected]>
Co-authored-by: Nicolas Dessart <[email protected]>
Co-authored-by: Qingwei Li <[email protected]>
Co-authored-by: Enduriel <[email protected]>
Co-authored-by: yy <[email protected]>
Co-authored-by: Marc-Philip <[email protected]>
Co-authored-by: necaran <[email protected]>
Co-authored-by: Mikel Olasagasti Uranga <[email protected]>
Co-authored-by: Nick Owens <[email protected]>
Co-authored-by: hyusap <[email protected]>
Co-authored-by: albertony <[email protected]>
Co-authored-by: Duncan Smart <[email protected]>
Co-authored-by: jzunigax2 <[email protected]>
Co-authored-by: lullius <[email protected]>
Co-authored-by: StarHack <[email protected]>
Co-authored-by: wiserain <[email protected]>
Co-authored-by: Leon Brocard <[email protected]>
Co-authored-by: kingston125 <[email protected]>
Co-authored-by: Cohinem <[email protected]>
lafkpages pushed a commit to lafkpages/rclone that referenced this pull request Jul 20, 2026
Fixes previous pull request rclone#8978

An oversight meant that unrestricted API keys
never called b2_list_buckets,
meaning the root remote could not be listed.

The call is now made in the event there are no allowed buckets,
indicating an unrestricted API key

Fixes rclone#9007
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.

2 participants