| 100 | export const networkEnvironmentInfo = (): string => inspect(networkInterfaces()) |
| 101 | |
| 102 | export const scrubAuthInfo = (obj: object): string => { |
| 103 | const message = inspect(obj) |
| 104 | const bearerRegex = /(Bearer [0-9a-f]{8})[0-9a-f-]{28}/i |
| 105 | |
| 106 | if (bearerRegex.test(message)) { |
| 107 | return message.replace(bearerRegex, '$1-xxxx-xxxx-xxxx-xxxxxxxxxxxx') |
| 108 | } else { // assume there is some other auth format and redact the entire header value |
| 109 | const authHeaderRegex = /Authorization:\s*(.*)/i |
| 110 | return message.replace(authHeaderRegex, 'Authorization: (redacted)') |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * Expected to manually verify the connected host (similar to overriding tls.checkServerIdentity) |