mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Undo merge issue
This commit is contained in:
parent
c7ec7fcf37
commit
dc1bbea56b
1 changed files with 5 additions and 20 deletions
|
|
@ -1,10 +1,10 @@
|
||||||
import { EventEmitter } from "events";
|
import { EventEmitter } from "events";
|
||||||
import {
|
import { getMinimumPackageAgeHours } from "../../../../config/settings.js";
|
||||||
getMinimumPackageAgeExclusions,
|
|
||||||
getMinimumPackageAgeHours,
|
|
||||||
} from "../../../../config/settings.js";
|
|
||||||
import { ui } from "../../../../environment/userInteraction.js";
|
import { ui } from "../../../../environment/userInteraction.js";
|
||||||
import { clearCachingHeaders, getHeaderValueAsString } from "../../http-utils.js";
|
import {
|
||||||
|
clearCachingHeaders,
|
||||||
|
getHeaderValueAsString,
|
||||||
|
} from "../../http-utils.js";
|
||||||
|
|
||||||
/** @type {EventEmitter<{ versionsRemoved: [{packageName: string, packageVersions: string[]}] }>} */
|
/** @type {EventEmitter<{ versionsRemoved: [{packageName: string, packageVersions: string[]}] }>} */
|
||||||
export const modifyResponseEventEmitter = new EventEmitter();
|
export const modifyResponseEventEmitter = new EventEmitter();
|
||||||
|
|
@ -68,21 +68,6 @@ export function modifyNpmInfoResponse(body, headers) {
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if this package is excluded from minimum age filtering
|
|
||||||
const packageName = bodyJson.name;
|
|
||||||
const exclusions = getMinimumPackageAgeExclusions();
|
|
||||||
if (
|
|
||||||
packageName &&
|
|
||||||
exclusions.some((pattern) =>
|
|
||||||
matchesExclusionPattern(packageName, pattern),
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
ui.writeVerbose(
|
|
||||||
`Safe-chain: ${packageName} is excluded from minimum package age filtering (minimumPackageAgeExclusions setting).`,
|
|
||||||
);
|
|
||||||
return body;
|
|
||||||
}
|
|
||||||
|
|
||||||
const cutOff = new Date(
|
const cutOff = new Date(
|
||||||
new Date().getTime() - getMinimumPackageAgeHours() * 3600 * 1000,
|
new Date().getTime() - getMinimumPackageAgeHours() * 3600 * 1000,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue