Skip to content

Commit 3d622d5

Browse files
Run cargo update on the runtime lockfiles and the SDK lockfile (#4562)
In addition to updating lockfiles, this PR updates `sdk-lockfiles` tool to 1. renew the contents of `false-positives.txt` 2. update audit error message so it displays which crate uses the offending dependency For 1, `chacha20` is flagged as not contained in SDK lockfile. Running `cargo tree -i chacha20` in `smithy-rs/rust-runtime` gives ``` chacha20 v0.10.0 └── rand v0.10.0 └── uuid v1.22.0 ├── aws-smithy-http-server v0.66.3 (/Users/awsaito/src/smithy-rs/rust-runtime/aws-smithy-http-server) │ └── aws-smithy-http-server-metrics v0.1.2 (/Users/awsaito/src/smithy-rs/rust-runtime/aws-smithy-http-server-metrics) └── cbor-diag v0.1.12 └── aws-smithy-protocol-test v0.63.14 (/Users/awsaito/src/smithy-rs/rust-runtime/aws-smithy-protocol-test) └── aws-smithy-http-client v1.1.12 (/Users/awsaito/src/smithy-rs/rust-runtime/aws-smithy-http-client) └── aws-smithy-mocks v0.2.6 (/Users/awsaito/src/smithy-rs/rust-runtime/aws-smithy-mocks) [dev-dependencies] └── aws-smithy-xml v0.60.15 (/Users/awsaito/src/smithy-rs/rust-runtime/aws-smithy-xml) ├── aws-smithy-http-server v0.66.3 (/Users/awsaito/src/smithy-rs/rust-runtime/aws-smithy-http-server) (*) ├── aws-smithy-http-server-python v0.67.1 (/Users/awsaito/src/smithy-rs/rust-runtime/aws-smithy-http-server-python) ├── aws-smithy-legacy-http-server v0.65.14 (/Users/awsaito/src/smithy-rs/rust-runtime/aws-smithy-legacy-http-server) │ └── aws-smithy-http-server-python v0.67.1 (/Users/awsaito/src/smithy-rs/rust-runtime/aws-smithy-http-server-python) └── inlineable v0.1.0 (/Users/awsaito/src/smithy-rs/rust-runtime/inlineable) ``` `chacha20 `only exists in `rust-runtime/Cargo.lock` because of feature unification — the server crates enable `uuid/fast-rng` which activates rand across the whole workspace. In the SDK workspace, uuid resolves without rand, so `chacha20` is never needed. For 2, while investigating 1 it became clear that showing the source dependency crate makes it much easier to add entries to `false-positives.txt`. ``` `chacha20` (0.10.0), used by `rust-runtime/Cargo.lock`, is not contained in the SDK lockfile! (brought in by `aws-smithy-xml`) `chacha20` (0.10.0), used by `rust-runtime/Cargo.lock`, is not contained in the SDK lockfile! (brought in by `aws-smithy-protocol-test`) `chacha20` (0.10.0), used by `rust-runtime/Cargo.lock`, is not contained in the SDK lockfile! (brought in by `aws-smithy-mocks`) `chacha20` (0.10.0), used by `rust-runtime/Cargo.lock`, is not contained in the SDK lockfile! (brought in by `aws-smithy-http-client`) `chacha20` (0.10.0), used by `rust-runtime/Cargo.lock`, is not contained in the SDK lockfile! (brought in by `aws-smithy-runtime`) `chacha20` (0.10.0), used by `rust-runtime/Cargo.lock`, is not contained in the SDK lockfile! (brought in by `aws-smithy-dns`) ``` --------- Co-authored-by: ysaito1001 <awsaito@amazon.com>
1 parent 230ffb3 commit 3d622d5

8 files changed

Lines changed: 881 additions & 936 deletions

File tree

aws/rust-runtime/Cargo.lock

Lines changed: 110 additions & 179 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aws/rust-runtime/aws-config/Cargo.lock

Lines changed: 308 additions & 173 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aws/sdk/Cargo.lock

Lines changed: 150 additions & 227 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust-runtime/Cargo.lock

Lines changed: 285 additions & 323 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/ci-build/sdk-lockfiles/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/ci-build/sdk-lockfiles/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sdk-lockfiles"
3-
version = "0.1.5"
3+
version = "0.1.6"
44
authors = ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>"]
55
description = """
66
A CLI tool to audit lockfiles for Smithy runtime crates, AWS runtime crates, `aws-config`, and the workspace containing
Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
aws-smithy-experimental -> pin-project
2-
aws-smithy-experimental -> pin-project-internal
3-
aws-runtime -> wit-bindgen-rt
4-
aws-smithy-http-client -> sync_wrapper
5-
aws-smithy-mocks -> sync_wrapper
6-
aws-smithy-runtime -> sync_wrapper
7-
aws-smithy-http-server -> sync_wrapper
8-
aws-smithy-http-server -> metrique-service-metrics
9-
aws-smithy-http-server -> metrique-timesource
10-
aws-smithy-http-server -> metrique-writer
11-
aws-smithy-http-server -> metrique-writer-core
12-
aws-smithy-http-server -> metrique-writer-format-emf
13-
aws-smithy-http-server -> metrique-writer-macro
1+
aws-smithy-xml -> chacha20
2+
aws-smithy-protocol-test -> chacha20
3+
aws-smithy-mocks -> chacha20
4+
aws-smithy-http-client -> chacha20
5+
aws-smithy-runtime -> chacha20
6+
aws-smithy-dns -> chacha20

tools/ci-build/sdk-lockfiles/src/audit.rs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use std::collections::HashSet;
1515
use std::env;
1616
use std::fmt;
1717
use std::hash::{Hash, Hasher};
18-
use std::iter;
1918
use std::path::PathBuf;
2019
use std::str::FromStr;
2120
use std::sync::LazyLock;
@@ -27,6 +26,7 @@ use std::sync::LazyLock;
2726
// This dependency might be an indirect dependency, meaning that the crate `from` transitively depends on the crate `to`.
2827
// Given collected `SuspectDependency` instances, the `audit` subcommand refers to `FALSE_POSITIVES` to determine
2928
// whether a `SuspectDependency` should be reported as an audit error.
29+
#[derive(Clone)]
3030
struct SuspectDependency {
3131
from: Package,
3232
to: Package,
@@ -46,7 +46,7 @@ impl fmt::Debug for SuspectDependency {
4646
impl PartialEq for SuspectDependency {
4747
fn eq(&self, other: &Self) -> bool {
4848
// `true` if two `SuspectDependency` share the same names `from`s and `to`s, ignoring package versions.
49-
self.from.name == other.from.name || self.to.name == other.to.name
49+
self.from.name == other.from.name && self.to.name == other.to.name
5050
}
5151
}
5252

@@ -235,16 +235,9 @@ fn audit_runtime_lockfile_covered_by_sdk_lockfile<'a>(
235235
}
236236
}
237237
if let Some(false_positives) = false_positives {
238-
// Any entry in `false_positives` that is not reported in `suspect_dependencies` may be removed,
239-
// as it is no longer considered a false positive.
240-
for fp in false_positives.difference(&suspect_dependencies) {
241-
tracing::warn!("{fp:?} may potentially be removed from `{false_positives:?}`");
242-
}
243238
suspect_dependencies.retain(|dep| !false_positives.contains(dep));
244-
suspect_dependencies
245-
} else {
246-
suspect_dependencies
247239
}
240+
suspect_dependencies
248241
}
249242

250243
fn lockfile_for(
@@ -282,38 +275,46 @@ pub(super) fn audit(args: AuditArgs) -> Result<()> {
282275
lockfile_for(smithy_rs_root, "aws/rust-runtime/aws-config/Cargo.lock")?,
283276
];
284277

285-
let mut crates_to_report: Vec<(Package, &str)> = Vec::new();
278+
let mut crates_to_report: Vec<(Package, Package, &str)> = Vec::new();
279+
let mut all_suspect_dependencies: HashSet<SuspectDependency> = HashSet::new();
286280

287281
for (runtime_lockfile, path) in &runtime_lockfiles {
288282
tracing::info!(
289283
"checking whether `{}` is covered by the SDK lockfile...",
290284
path
291285
);
292286

293-
let crates_uncovered_by_sdk = audit_runtime_lockfile_covered_by_sdk_lockfile(
287+
let mut crates_uncovered_by_sdk = audit_runtime_lockfile_covered_by_sdk_lockfile(
294288
runtime_lockfile,
295289
&sdk_dependency_set,
296-
Some(&FALSE_POSITIVES),
290+
None,
297291
);
292+
all_suspect_dependencies.extend(crates_uncovered_by_sdk.iter().cloned());
293+
crates_uncovered_by_sdk.retain(|dep| !FALSE_POSITIVES.contains(dep));
298294

299295
crates_to_report.extend(
300296
crates_uncovered_by_sdk
301297
.into_iter()
302-
.map(|c| c.to)
303-
.zip(iter::repeat(*path)),
298+
.map(|c| (c.from, c.to, *path)),
304299
);
305300
}
306301

302+
// Warn about false-positive entries that are no longer needed
303+
for fp in FALSE_POSITIVES.difference(&all_suspect_dependencies) {
304+
tracing::warn!("{fp:?} may potentially be removed from `false-positives.txt`");
305+
}
306+
307307
if crates_to_report.is_empty() {
308308
println!("SUCCESS");
309309
Ok(())
310310
} else {
311-
for (pkg, origin_lockfile) in crates_to_report {
311+
for (from, to, origin_lockfile) in &crates_to_report {
312312
eprintln!(
313-
"`{}` ({}), used by `{}`, is not contained in the SDK lockfile!",
314-
pkg.name.as_str(),
315-
pkg.version,
313+
"`{}` ({}), used by `{}`, is not contained in the SDK lockfile! (brought in by `{}`)",
314+
to.name.as_str(),
315+
to.version,
316316
origin_lockfile,
317+
from.name.as_str(),
317318
);
318319
}
319320
bail!("there are lockfile audit failures")

0 commit comments

Comments
 (0)