Skip to content

Remote pc access#18

Closed
MarvelNwachukwu wants to merge 18 commits intomainfrom
remote-pc-access
Closed

Remote pc access#18
MarvelNwachukwu wants to merge 18 commits intomainfrom
remote-pc-access

Conversation

@MarvelNwachukwu
Copy link
Copy Markdown
Contributor

No description provided.

Define the validation shape for SSH remote filesystem config with
fields: enabled, sshHost, sshKeyPath, sshPort, and allowedPaths.
Existing configs without remoteFileSystem will get disabled defaults
automatically, ensuring zero breaking changes.
Returns empty array when remote filesystem is not enabled in config.
Auto-accepts first connection but rejects changed host keys for safety.
Ensures clean failure instead of indefinite hang when key auth fails.
Pipes @modelcontextprotocol/server-filesystem stdio through SSH,
passing configured allowedPaths to restrict remote access.
Allows subagents to request remote filesystem tools via delegation.
Subagents can now request remoteFilesystem tools via delegation.
The main agent now has direct access to remote filesystem MCP tools
alongside local filesystem tools.
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @MarvelNwachukwu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the agent's capabilities by enabling secure access to remote file systems via SSH. This allows agents to interact with files on external machines, expanding their operational reach and facilitating tasks that require remote data manipulation or inspection. The new functionality is configurable and integrates seamlessly with existing tool delegation.

Highlights

  • Remote File System Access: Introduced capabilities for agents to access remote file systems securely via SSH.
  • Configuration Options: Added new configuration settings for remote file system tools, allowing specification of SSH host, key path, port, and allowed directories.
  • Agent Tool Integration: Integrated the new remote file system tools into the agent's available toolset and the delegation mechanism, enabling subagents to utilize them.
Changelog
  • src/agents/agent.ts
    • Imported getRemoteFileSystemTools.
    • Initialized remoteFileSystemTools using the new function.
    • Added remoteFilesystem to the agent's toolGroups.
    • Included remoteFileSystemTools in the agent's overall tool list.
  • src/config/index.ts
    • Defined a new remoteFileSystem object schema within tools for configuration, including enabled, sshHost, sshKeyPath, sshPort, and allowedPaths.
    • Added remoteFileSystemEnabled to the AppConfig interface.
    • Mapped the remoteFileSystem.enabled config value to remoteFileSystemEnabled in the toAppConfig function.
  • src/tools/delegateTools.ts
    • Expanded the toolGroupNames array to include "remoteFilesystem".
    • Updated the description for the taskSchema to mention remoteFilesystem and its purpose.
  • src/tools/index.ts
    • Exported the new getRemoteFileSystemTools function.
  • src/tools/remoteFileSystemTools.ts
    • Created a new file containing the getRemoteFileSystemTools function.
    • Implemented logic to retrieve remote file system tools using @modelcontextprotocol/server-filesystem over an SSH stdio tunnel, based on configuration.
    • Included SSH connection parameters (host, key path, port, strict host key checking, batch mode) and allowed paths.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces remote filesystem access via SSH. The overall implementation is sound, but I've identified a few critical issues related to security and correctness. Specifically, the configuration schema for the new feature needs stricter validation to prevent runtime errors. More importantly, there are two security vulnerabilities in how the SSH command is constructed: one concerning host key verification which could lead to MITM attacks, and another related to using an unpinned package version with npx, creating a supply chain attack vector. I've provided detailed comments and suggestions to address these points.

command: "ssh",
args: [
"-o",
"StrictHostKeyChecking=accept-new",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security-critical critical

Using StrictHostKeyChecking=accept-new poses a significant security risk as it makes the SSH connection vulnerable to Man-in-the-Middle (MITM) attacks. This option automatically trusts new host keys without verification. For a more secure implementation, it's recommended to remove this option and require users to add the host key to their known_hosts file manually before the first connection.

Comment on lines +77 to +92
remoteFileSystem: z
.object({
enabled: z.boolean(),
sshHost: z.string(),
sshKeyPath: z.string(),
sshPort: z.number().default(22),
allowedPaths: z.array(z.string()),
})
.optional()
.default({
enabled: false,
sshHost: "",
sshKeyPath: "",
sshPort: 22,
allowedPaths: [],
}),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The current schema allows remoteFileSystem to be enabled with an empty sshHost or sshKeyPath, which will cause runtime errors when the SSH command is executed. You should add a .refine() validation to the Zod schema to ensure these fields are non-empty strings when enabled is true.

    remoteFileSystem: z
      .object({
        enabled: z.boolean(),
        sshHost: z.string(),
        sshKeyPath: z.string(),
        sshPort: z.number().default(22),
        allowedPaths: z.array(z.string()),
      })
      .refine(
        (data) => !data.enabled || (data.sshHost !== "" && data.sshKeyPath !== ""),
        {
          message: "sshHost and sshKeyPath must be provided when remoteFileSystem is enabled.",
        },
      )
      .optional()
      .default({
        enabled: false,
        sshHost: "",
        sshKeyPath: "",
        sshPort: 22,
        allowedPaths: [],
      }),

remoteFsConfig.sshHost,
"npx",
"-y",
"@modelcontextprotocol/server-filesystem",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security-high high

Executing npx -y without pinning the package version creates a supply chain security risk. This command will always fetch the latest version of @modelcontextprotocol/server-filesystem, which could be a compromised version in the future. It is strongly recommended to pin this to a specific, known-good version. Please replace 0.0.0 in the suggestion with the actual version you intend to use.

Suggested change
"@modelcontextprotocol/server-filesystem",
"@modelcontextprotocol/server-filesystem@0.0.0",

@MarvelNwachukwu MarvelNwachukwu linked an issue Feb 18, 2026 that may be closed by this pull request
…docs

Remote filesystem tools had identical names to local tools (read_file,
write_file, etc.), causing collisions. Prefix all remote tools with
"remote_" and inject remote PC tool documentation into the agent system
prompt so it knows when and how to use them.
@MarvelNwachukwu
Copy link
Copy Markdown
Contributor Author

Deprioritized- Will re-implement if we decide to continue development

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.

Implement Remote PC access

1 participant