Repository navigation
fix(deps): resolve open Dependabot alerts - #8234
Conversation
Bump the packages behind the 13 open alerts: - simple-git 3.36.0 -> 4.0.2 (desktop, host-service) - @modelcontextprotocol/sdk 1.30.0 -> 1.31.0 (api, docs, cli, mcp, trpc), plus a root override so expo-mcp and shadcn share the patched copy - shell-quote 1.9.0 -> 1.11.0 (desktop and the root override) - katex 0.17.0 -> 0.18.2 (mobile) simple-git 4 is a major version. Port to it: - Use the named `simpleGit` export; v4 drops the default export. - Add the v4 unsafe flags to the shared allow-list, keeping the policy from #4602 that Superset honors the user's own Git env and config. - v4 rejects any GIT_*, EDITOR or PAGER key passed through `.env()` unless it is named in `allowEnvironment`, which is read once at construction. Build that list from the env being passed, and have host-service callers hand `env` to createUserSimpleGit instead of chaining `.env()`. Without this every credentialed git call and any desktop user with EDITOR set fails at runtime; typecheck does not see it. - Test fixtures that rely on ambient GIT_CONFIG_GLOBAL or run -C / url.insteadOf now build their client through createUserSimpleGit.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
⛔ Files ignored due to path filters (1)
📒 Files selected for processing (41)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe PR updates shared simple-git options and changes host-service and desktop Git clients to pass environment values during client creation. It also updates simple-git, shell-quote, the Model Context Protocol SDK, and katex versions, and changes simple-git imports to named exports. ChangesGit client environment handling
Other package version updates
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Other Sequence Diagram(s)sequenceDiagram
participant GitCaller
participant createUserSimpleGit
participant userGitSimpleGitOptions
participant simpleGit
GitCaller->>createUserSimpleGit: Pass environment in client options
createUserSimpleGit->>userGitSimpleGitOptions: Build Git options from environment keys
userGitSimpleGitOptions-->>createUserSimpleGit: Return Git options
createUserSimpleGit->>simpleGit: Create client with Git options
createUserSimpleGit->>simpleGit: Apply supplied environment when present
Suggested reviewers: Merge Risk: ⚪ Minimal · up to This PR updates dependencies and moves Git clients to simple-git v4. Users' own Git environment and configuration are still honored. No concrete defect was found. The one remaining gap is that nobody ran a manual desktop Git-flow smoke test, and that is worth doing before release. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 32 files. (9 skipped: 9 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
No installed development build can load this pull request as an update: its native fingerprint is |
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
There was a problem hiding this comment.
5 issues found and verified against the latest diff
You’re at about 93% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/desktop/src/lib/trpc/routers/workspaces/utils/git-client.test.ts">
<violation number="1" location="apps/desktop/src/lib/trpc/routers/workspaces/utils/git-client.test.ts:89">
P3: This test only allowlists the keys of `makeBlockedGitEnv`, but the spawned git process inherits the runner's `process.env` as well (the same reason this test has always relied on inherited PATH). simple-git 4 throws "not permitted" on any guarded GIT_*/EDITOR/PAGER key present in the child env that is not named in `allowEnvironment`, so a runner or developer shell that has e.g. GIT_AUTHOR_EMAIL, GIT_SSH_COMMAND, or GIT_TERMINAL_PROMPT set will fail this test spuriously. Merge the inherited env into `env` so the allow list covers everything the child will see, matching how host-service's `createUserSimpleGit` test passes `{ ...process.env, ... }`.</violation>
</file>
<file name="packages/host-service/src/trpc/router/project/utils/resolve-repo.ts">
<violation number="1" location="packages/host-service/src/trpc/router/project/utils/resolve-repo.ts:487">
P1: `cloneRepoInto` sends an arbitrary clone URL through the full unsafe Git client, allowing custom protocols and command/URL-rewrite behavior at the host. Use a restricted client for untrusted clone inputs, allowing only the intended URL schemes and credential environment instead of the full user-policy unsafe allow-list.</violation>
</file>
<file name="packages/shared/src/simple-git-options.ts">
<violation number="1" location="packages/shared/src/simple-git-options.ts:27">
P1: `allowUnsafeUrlRewrite` enables URL rewriting for every Git client, including clone and fetch operations that process repository URLs. Keep this guard disabled for untrusted URLs, or use a narrowly scoped options set only for trusted user-configuration operations; otherwise a `url.*.insteadOf` rule can redirect a URL and its credentials to an unintended endpoint.</violation>
</file>
<file name="packages/host-service/src/runtime/git/simple-git.ts">
<violation number="1" location="packages/host-service/src/runtime/git/simple-git.ts:18">
P2: When a caller supplies a sparse `env`, this allowlist omits guarded keys inherited from `process.env`; simple-git 4 then rejects Git commands if the host defines keys such as `GIT_EDITOR` or `GIT_CONFIG_*`. Build the allowlist from both `process.env` and the supplied environment.</violation>
</file>
<file name="apps/mobile/package.json">
<violation number="1" location="apps/mobile/package.json:114">
P2: katex jumps across a semver-major boundary (0.17.0 → 0.18.2), and the only consumer, react-native-enriched-markdown@0.6.0, declares the optional peer `katex >=0.16.0` with no upper bound, so the bump installs cleanly without any compatibility check. EnrichedMarkdownText renders math in PR descriptions and AI messages, no automated test covers that path, and the PR's manual smoke tests are unrun. Verify the math-rendering path (or a render smoke test) before relying on 0.18 output in the markdown WebView.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
| const env = await cloneEnv(credentials, repoCloneUrl); | ||
| const git = createUserSimpleGit(undefined, { abort: signal }); | ||
| await (env ? git.env(env) : git).clone(repoCloneUrl, targetPath); | ||
| await createUserSimpleGit(undefined, { abort: signal, env }).clone( |
There was a problem hiding this comment.
P1: cloneRepoInto sends an arbitrary clone URL through the full unsafe Git client, allowing custom protocols and command/URL-rewrite behavior at the host. Use a restricted client for untrusted clone inputs, allowing only the intended URL schemes and credential environment instead of the full user-policy unsafe allow-list.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/host-service/src/trpc/router/project/utils/resolve-repo.ts, line 487:
<comment>`cloneRepoInto` sends an arbitrary clone URL through the full unsafe Git client, allowing custom protocols and command/URL-rewrite behavior at the host. Use a restricted client for untrusted clone inputs, allowing only the intended URL schemes and credential environment instead of the full user-policy unsafe allow-list.</comment>
<file context>
@@ -483,8 +484,10 @@ export async function cloneRepoInto(
const env = await cloneEnv(credentials, repoCloneUrl);
- const git = createUserSimpleGit(undefined, { abort: signal });
- await (env ? git.env(env) : git).clone(repoCloneUrl, targetPath);
+ await createUserSimpleGit(undefined, { abort: signal, env }).clone(
+ repoCloneUrl,
+ targetPath,
</file context>
| "allowUnsafeSshCommand", | ||
| "allowUnsafeSubmodule", | ||
| "allowUnsafeTemplateDir", | ||
| "allowUnsafeUrlRewrite", |
There was a problem hiding this comment.
P1: allowUnsafeUrlRewrite enables URL rewriting for every Git client, including clone and fetch operations that process repository URLs. Keep this guard disabled for untrusted URLs, or use a narrowly scoped options set only for trusted user-configuration operations; otherwise a url.*.insteadOf rule can redirect a URL and its credentials to an unintended endpoint.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/shared/src/simple-git-options.ts, line 27:
<comment>`allowUnsafeUrlRewrite` enables URL rewriting for every Git client, including clone and fetch operations that process repository URLs. Keep this guard disabled for untrusted URLs, or use a narrowly scoped options set only for trusted user-configuration operations; otherwise a `url.*.insteadOf` rule can redirect a URL and its credentials to an unintended endpoint.</comment>
<file context>
@@ -1,24 +1,30 @@
"allowUnsafeSshCommand",
+ "allowUnsafeSubmodule",
"allowUnsafeTemplateDir",
+ "allowUnsafeUrlRewrite",
] as const;
</file context>
| const { env, ...rest } = options ?? {}; | ||
| const gitOptions = { | ||
| ...(userGitSimpleGitOptions( | ||
| env ?? process.env, |
There was a problem hiding this comment.
P2: When a caller supplies a sparse env, this allowlist omits guarded keys inherited from process.env; simple-git 4 then rejects Git commands if the host defines keys such as GIT_EDITOR or GIT_CONFIG_*. Build the allowlist from both process.env and the supplied environment.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/host-service/src/runtime/git/simple-git.ts, line 18:
<comment>When a caller supplies a sparse `env`, this allowlist omits guarded keys inherited from `process.env`; simple-git 4 then rejects Git commands if the host defines keys such as `GIT_EDITOR` or `GIT_CONFIG_*`. Build the allowlist from both `process.env` and the supplied environment.</comment>
<file context>
@@ -1,17 +1,24 @@
+ const { env, ...rest } = options ?? {};
+ const gitOptions = {
+ ...(userGitSimpleGitOptions(
+ env ?? process.env,
+ ) satisfies Partial<SimpleGitOptions>),
+ ...rest,
</file context>
| env ?? process.env, | |
| { ...process.env, ...env }, |
| "expo-updates": "57.0.24", | ||
| "expo-web-browser": "57.0.3", | ||
| "katex": "0.17.0", | ||
| "katex": "0.18.2", |
There was a problem hiding this comment.
P2: katex jumps across a semver-major boundary (0.17.0 → 0.18.2), and the only consumer, react-native-enriched-markdown@0.6.0, declares the optional peer katex >=0.16.0 with no upper bound, so the bump installs cleanly without any compatibility check. EnrichedMarkdownText renders math in PR descriptions and AI messages, no automated test covers that path, and the PR's manual smoke tests are unrun. Verify the math-rendering path (or a render smoke test) before relying on 0.18 output in the markdown WebView.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/mobile/package.json, line 114:
<comment>katex jumps across a semver-major boundary (0.17.0 → 0.18.2), and the only consumer, react-native-enriched-markdown@0.6.0, declares the optional peer `katex >=0.16.0` with no upper bound, so the bump installs cleanly without any compatibility check. EnrichedMarkdownText renders math in PR descriptions and AI messages, no automated test covers that path, and the PR's manual smoke tests are unrun. Verify the math-rendering path (or a render smoke test) before relying on 0.18 output in the markdown WebView.</comment>
<file context>
@@ -111,7 +111,7 @@
"expo-updates": "57.0.24",
"expo-web-browser": "57.0.3",
- "katex": "0.17.0",
+ "katex": "0.18.2",
"lucide-react-native": "0.562.0",
"posthog-react-native": "4.63.2",
</file context>
| makeBlockedGitEnv(workRoot), | ||
| ); | ||
| const env = makeBlockedGitEnv(workRoot); | ||
| const git = simpleGit(repoPath, userGitSimpleGitOptions(env)).env(env); |
There was a problem hiding this comment.
P3: This test only allowlists the keys of makeBlockedGitEnv, but the spawned git process inherits the runner's process.env as well (the same reason this test has always relied on inherited PATH). simple-git 4 throws "not permitted" on any guarded GIT_*/EDITOR/PAGER key present in the child env that is not named in allowEnvironment, so a runner or developer shell that has e.g. GIT_AUTHOR_EMAIL, GIT_SSH_COMMAND, or GIT_TERMINAL_PROMPT set will fail this test spuriously. Merge the inherited env into env so the allow list covers everything the child will see, matching how host-service's createUserSimpleGit test passes { ...process.env, ... }.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/desktop/src/lib/trpc/routers/workspaces/utils/git-client.test.ts, line 89:
<comment>This test only allowlists the keys of `makeBlockedGitEnv`, but the spawned git process inherits the runner's `process.env` as well (the same reason this test has always relied on inherited PATH). simple-git 4 throws "not permitted" on any guarded GIT_*/EDITOR/PAGER key present in the child env that is not named in `allowEnvironment`, so a runner or developer shell that has e.g. GIT_AUTHOR_EMAIL, GIT_SSH_COMMAND, or GIT_TERMINAL_PROMPT set will fail this test spuriously. Merge the inherited env into `env` so the allow list covers everything the child will see, matching how host-service's `createUserSimpleGit` test passes `{ ...process.env, ... }`.</comment>
<file context>
@@ -84,9 +85,8 @@ describe("simple-git user env options", () => {
- makeBlockedGitEnv(workRoot),
- );
+ const env = makeBlockedGitEnv(workRoot);
+ const git = simpleGit(repoPath, userGitSimpleGitOptions(env)).env(env);
const status = await git.raw(["status", "--short"]);
</file context>
There was a problem hiding this comment.
1 existing issue remains and no new issues found across 42 files
You’re at about 93% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Architecture diagram
sequenceDiagram
participant D as Desktop App
participant HS as Host Service
participant SG as Simple Git
participant Git as Git CLI
participant UO as Shared Utils Options
Note over D,HS: Git Client Factory Flow
D->>HS: getSimpleGitWithShellPath(repoPath, overrides)
HS->>HS: getProcessEnvWithShellPath() - resolve shell env
HS->>UO: NEW: userGitSimpleGitOptions(env)
UO-->>HS: allowEnvironment list + unsafe flags
HS->>HS: NEW: createUserSimpleGit(env, repoPath, overrides)
HS->>SG: simpleGit(repoPath, { allowEnvironment, unsafe, ...overrides })
SG->>SG: Build instance, capture allowEnvironment
HS->>SG: .env(env)
SG->>Git: git command with allowed env vars
Note over HS,SG: Host Service Factory Path
HS->>HS: createGitFactory(provider)
HS->>HS: resolveEnv(repoPath) - resolve credentials env
HS->>UO: NEW: userGitSimpleGitOptions(env)
UO-->>HS: allowEnvironment list from resolved env
HS->>SG: NEW: createUserSimpleGit(repoPath, { env, ...options })
SG->>Git: git command
Note over HS,SG: Worker Task Pattern
HS->>HS: Process worker task (git status, diff, commit)
HS->>UO: NEW: userGitSimpleGitOptions(gitEnv)
UO-->>HS: allowEnvironment list from task env
HS->>SG: createUserSimpleGit(worktreePath, { env: gitEnv })
SG->>Git: Execute git operation
Note over D,HS: Error Cases
alt Guarded env var not in allowEnvironment
SG->>SG: Throw environment guard error
SG-->>HS: Error: blocked key
HS-->>D: Error propagated
else Normal operation
SG-->>HS: Success result
HS-->>D: Result
end
Note over HS: Scaffolding/Clone Flows
HS->>HS: cloneTemplateInto(targetPath)
HS->>HS: cloneEnv(credentials, templateUrl)
HS->>UO: userGitSimpleGitOptions(env)
HS->>SG: createUserSimpleGit(undefined, { env })
SG->>Git: clone with env constraints
HS->>HS: scaffold commit bypass path
HS->>SG: createUserSimpleGit(repo) - uses process.env
SG->>Git: commit with ambient env keys
Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.
Turn on auto-fix | Re-trigger cubic
|
…eGit simple-git 4 (#8234) rejects GIT_* keys set with .env() unless they are in allowEnvironment, which createUserSimpleGit builds from its env option. The restore fetch chained .env(gitEnv), so GIT_OPTIONAL_LOCKS made every fetch fail and the branch-only-on-remote restore never recovered.
…ves up (#8255) * fix(host-service): fetch a missing branch before restore gives up, with a translated toast Restoring a deleted workspace whose branch is gone locally used to fail unless refs/remotes/origin/<branch> was already in the repo. Restore now runs one targeted fetch (15 s block timeout) before reporting the branch missing, so a pushed branch the clone never fetched, or one pruned locally, comes back. When the branch is gone everywhere, the error carries the i18n key serverError.workspaces.restoreBranchMissing. The host errorFormatter now passes i18nKey/i18nParams through, so the desktop's existing toast renders it in the user's locale and says only pushed commits restore. * fix(host-service): pass the restore fetch env through createUserSimpleGit simple-git 4 (#8234) rejects GIT_* keys set with .env() unless they are in allowEnvironment, which createUserSimpleGit builds from its env option. The restore fetch chained .env(gitEnv), so GIT_OPTIONAL_LOCKS made every fetch fail and the branch-only-on-remote restore never recovered. * fix(host-service): tell an unreachable remote apart from a missing branch on restore A failed restore fetch (offline, auth, timeout) used to fall through to branch-missing, which told the user the branch was not on origin even when it was. The fetch now reports "unreachable" unless git answered "couldn't find remote ref", and restore throws serverError.workspaces.restoreFetchFailed (BAD_GATEWAY) for it. A project with no such remote skips the fetch and still reports branch-missing. The host errorFormatter and the restore errors use userError and isI18nErrorCause from a new @superset/trpc/i18n-error export instead of a second copy of the cause type. The restore tests pass paths to git as arguments, and cover an unreachable remote and a remote without the branch. * test(host-service): run restore test git without inherited repository-location env A GIT_DIR or GIT_WORK_TREE inherited from a git hook would point the test's git calls at the outer repository. Strip those variables in the helper, and use it for the first test's commit too.
Summary
Resolves all 13 open Dependabot alerts (all npm), including 3 critical:
simple-gitapps/desktop,packages/host-serviceshell-quoteapps/desktop, rootoverridesquote()command injection via a line terminator after a{ comment }token@modelcontextprotocol/sdkapps/api,apps/docs,packages/cli,packages/mcp,packages/trpckatexapps/mobileAlso adds a root override
@modelcontextprotocol/sdk: 1.31.0, so the copies underexpo-mcpandshadcn(both^1.26.0) move to the patched version too.This replaces the Dependabot PRs #8197, #8198 and #8211. #8197 bumped simple-git in host-service only (red on Typecheck/Test/Sherif). #8211 left the root
shell-quote: 1.9.0override in place, so the lockfile still resolved 1.9.0.simple-git 4 migration
simple-git 4 is a major version, so this is more than a version pin:
import simpleGit from "simple-git"→import { simpleGit } from "simple-git"(2 wrappers + 21 test files).GIT_*,EDITOR,PAGER,PREFIX,SSH_ASKPASSorVISUALkey reaches the child through.env()unless the key is listed inallowEnvironment, and it strips such keys inherited fromprocess.env. That list is read once, when the instance is built. Today the desktop passes the whole shell env through.env(), and host-service chains.env(gitEnv)(withGIT_ASKPASS,GIT_TERMINAL_PROMPT,GIT_OPTIONAL_LOCKS, …) ontocreateUserSimpleGit()at about 25 call sites. A plain bump would make every credentialed git call, and any desktop git call for a user withEDITORset, fail at runtime withUse of "EDITOR" is blocked by the environment guard. Typecheck does not catch this.userGitSimpleGitOptions(env)in@superset/shared/simple-git-optionsbuildsallowEnvironmentfrom the env being passed.createUserSimpleGit(baseDir, { env })takes the env at construction, and every.env()chain moves to that option. Called withoutenv, it allows the ambientprocess.envkeys, as v3 did.getSimpleGitWithShellPathresolves the shell env first, then builds the client with it.allowUnsafeCommandBinaries,allowUnsafeExec,allowUnsafeInclude,allowUnsafeSubmodule,allowUnsafeUrlRewrite,allowAbbreviatedOptions) to the shared allow-list.Reviewer note on policy: this keeps the policy from #4602, where Superset is the user's own Git client and honors their Git env and config, so every simple-git unsafe guard is enabled. The alerts close because the vulnerable versions are gone, but the new v4 argument guards stay opted out, as the v3 ones already were.
allowAbbreviatedOptionsis included because otherwise v4 setsGIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=truein git's env, and that reaches the user's own hooks. If we want to narrow the policy for calls that carry untrusted input (PR head refs, remote URLs), that should be a separate change.Other bumps
@modelcontextprotocol/sdk1.31.0 adds anissuerfield to stored OAuth tokens. No code here uses the SDK's OAuth client storage.katex0.18.0 prefixes its internal CSS classes. In mobile, katex is only an optional peer ofreact-native-enriched-markdown, which uses it in its web renderer, and the app is iOS-only.mermaidstill pulls its ownkatex@0.16.47(^0.16.47excludes 0.18.x). Dependabot does not flag it; it clears when mermaid widens its range.Test plan
bun install: lockfile changes only the bumped packages; native modules rebuiltbun run lint:fixandbun run lint: cleanbun run sherif: no issuesbun run typecheck: clean in shared, host-service, desktop, trpc, mcp, cli, api and docs (after relinking this checkout withbun@1.4.2 install --frozen-lockfile --ignore-scriptsto repair a local better-auth install split; no tracked files change).apps/mobile(afterhost-service build:types) has 11 errors, allunrefonnumberinpackages/port-scannerandpackages/workspace-fs, which this PR does not touch. Under the earlier local install, mobile's error set was identical tomain.packages/host-servicetests: 2312 pass, 0 failpackages/sharedtests: 1303 pass, 0 failpackages/trpc(492),packages/cli(372),apps/api(230): all passapps/desktoptests: 7684 pass, 209 fail. All 209 are the known local Bun 1.3.14--isolateLingui shim failures ("useLingui hook was used without I18nProvider" / "without setting a locale"); none are in git code and none mention simple-gitcreateUserSimpleGit(…, { env })passesGIT_CONFIG_*through to git. Checked by mutation: it fails withallowEnvironmentemptiedSummary by CodeRabbit