0sec-cli 0.21.4 → 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/0.js +56 -56
- package/README.md +48 -63
- package/chunks/{adapt-loop-IGBRQAXO.js → adapt-loop-7I57LXXR.js} +4 -4
- package/chunks/{artifact-scraper-LNQJUORS.js → artifact-scraper-PYZ3RU3O.js} +2 -2
- package/chunks/{assumption-mining-4MJTP6H5.js → assumption-mining-MFLF43IR.js} +16 -16
- package/chunks/{chunk-Z3IKZX3X.js → chunk-23DG5YKS.js} +1 -1
- package/chunks/{chunk-BACXRTQ4.js → chunk-2GV4HQKE.js} +87 -767
- package/chunks/{chunk-QZVG3BG4.js → chunk-5IBCBQEH.js} +1 -2
- package/chunks/{chunk-NDJU5ZZ7.js → chunk-5MWAG3FT.js} +3 -3
- package/chunks/{chunk-PC6RCKQV.js → chunk-76KSBWOQ.js} +59 -26
- package/chunks/chunk-7DEHG7YT.js +2143 -0
- package/chunks/{chunk-CL5KAUM6.js → chunk-7UFUALR2.js} +274 -8
- package/chunks/{chunk-IMGWPNQM.js → chunk-CAYANSH6.js} +67 -574
- package/chunks/{chunk-P6YG6TEZ.js → chunk-DKSCN2AB.js} +1 -1
- package/chunks/{chunk-O6SD4A36.js → chunk-DM5C5L5D.js} +1 -1
- package/chunks/{chunk-FAH6V4QM.js → chunk-EGZGZFAH.js} +1116 -2291
- package/chunks/chunk-HR2TU42B.js +1228 -0
- package/chunks/{chunk-TF46UWFU.js → chunk-HUNAPTKV.js} +1 -1
- package/chunks/chunk-IO7R7WBM.js +114 -0
- package/chunks/{chunk-W4JOXE4N.js → chunk-IXT64DV5.js} +709 -1929
- package/chunks/{chunk-HBKCGJAV.js → chunk-LCRTAQN2.js} +1 -1
- package/chunks/{chunk-WPQLBN4S.js → chunk-LPTRPRZR.js} +1 -1
- package/chunks/{chunk-Y5H6E24H.js → chunk-LYUAM3TG.js} +1 -1
- package/chunks/{chunk-NOPBXZUV.js → chunk-MICHDTBK.js} +1 -1
- package/chunks/{chunk-CAJJRUTV.js → chunk-OAYUPGF6.js} +1 -1
- package/chunks/{chunk-FWAYJ2IV.js → chunk-OWLJYJ5O.js} +8 -8
- package/chunks/chunk-RE5EZDG2.js +5523 -0
- package/chunks/{chunk-RF5QGKLR.js → chunk-RRD4XXPU.js} +3 -3
- package/chunks/{chunk-2WSXFFJZ.js → chunk-RSIUX3RW.js} +2 -2
- package/chunks/{chunk-ANDKY54G.js → chunk-SJBCK2EI.js} +4019 -7299
- package/chunks/{chunk-G34QP2XW.js → chunk-TM74SSHC.js} +1 -1
- package/chunks/{chunk-VOAXLO4A.js → chunk-TO35Y326.js} +5 -721
- package/chunks/{chunk-SBMB4OL3.js → chunk-TZFIAMWZ.js} +62 -8
- package/chunks/chunk-UELXHK2Y.js +1950 -0
- package/chunks/{chunk-YHWWF4QY.js → chunk-UU7PQP6N.js} +3 -3
- package/chunks/{chunk-E2UOY5PJ.js → chunk-UV5QWZGE.js} +12 -70
- package/chunks/{chunk-YA4PUM4H.js → chunk-VMRRNRMR.js} +1 -1
- package/chunks/{chunk-WZISK5VC.js → chunk-VNRY6AWF.js} +53 -7
- package/chunks/{chunk-ER3SUMYJ.js → chunk-W6UWZFKL.js} +0 -195
- package/chunks/{chunk-5T6D5BVY.js → chunk-XFCTUKXR.js} +1 -1
- package/chunks/{chunk-YPOA3W4O.js → chunk-YIQSGNAA.js} +875 -108
- package/chunks/{codex-models-TYYV4JNN.js → codex-models-7TLJSY3L.js} +5 -3
- package/chunks/{commands-WF5RG4I2.js → commands-NEI7L3QA.js} +2151 -3642
- package/chunks/{db-U3WQZVAO.js → db-5AP3JB4W.js} +3 -3
- package/chunks/{disclose-67GZCDBO.js → disclose-LDNKAVRH.js} +10 -8
- package/chunks/{dist-F6X62TQK.js → dist-3FNZIBB4.js} +223 -192
- package/chunks/{dist-EVTN3UTT.js → dist-5YHYNLI3.js} +2 -2
- package/chunks/{dist-ACC3DZUZ.js → dist-DD4H6HMQ.js} +3 -1
- package/chunks/{eval-runner-SA6OUGHZ.js → eval-runner-43BO2C4T.js} +11 -11
- package/chunks/{exploit-agent-36Q7XQFP.js → exploit-agent-N4A5ELBK.js} +1 -1
- package/chunks/{exploit-autoclimb-J4OTSTZ6.js → exploit-autoclimb-N7P6KIF5.js} +1 -1
- package/chunks/{exploit-climb-PYEJDIC4.js → exploit-climb-WNEJUB5W.js} +2 -2
- package/chunks/fix-Z452M4EC.js +26 -0
- package/chunks/{harness-GDUMKGSE.js → harness-QJJJVSG4.js} +3 -3
- package/chunks/{hunt-scan-UDJSCISU.js → hunt-scan-K6D2V3PX.js} +14 -14
- package/chunks/{identity-JTIVJSV7.js → identity-62SVRW4H.js} +1 -1
- package/chunks/{kernel-primitive-F2IXUFAX.js → kernel-primitive-TKUACPKD.js} +2 -2
- package/chunks/{kernel-vm-runner-276LHIOV.js → kernel-vm-runner-RAAO2PGT.js} +2 -2
- package/chunks/{memsafety-scan-NHUOGTEX.js → memsafety-scan-FCPAXIZE.js} +2 -2
- package/chunks/{native-loop-3BSYVDUI.js → native-loop-2ZRJENZ3.js} +10 -10
- package/chunks/{npm-detectors-VIYJXKFQ.js → npm-detectors-Z2ZIQCN4.js} +2 -2
- package/chunks/orchestrate-2GWGNTBF.js +58 -0
- package/chunks/{process-PNMC36JI.js → process-N245QIQG.js} +1 -4
- package/chunks/{run-CBGE6DRQ.js → run-U3XU4CTC.js} +9940 -12572
- package/chunks/{runtime-PXO5G6UV.js → runtime-G75TEWQY.js} +4 -5
- package/chunks/{scope-NJHIDDTN.js → scope-WXI46UHJ.js} +4 -1
- package/chunks/{session-store-46WBZM22.js → session-store-27L3ZU73.js} +2 -2
- package/chunks/{variant-candidates-UH2WC2HA.js → variant-candidates-YWZORZMK.js} +3 -3
- package/chunks/{web-recon-prepass-SFXU44SS.js → web-recon-prepass-YVMFXCIK.js} +3 -3
- 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-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 +2 -3
- 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 +10 -3
- package/vendor/tree-sitter-0.21.1-node24.json +16 -0
- package/vendor/tree-sitter-0.21.1-node24.tgz +0 -0
- package/chunks/chunk-CGHCEN7W.js +0 -169
- package/chunks/chunk-CXKDWFNO.js +0 -102
- package/chunks/chunk-GIQKESMN.js +0 -687
- package/chunks/chunk-HPQZHOIU.js +0 -67
- package/chunks/chunk-PD2BBBKT.js +0 -245
- package/chunks/chunk-WF5W75WY.js +0 -1070
- package/chunks/fix-J2KBRJDV.js +0 -12
- package/chunks/orchestrate-DHBFRTSI.js +0 -59
- package/chunks/replay-runner-LK2XFIVG.js +0 -39
- 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-BT7RkC4q.js +0 -32
- package/dashboard/assets/desktop-OaBI0E0e.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-B4rwF6fZ.js +0 -5
- package/dashboard/assets/format-LNQSSpn6.js +0 -1
- package/dashboard/assets/jsx-runtime-C7oxC63R.js +0 -1
- package/dashboard/assets/live-page-DoNwpPAO.js +0 -1
- package/dashboard/assets/meta-tile-BMtBC-Qq.js +0 -1
- package/dashboard/assets/operations-app-ER0gg7GN.js +0 -2
- package/dashboard/assets/operations-e2CGYKB1.js +0 -4
- package/dashboard/assets/overview-page-CmeWH17A.js +0 -1
- package/dashboard/assets/page-header-CIJyycfz.js +0 -1
- package/dashboard/assets/play-Dwo-9xt6.js +0 -1
- package/dashboard/assets/scans-page-CuhzWhHx.js +0 -1
- package/dashboard/assets/search-CiooTLck.js +0 -1
- package/dashboard/assets/siren-CCBwTSuk.js +0 -1
- package/dashboard/assets/table-BgsSBdke.js +0 -1
- package/dashboard/assets/tabs-vn6v7Bk6.js +0 -1
- package/dashboard/desktop.html +0 -21
|
@@ -3,7 +3,7 @@ import { createRequire as __0CreateRequire } from "node:module";
|
|
|
3
3
|
const require = __0CreateRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
homeStateDir
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-76KSBWOQ.js";
|
|
7
7
|
|
|
8
8
|
// packages/core/dist/scope/waf-detect.js
|
|
9
9
|
function readHeader(headers, name) {
|
|
@@ -839,6 +839,13 @@ async function cachedJson(cache, source, key, fetcher, opts = {}) {
|
|
|
839
839
|
cache.set(source, key, value, opts.ttlMs);
|
|
840
840
|
return value;
|
|
841
841
|
}
|
|
842
|
+
var HttpStatusError = class extends Error {
|
|
843
|
+
status;
|
|
844
|
+
constructor(status, url) {
|
|
845
|
+
super(`HTTP ${status} for ${url}`);
|
|
846
|
+
this.status = status;
|
|
847
|
+
}
|
|
848
|
+
};
|
|
842
849
|
async function fetchJson(url, init = {}, opts = {}) {
|
|
843
850
|
const controller = new AbortController();
|
|
844
851
|
const timer = setTimeout(() => controller.abort(), opts.timeoutMs ?? 2e4);
|
|
@@ -848,7 +855,7 @@ async function fetchJson(url, init = {}, opts = {}) {
|
|
|
848
855
|
signal: controller.signal
|
|
849
856
|
});
|
|
850
857
|
if (!res.ok) {
|
|
851
|
-
throw new
|
|
858
|
+
throw new HttpStatusError(res.status, url);
|
|
852
859
|
}
|
|
853
860
|
return await res.json();
|
|
854
861
|
} finally {
|
|
@@ -2020,11 +2027,46 @@ function snippet(body) {
|
|
|
2020
2027
|
}
|
|
2021
2028
|
|
|
2022
2029
|
// packages/core/dist/intel/nvd.js
|
|
2030
|
+
var NVD_COOLDOWN_MS = 3e4;
|
|
2031
|
+
var nvdRequests = /* @__PURE__ */ new WeakMap();
|
|
2032
|
+
var NvdRateLimitedError = class extends Error {
|
|
2033
|
+
};
|
|
2034
|
+
async function nvdJson(url, opts) {
|
|
2035
|
+
const transport = opts.fetchImpl ?? globalThis.fetch;
|
|
2036
|
+
let state = nvdRequests.get(transport);
|
|
2037
|
+
if (!state) {
|
|
2038
|
+
state = { tail: Promise.resolve(), blockedUntil: 0 };
|
|
2039
|
+
nvdRequests.set(transport, state);
|
|
2040
|
+
}
|
|
2041
|
+
const queue = state;
|
|
2042
|
+
const request = queue.tail.then(async () => {
|
|
2043
|
+
if (Date.now() < queue.blockedUntil)
|
|
2044
|
+
throw new NvdRateLimitedError();
|
|
2045
|
+
try {
|
|
2046
|
+
return await fetchJson(url, { headers: nvdHeaders(opts.headers) }, opts);
|
|
2047
|
+
} catch (error) {
|
|
2048
|
+
if (error instanceof HttpStatusError && error.status === 429) {
|
|
2049
|
+
queue.blockedUntil = Date.now() + NVD_COOLDOWN_MS;
|
|
2050
|
+
console.warn("[intel] NVD rate limited; pausing requests for 30s");
|
|
2051
|
+
throw new NvdRateLimitedError();
|
|
2052
|
+
}
|
|
2053
|
+
throw error;
|
|
2054
|
+
}
|
|
2055
|
+
});
|
|
2056
|
+
queue.tail = request.then(() => void 0, () => void 0);
|
|
2057
|
+
return request;
|
|
2058
|
+
}
|
|
2023
2059
|
async function lookupNvdCve(input, opts = {}) {
|
|
2024
2060
|
const cveId = normalizeCveId(input.cveId);
|
|
2025
2061
|
const cache = new IntelCache(input.cacheDir);
|
|
2026
|
-
|
|
2027
|
-
|
|
2062
|
+
try {
|
|
2063
|
+
const raw = await cachedJson(cache, "nvd-cve", cveId, () => nvdJson(`https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=${encodeURIComponent(cveId)}`, opts), { offline: input.offline, ttlMs: input.ttlMs });
|
|
2064
|
+
return parseNvdResponse(raw)[0] ?? null;
|
|
2065
|
+
} catch (error) {
|
|
2066
|
+
if (error instanceof NvdRateLimitedError)
|
|
2067
|
+
return null;
|
|
2068
|
+
throw error;
|
|
2069
|
+
}
|
|
2028
2070
|
}
|
|
2029
2071
|
async function searchNvdSimilar(input, opts = {}) {
|
|
2030
2072
|
const terms = uniqueStrings([input.cwe, ...input.keywords ?? []]);
|
|
@@ -2037,8 +2079,14 @@ async function searchNvdSimilar(input, opts = {}) {
|
|
|
2037
2079
|
keywordSearch: terms.join(" "),
|
|
2038
2080
|
resultsPerPage: String(limit)
|
|
2039
2081
|
});
|
|
2040
|
-
|
|
2041
|
-
|
|
2082
|
+
try {
|
|
2083
|
+
const raw = await cachedJson(cache, "nvd-search", key, () => nvdJson(`https://services.nvd.nist.gov/rest/json/cves/2.0?${query}`, opts), { offline: input.offline, ttlMs: input.ttlMs });
|
|
2084
|
+
return parseNvdResponse(raw);
|
|
2085
|
+
} catch (error) {
|
|
2086
|
+
if (error instanceof NvdRateLimitedError)
|
|
2087
|
+
return [];
|
|
2088
|
+
throw error;
|
|
2089
|
+
}
|
|
2042
2090
|
}
|
|
2043
2091
|
async function searchNvdTargetHistory(input, opts = {}) {
|
|
2044
2092
|
const terms = targetHistorySearchTerms(input);
|
|
@@ -2052,8 +2100,14 @@ async function searchNvdTargetHistory(input, opts = {}) {
|
|
|
2052
2100
|
keywordSearch: term,
|
|
2053
2101
|
resultsPerPage: String(limit)
|
|
2054
2102
|
});
|
|
2055
|
-
|
|
2056
|
-
|
|
2103
|
+
try {
|
|
2104
|
+
const raw = await cachedJson(cache, "nvd-target-history", key, () => nvdJson(`https://services.nvd.nist.gov/rest/json/cves/2.0?${query}`, opts), { offline: input.offline, ttlMs: input.ttlMs });
|
|
2105
|
+
return parseNvdResponse(raw);
|
|
2106
|
+
} catch (error) {
|
|
2107
|
+
if (error instanceof NvdRateLimitedError)
|
|
2108
|
+
return [];
|
|
2109
|
+
throw error;
|
|
2110
|
+
}
|
|
2057
2111
|
}));
|
|
2058
2112
|
return results.flat();
|
|
2059
2113
|
}
|