Skip to content

Commit ba2b1e4

Browse files
authored
feat(boil): Improve empty image version filter error (#1527)
* feat(boil): Improve empty image version filter error This now reports the image name and the filtered version(s) in the error. Previously, users would have to guess which image and version yielded an empty list. * fix: Bump rustls-webpki to 0.103.13 to negate RUSTSEC-2026-0104 * fix: Ignore RUSTSEC-2026-0173 for now * chore: Update comment in deny.toml * chore: Copy complete deny.toml
1 parent b4a8a25 commit ba2b1e4

4 files changed

Lines changed: 80 additions & 19 deletions

File tree

Cargo.lock

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

deny.toml

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,57 @@ targets = [
1414

1515
[advisories]
1616
yanked = "deny"
17+
ignore = [
18+
# https://rustsec.org/advisories/RUSTSEC-2023-0071
19+
# "rsa" crate: Marvin Attack: potential key recovery through timing sidechannel
20+
#
21+
# No patch is yet available, however work is underway to migrate to a fully constant-time implementation.
22+
# So we need to accept this, as of SDP 26.3 we are "only" using the crate to create private +
23+
# public key pairs used by webhooks, such as conversion or mutating webhooks.
24+
#
25+
# https://github.com/RustCrypto/RSA/issues/19 is the tracking issue
26+
"RUSTSEC-2023-0071",
27+
28+
# https://rustsec.org/advisories/RUSTSEC-2024-0436
29+
# The "paste" crate is no longer maintained because the owner states that the implementation is
30+
# finished. There are at least two (forked) alternatives which state to be maintained. They'd
31+
# need to be vetted before a potential switch. Additionally, they'd need to be in a maintained
32+
# state for a couple of years to provide any benefit over using "paste".
33+
#
34+
# This crate is only used in a single place in the xtask package inside the declarative
35+
# "write_crd" macro. The impact of vulnerabilities, if any, should be fairly minimal.
36+
#
37+
# See thread: https://users.rust-lang.org/t/paste-alternatives/126787/4
38+
#
39+
# This can only be removed again if we decide to use a different crate.
40+
"RUSTSEC-2024-0436",
41+
42+
# https://rustsec.org/advisories/RUSTSEC-2026-0097
43+
# rand 0.8.5 is unsound when log+thread_rng features are enabled and a custom logger calls rand::rng().
44+
#
45+
# This version is pulled in transitively via num-bigint-dig -> rsa -> stackable-certs and cannot be
46+
# updated until the upstream rsa crate bumps its rand dependency.
47+
"RUSTSEC-2026-0097",
48+
49+
# https://rustsec.org/advisories/RUSTSEC-2026-0173
50+
# The author of `proc-macro-error2` has [confirmed](https://github.com/GnomedDev/proc-macro-error-2/issues/17#issuecomment-4643215473)
51+
# that the crate is no longer maintained and recommends that users migrate away from it.
52+
#
53+
# There currently is no way for us to negate this advisory, because that crate is not used
54+
# directly by us. We need to wait for new versions of oci-spec and getset. See the following
55+
# issue which tracks moving to a newer getset version: https://github.com/youki-dev/oci-spec-rs/issues/340
56+
#
57+
# proc-macro-error2 v2.0.1
58+
# └── getset v0.1.6
59+
# └── oci-spec v0.9.0
60+
# └── boil v0.2.1
61+
#
62+
# Alternate crates are:
63+
#
64+
# - https://crates.io/crates/manyhow
65+
# - https://github.com/SergioBenitez/proc-macro2-diagnostics
66+
"RUSTSEC-2026-0173",
67+
]
1768

1869
[bans]
1970
multiple-versions = "allow"
@@ -31,7 +82,7 @@ allow = [
3182
"LicenseRef-webpki",
3283
"MIT",
3384
"MPL-2.0",
34-
"OpenSSL", # Needed for the ring and/or aws-lc-sys crate. See https://github.com/stackabletech/operator-templating/pull/464 for details
85+
"OpenSSL", # Needed for the ring and/or aws-lc-sys crate. See https://github.com/stackabletech/operator-templating/pull/464 for details
3586
"Unicode-3.0",
3687
"Unicode-DFS-2016",
3788
"Zlib",
@@ -52,6 +103,7 @@ license-files = [{ path = "LICENSE", hash = 0x001c7e6c }]
52103
[sources]
53104
unknown-registry = "deny"
54105
unknown-git = "deny"
106+
allow-git = ["https://github.com/kube-rs/kube-rs"]
55107

56108
[sources.allow-org]
57109
github = ["stackabletech"]

rust/boil/src/core/bakefile.rs

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,17 @@ pub enum Error {
7070

7171
#[derive(Debug, Snafu)]
7272
pub enum TargetsError {
73-
#[snafu(display("encountered invalid image version"))]
74-
InvalidImageVersion { source: ImageConfigError },
75-
7673
#[snafu(display("failed to read image config"))]
7774
ReadImageConfig { source: ImageConfigError },
7875

7976
#[snafu(display("failed to resolve parent directory of image config at {path}", path = path.display()))]
8077
ResolveParentDirectory { path: PathBuf },
78+
79+
#[snafu(display("provided filter version(s) ({image_name}={versions}) yielded empty list", versions = versions.join(", ")))]
80+
EmptyFilter {
81+
versions: Vec<String>,
82+
image_name: String,
83+
},
8184
}
8285

8386
#[derive(Debug, Default)]
@@ -187,9 +190,15 @@ impl Targets {
187190
ImageConfig::from_file(image_config_path).context(ReadImageConfigSnafu)?;
188191

189192
// Create a list of image versions we need to generate targets for in the bakefile.
190-
image_config
191-
.filter_by_version(&image.versions)
192-
.context(InvalidImageVersionSnafu)?;
193+
image_config.filter_by_version(&image.versions);
194+
195+
ensure!(
196+
!image_config.versions.is_empty(),
197+
EmptyFilterSnafu {
198+
versions: image.versions.clone(),
199+
image_name: image.name.clone(),
200+
}
201+
);
193202

194203
targets.insert_targets(image.name.clone(), image_config, &options, true)?;
195204
}
@@ -222,9 +231,15 @@ impl Targets {
222231
let mut image_config =
223232
ImageConfig::from_file(image_config_path).context(ReadImageConfigSnafu)?;
224233

225-
image_config
226-
.filter_by_version(&[image_version])
227-
.context(InvalidImageVersionSnafu)?;
234+
image_config.filter_by_version(&[image_version]);
235+
236+
ensure!(
237+
!image_config.versions.is_empty(),
238+
EmptyFilterSnafu {
239+
versions: vec![image_version.clone()],
240+
image_name: image_name.clone(),
241+
}
242+
);
228243

229244
// Wowzers, recursion!
230245
self.insert_targets(image_name.clone(), image_config, options, false)?;

rust/boil/src/core/image.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,6 @@ pub enum ImageConfigError {
108108

109109
#[snafu(display("failed to deserialize config file from TOML"))]
110110
Deserialize { source: toml::de::Error },
111-
112-
#[snafu(display("provided filter version yielded empty list"))]
113-
EmptyFilter,
114111
}
115112

116113
#[derive(Debug, Deserialize)]
@@ -130,16 +127,13 @@ impl ImageConfig {
130127
pub const FLAT_CONFIG_GLOB_PATTERN: &str = "*/boil-config.toml";
131128

132129
/// This function removes versions in the config filtered out by `versions`.
133-
pub fn filter_by_version<V>(&mut self, versions: &[V]) -> Result<(), ImageConfigError>
130+
pub fn filter_by_version<V>(&mut self, versions: &[V])
134131
where
135132
V: AsRef<str> + PartialEq,
136133
{
137134
self.versions.retain(|image_version, _| {
138135
versions.is_empty() || versions.iter().any(|v| v.as_ref() == image_version)
139136
});
140-
141-
ensure!(!self.versions.is_empty(), EmptyFilterSnafu);
142-
Ok(())
143137
}
144138
}
145139

0 commit comments

Comments
 (0)