MCPcopy Index your code
hub / github.com/getsops/sops / stsSessionName

Function stsSessionName

kms/keysource.go:462–476  ·  view source on GitHub ↗

stsSessionName returns the name for the STS session in the format of `sops@ `. It sanitizes the hostname with stsSessionRegex, and truncates to roleSessionNameLengthLimit when it exceeds the limit.

()

Source from the content-addressed store, hash-verified

460// `sops@<hostname>`. It sanitizes the hostname with stsSessionRegex, and
461// truncates to roleSessionNameLengthLimit when it exceeds the limit.
462func stsSessionName() (string, error) {
463 hostname, err := osHostname()
464 if err != nil {
465 return "", fmt.Errorf("failed to construct STS session name: %w", err)
466 }
467
468 re := regexp.MustCompile(stsSessionRegex)
469 sanitizedHostname := re.ReplaceAllString(hostname, "")
470
471 name := "sops@" + sanitizedHostname
472 if len(name) >= roleSessionNameLengthLimit {
473 name = name[:roleSessionNameLengthLimit]
474 }
475 return name, nil
476}
477
478func stringPointerToStringMap(in map[string]*string) map[string]string {
479 var out = make(map[string]string)

Callers 2

createSTSConfigMethod · 0.85
Test_stsSessionNameFunction · 0.85

Calls

no outgoing calls

Tested by 1

Test_stsSessionNameFunction · 0.68