mirror of
https://github.com/Nystik-gh/ignis.git
synced 2026-06-17 04:35:53 +00:00
harden demo sessions
This commit is contained in:
@@ -80,6 +80,14 @@ async function provisionVault(sessionId, userVaultName) {
|
||||
const storageName = makeStorageName(sessionId, userVaultName);
|
||||
const vaultPath = path.join(config.vaultRoot, storageName);
|
||||
|
||||
// keep the resolved path inside the vault root.
|
||||
const root = path.resolve(config.vaultRoot);
|
||||
const resolved = path.resolve(vaultPath);
|
||||
|
||||
if (resolved !== root && !resolved.startsWith(root + path.sep)) {
|
||||
return { error: "invalid-vault-name" };
|
||||
}
|
||||
|
||||
await fsp.mkdir(config.vaultRoot, { recursive: true });
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user