(input: string)
| 7 | /(?:token|access[_-]?token|auth|authorization|key|secret|password|credential)/i; |
| 8 | |
| 9 | export const redactUrl = (input: string): string => { |
| 10 | try { |
| 11 | const url = new URL(input); |
| 12 | url.username = ""; |
| 13 | url.password = ""; |
| 14 | url.search = ""; |
| 15 | url.hash = ""; |
| 16 | return url.toString(); |
| 17 | } catch { |
| 18 | return input.replace(/\/\/[^/@\s]+@/g, "//").replace(/[?#].*$/g, ""); |
| 19 | } |
| 20 | }; |
| 21 | |
| 22 | export const hasTokenLikeQuery = (url: URL): boolean => { |
| 23 | for (const key of url.searchParams.keys()) { |
no test coverage detected