Decide the Artifact Registry api_url transport posture before remote settings writes ship

Summary

ArtifactRegistry::Client#create_repository and #update_repository now send upstream registry credentials (Basic auth for Maven and the container formats, a bearer auth_token for npm) to the Artifact Registry service over the per-user request path. That path has no transport guard: the existing plaintext check only runs on a different path, and the service is designed to run behind plain HTTP internally. We need to decide, before the write path ships to GitLab.com, whether that is acceptable for credential-carrying requests, and either close the gap or document why it is fine.

The gap

ArtifactRegistry::Client has two outbound request paths:

  • service_request, which calls guard_service_transport! (ee/lib/artifact_registry/client.rb:681). That guard refuses a plaintext base URL, but only when Rails.env.production?.
  • user_request, which never calls the guard and never checks the URL scheme at all.

create_repository (ee/lib/artifact_registry/client.rb:220) and update_repository (ee/lib/artifact_registry/client.rb:233) both go out through user_request. ArtifactRegistry::Configuration::ALLOWED_SCHEMES (ee/lib/artifact_registry/configuration.rb:5) is %w[http https], with no production carve-out, so a plaintext api_url is accepted for these calls in every environment.

Before !252160 (merged), the per-user path carried no credential more sensitive than the caller's own scoped token. That MR adds the upstream registry credentials described above to the create and update repository request bodies, so it is the first change that puts a secret worth protecting in transit on the unguarded path.

Why the guard was not extended in the merge request

The Artifact Registry service is designed to listen on plain HTTP, with TLS terminated at the Kubernetes ingress (Runway/GKE). Source: artifact-registry repo, docs/specs/S01-http-server-and-routing.md:780-781: "TLS terminated externally: The server listens on plain HTTP. TLS is terminated at the Kubernetes ingress (Runway/GKE)."

The default api_url for source installs and the GDK is http://localhost:8080. If user_request were held to HTTPS today, it could hard-fail every Artifact Registry surface in production, depending on how api_url ends up configured there. That configuration is not settled: #606085 (closed) is the open issue that wires artifact_registry.api_url through the charts and sets the value for gstg and gprd, and it has not landed. Extending the guard ahead of that issue risks locking in a requirement (or a false sense of safety) before the actual deployment topology is known.

Proposal

  1. Decide whether artifact_registry.api_url must be HTTPS in production before the remote settings write path is enabled. This is a decision for the rollout in #606085 (closed), and should be coordinated with the answer here rather than decided independently.
  2. Depending on that answer, do one of:
    • Extend the transport guard so the credential-carrying writes are covered, either by moving the guard_service_transport! check into user_request, or by calling it from create_repository and update_repository directly.
    • If in-cluster plaintext is kept intentionally, record why plaintext is acceptable for upstream registry credentials in transit, so the comment at ee/lib/artifact_registry/client.rb:678-680 can stop describing it as an open gap.

Application Security may want to weigh in on the second branch of option 2 (accepting in-cluster plaintext for these credentials).

This decision blocks enabling the artifact_registry_ui feature flag on GitLab.com for remote repositories. It does not block, and did not block, the merge of !252160 (merged) itself.

Where this is recorded in the code

The code comment at ee/lib/artifact_registry/client.rb:678-680 currently names this gap directly. It was written that way during review of !252160 (merged), so the tradeoff is recorded in the source rather than left silent, pending the decision this issue asks for.

Edited by 🤖 GitLab Bot 🤖