Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
b763deb
feat(bff): add OpenShell Go SDK dependency and error mapping foundation
gmenher Aug 14, 2026
909a5a6
feat(bff): migrate sandbox handler to OpenShell Go SDK
gmenher Aug 14, 2026
90158a3
test(bff): update sandbox handler tests for SDK client
gmenher Aug 14, 2026
f90bed8
fix(bff): address bugbot findings in SDK migration
gmenher Aug 14, 2026
08952b4
test(bff): add writeSDKError and BuildSDKSandboxSpec test coverage
gmenher Aug 14, 2026
2370919
fix(ci): resolve lint errors and proto conflict in CI
gmenher Aug 14, 2026
1729d76
feat(bff): migrate provider handlers to OpenShell Go SDK
gmenher Aug 14, 2026
297b8c9
feat(bff): migrate sandbox-provider attach to SDK and drop gateway wr…
gmenher Aug 14, 2026
b80c813
fix(bff): map SDK credential handles to credentialNames
gmenher Aug 14, 2026
bbc2c21
fix: unused parameter in test (lint)
gmenher Aug 14, 2026
e62bf60
feat(bff): migrate remaining handlers to OpenShell Go SDK
gmenher Aug 17, 2026
864fc99
fix(bff): restore file transfer and sandbox policy history after SDK …
gmenher Aug 17, 2026
82a1b12
fix(bff): fail failed uploads and fetch policy history in parallel
gmenher Aug 17, 2026
335bb7f
fix(ci): drop unused gateway mock and split upload/terminal helpers
gmenher Aug 17, 2026
b9d2f90
fix(ci): pack mockInteractiveSession to satisfy fieldalignment
gmenher Aug 17, 2026
1c4c027
fix(ci): group mock session pointers for fieldalignment scan prefix
gmenher Aug 17, 2026
fb85d7b
fix(bff): remove dead proto stubs to stop startup panic
Gkrumbach07 Aug 26, 2026
3be7c38
fix(bff): preserve full policy fidelity and fix binary upload corruption
Gkrumbach07 Aug 27, 2026
a09462a
fix(bff): restore gateway mTLS client-cert auth over the SDK client
Gkrumbach07 Aug 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ frontend/dist/

# Go
backend/bin/
backend/server

# Editor / OS
.DS_Store
Expand Down
67 changes: 61 additions & 6 deletions backend/cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ package main

import (
"flag"
"fmt"
"log/slog"
"net"
"net/http"
"os"
"strings"
"time"

openshell "github.com/NVIDIA/OpenShell/sdk/go/openshell/v1"

"github.com/Gkrumbach07/openshell-dashboard/backend/internal/api"
"github.com/Gkrumbach07/openshell-dashboard/backend/internal/auth"
"github.com/Gkrumbach07/openshell-dashboard/backend/internal/gateway"
"github.com/Gkrumbach07/openshell-dashboard/backend/internal/sdkclient"
)

const (
Expand All @@ -35,7 +39,7 @@ func envOr(key, fallback string) string {
return fallback
}

func main() {
func main() { //nolint:gocyclo // main is inherently branchy due to flag/config handling
var (
port = flag.String("port", envOr("PORT", defaultPort), "listen port (env PORT)")
listenAddress = flag.String("listen-address", envOr("LISTEN_ADDRESS", ""), "listen address (env LISTEN_ADDRESS)")
Expand All @@ -58,6 +62,13 @@ func main() {
if *gatewayURL == defaultGatewayURL {
slog.Warn("gateway URL is the default — verify OPENSHELL_GATEWAY_URL is configured correctly", "url", *gatewayURL)
}
if *gatewayCACert != "" && !strings.HasPrefix(*gatewayURL, "grpcs://") && !strings.HasPrefix(*gatewayURL, "https://") {
slog.Warn(
"gateway CA cert is set but gateway URL has no TLS scheme; use grpcs:// or https:// for TLS gateways",
"url", *gatewayURL,
"caCert", *gatewayCACert,
)
}
if *authDisabled {
slog.Warn("AUTH_DISABLED=true — authentication is OFF; never use this outside local development")
}
Expand All @@ -83,14 +94,58 @@ func main() {
},
}

gatewayClient, err := gateway.New(*gatewayURL, *gatewayCACert, *gatewayClientCert, *gatewayClientKey)
useTLS := strings.HasPrefix(*gatewayURL, "grpcs://") || strings.HasPrefix(*gatewayURL, "https://")
sdkAddress := *gatewayURL
switch {
case strings.HasPrefix(sdkAddress, "grpcs://"):
sdkAddress = "https://" + strings.TrimPrefix(sdkAddress, "grpcs://")
case strings.HasPrefix(sdkAddress, "grpc://"):
sdkAddress = "http://" + strings.TrimPrefix(sdkAddress, "grpc://")
case !strings.HasPrefix(sdkAddress, "https://") && !strings.HasPrefix(sdkAddress, "http://"):
scheme := "http"
if useTLS {
scheme = "https"
}
sdkAddress = fmt.Sprintf("%s://%s", scheme, sdkAddress)
}
if (*gatewayClientCert == "") != (*gatewayClientKey == "") {
slog.Error("gateway mTLS requires both --gateway-client-cert and --gateway-client-key")
os.Exit(1)
}
sdkCfg := openshell.Config{
Address: sdkAddress,
Auth: sdkclient.ContextAuthProvider{RequireTLS: useTLS},
}
if useTLS {
tlsCfg := &openshell.TLSConfig{CAFile: *gatewayCACert}
if *gatewayClientCert != "" {
tlsCfg.CertFile = *gatewayClientCert
tlsCfg.KeyFile = *gatewayClientKey
}
sdkCfg.TLS = tlsCfg
} else {
sdkCfg.TLS = &openshell.TLSConfig{Insecure: true}
}
sdkClient, err := openshell.NewClient(sdkCfg)
if err != nil {
slog.Error("SDK client setup failed", "error", err)
os.Exit(1)
}
defer sdkClient.Close()

// Dedicated raw client for the one gateway capability the SDK omits:
// non-TTY, stdin-carrying ExecSandbox, used for binary file upload.
rawHost := sdkAddress
rawHost = strings.TrimPrefix(rawHost, "https://")
rawHost = strings.TrimPrefix(rawHost, "http://")
uploadExec, err := sdkclient.NewRawExecClient(rawHost, *gatewayCACert, *gatewayClientCert, *gatewayClientKey, useTLS)
if err != nil {
slog.Error("gateway client setup failed", "error", err)
slog.Error("upload exec client setup failed", "error", err)
os.Exit(1)
}
defer gatewayClient.Close()
defer uploadExec.Close()

app := api.NewApp(gatewayClient, authMiddleware, *staticDir, authCfg)
app := api.NewApp(sdkClient, uploadExec, authMiddleware, *staticDir, authCfg)

addr := net.JoinHostPort(*listenAddress, *port)
slog.Info("openshell-dashboard BFF listening",
Expand Down
Loading
Loading