Skip to content

Commit

Permalink
Update security audit after change audit.ignore behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
vtsykun committed Sep 5, 2023
1 parent 39c3a1e commit 5e739c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Package/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function update(IOInterface $io, Config $config, Package $package, Reposi
/** @var VersionRepository $versionRepository */
$versionRepository = $this->doctrine->getRepository(Version::class);
if (null === $rootIdentifier && ($probe = end($versions))) {
$rootIdentifier = preg_replace('{dev-|-dev}', '', $probe->getVersion());
$rootIdentifier = preg_replace('{dev-|-dev}', '', $probe->getPrettyVersion());
}

if ($flags & self::DELETE_BEFORE) {
Expand Down Expand Up @@ -634,7 +634,8 @@ private function securityAuditCheck(Package $package, VcsRepository $repository,
$versionParser = new VersionParser();
$driver = $repository->getDriver();
$root = $driver->getComposerInformation($driver->getRootIdentifier());
$ignored = (array)($root['config']['audit']['ignored'] ?? []);

$ignored = (array)($root['config']['audit']['ignore'] ?? ($root['config']['audit']['ignored'] ?? []));

try {
$lockInfo = $driver->getFileContent('composer.lock', $driver->getRootIdentifier());
Expand Down Expand Up @@ -684,6 +685,8 @@ private function securityAuditCheck(Package $package, VcsRepository $repository,
if (!$advisory instanceof SecurityAdvisory
|| in_array($advisory->advisoryId, $ignored, true)
|| in_array($advisory->cve, $ignored, true)
|| isset($ignored[$advisory->advisoryId])
|| isset($ignored[$advisory->cve])
) {
continue;
}
Expand Down
5 changes: 5 additions & 0 deletions src/Util/PacketonUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@

class PacketonUtils
{

/**
* @param array $packages
* @return PackageInterface[]
*/
public static function sort(array $packages): array
{
usort($packages, function (PackageInterface $a, PackageInterface $b) {
Expand Down

0 comments on commit 5e739c5

Please sign in to comment.