(relPath string)
| 145 | } |
| 146 | |
| 147 | func (m *CLIBridgeModule) isPathAllowed(relPath string) bool { |
| 148 | dataDir := configs.GetFilePathsConfig().DataFiles.String() |
| 149 | |
| 150 | absPath := filepath.Clean(filepath.Join(dataDir, relPath)) |
| 151 | |
| 152 | if !strings.HasPrefix(absPath, filepath.Clean(dataDir)) { |
| 153 | return false |
| 154 | } |
| 155 | |
| 156 | for _, allowed := range m.getAllowedPaths() { |
| 157 | if allowed == `/*` { |
| 158 | return true |
| 159 | } |
| 160 | allowedAbs := filepath.Clean(filepath.Join(dataDir, allowed)) |
| 161 | if strings.HasPrefix(absPath, allowedAbs) { |
| 162 | return true |
| 163 | } |
| 164 | } |
| 165 | return false |
| 166 | } |
| 167 | |
| 168 | func (m *CLIBridgeModule) resolveArgs(args []string) ([]string, error) { |
| 169 | if len(args) == 0 { |
no test coverage detected