Merged
Conversation
A new util.c:_netplan_g_string_free_to_file_with_permissions() was added and accepts the owner, group and file mode as arguments. When these properties can't be set, when the generator is called by a non-root user for example, it will not hard-fail. This function is called by unit tests where we can't set the owner to a privileged account for example. When generating backend files, use more restrictive permissions: networkd related files will be owned by root:systemd-network and have mode 0640. service unit files will be owned by root:root and have mode 0640. udevd files will be owned by root:root with mode 0640. wpa_supplicant and Network Manager files will continue with the existing permissions. Autopkgtests will check if the permissions are set as expected when calling the generator. This fix addresses CVE-2022-4968
Control characters are escaped in the parser using glib's g_strescape. Quotes and backslashes were added to the list of exception. In places where double quotes are not escaped, such as netdef IDs as it is allowed as interface names, they are escaped as needed when generating back end configuration. To support escaping in wpa_supplicant configuration, the syntax for setting the SSID was changed to 'ssid=P"string here"'. With that, escaping is support in a printf-style.
Escape strings used to build paths with g_uri_escape_string(). systemd_escape() could also be used but it has the downside of calling an external program and, by default, it escapes dashes (which are present in files generated from Network Manager for example).
Semicolons separated from other words by a combination of spaces and/or tabs will be escaped.
slyon
approved these changes
Jun 27, 2024
Contributor
slyon
left a comment
There was a problem hiding this comment.
Thanks, LGTM!
It matches the embargoed branch that I've had reviewed earlier (ignoring patch fuzz, due to rebase).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
These are the fixes recently publish as part of https://launchpad.net/ubuntu/+source/netplan.io/1.0-2ubuntu1.1
Checklist
make checksuccessfully.make check-coverage).