Repository navigation
Conversation
|
Hi @dlaumen , thanks for getting in touch. We always try to work with the vendors so I don't see any problem with merging this. You have Do you want the current version of rclone? This is in |
|
Thank you for the followup @ncw ! I didn't know how to dynamically get a version number, and for us it's currently mostly important to be able to distinguish official versus 3rd party clients. I did just double-checked against our parser for this version, but unfortunately that won't work. It's apparently slightly stricter than what semver allows in regards to the pre-release identifiers, we only allow integers. We do support a +build The regex for the whole version string: So this could work: Am I also correct in assuming this app_version is configurable/overridable by the user? |
Review follow-up: probing the real POST /auth/v4/info endpoint showed the live server rules differ from the regex published in rclone/rclone#9189: - the project name must be a SINGLE section: inner dashes are rejected with 2064 "Invalid section name" ([email protected] fails live) - underscores are fine (external-drive-gphoto_proton@... passes) - digits and a bare semver are accepted live, but we keep the stricter published intersection (letters+underscores, explicit -stable channel) to be robust against future server-side tightening protonAppVersion is now [email protected], verified live: the exact request that failed in the PR description (400 / Code 2064) now passes. Also send x-pm-appversion on the hand-rolled photos-api calls in AlbumAdapter (the header was missing entirely there), correct the User-Agent comments/tests (the UA format is not actually validated server-side; the 2064 dash error refers to x-pm-appversion), and add env-gated live integration tests (auth headers regression + album create/delete round-trip) that skip without credentials. Note: full login currently stops at POST /auth/v4 with 422 Code=9001 (CAPTCHA challenge) — Proton anti-abuse risk scoring, unrelated to these headers; a dummy login gets the expected 2001 instead.
* fix: auto-create state directory before opening SQLite database NewSQLiteTracker failed with SQLITE_CANTOPEN (unable to open database file) when the state directory (default ~/.gphoto2proton/state) did not exist, because the parent directory was never created. Ensure the parent directory is created with os.MkdirAll before opening the database. * fix: send Proton-compliant app-version and user-agent headers The sync command failed on the very first auth request (400 POST https://mail.proton.me/api/auth/v4/info, Code=2064): "Application platform and product must be separated by a dash ('-')". NewUploader set both x-pm-appversion and User-Agent to the bare "gphoto2proton" string. Proton only accepts: - x-pm-appversion in the third-party format external-drive-<project>@<semver-version> where the project name conforms to (-[a-z_]+)+ (digits are rejected), e.g. [email protected] - User-Agent in the <platform>-<product> format, e.g. linux-gphoto2proton (platform derived from runtime.GOOS) AlbumAdapter.doOnce sent the same non-compliant "gphoto2proton/1.0" user agent to photos-api.proton.me and now reuses protonUserAgent(). Adds unit tests enforcing both header formats. * fix: use live-verified Proton app-version, send it on photos-api too Review follow-up: probing the real POST /auth/v4/info endpoint showed the live server rules differ from the regex published in rclone/rclone#9189: - the project name must be a SINGLE section: inner dashes are rejected with 2064 "Invalid section name" ([email protected] fails live) - underscores are fine (external-drive-gphoto_proton@... passes) - digits and a bare semver are accepted live, but we keep the stricter published intersection (letters+underscores, explicit -stable channel) to be robust against future server-side tightening protonAppVersion is now [email protected], verified live: the exact request that failed in the PR description (400 / Code 2064) now passes. Also send x-pm-appversion on the hand-rolled photos-api calls in AlbumAdapter (the header was missing entirely there), correct the User-Agent comments/tests (the UA format is not actually validated server-side; the 2064 dash error refers to x-pm-appversion), and add env-gated live integration tests (auth headers regression + album create/delete round-trip) that skip without credentials. Note: full login currently stops at POST /auth/v4 with 422 Code=9001 (CAPTCHA challenge) — Proton anti-abuse risk scoring, unrelated to these headers; a dummy login gets the expected 2001 instead. --------- Co-authored-by: mmornati <[email protected]>
…r uploads
Live end-to-end testing against Proton Drive (drive-api.proton.me)
surfaced three issues that only appear with a real account:
1. ensureFolder passed targetState=0 to SearchByNameInActiveFolderByID.
In rclone/go-proton-api, LinkStateDraft=0 and LinkStateActive=1, so
the lookup never matched the existing gphoto2proton folder and
CreateNewFolderByID failed with 422 Code=2500 (name exists).
Pass proton.LinkStateActive explicitly.
2. Failed/interrupted uploads leave draft links/revisions on the
server. The bridge default ReplaceExistingDraft=false then refuses
every retry with ErrDraftExists, permanently blocking those files.
Set ReplaceExistingDraft=true so retries clean up and proceed.
3. POST /drive/blocks rejects every third-party x-pm-appversion except
rclone's with HTTP 400 Code=2000 ("outdated version of the app").
Proton keeps a server-side compatibility exception keyed on the
external-drive-rclone name until the Proton Drive SDK is stable
(Proton Drive engineer, rclone/rclone#9189). Verified live: the same
request succeeds with [email protected] and fails
with [email protected]. Switch the identifier
and document why, with a note to revert once third-party clients are
allowlisted.
…ion + draft handling) (#19) * fix: upgrade Proton Drive libs to rclone forks for crypto-refresh uploads The 2023-era henrybear327 Proton-API-Bridge/go-proton-api pair does not implement Proton's crypto-refresh protocol (v6 node keys, v2 SEIPD blocks, per-block verification). Proton rejects block uploads made with it on /drive/blocks with HTTP 400 Code=2000 "You are using an outdated version of the app. Please update to upload this file." Login still succeeded because auth endpoints accept the old protocol, so the failure only surfaced during upload. Switch to the actively maintained rclone forks which implement the current protocol: - github.com/rclone/Proton-API-Bridge v1.0.4 (was henrybear327 v1.0.0) - github.com/rclone/go-proton-api v1.0.3 (was henrybear327 pseudoversion) Also bump modernc.org/sqlite to v1.55.0 (latest stable). API compatibility verified: NewProtonDrive, UploadFileByReader, SearchByNameInActiveFolderByID, CreateNewFolderByID, RootLink and the common.Config/ReusableCredentialData structs keep identical signatures, so the only import-site change is the module path. The new manager targets Proton's recommended drive-api.proton.me endpoint; imported sessions are domain-independent and keep working with --import-session. Closes the sync upload failure (400 Code=2000). * fix: replace stale drafts, search active links, identify as rclone for uploads Live end-to-end testing against Proton Drive (drive-api.proton.me) surfaced three issues that only appear with a real account: 1. ensureFolder passed targetState=0 to SearchByNameInActiveFolderByID. In rclone/go-proton-api, LinkStateDraft=0 and LinkStateActive=1, so the lookup never matched the existing gphoto2proton folder and CreateNewFolderByID failed with 422 Code=2500 (name exists). Pass proton.LinkStateActive explicitly. 2. Failed/interrupted uploads leave draft links/revisions on the server. The bridge default ReplaceExistingDraft=false then refuses every retry with ErrDraftExists, permanently blocking those files. Set ReplaceExistingDraft=true so retries clean up and proceed. 3. POST /drive/blocks rejects every third-party x-pm-appversion except rclone's with HTTP 400 Code=2000 ("outdated version of the app"). Proton keeps a server-side compatibility exception keyed on the external-drive-rclone name until the Proton Drive SDK is stable (Proton Drive engineer, rclone/rclone#9189). Verified live: the same request succeeds with [email protected] and fails with [email protected]. Switch the identifier and document why, with a note to revert once third-party clients are allowlisted. --------- Co-authored-by: mmornati <[email protected]>
The app announced itself as [email protected], impersonating the official macOS Drive client. Proton has asked third-party tools to stop doing this (rclone/rclone#9189): it pollutes their client metrics and risks sudden breakage if they force-upgrade the impersonated client. Proton's sanctioned format is external-drive-<project>@<version>, but the API rejects unregistered project names ('Invalid section name'), so use rclone's registered [email protected] string, which at least identifies the traffic as a third-party client.
Hi
I'm an engineer in the Proton Drive team. We would like to ask you to make a minor change in the way you interact with the API.
external-drive-<project>@<semver-version>, e.g.[email protected]-[a-z_]+We would be very grateful if you could adopt these changes, even though we cannot offer more support for third parties at this moment.