Skip to content

fix(types): reject unrecognized pull_policy values instead of defaulting - #923

Merged
glours merged 1 commit into
compose-spec:mainfrom
glours:fix/pull-policy-validation
Aug 31, 2026
Merged

fix(types): reject unrecognized pull_policy values instead of defaulting#923
glours merged 1 commit into
compose-spec:mainfrom
glours:fix/pull-policy-validation

Conversation

@glours

@glours glours commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

An unanchored JSON Schema pattern let typo'd pull_policy values (e.g. "neverxxx") pass validation as substring matches, and GetPullPolicy() silently mapped any unrecognized value to PullPolicyMissing. A one-character typo could therefore silently invert "never" into a registry pull with no diagnostic.

Anchor the schema pattern with ^...$ and make GetPullPolicy() return an error for unrecognized values, while still defaulting silently when pull_policy is unset and accepting the bare "refresh" literal already allowed by the schema.

Fixes https://docker.atlassian.net/browse/DDB-665

@glours
glours requested a review from ndeloof as a code owner August 27, 2026 13:18
@glours glours self-assigned this Aug 27, 2026
An unanchored JSON Schema pattern let typo'd pull_policy values
(e.g. "neverxxx") pass validation as substring matches, and
GetPullPolicy() silently mapped any unrecognized value to
PullPolicyMissing. A one-character typo could therefore silently
invert "never" into a registry pull with no diagnostic.

Anchor the schema pattern with ^...$ and make GetPullPolicy()
return an error for unrecognized values, while still defaulting
silently when pull_policy is unset and accepting the bare
"refresh" literal already allowed by the schema.

Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
@glours
glours force-pushed the fix/pull-policy-validation branch from b558c87 to 13499b4 Compare August 31, 2026 15:21
@glours
glours enabled auto-merge (rebase) August 31, 2026 15:21
@glours
glours merged commit f0442ff into compose-spec:main Aug 31, 2026
8 checks passed
@glours
glours deleted the fix/pull-policy-validation branch August 31, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants