Repository navigation
oci: return explicit error for out-of-range USER values - #13446
Conversation
Detect strconv.ErrRange and validate uid/gid bounds to avoid falling back to username/group lookups. Signed-off-by: LEI WANG <[email protected]>
There was a problem hiding this comment.
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.ErrRangeand return explicituid/gid out of rangeerrors rather than treating oversized numeric strings as names. - Enforce
min/maxUID/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.
|
/cherry-pick release/2.1 |
|
@cpuguy83: #13446 failed to apply on top of branch "release/2.1": DetailsIn response to this:
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. |
Detect strconv.ErrRange and validate uid/gid bounds to avoid falling back to username/group lookups.