style: cargo fmt --all — make codebase rustfmt-clean
Some checks failed
Build and Test / Build Server (Linux) (push) Failing after 2m59s
Build and Test / Build Agent (Windows) (push) Has started running
Build and Test / Security Audit (push) Has been cancelled
Build and Test / Build Summary (push) Has been cancelled
Run Tests / Test Server (push) Has been cancelled
Run Tests / Test Agent (push) Has been cancelled
Run Tests / Code Coverage (push) Has been cancelled
Run Tests / Lint and Format Check (push) Has been cancelled
Some checks failed
Build and Test / Build Server (Linux) (push) Failing after 2m59s
Build and Test / Build Agent (Windows) (push) Has started running
Build and Test / Security Audit (push) Has been cancelled
Build and Test / Build Summary (push) Has been cancelled
Run Tests / Test Server (push) Has been cancelled
Run Tests / Test Agent (push) Has been cancelled
Run Tests / Code Coverage (push) Has been cancelled
Run Tests / Lint and Format Check (push) Has been cancelled
First run of the build-and-test CI gate (cargo fmt --all -- --check) surfaced pre-existing formatting drift across the agent and server crates. Apply rustfmt across the workspace so the codebase meets its own CI gate. Pure formatting; no logic changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -11,18 +11,29 @@ use anyhow::{anyhow, Result};
|
||||
pub fn validate_api_key_strength(api_key: &str) -> Result<()> {
|
||||
// Minimum length check
|
||||
if api_key.len() < 32 {
|
||||
return Err(anyhow!("API key must be at least 32 characters long for security"));
|
||||
return Err(anyhow!(
|
||||
"API key must be at least 32 characters long for security"
|
||||
));
|
||||
}
|
||||
|
||||
// Check for common weak keys
|
||||
let weak_keys = [
|
||||
"password", "12345", "admin", "test", "api_key",
|
||||
"secret", "changeme", "default", "guruconnect"
|
||||
"password",
|
||||
"12345",
|
||||
"admin",
|
||||
"test",
|
||||
"api_key",
|
||||
"secret",
|
||||
"changeme",
|
||||
"default",
|
||||
"guruconnect",
|
||||
];
|
||||
let lowercase_key = api_key.to_lowercase();
|
||||
for weak in &weak_keys {
|
||||
if lowercase_key.contains(weak) {
|
||||
return Err(anyhow!("API key contains weak/common patterns and is not secure"));
|
||||
return Err(anyhow!(
|
||||
"API key contains weak/common patterns and is not secure"
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +64,9 @@ mod tests {
|
||||
assert!(validate_api_key_strength("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").is_err());
|
||||
|
||||
// Good key
|
||||
assert!(validate_api_key_strength("KfPrjjC3J6YMx9q1yjPxZAYkHLM2JdFy1XRxHJ9oPnw0NU3xH074ufHk7fj").is_ok());
|
||||
assert!(validate_api_key_strength(
|
||||
"KfPrjjC3J6YMx9q1yjPxZAYkHLM2JdFy1XRxHJ9oPnw0NU3xH074ufHk7fj"
|
||||
)
|
||||
.is_ok());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user