sandboxbox 1.0.8 → 1.0.9

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sandboxbox",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Zero-privilege container runner with Playwright support",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/scripts/build.js CHANGED
@@ -46,26 +46,21 @@ async function downloadAndBuild() {
46
46
  }
47
47
  }
48
48
 
49
- // Try to use system bubblewrap first (fallback option)
50
- try {
51
- const systemBwrap = execSync('which bwrap', { encoding: 'utf8' }).trim();
52
- if (systemBwrap && fs.existsSync(systemBwrap)) {
53
- fs.copyFileSync(systemBwrap, binaryPath);
54
- fs.chmodSync(binaryPath, 0o755);
55
- console.log('✅ Using system bubblewrap:', systemBwrap);
56
- return;
57
- }
58
- } catch (e) {
59
- // System bwrap not found, continue with build
60
- }
61
-
62
- // Try to download pre-built binary first
63
- if (await downloadPreBuiltBinary(binaryPath)) {
64
- return;
49
+ // Build from source like SQLite does - the ONLY method
50
+ if (await buildFromSource(binaryPath)) {
51
+ return; // Build succeeded
52
+ } else {
53
+ // Build failed - exit with error to make the problem visible
54
+ console.error('❌ Bubblewrap build failed!');
55
+ console.error('');
56
+ console.error('💡 Install build tools:');
57
+ console.error(' Ubuntu/Debian: sudo apt-get install build-essential autoconf automake libtool xz-utils');
58
+ console.error(' CentOS/RHEL: sudo yum groupinstall "Development Tools" && sudo yum install xz');
59
+ console.error('');
60
+ console.error('🚫 SandboxBox cannot function without bubblewrap.');
61
+ console.error(' Please install build tools and try again.');
62
+ process.exit(1);
65
63
  }
66
-
67
- // Build from source like SQLite does as last resort
68
- await buildFromSource(binaryPath);
69
64
  }
70
65
 
71
66
  async function downloadPreBuiltBinary(binaryPath) {
@@ -260,30 +255,33 @@ async function buildFromSource(binaryPath) {
260
255
  missingTools.push('xz');
261
256
  }
262
257
 
258
+ try {
259
+ execSync('which autoconf', { stdio: 'ignore' });
260
+ } catch (e) {
261
+ missingTools.push('autoconf');
262
+ }
263
+
264
+ try {
265
+ execSync('which automake', { stdio: 'ignore' });
266
+ } catch (e) {
267
+ missingTools.push('automake');
268
+ }
269
+
270
+ try {
271
+ execSync('which libtool', { stdio: 'ignore' });
272
+ } catch (e) {
273
+ missingTools.push('libtool');
274
+ }
275
+
263
276
  if (missingTools.length > 0) {
264
- console.log(`⚠️ Missing build tools: ${missingTools.join(', ')}`);
265
- console.log(' On Ubuntu/Debian: sudo apt-get install build-essential xz-utils');
266
- console.log(' On CentOS/RHEL: sudo yum groupinstall "Development Tools" && sudo yum install xz');
267
- console.log(' Falling back to system bubblewrap check...');
268
-
269
- // Create a placeholder binary that will show helpful error
270
- const placeholderScript = `#!/bin/bash
271
- echo "❌ Bubblewrap not available"
272
- echo ""
273
- echo "💡 Install bubblewrap system-wide:"
274
- echo " sudo apt-get install bubblewrap # Ubuntu/Debian"
275
- echo " sudo apk add bubblewrap # Alpine"
276
- echo " sudo yum install bubblewrap # CentOS/RHEL"
277
- echo ""
278
- echo "Or install build tools and reinstall SandboxBox:"
279
- echo " sudo apt-get install build-essential xz-utils"
280
- echo " npm uninstall sandboxbox && npm install sandboxbox"
281
- exit 1
282
- `;
283
- fs.writeFileSync(binaryPath, placeholderScript);
284
- fs.chmodSync(binaryPath, 0o755);
285
- console.log('📝 Created placeholder binary with installation instructions');
286
- return;
277
+ console.error(`❌ Missing build tools: ${missingTools.join(', ')}`);
278
+ console.error('');
279
+ console.error('💡 Install build tools:');
280
+ console.error(' Ubuntu/Debian: sudo apt-get install build-essential autoconf automake libtool xz-utils');
281
+ console.error(' CentOS/RHEL: sudo yum groupinstall "Development Tools" && sudo yum install xz');
282
+ console.error('');
283
+ console.error('🚫 SandboxBox requires these build tools to compile bubblewrap.');
284
+ return false; // Indicate build failed
287
285
  }
288
286
 
289
287
  // Configure and build
@@ -315,10 +313,15 @@ exit 1
315
313
  // Test the binary
316
314
  const version = execSync(`"${binaryPath}" --version`, { encoding: 'utf8' });
317
315
  console.log(`🎯 Built: ${version.trim()}`);
316
+ return true; // Build succeeded
318
317
  } else {
319
- throw new Error('Built binary not found');
318
+ console.log('Built binary not found');
319
+ return false; // Build failed
320
320
  }
