isol8 0.8.3 → 0.9.0-alpha.0
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/dist/cli.js +390 -78
- package/dist/docker/proxy-handler.sh +8 -0
- package/dist/docker/proxy.sh +3 -0
- package/dist/index.js +325 -13
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/engine/audit.d.ts +31 -0
- package/dist/src/engine/audit.d.ts.map +1 -0
- package/dist/src/engine/docker.d.ts +9 -0
- package/dist/src/engine/docker.d.ts.map +1 -1
- package/dist/src/engine/image-builder.d.ts.map +1 -1
- package/dist/src/engine/stats.d.ts +35 -0
- package/dist/src/engine/stats.d.ts.map +1 -0
- package/dist/src/server/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +85 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +2 -1
- package/schema/isol8.config.schema.json +47 -0
package/dist/cli.js
CHANGED
|
@@ -5038,23 +5038,23 @@ var require_nacl_fast = __commonJS((exports, module) => {
|
|
|
5038
5038
|
randombytes = fn;
|
|
5039
5039
|
};
|
|
5040
5040
|
(function() {
|
|
5041
|
-
var
|
|
5042
|
-
if (
|
|
5041
|
+
var crypto2 = typeof self !== "undefined" ? self.crypto || self.msCrypto : null;
|
|
5042
|
+
if (crypto2 && crypto2.getRandomValues) {
|
|
5043
5043
|
var QUOTA = 65536;
|
|
5044
5044
|
nacl.setPRNG(function(x, n) {
|
|
5045
5045
|
var i, v = new Uint8Array(n);
|
|
5046
5046
|
for (i = 0;i < n; i += QUOTA) {
|
|
5047
|
-
|
|
5047
|
+
crypto2.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
|
|
5048
5048
|
}
|
|
5049
5049
|
for (i = 0;i < n; i++)
|
|
5050
5050
|
x[i] = v[i];
|
|
5051
5051
|
cleanup(v);
|
|
5052
5052
|
});
|
|
5053
5053
|
} else if (true) {
|
|
5054
|
-
|
|
5055
|
-
if (
|
|
5054
|
+
crypto2 = __require("crypto");
|
|
5055
|
+
if (crypto2 && crypto2.randomBytes) {
|
|
5056
5056
|
nacl.setPRNG(function(x, n) {
|
|
5057
|
-
var i, v =
|
|
5057
|
+
var i, v = crypto2.randomBytes(n);
|
|
5058
5058
|
for (i = 0;i < n; i++)
|
|
5059
5059
|
x[i] = v[i];
|
|
5060
5060
|
cleanup(v);
|
|
@@ -6318,7 +6318,7 @@ var require_bcrypt_pbkdf = __commonJS((exports, module) => {
|
|
|
6318
6318
|
|
|
6319
6319
|
// node_modules/cpu-features/build/Release/cpufeatures.node
|
|
6320
6320
|
var require_cpufeatures = __commonJS((exports, module) => {
|
|
6321
|
-
module.exports = __require("./cpufeatures-
|
|
6321
|
+
module.exports = __require("./cpufeatures-8g73ch7n.node");
|
|
6322
6322
|
});
|
|
6323
6323
|
|
|
6324
6324
|
// node_modules/cpu-features/lib/index.js
|
|
@@ -6329,14 +6329,14 @@ var require_lib2 = __commonJS((exports, module) => {
|
|
|
6329
6329
|
|
|
6330
6330
|
// node_modules/ssh2/lib/protocol/constants.js
|
|
6331
6331
|
var require_constants = __commonJS((exports, module) => {
|
|
6332
|
-
var
|
|
6332
|
+
var crypto2 = __require("crypto");
|
|
6333
6333
|
var cpuInfo;
|
|
6334
6334
|
try {
|
|
6335
6335
|
cpuInfo = require_lib2()();
|
|
6336
6336
|
} catch {}
|
|
6337
6337
|
var { bindingAvailable, CIPHER_INFO, MAC_INFO } = require_crypto();
|
|
6338
6338
|
var eddsaSupported = (() => {
|
|
6339
|
-
if (typeof
|
|
6339
|
+
if (typeof crypto2.sign === "function" && typeof crypto2.verify === "function") {
|
|
6340
6340
|
const key = `-----BEGIN PRIVATE KEY-----\r
|
|
6341
6341
|
MC4CAQAwBQYDK2VwBCIEIHKj+sVa9WcD` + `/q2DJUJaf43Kptc8xYuUQA4bOFj9vC8T\r
|
|
6342
6342
|
-----END PRIVATE KEY-----`;
|
|
@@ -6344,14 +6344,14 @@ MC4CAQAwBQYDK2VwBCIEIHKj+sVa9WcD` + `/q2DJUJaf43Kptc8xYuUQA4bOFj9vC8T\r
|
|
|
6344
6344
|
let sig;
|
|
6345
6345
|
let verified;
|
|
6346
6346
|
try {
|
|
6347
|
-
sig =
|
|
6348
|
-
verified =
|
|
6347
|
+
sig = crypto2.sign(null, data, key);
|
|
6348
|
+
verified = crypto2.verify(null, data, key, sig);
|
|
6349
6349
|
} catch {}
|
|
6350
6350
|
return Buffer.isBuffer(sig) && sig.length === 64 && verified === true;
|
|
6351
6351
|
}
|
|
6352
6352
|
return false;
|
|
6353
6353
|
})();
|
|
6354
|
-
var curve25519Supported = typeof
|
|
6354
|
+
var curve25519Supported = typeof crypto2.diffieHellman === "function" && typeof crypto2.generateKeyPairSync === "function" && typeof crypto2.createPublicKey === "function";
|
|
6355
6355
|
var DEFAULT_KEX = [
|
|
6356
6356
|
"ecdh-sha2-nistp256",
|
|
6357
6357
|
"ecdh-sha2-nistp384",
|
|
@@ -6386,7 +6386,7 @@ MC4CAQAwBQYDK2VwBCIEIHKj+sVa9WcD` + `/q2DJUJaf43Kptc8xYuUQA4bOFj9vC8T\r
|
|
|
6386
6386
|
"ssh-dss"
|
|
6387
6387
|
]);
|
|
6388
6388
|
var canUseCipher = (() => {
|
|
6389
|
-
const ciphers =
|
|
6389
|
+
const ciphers = crypto2.getCiphers();
|
|
6390
6390
|
return (name) => ciphers.includes(CIPHER_INFO[name].sslName);
|
|
6391
6391
|
})();
|
|
6392
6392
|
var DEFAULT_CIPHER = [
|
|
@@ -6421,7 +6421,7 @@ MC4CAQAwBQYDK2VwBCIEIHKj+sVa9WcD` + `/q2DJUJaf43Kptc8xYuUQA4bOFj9vC8T\r
|
|
|
6421
6421
|
"arcfour"
|
|
6422
6422
|
].filter(canUseCipher));
|
|
6423
6423
|
var canUseMAC = (() => {
|
|
6424
|
-
const hashes =
|
|
6424
|
+
const hashes = crypto2.getHashes();
|
|
6425
6425
|
return (name) => hashes.includes(MAC_INFO[name].sslName);
|
|
6426
6426
|
})();
|
|
6427
6427
|
var DEFAULT_MAC = [
|
|
@@ -6931,12 +6931,12 @@ var require_utils2 = __commonJS((exports, module) => {
|
|
|
6931
6931
|
|
|
6932
6932
|
// node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node
|
|
6933
6933
|
var require_sshcrypto = __commonJS((exports, module) => {
|
|
6934
|
-
module.exports = __require("./sshcrypto-
|
|
6934
|
+
module.exports = __require("./sshcrypto-f6atjna1.node");
|
|
6935
6935
|
});
|
|
6936
6936
|
|
|
6937
6937
|
// node_modules/ssh2/lib/protocol/crypto/poly1305.js
|
|
6938
6938
|
var require_poly1305 = __commonJS((exports, module) => {
|
|
6939
|
-
var __dirname = "/
|
|
6939
|
+
var __dirname = "/Users/dhruv/Developer/Projects/isol8/node_modules/ssh2/lib/protocol/crypto", __filename = "/Users/dhruv/Developer/Projects/isol8/node_modules/ssh2/lib/protocol/crypto/poly1305.js";
|
|
6940
6940
|
var createPoly1305 = function() {
|
|
6941
6941
|
var _scriptDir = typeof document !== "undefined" && document.currentScript ? document.currentScript.src : undefined;
|
|
6942
6942
|
if (typeof __filename !== "undefined")
|
|
@@ -8681,7 +8681,7 @@ ${formatted}-----END ${type} KEY-----`;
|
|
|
8681
8681
|
}
|
|
8682
8682
|
return Buffer.from(hex, "hex");
|
|
8683
8683
|
}
|
|
8684
|
-
return function
|
|
8684
|
+
return function genOpenSSLRSAPriv(n, e, d, iqmp, p, q) {
|
|
8685
8685
|
const bn_d = bigIntFromBuffer(d);
|
|
8686
8686
|
const dmp1 = bigIntToBuffer(bn_d % (bigIntFromBuffer(p) - 1n));
|
|
8687
8687
|
const dmq1 = bigIntToBuffer(bn_d % (bigIntFromBuffer(q) - 1n));
|
|
@@ -9709,7 +9709,7 @@ ${formatted}-----END ${type} KEY-----`;
|
|
|
9709
9709
|
|
|
9710
9710
|
// node_modules/ssh2/lib/agent.js
|
|
9711
9711
|
var require_agent = __commonJS((exports, module) => {
|
|
9712
|
-
var __dirname = "/
|
|
9712
|
+
var __dirname = "/Users/dhruv/Developer/Projects/isol8/node_modules/ssh2/lib";
|
|
9713
9713
|
var { Socket } = __require("net");
|
|
9714
9714
|
var { Duplex } = __require("stream");
|
|
9715
9715
|
var { resolve } = __require("path");
|
|
@@ -21682,7 +21682,7 @@ var require__stream_writable = __commonJS((exports, module) => {
|
|
|
21682
21682
|
}
|
|
21683
21683
|
});
|
|
21684
21684
|
} else {
|
|
21685
|
-
realHasInstance = function
|
|
21685
|
+
realHasInstance = function realHasInstance(object) {
|
|
21686
21686
|
return object instanceof this;
|
|
21687
21687
|
};
|
|
21688
21688
|
}
|
|
@@ -22480,28 +22480,28 @@ var require_end_of_stream = __commonJS((exports, module) => {
|
|
|
22480
22480
|
callback = once(callback || noop);
|
|
22481
22481
|
var readable = opts.readable || opts.readable !== false && stream.readable;
|
|
22482
22482
|
var writable = opts.writable || opts.writable !== false && stream.writable;
|
|
22483
|
-
var onlegacyfinish = function
|
|
22483
|
+
var onlegacyfinish = function onlegacyfinish() {
|
|
22484
22484
|
if (!stream.writable)
|
|
22485
22485
|
onfinish();
|
|
22486
22486
|
};
|
|
22487
22487
|
var writableEnded = stream._writableState && stream._writableState.finished;
|
|
22488
|
-
var onfinish = function
|
|
22488
|
+
var onfinish = function onfinish() {
|
|
22489
22489
|
writable = false;
|
|
22490
22490
|
writableEnded = true;
|
|
22491
22491
|
if (!readable)
|
|
22492
22492
|
callback.call(stream);
|
|
22493
22493
|
};
|
|
22494
22494
|
var readableEnded = stream._readableState && stream._readableState.endEmitted;
|
|
22495
|
-
var onend = function
|
|
22495
|
+
var onend = function onend() {
|
|
22496
22496
|
readable = false;
|
|
22497
22497
|
readableEnded = true;
|
|
22498
22498
|
if (!writable)
|
|
22499
22499
|
callback.call(stream);
|
|
22500
22500
|
};
|
|
22501
|
-
var onerror = function
|
|
22501
|
+
var onerror = function onerror(err) {
|
|
22502
22502
|
callback.call(stream, err);
|
|
22503
22503
|
};
|
|
22504
|
-
var onclose = function
|
|
22504
|
+
var onclose = function onclose() {
|
|
22505
22505
|
var err;
|
|
22506
22506
|
if (readable && !readableEnded) {
|
|
22507
22507
|
if (!stream._readableState || !stream._readableState.ended)
|
|
@@ -22514,7 +22514,7 @@ var require_end_of_stream = __commonJS((exports, module) => {
|
|
|
22514
22514
|
return callback.call(stream, err);
|
|
22515
22515
|
}
|
|
22516
22516
|
};
|
|
22517
|
-
var onrequest = function
|
|
22517
|
+
var onrequest = function onrequest() {
|
|
22518
22518
|
stream.req.on("finish", onfinish);
|
|
22519
22519
|
};
|
|
22520
22520
|
if (isRequest(stream)) {
|
|
@@ -22671,7 +22671,7 @@ var require_async_iterator = __commonJS((exports, module) => {
|
|
|
22671
22671
|
});
|
|
22672
22672
|
});
|
|
22673
22673
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
22674
|
-
var createReadableStreamAsyncIterator = function
|
|
22674
|
+
var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {
|
|
22675
22675
|
var _Object$create;
|
|
22676
22676
|
var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {
|
|
22677
22677
|
value: stream,
|
|
@@ -22860,7 +22860,7 @@ var require__stream_readable = __commonJS((exports, module) => {
|
|
|
22860
22860
|
var Duplex;
|
|
22861
22861
|
Readable.ReadableState = ReadableState;
|
|
22862
22862
|
var EE = __require("events").EventEmitter;
|
|
22863
|
-
var EElistenerCount = function
|
|
22863
|
+
var EElistenerCount = function EElistenerCount(emitter, type) {
|
|
22864
22864
|
return emitter.listeners(type).length;
|
|
22865
22865
|
};
|
|
22866
22866
|
var Stream = __require("stream");
|
|
@@ -22877,7 +22877,7 @@ var require__stream_readable = __commonJS((exports, module) => {
|
|
|
22877
22877
|
if (debugUtil && debugUtil.debuglog) {
|
|
22878
22878
|
debug = debugUtil.debuglog("stream");
|
|
22879
22879
|
} else {
|
|
22880
|
-
debug = function
|
|
22880
|
+
debug = function debug() {};
|
|
22881
22881
|
}
|
|
22882
22882
|
var BufferList = require_buffer_list();
|
|
22883
22883
|
var destroyImpl = require_destroy();
|
|
@@ -25535,14 +25535,14 @@ var require_BufferList = __commonJS((exports, module) => {
|
|
|
25535
25535
|
if (srcEnd <= 0) {
|
|
25536
25536
|
return dst || Buffer2.alloc(0);
|
|
25537
25537
|
}
|
|
25538
|
-
const
|
|
25538
|
+
const copy = !!dst;
|
|
25539
25539
|
const off = this._offset(srcStart);
|
|
25540
25540
|
const len = srcEnd - srcStart;
|
|
25541
25541
|
let bytes = len;
|
|
25542
|
-
let bufoff =
|
|
25542
|
+
let bufoff = copy && dstStart || 0;
|
|
25543
25543
|
let start = off[1];
|
|
25544
25544
|
if (srcStart === 0 && srcEnd === this.length) {
|
|
25545
|
-
if (!
|
|
25545
|
+
if (!copy) {
|
|
25546
25546
|
return this._bufs.length === 1 ? this._bufs[0] : Buffer2.concat(this._bufs, this.length);
|
|
25547
25547
|
}
|
|
25548
25548
|
for (let i = 0;i < this._bufs.length; i++) {
|
|
@@ -25552,9 +25552,9 @@ var require_BufferList = __commonJS((exports, module) => {
|
|
|
25552
25552
|
return dst;
|
|
25553
25553
|
}
|
|
25554
25554
|
if (bytes <= this._bufs[off[0]].length - start) {
|
|
25555
|
-
return
|
|
25555
|
+
return copy ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes) : this._bufs[off[0]].slice(start, start + bytes);
|
|
25556
25556
|
}
|
|
25557
|
-
if (!
|
|
25557
|
+
if (!copy) {
|
|
25558
25558
|
dst = Buffer2.allocUnsafe(len);
|
|
25559
25559
|
}
|
|
25560
25560
|
for (let i = off[0];i < this._bufs.length; i++) {
|
|
@@ -25776,7 +25776,7 @@ var require_bl = __commonJS((exports, module) => {
|
|
|
25776
25776
|
}
|
|
25777
25777
|
if (typeof callback === "function") {
|
|
25778
25778
|
this._callback = callback;
|
|
25779
|
-
const piper = function
|
|
25779
|
+
const piper = function piper(err) {
|
|
25780
25780
|
if (this._callback) {
|
|
25781
25781
|
this._callback(err);
|
|
25782
25782
|
this._callback = null;
|
|
@@ -34839,7 +34839,7 @@ var require_writer2 = __commonJS((exports, module) => {
|
|
|
34839
34839
|
this.tail = this.head;
|
|
34840
34840
|
this.states = null;
|
|
34841
34841
|
}
|
|
34842
|
-
var create = function
|
|
34842
|
+
var create = function create() {
|
|
34843
34843
|
return util.Buffer ? function create_buffer_setup() {
|
|
34844
34844
|
return (Writer.create = function create_buffer() {
|
|
34845
34845
|
return new BufferWriter;
|
|
@@ -35063,12 +35063,12 @@ var require_reader2 = __commonJS((exports, module) => {
|
|
|
35063
35063
|
if (buffer instanceof Uint8Array || Array.isArray(buffer))
|
|
35064
35064
|
return new Reader(buffer);
|
|
35065
35065
|
throw Error("illegal buffer");
|
|
35066
|
-
} : function
|
|
35066
|
+
} : function create_array(buffer) {
|
|
35067
35067
|
if (Array.isArray(buffer))
|
|
35068
35068
|
return new Reader(buffer);
|
|
35069
35069
|
throw Error("illegal buffer");
|
|
35070
35070
|
};
|
|
35071
|
-
var create = function
|
|
35071
|
+
var create = function create() {
|
|
35072
35072
|
return util.Buffer ? function create_buffer_setup(buffer) {
|
|
35073
35073
|
return (Reader.create = function create_buffer(buffer2) {
|
|
35074
35074
|
return util.Buffer.isBuffer(buffer2) ? new BufferReader(buffer2) : create_array(buffer2);
|
|
@@ -35494,10 +35494,10 @@ var require_fetch = __commonJS((exports, module) => {
|
|
|
35494
35494
|
// node_modules/@protobufjs/path/index.js
|
|
35495
35495
|
var require_path = __commonJS((exports) => {
|
|
35496
35496
|
var path = exports;
|
|
35497
|
-
var isAbsolute = path.isAbsolute = function
|
|
35497
|
+
var isAbsolute = path.isAbsolute = function isAbsolute(path2) {
|
|
35498
35498
|
return /^(?:\/|\w+:)/.test(path2);
|
|
35499
35499
|
};
|
|
35500
|
-
var normalize = path.normalize = function
|
|
35500
|
+
var normalize = path.normalize = function normalize(path2) {
|
|
35501
35501
|
path2 = path2.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
|
|
35502
35502
|
var parts = path2.split("/"), absolute = isAbsolute(path2), prefix = "";
|
|
35503
35503
|
if (absolute)
|
|
@@ -35662,7 +35662,7 @@ var require_namespace = __commonJS((exports, module) => {
|
|
|
35662
35662
|
object.onRemove(this);
|
|
35663
35663
|
return clearCache(this);
|
|
35664
35664
|
};
|
|
35665
|
-
Namespace.prototype.define = function
|
|
35665
|
+
Namespace.prototype.define = function define(path, json) {
|
|
35666
35666
|
if (util.isString(path))
|
|
35667
35667
|
path = path.split(".");
|
|
35668
35668
|
else if (!Array.isArray(path))
|
|
@@ -42478,7 +42478,7 @@ var require_src3 = __commonJS((exports) => {
|
|
|
42478
42478
|
|
|
42479
42479
|
// node_modules/@grpc/grpc-js/build/src/channelz.js
|
|
42480
42480
|
var require_channelz = __commonJS((exports) => {
|
|
42481
|
-
var __dirname = "/
|
|
42481
|
+
var __dirname = "/Users/dhruv/Developer/Projects/isol8/node_modules/@grpc/grpc-js/build/src";
|
|
42482
42482
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42483
42483
|
exports.registerChannelzSocket = exports.registerChannelzServer = exports.registerChannelzSubchannel = exports.registerChannelzChannel = exports.ChannelzCallTrackerStub = exports.ChannelzCallTracker = exports.ChannelzChildrenTrackerStub = exports.ChannelzChildrenTracker = exports.ChannelzTrace = exports.ChannelzTraceStub = undefined;
|
|
42484
42484
|
exports.unregisterChannelzRef = unregisterChannelzRef;
|
|
@@ -47881,7 +47881,7 @@ var require_duration = __commonJS((exports) => {
|
|
|
47881
47881
|
|
|
47882
47882
|
// node_modules/@grpc/grpc-js/build/src/orca.js
|
|
47883
47883
|
var require_orca = __commonJS((exports) => {
|
|
47884
|
-
var __dirname = "/
|
|
47884
|
+
var __dirname = "/Users/dhruv/Developer/Projects/isol8/node_modules/@grpc/grpc-js/build/src";
|
|
47885
47885
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47886
47886
|
exports.OrcaOobMetricsSubchannelWrapper = exports.GRPC_METRICS_HEADER = exports.ServerMetricRecorder = exports.PerRequestMetricRecorder = undefined;
|
|
47887
47887
|
exports.createOrcaClient = createOrcaClient;
|
|
@@ -53270,7 +53270,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
53270
53270
|
|
|
53271
53271
|
// node_modules/dockerode/lib/session.js
|
|
53272
53272
|
var require_session = __commonJS((exports, module) => {
|
|
53273
|
-
var __dirname = "/
|
|
53273
|
+
var __dirname = "/Users/dhruv/Developer/Projects/isol8/node_modules/dockerode/lib";
|
|
53274
53274
|
var grpc = require_src4();
|
|
53275
53275
|
var protoLoader = require_src5();
|
|
53276
53276
|
var path = __require("path");
|
|
@@ -54496,7 +54496,7 @@ var require_docker = __commonJS((exports, module) => {
|
|
|
54496
54496
|
stream: true,
|
|
54497
54497
|
stdout: true,
|
|
54498
54498
|
stderr: true
|
|
54499
|
-
}, function
|
|
54499
|
+
}, function handler(err2, stream) {
|
|
54500
54500
|
if (err2)
|
|
54501
54501
|
return callback(err2, null, container);
|
|
54502
54502
|
hub.emit("stream", stream);
|
|
@@ -54803,6 +54803,10 @@ function mergeConfig(defaults, overrides) {
|
|
|
54803
54803
|
seccomp: overrides.security?.seccomp ?? defaults.security.seccomp,
|
|
54804
54804
|
customProfilePath: overrides.security?.customProfilePath ?? defaults.security.customProfilePath
|
|
54805
54805
|
},
|
|
54806
|
+
audit: {
|
|
54807
|
+
...defaults.audit,
|
|
54808
|
+
...overrides.audit
|
|
54809
|
+
},
|
|
54806
54810
|
debug: overrides.debug ?? defaults.debug
|
|
54807
54811
|
};
|
|
54808
54812
|
}
|
|
@@ -54830,6 +54834,16 @@ var init_config = __esm(() => {
|
|
|
54830
54834
|
security: {
|
|
54831
54835
|
seccomp: "strict"
|
|
54832
54836
|
},
|
|
54837
|
+
audit: {
|
|
54838
|
+
enabled: false,
|
|
54839
|
+
destination: "filesystem",
|
|
54840
|
+
logDir: undefined,
|
|
54841
|
+
postLogScript: undefined,
|
|
54842
|
+
trackResources: true,
|
|
54843
|
+
retentionDays: 90,
|
|
54844
|
+
includeCode: false,
|
|
54845
|
+
includeOutput: false
|
|
54846
|
+
},
|
|
54833
54847
|
debug: false
|
|
54834
54848
|
};
|
|
54835
54849
|
});
|
|
@@ -55022,6 +55036,144 @@ var init_logger = __esm(() => {
|
|
|
55022
55036
|
logger = new Logger;
|
|
55023
55037
|
});
|
|
55024
55038
|
|
|
55039
|
+
// src/engine/audit.ts
|
|
55040
|
+
import { spawn } from "node:child_process";
|
|
55041
|
+
import { appendFileSync, existsSync as existsSync2, mkdirSync, readdirSync, statSync, unlinkSync } from "node:fs";
|
|
55042
|
+
import { join as join2 } from "node:path";
|
|
55043
|
+
|
|
55044
|
+
class AuditLogger {
|
|
55045
|
+
config;
|
|
55046
|
+
auditFile;
|
|
55047
|
+
constructor(config) {
|
|
55048
|
+
this.config = config;
|
|
55049
|
+
const auditDir = config.logDir ?? process.env.ISOL8_AUDIT_DIR ?? join2(process.cwd(), "./.isol8_audit");
|
|
55050
|
+
this.auditFile = join2(auditDir, "executions.log");
|
|
55051
|
+
if (!existsSync2(auditDir)) {
|
|
55052
|
+
try {
|
|
55053
|
+
mkdirSync(auditDir, { recursive: true });
|
|
55054
|
+
} catch (err) {
|
|
55055
|
+
logger.error("Failed to create audit dir:", err);
|
|
55056
|
+
}
|
|
55057
|
+
}
|
|
55058
|
+
this.cleanupOldLogs();
|
|
55059
|
+
}
|
|
55060
|
+
cleanupOldLogs() {
|
|
55061
|
+
if (!this.config.enabled || this.config.retentionDays <= 0) {
|
|
55062
|
+
return;
|
|
55063
|
+
}
|
|
55064
|
+
try {
|
|
55065
|
+
const auditDir = join2(this.auditFile, "..");
|
|
55066
|
+
if (!existsSync2(auditDir)) {
|
|
55067
|
+
return;
|
|
55068
|
+
}
|
|
55069
|
+
const cutoffTime = Date.now() - this.config.retentionDays * 24 * 60 * 60 * 1000;
|
|
55070
|
+
const files = readdirSync(auditDir);
|
|
55071
|
+
let cleanedCount = 0;
|
|
55072
|
+
for (const file of files) {
|
|
55073
|
+
if (file.endsWith(".log") || file.endsWith(".jsonl")) {
|
|
55074
|
+
const filePath = join2(auditDir, file);
|
|
55075
|
+
try {
|
|
55076
|
+
const stats = statSync(filePath);
|
|
55077
|
+
if (stats.mtimeMs < cutoffTime) {
|
|
55078
|
+
unlinkSync(filePath);
|
|
55079
|
+
cleanedCount++;
|
|
55080
|
+
logger.debug(`Cleaned up old audit log: ${file}`);
|
|
55081
|
+
}
|
|
55082
|
+
} catch (err) {
|
|
55083
|
+
logger.debug(`Failed to check/remove old log file ${file}:`, err);
|
|
55084
|
+
}
|
|
55085
|
+
}
|
|
55086
|
+
}
|
|
55087
|
+
if (cleanedCount > 0) {
|
|
55088
|
+
logger.info(`Audit log cleanup: removed ${cleanedCount} old log files`);
|
|
55089
|
+
}
|
|
55090
|
+
} catch (err) {
|
|
55091
|
+
logger.error("Failed to cleanup old audit logs:", err);
|
|
55092
|
+
}
|
|
55093
|
+
}
|
|
55094
|
+
record(audit) {
|
|
55095
|
+
if (!this.config.enabled) {
|
|
55096
|
+
return;
|
|
55097
|
+
}
|
|
55098
|
+
try {
|
|
55099
|
+
const filteredAudit = this.filterAuditData(audit);
|
|
55100
|
+
const line = `${JSON.stringify(filteredAudit)}
|
|
55101
|
+
`;
|
|
55102
|
+
switch (this.config.destination) {
|
|
55103
|
+
case "file":
|
|
55104
|
+
case "filesystem":
|
|
55105
|
+
appendFileSync(this.auditFile, line, { encoding: "utf-8" });
|
|
55106
|
+
break;
|
|
55107
|
+
case "stdout":
|
|
55108
|
+
console.log("AUDIT_LOG:", filteredAudit);
|
|
55109
|
+
break;
|
|
55110
|
+
default:
|
|
55111
|
+
logger.error(`Unsupported audit destination: ${this.config.destination}`);
|
|
55112
|
+
return;
|
|
55113
|
+
}
|
|
55114
|
+
logger.debug("Audit record written:", audit.executionId);
|
|
55115
|
+
if (this.config.postLogScript) {
|
|
55116
|
+
this.runPostLogScript();
|
|
55117
|
+
}
|
|
55118
|
+
} catch (err) {
|
|
55119
|
+
logger.error("Failed to write audit record:", err);
|
|
55120
|
+
}
|
|
55121
|
+
}
|
|
55122
|
+
runPostLogScript() {
|
|
55123
|
+
if (!this.config.postLogScript) {
|
|
55124
|
+
return;
|
|
55125
|
+
}
|
|
55126
|
+
try {
|
|
55127
|
+
const child = spawn(this.config.postLogScript, [this.auditFile], {
|
|
55128
|
+
detached: true,
|
|
55129
|
+
stdio: "ignore"
|
|
55130
|
+
});
|
|
55131
|
+
child.on("error", (err) => {
|
|
55132
|
+
logger.error("Failed to run post-log script:", err);
|
|
55133
|
+
});
|
|
55134
|
+
child.unref();
|
|
55135
|
+
} catch (err) {
|
|
55136
|
+
logger.error("Failed to spawn post-log script:", err);
|
|
55137
|
+
}
|
|
55138
|
+
}
|
|
55139
|
+
filterAuditData(audit) {
|
|
55140
|
+
const result = {
|
|
55141
|
+
executionId: audit.executionId,
|
|
55142
|
+
userId: audit.userId,
|
|
55143
|
+
timestamp: audit.timestamp,
|
|
55144
|
+
runtime: audit.runtime,
|
|
55145
|
+
codeHash: audit.codeHash,
|
|
55146
|
+
containerId: audit.containerId,
|
|
55147
|
+
exitCode: audit.exitCode,
|
|
55148
|
+
durationMs: audit.durationMs
|
|
55149
|
+
};
|
|
55150
|
+
if (audit.resourceUsage !== undefined) {
|
|
55151
|
+
result.resourceUsage = audit.resourceUsage;
|
|
55152
|
+
}
|
|
55153
|
+
if (audit.securityEvents !== undefined) {
|
|
55154
|
+
result.securityEvents = audit.securityEvents;
|
|
55155
|
+
}
|
|
55156
|
+
if (audit.metadata !== undefined) {
|
|
55157
|
+
result.metadata = audit.metadata;
|
|
55158
|
+
}
|
|
55159
|
+
if (this.config.includeCode && audit.code !== undefined) {
|
|
55160
|
+
result.code = audit.code;
|
|
55161
|
+
}
|
|
55162
|
+
if (this.config.includeOutput) {
|
|
55163
|
+
if (audit.stdout !== undefined) {
|
|
55164
|
+
result.stdout = audit.stdout;
|
|
55165
|
+
}
|
|
55166
|
+
if (audit.stderr !== undefined) {
|
|
55167
|
+
result.stderr = audit.stderr;
|
|
55168
|
+
}
|
|
55169
|
+
}
|
|
55170
|
+
return result;
|
|
55171
|
+
}
|
|
55172
|
+
}
|
|
55173
|
+
var init_audit = __esm(() => {
|
|
55174
|
+
init_logger();
|
|
55175
|
+
});
|
|
55176
|
+
|
|
55025
55177
|
// src/engine/concurrency.ts
|
|
55026
55178
|
class Semaphore {
|
|
55027
55179
|
max;
|
|
@@ -55180,6 +55332,51 @@ var init_pool = __esm(() => {
|
|
|
55180
55332
|
init_logger();
|
|
55181
55333
|
});
|
|
55182
55334
|
|
|
55335
|
+
// src/engine/stats.ts
|
|
55336
|
+
function calculateCPUPercent(stats) {
|
|
55337
|
+
const cpuDelta = stats.cpu_stats.cpu_usage.total_usage - stats.precpu_stats.cpu_usage.total_usage;
|
|
55338
|
+
const systemDelta = stats.cpu_stats.system_cpu_usage - stats.precpu_stats.system_cpu_usage;
|
|
55339
|
+
if (systemDelta === 0 || cpuDelta === 0) {
|
|
55340
|
+
return 0;
|
|
55341
|
+
}
|
|
55342
|
+
const numCores = stats.cpu_stats.online_cpus ?? stats.cpu_stats.cpu_usage.percpu_usage?.length ?? 1;
|
|
55343
|
+
return cpuDelta / systemDelta * numCores * 100;
|
|
55344
|
+
}
|
|
55345
|
+
function calculateNetworkStats(stats) {
|
|
55346
|
+
if (!stats.networks) {
|
|
55347
|
+
return { in: 0, out: 0 };
|
|
55348
|
+
}
|
|
55349
|
+
let rxBytes = 0;
|
|
55350
|
+
let txBytes = 0;
|
|
55351
|
+
for (const iface of Object.values(stats.networks)) {
|
|
55352
|
+
rxBytes += iface.rx_bytes;
|
|
55353
|
+
txBytes += iface.tx_bytes;
|
|
55354
|
+
}
|
|
55355
|
+
return { in: rxBytes, out: txBytes };
|
|
55356
|
+
}
|
|
55357
|
+
async function getContainerStats(container) {
|
|
55358
|
+
const stats = await container.stats({
|
|
55359
|
+
stream: false
|
|
55360
|
+
});
|
|
55361
|
+
const cpuPercent = calculateCPUPercent(stats);
|
|
55362
|
+
const memoryBytes = stats.memory_stats.usage;
|
|
55363
|
+
const network = calculateNetworkStats(stats);
|
|
55364
|
+
return {
|
|
55365
|
+
cpuPercent: Math.round(cpuPercent * 100) / 100,
|
|
55366
|
+
memoryMB: Math.round(memoryBytes / (1024 * 1024)),
|
|
55367
|
+
networkBytesIn: network.in,
|
|
55368
|
+
networkBytesOut: network.out
|
|
55369
|
+
};
|
|
55370
|
+
}
|
|
55371
|
+
function calculateResourceDelta(before, after) {
|
|
55372
|
+
return {
|
|
55373
|
+
cpuPercent: after.cpuPercent,
|
|
55374
|
+
memoryMB: after.memoryMB,
|
|
55375
|
+
networkBytesIn: after.networkBytesIn - before.networkBytesIn,
|
|
55376
|
+
networkBytesOut: after.networkBytesOut - before.networkBytesOut
|
|
55377
|
+
};
|
|
55378
|
+
}
|
|
55379
|
+
|
|
55183
55380
|
// src/engine/utils.ts
|
|
55184
55381
|
var exports_utils = {};
|
|
55185
55382
|
__export(exports_utils, {
|
|
@@ -55290,14 +55487,14 @@ var exports_docker = {};
|
|
|
55290
55487
|
__export(exports_docker, {
|
|
55291
55488
|
DockerIsol8: () => DockerIsol8
|
|
55292
55489
|
});
|
|
55293
|
-
import { spawn } from "node:child_process";
|
|
55490
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
55294
55491
|
import { randomUUID } from "node:crypto";
|
|
55295
|
-
import { existsSync as
|
|
55492
|
+
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "node:fs";
|
|
55296
55493
|
import { PassThrough } from "node:stream";
|
|
55297
55494
|
async function writeFileViaExec(container, filePath, content) {
|
|
55298
55495
|
const data = typeof content === "string" ? Buffer.from(content, "utf-8") : content;
|
|
55299
55496
|
return new Promise((resolve2, reject) => {
|
|
55300
|
-
const child =
|
|
55497
|
+
const child = spawn2("docker", ["exec", "-i", "-u", "sandbox", container.id, "sh", "-c", `cat > ${filePath}`], {
|
|
55301
55498
|
stdio: ["pipe", "ignore", "pipe"]
|
|
55302
55499
|
});
|
|
55303
55500
|
child.on("error", (err) => {
|
|
@@ -55483,6 +55680,7 @@ class DockerIsol8 {
|
|
|
55483
55680
|
tmpSize;
|
|
55484
55681
|
security;
|
|
55485
55682
|
persist;
|
|
55683
|
+
auditLogger;
|
|
55486
55684
|
container = null;
|
|
55487
55685
|
persistentRuntime = null;
|
|
55488
55686
|
pool = null;
|
|
@@ -55504,6 +55702,9 @@ class DockerIsol8 {
|
|
|
55504
55702
|
this.tmpSize = options.tmpSize ?? "256m";
|
|
55505
55703
|
this.persist = options.persist ?? false;
|
|
55506
55704
|
this.security = options.security ?? { seccomp: "strict" };
|
|
55705
|
+
if (options.audit) {
|
|
55706
|
+
this.auditLogger = new AuditLogger(options.audit);
|
|
55707
|
+
}
|
|
55507
55708
|
if (options.debug) {
|
|
55508
55709
|
logger.setDebug(true);
|
|
55509
55710
|
}
|
|
@@ -55527,12 +55728,79 @@ class DockerIsol8 {
|
|
|
55527
55728
|
}
|
|
55528
55729
|
async execute(req) {
|
|
55529
55730
|
await this.semaphore.acquire();
|
|
55731
|
+
const startTime = Date.now();
|
|
55530
55732
|
try {
|
|
55531
|
-
|
|
55733
|
+
const result = this.mode === "persistent" ? await this.executePersistent(req, startTime) : await this.executeEphemeral(req, startTime);
|
|
55734
|
+
return result;
|
|
55532
55735
|
} finally {
|
|
55533
55736
|
this.semaphore.release();
|
|
55534
55737
|
}
|
|
55535
55738
|
}
|
|
55739
|
+
async recordAudit(req, result, startTime, container) {
|
|
55740
|
+
try {
|
|
55741
|
+
const enc = new TextEncoder;
|
|
55742
|
+
const data = enc.encode(req.code);
|
|
55743
|
+
const digest = await crypto.subtle.digest("SHA-256", data);
|
|
55744
|
+
const codeHash = Array.from(new Uint8Array(digest)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
55745
|
+
let securityEvents;
|
|
55746
|
+
if (container && this.network === "filtered") {
|
|
55747
|
+
securityEvents = await this.collectSecurityEvents(container);
|
|
55748
|
+
if (securityEvents.length === 0) {
|
|
55749
|
+
securityEvents = undefined;
|
|
55750
|
+
}
|
|
55751
|
+
}
|
|
55752
|
+
const audit = {
|
|
55753
|
+
executionId: result.executionId,
|
|
55754
|
+
userId: req.metadata?.userId || "",
|
|
55755
|
+
timestamp: new Date(startTime).toISOString(),
|
|
55756
|
+
runtime: result.runtime,
|
|
55757
|
+
codeHash,
|
|
55758
|
+
containerId: result.containerId || "",
|
|
55759
|
+
exitCode: result.exitCode,
|
|
55760
|
+
durationMs: result.durationMs,
|
|
55761
|
+
resourceUsage: result.resourceUsage,
|
|
55762
|
+
securityEvents,
|
|
55763
|
+
metadata: req.metadata
|
|
55764
|
+
};
|
|
55765
|
+
this.auditLogger.record(audit);
|
|
55766
|
+
} catch (err) {
|
|
55767
|
+
logger.error("Failed to record audit log:", err);
|
|
55768
|
+
}
|
|
55769
|
+
}
|
|
55770
|
+
async collectSecurityEvents(container) {
|
|
55771
|
+
const events = [];
|
|
55772
|
+
try {
|
|
55773
|
+
const exec = await container.exec({
|
|
55774
|
+
Cmd: ["cat", "/tmp/isol8-proxy/security-events.jsonl"],
|
|
55775
|
+
AttachStdout: true,
|
|
55776
|
+
AttachStderr: false,
|
|
55777
|
+
User: "root"
|
|
55778
|
+
});
|
|
55779
|
+
const stream = await exec.start({ Tty: false });
|
|
55780
|
+
const chunks = [];
|
|
55781
|
+
for await (const chunk of stream) {
|
|
55782
|
+
chunks.push(chunk);
|
|
55783
|
+
}
|
|
55784
|
+
const output = Buffer.concat(chunks).toString("utf-8").trim();
|
|
55785
|
+
if (output) {
|
|
55786
|
+
for (const line of output.split(`
|
|
55787
|
+
`)) {
|
|
55788
|
+
if (line.trim()) {
|
|
55789
|
+
try {
|
|
55790
|
+
const event = JSON.parse(line);
|
|
55791
|
+
events.push({
|
|
55792
|
+
type: event.type || "unknown",
|
|
55793
|
+
message: `Security event: ${event.type}`,
|
|
55794
|
+
details: event.details || {},
|
|
55795
|
+
timestamp: event.timestamp || new Date().toISOString()
|
|
55796
|
+
});
|
|
55797
|
+
} catch {}
|
|
55798
|
+
}
|
|
55799
|
+
}
|
|
55800
|
+
}
|
|
55801
|
+
} catch {}
|
|
55802
|
+
return events;
|
|
55803
|
+
}
|
|
55536
55804
|
async putFile(path, content) {
|
|
55537
55805
|
if (!this.container) {
|
|
55538
55806
|
throw new Error("No active container. Call execute() first in persistent mode.");
|
|
@@ -55640,7 +55908,7 @@ class DockerIsol8 {
|
|
|
55640
55908
|
return adapter.image;
|
|
55641
55909
|
}
|
|
55642
55910
|
}
|
|
55643
|
-
async executeEphemeral(req) {
|
|
55911
|
+
async executeEphemeral(req, startTime) {
|
|
55644
55912
|
const adapter = this.getAdapter(req.runtime);
|
|
55645
55913
|
const timeoutMs = req.timeoutMs ?? this.defaultTimeoutMs;
|
|
55646
55914
|
const image = await this.resolveImage(adapter);
|
|
@@ -55659,6 +55927,14 @@ class DockerIsol8 {
|
|
|
55659
55927
|
});
|
|
55660
55928
|
}
|
|
55661
55929
|
const container = await this.pool.acquire(image);
|
|
55930
|
+
let startStats;
|
|
55931
|
+
if (this.auditLogger) {
|
|
55932
|
+
try {
|
|
55933
|
+
startStats = await getContainerStats(container);
|
|
55934
|
+
} catch (err) {
|
|
55935
|
+
logger.debug("Failed to collect baseline stats:", err);
|
|
55936
|
+
}
|
|
55937
|
+
}
|
|
55662
55938
|
try {
|
|
55663
55939
|
if (this.network === "filtered") {
|
|
55664
55940
|
await startProxy(container, this.networkFilter);
|
|
@@ -55699,7 +55975,16 @@ class DockerIsol8 {
|
|
|
55699
55975
|
const { stdout, stderr, truncated } = await this.collectExecOutput(execStream, container, timeoutMs);
|
|
55700
55976
|
const durationMs = Math.round(performance.now() - start);
|
|
55701
55977
|
const inspectResult = await exec.inspect();
|
|
55702
|
-
|
|
55978
|
+
let resourceUsage;
|
|
55979
|
+
if (startStats) {
|
|
55980
|
+
try {
|
|
55981
|
+
const endStats = await getContainerStats(container);
|
|
55982
|
+
resourceUsage = calculateResourceDelta(startStats, endStats);
|
|
55983
|
+
} catch (err) {
|
|
55984
|
+
logger.debug("Failed to collect final stats:", err);
|
|
55985
|
+
}
|
|
55986
|
+
}
|
|
55987
|
+
const result = {
|
|
55703
55988
|
stdout: this.postProcessOutput(stdout, truncated),
|
|
55704
55989
|
stderr: this.postProcessOutput(stderr, false),
|
|
55705
55990
|
exitCode: inspectResult.ExitCode ?? 1,
|
|
@@ -55709,8 +55994,13 @@ class DockerIsol8 {
|
|
|
55709
55994
|
runtime: req.runtime,
|
|
55710
55995
|
timestamp: new Date().toISOString(),
|
|
55711
55996
|
containerId: container.id,
|
|
55997
|
+
...resourceUsage ? { resourceUsage } : {},
|
|
55712
55998
|
...req.outputPaths ? { files: await this.retrieveFiles(container, req.outputPaths) } : {}
|
|
55713
55999
|
};
|
|
56000
|
+
if (this.auditLogger) {
|
|
56001
|
+
await this.recordAudit(req, result, startTime, container);
|
|
56002
|
+
}
|
|
56003
|
+
return result;
|
|
55714
56004
|
} finally {
|
|
55715
56005
|
if (this.persist) {
|
|
55716
56006
|
logger.debug(`[Persist] Leaving container running for inspection: ${container.id}`);
|
|
@@ -55719,7 +56009,7 @@ class DockerIsol8 {
|
|
|
55719
56009
|
}
|
|
55720
56010
|
}
|
|
55721
56011
|
}
|
|
55722
|
-
async executePersistent(req) {
|
|
56012
|
+
async executePersistent(req, startTime) {
|
|
55723
56013
|
const adapter = this.getAdapter(req.runtime);
|
|
55724
56014
|
const timeoutMs = req.timeoutMs ?? this.defaultTimeoutMs;
|
|
55725
56015
|
if (!this.container) {
|
|
@@ -55773,7 +56063,21 @@ class DockerIsol8 {
|
|
|
55773
56063
|
const { stdout, stderr, truncated } = await this.collectExecOutput(execStream, this.container, timeoutMs);
|
|
55774
56064
|
const durationMs = Math.round(performance.now() - start);
|
|
55775
56065
|
const inspectResult = await exec.inspect();
|
|
55776
|
-
|
|
56066
|
+
let resourceUsage;
|
|
56067
|
+
if (this.auditLogger) {
|
|
56068
|
+
try {
|
|
56069
|
+
const endStats = await getContainerStats(this.container);
|
|
56070
|
+
resourceUsage = {
|
|
56071
|
+
cpuPercent: endStats.cpuPercent,
|
|
56072
|
+
memoryMB: endStats.memoryMB,
|
|
56073
|
+
networkBytesIn: endStats.networkBytesIn,
|
|
56074
|
+
networkBytesOut: endStats.networkBytesOut
|
|
56075
|
+
};
|
|
56076
|
+
} catch (err) {
|
|
56077
|
+
logger.debug("Failed to collect resource stats:", err);
|
|
56078
|
+
}
|
|
56079
|
+
}
|
|
56080
|
+
const result = {
|
|
55777
56081
|
stdout: this.postProcessOutput(stdout, truncated),
|
|
55778
56082
|
stderr: this.postProcessOutput(stderr, false),
|
|
55779
56083
|
exitCode: inspectResult.ExitCode ?? 1,
|
|
@@ -55783,8 +56087,13 @@ class DockerIsol8 {
|
|
|
55783
56087
|
runtime: req.runtime,
|
|
55784
56088
|
timestamp: new Date().toISOString(),
|
|
55785
56089
|
containerId: this.container?.id,
|
|
56090
|
+
...resourceUsage ? { resourceUsage } : {},
|
|
55786
56091
|
...req.outputPaths ? { files: await this.retrieveFiles(this.container, req.outputPaths) } : {}
|
|
55787
56092
|
};
|
|
56093
|
+
if (this.auditLogger) {
|
|
56094
|
+
await this.recordAudit(req, result, startTime, this.container);
|
|
56095
|
+
}
|
|
56096
|
+
return result;
|
|
55788
56097
|
}
|
|
55789
56098
|
async retrieveFiles(container, paths) {
|
|
55790
56099
|
const files = {};
|
|
@@ -55876,11 +56185,11 @@ class DockerIsol8 {
|
|
|
55876
56185
|
}
|
|
55877
56186
|
loadDefaultSeccompProfile() {
|
|
55878
56187
|
const devPath = new URL("../../docker/seccomp-profile.json", import.meta.url);
|
|
55879
|
-
if (
|
|
56188
|
+
if (existsSync3(devPath)) {
|
|
55880
56189
|
return readFileSync2(devPath, "utf-8");
|
|
55881
56190
|
}
|
|
55882
56191
|
const prodPath = new URL("./docker/seccomp-profile.json", import.meta.url);
|
|
55883
|
-
if (
|
|
56192
|
+
if (existsSync3(prodPath)) {
|
|
55884
56193
|
return readFileSync2(prodPath, "utf-8");
|
|
55885
56194
|
}
|
|
55886
56195
|
logger.warn("Could not locate default seccomp profile. Running without seccomp filter.");
|
|
@@ -56084,10 +56393,11 @@ class DockerIsol8 {
|
|
|
56084
56393
|
}
|
|
56085
56394
|
var import_dockerode, SANDBOX_WORKDIR = "/sandbox", MAX_OUTPUT_BYTES, PROXY_PORT = 8118, PROXY_STARTUP_TIMEOUT_MS = 5000, PROXY_POLL_INTERVAL_MS = 100;
|
|
56086
56395
|
var init_docker = __esm(() => {
|
|
56396
|
+
import_dockerode = __toESM(require_docker(), 1);
|
|
56087
56397
|
init_runtime();
|
|
56088
56398
|
init_logger();
|
|
56399
|
+
init_audit();
|
|
56089
56400
|
init_pool();
|
|
56090
|
-
import_dockerode = __toESM(require_docker(), 1);
|
|
56091
56401
|
MAX_OUTPUT_BYTES = 1024 * 1024;
|
|
56092
56402
|
});
|
|
56093
56403
|
|
|
@@ -56096,7 +56406,7 @@ var package_default;
|
|
|
56096
56406
|
var init_package = __esm(() => {
|
|
56097
56407
|
package_default = {
|
|
56098
56408
|
name: "isol8",
|
|
56099
|
-
version: "0.
|
|
56409
|
+
version: "0.9.0",
|
|
56100
56410
|
description: "Secure code execution engine for AI agents",
|
|
56101
56411
|
author: "Illusion47586",
|
|
56102
56412
|
license: "MIT",
|
|
@@ -56137,6 +56447,7 @@ var init_package = __esm(() => {
|
|
|
56137
56447
|
"build:server": "bun run scripts/build-server.ts",
|
|
56138
56448
|
"build:server:all": "bun run scripts/build-server.ts --all",
|
|
56139
56449
|
test: "bun test",
|
|
56450
|
+
"test:prod": "bun test tests/production/",
|
|
56140
56451
|
"lint:check": "ultracite check",
|
|
56141
56452
|
"lint:fix": "ultracite fix",
|
|
56142
56453
|
bench: "bunx tsx benchmarks/spawn.ts",
|
|
@@ -57854,7 +58165,8 @@ async function createServer(options) {
|
|
|
57854
58165
|
sandboxSize: config.defaults.sandboxSize,
|
|
57855
58166
|
tmpSize: config.defaults.tmpSize,
|
|
57856
58167
|
...body.options,
|
|
57857
|
-
mode: body.sessionId ? "persistent" : "ephemeral"
|
|
58168
|
+
mode: body.sessionId ? "persistent" : "ephemeral",
|
|
58169
|
+
audit: config.audit
|
|
57858
58170
|
};
|
|
57859
58171
|
let engine;
|
|
57860
58172
|
if (body.sessionId) {
|
|
@@ -58025,15 +58337,15 @@ var init_server = __esm(() => {
|
|
|
58025
58337
|
// src/cli.ts
|
|
58026
58338
|
import {
|
|
58027
58339
|
chmodSync,
|
|
58028
|
-
existsSync as
|
|
58029
|
-
mkdirSync,
|
|
58340
|
+
existsSync as existsSync5,
|
|
58341
|
+
mkdirSync as mkdirSync2,
|
|
58030
58342
|
readFileSync as readFileSync3,
|
|
58031
58343
|
renameSync,
|
|
58032
|
-
unlinkSync,
|
|
58344
|
+
unlinkSync as unlinkSync2,
|
|
58033
58345
|
writeFileSync
|
|
58034
58346
|
} from "node:fs";
|
|
58035
58347
|
import { arch, homedir as homedir2, platform } from "node:os";
|
|
58036
|
-
import { join as
|
|
58348
|
+
import { join as join3, resolve as resolve2 } from "node:path";
|
|
58037
58349
|
|
|
58038
58350
|
// node_modules/commander/esm.mjs
|
|
58039
58351
|
var import__ = __toESM(require_commander(), 1);
|
|
@@ -58630,7 +58942,7 @@ onetime.callCount = (function_) => {
|
|
|
58630
58942
|
};
|
|
58631
58943
|
var onetime_default = onetime;
|
|
58632
58944
|
|
|
58633
|
-
// node_modules/signal-exit/dist/mjs/signals.js
|
|
58945
|
+
// node_modules/restore-cursor/node_modules/signal-exit/dist/mjs/signals.js
|
|
58634
58946
|
var signals = [];
|
|
58635
58947
|
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
58636
58948
|
if (process.platform !== "win32") {
|
|
@@ -58640,7 +58952,7 @@ if (process.platform === "linux") {
|
|
|
58640
58952
|
signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
58641
58953
|
}
|
|
58642
58954
|
|
|
58643
|
-
// node_modules/signal-exit/dist/mjs/index.js
|
|
58955
|
+
// node_modules/restore-cursor/node_modules/signal-exit/dist/mjs/index.js
|
|
58644
58956
|
var processOk = (process3) => !!process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function";
|
|
58645
58957
|
var kExitEmitter = Symbol.for("signal-exit emitter");
|
|
58646
58958
|
var global2 = globalThis;
|
|
@@ -61427,10 +61739,10 @@ init_docker();
|
|
|
61427
61739
|
|
|
61428
61740
|
// src/engine/image-builder.ts
|
|
61429
61741
|
init_runtime();
|
|
61430
|
-
import { existsSync as
|
|
61742
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
61431
61743
|
function resolveDockerDir() {
|
|
61432
|
-
const fromBundled = new URL("
|
|
61433
|
-
if (
|
|
61744
|
+
const fromBundled = new URL("./docker", import.meta.url).pathname;
|
|
61745
|
+
if (existsSync4(fromBundled)) {
|
|
61434
61746
|
return fromBundled;
|
|
61435
61747
|
}
|
|
61436
61748
|
return new URL("../../docker", import.meta.url).pathname;
|
|
@@ -61783,7 +62095,7 @@ function getServerBinaryName() {
|
|
|
61783
62095
|
return `isol8-server-${resolvedOs}-${resolvedArch}`;
|
|
61784
62096
|
}
|
|
61785
62097
|
async function getServerBinaryVersion(binaryPath) {
|
|
61786
|
-
if (!
|
|
62098
|
+
if (!existsSync5(binaryPath)) {
|
|
61787
62099
|
logger.debug(`[Serve] No binary found at ${binaryPath}`);
|
|
61788
62100
|
return null;
|
|
61789
62101
|
}
|
|
@@ -61816,8 +62128,8 @@ async function downloadServerBinary(binaryPath) {
|
|
|
61816
62128
|
}
|
|
61817
62129
|
process.exit(1);
|
|
61818
62130
|
}
|
|
61819
|
-
const binDir =
|
|
61820
|
-
|
|
62131
|
+
const binDir = join3(homedir2(), ".isol8", "bin");
|
|
62132
|
+
mkdirSync2(binDir, { recursive: true });
|
|
61821
62133
|
const tmpPath = `${binaryPath}.tmp`;
|
|
61822
62134
|
const buffer = Buffer.from(await response.arrayBuffer());
|
|
61823
62135
|
writeFileSync(tmpPath, buffer);
|
|
@@ -61828,8 +62140,8 @@ async function downloadServerBinary(binaryPath) {
|
|
|
61828
62140
|
} catch (err) {
|
|
61829
62141
|
spinner.fail("Failed to download server binary");
|
|
61830
62142
|
const tmpPath = `${binaryPath}.tmp`;
|
|
61831
|
-
if (
|
|
61832
|
-
|
|
62143
|
+
if (existsSync5(tmpPath)) {
|
|
62144
|
+
unlinkSync2(tmpPath);
|
|
61833
62145
|
}
|
|
61834
62146
|
throw err;
|
|
61835
62147
|
}
|
|
@@ -61848,8 +62160,8 @@ async function promptYesNo(question) {
|
|
|
61848
62160
|
return normalized === "" || normalized === "y" || normalized === "yes";
|
|
61849
62161
|
}
|
|
61850
62162
|
async function ensureServerBinary(forceUpdate) {
|
|
61851
|
-
const binDir =
|
|
61852
|
-
const binaryPath =
|
|
62163
|
+
const binDir = join3(homedir2(), ".isol8", "bin");
|
|
62164
|
+
const binaryPath = join3(binDir, "isol8-server");
|
|
61853
62165
|
logger.debug(`[Serve] Binary path: ${binaryPath}, forceUpdate: ${forceUpdate}`);
|
|
61854
62166
|
if (forceUpdate) {
|
|
61855
62167
|
logger.debug("[Serve] Force update requested");
|
|
@@ -61879,10 +62191,10 @@ async function ensureServerBinary(forceUpdate) {
|
|
|
61879
62191
|
program2.command("config").description("Show the resolved isol8 configuration").option("--json", "Output as raw JSON").action((opts) => {
|
|
61880
62192
|
const config = loadConfig();
|
|
61881
62193
|
const searchPaths = [
|
|
61882
|
-
|
|
61883
|
-
|
|
62194
|
+
join3(resolve2(process.cwd()), "isol8.config.json"),
|
|
62195
|
+
join3(homedir2(), ".isol8", "config.json")
|
|
61884
62196
|
];
|
|
61885
|
-
const loadedFrom = searchPaths.find((p) =>
|
|
62197
|
+
const loadedFrom = searchPaths.find((p) => existsSync5(p));
|
|
61886
62198
|
logger.debug(`[Config] Config source: ${loadedFrom ?? "defaults"}`);
|
|
61887
62199
|
logger.debug(`[Config] Resolved config: ${JSON.stringify(config)}`);
|
|
61888
62200
|
if (opts.json) {
|
|
@@ -62017,7 +62329,7 @@ async function resolveRunInput(file, opts) {
|
|
|
62017
62329
|
} else if (file) {
|
|
62018
62330
|
const filePath = resolve2(file);
|
|
62019
62331
|
logger.debug(`[Run] Reading file: ${filePath}`);
|
|
62020
|
-
if (!
|
|
62332
|
+
if (!existsSync5(filePath)) {
|
|
62021
62333
|
console.error(`[ERR] File not found: ${file}`);
|
|
62022
62334
|
process.exit(1);
|
|
62023
62335
|
}
|
|
@@ -62104,4 +62416,4 @@ if (!process.argv.slice(2).length) {
|
|
|
62104
62416
|
}
|
|
62105
62417
|
program2.parse();
|
|
62106
62418
|
|
|
62107
|
-
//# debugId=
|
|
62419
|
+
//# debugId=A0037469D709994964756E2164756E21
|