Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPD-46264 - Extract inline styles #4668

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

juanjofgliferay
Copy link
Collaborator

Story / Task

LPD-44564 / LPD-46264

Goal

Extend ContentSecurityPolicyHTMLRewriter scope so it extracts event handlers and inline styles using the same DOM node.

# breaking

## What portal-kernel/src/com/liferay/portal/kernel/content/security/policy/ContentSecurityPolicyHTMLRewriter.java
portal-kernel/src/com/liferay/portal/kernel/content/security/policy/ContentSecurityPolicyHTMLRewriter.java includes
a utility that extracts inline event handlers and styles from the same DOM node

## Why
The method deeds a more generic name as it considers more attributes to extract
@juanjofgliferay juanjofgliferay requested review from izaera and removed request for liferay-frontend January 17, 2025 08:43
@liferay-continuous-integration
Copy link
Collaborator

CI is automatically triggering the following test suites:

  •     ci:test:sf

@liferay-continuous-integration
Copy link
Collaborator

❌ ci:test:sf - 0 out of 1 jobs passed in 4 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: d1f1ba2114b232828a89aa605c18ef368ad23905

Sender Branch:

Branch Name: LPD-46264
Branch GIT ID: 4a427744b3b57cb397842d14261b0c3455e9cfce

0 out of 1jobs PASSED
For more details click here.
format-source-files:
     [java] java.lang.Exception: Found 2 formatting issues:
     [java] 1: ./modules/apps/frontend-taglib/frontend-taglib-clay/src/main/java/com/liferay/frontend/taglib/clay/servlet/taglib/AlertTag.java expected:<...icyHTMLRewriterUtil.[rewriteInlineAttributes(
     [java] ]          sb.toString(), ...> but was:<...icyHTMLRewriterUtil.[
     [java]           rewriteInlineAttributes(
     [java]   ]          sb.toString(), ...>
     [java] 2: ./util-taglib/src/com/liferay/taglib/ui/CSPTag.java expected:<...icyHTMLRewriterUtil.[rewriteInlineAttributes(
     [java] ]          bodyContent.get...> but was:<...icyHTMLRewriterUtil.[
     [java]           rewriteInlineAttributes(
     [java]   ]          bodyContent.get...>
     [java] 
     [java]   at com.liferay.source.formatter.SourceFormatter.format(SourceFormatter.java:472)
     [java]   at com.liferay.source.formatter.SourceFormatter.main(SourceFormatter.java:301)
[stopwatch] [run.batch.test.action: 1:57.741 sec]
     [echo] The following error occurred while executing this line:
     [echo] /opt/dev/projects/github/liferay-portal/portal-impl/build.xml:498: The following error occurred while executing this line:
     [echo] /opt/dev/projects/github/liferay-portal/portal-impl/build.xml:651: Java returned: 1
  [typedef] Could not load definitions from resource org/apache/maven/artifact/ant/antlib.xml. It could not be found.
  [taskdef] Could not load definitions from resource org/jacoco/ant/antlib.xml. It could not be found.
   [delete] Deleting: /opt/dev/projects/github/liferay-portal/null864637582.properties

merge-test-results:
[mkdir] Created dir: /opt/dev/projects/github/liferay-portal/test-results
[beanshell] Truncating errors in /opt/dev/projects/github/liferay-portal/portal-impl/test-results/TEST-JenkinsLogAssertTest.xml
[junitreport] Processing /opt/dev/projects/github/liferay-portal/test-results/TESTS-TestSuites.xml to /tmp/null1704536478
[junitreport] Loading stylesheet ile:/opt/java/ant/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] Transform time: 205ms
[junitreport] Deleting: /tmp/null1704536478
[echo] A report with all the test results can be found at test-results/html/index.html.
[mkdir] Created dir: /opt/dev/projects/github/liferay-jenkins-ee/test-results
[copy] Copying 1 file to /opt/dev/projects/github/liferay-jenkins-ee/test-results
[echo] run.batch.test.tear.down.start.timestamp: 01-17-2025 00:47:32:682 PST

@liferay-continuous-integration
Copy link
Collaborator

@juanjofgliferay
Copy link
Collaborator Author

ci:test:sf

@liferay-continuous-integration
Copy link
Collaborator

✔️ ci:test:sf - 1 out of 1 jobs passed in 5 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: d1f1ba2114b232828a89aa605c18ef368ad23905

Sender Branch:

Branch Name: LPD-46264
Branch GIT ID: 14793fbae826cb9b745c6f35bb8c9abaefdc8759

1 out of 1jobs PASSED
1 Successful Jobs:
For more details click here.

@liferay-continuous-integration
Copy link
Collaborator

String elementStyles = element.attr("style");

if (Validator.isBlank(elementStyles)) {
return;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would break the recursive logic, right? 🤔

Meaning it wouldn't process children if the parent has no style attribute...

@juanjofgliferay
Copy link
Collaborator Author

ci:test:sf

@liferay-continuous-integration
Copy link
Collaborator

✔️ ci:test:sf - 1 out of 1 jobs passed in 4 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: d1f1ba2114b232828a89aa605c18ef368ad23905

Sender Branch:

Branch Name: LPD-46264
Branch GIT ID: 14793fbae826cb9b745c6f35bb8c9abaefdc8759

1 out of 1jobs PASSED
1 Successful Jobs:
For more details click here.

@liferay-continuous-integration
Copy link
Collaborator

@juanjofgliferay
Copy link
Collaborator Author

ci:test:relevant

@juanjofgliferay
Copy link
Collaborator Author

ci:test:sf

@liferay-continuous-integration
Copy link
Collaborator

✔️ ci:test:sf - 1 out of 1 jobs passed in 4 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: d1f1ba2114b232828a89aa605c18ef368ad23905

Sender Branch:

Branch Name: LPD-46264
Branch GIT ID: 1ad9385338fdc291a17a817f74d66a6925602880

1 out of 1jobs PASSED
1 Successful Jobs:
For more details click here.

@liferay-continuous-integration
Copy link
Collaborator

@liferay-continuous-integration
Copy link
Collaborator

✔️ ci:test:stable - 24 out of 24 jobs passed

❌ ci:test:relevant - 95 out of 130 jobs passed in 3 hours 24 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: d1f1ba2114b232828a89aa605c18ef368ad23905

Upstream Comparison:

Branch GIT ID: d1f1ba2114b232828a89aa605c18ef368ad23905
Jenkins Build URL: EE Development Acceptance (master) - 2 - 2025-01-16[23:22:23]

ci:test:stable - 24 out of 24 jobs PASSED
24 Successful Jobs:
    ci:test:relevant - 95 out of 130 jobs PASSED

    35 Failed Jobs:

    95 Successful Jobs:
      For more details click here.

      Failures unique to this pull:

      1. ...

      For upstream results, click here.

      Test bundle downloads:

      @liferay-continuous-integration
      Copy link
      Collaborator

      @juanjofgliferay
      Copy link
      Collaborator Author

      ci:test:relevant

      @liferay-continuous-integration
      Copy link
      Collaborator

      ✔️ ci:test:stable - 24 out of 24 jobs passed

      ❌ ci:test:relevant - 174 out of 206 jobs passed in 4 hours 3 minutes

      Click here for more details.

      This pull is eligible for reevaluation. When this upstream build has completed, using the following CI command will compare this pull request result against a more recent upstream result:

      ci:reevaluate:1377401_19829

      Base Branch:

      Branch Name: master
      Branch GIT ID: 4035a2f3f4c922f3108d0bf0a3939c66802ed5ba

      Upstream Comparison:

      Branch GIT ID: 09cc2b52634eb72cdebf54b7aac9afe4ba545311
      Jenkins Build URL: EE Development Acceptance (master) - 1128 - 2025-01-19[20:37:59]

      ci:test:stable - 24 out of 24 jobs PASSED
      24 Successful Jobs:
        ci:test:relevant - 174 out of 206 jobs PASSED

        32 Failed Jobs:

        174 Successful Jobs:
          For more details click here.

          Failures unique to this pull:

          1. semantic-versioning/0/0
            clean-up-java-processes:
               [delete] Deleting: /opt/dev/projects/github/liferay-portal/clean_up_java_processes.sh
            [stopwatch] [run.batch.test.setup: 19:09.280 sec]
                 [echo] run.batch.test.action.start.timestamp: 01-20-2025 00:41:53:966 PST
                 [echo] Checking for baseline log files.
                 [echo] 
                 [echo] ##
                 [echo] ## /opt/dev/projects/github/liferay-portal/baseline-reports/portal-kernel.log
                 [echo] ##
                 [echo] 
            [beanshell] [Baseline Warning] Bundle Version Change Recommended: 157.0.0
            [beanshell] 
            [stopwatch] [run.batch.test.action: 6.473 sec]
                 [echo] Semantic versioning is incorrect.
               [delete] Deleting: /opt/dev/projects/github/liferay-portal/null1719861490.properties
            1. com.liferay.jenkins.JenkinsLogAsserterTest
          2. ...
          Test bundle downloads:

          @liferay-continuous-integration
          Copy link
          Collaborator

          Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
          Projects
          None yet
          Development

          Successfully merging this pull request may close these issues.

          3 participants