)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":1000053,"name":"Răzvan Cojocaru","display_name":"Razvan Cojocaru","email":"razvanc@mailbox.org","username":"razvanc"},"change_message_id":"0017f201a0a0d81b17b80f1b6afd9420d84047c1","unresolved":true,"context_lines":[{"line_number":16,"context_line":"is not exploitable from the network. But the design means (a) the safety"},{"line_number":17,"context_line":"of root code execution rests entirely on that validation, and (b) the"},{"line_number":18,"context_line":"privilege separation the runner exists for does not hold: whoever controls"},{"line_number":19,"context_line":"the unprivileged process controls a file root will execute."},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Replace the sourcing with a small reader that only accepts the variable"},{"line_number":22,"context_line":"names openvpn writes (dns_server_*, dns_search_domain_*, dev, script_type),"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"e24922b6_7a7ef5b0","line":19,"updated":"2026-11-25 08:45:07.000000000","message":"(b) is not really achieved.\n\n`dev` passes the allow-list with no check on its value, then the scripts paste it into a `sed` script, so a vars file still gets code run as root.\n\nWe could either check `dev` in the reader and say in the message that the C side still trusts the path, or just drop claim (b) from the message.","commit_id":"01aa79f87f54bdbecb8f7a160c6ea0f8965ed29c"},{"author":{"_account_id":1000071,"name":"Deri Haerudi","email":"abcderyscreenprinting@gmail.com","username":"derioii"},"change_message_id":"658884b9e4810eb9b5e7a14d4e31fe199a5d6a3b","unresolved":false,"context_lines":[{"line_number":16,"context_line":"is not exploitable from the network. But the design means (a) the safety"},{"line_number":17,"context_line":"of root code execution rests entirely on that validation, and (b) the"},{"line_number":18,"context_line":"privilege separation the runner exists for does not hold: whoever controls"},{"line_number":19,"context_line":"the unprivileged process controls a file root will execute."},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Replace the sourcing with a small reader that only accepts the variable"},{"line_number":22,"context_line":"names openvpn writes (dns_server_*, dns_search_domain_*, dev, script_type),"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"8ce168d7_3139dc37","line":19,"in_reply_to":"e24922b6_7a7ef5b0","updated":"2026-11-25 09:49:42.000000000","message":"You\u0027re right, thanks. dev went into the dns-down sed program unchecked, so a crafted vars file could still run commands through sed\u0027s \"e\".\n\nI took your first option. In PS2 the reader only accepts a dev that starts with a letter or digit, contains only [A-Za-z0-9_./-] and no \"..\", and otherwise exits with an error. \u0027/\u0027 has to stay allowed because Haiku names its devices tun/N (tun.c), so the three dns-down sed calls now use \\%...% addresses: with \"/\" as the delimiter, a dev like \"x/r\u003cfile\u003e\" or \"x/w\u003cfile\u003e\" would still have made sed read or write files as root without needing any other special character. As a side effect, dev\u003dtun/0 no longer breaks that sed expression.\n\nThe message now says what is and isn\u0027t covered: root no longer executes the file, but the C side still trusts the path, and the values are still used as DNS configuration. One spot I left alone: unset_search_domains in the macOS script still uses search domains in a sed \"s\" expression. I\u0027m happy to look at that in a separate change.","commit_id":"01aa79f87f54bdbecb8f7a160c6ea0f8965ed29c"}],"/PATCHSET_LEVEL":[{"author":{"_account_id":1000006,"name":"Heiko Hund","display_name":"Heiko Hund","email":"heiko@ist.eigentlich.net","username":"d12fk"},"change_message_id":"1bf7e7041c8c1bd199505a6079704a24501d4fff","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"c76eba03_afe91c1e","updated":"2026-11-25 20:11:26.000000000","message":"I actually have a patch in the queue that removes use of the tmp file and passes the vars over the pipe directly and then passed in the env to the scripts. Think that\u0027s the better approach to this issue, than relying on the relatively complex parsing working in all scripts for all time. Will push my stuff tonight, please take a look.","commit_id":"cafe4eab2d6f519bde8d4ebef000ab02a8e66006"}],"distro/dns-scripts/haikuos_file-dns-updown.sh":[{"author":{"_account_id":1000053,"name":"Răzvan Cojocaru","display_name":"Razvan Cojocaru","email":"razvanc@mailbox.org","username":"razvanc"},"change_message_id":"0017f201a0a0d81b17b80f1b6afd9420d84047c1","unresolved":true,"context_lines":[{"line_number":50,"context_line":"# in a value (command substitution, quotes, redirections)."},{"line_number":51,"context_line":"dns_vars_load() {"},{"line_number":52,"context_line":"    _f\u003d$1"},{"line_number":53,"context_line":"    [ -r \"$_f\" ] || return 0"},{"line_number":54,"context_line":"    while IFS\u003d read -r _line || [ -n \"$_line\" ]; do"},{"line_number":55,"context_line":"        case $_line in"},{"line_number":56,"context_line":"            *\u003d*) ;;"}],"source_content_type":"text/x-sh","patch_set":1,"id":"adfaffaf_f7b4b711","line":53,"updated":"2026-11-25 08:45:07.000000000","message":"This should be `|| exit 1` - otherwise we are letting the script carry on with `script_type` unset.","commit_id":"01aa79f87f54bdbecb8f7a160c6ea0f8965ed29c"},{"author":{"_account_id":1000071,"name":"Deri Haerudi","email":"abcderyscreenprinting@gmail.com","username":"derioii"},"change_message_id":"658884b9e4810eb9b5e7a14d4e31fe199a5d6a3b","unresolved":false,"context_lines":[{"line_number":50,"context_line":"# in a value (command substitution, quotes, redirections)."},{"line_number":51,"context_line":"dns_vars_load() {"},{"line_number":52,"context_line":"    _f\u003d$1"},{"line_number":53,"context_line":"    [ -r \"$_f\" ] || return 0"},{"line_number":54,"context_line":"    while IFS\u003d read -r _line || [ -n \"$_line\" ]; do"},{"line_number":55,"context_line":"        case $_line in"},{"line_number":56,"context_line":"            *\u003d*) ;;"}],"source_content_type":"text/x-sh","patch_set":1,"id":"94050c53_e53c2ca2","line":53,"in_reply_to":"adfaffaf_f7b4b711","updated":"2026-11-25 09:49:42.000000000","message":"Done, in all five scripts. The old \". $dns_vars_file\" also made the /bin/sh scripts exit at that point, so \"return 0\" was a behaviour change in PS1: resolvconf_file and haikuos_file exited 0 without doing anything, and openresolv fell through to \"resolvconf -d \u0027\u0027 -f\".","commit_id":"01aa79f87f54bdbecb8f7a160c6ea0f8965ed29c"},{"author":{"_account_id":1000053,"name":"Răzvan Cojocaru","display_name":"Razvan Cojocaru","email":"razvanc@mailbox.org","username":"razvanc"},"change_message_id":"2670af3deeb32b0e798cb84a9295f4acc1c5bb8b","unresolved":true,"context_lines":[{"line_number":50,"context_line":"# in a value (command substitution, quotes, redirections)."},{"line_number":51,"context_line":"dns_vars_load() {"},{"line_number":52,"context_line":"    _f\u003d$1"},{"line_number":53,"context_line":"    [ -r \"$_f\" ] || exit 1"},{"line_number":54,"context_line":"    while IFS\u003d read -r _line || [ -n \"$_line\" ]; do"},{"line_number":55,"context_line":"        case $_line in"},{"line_number":56,"context_line":"            *\u003d*) ;;"}],"source_content_type":"text/x-sh","patch_set":2,"id":"e2fad090_07260b12","line":53,"updated":"2026-11-25 10:38:49.000000000","message":"Actually, could we also get an error message here? E.g.:\n\n```\n dns_vars_load() {\n     _f\u003d$1\n-    [ -r \"$_f\" ] || exit 1\n+    [ -r \"$_f\" ] || {\n+        echo \"cannot read dns vars file ${_f}\"\n+        exit 1\n+    }\n     while IFS\u003d read -r _line || [ -n \"$_line\" ]; do\n```","commit_id":"53542aefa682e59d804ae353be9731bf15ed9dfd"},{"author":{"_account_id":1000071,"name":"Deri Haerudi","email":"abcderyscreenprinting@gmail.com","username":"derioii"},"change_message_id":"6bca11ca2e8925958923716858e5ef77384992c8","unresolved":false,"context_lines":[{"line_number":50,"context_line":"# in a value (command substitution, quotes, redirections)."},{"line_number":51,"context_line":"dns_vars_load() {"},{"line_number":52,"context_line":"    _f\u003d$1"},{"line_number":53,"context_line":"    [ -r \"$_f\" ] || exit 1"},{"line_number":54,"context_line":"    while IFS\u003d read -r _line || [ -n \"$_line\" ]; do"},{"line_number":55,"context_line":"        case $_line in"},{"line_number":56,"context_line":"            *\u003d*) ;;"}],"source_content_type":"text/x-sh","patch_set":2,"id":"f44a2e1d_32c186f6","line":53,"in_reply_to":"e2fad090_07260b12","updated":"2026-11-25 11:21:55.000000000","message":"Done in all five scripts, with your message. It goes to stdout like the\nother messages in these scripts (\"invalid dev name\", \"setting DNS\nfailed, ...\"), so it ends up in the openvpn log.","commit_id":"53542aefa682e59d804ae353be9731bf15ed9dfd"},{"author":{"_account_id":1000053,"name":"Răzvan Cojocaru","display_name":"Razvan Cojocaru","email":"razvanc@mailbox.org","username":"razvanc"},"change_message_id":"2670af3deeb32b0e798cb84a9295f4acc1c5bb8b","unresolved":true,"context_lines":[{"line_number":64,"context_line":"                # dev is used in sed expressions and as a command argument:"},{"line_number":65,"context_line":"                # only accept interface name characters (\"/\" for Haiku tun/N)"},{"line_number":66,"context_line":"                case $_value in"},{"line_number":67,"context_line":"                    [!A-Za-z0-9]* | *[!A-Za-z0-9_./-]* | *..*)"},{"line_number":68,"context_line":"                        echo \"invalid dev name in ${_f}\""},{"line_number":69,"context_line":"                        exit 1"},{"line_number":70,"context_line":"                        ;;"}],"source_content_type":"text/x-sh","patch_set":2,"id":"c6d2437f_ccccb43f","line":67,"updated":"2026-11-25 10:38:49.000000000","message":"So on second thought, this causes a regression in what Linux actually allows (e.g. `_vpn`, `vpn+1`, `tun@corp` are actually accepted by Linux as interface names).\n\nSo this change would stop them from being accepted.\n\nWe could instead make this a deny list instead, e.g.:\n\n```\n             dev)\n-                # dev is used in sed expressions and as a command argument:\n-                # only accept interface name characters (\"/\" for Haiku tun/N)\n+                # Reject what could end a \\%re% sed address (% and \\),\n+                # pass as a command option (leading -) or walk up a path (..)\n                 case $_value in\n-                    [!A-Za-z0-9]* | *[!A-Za-z0-9_./-]* | *..*)\n+                    -* | *%* | *\\\\* | *..*)\n                         echo \"invalid dev name in ${_f}\"\n                         exit 1\n                         ;;\n                 esac\n                 ;;\n```","commit_id":"53542aefa682e59d804ae353be9731bf15ed9dfd"},{"author":{"_account_id":1000071,"name":"Deri Haerudi","email":"abcderyscreenprinting@gmail.com","username":"derioii"},"change_message_id":"6bca11ca2e8925958923716858e5ef77384992c8","unresolved":false,"context_lines":[{"line_number":64,"context_line":"                # dev is used in sed expressions and as a command argument:"},{"line_number":65,"context_line":"                # only accept interface name characters (\"/\" for Haiku tun/N)"},{"line_number":66,"context_line":"                case $_value in"},{"line_number":67,"context_line":"                    [!A-Za-z0-9]* | *[!A-Za-z0-9_./-]* | *..*)"},{"line_number":68,"context_line":"                        echo \"invalid dev name in ${_f}\""},{"line_number":69,"context_line":"                        exit 1"},{"line_number":70,"context_line":"                        ;;"}],"source_content_type":"text/x-sh","patch_set":2,"id":"76cb71ad_4742e566","line":67,"in_reply_to":"c6d2437f_ccccb43f","updated":"2026-11-25 11:21:55.000000000","message":"Agreed, the allow-list rejected names that Linux accepts. PS3 uses your\ndeny-list as is, in all five scripts.\n\nWith `%` and `\\` rejected, dev cannot end the `\\%...%` address, so\ncharacters like `;`, `/`, `$` or blanks are only regex characters there.\nI re-ran the sed `e`/`r`/`w` payloads, which now get past the reader,\nagainst the three dns-down sed calls: nothing is executed, read or\nwritten (the same values with `/` as the delimiter still do). `_vpn`,\n`vpn+1` and `tun@corp` now round-trip, as do tun0, eth0.100, wg0, utun3\nand tun/0.\n\ndev is still a regex in that address, as it was in the original\nscripts, so an unusual name only changes which marker lines match.","commit_id":"53542aefa682e59d804ae353be9731bf15ed9dfd"},{"author":{"_account_id":1000053,"name":"Răzvan Cojocaru","display_name":"Razvan Cojocaru","email":"razvanc@mailbox.org","username":"razvanc"},"change_message_id":"2670af3deeb32b0e798cb84a9295f4acc1c5bb8b","unresolved":true,"context_lines":[{"line_number":111,"context_line":"    test -z \"$dns_search_domain_1\" || {"},{"line_number":112,"context_line":"        for i in $(seq 1 6); do"},{"line_number":113,"context_line":"            eval d\u003d\\\"\\$dns_search_domain_${i}\\\" || break"},{"line_number":114,"context_line":"            domains\u003d\"$domains$d \""},{"line_number":115,"context_line":"        done"},{"line_number":116,"context_line":"        text\u003d\"${text}search $domains\\n\""},{"line_number":117,"context_line":"    }"}],"source_content_type":"text/x-sh","patch_set":2,"id":"7542e6a6_3612c9ba","line":114,"updated":"2026-11-25 10:38:49.000000000","message":"This could stop at the first empty domain. E.g.:\n\n```\n     test -z \"$dns_search_domain_1\" || {\n         for i in $(seq 1 6); do\n-            eval d\u003d\\\"\\$dns_search_domain_${i}\\\" || break\n-            domains\u003d\"$domains$d \"\n+            eval d\u003d\\\"\\$dns_search_domain_${i}\\\"\n+            [ -n \"$d\" ] || break\n+            domains\u003d\"${domains:+$domains }$d\"\n         done\n         text\u003d\"${text}search $domains\\n\"\n     }\n```","commit_id":"53542aefa682e59d804ae353be9731bf15ed9dfd"},{"author":{"_account_id":1000071,"name":"Deri Haerudi","email":"abcderyscreenprinting@gmail.com","username":"derioii"},"change_message_id":"6bca11ca2e8925958923716858e5ef77384992c8","unresolved":false,"context_lines":[{"line_number":111,"context_line":"    test -z \"$dns_search_domain_1\" || {"},{"line_number":112,"context_line":"        for i in $(seq 1 6); do"},{"line_number":113,"context_line":"            eval d\u003d\\\"\\$dns_search_domain_${i}\\\" || break"},{"line_number":114,"context_line":"            domains\u003d\"$domains$d \""},{"line_number":115,"context_line":"        done"},{"line_number":116,"context_line":"        text\u003d\"${text}search $domains\\n\""},{"line_number":117,"context_line":"    }"}],"source_content_type":"text/x-sh","patch_set":2,"id":"a7ae9f81_6123ae4a","line":114,"in_reply_to":"7542e6a6_3612c9ba","updated":"2026-11-25 11:21:55.000000000","message":"Done, thanks. The \"search\" line now has no trailing blanks and stops at\nthe first empty domain. I rewrote the last paragraph of the commit\nmessage to say so. openvpn writes the domains without gaps, so the stop\nonly matters for hand-written files.","commit_id":"53542aefa682e59d804ae353be9731bf15ed9dfd"}],"distro/dns-scripts/resolvconf_file-dns-updown.sh":[{"author":{"_account_id":1000053,"name":"Răzvan Cojocaru","display_name":"Razvan Cojocaru","email":"razvanc@mailbox.org","username":"razvanc"},"change_message_id":"2670af3deeb32b0e798cb84a9295f4acc1c5bb8b","unresolved":true,"context_lines":[{"line_number":111,"context_line":"    test -z \"$dns_search_domain_1\" || {"},{"line_number":112,"context_line":"        for i in $(seq 1 6); do"},{"line_number":113,"context_line":"            eval d\u003d\\\"\\$dns_search_domain_${i}\\\" || break"},{"line_number":114,"context_line":"            domains\u003d\"$domains$d \""},{"line_number":115,"context_line":"        done"},{"line_number":116,"context_line":"        text\u003d\"${text}search $domains\\n\""},{"line_number":117,"context_line":"    }"}],"source_content_type":"text/x-sh","patch_set":2,"id":"3adbf885_902f6cf4","line":114,"updated":"2026-11-25 10:38:49.000000000","message":"Same suggestion as for haikuos_file-dns-updown.sh (same hunk).","commit_id":"53542aefa682e59d804ae353be9731bf15ed9dfd"},{"author":{"_account_id":1000071,"name":"Deri Haerudi","email":"abcderyscreenprinting@gmail.com","username":"derioii"},"change_message_id":"6bca11ca2e8925958923716858e5ef77384992c8","unresolved":false,"context_lines":[{"line_number":111,"context_line":"    test -z \"$dns_search_domain_1\" || {"},{"line_number":112,"context_line":"        for i in $(seq 1 6); do"},{"line_number":113,"context_line":"            eval d\u003d\\\"\\$dns_search_domain_${i}\\\" || break"},{"line_number":114,"context_line":"            domains\u003d\"$domains$d \""},{"line_number":115,"context_line":"        done"},{"line_number":116,"context_line":"        text\u003d\"${text}search $domains\\n\""},{"line_number":117,"context_line":"    }"}],"source_content_type":"text/x-sh","patch_set":2,"id":"fc67337a_a0a4cd90","line":114,"in_reply_to":"3adbf885_902f6cf4","updated":"2026-11-25 11:21:55.000000000","message":"Done, same hunk.","commit_id":"53542aefa682e59d804ae353be9731bf15ed9dfd"}],"distro/dns-scripts/systemd-dns-updown.sh":[{"author":{"_account_id":1000053,"name":"Răzvan Cojocaru","display_name":"Razvan Cojocaru","email":"razvanc@mailbox.org","username":"razvanc"},"change_message_id":"2670af3deeb32b0e798cb84a9295f4acc1c5bb8b","unresolved":true,"context_lines":[{"line_number":263,"context_line":"        test -z \"$dns_search_domain_1\" || {"},{"line_number":264,"context_line":"            for i in $(seq 1 6); do"},{"line_number":265,"context_line":"                eval d\u003d\\\"\\$dns_search_domain_${i}\\\" || break"},{"line_number":266,"context_line":"                domains\u003d\"$domains$d \""},{"line_number":267,"context_line":"            done"},{"line_number":268,"context_line":"            text\u003d\"${text}search $domains\\n\""},{"line_number":269,"context_line":"        }"}],"source_content_type":"text/x-sh","patch_set":2,"id":"b3164433_5568c4aa","line":266,"updated":"2026-11-25 10:38:49.000000000","message":"This could stop at the first empty domain, e.g.:\n\n```\n         test -z \"$dns_search_domain_1\" || {\n             for i in $(seq 1 6); do\n-                eval d\u003d\\\"\\$dns_search_domain_${i}\\\" || break\n-                domains\u003d\"$domains$d \"\n+                eval d\u003d\\\"\\$dns_search_domain_${i}\\\"\n+                [ -n \"$d\" ] || break\n+                domains\u003d\"${domains:+$domains }$d\"\n             done\n             text\u003d\"${text}search $domains\\n\"\n         }\n```","commit_id":"53542aefa682e59d804ae353be9731bf15ed9dfd"},{"author":{"_account_id":1000071,"name":"Deri Haerudi","email":"abcderyscreenprinting@gmail.com","username":"derioii"},"change_message_id":"6bca11ca2e8925958923716858e5ef77384992c8","unresolved":false,"context_lines":[{"line_number":263,"context_line":"        test -z \"$dns_search_domain_1\" || {"},{"line_number":264,"context_line":"            for i in $(seq 1 6); do"},{"line_number":265,"context_line":"                eval d\u003d\\\"\\$dns_search_domain_${i}\\\" || break"},{"line_number":266,"context_line":"                domains\u003d\"$domains$d \""},{"line_number":267,"context_line":"            done"},{"line_number":268,"context_line":"            text\u003d\"${text}search $domains\\n\""},{"line_number":269,"context_line":"        }"}],"source_content_type":"text/x-sh","patch_set":2,"id":"d893cef7_39c2561a","line":266,"in_reply_to":"b3164433_5568c4aa","updated":"2026-11-25 11:21:55.000000000","message":"Done.","commit_id":"53542aefa682e59d804ae353be9731bf15ed9dfd"}]}
