Zeal device enforcement — release 1.31 (2026-10-14)
=================================================

Scope and trust
--------------
The account origin on MS-02 makes every decision. Psychz game servers keep
hosting Ranked lobbies; no hardware reports, hashing key or account database
are shipped to those hosts or to players. A signed report binds claims to the
IW4x key/GUID and challenge. It does NOT attest that a modified client reported
real hardware, prevent key theft, or replace anti-cheat and human moderation.

The user-mode Windows collector runs on a worker when Register/Ranked is used,
and caches its hashed report for that game process. No elevation, kernel
driver, file scanning or persistent hardware cache is installed. Restart the
game after a hardware change. Windows 10/11 is the supported client target;
Wine and VMs may expose insufficient identifiers and need a reviewed exception.

Signals and policy
------------------
* Firmware: motherboard serial, system serial, SMBIOS UUID. All count as ONE
  family, regardless of how many fields agree.
* Storage: up to eight fixed internal physical drive serials, one family.
* Memory: up to eight physical memory-module serials, one family.
* CPU models/ProcessorId, GPU models, MAC addresses and IPs are not hardware
  identity evidence. Empty, repeated-character and common OEM placeholder
  values are ignored. USB/removable storage is excluded.

When staff permanently restrict Ranked, freeze that account's observed device
profiles from the last 90 days. Compare each candidate profile against each
frozen profile independently; never add separate matches from different
profiles or accounts to reach a stronger decision.

Two or three matching families: Ranked blocked, appeal through staff.
One matching family: review flag for staff; Ranked remains allowed.
Fewer than two usable families, even no identifiers: review flag; Ranked remains allowed.
Two or more usable families and no match: normal Ranked access.
No current device proof: update/restart the client and reopen Ranked.

Changing the SSD alone does not evade a profile with firmware and memory
evidence. Changing all identifiers or lying through a modified client remains
possible. This is an additional moderation layer, not a ban-evasion guarantee.
An unrelated/shared PC can still need review; never infer cheating from the
hardware match alone. No account is automatically permanently banned merely
because it matched another account. Post-ban reports cannot expand a frozen
ban snapshot. Releasing or replacing the permanent restriction retires it.

Staff operation
---------------
Sign in using Register, then open Staff dashboard on zeal.family. The Players
search filters both player and device-review lists. Choose a reviewed player,
select Approve current device review, enter a reason, and apply. Admin/owner
roles are required; normal role hierarchy and CSRF checks remain enforced.
The dashboard displays families/matching banned usernames, never serials or
component hashes. Permanent Ranked restrictions capture device evidence;
voice/social restrictions and temporary Ranked restrictions do not.

An approval is bound to the account, exact current profile and current
matching ban evidence. It expires after 90 days, becomes invalid with changed
evidence, and can be revoked from the dashboard. A stale review form is
rejected. An approval never overrides a direct account restriction. Staff
cannot override a higher role's exception. The owner can review their own
incomplete report only when it has no ban matches; this supports the existing
Wine operator install without a general owner bypass. All actions are audited.

Protocol/storage
----------------
Canonical device JSON: {"components":{kind:[sorted unique lowercase SHA256]},
"version":1}, UTF-8/ASCII, sorted keys, compact separators. Client component
SHA256 input is "ZEAL DEVICE COMPONENT V1\n" + kind + "\n" + normalized serial.
The V2 account signature covers purpose, GUID, lobby binding, one-use challenge,
nonce and SHA256(canonical report). The client checks the returned digest before
signing. V1 Ranked proofs and pre-enforcement V1 challenges are rejected once
enforcement is enabled. V1 registration stays available for update instructions.

Only the origin knows the 32-byte device key. Each component is persisted as
HMAC-SHA256(key, "ZEAL DEVICE V1\n" + kind + "\n" + client hash). Raw serials and
client component hashes are never stored in the account DB or logs. Hashed
identifiers are still personal/pseudonymous evidence, not anonymous data.

