fix: security & privacy (rate limiter fix, csrf session cookie, logout on server, drafts stale token passw, login timing, password over 72b, JWT_SECRET complexity, SMTP TLS, CSV export neutralised, fonts bundled, upload metadata, hourly cleanup job, privacy.md report)

This commit is contained in:
Florian Sylvain committed 2026-10-22 00:49:19 +02:00
1 parent e2812ee0b9
commit ea98c5ec05
118 files changed
+3828 -130

No files matched your search

+28 -2
View File
@@ -3,6 +3,7 @@ package scheduler
import (
"RenewCMS/internal/domain/audit"
"RenewCMS/internal/domain/purge"
"RenewCMS/internal/domain/retention"
"context"
"errors"
"fmt"
@@ -23,6 +24,10 @@ type CleanupJob interface {
Tick(now time.Time) (audit.CleanupResult, bool, error)
}
type RetentionJob interface {
Tick(now time.Time) (retention.Result, error)
}
type task interface {
tick(ctx context.Context, now time.Time) (summary string, ran bool, err error)
}
@@ -49,6 +54,16 @@ func (c cleanupTask) tick(_ context.Context, now time.Time) (string, bool, error
return fmt.Sprintf("removed=%d", result.Removed), ran, err
}
type retentionTask struct {
job RetentionJob
}
func (r retentionTask) tick(_ context.Context, now time.Time) (string, bool, error) {
result, err := r.job.Tick(now)
summary := fmt.Sprintf("revoked_sessions=%d unverified_users=%d invites=%d", result.RevokedSessions, result.UnverifiedUsers, result.Invites)
return summary, result.Total() > 0, err
}
type Runner struct {
label string
task task
@@ -60,8 +75,9 @@ type Runner struct {
}
const (
purgeLabel = "automatic purge"
cleanupLabel = "activity cleanup"
purgeLabel = "automatic purge"
cleanupLabel = "activity cleanup"
retentionLabel = "personal data retention"
)
func newRunner(label string, task task, now func() time.Time, ticks <-chan time.Time, startup <-chan time.Time, logger *log.Logger) *Runner {
@@ -76,6 +92,16 @@ func NewCleanupRunner(job CleanupJob, now func() time.Time, ticks <-chan time.Ti
return newRunner(cleanupLabel, cleanupTask{job}, now, ticks, startup, logger)
}
func NewRetentionRunner(job RetentionJob, now func() time.Time, ticks <-chan time.Time, startup <-chan time.Time, logger *log.Logger) *Runner {
return newRunner(retentionLabel, retentionTask{job}, now, ticks, startup, logger)
}
func NewSystemRetentionRunner(job RetentionJob, logger *log.Logger) *Runner {
return withSystemTimers(func(now func() time.Time, ticks <-chan time.Time, startup <-chan time.Time) *Runner {
return NewRetentionRunner(job, now, ticks, startup, logger)
})
}
func NewSystemRunner(job Job, logger *log.Logger) *Runner {
return withSystemTimers(func(now func() time.Time, ticks <-chan time.Time, startup <-chan time.Time) *Runner {
return NewRunner(job, now, ticks, startup, logger)