bugproof 0.1.2 → 0.2.2
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/CHANGELOG.md +61 -5
- package/README.md +175 -4
- package/dist/capture/env-snapshot.d.ts +53 -0
- package/dist/capture/env-snapshot.d.ts.map +1 -0
- package/dist/capture/env-snapshot.js +122 -0
- package/dist/capture/env-snapshot.js.map +1 -0
- package/dist/capture/language-support.d.ts +55 -0
- package/dist/capture/language-support.d.ts.map +1 -0
- package/dist/capture/language-support.js +505 -0
- package/dist/capture/language-support.js.map +1 -0
- package/dist/capture/packager.d.ts +9 -0
- package/dist/capture/packager.d.ts.map +1 -1
- package/dist/capture/packager.js +23 -2
- package/dist/capture/packager.js.map +1 -1
- package/dist/capture/source-strategy.d.ts +52 -0
- package/dist/capture/source-strategy.d.ts.map +1 -0
- package/dist/capture/source-strategy.js +227 -0
- package/dist/capture/source-strategy.js.map +1 -0
- package/dist/cli.js +373 -12
- package/dist/cli.js.map +1 -1
- package/dist/config/loader.d.ts +44 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +87 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/replay/engine.d.ts +9 -0
- package/dist/replay/engine.d.ts.map +1 -1
- package/dist/replay/engine.js +29 -3
- package/dist/replay/engine.js.map +1 -1
- package/dist/replay/hints.d.ts +18 -0
- package/dist/replay/hints.d.ts.map +1 -0
- package/dist/replay/hints.js +138 -0
- package/dist/replay/hints.js.map +1 -0
- package/dist/replay/sandbox.js +41 -14
- package/dist/replay/sandbox.js.map +1 -1
- package/dist/replay/verdict.d.ts.map +1 -1
- package/dist/replay/verdict.js +41 -5
- package/dist/replay/verdict.js.map +1 -1
- package/dist/sandbox/bugbox.d.ts.map +1 -1
- package/dist/sandbox/bugbox.js +40 -6
- package/dist/sandbox/bugbox.js.map +1 -1
- package/dist/sandbox/container.d.ts +81 -0
- package/dist/sandbox/container.d.ts.map +1 -0
- package/dist/sandbox/container.js +343 -0
- package/dist/sandbox/container.js.map +1 -0
- package/dist/sandbox/cross-platform.d.ts +59 -0
- package/dist/sandbox/cross-platform.d.ts.map +1 -0
- package/dist/sandbox/cross-platform.js +330 -0
- package/dist/sandbox/cross-platform.js.map +1 -0
- package/dist/sandbox/network.d.ts.map +1 -1
- package/dist/sandbox/network.js +31 -2
- package/dist/sandbox/network.js.map +1 -1
- package/dist/share/gist.d.ts +21 -0
- package/dist/share/gist.d.ts.map +1 -0
- package/dist/share/gist.js +158 -0
- package/dist/share/gist.js.map +1 -0
- package/dist/utils/archive.d.ts +1 -0
- package/dist/utils/archive.d.ts.map +1 -1
- package/dist/utils/archive.js +42 -1
- package/dist/utils/archive.js.map +1 -1
- package/dist/utils/artifact-validation.d.ts +7 -0
- package/dist/utils/artifact-validation.d.ts.map +1 -0
- package/dist/utils/artifact-validation.js +212 -0
- package/dist/utils/artifact-validation.js.map +1 -0
- package/dist/utils/dependencies.d.ts +18 -0
- package/dist/utils/dependencies.d.ts.map +1 -0
- package/dist/utils/dependencies.js +218 -0
- package/dist/utils/dependencies.js.map +1 -0
- package/package.json +3 -2
- package/scripts/postinstall.cjs +38 -5
package/scripts/postinstall.cjs
CHANGED
|
@@ -17,11 +17,11 @@ function isCommandAvailable(command) {
|
|
|
17
17
|
return result.status === 0;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
function runCommand(command, args, timeout = 5000) {
|
|
20
|
+
function runCommand(command, args, timeout = 5000, captureOutput = false) {
|
|
21
21
|
return spawnSync(command, args, {
|
|
22
22
|
encoding: 'utf8',
|
|
23
23
|
timeout,
|
|
24
|
-
stdio: 'ignore',
|
|
24
|
+
stdio: captureOutput ? 'pipe' : 'ignore',
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -56,6 +56,27 @@ function ensureParentDir(filePath) {
|
|
|
56
56
|
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
function isSafeWindowsPath(value) {
|
|
60
|
+
return typeof value === 'string'
|
|
61
|
+
&& value.length > 0
|
|
62
|
+
&& !/[\r\n\0]/.test(value);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function quoteForWindowsCommand(value) {
|
|
66
|
+
if (!isSafeWindowsPath(value)) {
|
|
67
|
+
throw new Error('Unsafe Windows path detected for registry command.');
|
|
68
|
+
}
|
|
69
|
+
return `"${value.replace(/"/g, '\\"')}"`;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function queryRegistryValue(keyPath) {
|
|
73
|
+
const result = runCommand('reg', ['query', keyPath, '/ve'], 5000, true);
|
|
74
|
+
if (result.status !== 0) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
return result.stdout || '';
|
|
78
|
+
}
|
|
79
|
+
|
|
59
80
|
function registerWindowsAssociation() {
|
|
60
81
|
if (process.platform !== 'win32') {
|
|
61
82
|
return;
|
|
@@ -63,7 +84,7 @@ function registerWindowsAssociation() {
|
|
|
63
84
|
|
|
64
85
|
const reg = (args) => runCommand('reg', args, 5000);
|
|
65
86
|
|
|
66
|
-
const openCommand =
|
|
87
|
+
const openCommand = `${quoteForWindowsCommand(process.execPath)} ${quoteForWindowsCommand(cliPath)} replay \"%1\"`;
|
|
67
88
|
|
|
68
89
|
const outcomes = [];
|
|
69
90
|
|
|
@@ -77,7 +98,7 @@ function registerWindowsAssociation() {
|
|
|
77
98
|
'/f',
|
|
78
99
|
]));
|
|
79
100
|
|
|
80
|
-
if (fs.existsSync(iconPath)) {
|
|
101
|
+
if (fs.existsSync(iconPath) && isSafeWindowsPath(iconPath)) {
|
|
81
102
|
outcomes.push(reg([
|
|
82
103
|
'add',
|
|
83
104
|
'HKCU\\Software\\Classes\\BugProof.Artifact\\DefaultIcon',
|
|
@@ -101,6 +122,11 @@ function registerWindowsAssociation() {
|
|
|
101
122
|
if (failed) {
|
|
102
123
|
log('WARNING: Windows .bug association setup partially failed. Run scripts/bugproof-file-association-windows.reg manually.');
|
|
103
124
|
} else {
|
|
125
|
+
const commandQuery = queryRegistryValue('HKCU\\Software\\Classes\\BugProof.Artifact\\shell\\open\\command');
|
|
126
|
+
if (!commandQuery || !commandQuery.includes(openCommand)) {
|
|
127
|
+
log('WARNING: Windows association write could not be verified. Run scripts/bugproof-file-association-windows.reg manually.');
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
104
130
|
log('Windows .bug file association registered (HKCU).');
|
|
105
131
|
}
|
|
106
132
|
}
|
|
@@ -212,4 +238,11 @@ function main() {
|
|
|
212
238
|
}
|
|
213
239
|
}
|
|
214
240
|
|
|
215
|
-
main
|
|
241
|
+
if (require.main === module) {
|
|
242
|
+
main();
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
module.exports = {
|
|
246
|
+
isSafeWindowsPath,
|
|
247
|
+
quoteForWindowsCommand,
|
|
248
|
+
};
|