mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Adapt per latest core
This commit is contained in:
parent
07e315a382
commit
ac09534070
4 changed files with 35 additions and 26 deletions
|
|
@ -11,6 +11,7 @@ import {
|
|||
getMinimumPackageAgeHours,
|
||||
getEcoSystem,
|
||||
ECOSYSTEM_JS,
|
||||
ECOSYSTEM_PY,
|
||||
} from "../config/settings.js";
|
||||
|
||||
/**
|
||||
|
|
@ -23,11 +24,21 @@ let cachedNewPackagesDatabase = null;
|
|||
let hasWarnedAboutUnavailableNewPackagesDatabase = false;
|
||||
|
||||
/**
|
||||
* Returns the source identifier used in the feed for the current ecosystem.
|
||||
* Returns the ecosystem identifier expected in upstream/core release feeds.
|
||||
* @returns {string}
|
||||
*/
|
||||
function getCurrentFeedSource() {
|
||||
return getEcoSystem();
|
||||
const ecosystem = getEcoSystem();
|
||||
|
||||
if (ecosystem === ECOSYSTEM_JS) {
|
||||
return "npm";
|
||||
}
|
||||
|
||||
if (ecosystem === ECOSYSTEM_PY) {
|
||||
return "pypi";
|
||||
}
|
||||
|
||||
return ecosystem;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -73,8 +84,8 @@ export async function openNewPackagesDatabase() {
|
|||
|
||||
const entry = newPackagesList.find(
|
||||
(pkg) =>
|
||||
pkg.source?.toLowerCase() === expectedSource &&
|
||||
pkg.name === name &&
|
||||
(!pkg.source || pkg.source.toLowerCase() === expectedSource) &&
|
||||
pkg.package_name === name &&
|
||||
pkg.version === version
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue