Skip to content

feat: add CSP whitelist and update Alpine.js to version 3.15.11 with hash security#159

Merged
dermatz merged 5 commits intomainfrom
feature/inspector-csp-whitelist
Apr 10, 2026
Merged

feat: add CSP whitelist and update Alpine.js to version 3.15.11 with hash security#159
dermatz merged 5 commits intomainfrom
feature/inspector-csp-whitelist

Conversation

@dermatz
Copy link
Copy Markdown
Member

@dermatz dermatz commented Apr 10, 2026

This pull request updates the way Alpine.js is loaded in the frontend and ensures compliance with Magento's Content Security Policy (CSP) requirements. The main changes include upgrading Alpine.js to a newer version, adding Subresource Integrity (SRI) for security, and whitelisting the CDN in the CSP configuration.

Frontend JavaScript Loading:

  • Upgraded Alpine.js from version 3.14.1 to 3.15.11 in inspector.phtml and added Subresource Integrity (SRI) and crossOrigin attributes to enhance security when loading from the CDN.

Security and CSP Configuration:

  • Added a new csp_whitelist.xml file to whitelist cdn.jsdelivr.net for script-src, ensuring the CDN is allowed by Magento's CSP module.

Copilot AI review requested due to automatic review settings April 10, 2026 06:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates how the MageForge frontend inspector loads Alpine.js by switching to a newer CDN version with Subresource Integrity (SRI) and adding a Magento CSP whitelist entry so the CDN host is permitted.

Changes:

  • Bumped Alpine.js CDN version in inspector.phtml and added SRI + crossOrigin.
  • Added a csp_whitelist.xml entry to allow cdn.jsdelivr.net for script-src.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/view/frontend/templates/inspector.phtml Updates Alpine.js CDN URL and adds SRI/crossOrigin attributes for the dynamically injected script.
src/etc/csp_whitelist.xml Adds CSP whitelist entry to permit loading scripts from cdn.jsdelivr.net.

Comment thread src/view/frontend/templates/inspector.phtml
Comment thread src/etc/frontend/csp_whitelist.xml
Comment thread src/view/frontend/templates/inspector.phtml
Copilot AI review requested due to automatic review settings April 10, 2026 07:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates how MageForge’s frontend inspector loads Alpine.js from a CDN to comply with Magento CSP requirements while improving supply-chain security via SRI.

Changes:

  • Upgraded Alpine.js CDN version to 3.15.11 and added SRI + crossOrigin handling in the inspector bootstrap.
  • Rendered the inline bootstrap via Magento’s secure HTML renderer to better align with CSP nonce handling.
  • Added a frontend CSP whitelist entry allowing cdn.jsdelivr.net for script-src.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/view/frontend/templates/inspector.phtml Updates Alpine loader to use jsDelivr 3.15.11 with SRI and CSP-safe inline script rendering.
src/etc/frontend/csp_whitelist.xml Whitelists cdn.jsdelivr.net for script-src under Magento CSP.

Comment thread src/view/frontend/templates/inspector.phtml
@dermatz dermatz merged commit fa811bd into main Apr 10, 2026
13 checks passed
@dermatz dermatz deleted the feature/inspector-csp-whitelist branch April 10, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants