You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: Cargo workspace = true dependencies stay at * instead of inheriting from [workspace.dependencies] #604
parseCargoDepAttrs in src/core-open/scanners/rust-scanner.ts reads version = "…" from an inline table or [dependencies.<crate>] block, and the comment on that helper explicitly notes that workspace does not replace version. So a workspace-member Cargo.toml that writes
[dependencies]
serde = { workspace = true }
tokio = { workspace = true, features = ["rt-multi-thread"] }
while the root declares
[workspace.dependencies]
serde = "1.0"tokio = { version = "1.35", features = ["macros"] }
reports both crates with currentSpec / resolved version *. vg scan and vg sbom export then treat them as unpinned even though Cargo inherited a real version from the workspace table. Path- and git-only tables are a separate case; this issue is only about workspace = true inheritance.
What to do
When a dependency table sets workspace = true (and has no local version), look up the crate in the workspace root's [workspace.dependencies] and use that version (and any features/optional defaults the local table does not override).
Keep a local version = "…" winning over the workspace pin when both are present.
Leave path-/git-only tables without a version as they are today.
Add unit tests next to the other Cargo scanner tests (member + root fixture).
Acceptance
A member serde = { workspace = true } with root serde = "1.0" reports 1.0 (not *).
A member that also sets version = "2.0" keeps 2.0.
A path-only { path = "…" } table still does not invent a registry version.
Confirmed in parseCargoDepAttrs (src/core-open/scanners/rust-scanner.ts): the helper reads version / optional / features and the comment next to it already says workspace does not replace version. So serde = { workspace = true } lands as currentSpec: "*" even when the workspace root pins serde = "1.0" under [workspace.dependencies].
A focused fix is: when the member table has workspace = true and no local version, walk up to the workspace root Cargo.toml, parse [workspace.dependencies].<crate>, and use that version (string or table). Keep a local version winning when both are set, and leave path-/git-only tables alone. A small workspace-member fixture plus a unit test on the inherited version is enough to lock it in.
Activity
vibgrate-team commentedon Nov 5, 2026
Confirmed in
parseCargoDepAttrs(src/core-open/scanners/rust-scanner.ts): the helper readsversion/optional/featuresand the comment next to it already saysworkspacedoes not replaceversion. Soserde = { workspace = true }lands ascurrentSpec: "*"even when the workspace root pinsserde = "1.0"under[workspace.dependencies].A focused fix is: when the member table has
workspace = trueand no localversion, walk up to the workspace rootCargo.toml, parse[workspace.dependencies].<crate>, and use that version (string or table). Keep a localversionwinning when both are set, and leave path-/git-only tables alone. A small workspace-member fixture plus a unit test on the inherited version is enough to lock it in.