(path string)
| 559 | } |
| 560 | |
| 561 | func (h *shellCallHandler) contextAbsPath(path string) (string, error) { |
| 562 | if !filepath.IsAbs(path) { |
| 563 | path = filepath.Join(h.workdirPath(), path) |
| 564 | |
| 565 | // path could be empty if input is empty and workdir is "/" |
| 566 | if path != "" && !filepath.IsLocal(path) { |
| 567 | return "", fmt.Errorf("can't escape context root: %s", h.contextRoot()) |
| 568 | } |
| 569 | |
| 570 | path = filepath.Join("/", path) |
| 571 | } |
| 572 | return path, nil |
| 573 | } |
| 574 | |
| 575 | func (h *shellCallHandler) workdirPath() string { |
| 576 | return strings.TrimPrefix(h.workdirAbsPath(), "/") |
no test coverage detected