Remove workspace-root configuration and use client run directories
This commit is contained in:
@@ -16,14 +16,13 @@ import (
|
||||
)
|
||||
|
||||
type runner struct {
|
||||
ctx context.Context
|
||||
store *pipeline.Store
|
||||
mu sync.Mutex
|
||||
active map[int64]context.CancelFunc
|
||||
execute func(context.Context, stage.Definition, stage.Values) (stage.Result, error)
|
||||
wg sync.WaitGroup
|
||||
schedulerWG sync.WaitGroup
|
||||
workspaceRoots []string
|
||||
ctx context.Context
|
||||
store *pipeline.Store
|
||||
mu sync.Mutex
|
||||
active map[int64]context.CancelFunc
|
||||
execute func(context.Context, stage.Definition, stage.Values) (stage.Result, error)
|
||||
wg sync.WaitGroup
|
||||
schedulerWG sync.WaitGroup
|
||||
}
|
||||
|
||||
func newRunner(ctx context.Context, s *pipeline.Store) (*runner, error) {
|
||||
@@ -69,24 +68,6 @@ func (r *runner) start(request protocol.Message) (*protocol.RunDetail, error) {
|
||||
if err != nil || !info.IsDir() {
|
||||
return nil, fmt.Errorf("run workspace must be a directory")
|
||||
}
|
||||
allowed := selected == workspace
|
||||
for _, root := range r.workspaceRoots {
|
||||
root, err = filepath.Abs(root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
root, err = filepath.EvalSymlinks(root)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("configured workspace root is unavailable")
|
||||
}
|
||||
rel, err := filepath.Rel(root, selected)
|
||||
if err == nil && rel != ".." && !strings.HasPrefix(rel, ".."+string(os.PathSeparator)) {
|
||||
allowed = true
|
||||
}
|
||||
}
|
||||
if !allowed {
|
||||
return nil, fmt.Errorf("run workspace is outside the server's allowed workspace roots")
|
||||
}
|
||||
workspace = selected
|
||||
}
|
||||
if len(request.WritePaths) > 20 {
|
||||
|
||||
Reference in New Issue
Block a user