muaddib-scanner 2.10.53 → 2.10.54
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/sandbox/index.js +26 -0
package/package.json
CHANGED
package/src/sandbox/index.js
CHANGED
|
@@ -396,6 +396,32 @@ async function runSingleSandbox(packageName, options = {}) {
|
|
|
396
396
|
}
|
|
397
397
|
} catch (e) {
|
|
398
398
|
console.log('[SANDBOX] Failed to parse container output:', e.message);
|
|
399
|
+
// ── Debug: identify what corrupted the JSON report ──
|
|
400
|
+
const dbgDelim = stdout.lastIndexOf('---MUADDIB-REPORT-START---');
|
|
401
|
+
console.log(`[SANDBOX] DEBUG: stdout.length=${stdout.length}, delimiter_pos=${dbgDelim}`);
|
|
402
|
+
if (dbgDelim !== -1) {
|
|
403
|
+
const afterDelim = stdout.substring(dbgDelim);
|
|
404
|
+
// Show first 300 chars after delimiter (where JSON should start)
|
|
405
|
+
console.log('[SANDBOX] DEBUG after delimiter (first 300):', afterDelim.substring(0, 300));
|
|
406
|
+
// Show last 300 chars of stdout (where truncation happened)
|
|
407
|
+
console.log('[SANDBOX] DEBUG stdout tail (last 300):', stdout.substring(Math.max(0, stdout.length - 300)));
|
|
408
|
+
// Check for non-JSON content mixed in
|
|
409
|
+
const jsonPart = afterDelim.substring('---MUADDIB-REPORT-START---'.length).trim();
|
|
410
|
+
const firstBrace = jsonPart.indexOf('{');
|
|
411
|
+
if (firstBrace > 0) {
|
|
412
|
+
console.log('[SANDBOX] DEBUG garbage before JSON:', JSON.stringify(jsonPart.substring(0, firstBrace)));
|
|
413
|
+
}
|
|
414
|
+
const lastBrace = jsonPart.lastIndexOf('}');
|
|
415
|
+
if (lastBrace !== -1 && lastBrace < jsonPart.length - 1) {
|
|
416
|
+
console.log('[SANDBOX] DEBUG garbage after JSON:', JSON.stringify(jsonPart.substring(lastBrace + 1)));
|
|
417
|
+
}
|
|
418
|
+
if (lastBrace === -1) {
|
|
419
|
+
console.log('[SANDBOX] DEBUG no closing brace found — JSON truncated');
|
|
420
|
+
}
|
|
421
|
+
} else {
|
|
422
|
+
// No delimiter at all — show what's in stdout
|
|
423
|
+
console.log('[SANDBOX] DEBUG no delimiter found, stdout preview:', stdout.substring(0, 500));
|
|
424
|
+
}
|
|
399
425
|
resolve(cleanResult);
|
|
400
426
|
return;
|
|
401
427
|
}
|