Class CspViolationReporter

java.lang.Object
com.vaadin.flow.internal.CspViolationReporter

public final class CspViolationReporter extends Object
Reports calls to APIs that send JavaScript to the browser as a string, which the browser compiles with new Function and a strict Content Security Policy without unsafe-eval blocks.

What happens depends on the CspMode of the current service: nothing in CspMode.OFF, a warning logged once per call site in CspMode.WARN, and a CspViolationException in CspMode.STRICT. Every string-based call is reported, including the ones that Vaadin itself makes. Both the warning and the exception carry a stack trace that starts at the API and leads to the code that called it.

For internal use only. May be renamed or removed in a future release.

Since:
25.4
  • Method Details

    • reportStringJavaScript

      public static void reportStringJavaScript()
      Reports a call to an API that sends JavaScript to the browser as a string. Called by the API itself, which is where the stack trace of the report starts.
      Throws:
      CspViolationException - in the CspMode.STRICT mode