Documentation
¶
Overview ¶
Package mcppolicy owns the shared security policy for remote MCP endpoints.
Index ¶
- func InputHeaders(headers map[string]string, secret func(string) bool) (map[string]string, map[string]string)
- func PlaceholderURL(value string) string
- func ReplaceInputs(value string, replace func(name, fallback string, optional bool) string) string
- func SecretInputName(name string) bool
- func ValidInputName(name string) bool
- func ValidateHeaders(fixed, secret map[string]string, source HeaderSource, authEnabled bool) error
- func ValidateRemoteURL(raw string) error
- type Code
- type Error
- type HeaderSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InputHeaders ¶
func InputHeaders(headers map[string]string, secret func(string) bool) (map[string]string, map[string]string)
InputHeaders separates user credential templates from package-fixed credentials.
func PlaceholderURL ¶
PlaceholderURL validates the fixed URL structure before user input is available.
func ReplaceInputs ¶
ReplaceInputs scans once so supplied values cannot introduce executable template syntax.
func SecretInputName ¶
func ValidInputName ¶
func ValidateHeaders ¶
func ValidateHeaders(fixed, secret map[string]string, source HeaderSource, authEnabled bool) error
ValidateHeaders enforces header syntax, ownership, and duplicate rules. Fixed headers are always package-authored; source identifies secret headers.
func ValidateRemoteURL ¶
ValidateRemoteURL requires an absolute HTTP(S) endpoint and restricts plain HTTP to the exact localhost name or an IP loopback literal.
Types ¶
type Code ¶
type Code string
Code is a stable machine-readable policy failure reason.
const ( CodeInvalidHeaderName Code = "invalid_header_name" CodeInvalidHeaderValue Code = "invalid_header_value" CodeDuplicateHeader Code = "duplicate_header" CodeReservedHeader Code = "reserved_header" CodePackageCredential Code = "package_credential_forbidden" CodeOperatorCredential Code = "operator_credential_forbidden" CodeOAuthAuthorizationOwned Code = "oauth_authorization_owned" CodeInvalidHeaderSource Code = "invalid_header_source" )
type HeaderSource ¶
type HeaderSource int
HeaderSource identifies who supplied a header value.
const ( SourcePackageFixed HeaderSource = iota SourceOperatorSecret SourceOAuthOwned )