From d33b3f56950e3e50b727a3301c0a7d2d8bf324a6 Mon Sep 17 00:00:00 2001 From: Charles Coggins Date: Thu, 17 Aug 2023 13:27:20 -0500 Subject: [PATCH] fix: ensure lockfiles are files The change ensures that lockfiles that are not files are filtered out before processing. This change aligns with the corresponding one made in the CLI (https://github.com/phylum-dev/cli/pull/1202). It is done separately here because #244 (Replace lockfile detection with `phylum status`) has not been implemented yet. Plus, this allows for a fix without changing the minimum supported CLI version. --- src/phylum/ci/ci_base.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/phylum/ci/ci_base.py b/src/phylum/ci/ci_base.py index 8c5edbcf..599cfab1 100644 --- a/src/phylum/ci/ci_base.py +++ b/src/phylum/ci/ci_base.py @@ -145,6 +145,10 @@ def filter_lockfiles(self, provided_lockfiles: List[Path]) -> Lockfiles: LOG.warning("Provided lockfile does not exist: %s", provided_lockfile) self.returncode = ReturnCode.LOCKFILE_FILTER continue + if not provided_lockfile.is_file(): + LOG.warning("Provided lockfile is not a file: %s", provided_lockfile) + self.returncode = ReturnCode.LOCKFILE_FILTER + continue if not provided_lockfile.stat().st_size: LOG.warning("Provided lockfile is an empty file: %s", provided_lockfile) self.returncode = ReturnCode.LOCKFILE_FILTER