Repository navigation
user: limit reads when parsing passwd and group files - #286
Merged
Merged
Conversation
thaJeztah
force-pushed
the
passwd_userfile
branch
from
November 23, 2026 15:42
c58d916 to
6e5c714
Compare
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Use the existing openUserFile helper in ParsePasswdFileFilter to limit reads to 10 MiB and reject non-regular files. This extends the protection introduced in bba2f13 for group files to passwd files, which may also originate from untrusted container images. See: moby@bba2f13 Signed-off-by: Sebastiaan van Stijn <[email protected]>
Use the existing openUserFile helper in GetAdditionalGroupsPath to limit reads to 10 MiB and reject non-regular files. This extends the protection introduced in bba2f13 to additional group lookups, which may also read group files from untrusted container images. Preserve the existing behavior for missing group files, but propagate other errors instead of silently ignoring them. See: moby@bba2f13 Signed-off-by: Sebastiaan van Stijn <[email protected]>
Use the existing openUserFile helper in ParseSubIDFileFilter to limit reads to 10 MiB and reject non-regular files. This extends the protection introduced in bba2f13 to subordinate UID/GID files, which may also originate from untrusted sources. See: moby@bba2f13 Signed-off-by: Sebastiaan van Stijn <[email protected]>
Use ParsePasswdFileFilter and ParseGroupFileFilter for user and group lookups instead of opening and parsing the files directly. This reuses the existing 10 MiB read limit and regular-file checks introduced in bba2f13 and extended to passwd files. See: moby@bba2f13 Signed-off-by: Sebastiaan van Stijn <[email protected]>
Add GoDoc comments to GetPasswdPath, GetGroupPath, GetPasswd, and GetGroup. Clarify that GetPasswd and GetGroup return unrestricted readers without validating the file type or limiting reads, unlike the file-based parsing functions. Callers are responsible for closing the returned readers and handling potentially unbounded input. Signed-off-by: Sebastiaan van Stijn <[email protected]>
thaJeztah
force-pushed
the
passwd_userfile
branch
from
November 23, 2026 15:52
6e5c714 to
f0d05d9
Compare
thaJeztah
marked this pull request as ready for review
November 23, 2026 15:57
Member
Author
|
@vvoland ptal |
vvoland
approved these changes
Nov 23, 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: limit reads when parsing passwd files
Use the existing openUserFile helper in ParsePasswdFileFilter to limit reads
to 10 MiB and reject non-regular files. This extends the protection introduced
in bba2f13 for group files to passwd files, which may also originate
from untrusted container images.
See: bba2f13
user: limit reads when looking up additional groups
Use the existing openUserFile helper in GetAdditionalGroupsPath to limit reads
to 10 MiB and reject non-regular files. This extends the protection introduced
in bba2f13 to additional group lookups, which may also read group files
from untrusted container images.
Preserve the existing behavior for missing group files, but propagate other
errors instead of silently ignoring them.
See: bba2f13
user: limit reads when parsing subordinate ID files
Use the existing openUserFile helper in ParseSubIDFileFilter to limit reads
to 10 MiB and reject non-regular files. This extends the protection introduced
in bba2f13 to subordinate UID/GID files, which may also originate
from untrusted sources.
See: bba2f13
user: limit reads when looking up users and groups
Use ParsePasswdFileFilter and ParseGroupFileFilter for user and group lookups
instead of opening and parsing the files directly. This reuses the existing
10 MiB read limit and regular-file checks introduced in bba2f13 and
extended to passwd files.
See: bba2f13
user: document unrestricted passwd and group readers
Add GoDoc comments to GetPasswdPath, GetGroupPath, GetPasswd, and GetGroup.
Clarify that GetPasswd and GetGroup return unrestricted readers without
validating the file type or limiting reads, unlike the file-based parsing
functions. Callers are responsible for closing the returned readers and
handling potentially unbounded input.