mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-04-07 14:04:35 +08:00
[bug] Sanitize Content-Disposition in downloadFile; For bug 76325
This commit is contained in:
@ -1774,6 +1774,10 @@ exports.downloadFile = function(req, res) {
|
||||
const downloadResult = yield utils.downloadUrlPromise(ctx, url, tenDownloadTimeout, tenDownloadMaxBytes, authorization, isInJwtToken, headers, true);
|
||||
const response = downloadResult.response;
|
||||
stream = downloadResult.stream;
|
||||
// Sanitize Content-Disposition by removing control chars (prevents CRLF/header injection)
|
||||
if (response.headers['content-disposition']) {
|
||||
response.headers['content-disposition'] = response.headers['content-disposition'].replace(/[\x00-\x1F\x7F]/g, '');
|
||||
}
|
||||
//Set-Cookie resets browser session
|
||||
delete response.headers['set-cookie'];
|
||||
// Set the response headers to match the target response
|
||||
|
||||
Reference in New Issue
Block a user