Vulnerabilities in pkg:gem/shakapacker

PACKAGE
Advisory Summary

GHSA-96qw-h329-v5rg is a HIGH (CVSS 7.5) shakapacker has environment variable leak vulnerability (CWE-200: Exposure of Sensitive Information to an Unauthorized Actor) affecting Shakapacker libraries in the npm ecosystem. The issue involves shakapacker has environment variable leak via environmentplugin that exposes secrets to client-side bundles. Remediation is available by upgrading affected packages to version 9.5.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:gem/shakapacker

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:gem/shakapacker. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-96qw-h329-v5rg - HIGH Shakapacker has environment variable leak via EnvironmentPlugin that exposes secrets to client-side bundles

GHSA-96qw-h329-v5rg at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-96qw-h329-v5rg
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
Affected Product Shakapacker
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix GHSA-96qw-h329-v5rg

To remediate this vulnerability, upgrade all affected Shakapacker dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

shakapacker fixed: 9.5.0
npm install shakapacker@9.5.0
shakapacker fixed: 9.5.0
Upgrade shakapacker to 9.5.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls shakapacker

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-96qw-h329-v5rg, inspect your project dependencies using npm:

npm ls shakapacker

Analyze the terminal output to locate any version of Shakapacker in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 9.5.0), your application is affected.

Note: The npm ls shakapacker command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, where the product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. In Shakapacker, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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 credentials - `AWS_SECRET_ACCESS_KEY` - AWS credentials - `RAILS_MASTER_KEY` - Rails encrypted credentials key - `STRIPE_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: ```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. ### 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: 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 ### Migration 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 ``` ### Action Required After upgrading, **rotate any secrets** that may have been exposed in previously compiled JavaScript bundles. ### Resources - Fix PR: https://github.com/shakacode/shakapacker/pull/857

GHSA-96qw-h329-v5rg Affected Shakapacker Versions

2 component(s)
Fixed Versions:
9.5.0
Product / Package Ecosystem Affected Versions Fixed Version
shakapacker
npm
< 9.5.0
9.5.0
shakapacker
RubyGems
< 9.5.0
9.5.0

References

Frequently Asked Questions

What is GHSA-96qw-h329-v5rg?
GHSA-96qw-h329-v5rg is a security vulnerability in Shakapacker involving Shakapacker has environment variable leak via EnvironmentPlugin that exposes secrets to client-side bundles under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Which Shakapacker versions are affected?
Affected versions include releases prior to 9.5.0 across affected packages: shakapacker.
What version fixes GHSA-96qw-h329-v5rg?
Upgrading to 9.5.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is shakapacker affected?
Yes, shakapacker is affected in releases prior to 9.5.0. Upgrade your dependency to 9.5.0 or later.
What is the CVSS score of GHSA-96qw-h329-v5rg?
GHSA-96qw-h329-v5rg has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with GHSA-96qw-h329-v5rg?
GHSA-96qw-h329-v5rg is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor (The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.).
How can I check npm dependencies for GHSA-96qw-h329-v5rg?
Run the dependency tree command: 'npm ls shakapacker'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-96qw-h329-v5rg",
  "modified" : "2026-01-08T21:13:37Z",
  "published" : "2026-01-08T21:13:37Z",
  "aliases" : [ ],
  "summary" : "Shakapacker has environment variable leak via EnvironmentPlugin that exposes secrets to client-side bundles",
  "details" : "### Summary\n\nSince 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`.\n\nThis is not a regression - the vulnerable code has existed since the original Webpacker implementation. No recent code change in Shakapacker triggered this issue.\n\n### Impact\n\nAny 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:\n\n- `DATABASE_URL` - Database credentials\n- `AWS_SECRET_ACCESS_KEY` - AWS credentials  \n- `RAILS_MASTER_KEY` - Rails encrypted credentials key\n- `STRIPE_SECRET_KEY`, `TWILIO_AUTH_TOKEN` - Third-party API keys\n- Any other secrets present in the build environment\n\n**Severity**: Critical - secrets are exposed in publicly accessible JavaScript files.\n\n### Root Cause\n\nThe original code used:\n```javascript\nnew webpack.EnvironmentPlugin(process.env)\n```\n\nThis makes every environment variable available for substitution. If any code references `process.env.SECRET_KEY`, that value is embedded in the bundle.\n\n### Patches\n\nUpgrade to version 9.5.0 or later, which uses an allowlist approach that only exposes `NODE_ENV`, `RAILS_ENV`, and `WEBPACK_SERVE` by default.\n\n### Workarounds\n\nIf developers cannot upgrade immediately:\n1. Audit client-side code and dependencies for any `process.env.X` references to sensitive variables\n2. Remove sensitive variables from the build environment\n3. Override the default plugins with a custom webpack/rspack config using an explicit allowlist\n\n### Migration\n\nAfter upgrading, if client-side code needs access to specific environment variables:\n\n**Option 1: Use the `SHAKAPACKER_PUBLIC_` prefix (recommended)**\n```bash\n# Variables with this prefix are automatically exposed\nexport SHAKAPACKER_PUBLIC_API_URL=\"https://api.example.com\"\n```\n\n**Option 2: Use `SHAKAPACKER_ENV_VARS`**\n```bash\nSHAKAPACKER_ENV_VARS=API_URL,FEATURE_FLAG bundle exec rails assets:precompile\n```\n\n### Action Required\n\nAfter upgrading, **rotate any secrets** that may have been exposed in previously compiled JavaScript bundles.\n\n### Resources\n\n- Fix PR: https://github.com/shakacode/shakapacker/pull/857",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "shakapacker"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "9.5.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "shakapacker"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "9.5.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/shakacode/shakapacker/security/advisories/GHSA-96qw-h329-v5rg"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/shakacode/shakapacker/pull/857"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/shakacode/shakapacker/commit/3e06781b18383c5c2857ed3a722f7b91bdc1bc0e"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/shakacode/shakapacker"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-01-08T21:13:37Z",
    "nvd_published_at" : null
  }
}