-
Notifications
You must be signed in to change notification settings - Fork 68
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
maxRequestDepth
does not work if depth
is not set
#84
Comments
I also found this problem
|
I found that as long as the "depth" in the request header is not a number or is not set, the server will treat it as |
@mholt |
https://datatracker.ietf.org/doc/rfc4918/?include_text=1 9.1. PROPFIND Method The PROPFIND method retrieves properties defined on the resource A client MUST submit a Depth header with a value of "0", "1", or
This section, as with similar sections for other methods, provides 403 Forbidden - A server MAY reject PROPFIND requests on collections |
The following are the steps to reproduce the bug For example, if there is the existence of the following loop folder soft links:
|
The following are the steps to reproduce the bug Then I start the webdav service
|
The following are the steps to reproduce the bug Then initiate a request to the server, the server enters an endless loop, the memory overflows, and the server is down
|
The solution is as follows: server.beforeRequest((arg, next) => {
const { headers, method } = arg.request
const { depth } = headers
if (method === 'PROPFIND' && depth !== '0' && depth !== '1') {
arg.setCode(403);
arg.exit();
}
else {
next();
}
}) |
If
depth
header is not set or not a number,maxRequestDepth
does not work as expected. Because in such casesdepth
will never meet0
:npm-WebDAV-Server/src/server/v2/commands/Propfind.ts
Line 443 in 5f23762
The text was updated successfully, but these errors were encountered: