mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-03-21 18:04:10 -05:00
Hide refresh_token/client_secret/naIdToken fields in logs, ignore Cloudflare HTML errors
This commit is contained in:
parent
4452947187
commit
0f0f666ea6
|
|
@ -27,6 +27,15 @@ export class ErrorResponse<T = unknown> extends Error {
|
|||
|
||||
Object.defineProperty(this, ErrorResponseSymbol, {enumerable: false, value: ErrorResponseSymbol});
|
||||
|
||||
if (response.status === 502 &&
|
||||
response.headers.get('Server') === 'cloudflare' &&
|
||||
response.headers.get('Content-Type')?.match(/^text\/html(;|$)/)
|
||||
) {
|
||||
// Cloudflare returns it's own HTML error page for HTTP 502 errors
|
||||
// Logging this isn't helpful so just discard it
|
||||
body = 'Bad Gateway\n';
|
||||
}
|
||||
|
||||
if (body instanceof ArrayBuffer) {
|
||||
body = (new TextDecoder()).decode(body);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,10 +70,10 @@ function applyFormatters(args: [formatter: string, ...args: unknown[]], self = d
|
|||
|
||||
const censor_fields = [
|
||||
'token',
|
||||
// NA OIDC
|
||||
'access_token', 'id_token',
|
||||
// OAuth/OIDC
|
||||
'access_token', 'id_token', 'refresh_token', 'client_secret',
|
||||
// Coral
|
||||
'accessToken', 'supportId',
|
||||
'accessToken', 'supportId', 'naIdToken',
|
||||
// Moon
|
||||
'serialNumber', 'notificationToken',
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user