* tie back-end plugins together

* fix comment typo

* add tests and a bit of polish

* tests and polish

* add test, don't let backend executable paths escape the plugin directory
Этот коммит содержится в:
Chris
2017-09-11 10:02:02 -05:00
коммит произвёл GitHub
родитель a69bed712d
Коммит 402491b7e5
19 изменённых файлов: 655 добавлений и 152 удалений

Просмотреть файл

@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"path/filepath"
"strings"
"sync/atomic"
"time"
@@ -123,7 +124,11 @@ func SupervisorProvider(bundle *model.BundleInfo) (plugin.Supervisor, error) {
} else if bundle.Manifest.Backend == nil || bundle.Manifest.Backend.Executable == "" {
return nil, fmt.Errorf("no backend executable specified")
}
executable := filepath.Clean(filepath.Join(".", bundle.Manifest.Backend.Executable))
if strings.HasPrefix(executable, "..") {
return nil, fmt.Errorf("invalid backend executable")
}
return &Supervisor{
executable: filepath.Join(bundle.Path, bundle.Manifest.Backend.Executable),
executable: filepath.Join(bundle.Path, executable),
}, nil
}