Skip to content

fix(deps): resolve open Dependabot alerts - #8234

Merged
AviPeltz merged 2 commits into
mainfrom
fix/dependabot-2026-10-06
Oct 6, 2026
Merged

AviPeltz merged 2 commits into
mainfrom
fix/dependabot-2026-10-06

Conversation

@AviPeltz

@AviPeltz AviPeltz commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Resolves all 13 open Dependabot alerts (all npm), including 3 critical:

Package Bump Manifests Alerts
simple-git 3.36.0 → 4.0.2 apps/desktop, packages/host-service #317, #321 (critical): unsafe-operation guard misses trailer command config · #316, #320 (high): command execution through Git config includes · #315, #319 (high): unsafe-operations bypass through abbreviated long options
shell-quote 1.9.0 → 1.11.0 apps/desktop, root overrides #322 (critical): quote() command injection via a line terminator after a { comment } token
@modelcontextprotocol/sdk 1.30.0 → 1.31.0 apps/api, apps/docs, packages/cli, packages/mcp, packages/trpc #323–#327 (high): OAuth client could send credentials to an authorization server chosen by the MCP server
katex 0.17.0 → 0.18.2 apps/mobile #318 (low): prototype pollution can bypass trust restrictions

Also adds a root override @modelcontextprotocol/sdk: 1.31.0, so the copies under expo-mcp and shadcn (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.0 override 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:

  • Named export. v4 removes the default export: import simpleGit from "simple-git" → import { simpleGit } from "simple-git" (2 wrappers + 21 test files).
  • Environment guard. v4 throws when a GIT_*, EDITOR, PAGER, PREFIX, SSH_ASKPASS or VISUAL key reaches the child through .env() unless the key is listed in allowEnvironment, and it strips such keys inherited from process.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) (with GIT_ASKPASS, GIT_TERMINAL_PROMPT, GIT_OPTIONAL_LOCKS, …) onto createUserSimpleGit() at about 25 call sites. A plain bump would make every credentialed git call, and any desktop git call for a user with EDITOR set, fail at runtime with Use of "EDITOR" is blocked by the environment guard. Typecheck does not catch this.
    • New userGitSimpleGitOptions(env) in @superset/shared/simple-git-options builds allowEnvironment from the env being passed.
    • Host-service createUserSimpleGit(baseDir, { env }) takes the env at construction, and every .env() chain moves to that option. Called without env, it allows the ambient process.env keys, as v3 did.
    • The desktop getSimpleGitWithShellPath resolves the shell env first, then builds the client with it.
  • Unsafe flags. Adds the v4 flags (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. allowAbbreviatedOptions is included because otherwise v4 sets GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=true in 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/sdk 1.31.0 adds an issuer field to stored OAuth tokens. No code here uses the SDK's OAuth client storage.
  • katex 0.18.0 prefixes its internal CSS classes. In mobile, katex is only an optional peer of react-native-enriched-markdown, which uses it in its web renderer, and the app is iOS-only.
  • mermaid still pulls its own katex@0.16.47 (^0.16.47 excludes 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 rebuilt
  • bun run lint:fix and bun run lint: clean
  • bun run sherif: no issues
  • bun run typecheck: clean in shared, host-service, desktop, trpc, mcp, cli, api and docs (after relinking this checkout with bun@1.4.2 install --frozen-lockfile --ignore-scripts to repair a local better-auth install split; no tracked files change). apps/mobile (after host-service build:types) has 11 errors, all unref on number in packages/port-scanner and packages/workspace-fs, which this PR does not touch. Under the earlier local install, mobile's error set was identical to main.
  • packages/host-service tests: 2312 pass, 0 fail
  • packages/shared tests: 1303 pass, 0 fail
  • packages/trpc (492), packages/cli (372), apps/api (230): all pass
  • apps/desktop tests: 7684 pass, 209 fail. All 209 are the known local Bun 1.3.14 --isolate Lingui shim failures ("useLingui hook was used without I18nProvider" / "without setting a locale"); none are in git code and none mention simple-git
  • New regression test: createUserSimpleGit(…, { env }) passes GIT_CONFIG_* through to git. Checked by mutation: it fails with allowEnvironment emptied
  • Manual smoke test of desktop git flows (status, commit, push over SSH/HTTPS) on a dev build. Not run in this session

Summary by CodeRabbit

  • Bug Fixes
    • Git operations now consistently use the environment settings provided for each operation, including Git configuration and credentials. This helps ensure actions such as cloning, fetching, and checking repository status run with the intended settings.

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.
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e113f864-aa9b-424a-a74b-14311afb430d
📥 Commits

Reviewing files that changed from the base of the PR and between 34ce41f and 8f2c113.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (41)
  • apps/api/package.json
  • apps/desktop/package.json
  • apps/desktop/src/lib/trpc/routers/workspaces/utils/git-client.test.ts
  • apps/desktop/src/lib/trpc/routers/workspaces/utils/git-client.ts
  • apps/docs/package.json
  • apps/mobile/package.json
  • package.json
  • packages/cli/package.json
  • packages/host-service/package.json
  • packages/host-service/src/events/git-watcher-failure.test.ts
  • packages/host-service/src/runtime/git/git-message-locale.test.ts
  • packages/host-service/src/runtime/git/git.ts
  • packages/host-service/src/runtime/git/simple-git.test.ts
  • packages/host-service/src/runtime/git/simple-git.ts
  • packages/host-service/src/trpc/router/git/commit-push.test.ts
  • packages/host-service/src/trpc/router/git/discard-changes.test.ts
  • packages/host-service/src/trpc/router/git/get-diff-bulk.test.ts
  • packages/host-service/src/trpc/router/git/get-diff-patch.test.ts
  • packages/host-service/src/trpc/router/git/git.ts
  • packages/host-service/src/trpc/router/git/staging-status.test.ts
  • packages/host-service/src/trpc/router/git/utils/diff-patch.test.ts
  • packages/host-service/src/trpc/router/git/utils/git-helpers.integration.test.ts
  • packages/host-service/src/trpc/router/git/utils/git-helpers.ts
  • packages/host-service/src/trpc/router/git/utils/git-status-partial/git-status-partial.integration.test.ts
  • packages/host-service/src/trpc/router/git/utils/git-status.integration.test.ts
  • packages/host-service/src/trpc/router/git/v2-diff-surfaces.integration.test.ts
  • packages/host-service/src/trpc/router/project/utils/resolve-repo.test.ts
  • packages/host-service/src/trpc/router/project/utils/resolve-repo.ts
  • packages/host-service/src/trpc/router/workspace-creation/shared/branch-search.test.ts
  • packages/host-service/src/trpc/router/workspace-creation/shared/worktree-list.test.ts
  • packages/host-service/src/workers/tasks/git.ts
  • packages/host-service/test/helpers/git-fixture.ts
  • packages/host-service/test/integration/pr-branch-materialize.integration.test.ts
  • packages/host-service/test/integration/pull-requests-scaling.bench.ts
  • packages/host-service/test/integration/pull-requests-scaling.integration.test.ts
  • packages/host-service/test/integration/workspace-create-pr.integration.test.ts
  • packages/host-service/test/integration/workspace-creation-github.integration.test.ts
  • packages/mcp/package.json
  • packages/shared/src/simple-git-options.test.ts
  • packages/shared/src/simple-git-options.ts
  • packages/trpc/package.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The 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.

Changes

Git client environment handling

Layer / File(s) Summary
Shared Git options
packages/shared/src/simple-git-options.ts, packages/shared/src/simple-git-options.test.ts
The shared options add six unsafe-option flags and a function that sets allowed environment keys from the supplied environment.
Host-service Git clients
packages/host-service/src/runtime/git/*, packages/host-service/src/trpc/router/git/*, packages/host-service/src/trpc/router/project/utils/resolve-repo*, packages/host-service/src/trpc/router/workspace-creation/shared/*, packages/host-service/src/workers/tasks/git.ts, packages/host-service/src/events/*, packages/host-service/test/helpers/*, packages/host-service/test/integration/*, packages/host-service/package.json
createUserSimpleGit accepts environment values in its options. Host-service Git callers pass environment values during client creation. Tests cover supplied Git configuration and blocked environments; simple-git imports use the named export.
Desktop Git clients
apps/desktop/src/lib/trpc/routers/workspaces/utils/git-client*, apps/desktop/package.json, package.json
The desktop Git client derives options from environment values and passes its shell-adjusted environment during client creation. The simple-git and shell-quote versions and the shell-quote override are updated.

Other package version updates

Layer / File(s) Summary
SDK and katex versions
apps/api/package.json, apps/docs/package.json, apps/mobile/package.json, packages/cli/package.json, packages/mcp/package.json, packages/trpc/package.json, package.json
The Model Context Protocol SDK changes from 1.30.0 to 1.31.0 in package declarations and the root override. katex changes from 0.17.0 to 0.18.2.

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
Loading

Suggested reviewers: kitenite

Merge Risk: ⚪ Minimal · up to 8f2c1

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning 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:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title follows conventional commit format and clearly identifies the dependency-alert fixes.
Description check ✅ Passed The summary explains the changes and their purpose. The test plan gives detailed verification results and notes the unrun manual smoke test. The description does not include the template’s separate Ch…
Full details: Docstring Coverage

Explanation

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.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@expo

expo Bot commented Oct 6, 2026

Copy link
Copy Markdown

No installed development build can load this pull request as an update: its native fingerprint is 68f45e34df89 and no development build has it. Add the mobile-build label to build one.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch

Thank you for your contribution! 🎉

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Suggested change
env ?? process.env,
{ ...process.env, ...env },

Comment thread apps/mobile/package.json
"expo-updates": "57.0.24",
"expo-web-browser": "57.0.3",
"katex": "0.17.0",
"katex": "0.18.2",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Loading

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

@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[High risk] Updates git library and related dependencies across the codebase.

The PR appears safe to merge; no actionable regression was established.

What we checked:

  • Git tasks keep their signal: The runner skips busy and cancelled workers. Cancelling a task aborts its existing signal without replacing it.

Summary

Updates simple-git, shell-quote, @modelcontextprotocol/sdk, and katex, with matching changes in bun.lock.

  • Migrates Git clients to the named simpleGit export.
  • Builds allowEnvironment from the environment supplied to each client.
  • Adds a test that checks whether supplied GIT_CONFIG_* values reach Git.
  • No actionable issue was established. Tests were not run during this review.
  • AviPeltz explicitly keeps unsafe Git options enabled to preserve the user's Git settings; narrowing that policy is deferred.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A["Resolve user or credential environment"] --> B["Build allowEnvironment from its keys"]
  B --> C["Construct simpleGit client"]
  C --> D["Apply the same environment"]
  D --> E["Run Git command"]
Loading

Reviews (1) · Last reviewed commit: "fix(deps): resolve open Dependabot alert..."

@AviPeltz
AviPeltz merged commit 1f35585 into main Oct 6, 2026
25 checks passed
Kitenite added a commit that referenced this pull request Oct 7, 2026
…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.
Kitenite added a commit that referenced this pull request Oct 7, 2026
…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.

This branch was previously deployed

1 inactive deployment
preview — 8f2c113a Deployed Oct 6, 2026 by AviPeltz via Deploy Admin #11318
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant