Skip to content

policy: Handle absolute symlinks in system policy path resolution - #2343

Open
Johan-Liebert1 wants to merge 1 commit into
bootc-dev:mainfrom
Johan-Liebert1:cap-std-symlink
Open

policy: Handle absolute symlinks in system policy path resolution#2343
Johan-Liebert1 wants to merge 1 commit into
bootc-dev:mainfrom
Johan-Liebert1:cap-std-symlink

Conversation

@Johan-Liebert1

@Johan-Liebert1 Johan-Liebert1 commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

cap-std refuses to follow absolute symlinks since they would escape the sandbox, returning PermissionDenied. When /etc/containers/policy.json is a symlink to e.g. /usr/share/containers/policy.json, this caused policy resolution to silently skip the file.

Switch to cap_std_ext::RootDir that handles the above semantics by itself

Test written by Claude

Fixes: #2339

@Johan-Liebert1
Johan-Liebert1 requested a review from cgwalters July 27, 2026 06:00
@Johan-Liebert1 Johan-Liebert1 added the ci/tier-1 Run CI for tier-1 OS (centos-10) only label Jul 27, 2026
@github-actions github-actions Bot added the area/ostree Issues related to ostree label Jul 27, 2026
@bootc-bot
bootc-bot Bot requested a review from jmarrero July 27, 2026 06:00
@Johan-Liebert1
Johan-Liebert1 requested review from jeckersb and removed request for jmarrero July 27, 2026 06:00
Comment thread crates/ostree-ext/src/container/skopeo.rs Outdated
cgwalters
cgwalters previously approved these changes Jul 28, 2026
Comment on lines +343 to +344
/// procfs because cap-std (by design) refuses to create symlinks with
/// absolute targets.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is from cap-std which would error out on absolute symlinks

cap-std refuses to follow absolute symlinks since they would escape the
sandbox, returning PermissionDenied. When /etc/containers/policy.json is
a symlink to e.g. /usr/share/containers/policy.json, this caused policy
resolution to silently skip the file.

Switch to `cap_std_ext::RootDir` that handles the above semantics by
itself

Test written by Claude

Fixes: bootc-dev#2339

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ostree Issues related to ostree ci/tier-1 Run CI for tier-1 OS (centos-10) only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

skopeo.rs's container policy resolving does not follow symlinks

2 participants