Groovy Restriction on Formatter Class

Stricter access to the java.util.Formatter class has been implemented for Groovy scripts. Specifically, constructors that accept a File or file name and are capable of creating or writing to files on the file system are restricted. 

The following constructors are allowed:

  • Formatter()
  • Formatter(Appendable a)
  • Formatter(Appendable a, Locale l)
  • Formatter(Locale l)
  • Formatter(OutputStream os)
  • Formatter(OutputStream os, String csn)
  • Formatter(OutputStream os, String csn, Locale l)
  • Formatter(OutputStream os, Charset charset, Locale l)
  • Formatter(PrintStream ps)

Restricting the methods and constructors for this Java class protects against vulnerabilities.

Steps to enable and configure

You don't need to do anything to enable this feature.