Skip to content

Conversation

Mohamed-Asar
Copy link
Contributor

Description (*)

Rendering the critical css inline event via csp inline secure render

Fixed Issues (if relevant)

  1. Fixes CSP issues combined with dev/css/use_css_critical_path #39020

Manual testing scenarios (*)

  1. Enable dev/css/use_css_critical_path in order to facilitate critical CSS functionality
  2. Add some items to cart
  3. Visit checkout page

Copy link

m2-assistant bot commented Aug 13, 2024

Hi @Mohamed-Asar. Thank you for your contribution!
Here are some useful tips on how you can test your changes using Magento test environment.

Add the comment under your pull request to deploy test or vanilla Magento instance:
  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here
ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation.
Join Magento Community Engineering Slack and ask your questions in #github channel.

@m2-community-project m2-community-project bot added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Aug 13, 2024
@m2-github-services m2-github-services added Partner: Ziffity partners-contribution Pull Request is created by Magento Partner labels Aug 13, 2024
@Priyakshic Priyakshic added the Project: Community Picked PRs upvoted by the community label Sep 12, 2024
@engcom-Hotel
Copy link
Contributor

@magento run all tests

Copy link
Contributor

@engcom-Hotel engcom-Hotel left a comment

Choose a reason for hiding this comment

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

Hello @Mohamed-Asar,

Thanks for the contribution!

Please make the changes as suggested below.

Thanks

{
public function __construct(
ScopeConfigInterface $scopeConfig,
InlineUtilInterface $cspInlineUtil
Copy link
Contributor

Choose a reason for hiding this comment

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

New Params in Constructor should be null and handle it with ObjectManager

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@engcom-Hotel Changes done. please check

@engcom-Hotel
Copy link
Contributor

@magento run all tests

@engcom-Charlie
Copy link
Contributor

It seems that review changes has been covered so moved it back to review

@engcom-Hotel
Copy link
Contributor

@magento run Functional Tests CE, Functional Tests EE, Static Tests, Unit Tests

@engcom-Bravo
Copy link
Contributor

@magento run all tests

@engcom-Bravo
Copy link
Contributor

Hi @Mohamed-Asar,

Thanks for the collaboration & contribution!

✔️ QA Passed

Preconditions:

  • Install fresh Magento 2.4-develop

Steps to reproduce

  • Enable dev/css/use_css_critical_path in order to facilitate critical CSS functionality
  • Add some items to cart
  • Visit checkout page

Before: ✖️ 

Screenshot 2024-09-23 at 11 00 33

After: ✔️

Screenshot 2024-09-23 at 11 04 54

Checkout pages are rendered with proper css styles

Builds are failed. Hence, moving this PR to Extended Testing.

Thanks

@engcom-Charlie engcom-Charlie self-assigned this Sep 23, 2024
@engcom-Charlie
Copy link
Contributor

@magento run Functional Tests B2B, Functional Tests CE, Functional Tests EE, Integration Tests, Static Tests, Unit Tests

@engcom-Charlie
Copy link
Contributor

@magento run Functional Tests B2B, Functional Tests CE, Functional Tests EE, Integration Tests, Static Tests, Unit Tests

@engcom-Charlie
Copy link
Contributor

@magento run Functional Tests B2B, Functional Tests CE, Functional Tests EE, Integration Tests, Static Tests, Unit Tests

@engcom-Charlie
Copy link
Contributor

@magento run all tests

@Mohamed-Asar
Copy link
Contributor Author

@engcom-Charlie I fixed the unit cases issue

@Mohamed-Asar
Copy link
Contributor Author

@magento run all tests

@Mohamed-Asar
Copy link
Contributor Author

@magento run Functional Tests B2B, Functional Tests EE, Static Tests

@Mohamed-Asar
Copy link
Contributor Author

@magento run Static Tests

@Mohamed-Asar
Copy link
Contributor Author

@magento run all tests

@engcom-Charlie
Copy link
Contributor

@magento run Functional Tests B2B, Functional Tests EE, Static Tests

@engcom-Charlie
Copy link
Contributor

@magento run all tests

@engcom-Charlie
Copy link
Contributor

@magento run Functional Tests CE

@engcom-Charlie
Copy link
Contributor

@magento run Functional Tests EE, Functional Tests B2B

@engcom-Charlie
Copy link
Contributor

engcom-Charlie commented Oct 1, 2024

@magento-devops-reposync-svc magento-devops-reposync-svc merged commit 5c24c15 into magento:2.4-develop Oct 18, 2024
11 of 12 checks passed
@bigbangx
Copy link

bigbangx commented Feb 24, 2025

Hello,
Not sure if that's what you expected, but it's good to mention that, as $useUnsafeHashes is false by defalut in Magento\Csp\Helper\InlineUtil , this code will set unsafe-inline on script-src for all pages with critical css !

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

Labels

Partner: Ziffity partners-contribution Pull Request is created by Magento Partner Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: ready for testing Project: Community Picked PRs upvoted by the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CSP issues combined with dev/css/use_css_critical_path

8 participants