Keep your coding agent up to date with the latest web best practices
Release v0.0.193
github-actions[bot]a97286845f2b
diff --git a/.agents/plugins/marketplace.json b/.agents/plugins/marketplace.jsonindex 09eecd3..59deac0 100644--- a/.agents/plugins/marketplace.json+++ b/.agents/plugins/marketplace.json@@ -15,7 +15,7 @@"authentication": "ON_INSTALL"},"category": "Developer Tools",- "version": "0.0.192"+ "version": "0.0.193"}]}diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsonindex d1045d7..5313d8f 100644--- a/.claude-plugin/marketplace.json+++ b/.claude-plugin/marketplace.json@@ -8,7 +8,7 @@"name": "modern-web-guidance","source": "./","description": "Keep your coding agent up to date with the latest web best practices",- "version": "0.0.192"+ "version": "0.0.193"}]}diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.jsonindex d607fb9..5ef3173 100644--- a/.claude-plugin/plugin.json+++ b/.claude-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "modern-web-guidance","description": "Keep your coding agent up to date with the latest web best practices",- "version": "0.0.192",+ "version": "0.0.193","author": {"name": "Google Chrome"}diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.jsonindex 9fea550..792f28c 100644--- a/.codex-plugin/plugin.json+++ b/.codex-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "modern-web-guidance",- "version": "0.0.192",+ "version": "0.0.193","description": "Keep your coding agent up to date with the latest web best practices","author": {"name": "Google Chrome",diff --git a/.cursor-plugin/plugin.json b/.cursor-plugin/plugin.jsonindex 93842cd..07a8c4f 100644--- a/.cursor-plugin/plugin.json+++ b/.cursor-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "modern-web-guidance","description": "Modern Web Guidance is an agent skill and CLI tool designed to help AI coding agents build web applications using modern, secure, and high-performance APIs rather than outdated workarounds. Supported by the Google Chrome team, it injects expert-curated web platform best practices directly into an agent's context window to prevent the generation of bloated, legacy code.",- "version": "0.0.192",+ "version": "0.0.193","author": {"name": "Google Chrome"}diff --git a/.github/plugin/plugin.json b/.github/plugin/plugin.jsonindex 93842cd..07a8c4f 100644--- a/.github/plugin/plugin.json+++ b/.github/plugin/plugin.json@@ -1,7 +1,7 @@{"name": "modern-web-guidance","description": "Modern Web Guidance is an agent skill and CLI tool designed to help AI coding agents build web applications using modern, secure, and high-performance APIs rather than outdated workarounds. Supported by the Google Chrome team, it injects expert-curated web platform best practices directly into an agent's context window to prevent the generation of bloated, legacy code.",- "version": "0.0.192",+ "version": "0.0.193","author": {"name": "Google Chrome"}diff --git a/.grok-plugin/marketplace.json b/.grok-plugin/marketplace.jsonindex d1045d7..5313d8f 100644--- a/.grok-plugin/marketplace.json+++ b/.grok-plugin/marketplace.json@@ -8,7 +8,7 @@"name": "modern-web-guidance","source": "./","description": "Keep your coding agent up to date with the latest web best practices",- "version": "0.0.192"+ "version": "0.0.193"}]}diff --git a/README.md b/README.mdindex 9b87e47..9d9b7c3 100644--- a/README.md+++ b/README.md@@ -85,7 +85,7 @@ _View an example:_ [the `navigation-drawer` guide](https://github.com/GoogleChro#### The full list<details>-<summary><strong>190 modern web features</strong></summary>+<summary><strong>195 modern web features</strong></summary>### CSS & Layout (108 features)@@ -125,7 +125,7 @@ _View an example:_ [the `navigation-drawer` guide](https://github.com/GoogleChro| [color-mix()](https://web-platform-dx.github.io/web-features-explorer/features/color-mix/) | [Nesting](https://web-platform-dx.github.io/web-features-explorer/features/nesting/) | [user-select](https://web-platform-dx.github.io/web-features-explorer/features/user-select/) || [color-scheme](https://web-platform-dx.github.io/web-features-explorer/features/color-scheme/) | [Oklab and OkLCh](https://web-platform-dx.github.io/web-features-explorer/features/oklab/) | [View transitions](https://web-platform-dx.github.io/web-features-explorer/features/view-transitions/) || [Conic gradients](https://web-platform-dx.github.io/web-features-explorer/features/conic-gradients/) | [overflow-clip-margin](https://web-platform-dx.github.io/web-features-explorer/features/overflow-clip-margin/) | [view-transition-class](https://web-platform-dx.github.io/web-features-explorer/features/view-transition-class/) |-| [Container queries](https://web-platform-dx.github.io/web-features-explorer/features/container-queries/) | [overflow-wrap](https://web-platform-dx.github.io/web-features-explorer/features/overflow-wrap/) | [Viewport units](https://web-platform-dx.github.io/web-features-explorer/features/viewport-units/) |+| [Container queries (size)](https://web-platform-dx.github.io/web-features-explorer/features/container-queries/) | [overflow-wrap](https://web-platform-dx.github.io/web-features-explorer/features/overflow-wrap/) | [Viewport units](https://web-platform-dx.github.io/web-features-explorer/features/viewport-units/) || [Container scroll-state queries](https://web-platform-dx.github.io/web-features-explorer/features/container-scroll-state-queries/) | [overflow: clip](https://web-platform-dx.github.io/web-features-explorer/features/overflow-clip/) | [Web animations](https://web-platform-dx.github.io/web-features-explorer/features/web-animations/) |### HTML & DOM (31 features)@@ -144,7 +144,7 @@ _View an example:_ [the `navigation-drawer` guide](https://github.com/GoogleChro| [<video>](https://web-platform-dx.github.io/web-features-explorer/features/video/) | [HTML streaming setters](https://web-platform-dx.github.io/web-features-explorer/features/html-streaming-setters/) | || [Autonomous custom elements](https://web-platform-dx.github.io/web-features-explorer/features/autonomous-custom-elements/) | [inert](https://web-platform-dx.github.io/web-features-explorer/features/inert/) | |-### JavaScript & APIs (51 features)+### JavaScript & APIs (56 features)| | | || :--- | :--- | :--- |@@ -153,23 +153,25 @@ _View an example:_ [the `navigation-drawer` guide](https://github.com/GoogleChro| [AbortController and AbortSignal](https://web-platform-dx.github.io/web-features-explorer/features/aborting/) | [Keyboard events](https://web-platform-dx.github.io/web-features-explorer/features/keyboard-events/) | [Soft navigation performance entries](https://web-platform-dx.github.io/web-features-explorer/features/soft-navigations/) || [ARIA attribute reflection](https://web-platform-dx.github.io/web-features-explorer/features/aria-attribute-reflection/) | [Language detector](https://web-platform-dx.github.io/web-features-explorer/features/languagedetector/) | [Speculation rules](https://web-platform-dx.github.io/web-features-explorer/features/speculation-rules/) || [autocorrect](https://web-platform-dx.github.io/web-features-explorer/features/autocorrect/) | [LanguageModel](https://web-platform-dx.github.io/web-features-explorer/features/languagemodel/) | [Summarizer](https://web-platform-dx.github.io/web-features-explorer/features/summarizer/) |-| [corner-shape](https://web-platform-dx.github.io/web-features-explorer/features/corner-shape/) | [Lazy-loading images and iframes](https://web-platform-dx.github.io/web-features-explorer/features/loading-lazy/) | [SVG](https://web-platform-dx.github.io/web-features-explorer/features/svg/) |-| [document.modelContext](https://web-platform-dx.github.io/web-features-explorer/features/document-modelcontext/) | [light-dark() image values](https://web-platform-dx.github.io/web-features-explorer/features/light-dark-image/) | [Temporal](https://web-platform-dx.github.io/web-features-explorer/features/temporal/) |-| [enterkeyhint](https://web-platform-dx.github.io/web-features-explorer/features/enterkeyhint/) | [Local network access](https://web-platform-dx.github.io/web-features-explorer/features/local-network-access/) | [text-fit](https://web-platform-dx.github.io/web-features-explorer/features/text-fit/) |-| [Event timing performance entries](https://web-platform-dx.github.io/web-features-explorer/features/event-timing/) | [Long animation frames performance entries](https://web-platform-dx.github.io/web-features-explorer/features/long-animation-frames/) | [Top-level await](https://web-platform-dx.github.io/web-features-explorer/features/top-level-await/) |-| [Federated credential management](https://web-platform-dx.github.io/web-features-explorer/features/fedcm/) | [Navigation API](https://web-platform-dx.github.io/web-features-explorer/features/navigation/) | [Translator](https://web-platform-dx.github.io/web-features-explorer/features/translator/) |-| [Fetch](https://web-platform-dx.github.io/web-features-explorer/features/fetch/) | [Page visibility](https://web-platform-dx.github.io/web-features-explorer/features/page-visibility/) | [Trusted types](https://web-platform-dx.github.io/web-features-explorer/features/trusted-types/) |-| [fetchLater](https://web-platform-dx.github.io/web-features-explorer/features/fetchlater/) | [Page visibility state performance entries](https://web-platform-dx.github.io/web-features-explorer/features/page-visibility-state/) | [User agent client hints](https://web-platform-dx.github.io/web-features-explorer/features/ua-client-hints/) |-| [Form-associated WebMCP attributes](https://web-platform-dx.github.io/web-features-explorer/features/declarative-webmcp/) | [Partitioned cookies](https://web-platform-dx.github.io/web-features-explorer/features/partitioned-cookies/) | [Web app origin migration](https://web-platform-dx.github.io/web-features-explorer/features/app-migration/) |-| [HTML processing instructions](https://web-platform-dx.github.io/web-features-explorer/features/html-processing-instructions/) | [Permissions policy](https://web-platform-dx.github.io/web-features-explorer/features/permissions-policy/) | [Web authentication](https://web-platform-dx.github.io/web-features-explorer/features/webauthn/) |-| [image()](https://web-platform-dx.github.io/web-features-explorer/features/image-function/) | [Registered custom properties](https://web-platform-dx.github.io/web-features-explorer/features/registered-custom-properties/) | [Web authentication signal methods](https://web-platform-dx.github.io/web-features-explorer/features/webauthn-signals/) |-| [inputmode](https://web-platform-dx.github.io/web-features-explorer/features/inputmode/) | [Resize observer](https://web-platform-dx.github.io/web-features-explorer/features/resize-observer/) | [WebAssembly](https://web-platform-dx.github.io/web-features-explorer/features/wasm/) |-| [Interaction contentful paint performance entries](https://web-platform-dx.github.io/web-features-explorer/features/interaction-contentful-paint/) | [Sanitizer API](https://web-platform-dx.github.io/web-features-explorer/features/sanitizer/) | [WebOTP](https://web-platform-dx.github.io/web-features-explorer/features/web-otp/) |+| [Connection allowlists](https://web-platform-dx.github.io/web-features-explorer/features/connection-allowlists/) | [Lazy-loading images and iframes](https://web-platform-dx.github.io/web-features-explorer/features/loading-lazy/) | [SVG](https://web-platform-dx.github.io/web-features-explorer/features/svg/) |+| [corner-shape](https://web-platform-dx.github.io/web-features-explorer/features/corner-shape/) | [light-dark() image values](https://web-platform-dx.github.io/web-features-explorer/features/light-dark-image/) | [Temporal](https://web-platform-dx.github.io/web-features-explorer/features/temporal/) |+| [document.modelContext](https://web-platform-dx.github.io/web-features-explorer/features/document-modelcontext/) | [Local network access](https://web-platform-dx.github.io/web-features-explorer/features/local-network-access/) | [text-fit](https://web-platform-dx.github.io/web-features-explorer/features/text-fit/) |+| [email-verification](https://web-platform-dx.github.io/web-features-explorer/features/tmp-email-verification/) | [Long animation frames performance entries](https://web-platform-dx.github.io/web-features-explorer/features/long-animation-frames/) | [Top-level await](https://web-platform-dx.github.io/web-features-explorer/features/top-level-await/) |+| [enterkeyhint](https://web-platform-dx.github.io/web-features-explorer/features/enterkeyhint/) | [Navigation API](https://web-platform-dx.github.io/web-features-explorer/features/navigation/) | [touch-action](https://web-platform-dx.github.io/web-features-explorer/features/touch-action/) |+| [Event timing performance entries](https://web-platform-dx.github.io/web-features-explorer/features/event-timing/) | [Origin](https://web-platform-dx.github.io/web-features-explorer/features/origin/) | [Translator](https://web-platform-dx.github.io/web-features-explorer/features/translator/) |+| [Federated credential management](https://web-platform-dx.github.io/web-features-explorer/features/fedcm/) | [Page visibility](https://web-platform-dx.github.io/web-features-explorer/features/page-visibility/) | [Trusted types](https://web-platform-dx.github.io/web-features-explorer/features/trusted-types/) |+| [Fetch](https://web-platform-dx.github.io/web-features-explorer/features/fetch/) | [Page visibility state performance entries](https://web-platform-dx.github.io/web-features-explorer/features/page-visibility-state/) | [User agent client hints](https://web-platform-dx.github.io/web-features-explorer/features/ua-client-hints/) |+| [fetchLater](https://web-platform-dx.github.io/web-features-explorer/features/fetchlater/) | [Partitioned cookies](https://web-platform-dx.github.io/web-features-explorer/features/partitioned-cookies/) | [Web app origin migration](https://web-platform-dx.github.io/web-features-explorer/features/app-migration/) |+| [Form-associated WebMCP attributes](https://web-platform-dx.github.io/web-features-explorer/features/declarative-webmcp/) | [Permissions policy](https://web-platform-dx.github.io/web-features-explorer/features/permissions-policy/) | [Web authentication](https://web-platform-dx.github.io/web-features-explorer/features/webauthn/) |+| [HTML processing instructions](https://web-platform-dx.github.io/web-features-explorer/features/html-processing-instructions/) | [Pointer Events](https://web-platform-dx.github.io/web-features-explorer/features/pointer-events-api/) | [Web authentication signal methods](https://web-platform-dx.github.io/web-features-explorer/features/webauthn-signals/) |+| [image()](https://web-platform-dx.github.io/web-features-explorer/features/image-function/) | [Registered custom properties](https://web-platform-dx.github.io/web-features-explorer/features/registered-custom-properties/) | [WebAssembly](https://web-platform-dx.github.io/web-features-explorer/features/wasm/) |+| [inputmode](https://web-platform-dx.github.io/web-features-explorer/features/inputmode/) | [Resize observer](https://web-platform-dx.github.io/web-features-explorer/features/resize-observer/) | [WebOTP](https://web-platform-dx.github.io/web-features-explorer/features/web-otp/) |+| [Interaction contentful paint performance entries](https://web-platform-dx.github.io/web-features-explorer/features/interaction-contentful-paint/) | [Sanitizer API](https://web-platform-dx.github.io/web-features-explorer/features/sanitizer/) | |</details><details>-<summary><strong>166 real-world developer use cases</strong></summary>+<summary><strong>170 real-world developer use cases</strong></summary><h3>accessibility</h3>@@ -290,8 +292,11 @@ _View an example:_ [the `navigation-drawer` guide](https://github.com/GoogleChro- **[passkey-reauthentication](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/security/passkey-reauthentication.md)**: Verify a signed-in user's identity using their existing passkeys before a sensitive action.- **[passkey-registration](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/security/passkey-registration.md)**: Register a passkey for an existing user account.- **[passkeys](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/security/passkeys.md)**: Comprehensive orientation and cross-cutting principles for implementing WebAuthn and Passkeys in web applications. Use this guide when handling passkey registration, authentication, management, or reauthentication.+- **[restrict-outbound-connections](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/security/restrict-outbound-connections.md)**: Restrict a page or worker to communicating only with an explicit allowlist of network endpoints to prevent unauthorized third-party requests and client-side data exfiltration.- **[sanitize-untrusted-html](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/security/sanitize-untrusted-html.md)**: Safely parse and display untrusted HTML content from user input by removing unsafe elements and attributes.- **[trusted-types](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/security/trusted-types.md)**: Help prevent DOM-based XSS attacks by ensuring all untrusted content is sanitized before being inserted into the page.+- **[validate-origins](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/security/validate-origins.md)**: Compare and validate web origins and sites safely across cross-document messages and URLs without error-prone string parsing.+- **[verify-email-ownership](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/security/verify-email-ownership.md)**: Verify that a user owns an email address during account creation, sign-in, or recovery without sending a one-time passcode or magic link email.<h3>ui-atoms</h3>@@ -318,6 +323,7 @@ _View an example:_ [the `navigation-drawer` guide](https://github.com/GoogleChro- **[custom-button-actions](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-behaviors/custom-button-actions.md)**: Declaratively connect a button to any element to trigger custom, application-specific actions using declarative button commands, invoker commands, button commands, custom commands, or declarative toggle actions.- **[declarative-dialog-popover-control](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-behaviors/declarative-dialog-popover-control.md)**: Toggle the visibility of a dialog or popover from a button without writing JavaScript.- **[directional-navigation-transitions](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-behaviors/directional-navigation-transitions.md)**: Animate visual state changes to reflect the direction of a user's navigational flow, such as sliding new content in from the right when advancing forward or from the left when returning to a previous screen.+- **[drag](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-behaviors/drag.md)**: Support dragging to move a floating element around the page.- **[dynamic-sibling-animations](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-behaviors/dynamic-sibling-animations.md)**: Stagger animation or transition timing across sibling elements so each one starts after a computed delay based on its position in the sibling list.- **[group-element-transitions](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-behaviors/group-element-transitions.md)**: Transition a group of similar elements simultaneously using the same transition logic, such as removing a product from a shopping cart and having all the other products animate into their new positions.- **[highlight-text-ranges](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-behaviors/highlight-text-ranges.md)**: Highlight arbitrary text ranges on a page such as search results, spelling errors, or collaborative editing cursors.@@ -344,7 +350,7 @@ _View an example:_ [the `navigation-drawer` guide](https://github.com/GoogleChro<h3>ui-components</h3>- **[dark-mode-toggle](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-components/dark-mode-toggle.md)**: Build a dark mode toggle component that allows users to override their system color scheme preference for the current site.-- **[navigation-drawer](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-components/navigation-drawer.md)**: Create a navigation drawer component that, when triggered from a menu button, slides in from the side overlayed on top of existing page content, and slides out when dismissed (by swiping away, tapping outside, or pressing escape).+- **[navigation-drawer](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-components/navigation-drawer.md)**: Create a navigation drawer component that, when triggered from a menu button, slides in from the side overlaid on top of existing page content, and slides out when dismissed (by swiping away, tapping outside, or pressing escape).- **[persistent-app-tours](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-components/persistent-app-tours.md)**: Create persistent onboarding walkthroughs using tethered native overlays that stay open during user interaction.- **[persistent-toast-notifications](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-components/persistent-toast-notifications.md)**: Create non-intrusive toast and overlay notifications for persistent, stackable messaging and state communication.- **[progress-ring](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-components/progress-ring.md)**: Build a progress ring component that visually represents the completion status of a task or process, with support for content in the center and brand-consistent styling.@@ -372,7 +378,7 @@ _View an example:_ [the `navigation-drawer` guide](https://github.com/GoogleChro- **[soft-edge-content-fade](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/visual-design/soft-edge-content-fade.md)**: Apply a transparency gradient to content edges to indicate further scrollable areas or to obscure payment-walled text.- **[typography](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/visual-design/typography.md)**: Typography best practices for the web, including font sizing units, line height, text wrapping and balancing, and fluid type that scales with the viewport.- **[visual-effects](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/visual-design/visual-effects.md)**: Visual effects with CSS such as layered shadows, blend modes, gradients with predictable color interpolation, and patterns like stripes, checkerboards, dots, and pie charts built from gradients alone.-- **[visually-stable-font-fallbacks](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/visual-design/visually-stable-font-fallbacks.md)**: Define font styles such that text remains readable and visually consistent in the event that there's a swap between the perferred font and one of the fallbacks (or vise versa).+- **[visually-stable-font-fallbacks](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/visual-design/visually-stable-font-fallbacks.md)**: Define font styles such that text remains readable and visually consistent in the event that there's a swap between the preferred font and one of the fallbacks (or vice versa).- **[visually-stable-mixed-fonts](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/visual-design/visually-stable-mixed-fonts.md)**: Define font styles such that text remains readable and visually consistent in situations where multiple fonts are used to render a single block of text.- **[visually-texture-content](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/visual-design/visually-texture-content.md)**: Apply realistic weathering and texture patterns to elements to give them an organic, aged, or physical material appearance.diff --git a/gemini-extension.json b/gemini-extension.jsonindex d607fb9..5ef3173 100644--- a/gemini-extension.json+++ b/gemini-extension.json@@ -1,7 +1,7 @@{"name": "modern-web-guidance","description": "Keep your coding agent up to date with the latest web best practices",- "version": "0.0.192",+ "version": "0.0.193","author": {"name": "Google Chrome"}diff --git a/kimi.plugin.json b/kimi.plugin.jsonindex 75eb59d..4a8cc01 100644--- a/kimi.plugin.json+++ b/kimi.plugin.json@@ -1,7 +1,7 @@{"name": "modern-web-guidance","description": "Modern Web Guidance is an agent skill and CLI tool designed to help AI coding agents build web applications using modern, secure, and high-performance APIs rather than outdated workarounds. Supported by the Google Chrome team, it injects expert-curated web platform best practices directly into an agent's context window to prevent the generation of bloated, legacy code.",- "version": "0.0.192",+ "version": "0.0.193","author": {"name": "Google Chrome"},diff --git a/package.json b/package.jsonindex 07a32d5..a3e8224 100644--- a/package.json+++ b/package.json@@ -3,7 +3,7 @@"displayName": "Modern Web Guidance","description": "Keep your agent up to date on the latest web best practices.","license": "Apache-2.0",- "version": "0.0.192",+ "version": "0.0.193","publisher": "GoogleChrome","repository": {"url": "https://github.com/GoogleChrome/modern-web-guidance-src"diff --git a/skills/modern-web-guidance/guides/css/css-layout.md b/skills/modern-web-guidance/guides/css/css-layout.mdindex 66dfc03..23533ef 100644--- a/skills/modern-web-guidance/guides/css/css-layout.md+++ b/skills/modern-web-guidance/guides/css/css-layout.md@@ -161,7 +161,7 @@ footer { grid-area: footer; }## 4 Container queries-Baseline status for Container queries: Widely available. It's been Baseline since 2023-02-14.+Baseline status for Container queries (size): Widely available. It's been Baseline since 2023-02-14.Supported by: Chrome 105 (Sep 2022), Edge 105 (Sep 2022), Firefox 110 (Feb 2023), and Safari 16 (Sep 2022).Query the size (or computed style) of an ancestor container rather than the viewport. Mental model: container queries = component context; media queries = global page layout and user preferences (`prefers-color-scheme`, `prefers-reduced-motion`).diff --git a/skills/modern-web-guidance/guides/css/fluid-scaling.md b/skills/modern-web-guidance/guides/css/fluid-scaling.mdindex 1985bec..8b91d5c 100644--- a/skills/modern-web-guidance/guides/css/fluid-scaling.md+++ b/skills/modern-web-guidance/guides/css/fluid-scaling.md@@ -58,7 +58,7 @@ To prevent sizes from becoming too small or too large, use the CSS `clamp()` fun### Fallback strategies-Baseline status for Container queries: Widely available. It's been Baseline since 2023-02-14.+Baseline status for Container queries (size): Widely available. It's been Baseline since 2023-02-14.Supported by: Chrome 105 (Sep 2022), Edge 105 (Sep 2022), Firefox 110 (Feb 2023), and Safari 16 (Sep 2022).If container queries are not supported by the browser, you should provide a fallback using viewport units or standard media queries.diff --git a/skills/modern-web-guidance/guides/css/size-aware-styling.md b/skills/modern-web-guidance/guides/css/size-aware-styling.mdindex dccb552..5085d55 100644--- a/skills/modern-web-guidance/guides/css/size-aware-styling.md+++ b/skills/modern-web-guidance/guides/css/size-aware-styling.md@@ -67,7 +67,7 @@ You can also use container queries to hide or show extra details when there is m### Fallback strategies-Baseline status for Container queries: Widely available. It's been Baseline since 2023-02-14.+Baseline status for Container queries (size): Widely available. It's been Baseline since 2023-02-14.Supported by: Chrome 105 (Sep 2022), Edge 105 (Sep 2022), Firefox 110 (Feb 2023), and Safari 16 (Sep 2022).For browsers that do not support container queries, the best approach is to use a safe default layout (like the stacked vertical layout) and progressively enhance it using media queries if the general screen size allows it.diff --git a/skills/modern-web-guidance/guides/html/styling-web-components.md b/skills/modern-web-guidance/guides/html/styling-web-components.mdindex ac65717..d90ac30 100644--- a/skills/modern-web-guidance/guides/html/styling-web-components.md+++ b/skills/modern-web-guidance/guides/html/styling-web-components.md@@ -117,7 +117,7 @@ Supported by: Chrome 73 (Mar 2019), Edge 79 (Jan 2020), Firefox 72 (Jan 2020), SBaseline status for Cascade layers: Widely available. It's been Baseline since 2022-03-14.Supported by: Chrome 99 (Mar 2022), Edge 99 (Mar 2022), Firefox 97 (Feb 2022), and Safari 15.4 (Mar 2022).-Baseline status for Container queries: Widely available. It's been Baseline since 2023-02-14.+Baseline status for Container queries (size): Widely available. It's been Baseline since 2023-02-14.Supported by: Chrome 105 (Sep 2022), Edge 105 (Sep 2022), Firefox 110 (Feb 2023), and Safari 16 (Sep 2022).Browser support for :host-context(): Limited availability.diff --git a/skills/modern-web-guidance/guides/security/restrict-outbound-connections.md b/skills/modern-web-guidance/guides/security/restrict-outbound-connections.mdnew file mode 100644index 0000000..590dd45--- /dev/null+++ b/skills/modern-web-guidance/guides/security/restrict-outbound-connections.md@@ -0,0 +1,169 @@+# Restrict outbound network connections with Connection Allowlists++The `Connection-Allowlist` HTTP response header restricts a document or worker to communicating only with an explicit list of network endpoints. Unlike Content Security Policy (CSP)—which requires maintaining separate per-resource directives (`connect-src`, `img-src`, `script-src`, `font-src`, `form-action`) and does not govern speculative or non-Fetch network channels such as `<link rel="dns-prefetch">`, `<link rel="preconnect">`, or WebRTC—`Connection-Allowlist` enforces a single, network-layer allowlist across **all** outbound connections initiated by the context (`fetch()`, `XMLHttpRequest`, subresources, `navigator.sendBeacon()`, `<a ping>`, top-level and frame navigations, resource hints, Speculation Rules, `WebSocket`, `WebTransport`, and WebRTC).++## How to implement++1. **Serialize the allowlist as an RFC 9651 Inner List `(...)`**: Format `Connection-Allowlist` (or `Connection-Allowlist-Report-Only`) as a single parenthesized list of space-separated items. Include the unquoted token `response-origin` to permit the document or worker's own origin, followed by double-quoted `URLPattern` strings for every legitimate external endpoint the context connects or navigates to (APIs, image/font CDNs, and outbound `<a href>`, `<form action>`, OAuth, or payment redirect targets). When building patterns dynamically from configuration or `URL` objects, normalize `ws:`/`wss:` to `http:`/`https:` and strip bare trailing slashes on origin-only URLs (because `new URL('https://api.example.com').href` appends `/`, which restricts `URLPattern` matching to the root path `/` only).+2. **Scope middleware by `Sec-Fetch-Dest` and cover workers**: Browsers only honor `Connection-Allowlist` on document/navigation responses and worker script responses (`Sec-Fetch-Dest` values `document`, `iframe`, `worker`, `sharedworker`, and `serviceworker`). When varying headers by `Sec-Fetch-Dest`, include `Vary: Sec-Fetch-Dest` so shared caches do not serve headerless responses. Serve a matching allowlist on Dedicated and Shared Worker scripts so compromised page scripts cannot exfiltrate data via `worker.postMessage()`. Because a Service Worker performs its own network fetches on cache misses and navigation preloads, configure its `Connection-Allowlist` as a **superset** of the allowlists of all documents it controls.+3. **Configure violation reporting and staged or dual rollout**: Define a `Reporting-Endpoints` header and append an unquoted `; report-to=<endpoint-name>` parameter after the closing `)`. You can send `Connection-Allowlist-Report-Only` alone during initial rollout, or send **both** `Connection-Allowlist` (enforcing a baseline allowlist) and `Connection-Allowlist-Report-Only` (auditing a stricter candidate allowlist) on the same response. Violation reports are delivered with `"type": "connection-allowlist"` and body `{ url, connection, allowlist, disposition }` (where `connection` is the blocked destination URL or `"webrtc"`, and `disposition` is `"enforce"` or `"report"`).+4. **Account for default redirect and WebRTC blocking, and handle client errors**: By default, `Connection-Allowlist` blocks all `3xx` HTTP redirects (`redirects=block`, even when redirecting between allowlisted or same-origin URLs) and all `RTCPeerConnection` traffic (`webrtc=block`). Append `; redirects=allow` only when trusted endpoints require server-side redirects (the initial request must still match the allowlist), or `; webrtc=allow` when WebRTC is required. On the client, wrap outbound `fetch()` calls in `try...catch` and handle `WebSocket` `error` events so requests rejected with `TypeError` (`net::ERR_NETWORK_ACCESS_REVOKED`) return a handled error state and update UI status instead of causing unhandled rejections.++## Example code++```http+Vary: Sec-Fetch-Dest+Reporting-Endpoints: conn-reports="https://app.example.com/api/security-reports"+Connection-Allowlist: (response-origin "https://api.example.com" "https://realtime.example.com" "https://*.cdn.example.com/*"); report-to=conn-reports+Connection-Allowlist-Report-Only: (response-origin "https://api.example.com/v2/*"); report-to=conn-reports+```++```javascript+const ALLOWLIST_DESTS = new Set(['document', 'iframe', 'worker', 'sharedworker', 'serviceworker']);++// Normalize a config URL or URLPattern string for Connection-Allowlist:+// - Rewrites ws:// and wss:// to http:// and https:// (WebSocket matching rule).+// - Strips a bare trailing slash on origin-only URLs (e.g. from new URL(...).href)+// so all subpaths on the origin are permitted instead of only "/".+export function normalizeAllowlistPattern(rawPattern) {+ const trimmed = String(rawPattern).trim().replace(/^ws(s?):\/\//i, 'http$1://');+ if (!/^https?:\/\//i.test(trimmed)) {+ throw new Error(`Pattern must include an http:// or https:// scheme: ${rawPattern}`);+ }+ if (/[\s,]/.test(trimmed)) {+ throw new Error(`Pattern must be a single URLPattern without spaces or commas: ${rawPattern}`);+ }+ if (/[()]/.test(trimmed)) {+ throw new Error(`Custom regex groups are rejected by Connection-Allowlist: ${rawPattern}`);+ }+ return trimmed.replace(/^(https?:\/\/[^/?#]+)\/$/i, '$1');+}++// Build an RFC 9651 Inner List value for Connection-Allowlist or Connection-Allowlist-Report-Only.+export function buildConnectionAllowlistHeader({+ allowSelf = true,+ patterns = [],+ reportTo,+ redirects = 'block',+ webrtc = 'block',+} = {}) {+ const items = allowSelf ? ['response-origin'] : [];+ for (const pattern of patterns) {+ const raw = String(pattern).trim();+ if (raw === 'response-origin') {+ if (!items.includes('response-origin')) items.push('response-origin');+ continue;+ }+ const normalized = normalizeAllowlistPattern(raw);+ items.push(`"${normalized.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`);+ }+ let header = `(${items.join(' ')})`;+ if (redirects === 'allow') header += '; redirects=allow';+ if (webrtc === 'allow') header += '; webrtc=allow';+ if (reportTo) {+ const endpointToken = String(reportTo).trim().replace(/^"+|"+$/g, '');+ header += `; report-to=${endpointToken}`;+ }+ return header;+}++// Server or middleware helper applying Connection-Allowlist and Reporting-Endpoints+// on document and worker responses.+export function setConnectionAllowlistHeaders(res, options = {}) {+ const {+ secFetchDest = 'document',+ patterns = ['https://api.example.com', 'https://realtime.example.com', 'https://*.cdn.example.com/*'],+ reportOnlyPatterns,+ reportEndpointName = 'conn-reports',+ reportEndpointUrl = 'https://app.example.com/api/security-reports',+ redirects = 'block',+ webrtc = 'block',+ reportOnly = false,+ } = options;++ const setHeader = (name, value) =>+ typeof res.setHeader === 'function' ? res.setHeader(name, value) : res.headers.set(name, value);++ if (typeof res.appendHeader === 'function') {+ res.appendHeader('Vary', 'Sec-Fetch-Dest');+ } else if (typeof res.headers?.append === 'function') {+ res.headers.append('Vary', 'Sec-Fetch-Dest');+ } else {+ setHeader('Vary', 'Sec-Fetch-Dest');+ }+ if (secFetchDest && !ALLOWLIST_DESTS.has(String(secFetchDest).toLowerCase())) return;++ setHeader('Reporting-Endpoints', `${reportEndpointName}="${reportEndpointUrl}"`);+ setHeader(+ reportOnly ? 'Connection-Allowlist-Report-Only' : 'Connection-Allowlist',+ buildConnectionAllowlistHeader({ allowSelf: true, patterns, reportTo: reportEndpointName, redirects, webrtc }),+ );++ if (!reportOnly && Array.isArray(reportOnlyPatterns)) {+ setHeader(+ 'Connection-Allowlist-Report-Only',+ buildConnectionAllowlistHeader({+ allowSelf: true,+ patterns: reportOnlyPatterns,+ reportTo: reportEndpointName,+ redirects,+ webrtc,+ }),+ );+ }+}++// Client-side helper that catches blocked outbound requests gracefully without unhandled rejections.+export async function fetchWithPolicyHandling(url, { statusElement, ...fetchOptions } = {}) {+ try {+ const response = await fetch(url, fetchOptions);+ if (!response.ok) throw new Error(`HTTP ${response.status}`);+ const body = await response.text();+ if (statusElement) {+ statusElement.textContent = `Allowed: Loaded ${url} (${body.length} bytes).`;+ }+ return { ok: true, body, error: null };+ } catch (error) {+ const message = error instanceof Error ? error.message : String(error);+ if (statusElement) {+ statusElement.textContent = `Blocked: Request to ${url} was rejected by the outbound connection policy (${message}).`;+ }+ return { ok: false, body: null, error };+ }+}+```++## Best practices++- **DO** format `Connection-Allowlist` as a single RFC 9651 Inner List `(...)` of space-separated items. If a non-empty `Connection-Allowlist` header fails top-level Structured Field parsing (for example, omitting `(...)` or using single quotes `'...'`), the browser fails closed with an empty allowlist and blocks **all** outbound network connections. Use `Connection-Allowlist: ()` when you intentionally want to revoke all network access after load (local schemes `data:`, `blob:`, `about:`, and `filesystem:` remain permitted).+- **DO** omit the trailing slash on origin-wide URL patterns (`"https://api.example.com"`) or use an explicit wildcard (`"https://api.example.com/*"`) so subpaths like `/v1/users` are permitted. Strip trailing slashes added by `new URL(origin).href` before serializing patterns.+- **DO** allowlist `WebSocket` (`ws://` and `wss://`) endpoints using `"http://..."` and `"https://..."` patterns in `Connection-Allowlist`, because the browser normalizes WebSocket schemes to HTTP/HTTPS before matching.+- **DO** include expected external navigation targets (`<a href>`, `<form action>`, OAuth/SSO providers, payment checkouts) in a restricted document's allowlist, and remember that the default `redirects=block` blocks even same-origin `3xx` redirects unless `; redirects=allow` is specified.+- **DO NOT** wrap `response-origin` or inner-list parameter values (`; report-to=conn-reports`, `; redirects=allow`, `; webrtc=allow`) in quotes, or separate items inside `(...)` with commas.+- **DO NOT** use custom regular expression groups such as `(\d+)` or relative paths such as `"/api/*"` inside URL patterns; the browser's network-service parser rejects regex groups and patterns without a scheme and hostname.+- **DO NOT** rely on the experimental `<iframe connectionAllowlist="...">` attribute or `Allow-Connection-Allowlist-From` embedded enforcement header in production yet, as embedded enforcement is not enabled by default in shipping browsers.++## Fallback strategy++Browser support for Connection allowlists: Limited availability.+Supported by: Chrome 152 and Edge 152.+Unsupported in: Firefox and Safari.++Because `Connection-Allowlist` is enforced at the browser network layer via an HTTP response header, it cannot be polyfilled in client-side JavaScript. If your Baseline target includes browsers that do not yet support `Connection-Allowlist`, **pair `Connection-Allowlist` with a `Content-Security-Policy` (CSP) header** (and a `<meta http-equiv="Content-Security-Policy">` element for document-level fetch and subresource restrictions when HTTP response headers cannot be configured):++- **Additive defense-in-depth**: Supporting browsers enforce both policies simultaneously—`Connection-Allowlist` blocks non-CSP exfiltration channels (`dns-prefetch`, `preconnect`, WebRTC, and redirects), while CSP restricts `fetch()`, subresources, and `<form action>` navigations in browsers without `Connection-Allowlist`.+- **Cover `form-action` and `worker-src` explicitly**: In CSP, `default-src` does **not** fall back for `<form action>` submissions; always include `form-action` explicitly. Include `worker-src 'self'` (excluding `blob:`) so restricted pages cannot spawn `blob:` SharedWorkers to bypass document-level restrictions.+- **Map allowed origins to per-resource CSP directives**: Unlike `Connection-Allowlist` (which uses a single endpoint list and does not govern inline markup), `default-src 'self'` in CSP restricts each resource type (`connect-src`, `img-src`, `style-src`, `font-src`, `script-src`) and blocks inline `<style>` and `<script>` blocks unless authorized via hashes or nonces.+- **Include `wss://` in CSP `connect-src`**: While `Connection-Allowlist` matches `wss://` connections against `"https://..."` patterns, CSP `connect-src` in cross-browser environments should explicitly list `wss://` origins when WebSockets are used.++```http+Content-Security-Policy: default-src 'self'; connect-src 'self' https://api.example.com https://realtime.example.com wss://realtime.example.com; img-src 'self' https://*.cdn.example.com data: blob:; form-action 'self'; worker-src 'self'; object-src 'none'; base-uri 'self'; report-to conn-reports+```++```html+<!-- Document-level fallback when HTTP response headers cannot be set on static hosting -->+<meta+ http-equiv="Content-Security-Policy"+ content="default-src 'self'; connect-src 'self' https://api.example.com https://realtime.example.com wss://realtime.example.com; img-src 'self' https://*.cdn.example.com data: blob:; form-action 'self'; worker-src 'self'; object-src 'none'; base-uri 'self'"+/>+```diff --git a/skills/modern-web-guidance/guides/security/security.md b/skills/modern-web-guidance/guides/security/security.mdindex 7af0fdf..c1c5973 100644--- a/skills/modern-web-guidance/guides/security/security.md+++ b/skills/modern-web-guidance/guides/security/security.md@@ -19,9 +19,9 @@ Guidelines for implementing preventative security measures on the web safely and- 2.3 Data Hygiene for Reports- 2.4 Automated Discovery via Browser APIs and DevTools- Phase 3: Interpreting Results & Enforcement- - Core enforcement (data-driven rollouts)+ - Core enforcement- 3.1 Analyzing CSP Reports- - 3.2 Transitioning to CSP Enforcement+ - 3.2 Enforcing Content Security Policy (CSP)- 3.3 Trusted Types Enforcement- 3.4 Cross-Origin Opener Policy (COOP)- 3.5 Cross-Origin Resource Policy (CORP)@@ -38,15 +38,13 @@ Guidelines for implementing preventative security measures on the web safely and## When to apply this skill-The right starting point depends on the application:+The right starting point depends on the application and whether you can update the codebase directly:-- **Retrofitting an existing app**: Always start at Phase 1. Strict policies applied without discovery will break the app. Treat Phase 2 (report-only) as a prerequisite for any Phase 3 enforcement.-- **Greenfield app or new feature**: You can adopt Phase 3 enforced policies directly, but still wire up reporting from day one.-- **SaaS template / framework defaults**: Ship Phase 1 hygiene and Phase 3 policies enabled by default, with Phase 2 reporting on so downstream users can detect regressions.+- **Auditing and hardening a codebase directly**: Apply Phase 1 code hygiene, wire up Phase 2 reporting (`Reporting-Endpoints` and `report-to`), and enforce Phase 3 headers (`Content-Security-Policy` with nonces/hashes, `'strict-dynamic'`, `'report-sample'`, `object-src 'none'`, `base-uri 'none'`, `frame-ancestors 'self'`, and `require-trusted-types-for 'script'`, plus COOP, CORP, Fetch Metadata, HSTS, `X-Content-Type-Options`, `Referrer-Policy`, and `Permissions-Policy`) directly by updating `<script>` tags, cookies, and server middleware in the same pass.+- **Staged rollout on a large production site with unknown third-party dependencies**: Start with Phase 1 quick wins and deploy Phase 2 report-only headers alongside enforced companion policies while collecting violation telemetry, then promote the report-only policies to Phase 3 enforcement.+- **Greenfield app or SaaS template / framework defaults**: Ship Phase 1 hygiene and Phase 3 enforced policies by default, with Phase 2 reporting configured so regressions are captured immediately.-If you are unsure which case applies, default to Phase 1 → 2 → 3 in order.--**Focusing on Leverage**: While Phase 1 and 2 establish baseline hygiene and data gathering, Phase 3 core enforcement represents the highest-leverage security work. Specifically, Injection/XSS mitigation through CSP (§3.2) and Trusted Types (§3.3) addresses the largest practical threat, while companion policies and isolation defenses provide important defense-in-depth.+**Focusing on Leverage**: While Phase 1 and 2 establish baseline hygiene and violation visibility, Phase 3 core enforcement represents the highest-leverage security work. Specifically, Injection/XSS mitigation through enforced CSP (§3.2) and Trusted Types (§3.3) addresses the largest practical threat, while companion policies and isolation defenses provide important defense-in-depth.## Phase 1: Quick Wins & Obvious Anti-Patterns@@ -59,7 +57,7 @@ Before attempting to deploy global security policies, focus on code-level hygien### 1.2 Avoid Dangerous DOM Sinks- **DO**: Prefer `textContent` or `innerText` over `innerHTML` when setting text content.-- **DO**: Use `setHTML` (part of the Sanitizer API) when available to safely insert HTML.+- **DO**: Use `setHTML()` (part of the Sanitizer API; see `sanitize-untrusted-html` (via `npx -y modern-web-guidance@latest retrieve "sanitize-untrusted-html"`)) when available to safely insert untrusted HTML without going through `innerHTML`.- **DO NOT**: Use `innerHTML` or `setHTMLUnsafe` with untrusted or unsanitized input.- **DO**: Use DOMParser or create elements programmatically (`document.createElement`) instead of concatenating HTML strings.@@ -77,10 +75,10 @@ element.textContent = `Hello, ${untrustedName}!`;Trusted Types can enforce this pattern at runtime by blocking string assignments to dangerous sinks. Deploying it is a CSP enforcement step with real breakage risk — see §3.3.### 1.3 Secure Cookies-Ensure new cookies are configured securely by default.-- **DO**: Prefer naming cookies with the `__Host-` prefix when they'll only be used by one domain. This requires the `Secure` and `Path=/` attributes to be set, and the `Domain` attribute to be omitted. This protects against same-site and network attackers.+Ensure session and application cookies are configured securely by default, whether set via `Set-Cookie` headers or framework session configuration (such as Astro or Express session middleware).+- **DO**: Name first-party session cookies with the `__Host-` prefix (`name: '__Host-session'`) when used by a single domain. This requires `Secure` (`secure: true`), `Path=/` (`path: '/'`), and omitting the `Domain` attribute, protecting against same-site and network attackers.- **DO**: Prefer naming cookies with the `__Secure-` prefix when `__Host-` isn't appropriate. This requires the `Secure` attribute, and protects against network attackers.-- **DO**: Explicitly set `SameSite=Lax` for standard first-party cookies.+- **DO**: Set `HttpOnly` (`httpOnly: true`) on session and authentication cookies unless the cookie must be read by client-side script, and explicitly set `SameSite=Lax` (`sameSite: 'lax'`) for standard first-party cookies.- **DO**: If your application will be embedded as an iframe in third-party contexts, use `SameSite=None; Secure; Partitioned`.- **DO NOT**: Rely on unpartitioned `SameSite=None` — these are being systematically blocked for tracking prevention.@@ -101,7 +99,7 @@ Content-Security-Policy: frame-ancestors 'self' https://trusted-partner.com;### 1.5 Secure Window Messaging (postMessage)If your application communicates with other origins using `window.postMessage`, you must strictly validate the sender and receiver.-- **DO**: Always validate the `event.origin` of incoming messages on the receiver side using strict equality against a list of trusted origins. Do **not** trust wildcards (`*`) or unverified payloads.+- **DO**: Always validate the `event.origin` of incoming messages on the receiver side using strict equality against a list of trusted origins (or use the `Origin` API when comparing against URLs/elements, checking schemeful same-site relationships, or distinguishing opaque sandboxed iframe origins; see `validate-origins` (via `npx -y modern-web-guidance@latest retrieve "validate-origins"`)). Do **not** trust wildcards (`*`), substring checks, or unverified payloads.- **DO**: Always specify a target origin (rather than the wildcard `*`) when calling `postMessage` to send sensitive data, ensuring only the intended origin can receive it.- **DO**: Validate and sanitize the properties of incoming message payloads before performing operations or writing them to DOM sinks. Manual JSON serialization is unnecessary as `postMessage` handles object cloning internally.@@ -147,7 +145,7 @@ Use "Report-Only" headers to identify potential breakages before they happen.**Example headers:**```httpReporting-Endpoints: default="https://reports.example/default", main-endpoint="https://reports.example/main"-Content-Security-Policy-Report-Only: script-src 'nonce-{RANDOM}' 'strict-dynamic' 'report-sample'; object-src 'none'; base-uri 'none'; report-to main-endpoint;+Content-Security-Policy-Report-Only: script-src 'nonce-{RANDOM}' 'strict-dynamic' 'report-sample'; object-src 'none'; base-uri 'none'; frame-ancestors 'self'; require-trusted-types-for 'script'; report-to main-endpoint;```The `'strict-dynamic'`, `https:`, and `'unsafe-inline'` tokens together form a backwards-compatibility ladder: modern browsers honor `'strict-dynamic'` (nonce-propagating) and ignore the others; older browsers fall back to `https:`; very old browsers fall back to `'unsafe-inline'`. The fallbacks are harmless on any browser that supports a stricter token.@@ -166,12 +164,12 @@ The `'strict-dynamic'`, `https:`, and `'unsafe-inline'` tokens together form a b## Phase 3: Interpreting Results & Enforcement-After collecting data, decide how to proceed with enforcement. Phase 3 has two tracks that run in parallel, not in sequence:+After inspecting the application (or collecting report-only data), enforce your security policies. Phase 3 has two tracks that are enforced together:-- **Core enforcement (data-driven rollouts)** — high-breakage-risk policies that depend on Phase 2 report-only data. These are the rollouts you stage and watch.-- **Companion policies (deploy in parallel)** — lower-risk headers that can be turned on alongside or before the core work, with little or no Phase 2 discovery required.+- **Core enforcement** — high-leverage XSS and isolation defenses (`Content-Security-Policy`, Trusted Types, COOP, CORP, and Fetch Metadata).+- **Companion policies (deploy in parallel)** — low-risk headers (`Strict-Transport-Security`, `X-Content-Type-Options`, `Referrer-Policy`, `Permissions-Policy`, `Clear-Site-Data`) that should always be enabled alongside core enforcement.-### Core enforcement (data-driven rollouts)+### Core enforcement#### 3.1 Analyzing CSP Reports@@ -191,22 +189,22 @@ Once filtered and triaged, analyze the reports against the following common scen- **Condition**: Legacy code paths still write strings to `innerHTML` etc.- **Decision**: Refactor those sinks (per §1.2) or route them through a Trusted Types policy (§3.3) before enforcing.-#### 3.2 Transitioning to CSP Enforcement-Only move to enforced mode when:-1. Violations in the report-only logs have dropped to near zero or are accounted for.-2. Reporting remains wired up after the switch — keep `report-to` on the enforced header so regressions are visible.+#### 3.2 Enforcing Content Security Policy (CSP)+When enforcing `Content-Security-Policy`, always keep `Reporting-Endpoints` and `report-to` wired up on the enforced header so any regressions remain visible.-**Key directives to set:**-- `script-src` with nonces or hashes — this is the core directive of any CSP and the primary mechanism to prevent XSS.-- `base-uri 'none'` to block `<base>` hijacking. Legacy directives like `object-src 'none'` can be omitted in modern, post-Flash web environments.-- *Optional but potentially breaking*: `default-src 'self'` is sometimes used as a fallback for unspecified fetch directives, but it dramatically complicates deployment and has little security value beyond `script-src`. It is generally safer to focus on robust `script-src` enforcement first.+**Mandatory directives to set:**+- `script-src 'nonce-{RANDOM}' 'strict-dynamic' 'report-sample'` (or SHA-256/384/512 script hashes for static HTML) — the core directive of any CSP and the primary mechanism to prevent XSS.+- `object-src 'none'` — blocks plugin-based code execution (`<object>`, `<embed>`).+- `base-uri 'none'` — blocks `<base>` tag hijacking of relative URLs.+- `frame-ancestors 'self'` — prevents clickjacking alongside `X-Frame-Options: SAMEORIGIN` (§1.4).+- `require-trusted-types-for 'script'` — enforces Trusted Types runtime checks on DOM XSS sinks (§3.3).+- `report-to <endpoint>` — sends violation reports to the endpoint defined in `Reporting-Endpoints`.- *Optional*: `form-action 'self'` prevents form submissions to attacker-controlled origins.-- *Optional*: `upgrade-insecure-requests` auto-upgrades subresource HTTP loads to HTTPS, though modern browsers largely auto-upgrade mixed content anyway.**Enforced Header Example (CSP with reporting):**```httpReporting-Endpoints: main-endpoint="https://reports.example/main"-Content-Security-Policy: script-src 'nonce-{RANDOM}' 'strict-dynamic' 'report-sample'; object-src 'none'; base-uri 'none'; report-to main-endpoint;+Content-Security-Policy: script-src 'nonce-{RANDOM}' 'strict-dynamic' 'report-sample'; object-src 'none'; base-uri 'none'; frame-ancestors 'self'; require-trusted-types-for 'script'; report-to main-endpoint;```HTML for nonce-based CSP:@@ -214,18 +212,54 @@ HTML for nonce-based CSP:<script nonce="{RANDOM}" src="https://example.com/script.js"></script>```-For static/cached HTML (SPAs) where a per-response nonce is not possible, use hash-based CSP: hash each inline script and list the hashes in `script-src`.+**Server / Middleware Per-Request Nonce Generation:**+In server-rendered or SSR middleware (such as Node.js, Express, or Astro middleware), generate a fresh cryptographic nonce on every request, attach it to `Content-Security-Policy`, and stamp `nonce` onto `<script>` tags in HTML responses:++```javascript+const bytes = new Uint8Array(16);+crypto.getRandomValues(bytes);+const nonce = btoa(String.fromCharCode(...bytes));++const csp = [+ `script-src 'nonce-${nonce}' 'strict-dynamic' 'report-sample'`,+ "object-src 'none'",+ "base-uri 'none'",+ "frame-ancestors 'self'",+ "require-trusted-types-for 'script'",+ 'report-to main-endpoint',+].join('; ');++headers.set('Reporting-Endpoints', 'main-endpoint="https://reports.example/main"');+headers.set('Content-Security-Policy', csp);++// If transforming rendered HTML in middleware, inject the per-request nonce onto <script> tags:+html = html.replace(/<script\b(?![^>]*\bnonce=)/gi, `<script nonce="${nonce}"`);+```++For static/cached HTML (SPAs) where a per-response nonce is not possible, use hash-based CSP: compute the `sha256-` hash of each script and list the hashes in `script-src` alongside `'strict-dynamic' 'report-sample'`.-**Avoid**: URL allowlists like `script-src https://cdn.example.com` — they are easily bypassed by open redirects, JSONP endpoints, and dependency injection on the allowed origin.+**Avoid**: Broad scheme or domain allowlists (such as `https:` alone or `script-src https://cdn.example.com` without `'strict-dynamic'`) as the primary `script-src` protection — they are easily bypassed by open redirects, JSONP endpoints, and dependency injection on the allowed origin.#### 3.3 Trusted Types Enforcement-Trusted Types enforces source-level guidance at runtime by blocking string assignments to dangerous sinks unless they pass through a named policy.+Trusted Types enforces source-level guidance at runtime by blocking raw string assignments to dangerous DOM XSS sinks (`innerHTML`, `outerHTML`, `document.write`, `script.src`, `script.textContent`) unless they pass through a named policy.-Because deployment involves site-wide enforcement and framework compatibility checks, it should be treated as a major security initiative.+- **DO**: Enforce Trusted Types in your `Content-Security-Policy` header by including the `require-trusted-types-for 'script'` directive.+- **DO**: Sanitize any HTML sink assignments through a named `trustedTypes.createPolicy(...)` instance rather than assigning raw strings (or prefer `element.setHTML()` directly, which sanitizes HTML without needing a Trusted Types policy).+- **DO NOT**: Create a pass-through policy (such as `createHTML: (s) => s`) that returns unsanitized input unchanged, as this neutralizes Trusted Types protection.+- **DO**: Consult the dedicated `trusted-types` (via `npx -y modern-web-guidance@latest retrieve "trusted-types"`) guide for full implementation details, including `trusted-types` policy allowlisting and rollout strategies.-- **DO**: Consult the dedicated `trusted-types` (via `npx -y modern-web-guidance@latest retrieve "trusted-types"`) guide for full implementation details, including policy creation and rollout strategies.-- **Prerequisite**: Audit framework and third-party widget support before starting. If dependencies write to DOM sinks without producing Trusted Types, enforcement will break that code.-- **Incremental Rollout**: Always start with `Content-Security-Policy-Report-Only` to identify all offending sinks before moving to full enforcement.+```javascript+const htmlPolicy = window.trustedTypes?.createPolicy('app-html', {+ createHTML(input) {+ return String(input)+ .replace(/&/g, '&')+ .replace(/</g, '<')+ .replace(/>/g, '>')+ .replace(/"/g, '"')+ .replace(/'/g, ''');+ },+});+```#### 3.4 Cross-Origin Opener Policy (COOP)@@ -266,6 +300,8 @@ Server-side enforcement that uses `Sec-Fetch-*` request headers to reject suspic```javascriptapp.use((req, res, next) => {+ res.setHeader('Vary', 'Sec-Fetch-Dest, Sec-Fetch-Mode, Sec-Fetch-Site');+const site = req.get('Sec-Fetch-Site');const mode = req.get('Sec-Fetch-Mode');const dest = req.get('Sec-Fetch-Dest');diff --git a/skills/modern-web-guidance/guides/security/validate-origins.md b/skills/modern-web-guidance/guides/security/validate-origins.mdnew file mode 100644index 0000000..174f5f4--- /dev/null+++ b/skills/modern-web-guidance/guides/security/validate-origins.md@@ -0,0 +1,197 @@+# Compare and validate web origins and sites++While comparing `event.origin` against a fixed, port-normalized string literal (such as `event.origin === 'https://trusted.example.com'`) works for simple allowlists, manual string comparisons and regular expressions break down when validating arbitrary URLs, DOM link elements, cross-subdomain redirects, or sandboxed messages:++- **Prefix and substring spoofing:** Checking `url.startsWith('https://trusted.example.com')` is bypassed by `'https://trusted.example.com.attacker.example'`.+- **Unnormalized URLs:** Full URLs with paths, query strings, or explicit default ports (`'https://trusted.example.com:443/path'`) do not match `'https://trusted.example.com'` under string equality without first parsing and normalizing.+- **Public Suffix List mistakes:** Splitting hostnames on `.` to check same-site relationships fails on multi-label public suffixes (such as `.co.uk` or shared hosting domains like `.github.io`) and ignores scheme mismatches (`http:` vs. `https:`).+- **Opaque `"null"` origin collisions:** Sandboxed iframes (`<iframe sandbox="allow-scripts">`) and `data:` URLs serialize `event.origin` to the literal string `"null"`. Comparing two serialized runtime origins with `originA === originB` falsely equates two unrelated opaque contexts (`"null" === "null"`).++The **`Origin` API** (`Origin.from()`, `isSameOrigin()`, `isSameSite()`, and `opaque`) provides structured, spec-compliant origin and schemeful same-site comparisons backed by the browser's URL parser and Public Suffix List.++## Choosing the right comparison for your scenario++- **Use `isSameOrigin()` for strict privilege boundaries:** Require an exact `(scheme, host, port)` match when handling cross-window `postMessage` commands (such as an embedded checkout or auth popup) or deciding whether to attach credentials. Even a different subdomain (`https://blog.example.com` vs. `https://app.example.com`) is a different origin and must be rejected so a vulnerability on one subdomain cannot control another.+- **Use `isSameSite()` for cross-subdomain navigation and link classification:** Allow any subdomain or port sharing the same scheme and registrable domain when validating post-login redirect URLs (`?returnTo=https://billing.example.co.uk/orders`) or classifying links as internal vs. external. `isSameSite()` rejects both `http:` scheme downgrades and sibling tenants on shared public suffixes (`.co.uk`, `.github.io`).+- **Use `origin.opaque` and `Origin.from(event)` for opaque or sandboxed contexts:** Reject `data:` URLs for redirects (`origin.opaque === true`), or pin the opaque `Origin` extracted via `Origin.from(event)` when communicating with a specific `<iframe sandbox="allow-scripts">` widget whose serialized `event.origin` is `"null"`.++## 1. Verify Exact Origins for Privileged Actions (`Origin.from()` and `isSameOrigin()`)++Use `Origin.from()` to extract an `Origin` object and compare it against a trusted `Origin` using `isSameOrigin()`:++- **Both sides must be `Origin` instances:** `isSameOrigin(other)` and `isSameSite(other)` only accept an `Origin` object—passing a raw string throws a `TypeError`.+- **Supported `Origin.from()` inputs:**+ - Serialized URL strings (for example, `'https://trusted.example.com:443/path'`). Note that any invalid URL string—for instance `'example'`, or the `'null'` string serialized by `event.origin` for opaque origins—causes `Origin.from()` to throw a `TypeError`.+ - Platform objects that define origin-extraction steps in the HTML specification: `Origin`, `URL`, `HTMLAnchorElement` (`<a>`), `HTMLAreaElement` (`<area>`), same-origin `Window` or `WorkerGlobalScope` (`Origin.from(self)`), and browser-dispatched `MessageEvent` instances (`Origin.from(event)`).+ - Objects such as `Location`, `WorkerLocation`, `Document`, `Request`, and `Response` do **not** define origin-extraction steps and throw a `TypeError` if passed directly to `Origin.from()`—pass `self` (for the current context) or `request.url` / `response.url` instead.+- **Handle both browser-dispatched and synthetic `MessageEvent` instances:** Real browser `postMessage` events carry an internal origin extracted by `Origin.from(event)`, whereas synthetic `new MessageEvent('message', { origin })` events created in unit tests only populate the `event.origin` string and throw on `Origin.from(event)`. Falling back to `Origin.from(event.origin)` inside a `try...catch` handles both cleanly while still rejecting invalid or `"null"` strings.++```javascript+// Replace with your application's trusted origin(s)+const TRUSTED_ORIGIN = Origin.from('https://app.example.com');++function extractOrigin(candidate) {+ try {+ return Origin.from(candidate);+ } catch (err) {+ // Synthetic new MessageEvent('message', { origin }) objects in tests lack an+ // internal browser origin; fall back to parsing candidate.origin if it is a URL.+ if (typeof MessageEvent !== 'undefined' && candidate instanceof MessageEvent) {+ return Origin.from(candidate.origin);+ }+ throw err;+ }+}++export function isTrustedSameOrigin(candidate) {+ try {+ return extractOrigin(candidate).isSameOrigin(TRUSTED_ORIGIN);+ } catch {+ // Rejects invalid URLs, "null" strings, or unsupported objects+ return false;+ }+}++window.addEventListener('message', (event) => {+ if (!isTrustedSameOrigin(event)) return;++ // Safe to process privileged commands from the verified origin+});+```++## 2. Validate Cross-Subdomain Redirects and Links (`isSameSite()`)++When validating redirect targets (such as `?returnTo=` parameters) or internal links across subdomains of the same registrable domain (for example, `https://app.example.co.uk` and `https://billing.example.co.uk:8443`), use `isSameSite()`:++- `isSameSite()` performs a **schemeful same-site** comparison: `https://sub.example.com` and `http://sub.example.com` are **not** same-site because their schemes differ.+- `isSameSite()` uses the browser's built-in **Public Suffix List**, so distinct tenants on shared public suffixes (such as `https://tenant-a.github.io` and `https://tenant-b.github.io`, or `https://a.co.uk` and `https://b.co.uk`) evaluate to `false`.++```javascript+// Replace with your application's primary origin+const APP_ORIGIN = Origin.from('https://app.example.co.uk');++export function isAllowedSameSiteUrl(candidateUrlOrElement) {+ try {+ return extractOrigin(candidateUrlOrElement).isSameSite(APP_ORIGIN);+ } catch {+ return false;+ }+}++// true: same scheme (https) and same registrable domain (example.co.uk)+isAllowedSameSiteUrl('https://billing.example.co.uk:8443/checkout');++// false: scheme downgrade (http vs. https) is rejected by schemeful same-site+isAllowedSameSiteUrl('http://billing.example.co.uk/checkout');+```++## 3. Distinguish and Pin Opaque Origins (`origin.opaque` and `Origin.from(event)`)++Sandboxed iframes (`<iframe sandbox="allow-scripts">`), `data:` URLs, and `new Origin()` produce **opaque origins** (`origin.opaque === true`). While their string serialization is always `"null"`, `Origin.from(event)` extracts the sender's actual underlying opaque origin from a browser-dispatched `MessageEvent`:++- Two messages sent from the **same** sandboxed iframe yield `Origin` objects that are `isSameOrigin()` with each other (`true`).+- Messages sent from **different** sandboxed iframes—or separate `Origin.from('data:...')` / `new Origin()` calls—yield distinct opaque origins that evaluate `isSameOrigin()` to `false`, preventing `"null" === "null"` spoofing across unrelated opaque contexts.+- `new Origin()` creates a fresh, unique opaque origin that matches nothing except itself, which is useful as a default deny-all sentinel before an expected peer origin is pinned once on initialization.++```javascript+// Initialize with a unique opaque sentinel that matches no other origin+let pinnedSandboxOrigin = new Origin();+let isSandboxPinned = false;++export function handleSandboxedWidgetMessage(event, expectedWidgetWindow) {+ try {+ const senderOrigin = Origin.from(event);++ // Pin the opaque origin only once on initialization from the expected sandboxed iframe+ if (!isSandboxPinned && event.source === expectedWidgetWindow && event.data?.type === 'init') {+ pinnedSandboxOrigin = senderOrigin;+ isSandboxPinned = true;+ }++ // Subsequent messages from the SAME sandboxed iframe match pinnedSandboxOrigin;+ // messages from any other sandboxed iframe (also event.origin === "null") return false.+ return senderOrigin.isSameOrigin(pinnedSandboxOrigin);+ } catch {+ return false;+ }+}+```++## Best practices++- **DO** convert both sides of a comparison to `Origin` instances via `Origin.from()` before calling `isSameOrigin(other)` or `isSameSite(other)`.+- **DO** pass a browser-dispatched `MessageEvent` directly to `Origin.from(event)` when you need to preserve opaque origin identity, and use `Origin.from(self)` (rather than `Location` or `Document`, which throw `TypeError`) to obtain the current execution context's `Origin`.+- **DO** wrap `Origin.from()` calls on untrusted or runtime inputs in a `try...catch` block so invalid URLs, `"null"` strings, or unsupported objects safely return `false` instead of throwing an uncaught `TypeError`.+- **DO NOT** compare two runtime `event.origin` or `url.origin` strings directly without first rejecting `"null"` (`origin !== 'null'`), as two unrelated opaque origins both serialize to `"null"`.+- **DO NOT** validate origins or sites with `startsWith()`, `includes()`, `endsWith()`, or naive `.split('.')` hostname slicing.++## Fallback strategy++Browser support for Origin: Limited availability.+Supported by: Chrome 145 (Feb 2026), Edge 145 (Feb 2026), and Safari 26.5.+Unsupported in: Firefox.++If your Baseline target includes browsers that do not yet support the `Origin` interface, feature-detect `'Origin' in globalThis` and fall back to parsing URLs with `new URL()`:++- **Same-origin fallback (tuple origins):** Extract the URL string (using `event.origin` for `MessageEvent` objects or `candidate.href` for link elements), parse both the candidate and trusted URLs with `new URL()`, reject `"null"` opaque origins (`candidateUrl.origin !== 'null'`), and compare `candidateUrl.origin === trustedUrl.origin`. Because an opaque origin is never same-origin with a tuple origin like `'https://app.example.com'`, immediately rejecting `'null'` matches `Origin.isSameOrigin()`.+- **Same-site fallback (caveat):** The `URL` interface does not expose the browser's Public Suffix List. In browsers without `Origin`, only perform suffix matching against an explicit, known private registrable domain that you control (verifying both `protocol` and an exact or dot-prefixed `hostname` match), or use a maintained Public Suffix List library.+- **Opaque / sandboxed iframe fallback:** Browsers without `Origin` do not expose distinct opaque origin identities on `MessageEvent` (`event.origin` is always `"null"`). If you intentionally accept messages from a known sandboxed `<iframe sandbox="allow-scripts">`, verify `event.source === expectedWidgetWindow` (or communicate over a dedicated `MessageChannel` `MessagePort` transferred to the iframe on initialization) rather than comparing `event.origin`.++```javascript+// Replace with your trusted reference URL and known registrable domain+const TRUSTED_URL = 'https://app.example.com';+const TRUSTED_SITE_DOMAIN = 'example.com';++function extractUrlString(candidate) {+ if (typeof candidate === 'string') return candidate;+ if (typeof MessageEvent !== 'undefined' && candidate instanceof MessageEvent) {+ return candidate.origin;+ }+ if (candidate === globalThis) {+ return globalThis.location?.href ?? '';+ }+ return candidate?.href ?? '';+}++function extractOrigin(candidate) {+ try {+ return Origin.from(candidate);+ } catch (err) {+ if (typeof MessageEvent !== 'undefined' && candidate instanceof MessageEvent) {+ return Origin.from(candidate.origin);+ }+ throw err;+ }+}++export function checkSameOriginWithFallback(candidate) {+ try {+ if ('Origin' in globalThis) {+ return extractOrigin(candidate).isSameOrigin(Origin.from(TRUSTED_URL));+ }+ const candidateUrl = new URL(extractUrlString(candidate));+ const trustedUrl = new URL(TRUSTED_URL);+ return candidateUrl.origin !== 'null' && candidateUrl.origin === trustedUrl.origin;+ } catch {+ return false;+ }+}++export function checkSameSiteWithFallback(candidate) {+ try {+ if ('Origin' in globalThis) {+ return extractOrigin(candidate).isSameSite(Origin.from(TRUSTED_URL));+ }+ const candidateUrl = new URL(extractUrlString(candidate));+ const trustedUrl = new URL(TRUSTED_URL);+ return (+ candidateUrl.origin !== 'null' &&+ candidateUrl.protocol === trustedUrl.protocol &&+ (candidateUrl.hostname === TRUSTED_SITE_DOMAIN ||+ candidateUrl.hostname.endsWith(`.${TRUSTED_SITE_DOMAIN}`))+ );+ } catch {+ return false;+ }+}+```diff --git a/skills/modern-web-guidance/guides/security/verify-email-ownership.md b/skills/modern-web-guidance/guides/security/verify-email-ownership.mdnew file mode 100644index 0000000..50b1542--- /dev/null+++ b/skills/modern-web-guidance/guides/security/verify-email-ownership.md@@ -0,0 +1,235 @@+# Verify email address ownership++When collecting an email address during sign-up, sign-in, checkout, or account recovery, verifying ownership traditionally requires sending an out-of-band one-time passcode (OTP) or magic link. This forces users to leave your page, wait for email delivery, and copy codes—introducing friction, drop-off, and phishing risk, while also revealing to the email provider which relying party (RP) the user is visiting.++The **Email Verification API** (client-side HTML extension) and **Email Verification Protocol (EVP)** (backend cryptographic protocol) enable a relying party to verify that a user controls an email address without sending a verification email. The browser intermediates between the relying party and the user's email provider (the issuer):++1. The relying party includes a hidden `<input>` with `autocomplete="email-verification-token"` and a single-use cryptographic `nonce` in the same `<form>` as the email input.+2. When the user selects or enters an email address, the browser looks up the domain's `_email-verification.<domain>` DNS `TXT` record, verifies the user has an active session with the authoritative issuer, and requests an **Email Verification Token (EVT)** without disclosing the relying party's identity to the issuer.+3. The browser binds the EVT to the relying party's origin and session `nonce` in a **Key Binding JWT (KB-JWT)** signed with an ephemeral browser key pair (`EVT + KB-JWT`), populates the hidden input, and submits the form.+4. The relying party's backend verifies the cryptographic chain and, if valid, skips the email OTP or magic link step.++## 1. Enable the Origin Trial and Render the Verification Form++To participate as a verifying site (relying party):++1. **Provide the Origin Trial token** on the page hosting the form using either the `Origin-Trial` HTTP response header or a `<meta http-equiv="origin-trial">` element.+ - **Third-party origin trials:** Embedded identity SDKs can inject a third-party trial token, provided the Origin Trial registrant origin matches the issuer domain (same-site with the issuer, such as `https://issuer.example`).+2. **Generate a cryptographically random nonce per form render** with at least 128 bits of entropy (for example, `randomBytes(32).toString('base64url')` from `node:crypto`), store it in **server-side session state** keyed by an `HttpOnly`, `Secure`, `SameSite=Lax` session ID cookie (never store the expected `nonce` value directly inside a client cookie where an attacker could replay both the cookie and token), and render it into the hidden token input's `nonce` attribute. Serve the page with `Cache-Control: no-store` so back/forward navigation does not reuse an already-consumed nonce.+3. **Add the hidden token input** (`autocomplete="email-verification-token"`) inside the same `<form>` as the email input (`autocomplete="email"`).++```html+<!-- Serve with:+ Origin-Trial: <YOUR_ORIGIN_TRIAL_TOKEN>+ Cache-Control: no-store -->+<form method="POST" action="/api/verify-email">+ <label for="email">Email address:</label>+ <input+ type="email"+ id="email"+ name="email"+ autocomplete="email"+ required+ />++ <!-- MANDATORY: Must be in the same <form> as the email input.+ The nonce value must be freshly generated on the server per form render. -->+ <input+ type="hidden"+ name="token"+ nonce="SERVER_GENERATED_PER_FORM_NONCE"+ autocomplete="email-verification-token"+ />++ <button type="submit">Continue</button>+</form>+```++## 2. Verify the Submitted Token on the Server++When the form is submitted, treat the `token` field as untrusted input. Atomically read and delete the expected `nonce` from your server-side session store on receipt. If the `token` field is empty (for example, in browsers that do not support EVP or when the user is signed out of their email provider) or if verification fails, fall back immediately to your standard email OTP or magic link flow:++```javascript+// Replace with your public relying-party origin+const RP_ORIGIN = 'https://rp.example.com';++export async function handleSignupSubmission(request) {+ const formData = await request.formData();+ const submittedEmail = String(formData.get('email') || '').trim();+ const rawToken = String(formData.get('token') || '').trim();+ // Atomically read and delete the single-use nonce from server-side session state+ const expectedNonce = await consumeSessionNonce(request);++ if (rawToken && expectedNonce) {+ try {+ await verifyEmailVerificationToken({+ rawToken,+ submittedEmail,+ expectedNonce,+ expectedAudience: RP_ORIGIN,+ });+ // Fast path: email ownership is cryptographically verified; skip OTP email.+ return completeAccountCreation(submittedEmail);+ } catch (err) {+ // Log token verification failures before falling back to standard email verification.+ console.error('Email verification token check failed:', err);+ }+ }++ // Fallback path: send standard OTP code or magic link email to submittedEmail.+ return sendTraditionalVerificationEmail(submittedEmail);+}+```++Always use established SD-JWT and JOSE/JWT libraries for your backend platform (such as `@sd-jwt/core` and `jose` in Node.js, `sd-jwt-python` / `jwcrypto` in Python, or `sd-jwt-java` / Nimbus JOSE+JWT on the JVM) to implement `verifyEmailVerificationToken` rather than hand-rolling custom JWT or SD-JWT parsing code.++### Step 1: Parse the SD-JWT claims and validate the email address++After consuming the single-use `expectedNonce` from server-side session storage, decode the SD-JWT presentation (`EVT + KB-JWT`) and verify that:+- Both the issuer JWT (`jwt`) and Key Binding JWT (`kbJwt`) are present, along with the issuer claim (`iss`).+- `evtPayload.email_verified === true`.+- `evtPayload.email` matches the submitted form email using a **case-insensitive comparison** (`toLowerCase()`).++```javascript+import { createHash } from 'node:crypto';+import { decodeSdJwtSync } from '@sd-jwt/core';++const hasher = (data, alg) =>+ createHash(alg === 'sha-256' ? 'sha256' : alg).update(data).digest();++const decoded = decodeSdJwtSync(rawToken, hasher);+const evtPayload = decoded.jwt.payload;+const iss = evtPayload.iss;++if (!expectedNonce || !decoded.kbJwt || !iss || evtPayload.email_verified !== true) {+ throw new Error('Missing nonce, KB-JWT, issuer, or email_verified !== true.');+}+// MANDATORY: Compare email addresses case-insensitively+if (evtPayload.email?.toLowerCase() !== submittedEmail.toLowerCase()) {+ throw new Error('Submitted email does not match the EVT email claim.');+}+```++### Step 2: Validate DNS TXT delegation and load the issuer JWKS++Before making any network request to `iss`, verify that the submitted email's domain delegates authority to that exact issuer via a `_email-verification.<domain>` DNS `TXT` record (`iss=<issuer-host>` -> `https://<issuer-host>` with no port, path, or trailing slash). Once DNS delegation matches `iss` byte-for-byte, fetch `${iss}/.well-known/email-verification` over HTTPS, confirm that `metadata.issuer === iss`, and load the issuer's JSON Web Key Set (JWKS).++> **Note on `kid` handling:** Some major email providers (such as Gmail) omit `kid` from the EVT header. When `kid` is absent and the JWKS contains multiple keys, `jose` throws `ERR_JWKS_MULTIPLE_MATCHING_KEYS` (an `AsyncIterable` of matching `CryptoKey`s)—iterate `for await (const publicKey of err)` to trial-verify each key, as shown in Step 3.++```javascript+import dns from 'node:dns/promises';+import { createRemoteJWKSet } from 'jose';++const domain = submittedEmail.split('@')[1];+const txtRecords = (await dns.resolveTxt(`_email-verification.${domain}`)).map((r) => r.join(''));+if (!txtRecords.some((txt) => txt.startsWith('iss=') && `https://${txt.slice(4).trim()}` === iss)) {+ throw new Error(`Issuer "${iss}" is not delegated via DNS for "${domain}".`);+}++const discoveryUrl = new URL('/.well-known/email-verification', iss);+if (discoveryUrl.protocol !== 'https:') throw new Error('Issuer must use HTTPS.');+const metadata = await (await fetch(discoveryUrl)).json();+if (metadata.issuer !== iss || !metadata.jwks_uri?.startsWith('https://')) {+ throw new Error('Invalid issuer metadata or non-HTTPS jwks_uri.');+}+const issuerJwks = createRemoteJWKSet(new URL(metadata.jwks_uri));+```++### Step 3: Verify the EVT signature and Key Binding JWT (`KB-JWT`)++Finally, verify both signatures and the cryptographic binding between the two tokens using the explicit asymmetric algorithm allowlist (`['Ed25519', 'EdDSA', 'ES256']`):+1. **EVT signature (`verifier`):** Verify against `issuerJwks` (catching `ERR_JWKS_MULTIPLE_MATCHING_KEYS` to iterate candidate keys when `kid` is omitted), enforcing `iss` and a tight freshness window (`maxTokenAge: '5m'`, `clockTolerance: '1m'`).+2. **Holder binding (`kbVerifier` and `sdJwt.verify` options):** Extract the browser's ephemeral public key from `evtPayload.cnf.jwk`, confirm both `cnf.jwk.alg` and `decoded.kbJwt.header.alg` are in `ALLOWED_ALGS` and match (treating `'Ed25519'` and `'EdDSA'` as equivalent while Origin Trial implementations transition to RFC 9864 `'Ed25519'`), and verify the `KB-JWT` signature with `typ: 'kb+jwt'`. Pass `keyBindingNonce: expectedNonce`, `expectedKeyBindingAudience: expectedAudience`, and `keyBindingMaxAgeSeconds: 300` to `sdJwt.verify()`—`@sd-jwt/core` only invokes `kbVerifier` and validates `nonce`, `aud`, `iat`, and `sd_hash` when `keyBindingNonce` is supplied.++```javascript+import { SDJwtInstance } from '@sd-jwt/core';+import { importJWK, jwtVerify } from 'jose';++// IETF draft-hardt-email-verification-02 (§3.3, §5.1.1) specifies RFC 9864 'Ed25519' and 'ES256'.+// TODO: Remove 'EdDSA' once live issuers (e.g. Gmail) and Chrome Origin Trial builds finish+// transitioning from 'EdDSA' (with crv: 'Ed25519') to 'Ed25519'.+const ALLOWED_ALGS = ['Ed25519', 'EdDSA', 'ES256'];+const normalizeAlg = (alg) => (alg === 'Ed25519' ? 'EdDSA' : alg);+const evtOptions = {+ typ: 'ev+sd-jwt',+ issuer: iss,+ algorithms: ALLOWED_ALGS,+ maxTokenAge: '5m',+ clockTolerance: '1m',+};++const sdJwt = new SDJwtInstance({+ hasher,+ verifier: async (data, sig) => {+ const compactEvt = `${data}.${sig}`;+ try {+ await jwtVerify(compactEvt, issuerJwks, evtOptions);+ } catch (err) {+ // When `kid` is omitted (e.g. Gmail) and multiple keys match in the JWKS,+ // jose throws JWKSMultipleMatchingKeys, which yields each matching CryptoKey.+ if (err?.code !== 'ERR_JWKS_MULTIPLE_MATCHING_KEYS') throw err;+ let matched = false;+ for await (const publicKey of err) {+ try {+ await jwtVerify(compactEvt, publicKey, evtOptions);+ matched = true;+ break;+ } catch {}+ }+ if (!matched) throw err;+ }+ return true;+ },+ kbVerifier: async (data, sig) => {+ const holderJwk = evtPayload.cnf?.jwk;+ const holderAlg = holderJwk?.alg;+ const kbAlg = decoded.kbJwt.header.alg;+ if (+ !holderAlg ||+ !kbAlg ||+ !ALLOWED_ALGS.includes(holderAlg) ||+ !ALLOWED_ALGS.includes(kbAlg) ||+ normalizeAlg(kbAlg) !== normalizeAlg(holderAlg)+ ) {+ throw new Error('Missing, disallowed, or mismatched KB-JWT algorithm.');+ }+ const holderKey = await importJWK(holderJwk, kbAlg);+ await jwtVerify(`${data}.${sig}`, holderKey, {+ typ: 'kb+jwt',+ audience: expectedAudience,+ algorithms: [kbAlg],+ maxTokenAge: '5m',+ clockTolerance: '1m',+ });+ return true;+ },+});++const verified = await sdJwt.verify(rawToken, {+ requiredClaimKeys: ['email', 'email_verified'],+ keyBindingNonce: expectedNonce,+ expectedKeyBindingAudience: expectedAudience,+ keyBindingMaxAgeSeconds: 300,+ skewSeconds: 60,+});+```++## Best practices++- **DO** perform all token verification strictly on the server. **DO NOT** validate tokens in client-side JavaScript or trust any client-side verification state—client-side checks can be trivially bypassed or forged and provide zero trust guarantee to the relying party.+- **DO** use established SD-JWT and JOSE/JWT libraries for your backend platform (for example, `@sd-jwt/core` and `jose` in Node.js) to parse and validate the `EVT~KB-JWT` presentation, and pass `keyBindingNonce` to `sdJwt.verify()` so Key Binding verification cannot be bypassed. **DO NOT** hand-roll custom JWT, SD-JWT, or `sd_hash` parsing and signature verification routines.+- **DO** generate a fresh cryptographic `nonce` (at least 128 bits, such as `randomBytes(32).toString('base64url')`) on the server for each form render, store it in **server-side session state** (not directly in a client cookie), and serve the form page with `Cache-Control: no-store`.+- **DO** atomically read and delete the expected `nonce` from server-side session storage immediately when the `POST` request arrives so an intercepted token cannot be replayed.+- **DO** perform a **case-insensitive comparison** between `evtPayload.email` and the submitted form email address (`email.toLowerCase()`), while preserving the submitted email string.+- **DO** trial-verify all keys in the issuer's JWKS when `kid` is absent from the EVT header (providers such as Gmail omit `kid`).+- **DO** verify DNS delegation (`_email-verification.<domain>`) before trusting any `iss` claim in an EVT, and confirm `metadata.issuer === iss` in the `.well-known/email-verification` response.+- **DO NOT** treat email ownership verification as proof of inbox deliverability. EVP proves that the user controls the email account with the authoritative provider; still send transactional welcome emails and handle bounces normally.+- **DO NOT** block account creation or sign-in when `token` is empty or when verification fails—always degrade gracefully to your standard email OTP or magic link flow.++## Fallback strategy++Email Verification (`autocomplete="email-verification-token"`) is designed as a **progressive enhancement** over traditional out-of-band email verification (OTP codes or magic links):++- **Unsupported browsers:** Browsers that do not support `autocomplete="email-verification-token"` ignore the hidden input and submit the form with an empty `token` value.+- **Unauthenticated or non-participating email domains:** When a user enters an email address whose domain does not publish an `_email-verification` DNS `TXT` record, or when the user does not have an active session with their email provider in the browser, the browser submits the form with an empty `token`.+- **Expired or invalid tokens:** If the `nonce` has expired, was already consumed, or fails any step of `verifyEmailVerificationToken` in `handleSignupSubmission`, the server catches the error and sends a traditional OTP or magic link email without interrupting the user's sign-up or sign-in flow.diff --git a/skills/modern-web-guidance/guides/ui-behaviors/consistent-cross-document-transitions.md b/skills/modern-web-guidance/guides/ui-behaviors/consistent-cross-document-transitions.mdindex 169f2d9..3998f7e 100644--- a/skills/modern-web-guidance/guides/ui-behaviors/consistent-cross-document-transitions.md+++ b/skills/modern-web-guidance/guides/ui-behaviors/consistent-cross-document-transitions.md@@ -63,7 +63,7 @@ If a non-blocking script in the `<head>` must run before the transition animatesStylesheets and `blocking="render"` scripts in the `<head>` only guarantee that the `<head>` has been fully processed. They do **not** wait for any `<body>` content to be parsed. Without additional blocking, the browser may take the new-page snapshot before above-the-fold elements exist in the DOM — resulting in a transition that animates to a blank or partially rendered page.-`<link rel="expect">` solves this by blocking rendering until a specific element (identified by its `id`) has been parsed. The `href` value must be a fragment identifier (e.g., `#hero`) matching the target element's `id` attribute. Once that element's closing tag is parsed, the render block is released.+`<link rel="expect">` solves this by blocking rendering until a specific element (identified by its `id`) has been parsed. The `href` value must be a fragment identifier (e.g., `#hero`) matching the target element's `id` attribute. Once that element's closing tag is parsed, the render block is released. Note that `<link rel="expect">` only guarantees that the target DOM element exists in the document — it does **not** wait for external subresources (such as `<img>` pixels) to download or decode.**DO** use `<link rel="expect">` in all of the following scenarios:@@ -98,10 +98,20 @@ Even when no individual elements have a `view-transition-name`, the default `rooWhen elements on both pages share a `view-transition-name`, the browser morphs them smoothly across the navigation. If the target element has not been parsed when the transition starts, the browser cannot find it — the morph degrades to separate exit and entry animations. Block rendering until the element with the `view-transition-name` has been parsed.+Because `<link rel="expect">` only pauses rendering until the target DOM element is parsed and does not wait for image data to download or decode, an uncached `<img>` may be captured as an empty rectangle in the new-page snapshot. To prevent blank snapshots or layout shifts during image morphs, preload or pre-decode critical transition images (for example, with `<link rel="preload" as="image">` or by prerendering the destination page) and provide explicit sizing fallbacks (`width` and `height` attributes or CSS `aspect-ratio`, plus a placeholder background color).+```html<head><link rel="stylesheet" href="/css/styles.css">+ <!--+ DO: Preload critical transition images so their pixels are+ available to decode before the new-page snapshot is captured.+ <link rel="expect"> only waits for the DOM element to be parsed,+ NOT for image pixels to download or decode.+ -->+ <link rel="preload" as="image" href="/img/product.webp" fetchpriority="high">+<!--DO: Block rendering until the element participating in themorph animation has been parsed. Without this, the browser@@ -122,7 +132,18 @@ When elements on both pages share a `view-transition-name`, the browser morphs t<header>...</header><section id="hero"><h1 style="view-transition-name: page-title">Product Name</h1>- <img style="view-transition-name: hero-image" src="/img/product.webp" alt="Product">+ <!--+ DO: Provide explicit dimensions (width/height or aspect-ratio)+ as a sizing fallback so the snapshot captures the correct layout+ box even if image decoding is still in progress.+ -->+ <img+ style="view-transition-name: hero-image"+ src="/img/product.webp"+ width="800"+ height="600"+ alt="Product"+ ></section></body>```@@ -164,8 +185,10 @@ If `view-transition-name` values are assigned statically in CSS, or if you are o<head><!--MANDATORY: The pagereveal listener must be registered before- the page renders. Use an async script with blocking="render"- so the listener is registered early without blocking parsing.+ the page renders. Inline small setup scripts with blocking="render"+ to avoid an extra network round-trip on cold loads, or use an+ external async script with blocking="render" so the listener is+ registered early without blocking HTML parsing.If the listener is registered too late (e.g., in a deferredscript), the event may have already fired.-->@@ -188,15 +211,24 @@ window.addEventListener('pagereveal', async (event) => {// list page to the heading on the detail page.if (fromUrl.pathname === '/products/') {const heading = document.querySelector('main h1');- if (heading) {- heading.style.viewTransitionName = 'product-title';+ if (!heading) return;++ heading.style.viewTransitionName = 'product-title';++ try {+ await event.viewTransition.ready;+ } catch (error) {+ // Skipped view transitions reject `ready` with InvalidStateError.+ if (error.name !== 'InvalidStateError') {+ throw error;+ }+ } finally {+ // MANDATORY: Remove the temporary name after the transition+ // finishes. Stale names interfere with subsequent navigations+ // and prevent the page from entering the bfcache.+ await event.viewTransition.finished;+ heading.style.viewTransitionName = '';}-- // MANDATORY: Remove the temporary name after the transition- // finishes. Stale names interfere with subsequent navigations- // and prevent the page from entering the bfcache.- await event.viewTransition.finished;- heading.style.viewTransitionName = '';}});```@@ -204,7 +236,7 @@ window.addEventListener('pagereveal', async (event) => {## Best Practices- **DO** assign `view-transition-name` via CSS whenever possible. Reserve JavaScript assignment (via `pagereveal`) for cases where the name depends on navigation context.-- **DO** keep render-blocking scripts small and fast. The browser has a built-in timeout (around 4 seconds), after which the transition is skipped entirely with a `TimeoutError`.+- **DO** keep render-blocking scripts small and fast. The browser has a built-in timeout (around 4 seconds), after which the transition is skipped entirely (rejecting `viewTransition.ready` with an `InvalidStateError` if a transition was initiated).- **DO NOT** use `<link rel="expect">` to block on elements deep in the page that are not visible in the initial viewport. This delays the transition without visual benefit.- **DO NOT** mark analytics, ad-network, tag-manager or other third-party loaders with `blocking="render"`, even if they inject content into the initial viewport. Their network latency counts toward the transition timeout and their output is not part of the page's stable state.- **DO NOT** assign the same `view-transition-name` to multiple elements on the same page. Duplicate names cause the entire transition to be skipped.@@ -223,5 +255,5 @@ All browsers that support cross-document view transitions also support `blocking## Other Considerations1. **Performance Impact**: Every render-blocking resource delays the view transition animation start. Minimize the number of render-blocking scripts and use `<link rel="expect">` only for elements that are above the fold. Prerender destination pages using the Speculation Rules API to eliminate loading delays entirely.-2. **Timeout Behavior**: If the combined render-blocking time exceeds approximately 4 seconds, the browser skips the transition with a `TimeoutError`. Ensure critical resources load well within this window.+2. **Timeout Behavior**: If the combined render-blocking time exceeds approximately 4 seconds, the browser skips the transition (and any active `viewTransition.ready` promise rejects with an `InvalidStateError`). Ensure critical resources load well within this window.3. **bfcache Compatibility**: Temporary `view-transition-name` assignments that are not cleaned up after the transition can prevent the page from entering the bfcache. Always remove dynamically assigned names in the `finished` callback.diff --git a/skills/modern-web-guidance/guides/ui-behaviors/drag.md b/skills/modern-web-guidance/guides/ui-behaviors/drag.mdnew file mode 100644index 0000000..dc58c6d--- /dev/null+++ b/skills/modern-web-guidance/guides/ui-behaviors/drag.md@@ -0,0 +1,84 @@+# Build a Draggable Element++Add dragging to an existing floating element such as a panel, palette, toolbar, inspector, or dialog. Dragging does not determine how the element is displayed, dismissed, stacked, or focused.++## Use a dedicated handle++Start dragging from a dedicated handle when the element contains selectable text, buttons, inputs, or links. This keeps its normal contents usable. Make the handle focusable for keyboard movement and give it an accessible name that mentions the arrow-key interaction.++Do not apply `role="application"` to the handle. It unnecessarily changes assistive-technology interaction.++Apply `cursor: grab`/`grabbing`, `touch-action: none`, and both `user-select: none` and `-webkit-user-select: none` to the handle—not the entire draggable element—so text outside it remains selectable and touch gestures retain their usual behavior:++```css+.drag-handle {+ cursor: grab;+ touch-action: none;+ -webkit-user-select: none;+ user-select: none;+}++.drag-handle.dragging {+ cursor: grabbing;+}+```++## Preserve pointer position and reachability++Use a viewport-relative positioning model such as `position: fixed` when clamping movement to the viewport.++- Start a drag only for the primary pointer button (`event.button === 0`).+- Record the pointer offset on `pointerdown` and use it on every move so the element does not jump when grabbed away from its corner.+- Keep the drag active after the pointer leaves the handle. Default to `setPointerCapture()` and clear the dragging state on `lostpointercapture`. If the handle may be removed or re-rendered mid-drag, use document-level `pointermove`, `pointerup`, and `pointercancel` listeners instead, since capture is lost in that case.+- Optionally, wait for roughly 4px of movement before entering the dragging state, so a click on the handle does not trigger drag styling.++With pointer capture, the movement listeners can remain on the handle:++```js+handle.addEventListener('pointerdown', (event) => {+ if (event.button !== 0 || event.target.closest('button, input, select, textarea, a')) return;++ const rect = draggable.getBoundingClientRect();+ offsetX = event.clientX - rect.left;+ offsetY = event.clientY - rect.top;+ handle.setPointerCapture(event.pointerId);+});++handle.addEventListener('pointermove', (event) => {+ if (!handle.hasPointerCapture(event.pointerId)) return;+ handle.classList.add('dragging');+ moveTo(event.clientX - offsetX, event.clientY - offsetY);+});++handle.addEventListener('lostpointercapture', () => {+ handle.classList.remove('dragging');+});++function moveTo(left, top) {+ const maxLeft = Math.max(0, window.innerWidth - draggable.offsetWidth);+ const maxTop = Math.max(0, window.innerHeight - draggable.offsetHeight);++ draggable.style.left = `${Math.max(0, Math.min(left, maxLeft))}px`;+ draggable.style.top = `${Math.max(0, Math.min(top, maxTop))}px`;+}+```++Clamp every pointer and keyboard position through the same helper so the element stays reachable. Re-clamp its current position after viewport or element-size changes. For layout-heavy elements, consider translating during the drag to avoid per-frame layout, then commit the final position to `left` and `top` on release.++## Provide keyboard movement++When the handle has focus, move the element with the arrow keys and call `preventDefault()` for those keys. Use the same clamped positioning helper as pointer movement. A 15px increment is a reasonable starting point; adapt it to the component's size and precision needs.++## Dialog-specific note++A `<dialog>` or `[popover]` can use this mechanism with its header as the handle. Set `margin: 0` before assigning `left` and `top`, because the browser's default margins interfere with manual positioning. For dialog and popover opening, closing, focus, and dismissal behavior, see `declarative-dialog-popover-control` (via `npx -y modern-web-guidance@latest retrieve "declarative-dialog-popover-control"`) and `platform-controls-dismiss-dialog` (via `npx -y modern-web-guidance@latest retrieve "platform-controls-dismiss-dialog"`).++## Fallback strategies++When dragging only repositions a component, treat it as progressive enhancement: without JavaScript, keep the element, its content, and its controls visible, readable, and functional in a sensible default position. Do not expose a non-functional drag handle: if the handle is a standalone grip control, hide it by default and reveal it when JavaScript initializes; if a header doubles as the handle, attach its drag affordances when JavaScript initializes.++Browser support for user-select: Limited availability.+Supported by: Chrome 54 (Oct 2016), Edge 79 (Jan 2020), and Firefox 69 (Sep 2019).+Unsupported in: Safari.++Include `-webkit-user-select: none` before `user-select: none` so text selection stays suppressed during dragging in Safari.diff --git a/skills/modern-web-guidance/guides/ui-behaviors/dynamic-sibling-animations.md b/skills/modern-web-guidance/guides/ui-behaviors/dynamic-sibling-animations.mdindex f15f0c5..7894400 100644--- a/skills/modern-web-guidance/guides/ui-behaviors/dynamic-sibling-animations.md+++ b/skills/modern-web-guidance/guides/ui-behaviors/dynamic-sibling-animations.md@@ -11,7 +11,7 @@ Use the `sibling-index()` property on the `animation-delay` property so that the--stagger-time: 0.1s;/* Define the animation first */animation: fade-in 0.4s;- /* Set the `animation-delay` to a time multipled by the `sibling-index()` */+ /* Set the `animation-delay` to a time multiplied by the `sibling-index()` */animation-delay: calc(sibling-index() * var(--stagger-time))}```diff --git a/skills/modern-web-guidance/guides/visual-design/contrast-color.md b/skills/modern-web-guidance/guides/visual-design/contrast-color.mdindex 8218cf1..687e2d4 100644--- a/skills/modern-web-guidance/guides/visual-design/contrast-color.md+++ b/skills/modern-web-guidance/guides/visual-design/contrast-color.md@@ -101,7 +101,7 @@ Supported by: Chrome 4 (Jan 2010), Edge 15 (Apr 2017), Firefox 49 (Sep 2016), Sa#### Option 2: Text Stroke with `paint-order` to preserve letterforms-Baseline status for paint-order: Newly available. It's been Baseline since 2024-03-22.+Baseline status for paint-order: Widely available. It's been Baseline since 2024-03-22.Supported by: Chrome 123 (Mar 2024), Edge 123 (Mar 2024), Firefox ≤66, and Safari ≤12.```css