ocm: handshake callback follows OCS discovery, legacy GET flavor (#455) #482

Merged
Cordy merged 2 commits from fix-455e into main 2026-09-11 10:56:35 +00:00
Owner

Live dogfood trace: after the overwrite.cli.url fix, NC's request-shared-secret arrived and was accepted (200) — but our callback got 404, because Nextcloud 34 does not serve /ocs/v2.php/apps/federation/api/v1/get-shared-secret. Its /ocs-provider advertises the real endpoint: FEDERATED_SHARING.endpoints["shared-secret"] = /ocs/v2.php/cloud/shared-secret, a GET with query parameters and the OCS-APIRequest: true header (verified live against nextcloud.c0rdyceps.ch: GET → 403 on a dummy token, exactly the validation semantics).

fetchDirSecret now: fetches the peer's /ocs-provider/, uses the advertised shared-secret endpoint GET-style with the OCS header, and keeps the modern POST path as fallback when discovery is absent. Trailing-slash source retry unchanged; refusal logs now include the endpoint.

TDD: the corrected-protocol test (discovery + GET + header assertions) witnessed red on the runner against the old POST implementation; a second test pins the discovery-less POST fallback.

Live dogfood trace: after the `overwrite.cli.url` fix, NC's `request-shared-secret` arrived and was accepted (200) — but our callback got **404**, because Nextcloud 34 does not serve `/ocs/v2.php/apps/federation/api/v1/get-shared-secret`. Its `/ocs-provider` advertises the real endpoint: `FEDERATED_SHARING.endpoints["shared-secret"] = /ocs/v2.php/cloud/shared-secret`, a **GET** with query parameters and the `OCS-APIRequest: true` header (verified live against nextcloud.c0rdyceps.ch: GET → 403 on a dummy token, exactly the validation semantics). `fetchDirSecret` now: fetches the peer's `/ocs-provider/`, uses the advertised shared-secret endpoint GET-style with the OCS header, and keeps the modern POST path as fallback when discovery is absent. Trailing-slash source retry unchanged; refusal logs now include the endpoint. TDD: the corrected-protocol test (discovery + GET + header assertions) witnessed red on the runner against the old POST implementation; a second test pins the discovery-less POST fallback.
Cordy merged commit ddd65c6589 into main 2026-09-11 10:56:35 +00:00
Cordy deleted branch fix-455e 2026-09-11 10:56:37 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#482
No description provided.