CVE-2021-4430 (published 2023-11-06T08:15Z)

A vulnerability classified as problematic has been found in Ortus Solutions ColdBox Elixir 3.1.6. This affects an unknown part of the file src/defaultConfig.js of the component ENV Variable Handler. The manipulation leads to information disclosure. Upgrading to version 3.1.7 is able to address this issue. The identifier of the patch is a3aa62daea2e44c76d08d1eac63768cd928cd69e. It is recommended to upgrade the affected component. The identifier VDB-244485 was assigned to this vulnerability.

CVSS v3 base score: 7.5, HIGH (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N)

Weakness information:
cwe_id: NVD-CWE-noinfo
cwe_name: Insufficient Information
description: There is insufficient information about the issue to classify it; details are unkown or unspecified.
extended_description: Insufficient Information

Fix information:
repo_url: https://github.com/Ortus-Solutions/coldbox-elixir
commit_details: repo_url: https://github.com/Ortus-Solutions/coldbox-elixir
author: Eric Peterson
author_date: 2021-01-12 13:14:11-07:00
msg: Fix security vulnerability that echoed out all ENV vars.

In a mistaken attempt to make defining ENV vars easier, Elixir
would define every ENV var using Webpack's `DefinePlugin`.
This was a mistake.  The entire ENV of the server generating the
bundle would be serialized into an object and delivered in the
JavaScript bundle.  This code has been removed.  You need to allow
ENV variables using the webpack's `DefinePlugin` or `EnvironmentPlugin`.
To make this easier, Elixir now has a `mix.env` method that forwards
all arguments on to `EnvironmentPlugin`.
repository: repo_url: https://github.com/Ortus-Solutions/coldbox-elixir
repo_name: Ortus-Solutions/coldbox-elixir
description: Next version of ColdBox Elixir, built on top of Webpack
repo_language: JavaScript
owner: Ortus-Solutions
file_changes: filename: index.js
change_type: ModificationType.MODIFY
diff: @@ -2,12 +2,10 @@ const ElixirConfig = require("./config");
 
 ElixirConfig.addIngredient("js", require("./ingredients/js"));
 ElixirConfig.addIngredient("vue", require("./ingredients/vue"));
-
 ElixirConfig.addIngredient("css", require("./ingredients/css"));
 ElixirConfig.addIngredient("sass", require("./ingredients/sass"));
-
 ElixirConfig.addIngredient("copy", require("./ingredients/copy"));
-
 ElixirConfig.addIngredient("browserSync", require("./ingredients/browserSync"));
+ElixirConfig.addIngredient("env", require("./ingredients/env"));
 
 module.exports = ElixirConfig;

programming_language: JavaScript
filename: env.js
change_type: ModificationType.ADD
diff: @@ -0,0 +1,9 @@
+const { EnvironmentPlugin } = require("webpack");
+
+module.exports = function(keys) {
+    return this.mergeConfig({
+        plugins: [
+            new EnvironmentPlugin(keys)
+        ]
+    });
+};

programming_language: JavaScript
filename: defaultConfig.js
change_type: ModificationType.MODIFY
diff: @@ -7,7 +7,6 @@ const ManifestPlugin = require("webpack-manifest-plugin");
 const TerserPlugin = require("terser-webpack-plugin");
 const styleLoaders = require("./utils/styleLoaders");
 const webpackMerge = require("webpack-merge");
-const webpack = require("webpack");
 const path = require("path");
 const fs = require("fs");
 
@@ -115,13 +114,6 @@ module.exports = () => ({
                 ? "[name].[contenthash].css"
                 : "[name].css"
         }),
-        new webpack.DefinePlugin({
-            // stringify each value so webpack doesn't insert variables instead of strings
-            "process.env": Object.keys(process.env).reduce((obj, key) => {
-                obj[key] = JSON.stringify(process.env[key]);
-                return obj;
-            }, {})
-        })
     ],
     stats: {
         children: false

programming_language: JavaScript