Skip to content

public locking on folder returning 403 instead of 405 in new web dav api version #40882

@KarunAtreya

Description

@KarunAtreya

Steps to reproduce

  1. admin creates folders parent and parent/child
  2. admin created files parent/parent.txt and parent/child/child.txt
  3. admin creates a public share for folder parent
  4. public tries to lock folder child using new webdav api endpoint version

 curl -kv -XLOCK -uDPTMsy4r2TtFBpN: http://localhost/core/remote.php/dav/public-files/DPTMsy4r2TtFBpN/child --data \
 '<?xml version='1.0' encoding='UTF-8'?>
<d:lockinfo xmlns:d='DAV:'>                                  
        <d:lockscope>      
                <d:exclusive/>
        </d:lockscope>        
</d:lockinfo>' | xmllint --format -

Expected behaviour

the response should be:


HTTP/1.1 405 Method Not Allowed
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
    <s:exception>Sabre\DAV\Exception\MethodNotAllowed</s:exception>
    <s:message>Locking not allowed from public endpoint</s:message>
</d:error>


Actual behaviour

but the response is:


< HTTP/1.1 403 Forbidden
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre\DAVACL\Exception\NeedPrivileges</s:exception>
  <s:message>User did not have the required privileges ({DAV:}write-content) for path "public-files/DPTMsy4r2TtFBpN/child"</s:message>
  <d:need-privileges>
    <d:resource>
      <d:href>/core/remote.php/dav/public-files/DPTMsy4r2TtFBpN/child</d:href>
      <d:privilege>
        <d:write-content/>
      </d:privilege>
    </d:resource>
  </d:need-privileges>
</d:error>


Note: this issue does not persist on files of pubic share but only on the subfolders in the public share in new webdav api version

Server configuration

Operating system: ubuntu

Database: mysql

PHP version: 7.4

ownCloud version: ownCloud 10.13.0 prealpha (git)

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