Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moves core ICreate object and core GristLoginSystem to server/lib #994

Merged
merged 1 commit into from
May 23, 2024

Conversation

Spoffy
Copy link
Contributor

@Spoffy Spoffy commented May 21, 2024

Enables code in ext/ to be able to access it (e.g for proxying / interception).

Adds getCreate() to enable future refactoring of const create away from being a global singleton constant.

Enables code in ext/ to be able to access it (e.g for proxying / interception).

Adds getCreate() to enable future refactoring of `const create` away from being a global singleston constant.
@Spoffy Spoffy marked this pull request as ready for review May 21, 2024 21:56
@georgegevoian georgegevoian self-requested a review May 21, 2024 22:15
@Spoffy Spoffy changed the title Moves ICreate and GristLoginSystem code to server/lib. Moves ICreate core stub and core GristLoginSystem code to server/lib. May 21, 2024
@Spoffy Spoffy changed the title Moves ICreate core stub and core GristLoginSystem code to server/lib. Moves ICreate core stub and core GristLoginSystem to server/lib May 21, 2024
@Spoffy Spoffy changed the title Moves ICreate core stub and core GristLoginSystem to server/lib Moves core ICreate object and core GristLoginSystem to server/lib May 21, 2024
@paulfitz paulfitz self-requested a review May 23, 2024 13:39
Copy link
Member

@paulfitz paulfitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Spoffy !

app/server/lib/coreCreator.ts Show resolved Hide resolved
@Spoffy Spoffy merged commit e56b416 into main May 23, 2024
13 checks passed
@Spoffy Spoffy deleted the spoffy/provide_ee_server_access_to_stub_code branch May 23, 2024 22:07
paulfitz pushed a commit that referenced this pull request Jun 25, 2024
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.
SleepyLeslie added a commit that referenced this pull request Jul 8, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants