MCPcopy Create free account
hub / github.com/compozy/agh / ValidateWorkspaceID

Function ValidateWorkspaceID

internal/network/validate.go:119–128  ·  view source on GitHub ↗

ValidateWorkspaceID reports whether the workspace identity can safely occupy one NATS subject token and one protocol envelope field.

(workspaceID string)

Source from the content-addressed store, hash-verified

117// ValidateWorkspaceID reports whether the workspace identity can safely occupy
118// one NATS subject token and one protocol envelope field.
119func ValidateWorkspaceID(workspaceID string) error {
120 trimmed := strings.TrimSpace(workspaceID)
121 if trimmed == "" {
122 return fmt.Errorf("%w: workspace_id is required", ErrMissingField)
123 }
124 if strings.ContainsAny(trimmed, ". *>") || containsControlCharacter(trimmed) {
125 return fmt.Errorf("%w: workspace_id=%q", ErrInvalidField, workspaceID)
126 }
127 return nil
128}
129
130// ValidateSurface reports whether the surface matches the RFC conversation values.
131func ValidateSurface(surface Surface) error {

Callers 10

ValidateMethod · 0.85
BroadcastSubjectFunction · 0.85
DirectSubjectFunction · 0.85
DirectRoomIdentityFunction · 0.85
validateEnvelopeHeaderFunction · 0.85
ValidateMethod · 0.85
RefreshRemoteDetailedMethod · 0.85
prepareRuntimeSendMethod · 0.85

Calls 1

containsControlCharacterFunction · 0.70

Tested by

no test coverage detected