Fix cargo deny
commands so they scan the whole workspace
#1925
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When
cargo deny
commands are run from the top-level directory of a workspace, and no--manifest-path
option is pased, they implicitly use the top-levelCargo.toml
file as their manifest.In workspaces where this is a virtual manifest, i.e. those where the top-level
Cargo.toml
defines only the workspace and not also a specific crate, runningcargo deny
without specifying any roots implicitly acts as though--workspace
has been passed. (See https://embarkstudios.github.io/cargo-deny/cli/common.html for details.) In that situation,--workspace
can be omitted and all crates in the workspace are still treated as roots for the scan.But the gitoxide repository's top-level workspace's
Cargo.toml
file is not a virtual manifest. It defines a workspace, but it also defines thegitoxide
crate. As a result,cargo deny
commands, as run on CI in thecargo-deny
andcargo-deny-advisories
jobs, and locally viajust audit
, were not guaranteed to check the entire workspace. They used only thegitoxide
crate as a root for scanning, rather than using all crates defined in the workspace as roots as when--workspace
is used or implied.It looks like this was not detected for three reasons:
Most of the workspace was usually covered, especially on CI where, since no
arguments
were passed,cargo-deny-action
used the defualt of--all-features
. Most transitive dependencies inside and outside of the gitoxide project seem to be used by thegitoxide
crate by in some feature configuration.The distinction between virtual and non-virtual top-level manifests of workspaces is subtle and not highlighted in the
cargo deny
documentation.In
EmbarkStudios/cargo-deny-action
, the default value ofarguments
contains--all-features
but not--workspace
(nor any other options). Intuitively it feels like the default value would scan all crates in the repository that the action is being run on. That does happen in the perhaps more common case that the top-levelCargo.toml
defines no crate, but not here.This was discovered in connection with #1924. It is why the
cargo-deny-advisories
job didn't catch RUSTSEC-2025-0022 (GHSA-4fcv-w3qc-ppgg) even as Dependabot did.To fix it, this adds
--workspace
explicitly in bothcargo deny
jobs run on CI, as well as in thejustfile
.This also adds
--all-features
:--all-features
is itself no change from before, since it is the implicit value ofarguments
. It has to be passed explicitly now thatarguments
has an explicit value.justfile
, adding--all-features
does (at least in principle) make a difference.