@jerryan/just-bash 3.5.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 +308 -0
- package/LICENSE +201 -0
- package/README.md +827 -0
- package/dist/AGENTS.md +383 -0
- package/dist/Bash.d.ts +317 -0
- package/dist/abort-signals.d.ts +10 -0
- package/dist/agent-sandbox.d.ts +104 -0
- package/dist/ast/types.d.ts +612 -0
- package/dist/banned-patterns-test.d.ts +1 -0
- package/dist/bin/chunks/alias-3R4G6HQY.js +3 -0
- package/dist/bin/chunks/awk2-KO7ZE3P7.js +3 -0
- package/dist/bin/chunks/base64-TQ5KOCNW.js +3 -0
- package/dist/bin/chunks/basename-C4CRGDXP.js +3 -0
- package/dist/bin/chunks/bash-CFCBBWVH.js +3 -0
- package/dist/bin/chunks/cat-BQ7FQTN5.js +3 -0
- package/dist/bin/chunks/chmod-WYYTXGVB.js +3 -0
- package/dist/bin/chunks/chunk-23OI2XDJ.js +20 -0
- package/dist/bin/chunks/chunk-2ETT4ELS.js +4 -0
- package/dist/bin/chunks/chunk-2UV6ZFHK.js +4 -0
- package/dist/bin/chunks/chunk-2YLY6FJA.js +10 -0
- package/dist/bin/chunks/chunk-3FQBUEB6.js +3 -0
- package/dist/bin/chunks/chunk-3MRB66F4.js +3 -0
- package/dist/bin/chunks/chunk-3PCPQIUD.js +3 -0
- package/dist/bin/chunks/chunk-42AMF6EE.js +3 -0
- package/dist/bin/chunks/chunk-43E7AR6A.js +3 -0
- package/dist/bin/chunks/chunk-45DUHCXR.js +7 -0
- package/dist/bin/chunks/chunk-472JZJ2D.js +22 -0
- package/dist/bin/chunks/chunk-47IFMQYS.js +3 -0
- package/dist/bin/chunks/chunk-4JF56A3P.js +15 -0
- package/dist/bin/chunks/chunk-5SKEZPTU.js +12 -0
- package/dist/bin/chunks/chunk-67XYNGRV.js +9 -0
- package/dist/bin/chunks/chunk-6ESRNSO7.js +7 -0
- package/dist/bin/chunks/chunk-6KHZX4HU.js +12 -0
- package/dist/bin/chunks/chunk-7FGDUBSN.js +14 -0
- package/dist/bin/chunks/chunk-7JZKVC3F.js +2 -0
- package/dist/bin/chunks/chunk-7PPAWLUI.js +12 -0
- package/dist/bin/chunks/chunk-7PUOS2OO.js +143 -0
- package/dist/bin/chunks/chunk-7VWOECJ3.js +101 -0
- package/dist/bin/chunks/chunk-7WBCA2BB.js +3 -0
- package/dist/bin/chunks/chunk-AGKL4LDL.js +4 -0
- package/dist/bin/chunks/chunk-AI7JUA46.js +13 -0
- package/dist/bin/chunks/chunk-AJF3OBTR.js +4 -0
- package/dist/bin/chunks/chunk-B2DRBHGQ.js +3 -0
- package/dist/bin/chunks/chunk-B2GCIQI2.js +16 -0
- package/dist/bin/chunks/chunk-B6WWC6K3.js +9 -0
- package/dist/bin/chunks/chunk-BIJXTWZ4.js +3 -0
- package/dist/bin/chunks/chunk-CC2AQ6B7.js +15 -0
- package/dist/bin/chunks/chunk-CL7IYCGG.js +20 -0
- package/dist/bin/chunks/chunk-CMTQFWZK.js +5 -0
- package/dist/bin/chunks/chunk-CPKBPQ2C.js +3 -0
- package/dist/bin/chunks/chunk-DJAX3ZRG.js +8 -0
- package/dist/bin/chunks/chunk-DN2YCFOR.js +3 -0
- package/dist/bin/chunks/chunk-DYIBFLS3.js +17 -0
- package/dist/bin/chunks/chunk-DZAFUADN.js +36 -0
- package/dist/bin/chunks/chunk-F3UDTTI7.js +13 -0
- package/dist/bin/chunks/chunk-FHMIEBRM.js +6 -0
- package/dist/bin/chunks/chunk-FONAGXRJ.js +17 -0
- package/dist/bin/chunks/chunk-FPWHWWXO.js +8 -0
- package/dist/bin/chunks/chunk-FUT3X2GJ.js +9 -0
- package/dist/bin/chunks/chunk-G4AUMZUY.js +4 -0
- package/dist/bin/chunks/chunk-GA5TPRMF.js +34 -0
- package/dist/bin/chunks/chunk-GOWX7VPU.js +7 -0
- package/dist/bin/chunks/chunk-GQKQEK5N.js +11 -0
- package/dist/bin/chunks/chunk-GR4ZHKXI.js +3 -0
- package/dist/bin/chunks/chunk-HDWHYM2T.js +18 -0
- package/dist/bin/chunks/chunk-HQ63MFHG.js +34 -0
- package/dist/bin/chunks/chunk-HW2VJKFH.js +4 -0
- package/dist/bin/chunks/chunk-HWI42GQO.js +7 -0
- package/dist/bin/chunks/chunk-HZGHQZSY.js +10 -0
- package/dist/bin/chunks/chunk-I4IRHQDW.js +3 -0
- package/dist/bin/chunks/chunk-I57EACSL.js +3 -0
- package/dist/bin/chunks/chunk-JELR4642.js +21 -0
- package/dist/bin/chunks/chunk-JQM3DKCH.js +12 -0
- package/dist/bin/chunks/chunk-K27FY3ES.js +3 -0
- package/dist/bin/chunks/chunk-KG2KXL4Y.js +3 -0
- package/dist/bin/chunks/chunk-KI54R2QB.js +3 -0
- package/dist/bin/chunks/chunk-KP2UH5CJ.js +22 -0
- package/dist/bin/chunks/chunk-KUMHQGUR.js +3 -0
- package/dist/bin/chunks/chunk-LE2XKKGQ.js +7 -0
- package/dist/bin/chunks/chunk-LJQIAFWS.js +5 -0
- package/dist/bin/chunks/chunk-LXFMIXGA.js +3 -0
- package/dist/bin/chunks/chunk-M7SIPZZZ.js +22 -0
- package/dist/bin/chunks/chunk-MF3GVFLC.js +11 -0
- package/dist/bin/chunks/chunk-MROECM42.js +3 -0
- package/dist/bin/chunks/chunk-MUFNRCMY.js +24 -0
- package/dist/bin/chunks/chunk-MVBK66TR.js +22 -0
- package/dist/bin/chunks/chunk-MYTNZ7MA.js +7 -0
- package/dist/bin/chunks/chunk-N26Y42L6.js +10 -0
- package/dist/bin/chunks/chunk-NE4R2FVV.js +5 -0
- package/dist/bin/chunks/chunk-NLU5LALY.js +37 -0
- package/dist/bin/chunks/chunk-NXUXZWS5.js +7 -0
- package/dist/bin/chunks/chunk-O2BCKSMK.js +3 -0
- package/dist/bin/chunks/chunk-OLEQNRKX.js +8 -0
- package/dist/bin/chunks/chunk-OUQKFRVR.js +6 -0
- package/dist/bin/chunks/chunk-OXLC2WWX.js +26 -0
- package/dist/bin/chunks/chunk-OYXHOZZ4.js +15 -0
- package/dist/bin/chunks/chunk-PBOVSFTJ.js +3 -0
- package/dist/bin/chunks/chunk-PPVF2N6C.js +3 -0
- package/dist/bin/chunks/chunk-PQ2INDRF.js +87 -0
- package/dist/bin/chunks/chunk-PXP4YYZA.js +13 -0
- package/dist/bin/chunks/chunk-PZQVSQX6.js +4 -0
- package/dist/bin/chunks/chunk-Q2GOPGDA.js +6 -0
- package/dist/bin/chunks/chunk-Q3LE3Y66.js +13 -0
- package/dist/bin/chunks/chunk-QES5OSUC.js +3 -0
- package/dist/bin/chunks/chunk-QFTZKD5O.js +13 -0
- package/dist/bin/chunks/chunk-QL33F2W6.js +8 -0
- package/dist/bin/chunks/chunk-QMPZXXEK.js +8 -0
- package/dist/bin/chunks/chunk-QYZN33JA.js +3 -0
- package/dist/bin/chunks/chunk-R2J5MJOM.js +20 -0
- package/dist/bin/chunks/chunk-RPUFEP5O.js +65 -0
- package/dist/bin/chunks/chunk-RVPTAYDS.js +4 -0
- package/dist/bin/chunks/chunk-SC5TEGMM.js +12 -0
- package/dist/bin/chunks/chunk-SDGPS6XI.js +10 -0
- package/dist/bin/chunks/chunk-TW2IJRUF.js +3 -0
- package/dist/bin/chunks/chunk-TYBXHT6W.js +10 -0
- package/dist/bin/chunks/chunk-V2XF3TTW.js +276 -0
- package/dist/bin/chunks/chunk-V4U26ZWL.js +16 -0
- package/dist/bin/chunks/chunk-VTAMGD42.js +3 -0
- package/dist/bin/chunks/chunk-WAJVRK5B.js +16 -0
- package/dist/bin/chunks/chunk-WEHA3JFD.js +3 -0
- package/dist/bin/chunks/chunk-WFHYGSLJ.js +6 -0
- package/dist/bin/chunks/chunk-WFVCEB5T.js +3 -0
- package/dist/bin/chunks/chunk-YERKK5B3.js +4 -0
- package/dist/bin/chunks/chunk-YIANER7Y.js +8 -0
- package/dist/bin/chunks/chunk-YJ5OCPSK.js +7 -0
- package/dist/bin/chunks/chunk-YOIFOOGX.js +9 -0
- package/dist/bin/chunks/chunk-YQEKKZTU.js +12 -0
- package/dist/bin/chunks/chunk-YUZRUF5F.js +10 -0
- package/dist/bin/chunks/chunk-ZMGLTHSU.js +15 -0
- package/dist/bin/chunks/clear-OE52K3TM.js +3 -0
- package/dist/bin/chunks/column-AJFK3TWF.js +3 -0
- package/dist/bin/chunks/comm-URDMZCXL.js +3 -0
- package/dist/bin/chunks/cp-OMVKM35F.js +3 -0
- package/dist/bin/chunks/curl-NHNZ46BU.js +31 -0
- package/dist/bin/chunks/cut-42X6363P.js +3 -0
- package/dist/bin/chunks/date-6MQGVWDY.js +3 -0
- package/dist/bin/chunks/diff-YXZZCUSQ.js +3 -0
- package/dist/bin/chunks/dirname-TPUFCYF6.js +3 -0
- package/dist/bin/chunks/dist-5MWO25Y4.js +141 -0
- package/dist/bin/chunks/du-LUFPVLNW.js +3 -0
- package/dist/bin/chunks/echo-NYDCCFWB.js +3 -0
- package/dist/bin/chunks/env-2TSVF4W7.js +3 -0
- package/dist/bin/chunks/expand-IQRKKT7D.js +3 -0
- package/dist/bin/chunks/expr-NNMDHOCN.js +3 -0
- package/dist/bin/chunks/file-4T64QNLS.js +3 -0
- package/dist/bin/chunks/find-AWH2KOY7.js +3 -0
- package/dist/bin/chunks/flag-coverage-J2ZHA465.js +3 -0
- package/dist/bin/chunks/fold-YEY7X54W.js +3 -0
- package/dist/bin/chunks/grep-CVU5V66H.js +3 -0
- package/dist/bin/chunks/gzip-FDPA6EKG.js +3 -0
- package/dist/bin/chunks/head-QKVY3SIO.js +3 -0
- package/dist/bin/chunks/help-HVIDHJ6M.js +3 -0
- package/dist/bin/chunks/history-3HAU45KT.js +3 -0
- package/dist/bin/chunks/hostname-2I76DUQL.js +3 -0
- package/dist/bin/chunks/html-to-markdown-XUMA42ZC.js +3 -0
- package/dist/bin/chunks/join-34DX7YK5.js +3 -0
- package/dist/bin/chunks/jq-V7OTAVU5.js +3 -0
- package/dist/bin/chunks/js-exec-DJQLXWCS.js +99 -0
- package/dist/bin/chunks/js-exec-worker.js +4809 -0
- package/dist/bin/chunks/ln-B35EKC2Q.js +3 -0
- package/dist/bin/chunks/ls-Q6ZZ6SQ2.js +3 -0
- package/dist/bin/chunks/md5sum-Z6KAYGDK.js +3 -0
- package/dist/bin/chunks/mkdir-74BP5NTG.js +3 -0
- package/dist/bin/chunks/mv-76LAHXFR.js +3 -0
- package/dist/bin/chunks/nl-4IZRRT7U.js +3 -0
- package/dist/bin/chunks/od-2GXD4D5K.js +3 -0
- package/dist/bin/chunks/paste-DWWA3JTW.js +3 -0
- package/dist/bin/chunks/printf-YXCSED2H.js +3 -0
- package/dist/bin/chunks/pwd-YKLNXWZI.js +3 -0
- package/dist/bin/chunks/python3-JCJHSX4Z.js +14 -0
- package/dist/bin/chunks/readlink-EHXJNW62.js +3 -0
- package/dist/bin/chunks/rev-CZTQCNOZ.js +3 -0
- package/dist/bin/chunks/rg-PXNKNIMY.js +3 -0
- package/dist/bin/chunks/rm-3PLW4O4B.js +3 -0
- package/dist/bin/chunks/rmdir-7ZIVFZJX.js +3 -0
- package/dist/bin/chunks/sed-4LVDFHIJ.js +3 -0
- package/dist/bin/chunks/seq-X2EAOGV5.js +3 -0
- package/dist/bin/chunks/sha1sum-CATBXX76.js +3 -0
- package/dist/bin/chunks/sha256sum-YGSNBVY3.js +3 -0
- package/dist/bin/chunks/sleep-DVFE2GSF.js +3 -0
- package/dist/bin/chunks/sort-HBOCBBJQ.js +3 -0
- package/dist/bin/chunks/split-ZNNNHKSP.js +3 -0
- package/dist/bin/chunks/sqlite3-KP42NNIY.js +3 -0
- package/dist/bin/chunks/sqlite3-worker.js +1928 -0
- package/dist/bin/chunks/stat-LROLDXHH.js +3 -0
- package/dist/bin/chunks/strings-CNUK76JL.js +3 -0
- package/dist/bin/chunks/tac-DG4BMYM5.js +3 -0
- package/dist/bin/chunks/tail-UOTUV25D.js +3 -0
- package/dist/bin/chunks/tar-7HGZIMZD.js +3 -0
- package/dist/bin/chunks/tee-L4HKV5PD.js +3 -0
- package/dist/bin/chunks/time-LF7BTSK5.js +3 -0
- package/dist/bin/chunks/timeout-YGFHQJKX.js +3 -0
- package/dist/bin/chunks/touch-TVQAUQOG.js +3 -0
- package/dist/bin/chunks/tr-PVFO6FRY.js +3 -0
- package/dist/bin/chunks/tree-ZGP6NPGS.js +3 -0
- package/dist/bin/chunks/true-KFTJGQLQ.js +3 -0
- package/dist/bin/chunks/unexpand-JPOQORZF.js +3 -0
- package/dist/bin/chunks/uniq-JMHDIJXT.js +3 -0
- package/dist/bin/chunks/wc-3KLVOCI2.js +3 -0
- package/dist/bin/chunks/which-4TPGVSBZ.js +3 -0
- package/dist/bin/chunks/whoami-B5HDVKW6.js +3 -0
- package/dist/bin/chunks/worker.js +3330 -0
- package/dist/bin/chunks/xan-WW53ETXT.js +3 -0
- package/dist/bin/chunks/xan-view-PD26QEFN.js +3 -0
- package/dist/bin/chunks/xargs-4AMMXFXL.js +3 -0
- package/dist/bin/chunks/yq-MYZOS2WN.js +3 -0
- package/dist/bin/just-bash.js +858 -0
- package/dist/bin/shell/chunks/alias-3R4G6HQY.js +3 -0
- package/dist/bin/shell/chunks/awk2-KO7ZE3P7.js +3 -0
- package/dist/bin/shell/chunks/base64-TQ5KOCNW.js +3 -0
- package/dist/bin/shell/chunks/basename-C4CRGDXP.js +3 -0
- package/dist/bin/shell/chunks/bash-CFCBBWVH.js +3 -0
- package/dist/bin/shell/chunks/cat-BQ7FQTN5.js +3 -0
- package/dist/bin/shell/chunks/chmod-WYYTXGVB.js +3 -0
- package/dist/bin/shell/chunks/chunk-23OI2XDJ.js +20 -0
- package/dist/bin/shell/chunks/chunk-2ETT4ELS.js +4 -0
- package/dist/bin/shell/chunks/chunk-2UV6ZFHK.js +4 -0
- package/dist/bin/shell/chunks/chunk-2YLY6FJA.js +10 -0
- package/dist/bin/shell/chunks/chunk-3FQBUEB6.js +3 -0
- package/dist/bin/shell/chunks/chunk-3MRB66F4.js +3 -0
- package/dist/bin/shell/chunks/chunk-3PCPQIUD.js +3 -0
- package/dist/bin/shell/chunks/chunk-42AMF6EE.js +3 -0
- package/dist/bin/shell/chunks/chunk-43E7AR6A.js +3 -0
- package/dist/bin/shell/chunks/chunk-45DUHCXR.js +7 -0
- package/dist/bin/shell/chunks/chunk-472JZJ2D.js +22 -0
- package/dist/bin/shell/chunks/chunk-47IFMQYS.js +3 -0
- package/dist/bin/shell/chunks/chunk-4JF56A3P.js +15 -0
- package/dist/bin/shell/chunks/chunk-5SKEZPTU.js +12 -0
- package/dist/bin/shell/chunks/chunk-67XYNGRV.js +9 -0
- package/dist/bin/shell/chunks/chunk-6ESRNSO7.js +7 -0
- package/dist/bin/shell/chunks/chunk-6KHZX4HU.js +12 -0
- package/dist/bin/shell/chunks/chunk-7FGDUBSN.js +14 -0
- package/dist/bin/shell/chunks/chunk-7JZKVC3F.js +2 -0
- package/dist/bin/shell/chunks/chunk-7PPAWLUI.js +12 -0
- package/dist/bin/shell/chunks/chunk-7PUOS2OO.js +143 -0
- package/dist/bin/shell/chunks/chunk-7VWOECJ3.js +101 -0
- package/dist/bin/shell/chunks/chunk-7WBCA2BB.js +3 -0
- package/dist/bin/shell/chunks/chunk-AGKL4LDL.js +4 -0
- package/dist/bin/shell/chunks/chunk-AI7JUA46.js +13 -0
- package/dist/bin/shell/chunks/chunk-AJF3OBTR.js +4 -0
- package/dist/bin/shell/chunks/chunk-B2DRBHGQ.js +3 -0
- package/dist/bin/shell/chunks/chunk-B2GCIQI2.js +16 -0
- package/dist/bin/shell/chunks/chunk-B6WWC6K3.js +9 -0
- package/dist/bin/shell/chunks/chunk-BIJXTWZ4.js +3 -0
- package/dist/bin/shell/chunks/chunk-CC2AQ6B7.js +15 -0
- package/dist/bin/shell/chunks/chunk-CL7IYCGG.js +20 -0
- package/dist/bin/shell/chunks/chunk-CMTQFWZK.js +5 -0
- package/dist/bin/shell/chunks/chunk-CPKBPQ2C.js +3 -0
- package/dist/bin/shell/chunks/chunk-DJAX3ZRG.js +8 -0
- package/dist/bin/shell/chunks/chunk-DN2YCFOR.js +3 -0
- package/dist/bin/shell/chunks/chunk-DYIBFLS3.js +17 -0
- package/dist/bin/shell/chunks/chunk-DZAFUADN.js +36 -0
- package/dist/bin/shell/chunks/chunk-F3UDTTI7.js +13 -0
- package/dist/bin/shell/chunks/chunk-FHMIEBRM.js +6 -0
- package/dist/bin/shell/chunks/chunk-FONAGXRJ.js +17 -0
- package/dist/bin/shell/chunks/chunk-FPWHWWXO.js +8 -0
- package/dist/bin/shell/chunks/chunk-FUT3X2GJ.js +9 -0
- package/dist/bin/shell/chunks/chunk-G4AUMZUY.js +4 -0
- package/dist/bin/shell/chunks/chunk-GA5TPRMF.js +34 -0
- package/dist/bin/shell/chunks/chunk-GOWX7VPU.js +7 -0
- package/dist/bin/shell/chunks/chunk-GQKQEK5N.js +11 -0
- package/dist/bin/shell/chunks/chunk-GR4ZHKXI.js +3 -0
- package/dist/bin/shell/chunks/chunk-HDWHYM2T.js +18 -0
- package/dist/bin/shell/chunks/chunk-HQ63MFHG.js +34 -0
- package/dist/bin/shell/chunks/chunk-HW2VJKFH.js +4 -0
- package/dist/bin/shell/chunks/chunk-HWI42GQO.js +7 -0
- package/dist/bin/shell/chunks/chunk-HZGHQZSY.js +10 -0
- package/dist/bin/shell/chunks/chunk-I4IRHQDW.js +3 -0
- package/dist/bin/shell/chunks/chunk-I57EACSL.js +3 -0
- package/dist/bin/shell/chunks/chunk-JELR4642.js +21 -0
- package/dist/bin/shell/chunks/chunk-JQM3DKCH.js +12 -0
- package/dist/bin/shell/chunks/chunk-K27FY3ES.js +3 -0
- package/dist/bin/shell/chunks/chunk-KG2KXL4Y.js +3 -0
- package/dist/bin/shell/chunks/chunk-KI54R2QB.js +3 -0
- package/dist/bin/shell/chunks/chunk-KP2UH5CJ.js +22 -0
- package/dist/bin/shell/chunks/chunk-KUMHQGUR.js +3 -0
- package/dist/bin/shell/chunks/chunk-LE2XKKGQ.js +7 -0
- package/dist/bin/shell/chunks/chunk-LJQIAFWS.js +5 -0
- package/dist/bin/shell/chunks/chunk-LXFMIXGA.js +3 -0
- package/dist/bin/shell/chunks/chunk-M7SIPZZZ.js +22 -0
- package/dist/bin/shell/chunks/chunk-MF3GVFLC.js +11 -0
- package/dist/bin/shell/chunks/chunk-MROECM42.js +3 -0
- package/dist/bin/shell/chunks/chunk-MUFNRCMY.js +24 -0
- package/dist/bin/shell/chunks/chunk-MVBK66TR.js +22 -0
- package/dist/bin/shell/chunks/chunk-MYTNZ7MA.js +7 -0
- package/dist/bin/shell/chunks/chunk-N26Y42L6.js +10 -0
- package/dist/bin/shell/chunks/chunk-NE4R2FVV.js +5 -0
- package/dist/bin/shell/chunks/chunk-NLU5LALY.js +37 -0
- package/dist/bin/shell/chunks/chunk-NXUXZWS5.js +7 -0
- package/dist/bin/shell/chunks/chunk-O2BCKSMK.js +3 -0
- package/dist/bin/shell/chunks/chunk-OLEQNRKX.js +8 -0
- package/dist/bin/shell/chunks/chunk-OUQKFRVR.js +6 -0
- package/dist/bin/shell/chunks/chunk-OXLC2WWX.js +26 -0
- package/dist/bin/shell/chunks/chunk-OYXHOZZ4.js +15 -0
- package/dist/bin/shell/chunks/chunk-PBOVSFTJ.js +3 -0
- package/dist/bin/shell/chunks/chunk-PPVF2N6C.js +3 -0
- package/dist/bin/shell/chunks/chunk-PQ2INDRF.js +87 -0
- package/dist/bin/shell/chunks/chunk-PXP4YYZA.js +13 -0
- package/dist/bin/shell/chunks/chunk-PZQVSQX6.js +4 -0
- package/dist/bin/shell/chunks/chunk-Q2GOPGDA.js +6 -0
- package/dist/bin/shell/chunks/chunk-Q3LE3Y66.js +13 -0
- package/dist/bin/shell/chunks/chunk-QES5OSUC.js +3 -0
- package/dist/bin/shell/chunks/chunk-QFTZKD5O.js +13 -0
- package/dist/bin/shell/chunks/chunk-QL33F2W6.js +8 -0
- package/dist/bin/shell/chunks/chunk-QMPZXXEK.js +8 -0
- package/dist/bin/shell/chunks/chunk-QYZN33JA.js +3 -0
- package/dist/bin/shell/chunks/chunk-R2J5MJOM.js +20 -0
- package/dist/bin/shell/chunks/chunk-RPUFEP5O.js +65 -0
- package/dist/bin/shell/chunks/chunk-RVPTAYDS.js +4 -0
- package/dist/bin/shell/chunks/chunk-SC5TEGMM.js +12 -0
- package/dist/bin/shell/chunks/chunk-SDGPS6XI.js +10 -0
- package/dist/bin/shell/chunks/chunk-TW2IJRUF.js +3 -0
- package/dist/bin/shell/chunks/chunk-TYBXHT6W.js +10 -0
- package/dist/bin/shell/chunks/chunk-V2XF3TTW.js +276 -0
- package/dist/bin/shell/chunks/chunk-V4U26ZWL.js +16 -0
- package/dist/bin/shell/chunks/chunk-VTAMGD42.js +3 -0
- package/dist/bin/shell/chunks/chunk-WAJVRK5B.js +16 -0
- package/dist/bin/shell/chunks/chunk-WEHA3JFD.js +3 -0
- package/dist/bin/shell/chunks/chunk-WFHYGSLJ.js +6 -0
- package/dist/bin/shell/chunks/chunk-WFVCEB5T.js +3 -0
- package/dist/bin/shell/chunks/chunk-YERKK5B3.js +4 -0
- package/dist/bin/shell/chunks/chunk-YIANER7Y.js +8 -0
- package/dist/bin/shell/chunks/chunk-YJ5OCPSK.js +7 -0
- package/dist/bin/shell/chunks/chunk-YOIFOOGX.js +9 -0
- package/dist/bin/shell/chunks/chunk-YQEKKZTU.js +12 -0
- package/dist/bin/shell/chunks/chunk-YUZRUF5F.js +10 -0
- package/dist/bin/shell/chunks/chunk-ZMGLTHSU.js +15 -0
- package/dist/bin/shell/chunks/clear-OE52K3TM.js +3 -0
- package/dist/bin/shell/chunks/column-AJFK3TWF.js +3 -0
- package/dist/bin/shell/chunks/comm-URDMZCXL.js +3 -0
- package/dist/bin/shell/chunks/cp-OMVKM35F.js +3 -0
- package/dist/bin/shell/chunks/curl-NHNZ46BU.js +31 -0
- package/dist/bin/shell/chunks/cut-42X6363P.js +3 -0
- package/dist/bin/shell/chunks/date-6MQGVWDY.js +3 -0
- package/dist/bin/shell/chunks/diff-YXZZCUSQ.js +3 -0
- package/dist/bin/shell/chunks/dirname-TPUFCYF6.js +3 -0
- package/dist/bin/shell/chunks/dist-5MWO25Y4.js +141 -0
- package/dist/bin/shell/chunks/du-LUFPVLNW.js +3 -0
- package/dist/bin/shell/chunks/echo-NYDCCFWB.js +3 -0
- package/dist/bin/shell/chunks/env-2TSVF4W7.js +3 -0
- package/dist/bin/shell/chunks/expand-IQRKKT7D.js +3 -0
- package/dist/bin/shell/chunks/expr-NNMDHOCN.js +3 -0
- package/dist/bin/shell/chunks/file-4T64QNLS.js +3 -0
- package/dist/bin/shell/chunks/find-AWH2KOY7.js +3 -0
- package/dist/bin/shell/chunks/flag-coverage-J2ZHA465.js +3 -0
- package/dist/bin/shell/chunks/fold-YEY7X54W.js +3 -0
- package/dist/bin/shell/chunks/grep-CVU5V66H.js +3 -0
- package/dist/bin/shell/chunks/gzip-FDPA6EKG.js +3 -0
- package/dist/bin/shell/chunks/head-QKVY3SIO.js +3 -0
- package/dist/bin/shell/chunks/help-HVIDHJ6M.js +3 -0
- package/dist/bin/shell/chunks/history-3HAU45KT.js +3 -0
- package/dist/bin/shell/chunks/hostname-2I76DUQL.js +3 -0
- package/dist/bin/shell/chunks/html-to-markdown-XUMA42ZC.js +3 -0
- package/dist/bin/shell/chunks/join-34DX7YK5.js +3 -0
- package/dist/bin/shell/chunks/jq-V7OTAVU5.js +3 -0
- package/dist/bin/shell/chunks/js-exec-DJQLXWCS.js +99 -0
- package/dist/bin/shell/chunks/ln-B35EKC2Q.js +3 -0
- package/dist/bin/shell/chunks/ls-Q6ZZ6SQ2.js +3 -0
- package/dist/bin/shell/chunks/md5sum-Z6KAYGDK.js +3 -0
- package/dist/bin/shell/chunks/mkdir-74BP5NTG.js +3 -0
- package/dist/bin/shell/chunks/mv-76LAHXFR.js +3 -0
- package/dist/bin/shell/chunks/nl-4IZRRT7U.js +3 -0
- package/dist/bin/shell/chunks/od-2GXD4D5K.js +3 -0
- package/dist/bin/shell/chunks/paste-DWWA3JTW.js +3 -0
- package/dist/bin/shell/chunks/printf-YXCSED2H.js +3 -0
- package/dist/bin/shell/chunks/pwd-YKLNXWZI.js +3 -0
- package/dist/bin/shell/chunks/python3-JCJHSX4Z.js +14 -0
- package/dist/bin/shell/chunks/readlink-EHXJNW62.js +3 -0
- package/dist/bin/shell/chunks/rev-CZTQCNOZ.js +3 -0
- package/dist/bin/shell/chunks/rg-PXNKNIMY.js +3 -0
- package/dist/bin/shell/chunks/rm-3PLW4O4B.js +3 -0
- package/dist/bin/shell/chunks/rmdir-7ZIVFZJX.js +3 -0
- package/dist/bin/shell/chunks/sed-4LVDFHIJ.js +3 -0
- package/dist/bin/shell/chunks/seq-X2EAOGV5.js +3 -0
- package/dist/bin/shell/chunks/sha1sum-CATBXX76.js +3 -0
- package/dist/bin/shell/chunks/sha256sum-YGSNBVY3.js +3 -0
- package/dist/bin/shell/chunks/sleep-DVFE2GSF.js +3 -0
- package/dist/bin/shell/chunks/sort-HBOCBBJQ.js +3 -0
- package/dist/bin/shell/chunks/split-ZNNNHKSP.js +3 -0
- package/dist/bin/shell/chunks/sqlite3-KP42NNIY.js +3 -0
- package/dist/bin/shell/chunks/stat-LROLDXHH.js +3 -0
- package/dist/bin/shell/chunks/strings-CNUK76JL.js +3 -0
- package/dist/bin/shell/chunks/tac-DG4BMYM5.js +3 -0
- package/dist/bin/shell/chunks/tail-UOTUV25D.js +3 -0
- package/dist/bin/shell/chunks/tar-7HGZIMZD.js +3 -0
- package/dist/bin/shell/chunks/tee-L4HKV5PD.js +3 -0
- package/dist/bin/shell/chunks/time-LF7BTSK5.js +3 -0
- package/dist/bin/shell/chunks/timeout-YGFHQJKX.js +3 -0
- package/dist/bin/shell/chunks/touch-TVQAUQOG.js +3 -0
- package/dist/bin/shell/chunks/tr-PVFO6FRY.js +3 -0
- package/dist/bin/shell/chunks/tree-ZGP6NPGS.js +3 -0
- package/dist/bin/shell/chunks/true-KFTJGQLQ.js +3 -0
- package/dist/bin/shell/chunks/unexpand-JPOQORZF.js +3 -0
- package/dist/bin/shell/chunks/uniq-JMHDIJXT.js +3 -0
- package/dist/bin/shell/chunks/wc-3KLVOCI2.js +3 -0
- package/dist/bin/shell/chunks/which-4TPGVSBZ.js +3 -0
- package/dist/bin/shell/chunks/whoami-B5HDVKW6.js +3 -0
- package/dist/bin/shell/chunks/xan-WW53ETXT.js +3 -0
- package/dist/bin/shell/chunks/xan-view-PD26QEFN.js +3 -0
- package/dist/bin/shell/chunks/xargs-4AMMXFXL.js +3 -0
- package/dist/bin/shell/chunks/yq-MYZOS2WN.js +3 -0
- package/dist/bin/shell/shell.js +834 -0
- package/dist/bounded-builder.d.ts +37 -0
- package/dist/browser.d.ts +23 -0
- package/dist/bundle/browser.js +1576 -0
- package/dist/bundle/chunks/alias-T5TO5GWK.js +2 -0
- package/dist/bundle/chunks/awk2-W6BNZEJN.js +2 -0
- package/dist/bundle/chunks/base64-MHVQ5XHI.js +2 -0
- package/dist/bundle/chunks/basename-SJZQ5W65.js +2 -0
- package/dist/bundle/chunks/bash-HIEWVHJ2.js +2 -0
- package/dist/bundle/chunks/cat-VZBWBIJB.js +2 -0
- package/dist/bundle/chunks/chmod-WM2JFFQC.js +2 -0
- package/dist/bundle/chunks/chunk-24NLAR7R.js +36 -0
- package/dist/bundle/chunks/chunk-26GP3ACY.js +12 -0
- package/dist/bundle/chunks/chunk-2KNTH3KH.js +9 -0
- package/dist/bundle/chunks/chunk-2SMD2AUA.js +3 -0
- package/dist/bundle/chunks/chunk-2TSZPVPI.js +21 -0
- package/dist/bundle/chunks/chunk-2VWG4LDT.js +11 -0
- package/dist/bundle/chunks/chunk-3WASQYTF.js +11 -0
- package/dist/bundle/chunks/chunk-44YCJWNC.js +6 -0
- package/dist/bundle/chunks/chunk-4EDQZIAN.js +5 -0
- package/dist/bundle/chunks/chunk-4MJ7VJG4.js +21 -0
- package/dist/bundle/chunks/chunk-4MZPEZTU.js +3 -0
- package/dist/bundle/chunks/chunk-57LGFT4S.js +3 -0
- package/dist/bundle/chunks/chunk-5I5U6IYI.js +142 -0
- package/dist/bundle/chunks/chunk-6DDRR56B.js +33 -0
- package/dist/bundle/chunks/chunk-6QF3PCMO.js +8 -0
- package/dist/bundle/chunks/chunk-6RK4AAB7.js +21 -0
- package/dist/bundle/chunks/chunk-6WGIZV3E.js +13 -0
- package/dist/bundle/chunks/chunk-73JQKNZT.js +33 -0
- package/dist/bundle/chunks/chunk-7AISL3XV.js +12 -0
- package/dist/bundle/chunks/chunk-7EUWTCWK.js +2 -0
- package/dist/bundle/chunks/chunk-7IJWBG4I.js +2 -0
- package/dist/bundle/chunks/chunk-7O2RDO2R.js +14 -0
- package/dist/bundle/chunks/chunk-A4R2GWRF.js +9 -0
- package/dist/bundle/chunks/chunk-AGH5UJJI.js +4 -0
- package/dist/bundle/chunks/chunk-ANCQ4SCV.js +2 -0
- package/dist/bundle/chunks/chunk-ASE6AYV3.js +17 -0
- package/dist/bundle/chunks/chunk-AYSZ5MAE.js +2 -0
- package/dist/bundle/chunks/chunk-BKUWXPEM.js +2 -0
- package/dist/bundle/chunks/chunk-BRJERIF4.js +2 -0
- package/dist/bundle/chunks/chunk-DAKEIWT3.js +21 -0
- package/dist/bundle/chunks/chunk-DLL7UR66.js +2 -0
- package/dist/bundle/chunks/chunk-DMWNBCXJ.js +10 -0
- package/dist/bundle/chunks/chunk-DVSA72LH.js +2 -0
- package/dist/bundle/chunks/chunk-EJFBIRMD.js +6 -0
- package/dist/bundle/chunks/chunk-EZNS4GF7.js +9 -0
- package/dist/bundle/chunks/chunk-F6XU52K3.js +35 -0
- package/dist/bundle/chunks/chunk-FHC24QSK.js +7 -0
- package/dist/bundle/chunks/chunk-FIMF2TLE.js +20 -0
- package/dist/bundle/chunks/chunk-FOCWZZDE.js +2 -0
- package/dist/bundle/chunks/chunk-FQUVK4Q5.js +11 -0
- package/dist/bundle/chunks/chunk-FSJ6TTCC.js +19 -0
- package/dist/bundle/chunks/chunk-FT6ODGOU.js +2 -0
- package/dist/bundle/chunks/chunk-FTET43KM.js +2 -0
- package/dist/bundle/chunks/chunk-FX4RBUYU.js +5 -0
- package/dist/bundle/chunks/chunk-FZRQOL3C.js +7 -0
- package/dist/bundle/chunks/chunk-FZZL53S2.js +275 -0
- package/dist/bundle/chunks/chunk-GN6CQ3J4.js +2 -0
- package/dist/bundle/chunks/chunk-HDRAUQK2.js +2 -0
- package/dist/bundle/chunks/chunk-HP7HWZ2S.js +15 -0
- package/dist/bundle/chunks/chunk-HRIJVWZS.js +14 -0
- package/dist/bundle/chunks/chunk-HXWB4Z5X.js +7 -0
- package/dist/bundle/chunks/chunk-ICLA3MUR.js +3 -0
- package/dist/bundle/chunks/chunk-IXFQXNL4.js +7 -0
- package/dist/bundle/chunks/chunk-KIGPB52X.js +2 -0
- package/dist/bundle/chunks/chunk-L2UW7DWF.js +2 -0
- package/dist/bundle/chunks/chunk-LI6PTSPD.js +9 -0
- package/dist/bundle/chunks/chunk-LPJEKUCB.js +8 -0
- package/dist/bundle/chunks/chunk-LSLPJOYM.js +3 -0
- package/dist/bundle/chunks/chunk-LVDUF74R.js +7 -0
- package/dist/bundle/chunks/chunk-MLIO3BK2.js +7 -0
- package/dist/bundle/chunks/chunk-MQKGGNPS.js +16 -0
- package/dist/bundle/chunks/chunk-N3A4JVFJ.js +2 -0
- package/dist/bundle/chunks/chunk-NBNI7G66.js +8 -0
- package/dist/bundle/chunks/chunk-NCUTH6QL.js +2 -0
- package/dist/bundle/chunks/chunk-OQ7C4FYO.js +2 -0
- package/dist/bundle/chunks/chunk-P57S6Z6R.js +6 -0
- package/dist/bundle/chunks/chunk-PCPW54JH.js +7 -0
- package/dist/bundle/chunks/chunk-PJM5C3HZ.js +25 -0
- package/dist/bundle/chunks/chunk-PPEXVPHR.js +19 -0
- package/dist/bundle/chunks/chunk-Q4JSJ3KQ.js +4 -0
- package/dist/bundle/chunks/chunk-QAYAQNCG.js +23 -0
- package/dist/bundle/chunks/chunk-QHDBQA5N.js +9 -0
- package/dist/bundle/chunks/chunk-QIQMJJZ4.js +4 -0
- package/dist/bundle/chunks/chunk-QJ7OXJAZ.js +6 -0
- package/dist/bundle/chunks/chunk-QJFYYEFV.js +11 -0
- package/dist/bundle/chunks/chunk-R2FBRMDU.js +14 -0
- package/dist/bundle/chunks/chunk-ROAWFE6V.js +5 -0
- package/dist/bundle/chunks/chunk-RPKJJFGZ.js +14 -0
- package/dist/bundle/chunks/chunk-S3ENGQML.js +15 -0
- package/dist/bundle/chunks/chunk-SBBYKIYU.js +3 -0
- package/dist/bundle/chunks/chunk-SGX4WOAM.js +2 -0
- package/dist/bundle/chunks/chunk-SHKOQWO4.js +3 -0
- package/dist/bundle/chunks/chunk-SIOONII3.js +2 -0
- package/dist/bundle/chunks/chunk-STHBFACM.js +1 -0
- package/dist/bundle/chunks/chunk-SX2HC7SO.js +2 -0
- package/dist/bundle/chunks/chunk-T6DNSPYO.js +100 -0
- package/dist/bundle/chunks/chunk-TBVD66LC.js +10 -0
- package/dist/bundle/chunks/chunk-TDD4NFYE.js +2 -0
- package/dist/bundle/chunks/chunk-TVCZIH6M.js +8 -0
- package/dist/bundle/chunks/chunk-U4K5ZDWK.js +9 -0
- package/dist/bundle/chunks/chunk-UC76ZOWM.js +15 -0
- package/dist/bundle/chunks/chunk-UIJUTQPH.js +3 -0
- package/dist/bundle/chunks/chunk-ULXTDFQC.js +2 -0
- package/dist/bundle/chunks/chunk-UTKGYVUZ.js +7 -0
- package/dist/bundle/chunks/chunk-UUIYAOD4.js +2 -0
- package/dist/bundle/chunks/chunk-VJ6UXG2R.js +64 -0
- package/dist/bundle/chunks/chunk-W2Z6LYL6.js +11 -0
- package/dist/bundle/chunks/chunk-W5DWRFSU.js +2 -0
- package/dist/bundle/chunks/chunk-WN54B5NQ.js +12 -0
- package/dist/bundle/chunks/chunk-WNH3HOQA.js +2 -0
- package/dist/bundle/chunks/chunk-WXPNKIIH.js +2 -0
- package/dist/bundle/chunks/chunk-WZQNMEQW.js +2 -0
- package/dist/bundle/chunks/chunk-XV2V56NQ.js +12 -0
- package/dist/bundle/chunks/chunk-XVSR5HHH.js +6 -0
- package/dist/bundle/chunks/chunk-XXBIOG4R.js +5 -0
- package/dist/bundle/chunks/chunk-Y62SXZKJ.js +12 -0
- package/dist/bundle/chunks/chunk-YEYSCLSJ.js +3 -0
- package/dist/bundle/chunks/chunk-YJKHREBZ.js +11 -0
- package/dist/bundle/chunks/chunk-YUSFCOM7.js +2 -0
- package/dist/bundle/chunks/chunk-ZBUZKIPX.js +6 -0
- package/dist/bundle/chunks/chunk-ZDPFA4L3.js +6 -0
- package/dist/bundle/chunks/chunk-ZT3WF5R7.js +16 -0
- package/dist/bundle/chunks/chunk-ZXFELXJH.js +6 -0
- package/dist/bundle/chunks/clear-KPIUNI6K.js +2 -0
- package/dist/bundle/chunks/column-QJI65SH2.js +2 -0
- package/dist/bundle/chunks/comm-DTWKU2MC.js +2 -0
- package/dist/bundle/chunks/cp-2KZIPZJS.js +2 -0
- package/dist/bundle/chunks/curl-K4WT7UPN.js +30 -0
- package/dist/bundle/chunks/cut-FMDNVWQN.js +2 -0
- package/dist/bundle/chunks/date-7OEDRA27.js +2 -0
- package/dist/bundle/chunks/diff-CSARC7WF.js +2 -0
- package/dist/bundle/chunks/dirname-Z2ZMOOW2.js +2 -0
- package/dist/bundle/chunks/du-7AZCLKR6.js +2 -0
- package/dist/bundle/chunks/echo-PLLZYM2L.js +2 -0
- package/dist/bundle/chunks/env-VUUMB47B.js +2 -0
- package/dist/bundle/chunks/expand-J3VOSOMK.js +2 -0
- package/dist/bundle/chunks/expr-XSBELPAC.js +2 -0
- package/dist/bundle/chunks/file-URNAD6FQ.js +2 -0
- package/dist/bundle/chunks/find-END3EAHV.js +2 -0
- package/dist/bundle/chunks/flag-coverage-DPSAPFXA.js +2 -0
- package/dist/bundle/chunks/fold-QJBPHRFJ.js +2 -0
- package/dist/bundle/chunks/grep-4AYF3A5J.js +2 -0
- package/dist/bundle/chunks/gzip-RQOBR22H.js +2 -0
- package/dist/bundle/chunks/head-6UIPFWVJ.js +2 -0
- package/dist/bundle/chunks/help-QDDMBDU7.js +2 -0
- package/dist/bundle/chunks/history-3N762S3K.js +2 -0
- package/dist/bundle/chunks/hostname-CESD3CQR.js +2 -0
- package/dist/bundle/chunks/html-to-markdown-PE6BPRPA.js +2 -0
- package/dist/bundle/chunks/join-C2B6NGXH.js +2 -0
- package/dist/bundle/chunks/jq-NY7PCVMH.js +2 -0
- package/dist/bundle/chunks/js-exec-XKF2B7C3.js +98 -0
- package/dist/bundle/chunks/js-exec-worker.js +4809 -0
- package/dist/bundle/chunks/ln-OPY2ZVGQ.js +2 -0
- package/dist/bundle/chunks/ls-ZPXGZX63.js +2 -0
- package/dist/bundle/chunks/md5sum-JEDX55KS.js +2 -0
- package/dist/bundle/chunks/mkdir-WDDKK2P3.js +2 -0
- package/dist/bundle/chunks/mv-ZF6UBVRB.js +2 -0
- package/dist/bundle/chunks/nl-IELOWYJG.js +2 -0
- package/dist/bundle/chunks/od-Z4AIL3P4.js +2 -0
- package/dist/bundle/chunks/paste-ZNHNSRBW.js +2 -0
- package/dist/bundle/chunks/printf-B2NSYQ3N.js +2 -0
- package/dist/bundle/chunks/pwd-76BPYV5F.js +2 -0
- package/dist/bundle/chunks/python3-F5S5TYGS.js +13 -0
- package/dist/bundle/chunks/readlink-U5OM5A3M.js +2 -0
- package/dist/bundle/chunks/rev-EPOS3MFH.js +2 -0
- package/dist/bundle/chunks/rg-NAMXBYKS.js +2 -0
- package/dist/bundle/chunks/rm-JQ4GDKDD.js +2 -0
- package/dist/bundle/chunks/rmdir-YJKPQVCK.js +2 -0
- package/dist/bundle/chunks/sed-LIRH26EA.js +2 -0
- package/dist/bundle/chunks/seq-B6KDLMYQ.js +2 -0
- package/dist/bundle/chunks/sha1sum-BLPZJ6MP.js +2 -0
- package/dist/bundle/chunks/sha256sum-VJZ4PHQ4.js +2 -0
- package/dist/bundle/chunks/sleep-PPRBTSVR.js +2 -0
- package/dist/bundle/chunks/sort-CB5GO7XH.js +2 -0
- package/dist/bundle/chunks/split-JICLAMP6.js +2 -0
- package/dist/bundle/chunks/sqlite3-4EZ4GXVD.js +2 -0
- package/dist/bundle/chunks/sqlite3-worker.js +1928 -0
- package/dist/bundle/chunks/stat-LXFZND2P.js +2 -0
- package/dist/bundle/chunks/strings-VLFTYX2Z.js +2 -0
- package/dist/bundle/chunks/tac-YXC4HBTR.js +2 -0
- package/dist/bundle/chunks/tail-UBGSN4JF.js +2 -0
- package/dist/bundle/chunks/tar-B72KU357.js +2 -0
- package/dist/bundle/chunks/tee-OOWSWHRQ.js +2 -0
- package/dist/bundle/chunks/time-NERE2JJ2.js +2 -0
- package/dist/bundle/chunks/timeout-C6WDYPLV.js +2 -0
- package/dist/bundle/chunks/touch-W4DF6Z4T.js +2 -0
- package/dist/bundle/chunks/tr-UI2LA3GA.js +2 -0
- package/dist/bundle/chunks/tree-7OOL2MH6.js +2 -0
- package/dist/bundle/chunks/true-QUBPEGGU.js +2 -0
- package/dist/bundle/chunks/unexpand-YD5BWFH4.js +2 -0
- package/dist/bundle/chunks/uniq-PAEPA27E.js +2 -0
- package/dist/bundle/chunks/wc-7WVM7GV4.js +2 -0
- package/dist/bundle/chunks/which-UWVKETYW.js +2 -0
- package/dist/bundle/chunks/whoami-KR6E7UIR.js +2 -0
- package/dist/bundle/chunks/worker.js +3330 -0
- package/dist/bundle/chunks/xan-UIGVJCMA.js +2 -0
- package/dist/bundle/chunks/xan-view-FOCYCKZQ.js +2 -0
- package/dist/bundle/chunks/xargs-VQEXRD3C.js +2 -0
- package/dist/bundle/chunks/yq-FGNXZCGX.js +2 -0
- package/dist/bundle/index.cjs +2237 -0
- package/dist/bundle/index.js +809 -0
- package/dist/commands/alias/alias.d.ts +6 -0
- package/dist/commands/awk/ast.d.ts +202 -0
- package/dist/commands/awk/awk2.d.ts +9 -0
- package/dist/commands/awk/builtins.d.ts +17 -0
- package/dist/commands/awk/interpreter/context.d.ts +88 -0
- package/dist/commands/awk/interpreter/expressions.d.ts +17 -0
- package/dist/commands/awk/interpreter/fields.d.ts +25 -0
- package/dist/commands/awk/interpreter/index.d.ts +8 -0
- package/dist/commands/awk/interpreter/interpreter.d.ts +54 -0
- package/dist/commands/awk/interpreter/statements.d.ts +11 -0
- package/dist/commands/awk/interpreter/type-coercion.d.ts +32 -0
- package/dist/commands/awk/interpreter/types.d.ts +13 -0
- package/dist/commands/awk/interpreter/variables.d.ts +35 -0
- package/dist/commands/awk/lexer.d.ts +101 -0
- package/dist/commands/awk/parser2-print.d.ts +38 -0
- package/dist/commands/awk/parser2.d.ts +96 -0
- package/dist/commands/base64/base64.d.ts +7 -0
- package/dist/commands/basename/basename.d.ts +4 -0
- package/dist/commands/bash/bash.d.ts +6 -0
- package/dist/commands/browser-excluded.d.ts +16 -0
- package/dist/commands/cat/cat.d.ts +4 -0
- package/dist/commands/chmod/chmod.d.ts +4 -0
- package/dist/commands/clear/clear.d.ts +4 -0
- package/dist/commands/column/column.d.ts +11 -0
- package/dist/commands/comm/comm.d.ts +12 -0
- package/dist/commands/compression/codec-budget.d.ts +35 -0
- package/dist/commands/cp/cp.d.ts +4 -0
- package/dist/commands/curl/curl.d.ts +8 -0
- package/dist/commands/curl/form.d.ts +23 -0
- package/dist/commands/curl/help.d.ts +9 -0
- package/dist/commands/curl/parse.d.ts +9 -0
- package/dist/commands/curl/response-formatting.d.ts +20 -0
- package/dist/commands/curl/types.d.ts +70 -0
- package/dist/commands/cut/cut.d.ts +4 -0
- package/dist/commands/date/date.d.ts +7 -0
- package/dist/commands/diff/diff.d.ts +7 -0
- package/dist/commands/dirname/dirname.d.ts +4 -0
- package/dist/commands/du/du.d.ts +4 -0
- package/dist/commands/duration.d.ts +5 -0
- package/dist/commands/echo/echo.d.ts +4 -0
- package/dist/commands/env/env.d.ts +6 -0
- package/dist/commands/expand/expand.d.ts +12 -0
- package/dist/commands/expand/unexpand.d.ts +12 -0
- package/dist/commands/expr/expr.d.ts +9 -0
- package/dist/commands/file/file.d.ts +9 -0
- package/dist/commands/find/find.d.ts +4 -0
- package/dist/commands/find/matcher.d.ts +53 -0
- package/dist/commands/find/parser.d.ts +2 -0
- package/dist/commands/find/types.d.ts +89 -0
- package/dist/commands/flag-coverage.d.ts +2 -0
- package/dist/commands/fold/fold.d.ts +12 -0
- package/dist/commands/format-mode.d.ts +4 -0
- package/dist/commands/fuzz-flags-types.d.ts +17 -0
- package/dist/commands/fuzz-flags.d.ts +8 -0
- package/dist/commands/grep/grep.d.ts +8 -0
- package/dist/commands/gzip/gzip.d.ts +13 -0
- package/dist/commands/head/head-tail-shared.d.ts +38 -0
- package/dist/commands/head/head.d.ts +4 -0
- package/dist/commands/help/help.d.ts +4 -0
- package/dist/commands/help.d.ts +16 -0
- package/dist/commands/history/history.d.ts +4 -0
- package/dist/commands/hostname/hostname.d.ts +11 -0
- package/dist/commands/html-to-markdown/html-to-markdown.d.ts +9 -0
- package/dist/commands/join/join.d.ts +12 -0
- package/dist/commands/jq/jq.d.ts +9 -0
- package/dist/commands/js-exec/fetch-polyfill.d.ts +6 -0
- package/dist/commands/js-exec/js-exec-worker.d.ts +33 -0
- package/dist/commands/js-exec/js-exec.d.ts +13 -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/ln/ln.d.ts +4 -0
- package/dist/commands/ls/ls.d.ts +4 -0
- package/dist/commands/md5sum/checksum.d.ts +7 -0
- package/dist/commands/md5sum/md5sum.d.ts +4 -0
- package/dist/commands/md5sum/sha1sum.d.ts +4 -0
- package/dist/commands/md5sum/sha256sum.d.ts +4 -0
- package/dist/commands/mkdir/mkdir.d.ts +4 -0
- package/dist/commands/mv/mv.d.ts +4 -0
- package/dist/commands/nl/nl.d.ts +12 -0
- package/dist/commands/od/od.d.ts +12 -0
- package/dist/commands/paste/paste.d.ts +4 -0
- package/dist/commands/printf/escapes.d.ts +27 -0
- package/dist/commands/printf/printf.d.ts +4 -0
- package/dist/commands/printf/strftime.d.ts +14 -0
- package/dist/commands/pwd/pwd.d.ts +4 -0
- package/dist/commands/python3/python3.d.ts +16 -0
- package/dist/commands/python3/worker.d.ts +31 -0
- package/dist/commands/query-engine/builtins/array-builtins.d.ts +20 -0
- package/dist/commands/query-engine/builtins/control-builtins.d.ts +18 -0
- package/dist/commands/query-engine/builtins/date-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/format-builtins.d.ts +11 -0
- package/dist/commands/query-engine/builtins/index-builtins.d.ts +16 -0
- package/dist/commands/query-engine/builtins/index.d.ts +17 -0
- package/dist/commands/query-engine/builtins/math-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/navigation-builtins.d.ts +18 -0
- package/dist/commands/query-engine/builtins/object-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/path-builtins.d.ts +20 -0
- package/dist/commands/query-engine/builtins/sql-builtins.d.ts +16 -0
- package/dist/commands/query-engine/builtins/string-builtins.d.ts +15 -0
- package/dist/commands/query-engine/builtins/type-builtins.d.ts +11 -0
- package/dist/commands/query-engine/evaluator.d.ts +62 -0
- package/dist/commands/query-engine/index.d.ts +8 -0
- package/dist/commands/query-engine/json-output.d.ts +11 -0
- package/dist/commands/query-engine/parser-types.d.ts +171 -0
- package/dist/commands/query-engine/parser.d.ts +14 -0
- package/dist/commands/query-engine/path-operations.d.ts +15 -0
- package/dist/commands/query-engine/safe-object.d.ts +84 -0
- package/dist/commands/query-engine/value-operations.d.ts +44 -0
- package/dist/commands/readlink/readlink.d.ts +4 -0
- package/dist/commands/registry.d.ts +56 -0
- package/dist/commands/rev/rev.d.ts +13 -0
- package/dist/commands/rg/file-types.d.ts +49 -0
- package/dist/commands/rg/gitignore.d.ts +98 -0
- package/dist/commands/rg/rg-options.d.ts +61 -0
- package/dist/commands/rg/rg-parser.d.ts +20 -0
- package/dist/commands/rg/rg-search.d.ts +15 -0
- package/dist/commands/rg/rg.d.ts +14 -0
- package/dist/commands/rm/rm.d.ts +4 -0
- package/dist/commands/rmdir/rmdir.d.ts +4 -0
- package/dist/commands/search-engine/index.d.ts +10 -0
- package/dist/commands/search-engine/matcher.d.ts +72 -0
- package/dist/commands/search-engine/regex.d.ts +46 -0
- package/dist/commands/sed/executor.d.ts +7 -0
- package/dist/commands/sed/lexer.d.ts +88 -0
- package/dist/commands/sed/parser.d.ts +21 -0
- package/dist/commands/sed/sed-regex.d.ts +23 -0
- package/dist/commands/sed/sed.d.ts +4 -0
- package/dist/commands/sed/types.d.ts +216 -0
- package/dist/commands/seq/seq.d.ts +16 -0
- package/dist/commands/sleep/sleep.d.ts +4 -0
- package/dist/commands/sort/comparator.d.ts +9 -0
- package/dist/commands/sort/parser.d.ts +11 -0
- package/dist/commands/sort/sort.d.ts +4 -0
- package/dist/commands/sort/types.d.ts +30 -0
- package/dist/commands/split/split.d.ts +12 -0
- package/dist/commands/sqlite3/formatters.d.ts +17 -0
- package/dist/commands/sqlite3/sqlite3.d.ts +24 -0
- package/dist/commands/sqlite3/worker.d.ts +50 -0
- package/dist/commands/sqlite3/worker.js +1928 -0
- package/dist/commands/stat/stat.d.ts +4 -0
- package/dist/commands/strings/strings.d.ts +12 -0
- package/dist/commands/tac/tac.d.ts +11 -0
- package/dist/commands/tail/tail.d.ts +4 -0
- package/dist/commands/tar/archive.d.ts +150 -0
- package/dist/commands/tar/bzip2-compress.d.ts +18 -0
- package/dist/commands/tar/tar-options.d.ts +37 -0
- package/dist/commands/tar/tar.d.ts +10 -0
- package/dist/commands/tee/tee.d.ts +4 -0
- package/dist/commands/time/time.d.ts +27 -0
- package/dist/commands/timeout/timeout.d.ts +4 -0
- package/dist/commands/touch/touch.d.ts +4 -0
- package/dist/commands/tr/tr.d.ts +4 -0
- package/dist/commands/tree/tree.d.ts +4 -0
- package/dist/commands/true/true.d.ts +6 -0
- package/dist/commands/uniq/uniq.d.ts +4 -0
- package/dist/commands/wc/wc.d.ts +4 -0
- package/dist/commands/which/which.d.ts +4 -0
- package/dist/commands/whoami/whoami.d.ts +11 -0
- package/dist/commands/worker-bridge/bridge-handler.d.ts +73 -0
- package/dist/commands/worker-bridge/protocol.d.ts +141 -0
- package/dist/commands/worker-bridge/sync-backend.d.ts +86 -0
- package/dist/commands/worker-request-controller.d.ts +36 -0
- package/dist/commands/xan/aggregation.d.ts +30 -0
- package/dist/commands/xan/bounded-output.d.ts +4 -0
- package/dist/commands/xan/column-selection.d.ts +20 -0
- package/dist/commands/xan/csv.d.ts +62 -0
- package/dist/commands/xan/moonblade-parser.d.ts +89 -0
- package/dist/commands/xan/moonblade-to-jq.d.ts +12 -0
- package/dist/commands/xan/moonblade-tokenizer.d.ts +32 -0
- package/dist/commands/xan/subcommands.d.ts +15 -0
- package/dist/commands/xan/xan-agg.d.ts +8 -0
- package/dist/commands/xan/xan-columns.d.ts +8 -0
- package/dist/commands/xan/xan-core.d.ts +10 -0
- package/dist/commands/xan/xan-data.d.ts +52 -0
- package/dist/commands/xan/xan-filter.d.ts +8 -0
- package/dist/commands/xan/xan-map.d.ts +11 -0
- package/dist/commands/xan/xan-reshape.d.ts +40 -0
- package/dist/commands/xan/xan-simple.d.ts +40 -0
- package/dist/commands/xan/xan-view.d.ts +12 -0
- package/dist/commands/xan/xan.d.ts +10 -0
- package/dist/commands/xargs/xargs.d.ts +4 -0
- package/dist/commands/yq/formats.d.ts +65 -0
- package/dist/commands/yq/yq.d.ts +13 -0
- package/dist/custom-commands.d.ts +65 -0
- package/dist/encoding.d.ts +131 -0
- package/dist/execution-output.d.ts +28 -0
- package/dist/execution-scope.d.ts +110 -0
- package/dist/fatal-execution-error.d.ts +27 -0
- package/dist/fs/encoding.d.ts +17 -0
- package/dist/fs/identity.d.ts +9 -0
- package/dist/fs/in-memory-fs/in-memory-fs.d.ts +98 -0
- package/dist/fs/in-memory-fs/index.d.ts +1 -0
- package/dist/fs/init.d.ts +22 -0
- package/dist/fs/interface.d.ts +255 -0
- package/dist/fs/mountable-fs/index.d.ts +1 -0
- package/dist/fs/mountable-fs/mountable-fs.d.ts +118 -0
- package/dist/fs/overlay-fs/apply.d.ts +22 -0
- package/dist/fs/overlay-fs/index.d.ts +1 -0
- package/dist/fs/overlay-fs/overlay-fs.d.ts +360 -0
- package/dist/fs/overlay-fs/overlay-tree.d.ts +188 -0
- package/dist/fs/path-utils.d.ts +48 -0
- package/dist/fs/read-write-fs/index.d.ts +1 -0
- package/dist/fs/read-write-fs/read-write-fs.d.ts +150 -0
- package/dist/fs/real-fs-utils.d.ts +90 -0
- package/dist/fs/sanitize-error.d.ts +19 -0
- package/dist/fs/traversal.d.ts +98 -0
- package/dist/index.d.cts +30 -0
- package/dist/index.d.ts +30 -0
- package/dist/interpreter/alias-expansion.d.ts +27 -0
- package/dist/interpreter/arithmetic.d.ts +24 -0
- package/dist/interpreter/assignment-expansion.d.ts +24 -0
- package/dist/interpreter/builtin-dispatch.d.ts +46 -0
- package/dist/interpreter/builtins/break.d.ts +6 -0
- package/dist/interpreter/builtins/cd.d.ts +6 -0
- package/dist/interpreter/builtins/compgen.d.ts +26 -0
- package/dist/interpreter/builtins/complete.d.ts +17 -0
- package/dist/interpreter/builtins/compopt.d.ts +28 -0
- package/dist/interpreter/builtins/continue.d.ts +6 -0
- package/dist/interpreter/builtins/declare-array-parsing.d.ts +18 -0
- package/dist/interpreter/builtins/declare-print.d.ts +39 -0
- package/dist/interpreter/builtins/declare.d.ts +35 -0
- package/dist/interpreter/builtins/dirs.d.ts +29 -0
- package/dist/interpreter/builtins/eval.d.ts +15 -0
- package/dist/interpreter/builtins/exit.d.ts +5 -0
- package/dist/interpreter/builtins/export.d.ts +14 -0
- package/dist/interpreter/builtins/getopts.d.ts +18 -0
- package/dist/interpreter/builtins/hash.d.ts +19 -0
- package/dist/interpreter/builtins/help.d.ts +12 -0
- package/dist/interpreter/builtins/index.d.ts +44 -0
- package/dist/interpreter/builtins/let.d.ts +18 -0
- package/dist/interpreter/builtins/local.d.ts +6 -0
- package/dist/interpreter/builtins/mapfile.d.ts +17 -0
- package/dist/interpreter/builtins/read.d.ts +6 -0
- package/dist/interpreter/builtins/return.d.ts +6 -0
- package/dist/interpreter/builtins/set.d.ts +9 -0
- package/dist/interpreter/builtins/shift.d.ts +15 -0
- package/dist/interpreter/builtins/shopt.d.ts +7 -0
- package/dist/interpreter/builtins/source.d.ts +6 -0
- package/dist/interpreter/builtins/unset.d.ts +16 -0
- package/dist/interpreter/builtins/variable-assignment.d.ts +69 -0
- package/dist/interpreter/command-analysis.d.ts +30 -0
- package/dist/interpreter/command-resolution.d.ts +43 -0
- package/dist/interpreter/conditionals.d.ts +17 -0
- package/dist/interpreter/control-flow.d.ts +21 -0
- package/dist/interpreter/defense-aware-command-context.d.ts +6 -0
- package/dist/interpreter/errors.d.ts +161 -0
- package/dist/interpreter/expansion/analysis.d.ts +37 -0
- package/dist/interpreter/expansion/arith-text-expansion.d.ts +20 -0
- package/dist/interpreter/expansion/array-pattern-ops.d.ts +21 -0
- package/dist/interpreter/expansion/array-prefix-suffix.d.ts +46 -0
- package/dist/interpreter/expansion/array-slice-transform.d.ts +36 -0
- package/dist/interpreter/expansion/array-word-expansion.d.ts +39 -0
- package/dist/interpreter/expansion/brace-range.d.ts +24 -0
- package/dist/interpreter/expansion/command-substitution.d.ts +23 -0
- package/dist/interpreter/expansion/glob-escape.d.ts +32 -0
- package/dist/interpreter/expansion/indirect-expansion.d.ts +42 -0
- package/dist/interpreter/expansion/parameter-ops.d.ts +113 -0
- package/dist/interpreter/expansion/pattern-expansion.d.ts +23 -0
- package/dist/interpreter/expansion/pattern-removal.d.ts +17 -0
- package/dist/interpreter/expansion/pattern-replacement.d.ts +4 -0
- package/dist/interpreter/expansion/pattern.d.ts +23 -0
- package/dist/interpreter/expansion/positional-params.d.ts +59 -0
- package/dist/interpreter/expansion/prompt.d.ts +39 -0
- package/dist/interpreter/expansion/quoting.d.ts +13 -0
- package/dist/interpreter/expansion/tilde.d.ts +14 -0
- package/dist/interpreter/expansion/unquoted-expansion.d.ts +76 -0
- package/dist/interpreter/expansion/variable-attrs.d.ts +19 -0
- package/dist/interpreter/expansion/variable.d.ts +36 -0
- package/dist/interpreter/expansion/word-glob-expansion.d.ts +33 -0
- package/dist/interpreter/expansion/word-split.d.ts +29 -0
- package/dist/interpreter/expansion.d.ts +53 -0
- package/dist/interpreter/fd-table.d.ts +130 -0
- package/dist/interpreter/functions.d.ts +14 -0
- package/dist/interpreter/helpers/array.d.ts +56 -0
- package/dist/interpreter/helpers/bounded-array.d.ts +2 -0
- package/dist/interpreter/helpers/condition.d.ts +19 -0
- package/dist/interpreter/helpers/errors.d.ts +8 -0
- package/dist/interpreter/helpers/file-tests.d.ts +33 -0
- package/dist/interpreter/helpers/ifs.d.ts +104 -0
- package/dist/interpreter/helpers/loop.d.ts +24 -0
- package/dist/interpreter/helpers/nameref.d.ts +65 -0
- package/dist/interpreter/helpers/numeric-compare.d.ts +13 -0
- package/dist/interpreter/helpers/quoting.d.ts +26 -0
- package/dist/interpreter/helpers/readonly.d.ts +45 -0
- package/dist/interpreter/helpers/regex.d.ts +8 -0
- package/dist/interpreter/helpers/result.d.ts +60 -0
- package/dist/interpreter/helpers/shell-constants.d.ts +41 -0
- package/dist/interpreter/helpers/shellopts.d.ts +28 -0
- package/dist/interpreter/helpers/string-compare.d.ts +24 -0
- package/dist/interpreter/helpers/string-tests.d.ts +13 -0
- package/dist/interpreter/helpers/variable-tests.d.ts +9 -0
- package/dist/interpreter/helpers/word-matching.d.ts +16 -0
- package/dist/interpreter/helpers/word-parts.d.ts +22 -0
- package/dist/interpreter/helpers/xtrace.d.ts +18 -0
- package/dist/interpreter/index.d.ts +3 -0
- package/dist/interpreter/interpreter.d.ts +82 -0
- package/dist/interpreter/numeric-fd-redirects.d.ts +8 -0
- package/dist/interpreter/pipeline-execution.d.ts +16 -0
- package/dist/interpreter/process-substitution.d.ts +62 -0
- package/dist/interpreter/redirections.d.ts +50 -0
- package/dist/interpreter/simple-command-assignments.d.ts +36 -0
- package/dist/interpreter/state-transaction.d.ts +7 -0
- package/dist/interpreter/subshell-group.d.ts +40 -0
- package/dist/interpreter/type-command.d.ts +37 -0
- package/dist/interpreter/types.d.ts +402 -0
- package/dist/limits.d.ts +111 -0
- package/dist/network/allow-list/shared.d.ts +49 -0
- package/dist/network/allow-list.d.ts +59 -0
- package/dist/network/dns-pin.d.ts +42 -0
- package/dist/network/fetch.d.ts +27 -0
- package/dist/network/index.d.ts +7 -0
- package/dist/network/types.d.ts +182 -0
- package/dist/parser/arithmetic-parser.d.ts +23 -0
- package/dist/parser/arithmetic-primaries.d.ts +45 -0
- package/dist/parser/command-parser.d.ts +10 -0
- package/dist/parser/compound-parser.d.ts +28 -0
- package/dist/parser/conditional-parser.d.ts +8 -0
- package/dist/parser/expansion-parser.d.ts +18 -0
- package/dist/parser/lexer.d.ts +195 -0
- package/dist/parser/parser-substitution.d.ts +85 -0
- package/dist/parser/parser.d.ts +152 -0
- package/dist/parser/types.d.ts +40 -0
- package/dist/parser/word-parser.d.ts +35 -0
- package/dist/sandbox/Command.d.ts +35 -0
- package/dist/sandbox/Sandbox.d.ts +121 -0
- package/dist/sandbox/index.d.ts +2 -0
- 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 +354 -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 +17 -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 +228 -0
- package/dist/shell-metadata.d.ts +25 -0
- package/dist/source-limit.d.ts +2 -0
- package/dist/timers.d.ts +16 -0
- package/dist/transform/pipeline.d.ts +8 -0
- package/dist/transform/plugins/command-collector.d.ts +8 -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 +319 -0
- package/dist/utils/args.d.ts +55 -0
- package/dist/utils/constants.d.ts +15 -0
- package/dist/utils/file-reader.d.ts +76 -0
- package/dist/utils/glob.d.ts +25 -0
- package/dist/vitest-setup.d.ts +1 -0
- package/package.json +136 -0
- package/vendor/cpython-emscripten/python.cjs +2 -0
- package/vendor/cpython-emscripten/python.wasm +0 -0
- package/vendor/cpython-emscripten/python313.zip +0 -0
|
@@ -0,0 +1,1928 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// src/commands/sqlite3/worker.ts
|
|
9
|
+
import { parentPort, workerData } from "node:worker_threads";
|
|
10
|
+
import initSqlJs from "sql.js";
|
|
11
|
+
|
|
12
|
+
// src/fs/sanitize-error.ts
|
|
13
|
+
function sanitizeWithUnixPrefixes(message, includeHostRuntimePrefixes, includeFileUrls) {
|
|
14
|
+
if (!message) return message;
|
|
15
|
+
let sanitized = message.replace(/\n\s+at\s.*/g, "");
|
|
16
|
+
if (includeFileUrls) {
|
|
17
|
+
sanitized = sanitized.replace(/\bfile:\/\/\/?[^\s'",)}\]:]+/g, "<path>");
|
|
18
|
+
}
|
|
19
|
+
sanitized = sanitized.replace(
|
|
20
|
+
includeHostRuntimePrefixes ? /(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap|workspace|root|srv|mnt|app))\b[^\s'",)}\]:]*/g : /(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap))\b[^\s'",)}\]:]*/g,
|
|
21
|
+
"<path>"
|
|
22
|
+
);
|
|
23
|
+
sanitized = sanitized.replace(/node:internal\/[^\s'",)}\]:]+/g, "<internal>");
|
|
24
|
+
sanitized = sanitized.replace(/[A-Z]:\\[^\s'",)}\]:]+/g, "<path>");
|
|
25
|
+
if (includeFileUrls) {
|
|
26
|
+
sanitized = sanitized.replace(/\\\\[^\s\\]+\\[^\s'",)}\]:]+/g, "<path>");
|
|
27
|
+
}
|
|
28
|
+
return sanitized;
|
|
29
|
+
}
|
|
30
|
+
function sanitizeErrorMessage(message) {
|
|
31
|
+
return sanitizeWithUnixPrefixes(message, false, false);
|
|
32
|
+
}
|
|
33
|
+
function sanitizeHostErrorMessage(message) {
|
|
34
|
+
return sanitizeWithUnixPrefixes(message, true, true);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/security/defense-in-depth-box.ts
|
|
38
|
+
import * as nodeAsyncHooks from "node:async_hooks";
|
|
39
|
+
import * as nodeModule from "node:module";
|
|
40
|
+
|
|
41
|
+
// src/security/blocked-globals.ts
|
|
42
|
+
var blockedGlobalViolationTypes;
|
|
43
|
+
function getBlockedGlobalViolationTypes() {
|
|
44
|
+
if (!blockedGlobalViolationTypes) getBlockedGlobals();
|
|
45
|
+
return blockedGlobalViolationTypes;
|
|
46
|
+
}
|
|
47
|
+
function getBlockedGlobals() {
|
|
48
|
+
const globals = [
|
|
49
|
+
// Direct code execution vectors
|
|
50
|
+
{
|
|
51
|
+
prop: "Function",
|
|
52
|
+
target: globalThis,
|
|
53
|
+
violationType: "function_constructor",
|
|
54
|
+
strategy: "throw",
|
|
55
|
+
reason: "Function constructor allows arbitrary code execution"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
prop: "eval",
|
|
59
|
+
target: globalThis,
|
|
60
|
+
violationType: "eval",
|
|
61
|
+
strategy: "throw",
|
|
62
|
+
reason: "eval() allows arbitrary code execution"
|
|
63
|
+
},
|
|
64
|
+
// Timer functions with string argument allow code execution
|
|
65
|
+
{
|
|
66
|
+
prop: "setTimeout",
|
|
67
|
+
target: globalThis,
|
|
68
|
+
violationType: "setTimeout",
|
|
69
|
+
strategy: "throw",
|
|
70
|
+
reason: "setTimeout with string argument allows code execution"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
prop: "setInterval",
|
|
74
|
+
target: globalThis,
|
|
75
|
+
violationType: "setInterval",
|
|
76
|
+
strategy: "throw",
|
|
77
|
+
reason: "setInterval with string argument allows code execution"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
prop: "setImmediate",
|
|
81
|
+
target: globalThis,
|
|
82
|
+
violationType: "setImmediate",
|
|
83
|
+
strategy: "throw",
|
|
84
|
+
reason: "setImmediate could be used to escape sandbox context"
|
|
85
|
+
},
|
|
86
|
+
// Note: We intentionally do NOT block `process` entirely because:
|
|
87
|
+
// 1. Node.js internals (Promise resolution, etc.) use process.nextTick
|
|
88
|
+
// 2. Blocking process entirely breaks normal async operation
|
|
89
|
+
// 3. The primary code execution vectors (Function, eval) are already blocked
|
|
90
|
+
// However, we DO block specific dangerous process properties.
|
|
91
|
+
{
|
|
92
|
+
prop: "env",
|
|
93
|
+
target: process,
|
|
94
|
+
violationType: "process_env",
|
|
95
|
+
strategy: "throw",
|
|
96
|
+
reason: "process.env could leak sensitive environment variables",
|
|
97
|
+
// Node.js internals and bundled dependencies read these env vars
|
|
98
|
+
// during module loading, file watching, and I/O within the
|
|
99
|
+
// AsyncLocalStorage context. None are user secrets.
|
|
100
|
+
allowedKeys: /* @__PURE__ */ new Set([
|
|
101
|
+
// Node.js core
|
|
102
|
+
"NODE_V8_COVERAGE",
|
|
103
|
+
"NODE_DEBUG",
|
|
104
|
+
"NODE_DEBUG_NATIVE",
|
|
105
|
+
"NODE_COMPILE_CACHE",
|
|
106
|
+
"NODE_ENV",
|
|
107
|
+
"WATCH_REPORT_DEPENDENCIES",
|
|
108
|
+
// Dependencies
|
|
109
|
+
"FORCE_COLOR",
|
|
110
|
+
// chalk/supports-color
|
|
111
|
+
"DEBUG",
|
|
112
|
+
// debug package
|
|
113
|
+
"UNDICI_NO_FG",
|
|
114
|
+
// undici (Node.js fetch)
|
|
115
|
+
"JEST_WORKER_ID",
|
|
116
|
+
// jest/vitest worker detection
|
|
117
|
+
"__MINIMATCH_TESTING_PLATFORM__",
|
|
118
|
+
// minimatch
|
|
119
|
+
"LOG_TOKENS",
|
|
120
|
+
// query engine debug logging
|
|
121
|
+
"LOG_STREAM"
|
|
122
|
+
// query engine debug logging
|
|
123
|
+
])
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
prop: "binding",
|
|
127
|
+
target: process,
|
|
128
|
+
violationType: "process_binding",
|
|
129
|
+
strategy: "throw",
|
|
130
|
+
reason: "process.binding provides access to native Node.js modules"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
prop: "_linkedBinding",
|
|
134
|
+
target: process,
|
|
135
|
+
violationType: "process_binding",
|
|
136
|
+
strategy: "throw",
|
|
137
|
+
reason: "process._linkedBinding provides access to native Node.js modules"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
prop: "dlopen",
|
|
141
|
+
target: process,
|
|
142
|
+
violationType: "process_dlopen",
|
|
143
|
+
strategy: "throw",
|
|
144
|
+
reason: "process.dlopen allows loading native addons"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
prop: "getBuiltinModule",
|
|
148
|
+
target: process,
|
|
149
|
+
violationType: "process_get_builtin_module",
|
|
150
|
+
strategy: "throw",
|
|
151
|
+
reason: "process.getBuiltinModule allows loading native Node.js modules (fs, child_process, vm)"
|
|
152
|
+
},
|
|
153
|
+
// Note: process.mainModule is handled specially in defense-in-depth-box.ts
|
|
154
|
+
// and worker-defense-in-depth.ts because it may be undefined in ESM contexts
|
|
155
|
+
// but we still want to block both reading and setting it.
|
|
156
|
+
// Process control vectors
|
|
157
|
+
{
|
|
158
|
+
prop: "exit",
|
|
159
|
+
target: process,
|
|
160
|
+
violationType: "process_exit",
|
|
161
|
+
strategy: "throw",
|
|
162
|
+
reason: "process.exit could terminate the interpreter"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
prop: "abort",
|
|
166
|
+
target: process,
|
|
167
|
+
violationType: "process_exit",
|
|
168
|
+
strategy: "throw",
|
|
169
|
+
reason: "process.abort could crash the interpreter"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
prop: "kill",
|
|
173
|
+
target: process,
|
|
174
|
+
violationType: "process_kill",
|
|
175
|
+
strategy: "throw",
|
|
176
|
+
reason: "process.kill could signal other processes"
|
|
177
|
+
},
|
|
178
|
+
// Privilege escalation vectors
|
|
179
|
+
{
|
|
180
|
+
prop: "setuid",
|
|
181
|
+
target: process,
|
|
182
|
+
violationType: "process_setuid",
|
|
183
|
+
strategy: "throw",
|
|
184
|
+
reason: "process.setuid could escalate privileges"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
prop: "setgid",
|
|
188
|
+
target: process,
|
|
189
|
+
violationType: "process_setuid",
|
|
190
|
+
strategy: "throw",
|
|
191
|
+
reason: "process.setgid could escalate privileges"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
prop: "seteuid",
|
|
195
|
+
target: process,
|
|
196
|
+
violationType: "process_setuid",
|
|
197
|
+
strategy: "throw",
|
|
198
|
+
reason: "process.seteuid could escalate effective user privileges"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
prop: "setegid",
|
|
202
|
+
target: process,
|
|
203
|
+
violationType: "process_setuid",
|
|
204
|
+
strategy: "throw",
|
|
205
|
+
reason: "process.setegid could escalate effective group privileges"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
prop: "initgroups",
|
|
209
|
+
target: process,
|
|
210
|
+
violationType: "process_setuid",
|
|
211
|
+
strategy: "throw",
|
|
212
|
+
reason: "process.initgroups could modify supplementary group IDs"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
prop: "setgroups",
|
|
216
|
+
target: process,
|
|
217
|
+
violationType: "process_setuid",
|
|
218
|
+
strategy: "throw",
|
|
219
|
+
reason: "process.setgroups could modify supplementary group IDs"
|
|
220
|
+
},
|
|
221
|
+
// File permission manipulation
|
|
222
|
+
{
|
|
223
|
+
prop: "umask",
|
|
224
|
+
target: process,
|
|
225
|
+
violationType: "process_umask",
|
|
226
|
+
strategy: "throw",
|
|
227
|
+
reason: "process.umask could modify file creation permissions"
|
|
228
|
+
},
|
|
229
|
+
// Information disclosure vectors
|
|
230
|
+
// Note: process.argv is an array (object) so gets an object proxy
|
|
231
|
+
{
|
|
232
|
+
prop: "argv",
|
|
233
|
+
target: process,
|
|
234
|
+
violationType: "process_argv",
|
|
235
|
+
strategy: "throw",
|
|
236
|
+
reason: "process.argv may contain secrets in CLI arguments"
|
|
237
|
+
},
|
|
238
|
+
// Note: process.execPath is a string primitive, handled specially
|
|
239
|
+
// in defense-in-depth-box.ts and worker-defense-in-depth.ts
|
|
240
|
+
// Note: process.connected is a boolean primitive, handled specially
|
|
241
|
+
// in defense-in-depth-box.ts and worker-defense-in-depth.ts
|
|
242
|
+
// Working directory access/manipulation
|
|
243
|
+
{
|
|
244
|
+
prop: "cwd",
|
|
245
|
+
target: process,
|
|
246
|
+
violationType: "process_chdir",
|
|
247
|
+
strategy: "throw",
|
|
248
|
+
reason: "process.cwd could disclose real host working directory path"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
prop: "chdir",
|
|
252
|
+
target: process,
|
|
253
|
+
violationType: "process_chdir",
|
|
254
|
+
strategy: "throw",
|
|
255
|
+
reason: "process.chdir could confuse the interpreter's CWD tracking"
|
|
256
|
+
},
|
|
257
|
+
// Diagnostic report (leaks full environment, host paths, system info)
|
|
258
|
+
{
|
|
259
|
+
prop: "report",
|
|
260
|
+
target: process,
|
|
261
|
+
violationType: "process_report",
|
|
262
|
+
strategy: "throw",
|
|
263
|
+
reason: "process.report could disclose full environment, host paths, and system info"
|
|
264
|
+
},
|
|
265
|
+
// Environment file loading (Node 21.7+)
|
|
266
|
+
{
|
|
267
|
+
prop: "loadEnvFile",
|
|
268
|
+
target: process,
|
|
269
|
+
violationType: "process_env",
|
|
270
|
+
strategy: "throw",
|
|
271
|
+
reason: "process.loadEnvFile could load env files bypassing env proxy"
|
|
272
|
+
},
|
|
273
|
+
// Exception handler manipulation
|
|
274
|
+
{
|
|
275
|
+
prop: "setUncaughtExceptionCaptureCallback",
|
|
276
|
+
target: process,
|
|
277
|
+
violationType: "process_exception_handler",
|
|
278
|
+
strategy: "throw",
|
|
279
|
+
reason: "setUncaughtExceptionCaptureCallback could intercept security errors"
|
|
280
|
+
},
|
|
281
|
+
...[
|
|
282
|
+
"on",
|
|
283
|
+
"once",
|
|
284
|
+
"addListener",
|
|
285
|
+
"prependListener",
|
|
286
|
+
"prependOnceListener"
|
|
287
|
+
].map(
|
|
288
|
+
(prop) => ({
|
|
289
|
+
prop,
|
|
290
|
+
target: process,
|
|
291
|
+
violationType: "process_exception_handler",
|
|
292
|
+
strategy: "throw",
|
|
293
|
+
reason: "process-global listeners can outlive the sandbox and lose its security context"
|
|
294
|
+
})
|
|
295
|
+
),
|
|
296
|
+
// IPC communication vectors (may be undefined in non-IPC contexts)
|
|
297
|
+
{
|
|
298
|
+
prop: "send",
|
|
299
|
+
target: process,
|
|
300
|
+
violationType: "process_send",
|
|
301
|
+
strategy: "throw",
|
|
302
|
+
reason: "process.send could communicate with parent process in IPC contexts"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
prop: "channel",
|
|
306
|
+
target: process,
|
|
307
|
+
violationType: "process_channel",
|
|
308
|
+
strategy: "throw",
|
|
309
|
+
reason: "process.channel could access IPC channel to parent process"
|
|
310
|
+
},
|
|
311
|
+
// Timing side-channel vectors
|
|
312
|
+
{
|
|
313
|
+
prop: "cpuUsage",
|
|
314
|
+
target: process,
|
|
315
|
+
violationType: "process_timing",
|
|
316
|
+
strategy: "throw",
|
|
317
|
+
reason: "process.cpuUsage could enable timing side-channel attacks"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
prop: "memoryUsage",
|
|
321
|
+
target: process,
|
|
322
|
+
violationType: "process_timing",
|
|
323
|
+
strategy: "throw",
|
|
324
|
+
reason: "process.memoryUsage could enable timing side-channel attacks"
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
prop: "hrtime",
|
|
328
|
+
target: process,
|
|
329
|
+
violationType: "process_timing",
|
|
330
|
+
strategy: "throw",
|
|
331
|
+
reason: "process.hrtime could enable timing side-channel attacks"
|
|
332
|
+
},
|
|
333
|
+
// We also don't block `require` because:
|
|
334
|
+
// 1. It may not exist in all environments (ESM)
|
|
335
|
+
// 2. import() is the modern escape vector and can't be blocked this way
|
|
336
|
+
// Reference leak vectors
|
|
337
|
+
{
|
|
338
|
+
prop: "WeakRef",
|
|
339
|
+
target: globalThis,
|
|
340
|
+
violationType: "weak_ref",
|
|
341
|
+
strategy: "throw",
|
|
342
|
+
reason: "WeakRef could be used to leak references outside sandbox"
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
prop: "FinalizationRegistry",
|
|
346
|
+
target: globalThis,
|
|
347
|
+
violationType: "finalization_registry",
|
|
348
|
+
strategy: "throw",
|
|
349
|
+
reason: "FinalizationRegistry could be used to leak references outside sandbox"
|
|
350
|
+
},
|
|
351
|
+
// Introspection/interception vectors (freeze instead of throw)
|
|
352
|
+
// SECURITY RATIONALE: Reflect is frozen (not blocked) because:
|
|
353
|
+
// 1. Defense infrastructure uses Reflect.apply/get/set/construct internally
|
|
354
|
+
// 2. Frozen Reflect cannot be mutated but remains fully functional
|
|
355
|
+
// 3. Reflect.construct(Function, ['code']) IS safe because globalThis.Function
|
|
356
|
+
// is replaced with a blocking proxy — Reflect.construct receives the proxy
|
|
357
|
+
// 4. Security depends on NEVER leaking original Function/eval references.
|
|
358
|
+
// If an unpatched Function ref leaked, Reflect.construct would bypass defense.
|
|
359
|
+
{
|
|
360
|
+
prop: "Reflect",
|
|
361
|
+
target: globalThis,
|
|
362
|
+
violationType: "reflect",
|
|
363
|
+
strategy: "freeze",
|
|
364
|
+
reason: "Reflect provides introspection capabilities"
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
prop: "Proxy",
|
|
368
|
+
target: globalThis,
|
|
369
|
+
violationType: "proxy",
|
|
370
|
+
strategy: "throw",
|
|
371
|
+
reason: "Proxy allows intercepting and modifying object behavior"
|
|
372
|
+
},
|
|
373
|
+
// WebAssembly allows arbitrary code execution
|
|
374
|
+
{
|
|
375
|
+
prop: "WebAssembly",
|
|
376
|
+
target: globalThis,
|
|
377
|
+
violationType: "webassembly",
|
|
378
|
+
strategy: "throw",
|
|
379
|
+
reason: "WebAssembly allows executing arbitrary compiled code"
|
|
380
|
+
},
|
|
381
|
+
// SharedArrayBuffer and Atomics can enable side-channel attacks
|
|
382
|
+
{
|
|
383
|
+
prop: "SharedArrayBuffer",
|
|
384
|
+
target: globalThis,
|
|
385
|
+
violationType: "shared_array_buffer",
|
|
386
|
+
strategy: "throw",
|
|
387
|
+
reason: "SharedArrayBuffer could enable side-channel communication or timing attacks"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
prop: "Atomics",
|
|
391
|
+
target: globalThis,
|
|
392
|
+
violationType: "atomics",
|
|
393
|
+
strategy: "throw",
|
|
394
|
+
reason: "Atomics could enable side-channel communication or timing attacks"
|
|
395
|
+
},
|
|
396
|
+
// Note: Error.prepareStackTrace is handled specially in defense-in-depth-box.ts
|
|
397
|
+
// because we only want to block SETTING it, not reading (V8 reads it internally)
|
|
398
|
+
// Timing side-channel: performance.now() provides sub-millisecond resolution
|
|
399
|
+
// Note: Date.now() is intentionally NOT blocked — it's used for $SECONDS,
|
|
400
|
+
// date command, and has only ~1ms resolution (vs process.hrtime at ns).
|
|
401
|
+
{
|
|
402
|
+
prop: "performance",
|
|
403
|
+
target: globalThis,
|
|
404
|
+
violationType: "performance_timing",
|
|
405
|
+
strategy: "throw",
|
|
406
|
+
reason: "performance.now() provides sub-millisecond timing for side-channel attacks"
|
|
407
|
+
},
|
|
408
|
+
// Block direct access to process.stdout and process.stderr to prevent
|
|
409
|
+
// writing to the host's actual stdout/stderr, bypassing the interpreter's
|
|
410
|
+
// output accumulation.
|
|
411
|
+
{
|
|
412
|
+
prop: "stdout",
|
|
413
|
+
target: process,
|
|
414
|
+
violationType: "process_stdout",
|
|
415
|
+
strategy: "throw",
|
|
416
|
+
reason: "process.stdout could bypass interpreter output to write to host stdout"
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
prop: "stderr",
|
|
420
|
+
target: process,
|
|
421
|
+
violationType: "process_stderr",
|
|
422
|
+
strategy: "throw",
|
|
423
|
+
reason: "process.stderr could bypass interpreter output to write to host stderr"
|
|
424
|
+
},
|
|
425
|
+
// Prototype pollution vectors
|
|
426
|
+
{
|
|
427
|
+
prop: "__defineGetter__",
|
|
428
|
+
target: Object.prototype,
|
|
429
|
+
violationType: "prototype_mutation",
|
|
430
|
+
strategy: "throw",
|
|
431
|
+
reason: "__defineGetter__ allows prototype pollution via getter injection"
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
prop: "__defineSetter__",
|
|
435
|
+
target: Object.prototype,
|
|
436
|
+
violationType: "prototype_mutation",
|
|
437
|
+
strategy: "throw",
|
|
438
|
+
reason: "__defineSetter__ allows prototype pollution via setter injection"
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
prop: "__lookupGetter__",
|
|
442
|
+
target: Object.prototype,
|
|
443
|
+
violationType: "prototype_mutation",
|
|
444
|
+
strategy: "throw",
|
|
445
|
+
reason: "__lookupGetter__ enables introspection for prototype pollution attacks"
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
prop: "__lookupSetter__",
|
|
449
|
+
target: Object.prototype,
|
|
450
|
+
violationType: "prototype_mutation",
|
|
451
|
+
strategy: "throw",
|
|
452
|
+
reason: "__lookupSetter__ enables introspection for prototype pollution attacks"
|
|
453
|
+
},
|
|
454
|
+
// Freeze JSON and Math to prevent mutation of built-in utility objects
|
|
455
|
+
{
|
|
456
|
+
prop: "JSON",
|
|
457
|
+
target: globalThis,
|
|
458
|
+
violationType: "json_mutation",
|
|
459
|
+
strategy: "freeze",
|
|
460
|
+
reason: "Freeze JSON to prevent mutation of parsing/serialization"
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
prop: "Math",
|
|
464
|
+
target: globalThis,
|
|
465
|
+
violationType: "math_mutation",
|
|
466
|
+
strategy: "freeze",
|
|
467
|
+
reason: "Freeze Math to prevent mutation of math utilities"
|
|
468
|
+
}
|
|
469
|
+
];
|
|
470
|
+
try {
|
|
471
|
+
const AsyncFunction = Object.getPrototypeOf(async () => {
|
|
472
|
+
}).constructor;
|
|
473
|
+
if (AsyncFunction && AsyncFunction !== Function) {
|
|
474
|
+
globals.push({
|
|
475
|
+
prop: "constructor",
|
|
476
|
+
target: Object.getPrototypeOf(async () => {
|
|
477
|
+
}),
|
|
478
|
+
violationType: "async_function_constructor",
|
|
479
|
+
strategy: "throw",
|
|
480
|
+
reason: "AsyncFunction constructor allows arbitrary async code execution"
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
} catch {
|
|
484
|
+
}
|
|
485
|
+
try {
|
|
486
|
+
const GeneratorFunction = Object.getPrototypeOf(
|
|
487
|
+
function* () {
|
|
488
|
+
}
|
|
489
|
+
).constructor;
|
|
490
|
+
if (GeneratorFunction && GeneratorFunction !== Function) {
|
|
491
|
+
globals.push({
|
|
492
|
+
prop: "constructor",
|
|
493
|
+
target: Object.getPrototypeOf(function* () {
|
|
494
|
+
}),
|
|
495
|
+
violationType: "generator_function_constructor",
|
|
496
|
+
strategy: "throw",
|
|
497
|
+
reason: "GeneratorFunction constructor allows arbitrary generator code execution"
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
} catch {
|
|
501
|
+
}
|
|
502
|
+
try {
|
|
503
|
+
const AsyncGeneratorFunction = Object.getPrototypeOf(
|
|
504
|
+
async function* () {
|
|
505
|
+
}
|
|
506
|
+
).constructor;
|
|
507
|
+
if (AsyncGeneratorFunction && AsyncGeneratorFunction !== Function && AsyncGeneratorFunction !== Object.getPrototypeOf(async () => {
|
|
508
|
+
}).constructor) {
|
|
509
|
+
globals.push({
|
|
510
|
+
prop: "constructor",
|
|
511
|
+
target: Object.getPrototypeOf(async function* () {
|
|
512
|
+
}),
|
|
513
|
+
violationType: "async_generator_function_constructor",
|
|
514
|
+
strategy: "throw",
|
|
515
|
+
reason: "AsyncGeneratorFunction constructor allows arbitrary async generator code execution"
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
} catch {
|
|
519
|
+
}
|
|
520
|
+
const availableGlobals = globals.filter((g) => {
|
|
521
|
+
try {
|
|
522
|
+
return g.target[g.prop] !== void 0;
|
|
523
|
+
} catch {
|
|
524
|
+
return false;
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
blockedGlobalViolationTypes ??= new Set(
|
|
528
|
+
availableGlobals.map(({ violationType }) => violationType)
|
|
529
|
+
);
|
|
530
|
+
return availableGlobals;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// src/security/safe-timestamp.ts
|
|
534
|
+
var performanceTimeOrigin = performance.timeOrigin;
|
|
535
|
+
var performanceNow = performance.now.bind(performance);
|
|
536
|
+
function getSafeTimestamp() {
|
|
537
|
+
return Math.floor(performanceTimeOrigin + performanceNow());
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
// src/security/violation-error-message.ts
|
|
541
|
+
var NON_EXCLUDABLE_VIOLATION_TYPES = /* @__PURE__ */ new Set([
|
|
542
|
+
"function_constructor",
|
|
543
|
+
"async_function_constructor",
|
|
544
|
+
"generator_function_constructor",
|
|
545
|
+
"async_generator_function_constructor"
|
|
546
|
+
]);
|
|
547
|
+
function assertExcludableViolationTypes(violationTypes) {
|
|
548
|
+
const nonExcludable = violationTypes?.find(
|
|
549
|
+
(type) => NON_EXCLUDABLE_VIOLATION_TYPES.has(type)
|
|
550
|
+
);
|
|
551
|
+
if (nonExcludable) {
|
|
552
|
+
throw new RangeError(
|
|
553
|
+
`defenseInDepth.excludeViolationTypes cannot disable the non-excludable "${nonExcludable}" protection`
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
var DEFENSE_IN_DEPTH_NOTICE = "\n\nThis is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com";
|
|
558
|
+
function formatViolationErrorMessage(message, violationType, canExclude) {
|
|
559
|
+
const exclusionHint = canExclude && !NON_EXCLUDABLE_VIOLATION_TYPES.has(violationType) ? `
|
|
560
|
+
|
|
561
|
+
If this access is required by trusted host-runtime code, add "${violationType}" to defenseInDepth.excludeViolationTypes.` : "";
|
|
562
|
+
return message + DEFENSE_IN_DEPTH_NOTICE + exclusionHint;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
// src/security/defense-in-depth-box.ts
|
|
566
|
+
var IS_BROWSER = typeof __BROWSER__ !== "undefined" && __BROWSER__;
|
|
567
|
+
var AsyncLocalStorageClass = null;
|
|
568
|
+
var nodeModuleApi = null;
|
|
569
|
+
var nodeModuleClass = null;
|
|
570
|
+
if (!IS_BROWSER) {
|
|
571
|
+
try {
|
|
572
|
+
AsyncLocalStorageClass = nodeAsyncHooks.AsyncLocalStorage;
|
|
573
|
+
nodeModuleApi = nodeModule;
|
|
574
|
+
nodeModuleClass = nodeModuleApi.Module ?? nodeModuleApi.default ?? null;
|
|
575
|
+
} catch {
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
var executionContext = !IS_BROWSER && AsyncLocalStorageClass ? new AsyncLocalStorageClass() : null;
|
|
579
|
+
|
|
580
|
+
// src/security/worker-defense-in-depth.ts
|
|
581
|
+
var WORKER_SPECIAL_EXCLUDABLE_VIOLATION_TYPES = /* @__PURE__ */ new Set([
|
|
582
|
+
"error_prepare_stack_trace",
|
|
583
|
+
"module_load",
|
|
584
|
+
"module_resolve_filename",
|
|
585
|
+
"process_main_module",
|
|
586
|
+
"process_exec_path",
|
|
587
|
+
"process_connected"
|
|
588
|
+
]);
|
|
589
|
+
var WorkerSecurityViolationError = class extends Error {
|
|
590
|
+
constructor(message, violation) {
|
|
591
|
+
super(
|
|
592
|
+
formatViolationErrorMessage(
|
|
593
|
+
message,
|
|
594
|
+
violation.type,
|
|
595
|
+
WORKER_SPECIAL_EXCLUDABLE_VIOLATION_TYPES.has(violation.type) || getBlockedGlobalViolationTypes().has(violation.type)
|
|
596
|
+
)
|
|
597
|
+
);
|
|
598
|
+
this.violation = violation;
|
|
599
|
+
this.name = "WorkerSecurityViolationError";
|
|
600
|
+
}
|
|
601
|
+
violation;
|
|
602
|
+
};
|
|
603
|
+
var MAX_STORED_VIOLATIONS = 1e3;
|
|
604
|
+
var nodeModuleClass2 = null;
|
|
605
|
+
try {
|
|
606
|
+
const getBuiltinModule = process.getBuiltinModule;
|
|
607
|
+
const moduleApi = typeof getBuiltinModule === "function" ? getBuiltinModule("module") : typeof __require === "function" ? (
|
|
608
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
609
|
+
__require("node:module")
|
|
610
|
+
) : null;
|
|
611
|
+
nodeModuleClass2 = moduleApi?.Module ?? moduleApi?.default ?? null;
|
|
612
|
+
if (typeof getBuiltinModule === "function") {
|
|
613
|
+
const workerThreads = getBuiltinModule("worker_threads");
|
|
614
|
+
const isWorkerThread = workerThreads?.isMainThread === false;
|
|
615
|
+
if (isWorkerThread) {
|
|
616
|
+
const cryptoApi = getBuiltinModule("crypto");
|
|
617
|
+
cryptoApi?.randomUUID?.();
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
} catch {
|
|
621
|
+
nodeModuleClass2 = null;
|
|
622
|
+
}
|
|
623
|
+
function generateExecutionId() {
|
|
624
|
+
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
|
625
|
+
return crypto.randomUUID();
|
|
626
|
+
}
|
|
627
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
628
|
+
const r = Math.random() * 16 | 0;
|
|
629
|
+
const v = c === "x" ? r : r & 3 | 8;
|
|
630
|
+
return v.toString(16);
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
var WorkerDefenseInDepth = class {
|
|
634
|
+
config;
|
|
635
|
+
isActivated = false;
|
|
636
|
+
originalDescriptors = [];
|
|
637
|
+
patchFailures = [];
|
|
638
|
+
violations = [];
|
|
639
|
+
executionId;
|
|
640
|
+
/**
|
|
641
|
+
* Original Proxy constructor, captured before patching.
|
|
642
|
+
* This is captured at instance creation time to ensure we get the unpatched version.
|
|
643
|
+
*/
|
|
644
|
+
originalProxy;
|
|
645
|
+
/**
|
|
646
|
+
* Recursion guard to prevent infinite loops when proxy traps trigger
|
|
647
|
+
* code that accesses the same proxied object (e.g., process.env).
|
|
648
|
+
*/
|
|
649
|
+
inTrap = false;
|
|
650
|
+
/**
|
|
651
|
+
* Create and activate the worker defense layer.
|
|
652
|
+
*
|
|
653
|
+
* @param config - Configuration for the defense layer
|
|
654
|
+
*/
|
|
655
|
+
constructor(config) {
|
|
656
|
+
assertExcludableViolationTypes(config.excludeViolationTypes);
|
|
657
|
+
this.originalProxy = Proxy;
|
|
658
|
+
this.config = config;
|
|
659
|
+
this.executionId = generateExecutionId();
|
|
660
|
+
if (config.enabled !== false) {
|
|
661
|
+
this.activate();
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Get statistics about the defense layer.
|
|
666
|
+
*/
|
|
667
|
+
getStats() {
|
|
668
|
+
return {
|
|
669
|
+
violationsBlocked: this.violations.length,
|
|
670
|
+
violations: [...this.violations],
|
|
671
|
+
isActive: this.isActivated
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Clear stored violations. Useful for testing.
|
|
676
|
+
*/
|
|
677
|
+
clearViolations() {
|
|
678
|
+
this.violations = [];
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* Get the execution ID for this worker.
|
|
682
|
+
*/
|
|
683
|
+
getExecutionId() {
|
|
684
|
+
return this.executionId;
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Deactivate the defense layer and restore original globals.
|
|
688
|
+
* Typically only needed for testing.
|
|
689
|
+
*/
|
|
690
|
+
deactivate() {
|
|
691
|
+
if (!this.isActivated) {
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
this.restorePatches();
|
|
695
|
+
this.isActivated = false;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Activate the defense layer by applying patches.
|
|
699
|
+
*/
|
|
700
|
+
activate() {
|
|
701
|
+
if (this.isActivated) {
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
try {
|
|
705
|
+
this.applyPatches();
|
|
706
|
+
this.isActivated = true;
|
|
707
|
+
} catch (error) {
|
|
708
|
+
this.restorePatches();
|
|
709
|
+
this.isActivated = false;
|
|
710
|
+
throw error;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Get a human-readable path for a target object and property.
|
|
715
|
+
*/
|
|
716
|
+
getPathForTarget(target, prop) {
|
|
717
|
+
if (target === globalThis) {
|
|
718
|
+
return `globalThis.${prop}`;
|
|
719
|
+
}
|
|
720
|
+
if (typeof process !== "undefined" && target === process) {
|
|
721
|
+
return `process.${prop}`;
|
|
722
|
+
}
|
|
723
|
+
if (target === Error) {
|
|
724
|
+
return `Error.${prop}`;
|
|
725
|
+
}
|
|
726
|
+
if (target === Function.prototype) {
|
|
727
|
+
return `Function.prototype.${prop}`;
|
|
728
|
+
}
|
|
729
|
+
if (target === Object.prototype) {
|
|
730
|
+
return `Object.prototype.${prop}`;
|
|
731
|
+
}
|
|
732
|
+
return `<object>.${prop}`;
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* Record a violation and invoke the callback.
|
|
736
|
+
* In worker context, blocking always happens (no audit mode context check).
|
|
737
|
+
*/
|
|
738
|
+
recordViolation(type, path, message) {
|
|
739
|
+
const violation = {
|
|
740
|
+
timestamp: getSafeTimestamp(),
|
|
741
|
+
type,
|
|
742
|
+
message,
|
|
743
|
+
path,
|
|
744
|
+
stack: new Error().stack,
|
|
745
|
+
executionId: this.executionId
|
|
746
|
+
};
|
|
747
|
+
if (this.violations.length < MAX_STORED_VIOLATIONS) {
|
|
748
|
+
this.violations.push(violation);
|
|
749
|
+
}
|
|
750
|
+
if (this.config.onViolation) {
|
|
751
|
+
try {
|
|
752
|
+
this.config.onViolation(violation);
|
|
753
|
+
} catch (e) {
|
|
754
|
+
console.debug(
|
|
755
|
+
"[WorkerDefenseInDepth] onViolation callback threw:",
|
|
756
|
+
e instanceof Error ? e.message : e
|
|
757
|
+
);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
return violation;
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Create a blocking proxy for a function.
|
|
764
|
+
* In worker context, always blocks (no context check needed).
|
|
765
|
+
*/
|
|
766
|
+
createBlockingProxy(original, path, violationType) {
|
|
767
|
+
const self = this;
|
|
768
|
+
const auditMode = this.config.auditMode;
|
|
769
|
+
return new this.originalProxy(original, {
|
|
770
|
+
apply(target, thisArg, args) {
|
|
771
|
+
const message = `${path} is blocked in worker context`;
|
|
772
|
+
const violation = self.recordViolation(violationType, path, message);
|
|
773
|
+
if (!auditMode) {
|
|
774
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
775
|
+
}
|
|
776
|
+
return Reflect.apply(target, thisArg, args);
|
|
777
|
+
},
|
|
778
|
+
construct(target, args, newTarget) {
|
|
779
|
+
const message = `${path} constructor is blocked in worker context`;
|
|
780
|
+
const violation = self.recordViolation(violationType, path, message);
|
|
781
|
+
if (!auditMode) {
|
|
782
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
783
|
+
}
|
|
784
|
+
return Reflect.construct(target, args, newTarget);
|
|
785
|
+
}
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* Create a blocking proxy for an object (blocks all property access).
|
|
790
|
+
*/
|
|
791
|
+
createBlockingObjectProxy(original, path, violationType, allowedKeys) {
|
|
792
|
+
const self = this;
|
|
793
|
+
const auditMode = this.config.auditMode;
|
|
794
|
+
return new this.originalProxy(original, {
|
|
795
|
+
get(target, prop, receiver) {
|
|
796
|
+
if (self.inTrap) {
|
|
797
|
+
return Reflect.get(target, prop, receiver);
|
|
798
|
+
}
|
|
799
|
+
if (allowedKeys && typeof prop === "string" && allowedKeys.has(prop)) {
|
|
800
|
+
return Reflect.get(target, prop, receiver);
|
|
801
|
+
}
|
|
802
|
+
self.inTrap = true;
|
|
803
|
+
try {
|
|
804
|
+
const fullPath = `${path}.${String(prop)}`;
|
|
805
|
+
const message = `${fullPath} is blocked in worker context`;
|
|
806
|
+
const violation = self.recordViolation(
|
|
807
|
+
violationType,
|
|
808
|
+
fullPath,
|
|
809
|
+
message
|
|
810
|
+
);
|
|
811
|
+
if (!auditMode) {
|
|
812
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
813
|
+
}
|
|
814
|
+
return Reflect.get(target, prop, receiver);
|
|
815
|
+
} finally {
|
|
816
|
+
self.inTrap = false;
|
|
817
|
+
}
|
|
818
|
+
},
|
|
819
|
+
set(target, prop, value, receiver) {
|
|
820
|
+
const setValue = () => path === "process.env" && prop === "DEBUG" ? Reflect.set(target, prop, value) : Reflect.set(target, prop, value, receiver);
|
|
821
|
+
if (self.inTrap) {
|
|
822
|
+
return setValue();
|
|
823
|
+
}
|
|
824
|
+
self.inTrap = true;
|
|
825
|
+
try {
|
|
826
|
+
const fullPath = `${path}.${String(prop)}`;
|
|
827
|
+
const message = `${fullPath} modification is blocked in worker context`;
|
|
828
|
+
const violation = self.recordViolation(
|
|
829
|
+
violationType,
|
|
830
|
+
fullPath,
|
|
831
|
+
message
|
|
832
|
+
);
|
|
833
|
+
if (!auditMode) {
|
|
834
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
835
|
+
}
|
|
836
|
+
return setValue();
|
|
837
|
+
} finally {
|
|
838
|
+
self.inTrap = false;
|
|
839
|
+
}
|
|
840
|
+
},
|
|
841
|
+
ownKeys(target) {
|
|
842
|
+
if (self.inTrap) {
|
|
843
|
+
return Reflect.ownKeys(target);
|
|
844
|
+
}
|
|
845
|
+
self.inTrap = true;
|
|
846
|
+
try {
|
|
847
|
+
const message = `${path} enumeration is blocked in worker context`;
|
|
848
|
+
const violation = self.recordViolation(violationType, path, message);
|
|
849
|
+
if (!auditMode) {
|
|
850
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
851
|
+
}
|
|
852
|
+
return Reflect.ownKeys(target);
|
|
853
|
+
} finally {
|
|
854
|
+
self.inTrap = false;
|
|
855
|
+
}
|
|
856
|
+
},
|
|
857
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
858
|
+
if (self.inTrap) {
|
|
859
|
+
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
860
|
+
}
|
|
861
|
+
self.inTrap = true;
|
|
862
|
+
try {
|
|
863
|
+
const fullPath = `${path}.${String(prop)}`;
|
|
864
|
+
const message = `${fullPath} descriptor access is blocked in worker context`;
|
|
865
|
+
const violation = self.recordViolation(
|
|
866
|
+
violationType,
|
|
867
|
+
fullPath,
|
|
868
|
+
message
|
|
869
|
+
);
|
|
870
|
+
if (!auditMode) {
|
|
871
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
872
|
+
}
|
|
873
|
+
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
874
|
+
} finally {
|
|
875
|
+
self.inTrap = false;
|
|
876
|
+
}
|
|
877
|
+
},
|
|
878
|
+
has(target, prop) {
|
|
879
|
+
if (self.inTrap) {
|
|
880
|
+
return Reflect.has(target, prop);
|
|
881
|
+
}
|
|
882
|
+
self.inTrap = true;
|
|
883
|
+
try {
|
|
884
|
+
const fullPath = `${path}.${String(prop)}`;
|
|
885
|
+
const message = `${fullPath} existence check is blocked in worker context`;
|
|
886
|
+
const violation = self.recordViolation(
|
|
887
|
+
violationType,
|
|
888
|
+
fullPath,
|
|
889
|
+
message
|
|
890
|
+
);
|
|
891
|
+
if (!auditMode) {
|
|
892
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
893
|
+
}
|
|
894
|
+
return Reflect.has(target, prop);
|
|
895
|
+
} finally {
|
|
896
|
+
self.inTrap = false;
|
|
897
|
+
}
|
|
898
|
+
},
|
|
899
|
+
deleteProperty(target, prop) {
|
|
900
|
+
if (self.inTrap) {
|
|
901
|
+
return Reflect.deleteProperty(target, prop);
|
|
902
|
+
}
|
|
903
|
+
self.inTrap = true;
|
|
904
|
+
try {
|
|
905
|
+
const fullPath = `${path}.${String(prop)}`;
|
|
906
|
+
const message = `${fullPath} deletion is blocked in worker context`;
|
|
907
|
+
const violation = self.recordViolation(
|
|
908
|
+
violationType,
|
|
909
|
+
fullPath,
|
|
910
|
+
message
|
|
911
|
+
);
|
|
912
|
+
if (!auditMode) {
|
|
913
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
914
|
+
}
|
|
915
|
+
return Reflect.deleteProperty(target, prop);
|
|
916
|
+
} finally {
|
|
917
|
+
self.inTrap = false;
|
|
918
|
+
}
|
|
919
|
+
},
|
|
920
|
+
setPrototypeOf(target, proto) {
|
|
921
|
+
if (self.inTrap) {
|
|
922
|
+
return Reflect.setPrototypeOf(target, proto);
|
|
923
|
+
}
|
|
924
|
+
self.inTrap = true;
|
|
925
|
+
try {
|
|
926
|
+
const message = `${path} setPrototypeOf is blocked in worker context`;
|
|
927
|
+
const violation = self.recordViolation(violationType, path, message);
|
|
928
|
+
if (!auditMode) {
|
|
929
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
930
|
+
}
|
|
931
|
+
return Reflect.setPrototypeOf(target, proto);
|
|
932
|
+
} finally {
|
|
933
|
+
self.inTrap = false;
|
|
934
|
+
}
|
|
935
|
+
},
|
|
936
|
+
defineProperty(target, prop, descriptor) {
|
|
937
|
+
if (self.inTrap) {
|
|
938
|
+
return Reflect.defineProperty(target, prop, descriptor);
|
|
939
|
+
}
|
|
940
|
+
self.inTrap = true;
|
|
941
|
+
try {
|
|
942
|
+
const fullPath = `${path}.${String(prop)}`;
|
|
943
|
+
const message = `${fullPath} defineProperty is blocked in worker context`;
|
|
944
|
+
const violation = self.recordViolation(
|
|
945
|
+
violationType,
|
|
946
|
+
fullPath,
|
|
947
|
+
message
|
|
948
|
+
);
|
|
949
|
+
if (!auditMode) {
|
|
950
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
951
|
+
}
|
|
952
|
+
return Reflect.defineProperty(target, prop, descriptor);
|
|
953
|
+
} finally {
|
|
954
|
+
self.inTrap = false;
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
createReadonlyObjectProxy(original, path, violationType) {
|
|
960
|
+
const auditMode = this.config.auditMode;
|
|
961
|
+
const allowOrThrow = (operation) => {
|
|
962
|
+
const message = `${path} ${operation} is blocked in worker context`;
|
|
963
|
+
const violation = this.recordViolation(violationType, path, message);
|
|
964
|
+
if (!auditMode) {
|
|
965
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
966
|
+
}
|
|
967
|
+
};
|
|
968
|
+
return new this.originalProxy(original, {
|
|
969
|
+
set(target, prop, value, receiver) {
|
|
970
|
+
allowOrThrow("modification");
|
|
971
|
+
return Reflect.set(target, prop, value, receiver);
|
|
972
|
+
},
|
|
973
|
+
defineProperty(target, prop, descriptor) {
|
|
974
|
+
allowOrThrow("defineProperty");
|
|
975
|
+
return Reflect.defineProperty(target, prop, descriptor);
|
|
976
|
+
},
|
|
977
|
+
deleteProperty(target, prop) {
|
|
978
|
+
allowOrThrow("deletion");
|
|
979
|
+
return Reflect.deleteProperty(target, prop);
|
|
980
|
+
},
|
|
981
|
+
setPrototypeOf(target, prototype) {
|
|
982
|
+
allowOrThrow("setPrototypeOf");
|
|
983
|
+
return Reflect.setPrototypeOf(target, prototype);
|
|
984
|
+
},
|
|
985
|
+
preventExtensions(target) {
|
|
986
|
+
allowOrThrow("preventExtensions");
|
|
987
|
+
return Reflect.preventExtensions(target);
|
|
988
|
+
}
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Apply security patches to dangerous globals.
|
|
993
|
+
*/
|
|
994
|
+
applyPatches() {
|
|
995
|
+
this.patchFailures = [];
|
|
996
|
+
const blockedGlobals = getBlockedGlobals();
|
|
997
|
+
const excludeTypes = new Set(this.config.excludeViolationTypes ?? []);
|
|
998
|
+
const workerInfrastructureListenerMethods = /* @__PURE__ */ new Set([
|
|
999
|
+
"on",
|
|
1000
|
+
"once",
|
|
1001
|
+
"addListener",
|
|
1002
|
+
"prependListener",
|
|
1003
|
+
"prependOnceListener"
|
|
1004
|
+
]);
|
|
1005
|
+
const permanentIntrinsicPatches = [];
|
|
1006
|
+
for (const blocked of blockedGlobals) {
|
|
1007
|
+
if (excludeTypes.has(blocked.violationType)) {
|
|
1008
|
+
continue;
|
|
1009
|
+
}
|
|
1010
|
+
if (blocked.target === process && workerInfrastructureListenerMethods.has(blocked.prop)) {
|
|
1011
|
+
continue;
|
|
1012
|
+
}
|
|
1013
|
+
if (blocked.strategy === "freeze") {
|
|
1014
|
+
permanentIntrinsicPatches.push(blocked);
|
|
1015
|
+
continue;
|
|
1016
|
+
}
|
|
1017
|
+
this.applyPatch(blocked);
|
|
1018
|
+
}
|
|
1019
|
+
if (!excludeTypes.has("function_constructor")) {
|
|
1020
|
+
this.protectConstructorChain(excludeTypes);
|
|
1021
|
+
}
|
|
1022
|
+
if (!excludeTypes.has("error_prepare_stack_trace")) {
|
|
1023
|
+
this.protectErrorPrepareStackTrace();
|
|
1024
|
+
}
|
|
1025
|
+
if (!excludeTypes.has("module_load")) {
|
|
1026
|
+
this.protectModuleLoad();
|
|
1027
|
+
}
|
|
1028
|
+
if (!excludeTypes.has("module_resolve_filename")) {
|
|
1029
|
+
this.protectModuleResolveFilename();
|
|
1030
|
+
}
|
|
1031
|
+
if (!excludeTypes.has("process_main_module")) {
|
|
1032
|
+
this.protectProcessMainModule();
|
|
1033
|
+
}
|
|
1034
|
+
if (!excludeTypes.has("process_exec_path")) {
|
|
1035
|
+
this.protectProcessExecPath();
|
|
1036
|
+
}
|
|
1037
|
+
if (!excludeTypes.has("process_connected")) {
|
|
1038
|
+
this.protectProcessConnected();
|
|
1039
|
+
}
|
|
1040
|
+
if (!excludeTypes.has("proxy")) {
|
|
1041
|
+
this.protectProxyRevocable();
|
|
1042
|
+
}
|
|
1043
|
+
const criticalPaths = [
|
|
1044
|
+
"Function.prototype.constructor",
|
|
1045
|
+
"Module._load",
|
|
1046
|
+
"Module._resolveFilename"
|
|
1047
|
+
];
|
|
1048
|
+
const criticalFailures = this.patchFailures.filter(
|
|
1049
|
+
(path) => criticalPaths.includes(path)
|
|
1050
|
+
);
|
|
1051
|
+
if (criticalFailures.length > 0) {
|
|
1052
|
+
this.restorePatches();
|
|
1053
|
+
throw new Error(
|
|
1054
|
+
`WorkerDefenseInDepth: critical patches failed: ${criticalFailures.join(", ")}`
|
|
1055
|
+
);
|
|
1056
|
+
}
|
|
1057
|
+
for (const blocked of permanentIntrinsicPatches) {
|
|
1058
|
+
this.applyPatch(blocked);
|
|
1059
|
+
}
|
|
1060
|
+
this.lockWellKnownSymbols();
|
|
1061
|
+
}
|
|
1062
|
+
/**
|
|
1063
|
+
* Lock well-known Symbol properties on built-in constructors/prototypes.
|
|
1064
|
+
*/
|
|
1065
|
+
lockWellKnownSymbols() {
|
|
1066
|
+
const lock = (obj, sym) => {
|
|
1067
|
+
try {
|
|
1068
|
+
const desc = Object.getOwnPropertyDescriptor(obj, sym);
|
|
1069
|
+
if (desc?.configurable) {
|
|
1070
|
+
if ("value" in desc) {
|
|
1071
|
+
Object.defineProperty(obj, sym, {
|
|
1072
|
+
...desc,
|
|
1073
|
+
configurable: false,
|
|
1074
|
+
writable: false
|
|
1075
|
+
});
|
|
1076
|
+
return;
|
|
1077
|
+
}
|
|
1078
|
+
Object.defineProperty(obj, sym, { ...desc, configurable: false });
|
|
1079
|
+
}
|
|
1080
|
+
} catch {
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
for (const ctor of [Array, Map, Set, RegExp, Promise]) {
|
|
1084
|
+
lock(ctor, Symbol.species);
|
|
1085
|
+
}
|
|
1086
|
+
for (const proto of [
|
|
1087
|
+
Array.prototype,
|
|
1088
|
+
String.prototype,
|
|
1089
|
+
Map.prototype,
|
|
1090
|
+
Set.prototype
|
|
1091
|
+
]) {
|
|
1092
|
+
lock(proto, Symbol.iterator);
|
|
1093
|
+
}
|
|
1094
|
+
lock(Symbol.prototype, Symbol.toPrimitive);
|
|
1095
|
+
lock(Date.prototype, Symbol.toPrimitive);
|
|
1096
|
+
for (const sym of [
|
|
1097
|
+
Symbol.match,
|
|
1098
|
+
Symbol.matchAll,
|
|
1099
|
+
Symbol.replace,
|
|
1100
|
+
Symbol.search,
|
|
1101
|
+
Symbol.split
|
|
1102
|
+
]) {
|
|
1103
|
+
lock(RegExp.prototype, sym);
|
|
1104
|
+
}
|
|
1105
|
+
lock(Function.prototype, Symbol.hasInstance);
|
|
1106
|
+
lock(Array.prototype, Symbol.unscopables);
|
|
1107
|
+
for (const proto of [
|
|
1108
|
+
Map.prototype,
|
|
1109
|
+
Set.prototype,
|
|
1110
|
+
Promise.prototype,
|
|
1111
|
+
ArrayBuffer.prototype
|
|
1112
|
+
]) {
|
|
1113
|
+
lock(proto, Symbol.toStringTag);
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
/**
|
|
1117
|
+
* Block Proxy.revocable to prevent bypassing Proxy constructor blocking.
|
|
1118
|
+
*
|
|
1119
|
+
* Proxy.revocable internally uses the real Proxy constructor, so it bypasses
|
|
1120
|
+
* our blocking proxy on globalThis.Proxy. We replace it with a wrapper that
|
|
1121
|
+
* always blocks in worker context.
|
|
1122
|
+
*/
|
|
1123
|
+
protectProxyRevocable() {
|
|
1124
|
+
const self = this;
|
|
1125
|
+
const auditMode = this.config.auditMode;
|
|
1126
|
+
try {
|
|
1127
|
+
const originalRevocable = this.originalProxy.revocable;
|
|
1128
|
+
if (typeof originalRevocable !== "function") return;
|
|
1129
|
+
const descriptor = Object.getOwnPropertyDescriptor(
|
|
1130
|
+
this.originalProxy,
|
|
1131
|
+
"revocable"
|
|
1132
|
+
);
|
|
1133
|
+
this.originalDescriptors.push({
|
|
1134
|
+
target: this.originalProxy,
|
|
1135
|
+
prop: "revocable",
|
|
1136
|
+
descriptor
|
|
1137
|
+
});
|
|
1138
|
+
Object.defineProperty(this.originalProxy, "revocable", {
|
|
1139
|
+
value: function revocable(_target, _handler) {
|
|
1140
|
+
const message = "Proxy.revocable is blocked in worker context";
|
|
1141
|
+
const violation = self.recordViolation(
|
|
1142
|
+
"proxy",
|
|
1143
|
+
"Proxy.revocable",
|
|
1144
|
+
message
|
|
1145
|
+
);
|
|
1146
|
+
if (!auditMode) {
|
|
1147
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
1148
|
+
}
|
|
1149
|
+
return originalRevocable(_target, _handler);
|
|
1150
|
+
},
|
|
1151
|
+
writable: false,
|
|
1152
|
+
configurable: true
|
|
1153
|
+
// Must be configurable for restoration
|
|
1154
|
+
});
|
|
1155
|
+
} catch {
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* Protect against .constructor.constructor escape vector.
|
|
1160
|
+
* @param excludeTypes - Set of violation types to skip
|
|
1161
|
+
*/
|
|
1162
|
+
protectConstructorChain(excludeTypes) {
|
|
1163
|
+
let AsyncFunction = null;
|
|
1164
|
+
let GeneratorFunction = null;
|
|
1165
|
+
let AsyncGeneratorFunction = null;
|
|
1166
|
+
try {
|
|
1167
|
+
AsyncFunction = Object.getPrototypeOf(async () => {
|
|
1168
|
+
}).constructor;
|
|
1169
|
+
} catch {
|
|
1170
|
+
}
|
|
1171
|
+
try {
|
|
1172
|
+
GeneratorFunction = Object.getPrototypeOf(function* () {
|
|
1173
|
+
}).constructor;
|
|
1174
|
+
} catch {
|
|
1175
|
+
}
|
|
1176
|
+
try {
|
|
1177
|
+
AsyncGeneratorFunction = Object.getPrototypeOf(
|
|
1178
|
+
async function* () {
|
|
1179
|
+
}
|
|
1180
|
+
).constructor;
|
|
1181
|
+
} catch {
|
|
1182
|
+
}
|
|
1183
|
+
this.patchPrototypeConstructor(
|
|
1184
|
+
Function.prototype,
|
|
1185
|
+
"Function.prototype.constructor",
|
|
1186
|
+
"function_constructor"
|
|
1187
|
+
);
|
|
1188
|
+
if (!excludeTypes.has("async_function_constructor") && AsyncFunction && AsyncFunction !== Function) {
|
|
1189
|
+
this.patchPrototypeConstructor(
|
|
1190
|
+
AsyncFunction.prototype,
|
|
1191
|
+
"AsyncFunction.prototype.constructor",
|
|
1192
|
+
"async_function_constructor"
|
|
1193
|
+
);
|
|
1194
|
+
}
|
|
1195
|
+
if (!excludeTypes.has("generator_function_constructor") && GeneratorFunction && GeneratorFunction !== Function) {
|
|
1196
|
+
this.patchPrototypeConstructor(
|
|
1197
|
+
GeneratorFunction.prototype,
|
|
1198
|
+
"GeneratorFunction.prototype.constructor",
|
|
1199
|
+
"generator_function_constructor"
|
|
1200
|
+
);
|
|
1201
|
+
}
|
|
1202
|
+
if (!excludeTypes.has("async_generator_function_constructor") && AsyncGeneratorFunction && AsyncGeneratorFunction !== Function && AsyncGeneratorFunction !== AsyncFunction) {
|
|
1203
|
+
this.patchPrototypeConstructor(
|
|
1204
|
+
AsyncGeneratorFunction.prototype,
|
|
1205
|
+
"AsyncGeneratorFunction.prototype.constructor",
|
|
1206
|
+
"async_generator_function_constructor"
|
|
1207
|
+
);
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Protect Error.prepareStackTrace from being set.
|
|
1212
|
+
*/
|
|
1213
|
+
protectErrorPrepareStackTrace() {
|
|
1214
|
+
const self = this;
|
|
1215
|
+
const auditMode = this.config.auditMode;
|
|
1216
|
+
try {
|
|
1217
|
+
const originalDescriptor = Object.getOwnPropertyDescriptor(
|
|
1218
|
+
Error,
|
|
1219
|
+
"prepareStackTrace"
|
|
1220
|
+
);
|
|
1221
|
+
this.originalDescriptors.push({
|
|
1222
|
+
target: Error,
|
|
1223
|
+
prop: "prepareStackTrace",
|
|
1224
|
+
descriptor: originalDescriptor
|
|
1225
|
+
});
|
|
1226
|
+
let currentValue = originalDescriptor?.value;
|
|
1227
|
+
Object.defineProperty(Error, "prepareStackTrace", {
|
|
1228
|
+
get() {
|
|
1229
|
+
return currentValue;
|
|
1230
|
+
},
|
|
1231
|
+
set(value) {
|
|
1232
|
+
const message = "Error.prepareStackTrace modification is blocked in worker context";
|
|
1233
|
+
const violation = self.recordViolation(
|
|
1234
|
+
"error_prepare_stack_trace",
|
|
1235
|
+
"Error.prepareStackTrace",
|
|
1236
|
+
message
|
|
1237
|
+
);
|
|
1238
|
+
if (!auditMode) {
|
|
1239
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
1240
|
+
}
|
|
1241
|
+
currentValue = value;
|
|
1242
|
+
},
|
|
1243
|
+
configurable: true
|
|
1244
|
+
});
|
|
1245
|
+
} catch {
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* Patch a prototype's constructor property.
|
|
1250
|
+
*
|
|
1251
|
+
* Returns a proxy that allows reading properties (like .name) but blocks
|
|
1252
|
+
* calling the constructor as a function (which would allow code execution).
|
|
1253
|
+
*/
|
|
1254
|
+
patchPrototypeConstructor(prototype, path, violationType) {
|
|
1255
|
+
const self = this;
|
|
1256
|
+
const auditMode = this.config.auditMode;
|
|
1257
|
+
try {
|
|
1258
|
+
const originalDescriptor = Object.getOwnPropertyDescriptor(
|
|
1259
|
+
prototype,
|
|
1260
|
+
"constructor"
|
|
1261
|
+
);
|
|
1262
|
+
this.originalDescriptors.push({
|
|
1263
|
+
target: prototype,
|
|
1264
|
+
prop: "constructor",
|
|
1265
|
+
descriptor: originalDescriptor
|
|
1266
|
+
});
|
|
1267
|
+
const originalValue = originalDescriptor?.value;
|
|
1268
|
+
const constructorProxy = originalValue && typeof originalValue === "function" ? new this.originalProxy(originalValue, {
|
|
1269
|
+
apply(_target, _thisArg, _args) {
|
|
1270
|
+
const message = `${path} invocation is blocked in worker context`;
|
|
1271
|
+
const violation = self.recordViolation(
|
|
1272
|
+
violationType,
|
|
1273
|
+
path,
|
|
1274
|
+
message
|
|
1275
|
+
);
|
|
1276
|
+
if (!auditMode) {
|
|
1277
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
1278
|
+
}
|
|
1279
|
+
return void 0;
|
|
1280
|
+
},
|
|
1281
|
+
construct(_target, _args, _newTarget) {
|
|
1282
|
+
const message = `${path} construction is blocked in worker context`;
|
|
1283
|
+
const violation = self.recordViolation(
|
|
1284
|
+
violationType,
|
|
1285
|
+
path,
|
|
1286
|
+
message
|
|
1287
|
+
);
|
|
1288
|
+
if (!auditMode) {
|
|
1289
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
1290
|
+
}
|
|
1291
|
+
return {};
|
|
1292
|
+
},
|
|
1293
|
+
// Allow all property access (like .name, .prototype, etc.)
|
|
1294
|
+
get(target, prop, receiver) {
|
|
1295
|
+
return Reflect.get(target, prop, receiver);
|
|
1296
|
+
},
|
|
1297
|
+
getPrototypeOf(target) {
|
|
1298
|
+
return Reflect.getPrototypeOf(target);
|
|
1299
|
+
},
|
|
1300
|
+
has(target, prop) {
|
|
1301
|
+
return Reflect.has(target, prop);
|
|
1302
|
+
},
|
|
1303
|
+
ownKeys(target) {
|
|
1304
|
+
return Reflect.ownKeys(target);
|
|
1305
|
+
},
|
|
1306
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
1307
|
+
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
1308
|
+
}
|
|
1309
|
+
}) : originalValue;
|
|
1310
|
+
Object.defineProperty(prototype, "constructor", {
|
|
1311
|
+
get() {
|
|
1312
|
+
return constructorProxy;
|
|
1313
|
+
},
|
|
1314
|
+
set(value) {
|
|
1315
|
+
const message = `${path} modification is blocked in worker context`;
|
|
1316
|
+
const violation = self.recordViolation(violationType, path, message);
|
|
1317
|
+
if (!auditMode) {
|
|
1318
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
1319
|
+
}
|
|
1320
|
+
Object.defineProperty(this, "constructor", {
|
|
1321
|
+
value,
|
|
1322
|
+
writable: true,
|
|
1323
|
+
configurable: true
|
|
1324
|
+
});
|
|
1325
|
+
},
|
|
1326
|
+
configurable: true
|
|
1327
|
+
});
|
|
1328
|
+
} catch {
|
|
1329
|
+
this.patchFailures.push(path);
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
/**
|
|
1333
|
+
* Protect process.mainModule from being accessed or set.
|
|
1334
|
+
*
|
|
1335
|
+
* The attack vector is:
|
|
1336
|
+
* ```
|
|
1337
|
+
* process.mainModule.require('child_process').execSync('whoami')
|
|
1338
|
+
* process.mainModule.constructor._load('vm')
|
|
1339
|
+
* ```
|
|
1340
|
+
*
|
|
1341
|
+
* process.mainModule may be undefined in ESM contexts but could exist in
|
|
1342
|
+
* CommonJS workers. We block both reading and setting.
|
|
1343
|
+
*/
|
|
1344
|
+
protectProcessMainModule() {
|
|
1345
|
+
if (typeof process === "undefined") return;
|
|
1346
|
+
const self = this;
|
|
1347
|
+
const auditMode = this.config.auditMode;
|
|
1348
|
+
try {
|
|
1349
|
+
const originalDescriptor = Object.getOwnPropertyDescriptor(
|
|
1350
|
+
process,
|
|
1351
|
+
"mainModule"
|
|
1352
|
+
);
|
|
1353
|
+
this.originalDescriptors.push({
|
|
1354
|
+
target: process,
|
|
1355
|
+
prop: "mainModule",
|
|
1356
|
+
descriptor: originalDescriptor
|
|
1357
|
+
});
|
|
1358
|
+
const currentValue = originalDescriptor?.value;
|
|
1359
|
+
if (currentValue !== void 0) {
|
|
1360
|
+
Object.defineProperty(process, "mainModule", {
|
|
1361
|
+
get() {
|
|
1362
|
+
const message = "process.mainModule access is blocked in worker context";
|
|
1363
|
+
const violation = self.recordViolation(
|
|
1364
|
+
"process_main_module",
|
|
1365
|
+
"process.mainModule",
|
|
1366
|
+
message
|
|
1367
|
+
);
|
|
1368
|
+
if (!auditMode) {
|
|
1369
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
1370
|
+
}
|
|
1371
|
+
return currentValue;
|
|
1372
|
+
},
|
|
1373
|
+
set(value) {
|
|
1374
|
+
const message = "process.mainModule modification is blocked in worker context";
|
|
1375
|
+
const violation = self.recordViolation(
|
|
1376
|
+
"process_main_module",
|
|
1377
|
+
"process.mainModule",
|
|
1378
|
+
message
|
|
1379
|
+
);
|
|
1380
|
+
if (!auditMode) {
|
|
1381
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
1382
|
+
}
|
|
1383
|
+
Object.defineProperty(process, "mainModule", {
|
|
1384
|
+
value,
|
|
1385
|
+
writable: true,
|
|
1386
|
+
configurable: true
|
|
1387
|
+
});
|
|
1388
|
+
},
|
|
1389
|
+
configurable: true
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1392
|
+
} catch {
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* Protect process.execPath from being read or set in worker context.
|
|
1397
|
+
*
|
|
1398
|
+
* process.execPath is a string primitive (not an object), so it cannot be
|
|
1399
|
+
* proxied via the normal blocked globals mechanism. We use Object.defineProperty
|
|
1400
|
+
* with getter/setter (same pattern as protectProcessMainModule).
|
|
1401
|
+
*/
|
|
1402
|
+
protectProcessExecPath() {
|
|
1403
|
+
if (typeof process === "undefined") return;
|
|
1404
|
+
const self = this;
|
|
1405
|
+
const auditMode = this.config.auditMode;
|
|
1406
|
+
try {
|
|
1407
|
+
const originalDescriptor = Object.getOwnPropertyDescriptor(
|
|
1408
|
+
process,
|
|
1409
|
+
"execPath"
|
|
1410
|
+
);
|
|
1411
|
+
this.originalDescriptors.push({
|
|
1412
|
+
target: process,
|
|
1413
|
+
prop: "execPath",
|
|
1414
|
+
descriptor: originalDescriptor
|
|
1415
|
+
});
|
|
1416
|
+
const currentValue = originalDescriptor?.value ?? process.execPath;
|
|
1417
|
+
Object.defineProperty(process, "execPath", {
|
|
1418
|
+
get() {
|
|
1419
|
+
const message = "process.execPath access is blocked in worker context";
|
|
1420
|
+
const violation = self.recordViolation(
|
|
1421
|
+
"process_exec_path",
|
|
1422
|
+
"process.execPath",
|
|
1423
|
+
message
|
|
1424
|
+
);
|
|
1425
|
+
if (!auditMode) {
|
|
1426
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
1427
|
+
}
|
|
1428
|
+
return currentValue;
|
|
1429
|
+
},
|
|
1430
|
+
set(value) {
|
|
1431
|
+
const message = "process.execPath modification is blocked in worker context";
|
|
1432
|
+
const violation = self.recordViolation(
|
|
1433
|
+
"process_exec_path",
|
|
1434
|
+
"process.execPath",
|
|
1435
|
+
message
|
|
1436
|
+
);
|
|
1437
|
+
if (!auditMode) {
|
|
1438
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
1439
|
+
}
|
|
1440
|
+
Object.defineProperty(process, "execPath", {
|
|
1441
|
+
value,
|
|
1442
|
+
writable: true,
|
|
1443
|
+
configurable: true
|
|
1444
|
+
});
|
|
1445
|
+
},
|
|
1446
|
+
configurable: true
|
|
1447
|
+
});
|
|
1448
|
+
} catch {
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
/**
|
|
1452
|
+
* Protect process.connected from being read or set in worker context.
|
|
1453
|
+
*
|
|
1454
|
+
* process.connected is a boolean primitive (not an object), so it cannot be
|
|
1455
|
+
* proxied via the normal blocked globals mechanism. We use Object.defineProperty
|
|
1456
|
+
* with getter/setter (same pattern as protectProcessExecPath).
|
|
1457
|
+
*
|
|
1458
|
+
* Only protects if process.connected exists (IPC contexts).
|
|
1459
|
+
*/
|
|
1460
|
+
protectProcessConnected() {
|
|
1461
|
+
if (typeof process === "undefined") return;
|
|
1462
|
+
if (process.connected === void 0) return;
|
|
1463
|
+
const self = this;
|
|
1464
|
+
const auditMode = this.config.auditMode;
|
|
1465
|
+
try {
|
|
1466
|
+
const originalDescriptor = Object.getOwnPropertyDescriptor(
|
|
1467
|
+
process,
|
|
1468
|
+
"connected"
|
|
1469
|
+
);
|
|
1470
|
+
this.originalDescriptors.push({
|
|
1471
|
+
target: process,
|
|
1472
|
+
prop: "connected",
|
|
1473
|
+
descriptor: originalDescriptor
|
|
1474
|
+
});
|
|
1475
|
+
const currentValue = originalDescriptor?.value ?? process.connected;
|
|
1476
|
+
Object.defineProperty(process, "connected", {
|
|
1477
|
+
get() {
|
|
1478
|
+
const message = "process.connected access is blocked in worker context";
|
|
1479
|
+
const violation = self.recordViolation(
|
|
1480
|
+
"process_connected",
|
|
1481
|
+
"process.connected",
|
|
1482
|
+
message
|
|
1483
|
+
);
|
|
1484
|
+
if (!auditMode) {
|
|
1485
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
1486
|
+
}
|
|
1487
|
+
return currentValue;
|
|
1488
|
+
},
|
|
1489
|
+
set(value) {
|
|
1490
|
+
const message = "process.connected modification is blocked in worker context";
|
|
1491
|
+
const violation = self.recordViolation(
|
|
1492
|
+
"process_connected",
|
|
1493
|
+
"process.connected",
|
|
1494
|
+
message
|
|
1495
|
+
);
|
|
1496
|
+
if (!auditMode) {
|
|
1497
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
1498
|
+
}
|
|
1499
|
+
Object.defineProperty(process, "connected", {
|
|
1500
|
+
value,
|
|
1501
|
+
writable: true,
|
|
1502
|
+
configurable: true
|
|
1503
|
+
});
|
|
1504
|
+
},
|
|
1505
|
+
configurable: true
|
|
1506
|
+
});
|
|
1507
|
+
} catch {
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
/**
|
|
1511
|
+
* Protect Module._load from being called.
|
|
1512
|
+
*
|
|
1513
|
+
* The attack vector is:
|
|
1514
|
+
* ```
|
|
1515
|
+
* module.constructor._load('child_process')
|
|
1516
|
+
* require.main.constructor._load('vm')
|
|
1517
|
+
* ```
|
|
1518
|
+
*
|
|
1519
|
+
* We access the Module class and replace _load with a blocking proxy.
|
|
1520
|
+
*/
|
|
1521
|
+
protectModuleLoad() {
|
|
1522
|
+
this.protectModuleMethod("_load", "module_load");
|
|
1523
|
+
}
|
|
1524
|
+
/**
|
|
1525
|
+
* Protect Module._resolveFilename from being called in worker context.
|
|
1526
|
+
*
|
|
1527
|
+
* Module._resolveFilename is called for both require() and import() resolution.
|
|
1528
|
+
* Blocking it catches file-based import() specifiers.
|
|
1529
|
+
*
|
|
1530
|
+
* data: and blob: URLs are handled by ESM loader hooks registered
|
|
1531
|
+
* in the main thread (DefenseInDepthBox.protectDynamicImport).
|
|
1532
|
+
*/
|
|
1533
|
+
protectModuleResolveFilename() {
|
|
1534
|
+
this.protectModuleMethod("_resolveFilename", "module_resolve_filename");
|
|
1535
|
+
}
|
|
1536
|
+
protectModuleMethod(prop, violationType) {
|
|
1537
|
+
const path = `Module.${prop}`;
|
|
1538
|
+
const self = this;
|
|
1539
|
+
const auditMode = this.config.auditMode;
|
|
1540
|
+
try {
|
|
1541
|
+
const ModuleClass = nodeModuleClass2;
|
|
1542
|
+
const original = ModuleClass?.[prop];
|
|
1543
|
+
if (!ModuleClass || typeof original !== "function") {
|
|
1544
|
+
throw new Error("node:module Module class or method is unavailable");
|
|
1545
|
+
}
|
|
1546
|
+
const descriptor = Object.getOwnPropertyDescriptor(ModuleClass, prop);
|
|
1547
|
+
if (!descriptor) throw new Error("method descriptor is unavailable");
|
|
1548
|
+
if (descriptor.configurable === false && descriptor.writable === false) {
|
|
1549
|
+
throw new Error("method is non-configurable and non-writable");
|
|
1550
|
+
}
|
|
1551
|
+
const proxy = new this.originalProxy(
|
|
1552
|
+
original,
|
|
1553
|
+
{
|
|
1554
|
+
apply(target, thisArg, args) {
|
|
1555
|
+
const message = `${path} is blocked in worker context`;
|
|
1556
|
+
const violation = self.recordViolation(
|
|
1557
|
+
violationType,
|
|
1558
|
+
path,
|
|
1559
|
+
message
|
|
1560
|
+
);
|
|
1561
|
+
if (!auditMode) {
|
|
1562
|
+
throw new WorkerSecurityViolationError(message, violation);
|
|
1563
|
+
}
|
|
1564
|
+
return Reflect.apply(target, thisArg, args);
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
);
|
|
1568
|
+
this.originalDescriptors.push({
|
|
1569
|
+
target: ModuleClass,
|
|
1570
|
+
prop,
|
|
1571
|
+
descriptor
|
|
1572
|
+
});
|
|
1573
|
+
Object.defineProperty(ModuleClass, prop, {
|
|
1574
|
+
...descriptor,
|
|
1575
|
+
value: proxy
|
|
1576
|
+
});
|
|
1577
|
+
const installed = Object.getOwnPropertyDescriptor(ModuleClass, prop);
|
|
1578
|
+
if (ModuleClass[prop] !== proxy || installed?.value !== proxy) {
|
|
1579
|
+
throw new Error("installed patch failed verification");
|
|
1580
|
+
}
|
|
1581
|
+
} catch {
|
|
1582
|
+
this.patchFailures.push(path);
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
/**
|
|
1586
|
+
* Apply a single patch to a blocked global.
|
|
1587
|
+
*/
|
|
1588
|
+
applyPatch(blocked) {
|
|
1589
|
+
const { target, prop, violationType, strategy } = blocked;
|
|
1590
|
+
try {
|
|
1591
|
+
const original = target[prop];
|
|
1592
|
+
if (original === void 0) {
|
|
1593
|
+
return;
|
|
1594
|
+
}
|
|
1595
|
+
const descriptor = Object.getOwnPropertyDescriptor(target, prop);
|
|
1596
|
+
this.originalDescriptors.push({ target, prop, descriptor });
|
|
1597
|
+
if (strategy === "freeze") {
|
|
1598
|
+
if (typeof original === "object" && original !== null) {
|
|
1599
|
+
Object.freeze(original);
|
|
1600
|
+
const path = this.getPathForTarget(target, prop);
|
|
1601
|
+
const proxy = this.createReadonlyObjectProxy(
|
|
1602
|
+
original,
|
|
1603
|
+
path,
|
|
1604
|
+
violationType
|
|
1605
|
+
);
|
|
1606
|
+
Object.defineProperty(target, prop, {
|
|
1607
|
+
...descriptor,
|
|
1608
|
+
value: proxy
|
|
1609
|
+
});
|
|
1610
|
+
}
|
|
1611
|
+
} else {
|
|
1612
|
+
const path = this.getPathForTarget(target, prop);
|
|
1613
|
+
const proxy = typeof original === "function" ? this.createBlockingProxy(
|
|
1614
|
+
original,
|
|
1615
|
+
path,
|
|
1616
|
+
violationType
|
|
1617
|
+
) : this.createBlockingObjectProxy(
|
|
1618
|
+
original,
|
|
1619
|
+
path,
|
|
1620
|
+
violationType,
|
|
1621
|
+
blocked.allowedKeys
|
|
1622
|
+
);
|
|
1623
|
+
Object.defineProperty(target, prop, {
|
|
1624
|
+
value: proxy,
|
|
1625
|
+
writable: true,
|
|
1626
|
+
configurable: true
|
|
1627
|
+
});
|
|
1628
|
+
}
|
|
1629
|
+
} catch {
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
/**
|
|
1633
|
+
* Restore all original values.
|
|
1634
|
+
*/
|
|
1635
|
+
restorePatches() {
|
|
1636
|
+
for (let i = this.originalDescriptors.length - 1; i >= 0; i--) {
|
|
1637
|
+
const { target, prop, descriptor } = this.originalDescriptors[i];
|
|
1638
|
+
try {
|
|
1639
|
+
if (descriptor) {
|
|
1640
|
+
Object.defineProperty(target, prop, descriptor);
|
|
1641
|
+
} else {
|
|
1642
|
+
delete target[prop];
|
|
1643
|
+
}
|
|
1644
|
+
} catch {
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
this.originalDescriptors = [];
|
|
1648
|
+
}
|
|
1649
|
+
};
|
|
1650
|
+
|
|
1651
|
+
// src/security/wasm-callback.ts
|
|
1652
|
+
function sanitizeUnknownError(error) {
|
|
1653
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1654
|
+
return sanitizeErrorMessage(message);
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
// src/commands/sqlite3/worker.ts
|
|
1658
|
+
var MIN_SQLITE_HEAP_LIMIT = 32 * 1024 * 1024;
|
|
1659
|
+
var MAX_SQLITE_HEAP_LIMIT = 128 * 1024 * 1024;
|
|
1660
|
+
var cachedSQL = null;
|
|
1661
|
+
var defense = null;
|
|
1662
|
+
function wrapWorkerMessage(protocolToken, message) {
|
|
1663
|
+
const wrapped = /* @__PURE__ */ Object.create(null);
|
|
1664
|
+
if (!message || typeof message !== "object") {
|
|
1665
|
+
wrapped.success = false;
|
|
1666
|
+
wrapped.error = "Worker attempted to post non-object message";
|
|
1667
|
+
wrapped.protocolToken = protocolToken;
|
|
1668
|
+
return wrapped;
|
|
1669
|
+
}
|
|
1670
|
+
for (const [key, value] of Object.entries(message))
|
|
1671
|
+
wrapped[key] = value;
|
|
1672
|
+
wrapped.protocolToken = protocolToken;
|
|
1673
|
+
return wrapped;
|
|
1674
|
+
}
|
|
1675
|
+
function postWorkerMessage(protocolToken, message) {
|
|
1676
|
+
try {
|
|
1677
|
+
parentPort?.postMessage(wrapWorkerMessage(protocolToken, message));
|
|
1678
|
+
} catch (error) {
|
|
1679
|
+
console.debug(
|
|
1680
|
+
"[sqlite3-worker] failed to post worker message:",
|
|
1681
|
+
sanitizeUnknownError(error)
|
|
1682
|
+
);
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
async function initializeSqlJs() {
|
|
1686
|
+
if (cachedSQL) {
|
|
1687
|
+
return cachedSQL;
|
|
1688
|
+
}
|
|
1689
|
+
cachedSQL = await initSqlJs();
|
|
1690
|
+
return cachedSQL;
|
|
1691
|
+
}
|
|
1692
|
+
function activateDefense() {
|
|
1693
|
+
if (defense) return;
|
|
1694
|
+
defense = new WorkerDefenseInDepth({});
|
|
1695
|
+
}
|
|
1696
|
+
function stripLeadingNoise(sql) {
|
|
1697
|
+
let s = sql;
|
|
1698
|
+
for (; ; ) {
|
|
1699
|
+
const before = s;
|
|
1700
|
+
s = s.replace(/^\s+/, "");
|
|
1701
|
+
if (s.startsWith("--")) {
|
|
1702
|
+
const nl = s.indexOf("\n");
|
|
1703
|
+
s = nl === -1 ? "" : s.slice(nl + 1);
|
|
1704
|
+
} else if (s.startsWith("/*")) {
|
|
1705
|
+
const end = s.indexOf("*/");
|
|
1706
|
+
s = end === -1 ? "" : s.slice(end + 2);
|
|
1707
|
+
}
|
|
1708
|
+
if (s === before) return s;
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
function isReadOnlyStatement(sql) {
|
|
1712
|
+
const s = stripLeadingNoise(sql).toUpperCase();
|
|
1713
|
+
if (s.startsWith("SELECT")) return true;
|
|
1714
|
+
if (s.startsWith("EXPLAIN")) return true;
|
|
1715
|
+
if (s.startsWith("VALUES")) return true;
|
|
1716
|
+
return false;
|
|
1717
|
+
}
|
|
1718
|
+
function tailAfterFailedPrepare(db, sql) {
|
|
1719
|
+
let quote = null;
|
|
1720
|
+
let lineComment = false;
|
|
1721
|
+
let blockComment = false;
|
|
1722
|
+
for (let i = 0; i < sql.length; i++) {
|
|
1723
|
+
const char = sql[i];
|
|
1724
|
+
const next = sql[i + 1];
|
|
1725
|
+
if (lineComment) {
|
|
1726
|
+
if (char === "\n") lineComment = false;
|
|
1727
|
+
continue;
|
|
1728
|
+
}
|
|
1729
|
+
if (blockComment) {
|
|
1730
|
+
if (char === "*" && next === "/") {
|
|
1731
|
+
blockComment = false;
|
|
1732
|
+
i++;
|
|
1733
|
+
}
|
|
1734
|
+
continue;
|
|
1735
|
+
}
|
|
1736
|
+
if (quote !== null) {
|
|
1737
|
+
const closes = quote === "]" ? char === "]" : char === quote;
|
|
1738
|
+
if (closes) {
|
|
1739
|
+
if (quote !== "]" && next === quote) i++;
|
|
1740
|
+
else quote = null;
|
|
1741
|
+
}
|
|
1742
|
+
continue;
|
|
1743
|
+
}
|
|
1744
|
+
if (char === "-" && next === "-") {
|
|
1745
|
+
lineComment = true;
|
|
1746
|
+
i++;
|
|
1747
|
+
continue;
|
|
1748
|
+
}
|
|
1749
|
+
if (char === "/" && next === "*") {
|
|
1750
|
+
blockComment = true;
|
|
1751
|
+
i++;
|
|
1752
|
+
continue;
|
|
1753
|
+
}
|
|
1754
|
+
if (char === "'" || char === '"' || char === "`") {
|
|
1755
|
+
quote = char;
|
|
1756
|
+
continue;
|
|
1757
|
+
}
|
|
1758
|
+
if (char === "[") {
|
|
1759
|
+
quote = "]";
|
|
1760
|
+
continue;
|
|
1761
|
+
}
|
|
1762
|
+
if (char !== ";") continue;
|
|
1763
|
+
const prefix = sql.slice(0, i + 1);
|
|
1764
|
+
try {
|
|
1765
|
+
const statement = db.prepare(prefix);
|
|
1766
|
+
statement.free();
|
|
1767
|
+
return sql.slice(i + 1);
|
|
1768
|
+
} catch (error) {
|
|
1769
|
+
if (!/incomplete input/i.test(error.message))
|
|
1770
|
+
return sql.slice(i + 1);
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
return null;
|
|
1774
|
+
}
|
|
1775
|
+
function valueByteLength(value) {
|
|
1776
|
+
if (value === null || value === void 0) return 4;
|
|
1777
|
+
if (value instanceof Uint8Array) return value.byteLength;
|
|
1778
|
+
if (typeof value === "string") return Buffer.byteLength(value, "utf8");
|
|
1779
|
+
return Buffer.byteLength(String(value), "utf8");
|
|
1780
|
+
}
|
|
1781
|
+
function databaseByteLength(db) {
|
|
1782
|
+
const pageCount = db.exec("PRAGMA page_count")[0]?.values[0]?.[0];
|
|
1783
|
+
const pageSize = db.exec("PRAGMA page_size")[0]?.values[0]?.[0];
|
|
1784
|
+
if (typeof pageCount !== "number" || typeof pageSize !== "number") return 0;
|
|
1785
|
+
return pageCount * pageSize;
|
|
1786
|
+
}
|
|
1787
|
+
async function executeQuery(data) {
|
|
1788
|
+
let db;
|
|
1789
|
+
try {
|
|
1790
|
+
if (data.dbBuffer && data.dbBuffer.byteLength > data.limits.maxDatabaseBytes) {
|
|
1791
|
+
throw new Error(
|
|
1792
|
+
`database exceeds ${data.limits.maxDatabaseBytes} byte limit`
|
|
1793
|
+
);
|
|
1794
|
+
}
|
|
1795
|
+
const SQL = await initializeSqlJs();
|
|
1796
|
+
if (data.dbBuffer) {
|
|
1797
|
+
db = new SQL.Database(data.dbBuffer);
|
|
1798
|
+
} else {
|
|
1799
|
+
db = new SQL.Database();
|
|
1800
|
+
}
|
|
1801
|
+
const sqliteHeapLimit = Math.min(
|
|
1802
|
+
MAX_SQLITE_HEAP_LIMIT,
|
|
1803
|
+
Math.max(
|
|
1804
|
+
MIN_SQLITE_HEAP_LIMIT,
|
|
1805
|
+
(data.dbBuffer?.byteLength ?? 0) + data.limits.maxResultBytes * 2
|
|
1806
|
+
)
|
|
1807
|
+
);
|
|
1808
|
+
db.run(`PRAGMA hard_heap_limit = ${sqliteHeapLimit}`);
|
|
1809
|
+
const bootstrapIterator = db.iterateStatements("SELECT 1");
|
|
1810
|
+
const bootstrapStatement = bootstrapIterator.next();
|
|
1811
|
+
if (!bootstrapStatement.done) {
|
|
1812
|
+
bootstrapStatement.value.step();
|
|
1813
|
+
bootstrapStatement.value.free();
|
|
1814
|
+
}
|
|
1815
|
+
activateDefense();
|
|
1816
|
+
} catch (e) {
|
|
1817
|
+
const message = sanitizeHostErrorMessage(e.message);
|
|
1818
|
+
return {
|
|
1819
|
+
success: false,
|
|
1820
|
+
error: message,
|
|
1821
|
+
defenseStats: defense?.getStats()
|
|
1822
|
+
};
|
|
1823
|
+
}
|
|
1824
|
+
const results = [];
|
|
1825
|
+
let hasModifications = false;
|
|
1826
|
+
let resultRows = 0;
|
|
1827
|
+
let resultBytes = 0;
|
|
1828
|
+
try {
|
|
1829
|
+
let remainingSql = data.sql;
|
|
1830
|
+
while (remainingSql.trim().length > 0) {
|
|
1831
|
+
let prepared;
|
|
1832
|
+
const iterator = db.iterateStatements(remainingSql);
|
|
1833
|
+
try {
|
|
1834
|
+
const next = iterator.next();
|
|
1835
|
+
if (next.done) break;
|
|
1836
|
+
prepared = next.value;
|
|
1837
|
+
remainingSql = iterator.getRemainingSQL();
|
|
1838
|
+
} catch (e) {
|
|
1839
|
+
const message = sanitizeHostErrorMessage(e.message);
|
|
1840
|
+
results.push({
|
|
1841
|
+
type: "error",
|
|
1842
|
+
error: message
|
|
1843
|
+
});
|
|
1844
|
+
if (data.options.bail) break;
|
|
1845
|
+
let tail = iterator.getRemainingSQL();
|
|
1846
|
+
if (tail === remainingSql)
|
|
1847
|
+
tail = tailAfterFailedPrepare(db, remainingSql) ?? remainingSql;
|
|
1848
|
+
if (tail === remainingSql) break;
|
|
1849
|
+
remainingSql = tail;
|
|
1850
|
+
continue;
|
|
1851
|
+
}
|
|
1852
|
+
const stmt = prepared.getSQL();
|
|
1853
|
+
try {
|
|
1854
|
+
const columns = prepared.getColumnNames();
|
|
1855
|
+
for (const column of columns) {
|
|
1856
|
+
resultBytes += Buffer.byteLength(column, "utf8");
|
|
1857
|
+
}
|
|
1858
|
+
const rows = [];
|
|
1859
|
+
while (prepared.step()) {
|
|
1860
|
+
if (resultRows >= data.limits.maxResultRows) {
|
|
1861
|
+
throw new Error(
|
|
1862
|
+
`query result exceeds ${data.limits.maxResultRows} row limit`
|
|
1863
|
+
);
|
|
1864
|
+
}
|
|
1865
|
+
const row = prepared.get();
|
|
1866
|
+
let rowBytes = row.length * 8;
|
|
1867
|
+
for (const value of row) rowBytes += valueByteLength(value);
|
|
1868
|
+
if (resultBytes + rowBytes > data.limits.maxResultBytes) {
|
|
1869
|
+
throw new Error(
|
|
1870
|
+
`query result exceeds ${data.limits.maxResultBytes} byte limit`
|
|
1871
|
+
);
|
|
1872
|
+
}
|
|
1873
|
+
resultBytes += rowBytes;
|
|
1874
|
+
resultRows++;
|
|
1875
|
+
rows.push(row);
|
|
1876
|
+
}
|
|
1877
|
+
results.push({ type: "data", columns, rows });
|
|
1878
|
+
if (!isReadOnlyStatement(stmt)) hasModifications = true;
|
|
1879
|
+
} catch (e) {
|
|
1880
|
+
const message = sanitizeHostErrorMessage(e.message);
|
|
1881
|
+
results.push({ type: "error", error: message });
|
|
1882
|
+
if (data.options.bail) {
|
|
1883
|
+
break;
|
|
1884
|
+
}
|
|
1885
|
+
} finally {
|
|
1886
|
+
prepared.free();
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
let resultBuffer = null;
|
|
1890
|
+
if (hasModifications) {
|
|
1891
|
+
const databaseBytes = databaseByteLength(db);
|
|
1892
|
+
if (databaseBytes > data.limits.maxDatabaseBytes) {
|
|
1893
|
+
throw new Error(
|
|
1894
|
+
`database exceeds ${data.limits.maxDatabaseBytes} byte limit`
|
|
1895
|
+
);
|
|
1896
|
+
}
|
|
1897
|
+
resultBuffer = db.export();
|
|
1898
|
+
}
|
|
1899
|
+
db.close();
|
|
1900
|
+
return {
|
|
1901
|
+
success: true,
|
|
1902
|
+
results,
|
|
1903
|
+
hasModifications,
|
|
1904
|
+
dbBuffer: resultBuffer,
|
|
1905
|
+
defenseStats: defense?.getStats()
|
|
1906
|
+
};
|
|
1907
|
+
} catch (e) {
|
|
1908
|
+
db.close();
|
|
1909
|
+
const message = sanitizeHostErrorMessage(e.message);
|
|
1910
|
+
return {
|
|
1911
|
+
success: false,
|
|
1912
|
+
error: message,
|
|
1913
|
+
defenseStats: defense?.getStats()
|
|
1914
|
+
};
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
if (parentPort && workerData) {
|
|
1918
|
+
const input = workerData;
|
|
1919
|
+
executeQuery(input).then((result) => {
|
|
1920
|
+
postWorkerMessage(input.protocolToken, result);
|
|
1921
|
+
}).catch((error) => {
|
|
1922
|
+
postWorkerMessage(input.protocolToken, {
|
|
1923
|
+
success: false,
|
|
1924
|
+
error: sanitizeUnknownError(error),
|
|
1925
|
+
defenseStats: defense?.getStats()
|
|
1926
|
+
});
|
|
1927
|
+
});
|
|
1928
|
+
}
|