javi-forge 1.30.0 → 1.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -198,6 +198,9 @@ export function createPosixSecureFs(acl) {
|
|
|
198
198
|
const handle = await open(target, CAPTURE_FLAGS);
|
|
199
199
|
try {
|
|
200
200
|
const stats = await handle.stat();
|
|
201
|
+
if (!stats.isFile()) {
|
|
202
|
+
return refuse("unsafe-parent-chain", `capture ${target}: not a regular file`);
|
|
203
|
+
}
|
|
201
204
|
const bytes = await handle.readFile();
|
|
202
205
|
const sha256 = createHash("sha256").update(bytes).digest("hex");
|
|
203
206
|
return okValue({
|
|
@@ -227,7 +227,11 @@ export async function runTransaction(input) {
|
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
229
|
await secureFs.applyExactMode(path.join(entry.dir.path, rName), entry.prior.mode);
|
|
230
|
-
await secureFs.renameInDir(entry.dir, rName, base);
|
|
230
|
+
const restored = await secureFs.renameInDir(entry.dir, rName, base);
|
|
231
|
+
if (!restored.ok) {
|
|
232
|
+
errors.push(`STOP: cannot restore ${entry.path}; prior payload staged at ${path.join(entry.dir.path, rName)} for manual recovery`);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
231
235
|
}
|
|
232
236
|
}
|
|
233
237
|
// Remove only tx-created, identity-matched, still-empty segments, child-first.
|