Skip to content

Commit 929580b

Browse files
committed
Add state validation in sandbox update operation
1 parent a594db3 commit 929580b

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/api/internal/sandbox/store/memory/operations.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ func (s *Store) Update(sandboxID string, updateFunc func(sandbox.Sandbox) (sandb
110110

111111
item.mu.Lock()
112112
defer item.mu.Unlock()
113+
if item._data.State != sandbox.StateRunning {
114+
return sandbox.Sandbox{}, &sandbox.NotFoundError{SandboxID: sandboxID}
115+
}
116+
113117
sbx, err := updateFunc(item._data)
114118
if err != nil {
115119
return sandbox.Sandbox{}, err

0 commit comments

Comments
 (0)