fix: audit hash-chain GDPR, serialization, and alerting (#541-544)#738
fix: audit hash-chain GDPR, serialization, and alerting (#541-544)#7382witstudios merged 7 commits intomasterfrom
Conversation
Hash chain now only includes non-PII fields (eventType, serviceId, resourceType, resourceId, details, riskScore, anomalyFlags, timestamp, previousHash) so the chain remains verifiable after GDPR anonymization erases user data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace FOR UPDATE row locking with pg_advisory_xact_lock to prevent concurrent chain forks. Advisory locks work even on an empty table (genesis case) where no row exists to lock. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add alert handler callback and periodic cron verification scheduler. Fires alerts when chain verification detects tampering or breaks. Includes setChainAlertHandler, verifyAndAlert, startPeriodicVerification. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 11 minutes and 47 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (14)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Use explicit `any` for transaction callback parameter in mock to avoid Drizzle ORM complex generic type mismatch in test mocks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rd, shared test helpers - Replace console.error with loggers.security for structured logging consistency - Add overlap guard to prevent concurrent periodic verification runs - Simplify unref() call (always available on Node.js Timeout) - Extract shared MockSecurityAuditEntry type and createValidSecurityChain helper - Add logger mocks to test files that import the alerting/verifier modules
…re, dead code - F1: Replace console.log/error with loggers.security/api in cron route - F2: Remove breakPoint from API response (info disclosure); log server-side only - F3: Return generic 'Internal server error' instead of error.message - F4: Add 9 contract tests for verify-audit-chain cron route - F5: Remove vestigial lastHash write and unused getLastHash() method - F6: Log dropped audit events in adapter instead of silent .catch() - Switch cron route from verifySecurityAuditChain to verifyAndAlert - Export verifyAndAlert from packages/lib barrel Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts: # apps/web/src/app/api/cron/verify-audit-chain/__tests__/route.test.ts # apps/web/src/app/api/cron/verify-audit-chain/route.ts
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary
FOR UPDATErow locking withpg_advisory_xact_lockto prevent concurrent chain forks — works even on empty tables (genesis case)setChainAlertHandlercallback andstartPeriodicVerificationcron scheduler that fires alerts on chain integrity failuresChanges since initial review
loggers.security/loggers.apiinstead ofconsole.log/error(F1)breakPointremoved from API response — logged server-side only (F2)error.message(F3)lastHashwrite and unusedgetLastHash()(F5).catch()now logs warnings instead of silently dropping failures (F6)verifySecurityAuditChaintoverifyAndAlert('periodic', ...)Test plan
🤖 Generated with Claude Code