Skip to content

OCS v2.draft1: FEDERATED_SHARING service #21185

Closed

Description

@martin-rueegg

remark: this issue is regarding the regarding the OCS v2 draft 1 specification. please refer to OCS v2.draft1 comments overview for further information.

FEDERATED_SHARING service (FSS)

(source: my e-mail to frank)

{remoteId} collision

if i understand it correctly, the sharing/sending site is creating the {remoteId}. so in theory, two independent instances (say B and C) can create the same {remoteId} for a (different) resource within their repository, as it is not specified that it needs to include the server[:port]/url part of the federation id. as a result, the actual share can only be identified by the {remoteId}/{token} combination.

this is fine for the accept/reject actions. but the url structure for the unshare request is not unique in that sense! if site B and C are sharing the resource with {remoteId}=8 to site A, the request

POST /ocs/v2.php/cloud/shares/8/unshare?format=json HTTP/1.1

could be issued by site B or C. however, an exact identification of B/C is not possible by A (yes, the host and port might be identified through connection parameters, but the instance root-url not). now given the fact, that by any chance the {token} would also be the same (ok, is unlikely), the receiving site has a problem. also, if the {token} is not valid for any of the resources with {remoteId}=8.

of course, any future request by A to the now unshared resource on let's say B will fail, yet the configuration on site A will be inconsistent. so i would suggest that the sending site SHOULD repeat the unshare request after every future attempt to access the share (which MUST be replied by http 410) until a 200 success response is received. or the http 410 code MAY be interpreted as a unshare request.

thus i suggest, that the unshare request also MUST include the (url-encoded) {remote} IRI parameter of the original share request. or the URL structure should include that, to remain RESTful: example.org/{share}/{remote}/{remoteId}/decline, or can be located at example.org/{share}/decline and has to be authenticated with user {remote}/{remoteId} and password {token}.

new update method

next, an update request should probably be introduced at
example.org/{share}/{remote}/{remoteId}/update
in order to change, eg.

  • {token} (for security reasons it makes sense to update the token once in a while, or at least, if the token has been compromised)
  • {remote} IRI. (due to server migration, domain-name change, url-change)
  • owner (in case the username on the sending server get's updated)

the request should include the (old) {token} and the new paramter.

responses should be treated equally as with the unshare requests (repeated until success, probably in regular intervals in case of a {remote} IRI change.)

share related PRIVATE_DATA store

alternatively to the update request, a mandatory PRIVATE_DATA store could be defined, using {remote} as HTTP-Auth username and the {token} as password (or both somehow mangled into the password to avoid name conflicts with existing users [even if this is quite unlikely]). the store MUST be located at (to be defined)

  • example.org/{store}/ (since authentication needs to be done with the share credentials, the private store could be identified, custom values would only be allowed to example.org/{store}/{sub-store}), or
  • example.org/{share}/config: (where authentication is again required with user {remote}/{remoteId} and password {token}. custom values would only be allowed to example.org/{share}/config/{sub-store})

the config store MUST support the keys

  • {token}
  • {remote}
  • {owner}
  • {shareWith}
  • status, MUST be on of requested, pending, accepted, declined, unshared
  • ssl-cert (see "spam and DOS prevention" below)
  • cache.psl
  • cache.webdav

which

  • MUST reflect the currently actual values,
  • MUST all be undeletable,
  • MUST NOT accept null-values, and
  • MUST update the values used when connecting
  • only the first three ({token}, {remote}, {owner}) MAY be updated by the consumer, while the rest MUST be read-only.
    other keys MUST only be allowed in arbitrary {sub-stores} and SHOULD only be accepted once the share has been accepted by the user.

authenticity check and spam and DOS prevention

validation of a (share) request source

shares should only be accepted if the request is made by the same entity than the {remote} (or it's corresponding services PSL and FSS) belong to. this could be checked by requiring a SSL-client certificate on the connection that accepts the share. but maybe the implementation is difficult. so an other way could be to check if the originating IP address is found among the IP addresses of the {remote} (or it's corresponding services PSL and FSS).

in case of a mismatch, an consumer validation failed error SHOULD be returned, e.g.

  • 403/4xxx, or
  • 428/4xxx

future requests of the same share (unshare, config) should be validated to using the same procedure.

validation of sharing party

to ensure the authenticity of an offered share, the provider MUST check the SSL-certificate provided when connecting to {remote}, the corresponding PSL, and both the {share} and {webdav} capability endpoints of the FEDERATED_SHARING service. all certificates MUST be stored in the ssl-cert field of the share config. this certificate(s) SHOULD be made available to the user during the process of accepting the share and MUST be presented to and confirmed by the user in case it is/they are not perfectly valid for the respective endpoint.

thus the status in the share config would be requested after receiving the request until the SSL-certificate(s) have been collected from all locations, after that the "validation of the sharer" (see below) would be initiated.

this certificates MUST be checked upon future connections and re-confirmed by the user in case they would change or no longer match the hostname. in case of expiry re-confirmation by the user is RECOMMENDED.

validation of sharer

independent of the result of the "validation of sharing party" (see above) the {owner} should be checked at the sharing party. for this the receiving party should send a validate request to the sharing party at {share}/validate/shareRequest/{remoteId}/{owner}/{receivingInstance}/{sharedWith} which need to be authenticated with {token}.

the sharing instance MUST reply with

  • 200/2xxx "share request valid" ONLY in case of success, or
  • 5xx/5xxx on an internal server error
  • 403/4xxx "access denied) otherwise.

a success is defined by

  • the positive validation of "validation of a request source"
  • the existence of the given request identified by {remoteId}
  • the positive correspondence of the respective values {owner},{receivingInstance},{sharedWith}

further proceedings:

  • after successful validation (200/2xxx) the status in the config SHOULD be set to pending (for user confirmation) and the share request SHOULD be presented to the user (or processed by other provider internal means, e.g. automatically).
  • after a 5xx response, the validation SHOULD be retried.
  • 3xx redirections SHOULD be followed (collecting new SSL certificates into config/ssl-cert).
  • 4xx SHOULD "stale" the request.

Activity

  1. LukasReschke commented on Mar 1, 2016

    @LukasReschke
    Contributor

    Subscribing myself here.

  2. DeepDiver1975 commented on Jan 27, 2017

    @DeepDiver1975
    Contributor
  3. lock commented on Aug 3, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  4. locked as resolved and limited conversation to collaborators on Aug 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions