diff --git a/buildpacks/ruby/src/layers/bundle_download_layer.rs b/buildpacks/ruby/src/layers/bundle_download_layer.rs index 066a83a8..1dedcb90 100644 --- a/buildpacks/ruby/src/layers/bundle_download_layer.rs +++ b/buildpacks/ruby/src/layers/bundle_download_layer.rs @@ -59,6 +59,7 @@ try_migrate_deserializer_chain!( ); #[derive(Deserialize, Serialize, Debug, Clone, CacheDiff)] +#[serde(deny_unknown_fields)] pub(crate) struct MetadataV1 { #[cache_diff(rename = "Bundler version")] pub(crate) version: ResolvedBundlerVersion, diff --git a/buildpacks/ruby/src/layers/bundle_install_layer.rs b/buildpacks/ruby/src/layers/bundle_install_layer.rs index 6344f3c3..7dca1f19 100644 --- a/buildpacks/ruby/src/layers/bundle_install_layer.rs +++ b/buildpacks/ruby/src/layers/bundle_install_layer.rs @@ -125,6 +125,7 @@ try_migrate_deserializer_chain!( ); #[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq)] +#[serde(deny_unknown_fields)] pub(crate) struct MetadataV1 { pub(crate) stack: String, pub(crate) ruby_version: ResolvedRubyVersion, @@ -133,6 +134,7 @@ pub(crate) struct MetadataV1 { } #[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq)] +#[serde(deny_unknown_fields)] pub(crate) struct MetadataV2 { pub(crate) distro_name: String, pub(crate) distro_version: String, @@ -315,6 +317,7 @@ fn display_name(cmd: &mut Command, env: &Env) -> String { } #[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq, Default)] +#[serde(deny_unknown_fields)] pub(crate) struct BundleDigest { env: String, gemfile: String, diff --git a/buildpacks/ruby/src/layers/metrics_agent_install.rs b/buildpacks/ruby/src/layers/metrics_agent_install.rs index 2543f843..2c289194 100644 --- a/buildpacks/ruby/src/layers/metrics_agent_install.rs +++ b/buildpacks/ruby/src/layers/metrics_agent_install.rs @@ -30,6 +30,7 @@ const DOWNLOAD_URL: &str = const DOWNLOAD_SHA: &str = "f9bf9f33c949e15ffed77046ca38f8dae9307b6a0181c6af29a25dec46eb2dac"; #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)] +#[serde(deny_unknown_fields)] pub(crate) struct Metadata { download_url: String, } diff --git a/buildpacks/ruby/src/layers/ruby_install_layer.rs b/buildpacks/ruby/src/layers/ruby_install_layer.rs index 8d72b6d0..229512ee 100644 --- a/buildpacks/ruby/src/layers/ruby_install_layer.rs +++ b/buildpacks/ruby/src/layers/ruby_install_layer.rs @@ -76,12 +76,14 @@ fn install_ruby(metadata: &Metadata, layer_path: &Path) -> Result<(), RubyBuildp } #[derive(Deserialize, Serialize, Debug, Clone)] +#[serde(deny_unknown_fields)] pub(crate) struct MetadataV1 { pub(crate) stack: String, pub(crate) version: ResolvedRubyVersion, } #[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq)] +#[serde(deny_unknown_fields)] pub(crate) struct MetadataV2 { pub(crate) distro_name: String, pub(crate) distro_version: String, diff --git a/commons/src/cache/app_cache.rs b/commons/src/cache/app_cache.rs index 773cb9c9..395aa138 100644 --- a/commons/src/cache/app_cache.rs +++ b/commons/src/cache/app_cache.rs @@ -251,6 +251,7 @@ pub enum PathState { /// allows for emails, that might live a long time, to reference a specific SHA of an /// asset. #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)] +#[serde(deny_unknown_fields)] pub(crate) struct Metadata { pub(crate) app_dir_path: PathBuf, } diff --git a/commons/src/metadata_digest.rs b/commons/src/metadata_digest.rs index 2f9ce418..04f1e016 100644 --- a/commons/src/metadata_digest.rs +++ b/commons/src/metadata_digest.rs @@ -20,6 +20,7 @@ const PLATFORM_ENV_VAR: &str = "user configured environment variables"; /// use commons::metadata_digest::MetadataDigest; /// /// #[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq)] +/// #[serde(deny_unknown_fields)] /// pub(crate) struct BundleInstallLayerMetadata { /// ruby_version: String, /// force_bundle_install_key: String, @@ -82,6 +83,7 @@ const PLATFORM_ENV_VAR: &str = "user configured environment variables"; /// # } /// # /// # #[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq)] +/// # #[serde(deny_unknown_fields)] /// # struct FakeLayerMetadata { /// # digest: MetadataDigest, /// # }