Skip to content

v2: Adapt to core CSP API (JENKINS-76263)#63

Merged
daniel-beck merged 23 commits intojenkinsci:mainfrom
daniel-beck:v2
Nov 26, 2025
Merged

v2: Adapt to core CSP API (JENKINS-76263)#63
daniel-beck merged 23 commits intojenkinsci:mainfrom
daniel-beck:v2

Conversation

@daniel-beck
Copy link
Member

@daniel-beck daniel-beck commented Nov 5, 2025

This adapts CSP plugin to jenkinsci/jenkins#11269. It is basically an entire rewrite of the plugin. With the core change, there's no reason for the v1 implementation to continue to exist.

Instead of setting the header etc., it now builds on top of the infrastructure provided by core:

  • For Receiver (core API), the plugin now provides a UI (same UI as before), rather than the bare minimum Logger-based implementation in core.
  • For Contributor (core API), the plugin now allows configuring individual rule changes (as an AdvancedConfiguration implementation), rather than needing admins to edit the entire expression. Changes to CspBuilder are managed from ContentSecurityPolicyContributor as entrypoint.
  • There's another AdvancedConfiguration that allows dropping reports from anonymous users for the reports UI.

Open tasks:

  • Depend on core incremental build to make CI pass
  • Make this work nicely with https://plugins.jenkins.io/configuration-as-code/
  • Autotest coverage
  • Before merging:
    • Replace 2.TODO core version number placeholders in documentation
    • Replace core dependency with released weekly

@daniel-beck daniel-beck mentioned this pull request Nov 14, 2025
@daniel-beck daniel-beck marked this pull request as ready for review November 14, 2025 20:45
@daniel-beck daniel-beck requested a review from a team as a code owner November 14, 2025 20:45
daniel-beck and others added 7 commits November 16, 2025 12:11
- Move `ValueSpecifier` into its own top-level class
- Add `AllowNavigationRule`, similar to `AllowFetchRule`,
  but limits `ValueSpecifierDescriptor` to those that matter.
- Bugfix: Only apply `ByDomain` if it's valid also for non-admins
@daniel-beck
Copy link
Member Author

daniel-beck commented Nov 25, 2025

Note: This is currently pending final review and testing and will be released ASAP. Anyone who wants to use the plugin in Jenkins 2.539 can download an "incremental" PR build from https://repo.jenkins-ci.org/artifactory/incrementals/io/jenkins/plugins/csp/

Copy link

@Kevin-CB Kevin-CB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the plugin locally, tried different custom rules, everything seems to works properly.

@daniel-beck daniel-beck merged commit ab326b5 into jenkinsci:main Nov 26, 2025
17 checks passed
@daniel-beck daniel-beck deleted the v2 branch November 26, 2025 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants