Skip to content

OCS v2.draft1 comments overview #21172

Closed
Closed

Description

@martin-rueegg

hi @karlitschek
as suggested, i opened an issue with my comments regarding your OCS v2 draft 1 specification (as retrieved on 12.12.2015).

hoping that this will help keeping the overview while discussing the draft, i will spilt the issue into several sub-issues. this issue here shall be an umbrella issue and host the general discussion. references to and from the sub-issues are welcome and suggested. this first post shall be updated to reference the sub-issues, if possible.

following the outline of the document with the associated sub-issues:

  • Abstract
  • Notational Conventions
  • Terminology
  • Security Considerations
    • Authentication
    • Transmission layer
    • Secrets
  • Performance / Scalability
    • Cookies
    • HTTP Basic Authentication
  • Formats / Encoding
  • Service Discovery / Provider service list
  • Modules
    • FEDERATED_SHARING
    • PRIVATE_DATA
      • Set value
      • Get all values of store
      • Get value of a key in a store
      • Delete a key-value entry
    • SHARING
      • Get a list of shares
      • Get a list of shares from a specific file or folder
      • Get information about a specific share
      • Create a new share
      • Delete an existing share
      • Update an existing share
    • PROVISIONING
      • Create user
      • Get users
      • Get a user
      • Edit user attributes
      • Delete user
      • Get group memberships
      • Add user to group
      • Remove user from group
      • Promote user to subadmin of group
      • Remove subadmin privileges of user
      • Get subadmin privileges of user
      • Get groups on the server
      • Create a new group
      • Get members of a group
      • Get subadmins of a group
      • Delete a group
      • Get list of installed apps
      • Get application information
      • Enable application
      • Disable application
    • ACTIVITY
      • Request
      • Response

the next post will include my original mail for reference.

looking forward for future discussion.

thanks,
martin.

Activity

  1. martin-rueegg commented on Dec 13, 2015

    @martin-rueegg
    ContributorAuthor

    On Dec 12, 2015, at 17:07, metaworx - Martin Rüegg wrote:

    hi frank

    i had the idea of implementing some oc2oc replication in order to keep two sites (partially) in sync. i did not find out, if federated sharing is actually doing that already, but i assume it is more an relayed access. so as soon as that share is unshared, the files are no longer available in the receiving site.

    anyway, i came across your ocs draft and wanted to make some comments. if i should direct this mail to a mailing list or an issue tracker, please let me know. and: it became quite a long mail. hope you don't mind!

    in the following, i'm refering to the OCS v2 draft v1
    http://www.open-collaboration-services.org/ocs/ocs2-draft1.html (retrieved as of today)

    the first question is regarding the

    federation id

    it is created as user@server/url. is the https default port (443) considered to be standard (and as such left away) and if an other port is used it will be added like user@server[:port]/url?

    as the user can include the @ character itself, i guess the last @ is considered to be the user/server separator. so hopefully no one attempts to have a @ in their base url ... :-)

    Service Discovery / Provider service list

    given the fact, that this resource is available at https://server[:port][/root-url]/ocs-provider/ and the share endpoints in the OC implementation are located at https://server[:port][/root-url]/ocs/... the "Relative IRI to the endpoint" is intended to be relative to the root-url/, not the root-url/ocs-provider/ url. this should be stated explicitly in the documentation.

    the endpoints should also be able to include absolute paths, in case that the service is implemented on an other web server than the main resource (e.g. https://demo.owncloud.org/ocs-provider/ but https://ocs.owncloud.org/v2.php/cloud/shares).
    in case the server does not support federated sharing (i.e. disabled by administrator), then the /ocs-provider/ MUST NOT include the service, or an additional parameter "status" should be included, which could have

    • 200 for available
    • 501 for not implemented
    • 503 for temporary unavailable

    in case of 501 the endpoints parameter MUST NOT be provided.
    furthermore the webdav parameter should be OPTIONAL, depending of weather or not outgoing shares are available, i.e. if the admin only allows incoming shares, the webdav interface is not required.

    in the section Accessing shared files, the webdav resource is called access. this is ambiguous.

    Reserved status codes

    • codes <1000 should be reserved for OCS generic codes
    • codes >999 should be reserved for module/service specific codes

    generally in the documentation there is the use of OCS success message. this should be changed to read OCS response message, which is the minimum response and MUST include the ocs/meta element and MAY include the ocs/data element.

    it should also be made clear, when the documentation intends an http status code, and when a OCS status code. best might be if always both codes are given, eg. 200/200 (where the first represents the http, the second the OCS status code

    i suggest, that globally

    • temporary redirection (301/-)
      • by the server:
        • MUST be sent as http 301 status code,
        • MUST NOT include a OCS response
      • by the consumer
        • SHOULD be followed by, and
        • access information SHOULD be updated accordingly
    • temporary redirection (307/-)
      • by the server
        • MUST be sent as http 307 status code,
        • MUST NOT include a OCS response
      • by the consumer
        • SHOULD be followed,
        • while access information MUST NOT be updated
    • malformed requests
      • if the http-request itself is malformed, the server (400/-)
        • MUST send a http 400 error
        • MUST NOT include a OCS response
      • also in case the data does not comply to application/x-www-form-urlencoded
        • the http 400 error needs to be sent by the script
        • an OCS response MUST NOT be included
      • in case of missing parameters in a request (203/XXX)
        • the http code 203 MUST be used,
        • an OCS response SHOULD be included
      • in case of an unknown ressource (eg. an unexisting store or key in PRIVATE_DATA)
        • the http code 403 MUST be used
        • (a 404 seems more intuitive, but rfc2616 states: "This status code is commonly used when the server does not wish to reveal exactly why the request has been refused (...).")
        • an OCS response SHOULD be included
      • in case of too many components of the URI
        • the http cod 501 MUST be used
        • an OCS response SHOULD be included
    • Unauthorized requests (401/XXX?)
      • http 401 MUST be sent as http status code,
      • 401 OCS response MAY be included (not sure if http standard allows that for a 401 response)
    • the following situations would also cause a http 403
      • if a resource is correct, but
        • access denied or
        • data not available (eg. store not existing in PRIVATE_DATA, see above),
      • and OCS response SHOULD be included
    • http 404 will be sent by the webserver, if the resource is not available. this would include, if a service/module is not implemented, as there are no defined well-known URIs except the /ocs-provider/
    • http 410 SHOULD be sent, if a share has been unshared or rejected.(this implies, that re-sharing the same resource would require a new remoteId.)
    • http 503 SHOULD be sent eg. in maintenance mode, an OCS response MAY be included (eg. with the announcement, see https://apps.owncloud.com/content/show.php/Announcement+Center?content=173921)

    this seems all very complicated. but it makes it more consistent for the client, e.g. in the case a resource is accessed which is not actually an OCS resource or the webserver generates the error before processing the script.

    maybe the above rules need a revision, it would be easier to create a table with the conditions and both the http and OCS status codes.

    Output format / OCS Format

    the term 'customer' instead of 'consumer' is used.

    the default format should be defined for the case, where the format parameter is missing. or the format parameter should be mandatory and result in a malformed request if missing.
    alternatively to the GET parameter, the http Accept header could be set to either application/xml or application/json?

    the ocs/data is defined as mandatory. i suggest to define it optional (MAY).

    FEDERATED_SHARING

    if i understand it correctly, the sharing/sending site is creating the {remoteId}. so in theory, two independent instances can create the same {remoteId} for a resource, 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. an exact identification is not possible, however (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.

    there should be noted, that 500 http error codes MAY be acceptable as defined at reserved status codes. actually, i would suggest that they SHOULD or MUST be acceptable.

    of course, any future request to the now unshared resource 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.

    internal server error should send a http 500 with OCS 500 for debugging info.
    if federation is disabled, either http 404 MUST be returned. (the resource should not be given by the service list in the first place. see above.)
    same applies for the responses to the other requests.

    furthermore i suggest, that the unshare request also MUST include the {remote} IRI parameter of the original share request. or the URL structure should include that, to remain RESTful: example.org/{share}/{remote}/{remoteId}/decline

    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.)

    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 this is quite unlikely). the store MUST be located at example.org/{store}/{remoteId}/ and MUST support the keys

    • {token}
    • {remote}
    • {owner}
    • {shareWith}

    which

    • MUST reflect the currently actual values,
    • MUST all be undeletable,
    • MUST NOT accept null-values, and
    • MUST update the values used when connecting while
    • the last one ({shareWith}) MUST be read-only.
      other keys MUST be allowed and MUST begin with X- or x- (to avoid naming conflicts with future reserved keys), but SHOULD only be accepted once the share has been accepted by the user.

    if {storeName} is optional in the PRIVATE_DATA definition, then it could also be defined, that the missing storeName ("") only allows keys defined by the standard, while user-defined values MUST using an arbitrary {storeName}. In that case, the x- prefix would not be required. alternatively an other fix defined storeName could be used, e.g. share-metadata.

    PRIVATE_DATA

    see also notes above regarding the mandatory store for shares.

    same remark as for FEDERATED_SHARING requests regarding 500 responses should be added.

    status codes of the ocs response messages should be defined, eg.

    • 200/200 OK
    • 403/1100 store not found
    • 403/1200 key not found
    • 403/1201 key not allowed (for store)
    • 403/1202 key read-only (for store and delete)

    why is the store in the response called app and not store? this is inconsistent. furthermore i'd like to ask why is store not surrounding the element? e.g.

    • data
      • store
        • name: bla
        • element
          • key: foo
          • value: bar
        • element
          • key: foo2
          • value: bar

    Get all values of store

    URL structure must not include /{key}.

    while it should be added to the "Get value of a key in a store" section instead.


    ok, i will not go into Sharing, Provisioning, and Activity for now. maybe later, if appreciated.

    thanks,
    martin.

  2. LukasReschke commented on Mar 1, 2016

    @LukasReschke
    Contributor

    Subscribing myself here.

  3. DeepDiver1975 commented on Jan 27, 2017

    @DeepDiver1975
    Contributor
  4. 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.

  5. 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