mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Add minimum package age check for pypi
This commit is contained in:
parent
2c8a1b4972
commit
fd6fb456b4
22 changed files with 516 additions and 273 deletions
|
|
@ -129,18 +129,21 @@ export function getPipCustomRegistries() {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the minimum package age exclusions from the config file
|
||||
* Gets the minimum package age exclusions from the config file for the current ecosystem
|
||||
* @returns {string[]}
|
||||
*/
|
||||
export function getNpmMinimumPackageAgeExclusions() {
|
||||
export function getMinimumPackageAgeExclusions() {
|
||||
const config = readConfigFile();
|
||||
const ecosystem = getEcoSystem();
|
||||
const registryConfig = ecosystem === "py" ? config.pip : config.npm;
|
||||
|
||||
if (!config || !config.npm) {
|
||||
if (!config || !registryConfig) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const npmConfig = /** @type {SafeChainRegistryConfiguration} */ (config.npm);
|
||||
const exclusions = npmConfig.minimumPackageAgeExclusions;
|
||||
const typedRegistryConfig =
|
||||
/** @type {SafeChainRegistryConfiguration} */ (registryConfig);
|
||||
const exclusions = typedRegistryConfig.minimumPackageAgeExclusions;
|
||||
|
||||
if (!Array.isArray(exclusions)) {
|
||||
return [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue