files: разрешить загрузку html, css и js на форме записи
This commit is contained in:
@@ -584,7 +584,7 @@ MAX_TOTAL_UPLOAD_BYTES = UPLOAD_TOTAL_LIMIT_MB * 1024 * 1024
|
||||
| `adminUpload` (`server.js:1202`) | файлы проекта | `ADMIN_ALLOWED_EXT`: pdf, doc, docx, txt, md, html, htm, zip, rar, 7z + изображения. `BLOCKED_EXT` блокируется, если расширения нет в списке |
|
||||
| `uploadBackup` (`server.js:2460`) | восстановление | только `\.(?:tar\.gz\|tgz\|gz)$`; пишет во временный каталог `os.tmpdir()/wido-up-XXXX`, **не** в `uploads/` |
|
||||
|
||||
`BLOCKED_EXT` (`server.js:1164`) — regexp, запрещающий `html, htm, js, mjs, cjs, svg, xml, json, map, wasm, php*, phtml, asp*, jsp, sh, bat, cmd, cgi, exe, dll, com, msi, scr, hta, vbs, py, r, rb, htaccess`.
|
||||
`BLOCKED_EXT` (`server.js:1164`) — regexp, запрещающий `svg, xml, json, map, wasm, php*, phtml, asp*, jsp, sh, bat, cmd, cgi, exe, dll, com, msi, scr, hta, vbs, py, r, rb, htaccess`. Веб-файлы (`html`, `htm`, `css`, `js`, `mjs`, `cjs`) разрешены; скачивание отдаёт их как `attachment` (`GET /api/files/:token`), в браузере они не исполняются.
|
||||
|
||||
### Эндпоинты и имена полей form-data
|
||||
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ const DEFAULT_FILE_LIMIT_MB = 50;
|
||||
const DEFAULT_TOTAL_LIMIT_MB = 200;
|
||||
let MAX_FILE_BYTES = DEFAULT_FILE_LIMIT_MB * 1024 * 1024;
|
||||
let MAX_TOTAL_BYTES = DEFAULT_TOTAL_LIMIT_MB * 1024 * 1024;
|
||||
const BLOCKED_FILE_EXT = /\.(?:html?|js|mjs|cjs|svg|xml|json|map|wasm|php\d?|phtml|asp|aspx|jsp|sh|bat|cmd|cgi|exe|dll|com|msi|scr|hta|vbs|py|r|rb|htaccess)$/i;
|
||||
const BLOCKED_FILE_EXT = /\.(?:svg|xml|json|map|wasm|php\d?|phtml|asp|aspx|jsp|sh|bat|cmd|cgi|exe|dll|com|msi|scr|hta|vbs|py|r|rb|htaccess)$/i;
|
||||
const MIME_EXT = {
|
||||
'image/png': '.png', 'image/jpeg': '.jpg', 'image/jpg': '.jpg', 'image/gif': '.gif', 'image/webp': '.webp',
|
||||
'image/bmp': '.bmp', 'image/avif': '.avif', 'image/heic': '.heic', 'image/heif': '.heif', 'image/svg+xml': '.svg',
|
||||
|
||||
@@ -1540,7 +1540,7 @@ function fixFilename(str) {
|
||||
}
|
||||
}
|
||||
|
||||
const BLOCKED_EXT = /\.(?:html?|js|mjs|cjs|svg|xml|json|map|wasm|php\d?|phtml|asp|aspx|jsp|sh|bat|cmd|cgi|exe|dll|com|msi|scr|hta|vbs|py|r|rb|htaccess)$/i;
|
||||
const BLOCKED_EXT = /\.(?:svg|xml|json|map|wasm|php\d?|phtml|asp|aspx|jsp|sh|bat|cmd|cgi|exe|dll|com|msi|scr|hta|vbs|py|r|rb|htaccess)$/i;
|
||||
const ALLOWED_IMAGE_EXT = new Set(['.jpg', '.jpeg', '.png', '.gif', '.webp', '.bmp', '.avif', '.ico', '.heic', '.heif', '.jfif']);
|
||||
const UPLOAD_FILE_LIMIT_MB = Math.max(1, parseInt(process.env.UPLOAD_FILE_LIMIT_MB || '50', 10) || 50);
|
||||
const UPLOAD_TOTAL_LIMIT_MB = Math.max(UPLOAD_FILE_LIMIT_MB, parseInt(process.env.UPLOAD_TOTAL_LIMIT_MB || '200', 10) || 200);
|
||||
|
||||
Reference in New Issue
Block a user