@simple-git/argv-parser 1.1.1 → 2.0.1
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/LICENSE +20 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +244 -198
- package/dist/index.mjs.map +1 -1
- package/dist/src/args/parse-argv.d.ts +1 -0
- package/dist/src/args/parse-argv.d.ts.map +1 -0
- package/dist/src/args/parse-argv.types.d.ts +1 -0
- package/dist/src/args/parse-argv.types.d.ts.map +1 -0
- package/dist/src/config/analyse-config.d.ts +1 -0
- package/dist/src/config/analyse-config.d.ts.map +1 -0
- package/dist/src/config/config-operands.d.ts +1 -0
- package/dist/src/config/config-operands.d.ts.map +1 -0
- package/dist/src/config/config.types.d.ts +1 -0
- package/dist/src/config/config.types.d.ts.map +1 -0
- package/dist/src/config/detect-config-action.d.ts +1 -0
- package/dist/src/config/detect-config-action.d.ts.map +1 -0
- package/dist/src/env/parse-env.d.ts +25 -0
- package/dist/src/env/parse-env.d.ts.map +1 -0
- package/dist/src/flags/flags.helpers.d.ts +1 -0
- package/dist/src/flags/flags.helpers.d.ts.map +1 -0
- package/dist/src/flags/parse-global-flags.d.ts +1 -0
- package/dist/src/flags/parse-global-flags.d.ts.map +1 -0
- package/dist/src/flags/parse-task-flags.d.ts +1 -0
- package/dist/src/flags/parse-task-flags.d.ts.map +1 -0
- package/dist/src/tokens/flag-specs.d.ts +1 -0
- package/dist/src/tokens/flag-specs.d.ts.map +1 -0
- package/dist/src/tokens/token-expander.d.ts +1 -0
- package/dist/src/tokens/token-expander.d.ts.map +1 -0
- package/dist/src/vulnerabilities/detect-vulnerable-config-writes.d.ts +1 -0
- package/dist/src/vulnerabilities/detect-vulnerable-config-writes.d.ts.map +1 -0
- package/dist/src/vulnerabilities/detect-vulnerable-flags.d.ts +1 -0
- package/dist/src/vulnerabilities/detect-vulnerable-flags.d.ts.map +1 -0
- package/dist/src/vulnerabilities/vulnerability-analysis.d.ts +1 -0
- package/dist/src/vulnerabilities/vulnerability-analysis.d.ts.map +1 -0
- package/dist/src/vulnerabilities/vulnerability-check.d.ts +1 -0
- package/dist/src/vulnerabilities/vulnerability-check.d.ts.map +1 -0
- package/dist/src/vulnerabilities/vulnerability.types.d.ts +29 -0
- package/dist/src/vulnerabilities/vulnerability.types.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { isPathSpec as
|
|
2
|
-
function*
|
|
3
|
-
const
|
|
1
|
+
import { isPathSpec as v, toPaths as U } from "@simple-git/args-pathspec";
|
|
2
|
+
function* x(e, n) {
|
|
3
|
+
const t = n === "global";
|
|
4
4
|
for (const o of e)
|
|
5
|
-
o.isGlobal ===
|
|
5
|
+
o.isGlobal === t && (yield o);
|
|
6
6
|
}
|
|
7
|
-
const
|
|
7
|
+
const P = /* @__PURE__ */ new Set([
|
|
8
8
|
"--add",
|
|
9
9
|
"--edit",
|
|
10
10
|
"--remove-section",
|
|
@@ -22,45 +22,45 @@ const k = /* @__PURE__ */ new Set([
|
|
|
22
22
|
"--get-urlmatch",
|
|
23
23
|
"--list",
|
|
24
24
|
"-l"
|
|
25
|
-
]),
|
|
25
|
+
]), E = /* @__PURE__ */ new Set([
|
|
26
26
|
"edit",
|
|
27
27
|
"remove-section",
|
|
28
28
|
"rename-section",
|
|
29
29
|
"set",
|
|
30
30
|
"unset"
|
|
31
|
-
]),
|
|
32
|
-
function
|
|
33
|
-
for (const { name: o } of
|
|
34
|
-
if (
|
|
35
|
-
return
|
|
31
|
+
]), F = /* @__PURE__ */ new Set(["get", "get-color", "get-colorbool", "list"]);
|
|
32
|
+
function A(e, n) {
|
|
33
|
+
for (const { name: o } of x(e, "task")) {
|
|
34
|
+
if (P.has(o))
|
|
35
|
+
return w(!0, n);
|
|
36
36
|
if (S.has(o))
|
|
37
|
-
return
|
|
37
|
+
return w(!1, n);
|
|
38
38
|
}
|
|
39
|
-
const
|
|
40
|
-
return
|
|
39
|
+
const t = n.at(0)?.toLowerCase();
|
|
40
|
+
return t === void 0 ? null : E.has(t) ? w(!0, n.slice(1)) : F.has(t) ? w(!1, n.slice(1)) : n.length === 1 ? w(!1, n) : w(!0, n);
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
const
|
|
44
|
-
return
|
|
42
|
+
function w(e = !1, n = []) {
|
|
43
|
+
const t = n.at(0)?.toLowerCase();
|
|
44
|
+
return t === void 0 ? null : {
|
|
45
45
|
isWrite: e,
|
|
46
46
|
isRead: !e,
|
|
47
|
-
key:
|
|
48
|
-
value:
|
|
47
|
+
key: t,
|
|
48
|
+
value: n.at(1)
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
51
|
+
function O(e, n) {
|
|
52
|
+
return n.isWrite && n.value !== void 0 ? { key: n.key, value: n.value, scope: e } : { key: n.key, scope: e };
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
const
|
|
56
|
-
return !e ||
|
|
57
|
-
key: e.slice(0,
|
|
58
|
-
value: e.slice(
|
|
54
|
+
function G(e) {
|
|
55
|
+
const n = e?.indexOf("=") || -1;
|
|
56
|
+
return !e || n < 0 ? null : {
|
|
57
|
+
key: e.slice(0, n).trim().toLowerCase(),
|
|
58
|
+
value: e.slice(n + 1)
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
for (const { name:
|
|
63
|
-
switch (
|
|
61
|
+
function M(e) {
|
|
62
|
+
for (const { name: n } of x(e, "task"))
|
|
63
|
+
switch (n) {
|
|
64
64
|
case "--global":
|
|
65
65
|
return "global";
|
|
66
66
|
case "--system":
|
|
@@ -75,44 +75,44 @@ function N(e) {
|
|
|
75
75
|
}
|
|
76
76
|
return "local";
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function N({ name: e }) {
|
|
79
79
|
if (e === "-c" || e === "--config")
|
|
80
80
|
return "inline";
|
|
81
81
|
if (e === "--config-env")
|
|
82
82
|
return "env";
|
|
83
83
|
}
|
|
84
|
-
function*
|
|
85
|
-
for (const
|
|
86
|
-
const
|
|
84
|
+
function* $(e) {
|
|
85
|
+
for (const n of e) {
|
|
86
|
+
const t = N(n), o = t && G(n.value);
|
|
87
87
|
o && (yield {
|
|
88
88
|
...o,
|
|
89
|
-
scope:
|
|
89
|
+
scope: t
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function D(e, n, t) {
|
|
94
94
|
const o = {
|
|
95
95
|
read: [],
|
|
96
|
-
write: [
|
|
96
|
+
write: [...$(n)]
|
|
97
97
|
};
|
|
98
|
-
return e === "config" &&
|
|
98
|
+
return e === "config" && L(
|
|
99
99
|
o,
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
M(n),
|
|
101
|
+
A(n, t)
|
|
102
102
|
), o;
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
if (
|
|
104
|
+
function L(e, n, t) {
|
|
105
|
+
if (t === null)
|
|
106
106
|
return;
|
|
107
|
-
const o =
|
|
108
|
-
|
|
107
|
+
const o = O(n, t);
|
|
108
|
+
t.isWrite ? e.write.push(o) : e.read.push(o);
|
|
109
109
|
}
|
|
110
|
-
const
|
|
110
|
+
const C = {
|
|
111
111
|
short: /* @__PURE__ */ new Map([
|
|
112
112
|
["c", !0]
|
|
113
113
|
// -c <k=v> set config key for this invocation
|
|
114
114
|
])
|
|
115
|
-
},
|
|
115
|
+
}, I = {
|
|
116
116
|
short: new Map([
|
|
117
117
|
["C", !0],
|
|
118
118
|
// -C <path> change working directory
|
|
@@ -124,7 +124,7 @@ const x = {
|
|
|
124
124
|
// -p paginate
|
|
125
125
|
["v", !1],
|
|
126
126
|
// -v version
|
|
127
|
-
...
|
|
127
|
+
...C.short.entries()
|
|
128
128
|
]),
|
|
129
129
|
long: /* @__PURE__ */ new Set([
|
|
130
130
|
"attr-source",
|
|
@@ -199,188 +199,231 @@ const x = {
|
|
|
199
199
|
push: {
|
|
200
200
|
short: /* @__PURE__ */ new Map(),
|
|
201
201
|
long: /* @__PURE__ */ new Set(["exec", "receive-pack"])
|
|
202
|
+
},
|
|
203
|
+
rebase: {
|
|
204
|
+
short: /* @__PURE__ */ new Map([
|
|
205
|
+
["X", !0],
|
|
206
|
+
// -X <option> strategy option
|
|
207
|
+
["f", !1],
|
|
208
|
+
// -f force-rebase
|
|
209
|
+
["i", !1],
|
|
210
|
+
// -i interactive
|
|
211
|
+
["k", !1],
|
|
212
|
+
// -k keep-base
|
|
213
|
+
["m", !1],
|
|
214
|
+
// -m merge
|
|
215
|
+
["n", !1],
|
|
216
|
+
// -n no-stat
|
|
217
|
+
["q", !1],
|
|
218
|
+
// -q quiet
|
|
219
|
+
["r", !1],
|
|
220
|
+
// -r rebase-merges
|
|
221
|
+
["s", !0],
|
|
222
|
+
// -s <strategy>
|
|
223
|
+
["v", !1],
|
|
224
|
+
// -v verbose
|
|
225
|
+
["x", !0]
|
|
226
|
+
// -x <cmd> exec
|
|
227
|
+
]),
|
|
228
|
+
long: /* @__PURE__ */ new Set(["exec", "onto", "strategy", "strategy-option"])
|
|
202
229
|
}
|
|
203
230
|
}, T = { short: /* @__PURE__ */ new Map(), long: /* @__PURE__ */ new Set() };
|
|
204
|
-
function
|
|
205
|
-
const
|
|
231
|
+
function B(e) {
|
|
232
|
+
const n = R[e ?? ""] ?? T;
|
|
206
233
|
return {
|
|
207
|
-
short: new Map([...
|
|
208
|
-
long:
|
|
234
|
+
short: new Map([...C.short.entries(), ...n.short.entries()]),
|
|
235
|
+
long: n.long
|
|
209
236
|
};
|
|
210
237
|
}
|
|
211
|
-
function b(e,
|
|
238
|
+
function b(e, n = I) {
|
|
212
239
|
if (e.startsWith("--")) {
|
|
213
|
-
const
|
|
214
|
-
if (
|
|
215
|
-
return [{ name: e.slice(0,
|
|
240
|
+
const t = e.indexOf("=");
|
|
241
|
+
if (t > 2)
|
|
242
|
+
return [{ name: e.slice(0, t), value: e.slice(t + 1), needsNext: !1 }];
|
|
216
243
|
const o = e.slice(2);
|
|
217
|
-
return [{ name: e, needsNext:
|
|
244
|
+
return [{ name: e, needsNext: n.long.has(o) }];
|
|
218
245
|
}
|
|
219
246
|
if (e.length === 2) {
|
|
220
|
-
const
|
|
247
|
+
const t = e.charAt(1), o = n.short.get(t);
|
|
221
248
|
return [{ name: e, needsNext: o === !0 }];
|
|
222
249
|
}
|
|
223
|
-
return
|
|
250
|
+
return j(e, n.short);
|
|
224
251
|
}
|
|
225
|
-
function
|
|
226
|
-
const
|
|
227
|
-
for (let
|
|
228
|
-
const
|
|
229
|
-
if (
|
|
252
|
+
function j(e, n) {
|
|
253
|
+
const t = e.slice(1).split(""), o = [];
|
|
254
|
+
for (let a = 0; a < t.length; a++) {
|
|
255
|
+
const s = t[a], r = n.get(s);
|
|
256
|
+
if (r === void 0)
|
|
230
257
|
return [{ name: e, needsNext: !1 }];
|
|
231
|
-
if (
|
|
232
|
-
const
|
|
233
|
-
if (
|
|
234
|
-
return o.push({ name: `-${
|
|
258
|
+
if (r) {
|
|
259
|
+
const i = t.slice(a + 1).join("");
|
|
260
|
+
if (i && ![...i].every((m) => n.has(m)))
|
|
261
|
+
return o.push({ name: `-${s}`, value: i, needsNext: !1 }), o;
|
|
235
262
|
}
|
|
236
|
-
o.push({ name: `-${
|
|
263
|
+
o.push({ name: `-${s}`, needsNext: r });
|
|
237
264
|
}
|
|
238
265
|
return o;
|
|
239
266
|
}
|
|
240
|
-
function
|
|
241
|
-
let
|
|
242
|
-
for (;
|
|
243
|
-
const o = String(e[
|
|
267
|
+
function W(e, n = []) {
|
|
268
|
+
let t = 0;
|
|
269
|
+
for (; t < e.length; ) {
|
|
270
|
+
const o = String(e[t]);
|
|
244
271
|
if (!o.startsWith("-") || o.length < 2) break;
|
|
245
|
-
const
|
|
246
|
-
let
|
|
247
|
-
for (const
|
|
248
|
-
const
|
|
249
|
-
name:
|
|
250
|
-
value:
|
|
272
|
+
const a = b(o);
|
|
273
|
+
let s = t + 1;
|
|
274
|
+
for (const r of a) {
|
|
275
|
+
const i = {
|
|
276
|
+
name: r.name,
|
|
277
|
+
value: r.value,
|
|
251
278
|
absorbedNext: !1,
|
|
252
279
|
isGlobal: !0
|
|
253
280
|
};
|
|
254
|
-
|
|
281
|
+
r.needsNext && i.value === void 0 && s < e.length && (i.value = String(e[s]), i.absorbedNext = !0, s++), n.push(i);
|
|
255
282
|
}
|
|
256
|
-
|
|
283
|
+
t = s;
|
|
257
284
|
}
|
|
258
|
-
return { flags:
|
|
285
|
+
return { flags: n, taskIndex: t };
|
|
259
286
|
}
|
|
260
|
-
function
|
|
261
|
-
const o =
|
|
262
|
-
let
|
|
263
|
-
for (;
|
|
264
|
-
const
|
|
265
|
-
if (
|
|
266
|
-
|
|
287
|
+
function V(e, n, t = []) {
|
|
288
|
+
const o = B(n), a = [], s = [];
|
|
289
|
+
let r = 0;
|
|
290
|
+
for (; r < e.length; ) {
|
|
291
|
+
const i = e[r];
|
|
292
|
+
if (v(i)) {
|
|
293
|
+
s.push(...U(i)), r++;
|
|
267
294
|
continue;
|
|
268
295
|
}
|
|
269
|
-
const
|
|
270
|
-
if (
|
|
271
|
-
for (let
|
|
272
|
-
const
|
|
273
|
-
|
|
296
|
+
const p = String(i);
|
|
297
|
+
if (p === "--") {
|
|
298
|
+
for (let d = r + 1; d < e.length; d++) {
|
|
299
|
+
const g = e[d];
|
|
300
|
+
v(g) ? s.push(...U(g)) : s.push(String(g));
|
|
274
301
|
}
|
|
275
302
|
break;
|
|
276
303
|
}
|
|
277
|
-
if (!
|
|
278
|
-
|
|
304
|
+
if (!p.startsWith("-") || p.length < 2) {
|
|
305
|
+
a.push(p), r++;
|
|
279
306
|
continue;
|
|
280
307
|
}
|
|
281
|
-
const
|
|
282
|
-
let
|
|
283
|
-
for (const
|
|
284
|
-
const
|
|
285
|
-
name:
|
|
286
|
-
value:
|
|
308
|
+
const m = b(p, o);
|
|
309
|
+
let u = r + 1;
|
|
310
|
+
for (const d of m) {
|
|
311
|
+
const g = {
|
|
312
|
+
name: d.name,
|
|
313
|
+
value: d.value,
|
|
287
314
|
absorbedNext: !1,
|
|
288
315
|
isGlobal: !1
|
|
289
316
|
};
|
|
290
|
-
|
|
317
|
+
d.needsNext && g.value === void 0 && u < e.length && !v(e[u]) && (g.value = String(e[u]), g.absorbedNext = !0, u++), t.push(g);
|
|
291
318
|
}
|
|
292
|
-
|
|
319
|
+
r = u;
|
|
293
320
|
}
|
|
294
|
-
return { flags:
|
|
321
|
+
return { flags: t, positionals: a, pathspecs: s };
|
|
295
322
|
}
|
|
296
|
-
function*
|
|
323
|
+
function* q({
|
|
297
324
|
write: e
|
|
298
325
|
}) {
|
|
299
|
-
for (const
|
|
300
|
-
for (const
|
|
301
|
-
const o = n
|
|
326
|
+
for (const n of e)
|
|
327
|
+
for (const t of K) {
|
|
328
|
+
const o = t(n.key);
|
|
302
329
|
o && (yield o);
|
|
303
330
|
}
|
|
304
331
|
}
|
|
305
|
-
function
|
|
332
|
+
function f(e, n, t = String(e)) {
|
|
306
333
|
const o = typeof e == "string" ? new RegExp(`\\s*${e.toLowerCase()}`) : e;
|
|
307
|
-
return function(
|
|
308
|
-
if (o.test(
|
|
334
|
+
return function(s) {
|
|
335
|
+
if (o.test(s))
|
|
309
336
|
return {
|
|
310
|
-
category:
|
|
311
|
-
message: `Configuring ${
|
|
337
|
+
category: n,
|
|
338
|
+
message: `Configuring ${t} is not permitted without enabling ${n}`
|
|
312
339
|
};
|
|
313
340
|
};
|
|
314
341
|
}
|
|
315
|
-
function
|
|
316
|
-
const
|
|
317
|
-
return
|
|
342
|
+
function l(e, n) {
|
|
343
|
+
const t = new RegExp(`\\s*${e.toLowerCase().replace(/\./g, "(..+)?.")}`);
|
|
344
|
+
return f(t, n, e);
|
|
318
345
|
}
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
346
|
+
const K = [
|
|
347
|
+
f("alias", "allowUnsafeAlias"),
|
|
348
|
+
f("core.askPass", "allowUnsafeAskPass"),
|
|
349
|
+
f("core.editor", "allowUnsafeEditor"),
|
|
350
|
+
f("core.fsmonitor", "allowUnsafeFsMonitor"),
|
|
351
|
+
f("core.gitProxy", "allowUnsafeGitProxy"),
|
|
352
|
+
f("core.hooksPath", "allowUnsafeHooksPath"),
|
|
353
|
+
f("core.pager", "allowUnsafePager"),
|
|
354
|
+
f("core.sshCommand", "allowUnsafeSshCommand"),
|
|
355
|
+
l("credential.helper", "allowUnsafeCredentialHelper"),
|
|
356
|
+
l("diff.command", "allowUnsafeDiffExternal"),
|
|
357
|
+
f("diff.external", "allowUnsafeDiffExternal"),
|
|
358
|
+
l("difftool.cmd", "allowUnsafeDiffExternal"),
|
|
359
|
+
l("diff.textconv", "allowUnsafeDiffTextConv"),
|
|
360
|
+
l("filter.clean", "allowUnsafeFilter"),
|
|
361
|
+
l("filter.process", "allowUnsafeFilter"),
|
|
362
|
+
l("filter.smudge", "allowUnsafeFilter"),
|
|
363
|
+
l("gpg.program", "allowUnsafeGpgProgram"),
|
|
364
|
+
f("include.path", "allowUnsafeInclude"),
|
|
365
|
+
l("includeIf", "allowUnsafeInclude"),
|
|
366
|
+
f("init.templateDir", "allowUnsafeTemplateDir"),
|
|
367
|
+
l("pager.", "allowUnsafePager"),
|
|
368
|
+
l("merge.driver", "allowUnsafeMergeDriver"),
|
|
369
|
+
l("mergetool.path", "allowUnsafeMergeDriver"),
|
|
370
|
+
l("mergetool.cmd", "allowUnsafeMergeDriver"),
|
|
371
|
+
l("protocol.allow", "allowUnsafeProtocolOverride"),
|
|
372
|
+
l("remote.receivepack", "allowUnsafePack"),
|
|
373
|
+
l("remote.uploadpack", "allowUnsafePack"),
|
|
374
|
+
f("uploadpack.packObjectsHook", "allowUnsafePack"),
|
|
375
|
+
f("sequence.editor", "allowUnsafeEditor"),
|
|
376
|
+
l("submodule.update", "allowUnsafeSubmodule"),
|
|
377
|
+
l("tar.command", "allowUnsafeCommandBinaries"),
|
|
378
|
+
l("trailer.cmd", "allowUnsafeCommandBinaries"),
|
|
379
|
+
l("trailer.command", "allowUnsafeCommandBinaries"),
|
|
380
|
+
l("url.insteadOf", "allowUnsafeUrlRewrite")
|
|
343
381
|
];
|
|
344
|
-
function*
|
|
345
|
-
for (const
|
|
346
|
-
for (const o of
|
|
347
|
-
const
|
|
348
|
-
|
|
382
|
+
function* H(e, n) {
|
|
383
|
+
for (const t of n)
|
|
384
|
+
for (const o of X) {
|
|
385
|
+
const a = o(e, t);
|
|
386
|
+
a && (yield a);
|
|
349
387
|
}
|
|
350
388
|
}
|
|
351
|
-
function
|
|
352
|
-
const
|
|
353
|
-
return function(
|
|
354
|
-
if ((
|
|
389
|
+
function c(e, n, t, { name: o = String(n), globalOnly: a = !1, withValue: s = !1 } = {}) {
|
|
390
|
+
const r = typeof n == "string" ? new RegExp(`\\s*${n.toLowerCase()}`) : n, i = `Use of ${e ? `${e} with option ` : ""}${o} is not permitted without enabling ${t}`;
|
|
391
|
+
return function(m, u) {
|
|
392
|
+
if (!(e && m !== e) && !(a && !u.isGlobal) && !(s && u.value === void 0) && r.test(u.name))
|
|
355
393
|
return {
|
|
356
|
-
category:
|
|
357
|
-
message:
|
|
394
|
+
category: t,
|
|
395
|
+
message: i
|
|
358
396
|
};
|
|
359
397
|
};
|
|
360
398
|
}
|
|
361
|
-
const
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
),
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
399
|
+
const h = { globalOnly: !0, withValue: !0 }, X = [
|
|
400
|
+
c(null, /--(upload|receive)-pack/, "allowUnsafePack", {
|
|
401
|
+
name: "--upload-pack or --receive-pack"
|
|
402
|
+
}),
|
|
403
|
+
c("clone", /^-\w*u/, "allowUnsafePack"),
|
|
404
|
+
c("clone", "--u", "allowUnsafePack"),
|
|
405
|
+
c("push", /^--exec$/, "allowUnsafePack", { name: "--exec" }),
|
|
406
|
+
// `git` accepts unambiguous abbreviations of long options, so `--ex` and `--exe` are `--exec`
|
|
407
|
+
c("rebase", /^(-x|--ex(ec?)?)$/, "allowUnsafeExec", { name: "-x or --exec" }),
|
|
408
|
+
c(null, "--template", "allowUnsafeTemplateDir"),
|
|
409
|
+
c(null, "--exec-path", "allowUnsafeExec", h),
|
|
410
|
+
// `git` reads the configuration of whichever repository these name, so the
|
|
411
|
+
// directory alone is enough to deliver config the argv guards never see
|
|
412
|
+
c(null, "--git-dir", "allowUnsafeConfigPaths", h),
|
|
413
|
+
c(null, "--work-tree", "allowUnsafeConfigPaths", h),
|
|
414
|
+
c(null, /^-C$/, "allowUnsafeConfigPaths", { ...h, name: "-C" })
|
|
372
415
|
];
|
|
373
|
-
function
|
|
374
|
-
return [...
|
|
416
|
+
function k(e, n, t) {
|
|
417
|
+
return [...H(e, n), ...q(t)];
|
|
375
418
|
}
|
|
376
419
|
function Y(...e) {
|
|
377
|
-
const { flags:
|
|
420
|
+
const { flags: n, taskIndex: t } = W(e), o = t < e.length ? String(e[t]).toLowerCase() : null, a = o !== null ? e.slice(t + 1) : [], { positionals: s, pathspecs: r } = V(a, o, n), i = D(o, n, s);
|
|
378
421
|
return {
|
|
379
422
|
task: o,
|
|
380
|
-
flags:
|
|
381
|
-
paths:
|
|
382
|
-
config:
|
|
383
|
-
vulnerabilities: z(
|
|
423
|
+
flags: n.map(J),
|
|
424
|
+
paths: r,
|
|
425
|
+
config: i,
|
|
426
|
+
vulnerabilities: z(k(o, n, i))
|
|
384
427
|
};
|
|
385
428
|
}
|
|
386
429
|
function z(e) {
|
|
@@ -388,8 +431,8 @@ function z(e) {
|
|
|
388
431
|
value: e
|
|
389
432
|
});
|
|
390
433
|
}
|
|
391
|
-
function J({ value: e, name:
|
|
392
|
-
return e !== void 0 ? { name:
|
|
434
|
+
function J({ value: e, name: n }) {
|
|
435
|
+
return e !== void 0 ? { name: n, value: e } : { name: n };
|
|
393
436
|
}
|
|
394
437
|
const y = {
|
|
395
438
|
editor: "allowUnsafeEditor",
|
|
@@ -397,9 +440,10 @@ const y = {
|
|
|
397
440
|
git_config_global: "allowUnsafeConfigPaths",
|
|
398
441
|
git_config_system: "allowUnsafeConfigPaths",
|
|
399
442
|
git_config_count: "allowUnsafeConfigEnvCount",
|
|
443
|
+
git_config_parameters: "allowUnsafeConfigEnvCount",
|
|
400
444
|
git_config: "allowUnsafeConfigPaths",
|
|
401
445
|
git_editor: "allowUnsafeEditor",
|
|
402
|
-
git_exec_path: "
|
|
446
|
+
git_exec_path: "allowUnsafeExec",
|
|
403
447
|
git_external_diff: "allowUnsafeDiffExternal",
|
|
404
448
|
git_pager: "allowUnsafePager",
|
|
405
449
|
git_proxy_command: "allowUnsafeGitProxy",
|
|
@@ -409,55 +453,57 @@ const y = {
|
|
|
409
453
|
git_ssh_command: "allowUnsafeSshCommand",
|
|
410
454
|
pager: "allowUnsafePager",
|
|
411
455
|
prefix: "allowUnsafeConfigPaths",
|
|
412
|
-
ssh_askpass: "allowUnsafeAskPass"
|
|
456
|
+
ssh_askpass: "allowUnsafeAskPass",
|
|
457
|
+
visual: "allowUnsafeEditor"
|
|
413
458
|
};
|
|
414
459
|
function* Q(e) {
|
|
415
|
-
const
|
|
416
|
-
for (let
|
|
417
|
-
const o = e[`git_config_key_${
|
|
418
|
-
o !== void 0 && (yield { key: o.toLowerCase().trim(), value:
|
|
460
|
+
const n = parseInt(e.git_config_count ?? "0", 10);
|
|
461
|
+
for (let t = 0; t < n; t++) {
|
|
462
|
+
const o = e[`git_config_key_${t}`], a = e[`git_config_value_${t}`];
|
|
463
|
+
o !== void 0 && (yield { key: o.toLowerCase().trim(), value: a, scope: "env" });
|
|
419
464
|
}
|
|
420
465
|
}
|
|
421
|
-
function*
|
|
422
|
-
for (const
|
|
423
|
-
if (_(
|
|
424
|
-
const
|
|
466
|
+
function* Z(e) {
|
|
467
|
+
for (const n of Object.keys(e))
|
|
468
|
+
if (_(n)) {
|
|
469
|
+
const t = y[n];
|
|
425
470
|
yield {
|
|
426
|
-
category:
|
|
427
|
-
message: `Use of "${
|
|
471
|
+
category: t,
|
|
472
|
+
message: `Use of "${n.toUpperCase()}" is not permitted without enabling ${t}`
|
|
428
473
|
};
|
|
429
474
|
}
|
|
430
475
|
}
|
|
431
476
|
function _(e) {
|
|
432
477
|
return Object.hasOwn(y, e);
|
|
433
478
|
}
|
|
434
|
-
function
|
|
435
|
-
const
|
|
436
|
-
for (const [
|
|
437
|
-
const
|
|
438
|
-
(_(
|
|
479
|
+
function ee(e) {
|
|
480
|
+
const n = {};
|
|
481
|
+
for (const [t, o] of Object.entries(e)) {
|
|
482
|
+
const a = t.toLowerCase().trim();
|
|
483
|
+
(_(a) || a.startsWith("git")) && (n[a] = String(o));
|
|
439
484
|
}
|
|
440
|
-
return
|
|
485
|
+
return n;
|
|
441
486
|
}
|
|
442
|
-
function
|
|
443
|
-
const
|
|
487
|
+
function ne(e) {
|
|
488
|
+
const n = ee(e), t = {
|
|
444
489
|
read: [],
|
|
445
|
-
write: [...Q(
|
|
490
|
+
write: [...Q(n)]
|
|
446
491
|
}, o = [
|
|
447
|
-
...
|
|
448
|
-
...
|
|
492
|
+
...Z(n),
|
|
493
|
+
...k(null, [], t)
|
|
449
494
|
];
|
|
450
495
|
return {
|
|
451
|
-
config:
|
|
496
|
+
config: t,
|
|
452
497
|
vulnerabilities: o
|
|
453
498
|
};
|
|
454
499
|
}
|
|
455
|
-
function
|
|
456
|
-
return [...Y(...e).vulnerabilities, ...
|
|
500
|
+
function oe(e, n) {
|
|
501
|
+
return [...Y(...e).vulnerabilities, ...ne(n).vulnerabilities];
|
|
457
502
|
}
|
|
458
503
|
export {
|
|
504
|
+
_ as isGitEnvKey,
|
|
459
505
|
Y as parseArgv,
|
|
460
|
-
|
|
461
|
-
|
|
506
|
+
ne as parseEnv,
|
|
507
|
+
oe as vulnerabilityCheck
|
|
462
508
|
};
|
|
463
509
|
//# sourceMappingURL=index.mjs.map
|