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 denycommands are run from the top-level directory of a workspace, and no--manifest-pathoption is pased, they implicitly use the top-levelCargo.tomlfile as their manifest.In workspaces where this is a virtual manifest, i.e. those where the top-level
Cargo.tomldefines only the workspace and not also a specific crate, runningcargo denywithout specifying any roots implicitly acts as though--workspacehas been passed. (See https://embarkstudios.github.io/cargo-deny/cli/common.html for details.) In that situation,--workspacecan 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.tomlfile is not a virtual manifest. It defines a workspace, but it also defines thegitoxidecrate. As a result,cargo denycommands, as run on CI in thecargo-denyandcargo-deny-advisoriesjobs, and locally viajust audit, were not guaranteed to check the entire workspace. They used only thegitoxidecrate as a root for scanning, rather than using all crates defined in the workspace as roots as when--workspaceis 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
argumentswere passed,cargo-deny-actionused the defualt of--all-features. Most transitive dependencies inside and outside of the gitoxide project seem to be used by thegitoxidecrate 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 denydocumentation.In
EmbarkStudios/cargo-deny-action, the default value ofargumentscontains--all-featuresbut 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.tomldefines no crate, but not here.This was discovered in connection with #1924. It is why the
cargo-deny-advisoriesjob didn't catch RUSTSEC-2025-0022 (GHSA-4fcv-w3qc-ppgg) even as Dependabot did.To fix it, this adds
--workspaceexplicitly in bothcargo denyjobs run on CI, as well as in thejustfile.This also adds
--all-features:--all-featuresis itself no change from before, since it is the implicit value ofarguments. It has to be passed explicitly now thatargumentshas an explicit value.justfile, adding--all-featuresdoes (at least in principle) make a difference.