gristlabs_grist-core/app/client
Leslie H 24ce54b586
Improve session ID security (#1059)
Follow-up of #994. This PR revises the session ID generation logic to improve security in the absence of a secure session secret. It also adds a section in the admin panel "security" section to nag system admins when GRIST_SESSION_SECRET is not set.

Following is an excerpt from internal conversation.

TL;DR: Grist's current implementation generates semi-secure session IDs and uses a publicly known default signing key to sign them when the environment variable GRIST_SESSION_SECRET is not set. This PR generates cryptographically secure session IDs to dismiss security concerns around an insecure signing key, and encourages system admins to configure their own signing key anyway.

> The session secret is required by expressjs/session to sign its session IDs. It's designed as an extra protection against session hijacking by randomly guessing session IDs and hitting a valid one. While it is easy to encourage users to set a distinct session secret, this is unnecessary if session IDs are generated in a cryptographically secure way. As of now Grist uses version 4 UUIDs as session IDs (see app/server/lib/gristSessions.ts - it uses shortUUID.generate which invokes uuid.v4 under the hood). These contain 122 bits of entropy, technically insufficient to be considered cryptographically secure. In practice, this is never considered a real vulnerability. To compare, RSA2048 is still very commonly used in web servers, yet it only has 112 bits of security (>=128 bits = "secure", rule of thumb in cryptography). But for peace of mind I propose using crypto.getRandomValues to generate real 128-bit random values. This should render session ID signing unnecessary and hence dismiss security concerns around an insecure signing key.
2024-06-25 15:43:25 -04:00
..
aclui (core) Add dropdown conditions 2024-04-26 16:57:55 -04:00
components (core) Makes EE frontend behave as core if EE isn't activated 2024-06-14 00:43:51 +01:00
lib (core) Support user variable in dropdown conditions 2024-06-04 06:56:55 -07:00
models (core) Support user variable in dropdown conditions 2024-06-04 06:56:55 -07:00
ui Improve session ID security (#1059) 2024-06-25 15:43:25 -04:00
ui2018 (core) Adding UI for timing API 2024-05-22 14:56:53 +02:00
widgets (core) Support user variable in dropdown conditions 2024-06-04 06:56:55 -07:00
apiconsole.ts (core) Add dark mode CSS for Swagger UI 2024-03-05 08:45:21 -05:00
app.css (core) Polish tutorial popups 2023-04-20 12:20:03 -04:00
app.js (core) Improve API Console and link from Document Settings. 2024-01-29 10:08:19 -05:00
billingMain.ts (core) Refactor forms implementation 2024-02-22 08:44:25 -05:00
browserCheck.ts (core) On mobile, only show a warning for older and unknown browsers rather than for all 2023-06-01 11:15:21 -04:00
declarations.d.ts (core) Reference and ReferenceList should trigger RightMenu to show up on Column tab and display reference toolitp, if it wasn't dismissed yet 2024-02-13 16:59:59 +01:00
DefaultHooks.ts add hooks for tweaking how downloads happen (for grist-static) (#665) 2023-09-09 14:50:32 -04:00
errorMain.ts (core) Refactor forms implementation 2024-02-22 08:44:25 -05:00
exposeModulesForTests.js (core) Improve API Console and link from Document Settings. 2024-01-29 10:08:19 -05:00
formMain.ts (core) Refactor forms implementation 2024-02-22 08:44:25 -05:00
Hooks.ts support other SQLite wrappers, and various hooks needed by grist-static (#516) 2023-05-23 15:17:28 -04:00
logo.css (core) Cleanup removing some old unused files, fixing logo.css, and removing #grist-app. 2020-10-09 17:04:09 -04:00
tsconfig.json (core) Migrate to SRP and add change password dialog 2022-03-16 21:35:06 -07:00