@memnexus-ai/mx-agent-cli 0.1.297 → 0.1.298
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/agent-config/hooks/gh-pr-edit-guard.sh +21 -9
- package/dist/agent-config/settings.json +7 -1
- package/dist/commands/check.d.ts +20 -0
- package/dist/commands/check.d.ts.map +1 -0
- package/dist/commands/check.js +30 -0
- package/dist/commands/check.js.map +1 -0
- package/dist/commands/gh.d.ts +38 -0
- package/dist/commands/gh.d.ts.map +1 -0
- package/dist/commands/gh.js +162 -0
- package/dist/commands/gh.js.map +1 -0
- package/dist/commands/git-credential.d.ts +22 -0
- package/dist/commands/git-credential.d.ts.map +1 -0
- package/dist/commands/git-credential.js +53 -0
- package/dist/commands/git-credential.js.map +1 -0
- package/dist/commands/new.d.ts +24 -0
- package/dist/commands/new.d.ts.map +1 -1
- package/dist/commands/new.js +56 -5
- package/dist/commands/new.js.map +1 -1
- package/dist/commands/pr-set-body.d.ts +120 -35
- package/dist/commands/pr-set-body.d.ts.map +1 -1
- package/dist/commands/pr-set-body.js +343 -108
- package/dist/commands/pr-set-body.js.map +1 -1
- package/dist/commands/pr-sync.d.ts +2 -1
- package/dist/commands/pr-sync.d.ts.map +1 -1
- package/dist/commands/pr-sync.js +129 -32
- package/dist/commands/pr-sync.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +82 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/check-run.d.ts +131 -0
- package/dist/lib/check-run.d.ts.map +1 -0
- package/dist/lib/check-run.js +291 -0
- package/dist/lib/check-run.js.map +1 -0
- package/dist/lib/coordination-token.d.ts +33 -1
- package/dist/lib/coordination-token.d.ts.map +1 -1
- package/dist/lib/coordination-token.js +138 -9
- package/dist/lib/coordination-token.js.map +1 -1
- package/dist/lib/gh-remote.d.ts +20 -0
- package/dist/lib/gh-remote.d.ts.map +1 -1
- package/dist/lib/gh-remote.js +26 -0
- package/dist/lib/gh-remote.js.map +1 -1
- package/dist/lib/gh-token-run.d.ts +551 -0
- package/dist/lib/gh-token-run.d.ts.map +1 -0
- package/dist/lib/gh-token-run.js +1246 -0
- package/dist/lib/gh-token-run.js.map +1 -0
- package/dist/lib/git-credential.d.ts +120 -0
- package/dist/lib/git-credential.d.ts.map +1 -0
- package/dist/lib/git-credential.js +204 -0
- package/dist/lib/git-credential.js.map +1 -0
- package/dist/lib/github-app-token.d.ts +288 -0
- package/dist/lib/github-app-token.d.ts.map +1 -0
- package/dist/lib/github-app-token.js +519 -0
- package/dist/lib/github-app-token.js.map +1 -0
- package/dist/lib/memory.d.ts.map +1 -1
- package/dist/lib/memory.js +35 -2
- package/dist/lib/memory.js.map +1 -1
- package/dist/lib/repo-guard-state-dirs.d.ts +39 -0
- package/dist/lib/repo-guard-state-dirs.d.ts.map +1 -0
- package/dist/lib/repo-guard-state-dirs.js +170 -0
- package/dist/lib/repo-guard-state-dirs.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gh-token-run -- run the real `gh` with an mx-bott `gh` token in the child's
|
|
3
|
+
* environment only (#440, v56).
|
|
4
|
+
*
|
|
5
|
+
* WHAT THIS DOES. runGhWithToken(args, deps) checks the gh arguments against a
|
|
6
|
+
* fixed allowlist, mints an installation token with the `gh` permission set
|
|
7
|
+
* in-process, and spawns /usr/bin/gh with that token in one place: the
|
|
8
|
+
* `GH_TOKEN` variable of the child's environment. The product owner accepted
|
|
9
|
+
* that one place on 2026-10-19 (#440 comment 6279203208). This module never
|
|
10
|
+
* puts the token in its own environment, an argument, a file or its output.
|
|
11
|
+
*
|
|
12
|
+
* NOT ENABLED BY THIS MODULE. Nothing here installs a PATH shim, edits a hook
|
|
13
|
+
* or changes any config. Plain `gh` still uses the product owner's saved login.
|
|
14
|
+
*
|
|
15
|
+
* ARGUMENTS ARE AN ALLOWLIST (v56 plan revision 1, SF1, #440 comment
|
|
16
|
+
* 6279235415). The first argument names a command, and for a group the second
|
|
17
|
+
* names a subcommand; both must be on ALLOWED_COMMANDS. Every later argument
|
|
18
|
+
* starting with `-` must exactly match a flag listed for that subcommand.
|
|
19
|
+
* A joined form such as `-XPOST` or `--method=POST` matches nothing and is
|
|
20
|
+
* refused. A flag that takes a value consumes the next argument, which must
|
|
21
|
+
* not start with `-`. `api` takes exactly one endpoint under API_ENDPOINT_PREFIX.
|
|
22
|
+
*
|
|
23
|
+
* `--body-file` IS READ BY THE WRAPPER, NOT BY GH (v70, #761; plan comment
|
|
24
|
+
* 6406642967, revision 1 comment 6406680912; product owner decision 2026-10-26,
|
|
25
|
+
* memory 8b6e82de). Only on BODY_FILE_COMMANDS: `pr create`, `pr edit`,
|
|
26
|
+
* `pr comment`, `issue create`, `issue edit` and `issue comment`. The order is
|
|
27
|
+
* parse (planBodyFile, which puts a fixed placeholder `--body` in the argv),
|
|
28
|
+
* checkGhArgs on that argv, read (readBodyFileForGh, once), rewrite
|
|
29
|
+
* (bodyFileGhArgs), mint. gh gets the joined form `--body=<text>`, so a body
|
|
30
|
+
* starting with `-` reaches gh as the value. gh never opens the path.
|
|
31
|
+
* `--body-file` stays in ALWAYS_REFUSED_FLAGS and in no allowlist table, so a
|
|
32
|
+
* `--body-file` that reaches checkGhArgs (any other subcommand, `api`
|
|
33
|
+
* included) is still `flag-not-allowed`. The read resolves the path against
|
|
34
|
+
* the caller's cwd, refuses BODY_FILE_DENYLIST_HOME under both `os.homedir()`
|
|
35
|
+
* and the passwd home, `$GH_CONFIG_DIR`, `$XDG_CONFIG_HOME/gh`,
|
|
36
|
+
* BODY_FILE_DENYLIST_ROOT, and a hard link to a listed file or a file
|
|
37
|
+
* directly inside a listed directory; see deniedIdentities for the gap. That denylist
|
|
38
|
+
* is NOT an access control: one `cp` to a new path defeats it, and any other
|
|
39
|
+
* file this user can read can be posted, as `--body "$(cat <file>)"` already
|
|
40
|
+
* allows. `-F`, `--input`, `-f`, `--field`, `--raw-field`, `-X` and
|
|
41
|
+
* `--method` stay refused on every subcommand.
|
|
42
|
+
*
|
|
43
|
+
* NO IN-PROCESS FILTERS (security review on PR #705, Must Fix). gh evaluates
|
|
44
|
+
* `--jq` with gojq inside the gh process, and gojq's `$ENV` and `env` read
|
|
45
|
+
* that process's environment, which holds GH_TOKEN. So `--jq`, `-q` and
|
|
46
|
+
* `--slurp` are refused everywhere. `--template` and `-t` are refused too
|
|
47
|
+
* (lead decision). Pipe `--json` output to the system `jq` instead.
|
|
48
|
+
*
|
|
49
|
+
* NO OTHER HOST (security review on PR #705, SF). gh reads a host from a
|
|
50
|
+
* `HOST/OWNER/REPO` argument or a URL, and sends GH_TOKEN to `*.ghe.com` and
|
|
51
|
+
* `github.localhost`. Every positional and every non-free-text flag value is
|
|
52
|
+
* checked by isAllowedValue(). Free text (titles, bodies, comments, searches)
|
|
53
|
+
* is not read as a host by gh and is not checked.
|
|
54
|
+
*
|
|
55
|
+
* THE CHILD ENVIRONMENT IS AN ALLOWLIST (SF2). buildChildEnv() copies only
|
|
56
|
+
* LANG and TERM from this process, then sets fixed values. PATH is fixed.
|
|
57
|
+
* No pager, editor, browser, proxy, CA override, GH_ENTERPRISE_* or debug
|
|
58
|
+
* variable reaches gh. HOME and GH_CONFIG_DIR are one empty 0700 temp dir, so
|
|
59
|
+
* gh never reads the product owner's hosts.yml. The dir is removed when gh
|
|
60
|
+
* exits, and on SIGINT, SIGTERM and SIGHUP.
|
|
61
|
+
*
|
|
62
|
+
* GH RUNS IN THE WRAPPER'S OWN TEMP DIR (v69, #763; plan comment 6405228134,
|
|
63
|
+
* revision 1 comment 6405259462). The spawn `cwd` is that same temp dir, never
|
|
64
|
+
* the caller's working directory. The dir is a plain directory, not a git
|
|
65
|
+
* repository. buildChildEnv() sets `GIT_CEILING_DIRECTORIES` to the absolute
|
|
66
|
+
* parent of the temp dir, so git that gh starts finds no repository there and
|
|
67
|
+
* does not search upward. Without the ceiling, a caller-set `TMPDIR` inside a
|
|
68
|
+
* repository would put that repository's fsmonitor, hooks and aliases back in
|
|
69
|
+
* reach (red-team on the v69 plan). GH_REPO already names the repository, so
|
|
70
|
+
* gh needs no remote from git. Whether every shipped command still works from
|
|
71
|
+
* the plain directory is shown only by the live rows, not by this module.
|
|
72
|
+
* The ceiling covers git that gh starts in its working directory. It does not
|
|
73
|
+
* cover git started with `-C <dir>`, git started in another directory, or
|
|
74
|
+
* `gh --version`, which runs outside the ceiling. (v71, #759 V69-3.)
|
|
75
|
+
*
|
|
76
|
+
* A TEMP PARENT HOLDING `:` IS REFUSED (v69, lead decision on PR #766). Git
|
|
77
|
+
* splits `GIT_CEILING_DIRECTORIES` on `:`, so a parent such as `<repo>/a:b`
|
|
78
|
+
* becomes two wrong entries and git walks up into `<repo>`. runGhWithToken
|
|
79
|
+
* checks the parent right after makeTempDir(), before any mint, removes the
|
|
80
|
+
* dir and refuses with `tempdir-unsafe`. buildChildEnv() throws on the same
|
|
81
|
+
* condition, so no caller can build a child env with a split ceiling.
|
|
82
|
+
*
|
|
83
|
+
* REVOKE WHEN GH EXITS (#440 v59, #707 item 3; plan comment 6282796699,
|
|
84
|
+
* revision 1 comment 6282817801). Once a token is minted, the injected
|
|
85
|
+
* `revoke` runs once: after gh exits with any status, after a spawn failure,
|
|
86
|
+
* and on SIGINT, SIGTERM or SIGHUP after the temp dir is removed. One shared
|
|
87
|
+
* single-flight promise serves every path. Each attempt is bounded by
|
|
88
|
+
* REVOKE_TIMEOUT_MS. A failure writes `mx-agent gh: revoke-failed` and never
|
|
89
|
+
* changes the exit status, which stays gh's. A second signal during the revoke
|
|
90
|
+
* exits at once. SIGKILL or a crash skips the revoke, and the token then lives
|
|
91
|
+
* for its 1 hour.
|
|
92
|
+
*
|
|
93
|
+
* FIXED, NO OVERRIDES. The gh path, the permission set and the repository are
|
|
94
|
+
* constants. No flag, environment variable or parameter changes them. The gh
|
|
95
|
+
* path is absolute and has no PATH fallback.
|
|
96
|
+
*
|
|
97
|
+
* FAIL CLOSED. Every refusal and failure writes one stderr line naming a code
|
|
98
|
+
* only, spawns nothing it has not yet spawned, and returns non-zero. gh's own
|
|
99
|
+
* exit status passes through. No refusal writes a second line: v68 removed the
|
|
100
|
+
* two hint lines (`pr checks` and plain `pr view`) with the refusals they
|
|
101
|
+
* followed.
|
|
102
|
+
*
|
|
103
|
+
* THE `gh` SET HOLDS `contents: read` (v68, #757). Product owner decision
|
|
104
|
+
* 2026-10-25 (#757 comment 6396745069, memory cd571fc0). The measurement under
|
|
105
|
+
* the new set (#757 comment 6397047004, engineer and witness agree) exited 0
|
|
106
|
+
* for `pr create --dry-run`, `pr checks <n> --json`, plain `pr view <n>`,
|
|
107
|
+
* `pr view <branch>`, `pr diff <branch>` and `pr diff <n>`. The decision table
|
|
108
|
+
* (#757 comments 6396788460 and 6396808436) directs what follows.
|
|
109
|
+
*
|
|
110
|
+
* `pr checks <selector> --json <fields>` IS ALLOWED AGAIN (v68). `--json` is
|
|
111
|
+
* required and is its only flag; `--watch` and `--required` stay refused until
|
|
112
|
+
* measured. The selector must be a number or a pull request URL in this
|
|
113
|
+
* repository (`pr-number-required`). With none, gh reads the current branch
|
|
114
|
+
* from git in the working directory. A branch is refused because
|
|
115
|
+
* `pr checks <branch>` was not measured; gh's finder runs no git for a
|
|
116
|
+
* non-empty branch (security review at 121b903, INFO).
|
|
117
|
+
*
|
|
118
|
+
* PLAIN `pr view` IS ALLOWED AGAIN (v68). The v67 `json-required` refusal for
|
|
119
|
+
* `pr view` is removed, so `-c`/`--comments` work too.
|
|
120
|
+
*
|
|
121
|
+
* `pr view` AND `pr diff` TAKE A NUMBER, A BRANCH OR A PULL REQUEST URL (v68).
|
|
122
|
+
* Exactly one selector. No selector is refused with `pr-number-required`,
|
|
123
|
+
* because gh then reads the current branch from git in the working directory.
|
|
124
|
+
* A value holding `://` must be a pull request URL in this repository.
|
|
125
|
+
*
|
|
126
|
+
* EVERY `pr create` NEEDS `--head` (v68, #757 r1 SF3, widened by the security
|
|
127
|
+
* review at 121b903, CWE-522). Without `--head`, gh runs
|
|
128
|
+
* `git status --porcelain` in the working directory, which runs that
|
|
129
|
+
* repository's `core.fsmonitor`, and can `git push`, which runs its pre-push
|
|
130
|
+
* hook, both with GH_TOKEN in the environment (gh v2.97.0 `create.go:503,621`;
|
|
131
|
+
* `--dry-run` help says "May still push git changes"). So `pr create` without
|
|
132
|
+
* `--head`, with or without `--dry-run`, is refused with `head-required`, and
|
|
133
|
+
* so is any `--head` value that is empty or all spaces (gh v2.97.0
|
|
134
|
+
* `create.go:778` reads an empty value as no head; security re-review at
|
|
135
|
+
* 93c2f23). Every
|
|
136
|
+
* `pr create --head` value must be a bare branch name or
|
|
137
|
+
* `memnexus-ai:<branch>`; any other owner prefix is refused with
|
|
138
|
+
* `head-not-allowed`. A dry run proves gh's read path only, not that the
|
|
139
|
+
* create mutation is permitted.
|
|
140
|
+
*
|
|
141
|
+
* STILL REFUSED (v64, #729; kept in v68). `pr status` runs git in the working
|
|
142
|
+
* directory with the token in its environment, so it stays refused whatever a
|
|
143
|
+
* measurement shows. `repo view` exited 1 in v64 for a cause the measurement
|
|
144
|
+
* did not classify, and it stays refused while that cause is unmeasured. The
|
|
145
|
+
* `statusCheckRollup` field of `pr view --json` and `pr list --json` stays
|
|
146
|
+
* refused (v68 final decision 1: the cell was record-only).
|
|
147
|
+
*
|
|
148
|
+
* `pr create` READS GIT IN THE WORKING DIRECTORY (#757 r1 SF-e; v69, #763).
|
|
149
|
+
* Since v69 that working directory is the wrapper's own temp dir, with
|
|
150
|
+
* `GIT_CEILING_DIRECTORIES` set to its parent, so the git gh starts finds no
|
|
151
|
+
* repository and reads no caller's `.git/config` or hooks. A non-empty
|
|
152
|
+
* `--head` is still required, and with it gh reads git config, remotes and
|
|
153
|
+
* commit history only, and pushes nothing (`skipPushRefs`). A push would also
|
|
154
|
+
* need `contents: write`, which the `gh` set does not hold. If that is ever
|
|
155
|
+
* added, the no-`--head` path matters again (red-team F2 at 121b903); #763
|
|
156
|
+
* records that trigger as closed only once its live runs pass. The child has
|
|
157
|
+
* `GIT_CONFIG_GLOBAL=/dev/null` and `GIT_CONFIG_NOSYSTEM=1`. `pr status` stays
|
|
158
|
+
* refused: it takes no selector, and without `--repo` (always refused) it
|
|
159
|
+
* reads the current branch from git on every call (gh v2.97.0
|
|
160
|
+
* `pkg/cmd/pr/status/status.go:98-100`).
|
|
161
|
+
*
|
|
162
|
+
* MEMORY EXPOSURE, NOT REMOVED. The token is a JavaScript string in this
|
|
163
|
+
* process and a C string in the child's environment. Node cannot zero it. A
|
|
164
|
+
* process with this user's rights can read /proc/<pid>/environ of the child
|
|
165
|
+
* while gh runs. The git processes gh starts inherit GH_TOKEN. Since v69 they
|
|
166
|
+
* run in the wrapper's temp dir under `GIT_CEILING_DIRECTORIES`, so no
|
|
167
|
+
* repository's own config or hooks apply to them.
|
|
168
|
+
*/
|
|
169
|
+
import { type TokenPurpose } from './github-app-token.js';
|
|
170
|
+
/** The one gh binary run. Absolute; never looked up on PATH. */
|
|
171
|
+
export declare const GH_PATH = "/usr/bin/gh";
|
|
172
|
+
/** The permission set minted. A closed set in github-app-token.ts. */
|
|
173
|
+
export declare const GH_PURPOSE: TokenPurpose;
|
|
174
|
+
/** The host gh is pinned to. */
|
|
175
|
+
export declare const GH_HOST = "github.com";
|
|
176
|
+
/** The repository gh is pinned to, as GH_REPO. */
|
|
177
|
+
export declare const GH_REPO = "memnexus-ai/mx-agent-framework";
|
|
178
|
+
/** `pr edit` silently does nothing on gh 2.46.0 (gh-pr-edit-guard). Refused below this. */
|
|
179
|
+
export declare const MIN_GH_VERSION_FOR_PR_EDIT: readonly [number, number, number];
|
|
180
|
+
/** The only endpoint prefix `api` accepts. */
|
|
181
|
+
export declare const API_ENDPOINT_PREFIX = "repos/memnexus-ai/mx-agent-framework/";
|
|
182
|
+
/** The only URL prefix a positional argument or flag value outside `api` may hold. */
|
|
183
|
+
export declare const POSITIONAL_URL_PREFIX = "https://github.com/memnexus-ai/mx-agent-framework/";
|
|
184
|
+
/** Substrings an `api` endpoint must not hold (revision 1). */
|
|
185
|
+
export declare const API_ENDPOINT_FORBIDDEN: readonly string[];
|
|
186
|
+
/** The search qualifier `search issues` requires. scanSearchScope() finds it anywhere in the query, any case. */
|
|
187
|
+
export declare const SEARCH_REPO_QUALIFIER = "repo:memnexus-ai/mx-agent-framework";
|
|
188
|
+
/** The variables copied from this process into the child, when present. */
|
|
189
|
+
export declare const INHERITED_ENV_KEYS: readonly string[];
|
|
190
|
+
/** The fixed variables set in the child, besides GH_TOKEN, HOME and GH_CONFIG_DIR. */
|
|
191
|
+
export declare const FIXED_CHILD_ENV: Readonly<Record<string, string>>;
|
|
192
|
+
/**
|
|
193
|
+
* Flags refused on every subcommand: revision 1's list, then the PR #705 gate
|
|
194
|
+
* additions. No allowlist entry below may hold one; test H1 checks that, and
|
|
195
|
+
* runGhWithToken checks this list first.
|
|
196
|
+
*/
|
|
197
|
+
export declare const ALWAYS_REFUSED_FLAGS: readonly string[];
|
|
198
|
+
/**
|
|
199
|
+
* Commands and subcommands refused (revision 1). They are refused because they
|
|
200
|
+
* are absent from ALLOWED_COMMANDS; this list exists so tests can name them.
|
|
201
|
+
* Each is refused with `command-not-allowed` and WRAPPER_FAILURE_EXIT.
|
|
202
|
+
* v64 (#729, plan revision 1, SF4) adds `pr status`, and `repo view` (SF3,
|
|
203
|
+
* cause unmeasured). v68 (#757) removes `pr checks`, which v64 had added.
|
|
204
|
+
*/
|
|
205
|
+
export declare const ALWAYS_REFUSED_COMMANDS: readonly string[];
|
|
206
|
+
/**
|
|
207
|
+
* Subcommands refused without `--json` (v67 #749 for `pr view`; v68 #757
|
|
208
|
+
* moves it to `pr checks`). `pr checks` was measured with `--json` only
|
|
209
|
+
* (#757 cell 2), and without it gh prints a table and exits 8 on a pending
|
|
210
|
+
* check, so `--json` is required.
|
|
211
|
+
*/
|
|
212
|
+
export declare const JSON_REQUIRED_COMMANDS: readonly string[];
|
|
213
|
+
/**
|
|
214
|
+
* Subcommands whose one positional must be a pull request number (`123` or
|
|
215
|
+
* `#123`) or a pull request URL in this repository (v68, #757 decision table,
|
|
216
|
+
* cell 2). With no selector, gh's `pr checks` reads the current branch from
|
|
217
|
+
* git in the working directory. A branch is refused because it is unmeasured.
|
|
218
|
+
*/
|
|
219
|
+
export declare const PR_NUMBER_REQUIRED_COMMANDS: readonly string[];
|
|
220
|
+
/**
|
|
221
|
+
* Subcommands that need exactly one selector: a number, a branch name or a
|
|
222
|
+
* pull request URL in this repository (v68, #757 cells 5 and 6 narrow the v67
|
|
223
|
+
* number-only rule). No selector is still refused with `pr-number-required`:
|
|
224
|
+
* gh would read the current branch from git in the working directory.
|
|
225
|
+
*/
|
|
226
|
+
export declare const PR_SELECTOR_REQUIRED_COMMANDS: readonly string[];
|
|
227
|
+
/**
|
|
228
|
+
* True when the selector is a number or a pull request URL in this repository.
|
|
229
|
+
* The URL's number has the same 10-digit cap (v72): gh's URL path ignores the
|
|
230
|
+
* `Atoi` error (`finder.go:326`).
|
|
231
|
+
*/
|
|
232
|
+
export declare function isPrNumberSelector(selector: string): boolean;
|
|
233
|
+
/**
|
|
234
|
+
* True when the selector names one pull request for `pr view` or `pr diff`
|
|
235
|
+
* (v68): a number, or a branch name, or, when it holds `://`, a pull request
|
|
236
|
+
* URL in this repository (the v67 URL check, kept). An empty or all-space
|
|
237
|
+
* value is refused: gh would read it as no selector.
|
|
238
|
+
*/
|
|
239
|
+
export declare function isPrSelector(selector: string): boolean;
|
|
240
|
+
/** The only owner prefix a `pr create --head` value may carry (v68, #757 r1 SF3). */
|
|
241
|
+
export declare const HEAD_OWNER_PREFIX = "memnexus-ai:";
|
|
242
|
+
/**
|
|
243
|
+
* The refusal for one `pr create --head` value, or null (v68). Allowed: a bare
|
|
244
|
+
* branch name (no `:`), or `memnexus-ai:<branch>` with a non-empty branch and
|
|
245
|
+
* no further `:`. Any other owner prefix, in any case, is `head-not-allowed`.
|
|
246
|
+
* The value is never echoed.
|
|
247
|
+
*/
|
|
248
|
+
export declare function headRefusal(value: string): GhRunErrorCode | null;
|
|
249
|
+
/**
|
|
250
|
+
* `--json` fields refused per subcommand, compared case-insensitively (v64,
|
|
251
|
+
* #729 SF3). GitHub refuses `pr view --json statusCheckRollup` with the `gh`
|
|
252
|
+
* set (`graphql:repository.pullRequest.statusCheckRollup.nodes.0`, measured).
|
|
253
|
+
* `pr list` is listed by inference, not measurement (lead decision, v64): it
|
|
254
|
+
* selects the same field, and refusing is fail-closed. No other subcommand
|
|
255
|
+
* is listed.
|
|
256
|
+
*/
|
|
257
|
+
export declare const REFUSED_JSON_FIELDS: Readonly<Record<string, readonly string[]>>;
|
|
258
|
+
/**
|
|
259
|
+
* `bool` flags take no value. `value` flags consume the next argument, which
|
|
260
|
+
* isAllowedValue() checks. `text` flags consume free text that gh never reads
|
|
261
|
+
* as a host or repository: a title, body, comment or search string.
|
|
262
|
+
*/
|
|
263
|
+
export type FlagKind = 'bool' | 'value' | 'text';
|
|
264
|
+
export type FlagTable = Readonly<Record<string, FlagKind>>;
|
|
265
|
+
/**
|
|
266
|
+
* The allowlist. Keys are `command` or `command subcommand`. Each flag is a
|
|
267
|
+
* real gh 2.97.0 flag for that subcommand (`gh <cmd> --help`). Flags that read
|
|
268
|
+
* a file, open a browser or editor, delete a branch, filter output inside gh,
|
|
269
|
+
* or change the target repository or host are left out. `--body-file` is not
|
|
270
|
+
* here either: on BODY_FILE_COMMANDS the wrapper reads the file and gh gets
|
|
271
|
+
* `--body` (v70, applyBodyFile).
|
|
272
|
+
*/
|
|
273
|
+
export declare const ALLOWED_COMMANDS: Readonly<Record<string, FlagTable>>;
|
|
274
|
+
export type GhRunErrorCode = 'no-command' | 'command-not-allowed' | 'flag-not-allowed' | 'flag-value-missing' | 'api-endpoint-not-allowed' | 'url-not-allowed' | 'json-field-not-allowed' | 'json-required' | 'pr-number-required' | 'head-required' | 'head-not-allowed' | 'positional-not-allowed' | 'search-repo-required' | 'search-operator-not-allowed' | 'search-text-not-allowed' | 'state-not-allowed' | 'body-file-repeated' | 'body-file-with-body' | 'body-file-unreadable' | 'body-file-denied' | 'body-file-denied-fd' | 'body-file-hard-link' | 'body-file-not-regular' | 'body-file-too-large' | 'body-file-size-mismatch' | 'body-file-size-zero' | 'body-file-not-utf8' | 'body-file-nul' | 'body-arg-too-large' | 'gh-missing' | 'gh-version-unknown' | 'gh-too-old-for-pr-edit' | 'tempdir-failed' | 'tempdir-unsafe' | 'token-shape' | 'mint-failed' | 'spawn-failed';
|
|
275
|
+
/** The result of checking the arguments: ok, or a refusal code. */
|
|
276
|
+
export type ArgCheck = {
|
|
277
|
+
ok: true;
|
|
278
|
+
key: string;
|
|
279
|
+
} | {
|
|
280
|
+
ok: false;
|
|
281
|
+
code: GhRunErrorCode;
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* One positional or non-free-text flag value. Allowed: a value with no
|
|
285
|
+
* `://` and no host-shaped `HOST/OWNER/REPO` prefix (a number, a branch, a
|
|
286
|
+
* label, a login), this repository's `OWNER/REPO`, or a URL under
|
|
287
|
+
* POSITIONAL_URL_PREFIX. Returns the refusal code, or null when allowed.
|
|
288
|
+
*/
|
|
289
|
+
export declare function valueRefusal(value: string): GhRunErrorCode | null;
|
|
290
|
+
/** True when the value is allowed by valueRefusal(). */
|
|
291
|
+
export declare function isAllowedValue(value: string): boolean;
|
|
292
|
+
/** True when the search text holds a search operator (SEARCH_OPERATOR_RE). */
|
|
293
|
+
export declare function hasSearchOperator(text: string): boolean;
|
|
294
|
+
/** True when the text holds a character outside printable ASCII. */
|
|
295
|
+
export declare function hasForbiddenSearchChar(text: string): boolean;
|
|
296
|
+
/** What scanSearchScope() found in one search text. */
|
|
297
|
+
export interface SearchScope {
|
|
298
|
+
/** At least one `repo:` qualifier names this repository and passes isStrictQualifier(). */
|
|
299
|
+
hasAllowedRepo: boolean;
|
|
300
|
+
/** Some qualifier is `org:`, `user:`, `owner:`, a `repo:` naming anything else, or negated. */
|
|
301
|
+
namesOtherScope: boolean;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Scan a search text for scope qualifiers. A `repo:` value is allowed only
|
|
305
|
+
* when it equals this repository, compared case-insensitively. `org:`,
|
|
306
|
+
* `user:` and `owner:` are never allowed, and neither is any qualifier after a
|
|
307
|
+
* `-` or `!` (NEGATION_BEFORE_RE). Callers refuse operators and non-ASCII
|
|
308
|
+
* text first. Every match is checked, not the first.
|
|
309
|
+
*/
|
|
310
|
+
export declare function scanSearchScope(text: string): SearchScope;
|
|
311
|
+
/**
|
|
312
|
+
* True when the search text names a scope other than this repository. Used
|
|
313
|
+
* for `search issues` and every `-S`/`--search` value, `label list` included.
|
|
314
|
+
*/
|
|
315
|
+
export declare function namesOtherScope(text: string): boolean;
|
|
316
|
+
/**
|
|
317
|
+
* The refusal for one search text (an `-S`/`--search` value, the joined
|
|
318
|
+
* `search issues` positionals, or a value searchValueRefusal() checks), or null. Checked in this order: a character
|
|
319
|
+
* outside printable ASCII, a quote, a search operator, a scope other than this
|
|
320
|
+
* repository. The scan keeps its quote handling as a second layer.
|
|
321
|
+
*/
|
|
322
|
+
export declare function searchTextRefusal(text: string): GhRunErrorCode | null;
|
|
323
|
+
/**
|
|
324
|
+
* The refusal for whitespace inside one argument gh writes into a search query
|
|
325
|
+
* as a single term, or null (v58, #707 item 1). `\s` covers space, tab,
|
|
326
|
+
* newline and the no-break space. gh 2.97.0 quotes such an argument after its
|
|
327
|
+
* first `:`, so `'is:open repo:memnexus-ai/mx-agent-framework'` becomes
|
|
328
|
+
* `is:"open repo:memnexus-ai/mx-agent-framework"` and the `repo:` qualifier is
|
|
329
|
+
* read as part of a value (security review on PR #709, comment 6281614905).
|
|
330
|
+
*/
|
|
331
|
+
export declare function searchTermRefusal(term: string): GhRunErrorCode | null;
|
|
332
|
+
/**
|
|
333
|
+
* The refusal for one value gh writes into a search query, or null: every
|
|
334
|
+
* `search issues` value flag, and the SEARCH_QUERY_VALUE_FLAGS of `pr list`
|
|
335
|
+
* and `issue list`. They get the search text checks, and whitespace is refused
|
|
336
|
+
* as well (red-team Must Fix list on PR #709, item 3).
|
|
337
|
+
*/
|
|
338
|
+
export declare function searchValueRefusal(value: string): GhRunErrorCode | null;
|
|
339
|
+
/**
|
|
340
|
+
* The `pr list` and `issue list` value flags whose value gh 2.97.0 writes into
|
|
341
|
+
* the search query (v58, #707 item 1; security review on PR #709, S3). Measured
|
|
342
|
+
* offline with `--web` and GH_BROWSER=echo before this change; the table and
|
|
343
|
+
* method are in gh-token-run.test.ts (T3). `-L`/`--limit` and `--json` are not
|
|
344
|
+
* written into the query and keep the plain value check. `search issues` value
|
|
345
|
+
* flags are all checked, so it is not listed here.
|
|
346
|
+
*/
|
|
347
|
+
export declare const SEARCH_QUERY_VALUE_FLAGS: Readonly<Record<string, readonly string[]>>;
|
|
348
|
+
/**
|
|
349
|
+
* The `-s`/`--state` values each subcommand accepts, copied from gh 2.97.0's
|
|
350
|
+
* own help (lead request on PR #714): `gh pr list --help` lists
|
|
351
|
+
* `{open|closed|merged|all}`, `gh issue list --help` `{open|closed|all}`, and
|
|
352
|
+
* `gh search issues --help` `{open|closed}`. Any other value is refused with
|
|
353
|
+
* `state-not-allowed`, after the search value checks.
|
|
354
|
+
*/
|
|
355
|
+
export declare const STATE_VALUES: Readonly<Record<string, readonly string[]>>;
|
|
356
|
+
/**
|
|
357
|
+
* Check gh arguments against the allowlist. Pure. Returns the allowlist key
|
|
358
|
+
* on success so the caller can apply per-subcommand rules.
|
|
359
|
+
*/
|
|
360
|
+
export declare function checkGhArgs(args: readonly string[]): ArgCheck;
|
|
361
|
+
/** One `api` endpoint: under API_ENDPOINT_PREFIX, with none of the forbidden substrings. */
|
|
362
|
+
export declare function isAllowedApiEndpoint(endpoint: string): boolean;
|
|
363
|
+
/**
|
|
364
|
+
* The six subcommands on which the wrapper reads `--body-file` itself (v70,
|
|
365
|
+
* #761 revision 1, design change 1). Everywhere else `--body-file` reaches
|
|
366
|
+
* checkGhArgs unchanged and is refused by ALWAYS_REFUSED_FLAGS.
|
|
367
|
+
*/
|
|
368
|
+
export declare const BODY_FILE_COMMANDS: readonly string[];
|
|
369
|
+
/**
|
|
370
|
+
* The largest argument the kernel passes to a child: MAX_ARG_STRLEN is 32
|
|
371
|
+
* pages, 131,072 bytes with 4 KiB pages, and that count includes the
|
|
372
|
+
* terminating NUL. This assumes 4 KiB pages (#761 comment 6406680912);
|
|
373
|
+
* a larger page size only raises the kernel limit. Measured on this machine:
|
|
374
|
+
* an argument of 131,071 bytes spawns, one of 131,072 bytes fails with E2BIG.
|
|
375
|
+
* gh receives `--body=<text>`, so the largest file accepted is 131,064 bytes.
|
|
376
|
+
*/
|
|
377
|
+
export declare const BODY_ARG_MAX_BYTES = 131071;
|
|
378
|
+
/**
|
|
379
|
+
* The largest `--body-file` file read: 131,071 bytes, one byte under the
|
|
380
|
+
* product owner's 128 KiB, for the kernel limit above (revision 1, design
|
|
381
|
+
* change 3). The read buffer is one byte larger, so a read that fills it
|
|
382
|
+
* proves the file is too large. BODY_ARG_MAX_BYTES then lowers the real
|
|
383
|
+
* ceiling to 131,064 bytes.
|
|
384
|
+
*/
|
|
385
|
+
export declare const BODY_FILE_MAX_BYTES = 131071;
|
|
386
|
+
/**
|
|
387
|
+
* The `--body` value checkGhArgs sees in place of the file's text. checkGhArgs
|
|
388
|
+
* refuses a value starting with `-`, and a body such as `- item` is a valid
|
|
389
|
+
* body, so it checks this fixed value instead (revision 1, design change 2).
|
|
390
|
+
* gh never receives it.
|
|
391
|
+
*/
|
|
392
|
+
export declare const BODY_PLACEHOLDER = "mx-agent-body-file";
|
|
393
|
+
/**
|
|
394
|
+
* Refused paths under each home directory (revision 1, design change 4; the
|
|
395
|
+
* next five added after the security review of PR #771, INFO, and the last
|
|
396
|
+
* four after the red-team on PR #771, P2). A realpath
|
|
397
|
+
* equal to one of these, or under one, is refused. This narrows the product
|
|
398
|
+
* owner's "refuse the agent's config file" and widens nothing.
|
|
399
|
+
*/
|
|
400
|
+
export declare const BODY_FILE_DENYLIST_HOME: readonly string[];
|
|
401
|
+
/** Refused absolute roots (revision 1, design change 4). */
|
|
402
|
+
export declare const BODY_FILE_DENYLIST_ROOT: readonly string[];
|
|
403
|
+
/** The text of a `--body-file`, or the refusal code. */
|
|
404
|
+
export type BodyFileRead = {
|
|
405
|
+
ok: true;
|
|
406
|
+
text: string;
|
|
407
|
+
} | {
|
|
408
|
+
ok: false;
|
|
409
|
+
code: GhRunErrorCode;
|
|
410
|
+
};
|
|
411
|
+
/** The argv checkGhArgs checks and the argv gh receives, or the refusal code. */
|
|
412
|
+
export type BodyFileResult = {
|
|
413
|
+
ok: true;
|
|
414
|
+
checkArgs: string[];
|
|
415
|
+
ghArgs: string[];
|
|
416
|
+
} | {
|
|
417
|
+
ok: false;
|
|
418
|
+
code: GhRunErrorCode;
|
|
419
|
+
};
|
|
420
|
+
/**
|
|
421
|
+
* The parsed `--body-file`, before any file is opened: the argv checkGhArgs
|
|
422
|
+
* checks, the path (null when there is no `--body-file` to read) and the
|
|
423
|
+
* index of `--body-file` in `args`.
|
|
424
|
+
*/
|
|
425
|
+
export type BodyFilePlan = {
|
|
426
|
+
ok: true;
|
|
427
|
+
checkArgs: string[];
|
|
428
|
+
path: string | null;
|
|
429
|
+
at: number;
|
|
430
|
+
} | {
|
|
431
|
+
ok: false;
|
|
432
|
+
code: GhRunErrorCode;
|
|
433
|
+
};
|
|
434
|
+
/**
|
|
435
|
+
* Read one `--body-file` for gh (v70, #761 revision 1, design change 3). In
|
|
436
|
+
* order: the denylist homes (none absolute is refused), resolve against
|
|
437
|
+
* process.cwd() (no `~` expansion), realpath, the denylist, open with
|
|
438
|
+
* O_RDONLY|O_NONBLOCK|O_NOFOLLOW (a FIFO with no writer cannot block), fstat
|
|
439
|
+
* for a regular file, the denylist again on /proc/self/fd/<fd> (the file
|
|
440
|
+
* actually opened), the hard-link check, a read capped at BODY_FILE_READ_CAP,
|
|
441
|
+
* the size checks, a fatal UTF-8 decode that keeps a BOM, and a NUL check.
|
|
442
|
+
* One try/catch covers process.cwd() and every fs call. Every refusal is a
|
|
443
|
+
* code; no path or error text is returned.
|
|
444
|
+
*/
|
|
445
|
+
export declare function readBodyFileForGh(path: string): BodyFileRead;
|
|
446
|
+
/**
|
|
447
|
+
* Parse `--body-file`, opening nothing (v70, #761 revision 1, design changes
|
|
448
|
+
* 1 and 2). Without `--body-file` on a BODY_FILE_COMMANDS subcommand,
|
|
449
|
+
* checkArgs is `args` and path is null. Otherwise: one `--body-file` only,
|
|
450
|
+
* not with `--body` or `-b`, and a value not starting with `-` (so `-`,
|
|
451
|
+
* stdin, is refused). checkArgs holds `--body BODY_PLACEHOLDER` in its place.
|
|
452
|
+
* runGhWithToken runs checkGhArgs on checkArgs before any file is opened
|
|
453
|
+
* (security review of PR #771, INFO), so a command refused for another reason
|
|
454
|
+
* never opens the file.
|
|
455
|
+
*/
|
|
456
|
+
export declare function planBodyFile(args: readonly string[]): BodyFilePlan;
|
|
457
|
+
/**
|
|
458
|
+
* Read the planned file and build the argv gh receives: `--body-file <path>`
|
|
459
|
+
* replaced by the joined `--body=<text>`, which only this function builds. A
|
|
460
|
+
* caller's own `--body=` still reaches checkGhArgs and is refused there.
|
|
461
|
+
*/
|
|
462
|
+
export declare function bodyFileGhArgs(args: readonly string[], plan: Extract<BodyFilePlan, {
|
|
463
|
+
ok: true;
|
|
464
|
+
}>): BodyFileResult;
|
|
465
|
+
/**
|
|
466
|
+
* planBodyFile then bodyFileGhArgs, with no checkGhArgs between them. For
|
|
467
|
+
* tests and callers that check the argv themselves; runGhWithToken checks
|
|
468
|
+
* between the two steps.
|
|
469
|
+
*/
|
|
470
|
+
export declare function applyBodyFile(args: readonly string[]): BodyFileResult;
|
|
471
|
+
/** Parse `gh version X.Y.Z` from `gh --version` output. Null when absent. */
|
|
472
|
+
export declare function parseGhVersion(output: string | null): [number, number, number] | null;
|
|
473
|
+
/** True when `v` is at least `min`. */
|
|
474
|
+
export declare function versionAtLeast(v: readonly [number, number, number], min: readonly [number, number, number]): boolean;
|
|
475
|
+
/** The git ceiling for `tempDir`: its absolute parent. */
|
|
476
|
+
export declare function ceilingFor(tempDir: string): string;
|
|
477
|
+
/**
|
|
478
|
+
* True when git would split the ceiling: it holds `:`, git's list separator
|
|
479
|
+
* for GIT_CEILING_DIRECTORIES (v69, lead decision on PR #766).
|
|
480
|
+
*/
|
|
481
|
+
export declare function isUnsafeCeiling(ceiling: string): boolean;
|
|
482
|
+
/**
|
|
483
|
+
* The child's whole environment. Only INHERITED_ENV_KEYS are read from
|
|
484
|
+
* `parentEnv`; everything else is fixed or derived from `tempDir`. Test H2
|
|
485
|
+
* asserts the key set exactly.
|
|
486
|
+
*
|
|
487
|
+
* `GIT_CEILING_DIRECTORIES` (v69, #763 revision 1) is the absolute parent of
|
|
488
|
+
* `tempDir`, set on every call. gh runs with `tempDir` as its cwd, so git
|
|
489
|
+
* checks `tempDir` itself and never moves up into the parent. Git ignores a
|
|
490
|
+
* relative ceiling entry, so a relative `tempDir` is resolved first.
|
|
491
|
+
*
|
|
492
|
+
* Throws when that parent holds `:` (isUnsafeCeiling). runGhWithToken refuses
|
|
493
|
+
* that case with `tempdir-unsafe` before any mint, so on its path this throw
|
|
494
|
+
* is a second check that never fires. The message names no path.
|
|
495
|
+
*/
|
|
496
|
+
export declare function buildChildEnv(parentEnv: Readonly<Record<string, string | undefined>>, token: string, tempDir: string): Record<string, string>;
|
|
497
|
+
/** The running gh child, as runGhWithToken sees it. */
|
|
498
|
+
export interface GhChild {
|
|
499
|
+
/** Resolves when gh exits, or with `error` when it could not start. */
|
|
500
|
+
done: Promise<{
|
|
501
|
+
code: number | null;
|
|
502
|
+
signal: NodeJS.Signals | null;
|
|
503
|
+
error?: boolean;
|
|
504
|
+
}>;
|
|
505
|
+
kill: (signal: NodeJS.Signals) => void;
|
|
506
|
+
}
|
|
507
|
+
/** The signals that remove the temp dir and end the wrapper. SIGHUP: security review on PR #705, INFO. */
|
|
508
|
+
export type GhSignal = 'SIGINT' | 'SIGTERM' | 'SIGHUP';
|
|
509
|
+
export declare const GH_SIGNALS: readonly GhSignal[];
|
|
510
|
+
export interface GhRunDeps {
|
|
511
|
+
/** Mints a token for the named purpose. The command passes mintInstallationToken. */
|
|
512
|
+
mint: (purpose: TokenPurpose) => Promise<string>;
|
|
513
|
+
/** True when `path` is an executable file. Called with GH_PATH only. */
|
|
514
|
+
ghExists: (path: string) => boolean;
|
|
515
|
+
/** `gh --version` output, or null. Called with GH_PATH only, no token in its environment. */
|
|
516
|
+
ghVersion: (path: string) => string | null;
|
|
517
|
+
/** Creates an empty 0700 directory and returns its path. Throws on failure. */
|
|
518
|
+
makeTempDir: () => string;
|
|
519
|
+
/** Removes the directory and everything in it. Must not throw. */
|
|
520
|
+
removeTempDir: (dir: string) => void;
|
|
521
|
+
/**
|
|
522
|
+
* Starts `path` with exactly `args` and `env` in the directory `cwd`, no
|
|
523
|
+
* shell, stdio inherited. runGhWithToken passes its own temp dir as `cwd`
|
|
524
|
+
* (v69, #763).
|
|
525
|
+
*/
|
|
526
|
+
spawn: (path: string, args: readonly string[], env: Record<string, string>, cwd: string) => GhChild;
|
|
527
|
+
/** Registers a handler; returns a function that removes it. */
|
|
528
|
+
onSignal: (signal: GhSignal, handler: () => void) => () => void;
|
|
529
|
+
/** Ends this process at once with the status. Used only from a signal handler. */
|
|
530
|
+
exit: (code: number) => void;
|
|
531
|
+
/** This process's environment, read for INHERITED_ENV_KEYS only. */
|
|
532
|
+
parentEnv: () => Readonly<Record<string, string | undefined>>;
|
|
533
|
+
writeStderr: (text: string) => void;
|
|
534
|
+
/**
|
|
535
|
+
* Revokes the minted token (v59). Resolves on success, rejects on any
|
|
536
|
+
* failure. The command passes revokeInstallationToken.
|
|
537
|
+
*/
|
|
538
|
+
revoke: (token: string) => Promise<void>;
|
|
539
|
+
/** Calls `fn` after `ms` milliseconds; returns a function that cancels it. */
|
|
540
|
+
setTimer: (ms: number, fn: () => void) => () => void;
|
|
541
|
+
}
|
|
542
|
+
/** Exit status for a wrapper refusal or failure. */
|
|
543
|
+
export declare const WRAPPER_FAILURE_EXIT = 1;
|
|
544
|
+
/** Shell convention for a process ended by a signal: 128 plus the signal number. */
|
|
545
|
+
export declare function signalExit(sig: NodeJS.Signals): number;
|
|
546
|
+
/**
|
|
547
|
+
* Run gh with an mx-bott token in the child only. Returns the exit status:
|
|
548
|
+
* gh's own, or WRAPPER_FAILURE_EXIT on a refusal or failure.
|
|
549
|
+
*/
|
|
550
|
+
export declare function runGhWithToken(args: readonly string[], deps: GhRunDeps): Promise<number>;
|
|
551
|
+
//# sourceMappingURL=gh-token-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gh-token-run.d.ts","sourceRoot":"","sources":["../../src/lib/gh-token-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuKG;AAQH,OAAO,EAA6D,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErH,gEAAgE;AAChE,eAAO,MAAM,OAAO,gBAAgB,CAAC;AAErC,sEAAsE;AACtE,eAAO,MAAM,UAAU,EAAE,YAAmB,CAAC;AAE7C,gCAAgC;AAChC,eAAO,MAAM,OAAO,eAAe,CAAC;AAEpC,kDAAkD;AAClD,eAAO,MAAM,OAAO,mCAA+B,CAAC;AAEpD,2FAA2F;AAC3F,eAAO,MAAM,0BAA0B,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAc,CAAC;AAExF,8CAA8C;AAC9C,eAAO,MAAM,mBAAmB,0CAAsC,CAAC;AAEvE,sFAAsF;AACtF,eAAO,MAAM,qBAAqB,uDAAmD,CAAC;AAEtF,+DAA+D;AAC/D,eAAO,M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