Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -0,0 +1,15 @@
|
||||
import { randomBytes } from "node:crypto";
|
||||
|
||||
import { CSP_NONCE_REQUEST_HEADER, isValidCspNonce } from "../apps/web/app/utils/security/contentSecurityPolicy";
|
||||
|
||||
export function createRequestCspNonce(): string {
|
||||
return randomBytes(18).toString("base64url");
|
||||
}
|
||||
|
||||
export function overwriteRequestCspNonce(headers: Headers, nonce = createRequestCspNonce()): string {
|
||||
if (!isValidCspNonce(nonce)) {
|
||||
throw new Error("Request CSP nonce has an invalid format.");
|
||||
}
|
||||
headers.set(CSP_NONCE_REQUEST_HEADER, nonce);
|
||||
return nonce;
|
||||
}
|
||||
Reference in new issue
Block a user