feat: allow custom protocols for app href (#2575)
Co-authored-by: Manuel <30572287+manuel-rw@users.noreply.github.com> Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
This commit is contained in:
@@ -49,6 +49,32 @@ const nextConfig: NextConfig = {
|
|||||||
images: {
|
images: {
|
||||||
domains: ["cdn.jsdelivr.net"],
|
domains: ["cdn.jsdelivr.net"],
|
||||||
},
|
},
|
||||||
|
// eslint-disable-next-line @typescript-eslint/require-await,no-restricted-syntax
|
||||||
|
async headers() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
source: "/(.*)", // Apply CSP to all routes
|
||||||
|
headers: [
|
||||||
|
{
|
||||||
|
key: "Content-Security-Policy",
|
||||||
|
value: `
|
||||||
|
default-src 'self';
|
||||||
|
script-src * 'unsafe-inline' 'unsafe-eval';
|
||||||
|
base-uri 'self';
|
||||||
|
connect-src *;
|
||||||
|
style-src 'self' 'unsafe-inline';
|
||||||
|
frame-ancestors *;
|
||||||
|
frame-src *;
|
||||||
|
form-action 'self';
|
||||||
|
img-src * data:;
|
||||||
|
`
|
||||||
|
.replace(/\s{2,}/g, " ")
|
||||||
|
.trim(),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Skip transform is used because of webpack loader, without it for example 'Tooltip.Floating' will not work and show an error
|
// Skip transform is used because of webpack loader, without it for example 'Tooltip.Floating' will not work and show an error
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export const appHrefSchema = z
|
|||||||
.string()
|
.string()
|
||||||
.trim()
|
.trim()
|
||||||
.url()
|
.url()
|
||||||
.regex(/^https?:\/\//) // Only allow http and https for security reasons (javascript: is not allowed)
|
.regex(/^(?!javascript)[a-zA-Z]*:\/\//i) // javascript: is not allowed, i for case insensitive (so Javascript: is also not allowed)
|
||||||
.or(z.literal(""))
|
.or(z.literal(""))
|
||||||
.transform((value) => (value.length === 0 ? null : value))
|
.transform((value) => (value.length === 0 ? null : value))
|
||||||
.nullable();
|
.nullable();
|
||||||
|
|||||||
Reference in New Issue
Block a user