INNER CODE UNIT · Python

CSPMiddleware

Nuclear-Marmalade/dataforge · forge/dashboard/app.py:31

class CSPMiddleware(BaseHTTPMiddleware):
    async def dispatch(self, request, call_next):
        response = await call_next(request)
        response.headers["Content-Security-Policy"] = (
            "default-src 'self'; script-src 'self' https://cdn.tailwindcss.com https://unpkg.com; style-src 'self' 'unsafe-inline'"
        )
        response.headers["X-Content-Type-Options"] = "nosniff"
        return response


app.add_middleware(CSPMiddleware)

_HERE = Path(__file__).parent
templates = Jinja2Templates(directory=str(_HERE / "templates"))
app.mount("/static", StaticFiles(directory=str(_HERE / "static")), name="static")

# ── Industry whitelist (matches enrichment/pipeline.py) ────────────────────

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…