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

Magento 2.4.6-p6 Csp bugfix (jquery getScript bug) #56

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

Conversation

wmwnuk
Copy link

@wmwnuk wmwnuk commented Jun 19, 2024

This fixes #55

Some explanation of the changes:

  • jQuery.getScript doesn't play well with latest CSP security fixes made to Magento, so I replaced it with vanilla JS
  • To get nonce value required by CSP (and escape script content properly) I needed to add additional dependencies to the ConfigOpen and ConfigOrigin classes
  • Although, these classes (and ConfigFacade) where instantiated directly 'on use', which would require passing long chain of class members only to create these classes, which should be DI's job
  • Magento 2 proxies do exactly what you intended to do in the code, so the class is actually instantiated only when used, so I removed the direct instantiations and instead added Proxy classes as members trimming down class dependencies significantly

I'm explaining this in detail as it might seem like a lot of seemingly unrelated code changes for a simple JS fix.

@s4ddly
Copy link
Contributor

s4ddly commented Jul 8, 2024

Can you get PR up to date with latest changes and fix errors given in CI ? @wmwnuk

@s4ddly
Copy link
Contributor

s4ddly commented Jul 29, 2024

@wmwnuk I've created PR for your fork with fixes, please merge it so we can close this PR.

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

Successfully merging this pull request may close these issues.

Tpay module (both ^1.0.0 and ^2.0.0) doesn't work with Magento 2.4.6-p6 due to Csp issues
2 participants