<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE rfc>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude"
     docName="draft-sibiryakov-ztds-protocol-02"
     category="info"
     ipr="trust200902"
     submissionType="independent"
     xml:lang="en"
     version="3">

  <front>
    <title abbrev="ZTDS Protocol">The Zero-Trust Data Sanitization (ZTDS) Protocol for Frontier Artificial Intelligence Ingestion</title>
    <seriesInfo name="Internet-Draft" value="draft-sibiryakov-ztds-protocol-02"/>
    
    <author fullname="Ilya Sibiryakov" initials="I." surname="Sibiryakov">
      <organization>ZTDS AI Consortium / BrandMeWeb</organization>
      <address>
        <email>ilya@brandmeweb.com</email>
        <uri>https://ztds.ai</uri>
      </address>
    </author>

    <date year="2026" month="September" day="27"/>
    <area>Security</area>
    <workgroup>Independent Submission</workgroup>

    <keyword>zero-trust</keyword>
    <keyword>data sanitization</keyword>
    <keyword>large language models</keyword>
    <keyword>generative ai</keyword>
    <keyword>in-memory privacy</keyword>
    <keyword>pii de-identification</keyword>
    <keyword>gdpr</keyword>
    <keyword>hipaa</keyword>

    <abstract>
      <t>
        Zero-Trust Data Sanitization (ZTDS) defines a formal architectural standard and execution protocol for client-side, in-memory de-identification and re-identification across Generative Artificial Intelligence (GenAI), Retrieval-Augmented Generation (RAG), and autonomous agent workflows.
      </t>
      <t>
        Under ZTDS, sensitive information (including Personally Identifiable Information (PII), Protected Health Information (PHI), financial account numbers, and developer secrets) is intercepted and transformed into synthetic surrogate tokens strictly within volatile memory (RAM) of the originating client or private host node before network serialization.
      </t>
      <t>
        This protocol specification formalizes the threat model, the four core invariants, surrogate token syntaxes, cryptographic transport handoffs, and verification procedures required for interoperable, zero-subprocessor implementations.
      </t>
    </abstract>
  </front>

  <middle>
    <section anchor="intro">
      <name>Introduction</name>
      <t>
        The proliferation of Generative Artificial Intelligence (GenAI) and Large Language Model (LLM) APIs has created severe data exposure risks. Organizations transmitting unmasked corporate documents, healthcare records, source code, and customer communications over the Public Internet risk compromising sensitive information during model training, telemetry harvesting, or third-party cloud breaches.
      </t>
      <t>
        Prior approaches have relied on two predominant architectures, each with critical shortcomings:
      </t>
      <ol>
        <li>
          <t><strong>Network Gateways and Total Blockades:</strong> Prohibiting corporate AI access entirely. This strategy induces widespread employee circumvention ("Shadow AI"), leading to uncontrolled cleartext data exposure.</t>
        </li>
        <li>
          <t><strong>Cloud-Based Data Loss Prevention (Cloud DLP) Proxies:</strong> Intercepting and inspecting WAN traffic via intermediate multi-tenant cloud services. This introduces significant network round-trip latencies (typically 150ms to 350ms, as empirically measured in <xref target="ZTDS-LATENCY"/>), establishes a single point of data compromise, and introduces an additional Data Processor under European Union General Data Protection Regulation (GDPR) Article 28, mandating cumbersome Data Processing Agreements (DPAs).</t>
        </li>
      </ol>
      <t>
        The Zero-Trust Data Sanitization (ZTDS) protocol shifts the security perimeter directly into volatile memory (RAM) of the local execution context. No sensitive data may be serialized into network sockets prior to mathematical de-identification. This document specifies the normative requirements for conformant ZTDS implementations.
      </t>
    </section>

    <section anchor="terminology">
      <name>Conventions and Terminology</name>
      <t>
        The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they appear in all capitals, as shown here.
      </t>
      <dl>
        <dt>Cleartext Entity (S):</dt>
        <dd>A sensitive substring matching regulatory or organizational classification rules (e.g., patient name, credit card number, API secret).</dd>
        
        <dt>Surrogate Token (M):</dt>
        <dd>A structured, synthetic replacement token preserving semantic and syntactic properties without revealing cleartext.</dd>
        
        <dt>Session Mapping Dictionary (R):</dt>
        <dd>An ephemeral table linking surrogate tokens to cleartext entities, held exclusively in volatile memory.</dd>
        
        <dt>Airplane Mode Standard:</dt>
        <dd>An empirical test confirming that sanitization and inverse restoration execute with zero network packets emitted across all interfaces.</dd>
      </dl>
    </section>

    <section anchor="threat-model">
      <name>Threat Model and Assumptions</name>
      <t>
        The ZTDS threat model operates under the following security assumptions:
      </t>
      <ul>
        <li>
          <t><strong>Untrusted Transport:</strong> The Wide Area Network (WAN) and all intermediary proxy servers are assumed to be monitored or subject to lawful/unlawful interception.</t>
        </li>
        <li>
          <t><strong>Untrusted Remote Model:</strong> The upstream AI model provider (e.g., public LLM API endpoint) is treated as an untrusted third party that MUST NOT receive cleartext sensitive data, preventing training set ingestion or prompt logging.</t>
        </li>
        <li>
          <t><strong>Semi-Trusted Host Application:</strong> The host execution environment (e.g., browser tab, container, or IDE process) is trusted for local volatile execution, but secondary storage (disk, browser databases, unencrypted telemetry caches) is treated as an insecure persistent boundary.</t>
        </li>
      </ul>
      <t>
        The primary objective of ZTDS is guaranteeing:
      </t>
      <artwork align="center">
