@blogic-cz/agent-tools 1.5.2 → 1.5.3
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/dist/credential-guard/index.d.ts.map +1 -1
- package/dist/gh-tool/api.d.ts.map +1 -1
- package/dist/gh-tool/gist.d.ts.map +1 -1
- package/dist/gh-tool/service.d.ts.map +1 -1
- package/dist/gh-tool/text-input.d.ts +4 -0
- package/dist/gh-tool/text-input.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/credential-guard/index.ts +102 -4
- package/src/gh-tool/api.ts +21 -1
- package/src/gh-tool/gist.ts +7 -1
- package/src/gh-tool/service.ts +9 -5
- package/src/gh-tool/text-input.ts +63 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/credential-guard/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAmB,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAM5E,8CAA8C;AAC9C,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,+CAA+C;AAC/C,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B,CAAC;AAQF,+CAA+C;AAC/C,MAAM,MAAM,eAAe,GAAG;IAC5B,uBAAuB,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACxE,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC3E,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IAC7C,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CA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A;CAAE,GAAG,IA28Bf,CAAC;AAEhE,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,YA78BC,MAAM,KAAK,OA68BsB,CAAC;AAElE,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,YA/8BC,MAAM,KAAK,MAAM,GAAG,IA+8Ba,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/gh-tool/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,EAAE,eAAe,EAA2C,MAAM,UAAU,CAAC;AACpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/gh-tool/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,EAAE,eAAe,EAA2C,MAAM,UAAU,CAAC;AACpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAU/C,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAYF,eAAO,MAAM,kBAAkB,qDA4B7B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACrD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AA4FF,eAAO,MAAM,SAAS,GAAI,CAAC,QACnB,gBAAgB,KACrB,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,cAAc,CAQjD,CAAC"}
|
|
@@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,CAAC,CAAC,EAAE,OAAO,CAAC;yBAC/C,CACnB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,KAC9C,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC;yBACf,CAAC,CAAC,EACrB,IAAI,EAAE,gBAAgB,KACnB,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;4BACzB,MAAM,MAAM,CAAC,MAAM,CAAC,gBAAgB,GAAG,SAAS,EAAE,KAAK,CAAC;0BAC1D,MAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC;6BACnC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAC/B,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,kBAAkB,EAAE,CAAC,CAAC;;AAjBpD,qBAAa,aAAc,SAAQ,kBAmBF;IAC/B,MAAM,CAAC,QAAQ,CAAC,KAAK,6FAyRnB;CACH"}
|
|
@@ -2,6 +2,10 @@ import { Effect, Schema } from "effect";
|
|
|
2
2
|
import { GitHubCommandError } from "#gh/errors";
|
|
3
3
|
declare const MissingMode: Schema.Literals<readonly ["error", "null", "default"]>;
|
|
4
4
|
export declare const isSensitivePath: (filePath: string) => boolean;
|
|
5
|
+
/** Inspect the final text, after shell expansion and after reading files or stdin. */
|
|
6
|
+
export declare function unsafeOutboundTextReason(text: string, environment?: Record<string, string | undefined>): string | null;
|
|
7
|
+
export declare const validateOutboundText: (text: string, command: string) => Effect.Effect<string, never, never> | Effect.Effect<never, GitHubCommandError, never>;
|
|
8
|
+
export declare const validateOutboundFile: (filePath: string, command: string) => Effect.Effect<void, GitHubCommandError, never>;
|
|
5
9
|
type ResolveTextInputOptions = {
|
|
6
10
|
command: string;
|
|
7
11
|
value: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-input.d.ts","sourceRoot":"","sources":["../../src/gh-tool/text-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"text-input.d.ts","sourceRoot":"","sources":["../../src/gh-tool/text-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAUhD,QAAA,MAAM,WAAW,wDAAgD,CAAC;AAIlE,eAAO,MAAM,eAAe,aAAc,MAAM,YACmB,CAAC;AAEpE,sFAAsF;AACtF,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,WAAW,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GAC5D,MAAM,GAAG,IAAI,CAqBf;AAED,eAAO,MAAM,oBAAoB,SAAU,MAAM,WAAW,MAAM,0FAYjE,CAAC;AAEF,eAAO,MAAM,oBAAoB,aAAc,MAAM,WAAW,MAAM,mDAanE,CAAC;AAkBJ,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,CAAC;IACpD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAwFF,eAAO,MAAM,wBAAwB,YAC1B,IAAI,CAAC,uBAAuB,EAAE,aAAa,GAAG,cAAc,CAAC,KACrE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAIuD,CAAC;AAEnG,eAAO,MAAM,wBAAwB,YAC1B,IAAI,CAAC,uBAAuB,EAAE,aAAa,GAAG,cAAc,CAAC,KACrE,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,EAAE,kBAAkB,CAI9C,CAAC;AAEL,eAAO,MAAM,uBAAuB,YACzB,IAAI,CAAC,uBAAuB,EAAE,aAAa,GAAG,cAAc,CAAC,GAAG;IACvE,YAAY,EAAE,MAAM,CAAC;CACtB,KACA,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAKsD,CAAC"}
|
package/package.json
CHANGED
|
@@ -361,6 +361,15 @@ function hasArgumentBraceExpansion(text: string): boolean {
|
|
|
361
361
|
}
|
|
362
362
|
|
|
363
363
|
function hasCommandArgumentBraceExpansion(argv: string[]): boolean {
|
|
364
|
+
// LogQL is data for this wrapper; its quoted label selectors are never shell-evaluated.
|
|
365
|
+
if (
|
|
366
|
+
argv[0]?.split("/").at(-1) === "bun" &&
|
|
367
|
+
argv[1] === "run" &&
|
|
368
|
+
argv[2] === "observability-tool" &&
|
|
369
|
+
argv[3] === "logs" &&
|
|
370
|
+
argv[4] === "query"
|
|
371
|
+
)
|
|
372
|
+
return false;
|
|
364
373
|
return (argv[0]?.split("/").at(-1) === "awk" && !isAwkExecution(argv)) ||
|
|
365
374
|
isJqObjectConstruction(argv)
|
|
366
375
|
? false
|
|
@@ -492,9 +501,7 @@ function hasStaticEnvironmentRead(argv: string[], allowedNames: Set<string>): bo
|
|
|
492
501
|
}
|
|
493
502
|
if (isPassiveTextCommand(argv)) return false;
|
|
494
503
|
// Any command may re-parse an argument as shell code (trap, find -exec, awk system()).
|
|
495
|
-
return (
|
|
496
|
-
hasArgumentBraceExpansion(argv.slice(1).join(" ")) || mentionsEnvironmentRead(argv.join(" "))
|
|
497
|
-
);
|
|
504
|
+
return hasCommandArgumentBraceExpansion(argv) || mentionsEnvironmentRead(argv.join(" "));
|
|
498
505
|
}
|
|
499
506
|
|
|
500
507
|
function isStaticHerdrPrompt(command: string): boolean {
|
|
@@ -626,7 +633,98 @@ function hasSensitiveFileRead(command: string): boolean {
|
|
|
626
633
|
if (inspectedArgv === null) return false;
|
|
627
634
|
const inspected = unwrapStaticCommand(inspectedArgv);
|
|
628
635
|
const name = inspected[0]?.split("/").at(-1) ?? "";
|
|
629
|
-
|
|
636
|
+
if (!readers.test(name)) return false;
|
|
637
|
+
if (name === "rg" || name === "grep") {
|
|
638
|
+
const args = inspected.slice(1);
|
|
639
|
+
const paths: string[] = [];
|
|
640
|
+
let hasPattern = false;
|
|
641
|
+
let options = true;
|
|
642
|
+
let filesOnly = false;
|
|
643
|
+
for (let i = 0; i < args.length; i++) {
|
|
644
|
+
const arg = args[i] ?? "";
|
|
645
|
+
if (options && arg === "--") {
|
|
646
|
+
options = false;
|
|
647
|
+
continue;
|
|
648
|
+
}
|
|
649
|
+
if (
|
|
650
|
+
options &&
|
|
651
|
+
(arg === "--pre" ||
|
|
652
|
+
arg.startsWith("--pre=") ||
|
|
653
|
+
arg === "--hostname-bin" ||
|
|
654
|
+
arg.startsWith("--hostname-bin="))
|
|
655
|
+
)
|
|
656
|
+
return true;
|
|
657
|
+
if (options && (arg.startsWith("--file=") || /^-f.+/.test(arg))) {
|
|
658
|
+
paths.push(arg.startsWith("--file=") ? arg.slice(7) : arg.slice(2));
|
|
659
|
+
hasPattern = true;
|
|
660
|
+
continue;
|
|
661
|
+
}
|
|
662
|
+
if (options && (arg.startsWith("--regexp=") || /^-e.+/.test(arg))) {
|
|
663
|
+
hasPattern = true;
|
|
664
|
+
continue;
|
|
665
|
+
}
|
|
666
|
+
if (
|
|
667
|
+
options &&
|
|
668
|
+
(arg.startsWith("--glob=") ||
|
|
669
|
+
arg.startsWith("--iglob=") ||
|
|
670
|
+
arg.startsWith("--include=") ||
|
|
671
|
+
/^-g.+/.test(arg))
|
|
672
|
+
) {
|
|
673
|
+
const glob = arg.startsWith("--iglob=")
|
|
674
|
+
? arg.slice(8)
|
|
675
|
+
: arg.startsWith("--include=")
|
|
676
|
+
? arg.slice(10)
|
|
677
|
+
: arg.startsWith("--glob=")
|
|
678
|
+
? arg.slice(7)
|
|
679
|
+
: arg.slice(2);
|
|
680
|
+
if (isSensitivePath(glob)) paths.push(glob);
|
|
681
|
+
continue;
|
|
682
|
+
}
|
|
683
|
+
if (
|
|
684
|
+
options &&
|
|
685
|
+
["-e", "--regexp", "-f", "--file", "-g", "--glob", "--iglob", "--include"].includes(arg)
|
|
686
|
+
) {
|
|
687
|
+
const value = args[++i];
|
|
688
|
+
if (arg === "-f" || arg === "--file") paths.push(value ?? "");
|
|
689
|
+
if (
|
|
690
|
+
(arg === "-g" || arg === "--glob" || arg === "--iglob" || arg === "--include") &&
|
|
691
|
+
value &&
|
|
692
|
+
isSensitivePath(value)
|
|
693
|
+
)
|
|
694
|
+
paths.push(value);
|
|
695
|
+
if (arg === "-e" || arg === "--regexp" || arg === "-f" || arg === "--file")
|
|
696
|
+
hasPattern = true;
|
|
697
|
+
continue;
|
|
698
|
+
}
|
|
699
|
+
if (options && (arg === "--files" || (arg === "-l" && name === "grep"))) {
|
|
700
|
+
filesOnly = arg === "--files";
|
|
701
|
+
if (filesOnly) continue;
|
|
702
|
+
}
|
|
703
|
+
if (options && arg.startsWith("-")) {
|
|
704
|
+
if (/^-[A-Za-z]+[fg]$/.test(arg)) {
|
|
705
|
+
const value = args[++i];
|
|
706
|
+
if (value && isSensitivePath(value)) paths.push(value);
|
|
707
|
+
if (arg.endsWith("f")) hasPattern = true;
|
|
708
|
+
continue;
|
|
709
|
+
}
|
|
710
|
+
const combinedPatternFile = arg.match(/^-[A-Za-z]*f(.+)$/)?.[1];
|
|
711
|
+
if (combinedPatternFile) {
|
|
712
|
+
if (isSensitivePath(combinedPatternFile)) paths.push(combinedPatternFile);
|
|
713
|
+
hasPattern = true;
|
|
714
|
+
}
|
|
715
|
+
const optionValue = arg.includes("=") ? arg.slice(arg.indexOf("=") + 1) : null;
|
|
716
|
+
if (optionValue && isSensitivePath(optionValue)) paths.push(optionValue);
|
|
717
|
+
continue;
|
|
718
|
+
}
|
|
719
|
+
if (!hasPattern && !filesOnly) {
|
|
720
|
+
hasPattern = true;
|
|
721
|
+
continue;
|
|
722
|
+
}
|
|
723
|
+
paths.push(arg);
|
|
724
|
+
}
|
|
725
|
+
return paths.some(isSensitivePath);
|
|
726
|
+
}
|
|
727
|
+
return inspected.slice(1).some(isSensitivePath);
|
|
630
728
|
});
|
|
631
729
|
}
|
|
632
730
|
const unquoted = command.replace(/'(?:\\.|[^'])*'/g, " ").replace(/"(?:\\.|[^"$`])*"/g, " ");
|
package/src/gh-tool/api.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { retryTransient } from "#shared/retry-transient";
|
|
|
4
4
|
|
|
5
5
|
import { GitHubAuthError, GitHubCommandError, GitHubNotFoundError } from "./errors";
|
|
6
6
|
import type { GitHubApiError } from "./errors";
|
|
7
|
+
import { validateOutboundText } from "./text-input";
|
|
7
8
|
|
|
8
9
|
// Direct HTTP, not `gh api`: the CLI collapses every failure into a non-zero exit and
|
|
9
10
|
// loses the status code, but merge-async answers 202 (accepted), 200 (already merged or
|
|
@@ -66,9 +67,28 @@ export type GitHubApiRequest = {
|
|
|
66
67
|
|
|
67
68
|
const MAX_API_RETRIES = 2;
|
|
68
69
|
|
|
70
|
+
const outboundBodyText = (value: unknown): string => {
|
|
71
|
+
if (typeof value === "string") return value;
|
|
72
|
+
if (Array.isArray(value)) return value.map(outboundBodyText).join("\n");
|
|
73
|
+
if (value !== null && typeof value === "object")
|
|
74
|
+
return Object.values(value).map(outboundBodyText).join("\n");
|
|
75
|
+
return "";
|
|
76
|
+
};
|
|
77
|
+
|
|
69
78
|
const githubApiAttempt = Effect.fn("gh.githubApiAttempt")(function* <T>(opts: GitHubApiRequest) {
|
|
70
|
-
const token = yield* resolveGitHubToken();
|
|
71
79
|
const method = opts.method ?? "GET";
|
|
80
|
+
const bodyText = yield* Effect.try({
|
|
81
|
+
try: () => outboundBodyText(opts.body),
|
|
82
|
+
catch: () =>
|
|
83
|
+
new GitHubCommandError({
|
|
84
|
+
command: `gh-tool ${method} ${opts.path}`,
|
|
85
|
+
exitCode: 1,
|
|
86
|
+
stderr: "Refusing to publish an invalid request body",
|
|
87
|
+
message: "Refusing to publish an invalid request body",
|
|
88
|
+
}),
|
|
89
|
+
});
|
|
90
|
+
yield* validateOutboundText(`${opts.path}\n${bodyText}`, `gh-tool ${method} ${opts.path}`);
|
|
91
|
+
const token = yield* resolveGitHubToken();
|
|
72
92
|
const url = `${GITHUB_API_ROOT}/${opts.path.replace(/^\//, "")}`;
|
|
73
93
|
|
|
74
94
|
const response = yield* Effect.tryPromise({
|
package/src/gh-tool/gist.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Effect, Option } from "effect";
|
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
|
|
5
5
|
import { formatOption, logFormatted } from "#shared";
|
|
6
|
-
import { isSensitivePath, resolveOptionalTextInput } from "#gh/text-input";
|
|
6
|
+
import { isSensitivePath, resolveOptionalTextInput, validateOutboundFile } from "#gh/text-input";
|
|
7
7
|
import { GitHubCommandError } from "./errors";
|
|
8
8
|
import { GitHubService } from "./service";
|
|
9
9
|
|
|
@@ -294,6 +294,8 @@ export const createGist = Effect.fn("gist.createGist")(function* (opts: {
|
|
|
294
294
|
}) {
|
|
295
295
|
const gh = yield* GitHubService;
|
|
296
296
|
|
|
297
|
+
for (const path of opts.paths) yield* validateOutboundFile(path, "gh-tool gist create");
|
|
298
|
+
|
|
297
299
|
const args = ["gist", "create", ...opts.paths];
|
|
298
300
|
|
|
299
301
|
if (opts.description !== null) {
|
|
@@ -339,6 +341,10 @@ const editGist = Effect.fn("gist.editGist")(function* (opts: {
|
|
|
339
341
|
}) {
|
|
340
342
|
const gh = yield* GitHubService;
|
|
341
343
|
|
|
344
|
+
for (const path of [opts.sourcePath, opts.add]) {
|
|
345
|
+
if (path !== null) yield* validateOutboundFile(path, "gh-tool gist edit");
|
|
346
|
+
}
|
|
347
|
+
|
|
342
348
|
const args = ["gist", "edit", opts.id];
|
|
343
349
|
const changes: string[] = [];
|
|
344
350
|
|
package/src/gh-tool/service.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { retryTransient } from "#shared/retry-transient";
|
|
|
10
10
|
import { githubApi } from "./api";
|
|
11
11
|
import type { GitHubApiRequest, GitHubApiResponse } from "./api";
|
|
12
12
|
import { ConfigService, getGitHubConfig, resolveGitHubRepoTarget } from "#config";
|
|
13
|
+
import { validateOutboundText } from "#gh/text-input";
|
|
13
14
|
|
|
14
15
|
// Transient GitHub-side failures worth a silent retry (vs. a hard error the agent must act on).
|
|
15
16
|
const NETWORK_ERROR_RE =
|
|
@@ -267,11 +268,14 @@ export class GitHubService extends Context.Service<
|
|
|
267
268
|
// Auto-retry transient failures, but only for idempotent reads (never replay a mutation).
|
|
268
269
|
const runGh = (args: string[]): Effect.Effect<GhResult, GhError> => {
|
|
269
270
|
const canRetry = isSafeRetryRead(args);
|
|
270
|
-
return
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
271
|
+
return Effect.gen(function* () {
|
|
272
|
+
yield* validateOutboundText(args.join("\n"), "gh-tool");
|
|
273
|
+
return yield* retryTransient({
|
|
274
|
+
attempt: () => runGhAttempt(args),
|
|
275
|
+
isTransient: (err) =>
|
|
276
|
+
err instanceof GitHubCommandError && err.retryable === true && canRetry,
|
|
277
|
+
maxRetries: MAX_GH_RETRIES,
|
|
278
|
+
});
|
|
275
279
|
});
|
|
276
280
|
};
|
|
277
281
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
2
|
|
|
3
3
|
import { GitHubCommandError } from "#gh/errors";
|
|
4
|
+
import { detectSecrets } from "#guard";
|
|
4
5
|
|
|
5
6
|
const STDIN_SENTINEL = "-";
|
|
6
7
|
const SENSITIVE_PATH_PATTERNS = [
|
|
@@ -16,6 +17,62 @@ const readTextFromStdin = () => Bun.stdin.text();
|
|
|
16
17
|
export const isSensitivePath = (filePath: string) =>
|
|
17
18
|
SENSITIVE_PATH_PATTERNS.some((pattern) => pattern.test(filePath));
|
|
18
19
|
|
|
20
|
+
/** Inspect the final text, after shell expansion and after reading files or stdin. */
|
|
21
|
+
export function unsafeOutboundTextReason(
|
|
22
|
+
text: string,
|
|
23
|
+
environment: Record<string, string | undefined> = process.env,
|
|
24
|
+
): string | null {
|
|
25
|
+
if (detectSecrets(text)) return "a credential pattern";
|
|
26
|
+
|
|
27
|
+
const sensitiveName =
|
|
28
|
+
/(?:KEY|TOKEN|SECRET|PASS(?:WORD)?|PWD|CREDENTIAL|AUTH|COOKIE|SESSION|PSK)/i;
|
|
29
|
+
const isSensitiveName = (name: string) =>
|
|
30
|
+
name !== "PWD" && name !== "OLDPWD" && sensitiveName.test(name);
|
|
31
|
+
for (const [name, value] of Object.entries(environment)) {
|
|
32
|
+
if (isSensitiveName(name) && value && value.length >= 8 && text.includes(value)) {
|
|
33
|
+
return "a credential from the process environment";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const assignments = text.match(/^[A-Za-z_][A-Za-z0-9_]*=.*$/gm) ?? [];
|
|
38
|
+
if (
|
|
39
|
+
assignments.length >= 5 &&
|
|
40
|
+
assignments.some((line) => isSensitiveName(line.split("=", 1)[0] ?? ""))
|
|
41
|
+
) {
|
|
42
|
+
return "an environment dump";
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const validateOutboundText = (text: string, command: string) => {
|
|
48
|
+
const reason = unsafeOutboundTextReason(text);
|
|
49
|
+
return reason === null
|
|
50
|
+
? Effect.succeed(text)
|
|
51
|
+
: Effect.fail(
|
|
52
|
+
new GitHubCommandError({
|
|
53
|
+
command,
|
|
54
|
+
exitCode: 1,
|
|
55
|
+
stderr: `Refusing to publish text containing ${reason}`,
|
|
56
|
+
message: `Refusing to publish text containing ${reason}`,
|
|
57
|
+
}),
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const validateOutboundFile = (filePath: string, command: string) =>
|
|
62
|
+
Effect.tryPromise({
|
|
63
|
+
try: () => readTextFile(filePath),
|
|
64
|
+
catch: () =>
|
|
65
|
+
new GitHubCommandError({
|
|
66
|
+
command,
|
|
67
|
+
exitCode: 1,
|
|
68
|
+
stderr: `Refusing to publish unreadable or sensitive file: ${filePath}`,
|
|
69
|
+
message: `Refusing to publish unreadable or sensitive file: ${filePath}`,
|
|
70
|
+
}),
|
|
71
|
+
}).pipe(
|
|
72
|
+
Effect.flatMap((text) => validateOutboundText(text, command)),
|
|
73
|
+
Effect.asVoid,
|
|
74
|
+
);
|
|
75
|
+
|
|
19
76
|
const readTextFile = (filePath: string) => {
|
|
20
77
|
if (isSensitivePath(filePath)) {
|
|
21
78
|
return Promise.reject(new Error(`Refusing to read sensitive file: ${filePath}`));
|
|
@@ -80,13 +137,13 @@ const resolveTextInputInternal = Effect.fn("gh.resolveTextInputInternal")(functi
|
|
|
80
137
|
}
|
|
81
138
|
|
|
82
139
|
if (value !== null) {
|
|
83
|
-
return value;
|
|
140
|
+
return yield* validateOutboundText(value, command);
|
|
84
141
|
}
|
|
85
142
|
|
|
86
143
|
if (fileValue !== null) {
|
|
87
144
|
const source = fileValue === STDIN_SENTINEL ? "stdin" : fileValue;
|
|
88
145
|
|
|
89
|
-
|
|
146
|
+
const text = yield* Effect.tryPromise({
|
|
90
147
|
try: () => (fileValue === STDIN_SENTINEL ? readTextFromStdin() : readTextFile(fileValue)),
|
|
91
148
|
catch: (error) =>
|
|
92
149
|
new GitHubCommandError({
|
|
@@ -96,10 +153,11 @@ const resolveTextInputInternal = Effect.fn("gh.resolveTextInputInternal")(functi
|
|
|
96
153
|
message: `Failed to read ${label} from ${source}: ${error instanceof Error ? error.message : String(error)}`,
|
|
97
154
|
}),
|
|
98
155
|
});
|
|
156
|
+
return yield* validateOutboundText(text, command);
|
|
99
157
|
}
|
|
100
158
|
|
|
101
159
|
if (stdin) {
|
|
102
|
-
|
|
160
|
+
const text = yield* Effect.tryPromise({
|
|
103
161
|
try: () => readTextFromStdin(),
|
|
104
162
|
catch: (error) =>
|
|
105
163
|
new GitHubCommandError({
|
|
@@ -109,6 +167,7 @@ const resolveTextInputInternal = Effect.fn("gh.resolveTextInputInternal")(functi
|
|
|
109
167
|
message: `Failed to read ${label} from stdin: ${error instanceof Error ? error.message : String(error)}`,
|
|
110
168
|
}),
|
|
111
169
|
});
|
|
170
|
+
return yield* validateOutboundText(text, command);
|
|
112
171
|
}
|
|
113
172
|
|
|
114
173
|
if (missingMode === "null") {
|
|
@@ -116,7 +175,7 @@ const resolveTextInputInternal = Effect.fn("gh.resolveTextInputInternal")(functi
|
|
|
116
175
|
}
|
|
117
176
|
|
|
118
177
|
if (missingMode === "default") {
|
|
119
|
-
return missingValue ?? "";
|
|
178
|
+
return yield* validateOutboundText(missingValue ?? "", command);
|
|
120
179
|
}
|
|
121
180
|
|
|
122
181
|
return yield* Effect.fail(
|