3.4 Cryptographic and data protection solutions
In this lesson you will:
- Choose the right posture tool (DSPM, CSPM, DLP or AI-SPM) for a given question.
- Design data loss prevention for AI that catches both obvious identifiers and sensitive meaning.
- Apply encryption at rest, in transit and in use, and explain what encryption cannot do for AI.
- Manage keys and secrets through their lifecycle, and choose who should hold the keys.
- Give AI systems and agents only the data access their purpose requires.
- Make AI data unrecoverable when storage is reused or a contract ends.
Opening case: the project that ended
Meridian's data science team ran an 18-month project on a cloud GPU platform to build a next-generation credit model. The project is cancelled. The CIO asks the security team to confirm that "all customer data has been removed" before the cloud account is closed next month.
The security team's first scan finds customer data in places nobody listed: 14 copies of the training dataset in object storage buckets (one of them readable by anyone with the link), customer records in 230 notebook files, a feature store, a vector database used for an experimental assistant, model checkpoints, and the local disks of GPU nodes. Six model provider API keys are hard-coded in notebooks.
The data was encrypted at rest using the provider's default keys. The team proposes to "delete the buckets and close the account".
By the end of this section you will be able to explain which tool should have found these copies, what to do about the API keys, and how to give the CIO a defensible answer that the data is unrecoverable.
Finding the data: DSPM and its neighbors
You cannot protect AI data you have not found. AI projects copy data into notebooks, buckets, feature stores, vector databases and fine-tuning jobs, often outside normal controls. Four tool categories help, and the exam may ask which one fits [10][11]. Figure 3.12 compares them.
| Tool | Question it answers | AI relevance |
|---|---|---|
| Data security posture management (DSPM) | Where is our sensitive data, who can access it, and is it exposed? | Discovers and classifies training sets, embeddings and copies across clouds; flags over-exposure |
| Cloud security posture management (CSPM) | Are our cloud resources configured securely? | Finds public buckets, open endpoints and over-permissive roles hosting AI workloads |
| Data loss prevention (DLP) | Is sensitive data leaving where it should not? | Inspects prompts, uploads and outputs in real time |
| AI security posture management (AI-SPM) | What AI assets do we have, and are they configured securely? | Inventories models, agents, endpoints and pipelines; flags risky configurations and exposed AI services |
In short: DSPM finds and classifies the data, CSPM checks the infrastructure, DLP stops data leaving, and AI-SPM covers the AI assets themselves. They complement each other. In the opening case, DSPM would have found the 14 dataset copies and the customer data in notebooks; CSPM would have flagged the publicly readable bucket; AI-SPM would have listed the experimental assistant and its vector database; secrets scanning would have caught the API keys.
DLP for AI inputs and outputs
DLP now has to watch new channels: what people type or paste into AI tools, files they upload, what models send back, and what agents send to external tools. Figure 3.13 shows DLP at an AI gateway, the proxy through which prompts and responses pass.
Two detection approaches are needed:
- Pattern-based detection (regular expressions, checksums, keywords, document fingerprints) is precise for structured identifiers such as card numbers, account numbers and national ID numbers, but misses meaning: a summary of a confidential acquisition contains no pattern.
- Semantic detection uses classifiers or models to recognize sensitive content by meaning, such as source code, legal advice, health information or merger terms. It catches paraphrased secrets but produces more false positives.
Worked example: what each approach catches
| What a Meridian employee pastes into an AI tool | Pattern DLP | Semantic DLP |
|---|---|---|
| "Customer 4111 1111 1111 1111 disputes a charge" | Catches (card number with valid checksum) | Probably catches |
| A paragraph summarizing the planned acquisition of a fintech, with no names | Misses | Catches (confidential deal content) |
| 200 lines of Meridian's payment-routing source code | Catches only if code is fingerprinted | Catches (source code) |
| "Mrs. Rao in Pune, who banks with us, has cancer and missed two payments" | Misses (no structured identifier) | Catches (health data about an identifiable person) |
Effective AI DLP combines both, enforced at three points: the AI gateway for sanctioned tools and agents; the endpoint or browser for public tools; and outputs before they leave the system. Actions range from a coaching warning, to redacting the sensitive part, to blocking the request. Because both approaches make errors, measure false positives and false negatives and tune over time.
Encryption: at rest, in transit and in use
- At rest: encrypt datasets, feature stores, vector databases, model weights, checkpoints and logs, typically with AES-256 through the platform's storage encryption.
- In transit: TLS 1.2 or higher (preferably 1.3) for all API calls, data transfers and service-to-service traffic, including inside training clusters where practical.
- In use: data must normally be decrypted to be computed on. Confidential computing (trusted execution environments) keeps it protected in memory from the infrastructure operator (section 2.5). Homomorphic encryption allows some computation on encrypted data, and secure multi-party computation lets parties compute jointly without revealing their inputs, but both are still too slow for most large-model workloads.
AI creates specific gaps that encryption alone does not close:
- data is decrypted into GPU memory and caches during training and inference;
- copies spread into notebooks and temporary files, often outside managed, encrypted storage;
- embeddings and logs are forgotten as sensitive stores;
- a model encrypted at rest can still leak its training data through its outputs.
Security lens. Encryption protects data in storage and on the wire. It does nothing about what a model reveals when it answers questions. Controls against memorization and extraction (section 3.3) are separate, and both are needed.
Keys and secrets
Keys and secrets (encryption keys, model provider API keys, vector database credentials, connector OAuth tokens, signing keys) follow a lifecycle, shown in Figure 3.14: generate, store, distribute, use, rotate, revoke and destroy.
Store them in a key management service (KMS) or hardware security module (HSM) and a secrets vault, never in code, notebooks or prompts. Issue them short-lived where possible, log their use, and rotate them on a schedule and immediately after suspected exposure. The six API keys in notebooks must be treated as exposed: revoke and replace them, check the provider's usage logs for misuse, and add secrets scanning to notebooks and repositories.
Key ownership models
For cloud and AI services, choose who holds the keys:
| Model | Who holds the key | Trade-off |
|---|---|---|
| Provider-managed keys | The provider generates and manages keys | Simplest; least customer control |
| Customer-managed keys (CMK) | The customer controls keys in the provider's KMS, including rotation and disabling | The customer can revoke access by disabling the key |
| Bring your own key (BYOK) | The customer generates keys and imports them | Control over key origin |
| Hold your own key (HYOK) / external key management | Keys stay outside the provider, in the customer's own HSM | Strongest control and sovereignty; more complexity and latency; some AI features may not work |
Meridian used provider-managed keys for the credit project, which matters for the next section: Meridian cannot destroy keys it never controlled.
Access to data used by AI
AI systems and agents should get only the data access their purpose requires [7]:
- Purpose-based access: data is released for a declared, approved purpose ("credit model training, project CR-22"), not to a person or system in general, and the grant ends with the purpose.
- Delegated access: an agent acting for a user accesses data with that user's permissions, not with a broad service account. This prevents the agent from becoming a way to read data the user could not see (Module 4 covers how).
- Restricted access: the most sensitive datasets are available only in controlled environments, such as clean rooms or secure enclaves, from which data cannot be exported.
Purpose-based access would also have solved part of the opening case: when the project was cancelled, the purpose ended, so the grants would have expired automatically.
Sanitizing AI storage
When storage is reused or retired, data must be made unrecoverable. NIST SP 800-88 defines three levels [15], shown in Figure 3.15.
- Clear: logical techniques such as overwriting, which protect against simple, non-invasive recovery. Suitable for reuse inside the organization at lower sensitivity.
- Purge: physical or logical techniques that make recovery infeasible even with laboratory methods, such as block erase or cryptographic erase. Suitable before media leaves organizational control.
- Destroy: physical destruction (shredding, disintegration, incineration) so media cannot be reused. For the highest sensitivity or failed media.
Cryptographic erase is especially useful in cloud and AI environments, where you cannot reach the physical disks: if all copies of the data were encrypted under a key, securely destroying every copy of that key makes the data unrecoverable. It works only if:
- the encryption was applied to all copies from the start, including backups and replicas;
- every copy of the key is truly destroyed, including backups and escrow;
- you control the key (customer-managed or held-your-own).
Sanitization must also cover AI-specific locations: model checkpoints, GPU node local disks, feature stores, vector databases, notebook storage and the caches of training clusters.
Worked example: a defensible answer for the CIO
| Location | Encrypted? | Meridian-controlled key? | Sanitization approach |
|---|---|---|---|
| Object storage (14 dataset copies) | Yes, provider-managed key | No | Delete; obtain the provider's written attestation of media sanitization under the contract; for the future, use CMK so crypto-erase is possible |
| Notebooks (230 files) | Yes, provider-managed | No | Delete; confirm no exports to laptops; same attestation |
| Feature store, vector database | Yes, provider-managed | No | Delete the services; attestation |
| Model checkpoints | Yes, provider-managed | No | Delete, or keep only if retained models are approved and logged |
| GPU node local disks | Ephemeral, provider-managed | No | Provider's sanitization of ephemeral storage; attestation |
| API keys in notebooks | n/a | n/a | Revoke and rotate; review usage logs |
The honest answer for the CIO is: "All copies we know of are deleted; our DSPM scan confirms no others remain; the provider attests to sanitization under the contract; and because we did not control the keys, we cannot independently prove cryptographic erasure. For future projects, we will use customer-managed keys so we can." That is a much stronger and more truthful position than "we deleted the buckets".
The opening case, resolved
- Which tool should have found the copies: DSPM finds and classifies sensitive data copies across the cloud; CSPM flags the public bucket; AI-SPM inventories the experimental assistant and its vector store; secrets scanning catches the keys. Running them throughout the project, not just at the end, would have kept the estate small and known.
- The API keys: treat as exposed. Revoke, rotate, review usage logs, and move all secrets to a vault.
- The defensible answer: delete every copy found by discovery, obtain the provider's sanitization attestation, and be clear that cryptographic erase was not possible because the keys were provider-managed. In future, use customer-managed keys for AI projects so that destroying the key is a verifiable purge, and use purpose-based access so grants end with the project.
Check your understanding
Try each before reading the reasoning.
1. Which tool BEST answers "which AI agents and model endpoints do we have, and are any exposed to the internet without authentication?"
Reasoning: AI-SPM, which inventories AI assets and checks their configuration. CSPM may catch some infrastructure misconfigurations, but it does not understand AI assets as such.
2. An organization encrypts all its training data at rest and in transit, and concludes its models cannot leak personal data. What is wrong?
Reasoning: encryption protects storage and transport, not what the model reveals. A model can memorize and reproduce training data in its outputs. Memorization controls (deduplication, DP, output filtering) are separate and still needed.
3. A company wants to be able to make its data in a cloud AI service unrecoverable at the end of the contract, without physical access to disks. What should it set up at the start?
Reasoning: customer-managed (or held-your-own) keys covering all copies, including backups, so that at exit it can perform cryptographic erase by destroying every copy of the keys, plus contractual sanitization attestation.
Key takeaways
- DSPM finds data, CSPM checks infrastructure, DLP stops data leaving, AI-SPM covers AI assets. Use them together and continuously.
- AI DLP needs pattern detection for identifiers and semantic detection for meaning, at the gateway, the endpoint and the output.
- Encrypt at rest and in transit; confidential computing protects data in use from the operator. Encryption does not stop a model revealing what it learned.
- Keep keys and secrets in a KMS, HSM or vault, never in notebooks or prompts. Rotate immediately on exposure. Customer-managed keys let you revoke access and crypto-erase.
- Grant AI data by purpose, delegate user permissions to agents, and keep the most sensitive data in controlled environments.
- Clear, purge, destroy. Cryptographic erase works only if every copy was encrypted and every copy of a key you control is destroyed.