Add types to CSP middleware params

This commit is contained in:
Andrew Kingston 2025-04-08 09:59:01 +01:00
parent ced75c83a7
commit 45e5742c9f
No known key found for this signature in database
1 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,7 @@
import crypto from "crypto"
import { app } from "../cache"
import { Feature } from "@budibase/types"
import { Feature, Ctx } from "@budibase/types"
import { Next } from "koa"
const CSP_DIRECTIVES = {
"default-src": ["'self'"],
@ -88,7 +89,7 @@ const CSP_DIRECTIVES = {
"worker-src": ["blob:"],
}
export async function contentSecurityPolicy(ctx: any, next: any) {
export async function contentSecurityPolicy(ctx: Ctx, next: Next) {
const nonce = crypto.randomBytes(16).toString("base64")
ctx.state.nonce = nonce
let directives = { ...CSP_DIRECTIVES }