Skip to content

fix(csp): skip sharedStorage when enumerating globalThis properties#4787

Merged
calebporzio merged 1 commit into
alpinejs:mainfrom
PierreBultez:fix/csp-shared-storage-deprecation
Apr 1, 2026
Merged

fix(csp): skip sharedStorage when enumerating globalThis properties#4787
calebporzio merged 1 commit into
alpinejs:mainfrom
PierreBultez:fix/csp-shared-storage-deprecation

Conversation

@PierreBultez

@PierreBultez PierreBultez commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Problem

The CSP parser enumerates all globalThis properties to build a set of known
globals. Accessing window.sharedStorage triggers Chrome's deprecation warning:

[Deprecation] Shared Storage API is deprecated and will be removed in a future release.

This causes Lighthouse "Best Practices" score to drop from 100 to 81.

This is the same class of issue that was already fixed for styleMedia.

Solution

Add "sharedStorage" to the skip list in the globalThis enumeration loop,
alongside the already-skipped "styleMedia".

Testing

  • Before: Chrome DevTools shows deprecation warning on any page using Alpine CSP
  • After: No deprecation warning, Lighthouse Best Practices score returns to 100
  • No functional impact: sharedStorage is not used by Alpine or typical web apps

Fixes #4788

@calebporzio

Copy link
Copy Markdown
Collaborator

good catch. thanks

@calebporzio
calebporzio merged commit f458215 into alpinejs:main Apr 1, 2026
1 check passed
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.

2 participants