You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+103-1Lines changed: 103 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@ the [OpenAPI](https://github.com/OAI/OpenAPI-Specification) (fka Swagger) specif
15
15
*[Share Updating](#update)
16
16
*[Resharing](#reshare)
17
17
*[Invite](#invite)
18
+
*[Signing Request](#signing-request)
18
19
19
20
*[Contributing](#contributing)
20
21
@@ -35,16 +36,20 @@ If a finite whitelist of receiver servers exists on the sender side, then this l
35
36
36
37
When a sending server allows sharing to any internet-hosted receiving server, then discovery can happen from the sharee address, using the `/.well-known/ocm` (or `/ocm-provider`, for backwards compatibility) URL that receiving servers SHOULD provide according to this [specification](https://cs3org.github.io/OCM-API/docs.html?branch=develop&repo=OCM-API&user=cs3org#/paths/~1.well-known~1ocm/get).
37
38
39
+
If the identity of an incoming request needs to be confirmed, the discovery data SHOULD contain a public key. Each incoming request that requires to origin from an authenticated source must be signed in its headers using the related private key.
40
+
38
41
To fill the gap between users knowning other peers' email addresses of the form `user@provider.org`, and the actual cloud storage endpoints being in the form `https://my-cloud-storage.provider.org`, a further discovery mechanism SHOULD be provided by implementations that wish to allow sending shares to any receiver, based on DNS `SRV` Service Records.
39
42
40
43
* A provider SHOULD ensure that a `type=SRV` DNS query to `_ocm._tcp.provider.org` resolves to e.g. `service = 10 10 443 my-cloud-storage.provider.org`
41
44
* When requested to discover the EFSS endpoint for `user@provider.org`, implementations SHOULD query the corresponding `_ocm._tcp.domain` DNS record, e.g. `_ocm._tcp.provider.org`, and subsequently make a HTTP GET request to the host returned by that DNS query, followed by the `/.well-known/ocm` URL path.
42
45
46
+
47
+
43
48
### Share Creation
44
49
To create a share, the sending server SHOULD make a HTTP POST request to the `/shares` endpoint of the receiving server ([docs](https://cs3org.github.io/OCM-API/docs.html?branch=develop&repo=OCM-API&user=cs3org#/paths/~1shares/post)).
45
50
46
51
### Share Acceptance
47
-
In response to a share creation, the receiving server MAY send back a [notification](https://cs3org.github.io/OCM-API/docs.html?branch=develop&repo=OCM-API&user=cs3org#/paths/~1notifications/post) to the sending server, with `notificationType` set to `"SHARE_ACCEPTED"` or `"SHARE_DECLINED"`. The sending server MAY expose this information to the end user.
52
+
In response to a share creation, the receiving server MAY send back a [notification](https://cs3org.github.io/OCM-API/docs.html?branch=develop&repo=OCM-API&user=cs3org#/paths/~1notifications/post) to the sending server, with `notificationType` set to `"SHARE_ACCEPTED"` or `"SHARE_DECLINED"`. The sending server MAY expose this information to the end user.
48
53
49
54
### Share Access
50
55
To access a share, the receiving server MAY use multiple ways, depending on the received payload and on the `protocol.name` property:
@@ -87,6 +92,103 @@ If an OCM provider exposes the capability `/mfa-capable`, it indicates that it w
87
92
Since there is no way to guarantee that the sharee OCM provider will actually enforce the MFA requirement, it is up to the sharer OCM provider to establish a trust with the OCM sharee provider such that it is reasonable to assume that the sharee OCM provider will honor the MFA requirement. This establishment of trust will inevitably be implementation dependent, and can be done for example using a pre approved allow list of trusted OCM providers. The procedure of establishing trust is out of scope for this specification: a mechanism similar to the [ScienceMesh](https://sciencemesh.io) integration for the [Invite](#invite) capability may be envisaged.
88
93
89
94
95
+
## Signing request
96
+
97
+
A request is signed by adding the signature in the headers. The sender also need to expose the public key used to generate the signature. The receiver can then validate the signature and therefore the origin of the request.
98
+
To helps debugging, it is made mandatory to also add all properties used in the signature as headers, even if they can be easily re-generated from the payload.
99
+
100
+
Note: Signed requests prove the identity of the sender but does not encrypt nor affect its payload.
101
+
102
+
Here is an example of headers needed to sign a request.
"Signature": "keyId=\"https://author.hostname/key\",algorithm=\"ras-sha256\",headers=\"content-length date digest host\",signature=\"DzN12OCS1rsA[...]o0VmxjQooRo6HHabg==\""
112
+
}
113
+
```
114
+
115
+
- '(request-target)' contains the reached endpoint and the used method,
116
+
- 'content-length' is the total length of the payload of the request,
117
+
- 'date' is the date and time on which the request have been emitted,
118
+
- 'digest' is a checksum of the payload of the request,
119
+
- 'host' is the hostname of the recipient of the request (remote when signing outgoing request, local on incoming request),
120
+
- 'Signature' contains the signature generated using the private key and details on its generation:
121
+
* 'keyId' is a unique id, formatted as an url. hostname is used to retrieve the public key via custom discovery
122
+
* 'algorithm' specify the algorithm used to generate signature
123
+
* 'headers' specify the properties used when generating the signature
124
+
* 'signature' the signature of an array containing the properties listed in 'headers'. Some properties like content-length, date, digest, and host are mandatory to protect against authenticity override.
125
+
126
+
127
+
### How to generate the Signature for outgoing request
128
+
129
+
After properties are set in the headers, the Signature is generated and added to the list.
130
+
131
+
This is a quick PHP example of headers for outgoing request:
0 commit comments