just-bash 3.4.1 → 3.6.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/CHANGELOG.md +248 -0
- package/README.md +22 -9
- package/dist/AGENTS.md +58 -2
- package/dist/Bash.d.ts +4 -2
- package/dist/abort-signals.d.ts +10 -0
- package/dist/bin/chunks/awk2-U22OR5B5.js +3 -0
- package/dist/bin/{shell/chunks/base64-FLJ4YPHB.js → chunks/base64-2KKH5BCT.js} +1 -1
- package/dist/bin/chunks/{cat-2J5MA5PY.js → cat-V45MVNBT.js} +1 -1
- package/dist/bin/{shell/chunks/chmod-ZM5WLMZI.js → chunks/chmod-A54R4UUQ.js} +1 -1
- package/dist/bin/chunks/chunk-2NJJXU4K.js +27 -0
- package/dist/bin/{shell/chunks/chunk-BJRT4VKD.js → chunks/chunk-3LKMI5IX.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-4APSDE57.js → chunks/chunk-44SKMHU6.js} +1 -1
- package/dist/bin/chunks/{chunk-GRP7L2EL.js → chunk-6DAR25KN.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-VGR3NA3H.js → chunks/chunk-723HNGID.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-MRPJL3ZK.js → chunks/chunk-7X4QBCFW.js} +1 -1
- package/dist/bin/chunks/{chunk-42AMF6EE.js → chunk-ABM5WFEO.js} +1 -1
- package/dist/bin/chunks/{chunk-2HFDEZUY.js → chunk-AINNAQBQ.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-BPWZ7ADB.js → chunks/chunk-AL7RVSF4.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-MHAGHCSO.js → chunks/chunk-ARYCSNJJ.js} +7 -7
- package/dist/bin/{shell/chunks/chunk-2INNLNI5.js → chunks/chunk-BJF6B4YW.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-BZWGVRFA.js → chunks/chunk-BOXG6XBN.js} +2 -2
- package/dist/bin/chunks/chunk-DA3RFNKK.js +17 -0
- package/dist/bin/chunks/chunk-DH7M46D3.js +20 -0
- package/dist/bin/chunks/{chunk-2ND6MMXN.js → chunk-DTGQQKI2.js} +1 -1
- package/dist/bin/chunks/{chunk-YOIFOOGX.js → chunk-ECZAFQ22.js} +1 -1
- package/dist/bin/chunks/{chunk-PPVF2N6C.js → chunk-EFS34UUR.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-TW2IJRUF.js → chunks/chunk-ENEHPI32.js} +1 -1
- package/dist/bin/chunks/chunk-HFW2LXQV.js +13 -0
- package/dist/bin/{shell/chunks/chunk-UHNV55NF.js → chunks/chunk-HRKG3ZK2.js} +1 -1
- package/dist/bin/chunks/{chunk-74TZ7ZF7.js → chunk-IKUY74NG.js} +1 -1
- package/dist/bin/chunks/chunk-ILXMFIYG.js +7 -0
- package/dist/bin/chunks/chunk-IMVXTSPG.js +275 -0
- package/dist/bin/chunks/chunk-J5L5DJWL.js +3 -0
- package/dist/bin/{shell/chunks/chunk-MF3GVFLC.js → chunks/chunk-JKS7WXGR.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-XBX7KFWK.js → chunks/chunk-LG6IN6SW.js} +11 -11
- package/dist/bin/chunks/chunk-LMFAALLO.js +21 -0
- package/dist/bin/{shell/chunks/chunk-DYIBFLS3.js → chunks/chunk-LOU52GPJ.js} +2 -2
- package/dist/bin/chunks/{chunk-FB44CW33.js → chunk-M5ZBECGM.js} +1 -1
- package/dist/bin/chunks/chunk-MA6BMA4M.js +3 -0
- package/dist/bin/chunks/{chunk-Z7QCL4IA.js → chunk-MPQMTLXN.js} +1 -1
- package/dist/bin/chunks/{chunk-TIHFGNPS.js → chunk-MUIYG2RB.js} +1 -1
- package/dist/bin/chunks/{chunk-PUZGSIMN.js → chunk-NGMFI3RH.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-RYQB6GQ7.js → chunks/chunk-NLMTGTSG.js} +1 -1
- package/dist/bin/chunks/{chunk-QAYU7HPM.js → chunk-OBVTFHVP.js} +1 -1
- package/dist/bin/chunks/{chunk-MNSMZU47.js → chunk-OOKVPG5D.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-O2BCKSMK.js → chunks/chunk-PEJXCXSY.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-MYEPQX6Y.js → chunks/chunk-PL4EU7Y2.js} +1 -1
- package/dist/bin/chunks/{chunk-QFTZKD5O.js → chunk-QCGH2ZOW.js} +1 -1
- package/dist/bin/chunks/chunk-QKWMWSV3.js +3 -0
- package/dist/bin/{shell/chunks/chunk-ISOWCECJ.js → chunks/chunk-S5Z7DMIE.js} +10 -10
- package/dist/bin/{shell/chunks/chunk-OLEQNRKX.js → chunks/chunk-SQ7SZZMW.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-44MQ5AXA.js → chunks/chunk-SQUH76NP.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-BOYPCOSV.js → chunks/chunk-TGRZ42DS.js} +1 -1
- package/dist/bin/chunks/{chunk-LUHU7UUN.js → chunk-THTKNRO6.js} +1 -1
- package/dist/bin/chunks/{chunk-VKTV45AP.js → chunk-TQXLQEIT.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-2OQ5HPZE.js → chunks/chunk-U6BXPMLD.js} +1 -1
- package/dist/bin/chunks/chunk-U6DBRMD5.js +5 -0
- package/dist/bin/{shell/chunks/chunk-CC2AQ6B7.js → chunks/chunk-U6JTVQU6.js} +1 -1
- package/dist/bin/chunks/chunk-UPUFWGHR.js +3 -0
- package/dist/bin/chunks/{chunk-E5VZGTZ6.js → chunk-URRH3GPG.js} +1 -1
- package/dist/bin/chunks/{chunk-EXGPMLIE.js → chunk-VBU3UEG5.js} +1 -1
- package/dist/bin/chunks/chunk-VGSRQOLD.js +7 -0
- package/dist/bin/chunks/{chunk-GTULZ3ZD.js → chunk-WBST7XJW.js} +1 -1
- package/dist/bin/chunks/{chunk-ROFYAVPF.js → chunk-WEQ5WM2M.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-BCQSUELK.js → chunks/chunk-WZ7MIBLR.js} +1 -1
- package/dist/bin/chunks/{chunk-H4BRFPKY.js → chunk-X45GP3AQ.js} +1 -1
- package/dist/bin/chunks/chunk-YQEKKZTU.js +12 -0
- package/dist/bin/chunks/{chunk-UNKX6YM6.js → chunk-Z3KAV6YJ.js} +1 -1
- package/dist/bin/chunks/{chunk-3SCW7PD5.js → chunk-Z5KICK5X.js} +1 -1
- package/dist/bin/chunks/{column-7VBJL757.js → column-LHHS4D3K.js} +1 -1
- package/dist/bin/{shell/chunks/cp-MF5GADQN.js → chunks/cp-HPLQA35N.js} +1 -1
- package/dist/bin/chunks/curl-FIRG3RB6.js +31 -0
- package/dist/bin/chunks/{cut-QOTYBJJJ.js → cut-KP3S36XS.js} +1 -1
- package/dist/bin/{shell/chunks/diff-YXZZCUSQ.js → chunks/diff-JSJ56EOK.js} +1 -1
- package/dist/bin/chunks/dist-4NZ74CRE.js +141 -0
- package/dist/bin/chunks/{du-A3UGHIKJ.js → du-WEF5YWQK.js} +1 -1
- package/dist/bin/chunks/{expr-TDF3B6QJ.js → expr-FLWT4OCO.js} +1 -1
- package/dist/bin/chunks/{file-AJGG7RYT.js → file-JLUCGBCB.js} +1 -1
- package/dist/bin/chunks/{find-6DH6TRDN.js → find-XGVQ6N6L.js} +1 -1
- package/dist/bin/chunks/flag-coverage-4JYKIAVV.js +3 -0
- package/dist/bin/chunks/{grep-WUZMZDGY.js → grep-DCPCPQOS.js} +1 -1
- package/dist/bin/chunks/{gzip-JA7JQBUS.js → gzip-6DZIKNBW.js} +1 -1
- package/dist/bin/{shell/chunks/head-YGKW3HS4.js → chunks/head-TLFXMM2T.js} +1 -1
- package/dist/bin/{shell/chunks/help-HVIDHJ6M.js → chunks/help-EXVKU23F.js} +1 -1
- package/dist/bin/chunks/{html-to-markdown-ZWL7LZIP.js → html-to-markdown-E22RLT2U.js} +1 -1
- package/dist/bin/chunks/{jq-5MI4V3G5.js → jq-GDM3OBBK.js} +1 -1
- package/dist/bin/chunks/js-exec-VU6F6WLS.js +1578 -0
- package/dist/bin/chunks/{ln-XSDIE6SU.js → ln-B35EKC2Q.js} +1 -1
- package/dist/bin/chunks/{ls-R6DAGGBH.js → ls-67NUUIYT.js} +1 -1
- package/dist/bin/chunks/{mkdir-74BP5NTG.js → mkdir-AWDWRBKC.js} +1 -1
- package/dist/bin/chunks/mktemp-L6OGMDUO.js +3 -0
- package/dist/bin/chunks/{mv-YG75IRRE.js → mv-4BJSOT4Y.js} +1 -1
- package/dist/bin/{shell/chunks/od-YCY27MMO.js → chunks/od-SI75GLRE.js} +1 -1
- package/dist/bin/chunks/{paste-ACKOG3XS.js → paste-5TSIBDF7.js} +1 -1
- package/dist/bin/chunks/python3-GUWCSSDP.js +23 -0
- package/dist/bin/{shell/chunks/readlink-HMHVGSAM.js → chunks/readlink-URO5XTBB.js} +1 -1
- package/dist/bin/{shell/chunks/rg-A3E7YM2A.js → chunks/rg-RVULUPDH.js} +1 -1
- package/dist/bin/{shell/chunks/rm-3PLW4O4B.js → chunks/rm-UCUTHC3I.js} +1 -1
- package/dist/bin/chunks/{rmdir-DCJ3XJRR.js → rmdir-J3HM7GGM.js} +1 -1
- package/dist/bin/{shell/chunks/sed-KJWKB22J.js → chunks/sed-MCLGHZOI.js} +1 -1
- package/dist/bin/chunks/{seq-Q4LZ6EXV.js → seq-I54NZE75.js} +1 -1
- package/dist/bin/{shell/chunks/sleep-DVFE2GSF.js → chunks/sleep-CV6B4M6W.js} +1 -1
- package/dist/bin/chunks/{split-XMXBXL5Q.js → split-VZO7223N.js} +1 -1
- package/dist/bin/chunks/{sqlite3-DNH2VLVN.js → sqlite3-HXVFVP4Z.js} +1 -1
- package/dist/bin/chunks/sqlite3-worker.js +75 -11
- package/dist/bin/chunks/{stat-5PUSTPTK.js → stat-UJ37RBMM.js} +1 -1
- package/dist/bin/chunks/{tail-4MB7HHIZ.js → tail-5TSF5YM4.js} +1 -1
- package/dist/bin/{shell/chunks/tar-FRDUJZDN.js → chunks/tar-ZGZZDQXO.js} +1 -1
- package/dist/bin/chunks/{time-LF7BTSK5.js → time-J2DAZUIN.js} +1 -1
- package/dist/bin/chunks/timeout-ATTDYXLX.js +3 -0
- package/dist/bin/chunks/{tr-Z6N34HZM.js → tr-6RPFASYV.js} +1 -1
- package/dist/bin/chunks/worker.js +88 -15
- package/dist/bin/chunks/{xan-VSF6ZQGZ.js → xan-CCS53B7D.js} +1 -1
- package/dist/bin/chunks/{xan-view-UEFBHYVN.js → xan-view-KOXASOEV.js} +1 -1
- package/dist/bin/chunks/yes-ELH3XQWY.js +3 -0
- package/dist/bin/chunks/yq-GSCDUHGM.js +3 -0
- package/dist/bin/just-bash.js +333 -328
- package/dist/bin/shell/chunks/awk2-U22OR5B5.js +3 -0
- package/dist/bin/{chunks/base64-FLJ4YPHB.js → shell/chunks/base64-2KKH5BCT.js} +1 -1
- package/dist/bin/shell/chunks/{cat-2J5MA5PY.js → cat-V45MVNBT.js} +1 -1
- package/dist/bin/{chunks/chmod-ZM5WLMZI.js → shell/chunks/chmod-A54R4UUQ.js} +1 -1
- package/dist/bin/shell/chunks/chunk-2NJJXU4K.js +27 -0
- package/dist/bin/{chunks/chunk-BJRT4VKD.js → shell/chunks/chunk-3LKMI5IX.js} +1 -1
- package/dist/bin/{chunks/chunk-4APSDE57.js → shell/chunks/chunk-44SKMHU6.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-GRP7L2EL.js → chunk-6DAR25KN.js} +1 -1
- package/dist/bin/{chunks/chunk-VGR3NA3H.js → shell/chunks/chunk-723HNGID.js} +1 -1
- package/dist/bin/{chunks/chunk-MRPJL3ZK.js → shell/chunks/chunk-7X4QBCFW.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-42AMF6EE.js → chunk-ABM5WFEO.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-2HFDEZUY.js → chunk-AINNAQBQ.js} +1 -1
- package/dist/bin/{chunks/chunk-BPWZ7ADB.js → shell/chunks/chunk-AL7RVSF4.js} +1 -1
- package/dist/bin/{chunks/chunk-MHAGHCSO.js → shell/chunks/chunk-ARYCSNJJ.js} +7 -7
- package/dist/bin/{chunks/chunk-2INNLNI5.js → shell/chunks/chunk-BJF6B4YW.js} +1 -1
- package/dist/bin/{chunks/chunk-BZWGVRFA.js → shell/chunks/chunk-BOXG6XBN.js} +2 -2
- package/dist/bin/shell/chunks/chunk-DA3RFNKK.js +17 -0
- package/dist/bin/shell/chunks/chunk-DH7M46D3.js +20 -0
- package/dist/bin/shell/chunks/{chunk-2ND6MMXN.js → chunk-DTGQQKI2.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-YOIFOOGX.js → chunk-ECZAFQ22.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-PPVF2N6C.js → chunk-EFS34UUR.js} +1 -1
- package/dist/bin/{chunks/chunk-TW2IJRUF.js → shell/chunks/chunk-ENEHPI32.js} +1 -1
- package/dist/bin/shell/chunks/chunk-HFW2LXQV.js +13 -0
- package/dist/bin/{chunks/chunk-UHNV55NF.js → shell/chunks/chunk-HRKG3ZK2.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-74TZ7ZF7.js → chunk-IKUY74NG.js} +1 -1
- package/dist/bin/shell/chunks/chunk-ILXMFIYG.js +7 -0
- package/dist/bin/shell/chunks/chunk-IMVXTSPG.js +275 -0
- package/dist/bin/shell/chunks/chunk-J5L5DJWL.js +3 -0
- package/dist/bin/{chunks/chunk-MF3GVFLC.js → shell/chunks/chunk-JKS7WXGR.js} +1 -1
- package/dist/bin/{chunks/chunk-XBX7KFWK.js → shell/chunks/chunk-LG6IN6SW.js} +11 -11
- package/dist/bin/shell/chunks/chunk-LMFAALLO.js +21 -0
- package/dist/bin/{chunks/chunk-DYIBFLS3.js → shell/chunks/chunk-LOU52GPJ.js} +2 -2
- package/dist/bin/shell/chunks/{chunk-FB44CW33.js → chunk-M5ZBECGM.js} +1 -1
- package/dist/bin/shell/chunks/chunk-MA6BMA4M.js +3 -0
- package/dist/bin/shell/chunks/{chunk-Z7QCL4IA.js → chunk-MPQMTLXN.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-TIHFGNPS.js → chunk-MUIYG2RB.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-PUZGSIMN.js → chunk-NGMFI3RH.js} +1 -1
- package/dist/bin/{chunks/chunk-RYQB6GQ7.js → shell/chunks/chunk-NLMTGTSG.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-QAYU7HPM.js → chunk-OBVTFHVP.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-MNSMZU47.js → chunk-OOKVPG5D.js} +1 -1
- package/dist/bin/{chunks/chunk-O2BCKSMK.js → shell/chunks/chunk-PEJXCXSY.js} +1 -1
- package/dist/bin/{chunks/chunk-MYEPQX6Y.js → shell/chunks/chunk-PL4EU7Y2.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-QFTZKD5O.js → chunk-QCGH2ZOW.js} +1 -1
- package/dist/bin/shell/chunks/chunk-QKWMWSV3.js +3 -0
- package/dist/bin/{chunks/chunk-ISOWCECJ.js → shell/chunks/chunk-S5Z7DMIE.js} +10 -10
- package/dist/bin/{chunks/chunk-OLEQNRKX.js → shell/chunks/chunk-SQ7SZZMW.js} +1 -1
- package/dist/bin/{chunks/chunk-44MQ5AXA.js → shell/chunks/chunk-SQUH76NP.js} +1 -1
- package/dist/bin/{chunks/chunk-BOYPCOSV.js → shell/chunks/chunk-TGRZ42DS.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-LUHU7UUN.js → chunk-THTKNRO6.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-VKTV45AP.js → chunk-TQXLQEIT.js} +1 -1
- package/dist/bin/{chunks/chunk-2OQ5HPZE.js → shell/chunks/chunk-U6BXPMLD.js} +1 -1
- package/dist/bin/shell/chunks/chunk-U6DBRMD5.js +5 -0
- package/dist/bin/{chunks/chunk-CC2AQ6B7.js → shell/chunks/chunk-U6JTVQU6.js} +1 -1
- package/dist/bin/shell/chunks/chunk-UPUFWGHR.js +3 -0
- package/dist/bin/shell/chunks/{chunk-E5VZGTZ6.js → chunk-URRH3GPG.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-EXGPMLIE.js → chunk-VBU3UEG5.js} +1 -1
- package/dist/bin/shell/chunks/chunk-VGSRQOLD.js +7 -0
- package/dist/bin/shell/chunks/{chunk-GTULZ3ZD.js → chunk-WBST7XJW.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-ROFYAVPF.js → chunk-WEQ5WM2M.js} +1 -1
- package/dist/bin/{chunks/chunk-BCQSUELK.js → shell/chunks/chunk-WZ7MIBLR.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-H4BRFPKY.js → chunk-X45GP3AQ.js} +1 -1
- package/dist/bin/shell/chunks/chunk-YQEKKZTU.js +12 -0
- package/dist/bin/shell/chunks/{chunk-UNKX6YM6.js → chunk-Z3KAV6YJ.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-3SCW7PD5.js → chunk-Z5KICK5X.js} +1 -1
- package/dist/bin/shell/chunks/{column-7VBJL757.js → column-LHHS4D3K.js} +1 -1
- package/dist/bin/{chunks/cp-MF5GADQN.js → shell/chunks/cp-HPLQA35N.js} +1 -1
- package/dist/bin/shell/chunks/curl-FIRG3RB6.js +31 -0
- package/dist/bin/shell/chunks/{cut-QOTYBJJJ.js → cut-KP3S36XS.js} +1 -1
- package/dist/bin/{chunks/diff-YXZZCUSQ.js → shell/chunks/diff-JSJ56EOK.js} +1 -1
- package/dist/bin/shell/chunks/dist-4NZ74CRE.js +141 -0
- package/dist/bin/shell/chunks/{du-A3UGHIKJ.js → du-WEF5YWQK.js} +1 -1
- package/dist/bin/shell/chunks/{expr-TDF3B6QJ.js → expr-FLWT4OCO.js} +1 -1
- package/dist/bin/shell/chunks/{file-AJGG7RYT.js → file-JLUCGBCB.js} +1 -1
- package/dist/bin/shell/chunks/{find-6DH6TRDN.js → find-XGVQ6N6L.js} +1 -1
- package/dist/bin/shell/chunks/flag-coverage-4JYKIAVV.js +3 -0
- package/dist/bin/shell/chunks/{grep-WUZMZDGY.js → grep-DCPCPQOS.js} +1 -1
- package/dist/bin/shell/chunks/{gzip-JA7JQBUS.js → gzip-6DZIKNBW.js} +1 -1
- package/dist/bin/{chunks/head-YGKW3HS4.js → shell/chunks/head-TLFXMM2T.js} +1 -1
- package/dist/bin/{chunks/help-HVIDHJ6M.js → shell/chunks/help-EXVKU23F.js} +1 -1
- package/dist/bin/shell/chunks/{html-to-markdown-ZWL7LZIP.js → html-to-markdown-E22RLT2U.js} +1 -1
- package/dist/bin/shell/chunks/{jq-5MI4V3G5.js → jq-GDM3OBBK.js} +1 -1
- package/dist/bin/shell/chunks/js-exec-VU6F6WLS.js +1578 -0
- package/dist/bin/shell/chunks/{ln-XSDIE6SU.js → ln-B35EKC2Q.js} +1 -1
- package/dist/bin/shell/chunks/{ls-R6DAGGBH.js → ls-67NUUIYT.js} +1 -1
- package/dist/bin/shell/chunks/{mkdir-74BP5NTG.js → mkdir-AWDWRBKC.js} +1 -1
- package/dist/bin/shell/chunks/mktemp-L6OGMDUO.js +3 -0
- package/dist/bin/shell/chunks/{mv-YG75IRRE.js → mv-4BJSOT4Y.js} +1 -1
- package/dist/bin/{chunks/od-YCY27MMO.js → shell/chunks/od-SI75GLRE.js} +1 -1
- package/dist/bin/shell/chunks/{paste-ACKOG3XS.js → paste-5TSIBDF7.js} +1 -1
- package/dist/bin/shell/chunks/python3-GUWCSSDP.js +23 -0
- package/dist/bin/{chunks/readlink-HMHVGSAM.js → shell/chunks/readlink-URO5XTBB.js} +1 -1
- package/dist/bin/{chunks/rg-A3E7YM2A.js → shell/chunks/rg-RVULUPDH.js} +1 -1
- package/dist/bin/{chunks/rm-3PLW4O4B.js → shell/chunks/rm-UCUTHC3I.js} +1 -1
- package/dist/bin/shell/chunks/{rmdir-DCJ3XJRR.js → rmdir-J3HM7GGM.js} +1 -1
- package/dist/bin/{chunks/sed-KJWKB22J.js → shell/chunks/sed-MCLGHZOI.js} +1 -1
- package/dist/bin/shell/chunks/{seq-Q4LZ6EXV.js → seq-I54NZE75.js} +1 -1
- package/dist/bin/{chunks/sleep-DVFE2GSF.js → shell/chunks/sleep-CV6B4M6W.js} +1 -1
- package/dist/bin/shell/chunks/{split-XMXBXL5Q.js → split-VZO7223N.js} +1 -1
- package/dist/bin/shell/chunks/{sqlite3-DNH2VLVN.js → sqlite3-HXVFVP4Z.js} +1 -1
- package/dist/bin/shell/chunks/{stat-5PUSTPTK.js → stat-UJ37RBMM.js} +1 -1
- package/dist/bin/shell/chunks/{tail-4MB7HHIZ.js → tail-5TSF5YM4.js} +1 -1
- package/dist/bin/{chunks/tar-FRDUJZDN.js → shell/chunks/tar-ZGZZDQXO.js} +1 -1
- package/dist/bin/shell/chunks/{time-LF7BTSK5.js → time-J2DAZUIN.js} +1 -1
- package/dist/bin/shell/chunks/timeout-ATTDYXLX.js +3 -0
- package/dist/bin/shell/chunks/{tr-Z6N34HZM.js → tr-6RPFASYV.js} +1 -1
- package/dist/bin/shell/chunks/{xan-VSF6ZQGZ.js → xan-CCS53B7D.js} +1 -1
- package/dist/bin/shell/chunks/{xan-view-UEFBHYVN.js → xan-view-KOXASOEV.js} +1 -1
- package/dist/bin/shell/chunks/yes-ELH3XQWY.js +3 -0
- package/dist/bin/shell/chunks/yq-GSCDUHGM.js +3 -0
- package/dist/bin/shell/shell.js +334 -329
- package/dist/browser.d.ts +1 -1
- package/dist/bundle/browser.js +866 -836
- package/dist/bundle/chunks/awk2-V7KYQWCD.js +2 -0
- package/dist/bundle/chunks/{base64-2BAITDZF.js → base64-QPSYZAAJ.js} +1 -1
- package/dist/bundle/chunks/{cat-33KGN4MZ.js → cat-54BXBS6X.js} +1 -1
- package/dist/bundle/chunks/{chmod-APOXUPXW.js → chmod-4OPV4QKK.js} +1 -1
- package/dist/bundle/chunks/{chunk-IBRT3OJS.js → chunk-2WBUTDF5.js} +1 -1
- package/dist/bundle/chunks/{chunk-WNH3HOQA.js → chunk-353VO5TF.js} +1 -1
- package/dist/bundle/chunks/chunk-3HDTNUL3.js +6 -0
- package/dist/bundle/chunks/{chunk-XV2V56NQ.js → chunk-3KWM4FFA.js} +1 -1
- package/dist/bundle/chunks/{chunk-WXPNKIIH.js → chunk-43OP7DFL.js} +1 -1
- package/dist/bundle/chunks/{chunk-DMWNBCXJ.js → chunk-4GEHRJMD.js} +1 -1
- package/dist/bundle/chunks/{chunk-3CBCABOZ.js → chunk-4IMUNIUJ.js} +1 -1
- package/dist/bundle/chunks/chunk-5BMPT6SF.js +19 -0
- package/dist/bundle/chunks/{chunk-XPDOK3XY.js → chunk-5QWGR2WA.js} +1 -1
- package/dist/bundle/chunks/{chunk-X3TZEFQG.js → chunk-5UTZMNI5.js} +1 -1
- package/dist/bundle/chunks/{chunk-QPZVR6ZN.js → chunk-65LVAUWW.js} +1 -1
- package/dist/bundle/chunks/{chunk-YDR2IWKO.js → chunk-72JHTO7E.js} +1 -1
- package/dist/bundle/chunks/{chunk-KVG5FR5F.js → chunk-7GA3QWJJ.js} +11 -11
- package/dist/bundle/chunks/{chunk-ICQYTW7W.js → chunk-7M672HB6.js} +1 -1
- package/dist/bundle/chunks/chunk-B6OSJB22.js +26 -0
- package/dist/bundle/chunks/{chunk-N3FZSEG7.js → chunk-BM3X75NC.js} +1 -1
- package/dist/bundle/chunks/chunk-CBM6J4AL.js +6 -0
- package/dist/bundle/chunks/{chunk-FNEG7DFQ.js → chunk-CGI6V2HW.js} +1 -1
- package/dist/bundle/chunks/{chunk-BKUWXPEM.js → chunk-CHWP6GRK.js} +1 -1
- package/dist/bundle/chunks/{chunk-UL6YJ7FT.js → chunk-D5ZJISRS.js} +1 -1
- package/dist/bundle/chunks/{chunk-TUNYNC46.js → chunk-DIRWTBKE.js} +1 -1
- package/dist/bundle/chunks/chunk-DIWMSSQY.js +2 -0
- package/dist/bundle/chunks/{chunk-273265WK.js → chunk-DPZVOEUP.js} +1 -1
- package/dist/bundle/chunks/chunk-EGTVQWAP.js +20 -0
- package/dist/bundle/chunks/{chunk-SI5VPVOA.js → chunk-EXXOLIVE.js} +1 -1
- package/dist/bundle/chunks/chunk-GLAFXDZC.js +4 -0
- package/dist/bundle/chunks/{chunk-PMYUC5JF.js → chunk-H42OAUJL.js} +1 -1
- package/dist/bundle/chunks/chunk-H53EPEGD.js +12 -0
- package/dist/bundle/chunks/{chunk-QE275OWT.js → chunk-HDOXCDVK.js} +1 -1
- package/dist/bundle/chunks/{chunk-USNDURQI.js → chunk-HIQEVPXM.js} +1 -1
- package/dist/bundle/chunks/{chunk-G4SEENI7.js → chunk-M4LDT7V7.js} +1 -1
- package/dist/bundle/chunks/{chunk-MHY57JTL.js → chunk-MDE25PQK.js} +1 -1
- package/dist/bundle/chunks/{chunk-Q6JV5CBB.js → chunk-MHDZERK4.js} +1 -1
- package/dist/bundle/chunks/{chunk-5ELNHAAJ.js → chunk-MHZF23KB.js} +1 -1
- package/dist/bundle/chunks/{chunk-LPJEKUCB.js → chunk-N6W6FM4N.js} +1 -1
- package/dist/bundle/chunks/{chunk-POIWRLUV.js → chunk-NRLE7KYI.js} +1 -1
- package/dist/bundle/chunks/{chunk-MQKGGNPS.js → chunk-NXBUT5V2.js} +2 -2
- package/dist/bundle/chunks/{chunk-4HMWZAP7.js → chunk-OB46N7Q7.js} +1 -1
- package/dist/bundle/chunks/{chunk-ALOFNPKY.js → chunk-PPHGMG47.js} +2 -2
- package/dist/bundle/chunks/{chunk-UXHSH7BM.js → chunk-R6ZGLVXI.js} +1 -1
- package/dist/bundle/chunks/chunk-RCRHDT54.js +274 -0
- package/dist/bundle/chunks/{chunk-N4TGZ6H7.js → chunk-RIIUVFUS.js} +1 -1
- package/dist/bundle/chunks/chunk-RK2WBVP4.js +2 -0
- package/dist/bundle/chunks/{chunk-MLIO3BK2.js → chunk-SQX6WQXB.js} +1 -1
- package/dist/bundle/chunks/chunk-SRB6FXRH.js +2 -0
- package/dist/bundle/chunks/{chunk-7IFSXTCJ.js → chunk-T4INBNHX.js} +1 -1
- package/dist/bundle/chunks/{chunk-TVJ6JVK4.js → chunk-TUQG2YRH.js} +1 -1
- package/dist/bundle/chunks/{chunk-JA6EY7US.js → chunk-U7UNEMLJ.js} +1 -1
- package/dist/bundle/chunks/{chunk-GVKYQN5J.js → chunk-UK2K3DHN.js} +1 -1
- package/dist/bundle/chunks/{chunk-HW6ZCMM5.js → chunk-VDJ53ESK.js} +1 -1
- package/dist/bundle/chunks/{chunk-WHHRIZS3.js → chunk-VGCXKMXN.js} +1 -1
- package/dist/bundle/chunks/chunk-VOQZ5TSL.js +2 -0
- package/dist/bundle/chunks/{chunk-R2FBRMDU.js → chunk-VWUMR4IC.js} +1 -1
- package/dist/bundle/chunks/chunk-W2Z6LYL6.js +11 -0
- package/dist/bundle/chunks/{chunk-CFBEDNHJ.js → chunk-W5J5ADJF.js} +7 -7
- package/dist/bundle/chunks/{chunk-V2SOLEQN.js → chunk-XHFP44Y4.js} +1 -1
- package/dist/bundle/chunks/{chunk-KIGPB52X.js → chunk-XZ34OGNM.js} +1 -1
- package/dist/bundle/chunks/{chunk-A3D7NRT6.js → chunk-Y32R7EZP.js} +10 -10
- package/dist/bundle/chunks/chunk-YUFU7O6I.js +16 -0
- package/dist/bundle/chunks/{chunk-MFGH46GH.js → chunk-YZH7FUSY.js} +1 -1
- package/dist/bundle/chunks/{column-LKMDIDCH.js → column-F5JDBRV6.js} +1 -1
- package/dist/bundle/chunks/{cp-FKTQRFYJ.js → cp-LTFB4EUA.js} +1 -1
- package/dist/bundle/chunks/curl-XCX2ZQEA.js +30 -0
- package/dist/bundle/chunks/{cut-RWPUW5FY.js → cut-IRSHL3BB.js} +1 -1
- package/dist/bundle/chunks/{diff-CSARC7WF.js → diff-VDB6RXHO.js} +1 -1
- package/dist/bundle/chunks/{du-PR3M44X6.js → du-DOWSRLXR.js} +1 -1
- package/dist/bundle/chunks/{expr-UMT2OHZ7.js → expr-GZ4DABKB.js} +1 -1
- package/dist/bundle/chunks/{file-VEGKTTSF.js → file-UI6QJAAU.js} +1 -1
- package/dist/bundle/chunks/{find-PM3TD7V4.js → find-JTXDH3MR.js} +1 -1
- package/dist/bundle/chunks/flag-coverage-EDO3VM43.js +2 -0
- package/dist/bundle/chunks/{grep-5UPEO42U.js → grep-OZCR76FT.js} +1 -1
- package/dist/bundle/chunks/{gzip-ZINVK3M6.js → gzip-GQC6CWVL.js} +1 -1
- package/dist/bundle/chunks/{head-CFENJILH.js → head-J6RVJFRS.js} +1 -1
- package/dist/bundle/chunks/{help-QDDMBDU7.js → help-62M75TSG.js} +1 -1
- package/dist/bundle/chunks/{html-to-markdown-GGVR4YGL.js → html-to-markdown-7OG5VWYG.js} +1 -1
- package/dist/bundle/chunks/{jq-X2P7Q64K.js → jq-FCG2IUBK.js} +1 -1
- package/dist/bundle/chunks/js-exec-NDLXDUBN.js +1577 -0
- package/dist/bundle/chunks/{ln-VYDFOFNO.js → ln-OPY2ZVGQ.js} +1 -1
- package/dist/bundle/chunks/{ls-R5CQLZQM.js → ls-MQTYWW4T.js} +1 -1
- package/dist/bundle/chunks/{mkdir-WDDKK2P3.js → mkdir-4A5W3RXH.js} +1 -1
- package/dist/bundle/chunks/mktemp-XKIE5N3X.js +2 -0
- package/dist/bundle/chunks/{mv-XSJA2FNL.js → mv-ZPIATQJL.js} +1 -1
- package/dist/bundle/chunks/{od-BI6XJPXY.js → od-LUHOH7CG.js} +1 -1
- package/dist/bundle/chunks/{paste-LLZ3ZQR2.js → paste-U57ZU47S.js} +1 -1
- package/dist/bundle/chunks/python3-SDFCGIU4.js +22 -0
- package/dist/bundle/chunks/{readlink-IY6QKK2P.js → readlink-YNNS6F7K.js} +1 -1
- package/dist/bundle/chunks/{rg-UQE6KUBP.js → rg-F4SX2PHI.js} +1 -1
- package/dist/bundle/chunks/{rm-JQ4GDKDD.js → rm-3XUUYAXQ.js} +1 -1
- package/dist/bundle/chunks/{rmdir-WZKAT6M5.js → rmdir-OGSEXEF4.js} +1 -1
- package/dist/bundle/chunks/{sed-JW2JDLSI.js → sed-MBB5SXGD.js} +1 -1
- package/dist/bundle/chunks/{seq-5R2GKXC6.js → seq-IN77HD3S.js} +1 -1
- package/dist/bundle/chunks/{sleep-PPRBTSVR.js → sleep-3QNP3BGR.js} +1 -1
- package/dist/bundle/chunks/{split-2SD6EP72.js → split-6R2TSQY6.js} +1 -1
- package/dist/bundle/chunks/{sqlite3-UVVRYDAL.js → sqlite3-7MBPFI6W.js} +1 -1
- package/dist/bundle/chunks/sqlite3-worker.js +75 -11
- package/dist/bundle/chunks/{stat-6KILP5AL.js → stat-YLVJ4L67.js} +1 -1
- package/dist/bundle/chunks/{tail-BDNMS4FR.js → tail-UGFWX3YY.js} +1 -1
- package/dist/bundle/chunks/{tar-6365WH6H.js → tar-BNHPWTOY.js} +1 -1
- package/dist/bundle/chunks/{time-NERE2JJ2.js → time-N6J6DC6C.js} +1 -1
- package/dist/bundle/chunks/timeout-ZHCL5KTP.js +2 -0
- package/dist/bundle/chunks/{tr-3I4MDKIF.js → tr-4NGL47UU.js} +1 -1
- package/dist/bundle/chunks/worker.js +88 -15
- package/dist/bundle/chunks/{xan-HUOXKUQA.js → xan-7R3I2DJO.js} +1 -1
- package/dist/bundle/chunks/xan-view-S4ZILLPU.js +2 -0
- package/dist/bundle/chunks/yes-I7SAR7XX.js +2 -0
- package/dist/bundle/chunks/yq-IOMBQYB2.js +2 -0
- package/dist/bundle/index.cjs +2862 -1489
- package/dist/bundle/index.js +349 -344
- package/dist/commands/curl/response-formatting.d.ts +2 -2
- package/dist/commands/curl/types.d.ts +5 -0
- package/dist/commands/diff/format.d.ts +46 -0
- package/dist/commands/js-exec/js-exec.d.ts +1 -10
- package/dist/commands/js-exec/run-runtime.d.ts +10 -0
- package/dist/commands/mktemp/mktemp.d.ts +4 -0
- package/dist/commands/registry.d.ts +1 -1
- package/dist/commands/sqlite3/worker.js +75 -11
- package/dist/commands/worker-request-controller.d.ts +3 -23
- package/dist/commands/yes/yes.d.ts +4 -0
- package/dist/custom-commands.d.ts +7 -0
- package/dist/fs/create-exclusive.d.ts +30 -0
- package/dist/fs/in-memory-fs/in-memory-fs.d.ts +8 -1
- package/dist/fs/interface.d.ts +37 -0
- package/dist/fs/mountable-fs/mountable-fs.d.ts +20 -1
- package/dist/fs/overlay-fs/overlay-fs.d.ts +9 -1
- package/dist/fs/read-write-fs/read-write-fs.d.ts +27 -1
- package/dist/fs/traversal.d.ts +9 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/interpreter/expansion/array-prefix-suffix.d.ts +2 -1
- package/dist/interpreter/expansion/parameter-ops.d.ts +1 -0
- package/dist/interpreter/expansion/pattern-removal.d.ts +3 -0
- package/dist/interpreter/expansion/variable.d.ts +1 -1
- package/dist/interpreter/helpers/loop.d.ts +32 -0
- package/dist/interpreter/helpers/substitution-status.d.ts +34 -0
- package/dist/interpreter/interpreter.d.ts +1 -1
- package/dist/interpreter/types.d.ts +8 -1
- package/dist/limits.d.ts +2 -0
- package/dist/network/allow-list/shared.d.ts +0 -8
- package/dist/network/dns-pin.d.ts +1 -35
- package/dist/network/fetch.d.ts +4 -6
- package/dist/network/types.d.ts +20 -2
- package/dist/security/blocked-globals.d.ts +60 -0
- package/dist/security/defense-context.d.ts +13 -0
- package/dist/security/defense-in-depth-box.d.ts +361 -0
- package/dist/security/index.d.ts +33 -0
- package/dist/security/safe-timestamp.d.ts +1 -0
- package/dist/security/security-violation-logger.d.ts +99 -0
- package/dist/security/trusted-globals.d.ts +25 -0
- package/dist/security/types.d.ts +151 -0
- package/dist/security/violation-error-message.d.ts +3 -0
- package/dist/security/wasm-callback.d.ts +6 -0
- package/dist/security/worker-defense-in-depth.d.ts +235 -0
- package/dist/transform/pipeline.d.ts +8 -0
- package/dist/transform/plugins/command-collector.d.ts +15 -0
- package/dist/transform/plugins/tee-plugin.d.ts +40 -0
- package/dist/transform/serialize.d.ts +4 -0
- package/dist/transform/types.d.ts +18 -0
- package/dist/types.d.ts +4 -3
- package/dist/worker-lifecycle.d.ts +27 -0
- package/package.json +15 -14
- package/dist/bin/chunks/awk2-C4A37H5N.js +0 -3
- package/dist/bin/chunks/chunk-23OI2XDJ.js +0 -20
- package/dist/bin/chunks/chunk-2ORJ5HTY.js +0 -276
- package/dist/bin/chunks/chunk-3PCPQIUD.js +0 -3
- package/dist/bin/chunks/chunk-7WBCA2BB.js +0 -3
- package/dist/bin/chunks/chunk-APV27ZZW.js +0 -21
- package/dist/bin/chunks/chunk-CPTQXTBJ.js +0 -3
- package/dist/bin/chunks/chunk-FE6GSISP.js +0 -22
- package/dist/bin/chunks/chunk-HL7NFZVQ.js +0 -13
- package/dist/bin/chunks/chunk-HWI42GQO.js +0 -7
- package/dist/bin/chunks/chunk-JQM3DKCH.js +0 -12
- package/dist/bin/chunks/chunk-TOTKK2XI.js +0 -16
- package/dist/bin/chunks/chunk-YTL6DXBO.js +0 -11
- package/dist/bin/chunks/curl-FS5LAEYI.js +0 -30
- package/dist/bin/chunks/flag-coverage-DOLZIUQ7.js +0 -3
- package/dist/bin/chunks/js-exec-DJQLXWCS.js +0 -99
- package/dist/bin/chunks/js-exec-worker.js +0 -4809
- package/dist/bin/chunks/python3-JCJHSX4Z.js +0 -14
- package/dist/bin/chunks/timeout-YGFHQJKX.js +0 -3
- package/dist/bin/chunks/undici-CKF2L2IP.js +0 -141
- package/dist/bin/chunks/yq-K5N5JD4N.js +0 -3
- package/dist/bin/shell/chunks/awk2-C4A37H5N.js +0 -3
- package/dist/bin/shell/chunks/chunk-23OI2XDJ.js +0 -20
- package/dist/bin/shell/chunks/chunk-2ORJ5HTY.js +0 -276
- package/dist/bin/shell/chunks/chunk-3PCPQIUD.js +0 -3
- package/dist/bin/shell/chunks/chunk-7WBCA2BB.js +0 -3
- package/dist/bin/shell/chunks/chunk-APV27ZZW.js +0 -21
- package/dist/bin/shell/chunks/chunk-CPTQXTBJ.js +0 -3
- package/dist/bin/shell/chunks/chunk-FE6GSISP.js +0 -22
- package/dist/bin/shell/chunks/chunk-HL7NFZVQ.js +0 -13
- package/dist/bin/shell/chunks/chunk-HWI42GQO.js +0 -7
- package/dist/bin/shell/chunks/chunk-JQM3DKCH.js +0 -12
- package/dist/bin/shell/chunks/chunk-TOTKK2XI.js +0 -16
- package/dist/bin/shell/chunks/chunk-YTL6DXBO.js +0 -11
- package/dist/bin/shell/chunks/curl-FS5LAEYI.js +0 -30
- package/dist/bin/shell/chunks/flag-coverage-DOLZIUQ7.js +0 -3
- package/dist/bin/shell/chunks/js-exec-DJQLXWCS.js +0 -99
- package/dist/bin/shell/chunks/python3-JCJHSX4Z.js +0 -14
- package/dist/bin/shell/chunks/timeout-YGFHQJKX.js +0 -3
- package/dist/bin/shell/chunks/undici-CKF2L2IP.js +0 -141
- package/dist/bin/shell/chunks/yq-K5N5JD4N.js +0 -3
- package/dist/bundle/chunks/awk2-NPLZQ3K7.js +0 -2
- package/dist/bundle/chunks/chunk-6DTD75TR.js +0 -275
- package/dist/bundle/chunks/chunk-6KK46B7Q.js +0 -12
- package/dist/bundle/chunks/chunk-AH7VTVWU.js +0 -2
- package/dist/bundle/chunks/chunk-BRJERIF4.js +0 -2
- package/dist/bundle/chunks/chunk-ELHOZMBD.js +0 -10
- package/dist/bundle/chunks/chunk-INDA53JL.js +0 -21
- package/dist/bundle/chunks/chunk-KBXRZGTY.js +0 -15
- package/dist/bundle/chunks/chunk-N3A4JVFJ.js +0 -2
- package/dist/bundle/chunks/chunk-UTKGYVUZ.js +0 -7
- package/dist/bundle/chunks/chunk-XMMV24SP.js +0 -20
- package/dist/bundle/chunks/chunk-YJKHREBZ.js +0 -11
- package/dist/bundle/chunks/chunk-ZBUZKIPX.js +0 -6
- package/dist/bundle/chunks/curl-DEHFBW27.js +0 -29
- package/dist/bundle/chunks/flag-coverage-I6UJUKQ4.js +0 -2
- package/dist/bundle/chunks/js-exec-XKF2B7C3.js +0 -98
- package/dist/bundle/chunks/js-exec-worker.js +0 -4809
- package/dist/bundle/chunks/python3-F5S5TYGS.js +0 -13
- package/dist/bundle/chunks/timeout-C6WDYPLV.js +0 -2
- package/dist/bundle/chunks/undici-PSPBDOYF.js +0 -140
- package/dist/bundle/chunks/xan-view-RT2WKDOQ.js +0 -2
- package/dist/bundle/chunks/yq-MI27NZ2U.js +0 -2
- package/dist/commands/js-exec/js-exec-worker.d.ts +0 -33
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exit-status bookkeeping for command substitutions.
|
|
3
|
+
*/
|
|
4
|
+
import type { RedirectionNode } from "../../ast/types.js";
|
|
5
|
+
import type { InterpreterState } from "../types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Record the exit status of a command substitution.
|
|
8
|
+
*
|
|
9
|
+
* `$?` and the "a substitution ran here" marker have to move together: a
|
|
10
|
+
* command with no command word (`x=1`, `> file`, an expansion that came out
|
|
11
|
+
* empty) reports the status of the last substitution that ran inside it, and
|
|
12
|
+
* 0 when none did. Setting `lastExitCode` without the marker leaves such a
|
|
13
|
+
* command reporting the *previous* command's status instead.
|
|
14
|
+
*/
|
|
15
|
+
export declare function recordSubstitutionExit(state: InterpreterState, exitCode: number): void;
|
|
16
|
+
/**
|
|
17
|
+
* The status bash gives a command that has no command word.
|
|
18
|
+
*
|
|
19
|
+
* It is the status of the last command substitution performed while expanding
|
|
20
|
+
* the command — assigned values and redirection words alike, in that order —
|
|
21
|
+
* and 0 when no substitution ran. A bare `x=1` is therefore 0 rather than
|
|
22
|
+
* whatever the previous command left in `$?`.
|
|
23
|
+
*
|
|
24
|
+
* A redirection onto fd 0 overrides all of that with 0. bash performs the
|
|
25
|
+
* redirections of a null command in a forked child when one of them reads
|
|
26
|
+
* stdin (`execute_null_command`'s `forcefork`), so the shell reports the
|
|
27
|
+
* child's status and any substitution in the words is discarded:
|
|
28
|
+
* `x=$(exit 7) < /dev/null` is 0, while `x=$(exit 7) 3< /dev/null` is 7.
|
|
29
|
+
*
|
|
30
|
+
* Verified against GNU bash 5.3. bash 3.2 predates the fork and reports 7 for
|
|
31
|
+
* both; this follows 5.x, which is what the comparison fixtures are recorded
|
|
32
|
+
* against.
|
|
33
|
+
*/
|
|
34
|
+
export declare function nullCommandExitStatus(state: InterpreterState, redirections: readonly RedirectionNode[]): number;
|
|
@@ -38,7 +38,7 @@ export interface InterpreterOptions {
|
|
|
38
38
|
/** Bootstrap JavaScript code for js-exec */
|
|
39
39
|
jsBootstrapCode?: string;
|
|
40
40
|
/** Tool invoker hook for js-exec's `tools` proxy */
|
|
41
|
-
invokeTool?: (path: string, argsJson: string) => Promise<string>;
|
|
41
|
+
invokeTool?: (path: string, argsJson: string, abortSignal: AbortSignal) => Promise<string>;
|
|
42
42
|
}
|
|
43
43
|
export declare class Interpreter {
|
|
44
44
|
private ctx;
|
|
@@ -320,6 +320,13 @@ export interface InterpreterState extends VariableAttributeState, LocalScopingSt
|
|
|
320
320
|
previousDir: string;
|
|
321
321
|
/** Exit code of last executed command */
|
|
322
322
|
lastExitCode: number;
|
|
323
|
+
/**
|
|
324
|
+
* Exit status of the most recent command substitution, or `null` when none
|
|
325
|
+
* has run since the current simple command began expanding. A command with
|
|
326
|
+
* no command word takes its status from this, not from `lastExitCode`:
|
|
327
|
+
* `x=$(exit 7)` is 7, while a plain `x=1` is 0 no matter what ran before it.
|
|
328
|
+
*/
|
|
329
|
+
lastSubstitutionExitCode: number | null;
|
|
323
330
|
/** Last argument of previous command, for $_ expansion */
|
|
324
331
|
lastArg: string;
|
|
325
332
|
/** Current line number being executed (for $LINENO) */
|
|
@@ -398,5 +405,5 @@ export interface InterpreterContext {
|
|
|
398
405
|
* Tool invoker hook. When present, js-exec sets up a `tools` proxy that
|
|
399
406
|
* routes calls through this callback.
|
|
400
407
|
*/
|
|
401
|
-
invokeTool?: (path: string, argsJson: string) => Promise<string>;
|
|
408
|
+
invokeTool?: (path: string, argsJson: string, abortSignal: AbortSignal) => Promise<string>;
|
|
402
409
|
}
|
package/dist/limits.d.ts
CHANGED
|
@@ -82,6 +82,8 @@ export interface ExecutionLimits {
|
|
|
82
82
|
maxPythonTimeoutMs?: number;
|
|
83
83
|
/** Maximum JavaScript execution time in milliseconds (normal default: 30000) */
|
|
84
84
|
maxJsTimeoutMs?: number;
|
|
85
|
+
/** Maximum JavaScript host-bridge operations (normal default: 1000000) */
|
|
86
|
+
maxJsBridgeRequests?: number;
|
|
85
87
|
/** Maximum glob filesystem operations (normal default: 1000000) */
|
|
86
88
|
maxGlobOperations?: number;
|
|
87
89
|
/** Maximum string length in bytes (normal default: 64 MiB) */
|
|
@@ -43,14 +43,6 @@ export declare function expectBlocked(env: EnvAdapter, url: string, expectedUrl?
|
|
|
43
43
|
* Utility for testing that a URL is blocked due to private IP
|
|
44
44
|
*/
|
|
45
45
|
export declare function expectBlockedPrivate(env: EnvAdapter, url: string, expectedUrl?: string): Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* Utility for testing that a URL is blocked due to DNS-resolved private IP
|
|
48
|
-
*/
|
|
49
|
-
export declare function expectBlockedDnsPrivate(env: EnvAdapter, url: string, expectedUrl?: string): Promise<void>;
|
|
50
|
-
/**
|
|
51
|
-
* Utility for testing that a URL is blocked due to DNS resolution failure (fail-closed)
|
|
52
|
-
*/
|
|
53
|
-
export declare function expectBlockedDnsFailure(env: EnvAdapter, url: string, expectedUrl?: string): Promise<void>;
|
|
54
46
|
/**
|
|
55
47
|
* Utility for testing that a URL succeeds with expected mock response
|
|
56
48
|
*/
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Request-owned connection binding for DNS-reviewed HTTP requests.
|
|
3
|
-
*
|
|
4
|
-
* Each owner has a private Undici Agent whose connector resolves exactly one
|
|
5
|
-
* hostname to exactly one preflight-reviewed address. The Agent is never
|
|
6
|
-
* shared between requests or redirect hops, so an existing origin pool cannot
|
|
7
|
-
* substitute a socket opened under a different DNS decision.
|
|
8
|
-
*
|
|
9
|
-
* The browser build removes the Node-only `undici` branch and edge runtimes
|
|
10
|
-
* that cannot construct this owner fail closed when private-range denial is
|
|
11
|
-
* enabled.
|
|
12
|
-
*/
|
|
1
|
+
/** Types for the deprecated request-owned connection override. */
|
|
13
2
|
export interface PinnedAddress {
|
|
14
3
|
hostname: string;
|
|
15
4
|
address: string;
|
|
@@ -20,26 +9,3 @@ export interface PinnedConnectionOwner {
|
|
|
20
9
|
close(): Promise<void>;
|
|
21
10
|
}
|
|
22
11
|
export type PinnedConnectionOwnerFactory = (pinned: PinnedAddress) => Promise<PinnedConnectionOwner>;
|
|
23
|
-
export declare class DnsPinningUnavailableError extends Error {
|
|
24
|
-
constructor();
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Both shapes a dynamic `import("undici")` can resolve to.
|
|
28
|
-
*
|
|
29
|
-
* Node resolves the package and exposes its CommonJS exports as named ones. A
|
|
30
|
-
* bundler that inlines the same module into its own graph cannot always do
|
|
31
|
-
* that, and hands back a namespace carrying the module under `default` alone.
|
|
32
|
-
*/
|
|
33
|
-
type UndiciNamespace = typeof import("undici") | Pick<typeof import("undici"), "default">;
|
|
34
|
-
type UndiciExports = typeof import("undici") | typeof import("undici").default;
|
|
35
|
-
/** @internal Pure namespace normalization used by focused interop tests. */
|
|
36
|
-
export declare function _undiciExports(namespace: UndiciNamespace): UndiciExports;
|
|
37
|
-
type PinnedLookup = import("node:net").LookupFunction;
|
|
38
|
-
/** @internal Pure connector lookup used by focused binding tests. */
|
|
39
|
-
export declare function _createPinnedLookup(pinned: PinnedAddress): PinnedLookup;
|
|
40
|
-
/**
|
|
41
|
-
* Create a disposable transport whose pool identity is the reviewed address.
|
|
42
|
-
* The returned owner must be closed after the response body is consumed.
|
|
43
|
-
*/
|
|
44
|
-
export declare const createPinnedConnectionOwner: PinnedConnectionOwnerFactory;
|
|
45
|
-
export {};
|
package/dist/network/fetch.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Secure fetch
|
|
2
|
+
* Secure fetch adapter.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* 2. Handles redirects manually to check each redirect target against the allow-list
|
|
7
|
-
* 3. Provides timeout support
|
|
4
|
+
* just-bash retains path allow-listing, firewall headers, response conversion,
|
|
5
|
+
* and redirect policy; guarded-fetch handles SSRF and transport safety.
|
|
8
6
|
*/
|
|
9
7
|
import { type FetchResult, type NetworkConfig } from "./types.js";
|
|
10
8
|
export interface SecureFetchOptions {
|
|
11
9
|
method?: string;
|
|
12
10
|
headers?: Headers | Record<string, string>;
|
|
13
|
-
body?: string
|
|
11
|
+
body?: string | Uint8Array<ArrayBuffer>;
|
|
14
12
|
followRedirects?: boolean;
|
|
15
13
|
/** Override timeout for this request (capped at global timeout) */
|
|
16
14
|
timeoutMs?: number;
|
package/dist/network/types.d.ts
CHANGED
|
@@ -112,14 +112,22 @@ export interface NetworkConfig {
|
|
|
112
112
|
denyPrivateRanges?: boolean;
|
|
113
113
|
/**
|
|
114
114
|
* @internal Override DNS resolution for testing.
|
|
115
|
-
*
|
|
116
|
-
*
|
|
115
|
+
* @deprecated guarded-fetch resolves DNS internally; `createSecureFetch`
|
|
116
|
+
* throws when this is set rather than running a weaker policy silently.
|
|
117
117
|
*/
|
|
118
118
|
_dnsResolve?: (hostname: string) => Promise<DnsLookupResult[]>;
|
|
119
119
|
/**
|
|
120
120
|
* @internal Override request-owned connection binding for testing.
|
|
121
|
+
* @deprecated guarded-fetch pins connections itself; `createSecureFetch`
|
|
122
|
+
* throws when this is set rather than running a weaker policy silently.
|
|
121
123
|
*/
|
|
122
124
|
_createConnectionOwner?: PinnedConnectionOwnerFactory;
|
|
125
|
+
/**
|
|
126
|
+
* @internal Override the HTTP transport for testing. Required to intercept
|
|
127
|
+
* requests on the private-range-enforcing path, which ignores
|
|
128
|
+
* `globalThis.fetch`. DNS resolution and IP validation still run.
|
|
129
|
+
*/
|
|
130
|
+
_fetch?: typeof fetch;
|
|
123
131
|
}
|
|
124
132
|
/**
|
|
125
133
|
* Result of a network fetch operation
|
|
@@ -131,6 +139,16 @@ export interface FetchResult {
|
|
|
131
139
|
/** Raw response bytes (never decoded as UTF-8 text). */
|
|
132
140
|
body: Uint8Array;
|
|
133
141
|
url: string;
|
|
142
|
+
/**
|
|
143
|
+
* Intermediate redirect responses in hop order (excluding the final
|
|
144
|
+
* response). Populated when redirects were followed so callers like
|
|
145
|
+
* `curl -D` can dump every status/header block the way real curl does.
|
|
146
|
+
*/
|
|
147
|
+
redirectChain?: Array<{
|
|
148
|
+
status: number;
|
|
149
|
+
statusText: string;
|
|
150
|
+
headers: Record<string, string>;
|
|
151
|
+
}>;
|
|
134
152
|
}
|
|
135
153
|
/**
|
|
136
154
|
* Error thrown when a URL is not allowed
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Blocked Globals for Defense-in-Depth Box
|
|
3
|
+
*
|
|
4
|
+
* This module defines which JavaScript globals should be blocked during
|
|
5
|
+
* bash script execution to prevent code execution escape vectors.
|
|
6
|
+
*
|
|
7
|
+
* IMPORTANT: This is a SECONDARY defense layer. The primary security comes
|
|
8
|
+
* from proper sandboxing and architectural constraints.
|
|
9
|
+
*
|
|
10
|
+
* NOTE: Dynamic import() is handled separately in defense-in-depth-box.ts via
|
|
11
|
+
* ESM loader hooks. This module only defines global/property patching.
|
|
12
|
+
*/
|
|
13
|
+
import type { SecurityViolationType } from "./types.js";
|
|
14
|
+
/**
|
|
15
|
+
* Strategy for handling a blocked global.
|
|
16
|
+
* - "throw": Replace with a proxy that throws on access/call
|
|
17
|
+
* - "freeze": Freeze the object to prevent modification
|
|
18
|
+
*/
|
|
19
|
+
export type BlockStrategy = "throw" | "freeze";
|
|
20
|
+
/**
|
|
21
|
+
* Configuration for a blocked global.
|
|
22
|
+
*/
|
|
23
|
+
export interface BlockedGlobal {
|
|
24
|
+
/**
|
|
25
|
+
* The property name on the target object (e.g., "Function", "eval").
|
|
26
|
+
*/
|
|
27
|
+
prop: string;
|
|
28
|
+
/**
|
|
29
|
+
* The target object containing the property.
|
|
30
|
+
* Usually globalThis, but can be other objects like Object.prototype.
|
|
31
|
+
*/
|
|
32
|
+
target: object;
|
|
33
|
+
/**
|
|
34
|
+
* Type of violation to record when this global is accessed.
|
|
35
|
+
*/
|
|
36
|
+
violationType: SecurityViolationType;
|
|
37
|
+
/**
|
|
38
|
+
* Strategy for blocking this global.
|
|
39
|
+
*/
|
|
40
|
+
strategy: BlockStrategy;
|
|
41
|
+
/**
|
|
42
|
+
* Human-readable description of why this is blocked.
|
|
43
|
+
*/
|
|
44
|
+
reason: string;
|
|
45
|
+
/**
|
|
46
|
+
* For object proxies (strategy: "throw" on objects): allow reads of these
|
|
47
|
+
* specific property names even inside the sandbox context. Node.js internals
|
|
48
|
+
* read certain properties (e.g., process.env keys) during module loading
|
|
49
|
+
* within the AsyncLocalStorage context, so they must be allowed through.
|
|
50
|
+
*/
|
|
51
|
+
allowedKeys?: Set<string>;
|
|
52
|
+
}
|
|
53
|
+
export declare function getBlockedGlobalViolationTypes(): ReadonlySet<SecurityViolationType>;
|
|
54
|
+
/**
|
|
55
|
+
* Get the list of globals to block during script execution.
|
|
56
|
+
*
|
|
57
|
+
* Note: This function must be called at runtime (not module load time)
|
|
58
|
+
* because some globals may not exist in all environments.
|
|
59
|
+
*/
|
|
60
|
+
export declare function getBlockedGlobals(): BlockedGlobal[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fail closed when execution is expected to run inside defense async context.
|
|
3
|
+
*/
|
|
4
|
+
export declare function assertDefenseContext(requireDefenseContext: boolean | undefined, component: string, phase: string): void;
|
|
5
|
+
/**
|
|
6
|
+
* Guard an async boundary by checking context both before and after await.
|
|
7
|
+
*/
|
|
8
|
+
export declare function awaitWithDefenseContext<T>(requireDefenseContext: boolean | undefined, component: string, phase: string, op: () => Promise<T>): Promise<T>;
|
|
9
|
+
/**
|
|
10
|
+
* Bind a callback to the current defense async context and assert defense
|
|
11
|
+
* invariants on callback entry.
|
|
12
|
+
*/
|
|
13
|
+
export declare function bindDefenseContextCallback<TArgs extends unknown[], TResult>(requireDefenseContext: boolean | undefined, component: string, phase: string, callback: (...args: TArgs) => TResult): (...args: TArgs) => TResult;
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defense-in-Depth Box
|
|
3
|
+
*
|
|
4
|
+
* A security layer that monkey-patches dangerous JavaScript globals during
|
|
5
|
+
* bash script execution. Uses AsyncLocalStorage to track execution context,
|
|
6
|
+
* so blocks only apply to code running within bash.exec() - not to concurrent
|
|
7
|
+
* operations in the same process.
|
|
8
|
+
*
|
|
9
|
+
* IMPORTANT: This is a SECONDARY defense layer. It should never be relied upon
|
|
10
|
+
* as the primary security mechanism. The primary security comes from proper
|
|
11
|
+
* sandboxing, input validation, and architectural constraints.
|
|
12
|
+
*
|
|
13
|
+
* Key design decisions:
|
|
14
|
+
* - AsyncLocalStorage for context tracking (blocks only affect sandboxed code)
|
|
15
|
+
* - Reference counting for nested exec() calls
|
|
16
|
+
* - Patches are process-wide but checks are context-aware
|
|
17
|
+
* - Violations are recorded even in audit mode
|
|
18
|
+
*
|
|
19
|
+
* Dynamic import() mitigation (three layers):
|
|
20
|
+
* 1. ESM loader hooks (module.register/registerHooks):
|
|
21
|
+
* - block data:/blob: URLs only in the untrusted async context
|
|
22
|
+
* - block Node.js builtin specifiers in untrusted sandbox context
|
|
23
|
+
* 2. Module._resolveFilename blocked — catches file-based specifiers
|
|
24
|
+
* 3. Filesystem restrictions — OverlayFs writes to memory only
|
|
25
|
+
*
|
|
26
|
+
* Runtimes with only module.register() (no registerHooks) resolve auto mode as
|
|
27
|
+
* unsupported and reject explicitly enabled activation. Their separate loader
|
|
28
|
+
* thread cannot observe AsyncLocalStorage, so installing a partial or
|
|
29
|
+
* process-global fallback would either be misleading or break unrelated host
|
|
30
|
+
* imports.
|
|
31
|
+
*/
|
|
32
|
+
import type { DefenseInDepthConfig, DefenseInDepthHandle, DefenseInDepthStats, DefenseInDepthStatus, SecurityViolation } from "./types.js";
|
|
33
|
+
/**
|
|
34
|
+
* Error thrown when a security violation is detected and blocking is enabled.
|
|
35
|
+
*/
|
|
36
|
+
export declare class SecurityViolationError extends Error {
|
|
37
|
+
readonly violation: SecurityViolation;
|
|
38
|
+
constructor(message: string, violation: SecurityViolation);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Defense-in-Depth Box
|
|
42
|
+
*
|
|
43
|
+
* Singleton class that manages security patches during bash execution.
|
|
44
|
+
* Use getInstance() to get or create the instance.
|
|
45
|
+
*/
|
|
46
|
+
export declare class DefenseInDepthBox {
|
|
47
|
+
private static instance;
|
|
48
|
+
private static importHooksRegistered;
|
|
49
|
+
/**
|
|
50
|
+
* Tracks active trusted scopes per executionId.
|
|
51
|
+
* Needed for async machinery that may not preserve `store.trusted` all the
|
|
52
|
+
* way into Node.js internals (e.g. dynamic import resolution hooks).
|
|
53
|
+
*/
|
|
54
|
+
private static trustedExecutionDepth;
|
|
55
|
+
private config;
|
|
56
|
+
private refCount;
|
|
57
|
+
private patchFailures;
|
|
58
|
+
private activeExecutionIds;
|
|
59
|
+
/** Reusable DefenseContext objects keyed by executionId (avoids per-.then() allocation). */
|
|
60
|
+
private contextCache;
|
|
61
|
+
private originalDescriptors;
|
|
62
|
+
/**
|
|
63
|
+
* Restores the native accessor backing slot for module methods patched via
|
|
64
|
+
* their setter (see protectModuleMethod). Restoring the descriptor alone
|
|
65
|
+
* does not clear that slot, since the runtime's setter, not the descriptor
|
|
66
|
+
* shape, is what tracks the active override.
|
|
67
|
+
*/
|
|
68
|
+
private moduleAccessorResets;
|
|
69
|
+
/**
|
|
70
|
+
* Descriptors made temporarily read-only while the shared host realm is
|
|
71
|
+
* protected. Unlike process-lifetime hardening, every entry remains
|
|
72
|
+
* configurable and is restored exactly when the last handle deactivates.
|
|
73
|
+
*/
|
|
74
|
+
private temporaryIntrinsicDescriptors;
|
|
75
|
+
private violations;
|
|
76
|
+
private activationTime;
|
|
77
|
+
private totalActiveTimeMs;
|
|
78
|
+
private constructor();
|
|
79
|
+
/**
|
|
80
|
+
* Get or create the singleton instance.
|
|
81
|
+
*
|
|
82
|
+
* @param config - Configuration for the defense box.
|
|
83
|
+
* @throws Error if called with a config that conflicts with the existing instance's
|
|
84
|
+
* security-relevant settings (enabled, auditMode). This prevents a weaker
|
|
85
|
+
* first caller from silently downgrading protection for later callers.
|
|
86
|
+
*/
|
|
87
|
+
static getInstance(config?: DefenseInDepthConfig | boolean): DefenseInDepthBox;
|
|
88
|
+
/**
|
|
89
|
+
* Reset the singleton instance. Only use in tests.
|
|
90
|
+
*/
|
|
91
|
+
static resetInstance(): void;
|
|
92
|
+
/**
|
|
93
|
+
* Check if the current async context is within sandboxed execution.
|
|
94
|
+
*/
|
|
95
|
+
static isInSandboxedContext(): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Get the current execution ID if in a sandboxed context.
|
|
98
|
+
*/
|
|
99
|
+
static getCurrentExecutionId(): string | undefined;
|
|
100
|
+
private static enterTrustedScope;
|
|
101
|
+
private static leaveTrustedScope;
|
|
102
|
+
private static isTrustedScopeActive;
|
|
103
|
+
private static isTrustedContext;
|
|
104
|
+
/**
|
|
105
|
+
* Check if a defense execution ID is still live (its handle is not deactivated).
|
|
106
|
+
*/
|
|
107
|
+
private isExecutionIdActive;
|
|
108
|
+
/**
|
|
109
|
+
* Get or create a cached DefenseContext for an executionId.
|
|
110
|
+
* Avoids allocating a new {sandboxActive, executionId} object on every
|
|
111
|
+
* Promise.then / timer call.
|
|
112
|
+
*/
|
|
113
|
+
private getCachedContext;
|
|
114
|
+
/**
|
|
115
|
+
* Bind a callback to the current defense AsyncLocalStorage context.
|
|
116
|
+
*
|
|
117
|
+
* Useful for infrastructure callbacks that may execute later via pre-captured
|
|
118
|
+
* timer references, while still needing executionId/trace continuity.
|
|
119
|
+
*
|
|
120
|
+
* Note: this intentionally does NOT preserve `trusted` mode. Trusted execution
|
|
121
|
+
* is meant to stay tightly scoped to the immediate infrastructure operation.
|
|
122
|
+
*/
|
|
123
|
+
static bindCurrentContext<TArgs extends unknown[], TResult>(fn: (...args: TArgs) => TResult): (...args: TArgs) => TResult;
|
|
124
|
+
/**
|
|
125
|
+
* Check if defense-in-depth is enabled and functional.
|
|
126
|
+
* Returns false if AsyncLocalStorage is unavailable or config.enabled is false.
|
|
127
|
+
*/
|
|
128
|
+
isEnabled(): boolean;
|
|
129
|
+
/** Return the resolved runtime capability without activating protection. */
|
|
130
|
+
getStatus(): DefenseInDepthStatus;
|
|
131
|
+
/**
|
|
132
|
+
* Update configuration. Only affects future activations.
|
|
133
|
+
*/
|
|
134
|
+
updateConfig(config: Partial<DefenseInDepthConfig>): void;
|
|
135
|
+
/**
|
|
136
|
+
* Activate the defense box. Returns a handle for scoped execution.
|
|
137
|
+
*
|
|
138
|
+
* Usage:
|
|
139
|
+
* ```
|
|
140
|
+
* const { run, deactivate } = box.activate();
|
|
141
|
+
* try {
|
|
142
|
+
* await run(async () => {
|
|
143
|
+
* // Code here is protected
|
|
144
|
+
* });
|
|
145
|
+
* } finally {
|
|
146
|
+
* deactivate();
|
|
147
|
+
* }
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
activate(): DefenseInDepthHandle;
|
|
151
|
+
/**
|
|
152
|
+
* Force deactivation, restoring all patches regardless of ref count.
|
|
153
|
+
* Use for error recovery only.
|
|
154
|
+
*/
|
|
155
|
+
forceDeactivate(): void;
|
|
156
|
+
/**
|
|
157
|
+
* Check if patches are currently applied.
|
|
158
|
+
*/
|
|
159
|
+
isActive(): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Get statistics about the defense box.
|
|
162
|
+
*/
|
|
163
|
+
getStats(): DefenseInDepthStats;
|
|
164
|
+
/**
|
|
165
|
+
* Get the list of patch paths that failed during the last activation.
|
|
166
|
+
*/
|
|
167
|
+
getPatchFailures(): string[];
|
|
168
|
+
/**
|
|
169
|
+
* Clear stored violations. Useful for testing.
|
|
170
|
+
*/
|
|
171
|
+
clearViolations(): void;
|
|
172
|
+
/**
|
|
173
|
+
* Get a human-readable path for a target object and property.
|
|
174
|
+
*/
|
|
175
|
+
private getPathForTarget;
|
|
176
|
+
/**
|
|
177
|
+
* Run a function as trusted infrastructure code.
|
|
178
|
+
* Blocking is suspended for the current async context only — other
|
|
179
|
+
* concurrent exec() calls remain protected.
|
|
180
|
+
*
|
|
181
|
+
* Uses AsyncLocalStorage to scope the trust, so async operations
|
|
182
|
+
* spawned inside the callback inherit the trusted state.
|
|
183
|
+
*/
|
|
184
|
+
static runTrusted<T>(fn: () => T): T;
|
|
185
|
+
/**
|
|
186
|
+
* Async version of runTrusted.
|
|
187
|
+
*/
|
|
188
|
+
static runTrustedAsync<T>(fn: () => Promise<T>): Promise<T>;
|
|
189
|
+
/**
|
|
190
|
+
* Restore blocking for an untrusted operation nested inside trusted host code.
|
|
191
|
+
*/
|
|
192
|
+
static runUntrustedAsync<T>(fn: () => Promise<T>): Promise<T>;
|
|
193
|
+
/**
|
|
194
|
+
* Check if current context should be blocked.
|
|
195
|
+
* Returns false in audit mode, browser environment, outside sandboxed context,
|
|
196
|
+
* inside runTrusted(), or when the immediate caller is a Node.js bundled dep.
|
|
197
|
+
*/
|
|
198
|
+
private shouldBlock;
|
|
199
|
+
/** Record audit events only for untrusted sandbox work. */
|
|
200
|
+
private shouldAudit;
|
|
201
|
+
/**
|
|
202
|
+
* Record a violation and optionally invoke the callback.
|
|
203
|
+
*/
|
|
204
|
+
private recordViolation;
|
|
205
|
+
/**
|
|
206
|
+
* Create a blocking proxy for a function.
|
|
207
|
+
*/
|
|
208
|
+
private createBlockingProxy;
|
|
209
|
+
/**
|
|
210
|
+
* Create a blocking proxy for an object (blocks all property access).
|
|
211
|
+
*/
|
|
212
|
+
private createBlockingObjectProxy;
|
|
213
|
+
/** Preserve read access while denying mutation only in sandbox context. */
|
|
214
|
+
private createReadonlyObjectProxy;
|
|
215
|
+
/**
|
|
216
|
+
* Apply security patches to dangerous globals.
|
|
217
|
+
*/
|
|
218
|
+
private applyPatches;
|
|
219
|
+
/**
|
|
220
|
+
* Close the cached-reference assignment path without permanently freezing
|
|
221
|
+
* host globals. The global proxies protect references obtained after
|
|
222
|
+
* activation; these temporary descriptor changes protect references cached
|
|
223
|
+
* before activation. Configurability is deliberately retained so teardown
|
|
224
|
+
* can restore the host realm byte-for-byte.
|
|
225
|
+
*/
|
|
226
|
+
private protectReversibleIntrinsics;
|
|
227
|
+
/**
|
|
228
|
+
* Protect against .constructor.constructor escape vector.
|
|
229
|
+
*
|
|
230
|
+
* The pattern `{}.constructor.constructor` accesses Function via:
|
|
231
|
+
* - {}.constructor → Object (via Object.prototype.constructor)
|
|
232
|
+
* - Object.constructor → Function (via Function.prototype.constructor)
|
|
233
|
+
*
|
|
234
|
+
* By patching Function.prototype.constructor to return our blocked proxy,
|
|
235
|
+
* we block the escape vector without breaking normal .constructor access.
|
|
236
|
+
*/
|
|
237
|
+
private protectConstructorChain;
|
|
238
|
+
/**
|
|
239
|
+
* Protect Error.prepareStackTrace from being set in sandbox context.
|
|
240
|
+
*
|
|
241
|
+
* The attack vector is:
|
|
242
|
+
* ```
|
|
243
|
+
* Error.prepareStackTrace = (err, stack) => {
|
|
244
|
+
* return stack[0].getFunction().constructor; // Gets Function
|
|
245
|
+
* };
|
|
246
|
+
* const F = new Error().stack;
|
|
247
|
+
* F("return process")();
|
|
248
|
+
* ```
|
|
249
|
+
*
|
|
250
|
+
* We only block SETTING, not reading, because V8 reads it internally
|
|
251
|
+
* when creating error stack traces.
|
|
252
|
+
*/
|
|
253
|
+
private protectErrorPrepareStackTrace;
|
|
254
|
+
/**
|
|
255
|
+
* Protect Promise.then callback lifetime across deactivate boundaries.
|
|
256
|
+
*
|
|
257
|
+
* Callbacks registered in sandbox context are wrapped with an execution-id
|
|
258
|
+
* liveness check. If they run after the originating handle is deactivated,
|
|
259
|
+
* they are blocked even if global patches have already been restored.
|
|
260
|
+
*/
|
|
261
|
+
private protectPromiseThen;
|
|
262
|
+
/**
|
|
263
|
+
* Patch a prototype's constructor property to block access in sandbox context.
|
|
264
|
+
*/
|
|
265
|
+
private patchPrototypeConstructor;
|
|
266
|
+
/**
|
|
267
|
+
* Protect process.mainModule from being accessed or set in sandbox context.
|
|
268
|
+
*
|
|
269
|
+
* The attack vector is:
|
|
270
|
+
* ```
|
|
271
|
+
* process.mainModule.require('child_process').execSync('whoami')
|
|
272
|
+
* process.mainModule.constructor._load('vm')
|
|
273
|
+
* ```
|
|
274
|
+
*
|
|
275
|
+
* process.mainModule may be undefined in ESM contexts but could exist in
|
|
276
|
+
* CommonJS workers. We block both reading and setting.
|
|
277
|
+
*/
|
|
278
|
+
private protectProcessMainModule;
|
|
279
|
+
/**
|
|
280
|
+
* Protect process.execPath from being read or set in sandbox context.
|
|
281
|
+
*
|
|
282
|
+
* process.execPath is a string primitive (not an object), so it cannot be
|
|
283
|
+
* proxied via the normal blocked globals mechanism. We use Object.defineProperty
|
|
284
|
+
* with getter/setter (same pattern as protectProcessMainModule).
|
|
285
|
+
*/
|
|
286
|
+
private protectProcessExecPath;
|
|
287
|
+
/**
|
|
288
|
+
* Lock well-known Symbol properties on built-in constructors/prototypes.
|
|
289
|
+
*
|
|
290
|
+
* Instead of freezing entire prototypes (which breaks Node.js internals),
|
|
291
|
+
* we make specific Symbol properties non-configurable so they can't be
|
|
292
|
+
* replaced. This prevents:
|
|
293
|
+
* - Symbol.species hijacking (controls .map/.filter/.slice return types)
|
|
294
|
+
* - Symbol.iterator hijacking (controls for...of and spread)
|
|
295
|
+
* - Symbol.toPrimitive hijacking (controls type coercion)
|
|
296
|
+
*/
|
|
297
|
+
private lockWellKnownSymbols;
|
|
298
|
+
/**
|
|
299
|
+
* Block Proxy.revocable to prevent bypassing Proxy constructor blocking.
|
|
300
|
+
*
|
|
301
|
+
* Proxy.revocable internally uses the real Proxy constructor, so it bypasses
|
|
302
|
+
* our blocking proxy on globalThis.Proxy. We replace it with a wrapper that
|
|
303
|
+
* checks the sandbox context before delegating to the original.
|
|
304
|
+
*/
|
|
305
|
+
private protectProxyRevocable;
|
|
306
|
+
/**
|
|
307
|
+
* Block dynamic import() escape vectors via ESM loader hooks.
|
|
308
|
+
*
|
|
309
|
+
* Uses Node.js module.registerHooks() (23.5+, synchronous) to install ESM
|
|
310
|
+
* loader hooks that reject dangerous specifiers.
|
|
311
|
+
*
|
|
312
|
+
* registerHooks() runs in-thread and can read AsyncLocalStorage. We use it
|
|
313
|
+
* to block Node.js builtin specifiers (node:* and bare builtins) only in
|
|
314
|
+
* untrusted sandbox context while still allowing trusted infrastructure
|
|
315
|
+
* imports (runTrusted/runTrustedAsync).
|
|
316
|
+
*
|
|
317
|
+
* module.register() is deliberately not used as a fallback: those hooks run
|
|
318
|
+
* in a separate loader thread and cannot read AsyncLocalStorage.
|
|
319
|
+
*
|
|
320
|
+
* This is process-wide and permanent (hooks cannot be unregistered).
|
|
321
|
+
* Only applied once per process regardless of how many DefenseInDepthBox
|
|
322
|
+
* instances are created.
|
|
323
|
+
*
|
|
324
|
+
* Combined with Module._resolveFilename blocking (file-based specifiers),
|
|
325
|
+
* this closes the import() escape vector except for specifiers that bypass
|
|
326
|
+
* both the ESM loader and CJS resolution (none known).
|
|
327
|
+
*/
|
|
328
|
+
private protectDynamicImport;
|
|
329
|
+
/**
|
|
330
|
+
* Protect Module._load from being called in sandbox context.
|
|
331
|
+
*
|
|
332
|
+
* The attack vector is:
|
|
333
|
+
* ```
|
|
334
|
+
* module.constructor._load('child_process')
|
|
335
|
+
* require.main.constructor._load('vm')
|
|
336
|
+
* ```
|
|
337
|
+
*
|
|
338
|
+
* We access the Module class and replace _load with a blocking proxy.
|
|
339
|
+
*/
|
|
340
|
+
private protectModuleLoad;
|
|
341
|
+
/**
|
|
342
|
+
* Protect Module._resolveFilename from being called in sandbox context.
|
|
343
|
+
*
|
|
344
|
+
* Module._resolveFilename is called for both require() and import() resolution.
|
|
345
|
+
* Blocking it catches file-based import() specifiers:
|
|
346
|
+
* import('./malicious.js') // _resolveFilename is called to resolve the path
|
|
347
|
+
*
|
|
348
|
+
* data: and blob: URLs are handled separately by protectDynamicImport()
|
|
349
|
+
* via ESM loader hooks.
|
|
350
|
+
*/
|
|
351
|
+
private protectModuleResolveFilename;
|
|
352
|
+
private protectModuleMethod;
|
|
353
|
+
/**
|
|
354
|
+
* Apply a single patch to a blocked global.
|
|
355
|
+
*/
|
|
356
|
+
private applyPatch;
|
|
357
|
+
/**
|
|
358
|
+
* Restore all original values.
|
|
359
|
+
*/
|
|
360
|
+
private restorePatches;
|
|
361
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security Module - Defense-in-Depth Box
|
|
3
|
+
*
|
|
4
|
+
* This module provides a secondary defense layer that monkey-patches
|
|
5
|
+
* dangerous JavaScript globals during bash script execution.
|
|
6
|
+
*
|
|
7
|
+
* IMPORTANT: This is a SECONDARY defense layer. It should never be relied upon
|
|
8
|
+
* as the primary security mechanism. The primary security comes from proper
|
|
9
|
+
* sandboxing, input validation, and architectural constraints.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { Bash } from 'just-bash';
|
|
14
|
+
*
|
|
15
|
+
* // Capability-detect defense-in-depth (the Bash default)
|
|
16
|
+
* const bash = new Bash({
|
|
17
|
+
* defenseInDepth: { enabled: "auto" },
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* // Or with custom configuration
|
|
21
|
+
* const bash = new Bash({
|
|
22
|
+
* defenseInDepth: {
|
|
23
|
+
* enabled: true,
|
|
24
|
+
* auditMode: false,
|
|
25
|
+
* onViolation: (v) => console.warn('Violation:', v),
|
|
26
|
+
* },
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export { DefenseInDepthBox, SecurityViolationError, } from "./defense-in-depth-box.js";
|
|
31
|
+
export { createConsoleViolationCallback, SecurityViolationLogger, type SecurityViolationLoggerOptions, type ViolationSummary, } from "./security-violation-logger.js";
|
|
32
|
+
export type { DefenseInDepthConfig, DefenseInDepthHandle, DefenseInDepthStats, DefenseInDepthStatus, SecurityViolation, SecurityViolationType, } from "./types.js";
|
|
33
|
+
export { WorkerDefenseInDepth, type WorkerDefenseStats, } from "./worker-defense-in-depth.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getSafeTimestamp(): number;
|