gsmvalidation

package
v0.0.0-...-77434bf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CollectionSecretDelimiter is the separator between collection and secret name in GSM
	CollectionSecretDelimiter = "__"

	// Encoding constants for special characters
	DotReplacementString = "--dot--"
	// UnderscorePrefix/Suffix for encoding consecutive underscores
	// __ → --uu--, ___ → --uuu--, etc.
	UnderscorePrefix = "--"
	UnderscoreSuffix = "--"

	CollectionRegex = "^([a-z0-9_-]*[a-z0-9])?$"
	GroupRegex      = `^[a-z0-9]+([a-z0-9_-]*[a-z0-9]+)?(/[a-z0-9]+([a-z0-9_-]*[a-z0-9]+)?)*$`
	SecretNameRegex = "^[A-Za-z0-9_-]+$"

	// MaxCollectionLength is the maximum length of a collection name
	MaxCollectionLength = 50

	// GcpMaxNameLength is the maximum length for a GSM secret name
	GcpMaxNameLength = 255
)

Variables

This section is empty.

Functions

func DenormalizeName

func DenormalizeName(name string) string

DenormalizeName decodes field names back to their original form. This reverses the encoding done by NormalizeName. Decodes in reverse order of NormalizeName.

func NormalizeName

func NormalizeName(name string) string

NormalizeName replaces forbidden characters in names with safe replacements. This is used when migrating from Vault to GSM to handle special characters. Rules (applied in order):

  1. `__` (2+ consecutive underscores) → `--uu--`, `--uuu--`, etc.
  2. `.` → `--dot--` (dots not allowed in GSM secret names)

Examples:

  • ".dockerconfigjson" → "--dot--dockerconfigjson"
  • "mac_ai__base_dir" → "mac_ai--uu--base_dir"
  • "some___field" → "some--uuu--field"
  • "field.with__both" → "field--dot--with--uu--both"

func ValidateCollectionName

func ValidateCollectionName(collection string) bool

ValidateCollectionName validates a GSM collection name

func ValidateGroupName

func ValidateGroupName(group string) bool

func ValidateSecretName

func ValidateSecretName(secretName string) bool

ValidateSecretName validates a GSM secret name

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL