just-bash 2.12.8 → 2.13.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/README.md +89 -3
- package/dist/AGENTS.md +1 -1
- package/dist/Bash.d.ts +17 -0
- package/dist/bin/chunks/{awk2-J2PNSA7C.js → awk2-VTJMI54B.js} +1 -1
- package/dist/bin/chunks/chunk-3YMCKZTY.js +14 -0
- package/dist/bin/chunks/{chunk-O5B6WWQQ.js → chunk-A3HQTYHR.js} +1 -1
- package/dist/bin/chunks/chunk-AAW7UMPO.js +9 -0
- package/dist/bin/chunks/{chunk-2V53PP6G.js → chunk-B3RU2PUI.js} +27 -27
- package/dist/bin/chunks/chunk-CQG2HEAL.js +5 -0
- package/dist/bin/chunks/chunk-DOXYBGNA.js +12 -0
- package/dist/bin/{shell/chunks/chunk-YAEF6X2N.js → chunks/chunk-GR23MPTT.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-35JD7YEM.js → chunks/chunk-HJEHIH4P.js} +13 -13
- package/dist/bin/chunks/{chunk-UG4GMDQL.js → chunk-LGF54XJQ.js} +1 -1
- package/dist/bin/chunks/chunk-N6KA6G3Q.js +11 -0
- package/dist/bin/chunks/{chunk-2BC3N3L2.js → chunk-ORUYSLP4.js} +4 -4
- package/dist/bin/chunks/{chunk-REGSV3X5.js → chunk-SDLWFYVT.js} +1 -1
- package/dist/bin/chunks/{chunk-STOAUD75.js → chunk-THNL3XFF.js} +8 -8
- package/dist/bin/chunks/{chunk-ZJGIBTWD.js → chunk-V7ZOPVQS.js} +1 -1
- package/dist/bin/chunks/{chunk-ZYQQ6B7B.js → chunk-ZO5PSLKR.js} +2 -2
- package/dist/bin/{shell/chunks/curl-3GMIPMCI.js → chunks/curl-B64SIJOD.js} +1 -1
- package/dist/bin/chunks/env-NTPN5QYM.js +2 -0
- package/dist/bin/{shell/chunks/expansion-JBCP2CHQ.js → chunks/expansion-2RO5M3QC.js} +1 -1
- package/dist/bin/{shell/chunks/find-MTLF23HX.js → chunks/find-GAYRV4IF.js} +1 -1
- package/dist/bin/{shell/chunks/flag-coverage-CFWN3JJN.js → chunks/flag-coverage-IRM4GISL.js} +1 -1
- package/dist/bin/{shell/chunks/help-4H52JYYC.js → chunks/help-DVG4AAGE.js} +1 -1
- package/dist/bin/{shell/chunks/jq-JFXEKNLN.js → chunks/jq-V7FYGIKO.js} +1 -1
- package/dist/bin/chunks/js-exec-YGYYZEEQ.js +97 -0
- package/dist/bin/chunks/js-exec-worker.js +4368 -0
- package/dist/bin/chunks/python3-EIXZW3LO.js +12 -0
- package/dist/bin/chunks/rg-C6KMBFNG.js +2 -0
- package/dist/bin/{shell/chunks/time-GZSHCM77.js → chunks/time-VSKBXRQH.js} +1 -1
- package/dist/bin/chunks/{timeout-JJWIFL7W.js → timeout-Z24MNWOP.js} +1 -1
- package/dist/bin/chunks/worker.js +87 -33
- package/dist/bin/chunks/{xan-M6MLWZCU.js → xan-MOZFJGMY.js} +1 -1
- package/dist/bin/chunks/xargs-SCYIFXOW.js +2 -0
- package/dist/bin/chunks/{yq-YWUQUXJJ.js → yq-JJLSDDST.js} +1 -1
- package/dist/bin/just-bash.js +158 -157
- package/dist/bin/shell/chunks/{awk2-J2PNSA7C.js → awk2-VTJMI54B.js} +1 -1
- package/dist/bin/shell/chunks/chunk-3YMCKZTY.js +14 -0
- package/dist/bin/shell/chunks/{chunk-O5B6WWQQ.js → chunk-A3HQTYHR.js} +1 -1
- package/dist/bin/shell/chunks/chunk-AAW7UMPO.js +9 -0
- package/dist/bin/shell/chunks/{chunk-2V53PP6G.js → chunk-B3RU2PUI.js} +27 -27
- package/dist/bin/shell/chunks/chunk-CQG2HEAL.js +5 -0
- package/dist/bin/shell/chunks/chunk-DOXYBGNA.js +12 -0
- package/dist/bin/{chunks/chunk-YAEF6X2N.js → shell/chunks/chunk-GR23MPTT.js} +1 -1
- package/dist/bin/{chunks/chunk-35JD7YEM.js → shell/chunks/chunk-HJEHIH4P.js} +13 -13
- package/dist/bin/shell/chunks/{chunk-UG4GMDQL.js → chunk-LGF54XJQ.js} +1 -1
- package/dist/bin/shell/chunks/chunk-N6KA6G3Q.js +11 -0
- package/dist/bin/shell/chunks/{chunk-2BC3N3L2.js → chunk-ORUYSLP4.js} +4 -4
- package/dist/bin/shell/chunks/{chunk-REGSV3X5.js → chunk-SDLWFYVT.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-STOAUD75.js → chunk-THNL3XFF.js} +8 -8
- package/dist/bin/shell/chunks/{chunk-ZJGIBTWD.js → chunk-V7ZOPVQS.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-ZYQQ6B7B.js → chunk-ZO5PSLKR.js} +2 -2
- package/dist/bin/{chunks/curl-3GMIPMCI.js → shell/chunks/curl-B64SIJOD.js} +1 -1
- package/dist/bin/shell/chunks/env-NTPN5QYM.js +2 -0
- package/dist/bin/{chunks/expansion-JBCP2CHQ.js → shell/chunks/expansion-2RO5M3QC.js} +1 -1
- package/dist/bin/{chunks/find-MTLF23HX.js → shell/chunks/find-GAYRV4IF.js} +1 -1
- package/dist/bin/{chunks/flag-coverage-CFWN3JJN.js → shell/chunks/flag-coverage-IRM4GISL.js} +1 -1
- package/dist/bin/{chunks/help-4H52JYYC.js → shell/chunks/help-DVG4AAGE.js} +1 -1
- package/dist/bin/{chunks/jq-JFXEKNLN.js → shell/chunks/jq-V7FYGIKO.js} +1 -1
- package/dist/bin/shell/chunks/js-exec-VYG74FQ3.js +97 -0
- package/dist/bin/shell/chunks/python3-WO3WFGMS.js +12 -0
- package/dist/bin/shell/chunks/rg-C6KMBFNG.js +2 -0
- package/dist/bin/{chunks/time-GZSHCM77.js → shell/chunks/time-VSKBXRQH.js} +1 -1
- package/dist/bin/shell/chunks/{timeout-JJWIFL7W.js → timeout-Z24MNWOP.js} +1 -1
- package/dist/bin/shell/chunks/{xan-M6MLWZCU.js → xan-MOZFJGMY.js} +1 -1
- package/dist/bin/shell/chunks/xargs-SCYIFXOW.js +2 -0
- package/dist/bin/shell/chunks/{yq-YWUQUXJJ.js → yq-JJLSDDST.js} +1 -1
- package/dist/bin/shell/shell.js +164 -164
- package/dist/bundle/browser.js +534 -534
- package/dist/bundle/chunks/{awk2-FUVZGMX2.js → awk2-POPGKRAI.js} +1 -1
- package/dist/bundle/chunks/{chunk-DZZS6SJP.js → chunk-7TSDKFEO.js} +1 -1
- package/dist/bundle/chunks/{chunk-D4QDMGEB.js → chunk-BBXLRYSX.js} +2 -2
- package/dist/bundle/chunks/{chunk-TRD56HID.js → chunk-FEIOJCZD.js} +1 -1
- package/dist/bundle/chunks/chunk-JCMONG3T.js +13 -0
- package/dist/bundle/chunks/{chunk-D2FZX7A2.js → chunk-LPQPILI2.js} +8 -8
- package/dist/bundle/chunks/chunk-MJWMXCEJ.js +10 -0
- package/dist/bundle/chunks/{chunk-2GOYXRRP.js → chunk-MLXIYONF.js} +4 -4
- package/dist/bundle/chunks/chunk-NAERJDUW.js +8 -0
- package/dist/bundle/chunks/{chunk-OKEHYWBE.js → chunk-NYQYO467.js} +13 -13
- package/dist/bundle/chunks/{chunk-JKLUDNMU.js → chunk-O2DBFL6Z.js} +1 -1
- package/dist/bundle/chunks/{chunk-JDMQDJYE.js → chunk-OARHFVLG.js} +1 -1
- package/dist/bundle/chunks/{chunk-AKVMAONP.js → chunk-RUF7WQ7U.js} +1 -1
- package/dist/bundle/chunks/chunk-TOMNU26N.js +4 -0
- package/dist/bundle/chunks/{chunk-ZLJ5TCLC.js → chunk-UNYNJIFU.js} +27 -27
- package/dist/bundle/chunks/chunk-YTNYSM6T.js +11 -0
- package/dist/bundle/chunks/{curl-KM2ZAUR6.js → curl-FCIO57JJ.js} +1 -1
- package/dist/bundle/chunks/env-5EPCWSXR.js +1 -0
- package/dist/bundle/chunks/{expansion-XG7G47TX.js → expansion-ENLSRCXJ.js} +1 -1
- package/dist/bundle/chunks/{find-DOIVMX6X.js → find-TPUOAIUQ.js} +1 -1
- package/dist/bundle/chunks/{flag-coverage-VML3BMJT.js → flag-coverage-SPT2DN2I.js} +1 -1
- package/dist/bundle/chunks/{help-IA5CMGR4.js → help-VVWX7SA5.js} +1 -1
- package/dist/bundle/chunks/{jq-SSCW4AAA.js → jq-DIRZBOTX.js} +1 -1
- package/dist/bundle/chunks/js-exec-R2LSP7M4.js +96 -0
- package/dist/bundle/chunks/js-exec-worker.js +4368 -0
- package/dist/bundle/chunks/python3-DH2SBOI3.js +11 -0
- package/dist/bundle/chunks/rg-FOQSCCX3.js +1 -0
- package/dist/bundle/chunks/{time-XL42Z4U5.js → time-FABCOJJU.js} +1 -1
- package/dist/bundle/chunks/{timeout-QCU4INQT.js → timeout-VRKMCG72.js} +1 -1
- package/dist/bundle/chunks/worker.js +87 -33
- package/dist/bundle/chunks/{xan-K7XYDHFV.js → xan-BXDXYEIB.js} +1 -1
- package/dist/bundle/chunks/xargs-I6EZUCYF.js +1 -0
- package/dist/bundle/chunks/{yq-WTK3HUOR.js → yq-XMVSIL6Z.js} +1 -1
- package/dist/bundle/index.cjs +956 -857
- package/dist/bundle/index.js +145 -145
- package/dist/commands/js-exec/fetch-polyfill.d.ts +6 -0
- package/dist/commands/js-exec/js-exec.d.ts +11 -0
- package/dist/commands/js-exec/module-shims.d.ts +29 -0
- package/dist/commands/js-exec/path-polyfill.d.ts +6 -0
- package/dist/commands/js-exec/worker.d.ts +30 -0
- package/dist/commands/python3/worker.d.ts +1 -0
- package/dist/commands/query-engine/safe-object.d.ts +11 -0
- package/dist/commands/registry.d.ts +13 -2
- package/dist/commands/{python3/fs-bridge-handler.d.ts → worker-bridge/bridge-handler.d.ts} +25 -8
- package/dist/commands/{python3 → worker-bridge}/protocol.d.ts +6 -3
- package/dist/commands/{python3/sync-fs-backend.d.ts → worker-bridge/sync-backend.d.ts} +25 -4
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/interpreter/interpreter.d.ts +3 -0
- package/dist/interpreter/types.d.ts +8 -0
- package/dist/limits.d.ts +3 -1
- package/dist/types.d.ts +12 -0
- package/package.json +12 -11
- package/dist/bin/chunks/chunk-47HZU3SY.js +0 -5
- package/dist/bin/chunks/chunk-CZFRRDQC.js +0 -12
- package/dist/bin/chunks/chunk-N4EU64Y4.js +0 -9
- package/dist/bin/chunks/chunk-VIYJJTN2.js +0 -14
- package/dist/bin/chunks/env-HOVBNLUR.js +0 -2
- package/dist/bin/chunks/python3-KI2FQWSN.js +0 -17
- package/dist/bin/chunks/rg-34GE6REQ.js +0 -2
- package/dist/bin/chunks/xargs-GBL6PZ2K.js +0 -2
- package/dist/bin/shell/chunks/chunk-47HZU3SY.js +0 -5
- package/dist/bin/shell/chunks/chunk-CZFRRDQC.js +0 -12
- package/dist/bin/shell/chunks/chunk-N4EU64Y4.js +0 -9
- package/dist/bin/shell/chunks/chunk-VIYJJTN2.js +0 -14
- package/dist/bin/shell/chunks/env-HOVBNLUR.js +0 -2
- package/dist/bin/shell/chunks/python3-E5X6WBBU.js +0 -17
- package/dist/bin/shell/chunks/rg-34GE6REQ.js +0 -2
- package/dist/bin/shell/chunks/xargs-GBL6PZ2K.js +0 -2
- package/dist/bundle/chunks/chunk-3RA5L262.js +0 -8
- package/dist/bundle/chunks/chunk-EX62JIX3.js +0 -13
- package/dist/bundle/chunks/chunk-WECLUBEQ.js +0 -11
- package/dist/bundle/chunks/chunk-ZSJYNBAF.js +0 -4
- package/dist/bundle/chunks/env-XZY4LKEO.js +0 -1
- package/dist/bundle/chunks/python3-2OHR6PZU.js +0 -16
- package/dist/bundle/chunks/rg-RAICUFGG.js +0 -1
- package/dist/bundle/chunks/xargs-2BBAQDTC.js +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as M,b as D}from"./chunk-N6KA6G3Q.js";import"./chunk-4OALHZXB.js";import"./chunk-MY5PY2PL.js";import"./chunk-QZNF3Y3J.js";import{a as C,b as v}from"./chunk-OOJCYVYF.js";import{a as b}from"./chunk-4PRVMER6.js";import{c as h}from"./chunk-MO4RPBN2.js";import{b as k}from"./chunk-YU6OGPZR.js";import{a as c}from"./chunk-SYG3IW7P.js";import{a as T,b as P}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";import{randomBytes as F}from"node:crypto";import{fileURLToPath as W}from"node:url";import{Worker as $}from"node:worker_threads";var Q=1e4,R=6e4,U={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 I(r){let e={code:null,module:null,scriptFile:null,showVersion:!1,scriptArgs:[]};if(r.length===0)return e;let t=r.findIndex(o=>!o.startsWith("-")||o==="-"||o==="--");for(let o=0;o<(t===-1?r.length:t);o++){let s=r[o];if(s==="-c")return o+1>=r.length?{stdout:"",stderr:`python3: option requires an argument -- 'c'
|
|
3
|
+
`,exitCode:2}:(e.code=r[o+1],e.scriptArgs=r.slice(o+2),e);if(s==="-m")return o+1>=r.length?{stdout:"",stderr:`python3: option requires an argument -- 'm'
|
|
4
|
+
`,exitCode:2}:(e.module=r[o+1],e.scriptArgs=r.slice(o+2),e);if(s==="--version"||s==="-V")return e.showVersion=!0,e;if(s.startsWith("-")&&s!=="-")return{stdout:"",stderr:`python3: unrecognized option '${s}'
|
|
5
|
+
`,exitCode:2}}if(t!==-1){let o=r[t];o==="--"?t+1<r.length&&(e.scriptFile=r[t+1],e.scriptArgs=r.slice(t+2)):(e.scriptFile=o,e.scriptArgs=r.slice(t+1))}return e}var w=new WeakMap;function L(r){let e=w.get(r);return e||(e={executionQueue:[],isExecuting:!1},w.set(r,e)),e}function oe(){w=new WeakMap}var H=W(new URL("./worker.js",import.meta.url));function N(){return F(16).toString("hex")}function z(r,e){if(!r||typeof r!="object")return{success:!1,error:"Malformed worker response"};let t=r;return typeof t.protocolToken!="string"||t.protocolToken!==e?{success:!1,error:"Malformed worker response: invalid protocol token"}:t.type==="security-violation"?{success:!1,error:`Security violation: ${typeof t.violation?.type=="string"?t.violation.type:"unknown"}`}:typeof t.success!="boolean"?{success:!1,error:"Malformed worker response: missing success flag"}:t.success?{success:!0}:{success:!1,error:typeof t.error=="string"&&t.error.length>0?t.error:"Worker execution failed"}}function a(r){if(r.isExecuting||r.executionQueue.length===0)return;for(;r.executionQueue.length>0&&r.executionQueue[0].canceled;)r.executionQueue.shift();if(r.executionQueue.length===0)return;let e=r.executionQueue.shift();if(!e)return;r.isExecuting=!0;let t;try{t=k.runTrusted(()=>new $(H,{workerData:e.input}))}catch(n){let i=n instanceof Error?n.message:String(n);e.resolve({success:!1,error:c(i)}),r.isExecuting=!1,a(r);return}e.workerRef&&(e.workerRef.current=t);let o=h(e.requireDefenseContext,"python3","worker message callback",n=>{e.resolve(z(n,e.input.protocolToken)),r.isExecuting=!1,t.terminate(),a(r)}),s=h(e.requireDefenseContext,"python3","worker error callback",n=>{e.resolve({success:!1,error:c(n.message)}),r.isExecuting=!1,a(r)}),p=h(e.requireDefenseContext,"python3","worker exit callback",()=>{r.isExecuting&&(e.resolve({success:!1,error:"Worker exited unexpectedly"}),r.isExecuting=!1,a(r))}),f=n=>{try{o(n)}catch(i){let m=i instanceof Error?i.message:String(i);e.resolve({success:!1,error:c(m)}),r.isExecuting=!1,t.terminate(),a(r)}},l=n=>{try{s(n)}catch(i){let m=i instanceof Error?i.message:String(i);e.resolve({success:!1,error:c(m)}),r.isExecuting=!1,a(r)}},y=()=>{try{p()}catch(n){let i=n instanceof Error?n.message:String(n);e.resolve({success:!1,error:c(i)}),r.isExecuting=!1,a(r)}};t.on("message",f),t.on("error",l),t.on("exit",y)}async function B(r,e,t,o=[]){let s=M(),p=new D(s,e.fs,e.cwd,"python3",e.fetch,e.limits?.maxOutputSize??0),f=e.limits?.maxPythonTimeoutMs??Q,l=e.fetch?Math.max(f,R):f,y=L(e.fs),n={protocolToken:N(),sharedBuffer:s,pythonCode:r,cwd:e.cwd,env:b(e.env),args:o,scriptPath:t,timeoutMs:l},i={current:null},m=new Promise(u=>{let E={input:n,resolve:()=>{},workerRef:i,requireDefenseContext:e.requireDefenseContext},_=h(e.requireDefenseContext,"python3","worker timeout callback",()=>{i.current?i.current.terminate():E.canceled=!0,u({success:!1,error:`Execution timeout: exceeded ${l}ms limit`})}),O=C(()=>{try{_()}catch(d){let A=d instanceof Error?d.message:String(d);u({success:!1,error:c(A)})}},l);E.resolve=d=>{v(O),u(d)},y.executionQueue.push(E),a(y)}),[g,x]=await Promise.all([p.run(l).catch(u=>({stdout:"",stderr:`python3: bridge error: ${c(u.message)}
|
|
6
|
+
`,exitCode:1})),m.catch(u=>({success:!1,error:c(u.message)}))]);if(!x.success&&x.error){let u=c(x.error);return{stdout:g.stdout,stderr:`${g.stderr}python3: ${u}
|
|
7
|
+
`,exitCode:g.exitCode||1}}return g}var V={name:"python3",async execute(r,e){if(P(r))return T(U);let t=I(r);if("exitCode"in t)return t;if(t.showVersion)return{stdout:`Python 3.13.2 (Emscripten)
|
|
8
|
+
`,stderr:"",exitCode:0};let o,s;if(t.code!==null)o=t.code,s="-c";else if(t.module!==null){if(!/^[a-zA-Z_][a-zA-Z0-9_.]*$/.test(t.module))return{stdout:"",stderr:`python3: No module named '${t.module.slice(0,200)}'
|
|
9
|
+
`,exitCode:1};o=`import runpy; runpy.run_module('${t.module}', run_name='__main__')`,s=t.module}else if(t.scriptFile!==null){let p=e.fs.resolvePath(e.cwd,t.scriptFile);if(!await e.fs.exists(p))return{stdout:"",stderr:`python3: can't open file '${t.scriptFile}': [Errno 2] No such file or directory
|
|
10
|
+
`,exitCode:2};try{o=await e.fs.readFile(p),s=t.scriptFile}catch(f){let l=c(f.message);return{stdout:"",stderr:`python3: can't open file '${t.scriptFile}': ${l}
|
|
11
|
+
`,exitCode:2}}}else if(e.stdin.trim())o=e.stdin,s="<stdin>";else return{stdout:"",stderr:`python3: no input provided (use -c CODE, -m MODULE, or provide a script file)
|
|
12
|
+
`,exitCode:2};return B(o,e,s,t.scriptArgs)}},se={name:"python",async execute(r,e){return V.execute(r,e)}};export{oe as _resetExecutionQueue,V as python3Command,se as pythonCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a,b}from"./chunk-
|
|
2
|
+
import{a,b}from"./chunk-3YMCKZTY.js";import"./chunk-4OALHZXB.js";import"./chunk-QZNF3Y3J.js";import"./chunk-4PRVMER6.js";import"./chunk-SYG3IW7P.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as timeCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a,b}from"./chunk-
|
|
2
|
+
import{a,b}from"./chunk-DOXYBGNA.js";import"./chunk-YTIURC67.js";import"./chunk-4OALHZXB.js";import"./chunk-OOJCYVYF.js";import"./chunk-YU6OGPZR.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as timeoutCommand};
|
|
@@ -647,7 +647,6 @@ var WorkerDefenseInDepth = class {
|
|
|
647
647
|
* Create a blocking proxy for a function.
|
|
648
648
|
* In worker context, always blocks (no context check needed).
|
|
649
649
|
*/
|
|
650
|
-
// @banned-pattern-ignore: intentional use of Function type for security proxy
|
|
651
650
|
createBlockingProxy(original, path, violationType) {
|
|
652
651
|
const self = this;
|
|
653
652
|
const auditMode = this.config.auditMode;
|
|
@@ -673,7 +672,7 @@ var WorkerDefenseInDepth = class {
|
|
|
673
672
|
/**
|
|
674
673
|
* Create a blocking proxy for an object (blocks all property access).
|
|
675
674
|
*/
|
|
676
|
-
createBlockingObjectProxy(original, path, violationType) {
|
|
675
|
+
createBlockingObjectProxy(original, path, violationType, allowedKeys) {
|
|
677
676
|
const self = this;
|
|
678
677
|
const auditMode = this.config.auditMode;
|
|
679
678
|
return new this.originalProxy(original, {
|
|
@@ -681,6 +680,9 @@ var WorkerDefenseInDepth = class {
|
|
|
681
680
|
if (self.inTrap) {
|
|
682
681
|
return Reflect.get(target, prop, receiver);
|
|
683
682
|
}
|
|
683
|
+
if (allowedKeys && typeof prop === "string" && allowedKeys.has(prop)) {
|
|
684
|
+
return Reflect.get(target, prop, receiver);
|
|
685
|
+
}
|
|
684
686
|
self.inTrap = true;
|
|
685
687
|
try {
|
|
686
688
|
const fullPath = `${path}.${String(prop)}`;
|
|
@@ -1477,7 +1479,8 @@ var WorkerDefenseInDepth = class {
|
|
|
1477
1479
|
) : this.createBlockingObjectProxy(
|
|
1478
1480
|
original,
|
|
1479
1481
|
path,
|
|
1480
|
-
violationType
|
|
1482
|
+
violationType,
|
|
1483
|
+
blocked.allowedKeys
|
|
1481
1484
|
);
|
|
1482
1485
|
Object.defineProperty(target, prop, {
|
|
1483
1486
|
value: proxy,
|
|
@@ -1528,7 +1531,7 @@ var _SharedArrayBuffer = globalThis.SharedArrayBuffer;
|
|
|
1528
1531
|
var _Atomics = globalThis.Atomics;
|
|
1529
1532
|
var _performanceNow = performance.now.bind(performance);
|
|
1530
1533
|
|
|
1531
|
-
// src/commands/
|
|
1534
|
+
// src/commands/worker-bridge/protocol.ts
|
|
1532
1535
|
var OpCode = {
|
|
1533
1536
|
NOOP: 0,
|
|
1534
1537
|
READ_FILE: 1,
|
|
@@ -1544,12 +1547,16 @@ var OpCode = {
|
|
|
1544
1547
|
LSTAT: 11,
|
|
1545
1548
|
CHMOD: 12,
|
|
1546
1549
|
REALPATH: 13,
|
|
1547
|
-
|
|
1550
|
+
RENAME: 14,
|
|
1551
|
+
COPY_FILE: 15,
|
|
1552
|
+
// Special operations for I/O
|
|
1548
1553
|
WRITE_STDOUT: 100,
|
|
1549
1554
|
WRITE_STDERR: 101,
|
|
1550
1555
|
EXIT: 102,
|
|
1551
1556
|
// HTTP operations
|
|
1552
|
-
HTTP_REQUEST: 200
|
|
1557
|
+
HTTP_REQUEST: 200,
|
|
1558
|
+
// Sub-shell execution
|
|
1559
|
+
EXEC_COMMAND: 300
|
|
1553
1560
|
};
|
|
1554
1561
|
var Status = {
|
|
1555
1562
|
PENDING: 0,
|
|
@@ -1586,8 +1593,10 @@ var Offset = {
|
|
|
1586
1593
|
var Size = {
|
|
1587
1594
|
CONTROL_REGION: 32,
|
|
1588
1595
|
PATH_BUFFER: 4096,
|
|
1596
|
+
// 1MB limit applies to all FS read/write operations through the bridge.
|
|
1597
|
+
// Files larger than this will be truncated. This is tight — consider
|
|
1598
|
+
// increasing if real workloads hit the cap. Reduced from 16MB for faster tests.
|
|
1589
1599
|
DATA_BUFFER: 1048576,
|
|
1590
|
-
// 1MB (reduced from 16MB for faster tests)
|
|
1591
1600
|
TOTAL: 1052704
|
|
1592
1601
|
// 32 + 4096 + 1MB
|
|
1593
1602
|
};
|
|
@@ -1828,11 +1837,13 @@ var ProtocolBuffer = class {
|
|
|
1828
1837
|
}
|
|
1829
1838
|
};
|
|
1830
1839
|
|
|
1831
|
-
// src/commands/
|
|
1832
|
-
var
|
|
1840
|
+
// src/commands/worker-bridge/sync-backend.ts
|
|
1841
|
+
var SyncBackend = class {
|
|
1833
1842
|
protocol;
|
|
1834
|
-
|
|
1843
|
+
operationTimeoutMs;
|
|
1844
|
+
constructor(sharedBuffer, operationTimeoutMs = 3e4) {
|
|
1835
1845
|
this.protocol = new ProtocolBuffer(sharedBuffer);
|
|
1846
|
+
this.operationTimeoutMs = operationTimeoutMs;
|
|
1836
1847
|
}
|
|
1837
1848
|
execSync(opCode, path, data, flags = 0, mode = 0) {
|
|
1838
1849
|
this.protocol.reset();
|
|
@@ -1845,7 +1856,7 @@ var SyncFsBackend = class {
|
|
|
1845
1856
|
}
|
|
1846
1857
|
this.protocol.setStatus(Status.READY);
|
|
1847
1858
|
this.protocol.notify();
|
|
1848
|
-
const waitResult = this.protocol.waitForResult(
|
|
1859
|
+
const waitResult = this.protocol.waitForResult(this.operationTimeoutMs);
|
|
1849
1860
|
if (waitResult === "timed-out") {
|
|
1850
1861
|
return { success: false, error: "Operation timed out" };
|
|
1851
1862
|
}
|
|
@@ -1948,6 +1959,20 @@ var SyncFsBackend = class {
|
|
|
1948
1959
|
}
|
|
1949
1960
|
return this.protocol.getResultAsString();
|
|
1950
1961
|
}
|
|
1962
|
+
rename(oldPath, newPath) {
|
|
1963
|
+
const newPathData = new TextEncoder().encode(newPath);
|
|
1964
|
+
const result = this.execSync(OpCode.RENAME, oldPath, newPathData);
|
|
1965
|
+
if (!result.success) {
|
|
1966
|
+
throw new Error(result.error || "Failed to rename");
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
copyFile(src, dest) {
|
|
1970
|
+
const destData = new TextEncoder().encode(dest);
|
|
1971
|
+
const result = this.execSync(OpCode.COPY_FILE, src, destData);
|
|
1972
|
+
if (!result.success) {
|
|
1973
|
+
throw new Error(result.error || "Failed to copyFile");
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1951
1976
|
writeStdout(data) {
|
|
1952
1977
|
const encoded = new TextEncoder().encode(data);
|
|
1953
1978
|
const result = this.execSync(OpCode.WRITE_STDOUT, "", encoded);
|
|
@@ -1978,6 +2003,32 @@ var SyncFsBackend = class {
|
|
|
1978
2003
|
const responseJson = new TextDecoder().decode(result.result);
|
|
1979
2004
|
return JSON.parse(responseJson);
|
|
1980
2005
|
}
|
|
2006
|
+
/**
|
|
2007
|
+
* Execute a shell command through the main thread's exec function.
|
|
2008
|
+
* Returns the result as { stdout, stderr, exitCode }.
|
|
2009
|
+
*/
|
|
2010
|
+
execCommand(command, stdin) {
|
|
2011
|
+
const requestData = stdin ? new TextEncoder().encode(JSON.stringify({ stdin })) : void 0;
|
|
2012
|
+
const result = this.execSync(OpCode.EXEC_COMMAND, command, requestData);
|
|
2013
|
+
if (!result.success) {
|
|
2014
|
+
throw new Error(result.error || "Command execution failed");
|
|
2015
|
+
}
|
|
2016
|
+
const responseJson = new TextDecoder().decode(result.result);
|
|
2017
|
+
return JSON.parse(responseJson);
|
|
2018
|
+
}
|
|
2019
|
+
/**
|
|
2020
|
+
* Execute a shell command with structured args (shell-escaped on the main thread).
|
|
2021
|
+
* Prevents command injection from unsanitized args.
|
|
2022
|
+
*/
|
|
2023
|
+
execCommandArgs(command, args) {
|
|
2024
|
+
const requestData = new TextEncoder().encode(JSON.stringify({ args }));
|
|
2025
|
+
const result = this.execSync(OpCode.EXEC_COMMAND, command, requestData);
|
|
2026
|
+
if (!result.success) {
|
|
2027
|
+
throw new Error(result.error || "Command execution failed");
|
|
2028
|
+
}
|
|
2029
|
+
const responseJson = new TextDecoder().decode(result.result);
|
|
2030
|
+
return JSON.parse(responseJson);
|
|
2031
|
+
}
|
|
1981
2032
|
};
|
|
1982
2033
|
|
|
1983
2034
|
// src/commands/python3/worker.ts
|
|
@@ -2060,27 +2111,30 @@ var cpythonDir = dirname(cpythonEntryPath);
|
|
|
2060
2111
|
var stdlibZipPath = `${cpythonDir}/python313.zip`;
|
|
2061
2112
|
assertApprovedPath(stdlibZipPath, "cpython-stdlib");
|
|
2062
2113
|
function createHOSTFS(backend, FS, PATH) {
|
|
2063
|
-
const ERRNO_CODES =
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2114
|
+
const ERRNO_CODES = Object.assign(
|
|
2115
|
+
/* @__PURE__ */ Object.create(null),
|
|
2116
|
+
{
|
|
2117
|
+
EPERM: 63,
|
|
2118
|
+
ENOENT: 44,
|
|
2119
|
+
EIO: 29,
|
|
2120
|
+
EBADF: 8,
|
|
2121
|
+
EAGAIN: 6,
|
|
2122
|
+
EACCES: 2,
|
|
2123
|
+
EBUSY: 10,
|
|
2124
|
+
EEXIST: 20,
|
|
2125
|
+
ENOTDIR: 54,
|
|
2126
|
+
EISDIR: 31,
|
|
2127
|
+
EINVAL: 28,
|
|
2128
|
+
EMFILE: 33,
|
|
2129
|
+
ENOSPC: 51,
|
|
2130
|
+
ESPIPE: 70,
|
|
2131
|
+
EROFS: 69,
|
|
2132
|
+
ENOTEMPTY: 55,
|
|
2133
|
+
ENOSYS: 52,
|
|
2134
|
+
ENOTSUP: 138,
|
|
2135
|
+
ENODATA: 42
|
|
2136
|
+
}
|
|
2137
|
+
);
|
|
2084
2138
|
function realPath(node) {
|
|
2085
2139
|
const parts = [];
|
|
2086
2140
|
while (node.parent !== node) {
|
|
@@ -2864,7 +2918,7 @@ async function runPython(input) {
|
|
|
2864
2918
|
error: "Defense-in-depth module-loader guard failed to initialize; refusing to execute Python worker"
|
|
2865
2919
|
};
|
|
2866
2920
|
}
|
|
2867
|
-
const backend = new
|
|
2921
|
+
const backend = new SyncBackend(input.sharedBuffer, input.timeoutMs);
|
|
2868
2922
|
assertApprovedPath(cpythonEntryPath, "cpython-entry");
|
|
2869
2923
|
const createPythonModule = require2(cpythonEntryPath);
|
|
2870
2924
|
let moduleReady = false;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a,b}from"./chunk-
|
|
2
|
+
import{a,b}from"./chunk-B3RU2PUI.js";import"./chunk-GZHFXDDO.js";import"./chunk-QSDVMMYI.js";import"./chunk-ZO5PSLKR.js";import"./chunk-V7ZOPVQS.js";import"./chunk-4PRVMER6.js";import"./chunk-MO4RPBN2.js";import"./chunk-YU6OGPZR.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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a,b}from"./chunk-
|
|
2
|
+
import{a,b}from"./chunk-LGF54XJQ.js";import"./chunk-QSDVMMYI.js";import"./chunk-ZO5PSLKR.js";import"./chunk-V7ZOPVQS.js";import"./chunk-4PRVMER6.js";import"./chunk-MO4RPBN2.js";import"./chunk-YU6OGPZR.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};
|