mcppolicy

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package mcppolicy owns the shared security policy for remote MCP endpoints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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

func ValidateRemoteURL(raw string) error

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 Error

type Error struct {
	Code   Code
	Header string
}

Error describes one deterministic header-policy failure.

func (*Error) Error

func (e *Error) Error() string

Error returns the stable code and normalized header involved in the failure.

type HeaderSource

type HeaderSource int

HeaderSource identifies who supplied a header value.

const (
	SourcePackageFixed HeaderSource = iota
	SourceOperatorSecret
	SourceOAuthOwned
)

Jump to

Keyboard shortcuts

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