Skip to content

[Host] Validate the Docker Hub user name at startup - #391

Merged
LarsLaskowski merged 21 commits into
mainfrom
claude/amazing-mendel-mzdyfe
Nov 5, 2026
Merged

LarsLaskowski merged 21 commits into
mainfrom
claude/amazing-mendel-mzdyfe

Conversation

@LarsLaskowski

@LarsLaskowski LarsLaskowski commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Pull Request

📖 Description

The configured DockerUpdateGuard:DockerHub:UserName went into the account listing path v2/repositories/{name}/ with Uri.EscapeDataString only, so . or .. addressed another path of the Docker Hub web API (with the account's bearer token). The configuration validator now requires a non-blank, trimmed user name to be one Docker Hub namespace component (ASCII letters and digits separated by ., _, __ or runs of -, at most 255 characters), so an invalid value fails startup and every configuration reload with a fixed message that never contains the value. This is a fix with a behavior change: a user name that is an e-mail address or contains other characters now stops the app from starting. The rule and its reasoning are in docs/areas/registries.md and decision record 0018.

🎫 Issues

💬 Reviewer Notes

Security area: Registry and Docker Hub calls. The grammar uses explicit [a-zA-Z0-9] classes with no IgnoreCase, because case folding turns the Kelvin sign into k; the length is checked before the regex so its timeout cannot throw out of the validator. DockerHubClient is deliberately unchanged (decision 0014, option 19). The Docker Scout login still sends the raw value in a JSON body, which is not path-bearing and out of scope.

📑 Test Plan

DockerUpdateGuardOptionsValidatorInvalidDockerHubUserNameReturnsFailure (20 rejected forms, including ., .., %2e%2e, the Kelvin sign, a zero-width space and 256 characters), DockerUpdateGuardOptionsValidatorValidDockerHubUserNameReturnsSuccess (valid forms, null, blank and 255 characters) and DockerUpdateGuardOptionsValidatorNoBreakSpaceDockerHubUserNameReturnsSuccess. New and changed code is 100 % covered, overall coverage 88.3 %.

✅ Checklist

  • I have added or updated Unit Tests for the change.
  • I have tested my changes.
  • I have run Format and Build from .squad/stack.md, and the Analyzer gate reports no diagnostic in a changed file.
  • The Coverage gate in .squad/stack.md passes (line coverage on new or changed production code and overall).
  • I have updated the project documentation (README.md, ARCHITECTURE.md) to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the project's code style guidelines.
  • New dependencies, if any, were added the way Dependencies in .squad/stack.md prescribes.
  • The C# rules in csharp.instructions.md are followed.

⏭ Next Steps

None.

@sonarqubecloud

sonarqubecloud Bot commented Nov 5, 2026

Copy link
Copy Markdown

@LarsLaskowski
LarsLaskowski marked this pull request as ready for review November 5, 2026 18:26
@LarsLaskowski
LarsLaskowski merged commit a1c9ba6 into main Nov 5, 2026
6 checks passed
@LarsLaskowski
LarsLaskowski deleted the claude/amazing-mendel-mzdyfe branch November 5, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security Security issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate DockerHub:UserName as a Docker Hub namespace at startup

2 participants