Miggo Logo

CVE-2022-39382: @keystone-6/core's NODE_ENV defaults to development with esbuild

9.8

CVSS Score
3.1

Basic Information

EPSS Score
0.70806%
Published
11/3/2022
Updated
2/2/2023
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
@keystone-6/corenpm>= 3.0.0, < 3.0.23.0.2

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from esbuild's default behavior when platform configuration is undefined. In @keystone-6/core versions 3.0.0-3.0.1, the build configuration function responsible for setting up esbuild did not explicitly specify 'platform: 'node'', allowing esbuild to default to browser-like environment behavior. This caused process.env.NODE_ENV to be hardcoded as 'development' during build-time compilation of user code, while dependencies (not processed through esbuild) still respected the actual environment variable. The fix in #8031 explicitly sets platform: 'node' in the esbuild configuration to prevent this unwanted inlining.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

### Imp**t `@k*yston*-*/*or*@*.*.* || *.*.*` us*rs t**t us* `NO**_*NV` in t**ir own *o** (**not **p*n**n*i*s**) to tri***r s**urity-s*nsitiv* *un*tion*lity in * pro*u*tion *uil* *r* vuln*r**l* to `NO**_*NV` **in* inlin** to `"**v*lopm*nt"` *or us*r *

Reasoning

T** vuln*r**ility st*ms *rom *s*uil*'s ****ult ****vior w**n pl*t*orm *on*i*ur*tion is un***in**. In @k*yston*-*/*or* v*rsions *.*.*-*.*.*, t** *uil* *on*i*ur*tion *un*tion r*sponsi*l* *or s*ttin* up *s*uil* *i* not *xpli*itly sp**i*y 'pl*t*orm: 'no*