@cdxgen/cdxgen 13.0.1 → 13.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -16
- package/bin/audit.js +6 -0
- package/bin/cdxgen.js +141 -7
- package/bin/evinse.js +3 -1
- package/data/component-tags.json +8 -1
- package/data/crypto-oid.json +88 -12
- package/data/frameworks-list.json +86 -1
- package/data/remediations.json +1167 -0
- package/data/rules/ai-bom.yaml +78 -0
- package/data/rules/asar-archives.yaml +1 -1
- package/data/rules/build-fidelity.yaml +782 -0
- package/data/rules/cargo-rust.yaml +132 -0
- package/data/rules/mcp-servers.yaml +122 -0
- package/data/rules/package-integrity.yaml +13 -13
- package/lib/audit/index.js +48 -4
- package/lib/audit/scoring.js +2 -8
- package/lib/audit/targets.js +6 -1
- package/lib/cli/bomAssembly.js +32 -1
- package/lib/cli/cliOptions.js +94 -7
- package/lib/cli/index.js +268 -49
- package/lib/cli/jsBom.js +91 -5
- package/lib/cli/jvmBom.js +1515 -1314
- package/lib/cli/managedBom.js +249 -28
- package/lib/cli/nativeBom.js +986 -10
- package/lib/core/activity.js +120 -2
- package/lib/core/buildLedger.js +799 -0
- package/lib/core/deferredExit.js +141 -0
- package/lib/core/env.js +108 -2
- package/lib/core/fs.js +60 -0
- package/lib/core/logger.js +12 -99
- package/lib/core/severity.js +16 -0
- package/lib/core/syncFileWriter.js +106 -0
- package/lib/core/userAgent.js +151 -0
- package/lib/ecosystems/cargoCache.js +364 -0
- package/lib/ecosystems/caxa.js +13 -5
- package/lib/ecosystems/cppEvidence.js +40 -2
- package/lib/ecosystems/ecosystems.js +250 -91
- package/lib/ecosystems/golem.js +11 -1
- package/lib/ecosystems/gradleutils.js +498 -17
- package/lib/ecosystems/kosi.js +1256 -0
- package/lib/ecosystems/parsers-crystal.js +179 -0
- package/lib/ecosystems/parsers-dotnet.js +69 -39
- package/lib/ecosystems/parsers-elm.js +816 -0
- package/lib/ecosystems/parsers-gleam.js +1 -1
- package/lib/ecosystems/parsers-js.js +26 -0
- package/lib/ecosystems/parsers-julia.js +268 -0
- package/lib/ecosystems/parsers-jvm.js +9 -0
- package/lib/ecosystems/parsers-lua.js +218 -0
- package/lib/ecosystems/parsers-misc.js +188 -2
- package/lib/ecosystems/parsers-nim.js +221 -0
- package/lib/ecosystems/parsers-opam.js +180 -0
- package/lib/ecosystems/parsers-perl.js +277 -0
- package/lib/ecosystems/parsers-python.js +172 -36
- package/lib/ecosystems/parsers-r.js +148 -0
- package/lib/ecosystems/parsers-rebar.js +411 -0
- package/lib/ecosystems/parsers-rust.js +944 -19
- package/lib/ecosystems/parsers-spack.js +204 -0
- package/lib/ecosystems/parsers-stack.js +264 -0
- package/lib/ecosystems/parsers-terraform.js +194 -0
- package/lib/ecosystems/pypiClassifiers.js +326 -0
- package/lib/ecosystems/pythonutils.js +49 -1
- package/lib/ecosystems/rubyutils.js +13 -0
- package/lib/ecosystems/rusi.js +126 -6
- package/lib/evinser/evinser.js +141 -13
- package/lib/helpers/agenticToolutils.js +925 -0
- package/lib/helpers/remote/dependency-track.js +81 -14
- package/lib/inventory/agentFormulationParser.js +57 -4
- package/lib/inventory/aiCollector.js +504 -10
- package/lib/inventory/aiInventory.js +12 -0
- package/lib/inventory/analyzer.js +488 -30
- package/lib/inventory/astWorker.js +6 -0
- package/lib/inventory/auditCategories.js +17 -0
- package/lib/inventory/cbomutils.js +30 -0
- package/lib/inventory/cdxrs.js +7 -2
- package/lib/inventory/communityAiConfigParser.js +215 -2
- package/lib/inventory/depsUtils.js +72 -0
- package/lib/inventory/dosai.js +508 -22
- package/lib/inventory/envcontext.js +215 -24
- package/lib/inventory/evidenceUtils.js +13 -0
- package/lib/inventory/fetchBatch.js +131 -2
- package/lib/inventory/fetchRate.js +74 -11
- package/lib/inventory/forgeEnricher.js +3 -2
- package/lib/inventory/jvmToolEnv.js +594 -0
- package/lib/inventory/mcpConfigParser.js +166 -2
- package/lib/inventory/mcpDiscovery.js +11 -0
- package/lib/inventory/mcpServerManifest.js +389 -0
- package/lib/inventory/mcpbBundle.js +419 -0
- package/lib/inventory/osinfo.js +1 -0
- package/lib/inventory/plugins.js +3 -0
- package/lib/inventory/protobom.js +54 -88
- package/lib/inventory/protobomLoader.js +4 -0
- package/lib/inventory/rustFormulationParser.js +1 -1
- package/lib/inventory/source.js +10 -4
- package/lib/inventory/stylePackageRefs.js +41 -0
- package/lib/inventory/svelteUtils.js +524 -0
- package/lib/inventory/toolRequirements.js +903 -0
- package/lib/managers/binary.js +24 -0
- package/lib/managers/docker.js +26 -5
- package/lib/parsers/huggingfaceUtils.js +15 -7
- package/lib/parsers/onnx.js +294 -0
- package/lib/parsers/safetensors.js +114 -0
- package/lib/server/server.js +1 -1
- package/lib/stages/postgen/annotationBuilder.js +97 -0
- package/lib/stages/postgen/auditBom.js +76 -79
- package/lib/stages/postgen/introspection/annotate.js +320 -0
- package/lib/stages/postgen/introspection/commandFacts.js +293 -0
- package/lib/stages/postgen/introspection/emit.js +192 -0
- package/lib/stages/postgen/introspection/formulationEvidence.js +427 -0
- package/lib/stages/postgen/introspection/markers.js +250 -0
- package/lib/stages/postgen/introspection/reflect.js +1214 -0
- package/lib/stages/postgen/introspection/report.js +1208 -0
- package/lib/stages/postgen/introspection/score.js +1067 -0
- package/lib/stages/postgen/introspection/shapeCommand.js +304 -0
- package/lib/stages/postgen/parentEdge.js +156 -0
- package/lib/stages/postgen/postgen.js +284 -3
- package/lib/stages/postgen/ruleEngine.js +17 -0
- package/lib/stages/pregen/envAudit.js +42 -2
- package/lib/stages/pregen/pregen.js +1171 -6
- package/lib/third-party/arborist/snapshots/calc-dep-flags.test.cjs +462 -0
- package/lib/validator/bomValidator.js +11 -2
- package/package.json +26 -26
- package/types/lib/audit/index.d.ts.map +1 -1
- package/types/lib/audit/scoring.d.ts +2 -8
- package/types/lib/audit/scoring.d.ts.map +1 -1
- package/types/lib/audit/targets.d.ts.map +1 -1
- package/types/lib/cli/bomAssembly.d.ts.map +1 -1
- package/types/lib/cli/cliOptions.d.ts +2 -1
- package/types/lib/cli/cliOptions.d.ts.map +1 -1
- package/types/lib/cli/index.d.ts +10 -2
- package/types/lib/cli/index.d.ts.map +1 -1
- package/types/lib/cli/jsBom.d.ts +23 -0
- package/types/lib/cli/jsBom.d.ts.map +1 -1
- package/types/lib/cli/jvmBom.d.ts.map +1 -1
- package/types/lib/cli/managedBom.d.ts +33 -0
- package/types/lib/cli/managedBom.d.ts.map +1 -1
- package/types/lib/cli/nativeBom.d.ts +88 -8
- package/types/lib/cli/nativeBom.d.ts.map +1 -1
- package/types/lib/core/activity.d.ts.map +1 -1
- package/types/lib/core/buildLedger.d.ts +272 -0
- package/types/lib/core/buildLedger.d.ts.map +1 -0
- package/types/lib/core/deferredExit.d.ts +84 -0
- package/types/lib/core/deferredExit.d.ts.map +1 -0
- package/types/lib/core/env.d.ts +43 -1
- package/types/lib/core/env.d.ts.map +1 -1
- package/types/lib/core/fs.d.ts +21 -0
- package/types/lib/core/fs.d.ts.map +1 -1
- package/types/lib/core/logger.d.ts +2 -11
- package/types/lib/core/logger.d.ts.map +1 -1
- package/types/lib/core/severity.d.ts +11 -0
- package/types/lib/core/severity.d.ts.map +1 -0
- package/types/lib/core/syncFileWriter.d.ts +33 -0
- package/types/lib/core/syncFileWriter.d.ts.map +1 -0
- package/types/lib/core/userAgent.d.ts +56 -0
- package/types/lib/core/userAgent.d.ts.map +1 -0
- package/types/lib/ecosystems/cargoCache.d.ts +75 -0
- package/types/lib/ecosystems/cargoCache.d.ts.map +1 -0
- package/types/lib/ecosystems/caxa.d.ts.map +1 -1
- package/types/lib/ecosystems/cppEvidence.d.ts +1 -1
- package/types/lib/ecosystems/cppEvidence.d.ts.map +1 -1
- package/types/lib/ecosystems/ecosystems.d.ts +15 -1
- package/types/lib/ecosystems/ecosystems.d.ts.map +1 -1
- package/types/lib/ecosystems/gradleutils.d.ts +53 -0
- package/types/lib/ecosystems/gradleutils.d.ts.map +1 -1
- package/types/lib/ecosystems/kosi.d.ts +73 -0
- package/types/lib/ecosystems/kosi.d.ts.map +1 -0
- package/types/lib/ecosystems/parsers-crystal.d.ts +27 -0
- package/types/lib/ecosystems/parsers-crystal.d.ts.map +1 -0
- package/types/lib/ecosystems/parsers-dotnet.d.ts +19 -0
- package/types/lib/ecosystems/parsers-dotnet.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-elm.d.ts +79 -0
- package/types/lib/ecosystems/parsers-elm.d.ts.map +1 -0
- package/types/lib/ecosystems/parsers-js.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-julia.d.ts +57 -0
- package/types/lib/ecosystems/parsers-julia.d.ts.map +1 -0
- package/types/lib/ecosystems/parsers-jvm.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-lua.d.ts +50 -0
- package/types/lib/ecosystems/parsers-lua.d.ts.map +1 -0
- package/types/lib/ecosystems/parsers-misc.d.ts +23 -0
- package/types/lib/ecosystems/parsers-misc.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-nim.d.ts +43 -0
- package/types/lib/ecosystems/parsers-nim.d.ts.map +1 -0
- package/types/lib/ecosystems/parsers-opam.d.ts +31 -0
- package/types/lib/ecosystems/parsers-opam.d.ts.map +1 -0
- package/types/lib/ecosystems/parsers-perl.d.ts +36 -0
- package/types/lib/ecosystems/parsers-perl.d.ts.map +1 -0
- package/types/lib/ecosystems/parsers-python.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-r.d.ts +35 -0
- package/types/lib/ecosystems/parsers-r.d.ts.map +1 -0
- package/types/lib/ecosystems/parsers-rebar.d.ts +42 -0
- package/types/lib/ecosystems/parsers-rebar.d.ts.map +1 -0
- package/types/lib/ecosystems/parsers-rust.d.ts +199 -0
- package/types/lib/ecosystems/parsers-rust.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-spack.d.ts +33 -0
- package/types/lib/ecosystems/parsers-spack.d.ts.map +1 -0
- package/types/lib/ecosystems/parsers-stack.d.ts +35 -0
- package/types/lib/ecosystems/parsers-stack.d.ts.map +1 -0
- package/types/lib/ecosystems/parsers-terraform.d.ts +34 -0
- package/types/lib/ecosystems/parsers-terraform.d.ts.map +1 -0
- package/types/lib/ecosystems/pypiClassifiers.d.ts +80 -0
- package/types/lib/ecosystems/pypiClassifiers.d.ts.map +1 -0
- package/types/lib/ecosystems/pythonutils.d.ts +21 -1
- package/types/lib/ecosystems/pythonutils.d.ts.map +1 -1
- package/types/lib/ecosystems/rubyutils.d.ts.map +1 -1
- package/types/lib/ecosystems/rusi.d.ts.map +1 -1
- package/types/lib/evinser/evinser.d.ts +34 -1
- package/types/lib/evinser/evinser.d.ts.map +1 -1
- package/types/lib/helpers/agenticToolutils.d.ts +87 -0
- package/types/lib/helpers/agenticToolutils.d.ts.map +1 -0
- package/types/lib/helpers/remote/dependency-track.d.ts +45 -4
- package/types/lib/helpers/remote/dependency-track.d.ts.map +1 -1
- package/types/lib/inventory/agentFormulationParser.d.ts.map +1 -1
- package/types/lib/inventory/aiCollector.d.ts.map +1 -1
- package/types/lib/inventory/aiInventory.d.ts.map +1 -1
- package/types/lib/inventory/analyzer.d.ts.map +1 -1
- package/types/lib/inventory/auditCategories.d.ts +12 -0
- package/types/lib/inventory/auditCategories.d.ts.map +1 -1
- package/types/lib/inventory/cbomutils.d.ts.map +1 -1
- package/types/lib/inventory/communityAiConfigParser.d.ts.map +1 -1
- package/types/lib/inventory/depsUtils.d.ts.map +1 -1
- package/types/lib/inventory/dosai.d.ts +43 -0
- package/types/lib/inventory/dosai.d.ts.map +1 -1
- package/types/lib/inventory/envcontext.d.ts.map +1 -1
- package/types/lib/inventory/evidenceUtils.d.ts.map +1 -1
- package/types/lib/inventory/fetchBatch.d.ts +43 -0
- package/types/lib/inventory/fetchBatch.d.ts.map +1 -1
- package/types/lib/inventory/fetchRate.d.ts +9 -6
- package/types/lib/inventory/fetchRate.d.ts.map +1 -1
- package/types/lib/inventory/forgeEnricher.d.ts.map +1 -1
- package/types/lib/inventory/jvmToolEnv.d.ts +190 -0
- package/types/lib/inventory/jvmToolEnv.d.ts.map +1 -0
- package/types/lib/inventory/mcpConfigParser.d.ts.map +1 -1
- package/types/lib/inventory/mcpDiscovery.d.ts.map +1 -1
- package/types/lib/inventory/mcpServerManifest.d.ts +19 -0
- package/types/lib/inventory/mcpServerManifest.d.ts.map +1 -0
- package/types/lib/inventory/mcpbBundle.d.ts +19 -0
- package/types/lib/inventory/mcpbBundle.d.ts.map +1 -0
- package/types/lib/inventory/osinfo.d.ts.map +1 -1
- package/types/lib/inventory/plugins.d.ts.map +1 -1
- package/types/lib/inventory/protobom.d.ts +18 -13
- package/types/lib/inventory/protobom.d.ts.map +1 -1
- package/types/lib/inventory/protobomLoader.d.ts.map +1 -1
- package/types/lib/inventory/source.d.ts.map +1 -1
- package/types/lib/inventory/stylePackageRefs.d.ts +17 -0
- package/types/lib/inventory/stylePackageRefs.d.ts.map +1 -0
- package/types/lib/inventory/svelteUtils.d.ts +124 -0
- package/types/lib/inventory/svelteUtils.d.ts.map +1 -0
- package/types/lib/inventory/toolRequirements.d.ts +216 -0
- package/types/lib/inventory/toolRequirements.d.ts.map +1 -0
- package/types/lib/managers/binary.d.ts.map +1 -1
- package/types/lib/managers/docker.d.ts.map +1 -1
- package/types/lib/parsers/huggingfaceUtils.d.ts +8 -1
- package/types/lib/parsers/huggingfaceUtils.d.ts.map +1 -1
- package/types/lib/parsers/onnx.d.ts +28 -0
- package/types/lib/parsers/onnx.d.ts.map +1 -0
- package/types/lib/parsers/safetensors.d.ts +22 -0
- package/types/lib/parsers/safetensors.d.ts.map +1 -0
- package/types/lib/stages/postgen/annotationBuilder.d.ts +53 -0
- package/types/lib/stages/postgen/annotationBuilder.d.ts.map +1 -0
- package/types/lib/stages/postgen/auditBom.d.ts.map +1 -1
- package/types/lib/stages/postgen/introspection/annotate.d.ts +81 -0
- package/types/lib/stages/postgen/introspection/annotate.d.ts.map +1 -0
- package/types/lib/stages/postgen/introspection/commandFacts.d.ts +32 -0
- package/types/lib/stages/postgen/introspection/commandFacts.d.ts.map +1 -0
- package/types/lib/stages/postgen/introspection/emit.d.ts +71 -0
- package/types/lib/stages/postgen/introspection/emit.d.ts.map +1 -0
- package/types/lib/stages/postgen/introspection/formulationEvidence.d.ts +154 -0
- package/types/lib/stages/postgen/introspection/formulationEvidence.d.ts.map +1 -0
- package/types/lib/stages/postgen/introspection/markers.d.ts +58 -0
- package/types/lib/stages/postgen/introspection/markers.d.ts.map +1 -0
- package/types/lib/stages/postgen/introspection/reflect.d.ts +77 -0
- package/types/lib/stages/postgen/introspection/reflect.d.ts.map +1 -0
- package/types/lib/stages/postgen/introspection/report.d.ts +85 -0
- package/types/lib/stages/postgen/introspection/report.d.ts.map +1 -0
- package/types/lib/stages/postgen/introspection/score.d.ts +149 -0
- package/types/lib/stages/postgen/introspection/score.d.ts.map +1 -0
- package/types/lib/stages/postgen/introspection/shapeCommand.d.ts +79 -0
- package/types/lib/stages/postgen/introspection/shapeCommand.d.ts.map +1 -0
- package/types/lib/stages/postgen/parentEdge.d.ts +35 -0
- package/types/lib/stages/postgen/parentEdge.d.ts.map +1 -0
- package/types/lib/stages/postgen/postgen.d.ts +35 -2
- package/types/lib/stages/postgen/postgen.d.ts.map +1 -1
- package/types/lib/stages/postgen/ruleEngine.d.ts.map +1 -1
- package/types/lib/stages/pregen/envAudit.d.ts.map +1 -1
- package/types/lib/stages/pregen/pregen.d.ts +131 -0
- package/types/lib/stages/pregen/pregen.d.ts.map +1 -1
- package/types/lib/validator/bomValidator.d.ts.map +1 -1
|
@@ -2,18 +2,21 @@
|
|
|
2
2
|
* Per-host rate policy for batched registry fetches.
|
|
3
3
|
*
|
|
4
4
|
* This is the single source of truth for the JS transport's concurrency and
|
|
5
|
-
* minimum-interval decisions.
|
|
5
|
+
* minimum-interval decisions. Every number is shared with the Rust transport
|
|
6
6
|
* (`cdxgen-plugins-bin/thirdparty/cdxrs/src/fetch/rate.rs`); a change to one
|
|
7
7
|
* side must be reflected in the other, and `fetchRate.poku.js` pins them so a
|
|
8
|
-
* drift is visible.
|
|
8
|
+
* drift is visible. crates.io and package.elm-lang.org are routed so that their
|
|
9
|
+
* requests never reach the Rust transport, which makes this table the one that
|
|
10
|
+
* governs them in practice — their rows are mirrored there regardless, because
|
|
11
|
+
* two tables that disagree are a bug waiting for the routing to change.
|
|
9
12
|
*
|
|
10
13
|
* Why a per-host table rather than a single global interval: a single-registry
|
|
11
14
|
* project — which is to say, almost every npm project — has exactly one host,
|
|
12
15
|
* so a conservative per-host cap *is* the global cap. Applying crates.io's
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
16
|
+
* one-per-second policy to every host would cap an npm run at one request a
|
|
17
|
+
* second, orders of magnitude slower than that registry asks for. Hosts that
|
|
18
|
+
* publish a limit get an interval; hosts that do not are bounded by the
|
|
19
|
+
* per-host concurrency cap alone, and by whatever `Retry-After` they send.
|
|
17
20
|
*/
|
|
18
21
|
|
|
19
22
|
import { readEnvironmentVariable } from "../core/activity.js";
|
|
@@ -48,13 +51,18 @@ import { readEnvironmentVariable } from "../core/activity.js";
|
|
|
48
51
|
* Suffix match is used so `index.crates.io` inherits `crates.io`.
|
|
49
52
|
*/
|
|
50
53
|
const HOST_POLICIES = [
|
|
51
|
-
// crates.io's
|
|
54
|
+
// crates.io's crawler policy asks for at most one request per second, made
|
|
55
|
+
// serially. It is a condition of use rather than a throughput hint, so the
|
|
56
|
+
// interval is a full second and the concurrency is 1: with more than one
|
|
57
|
+
// request in flight the gate would still average a second apiece but would
|
|
58
|
+
// deliver them in bursts, which is the thing the policy rules out. The
|
|
59
|
+
// budget is per IP and does not improve with a token.
|
|
52
60
|
{
|
|
53
61
|
host: "crates.io",
|
|
54
|
-
anonInterval:
|
|
55
|
-
anonConcurrency:
|
|
56
|
-
authInterval:
|
|
57
|
-
authConcurrency:
|
|
62
|
+
anonInterval: 1000,
|
|
63
|
+
anonConcurrency: 1,
|
|
64
|
+
authInterval: 1000,
|
|
65
|
+
authConcurrency: 1,
|
|
58
66
|
},
|
|
59
67
|
// GitHub: 60 req/h anonymous, 5000 req/h authenticated. The limit is an
|
|
60
68
|
// hourly budget rather than a rate, so a batch of a few hundred lookups is
|
|
@@ -88,6 +96,61 @@ const HOST_POLICIES = [
|
|
|
88
96
|
authInterval: 250,
|
|
89
97
|
authConcurrency: 4,
|
|
90
98
|
},
|
|
99
|
+
// package.elm-lang.org publishes no limit: its robots.txt carries no
|
|
100
|
+
// `Crawl-delay` and the registry has no terms of use or documented API. What
|
|
101
|
+
// it does have is a single community-run origin rather than a CDN, so it is
|
|
102
|
+
// held to the same gentle allowance as the other unpublished host in this
|
|
103
|
+
// table instead of the CDN default. Like crates.io, its requests are kept off
|
|
104
|
+
// the Rust transport to leave one gate in charge; rate.rs still carries the
|
|
105
|
+
// same row so the two tables state one policy.
|
|
106
|
+
// Maven Central publishes no numeric limit. What it publishes instead is a
|
|
107
|
+
// policy: consumption limits are enforced against aggregate traffic, the
|
|
108
|
+
// thresholds are unpublished and moving downward, and the named offenders are
|
|
109
|
+
// "CI/CD platforms, security scanners, and other services that generate
|
|
110
|
+
// outsized traffic" — which is cdxgen's exact job description. A block is an
|
|
111
|
+
// escalating ban of up to 30 days, not a per-request 429, so the cost of
|
|
112
|
+
// being slightly too fast is losing Maven resolution for a month rather than
|
|
113
|
+
// retrying a second later. That asymmetry, not a published number, is what
|
|
114
|
+
// sets these rows.
|
|
115
|
+
//
|
|
116
|
+
// repo1 is the artifact store: Cloudflare-fronted (`cf-cache-status` on every
|
|
117
|
+
// response), and a POM fetch that hits the edge cache never reaches Sonatype.
|
|
118
|
+
// It gets a real allowance — 100 ms and 8 in flight, so ~10 req/s sustained —
|
|
119
|
+
// which is half the CDN default and orders of magnitude below anything that
|
|
120
|
+
// would show up in the top few percent of Central's traffic.
|
|
121
|
+
{
|
|
122
|
+
host: "repo1.maven.org",
|
|
123
|
+
anonInterval: 100,
|
|
124
|
+
anonConcurrency: 8,
|
|
125
|
+
authInterval: 100,
|
|
126
|
+
authConcurrency: 8,
|
|
127
|
+
},
|
|
128
|
+
// The search API is the opposite: a Solr query against the origin, one
|
|
129
|
+
// request per unknown jar hash, cacheable by nobody. cdxgen already treats it
|
|
130
|
+
// as fragile — a single timeout or 429 disables jar search for the rest of
|
|
131
|
+
// the run — so the gate is a serial 500 ms (~2 req/s). A jar sweep stays
|
|
132
|
+
// usable while staying far below anything worth throttling.
|
|
133
|
+
{
|
|
134
|
+
host: "search.maven.org",
|
|
135
|
+
anonInterval: 500,
|
|
136
|
+
anonConcurrency: 1,
|
|
137
|
+
authInterval: 500,
|
|
138
|
+
authConcurrency: 1,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
host: "central.sonatype.com",
|
|
142
|
+
anonInterval: 500,
|
|
143
|
+
anonConcurrency: 1,
|
|
144
|
+
authInterval: 500,
|
|
145
|
+
authConcurrency: 1,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
host: "package.elm-lang.org",
|
|
149
|
+
anonInterval: 250,
|
|
150
|
+
anonConcurrency: 4,
|
|
151
|
+
authInterval: 250,
|
|
152
|
+
authConcurrency: 4,
|
|
153
|
+
},
|
|
91
154
|
];
|
|
92
155
|
|
|
93
156
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cdxgenAgent, readEnvironmentVariable } from "../core/activity.js";
|
|
2
|
+
import { getUserAgent } from "../core/userAgent.js";
|
|
2
3
|
import { getOriginUrl } from "./envcontext.js";
|
|
3
4
|
import { prefetchJson } from "./fetchBatch.js";
|
|
4
5
|
|
|
@@ -123,7 +124,7 @@ export async function enrichFromForge(dir, aiCommits, options = {}) {
|
|
|
123
124
|
const githubHeaders = {
|
|
124
125
|
Accept: "application/vnd.github+json",
|
|
125
126
|
Authorization: `Bearer ${githubToken}`,
|
|
126
|
-
"User-Agent": "
|
|
127
|
+
"User-Agent": getUserAgent("api.github.com"),
|
|
127
128
|
};
|
|
128
129
|
const pullsUrlFor = (commit) =>
|
|
129
130
|
`https://api.github.com/repos/${owner}/${repo}/commits/${commit.hash}/pulls`;
|
|
@@ -214,7 +215,7 @@ export async function enrichFromForge(dir, aiCommits, options = {}) {
|
|
|
214
215
|
const commitsToQuery = aiCommits.slice(0, 5);
|
|
215
216
|
const gitlabHeaders = {
|
|
216
217
|
"PRIVATE-TOKEN": gitlabToken,
|
|
217
|
-
"User-Agent": "
|
|
218
|
+
"User-Agent": getUserAgent("gitlab.com"),
|
|
218
219
|
};
|
|
219
220
|
const mrUrlFor = (commit) =>
|
|
220
221
|
`https://gitlab.com/api/v4/projects/${projectEncoded}/repository/commits/${commit.hash}/merge_requests`;
|