You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "roddhjav (via GitHub)" <gi...@apache.org> on 2025/09/17 15:57:03 UTC
Re: [PR] [SPARK-53337][CORE] Ensure the application name get escaped. [spark]
roddhjav commented on PR #52084:
URL: https://github.com/apache/spark/pull/52084#issuecomment-3303641986
> Can you show us a bad case you've met?
Start spark 4.0.0 in a container (it works too on 3.5.6)
```sh
mkdir -p spark-logs
chmod 777 spark-logs
docker run -it --rm -v "${PWD}/spark-logs:/spark-logs" spark:4.0.0 /bin/bash
```
Inside the container, generate the PySpark script with the payload in the application name.
```sh
cat <<EOF > script.py
from pyspark.sql import SparkSession
if __name__ == "__main__":
spark = SparkSession.builder.appName("<script>alert('Dark Vador')</script>").getOrCreate()
print(spark.range(1000 * 1000 * 1000).count())
spark.stop()
EOF
```
Still inside the container, start the application:
```sh
/opt/spark/bin/spark-submit --conf "spark.eventLog.enabled=true" --conf "spark.eventLog.dir=/spark-logs" script.py
```
Now start the Spark History Server.
```sh
docker run -it --rm -p 18080:18080 -v "${PWD}/spark-logs:/spark-logs" -e "SPARK_HISTORY_OPTS='-Dspark.history.fs.logDirectory=/spark-logs'" -e "SPARK_NO_DAEMONIZE=TRUE" spark:4.0.0 /opt/spark/sbin/start-history-server.sh
```
On the host machine, open a browser and go to http://localhost:18080. You should see a JavaScript alert pop-up.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org