Skip to content

Conversation

@strantalis
Copy link
Member

@strantalis strantalis commented Dec 2, 2025

Proposed Changes

Add additionalheaders, additionalmethods, and additionalexposedheaders
fields to CORS config, allowing operators to append custom values without
replacing the entire default list.

  • Add mergeStringSlices() for case-sensitive method deduplication
  • Add mergeHeaderSlices() for case-insensitive header deduplication (RFC 7230)
  • Add Effective*() methods to compute merged values at runtime
  • Log effective CORS values at startup for operator visibility
  • Add unit tests for merge functions and Effective* methods
  • Update docs/Configuring.md with CORS configuration section

Operators can now add custom headers without copying all defaults:

server:
  cors: 
    additionalheaders: 
      - X-Custom-Header

Backwards compatible: existing configs work unchanged.

Checklist

  • I have added or updated unit tests
  • I have added or updated integration tests (if appropriate)
  • I have added or updated documentation

Testing Instructions

@github-actions github-actions bot added docs Documentation size/m labels Dec 2, 2025
@strantalis strantalis changed the title feat(server): add additive CORS configuration fields feat(core): add additive CORS configuration fields Dec 2, 2025
@strantalis
Copy link
Member Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a valuable feature by adding additive CORS configuration fields, allowing operators to extend default lists without replacing them. The implementation is robust, including correct handling of case-insensitive headers, comprehensive unit and integration tests, and clear documentation. I have one suggestion to refactor the slice merging logic to reduce code duplication, which would enhance maintainability. Overall, this is a well-executed and beneficial change.

  Add `additionalheaders`, `additionalmethods`, and `additionalexposedheaders`
  fields to CORS config, allowing operators to append custom values without
  replacing the entire default list.

  - Add mergeStringSlices() for case-sensitive method deduplication
  - Add mergeHeaderSlices() for case-insensitive header deduplication (RFC 7230)
  - Add Effective*() methods to compute merged values at runtime
  - Log effective CORS values at startup for operator visibility
  - Add unit tests for merge functions and Effective* methods
  - Update docs/Configuring.md with CORS configuration section

  Operators can now add custom headers without copying all defaults:

  ```yaml
  server:
    cors:
      additionalheaders:
        - X-Custom-Header

  Backwards compatible: existing configs work unchanged.
@strantalis strantalis force-pushed the dspx-1961/cors-enhancements branch from b3b0226 to 41bf81e Compare December 3, 2025 16:17
@strantalis strantalis marked this pull request as ready for review December 3, 2025 19:13
@strantalis strantalis requested a review from a team as a code owner December 3, 2025 19:13
@strantalis strantalis enabled auto-merge December 4, 2025 14:29
@strantalis strantalis added this pull request to the merge queue Dec 4, 2025
Merged via the queue into opentdf:main with commit d45a34b Dec 4, 2025
39 checks passed
@strantalis strantalis deleted the dspx-1961/cors-enhancements branch December 4, 2025 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation size/m

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants