(ctx context.Context)
| 753 | } |
| 754 | |
| 755 | func loadRuntimeSeedFilesFromContext(ctx context.Context) map[string]string { |
| 756 | raw := ctx.Value(RuntimeSeedFilesKey) |
| 757 | if raw == nil { |
| 758 | return nil |
| 759 | } |
| 760 | seedFiles, ok := raw.(map[string]string) |
| 761 | if !ok || len(seedFiles) == 0 { |
| 762 | return nil |
| 763 | } |
| 764 | |
| 765 | sanitized := make(map[string]string, len(seedFiles)) |
| 766 | for p, content := range seedFiles { |
| 767 | normalized := filepath.ToSlash(filepath.Clean(strings.TrimSpace(p))) |
| 768 | if normalized == "" || normalized == "." || strings.HasPrefix(normalized, "..") || strings.HasPrefix(normalized, "/") { |
| 769 | continue |
| 770 | } |
| 771 | sanitized[normalized] = content |
| 772 | } |
| 773 | if len(sanitized) == 0 { |
| 774 | return nil |
| 775 | } |
| 776 | return sanitized |
| 777 | } |
| 778 | |
| 779 | func normalizeSandboxRelativePath(raw string) (string, error) { |
| 780 | trimmed := strings.TrimSpace(raw) |
no outgoing calls
no test coverage detected