Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ gcc_hardening_options+=(

gcc \
-g \
$(pkg-config --cflags dbus-1) \
$(pkg-config --cflags libsystemd) \
"$(pkg-config --cflags dbus-1)" \
"$(pkg-config --cflags libsystemd)" \
/usr/src/security-misc/fm-shim-backend.c \
-o /usr/bin/fm-shim-backend \
$(pkg-config --libs dbus-1) \
$(pkg-config --libs libsystemd) \
"$(pkg-config --libs dbus-1)" \
"$(pkg-config --libs libsystemd)" \
Comment on lines -49 to +54
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rejected. Quotes are absent here on purpose, because pkg-config may return multiple parameters at once. For instance, pkg-config --cflags dbus-1 returns -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include. Those would get smashed into one argument by this.

"${gcc_hardening_options[@]}" \
|| {
printf "%s\n" 'Could not compile fm-shim-backend executable!'
Expand Down
5 changes: 5 additions & 0 deletions usr/libexec/security-misc/virusforget#security-misc-shared
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ parse_cmd_options() {
echo "ERROR: must set --user username" >&2
exit 1
fi

if [[ ! "$user_name" =~ ^[a-zA-Z0-9._-]+$ ]]; then
echo "ERROR: Invalid username format. Only alphanumeric characters, dots, underscores, and hyphens are allowed." >&2
exit 1
fi
Comment on lines +88 to +92
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This doesn't seem like it adds much value IMO. Usernames might not always match this pattern, and the input here is trusted (I think?) so we probably shouldn't be concerned about invalid usernames being passed here. What we can do here is make sure the specified user actually exists though.

}

variables() {
Expand Down