fix: default dev password for keycloak refer to env

This commit is contained in:
Théo LAGACHE
2026-06-25 15:20:02 +02:00
parent 45c82f9ef5
commit 1a210c6de9
2 changed files with 158 additions and 84 deletions
+80 -82
View File
@@ -1,102 +1,100 @@
import type {NextConfig} from "next"; import type { NextConfig } from "next";
import {PORTABASE_DEFAULT_SETTINGS} from "./portabase.config"; import { PORTABASE_DEFAULT_SETTINGS } from "./portabase.config";
const isDev = process.env.NODE_ENV === "development"; const isDev = process.env.NODE_ENV === "development";
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(" ")}`,
`script-src ${CSP.SCRIPT_SRC.join(" ")}`, `script-src ${CSP.SCRIPT_SRC.join(" ")}`,
`style-src ${CSP.STYLE_SRC.join(" ")}`, `style-src ${CSP.STYLE_SRC.join(" ")}`,
`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(" ")}`, `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(" ")}`,
]; ];
if (CSP.BLOCK_ALL_MIXED_CONTENT) { if (CSP.BLOCK_ALL_MIXED_CONTENT) {
directives.push("block-all-mixed-content"); directives.push("block-all-mixed-content");
} }
if (CSP.UPGRADE_INSECURE_REQUESTS) { if (CSP.UPGRADE_INSECURE_REQUESTS) {
directives.push("upgrade-insecure-requests"); directives.push("upgrade-insecure-requests");
} }
return directives.join("; "); return directives.join("; ");
} }
function buildPermissionsPolicy(): string { function buildPermissionsPolicy(): string {
return Object.entries(PORTABASE_DEFAULT_SETTINGS.SECURITY.PERMISSIONS_POLICY) return Object.entries(PORTABASE_DEFAULT_SETTINGS.SECURITY.PERMISSIONS_POLICY)
.map(([feature, values]) => `${feature.toLowerCase()}=${values.join(", ")}`) .map(([feature, values]) => `${feature.toLowerCase()}=${values.join(", ")}`)
.join(", "); .join(", ");
} }
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
output: "standalone", output: "standalone",
typescript: { devIndicators: false,
ignoreBuildErrors: true, typescript: {
ignoreBuildErrors: true,
},
logging: {
browserToTerminal: false,
},
experimental: {
serverActions: {
bodySizeLimit: "10gb",
}, },
logging: { proxyClientMaxBodySize: "10gb",
browserToTerminal: false, },
}, async rewrites() {
experimental: { if (!isDev) return [];
serverActions: {
bodySizeLimit: "10gb",
},
proxyClientMaxBodySize: '10gb',
},
async rewrites() {
if (!isDev) return [];
return [ return [
{ {
source: "/tus/:path*", source: "/tus/:path*",
destination: "http://localhost:1080/tus/:path*", destination: "http://localhost:1080/tus/:path*",
}, },
]; ];
}, },
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 ],
], },
}, ];
]; },
},
}; };
export default nextConfig; export default nextConfig;
+78 -2
View File
@@ -351,6 +351,14 @@
"clientRole" : true, "clientRole" : true,
"containerId" : "18b5dfb2-44d4-448e-98df-9652daef1a22", "containerId" : "18b5dfb2-44d4-448e-98df-9652daef1a22",
"attributes" : { } "attributes" : { }
} ],
"exemple-client" : [ {
"id" : "67766209-57dd-45c7-940d-ed3313473101",
"name" : "uma_protection",
"composite" : false,
"clientRole" : true,
"containerId" : "248d3eaa-466f-4b85-8903-9242959e67ba",
"attributes" : { }
} ] } ]
} }
}, },
@@ -458,8 +466,8 @@
"id" : "b1cedcac-5207-4479-bc29-065ba849e414", "id" : "b1cedcac-5207-4479-bc29-065ba849e414",
"type" : "password", "type" : "password",
"userLabel" : "My password", "userLabel" : "My password",
"createdDate" : 1772179391727, "createdDate" : 1782393421785,
"secretData" : "{\"value\":\"IXr6L3pvO2BAkn/cH3rh3v2tg1R83u2f8SWEZK2fq5E=\",\"salt\":\"XWV8/yKm7Rw/YXiwXZZUig==\",\"additionalParameters\":{}}", "secretData" : "{\"value\":\"L585pLqSeHaNW4HzOu+GzZm+VJWWBO3Df+rPs04gUGk=\",\"salt\":\"w3pmQ0hsMDJnCX+qJ3K+zQ==\",\"additionalParameters\":{}}",
"credentialData" : "{\"hashIterations\":5,\"algorithm\":\"argon2\",\"additionalParameters\":{\"hashLength\":[\"32\"],\"memory\":[\"7168\"],\"type\":[\"id\"],\"version\":[\"1.3\"],\"parallelism\":[\"1\"]}}" "credentialData" : "{\"hashIterations\":5,\"algorithm\":\"argon2\",\"additionalParameters\":{\"hashLength\":[\"32\"],\"memory\":[\"7168\"],\"type\":[\"id\"],\"version\":[\"1.3\"],\"parallelism\":[\"1\"]}}"
} ], } ],
"disableableCredentialTypes" : [ ], "disableableCredentialTypes" : [ ],
@@ -467,6 +475,23 @@
"realmRoles" : [ "admin", "default-roles-master" ], "realmRoles" : [ "admin", "default-roles-master" ],
"notBefore" : 0, "notBefore" : 0,
"groups" : [ "/Admin" ] "groups" : [ "/Admin" ]
}, {
"id" : "8c749a0c-f2ed-4bc7-9f54-4e0bcbc36626",
"username" : "service-account-exemple-client",
"emailVerified" : false,
"enabled" : true,
"createdTimestamp" : 1772190246795,
"totp" : false,
"serviceAccountClientId" : "exemple-client",
"credentials" : [ ],
"disableableCredentialTypes" : [ ],
"requiredActions" : [ ],
"realmRoles" : [ "default-roles-master" ],
"clientRoles" : {
"exemple-client" : [ "uma_protection" ]
},
"notBefore" : 0,
"groups" : [ ]
}, { }, {
"id" : "718dfe46-dbef-41a3-9120-78aeac240431", "id" : "718dfe46-dbef-41a3-9120-78aeac240431",
"username" : "service-account-portabase", "username" : "service-account-portabase",
@@ -625,6 +650,57 @@
"nodeReRegistrationTimeout" : 0, "nodeReRegistrationTimeout" : 0,
"defaultClientScopes" : [ "web-origins", "acr", "profile", "roles", "basic", "email" ], "defaultClientScopes" : [ "web-origins", "acr", "profile", "roles", "basic", "email" ],
"optionalClientScopes" : [ "address", "phone", "organization", "offline_access", "microprofile-jwt" ] "optionalClientScopes" : [ "address", "phone", "organization", "offline_access", "microprofile-jwt" ]
}, {
"id" : "248d3eaa-466f-4b85-8903-9242959e67ba",
"clientId" : "exemple-client",
"name" : "Exemple Client",
"description" : "",
"rootUrl" : "https://your-instance.portabase.io",
"adminUrl" : "https://your-instance.portabase.io",
"baseUrl" : "https://your-instance.portabase.io",
"surrogateAuthRequired" : false,
"enabled" : true,
"alwaysDisplayInConsole" : false,
"clientAuthenticatorType" : "client-secret",
"secret" : "lFZY6fXzh9uxCXwvucw9JtXGhNRKgnnj",
"redirectUris" : [ "https://your-instance.portabase.io/api/auth/sso/callback/exemple-client" ],
"webOrigins" : [ "https://your-instance.portabase.io" ],
"notBefore" : 0,
"bearerOnly" : false,
"consentRequired" : false,
"standardFlowEnabled" : true,
"implicitFlowEnabled" : false,
"directAccessGrantsEnabled" : false,
"serviceAccountsEnabled" : true,
"authorizationServicesEnabled" : true,
"publicClient" : false,
"frontchannelLogout" : true,
"protocol" : "openid-connect",
"attributes" : {
"realm_client" : "false",
"oidc.ciba.grant.enabled" : "false",
"client.secret.creation.time" : "1772190246",
"backchannel.logout.session.required" : "true",
"standard.token.exchange.enabled" : "false",
"post.logout.redirect.uris" : "https://your-instance.portabase.io",
"oauth2.device.authorization.grant.enabled" : "true",
"pkce.code.challenge.method" : "S256",
"backchannel.logout.revoke.offline.tokens" : "false",
"dpop.bound.access.tokens" : "false"
},
"authenticationFlowBindingOverrides" : { },
"fullScopeAllowed" : true,
"nodeReRegistrationTimeout" : -1,
"defaultClientScopes" : [ "web-origins", "service_account", "acr", "profile", "roles", "basic", "email" ],
"optionalClientScopes" : [ "address", "phone", "organization", "offline_access", "microprofile-jwt" ],
"authorizationSettings" : {
"allowRemoteResourceManagement" : true,
"policyEnforcementMode" : "ENFORCING",
"resources" : [ ],
"policies" : [ ],
"scopes" : [ ],
"decisionStrategy" : "UNANIMOUS"
}
}, { }, {
"id" : "6022c206-5f1f-45b7-af07-74ce6804cbc7", "id" : "6022c206-5f1f-45b7-af07-74ce6804cbc7",
"clientId" : "master-realm", "clientId" : "master-realm",