mcpField
L
lgpd-retention-erasure

lgpd-retention-erasure

github.com/goul4rtSecurity14950 installsUpdated 23w ago
Repository

About lgpd-retention-erasure

This skill guides implementation of data retention and erasure processes under Brazil’s LGPD. It helps teams balance deletion requests with legal retention duties through retention rules, deletion strategies, and an automated job workflow.

Key features

  1. 01Legal retention hierarchy
  2. 02Brazilian retention periods
  3. 03Hard delete and soft delete strategies
  4. 04Crypto-shredding and anonymization
  5. 05Prisma retention-rule schema
  6. 06Scheduled erasure and audit logging

Use cases

  1. 01Handling an LGPD erasure request
  2. 02Retaining records under legal duties
  3. 03Automating expired-record deletion
  4. 04Reporting deletion and blocked data

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/goul4rt/lgpd-skills --skill lgpd-retention-erasure

After installing, type/lgpd-retention-erasurein Claude Code to confirm it loaded.

Details

From the project README

Retention & Erasure

Arts. 15-16 LGPD definem o término do tratamento. Art. 18, VI dá direito à eliminação. A tensão prática é com retenções legais obrigatórias.

Hierarquia de obrigações

Retenção legal obrigatória > Retenção contratual > Vontade do titular (Art. 18, VI)

Quando há obrigação legal de manter (fiscal, trabalhista, bancário, Marco Civil), o tratamento continua bloqueado (não usado para finalidade original) até o fim do prazo legal, depois é eliminado.

Prazos comuns no Brasil

CategoriaPrazoFonte
Fiscal (notas, impostos)5 anosCTN Art. 173-174
Trabalhista (contratos, folha)5 anosCLT Art. 11
Previdenciária10 anosLei 8.212/91
Bancário10 anosCMN
Marco Civil — logs de conexão1 anoLei 12.965/2014 Art. 13
Marco Civil — logs de acesso a apps6 mesesLei 12.965/2014 Art. 15
CDC — relação de consumo5 anosCDC Art. 27 (prescrição)

Estratégias de eliminação

1. Hard delete

Quando não há retenção legal. Cascata bem definida em todas as tabelas + replicas + backups quando possível.

2. Soft delete + bloqueio

Quando há retenção legal de alguns campos. Marcar deletedAt, mascarar campos não-essenciais, manter apenas o estritamente necessário.

3. Crypto-shredding

Quando há volume e dificuldade de varrer storage. Dados cifrados por chave do titular; eliminação = destrói a chave.

4. Anonimização

Substituto à eliminação. Após anonimizar (irreversivelmente), dado sai do escopo da LGPD (Art. 12).

Schema Prisma

model RetentionRule {
  id              String   @id @default(cuid())
  entity          String   // "User", "Order", "Message"
  purpose         String   // "marketing", "billing"
  retentionMonths Int
  legalBasis      String
  postAction      PostRetentionAction
  triggeredBy     String   // "consent_revoked", "contract_end", "ttl"
  active          Boolean  @default(true)
}

enum PostRetentionAction {
  HARD_DELETE
  ANONYMIZE
  CRYPTO_SHRED
  BLOCK_AND_RETAIN
}

Job de eliminação automática

Cron job diário:

  1. Identifica registros que ultrapassaram retenção
  2. Aplica postAction conforme RetentionRule
  3. Loga em AuditLogEntry
  4. Notifica relatório semanal ao Encarregado

Workflow para Art. 18, VI

Ver detalhes no skill lgpd-dsar. Resumo:

  1. Recebe pedido
  2. Verifica retenção legal
  3. Se ZERO retenção → hard delete
  4. Se PARCIAL → soft delete + crypto-shred dos campos elimináveis
  5. Loga
  6. Responde titular informando o que foi eliminado e o que foi bloqueado (com prazo)

Status update

## F8 — Retention ✓
- RetentionRules configuradas: {N}
- Job diário ativo
- Eliminação automatizada validada em ambiente staging
- {M} registros já em fila para eliminação
- Próximo: lgpd-incident-response

Comments

Markdown supported