mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-05 02:43:32 +00:00
fix(docker-server): reject null bytes in resolvePath
Defensively harden the path traversal guard by returning null early when the URL contains a null byte, before normalization runs. Made-with: Cursor
This commit is contained in:
parent
3504945367
commit
856d9a4b97
1 changed files with 1 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ const contentTypes = {
|
|||
};
|
||||
|
||||
function resolvePath(urlPath) {
|
||||
if (urlPath.includes('\0')) return null;
|
||||
const cleanPath = normalize(decodeURIComponent(urlPath).replace(/^\/+/, ''));
|
||||
const candidate = join(root, cleanPath);
|
||||
if (!candidate.startsWith(root)) return null;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue