Skip to content

OGSEC-39 Add anti-clickjacking security headers to ZGW API - #208

Open
roxit-ai-agent wants to merge 1 commit into
mainfrom
OGSEC-39-anti-clickjacking-headers
Open

OGSEC-39 Add anti-clickjacking security headers to ZGW API#208
roxit-ai-agent wants to merge 1 commit into
mainfrom
OGSEC-39-anti-clickjacking-headers

Conversation

@roxit-ai-agent

Copy link
Copy Markdown

Pull Request

Description

Introduce a SecurityHeadersMiddleware in OneGround.ZGW.Common.Web that sets X-Frame-Options: DENY and Content-Security-Policy: frame-ancestors 'none' via Response.OnStarting, and wire it as the first call in ConfigureZgwApi so every ZGW API host (and its Swagger UI and error responses) emits the headers.

The headers are set through OnStarting and assigned (not added) so they survive the response re-executed by UseExceptionHandler and cannot be duplicated by a second registration. Adds unit tests covering a successful response and an exception-handled response.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation

Related Issues

Testing

  • Tests pass
  • Manual testing completed

Checklist

  • Self-review completed
  • Documentation updated (if needed)

…eline

Introduce a SecurityHeadersMiddleware in OneGround.ZGW.Common.Web that sets
X-Frame-Options: DENY and Content-Security-Policy: frame-ancestors 'none' via
Response.OnStarting, and wire it as the first call in ConfigureZgwApi so every
ZGW API host (and its Swagger UI and error responses) emits the headers.

The headers are set through OnStarting and assigned (not added) so they survive
the response re-executed by UseExceptionHandler and cannot be duplicated by a
second registration. Adds unit tests covering a successful response and an
exception-handled response.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: roxit-ai-agent <316607320+roxit-ai-agent@users.noreply.github.com>
@Grabauskas
Grabauskas force-pushed the OGSEC-39-anti-clickjacking-headers branch from f6bd2eb to b4de562 Compare August 13, 2026 14:46
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.

1 participant