Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion internal/services/secretsmanager/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,16 @@ func (p *Provider) cancelRotateSecret(params map[string]any) (*plugin.Response,
// allowedChars is the default character pool for random passwords.
const allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_=+[]{}|;:,.<>?"

// maxRandomPasswordLength caps user-controlled password length to prevent
// excessive memory allocation from untrusted input.
const maxRandomPasswordLength = 4096

func (p *Provider) getRandomPassword(params map[string]any) (*plugin.Response, error) {
length := 32
if l, ok := params["PasswordLength"].(float64); ok && l > 0 {
if l, ok := params["PasswordLength"].(float64); ok {
if l <= 0 || l > maxRandomPasswordLength {
return smError("InvalidParameterException", fmt.Sprintf("PasswordLength must be between 1 and %d", maxRandomPasswordLength), http.StatusBadRequest), nil
}
length = int(l)
}
excludeChars, _ := params["ExcludeCharacters"].(string)
Expand Down
Loading