Skip to content

Commit 86d6145

Browse files
authored
Fix default permission profile for API (#874)
This was ommitted from the API code. Need to figure out if this logic can be moved inside the runconfig creation code.
1 parent 29484bd commit 86d6145

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/api/v1/workloads.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010

1111
"github.com/stacklok/toolhive/pkg/container/runtime"
1212
"github.com/stacklok/toolhive/pkg/logger"
13+
"github.com/stacklok/toolhive/pkg/permissions"
1314
"github.com/stacklok/toolhive/pkg/runner"
1415
"github.com/stacklok/toolhive/pkg/runner/retriever"
1516
"github.com/stacklok/toolhive/pkg/secrets"
@@ -223,6 +224,12 @@ func (s *WorkloadRoutes) createWorkload(w http.ResponseWriter, r *http.Request)
223224
return
224225
}
225226

227+
// Mimic behavior of the CLI by defaulting to the "network" permission profile.
228+
// TODO: Consider moving this into the run config creation logic.
229+
if req.PermissionProfile == "" {
230+
req.PermissionProfile = permissions.ProfileNetwork
231+
}
232+
226233
// Fetch or build the requested image
227234
// TODO: Make verification configurable and return errors over the API.
228235
imageURL, imageMetadata, err := retriever.GetMCPServer(

0 commit comments

Comments
 (0)