fix: Security Issues + Bug Fixes
continuous-integration/drone/push Build is failing

SECURITY FIXES:
- SEC-1: Debug-Endpoints (/api/debug/*) entfernt - waren ohne Auth zugänglich
- SEC-2: debugCode aus 2FA API-Responses entfernt (nur noch console.log in dev)
- SEC-3: Session Secret Validierung - Server startet nicht ohne SECRET in production
- SEC-4: 2FA if(true) bypass entfernt - 2FA-Flow funktioniert jetzt korrekt
- SEC-5: Auth-Checks auf 10 Endpoints hinzugefügt (labels, notes, goals, rewards)

BUG FIXES:
- DUP-1: Doppelte DELETE /api/tasks/:id Route entfernt
- DUP-2: Doppelter deleteLabel() Aufruf entfernt
- DEAD-4: PATCH /api/goals/:id nutzt jetzt updateGoal() statt updateTask()
- MISC-3: XP Double-Counting in logXpEvent() behoben
- TYPE-2: awardXP() Parameter-Reihenfolge korrigiert (break, energy, focus)
- DEAD-1: Ungenutzter calculateXP() Dead Code entfernt
This commit is contained in:
NotiBot
2026-02-03 10:39:32 +01:00
parent 4f6aff32ab
commit 70de82e88f
3 changed files with 45 additions and 96 deletions
+2 -4
View File
@@ -1043,10 +1043,8 @@ export class DbStorage implements IStorage {
async logXpEvent(event: InsertXpEvent): Promise<XpEvent> {
const result = await this.db.insert(schema.xpEvents).values(event).returning();
// Also update user XP
if (event.userId) { // In real app ensure ID
await this.updateUserXP(event.userId, event.amount);
}
// BUG FIX: Removed duplicate updateUserXP call (MISC-3)
// XP is already updated in GamificationService.awardXP() before logXpEvent is called
return result[0];
}