Repository navigation
feat: match registry credentials by repository path [NOTASK] - #1165
cristianrcv wants to merge 2 commits into
Conversation
Wave picked the first Platform credential whose registry equalled the image host. Two credentials on the same host (e.g. one ECR account with per-repository IAM users) were therefore ambiguous and a push could use the credentials of another repository and fail. A credential registry can now include a repository path (e.g. 123.dkr.ecr.eu-west-2.amazonaws.com/team/set-a). The lookup receives the full repository and picks the credential with the longest matching prefix, so bare-host credentials keep working as before. Credential validation strips the path before logging in, and the build docker config adds the push targets first so their credentials win the single per-host entry. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
There is no lockfile, so npm resolved the @typespec/openapi peer of @typespec/openapi3 to 1.17.0, which requires @typespec/compiler ^1.17.0 and conflicts with the pinned 1.16.0. installTypeSpec failed on every build. Pinning the peer to the same release as the rest of the toolchain restores the install. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
LGTM and from the test looks like exactly what we want. |
|
Thanks @cristianrcv, this is the right direction. The matching rule (longest prefix of the repository at a 1. Saving a credential with a path fails the SSRF check (blocker) 2. Reject tags and digests in the registry value (#224) 3. Validation only checks the host login 4. Docker Hub 5. Platform dependency 6. Housekeeping
|
Problem
CredentialServiceImpl.findRegistryCredspicks the first Platformcontainer-regcredential whoseregistryequals the image host (see the existingTODO @t0randr). When a workspace holds two credentials for the same host, the choice depends on list order. One example is a single ECR account where each repository has its own IAM user:056956104246.dkr.ecr.eu-west-2.amazonaws.com/gradient-dev/set-a056956104246.dkr.ecr.eu-west-2.amazonaws.com/gradient-dev/set-bA push to
set-acan then useset-b's IAM user and fail.Change
CredentialServiceImpl): the lookup now receives the full repository (ContainerPath.repository) instead of the host. It picks the credential whoseregistryis the longest prefix of the repository, with prefixes compared on/boundaries. Bare-host credentials still match as before. On a tie, the first credential wins, as it did before.RegistryAuthServiceImpl.validateUser): Platform validates a credential through Wave when it is saved. A path inregistryis now stripped before login, and scheme URLs such ashttps://registry-1.docker.ioare left unchanged.ContainerInspectServiceImpl.credentialsConfigJson): the Docker config keeps one auth entry per host. Build and cache repositories are now added before base-image repositories, so the push target's credential takes that entry.Known limitations
set-bwhile pushing toset-aon the same host usesset-a's credential. This comes from the Docker config format.HOST_NAME_ALLOW_PORTSincontainer-registry-credentials.component.ts). It needs a matching change before users can enter a path. The API already accepts any string.Testing
CredentialsServiceTest"should find the most specific credentials" (8 cases) andRegistryAuthServiceTest"should strip repository path" (7 cases). Both pass.RegistryCredentialsProviderTestis updated for the new signature and passes.RegistryAuthServiceTestandContainerInspectServiceImplTestfail locally. The same 6 fail on unmodifiedmaster; they need registry credentials or network access.-x installTypeSpec -x generateOpenApi -x generateSwaggerUI. Without those flags,installTypeSpeccurrently fails onmasterbecausenpm installresolves@typespec/openapi@1.17.0against the pinned compiler1.16.0.🤖 Generated with Claude Code