Shakapacker has environment variable leak via EnvironmentPlugin that exposes secrets to client-side bundles
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.
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 keysSeverity: Critical - secrets are exposed in publicly accessible JavaScript files.
The original code used:
```javascript
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.
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.
If developers cannot upgrade immediately:
1. Audit client-side code and dependencies for any process.env.X references to sensitive variables
2. Remove sensitive variables from the build environment
3. Override the default plugins with a custom webpack/rspack config using an explicit allowlist
After upgrading, if client-side code needs access to specific environment variables:
Option 1: Use the SHAKAPACKER_PUBLIC_ prefix (recommended)
```bash
# Variables with this prefix are automatically exposed
export SHAKAPACKER_PUBLIC_API_URL="https://api.example.com"
```
Option 2: Use SHAKAPACKER_ENV_VARS
```bash
SHAKAPACKER_ENV_VARS=API_URL,FEATURE_FLAG bundle exec rails assets:precompile
```
After upgrading, rotate any secrets that may have been exposed in previously compiled JavaScript bundles.
This issue can be reached over the network, attack complexity is low, an attacker needs no privileges on the target. No user interaction is required. The scope is unchanged, so the impact stays within the vulnerable component. Rated impact: confidentiality high, integrity none, availability none.
GHSA-96qw-h329-v5rg is classified as CWE-200: Exposure of Sensitive Information. Information that should stay internal is disclosed to someone who is not authorised to see it.
GHSA-96qw-h329-v5rg is recorded against 1 package.
Published on 8 January 2026 and last revised on 3 February 2026. No public exploit is currently recorded for this entry. Record sourced from OSV.
github.com (Web)
github.com (Web)
github.com (Web)
github.com (Package)
Details
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Affected Packages
| Software | From version | Fixed in |
|---|---|---|
| shakapacker | — | 9.5.0 |
References
Site Security Check
GHSA-96qw-h329-v5rg is rated CVSS 8.0 High. BotEraser scans your installation against known CVE records and tells you whether this vulnerability applies to the versions you actually run.
Scan My Site Free →No credit card required · Results in minutes
ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.
Stay up to date with the latest from Boteraser.
We use cookies to improve your experience on our site. By using our site, you consent to cookies.
Manage your cookie preferences below:
Essential cookies enable basic functions and are necessary for the proper function of the website.
CloudFlare provides web performance and security solutions, enhancing site speed and protecting against threats.
Service URL: developers.cloudflare.com (opens in a new window)
These cookies are needed for adding comments on this website.
These cookies are used for managing login functionality on this website.
Statistics cookies collect information anonymously. This information helps us understand how visitors use our website.
Google Analytics is a powerful tool that tracks and analyzes website traffic for informed marketing decisions.
Service URL: policies.google.com (opens in a new window)
You can find more information in our Cookie Policy and Privacy Policy.