본문으로 건너뛰기
cccskills
무료GitHub에 공개

saas-lgpd-encryption-keys

Configure encryption at rest, in transit, and key management aligned with LGPD Art. 46 (security duty) and the ANPD's Guia de Segurança da Informação para ATPP. Use when user asks 'criptografia LGPD', 'KMS', 'TDE', 'encryption at rest', 'rotação de chaves', 'pgcrypto', 'column-level encryption'. Tailored for Prisma/PostgreSQL/Better Auth stack.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

실행 점수 미검증

설치 방법 보기

포함된 파일(1)

  • SKILL.md4.5 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Encryption & Key Management

Interaction Localization Rule: When locale: pt-BR (or user speaks Portuguese), ALL questions (AskUserQuestion / sk_question), confirmation prompts, and selectable options MUST be translated and presented in Brazilian Portuguese (PT-BR). Any English question text or options in this skill are illustrative examples — NEVER display English questions or options to a Portuguese developer. Internal reasoning, code synthesis, tests, and technical documentation MUST remain in English (except Brazilian statutory compliance documents under .lgpd/).

Art. 46 LGPD + Guia de Segurança da Informação para ATPP (ANPD, 2021).

Camadas

1. Em trânsito

  • TLS 1.3 em toda comunicação (cliente ↔ servidor, serviço ↔ serviço)
  • HSTS habilitado (max-age=31536000; includeSubDomains; preload)
  • Certificate pinning em apps mobile (React Native — react-native-ssl-pinning ou equivalente)
  • mTLS para comunicação entre serviços internos quando viável

2. Em repouso

  • TDE (Transparent Data Encryption) no PostgreSQL — habilitado pelo provider (AWS RDS, GCP Cloud SQL)
  • Volume encryption (EBS, persistent disks) — geralmente padrão hoje
  • Backups criptografados — mesma chave do volume, ou KMS dedicado
  • Storage de arquivos (S3, GCS): server-side encryption (SSE-KMS preferível a SSE-S3)

3. Nível de aplicação (campos sensíveis)

Para CPF, biometria, dados de saúde, tokens de auth — criptografia adicional em coluna:

// lib/crypto/field-encryption.ts
import { createCipheriv, createDecipheriv, randomBytes } from "crypto";

const KEY = await loadKeyFromKMS(); // 32 bytes

export function encryptField(plain: string): string {
  const iv = randomBytes(12);
  const cipher = createCipheriv("aes-256-gcm", KEY, iv);
  const enc = Buffer.concat([cipher.update(plain, "utf8"), cipher.final()]);
  const tag = cipher.getAuthTag();
  return Buffer.concat([iv, tag, enc]).toString("base64");
}

export function decryptField(encoded: string): string {
  const buf = Buffer.from(encoded, "base64");
  const iv = buf.subarray(0, 12);
  const tag = buf.subarray(12, 28);
  const enc = buf.subarray(28);
  const decipher = createDecipheriv("aes-256-gcm", KEY, iv);
  decipher.setAuthTag(tag);
  return Buffer.concat([decipher.update(enc), decipher.final()]).toString("utf8");
}

Prisma extension para criptografia transparente:

const prisma = new PrismaClient().$extends({
  query: {
    user: {
      async create({ args, query }) {
        if (args.data.cpf) args.data.cpf = encryptField(args.data.cpf);
        return query(args);
      },
      async findUnique({ args, query }) {
        const r = await query(args);
        if (r?.cpf) r.cpf = decryptField(r.cpf);
        return r;
      }
    }
  }
});

KMS

Use KMS gerenciado (AWS KMS, GCP KMS, Azure Key Vault) ou HashiCorp Vault para chaves de aplicação.

  • Chaves separadas por finalidade (PII identidade vs. PII financeiro vs. PII saúde)
  • Rotação anual no mínimo (data key automática + master key manual)
  • Acesso por IAM com least privilege
  • Log de uso da chave (CloudTrail / equivalente)
  • Backup das chaves (KMS já faz, mas atestar)

Crypto-shredding

Para suportar Art. 18, VI (eliminação):

  • Cada titular tem uma chave de envelope (encrypted by master key)
  • Dados sensíveis cifrados com a chave do titular
  • Eliminação = deletar a chave do titular no KMS
  • Dado em repouso torna-se irrecuperável sem necessidade de varrer 100% do storage

Útil quando há retenção legal de outros campos mas o restante deve ser eliminável.

Better Auth + senhas

Better Auth usa hash padrão (Argon2id ou bcrypt). Configure:

  • Argon2id com memória ≥ 64MB, paralelismo 2, iterações ≥ 3
  • OU bcrypt com cost ≥ 12

Status update

## F7 — Encryption ✓
- TLS 1.3 + HSTS confirmados
- TDE habilitado no Postgres
- KMS configurado com 3 chaves (identidade, financeiro, saúde)
- Crypto-shredding implementado para campos críticos
- Rotação anual em calendário
- Próximo: saas-lgpd-retention-erasure

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Turn your AI session into an autonomous SaaS and software engineering studio with 49 specialized agents, 74 workflow skills (/saas-*), 28 director gates, and complete architecture across Next.js, FastAPI, Supabase, Tailwind, and Stripe.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Basinfy/Basinfy-SaaS-Studio32026년 10월 24일 업데이트

Brownfield audit — do existing artifacts actually work? Numbered migration plan. Unlike /saas-project-stage-detect, checks compliance not existence.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Basinfy/Basinfy-SaaS-Studio32026년 10월 24일 업데이트

Create an ADR documenting a technical decision: context, alternatives considered, consequences.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Basinfy/Basinfy-SaaS-Studio32026년 10월 24일 업데이트

Traceability matrix mapping PRD requirements to ADRs. Finds gaps, cross-ADR conflicts, stack compatibility. PASS/CONCERNS/NOT ASSESSED/FAIL.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Basinfy/Basinfy-SaaS-Studio32026년 10월 24일 업데이트

Audit assets against naming conventions, file size budgets, format standards. Finds orphaned assets, missing references.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Basinfy/Basinfy-SaaS-Studio32026년 10월 24일 업데이트

Author per-asset visual specs, SVG dimensions, and generation prompts from PRDs and design tokens. After design tokens.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Basinfy/Basinfy-SaaS-Studio32026년 10월 24일 업데이트

Basinfy의 스킬 모두 보기

이 스킬의 문제 신고