mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 20:20:49 +00:00
Allow to configure custom/prinvate npm registries
This commit is contained in:
parent
0925279521
commit
41cc24d1f5
9 changed files with 576 additions and 15 deletions
|
|
@ -1,4 +1,7 @@
|
|||
import { skipMinimumPackageAge } from "../../../config/settings.js";
|
||||
import {
|
||||
getNpmCustomRegistries,
|
||||
skipMinimumPackageAge,
|
||||
} from "../../../config/settings.js";
|
||||
import { isMalwarePackage } from "../../../scanning/audit/index.js";
|
||||
import { interceptRequests } from "../interceptorBuilder.js";
|
||||
import {
|
||||
|
|
@ -15,7 +18,9 @@ const knownJsRegistries = ["registry.npmjs.org", "registry.yarnpkg.com"];
|
|||
* @returns {import("../interceptorBuilder.js").Interceptor | undefined}
|
||||
*/
|
||||
export function npmInterceptorForUrl(url) {
|
||||
const registry = knownJsRegistries.find((reg) => url.includes(reg));
|
||||
const registry = [...knownJsRegistries, ...getNpmCustomRegistries()].find(
|
||||
(reg) => url.includes(reg)
|
||||
);
|
||||
|
||||
if (registry) {
|
||||
return buildNpmInterceptor(registry);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue