Skip to content

Bugfix/coep default header value#173

Merged
GaProgMan merged 17 commits into
GaProgMan:mainfrom
jamie-taylor-rjj:bugfix/coep-default-header-value
Jan 7, 2026
Merged

Bugfix/coep default header value#173
GaProgMan merged 17 commits into
GaProgMan:mainfrom
jamie-taylor-rjj:bugfix/coep-default-header-value

Conversation

@jamie-taylor-rjj

@jamie-taylor-rjj jamie-taylor-rjj commented Mar 29, 2025

Copy link
Copy Markdown
Collaborator

Rationale for this PR

This PR adds the Reporting-Endpoints header, configuration for it, updates the relevant documentation, and increases the version number.

This PR closes #170

The following is a minimal code sample for the new feature:

// in Program.cs
var reportingEndpoints =
    new Dictionary<string, Uri> {
        { "standard", new Uri("https://localhost:5000/reporting-endpoint") }
    };
var secureHeadersMiddlewareConfig = SecureHeadersMiddlewareBuilder.CreateBuilder()
    .UseReportingEndpointsPolicy(reportingEndpoints)
    .Build();
app.UseSecureHeadersMiddleware(secureHeadersMiddlewareConfig);

PR Checklist

Feel free to either check the following items (by place an x inside of the square brackets) or by replacing the square brackets with a relevant emoji from the following list:

  • ✅ to indicate that you have checked something off
  • ❎ to indicate that you haven't checked something off
  • ❓ to indicate that something might not be relevant (writing tests for documentation changes, for instance)

Essential

These items are essential and must be completed for each commit. If they are not completed, the PR may not be accepted.

  • [ ✅ ] I have added tests to the OwaspHeaders.Core.Tests project
  • [ ✅ ] I have run the dotnet-format command and fixed any .editorconfig issues
  • [ ✅ ] I have ensured that the code coverage has not dropped below 65%
  • [ ✅ ] I have increased the version number in OwaspHeaders.Core.csproj (only relevant for code changes)

Optional

  • [ ✅ ] I have documented the new feature in the docs directory
  • [ ✅ ] I have provided a code sample, showing how someone could use the new code

Any Other Information

This PR adds experimental functionality. Depending on feedback, it might not be closed.

Comment thread changelog.md Outdated
Comment thread docs/changelog.md Outdated
GaProgMan
GaProgMan previously approved these changes Aug 4, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements support for the experimental Reporting-Endpoints HTTP header, which allows website administrators to specify endpoints for receiving reports from the browser's Reporting API. The header is intended to work with Content Security Policy (CSP) and other security policies that can generate violation reports.

  • Adds ReportingEndpointsPolicy model with configuration and header value generation
  • Implements middleware support for the new header with UseReportingEndpointsPolicy extension method
  • Updates CSP configuration to support the modern report-to directive alongside the deprecated report-uri

Reviewed Changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/Models/ReportingEndpointsPolicy.cs New model class for configuring Reporting-Endpoints header with endpoint name-to-URI mappings
src/Extensions/SecureHeadersMiddlewareBuilder.cs Adds builder method for configuring Reporting-Endpoints policy and updates CSP methods
src/Models/ContentSecurityPolicyConfiguration.cs Adds support for report-to directive and marks report-uri as obsolete
src/Extensions/StringBuilderExtensions.cs New utility method for removing trailing characters from StringBuilder
tests/OwaspHeaders.Core.Tests/CustomHeaders/ReportingEndpointsTests.cs Test coverage for the new Reporting-Endpoints functionality
docs/configuration/ReportingEndpoints.md Documentation for the experimental header with appropriate warnings

Comment thread src/Models/ReportingEndpointsPolicy.cs Outdated
Comment thread src/Extensions/StringBuilderExtensions.cs Outdated
Comment thread docs/configuration/ReportingEndpoints.md Outdated
Comment thread changelog.md Outdated
Comment thread docs/changelog.md Outdated
@GaProgMan

Copy link
Copy Markdown
Owner

As PR #189 will likely be merged ahead of this one, we'll need a version bump on this PR.

@jamie-taylor-rjj jamie-taylor-rjj deleted the bugfix/coep-default-header-value branch October 1, 2025 12:29
@jamie-taylor-rjj jamie-taylor-rjj restored the bugfix/coep-default-header-value branch October 1, 2025 12:32
@jamie-taylor-rjj

Copy link
Copy Markdown
Collaborator Author

Deleted the wrong branch when trying to clean up. Sorry all.

@jamie-taylor-rjj jamie-taylor-rjj force-pushed the bugfix/coep-default-header-value branch from a2ed26f to fec46d6 Compare November 12, 2025 19:24
@GaProgMan

Copy link
Copy Markdown
Owner

Assuming the CI steps complete successfully, LGTM.

1 similar comment
@GaProgMan

Copy link
Copy Markdown
Owner

Assuming the CI steps complete successfully, LGTM.

@GaProgMan GaProgMan merged commit 786a0b8 into GaProgMan:main Jan 7, 2026
6 checks passed
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.

Feature Request: Add support for CSP report-to directive

3 participants