Skip to content

oci: return explicit error for out-of-range USER values - #13446

Merged
dmcgowan merged 1 commit into
containerd:mainfrom
samuelkarp:oci-withuser-errrange
May 20, 2026
Merged

dmcgowan merged 1 commit into
containerd:mainfrom
samuelkarp:oci-withuser-errrange

Conversation

@samuelkarp

Copy link
Copy Markdown
Member

Detect strconv.ErrRange and validate uid/gid bounds to avoid falling back to username/group lookups.

Detect strconv.ErrRange and validate uid/gid bounds to avoid falling back to username/group lookups.

Signed-off-by: LEI WANG <[email protected]>
Copilot AI review requested due to automatic review settings May 20, 2026 17:16
@github-project-automation github-project-automation Bot moved this to Needs Triage in Pull Request Review May 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens pkg/oci.WithUser parsing so out-of-range numeric USER values fail fast with an explicit error instead of falling back to username/group lookups, aligning behavior with the intended UID/GID bounds.

Changes:

  • Detect strconv.ErrRange and return explicit uid/gid out of range errors rather than treating oversized numeric strings as names.
  • Enforce min/max UID/GID bounds (0..MaxInt32) for successfully parsed numeric values and return explicit errors on violation.
  • Update and extend unit tests to assert the new error messages for out-of-range inputs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pkg/oci/spec_opts.go Adds explicit out-of-range detection/validation for WithUser numeric parsing to avoid username/group fallback.
pkg/oci/spec_opts_user_test.go Updates existing cases and adds new coverage for oversized UID/GID inputs to validate the new error behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-project-automation github-project-automation Bot moved this from Needs Triage to Review In Progress in Pull Request Review May 20, 2026
@dmcgowan
dmcgowan merged commit ba57862 into containerd:main May 20, 2026
49 checks passed
@github-project-automation github-project-automation Bot moved this from Review In Progress to Done in Pull Request Review May 20, 2026
@cpuguy83

Copy link
Copy Markdown
Member

/cherry-pick release/2.1

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@cpuguy83: #13446 failed to apply on top of branch "release/2.1":

Applying: oci: return explicit error for out-of-range USER values
Using index info to reconstruct a base tree...
M	pkg/oci/spec_opts.go
A	pkg/oci/spec_opts_user_test.go
Falling back to patching base and 3-way merge...
CONFLICT (modify/delete): pkg/oci/spec_opts_user_test.go deleted in HEAD and modified in oci: return explicit error for out-of-range USER values. Version oci: return explicit error for out-of-range USER values of pkg/oci/spec_opts_user_test.go left in tree.
Auto-merging pkg/oci/spec_opts.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 oci: return explicit error for out-of-range USER values

Details

In response to this:

/cherry-pick release/2.1

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

7 participants