sealcode 1.3.2 → 1.3.3
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.
- package/package.json +1 -1
- package/src/seal.js +12 -0
package/package.json
CHANGED
package/src/seal.js
CHANGED
|
@@ -49,6 +49,18 @@ function applyStubs(projectRoot, stubs) {
|
|
|
49
49
|
} else {
|
|
50
50
|
throw new Error(`stub for ${relPath} must be string or { contents, mode? }`);
|
|
51
51
|
}
|
|
52
|
+
// sealcode@1.3.3 — if the target file already exists and was set to
|
|
53
|
+
// 0444 (by RO-mode unlock), writeFileSync will EACCES. This is exactly
|
|
54
|
+
// the failure that left RO-violation re-locks half-complete: the
|
|
55
|
+
// watcher detected the tamper, started the re-lock, hit EACCES on the
|
|
56
|
+
// first stub, then exited — leaving every plaintext file exposed on
|
|
57
|
+
// disk with NO watcher running. Force the file writable before we
|
|
58
|
+
// overwrite it.
|
|
59
|
+
try {
|
|
60
|
+
if (fs.existsSync(target)) {
|
|
61
|
+
fs.chmodSync(target, 0o644);
|
|
62
|
+
}
|
|
63
|
+
} catch (_) { /* best-effort; the writeFile below will surface any real error */ }
|
|
52
64
|
writeFileEnsuringDir(target, contents, mode);
|
|
53
65
|
written[relPath] = true;
|
|
54
66
|
}
|