Skip to content

goul4rt/lgpd-skills / skills/lgpd-audit-logging

lgpd-audit-logging

Verified

Design and implement tamper-evident, transactionally serialized audit logging as a recommended engineering control for LGPD accountability (Art. 6, X) and security (Art. 46). Outputs Prisma schema, concurrency-safe hash-chain writer, DB write-protection triggers, and external WORM/SIEM anchoring verification.

FileKindSize
SKILL.mdskill md5.2 KB
assets/audit-log.prismaother1.2 KB
assets/audit-log.tsscript7.9 KB

assets/audit-log.prisma

View on GitHub
// Trilha de auditoria encadeada (hash chain) — controle técnico recomendado para
// responsabilização (Art. 6º, X) e segurança (Art. 46).

enum ActorType {
  USER
  ADMIN
  SYSTEM
  OPERATOR
}

model AuditLogEntry {
  id          String    @id @default(cuid())
  seq         BigInt    @unique @default(autoincrement()) // ordem estrita de encadeamento
  actorId     String?   // null quando ação automática de sistema
  actorType   ActorType
  action      String    // ex.: "DSAR_FULFILLED", "CONSENT_REVOKED", "PII_EXPORT"
  resource    String    // ex.: "User:usr_123"
  subjectId   String?   // titular afetado (quando aplicável)
  legalBasis  String?
  purpose     String?
  ipAddress   String?   @db.Inet
  userAgent   String?
  payloadHash String    // SHA-256 canônico de metadados redigidos (NUNCA PII em claro)
  prevHash    String    // "GENESIS" no primeiro registro, ou selfHash do seq anterior
  selfHash    String    // SHA-256(prevHash | timestampIso | actorType | actorId | action | resource | subjectId | payloadHash)
  timestamp   DateTime  @default(now())

  @@index([subjectId, timestamp(sort: Desc)])
  @@index([actorId, timestamp(sort: Desc)])
  @@index([action, timestamp(sort: Desc)])
}
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 196kUpdated Claude CodeCodexVerifiedInstall