Egress(S) == 0 bytes
      </artwork>
      <t>
        Where S represents the set of all sensitive entities detected within an input prompt or payload.
      </t>
    </section>

    <section anchor="math-spec">
      <name>Mathematical Specification of Protocol</name>
      <t>
        Let an input prompt or agent payload P be a sequence of tokens composed of non-sensitive tokens U and sensitive tokens S:
      </t>
      <artwork align="center">
P = U union S, where U intersect S = empty_set
      </artwork>
      <t>
        Where S = {s_1, s_2, ..., s_k} represents discrete sensitive entity instances.
      </t>
      <t>
        A conformant ZTDS transformation T operates locally as follows:
      </t>
      <ol>
        <li>
          <t>An in-memory transformation T: S -&gt; M is computed locally:
          M = {m_1, m_2, ..., m_k}, where each m_i is a structured surrogate token.</t>
        </li>
        <li>
          <t>The ephemeral reverse dictionary R = {(m_i, s_i)} is allocated strictly in volatile RAM scoped to the active execution context.</t>
        </li>
        <li>
          <t>The payload serialized and dispatched over the network contains strictly U union M.</t>
        </li>
        <li>
          <t>Upon receipt of the AI inference response P_out containing surrogate tokens M, the local inverse transformation T^(-1): M -&gt; S restores the cleartext entities exclusively on the local presentation layer:
          P_final = T^(-1)(P_out, R).</t>
        </li>
        <li>
          <t>Upon process termination or session destruction, R MUST be purged from memory.</t>
        </li>
      </ol>
    </section>

    <section anchor="invariants">
      <name>The Four Protocol Invariants</name>
      <t>
        Every compliant implementation of the ZTDS protocol MUST satisfy four normative invariants, with formal mathematical proofs detailed in <xref target="ZTDS-PROOF"/>:
      </t>

      <section anchor="inv-1">
        <name>Invariant 1: Volatile Memory Boundary (RAM-Only Isolation)</name>
        <t>
          Under no circumstances SHALL cleartext entity values S or mapping pairs R be persisted to secondary storage. Implementations MUST NOT write session mapping state to:
        </t>
        <ul>
          <li><t>Browser storage subsystems: localStorage, sessionStorage, IndexedDB, document.cookie.</t></li>
          <li><t>Host non-volatile storage: temporary files, swap space, disk caches, or crash log dumps.</t></li>
          <li><t>Application logging frameworks: debug logs, operational analytics, or tracing pipelines.</t></li>
        </ul>
        <t>
          In multi-threaded or browser environments, mapping dictionaries MUST be strictly process-isolated or tabId-scoped to prevent cross-session leakage.
        </t>
      </section>

      <section anchor="inv-2">
        <name>Invariant 2: Deterministic Reversible Tokenization</name>
        <t>
          Surrogate tokens MUST preserve the syntactic category and semantic spacing of the original entity to prevent LLM reasoning degradation. The transformation MUST guarantee:
        </t>
        <artwork align="center">
