How to Configure GitHub Copilot SSH Sandbox

Published
Length
4 min read

Luis Felipe Dias

All posts

You set up a github copilot ssh sandbox by pairing local agent rules with restricted Linux accounts. You also sign OpenSSH certificates that limit which commands the agent can run on remote hosts. Many engineering teams start by giving their AI assistant the same local SSH keys they use daily. That shortcut lets the agent run any command that the developer's remote user role allows. A bad prompt or small mistake can delete files, restart services, or read private keys on production machines. H

SSH Access Management + GitHub Actions Security: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You set up a github copilot ssh sandbox by pairing local agent rules with restricted Linux accounts. You also sign OpenSSH certificates that limit which commands the agent can run on remote hosts. Many engineering teams start by giving their AI assistant the same local SSH keys they use daily. That shortcut lets the agent run any command that the developer's remote user role allows. A bad prompt or small mistake can delete files, restart services, or read private keys on production machines.

How to build a github copilot ssh sandbox

Setting up a safe remote workflow starts on the developer machine and ends on the target server. In Visual Studio Code, the agent mode runs terminal commands on behalf of the developer. When the agent needs to check a remote host, it calls the standard OpenSSH client. If the local machine holds an open SSH key, the agent inherits full entry to that server.

To isolate this activity, teams create a dedicated Linux user on the remote test host. This sandbox user receives read rights on log folders and zero write rights on system paths. Admins also remove this user from the sudo group so it cannot raise its own privileges.

Next, teams replace static public keys with OpenSSH user certificates signed by a Certificate Authority key. Certificate login for users and hosts arrived in OpenSSH 5.4 and uses a simple format. Each signed certificate holds a public key, identity info, user names, and a set of options. Admins set a short time window when signing the certificate so the credential expires soon. They also attach certificate options that force a specific command or block port forwarding during the session.

On the remote server, the SSH daemon checks the Certificate Authority signature before allowing the login. The daemon reads the allowed principals list and matches the sandbox user account. Once inside, the agent operates inside the strict limits of that Linux user and certificate.

Where native SSH sandboxes fall short in daily work

Native OpenSSH certificates and Linux user roles solve the problem of who can log in. They verify the identity of the caller and tie the session to a single OS account. For static scripts that run one task, a forced command in a certificate works well.

Still, AI coding agents do not run one static task during a debugging session. An agent checks service status, reads app logs, inspects disk space, and tests network ports. If you lock the certificate to a single command, the agent cannot finish its job. If you give the sandbox user a full shell, you lose control over individual commands.

SSH Access Management + GitHub Actions Security: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

A standard Linux shell cannot inspect the intent of each command before it runs in flight. The OS lets the sandbox user read any file that matches its basic group permissions. Those log files or app configs often contain customer emails, phone numbers, or card numbers. Once the agent reads that output, the raw text flows back into the model context.

Local editor prompts ask the user to approve terminal steps, but developers get tired of clicking. People often approve long shell pipelines without reading every flag or target host name. Native SSH logs also record only the login event and key fingerprint by default. They do not give security teams a clear record of every command and output line.

Keeping agent sessions safe across remote hosts

To make a sandbox useful, teams must separate login checks from live command checks. Start by routing agent tasks to non-production servers that hold fake data whenever possible. When an agent must inspect a live host, avoid storing static private keys on laptops.

Break permissions down to the exact commands the agent needs for reading state. Block file transfers, remote port forwarding, and sub-shells inside the SSH settings. Pair OS user limits with real-time command checks and data masking on the output stream. Rewriting matched fields like emails and national IDs in results keeps sensitive data out of prompts.

Check SSH commands and file transfers on the host

OpenSSH keys and certificates decide who can log into a Linux host. They do not check what a one-shot command or file transfer does once the session starts. With hoop.dev, you run an open-source SSH server with guardrails inline on the host. On every one-shot command or file transfer an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.

When a caller runs a one-shot command or moves a file, hoop.dev guardrails check the command or path before it runs, and hoop.dev data masking masks matched sensitive patterns in downloads and output. Interactive shells carry no guardrails because keystrokes have no statement boundary. Teams can turn interactive shells off and allow only commands and file tasks. The audit trail logs who connected and what was allowed or refused, without storing keystrokes or file bytes. See the source on GitHub.

Frequently asked questions

Can GitHub Copilot run SSH commands on its own?

In agent mode, the tool can propose and run terminal commands, including SSH calls. You can set your editor to require manual approval before any terminal command runs.

Why use OpenSSH certificates instead of static SSH keys for agents?

Static keys stay valid until someone removes them from the server. OpenSSH certificates hold a signed identity, allowed user principals, and options that expire on a schedule.

Does a restricted Linux user stop data leaks to AI models?

No, a Linux user with read access to logs can still print sensitive text. Unless a tool rewrites emails, phone numbers, or card numbers in results, raw data reaches the model.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.