@karmaniverous/get-dotenv 6.2.4 → 6.4.0
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/README.md +1 -0
- package/dist/chunks/{AwsRestJsonProtocol-Bq1HE-Ln.mjs → AwsRestJsonProtocol-fYZqn-kW.mjs} +2 -2
- package/dist/chunks/{createCli-BY6_cfZr.mjs → createCli-BnRdfRRL.mjs} +7 -6
- package/dist/chunks/{externalDataInterceptor-CbsdEYa-.mjs → externalDataInterceptor-CILOLqbB.mjs} +2 -2
- package/dist/chunks/{getSSOTokenFromFile-hUSpR7Wf.mjs → getSSOTokenFromFile-BwMkZ_yT.mjs} +1 -1
- package/dist/chunks/{index-C_wqbTwI.mjs → index-0-nP97ri.mjs} +7 -6
- package/dist/chunks/{index-CeCufHlm.mjs → index-70Dm0f1N.mjs} +11 -10
- package/dist/chunks/{index-BPYF6K_G.mjs → index-BhVOypA1.mjs} +9 -8
- package/dist/chunks/{index-cIunyiUQ.mjs → index-CcwT4HJK.mjs} +6 -5
- package/dist/chunks/{index-BpCF5UKx.mjs → index-D8UL3w94.mjs} +6 -5
- package/dist/chunks/{index-Cu7rdyqN.mjs → index-DLNhHC15.mjs} +9 -8
- package/dist/chunks/{index-Dp1Ip6Ra.mjs → index-DWqbxY8Y.mjs} +11 -10
- package/dist/chunks/{index-c7zKtEuy.mjs → index-Du51s-Z0.mjs} +8 -7
- package/dist/chunks/{index-B5JKTBOL.mjs → index-DuSz0ul6.mjs} +8 -7
- package/dist/chunks/{index-DWAtHEA-.mjs → index-OeNCYa8T.mjs} +6 -5
- package/dist/chunks/{index-DyU5pKKi.mjs → index-_FP0whjC.mjs} +6 -5
- package/dist/chunks/{index-BEJFiHMX.mjs → index-o5zJ9PWL.mjs} +15 -15
- package/dist/chunks/{index-Bc3h0a95.mjs → index-r0Me7-sT.mjs} +112 -6
- package/dist/chunks/{loadSso-w1eTVg0O.mjs → loadSso-CLR1fKci.mjs} +8 -7
- package/dist/chunks/{loader-DnhPeGfq.mjs → loader-CePOf74i.mjs} +1 -0
- package/dist/chunks/{parseKnownFiles-B9cDK21V.mjs → parseKnownFiles-BQvmJ0HK.mjs} +1 -1
- package/dist/chunks/readDotenvCascade-DfFkWMjs.mjs +546 -0
- package/dist/chunks/{readMergedOptions-Nt0TR7dX.mjs → readMergedOptions-B7VdLROn.mjs} +62 -272
- package/dist/chunks/{resolveCliOptions-TFRzhB2c.mjs → resolveCliOptions-pgUXHJtj.mjs} +2 -1
- package/dist/chunks/{sdk-stream-mixin-BZoJ5jy9.mjs → sdk-stream-mixin-ecbbBR0l.mjs} +1 -1
- package/dist/chunks/{spawnEnv-CN8a7cNR.mjs → spawnEnv-CQwFu7ZJ.mjs} +2 -1
- package/dist/chunks/{types-DJ-BGABd.mjs → types-CVDR-Sjk.mjs} +1 -1
- package/dist/cli.d.ts +218 -84
- package/dist/cli.mjs +10 -10
- package/dist/cliHost.d.ts +218 -84
- package/dist/cliHost.mjs +8 -7
- package/dist/config.mjs +2 -1
- package/dist/env-overlay.d.ts +304 -2
- package/dist/env-overlay.mjs +38 -1
- package/dist/getdotenv.cli.mjs +10 -10
- package/dist/index.d.ts +703 -86
- package/dist/index.mjs +862 -13
- package/dist/plugins-aws.d.ts +153 -19
- package/dist/plugins-aws.mjs +5 -4
- package/dist/plugins-batch.d.ts +153 -19
- package/dist/plugins-batch.mjs +5 -4
- package/dist/plugins-cmd.d.ts +153 -19
- package/dist/plugins-cmd.mjs +7 -6
- package/dist/plugins-init.d.ts +153 -19
- package/dist/plugins-init.mjs +4 -4
- package/dist/plugins.d.ts +153 -19
- package/dist/plugins.mjs +9 -9
- package/package.json +1 -1
- package/dist/chunks/overlayEnv-Bs2kVayG.mjs +0 -234
|
@@ -1,20 +1,126 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as readMergedOptions, g as getDotenvCliOptions2Options, d as definePlugin } from './readMergedOptions-B7VdLROn.mjs';
|
|
2
2
|
import 'execa';
|
|
3
3
|
import 'fs-extra';
|
|
4
|
+
import 'node:path';
|
|
4
5
|
import 'crypto';
|
|
5
6
|
import 'path';
|
|
6
7
|
import 'url';
|
|
7
8
|
import '@commander-js/extra-typings';
|
|
8
9
|
import 'nanoid';
|
|
9
10
|
import 'dotenv';
|
|
10
|
-
import './loader-
|
|
11
|
+
import './loader-CePOf74i.mjs';
|
|
11
12
|
import 'package-directory';
|
|
12
13
|
import 'yaml';
|
|
13
14
|
import { z } from 'zod';
|
|
14
|
-
import {
|
|
15
|
+
import { b as resolveCommand, c as resolveShell, t as tokenize, s as shouldCapture, r as runCommand, d as buildSpawnEnv } from './spawnEnv-CQwFu7ZJ.mjs';
|
|
15
16
|
import { m as maybePreserveNodeEvalArgv, c as composeNestedEnv, s as stripOne } from './invoke-DuRPU1oC.mjs';
|
|
16
|
-
import {
|
|
17
|
-
import { r as resolveCliOptions, b as baseGetDotenvCliOptions } from './resolveCliOptions-
|
|
17
|
+
import { h as dotenvExpandFromProcessEnv } from './readDotenvCascade-DfFkWMjs.mjs';
|
|
18
|
+
import { r as resolveCliOptions, b as baseGetDotenvCliOptions } from './resolveCliOptions-pgUXHJtj.mjs';
|
|
19
|
+
|
|
20
|
+
/** src/diagnostics/entropy.ts
|
|
21
|
+
* Entropy diagnostics (presentation-only).
|
|
22
|
+
* - Gated by min length and printable ASCII.
|
|
23
|
+
* - Warn once per key per run when bits/char \>= threshold.
|
|
24
|
+
* - Supports whitelist patterns to suppress known-noise keys.
|
|
25
|
+
*/
|
|
26
|
+
const warned = new Set();
|
|
27
|
+
const isPrintableAscii = (s) => /^[\x20-\x7E]+$/.test(s);
|
|
28
|
+
const compile$1 = (patterns) => (patterns ?? []).map((p) => (typeof p === 'string' ? new RegExp(p, 'i') : p));
|
|
29
|
+
const whitelisted = (key, regs) => regs.some((re) => re.test(key));
|
|
30
|
+
const shannonBitsPerChar = (s) => {
|
|
31
|
+
const freq = new Map();
|
|
32
|
+
for (const ch of s)
|
|
33
|
+
freq.set(ch, (freq.get(ch) ?? 0) + 1);
|
|
34
|
+
const n = s.length;
|
|
35
|
+
let h = 0;
|
|
36
|
+
for (const c of freq.values()) {
|
|
37
|
+
const p = c / n;
|
|
38
|
+
h -= p * Math.log2(p);
|
|
39
|
+
}
|
|
40
|
+
return h;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Maybe emit a one-line entropy warning for a key.
|
|
44
|
+
* Caller supplies an `emit(line)` function; the helper ensures once-per-key.
|
|
45
|
+
*/
|
|
46
|
+
const maybeWarnEntropy = (key, value, origin, opts, emit) => {
|
|
47
|
+
if (!opts || opts.warnEntropy === false)
|
|
48
|
+
return;
|
|
49
|
+
if (warned.has(key))
|
|
50
|
+
return;
|
|
51
|
+
const v = value ?? '';
|
|
52
|
+
const minLen = Math.max(0, opts.entropyMinLength ?? 16);
|
|
53
|
+
const threshold = opts.entropyThreshold ?? 3.8;
|
|
54
|
+
if (v.length < minLen)
|
|
55
|
+
return;
|
|
56
|
+
if (!isPrintableAscii(v))
|
|
57
|
+
return;
|
|
58
|
+
const wl = compile$1(opts.entropyWhitelist);
|
|
59
|
+
if (whitelisted(key, wl))
|
|
60
|
+
return;
|
|
61
|
+
const bpc = shannonBitsPerChar(v);
|
|
62
|
+
if (bpc >= threshold) {
|
|
63
|
+
warned.add(key);
|
|
64
|
+
emit(`[entropy] key=${key} score=${bpc.toFixed(2)} len=${String(v.length)} origin=${origin}`);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const DEFAULT_PATTERNS = [
|
|
69
|
+
'\\bsecret\\b',
|
|
70
|
+
'\\btoken\\b',
|
|
71
|
+
'\\bpass(word)?\\b',
|
|
72
|
+
'\\bapi[_-]?key\\b',
|
|
73
|
+
'\\bkey\\b',
|
|
74
|
+
];
|
|
75
|
+
const compile = (patterns) => (patterns && patterns.length > 0 ? patterns : DEFAULT_PATTERNS).map((p) => typeof p === 'string' ? new RegExp(p, 'i') : p);
|
|
76
|
+
const shouldRedactKey = (key, regs) => regs.some((re) => re.test(key));
|
|
77
|
+
const MASK = '[redacted]';
|
|
78
|
+
/**
|
|
79
|
+
* Redact a single displayed value according to key/patterns.
|
|
80
|
+
* Returns the original value when redaction is disabled or key is not matched.
|
|
81
|
+
*/
|
|
82
|
+
const redactDisplay = (key, value, opts) => {
|
|
83
|
+
if (!value)
|
|
84
|
+
return value;
|
|
85
|
+
if (!opts?.redact)
|
|
86
|
+
return value;
|
|
87
|
+
const regs = compile(opts.redactPatterns);
|
|
88
|
+
return shouldRedactKey(key, regs) ? MASK : value;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Produce a shallow redacted copy of an env-like object for display.
|
|
92
|
+
*/
|
|
93
|
+
const redactObject = (obj, opts) => {
|
|
94
|
+
if (!opts?.redact)
|
|
95
|
+
return { ...obj };
|
|
96
|
+
const regs = compile(opts.redactPatterns);
|
|
97
|
+
const out = {};
|
|
98
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
99
|
+
out[k] = v && shouldRedactKey(k, regs) ? MASK : v;
|
|
100
|
+
}
|
|
101
|
+
return out;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Utility to redact three related displayed values (parent/dotenv/final)
|
|
105
|
+
* consistently for trace lines.
|
|
106
|
+
*/
|
|
107
|
+
const redactTriple = (key, triple, opts) => {
|
|
108
|
+
if (!opts?.redact)
|
|
109
|
+
return triple;
|
|
110
|
+
const regs = compile(opts.redactPatterns);
|
|
111
|
+
const maskIf = (v) => (v && shouldRedactKey(key, regs) ? MASK : v);
|
|
112
|
+
const out = {};
|
|
113
|
+
const p = maskIf(triple.parent);
|
|
114
|
+
const d = maskIf(triple.dotenv);
|
|
115
|
+
const f = maskIf(triple.final);
|
|
116
|
+
if (p !== undefined)
|
|
117
|
+
out.parent = p;
|
|
118
|
+
if (d !== undefined)
|
|
119
|
+
out.dotenv = d;
|
|
120
|
+
if (f !== undefined)
|
|
121
|
+
out.final = f;
|
|
122
|
+
return out;
|
|
123
|
+
};
|
|
18
124
|
|
|
19
125
|
/**
|
|
20
126
|
* Trace child env composition with redaction and entropy warnings.
|
|
@@ -371,4 +477,4 @@ const cmdPlugin = (options = {}) => {
|
|
|
371
477
|
return plugin;
|
|
372
478
|
};
|
|
373
479
|
|
|
374
|
-
export { cmdPlugin as c, traceChildEnv as t };
|
|
480
|
+
export { redactDisplay as a, cmdPlugin as c, maybeWarnEntropy as m, redactObject as r, traceChildEnv as t };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { w as resolveAwsSdkSigV4Config, x as normalizeProvider, y as getSmithyContext, z as EndpointCache, A as resolveEndpoint, B as awsEndpointFunctions, D as customEndpointFunctions, t as toUtf8, i as fromUtf8, F as parseUrl, G as NoOpLogger, I as AwsSdkSigV4Signer, J as NoAuthSigner, n as toBase64, m as fromBase64, K as emitWarningIfUnsupportedVersion, L as resolveDefaultsModeConfig, M as emitWarningIfUnsupportedVersion$1, O as loadConfig, r as streamCollector, P as Hash, N as NodeHttpHandler, Q as createDefaultUserAgentProvider, R as calculateBodyLength, S as NODE_APP_ID_CONFIG_OPTIONS, T as NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, U as NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, V as NODE_RETRY_MODE_CONFIG_OPTIONS, W as DEFAULT_RETRY_MODE, X as NODE_REGION_CONFIG_FILE_OPTIONS, Y as NODE_REGION_CONFIG_OPTIONS, Z as NODE_MAX_ATTEMPT_CONFIG_OPTIONS, _ as NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, $ as loadConfigsForDefaultMode, a0 as getAwsRegionExtensionConfiguration, a1 as getDefaultExtensionConfiguration, a2 as getHttpHandlerExtensionConfiguration, a3 as resolveAwsRegionExtensionConfiguration, a4 as resolveDefaultRuntimeConfig, a5 as resolveHttpHandlerRuntimeConfig, a6 as Client, a7 as resolveUserAgentConfig, a8 as resolveRetryConfig, a9 as resolveRegionConfig, aa as resolveEndpointConfig, ab as resolveHostHeaderConfig, ac as getSchemaSerdePlugin, ad as getUserAgentPlugin, ae as getRetryPlugin, af as getContentLengthPlugin, ag as getHostHeaderPlugin, ah as getLoggerPlugin, ai as getRecursionDetectionPlugin, aj as getHttpAuthSchemeEndpointRuleSetPlugin, ak as DefaultIdentityProviderConfig, al as getHttpSigningPlugin, am as ServiceException, an as TypeRegistry, ao as Command, ap as getEndpointPlugin } from './index-
|
|
2
|
-
import { A as AwsRestJsonProtocol } from './AwsRestJsonProtocol-
|
|
3
|
-
import './readMergedOptions-
|
|
1
|
+
import { w as resolveAwsSdkSigV4Config, x as normalizeProvider, y as getSmithyContext, z as EndpointCache, A as resolveEndpoint, B as awsEndpointFunctions, D as customEndpointFunctions, t as toUtf8, i as fromUtf8, F as parseUrl, G as NoOpLogger, I as AwsSdkSigV4Signer, J as NoAuthSigner, n as toBase64, m as fromBase64, K as emitWarningIfUnsupportedVersion, L as resolveDefaultsModeConfig, M as emitWarningIfUnsupportedVersion$1, O as loadConfig, r as streamCollector, P as Hash, N as NodeHttpHandler, Q as createDefaultUserAgentProvider, R as calculateBodyLength, S as NODE_APP_ID_CONFIG_OPTIONS, T as NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, U as NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, V as NODE_RETRY_MODE_CONFIG_OPTIONS, W as DEFAULT_RETRY_MODE, X as NODE_REGION_CONFIG_FILE_OPTIONS, Y as NODE_REGION_CONFIG_OPTIONS, Z as NODE_MAX_ATTEMPT_CONFIG_OPTIONS, _ as NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, $ as loadConfigsForDefaultMode, a0 as getAwsRegionExtensionConfiguration, a1 as getDefaultExtensionConfiguration, a2 as getHttpHandlerExtensionConfiguration, a3 as resolveAwsRegionExtensionConfiguration, a4 as resolveDefaultRuntimeConfig, a5 as resolveHttpHandlerRuntimeConfig, a6 as Client, a7 as resolveUserAgentConfig, a8 as resolveRetryConfig, a9 as resolveRegionConfig, aa as resolveEndpointConfig, ab as resolveHostHeaderConfig, ac as getSchemaSerdePlugin, ad as getUserAgentPlugin, ae as getRetryPlugin, af as getContentLengthPlugin, ag as getHostHeaderPlugin, ah as getLoggerPlugin, ai as getRecursionDetectionPlugin, aj as getHttpAuthSchemeEndpointRuleSetPlugin, ak as DefaultIdentityProviderConfig, al as getHttpSigningPlugin, am as ServiceException, an as TypeRegistry, ao as Command, ap as getEndpointPlugin } from './index-70Dm0f1N.mjs';
|
|
2
|
+
import { A as AwsRestJsonProtocol } from './AwsRestJsonProtocol-fYZqn-kW.mjs';
|
|
3
|
+
import './readMergedOptions-B7VdLROn.mjs';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import '@commander-js/extra-typings';
|
|
6
|
-
import './
|
|
6
|
+
import './readDotenvCascade-DfFkWMjs.mjs';
|
|
7
7
|
import 'fs-extra';
|
|
8
|
+
import 'node:path';
|
|
8
9
|
import './loadModuleDefault-Dj8B3Stt.mjs';
|
|
9
10
|
import 'crypto';
|
|
10
11
|
import 'path';
|
|
11
12
|
import 'url';
|
|
12
|
-
import 'nanoid';
|
|
13
13
|
import 'dotenv';
|
|
14
|
-
import '
|
|
14
|
+
import 'nanoid';
|
|
15
|
+
import './loader-CePOf74i.mjs';
|
|
15
16
|
import 'package-directory';
|
|
16
17
|
import 'yaml';
|
|
17
18
|
import 'execa';
|
|
@@ -23,7 +24,7 @@ import 'https';
|
|
|
23
24
|
import 'stream';
|
|
24
25
|
import 'process';
|
|
25
26
|
import 'node:fs';
|
|
26
|
-
import './sdk-stream-mixin-
|
|
27
|
+
import './sdk-stream-mixin-ecbbBR0l.mjs';
|
|
27
28
|
|
|
28
29
|
const defaultSSOHttpAuthSchemeParametersProvider = async (config, context, input) => {
|
|
29
30
|
return {
|