@appwarden/middleware 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,7 +14,7 @@ var debug = (...msg) => {
14
14
  };
15
15
 
16
16
  // src/utils/print-message.ts
17
- var addSlashes = (str) => str.replace(/[\\"'`]/g, "\\$&").replace(/\u0000/g, "\\0");
17
+ var addSlashes = (str) => str.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$").replace(/"/g, '\\"').replace(/'/g, "\\'").replace(/\u0000/g, "\\0").replace(/<\/script>/gi, "<\\/script>");
18
18
  var printMessage = (message) => `[@appwarden/middleware] ${addSlashes(message)}`;
19
19
 
20
20
  export {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  debug,
3
3
  printMessage
4
- } from "./chunk-JWUAFJ2E.js";
4
+ } from "./chunk-FDIKUQ3E.js";
5
5
 
6
6
  // src/schemas/use-content-security-policy.ts
7
7
  import { z as z2 } from "zod";
@@ -125,7 +125,7 @@ var useContentSecurityPolicy = (input) => {
125
125
  if (response.headers.has("Content-Type") && !response.headers.get("Content-Type")?.includes("text/html")) {
126
126
  return;
127
127
  }
128
- const cspNonce = btoa(crypto.getRandomValues(new Uint32Array(2)).toString());
128
+ const cspNonce = crypto.randomUUID();
129
129
  const [cspHeaderName, cspHeaderValue] = makeCSPHeader(
130
130
  cspNonce,
131
131
  config.directives,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  LOCKDOWN_TEST_EXPIRY_MS
3
- } from "./chunk-JWUAFJ2E.js";
3
+ } from "./chunk-FDIKUQ3E.js";
4
4
 
5
5
  // src/utils/errors.ts
6
6
  var errorsMap = {
package/cloudflare.js CHANGED
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  useContentSecurityPolicy
3
- } from "./chunk-NZNMFDZ7.js";
3
+ } from "./chunk-GTGPYCQY.js";
4
4
  import {
5
5
  BooleanSchema,
6
6
  LockValue,
7
7
  MemoryCache,
8
8
  getErrors
9
- } from "./chunk-47MLTBFC.js";
9
+ } from "./chunk-L6RSRHOF.js";
10
10
  import {
11
11
  APPWARDEN_CACHE_KEY,
12
12
  APPWARDEN_TEST_ROUTE,
13
13
  APPWARDEN_USER_AGENT,
14
14
  debug,
15
15
  printMessage
16
- } from "./chunk-JWUAFJ2E.js";
16
+ } from "./chunk-FDIKUQ3E.js";
17
17
 
18
18
  // src/runners/appwarden-on-cloudflare.ts
19
19
  import { ZodError } from "zod";
package/index.js CHANGED
@@ -7,12 +7,12 @@ import {
7
7
  CSPDirectivesSchema,
8
8
  CSPModeSchema,
9
9
  useContentSecurityPolicy
10
- } from "./chunk-NZNMFDZ7.js";
10
+ } from "./chunk-GTGPYCQY.js";
11
11
  import {
12
12
  APPWARDEN_CACHE_KEY,
13
13
  APPWARDEN_USER_AGENT,
14
14
  LOCKDOWN_TEST_EXPIRY_MS
15
- } from "./chunk-JWUAFJ2E.js";
15
+ } from "./chunk-FDIKUQ3E.js";
16
16
  export {
17
17
  APPWARDEN_CACHE_KEY,
18
18
  APPWARDEN_USER_AGENT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appwarden/middleware",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "Instantly shut off access your app deployed on Cloudflare or Vercel",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/vercel.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  LockValue,
8
8
  MemoryCache,
9
9
  getErrors
10
- } from "./chunk-47MLTBFC.js";
10
+ } from "./chunk-L6RSRHOF.js";
11
11
  import {
12
12
  APPWARDEN_CACHE_KEY,
13
13
  APPWARDEN_TEST_ROUTE,
@@ -16,7 +16,7 @@ import {
16
16
  errors,
17
17
  globalErrors,
18
18
  printMessage
19
- } from "./chunk-JWUAFJ2E.js";
19
+ } from "./chunk-FDIKUQ3E.js";
20
20
 
21
21
  // src/runners/appwarden-on-vercel.ts
22
22
  import { NextResponse } from "next/server";