diff --git a/scripts/packaging/rpm.sh b/scripts/packaging/rpm.sh index b4685b6..094e301 100755 --- a/scripts/packaging/rpm.sh +++ b/scripts/packaging/rpm.sh @@ -233,14 +233,6 @@ install -Dm 755 $staging_dir/claude-desktop %{buildroot}/usr/bin/claude-desktop # Update desktop database for MIME types update-desktop-database /usr/share/applications &> /dev/null || true -# Set correct permissions for chrome-sandbox -SANDBOX_PATH="/usr/lib/$package_name/node_modules/electron/dist/chrome-sandbox" -if [ -f "\$SANDBOX_PATH" ]; then - echo "Setting chrome-sandbox permissions..." - chown root:root "\$SANDBOX_PATH" || echo "Warning: Failed to chown chrome-sandbox" - chmod 4755 "\$SANDBOX_PATH" || echo "Warning: Failed to chmod chrome-sandbox" -fi - %postun # Update desktop database after removal update-desktop-database /usr/share/applications &> /dev/null || true @@ -248,6 +240,7 @@ update-desktop-database /usr/share/applications &> /dev/null || true %files %defattr(-, root, root, 0755) %attr(755, root, root) /usr/bin/claude-desktop +%attr(4755, root, root) /usr/lib/$package_name/node_modules/electron/dist/chrome-sandbox /usr/lib/$package_name /usr/share/applications/claude-desktop.desktop /usr/share/icons/hicolor/*/apps/claude-desktop.png diff --git a/tests/test-artifact-common.sh b/tests/test-artifact-common.sh index 7d09f25..876514f 100644 --- a/tests/test-artifact-common.sh +++ b/tests/test-artifact-common.sh @@ -38,6 +38,14 @@ assert_executable() { fi } +assert_setuid() { + if [[ -u $1 ]]; then + pass "Setuid bit set: $1" + else + fail "Setuid bit not set: $1" + fi +} + assert_contains() { local file="$1" pattern="$2" desc="${3:-}" if grep -q "$pattern" "$file" 2>/dev/null; then diff --git a/tests/test-artifact-rpm.sh b/tests/test-artifact-rpm.sh index 60b2a3a..072a7b5 100644 --- a/tests/test-artifact-rpm.sh +++ b/tests/test-artifact-rpm.sh @@ -41,9 +41,14 @@ electron_path='/usr/lib/claude-desktop/node_modules/electron/dist/electron' assert_file_exists "$electron_path" assert_executable "$electron_path" -# chrome-sandbox -assert_file_exists \ - '/usr/lib/claude-desktop/node_modules/electron/dist/chrome-sandbox' +# chrome-sandbox: setuid bit must be set by the rpm spec's %files +# %attr(4755, ...) entry, not by a %post chmod (#539). The check +# guards against any regression that strips the suid bit — including +# (but not limited to) reverting to a %post chmod, which silently +# no-ops if the scriptlet is skipped (--noscripts, layered images). +chrome_sandbox='/usr/lib/claude-desktop/node_modules/electron/dist/chrome-sandbox' +assert_file_exists "$chrome_sandbox" +assert_setuid "$chrome_sandbox" # --- Desktop entry validation --- desktop_file='/usr/share/applications/claude-desktop.desktop'