Fix special characters in admin-generated secret keys (#7994)

Fixes #7990

The issue was that the Charset constant used for generating secret keys
included the '/' character, which is URL-unsafe. When secret keys
containing '/' were used in HTTP requests, they would be URL-encoded,
causing a mismatch during signature verification.

Changes:
- Removed '/' from the Charset constant in weed/iam/constants.go
- Added TestGenerateSecretAccessKey_URLSafe to verify generated keys
  don't contain URL-unsafe characters like '/' or '+'

This ensures all newly generated secret keys are URL-safe and will
work correctly with S3 authentication. Existing keys continue to work.
This commit is contained in:
Chris Lu
2026-01-09 11:55:17 -08:00
committed by GitHub
parent 1ea6b0c0d9
commit ad76487e9d
2 changed files with 18 additions and 1 deletions

View File

@@ -3,7 +3,7 @@ package iam
// Character sets for credential generation
const (
CharsetUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
Charset = CharsetUpper + "abcdefghijklmnopqrstuvwxyz/"
Charset = CharsetUpper + "abcdefghijklmnopqrstuvwxyz"
)
// Policy document version