Skip to content

Bugfix/data directive#186

Merged
GaProgMan merged 7 commits into
GaProgMan:mainfrom
jamie-taylor-rjj:bugfix/data-directive
Aug 28, 2025
Merged

Bugfix/data directive#186
GaProgMan merged 7 commits into
GaProgMan:mainfrom
jamie-taylor-rjj:bugfix/data-directive

Conversation

@jamie-taylor-rjj

Copy link
Copy Markdown
Collaborator

Rationale for this PR

This PR adds some extra documentation around the Content-Security-Policy header values and how they are used by the header. It is related to bug #185, but does not close it.

As this is a documentation only change, I have increased the patch version number and updated relevant changelogs only.

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)
  • [ ✅ ] I have updated the changelog in the root of the repository
  • [ ✅ ] I have avoided using primary constructors in the example project (see README for details)

Note

The changelog in the docs/ directory will be updated automatically when PRs are merged into main.

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

N/A

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 enhances the documentation and testing for Content-Security-Policy (CSP) header generation, specifically clarifying the difference between directive keywords and URI sources in CSP configuration.

  • Adds comprehensive XML documentation to ContentSecurityPolicyElement and CspCommandType enum explaining when to use each type
  • Modernizes test code by replacing new List<> with collection expressions ([])
  • Adds four new regression tests that verify proper quoting behavior for directive vs URI elements
  • Updates documentation with detailed examples of CSP directive and URI configuration patterns

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/OwaspHeaders.Core.Tests/RegressionTests/CspRegressionTests.cs Updates existing tests to use collection expressions and adds new tests verifying CSP directive/URI quoting behavior
src/OwaspHeaders.Core.csproj Bumps patch version from 9.8.1 to 9.8.2
src/Models/ContentSecurityPolicyElement.cs Adds XML documentation explaining the purpose and usage of CommandType and DirectiveOrUri properties
src/Enums/CspCommandType.cs Adds XML documentation clarifying when to use Directive vs Uri enum values
docs/configuration/Content-Security-Policy.md Expands documentation with detailed examples and explanations of directive vs URI configuration
docs/changelog.md Updates changelog to document the increased CSP documentation coverage
changelog.md Updates root changelog with same CSP documentation improvements

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread tests/OwaspHeaders.Core.Tests/RegressionTests/CspRegressionTests.cs Outdated
Comment thread docs/changelog.md Outdated
Comment thread docs/changelog.md Outdated
@GaProgMan GaProgMan merged commit 5918bd2 into GaProgMan:main Aug 28, 2025
6 checks passed
@jamie-taylor-rjj jamie-taylor-rjj deleted the bugfix/data-directive branch August 28, 2025 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants