Add safe logging utility for credential protection

- Created lib/safe-logging.ts with utilities for safe logging
- logConfigSafely() automatically redacts credentials field
- logSafely() redacts common sensitive fields (password, email, token, etc)
- Updated enhanced-screenshot service to use safe logging utility
- Provides reusable pattern for secure logging throughout codebase
This commit is contained in:
mindesbunister
2025-07-17 14:48:19 +02:00
parent 743bb6bc73
commit 28836c3e5b
2 changed files with 57 additions and 7 deletions

View File

@@ -4,6 +4,7 @@ import path from 'path'
import puppeteer from 'puppeteer'
import { Browser, Page } from 'puppeteer'
import { progressTracker, ProgressStep } from './progress-tracker'
import { logConfigSafely } from './safe-logging'
export interface ScreenshotConfig {
symbol: string
@@ -28,13 +29,7 @@ export class EnhancedScreenshotService {
async captureWithLogin(config: ScreenshotConfig): Promise<string[]> {
console.log('🚀 Enhanced Screenshot Service - Docker Environment (Dual Session)')
console.log('📋 Config:', {
symbol: config.symbol,
timeframe: config.timeframe,
layouts: config.layouts,
sessionId: config.sessionId,
credentials: '[REDACTED]'
})
logConfigSafely(config)
const screenshotFiles: string[] = []
const { sessionId } = config