--- title: "ADR 0068: Inherited global secrets stay on the endpoint they belong to" --- * Status: accepted * Code: [`pkg/secrets/inherit.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/secrets/inherit.go) ## Context A Repository without `git_provider.secret` inherits the one of the global Repository, which lives in the controller namespace and is shared by every tenant. If that Repository may also set `git_provider.url`, whoever can create a Repository in any namespace can make an administrator's token be sent to a host, or over a transport, of their choosing. The adapter and the watcher used to carry their own copy of this decision. ## Decision * `ResolveInheritedSecret` is the single place that picks the secret namespace and refuses the unsafe combination. Every path resolving a provider secret must call it. * A local `git_provider.url` is accepted with an inherited secret only if `sameProviderEndpoint` holds: same lowercased scheme, same canonical host and same path prefix. Comparing the scheme means a downgrade to cleartext is refused. * The path prefix counts because GitLab, Gitea and Bitbucket Data Center are served under a prefix on shared front ends. A local URL with no prefix does not match a global one that has one. * A trailing `/api/v3` or `/api/v4` and trailing slashes are stripped before comparing, because they are the API entry of a root deployment, not a prefix. * A URL that cannot be parsed is compared as the raw string, which can only be stricter than comparing endpoints. * The clone endpoint (`CloneURL`, else `URL`) must share the host of the global `git_provider.url`. ## Consequences * A Repository wanting its own URL must also set its own secret. * The ADR cannot show whether other path forms (ports, case in paths) are considered; only what `splitProviderURL` does is checked.