보안 감사 결과 CRITICAL 2건, HIGH 5건 발견 → 수정 완료 + 자동화 구축. [보안 수정] - issue-view.js: 하드코딩 비밀번호 → crypto.getRandomValues() 랜덤 생성 - pushSubscriptionController.js: ntfy 비밀번호 → process.env.NTFY_SUB_PASSWORD - DEPLOY-GUIDE.md/PROGRESS.md/migration SQL: 평문 비밀번호 → placeholder - docker-compose.yml/.env.example: NTFY_SUB_PASSWORD 환경변수 추가 [보안 강제 시스템 - 신규] - scripts/security-scan.sh: 8개 규칙 (CRITICAL 2, HIGH 4, MEDIUM 2) 3모드(staged/all/diff), severity, .securityignore, MEDIUM 임계값 - .githooks/pre-commit: 로컬 빠른 피드백 - .githooks/pre-receive-server.sh: Gitea 서버 최종 차단 bypass 거버넌스([SECURITY-BYPASS: 사유] + 사용자 제한 + 로그) - SECURITY-CHECKLIST.md: 10개 카테고리 자동/수동 구분 - docs/SECURITY-GUIDE.md: 운영자 가이드 (워크플로우, bypass, FAQ) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
// Push Notification Service Worker
|
|
// 캐싱 없음 — Push 수신 전용
|
|
|
|
self.addEventListener('push', function(event) {
|
|
var data = { title: '알림', body: '새 알림이 있습니다.', url: '/' };
|
|
if (event.data) {
|
|
try { data = Object.assign(data, event.data.json()); } catch(e) {}
|
|
}
|
|
event.waitUntil(
|
|
self.registration.showNotification(data.title, {
|
|
body: data.body,
|
|
icon: '/static/img/icon-192.png',
|
|
badge: '/static/img/badge-72.png',
|
|
data: { url: data.url || '/' },
|
|
tag: 'tk-notification-' + Date.now(),
|
|
renotify: true
|
|
})
|
|
);
|
|
// 메인 페이지에 뱃지 갱신 신호 전송
|
|
self.clients.matchAll({ type: 'window' }).then(function(clients) {
|
|
clients.forEach(function(client) {
|
|
client.postMessage({ type: 'NOTIFICATION_RECEIVED' });
|
|
});
|
|
});
|
|
});
|
|
|
|
self.addEventListener('notificationclick', function(event) {
|
|
event.notification.close();
|
|
var url = (event.notification.data && event.notification.data.url) || '/';
|
|
event.waitUntil(
|
|
self.clients.matchAll({ type: 'window' }).then(function(clients) {
|
|
for (var i = 0; i < clients.length; i++) {
|
|
if (clients[i].url.includes(self.location.origin)) {
|
|
clients[i].navigate(url);
|
|
return clients[i].focus();
|
|
}
|
|
}
|
|
return self.clients.openWindow(url);
|
|
})
|
|
);
|
|
});
|