fix(security): harden data layer and persistence (sec-data-01..08)#45
Open
Abdulkhalek-1 wants to merge 2 commits intomainfrom
Open
fix(security): harden data layer and persistence (sec-data-01..08)#45Abdulkhalek-1 wants to merge 2 commits intomainfrom
Abdulkhalek-1 wants to merge 2 commits intomainfrom
Conversation
Implements 8 security hardening plans covering encryption, cache correctness, logging, and schema integrity: - sec-data-01: encrypt DashboardSession.accessToken with AES-256-GCM (session-scoped key via sha256(dashboardSessionSecret)); adds isEncrypted/encryptAccessToken/decryptAccessToken helpers and a backfill script for legacy plaintext rows - sec-data-02: atomic swap of actions rule cache - build the new per-event Map locally then swap it in to eliminate the empty-cache window during reloadGuild - sec-data-03: constant-time session id comparison via timingSafeEqual with equalized not-found-path work (dummy decrypt) - sec-data-04: DashboardRoleAssignment FK onDelete -> Restrict plus new deleteDashboardRoleWithAudit helper that enumerates, audit-logs and unassigns inside a single transaction before deleting the role - sec-data-05: redactSensitive() in @fluxcore/utils logger strips Bearer/Basic auth, Discord webhooks, bot tokens, and sensitive query params from all log output - sec-data-06: migrate DashboardAuditLog.details String -> Json (jsonb with ALTER TABLE USING migration); routes no longer stringify - sec-data-07: safeJsonParse warn-on-failure with rule context so corrupted rows surface instead of silently degrading - sec-data-08: action rate limiter keyed per (guildId, eventType) so noisy events can't starve quieter ones Prisma migrations: 3 new (encryption annotation, FK restrict, jsonb). Typecheck clean; dashboard 287 pass / 15 baseline failures (no new regressions); systems 228/228 unit tests green (integration tests for sec-data-04/06 require real test DB).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements 8 security hardening plans covering encryption, cache correctness, logging, and schema integrity.
Migrations
Three Prisma migrations are included:
Required before deploy:
Changes
Test plan
🤖 Generated with Claude Code