c82668c789
Co-authored-by: Vojtěch Biberle <vojtech.biberle@gmail.com> Co-authored-by: nova28 <17953305+nova28@users.noreply.github.com> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> Co-authored-by: Carlos Florencio <carlosmflorencio@gmail.com>
21 lines
692 B
Go
21 lines
692 B
Go
// Package origin carries trusted, process-local MCP transport attestations.
|
|
// Wire payloads cannot create these markers.
|
|
package origin
|
|
|
|
import "context"
|
|
|
|
type externalTransportKey struct{}
|
|
|
|
// WithTrustedExternalTransport marks a context after it enters through the
|
|
// backend's external MCP transport boundary.
|
|
func WithTrustedExternalTransport(ctx context.Context) context.Context {
|
|
return context.WithValue(ctx, externalTransportKey{}, true)
|
|
}
|
|
|
|
// IsTrustedExternalTransport reports whether the external MCP boundary marked
|
|
// the context in-process.
|
|
func IsTrustedExternalTransport(ctx context.Context) bool {
|
|
trusted, _ := ctx.Value(externalTransportKey{}).(bool)
|
|
return trusted
|
|
}
|