@appwarden/middleware 1.0.18 → 1.1.0
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.
- package/chunk-BHCQJZWE.js +358 -0
- package/chunk-WVVSYKJM.js +525 -0
- package/cloudflare.d.ts +8 -11
- package/cloudflare.js +54 -6
- package/index.d.ts +15 -5
- package/index.js +14 -4
- package/package.json +1 -1
- package/use-content-security-policy-DBWKjDEH.d.ts +509 -0
- package/vercel.d.ts +6 -12
- package/vercel.js +82 -5
- package/chunk-C7APN7T6.js +0 -821
- package/chunk-JXIVUR6E.js +0 -186
- package/cloudflare-hVS30fDq.d.ts +0 -99
- package/nextjs-on-pages.d.ts +0 -30
- package/nextjs-on-pages.js +0 -10
- package/use-content-security-policy-BtEGGIeu.d.ts +0 -245
package/chunk-JXIVUR6E.js
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AppwardenConfigSchema,
|
|
3
|
-
CloudflareConfigFnOutputSchema,
|
|
4
|
-
MemoryCache,
|
|
5
|
-
NextJsConfigFnOutputSchema,
|
|
6
|
-
createResponse,
|
|
7
|
-
debug,
|
|
8
|
-
globalErrors,
|
|
9
|
-
handleResetCache,
|
|
10
|
-
handleVercelRequest,
|
|
11
|
-
isResetCacheRequest,
|
|
12
|
-
maybeQuarantine,
|
|
13
|
-
printMessage,
|
|
14
|
-
renderLockPage,
|
|
15
|
-
store,
|
|
16
|
-
syncEdgeValue,
|
|
17
|
-
useAppwarden,
|
|
18
|
-
usePipeline
|
|
19
|
-
} from "./chunk-C7APN7T6.js";
|
|
20
|
-
|
|
21
|
-
// src/runners/appwarden-on-cloudflare.ts
|
|
22
|
-
var appwardenOnCloudflare = (inputFn) => async (request, env, ctx) => {
|
|
23
|
-
const parsedInput = CloudflareConfigFnOutputSchema.safeParse(inputFn);
|
|
24
|
-
if (!parsedInput.success) {
|
|
25
|
-
throw new Error(
|
|
26
|
-
printMessage(`Input validation failed ${parsedInput.error.message}`)
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
const context = {
|
|
30
|
-
request,
|
|
31
|
-
hostname: new URL(request.url).host,
|
|
32
|
-
response: new Response("Unhandled response"),
|
|
33
|
-
// https://developers.cloudflare.com/workers/observability/errors/#illegal-invocation-errors
|
|
34
|
-
waitUntil: (fn) => ctx.waitUntil(fn)
|
|
35
|
-
};
|
|
36
|
-
try {
|
|
37
|
-
const input = parsedInput.data({ env, ctx, cf: {} });
|
|
38
|
-
const pipeline = [...input.middleware.before, useAppwarden(input)];
|
|
39
|
-
await usePipeline(...pipeline).execute(context);
|
|
40
|
-
} catch (error) {
|
|
41
|
-
if (error instanceof Error) {
|
|
42
|
-
context.response = createResponse(error.message, 500);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return context.response;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// src/runners/appwarden-on-pages-next-js.ts
|
|
49
|
-
import { getRequestContext } from "@cloudflare/next-on-pages";
|
|
50
|
-
import { NextResponse } from "next/server";
|
|
51
|
-
debug("Instantiating isolate");
|
|
52
|
-
var appwardenOnPagesNextJs = (inputFn) => async (request, event) => {
|
|
53
|
-
const parsedInput = NextJsConfigFnOutputSchema.safeParse(inputFn);
|
|
54
|
-
if (!parsedInput.success) {
|
|
55
|
-
console.error(
|
|
56
|
-
printMessage(`Input validation failed ${parsedInput.error.message}`)
|
|
57
|
-
);
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
const input = parsedInput.data(getRequestContext());
|
|
61
|
-
try {
|
|
62
|
-
const requestUrl = new URL(request.url);
|
|
63
|
-
const provider = "cloudflare-cache";
|
|
64
|
-
const keyName = "appwarden-lock";
|
|
65
|
-
const edgeCache = store.json(
|
|
66
|
-
{
|
|
67
|
-
serviceOrigin: requestUrl.origin,
|
|
68
|
-
cache: await caches.open("appwarden:lock")
|
|
69
|
-
},
|
|
70
|
-
keyName
|
|
71
|
-
);
|
|
72
|
-
if (isResetCacheRequest(request)) {
|
|
73
|
-
await handleResetCache(keyName, provider, edgeCache, request);
|
|
74
|
-
return NextResponse.next();
|
|
75
|
-
}
|
|
76
|
-
const acceptHeader = request.headers.get("accept");
|
|
77
|
-
const isHTMLRequest = acceptHeader?.includes("text/html");
|
|
78
|
-
debug({
|
|
79
|
-
acceptHeader,
|
|
80
|
-
isHTMLRequest,
|
|
81
|
-
url: requestUrl.pathname
|
|
82
|
-
});
|
|
83
|
-
if (isHTMLRequest) {
|
|
84
|
-
let appwardenResponse = void 0;
|
|
85
|
-
const context = {
|
|
86
|
-
keyName,
|
|
87
|
-
request,
|
|
88
|
-
edgeCache,
|
|
89
|
-
requestUrl,
|
|
90
|
-
provider,
|
|
91
|
-
waitUntil: (fn) => event.waitUntil(fn),
|
|
92
|
-
...input
|
|
93
|
-
};
|
|
94
|
-
await maybeQuarantine(context, {
|
|
95
|
-
onLocked: async () => {
|
|
96
|
-
appwardenResponse = renderLockPage(context);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
if (appwardenResponse) {
|
|
100
|
-
return appwardenResponse;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
} catch (e) {
|
|
104
|
-
const message = "Appwarden encountered an unknown error. Please contact Appwarden support at https://appwarden.io/join-community.";
|
|
105
|
-
console.error(
|
|
106
|
-
printMessage(
|
|
107
|
-
e instanceof Error ? `${message} - ${e.message}
|
|
108
|
-
${e.stack}` : message
|
|
109
|
-
)
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
return NextResponse.next();
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
// src/runners/appwarden-on-vercel.ts
|
|
116
|
-
import { NextResponse as NextResponse2 } from "next/server";
|
|
117
|
-
debug("Instantiating isolate");
|
|
118
|
-
var renderLockPage2 = (context) => {
|
|
119
|
-
context.req.nextUrl.pathname = context.lockPageSlug;
|
|
120
|
-
return NextResponse2.rewrite(context.req.nextUrl, {
|
|
121
|
-
headers: {
|
|
122
|
-
// no browser caching, otherwise we need to hard refresh to disable lock screen
|
|
123
|
-
"Cache-Control": "no-store"
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
|
-
var memoryCache = new MemoryCache({ maxSize: 1 });
|
|
128
|
-
var appwardenOnVercel = (input) => async (req, event) => {
|
|
129
|
-
const parsedConfig = AppwardenConfigSchema.safeParse(input);
|
|
130
|
-
if (!parsedConfig.success) {
|
|
131
|
-
console.error(
|
|
132
|
-
printMessage(`Input validation failed ${parsedConfig.error.message}`)
|
|
133
|
-
);
|
|
134
|
-
return null;
|
|
135
|
-
}
|
|
136
|
-
try {
|
|
137
|
-
const requestUrl = new URL(req.url);
|
|
138
|
-
const acceptHeader = req.headers.get("accept");
|
|
139
|
-
const isHTMLRequest = acceptHeader?.includes("text/html");
|
|
140
|
-
debug({
|
|
141
|
-
acceptHeader,
|
|
142
|
-
isHTMLRequest,
|
|
143
|
-
url: requestUrl.pathname
|
|
144
|
-
});
|
|
145
|
-
if (isHTMLRequest) {
|
|
146
|
-
let appwardenResponse = void 0;
|
|
147
|
-
const context = {
|
|
148
|
-
req,
|
|
149
|
-
event,
|
|
150
|
-
requestUrl,
|
|
151
|
-
memoryCache,
|
|
152
|
-
waitUntil: (fn) => event.waitUntil(fn),
|
|
153
|
-
keyName: "appwarden-lock",
|
|
154
|
-
...parsedConfig.data
|
|
155
|
-
};
|
|
156
|
-
const cacheValue = await handleVercelRequest(context, {
|
|
157
|
-
onLocked: () => {
|
|
158
|
-
appwardenResponse = renderLockPage2(context);
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
const shouldRecheck = MemoryCache.isExpired(cacheValue);
|
|
162
|
-
if (!cacheValue || shouldRecheck) {
|
|
163
|
-
event.waitUntil(syncEdgeValue(context));
|
|
164
|
-
}
|
|
165
|
-
if (appwardenResponse) {
|
|
166
|
-
return appwardenResponse;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
} catch (e) {
|
|
170
|
-
const message = "Appwarden encountered an unknown error. Please contact Appwarden support at https://appwarden.io/join-community.";
|
|
171
|
-
if (e instanceof Error) {
|
|
172
|
-
if (!globalErrors.includes(e.message)) {
|
|
173
|
-
console.error(printMessage(`${message} - ${e.message}`));
|
|
174
|
-
}
|
|
175
|
-
} else {
|
|
176
|
-
console.error(printMessage(message));
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return NextResponse2.next();
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
export {
|
|
183
|
-
appwardenOnCloudflare,
|
|
184
|
-
appwardenOnPagesNextJs,
|
|
185
|
-
appwardenOnVercel
|
|
186
|
-
};
|
package/cloudflare-hVS30fDq.d.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
declare const ContentSecurityPolicySchema: z.ZodObject<{
|
|
4
|
-
"default-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
5
|
-
"script-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
6
|
-
"style-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
7
|
-
"img-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
8
|
-
"connect-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
9
|
-
"font-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
10
|
-
"object-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
11
|
-
"media-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
12
|
-
"frame-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
13
|
-
sandbox: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
14
|
-
"report-uri": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
15
|
-
"child-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
16
|
-
"form-action": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
17
|
-
"frame-ancestors": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
18
|
-
"plugin-types": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
19
|
-
"base-uri": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
20
|
-
"report-to": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
21
|
-
"worker-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
22
|
-
"manifest-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
23
|
-
"prefetch-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
24
|
-
"navigate-to": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
25
|
-
"require-sri-for": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
26
|
-
"block-all-mixed-content": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
27
|
-
"upgrade-insecure-requests": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
28
|
-
"trusted-types": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
29
|
-
"require-trusted-types-for": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
30
|
-
}, "strip", z.ZodTypeAny, {
|
|
31
|
-
"default-src"?: string | boolean | string[] | undefined;
|
|
32
|
-
"script-src"?: string | boolean | string[] | undefined;
|
|
33
|
-
"style-src"?: string | boolean | string[] | undefined;
|
|
34
|
-
"img-src"?: string | boolean | string[] | undefined;
|
|
35
|
-
"connect-src"?: string | boolean | string[] | undefined;
|
|
36
|
-
"font-src"?: string | boolean | string[] | undefined;
|
|
37
|
-
"object-src"?: string | boolean | string[] | undefined;
|
|
38
|
-
"media-src"?: string | boolean | string[] | undefined;
|
|
39
|
-
"frame-src"?: string | boolean | string[] | undefined;
|
|
40
|
-
sandbox?: string | boolean | string[] | undefined;
|
|
41
|
-
"report-uri"?: string | boolean | string[] | undefined;
|
|
42
|
-
"child-src"?: string | boolean | string[] | undefined;
|
|
43
|
-
"form-action"?: string | boolean | string[] | undefined;
|
|
44
|
-
"frame-ancestors"?: string | boolean | string[] | undefined;
|
|
45
|
-
"plugin-types"?: string | boolean | string[] | undefined;
|
|
46
|
-
"base-uri"?: string | boolean | string[] | undefined;
|
|
47
|
-
"report-to"?: string | boolean | string[] | undefined;
|
|
48
|
-
"worker-src"?: string | boolean | string[] | undefined;
|
|
49
|
-
"manifest-src"?: string | boolean | string[] | undefined;
|
|
50
|
-
"prefetch-src"?: string | boolean | string[] | undefined;
|
|
51
|
-
"navigate-to"?: string | boolean | string[] | undefined;
|
|
52
|
-
"require-sri-for"?: string | boolean | string[] | undefined;
|
|
53
|
-
"block-all-mixed-content"?: string | boolean | string[] | undefined;
|
|
54
|
-
"upgrade-insecure-requests"?: string | boolean | string[] | undefined;
|
|
55
|
-
"trusted-types"?: string | boolean | string[] | undefined;
|
|
56
|
-
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
57
|
-
}, {
|
|
58
|
-
"default-src"?: string | boolean | string[] | undefined;
|
|
59
|
-
"script-src"?: string | boolean | string[] | undefined;
|
|
60
|
-
"style-src"?: string | boolean | string[] | undefined;
|
|
61
|
-
"img-src"?: string | boolean | string[] | undefined;
|
|
62
|
-
"connect-src"?: string | boolean | string[] | undefined;
|
|
63
|
-
"font-src"?: string | boolean | string[] | undefined;
|
|
64
|
-
"object-src"?: string | boolean | string[] | undefined;
|
|
65
|
-
"media-src"?: string | boolean | string[] | undefined;
|
|
66
|
-
"frame-src"?: string | boolean | string[] | undefined;
|
|
67
|
-
sandbox?: string | boolean | string[] | undefined;
|
|
68
|
-
"report-uri"?: string | boolean | string[] | undefined;
|
|
69
|
-
"child-src"?: string | boolean | string[] | undefined;
|
|
70
|
-
"form-action"?: string | boolean | string[] | undefined;
|
|
71
|
-
"frame-ancestors"?: string | boolean | string[] | undefined;
|
|
72
|
-
"plugin-types"?: string | boolean | string[] | undefined;
|
|
73
|
-
"base-uri"?: string | boolean | string[] | undefined;
|
|
74
|
-
"report-to"?: string | boolean | string[] | undefined;
|
|
75
|
-
"worker-src"?: string | boolean | string[] | undefined;
|
|
76
|
-
"manifest-src"?: string | boolean | string[] | undefined;
|
|
77
|
-
"prefetch-src"?: string | boolean | string[] | undefined;
|
|
78
|
-
"navigate-to"?: string | boolean | string[] | undefined;
|
|
79
|
-
"require-sri-for"?: string | boolean | string[] | undefined;
|
|
80
|
-
"block-all-mixed-content"?: string | boolean | string[] | undefined;
|
|
81
|
-
"upgrade-insecure-requests"?: string | boolean | string[] | undefined;
|
|
82
|
-
"trusted-types"?: string | boolean | string[] | undefined;
|
|
83
|
-
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
84
|
-
}>;
|
|
85
|
-
type ContentSecurityPolicyType = z.infer<typeof ContentSecurityPolicySchema>;
|
|
86
|
-
|
|
87
|
-
declare global {
|
|
88
|
-
interface CloudflareEnv extends Bindings {
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
type Bindings = {
|
|
92
|
-
DEBUG: string | boolean;
|
|
93
|
-
LOCK_PAGE_SLUG: string;
|
|
94
|
-
CSP_ENFORCED: string | boolean;
|
|
95
|
-
CSP_DIRECTIVES: string | ContentSecurityPolicyType;
|
|
96
|
-
APPWARDEN_API_TOKEN: string;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export type { Bindings as B };
|
package/nextjs-on-pages.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as next_server from 'next/server';
|
|
2
|
-
import './cloudflare-hVS30fDq.js';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
|
|
5
|
-
declare const NextJsConfigFnOutputSchema: z.ZodFunction<z.ZodTuple<[z.ZodType<{
|
|
6
|
-
env: CloudflareEnv;
|
|
7
|
-
cf: Record<string, unknown>;
|
|
8
|
-
ctx: unknown;
|
|
9
|
-
}, z.ZodTypeDef, {
|
|
10
|
-
env: CloudflareEnv;
|
|
11
|
-
cf: Record<string, unknown>;
|
|
12
|
-
ctx: unknown;
|
|
13
|
-
}>], z.ZodUnknown>, z.ZodObject<{
|
|
14
|
-
debug: z.ZodDefault<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>, boolean, string | boolean | undefined>>;
|
|
15
|
-
appwardenApiToken: z.ZodEffects<z.ZodString, string, string>;
|
|
16
|
-
lockPageSlug: z.ZodString;
|
|
17
|
-
}, "strip", z.ZodTypeAny, {
|
|
18
|
-
lockPageSlug: string;
|
|
19
|
-
appwardenApiToken: string;
|
|
20
|
-
debug: boolean;
|
|
21
|
-
}, {
|
|
22
|
-
lockPageSlug: string;
|
|
23
|
-
appwardenApiToken: string;
|
|
24
|
-
debug?: string | boolean | undefined;
|
|
25
|
-
}>>;
|
|
26
|
-
type NextJsConfigFnType = z.infer<typeof NextJsConfigFnOutputSchema>;
|
|
27
|
-
|
|
28
|
-
declare const withAppwardenOnNextJs: (inputFn: NextJsConfigFnType) => next_server.NextMiddleware;
|
|
29
|
-
|
|
30
|
-
export { withAppwardenOnNextJs };
|
package/nextjs-on-pages.js
DELETED
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import './cloudflare-hVS30fDq.js';
|
|
3
|
-
|
|
4
|
-
interface MiddlewareContext {
|
|
5
|
-
hostname: string;
|
|
6
|
-
request: Request;
|
|
7
|
-
response: Response;
|
|
8
|
-
waitUntil: ExecutionContext["waitUntil"];
|
|
9
|
-
}
|
|
10
|
-
type Middleware = (context: MiddlewareContext, next: () => MiddlewareNextSchemaType) => MiddlewareNextSchemaType;
|
|
11
|
-
declare const MiddlewareNextSchema: z.ZodUnion<[z.ZodVoid, z.ZodNull, z.ZodPromise<z.ZodUnion<[z.ZodVoid, z.ZodNull]>>]>;
|
|
12
|
-
type MiddlewareNextSchemaType = z.infer<typeof MiddlewareNextSchema>;
|
|
13
|
-
|
|
14
|
-
declare const CSPDirectivesSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
15
|
-
"default-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
16
|
-
"script-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
17
|
-
"style-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
18
|
-
"img-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
19
|
-
"connect-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
20
|
-
"font-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
21
|
-
"object-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
22
|
-
"media-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
23
|
-
"frame-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
24
|
-
sandbox: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
25
|
-
"report-uri": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
26
|
-
"child-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
27
|
-
"form-action": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
28
|
-
"frame-ancestors": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
29
|
-
"plugin-types": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
30
|
-
"base-uri": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
31
|
-
"report-to": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
32
|
-
"worker-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
33
|
-
"manifest-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
34
|
-
"prefetch-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
35
|
-
"navigate-to": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
36
|
-
"require-sri-for": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
37
|
-
"block-all-mixed-content": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
38
|
-
"upgrade-insecure-requests": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
39
|
-
"trusted-types": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
40
|
-
"require-trusted-types-for": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
41
|
-
}, "strip", z.ZodTypeAny, {
|
|
42
|
-
"default-src"?: string | boolean | string[] | undefined;
|
|
43
|
-
"script-src"?: string | boolean | string[] | undefined;
|
|
44
|
-
"style-src"?: string | boolean | string[] | undefined;
|
|
45
|
-
"img-src"?: string | boolean | string[] | undefined;
|
|
46
|
-
"connect-src"?: string | boolean | string[] | undefined;
|
|
47
|
-
"font-src"?: string | boolean | string[] | undefined;
|
|
48
|
-
"object-src"?: string | boolean | string[] | undefined;
|
|
49
|
-
"media-src"?: string | boolean | string[] | undefined;
|
|
50
|
-
"frame-src"?: string | boolean | string[] | undefined;
|
|
51
|
-
sandbox?: string | boolean | string[] | undefined;
|
|
52
|
-
"report-uri"?: string | boolean | string[] | undefined;
|
|
53
|
-
"child-src"?: string | boolean | string[] | undefined;
|
|
54
|
-
"form-action"?: string | boolean | string[] | undefined;
|
|
55
|
-
"frame-ancestors"?: string | boolean | string[] | undefined;
|
|
56
|
-
"plugin-types"?: string | boolean | string[] | undefined;
|
|
57
|
-
"base-uri"?: string | boolean | string[] | undefined;
|
|
58
|
-
"report-to"?: string | boolean | string[] | undefined;
|
|
59
|
-
"worker-src"?: string | boolean | string[] | undefined;
|
|
60
|
-
"manifest-src"?: string | boolean | string[] | undefined;
|
|
61
|
-
"prefetch-src"?: string | boolean | string[] | undefined;
|
|
62
|
-
"navigate-to"?: string | boolean | string[] | undefined;
|
|
63
|
-
"require-sri-for"?: string | boolean | string[] | undefined;
|
|
64
|
-
"block-all-mixed-content"?: string | boolean | string[] | undefined;
|
|
65
|
-
"upgrade-insecure-requests"?: string | boolean | string[] | undefined;
|
|
66
|
-
"trusted-types"?: string | boolean | string[] | undefined;
|
|
67
|
-
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
68
|
-
}, {
|
|
69
|
-
"default-src"?: string | boolean | string[] | undefined;
|
|
70
|
-
"script-src"?: string | boolean | string[] | undefined;
|
|
71
|
-
"style-src"?: string | boolean | string[] | undefined;
|
|
72
|
-
"img-src"?: string | boolean | string[] | undefined;
|
|
73
|
-
"connect-src"?: string | boolean | string[] | undefined;
|
|
74
|
-
"font-src"?: string | boolean | string[] | undefined;
|
|
75
|
-
"object-src"?: string | boolean | string[] | undefined;
|
|
76
|
-
"media-src"?: string | boolean | string[] | undefined;
|
|
77
|
-
"frame-src"?: string | boolean | string[] | undefined;
|
|
78
|
-
sandbox?: string | boolean | string[] | undefined;
|
|
79
|
-
"report-uri"?: string | boolean | string[] | undefined;
|
|
80
|
-
"child-src"?: string | boolean | string[] | undefined;
|
|
81
|
-
"form-action"?: string | boolean | string[] | undefined;
|
|
82
|
-
"frame-ancestors"?: string | boolean | string[] | undefined;
|
|
83
|
-
"plugin-types"?: string | boolean | string[] | undefined;
|
|
84
|
-
"base-uri"?: string | boolean | string[] | undefined;
|
|
85
|
-
"report-to"?: string | boolean | string[] | undefined;
|
|
86
|
-
"worker-src"?: string | boolean | string[] | undefined;
|
|
87
|
-
"manifest-src"?: string | boolean | string[] | undefined;
|
|
88
|
-
"prefetch-src"?: string | boolean | string[] | undefined;
|
|
89
|
-
"navigate-to"?: string | boolean | string[] | undefined;
|
|
90
|
-
"require-sri-for"?: string | boolean | string[] | undefined;
|
|
91
|
-
"block-all-mixed-content"?: string | boolean | string[] | undefined;
|
|
92
|
-
"upgrade-insecure-requests"?: string | boolean | string[] | undefined;
|
|
93
|
-
"trusted-types"?: string | boolean | string[] | undefined;
|
|
94
|
-
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
95
|
-
}>]>;
|
|
96
|
-
declare const CSPEnforcedSchema: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
97
|
-
declare const InputConfigSchema: z.ZodObject<{
|
|
98
|
-
directives: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
99
|
-
"default-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
100
|
-
"script-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
101
|
-
"style-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
102
|
-
"img-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
103
|
-
"connect-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
104
|
-
"font-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
105
|
-
"object-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
106
|
-
"media-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
107
|
-
"frame-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
108
|
-
sandbox: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
109
|
-
"report-uri": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
110
|
-
"child-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
111
|
-
"form-action": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
112
|
-
"frame-ancestors": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
113
|
-
"plugin-types": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
114
|
-
"base-uri": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
115
|
-
"report-to": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
116
|
-
"worker-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
117
|
-
"manifest-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
118
|
-
"prefetch-src": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
119
|
-
"navigate-to": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
120
|
-
"require-sri-for": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
121
|
-
"block-all-mixed-content": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
122
|
-
"upgrade-insecure-requests": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
123
|
-
"trusted-types": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
124
|
-
"require-trusted-types-for": z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString, z.ZodBoolean]>>;
|
|
125
|
-
}, "strip", z.ZodTypeAny, {
|
|
126
|
-
"default-src"?: string | boolean | string[] | undefined;
|
|
127
|
-
"script-src"?: string | boolean | string[] | undefined;
|
|
128
|
-
"style-src"?: string | boolean | string[] | undefined;
|
|
129
|
-
"img-src"?: string | boolean | string[] | undefined;
|
|
130
|
-
"connect-src"?: string | boolean | string[] | undefined;
|
|
131
|
-
"font-src"?: string | boolean | string[] | undefined;
|
|
132
|
-
"object-src"?: string | boolean | string[] | undefined;
|
|
133
|
-
"media-src"?: string | boolean | string[] | undefined;
|
|
134
|
-
"frame-src"?: string | boolean | string[] | undefined;
|
|
135
|
-
sandbox?: string | boolean | string[] | undefined;
|
|
136
|
-
"report-uri"?: string | boolean | string[] | undefined;
|
|
137
|
-
"child-src"?: string | boolean | string[] | undefined;
|
|
138
|
-
"form-action"?: string | boolean | string[] | undefined;
|
|
139
|
-
"frame-ancestors"?: string | boolean | string[] | undefined;
|
|
140
|
-
"plugin-types"?: string | boolean | string[] | undefined;
|
|
141
|
-
"base-uri"?: string | boolean | string[] | undefined;
|
|
142
|
-
"report-to"?: string | boolean | string[] | undefined;
|
|
143
|
-
"worker-src"?: string | boolean | string[] | undefined;
|
|
144
|
-
"manifest-src"?: string | boolean | string[] | undefined;
|
|
145
|
-
"prefetch-src"?: string | boolean | string[] | undefined;
|
|
146
|
-
"navigate-to"?: string | boolean | string[] | undefined;
|
|
147
|
-
"require-sri-for"?: string | boolean | string[] | undefined;
|
|
148
|
-
"block-all-mixed-content"?: string | boolean | string[] | undefined;
|
|
149
|
-
"upgrade-insecure-requests"?: string | boolean | string[] | undefined;
|
|
150
|
-
"trusted-types"?: string | boolean | string[] | undefined;
|
|
151
|
-
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
152
|
-
}, {
|
|
153
|
-
"default-src"?: string | boolean | string[] | undefined;
|
|
154
|
-
"script-src"?: string | boolean | string[] | undefined;
|
|
155
|
-
"style-src"?: string | boolean | string[] | undefined;
|
|
156
|
-
"img-src"?: string | boolean | string[] | undefined;
|
|
157
|
-
"connect-src"?: string | boolean | string[] | undefined;
|
|
158
|
-
"font-src"?: string | boolean | string[] | undefined;
|
|
159
|
-
"object-src"?: string | boolean | string[] | undefined;
|
|
160
|
-
"media-src"?: string | boolean | string[] | undefined;
|
|
161
|
-
"frame-src"?: string | boolean | string[] | undefined;
|
|
162
|
-
sandbox?: string | boolean | string[] | undefined;
|
|
163
|
-
"report-uri"?: string | boolean | string[] | undefined;
|
|
164
|
-
"child-src"?: string | boolean | string[] | undefined;
|
|
165
|
-
"form-action"?: string | boolean | string[] | undefined;
|
|
166
|
-
"frame-ancestors"?: string | boolean | string[] | undefined;
|
|
167
|
-
"plugin-types"?: string | boolean | string[] | undefined;
|
|
168
|
-
"base-uri"?: string | boolean | string[] | undefined;
|
|
169
|
-
"report-to"?: string | boolean | string[] | undefined;
|
|
170
|
-
"worker-src"?: string | boolean | string[] | undefined;
|
|
171
|
-
"manifest-src"?: string | boolean | string[] | undefined;
|
|
172
|
-
"prefetch-src"?: string | boolean | string[] | undefined;
|
|
173
|
-
"navigate-to"?: string | boolean | string[] | undefined;
|
|
174
|
-
"require-sri-for"?: string | boolean | string[] | undefined;
|
|
175
|
-
"block-all-mixed-content"?: string | boolean | string[] | undefined;
|
|
176
|
-
"upgrade-insecure-requests"?: string | boolean | string[] | undefined;
|
|
177
|
-
"trusted-types"?: string | boolean | string[] | undefined;
|
|
178
|
-
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
179
|
-
}>]>;
|
|
180
|
-
enforce: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
181
|
-
}, "strip", z.ZodTypeAny, {
|
|
182
|
-
directives: string | {
|
|
183
|
-
"default-src"?: string | boolean | string[] | undefined;
|
|
184
|
-
"script-src"?: string | boolean | string[] | undefined;
|
|
185
|
-
"style-src"?: string | boolean | string[] | undefined;
|
|
186
|
-
"img-src"?: string | boolean | string[] | undefined;
|
|
187
|
-
"connect-src"?: string | boolean | string[] | undefined;
|
|
188
|
-
"font-src"?: string | boolean | string[] | undefined;
|
|
189
|
-
"object-src"?: string | boolean | string[] | undefined;
|
|
190
|
-
"media-src"?: string | boolean | string[] | undefined;
|
|
191
|
-
"frame-src"?: string | boolean | string[] | undefined;
|
|
192
|
-
sandbox?: string | boolean | string[] | undefined;
|
|
193
|
-
"report-uri"?: string | boolean | string[] | undefined;
|
|
194
|
-
"child-src"?: string | boolean | string[] | undefined;
|
|
195
|
-
"form-action"?: string | boolean | string[] | undefined;
|
|
196
|
-
"frame-ancestors"?: string | boolean | string[] | undefined;
|
|
197
|
-
"plugin-types"?: string | boolean | string[] | undefined;
|
|
198
|
-
"base-uri"?: string | boolean | string[] | undefined;
|
|
199
|
-
"report-to"?: string | boolean | string[] | undefined;
|
|
200
|
-
"worker-src"?: string | boolean | string[] | undefined;
|
|
201
|
-
"manifest-src"?: string | boolean | string[] | undefined;
|
|
202
|
-
"prefetch-src"?: string | boolean | string[] | undefined;
|
|
203
|
-
"navigate-to"?: string | boolean | string[] | undefined;
|
|
204
|
-
"require-sri-for"?: string | boolean | string[] | undefined;
|
|
205
|
-
"block-all-mixed-content"?: string | boolean | string[] | undefined;
|
|
206
|
-
"upgrade-insecure-requests"?: string | boolean | string[] | undefined;
|
|
207
|
-
"trusted-types"?: string | boolean | string[] | undefined;
|
|
208
|
-
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
209
|
-
};
|
|
210
|
-
enforce?: string | boolean | undefined;
|
|
211
|
-
}, {
|
|
212
|
-
directives: string | {
|
|
213
|
-
"default-src"?: string | boolean | string[] | undefined;
|
|
214
|
-
"script-src"?: string | boolean | string[] | undefined;
|
|
215
|
-
"style-src"?: string | boolean | string[] | undefined;
|
|
216
|
-
"img-src"?: string | boolean | string[] | undefined;
|
|
217
|
-
"connect-src"?: string | boolean | string[] | undefined;
|
|
218
|
-
"font-src"?: string | boolean | string[] | undefined;
|
|
219
|
-
"object-src"?: string | boolean | string[] | undefined;
|
|
220
|
-
"media-src"?: string | boolean | string[] | undefined;
|
|
221
|
-
"frame-src"?: string | boolean | string[] | undefined;
|
|
222
|
-
sandbox?: string | boolean | string[] | undefined;
|
|
223
|
-
"report-uri"?: string | boolean | string[] | undefined;
|
|
224
|
-
"child-src"?: string | boolean | string[] | undefined;
|
|
225
|
-
"form-action"?: string | boolean | string[] | undefined;
|
|
226
|
-
"frame-ancestors"?: string | boolean | string[] | undefined;
|
|
227
|
-
"plugin-types"?: string | boolean | string[] | undefined;
|
|
228
|
-
"base-uri"?: string | boolean | string[] | undefined;
|
|
229
|
-
"report-to"?: string | boolean | string[] | undefined;
|
|
230
|
-
"worker-src"?: string | boolean | string[] | undefined;
|
|
231
|
-
"manifest-src"?: string | boolean | string[] | undefined;
|
|
232
|
-
"prefetch-src"?: string | boolean | string[] | undefined;
|
|
233
|
-
"navigate-to"?: string | boolean | string[] | undefined;
|
|
234
|
-
"require-sri-for"?: string | boolean | string[] | undefined;
|
|
235
|
-
"block-all-mixed-content"?: string | boolean | string[] | undefined;
|
|
236
|
-
"upgrade-insecure-requests"?: string | boolean | string[] | undefined;
|
|
237
|
-
"trusted-types"?: string | boolean | string[] | undefined;
|
|
238
|
-
"require-trusted-types-for"?: string | boolean | string[] | undefined;
|
|
239
|
-
};
|
|
240
|
-
enforce?: string | boolean | undefined;
|
|
241
|
-
}>;
|
|
242
|
-
type InputConfigType = z.infer<typeof InputConfigSchema>;
|
|
243
|
-
declare const useContentSecurityPolicy: (input: InputConfigType) => Middleware;
|
|
244
|
-
|
|
245
|
-
export { CSPDirectivesSchema as C, type Middleware as M, CSPEnforcedSchema as a, useContentSecurityPolicy as u };
|