(path string)
| 593 | } |
| 594 | |
| 595 | func (s *PostgresStore) relativeAuthID(path string) (string, error) { |
| 596 | if s == nil { |
| 597 | return "", fmt.Errorf("postgres store: store not initialized") |
| 598 | } |
| 599 | if !filepath.IsAbs(path) { |
| 600 | path = filepath.Join(s.authDir, path) |
| 601 | } |
| 602 | clean := filepath.Clean(path) |
| 603 | rel, err := filepath.Rel(s.authDir, clean) |
| 604 | if err != nil { |
| 605 | return "", fmt.Errorf("postgres store: compute relative path: %w", err) |
| 606 | } |
| 607 | if strings.HasPrefix(rel, "..") { |
| 608 | return "", fmt.Errorf("postgres store: path %s outside managed directory", path) |
| 609 | } |
| 610 | return filepath.ToSlash(rel), nil |
| 611 | } |
| 612 | |
| 613 | func (s *PostgresStore) absoluteAuthPath(id string) (string, error) { |
| 614 | if s == nil { |
no outgoing calls
no test coverage detected