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''

Below is a strict, but still workable Content Security Policy for your Ruby on Rails project. Use this CSP if...

api.rubyonrails.org

When working with file uploads, we sometimes need to process intrinsic properties like the page count or page dimensions of...

I recently encountered this error as I was trying to build assets: $ node esbuild.config.js .../node_modules/esbuild-plugin-browserslist/dist/resolveToEsbuildTarget.js:43 throw new Error('Could...

If you need to implement newsletter sending, rapidmail is a solid option. Support is very fast, friendly and helpful, and...

makandra dev

Postgres supports multiple built-in range datatypes: int4range int8range numrange tsrange (range with timestamp without timezone) tstzrange (range with timestamp...

You may remember to use the || operator with caution to set defaults. We'll see that && and other conditionals come...

In rare circumstances, you want to use a websites full domain (say https://mywebsite.com) while testing in dev mode. This...

TypeScript basically uses structural typing, which is conceptually quite similar to duck typing, but with static compile-time type checking...

In some projects we have issues with flaky tests. The best default is to fix them all. But in some...

makandracards.com

Documented a repomix that allows you to bundle the XML repository context with custom LLM instructions. I have mine located...

Leaving old unused DB columns around after a migration is confusing for other developers. However, dropping columns too eagerly might...

I use the Gemini web chat interface quite extensively. One thing that is tedious is giving it all the context...

Knapsack allows you to rerun a specific job locally. This is helpful to run specs in the exactly same order...

If your rubocop run fails with a stack like rubocop-1.61.0/lib/rubocop/server/socket_reader.rb:36:in `ensure in read!': undefined method `string...

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...

The :test adapter doesn't respect limits_concurrency configuration. Switch to :solid_queue adapter in your test to verify blocking...

makandra dev

If you use the selenium-webdriver gem, it will sneakily phone home once every hour whenever you run a browser...

makandra dev

Most of our CI pipelines don't use the --retry flag for Cucumber and instead build their own retry via...

Short reference on how to quickly debug the vanilla Rails job adapters. Queue Adapters by Environment Environment Adapter

I recently had to update a few selective npm libraries in a project that uses pnpm to apply a CVE...

Sometimes you have a maintenance script where you want to iterate over all ActiveRecord models. Rails provides this out of...

When creating a database table for a join model without further importance, you can use Rails' create_join_table: