# Software Security, Anti-Piracy, Seat-Lock & Anti-LLM Extraction Policy # سياسة حماية البرمجيات ومنع القرصنة وقفل الأجهزة ومكافحة الاستنساخ بالذكاء الاصطناعي **Applies To:** All 20 HQ Team Iraq commercial software systems (`systems/01-*` through `systems/20-*`) and `core_foundation/` (`hqt_core` + `native_lock_rs`). --- ## 1. Layered Technical Defense Summary | Defense Layer | Concrete Implementation (`core_foundation/`) | Threat Mitigated | |---|---|---| | **L1: Limited-Computer Hardware Seat Lock (`1–3` PCs)** | `hqt_core/seat_lock.py` & `native_lock_rs` (`MIN_SEATS=1`, `MAX_SEATS=3`): derives salted SHA-256 hashes from 5 host signals (`cpu_id`, `board_uuid`, `nvme_serial`, `mac_hash`, `tpm_ek_hash`) requiring **`>= 3/5` matching quorum**; supports signed `SEAT_REVOCATION_V1` receipts for hardware upgrades | Prevents USB-free mass copying or cloned SSD/VM deployment onto unauthorized 4th+ workstations while surviving 1–2 routine part swaps | | **L2: Asymmetric Ed25519 Offline/Online Leases + Clock Guard** | Offline lease tokens signed by HQ Team's offline **Ed25519** private key (`cryptography` + pure-Rust RFC 8032 in `native_lock_rs`) with embedded `issued_utc_s`, `expires_utc_s`, and `max_seats`; paired with **multi-anchor SQLite WAL clock-rollback detection** (`MultiAnchorClockVerifier`) across >=2 stores | Blocks keygen creation, license JSON tampering, trial/lease clock rollback, and single-file DB backup restoration attacks | | **L3: Native Compiled Core & Anti-Decompilation** | Sensitive licensing, FX rounding, and security checks reside in compiled native Rust (`native_lock_rs` built with `lto="fat"`, `strip="symbols"`, `panic="abort"`) / Nuitka AOT modules verified via **Ed25519 SHA-256 self-digest manifests** (`hqt_core/integrity.py`) | Eliminates trivial plaintext `.py` / `.NET` IL inspection and detects binary patching or DLL/SO substitution at startup | | **L4: Server-Enforced Split Entitlements** | Cloud sync (`hlc_sync.py`), WhatsApp/Telegram relays, and payment webhooks (`iraq_pay.py`) independently re-validate signed tenant/seat claims server-side (`HTTP 403` on revoked/over-seat tokens) | Prevents local memory-patching from unlocking paid cloud/multi-branch services | | **L5: Anti-LLM Copying & Extraction Firewall** | `hqt_core/anti_llm_guard.py` (`scan_bundle_or_payload`) runs in CI and API middleware to block raw SQL DDL (`CREATE TABLE`), system prompt strings (`` / `AGENT_STARTER_PROMPT`), JS source maps (`sourceMappingURL`), host stack traces, and unpaginated bulk dumps (`>100` rows), plus HMAC `_hqt_wm` export watermarks | Stops automated competitor scraping, client-bundle architecture reverse engineering, and LLM prompt/schema extraction | --- ## 2. Operational & Ethical Boundaries - **Zero Destructive Logic:** License failures cleanly lock write/checkout actions and display a bilingual recovery prompt (`Renew Lease / Rebind Seat`) — **never** deleting, corrupting, or holding customer accounting/patient databases hostage. - **No Proprietary Hardware Dongles:** Unlike legacy Iraqi USB dongles (`dongleproxy`), HQ Team enforces software-cryptographic `3/5` hardware binding so merchants never suffer production downtime from broken/stolen USB dongles. - **Zero Offensive / Evasive Techniques:** Anti-tamper verification runs strictly within sanctioned application process boundaries without kernel rootkits or unauthorized system modification.