-
Notifications
You must be signed in to change notification settings - Fork 55
Fix shell quoting and add username validation #355
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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() { | ||
|
|
||
There was a problem hiding this comment.
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-configmay return multiple parameters at once. For instance,pkg-config --cflags dbus-1returns-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.