Browse Source
Update weed/s3api/s3api_sts.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
pull/8003/head
Chris Lu
16 hours ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
1 additions and
2 deletions
-
weed/s3api/s3api_sts.go
|
|
|
@ -500,8 +500,7 @@ func (h *STSHandlers) prepareSTSCredentials(roleArn, roleSessionName, principalA |
|
|
|
// We use 8 bytes (16 hex chars)
|
|
|
|
accessKeyId := "ASIA" + fmt.Sprintf("%X", randBytes[:8]) |
|
|
|
|
|
|
|
// Generate SecretAccessKey (base64 of 30 bytes is 40 characters)
|
|
|
|
// We use the remaining bytes or generate new ones? Let's assume we need 32 bytes for strong secret
|
|
|
|
// Generate SecretAccessKey: 30 random bytes, base64-encoded to a 40-character string
|
|
|
|
secretBytes := make([]byte, 30) |
|
|
|
if _, err := rand.Read(secretBytes); err != nil { |
|
|
|
return STSCredentials{}, nil, fmt.Errorf("failed to generate secret bytes: %w", err) |
|
|
|
|