LGPD Privacy Code Review (Brazil)

    1

    Engineering-level LGPD review: where personal data lives, what breaks the law in code, and a prioritized fix list. Not legal advice.

    Free

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    LGPD Privacy Code Review (Brazil)

    Example session with this skill installed

    Do an LGPD review of this Express handler and list findings by priority: app.post("/signup", async (req,res)=>{ console.log("signup", req.body); await db.users.insert({name:req.body.name,email:req.body.email,cpf:req.body.cpf,birth:req.body.birth}); analytics.track("signup",{email:req.body.email,cpf:req.body.cpf}); res.json({ok:true}) })

    • Read your context and instructions
    • Compiled the lgpd privacy code

    LGPD review: POST /signup

    This is an engineering review, not legal advice. Have your lawyer or DPO (encarregado) confirm the legal bases and policies.

    Data inventory

    DataStoredPurposeRecipientsRetention
    namedb.users, logsUnknown (probably the account)nonenone defined
    emaildb.users, logs, analyticsAccount and loginanalytics vendornone defined
    CPFdb.users, logs, analyticsNot statedanalytics vendornone defined
    birth datedb.users, logsNot statednonenone defined

    None of these are sensitive data under art. 5, II. The birth date could indicate a minor (art. 14), and the handler doesn't check it.

    Findings

    Critical

    The whole request body goes to the logs. console.log("signup", req.body) writes name, email, CPF and birth date in plaintext (arts. 6, VII and 46).

    • Logs are usually kept longer, readable by more people, and shipped to third parties such as log aggregators. That makes them the most common source of leaks.
    • They are also outside any deletion flow.

    Fix: remove the line. If you need a trace, log a request ID or the new user ID only. If you must log the body, use an allowlist and mask values (for example c***@dom.com).

    CPF and email are sent to the analytics vendor. analytics.track("signup", {email, cpf}) shares personal data with a third party (arts. 6, III, 7 and 33).

    • Analytics doesn't need CPF. This breaks the necessity principle.
    • The CPF is a national identifier, so a leak enables fraud and identity theft.
    • Most analytics vendors process data abroad. That needs an art. 33 mechanism, such as ANPD-approved standard contractual clauses.

    Fix: drop the CPF entirely. Send an internal pseudonymous userId instead of the email. If you need the email for CRM, do it through a separate, justified integration.

    High

    1. No legal basis is recorded and there's no consent. The handler doesn't show why it collects each field (art. 7).
      • Account creation can rest on contract performance.
      • Sending data to analytics and any marketing use are different purposes. They need their own basis, usually consent or documented legitimate interest.
      • Consent must be specific and separate (art. 8), with proof stored: user, timestamp, text version, and what was accepted.

    Fix: add consent fields to the request, such as consent_analytics and consent_marketing. Don't pre-check them. Store a consent record. Call analytics.track only if the user opted in.

    1. The CPF is collected without a clear need. Is it required to provide the service (art. 6, III)?

      • If not, remove the field or make it optional.
      • If it is required, for example for payments or legal obligations, document that. Collect it at the point it's needed, not at signup.
    2. There's no input validation. req.body is trusted as is.

      • There is no schema, no CPF checksum, no type checks and no field allowlist.
      • This hurts data accuracy (art. 6, V) and security.
      • Fix: validate with a schema library such as zod or joi, and reject unknown fields.
    3. CPF is stored in plaintext and in the clear in the schema. Art. 46 requires appropriate technical measures.

    Fix: use column-level or application-level encryption for the CPF. If you only need to look it up or check for duplicates, also store a keyed hash (HMAC) in a separate column.

    • Restrict read access to the column, and audit who reads it.

    Medium

    1. The birth date may identify minors. The handler has no age check (art. 14).
      • Under 12, you need specific consent from a parent or guardian.
      • For teenagers, processing must still serve their best interest.

    Fix: compute age at signup. Block, or branch into a guardian-consent flow, when the user is under 18 (or under whatever age your product policy sets). Store only what you need. If you only need "is 18 or over," store that instead of the full date.

    1. There's no retention rule. Nothing says when users rows, logs or analytics events expire (arts. 15 and 16).

      • Fix: define retention per data type. Add a purge or anonymization job for deleted and inactive accounts.

    Data subject rights (art. 18) aren't visible in this code. There's no access, correction, deletion, portability or consent-withdrawal path.

    • Fix: build endpoints or a documented runbook for each right.
    • Make deletion reach the users table, logs, backups per policy, caches and the analytics vendor (most vendors have a deletion API).

    Low

    Error handling is missing. If db.users.insert throws, the async handler can end in an unhandled rejection or a default error page.
    - Express 4 doesn't catch async errors, and some error handlers or trackers dump the request body.
    -

    Fix: wrap the handler in try/catch or an async wrapper. Make sure error tracking (Sentry, for example) scrubs bodies and PII.

    1. The privacy notice and transparency are outside this handler but should be checked (arts. 9 and 41). The signup form should link to a notice that states the purposes, recipients, retention, the DPO's contact, and how to exercise rights.

    Duplicate-signup behavior may leak information. Check what happens on an existing email or CPF. Different responses let someone test whether a person is registered.

    Suggested fixed version

    app.post("/signup", async (req, res, next) => {
      try {
        const data = signupSchema.parse(req.body); // allowlist + CPF checksum + age check
        const user = await db.users.insert({
          name: data.name,
          email: data.email,
          cpf_enc: encrypt(data.cpf),   // encrypted
          cpf_hash: hmac(data.cpf),     // for lookup / dedup
          birth: data.birth,
        });
        await db.consents.insert({
          user_id: user.id,
          analytics: data.consentAnalytics,
          marketing: data.consentMarketing,
          text_version: data.termsVersion,
          at: new Date(),
        });
        logger.info({ event: "signup", userId: user.id }); // no PII
        if (data.consentAnalytics) analytics.track("signup", { userId: user.id });
        res.json({ ok: true });
      } catch (e) { next(e); }
    });
    

    Why this order

    Findings 1 and 2 come first because the data is already leaving your control (logs and a third party), possibly across borders, and you can't undo that. They also take minutes to fix. If this code has been in production, treat them as an existing exposure. Check what the log pipeline and the analytics vendor hold, and purge it. Then ask your DPO whether it counts as an incident under art. 48.

    For context on the stakes, art. 52 penalties can reach 2% of revenue, capped at R$ 50 million per infraction.

    Real output from a Claude Code session with this skill installed.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Shipping to Brazilian users without an LGPD strategy risks fines up to R$ 50 million or data blocks. This skill audits your codebase and data architecture to find specific privacy violations before the ANPD does.

    What it does

    • Personal data mapping identifies PII, sensitive data, and children's data across schemas, logs, and third-party calls.
    • Legal basis verification flags data collection that lacks a valid purpose under Article 7 or 11.
    • Consent flow audit checks if opt-ins are granular, stored as proof, and easy to withdraw in the UI and backend.
    • Data subject rights check verifies if your API or admin tools can handle access, correction, and deletion requests.
    • Security and retention analysis finds PII leaks in error trackers and flags tables missing purge jobs.
    • International transfer review lists SDKs and APIs receiving data to ensure compliance with Article 33.

    How it works

    1. Inventory phase scans your repo and database migrations to build a table of data types, storage locations, and recipients.
    2. Analysis phase maps discovered data against LGPD articles to find missing legal bases or retention policies.
    3. Infrastructure check reviews logs, analytics configurations, and third-party integrations for leakage.
    4. Report generation delivers a prioritized fix list categorized by severity with specific file/line references.

    Frameworks & tools

    Works with any stack. Scans SQL schemas, Prisma/TypeORM migrations, logging configurations (Winston, Log4j), analytics SDKs, and API route definitions.

    Why this beats prompting it yourself

    Generic privacy prompts miss the technical nuances of Article 18 (Rights) or the specific handling of Article 14 (Children). This skill focuses on the engineering implementation, finding PII in request bodies and logs that a general prompt would ignore.

    Use cases

    • Auditing a startup backend before expanding into the Brazilian market.
    • Finding PII leaked into Sentry or Datadog error logs.
    • Designing the database purge logic for "right to be forgotten" requests.
    • Preparing a technical data inventory for a company DPO or lawyer.

    Known limitations

    Does not provide legal advice. Requires access to code, schemas, or architectural diagrams to find data flows. Use a lawyer to validate final legal bases.

    Not legal advice. Cannot verify physical security measures. Requires code or schema access to identify PII. Lawyer or DPO must validate final legal bases.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 16 days ago

    • Free with an Agensi account

    Permissions

    Read Files
    Listed16 days ago

    What's inside

    Frequently Asked Questions

    This skill automates the technical identification of PII within your codebase, flagging specific LGPD violations like missing legal bases (Article 7) and data retention gaps that general security scanners often miss.

    The skill is language-agnostic and works by scanning SQL schemas, ORM migrations, logging configurations, and API route definitions across all major frameworks like Node.js, Python, and Java.

    A SKILL.md with an eight-step engineering review: personal-data inventory, legal bases (art. 7 and 11), consent, data subject rights (art. 18), retention, security and logs, third parties and international transfer (art. 33), incident readiness, and a prioritized report format. No scripts. It is free.

    While this skill provides a high-fidelity technical inventory and prioritizes fixes, it is designed to assist your DPO or legal counsel by providing the data they need; it does not constitute legal advice.

    Ask your agent for an LGPD review of the repository (or paste the schemas and handlers you care about). It starts with the personal-data inventory and ends with a prioritized fix list.

    New in Legal & Compliance