Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set PATH on bare-based rocks #725

Merged
merged 1 commit into from
Oct 9, 2024
Merged

Conversation

tigarmo
Copy link
Collaborator

@tigarmo tigarmo commented Oct 4, 2024

If the PATH is empty, Pebble will be default use the standard Ubuntu value
of "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" (see [0]).
Follow this lead and set this value on the image's PATH.

This PATH setting on the image itself has no bearing on most cases, as the
PATH that prevails is the one defined by Pebble and its services, but an
empty (or unset) PATH is a potential security issue in cases where the pebble
entrypoint is bypassed.

0: https://github.com/canonical/pebble/blob/master/internals/overlord/cmdstate/request.go#L91

Fixes #711

@tigarmo tigarmo force-pushed the work/CRAFT-3437-bare-path branch 3 times, most recently from b7608e0 to a2b71f7 Compare October 8, 2024 16:12
@tigarmo tigarmo marked this pull request as ready for review October 8, 2024 17:32
@tigarmo tigarmo requested review from cjdcordeiro and a team October 8, 2024 17:33
@lengau lengau requested a review from a team October 8, 2024 23:29
Copy link
Collaborator

@cjdcordeiro cjdcordeiro left a comment

Choose a reason for hiding this comment

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

Nice idea with the default Pebble path. And nice parameterization of the tests.

Just left a couple of small comments.

If the PATH is empty, Pebble will be default use the standard Ubuntu value
of "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" (see [0]).
Follow this lead and set this value on the image's PATH.

This PATH setting on the image itself has no bearing on most cases, as the
PATH that prevails is the one defined by Pebble and its services, but an
empty (or unset) PATH is a potential security issue in cases where the pebble
entrypoint is bypassed.

0: https://github.com/canonical/pebble/blob/master/internals/overlord/cmdstate/request.go#L91

Fixes #711
@tigarmo tigarmo force-pushed the work/CRAFT-3437-bare-path branch from a2b71f7 to 4dd2fe0 Compare October 9, 2024 12:06
@tigarmo tigarmo merged commit b81a12c into main Oct 9, 2024
13 checks passed
@tigarmo tigarmo deleted the work/CRAFT-3437-bare-path branch October 9, 2024 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set PATH on the rock for bare bases
4 participants