sandboxedjs 0.1.73 → 0.1.75

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.
@@ -1,4 +1,4 @@
1
- import { R as RuntimeVolume, d as VolumeStat, e as VolumeStats } from './contracts-CVgctitO.js';
1
+ import { R as RuntimeVolume, d as VolumeStat, e as VolumeStats } from './contracts-C2_dTgk3.js';
2
2
 
3
3
  type NodeKind = "file" | "directory" | "symlink";
4
4
  interface MemoryVolumeSnapshotEntry {
@@ -1,4 +1,4 @@
1
- import { R as RuntimeVolume, d as VolumeStat, e as VolumeStats } from './contracts-CVgctitO.cjs';
1
+ import { R as RuntimeVolume, d as VolumeStat, e as VolumeStats } from './contracts-C2_dTgk3.cjs';
2
2
 
3
3
  type NodeKind = "file" | "directory" | "symlink";
4
4
  interface MemoryVolumeSnapshotEntry {
@@ -1139,6 +1139,12 @@ var VirtualTcpSocket = class _VirtualTcpSocket {
1139
1139
  }
1140
1140
  connect(port, address = "127.0.0.1") {
1141
1141
  if (this.listenerValue || this.connectionValue) throw new PosixError(Errno.EISCONN);
1142
+ if (!isLoopback(address)) {
1143
+ throw new PosixError(
1144
+ Errno.ENETUNREACH,
1145
+ `cannot reach ${address}:${port}: outbound network access is not available through raw sockets in this container; only loopback is routed`
1146
+ );
1147
+ }
1142
1148
  this.connectionValue = this.network.connect(port, this.boundPort, this.boundAddress);
1143
1149
  this.boundPort = this.connectionValue.local.port;
1144
1150
  this.boundAddress = this.connectionValue.local.address;
@@ -1275,6 +1281,11 @@ var SocketDescription = class _SocketDescription {
1275
1281
  return peer;
1276
1282
  }
1277
1283
  };
1284
+ function isLoopback(address) {
1285
+ if (address === "" || address === "localhost" || address === "0.0.0.0") return true;
1286
+ if (address === "::1" || address === "::" || address === "[::1]") return true;
1287
+ return /^127\./.test(address);
1288
+ }
1278
1289
 
1279
1290
  // src/python/syscall-server.ts
1280
1291
  var MAX_TRANSFER = 8 * 1024 * 1024;
@@ -1983,6 +1994,7 @@ var ERRNO = {
1983
1994
  ECONNRESET: 104,
1984
1995
  ENOTCONN: 107,
1985
1996
  ETIMEDOUT: 110,
1997
+ ENETUNREACH: 101,
1986
1998
  ECONNREFUSED: 111,
1987
1999
  EHOSTUNREACH: 113,
1988
2000
  ENOTSUP: 95
@@ -2036,6 +2048,7 @@ var STRERROR = {
2036
2048
  ECONNRESET: "Connection reset by peer",
2037
2049
  ENOTCONN: "Transport endpoint is not connected",
2038
2050
  ETIMEDOUT: "Connection timed out",
2051
+ ENETUNREACH: "Network is unreachable",
2039
2052
  ECONNREFUSED: "Connection refused",
2040
2053
  EHOSTUNREACH: "No route to host",
2041
2054
  ENOTSUP: "Operation not supported"