slachiewicz opened a new issue, #3617:
URL: https://github.com/apache/maven-surefire/issues/3617
Affected version: master at d7c7e359e.
`PpidChecker.unix`
(surefire-booter/src/main/java/org/apache/maven/surefire/booter/PpidChecker.java:174-204)
builds a command string by concatenating the `ps` path, flags, and `ppid`,
then calls `reader.execute("/bin/sh", "-c", cmd)` at line 203. The executable
path is fixed to `/usr/bin/ps` or `/bin/ps` at lines 259-261.
Tracing `ppid` backward: it comes from `PLUGIN_PID` in the boot config
(`BooterDeserializer.java:78-80`), written only by
`BooterSerializer.serialize:116` from
`forkConfiguration.getPluginPlatform().getPluginPid()`
(`ForkStarter.java:569`). `Platform.getPluginPid` (Platform.java:66-84) returns
`SystemUtils.pid()`, which is always numeric. So the value is not injectable
today, but the pattern is fragile if a future caller makes the PID configurable
or if the boot config file is rewritten.
Expected behavior: replace the shell invocation with a no-shell
`ProcessBuilder("/usr/bin/ps" or "/bin/ps", "-o", "etime,pid", "-p", ppid)` and
validate `ppid` with `Long.parseLong` at the deserialization boundary. Note the
existing busybox/Alpine concern in #2187 when changing flags.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]