mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 20:20:49 +00:00
Allow to exclude packages from the minimum package age
This commit is contained in:
parent
4ef4218eb5
commit
d7a9884ff6
9 changed files with 387 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { getMinimumPackageAgeHours } from "../../../config/settings.js";
|
||||
import { getMinimumPackageAgeHours, getNpmMinimumPackageAgeExclusions } from "../../../config/settings.js";
|
||||
import { ui } from "../../../environment/userInteraction.js";
|
||||
import { getHeaderValueAsString } from "../../http-utils.js";
|
||||
|
||||
|
|
@ -65,6 +65,16 @@ export function modifyNpmInfoResponse(body, headers) {
|
|||
return body;
|
||||
}
|
||||
|
||||
// Check if this package is excluded from minimum age filtering
|
||||
const packageName = bodyJson.name;
|
||||
const exclusions = getNpmMinimumPackageAgeExclusions();
|
||||
if (packageName && exclusions.includes(packageName)) {
|
||||
ui.writeVerbose(
|
||||
`Safe-chain: ${packageName} is excluded from minimum package age filtering (minimumPackageAgeExclusions setting).`
|
||||
);
|
||||
return body;
|
||||
}
|
||||
|
||||
const cutOff = new Date(
|
||||
new Date().getTime() - getMinimumPackageAgeHours() * 3600 * 1000
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue