Skip to content

Commit

Permalink
meson: prevent use of suid fallback without explicit consent
Browse files Browse the repository at this point in the history
This caused a surprise since the package providing setcap changed on
alpine linux, and the binary stopped being present in the environment,
causing bst to be setuid root instead of using file capabilities.
  • Loading branch information
Snaipe committed Nov 28, 2023
1 parent a68886f commit e757b7b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jobs:
command -v apk && apk add --no-cache linux-headers scdoc
command -v apt && apt-get update && apt-get install -y scdoc
command -v dnf && dnf install -y glibc-static scdoc
CPPFLAGS='-Wconversion -pedantic-errors' meson build
CPPFLAGS='-Wconversion -pedantic-errors' meson build -Dsuid-fallback=true
ninja -C build
3 changes: 3 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ if not get_option('no-setcap-or-suid')
meson.add_install_script(sh.path(), '-c', '@0@ @1@ ${MESON_INSTALL_DESTDIR_PREFIX}/bin/@2@'.format(setcap.path(), ','.join(caps) + '=p', bin))
endforeach
else
if not get_option('suid-fallback')
error('no setcap program available, and suid-fallback=true was not set')
endif
chmod = find_program('chmod')
foreach bin, _ : capabilities
meson.add_install_script(sh.path(), '-c', '@0@ u+s ${MESON_INSTALL_DESTDIR_PREFIX}/bin/@1@'.format(chmod.path(), bin))
Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ option('version', type: 'string', value: '')
option('tests', type: 'boolean', value: true)
option('man-pages', type: 'feature', value: 'auto')
option('no-setcap-or-suid', type: 'boolean', value: false)
option('suid-fallback', type: 'boolean', value: false)

0 comments on commit e757b7b

Please sign in to comment.