Add types to CSP middleware params
This commit is contained in:
parent
ced75c83a7
commit
45e5742c9f
|
@ -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 }
|
||||
|
|
Loading…
Reference in New Issue