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"; import {PORTABASE_DEFAULT_SETTINGS} from "./portabase.config";
function buildCSPHeader(): string { function buildCSPHeader(): string {
const { CSP } = PORTABASE_DEFAULT_SETTINGS.SECURITY; const {CSP} = PORTABASE_DEFAULT_SETTINGS.SECURITY;
const directives = [ const directives = [
`default-src ${CSP.DEFAULT_SRC.join(" ")}`, `default-src ${CSP.DEFAULT_SRC.join(" ")}`,
@@ -12,6 +12,7 @@ function buildCSPHeader(): string {
`img-src ${CSP.IMG_SRC.join(" ")}`, `img-src ${CSP.IMG_SRC.join(" ")}`,
`font-src ${CSP.FONT_SRC.join(" ")}`, `font-src ${CSP.FONT_SRC.join(" ")}`,
`object-src ${CSP.OBJECT_SRC.join(" ")}`, `object-src ${CSP.OBJECT_SRC.join(" ")}`,
`connect-src ${CSP.CONNECT_SRC.join(" ")}`,
`base-uri ${CSP.BASE_URI.join(" ")}`, `base-uri ${CSP.BASE_URI.join(" ")}`,
`form-action ${CSP.FORM_ACTION.join(" ")}`, `form-action ${CSP.FORM_ACTION.join(" ")}`,
`frame-ancestors ${CSP.FRAME_ANCESTORS.join(" ")}`, `frame-ancestors ${CSP.FRAME_ANCESTORS.join(" ")}`,
@@ -35,7 +36,6 @@ function buildPermissionsPolicy(): string {
} }
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
output: "standalone", output: "standalone",
typescript: { typescript: {
@@ -50,40 +50,40 @@ const nextConfig: NextConfig = {
experimental: { experimental: {
nodeMiddleware: true, nodeMiddleware: true,
}, },
// async headers() { async headers() {
// return [ return [
// { {
// source: "/(.*)", source: "/(.*)",
// headers: [ headers: [
// { {
// key: "Content-Security-Policy", key: "Content-Security-Policy",
// value: buildCSPHeader(), value: buildCSPHeader(),
// }, },
// { {
// key: "Permissions-Policy", key: "Permissions-Policy",
// value: buildPermissionsPolicy(), value: buildPermissionsPolicy(),
// }, },
// { {
// key: 'X-Content-Type-Options', key: 'X-Content-Type-Options',
// value: 'nosniff', value: 'nosniff',
// }, },
// { {
// key: 'X-Frame-Options', key: 'X-Frame-Options',
// value: 'DENY', value: 'DENY',
// }, },
// { {
// key: 'Referrer-Policy', key: 'Referrer-Policy',
// value: 'strict-origin-when-cross-origin', value: 'strict-origin-when-cross-origin',
// }, },
// { {
// key: 'Strict-Transport-Security', key: 'Strict-Transport-Security',
// value: 'max-age=63072000; includeSubDomains; preload', value: 'max-age=63072000; includeSubDomains; preload',
// } }
// // ...other security headers // ...other security headers
// ], ],
// }, },
// ]; ];
// }, },
}; };
export default nextConfig; export default nextConfig;
+39 -4
View File
@@ -3,10 +3,45 @@ export const PORTABASE_DEFAULT_SETTINGS = {
SECURITY: { SECURITY: {
CSP: { CSP: {
DEFAULT_SRC: ["'self'"], DEFAULT_SRC: ["'self'"],
SCRIPT_SRC: ["'self'", "'unsafe-eval'", "'unsafe-inline'", "https://cdn.jsdelivr.net", "https://www.googletagmanager.com"], SCRIPT_SRC: [
STYLE_SRC: ["'self'", "'unsafe-inline'", "https://fonts.googleapis.com"], "'self'",
IMG_SRC: ["'self'", "blob:", "data:", "https:"], "'unsafe-eval'",
FONT_SRC: ["'self'"], "'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'"], OBJECT_SRC: ["'none'"],
BASE_URI: ["'self'"], BASE_URI: ["'self'"],
FORM_ACTION: ["'self'"], FORM_ACTION: ["'self'"],