Security2026-06-12

[Security] Secure AI Development Strategy for SOC2/ISO27001 Compliant Companies: Preventing External Training on Sensitive Data


The "Generative AI Adoption vs. Governance" Dilemma Faced by Enterprises

With the utilization of LLMs led by ChatGPT, the automation of internal document summarization, customer support, and BPR (Business Process Re-engineering) is advancing rapidly. However, in corporate organizations with strict security policies (especially those that have obtained and maintain information security certifications like SOC2 Type II or ISO27001), there is a tendency to prohibit or severely restrict the introduction of AI tools due to the following concerns:

  1. Use of Input Data for Public Training: The risk that highly confidential contracts, source code, and personal information could be automatically incorporated into "public training data" for future model updates.
  2. Data Leakage and Lack of Logging: The risk that there will be no audit trail of what data employees input into the AI, providing a cover for unauthorized data exfiltration.
  3. Data Residency: The concern that data will be permanently stored on overseas servers, violating domestic regulations or customer contracts.

These challenges arise when using off-the-shelf consumer AI chatbots as-is. By properly deploying an enterprise-grade "Touchless AI System" in-house that meets these security requirements, companies can safely maximize the benefits of AI.


2. Before & After: Resolving the Challenges

Item Consumer AI Usage (Before) Secure Touchless AI Architecture (After)
API Data Training Concern that data entered via the web interface is used for training Guaranteed "no training" via OpenAI API / Google Vertex AI
Security Certifications Vendor certification scope is unclear Built exclusively on SOC2/ISO27001 compliant cloud infrastructure (Vercel, GCP)
Audit Logs Chat history can be deleted, making audits impossible Sent/received data, usage time, and user IDs are semi-permanently stored in Upstash/GCS
Sensitive Data Filtering Relies on user goodwill Proxy gateway detects and removes PII, credit card numbers, etc., before API transmission

3. Concrete Implementation Example: Data Protection and Filtering via API Gateway

Instead of calling the LLM API directly, passing requests through an internal relay gateway (like Vercel AI Gateway) allows for atomic management of data encryption, masking, and logging.

Example Middleware Code for Filtering Personally Identifiable Information (PII)

import { NextResponse } from "next/server";

// Simple regular expressions for personal information (email addresses, phone numbers, credit cards)
const EMAIL_REGEX = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g;
const PHONE_REGEX = /\b\d{2,4}-\d{2,4}-\d{4}\b/g;

function maskSensitiveData(text: string): string {
  let masked = text;
  masked = masked.replace(EMAIL_REGEX, "[REDACTED_EMAIL]");
  masked = masked.replace(PHONE_REGEX, "[REDACTED_PHONE]");
  return masked;
}

export async function POST(req: Request) {
  const { prompt, userId } = await req.json();

  // 1. Filter the outgoing message
  const safePrompt = maskSensitiveData(prompt);

  // 2. Record the audit log (e.g., to a secure internal audit DB or Upstash Redis)
  await recordAuditLog({
    userId,
    timestamp: new Date().toISOString(),
    originalLength: prompt.length,
    containsSensitiveData: prompt !== safePrompt,
  });

  // 3. Call the LLM API explicitly with the no-training option
  const llmResponse = await fetch("https://api.openai.com/v1/chat/completions", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${process.env.OPENAI_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      model: "gpt-4o",
      messages: [{ role: "user", content: safePrompt }],
      // As clearly stated in the API terms of service, data sent via the API is not used for training
    }),
  });

  const data = await llmResponse.json();
  return NextResponse.json({ result: data.choices[0].message.content });
}

async function recordAuditLog(logEntry: any) {
  // Logic to persist logs to GCS or Upstash Redis (SOC2 requirement)
  console.log("Audit Log Recorded:", JSON.stringify(logEntry));
}

4. HadayaLab's Security Policy and AI Support

All automation packages (AI-FDE) provided by HadayaLab strictly adhere to the following design philosophy to prevent the leakage of confidential customer data:

  • API-First Design: To prevent input data from being incorporated into training models, we always use an opt-out API connection or Google Cloud Vertex AI (dedicated tenant).
  • Encryption and Zero-Persistence: Sensitive data is encrypted in transit (HTTPS) and at rest (AES-256), and unnecessary temporary data is immediately destroyed after processing is complete.
  • Tamper-Proof Audit Logs: All AI decision-making steps are logged to Upstash Redis / Google Storage, making them auditable by administrators at any time.

If you are a security officer looking to maximize business automation while clearing compliance requirements, please contact us about HadayaLab's security-compliant design plans.

Get Your Free Workflow Audit