Spark has a built-in prevention system against XSS. To set this, use the following command:
val sc = new SparkContext(new SparkConf())
./bin/spark-submit <all your existing options> --spark.ui.xXssProtection=1;
Different options for this are:
- 0 (Disables XSS filtering)
- 1 (Enables XSS filtering. If a cross-site scripting attack is detected, the browser will sanitize the page.)
- 1; mode=block (Enables XSS filtering. The browser will prevent rendering of the page if an attack is detected.)