just-bash 2.12.5 → 2.12.7
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/banned-patterns-test.d.ts +0 -7
- package/dist/bin/chunks/{awk2-4MK3F3NZ.js → awk2-EB5SCHVW.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-ZRRNCS7N.js → chunks/chunk-5MUD3WB2.js} +1 -1
- package/dist/bin/chunks/{chunk-EMSJEY2U.js → chunk-BBRVF6XE.js} +1 -1
- package/dist/bin/chunks/chunk-DHFZMFUW.js +36 -0
- package/dist/bin/{shell/chunks/chunk-5ATRLST6.js → chunks/chunk-IRCLOW32.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-UT6LUTWP.js → chunks/chunk-JX6YLHDX.js} +1 -1
- package/dist/bin/chunks/chunk-NTKUVXEL.js +5 -0
- package/dist/bin/chunks/{chunk-RDGXTKIB.js → chunk-OLN6BSO3.js} +1 -1
- package/dist/bin/chunks/chunk-PIBXJ3VX.js +13 -0
- package/dist/bin/chunks/chunk-PLKGKTIS.js +6 -0
- package/dist/bin/{shell/chunks/chunk-WWVVJW3F.js → chunks/chunk-QTII62YM.js} +1 -1
- package/dist/bin/chunks/{chunk-RS2PRILS.js → chunk-ROMKUVHI.js} +1 -1
- package/dist/bin/chunks/{chunk-2HDH5VPF.js → chunk-VCKKRS7V.js} +1 -1
- package/dist/bin/chunks/chunk-ZJGIBTWD.js +2 -0
- package/dist/bin/{shell/chunks/chunk-6W7JTG6A.js → chunks/chunk-ZNPXCE5B.js} +99 -99
- package/dist/bin/{shell/chunks/curl-GIQ5S66Y.js → chunks/curl-3GMIPMCI.js} +1 -1
- package/dist/bin/{shell/chunks/flag-coverage-NDF6MQAO.js → chunks/flag-coverage-7GOZYXJT.js} +1 -1
- package/dist/bin/{shell/chunks/jq-F7FJ46VM.js → chunks/jq-P457LMHU.js} +1 -1
- package/dist/bin/chunks/{python3-QBGIYRFR.js → python3-45TMCI4M.js} +7 -7
- package/dist/bin/{shell/chunks/sed-ENUQOCBB.js → chunks/sed-UV2LTNVK.js} +1 -1
- package/dist/bin/chunks/sleep-3WHM7JMW.js +2 -0
- package/dist/bin/{shell/chunks/sqlite3-4SBQACEE.js → chunks/sqlite3-B3P3OMPI.js} +1 -1
- package/dist/bin/chunks/tar-SO3XDDIW.js +2 -0
- package/dist/bin/chunks/timeout-BYB3L2JA.js +2 -0
- package/dist/bin/chunks/worker.js +155 -14
- package/dist/bin/chunks/xan-FZB7FHX3.js +2 -0
- package/dist/bin/chunks/yq-H7D2U3HS.js +2 -0
- package/dist/bin/just-bash.js +125 -125
- package/dist/bin/shell/chunks/{awk2-4MK3F3NZ.js → awk2-EB5SCHVW.js} +1 -1
- package/dist/bin/{chunks/chunk-ZRRNCS7N.js → shell/chunks/chunk-5MUD3WB2.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-EMSJEY2U.js → chunk-BBRVF6XE.js} +1 -1
- package/dist/bin/shell/chunks/chunk-DHFZMFUW.js +36 -0
- package/dist/bin/{chunks/chunk-5ATRLST6.js → shell/chunks/chunk-IRCLOW32.js} +1 -1
- package/dist/bin/{chunks/chunk-UT6LUTWP.js → shell/chunks/chunk-JX6YLHDX.js} +1 -1
- package/dist/bin/shell/chunks/chunk-NTKUVXEL.js +5 -0
- package/dist/bin/shell/chunks/{chunk-RDGXTKIB.js → chunk-OLN6BSO3.js} +1 -1
- package/dist/bin/shell/chunks/chunk-PIBXJ3VX.js +13 -0
- package/dist/bin/shell/chunks/chunk-PLKGKTIS.js +6 -0
- package/dist/bin/{chunks/chunk-WWVVJW3F.js → shell/chunks/chunk-QTII62YM.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-RS2PRILS.js → chunk-ROMKUVHI.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-2HDH5VPF.js → chunk-VCKKRS7V.js} +1 -1
- package/dist/bin/shell/chunks/chunk-ZJGIBTWD.js +2 -0
- package/dist/bin/{chunks/chunk-6W7JTG6A.js → shell/chunks/chunk-ZNPXCE5B.js} +99 -99
- package/dist/bin/{chunks/curl-GIQ5S66Y.js → shell/chunks/curl-3GMIPMCI.js} +1 -1
- package/dist/bin/{chunks/flag-coverage-NDF6MQAO.js → shell/chunks/flag-coverage-7GOZYXJT.js} +1 -1
- package/dist/bin/{chunks/jq-F7FJ46VM.js → shell/chunks/jq-P457LMHU.js} +1 -1
- package/dist/bin/shell/chunks/{python3-XN7O5X3A.js → python3-IV3DBMHM.js} +7 -7
- package/dist/bin/{chunks/sed-ENUQOCBB.js → shell/chunks/sed-UV2LTNVK.js} +1 -1
- package/dist/bin/shell/chunks/sleep-3WHM7JMW.js +2 -0
- package/dist/bin/{chunks/sqlite3-4SBQACEE.js → shell/chunks/sqlite3-B3P3OMPI.js} +1 -1
- package/dist/bin/shell/chunks/tar-SO3XDDIW.js +2 -0
- package/dist/bin/shell/chunks/timeout-BYB3L2JA.js +2 -0
- package/dist/bin/shell/chunks/xan-FZB7FHX3.js +2 -0
- package/dist/bin/shell/chunks/yq-H7D2U3HS.js +2 -0
- package/dist/bin/shell/shell.js +124 -124
- package/dist/bundle/browser.js +503 -503
- package/dist/bundle/chunks/{awk2-ID6QVUYU.js → awk2-VPBKDCSO.js} +1 -1
- package/dist/bundle/chunks/{chunk-CBAJ47B3.js → chunk-4YPFHVJJ.js} +1 -1
- package/dist/bundle/chunks/{chunk-3ZBKQKTX.js → chunk-6HBBXB3L.js} +1 -1
- package/dist/bundle/chunks/chunk-72EQZSVH.js +4 -0
- package/dist/bundle/chunks/{chunk-SJ5LXPUH.js → chunk-7YDOWJ75.js} +1 -1
- package/dist/bundle/chunks/chunk-AUD37QB3.js +35 -0
- package/dist/bundle/chunks/{chunk-TVHAURH5.js → chunk-BED5HSP2.js} +1 -1
- package/dist/bundle/chunks/{chunk-3J4BCKUH.js → chunk-C7ZTXK5C.js} +99 -99
- package/dist/bundle/chunks/chunk-DZZS6SJP.js +1 -0
- package/dist/bundle/chunks/chunk-KZ7BI7TV.js +5 -0
- package/dist/bundle/chunks/chunk-U5FWK6IA.js +12 -0
- package/dist/bundle/chunks/{chunk-HOFSUCIB.js → chunk-VBF2GWEM.js} +1 -1
- package/dist/bundle/chunks/{chunk-AYQ5FKKK.js → chunk-VSWTMNI3.js} +1 -1
- package/dist/bundle/chunks/{chunk-L75XCEQX.js → chunk-X36DXRVC.js} +1 -1
- package/dist/bundle/chunks/{chunk-2OZNLYX4.js → chunk-X3CVFNQZ.js} +1 -1
- package/dist/bundle/chunks/{curl-743M564K.js → curl-KM2ZAUR6.js} +1 -1
- package/dist/bundle/chunks/{flag-coverage-4M54QHNZ.js → flag-coverage-NT32EG6Q.js} +1 -1
- package/dist/bundle/chunks/{jq-5FRYP6YP.js → jq-NLRWI2Q6.js} +1 -1
- package/dist/bundle/chunks/{python3-WANWDR22.js → python3-G2ZUJAQL.js} +7 -7
- package/dist/bundle/chunks/{sed-TS7M7I25.js → sed-2BILOGNL.js} +1 -1
- package/dist/bundle/chunks/sleep-IUBP5GMH.js +1 -0
- package/dist/bundle/chunks/{sqlite3-IH5QMEIK.js → sqlite3-VEDNWJL6.js} +1 -1
- package/dist/bundle/chunks/tar-LKO7DKAK.js +1 -0
- package/dist/bundle/chunks/timeout-TL4Q5YKZ.js +1 -0
- package/dist/bundle/chunks/worker.js +155 -14
- package/dist/bundle/chunks/xan-KSDYKKEK.js +1 -0
- package/dist/bundle/chunks/yq-HIQ4WMDY.js +1 -0
- package/dist/bundle/index.cjs +717 -717
- package/dist/bundle/index.js +111 -111
- package/dist/commands/python3/worker.d.ts +1 -0
- package/dist/commands/query-engine/safe-object.d.ts +13 -0
- package/dist/commands/sqlite3/worker.d.ts +1 -0
- package/dist/network/allow-list/shared.d.ts +4 -0
- package/dist/network/types.d.ts +5 -1
- package/package.json +34 -34
- package/vendor/cpython-emscripten/python.wasm +0 -0
- package/dist/bin/chunks/chunk-DERQIX2O.js +0 -36
- package/dist/bin/chunks/chunk-LWKIHJ5L.js +0 -13
- package/dist/bin/chunks/chunk-Q5MYEU7X.js +0 -5
- package/dist/bin/chunks/chunk-UYBH3FNE.js +0 -2
- package/dist/bin/chunks/chunk-W752QGNZ.js +0 -6
- package/dist/bin/chunks/sleep-5T34UFNF.js +0 -2
- package/dist/bin/chunks/tar-3UIZ4IRM.js +0 -2
- package/dist/bin/chunks/timeout-7ECKKPNP.js +0 -2
- package/dist/bin/chunks/xan-5QTBTP4U.js +0 -2
- package/dist/bin/chunks/yq-O5RSLLA3.js +0 -2
- package/dist/bin/shell/chunks/chunk-DERQIX2O.js +0 -36
- package/dist/bin/shell/chunks/chunk-LWKIHJ5L.js +0 -13
- package/dist/bin/shell/chunks/chunk-Q5MYEU7X.js +0 -5
- package/dist/bin/shell/chunks/chunk-UYBH3FNE.js +0 -2
- package/dist/bin/shell/chunks/chunk-W752QGNZ.js +0 -6
- package/dist/bin/shell/chunks/sleep-5T34UFNF.js +0 -2
- package/dist/bin/shell/chunks/tar-3UIZ4IRM.js +0 -2
- package/dist/bin/shell/chunks/timeout-7ECKKPNP.js +0 -2
- package/dist/bin/shell/chunks/xan-5QTBTP4U.js +0 -2
- package/dist/bin/shell/chunks/yq-O5RSLLA3.js +0 -2
- package/dist/bundle/chunks/chunk-7MKBHGLS.js +0 -1
- package/dist/bundle/chunks/chunk-C764MECG.js +0 -35
- package/dist/bundle/chunks/chunk-FD7SFJNJ.js +0 -4
- package/dist/bundle/chunks/chunk-QI4EPYAT.js +0 -5
- package/dist/bundle/chunks/chunk-R5XRHEZH.js +0 -12
- package/dist/bundle/chunks/sleep-RRZXXEW2.js +0 -1
- package/dist/bundle/chunks/tar-JCULQ5J2.js +0 -1
- package/dist/bundle/chunks/timeout-DNGO7OHT.js +0 -1
- package/dist/bundle/chunks/xan-LAW2EMOM.js +0 -1
- package/dist/bundle/chunks/yq-MFJEXB7R.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
2
|
+
import{f as w}from"./chunk-ZJGIBTWD.js";import{a as b}from"./chunk-4VDEBYW7.js";import{a as y,b as T,c as d}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";function f(s){let t=s.indexOf("=");if(t>=0){let a=s.slice(0,t),r=s.slice(t+1);return a?`${encodeURIComponent(a)}=${encodeURIComponent(r)}`:encodeURIComponent(r)}return encodeURIComponent(s)}function c(s){let t=s.indexOf("=");if(t<0)return null;let a=s.slice(0,t),r=s.slice(t+1),e,i,o=r.match(/;type=([^;]+)$/);o&&(i=o[1],r=r.slice(0,-o[0].length));let n=r.match(/;filename=([^;]+)/);return n&&(e=n[1],r=r.replace(n[0],"")),(r.startsWith("@")||r.startsWith("<"))&&(e=e??r.slice(1).split("/").pop()),{name:a,value:r,filename:e,contentType:i}}function O(s,t){let a=`----CurlFormBoundary${Date.now().toString(36)}`,r=[];for(let e of s){let i=e.value;if(i.startsWith("@")||i.startsWith("<")){let n=i.slice(1);i=t.get(n)??""}let o=`--${a}\r
|
|
3
3
|
`;e.filename?(o+=`Content-Disposition: form-data; name="${e.name}"; filename="${e.filename}"\r
|
|
4
4
|
`,e.contentType&&(o+=`Content-Type: ${e.contentType}\r
|
|
5
5
|
`)):o+=`Content-Disposition: form-data; name="${e.name}"\r
|
package/dist/bin/{shell/chunks/flag-coverage-NDF6MQAO.js → chunks/flag-coverage-7GOZYXJT.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{b as yr}from"./chunk-
|
|
2
|
+
import{b as yr}from"./chunk-QTII62YM.js";import{b as Ar}from"./chunk-ZNPXCE5B.js";import{b as $r}from"./chunk-BBRVF6XE.js";import"./chunk-GZHFXDDO.js";import"./chunk-QSDVMMYI.js";import{c as Sr}from"./chunk-DHFZMFUW.js";import{b as wr}from"./chunk-XKPFI566.js";import{b as xr}from"./chunk-2BC3N3L2.js";import{b as vr}from"./chunk-IDGH4PGU.js";import{b as kr}from"./chunk-F3LGZXLQ.js";import{b as qr}from"./chunk-BYDV4VEF.js";import{b as Cr}from"./chunk-JLX6YWGA.js";import{b as br}from"./chunk-FLPVVSN5.js";import{d as Ir,e as Mr,f as jr}from"./chunk-54G6AE72.js";import{b as tr}from"./chunk-VCKKRS7V.js";import{b as lr}from"./chunk-VIYJJTN2.js";import{b as ur}from"./chunk-THALLNXT.js";import{b as pr}from"./chunk-EZS766DD.js";import{b as er}from"./chunk-3Y32LPNT.js";import{b as dr}from"./chunk-7BORMNPQ.js";import{b as cr}from"./chunk-N43DJTSI.js";import"./chunk-OBI37ZY4.js";import{b as hr}from"./chunk-N5OTVT4F.js";import{c as or,d as ar}from"./chunk-MAVV76T4.js";import{b as sr}from"./chunk-JTF74J6E.js";import{c as ir,d as gr}from"./chunk-GO6FXSC4.js";import{b as mr}from"./chunk-PIBXJ3VX.js";import"./chunk-PLKGKTIS.js";import"./chunk-ZJGIBTWD.js";import{b as Fr}from"./chunk-GOJZHH3L.js";import{b as zr}from"./chunk-P6GNZPVW.js";import{b as fr}from"./chunk-LOJMXC4F.js";import{b as nr}from"./chunk-ROMKUVHI.js";import"./chunk-YTIURC67.js";import{b as R}from"./chunk-PQNTKMH3.js";import{b as U}from"./chunk-PPBQJBC2.js";import{b as V}from"./chunk-NSUMEERA.js";import{b as W}from"./chunk-XY5HGZW5.js";import{c as X,d as Y}from"./chunk-N4EU64Y4.js";import{c as Z,d as _}from"./chunk-3MBAUIBB.js";import{b as N}from"./chunk-RT7TRQVZ.js";import{b as rr}from"./chunk-47HZU3SY.js";import{b as G}from"./chunk-RJSAGJQJ.js";import{b as H}from"./chunk-YEKSVVRC.js";import{b as J}from"./chunk-26NO42TF.js";import{b as K}from"./chunk-LGJM5YFT.js";import{b as L}from"./chunk-LMK6G2HH.js";import{b as O}from"./chunk-ZKC5HQYO.js";import{b as P}from"./chunk-ROJPSS6N.js";import{b as Q}from"./chunk-STOAUD75.js";import{b as y}from"./chunk-CGE2EHYP.js";import{b as A}from"./chunk-ZA4HUKJ3.js";import{b as $}from"./chunk-WWZVR5NN.js";import{b as S}from"./chunk-JQBC3FXE.js";import{b as T}from"./chunk-SYL34GE7.js";import{b as B}from"./chunk-5G2VOPPJ.js";import{b as D}from"./chunk-SGA7Y45Z.js";import{b as E}from"./chunk-EUXCM6C4.js";import{b as w}from"./chunk-YLE2OYY6.js";import{b as x}from"./chunk-S7OHMN3F.js";import{b as v}from"./chunk-YWZOGBFE.js";import"./chunk-YMMJLYIX.js";import{d as k,e as q,f as C}from"./chunk-YFPDB4PH.js";import"./chunk-SXB55JOI.js";import{b}from"./chunk-35JD7YEM.js";import"./chunk-4OALHZXB.js";import"./chunk-G43H2WGH.js";import{b as I}from"./chunk-IRCLOW32.js";import{b as M}from"./chunk-OLN6BSO3.js";import{b as j}from"./chunk-FA2CHD73.js";import{b as t}from"./chunk-R2LDP472.js";import{b as l}from"./chunk-PS4LOXE5.js";import{b as u}from"./chunk-VNER2XXL.js";import{b as p}from"./chunk-YX7OOTPO.js";import{b as e}from"./chunk-7ADG3DNO.js";import{b as d}from"./chunk-TEFXEYX3.js";import{b as c}from"./chunk-ZSVBYEY4.js";import{b as h}from"./chunk-SXRVLCZ4.js";import"./chunk-FSZWFMB4.js";import"./chunk-QZNF3Y3J.js";import"./chunk-JX6YLHDX.js";import"./chunk-4PRVMER6.js";import"./chunk-5MUD3WB2.js";import"./chunk-NTKUVXEL.js";import"./chunk-SE4C7FJY.js";import{b as i}from"./chunk-LJKIWB5F.js";import{b as g}from"./chunk-MRP4ZCD7.js";import"./chunk-5WFYIUU2.js";import{b as m}from"./chunk-ND23BJUM.js";import"./chunk-D5WP4CKS.js";import"./chunk-6KZRLMG3.js";import{b as F}from"./chunk-MXVNCVD6.js";import"./chunk-OBH7XN5N.js";import{b as z}from"./chunk-OQV5J23L.js";import"./chunk-SYG3IW7P.js";import{b as f}from"./chunk-EJQKHROT.js";import"./chunk-JBABAK44.js";import{b as n}from"./chunk-ITA43A73.js";import"./chunk-4VDEBYW7.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var Er=[i,g,m,F,z,f,n,t,l,u,p,e,d,c,h,w,x,v,k,q,C,b,I,M,j,y,A,$,S,T,B,D,E,G,H,J,K,L,O,P,Q,R,U,V,W,X,Y,Z,_,N,rr,or,ar,sr,ir,gr,mr,Fr,zr,fr,nr,tr,lr,ur,pr,er,dr,cr,hr,wr,xr,vr,kr,qr,Cr,br,Ir,Mr,jr,yr,Ar,$r,Sr];function Tr(){return Er}var Br=new Map;for(let r of Tr())Br.set(r.name,new Set(r.flags.map(o=>o.flag)));function Fa(r,o,Dr){let a=Br.get(o);if(!(!a||a.size===0))for(let s of Dr)a.has(s)&&r.hit(`cmd:flag:${o}:${s}`)}export{Fa as emitFlagCoverage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a,b}from"./chunk-
|
|
2
|
+
import{a,b}from"./chunk-PIBXJ3VX.js";import"./chunk-PLKGKTIS.js";import"./chunk-ZJGIBTWD.js";import"./chunk-4PRVMER6.js";import"./chunk-5MUD3WB2.js";import"./chunk-NTKUVXEL.js";import"./chunk-SE4C7FJY.js";import"./chunk-5WFYIUU2.js";import"./chunk-6KZRLMG3.js";import"./chunk-OBH7XN5N.js";import"./chunk-SYG3IW7P.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as jqCommand};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./chunk-MY5PY2PL.js";import{a as M,b as c}from"./chunk-QZNF3Y3J.js";import{a as P,b as U}from"./chunk-
|
|
2
|
+
import"./chunk-MY5PY2PL.js";import{a as M,b as c}from"./chunk-QZNF3Y3J.js";import{a as P,b as U}from"./chunk-JX6YLHDX.js";import{a as N}from"./chunk-4PRVMER6.js";import{c as y}from"./chunk-5MUD3WB2.js";import{b as I}from"./chunk-NTKUVXEL.js";import{a as l}from"./chunk-SYG3IW7P.js";import{a as L,b as k}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";import{randomBytes as H}from"node:crypto";import{fileURLToPath as W}from"node:url";import{Worker as z}from"node:worker_threads";var u={NOOP:0,READ_FILE:1,WRITE_FILE:2,STAT:3,READDIR:4,MKDIR:5,RM:6,EXISTS:7,APPEND_FILE:8,SYMLINK:9,READLINK:10,LSTAT:11,CHMOD:12,REALPATH:13,WRITE_STDOUT:100,WRITE_STDERR:101,EXIT:102,HTTP_REQUEST:200},a={PENDING:0,READY:1,SUCCESS:2,ERROR:3},E={NONE:0,NOT_FOUND:1,IS_DIRECTORY:2,NOT_DIRECTORY:3,EXISTS:4,PERMISSION_DENIED:5,INVALID_PATH:6,IO_ERROR:7,TIMEOUT:8,NETWORK_ERROR:9,NETWORK_NOT_CONFIGURED:10},i={OP_CODE:0,STATUS:4,PATH_LENGTH:8,DATA_LENGTH:12,RESULT_LENGTH:16,ERROR_CODE:20,FLAGS:24,MODE:28,PATH_BUFFER:32,DATA_BUFFER:4128},w={CONTROL_REGION:32,PATH_BUFFER:4096,DATA_BUFFER:1048576,TOTAL:1052704},F={NONE:0,RECURSIVE:1,FORCE:2,MKDIR_RECURSIVE:1},p={IS_FILE:0,IS_DIRECTORY:1,IS_SYMLINK:2,MODE:4,SIZE:8,MTIME:16,TOTAL:24};function V(){return new M(w.TOTAL)}var A=class{int32View;uint8View;dataView;constructor(t){this.int32View=new Int32Array(t),this.uint8View=new Uint8Array(t),this.dataView=new DataView(t)}getOpCode(){return c.load(this.int32View,i.OP_CODE/4)}setOpCode(t){c.store(this.int32View,i.OP_CODE/4,t)}getStatus(){return c.load(this.int32View,i.STATUS/4)}setStatus(t){c.store(this.int32View,i.STATUS/4,t)}getPathLength(){return c.load(this.int32View,i.PATH_LENGTH/4)}setPathLength(t){c.store(this.int32View,i.PATH_LENGTH/4,t)}getDataLength(){return c.load(this.int32View,i.DATA_LENGTH/4)}setDataLength(t){c.store(this.int32View,i.DATA_LENGTH/4,t)}getResultLength(){return c.load(this.int32View,i.RESULT_LENGTH/4)}setResultLength(t){c.store(this.int32View,i.RESULT_LENGTH/4,t)}getErrorCode(){return c.load(this.int32View,i.ERROR_CODE/4)}setErrorCode(t){c.store(this.int32View,i.ERROR_CODE/4,t)}getFlags(){return c.load(this.int32View,i.FLAGS/4)}setFlags(t){c.store(this.int32View,i.FLAGS/4,t)}getMode(){return c.load(this.int32View,i.MODE/4)}setMode(t){c.store(this.int32View,i.MODE/4,t)}getPath(){let t=this.getPathLength(),e=this.uint8View.slice(i.PATH_BUFFER,i.PATH_BUFFER+t);return new TextDecoder().decode(e)}setPath(t){let e=new TextEncoder().encode(t);if(e.length>w.PATH_BUFFER)throw new Error(`Path too long: ${e.length} > ${w.PATH_BUFFER}`);this.uint8View.set(e,i.PATH_BUFFER),this.setPathLength(e.length)}getData(){let t=this.getDataLength();return this.uint8View.slice(i.DATA_BUFFER,i.DATA_BUFFER+t)}setData(t){if(t.length>w.DATA_BUFFER)throw new Error(`Data too large: ${t.length} > ${w.DATA_BUFFER}`);this.uint8View.set(t,i.DATA_BUFFER),this.setDataLength(t.length)}getDataAsString(){let t=this.getData();return new TextDecoder().decode(t)}setDataFromString(t){let e=new TextEncoder().encode(t);this.setData(e)}getResult(){let t=this.getResultLength();return this.uint8View.slice(i.DATA_BUFFER,i.DATA_BUFFER+t)}setResult(t){if(t.length>w.DATA_BUFFER)throw new Error(`Result too large: ${t.length} > ${w.DATA_BUFFER}`);this.uint8View.set(t,i.DATA_BUFFER),this.setResultLength(t.length)}getResultAsString(){let t=this.getResult();return new TextDecoder().decode(t)}setResultFromString(t){let e=new TextEncoder().encode(t);this.setResult(e)}encodeStat(t){this.uint8View[i.DATA_BUFFER+p.IS_FILE]=t.isFile?1:0,this.uint8View[i.DATA_BUFFER+p.IS_DIRECTORY]=t.isDirectory?1:0,this.uint8View[i.DATA_BUFFER+p.IS_SYMLINK]=t.isSymbolicLink?1:0,this.dataView.setInt32(i.DATA_BUFFER+p.MODE,t.mode,!0);let e=Math.min(t.size,Number.MAX_SAFE_INTEGER);this.dataView.setFloat64(i.DATA_BUFFER+p.SIZE,e,!0),this.dataView.setFloat64(i.DATA_BUFFER+p.MTIME,t.mtime.getTime(),!0),this.setResultLength(p.TOTAL)}decodeStat(){return{isFile:this.uint8View[i.DATA_BUFFER+p.IS_FILE]===1,isDirectory:this.uint8View[i.DATA_BUFFER+p.IS_DIRECTORY]===1,isSymbolicLink:this.uint8View[i.DATA_BUFFER+p.IS_SYMLINK]===1,mode:this.dataView.getInt32(i.DATA_BUFFER+p.MODE,!0),size:this.dataView.getFloat64(i.DATA_BUFFER+p.SIZE,!0),mtime:new Date(this.dataView.getFloat64(i.DATA_BUFFER+p.MTIME,!0))}}waitForReady(t){return c.wait(this.int32View,i.STATUS/4,a.PENDING,t)}waitForReadyAsync(t){return c.waitAsync(this.int32View,i.STATUS/4,a.PENDING,t)}async waitUntilReady(t){let e=Date.now();for(;;){let s=this.getStatus();if(s===a.READY)return!0;let r=Date.now()-e;if(r>=t)return!1;let n=t-r,m=c.waitAsync(this.int32View,i.STATUS/4,s,n);if(m.async&&await m.value==="timed-out")return!1}}waitForResult(t){return c.wait(this.int32View,i.STATUS/4,a.READY,t)}notify(){return c.notify(this.int32View,i.STATUS/4)}reset(){this.setOpCode(u.NOOP),this.setStatus(a.PENDING),this.setPathLength(0),this.setDataLength(0),this.setResultLength(0),this.setErrorCode(E.NONE),this.setFlags(F.NONE),this.setMode(0)}};var x=class{fs;cwd;secureFetch;maxOutputSize;protocol;running=!1;output={stdout:"",stderr:"",exitCode:0};outputLimitExceeded=!1;constructor(t,e,s,r=void 0,n=0){this.fs=e,this.cwd=s,this.secureFetch=r,this.maxOutputSize=n,this.protocol=new A(t)}async run(t){this.running=!0;let e=Date.now();for(;this.running;){let s=Date.now()-e;if(s>=t){this.output.stderr+=`
|
|
3
3
|
python3: execution timeout exceeded
|
|
4
4
|
`,this.output.exitCode=124;break}let r=t-s;if(!await this.protocol.waitUntilReady(r)){this.output.stderr+=`
|
|
5
5
|
python3: execution timeout exceeded
|
|
6
|
-
`,this.output.exitCode=124;break}let m=this.protocol.getOpCode();await this.handleOperation(m),this.protocol.notify()}return this.output}stop(){this.running=!1}async handleOperation(t){try{switch(t){case u.READ_FILE:await this.handleReadFile();break;case u.WRITE_FILE:await this.handleWriteFile();break;case u.STAT:await this.handleStat();break;case u.LSTAT:await this.handleLstat();break;case u.READDIR:await this.handleReaddir();break;case u.MKDIR:await this.handleMkdir();break;case u.RM:await this.handleRm();break;case u.EXISTS:await this.handleExists();break;case u.APPEND_FILE:await this.handleAppendFile();break;case u.SYMLINK:await this.handleSymlink();break;case u.READLINK:await this.handleReadlink();break;case u.CHMOD:await this.handleChmod();break;case u.REALPATH:await this.handleRealpath();break;case u.WRITE_STDOUT:this.handleWriteStdout();break;case u.WRITE_STDERR:this.handleWriteStderr();break;case u.EXIT:this.handleExit();break;case u.HTTP_REQUEST:await this.handleHttpRequest();break;default:this.protocol.setErrorCode(E.IO_ERROR),this.protocol.setStatus(a.ERROR)}}catch(e){this.setErrorFromException(e)}}resolvePath(t){return this.fs.resolvePath(this.cwd,t)}async handleReadFile(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readFileBuffer(t);this.protocol.setResult(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleWriteFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.writeFile(t,e),this.protocol.setStatus(a.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleStat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.stat(t);this.protocol.encodeStat(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleLstat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.lstat(t);this.protocol.encodeStat(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleReaddir(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readdir(t);this.protocol.setResultFromString(JSON.stringify(e)),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleMkdir(){let t=this.resolvePath(this.protocol.getPath()),s=(this.protocol.getFlags()&
|
|
7
|
-
`,e=t.length>this.maxOutputSize?t.slice(0,this.maxOutputSize):t;if(this.output.stderr.includes("total output size exceeded"))return;let r=this.output.stdout.length+this.output.stderr.length+e.length-this.maxOutputSize;if(r>0)if(this.output.stdout.length>=r)this.output.stdout=this.output.stdout.slice(0,this.output.stdout.length-r);else{let n=r-this.output.stdout.length;this.output.stdout="",n>=this.output.stderr.length?this.output.stderr="":this.output.stderr=this.output.stderr.slice(0,this.output.stderr.length-n)}this.output.stderr+=e}async handleHttpRequest(){if(!this.secureFetch){this.protocol.setErrorCode(E.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString("Network access not configured. Enable network in Bash options."),this.protocol.setStatus(a.ERROR);return}let t=this.protocol.getPath(),e=this.protocol.getDataAsString();try{let s=e?JSON.parse(e):{},r=await this.secureFetch(t,{method:s.method,headers:s.headers,body:s.body}),n=JSON.stringify({status:r.status,statusText:r.statusText,headers:r.headers,body:r.body,url:r.url});this.protocol.setResultFromString(n),this.protocol.setStatus(a.SUCCESS)}catch(s){let r=l(s instanceof Error?s.message:String(s));this.protocol.setErrorCode(E.NETWORK_ERROR),this.protocol.setResultFromString(r),this.protocol.setStatus(a.ERROR)}}setErrorFromException(t){let e=t instanceof Error?t.message:String(t),s=l(e),r=E.IO_ERROR,n=e.toLowerCase();n.includes("no such file")||n.includes("not found")||n.includes("enoent")?r=E.NOT_FOUND:n.includes("is a directory")||n.includes("eisdir")?r=E.IS_DIRECTORY:n.includes("not a directory")||n.includes("enotdir")?r=E.NOT_DIRECTORY:n.includes("already exists")||n.includes("eexist")?r=E.EXISTS:(n.includes("permission")||n.includes("eperm")||n.includes("eacces"))&&(r=E.PERMISSION_DENIED),this.protocol.setErrorCode(r),this.protocol.setResultFromString(s),this.protocol.setStatus(a.ERROR)}};var
|
|
6
|
+
`,this.output.exitCode=124;break}let m=this.protocol.getOpCode();await this.handleOperation(m),this.protocol.notify()}return this.output}stop(){this.running=!1}async handleOperation(t){try{switch(t){case u.READ_FILE:await this.handleReadFile();break;case u.WRITE_FILE:await this.handleWriteFile();break;case u.STAT:await this.handleStat();break;case u.LSTAT:await this.handleLstat();break;case u.READDIR:await this.handleReaddir();break;case u.MKDIR:await this.handleMkdir();break;case u.RM:await this.handleRm();break;case u.EXISTS:await this.handleExists();break;case u.APPEND_FILE:await this.handleAppendFile();break;case u.SYMLINK:await this.handleSymlink();break;case u.READLINK:await this.handleReadlink();break;case u.CHMOD:await this.handleChmod();break;case u.REALPATH:await this.handleRealpath();break;case u.WRITE_STDOUT:this.handleWriteStdout();break;case u.WRITE_STDERR:this.handleWriteStderr();break;case u.EXIT:this.handleExit();break;case u.HTTP_REQUEST:await this.handleHttpRequest();break;default:this.protocol.setErrorCode(E.IO_ERROR),this.protocol.setStatus(a.ERROR)}}catch(e){this.setErrorFromException(e)}}resolvePath(t){return this.fs.resolvePath(this.cwd,t)}async handleReadFile(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readFileBuffer(t);this.protocol.setResult(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleWriteFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.writeFile(t,e),this.protocol.setStatus(a.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleStat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.stat(t);this.protocol.encodeStat(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleLstat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.lstat(t);this.protocol.encodeStat(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleReaddir(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readdir(t);this.protocol.setResultFromString(JSON.stringify(e)),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleMkdir(){let t=this.resolvePath(this.protocol.getPath()),s=(this.protocol.getFlags()&F.MKDIR_RECURSIVE)!==0;try{await this.fs.mkdir(t,{recursive:s}),this.protocol.setStatus(a.SUCCESS)}catch(r){this.setErrorFromException(r)}}async handleRm(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),s=(e&F.RECURSIVE)!==0,r=(e&F.FORCE)!==0;try{await this.fs.rm(t,{recursive:s,force:r}),this.protocol.setStatus(a.SUCCESS)}catch(n){this.setErrorFromException(n)}}async handleExists(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.exists(t);this.protocol.setResult(new Uint8Array([e?1:0])),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleAppendFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.appendFile(t,e),this.protocol.setStatus(a.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleSymlink(){let t=this.protocol.getPath(),e=this.protocol.getDataAsString(),s=this.resolvePath(t);try{await this.fs.symlink(e,s),this.protocol.setStatus(a.SUCCESS)}catch(r){this.setErrorFromException(r)}}async handleReadlink(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readlink(t);this.protocol.setResultFromString(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleChmod(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getMode();try{await this.fs.chmod(t,e),this.protocol.setStatus(a.SUCCESS)}catch(s){this.setErrorFromException(s)}}async handleRealpath(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.realpath(t);this.protocol.setResultFromString(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}handleWriteStdout(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stdout",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(E.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setStatus(a.ERROR);return}this.protocol.setStatus(a.SUCCESS)}handleWriteStderr(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stderr",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(E.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setStatus(a.ERROR);return}this.protocol.setStatus(a.SUCCESS)}handleExit(){let t=this.protocol.getFlags();this.outputLimitExceeded?this.output.exitCode===0&&(this.output.exitCode=1):this.output.exitCode=t,this.protocol.setStatus(a.SUCCESS),this.running=!1}tryAppendOutput(t,e){return this.outputLimitExceeded?!1:this.maxOutputSize<=0?(t==="stdout"?this.output.stdout+=e:this.output.stderr+=e,!0):this.output.stdout.length+this.output.stderr.length+e.length>this.maxOutputSize?!1:(t==="stdout"?this.output.stdout+=e:this.output.stderr+=e,!0)}appendOutputLimitError(){if(this.maxOutputSize<=0)return;let t=`python3: total output size exceeded (>${this.maxOutputSize} bytes), increase executionLimits.maxOutputSize
|
|
7
|
+
`,e=t.length>this.maxOutputSize?t.slice(0,this.maxOutputSize):t;if(this.output.stderr.includes("total output size exceeded"))return;let r=this.output.stdout.length+this.output.stderr.length+e.length-this.maxOutputSize;if(r>0)if(this.output.stdout.length>=r)this.output.stdout=this.output.stdout.slice(0,this.output.stdout.length-r);else{let n=r-this.output.stdout.length;this.output.stdout="",n>=this.output.stderr.length?this.output.stderr="":this.output.stderr=this.output.stderr.slice(0,this.output.stderr.length-n)}this.output.stderr+=e}async handleHttpRequest(){if(!this.secureFetch){this.protocol.setErrorCode(E.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString("Network access not configured. Enable network in Bash options."),this.protocol.setStatus(a.ERROR);return}let t=this.protocol.getPath(),e=this.protocol.getDataAsString();try{let s=e?JSON.parse(e):{},r=await this.secureFetch(t,{method:s.method,headers:s.headers,body:s.body}),n=JSON.stringify({status:r.status,statusText:r.statusText,headers:r.headers,body:r.body,url:r.url});this.protocol.setResultFromString(n),this.protocol.setStatus(a.SUCCESS)}catch(s){let r=l(s instanceof Error?s.message:String(s));this.protocol.setErrorCode(E.NETWORK_ERROR),this.protocol.setResultFromString(r),this.protocol.setStatus(a.ERROR)}}setErrorFromException(t){let e=t instanceof Error?t.message:String(t),s=l(e),r=E.IO_ERROR,n=e.toLowerCase();n.includes("no such file")||n.includes("not found")||n.includes("enoent")?r=E.NOT_FOUND:n.includes("is a directory")||n.includes("eisdir")?r=E.IS_DIRECTORY:n.includes("not a directory")||n.includes("enotdir")?r=E.NOT_DIRECTORY:n.includes("already exists")||n.includes("eexist")?r=E.EXISTS:(n.includes("permission")||n.includes("eperm")||n.includes("eacces"))&&(r=E.PERMISSION_DENIED),this.protocol.setErrorCode(r),this.protocol.setResultFromString(s),this.protocol.setStatus(a.ERROR)}};var G=3e4,$={name:"python3",summary:"Execute Python code via CPython Emscripten",usage:"python3 [OPTIONS] [-c CODE | -m MODULE | FILE] [ARGS...]",description:["Execute Python code using CPython compiled to WebAssembly via Emscripten.","","This command runs Python in an isolated environment with access to","the virtual filesystem. Standard library modules are available."],options:["-c CODE Execute CODE as Python script","-m MODULE Run library module as a script","--version Show Python version","--help Show this help"],examples:['python3 -c "print(1 + 2)"','python3 -c "import sys; print(sys.version)"',"python3 script.py","python3 script.py arg1 arg2",`echo 'print("hello")' | python3`],notes:["CPython runs in WebAssembly, so execution may be slower than native Python.","Standard library modules are available (no pip install).","Maximum execution time is 30 seconds by default."]};function Y(o){let t={code:null,module:null,scriptFile:null,showVersion:!1,scriptArgs:[]};if(o.length===0)return t;let e=o.findIndex(s=>!s.startsWith("-")||s==="-"||s==="--");for(let s=0;s<(e===-1?o.length:e);s++){let r=o[s];if(r==="-c")return s+1>=o.length?{stdout:"",stderr:`python3: option requires an argument -- 'c'
|
|
8
8
|
`,exitCode:2}:(t.code=o[s+1],t.scriptArgs=o.slice(s+2),t);if(r==="-m")return s+1>=o.length?{stdout:"",stderr:`python3: option requires an argument -- 'm'
|
|
9
9
|
`,exitCode:2}:(t.module=o[s+1],t.scriptArgs=o.slice(s+2),t);if(r==="--version"||r==="-V")return t.showVersion=!0,t;if(r.startsWith("-")&&r!=="-")return{stdout:"",stderr:`python3: unrecognized option '${r}'
|
|
10
|
-
`,exitCode:2}}if(e!==-1){let s=o[e];s==="--"?e+1<o.length&&(t.scriptFile=o[e+1],t.scriptArgs=o.slice(e+2)):(t.scriptFile=s,t.scriptArgs=o.slice(e+1))}return t}var _=new WeakMap;function
|
|
10
|
+
`,exitCode:2}}if(e!==-1){let s=o[e];s==="--"?e+1<o.length&&(t.scriptFile=o[e+1],t.scriptArgs=o.slice(e+2)):(t.scriptFile=s,t.scriptArgs=o.slice(e+1))}return t}var _=new WeakMap;function K(o){let t=_.get(o);return t||(t={executionQueue:[],isExecuting:!1},_.set(o,t)),t}function Rt(){_=new WeakMap}var Q=W(new URL("./worker.js",import.meta.url));function X(){return H(16).toString("hex")}function Z(o,t){if(!o||typeof o!="object")return{success:!1,error:"Malformed worker response"};let e=o;return typeof e.protocolToken!="string"||e.protocolToken!==t?{success:!1,error:"Malformed worker response: invalid protocol token"}:e.type==="security-violation"?{success:!1,error:`Security violation: ${typeof e.violation?.type=="string"?e.violation.type:"unknown"}`}:typeof e.success!="boolean"?{success:!1,error:"Malformed worker response: missing success flag"}:e.success?{success:!0}:{success:!1,error:typeof e.error=="string"&&e.error.length>0?e.error:"Worker execution failed"}}function f(o){if(o.isExecuting||o.executionQueue.length===0)return;for(;o.executionQueue.length>0&&o.executionQueue[0].canceled;)o.executionQueue.shift();if(o.executionQueue.length===0)return;let t=o.executionQueue.shift();if(!t)return;o.isExecuting=!0;let e;try{e=I.runTrusted(()=>new z(Q,{workerData:t.input}))}catch(h){let d=h instanceof Error?h.message:String(h);t.resolve({success:!1,error:l(d)}),o.isExecuting=!1,f(o);return}t.workerRef&&(t.workerRef.current=e);let s=y(t.requireDefenseContext,"python3","worker message callback",h=>{t.resolve(Z(h,t.input.protocolToken)),o.isExecuting=!1,e.terminate(),f(o)}),r=y(t.requireDefenseContext,"python3","worker error callback",h=>{t.resolve({success:!1,error:l(h.message)}),o.isExecuting=!1,f(o)}),n=y(t.requireDefenseContext,"python3","worker exit callback",()=>{o.isExecuting&&(t.resolve({success:!1,error:"Worker exited unexpectedly"}),o.isExecuting=!1,f(o))}),m=h=>{try{s(h)}catch(d){let g=d instanceof Error?d.message:String(d);t.resolve({success:!1,error:l(g)}),o.isExecuting=!1,e.terminate(),f(o)}},S=h=>{try{r(h)}catch(d){let g=d instanceof Error?d.message:String(d);t.resolve({success:!1,error:l(g)}),o.isExecuting=!1,f(o)}},D=()=>{try{n()}catch(h){let d=h instanceof Error?h.message:String(h);t.resolve({success:!1,error:l(d)}),o.isExecuting=!1,f(o)}};e.on("message",m),e.on("error",S),e.on("exit",D)}async function J(o,t,e,s=[]){let r=V(),n=new x(r,t.fs,t.cwd,t.fetch,t.limits?.maxOutputSize??0),m=t.limits?.maxPythonTimeoutMs??G,S=K(t.fs),D={protocolToken:X(),sharedBuffer:r,pythonCode:o,cwd:t.cwd,env:N(t.env),args:s,scriptPath:e},h={current:null},d=new Promise(R=>{let C={input:D,resolve:()=>{},workerRef:h,requireDefenseContext:t.requireDefenseContext},b=y(t.requireDefenseContext,"python3","worker timeout callback",()=>{h.current?h.current.terminate():C.canceled=!0,R({success:!1,error:`Execution timeout: exceeded ${m}ms limit`})}),v=P(()=>{try{b()}catch(T){let B=T instanceof Error?T.message:String(T);R({success:!1,error:l(B)})}},m);C.resolve=T=>{U(v),R(T)},S.executionQueue.push(C),f(S)}),[g,O]=await Promise.all([n.run(m).catch(R=>({stdout:"",stderr:`python3: bridge error: ${l(R.message)}
|
|
11
11
|
`,exitCode:1})),d.catch(R=>({success:!1,error:l(R.message)}))]);if(!O.success&&O.error){let R=l(O.error);return{stdout:g.stdout,stderr:`${g.stderr}python3: ${R}
|
|
12
|
-
`,exitCode:g.exitCode||1}}return g}var
|
|
12
|
+
`,exitCode:g.exitCode||1}}return g}var j={name:"python3",async execute(o,t){if(k(o))return L($);let e=Y(o);if("exitCode"in e)return e;if(e.showVersion)return{stdout:`Python 3.13.2 (Emscripten)
|
|
13
13
|
`,stderr:"",exitCode:0};let s,r;if(e.code!==null)s=e.code,r="-c";else if(e.module!==null){if(!/^[a-zA-Z_][a-zA-Z0-9_.]*$/.test(e.module))return{stdout:"",stderr:`python3: No module named '${e.module.slice(0,200)}'
|
|
14
14
|
`,exitCode:1};s=`import runpy; runpy.run_module('${e.module}', run_name='__main__')`,r=e.module}else if(e.scriptFile!==null){let n=t.fs.resolvePath(t.cwd,e.scriptFile);if(!await t.fs.exists(n))return{stdout:"",stderr:`python3: can't open file '${e.scriptFile}': [Errno 2] No such file or directory
|
|
15
|
-
`,exitCode:2};try{s=await t.fs.readFile(n),r=e.scriptFile}catch(m){let
|
|
15
|
+
`,exitCode:2};try{s=await t.fs.readFile(n),r=e.scriptFile}catch(m){let S=l(m.message);return{stdout:"",stderr:`python3: can't open file '${e.scriptFile}': ${S}
|
|
16
16
|
`,exitCode:2}}}else if(t.stdin.trim())s=t.stdin,r="<stdin>";else return{stdout:"",stderr:`python3: no input provided (use -c CODE, -m MODULE, or provide a script file)
|
|
17
|
-
`,exitCode:2};return
|
|
17
|
+
`,exitCode:2};return J(s,t,r,e.scriptArgs)}},gt={name:"python",async execute(o,t){return j.execute(o,t)}};export{Rt as _resetExecutionQueue,j as python3Command,gt as pythonCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a,b}from"./chunk-
|
|
2
|
+
import{a,b}from"./chunk-IRCLOW32.js";import"./chunk-5MUD3WB2.js";import"./chunk-NTKUVXEL.js";import"./chunk-SE4C7FJY.js";import"./chunk-6KZRLMG3.js";import"./chunk-SYG3IW7P.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as sedCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a,b,c}from"./chunk-
|
|
2
|
+
import{a,b,c}from"./chunk-DHFZMFUW.js";import"./chunk-JX6YLHDX.js";import"./chunk-5MUD3WB2.js";import"./chunk-NTKUVXEL.js";import"./chunk-SYG3IW7P.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{a as _internals,c as flagsForFuzzing,b as sqlite3Command};
|
|
@@ -169,6 +169,34 @@ function getBlockedGlobals() {
|
|
|
169
169
|
strategy: "throw",
|
|
170
170
|
reason: "process.setgid could escalate privileges"
|
|
171
171
|
},
|
|
172
|
+
{
|
|
173
|
+
prop: "seteuid",
|
|
174
|
+
target: process,
|
|
175
|
+
violationType: "process_setuid",
|
|
176
|
+
strategy: "throw",
|
|
177
|
+
reason: "process.seteuid could escalate effective user privileges"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
prop: "setegid",
|
|
181
|
+
target: process,
|
|
182
|
+
violationType: "process_setuid",
|
|
183
|
+
strategy: "throw",
|
|
184
|
+
reason: "process.setegid could escalate effective group privileges"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
prop: "initgroups",
|
|
188
|
+
target: process,
|
|
189
|
+
violationType: "process_setuid",
|
|
190
|
+
strategy: "throw",
|
|
191
|
+
reason: "process.initgroups could modify supplementary group IDs"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
prop: "setgroups",
|
|
195
|
+
target: process,
|
|
196
|
+
violationType: "process_setuid",
|
|
197
|
+
strategy: "throw",
|
|
198
|
+
reason: "process.setgroups could modify supplementary group IDs"
|
|
199
|
+
},
|
|
172
200
|
// File permission manipulation
|
|
173
201
|
{
|
|
174
202
|
prop: "umask",
|
|
@@ -205,6 +233,30 @@ function getBlockedGlobals() {
|
|
|
205
233
|
strategy: "throw",
|
|
206
234
|
reason: "process.chdir could confuse the interpreter's CWD tracking"
|
|
207
235
|
},
|
|
236
|
+
// Diagnostic report (leaks full environment, host paths, system info)
|
|
237
|
+
{
|
|
238
|
+
prop: "report",
|
|
239
|
+
target: process,
|
|
240
|
+
violationType: "process_report",
|
|
241
|
+
strategy: "throw",
|
|
242
|
+
reason: "process.report could disclose full environment, host paths, and system info"
|
|
243
|
+
},
|
|
244
|
+
// Environment file loading (Node 21.7+)
|
|
245
|
+
{
|
|
246
|
+
prop: "loadEnvFile",
|
|
247
|
+
target: process,
|
|
248
|
+
violationType: "process_env",
|
|
249
|
+
strategy: "throw",
|
|
250
|
+
reason: "process.loadEnvFile could load env files bypassing env proxy"
|
|
251
|
+
},
|
|
252
|
+
// Exception handler manipulation
|
|
253
|
+
{
|
|
254
|
+
prop: "setUncaughtExceptionCaptureCallback",
|
|
255
|
+
target: process,
|
|
256
|
+
violationType: "process_exception_handler",
|
|
257
|
+
strategy: "throw",
|
|
258
|
+
reason: "setUncaughtExceptionCaptureCallback could intercept security errors"
|
|
259
|
+
},
|
|
208
260
|
// IPC communication vectors (may be undefined in non-IPC contexts)
|
|
209
261
|
{
|
|
210
262
|
prop: "send",
|
|
@@ -818,6 +870,42 @@ var WorkerDefenseInDepth = class {
|
|
|
818
870
|
if (!excludeTypes.has("process_connected")) {
|
|
819
871
|
this.protectProcessConnected();
|
|
820
872
|
}
|
|
873
|
+
this.lockWellKnownSymbols();
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* Lock well-known Symbol properties on built-in constructors/prototypes.
|
|
877
|
+
*/
|
|
878
|
+
lockWellKnownSymbols() {
|
|
879
|
+
const lock = (obj, sym) => {
|
|
880
|
+
try {
|
|
881
|
+
const desc = Object.getOwnPropertyDescriptor(obj, sym);
|
|
882
|
+
if (desc?.configurable) {
|
|
883
|
+
if ("value" in desc) {
|
|
884
|
+
Object.defineProperty(obj, sym, {
|
|
885
|
+
...desc,
|
|
886
|
+
configurable: false,
|
|
887
|
+
writable: false
|
|
888
|
+
});
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
Object.defineProperty(obj, sym, { ...desc, configurable: false });
|
|
892
|
+
}
|
|
893
|
+
} catch {
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
for (const ctor of [Array, Map, Set, RegExp, Promise]) {
|
|
897
|
+
lock(ctor, Symbol.species);
|
|
898
|
+
}
|
|
899
|
+
for (const proto of [
|
|
900
|
+
Array.prototype,
|
|
901
|
+
String.prototype,
|
|
902
|
+
Map.prototype,
|
|
903
|
+
Set.prototype
|
|
904
|
+
]) {
|
|
905
|
+
lock(proto, Symbol.iterator);
|
|
906
|
+
}
|
|
907
|
+
lock(Symbol.prototype, Symbol.toPrimitive);
|
|
908
|
+
lock(Date.prototype, Symbol.toPrimitive);
|
|
821
909
|
}
|
|
822
910
|
/**
|
|
823
911
|
* Protect against .constructor.constructor escape vector.
|
|
@@ -1814,6 +1902,26 @@ var SyncFsBackend = class {
|
|
|
1814
1902
|
// src/commands/python3/worker.ts
|
|
1815
1903
|
import { readFileSync } from "node:fs";
|
|
1816
1904
|
var require2 = createRequire(import.meta.url);
|
|
1905
|
+
var CPYTHON_ENTRY_BASENAME = "/vendor/cpython-emscripten/python.cjs";
|
|
1906
|
+
var CPYTHON_STDLIB_BASENAME = "/vendor/cpython-emscripten/python313.zip";
|
|
1907
|
+
var moduleLoadGuardInstalled = false;
|
|
1908
|
+
function normalizePath(path) {
|
|
1909
|
+
return path.replace(/\\/g, "/");
|
|
1910
|
+
}
|
|
1911
|
+
function isApprovedCpythonEntryPath(path) {
|
|
1912
|
+
return normalizePath(path).endsWith(CPYTHON_ENTRY_BASENAME);
|
|
1913
|
+
}
|
|
1914
|
+
function isApprovedStdlibZipPath(path) {
|
|
1915
|
+
return normalizePath(path).endsWith(CPYTHON_STDLIB_BASENAME);
|
|
1916
|
+
}
|
|
1917
|
+
function assertApprovedPath(path, kind) {
|
|
1918
|
+
const ok = kind === "cpython-entry" ? isApprovedCpythonEntryPath(path) : isApprovedStdlibZipPath(path);
|
|
1919
|
+
if (!ok) {
|
|
1920
|
+
throw new Error(
|
|
1921
|
+
`[Defense-in-depth] rejected ${kind} path outside approved vendor bundle: ${path}`
|
|
1922
|
+
);
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1817
1925
|
try {
|
|
1818
1926
|
const NodeModule = require2("node:module");
|
|
1819
1927
|
if (typeof NodeModule._load === "function") {
|
|
@@ -1854,18 +1962,22 @@ try {
|
|
|
1854
1962
|
}
|
|
1855
1963
|
return originalLoad.apply(this, [request, ...rest]);
|
|
1856
1964
|
};
|
|
1965
|
+
moduleLoadGuardInstalled = true;
|
|
1857
1966
|
}
|
|
1858
1967
|
} catch {
|
|
1859
1968
|
}
|
|
1860
|
-
var
|
|
1969
|
+
var cpythonEntryPath;
|
|
1861
1970
|
try {
|
|
1862
|
-
|
|
1863
|
-
|
|
1971
|
+
cpythonEntryPath = require2.resolve(
|
|
1972
|
+
"../../../vendor/cpython-emscripten/python.cjs"
|
|
1864
1973
|
);
|
|
1865
1974
|
} catch (_e) {
|
|
1866
|
-
|
|
1975
|
+
cpythonEntryPath = dirname(import.meta.url).replace("file://", "") + "/../../../vendor/cpython-emscripten/python.cjs";
|
|
1867
1976
|
}
|
|
1977
|
+
assertApprovedPath(cpythonEntryPath, "cpython-entry");
|
|
1978
|
+
var cpythonDir = dirname(cpythonEntryPath);
|
|
1868
1979
|
var stdlibZipPath = `${cpythonDir}/python313.zip`;
|
|
1980
|
+
assertApprovedPath(stdlibZipPath, "cpython-stdlib");
|
|
1869
1981
|
function createHOSTFS(backend, FS, PATH) {
|
|
1870
1982
|
const ERRNO_CODES = {
|
|
1871
1983
|
EPERM: 63,
|
|
@@ -2641,9 +2753,22 @@ sys.modules['jb_http'] = jb_http
|
|
|
2641
2753
|
`;
|
|
2642
2754
|
}
|
|
2643
2755
|
var cachedStdlibZip = new Uint8Array(readFileSync(stdlibZipPath));
|
|
2644
|
-
function
|
|
2756
|
+
function wrapWorkerMessage(protocolToken, message) {
|
|
2757
|
+
const wrapped = /* @__PURE__ */ Object.create(null);
|
|
2758
|
+
if (!message || typeof message !== "object") {
|
|
2759
|
+
wrapped.success = false;
|
|
2760
|
+
wrapped.error = "Worker attempted to post non-object message";
|
|
2761
|
+
wrapped.protocolToken = protocolToken;
|
|
2762
|
+
return wrapped;
|
|
2763
|
+
}
|
|
2764
|
+
for (const [key, value] of Object.entries(message))
|
|
2765
|
+
wrapped[key] = value;
|
|
2766
|
+
wrapped.protocolToken = protocolToken;
|
|
2767
|
+
return wrapped;
|
|
2768
|
+
}
|
|
2769
|
+
function postWorkerMessage(protocolToken, message) {
|
|
2645
2770
|
try {
|
|
2646
|
-
parentPort?.postMessage(message);
|
|
2771
|
+
parentPort?.postMessage(wrapWorkerMessage(protocolToken, message));
|
|
2647
2772
|
} catch (error) {
|
|
2648
2773
|
console.debug(
|
|
2649
2774
|
"[python3-worker] failed to post worker message:",
|
|
@@ -2652,8 +2777,15 @@ function postWorkerMessage(message) {
|
|
|
2652
2777
|
}
|
|
2653
2778
|
}
|
|
2654
2779
|
async function runPython(input) {
|
|
2780
|
+
if (!moduleLoadGuardInstalled) {
|
|
2781
|
+
return {
|
|
2782
|
+
success: false,
|
|
2783
|
+
error: "Defense-in-depth module-loader guard failed to initialize; refusing to execute Python worker"
|
|
2784
|
+
};
|
|
2785
|
+
}
|
|
2655
2786
|
const backend = new SyncFsBackend(input.sharedBuffer);
|
|
2656
|
-
|
|
2787
|
+
assertApprovedPath(cpythonEntryPath, "cpython-entry");
|
|
2788
|
+
const createPythonModule = require2(cpythonEntryPath);
|
|
2657
2789
|
let moduleReady = false;
|
|
2658
2790
|
const pendingStdout = [];
|
|
2659
2791
|
const pendingStderr = [];
|
|
@@ -2711,7 +2843,7 @@ async function runPython(input) {
|
|
|
2711
2843
|
error: `Failed to load CPython: ${message}`
|
|
2712
2844
|
};
|
|
2713
2845
|
}
|
|
2714
|
-
activateDefense();
|
|
2846
|
+
activateDefense(input.protocolToken);
|
|
2715
2847
|
moduleReady = true;
|
|
2716
2848
|
for (const text of pendingStdout) backend.writeStdout(text);
|
|
2717
2849
|
for (const text of pendingStderr) backend.writeStderr(text);
|
|
@@ -2775,7 +2907,7 @@ sys.exit(_jb_exit_code)
|
|
|
2775
2907
|
}
|
|
2776
2908
|
}
|
|
2777
2909
|
var defense = null;
|
|
2778
|
-
function activateDefense() {
|
|
2910
|
+
function activateDefense(protocolToken) {
|
|
2779
2911
|
if (defense) return;
|
|
2780
2912
|
const _DateNow = Date.now;
|
|
2781
2913
|
const degraded = { now: () => _DateNow(), timeOrigin: _DateNow() };
|
|
@@ -2788,7 +2920,10 @@ function activateDefense() {
|
|
|
2788
2920
|
"python3-worker",
|
|
2789
2921
|
"onViolation",
|
|
2790
2922
|
(v) => {
|
|
2791
|
-
postWorkerMessage(
|
|
2923
|
+
postWorkerMessage(protocolToken, {
|
|
2924
|
+
type: "security-violation",
|
|
2925
|
+
violation: v
|
|
2926
|
+
});
|
|
2792
2927
|
}
|
|
2793
2928
|
);
|
|
2794
2929
|
defense = new WorkerDefenseInDepth({
|
|
@@ -2805,20 +2940,26 @@ function activateDefense() {
|
|
|
2805
2940
|
});
|
|
2806
2941
|
}
|
|
2807
2942
|
process.on("uncaughtException", (e) => {
|
|
2943
|
+
if (!activeProtocolToken) {
|
|
2944
|
+
return;
|
|
2945
|
+
}
|
|
2808
2946
|
const message = sanitizeErrorMessage(e.message);
|
|
2809
|
-
postWorkerMessage({
|
|
2947
|
+
postWorkerMessage(activeProtocolToken, {
|
|
2810
2948
|
success: false,
|
|
2811
2949
|
error: `Worker uncaught exception: ${message}`
|
|
2812
2950
|
});
|
|
2813
2951
|
});
|
|
2952
|
+
var activeProtocolToken = null;
|
|
2814
2953
|
if (parentPort) {
|
|
2815
2954
|
if (workerData) {
|
|
2816
|
-
|
|
2955
|
+
const input = workerData;
|
|
2956
|
+
activeProtocolToken = input.protocolToken;
|
|
2957
|
+
runPython(input).then((result) => {
|
|
2817
2958
|
result.defenseStats = defense?.getStats();
|
|
2818
|
-
postWorkerMessage(result);
|
|
2959
|
+
postWorkerMessage(input.protocolToken, result);
|
|
2819
2960
|
}).catch((e) => {
|
|
2820
2961
|
const message = sanitizeUnknownError(e);
|
|
2821
|
-
postWorkerMessage({
|
|
2962
|
+
postWorkerMessage(input.protocolToken, {
|
|
2822
2963
|
success: false,
|
|
2823
2964
|
error: message,
|
|
2824
2965
|
defenseStats: defense?.getStats()
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a,b}from"./chunk-BBRVF6XE.js";import"./chunk-GZHFXDDO.js";import"./chunk-QSDVMMYI.js";import"./chunk-PLKGKTIS.js";import"./chunk-ZJGIBTWD.js";import"./chunk-4PRVMER6.js";import"./chunk-5MUD3WB2.js";import"./chunk-NTKUVXEL.js";import"./chunk-SE4C7FJY.js";import"./chunk-5WFYIUU2.js";import"./chunk-6KZRLMG3.js";import"./chunk-OBH7XN5N.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as xanCommand};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a,b}from"./chunk-ZNPXCE5B.js";import"./chunk-QSDVMMYI.js";import"./chunk-PLKGKTIS.js";import"./chunk-ZJGIBTWD.js";import"./chunk-4PRVMER6.js";import"./chunk-5MUD3WB2.js";import"./chunk-NTKUVXEL.js";import"./chunk-SE4C7FJY.js";import"./chunk-6KZRLMG3.js";import"./chunk-SYG3IW7P.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as yqCommand};
|