mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
create: hard-code the default session secret even more
The problem here is that making it this optional meant that it wasn't
supplied by [the enterprise creation
function](fb22d94878/ext/app/server/lib/create.ts (L10)
).
This resulted in an odd situation where the secret was required for
the enterprise edition, even though it offers no additional security.
Without this key, the enterprise code crashes.
The requirement to supply a secret key would make a Grist instance
crash if you start in normal mode but switch to enterprise, as the
enterprise creator does not supply a default secret key.
This commit is contained in:
parent
c9f9b70b67
commit
9b3ae08ece
@ -6,7 +6,7 @@ import { GristServer } from 'app/server/lib/GristServer';
|
||||
import * as express from 'express';
|
||||
import WS from 'ws';
|
||||
import fetch from 'node-fetch';
|
||||
import { DEFAULT_SESSION_SECRET } from 'app/server/lib/coreCreator';
|
||||
import { DEFAULT_SESSION_SECRET } from 'app/server/lib/ICreate';
|
||||
|
||||
/**
|
||||
* Self-diagnostics useful when installing Grist.
|
||||
|
@ -13,6 +13,9 @@ import {createSandbox, SpawnFn} from 'app/server/lib/NSandbox';
|
||||
import {SqliteVariant} from 'app/server/lib/SqliteCommon';
|
||||
import {ITelemetry} from 'app/server/lib/Telemetry';
|
||||
|
||||
export const DEFAULT_SESSION_SECRET =
|
||||
'Phoo2ag1jaiz6Moo2Iese2xoaphahbai3oNg7diemohlah0ohtae9iengafieS2Hae7quungoCi9iaPh';
|
||||
|
||||
export interface ICreate {
|
||||
|
||||
Billing(dbManager: HomeDBManager, gristConfig: GristServer): IBilling;
|
||||
@ -116,11 +119,7 @@ export function makeSimpleCreator(opts: {
|
||||
return createSandbox(opts.sandboxFlavor || 'unsandboxed', options);
|
||||
},
|
||||
sessionSecret() {
|
||||
const secret = process.env.GRIST_SESSION_SECRET || sessionSecret;
|
||||
if (!secret) {
|
||||
throw new Error('need GRIST_SESSION_SECRET');
|
||||
}
|
||||
return secret;
|
||||
return process.env.GRIST_SESSION_SECRET || sessionSecret || DEFAULT_SESSION_SECRET;
|
||||
},
|
||||
async configure() {
|
||||
for (const s of storage || []) {
|
||||
|
@ -3,14 +3,8 @@ import { checkMinIOBucket, checkMinIOExternalStorage,
|
||||
import { makeSimpleCreator } from 'app/server/lib/ICreate';
|
||||
import { Telemetry } from 'app/server/lib/Telemetry';
|
||||
|
||||
export const DEFAULT_SESSION_SECRET =
|
||||
'Phoo2ag1jaiz6Moo2Iese2xoaphahbai3oNg7diemohlah0ohtae9iengafieS2Hae7quungoCi9iaPh';
|
||||
|
||||
export const makeCoreCreator = () => makeSimpleCreator({
|
||||
deploymentType: 'core',
|
||||
// This can and should be overridden by GRIST_SESSION_SECRET
|
||||
// (or generated randomly per install, like grist-omnibus does).
|
||||
sessionSecret: DEFAULT_SESSION_SECRET,
|
||||
storage: [
|
||||
{
|
||||
name: 'minio',
|
||||
|
Loading…
Reference in New Issue
Block a user