Commit Graph
346 Commits
Author SHA1 Message Date
Drew Newberry 1a70f45b97 fix: resolve rebase artifacts (missing impl block, stray brace, per-channel state) 2026-03-23 15:57:35 -07:00
Drew Newberry fa9b617345 fix(ssh): harden keepalives and tunnel shutdown 2026-03-23 15:29:55 -07:00
Drew Newberry 40fa063dff fix(ssh): add timeouts to SSH/WebSocket connections and per-channel state
Add timeout handling across the SSH connection stack to prevent
indefinite hangs during connection establishment:

- Add SSH_PROXY_ACCEPT_TIMEOUT (5s) and SSH_PROXY_CONNECT_TIMEOUT (10s)
- Add UPSTREAM_HANDSHAKE_TIMEOUT (10s) for WebSocket upstream connections
- Extract establish_upstream for cleaner connection setup
- Refactor SshHandler to maintain per-channel state instead of global
  state, properly isolating pty_master, input_sender, and pty_request
  per ChannelId

This prevents clients from hanging indefinitely when connection
establishment fails or times out.
2026-03-23 15:29:12 -07:00
John T. Myers 834f8aa184 fix: security hardening batch 1 (SEC-002 through SEC-010) (#548)
* fix(l7): reject ambiguous HTTP framing in REST proxy (SEC-009)

Harden the L7 REST proxy HTTP parser against request smuggling:

- Reject requests containing both Content-Length and Transfer-Encoding
  headers per RFC 7230 Section 3.3.3 (CL/TE ambiguity)
- Replace String::from_utf8_lossy with strict UTF-8 validation to
  prevent interpretation gaps with upstream servers
- Reject bare LF line endings (require CRLF per HTTP spec)
- Validate HTTP version string (HTTP/1.0 or HTTP/1.1 only)

* fix(server): harden shell_escape and command construction (SEC-002)

Harden the gRPC exec handler against command injection via the
structured-to-shell-string conversion:

- Reject null bytes and newlines/carriage returns in shell_escape()
- Add input validation in exec_sandbox: reject control characters in
  command args, env values, and workdir
- Enforce size limits: max 1024 args, 32 KiB per arg/value, 4 KiB
  workdir, 256 KiB total assembled command string
- Change shell_escape and build_remote_exec_command to return Result
  so callers must handle validation failures

* fix(server): add command validation at SSH transport boundary (SEC-003)

Add defense-in-depth validation in run_exec_with_russh before sending
the command to the sandbox SSH server:

- Reject null bytes in command string at transport boundary
- Enforce max command length (256 KiB) at transport boundary
- Enhance stream_exec_over_ssh logging with command length, stdin
  length, and truncated command preview for audit trail

* fix(sandbox): validate port range and extend loopback check in SSH (SEC-007)

Harden the SSH direct-tcpip channel handler:

- Validate port_to_connect <= 65535 before u32-to-u16 cast to prevent
  port truncation (e.g., 65537 becoming port 1)
- Replace string-literal loopback check with is_loopback_host() that
  covers the full 127.0.0.0/8 range, IPv4-mapped IPv6 (::ffff:127.x),
  bracketed IPv6, and case-insensitive localhost
- Remove #[allow(clippy::cast_possible_truncation)] since the cast is
  now proven safe by the preceding range check

* fix(sandbox): sanitize inference error messages returned to sandbox (SEC-008)

Replace verbatim internal error strings in router_error_to_http with
generic messages to prevent information leakage to sandboxed code.
Upstream URLs, internal hostnames, TLS details, and file paths are no
longer exposed. Full error context is still logged server-side at warn
level by the caller for debugging.

* fix(server): block internal IPs in SSH proxy target validation (SEC-006)

Add IP validation in start_single_use_ssh_proxy to prevent SSRF if a
sandbox status record were poisoned:

- Resolve DNS before connecting and validate the resolved IP
- Block loopback (127.0.0.0/8) and link-local (169.254.0.0/16, covers
  cloud metadata endpoint) addresses
- Block IPv4-mapped IPv6 variants of the same ranges
- Connect to the validated SocketAddr directly to prevent TOCTOU
- Add debug logging of resolved target IP for audit

* fix(sandbox): add resource limits to chunked body parser (SEC-010)

Harden parse_chunked_body in the inference interception path:

- Replace all unchecked +2 additions with checked_add for consistent
  overflow safety across all target architectures
- Add MAX_CHUNKED_BODY (10 MiB) to cap decoded body size
- Add MAX_CHUNK_COUNT (4096) to prevent CPU exhaustion via tiny chunks
- Early-reject chunk sizes larger than remaining buffer space

* fix(cli): double-escape command for SSH path, validate host and name (SEC-004)

Harden doctor_exec against command injection in the SSH remote path:

- Apply shell_escape to inner_cmd in the SSH path so it survives the
  double shell interpretation (SSH remote shell + sh -lc). This also
  fixes a correctness bug where multi-word commands were silently
  broken in the SSH path.
- Add validate_gateway_name to reject shell metacharacters in gateway
  names before use in container_name
- Add validate_ssh_host to reject metacharacters in remote_host loaded
  from metadata.json

* fix(sandbox): add CIDR breadth warning and control-plane port blocklist (SEC-005)

Defense-in-depth for the allowed_ips feature:

- Log a warning when a CIDR entry has a prefix length < /16, as overly
  broad ranges may unintentionally expose control-plane services
- Block K8s API (6443), etcd (2379/2380), and kubelet (10250/10255)
  ports unconditionally in resolve_and_check_allowed_ips, even when
  the resolved IP matches an allowed_ips entry

* test(e2e): update assertion for sanitized inference error message (SEC-008)

The SEC-008 fix changed the error message from 'no compatible route
for source protocol ...' to 'no compatible inference route available'.
Update the E2E assertion substring to match.
2026-03-23 14:41:03 -07:00
Khai Le b4e20c19f5 docs(providers): add Groq to the supported providers table (#518) v0.0.14 2026-03-21 13:34:23 -07:00
Drew Newberry 7186a772ef fix(docker): propagate OPENSHELL_IMAGE_TAG to cross-compile Dockerfiles (#530) v0.0.13 2026-03-21 10:58:58 -07:00
Drew Newberry ef196dba9a refactor(sandbox): remove unused pod_template field from CreateSandbox RPC (#522) 2026-03-21 08:50:34 -07:00
John T. Myers bbcaed2ea7 refactor(proto): rename UpdateSettings to UpdateConfig for consistency with read path (#515) 2026-03-20 16:45:59 -07:00
Drew Newberry 0dd3dbc768 ci(release): restrict auto-tag to weekdays only (#507) 2026-03-20 16:44:02 -07:00
Parth Sareen 86a8fa13e0 docs(ollama): fix references to renamed tutorial file (#513) 2026-03-20 15:29:21 -07:00
Parth Sareen ba19aade08 docs(ollama): update ollama tutorial and references to match latest (#511)
features
2026-03-20 14:42:54 -07:00
John T. Myers a831a8921b feat(settings): gateway-to-sandbox runtime settings channel (#474)
* feat(gateway/sandbox): add global and sandbox runtime settings flow
2026-03-20 14:08:57 -07:00
John T. Myers 51aeffc9a7 feat(ocsf): create openshell-ocsf crate — standalone OCSF event types, formatters, and tracing layers (#489)
feat(ocsf): create openshell-ocsf crate with OCSF v1.7.0 event types, formatters, and tracing layers
2026-03-20 12:19:26 -07:00
Evan Lezar dac6cd953d feat(gpu): disable NFD/GFD and remove nodeAffinity from device plugin chart (#497)
Disables GPU Feature Discovery and Node Feature Discovery DaemonSets and
overrides the device plugin's default nodeAffinity to null so it schedules
unconditionally on the single-node gateway without requiring NFD/GFD labels.

Setting affinity to an empty map ({}) does not override the chart defaults
because Helm deep-merges user values with chart defaults. Using null explicitly
removes the key, causing the chart template to skip the affinity block entirely.
2026-03-20 10:45:30 -07:00
Hector Flores eff88b7011 feat(providers): add GitHub Copilot CLI agent provider (#476)
* feat(providers): add GitHub Copilot CLI agent provider

Source: https://docs.github.com/en/copilot/reference/copilot-allowlist-reference
2026-03-20 10:18:37 -07:00
Evan Lezar 495fe4cc73 fix(docker): set migrations dir permissions to 755 on COPY (#475)
Docker COPY preserves build-host file permissions. On hosts with a
restrictive umask (e.g. 0027), the migrations directory is copied as
750 root:root, making it unreadable by the openshell user at runtime
and causing the server to crash with a permission denied error on
startup.

Using --chmod=755 ensures the directory is always world-readable
regardless of the build host umask.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
v0.0.12
2026-03-20 14:09:24 +01:00
Piotr Mlocek c0cdd665b6 fix(gateway): allow first live network policy update (#493) 2026-03-19 20:09:52 -07:00
Glen Maddern 5e4d0a0b61 fix(router): increase inference validation token budget (#432) 2026-03-19 15:47:28 -07:00
Drew Newberry de9dcaa44b fix(e2e): update log-reading helpers for rolling file appender (#480) (#481) 2026-03-19 14:06:39 -07:00
Serge Panev 564c4118fd fix(sandbox): rotate openshell.log daily, keep 3 files (#431) 2026-03-19 10:20:12 -07:00
Miyoung Choi 510dcd1d92 docs: add guidance for OpenAI-compatible cloud providers (#458)
* add guidance for OpenAI-compatible cloud providers

* add provider list and xref link

* add xref

* add provider name value column
2026-03-19 09:58:33 -07:00
Drew Newberry a4883d8286 fix(bootstrap): surface diagnostics for K8s namespace not ready failures (#466) 2026-03-19 09:13:11 -07:00
Drew Newberry 4878b9b086 fix(bootstrap): auto-cleanup Docker resources on failed gateway deploy (#464) v0.0.11 2026-03-18 21:24:21 -07:00
Drew Newberry a912848217 refactor(build): unify image build graph for cache reuse (#390) 2026-03-18 15:01:04 -07:00
Drew Newberry e45d415230 chore(repo): migrate github label taxonomy (#454) 2026-03-18 14:01:48 -07:00
Drew Newberry 1a706f33cf fix(ci): simplify dev release install instructions to use install.sh (#453) 2026-03-18 13:53:03 -07:00
John T. MyersandJohn Myers 3566e556f4 fix(ci): use env context instead of secrets in step-level if condition (#452)
The secrets context is not available in step-level if expressions in
GitHub Actions — only in with and env blocks. This caused the workflow
file to be invalid, failing every run with:

  Unrecognized named-value: 'secrets'

Fix by exporting the secret to a job-level env var and checking that
in the step condition instead.

Co-authored-by: John Myers <johntmyers@users.noreply.github.com>
2026-03-18 10:20:27 -07:00
Drew Newberry 5565a8bba3 fix(cli): suppress browser popup during auth via OPENSHELL_NO_BROWSER env var (#419) 2026-03-18 09:38:51 -07:00
John T. MyersandJohn Myers e26732bfae fix(ci): split vouch gate into two steps with separate tokens (#446)
The ORG_READ_TOKEN (read:org PAT) was being used for all API calls,
including closing PRs and posting comments, which it lacks permissions
for. Split into two steps:

1. Org membership check — uses ORG_READ_TOKEN exclusively
2. VOUCHED.td check + close — uses default GITHUB_TOKEN (has repo write)

Step 2 is skipped entirely if step 1 confirms org membership.

Co-authored-by: John Myers <johntmyers@users.noreply.github.com>
2026-03-18 09:29:23 -07:00
John T. MyersandJohn Myers 82cb8d2bed fix(ci): use ORG_READ_TOKEN for org membership check in vouch gate (#445)
The GITHUB_TOKEN cannot determine org membership — it lacks read:org
scope and this is not configurable via the permissions block. Both
author_association and orgs.checkMembershipForUser return NONE/404 for
org members (even public ones) when called with the repo-scoped token.

Use an ORG_READ_TOKEN secret (fine-grained PAT with read:org) when
available, falling back to GITHUB_TOKEN. Also restores the
checkCollaborator fallback since the PAT can resolve that too.

Setup required: create a fine-grained PAT with Organization > Members >
Read permission, then add it as a repo secret named ORG_READ_TOKEN.

Co-authored-by: John Myers <johntmyers@users.noreply.github.com>
2026-03-18 09:24:19 -07:00
Piotr Mlocek 73e19134b0 fix(ci): pass wheel filenames as job output instead of re-downloading (#418)
The trigger-wheel-publish job was downloading the wheel artifact onto a
persistent self-hosted runner just to glob the filenames. Since
download-artifact does not clean the destination directory, stale .whl
files from every previous run accumulated in release/ and were all sent
to GitLab as WHEEL_FILENAMES.

Confirmed on the runner: /home/ubuntu/actions-runner/_work/OpenShell/
OpenShell/release/ contained 120+ wheels spanning versions 0.0.5
through 0.0.10.

Fix: capture wheel filenames as a job output in build-python-wheels and
pass them directly to trigger-wheel-publish. The trigger job no longer
downloads the artifact at all — it only needs the filenames to construct
GitHub release asset URLs for GitLab/Kitmaker.
2026-03-18 09:20:18 -07:00
John T. MyersandJohn Myers 85a3d83d75 fix(ci): fetch author_association via REST API instead of webhook payload (#444)
The webhook payload field context.payload.pull_request.author_association
is unreliable under pull_request_target events — it was absent or not
populated, causing the previous fix (#442) to still fail.

Switch to fetching author_association via pulls.get REST API, which only
needs pull-requests permission (already granted) and reliably returns
MEMBER for org members regardless of membership visibility.

Also removes the redundant orgs.checkMembershipForUser and
repos.checkCollaborator fallbacks, which suffered from the same
GITHUB_TOKEN permission limitation that started this bug.

Co-authored-by: John Myers <johntmyers@users.noreply.github.com>
2026-03-18 09:12:56 -07:00
John T. MyersandJohn Myers 240d0ee3ed fix(ci): check author_association before API calls in vouch gate (#442)
The vouch-check workflow was closing PRs from NVIDIA org members because
the GITHUB_TOKEN lacks read:org scope, causing orgs.checkMembershipForUser
to return 404 for non-public members. The catch block silently swallowed
these as expected 'not found' responses.

Add an author_association check from the webhook payload as the primary
bypass. GitHub sets this field server-side (MEMBER, OWNER, COLLABORATOR)
regardless of membership visibility, with no extra token permissions
needed. The existing API calls are kept as fallbacks.

Fixes the false positive that closed #430.

Co-authored-by: John Myers <johntmyers@users.noreply.github.com>
2026-03-18 08:53:10 -07:00
Yuxi Shi 1d071b8d97 fix(deploy): remove duplicate glob pattern in manifest cleanup loop (#428) 2026-03-18 00:05:20 -07:00
Drew Newberry dcd991275c fix(ci): use published install script in release workflows (#416) 2026-03-17 21:09:26 -07:00
Drew Newberry 13f13c2ea1 fix(server): add startup probe for gateway boot (#417) v0.0.10 2026-03-17 17:08:52 -07:00
Drew Newberry cf66d05c25 fix(installer): remove duplicate app name in install output (#408)
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
v0.0.9
2026-03-17 14:35:27 -07:00
Parth Sareen efb80e7382 docs(ollama): add ollama to community sandboxes catalog and supported agents (#383)
* docs(ollama): add ollama to community sandboxes catalog and supported agents

* update readme
2026-03-17 14:02:40 -07:00
Drew Newberry 925160e848 refactor: simplify install.sh to print PATH guidance (#403) 2026-03-17 12:22:25 -07:00
Piotr Mlocek 00ae3edb5b fix(docs): resolve Pygments console lexer error in LM Studio tutorial (#402)
The console lexer cannot tokenize single-quoted JSON arguments in
multi-line shell commands. Switch the Step 5 code blocks to the bash
lexer which handles quoting correctly. Also standardize earlier blocks
to use the console lexer with $ prompts for simple commands, and
replace -H/-d curl flags with --json for consistency.
2026-03-17 10:45:36 -07:00
Drew Newberry 5439f478ac fix(ci): skip auto-tag when no new commits since latest tag (#399) 2026-03-17 09:28:55 -07:00
will-lms 389454f02b fix(verification): send content type (#382)
Signed-off-by: Will Burford <will@lmstudio.ai>
2026-03-17 09:26:22 -07:00
will-lms 0463046ad0 docs(inference): Add LM Studio guide (#386)
Signed-off-by: Will Burford <will@lmstudio.ai>
2026-03-16 21:30:42 -07:00
Drew Newberry bb4545ff15 fix(ci): skip remote sccache config for fork PRs (#388) v0.0.7 v0.0.8 2026-03-16 19:04:34 -07:00
Piotr Mlocek 18fb7af4e2 perf(docker): move version ARG below cached layers to fix cache invalidation (#385)
The OPENSHELL_CARGO_VERSION build arg contains a git commit hash that
changes on every build (e.g. 0.0.7-dev.11+g085b131ae). Declaring this
ARG near the top of each Dockerfile invalidated every layer below it --
including expensive dependency installs, toolchain setup, and the Rust
dependency pre-build step -- on every single commit.

Move the ARG declaration to just before the RUN that actually uses it so
upstream layers stay cached. This recovers ~5-6 minutes per build on the
gateway image (from ~9m back toward ~2-3m) and similarly improves cluster,
CLI, and Python wheel builds.

Also removes unused OPENSHELL_IMAGE_TAG ARG from cli-macos, python-wheels,
and python-wheels-macos Dockerfiles.
2026-03-16 18:56:30 -07:00
Drew Newberry 48cb68914f ci(release): enable scheduled nightly release auto-tag (#384) 2026-03-16 17:44:58 -07:00
John T. Myers 8227719d82 fix: use dedicated vouched branch to avoid branch protection (#379) 2026-03-16 16:07:57 -07:00
John T. Myers 20dab0bbf1 chore: replace mitchellh/vouch with hand-rolled workflows (#378) 2026-03-16 15:56:51 -07:00
John T. MyersandJohn Myers c95a954b0f chore: pin mitchellh/vouch actions to SHA (#377)
Signed-off-by: John Myers <johntmyers@users.noreply.github.com>
Co-authored-by: John Myers <johntmyers@users.noreply.github.com>
2026-03-16 15:18:37 -07:00
John T. Myers a4e2c91008 chore: add vouch system for first-time contributors (#375)
chore: add vouch system for first-time contributors
2026-03-16 15:06:50 -07:00