When you load a with a nonce, that script can await import() additional sources from any hostname. The nonce is propagated automatically for the one purpose of importing more scripts. This is not related to strict-dynamic, which propagates nonces for any propose not limited to imports (e.g. inserting elements). Example We have a restrictive CSP that only allows nonces: Content-Security-Policy: default-src 'none'; script-src 'nonce-secret123' Our HTML loads script.js using that nonce: Our script.js imports other.js without a nonce: let other = await import('other.js') console.log("Look, script.js has imported %o", other) The import succeeds without a nonce, due to implicit nonce propagation. Why this is useful In modern build pipelines, code splitting (chunking) is implemented using dynamic imports. Nonce propagation allows us to use automatic chunking with restrictive, nonce-based CSPs without using strict-dynamic. E.g. esbuild automatically groups dynamically imported modules into chunks, and writes that chunk to disk. The compiled build has an await import('assets/chunk-NAXSMFJV.js'). There's no way to inject a nonce into that import(), but implicit nonce propagation still allows the request. Should I worry about this? It would require some truly strange code for user input to make it into an import() argument. I wouldn't lose sleep over this. Is this a browser bug? It is by design. Here are some sources: HTML Spec Section 8 (Web Application APIs) (search for "descendant script fetch options") Chromium test ensuring none propagation Firefox bug implementing nonce propagation CSP issue: Someone concerned about propagation being a vulnerability CSP issue: Proposal for import-src that went nowhere Are other CSP sources also propagated? No, only nonces. In particular host-based CSPs do not propagate trust. For example, you only allow scripts from our own host (no nonces): Content-Security-Policy: default-src 'none'; script-src 'self' Our HTML loads script.js from our own host: Our script.js imports other.js from a different host: let other = await import('https://other-host.com/other.js') This fails with a CSP violation: Executing inline script violates the following Content Security Policy directive 'script-src 'self''
You may remember to use the || operator with caution to set defaults. We'll see that && and other conditionals come...
TypeScript basically uses structural typing, which is conceptually quite similar to duck typing, but with static compile-time type checking...
Event listeners are called in the order of their registration: button.addEventListener('click', () => console.log("I run first")) button.addEventListener('click', () => console.log("I...
I have a form with a dynamic number of fields. Submitting it worked fine until I tried out a very...
Short reference on how to quickly debug the vanilla Rails job adapters. Queue Adapters by Environment Environment Adapter
When you query the browser for DOM elements, there are some footguns you should know about. Some lists are synchronized...
Finding changes When you're looking for a specific change in Git, there are multiple axes you can choose:
The File System Access API is a new capability of modern browsers that allows us to iterate over selected folders...
Enable local logging for Sentry when: Debugging Sentry event capture locally Testing error handling without polluting production metrics Developing background...
Quick reference for passing data from Rails to JavaScript via Unpoly compilers. Haml Attribute Syntax # Ising hash rockets and string...
Rails log files rotate automatically when they reach approx. 100MB: $ ls -lh log/ -rw-r--r-- 1 user group 55M...
Most of the time, when you are interested in any log output, you see the logs directly on your console...
When RSpecs runs the first feature spec, you may see log output like this: Capybara starting Puma... * Version 6.5.0, codename...
Frontend performance and user experience are orthogonal to feature development. If care is not taken, adding features usually degrades frontend...
Orca is a Linux screen reader. Since it is part of the GNOME project it should come preinstalled with Ubuntu...
Rails wraps your parameters into an interface called StrongParameters. In most cases, your form submits your data in a nested...
TL;DR: Rails ships two methods to convert strings to constants, constantize and safe_constantize. Neither is safe for untrusted...
In development, we store files using ActiveStorage's disk service. This means that stored files are served by your Rails...
If you update Selenium regularly, you'll run into deprecation warnings similar to: WARN Selenium [:clear_local_storage] [DEPRECATION] clear...
The ActiveSupport::BroadcastLogger allows you to log to multiple sinks. You know this behavior from from the rails server command...
Rails' default logger prefixes each log entry with timestamp and tags (like request ID). For multi-line entries, only the...
Terser is a really good minifier ("compressor") for JavaScript code. I'm often surprised by the thoughtfulness of its compressed...
I was recently asked to optimize the response time of a notoriously slow JSON API endpoint that was backed by...