Skip to content

Add per-block verification token support for uploads#7

Open
pwnorbitals wants to merge 1 commit intorclone:masterfrom
pwnorbitals:fix/upload-verification-token
Open

Add per-block verification token support for uploads#7
pwnorbitals wants to merge 1 commit intorclone:masterfrom
pwnorbitals:fix/upload-verification-token

Conversation

@pwnorbitals
Copy link
Copy Markdown

Summary

  • Proton's storage API now requires a per-block verification token when uploading file blocks. Without it, all uploads fail with HTTP 422 (Code=200501, "Operation failed: Please retry").
  • Add GetUploadVerification() to fetch the verification code from the /drive/v2/volumes/{}/links/{}/revisions/{}/verification endpoint
  • Add BlockVerifier and UploadVerification types to block_types.go
  • Add VolumeID field to BlockUploadReq (now required by the API)
  • Fix UploadBlock() to use a plain HTTP client instead of the authenticated API client, as storage servers only accept the pm-storage-token header

Context

Since late 2025, Proton has been rolling out a breaking change to their block upload API that requires a per-block verification token. This is computed by XORing the verification code (fetched from a new endpoint) with the first 32 bytes of each encrypted block.

Without this change, all file uploads via rclone fail. See rclone/rclone#8870 and forum discussion.

Test plan

  • Upload a small text file to Proton Drive via rclone
  • Upload a file larger than 4 MB (multi-block) to verify per-block token computation
  • Verify existing download/read operations are unaffected

Made with the help of Claude Opus 4.6 (claude-opus-4-6)

Proton's storage API now requires a per-block verification token when
uploading file blocks. Without it, all uploads fail with HTTP 422
(Code=200501, "Operation failed: Please retry").

Changes:
- Add GetUploadVerification() to fetch verification code from the
  /drive/v2/volumes/{}/links/{}/revisions/{}/verification endpoint
- Add BlockVerifier and UploadVerification types to block_types.go
- Add VolumeID field to BlockUploadReq (now required by the API)
- Fix UploadBlock() to use a plain HTTP client instead of the
  authenticated API client, as storage servers only accept the
  pm-storage-token header

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant