Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-30649

[GSS](8.0.z) jsf packaged jsf.js breaks content security policy

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • None
    • None
    • False
    • Hide

      None

      Show
      None
    • False
    • Customer Escalated

      When a jsf page is set with content security such as:
      "Content-Security-Policy", "default-src 'self'; script-src 'self';"
      it breaks the commandLink which relies on rendering javascript code. It seems that the culprit is the following js code from jsf packaged jsf.js file ($EAP8_HOME/modules/system/layers/base/jakarta/faces/impl/main/jakarta.faces-4.0.11.redhat-00001.jar):

      jsf.util.chain = function(source, event) {

      if (arguments.length < 3)

      { return true; }

      // RELEASE_PENDING rogerk - shouldn't this be getElementById instead of null
      var thisArg = (typeof source === 'object') ? source : null;

      // Call back any scripts that were passed in
      for (var i = 2; i < arguments.length; i++) {

      var f = new Function("event", arguments[i]);
      var returnValue = f.call(thisArg, event);

      if (returnValue === false)

      { return false; }

      }
      return true;

      };

      Especially the call
      var f = new Function("event", arguments[i]);
      that dynamically creates js function which requires unsafe-eval. This breaks the content security policy.

      The commandLink could be as simply as :

      <h:commandLink action="#{testBean.doNothing}" value="Click Me"/>

        1. fav-generic.png
          4 kB
          Brian Stansberry
        2. reproducer-04209988.war
          99 kB
          Gary Hu

              jaslee@redhat.com Jason Lee
              rhn-support-ghu Gary Hu
              Votes:
              0 Vote for this issue
              Watchers:
              12 Start watching this issue

                Created:
                Updated: