Skip to content
zanex-devPublic

About

End-to-End AES-256-GCM OpenAI Inference Bridge & Ephemeral Ciphertext Mailbox for Untrusted Cloud GPUs (Codename: Kiss-Shot)

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Kiss-Shot (姬丝秀忒) — Zero-Trust GPU Inference Protocol

Kiss-Shot (姬丝秀忒)

Zero-Trust End-to-End Encrypted (AES-256-GCM) OpenAI Inference Bridge & Ephemeral Ciphertext Mailbox for Remote GPUs.

CI Version v1.3.0 License: PolyForm Noncommercial 1.0.0 Python 3.10+ Codename

English · 简体中文 · Changelog


When renting cloud GPUs on shared or third-party infrastructure (RunPod, Vast.ai, Lambda, AutoDL, or remote Jupyter pods), standard HTTPS ingress proxies terminate TLS at the provider's edge—exposing plaintext prompts, proprietary system instructions, multimodal images, and generated media to edge gateways, reverse-proxy logs, and shared disks.

kiss-shot (Codename: Kiss-Shot / 姬丝秀忒) establishes an application-layer zero-trust cryptographic bond directly from 127.0.0.1 on your local workstation into the remote GPU process memory:

  1. Streaming OpenAI-Compatible AEAD Bridge: Exposes a standard http://127.0.0.1:18443/v1 endpoint locally (drop-in for the OpenAI SDK, LangChain, Cursor, Continue, OpenWebUI, or SillyTavern) while sealing every request and streaming SSE token chunk with PBKDF2-HMAC-SHA256 (210,000 iterations) + AES-256-GCM, strict domain-separated AADs (AAD_PAYLOAD, AAD_TICKET, AAD_BLOB, AAD_ARCHIVE), and 24-hour authenticated TTL envelopes.
  2. Dynamic Ephemeral Routing, Anti-Replay & SSRF Allowlist: Each remote gateway session generates a fresh random route (/v1/ks-<random>) and 128-bit session salt embedded inside an authenticated KISSSHOT_TICKET:... handshake string, backed by a ±300s clock check, a bounded request-ID replay filter (ReplayGuard), BoundedSemaphore concurrency control, and strict upstream path allowlisting (/v1/*, /health). Unauthenticated probes immediately receive 403 Forbidden.
  3. Stream Integrity & Truncation Detection: Streaming SSE chunks bind monotonic sequence numbers (kissshot-s2c:<req_id>:<seq>) and an authenticated termination tag (EOF:...) into GCM Additional Authenticated Data (AAD), defeating chunk reordering, injection, and silent middlebox truncation.
  4. Transactional Ciphertext Queue v2 & Zero-WebUI Local Visual Studio: For asynchronous Image/Video workloads (MOSS-Image-SFT, SDXL, FLUX.1, Wan 2.1/2.2 T2V & I2V, Wan 2.2 TI2V-5B, HunyuanVideo-1.5), the local desktop console provides an offline Inpainting brush mask painter, a centered-origin MOSS spatial BBox composer, dynamic LoRA strength controls, a SQLite WAL encrypted job ledger & outbox (.kissshot_jobs.sqlite3), and a DPAPI / POSIX 0600 encrypted recipe gallery. Jobs are dispatched atomically to _queue/v2/ under AAD_QUEUE (with hf_token stripped from queue payloads and parent_commit CAS retry), claimed by remote workers via _claims/<job_id>.json lease heartbeats, inferred purely in memory (BytesIO / /dev/shm) from pinned per-repo commit SHAs with executable-file stripping and approved SHA-256-verified custom code, packed into a 256-bit WinZip AES (WZ_AES, ZIP_STORED zero-compression + obfuscated inner filenames) archive wrapped inside an outer AES-256-GCM (AAD_ARCHIVE) envelope, atomically committed alongside _receipts/<job_id>.json, downloaded under revision-locked blob_id verification with idempotent packet_id unpacking, and conditionally burned only after verified local decryption.
  5. Local Workstation, Supply-Chain & Daemon Hardening: Protects local passphrases/tokens at rest via Windows DPAPI (CryptProtectData) or POSIX 0600 owner-only vaults, enforces X-KissShot-Admin-Token IPC authentication, blocks browser DNS Rebinding (Host) and Sec-Fetch-Site: cross-site attacks, sanitizes response MIME headers (X-Content-Type-Options: nosniff), enforces single-profile SillyTavern binding with pre-edit backups, applies optional runtime dependency lock verification (runtime_lock.py, strict=False compatibility default) and engine binary SHA-256 checks (verified_engine), selectively scrubs only KISSSHOT_-related IPython history rows without wiping unrelated work, and marks copied secrets as excluded from Windows Clipboard History & Cloud Sync with automatic timer scrubbing.

Architecture

flowchart LR
    subgraph Workstation["Local Workstation (Trusted)"]
        Client["OpenAI SDK / WebUI / CLI"]
        LocalBridge["kiss-shot (127.0.0.1:18443/v1)"]
        Client -->|"Plaintext HTTP (Loopback)"| LocalBridge
    end

    subgraph UntrustedNet["Edge Proxy / Public Network (Untrusted)"]
        Edge["Cloud Ingress / Reverse Proxy"]
    end

    subgraph GPUHost["Remote GPU Container"]
        RemoteGW["RemoteAEADGateway (:8081 /v1/ks-random)"]
        Engine["llama-server / vLLM / Ollama (127.0.0.1:8080)"]
        RemoteGW -->|"Decrypted Loopback"| Engine
    end

    LocalBridge <-->|"High-Entropy AES-256-GCM + Seq AAD"| Edge
    Edge <-->|"Opaque Binary / Encrypted SSE"| RemoteGW
Loading

Threat Model

Threat Vector Standard HTTPS Proxy / Tunnel kiss-shot
Edge TLS termination inspecting prompts / Vision images Exposed at edge proxy Protected (AES-256-GCM sealed on 127.0.0.1 before egress)
Public URL / port scanners probing inference endpoints Exposes /v1/models & API fingerprint Protected (random dynamic route + 403 Forbidden on unauthenticated bytes)
Replay of captured encrypted HTTP requests Vulnerable without app-layer nonces Protected (±300s clock check + bounded ReplayGuard request-ID filter)
SSE stream chunk reordering or premature truncation Undetected partial output Protected (per-chunk seq in AAD + mandatory authenticated EOF tag)
Shared cloud disk retaining batch images/videos Plaintext files on container disk Protected (BytesIO / /dev/shm + outer AES-256-GCM + inner WZ_AES ZIP_STORED + burn-after-reading)
Cross-context ciphertext grafting / ZIP bomb archive Unchecked archive headers & compression Protected (domain-separated AADs, 24h TTL, ZIP_DEFLATED rejection & 2 GiB streaming cap)
Malicious browser tab probing 127.0.0.1 (DNS Rebinding / XSS) Wildcard CORS or unauthenticated loopback Protected (strict Host & Sec-Fetch-Site guard, X-KissShot-Admin-Token IPC, nosniff sanitization)
Plaintext credentials on disk or Cloud Clipboard sync Cleartext JSON & persistent clipboard history Protected (Windows DPAPI / POSIX 0600 vault + cloud-clipboard exclusion & auto-scrub)

Scope Note: Application-layer E2EE protects data in transit across untrusted networks/proxies and avoids plaintext persistence on remote storage. Once decrypted inside the remote GPU process for matrix multiplication, a malicious host hypervisor with raw physical RAM/VRAM dump access remains outside the boundary of software-only encryption (require hardware confidential computing / H100 TEE for host-memory isolation).


Quick Start

1. Installation

git clone https://github.com/zanex-dev/kiss-shot.git
cd kiss-shot
pip install -r requirements.txt
pip install -e .

2. Streaming OpenAI E2EE Bridge (CLI or GUI)

On the remote GPU server (where vLLM, llama-server, or Ollama is listening on 127.0.0.1:8080):

kiss-shot remote-gateway \
  --public-url https://your-pod-8081.proxy.example.com \
  --listen-port 8081 \
  --upstream http://127.0.0.1:8080

Enter your session passphrase when prompted, then copy the printed KISSSHOT_TICKET:... line.

On your local workstation:

# Option A: Launch the cross-platform desktop GUI console (closes to Windows system tray to keep bridge alive)
kiss-shot panel
kiss-shot panel --minimized   # Optional: start directly in the Windows system tray
kiss-shot shortcut            # Optional (Windows): register Start Menu & Taskbar-pinnable app shortcut

# Option B: Run the headless CLI OpenAI proxy (auto-detects KISSSHOT_TICKET from clipboard)
kiss-shot bridge --port 18443

Point any OpenAI-compatible client to http://127.0.0.1:18443/v1:

from openai import OpenAI

client = OpenAI(base_url="http://127.0.0.1:18443/v1", api_key="kissshot-local")
stream = client.chat.completions.create(
    model="kiss-shot-llm",
    messages=[{"role": "user", "content": "Explain authenticated encryption with associated data."}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

3. Remote Jupyter Notebook Templates

For interactive cloud GPU environments, ready-to-run templates are provided under notebooks/:


Verification & Test Suite

Run the full cryptographic, live HTTP/SSE loopback E2EE, anti-replay, truncation-detection, and repository hygiene test suite:

python -m unittest discover -s tests -v

License

Licensed under the PolyForm Noncommercial License 1.0.0 (PolyForm-Noncommercial-1.0.0) — free for personal, educational, and noncommercial use; commercial use, paid SaaS, bundling, or resale of the code or assets/ artwork is strictly prohibited without prior written authorization from zanex-dev.

Required Notice: Copyright (c) 2026 zanex (zanex-dev) (https://github.com/zanex-dev/kiss-shot)

About

End-to-End AES-256-GCM OpenAI Inference Bridge & Ephemeral Ciphertext Mailbox for Untrusted Cloud GPUs (Codename: Kiss-Shot)

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages