feat(security): обновление системы безопасности GraphQL и исправления ESLint

- Обновлены тесты безопасности для всех ролей (SELLER, WHOLESALE, FULFILLMENT, LOGIST)
- Улучшен мониторинг и аудит доступа к коммерческим данным
- Добавлена интеграция с внешними системами мониторинга
- Исправлены ESLint предупреждения в компонентах поставщика
- Обновлены middleware для безопасности GraphQL резолверов

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Veronika Smirnova
2025-08-23 18:49:32 +03:00
parent 12fd8ddf61
commit d05f0a6a93
20 changed files with 127 additions and 110 deletions

View File

@ -6,9 +6,11 @@
*/
import { EventEmitter } from 'events'
import { PrismaClient } from '@prisma/client'
import { SecurityLogger } from '../../lib/security-logger'
import { SecurityAlert } from './types'
/**
@ -775,20 +777,20 @@ export class ExternalMonitoringIntegration extends EventEmitter {
const lines: string[] = []
const timestamp = metrics.timestamp.getTime()
lines.push(`# HELP sfera_security_alerts_total Total number of security alerts`)
lines.push(`# TYPE sfera_security_alerts_total counter`)
lines.push('# HELP sfera_security_alerts_total Total number of security alerts')
lines.push('# TYPE sfera_security_alerts_total counter')
lines.push(`sfera_security_alerts_total ${metrics.totalAlerts} ${timestamp}`)
lines.push(`# HELP sfera_security_active_threats Current number of active threats`)
lines.push(`# TYPE sfera_security_active_threats gauge`)
lines.push('# HELP sfera_security_active_threats Current number of active threats')
lines.push('# TYPE sfera_security_active_threats gauge')
lines.push(`sfera_security_active_threats ${metrics.activeThreats} ${timestamp}`)
lines.push(`# HELP sfera_security_risk_score Current overall risk score`)
lines.push(`# TYPE sfera_security_risk_score gauge`)
lines.push('# HELP sfera_security_risk_score Current overall risk score')
lines.push('# TYPE sfera_security_risk_score gauge')
lines.push(`sfera_security_risk_score ${metrics.riskScore} ${timestamp}`)
lines.push(`# HELP sfera_security_user_accesses_total Total number of user data accesses`)
lines.push(`# TYPE sfera_security_user_accesses_total counter`)
lines.push('# HELP sfera_security_user_accesses_total Total number of user data accesses')
lines.push('# TYPE sfera_security_user_accesses_total counter')
lines.push(`sfera_security_user_accesses_total ${metrics.userActivity.totalAccesses} ${timestamp}`)
return lines.join('\n')