321
321
 
322
+ } catch (error) {
323
+ console.log(`❌ Build from source failed: ${error.message}`);
324
+ return false; // Build failed
322
325
  } finally {
323
326
  // Cleanup
324
327
  fs.rmSync(tmpDir, { recursive: true, force: true });
@@ -327,12 +330,11 @@ exit 1
327
330
 
328
331
  // Run the build
329
332
  downloadAndBuild().catch(error => {
330
- console.error('❌ Build failed:', error.message);
331
- console.log('💡 SandboxBox will still work with system bubblewrap if available');
332
-
333
- // Create a minimal fallback as last resort
334
- createMinimalBubblewrap(path.join(BINARY_DIR, 'bwrap'));
335
- process.exit(0); // Don't fail npm install
333
+ console.error('❌ Bubblewrap build failed:', error.message);
334
+ console.error('');
335
+ console.error('🚫 SandboxBox cannot function without bubblewrap.');
336
+ console.error(' Please install build tools and try again.');
337
+ process.exit(1);
336
338
  });
337
339
 
338
340
  function createMinimalBubblewrap(binaryPath) {
package/bin/bwrap DELETED
@@ -1,50 +0,0 @@
1
- #!/bin/bash
2
- # Minimal bubblewrap fallback for SandboxBox
3
- # This provides basic namespace isolation functionality
4
-
5
- # Handle --version flag for compatibility
6
- if [[ "$1" == "--version" ]]; then
7
- echo "bubblewrap 0.11.0 (minimal fallback for SandboxBox)"
8
- exit 0
9
- fi
10
-
11
- # Handle --help flag
12
- if [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]]; then
13
- echo "bubblewrap - minimal fallback version"
14
- echo ""
15
- echo "⚠️ This is a minimal fallback for SandboxBox"
16
- echo "💡 For full functionality, install bubblewrap:"
17
- echo " sudo apt-get install bubblewrap"
18
- echo ""
19
- echo "Usage: bwrap [options] -- command [args]"
20
- exit 0
21
- fi
22
-
23
- echo "⚠️ Using minimal bubblewrap fallback"
24
- echo "💡 For full functionality, install bubblewrap:"
25
- echo " sudo apt-get install bubblewrap"
26
- echo ""
27
-
28
- # Filter out bubblewrap-specific options that unshare doesn't support
29
- ARGS=()
30
- for arg in "$@"; do
31
- case "$arg" in
32
- --ro-bind|--bind|--dev-bind|--proc|--tmpfs|--symlink|--dir|--file|--setenv|--die-with-parent|--new-session|--share-net|--unshare-net|--unshare-pid|--unshare-ipc|--unshare-uts|--unshare-cgroup|--unshare-user)
33
- # Skip bubblewrap-specific options
34
- ;;
35
- *)
36
- ARGS+=("$arg")
37
- ;;
38
- esac
39
- done
40
-
41
- # Basic namespace isolation using unshare
42
- exec unshare \
43
- --pid \
44
- --mount \
45
- --uts \
46
- --ipc \
47
- --net \
48
- --fork \
49
- --mount-proc \
50
- "${ARGS[@]}"