Skip to content

Commit c8193c7

Browse files
committed
comments
1 parent 63035d3 commit c8193c7

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

usr/libexec/helper-scripts/source_folder.bsh

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
## - Therefore, it MUST only be used with trusted configuration directories on a
1515
## trusted filesystem.
1616
## - This function is not a parser for untrusted data.
17-
## - For per-user configuration directories, the invoking user's primary group is
18-
## assumed to be a trusted private group containing only that user.
17+
## - For per-user configuration directories, the invoking process's current
18+
## effective group is assumed to be trusted for that configuration context.
19+
## In the common case, this is expected to be the user's private group, but
20+
## this function intentionally follows the current effective group as reported
21+
## by `id --group --name`.
1922
## - Symlinked configuration directories and symlinked configuration files are
2023
## allowed by this security model.
2124
## - Ownership, group, and permission checks apply to the resolved target as
@@ -29,6 +32,12 @@
2932
## Additional checks on resolved symlink targets are defense in depth. They are
3033
## not intended to be canonical supported-directory containment checks after
3134
## resolving all symlinks.
35+
## - For per-user configuration paths, expected ownership for resolved symlink
36+
## targets is still derived from the resolved pathname being checked.
37+
## Therefore, if a per-user configuration symlink resolves to a path outside
38+
## the literal `$HOME` pathname prefix, the resolved target hierarchy is
39+
## expected to be owned by `root:root` and may be rejected even if it is
40+
## user-owned. This stricter behavior is accepted as defense in depth.
3241
## - The caller is trusted to pass the intended configuration directories.
3342
## - "Trusted" in this context means:
3443
## * the directory hierarchy is only writable by the trusted owner or an
@@ -38,9 +47,9 @@
3847
## permission semantics correctly.
3948
## - Parent directories are checked as defense in depth.
4049
## For per-user paths, directories above `$HOME` are expected to be
41-
## administered by root, while `$HOME` and directories below it are expected to
42-
## be administered by the invoking user and that user's trusted private primary
43-
## group.
50+
## administered by root, while `$HOME` and directories below it are expected
51+
## to be administered by the invoking user and the invoking process's current
52+
## effective group.
4453
## - This function performs pathname-based checks before sourcing files.
4554
## A time-of-check/time-of-use race condition remains possible in principle.
4655
## - Within this security model, that limitation is accepted because exploiting
@@ -60,7 +69,8 @@
6069
## functions:
6170
## * `source_config_error` sets the caller's local `rc`;
6271
## * `source_config_get_expected_owner_group` reads the caller's local
63-
## `invoking_user` and `invoking_group`.
72+
## `invoking_user` and `invoking_group` values, where `invoking_group`
73+
## reflects the current effective group selected by this implementation.
6474
## This is intentional and part of the implementation contract of these helper
6575
## functions. They are not designed as fully self-contained pure functions.
6676
##
@@ -74,8 +84,8 @@
7484
## 2) Per-user configuration directories, such as ~/...
7585
## - directories and files should be owned by the invoking user
7686
## - files must not be writable by "others"
77-
## - group-writable files are acceptable only when the file group is a
78-
## trusted private group of that same user
87+
## - group-writable files are acceptable only when the file group matches the
88+
## invoking process's current effective group
7989
##
8090
## Notes:
8191
## - The ownership / permission checks are defense-in-depth and help catch

0 commit comments

Comments
 (0)