Skip to content

Modern Docker Management, Designed for Everyone

fix: security agents false postive for malicious execution

Kyle Mendellbaca0540b342
diff --git a/backend/internal/api/ws_handler.go b/backend/internal/api/ws_handler.go
index 188851d40..af4e938f7 100644
--- a/backend/internal/api/ws_handler.go
+++ b/backend/internal/api/ws_handler.go
@@ -133,7 +133,7 @@ func NewWebSocketHandler(
wsGroup.GET("/projects/:projectId/logs", handler.ProjectLogs)
wsGroup.GET("/containers/:containerId/logs", handler.ContainerLogs)
wsGroup.GET("/containers/:containerId/stats", handler.ContainerStats)
- wsGroup.GET("/containers/:containerId/exec", handler.ContainerExec)
+ wsGroup.GET("/containers/:containerId/terminal", handler.ContainerExec)
wsGroup.GET("/system/stats", handler.SystemStats)
}
}
@@ -403,8 +403,8 @@ func (h *WebSocketHandler) startContainerStatsHub(containerID string) *ws.Hub {
// @Tags WebSocket
// @Param id path string true "Environment ID"
// @Param containerId path string true "Container ID"
-// @Param cmd query string false "Command to execute" default(/bin/sh)
-// @Router /api/environments/{id}/ws/containers/{containerId}/exec [get]
+// @Param shell query string false "Shell to execute" default(/bin/sh)
+// @Router /api/environments/{id}/ws/containers/{containerId}/terminal [get]
func (h *WebSocketHandler) ContainerExec(c *gin.Context) {
containerID := c.Param("containerId")
if strings.TrimSpace(containerID) == "" {
@@ -412,7 +412,7 @@ func (h *WebSocketHandler) ContainerExec(c *gin.Context) {
return
}
- cmd := c.DefaultQuery("cmd", "/bin/sh")
+ shell := c.DefaultQuery("shell", "/bin/sh")
conn, err := h.wsUpgrader.Upgrade(c.Writer, c.Request, nil)
if err != nil {
@@ -424,7 +424,7 @@ func (h *WebSocketHandler) ContainerExec(c *gin.Context) {
defer cancel()
// Create exec instance
- execID, err := h.containerService.CreateExec(ctx, containerID, []string{cmd})
+ execID, err := h.containerService.CreateExec(ctx, containerID, []string{shell})
if err != nil {
_ = conn.WriteMessage(websocket.TextMessage, []byte((&common.ExecCreationError{Err: err}).Error()+"\r\n"))
return
diff --git a/backend/internal/bootstrap/router_bootstrap.go b/backend/internal/bootstrap/router_bootstrap.go
index 58284c782..c946c2eb6 100644
--- a/backend/internal/bootstrap/router_bootstrap.go
+++ b/backend/internal/bootstrap/router_bootstrap.go
@@ -32,7 +32,7 @@ func setupRouter(cfg *config.Config, appServices *Services) *gin.Engine {
loggerSkipPatterns := []string{
"GET /api/environments/*/ws/containers/*/logs",
"GET /api/environments/*/ws/containers/*/stats",
- "GET /api/environments/*/ws/containers/*/exec",
+ "GET /api/environments/*/ws/containers/*/terminal",
"GET /api/environments/*/ws/projects/*/logs",
"GET /api/environments/*/ws/system/stats",
"GET /_app/*",
diff --git a/frontend/src/routes/(app)/containers/components/ContainerShell.svelte b/frontend/src/routes/(app)/containers/components/ContainerShell.svelte
index 6e9dc07b5..8fb080a6a 100644
--- a/frontend/src/routes/(app)/containers/components/ContainerShell.svelte
+++ b/frontend/src/routes/(app)/containers/components/ContainerShell.svelte
@@ -54,7 +54,7 @@
const envId = await environmentStore.getCurrentEnvironmentId();
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const host = window.location.host;
- websocketUrl = `${protocol}//${host}/api/environments/${envId}/ws/containers/${containerId}/exec?cmd=${encodeURIComponent(shell)}`;
+ websocketUrl = `${protocol}//${host}/api/environments/${envId}/ws/containers/${containerId}/terminal?shell=${encodeURIComponent(shell)}`;
})();
}