Skip to content
Snippets Groups Projects
Commit cc314690 authored by Kazumasa Kohtaka's avatar Kazumasa Kohtaka
Browse files

Avoid generating an identifer which starts with a number because it may be...

Avoid generating an identifer which starts with a number because it may be used as a SAML's ID attribute
parent 6f2af269
Branches
Tags
No related merge requests found
......@@ -30,8 +30,8 @@ func NewID() string {
if _, err := io.ReadFull(rand.Reader, buff); err != nil {
panic(err)
}
// Trim padding
return strings.TrimRight(encoding.EncodeToString(buff), "=")
// Avoid the identifier to begin with number and trim padding
return string(buff[0]%26+'a') + strings.TrimRight(encoding.EncodeToString(buff[1:]), "=")
}
// GCResult returns the number of objects deleted by garbage collection.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment