🐛 fix(explicit): vulnerablities removed

This commit is contained in:
eshanized
2024-12-30 02:07:52 +05:30
parent 65ecb84500
commit 281e76b434
2 changed files with 18 additions and 13 deletions

View File

@@ -3,12 +3,14 @@
"http://www.freedesktop.org/software/polkit/policyconfig-1.dtd">
<policyconfig>
<!-- Vendor Information -->
<vendor>Snigdha OS</vendor>
<vendor_url>https://snigdhaos.org</vendor_url>
<action id="org.snigdhaos.libs.install-package.pkexec.policy.run">
<!-- Policy for Installing Packages -->
<action id="org.snigdhaos.package.install">
<description>Install software using the pacman package manager</description>
<message>Authentication is required to install software with pacman.</message>
<message>Administrator authentication is required to install software using pacman.</message>
<icon_name>snigdhaos-pacman</icon_name>
<defaults>
<allow_any>no</allow_any>
@@ -19,10 +21,11 @@
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
<action id="org.garuda.libs.pkexec-gui.pkexec.policy.run">
<description>Run a graphical program as root</description>
<message>Authentication is required to run a graphical program with elevated privileges.</message>
<icon_name>gnome-session</icon_name>
<!-- Policy for Running Graphical Programs with Elevated Privileges -->
<action id="org.snigdhaos.graphical.run-as-root">
<description>Run graphical applications with administrative privileges</description>
<message>Administrator authentication is required to run this graphical application with elevated privileges.</message>
<icon_name>snigdhaos-root-gui</icon_name>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>

View File

@@ -2,30 +2,32 @@
# Ensure pkexec is available
if ! command -v pkexec &>/dev/null; then
echo "Error: pkexec is not installed. Please install PolicyKit."
echo "Error: 'pkexec' is not installed. Please install PolicyKit to proceed."
exit 1
fi
# Check if running as root
# Check if the script is being run as root
if [[ $EUID -ne 0 ]]; then
# Attempt to execute the script as root via pkexec
# Attempt to elevate privileges and rerun the script with pkexec
exec pkexec /usr/lib/snigdhaos/pkexec-gui "$@"
exit 1
fi
# Shellcheck disable: Read environment variables from parent process
# Export environment variables from the parent process
# ShellCheck Directive: Allow environment variables to be read and exported from /proc
# shellcheck disable=SC2163
# Read the necessary environment variables from the parent process
while IFS= read -rd '' var; do
export "$var"
done < <(grep --null-data -ae "^\($XDG_CURRENT_DESKTOP\|WAYLAND_DISPLAY\|XDG_RUNTIME_DIR\|XDG_SESSION_TYPE\|XCURSOR_SIZE\|LC_*\|LANG\|LANGUAGE\|QT_WAYLAND_FORCE_DPI\|QT_QPA_PLATFORMTHEME\|QT_STYLE-OVERRIDE\|\)=.*\$" /proc/$PPID/environ)
done < <(
grep --null-data -ae "^\($XDG_CURRENT_DESKTOP\|WAYLAND_DISPLAY\|XDG_RUNTIME_DIR\|XDG_SESSION_TYPE\|XCURSOR_SIZE\|LC_.*\|LANG\|LANGUAGE\|QT_WAYLAND_FORCE_DPI\|QT_QPA_PLATFORMTHEME\|QT_STYLE_OVERRIDE\)=" /proc/$PPID/environ
)
# Adjust WAYLAND_DISPLAY if running on Wayland
if [[ -n "$WAYLAND_DISPLAY" ]]; then
export WAYLAND_DISPLAY="$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY"
fi
# Set the root user's XDG_RUNTIME_DIR
# Set the root user's runtime directory
export XDG_RUNTIME_DIR="/run/user/0"
# Execute the provided command with root privileges