Skip to content

Commit

Permalink
Fixes #22887: Update embedded openssl to 1.1.1u - relayd (#4830)
Browse files Browse the repository at this point in the history
  • Loading branch information
amousset committed Jun 14, 2023
1 parent a6c83d3 commit aa61416
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 23 deletions.
8 changes: 4 additions & 4 deletions relay/sources/relayd/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion relay/sources/relayd/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.62.1-bullseye
FROM rust:1.70.0-bullseye

ARG USER_ID=1000
COPY ci/user.sh .
Expand Down
2 changes: 1 addition & 1 deletion relay/sources/relayd/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.62.1"
channel = "1.70.0"

4 changes: 2 additions & 2 deletions relay/sources/relayd/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ impl fmt::Debug for Secret {
type Warnings = Vec<Error>;

pub fn check_configuration(cfg_dir: &Path) -> Result<Warnings, Error> {
let cfg = Configuration::new(&cfg_dir)?;
let cfg = Configuration::new(cfg_dir)?;
let warns = cfg.warnings();
LogConfig::new(&cfg_dir)?;
LogConfig::new(cfg_dir)?;
Ok(warns)
}
11 changes: 3 additions & 8 deletions relay/sources/relayd/src/hashing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl fmt::Debug for Hash {
impl Hash {
pub fn new(hash_type: &str, hex_value: &str) -> Result<Hash, Error> {
let hash_type = HashType::from_str(hash_type)?;
let value = hex::decode(&hex_value)?;
let value = hex::decode(hex_value)?;

if hash_type.is_valid_hash(&value) {
Ok(Hash { hash_type, value })
Expand Down Expand Up @@ -87,18 +87,13 @@ impl fmt::Display for Hash {
}
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum HashType {
Sha256,
#[default]
Sha512,
}

impl Default for HashType {
fn default() -> Self {
HashType::Sha512
}
}

impl FromStr for HashType {
type Err = Error;

Expand Down
14 changes: 7 additions & 7 deletions relay/sources/relayd/tests/shared_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ fn it_shares_files() {
// tools/rudder-sign tests/api_shared_files/37817c4d-fbf7-4850-a985-50021f4e8f41/e745a140-40bc-4b86-b6dc-084488fc906b/file2 tests/files/keys/e745a140-40bc-4b86-b6dc-084488fc906b.priv tests/files/keys/e745a140-40bc-4b86-b6dc-084488fc906b.pub "node1.rudder.local"

let file = "tests/api_shared_files/37817c4d-fbf7-4850-a985-50021f4e8f41/files/e745a140-40bc-4b86-b6dc-084488fc906b/file2";
let signature = read_to_string(&format!("{}.sign", file)).unwrap();
let content = read_to_string(&format!("{}.source", file)).unwrap();
let signature = read_to_string(format!("{}.sign", file)).unwrap();
let content = read_to_string(format!("{}.source", file)).unwrap();

// Wrong digest

let wrong_signature = read_to_string(&format!("{}.wrongsign", file)).unwrap();
let wrong_signature = read_to_string(format!("{}.wrongsign", file)).unwrap();
let upload = client.put("http://127.0.0.1:3030/rudder/relay-api/1/shared-files/37817c4d-fbf7-4850-a985-50021f4e8f41/e745a140-40bc-4b86-b6dc-084488fc906b/file2?ttl=1d").body(format!("{}\n{}", wrong_signature, content))
.send().unwrap();
assert_eq!(500, upload.status());
Expand All @@ -84,24 +84,24 @@ fn it_shares_files() {
assert_eq!(200, upload.status());

let mut written_metadata =
Metadata::from_str(&read_to_string(&format!("{}.metadata", file)).unwrap()).unwrap();
Metadata::from_str(&read_to_string(format!("{}.metadata", file)).unwrap()).unwrap();
let expiration = (chrono::Utc::now() + chrono::Duration::days(1)).timestamp();
// Check expiration is correct
assert!((expiration - written_metadata.expires.unwrap()).abs() < 500);
written_metadata.expires = None;

let source_metadata =
Metadata::from_str(&read_to_string(&format!("{}.sign", file)).unwrap()).unwrap();
Metadata::from_str(&read_to_string(format!("{}.sign", file)).unwrap()).unwrap();

// Check uploaded file
assert_eq!(
read_to_string(file).unwrap(),
read_to_string(&format!("{}.source", file)).unwrap()
read_to_string(format!("{}.source", file)).unwrap()
);
// Check metadata file
assert_eq!(source_metadata, written_metadata);

// Remove leftover
remove_file(file).unwrap();
remove_file(&format!("{}.metadata", file)).unwrap();
remove_file(format!("{}.metadata", file)).unwrap();
}

0 comments on commit aa61416

Please sign in to comment.