NAME
CPAN::InGit::Advisories - Look up security advisories (CVEs) that affect a release of a distribution
SYNOPSIS
my $advisories= $cpan_repo->load_advisories; # downloads or re-uses the CPANSA feed
# or
my $advisories= CPAN::InGit::Advisories->new_from_json($json_text);
for ($advisories->affecting_path('A/AU/AUTHOR/Example-1.02.tar.gz')) {
say join ' ', @{ $_->{ids} }, $_->{severity} // '';
}
DESCRIPTION
This is an index of the CPAN Security Advisory feed, the same file which the web interface of CPAN::InGit::Server downloads for its "Check CVEs" button. The semantics of the affected-version ranges follow Test::CVE: an advisory affects a version when any of its ranges match, and a range matches when all of its comma-separated comparisons match. An advisory without ranges affects every version.
Advisories apply to releases of a distribution, so versions are always the version of the distribution file, not the $VERSION of a module in it.
ATTRIBUTES
data
The decoded feed: a hashref of { $distribution_name => [ \%advisory, ... ] }
source_path
The path of the file this was loaded from, if any.
fetched
The epoch time when the feed was last downloaded or confirmed current, if known.
METHODS
new_from_json
my $advisories= CPAN::InGit::Advisories->new_from_json($bytes, %attributes);
Parse the text of the feed. Some revisions of the feed have a plain-text warning before the JSON, which is ignored. Dies if the text is not a feed.
parse_version
my $version= CPAN::InGit::Advisories->parse_version('1.02_03');
Return a version object, or undef if the string is not a version. Underscores are ignored, so that a development release compares by its digits.
affecting
my @advisories= $advisories->affecting($distribution_name, $version);
Return the advisories that affect this version of a distribution, like ->affecting('Example', '1.02'). Each is a hashref of plain data:
{
ids => [ 'CVE-2025-1234', 'CPANSA-Example-2025-01' ],
affected_versions => [ '<1.03' ],
fixed_versions => [ '>=1.03' ], # when the feed has it (and likewise below)
title => '...',
severity => 'high',
reported => '2025-01-02',
description => '...',
}
Returns an empty list if the version can't be parsed.
affecting_path
my @advisories= $advisories->affecting_path('A/AU/AUTHOR/Example-1.02.tar.gz');
Same as "affecting", for the name and version in the file name of a distribution archive.
VERSION
version 0.007
AUTHOR
Michael Conrad <mike@nrdvana.net>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Michael Conrad, and IntelliTree Solutions.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.