diff --git a/tools/clis/amplitude.js b/tools/clis/amplitude.js index 84128c4..a1321f4 100755 --- a/tools/clis/amplitude.js +++ b/tools/clis/amplitude.js @@ -12,7 +12,9 @@ if (!API_KEY) { async function ingestApi(method, path, body) { if (args['dry-run']) { - return { _dry_run: true, method, url: `${INGESTION_URL}${path}`, headers: { 'Content-Type': 'application/json' }, body: body || undefined } + const maskedBody = body ? JSON.parse(JSON.stringify(body)) : undefined + if (maskedBody && maskedBody.api_key) maskedBody.api_key = '***' + return { _dry_run: true, method, url: `${INGESTION_URL}${path}`, headers: { 'Content-Type': 'application/json' }, body: maskedBody } } const res = await fetch(`${INGESTION_URL}${path}`, { method, diff --git a/tools/clis/livestorm.js b/tools/clis/livestorm.js index b393e32..23df978 100755 --- a/tools/clis/livestorm.js +++ b/tools/clis/livestorm.js @@ -10,7 +10,7 @@ if (!API_TOKEN) { async function api(method, path, body) { const headers = { - 'Authorization': API_TOKEN, + 'Authorization': `Bearer ${API_TOKEN}`, 'Content-Type': 'application/vnd.api+json', 'Accept': 'application/vnd.api+json', } diff --git a/tools/clis/mixpanel.js b/tools/clis/mixpanel.js index e6cf02d..cae1ad3 100755 --- a/tools/clis/mixpanel.js +++ b/tools/clis/mixpanel.js @@ -15,7 +15,12 @@ if (!TOKEN && !API_KEY) { async function ingestApi(method, path, body) { const headers = { 'Content-Type': 'application/json' } if (args['dry-run']) { - return { _dry_run: true, method, url: `${INGESTION_URL}${path}`, headers, body: body || undefined } + const maskedBody = body ? JSON.parse(JSON.stringify(body)) : undefined + if (Array.isArray(maskedBody)) maskedBody.forEach(item => { + if (item.properties && item.properties.token) item.properties.token = '***' + if (item.$token) item.$token = '***' + }) + return { _dry_run: true, method, url: `${INGESTION_URL}${path}`, headers, body: maskedBody } } const res = await fetch(`${INGESTION_URL}${path}`, { method, diff --git a/tools/clis/onesignal.js b/tools/clis/onesignal.js index 42bf0f9..408ecd7 100755 --- a/tools/clis/onesignal.js +++ b/tools/clis/onesignal.js @@ -16,7 +16,7 @@ if (!APP_ID) { async function api(method, path, body) { const headers = { - 'Authorization': `Key ${REST_API_KEY}`, + 'Authorization': `Basic ${REST_API_KEY}`, 'Content-Type': 'application/json', 'Accept': 'application/json', }