mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
fix: default dev password for keycloak refer to env
This commit is contained in:
+80
-82
@@ -1,102 +1,100 @@
|
||||
import type {NextConfig} from "next";
|
||||
import {PORTABASE_DEFAULT_SETTINGS} from "./portabase.config";
|
||||
import type { NextConfig } from "next";
|
||||
import { PORTABASE_DEFAULT_SETTINGS } from "./portabase.config";
|
||||
|
||||
const isDev = process.env.NODE_ENV === "development";
|
||||
|
||||
|
||||
function buildCSPHeader(): string {
|
||||
const {CSP} = PORTABASE_DEFAULT_SETTINGS.SECURITY;
|
||||
const { CSP } = PORTABASE_DEFAULT_SETTINGS.SECURITY;
|
||||
|
||||
const directives = [
|
||||
`default-src ${CSP.DEFAULT_SRC.join(" ")}`,
|
||||
`script-src ${CSP.SCRIPT_SRC.join(" ")}`,
|
||||
`style-src ${CSP.STYLE_SRC.join(" ")}`,
|
||||
`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(" ")}`,
|
||||
];
|
||||
const directives = [
|
||||
`default-src ${CSP.DEFAULT_SRC.join(" ")}`,
|
||||
`script-src ${CSP.SCRIPT_SRC.join(" ")}`,
|
||||
`style-src ${CSP.STYLE_SRC.join(" ")}`,
|
||||
`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(" ")}`,
|
||||
];
|
||||
|
||||
if (CSP.BLOCK_ALL_MIXED_CONTENT) {
|
||||
directives.push("block-all-mixed-content");
|
||||
}
|
||||
if (CSP.BLOCK_ALL_MIXED_CONTENT) {
|
||||
directives.push("block-all-mixed-content");
|
||||
}
|
||||
|
||||
if (CSP.UPGRADE_INSECURE_REQUESTS) {
|
||||
directives.push("upgrade-insecure-requests");
|
||||
}
|
||||
if (CSP.UPGRADE_INSECURE_REQUESTS) {
|
||||
directives.push("upgrade-insecure-requests");
|
||||
}
|
||||
|
||||
return directives.join("; ");
|
||||
return directives.join("; ");
|
||||
}
|
||||
|
||||
function buildPermissionsPolicy(): string {
|
||||
return Object.entries(PORTABASE_DEFAULT_SETTINGS.SECURITY.PERMISSIONS_POLICY)
|
||||
.map(([feature, values]) => `${feature.toLowerCase()}=${values.join(", ")}`)
|
||||
.join(", ");
|
||||
return Object.entries(PORTABASE_DEFAULT_SETTINGS.SECURITY.PERMISSIONS_POLICY)
|
||||
.map(([feature, values]) => `${feature.toLowerCase()}=${values.join(", ")}`)
|
||||
.join(", ");
|
||||
}
|
||||
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
output: "standalone",
|
||||
typescript: {
|
||||
ignoreBuildErrors: true,
|
||||
output: "standalone",
|
||||
devIndicators: false,
|
||||
typescript: {
|
||||
ignoreBuildErrors: true,
|
||||
},
|
||||
logging: {
|
||||
browserToTerminal: false,
|
||||
},
|
||||
experimental: {
|
||||
serverActions: {
|
||||
bodySizeLimit: "10gb",
|
||||
},
|
||||
logging: {
|
||||
browserToTerminal: false,
|
||||
},
|
||||
experimental: {
|
||||
serverActions: {
|
||||
bodySizeLimit: "10gb",
|
||||
},
|
||||
proxyClientMaxBodySize: '10gb',
|
||||
},
|
||||
async rewrites() {
|
||||
if (!isDev) return [];
|
||||
proxyClientMaxBodySize: "10gb",
|
||||
},
|
||||
async rewrites() {
|
||||
if (!isDev) return [];
|
||||
|
||||
return [
|
||||
{
|
||||
source: "/tus/:path*",
|
||||
destination: "http://localhost:1080/tus/:path*",
|
||||
},
|
||||
];
|
||||
},
|
||||
return [
|
||||
{
|
||||
source: "/tus/:path*",
|
||||
destination: "http://localhost:1080/tus/:path*",
|
||||
},
|
||||
];
|
||||
},
|
||||
|
||||
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",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
@@ -351,6 +351,14 @@
|
||||
"clientRole" : true,
|
||||
"containerId" : "18b5dfb2-44d4-448e-98df-9652daef1a22",
|
||||
"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",
|
||||
"type" : "password",
|
||||
"userLabel" : "My password",
|
||||
"createdDate" : 1772179391727,
|
||||
"secretData" : "{\"value\":\"IXr6L3pvO2BAkn/cH3rh3v2tg1R83u2f8SWEZK2fq5E=\",\"salt\":\"XWV8/yKm7Rw/YXiwXZZUig==\",\"additionalParameters\":{}}",
|
||||
"createdDate" : 1782393421785,
|
||||
"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\"]}}"
|
||||
} ],
|
||||
"disableableCredentialTypes" : [ ],
|
||||
@@ -467,6 +475,23 @@
|
||||
"realmRoles" : [ "admin", "default-roles-master" ],
|
||||
"notBefore" : 0,
|
||||
"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",
|
||||
"username" : "service-account-portabase",
|
||||
@@ -625,6 +650,57 @@
|
||||
"nodeReRegistrationTimeout" : 0,
|
||||
"defaultClientScopes" : [ "web-origins", "acr", "profile", "roles", "basic", "email" ],
|
||||
"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",
|
||||
"clientId" : "master-realm",
|
||||
|
||||
Reference in New Issue
Block a user