java_binary.jvm_flags allows Bash injection #7097
Labels
P3
We're not considering working on this, but happy to review a PR. (No assignee)
stale
Issues or PRs that are stale (no activity for 30 days)
team-Rules-Java
Issues for Java rules
type: bug
Description of the problem / feature request:
On Linux/macOS, where java_binary uses a Bash stub script to start the JVM (in contrast to Windows where we use a C++ binary instead of the Bash stub), Bazel embeds the value of
java_binary.jvm_flags
directly into the stub script.The intent is to support Bash quoting so the user can pass JVM flags like:
The probably unintended consequence is, the user can also pass this:
which will dutifully pass the current date to the JVM.
This is arguably a bug.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
BUILD
file:HelloArg.java
:Output:
What operating system are you running Bazel on?
Linux
What's the output of
bazel info release
?0.21
Have you found anything relevant by searching the web?
Found this while fixing #7072.
The text was updated successfully, but these errors were encountered: