Fix Linux installer NetworkManager file URIs#354
Fix Linux installer NetworkManager file URIs#354Game4Move78 wants to merge 2 commits intoGEANT:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes the Linux installer template’s NetworkManager 802.1X file URI serialization to use length-delimited D-Bus byte arrays (no trailing NUL), preventing persisted paths with a \0 suffix that can break TLS validation.
Changes:
- Add
__nm_file_uri()helper to build NetworkManager file URIdbus.ByteArrayvalues without NUL termination. - Use the helper for
ca-cert,client-cert, andprivate-keysettings. - Add a PHPUnit regression test ensuring the template no longer contains the NUL-terminated patterns.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
devices/linux/Files/main.py |
Introduces __nm_file_uri() and updates NM settings to avoid NUL-terminated file URI byte arrays. |
tests/unit/devices/linux/Files/MainPyTemplateTest.php |
Adds regression coverage by asserting the template contains the helper and omits the old \0-terminated patterns. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $template = file_get_contents(__DIR__ . '/../../../../../devices/linux/Files/main.py'); | ||
|
|
||
| $this->assertStringContainsString( | ||
| 'def __nm_file_uri(path: str) -> dbus.ByteArray:', | ||
| $template | ||
| ); | ||
| $this->assertStringContainsString( | ||
| 'return dbus.ByteArray(f"file://{path}".encode())', | ||
| $template | ||
| ); |
There was a problem hiding this comment.
file_get_contents() can return false if the relative path changes or the file is missing, which would cause a type error in the subsequent assertString* calls and make the test failure harder to diagnose. Consider asserting the file exists and/or that $template !== false before running string assertions (and optionally include a failure message with the resolved path).
Summary
Fix the Linux installer template so NetworkManager file URI settings are sent as plain length-delimited D-Bus byte arrays instead of NUL-terminated strings.
Problem
The generated Linux installer currently serializes
ca-cert,client-cert, andprivate-keyasdbus.ByteArray(b"file://...\0").On newer NetworkManager setups this can persist as a
%00suffix in the stored path, which breaks TLS validation during 802.1X authentication.Changes
devices/linux/Files/main.pyto build NetworkManager file URI byte arrays without a trailing NULca-cert,client-cert, andprivate-keyTesting
tests/unit/devices/linux/Files/MainPyTemplateTest.php