@molecule/api-code-sandbox-e2b 1.2.2 → 1.2.4
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/LICENSE +111 -24
- package/README.md +43 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/provider.d.ts +25 -0
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +50 -13
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
Apache License
|
|
2
3
|
Version 2.0, January 2004
|
|
3
4
|
http://www.apache.org/licenses/
|
|
@@ -34,21 +35,33 @@
|
|
|
34
35
|
|
|
35
36
|
"Work" shall mean the work of authorship, whether in Source or
|
|
36
37
|
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
38
40
|
|
|
39
41
|
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
42
|
form, that is based on (or derived from) the Work and for which the
|
|
41
43
|
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
-
represent, as a whole, an original work of authorship.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
49
62
|
|
|
50
63
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
51
|
-
on behalf of whom a Contribution has been received by
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
52
65
|
subsequently incorporated within the Work.
|
|
53
66
|
|
|
54
67
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
@@ -61,8 +74,18 @@
|
|
|
61
74
|
3. Grant of Patent License. Subject to the terms and conditions of
|
|
62
75
|
this License, each Contributor hereby grants to You a perpetual,
|
|
63
76
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
64
|
-
|
|
65
|
-
and otherwise transfer the Work
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
66
89
|
|
|
67
90
|
4. Redistribution. You may reproduce and distribute copies of the
|
|
68
91
|
Work or Derivative Works thereof in any medium, with or without
|
|
@@ -84,23 +107,87 @@
|
|
|
84
107
|
(d) If the Work includes a "NOTICE" text file as part of its
|
|
85
108
|
distribution, then any Derivative Works that You distribute must
|
|
86
109
|
include a readable copy of the attribution notices contained
|
|
87
|
-
within such NOTICE file
|
|
88
|
-
|
|
89
|
-
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
90
138
|
|
|
91
139
|
6. Trademarks. This License does not grant permission to use the trade
|
|
92
|
-
names, trademarks, service marks, or product names of the Licensor
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
93
143
|
|
|
94
144
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
95
|
-
agreed to in writing, Licensor provides the Work
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
104
191
|
|
|
105
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
106
193
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-
|
|
6
|
+
Generated: 2026-10-04T08:07:55.241Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/api-code-sandbox-e2b
|
|
@@ -376,6 +376,21 @@ interface E2BVolumeLike {
|
|
|
376
376
|
}
|
|
377
377
|
```
|
|
378
378
|
|
|
379
|
+
#### `EgressProbeCodes`
|
|
380
|
+
|
|
381
|
+
The three curl `%{http_code}` outputs an egress probe observes.
|
|
382
|
+
|
|
383
|
+
```typescript
|
|
384
|
+
interface EgressProbeCodes {
|
|
385
|
+
/** The allow-listed control host — must answer for the probe to mean anything. */
|
|
386
|
+
allowed: string
|
|
387
|
+
/** A non-allow-listed hostname. */
|
|
388
|
+
deniedHost: string
|
|
389
|
+
/** A raw IP outside the allowlist. */
|
|
390
|
+
deniedIp: string
|
|
391
|
+
}
|
|
392
|
+
```
|
|
393
|
+
|
|
379
394
|
### Classes
|
|
380
395
|
|
|
381
396
|
#### `E2BSandboxProvider`
|
|
@@ -391,6 +406,27 @@ in prod, which is the correct safe default until egress observation is proven
|
|
|
391
406
|
|
|
392
407
|
### Functions
|
|
393
408
|
|
|
409
|
+
#### `classifyEgressProbe(codes)`
|
|
410
|
+
|
|
411
|
+
Turn the probe's curl codes into a verdict.
|
|
412
|
+
|
|
413
|
+
- `open` only when a denied probe answered a real HTTP status — reachable
|
|
414
|
+
egress was OBSERVED;
|
|
415
|
+
- `inconclusive` whenever the allow-listed control host did not answer — a
|
|
416
|
+
probe sandbox with no network at all blocks everything, which says nothing
|
|
417
|
+
about the policy (2026-10-04: `host=000, rawIP=000, allowed=000` was read
|
|
418
|
+
as open and production refused to boot);
|
|
419
|
+
- `filtered` only when the control host answered AND both denied probes were
|
|
420
|
+
blocked (`000` / empty).
|
|
421
|
+
|
|
422
|
+
```typescript
|
|
423
|
+
function classifyEgressProbe(codes: EgressProbeCodes): EgressVerdict
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
- `codes` — The observed curl codes.
|
|
427
|
+
|
|
428
|
+
**Returns:** The verdict.
|
|
429
|
+
|
|
394
430
|
#### `createProvider(config, clientOverride)`
|
|
395
431
|
|
|
396
432
|
Create an E2B provider with the given configuration.
|
|
@@ -470,6 +506,12 @@ failure to run that probe is `inconclusive` — never `filtered`, because "I
|
|
|
470
506
|
could not look" must not reach a control plane as "I looked, and it is safe"
|
|
471
507
|
(Rule 18: never trade cost for security).
|
|
472
508
|
|
|
509
|
+
**A probe that sees NO network is `inconclusive`, not `open`.** When the
|
|
510
|
+
allow-listed control host does not answer either, the probe sandbox itself has
|
|
511
|
+
no network and observed nothing about the policy. `open` requires a denied
|
|
512
|
+
probe to answer a real HTTP status. (A no-network probe once read as open and
|
|
513
|
+
kept a control plane from booting.)
|
|
514
|
+
|
|
473
515
|
**E2B pauses, it does not stop.** `sleep()`/`stop()` both map to E2B pause
|
|
474
516
|
(FS + memory snapshot); `wake()`/`start()` reconnect by id. `hibernate()`/
|
|
475
517
|
`resume()` report `processesPreserved: true` because the memory snapshot
|
package/dist/index.d.ts
CHANGED
|
@@ -47,6 +47,12 @@
|
|
|
47
47
|
* could not look" must not reach a control plane as "I looked, and it is safe"
|
|
48
48
|
* (Rule 18: never trade cost for security).
|
|
49
49
|
*
|
|
50
|
+
* **A probe that sees NO network is `inconclusive`, not `open`.** When the
|
|
51
|
+
* allow-listed control host does not answer either, the probe sandbox itself has
|
|
52
|
+
* no network and observed nothing about the policy. `open` requires a denied
|
|
53
|
+
* probe to answer a real HTTP status. (A no-network probe once read as open and
|
|
54
|
+
* kept a control plane from booting.)
|
|
55
|
+
*
|
|
50
56
|
* **E2B pauses, it does not stop.** `sleep()`/`stop()` both map to E2B pause
|
|
51
57
|
* (FS + memory snapshot); `wake()`/`start()` reconnect by id. `hibernate()`/
|
|
52
58
|
* `resume()` report `processesPreserved: true` because the memory snapshot
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsJG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -47,6 +47,12 @@
|
|
|
47
47
|
* could not look" must not reach a control plane as "I looked, and it is safe"
|
|
48
48
|
* (Rule 18: never trade cost for security).
|
|
49
49
|
*
|
|
50
|
+
* **A probe that sees NO network is `inconclusive`, not `open`.** When the
|
|
51
|
+
* allow-listed control host does not answer either, the probe sandbox itself has
|
|
52
|
+
* no network and observed nothing about the policy. `open` requires a denied
|
|
53
|
+
* probe to answer a real HTTP status. (A no-network probe once read as open and
|
|
54
|
+
* kept a control plane from booting.)
|
|
55
|
+
*
|
|
50
56
|
* **E2B pauses, it does not stop.** `sleep()`/`stop()` both map to E2B pause
|
|
51
57
|
* (FS + memory snapshot); `wake()`/`start()` reconnect by id. `hibernate()`/
|
|
52
58
|
* `resume()` report `processesPreserved: true` because the memory snapshot
|
package/dist/provider.d.ts
CHANGED
|
@@ -252,6 +252,31 @@ export declare class E2BSandboxProvider implements SandboxProvider {
|
|
|
252
252
|
*/
|
|
253
253
|
private probeEgress;
|
|
254
254
|
}
|
|
255
|
+
/** The three curl `%{http_code}` outputs an egress probe observes. */
|
|
256
|
+
export interface EgressProbeCodes {
|
|
257
|
+
/** The allow-listed control host — must answer for the probe to mean anything. */
|
|
258
|
+
allowed: string;
|
|
259
|
+
/** A non-allow-listed hostname. */
|
|
260
|
+
deniedHost: string;
|
|
261
|
+
/** A raw IP outside the allowlist. */
|
|
262
|
+
deniedIp: string;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Turn the probe's curl codes into a verdict.
|
|
266
|
+
*
|
|
267
|
+
* - `open` only when a denied probe answered a real HTTP status — reachable
|
|
268
|
+
* egress was OBSERVED;
|
|
269
|
+
* - `inconclusive` whenever the allow-listed control host did not answer — a
|
|
270
|
+
* probe sandbox with no network at all blocks everything, which says nothing
|
|
271
|
+
* about the policy (2026-10-04: `host=000, rawIP=000, allowed=000` was read
|
|
272
|
+
* as open and production refused to boot);
|
|
273
|
+
* - `filtered` only when the control host answered AND both denied probes were
|
|
274
|
+
* blocked (`000` / empty).
|
|
275
|
+
*
|
|
276
|
+
* @param codes - The observed curl codes.
|
|
277
|
+
* @returns The verdict.
|
|
278
|
+
*/
|
|
279
|
+
export declare function classifyEgressProbe(codes: EgressProbeCodes): EgressVerdict;
|
|
255
280
|
/**
|
|
256
281
|
* Create an E2B provider with the given configuration.
|
|
257
282
|
*
|
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,qBAAqB,EAErB,aAAa,EAKb,oBAAoB,EACpB,kBAAkB,EAClB,OAAO,EACP,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,eAAe,EAGf,UAAU,EACX,MAAM,4BAA4B,CAAA;AAEnC,OAAO,KAAK,EAGV,SAAS,EACT,oBAAoB,EAMrB,MAAM,YAAY,CAAA;AAkvBnB;;;;;;;;;GASG;AACH,qBAAa,kBAAmB,YAAW,eAAe;IACxD,QAAQ,CAAC,IAAI,SAAQ;IAErB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0D;IACjF,OAAO,CAAC,aAAa,CAA6C;IAClE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAsB;IAEtD;;;;;OAKG;gBACS,MAAM,GAAE,SAAc,EAAE,cAAc,CAAC,EAAE,oBAAoB;IAYzE;;;;OAIG;YACW,MAAM;IASpB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC;IA4CrD;;;;;OAKG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAoB9C;;;;;;;;;;;;;;;OAeG;IACG,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAkC7D;;;;;OAKG;IACG,IAA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@ export class E2BSandboxProvider {
|
|
|
1242
1242
|
EGRESS_PROBE_ALLOW,
|
|
1243
1243
|
`*.${EGRESS_PROBE_ALLOW.split('.').slice(-2).join('.')}`,
|
|
1244
1244
|
]);
|
|
1245
|
-
const code = async (host) => (await handle.exec(
|
|
1245
|
+
const code = async (host) => (await handle.exec(
|
|
1246
|
+
// No `|| echo 000`: exec RETURNS a non-zero exit as data, and curl
|
|
1247
|
+
// already prints `000` for "no response" — the fallback appended a
|
|
1248
|
+
// second one (`000000`).
|
|
1249
|
+
`curl -s -o /dev/null -m 8 -w '%{http_code}' https://${host}/`)).stdout.trim();
|
|
1246
1250
|
const [allowed, deniedHost, deniedIp] = await Promise.all([
|
|
1247
1251
|
code(EGRESS_PROBE_ALLOW),
|
|
1248
1252
|
code(EGRESS_PROBE_DENY),
|
|
1249
1253
|
code('1.1.1.1'),
|
|
1250
1254
|
]);
|
|
1251
|
-
|
|
1252
|
-
if (blocked(deniedHost) && blocked(deniedIp) && !blocked(allowed)) {
|
|
1253
|
-
return {
|
|
1254
|
-
state: 'filtered',
|
|
1255
|
-
detail: `deny-by-default verified: ${EGRESS_PROBE_ALLOW}=${allowed} reachable; ${EGRESS_PROBE_DENY}=${deniedHost} and raw IP=${deniedIp} blocked.`,
|
|
1256
|
-
};
|
|
1257
|
-
}
|
|
1258
|
-
return {
|
|
1259
|
-
state: 'open',
|
|
1260
|
-
detail: `Non-allow-listed egress was reachable (host=${deniedHost}, rawIP=${deniedIp}, allowed=${allowed}).`,
|
|
1261
|
-
remediation: 'Ensure updateNetwork applies allowOut + denyOut:[0.0.0.0/0]; check the E2B account supports network policy.',
|
|
1262
|
-
};
|
|
1255
|
+
return classifyEgressProbe({ allowed, deniedHost, deniedIp });
|
|
1263
1256
|
}
|
|
1264
1257
|
catch (error) {
|
|
1265
1258
|
return {
|
|
@@ -1269,6 +1262,50 @@ export class E2BSandboxProvider {
|
|
|
1269
1262
|
}
|
|
1270
1263
|
}
|
|
1271
1264
|
}
|
|
1265
|
+
/**
|
|
1266
|
+
* Turn the probe's curl codes into a verdict.
|
|
1267
|
+
*
|
|
1268
|
+
* - `open` only when a denied probe answered a real HTTP status — reachable
|
|
1269
|
+
* egress was OBSERVED;
|
|
1270
|
+
* - `inconclusive` whenever the allow-listed control host did not answer — a
|
|
1271
|
+
* probe sandbox with no network at all blocks everything, which says nothing
|
|
1272
|
+
* about the policy (2026-10-04: `host=000, rawIP=000, allowed=000` was read
|
|
1273
|
+
* as open and production refused to boot);
|
|
1274
|
+
* - `filtered` only when the control host answered AND both denied probes were
|
|
1275
|
+
* blocked (`000` / empty).
|
|
1276
|
+
*
|
|
1277
|
+
* @param codes - The observed curl codes.
|
|
1278
|
+
* @returns The verdict.
|
|
1279
|
+
*/
|
|
1280
|
+
export function classifyEgressProbe(codes) {
|
|
1281
|
+
const { allowed, deniedHost, deniedIp } = codes;
|
|
1282
|
+
const answered = (c) => /^[1-5]\d\d$/.test(c);
|
|
1283
|
+
const blocked = (c) => c === '' || /^0+$/.test(c);
|
|
1284
|
+
if (answered(deniedHost) || answered(deniedIp)) {
|
|
1285
|
+
return {
|
|
1286
|
+
state: 'open',
|
|
1287
|
+
detail: `Non-allow-listed egress was reachable (host=${deniedHost}, rawIP=${deniedIp}, allowed=${allowed}).`,
|
|
1288
|
+
remediation: 'Ensure updateNetwork applies allowOut + denyOut:[0.0.0.0/0]; check the E2B account supports network policy.',
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
if (!answered(allowed)) {
|
|
1292
|
+
return {
|
|
1293
|
+
state: 'inconclusive',
|
|
1294
|
+
detail: `probe sandbox had no network (allowed=${allowed}; host=${deniedHost}, rawIP=${deniedIp}).`,
|
|
1295
|
+
remediation: 'The allow-listed control host did not answer, so the probe observed nothing. Check the sandbox template / E2B networking.',
|
|
1296
|
+
};
|
|
1297
|
+
}
|
|
1298
|
+
if (blocked(deniedHost) && blocked(deniedIp)) {
|
|
1299
|
+
return {
|
|
1300
|
+
state: 'filtered',
|
|
1301
|
+
detail: `deny-by-default verified: ${EGRESS_PROBE_ALLOW}=${allowed} reachable; ${EGRESS_PROBE_DENY}=${deniedHost} and raw IP=${deniedIp} blocked.`,
|
|
1302
|
+
};
|
|
1303
|
+
}
|
|
1304
|
+
return {
|
|
1305
|
+
state: 'inconclusive',
|
|
1306
|
+
detail: `Egress probe output was unreadable (host=${deniedHost}, rawIP=${deniedIp}, allowed=${allowed}).`,
|
|
1307
|
+
};
|
|
1308
|
+
}
|
|
1272
1309
|
/**
|
|
1273
1310
|
* Create an E2B provider with the given configuration.
|
|
1274
1311
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/api-code-sandbox-e2b",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "E2B (e2b.dev) code sandbox provider — Firecracker microVMs with golden templates, fork, and pause/resume",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -57,6 +57,6 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@bufbuild/protobuf": "2.13.0",
|
|
60
|
-
"e2b": "2.
|
|
60
|
+
"e2b": "2.51.0"
|
|
61
61
|
}
|
|
62
62
|
}
|