review changes
- fix lint issues - use errors pkg for wrapping errors - cleanup on error when setting up secrets mount - fix erroneous import - remove unneeded switch for secret reference mode - return single mount for secrets instead of slice Signed-off-by: Evan Hazlett <ejhazlett@gmail.com> Upstream-commit: 857e60c2f943a09e3ec0ac0f236821b797935900 Component: engine
This commit is contained in:
@ -3,6 +3,7 @@ package service
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
@ -31,6 +32,13 @@ func parseSecretString(secretString string) (string, string, error) {
|
||||
} else {
|
||||
targetName = secretName
|
||||
}
|
||||
|
||||
// ensure target is a filename only; no paths allowed
|
||||
tDir, _ := filepath.Split(targetName)
|
||||
if tDir != "" {
|
||||
return "", "", fmt.Errorf("target must not have a path")
|
||||
}
|
||||
|
||||
return secretName, targetName, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user