Each account retains at most eight profiles for 90 days after last observation.
Profiles are keyed by the account GUID whichever linked PC signs the proof
(ACCOUNTS.txt, linked keys), so a permanent ban freezes every linked PC.
Unregistered profiles expire after 15 minutes. The service prunes expired data
hourly and during account proofs. Active permanent-ban snapshots survive normal
history expiry until the ban is released. Restricted operational backups can
retain earlier data; handle them with the same access controls as the live DB.
The installer and /device-privacy disclose collection, retention and appeals.

IP evidence (2026-10-14)
------------------------
Every verified proof (register, link, Ranked lobby) records the caller's
public address as seen through the Cloudflare connector (CF-Connecting-IP from
a trusted proxy only). The account origin stores HMAC-SHA256(device key,
"ZEAL IP V1\n" + address) and the same for its /24 IPv4 or /48 IPv6 network
("ZEAL NET V1\n"), with the signing game identity, purpose, time and a
SHA-256 reference to the Ranked lobby session. The address itself is stored
only encrypted (AES-256-GCM; key = HKDF-SHA256(device key, "ZEAL IP ADDRESS
ENCRYPTION V1"); associated data binds it to the game identity). Lobby and
rating services can read the database but have no key. Addresses never enter
service logs. The lobby service records which server, match and party each lobby
session reached (ranked_sessions, ranked_session_matches); those rows carry
no address and need no key. Denied proofs are recorded too.

Linked PCs resolve to their account. The staff dashboard shows, per player,
accounts that shared an address or network and whether they are permanently
banned. "IP history" (admin/owner, reason required, audited) lists recent
sign-ins with PC, purpose, the decrypted IP address and its /24 for VPN/ISP
checks, fingerprints, matches played and other accounts on the same address.
Rows recorded before 2026-10-15 05:00 UTC have fingerprints but no address. A shared address is a review signal
only and never blocks Ranked: households, LAN events, carrier NAT and VPNs.
Game UDP addresses seen by the Psychz servers are not collected; a player who
routes only game traffic through a different network is not covered.

Retention: 90 days, 15 minutes for keys that never register or link, and kept
while the account holds a permanent Ranked restriction. At most 500 events per
game identity. /device-privacy discloses this.

Deployment/recovery
-------------------
Accounts config: device_hmac_key_file=/etc/zeal/device-hmac.key,
device_required=true. The key is generated once on MS-02, root-owned, mode 0640
with the account-service group. Keep a private backup WITH the account database.
Do not copy it into installers, git, server-bridge configs or public backups.
Startup detects the wrong key; never generate a replacement as an automatic
repair. Restore the original key/database together. Read-only lobby/rating
consumers need the updated Python modules but never the key.

Publish the updated native DLL/installer before enabling the required flag.
Restart accounts first for schema/config initialization, then lobby/rating
services when no active matches are running. Ban enforcement is checked at
proof, ticket consumption, live lobby/voice policy and signed game admission.
No server scripts or dedicated-server binaries are required for this client
collector/proof change. Clients need V2 proofs (introduced in 1.30); 1.31 also fixes the update/review
messages. Existing
unproven identities need an updated proof; old accounts are not grandfathered.

In an emergency a local operator can set device_required=false in the account
config and restart accounts. That is an explicit policy rollback, not an
exception for one player. Account bans continue to apply. Do not drop tables or
reset the key to repair a deployment.

API references
--------------
https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemfirmwaretable
https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-storage_device_descriptor

Validation
----------
See docs/qa/device-20261013/RESULTS.txt. Synthetic tests cover GUID changes,
component upgrades, correlated fields, multiple source profiles, reviewed
shared hardware, stale approvals, ban release, permissions, replay/tampering,
legacy protocol denial, readonly policy consumers and live session revocation.
Native parsers are exercised with sanitizers and malformed SMBIOS fixtures.
Windows and Wine collectors are checked without logging real identifiers.
