0sec-cli 0.18.0 → 0.22.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/{0sec.js → 0.js} +90 -82
- package/LICENSE +1 -1
- package/README.md +62 -46
- package/chunks/adapt-loop-7I57LXXR.js +18 -0
- package/chunks/{adgraph-JLGA6RYI.js → adgraph-AUDQTBYA.js} +5 -5
- package/chunks/agent/skills/frameworks/entra-id.yaml +2 -2
- package/chunks/agent/skills/techniques/assumption-mining.yaml +2 -2
- package/chunks/agent/skills/techniques/cve-poc-adaptation.yaml +2 -2
- package/chunks/agent/skills/techniques/entra-attack-paths.yaml +1 -1
- package/chunks/agent/skills/techniques/kernel-weaponization.yaml +1 -1
- package/chunks/agent/skills/techniques/llm-prompt-injection.yaml +2 -2
- package/chunks/agent/skills/techniques/npm-ecosystem.yaml +1 -1
- package/chunks/agent/skills/techniques/poc-verification.yaml +1 -1
- package/chunks/agent/skills/techniques/seedless-depth-review.yaml +20 -38
- package/chunks/{artifact-scraper-HQ7HLP6V.js → artifact-scraper-PYZ3RU3O.js} +6 -6
- package/chunks/{assumption-mining-5SNIVVDN.js → assumption-mining-MFLF43IR.js} +24 -26
- package/chunks/{chunk-7DQEV5QI.js → chunk-23DG5YKS.js} +4 -4
- package/chunks/{chunk-UR4ELX2Y.js → chunk-2GV4HQKE.js} +340 -703
- package/chunks/{chunk-P6WKNFWX.js → chunk-2OQOQ2FZ.js} +8 -8
- package/chunks/{chunk-5G3ZXFBW.js → chunk-2WNCI664.js} +3 -3
- package/chunks/{chunk-DW5UWPFY.js → chunk-4VGLO2YS.js} +6 -5
- package/chunks/{chunk-KLTNTE2Z.js → chunk-5IBCBQEH.js} +13 -14
- package/chunks/{chunk-N7BOUYEV.js → chunk-5MWAG3FT.js} +14 -14
- package/chunks/{chunk-OEFNRYI2.js → chunk-6GHSR47F.js} +3 -6
- package/chunks/chunk-6YNKRUMC.js +4474 -0
- package/chunks/{chunk-6L26OBWI.js → chunk-76KSBWOQ.js} +255 -35
- package/chunks/chunk-7DEHG7YT.js +2143 -0
- package/chunks/{chunk-AD7WXDH6.js → chunk-7UFUALR2.js} +288 -22
- package/chunks/{chunk-53G27VPS.js → chunk-AZ7L3HFD.js} +7 -2
- package/chunks/{chunk-TSK2AG6J.js → chunk-CAYANSH6.js} +173 -1757
- package/chunks/{chunk-SAFFWQW4.js → chunk-DKSCN2AB.js} +7 -7
- package/chunks/{chunk-2JCCA2JL.js → chunk-DM5C5L5D.js} +3 -3
- package/chunks/{chunk-RWONANDA.js → chunk-DQTNI3KY.js} +5 -5
- package/chunks/{chunk-5JI7L7KV.js → chunk-EGZGZFAH.js} +10036 -12938
- package/chunks/{chunk-6LKRLK2R.js → chunk-FHC2B7LN.js} +3 -3
- package/chunks/{chunk-MYVT64FN.js → chunk-GHWODZMR.js} +2 -2
- package/chunks/{chunk-2RMLOJVB.js → chunk-GVD6SJGH.js} +2 -2
- package/chunks/{chunk-SF4KZ4O3.js → chunk-HLFS6WV2.js} +2 -2
- package/chunks/chunk-HR2TU42B.js +1228 -0
- package/chunks/{chunk-BFRB6HB2.js → chunk-HUNAPTKV.js} +3 -3
- package/chunks/chunk-IO7R7WBM.js +114 -0
- package/chunks/{chunk-WEBMRWEG.js → chunk-IXT64DV5.js} +656 -1868
- package/chunks/{chunk-3MOLBTLS.js → chunk-K2PWUPUI.js} +2 -2
- package/chunks/{chunk-WXQ6BJ6A.js → chunk-LCRTAQN2.js} +7 -7
- package/chunks/{chunk-SVJEDVYK.js → chunk-LPTRPRZR.js} +5 -5
- package/chunks/{chunk-CMKXP5RR.js → chunk-LYUAM3TG.js} +3 -3
- package/chunks/{chunk-BVAZO4WA.js → chunk-MICHDTBK.js} +3 -3
- package/chunks/{chunk-UCYRA73C.js → chunk-OAYUPGF6.js} +4 -4
- package/chunks/{chunk-XM5NLHYU.js → chunk-OWLJYJ5O.js} +14 -14
- package/chunks/{chunk-BKZFDZ23.js → chunk-QCUFBVIZ.js} +3 -3
- package/chunks/chunk-RE5EZDG2.js +5523 -0
- package/chunks/{chunk-ASUR522M.js → chunk-RRD4XXPU.js} +9 -9
- package/chunks/{chunk-AHTBZC3E.js → chunk-RSIUX3RW.js} +4 -4
- package/chunks/{chunk-BZNEY2ZS.js → chunk-SJBCK2EI.js} +15268 -16053
- package/chunks/{chunk-IOL7D5YV.js → chunk-SQCBHFWN.js} +3 -3
- package/chunks/chunk-TH2LW437.js +7829 -0
- package/chunks/{chunk-WVTBZEQO.js → chunk-TM74SSHC.js} +8 -8
- package/chunks/{chunk-U5FLXGHT.js → chunk-TO35Y326.js} +13 -729
- package/chunks/chunk-TRH2PJSN.js +547 -0
- package/chunks/{chunk-YYRBQVFE.js → chunk-TZFIAMWZ.js} +70 -16
- package/chunks/chunk-UELXHK2Y.js +1950 -0
- package/chunks/{chunk-RJWOYEOG.js → chunk-UEX7PFSE.js} +5 -5
- package/chunks/{chunk-VQG4FT5D.js → chunk-UFHN6RIU.js} +2 -2
- package/chunks/{chunk-JQHOLLTD.js → chunk-UU7PQP6N.js} +9 -9
- package/chunks/{chunk-BFR2CDV5.js → chunk-UV5QWZGE.js} +283 -153
- package/chunks/{chunk-WU6AFRAZ.js → chunk-V36HVTUL.js} +12 -12
- package/chunks/{chunk-IR537GON.js → chunk-VCSFCHAJ.js} +2 -2
- package/chunks/{chunk-YLMN3N25.js → chunk-VIT5ALXF.js} +3 -3
- package/chunks/{chunk-BATRQBOR.js → chunk-VMRRNRMR.js} +41 -41
- package/chunks/{chunk-72CISA2D.js → chunk-VNRY6AWF.js} +89 -41
- package/chunks/chunk-W6UWZFKL.js +298 -0
- package/chunks/{chunk-3KPWWJCI.js → chunk-XFCTUKXR.js} +88 -88
- package/chunks/{chunk-GMT2AZKM.js → chunk-YIQSGNAA.js} +897 -130
- package/chunks/codex-models-7TLJSY3L.js +17 -0
- package/chunks/{commands-TBC2F5CE.js → commands-NEI7L3QA.js} +2836 -1424
- package/chunks/corpus-v1.json +2 -2
- package/chunks/data/appsec-archetypes.json +2 -2
- package/chunks/data/chromium-archetypes.json +1 -1
- package/chunks/data/freebsd-archetypes.json +1 -1
- package/chunks/data/kernel-archetypes.json +2 -2
- package/chunks/db-5AP3JB4W.js +16 -0
- package/chunks/{disclose-EKTWSCGW.js → disclose-LDNKAVRH.js} +13 -11
- package/chunks/{dist-4YICS2J2.js → dist-3FNZIBB4.js} +394 -404
- package/chunks/{dist-4MAW5X6L.js → dist-5YHYNLI3.js} +6 -6
- package/chunks/{dist-FMGSR3DW.js → dist-DD4H6HMQ.js} +13 -5
- package/chunks/dist-KEULE5IQ.js +21914 -0
- package/chunks/dist-XZB53PS5.js +53 -0
- package/chunks/eval-runner-43BO2C4T.js +26 -0
- package/chunks/example-manifest.json +2 -2
- package/chunks/{exploit-agent-45YQOHPJ.js → exploit-agent-N4A5ELBK.js} +4 -4
- package/chunks/{exploit-autoclimb-UZGEMGYT.js → exploit-autoclimb-N7P6KIF5.js} +6 -6
- package/chunks/{exploit-climb-SG23KB2G.js → exploit-climb-WNEJUB5W.js} +12 -12
- package/chunks/fix-Z452M4EC.js +26 -0
- package/chunks/{github-issues-MJ6OYOOU.js → github-issues-IGTTWM7V.js} +7 -7
- package/chunks/harness-QJJJVSG4.js +22 -0
- package/chunks/http-conformance-U5F6GKYG.js +11 -0
- package/chunks/http-sender-I5XFFY35.js +10 -0
- package/chunks/hunt-scan-K6D2V3PX.js +36 -0
- package/chunks/{identity-6ZAIIWOR.js → identity-62SVRW4H.js} +5 -5
- package/chunks/{kernel-primitive-7U6CWHXD.js → kernel-primitive-TKUACPKD.js} +6 -6
- package/chunks/{kernel-vm-runner-3JAU4O6J.js → kernel-vm-runner-RAAO2PGT.js} +6 -6
- package/chunks/memsafety-scan-FCPAXIZE.js +16 -0
- package/chunks/{native-loop-RJCJPOUS.js → native-loop-2ZRJENZ3.js} +17 -18
- package/chunks/{npm-detectors-KB5Y5ZFX.js → npm-detectors-Z2ZIQCN4.js} +6 -6
- package/chunks/npm-dynamic-discovery-5J7FT3XM.js +13 -0
- package/chunks/orchestrate-2GWGNTBF.js +58 -0
- package/chunks/{pre-recon-cve-66EB6G4M.js → pre-recon-cve-X2K2P5YQ.js} +4 -4
- package/chunks/prepare-KYHGFWCJ.js +13 -0
- package/chunks/process-N245QIQG.js +12 -0
- package/chunks/{run-D56MPDKY.js → run-U3XU4CTC.js} +11507 -13632
- package/chunks/{runtime-G7YWIO3B.js → runtime-G75TEWQY.js} +10 -11
- package/chunks/runtime-XFWJTBUO.js +12 -0
- package/chunks/{scan-stream-FHI2FYZE.js → scan-stream-BMOCPKQX.js} +7 -7
- package/chunks/scope-WXI46UHJ.js +21 -0
- package/chunks/{session-store-GZ4A4KYT.js → session-store-27L3ZU73.js} +6 -6
- package/chunks/source-files-REHOM44I.js +12 -0
- package/chunks/{specdrift-WCLH6TTQ.js → specdrift-AFS54WEJ.js} +5 -5
- package/chunks/token-KRWP5JYA.js +72 -0
- package/chunks/token-util-DWTL33S3.js +8 -0
- package/chunks/variant-candidates-YWZORZMK.js +13 -0
- package/chunks/{web-recon-prepass-JJGPEOLE.js → web-recon-prepass-YVMFXCIK.js} +9 -9
- package/cli-path-traversal-fixture.js +352 -0
- package/dashboard/assets/bot-Bg1Tp9_d.js +1 -0
- package/dashboard/assets/dist-B_dDCPbu.js +1 -0
- package/dashboard/assets/findings-page-mayGhNx6.js +5 -0
- package/dashboard/assets/format--susmHX7.js +1 -0
- package/dashboard/assets/input-TuVPR3Zl.js +1 -0
- package/dashboard/assets/jsx-runtime-MGseXjj5.js +3 -0
- package/dashboard/assets/live-page-HWWHX99U.js +1 -0
- package/dashboard/assets/meta-tile-ckHo-w7k.js +1 -0
- package/dashboard/assets/operations-BxZ0OoXO.js +10 -0
- package/dashboard/assets/operations-CMFVrXEe.css +2 -0
- package/dashboard/assets/operations-app-D3d35rgo.js +46 -0
- package/dashboard/assets/overview-page-W_4IteEr.js +1 -0
- package/dashboard/assets/page-header-Bw9AJgBV.js +1 -0
- package/dashboard/assets/scans-page-CgzVXHnn.js +1 -0
- package/dashboard/assets/siren-KQj8QAnJ.js +1 -0
- package/dashboard/assets/table-8EDklulN.js +1 -0
- package/dashboard/assets/tabs-CFHPOwg8.js +1 -0
- package/dashboard/index.html +4 -5
- package/node_modules/node-addon-api/LICENSE.md +9 -0
- package/node_modules/node-addon-api/README.md +95 -0
- package/node_modules/node-addon-api/common.gypi +21 -0
- package/node_modules/node-addon-api/except.gypi +25 -0
- package/node_modules/node-addon-api/index.js +14 -0
- package/node_modules/node-addon-api/napi-inl.deprecated.h +186 -0
- package/node_modules/node-addon-api/napi-inl.h +7250 -0
- package/node_modules/node-addon-api/napi.h +3463 -0
- package/node_modules/node-addon-api/node_addon_api.gyp +42 -0
- package/node_modules/node-addon-api/node_api.gyp +9 -0
- package/node_modules/node-addon-api/noexcept.gypi +26 -0
- package/node_modules/node-addon-api/nothing.c +0 -0
- package/node_modules/node-addon-api/package-support.json +21 -0
- package/node_modules/node-addon-api/package.json +481 -0
- package/node_modules/node-addon-api/tools/README.md +73 -0
- package/node_modules/node-addon-api/tools/check-napi.js +99 -0
- package/node_modules/node-addon-api/tools/clang-format.js +71 -0
- package/node_modules/node-addon-api/tools/conversion.js +301 -0
- package/node_modules/node-gyp-build/LICENSE +21 -0
- package/node_modules/node-gyp-build/README.md +58 -0
- package/node_modules/node-gyp-build/SECURITY.md +5 -0
- package/node_modules/node-gyp-build/bin.js +84 -0
- package/node_modules/node-gyp-build/build-test.js +19 -0
- package/node_modules/node-gyp-build/index.js +6 -0
- package/node_modules/node-gyp-build/node-gyp-build.js +207 -0
- package/node_modules/node-gyp-build/optional.js +7 -0
- package/node_modules/node-gyp-build/package.json +43 -0
- package/node_modules/tree-sitter/LICENSE +21 -0
- package/node_modules/tree-sitter/README.md +90 -0
- package/node_modules/tree-sitter/binding.gyp +76 -0
- package/node_modules/tree-sitter/index.js +895 -0
- package/node_modules/tree-sitter/package.json +62 -0
- package/node_modules/tree-sitter/prebuilds/darwin-arm64/tree-sitter.node +0 -0
- package/node_modules/tree-sitter/prebuilds/darwin-x64/tree-sitter.node +0 -0
- package/node_modules/tree-sitter/prebuilds/linux-x64/tree-sitter.node +0 -0
- package/node_modules/tree-sitter/prebuilds/win32-x64/tree-sitter.node +0 -0
- package/node_modules/tree-sitter/src/addon_data.h +47 -0
- package/node_modules/tree-sitter/src/binding.cc +35 -0
- package/node_modules/tree-sitter/src/conversions.cc +140 -0
- package/node_modules/tree-sitter/src/conversions.h +22 -0
- package/node_modules/tree-sitter/src/language.cc +106 -0
- package/node_modules/tree-sitter/src/language.h +17 -0
- package/node_modules/tree-sitter/src/logger.cc +70 -0
- package/node_modules/tree-sitter/src/logger.h +19 -0
- package/node_modules/tree-sitter/src/lookaheaditerator.cc +122 -0
- package/node_modules/tree-sitter/src/lookaheaditerator.h +33 -0
- package/node_modules/tree-sitter/src/node.cc +1056 -0
- package/node_modules/tree-sitter/src/node.h +30 -0
- package/node_modules/tree-sitter/src/parser.cc +298 -0
- package/node_modules/tree-sitter/src/parser.h +35 -0
- package/node_modules/tree-sitter/src/query.cc +383 -0
- package/node_modules/tree-sitter/src/query.h +39 -0
- package/node_modules/tree-sitter/src/tree.cc +307 -0
- package/node_modules/tree-sitter/src/tree.h +45 -0
- package/node_modules/tree-sitter/src/tree_cursor.cc +213 -0
- package/node_modules/tree-sitter/src/tree_cursor.h +52 -0
- package/node_modules/tree-sitter/tree-sitter.d.ts +211 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/LICENSE +21 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/README.md +21 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/README.md +6 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/include/tree_sitter/api.h +1266 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.c +48 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.h +41 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/array.h +290 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/atomic.h +68 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/clock.h +146 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/error_costs.h +11 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.c +501 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.h +36 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/host.h +21 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.c +221 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.h +299 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/length.h +52 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.c +419 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.h +49 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lib.c +14 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/node.c +774 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.c +2151 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.h +230 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/point.h +62 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/query.c +4134 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reduce_action.h +34 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reusable_node.h +95 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.c +899 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.h +133 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.c +1060 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.h +382 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.c +165 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.h +31 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.c +714 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.h +48 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ICU_SHA +1 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/LICENSE +414 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/README.md +29 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ptypes.h +1 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/umachine.h +448 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/urename.h +1 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf.h +1 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf16.h +733 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf8.h +881 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode.h +50 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib-symbols.txt +23 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib.c +109 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/wasm-stdlib.h +1294 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.c +1823 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.h +31 -0
- package/node_modules/tree-sitter/vendor/tree-sitter/test/fixtures/grammars/.gitkeep +0 -0
- package/node_modules/tree-sitter-c/LICENSE +21 -0
- package/node_modules/tree-sitter-c/README.md +18 -0
- package/node_modules/tree-sitter-c/binding.gyp +20 -0
- package/node_modules/tree-sitter-c/bindings/node/binding.cc +20 -0
- package/node_modules/tree-sitter-c/bindings/node/index.d.ts +28 -0
- package/node_modules/tree-sitter-c/bindings/node/index.js +7 -0
- package/node_modules/tree-sitter-c/grammar.js +1463 -0
- package/node_modules/tree-sitter-c/package.json +108 -0
- package/node_modules/tree-sitter-c/prebuilds/darwin-arm64/tree-sitter-c.node +0 -0
- package/node_modules/tree-sitter-c/prebuilds/darwin-x64/tree-sitter-c.node +0 -0
- package/node_modules/tree-sitter-c/prebuilds/linux-x64/tree-sitter-c.node +0 -0
- package/node_modules/tree-sitter-c/prebuilds/win32-x64/tree-sitter-c.node +0 -0
- package/node_modules/tree-sitter-c/queries/highlights.scm +81 -0
- package/node_modules/tree-sitter-c/queries/tags.scm +9 -0
- package/node_modules/tree-sitter-c/src/grammar.json +9682 -0
- package/node_modules/tree-sitter-c/src/node-types.json +4556 -0
- package/node_modules/tree-sitter-c/src/parser.c +113852 -0
- package/node_modules/tree-sitter-c/src/tree_sitter/alloc.h +54 -0
- package/node_modules/tree-sitter-c/src/tree_sitter/array.h +290 -0
- package/node_modules/tree-sitter-c/src/tree_sitter/parser.h +265 -0
- package/package.json +20 -13
- package/vendor/tree-sitter-0.21.1-node24.json +16 -0
- package/vendor/tree-sitter-0.21.1-node24.tgz +0 -0
- package/chunks/adapt-loop-SMH6V4PD.js +0 -18
- package/chunks/appsec-catalog-CBWHGTEL.js +0 -24
- package/chunks/chunk-242TMK6G.js +0 -110
- package/chunks/chunk-57ZENEX2.js +0 -169
- package/chunks/chunk-ADOLI6DT.js +0 -102
- package/chunks/chunk-ATATQACO.js +0 -471
- package/chunks/chunk-C2WXWFBB.js +0 -1070
- package/chunks/chunk-F3WBKITT.js +0 -687
- package/chunks/chunk-H2FFLZNK.js +0 -3
- package/chunks/chunk-LP3HHYQU.js +0 -245
- package/chunks/chunk-QI233I24.js +0 -333
- package/chunks/chunk-RRMJC3ZE.js +0 -105
- package/chunks/chunk-Z5FA2XOX.js +0 -2798
- package/chunks/cost-ledger-NU63MYZM.js +0 -13
- package/chunks/db-KFWOAUUB.js +0 -16
- package/chunks/eval-runner-7ZF472KV.js +0 -27
- package/chunks/fix-IG7LYXH3.js +0 -12
- package/chunks/harness-7ODOLOWU.js +0 -22
- package/chunks/http-conformance-DU66MZIU.js +0 -11
- package/chunks/http-sender-GWH2IYEA.js +0 -10
- package/chunks/hunt-scan-MMKUOETU.js +0 -38
- package/chunks/memsafety-scan-J7SECV5W.js +0 -16
- package/chunks/npm-dynamic-discovery-AHROOZDB.js +0 -13
- package/chunks/orchestrate-OC2VZN2X.js +0 -62
- package/chunks/pipeline-BZK5BLJR.js +0 -14
- package/chunks/prepare-MYY743TK.js +0 -13
- package/chunks/process-LQRCS5OY.js +0 -13
- package/chunks/replay-runner-45G3VU7X.js +0 -39
- package/chunks/runtime-J7PLXZNM.js +0 -12
- package/chunks/scope-BI7BF4ZY.js +0 -18
- package/chunks/source-files-PWRQR6LY.js +0 -12
- package/chunks/variant-candidates-YERCYMPD.js +0 -13
- package/dashboard/assets/0sec-icon-66SreztZ.gif +0 -0
- package/dashboard/assets/bot-yILPnRgD.js +0 -1
- package/dashboard/assets/chevron-down-BeDJ-Vka.js +0 -1
- package/dashboard/assets/circle-alert-BEnMBMT-.js +0 -1
- package/dashboard/assets/client-DRYsuOGl.js +0 -9
- package/dashboard/assets/copy-Bi5vzoF9.js +0 -1
- package/dashboard/assets/desktop-CXTQonNm.js +0 -32
- package/dashboard/assets/desktop-NOekk4QS.css +0 -1
- package/dashboard/assets/dist-CmX-h7a4.js +0 -1
- package/dashboard/assets/dist-DAwYQmf_.js +0 -45
- package/dashboard/assets/findings-page-CACW9nw2.js +0 -5
- package/dashboard/assets/format-PoISqsES.js +0 -1
- package/dashboard/assets/jsx-runtime-C7oxC63R.js +0 -1
- package/dashboard/assets/live-page-DrgQqQK5.js +0 -1
- package/dashboard/assets/meta-tile-CcskIV_o.js +0 -1
- package/dashboard/assets/operations-BKE8T-vY.css +0 -2
- package/dashboard/assets/operations-D8nUP5_m.js +0 -4
- package/dashboard/assets/operations-app-CQQhG54n.js +0 -2
- package/dashboard/assets/overview-page-DTGS8dPo.js +0 -1
- package/dashboard/assets/page-header-MFVvEtZW.js +0 -1
- package/dashboard/assets/play-Dwo-9xt6.js +0 -1
- package/dashboard/assets/scans-page-ChVtq8Us.js +0 -1
- package/dashboard/assets/search-CiooTLck.js +0 -1
- package/dashboard/assets/siren-CCBwTSuk.js +0 -1
- package/dashboard/assets/table-BYS-nIVA.js +0 -1
- package/dashboard/assets/tabs-DivxbhQy.js +0 -1
- package/dashboard/desktop.html +0 -21
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as
|
|
3
|
-
const require =
|
|
2
|
+
import { createRequire as __0CreateRequire } from "node:module";
|
|
3
|
+
const require = __0CreateRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
homeStateDir,
|
|
6
6
|
runStateDir
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-76KSBWOQ.js";
|
|
8
8
|
import {
|
|
9
9
|
__export
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VCSFCHAJ.js";
|
|
11
11
|
|
|
12
12
|
// packages/db/dist/wasm-shim.js
|
|
13
13
|
import { BetterSQLiteSession } from "drizzle-orm/better-sqlite3/session";
|
|
@@ -99,7 +99,7 @@ var ShimmedDatabase = class {
|
|
|
99
99
|
* only uses it as a setter ("journal_mode = WAL", "foreign_keys = ON"), so
|
|
100
100
|
* we just `exec()` the pragma and swallow errors — some PRAGMAs (notably
|
|
101
101
|
* WAL journal mode) are not supported by node-sqlite3-wasm's VFS and error
|
|
102
|
-
* here, but losing them is acceptable for
|
|
102
|
+
* here, but losing them is acceptable for 0's single-process workload.
|
|
103
103
|
*/
|
|
104
104
|
pragma(query, _opts) {
|
|
105
105
|
try {
|
|
@@ -112,7 +112,7 @@ var ShimmedDatabase = class {
|
|
|
112
112
|
* better-sqlite3's `db.transaction(fn)` returns a callable object with
|
|
113
113
|
* `.deferred`, `.immediate`, `.exclusive`, and `.default` methods, each
|
|
114
114
|
* running `fn` inside a BEGIN/COMMIT of the corresponding isolation level.
|
|
115
|
-
* All three variants are functionally equivalent for
|
|
115
|
+
* All three variants are functionally equivalent for 0's single-writer
|
|
116
116
|
* workload, so we wire them to the same underlying implementation.
|
|
117
117
|
*/
|
|
118
118
|
transaction(fn) {
|
|
@@ -357,29 +357,29 @@ var findings = sqliteTable("findings", {
|
|
|
357
357
|
evidenceResponse: text("evidenceResponse").notNull(),
|
|
358
358
|
evidenceAnalysis: text("evidenceAnalysis"),
|
|
359
359
|
/**
|
|
360
|
-
* JSON-stringified LayerVerdict[] (see @
|
|
360
|
+
* JSON-stringified LayerVerdict[] (see @0/shared types). NULL until
|
|
361
361
|
* the triage stage runs. Stored as text rather than a join table because
|
|
362
362
|
* the array is read-and-write together at finding-save time and we never
|
|
363
|
-
* query individual verdict rows. See
|
|
363
|
+
* query individual verdict rows. See 0#112.
|
|
364
364
|
*/
|
|
365
365
|
layerVerdicts: text("layerVerdicts"),
|
|
366
366
|
impactAssessment: text("impactAssessment"),
|
|
367
367
|
// JSON: ImpactAssessment (reachability/blast/weaponizability/business)
|
|
368
368
|
/**
|
|
369
|
-
* JSON-stringified PocStep[] (see @
|
|
369
|
+
* JSON-stringified PocStep[] (see @0/shared types). NULL when the
|
|
370
370
|
* agent only produced prose evidence (the legacy default). Stored as
|
|
371
371
|
* text rather than a join table because the array is read-and-write
|
|
372
372
|
* together at finding-save time and we never query individual steps.
|
|
373
|
-
* See
|
|
373
|
+
* See 0#170.
|
|
374
374
|
*/
|
|
375
375
|
pocSteps: text("pocSteps"),
|
|
376
376
|
/**
|
|
377
|
-
* JSON-stringified VerificationSpec (see @
|
|
377
|
+
* JSON-stringified VerificationSpec (see @0/shared types). NULL
|
|
378
378
|
* when the agent produced a finding without a deterministic re-check
|
|
379
379
|
* contract — every reader must continue to work in that case. Stored
|
|
380
380
|
* as text because the spec is an opaque blob that the verifier reads
|
|
381
|
-
* whole; we never query individual predicates. See
|
|
382
|
-
*
|
|
381
|
+
* whole; we never query individual predicates. See 0#193 /
|
|
382
|
+
* 0-cloud#111.
|
|
383
383
|
*/
|
|
384
384
|
verificationSpec: text("verificationSpec"),
|
|
385
385
|
/**
|
|
@@ -395,11 +395,11 @@ var findings = sqliteTable("findings", {
|
|
|
395
395
|
/**
|
|
396
396
|
* JSON-stringified PocExecutionReport written when `disclose --target-url`
|
|
397
397
|
* runs the step graph against a live target. NULL until that runs. See
|
|
398
|
-
*
|
|
398
|
+
* 0#171.
|
|
399
399
|
*/
|
|
400
400
|
pocExecution: text("pocExecution"),
|
|
401
401
|
/**
|
|
402
|
-
* JSON-stringified VerificationResult (see @
|
|
402
|
+
* JSON-stringified VerificationResult (see @0/shared
|
|
403
403
|
* `VerificationResultSchema`) — the last deterministic-replay result
|
|
404
404
|
* attached to the finding. NULL when the finding was never verified;
|
|
405
405
|
* readers MUST treat NULL / malformed / statusless payloads as
|
|
@@ -409,6 +409,12 @@ var findings = sqliteTable("findings", {
|
|
|
409
409
|
* `verificationSpec`: the blob is read and written whole.
|
|
410
410
|
*/
|
|
411
411
|
verificationResult: text("verificationResult"),
|
|
412
|
+
/**
|
|
413
|
+
* JSON-stringified safe code-only source-verification summary. NULL when
|
|
414
|
+
* no scoped source workspace/spec was available or data is unusable; it
|
|
415
|
+
* never carries canonical replay status.
|
|
416
|
+
*/
|
|
417
|
+
sourceVerification: text("sourceVerification"),
|
|
412
418
|
/**
|
|
413
419
|
* JSON-stringified Finding["reviewAnnotation"] — the scoped source
|
|
414
420
|
* reference (`path` + line range, optional suggestion / knownMarker)
|
|
@@ -609,9 +615,9 @@ var trustGraphEdges = sqliteTable("trust_graph_edges", {
|
|
|
609
615
|
|
|
610
616
|
// packages/db/dist/database.js
|
|
611
617
|
var DEFAULT_DB_DIR = homeStateDir();
|
|
612
|
-
var DEFAULT_DB_PATH = join(DEFAULT_DB_DIR, "
|
|
618
|
+
var DEFAULT_DB_PATH = join(DEFAULT_DB_DIR, "0.db");
|
|
613
619
|
function resolveOsecDbPath(dbPath) {
|
|
614
|
-
const configuredPath = process.env["
|
|
620
|
+
const configuredPath = process.env["ZERO_DB_PATH"]?.trim();
|
|
615
621
|
return dbPath ?? (configuredPath ? configuredPath : DEFAULT_DB_PATH);
|
|
616
622
|
}
|
|
617
623
|
function resetOsecDatabase(dbPath) {
|
|
@@ -725,7 +731,7 @@ function migrateWalHeaderIfNeeded(path) {
|
|
|
725
731
|
}
|
|
726
732
|
}
|
|
727
733
|
if (hadWalData) {
|
|
728
|
-
console.warn(`[
|
|
734
|
+
console.warn(`[0] Migrated ${path} from WAL mode to rollback mode for WASM engine compatibility. A non-empty WAL sidecar was present and has been removed; any uncommitted transactions from a prior crashed run were discarded.`);
|
|
729
735
|
}
|
|
730
736
|
}
|
|
731
737
|
function clearStaleLockIfAny(path) {
|
|
@@ -744,7 +750,7 @@ function clearStaleLockIfAny(path) {
|
|
|
744
750
|
return;
|
|
745
751
|
try {
|
|
746
752
|
rmSync(lockPath, { recursive: true, force: true });
|
|
747
|
-
console.warn(`[
|
|
753
|
+
console.warn(`[0] Removed stale database lock at ${lockPath} (age ${Math.floor(ageMs / 1e3)}s \u2014 previous holder likely crashed).`);
|
|
748
754
|
} catch {
|
|
749
755
|
}
|
|
750
756
|
}
|
|
@@ -779,7 +785,7 @@ var osecDB = class {
|
|
|
779
785
|
throw error;
|
|
780
786
|
const backupPath = backupCorruptDatabase(path);
|
|
781
787
|
this.initializeDatabase(path);
|
|
782
|
-
console.warn(backupPath ? `[
|
|
788
|
+
console.warn(backupPath ? `[0] Recovered malformed database at ${path}. Backup saved to ${backupPath}.` : `[0] Recovered malformed database state at ${path} by recreating a fresh database.`);
|
|
783
789
|
}
|
|
784
790
|
}
|
|
785
791
|
initializeDatabase(path) {
|
|
@@ -787,9 +793,11 @@ var osecDB = class {
|
|
|
787
793
|
this.sqlite.pragma("foreign_keys = ON");
|
|
788
794
|
ensureDatabaseHealthy(this.sqlite);
|
|
789
795
|
this.db = createDrizzleFromShim(this.sqlite, { schema: schema_exports });
|
|
790
|
-
this.sqlite.
|
|
791
|
-
|
|
792
|
-
|
|
796
|
+
this.sqlite.transaction(() => {
|
|
797
|
+
this.sqlite.exec(SCHEMA_TABLES_SQL);
|
|
798
|
+
this.migrate();
|
|
799
|
+
this.sqlite.exec(SCHEMA_INDEXES_SQL);
|
|
800
|
+
})();
|
|
793
801
|
}
|
|
794
802
|
initializeReadOnlyDatabase(path) {
|
|
795
803
|
this.sqlite = createShimmedDatabase(path);
|
|
@@ -797,7 +805,7 @@ var osecDB = class {
|
|
|
797
805
|
this.db = createDrizzleFromShim(this.sqlite, { schema: schema_exports });
|
|
798
806
|
}
|
|
799
807
|
/**
|
|
800
|
-
* Upgrade databases created by older
|
|
808
|
+
* Upgrade databases created by older 0 versions.
|
|
801
809
|
*
|
|
802
810
|
* SCHEMA_TABLES_SQL (above) now contains every table and every column from
|
|
803
811
|
* the drizzle schema, so fresh installs need no patching. This method only
|
|
@@ -806,7 +814,7 @@ var osecDB = class {
|
|
|
806
814
|
* table_info is cached by SQLite) and the ALTERs are no-ops when the
|
|
807
815
|
* column is already present, so running on a fresh DB is harmless.
|
|
808
816
|
*
|
|
809
|
-
* See: https://github.com/0sec-labs/
|
|
817
|
+
* See: https://github.com/0sec-labs/0/issues/420
|
|
810
818
|
*/
|
|
811
819
|
migrate() {
|
|
812
820
|
const cols = this.sqlite.prepare("PRAGMA table_info(findings)").all();
|
|
@@ -871,6 +879,9 @@ var osecDB = class {
|
|
|
871
879
|
if (!colNames.has("reviewAnnotation")) {
|
|
872
880
|
this.sqlite.exec("ALTER TABLE findings ADD COLUMN reviewAnnotation TEXT");
|
|
873
881
|
}
|
|
882
|
+
if (!colNames.has("sourceVerification")) {
|
|
883
|
+
this.sqlite.exec("ALTER TABLE findings ADD COLUMN sourceVerification TEXT");
|
|
884
|
+
}
|
|
874
885
|
this.sqlite.exec("UPDATE findings SET fingerprint = id WHERE fingerprint IS NULL OR fingerprint = ''");
|
|
875
886
|
this.sqlite.exec("UPDATE findings SET triageStatus = 'new' WHERE triageStatus IS NULL OR triageStatus = ''");
|
|
876
887
|
this.sqlite.exec(`
|
|
@@ -1362,6 +1373,7 @@ var osecDB = class {
|
|
|
1362
1373
|
const semanticDedupeJson = finding.semanticDedupe ? JSON.stringify(finding.semanticDedupe) : null;
|
|
1363
1374
|
const verificationResultJson = serializeFindingVerificationResult(finding.verification_result);
|
|
1364
1375
|
const reviewAnnotationJson = serializeFindingReviewAnnotation(finding.reviewAnnotation);
|
|
1376
|
+
const sourceVerificationJson = serializeFindingSourceVerification(finding.sourceVerification);
|
|
1365
1377
|
const candidateFindingRank = finding.findingRank;
|
|
1366
1378
|
const findingRank = typeof candidateFindingRank === "number" && Number.isSafeInteger(candidateFindingRank) && candidateFindingRank > 0 ? candidateFindingRank : null;
|
|
1367
1379
|
const derivedEvidence = deriveEvidenceFromPocSteps(finding);
|
|
@@ -1398,6 +1410,7 @@ var osecDB = class {
|
|
|
1398
1410
|
findingRank,
|
|
1399
1411
|
verificationResult: verificationResultJson,
|
|
1400
1412
|
reviewAnnotation: reviewAnnotationJson,
|
|
1413
|
+
sourceVerification: sourceVerificationJson,
|
|
1401
1414
|
timestamp: finding.timestamp
|
|
1402
1415
|
}).onConflictDoUpdate({
|
|
1403
1416
|
target: findings.id,
|
|
@@ -1429,6 +1442,7 @@ var osecDB = class {
|
|
|
1429
1442
|
findingRank,
|
|
1430
1443
|
verificationResult: verificationResultJson,
|
|
1431
1444
|
reviewAnnotation: reviewAnnotationJson,
|
|
1445
|
+
sourceVerification: sourceVerificationJson,
|
|
1432
1446
|
timestamp: finding.timestamp
|
|
1433
1447
|
}
|
|
1434
1448
|
}).run();
|
|
@@ -1438,11 +1452,10 @@ var osecDB = class {
|
|
|
1438
1452
|
return this.db.select().from(findings).where(eq(findings.id, findingId)).get();
|
|
1439
1453
|
}
|
|
1440
1454
|
/**
|
|
1441
|
-
* Read path for the
|
|
1442
|
-
* `
|
|
1443
|
-
*
|
|
1444
|
-
*
|
|
1445
|
-
* `{ ...mapped, ...db.getFindingReviewFields(id) }`.
|
|
1455
|
+
* Read path for the persisted `verification_result`, `reviewAnnotation`,
|
|
1456
|
+
* and `sourceVerification` fields. The first two retain their existing
|
|
1457
|
+
* source-fix gate semantics; a source-only check is never replay evidence.
|
|
1458
|
+
* Each key is omitted when absent, including for pre-migration rows.
|
|
1446
1459
|
*/
|
|
1447
1460
|
getFindingReviewFields(findingId) {
|
|
1448
1461
|
return restoreFindingReviewFields(this.getFinding(findingId));
|
|
@@ -1949,7 +1962,7 @@ var osecDB = class {
|
|
|
1949
1962
|
const result = this.sqlite.prepare(`DELETE FROM workers WHERE status IN (${placeholders})`).run(...values);
|
|
1950
1963
|
return result.changes;
|
|
1951
1964
|
}
|
|
1952
|
-
// ── Persistent credential store (
|
|
1965
|
+
// ── Persistent credential store (0#771) ──
|
|
1953
1966
|
/**
|
|
1954
1967
|
* Upsert a discovered foothold keyed by (credentialKind, valueHash). First
|
|
1955
1968
|
* write records the discovery attribution (target/finding/scan/turn);
|
|
@@ -2019,7 +2032,7 @@ var osecDB = class {
|
|
|
2019
2032
|
const limit = query.limit ?? 500;
|
|
2020
2033
|
return this.sqlite.prepare(`SELECT * FROM persistent_credentials ${whereSql} ORDER BY lastSeenAt DESC LIMIT ${limit}`).all(...params);
|
|
2021
2034
|
}
|
|
2022
|
-
// ── Trust graph edges (
|
|
2035
|
+
// ── Trust graph edges (0#771) ──
|
|
2023
2036
|
/**
|
|
2024
2037
|
* Upsert a directed trust edge keyed by
|
|
2025
2038
|
* (srcKind, srcId, dstKind, dstId, relation). Re-observing an edge refreshes
|
|
@@ -2167,6 +2180,38 @@ function parseFindingReviewAnnotation(value) {
|
|
|
2167
2180
|
return void 0;
|
|
2168
2181
|
return parsed;
|
|
2169
2182
|
}
|
|
2183
|
+
function parseFindingSourceVerification(value) {
|
|
2184
|
+
const parsed = parseJsonObjectColumn(value);
|
|
2185
|
+
if (!parsed)
|
|
2186
|
+
return void 0;
|
|
2187
|
+
const status = parsed.status;
|
|
2188
|
+
const totalPredicates = parsed.totalPredicates;
|
|
2189
|
+
const matchedPredicates = parsed.matchedPredicates;
|
|
2190
|
+
const notMatchedPredicates = parsed.notMatchedPredicates;
|
|
2191
|
+
const inconclusivePredicates = parsed.inconclusivePredicates;
|
|
2192
|
+
const behaviorPending = parsed.behaviorPending;
|
|
2193
|
+
if (status !== "matched" && status !== "not_confirmed" && status !== "inconclusive" || typeof totalPredicates !== "number" || !Number.isSafeInteger(totalPredicates) || totalPredicates < 0 || typeof matchedPredicates !== "number" || !Number.isSafeInteger(matchedPredicates) || matchedPredicates < 0 || typeof notMatchedPredicates !== "number" || !Number.isSafeInteger(notMatchedPredicates) || notMatchedPredicates < 0 || typeof inconclusivePredicates !== "number" || !Number.isSafeInteger(inconclusivePredicates) || inconclusivePredicates < 0 || typeof behaviorPending !== "boolean") {
|
|
2194
|
+
return void 0;
|
|
2195
|
+
}
|
|
2196
|
+
const countSum = matchedPredicates + notMatchedPredicates + inconclusivePredicates;
|
|
2197
|
+
if (!Number.isSafeInteger(countSum) || countSum !== totalPredicates)
|
|
2198
|
+
return void 0;
|
|
2199
|
+
if (status === "matched" && (totalPredicates === 0 || matchedPredicates !== totalPredicates || notMatchedPredicates !== 0 || inconclusivePredicates !== 0) || status === "not_confirmed" && (notMatchedPredicates === 0 || inconclusivePredicates !== 0) || status === "inconclusive" && inconclusivePredicates === 0 && totalPredicates !== 0) {
|
|
2200
|
+
return void 0;
|
|
2201
|
+
}
|
|
2202
|
+
return {
|
|
2203
|
+
status,
|
|
2204
|
+
totalPredicates,
|
|
2205
|
+
matchedPredicates,
|
|
2206
|
+
notMatchedPredicates,
|
|
2207
|
+
inconclusivePredicates,
|
|
2208
|
+
behaviorPending
|
|
2209
|
+
};
|
|
2210
|
+
}
|
|
2211
|
+
function serializeFindingSourceVerification(value) {
|
|
2212
|
+
const usable = parseFindingSourceVerification(value);
|
|
2213
|
+
return usable ? JSON.stringify(usable) : null;
|
|
2214
|
+
}
|
|
2170
2215
|
function serializeFindingVerificationResult(value) {
|
|
2171
2216
|
const usable = parseFindingVerificationResult(value);
|
|
2172
2217
|
return usable ? JSON.stringify(usable) : null;
|
|
@@ -2180,9 +2225,11 @@ function restoreFindingReviewFields(row) {
|
|
|
2180
2225
|
return {};
|
|
2181
2226
|
const verificationResult = parseFindingVerificationResult(row.verificationResult);
|
|
2182
2227
|
const reviewAnnotation = parseFindingReviewAnnotation(row.reviewAnnotation);
|
|
2228
|
+
const sourceVerification = parseFindingSourceVerification(row.sourceVerification);
|
|
2183
2229
|
return {
|
|
2184
2230
|
...verificationResult ? { verification_result: verificationResult } : {},
|
|
2185
|
-
...reviewAnnotation ? { reviewAnnotation } : {}
|
|
2231
|
+
...reviewAnnotation ? { reviewAnnotation } : {},
|
|
2232
|
+
...sourceVerification ? { sourceVerification } : {}
|
|
2186
2233
|
};
|
|
2187
2234
|
}
|
|
2188
2235
|
function deriveEvidenceFromPocSteps(finding) {
|
|
@@ -2276,6 +2323,7 @@ CREATE TABLE IF NOT EXISTS findings (
|
|
|
2276
2323
|
findingRank INTEGER,
|
|
2277
2324
|
verificationResult TEXT,
|
|
2278
2325
|
reviewAnnotation TEXT,
|
|
2326
|
+
sourceVerification TEXT,
|
|
2279
2327
|
timestamp INTEGER NOT NULL
|
|
2280
2328
|
);
|
|
2281
2329
|
|
|
@@ -2484,24 +2532,24 @@ var STATE_DB_FILE = "state.db";
|
|
|
2484
2532
|
var REPORT_FILE = "report.json";
|
|
2485
2533
|
function normalizeRunId(value) {
|
|
2486
2534
|
if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(value)) {
|
|
2487
|
-
throw new Error(`Invalid
|
|
2535
|
+
throw new Error(`Invalid 0 run id ${JSON.stringify(value)}.`);
|
|
2488
2536
|
}
|
|
2489
2537
|
return value;
|
|
2490
2538
|
}
|
|
2491
2539
|
function resolveOsecRunStorage(options = {}) {
|
|
2492
2540
|
const env = options.env ?? process.env;
|
|
2493
|
-
const cloudRunId = env["
|
|
2541
|
+
const cloudRunId = env["ZERO_CLOUD_SCAN_ID"]?.trim() || void 0;
|
|
2494
2542
|
let runId = normalizeRunId(options.runId ?? cloudRunId ?? randomUUID2());
|
|
2495
2543
|
const stateDir = homeStateDir(options.homeDir);
|
|
2496
|
-
const configuredRunDir = env["
|
|
2497
|
-
const configuredDbPath = options.dbPath ?? (env["
|
|
2544
|
+
const configuredRunDir = env["ZERO_RUN_DIR"]?.trim() || void 0;
|
|
2545
|
+
const configuredDbPath = options.dbPath ?? (env["ZERO_DB_PATH"]?.trim() || void 0);
|
|
2498
2546
|
let runDir = configuredRunDir ? resolve(configuredRunDir) : runStateDir(runId, options.homeDir);
|
|
2499
2547
|
if (options.resume && !configuredRunDir && !configuredDbPath && !existsSync2(runDir)) {
|
|
2500
2548
|
const runsDir = join2(stateDir, "runs");
|
|
2501
2549
|
if (existsSync2(runsDir)) {
|
|
2502
2550
|
const matches = readdirSync(runsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name.startsWith(runId));
|
|
2503
2551
|
if (matches.length > 1) {
|
|
2504
|
-
throw new Error(`
|
|
2552
|
+
throw new Error(`0 run id prefix '${runId}' is ambiguous.`);
|
|
2505
2553
|
}
|
|
2506
2554
|
const match = matches[0];
|
|
2507
2555
|
if (match) {
|
|
@@ -2511,13 +2559,13 @@ function resolveOsecRunStorage(options = {}) {
|
|
|
2511
2559
|
}
|
|
2512
2560
|
}
|
|
2513
2561
|
if (!isAbsolute(runDir)) {
|
|
2514
|
-
throw new Error(`
|
|
2562
|
+
throw new Error(`0 run directory must be absolute: ${JSON.stringify(runDir)}.`);
|
|
2515
2563
|
}
|
|
2516
2564
|
let dbPath = configuredDbPath ? configuredDbPath === ":memory:" ? configuredDbPath : resolve(configuredDbPath) : join2(runDir, STATE_DB_FILE);
|
|
2517
|
-
const configuredReportPath = env["
|
|
2565
|
+
const configuredReportPath = env["ZERO_REPORT_PATH"]?.trim() || void 0;
|
|
2518
2566
|
const reportPath = configuredReportPath ? resolve(configuredReportPath) : !configuredDbPath || configuredRunDir ? join2(runDir, REPORT_FILE) : void 0;
|
|
2519
2567
|
if (options.resume && !configuredDbPath && !existsSync2(dbPath)) {
|
|
2520
|
-
const legacyDbPath = join2(stateDir, "
|
|
2568
|
+
const legacyDbPath = join2(stateDir, "0.db");
|
|
2521
2569
|
if (existsSync2(legacyDbPath))
|
|
2522
2570
|
dbPath = legacyDbPath;
|
|
2523
2571
|
}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __0CreateRequire } from "node:module";
|
|
3
|
+
const require = __0CreateRequire(import.meta.url);
|
|
4
|
+
|
|
5
|
+
// packages/core/dist/runtime/process.js
|
|
6
|
+
import { spawn } from "node:child_process";
|
|
7
|
+
import { tmpdir } from "node:os";
|
|
8
|
+
import { join, resolve } from "node:path";
|
|
9
|
+
import { writeFileSync } from "node:fs";
|
|
10
|
+
var dim = (text) => `\x1B[2m${text}\x1B[0m`;
|
|
11
|
+
function formatToolDetail(input) {
|
|
12
|
+
const inp = input;
|
|
13
|
+
if (inp?.file_path)
|
|
14
|
+
return String(inp.file_path).split("/").slice(-2).join("/");
|
|
15
|
+
if (inp?.command)
|
|
16
|
+
return String(inp.command).slice(0, 60);
|
|
17
|
+
if (inp?.pattern)
|
|
18
|
+
return String(inp.pattern).slice(0, 40);
|
|
19
|
+
if (inp?.path)
|
|
20
|
+
return String(inp.path).slice(0, 60);
|
|
21
|
+
if (inp?.content)
|
|
22
|
+
return "(writing file)";
|
|
23
|
+
return "";
|
|
24
|
+
}
|
|
25
|
+
function friendlyToolName(name) {
|
|
26
|
+
const stripped = name.replace(/^mcp__\w+__/, "");
|
|
27
|
+
return stripped.split("_").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
28
|
+
}
|
|
29
|
+
function showToolCall(onToolCall, name, input) {
|
|
30
|
+
const rawName = name || "tool";
|
|
31
|
+
if (/^(ToolSearch|Read|Glob|Grep|Write|Edit|Bash|LSP|Agent)$/i.test(rawName))
|
|
32
|
+
return;
|
|
33
|
+
const toolName = friendlyToolName(rawName);
|
|
34
|
+
const detail = formatToolDetail(input);
|
|
35
|
+
if (onToolCall) {
|
|
36
|
+
onToolCall(toolName, detail);
|
|
37
|
+
}
|
|
38
|
+
if (process.stderr.isTTY && !onToolCall) {
|
|
39
|
+
process.stderr.write(dim(` ${toolName}${detail ? ": " + detail : ""}
|
|
40
|
+
`));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
var RUNTIME_COMMANDS = {
|
|
44
|
+
claude: "claude",
|
|
45
|
+
codex: "codex",
|
|
46
|
+
gemini: "gemini"
|
|
47
|
+
};
|
|
48
|
+
function resolveCliEntrypoint() {
|
|
49
|
+
return resolve(process.argv[1] ?? join(process.cwd(), "dist", "index.js"));
|
|
50
|
+
}
|
|
51
|
+
function buildOsecMcpCommandArgs(context) {
|
|
52
|
+
const cliEntrypoint = resolveCliEntrypoint();
|
|
53
|
+
const args = [
|
|
54
|
+
cliEntrypoint,
|
|
55
|
+
"mcp-server",
|
|
56
|
+
"--target",
|
|
57
|
+
context.target ?? "",
|
|
58
|
+
"--scan-id",
|
|
59
|
+
context.scanId ?? "no-scan-id"
|
|
60
|
+
];
|
|
61
|
+
if (context.mcp?.dbPath) {
|
|
62
|
+
args.push("--db-path", context.mcp.dbPath);
|
|
63
|
+
}
|
|
64
|
+
if (context.mcp?.scopeFile) {
|
|
65
|
+
args.push("--scope", context.mcp.scopeFile);
|
|
66
|
+
}
|
|
67
|
+
if (context.mcp?.rateLimit) {
|
|
68
|
+
args.push("--rate-limit", context.mcp.rateLimit);
|
|
69
|
+
}
|
|
70
|
+
if (context.mcp?.allowScanners) {
|
|
71
|
+
args.push("--allow-scanners");
|
|
72
|
+
}
|
|
73
|
+
return args;
|
|
74
|
+
}
|
|
75
|
+
function buildClaudeMcpConfig(context) {
|
|
76
|
+
return JSON.stringify({
|
|
77
|
+
mcpServers: {
|
|
78
|
+
"0": {
|
|
79
|
+
command: process.execPath,
|
|
80
|
+
args: buildOsecMcpCommandArgs(context)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function describeSpawnFailure(err, command, argv) {
|
|
86
|
+
const code = err?.code;
|
|
87
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
88
|
+
if (code === "E2BIG" || message.includes("E2BIG")) {
|
|
89
|
+
const bytes = argv.reduce((total, arg) => total + Buffer.byteLength(arg, "utf8") + 1, 0);
|
|
90
|
+
return `${command} could not be started: the prompt is too large for one command line (${bytes} bytes of arguments, over this system's limit). Narrow the run \u2014 a smaller --subsystem or scope, or a lower --batch-size \u2014 so less content is sent in a single request.`;
|
|
91
|
+
}
|
|
92
|
+
return message;
|
|
93
|
+
}
|
|
94
|
+
var ProcessRuntime = class {
|
|
95
|
+
type;
|
|
96
|
+
config;
|
|
97
|
+
command;
|
|
98
|
+
constructor(config) {
|
|
99
|
+
this.type = config.type;
|
|
100
|
+
this.config = config;
|
|
101
|
+
this.command = RUNTIME_COMMANDS[config.type] ?? config.type;
|
|
102
|
+
}
|
|
103
|
+
async execute(prompt, context) {
|
|
104
|
+
const start = Date.now();
|
|
105
|
+
const args = this.buildArgs(prompt, context);
|
|
106
|
+
const env = this.buildEnv(context);
|
|
107
|
+
const onToolCall = this.config.onToolCall;
|
|
108
|
+
return new Promise((resolve2) => {
|
|
109
|
+
let stdout = "";
|
|
110
|
+
let stderr = "";
|
|
111
|
+
let resultText = "";
|
|
112
|
+
let timedOut = false;
|
|
113
|
+
const isJsonStream = args.includes("stream-json") || args.includes("--json");
|
|
114
|
+
let proc;
|
|
115
|
+
try {
|
|
116
|
+
proc = spawn(this.command, args, {
|
|
117
|
+
cwd: this.config.cwd ?? process.cwd(),
|
|
118
|
+
env: { ...process.env, ...env },
|
|
119
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
120
|
+
});
|
|
121
|
+
} catch (err) {
|
|
122
|
+
resolve2({
|
|
123
|
+
output: "",
|
|
124
|
+
exitCode: 1,
|
|
125
|
+
timedOut: false,
|
|
126
|
+
durationMs: Date.now() - start,
|
|
127
|
+
error: describeSpawnFailure(err, this.command, args)
|
|
128
|
+
});
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
proc.stdout.on("data", (chunk) => {
|
|
132
|
+
const text = chunk.toString();
|
|
133
|
+
stdout += text;
|
|
134
|
+
if (isJsonStream) {
|
|
135
|
+
for (const line of text.split("\n")) {
|
|
136
|
+
if (!line.trim())
|
|
137
|
+
continue;
|
|
138
|
+
try {
|
|
139
|
+
const event = JSON.parse(line);
|
|
140
|
+
if (event.type === "assistant" && event.message?.content) {
|
|
141
|
+
for (const block of event.message.content) {
|
|
142
|
+
if (block.type === "text") {
|
|
143
|
+
resultText += block.text;
|
|
144
|
+
this.config.onThinking?.(block.text);
|
|
145
|
+
} else if (block.type === "tool_use") {
|
|
146
|
+
showToolCall(onToolCall, block.name, block.input);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
} else if (event.type === "result") {
|
|
150
|
+
resultText = event.result || resultText;
|
|
151
|
+
}
|
|
152
|
+
if (event.type === "item.started" && event.item?.type === "command_execution") {
|
|
153
|
+
showToolCall(onToolCall, "shell", { command: event.item.command });
|
|
154
|
+
}
|
|
155
|
+
if (event.type === "item.completed" && event.item) {
|
|
156
|
+
if (event.item.type === "agent_message" && event.item.text) {
|
|
157
|
+
resultText += event.item.text;
|
|
158
|
+
this.config.onThinking?.(event.item.text);
|
|
159
|
+
} else if (event.item.type === "command_execution" && event.item.command) {
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
} catch {
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
proc.stderr.on("data", (chunk) => {
|
|
168
|
+
const text = chunk.toString();
|
|
169
|
+
stderr += text;
|
|
170
|
+
if (/permission|approve|allow.*tool/i.test(stderr) && stderr.length > 500) {
|
|
171
|
+
proc.kill("SIGTERM");
|
|
172
|
+
stderr += "\n[0] Subprocess killed: MCP tools require interactive approval. Use --runtime api instead.";
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
const timer = setTimeout(() => {
|
|
176
|
+
timedOut = true;
|
|
177
|
+
proc.kill("SIGTERM");
|
|
178
|
+
setTimeout(() => proc.kill("SIGKILL"), 5e3);
|
|
179
|
+
}, this.config.timeout);
|
|
180
|
+
proc.on("close", (code) => {
|
|
181
|
+
clearTimeout(timer);
|
|
182
|
+
const output = isJsonStream ? (resultText || stdout).trim() : stdout.trim();
|
|
183
|
+
resolve2({
|
|
184
|
+
output,
|
|
185
|
+
exitCode: code,
|
|
186
|
+
timedOut,
|
|
187
|
+
durationMs: Date.now() - start,
|
|
188
|
+
error: code !== 0 ? stderr.trim() || void 0 : void 0
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
proc.on("error", (err) => {
|
|
192
|
+
clearTimeout(timer);
|
|
193
|
+
resolve2({
|
|
194
|
+
output: "",
|
|
195
|
+
exitCode: 1,
|
|
196
|
+
timedOut: false,
|
|
197
|
+
durationMs: Date.now() - start,
|
|
198
|
+
error: describeSpawnFailure(err, this.command, args)
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
async isAvailable() {
|
|
204
|
+
const attempt = (timeoutMs) => new Promise((resolve2) => {
|
|
205
|
+
const proc = spawn(this.command, ["--version"], {
|
|
206
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
207
|
+
});
|
|
208
|
+
let settled = false;
|
|
209
|
+
const finish = (ok) => {
|
|
210
|
+
if (settled)
|
|
211
|
+
return;
|
|
212
|
+
settled = true;
|
|
213
|
+
resolve2(ok);
|
|
214
|
+
};
|
|
215
|
+
proc.on("close", (code) => finish(code === 0));
|
|
216
|
+
proc.on("error", () => finish(false));
|
|
217
|
+
setTimeout(() => {
|
|
218
|
+
proc.kill();
|
|
219
|
+
finish(false);
|
|
220
|
+
}, timeoutMs).unref?.();
|
|
221
|
+
});
|
|
222
|
+
if (await attempt(5e3))
|
|
223
|
+
return true;
|
|
224
|
+
return attempt(15e3);
|
|
225
|
+
}
|
|
226
|
+
buildArgs(prompt, context) {
|
|
227
|
+
switch (this.type) {
|
|
228
|
+
case "claude": {
|
|
229
|
+
const args = ["-p", prompt, "--verbose", "--output-format", "stream-json"];
|
|
230
|
+
if (context?.mcp?.enableTargetTools && context.target && context.scanId) {
|
|
231
|
+
args.push("--mcp-config", buildClaudeMcpConfig(context), "--dangerously-skip-permissions");
|
|
232
|
+
}
|
|
233
|
+
if (context?.systemPrompt) {
|
|
234
|
+
args.push("--system-prompt", context.systemPrompt);
|
|
235
|
+
}
|
|
236
|
+
if (this.config.outputSchema) {
|
|
237
|
+
args.push("--json-schema", JSON.stringify(this.config.outputSchema));
|
|
238
|
+
}
|
|
239
|
+
return args;
|
|
240
|
+
}
|
|
241
|
+
case "codex": {
|
|
242
|
+
const args = [
|
|
243
|
+
"exec",
|
|
244
|
+
"--skip-git-repo-check",
|
|
245
|
+
"--json"
|
|
246
|
+
];
|
|
247
|
+
if (this.config.model) {
|
|
248
|
+
args.push("--model", this.config.model);
|
|
249
|
+
}
|
|
250
|
+
if (context?.mcp?.enableTargetTools && context.target && context.scanId) {
|
|
251
|
+
throw new Error("Codex CLI MCP target tools are not supported. Use the direct ChatGPT Codex provider for live target scans.");
|
|
252
|
+
}
|
|
253
|
+
if (this.config.outputSchema) {
|
|
254
|
+
const schemaPath = join(tmpdir(), `0-schema-${Date.now()}.json`);
|
|
255
|
+
writeFileSync(schemaPath, JSON.stringify(this.config.outputSchema));
|
|
256
|
+
args.push("--output-schema", schemaPath);
|
|
257
|
+
}
|
|
258
|
+
args.push(prompt);
|
|
259
|
+
return args;
|
|
260
|
+
}
|
|
261
|
+
case "gemini": {
|
|
262
|
+
const args = ["-p", prompt, "--output-format", "stream-json"];
|
|
263
|
+
return args;
|
|
264
|
+
}
|
|
265
|
+
default:
|
|
266
|
+
return ["-p", prompt];
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
buildEnv(context) {
|
|
270
|
+
const env = {
|
|
271
|
+
...this.config.env
|
|
272
|
+
};
|
|
273
|
+
if (context?.target) {
|
|
274
|
+
env["ZERO_TARGET"] = context.target;
|
|
275
|
+
}
|
|
276
|
+
if (context?.findings) {
|
|
277
|
+
env["ZERO_FINDINGS"] = context.findings;
|
|
278
|
+
}
|
|
279
|
+
if (context?.templateId) {
|
|
280
|
+
env["ZERO_TEMPLATE_ID"] = context.templateId;
|
|
281
|
+
}
|
|
282
|
+
if (context?.mcp?.auth) {
|
|
283
|
+
env["ZERO_MCP_AUTH_JSON"] = JSON.stringify(context.mcp.auth);
|
|
284
|
+
}
|
|
285
|
+
if (context?.mcp?.attributionHeaders) {
|
|
286
|
+
env["ZERO_MCP_ATTRIBUTION_HEADERS_JSON"] = JSON.stringify(context.mcp.attributionHeaders);
|
|
287
|
+
}
|
|
288
|
+
if (context?.mcp?.attributionUaToken) {
|
|
289
|
+
env["ZERO_MCP_ATTRIBUTION_UA_TOKEN"] = context.mcp.attributionUaToken;
|
|
290
|
+
}
|
|
291
|
+
return env;
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
export {
|
|
296
|
+
describeSpawnFailure,
|
|
297
|
+
ProcessRuntime
|
|
298
|
+
};
|