(dirPath: string, filename: string)
| 3169 | } |
| 3170 | |
| 3171 | protected getExtraFilepath(dirPath: string, filename: string) { |
| 3172 | // note: it's vitally important that the resulting path does not escape dirPath |
| 3173 | // (filename is user input and thus unsafe) |
| 3174 | |
| 3175 | const joined = path.join(dirPath, filename); |
| 3176 | const normalized = path.normalize(joined); |
| 3177 | if (process.platform === 'win32') { |
| 3178 | if (!normalized.replaceAll('\\', '/').startsWith(dirPath.replaceAll('\\', '/'))) { |
| 3179 | throw new Error('Invalid filename'); |
| 3180 | } |
| 3181 | } else { |
| 3182 | if (!normalized.startsWith(dirPath)) throw new Error('Invalid filename'); |
| 3183 | } |
| 3184 | return normalized; |
| 3185 | } |
| 3186 | |
| 3187 | fixFiltersBeforeCacheKey(filters: ParseFiltersAndOutputOptions, options: string[], files: FiledataPair[]) { |
| 3188 | // Don't run binary for unsupported compilers, even if we're asked. |
no test coverage detected