mirror of
https://github.com/home-assistant/supervisor.git
synced 2026-04-02 00:07:16 +01:00
Reuse IMAGE_REGISTRY_REGEX for docker_image validation (#6667)
* Reuse IMAGE_REGISTRY_REGEX for docker_image validation Replace the monolithic regex in docker_image validator with a function-based approach that reuses get_registry_from_image() from docker.utils for robust registry detection. This properly handles domains, IPv4/IPv6 addresses, ports, and localhost while still rejecting tags (managed separately by the add-on system). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Address review feedback: reorder checks for efficiency Check falsy value before isinstance, and empty path before tag check, as suggested in PR review. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -25,14 +25,23 @@ IMAGE_NAME_GOOD = [
|
||||
"homeassistant/amd64-homeassistant",
|
||||
"ttl.sh/homeassistant",
|
||||
"myreg.local:8080/homeassistant",
|
||||
"localhost/myimage",
|
||||
"localhost:5000/myimage",
|
||||
"127.0.0.1/myimage",
|
||||
"127.0.0.1:5000/org/myimage",
|
||||
"[::1]:5000/myimage",
|
||||
"dockeruser/nice-app-1.2",
|
||||
"ghcr.io/blakeblackshear/frigate",
|
||||
]
|
||||
IMAGE_NAME_BAD = [
|
||||
"ghcr.io/home-assistant/homeassistant:123",
|
||||
"ghcr.io/blakeblackshear/frigate:stable-rocm",
|
||||
".ghcr.io/home-assistant/homeassistant",
|
||||
"HOMEASSISTANT/homeassistant",
|
||||
"homeassistant/HOMEASSISTANT",
|
||||
"homeassistant/_homeassistant",
|
||||
"homeassistant/-homeassistant",
|
||||
"GHCR.IO/home-assistant/homeassistant",
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user