@dotenvx/dotenvx 1.24.2 → 1.24.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -4
- package/package.json +1 -1
- package/src/lib/helpers/parse.js +12 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,21 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.24.4...main)
|
|
6
6
|
|
|
7
|
-
## 1.24.
|
|
7
|
+
## [1.24.4](https://github.com/dotenvx/dotenvx/compare/v1.24.3...v1.24.4)
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
* do not expand command substitution ([#456](https://github.com/dotenvx/dotenvx/pull/456))
|
|
12
|
+
|
|
13
|
+
## [1.24.3](https://github.com/dotenvx/dotenvx/compare/v1.24.2...v1.24.3)
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
* 🐞 fix command substitution for more complex commands ([#455](https://github.com/dotenvx/dotenvx/pull/455))
|
|
18
|
+
|
|
19
|
+
## [1.24.2](https://github.com/dotenvx/dotenvx/compare/v1.24.1...v1.24.2)
|
|
8
20
|
|
|
9
21
|
### Changed
|
|
10
22
|
|
|
11
23
|
* treat pre-existing expandable values as literal in `process.env` ([#450](https://github.com/dotenvx/dotenvx/pull/450))
|
|
12
24
|
|
|
13
|
-
## 1.24.1
|
|
25
|
+
## [1.24.1](https://github.com/dotenvx/dotenvx/compare/v1.24.0...v1.24.1)
|
|
14
26
|
|
|
15
27
|
### Changed
|
|
16
28
|
|
|
17
29
|
* bump `cross-spawn` to prevent potential ReDoS [CVE-2024-21538](https://github.com/advisories/ghsa-3xgq-45jj-v275) ([#449](https://github.com/dotenvx/dotenvx/pull/449))
|
|
18
30
|
|
|
19
|
-
## 1.24.0
|
|
31
|
+
## [1.24.0](https://github.com/dotenvx/dotenvx/compare/v1.23.0...v1.24.0)
|
|
20
32
|
|
|
21
33
|
### Added
|
|
22
34
|
|
package/package.json
CHANGED
package/src/lib/helpers/parse.js
CHANGED
|
@@ -44,12 +44,17 @@ class Parse {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
// eval empty, double, or backticks
|
|
47
|
+
let evaled = false
|
|
47
48
|
if (quote !== "'" && (!this.inProcessEnv(key) || this.processEnv[key] === this.parsed[key])) {
|
|
48
|
-
|
|
49
|
+
const priorEvaled = this.parsed[key]
|
|
50
|
+
this.parsed[key] = this.eval(priorEvaled)
|
|
51
|
+
if (priorEvaled !== this.parsed[key]) {
|
|
52
|
+
evaled = true
|
|
53
|
+
}
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
// expand empty, double, or backticks
|
|
52
|
-
if (quote !== "'" && !this.processEnv[key]) {
|
|
57
|
+
if (!evaled && quote !== "'" && !this.processEnv[key]) {
|
|
53
58
|
this.parsed[key] = resolveEscapeSequences(this.expand(this.parsed[key]))
|
|
54
59
|
}
|
|
55
60
|
|
|
@@ -122,12 +127,13 @@ class Parse {
|
|
|
122
127
|
}
|
|
123
128
|
|
|
124
129
|
eval (value) {
|
|
125
|
-
|
|
130
|
+
// Match everything between the outermost $() using a regex with non-capturing groups
|
|
131
|
+
const matches = value.match(/\$\(([^)]+(?:\)[^(]*)*)\)/g) || []
|
|
126
132
|
|
|
127
133
|
return matches.reduce(function (newValue, match) {
|
|
128
|
-
const command = match.
|
|
129
|
-
const
|
|
130
|
-
return newValue.replace(match,
|
|
134
|
+
const command = match.slice(2, -1) // Extract command by removing $() wrapper
|
|
135
|
+
const result = chomp(execSync(command).toString()) // execute command
|
|
136
|
+
return newValue.replace(match, result) // Replace match with result
|
|
131
137
|
}, value)
|
|
132
138
|
}
|
|
133
139
|
|