T^(-1)( T(S) ) == S
        </artwork>
        <t>
          The sanitization engine MUST execute with a deterministic latency bound: Latency(T) &lt; 2.0 ms for standard payloads up to 15,000 characters on standard computing architectures.
        </t>
      </section>

      <section anchor="inv-3">
        <name>Invariant 3: Zero Outgoing Network Transmission (Airplane Mode Standard)</name>
        <t>
          The sanitization and de-tokenization mechanisms MUST be completely self-contained within local runtime code. Implementations MUST be verifiable via the 5-step Airplane Mode Audit:
        </t>
        <ol>
          <li><t>Ingest sensitive payload into application memory.</t></li>
          <li><t>Sever all physical and virtual network interfaces.</t></li>
          <li><t>Execute sanitization transformation T.</t></li>
          <li><t>Execute reverse re-identification transformation T^(-1).</t></li>
          <li><t>Confirm 100% functional execution with 0 socket errors and 0 bytes egressed.</t></li>
        </ol>
      </section>

      <section anchor="inv-4">
        <name>Invariant 4: Zero Sub-Processor Chain</name>
        <t>
          The sanitization engine MUST operate as a pure computational utility on the host device. It MUST NOT transmit telemetry, telemetry pings, entity frequencies, or usage metrics to external collection servers. This exclusion relieves the deployment from third-party Data Processing Agreements under European Union GDPR Article 28.
        </t>
      </section>
    </section>

    <section anchor="taxonomy">
      <name>Surrogate Token Taxonomy</name>
      <t>
        Surrogate tokens follow standardized bracketed notation to ensure cross-vendor compatibility:
      </t>
      <table anchor="token-table">
        <name>Standardized Surrogate Token Notation</name>
        <thead>
          <tr>
            <th>Entity Class</th>
            <th>Canonical Token Syntax</th>
            <th>Example Transformation</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>Personal Name</td>
            <td><tt>[NAME_N]</tt></td>
            <td>John Doe -&gt; <tt>[NAME_1]</tt></td>
          </tr>
          <tr>
            <td>Email Address</td>
            <td><tt>[EMAIL_N]</tt></td>
            <td>john@example.com -&gt; <tt>[EMAIL_1]</tt></td>
          </tr>
          <tr>
            <td>Phone Number</td>
            <td><tt>[PHONE_N]</tt></td>
            <td>+1-555-0199 -&gt; <tt>[PHONE_1]</tt></td>
          </tr>
          <tr>
            <td>National ID / SSN</td>
            <td><tt>[ID_N]</tt> / <tt>[SSN_N]</tt></td>
            <td>123-45-6789 -&gt; <tt>[SSN_1]</tt></td>
          </tr>
          <tr>
            <td>Financial / IBAN</td>
            <td><tt>[IBAN_N]</tt> / <tt>[CARD_N]</tt></td>
            <td>GB29XAAA... -&gt; <tt>[IBAN_1]</tt></td>
          </tr>
          <tr>
            <td>Protected Health / PHI</td>
            <td><tt>[MRN_N]</tt> / <tt>[PATIENT_N]</tt></td>
            <td>MRN-90123 -&gt; <tt>[MRN_1]</tt></td>
          </tr>
          <tr>
            <td>Developer Secrets</td>
            <td><tt>[SECRET_KEY_N]</tt></td>
            <td>sk-ant-... -&gt; <tt>[SECRET_KEY_1]</tt></td>
          </tr>
          <tr>
            <td>IP / Host Address</td>
            <td><tt>[IP_ADDR_N]</tt></td>
            <td>192.0.2.1 -&gt; <tt>[IP_ADDR_1]</tt></td>
          </tr>
        </tbody>
      </table>
    </section>

    <section anchor="crypto-handoff">
      <name>Cryptographic Transport Handoff</name>
      <t>
        When collaborative agent swarms or multi-node enterprise pipelines require transferring mapping state across trust boundaries, mapping dictionaries MUST be encrypted prior to transit:
      </t>
      <ul>
        <li>
          <t><strong>Key Derivation:</strong> Argon2id as specified in <xref target="RFC9106"/> with a minimum of 19 MiB memory cost and 2 iterations.</t>
        </li>
        <li>
          <t><strong>Authenticated Symmetric Encryption:</strong> XChaCha20-Poly1305 with a 24-byte (192-bit) cryptographically secure random nonce generated via a CSPRNG, conforming to <xref target="RFC8439"/> principles.</t>
        </li>
        <li>
          <t><strong>Zero Relay Custody:</strong> Coordination relays act exclusively as blind encrypted conduits with zero mathematical capability to derive keys or inspect mapping pairs.</t>
        </li>
      </ul>
    </section>

    <section anchor="conformance">
      <name>Conformance Attestation Architecture</name>
      <t>
        Conformant implementations MAY generate cryptographically signed Conformance Certificates:
      </t>
      <artwork align="center">
