1773ed5f95
Mirror to GitHub / mirror (push) Successful in 26s
Test and Lint / backend-test (push) Successful in 1m11s
continuous-integration/drone/push Build is passing
Test and Lint / frontend-test (push) Successful in 2m28s
Version and Release / version-bump (push) Successful in 32s
Version and Release / trigger-drone (push) Has been skipped
Original: feat: enhance security logging and ensure rate limit blocks are properly tracked - Add comprehensive logging for rate limit blocks with full request details - IP address (with proper proxy detection), user agent, headers, timestamps - Rate limit info (current count, limit, remaining, reset time) - Separate tracking for auth vs general endpoints - Enhance authentication failure logging - JWT validation failures with detailed error info - Admin auth attempts without token - Failed token validation with user context - All events include IP, path, method, user agent - Improve Winston logger configuration for production - Add automatic log rotation (10MB errors, 50MB combined) - Create separate security.log for auth/rate limit events - Ensure logs directory exists automatically - Add structured JSON format for log aggregation - Support container logging with LOG_TO_CONSOLE env var - Create comprehensive documentation - Security logging guide with examples - Monitoring recommendations - Configuration reference - Add test script to verify logging functionality All rate limit settings remain configurable via admin panel: - Window duration, max requests, auth limits - Skip authenticated requests option - Public endpoints only option 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
57 lines
3.1 KiB
JavaScript
57 lines
3.1 KiB
JavaScript
exports.up = async function(knex) {
|
|
// Check if gallery_expired template exists
|
|
const galleryExpiredExists = await knex('email_templates')
|
|
.where('template_key', 'gallery_expired')
|
|
.first();
|
|
|
|
if (!galleryExpiredExists) {
|
|
await knex('email_templates').insert({
|
|
template_key: 'gallery_expired',
|
|
subject_en: 'Your {{event_name}} photo gallery has expired',
|
|
body_html_en: `<h2>Gallery Expired</h2>
|
|
<p>Your photo gallery for {{event_name}} has expired and is no longer accessible.</p>
|
|
<p>The photos have been archived for safekeeping. If you need access to them, please contact the event administrator at {{admin_email}}.</p>
|
|
<p>Thank you for using our photo sharing service!</p>
|
|
<p>Best regards,<br>The Photo Sharing Team</p>`,
|
|
body_text_en: 'Your photo gallery for {{event_name}} has expired and is no longer accessible.\n\nThe photos have been archived. Please contact the administrator at {{admin_email}} if you need access.',
|
|
subject_de: 'Ihre Fotogalerie {{event_name}} ist abgelaufen',
|
|
body_html_de: `<h2>Galerie abgelaufen</h2>
|
|
<p>Ihre Fotogalerie für "{{event_name}}" ist abgelaufen und nicht mehr zugänglich.</p>
|
|
<p>Die Fotos wurden zur sicheren Aufbewahrung archiviert. Wenn Sie wieder Zugriff benötigen, wenden Sie sich bitte an den Administrator unter {{admin_email}}.</p>
|
|
<p>Vielen Dank für die Nutzung unseres Foto-Sharing-Services!</p>
|
|
<p>Mit freundlichen Grüßen,<br>Das Foto-Sharing-Team</p>`,
|
|
body_text_de: 'Ihre Fotogalerie für {{event_name}} ist abgelaufen und nicht mehr zugänglich.\n\nDie Fotos wurden archiviert. Bei Bedarf kontaktieren Sie bitte den Administrator unter {{admin_email}}.',
|
|
variables: JSON.stringify(['event_name', 'admin_email'])
|
|
});
|
|
}
|
|
|
|
// Check if archive_complete template exists
|
|
const archiveCompleteExists = await knex('email_templates')
|
|
.where('template_key', 'archive_complete')
|
|
.first();
|
|
|
|
if (!archiveCompleteExists) {
|
|
await knex('email_templates').insert({
|
|
template_key: 'archive_complete',
|
|
subject_en: 'Archive Complete: {{event_name}}',
|
|
body_html_en: `<h2>Archive Complete</h2>
|
|
<p>The photo gallery "{{event_name}}" has been successfully archived.</p>
|
|
<p>Archive size: {{archive_size}}</p>
|
|
<p>The archive has been stored securely and can be restored if needed.</p>`,
|
|
body_text_en: 'The photo gallery "{{event_name}}" has been successfully archived.\n\nArchive size: {{archive_size}}',
|
|
subject_de: 'Archivierung abgeschlossen: {{event_name}}',
|
|
body_html_de: `<h2>Archivierung abgeschlossen</h2>
|
|
<p>Die Fotogalerie "{{event_name}}" wurde erfolgreich archiviert.</p>
|
|
<p>Archivgröße: {{archive_size}}</p>
|
|
<p>Das Archiv wird sicher aufbewahrt und kann bei Bedarf wiederhergestellt werden.</p>`,
|
|
body_text_de: 'Die Fotogalerie "{{event_name}}" wurde erfolgreich archiviert.\n\nArchivgröße: {{archive_size}}',
|
|
variables: JSON.stringify(['event_name', 'archive_size'])
|
|
});
|
|
}
|
|
};
|
|
|
|
exports.down = async function(knex) {
|
|
await knex('email_templates')
|
|
.whereIn('template_key', ['gallery_expired', 'archive_complete'])
|
|
.del();
|
|
}; |