in internal/task/run_config.go [37:56]
func (tr *taskRunner) resolveSourceFileContent(
ctx context.Context,
source string,
) (string, error) {
absSourceFilePath, err := filepath.Abs(filepath.Join(tr.sourceBaseDir, source))
if err != nil {
return "", fmt.Errorf("invalid source file %q: %w", source, err)
}
if !isChildPath(tr.sourceBaseDir, absSourceFilePath) {
return "", fmt.Errorf("invalid source file %q: not a child of %q", source, tr.sourceBaseDir)
}
b, err := os.ReadFile(absSourceFilePath)
if err != nil {
return "", fmt.Errorf("failed to read source file %q: %w", source, err)
}
return string(b), nil
}