Skip to content

Commit cb9b3e2

Browse files
committed
Fix cargo fmt formatting
1 parent ac029ae commit cb9b3e2

5 files changed

Lines changed: 34 additions & 21 deletions

File tree

crates/runtime/src/api/api_keys.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,7 @@ impl ApiKeyStore {
199199
let salt = SaltString::generate(&mut rand::thread_rng());
200200
let params = argon2::Params::new(19 * 1024, 2, 1, None)
201201
.map_err(|e| format!("Invalid Argon2 parameters: {}", e))?;
202-
let argon2 =
203-
Argon2::new(argon2::Algorithm::Argon2id, argon2::Version::V0x13, params);
202+
let argon2 = Argon2::new(argon2::Algorithm::Argon2id, argon2::Version::V0x13, params);
204203
let hash = argon2
205204
.hash_password(raw_key.as_bytes(), &salt)
206205
.map_err(|e| format!("Failed to hash key: {}", e))?;

crates/runtime/src/integrations/policy_engine/engine.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,7 @@ impl OpaClient {
165165
.cloned()
166166
.unwrap_or(serde_json::json!(false)))
167167
} else {
168-
tracing::warn!(
169-
"OPA returned HTTP {}: denying by default",
170-
resp.status()
171-
);
168+
tracing::warn!("OPA returned HTTP {}: denying by default", resp.status());
172169
Ok(serde_json::json!(false))
173170
}
174171
}

crates/runtime/src/integrations/schemapin/native_client.rs

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,14 @@ impl SchemaPinClient for NativeSchemaPinClient {
141141

142142
// Attempt to extract an embedded signature from the schema JSON.
143143
// Schemas signed by SchemaPin contain a top-level `signature` field.
144-
let embedded_signature: Option<String> = serde_json::from_slice::<serde_json::Value>(&schema_data)
145-
.ok()
146-
.and_then(|v| v.get("signature").and_then(|s| s.as_str()).map(String::from));
144+
let embedded_signature: Option<String> =
145+
serde_json::from_slice::<serde_json::Value>(&schema_data)
146+
.ok()
147+
.and_then(|v| {
148+
v.get("signature")
149+
.and_then(|s| s.as_str())
150+
.map(String::from)
151+
});
147152

148153
if let Some(ref sig) = embedded_signature {
149154
// Verify the embedded signature against the schema content and fetched public key
@@ -155,14 +160,17 @@ impl SchemaPinClient for NativeSchemaPinClient {
155160
if let Some(obj) = schema_value.as_object_mut() {
156161
obj.remove("signature");
157162
}
158-
let canonical_payload = serde_json::to_vec(&schema_value)
159-
.map_err(|e| SchemaPinError::IoError {
163+
let canonical_payload =
164+
serde_json::to_vec(&schema_value).map_err(|e| SchemaPinError::IoError {
160165
reason: format!("Failed to serialize canonical schema: {}", e),
161166
})?;
162167

163168
match verify_signature(&public_key_pem, &canonical_payload, sig) {
164169
Ok(true) => {
165-
tracing::info!("Schema signature verified successfully for {}", args.schema_path);
170+
tracing::info!(
171+
"Schema signature verified successfully for {}",
172+
args.schema_path
173+
);
166174
Ok(VerificationResult {
167175
success: true,
168176
message: "Schema signature verified successfully using native Rust implementation".to_string(),
@@ -179,10 +187,14 @@ impl SchemaPinClient for NativeSchemaPinClient {
179187
})
180188
}
181189
Ok(false) => {
182-
tracing::warn!("Schema signature verification failed: signature invalid for {}", args.schema_path);
190+
tracing::warn!(
191+
"Schema signature verification failed: signature invalid for {}",
192+
args.schema_path
193+
);
183194
Ok(VerificationResult {
184195
success: false,
185-
message: "Schema signature verification failed: signature is invalid".to_string(),
196+
message: "Schema signature verification failed: signature is invalid"
197+
.to_string(),
186198
schema_hash: Some(schema_hash),
187199
public_key_url: Some(args.public_key_url.clone()),
188200
signature: Some(SignatureInfo {
@@ -196,7 +208,11 @@ impl SchemaPinClient for NativeSchemaPinClient {
196208
})
197209
}
198210
Err(e) => {
199-
tracing::warn!("Schema signature verification error for {}: {}", args.schema_path, e);
211+
tracing::warn!(
212+
"Schema signature verification error for {}: {}",
213+
args.schema_path,
214+
e
215+
);
200216
Ok(VerificationResult {
201217
success: false,
202218
message: format!("Schema signature verification error: {}", e),

crates/runtime/src/secrets/auditing.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use thiserror::Error;
1212
use tokio::fs::OpenOptions;
1313
use tokio::io::AsyncWriteExt;
1414

15-
1615
/// Controls whether audit failures block secret operations
1716
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1817
#[serde(rename_all = "lowercase")]
@@ -208,9 +207,12 @@ impl SecretAuditSink for JsonFileAuditSink {
208207
opts.create(true).append(true);
209208
#[cfg(unix)]
210209
opts.mode(0o600); // Owner-only read/write
211-
let mut file = opts.open(&self.file_path).await.map_err(|e| AuditError::IoError {
212-
message: format!("Failed to open audit log file: {}", e),
213-
})?;
210+
let mut file = opts
211+
.open(&self.file_path)
212+
.await
213+
.map_err(|e| AuditError::IoError {
214+
message: format!("Failed to open audit log file: {}", e),
215+
})?;
214216

215217
// Write the JSON line followed by a newline
216218
file.write_all(json_line.as_bytes())

crates/runtime/src/toolclad/executor.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,8 +748,7 @@ fn evaluate_condition(when: &str, args: &HashMap<String, String>) -> bool {
748748

749749
/// Reject URLs targeting private/internal IP ranges to prevent SSRF.
750750
fn reject_ssrf_url(url: &str) -> Result<(), String> {
751-
let parsed =
752-
url::Url::parse(url).map_err(|e| format!("Invalid URL '{}': {}", url, e))?;
751+
let parsed = url::Url::parse(url).map_err(|e| format!("Invalid URL '{}': {}", url, e))?;
753752

754753
// Only allow http/https
755754
if !matches!(parsed.scheme(), "http" | "https") {

0 commit comments

Comments
 (0)