The roleSessionName function generates a name that may exceed the 64-character constraint, causing a ValidationError. This issue arises when the hostname used for the suffix is too long.
ValidationError: 1 validation error detected: Value 'aws-sigv4-proxy-our-very-long-host-name-that-is-far-more-than-60-characters-long...' at 'roleSessionName' failed to satisfy constraint: Member must have length less than or equal to 64
How to reproduce
- Use a hostname longer than 60 characters.
- Execute the code from the aws-sigv4-proxy repository.
- Observe the ValidationError related to the roleSessionName.
Suggested Solutions
- Automatically truncate the session name to fit within 64 characters.
- Allow setting AWS_ROLE_SESSION_NAME via environment variable or CLI flag for customization.
- If more reproduction steps or environment details are available, please provide them.
see also:
https://github.com/awslabs/aws-sigv4-proxy/blob/1515ef92f92a40e885da62f78f8bbadc0baf3039/cmd/aws-sigv4-proxy/main.go#L174C1-L183C2
func roleSessionName() string {
suffix, err := os.Hostname()
if err != nil {
now := time.Now().Unix()
suffix = strconv.FormatInt(now, 10)
}
return "aws-sigv4-proxy-" + suffix
}
The roleSessionName function generates a name that may exceed the 64-character constraint, causing a ValidationError. This issue arises when the hostname used for the suffix is too long.
How to reproduce
Suggested Solutions
see also:
https://github.com/awslabs/aws-sigv4-proxy/blob/1515ef92f92a40e885da62f78f8bbadc0baf3039/cmd/aws-sigv4-proxy/main.go#L174C1-L183C2