Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump validator from "0.16.1" to "0.18.1" #1141

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion northstar-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ toml = { version = "0.8.14", optional = true }
umask = { version = "2.1.0", optional = true }
url = { version = "2.5.0", features = ["serde"], optional = true }
uuid = { version = "1.7.0", features = ["v4"], optional = true }
validator = { version = "0.16.1", features = ["derive"] }
validator = { version = "0.18.1", features = ["derive"] }
zeroize = { version = "1.7.0", optional = true }
zip = { version = "0.6.6", default-features = false, optional = true }

Expand Down
8 changes: 0 additions & 8 deletions northstar-runtime/src/common/non_nul_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use std::{
path::Path,
};
use thiserror::Error;
use validator::HasLen;

/// String that does not contain null bytes
#[derive(Clone, Eq, PartialOrd, Ord, PartialEq, Hash)]
Expand Down Expand Up @@ -150,13 +149,6 @@ impl<'de> Deserialize<'de> for NonNulString {
}
}

/// Implement HasLen for NonNulString to allow validation of the length.
impl HasLen for &NonNulString {
fn length(&self) -> u64 {
self.0.len() as u64
}
}

#[test]
fn try_from() {
assert!(NonNulString::try_from("hello").is_ok());
Expand Down
14 changes: 7 additions & 7 deletions northstar-runtime/src/npk/manifest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub struct Manifest {
pub args: Vec<NonNulString>,
/// Environment passed to container
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
#[validate(custom = "validate_env")]
#[validate(custom(function = "validate_env"))]
pub env: HashMap<NonNulString, NonNulString>,
/// UID
#[validate(range(min = 1, message = "uid must be greater than 0"))]
Expand All @@ -110,28 +110,28 @@ pub struct Manifest {
#[validate(range(min = 1, message = "gid must be greater than 0"))]
pub gid: u16,
/// Scheduling parameter.
#[validate]
#[validate(nested)]
pub sched: Option<sched::Sched>,
/// List of bind mounts and resources
#[serde(
default,
skip_serializing_if = "HashMap::is_empty",
deserialize_with = "maps_duplicate_key_is_error::deserialize"
)]
#[validate(custom = "mount::validate")]
#[validate(custom(function = "mount::validate"))]
pub mounts: HashMap<mount::MountPoint, mount::Mount>,
/// Autostart this container upon northstar startup
pub autostart: Option<autostart::Autostart>,
/// CGroup configuration
pub cgroups: Option<self::cgroups::CGroups>,
/// Network configuration. Unshare the network if omitted.
#[validate(custom = "network::validate")]
#[validate(custom(function = "network::validate"))]
pub network: Option<Network>,
/// Seccomp configuration
#[validate(custom = "seccomp::validate")]
#[validate(custom(function = "seccomp::validate"))]
pub seccomp: Option<Seccomp>,
/// SELinux configuration
#[validate]
#[validate(nested)]
pub selinux: Option<selinux::Selinux>,
/// Capabilities
#[serde(
Expand All @@ -146,7 +146,7 @@ pub struct Manifest {
skip_serializing_if = "HashSet::is_empty",
deserialize_with = "sets_duplicate_value_is_error::deserialize"
)]
#[validate(custom = "validate_suppl_groups")]
#[validate(custom(function = "validate_suppl_groups"))]
pub suppl_groups: HashSet<NonNulString>,
/// Resource limits
#[serde(
Expand Down
2 changes: 1 addition & 1 deletion northstar-runtime/src/npk/manifest/sched.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub enum Policy {
#[serde(rename_all = "snake_case")]
pub struct Sched {
/// Scheduling policy.
#[validate(custom = "validate_policy")]
#[validate(custom(function = "validate_policy"))]
pub policy: Policy,
}

Expand Down
4 changes: 2 additions & 2 deletions northstar-runtime/src/npk/manifest/selinux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ use crate::common::non_nul_string::NonNulString;
#[serde(deny_unknown_fields)]
pub struct Selinux {
/// Default SE label (mount option context=...).
#[validate(custom = "validate_context")]
#[validate(custom(function = "validate_context"))]
pub mount_context: Option<NonNulString>,
/// SE context for the execve call from init.
#[validate(custom = "validate_context")]
#[validate(custom(function = "validate_context"))]
pub exec: Option<NonNulString>,
}

Expand Down
Loading