endpoints

package
v1.26.2 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Store

func Store(ctx context.Context, rc *rest.Config, ns string, ep Endpoint) error

Types

type Endpoint

type Endpoint struct {
	ServerURL                string `json:"serverURL"`
	ProxyURL                 string `json:"proxyURL,omitempty"`
	CertificateAuthorityData string `json:"caData,omitempty"`
	ClientCertificateData    string `json:"-"`
	ClientKeyData            string `json:"-"`
	Token                    string `json:"token,omitempty"`
	Username                 string `json:"username,omitempty"`
	Password                 string `json:"password,omitempty"`
	Debug                    bool   `json:"debug"`
	Insecure                 bool   `json:"insecure"`
	// PassCredentialsOnRedirect lets a credential follow a redirect to a DIFFERENT host:port
	// (core-provider#307). Default false, which refuses.
	//
	// NAMED FOR THE HOP, not for the destination, deliberately. helm's equivalent is
	// PassCredentialsAll, and an operator reads "all" as a statement about which destinations are
	// allowed rather than about every hop of a chain they never see. The installer session made
	// exactly that point about an allowAnyHost flag elsewhere: the people who set such a flag are
	// by definition debugging something, and they are the least likely to be thinking about
	// redirects.
	//
	// IT REMOVES THE WHOLE GUARD, not part of it. With this set, a credential will follow a 302
	// anywhere the endpoint sends it - including a subdomain, a different port, or an unrelated
	// host. There is no partial setting and that is on purpose: a half-guard would be harder to
	// reason about than none.
	//
	// It exists because the strict default has a legitimate casualty: an endpoint configured
	// without a port that redirects to one - an on-prem GHES, or a corporate proxy - is a real
	// deployment, and helm's own chart getter has carried PassCredentialsAll for that reason since
	// long before this. Measured on krateo-057: 0 of 3 external targets issue any 3xx, so nothing
	// there needs it; the field is for the deployment that does.
	PassCredentialsOnRedirect bool `json:"passCredentialsOnRedirect,omitempty"`
	// AWS garbage fields for their proprietary authentication header
	AwsAccessKey string `json:"awsAccessKey"`
	AwsSecretKey string `json:"awsSecretKey"`
	AwsRegion    string `json:"awsRegion"`
	AwsService   string `json:"awsService"`
	// AWS time field, testing only
	AwsTime string `json:"awsTime"`
}

func FromSecret

func FromSecret(ctx context.Context, rc *rest.Config, name, namespace string) (Endpoint, error)

func (*Endpoint) HasAwsAuth

func (ep *Endpoint) HasAwsAuth() bool

HasAwsAuth returns whether the configuration has AWS authentication or not.

ALL FOUR SigV4 INPUTS, and the fourth term used to be a DUPLICATE of AwsSecretKey rather than AwsService — so this reported "has AWS auth" for a configuration that cannot produce a valid signature. `A && A` is `A`, so the typo was invisible until go 1.26's vet made "redundant and" an error and the package stopped building.

Why AwsService is the missing term and not a guess: ComputeAwsSignature uses it twice, in the credential scope and in the signing-key derivation (http/request/util.go:146, :158). With it empty, the scope reads ".../<region>//aws4_request" and the key is derived over an empty service, so AWS answers SignatureDoesNotMatch. Returning true for that is a false positive about the one thing the predicate exists to decide.

THE BEHAVIOUR CHANGE, stated rather than buried — three call sites, all in http/request:

access+secret+region+service          signs, works                  unchanged
access+secret+region, NO service      signed with an EMPTY service   -> now unsigned,
                                      and rejected by AWS               failing visibly
the same, PLUS a bearer token         countTrue==2, so client.go      -> countTrue==1,
                                      REFUSES the request outright       the token is used

No configuration that works today stops working. The third row is the one worth noticing: an endpoint whose bearer token is complete is refused today because incomplete AWS fields sit beside it, and that request starts succeeding.

func (*Endpoint) HasBasicAuth

func (ep *Endpoint) HasBasicAuth() bool

HasBasicAuth returns whether the configuration has basic authentication or not.

func (*Endpoint) HasCA

func (ep *Endpoint) HasCA() bool

HasCA returns whether the configuration has a certificate authority or not.

func (*Endpoint) HasCertAuth

func (ep *Endpoint) HasCertAuth() bool

HasCertAuth returns whether the configuration has certificate authentication or not.

func (*Endpoint) HasTokenAuth

func (ep *Endpoint) HasTokenAuth() bool

HasTokenAuth returns whether the configuration has token authentication or not.

Jump to

Keyboard shortcuts

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