@f5-sales-demo/xcsh 20.3.2 → 20.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/package.json +8 -8
- package/src/cli/resource-cli.ts +134 -0
- package/src/cli/sandbox-check.ts +84 -21
- package/src/cli/update-cli.ts +1 -1
- package/src/cli.ts +8 -0
- package/src/commands/apply.ts +21 -0
- package/src/commands/create.ts +21 -0
- package/src/commands/delete.ts +32 -0
- package/src/commands/diff.ts +20 -0
- package/src/commands/export.ts +36 -0
- package/src/commands/get.ts +30 -0
- package/src/commands/resource-flags.ts +30 -0
- package/src/commands/self-update.ts +18 -0
- package/src/commands/update.ts +14 -14
- package/src/commands/validate.ts +20 -0
- package/src/internal-urls/build-info.generated.ts +8 -8
- package/src/locales/ar.json +1 -1
- package/src/locales/de.json +1 -1
- package/src/locales/en.json +1 -1
- package/src/locales/es.json +1 -1
- package/src/locales/fr.json +1 -1
- package/src/locales/hi.json +1 -1
- package/src/locales/it.json +1 -1
- package/src/locales/ja.json +1 -1
- package/src/locales/ko.json +1 -1
- package/src/locales/pt-br.json +1 -1
- package/src/locales/th.json +1 -1
- package/src/locales/zh-cn.json +1 -1
- package/src/locales/zh-tw.json +1 -1
- package/src/main.ts +1 -1
- package/src/prompts/internal-urls/containment.md +16 -17
- package/src/resource-management/index.ts +8 -0
- package/src/sandbox/command-operands.ts +20 -290
- package/src/sandbox/containment.ts +41 -42
- package/src/sandbox/enforce.ts +45 -280
- package/src/sandbox/session-fence.ts +7 -0
- package/src/slash-commands/resource-commands.ts +63 -93
- package/src/tools/bash.ts +9 -3
- package/src/tools/shell-lex.ts +8 -10
package/src/tools/bash.ts
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
SANDBOX_CHECK_NAMED_SIBLING_ENV,
|
|
25
25
|
SANDBOX_OPERATOR_HOME_ENV,
|
|
26
26
|
SANDBOX_SESSION_ROOT_ENV,
|
|
27
|
+
sandboxCheckSiblingRoot,
|
|
27
28
|
} from "../sandbox/session-fence";
|
|
28
29
|
import { SECRET_ENV_PATTERNS, type SecretObfuscator } from "../secrets";
|
|
29
30
|
import { DEFAULT_MAX_BYTES, TailBuffer } from "../session/streaming-output";
|
|
@@ -658,12 +659,14 @@ export class BashTool implements AgentTool<BashToolSchema, BashToolDetails> {
|
|
|
658
659
|
// Keep these values host-owned: tool-supplied env cannot replace them.
|
|
659
660
|
let env = requestedEnv;
|
|
660
661
|
let trustedSessionRoot = containmentRoot;
|
|
662
|
+
let trustedOperatorHome = os.homedir();
|
|
661
663
|
if (fence !== undefined) {
|
|
662
|
-
const [canonicalSessionRoot,
|
|
664
|
+
const [canonicalSessionRoot, canonicalOperatorHome] = await Promise.all([
|
|
663
665
|
canonicalizeSandboxContextPath(containmentRoot),
|
|
664
|
-
canonicalizeSandboxContextPath(
|
|
666
|
+
canonicalizeSandboxContextPath(trustedOperatorHome),
|
|
665
667
|
]);
|
|
666
668
|
trustedSessionRoot = canonicalSessionRoot;
|
|
669
|
+
trustedOperatorHome = canonicalOperatorHome;
|
|
667
670
|
env = {
|
|
668
671
|
...requestedEnv,
|
|
669
672
|
[SANDBOX_SESSION_ROOT_ENV]: trustedSessionRoot,
|
|
@@ -799,7 +802,10 @@ export class BashTool implements AgentTool<BashToolSchema, BashToolDetails> {
|
|
|
799
802
|
// sibling before the child is confined so the diagnostic measures reachability, not whether a
|
|
800
803
|
// nested sandbox can widen itself. The host owns both this path and its cleanup.
|
|
801
804
|
sandboxCheckSibling = await fs.promises.mkdtemp(
|
|
802
|
-
path.join(
|
|
805
|
+
path.join(
|
|
806
|
+
sandboxCheckSiblingRoot(trustedSessionRoot, trustedOperatorHome),
|
|
807
|
+
".xcsh-sandbox-check-live-sibling-",
|
|
808
|
+
),
|
|
803
809
|
);
|
|
804
810
|
await Bun.write(path.join(sandboxCheckSibling, "named.txt"), "sibling\n");
|
|
805
811
|
env = { ...env, [SANDBOX_CHECK_NAMED_SIBLING_ENV]: sandboxCheckSibling };
|
package/src/tools/shell-lex.ts
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shell-aware tokenizer for bash command strings.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Raw command-text regexes get argument *data* wrong. Internal-URL expansion rewrote `xcsh://`
|
|
5
|
+
* tokens sitting inside quoted strings (#2468), while sandbox enforcement needs to identify only
|
|
6
|
+
* explicit redirections, write operands, and directory changes. Both need to know where a shell
|
|
7
|
+
* *word* starts and ends.
|
|
8
8
|
*
|
|
9
9
|
* This module answers only that question. It deliberately does NOT decide anything:
|
|
10
10
|
*
|
|
11
11
|
* - #2468 uses `text` plus `start`/`end` to tell "this whole word is the URL" from "the URL is
|
|
12
12
|
* mentioned inside this word", and to splice a replacement over the exact source span.
|
|
13
|
-
* -
|
|
14
|
-
*
|
|
15
|
-
* on its own coverage floor, never on this lexer being complete — see
|
|
16
|
-
* `sandbox/command-operands.ts`.
|
|
13
|
+
* - Sandbox enforcement uses `name`, `operandStart`, and redirect metadata only for filesystem
|
|
14
|
+
* effects whose meaning is known without interpreting arbitrary argument text.
|
|
17
15
|
*
|
|
18
16
|
* Scope: enough POSIX shell to describe the commands an agent actually writes. Heredoc bodies are
|
|
19
|
-
* consumed as data and never re-lexed, which is shell-correct
|
|
20
|
-
*
|
|
17
|
+
* consumed as data and never re-lexed, which is shell-correct: source and heredoc text are left to
|
|
18
|
+
* the runtime fence rather than scanned for path-looking strings.
|
|
21
19
|
*/
|
|
22
20
|
|
|
23
21
|
/** How a word was quoted. `mixed` when built from differently-quoted segments, as in `a"b"'c'`. */
|