Skip to content

RoleSessionName Exceeds Maximum Length Constraint #243

@markussiebert

Description

@markussiebert

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions