Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to access a non-existing resource returns an empty body #1282

Closed
Tracked by #39113
individual-it opened this issue May 4, 2020 · 17 comments
Closed
Tracked by #39113

Trying to access a non-existing resource returns an empty body #1282

individual-it opened this issue May 4, 2020 · 17 comments

Comments

@individual-it
Copy link
Member

when trying to access a resource that does not exist with GET or PROPFIND, the correct HTTP code (404) is returned but the body of the response is empty

curl -X PROPFIND http://localhost:9140/remote.php/dav/files/does-not-exist -u user0:123456 -v
*   Trying 127.0.0.1:9140...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9140 (#0)
* Server auth using Basic with user 'user0'
> PROPFIND /remote.php/dav/files/does-not-exist HTTP/1.1
> Host: localhost:9140
> Authorization: Basic dXNlcjA6MTIzNDU2
> User-Agent: curl/7.68.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Access-Control-Allow-Origin: *
< Vary: Origin
< X-Access-Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJyZXZhIiwiZXhwIjoxNTg4NTc1NTkxLCJpYXQiOjE1ODg1NzE5OTEsImlzcyI6Imh0dHBzOi8vbG9jYWxob3N0OjkyMDAiLCJ1c2VyIjp7ImlkIjp7ImlkcCI6Imh0dHBzOi8vbG9jYWxob3N0OjkyMDAiLCJvcGFxdWVfaWQiOiJ1c2VyMCJ9LCJ1c2VybmFtZSI6InVzZXIwIiwibWFpbCI6InVzZXIwQGV4YW1wbGUub3JnIiwiZGlzcGxheV9uYW1lIjoiVXNlciBaZXJvIn19.7idBBYb4GuSQB3LQxZIMf4JmWz-teFBzpKZX1_PVIiU
< Date: Mon, 04 May 2020 05:59:51 GMT
< Content-Length: 0
< 
* Connection #0 to host localhost left intact

vs oC 10

curl -X PROPFIND http://localhost/owncloud-core/remote.php/dav/files/does-not-exist -u uu1:uu1 -v
*   Trying 127.0.0.1:80...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 80 (#0)
* Server auth using Basic with user 'uu1'
> PROPFIND /owncloud-core/remote.php/dav/files/does-not-exist HTTP/1.1
> Host: localhost
> Authorization: Basic dXUxOnV1MQ==
> User-Agent: curl/7.68.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Date: Mon, 04 May 2020 06:00:26 GMT
< Server: Apache/2.4.43 (Ubuntu)
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< X-Robots-Tag: none
< X-Frame-Options: SAMEORIGIN
< X-Download-Options: noopen
< X-Permitted-Cross-Domain-Policies: none
< Set-Cookie: oc4kyqahfanl=c9jffpv2t69jkun4u618srq9m0; path=/owncloud-core; HttpOnly
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate
< Pragma: no-cache
< Set-Cookie: oc_sessionPassphrase=RrXPBYcZINaSYO%2FyXa0KD1Dk55%2BXVzUBt0En2u8OR6%2BFmFh5snEXGHK6OubihNmB0d98QfYx4K0WvxmObZizlYzxvOC4rMwhCrCuyrJTVeC8YIZHMJWFyD8mM%2FDw8AMc; path=/owncloud-core; HttpOnly
< Content-Security-Policy: default-src 'none';
< Set-Cookie: oc4kyqahfanl=62cob6c4pgbiat956s91o31t79; path=/owncloud-core; HttpOnly
< Set-Cookie: cookie_test=test; expires=Mon, 04-May-2020 07:00:26 GMT; Max-Age=3600
< Vary: Brief,Prefer
< DAV: 1, 3, extended-mkcol, 2
< Content-Length: 236
< Content-Type: application/xml; charset=utf-8
< 
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre\DAV\Exception\NotFound</s:exception>
  <s:message>Principal with name does-not-exist not found</s:message>
</d:error>
* Connection #0 to host localhost left intact
@individual-it
Copy link
Member Author

similar to owncloud/ocis-reva#30

@PVince81
Copy link
Contributor

PVince81 commented May 4, 2020

supersedes owncloud/ocis-reva#13 as now it returns an empty body with 204 instead of 500.

  • unskip test issue-ocis-reva-13 when fixed

@PVince81 PVince81 self-assigned this May 4, 2020
@PVince81
Copy link
Contributor

PVince81 commented May 4, 2020

Going to try and debug this

@PVince81
Copy link
Contributor

PVince81 commented May 4, 2020

bug seems gone:

curl -D - -X PROPFIND -u einstein:relativity -k http://localhost:9140/remote.php/dav/files/does-not-exist
HTTP/1.1 404 Not Found
Access-Control-Allow-Origin: *
Vary: Origin
X-Access-Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJyZXZhIiwiZXhwIjoxNTg4NTg5MzM2LCJpYXQiOjE1ODg1ODU3MzYsImlzcyI6Imh0dHBzOi8vbG9jYWxob3N0OjkyMDAiLCJ1c2VyIjp7ImlkIjp7ImlkcCI6Imh0dHBzOi8vbG9jYWxob3N0OjkyMDAiLCJvcGFxdWVfaWQiOiJlaW5zdGVpbiJ9LCJ1c2VybmFtZSI6ImVpbnN0ZWluIiwibWFpbCI6ImVpbnN0ZWluQGV4YW1wbGUub3JnIiwiZGlzcGxheV9uYW1lIjoiRWluc3RlaW4ifX0.w2caqBfMe6C-loaoLw0JUI4F06C4JTmptEzULxUiJzA
Date: Mon, 04 May 2020 09:48:56 GMT
Content-Length: 0

The following was tested manually using curl with the ocis server (without external LDAP docker)

I think we need to distinguish multiple cases properly:

  • accessing a non-existing resource with GET inside home: getting 404 ✅

  • accessing a non-existing resource with PROPFIND inside home: getting 404 ✅

  • accessing a non-existing user in dav2 path "remote.php/dav/files/unexist" with GET : getting 404 ✅

  • accessing a non-existing user in dav2 path "remote.php/dav/files/unexist" with PROPFIND: getting 404 ✅

  • access a non-existing resource inside another user's path "remote.php/dav/files/anotheruser/unexist.txt" with GET: returns 404 ✅

  • access a non-existing resource inside another user's path "remote.php/dav/files/anotheruser/unexist.txt" with PROPFIND: returns 404 ✅

  • access an existing resource inside another user's path "remote.php/dav/files/anotheruser/exist.txt" with GET: should return 404 🚫 , already reported here: https://github.com/owncloud/ocis-reva/issues/9

  • access an existing resource inside another user's path "remote.php/dav/files/anotheruser/exist.txt" with PROPFIND: should return 404, returns XML instead 🚫 https://github.com/owncloud/ocis-reva/issues/9

  • trying to DELETE a resource inside another user's path returns 204 but should return 404 🚫, likely covered by server returns 500 when trying to access a not existing file ocis-reva#13 (comment)

  • trying to DELETE a non-existing resource inside own or another user's path returns 404 ✅

To me it seems this already works.

But I have doubts about what owncloud/ocis-reva#13 (comment) is actually testing and why it would still fail, as it seems to be deleting a non-existing file but behaves as if it that file does exist. @individual-it can you recheck ?

@PVince81
Copy link
Contributor

PVince81 commented May 4, 2020

@individual-it the top post speaks of a non-existing resource but it's actually a non-existing user or another user (which must appear as non-existing for the calling user).

a non-existing resource would be "http://localhost:9140/remote.php/dav/files/einstein/does-not-exist".

we should be more precise in the future because of all these possible distinctions and nuances, especially that these are likely covered by different code paths in the backend

@individual-it
Copy link
Member Author

@PVince81 you are true, I forgot the username in the dav path, but the result is the same - the content of the reply is empty. This issue is not about the return code but about the body of the result message.

In your test its the same Content-Length: 0 oC10 returns an XML body in that case, ocis does an empty body

@PVince81
Copy link
Contributor

PVince81 commented May 4, 2020

Ah, got it. Thanks

@PVince81
Copy link
Contributor

to be discussed in https://github.com/owncloud/ocis-reva/issues/199

@PVince81 PVince81 removed their assignment Sep 3, 2020
@butonic butonic transferred this issue from owncloud/ocis-reva Jan 18, 2021
@refs refs changed the title trying to access a non-existing resource returns an empty body Trying to access a non-existing resource returns an empty body Jan 19, 2021
@refs
Copy link
Member

refs commented Jan 19, 2021

can confirm it still happens with the latest master.

@stale
Copy link

stale bot commented Jun 6, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

@micbar
Copy link
Contributor

micbar commented Jul 7, 2021

fixed as a side effect of cs3org/reva#1849

@pmaier1
Copy link
Contributor

pmaier1 commented Aug 11, 2021

fixed as a side effect of cs3org/reva#1849

Then close and remove from expected failures?

@phil-davis
Copy link
Contributor

@dpakach please check if there are still any expected-failures related to this issue. Hopefully this is fixed and we can close the issue.

@SwikritiT
Copy link
Contributor

@sakshamgurung is working on this issue

@sakshamgurung
Copy link
Contributor

sakshamgurung commented Aug 16, 2021

@phil-davis

  • oc10 is responding with following response body
OC10: curl -X PROPFIND http://localhost/core/remote.php/dav/files/does-not-exist -u admin:admin -v
...
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre\DAV\Exception\NotFound</s:exception>
  <s:message>Principal with name does-not-exist not found</s:message>
</d:error>
* Connection #0 to host localhost left intact
  • ocis is responding with following response body
OCIS :  curl -k -X PROPFIND https://localhost:9200/remote.php/dav/files/does-not-exist -u admin:admin -v
...
<?xml version="1.0" encoding="UTF-8"?>
* Connection #0 to host localhost left intact
<d:error xmlns:d="DAV" xmlns:s="http://sabredav.org/ns"><s:exception>Sabre\DAV\Exception\NotFound</s:exception><s:message>Resource /users/does-not-exist not found</s:message></d:error>%
  • Is is expected to have different message structure for oc10 and ocis because drone is failing with this error message:
    Screenshot from 2021-08-16 16-44-20

@SwikritiT
Copy link
Contributor

@phil-davis the PR that adjusts the tests for this issue has been merged owncloud/core#39113.
I think we can close this issue.

@phil-davis
Copy link
Contributor

The response body exists now, and has the same exception. The message text is different - but that is OK and we have adjusted the tests so that they know to expect the different message text from oCIS. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants