Skip to content
Merged
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
5 changes: 4 additions & 1 deletion src/allowlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,10 @@ mod tests {
allowed_ports: Some(vec![443, 8443]),
}];
let al = Allowlist::new(&rules, Action::Deny);
assert!(matches!(al.check("api.openai.com:8443"), Decision::Allow(_)));
assert!(matches!(
al.check("api.openai.com:8443"),
Decision::Allow(_)
));
assert!(matches!(al.check("api.openai.com:9999"), Decision::Deny));
}

Expand Down
4 changes: 3 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ impl Config {
}

pub fn secrets_dir(&self) -> &str {
self.secrets_dir.as_deref().unwrap_or("/var/run/secrets/botbox")
self.secrets_dir
.as_deref()
.unwrap_or("/var/run/secrets/botbox")
}

pub fn max_connections(&self) -> u32 {
Expand Down
5 changes: 4 additions & 1 deletion src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,10 @@ mod tests {
#[test]
fn test_host_header_value_ipv6_non_443_port() {
assert_eq!(host_header_value("[::1]:8443"), "[::1]:8443");
assert_eq!(host_header_value("[2001:db8::1]:8080"), "[2001:db8::1]:8080");
assert_eq!(
host_header_value("[2001:db8::1]:8080"),
"[2001:db8::1]:8080"
);
}

#[test]
Expand Down
3 changes: 2 additions & 1 deletion src/secrets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ pub fn load_secrets_from_dir(dir: &Path) -> Result<HashMap<String, SecretString>
}

// Canonicalize the base directory for prefix checking
let canonical_dir = dir.canonicalize()
let canonical_dir = dir
.canonicalize()
.with_context(|| format!("canonicalizing secrets directory: {:?}", dir))?;

let entries =
Expand Down