Skip to content

src/dazzle_back/runtime/security_middleware.py

Generated: 2026-03-30T04:38:48.146797+00:00

Commit: 615f1354a103

Language: python

Scope: dazzle_back

Purpose

Security middleware for DNR-Back applications.

Provides configurable security based on security profile: - Security headers (X-Frame-Options, X-Content-Type-Options, HSTS, CSP) - CORS configuration - Request origin validation

Key Exports

  • SecurityHeadersConfig
  • CORSConfig
  • configure_cors_for_profile
  • configure_headers_for_profile
  • create_security_headers_middleware
  • apply_security_middleware
  • SecurityHeadersMiddleware
  • dispatch

Dependencies

Imports

  • __future__.annotations
  • dataclasses.dataclass
  • typing.Any
  • starlette.middleware.base.BaseHTTPMiddleware
  • starlette.requests.Request
  • starlette.responses.Response
  • fastapi.middleware.cors.CORSMiddleware

Event Interactions

None detected.

Invariants and Assumptions

  • allow_origins=custom_origins, # Must be explicitly configured

Tests

  • tests/integration/test_runtime_e2e.py
  • tests/integration/test_runtime_pipeline.py
  • tests/unit/test_runtime_test_routes.py
  • tests/unit/test_runtime_services.py
  • tests/unit/test_runtime_mcp_tools.py

Notes

This page was automatically generated by tools/gen_reference_docs.py.