ZTDS-CERT-v1.{payload_b64url}.{signature_b64url}
      </artwork>
      <t>
        Signatures are generated using Ed25519 as specified in <xref target="RFC8032"/>. The payload encompasses a canonicalized JSON structure containing the SHA-256 tree hash of the audited source code, invariant evaluation statuses, and a 365-day validity window.
      </t>
    </section>

    <section anchor="iana">
      <name>IANA Considerations</name>
      <t>
        This document has no IANA actions.
      </t>
    </section>

    <section anchor="security">
      <name>Security Considerations</name>
      <section anchor="sec-side-channels">
        <name>Memory Dumps and Side-Channel Attacks</name>
        <t>
          While ZTDS eliminates WAN exposure, local volatile memory remains vulnerable to process inspection if the underlying operating system is compromised. Implementations deployed in high-assurance environments SHOULD utilize hardware-isolated secure enclaves (e.g., AWS Nitro Enclaves or hardware WebAssembly sandboxes) to prevent OS kernel memory dumps from harvesting ephemeral mapping tables.
        </t>
      </section>

      <section anchor="sec-prompt-injection">
        <name>Adversarial Prompt Injection</name>
        <t>
          Adversarial prompts designed to trick the LLM into printing mapping dictionaries are mitigated by the architecture: the remote LLM NEVER receives the mapping dictionary R. It only observes surrogate tokens [TYPE_N] as atomic entities.
        </t>
      </section>

      <section anchor="sec-entropy">
        <name>Surrogate Collision and Entropy</name>
        <t>
          Surrogate token assignment MUST be deterministic within a given session to ensure co-reference resolution (e.g., the same person mentioned five times receives the identical [NAME_1] surrogate across all mentions), while maintaining fresh indexing per session.
        </t>
      </section>
    </section>

    <section anchor="privacy">
      <name>Privacy and Regulatory Considerations</name>
      <t>
        By eliminating intermediate data processors, ZTDS satisfies European Union GDPR Article 28 exemption requirements, Article 17 Right to be Forgotten within vector databases (embeddings contain zero extractable cleartext PII), and HIPAA 45 CFR Section 164.514(b) Safe Harbor de-identification rules, as analyzed in <xref target="ZTDS-LEGAL"/>.
      </t>
    </section>
  </middle>

  <back>
    <references>
      <name>References</name>
      
      <references>
        <name>Normative References</name>
        
        <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119">
          <front>
            <title>Key words for use in RFCs to Indicate Requirement Levels</title>
            <author fullname="S. Bradner" initials="S." surname="Bradner"/>
            <date month="March" year="1997"/>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="2119"/>
        </reference>

        <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174">
          <front>
            <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
            <author fullname="B. Leiba" initials="B." surname="Leiba"/>
            <date month="May" year="2017"/>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="8174"/>
        </reference>

        <reference anchor="RFC8032" target="https://www.rfc-editor.org/info/rfc8032">
          <front>
            <title>Edwards-Curve Digital Signature Algorithm (EdDSA)</title>
            <author fullname="S. Josefsson" initials="S." surname="Josefsson"/>
            <author fullname="I. Liusvaara" initials="I." surname="Liusvaara"/>
            <date month="January" year="2017"/>
          </front>
          <seriesInfo name="RFC" value="8032"/>
        </reference>

        <reference anchor="RFC8439" target="https://www.rfc-editor.org/info/rfc8439">
          <front>
            <title>ChaCha20 and Poly1305 for IETF Protocols</title>
            <author fullname="Y. Nir" initials="Y." surname="Nir"/>
            <author fullname="A. Langley" initials="A." surname="Langley"/>
            <date month="June" year="2018"/>
          </front>
          <seriesInfo name="RFC" value="8439"/>
        </reference>

        <reference anchor="RFC9106" target="https://www.rfc-editor.org/info/rfc9106">
          <front>
            <title>Argon2 Memory-Hard Function for Password Hashing and Proof-of-Work Applications</title>
            <author fullname="A. Biryukov" initials="A." surname="Biryukov"/>
            <author fullname="D. Dinu" initials="D." surname="Dinu"/>
            <author fullname="D. Khovratovich" initials="D." surname="Khovratovich"/>
            <author fullname="S. Kiviharju" initials="S." surname="Kiviharju"/>
            <date month="September" year="2021"/>
          </front>
          <seriesInfo name="RFC" value="9106"/>
        </reference>
      </references>

      <references>
        <name>Informative References</name>
        
        <reference anchor="ZTDS-PROOF" target="https://doi.org/10.5281/zenodo.22058770">
          <front>
            <title>Zero-Trust Data Sanitization (ZTDS): Mathematical Proof and Operational Framework for Client-Side AI Prompt Privacy</title>
            <author fullname="Ilya Sibiryakov" initials="I." surname="Sibiryakov"/>
            <date year="2026"/>
          </front>
          <seriesInfo name="DOI" value="10.5281/zenodo.22058770"/>
        </reference>

        <reference anchor="ZTDS-LATENCY" target="https://doi.org/10.17605/OSF.IO/5BYJF">
          <front>
            <title>Empirical Latency Benchmark: In-Memory Client RAM Masking vs. Cloud DLP Proxies</title>
            <author fullname="Ilya Sibiryakov" initials="I." surname="Sibiryakov"/>
            <date year="2026"/>
          </front>
          <seriesInfo name="DOI" value="10.17605/OSF.IO/5BYJF"/>
        </reference>

        <reference anchor="ZTDS-LEGAL" target="https://papers.ssrn.com/sol3/papers.cfm?abstract_id=7335581">
          <front>
            <title>Enterprise Compliance Under the EU AI Act and UK GDPR via Ephemeral Client-Side Sanitization</title>
            <author fullname="Ilya Sibiryakov" initials="I." surname="Sibiryakov"/>
            <date year="2026"/>
          </front>
          <seriesInfo name="SSRN" value="7335581"/>
        </reference>
      </references>
    </references>
  </back>
</rfc>
