PHP 8.4 / Magento 2.4.8+ compatibility, beacon + CSP fixes, encrypted token & docs - #13
Open
allrude wants to merge 4 commits into
Open
PHP 8.4 / Magento 2.4.8+ compatibility, beacon + CSP fixes, encrypted token & docs#13allrude wants to merge 4 commits into
allrude wants to merge 4 commits into
Conversation
Compatibility, correctness, security and cleanup pass on the fork, plus full user documentation. Public config paths (basicrum/general/*) are unchanged. Functional fixes: - Initialise Boomerang for real. The template built basicRumBoomerangConfig but never passed it to Boomerang, so beacon_url / cookie flags / plugin settings were inert. Now pushes ["init", config] through BOOMR_mq. - Reimplement the "send after onload" delay with the public API (autorun:false + delayed BOOMR.page_ready) instead of a custom plugin that was never registered in the Boomerang build. - Add dynamic CSP: Model/Csp/BeaconPolicyCollector adds the configured beacon origin to connect-src + img-src, registered in CompositePolicyCollector. Without this, beacons are blocked on strict-CSP 2.4.x stores. Compatibility: - composer.json: PHP ~8.3||~8.4 (was ^8.1|^8.2|^8.3, excluded 8.4); replace "*" wildcards with bounded ranges; add module-config/backend/csp deps. - module.xml: declare <sequence> for Store/Config/Backend/Csp. - PageTypeDetector: inject Response\Http (interface lacked getStatusCode()), strict ===404, map cms_noroute_index, memoise. Cleanup / security: - Footer ViewModel: typed, null-safe getBeaconEndpoint(); path constant. - footer.phtml: render nothing when endpoint empty; standardise on $escaper->escapeJs; drop redundant view-model re-fetch; keep SecureHtmlRenderer. - Trim PageTypeDetectorInterface to getPageType(); add return types to admin blocks; move Logo markup to an admin template + CSS (no inline styles). - Centralise Boomerang version in Model\Boomerang; rename vendored file to version-agnostic boomerang.min.js (it is release build 815, "cutting-edge" plugin flavor — a plugin-set name, not an unstable channel). - Beacon Endpoint field: validate-url + CSP comment. - Remove non-functional consent group + ConsentMode source model. - Add LICENSE (MIT + BSD-3 notice for Boomerang); correct README. Docs: - docs/user-guide.html: self-contained setup guide (cards, <details>, <dialog>) covering install, endpoint/token, config, CSP, verification, FAQ and troubleshooting. - CHANGELOG.md and IMPROVEMENT_PLAN.md documenting what/why. Verified: php -l clean on PHP 8.4; composer validate clean; setup:upgrade succeeds; Magento-bootstrapped runtime check confirms DI resolution, ViewModel null-safety, and that the CSP collector emits the correct policies and is registered. Browser-level beacon/CSP check left for the operator. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- system.xml: new optional "Beacon Token / Site Key" field (basicrum/general/token), type=obscure + Encrypted backend model. - Footer ViewModel: decrypt the token and expose getBeaconUrl(), which appends the token to the endpoint as &token=... (URL-encoded, respecting an existing query string). Template now uses getBeaconUrl(). - CSP collector unaffected (token is in the query string, not the host). - docs/user-guide.html: remove the three feature-card emoji icons; increase spacing between section headings and cards; change the hero's purple to a dark green; document the new Token field (setup step, settings table, FAQ, example dialog). - CHANGELOG: note the new token field. Verified: php -l clean; runtime test confirms token append + URL-encoding for plain, existing-query, blank-token and no-endpoint cases. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Hero uses a single dark-green color instead of a blue→green gradient. - Increase top padding under the sticky nav so the first section isn't cramped; add scroll-margin-top so anchor links don't hide headings under the sticky nav. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`main` also carries class="wrap", so `.wrap{padding:0 20px}` (class
selector) beat `main{padding:52px 0 60px}` (element selector) on specificity
and the top padding never applied. Target `main.wrap` so the top space sticks.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings the module up to date for modern Magento, fixes two functional bugs in the
beacon integration, adds an encrypted token field, and ships a complete user guide.
The public config paths (
basicrum/general/*) are unchanged, so existingconfiguration keeps working after upgrade.
Why
^8.1|^8.2|^8.3) excluded PHP 8.4, blockinginstallation on Magento 2.4.9.
init, so thebeacon URL and plugin settings were inert.
What's in this PR
Functional fixes
["init", config]throughBOOMR_mqso theconfigured
beacon_url/ cookie flags / plugins actually take effect.WaitAfterOnloadplugin withautorun: false+ a delayedBOOMR.page_ready().Model/Csp/BeaconPolicyCollectoradds the configured beaconorigin to
connect-src+img-src, registered inCompositePolicyCollector.No manual
csp_whitelist.xmlneeded since the endpoint is admin-configurable.New feature
basicrum/general/token,obscure+Encryptedbackend). When set, it is decrypted and appended to thebeacon URL as
&token=…(URL-encoded, respecting an existing query string).Compatibility
composer.json: PHP~8.3.0 || ~8.4.0; replace*wildcards with boundedranges; add the modules actually used (
module-config,module-backend,module-csp).etc/module.xml: declare<sequence>for Store / Config / Backend / Csp.PageTypeDetector: injectApp\Response\Http(the baseResponseInterfacedoesn't declare
getStatusCode()), strict=== 404, mapcms_noroute_index, memoise.Cleanup & security
standardises on
$escaper->escapeJs, keeps the CSP-safeSecureHtmlRenderer.PageTypeDetectorInterfaceto the method in use; add return types to adminblocks; move the
Logofield's markup out of PHP into a template + CSS.Model\Boomerang; rename the vendored file toa version-agnostic
boomerang.min.js.LICENSE(MIT + BSD-3-Clause notice for bundled Boomerang); fix theREADME (previously claimed PHP 7.2 / Magento 2.3).
Docs
docs/user-guide.html(install, endpoint/token, config, CSP,verification, FAQ, troubleshooting), plus
CHANGELOG.md.Behaviour changes
consentgroup (consent/enabled,consent/mode)and its
ConsentModesource model — they were never read by any code. Real consentgating can be reintroduced as a proper feature later.
How to test
composer requirethe branch,bin/magento module:enable BasicRum_Analytics,setup:upgrade,cache:flush.p_type+p_gen=mage2(and&token=…if set).Notes
(bundles Continuity) — a plugin-set name, not an unstable channel; npm
latest(1.815.1) is the same build. Kept as-is; only the filename/version bookkeeping changed.