Skip to content

Commit a56b1a2

Browse files
authored
Additional 1.85.0 fixup (#746)
This fixes an issue where crate sources were not being correctly determined as crates.io when using cargo 1.85.0 due to the change in how directory names are calculated, which would cause eg. workspace dependency checks to fail. The advisory databases no longer use tame_index to perform the directory naming as it doesn't really make sense in the first place, so now it just uses a similar method, but using xxhash instead which gives the same properties as the cargo 1.85.0 change, namely that the hash is the same for the same url regardless of the host platform (endianness/pointer width/arch). It also now uses the last path component as the start of the name which is a much nicer way to name the directory. This also updates to the rust-version to 1.85.0 and moves to edition 2024.
1 parent 7bf9758 commit a56b1a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+392
-332
lines changed

.github/workflows/ci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- uses: actions/checkout@v4
4949
- uses: dtolnay/rust-toolchain@master
5050
with:
51-
toolchain: 1.81.0
51+
toolchain: 1.85.0
5252
components: "clippy"
5353
- run: cargo fetch
5454
- name: cargo clippy

.gitmodules

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
[submodule "tests/advisory-db/github.com-c046ebb82572a8ef"]
2-
path = tests/advisory-db/github.com-c046ebb82572a8ef
1+
[submodule "tests/advisory-db/test-advisory-db-c27873b782cceedc"]
2+
path = tests/advisory-db/test-advisory-db-c27873b782cceedc
33
url = https://github.com/EmbarkStudios/test-advisory-db
4-
[submodule "tests/advisory-db/github.com-9b36585d9d99f7b3"]
5-
path = tests/advisory-db/github.com-9b36585d9d99f7b3
4+
[submodule "tests/advisory-db/advisory-db-3157b0e258782691"]
5+
path = tests/advisory-db/advisory-db-3157b0e258782691
66
url = https://github.com/rustsec/advisory-db

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
<!-- next-header -->
1010
## [Unreleased] - ReleaseDate
11+
### Changed
12+
- [PR#746](https://github.com/EmbarkStudios/cargo-deny/pull/746) changed the directory naming of advisory databases, [again](https://github.com/EmbarkStudios/cargo-deny/pull/745), so the name uses the last path component and a different, but also stable, hashing algorithm. Eg. the default `https://github.com/rustsec/advisory-db` will now be placed in `$CARGO_HOME/advisory-dbs/advisory-db-3157b0e258782691`.
13+
- [PR#746](https://github.com/EmbarkStudios/cargo-deny/pull/746) changed the MSRV to 1.85.0 and uses edition 2024.
14+
15+
### Fixed
16+
- [PR#746](https://github.com/EmbarkStudios/cargo-deny/pull/746) fixes an issue when using cargo 1.85.0 where source urls were not being properly assigned to crates.io due to the constant being used no longer matching the new path used in cargo 1.85.0 causing eg. workspace dependency checks to fail.
17+
1118
## [0.17.0] - 2025-02-20
1219
### Changed
1320
- [PR#745](https://github.com/EmbarkStudios/cargo-deny/pull/745) updated `tame-index` to [0.18.0](https://github.com/EmbarkStudios/tame-index/releases/tag/0.18.0) so that cargo 1.85.0 is transparently supported along with older cargo versions.

Cargo.lock

+32-32
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ authors = [
77
"Embark <opensource@embark-studios.com>",
88
"Jake Shadle <jake.shadle@embark-studios.com>",
99
]
10-
edition = "2021"
10+
edition = "2024"
1111
license = "MIT OR Apache-2.0"
1212
readme = "README.md"
1313
documentation = "https://docs.rs/cargo-deny"
1414
homepage = "https://github.com/EmbarkStudios/cargo-deny"
1515
categories = ["development-tools::cargo-plugins"]
1616
keywords = ["cargo", "license", "spdx", "ci", "advisories"]
1717
exclude = ["docs/", "examples/", ".github/", "tests"]
18-
rust-version = "1.81.0"
18+
rust-version = "1.85.0"
1919

2020
[badges]
2121
maintenance = { status = "actively-developed" }
@@ -50,7 +50,7 @@ askalono = { version = "0.5", default-features = false }
5050
bitvec = { version = "1.0", features = ["alloc"] }
5151
# Much nicer paths
5252
camino = "1.1"
53-
cfg-expr = "0.17"
53+
cfg-expr = "0.18"
5454
# Allows us to do eg cargo metadata operations without relying on an external cargo
5555
#cargo = { version = "0.71", optional = true }
5656
# Argument parsing, kept aligned with cargo
@@ -77,7 +77,7 @@ goblin = { version = "0.9", default-features = false, features = [
7777
# We need to figure out HOME/CARGO_HOME in some cases
7878
home = "0.5"
7979
# Provides graphs on top of cargo_metadata
80-
krates = { version = "0.17", features = ["targets"] }
80+
krates = { version = "0.18", features = ["targets"] }
8181
# Log macros
8282
log = "0.4"
8383
# Faster char searching

clippy.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
msrv = "1.84.1"
1+
msrv = "1.85.0"
22

33
disallowed-types = [
44
{ path = "std::sync::Mutex", reason = "Use the faster & simpler non-poisonable primitives in `parking_lot` instead" },

deny.toml

-14
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,8 @@ allow = [
5656
exceptions = [
5757
# Use exceptions for these as they only have a single user
5858
{ allow = ["Zlib"], crate = "tinyvec" },
59-
{ allow = ["OpenSSL"], crate = "ring" },
6059
]
6160

62-
# Sigh
63-
[[licenses.clarify]]
64-
crate = "ring"
65-
# SPDX considers OpenSSL to encompass both the OpenSSL and SSLeay licenses
66-
# https://spdx.org/licenses/OpenSSL.html
67-
# ISC - Both BoringSSL and ring use this for their new files
68-
# MIT - "Files in third_party/ have their own licenses, as described therein. The MIT
69-
# license, for third_party/fiat, which, unlike other third_party directories, is
70-
# compiled into non-test libraries, is included below."
71-
# OpenSSL - Obviously
72-
expression = "ISC AND MIT AND OpenSSL"
73-
license-files = [{ path = "LICENSE", hash = 0xbd0eed23 }]
74-
7561
[[licenses.clarify]]
7662
crate = "webpki"
7763
expression = "ISC"

src/advisories.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pub mod cfg;
22
pub(crate) mod diags;
33
mod helpers;
44

5-
use crate::{diag, LintLevel};
5+
use crate::{LintLevel, diag};
66
pub use diags::Code;
77
pub use helpers::{
88
db::{AdvisoryDb, DbSet, Fetch, Id, Report},

src/advisories/cfg.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
use crate::{
2+
LintLevel, PathBuf, Span, Spanned,
23
cfg::{PackageSpecOrExtended, Reason, ValidationContext},
34
diag::{Diagnostic, FileId, Label},
4-
utf8path, LintLevel, PathBuf, Span, Spanned,
5+
utf8path,
56
};
67
use anyhow::Context as _;
78
use rustsec::advisory;
89
use time::Duration;
9-
use toml_span::{de_helpers::*, value::ValueInner, Deserialize, Value};
10+
use toml_span::{Deserialize, Value, de_helpers::*, value::ValueInner};
1011
use url::Url;
1112

1213
pub(crate) type AdvisoryId = Spanned<advisory::Id>;
@@ -465,7 +466,9 @@ fn parse_rfc3339_duration(value: &str) -> anyhow::Result<Duration> {
465466
// of the function
466467
for c in value.chars() {
467468
if c == ',' {
468-
anyhow::bail!("'{c}' is valid in the RFC-3339 duration format but not supported by this implementation, use '.' instead");
469+
anyhow::bail!(
470+
"'{c}' is valid in the RFC-3339 duration format but not supported by this implementation, use '.' instead"
471+
);
469472
}
470473

471474
if c != '.' && c != 'T' && !c.is_ascii_digit() && !UNITS.iter().any(|(uc, _)| c == *uc) {
@@ -720,7 +723,7 @@ fn shellexpand(
720723
mod test {
721724

722725
use super::{parse_rfc3339_duration as dur_parse, *};
723-
use crate::test_utils::{write_diagnostics, ConfigData};
726+
use crate::test_utils::{ConfigData, write_diagnostics};
724727

725728
struct Advisories {
726729
advisories: Config,

src/advisories/diags.rs

+22-16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::cfg::IgnoreId;
22
use crate::{
3-
diag::{Check, Diagnostic, FileId, Label, Pack, Severity},
43
LintLevel,
4+
diag::{Check, Diagnostic, FileId, Label, Pack, Severity},
55
};
66
use rustsec::advisory::{Informational, Metadata, Versions};
77

@@ -160,11 +160,13 @@ impl crate::CheckCtx<'_, super::cfg::ValidConfig> {
160160
let diag = pack.push(
161161
Diagnostic::new(severity)
162162
.with_message(advisory.title.clone())
163-
.with_labels(vec![Label::primary(
164-
self.krate_spans.lock_id,
165-
self.krate_spans.lock_span(&krate.id).total,
166-
)
167-
.with_message(message)])
163+
.with_labels(vec![
164+
Label::primary(
165+
self.krate_spans.lock_id,
166+
self.krate_spans.lock_span(&krate.id).total,
167+
)
168+
.with_message(message),
169+
])
168170
.with_code(code)
169171
.with_notes(notes),
170172
);
@@ -185,11 +187,13 @@ impl crate::CheckCtx<'_, super::cfg::ValidConfig> {
185187
krate.name
186188
))
187189
.with_code(Code::Yanked)
188-
.with_labels(vec![Label::primary(
189-
self.krate_spans.lock_id,
190-
self.krate_spans.lock_span(&krate.id).total,
191-
)
192-
.with_message("yanked version")]),
190+
.with_labels(vec![
191+
Label::primary(
192+
self.krate_spans.lock_id,
193+
self.krate_spans.lock_span(&krate.id).total,
194+
)
195+
.with_message("yanked version"),
196+
]),
193197
);
194198

195199
pack
@@ -212,11 +216,13 @@ impl crate::CheckCtx<'_, super::cfg::ValidConfig> {
212216
krate: &crate::Krate,
213217
error: D,
214218
) -> Pack {
215-
let mut labels = vec![Label::secondary(
216-
self.krate_spans.lock_id,
217-
self.krate_spans.lock_span(&krate.id).total,
218-
)
219-
.with_message("crate whose registry we failed to query")];
219+
let mut labels = vec![
220+
Label::secondary(
221+
self.krate_spans.lock_id,
222+
self.krate_spans.lock_span(&krate.id).total,
223+
)
224+
.with_message("crate whose registry we failed to query"),
225+
];
220226

221227
// Don't show the config location if it's the default, since it just points
222228
// to the beginning and confuses users

0 commit comments

Comments
 (0)