Skip to content

chore: cherry-pick 2 PRs to 25.4 (CP: 25.4) - #27692

Open
vaadin-bot wants to merge 2 commits into
25.4from
cherry-pick-batch-to-25.4-1796413319451
Open

vaadin-bot wants to merge 2 commits into
25.4from
cherry-pick-batch-to-25.4-1796413319451

Conversation

@vaadin-bot

Copy link
Copy Markdown
Collaborator

This PR cherry-picks 2 PRs to branch 25.4, one commit each, in the order they were merged:

  1. feat: send report-only Content Security Policy in warn and strict dev mode #27612
  2. ci: remove diagram bot workflow #27575 (conflicts resolved by Claude)

Merge it with rebase and merge, so that each pick keeps its own commit.

Warning

The cherry-pick had merge conflicts that were resolved automatically by Claude Code. Please review the changes carefully.

Resolution notes from Claude:

#27575:

  • .github/workflows/README.md: conflicts were only the Diagram Bot table row and section; resolved by removing both, as the original PR does.
  • diagram-bot.md and diagram-bot.lock.yml (modify/delete conflicts, the 25.4 copies differ slightly from main): deleted, as the original PR does.
  • No tests are affected. The formatter and the Maven build were not run because the pick changes only CI workflow files and docs, no module sources.

totally-not-ai Bot and others added 2 commits December 4, 2026 19:41
… mode (#27612) (CP: 25.4)

Part of #26696
Follow-up to #27471

**new feature** · flow-server, vaadin-spring · apps that use
`contentSecurityPolicy=warn`, or `strict` in development mode

**Background — report-only policy.** A
`Content-Security-Policy-Report-Only` header makes the browser check the
page against a policy and report every violation, in the console and to
a `report-uri`/`report-to` collector, without blocking anything.

Vaadin now sends its strict policy, with the nonce on its scripts, as
report-only wherever it does not enforce it: in the `warn` mode, in
development and production mode, and in the `strict` mode in development
mode. The browser then shows what the enforced policy would block, such
as inline scripts, `eval` in client code and resources from other
origins, which the server-side checks cannot see. `strict` in production
mode enforces the same policy, as before.

**Risks:**
- ⚠️ Behaviour change: pages in `warn` mode, and in `strict` mode in
development mode, now get a `Content-Security-Policy-Report-Only` header
and a nonce on their scripts. The browser console shows the violations;
nothing is blocked.
- ⚠️ Behaviour change: in development mode, the console also shows two
reports that do not come from the app: the `eval` of the web components'
development mode detector, and, with Vite, the inline `onerror` reload
handler that Flow puts on the dev mode script. Both are tracked in
#27627.
- ⚠️ Behaviour change: in `warn` mode,
`IndexHtmlResponse.getContentSecurityPolicy()` and
`getContentSecurityPolicyNonce()` now return a value instead of `null`.
- ✅ No change in `off` mode, in `strict` mode in production mode, or
when a security framework provides the nonce.

**Context.** Follows the decisions of #27471: when a security framework
such as Spring Security provides the nonce, Vaadin uses it in every mode
and sends no policy of its own. With Spring Security, the app sends the
policy as report-only through `vaadin().contentSecurityPolicy(policy ->
{}, config -> config.reportOnly())`. No built-in endpoint for the
reports is added. The policy is only enforced in `strict` production
mode, because the dev server and the dev tools need `eval`; a
report-only policy blocks nothing, so it is sent in development mode.

- `IndexHtmlRequestHandler` creates the nonce and the policy in `warn`
mode too, and sends the policy as `Content-Security-Policy-Report-Only`
except in `strict` production mode, where it sends
`Content-Security-Policy`
- A report-only header that the response already has is kept, and a
warning naming the mode is logged once per handler, so a report-only
policy never fails the request
- An enforced `Content-Security-Policy` header of the app is left alone
when the policy is report-only; `strict` production mode still fails the
request for it
- Updated the Javadoc of `ContentSecurityPolicyMode`,
`IndexHtmlResponse`, `ContentSecurityPolicy` and
`VaadinSecurityConfigurer.contentSecurityPolicy()`
- The tests of the sent policy now also cover `warn` in production and
development mode and `strict` in development mode; the test that no
policy is sent now only covers `off`, since `warn` and `strict`
development mode send one

Working on behalf of @mcollovati

---------

Co-authored-by: totally-not-ai[bot] <290682512+totally-not-ai[bot]@users.noreply.github.com>
Co-authored-by: Artur Signell <artur@vaadin.com>
Co-authored-by: caalador <mikael.grankvist@vaadin.com>
Co-authored-by: Giovanni Lovato <giovanni@vaadin.com>
Co-authored-by: Marco Collovati <marco@vaadin.com>
Resolution notes:
- .github/workflows/README.md: conflicts were only the Diagram Bot table row and section; resolved by removing both, as the original PR does.
- diagram-bot.md and diagram-bot.lock.yml (modify/delete conflicts, the 25.4 copies differ slightly from main): deleted, as the original PR does.
- No tests are affected. The formatter and the Maven build were not run because the pick changes only CI workflow files and docs, no module sources.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vaadin-bot

Copy link
Copy Markdown
Collaborator Author

Auto merge (with 'rebase' method) is enabled for this PR, so it is merged once it is approved and its checks pass. Please review it and approve it, do not merge it manually. [Message is sent from bot]

@vaadin-bot

Copy link
Copy Markdown
Collaborator Author

Auto merge (with 'rebase' method) is enabled for this PR, so it is merged once it is approved and its checks pass. Please review it and approve it, do not merge it manually. [Message is sent from bot]

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Test Results

 1 662 files   - 33   1 753 suites   - 33   1h 40m 19s ⏱️ - 9m 40s
14 131 tests + 3  14 059 ✅ + 3  72 💤 ±0  0 ❌ ±0 
14 567 runs   - 70  14 495 ✅  - 70  72 💤 ±0  0 ❌ ±0 

Results for commit 8f920c1. ± Comparison against base commit c20e6ff.

@sonarqubecloud

sonarqubecloud Bot commented Dec 4, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants