@agent-beam/beam 0.2.40 → 0.2.41
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/access-risk.d.ts +1 -1
- package/dist/access-risk.js +7 -2
- package/dist/access-risk.js.map +1 -1
- package/dist/action-context.d.ts +5 -0
- package/dist/action-context.js +5 -2
- package/dist/action-context.js.map +1 -1
- package/dist/core.d.ts +5 -0
- package/dist/core.js +55 -5
- package/dist/core.js.map +1 -1
- package/dist/credential-egress.d.ts +7 -0
- package/dist/credential-egress.js +52 -6
- package/dist/credential-egress.js.map +1 -1
- package/dist/destructive-risk.d.ts +5 -1
- package/dist/destructive-risk.js +63 -5
- package/dist/destructive-risk.js.map +1 -1
- package/dist/flow.d.ts +63 -0
- package/dist/flow.js +196 -0
- package/dist/flow.js.map +1 -0
- package/dist/plain-explain.d.ts +38 -0
- package/dist/plain-explain.js +197 -0
- package/dist/plain-explain.js.map +1 -0
- package/dist/repo-remote.d.ts +39 -0
- package/dist/repo-remote.js +191 -0
- package/dist/repo-remote.js.map +1 -0
- package/dist/rule-catalog.js +237 -15
- package/dist/rule-catalog.js.map +1 -1
- package/dist/secret-use.d.ts +23 -0
- package/dist/secret-use.js +142 -0
- package/dist/secret-use.js.map +1 -0
- package/dist/skill-context.js +5 -2
- package/dist/skill-context.js.map +1 -1
- package/dist/skill-risk-rules.js +3 -1
- package/dist/skill-risk-rules.js.map +1 -1
- package/dist/skill-scan.d.ts +4 -0
- package/dist/skill-scan.js +31 -8
- package/dist/skill-scan.js.map +1 -1
- package/package.json +1 -1
- package/stress-report.json +45 -45
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { basename } from "node:path";
|
|
2
|
+
import { shellActionCommands } from "./credential-egress.js";
|
|
3
|
+
import { PRIVATE_PATH, isTemplateEnvPath, touchesSecretContent, executedText } from "./secret-use.js";
|
|
4
|
+
const MAX_STEPS = 6;
|
|
5
|
+
const clip = (s, n = 140) => (s.length > n ? s.slice(0, n - 1) + "…" : s);
|
|
6
|
+
// Pipe tails and plumbing: they shape output but are not an action worth narrating.
|
|
7
|
+
const PLUMBING = new Set(["cut", "wc", "sort", "uniq", "tr", "awk", "xargs", "tee", "cd", "echo", "printf", "true", "false", "export", "set", "unset", "sleep", "clear", "pwd", "[", "[[", "test", "read", "exit", "wait", "alias", "time", "nohup"]);
|
|
8
|
+
/** Last two path segments, no quotes -- the form used inside data fields. */
|
|
9
|
+
export function shortPath(path, safe) {
|
|
10
|
+
const clean = path.replace(/^["']|["']$/g, "");
|
|
11
|
+
if (/[$`]/.test(clean))
|
|
12
|
+
return "a file chosen by the command";
|
|
13
|
+
const parts = clean.replace(/\/+$/, "").split("/").filter(Boolean);
|
|
14
|
+
return safe(parts.length > 2 ? parts.slice(-2).join("/") : parts.join("/") || clean);
|
|
15
|
+
}
|
|
16
|
+
/** Quoted friendly name for reading in a sentence. */
|
|
17
|
+
export const friendlyName = (path, safe) => nice(path, safe);
|
|
18
|
+
function nice(path, safe) {
|
|
19
|
+
const clean = path.replace(/^["']|["']$/g, "");
|
|
20
|
+
if (/[$`]/.test(clean))
|
|
21
|
+
return "a file chosen by the command";
|
|
22
|
+
if (/[*?]/.test(clean))
|
|
23
|
+
return `files matching “${safe(clean.split("/").pop() ?? clean)}”`;
|
|
24
|
+
const parts = clean.replace(/\/+$/, "").split("/").filter(Boolean);
|
|
25
|
+
const tail = parts.length > 2 ? parts.slice(-2).join("/") : parts.join("/") || clean;
|
|
26
|
+
return `“${safe(tail)}”`;
|
|
27
|
+
}
|
|
28
|
+
const list = (items, max = 3) => (items.length > max ? `${items.slice(0, max).join(", ")} and ${items.length - max} more` : items.join(", "));
|
|
29
|
+
const GIT = {
|
|
30
|
+
status: "checked which files changed in git", diff: "looked at code changes in git", log: "looked at the commit history",
|
|
31
|
+
add: "staged files in git", commit: "saved a git commit", push: "pushed code to the shared repository", pull: "pulled the latest code",
|
|
32
|
+
checkout: "switched git branches", branch: "looked at git branches", stash: "set changes aside in git", reset: "reset git state",
|
|
33
|
+
clean: "removed untracked files with git", "ls-files": "asked git which files it tracks", "check-ignore": "asked git whether a file is ignored",
|
|
34
|
+
rm: "removed files through git", mv: "moved files through git", merge: "merged branches", rebase: "rewrote branch history", fetch: "fetched updates",
|
|
35
|
+
};
|
|
36
|
+
function describe(cmd, args, safe) {
|
|
37
|
+
const files = args.filter(a => !a.startsWith("-") && !/^\d+(?:,\d+)?p?$/.test(a));
|
|
38
|
+
if (/^(?:cat|head|tail|less|more|nl|bat|xxd|strings|od|sed)$/.test(cmd)) {
|
|
39
|
+
// sed's first non-option argument is its script (1,40p), not a file.
|
|
40
|
+
const target = cmd === "sed" ? args.filter(a => !a.startsWith("-")).slice(1) : files;
|
|
41
|
+
if (!target.length)
|
|
42
|
+
return undefined; // reading a pipe, not a file
|
|
43
|
+
const range = cmd === "sed" ? args.join(" ").match(/-n\s+['"]?(\d+),(\d+)p/) : cmd === "head" || cmd === "tail" ? args.join(" ").match(/-n?\s*(\d+)\b/) : null;
|
|
44
|
+
const how = range ? (range[2] ? `lines ${range[1]}–${range[2]} of ` : `${cmd === "head" ? "the first" : "the last"} ${range[1]} lines of `) : "";
|
|
45
|
+
return `read ${how}${list(target.map(f => nice(f, safe)))}`;
|
|
46
|
+
}
|
|
47
|
+
if (/^(?:ls|ll|la|tree|stat|file)$/.test(cmd)) {
|
|
48
|
+
if (!files.length)
|
|
49
|
+
return "listed the files in the current folder";
|
|
50
|
+
return files.length === 1 && /[*?]/.test(files[0]) ? `listed ${nice(files[0], safe)}` : `listed the files in ${list(files.map(f => nice(f, safe)))}`;
|
|
51
|
+
}
|
|
52
|
+
if (cmd === "find")
|
|
53
|
+
return `searched for files${files[0] ? ` under ${nice(files[0], safe)}` : ""}`;
|
|
54
|
+
if (/^(?:grep|egrep|rg|ag|ack)$/.test(cmd)) {
|
|
55
|
+
const pattern = files[0], where = files.slice(1);
|
|
56
|
+
const what = pattern && !/[|\\^$]{2,}/.test(pattern) ? ` for “${clip(safe(pattern.replace(/^["']|["']$/g, "")), 28)}”` : "";
|
|
57
|
+
return where.length ? `searched ${list(where.map(f => nice(f, safe)))}${what}` : `filtered the output${what}`;
|
|
58
|
+
}
|
|
59
|
+
if (cmd === "git")
|
|
60
|
+
return GIT[args.find(a => !a.startsWith("-")) ?? ""] ?? "ran a git command";
|
|
61
|
+
if (/^(?:npm|pnpm|yarn|bun|bunx|npx)$/.test(cmd)) {
|
|
62
|
+
const sub = args.find(a => !a.startsWith("-"));
|
|
63
|
+
if (sub === "run" || (cmd === "bun" && sub === "run"))
|
|
64
|
+
return `ran the project's “${safe(args[args.indexOf("run") + 1] ?? "script")}” command`;
|
|
65
|
+
if (sub === "install" || sub === "i" || sub === "add")
|
|
66
|
+
return "installed packages";
|
|
67
|
+
if (cmd === "npx" || cmd === "bunx")
|
|
68
|
+
return `ran the tool “${safe(sub ?? "")}” on demand`;
|
|
69
|
+
return `ran ${cmd} ${safe(sub ?? "")}`.trim();
|
|
70
|
+
}
|
|
71
|
+
if (/^(?:python[\d.]*|node|deno|ruby|perl|php)$/.test(cmd))
|
|
72
|
+
return args.some(a => a === "-") ? "ran a short script typed into the command" : files[0] ? `ran the script ${nice(files[0], safe)}` : "ran a short script";
|
|
73
|
+
if (/^(?:curl|wget)$/.test(cmd)) {
|
|
74
|
+
const url = args.find(a => /^https?:\/\//i.test(a.replace(/^["']|["']$/g, "")));
|
|
75
|
+
const host = url ? url.replace(/^["']/, "").replace(/^https?:\/\//i, "").split(/[/?#"']/)[0] : undefined;
|
|
76
|
+
return `contacted ${host ? safe(host) : "a web address"}${args.some(a => /^-[a-zA-Z]*[oO]$|^--output/.test(a)) ? " and saved the response" : ""}`;
|
|
77
|
+
}
|
|
78
|
+
if (cmd === "rm")
|
|
79
|
+
return `deleted ${list(files.map(f => nice(f, safe))) || "files"}${args.some(a => /^-[a-z]*r/i.test(a)) ? " (including everything inside)" : ""}`;
|
|
80
|
+
if (cmd === "mkdir")
|
|
81
|
+
return `created the folder ${list(files.map(f => nice(f, safe)))}`;
|
|
82
|
+
if (cmd === "cp")
|
|
83
|
+
return `copied ${files.length > 1 ? nice(files[0], safe) : "files"}${files.length > 1 ? ` to ${nice(files[files.length - 1], safe)}` : ""}`;
|
|
84
|
+
if (cmd === "mv")
|
|
85
|
+
return `moved ${files.length > 1 ? nice(files[0], safe) : "files"}${files.length > 1 ? ` to ${nice(files[files.length - 1], safe)}` : ""}`;
|
|
86
|
+
if (cmd === "touch")
|
|
87
|
+
return `created the file ${list(files.map(f => nice(f, safe)))}`;
|
|
88
|
+
if (cmd === "chmod" || cmd === "chown")
|
|
89
|
+
return "changed who is allowed to use a file";
|
|
90
|
+
if (/^(?:pkill|kill|killall|lsof|ps|pgrep)$/.test(cmd))
|
|
91
|
+
return "stopped or looked at a running program";
|
|
92
|
+
if (/^(?:psql|mysql|sqlite3|mongosh|redis-cli)$/.test(cmd))
|
|
93
|
+
return "ran a database command";
|
|
94
|
+
if (/^(?:docker|podman|kubectl|helm|terraform|aws|gcloud|az|vercel|railway|fly|gh|heroku)$/.test(cmd))
|
|
95
|
+
return `used the ${cmd} command-line tool`;
|
|
96
|
+
if (/^(?:source|\.)$/.test(cmd))
|
|
97
|
+
return files[0] ? `loaded settings from ${nice(files[0], safe)}` : "loaded a settings file";
|
|
98
|
+
if (cmd === "env" || cmd === "printenv")
|
|
99
|
+
return args.some(a => !a.startsWith("-")) ? "looked up a named setting" : "listed all of the computer's hidden settings";
|
|
100
|
+
if (/^(?:sed|awk)$/.test(cmd))
|
|
101
|
+
return undefined;
|
|
102
|
+
return `ran “${safe(cmd)}”`;
|
|
103
|
+
}
|
|
104
|
+
/** Steps for a shell command, in order, with plumbing left out and repeats merged. */
|
|
105
|
+
export function narrateCommand(command, safe) {
|
|
106
|
+
const all = [];
|
|
107
|
+
let admin = false;
|
|
108
|
+
const heredocEditor = /<<-?\s*['"]?\w+['"]?/.test(command) && /\.write_text\(|\.write\(|writeFile(?:Sync)?\(|open\([^)]*['"][wa]b?['"]/.test(command);
|
|
109
|
+
for (const c of shellActionCommands(command)) {
|
|
110
|
+
const t = c.tokens;
|
|
111
|
+
let at = 0;
|
|
112
|
+
while (/^[A-Za-z_]\w*=/.test(t[at]?.value ?? ""))
|
|
113
|
+
at++;
|
|
114
|
+
if (t[at]?.value === "sudo") {
|
|
115
|
+
admin = true;
|
|
116
|
+
at++;
|
|
117
|
+
}
|
|
118
|
+
const cmd = basename(t[at]?.value ?? "").toLowerCase();
|
|
119
|
+
if (!cmd || PLUMBING.has(cmd))
|
|
120
|
+
continue;
|
|
121
|
+
// Redirections (`2>/dev/null`, `> out.log`) are plumbing, not things the command acted on.
|
|
122
|
+
const raw = t.slice(at + 1).map(x => x.value);
|
|
123
|
+
const args = [];
|
|
124
|
+
for (let i = 0; i < raw.length; i++) {
|
|
125
|
+
if (/^(?:\d*>>?|&>>?|<)$/.test(raw[i])) {
|
|
126
|
+
i++;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (/^(?:\d*>>?|&>>?|<)\S/.test(raw[i]) || /^\d*>&\d*$/.test(raw[i]))
|
|
130
|
+
continue;
|
|
131
|
+
args.push(raw[i]);
|
|
132
|
+
}
|
|
133
|
+
const text = describe(cmd, args, safe);
|
|
134
|
+
if (!text)
|
|
135
|
+
continue;
|
|
136
|
+
if (all.includes(text))
|
|
137
|
+
continue;
|
|
138
|
+
all.push(text);
|
|
139
|
+
}
|
|
140
|
+
if (heredocEditor && !all.some(s => /script/.test(s)))
|
|
141
|
+
all.unshift("ran a short script that edits files");
|
|
142
|
+
const steps = all.length > MAX_STEPS ? [...all.slice(0, MAX_STEPS - 1), `and ${all.length - (MAX_STEPS - 1)} more steps`] : all;
|
|
143
|
+
return { steps: steps.map(s => clip(s)), admin };
|
|
144
|
+
}
|
|
145
|
+
const ACCESS_RULES = new Set(["credentials.environment", "credentials.access", "source.private_files"]);
|
|
146
|
+
/** Builds the event-specific explanation. Returns undefined when there is nothing useful to narrate. */
|
|
147
|
+
export function explainFinding(input) {
|
|
148
|
+
const { ruleId, severity, command, context, safe } = input;
|
|
149
|
+
if (!command.trim())
|
|
150
|
+
return undefined;
|
|
151
|
+
const narrated = narrateCommand(command, safe);
|
|
152
|
+
const steps = narrated.steps;
|
|
153
|
+
if (!steps.length)
|
|
154
|
+
return undefined;
|
|
155
|
+
const privateNames = new Set();
|
|
156
|
+
for (const a of context?.actions ?? []) {
|
|
157
|
+
const p = a.resolvedPath ?? a.target ?? "";
|
|
158
|
+
if (p && PRIVATE_PATH.test(p) && !isTemplateEnvPath(p))
|
|
159
|
+
privateNames.add(basename(p) || p);
|
|
160
|
+
}
|
|
161
|
+
for (const m of executedText(command).matchAll(/(?:^|[\s/"'=])(\.env(?:\.[\w-]+)?|\.npmrc|\.netrc|\.pgpass|id_(?:rsa|ed25519)|credentials\.json)(?![\w.])/g)) {
|
|
162
|
+
if (!isTemplateEnvPath(m[1]))
|
|
163
|
+
privateNames.add(m[1]);
|
|
164
|
+
}
|
|
165
|
+
const touched = [...privateNames].slice(0, 4).map(n => clip(safe(n), 60));
|
|
166
|
+
let opened;
|
|
167
|
+
let nuance;
|
|
168
|
+
if (ACCESS_RULES.has(ruleId)) {
|
|
169
|
+
const dump = context?.actions.some(a => a.operation === "environment-dump");
|
|
170
|
+
const lookup = context?.actions.some(a => a.operation === "environment-lookup");
|
|
171
|
+
if (touched.length) {
|
|
172
|
+
opened = context && touchesSecretContent(command, context) ? "contents" : "names-only";
|
|
173
|
+
nuance = opened === "contents"
|
|
174
|
+
? `It opened ${list(touched)}, so its contents may have been shown to the agent.`
|
|
175
|
+
: `${list(touched)} was only listed or mentioned; nothing opened its contents, so no secret was exposed.`;
|
|
176
|
+
}
|
|
177
|
+
else if (ruleId === "credentials.environment") {
|
|
178
|
+
nuance = dump ? "It listed every hidden setting at once, which can include passwords and keys."
|
|
179
|
+
: lookup ? "It looked up a single named setting, not the whole set."
|
|
180
|
+
: "The detector saw the word “env”, but the command did not list the computer's settings.";
|
|
181
|
+
opened = dump || lookup ? "contents" : "none";
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
opened = "none";
|
|
185
|
+
nuance = "The command only mentions a credential-related word; it did not open a secret file.";
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
let verdict = "check";
|
|
189
|
+
if (severity === "critical" || opened === "contents" || (!ACCESS_RULES.has(ruleId) && severity === "high" && narrated.admin))
|
|
190
|
+
verdict = "risky";
|
|
191
|
+
else if (ACCESS_RULES.has(ruleId) && (opened === "none" || opened === "names-only"))
|
|
192
|
+
verdict = "routine";
|
|
193
|
+
else if (severity === "low" || severity === "info")
|
|
194
|
+
verdict = "routine";
|
|
195
|
+
return { v: 1, steps, ...(opened ? { opened } : {}), ...(touched.length ? { touched } : {}), verdict, ...(nuance ? { nuance: clip(nuance, 220) } : {}) };
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=plain-explain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plain-explain.js","sourceRoot":"","sources":["../src/plain-explain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAuBtG,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,CAAC,GAAG,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAElF,oFAAoF;AACpF,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EA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K,KAAK,IAAI,QAAQ,KAAK,MAAM;QAAE,OAAO,GAAG,SAAS,CAAC;IAExE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAC3J,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a repository lives, for the dashboard's repository tag: GitHub, GitLab, Bitbucket, Azure
|
|
3
|
+
* DevOps, AWS CodeCommit, Hugging Face, self-hosted servers, and so on -- plus the container
|
|
4
|
+
* registries (AWS ECR, GHCR, Docker Hub, ...) a command pushes to or pulls from.
|
|
5
|
+
*
|
|
6
|
+
* Read from `.git/config` and the command text. No `git` process is spawned and nothing touches the
|
|
7
|
+
* network. Credentials in a URL (https://user:token@host/...) are always dropped, and only
|
|
8
|
+
* host + path (the same "owner/repo" you would read off the page) are reported.
|
|
9
|
+
*/
|
|
10
|
+
export type RepoRemote = {
|
|
11
|
+
/** github | gitlab | bitbucket | azure-devops | aws-codecommit | codeberg | sourcehut | gitea | huggingface | other */
|
|
12
|
+
provider: string;
|
|
13
|
+
/** Host name only, no port or credentials. */
|
|
14
|
+
host: string;
|
|
15
|
+
/** owner/repo, group/subgroup/repo, org/project/repo (Azure DevOps) or the repository name (CodeCommit). */
|
|
16
|
+
path: string;
|
|
17
|
+
protocol: "https" | "http" | "ssh" | "git" | "codecommit";
|
|
18
|
+
/** A web link to the repository, only for hosts whose layout is known. Always https. */
|
|
19
|
+
url?: string;
|
|
20
|
+
/** AWS region, for CodeCommit. */
|
|
21
|
+
region?: string;
|
|
22
|
+
};
|
|
23
|
+
export type RegistryRef = {
|
|
24
|
+
/** aws-ecr | aws-ecr-public | ghcr | docker-hub | gcr | gcp-artifact-registry | azure-acr | quay | gitlab-registry */
|
|
25
|
+
provider: string;
|
|
26
|
+
host: string;
|
|
27
|
+
/** Repository path inside the registry (no tag, no digest). */
|
|
28
|
+
path: string;
|
|
29
|
+
tag?: string;
|
|
30
|
+
/** AWS account id (ECR) -- an identifier, not a secret. */
|
|
31
|
+
account?: string;
|
|
32
|
+
region?: string;
|
|
33
|
+
};
|
|
34
|
+
/** Parses any git remote URL form. Returns undefined for local paths and anything unrecognisable. */
|
|
35
|
+
export declare function parseRemoteUrl(input: string): RepoRemote | undefined;
|
|
36
|
+
/** The origin remote (or the first remote) from a git directory's config. */
|
|
37
|
+
export declare function readOriginRemote(gitDir: string): RepoRemote | undefined;
|
|
38
|
+
/** Container registries named in a command (docker push/pull/build, aws ecr, ...). At most 4, no duplicates. */
|
|
39
|
+
export declare function registriesIn(text: string): RegistryRef[];
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { closeSync, existsSync, openSync, readSync, statSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
const SAFE_SEGMENT = /^[A-Za-z0-9._~@+-]+$/;
|
|
4
|
+
const cleanPath = (p) => p.replace(/^\/+/, "").replace(/\/+$/, "").replace(/\.git$/i, "");
|
|
5
|
+
const okPath = (p) => p.length > 0 && p.length <= 200 && p.split("/").every(s => SAFE_SEGMENT.test(s) && s !== "." && s !== "..");
|
|
6
|
+
function providerOf(host) {
|
|
7
|
+
const h = host.toLowerCase();
|
|
8
|
+
if (/(^|\.)github\./.test(h) || h === "github.com" || h.endsWith(".github.com"))
|
|
9
|
+
return "github";
|
|
10
|
+
if (/(^|\.)gitlab\./.test(h) || h.includes("gitlab"))
|
|
11
|
+
return "gitlab";
|
|
12
|
+
if (/(^|\.)bitbucket\./.test(h) || h.includes("bitbucket"))
|
|
13
|
+
return "bitbucket";
|
|
14
|
+
if (h === "dev.azure.com" || h === "ssh.dev.azure.com" || h.endsWith(".visualstudio.com"))
|
|
15
|
+
return "azure-devops";
|
|
16
|
+
if (/^git-codecommit(?:-fips)?\.[a-z0-9-]+\.amazonaws\.com(?:\.cn)?$/.test(h))
|
|
17
|
+
return "aws-codecommit";
|
|
18
|
+
if (h === "codeberg.org")
|
|
19
|
+
return "codeberg";
|
|
20
|
+
if (h === "git.sr.ht" || h === "sr.ht")
|
|
21
|
+
return "sourcehut";
|
|
22
|
+
if (h === "huggingface.co" || h.endsWith(".hf.co"))
|
|
23
|
+
return "huggingface";
|
|
24
|
+
if (h.includes("gitea") || h.includes("forgejo"))
|
|
25
|
+
return "gitea";
|
|
26
|
+
return "other";
|
|
27
|
+
}
|
|
28
|
+
function browse(provider, host, path, region) {
|
|
29
|
+
switch (provider) {
|
|
30
|
+
case "azure-devops": {
|
|
31
|
+
const [org, project, repo] = path.split("/");
|
|
32
|
+
return org && project && repo ? `https://dev.azure.com/${org}/${project}/_git/${repo}` : undefined;
|
|
33
|
+
}
|
|
34
|
+
case "aws-codecommit":
|
|
35
|
+
return region ? `https://${region}.console.aws.amazon.com/codesuite/codecommit/repositories/${path}/browse?region=${region}` : undefined;
|
|
36
|
+
case "sourcehut":
|
|
37
|
+
return `https://git.sr.ht/${path}`;
|
|
38
|
+
default:
|
|
39
|
+
return `https://${host}/${path}`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Parses any git remote URL form. Returns undefined for local paths and anything unrecognisable. */
|
|
43
|
+
export function parseRemoteUrl(input) {
|
|
44
|
+
const raw = input.trim();
|
|
45
|
+
if (!raw || raw.length > 500)
|
|
46
|
+
return undefined;
|
|
47
|
+
// codecommit::us-east-1://my-repo or codecommit://profile@my-repo
|
|
48
|
+
const cc = /^codecommit(?:::([a-z0-9-]+))?:\/\/(?:[^@/]+@)?([A-Za-z0-9._-]+)\/?$/.exec(raw);
|
|
49
|
+
if (cc) {
|
|
50
|
+
const region = cc[1];
|
|
51
|
+
return { provider: "aws-codecommit", host: region ? `git-codecommit.${region}.amazonaws.com` : "git-codecommit.amazonaws.com", path: cc[2], protocol: "codecommit", ...(region ? { region } : {}), ...(region ? { url: browse("aws-codecommit", "", cc[2], region) } : {}) };
|
|
52
|
+
}
|
|
53
|
+
let host = "", path = "", protocol = "https";
|
|
54
|
+
const scheme = /^([a-z][a-z0-9+.-]*):\/\//i.exec(raw);
|
|
55
|
+
if (scheme) {
|
|
56
|
+
let u;
|
|
57
|
+
try {
|
|
58
|
+
u = new URL(raw);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
const proto = u.protocol.replace(":", "").toLowerCase();
|
|
64
|
+
if (proto === "file")
|
|
65
|
+
return undefined;
|
|
66
|
+
protocol = proto === "http" ? "http" : proto === "https" ? "https" : proto === "git" ? "git" : "ssh";
|
|
67
|
+
host = u.hostname.toLowerCase(); // port, user and password are dropped here
|
|
68
|
+
path = decodeURIComponent(u.pathname);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
// scp-like: git@github.com:owner/repo.git (but not C:\path or ./relative)
|
|
72
|
+
const scp = /^(?:[^@/\s]+@)?([A-Za-z0-9.-]+):(?!\/\/)(.+)$/.exec(raw);
|
|
73
|
+
if (!scp || /^[A-Za-z]$/.test(scp[1]))
|
|
74
|
+
return undefined;
|
|
75
|
+
host = scp[1].toLowerCase();
|
|
76
|
+
path = scp[2];
|
|
77
|
+
protocol = "ssh";
|
|
78
|
+
}
|
|
79
|
+
if (!host || !/^[a-z0-9.-]+$/.test(host))
|
|
80
|
+
return undefined;
|
|
81
|
+
let provider = providerOf(host);
|
|
82
|
+
let region;
|
|
83
|
+
path = cleanPath(path);
|
|
84
|
+
if (provider === "azure-devops") {
|
|
85
|
+
// https://dev.azure.com/org/project/_git/repo | git@ssh.dev.azure.com:v3/org/project/repo
|
|
86
|
+
path = path.replace(/^v3\//, "").replace(/\/_git\//, "/");
|
|
87
|
+
const vs = /^([a-z0-9-]+)\.visualstudio\.com$/.exec(host);
|
|
88
|
+
if (vs)
|
|
89
|
+
path = `${vs[1]}/${path}`;
|
|
90
|
+
}
|
|
91
|
+
else if (provider === "aws-codecommit") {
|
|
92
|
+
region = /^git-codecommit(?:-fips)?\.([a-z0-9-]+)\./.exec(host)?.[1];
|
|
93
|
+
path = path.replace(/^v1\/repos\//, "");
|
|
94
|
+
}
|
|
95
|
+
else if (provider === "sourcehut") {
|
|
96
|
+
path = path.replace(/^~/, "~");
|
|
97
|
+
}
|
|
98
|
+
if (!okPath(path))
|
|
99
|
+
return undefined;
|
|
100
|
+
if (protocol === "http")
|
|
101
|
+
provider = providerOf(host);
|
|
102
|
+
return {
|
|
103
|
+
provider, host, path, protocol,
|
|
104
|
+
...(region ? { region } : {}),
|
|
105
|
+
...(protocol !== "http" ? { url: browse(provider, host, path, region) } : {}),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function readSmall(file, max = 65536) {
|
|
109
|
+
try {
|
|
110
|
+
if (!existsSync(file) || statSync(file).size > max)
|
|
111
|
+
return undefined;
|
|
112
|
+
const fd = openSync(file, "r");
|
|
113
|
+
try {
|
|
114
|
+
const buf = Buffer.alloc(max);
|
|
115
|
+
const n = readSync(fd, buf, 0, max, 0);
|
|
116
|
+
return buf.subarray(0, n).toString("utf8");
|
|
117
|
+
}
|
|
118
|
+
finally {
|
|
119
|
+
closeSync(fd);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/** The origin remote (or the first remote) from a git directory's config. */
|
|
127
|
+
export function readOriginRemote(gitDir) {
|
|
128
|
+
const config = readSmall(join(gitDir, "config"));
|
|
129
|
+
if (!config)
|
|
130
|
+
return undefined;
|
|
131
|
+
const remotes = [];
|
|
132
|
+
let current;
|
|
133
|
+
for (const line of config.split(/\r?\n/)) {
|
|
134
|
+
const section = /^\s*\[\s*remote\s+"([^"]+)"\s*\]\s*$/.exec(line);
|
|
135
|
+
if (section) {
|
|
136
|
+
current = { name: section[1] };
|
|
137
|
+
remotes.push(current);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
if (/^\s*\[/.test(line)) {
|
|
141
|
+
current = undefined;
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
const url = current && !current.url ? /^\s*url\s*=\s*(.+?)\s*$/.exec(line) : null;
|
|
145
|
+
if (current && url)
|
|
146
|
+
current.url = url[1];
|
|
147
|
+
}
|
|
148
|
+
const pick = remotes.find(r => r.name === "origin" && r.url) ?? remotes.find(r => r.url);
|
|
149
|
+
return pick?.url ? parseRemoteUrl(pick.url) : undefined;
|
|
150
|
+
}
|
|
151
|
+
// ---- container registries ---------------------------------------------------------------------
|
|
152
|
+
const TAG = "(?::([A-Za-z0-9_][A-Za-z0-9_.-]{0,127}))?";
|
|
153
|
+
const REGISTRIES = [
|
|
154
|
+
{ provider: "aws-ecr", re: new RegExp(`\\b(\\d{12})\\.dkr\\.ecr(?:-fips)?\\.([a-z0-9-]+)\\.amazonaws\\.com(?:\\.cn)?/([a-z0-9][a-z0-9._/-]*)${TAG}`, "i"),
|
|
155
|
+
build: m => ({ provider: "aws-ecr", host: `${m[1]}.dkr.ecr.${m[2]}.amazonaws.com`, path: m[3], account: m[1], region: m[2], ...(m[4] ? { tag: m[4] } : {}) }) },
|
|
156
|
+
{ provider: "aws-ecr-public", re: new RegExp(`\\bpublic\\.ecr\\.aws/([a-z0-9][a-z0-9._-]*/[a-z0-9][a-z0-9._/-]*)${TAG}`, "i"),
|
|
157
|
+
build: m => ({ provider: "aws-ecr-public", host: "public.ecr.aws", path: m[1], ...(m[2] ? { tag: m[2] } : {}) }) },
|
|
158
|
+
{ provider: "ghcr", re: new RegExp(`\\bghcr\\.io/([a-z0-9][a-z0-9._-]*/[a-z0-9][a-z0-9._/-]*)${TAG}`, "i"),
|
|
159
|
+
build: m => ({ provider: "ghcr", host: "ghcr.io", path: m[1], ...(m[2] ? { tag: m[2] } : {}) }) },
|
|
160
|
+
{ provider: "gcp-artifact-registry", re: new RegExp(`\\b([a-z0-9-]+)-docker\\.pkg\\.dev/([a-z0-9][a-z0-9.:-]*/[a-z0-9._-]+/[a-z0-9][a-z0-9._/-]*)${TAG}`, "i"),
|
|
161
|
+
build: m => ({ provider: "gcp-artifact-registry", host: `${m[1]}-docker.pkg.dev`, path: m[2], region: m[1], ...(m[3] ? { tag: m[3] } : {}) }) },
|
|
162
|
+
{ provider: "gcr", re: new RegExp(`\\b((?:[a-z]+\\.)?gcr\\.io)/([a-z0-9][a-z0-9.:-]*/[a-z0-9][a-z0-9._/-]*)${TAG}`, "i"),
|
|
163
|
+
build: m => ({ provider: "gcr", host: m[1].toLowerCase(), path: m[2], ...(m[3] ? { tag: m[3] } : {}) }) },
|
|
164
|
+
{ provider: "azure-acr", re: new RegExp(`\\b([a-z0-9]{5,50})\\.azurecr\\.io/([a-z0-9][a-z0-9._/-]*)${TAG}`, "i"),
|
|
165
|
+
build: m => ({ provider: "azure-acr", host: `${m[1]}.azurecr.io`, path: m[2], ...(m[3] ? { tag: m[3] } : {}) }) },
|
|
166
|
+
{ provider: "quay", re: new RegExp(`\\bquay\\.io/([a-z0-9][a-z0-9._-]*/[a-z0-9][a-z0-9._/-]*)${TAG}`, "i"),
|
|
167
|
+
build: m => ({ provider: "quay", host: "quay.io", path: m[1], ...(m[2] ? { tag: m[2] } : {}) }) },
|
|
168
|
+
{ provider: "gitlab-registry", re: new RegExp(`\\bregistry\\.gitlab\\.com/([a-z0-9][a-z0-9._-]*/[a-z0-9][a-z0-9._/-]*)${TAG}`, "i"),
|
|
169
|
+
build: m => ({ provider: "gitlab-registry", host: "registry.gitlab.com", path: m[1], ...(m[2] ? { tag: m[2] } : {}) }) },
|
|
170
|
+
{ provider: "docker-hub", re: new RegExp(`\\b(?:docker\\.io|index\\.docker\\.io|registry-1\\.docker\\.io)/([a-z0-9][a-z0-9._-]*/[a-z0-9][a-z0-9._/-]*)${TAG}`, "i"),
|
|
171
|
+
build: m => ({ provider: "docker-hub", host: "docker.io", path: m[1], ...(m[2] ? { tag: m[2] } : {}) }) },
|
|
172
|
+
];
|
|
173
|
+
/** Container registries named in a command (docker push/pull/build, aws ecr, ...). At most 4, no duplicates. */
|
|
174
|
+
export function registriesIn(text) {
|
|
175
|
+
const out = [];
|
|
176
|
+
const seen = new Set();
|
|
177
|
+
for (const { re, build } of REGISTRIES) {
|
|
178
|
+
for (const m of text.matchAll(new RegExp(re.source, "gi"))) {
|
|
179
|
+
const ref = build(m);
|
|
180
|
+
const key = `${ref.provider}|${ref.host}|${ref.path}`;
|
|
181
|
+
if (seen.has(key) || !okPath(ref.path.replace(/:/g, "")))
|
|
182
|
+
continue;
|
|
183
|
+
seen.add(key);
|
|
184
|
+
out.push(ref);
|
|
185
|
+
if (out.length >= 4)
|
|
186
|
+
return out;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return out;
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=repo-remote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo-remote.js","sourceRoot":"","sources":["../src/repo-remote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAqCjC,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAC5C,MAAM,SAAS,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,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