GHSA-96qw-h329-v5rg
Shakapacker has environment variable leak via EnvironmentPlugin that exposes secrets to client-side bundles
GHSA-96qw-h329-v5rg is a high vulnerability (CVSS 7.5) in shakapacker, published January 8, 2026. No source lists public exploit code. Fixed in shakapacker 9.5.0.
- Severity
- 7.5 HighCVSS 3.1, GitHub Advisories
- Exploit chance
- UnscoredNo EPSS score yet
- Exploitation
- None knownNot on CISA’s or ENISA’s lists
- Fixed in
9.5.0shakapacker +2 more
Description
Summary
Since 2017, the default webpack plugins have passed the entire process.env to EnvironmentPlugin. This pattern exposed ALL build environment variables to client-side JavaScript bundles whenever application code (or any dependency) referenced process.env.VARIABLE_NAME.
This is not a regression - the vulnerable code has existed since the original Webpacker implementation. No recent code change in Shakapacker triggered this issue.
Impact
Any environment variable in the build environment that is referenced in client-side code (including third-party dependencies) is embedded directly into the JavaScript bundle. This includes:
DATABASE_URL- Database credentialsAWS_SECRET_ACCESS_KEY- AWS credentialsRAILS_MASTER_KEY- Rails encrypted credentials keySTRIPE_SECRET_KEY,TWILIO_AUTH_TOKEN- Third-party API keys- Any other secrets present in the build environment
Severity: Critical - secrets are exposed in publicly accessible JavaScript files.
Root Cause
The original code used:
new webpack.EnvironmentPlugin(process.env)
This makes every environment variable available for substitution. If any code references process.env.SECRET_KEY, that value is embedded in the bundle.
Patches
Upgrade to version 9.5.0 or later, which uses an allowlist approach that only exposes NODE_ENV, RAILS_ENV, and WEBPACK_SERVE by default.
Workarounds
If developers cannot upgrade immediately:
- Audit client-side code and dependencies for any
process.env.Xreferences to sensitive variables - Remove sensitive variables from the build environment
- Override the default plugins with a custom webpack/rspack config using an explicit allowlist
Migration
After upgrading, if client-side code needs access to specific environment variables:
Option 1: Use the SHAKAPACKER_PUBLIC_ prefix (recommended)
# Variables with this prefix are automatically exposed
export SHAKAPACKER_PUBLIC_API_URL="https://api.example.com"
Option 2: Use SHAKAPACKER_ENV_VARS
SHAKAPACKER_ENV_VARS=API_URL,FEATURE_FLAG bundle exec rails assets:precompile
Action Required
After upgrading, rotate any secrets that may have been exposed in previously compiled JavaScript bundles.
Resources
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- None
- Availability
- None
Affected packages
| Package | Affected | Fixed |
|---|---|---|
shakapackernpm | before 9.5.0 | 9.5.0 |
shakapackerRubyGems | before 9.5.0 | 9.5.0 |
shakapackerRubyGems | before 9.5.0, plus listed versions 6.0.06.0.0.rc.126.0.0.rc.136.0.0.rc.146.0.0.rc.6 Show 45 moreShow less6.0.16.0.26.1.06.1.0.beta.06.1.16.2.06.2.16.3.06.3.0.pre.rc.16.4.06.4.16.5.06.5.16.5.26.5.36.5.46.5.56.5.66.6.07.0.07.0.0.rc.07.0.0.rc.17.0.0.rc.27.0.17.0.27.0.37.1.07.2.07.2.0.rc.07.2.17.2.27.2.37.3.0.beta.18.0.08.0.0.pre.rc.18.0.0.rc.28.0.0.rc.38.0.0.rc.48.0.18.0.28.1.08.2.08.3.08.4.09.0.0 | 9.5.0 |
What each source reports
GitHub Advisories Score used 7.5
Shakapacker has environment variable leak via EnvironmentPlugin that exposes secrets to client-side bundles
Summary
Since 2017, the default webpack plugins have passed the entire process.env to EnvironmentPlugin. This pattern exposed ALL build environment variables to client-side JavaScript bundles whenever application code (or any dependency) referenced process.env.VARIABLE_NAME.
This is not a regression - the vulnerable code has existed since the original Webpacker implementation. No recent code change in Shakapacker triggered this issue.
Impact
Any environment variable in the build environment that is referenced in client-side code (including third-party dependencies) is embedded directly into the JavaScript bundle. This includes:
DATABASE_URL- Database credentialsAWS_SECRET_ACCESS_KEY- AWS credentialsRAILS_MASTER_KEY- Rails encrypted credentials keySTRIPE_SECRET_KEY,TWILIO_AUTH_TOKEN- Third-party API keys- Any other secrets present in the build environment
Severity: Critical - secrets are exposed in publicly accessible JavaScript files.
Root Cause
The original code used:
new webpack.EnvironmentPlugin(process.env)
This makes every environment variable available for substitution. If any code references process.env.SECRET_KEY, that value is embedded in the bundle.
Patches
Upgrade to version 9.5.0 or later, which uses an allowlist approach that only exposes NODE_ENV, RAILS_ENV, and WEBPACK_SERVE by default.
Workarounds
If developers cannot upgrade immediately:
- Audit client-side code and dependencies for any
process.env.Xreferences to sensitive variables - Remove sensitive variables from the build environment
- Override the default plugins with a custom webpack/rspack config using an explicit allowlist
Migration
After upgrading, if client-side code needs access to specific environment variables:
Option 1: Use the SHAKAPACKER_PUBLIC_ prefix (recommended)
# Variables with this prefix are automatically exposed
export SHAKAPACKER_PUBLIC_API_URL="https://api.example.com"
Option 2: Use SHAKAPACKER_ENV_VARS
SHAKAPACKER_ENV_VARS=API_URL,FEATURE_FLAG bundle exec rails assets:precompile
Action Required
After upgrading, rotate any secrets that may have been exposed in previously compiled JavaScript bundles.
Resources
- Record
GHSA-96qw-h329-v5rg- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N - Weakness
- CWE-200
- Updated
- 2026-11-02
OSV 7.5
Shakapacker has environment variable leak via EnvironmentPlugin that exposes secrets to client-side bundles
Summary
Since 2017, the default webpack plugins have passed the entire process.env to EnvironmentPlugin. This pattern exposed ALL build environment variables to client-side JavaScript bundles whenever application code (or any dependency) referenced process.env.VARIABLE_NAME.
This is not a regression - the vulnerable code has existed since the original Webpacker implementation. No recent code change in Shakapacker triggered this issue.
Impact
Any environment variable in the build environment that is referenced in client-side code (including third-party dependencies) is embedded directly into the JavaScript bundle. This includes:
DATABASE_URL- Database credentialsAWS_SECRET_ACCESS_KEY- AWS credentialsRAILS_MASTER_KEY- Rails encrypted credentials keySTRIPE_SECRET_KEY,TWILIO_AUTH_TOKEN- Third-party API keys- Any other secrets present in the build environment
Severity: Critical - secrets are exposed in publicly accessible JavaScript files.
Root Cause
The original code used:
new webpack.EnvironmentPlugin(process.env)
This makes every environment variable available for substitution. If any code references process.env.SECRET_KEY, that value is embedded in the bundle.
Patches
Upgrade to version 9.5.0 or later, which uses an allowlist approach that only exposes NODE_ENV, RAILS_ENV, and WEBPACK_SERVE by default.
Workarounds
If developers cannot upgrade immediately:
- Audit client-side code and dependencies for any
process.env.Xreferences to sensitive variables - Remove sensitive variables from the build environment
- Override the default plugins with a custom webpack/rspack config using an explicit allowlist
Migration
After upgrading, if client-side code needs access to specific environment variables:
Option 1: Use the SHAKAPACKER_PUBLIC_ prefix (recommended)
# Variables with this prefix are automatically exposed
export SHAKAPACKER_PUBLIC_API_URL="https://api.example.com"
Option 2: Use SHAKAPACKER_ENV_VARS
SHAKAPACKER_ENV_VARS=API_URL,FEATURE_FLAG bundle exec rails assets:precompile
Action Required
After upgrading, rotate any secrets that may have been exposed in previously compiled JavaScript bundles.
Resources
- Record
GHSA-96qw-h329-v5rg- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N - Weakness
- CWE-200
- Updated
- 2026-11-02
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | GitHub Advisories, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
References
Left out here: 27 versions. The JSON record has them.