tighten permission checks and input validation across the api

This commit is contained in:
Jarek Krochmalski committed 2026-09-02 15:52:44 +02:00
1 parent 77686da02a
commit 5af4e69eb2
47 files changed
+721 -225

No files matched your search

+10
View File
@@ -43,4 +43,14 @@ describe('isDeletableStackDir', () => {
it('a "../" escape resolves out and is NOT deletable', () => {
expect(isDeletableStackDir('/data/stacks/../evil', STACKS, 'evil')).toBe(false);
});
it('traversal name "..": getStackDir("..") resolves to DATA_DIR and is NOT deletable', () => {
// join(STACKS, '..') = '/data' (DATA_DIR). basename '/data' = 'data' != '..' AND not a
// strict subdir of /data/stacks -> blocked. Guards the removeStack fallback branch.
expect(isDeletableStackDir('/data', STACKS, '..')).toBe(false);
});
it('traversal name "../..": resolves above DATA_DIR and is NOT deletable', () => {
expect(isDeletableStackDir('/', STACKS, '../..')).toBe(false);
});
});