nextcloud / nextcloud/server

[Bug]: file_exists(): open_basedir restriction in effect. File(/files) is not within the allowed path

Open
#39,633 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 27-feedback bug feature: dav feature: filesystem needs review
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
Bug description

Log is flooded with

file_exists(): open_basedir restriction in effect. File(/files) is not within the allowed path(s): (/abc/:/tmp/:/proc/) at /abc/xyz/nextcloud/3rdparty/sabre/dav/lib/DAV/FS/Directory.php#78

Steps to reproduce
  1. Open Logs
Expected behavior

Use correct path like /remote.php/dav/files, not /files

Installation method

Community Manual installation with Archive

Nextcloud Server version

27

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Nginx

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Upgraded to a MAJOR version (ex. 22 to 23)

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs
{"reqId":"NYbARyfFtjdAaEfIAvif","level":3,"time":"2023-07-31T08:13:34+00:00","remoteAddr":"141.88.235.123","user":"--","app":"PHP","method":"OPTIONS","url":"/remote.php/dav/files/ttt/","message":"file_exists(): open_basedir restriction in effect. File(/files) is not within the allowed path(s): (/dfgh/:/tmp/:/proc/) at /var/www/vhosts/abc/nextcloud/3rdparty/sabre/dav/lib/DAV/FS/Directory.php#78","userAgent":"Microsoft Office Excel","version":"27.0.1.2","data":{"app":"PHP"}}
{"reqId":"7BUNPLXkF9LcO3rk7WfQ","level":3,"time":"2023-07-31T08:13:35+00:00","remoteAddr":"141.88.235.123","user":"--","app":"PHP","method":"HEAD","url":"/remote.php/dav/files/ttt/ppp.xlsx","message":"file_exists(): open_basedir restriction in effect. File(/files) is not within the allowed path(s): (/dfgh/:/tmp/:/proc/) at /var/www/vhosts/abc/nextcloud/3rdparty/sabre/dav/lib/DAV/FS/Directory.php#78","userAgent":"Microsoft Office Existence Discovery","version":"27.0.1.2","data":{"app":"PHP"}}
{"reqId":"7BUNPLXkF9LcO3rk7WfQ","level":3,"time":"2023-07-31T08:13:35+00:00","remoteAddr":"141.88.235.123","user":"--","app":"PHP","method":"HEAD","url":"/remote.php/dav/files/ttt/ppp.xlsx","message":"file_exists(): open_basedir restriction in effect. File(/files) is not within the allowed path(s): (/dfgh/:/tmp/:/proc/) at /var/www/vhosts/abc/nextcloud/3rdparty/sabre/dav/lib/DAV/FS/Directory.php#78","userAgent":"Microsoft Office Existence Discovery","version":"27.0.1.2","data":{"app":"PHP"}}
{"reqId":"X1C1YQXJxZwHuIdsktnX","level":0,"time":"2023-07-31T08:13:35+00:00","remoteAddr":"141.88.235.123","user":"FFFFF","app":"webdav","method":"PROPFIND","url":"/remote.php/dav/files/ttt/~%24ppp.xlsx","message":"File with name /ttt/~$ppp.xlsx could not be located","userAgent":"Microsoft-WebDAV-MiniRedir/10.0.19045","version":"27.0.1.2","exception":{"Exception":"Sabre\\DAV\\Exception\\NotFound","Message":"File with name /ttt/~$ppp.xlsx could not be located","Code":0,"Trace":[{"file":"/var/www/vhosts/abc/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":78,"function":"getChild","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->"},{"file":"/var/www/vhosts/abc/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":971,"function":"getNodeForPath","class":"Sabre\\DAV\\Tree","type":"->"},{"file":"/var/www/vhosts/abc/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1662,"function":"getPropertiesIteratorForPath","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/vhosts/abc/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1647,"function":"writeMultiStatus","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/vhosts/abc/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":346,"function":"generateMultiStatus","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/vhosts/abc/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPropFind","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/vhosts/abc/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/vhosts/abc/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/vhosts/abc/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/vhosts/abc/nextcloud/apps/dav/lib/Server.php","line":364,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/vhosts/abc/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/vhosts/abc/nextcloud/remote.php","line":172,"args":["/var/www/vhosts/abc/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/vhosts/abc/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","Line":227,"message":"File with name /yyy.xlsx could not be located","exception":{},"CustomMessage":"File with name /yyy.xlsx could not be located"}}
Additional info

There was an older closed bug report here: https://github.com/nextcloud/server/issues/30479

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with 3rdparty/sabre/dav/lib/DAV/FS/Directory.php at line 78 and apps/dav/lib/Connector/Sabre/Directory.php at line 227. Reproduce the warning using the reported OPTIONS, HEAD, and PROPFIND requests under the shown open_basedir settings, then verify that DAV requests no longer log the invalid /files path warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.