Working on bugs, add delete restore. Review the auth style. working on the RBAC.

This commit is contained in:
charlesgauthereau
2025-07-26 16:45:43 +02:00
parent 1ffbd6efc8
commit 847a567c52
2 changed files with 77 additions and 42 deletions
+37 -37
View File
@@ -1,9 +1,9 @@
import type { NextConfig } from "next";
import type {NextConfig} from "next";
import {PORTABASE_DEFAULT_SETTINGS} from "./portabase.config";
function buildCSPHeader(): string {
const { CSP } = PORTABASE_DEFAULT_SETTINGS.SECURITY;
const {CSP} = PORTABASE_DEFAULT_SETTINGS.SECURITY;
const directives = [
`default-src ${CSP.DEFAULT_SRC.join(" ")}`,
@@ -12,6 +12,7 @@ function buildCSPHeader(): string {
`img-src ${CSP.IMG_SRC.join(" ")}`,
`font-src ${CSP.FONT_SRC.join(" ")}`,
`object-src ${CSP.OBJECT_SRC.join(" ")}`,
`connect-src ${CSP.CONNECT_SRC.join(" ")}`,
`base-uri ${CSP.BASE_URI.join(" ")}`,
`form-action ${CSP.FORM_ACTION.join(" ")}`,
`frame-ancestors ${CSP.FRAME_ANCESTORS.join(" ")}`,
@@ -35,7 +36,6 @@ function buildPermissionsPolicy(): string {
}
const nextConfig: NextConfig = {
output: "standalone",
typescript: {
@@ -50,40 +50,40 @@ const nextConfig: NextConfig = {
experimental: {
nodeMiddleware: true,
},
// async headers() {
// return [
// {
// source: "/(.*)",
// headers: [
// {
// key: "Content-Security-Policy",
// value: buildCSPHeader(),
// },
// {
// key: "Permissions-Policy",
// value: buildPermissionsPolicy(),
// },
// {
// key: 'X-Content-Type-Options',
// value: 'nosniff',
// },
// {
// key: 'X-Frame-Options',
// value: 'DENY',
// },
// {
// key: 'Referrer-Policy',
// value: 'strict-origin-when-cross-origin',
// },
// {
// key: 'Strict-Transport-Security',
// value: 'max-age=63072000; includeSubDomains; preload',
// }
// // ...other security headers
// ],
// },
// ];
// },
async headers() {
return [
{
source: "/(.*)",
headers: [
{
key: "Content-Security-Policy",
value: buildCSPHeader(),
},
{
key: "Permissions-Policy",
value: buildPermissionsPolicy(),
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'X-Frame-Options',
value: 'DENY',
},
{
key: 'Referrer-Policy',
value: 'strict-origin-when-cross-origin',
},
{
key: 'Strict-Transport-Security',
value: 'max-age=63072000; includeSubDomains; preload',
}
// ...other security headers
],
},
];
},
};
export default nextConfig;
+39 -4
View File
@@ -3,10 +3,45 @@ export const PORTABASE_DEFAULT_SETTINGS = {
SECURITY: {
CSP: {
DEFAULT_SRC: ["'self'"],
SCRIPT_SRC: ["'self'", "'unsafe-eval'", "'unsafe-inline'", "https://cdn.jsdelivr.net", "https://www.googletagmanager.com"],
STYLE_SRC: ["'self'", "'unsafe-inline'", "https://fonts.googleapis.com"],
IMG_SRC: ["'self'", "blob:", "data:", "https:"],
FONT_SRC: ["'self'"],
SCRIPT_SRC: [
"'self'",
"'unsafe-eval'",
"'unsafe-inline'",
"https://cdn.jsdelivr.net",
"https://www.googletagmanager.com",
"https://code.iconify.design",
"https://code.iconify.com",
"https://cdn.iconify.design",
"https://api.iconify.design",
],
STYLE_SRC: [
"'self'",
"'unsafe-inline'",
"https://fonts.googleapis.com",
"https://code.iconify.design",
"https://cdn.iconify.design",
"https://code.iconify.com",
],
IMG_SRC: [
"'self'",
"blob:",
"data:",
"https:",
"https://code.iconify.design",
"https://cdn.iconify.design",
"https://code.iconify.com",
"https://api.iconify.design",
],
FONT_SRC: [
"'self'",
"https://fonts.gstatic.com",
"https://cdn.iconify.design",
],
CONNECT_SRC: [
"'self'",
"https://api.iconify.design",
"https://code.iconify.design",
],
OBJECT_SRC: ["'none'"],
BASE_URI: ["'self'"],
FORM_ACTION: ["'self'"],