CS Fundamentals Trainer · JavaScript · Security
A page is served with Content-Security-Policy: script-src 'nonce-r4nd' 'strict-dynamic' https://cdn.example. Which script executes in…
A page is served with `Content-Security-Policy: script-src 'nonce-r4nd' 'strict-dynamic' https://cdn.example`. Which script executes in Chromium?
- A `<script src="https://cdn.example/lib.js">` tag in the HTML without a nonce, because its host is in the policy
- An inline `onclick="..."` attribute on a button, because `'strict-dynamic'` trusts the page's own markup
- A script element that the nonced inline script creates with `document.createElement('script')` and appends
- A `<script>` block without a nonce, provided it was part of the original HTML response
Difficulty: hard