test(credentials): avoid printing default secret (#2820)

Signed-off-by: houseme <housemecn@gmail.com>
Co-authored-by: houseme <housemecn@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: loverustfs <hello@rustfs.com>
Co-authored-by: 安正超 <anzhengchao@gmail.com>
This commit is contained in:
Henry Guo
2026-05-06 13:19:42 +08:00
committed by GitHub
parent 3dd0692917
commit 7692c0c3bd
2 changed files with 8 additions and 6 deletions

View File

@@ -66,7 +66,7 @@ mod tests {
// In production environment, access key and secret key should be different
// These are default values, so being the same is acceptable, but should be warned in documentation
println!("Warning: Default access key and secret key are the same. Change them in production!");
assert_eq!(DEFAULT_ACCESS_KEY, DEFAULT_SECRET_KEY);
}
#[test]
@@ -74,10 +74,8 @@ mod tests {
// Test security best practices
// These are default values, should be changed in production environments
println!("Security Warning: Default credentials detected!");
println!("Access Key: {DEFAULT_ACCESS_KEY}");
println!("Secret Key: {DEFAULT_SECRET_KEY}");
println!("These should be changed in production environments!");
assert_eq!(DEFAULT_ACCESS_KEY, "rustfsadmin");
assert_eq!(DEFAULT_SECRET_KEY, "rustfsadmin");
// Verify that key lengths meet minimum security requirements
assert!(DEFAULT_ACCESS_KEY.len() >= 8, "Access key should be at least 8 characters");

View File

@@ -16,8 +16,12 @@ Group=rustfs
# working directory
WorkingDirectory=/opt/rustfs
# environment variable configuration and main program (single active ExecStart).
# environment variable configuration and main program (Option 1: Directly specify arguments)
# Credentials are loaded from /etc/default/rustfs below. Replace the sample values before deployment.
ExecStart=/usr/local/bin/rustfs \
--address 0.0.0.0:9000 \
--volumes /data/rustfs/vol1,/data/rustfs/vol2 \
--console-enable
# environment variable configuration (Option 2: Use environment variables)
# rustfs example file see: `../config/rustfs.env`