(value: string)
| 70 | } |
| 71 | |
| 72 | function hasUrlControlChars(value: string): boolean { |
| 73 | for (let i = 0; i < value.length; i++) { |
| 74 | const code = value.charCodeAt(i); |
| 75 | if (code <= 0x1F || code === 0x7F) return true; |
| 76 | } |
| 77 | return false; |
| 78 | } |
| 79 | |
| 80 | export function isSafeExternalHttpsUrl(value: unknown): value is string { |
| 81 | if (typeof value !== 'string' || hasUrlControlChars(value) || !value.toLowerCase().startsWith('https://')) { |
no outgoing calls
no test coverage detected