NAME

cpangit-audit - list the distributions of a branch which are outdated or affected by CVEs

NAME

cpangit-audit - list the distributions of a branch which are outdated or affected by CVEs

USAGE

cpangit-audit [OPTIONS]

This compares the index of your branch with the index of each of its import sources, and with the CPAN Security Advisory list (the same one the web interface uses). It lists every distribution of the branch for which a newer distribution is available, and every distribution of the branch which is affected by a security advisory, whether or not there is a newer one. For each, it says which advisories affect the version you have, and which affect the version you could upgrade to.

A module can move from one distribution to another, so the comparison is made one module at a time and then grouped by the pair of (distribution you have, distribution that now provides the module). A distribution of your branch can therefore be listed with more than one newer distribution. Each pair can be given to cpangit-diff for review.

The exit status is 0 unless you request one of the --assert-* checks.

OPTIONS

--git-dir=PATH

Path to the Git repository of CPAN::InGit. The default is GIT_DIR from the environment, or any git repo above "."

--branch=BRANCH_NAME

The branch to audit. The default is the checked-out branch.

--source=BRANCH_NAME

A branch to search for newer versions. May be given more than once. The default is the import sources of --branch.

--format=text|json|none
--json

The default is text, one line for each pair of distributions, unless one of the --assert-* options is given, in which case the default is none and nothing is written to STDOUT. Give --format along with an assertion to get both. --json is the same as --format=json, which writes one object:

{
  "branch": "my_app",
  "sources": [ "www_cpan_org" ],
  "cve_list": { "path": "...", "fetched": "2026-11-27T10:00:00Z", "url": "..." },
  "dists": [
    {
      "author_path": "A/AU/AUTHOR/Example-1.00.tar.gz",
      "dist": "Example", "version": "1.00",
      "advisories": [
        { "ids": [ "CVE-2025-1234", "CPANSA-Example-2025-1234" ], "affected_versions": [ "<1.02" ],
          "title": "...", "severity": "high", "reported": "2025-01-02", "description": "..." }
      ],
      "upgrades": [
        {
          "author_path": "A/AU/AUTHOR/Example-1.02.tar.gz",
          "dist": "Example", "version": "1.02",
          "source": "www_cpan_org",
          "kind": "upgrade",
          "modules": { "Example": [ "1.00", "1.02" ] },
          "advisories": [],
          "diff_args": [ "A/AU/AUTHOR/Example-1.00.tar.gz", "A/AU/AUTHOR/Example-1.02.tar.gz" ]
        }
      ],
      "left_behind": [ "Example::Old" ],
      "not_in_source": [ "Example::Private" ]
    }
  ],
  "summary": { "dists": 120, "outdated": 1, "affected": 1 },
  "failed_assertions": []
}

kind is upgrade for a newer release of the same distribution, and moved when the modules are now provided by a distribution with a different name. modules has the version of each module in the branch and in the source. left_behind are modules the source still attributes to the distribution you have (usually because the newer release removed them), and not_in_source are modules no source provides. diff_args are the arguments for cpangit-diff. summary.dists counts every distribution of the branch.

--cve-only

Only list the distributions which are affected by an advisory.

--outdated-only

Only list the distributions for which a newer distribution is available.

--assert-have-src-ver

Exit with status 1 if a newer distribution is available for any distribution of the branch. The list of distributions is not written unless you also give --format.

--assert-no-cve

Exit with status 1 if any distribution of the branch is affected by an advisory. Advisories which only affect the newer distribution do not count. The list of distributions is not written unless you also give --format.

--cve-file=PATH

The file in which to keep the CVE list. The default is cpan-ingit-cpansa.json inside the Git directory. The list is downloaded to this file if it doesn't exist or is more than 12 hours old, and the file is otherwise used as it is. The path and age of the file are announced on STDERR.

--refresh

Ask the server for a newer CVE list regardless of the age of the file.

--no-fetch

Never use the network. Use the CVE list file as it is (failing if there is none) and don't let a mirror branch refresh its index.

--no-cve

Don't look up advisories at all.

-v, --verbose
-q, --quiet

Show more or fewer log messages (on STDERR). --quiet also omits the announcement of the CVE list file.

EXIT STATUS

0 if the audit was made, 1 if an --assert-* check failed, and 2 for any error. Each failed check is described by a line on STDERR, and in failed_assertions of the JSON.

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.