fix: correct auth issues in amplitude, livestorm, mixpanel, onesignal

- amplitude: mask api_key in dry-run body output
- livestorm: add missing Bearer prefix to Authorization header
- mixpanel: mask token/$token in dry-run ingestion body output
- onesignal: change auth from 'Key' to 'Basic' per OneSignal REST API docs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Corey Haines 2026-02-17 22:40:03 -08:00
parent c1be574c8b
commit 51bdf2f6b3
4 changed files with 11 additions and 4 deletions

View file

@ -12,7 +12,9 @@ if (!API_KEY) {
async function ingestApi(method, path, body) { async function ingestApi(method, path, body) {
if (args['dry-run']) { 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}`, { const res = await fetch(`${INGESTION_URL}${path}`, {
method, method,

View file

@ -10,7 +10,7 @@ if (!API_TOKEN) {
async function api(method, path, body) { async function api(method, path, body) {
const headers = { const headers = {
'Authorization': API_TOKEN, 'Authorization': `Bearer ${API_TOKEN}`,
'Content-Type': 'application/vnd.api+json', 'Content-Type': 'application/vnd.api+json',
'Accept': 'application/vnd.api+json', 'Accept': 'application/vnd.api+json',
} }

View file

@ -15,7 +15,12 @@ if (!TOKEN && !API_KEY) {
async function ingestApi(method, path, body) { async function ingestApi(method, path, body) {
const headers = { 'Content-Type': 'application/json' } const headers = { 'Content-Type': 'application/json' }
if (args['dry-run']) { 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}`, { const res = await fetch(`${INGESTION_URL}${path}`, {
method, method,

View file

@ -16,7 +16,7 @@ if (!APP_ID) {
async function api(method, path, body) { async function api(method, path, body) {
const headers = { const headers = {
'Authorization': `Key ${REST_API_KEY}`, 'Authorization': `Basic ${REST_API_KEY}`,
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Accept': 'application/json', 'Accept': 'application/json',
} }