dhananjay6561 opened a new pull request, #3642:
URL: https://github.com/apache/maven-surefire/pull/3642

   Fixes #3617.
   
   On Unix, `PpidChecker.unix()` built the `ps` command as one string (`ps -o 
etime,pid [-p ]<ppid>`) and ran it through `/bin/sh -c`. The PPID comes from 
the boot config and is always numeric today, so nothing is exploitable, but the 
value was still being parsed by a shell.
   
   This builds the command as an argument array and passes it straight to 
`ProcessBuilder`, so `ps` gets the same arguments as before without a shell in 
between. The `-p` flag is still left out on Linux (busybox `ps` on Alpine does 
not support it), and the `UNIX95` environment variable for HP-UX is still set 
on the process builder, so the behaviour on each platform stays the same.
   
   Tests in the new `PpidCheckerTest`:
   - the command has no `/bin/sh -c` and the PPID is passed as one argument, 
even when it contains `;` and a space
   - on Unix, `unix()` still reads the current process from `ps` (runs on all 
JDKs, not only on Java 8 where `ProcessChecker.of` picks `PpidChecker`)
   
   ---
   
   To make clear that you license your contribution under
   the [Apache License Version 2.0, January 
2004](https://www.apache.org/licenses/LICENSE-2.0)
   check one of the following:
   
   - [x] I hereby declare this contribution to be licensed under the [Apache 
License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0)
   - [ ] I hereby declare that I have filed an [Apache Individual Contributor 
License Agreement](https://www.apache.org/licenses/icla.pdf).
   


-- 
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]

Reply via email to