Repository navigation
user: limit reads when parsing ID mapping files - #287
Merged
Merged
Conversation
Add missing GoDoc comments to the exported ParseSubID and ParseIDMap functions and their File and Filter variants. Signed-off-by: Sebastiaan van Stijn <[email protected]>
Use the existing limitedFile reader in ParseIDMapFileFilter to limit reads to 10 MiB. Unlike other user database files, ID mapping files may be procfs-backed, so they cannot be restricted to regular files. Reuse the read limit introduced in bba2f13 while preserving support for non-regular files such as /proc/self/uid_map and /proc/self/gid_map. See: moby@bba2f13 Signed-off-by: Sebastiaan van Stijn <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the ID mapping file-read protection changes.
No open issues 🎉
What changed in this PR
Extends the user package’s file-read protections to ID mapping files, applying the existing 10 MiB limit while preserving support for procfs-backed UID/GID mappings.
Changes:
- Applies the shared limited reader to file-based ID mapping parsing.
- Adds GoDoc comments for subordinate-ID and ID mapping parsers.
- Adds tests for read-limit boundaries and Linux procfs compatibility.
| File | Description |
|---|---|
user/user.go |
Documents parsing APIs and limits ID mapping file reads. |
user/user_utils.go |
Extracts a shared newLimitedFile constructor. |
user/user_test.go |
Tests size-limit boundaries and procfs mapping support. |
Review effort: Balanced
vvoland
approved these changes
Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
user: add GoDoc for subordinate ID and ID mapping functions
Add missing GoDoc comments to the exported ParseSubID and ParseIDMap
functions and their File and Filter variants.
user: limit reads when parsing ID mapping files
Use the existing limitedFile reader in ParseIDMapFileFilter to limit reads
to 10 MiB. Unlike other user database files, ID mapping files may be
procfs-backed, so they cannot be restricted to regular files.
Reuse the read limit introduced in bba2f13 while preserving support
for non-regular files such as /proc/self/uid_map and /proc/self/gid_map.
See: bba2f13