From 3c1c527701eecfb52e0525902e6131a52b6bc3e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 22 Nov 2026 18:36:26 -0300 Subject: [PATCH 01/59] feat: add isomorphic crypto primitives and message protocol --- bun.lock | 13 + package.json | 9 + src/crypto/aead.ts | 58 +++ src/crypto/box.ts | 39 +++ src/crypto/canonical.ts | 77 ++++ src/crypto/crypto.test.ts | 180 ++++++++++ src/crypto/encoding.ts | 117 +++++++ src/crypto/index.ts | 43 +++ src/crypto/kdf.ts | 97 +++++ src/crypto/signing.ts | 70 ++++ src/crypto/sodium.ts | 30 ++ src/isomorphic.test.ts | 33 ++ src/protocol/agent-message.ts | 123 +++++++ src/protocol/command.ts | 251 +++++++++++++ src/protocol/commands/core.ts | 48 +++ src/protocol/domains.ts | 36 ++ src/protocol/errors.ts | 30 ++ src/protocol/index.ts | 77 ++++ src/protocol/protocol.test.ts | 642 ++++++++++++++++++++++++++++++++++ src/protocol/registry.ts | 53 +++ src/protocol/revocation.ts | 77 ++++ src/protocol/schemas.ts | 122 +++++++ src/protocol/session.ts | 110 ++++++ src/protocol/trust.ts | 76 ++++ 24 files changed, 2411 insertions(+) create mode 100644 src/crypto/aead.ts create mode 100644 src/crypto/box.ts create mode 100644 src/crypto/canonical.ts create mode 100644 src/crypto/crypto.test.ts create mode 100644 src/crypto/encoding.ts create mode 100644 src/crypto/index.ts create mode 100644 src/crypto/kdf.ts create mode 100644 src/crypto/signing.ts create mode 100644 src/crypto/sodium.ts create mode 100644 src/isomorphic.test.ts create mode 100644 src/protocol/agent-message.ts create mode 100644 src/protocol/command.ts create mode 100644 src/protocol/commands/core.ts create mode 100644 src/protocol/domains.ts create mode 100644 src/protocol/errors.ts create mode 100644 src/protocol/index.ts create mode 100644 src/protocol/protocol.test.ts create mode 100644 src/protocol/registry.ts create mode 100644 src/protocol/revocation.ts create mode 100644 src/protocol/schemas.ts create mode 100644 src/protocol/session.ts create mode 100644 src/protocol/trust.ts diff --git a/bun.lock b/bun.lock index 119fa83..b9dfdde 100644 --- a/bun.lock +++ b/bun.lock @@ -4,9 +4,14 @@ "workspaces": { "": { "name": "tegrad", + "dependencies": { + "libsodium-wrappers-sumo": "^0.8.4", + "zod": "^4.6.7", + }, "devDependencies": { "@biomejs/biome": "^2.6.8", "@types/bun": "^1.4.5", + "@types/libsodium-wrappers-sumo": "^0.8.2", "typescript": "^7.0.2", }, }, @@ -36,6 +41,8 @@ "@types/bun": ["@types/bun@1.4.5", "", { "dependencies": { "bun-types": "1.4.5" } }, "sha512-DpgwNI9z0L1S0gtb45QLCWgwCUcMLnsHYMJHQvpNj7erGiCGBvpggltAIeARrtobNMKMuy0UP7i56tKKgwFs/Q=="], + "@types/libsodium-wrappers-sumo": ["@types/libsodium-wrappers-sumo@0.8.2", "", { "dependencies": { "libsodium-wrappers-sumo": "*" } }, "sha512-uFOBpg/r21hExVlh2ty8YpDfSR+Yy3Jn8XS4+SSjitbhTxdYq+pBz/49XRxyUFe8SzqujHf/Wu0/O4d+FUtNfQ=="], + "@types/node": ["@types/node@26.6.6", "", { "dependencies": { "undici-types": "~8.9.0" } }, "sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog=="], "@typescript/typescript-aix-ppc64": ["@typescript/typescript-aix-ppc64@7.0.2", "", { "os": "aix", "cpu": "ppc64" }, "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ=="], @@ -80,10 +87,16 @@ "bun-types": ["bun-types@1.4.5", "", { "dependencies": { "@types/node": "*", "undici-types": "*" } }, "sha512-ECHn+9dhL3wv0G6u0+7dQvrnaimXiRDxxerYBmhTaLyJEEuvTPWk2Fye3XIf5Y++JIIiHKfQw4Z7V5D8KuiXbg=="], + "libsodium-sumo": ["libsodium-sumo@0.8.4", "", {}, "sha512-TMtHShQfVVsaxDygyapvUC3o7YsPgXa/hRWeIgzyFz6w5k/1hirGptCxp1U7XwW3rCskaTTYKgV10v86UiGgNw=="], + + "libsodium-wrappers-sumo": ["libsodium-wrappers-sumo@0.8.4", "", { "dependencies": { "libsodium-sumo": "^0.8.0" } }, "sha512-ql7hcgulKZ3ekfa2DGAogcCKsWU0diA/0nArz1CFzh93WQdb46/Kj18ka/Hifq6uA3Ush34Pc6vU/6HXeRwUkg=="], + "typescript": ["typescript@7.0.2", "", { "optionalDependencies": { "@typescript/typescript-aix-ppc64": "7.0.2", "@typescript/typescript-darwin-arm64": "7.0.2", "@typescript/typescript-darwin-x64": "7.0.2", "@typescript/typescript-freebsd-arm64": "7.0.2", "@typescript/typescript-freebsd-x64": "7.0.2", "@typescript/typescript-linux-arm": "7.0.2", "@typescript/typescript-linux-arm64": "7.0.2", "@typescript/typescript-linux-loong64": "7.0.2", "@typescript/typescript-linux-mips64el": "7.0.2", "@typescript/typescript-linux-ppc64": "7.0.2", "@typescript/typescript-linux-riscv64": "7.0.2", "@typescript/typescript-linux-s390x": "7.0.2", "@typescript/typescript-linux-x64": "7.0.2", "@typescript/typescript-netbsd-arm64": "7.0.2", "@typescript/typescript-netbsd-x64": "7.0.2", "@typescript/typescript-openbsd-arm64": "7.0.2", "@typescript/typescript-openbsd-x64": "7.0.2", "@typescript/typescript-sunos-x64": "7.0.2", "@typescript/typescript-win32-arm64": "7.0.2", "@typescript/typescript-win32-x64": "7.0.2" }, "bin": { "tsc": "bin/tsc" } }, "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA=="], "undici-types": ["undici-types@8.13.1", "", {}, "sha512-wEtfquPVc1e9umZh73XVwnPauVuGQp20M/u/4ENuWMRkZ8NZx0ut6q3HLLdMUb9awNlxxHcsaGVhaerZu/2SSw=="], + "zod": ["zod@4.6.7", "", {}, "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg=="], + "@types/node/undici-types": ["undici-types@8.9.0", "", {}, "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg=="], } } diff --git a/package.json b/package.json index befac47..bcc932f 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,10 @@ "license": "AGPL-3.0-only", "author": "Antônio Miranda ", "type": "module", + "exports": { + "./protocol": "./src/protocol/index.ts", + "./crypto": "./src/crypto/index.ts" + }, "engines": { "bun": ">=1.3.0" }, @@ -20,6 +24,11 @@ "devDependencies": { "@biomejs/biome": "^2.6.8", "@types/bun": "^1.4.5", + "@types/libsodium-wrappers-sumo": "^0.8.2", "typescript": "^7.0.2" + }, + "dependencies": { + "libsodium-wrappers-sumo": "^0.8.4", + "zod": "^4.6.7" } } diff --git a/src/crypto/aead.ts b/src/crypto/aead.ts new file mode 100644 index 0000000..c0f87f0 --- /dev/null +++ b/src/crypto/aead.ts @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { getSodium } from "./sodium"; + +export const SYMMETRIC_KEY_BYTES = 32; +export const AEAD_NONCE_BYTES = 24; +export const AEAD_TAG_BYTES = 16; + +export function generateSymmetricKey(): Uint8Array { + return getSodium().randombytes_buf(SYMMETRIC_KEY_BYTES); +} + +export function aeadEncrypt( + plaintext: Uint8Array, + key: Uint8Array, + associatedData?: Uint8Array, +): Uint8Array { + const s = getSodium(); + if (key.length !== SYMMETRIC_KEY_BYTES) { + throw new RangeError(`Symmetric key must be ${SYMMETRIC_KEY_BYTES} bytes`); + } + const nonce = s.randombytes_buf(AEAD_NONCE_BYTES); + const ciphertext = s.crypto_aead_xchacha20poly1305_ietf_encrypt( + plaintext, + associatedData ?? null, + null, + nonce, + key, + ); + const out = new Uint8Array(AEAD_NONCE_BYTES + ciphertext.length); + out.set(nonce, 0); + out.set(ciphertext, AEAD_NONCE_BYTES); + return out; +} + +export function aeadDecrypt( + ciphertext: Uint8Array, + key: Uint8Array, + associatedData?: Uint8Array, +): Uint8Array { + const s = getSodium(); + if (key.length !== SYMMETRIC_KEY_BYTES) { + throw new RangeError(`Symmetric key must be ${SYMMETRIC_KEY_BYTES} bytes`); + } + if (ciphertext.length < AEAD_NONCE_BYTES + AEAD_TAG_BYTES) { + throw new Error("Ciphertext is too short"); + } + const nonce = ciphertext.subarray(0, AEAD_NONCE_BYTES); + const body = ciphertext.subarray(AEAD_NONCE_BYTES); + return s.crypto_aead_xchacha20poly1305_ietf_decrypt( + null, + body, + associatedData ?? null, + nonce, + key, + ); +} diff --git a/src/crypto/box.ts b/src/crypto/box.ts new file mode 100644 index 0000000..c660b71 --- /dev/null +++ b/src/crypto/box.ts @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { + type PublicKey, + SIGNING_PUBLIC_KEY_BYTES, + SIGNING_SECRET_KEY_BYTES, + type SigningKeyPair, +} from "./signing"; +import { getSodium } from "./sodium"; + +export function sealTo(plaintext: Uint8Array, recipientSigningPublicKey: PublicKey): Uint8Array { + const s = getSodium(); + if (recipientSigningPublicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new RangeError(`Recipient public key must be ${SIGNING_PUBLIC_KEY_BYTES} bytes`); + } + const curvePk = s.crypto_sign_ed25519_pk_to_curve25519(recipientSigningPublicKey); + return s.crypto_box_seal(plaintext, curvePk); +} + +export function openSealed( + ciphertext: Uint8Array, + recipientSigningKeyPair: SigningKeyPair, +): Uint8Array { + const s = getSodium(); + if ( + recipientSigningKeyPair.publicKey.length !== SIGNING_PUBLIC_KEY_BYTES || + recipientSigningKeyPair.secretKey.length !== SIGNING_SECRET_KEY_BYTES + ) { + throw new RangeError("Invalid recipient signing key pair length"); + } + const curvePk = s.crypto_sign_ed25519_pk_to_curve25519(recipientSigningKeyPair.publicKey); + const curveSk = s.crypto_sign_ed25519_sk_to_curve25519(recipientSigningKeyPair.secretKey); + try { + return s.crypto_box_seal_open(ciphertext, curvePk, curveSk); + } finally { + s.memzero(curveSk); + } +} diff --git a/src/crypto/canonical.ts b/src/crypto/canonical.ts new file mode 100644 index 0000000..5abf25b --- /dev/null +++ b/src/crypto/canonical.ts @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +const utf8Encoder = new TextEncoder(); + +function compareCodeUnits(a: string, b: string): number { + if (a < b) return -1; + if (a > b) return 1; + return 0; +} + +function serializeCanonical(value: unknown, ancestors: Set): string { + if (value === null) return "null"; + + switch (typeof value) { + case "boolean": + return value ? "true" : "false"; + case "number": { + if (!Number.isFinite(value)) { + throw new TypeError("Cannot canonicalize non-finite number"); + } + return Object.is(value, -0) ? "0" : JSON.stringify(value); + } + case "string": + return JSON.stringify(value); + case "undefined": + case "function": + case "symbol": + case "bigint": + throw new TypeError(`Cannot canonicalize value of type ${typeof value}`); + case "object": { + if (ancestors.has(value)) { + throw new TypeError("Cannot canonicalize circular reference"); + } + + if (Array.isArray(value)) { + ancestors.add(value); + try { + const items: string[] = []; + for (let i = 0; i < value.length; i++) { + items.push(serializeCanonical(value[i], ancestors)); + } + return `[${items.join(",")}]`; + } finally { + ancestors.delete(value); + } + } + + const proto = Object.getPrototypeOf(value) as unknown; + if (proto !== Object.prototype && proto !== null) { + throw new TypeError("Cannot canonicalize non-plain object"); + } + + ancestors.add(value); + try { + const record = value as Record; + const keys = Object.keys(record) + .filter((k) => record[k] !== undefined) + .sort(compareCodeUnits); + + const entries: string[] = []; + for (const key of keys) { + entries.push(`${JSON.stringify(key)}:${serializeCanonical(record[key], ancestors)}`); + } + return `{${entries.join(",")}}`; + } finally { + ancestors.delete(value); + } + } + default: + throw new TypeError(`Cannot canonicalize value of type ${typeof value}`); + } +} + +export function canonicalize(value: unknown): Uint8Array { + return utf8Encoder.encode(serializeCanonical(value, new Set())); +} diff --git a/src/crypto/crypto.test.ts b/src/crypto/crypto.test.ts new file mode 100644 index 0000000..743a858 --- /dev/null +++ b/src/crypto/crypto.test.ts @@ -0,0 +1,180 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { beforeAll, describe, expect, test } from "bun:test"; +import { + aeadDecrypt, + aeadEncrypt, + assertKdfParams, + canonicalize, + deriveKeyFromPassword, + fingerprint, + fromBase64Url, + generateSalt, + generateSigningKeyPair, + generateSymmetricKey, + KDF_FLOOR, + KDF_MODERATE, + openSealed, + ready, + sealTo, + sign, + signingKeyPairFromSeed, + toBase32, + toBase64Url, + verify, +} from "./index"; + +beforeAll(async () => { + await ready(); +}); + +describe("encoding", () => { + test("base64url round-trip without padding", () => { + for (let len = 0; len <= 10; len++) { + const bytes = new Uint8Array(len); + for (let i = 0; i < len; i++) bytes[i] = (i * 37 + 13) & 0xff; + const encoded = toBase64Url(bytes); + expect(encoded.includes("=")).toBe(false); + expect(encoded.includes("+")).toBe(false); + expect(encoded.includes("/")).toBe(false); + expect(fromBase64Url(encoded)).toEqual(bytes); + } + }); + + test("fromBase64Url rejects invalid inputs", () => { + expect(() => fromBase64Url("abc=")).toThrow(); + expect(() => fromBase64Url("a")).toThrow(); + expect(() => fromBase64Url("ab+c")).toThrow(); + expect(() => fromBase64Url("ab/c")).toThrow(); + expect(() => fromBase64Url("ab c")).toThrow(); + expect(() => fromBase64Url("AB")).toThrow(); // non-canonical trailing bits + }); + + test("toBase32 encodes lowercase RFC 4648 without padding", () => { + const enc = new TextEncoder(); + expect(toBase32(enc.encode(""))).toBe(""); + expect(toBase32(enc.encode("f"))).toBe("my"); + expect(toBase32(enc.encode("fo"))).toBe("mzxq"); + expect(toBase32(enc.encode("foo"))).toBe("mzxw6"); + expect(toBase32(enc.encode("foob"))).toBe("mzxw6yq"); + expect(toBase32(enc.encode("fooba"))).toBe("mzxw6ytb"); + expect(toBase32(enc.encode("foobar"))).toBe("mzxw6ytboi"); + }); +}); + +describe("fixed vectors", () => { + test("signingKeyPairFromSeed and fingerprint are deterministic", () => { + const seedA = new Uint8Array(32).fill(0x11); + const seedB = new Uint8Array(32).fill(0x22); + + const kpA = signingKeyPairFromSeed(seedA); + const kpB = signingKeyPairFromSeed(seedB); + + expect(toBase64Url(kpA.publicKey)).toBe("0EqyMnQrtKs6E2i9RhXk5tAiSrcaAWuvhSCjMsl3hzc"); + expect(toBase64Url(kpB.publicKey)).toBe("oJql9HpnWYAv-VX43C0qFKXJnSO-l_hkEn_5ODRVpPA"); + + const fpA = fingerprint(kpA.publicKey); + const fpB = fingerprint(kpB.publicKey); + expect(fpA).toBe("2o6xl7gxm5sqizy645pzlypnplng2fun"); + expect(fpB).toBe("7sgisx6bisee5ge2gkt4x67uondk2ojg"); + expect(fpA.length).toBe(32); + expect(fpB.length).toBe(32); + }); + + test("Argon2id fixed vector with floor parameters", () => { + const salt = new Uint8Array(16).fill(0x42); + const derived = deriveKeyFromPassword("tegra-test-password", { + ...KDF_FLOOR, + salt, + }); + expect(toBase64Url(derived)).toBe("UxQEU4EnrisI0GgKMdR0R_SKEu-zItfkz1agjIz3cUc"); + }); +}); + +describe("signing, sealed box, and AEAD", () => { + test("Ed25519 sign and verify", () => { + const kp = generateSigningKeyPair(); + const msg = new TextEncoder().encode("hello tegra"); + const sig = sign(msg, kp.secretKey); + + expect(verify(msg, sig, kp.publicKey)).toBe(true); + + const tamperedSig = new Uint8Array(sig); + tamperedSig[0] = (tamperedSig[0] ?? 0) ^ 0xff; + expect(verify(msg, tamperedSig, kp.publicKey)).toBe(false); + expect(verify(msg, new Uint8Array(10), kp.publicKey)).toBe(false); + expect(verify(msg, sig, new Uint8Array(10))).toBe(false); + }); + + test("sealed box round-trip with Ed25519 keys", () => { + const recipient = generateSigningKeyPair(); + const other = generateSigningKeyPair(); + const plaintext = new TextEncoder().encode("secret payload"); + + const sealed = sealTo(plaintext, recipient.publicKey); + expect(openSealed(sealed, recipient)).toEqual(plaintext); + expect(() => openSealed(sealed, other)).toThrow(); + }); + + test("AEAD XChaCha20-Poly1305 round-trip with and without AAD", () => { + const key = generateSymmetricKey(); + const plaintext = new TextEncoder().encode("vault contents"); + const aad = new TextEncoder().encode("vault-v1"); + + const ct1 = aeadEncrypt(plaintext, key); + expect(aeadDecrypt(ct1, key)).toEqual(plaintext); + + const ct2 = aeadEncrypt(plaintext, key, aad); + expect(aeadDecrypt(ct2, key, aad)).toEqual(plaintext); + expect(() => aeadDecrypt(ct2, key)).toThrow(); + expect(() => aeadDecrypt(ct2, key, new TextEncoder().encode("wrong"))).toThrow(); + }); +}); + +describe("KDF validation", () => { + test("assertKdfParams accepts floor and moderate presets", () => { + const salt = generateSalt(); + expect(() => assertKdfParams({ ...KDF_FLOOR, salt })).not.toThrow(); + expect(() => assertKdfParams({ ...KDF_MODERATE, salt })).not.toThrow(); + }); + + test("assertKdfParams rejects below floor, wrong alg, or bad salt", () => { + const salt = generateSalt(); + expect(() => assertKdfParams({ ...KDF_FLOOR, opslimit: 2, salt })).toThrow(); + expect(() => assertKdfParams({ ...KDF_FLOOR, memlimit: 64 * 1024 * 1024, salt })).toThrow(); + expect(() => assertKdfParams({ ...KDF_FLOOR, alg: "argon2i13", salt })).toThrow(); + expect(() => assertKdfParams({ ...KDF_FLOOR, salt: new Uint8Array(8) })).toThrow(); + }); +}); + +describe("canonicalize", () => { + const decode = (bytes: Uint8Array) => new TextDecoder().decode(bytes); + + test("sorts object keys, omits undefined properties, normalizes -0", () => { + const input = { + z: 1, + a: { d: true, b: -0, c: undefined }, + m: [1, "x", null], + skip: undefined, + }; + expect(decode(canonicalize(input))).toBe('{"a":{"b":0,"d":true},"m":[1,"x",null],"z":1}'); + }); + + test("rejects NaN, Infinity, bare undefined, and non-JSON types", () => { + expect(() => canonicalize(Number.NaN)).toThrow(); + expect(() => canonicalize(Number.POSITIVE_INFINITY)).toThrow(); + expect(() => canonicalize(Number.NEGATIVE_INFINITY)).toThrow(); + expect(() => canonicalize(undefined)).toThrow(); + expect(() => canonicalize([1, undefined])).toThrow(); + expect(() => canonicalize(() => {})).toThrow(); + expect(() => canonicalize(Symbol("x"))).toThrow(); + expect(() => canonicalize(10n)).toThrow(); + expect(() => canonicalize(new Date())).toThrow(); + expect(() => canonicalize(new Uint8Array([1, 2]))).toThrow(); + + const circular: Record = {}; + circular.self = circular; + expect(() => canonicalize(circular)).toThrow(); + }); +}); diff --git a/src/crypto/encoding.ts b/src/crypto/encoding.ts new file mode 100644 index 0000000..238574c --- /dev/null +++ b/src/crypto/encoding.ts @@ -0,0 +1,117 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +const BASE64URL_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; +const BASE32_ALPHABET = "abcdefghijklmnopqrstuvwxyz234567"; + +const BASE64URL_LOOKUP = new Int8Array(128).fill(-1); +for (let i = 0; i < BASE64URL_ALPHABET.length; i++) { + BASE64URL_LOOKUP[BASE64URL_ALPHABET.charCodeAt(i)] = i; +} + +export function toBase64Url(bytes: Uint8Array): string { + let out = ""; + const len = bytes.length; + let i = 0; + + for (; i + 2 < len; i += 3) { + const b0 = bytes[i] ?? 0; + const b1 = bytes[i + 1] ?? 0; + const b2 = bytes[i + 2] ?? 0; + const triple = (b0 << 16) | (b1 << 8) | b2; + out += + (BASE64URL_ALPHABET[(triple >>> 18) & 0x3f] ?? "") + + (BASE64URL_ALPHABET[(triple >>> 12) & 0x3f] ?? "") + + (BASE64URL_ALPHABET[(triple >>> 6) & 0x3f] ?? "") + + (BASE64URL_ALPHABET[triple & 0x3f] ?? ""); + } + + const remaining = len - i; + if (remaining === 1) { + const b0 = bytes[i] ?? 0; + out += + (BASE64URL_ALPHABET[(b0 >>> 2) & 0x3f] ?? "") + (BASE64URL_ALPHABET[(b0 << 4) & 0x3f] ?? ""); + } else if (remaining === 2) { + const b0 = bytes[i] ?? 0; + const b1 = bytes[i + 1] ?? 0; + out += + (BASE64URL_ALPHABET[(b0 >>> 2) & 0x3f] ?? "") + + (BASE64URL_ALPHABET[((b0 << 4) | (b1 >>> 4)) & 0x3f] ?? "") + + (BASE64URL_ALPHABET[(b1 << 2) & 0x3f] ?? ""); + } + + return out; +} + +export function fromBase64Url(text: string): Uint8Array { + const len = text.length; + const rem = len % 4; + if (rem === 1) { + throw new Error("Invalid base64url length"); + } + + const byteLen = Math.floor((len * 3) / 4); + const out = new Uint8Array(byteLen); + let outIdx = 0; + let i = 0; + + const decodeChar = (idx: number): number => { + const code = text.charCodeAt(idx); + if (code >= 128) throw new Error("Invalid base64url character"); + const val = BASE64URL_LOOKUP[code] ?? -1; + if (val < 0) throw new Error("Invalid base64url character"); + return val; + }; + + for (; i + 3 < len; i += 4) { + const c0 = decodeChar(i); + const c1 = decodeChar(i + 1); + const c2 = decodeChar(i + 2); + const c3 = decodeChar(i + 3); + const triple = (c0 << 18) | (c1 << 12) | (c2 << 6) | c3; + out[outIdx++] = (triple >>> 16) & 0xff; + out[outIdx++] = (triple >>> 8) & 0xff; + out[outIdx++] = triple & 0xff; + } + + if (rem === 2) { + const c0 = decodeChar(i); + const c1 = decodeChar(i + 1); + if ((c1 & 0x0f) !== 0) { + throw new Error("Non-canonical base64url trailing bits"); + } + out[outIdx++] = (c0 << 2) | (c1 >>> 4); + } else if (rem === 3) { + const c0 = decodeChar(i); + const c1 = decodeChar(i + 1); + const c2 = decodeChar(i + 2); + if ((c2 & 0x03) !== 0) { + throw new Error("Non-canonical base64url trailing bits"); + } + out[outIdx++] = (c0 << 2) | (c1 >>> 4); + out[outIdx++] = ((c1 & 0x0f) << 4) | (c2 >>> 2); + } + + return out; +} + +export function toBase32(bytes: Uint8Array): string { + let out = ""; + let buffer = 0; + let bitsLeft = 0; + + for (let i = 0; i < bytes.length; i++) { + buffer = (buffer << 8) | (bytes[i] ?? 0); + bitsLeft += 8; + while (bitsLeft >= 5) { + bitsLeft -= 5; + out += BASE32_ALPHABET[(buffer >>> bitsLeft) & 0x1f] ?? ""; + } + } + + if (bitsLeft > 0) { + out += BASE32_ALPHABET[(buffer << (5 - bitsLeft)) & 0x1f] ?? ""; + } + + return out; +} diff --git a/src/crypto/index.ts b/src/crypto/index.ts new file mode 100644 index 0000000..c600ead --- /dev/null +++ b/src/crypto/index.ts @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +export { + AEAD_NONCE_BYTES, + AEAD_TAG_BYTES, + aeadDecrypt, + aeadEncrypt, + generateSymmetricKey, + SYMMETRIC_KEY_BYTES, +} from "./aead"; +export { openSealed, sealTo } from "./box"; +export { canonicalize } from "./canonical"; +export { fromBase64Url, toBase32, toBase64Url } from "./encoding"; +export { + assertKdfParams, + deriveKeyFromPassword, + generateSalt, + KDF_ALG_ARGON2ID13, + KDF_FLOOR, + KDF_KEY_BYTES, + KDF_MODERATE, + KDF_SALT_BYTES, + type KdfParams, + type KdfPreset, +} from "./kdf"; +export { + FINGERPRINT_HASH_BYTES, + FINGERPRINT_TRUNCATED_BYTES, + fingerprint, + generateSigningKeyPair, + type PublicKey, + type SecretKey, + SIGNATURE_BYTES, + SIGNING_PUBLIC_KEY_BYTES, + SIGNING_SECRET_KEY_BYTES, + SIGNING_SEED_BYTES, + type SigningKeyPair, + sign, + signingKeyPairFromSeed, + verify, +} from "./signing"; +export { memzero, randomBytes, ready } from "./sodium"; diff --git a/src/crypto/kdf.ts b/src/crypto/kdf.ts new file mode 100644 index 0000000..758f91b --- /dev/null +++ b/src/crypto/kdf.ts @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { getSodium } from "./sodium"; + +export const KDF_ALG_ARGON2ID13 = "argon2id13" as const; +export const KDF_SALT_BYTES = 16; +export const KDF_KEY_BYTES = 32; + +export interface KdfPreset { + readonly alg: typeof KDF_ALG_ARGON2ID13; + readonly opslimit: number; + readonly memlimit: number; +} + +export interface KdfParams extends KdfPreset { + readonly salt: Uint8Array; +} + +export const KDF_FLOOR: KdfPreset = { + alg: KDF_ALG_ARGON2ID13, + opslimit: 3, + memlimit: 128 * 1024 * 1024, +}; + +export const KDF_MODERATE: KdfPreset = { + alg: KDF_ALG_ARGON2ID13, + opslimit: 3, + memlimit: 256 * 1024 * 1024, +}; + +const utf8Encoder = new TextEncoder(); + +export function generateSalt(): Uint8Array { + return getSodium().randombytes_buf(KDF_SALT_BYTES); +} + +export function assertKdfParams(params: unknown): asserts params is KdfParams { + if (typeof params !== "object" || params === null) { + throw new Error("KDF parameters must be an object"); + } + + const record = params as Record; + + if (record.alg !== KDF_ALG_ARGON2ID13) { + throw new Error(`Unsupported KDF algorithm: expected ${KDF_ALG_ARGON2ID13}`); + } + + if ( + typeof record.opslimit !== "number" || + !Number.isSafeInteger(record.opslimit) || + record.opslimit < KDF_FLOOR.opslimit + ) { + throw new Error(`KDF opslimit must be an integer >= ${KDF_FLOOR.opslimit}`); + } + + if ( + typeof record.memlimit !== "number" || + !Number.isSafeInteger(record.memlimit) || + record.memlimit < KDF_FLOOR.memlimit + ) { + throw new Error(`KDF memlimit must be an integer >= ${KDF_FLOOR.memlimit}`); + } + + if (!(record.salt instanceof Uint8Array) || record.salt.length !== KDF_SALT_BYTES) { + throw new Error(`KDF salt must be a Uint8Array of ${KDF_SALT_BYTES} bytes`); + } +} + +export function deriveKeyFromPassword( + password: string | Uint8Array, + params: KdfParams, + keyLength: number = KDF_KEY_BYTES, +): Uint8Array { + const s = getSodium(); + assertKdfParams(params); + if (!Number.isSafeInteger(keyLength) || keyLength < 16) { + throw new RangeError("Derived key length must be an integer >= 16"); + } + + const isString = typeof password === "string"; + const pwBytes = isString ? utf8Encoder.encode(password) : password; + try { + return s.crypto_pwhash( + keyLength, + pwBytes, + params.salt, + params.opslimit, + params.memlimit, + s.crypto_pwhash_ALG_ARGON2ID13, + ); + } finally { + if (isString) { + s.memzero(pwBytes); + } + } +} diff --git a/src/crypto/signing.ts b/src/crypto/signing.ts new file mode 100644 index 0000000..a1c85fa --- /dev/null +++ b/src/crypto/signing.ts @@ -0,0 +1,70 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { toBase32 } from "./encoding"; +import { getSodium } from "./sodium"; + +export const SIGNING_PUBLIC_KEY_BYTES = 32; +export const SIGNING_SECRET_KEY_BYTES = 64; +export const SIGNING_SEED_BYTES = 32; +export const SIGNATURE_BYTES = 64; +export const FINGERPRINT_HASH_BYTES = 32; +export const FINGERPRINT_TRUNCATED_BYTES = 20; + +export type PublicKey = Uint8Array; +export type SecretKey = Uint8Array; + +export interface SigningKeyPair { + readonly publicKey: PublicKey; + readonly secretKey: SecretKey; +} + +export function generateSigningKeyPair(): SigningKeyPair { + const s = getSodium(); + const kp = s.crypto_sign_keypair(); + return { + publicKey: kp.publicKey, + secretKey: kp.privateKey, + }; +} + +export function signingKeyPairFromSeed(seed: Uint8Array): SigningKeyPair { + const s = getSodium(); + if (seed.length !== SIGNING_SEED_BYTES) { + throw new RangeError(`Signing seed must be ${SIGNING_SEED_BYTES} bytes`); + } + const kp = s.crypto_sign_seed_keypair(seed); + return { + publicKey: kp.publicKey, + secretKey: kp.privateKey, + }; +} + +export function sign(message: Uint8Array, secretKey: SecretKey): Uint8Array { + const s = getSodium(); + if (secretKey.length !== SIGNING_SECRET_KEY_BYTES) { + throw new RangeError(`Signing secret key must be ${SIGNING_SECRET_KEY_BYTES} bytes`); + } + return s.crypto_sign_detached(message, secretKey); +} + +export function verify(message: Uint8Array, signature: Uint8Array, publicKey: PublicKey): boolean { + const s = getSodium(); + if (signature.length !== SIGNATURE_BYTES || publicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + return false; + } + try { + return s.crypto_sign_verify_detached(signature, message, publicKey); + } catch { + return false; + } +} + +export function fingerprint(publicKey: PublicKey): string { + const s = getSodium(); + if (publicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new RangeError(`Public key must be ${SIGNING_PUBLIC_KEY_BYTES} bytes`); + } + const digest = s.crypto_generichash(FINGERPRINT_HASH_BYTES, publicKey, null); + return toBase32(digest.subarray(0, FINGERPRINT_TRUNCATED_BYTES)); +} diff --git a/src/crypto/sodium.ts b/src/crypto/sodium.ts new file mode 100644 index 0000000..6574fd6 --- /dev/null +++ b/src/crypto/sodium.ts @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import sodium from "libsodium-wrappers-sumo"; + +let initialized = false; + +export async function ready(): Promise { + if (initialized) return; + await sodium.ready; + initialized = true; +} + +export function getSodium(): typeof sodium { + if (!initialized) { + throw new Error("Crypto module is not initialized. Call await ready() first."); + } + return sodium; +} + +export function randomBytes(length: number): Uint8Array { + if (!Number.isInteger(length) || length < 0) { + throw new RangeError("length must be a non-negative integer"); + } + return getSodium().randombytes_buf(length); +} + +export function memzero(buffer: Uint8Array): void { + getSodium().memzero(buffer); +} diff --git a/src/isomorphic.test.ts b/src/isomorphic.test.ts new file mode 100644 index 0000000..789dd7a --- /dev/null +++ b/src/isomorphic.test.ts @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { expect, test } from "bun:test"; +import { Glob } from "bun"; + +const FORBIDDEN_PATTERNS: readonly { name: string; regex: RegExp }[] = [ + { name: "node:* import", regex: /from\s+["']node:[^"']+["']|import\s+["']node:[^"']+["']/ }, + { name: "bun:* import", regex: /from\s+["']bun:[^"']+["']|import\s+["']bun:[^"']+["']/ }, + { name: "Buffer global", regex: /\bBuffer\b/ }, + { name: "process global", regex: /\bprocess\b/ }, + { name: "Bun global", regex: /\bBun\b/ }, + { name: "fs import", regex: /from\s+["']fs["']|from\s+["']fs\/promises["']/ }, +]; + +test("src/crypto and src/protocol are isomorphic (no Node/Bun-only APIs)", async () => { + const violations: string[] = []; + let checkedCount = 0; + + for await (const path of new Glob("src/{crypto,protocol}/**/*.ts").scan(".")) { + if (path.endsWith(".test.ts")) continue; + checkedCount++; + const content = await Bun.file(path).text(); + for (const rule of FORBIDDEN_PATTERNS) { + if (rule.regex.test(content)) { + violations.push(`${path}: matched ${rule.name}`); + } + } + } + + expect(checkedCount).toBeGreaterThan(0); + expect(violations).toEqual([]); +}); diff --git a/src/protocol/agent-message.ts b/src/protocol/agent-message.ts new file mode 100644 index 0000000..66a4a7d --- /dev/null +++ b/src/protocol/agent-message.ts @@ -0,0 +1,123 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { + canonicalize, + fingerprint, + fromBase64Url, + openSealed, + type PublicKey, + randomBytes, + type SigningKeyPair, + sealTo, + sign, + toBase64Url, + verify, +} from "../crypto"; +import { + assertSupportedVersion, + concatBytes, + DOMAIN_AGENT_MESSAGE, + PROTOCOL_VERSION, +} from "./domains"; +import { ProtocolError } from "./errors"; +import { type AgentMessage, type AgentMessageHeader, agentMessageSchema } from "./schemas"; + +const utf8Decoder = new TextDecoder("utf-8", { fatal: true }); + +export interface SealAgentMessageParams { + readonly type: string; + readonly body: unknown; + readonly agentKeyPair: SigningKeyPair; + readonly recipientPublicKey: PublicKey; + readonly sentAt: number; + readonly seq: number; + readonly id?: string; +} + +export interface OpenedAgentMessage { + readonly header: AgentMessageHeader; + readonly body: unknown; +} + +export function sealAgentMessage(params: SealAgentMessageParams): AgentMessage { + const header: AgentMessageHeader = { + v: PROTOCOL_VERSION, + id: params.id ?? toBase64Url(randomBytes(16)), + type: params.type, + agent: fingerprint(params.agentKeyPair.publicKey), + recipient: fingerprint(params.recipientPublicKey), + sent_at: params.sentAt, + seq: params.seq, + }; + + const payloadBytes = sealTo(canonicalize(params.body), params.recipientPublicKey); + const signingInput = concatBytes(DOMAIN_AGENT_MESSAGE, canonicalize(header), payloadBytes); + const signature = sign(signingInput, params.agentKeyPair.secretKey); + + return { + header, + payload: toBase64Url(payloadBytes), + sig: toBase64Url(signature), + }; +} + +export function openAgentMessage( + message: unknown, + agentPublicKey: PublicKey, + recipientKeyPair: SigningKeyPair, +): OpenedAgentMessage { + if (typeof message === "object" && message !== null && "header" in message) { + assertSupportedVersion((message as { header: unknown }).header); + } + + const parsed = agentMessageSchema.safeParse(message); + if (!parsed.success) { + throw new ProtocolError("invalid_format", "Malformed agent message"); + } + + const { header, payload, sig } = parsed.data; + + if (header.agent !== fingerprint(agentPublicKey)) { + throw new ProtocolError("wrong_agent", "Agent message sender mismatch"); + } + + if (header.recipient !== fingerprint(recipientKeyPair.publicKey)) { + throw new ProtocolError("wrong_recipient", "Agent message recipient mismatch"); + } + + let payloadBytes: Uint8Array; + try { + payloadBytes = fromBase64Url(payload); + } catch { + throw new ProtocolError("invalid_format", "Invalid payload encoding"); + } + + let signatureBytes: Uint8Array; + try { + signatureBytes = fromBase64Url(sig); + } catch { + throw new ProtocolError("bad_signature", "Invalid signature encoding"); + } + + const signingInput = concatBytes(DOMAIN_AGENT_MESSAGE, canonicalize(header), payloadBytes); + if (!verify(signingInput, signatureBytes, agentPublicKey)) { + throw new ProtocolError("bad_signature", "Invalid agent message signature"); + } + + let plaintext: Uint8Array; + try { + plaintext = openSealed(payloadBytes, recipientKeyPair); + } catch { + throw new ProtocolError("decrypt_failed", "Failed to decrypt agent message payload"); + } + + let body: unknown; + try { + body = JSON.parse(utf8Decoder.decode(plaintext)); + } catch { + throw new ProtocolError("invalid_body", "Agent message payload is not valid JSON"); + } + + return { header, body }; +} diff --git a/src/protocol/command.ts b/src/protocol/command.ts new file mode 100644 index 0000000..87ad411 --- /dev/null +++ b/src/protocol/command.ts @@ -0,0 +1,251 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { + canonicalize, + fingerprint, + fromBase64Url, + openSealed, + type PublicKey, + randomBytes, + type SigningKeyPair, + sealTo, + sign, + toBase64Url, + verify, +} from "../crypto"; +import { assertSupportedVersion, concatBytes, DOMAIN_COMMAND, PROTOCOL_VERSION } from "./domains"; +import { ProtocolError } from "./errors"; +import type { CommandRegistry } from "./registry"; +import { + type CommandHeader, + type KeyId, + type SessionCertificate, + type SignedCommand, + signedCommandSchema, +} from "./schemas"; +import { verifySessionCertificate } from "./session"; +import type { TrustContext } from "./trust"; + +export const COMMAND_ID_BYTES = 16; +export const DEFAULT_COMMAND_TTL_MS = 5 * 60 * 1000; +export const MAX_COMMAND_TTL_MS = 10 * 60 * 1000; +export const MAX_CLOCK_SKEW_MS = 30 * 1000; + +const utf8Decoder = new TextDecoder("utf-8", { fatal: true }); + +export interface CreateSignedCommandParams { + readonly type: string; + readonly body: unknown; + readonly agentPublicKey: PublicKey; + readonly signer: SigningKeyPair; + readonly session?: SessionCertificate; + readonly counter: number; + readonly now: number; + readonly ttlMs?: number; + readonly id?: string; +} + +export interface OpenedCommand { + readonly header: CommandHeader; + readonly body: TBody; + readonly signerType: "account" | "session"; + readonly accountId: KeyId; + readonly sessionId?: string; +} + +export function createSignedCommand( + params: CreateSignedCommandParams, + registry: CommandRegistry, +): SignedCommand { + const definition = registry.get(params.type); + if (!definition) { + throw new ProtocolError("unknown_command", "Unknown command type"); + } + + const parsedBody = definition.body.safeParse(params.body); + if (!parsedBody.success) { + throw new ProtocolError("invalid_body", "Command body failed schema validation"); + } + + const ttlMs = params.ttlMs ?? DEFAULT_COMMAND_TTL_MS; + const header: CommandHeader = { + v: PROTOCOL_VERSION, + id: params.id ?? toBase64Url(randomBytes(COMMAND_ID_BYTES)), + type: params.type, + agent: fingerprint(params.agentPublicKey), + signer: fingerprint(params.signer.publicKey), + issued_at: params.now, + expires_at: params.now + ttlMs, + counter: params.counter, + }; + + const payloadBytes = sealTo(canonicalize(parsedBody.data), params.agentPublicKey); + const signingInput = concatBytes(DOMAIN_COMMAND, canonicalize(header), payloadBytes); + const signature = sign(signingInput, params.signer.secretKey); + + const command: SignedCommand = { + header, + payload: toBase64Url(payloadBytes), + ...(params.session !== undefined ? { session: params.session } : {}), + sig: toBase64Url(signature), + }; + + return command; +} + +export async function openCommand( + command: unknown, + trust: TrustContext, + registry: CommandRegistry, +): Promise { + // 1. Validate version and format + if (typeof command === "object" && command !== null) { + if ("header" in command) { + assertSupportedVersion((command as { header: unknown }).header); + } + if ("session" in command && (command as { session: unknown }).session !== undefined) { + assertSupportedVersion((command as { session: unknown }).session); + } + } + + const parsed = signedCommandSchema.safeParse(command); + if (!parsed.success) { + throw new ProtocolError("invalid_format", "Malformed signed command"); + } + + const { header, payload, session, sig } = parsed.data; + + let idBytes: Uint8Array; + try { + idBytes = fromBase64Url(header.id); + } catch { + throw new ProtocolError("invalid_format", "Invalid command id encoding"); + } + if (idBytes.length !== COMMAND_ID_BYTES) { + throw new ProtocolError("invalid_format", "Invalid command id length"); + } + + // 2. Verify target agent + const localAgentId = fingerprint(trust.agentKeyPair.publicKey); + if (header.agent !== localAgentId) { + throw new ProtocolError("wrong_agent", "Command is addressed to a different agent"); + } + + // 3. Verify time window + const now = trust.now(); + if (header.expires_at <= header.issued_at) { + throw new ProtocolError("expired", "Command expiration is not after issuance"); + } + if (header.expires_at - header.issued_at > MAX_COMMAND_TTL_MS) { + throw new ProtocolError("ttl_too_long", "Command lifetime exceeds maximum allowed window"); + } + if (header.issued_at > now + MAX_CLOCK_SKEW_MS) { + throw new ProtocolError("not_yet_valid", "Command issued_at is in the future"); + } + if (now >= header.expires_at) { + throw new ProtocolError("expired", "Command has expired"); + } + + // 4. Resolve and trust signer + let signerPublicKey: PublicKey; + let signerType: "account" | "session"; + let accountId: KeyId; + let sessionId: string | undefined; + + if (session !== undefined) { + const accountPublicKey = trust.isTrustedAccountKey(session.account); + if (accountPublicKey === null) { + throw new ProtocolError("untrusted_signer", "Session certificate account key is not trusted"); + } + if (trust.isSessionRevoked(session.id)) { + throw new ProtocolError("session_revoked", "Session certificate has been revoked"); + } + const verifiedSession = verifySessionCertificate(session, accountPublicKey, header.issued_at); + if (fingerprint(verifiedSession.sessionPublicKey) !== header.signer) { + throw new ProtocolError( + "session_invalid", + "Session certificate key does not match command signer", + ); + } + signerPublicKey = verifiedSession.sessionPublicKey; + signerType = "session"; + accountId = session.account; + sessionId = session.id; + } else { + const accountPublicKey = trust.isTrustedAccountKey(header.signer); + if (accountPublicKey === null) { + throw new ProtocolError("untrusted_signer", "Command signer is not a trusted account key"); + } + signerPublicKey = accountPublicKey; + signerType = "account"; + accountId = header.signer; + } + + // 5. Verify command signature + let payloadBytes: Uint8Array; + try { + payloadBytes = fromBase64Url(payload); + } catch { + throw new ProtocolError("invalid_format", "Invalid payload encoding"); + } + + let signatureBytes: Uint8Array; + try { + signatureBytes = fromBase64Url(sig); + } catch { + throw new ProtocolError("bad_signature", "Invalid signature encoding"); + } + + const signingInput = concatBytes(DOMAIN_COMMAND, canonicalize(header), payloadBytes); + if (!verify(signingInput, signatureBytes, signerPublicKey)) { + throw new ProtocolError("bad_signature", "Invalid command signature"); + } + + // 6. Anti-replay (only after valid signature) + if (!trust.claimCommand(header.signer, header.id, header.counter)) { + throw new ProtocolError("replayed", "Command replay or non-increasing counter detected"); + } + + // 7. Decrypt payload + let plaintext: Uint8Array; + try { + plaintext = openSealed(payloadBytes, trust.agentKeyPair); + } catch { + throw new ProtocolError("decrypt_failed", "Failed to decrypt command payload"); + } + + // 8. Look up command type and validate body + const definition = registry.get(header.type); + if (!definition) { + throw new ProtocolError("unknown_command", "Unknown command type"); + } + + let rawBody: unknown; + try { + rawBody = JSON.parse(utf8Decoder.decode(plaintext)); + } catch { + throw new ProtocolError("invalid_body", "Decrypted command payload is not valid JSON"); + } + + const bodyResult = definition.body.safeParse(rawBody); + if (!bodyResult.success) { + throw new ProtocolError("invalid_body", "Command body failed schema validation"); + } + + // 9. Enforce sensitive command policy + if (definition.sensitive && signerType !== "account") { + throw new ProtocolError( + "sensitive_requires_account_key", + "Sensitive command must be signed directly by an account key", + ); + } + + return { + header, + body: bodyResult.data, + signerType, + accountId, + ...(sessionId !== undefined ? { sessionId } : {}), + }; +} diff --git a/src/protocol/commands/core.ts b/src/protocol/commands/core.ts new file mode 100644 index 0000000..9f94f38 --- /dev/null +++ b/src/protocol/commands/core.ts @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; +import { CommandRegistry, defineCommand } from "../registry"; + +const serverIdBodySchema = z.object({ + server_id: z.string().min(1), +}); + +export const agentPingCommand = defineCommand({ + type: "agent.ping", + sensitive: false, + body: z.object({}).strict(), +}); + +export const serverStartCommand = defineCommand({ + type: "server.start", + sensitive: false, + body: serverIdBodySchema, +}); + +export const serverStopCommand = defineCommand({ + type: "server.stop", + sensitive: false, + body: serverIdBodySchema, +}); + +export const serverDeleteCommand = defineCommand({ + type: "server.delete", + sensitive: true, + body: serverIdBodySchema, +}); + +export const CORE_COMMANDS = [ + agentPingCommand, + serverStartCommand, + serverStopCommand, + serverDeleteCommand, +] as const; + +export function registerCoreCommands(registry: CommandRegistry): CommandRegistry { + return registry.registerAll(CORE_COMMANDS); +} + +export function createCoreRegistry(): CommandRegistry { + return registerCoreCommands(new CommandRegistry()); +} diff --git a/src/protocol/domains.ts b/src/protocol/domains.ts new file mode 100644 index 0000000..144ed3b --- /dev/null +++ b/src/protocol/domains.ts @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { ProtocolError } from "./errors"; + +export const PROTOCOL_VERSION = 1 as const; + +const utf8Encoder = new TextEncoder(); + +export const DOMAIN_COMMAND = utf8Encoder.encode("tegrad/command/v1\0"); +export const DOMAIN_SESSION = utf8Encoder.encode("tegrad/session/v1\0"); +export const DOMAIN_AGENT_MESSAGE = utf8Encoder.encode("tegrad/agent-message/v1\0"); +export const DOMAIN_REVOCATION = utf8Encoder.encode("tegrad/revocation/v1\0"); + +export function concatBytes(...parts: readonly Uint8Array[]): Uint8Array { + let total = 0; + for (const part of parts) { + total += part.length; + } + const out = new Uint8Array(total); + let offset = 0; + for (const part of parts) { + out.set(part, offset); + offset += part.length; + } + return out; +} + +export function assertSupportedVersion(value: unknown): void { + if (typeof value === "object" && value !== null && "v" in value) { + const version = (value as { v: unknown }).v; + if (version !== PROTOCOL_VERSION) { + throw new ProtocolError("unsupported_version", "Unsupported protocol version"); + } + } +} diff --git a/src/protocol/errors.ts b/src/protocol/errors.ts new file mode 100644 index 0000000..7c77e24 --- /dev/null +++ b/src/protocol/errors.ts @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +export type ProtocolErrorCode = + | "invalid_format" + | "unsupported_version" + | "wrong_agent" + | "wrong_recipient" + | "expired" + | "not_yet_valid" + | "ttl_too_long" + | "untrusted_signer" + | "bad_signature" + | "session_invalid" + | "session_revoked" + | "replayed" + | "unknown_command" + | "invalid_body" + | "sensitive_requires_account_key" + | "decrypt_failed"; + +export class ProtocolError extends Error { + readonly code: ProtocolErrorCode; + + constructor(code: ProtocolErrorCode, message: string) { + super(message); + this.name = "ProtocolError"; + this.code = code; + } +} diff --git a/src/protocol/index.ts b/src/protocol/index.ts new file mode 100644 index 0000000..101c93f --- /dev/null +++ b/src/protocol/index.ts @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +export { + type OpenedAgentMessage, + openAgentMessage, + type SealAgentMessageParams, + sealAgentMessage, +} from "./agent-message"; +export { + COMMAND_ID_BYTES, + type CreateSignedCommandParams, + createSignedCommand, + DEFAULT_COMMAND_TTL_MS, + MAX_CLOCK_SKEW_MS, + MAX_COMMAND_TTL_MS, + type OpenedCommand, + openCommand, +} from "./command"; +export { + agentPingCommand, + CORE_COMMANDS, + createCoreRegistry, + registerCoreCommands, + serverDeleteCommand, + serverStartCommand, + serverStopCommand, +} from "./commands/core"; +export { + DOMAIN_AGENT_MESSAGE, + DOMAIN_COMMAND, + DOMAIN_REVOCATION, + DOMAIN_SESSION, + PROTOCOL_VERSION, +} from "./domains"; +export { ProtocolError, type ProtocolErrorCode } from "./errors"; +export { type CommandDefinition, CommandRegistry, defineCommand } from "./registry"; +export { + type SignRevocationListParams, + signRevocationList, + verifyRevocationList, +} from "./revocation"; +export { + type AgentMessage, + type AgentMessageHeader, + agentMessageHeaderSchema, + agentMessageSchema, + base64UrlSchema, + type CommandHeader, + commandHeaderSchema, + type KeyId, + keyIdSchema, + type RevocationList, + revocationListSchema, + type SessionCertificate, + type SignedCommand, + sessionCertificateSchema, + signedCommandSchema, + type TransportFrame, + transportAckFrameSchema, + transportCommandFrameSchema, + transportEventFrameSchema, + transportFrameSchema, + transportPingFrameSchema, +} from "./schemas"; +export { + type SignSessionCertificateParams, + signSessionCertificate, + type VerifiedSessionCertificate, + verifySessionCertificate, +} from "./session"; +export { + createInMemoryTrustContext, + type InMemoryTrustContext, + type InMemoryTrustContextOptions, + type TrustContext, +} from "./trust"; diff --git a/src/protocol/protocol.test.ts b/src/protocol/protocol.test.ts new file mode 100644 index 0000000..c1e2120 --- /dev/null +++ b/src/protocol/protocol.test.ts @@ -0,0 +1,642 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { beforeAll, describe, expect, test } from "bun:test"; +import { + canonicalize, + fingerprint, + fromBase64Url, + generateSigningKeyPair, + ready, + sealTo, + sign, + signingKeyPairFromSeed, + toBase64Url, +} from "../crypto"; +import { + createCoreRegistry, + createInMemoryTrustContext, + createSignedCommand, + DOMAIN_COMMAND, + DOMAIN_SESSION, + MAX_COMMAND_TTL_MS, + openAgentMessage, + openCommand, + PROTOCOL_VERSION, + ProtocolError, + type ProtocolErrorCode, + sealAgentMessage, + signRevocationList, + signSessionCertificate, + transportFrameSchema, + verifyRevocationList, + verifySessionCertificate, +} from "./index"; + +const BASE_TIME = 1_700_000_000_000; + +beforeAll(async () => { + await ready(); +}); + +async function expectProtocolError( + promise: Promise, + expectedCode: ProtocolErrorCode, +): Promise { + try { + await promise; + throw new Error(`Expected ProtocolError(${expectedCode}), but succeeded`); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe(expectedCode); + } +} + +function makeFixture() { + const account = generateSigningKeyPair(); + const session = generateSigningKeyPair(); + const agent = generateSigningKeyPair(); + const registry = createCoreRegistry(); + const now = BASE_TIME; + + const sessionCert = signSessionCertificate({ + sessionPublicKey: session.publicKey, + accountKeyPair: account, + notBefore: now - 60_000, + notAfter: now + 3_600_000, + }); + + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [account.publicKey], + now: () => now, + }); + + return { account, session, agent, registry, sessionCert, trust, now }; +} + +describe("fixed protocol vector", () => { + test("canonical command header and Ed25519 signature match fixed vector", () => { + const account = signingKeyPairFromSeed(new Uint8Array(32).fill(0x11)); + const agent = signingKeyPairFromSeed(new Uint8Array(32).fill(0x22)); + + const header = { + v: PROTOCOL_VERSION, + id: "AAAAAAAAAAAAAAAAAAAAAA", + type: "server.start", + agent: fingerprint(agent.publicKey), + signer: fingerprint(account.publicKey), + issued_at: BASE_TIME, + expires_at: BASE_TIME + 300_000, + counter: 1, + }; + + const canonHeader = canonicalize(header); + expect(new TextDecoder().decode(canonHeader)).toBe( + '{"agent":"7sgisx6bisee5ge2gkt4x67uondk2ojg","counter":1,"expires_at":1700000300000,"id":"AAAAAAAAAAAAAAAAAAAAAA","issued_at":1700000000000,"signer":"2o6xl7gxm5sqizy645pzlypnplng2fun","type":"server.start","v":1}', + ); + + const fixedPayload = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]); + const input = new Uint8Array(DOMAIN_COMMAND.length + canonHeader.length + fixedPayload.length); + input.set(DOMAIN_COMMAND, 0); + input.set(canonHeader, DOMAIN_COMMAND.length); + input.set(fixedPayload, DOMAIN_COMMAND.length + canonHeader.length); + + const sig = sign(input, account.secretKey); + expect(toBase64Url(sig)).toBe( + "SI0IX7mt3GFTZirFUj5J_7fnMfgC9SW76UVlL77DnGkWxa9vq3o_hFeCF_JGKnSGld7mbeskTV7QyVso9s-NBg", + ); + }); +}); + +describe("happy paths", () => { + test("command signed by session key opens cleanly", async () => { + const { account, session, agent, registry, sessionCert, trust, now } = makeFixture(); + const cmd = createSignedCommand( + { + type: "server.start", + body: { server_id: "srv-1" }, + agentPublicKey: agent.publicKey, + signer: session, + session: sessionCert, + counter: 1, + now, + }, + registry, + ); + + const opened = await openCommand(cmd, trust, registry); + expect(opened.header.type).toBe("server.start"); + expect(opened.body).toEqual({ server_id: "srv-1" }); + expect(opened.signerType).toBe("session"); + expect(opened.accountId).toBe(fingerprint(account.publicKey)); + expect(opened.sessionId).toBe(sessionCert.id); + }); + + test("sensitive command signed directly by account key opens cleanly", async () => { + const { account, agent, registry, trust, now } = makeFixture(); + const cmd = createSignedCommand( + { + type: "server.delete", + body: { server_id: "srv-1" }, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now, + }, + registry, + ); + + const opened = await openCommand(cmd, trust, registry); + expect(opened.header.type).toBe("server.delete"); + expect(opened.body).toEqual({ server_id: "srv-1" }); + expect(opened.signerType).toBe("account"); + expect(opened.accountId).toBe(fingerprint(account.publicKey)); + expect(opened.sessionId).toBeUndefined(); + }); + + test("AgentMessage round-trip", () => { + const { account, agent, now } = makeFixture(); + const msg = sealAgentMessage({ + type: "server.status", + body: { server_id: "srv-1", status: "running" }, + agentKeyPair: agent, + recipientPublicKey: account.publicKey, + sentAt: now, + seq: 1, + }); + + const opened = openAgentMessage(msg, agent.publicKey, account); + expect(opened.header.type).toBe("server.status"); + expect(opened.header.seq).toBe(1); + expect(opened.body).toEqual({ server_id: "srv-1", status: "running" }); + }); + + test("RevocationList round-trip and SessionCertificate verification", () => { + const { account, sessionCert, now } = makeFixture(); + const verified = verifySessionCertificate(sessionCert, account.publicKey, now); + expect(verified.certificate.id).toBe(sessionCert.id); + + const revList = signRevocationList({ + accountKeyPair: account, + issuedAt: now, + revoked: [sessionCert.id], + }); + const verifiedRev = verifyRevocationList(revList, account.publicKey); + expect(verifiedRev.revoked).toEqual([sessionCert.id]); + }); + + test("TransportFrame validates command, event, ack, and ping frames", () => { + const { account, agent, registry, now } = makeFixture(); + const agentId = fingerprint(agent.publicKey); + const accountId = fingerprint(account.publicKey); + + const cmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now, + }, + registry, + ); + const event = sealAgentMessage({ + type: "agent.pong", + body: {}, + agentKeyPair: agent, + recipientPublicKey: account.publicKey, + sentAt: now, + seq: 1, + }); + + expect( + transportFrameSchema.safeParse({ + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: agentId }, + body: cmd, + }).success, + ).toBe(true); + + expect( + transportFrameSchema.safeParse({ + v: PROTOCOL_VERSION, + kind: "event", + route: { agent: agentId, recipient: accountId }, + body: event, + }).success, + ).toBe(true); + + expect( + transportFrameSchema.safeParse({ + v: PROTOCOL_VERSION, + kind: "ack", + route: { agent: agentId }, + body: { id: cmd.header.id, ok: true }, + }).success, + ).toBe(true); + + expect( + transportFrameSchema.safeParse({ + v: PROTOCOL_VERSION, + kind: "ping", + route: { agent: agentId }, + body: { ts: now }, + }).success, + ).toBe(true); + }); +}); + +describe("rejections", () => { + test("rejects tampered header", async () => { + const { account, agent, registry, trust, now } = makeFixture(); + const cmd = createSignedCommand( + { + type: "server.start", + body: { server_id: "srv-1" }, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now, + }, + registry, + ); + const tampered = { ...cmd, header: { ...cmd.header, counter: 2 } }; + await expectProtocolError(openCommand(tampered, trust, registry), "bad_signature"); + }); + + test("rejects tampered payload", async () => { + const { account, agent, registry, trust, now } = makeFixture(); + const cmd = createSignedCommand( + { + type: "server.start", + body: { server_id: "srv-1" }, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now, + }, + registry, + ); + const bytes = fromBase64Url(cmd.payload); + bytes[0] = (bytes[0] ?? 0) ^ 0xff; + const tampered = { ...cmd, payload: toBase64Url(bytes) }; + await expectProtocolError(openCommand(tampered, trust, registry), "bad_signature"); + }); + + test("rejects signature reused from another domain", async () => { + const { account, agent, registry, trust, now } = makeFixture(); + const cmd = createSignedCommand( + { + type: "server.start", + body: { server_id: "srv-1" }, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now, + }, + registry, + ); + const canonHeader = canonicalize(cmd.header); + const payloadBytes = fromBase64Url(cmd.payload); + const wrongDomainInput = new Uint8Array( + DOMAIN_SESSION.length + canonHeader.length + payloadBytes.length, + ); + wrongDomainInput.set(DOMAIN_SESSION, 0); + wrongDomainInput.set(canonHeader, DOMAIN_SESSION.length); + wrongDomainInput.set(payloadBytes, DOMAIN_SESSION.length + canonHeader.length); + + const wrongDomainSig = sign(wrongDomainInput, account.secretKey); + const forged = { ...cmd, sig: toBase64Url(wrongDomainSig) }; + await expectProtocolError(openCommand(forged, trust, registry), "bad_signature"); + }); + + test("rejects wrong agent", async () => { + const { account, registry, trust, now } = makeFixture(); + const otherAgent = generateSigningKeyPair(); + const cmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: otherAgent.publicKey, + signer: account, + counter: 1, + now, + }, + registry, + ); + await expectProtocolError(openCommand(cmd, trust, registry), "wrong_agent"); + }); + + test("rejects expired command", async () => { + const { account, agent, registry, trust, now } = makeFixture(); + const cmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now: now - 120_000, + ttlMs: 60_000, + }, + registry, + ); + await expectProtocolError(openCommand(cmd, trust, registry), "expired"); + }); + + test("rejects command issued in the future", async () => { + const { account, agent, registry, trust, now } = makeFixture(); + const cmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now: now + 120_000, + }, + registry, + ); + await expectProtocolError(openCommand(cmd, trust, registry), "not_yet_valid"); + }); + + test("rejects command with TTL exceeding maximum", async () => { + const { account, agent, registry, trust, now } = makeFixture(); + const cmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now, + ttlMs: MAX_COMMAND_TTL_MS + 1, + }, + registry, + ); + await expectProtocolError(openCommand(cmd, trust, registry), "ttl_too_long"); + }); + + test("rejects untrusted direct signer", async () => { + const { agent, registry, trust, now } = makeFixture(); + const stranger = generateSigningKeyPair(); + const cmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: stranger, + counter: 1, + now, + }, + registry, + ); + await expectProtocolError(openCommand(cmd, trust, registry), "untrusted_signer"); + }); + + test("rejects expired session certificate", async () => { + const { account, session, agent, registry, trust, now } = makeFixture(); + const expiredCert = signSessionCertificate({ + sessionPublicKey: session.publicKey, + accountKeyPair: account, + notBefore: now - 120_000, + notAfter: now - 1_000, + }); + const cmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: session, + session: expiredCert, + counter: 1, + now, + }, + registry, + ); + await expectProtocolError(openCommand(cmd, trust, registry), "session_invalid"); + }); + + test("rejects revoked session certificate", async () => { + const { session, agent, registry, sessionCert, trust, now } = makeFixture(); + trust.revokeSession(sessionCert.id); + const cmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: session, + session: sessionCert, + counter: 1, + now, + }, + registry, + ); + await expectProtocolError(openCommand(cmd, trust, registry), "session_revoked"); + }); + + test("rejects session certificate signed by untrusted account key", async () => { + const { session, agent, registry, trust, now } = makeFixture(); + const untrustedAccount = generateSigningKeyPair(); + const cert = signSessionCertificate({ + sessionPublicKey: session.publicKey, + accountKeyPair: untrustedAccount, + notBefore: now - 60_000, + notAfter: now + 60_000, + }); + const cmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: session, + session: cert, + counter: 1, + now, + }, + registry, + ); + await expectProtocolError(openCommand(cmd, trust, registry), "untrusted_signer"); + }); + + test("rejects replay of the same command id", async () => { + const { account, agent, registry, trust, now } = makeFixture(); + const cmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now, + }, + registry, + ); + await openCommand(cmd, trust, registry); + await expectProtocolError(openCommand(cmd, trust, registry), "replayed"); + }); + + test("rejects regressing counter and does not consume counter on invalid signature", async () => { + const { account, agent, registry, trust, now } = makeFixture(); + + const forgedHighCounter = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 100, + now, + }, + registry, + ); + const badSigBytes = fromBase64Url(forgedHighCounter.sig); + badSigBytes[0] = (badSigBytes[0] ?? 0) ^ 0xff; + await expectProtocolError( + openCommand({ ...forgedHighCounter, sig: toBase64Url(badSigBytes) }, trust, registry), + "bad_signature", + ); + + const valid5 = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 5, + now, + }, + registry, + ); + await openCommand(valid5, trust, registry); + + const regressed4 = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 4, + now, + }, + registry, + ); + await expectProtocolError(openCommand(regressed4, trust, registry), "replayed"); + }); + + test("rejects unsupported protocol version", async () => { + const { account, agent, registry, trust, now } = makeFixture(); + const cmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now, + }, + registry, + ); + const v2 = { ...cmd, header: { ...cmd.header, v: 2 } }; + await expectProtocolError(openCommand(v2, trust, registry), "unsupported_version"); + }); + + test("rejects unknown command type", async () => { + const { account, agent, registry, trust, now } = makeFixture(); + const header = { + v: PROTOCOL_VERSION, + id: "AAAAAAAAAAAAAAAAAAAAAA", + type: "server.unknown", + agent: fingerprint(agent.publicKey), + signer: fingerprint(account.publicKey), + issued_at: now, + expires_at: now + 60_000, + counter: 1, + }; + const payloadBytes = sealTo(canonicalize({}), agent.publicKey); + const canonHeader = canonicalize(header); + const input = new Uint8Array(DOMAIN_COMMAND.length + canonHeader.length + payloadBytes.length); + input.set(DOMAIN_COMMAND, 0); + input.set(canonHeader, DOMAIN_COMMAND.length); + input.set(payloadBytes, DOMAIN_COMMAND.length + canonHeader.length); + const cmd = { + header, + payload: toBase64Url(payloadBytes), + sig: toBase64Url(sign(input, account.secretKey)), + }; + await expectProtocolError(openCommand(cmd, trust, registry), "unknown_command"); + }); + + test("rejects body not matching command schema", async () => { + const { account, agent, registry, trust, now } = makeFixture(); + const header = { + v: PROTOCOL_VERSION, + id: "AAAAAAAAAAAAAAAAAAAAAA", + type: "server.start", + agent: fingerprint(agent.publicKey), + signer: fingerprint(account.publicKey), + issued_at: now, + expires_at: now + 60_000, + counter: 1, + }; + const payloadBytes = sealTo(canonicalize({ wrong_field: 123 }), agent.publicKey); + const canonHeader = canonicalize(header); + const input = new Uint8Array(DOMAIN_COMMAND.length + canonHeader.length + payloadBytes.length); + input.set(DOMAIN_COMMAND, 0); + input.set(canonHeader, DOMAIN_COMMAND.length); + input.set(payloadBytes, DOMAIN_COMMAND.length + canonHeader.length); + const cmd = { + header, + payload: toBase64Url(payloadBytes), + sig: toBase64Url(sign(input, account.secretKey)), + }; + await expectProtocolError(openCommand(cmd, trust, registry), "invalid_body"); + }); + + test("rejects sensitive command signed by session key", async () => { + const { session, agent, registry, sessionCert, trust, now } = makeFixture(); + const cmd = createSignedCommand( + { + type: "server.delete", + body: { server_id: "srv-1" }, + agentPublicKey: agent.publicKey, + signer: session, + session: sessionCert, + counter: 1, + now, + }, + registry, + ); + await expectProtocolError(openCommand(cmd, trust, registry), "sensitive_requires_account_key"); + }); + + test("rejects decryption failure when payload is sealed for wrong key", async () => { + const { account, agent, registry, trust, now } = makeFixture(); + const wrongRecipient = generateSigningKeyPair(); + const header = { + v: PROTOCOL_VERSION, + id: "AAAAAAAAAAAAAAAAAAAAAA", + type: "agent.ping", + agent: fingerprint(agent.publicKey), + signer: fingerprint(account.publicKey), + issued_at: now, + expires_at: now + 60_000, + counter: 1, + }; + const payloadBytes = sealTo(canonicalize({}), wrongRecipient.publicKey); + const canonHeader = canonicalize(header); + const input = new Uint8Array(DOMAIN_COMMAND.length + canonHeader.length + payloadBytes.length); + input.set(DOMAIN_COMMAND, 0); + input.set(canonHeader, DOMAIN_COMMAND.length); + input.set(payloadBytes, DOMAIN_COMMAND.length + canonHeader.length); + const cmd = { + header, + payload: toBase64Url(payloadBytes), + sig: toBase64Url(sign(input, account.secretKey)), + }; + await expectProtocolError(openCommand(cmd, trust, registry), "decrypt_failed"); + }); +}); diff --git a/src/protocol/registry.ts b/src/protocol/registry.ts new file mode 100644 index 0000000..63bc671 --- /dev/null +++ b/src/protocol/registry.ts @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import type { z } from "zod"; + +export interface CommandDefinition { + readonly type: TType; + readonly sensitive: boolean; + readonly body: z.ZodType; +} + +export function defineCommand(definition: { + readonly type: TType; + readonly sensitive: boolean; + readonly body: z.ZodType; +}): CommandDefinition { + return { + type: definition.type, + sensitive: definition.sensitive, + body: definition.body, + }; +} + +export class CommandRegistry { + readonly #commands = new Map(); + + register(definition: CommandDefinition): this { + if (this.#commands.has(definition.type)) { + throw new Error(`Command already registered: ${definition.type}`); + } + this.#commands.set(definition.type, definition); + return this; + } + + registerAll(definitions: readonly CommandDefinition[]): this { + for (const definition of definitions) { + this.register(definition); + } + return this; + } + + get(type: string): CommandDefinition | undefined { + return this.#commands.get(type); + } + + has(type: string): boolean { + return this.#commands.has(type); + } + + types(): string[] { + return [...this.#commands.keys()]; + } +} diff --git a/src/protocol/revocation.ts b/src/protocol/revocation.ts new file mode 100644 index 0000000..d5ad1cc --- /dev/null +++ b/src/protocol/revocation.ts @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { + canonicalize, + fingerprint, + fromBase64Url, + type PublicKey, + type SigningKeyPair, + sign, + toBase64Url, + verify, +} from "../crypto"; +import { + assertSupportedVersion, + concatBytes, + DOMAIN_REVOCATION, + PROTOCOL_VERSION, +} from "./domains"; +import { ProtocolError } from "./errors"; +import { type RevocationList, revocationListSchema } from "./schemas"; + +export interface SignRevocationListParams { + readonly accountKeyPair: SigningKeyPair; + readonly issuedAt: number; + readonly revoked: readonly string[]; +} + +export function signRevocationList(params: SignRevocationListParams): RevocationList { + if (!Number.isSafeInteger(params.issuedAt) || params.issuedAt < 0) { + throw new RangeError("issuedAt must be a non-negative safe integer"); + } + + const unsigned = { + v: PROTOCOL_VERSION, + account: fingerprint(params.accountKeyPair.publicKey), + issued_at: params.issuedAt, + revoked: [...params.revoked], + }; + + const signingInput = concatBytes(DOMAIN_REVOCATION, canonicalize(unsigned)); + const signature = sign(signingInput, params.accountKeyPair.secretKey); + + return { + ...unsigned, + sig: toBase64Url(signature), + }; +} + +export function verifyRevocationList(list: unknown, accountPublicKey: PublicKey): RevocationList { + assertSupportedVersion(list); + + const parsed = revocationListSchema.safeParse(list); + if (!parsed.success) { + throw new ProtocolError("invalid_format", "Malformed revocation list"); + } + + const data = parsed.data; + if (data.account !== fingerprint(accountPublicKey)) { + throw new ProtocolError("untrusted_signer", "Revocation list account mismatch"); + } + + let signatureBytes: Uint8Array; + try { + signatureBytes = fromBase64Url(data.sig); + } catch { + throw new ProtocolError("bad_signature", "Invalid revocation list signature encoding"); + } + + const { sig: _sig, ...unsigned } = data; + const signingInput = concatBytes(DOMAIN_REVOCATION, canonicalize(unsigned)); + if (!verify(signingInput, signatureBytes, accountPublicKey)) { + throw new ProtocolError("bad_signature", "Invalid revocation list signature"); + } + + return data; +} diff --git a/src/protocol/schemas.ts b/src/protocol/schemas.ts new file mode 100644 index 0000000..d39f467 --- /dev/null +++ b/src/protocol/schemas.ts @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; +import { PROTOCOL_VERSION } from "./domains"; + +export const keyIdSchema = z.string().regex(/^[a-z2-7]{32}$/, "Invalid KeyId"); +export type KeyId = z.infer; + +export const base64UrlSchema = z + .string() + .min(1) + .regex(/^[A-Za-z0-9_-]+$/, "Invalid base64url"); + +export const sessionCertificateSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + session_key: base64UrlSchema, + account: keyIdSchema, + not_before: z.number().int().nonnegative(), + not_after: z.number().int().nonnegative(), + id: base64UrlSchema, + sig: base64UrlSchema, +}); +export type SessionCertificate = z.infer; + +export const commandHeaderSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + id: base64UrlSchema, + type: z.string().min(1), + agent: keyIdSchema, + signer: keyIdSchema, + issued_at: z.number().int().nonnegative(), + expires_at: z.number().int().nonnegative(), + counter: z.number().int().nonnegative(), +}); +export type CommandHeader = z.infer; + +export const signedCommandSchema = z.object({ + header: commandHeaderSchema, + payload: base64UrlSchema, + session: sessionCertificateSchema.optional(), + sig: base64UrlSchema, +}); +export type SignedCommand = z.infer; + +export const agentMessageHeaderSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + id: base64UrlSchema, + type: z.string().min(1), + agent: keyIdSchema, + recipient: keyIdSchema, + sent_at: z.number().int().nonnegative(), + seq: z.number().int().nonnegative(), +}); +export type AgentMessageHeader = z.infer; + +export const agentMessageSchema = z.object({ + header: agentMessageHeaderSchema, + payload: base64UrlSchema, + sig: base64UrlSchema, +}); +export type AgentMessage = z.infer; + +export const revocationListSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + account: keyIdSchema, + issued_at: z.number().int().nonnegative(), + revoked: z.array(base64UrlSchema), + sig: base64UrlSchema, +}); +export type RevocationList = z.infer; + +export const transportCommandFrameSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + kind: z.literal("command"), + route: z.object({ + agent: keyIdSchema, + }), + body: signedCommandSchema, +}); + +export const transportEventFrameSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + kind: z.literal("event"), + route: z.object({ + agent: keyIdSchema, + recipient: keyIdSchema, + }), + body: agentMessageSchema, +}); + +export const transportAckFrameSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + kind: z.literal("ack"), + route: z.object({ + agent: keyIdSchema, + }), + body: z.object({ + id: base64UrlSchema, + ok: z.boolean(), + code: z.string().optional(), + }), +}); + +export const transportPingFrameSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + kind: z.literal("ping"), + route: z.object({ + agent: keyIdSchema, + }), + body: z.object({ + ts: z.number().int().nonnegative(), + }), +}); + +export const transportFrameSchema = z.discriminatedUnion("kind", [ + transportCommandFrameSchema, + transportEventFrameSchema, + transportAckFrameSchema, + transportPingFrameSchema, +]); +export type TransportFrame = z.infer; diff --git a/src/protocol/session.ts b/src/protocol/session.ts new file mode 100644 index 0000000..c609c74 --- /dev/null +++ b/src/protocol/session.ts @@ -0,0 +1,110 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { + canonicalize, + fingerprint, + fromBase64Url, + type PublicKey, + randomBytes, + SIGNING_PUBLIC_KEY_BYTES, + type SigningKeyPair, + sign, + toBase64Url, + verify, +} from "../crypto"; +import { assertSupportedVersion, concatBytes, DOMAIN_SESSION, PROTOCOL_VERSION } from "./domains"; +import { ProtocolError } from "./errors"; +import { type SessionCertificate, sessionCertificateSchema } from "./schemas"; + +export interface SignSessionCertificateParams { + readonly sessionPublicKey: PublicKey; + readonly accountKeyPair: SigningKeyPair; + readonly notBefore: number; + readonly notAfter: number; + readonly id?: string; +} + +export interface VerifiedSessionCertificate { + readonly certificate: SessionCertificate; + readonly sessionPublicKey: PublicKey; +} + +export function signSessionCertificate(params: SignSessionCertificateParams): SessionCertificate { + if (params.sessionPublicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new RangeError(`Session public key must be ${SIGNING_PUBLIC_KEY_BYTES} bytes`); + } + if (!Number.isSafeInteger(params.notBefore) || !Number.isSafeInteger(params.notAfter)) { + throw new RangeError("Session validity timestamps must be safe integers"); + } + if (params.notBefore < 0 || params.notAfter <= params.notBefore) { + throw new RangeError("Invalid session certificate validity window"); + } + + const unsigned = { + v: PROTOCOL_VERSION, + session_key: toBase64Url(params.sessionPublicKey), + account: fingerprint(params.accountKeyPair.publicKey), + not_before: params.notBefore, + not_after: params.notAfter, + id: params.id ?? toBase64Url(randomBytes(16)), + }; + + const signingInput = concatBytes(DOMAIN_SESSION, canonicalize(unsigned)); + const signature = sign(signingInput, params.accountKeyPair.secretKey); + + return { + ...unsigned, + sig: toBase64Url(signature), + }; +} + +export function verifySessionCertificate( + certificate: unknown, + accountPublicKey: PublicKey, + atTime?: number, +): VerifiedSessionCertificate { + assertSupportedVersion(certificate); + + const parsed = sessionCertificateSchema.safeParse(certificate); + if (!parsed.success) { + throw new ProtocolError("session_invalid", "Malformed session certificate"); + } + + const cert = parsed.data; + if (cert.account !== fingerprint(accountPublicKey)) { + throw new ProtocolError("session_invalid", "Session certificate account mismatch"); + } + + if (cert.not_after <= cert.not_before) { + throw new ProtocolError("session_invalid", "Session certificate has invalid validity window"); + } + + if (atTime !== undefined && (atTime < cert.not_before || atTime >= cert.not_after)) { + throw new ProtocolError("session_invalid", "Session certificate is not valid at this time"); + } + + let sessionPublicKey: Uint8Array; + let signatureBytes: Uint8Array; + try { + sessionPublicKey = fromBase64Url(cert.session_key); + signatureBytes = fromBase64Url(cert.sig); + } catch { + throw new ProtocolError("session_invalid", "Invalid base64url encoding in session certificate"); + } + + if (sessionPublicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new ProtocolError("session_invalid", "Invalid session public key length"); + } + + const { sig: _sig, ...unsigned } = cert; + const signingInput = concatBytes(DOMAIN_SESSION, canonicalize(unsigned)); + if (!verify(signingInput, signatureBytes, accountPublicKey)) { + throw new ProtocolError("session_invalid", "Invalid session certificate signature"); + } + + return { + certificate: cert, + sessionPublicKey, + }; +} diff --git a/src/protocol/trust.ts b/src/protocol/trust.ts new file mode 100644 index 0000000..5f1ede5 --- /dev/null +++ b/src/protocol/trust.ts @@ -0,0 +1,76 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { fingerprint, type PublicKey, type SigningKeyPair } from "../crypto"; +import type { KeyId } from "./schemas"; + +export interface TrustContext { + readonly agentKeyPair: SigningKeyPair; + isTrustedAccountKey(id: KeyId): PublicKey | null; + isSessionRevoked(certificateId: string): boolean; + now(): number; + claimCommand(signer: KeyId, id: string, counter: number): boolean; +} + +export interface InMemoryTrustContextOptions { + readonly agentKeyPair: SigningKeyPair; + readonly trustedAccountKeys: readonly PublicKey[]; + readonly revokedSessionIds?: Iterable; + readonly now?: () => number; +} + +export interface InMemoryTrustContext extends TrustContext { + revokeSession(certificateId: string): void; + setNow(clock: () => number): void; +} + +export function createInMemoryTrustContext( + options: InMemoryTrustContextOptions, +): InMemoryTrustContext { + const trusted = new Map(); + for (const key of options.trustedAccountKeys) { + trusted.set(fingerprint(key), key); + } + + const revoked = new Set(options.revokedSessionIds); + const seenIds = new Set(); + const lastCounters = new Map(); + let clock = options.now ?? (() => Date.now()); + + return { + agentKeyPair: options.agentKeyPair, + + isTrustedAccountKey(id: KeyId): PublicKey | null { + return trusted.get(id) ?? null; + }, + + isSessionRevoked(certificateId: string): boolean { + return revoked.has(certificateId); + }, + + now(): number { + return clock(); + }, + + claimCommand(signer: KeyId, id: string, counter: number): boolean { + if (seenIds.has(id)) { + return false; + } + const prev = lastCounters.get(signer); + if (prev !== undefined && counter <= prev) { + return false; + } + seenIds.add(id); + lastCounters.set(signer, counter); + return true; + }, + + revokeSession(certificateId: string): void { + revoked.add(certificateId); + }, + + setNow(nextClock: () => number): void { + clock = nextClock; + }, + }; +} From b4ead1a7e6f5702b43dda095eb7b6887fe86a5a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 22 Nov 2026 18:55:32 -0300 Subject: [PATCH 02/59] feat: add agent runtime, state store, websocket client, command queue, and CLI --- src/agent/connection.test.ts | 385 ++++++++++++++++++++++++ src/agent/connection.ts | 478 ++++++++++++++++++++++++++++++ src/agent/index.ts | 76 +++++ src/agent/jobs.test.ts | 441 +++++++++++++++++++++++++++ src/agent/jobs.ts | 229 ++++++++++++++ src/agent/logger.test.ts | 95 ++++++ src/agent/logger.ts | 156 ++++++++++ src/agent/no-inbound-port.test.ts | 32 ++ src/agent/paths.ts | 50 ++++ src/agent/state.test.ts | 210 +++++++++++++ src/agent/state.ts | 453 ++++++++++++++++++++++++++++ src/cli/args.ts | 62 ++++ src/cli/cli.test.ts | 117 ++++++++ src/cli/e2e.test.ts | 152 ++++++++++ src/cli/main.ts | 101 +++++++ src/cli/run.ts | 150 ++++++++++ src/index.ts | 11 +- 17 files changed, 3191 insertions(+), 7 deletions(-) create mode 100644 src/agent/connection.test.ts create mode 100644 src/agent/connection.ts create mode 100644 src/agent/index.ts create mode 100644 src/agent/jobs.test.ts create mode 100644 src/agent/jobs.ts create mode 100644 src/agent/logger.test.ts create mode 100644 src/agent/logger.ts create mode 100644 src/agent/no-inbound-port.test.ts create mode 100644 src/agent/paths.ts create mode 100644 src/agent/state.test.ts create mode 100644 src/agent/state.ts create mode 100644 src/cli/args.ts create mode 100644 src/cli/cli.test.ts create mode 100644 src/cli/e2e.test.ts create mode 100644 src/cli/main.ts create mode 100644 src/cli/run.ts diff --git a/src/agent/connection.test.ts b/src/agent/connection.test.ts new file mode 100644 index 0000000..f0e8927 --- /dev/null +++ b/src/agent/connection.test.ts @@ -0,0 +1,385 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { describe, expect, test } from "bun:test"; +import { PROTOCOL_VERSION, type TransportFrame } from "../protocol"; +import { + buildConnectUrl, + computeBackoffDelayMs, + createAgentConnection, + HEARTBEAT_INTERVAL_MS, + IDLE_TIMEOUT_MS, + MAX_INBOUND_MESSAGE_BYTES, + MAX_OUTBOUND_QUEUE, + STABLE_CONNECTION_MS, + type TimerProvider, + type WebSocketCloseEventLike, + type WebSocketLike, + type WebSocketMessageEventLike, + WS_READY_STATE_CLOSED, + WS_READY_STATE_CONNECTING, + WS_READY_STATE_OPEN, +} from "./connection"; +import { createLogger } from "./logger"; + +const AGENT_ID = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + +class FakeSocket implements WebSocketLike { + readyState: number = WS_READY_STATE_CONNECTING; + onopen: (() => void) | null = null; + onmessage: ((event: WebSocketMessageEventLike) => void) | null = null; + onclose: ((event: WebSocketCloseEventLike) => void) | null = null; + onerror: ((event: unknown) => void) | null = null; + readonly sent: string[] = []; + readonly closeCalls: { code?: number; reason?: string }[] = []; + + constructor(readonly url: string) {} + + send(data: string): void { + if (this.readyState !== WS_READY_STATE_OPEN) { + throw new Error("Socket not open"); + } + this.sent.push(data); + } + + close(code?: number, reason?: string): void { + this.closeCalls.push({ + ...(code !== undefined ? { code } : {}), + ...(reason !== undefined ? { reason } : {}), + }); + if (this.readyState === WS_READY_STATE_CLOSED) { + return; + } + this.readyState = WS_READY_STATE_CLOSED; + this.onclose?.({ + ...(code !== undefined ? { code } : {}), + ...(reason !== undefined ? { reason } : {}), + }); + } + + triggerOpen(): void { + this.readyState = WS_READY_STATE_OPEN; + this.onopen?.(); + } + + triggerMessage(data: unknown): void { + this.onmessage?.({ data }); + } + + triggerDrop(code = 1006, reason = "dropped"): void { + this.readyState = WS_READY_STATE_CLOSED; + this.onclose?.({ code, reason }); + } +} + +interface ScheduledTimer { + id: number; + runAt: number; + intervalMs: number | null; + fn: () => void; + cleared: boolean; +} + +class FakeTimers implements TimerProvider { + private currentTime = 1_700_000_000_000; + private nextId = 1; + private readonly timers = new Map(); + + setTimeout(fn: () => void, ms: number): number { + const id = this.nextId++; + this.timers.set(id, { + id, + runAt: this.currentTime + ms, + intervalMs: null, + fn, + cleared: false, + }); + return id; + } + + clearTimeout(handle: unknown): void { + const entry = this.timers.get(handle as number); + if (entry) { + entry.cleared = true; + this.timers.delete(entry.id); + } + } + + setInterval(fn: () => void, ms: number): number { + const id = this.nextId++; + this.timers.set(id, { + id, + runAt: this.currentTime + ms, + intervalMs: ms, + fn, + cleared: false, + }); + return id; + } + + clearInterval(handle: unknown): void { + this.clearTimeout(handle); + } + + now(): number { + return this.currentTime; + } + + advance(ms: number): void { + const target = this.currentTime + ms; + while (true) { + let next: ScheduledTimer | null = null; + for (const t of this.timers.values()) { + if (t.cleared || t.runAt > target) continue; + if (next === null || t.runAt < next.runAt) { + next = t; + } + } + if (next === null) { + break; + } + this.currentTime = next.runAt; + if (next.intervalMs !== null) { + next.runAt += next.intervalMs; + } else { + this.timers.delete(next.id); + } + next.fn(); + } + this.currentTime = target; + } + + activeCount(): number { + return this.timers.size; + } +} + +function makeLogger(logs: string[] = []) { + return createLogger({ + level: "debug", + stdout: (line) => logs.push(line), + stderr: (line) => logs.push(line), + }); +} + +function makePingFrame(ts: number): TransportFrame { + return { + v: PROTOCOL_VERSION, + kind: "ping", + route: { agent: AGENT_ID }, + body: { ts }, + }; +} + +async function flushMicrotasks(): Promise { + await Promise.resolve(); + await Promise.resolve(); +} + +describe("connection", () => { + test("buildConnectUrl converts https/http to wss/ws with agent query param", () => { + expect(buildConnectUrl("https://api.tegra.example", AGENT_ID)).toBe( + `wss://api.tegra.example/agents/connect?agent=${AGENT_ID}`, + ); + expect(buildConnectUrl("http://127.0.0.1:8080/v1/", AGENT_ID)).toBe( + `ws://127.0.0.1:8080/v1/agents/connect?agent=${AGENT_ID}`, + ); + }); + + test("computeBackoffDelayMs scales exponentially with jitter within range and caps at 60s", () => { + expect(computeBackoffDelayMs(0, () => 0)).toBe(800); + expect(computeBackoffDelayMs(0, () => 0.5)).toBe(1000); + expect(computeBackoffDelayMs(0, () => 1)).toBe(1200); + expect(computeBackoffDelayMs(1, () => 0.5)).toBe(2000); + expect(computeBackoffDelayMs(2, () => 0.5)).toBe(4000); + expect(computeBackoffDelayMs(10, () => 1)).toBe(60_000); + }); + + test("reconnects with exponential backoff and resets backoff after stable connection", async () => { + const timers = new FakeTimers(); + const sockets: FakeSocket[] = []; + const conn = createAgentConnection({ + apiUrl: "https://api.tegra.example", + agentId: AGENT_ID, + logger: makeLogger(), + onFrame: () => {}, + webSocketFactory: (url) => { + const ws = new FakeSocket(url); + sockets.push(ws); + return ws; + }, + timers, + random: () => 0.5, // exact base backoff: 1000, 2000, 4000... + }); + + conn.start(); + expect(sockets.length).toBe(1); + + // Drop #1 -> reconnect after 1000ms + sockets[0]?.triggerDrop(); + timers.advance(999); + expect(sockets.length).toBe(1); + timers.advance(1); + expect(sockets.length).toBe(2); + + // Drop #2 -> reconnect after 2000ms + sockets[1]?.triggerDrop(); + timers.advance(1999); + expect(sockets.length).toBe(2); + timers.advance(1); + expect(sockets.length).toBe(3); + + // Connect and stay stable for 30s -> backoff resets to 1000ms + sockets[2]?.triggerOpen(); + await flushMicrotasks(); + timers.advance(STABLE_CONNECTION_MS); + + sockets[2]?.triggerDrop(); + timers.advance(999); + expect(sockets.length).toBe(3); + timers.advance(1); + expect(sockets.length).toBe(4); + + conn.stop(); + expect(timers.activeCount()).toBe(0); + }); + + test("sends heartbeat pings every 25s and reconnects after 75s without inbound traffic", async () => { + const timers = new FakeTimers(); + const sockets: FakeSocket[] = []; + const received: TransportFrame[] = []; + + const conn = createAgentConnection({ + apiUrl: "https://api.tegra.example", + agentId: AGENT_ID, + logger: makeLogger(), + onFrame: (frame) => received.push(frame), + webSocketFactory: (url) => { + const ws = new FakeSocket(url); + sockets.push(ws); + return ws; + }, + timers, + random: () => 0.5, + }); + + conn.start(); + sockets[0]?.triggerOpen(); + await flushMicrotasks(); + + timers.advance(HEARTBEAT_INTERVAL_MS); + expect(sockets[0]?.sent.length).toBe(1); + const ping = JSON.parse(sockets[0]?.sent[0] ?? "") as TransportFrame; + expect(ping.kind).toBe("ping"); + + // Advance remaining time up to 75s with no inbound frames -> connection torn down + timers.advance(IDLE_TIMEOUT_MS - HEARTBEAT_INTERVAL_MS); + expect(sockets[0]?.readyState).toBe(WS_READY_STATE_CLOSED); + + // After backoff (1000ms), reconnects + timers.advance(1000); + expect(sockets.length).toBe(2); + + // Inbound traffic resets idle timer + sockets[1]?.triggerOpen(); + await flushMicrotasks(); + timers.advance(50_000); + sockets[1]?.triggerMessage(JSON.stringify(makePingFrame(timers.now()))); + expect(received.length).toBe(1); + timers.advance(50_000); + expect(sockets[1]?.readyState).toBe(WS_READY_STATE_OPEN); + + conn.stop(); + }); + + test("discards invalid frames and oversized messages without dropping the connection", async () => { + const timers = new FakeTimers(); + const sockets: FakeSocket[] = []; + const received: TransportFrame[] = []; + const logs: string[] = []; + + const conn = createAgentConnection({ + apiUrl: "https://api.tegra.example", + agentId: AGENT_ID, + logger: makeLogger(logs), + onFrame: (frame) => received.push(frame), + webSocketFactory: (url) => { + const ws = new FakeSocket(url); + sockets.push(ws); + return ws; + }, + timers, + }); + + conn.start(); + sockets[0]?.triggerOpen(); + await flushMicrotasks(); + + // Bad JSON + sockets[0]?.triggerMessage("{broken"); + // Valid JSON, invalid TransportFrame + sockets[0]?.triggerMessage(JSON.stringify({ kind: "unknown" })); + // Oversized message (> 1 MiB) + sockets[0]?.triggerMessage("x".repeat(MAX_INBOUND_MESSAGE_BYTES + 1)); + + expect(received.length).toBe(0); + expect(conn.isConnected()).toBe(true); + expect(logs.filter((l) => l.includes('"level":"warn"')).length).toBe(3); + + // Connection still accepts valid frames afterwards + sockets[0]?.triggerMessage(JSON.stringify(makePingFrame(timers.now()))); + expect(received.length).toBe(1); + + conn.stop(); + }); + + test("queues outbound frames while disconnected up to 256 and flushes after authenticate on reconnect", async () => { + const timers = new FakeTimers(); + const sockets: FakeSocket[] = []; + let authCalls = 0; + + const conn = createAgentConnection({ + apiUrl: "https://api.tegra.example", + agentId: AGENT_ID, + logger: makeLogger(), + onFrame: () => {}, + authenticate: async () => { + authCalls++; + }, + webSocketFactory: (url) => { + const ws = new FakeSocket(url); + sockets.push(ws); + return ws; + }, + timers, + }); + + // Send 260 frames while disconnected -> oldest 4 discarded, 256 kept + for (let i = 1; i <= MAX_OUTBOUND_QUEUE + 4; i++) { + expect(conn.send(makePingFrame(i))).toBe(false); + } + expect(conn.getQueuedCount()).toBe(MAX_OUTBOUND_QUEUE); + + conn.start(); + sockets[0]?.triggerOpen(); + await flushMicrotasks(); + + expect(authCalls).toBe(1); + expect(conn.getQueuedCount()).toBe(0); + expect(sockets[0]?.sent.length).toBe(MAX_OUTBOUND_QUEUE); + + const firstFlushed = JSON.parse(sockets[0]?.sent[0] ?? "") as Extract< + TransportFrame, + { kind: "ping" } + >; + const lastFlushed = JSON.parse(sockets[0]?.sent[MAX_OUTBOUND_QUEUE - 1] ?? "") as Extract< + TransportFrame, + { kind: "ping" } + >; + + expect(firstFlushed.body.ts).toBe(5); + expect(lastFlushed.body.ts).toBe(MAX_OUTBOUND_QUEUE + 4); + + conn.stop(); + }); +}); diff --git a/src/agent/connection.ts b/src/agent/connection.ts new file mode 100644 index 0000000..2a84d67 --- /dev/null +++ b/src/agent/connection.ts @@ -0,0 +1,478 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { + type KeyId, + PROTOCOL_VERSION, + type TransportFrame, + transportFrameSchema, +} from "../protocol"; +import type { Logger } from "./logger"; + +export const AGENT_CONNECT_PATH = "/agents/connect"; +export const MAX_INBOUND_MESSAGE_BYTES = 1024 * 1024; +export const MAX_OUTBOUND_QUEUE = 256; +export const INITIAL_BACKOFF_MS = 1_000; +export const MAX_BACKOFF_MS = 60_000; +export const STABLE_CONNECTION_MS = 30_000; +export const HEARTBEAT_INTERVAL_MS = 25_000; +export const IDLE_TIMEOUT_MS = 75_000; + +export const WS_READY_STATE_CONNECTING = 0; +export const WS_READY_STATE_OPEN = 1; +export const WS_READY_STATE_CLOSING = 2; +export const WS_READY_STATE_CLOSED = 3; + +export interface WebSocketMessageEventLike { + readonly data: unknown; +} + +export interface WebSocketCloseEventLike { + readonly code?: number; + readonly reason?: string; +} + +export interface WebSocketLike { + readonly readyState: number; + onopen: (() => void) | null; + onmessage: ((event: WebSocketMessageEventLike) => void) | null; + onclose: ((event: WebSocketCloseEventLike) => void) | null; + onerror: ((event: unknown) => void) | null; + send(data: string): void; + close(code?: number, reason?: string): void; +} + +export type WebSocketFactory = (url: string) => WebSocketLike; + +export type TimerHandle = unknown; + +export interface TimerProvider { + setTimeout(fn: () => void, ms: number): TimerHandle; + clearTimeout(handle: TimerHandle): void; + setInterval(fn: () => void, ms: number): TimerHandle; + clearInterval(handle: TimerHandle): void; + now(): number; +} + +export const defaultTimers: TimerProvider = { + setTimeout: (fn, ms) => setTimeout(fn, ms), + clearTimeout: (handle) => clearTimeout(handle as ReturnType), + setInterval: (fn, ms) => setInterval(fn, ms), + clearInterval: (handle) => clearInterval(handle as ReturnType), + now: () => Date.now(), +}; + +export function createDefaultWebSocket(url: string): WebSocketLike { + const ws = new WebSocket(url); + const adapter: WebSocketLike = { + get readyState() { + return ws.readyState; + }, + onopen: null, + onmessage: null, + onclose: null, + onerror: null, + send(data: string) { + ws.send(data); + }, + close(code?: number, reason?: string) { + ws.close(code, reason); + }, + }; + + ws.addEventListener("open", () => { + adapter.onopen?.(); + }); + ws.addEventListener("message", (event) => { + adapter.onmessage?.({ data: event.data }); + }); + ws.addEventListener("close", (event) => { + adapter.onclose?.({ code: event.code, reason: event.reason }); + }); + ws.addEventListener("error", (event) => { + adapter.onerror?.(event); + }); + + return adapter; +} + +export function buildConnectUrl(apiUrl: string, agentId: KeyId): string { + const url = new URL(apiUrl); + if (url.protocol === "https:") { + url.protocol = "wss:"; + } else if (url.protocol === "http:") { + url.protocol = "ws:"; + } else { + throw new Error(`Unsupported api_url protocol: ${url.protocol}`); + } + + const basePath = url.pathname.replace(/\/+$/, ""); + url.pathname = `${basePath}${AGENT_CONNECT_PATH}`; + url.search = ""; + url.searchParams.set("agent", agentId); + return url.toString(); +} + +export function computeBackoffDelayMs(attempt: number, random: () => number = Math.random): number { + const base = Math.min(INITIAL_BACKOFF_MS * 2 ** Math.max(0, attempt), MAX_BACKOFF_MS); + const clampedRandom = Math.min(1, Math.max(0, random())); + const jittered = Math.round(base * (0.8 + clampedRandom * 0.4)); + return Math.min(MAX_BACKOFF_MS, jittered); +} + +export interface AgentConnectionOptions { + readonly apiUrl: string; + readonly agentId: KeyId; + readonly logger: Logger; + readonly onFrame: (frame: TransportFrame) => void; + readonly authenticate?: (socket: WebSocketLike) => void | Promise; + readonly webSocketFactory?: WebSocketFactory; + readonly timers?: TimerProvider; + readonly random?: () => number; + readonly maxInboundBytes?: number; + readonly maxOutboundQueue?: number; + readonly heartbeatIntervalMs?: number; + readonly idleTimeoutMs?: number; + readonly stableConnectionMs?: number; +} + +export interface AgentConnection { + start(): void; + stop(): void; + send(frame: TransportFrame): boolean; + isConnected(): boolean; + getQueuedCount(): number; +} + +const utf8Encoder = new TextEncoder(); + +export function createAgentConnection(options: AgentConnectionOptions): AgentConnection { + const connectUrl = buildConnectUrl(options.apiUrl, options.agentId); + const wsFactory = options.webSocketFactory ?? createDefaultWebSocket; + const timers = options.timers ?? defaultTimers; + const random = options.random ?? Math.random; + const maxInboundBytes = options.maxInboundBytes ?? MAX_INBOUND_MESSAGE_BYTES; + const maxOutboundQueue = options.maxOutboundQueue ?? MAX_OUTBOUND_QUEUE; + const heartbeatIntervalMs = options.heartbeatIntervalMs ?? HEARTBEAT_INTERVAL_MS; + const idleTimeoutMs = options.idleTimeoutMs ?? IDLE_TIMEOUT_MS; + const stableConnectionMs = options.stableConnectionMs ?? STABLE_CONNECTION_MS; + const authenticate = options.authenticate ?? (() => {}); + + const outboundQueue: string[] = []; + let running = false; + let socket: WebSocketLike | null = null; + let authenticated = false; + let reconnectAttempt = 0; + + let reconnectTimer: TimerHandle | null = null; + let stableTimer: TimerHandle | null = null; + let heartbeatTimer: TimerHandle | null = null; + let idleTimer: TimerHandle | null = null; + + function clearConnectionTimers(): void { + if (stableTimer !== null) { + timers.clearTimeout(stableTimer); + stableTimer = null; + } + if (heartbeatTimer !== null) { + timers.clearInterval(heartbeatTimer); + heartbeatTimer = null; + } + if (idleTimer !== null) { + timers.clearTimeout(idleTimer); + idleTimer = null; + } + } + + function clearReconnectTimer(): void { + if (reconnectTimer !== null) { + timers.clearTimeout(reconnectTimer); + reconnectTimer = null; + } + } + + function resetIdleTimer(activeSocket: WebSocketLike): void { + if (idleTimer !== null) { + timers.clearTimeout(idleTimer); + idleTimer = null; + } + idleTimer = timers.setTimeout(() => { + if (!running || socket !== activeSocket) { + return; + } + options.logger.warn("Connection idle timeout reached, reconnecting", { + idleTimeoutMs, + }); + detachAndReconnect(activeSocket, 4000, "idle_timeout"); + }, idleTimeoutMs); + } + + function flushQueue(activeSocket: WebSocketLike): void { + while (outboundQueue.length > 0) { + if (!running || socket !== activeSocket || activeSocket.readyState !== WS_READY_STATE_OPEN) { + return; + } + const next = outboundQueue.shift(); + if (next === undefined) { + return; + } + try { + activeSocket.send(next); + } catch { + outboundQueue.unshift(next); + detachAndReconnect(activeSocket, 1011, "send_failed"); + return; + } + } + } + + function scheduleReconnect(): void { + if (!running || reconnectTimer !== null) { + return; + } + const delayMs = computeBackoffDelayMs(reconnectAttempt, random); + reconnectAttempt++; + options.logger.info("Scheduling reconnect", { + attempt: reconnectAttempt, + delayMs, + }); + reconnectTimer = timers.setTimeout(() => { + reconnectTimer = null; + if (running) { + connect(); + } + }, delayMs); + } + + function detachAndReconnect( + activeSocket: WebSocketLike, + closeCode?: number, + reason?: string, + ): void { + if (socket !== activeSocket) { + return; + } + socket = null; + authenticated = false; + clearConnectionTimers(); + activeSocket.onopen = null; + activeSocket.onmessage = null; + activeSocket.onclose = null; + activeSocket.onerror = null; + + if (closeCode !== undefined) { + try { + activeSocket.close(closeCode, reason); + } catch { + // ignore close errors on dead socket + } + } + + if (running) { + scheduleReconnect(); + } + } + + function handleMessage(activeSocket: WebSocketLike, data: unknown): void { + if (socket !== activeSocket || !running) { + return; + } + if (typeof data !== "string") { + options.logger.warn("Discarding non-text WebSocket message"); + return; + } + const byteLength = utf8Encoder.encode(data).byteLength; + if (byteLength > maxInboundBytes) { + options.logger.warn("Discarding oversized WebSocket message", { + byteLength, + maxInboundBytes, + }); + return; + } + + let raw: unknown; + try { + raw = JSON.parse(data) as unknown; + } catch { + options.logger.warn("Discarding invalid JSON WebSocket message"); + return; + } + + const parsed = transportFrameSchema.safeParse(raw); + if (!parsed.success) { + options.logger.warn("Discarding invalid transport frame"); + return; + } + + resetIdleTimer(activeSocket); + + try { + options.onFrame(parsed.data); + } catch (err) { + options.logger.error("Unhandled error in frame listener", { + errName: err instanceof Error ? err.name : "Error", + }); + } + } + + function connect(): void { + if (!running) { + return; + } + + clearReconnectTimer(); + let ws: WebSocketLike; + try { + ws = wsFactory(connectUrl); + } catch (err) { + options.logger.warn("Failed to create WebSocket connection", { + errName: err instanceof Error ? err.name : "Error", + }); + scheduleReconnect(); + return; + } + + socket = ws; + authenticated = false; + + ws.onopen = () => { + if (!running || socket !== ws) { + return; + } + void (async () => { + try { + await authenticate(ws); + } catch (err) { + options.logger.warn("Connection authentication hook failed", { + errName: err instanceof Error ? err.name : "Error", + }); + detachAndReconnect(ws, 4001, "auth_failed"); + return; + } + + if (!running || socket !== ws || ws.readyState !== WS_READY_STATE_OPEN) { + return; + } + + authenticated = true; + options.logger.info("Connected to control server"); + + stableTimer = timers.setTimeout(() => { + if (running && socket === ws) { + reconnectAttempt = 0; + } + }, stableConnectionMs); + + resetIdleTimer(ws); + + heartbeatTimer = timers.setInterval(() => { + if (!running || socket !== ws || ws.readyState !== WS_READY_STATE_OPEN) { + return; + } + const pingFrame: TransportFrame = { + v: PROTOCOL_VERSION, + kind: "ping", + route: { agent: options.agentId }, + body: { ts: timers.now() }, + }; + try { + ws.send(JSON.stringify(pingFrame)); + } catch { + detachAndReconnect(ws, 1011, "ping_failed"); + } + }, heartbeatIntervalMs); + + flushQueue(ws); + })(); + }; + + ws.onmessage = (event) => { + handleMessage(ws, event.data); + }; + + ws.onerror = () => { + if (!running || socket !== ws) { + return; + } + options.logger.warn("WebSocket error occurred"); + }; + + ws.onclose = (event) => { + if (socket !== ws) { + return; + } + options.logger.info("WebSocket closed", { + code: event.code ?? 0, + }); + detachAndReconnect(ws); + }; + } + + return { + start(): void { + if (running) { + return; + } + running = true; + connect(); + }, + + stop(): void { + if (!running) { + return; + } + running = false; + clearReconnectTimer(); + clearConnectionTimers(); + authenticated = false; + const active = socket; + socket = null; + if (active) { + active.onopen = null; + active.onmessage = null; + active.onclose = null; + active.onerror = null; + try { + active.close(1000, "shutdown"); + } catch { + // ignore close errors during shutdown + } + } + }, + + send(frame: TransportFrame): boolean { + const validated = transportFrameSchema.parse(frame); + const serialized = JSON.stringify(validated); + + if ( + running && + authenticated && + socket !== null && + socket.readyState === WS_READY_STATE_OPEN + ) { + try { + socket.send(serialized); + return true; + } catch { + detachAndReconnect(socket, 1011, "send_failed"); + } + } + + if (outboundQueue.length >= maxOutboundQueue) { + outboundQueue.shift(); + } + outboundQueue.push(serialized); + return false; + }, + + isConnected(): boolean { + return ( + running && authenticated && socket !== null && socket.readyState === WS_READY_STATE_OPEN + ); + }, + + getQueuedCount(): number { + return outboundQueue.length; + }, + }; +} diff --git a/src/agent/index.ts b/src/agent/index.ts new file mode 100644 index 0000000..52591a0 --- /dev/null +++ b/src/agent/index.ts @@ -0,0 +1,76 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +export { + AGENT_CONNECT_PATH, + type AgentConnection, + type AgentConnectionOptions, + buildConnectUrl, + computeBackoffDelayMs, + createAgentConnection, + createDefaultWebSocket, + defaultTimers, + HEARTBEAT_INTERVAL_MS, + IDLE_TIMEOUT_MS, + INITIAL_BACKOFF_MS, + MAX_BACKOFF_MS, + MAX_INBOUND_MESSAGE_BYTES, + MAX_OUTBOUND_QUEUE, + STABLE_CONNECTION_MS, + type TimerHandle, + type TimerProvider, + type WebSocketCloseEventLike, + type WebSocketFactory, + type WebSocketLike, + type WebSocketMessageEventLike, + WS_READY_STATE_CLOSED, + WS_READY_STATE_CLOSING, + WS_READY_STATE_CONNECTING, + WS_READY_STATE_OPEN, +} from "./connection"; +export { + type CommandHandler, + type CommandHandlerContext, + type CommandQueue, + type CommandQueueOptions, + createCommandQueue, + DEFAULT_MAX_IDEMPOTENCY_ENTRIES, + type TransportAckFrame, + type TransportCommandFrame, + type TransportEventFrame, +} from "./jobs"; +export { + createLogger, + isSensitiveKey, + type LogContext, + type Logger, + type LoggerOptions, + type LogLevel, + logLevelSchema, + redactValue, + resolveLogLevel, +} from "./logger"; +export { + DEFAULT_LINUX_STATE_DIR, + getStatePaths, + resolveStateDir, + type StatePaths, +} from "./paths"; +export { + type AgentConfig, + type AtomicWriteOptions, + assertStrictPermissions, + createFileTrustContext, + type FileTrustContext, + type FileTrustContextOptions, + isInsecureAllowed, + type LoadConfigOptions, + loadConfig, + loadIdentityIfExists, + loadOrCreateIdentity, + loadTrust, + MAX_RECENT_REPLAY_IDS, + StateError, + validateApiUrl, + writeFileAtomic, +} from "./state"; diff --git a/src/agent/jobs.test.ts b/src/agent/jobs.test.ts new file mode 100644 index 0000000..bf43cd0 --- /dev/null +++ b/src/agent/jobs.test.ts @@ -0,0 +1,441 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { beforeAll, describe, expect, test } from "bun:test"; +import { fingerprint, generateSigningKeyPair, ready } from "../crypto"; +import { + createCoreRegistry, + createInMemoryTrustContext, + createSignedCommand, + openAgentMessage, + PROTOCOL_VERSION, + type SignedCommand, + type TransportFrame, +} from "../protocol"; +import { createCommandQueue, type TransportCommandFrame } from "./jobs"; +import { createLogger } from "./logger"; + +beforeAll(async () => { + await ready(); +}); + +function wrapCommand(agentId: string, body: SignedCommand): TransportCommandFrame { + return { + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: agentId }, + body, + }; +} + +function makeSilentLogger(logs: string[] = []) { + return createLogger({ + level: "debug", + stdout: (line) => logs.push(line), + stderr: (line) => logs.push(line), + }); +} + +describe("command queue", () => { + test("executes built-in agent.ping handler, emits sealed agent.pong event, and acks ok", async () => { + const agent = generateSigningKeyPair(); + const account = generateSigningKeyPair(); + const agentId = fingerprint(agent.publicKey); + let now = 1_700_000_000_000; + + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [account.publicKey], + now: () => now, + }); + const registry = createCoreRegistry(); + const sent: TransportFrame[] = []; + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (frame) => sent.push(frame), + logger: makeSilentLogger(), + }); + + const cmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now, + }, + registry, + ); + + await queue.enqueue(wrapCommand(agentId, cmd)); + + expect(sent.length).toBe(2); + const eventFrame = sent[0]; + const ackFrame = sent[1]; + + expect(eventFrame?.kind).toBe("event"); + if (eventFrame?.kind === "event") { + const opened = openAgentMessage(eventFrame.body, agent.publicKey, account); + expect(opened.header.type).toBe("agent.pong"); + expect(opened.header.seq).toBe(1); + expect(opened.body).toEqual({ at: now }); + } + + expect(ackFrame).toEqual({ + v: PROTOCOL_VERSION, + kind: "ack", + route: { agent: agentId }, + body: { id: cmd.header.id, ok: true }, + }); + + // Second ping increments event seq monotonically + now += 1000; + const cmd2 = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 2, + now, + }, + registry, + ); + await queue.enqueue(wrapCommand(agentId, cmd2)); + const eventFrame2 = sent[2]; + expect(eventFrame2?.kind).toBe("event"); + if (eventFrame2?.kind === "event") { + const opened2 = openAgentMessage(eventFrame2.body, agent.publicKey, account); + expect(opened2.header.seq).toBe(2); + expect(opened2.body).toEqual({ at: now }); + } + }); + + test("rejects untrusted, expired, tampered, and replayed commands with ProtocolError codes", async () => { + const agent = generateSigningKeyPair(); + const account = generateSigningKeyPair(); + const stranger = generateSigningKeyPair(); + const agentId = fingerprint(agent.publicKey); + const now = 1_700_000_000_000; + + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [account.publicKey], + now: () => now, + }); + const registry = createCoreRegistry(); + const sent: TransportFrame[] = []; + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (frame) => sent.push(frame), + logger: makeSilentLogger(), + }); + + // Untrusted signer + const untrusted = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: stranger, + counter: 1, + now, + }, + registry, + ); + await queue.enqueue(wrapCommand(agentId, untrusted)); + expect(sent.pop()).toEqual({ + v: PROTOCOL_VERSION, + kind: "ack", + route: { agent: agentId }, + body: { id: untrusted.header.id, ok: false, code: "untrusted_signer" }, + }); + + // Expired command + const expired = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now: now - 10_000, + ttlMs: 5_000, + }, + registry, + ); + await queue.enqueue(wrapCommand(agentId, expired)); + expect(sent.pop()).toEqual({ + v: PROTOCOL_VERSION, + kind: "ack", + route: { agent: agentId }, + body: { id: expired.header.id, ok: false, code: "expired" }, + }); + + // Tampered command + const valid = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 2, + now, + }, + registry, + ); + const tampered: SignedCommand = { + ...valid, + header: { ...valid.header, counter: 3 }, + }; + await queue.enqueue(wrapCommand(agentId, tampered)); + expect(sent.pop()).toEqual({ + v: PROTOCOL_VERSION, + kind: "ack", + route: { agent: agentId }, + body: { id: tampered.header.id, ok: false, code: "bad_signature" }, + }); + + // Valid command at counter 2 succeeds + await queue.enqueue(wrapCommand(agentId, valid)); + sent.length = 0; + + // New command reusing counter 2 -> replayed + const replayedCounter = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 2, + now, + }, + registry, + ); + await queue.enqueue(wrapCommand(agentId, replayedCounter)); + expect(sent.pop()).toEqual({ + v: PROTOCOL_VERSION, + kind: "ack", + route: { agent: agentId }, + body: { id: replayedCounter.header.id, ok: false, code: "replayed" }, + }); + }); + + test("redelivery of an already executed command returns cached ack ok without re-running handler", async () => { + const agent = generateSigningKeyPair(); + const account = generateSigningKeyPair(); + const agentId = fingerprint(agent.publicKey); + const now = 1_700_000_000_000; + + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [account.publicKey], + now: () => now, + }); + const registry = createCoreRegistry(); + const sent: TransportFrame[] = []; + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (frame) => sent.push(frame), + logger: makeSilentLogger(), + }); + + let runCount = 0; + queue.registerHandler("server.start", () => { + runCount++; + }); + + const cmd = createSignedCommand( + { + type: "server.start", + body: { server_id: "srv_1" }, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now, + }, + registry, + ); + + await queue.enqueue(wrapCommand(agentId, cmd)); + await queue.enqueue(wrapCommand(agentId, cmd)); + + expect(runCount).toBe(1); + expect(sent).toEqual([ + { + v: PROTOCOL_VERSION, + kind: "ack", + route: { agent: agentId }, + body: { id: cmd.header.id, ok: true }, + }, + { + v: PROTOCOL_VERSION, + kind: "ack", + route: { agent: agentId }, + body: { id: cmd.header.id, ok: true }, + }, + ]); + }); + + test("returns no_handler for unregistered command types and handler_error when handler throws", async () => { + const agent = generateSigningKeyPair(); + const account = generateSigningKeyPair(); + const agentId = fingerprint(agent.publicKey); + const now = 1_700_000_000_000; + + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [account.publicKey], + now: () => now, + }); + const registry = createCoreRegistry(); + const sent: TransportFrame[] = []; + const logs: string[] = []; + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (frame) => sent.push(frame), + logger: makeSilentLogger(logs), + }); + + // No handler for server.stop + const noHandlerCmd = createSignedCommand( + { + type: "server.stop", + body: { server_id: "srv_secret_id" }, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now, + }, + registry, + ); + await queue.enqueue(wrapCommand(agentId, noHandlerCmd)); + expect(sent.pop()).toEqual({ + v: PROTOCOL_VERSION, + kind: "ack", + route: { agent: agentId }, + body: { id: noHandlerCmd.header.id, ok: false, code: "no_handler" }, + }); + + // Throwing handler for server.start + queue.registerHandler("server.start", () => { + throw new Error("disk exploded"); + }); + const failingCmd = createSignedCommand( + { + type: "server.start", + body: { server_id: "srv_do_not_leak" }, + agentPublicKey: agent.publicKey, + signer: account, + counter: 2, + now, + }, + registry, + ); + await queue.enqueue(wrapCommand(agentId, failingCmd)); + expect(sent.pop()).toEqual({ + v: PROTOCOL_VERSION, + kind: "ack", + route: { agent: agentId }, + body: { id: failingCmd.header.id, ok: false, code: "handler_error" }, + }); + expect(logs.join("\n")).not.toContain("srv_do_not_leak"); + + // Queue continues processing subsequent commands cleanly + const pingCmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 3, + now, + }, + registry, + ); + await queue.enqueue(wrapCommand(agentId, pingCmd)); + expect(sent[sent.length - 1]).toEqual({ + v: PROTOCOL_VERSION, + kind: "ack", + route: { agent: agentId }, + body: { id: pingCmd.header.id, ok: true }, + }); + }); + + test("executes simultaneous commands strictly serially", async () => { + const agent = generateSigningKeyPair(); + const account = generateSigningKeyPair(); + const agentId = fingerprint(agent.publicKey); + const now = 1_700_000_000_000; + + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [account.publicKey], + now: () => now, + }); + const registry = createCoreRegistry(); + const sent: TransportFrame[] = []; + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (frame) => sent.push(frame), + logger: makeSilentLogger(), + }); + + const events: string[] = []; + let releaseFirst: (() => void) | undefined; + const firstGate = new Promise((resolve) => { + releaseFirst = resolve; + }); + + queue.registerHandler("server.start", async (opened) => { + const body = opened.body as { server_id: string }; + events.push(`start:${body.server_id}`); + if (body.server_id === "first") { + await firstGate; + } + events.push(`end:${body.server_id}`); + }); + + const cmd1 = createSignedCommand( + { + type: "server.start", + body: { server_id: "first" }, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now, + }, + registry, + ); + const cmd2 = createSignedCommand( + { + type: "server.start", + body: { server_id: "second" }, + agentPublicKey: agent.publicKey, + signer: account, + counter: 2, + now, + }, + registry, + ); + + const p1 = queue.enqueue(wrapCommand(agentId, cmd1)); + const p2 = queue.enqueue(wrapCommand(agentId, cmd2)); + + // Allow microtasks to run so first command enters handler + await Promise.resolve(); + await Promise.resolve(); + expect(events).toEqual(["start:first"]); + + releaseFirst?.(); + await Promise.all([p1, p2]); + + expect(events).toEqual(["start:first", "end:first", "start:second", "end:second"]); + }); +}); diff --git a/src/agent/jobs.ts b/src/agent/jobs.ts new file mode 100644 index 0000000..333a36b --- /dev/null +++ b/src/agent/jobs.ts @@ -0,0 +1,229 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { fingerprint } from "../crypto"; +import { + type CommandRegistry, + type OpenedCommand, + openCommand, + PROTOCOL_VERSION, + ProtocolError, + sealAgentMessage, + type TransportFrame, + type TrustContext, +} from "../protocol"; +import type { Logger } from "./logger"; + +export const DEFAULT_MAX_IDEMPOTENCY_ENTRIES = 4096; + +export type TransportCommandFrame = Extract; +export type TransportAckFrame = Extract; +export type TransportEventFrame = Extract; + +export interface CommandHandlerContext { + sendEvent(type: string, body: unknown): void; + now(): number; + readonly logger: Logger; +} + +export type CommandHandler = ( + opened: OpenedCommand, + ctx: CommandHandlerContext, +) => unknown | Promise; + +export interface CommandQueueOptions { + readonly trust: TrustContext; + readonly registry: CommandRegistry; + readonly sendFrame: (frame: TransportFrame) => void; + readonly logger: Logger; + readonly maxIdempotencyEntries?: number; +} + +export interface CommandQueue { + registerHandler(type: string, handler: CommandHandler): void; + enqueue(frame: TransportCommandFrame): Promise; + drain(timeoutMs: number): Promise; +} + +interface CompletedAckEntry { + readonly sig: string; + readonly ack: TransportAckFrame; +} + +export function createCommandQueue(options: CommandQueueOptions): CommandQueue { + const { trust, registry, sendFrame, logger } = options; + const maxIdempotencyEntries = options.maxIdempotencyEntries ?? DEFAULT_MAX_IDEMPOTENCY_ENTRIES; + const agentId = fingerprint(trust.agentKeyPair.publicKey); + const handlers = new Map(); + const completedAcks = new Map(); + + let nextEventSeq = 1; + let tail: Promise = Promise.resolve(); + let pendingCount = 0; + + function recordCompletedAck(id: string, sig: string, ack: TransportAckFrame): void { + if (completedAcks.has(id)) { + completedAcks.delete(id); + } else if (completedAcks.size >= maxIdempotencyEntries) { + const oldestKey = completedAcks.keys().next().value; + if (oldestKey !== undefined) { + completedAcks.delete(oldestKey); + } + } + completedAcks.set(id, { sig, ack }); + } + + function makeAckOk(id: string): TransportAckFrame { + return { + v: PROTOCOL_VERSION, + kind: "ack", + route: { agent: agentId }, + body: { id, ok: true }, + }; + } + + function makeAckError(id: string, code: string): TransportAckFrame { + return { + v: PROTOCOL_VERSION, + kind: "ack", + route: { agent: agentId }, + body: { id, ok: false, code }, + }; + } + + async function processCommand(frame: TransportCommandFrame): Promise { + const commandId = frame.body.header.id; + let opened: OpenedCommand; + + try { + opened = await openCommand(frame.body, trust, registry); + } catch (err) { + if (err instanceof ProtocolError) { + if (err.code === "replayed") { + const cached = completedAcks.get(commandId); + if (cached !== undefined && cached.sig === frame.body.sig) { + sendFrame(cached.ack); + return; + } + } + logger.warn("Command rejected by protocol verification", { + commandId, + code: err.code, + }); + sendFrame(makeAckError(commandId, err.code)); + return; + } + + logger.error("Unexpected error while opening command", { + commandId, + errName: err instanceof Error ? err.name : "Error", + }); + sendFrame(makeAckError(commandId, "invalid_format")); + return; + } + + const handler = handlers.get(opened.header.type); + if (!handler) { + logger.warn("No handler registered for command", { + commandId: opened.header.id, + type: opened.header.type, + code: "no_handler", + }); + sendFrame(makeAckError(opened.header.id, "no_handler")); + return; + } + + const ctx: CommandHandlerContext = { + sendEvent(type: string, body: unknown): void { + const recipientPublicKey = trust.isTrustedAccountKey(opened.accountId); + if (recipientPublicKey === null) { + throw new Error("Trusted account key unavailable for event recipient"); + } + const seq = nextEventSeq++; + const sealed = sealAgentMessage({ + type, + body, + agentKeyPair: trust.agentKeyPair, + recipientPublicKey, + sentAt: trust.now(), + seq, + }); + const eventFrame: TransportEventFrame = { + v: PROTOCOL_VERSION, + kind: "event", + route: { + agent: agentId, + recipient: opened.accountId, + }, + body: sealed, + }; + sendFrame(eventFrame); + }, + now(): number { + return trust.now(); + }, + logger, + }; + + try { + await handler(opened, ctx); + } catch (err) { + logger.error("Command handler threw an exception", { + commandId: opened.header.id, + type: opened.header.type, + code: "handler_error", + errName: err instanceof Error ? err.name : "Error", + }); + sendFrame(makeAckError(opened.header.id, "handler_error")); + return; + } + + const ack = makeAckOk(opened.header.id); + recordCompletedAck(opened.header.id, frame.body.sig, ack); + sendFrame(ack); + } + + function registerHandler(type: string, handler: CommandHandler): void { + handlers.set(type, handler); + } + + registerHandler("agent.ping", (_opened, ctx) => { + ctx.sendEvent("agent.pong", { at: ctx.now() }); + }); + + return { + registerHandler, + + enqueue(frame: TransportCommandFrame): Promise { + pendingCount++; + const run = tail.then(async () => { + try { + await processCommand(frame); + } finally { + pendingCount--; + } + }); + tail = run.catch(() => {}); + return run; + }, + + async drain(timeoutMs: number): Promise { + if (pendingCount === 0) { + return true; + } + let timer: ReturnType | undefined; + try { + return await Promise.race([ + tail.then(() => true), + new Promise((resolve) => { + timer = setTimeout(() => resolve(false), timeoutMs); + }), + ]); + } finally { + if (timer !== undefined) { + clearTimeout(timer); + } + } + }, + }; +} diff --git a/src/agent/logger.test.ts b/src/agent/logger.test.ts new file mode 100644 index 0000000..bca87f6 --- /dev/null +++ b/src/agent/logger.test.ts @@ -0,0 +1,95 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { describe, expect, test } from "bun:test"; +import { createLogger, resolveLogLevel } from "./logger"; + +describe("logger", () => { + test("writes JSON lines to stdout for debug/info/warn and stderr for error", () => { + const out: string[] = []; + const err: string[] = []; + const logger = createLogger({ + level: "debug", + now: () => 1_700_000_000_000, + stdout: (line) => out.push(line), + stderr: (line) => err.push(line), + }); + + logger.debug("dbg", { step: 1 }); + logger.info("hello", { agentId: "abc" }); + logger.warn("careful"); + logger.error("boom", { code: "handler_error" }); + + expect(out.length).toBe(3); + expect(err.length).toBe(1); + + const parsedInfo = JSON.parse(out[1] ?? "") as Record; + expect(parsedInfo.ts).toBe("2023-11-14T22:13:20.000Z"); + expect(parsedInfo.level).toBe("info"); + expect(parsedInfo.msg).toBe("hello"); + expect(parsedInfo.agentId).toBe("abc"); + + const parsedErr = JSON.parse(err[0] ?? "") as Record; + expect(parsedErr.level).toBe("error"); + expect(parsedErr.msg).toBe("boom"); + expect(parsedErr.code).toBe("handler_error"); + }); + + test("redacts sensitive keys recursively", () => { + const out: string[] = []; + const logger = createLogger({ + level: "debug", + stdout: (line) => out.push(line), + stderr: () => {}, + }); + + logger.info("auth", { + secret: "s1", + secret_key: "s2", + apiKey: "s3", + authToken: "s4", + userPassword: "s5", + commandPayload: "s6", + nested: { + private_key: "s7", + safe: "ok", + }, + items: [{ access_token: "s8", count: 2 }], + }); + + const line = out[0] ?? ""; + for (const leaked of ["s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8"]) { + expect(line).not.toContain(leaked); + } + + const parsed = JSON.parse(line) as Record; + expect(parsed.secret).toBe("[redacted]"); + expect(parsed.secret_key).toBe("[redacted]"); + expect(parsed.apiKey).toBe("[redacted]"); + expect(parsed.authToken).toBe("[redacted]"); + expect(parsed.userPassword).toBe("[redacted]"); + expect(parsed.commandPayload).toBe("[redacted]"); + expect(parsed.nested).toEqual({ private_key: "[redacted]", safe: "ok" }); + expect(parsed.items).toEqual([{ access_token: "[redacted]", count: 2 }]); + }); + + test("respects TEGRAD_LOG_LEVEL filtering", () => { + expect(resolveLogLevel({})).toBe("info"); + expect(resolveLogLevel({ TEGRAD_LOG_LEVEL: "warn" })).toBe("warn"); + expect(resolveLogLevel({ TEGRAD_LOG_LEVEL: "invalid" })).toBe("info"); + + const out: string[] = []; + const logger = createLogger({ + env: { TEGRAD_LOG_LEVEL: "warn" }, + stdout: (line) => out.push(line), + stderr: () => {}, + }); + + logger.debug("skip"); + logger.info("skip"); + logger.warn("keep"); + + expect(out.length).toBe(1); + expect(JSON.parse(out[0] ?? "").msg).toBe("keep"); + }); +}); diff --git a/src/agent/logger.ts b/src/agent/logger.ts new file mode 100644 index 0000000..214f00b --- /dev/null +++ b/src/agent/logger.ts @@ -0,0 +1,156 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; + +export const logLevelSchema = z.enum(["debug", "info", "warn", "error"]); +export type LogLevel = z.infer; + +const LEVEL_RANK: Record = { + debug: 10, + info: 20, + warn: 30, + error: 40, +}; + +const SENSITIVE_KEY_PATTERN = /secret|key|token|password|payload/i; +const REDACTED = "[redacted]"; + +export type LogContext = Record; + +export interface Logger { + debug(msg: string, context?: LogContext): void; + info(msg: string, context?: LogContext): void; + warn(msg: string, context?: LogContext): void; + error(msg: string, context?: LogContext): void; + child(baseContext: LogContext): Logger; +} + +export interface LoggerOptions { + readonly level?: LogLevel; + readonly env?: Readonly>; + readonly stdout?: (line: string) => void; + readonly stderr?: (line: string) => void; + readonly now?: () => number; + readonly baseContext?: LogContext; +} + +export function resolveLogLevel( + env: Readonly> = process.env, +): LogLevel { + const raw = env.TEGRAD_LOG_LEVEL?.trim().toLowerCase(); + if (!raw) { + return "info"; + } + const parsed = logLevelSchema.safeParse(raw); + return parsed.success ? parsed.data : "info"; +} + +export function isSensitiveKey(key: string): boolean { + return SENSITIVE_KEY_PATTERN.test(key); +} + +export function redactValue(value: unknown, seen: WeakSet = new WeakSet()): unknown { + if (value === null || value === undefined) { + return value; + } + if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { + return value; + } + if (typeof value === "bigint") { + return value.toString(); + } + if (value instanceof Date) { + return value.toISOString(); + } + if (value instanceof Uint8Array) { + return `[Uint8Array(${value.byteLength})]`; + } + if (value instanceof Error) { + return { name: value.name, message: value.message }; + } + if (typeof value !== "object") { + return String(value); + } + if (seen.has(value)) { + return "[circular]"; + } + seen.add(value); + + if (Array.isArray(value)) { + return value.map((item) => redactValue(item, seen)); + } + + const out: Record = {}; + for (const [k, v] of Object.entries(value)) { + if (isSensitiveKey(k)) { + out[k] = REDACTED; + } else if (v !== undefined) { + out[k] = redactValue(v, seen); + } + } + return out; +} + +export function createLogger(options: LoggerOptions = {}): Logger { + const level = options.level ?? resolveLogLevel(options.env); + const minRank = LEVEL_RANK[level]; + const writeStdout = options.stdout ?? ((line: string) => process.stdout.write(line)); + const writeStderr = options.stderr ?? ((line: string) => process.stderr.write(line)); + const now = options.now ?? (() => Date.now()); + const baseContext = options.baseContext; + + function emit(entryLevel: LogLevel, msg: string, context?: LogContext): void { + if (LEVEL_RANK[entryLevel] < minRank) { + return; + } + + const merged: Record = {}; + if (baseContext) { + const redactedBase = redactValue(baseContext) as Record; + Object.assign(merged, redactedBase); + } + if (context) { + const redactedCtx = redactValue(context) as Record; + Object.assign(merged, redactedCtx); + } + + const record: Record = { + ...merged, + ts: new Date(now()).toISOString(), + level: entryLevel, + msg, + }; + + const line = `${JSON.stringify(record)}\n`; + if (entryLevel === "error") { + writeStderr(line); + } else { + writeStdout(line); + } + } + + return { + debug(msg: string, context?: LogContext): void { + emit("debug", msg, context); + }, + info(msg: string, context?: LogContext): void { + emit("info", msg, context); + }, + warn(msg: string, context?: LogContext): void { + emit("warn", msg, context); + }, + error(msg: string, context?: LogContext): void { + emit("error", msg, context); + }, + child(extraContext: LogContext): Logger { + return createLogger({ + level, + stdout: writeStdout, + stderr: writeStderr, + now, + baseContext: { ...(baseContext ?? {}), ...extraContext }, + }); + }, + }; +} diff --git a/src/agent/no-inbound-port.test.ts b/src/agent/no-inbound-port.test.ts new file mode 100644 index 0000000..a25644b --- /dev/null +++ b/src/agent/no-inbound-port.test.ts @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { expect, test } from "bun:test"; +import { Glob } from "bun"; + +const FORBIDDEN_INBOUND_PATTERNS: readonly { name: string; regex: RegExp }[] = [ + { name: "Bun.serve", regex: /\bBun\.serve\b/ }, + { name: "createServer", regex: /\bcreateServer\b/ }, + { name: ".listen(", regex: /\.listen\s*\(/ }, + { name: "new Bun.TCPSocket", regex: /\bnew\s+Bun\.TCPSocket\b/ }, + { name: "Bun.listen", regex: /\bBun\.listen\b/ }, +]; + +test("src/agent and src/cli never open an inbound port", async () => { + const violations: string[] = []; + let checkedCount = 0; + + for await (const path of new Glob("src/{agent,cli}/**/*.ts").scan(".")) { + if (path.endsWith(".test.ts")) continue; + checkedCount++; + const content = await Bun.file(path).text(); + for (const rule of FORBIDDEN_INBOUND_PATTERNS) { + if (rule.regex.test(content)) { + violations.push(`${path}: matched ${rule.name}`); + } + } + } + + expect(checkedCount).toBeGreaterThan(0); + expect(violations).toEqual([]); +}); diff --git a/src/agent/paths.ts b/src/agent/paths.ts new file mode 100644 index 0000000..ef40d77 --- /dev/null +++ b/src/agent/paths.ts @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { homedir } from "node:os"; +import { join, resolve } from "node:path"; +import { z } from "zod"; + +export const DEFAULT_LINUX_STATE_DIR = "/var/lib/tegrad"; + +const stateDirEnvSchema = z.object({ + TEGRAD_STATE_DIR: z.string().trim().min(1).optional(), +}); + +export interface StatePaths { + readonly stateDir: string; + readonly configPath: string; + readonly identityPath: string; + readonly trustPath: string; + readonly replayPath: string; +} + +export function resolveStateDir( + env: Readonly> = process.env, + platform: NodeJS.Platform = process.platform, + homeDirectory: string = homedir(), +): string { + const raw = env.TEGRAD_STATE_DIR; + if (raw !== undefined && raw.trim().length > 0) { + const parsed = stateDirEnvSchema.parse({ TEGRAD_STATE_DIR: raw }); + if (parsed.TEGRAD_STATE_DIR !== undefined) { + return resolve(parsed.TEGRAD_STATE_DIR); + } + } + + if (platform === "linux") { + return DEFAULT_LINUX_STATE_DIR; + } + + return join(homeDirectory, ".tegrad"); +} + +export function getStatePaths(stateDir: string): StatePaths { + return { + stateDir, + configPath: join(stateDir, "config.json"), + identityPath: join(stateDir, "identity.json"), + trustPath: join(stateDir, "trust.json"), + replayPath: join(stateDir, "replay.json"), + }; +} diff --git a/src/agent/state.test.ts b/src/agent/state.test.ts new file mode 100644 index 0000000..4a69e19 --- /dev/null +++ b/src/agent/state.test.ts @@ -0,0 +1,210 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeAll, describe, expect, test } from "bun:test"; +import { + chmodSync, + mkdtempSync, + readdirSync, + readFileSync, + rmSync, + statSync, + writeFileSync, +} from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { fingerprint, generateSigningKeyPair, ready, toBase64Url } from "../crypto"; +import { DEFAULT_LINUX_STATE_DIR, getStatePaths, resolveStateDir } from "./paths"; +import { + createFileTrustContext, + loadConfig, + loadOrCreateIdentity, + loadTrust, + MAX_RECENT_REPLAY_IDS, + StateError, + writeFileAtomic, +} from "./state"; + +const tempDirs: string[] = []; + +function makeTempDir(): string { + const dir = mkdtempSync(join(tmpdir(), "tegrad-state-test-")); + tempDirs.push(dir); + return dir; +} + +beforeAll(async () => { + await ready(); +}); + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +describe("paths", () => { + test("resolveStateDir honors TEGRAD_STATE_DIR, linux default, and non-linux home fallback", () => { + expect(resolveStateDir({ TEGRAD_STATE_DIR: "/custom/dir" }, "linux", "/home/u")).toContain( + "custom", + ); + expect(resolveStateDir({}, "linux", "/home/u")).toBe(DEFAULT_LINUX_STATE_DIR); + expect(resolveStateDir({}, "win32", "C:\\Users\\dev")).toBe(join("C:\\Users\\dev", ".tegrad")); + }); +}); + +describe("state files", () => { + test("loadOrCreateIdentity is idempotent and enforces 0600 on POSIX", async () => { + const dir = makeTempDir(); + const first = await loadOrCreateIdentity(dir); + const second = await loadOrCreateIdentity(dir); + + expect(toBase64Url(second.publicKey)).toBe(toBase64Url(first.publicKey)); + expect(toBase64Url(second.secretKey)).toBe(toBase64Url(first.secretKey)); + + if (process.platform !== "win32") { + const { identityPath } = getStatePaths(dir); + expect(statSync(identityPath).mode & 0o777).toBe(0o600); + + chmodSync(identityPath, 0o644); + await expect(loadOrCreateIdentity(dir)).rejects.toThrow(StateError); + } + }); + + test("writeFileAtomic leaves existing file intact and removes temp file on simulated write failure", () => { + const dir = makeTempDir(); + const target = join(dir, "sample.json"); + writeFileAtomic(target, '{"ok":true}\n'); + + expect(() => + writeFileAtomic(target, '{"ok":false}\n', { + writeContent() { + throw new Error("simulated disk failure"); + }, + }), + ).toThrow("simulated disk failure"); + + expect(readFileSync(target, "utf8")).toBe('{"ok":true}\n'); + expect(readdirSync(dir)).toEqual(["sample.json"]); + }); + + test("loadConfig validates presence, JSON, and https requirement", () => { + const dir = makeTempDir(); + const { configPath } = getStatePaths(dir); + + expect(() => loadConfig(dir)).toThrow(StateError); + + writeFileSync(configPath, "{not-json", "utf8"); + expect(() => loadConfig(dir)).toThrow(StateError); + + writeFileSync(configPath, JSON.stringify({ api_url: "http://api.example.com" }), "utf8"); + expect(() => loadConfig(dir, { env: {} })).toThrow(StateError); + expect(() => loadConfig(dir, { env: { TEGRAD_ALLOW_INSECURE: "1" } })).toThrow(StateError); + + writeFileSync(configPath, JSON.stringify({ api_url: "http://127.0.0.1:8080" }), "utf8"); + expect(() => loadConfig(dir, { env: {} })).toThrow(StateError); + expect(loadConfig(dir, { env: { TEGRAD_ALLOW_INSECURE: "1" } }).apiUrl).toBe( + "http://127.0.0.1:8080/", + ); + + writeFileSync(configPath, JSON.stringify({ api_url: "https://api.tegra.example" }), "utf8"); + expect(loadConfig(dir, { env: {} }).apiUrl).toBe("https://api.tegra.example/"); + }); + + test("loadTrust returns empty list when trust.json is missing and loads valid account keys", async () => { + const dir = makeTempDir(); + expect(await loadTrust(dir)).toEqual([]); + + const account = generateSigningKeyPair(); + const { trustPath } = getStatePaths(dir); + writeFileSync( + trustPath, + JSON.stringify({ v: 1, accounts: [{ public_key: toBase64Url(account.publicKey) }] }), + "utf8", + ); + + const loaded = await loadTrust(dir); + expect(loaded.length).toBe(1); + expect(toBase64Url(loaded[0] ?? new Uint8Array())).toBe(toBase64Url(account.publicKey)); + }); +}); + +describe("persistent replay state", () => { + test("counter and recent ids survive reload across TrustContext instances", async () => { + const dir = makeTempDir(); + const agent = await loadOrCreateIdentity(dir); + const account = generateSigningKeyPair(); + const accountId = fingerprint(account.publicKey); + + const ctx1 = createFileTrustContext({ + stateDir: dir, + agentKeyPair: agent, + trustedAccountKeys: [account.publicKey], + }); + + expect(ctx1.isTrustedAccountKey(accountId)).not.toBeNull(); + expect(ctx1.isSessionRevoked("sess_1")).toBe(false); + ctx1.setRevokedSessionIds(["sess_1"]); + expect(ctx1.isSessionRevoked("sess_1")).toBe(true); + + expect(ctx1.claimCommand(accountId, "cmd_id_0001", 1)).toBe(true); + expect(ctx1.claimCommand(accountId, "cmd_id_0002", 5)).toBe(true); + + const ctx2 = createFileTrustContext({ + stateDir: dir, + agentKeyPair: agent, + trustedAccountKeys: [account.publicKey], + }); + + // Duplicate ID rejected after reload + expect(ctx2.claimCommand(accountId, "cmd_id_0001", 6)).toBe(false); + // Equal or lower counter rejected after reload + expect(ctx2.claimCommand(accountId, "cmd_id_0003", 5)).toBe(false); + expect(ctx2.claimCommand(accountId, "cmd_id_0003", 4)).toBe(false); + // Strictly higher counter with new ID accepted + expect(ctx2.claimCommand(accountId, "cmd_id_0003", 6)).toBe(true); + }); + + test("caps recent_ids at 4096 and evicts oldest entries", async () => { + const dir = makeTempDir(); + const agent = await loadOrCreateIdentity(dir); + const account = generateSigningKeyPair(); + const accountId = fingerprint(account.publicKey); + + // Pre-seed 4096 IDs on disk so we verify the exact 4096 cap without 4096 fsyncs + const { replayPath } = getStatePaths(dir); + const initialIds: string[] = []; + for (let i = 0; i < MAX_RECENT_REPLAY_IDS; i++) { + initialIds.push(`id_${i}`); + } + writeFileAtomic( + replayPath, + JSON.stringify({ + v: 1, + last_counter: { [accountId]: MAX_RECENT_REPLAY_IDS }, + recent_ids: initialIds, + }), + ); + + const ctx = createFileTrustContext({ + stateDir: dir, + agentKeyPair: agent, + trustedAccountKeys: [account.publicKey], + }); + + expect(ctx.claimCommand(accountId, "id_4096", MAX_RECENT_REPLAY_IDS + 1)).toBe(true); + expect(ctx.claimCommand(accountId, "id_4097", MAX_RECENT_REPLAY_IDS + 2)).toBe(true); + + const persisted = JSON.parse(readFileSync(replayPath, "utf8")) as { + recent_ids: string[]; + last_counter: Record; + }; + expect(persisted.recent_ids.length).toBe(MAX_RECENT_REPLAY_IDS); + expect(persisted.recent_ids[0]).toBe("id_2"); + expect(persisted.recent_ids[persisted.recent_ids.length - 1]).toBe("id_4097"); + expect(persisted.last_counter[accountId]).toBe(MAX_RECENT_REPLAY_IDS + 2); + }); +}); diff --git a/src/agent/state.ts b/src/agent/state.ts new file mode 100644 index 0000000..5832909 --- /dev/null +++ b/src/agent/state.ts @@ -0,0 +1,453 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { randomBytes as nodeRandomBytes } from "node:crypto"; +import { + chmodSync, + closeSync, + existsSync, + fsyncSync, + mkdirSync, + openSync, + readFileSync, + renameSync, + statSync, + unlinkSync, + writeFileSync, +} from "node:fs"; +import { basename, dirname, join } from "node:path"; +import { z } from "zod"; +import { + fingerprint, + fromBase64Url, + generateSigningKeyPair, + type PublicKey, + ready, + SIGNING_PUBLIC_KEY_BYTES, + SIGNING_SECRET_KEY_BYTES, + type SigningKeyPair, + toBase64Url, +} from "../crypto"; +import { base64UrlSchema, type KeyId, keyIdSchema, type TrustContext } from "../protocol"; +import { getStatePaths } from "./paths"; + +export const MAX_RECENT_REPLAY_IDS = 4096; + +const STATE_DIR_MODE = 0o700; +const SECRET_FILE_MODE = 0o600; + +export class StateError extends Error { + constructor(message: string) { + super(message); + this.name = "StateError"; + } +} + +const envFlagsSchema = z.object({ + TEGRAD_ALLOW_INSECURE: z.string().optional(), +}); + +const rawConfigSchema = z.object({ + api_url: z.string().min(1), +}); + +export interface AgentConfig { + readonly apiUrl: string; +} + +const identityFileSchema = z.object({ + v: z.literal(1), + public_key: base64UrlSchema, + secret_key: base64UrlSchema, +}); + +const trustFileSchema = z.object({ + v: z.literal(1), + accounts: z.array( + z.object({ + public_key: base64UrlSchema, + }), + ), +}); + +const replayFileSchema = z.object({ + v: z.literal(1), + last_counter: z.record(keyIdSchema, z.number().int().nonnegative()), + recent_ids: z.array(base64UrlSchema), +}); + +export interface AtomicWriteOptions { + readonly mode?: number; + readonly dirMode?: number; + readonly writeContent?: (fd: number, content: string) => void; +} + +function isPosix(platform: NodeJS.Platform = process.platform): boolean { + return platform !== "win32"; +} + +function ensureDir(dirPath: string, mode: number = STATE_DIR_MODE): void { + mkdirSync(dirPath, { recursive: true, mode }); + if (isPosix()) { + chmodSync(dirPath, mode); + } +} + +export function assertStrictPermissions(filePath: string): void { + if (!isPosix()) { + return; + } + const mode = statSync(filePath).mode & 0o777; + if ((mode & ~SECRET_FILE_MODE) !== 0) { + throw new StateError( + `Refusing to read ${filePath}: permissions ${mode.toString(8).padStart(4, "0")} are more permissive than 0600`, + ); + } +} + +export function writeFileAtomic( + filePath: string, + content: string, + options: AtomicWriteOptions = {}, +): void { + const dir = dirname(filePath); + const mode = options.mode ?? SECRET_FILE_MODE; + const dirMode = options.dirMode ?? STATE_DIR_MODE; + ensureDir(dir, dirMode); + + const suffix = nodeRandomBytes(8).toString("hex"); + const tmpPath = join(dir, `.tmp-${basename(filePath)}-${process.pid}-${suffix}`); + let fd: number | undefined; + + try { + fd = openSync(tmpPath, "wx", mode); + if (options.writeContent) { + options.writeContent(fd, content); + } else { + writeFileSync(fd, content, "utf8"); + } + fsyncSync(fd); + closeSync(fd); + fd = undefined; + + if (isPosix()) { + chmodSync(tmpPath, mode); + } + + renameSync(tmpPath, filePath); + } catch (err) { + if (fd !== undefined) { + try { + closeSync(fd); + } catch { + // ignore close failure on cleanup + } + } + try { + if (existsSync(tmpPath)) { + unlinkSync(tmpPath); + } + } catch { + // ignore cleanup failure + } + throw err; + } +} + +function readJsonFile(filePath: string, label: string): unknown { + let raw: string; + try { + raw = readFileSync(filePath, "utf8"); + } catch (err) { + throw new StateError( + `Failed to read ${label} at ${filePath}: ${err instanceof Error ? err.message : String(err)}`, + ); + } + + try { + return JSON.parse(raw) as unknown; + } catch { + throw new StateError(`Invalid JSON in ${label} at ${filePath}`); + } +} + +export function isInsecureAllowed( + env: Readonly> = process.env, +): boolean { + const parsed = envFlagsSchema.parse({ TEGRAD_ALLOW_INSECURE: env.TEGRAD_ALLOW_INSECURE }); + return parsed.TEGRAD_ALLOW_INSECURE === "1"; +} + +export function validateApiUrl(apiUrl: string, allowInsecure: boolean): string { + let parsed: URL; + try { + parsed = new URL(apiUrl); + } catch { + throw new StateError(`Invalid api_url in config.json: "${apiUrl}"`); + } + + if (parsed.username || parsed.password) { + throw new StateError("api_url must not contain embedded credentials"); + } + + if (parsed.protocol === "https:") { + return parsed.toString(); + } + + if ( + allowInsecure && + parsed.protocol === "http:" && + (parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1") + ) { + return parsed.toString(); + } + + throw new StateError( + `api_url must use https:// (got ${parsed.protocol}//${parsed.host}); set TEGRAD_ALLOW_INSECURE=1 for http://localhost or http://127.0.0.1 in development`, + ); +} + +export interface LoadConfigOptions { + readonly allowInsecure?: boolean; + readonly env?: Readonly>; +} + +export function loadConfig(stateDir: string, options: LoadConfigOptions = {}): AgentConfig { + const { configPath } = getStatePaths(stateDir); + if (!existsSync(configPath)) { + throw new StateError(`Missing config.json at ${configPath}`); + } + + const raw = readJsonFile(configPath, "config.json"); + const parsed = rawConfigSchema.safeParse(raw); + if (!parsed.success) { + throw new StateError(`Invalid config.json at ${configPath}`); + } + + const allowInsecure = options.allowInsecure ?? isInsecureAllowed(options.env); + const apiUrl = validateApiUrl(parsed.data.api_url, allowInsecure); + return { apiUrl }; +} + +function parseIdentityFile(filePath: string): SigningKeyPair { + assertStrictPermissions(filePath); + const raw = readJsonFile(filePath, "identity.json"); + const parsed = identityFileSchema.safeParse(raw); + if (!parsed.success) { + throw new StateError(`Invalid identity.json at ${filePath}`); + } + + let publicKey: Uint8Array; + let secretKey: Uint8Array; + try { + publicKey = fromBase64Url(parsed.data.public_key); + secretKey = fromBase64Url(parsed.data.secret_key); + } catch { + throw new StateError(`Invalid key encoding in identity.json at ${filePath}`); + } + + if ( + publicKey.length !== SIGNING_PUBLIC_KEY_BYTES || + secretKey.length !== SIGNING_SECRET_KEY_BYTES + ) { + throw new StateError(`Invalid key length in identity.json at ${filePath}`); + } + + return { publicKey, secretKey }; +} + +export async function loadIdentityIfExists(stateDir: string): Promise { + await ready(); + const { identityPath } = getStatePaths(stateDir); + if (!existsSync(identityPath)) { + return null; + } + return parseIdentityFile(identityPath); +} + +export async function loadOrCreateIdentity(stateDir: string): Promise { + await ready(); + const { identityPath } = getStatePaths(stateDir); + if (existsSync(identityPath)) { + return parseIdentityFile(identityPath); + } + + const keyPair = generateSigningKeyPair(); + const content = `${JSON.stringify( + { + v: 1, + public_key: toBase64Url(keyPair.publicKey), + secret_key: toBase64Url(keyPair.secretKey), + }, + null, + 2, + )}\n`; + + writeFileAtomic(identityPath, content, { + mode: SECRET_FILE_MODE, + dirMode: STATE_DIR_MODE, + }); + + return keyPair; +} + +export async function loadTrust(stateDir: string): Promise { + await ready(); + const { trustPath } = getStatePaths(stateDir); + if (!existsSync(trustPath)) { + return []; + } + + const raw = readJsonFile(trustPath, "trust.json"); + const parsed = trustFileSchema.safeParse(raw); + if (!parsed.success) { + throw new StateError(`Invalid trust.json at ${trustPath}`); + } + + const keys: PublicKey[] = []; + for (const entry of parsed.data.accounts) { + let keyBytes: Uint8Array; + try { + keyBytes = fromBase64Url(entry.public_key); + } catch { + throw new StateError(`Invalid public_key encoding in trust.json at ${trustPath}`); + } + if (keyBytes.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new StateError(`Invalid public_key length in trust.json at ${trustPath}`); + } + keys.push(keyBytes); + } + + return keys; +} + +interface ReplayStateData { + readonly lastCounters: Map; + readonly recentIds: string[]; + readonly recentIdSet: Set; +} + +function loadReplayState(replayPath: string, maxRecentIds: number): ReplayStateData { + const lastCounters = new Map(); + const recentIds: string[] = []; + const recentIdSet = new Set(); + + if (!existsSync(replayPath)) { + return { lastCounters, recentIds, recentIdSet }; + } + + const raw = readJsonFile(replayPath, "replay.json"); + const parsed = replayFileSchema.safeParse(raw); + if (!parsed.success) { + throw new StateError(`Invalid replay.json at ${replayPath}`); + } + + for (const [signer, counter] of Object.entries(parsed.data.last_counter)) { + lastCounters.set(signer as KeyId, counter); + } + + const trimmed = + parsed.data.recent_ids.length > maxRecentIds + ? parsed.data.recent_ids.slice(parsed.data.recent_ids.length - maxRecentIds) + : parsed.data.recent_ids; + + for (const id of trimmed) { + if (!recentIdSet.has(id)) { + recentIdSet.add(id); + recentIds.push(id); + } + } + + return { lastCounters, recentIds, recentIdSet }; +} + +function persistReplayState(replayPath: string, state: ReplayStateData): void { + const lastCounterObj: Record = {}; + for (const [signer, counter] of state.lastCounters.entries()) { + lastCounterObj[signer] = counter; + } + + const payload = `${JSON.stringify({ + v: 1, + last_counter: lastCounterObj, + recent_ids: state.recentIds, + })}\n`; + + writeFileAtomic(replayPath, payload, { + mode: SECRET_FILE_MODE, + dirMode: STATE_DIR_MODE, + }); +} + +export interface FileTrustContextOptions { + readonly stateDir: string; + readonly agentKeyPair: SigningKeyPair; + readonly trustedAccountKeys: readonly PublicKey[]; + readonly revokedSessionIds?: Iterable; + readonly now?: () => number; + readonly maxRecentIds?: number; +} + +export interface FileTrustContext extends TrustContext { + setRevokedSessionIds(ids: Iterable): void; + flush(): void; +} + +export function createFileTrustContext(options: FileTrustContextOptions): FileTrustContext { + const { replayPath } = getStatePaths(options.stateDir); + const maxRecentIds = options.maxRecentIds ?? MAX_RECENT_REPLAY_IDS; + const trusted = new Map(); + for (const key of options.trustedAccountKeys) { + trusted.set(fingerprint(key), key); + } + + let revoked = new Set(options.revokedSessionIds); + const clock = options.now ?? (() => Date.now()); + const replay = loadReplayState(replayPath, maxRecentIds); + + return { + agentKeyPair: options.agentKeyPair, + + isTrustedAccountKey(id: KeyId): PublicKey | null { + return trusted.get(id) ?? null; + }, + + isSessionRevoked(certificateId: string): boolean { + return revoked.has(certificateId); + }, + + setRevokedSessionIds(ids: Iterable): void { + revoked = new Set(ids); + }, + + now(): number { + return clock(); + }, + + claimCommand(signer: KeyId, id: string, counter: number): boolean { + if (replay.recentIdSet.has(id)) { + return false; + } + const prev = replay.lastCounters.get(signer); + if (prev !== undefined && counter <= prev) { + return false; + } + + replay.recentIdSet.add(id); + replay.recentIds.push(id); + while (replay.recentIds.length > maxRecentIds) { + const oldest = replay.recentIds.shift(); + if (oldest !== undefined) { + replay.recentIdSet.delete(oldest); + } + } + replay.lastCounters.set(signer, counter); + persistReplayState(replayPath, replay); + return true; + }, + + flush(): void { + persistReplayState(replayPath, replay); + }, + }; +} diff --git a/src/cli/args.ts b/src/cli/args.ts new file mode 100644 index 0000000..fe7b361 --- /dev/null +++ b/src/cli/args.ts @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +export type ParsedCliCommand = + | { readonly kind: "run" } + | { readonly kind: "status" } + | { readonly kind: "identity" } + | { readonly kind: "link" } + | { readonly kind: "version" } + | { readonly kind: "help" } + | { readonly kind: "unknown"; readonly token: string }; + +export function parseCliArgs(argv: readonly string[]): ParsedCliCommand { + const first = argv[0]; + if (first === undefined) { + return { kind: "help" }; + } + + if (first === "--version" || first === "-v") { + return { kind: "version" }; + } + + if (first === "--help" || first === "-h" || first === "help") { + return { kind: "help" }; + } + + if (first === "run" && argv.length === 1) { + return { kind: "run" }; + } + + if (first === "status" && argv.length === 1) { + return { kind: "status" }; + } + + if (first === "identity" && argv.length === 1) { + return { kind: "identity" }; + } + + if (first === "link") { + return { kind: "link" }; + } + + return { kind: "unknown", token: argv.join(" ") }; +} + +export function formatUsage(versionLineText: string): string { + return [ + versionLineText, + "", + "Usage: tegrad ", + "", + "Commands:", + " run Connect to the control server and process commands", + " status Show local state directory, identity, config, and trust status", + " identity Create the agent identity if missing and print its fingerprint", + "", + "Options:", + " -v, --version Print version and exit", + " -h, --help Print this help message and exit", + "", + ].join("\n"); +} diff --git a/src/cli/cli.test.ts b/src/cli/cli.test.ts new file mode 100644 index 0000000..e5202aa --- /dev/null +++ b/src/cli/cli.test.ts @@ -0,0 +1,117 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, describe, expect, test } from "bun:test"; +import { mkdtempSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { getStatePaths } from "../agent"; +import { versionLine } from "../version"; +import { runCli } from "./main"; + +const tempDirs: string[] = []; + +function makeTempDir(): string { + const dir = mkdtempSync(join(tmpdir(), "tegrad-cli-test-")); + tempDirs.push(dir); + return dir; +} + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +async function invokeCli(argv: readonly string[], env: Record = {}) { + let stdout = ""; + let stderr = ""; + const code = await runCli(argv, { + env, + stdout: (text) => { + stdout += text; + }, + stderr: (text) => { + stderr += text; + }, + }); + return { code, stdout, stderr }; +} + +describe("CLI", () => { + test("--version and -v print version line and exit 0", async () => { + const r1 = await invokeCli(["--version"]); + expect(r1.code).toBe(0); + expect(r1.stdout).toBe(`${versionLine()}\n`); + + const r2 = await invokeCli(["-v"]); + expect(r2.code).toBe(0); + expect(r2.stdout).toBe(`${versionLine()}\n`); + }); + + test("--help and -h print usage and exit 0", async () => { + const r1 = await invokeCli(["--help"]); + expect(r1.code).toBe(0); + expect(r1.stdout).toContain("Usage: tegrad"); + + const r2 = await invokeCli(["-h"]); + expect(r2.code).toBe(0); + expect(r2.stdout).toContain("Usage: tegrad"); + }); + + test("unknown subcommand exits with code 2", async () => { + const res = await invokeCli(["does-not-exist"]); + expect(res.code).toBe(2); + expect(res.stderr).toContain("Usage: tegrad"); + }); + + test("link and link --reset respond 'not implemented' with exit code 2", async () => { + const r1 = await invokeCli(["link"]); + expect(r1.code).toBe(2); + expect(r1.stderr.trim()).toBe("not implemented"); + + const r2 = await invokeCli(["link", "--reset"]); + expect(r2.code).toBe(2); + expect(r2.stderr.trim()).toBe("not implemented"); + }); + + test("identity creates keypair and prints only fingerprint; status reports local state", async () => { + const dir = makeTempDir(); + const env = { TEGRAD_STATE_DIR: dir }; + + const beforeStatus = await invokeCli(["status"], env); + expect(beforeStatus.code).toBe(0); + expect(beforeStatus.stdout).toContain(`state_dir: ${dir}`); + expect(beforeStatus.stdout).toContain("fingerprint: not initialized"); + expect(beforeStatus.stdout).toContain("config: missing"); + expect(beforeStatus.stdout).toContain("trusted_accounts: 0"); + + const id1 = await invokeCli(["identity"], env); + expect(id1.code).toBe(0); + const fp = id1.stdout.trim(); + expect(fp).toMatch(/^[a-z2-7]{32}$/); + + const id2 = await invokeCli(["identity"], env); + expect(id2.code).toBe(0); + expect(id2.stdout.trim()).toBe(fp); + + const { configPath } = getStatePaths(dir); + writeFileSync(configPath, JSON.stringify({ api_url: "https://api.tegra.example" }), "utf8"); + + const afterStatus = await invokeCli(["status"], env); + expect(afterStatus.code).toBe(0); + expect(afterStatus.stdout).toContain(`fingerprint: ${fp}`); + expect(afterStatus.stdout).toContain("config: present"); + expect(afterStatus.stdout).toContain("trusted_accounts: 0"); + }); + + test("run fails clearly when config.json is missing", async () => { + const dir = makeTempDir(); + const res = await invokeCli(["run"], { TEGRAD_STATE_DIR: dir }); + expect(res.code).toBe(1); + expect(res.stderr).toContain("config.json"); + }); +}); diff --git a/src/cli/e2e.test.ts b/src/cli/e2e.test.ts new file mode 100644 index 0000000..ba8f5ea --- /dev/null +++ b/src/cli/e2e.test.ts @@ -0,0 +1,152 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeAll, describe, expect, test } from "bun:test"; +import { mkdtempSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { createLogger, getStatePaths, loadOrCreateIdentity } from "../agent"; +import { fingerprint, generateSigningKeyPair, ready, toBase64Url } from "../crypto"; +import { + createCoreRegistry, + createSignedCommand, + openAgentMessage, + PROTOCOL_VERSION, + type TransportFrame, + transportFrameSchema, +} from "../protocol"; +import { createAgentRuntime } from "./run"; + +const tempDirs: string[] = []; + +function makeTempDir(): string { + const dir = mkdtempSync(join(tmpdir(), "tegrad-e2e-test-")); + tempDirs.push(dir); + return dir; +} + +beforeAll(async () => { + await ready(); +}); + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +describe("E2E local WebSocket ping/pong", () => { + test("agent connects to local WS server, receives signed agent.ping, and replies with agent.pong + ack", async () => { + const stateDir = makeTempDir(); + const agent = await loadOrCreateIdentity(stateDir); + const agentId = fingerprint(agent.publicKey); + const account = generateSigningKeyPair(); + const registry = createCoreRegistry(); + const now = Date.now(); + + const receivedFrames: TransportFrame[] = []; + let resolveBoth!: () => void; + const bothReceived = new Promise((resolve) => { + resolveBoth = resolve; + }); + + const signedPing = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now, + }, + registry, + ); + + const server = Bun.serve({ + hostname: "127.0.0.1", + port: 0, + fetch(req, srv) { + const url = new URL(req.url); + if (url.pathname === "/agents/connect" && url.searchParams.get("agent") === agentId) { + if (srv.upgrade(req)) { + return; + } + } + return new Response("Not found", { status: 404 }); + }, + websocket: { + open(ws) { + const commandFrame: TransportFrame = { + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: agentId }, + body: signedPing, + }; + ws.send(JSON.stringify(commandFrame)); + }, + message(_ws, message) { + const text = typeof message === "string" ? message : new TextDecoder().decode(message); + const frame = transportFrameSchema.parse(JSON.parse(text)); + receivedFrames.push(frame); + const hasEvent = receivedFrames.some((f) => f.kind === "event"); + const hasAck = receivedFrames.some((f) => f.kind === "ack"); + if (hasEvent && hasAck) { + resolveBoth(); + } + }, + }, + }); + + const { configPath, trustPath } = getStatePaths(stateDir); + writeFileSync( + configPath, + JSON.stringify({ api_url: `http://127.0.0.1:${server.port}` }), + "utf8", + ); + writeFileSync( + trustPath, + JSON.stringify({ v: 1, accounts: [{ public_key: toBase64Url(account.publicKey) }] }), + "utf8", + ); + + const runtime = await createAgentRuntime({ + stateDir, + env: { TEGRAD_ALLOW_INSECURE: "1" }, + logger: createLogger({ level: "error", stdout: () => {}, stderr: () => {} }), + now: () => now, + }); + + try { + runtime.start(); + await Promise.race([ + bothReceived, + new Promise((_, reject) => + setTimeout(() => reject(new Error("Timed out waiting for agent.pong and ack")), 5000), + ), + ]); + + const eventFrame = receivedFrames.find((f) => f.kind === "event"); + const ackFrame = receivedFrames.find((f) => f.kind === "ack"); + + expect(eventFrame).toBeDefined(); + if (eventFrame?.kind === "event") { + const opened = openAgentMessage(eventFrame.body, agent.publicKey, account); + expect(opened.header.type).toBe("agent.pong"); + expect(opened.body).toEqual({ at: now }); + } + + expect(ackFrame).toEqual({ + v: PROTOCOL_VERSION, + kind: "ack", + route: { agent: agentId }, + body: { id: signedPing.header.id, ok: true }, + }); + } finally { + await runtime.shutdown(2000); + server.stop(true); + } + }); +}); diff --git a/src/cli/main.ts b/src/cli/main.ts new file mode 100644 index 0000000..2b3a4e8 --- /dev/null +++ b/src/cli/main.ts @@ -0,0 +1,101 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { existsSync } from "node:fs"; +import { + getStatePaths, + loadIdentityIfExists, + loadOrCreateIdentity, + loadTrust, + resolveStateDir, +} from "../agent"; +import { fingerprint } from "../crypto"; +import { versionLine } from "../version"; +import { formatUsage, parseCliArgs } from "./args"; +import { runAgentLoop } from "./run"; + +export interface CliDependencies { + readonly env?: Readonly>; + readonly stdout?: (text: string) => void; + readonly stderr?: (text: string) => void; + readonly runAgent?: ( + stateDir: string, + env: Readonly>, + ) => Promise; +} + +export async function runCli(argv: readonly string[], deps: CliDependencies = {}): Promise { + const env = deps.env ?? process.env; + const stdout = deps.stdout ?? ((text: string) => process.stdout.write(text)); + const stderr = deps.stderr ?? ((text: string) => process.stderr.write(text)); + const parsed = parseCliArgs(argv); + + switch (parsed.kind) { + case "version": { + stdout(`${versionLine()}\n`); + return 0; + } + + case "help": { + stdout(formatUsage(versionLine())); + return 0; + } + + case "link": { + stderr("not implemented\n"); + return 2; + } + + case "unknown": { + stderr(`Unknown command: ${parsed.token}\n\n${formatUsage(versionLine())}`); + return 2; + } + + case "identity": { + try { + const stateDir = resolveStateDir(env); + const keyPair = await loadOrCreateIdentity(stateDir); + stdout(`${fingerprint(keyPair.publicKey)}\n`); + return 0; + } catch (err) { + stderr(`${err instanceof Error ? err.message : String(err)}\n`); + return 1; + } + } + + case "status": { + try { + const stateDir = resolveStateDir(env); + const paths = getStatePaths(stateDir); + const identity = await loadIdentityIfExists(stateDir); + const hasConfig = existsSync(paths.configPath); + const trustedKeys = await loadTrust(stateDir); + + const lines = [ + `state_dir: ${stateDir}`, + `fingerprint: ${identity ? fingerprint(identity.publicKey) : "not initialized"}`, + `config: ${hasConfig ? "present" : "missing"}`, + `trusted_accounts: ${trustedKeys.length}`, + ]; + stdout(`${lines.join("\n")}\n`); + return 0; + } catch (err) { + stderr(`${err instanceof Error ? err.message : String(err)}\n`); + return 1; + } + } + + case "run": { + try { + const stateDir = resolveStateDir(env); + if (deps.runAgent) { + return await deps.runAgent(stateDir, env); + } + return await runAgentLoop({ stateDir, env }); + } catch (err) { + stderr(`${err instanceof Error ? err.message : String(err)}\n`); + return 1; + } + } + } +} diff --git a/src/cli/run.ts b/src/cli/run.ts new file mode 100644 index 0000000..2672231 --- /dev/null +++ b/src/cli/run.ts @@ -0,0 +1,150 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { + type AgentConnection, + type CommandQueue, + createAgentConnection, + createCommandQueue, + createFileTrustContext, + createLogger, + type FileTrustContext, + type Logger, + loadConfig, + loadOrCreateIdentity, + loadTrust, + type TimerProvider, + type WebSocketFactory, +} from "../agent"; +import { fingerprint } from "../crypto"; +import { type CommandRegistry, createCoreRegistry, type TransportFrame } from "../protocol"; + +export const SHUTDOWN_DRAIN_TIMEOUT_MS = 10_000; + +export interface AgentRuntime { + readonly agentId: string; + readonly connection: AgentConnection; + readonly queue: CommandQueue; + readonly trust: FileTrustContext; + readonly logger: Logger; + start(): void; + shutdown(drainTimeoutMs?: number): Promise; +} + +export interface CreateAgentRuntimeOptions { + readonly stateDir: string; + readonly env?: Readonly>; + readonly logger?: Logger; + readonly registry?: CommandRegistry; + readonly webSocketFactory?: WebSocketFactory; + readonly timers?: TimerProvider; + readonly now?: () => number; +} + +export async function createAgentRuntime( + options: CreateAgentRuntimeOptions, +): Promise { + const env = options.env ?? process.env; + const logger = options.logger ?? createLogger({ env }); + const config = loadConfig(options.stateDir, { env }); + const agentKeyPair = await loadOrCreateIdentity(options.stateDir); + const trustedAccountKeys = await loadTrust(options.stateDir); + const agentId = fingerprint(agentKeyPair.publicKey); + const registry = options.registry ?? createCoreRegistry(); + + const trust = createFileTrustContext({ + stateDir: options.stateDir, + agentKeyPair, + trustedAccountKeys, + ...(options.now !== undefined ? { now: options.now } : {}), + }); + + let connectionRef: AgentConnection | null = null; + const queue = createCommandQueue({ + trust, + registry, + logger, + sendFrame: (frame: TransportFrame) => { + connectionRef?.send(frame); + }, + }); + + const connection = createAgentConnection({ + apiUrl: config.apiUrl, + agentId, + logger, + onFrame: (frame) => { + if (frame.kind === "command") { + void queue.enqueue(frame); + } + }, + ...(options.webSocketFactory !== undefined + ? { webSocketFactory: options.webSocketFactory } + : {}), + ...(options.timers !== undefined ? { timers: options.timers } : {}), + }); + connectionRef = connection; + + let shutdownPromise: Promise | null = null; + + return { + agentId, + connection, + queue, + trust, + logger, + + start(): void { + logger.info("Starting tegrad", { agentId }); + connection.start(); + }, + + shutdown(drainTimeoutMs: number = SHUTDOWN_DRAIN_TIMEOUT_MS): Promise { + if (shutdownPromise !== null) { + return shutdownPromise; + } + shutdownPromise = (async () => { + logger.info("Shutting down tegrad"); + connection.stop(); + const drained = await queue.drain(drainTimeoutMs); + if (!drained) { + logger.warn("Shutdown drain timeout elapsed before active command finished", { + drainTimeoutMs, + }); + } + trust.flush(); + logger.info("Shutdown complete"); + })(); + return shutdownPromise; + }, + }; +} + +export interface RunAgentLoopOptions extends CreateAgentRuntimeOptions { + readonly signalTarget?: Pick; + readonly drainTimeoutMs?: number; +} + +export async function runAgentLoop(options: RunAgentLoopOptions): Promise { + const runtime = await createAgentRuntime(options); + const signalTarget = options.signalTarget ?? process; + const drainTimeoutMs = options.drainTimeoutMs ?? SHUTDOWN_DRAIN_TIMEOUT_MS; + + return await new Promise((resolve) => { + let stopping = false; + + const handleSignal = (): void => { + if (stopping) { + return; + } + stopping = true; + signalTarget.off("SIGINT", handleSignal); + signalTarget.off("SIGTERM", handleSignal); + void runtime.shutdown(drainTimeoutMs).then(() => resolve(0)); + }; + + signalTarget.on("SIGINT", handleSignal); + signalTarget.on("SIGTERM", handleSignal); + runtime.start(); + }); +} diff --git a/src/index.ts b/src/index.ts index b83cf02..3f16e7b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,12 +1,9 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import { versionLine } from "./version"; +import { runCli } from "./cli/main"; -const args = process.argv.slice(2); - -if (args.includes("--version") || args.includes("-v")) { - process.stdout.write(`${versionLine()}\n`); -} else { - process.stdout.write(`${versionLine()}\nUsage: tegrad [--version]\n`); +const exitCode = await runCli(process.argv.slice(2)); +if (exitCode !== 0) { + process.exit(exitCode); } From 0c53e4ce27b497fbdbd298b1bc61c6f9932ea31f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 22 Nov 2026 18:55:35 -0300 Subject: [PATCH 03/59] feat: add account vault, recovery codes, password policy, and sessions --- bun.lock | 13 + package.json | 6 +- scripts/kdf-bench.ts | 60 ++++ src/crypto/crypto.test.ts | 29 ++ src/crypto/hash.ts | 22 ++ src/crypto/index.ts | 1 + src/isomorphic.test.ts | 4 +- src/vault/blob.ts | 128 ++++++++ src/vault/counter.ts | 24 ++ src/vault/errors.ts | 21 ++ src/vault/index.ts | 60 ++++ src/vault/password.ts | 57 ++++ src/vault/recovery-code.ts | 148 ++++++++++ src/vault/session.ts | 242 +++++++++++++++ src/vault/vault.test.ts | 591 +++++++++++++++++++++++++++++++++++++ src/vault/vault.ts | 445 ++++++++++++++++++++++++++++ 16 files changed, 1848 insertions(+), 3 deletions(-) create mode 100644 scripts/kdf-bench.ts create mode 100644 src/crypto/hash.ts create mode 100644 src/vault/blob.ts create mode 100644 src/vault/counter.ts create mode 100644 src/vault/errors.ts create mode 100644 src/vault/index.ts create mode 100644 src/vault/password.ts create mode 100644 src/vault/recovery-code.ts create mode 100644 src/vault/session.ts create mode 100644 src/vault/vault.test.ts create mode 100644 src/vault/vault.ts diff --git a/bun.lock b/bun.lock index b9dfdde..e53b637 100644 --- a/bun.lock +++ b/bun.lock @@ -5,6 +5,9 @@ "": { "name": "tegrad", "dependencies": { + "@zxcvbn-ts/core": "^4.3.0", + "@zxcvbn-ts/language-common": "^4.2.0", + "@zxcvbn-ts/language-en": "^4.1.2", "libsodium-wrappers-sumo": "^0.8.4", "zod": "^4.6.7", }, @@ -85,8 +88,18 @@ "@typescript/typescript-win32-x64": ["@typescript/typescript-win32-x64@7.0.2", "", { "os": "win32", "cpu": "x64" }, "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g=="], + "@zxcvbn-ts/core": ["@zxcvbn-ts/core@4.3.0", "", { "dependencies": { "fastest-levenshtein": "1.0.16" } }, "sha512-Y5Nes+T9TweCdA/X1zji6KZiepThNP52kNXAo9omdyI5fltlDqIBgFeIwEepehzVUiGdYvL+YsbCYyyS3yn2nw=="], + + "@zxcvbn-ts/dictionary-compression": ["@zxcvbn-ts/dictionary-compression@3.0.1", "", {}, "sha512-p3KyPzxGc3vWSap5hHA6SllbUCmh7s+NtpGyC3qEWrxYJT9t9TUAzjPm48Okipo+UUyPQfDlIvTcs9JRShBFiQ=="], + + "@zxcvbn-ts/language-common": ["@zxcvbn-ts/language-common@4.2.0", "", { "dependencies": { "@zxcvbn-ts/dictionary-compression": "^3.0.1" } }, "sha512-LPcIu73i+ZV2fYPRDAd/JfaBblFUMVXSjupxkr0NU04wViVkYuzZ6ncw6pDgUdm7MMM5llMMzkbzhKrwXgv1tg=="], + + "@zxcvbn-ts/language-en": ["@zxcvbn-ts/language-en@4.1.2", "", { "dependencies": { "@zxcvbn-ts/dictionary-compression": "^3.0.1" } }, "sha512-VICTXVOYrfSCtmrLLv41x4nx34H+BEJO2FPYMUXK3DGYxVtBfqUKx9Xq9WfxBpDAvvlQ4DocUA9bqNN18zKMXA=="], + "bun-types": ["bun-types@1.4.5", "", { "dependencies": { "@types/node": "*", "undici-types": "*" } }, "sha512-ECHn+9dhL3wv0G6u0+7dQvrnaimXiRDxxerYBmhTaLyJEEuvTPWk2Fye3XIf5Y++JIIiHKfQw4Z7V5D8KuiXbg=="], + "fastest-levenshtein": ["fastest-levenshtein@1.0.16", "", {}, "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg=="], + "libsodium-sumo": ["libsodium-sumo@0.8.4", "", {}, "sha512-TMtHShQfVVsaxDygyapvUC3o7YsPgXa/hRWeIgzyFz6w5k/1hirGptCxp1U7XwW3rCskaTTYKgV10v86UiGgNw=="], "libsodium-wrappers-sumo": ["libsodium-wrappers-sumo@0.8.4", "", { "dependencies": { "libsodium-sumo": "^0.8.0" } }, "sha512-ql7hcgulKZ3ekfa2DGAogcCKsWU0diA/0nArz1CFzh93WQdb46/Kj18ka/Hifq6uA3Ush34Pc6vU/6HXeRwUkg=="], diff --git a/package.json b/package.json index bcc932f..69ba42a 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "type": "module", "exports": { "./protocol": "./src/protocol/index.ts", - "./crypto": "./src/crypto/index.ts" + "./crypto": "./src/crypto/index.ts", + "./vault": "./src/vault/index.ts" }, "engines": { "bun": ">=1.3.0" @@ -28,6 +29,9 @@ "typescript": "^7.0.2" }, "dependencies": { + "@zxcvbn-ts/core": "^4.3.0", + "@zxcvbn-ts/language-common": "^4.2.0", + "@zxcvbn-ts/language-en": "^4.1.2", "libsodium-wrappers-sumo": "^0.8.4", "zod": "^4.6.7" } diff --git a/scripts/kdf-bench.ts b/scripts/kdf-bench.ts new file mode 100644 index 0000000..373ff17 --- /dev/null +++ b/scripts/kdf-bench.ts @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { + deriveKeyFromPassword, + generateSalt, + KDF_FLOOR, + KDF_MODERATE, + type KdfPreset, + memzero, + ready, +} from "../src/crypto"; + +const ITERATIONS = 3; + +function formatMiB(bytes: number): string { + return `${(bytes / (1024 * 1024)).toFixed(1)} MiB`; +} + +function benchPreset(name: string, preset: KdfPreset): void { + const salt = generateSalt(); + const durations: number[] = []; + let peakRss = process.memoryUsage().rss; + const baselineRss = peakRss; + + for (let i = 0; i < ITERATIONS; i++) { + const start = performance.now(); + const key = deriveKeyFromPassword("correct-horse-battery-staple-42!", { + ...preset, + salt, + }); + const elapsed = performance.now() - start; + const rssAfter = process.memoryUsage().rss; + if (rssAfter > peakRss) { + peakRss = rssAfter; + } + memzero(key); + durations.push(elapsed); + } + + const avgMs = durations.reduce((a, b) => a + b, 0) / durations.length; + const minMs = Math.min(...durations); + const maxMs = Math.max(...durations); + + process.stdout.write( + `${name} (opslimit=${preset.opslimit}, memlimit=${formatMiB(preset.memlimit)}):\n`, + ); + process.stdout.write( + ` time: avg=${avgMs.toFixed(1)}ms min=${minMs.toFixed(1)}ms max=${maxMs.toFixed(1)}ms (${ITERATIONS} runs)\n`, + ); + process.stdout.write( + ` rss: baseline=${formatMiB(baselineRss)} peak=${formatMiB(peakRss)} delta=${formatMiB(Math.max(0, peakRss - baselineRss))}\n`, + ); +} + +await ready(); + +process.stdout.write(`KDF benchmark on Bun ${Bun.version} (${process.platform}/${process.arch})\n`); +benchPreset("KDF_FLOOR", KDF_FLOOR); +benchPreset("KDF_MODERATE", KDF_MODERATE); diff --git a/src/crypto/crypto.test.ts b/src/crypto/crypto.test.ts index 743a858..fc2a455 100644 --- a/src/crypto/crypto.test.ts +++ b/src/crypto/crypto.test.ts @@ -13,6 +13,8 @@ import { generateSalt, generateSigningKeyPair, generateSymmetricKey, + HASH_BYTES, + hash, KDF_FLOOR, KDF_MODERATE, openSealed, @@ -178,3 +180,30 @@ describe("canonicalize", () => { expect(() => canonicalize(circular)).toThrow(); }); }); + +describe("hash (BLAKE2b)", () => { + test("produces deterministic 32-byte digest with and without key", () => { + const enc = new TextEncoder(); + const data = enc.encode("tegra-hash-input"); + const digest1 = hash(data); + const digest2 = hash(data); + expect(digest1.length).toBe(HASH_BYTES); + expect(digest1).toEqual(digest2); + + const other = hash(enc.encode("tegra-hash-other")); + expect(digest1).not.toEqual(other); + + const key = new Uint8Array(32).fill(0x5a); + const keyed1 = hash(data, key); + const keyed2 = hash(data, key); + expect(keyed1.length).toBe(HASH_BYTES); + expect(keyed1).toEqual(keyed2); + expect(keyed1).not.toEqual(digest1); + }); + + test("rejects invalid key lengths", () => { + const data = new TextEncoder().encode("data"); + expect(() => hash(data, new Uint8Array(8))).toThrow(RangeError); + expect(() => hash(data, new Uint8Array(65))).toThrow(RangeError); + }); +}); diff --git a/src/crypto/hash.ts b/src/crypto/hash.ts new file mode 100644 index 0000000..02568e4 --- /dev/null +++ b/src/crypto/hash.ts @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { getSodium } from "./sodium"; + +export const HASH_BYTES = 32; + +export function hash(data: Uint8Array, key?: Uint8Array): Uint8Array { + const s = getSodium(); + if (key !== undefined) { + if ( + key.length < s.crypto_generichash_KEYBYTES_MIN || + key.length > s.crypto_generichash_KEYBYTES_MAX + ) { + throw new RangeError( + `Hash key must be between ${s.crypto_generichash_KEYBYTES_MIN} and ${s.crypto_generichash_KEYBYTES_MAX} bytes`, + ); + } + return s.crypto_generichash(HASH_BYTES, data, key); + } + return s.crypto_generichash(HASH_BYTES, data, null); +} diff --git a/src/crypto/index.ts b/src/crypto/index.ts index c600ead..62df0f2 100644 --- a/src/crypto/index.ts +++ b/src/crypto/index.ts @@ -12,6 +12,7 @@ export { export { openSealed, sealTo } from "./box"; export { canonicalize } from "./canonical"; export { fromBase64Url, toBase32, toBase64Url } from "./encoding"; +export { HASH_BYTES, hash } from "./hash"; export { assertKdfParams, deriveKeyFromPassword, diff --git a/src/isomorphic.test.ts b/src/isomorphic.test.ts index 789dd7a..07d6671 100644 --- a/src/isomorphic.test.ts +++ b/src/isomorphic.test.ts @@ -13,11 +13,11 @@ const FORBIDDEN_PATTERNS: readonly { name: string; regex: RegExp }[] = [ { name: "fs import", regex: /from\s+["']fs["']|from\s+["']fs\/promises["']/ }, ]; -test("src/crypto and src/protocol are isomorphic (no Node/Bun-only APIs)", async () => { +test("src/crypto, src/protocol, and src/vault are isomorphic (no Node/Bun-only APIs)", async () => { const violations: string[] = []; let checkedCount = 0; - for await (const path of new Glob("src/{crypto,protocol}/**/*.ts").scan(".")) { + for await (const path of new Glob("src/{crypto,protocol,vault}/**/*.ts").scan(".")) { if (path.endsWith(".test.ts")) continue; checkedCount++; const content = await Bun.file(path).text(); diff --git a/src/vault/blob.ts b/src/vault/blob.ts new file mode 100644 index 0000000..f15fd50 --- /dev/null +++ b/src/vault/blob.ts @@ -0,0 +1,128 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; +import { + assertKdfParams, + canonicalize, + fromBase64Url, + KDF_ALG_ARGON2ID13, + type KdfParams, + SIGNING_PUBLIC_KEY_BYTES, +} from "../crypto"; +import { base64UrlSchema, type KeyId, keyIdSchema } from "../protocol"; +import { VaultError } from "./errors"; + +export const VAULT_VERSION = 1 as const; + +export const vaultKdfSchema = z.object({ + alg: z.literal(KDF_ALG_ARGON2ID13), + opslimit: z.number().int().positive(), + memlimit: z.number().int().positive(), + salt: base64UrlSchema, +}); + +export const vaultBlobSchema = z.object({ + v: z.literal(VAULT_VERSION), + account: keyIdSchema, + public_key: base64UrlSchema, + created_at: z.number().int().nonnegative(), + password: z.object({ + kdf: vaultKdfSchema, + wrapped_secret: base64UrlSchema, + }), + recovery: z.object({ + wrapped_secret: base64UrlSchema, + }), +}); + +export type VaultKdf = z.infer; +export type VaultBlob = z.infer; + +export interface ParsedVaultBlob { + readonly blob: VaultBlob; + readonly publicKeyBytes: Uint8Array; + readonly kdfParams: KdfParams; + readonly passwordWrapped: Uint8Array; + readonly recoveryWrapped: Uint8Array; +} + +export function parseVaultBlob(input: unknown): ParsedVaultBlob { + const parsed = vaultBlobSchema.safeParse(input); + if (!parsed.success) { + throw new VaultError("invalid_blob", "Malformed vault blob"); + } + + const blob = parsed.data; + + let publicKeyBytes: Uint8Array; + let saltBytes: Uint8Array; + let passwordWrapped: Uint8Array; + let recoveryWrapped: Uint8Array; + try { + publicKeyBytes = fromBase64Url(blob.public_key); + saltBytes = fromBase64Url(blob.password.kdf.salt); + passwordWrapped = fromBase64Url(blob.password.wrapped_secret); + recoveryWrapped = fromBase64Url(blob.recovery.wrapped_secret); + } catch { + throw new VaultError("invalid_blob", "Invalid base64url encoding in vault blob"); + } + + if (publicKeyBytes.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new VaultError("invalid_blob", "Invalid account public key length in vault blob"); + } + + const kdfParams: KdfParams = { + alg: blob.password.kdf.alg, + opslimit: blob.password.kdf.opslimit, + memlimit: blob.password.kdf.memlimit, + salt: saltBytes, + }; + + try { + assertKdfParams(kdfParams); + } catch { + throw new VaultError("invalid_blob", "Vault blob KDF parameters do not meet minimum floor"); + } + + return { + blob, + publicKeyBytes, + kdfParams, + passwordWrapped, + recoveryWrapped, + }; +} + +export function buildPasswordAad(fields: { + readonly v: typeof VAULT_VERSION; + readonly account: KeyId; + readonly public_key: string; + readonly kdf: VaultKdf; +}): Uint8Array { + return canonicalize({ + context: "tegra-vault-v1:password", + v: fields.v, + account: fields.account, + public_key: fields.public_key, + kdf: { + alg: fields.kdf.alg, + opslimit: fields.kdf.opslimit, + memlimit: fields.kdf.memlimit, + salt: fields.kdf.salt, + }, + }); +} + +export function buildRecoveryAad(fields: { + readonly v: typeof VAULT_VERSION; + readonly account: KeyId; + readonly public_key: string; +}): Uint8Array { + return canonicalize({ + context: "tegra-vault-v1:recovery", + v: fields.v, + account: fields.account, + public_key: fields.public_key, + }); +} diff --git a/src/vault/counter.ts b/src/vault/counter.ts new file mode 100644 index 0000000..03d5135 --- /dev/null +++ b/src/vault/counter.ts @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import type { KeyId } from "../protocol"; + +export interface CounterStore { + next(signer: KeyId, now: number): Promise; +} + +export function createMemoryCounterStore(): CounterStore { + const lastBySigner = new Map(); + + return { + async next(signer: KeyId, now: number): Promise { + if (!Number.isSafeInteger(now) || now < 0) { + throw new RangeError("now must be a non-negative safe integer"); + } + const prev = lastBySigner.get(signer); + const value = prev === undefined ? now : Math.max(prev + 1, now); + lastBySigner.set(signer, value); + return value; + }, + }; +} diff --git a/src/vault/errors.ts b/src/vault/errors.ts new file mode 100644 index 0000000..aefbee8 --- /dev/null +++ b/src/vault/errors.ts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +export type VaultErrorCode = + | "weak_password" + | "wrong_password" + | "unlock_failed" + | "invalid_blob" + | "invalid_recovery_code" + | "locked" + | "invalid_session"; + +export class VaultError extends Error { + readonly code: VaultErrorCode; + + constructor(code: VaultErrorCode, message: string) { + super(message); + this.name = "VaultError"; + this.code = code; + } +} diff --git a/src/vault/index.ts b/src/vault/index.ts new file mode 100644 index 0000000..c9bd6a9 --- /dev/null +++ b/src/vault/index.ts @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +export { + buildPasswordAad, + buildRecoveryAad, + type ParsedVaultBlob, + parseVaultBlob, + VAULT_VERSION, + type VaultBlob, + type VaultKdf, + vaultBlobSchema, + vaultKdfSchema, +} from "./blob"; +export { type CounterStore, createMemoryCounterStore } from "./counter"; +export { VaultError, type VaultErrorCode } from "./errors"; +export { + MIN_PASSWORD_LENGTH, + MIN_PASSWORD_SCORE, + type PasswordValidationResult, + type ValidatePasswordOptions, + validatePassword, +} from "./password"; +export { + deriveRecoveryKey, + formatRecoveryCode, + generateRecoveryCodeBytes, + parseRecoveryCode, + RECOVERY_CODE_BYTES, +} from "./recovery-code"; +export { + createCommandFromSession, + createSensitiveCommand, + type IssueSessionOptions, + isSessionExpired, + issueSession, + parseSession, + SESSION_DURATION_MS, + type Session, + type SessionDuration, + type SignRevocationParams, + serializeSession, + sessionExpiresAt, + signRevocation, + type VaultCommandParams, +} from "./session"; +export { + type ChangePasswordOptions, + type CreateVaultParams, + type CreateVaultResult, + changePassword, + createVault, + type RotateRecoveryCodeResult, + resetPasswordWithRecovery, + rotateRecoveryCode, + type UnlockedVault, + unlockVault, + unlockVaultWithRecovery, + withUnlockedVault, +} from "./vault"; diff --git a/src/vault/password.ts b/src/vault/password.ts new file mode 100644 index 0000000..c1bc10e --- /dev/null +++ b/src/vault/password.ts @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { ZxcvbnFactory } from "@zxcvbn-ts/core"; +import { + adjacencyGraphs as commonAdjacencyGraphs, + dictionary as commonDictionary, +} from "@zxcvbn-ts/language-common"; +import { dictionary as enDictionary } from "@zxcvbn-ts/language-en"; + +export const MIN_PASSWORD_LENGTH = 12; +export const MIN_PASSWORD_SCORE = 3; + +export interface ValidatePasswordOptions { + readonly userInputs?: readonly string[]; +} + +export type PasswordValidationResult = + | { readonly ok: true } + | { readonly ok: false; readonly reason: "too_short" | "too_weak" }; + +let evaluator: ZxcvbnFactory | null = null; + +function getEvaluator(): ZxcvbnFactory { + if (evaluator === null) { + evaluator = new ZxcvbnFactory({ + dictionary: { + ...commonDictionary, + ...enDictionary, + }, + graphs: commonAdjacencyGraphs, + }); + } + return evaluator; +} + +export function validatePassword( + password: string, + options?: ValidatePasswordOptions, +): PasswordValidationResult { + const codePointLength = [...password].length; + if (codePointLength < MIN_PASSWORD_LENGTH) { + return { ok: false, reason: "too_short" }; + } + + if (password.trim().length === 0) { + return { ok: false, reason: "too_weak" }; + } + + const userInputs = options?.userInputs ? [...options.userInputs] : []; + const result = getEvaluator().check(password, userInputs); + if (result.score < MIN_PASSWORD_SCORE) { + return { ok: false, reason: "too_weak" }; + } + + return { ok: true }; +} diff --git a/src/vault/recovery-code.ts b/src/vault/recovery-code.ts new file mode 100644 index 0000000..cbd80bf --- /dev/null +++ b/src/vault/recovery-code.ts @@ -0,0 +1,148 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { hash, memzero, randomBytes } from "../crypto"; +import { VaultError } from "./errors"; + +export const RECOVERY_CODE_BYTES = 32; + +const CROCKFORD_ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"; +const DATA_CHAR_COUNT = 52; // ceil(256 / 5) = 52 symbols (4 trailing zero bits) +const TOTAL_CHAR_COUNT = DATA_CHAR_COUNT + 1; // + 1 check character +const GROUP_SIZE = 4; + +const CROCKFORD_LOOKUP = new Int8Array(128).fill(-1); +for (let i = 0; i < CROCKFORD_ALPHABET.length; i++) { + CROCKFORD_LOOKUP[CROCKFORD_ALPHABET.charCodeAt(i)] = i; +} +// Standard Crockford base32 normalization for visually similar characters +CROCKFORD_LOOKUP["I".charCodeAt(0)] = 1; +CROCKFORD_LOOKUP["L".charCodeAt(0)] = 1; +CROCKFORD_LOOKUP["O".charCodeAt(0)] = 0; + +const utf8Encoder = new TextEncoder(); +const DOMAIN_RECOVERY_KEY = utf8Encoder.encode("tegra-vault-v1:recovery-key\0"); + +// Polynomial checksum over GF(32) with irreducible polynomial x^5 + x^2 + 1 (0x25). +// Detects 100% of single-character substitutions and 100% of adjacent transpositions. +function computeCheckSymbol(symbols: readonly number[]): number { + let acc = 0; + for (let i = 0; i < symbols.length; i++) { + const sym = symbols[i] ?? 0; + const shifted = acc << 1; + acc = (shifted >= 32 ? shifted ^ 0x25 : shifted) ^ sym; + } + return acc & 0x1f; +} + +export function generateRecoveryCodeBytes(): Uint8Array { + return randomBytes(RECOVERY_CODE_BYTES); +} + +export function formatRecoveryCode(bytes: Uint8Array): string { + if (bytes.length !== RECOVERY_CODE_BYTES) { + throw new RangeError(`Recovery code must be ${RECOVERY_CODE_BYTES} bytes`); + } + + const symbols: number[] = []; + let bitBuffer = 0; + let bitsLeft = 0; + + for (let i = 0; i < bytes.length; i++) { + bitBuffer = (bitBuffer << 8) | (bytes[i] ?? 0); + bitsLeft += 8; + while (bitsLeft >= 5) { + bitsLeft -= 5; + symbols.push((bitBuffer >>> bitsLeft) & 0x1f); + } + } + + if (bitsLeft > 0) { + symbols.push((bitBuffer << (5 - bitsLeft)) & 0x1f); + } + + const check = computeCheckSymbol(symbols); + + const groups: string[] = []; + for (let i = 0; i < symbols.length; i += GROUP_SIZE) { + let group = ""; + for (let j = i; j < i + GROUP_SIZE && j < symbols.length; j++) { + group += CROCKFORD_ALPHABET[symbols[j] ?? 0] ?? ""; + } + groups.push(group); + } + + const checkChar = CROCKFORD_ALPHABET[check] ?? ""; + return `${groups.join("-")}-${checkChar}`; +} + +export function parseRecoveryCode(code: string): Uint8Array { + const cleaned = code.replace(/[\s-]+/g, "").toUpperCase(); + if (cleaned.length !== TOTAL_CHAR_COUNT) { + throw new VaultError("invalid_recovery_code", "Invalid recovery code format"); + } + + const symbols: number[] = new Array(DATA_CHAR_COUNT); + for (let i = 0; i < DATA_CHAR_COUNT; i++) { + const charCode = cleaned.charCodeAt(i); + if (charCode >= 128) { + throw new VaultError("invalid_recovery_code", "Invalid recovery code character"); + } + const val = CROCKFORD_LOOKUP[charCode] ?? -1; + if (val < 0) { + throw new VaultError("invalid_recovery_code", "Invalid recovery code character"); + } + symbols[i] = val; + } + + const checkCharCode = cleaned.charCodeAt(DATA_CHAR_COUNT); + if (checkCharCode >= 128) { + throw new VaultError("invalid_recovery_code", "Invalid recovery code check character"); + } + const providedCheck = CROCKFORD_LOOKUP[checkCharCode] ?? -1; + if (providedCheck < 0) { + throw new VaultError("invalid_recovery_code", "Invalid recovery code check character"); + } + + if (computeCheckSymbol(symbols) !== providedCheck) { + throw new VaultError("invalid_recovery_code", "Recovery code verification failed"); + } + + const out = new Uint8Array(RECOVERY_CODE_BYTES); + let bitBuffer = 0; + let bitsLeft = 0; + let outIdx = 0; + + for (let i = 0; i < DATA_CHAR_COUNT; i++) { + bitBuffer = (bitBuffer << 5) | (symbols[i] ?? 0); + bitsLeft += 5; + if (bitsLeft >= 8) { + bitsLeft -= 8; + if (outIdx < RECOVERY_CODE_BYTES) { + out[outIdx++] = (bitBuffer >>> bitsLeft) & 0xff; + } + } + } + + // Remaining 4 trailing bits must be zero for canonical encoding + const trailingMask = (1 << bitsLeft) - 1; + if ((bitBuffer & trailingMask) !== 0) { + throw new VaultError("invalid_recovery_code", "Non-canonical recovery code"); + } + + return out; +} + +export function deriveRecoveryKey(codeBytes: Uint8Array): Uint8Array { + if (codeBytes.length !== RECOVERY_CODE_BYTES) { + throw new RangeError(`Recovery code must be ${RECOVERY_CODE_BYTES} bytes`); + } + const input = new Uint8Array(DOMAIN_RECOVERY_KEY.length + codeBytes.length); + input.set(DOMAIN_RECOVERY_KEY, 0); + input.set(codeBytes, DOMAIN_RECOVERY_KEY.length); + try { + return hash(input); + } finally { + memzero(input); + } +} diff --git a/src/vault/session.ts b/src/vault/session.ts new file mode 100644 index 0000000..e832c69 --- /dev/null +++ b/src/vault/session.ts @@ -0,0 +1,242 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; +import { + fromBase64Url, + generateSigningKeyPair, + memzero, + type PublicKey, + SIGNING_PUBLIC_KEY_BYTES, + SIGNING_SECRET_KEY_BYTES, + SIGNING_SEED_BYTES, + type SigningKeyPair, + signingKeyPairFromSeed, + toBase64Url, +} from "../crypto"; +import { + base64UrlSchema, + type CommandRegistry, + createSignedCommand, + type RevocationList, + type SessionCertificate, + type SignedCommand, + sessionCertificateSchema, + signRevocationList, + signSessionCertificate, +} from "../protocol"; +import { VaultError } from "./errors"; +import type { UnlockedVault } from "./vault"; + +const HOUR_MS = 60 * 60 * 1000; +const DAY_MS = 24 * HOUR_MS; + +export const SESSION_DURATION_MS = { + "24h": DAY_MS, + "7d": 7 * DAY_MS, + "30d": 30 * DAY_MS, + remember: 180 * DAY_MS, +} as const; + +export type SessionDuration = keyof typeof SESSION_DURATION_MS; + +export interface Session { + readonly keyPair: SigningKeyPair; + readonly certificate: SessionCertificate; +} + +export interface IssueSessionOptions { + readonly duration: SessionDuration; + readonly now?: number; + readonly id?: string; +} + +export interface VaultCommandParams { + readonly type: string; + readonly body: unknown; + readonly agentPublicKey: PublicKey; + readonly counter: number; + readonly now: number; + readonly registry: CommandRegistry; + readonly ttlMs?: number; + readonly id?: string; +} + +export interface SignRevocationParams { + readonly revoked: readonly string[]; + readonly now: number; +} + +const serializedSessionSchema = z.object({ + v: z.literal(1), + public_key: base64UrlSchema, + secret_key: base64UrlSchema, + certificate: sessionCertificateSchema, +}); + +function bytesEqual(a: Uint8Array, b: Uint8Array): boolean { + if (a.length !== b.length) return false; + let diff = 0; + for (let i = 0; i < a.length; i++) { + diff |= (a[i] ?? 0) ^ (b[i] ?? 0); + } + return diff === 0; +} + +export function issueSession(unlocked: UnlockedVault, options: IssueSessionOptions): Session { + const accountKeyPair = unlocked.keyPair; + const now = options.now ?? Date.now(); + if (!Number.isSafeInteger(now) || now < 0) { + throw new RangeError("Timestamp must be a non-negative safe integer"); + } + + const durationMs = SESSION_DURATION_MS[options.duration]; + const keyPair = generateSigningKeyPair(); + try { + const certificate = signSessionCertificate({ + sessionPublicKey: keyPair.publicKey, + accountKeyPair, + notBefore: now, + notAfter: now + durationMs, + ...(options.id !== undefined ? { id: options.id } : {}), + }); + + return { keyPair, certificate }; + } catch (err) { + memzero(keyPair.secretKey); + throw err; + } +} + +export function serializeSession(session: Session): string { + return JSON.stringify({ + v: 1, + public_key: toBase64Url(session.keyPair.publicKey), + secret_key: toBase64Url(session.keyPair.secretKey), + certificate: session.certificate, + }); +} + +export function parseSession(text: string): Session { + let raw: unknown; + try { + raw = JSON.parse(text); + } catch { + throw new VaultError("invalid_session", "Malformed session JSON"); + } + + const parsed = serializedSessionSchema.safeParse(raw); + if (!parsed.success) { + throw new VaultError("invalid_session", "Malformed serialized session"); + } + + const { public_key, secret_key, certificate } = parsed.data; + if (certificate.not_after <= certificate.not_before) { + throw new VaultError("invalid_session", "Session certificate has invalid validity window"); + } + + let publicKey: Uint8Array; + let secretKey: Uint8Array; + let certPublicKey: Uint8Array; + try { + publicKey = fromBase64Url(public_key); + secretKey = fromBase64Url(secret_key); + certPublicKey = fromBase64Url(certificate.session_key); + } catch { + throw new VaultError("invalid_session", "Invalid base64url encoding in serialized session"); + } + + if ( + publicKey.length !== SIGNING_PUBLIC_KEY_BYTES || + secretKey.length !== SIGNING_SECRET_KEY_BYTES || + certPublicKey.length !== SIGNING_PUBLIC_KEY_BYTES + ) { + memzero(secretKey); + throw new VaultError("invalid_session", "Invalid session key length"); + } + + const seed = secretKey.slice(0, SIGNING_SEED_BYTES); + let derived: SigningKeyPair; + try { + derived = signingKeyPairFromSeed(seed); + } finally { + memzero(seed); + } + + const valid = + bytesEqual(derived.publicKey, publicKey) && + bytesEqual(derived.secretKey, secretKey) && + bytesEqual(publicKey, certPublicKey); + + memzero(secretKey); + + if (!valid) { + memzero(derived.secretKey); + throw new VaultError("invalid_session", "Session keys do not match certificate"); + } + + return { + keyPair: derived, + certificate, + }; +} + +export function sessionExpiresAt(session: Session): number { + return session.certificate.not_after; +} + +export function isSessionExpired(session: Session, now: number = Date.now()): boolean { + return now >= session.certificate.not_after; +} + +export function createCommandFromSession( + session: Session, + params: VaultCommandParams, +): SignedCommand { + return createSignedCommand( + { + type: params.type, + body: params.body, + agentPublicKey: params.agentPublicKey, + signer: session.keyPair, + session: session.certificate, + counter: params.counter, + now: params.now, + ...(params.ttlMs !== undefined ? { ttlMs: params.ttlMs } : {}), + ...(params.id !== undefined ? { id: params.id } : {}), + }, + params.registry, + ); +} + +export function createSensitiveCommand( + unlocked: UnlockedVault, + params: VaultCommandParams, +): SignedCommand { + const accountKeyPair = unlocked.keyPair; + return createSignedCommand( + { + type: params.type, + body: params.body, + agentPublicKey: params.agentPublicKey, + signer: accountKeyPair, + counter: params.counter, + now: params.now, + ...(params.ttlMs !== undefined ? { ttlMs: params.ttlMs } : {}), + ...(params.id !== undefined ? { id: params.id } : {}), + }, + params.registry, + ); +} + +export function signRevocation( + unlocked: UnlockedVault, + params: SignRevocationParams, +): RevocationList { + const accountKeyPair = unlocked.keyPair; + return signRevocationList({ + accountKeyPair, + issuedAt: params.now, + revoked: params.revoked, + }); +} diff --git a/src/vault/vault.test.ts b/src/vault/vault.test.ts new file mode 100644 index 0000000..5ab8585 --- /dev/null +++ b/src/vault/vault.test.ts @@ -0,0 +1,591 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { beforeAll, describe, expect, test } from "bun:test"; +import { + fingerprint, + generateSigningKeyPair, + KDF_FLOOR, + KDF_MODERATE, + ready, + toBase64Url, +} from "../crypto"; +import { + createCoreRegistry, + createInMemoryTrustContext, + openCommand, + ProtocolError, + verifyRevocationList, + verifySessionCertificate, +} from "../protocol"; +import { + changePassword, + createCommandFromSession, + createMemoryCounterStore, + createSensitiveCommand, + createVault, + isSessionExpired, + issueSession, + parseRecoveryCode, + parseSession, + resetPasswordWithRecovery, + rotateRecoveryCode, + SESSION_DURATION_MS, + serializeSession, + sessionExpiresAt, + signRevocation, + unlockVault, + unlockVaultWithRecovery, + type VaultBlob, + VaultError, + validatePassword, + withUnlockedVault, +} from "./index"; + +const STRONG_PW_1 = "correct-horse-battery-staple-91!"; +const STRONG_PW_2 = "cobalt-lantern-quartz-monolith-73#"; +const STRONG_PW_3 = "velvet-compass-harbor-nebula-48$"; +const BASE_TIME = 1_750_000_000_000; + +function expectVaultError(fn: () => unknown, code: VaultError["code"]): VaultError { + try { + fn(); + } catch (err) { + expect(err).toBeInstanceOf(VaultError); + const ve = err as VaultError; + expect(ve.code).toBe(code); + return ve; + } + throw new Error(`Expected VaultError(${code}), but function did not throw`); +} + +async function expectProtocolError( + promise: Promise, + code: ProtocolError["code"], +): Promise { + try { + await promise; + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe(code); + return; + } + throw new Error(`Expected ProtocolError(${code}), but promise resolved`); +} + +beforeAll(async () => { + await ready(); +}); + +describe("password policy", () => { + test("rejects short, empty, whitespace-only, and weak passwords", () => { + expect(validatePassword("")).toEqual({ ok: false, reason: "too_short" }); + expect(validatePassword("short!9X")).toEqual({ ok: false, reason: "too_short" }); + // 11 emoji = 22 UTF-16 code units, but only 11 Unicode code points + expect(validatePassword("🔑🔑🔑🔑🔑🔑🔑🔑🔑🔑🔑")).toEqual({ ok: false, reason: "too_short" }); + expect(validatePassword(" ")).toEqual({ ok: false, reason: "too_weak" }); + expect(validatePassword("\t\n \t\n ")).toEqual({ ok: false, reason: "too_weak" }); + expect(validatePassword("passwordpassword")).toEqual({ ok: false, reason: "too_weak" }); + expect(validatePassword("123456789012")).toEqual({ ok: false, reason: "too_weak" }); + }); + + test("accepts strong random passphrase and rejects passwords derived from userInputs", () => { + expect(validatePassword(STRONG_PW_1)).toEqual({ ok: true }); + + const email = "mariana.silva@example.com"; + const derived = "mariana.silva2026"; + expect(validatePassword(derived, { userInputs: [email, "mariana", "silva"] })).toEqual({ + ok: false, + reason: "too_weak", + }); + }); + + test("vault mutations reject weak passwords with weak_password", () => { + expectVaultError( + () => createVault({ password: "passwordpassword", now: BASE_TIME, kdf: KDF_FLOOR }), + "weak_password", + ); + + const { blob, recoveryCode, unlocked } = createVault({ + password: STRONG_PW_1, + now: BASE_TIME, + kdf: KDF_FLOOR, + }); + unlocked.lock(); + + expectVaultError( + () => changePassword(blob, STRONG_PW_1, "123456789012", { now: BASE_TIME, kdf: KDF_FLOOR }), + "weak_password", + ); + expectVaultError( + () => + resetPasswordWithRecovery(blob, recoveryCode, "short", { + now: BASE_TIME, + kdf: KDF_FLOOR, + }), + "weak_password", + ); + }); +}); + +describe("vault lifecycle and protocol integration", () => { + test("full cycle: createVault -> JSON round-trip -> unlock -> session -> openCommand", async () => { + const registry = createCoreRegistry(); + const agentKeyPair = generateSigningKeyPair(); + + const created = createVault({ password: STRONG_PW_1, now: BASE_TIME, kdf: KDF_FLOOR }); + const serialized = JSON.stringify(created.blob); + created.unlocked.lock(); + + const parsedBlob: unknown = JSON.parse(serialized); + const unlocked = unlockVault(parsedBlob, STRONG_PW_1); + expect(unlocked.account).toBe(created.blob.account); + expect(toBase64Url(unlocked.publicKey)).toBe(created.blob.public_key); + + const session = issueSession(unlocked, { duration: "24h", now: BASE_TIME }); + const counters = createMemoryCounterStore(); + const counter = await counters.next(fingerprint(session.keyPair.publicKey), BASE_TIME); + + const command = createCommandFromSession(session, { + type: "server.start", + body: { server_id: "srv-1" }, + agentPublicKey: agentKeyPair.publicKey, + counter, + now: BASE_TIME + 1000, + registry, + }); + + const trust = createInMemoryTrustContext({ + agentKeyPair, + trustedAccountKeys: [unlocked.publicKey], + now: () => BASE_TIME + 2000, + }); + + const opened = await openCommand(command, trust, registry); + expect(opened.signerType).toBe("session"); + expect(opened.accountId).toBe(unlocked.account); + expect(opened.sessionId).toBe(session.certificate.id); + expect(opened.body).toEqual({ server_id: "srv-1" }); + + unlocked.lock(); + }); + + test("sensitive command succeeds with account key and is rejected with session key", async () => { + const registry = createCoreRegistry(); + const agentKeyPair = generateSigningKeyPair(); + const { unlocked } = createVault({ password: STRONG_PW_1, now: BASE_TIME, kdf: KDF_FLOOR }); + + const trust = createInMemoryTrustContext({ + agentKeyPair, + trustedAccountKeys: [unlocked.publicKey], + now: () => BASE_TIME + 1000, + }); + + const session = issueSession(unlocked, { duration: "24h", now: BASE_TIME }); + const sessionCmd = createCommandFromSession(session, { + type: "server.delete", + body: { server_id: "srv-9" }, + agentPublicKey: agentKeyPair.publicKey, + counter: 1, + now: BASE_TIME + 500, + registry, + }); + + await expectProtocolError( + openCommand(sessionCmd, trust, registry), + "sensitive_requires_account_key", + ); + + const accountCmd = createSensitiveCommand(unlocked, { + type: "server.delete", + body: { server_id: "srv-9" }, + agentPublicKey: agentKeyPair.publicKey, + counter: 1, + now: BASE_TIME + 500, + registry, + }); + + const opened = await openCommand(accountCmd, trust, registry); + expect(opened.signerType).toBe("account"); + expect(opened.accountId).toBe(unlocked.account); + expect(opened.body).toEqual({ server_id: "srv-9" }); + + unlocked.lock(); + }); + + test("wrong password and tampered blobs fail with unlock_failed or invalid_blob", () => { + const { blob, recoveryCode, unlocked } = createVault({ + password: STRONG_PW_1, + now: BASE_TIME, + kdf: KDF_FLOOR, + }); + unlocked.lock(); + + // Wrong password + const wrongErr = expectVaultError(() => unlockVault(blob, STRONG_PW_2), "unlock_failed"); + expect(wrongErr.message).not.toContain(STRONG_PW_2); + expect(wrongErr.message).not.toContain(blob.password.wrapped_secret); + + // Tampered account + const otherAccount = fingerprint(generateSigningKeyPair().publicKey); + const tamperedAccount: VaultBlob = { ...blob, account: otherAccount }; + expectVaultError(() => unlockVault(tamperedAccount, STRONG_PW_1), "unlock_failed"); + + // Tampered public_key + const otherPub = toBase64Url(generateSigningKeyPair().publicKey); + const tamperedPub: VaultBlob = { ...blob, public_key: otherPub }; + expectVaultError(() => unlockVault(tamperedPub, STRONG_PW_1), "unlock_failed"); + + // Tampered KDF opslimit (still >= floor so it passes floor check and fails AAD/key derivation) + const tamperedKdf: VaultBlob = { + ...blob, + password: { + ...blob.password, + kdf: { ...blob.password.kdf, opslimit: blob.password.kdf.opslimit + 1 }, + }, + }; + expectVaultError(() => unlockVault(tamperedKdf, STRONG_PW_1), "unlock_failed"); + + // Swap password copy with recovery copy + const swappedToPassword: VaultBlob = { + ...blob, + password: { + ...blob.password, + wrapped_secret: blob.recovery.wrapped_secret, + }, + }; + expectVaultError(() => unlockVault(swappedToPassword, STRONG_PW_1), "unlock_failed"); + + // Swap recovery copy with password copy + const swappedToRecovery: VaultBlob = { + ...blob, + recovery: { + wrapped_secret: blob.password.wrapped_secret, + }, + }; + expectVaultError( + () => unlockVaultWithRecovery(swappedToRecovery, recoveryCode), + "unlock_failed", + ); + }); + + test("KDF below floor in blob is rejected immediately with invalid_blob", () => { + const { blob, unlocked } = createVault({ + password: STRONG_PW_1, + now: BASE_TIME, + kdf: KDF_FLOOR, + }); + unlocked.lock(); + + const lowMem: VaultBlob = { + ...blob, + password: { + ...blob.password, + kdf: { ...blob.password.kdf, memlimit: 1024 * 1024 }, + }, + }; + + const start = performance.now(); + expectVaultError(() => unlockVault(lowMem, STRONG_PW_1), "invalid_blob"); + const elapsed = performance.now() - start; + expect(elapsed).toBeLessThan(100); + + const lowOps: VaultBlob = { + ...blob, + password: { + ...blob.password, + kdf: { ...blob.password.kdf, opslimit: 1 }, + }, + }; + expectVaultError(() => unlockVault(lowOps, STRONG_PW_1), "invalid_blob"); + }); + + test("default createVault uses KDF_MODERATE and records its parameters in the blob", () => { + const { blob, unlocked } = createVault({ password: STRONG_PW_1, now: BASE_TIME }); + expect(blob.password.kdf.alg).toBe(KDF_MODERATE.alg); + expect(blob.password.kdf.opslimit).toBe(KDF_MODERATE.opslimit); + expect(blob.password.kdf.memlimit).toBe(KDF_MODERATE.memlimit); + unlocked.lock(); + + const reopened = unlockVault(blob, STRONG_PW_1); + expect(reopened.account).toBe(blob.account); + reopened.lock(); + }); +}); + +describe("recovery codes and password changes", () => { + test("recovery code unlocks vault, detects typos, and rejects another vault's code", () => { + const v1 = createVault({ password: STRONG_PW_1, now: BASE_TIME, kdf: KDF_FLOOR }); + const v2 = createVault({ password: STRONG_PW_2, now: BASE_TIME, kdf: KDF_FLOOR }); + v1.unlocked.lock(); + v2.unlocked.lock(); + + // Format check: 13 groups of 4 + 1 check char + expect(v1.recoveryCode).toMatch(/^([0-9A-HJKMNP-TV-Z]{4}-){13}[0-9A-HJKMNP-TV-Z]$/); + + // Works with lowercase and spaces + const messy = v1.recoveryCode.toLowerCase().replaceAll("-", " "); + const u1 = unlockVaultWithRecovery(v1.blob, messy); + expect(u1.account).toBe(v1.blob.account); + u1.lock(); + + // Single character substitution caught by check digit + const firstChar = v1.recoveryCode[0] ?? "0"; + const replacement = firstChar === "A" ? "B" : "A"; + const typo = `${replacement}${v1.recoveryCode.slice(1)}`; + const typoErr = expectVaultError( + () => unlockVaultWithRecovery(v1.blob, typo), + "invalid_recovery_code", + ); + expect(typoErr.message).not.toContain(typo); + + // Adjacent transposition caught by check digit + const raw = v1.recoveryCode.replaceAll("-", ""); + let swapped = raw; + for (let i = 0; i < raw.length - 2; i++) { + if (raw[i] !== raw[i + 1]) { + swapped = raw.slice(0, i) + (raw[i + 1] ?? "") + (raw[i] ?? "") + raw.slice(i + 2); + break; + } + } + expectVaultError(() => parseRecoveryCode(swapped), "invalid_recovery_code"); + + // Recovery code from another vault fails decryption with unlock_failed + expectVaultError(() => unlockVaultWithRecovery(v1.blob, v2.recoveryCode), "unlock_failed"); + }); + + test("rotateRecoveryCode invalidates old code and preserves password access", () => { + const { + blob, + recoveryCode: oldCode, + unlocked, + } = createVault({ + password: STRONG_PW_1, + now: BASE_TIME, + kdf: KDF_FLOOR, + }); + unlocked.lock(); + + const rotated = rotateRecoveryCode(blob, STRONG_PW_1); + expect(rotated.recoveryCode).not.toBe(oldCode); + expect(rotated.blob.account).toBe(blob.account); + + expectVaultError(() => unlockVaultWithRecovery(rotated.blob, oldCode), "unlock_failed"); + + const byNewCode = unlockVaultWithRecovery(rotated.blob, rotated.recoveryCode); + expect(byNewCode.account).toBe(blob.account); + byNewCode.lock(); + + const byPassword = unlockVault(rotated.blob, STRONG_PW_1); + expect(byPassword.account).toBe(blob.account); + byPassword.lock(); + }); + + test("resetPasswordWithRecovery sets a new password and invalidates the old one", () => { + const { blob, recoveryCode, unlocked } = createVault({ + password: STRONG_PW_1, + now: BASE_TIME, + kdf: KDF_FLOOR, + }); + unlocked.lock(); + + const resetBlob = resetPasswordWithRecovery(blob, recoveryCode, STRONG_PW_3, { + now: BASE_TIME + 5000, + kdf: KDF_FLOOR, + }); + expect(resetBlob.account).toBe(blob.account); + expect(resetBlob.password.kdf.salt).not.toBe(blob.password.kdf.salt); + + expectVaultError(() => unlockVault(resetBlob, STRONG_PW_1), "unlock_failed"); + + const u = unlockVault(resetBlob, STRONG_PW_3); + expect(u.account).toBe(blob.account); + u.lock(); + }); + + test("changePassword rotates salt, invalidates old password, preserves account and recovery", () => { + const { blob, recoveryCode, unlocked } = createVault({ + password: STRONG_PW_1, + now: BASE_TIME, + kdf: KDF_FLOOR, + }); + unlocked.lock(); + + const nextBlob = changePassword(blob, STRONG_PW_1, STRONG_PW_2, { + now: BASE_TIME + 10_000, + kdf: KDF_FLOOR, + }); + + expect(nextBlob.account).toBe(blob.account); + expect(nextBlob.public_key).toBe(blob.public_key); + expect(nextBlob.password.kdf.salt).not.toBe(blob.password.kdf.salt); + expect(nextBlob.recovery.wrapped_secret).toBe(blob.recovery.wrapped_secret); + + expectVaultError(() => unlockVault(nextBlob, STRONG_PW_1), "unlock_failed"); + + const byNewPw = unlockVault(nextBlob, STRONG_PW_2); + expect(byNewPw.account).toBe(blob.account); + byNewPw.lock(); + + const byRecovery = unlockVaultWithRecovery(nextBlob, recoveryCode); + expect(byRecovery.account).toBe(blob.account); + byRecovery.lock(); + }); +}); + +describe("sessions, revocation, counter, and locking", () => { + test("session durations, certificate verification, serialization, expiry, and revocation", async () => { + const registry = createCoreRegistry(); + const agentKeyPair = generateSigningKeyPair(); + const { unlocked } = createVault({ password: STRONG_PW_1, now: BASE_TIME, kdf: KDF_FLOOR }); + + // Check all four durations + for (const duration of ["24h", "7d", "30d", "remember"] as const) { + const s = issueSession(unlocked, { duration, now: BASE_TIME }); + expect(s.certificate.not_before).toBe(BASE_TIME); + expect(sessionExpiresAt(s)).toBe(BASE_TIME + SESSION_DURATION_MS[duration]); + const verified = verifySessionCertificate(s.certificate, unlocked.publicKey, BASE_TIME); + expect(verified.sessionPublicKey).toEqual(s.keyPair.publicKey); + } + + const session = issueSession(unlocked, { duration: "24h", now: BASE_TIME }); + + // Serialize / parse round-trip + const text = serializeSession(session); + const restored = parseSession(text); + expect(restored.certificate).toEqual(session.certificate); + expect(restored.keyPair.publicKey).toEqual(session.keyPair.publicKey); + expect(restored.keyPair.secretKey).toEqual(session.keyPair.secretKey); + + // Reject tampered serialized sessions + expectVaultError(() => parseSession("not json"), "invalid_session"); + const parsedObj = JSON.parse(text) as Record; + const otherKp = generateSigningKeyPair(); + expectVaultError( + () => + parseSession(JSON.stringify({ ...parsedObj, public_key: toBase64Url(otherKp.publicKey) })), + "invalid_session", + ); + expectVaultError( + () => + parseSession(JSON.stringify({ ...parsedObj, secret_key: toBase64Url(otherKp.secretKey) })), + "invalid_session", + ); + + // Expiry checks + expect(isSessionExpired(session, BASE_TIME)).toBe(false); + expect(isSessionExpired(session, sessionExpiresAt(session) - 1)).toBe(false); + expect(isSessionExpired(session, sessionExpiresAt(session))).toBe(true); + + const expiredAt = sessionExpiresAt(session) + 1000; + const expiredCmd = createCommandFromSession(session, { + type: "agent.ping", + body: {}, + agentPublicKey: agentKeyPair.publicKey, + counter: 1, + now: expiredAt, + registry, + }); + const trustExpired = createInMemoryTrustContext({ + agentKeyPair, + trustedAccountKeys: [unlocked.publicKey], + now: () => expiredAt + 500, + }); + await expectProtocolError(openCommand(expiredCmd, trustExpired, registry), "session_invalid"); + + // Revocation list + const revList = signRevocation(unlocked, { + revoked: [session.certificate.id], + now: BASE_TIME + 5000, + }); + const verifiedRev = verifyRevocationList(revList, unlocked.publicKey); + expect(verifiedRev.revoked).toEqual([session.certificate.id]); + + const trustRevoked = createInMemoryTrustContext({ + agentKeyPair, + trustedAccountKeys: [unlocked.publicKey], + revokedSessionIds: verifiedRev.revoked, + now: () => BASE_TIME + 6000, + }); + const validCmd = createCommandFromSession(session, { + type: "agent.ping", + body: {}, + agentPublicKey: agentKeyPair.publicKey, + counter: 1, + now: BASE_TIME + 5500, + registry, + }); + await expectProtocolError(openCommand(validCmd, trustRevoked, registry), "session_revoked"); + + unlocked.lock(); + }); + + test("memory counter store is strictly increasing per signer even when clock repeats or rewinds", async () => { + const store = createMemoryCounterStore(); + const signerA = fingerprint(generateSigningKeyPair().publicKey); + const signerB = fingerprint(generateSigningKeyPair().publicKey); + + expect(await store.next(signerA, 1000)).toBe(1000); + expect(await store.next(signerA, 1000)).toBe(1001); + expect(await store.next(signerA, 500)).toBe(1002); + expect(await store.next(signerA, 2000)).toBe(2000); + + // Independent per signer + expect(await store.next(signerB, 500)).toBe(500); + expect(await store.next(signerB, 500)).toBe(501); + }); + + test("lock zeroes secret key and blocks all further use; withUnlockedVault always locks", async () => { + const { blob, unlocked } = createVault({ + password: STRONG_PW_1, + now: BASE_TIME, + kdf: KDF_FLOOR, + }); + + const secretRef = unlocked.keyPair.secretKey; + expect(secretRef.some((b) => b !== 0)).toBe(true); + + unlocked.lock(); + // Idempotent second lock + unlocked.lock(); + + // Secret key buffer is zeroed + expect(secretRef.every((b) => b === 0)).toBe(true); + + // Every access throws locked + expectVaultError(() => unlocked.account, "locked"); + expectVaultError(() => unlocked.publicKey, "locked"); + expectVaultError(() => unlocked.keyPair, "locked"); + expectVaultError(() => issueSession(unlocked, { duration: "24h", now: BASE_TIME }), "locked"); + expectVaultError(() => signRevocation(unlocked, { revoked: [], now: BASE_TIME }), "locked"); + + // withUnlockedVault locks on normal return + const captured: { handle: typeof unlocked | null; secret: Uint8Array | null } = { + handle: null, + secret: null, + }; + const accountId = await withUnlockedVault(blob, STRONG_PW_1, (u) => { + captured.handle = u; + captured.secret = u.keyPair.secretKey; + return u.account; + }); + expect(accountId).toBe(blob.account); + expect(captured.secret?.every((b) => b === 0)).toBe(true); + expectVaultError(() => captured.handle?.account, "locked"); + + // withUnlockedVault locks even when fn throws + const errCaptured: { handle: typeof unlocked | null; secret: Uint8Array | null } = { + handle: null, + secret: null, + }; + await expect( + withUnlockedVault(blob, STRONG_PW_1, (u) => { + errCaptured.handle = u; + errCaptured.secret = u.keyPair.secretKey; + throw new Error("boom"); + }), + ).rejects.toThrow("boom"); + expect(errCaptured.secret?.every((b) => b === 0)).toBe(true); + expectVaultError(() => errCaptured.handle?.keyPair, "locked"); + }); +}); diff --git a/src/vault/vault.ts b/src/vault/vault.ts new file mode 100644 index 0000000..447cc2e --- /dev/null +++ b/src/vault/vault.ts @@ -0,0 +1,445 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { + aeadDecrypt, + aeadEncrypt, + assertKdfParams, + deriveKeyFromPassword, + fingerprint, + generateSalt, + generateSigningKeyPair, + KDF_MODERATE, + type KdfPreset, + memzero, + type PublicKey, + SIGNING_SECRET_KEY_BYTES, + SIGNING_SEED_BYTES, + type SigningKeyPair, + signingKeyPairFromSeed, + toBase64Url, +} from "../crypto"; +import type { KeyId } from "../protocol"; +import { + buildPasswordAad, + buildRecoveryAad, + parseVaultBlob, + VAULT_VERSION, + type VaultBlob, + type VaultKdf, +} from "./blob"; +import { VaultError } from "./errors"; +import { validatePassword } from "./password"; +import { + deriveRecoveryKey, + formatRecoveryCode, + generateRecoveryCodeBytes, + parseRecoveryCode, +} from "./recovery-code"; + +export interface UnlockedVault { + readonly account: KeyId; + readonly publicKey: PublicKey; + readonly keyPair: SigningKeyPair; + lock(): void; +} + +export interface CreateVaultParams { + readonly password: string; + readonly now?: number; + readonly kdf?: KdfPreset; + readonly userInputs?: readonly string[]; +} + +export interface CreateVaultResult { + readonly blob: VaultBlob; + readonly recoveryCode: string; + readonly unlocked: UnlockedVault; +} + +export interface ChangePasswordOptions { + readonly now?: number; + readonly kdf?: KdfPreset; + readonly userInputs?: readonly string[]; +} + +export interface RotateRecoveryCodeResult { + readonly blob: VaultBlob; + readonly recoveryCode: string; +} + +class UnlockedVaultHandle implements UnlockedVault { + readonly #account: KeyId; + readonly #keyPair: SigningKeyPair; + #locked = false; + + constructor(account: KeyId, keyPair: SigningKeyPair) { + this.#account = account; + this.#keyPair = keyPair; + } + + #assertOpen(): void { + if (this.#locked) { + throw new VaultError("locked", "Vault is locked"); + } + } + + get account(): KeyId { + this.#assertOpen(); + return this.#account; + } + + get publicKey(): PublicKey { + this.#assertOpen(); + return this.#keyPair.publicKey; + } + + get keyPair(): SigningKeyPair { + this.#assertOpen(); + return this.#keyPair; + } + + lock(): void { + if (this.#locked) return; + memzero(this.#keyPair.secretKey); + this.#locked = true; + } +} + +function bytesEqual(a: Uint8Array, b: Uint8Array): boolean { + if (a.length !== b.length) return false; + let diff = 0; + for (let i = 0; i < a.length; i++) { + diff |= (a[i] ?? 0) ^ (b[i] ?? 0); + } + return diff === 0; +} + +function assertValidTimestamp(now: number): void { + if (!Number.isSafeInteger(now) || now < 0) { + throw new RangeError("Timestamp must be a non-negative safe integer"); + } +} + +function assertValidPassword(password: string, userInputs?: readonly string[]): void { + const result = validatePassword(password, userInputs !== undefined ? { userInputs } : undefined); + if (!result.ok) { + throw new VaultError("weak_password", "Password does not meet strength requirements"); + } +} + +function wrapWithPassword( + secretKey: Uint8Array, + password: string, + meta: { readonly v: typeof VAULT_VERSION; readonly account: KeyId; readonly public_key: string }, + preset: KdfPreset, +): { readonly kdf: VaultKdf; readonly wrapped_secret: string } { + const salt = generateSalt(); + const kdfParams = { + alg: preset.alg, + opslimit: preset.opslimit, + memlimit: preset.memlimit, + salt, + }; + assertKdfParams(kdfParams); + + const kdf: VaultKdf = { + alg: kdfParams.alg, + opslimit: kdfParams.opslimit, + memlimit: kdfParams.memlimit, + salt: toBase64Url(salt), + }; + + const aad = buildPasswordAad({ + v: meta.v, + account: meta.account, + public_key: meta.public_key, + kdf, + }); + + const derivedKey = deriveKeyFromPassword(password, kdfParams); + try { + const wrapped = aeadEncrypt(secretKey, derivedKey, aad); + return { + kdf, + wrapped_secret: toBase64Url(wrapped), + }; + } finally { + memzero(derivedKey); + } +} + +function wrapWithRecovery( + secretKey: Uint8Array, + meta: { readonly v: typeof VAULT_VERSION; readonly account: KeyId; readonly public_key: string }, +): { readonly wrapped_secret: string; readonly recoveryCode: string } { + const codeBytes = generateRecoveryCodeBytes(); + try { + const recoveryCode = formatRecoveryCode(codeBytes); + const recoveryKey = deriveRecoveryKey(codeBytes); + try { + const aad = buildRecoveryAad(meta); + const wrapped = aeadEncrypt(secretKey, recoveryKey, aad); + return { + wrapped_secret: toBase64Url(wrapped), + recoveryCode, + }; + } finally { + memzero(recoveryKey); + } + } finally { + memzero(codeBytes); + } +} + +function verifyDecryptedSecretKey( + rawSecretKey: Uint8Array, + expectedPublicKey: Uint8Array, + expectedAccount: KeyId, +): UnlockedVault { + if (rawSecretKey.length !== SIGNING_SECRET_KEY_BYTES) { + memzero(rawSecretKey); + throw new VaultError("invalid_blob", "Decrypted key has invalid length"); + } + + const seed = rawSecretKey.slice(0, SIGNING_SEED_BYTES); + let derived: SigningKeyPair; + try { + derived = signingKeyPairFromSeed(seed); + } finally { + memzero(seed); + } + + const valid = + bytesEqual(derived.publicKey, expectedPublicKey) && + bytesEqual(derived.secretKey, rawSecretKey) && + fingerprint(derived.publicKey) === expectedAccount; + + memzero(rawSecretKey); + + if (!valid) { + memzero(derived.secretKey); + throw new VaultError("invalid_blob", "Decrypted key does not match vault metadata"); + } + + return new UnlockedVaultHandle(expectedAccount, derived); +} + +export function createVault(params: CreateVaultParams): CreateVaultResult { + const now = params.now ?? Date.now(); + assertValidTimestamp(now); + assertValidPassword(params.password, params.userInputs); + + const keyPair = generateSigningKeyPair(); + const account = fingerprint(keyPair.publicKey); + const publicKeyB64 = toBase64Url(keyPair.publicKey); + const meta = { + v: VAULT_VERSION, + account, + public_key: publicKeyB64, + }; + + try { + const passwordSection = wrapWithPassword( + keyPair.secretKey, + params.password, + meta, + params.kdf ?? KDF_MODERATE, + ); + const { wrapped_secret: recoveryWrappedSecret, recoveryCode } = wrapWithRecovery( + keyPair.secretKey, + meta, + ); + + const blob: VaultBlob = { + v: VAULT_VERSION, + account, + public_key: publicKeyB64, + created_at: now, + password: passwordSection, + recovery: { + wrapped_secret: recoveryWrappedSecret, + }, + }; + + const unlocked = new UnlockedVaultHandle(account, keyPair); + return { blob, recoveryCode, unlocked }; + } catch (err) { + memzero(keyPair.secretKey); + throw err; + } +} + +export function unlockVault(blob: unknown, password: string): UnlockedVault { + const parsed = parseVaultBlob(blob); + const aad = buildPasswordAad({ + v: parsed.blob.v, + account: parsed.blob.account, + public_key: parsed.blob.public_key, + kdf: parsed.blob.password.kdf, + }); + + const derivedKey = deriveKeyFromPassword(password, parsed.kdfParams); + let rawSecretKey: Uint8Array; + try { + rawSecretKey = aeadDecrypt(parsed.passwordWrapped, derivedKey, aad); + } catch { + throw new VaultError("unlock_failed", "Failed to unlock vault"); + } finally { + memzero(derivedKey); + } + + return verifyDecryptedSecretKey(rawSecretKey, parsed.publicKeyBytes, parsed.blob.account); +} + +export function unlockVaultWithRecovery(blob: unknown, recoveryCode: string): UnlockedVault { + const parsed = parseVaultBlob(blob); + const codeBytes = parseRecoveryCode(recoveryCode); + + let recoveryKey: Uint8Array; + try { + recoveryKey = deriveRecoveryKey(codeBytes); + } finally { + memzero(codeBytes); + } + + const aad = buildRecoveryAad({ + v: parsed.blob.v, + account: parsed.blob.account, + public_key: parsed.blob.public_key, + }); + + let rawSecretKey: Uint8Array; + try { + rawSecretKey = aeadDecrypt(parsed.recoveryWrapped, recoveryKey, aad); + } catch { + throw new VaultError("unlock_failed", "Failed to unlock vault with recovery code"); + } finally { + memzero(recoveryKey); + } + + return verifyDecryptedSecretKey(rawSecretKey, parsed.publicKeyBytes, parsed.blob.account); +} + +export async function withUnlockedVault( + blob: unknown, + password: string, + fn: (unlocked: UnlockedVault) => T | Promise, +): Promise { + const unlocked = unlockVault(blob, password); + try { + return await fn(unlocked); + } finally { + unlocked.lock(); + } +} + +export function changePassword( + blob: unknown, + oldPassword: string, + newPassword: string, + options?: ChangePasswordOptions, +): VaultBlob { + if (options?.now !== undefined) { + assertValidTimestamp(options.now); + } + assertValidPassword(newPassword, options?.userInputs); + + const parsed = parseVaultBlob(blob); + const unlocked = unlockVault(parsed.blob, oldPassword); + try { + const passwordSection = wrapWithPassword( + unlocked.keyPair.secretKey, + newPassword, + { + v: parsed.blob.v, + account: parsed.blob.account, + public_key: parsed.blob.public_key, + }, + options?.kdf ?? KDF_MODERATE, + ); + + return { + v: parsed.blob.v, + account: parsed.blob.account, + public_key: parsed.blob.public_key, + created_at: parsed.blob.created_at, + password: passwordSection, + recovery: { + wrapped_secret: parsed.blob.recovery.wrapped_secret, + }, + }; + } finally { + unlocked.lock(); + } +} + +export function rotateRecoveryCode(blob: unknown, password: string): RotateRecoveryCodeResult { + const parsed = parseVaultBlob(blob); + const unlocked = unlockVault(parsed.blob, password); + try { + const { wrapped_secret, recoveryCode } = wrapWithRecovery(unlocked.keyPair.secretKey, { + v: parsed.blob.v, + account: parsed.blob.account, + public_key: parsed.blob.public_key, + }); + + const nextBlob: VaultBlob = { + v: parsed.blob.v, + account: parsed.blob.account, + public_key: parsed.blob.public_key, + created_at: parsed.blob.created_at, + password: { + kdf: { ...parsed.blob.password.kdf }, + wrapped_secret: parsed.blob.password.wrapped_secret, + }, + recovery: { + wrapped_secret, + }, + }; + + return { blob: nextBlob, recoveryCode }; + } finally { + unlocked.lock(); + } +} + +export function resetPasswordWithRecovery( + blob: unknown, + recoveryCode: string, + newPassword: string, + options?: ChangePasswordOptions, +): VaultBlob { + if (options?.now !== undefined) { + assertValidTimestamp(options.now); + } + assertValidPassword(newPassword, options?.userInputs); + + const parsed = parseVaultBlob(blob); + const unlocked = unlockVaultWithRecovery(parsed.blob, recoveryCode); + try { + const passwordSection = wrapWithPassword( + unlocked.keyPair.secretKey, + newPassword, + { + v: parsed.blob.v, + account: parsed.blob.account, + public_key: parsed.blob.public_key, + }, + options?.kdf ?? KDF_MODERATE, + ); + + return { + v: parsed.blob.v, + account: parsed.blob.account, + public_key: parsed.blob.public_key, + created_at: parsed.blob.created_at, + password: passwordSection, + recovery: { + wrapped_secret: parsed.blob.recovery.wrapped_secret, + }, + }; + } finally { + unlocked.lock(); + } +} From 071e7fe4f2698481d7ce1b167f302b9cd0627fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 22 Nov 2026 19:26:37 -0300 Subject: [PATCH 04/59] feat: add agent pairing, account trust persistence, and session revocation --- bun.lock | 3 + package.json | 1 + src/agent/index.ts | 29 ++ src/agent/jobs.ts | 28 ++ src/agent/pairing-api.ts | 251 ++++++++++++ src/agent/pairing.test.ts | 674 +++++++++++++++++++++++++++++++ src/agent/pairing.ts | 315 +++++++++++++++ src/agent/paths.ts | 2 + src/agent/state.test.ts | 151 +++++++ src/agent/state.ts | 271 ++++++++++++- src/cli/args.ts | 35 +- src/cli/cli.test.ts | 37 +- src/cli/e2e.test.ts | 224 +++++++++- src/cli/main.ts | 41 +- src/protocol/commands/core.ts | 3 +- src/protocol/commands/pairing.ts | 20 + src/protocol/domains.ts | 2 + src/protocol/errors.ts | 10 +- src/protocol/index.ts | 27 ++ src/protocol/pairing.test.ts | 417 +++++++++++++++++++ src/protocol/pairing.ts | 338 ++++++++++++++++ 21 files changed, 2853 insertions(+), 26 deletions(-) create mode 100644 src/agent/pairing-api.ts create mode 100644 src/agent/pairing.test.ts create mode 100644 src/agent/pairing.ts create mode 100644 src/protocol/commands/pairing.ts create mode 100644 src/protocol/pairing.test.ts create mode 100644 src/protocol/pairing.ts diff --git a/bun.lock b/bun.lock index e53b637..425db10 100644 --- a/bun.lock +++ b/bun.lock @@ -9,6 +9,7 @@ "@zxcvbn-ts/language-common": "^4.2.0", "@zxcvbn-ts/language-en": "^4.1.2", "libsodium-wrappers-sumo": "^0.8.4", + "uqr": "^0.1.3", "zod": "^4.6.7", }, "devDependencies": { @@ -108,6 +109,8 @@ "undici-types": ["undici-types@8.13.1", "", {}, "sha512-wEtfquPVc1e9umZh73XVwnPauVuGQp20M/u/4ENuWMRkZ8NZx0ut6q3HLLdMUb9awNlxxHcsaGVhaerZu/2SSw=="], + "uqr": ["uqr@0.1.3", "", {}, "sha512-0rjE8iEJe4YmT9TOhwsZtqCMRLc5DXZUI2UEYUUg63ikBkqqE5EYWaI0etFe/5KUcmcYwLih2RND1kq+hrUJXA=="], + "zod": ["zod@4.6.7", "", {}, "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg=="], "@types/node/undici-types": ["undici-types@8.9.0", "", {}, "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg=="], diff --git a/package.json b/package.json index 69ba42a..9f9a793 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "@zxcvbn-ts/language-common": "^4.2.0", "@zxcvbn-ts/language-en": "^4.1.2", "libsodium-wrappers-sumo": "^0.8.4", + "uqr": "^0.1.3", "zod": "^4.6.7" } } diff --git a/src/agent/index.ts b/src/agent/index.ts index 52591a0..0a455f3 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -50,6 +50,27 @@ export { redactValue, resolveLogLevel, } from "./logger"; +export { + DEFAULT_LINK_URL, + DEFAULT_PAIRING_TIMEOUT_MS, + DEFAULT_POLL_INTERVAL_MS, + formatFingerprintGroups, + MAX_CODE_CONFLICT_RETRIES, + type RunPairingFlowOptions, + resolveLinkUrl, + runPairingFlow, +} from "./pairing"; +export { + createPairingApiClient, + type FetchLike, + PAIRING_API_MAX_RESPONSE_BYTES, + PAIRING_API_TIMEOUT_MS, + type PairingApiClient, + type PairingApiClientOptions, + PairingApiError, + type PairingApiErrorCode, + type PollGrantResult, +} from "./pairing-api"; export { DEFAULT_LINUX_STATE_DIR, getStatePaths, @@ -59,7 +80,10 @@ export { export { type AgentConfig, type AtomicWriteOptions, + addTrustedAccount, + applyRevocationList, assertStrictPermissions, + clearTrust, createFileTrustContext, type FileTrustContext, type FileTrustContextOptions, @@ -68,9 +92,14 @@ export { loadConfig, loadIdentityIfExists, loadOrCreateIdentity, + loadRevocations, loadTrust, MAX_RECENT_REPLAY_IDS, + type RevocationAccountState, + type RevocationsState, + resetTrustState, StateError, validateApiUrl, + validateLinkUrl, writeFileAtomic, } from "./state"; diff --git a/src/agent/jobs.ts b/src/agent/jobs.ts index 333a36b..6576ac4 100644 --- a/src/agent/jobs.ts +++ b/src/agent/jobs.ts @@ -4,10 +4,12 @@ import { fingerprint } from "../crypto"; import { type CommandRegistry, + type KeyId, type OpenedCommand, openCommand, PROTOCOL_VERSION, ProtocolError, + type RevocationList, sealAgentMessage, type TransportFrame, type TrustContext, @@ -168,6 +170,15 @@ export function createCommandQueue(options: CommandQueueOptions): CommandQueue { try { await handler(opened, ctx); } catch (err) { + if (err instanceof ProtocolError) { + logger.warn("Command handler rejected command", { + commandId: opened.header.id, + type: opened.header.type, + code: err.code, + }); + sendFrame(makeAckError(opened.header.id, err.code)); + return; + } logger.error("Command handler threw an exception", { commandId: opened.header.id, type: opened.header.type, @@ -191,6 +202,23 @@ export function createCommandQueue(options: CommandQueueOptions): CommandQueue { ctx.sendEvent("agent.pong", { at: ctx.now() }); }); + const revocationAware = trust as TrustContext & { + readonly applyRevocationList?: ( + list: unknown, + ) => Promise<{ readonly account: KeyId; readonly count: number }>; + }; + if (typeof revocationAware.applyRevocationList === "function") { + const applyRevocations = revocationAware.applyRevocationList.bind(revocationAware); + registerHandler("agent.revocations.set", async (opened, ctx) => { + const body = opened.body as { readonly list: RevocationList }; + const result = await applyRevocations(body.list); + ctx.sendEvent("agent.revocations.applied", { + account: result.account, + count: result.count, + }); + }); + } + return { registerHandler, diff --git a/src/agent/pairing-api.ts b/src/agent/pairing-api.ts new file mode 100644 index 0000000..afc3b6c --- /dev/null +++ b/src/agent/pairing-api.ts @@ -0,0 +1,251 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; +import { validateApiUrl } from "./state"; + +export const PAIRING_API_TIMEOUT_MS = 10_000; +export const PAIRING_API_MAX_RESPONSE_BYTES = 64 * 1024; + +export type FetchLike = (input: string | URL, init?: RequestInit) => Promise; + +export type PairingApiErrorCode = + | "network_error" + | "http_error" + | "response_too_large" + | "invalid_response" + | "aborted"; + +export class PairingApiError extends Error { + readonly code: PairingApiErrorCode; + + constructor(code: PairingApiErrorCode, message: string) { + super(message); + this.name = "PairingApiError"; + this.code = code; + } +} + +export type PollGrantResult = + | { readonly status: "pending" } + | { readonly status: "expired" } + | { readonly status: "ready"; readonly grant: unknown }; + +export interface PairingApiClient { + registerPairing( + code: string, + agentPublicKeyB64: string, + signal?: AbortSignal, + ): Promise<"created" | "conflict">; + pollGrant(code: string, signal?: AbortSignal): Promise; + deletePairing(code: string): Promise; +} + +export interface PairingApiClientOptions { + readonly apiUrl: string; + readonly allowInsecure?: boolean; + readonly fetch?: FetchLike; + readonly timeoutMs?: number; + readonly maxResponseBytes?: number; +} + +const grantResponseSchema = z.object({ + grant: z.unknown(), +}); + +function buildEndpointUrl(baseApiUrl: string, pathSuffix: string): string { + const url = new URL(baseApiUrl); + const basePath = url.pathname.replace(/\/+$/, ""); + url.pathname = `${basePath}${pathSuffix}`; + url.search = ""; + url.hash = ""; + return url.toString(); +} + +async function readBoundedText(response: Response, maxBytes: number): Promise { + const contentLengthHeader = response.headers.get("content-length"); + if (contentLengthHeader !== null) { + const declared = Number(contentLengthHeader); + if (Number.isFinite(declared) && declared > maxBytes) { + throw new PairingApiError("response_too_large", "Pairing API response exceeds size limit"); + } + } + + if (response.body === null) { + const text = await response.text(); + if (new TextEncoder().encode(text).byteLength > maxBytes) { + throw new PairingApiError("response_too_large", "Pairing API response exceeds size limit"); + } + return text; + } + + const reader = response.body.getReader(); + const chunks: Uint8Array[] = []; + let total = 0; + + try { + while (true) { + const { done, value } = await reader.read(); + if (done) { + break; + } + if (value !== undefined) { + total += value.byteLength; + if (total > maxBytes) { + await reader.cancel(); + throw new PairingApiError( + "response_too_large", + "Pairing API response exceeds size limit", + ); + } + chunks.push(value); + } + } + } finally { + reader.releaseLock(); + } + + const combined = new Uint8Array(total); + let offset = 0; + for (const chunk of chunks) { + combined.set(chunk, offset); + offset += chunk.byteLength; + } + return new TextDecoder("utf-8", { fatal: true }).decode(combined); +} + +async function fetchWithTimeout( + fetchFn: FetchLike, + url: string, + init: RequestInit, + timeoutMs: number, + externalSignal?: AbortSignal, +): Promise { + if (externalSignal?.aborted) { + throw new PairingApiError("aborted", "Pairing request aborted"); + } + + const controller = new AbortController(); + let timedOut = false; + + const onExternalAbort = (): void => { + controller.abort(); + }; + externalSignal?.addEventListener("abort", onExternalAbort, { once: true }); + + const timer = setTimeout(() => { + timedOut = true; + controller.abort(); + }, timeoutMs); + + try { + return await fetchFn(url, { + ...init, + signal: controller.signal, + }); + } catch { + if (externalSignal?.aborted) { + throw new PairingApiError("aborted", "Pairing request aborted"); + } + if (timedOut) { + throw new PairingApiError("network_error", "Pairing API request timed out"); + } + throw new PairingApiError("network_error", "Pairing API network request failed"); + } finally { + clearTimeout(timer); + externalSignal?.removeEventListener("abort", onExternalAbort); + } +} + +export function createPairingApiClient(options: PairingApiClientOptions): PairingApiClient { + const validatedUrl = validateApiUrl(options.apiUrl, options.allowInsecure ?? false); + const fetchFn: FetchLike = options.fetch ?? ((input, init) => fetch(input, init)); + const timeoutMs = options.timeoutMs ?? PAIRING_API_TIMEOUT_MS; + const maxResponseBytes = options.maxResponseBytes ?? PAIRING_API_MAX_RESPONSE_BYTES; + + return { + async registerPairing( + code: string, + agentPublicKeyB64: string, + signal?: AbortSignal, + ): Promise<"created" | "conflict"> { + const url = buildEndpointUrl(validatedUrl, "/agents/pairing"); + const response = await fetchWithTimeout( + fetchFn, + url, + { + method: "POST", + headers: { "content-type": "application/json" }, + body: JSON.stringify({ + code, + agent_public_key: agentPublicKeyB64, + }), + }, + timeoutMs, + signal, + ); + + if (response.status === 201) { + return "created"; + } + if (response.status === 409) { + return "conflict"; + } + throw new PairingApiError( + "http_error", + `Pairing registration failed with HTTP ${response.status}`, + ); + }, + + async pollGrant(code: string, signal?: AbortSignal): Promise { + const url = buildEndpointUrl( + validatedUrl, + `/agents/pairing/${encodeURIComponent(code)}/grant`, + ); + const response = await fetchWithTimeout( + fetchFn, + url, + { + method: "GET", + headers: { accept: "application/json" }, + }, + timeoutMs, + signal, + ); + + if (response.status === 202) { + return { status: "pending" }; + } + if (response.status === 404 || response.status === 410) { + return { status: "expired" }; + } + if (response.status !== 200) { + throw new PairingApiError("http_error", `Pairing poll failed with HTTP ${response.status}`); + } + + const text = await readBoundedText(response, maxResponseBytes); + let raw: unknown; + try { + raw = JSON.parse(text) as unknown; + } catch { + throw new PairingApiError("invalid_response", "Pairing API returned invalid JSON"); + } + + const parsed = grantResponseSchema.safeParse(raw); + if (!parsed.success || parsed.data.grant === undefined) { + throw new PairingApiError("invalid_response", "Pairing API returned malformed grant body"); + } + + return { status: "ready", grant: parsed.data.grant }; + }, + + async deletePairing(code: string): Promise { + const url = buildEndpointUrl(validatedUrl, `/agents/pairing/${encodeURIComponent(code)}`); + try { + await fetchWithTimeout(fetchFn, url, { method: "DELETE" }, timeoutMs); + } catch { + // Best-effort cleanup + } + }, + }; +} diff --git a/src/agent/pairing.test.ts b/src/agent/pairing.test.ts new file mode 100644 index 0000000..b0685bd --- /dev/null +++ b/src/agent/pairing.test.ts @@ -0,0 +1,674 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeAll, describe, expect, test } from "bun:test"; +import { EventEmitter } from "node:events"; +import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { fingerprint, generateSigningKeyPair, ready } from "../crypto"; +import { + createCoreRegistry, + createSignedCommand, + generatePairingSecret, + openAgentMessage, + PROTOCOL_VERSION, + parsePairingFragment, + signRevocationList, + signSessionCertificate, + signTrustGrant, + type TransportFrame, +} from "../protocol"; +import { createCommandQueue, type TransportCommandFrame } from "./jobs"; +import { createLogger } from "./logger"; +import { formatFingerprintGroups, runPairingFlow } from "./pairing"; +import { createPairingApiClient, type FetchLike, PairingApiError } from "./pairing-api"; +import { getStatePaths } from "./paths"; +import { + addTrustedAccount, + applyRevocationList, + createFileTrustContext, + loadOrCreateIdentity, + loadRevocations, + loadTrust, + StateError, +} from "./state"; + +const BASE_TIME = 1_700_000_000_000; +const tempDirs: string[] = []; + +function makeTempDir(): string { + const dir = mkdtempSync(join(tmpdir(), "tegrad-pairing-test-")); + tempDirs.push(dir); + return dir; +} + +function writeConfig(dir: string, apiUrl = "https://api.tegra.example", linkUrl?: string): void { + const { configPath } = getStatePaths(dir); + writeFileSync( + configPath, + JSON.stringify({ api_url: apiUrl, ...(linkUrl !== undefined ? { link_url: linkUrl } : {}) }), + "utf8", + ); +} + +beforeAll(async () => { + await ready(); +}); + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +describe("pairing API client", () => { + test("rejects non-https URLs unless allowInsecure is enabled for localhost", () => { + expect(() => createPairingApiClient({ apiUrl: "http://api.tegra.example" })).toThrow( + StateError, + ); + expect(() => + createPairingApiClient({ apiUrl: "http://127.0.0.1:8080", allowInsecure: false }), + ).toThrow(StateError); + expect(() => + createPairingApiClient({ apiUrl: "http://127.0.0.1:8080", allowInsecure: true }), + ).not.toThrow(); + }); + + test("rejects oversized grant responses (> 64 KiB)", async () => { + const hugeBody = JSON.stringify({ grant: "x".repeat(70 * 1024) }); + const fakeFetch: FetchLike = async () => + new Response(hugeBody, { + status: 200, + headers: { "content-type": "application/json" }, + }); + + const api = createPairingApiClient({ + apiUrl: "https://api.tegra.example", + fetch: fakeFetch, + }); + + await expect(api.pollGrant("0123456789")).rejects.toThrow(PairingApiError); + await expect(api.pollGrant("0123456789")).rejects.toMatchObject({ + code: "response_too_large", + }); + }); +}); + +describe("tegrad link pairing flow", () => { + test("happy path with proof writes trusted account, prints URL/QR/fingerprint, deletes pairing, and exits 0", async () => { + const dir = makeTempDir(); + writeConfig(dir); + const agent = await loadOrCreateIdentity(dir); + const account = generateSigningKeyPair(); + const secret = generatePairingSecret(); + let now = BASE_TIME; + let pollCount = 0; + const deletedCodes: string[] = []; + + const fakeFetch: FetchLike = async (input, init) => { + const url = String(input); + const method = init?.method ?? "GET"; + if (method === "POST" && url.endsWith("/agents/pairing")) { + return new Response(null, { status: 201 }); + } + if (method === "GET" && url.includes("/grant")) { + pollCount++; + if (pollCount === 1) { + return new Response(null, { status: 202 }); + } + const grant = signTrustGrant({ + accountKeyPair: account, + agentPublicKey: agent.publicKey, + secret, + issuedAt: now, + }); + return new Response(JSON.stringify({ grant }), { + status: 200, + headers: { "content-type": "application/json" }, + }); + } + if (method === "DELETE") { + deletedCodes.push(url); + return new Response(null, { status: 204 }); + } + return new Response("Not found", { status: 404 }); + }; + + let stdout = ""; + let stderr = ""; + const logs: string[] = []; + const logger = createLogger({ + level: "debug", + stdout: (line) => logs.push(line), + stderr: (line) => logs.push(line), + }); + + const exitCode = await runPairingFlow({ + stateDir: dir, + fetch: fakeFetch, + logger, + now: () => now, + sleep: async (ms) => { + now += ms; + }, + stdout: (text) => { + stdout += text; + }, + stderr: (text) => { + stderr += text; + }, + generateSecret: () => secret, + }); + + expect(exitCode).toBe(0); + expect(stderr).toBe(""); + expect(stdout).toContain(formatFingerprintGroups(fingerprint(agent.publicKey))); + expect(stdout).toContain("https://tegramc.com/link#"); + expect(stdout).toContain(fingerprint(account.publicKey)); + expect(deletedCodes.length).toBe(1); + + const trusted = await loadTrust(dir); + expect(trusted.length).toBe(1); + expect(fingerprint(trusted[0] ?? new Uint8Array())).toBe(fingerprint(account.publicKey)); + + // Secret and grant signature must never appear in structured logs + const joinedLogs = logs.join("\n"); + expect(joinedLogs).not.toContain(secret); + expect(joinedLogs).not.toContain("agent-pairing"); + }); + + test("rejects malicious API grant for another account without secret (exits 1, writes nothing, leaks no secret/grant)", async () => { + const dir = makeTempDir(); + writeConfig(dir); + const agent = await loadOrCreateIdentity(dir); + const attacker = generateSigningKeyPair(); + const secret = generatePairingSecret(); + const attackerSecret = generatePairingSecret(); + const forgedGrant = signTrustGrant({ + accountKeyPair: attacker, + agentPublicKey: agent.publicKey, + secret: attackerSecret, + issuedAt: BASE_TIME, + }); + + const fakeFetch: FetchLike = async (_input, init) => { + if (init?.method === "POST") return new Response(null, { status: 201 }); + if (init?.method === "DELETE") return new Response(null, { status: 204 }); + return new Response(JSON.stringify({ grant: forgedGrant }), { status: 200 }); + }; + + let stderr = ""; + const logs: string[] = []; + const logger = createLogger({ + level: "debug", + stdout: (line) => logs.push(line), + stderr: (line) => logs.push(line), + }); + + const exitCode = await runPairingFlow({ + stateDir: dir, + fetch: fakeFetch, + logger, + now: () => BASE_TIME, + stdout: () => {}, + stderr: (text) => { + stderr += text; + }, + generateSecret: () => secret, + }); + + expect(exitCode).toBe(1); + expect(stderr).toContain("grant_bad_proof"); + expect(stderr).not.toContain(secret); + expect(stderr).not.toContain(forgedGrant.sig); + expect(logs.join("\n")).not.toContain(secret); + expect(logs.join("\n")).not.toContain(forgedGrant.sig); + expect(await loadTrust(dir)).toEqual([]); + }); + + test("grant without proof is rejected by default and accepted with --allow-unverified with warning", async () => { + const dir = makeTempDir(); + writeConfig(dir); + const agent = await loadOrCreateIdentity(dir); + const account = generateSigningKeyPair(); + const unverifiedGrant = signTrustGrant({ + accountKeyPair: account, + agentPublicKey: agent.publicKey, + issuedAt: BASE_TIME, + }); + + const fakeFetch: FetchLike = async (_input, init) => { + if (init?.method === "POST") return new Response(null, { status: 201 }); + if (init?.method === "DELETE") return new Response(null, { status: 204 }); + return new Response(JSON.stringify({ grant: unverifiedGrant }), { status: 200 }); + }; + + let stderrDefault = ""; + const codeDefault = await runPairingFlow({ + stateDir: dir, + fetch: fakeFetch, + now: () => BASE_TIME, + stdout: () => {}, + stderr: (t) => { + stderrDefault += t; + }, + }); + expect(codeDefault).toBe(1); + expect(stderrDefault).toContain("grant_proof_required"); + expect(await loadTrust(dir)).toEqual([]); + + let stderrUnverified = ""; + const codeUnverified = await runPairingFlow({ + stateDir: dir, + fetch: fakeFetch, + allowUnverified: true, + now: () => BASE_TIME, + stdout: () => {}, + stderr: (t) => { + stderrUnverified += t; + }, + }); + expect(codeUnverified).toBe(0); + expect(stderrUnverified).toContain("WARNING"); + expect(stderrUnverified).toContain("--allow-unverified"); + expect((await loadTrust(dir)).length).toBe(1); + }); + + test("retries up to 3 times on 409 code conflict", async () => { + const dir = makeTempDir(); + writeConfig(dir); + const agent = await loadOrCreateIdentity(dir); + const account = generateSigningKeyPair(); + const secret = generatePairingSecret(); + const codes = ["0000000001", "0000000002", "0000000003", "0000000004"]; + let codeIdx = 0; + let postAttempts = 0; + + const fakeFetch: FetchLike = async (_input, init) => { + if (init?.method === "POST") { + postAttempts++; + if (postAttempts <= 3) { + return new Response(null, { status: 409 }); + } + return new Response(null, { status: 201 }); + } + if (init?.method === "DELETE") return new Response(null, { status: 204 }); + const grant = signTrustGrant({ + accountKeyPair: account, + agentPublicKey: agent.publicKey, + secret, + issuedAt: BASE_TIME, + }); + return new Response(JSON.stringify({ grant }), { status: 200 }); + }; + + const exitCode = await runPairingFlow({ + stateDir: dir, + fetch: fakeFetch, + now: () => BASE_TIME, + stdout: () => {}, + stderr: () => {}, + generateCode: () => codes[codeIdx++] ?? "0000000009", + generateSecret: () => secret, + }); + + expect(exitCode).toBe(0); + expect(postAttempts).toBe(4); + }); + + test("exits 1 on 404/410 expiration or 10 min timeout", async () => { + const dir = makeTempDir(); + writeConfig(dir); + + const expiredFetch: FetchLike = async (_input, init) => { + if (init?.method === "POST") return new Response(null, { status: 201 }); + return new Response(null, { status: 410 }); + }; + + const expiredCode = await runPairingFlow({ + stateDir: dir, + fetch: expiredFetch, + now: () => BASE_TIME, + stdout: () => {}, + stderr: () => {}, + }); + expect(expiredCode).toBe(1); + + let now = BASE_TIME; + let deleted = false; + const pendingFetch: FetchLike = async (_input, init) => { + if (init?.method === "POST") return new Response(null, { status: 201 }); + if (init?.method === "DELETE") { + deleted = true; + return new Response(null, { status: 204 }); + } + return new Response(null, { status: 202 }); + }; + + const timeoutCode = await runPairingFlow({ + stateDir: dir, + fetch: pendingFetch, + now: () => now, + sleep: async (ms) => { + now += ms; + }, + stdout: () => {}, + stderr: () => {}, + }); + expect(timeoutCode).toBe(1); + expect(deleted).toBe(true); + expect(now - BASE_TIME).toBe(10 * 60 * 1000); + }); + + test("SIGINT cancels pairing and deletes the pairing request", async () => { + const dir = makeTempDir(); + writeConfig(dir); + const signalTarget = new EventEmitter(); + let deleted = false; + + const fakeFetch: FetchLike = async (_input, init) => { + if (init?.method === "POST") return new Response(null, { status: 201 }); + if (init?.method === "DELETE") { + deleted = true; + return new Response(null, { status: 204 }); + } + return new Response(null, { status: 202 }); + }; + + const exitCode = await runPairingFlow({ + stateDir: dir, + fetch: fakeFetch, + now: () => BASE_TIME, + signalTarget: signalTarget as unknown as Pick, + sleep: async () => { + signalTarget.emit("SIGINT"); + }, + stdout: () => {}, + stderr: () => {}, + }); + + expect(exitCode).toBe(1); + expect(deleted).toBe(true); + }); + + test("refuses when already linked without --add/--reset; --add appends; --reset confirms, clears trust/revocations/replay, keeps identity & server data", async () => { + const dir = makeTempDir(); + writeConfig(dir); + const agent = await loadOrCreateIdentity(dir); + const account1 = generateSigningKeyPair(); + const account2 = generateSigningKeyPair(); + const account3 = generateSigningKeyPair(); + const secret = generatePairingSecret(); + + await addTrustedAccount(dir, account1.publicKey); + await applyRevocationList( + dir, + signRevocationList({ + accountKeyPair: account1, + issuedAt: BASE_TIME, + revoked: ["sess_old"], + }), + ); + const { replayPath } = getStatePaths(dir); + writeFileSync(replayPath, JSON.stringify({ v: 1, last_counter: {}, recent_ids: [] }), "utf8"); + const serversDir = join(dir, "servers"); + mkdirSync(serversDir, { recursive: true }); + writeFileSync(join(serversDir, "world.txt"), "keep-me", "utf8"); + + // Refused without --add / --reset + let refusedErr = ""; + const refusedCode = await runPairingFlow({ + stateDir: dir, + stdout: () => {}, + stderr: (t) => { + refusedErr += t; + }, + }); + expect(refusedCode).toBe(1); + expect(refusedErr).toContain("--add"); + expect(refusedErr).toContain("--reset"); + + // --add adds account2 alongside account1 + const makeGrantFetch = (acct: ReturnType): FetchLike => { + return async (_input, init) => { + if (init?.method === "POST") return new Response(null, { status: 201 }); + if (init?.method === "DELETE") return new Response(null, { status: 204 }); + const grant = signTrustGrant({ + accountKeyPair: acct, + agentPublicKey: agent.publicKey, + secret, + issuedAt: BASE_TIME, + }); + return new Response(JSON.stringify({ grant }), { status: 200 }); + }; + }; + + const addCode = await runPairingFlow({ + stateDir: dir, + add: true, + fetch: makeGrantFetch(account2), + now: () => BASE_TIME, + stdout: () => {}, + stderr: () => {}, + generateSecret: () => secret, + }); + expect(addCode).toBe(0); + expect((await loadTrust(dir)).length).toBe(2); + + // --reset rejected when confirmation is not 'yes' + const cancelResetCode = await runPairingFlow({ + stateDir: dir, + reset: true, + confirm: async () => "no", + stdout: () => {}, + stderr: () => {}, + }); + expect(cancelResetCode).toBe(1); + expect((await loadTrust(dir)).length).toBe(2); + + // --reset accepted when confirmed with 'yes' + const resetCode = await runPairingFlow({ + stateDir: dir, + reset: true, + confirm: async () => "yes", + fetch: makeGrantFetch(account3), + now: () => BASE_TIME, + stdout: () => {}, + stderr: () => {}, + generateSecret: () => secret, + }); + expect(resetCode).toBe(0); + + // Only account3 trusted, revocations & replay cleared, identity & server data intact + const finalTrusted = await loadTrust(dir); + expect(finalTrusted.length).toBe(1); + expect(fingerprint(finalTrusted[0] ?? new Uint8Array())).toBe(fingerprint(account3.publicKey)); + expect(loadRevocations(dir)).toEqual({ v: 1, accounts: {} }); + expect(existsSync(replayPath)).toBe(false); + expect(fingerprint((await loadOrCreateIdentity(dir)).publicKey)).toBe( + fingerprint(agent.publicKey), + ); + expect(readFileSync(join(serversDir, "world.txt"), "utf8")).toBe("keep-me"); + }); + + test("parses printed pairing URL fragment cleanly", async () => { + const dir = makeTempDir(); + writeConfig(dir, "https://api.tegra.example", "https://custom.tegra.example/pair"); + const agent = await loadOrCreateIdentity(dir); + const account = generateSigningKeyPair(); + + let stdout = ""; + let capturedGrant: unknown = null; + + const fakeFetch: FetchLike = async (_input, init) => { + if (init?.method === "POST") return new Response(null, { status: 201 }); + if (init?.method === "DELETE") return new Response(null, { status: 204 }); + if (capturedGrant === null) { + const match = stdout.match(/Pairing URL: (https:\/\/\S+)/); + const url = new URL(match?.[1] ?? ""); + const parsed = parsePairingFragment(url.hash); + capturedGrant = signTrustGrant({ + accountKeyPair: account, + agentPublicKey: agent.publicKey, + ...(parsed.secret !== undefined ? { secret: parsed.secret } : {}), + issuedAt: BASE_TIME, + }); + } + return new Response(JSON.stringify({ grant: capturedGrant }), { status: 200 }); + }; + + const code = await runPairingFlow({ + stateDir: dir, + fetch: fakeFetch, + now: () => BASE_TIME, + stdout: (t) => { + stdout += t; + }, + stderr: () => {}, + }); + + expect(code).toBe(0); + expect(stdout).toContain("https://custom.tegra.example/pair#"); + }); +}); + +describe("end-to-end revocation via command queue", () => { + test("agent.revocations.set applies revocations, emits agent.revocations.applied, and blocks revoked session", async () => { + const dir = makeTempDir(); + const agent = await loadOrCreateIdentity(dir); + const agentId = fingerprint(agent.publicKey); + const account = generateSigningKeyPair(); + const session = generateSigningKeyPair(); + const now = BASE_TIME; + + await addTrustedAccount(dir, account.publicKey); + const trust = createFileTrustContext({ + stateDir: dir, + agentKeyPair: agent, + trustedAccountKeys: [account.publicKey], + now: () => now, + }); + const registry = createCoreRegistry(); + const sent: TransportFrame[] = []; + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (frame) => sent.push(frame), + logger: createLogger({ level: "error", stdout: () => {}, stderr: () => {} }), + }); + + const sessionCert = signSessionCertificate({ + sessionPublicKey: session.publicKey, + accountKeyPair: account, + notBefore: now - 60_000, + notAfter: now + 3_600_000, + }); + + const wrap = (body: ReturnType): TransportCommandFrame => ({ + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: agentId }, + body, + }); + + // Session works before revocation + const pingBefore = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: session, + session: sessionCert, + counter: 1, + now, + }, + registry, + ); + await queue.enqueue(wrap(pingBefore)); + expect(sent.pop()).toMatchObject({ kind: "ack", body: { id: pingBefore.header.id, ok: true } }); + sent.length = 0; + + // Apply revocation list via agent.revocations.set + const list1 = signRevocationList({ + accountKeyPair: account, + issuedAt: now, + revoked: [sessionCert.id], + }); + const revokeCmd = createSignedCommand( + { + type: "agent.revocations.set", + body: { list: list1 }, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now, + }, + registry, + ); + await queue.enqueue(wrap(revokeCmd)); + + const eventFrame = sent.find((f) => f.kind === "event"); + const ackFrame = sent.find((f) => f.kind === "ack"); + expect(eventFrame).toBeDefined(); + if (eventFrame?.kind === "event") { + const openedEvent = openAgentMessage(eventFrame.body, agent.publicKey, account); + expect(openedEvent.header.type).toBe("agent.revocations.applied"); + expect(openedEvent.body).toEqual({ + account: fingerprint(account.publicKey), + count: 1, + }); + } + expect(ackFrame).toMatchObject({ kind: "ack", body: { id: revokeCmd.header.id, ok: true } }); + sent.length = 0; + + // Session is now rejected with session_revoked + const pingAfter = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: session, + session: sessionCert, + counter: 2, + now, + }, + registry, + ); + await queue.enqueue(wrap(pingAfter)); + expect(sent.pop()).toEqual({ + v: PROTOCOL_VERSION, + kind: "ack", + route: { agent: agentId }, + body: { id: pingAfter.header.id, ok: false, code: "session_revoked" }, + }); + + // Non-superset revocation list returns ack with code revocation_not_superset + const shrinkingList = signRevocationList({ + accountKeyPair: account, + issuedAt: now + 1000, + revoked: [], + }); + const badRevokeCmd = createSignedCommand( + { + type: "agent.revocations.set", + body: { list: shrinkingList }, + agentPublicKey: agent.publicKey, + signer: account, + counter: 2, + now, + }, + registry, + ); + await queue.enqueue(wrap(badRevokeCmd)); + expect(sent.pop()).toEqual({ + v: PROTOCOL_VERSION, + kind: "ack", + route: { agent: agentId }, + body: { id: badRevokeCmd.header.id, ok: false, code: "revocation_not_superset" }, + }); + }); +}); diff --git a/src/agent/pairing.ts b/src/agent/pairing.ts new file mode 100644 index 0000000..ac5287e --- /dev/null +++ b/src/agent/pairing.ts @@ -0,0 +1,315 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { createInterface } from "node:readline"; +import { renderUnicodeCompact } from "uqr"; +import { fingerprint, ready, toBase64Url } from "../crypto"; +import { + buildPairingFragment, + generatePairingCode, + generatePairingSecret, + ProtocolError, + verifyTrustGrant, +} from "../protocol"; +import type { Logger } from "./logger"; +import { + createPairingApiClient, + type FetchLike, + type PairingApiClient, + PairingApiError, +} from "./pairing-api"; +import { + type AgentConfig, + addTrustedAccount, + isInsecureAllowed, + loadConfig, + loadOrCreateIdentity, + loadTrust, + resetTrustState, + validateLinkUrl, +} from "./state"; + +export const DEFAULT_LINK_URL = "https://tegramc.com/link"; +export const DEFAULT_POLL_INTERVAL_MS = 2_000; +export const DEFAULT_PAIRING_TIMEOUT_MS = 10 * 60 * 1000; +export const MAX_CODE_CONFLICT_RETRIES = 3; + +export function formatFingerprintGroups(fp: string): string { + const groups: string[] = []; + for (let i = 0; i < fp.length; i += 4) { + groups.push(fp.slice(i, i + 4)); + } + return groups.join(" "); +} + +export function resolveLinkUrl( + config: AgentConfig, + env: Readonly> = process.env, +): string { + const envUrl = env.TEGRAD_LINK_URL?.trim(); + if (envUrl && envUrl.length > 0) { + return validateLinkUrl(envUrl); + } + if (config.linkUrl !== undefined) { + return config.linkUrl; + } + return DEFAULT_LINK_URL; +} + +function defaultSleep(ms: number, signal?: AbortSignal): Promise { + if (signal?.aborted) { + return Promise.resolve(); + } + return new Promise((resolve) => { + const onAbort = (): void => { + clearTimeout(timer); + resolve(); + }; + const timer = setTimeout(() => { + signal?.removeEventListener("abort", onAbort); + resolve(); + }, ms); + signal?.addEventListener("abort", onAbort, { once: true }); + }); +} + +function defaultConfirm(prompt: string, stdout: (text: string) => void): Promise { + return new Promise((resolve) => { + stdout(prompt); + const rl = createInterface({ + input: process.stdin, + terminal: false, + }); + let resolved = false; + rl.once("line", (line) => { + resolved = true; + rl.close(); + resolve(line); + }); + rl.once("close", () => { + if (!resolved) { + resolve(""); + } + }); + }); +} + +export interface RunPairingFlowOptions { + readonly stateDir: string; + readonly env?: Readonly>; + readonly add?: boolean; + readonly reset?: boolean; + readonly yes?: boolean; + readonly allowUnverified?: boolean; + readonly stdout?: (text: string) => void; + readonly stderr?: (text: string) => void; + readonly logger?: Logger; + readonly fetch?: FetchLike; + readonly apiClient?: PairingApiClient; + readonly now?: () => number; + readonly sleep?: (ms: number, signal?: AbortSignal) => Promise; + readonly pollIntervalMs?: number; + readonly timeoutMs?: number; + readonly signalTarget?: Pick; + readonly confirm?: (prompt: string) => Promise; + readonly generateCode?: () => string; + readonly generateSecret?: () => string; +} + +export async function runPairingFlow(options: RunPairingFlowOptions): Promise { + await ready(); + + const env = options.env ?? process.env; + const stdout = options.stdout ?? ((text: string) => process.stdout.write(text)); + const stderr = options.stderr ?? ((text: string) => process.stderr.write(text)); + const now = options.now ?? (() => Date.now()); + const sleep = options.sleep ?? defaultSleep; + const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS; + const timeoutMs = options.timeoutMs ?? DEFAULT_PAIRING_TIMEOUT_MS; + const signalTarget = options.signalTarget ?? process; + const confirm = options.confirm ?? ((prompt: string) => defaultConfirm(prompt, stdout)); + const generateCode = options.generateCode ?? generatePairingCode; + const generateSecret = options.generateSecret ?? generatePairingSecret; + const allowUnverified = options.allowUnverified ?? false; + + const config = loadConfig(options.stateDir, { env }); + const linkBaseUrl = resolveLinkUrl(config, env); + const agentKeyPair = await loadOrCreateIdentity(options.stateDir); + const agentId = fingerprint(agentKeyPair.publicKey); + const existingTrusted = await loadTrust(options.stateDir); + + if (options.reset) { + if (!options.yes) { + const answer = await confirm( + "This will remove all trusted accounts, revocations, and replay state (keeping the agent identity and server data). Type 'yes' to continue: ", + ); + if (answer.trim() !== "yes") { + stderr("Pairing reset cancelled.\n"); + return 1; + } + } + resetTrustState(options.stateDir); + options.logger?.info("Cleared trust, revocations, and replay state for reset"); + } else if (existingTrusted.length > 0 && !options.add) { + stderr( + `This agent is already linked to ${existingTrusted.length} account(s). Use --add to trust another account, or --reset to clear existing trust and link again.\n`, + ); + return 1; + } + + if (allowUnverified) { + stderr( + "WARNING: --allow-unverified is enabled. Accepting a trust grant without pairing proof trusts the API on first contact.\n", + ); + } + + const api = + options.apiClient ?? + createPairingApiClient({ + apiUrl: config.apiUrl, + allowInsecure: isInsecureAllowed(env), + ...(options.fetch !== undefined ? { fetch: options.fetch } : {}), + }); + + const abortController = new AbortController(); + let cancelled = false; + let activeCode: string | null = null; + + const onSigInt = (): void => { + cancelled = true; + abortController.abort(); + }; + signalTarget.on("SIGINT", onSigInt); + + try { + const secret = generateSecret(); + const agentPublicKeyB64 = toBase64Url(agentKeyPair.publicKey); + + let registeredCode: string | null = null; + for (let attempt = 0; attempt <= MAX_CODE_CONFLICT_RETRIES; attempt++) { + const candidate = generateCode(); + const status = await api.registerPairing( + candidate, + agentPublicKeyB64, + abortController.signal, + ); + if (status === "created") { + registeredCode = candidate; + break; + } + options.logger?.warn("Pairing code conflict, retrying with a new code", { + attempt: attempt + 1, + }); + } + + if (registeredCode === null) { + stderr("Failed to register pairing code after multiple conflicts.\n"); + return 1; + } + + activeCode = registeredCode; + const fragment = buildPairingFragment({ + code: registeredCode, + secret, + agentFingerprint: agentId, + }); + const pairingUrl = `${linkBaseUrl}#${fragment}`; + const qr = renderUnicodeCompact(pairingUrl); + + options.logger?.info("Pairing request registered", { agentId }); + + stdout(`Agent fingerprint: ${formatFingerprintGroups(agentId)}\n`); + stdout(`Pairing URL: ${pairingUrl}\n\n`); + stdout(`${qr}\n\n`); + stdout("Waiting for pairing confirmation...\n"); + + const deadline = now() + timeoutMs; + + while (!cancelled && now() < deadline) { + const result = await api.pollGrant(registeredCode, abortController.signal); + + if (result.status === "expired") { + options.logger?.warn("Pairing request expired"); + stderr("Pairing request expired.\n"); + return 1; + } + + if (result.status === "ready") { + try { + const verified = verifyTrustGrant(result.grant, { + agentPublicKey: agentKeyPair.publicKey, + secret, + now: now(), + requireProof: !allowUnverified, + }); + await addTrustedAccount(options.stateDir, verified.accountPublicKey); + await api.deletePairing(registeredCode); + activeCode = null; + options.logger?.info("Agent linked to account", { + accountId: verified.accountId, + proven: verified.proven, + }); + stdout( + `Linked account: ${verified.accountId} (${formatFingerprintGroups(verified.accountId)})\n`, + ); + return 0; + } catch (err) { + await api.deletePairing(registeredCode); + activeCode = null; + if (err instanceof ProtocolError) { + options.logger?.warn("Trust grant rejected", { code: err.code }); + stderr(`Pairing rejected: ${err.code}\n`); + return 1; + } + options.logger?.error("Unexpected error verifying trust grant", { + errName: err instanceof Error ? err.name : "Error", + }); + stderr("Pairing rejected: grant_invalid\n"); + return 1; + } + } + + const remaining = deadline - now(); + if (remaining <= 0 || cancelled) { + break; + } + await sleep(Math.min(pollIntervalMs, remaining), abortController.signal); + } + + if (cancelled) { + await api.deletePairing(registeredCode); + activeCode = null; + options.logger?.info("Pairing cancelled by user"); + stderr("Pairing cancelled.\n"); + return 1; + } + + await api.deletePairing(registeredCode); + activeCode = null; + options.logger?.warn("Pairing timed out"); + stderr("Pairing timed out.\n"); + return 1; + } catch (err) { + if (activeCode !== null) { + await api.deletePairing(activeCode); + activeCode = null; + } + if (cancelled || (err instanceof PairingApiError && err.code === "aborted")) { + options.logger?.info("Pairing cancelled by user"); + stderr("Pairing cancelled.\n"); + return 1; + } + if (err instanceof PairingApiError) { + options.logger?.error("Pairing API error", { code: err.code }); + stderr(`Pairing failed: ${err.code}\n`); + return 1; + } + options.logger?.error("Unexpected pairing failure", { + errName: err instanceof Error ? err.name : "Error", + }); + stderr("Pairing failed.\n"); + return 1; + } finally { + signalTarget.off("SIGINT", onSigInt); + } +} diff --git a/src/agent/paths.ts b/src/agent/paths.ts index ef40d77..49b8f91 100644 --- a/src/agent/paths.ts +++ b/src/agent/paths.ts @@ -16,6 +16,7 @@ export interface StatePaths { readonly configPath: string; readonly identityPath: string; readonly trustPath: string; + readonly revocationsPath: string; readonly replayPath: string; } @@ -45,6 +46,7 @@ export function getStatePaths(stateDir: string): StatePaths { configPath: join(stateDir, "config.json"), identityPath: join(stateDir, "identity.json"), trustPath: join(stateDir, "trust.json"), + revocationsPath: join(stateDir, "revocations.json"), replayPath: join(stateDir, "replay.json"), }; } diff --git a/src/agent/state.test.ts b/src/agent/state.test.ts index 4a69e19..1eb5ef9 100644 --- a/src/agent/state.test.ts +++ b/src/agent/state.test.ts @@ -4,6 +4,7 @@ import { afterEach, beforeAll, describe, expect, test } from "bun:test"; import { chmodSync, + existsSync, mkdtempSync, readdirSync, readFileSync, @@ -14,13 +15,19 @@ import { import { tmpdir } from "node:os"; import { join } from "node:path"; import { fingerprint, generateSigningKeyPair, ready, toBase64Url } from "../crypto"; +import { ProtocolError, signRevocationList } from "../protocol"; import { DEFAULT_LINUX_STATE_DIR, getStatePaths, resolveStateDir } from "./paths"; import { + addTrustedAccount, + applyRevocationList, + clearTrust, createFileTrustContext, loadConfig, loadOrCreateIdentity, + loadRevocations, loadTrust, MAX_RECENT_REPLAY_IDS, + resetTrustState, StateError, writeFileAtomic, } from "./state"; @@ -208,3 +215,147 @@ describe("persistent replay state", () => { expect(persisted.last_counter[accountId]).toBe(MAX_RECENT_REPLAY_IDS + 2); }); }); + +describe("trust and revocations persistence", () => { + test("addTrustedAccount is atomic, idempotent by fingerprint, preserves 0600, and clearTrust removes trust.json", async () => { + const dir = makeTempDir(); + const account1 = generateSigningKeyPair(); + const account2 = generateSigningKeyPair(); + const { trustPath } = getStatePaths(dir); + + const r1 = await addTrustedAccount(dir, account1.publicKey); + expect(r1.added).toBe(true); + expect(r1.accountId).toBe(fingerprint(account1.publicKey)); + + // Idempotent duplicate add + const r1Dup = await addTrustedAccount(dir, account1.publicKey); + expect(r1Dup.added).toBe(false); + expect((await loadTrust(dir)).length).toBe(1); + + const r2 = await addTrustedAccount(dir, account2.publicKey); + expect(r2.added).toBe(true); + expect((await loadTrust(dir)).length).toBe(2); + + if (process.platform !== "win32") { + expect(statSync(trustPath).mode & 0o777).toBe(0o600); + } + + clearTrust(dir); + expect(existsSync(trustPath)).toBe(false); + expect(await loadTrust(dir)).toEqual([]); + }); + + test("applyRevocationList validates trust, signature, monotonic issued_at, superset, and persists across reloads", async () => { + const dir = makeTempDir(); + const agent = await loadOrCreateIdentity(dir); + const trustedAccount = generateSigningKeyPair(); + const untrustedAccount = generateSigningKeyPair(); + + await addTrustedAccount(dir, trustedAccount.publicKey); + + // Untrusted account rejected + const untrustedList = signRevocationList({ + accountKeyPair: untrustedAccount, + issuedAt: 1000, + revoked: ["sess_1"], + }); + await expect(applyRevocationList(dir, untrustedList)).rejects.toMatchObject({ + code: "untrusted_signer", + }); + + // Invalid signature rejected + const validList1 = signRevocationList({ + accountKeyPair: trustedAccount, + issuedAt: 1000, + revoked: ["sess_1"], + }); + await expect( + applyRevocationList(dir, { ...validList1, revoked: ["sess_2"] }), + ).rejects.toMatchObject({ + code: "bad_signature", + }); + + // Valid list accepted + const applied1 = await applyRevocationList(dir, validList1); + expect(applied1).toEqual({ + account: fingerprint(trustedAccount.publicKey), + count: 1, + }); + + // Equal or older issued_at rejected + const staleList = signRevocationList({ + accountKeyPair: trustedAccount, + issuedAt: 1000, + revoked: ["sess_1", "sess_2"], + }); + await expect(applyRevocationList(dir, staleList)).rejects.toMatchObject({ + code: "revocation_stale", + }); + + // Non-superset rejected with revocation_not_superset + const shrinkingList = signRevocationList({ + accountKeyPair: trustedAccount, + issuedAt: 2000, + revoked: ["sess_2"], + }); + try { + await applyRevocationList(dir, shrinkingList); + throw new Error("Expected revocation_not_superset"); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe("revocation_not_superset"); + } + + // Newer superset accepted + const validList2 = signRevocationList({ + accountKeyPair: trustedAccount, + issuedAt: 2000, + revoked: ["sess_1", "sess_2"], + }); + const applied2 = await applyRevocationList(dir, validList2); + expect(applied2.count).toBe(2); + + // Reloaded FileTrustContext reflects persisted revocations + const ctx = createFileTrustContext({ + stateDir: dir, + agentKeyPair: agent, + trustedAccountKeys: await loadTrust(dir), + }); + expect(ctx.isSessionRevoked("sess_1")).toBe(true); + expect(ctx.isSessionRevoked("sess_2")).toBe(true); + expect(ctx.isSessionRevoked("sess_3")).toBe(false); + + // Corrupted revocations.json throws StateError + const { revocationsPath } = getStatePaths(dir); + writeFileSync(revocationsPath, '{"v":999}', "utf8"); + expect(() => loadRevocations(dir)).toThrow(StateError); + }); + + test("FileTrustContext picks up live trust.json changes and resetTrustState preserves identity", async () => { + const dir = makeTempDir(); + const agent = await loadOrCreateIdentity(dir); + const account1 = generateSigningKeyPair(); + const account2 = generateSigningKeyPair(); + + await addTrustedAccount(dir, account1.publicKey); + const ctx = createFileTrustContext({ + stateDir: dir, + agentKeyPair: agent, + trustedAccountKeys: [account1.publicKey], + }); + expect(ctx.isTrustedAccountKey(fingerprint(account1.publicKey))).not.toBeNull(); + expect(ctx.isTrustedAccountKey(fingerprint(account2.publicKey))).toBeNull(); + + // Live reset while context is active + resetTrustState(dir); + expect(ctx.isTrustedAccountKey(fingerprint(account1.publicKey))).toBeNull(); + + // Identity still exists + const reloadedAgent = await loadOrCreateIdentity(dir); + expect(fingerprint(reloadedAgent.publicKey)).toBe(fingerprint(agent.publicKey)); + + // Live re-pair with account2 + await addTrustedAccount(dir, account2.publicKey); + expect(ctx.isTrustedAccountKey(fingerprint(account2.publicKey))).not.toBeNull(); + }); +}); diff --git a/src/agent/state.ts b/src/agent/state.ts index 5832909..e51da55 100644 --- a/src/agent/state.ts +++ b/src/agent/state.ts @@ -28,7 +28,16 @@ import { type SigningKeyPair, toBase64Url, } from "../crypto"; -import { base64UrlSchema, type KeyId, keyIdSchema, type TrustContext } from "../protocol"; +import { + base64UrlSchema, + type KeyId, + keyIdSchema, + PROTOCOL_VERSION, + ProtocolError, + revocationListSchema, + type TrustContext, + verifyRevocationList, +} from "../protocol"; import { getStatePaths } from "./paths"; export const MAX_RECENT_REPLAY_IDS = 4096; @@ -49,10 +58,12 @@ const envFlagsSchema = z.object({ const rawConfigSchema = z.object({ api_url: z.string().min(1), + link_url: z.string().min(1).optional(), }); export interface AgentConfig { readonly apiUrl: string; + readonly linkUrl?: string; } const identityFileSchema = z.object({ @@ -76,6 +87,26 @@ const replayFileSchema = z.object({ recent_ids: z.array(base64UrlSchema), }); +const revocationAccountEntrySchema = z.object({ + issued_at: z.number().int().nonnegative(), + revoked: z.array(base64UrlSchema), +}); + +const revocationsFileSchema = z.object({ + v: z.literal(1), + accounts: z.record(keyIdSchema, revocationAccountEntrySchema), +}); + +export interface RevocationAccountState { + readonly issued_at: number; + readonly revoked: readonly string[]; +} + +export interface RevocationsState { + readonly v: 1; + readonly accounts: Readonly>; +} + export interface AtomicWriteOptions { readonly mode?: number; readonly dirMode?: number; @@ -207,6 +238,29 @@ export function validateApiUrl(apiUrl: string, allowInsecure: boolean): string { ); } +export function validateLinkUrl(linkUrl: string): string { + let parsed: URL; + try { + parsed = new URL(linkUrl); + } catch { + throw new StateError(`Invalid link_url: "${linkUrl}"`); + } + + if (parsed.username || parsed.password) { + throw new StateError("link_url must not contain embedded credentials"); + } + + if (parsed.protocol !== "https:") { + throw new StateError(`link_url must use https:// (got ${parsed.protocol}//${parsed.host})`); + } + + if (parsed.hash.length > 0) { + throw new StateError("link_url must not contain a URL fragment"); + } + + return parsed.toString(); +} + export interface LoadConfigOptions { readonly allowInsecure?: boolean; readonly env?: Readonly>; @@ -226,7 +280,12 @@ export function loadConfig(stateDir: string, options: LoadConfigOptions = {}): A const allowInsecure = options.allowInsecure ?? isInsecureAllowed(options.env); const apiUrl = validateApiUrl(parsed.data.api_url, allowInsecure); - return { apiUrl }; + const linkUrl = + parsed.data.link_url !== undefined ? validateLinkUrl(parsed.data.link_url) : undefined; + return { + apiUrl, + ...(linkUrl !== undefined ? { linkUrl } : {}), + }; } function parseIdentityFile(filePath: string): SigningKeyPair { @@ -291,9 +350,7 @@ export async function loadOrCreateIdentity(stateDir: string): Promise { - await ready(); - const { trustPath } = getStatePaths(stateDir); +function loadTrustSync(trustPath: string): PublicKey[] { if (!existsSync(trustPath)) { return []; } @@ -321,6 +378,153 @@ export async function loadTrust(stateDir: string): Promise { return keys; } +export async function loadTrust(stateDir: string): Promise { + await ready(); + const { trustPath } = getStatePaths(stateDir); + return loadTrustSync(trustPath); +} + +export async function addTrustedAccount( + stateDir: string, + publicKey: PublicKey, +): Promise<{ readonly added: boolean; readonly accountId: KeyId }> { + await ready(); + if (publicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new StateError(`Account public key must be ${SIGNING_PUBLIC_KEY_BYTES} bytes`); + } + + const { trustPath } = getStatePaths(stateDir); + const existing = loadTrustSync(trustPath); + const accountId = fingerprint(publicKey); + + for (const key of existing) { + if (fingerprint(key) === accountId) { + return { added: false, accountId }; + } + } + + const accounts = [...existing, publicKey].map((key) => ({ + public_key: toBase64Url(key), + })); + const content = `${JSON.stringify({ v: 1, accounts }, null, 2)}\n`; + writeFileAtomic(trustPath, content, { + mode: SECRET_FILE_MODE, + dirMode: STATE_DIR_MODE, + }); + + return { added: true, accountId }; +} + +function unlinkIfExists(filePath: string): void { + if (existsSync(filePath)) { + unlinkSync(filePath); + } +} + +export function clearTrust(stateDir: string): void { + const { trustPath } = getStatePaths(stateDir); + unlinkIfExists(trustPath); +} + +export function resetTrustState(stateDir: string): void { + const { trustPath, revocationsPath, replayPath } = getStatePaths(stateDir); + unlinkIfExists(trustPath); + unlinkIfExists(revocationsPath); + unlinkIfExists(replayPath); +} + +export function loadRevocations(stateDir: string): RevocationsState { + const { revocationsPath } = getStatePaths(stateDir); + if (!existsSync(revocationsPath)) { + return { v: 1, accounts: {} }; + } + + const raw = readJsonFile(revocationsPath, "revocations.json"); + const parsed = revocationsFileSchema.safeParse(raw); + if (!parsed.success) { + throw new StateError(`Invalid revocations.json at ${revocationsPath}`); + } + + return parsed.data; +} + +export async function applyRevocationList( + stateDir: string, + list: unknown, +): Promise<{ readonly account: KeyId; readonly count: number }> { + await ready(); + + if (typeof list === "object" && list !== null && "v" in list) { + const version = (list as { v: unknown }).v; + if (version !== PROTOCOL_VERSION) { + throw new ProtocolError("unsupported_version", "Unsupported protocol version"); + } + } + + const parsed = revocationListSchema.safeParse(list); + if (!parsed.success) { + throw new ProtocolError("invalid_format", "Malformed revocation list"); + } + + const trustedKeys = await loadTrust(stateDir); + const accountPublicKey = + trustedKeys.find((key) => fingerprint(key) === parsed.data.account) ?? null; + if (accountPublicKey === null) { + throw new ProtocolError("untrusted_signer", "Revocation list account is not trusted"); + } + + const verified = verifyRevocationList(list, accountPublicKey); + const current = loadRevocations(stateDir); + const existing = current.accounts[verified.account]; + + if (existing !== undefined) { + if (verified.issued_at <= existing.issued_at) { + throw new ProtocolError( + "revocation_stale", + "Revocation list issued_at must be greater than existing list", + ); + } + const nextSet = new Set(verified.revoked); + for (const revokedId of existing.revoked) { + if (!nextSet.has(revokedId)) { + throw new ProtocolError( + "revocation_not_superset", + "Revocation list must be a superset of previously revoked sessions", + ); + } + } + } + + const dedupedRevoked: string[] = []; + const seen = new Set(); + for (const id of verified.revoked) { + if (!seen.has(id)) { + seen.add(id); + dedupedRevoked.push(id); + } + } + + const nextAccounts: Record = { + ...current.accounts, + [verified.account]: { + issued_at: verified.issued_at, + revoked: dedupedRevoked, + }, + }; + + const { revocationsPath } = getStatePaths(stateDir); + const content = `${JSON.stringify({ v: 1, accounts: nextAccounts }, null, 2)}\n`; + writeFileAtomic(revocationsPath, content, { + mode: SECRET_FILE_MODE, + dirMode: STATE_DIR_MODE, + }); + + return { + account: verified.account, + count: dedupedRevoked.length, + }; +} + interface ReplayStateData { readonly lastCounters: Map; readonly recentIds: string[]; @@ -390,18 +594,21 @@ export interface FileTrustContextOptions { export interface FileTrustContext extends TrustContext { setRevokedSessionIds(ids: Iterable): void; + applyRevocationList(list: unknown): Promise<{ readonly account: KeyId; readonly count: number }>; flush(): void; } export function createFileTrustContext(options: FileTrustContextOptions): FileTrustContext { - const { replayPath } = getStatePaths(options.stateDir); + const { trustPath, revocationsPath, replayPath } = getStatePaths(options.stateDir); const maxRecentIds = options.maxRecentIds ?? MAX_RECENT_REPLAY_IDS; - const trusted = new Map(); + const fallbackTrusted = new Map(); for (const key of options.trustedAccountKeys) { - trusted.set(fingerprint(key), key); + fallbackTrusted.set(fingerprint(key), key); } - let revoked = new Set(options.revokedSessionIds); + let sawTrustFile = existsSync(trustPath); + let sawReplayFile = existsSync(replayPath); + let manualRevoked = new Set(options.revokedSessionIds); const clock = options.now ?? (() => Date.now()); const replay = loadReplayState(replayPath, maxRecentIds); @@ -409,15 +616,46 @@ export function createFileTrustContext(options: FileTrustContextOptions): FileTr agentKeyPair: options.agentKeyPair, isTrustedAccountKey(id: KeyId): PublicKey | null { - return trusted.get(id) ?? null; + if (existsSync(trustPath)) { + sawTrustFile = true; + const keys = loadTrustSync(trustPath); + for (const key of keys) { + if (fingerprint(key) === id) { + return key; + } + } + return null; + } + if (sawTrustFile) { + return null; + } + return fallbackTrusted.get(id) ?? null; }, isSessionRevoked(certificateId: string): boolean { - return revoked.has(certificateId); + if (manualRevoked.has(certificateId)) { + return true; + } + if (!existsSync(revocationsPath)) { + return false; + } + const state = loadRevocations(options.stateDir); + for (const entry of Object.values(state.accounts)) { + if (entry.revoked.includes(certificateId)) { + return true; + } + } + return false; }, setRevokedSessionIds(ids: Iterable): void { - revoked = new Set(ids); + manualRevoked = new Set(ids); + }, + + applyRevocationList( + list: unknown, + ): Promise<{ readonly account: KeyId; readonly count: number }> { + return applyRevocationList(options.stateDir, list); }, now(): number { @@ -425,6 +663,13 @@ export function createFileTrustContext(options: FileTrustContextOptions): FileTr }, claimCommand(signer: KeyId, id: string, counter: number): boolean { + if (sawReplayFile && !existsSync(replayPath)) { + replay.lastCounters.clear(); + replay.recentIds.length = 0; + replay.recentIdSet.clear(); + sawReplayFile = false; + } + if (replay.recentIdSet.has(id)) { return false; } @@ -443,11 +688,13 @@ export function createFileTrustContext(options: FileTrustContextOptions): FileTr } replay.lastCounters.set(signer, counter); persistReplayState(replayPath, replay); + sawReplayFile = true; return true; }, flush(): void { persistReplayState(replayPath, replay); + sawReplayFile = true; }, }; } diff --git a/src/cli/args.ts b/src/cli/args.ts index fe7b361..5c9343d 100644 --- a/src/cli/args.ts +++ b/src/cli/args.ts @@ -1,11 +1,18 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda +export interface LinkCliOptions { + readonly add: boolean; + readonly reset: boolean; + readonly yes: boolean; + readonly allowUnverified: boolean; +} + export type ParsedCliCommand = | { readonly kind: "run" } | { readonly kind: "status" } | { readonly kind: "identity" } - | { readonly kind: "link" } + | { readonly kind: "link"; readonly options: LinkCliOptions } | { readonly kind: "version" } | { readonly kind: "help" } | { readonly kind: "unknown"; readonly token: string }; @@ -37,7 +44,30 @@ export function parseCliArgs(argv: readonly string[]): ParsedCliCommand { } if (first === "link") { - return { kind: "link" }; + let add = false; + let reset = false; + let yes = false; + let allowUnverified = false; + + for (let i = 1; i < argv.length; i++) { + const flag = argv[i]; + if (flag === "--add") { + add = true; + } else if (flag === "--reset") { + reset = true; + } else if (flag === "--yes" || flag === "-y") { + yes = true; + } else if (flag === "--allow-unverified") { + allowUnverified = true; + } else { + return { kind: "unknown", token: argv.join(" ") }; + } + } + + return { + kind: "link", + options: { add, reset, yes, allowUnverified }, + }; } return { kind: "unknown", token: argv.join(" ") }; @@ -51,6 +81,7 @@ export function formatUsage(versionLineText: string): string { "", "Commands:", " run Connect to the control server and process commands", + " link Pair this agent with a Tegra account (--add, --reset, --yes, --allow-unverified)", " status Show local state directory, identity, config, and trust status", " identity Create the agent identity if missing and print its fingerprint", "", diff --git a/src/cli/cli.test.ts b/src/cli/cli.test.ts index e5202aa..e178ae0 100644 --- a/src/cli/cli.test.ts +++ b/src/cli/cli.test.ts @@ -5,7 +5,9 @@ import { afterEach, describe, expect, test } from "bun:test"; import { mkdtempSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { getStatePaths } from "../agent"; +import { addTrustedAccount, applyRevocationList, getStatePaths } from "../agent"; +import { fingerprint, generateSigningKeyPair, ready } from "../crypto"; +import { signRevocationList } from "../protocol"; import { versionLine } from "../version"; import { runCli } from "./main"; @@ -68,14 +70,37 @@ describe("CLI", () => { expect(res.stderr).toContain("Usage: tegrad"); }); - test("link and link --reset respond 'not implemented' with exit code 2", async () => { - const r1 = await invokeCli(["link"]); + test("link rejects conflicting --add and --reset flags or unknown flags with exit code 2", async () => { + const r1 = await invokeCli(["link", "--add", "--reset"]); expect(r1.code).toBe(2); - expect(r1.stderr.trim()).toBe("not implemented"); + expect(r1.stderr).toContain("--add"); - const r2 = await invokeCli(["link", "--reset"]); + const r2 = await invokeCli(["link", "--unknown-flag"]); expect(r2.code).toBe(2); - expect(r2.stderr.trim()).toBe("not implemented"); + expect(r2.stderr).toContain("Usage: tegrad"); + }); + + test("status lists trusted account fingerprints and revoked session counts", async () => { + await ready(); + const dir = makeTempDir(); + const env = { TEGRAD_STATE_DIR: dir }; + const account = generateSigningKeyPair(); + const accountId = fingerprint(account.publicKey); + + await addTrustedAccount(dir, account.publicKey); + await applyRevocationList( + dir, + signRevocationList({ + accountKeyPair: account, + issuedAt: 1_700_000_000_000, + revoked: ["sess_1", "sess_2"], + }), + ); + + const status = await invokeCli(["status"], env); + expect(status.code).toBe(0); + expect(status.stdout).toContain("trusted_accounts: 1"); + expect(status.stdout).toContain(`${accountId} (revoked_sessions: 2)`); }); test("identity creates keypair and prints only fingerprint; status reports local state", async () => { diff --git a/src/cli/e2e.test.ts b/src/cli/e2e.test.ts index ba8f5ea..3526de1 100644 --- a/src/cli/e2e.test.ts +++ b/src/cli/e2e.test.ts @@ -5,16 +5,32 @@ import { afterEach, beforeAll, describe, expect, test } from "bun:test"; import { mkdtempSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { createLogger, getStatePaths, loadOrCreateIdentity } from "../agent"; -import { fingerprint, generateSigningKeyPair, ready, toBase64Url } from "../crypto"; +import { + createLogger, + getStatePaths, + loadOrCreateIdentity, + loadTrust, + runPairingFlow, +} from "../agent"; +import { + fingerprint, + fromBase64Url, + generateSigningKeyPair, + KDF_FLOOR, + ready, + toBase64Url, +} from "../crypto"; import { createCoreRegistry, createSignedCommand, openAgentMessage, PROTOCOL_VERSION, + parsePairingFragment, + signTrustGrant, type TransportFrame, transportFrameSchema, } from "../protocol"; +import { createCommandFromSession, createVault, issueSession } from "../vault"; import { createAgentRuntime } from "./run"; const tempDirs: string[] = []; @@ -149,4 +165,208 @@ describe("E2E local WebSocket ping/pong", () => { server.stop(true); } }); + + test("full pairing E2E over local HTTP + WS server: vault signs TrustGrant, agent trusts account and accepts session agent.ping", async () => { + const stateDir = makeTempDir(); + const agent = await loadOrCreateIdentity(stateDir); + const agentId = fingerprint(agent.publicKey); + const registry = createCoreRegistry(); + const now = Date.now(); + + const pairings = new Map(); + const receivedFrames: TransportFrame[] = []; + let resolveBoth!: () => void; + const bothReceived = new Promise((resolve) => { + resolveBoth = resolve; + }); + let commandToSend: ReturnType | null = null; + + const server = Bun.serve({ + hostname: "127.0.0.1", + port: 0, + async fetch(req, srv) { + const url = new URL(req.url); + if (url.pathname === "/agents/connect" && url.searchParams.get("agent") === agentId) { + if (srv.upgrade(req)) { + return; + } + } + if (req.method === "POST" && url.pathname === "/agents/pairing") { + const body = (await req.json()) as { code: string; agent_public_key: string }; + if (pairings.has(body.code)) { + return new Response(null, { status: 409 }); + } + pairings.set(body.code, { agentPublicKeyB64: body.agent_public_key }); + return new Response(null, { status: 201 }); + } + const grantMatch = url.pathname.match(/^\/agents\/pairing\/([^/]+)\/grant$/); + if (grantMatch) { + const code = decodeURIComponent(grantMatch[1] ?? ""); + const entry = pairings.get(code); + if (!entry) { + return new Response(null, { status: 404 }); + } + if (req.method === "POST") { + const body = (await req.json()) as { grant: unknown }; + entry.grant = body.grant; + return new Response(null, { status: 200 }); + } + if (req.method === "GET") { + if (entry.grant === undefined) { + return new Response(null, { status: 202 }); + } + return new Response(JSON.stringify({ grant: entry.grant }), { + status: 200, + headers: { "content-type": "application/json" }, + }); + } + } + const pairingMatch = url.pathname.match(/^\/agents\/pairing\/([^/]+)$/); + if (pairingMatch) { + const code = decodeURIComponent(pairingMatch[1] ?? ""); + const entry = pairings.get(code); + if (req.method === "GET") { + if (!entry) return new Response(null, { status: 404 }); + return new Response(JSON.stringify({ agent_public_key: entry.agentPublicKeyB64 }), { + status: 200, + headers: { "content-type": "application/json" }, + }); + } + if (req.method === "DELETE") { + pairings.delete(code); + return new Response(null, { status: 204 }); + } + } + return new Response("Not found", { status: 404 }); + }, + websocket: { + open(ws) { + if (commandToSend !== null) { + const frame: TransportFrame = { + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: agentId }, + body: commandToSend, + }; + ws.send(JSON.stringify(frame)); + } + }, + message(_ws, message) { + const text = typeof message === "string" ? message : new TextDecoder().decode(message); + const frame = transportFrameSchema.parse(JSON.parse(text)); + receivedFrames.push(frame); + const hasEvent = receivedFrames.some((f) => f.kind === "event"); + const hasAck = receivedFrames.some((f) => f.kind === "ack"); + if (hasEvent && hasAck) { + resolveBoth(); + } + }, + }, + }); + + const apiBase = `http://127.0.0.1:${server.port}`; + const { configPath } = getStatePaths(stateDir); + writeFileSync(configPath, JSON.stringify({ api_url: apiBase }), "utf8"); + + const vault = createVault({ + password: "correct-horse-battery-staple-99!", + kdf: KDF_FLOOR, + now, + }); + + try { + let stdout = ""; + let clientCompleted = false; + + const linkCode = await runPairingFlow({ + stateDir, + env: { TEGRAD_ALLOW_INSECURE: "1" }, + now: () => now, + pollIntervalMs: 25, + stdout: (text) => { + stdout += text; + if (!clientCompleted && stdout.includes("Pairing URL: ")) { + const match = stdout.match(/Pairing URL: (https:\/\/\S+)/); + if (match?.[1]) { + clientCompleted = true; + const fragment = parsePairingFragment(new URL(match[1]).hash); + void (async () => { + const res = await fetch(`${apiBase}/agents/pairing/${fragment.code}`); + const data = (await res.json()) as { agent_public_key: string }; + const fetchedAgentPub = fromBase64Url(data.agent_public_key); + expect(fragment.agentFingerprint).toBeDefined(); + expect(fingerprint(fetchedAgentPub)).toBe(fragment.agentFingerprint ?? ""); + + const grant = signTrustGrant({ + accountKeyPair: vault.unlocked.keyPair, + agentPublicKey: fetchedAgentPub, + ...(fragment.secret !== undefined ? { secret: fragment.secret } : {}), + issuedAt: now, + }); + await fetch(`${apiBase}/agents/pairing/${fragment.code}/grant`, { + method: "POST", + headers: { "content-type": "application/json" }, + body: JSON.stringify({ grant }), + }); + })(); + } + } + }, + stderr: () => {}, + }); + + expect(linkCode).toBe(0); + const trusted = await loadTrust(stateDir); + expect(trusted.length).toBe(1); + expect(fingerprint(trusted[0] ?? new Uint8Array())).toBe(vault.unlocked.account); + + // Issue a session from the vault and send a signed agent.ping to the running agent + const session = issueSession(vault.unlocked, { duration: "24h", now }); + commandToSend = createCommandFromSession(session, { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + counter: 1, + now, + registry, + }); + + const runtime = await createAgentRuntime({ + stateDir, + env: { TEGRAD_ALLOW_INSECURE: "1" }, + logger: createLogger({ level: "error", stdout: () => {}, stderr: () => {} }), + now: () => now, + }); + + try { + runtime.start(); + await Promise.race([ + bothReceived, + new Promise((_, reject) => + setTimeout(() => reject(new Error("Timed out waiting for paired agent.pong")), 5000), + ), + ]); + + const eventFrame = receivedFrames.find((f) => f.kind === "event"); + const ackFrame = receivedFrames.find((f) => f.kind === "ack"); + expect(eventFrame?.kind).toBe("event"); + if (eventFrame?.kind === "event") { + const opened = openAgentMessage(eventFrame.body, agent.publicKey, vault.unlocked.keyPair); + expect(opened.header.type).toBe("agent.pong"); + expect(opened.body).toEqual({ at: now }); + } + expect(ackFrame).toEqual({ + v: PROTOCOL_VERSION, + kind: "ack", + route: { agent: agentId }, + body: { id: commandToSend.header.id, ok: true }, + }); + } finally { + await runtime.shutdown(2000); + } + } finally { + vault.unlocked.lock(); + server.stop(true); + } + }); }); diff --git a/src/cli/main.ts b/src/cli/main.ts index 2b3a4e8..b0572c8 100644 --- a/src/cli/main.ts +++ b/src/cli/main.ts @@ -3,11 +3,16 @@ import { existsSync } from "node:fs"; import { + type FetchLike, getStatePaths, + type Logger, loadIdentityIfExists, loadOrCreateIdentity, + loadRevocations, loadTrust, + type RunPairingFlowOptions, resolveStateDir, + runPairingFlow, } from "../agent"; import { fingerprint } from "../crypto"; import { versionLine } from "../version"; @@ -22,6 +27,13 @@ export interface CliDependencies { stateDir: string, env: Readonly>, ) => Promise; + readonly linkOptions?: Omit< + RunPairingFlowOptions, + "stateDir" | "env" | "add" | "reset" | "yes" | "allowUnverified" | "stdout" | "stderr" + > & { + readonly fetch?: FetchLike; + readonly logger?: Logger; + }; } export async function runCli(argv: readonly string[], deps: CliDependencies = {}): Promise { @@ -42,8 +54,27 @@ export async function runCli(argv: readonly string[], deps: CliDependencies = {} } case "link": { - stderr("not implemented\n"); - return 2; + if (parsed.options.add && parsed.options.reset) { + stderr("Cannot combine --add and --reset.\n"); + return 2; + } + try { + const stateDir = resolveStateDir(env); + return await runPairingFlow({ + ...(deps.linkOptions ?? {}), + stateDir, + env, + add: parsed.options.add, + reset: parsed.options.reset, + yes: parsed.options.yes, + allowUnverified: parsed.options.allowUnverified, + stdout, + stderr, + }); + } catch (err) { + stderr(`${err instanceof Error ? err.message : String(err)}\n`); + return 1; + } } case "unknown": { @@ -70,6 +101,7 @@ export async function runCli(argv: readonly string[], deps: CliDependencies = {} const identity = await loadIdentityIfExists(stateDir); const hasConfig = existsSync(paths.configPath); const trustedKeys = await loadTrust(stateDir); + const revocations = loadRevocations(stateDir); const lines = [ `state_dir: ${stateDir}`, @@ -77,6 +109,11 @@ export async function runCli(argv: readonly string[], deps: CliDependencies = {} `config: ${hasConfig ? "present" : "missing"}`, `trusted_accounts: ${trustedKeys.length}`, ]; + for (const key of trustedKeys) { + const accountId = fingerprint(key); + const revokedCount = revocations.accounts[accountId]?.revoked.length ?? 0; + lines.push(` - ${accountId} (revoked_sessions: ${revokedCount})`); + } stdout(`${lines.join("\n")}\n`); return 0; } catch (err) { diff --git a/src/protocol/commands/core.ts b/src/protocol/commands/core.ts index 9f94f38..d9fdf34 100644 --- a/src/protocol/commands/core.ts +++ b/src/protocol/commands/core.ts @@ -3,6 +3,7 @@ import { z } from "zod"; import { CommandRegistry, defineCommand } from "../registry"; +import { registerPairingCommands } from "./pairing"; const serverIdBodySchema = z.object({ server_id: z.string().min(1), @@ -44,5 +45,5 @@ export function registerCoreCommands(registry: CommandRegistry): CommandRegistry } export function createCoreRegistry(): CommandRegistry { - return registerCoreCommands(new CommandRegistry()); + return registerPairingCommands(registerCoreCommands(new CommandRegistry())); } diff --git a/src/protocol/commands/pairing.ts b/src/protocol/commands/pairing.ts new file mode 100644 index 0000000..1ffdb08 --- /dev/null +++ b/src/protocol/commands/pairing.ts @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; +import { type CommandRegistry, defineCommand } from "../registry"; +import { revocationListSchema } from "../schemas"; + +export const agentRevocationsSetCommand = defineCommand({ + type: "agent.revocations.set", + sensitive: false, + body: z.object({ + list: revocationListSchema, + }), +}); + +export const PAIRING_COMMANDS = [agentRevocationsSetCommand] as const; + +export function registerPairingCommands(registry: CommandRegistry): CommandRegistry { + return registry.registerAll(PAIRING_COMMANDS); +} diff --git a/src/protocol/domains.ts b/src/protocol/domains.ts index 144ed3b..cc03508 100644 --- a/src/protocol/domains.ts +++ b/src/protocol/domains.ts @@ -11,6 +11,8 @@ export const DOMAIN_COMMAND = utf8Encoder.encode("tegrad/command/v1\0"); export const DOMAIN_SESSION = utf8Encoder.encode("tegrad/session/v1\0"); export const DOMAIN_AGENT_MESSAGE = utf8Encoder.encode("tegrad/agent-message/v1\0"); export const DOMAIN_REVOCATION = utf8Encoder.encode("tegrad/revocation/v1\0"); +export const DOMAIN_TRUST_GRANT = utf8Encoder.encode("tegrad/trust-grant/v1\0"); +export const DOMAIN_PAIRING_PROOF = utf8Encoder.encode("tegrad/pairing-proof/v1\0"); export function concatBytes(...parts: readonly Uint8Array[]): Uint8Array { let total = 0; diff --git a/src/protocol/errors.ts b/src/protocol/errors.ts index 7c77e24..b222a24 100644 --- a/src/protocol/errors.ts +++ b/src/protocol/errors.ts @@ -17,7 +17,15 @@ export type ProtocolErrorCode = | "unknown_command" | "invalid_body" | "sensitive_requires_account_key" - | "decrypt_failed"; + | "decrypt_failed" + | "grant_invalid" + | "grant_wrong_agent" + | "grant_expired" + | "grant_bad_signature" + | "grant_proof_required" + | "grant_bad_proof" + | "revocation_stale" + | "revocation_not_superset"; export class ProtocolError extends Error { readonly code: ProtocolErrorCode; diff --git a/src/protocol/index.ts b/src/protocol/index.ts index 101c93f..31521ce 100644 --- a/src/protocol/index.ts +++ b/src/protocol/index.ts @@ -26,14 +26,41 @@ export { serverStartCommand, serverStopCommand, } from "./commands/core"; +export { + agentRevocationsSetCommand, + PAIRING_COMMANDS, + registerPairingCommands, +} from "./commands/pairing"; export { DOMAIN_AGENT_MESSAGE, DOMAIN_COMMAND, + DOMAIN_PAIRING_PROOF, DOMAIN_REVOCATION, DOMAIN_SESSION, + DOMAIN_TRUST_GRANT, PROTOCOL_VERSION, } from "./domains"; export { ProtocolError, type ProtocolErrorCode } from "./errors"; +export { + type BuildPairingFragmentParams, + buildPairingFragment, + DEFAULT_TRUST_GRANT_TTL_MS, + generatePairingCode, + generatePairingSecret, + MAX_TRUST_GRANT_TTL_MS, + PAIRING_CODE_LENGTH, + PAIRING_SECRET_BYTES, + type PairingFragment, + pairingCodeSchema, + parsePairingFragment, + type SignTrustGrantParams, + signTrustGrant, + type TrustGrant, + trustGrantSchema, + type VerifiedTrustGrant, + type VerifyTrustGrantOptions, + verifyTrustGrant, +} from "./pairing"; export { type CommandDefinition, CommandRegistry, defineCommand } from "./registry"; export { type SignRevocationListParams, diff --git a/src/protocol/pairing.test.ts b/src/protocol/pairing.test.ts new file mode 100644 index 0000000..fbe76e6 --- /dev/null +++ b/src/protocol/pairing.test.ts @@ -0,0 +1,417 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { beforeAll, describe, expect, test } from "bun:test"; +import { fingerprint, generateSigningKeyPair, ready } from "../crypto"; +import { + buildPairingFragment, + createCoreRegistry, + createInMemoryTrustContext, + createSignedCommand, + generatePairingCode, + generatePairingSecret, + MAX_TRUST_GRANT_TTL_MS, + openCommand, + PAIRING_CODE_LENGTH, + ProtocolError, + type ProtocolErrorCode, + parsePairingFragment, + signRevocationList, + signTrustGrant, + type TrustGrant, + verifyTrustGrant, +} from "./index"; + +const BASE_TIME = 1_700_000_000_000; + +beforeAll(async () => { + await ready(); +}); + +function expectProtocolErrorSync(fn: () => unknown, expectedCode: ProtocolErrorCode): void { + try { + fn(); + throw new Error(`Expected ProtocolError(${expectedCode}), but succeeded`); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe(expectedCode); + } +} + +describe("pairing fragments", () => { + test("generatePairingCode produces 10 uppercase Crockford base32 chars without I, L, O, U", () => { + for (let i = 0; i < 50; i++) { + const code = generatePairingCode(); + expect(code.length).toBe(PAIRING_CODE_LENGTH); + expect(code).toMatch(/^[0-9A-HJKMNP-TV-Z]{10}$/); + expect(code).not.toMatch(/[ILOU]/); + } + }); + + test("buildPairingFragment and parsePairingFragment round-trip with and without leading #", () => { + const agent = generateSigningKeyPair(); + const agentFingerprint = fingerprint(agent.publicKey); + const code = generatePairingCode(); + const secret = generatePairingSecret(); + + const fragment = buildPairingFragment({ code, secret, agentFingerprint }); + expect(fragment).toBe(`${code}.${secret}.${agentFingerprint}`); + + expect(parsePairingFragment(fragment)).toEqual({ + code, + secret, + agentFingerprint, + }); + expect(parsePairingFragment(`#${fragment}`)).toEqual({ + code, + secret, + agentFingerprint, + }); + }); + + test("parsePairingFragment accepts short code only (with or without #)", () => { + const code = generatePairingCode(); + expect(parsePairingFragment(code)).toEqual({ code }); + expect(parsePairingFragment(`#${code}`)).toEqual({ code }); + }); + + test("parsePairingFragment rejects invalid formats", () => { + const agent = generateSigningKeyPair(); + const fp = fingerprint(agent.publicKey); + const code = generatePairingCode(); + const secret = generatePairingSecret(); + + const invalidInputs = [ + "", + "#", + "TOO-SHORT", + "012345678I", // contains I + "012345678L", // contains L + "012345678O", // contains O + "012345678U", // contains U + "012345678a", // lowercase + `${code}.${secret}`, // 2 parts + `${code}.${secret}.${fp}.extra`, // 4 parts + `${code}.short.${fp}`, // wrong secret length + `${code}.${secret}.not-a-valid-fingerprint`, + ]; + + for (const input of invalidInputs) { + expectProtocolErrorSync(() => parsePairingFragment(input), "invalid_format"); + } + }); +}); + +describe("TrustGrant signing and verification", () => { + test("accepts valid grant with proof and returns accountPublicKey, accountId, proven: true", () => { + const account = generateSigningKeyPair(); + const agent = generateSigningKeyPair(); + const secret = generatePairingSecret(); + + const grant = signTrustGrant({ + accountKeyPair: account, + agentPublicKey: agent.publicKey, + secret, + issuedAt: BASE_TIME, + }); + + const verified = verifyTrustGrant(grant, { + agentPublicKey: agent.publicKey, + secret, + now: BASE_TIME + 5_000, + requireProof: true, + }); + + expect(verified.proven).toBe(true); + expect(verified.accountId).toBe(fingerprint(account.publicKey)); + expect(verified.accountPublicKey).toEqual(account.publicKey); + }); + + test("accepts valid grant without proof when requireProof is false", () => { + const account = generateSigningKeyPair(); + const agent = generateSigningKeyPair(); + + const grant = signTrustGrant({ + accountKeyPair: account, + agentPublicKey: agent.publicKey, + issuedAt: BASE_TIME, + }); + + expect(grant.proof).toBeUndefined(); + + const verified = verifyTrustGrant(grant, { + agentPublicKey: agent.publicKey, + now: BASE_TIME + 1_000, + requireProof: false, + }); + + expect(verified.proven).toBe(false); + expect(verified.accountId).toBe(fingerprint(account.publicKey)); + }); + + test("rejects wrong agent with grant_wrong_agent", () => { + const account = generateSigningKeyPair(); + const agent1 = generateSigningKeyPair(); + const agent2 = generateSigningKeyPair(); + const secret = generatePairingSecret(); + + const grant = signTrustGrant({ + accountKeyPair: account, + agentPublicKey: agent1.publicKey, + secret, + issuedAt: BASE_TIME, + }); + + expectProtocolErrorSync( + () => + verifyTrustGrant(grant, { + agentPublicKey: agent2.publicKey, + secret, + now: BASE_TIME, + requireProof: true, + }), + "grant_wrong_agent", + ); + }); + + test("rejects expired grant with grant_expired", () => { + const account = generateSigningKeyPair(); + const agent = generateSigningKeyPair(); + const secret = generatePairingSecret(); + + const grant = signTrustGrant({ + accountKeyPair: account, + agentPublicKey: agent.publicKey, + secret, + issuedAt: BASE_TIME, + ttlMs: 60_000, + }); + + expectProtocolErrorSync( + () => + verifyTrustGrant(grant, { + agentPublicKey: agent.publicKey, + secret, + now: BASE_TIME + 60_000, + requireProof: true, + }), + "grant_expired", + ); + }); + + test("rejects not-yet-valid grant with not_yet_valid", () => { + const account = generateSigningKeyPair(); + const agent = generateSigningKeyPair(); + const secret = generatePairingSecret(); + + const grant = signTrustGrant({ + accountKeyPair: account, + agentPublicKey: agent.publicKey, + secret, + issuedAt: BASE_TIME + 60_000, + }); + + expectProtocolErrorSync( + () => + verifyTrustGrant(grant, { + agentPublicKey: agent.publicKey, + secret, + now: BASE_TIME, + requireProof: true, + }), + "not_yet_valid", + ); + }); + + test("rejects grant with TTL exceeding 15 minutes with grant_invalid", () => { + const account = generateSigningKeyPair(); + const agent = generateSigningKeyPair(); + const grant = signTrustGrant({ + accountKeyPair: account, + agentPublicKey: agent.publicKey, + issuedAt: BASE_TIME, + }); + + const tooLong: TrustGrant = { + ...grant, + expires_at: BASE_TIME + MAX_TRUST_GRANT_TTL_MS + 1, + }; + + expectProtocolErrorSync( + () => + verifyTrustGrant(tooLong, { + agentPublicKey: agent.publicKey, + now: BASE_TIME, + requireProof: false, + }), + "grant_invalid", + ); + }); + + test("rejects tampered signature with grant_bad_signature", () => { + const account = generateSigningKeyPair(); + const agent = generateSigningKeyPair(); + const secret = generatePairingSecret(); + + const grant = signTrustGrant({ + accountKeyPair: account, + agentPublicKey: agent.publicKey, + secret, + issuedAt: BASE_TIME, + }); + + const tampered: TrustGrant = { + ...grant, + expires_at: grant.expires_at - 1000, + }; + + expectProtocolErrorSync( + () => + verifyTrustGrant(tampered, { + agentPublicKey: agent.publicKey, + secret, + now: BASE_TIME, + requireProof: true, + }), + "grant_bad_signature", + ); + }); + + test("rejects missing proof when requireProof is true with grant_proof_required", () => { + const account = generateSigningKeyPair(); + const agent = generateSigningKeyPair(); + const secret = generatePairingSecret(); + + const grant = signTrustGrant({ + accountKeyPair: account, + agentPublicKey: agent.publicKey, + issuedAt: BASE_TIME, + }); + + expectProtocolErrorSync( + () => + verifyTrustGrant(grant, { + agentPublicKey: agent.publicKey, + secret, + now: BASE_TIME, + requireProof: true, + }), + "grant_proof_required", + ); + }); + + test("rejects wrong proof (different secret) with grant_bad_proof", () => { + const account = generateSigningKeyPair(); + const agent = generateSigningKeyPair(); + const secret1 = generatePairingSecret(); + const secret2 = generatePairingSecret(); + + const grant = signTrustGrant({ + accountKeyPair: account, + agentPublicKey: agent.publicKey, + secret: secret1, + issuedAt: BASE_TIME, + }); + + expectProtocolErrorSync( + () => + verifyTrustGrant(grant, { + agentPublicKey: agent.publicKey, + secret: secret2, + now: BASE_TIME, + requireProof: true, + }), + "grant_bad_proof", + ); + }); + + test("rejects grant with proof stripped as grant_bad_signature", () => { + const account = generateSigningKeyPair(); + const agent = generateSigningKeyPair(); + const secret = generatePairingSecret(); + + const grant = signTrustGrant({ + accountKeyPair: account, + agentPublicKey: agent.publicKey, + secret, + issuedAt: BASE_TIME, + }); + + const { proof: _removed, ...stripped } = grant; + + expectProtocolErrorSync( + () => + verifyTrustGrant(stripped, { + agentPublicKey: agent.publicKey, + secret, + now: BASE_TIME, + requireProof: false, + }), + "grant_bad_signature", + ); + }); + + test("rejects grant signed by attacker key with proof from another secret as grant_bad_proof", () => { + const attacker = generateSigningKeyPair(); + const agent = generateSigningKeyPair(); + const agentSecret = generatePairingSecret(); + const attackerSecret = generatePairingSecret(); + + const forgedGrant = signTrustGrant({ + accountKeyPair: attacker, + agentPublicKey: agent.publicKey, + secret: attackerSecret, + issuedAt: BASE_TIME, + }); + + expectProtocolErrorSync( + () => + verifyTrustGrant(forgedGrant, { + agentPublicKey: agent.publicKey, + secret: agentSecret, + now: BASE_TIME, + requireProof: true, + }), + "grant_bad_proof", + ); + }); +}); + +describe("agent.revocations.set command", () => { + test("is registered in createCoreRegistry as non-sensitive and opens cleanly", async () => { + const registry = createCoreRegistry(); + const def = registry.get("agent.revocations.set"); + expect(def).toBeDefined(); + expect(def?.sensitive).toBe(false); + + const account = generateSigningKeyPair(); + const agent = generateSigningKeyPair(); + const list = signRevocationList({ + accountKeyPair: account, + issuedAt: BASE_TIME, + revoked: ["sess_abc"], + }); + + const cmd = createSignedCommand( + { + type: "agent.revocations.set", + body: { list }, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now: BASE_TIME, + }, + registry, + ); + + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [account.publicKey], + now: () => BASE_TIME, + }); + + const opened = await openCommand(cmd, trust, registry); + expect(opened.header.type).toBe("agent.revocations.set"); + expect(opened.body).toEqual({ list }); + }); +}); diff --git a/src/protocol/pairing.ts b/src/protocol/pairing.ts new file mode 100644 index 0000000..a29e957 --- /dev/null +++ b/src/protocol/pairing.ts @@ -0,0 +1,338 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; +import { + canonicalize, + fingerprint, + fromBase64Url, + HASH_BYTES, + hash, + type PublicKey, + randomBytes, + SIGNING_PUBLIC_KEY_BYTES, + type SigningKeyPair, + sign, + toBase64Url, + verify, +} from "../crypto"; +import { MAX_CLOCK_SKEW_MS } from "./command"; +import { + assertSupportedVersion, + concatBytes, + DOMAIN_PAIRING_PROOF, + DOMAIN_TRUST_GRANT, + PROTOCOL_VERSION, +} from "./domains"; +import { ProtocolError } from "./errors"; +import { base64UrlSchema, type KeyId, keyIdSchema } from "./schemas"; + +export const PAIRING_CODE_LENGTH = 10; +export const PAIRING_SECRET_BYTES = 16; +export const DEFAULT_TRUST_GRANT_TTL_MS = 10 * 60 * 1000; +export const MAX_TRUST_GRANT_TTL_MS = 15 * 60 * 1000; + +const CROCKFORD_ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"; +const PAIRING_CODE_REGEX = /^[0-9A-HJKMNP-TV-Z]{10}$/; + +export const pairingCodeSchema = z.string().regex(PAIRING_CODE_REGEX, "Invalid pairing code"); + +export const trustGrantSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + kind: z.literal("agent-pairing"), + account_key: base64UrlSchema, + agent: keyIdSchema, + issued_at: z.number().int().nonnegative(), + expires_at: z.number().int().nonnegative(), + proof: base64UrlSchema.optional(), + sig: base64UrlSchema, +}); +export type TrustGrant = z.infer; + +export interface PairingFragment { + readonly code: string; + readonly secret?: string; + readonly agentFingerprint?: KeyId; +} + +export interface BuildPairingFragmentParams { + readonly code: string; + readonly secret: string; + readonly agentFingerprint: KeyId; +} + +export interface SignTrustGrantParams { + readonly accountKeyPair: SigningKeyPair; + readonly agentPublicKey: PublicKey; + readonly secret?: string | Uint8Array; + readonly issuedAt: number; + readonly ttlMs?: number; +} + +export interface VerifyTrustGrantOptions { + readonly agentPublicKey: PublicKey; + readonly secret?: string | Uint8Array; + readonly now: number; + readonly requireProof: boolean; +} + +export interface VerifiedTrustGrant { + readonly accountPublicKey: PublicKey; + readonly accountId: KeyId; + readonly proven: boolean; +} + +function bytesEqual(a: Uint8Array, b: Uint8Array): boolean { + if (a.length !== b.length) { + return false; + } + let diff = 0; + for (let i = 0; i < a.length; i++) { + diff |= (a[i] ?? 0) ^ (b[i] ?? 0); + } + return diff === 0; +} + +function decodeSecretBytes(secret: string | Uint8Array): Uint8Array | null { + let bytes: Uint8Array; + if (typeof secret === "string") { + if (!base64UrlSchema.safeParse(secret).success) { + return null; + } + try { + bytes = fromBase64Url(secret); + } catch { + return null; + } + } else { + bytes = secret; + } + if (bytes.length !== PAIRING_SECRET_BYTES) { + return null; + } + return bytes; +} + +export function generatePairingCode(): string { + const bytes = randomBytes(PAIRING_CODE_LENGTH); + let out = ""; + for (let i = 0; i < PAIRING_CODE_LENGTH; i++) { + const idx = (bytes[i] ?? 0) & 0x1f; + out += CROCKFORD_ALPHABET[idx] ?? ""; + } + return out; +} + +export function generatePairingSecret(): string { + return toBase64Url(randomBytes(PAIRING_SECRET_BYTES)); +} + +export function buildPairingFragment(params: BuildPairingFragmentParams): string { + if (!pairingCodeSchema.safeParse(params.code).success) { + throw new ProtocolError("invalid_format", "Invalid pairing code"); + } + if (decodeSecretBytes(params.secret) === null) { + throw new ProtocolError("invalid_format", "Invalid pairing secret"); + } + if (!keyIdSchema.safeParse(params.agentFingerprint).success) { + throw new ProtocolError("invalid_format", "Invalid agent fingerprint"); + } + return `${params.code}.${params.secret}.${params.agentFingerprint}`; +} + +export function parsePairingFragment(text: string): PairingFragment { + const raw = text.startsWith("#") ? text.slice(1) : text; + if (raw.length === 0) { + throw new ProtocolError("invalid_format", "Empty pairing fragment"); + } + + const parts = raw.split("."); + if (parts.length === 1) { + const code = parts[0] ?? ""; + if (!pairingCodeSchema.safeParse(code).success) { + throw new ProtocolError("invalid_format", "Invalid pairing code"); + } + return { code }; + } + + if (parts.length === 3) { + const code = parts[0] ?? ""; + const secret = parts[1] ?? ""; + const agentFingerprint = parts[2] ?? ""; + + if (!pairingCodeSchema.safeParse(code).success) { + throw new ProtocolError("invalid_format", "Invalid pairing code"); + } + if (decodeSecretBytes(secret) === null) { + throw new ProtocolError("invalid_format", "Invalid pairing secret"); + } + const parsedFp = keyIdSchema.safeParse(agentFingerprint); + if (!parsedFp.success) { + throw new ProtocolError("invalid_format", "Invalid agent fingerprint"); + } + + return { + code, + secret, + agentFingerprint: parsedFp.data, + }; + } + + throw new ProtocolError("invalid_format", "Malformed pairing fragment"); +} + +function computePairingProof( + base: { + readonly v: typeof PROTOCOL_VERSION; + readonly kind: "agent-pairing"; + readonly account_key: string; + readonly agent: KeyId; + readonly issued_at: number; + readonly expires_at: number; + }, + secretBytes: Uint8Array, +): Uint8Array { + const input = concatBytes(DOMAIN_PAIRING_PROOF, canonicalize(base)); + return hash(input, secretBytes); +} + +export function signTrustGrant(params: SignTrustGrantParams): TrustGrant { + if (!Number.isSafeInteger(params.issuedAt) || params.issuedAt < 0) { + throw new RangeError("issuedAt must be a non-negative safe integer"); + } + if (params.agentPublicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new RangeError(`Agent public key must be ${SIGNING_PUBLIC_KEY_BYTES} bytes`); + } + + const ttlMs = params.ttlMs ?? DEFAULT_TRUST_GRANT_TTL_MS; + if (!Number.isSafeInteger(ttlMs) || ttlMs <= 0 || ttlMs > MAX_TRUST_GRANT_TTL_MS) { + throw new RangeError( + `ttlMs must be a positive safe integer at most ${MAX_TRUST_GRANT_TTL_MS} ms`, + ); + } + + const base = { + v: PROTOCOL_VERSION, + kind: "agent-pairing" as const, + account_key: toBase64Url(params.accountKeyPair.publicKey), + agent: fingerprint(params.agentPublicKey), + issued_at: params.issuedAt, + expires_at: params.issuedAt + ttlMs, + }; + + let proof: string | undefined; + if (params.secret !== undefined) { + const secretBytes = decodeSecretBytes(params.secret); + if (secretBytes === null) { + throw new RangeError(`Pairing secret must be ${PAIRING_SECRET_BYTES} bytes`); + } + proof = toBase64Url(computePairingProof(base, secretBytes)); + } + + const unsigned = proof !== undefined ? { ...base, proof } : base; + const signingInput = concatBytes(DOMAIN_TRUST_GRANT, canonicalize(unsigned)); + const signature = sign(signingInput, params.accountKeyPair.secretKey); + + return { + ...unsigned, + sig: toBase64Url(signature), + }; +} + +export function verifyTrustGrant( + grant: unknown, + options: VerifyTrustGrantOptions, +): VerifiedTrustGrant { + assertSupportedVersion(grant); + + const parsed = trustGrantSchema.safeParse(grant); + if (!parsed.success) { + throw new ProtocolError("grant_invalid", "Malformed trust grant"); + } + + const data = parsed.data; + if (data.expires_at <= data.issued_at) { + throw new ProtocolError("grant_invalid", "Trust grant expiration is not after issuance"); + } + if (data.expires_at - data.issued_at > MAX_TRUST_GRANT_TTL_MS) { + throw new ProtocolError("grant_invalid", "Trust grant lifetime exceeds maximum allowed window"); + } + + let accountPublicKey: Uint8Array; + try { + accountPublicKey = fromBase64Url(data.account_key); + } catch { + throw new ProtocolError("grant_invalid", "Invalid account_key encoding in trust grant"); + } + if (accountPublicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new ProtocolError("grant_invalid", "Invalid account_key length in trust grant"); + } + + const expectedAgent = fingerprint(options.agentPublicKey); + if (data.agent !== expectedAgent) { + throw new ProtocolError("grant_wrong_agent", "Trust grant is addressed to a different agent"); + } + + if (data.issued_at > options.now + MAX_CLOCK_SKEW_MS) { + throw new ProtocolError("not_yet_valid", "Trust grant issued_at is in the future"); + } + if (options.now >= data.expires_at) { + throw new ProtocolError("grant_expired", "Trust grant has expired"); + } + + let signatureBytes: Uint8Array; + try { + signatureBytes = fromBase64Url(data.sig); + } catch { + throw new ProtocolError("grant_bad_signature", "Invalid trust grant signature encoding"); + } + + const base = { + v: data.v, + kind: data.kind, + account_key: data.account_key, + agent: data.agent, + issued_at: data.issued_at, + expires_at: data.expires_at, + }; + const unsigned = data.proof !== undefined ? { ...base, proof: data.proof } : base; + const signingInput = concatBytes(DOMAIN_TRUST_GRANT, canonicalize(unsigned)); + if (!verify(signingInput, signatureBytes, accountPublicKey)) { + throw new ProtocolError("grant_bad_signature", "Invalid trust grant signature"); + } + + let proven = false; + if (data.proof === undefined) { + if (options.requireProof) { + throw new ProtocolError("grant_proof_required", "Trust grant is missing pairing proof"); + } + } else { + if (options.secret === undefined) { + throw new ProtocolError("grant_bad_proof", "Pairing secret unavailable to verify proof"); + } + const secretBytes = decodeSecretBytes(options.secret); + if (secretBytes === null) { + throw new ProtocolError("grant_bad_proof", "Invalid pairing secret"); + } + let proofBytes: Uint8Array; + try { + proofBytes = fromBase64Url(data.proof); + } catch { + throw new ProtocolError("grant_bad_proof", "Invalid proof encoding"); + } + if (proofBytes.length !== HASH_BYTES) { + throw new ProtocolError("grant_bad_proof", "Invalid proof length"); + } + const expectedProof = computePairingProof(base, secretBytes); + if (!bytesEqual(proofBytes, expectedProof)) { + throw new ProtocolError("grant_bad_proof", "Pairing proof does not match secret"); + } + proven = true; + } + + return { + accountPublicKey, + accountId: fingerprint(accountPublicKey), + proven, + }; +} From 9d544234dbf2a59eeb3d2aff52262b2e2c4641b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 22 Nov 2026 19:39:58 -0300 Subject: [PATCH 05/59] feat: add Linux installer, systemd units, polkit rule, network isolation, and doctor command --- .github/workflows/ci.yml | 31 + install/README.md | 59 ++ install/install.sh | 939 +++++++++++++++++++++++++++ install/polkit/50-tegrad.rules | 21 + install/tmpfiles/tegrad.conf | 7 + install/units/tegrad-server@.service | 52 ++ install/units/tegrad-server@.socket | 18 + install/units/tegrad.service | 42 ++ src/agent/exec.test.ts | 54 ++ src/agent/exec.ts | 154 +++++ src/agent/index.ts | 7 + src/cli/args.ts | 6 + src/cli/cli.test.ts | 50 ++ src/cli/doctor.test.ts | 171 +++++ src/cli/doctor.ts | 411 ++++++++++++ src/cli/main.ts | 25 +- src/cli/run.ts | 19 + src/install/units.test.ts | 348 ++++++++++ src/install/units.ts | 285 ++++++++ 19 files changed, 2697 insertions(+), 2 deletions(-) create mode 100644 install/README.md create mode 100755 install/install.sh create mode 100644 install/polkit/50-tegrad.rules create mode 100644 install/tmpfiles/tegrad.conf create mode 100644 install/units/tegrad-server@.service create mode 100644 install/units/tegrad-server@.socket create mode 100644 install/units/tegrad.service create mode 100644 src/agent/exec.test.ts create mode 100644 src/agent/exec.ts create mode 100644 src/cli/doctor.test.ts create mode 100644 src/cli/doctor.ts create mode 100644 src/install/units.test.ts create mode 100644 src/install/units.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1802e9a..be35544 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,3 +17,34 @@ jobs: - run: bun run lint - run: bun run typecheck - run: bun run test + + install-checks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Lint installer with shellcheck + run: shellcheck install/install.sh + - name: Verify systemd units + run: | + set -eu + sudo groupadd --system tegrad-srv + sudo useradd --system --gid tegrad-srv --home-dir /nonexistent --no-create-home --shell /usr/sbin/nologin tegrad-srv + sudo groupadd --system tegrad + sudo useradd --system --gid tegrad --home-dir /var/lib/tegrad --no-create-home --shell /usr/sbin/nologin tegrad + sudo usermod -aG tegrad-srv tegrad + sudo install -d -o root -g root -m 0755 /opt/tegrad/bin + sudo install -d -o tegrad -g tegrad -m 0700 /var/lib/tegrad + sudo install -d -o tegrad-srv -g tegrad-srv -m 2770 /var/lib/tegrad-servers /var/lib/tegrad-servers/test + sudo install -d -o root -g tegrad -m 0750 /run/tegrad-server + printf '#!/bin/sh\nexit 0\n' | sudo tee /opt/tegrad/bin/tegrad /var/lib/tegrad-servers/test/start.sh >/dev/null + sudo chmod 0755 /opt/tegrad/bin/tegrad /var/lib/tegrad-servers/test/start.sh + tmp_dir=$(mktemp -d) + for unit in tegrad.service tegrad-server@.service tegrad-server@.socket; do + sed \ + -e 's|@TEGRAD_BIN@|/opt/tegrad/bin/tegrad|g' \ + -e 's|@TEGRAD_STATE_DIR@|/var/lib/tegrad|g' \ + -e 's|@TEGRAD_SERVERS_DIR@|/var/lib/tegrad-servers|g' \ + -e 's|@TEGRAD_RUN_DIR@|/run/tegrad-server|g' \ + "install/units/${unit}" > "${tmp_dir}/${unit}" + done + systemd-analyze verify "${tmp_dir}/tegrad.service" "${tmp_dir}/tegrad-server@test.service" "${tmp_dir}/tegrad-server@test.socket" diff --git a/install/README.md b/install/README.md new file mode 100644 index 0000000..905c6bf --- /dev/null +++ b/install/README.md @@ -0,0 +1,59 @@ +# Installing `tegrad` on Linux + +`install.sh` sets up `tegrad` as an unprivileged systemd service with isolated Minecraft server units and LAN network isolation enabled by default. + +## Requirements + +- Linux (`x86_64` or `aarch64`) +- `systemd` running as PID 1 +- `polkit` with JavaScript rules support (`/etc/polkit-1/rules.d`) +- `sudo` (or root) for the initial installation + +## Install or update + +From a release tag (downloads the binary and verifies `SHA256SUMS`): + +```sh +./install/install.sh --version v0.1.0 +``` + +From a locally built binary: + +```sh +./install/install.sh --binary ./dist/tegrad +``` + +Optional flags: + +- `--api-url https://...`: writes `api_url` to `/var/lib/tegrad/config.json` (otherwise created once with `https://api.tegramc.com` and preserved on updates). +- `--allow-lan `: allows a private/LAN CIDR in the server network drop-in (can be repeated). + +The installer is idempotent: re-running it updates the binary, units, polkit rule, and network drop-in without resetting `/var/lib/tegrad`. + +After installation, link the agent and verify the setup: + +```sh +tegrad link +tegrad doctor +``` + +## Network isolation and LAN access + +By default, `/etc/systemd/system/tegrad-server@.service.d/10-network.conf` denies private, link-local, CGNAT, and loopback address ranges (`IPAddressDeny`) on `tegrad-server@.service`, and only allows private/loopback DNS resolvers detected on the host. + +- **LAN players are blocked by default**: systemd's `IPAddressDeny` applies to both inbound and outbound traffic on the server's sockets. If players on your local network need to connect directly, pass `--allow-lan ` (for example `--allow-lan 192.168.1.0/24`). +- **Changing DNS resolvers later**: if the host's DNS configuration changes after installation, re-run `install.sh` (with your previous flags) to regenerate `10-network.conf` and reload systemd. + +## Uninstall + +Remove services, units, polkit rule, wrapper, and binary while keeping `/var/lib/tegrad`, `/var/lib/tegrad-servers`, and system users: + +```sh +./install/install.sh --uninstall +``` + +Remove everything including data and system users (prompts for `yes` unless `--yes` is passed): + +```sh +./install/install.sh --uninstall --purge +``` diff --git a/install/install.sh b/install/install.sh new file mode 100755 index 0000000..f8b4ca5 --- /dev/null +++ b/install/install.sh @@ -0,0 +1,939 @@ +#!/bin/sh +# SPDX-License-Identifier: AGPL-3.0-only +# Copyright (C) 2026 Antônio Miranda +# +# Idempotent POSIX sh installer for tegrad (Tegra Agent). + +set -eu + +TEGRAD_USER="tegrad" +TEGRAD_GROUP="tegrad" +TEGRAD_SRV_USER="tegrad-srv" +TEGRAD_SRV_GROUP="tegrad-srv" + +TEGRAD_BIN_DIR="/opt/tegrad/bin" +TEGRAD_BIN="/opt/tegrad/bin/tegrad" +TEGRAD_WRAPPER="/usr/local/bin/tegrad" +TEGRAD_STATE_DIR="/var/lib/tegrad" +TEGRAD_CONFIG_FILE="/var/lib/tegrad/config.json" +TEGRAD_SERVERS_DIR="/var/lib/tegrad-servers" +TEGRAD_RUN_DIR="/run/tegrad-server" + +SYSTEMD_DIR="/etc/systemd/system" +DROPIN_DIR="/etc/systemd/system/tegrad-server@.service.d" +DROPIN_FILE="/etc/systemd/system/tegrad-server@.service.d/10-network.conf" +POLKIT_RULES_DIR="/etc/polkit-1/rules.d" +POLKIT_RULE_FILE="/etc/polkit-1/rules.d/50-tegrad.rules" +TMPFILES_FILE="/etc/tmpfiles.d/tegrad.conf" + +DEFAULT_API_URL="https://api.tegramc.com" +RELEASE_BASE_URL="https://github.com/codebyant/tegrad/releases/download" +NETWORK_DENY_RANGES="10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 169.254.0.0/16 100.64.0.0/10 127.0.0.0/8 fc00::/7 fe80::/10 ::1/128" + +TMP_DOWNLOAD_DIR="" + +cleanup_tmp() { + if [ -n "${TMP_DOWNLOAD_DIR:-}" ] && [ -d "${TMP_DOWNLOAD_DIR}" ]; then + rm -rf -- "${TMP_DOWNLOAD_DIR:?}" + fi +} + +log_info() { + printf '%s\n' "$1" +} + +log_err() { + printf 'Error: %s\n' "$1" >&2 +} + +die() { + log_err "$1" + exit 1 +} + +usage() { + cat <<'EOF' +Usage: install.sh [options] + +Install or update tegrad (idempotent): + --binary Install a local tegrad binary + --version Download release binary and verify SHA256SUMS + --api-url Write api_url to /var/lib/tegrad/config.json (must be https://) + --allow-lan Allow a LAN CIDR in IPAddressAllow (repeatable) + +Uninstall: + --uninstall Stop services and remove units, polkit rule, wrapper, and binary + --purge With --uninstall, also remove state, servers, and system users + --yes Skip interactive confirmation for --purge + +Other: + -h, --help Show this help message +EOF +} + +is_uint_no_leading_zero() { + _u_val="$1" + case "$_u_val" in + "") return 1 ;; + 0) return 0 ;; + 0*) return 1 ;; + *[!0-9]*) return 1 ;; + *) return 0 ;; + esac +} + +is_valid_ipv4() { + _v4_in="$1" + case "$_v4_in" in + ""|.*|*.|*..*|*[!0-9.]*) return 1 ;; + esac + + _v4_rest="$_v4_in" + _v4_count=0 + while :; do + _v4_count=$((_v4_count + 1)) + case "$_v4_rest" in + *.*) + _v4_oct="${_v4_rest%%.*}" + _v4_rest="${_v4_rest#*.}" + ;; + *) + _v4_oct="$_v4_rest" + _v4_rest="" + ;; + esac + + if ! is_uint_no_leading_zero "$_v4_oct"; then + return 1 + fi + if [ "$_v4_oct" -gt 255 ]; then + return 1 + fi + + if [ -z "$_v4_rest" ]; then + break + fi + done + + [ "$_v4_count" -eq 4 ] +} + +pad_hex4_lower() { + _p_in=$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]') + while [ "${#_p_in}" -lt 4 ]; do + _p_in="0${_p_in}" + done + printf '%s' "$_p_in" +} + +is_valid_ipv6() { + _v6_in="$1" + case "$_v6_in" in + ""|*[!0-9a-fA-F:]*) return 1 ;; + *:*) ;; + *) return 1 ;; + esac + # Reject triple colons + case "$_v6_in" in + *:::* ) return 1 ;; + esac + # Reject leading or trailing single colon + case "$_v6_in" in + :*) + case "$_v6_in" in + ::*) ;; + *) return 1 ;; + esac + ;; + esac + case "$_v6_in" in + *:) + case "$_v6_in" in + *::) ;; + *) return 1 ;; + esac + ;; + esac + + # Check for :: compression (at most one occurrence) + _v6_has_dc=0 + case "$_v6_in" in + *::*) + _v6_has_dc=1 + _v6_left="${_v6_in%%::*}" + _v6_right="${_v6_in#*::}" + case "$_v6_right" in + *::*) return 1 ;; + esac + ;; + *) + _v6_left="$_v6_in" + _v6_right="" + ;; + esac + + _v6_groups=0 + for _v6_side in "$_v6_left" "$_v6_right"; do + if [ -z "$_v6_side" ]; then + continue + fi + _v6_rem="$_v6_side" + while :; do + case "$_v6_rem" in + *:*) + _v6_grp="${_v6_rem%%:*}" + _v6_rem="${_v6_rem#*:}" + ;; + *) + _v6_grp="$_v6_rem" + _v6_rem="" + ;; + esac + if [ -z "$_v6_grp" ] || [ "${#_v6_grp}" -gt 4 ]; then + return 1 + fi + _v6_groups=$((_v6_groups + 1)) + if [ -z "$_v6_rem" ]; then + break + fi + done + done + + if [ "$_v6_has_dc" -eq 1 ]; then + [ "$_v6_groups" -lt 8 ] + else + [ "$_v6_groups" -eq 8 ] + fi +} + +is_valid_ip() { + if is_valid_ipv4 "$1"; then + return 0 + fi + if is_valid_ipv6 "$1"; then + return 0 + fi + return 1 +} + +is_valid_cidr() { + _c_in="$1" + case "$_c_in" in + */*) ;; + *) return 1 ;; + esac + _c_addr="${_c_in%%/*}" + _c_prefix="${_c_in#*/}" + case "$_c_prefix" in + */*) return 1 ;; + esac + if ! is_uint_no_leading_zero "$_c_prefix"; then + return 1 + fi + if is_valid_ipv4 "$_c_addr"; then + [ "$_c_prefix" -le 32 ] + return $? + fi + if is_valid_ipv6 "$_c_addr"; then + [ "$_c_prefix" -le 128 ] + return $? + fi + return 1 +} + +expand_ipv6_groups() { + _e_in="$1" + _e_left="" + _e_right="" + _e_has_dc=0 + case "$_e_in" in + *::*) + _e_has_dc=1 + _e_left="${_e_in%%::*}" + _e_right="${_e_in#*::}" + ;; + *) + _e_left="$_e_in" + ;; + esac + + _e_lcount=0 + _e_lout="" + if [ -n "$_e_left" ]; then + _e_rem="$_e_left" + while :; do + case "$_e_rem" in + *:*) _e_g="${_e_rem%%:*}"; _e_rem="${_e_rem#*:}" ;; + *) _e_g="$_e_rem"; _e_rem="" ;; + esac + _e_p=$(pad_hex4_lower "$_e_g") + _e_lout="${_e_lout}${_e_lout:+:}${_e_p}" + _e_lcount=$((_e_lcount + 1)) + [ -z "$_e_rem" ] && break + done + fi + + _e_rcount=0 + _e_rout="" + if [ -n "$_e_right" ]; then + _e_rem="$_e_right" + while :; do + case "$_e_rem" in + *:*) _e_g="${_e_rem%%:*}"; _e_rem="${_e_rem#*:}" ;; + *) _e_g="$_e_rem"; _e_rem="" ;; + esac + _e_p=$(pad_hex4_lower "$_e_g") + _e_rout="${_e_rout}${_e_rout:+:}${_e_p}" + _e_rcount=$((_e_rcount + 1)) + [ -z "$_e_rem" ] && break + done + fi + + _e_mout="" + if [ "$_e_has_dc" -eq 1 ]; then + _e_zeros=$((8 - _e_lcount - _e_rcount)) + while [ "$_e_zeros" -gt 0 ]; do + _e_mout="${_e_mout}${_e_mout:+:}0000" + _e_zeros=$((_e_zeros - 1)) + done + fi + + _e_full="$_e_lout" + if [ -n "$_e_mout" ]; then + _e_full="${_e_full}${_e_full:+:}${_e_mout}" + fi + if [ -n "$_e_rout" ]; then + _e_full="${_e_full}${_e_full:+:}${_e_rout}" + fi + printf '%s' "$_e_full" +} + +is_private_or_loopback_ip() { + _p_ip="$1" + if is_valid_ipv4 "$_p_ip"; then + _p_a="${_p_ip%%.*}" + _p_rest="${_p_ip#*.}" + _p_b="${_p_rest%%.*}" + # 10.0.0.0/8 + [ "$_p_a" -eq 10 ] && return 0 + # 127.0.0.0/8 + [ "$_p_a" -eq 127 ] && return 0 + # 169.254.0.0/16 + [ "$_p_a" -eq 169 ] && [ "$_p_b" -eq 254 ] && return 0 + # 172.16.0.0/12 + [ "$_p_a" -eq 172 ] && [ "$_p_b" -ge 16 ] && [ "$_p_b" -le 31 ] && return 0 + # 192.168.0.0/16 + [ "$_p_a" -eq 192 ] && [ "$_p_b" -eq 168 ] && return 0 + # 100.64.0.0/10 + [ "$_p_a" -eq 100 ] && [ "$_p_b" -ge 64 ] && [ "$_p_b" -le 127 ] && return 0 + return 1 + fi + + if is_valid_ipv6 "$_p_ip"; then + _p_exp=$(expand_ipv6_groups "$_p_ip") + # ::1/128 + if [ "$_p_exp" = "0000:0000:0000:0000:0000:0000:0000:0001" ]; then + return 0 + fi + _p_first="${_p_exp%%:*}" + # fc00::/7 (fc00..fdff) and fe80::/10 (fe80..febf) + case "$_p_first" in + fc*|fd*|fe8*|fe9*|fea*|feb*) return 0 ;; + esac + return 1 + fi + + return 1 +} + +parse_resolv_conf_file() { + _rc_file="$1" + if [ ! -r "$_rc_file" ]; then + return 0 + fi + while IFS= read -r _rc_line || [ -n "$_rc_line" ]; do + # Strip comments + _rc_clean="${_rc_line%%#*}" + _rc_clean="${_rc_clean%%;*}" + # Normalize tabs to spaces + _rc_clean=$(printf '%s' "$_rc_clean" | tr '\t' ' ') + # Trim leading spaces + while [ "${_rc_clean# }" != "$_rc_clean" ]; do + _rc_clean="${_rc_clean# }" + done + case "$_rc_clean" in + nameserver\ *) + _rc_rest="${_rc_clean#nameserver }" + while [ "${_rc_rest# }" != "$_rc_rest" ]; do + _rc_rest="${_rc_rest# }" + done + _rc_addr="${_rc_rest%% *}" + if is_valid_ip "$_rc_addr"; then + printf '%s\n' "$_rc_addr" + fi + ;; + esac + done < "$_rc_file" +} + +collect_resolvers() { + _cr_primary="${1:-/etc/resolv.conf}" + _cr_systemd="${2:-/run/systemd/resolve/resolv.conf}" + _cr_list="" + _cr_has_stub=0 + + if [ -r "$_cr_primary" ]; then + _cr_list=$(parse_resolv_conf_file "$_cr_primary") + fi + + # shellcheck disable=SC2086 -- intentional word splitting on validated IP list + for _cr_ip in $_cr_list; do + if [ "$_cr_ip" = "127.0.0.53" ] || [ "$_cr_ip" = "127.0.0.54" ]; then + _cr_has_stub=1 + break + fi + done + + if [ "$_cr_has_stub" -eq 1 ] && [ -r "$_cr_systemd" ]; then + _cr_extra=$(parse_resolv_conf_file "$_cr_systemd") + if [ -n "$_cr_extra" ]; then + _cr_list="${_cr_list}${_cr_list:+ +}${_cr_extra}" + fi + fi + + printf '%s' "$_cr_list" +} + +append_unique_token() { + _au_list="$1" + _au_tok="$2" + case " $_au_list " in + *" $_au_tok "*) printf '%s' "$_au_list" ;; + *) printf '%s' "${_au_list}${_au_list:+ }${_au_tok}" ;; + esac +} + +render_network_dropin() { + _rd_resolvers="$1" + _rd_allow_lan="$2" + _rd_allow="" + + # shellcheck disable=SC2086 -- intentional word splitting on validated IP list + for _rd_ip in $_rd_resolvers; do + if is_valid_ip "$_rd_ip" && is_private_or_loopback_ip "$_rd_ip"; then + _rd_allow=$(append_unique_token "$_rd_allow" "$_rd_ip") + fi + done + + # shellcheck disable=SC2086 -- intentional word splitting on validated CIDR list + for _rd_cidr in $_rd_allow_lan; do + if is_valid_cidr "$_rd_cidr"; then + _rd_allow=$(append_unique_token "$_rd_allow" "$_rd_cidr") + fi + done + + printf '# SPDX-License-Identifier: AGPL-3.0-only\n' + printf '# Copyright (C) 2026 Antônio Miranda \n' + printf '# Generated by tegrad installer. Re-run installer to refresh DNS resolvers.\n' + printf '\n' + printf '[Service]\n' + printf 'IPAddressDeny=%s\n' "$NETWORK_DENY_RANGES" + if [ -n "$_rd_allow" ]; then + printf 'IPAddressAllow=%s\n' "$_rd_allow" + fi +} + +validate_api_url() { + _au_url="$1" + case "$_au_url" in + https://*) ;; + *) die "--api-url must start with https://" ;; + esac + # Reject whitespace, quotes, backslashes, or embedded credentials + case "$_au_url" in + *[[:space:]]*|*\"*|*\\*|*@*) + die "--api-url contains forbidden characters or embedded credentials" + ;; + esac + _au_rest="${_au_url#https://}" + if [ -z "$_au_rest" ] || [ "${_au_rest#/}" != "$_au_rest" ]; then + die "--api-url must include a valid host" + fi +} + +validate_version() { + _ver="$1" + case "$_ver" in + v[0-9]*) ;; + *) die "--version must look like vX.Y.Z (got '$_ver')" ;; + esac + case "$_ver" in + *..*|*/*|*[!0-9A-Za-z._-]*) + die "--version contains invalid characters" + ;; + esac +} + +detect_arch() { + _arch=$(uname -m) + case "$_arch" in + x86_64) printf 'x64' ;; + aarch64) printf 'arm64' ;; + *) die "Unsupported architecture: $_arch (supported: x86_64, aarch64)" ;; + esac +} + +check_environment() { + _os=$(uname -s) + if [ "$_os" != "Linux" ]; then + die "tegrad installer only supports Linux (detected: $_os)" + fi + + detect_arch >/dev/null + + if [ ! -d /run/systemd/system ] || ! command -v systemctl >/dev/null 2>&1; then + die "systemd must be running as PID 1" + fi + + if [ ! -d "$POLKIT_RULES_DIR" ] \ + && ! command -v polkitd >/dev/null 2>&1 \ + && [ ! -x /usr/lib/polkit-1/polkitd ] \ + && [ ! -x /usr/libexec/polkitd ]; then + die "polkit with JavaScript rules support ($POLKIT_RULES_DIR) is required. Install polkit (e.g. 'polkitd') and re-run." + fi + + if [ "$(id -u)" -ne 0 ] && ! command -v sudo >/dev/null 2>&1; then + die "Root privileges or 'sudo' are required" + fi +} + +detect_nologin_shell() { + if [ -x /usr/sbin/nologin ]; then + printf '/usr/sbin/nologin' + elif [ -x /sbin/nologin ]; then + printf '/sbin/nologin' + else + printf '/bin/false' + fi +} + +download_file() { + _dl_url="$1" + _dl_out="$2" + if command -v curl >/dev/null 2>&1; then + curl -fsSL --proto '=https' --tlsv1.2 -o "$_dl_out" "$_dl_url" + elif command -v wget >/dev/null 2>&1; then + wget -q --https-only -O "$_dl_out" "$_dl_url" + else + die "Either 'curl' or 'wget' is required to download releases" + fi +} + +fetch_release_binary() { + _fr_ver="$1" + _fr_arch=$(detect_arch) + _fr_asset="tegrad-linux-${_fr_arch}" + _fr_bin_url="${RELEASE_BASE_URL}/${_fr_ver}/${_fr_asset}" + _fr_sums_url="${RELEASE_BASE_URL}/${_fr_ver}/SHA256SUMS" + + if ! command -v sha256sum >/dev/null 2>&1; then + die "'sha256sum' is required to verify release downloads" + fi + + TMP_DOWNLOAD_DIR=$(mktemp -d) + trap cleanup_tmp EXIT + + log_info "Downloading ${_fr_asset} (${_fr_ver})..." + download_file "$_fr_bin_url" "${TMP_DOWNLOAD_DIR}/${_fr_asset}" \ + || die "Failed to download ${_fr_bin_url}" + download_file "$_fr_sums_url" "${TMP_DOWNLOAD_DIR}/SHA256SUMS" \ + || die "Failed to download ${_fr_sums_url}" + + # TODO(signature): verify cryptographic signature of SHA256SUMS before trusting the checksum. + + _fr_expected="" + while IFS= read -r _fr_line || [ -n "$_fr_line" ]; do + # Standard sha256sum format: " " or " *" + _fr_hash="${_fr_line%%[[:space:]]*}" + _fr_name="${_fr_line#*[[:space:]]}" + while [ "${_fr_name# }" != "$_fr_name" ]; do + _fr_name="${_fr_name# }" + done + _fr_name="${_fr_name#\*}" + if [ "$_fr_name" = "$_fr_asset" ]; then + _fr_expected="$_fr_hash" + break + fi + done < "${TMP_DOWNLOAD_DIR}/SHA256SUMS" + + if [ -z "$_fr_expected" ]; then + die "Checksum for ${_fr_asset} not found in SHA256SUMS" + fi + + _fr_actual=$(sha256sum "${TMP_DOWNLOAD_DIR}/${_fr_asset}" | awk '{print $1}') + if [ "$_fr_actual" != "$_fr_expected" ]; then + die "SHA-256 mismatch for ${_fr_asset} (expected ${_fr_expected}, got ${_fr_actual})" + fi + + log_info "SHA-256 verified for ${_fr_asset}." + DOWNLOADED_BINARY="${TMP_DOWNLOAD_DIR}/${_fr_asset}" +} + +render_template_file() { + _rt_src="$1" + _rt_dst="$2" + _rt_mode="$3" + _rt_tmp="${_rt_dst}.tmp.$$" + + sed \ + -e "s|@TEGRAD_BIN@|${TEGRAD_BIN}|g" \ + -e "s|@TEGRAD_STATE_DIR@|${TEGRAD_STATE_DIR}|g" \ + -e "s|@TEGRAD_SERVERS_DIR@|${TEGRAD_SERVERS_DIR}|g" \ + -e "s|@TEGRAD_RUN_DIR@|${TEGRAD_RUN_DIR}|g" \ + "$_rt_src" > "$_rt_tmp" + + chown root:root "$_rt_tmp" + chmod "$_rt_mode" "$_rt_tmp" + mv -f "$_rt_tmp" "$_rt_dst" +} + +ensure_users_and_groups() { + _nl_shell=$(detect_nologin_shell) + + if ! getent group "$TEGRAD_SRV_GROUP" >/dev/null 2>&1; then + groupadd --system "$TEGRAD_SRV_GROUP" + fi + if ! id -u "$TEGRAD_SRV_USER" >/dev/null 2>&1; then + useradd --system \ + --gid "$TEGRAD_SRV_GROUP" \ + --home-dir /nonexistent \ + --no-create-home \ + --shell "$_nl_shell" \ + "$TEGRAD_SRV_USER" + fi + + if ! getent group "$TEGRAD_GROUP" >/dev/null 2>&1; then + groupadd --system "$TEGRAD_GROUP" + fi + if ! id -u "$TEGRAD_USER" >/dev/null 2>&1; then + useradd --system \ + --gid "$TEGRAD_GROUP" \ + --home-dir "$TEGRAD_STATE_DIR" \ + --no-create-home \ + --shell "$_nl_shell" \ + "$TEGRAD_USER" + fi + + # Ensure tegrad is in tegrad-srv group (to manage server files) + _tegrad_groups=" $(id -nG "$TEGRAD_USER") " + case "$_tegrad_groups" in + *" $TEGRAD_SRV_GROUP "*) ;; + *) usermod -aG "$TEGRAD_SRV_GROUP" "$TEGRAD_USER" ;; + esac + + # Ensure tegrad-srv is NOT in tegrad group + _srv_groups=" $(id -nG "$TEGRAD_SRV_USER") " + case "$_srv_groups" in + *" $TEGRAD_GROUP "*) + if command -v gpasswd >/dev/null 2>&1; then + gpasswd -d "$TEGRAD_SRV_USER" "$TEGRAD_GROUP" >/dev/null + else + die "User $TEGRAD_SRV_USER must not belong to group $TEGRAD_GROUP" + fi + ;; + esac +} + +ensure_directories() { + install -d -o root -g root -m 0755 "$TEGRAD_BIN_DIR" + install -d -o "$TEGRAD_USER" -g "$TEGRAD_GROUP" -m 0700 "$TEGRAD_STATE_DIR" + install -d -o "$TEGRAD_SRV_USER" -g "$TEGRAD_SRV_GROUP" -m 2770 "$TEGRAD_SERVERS_DIR" + chmod 2770 "$TEGRAD_SERVERS_DIR" + install -d -o root -g root -m 0755 "$DROPIN_DIR" + install -d -o root -g root -m 0755 "$POLKIT_RULES_DIR" +} + +install_wrapper() { + _wr_tmp="${TEGRAD_WRAPPER}.tmp.$$" + cat < "$_wr_tmp" +#!/bin/sh +# SPDX-License-Identifier: AGPL-3.0-only +# Copyright (C) 2026 Antônio Miranda +set -eu +if [ "\$(id -u)" -eq 0 ]; then + exec runuser -u ${TEGRAD_USER} -- ${TEGRAD_BIN} "\$@" +fi +if [ "\$(id -un)" = "${TEGRAD_USER}" ]; then + exec ${TEGRAD_BIN} "\$@" +fi +exec sudo -u ${TEGRAD_USER} -- ${TEGRAD_BIN} "\$@" +EOF + chown root:root "$_wr_tmp" + chmod 0755 "$_wr_tmp" + mv -f "$_wr_tmp" "$TEGRAD_WRAPPER" +} + +ensure_config() { + _cfg_url="$1" + _cfg_force="$2" + + if [ -f "$TEGRAD_CONFIG_FILE" ] && [ "$_cfg_force" -eq 0 ]; then + chown "${TEGRAD_USER}:${TEGRAD_GROUP}" "$TEGRAD_CONFIG_FILE" + chmod 0600 "$TEGRAD_CONFIG_FILE" + return 0 + fi + + _cfg_tmp="${TEGRAD_CONFIG_FILE}.tmp.$$" + printf '{\n "api_url": "%s"\n}\n' "$_cfg_url" > "$_cfg_tmp" + chown "${TEGRAD_USER}:${TEGRAD_GROUP}" "$_cfg_tmp" + chmod 0600 "$_cfg_tmp" + mv -f "$_cfg_tmp" "$TEGRAD_CONFIG_FILE" +} + +do_uninstall() { + _un_purge="$1" + _un_yes="$2" + + if [ "$_un_purge" -eq 1 ] && [ "$_un_yes" -ne 1 ]; then + printf 'WARNING: --purge will permanently delete %s, %s, and users %s/%s.\n' \ + "$TEGRAD_STATE_DIR" "$TEGRAD_SERVERS_DIR" "$TEGRAD_USER" "$TEGRAD_SRV_USER" + printf 'Type "yes" to confirm: ' + if ! IFS= read -r _un_confirm; then + die "Aborted." + fi + if [ "$_un_confirm" != "yes" ]; then + die "Confirmation did not match 'yes'. Aborted." + fi + fi + + log_info "Stopping tegrad services..." + systemctl disable --now tegrad.service >/dev/null 2>&1 || true + + # Stop any running server template instances + _un_units=$(systemctl list-units --all --no-legend --plain 'tegrad-server@*' 2>/dev/null | awk '{print $1}' || true) + # shellcheck disable=SC2086 -- intentional word splitting on unit names from systemctl + for _un_u in $_un_units; do + systemctl stop "$_un_u" >/dev/null 2>&1 || true + done + + rm -f -- \ + "${SYSTEMD_DIR}/tegrad.service" \ + "${SYSTEMD_DIR}/tegrad-server@.service" \ + "${SYSTEMD_DIR}/tegrad-server@.socket" \ + "${DROPIN_FILE}" \ + "${POLKIT_RULE_FILE}" \ + "${TMPFILES_FILE}" \ + "${TEGRAD_WRAPPER}" \ + "${TEGRAD_BIN}" + + rmdir "$DROPIN_DIR" 2>/dev/null || true + rmdir "$TEGRAD_BIN_DIR" 2>/dev/null || true + rmdir /opt/tegrad 2>/dev/null || true + + systemctl daemon-reload >/dev/null 2>&1 || true + + if [ "$_un_purge" -eq 1 ]; then + log_info "Purging data directories and system users..." + rm -rf -- "${TEGRAD_STATE_DIR:?}" + rm -rf -- "${TEGRAD_SERVERS_DIR:?}" + rm -rf -- "${TEGRAD_RUN_DIR:?}" + if id -u "$TEGRAD_USER" >/dev/null 2>&1; then + userdel "$TEGRAD_USER" 2>/dev/null || true + fi + if id -u "$TEGRAD_SRV_USER" >/dev/null 2>&1; then + userdel "$TEGRAD_SRV_USER" 2>/dev/null || true + fi + if getent group "$TEGRAD_GROUP" >/dev/null 2>&1; then + groupdel "$TEGRAD_GROUP" 2>/dev/null || true + fi + if getent group "$TEGRAD_SRV_GROUP" >/dev/null 2>&1; then + groupdel "$TEGRAD_SRV_GROUP" 2>/dev/null || true + fi + log_info "tegrad uninstalled and purged." + else + log_info "tegrad uninstalled. Data in ${TEGRAD_STATE_DIR} and ${TEGRAD_SERVERS_DIR} and system users were preserved." + fi +} + +main() { + OPT_BINARY="" + OPT_VERSION="" + OPT_API_URL="" + OPT_ALLOW_LAN="" + OPT_UNINSTALL=0 + OPT_PURGE=0 + OPT_YES=0 + + # Save original args for potential single sudo re-exec + while [ "$#" -gt 0 ]; do + case "$1" in + --binary) + [ "$#" -ge 2 ] || die "--binary requires a path" + OPT_BINARY="$2" + shift 2 + ;; + --version) + [ "$#" -ge 2 ] || die "--version requires a version tag (e.g. v0.1.0)" + OPT_VERSION="$2" + shift 2 + ;; + --api-url) + [ "$#" -ge 2 ] || die "--api-url requires a URL" + OPT_API_URL="$2" + shift 2 + ;; + --allow-lan) + [ "$#" -ge 2 ] || die "--allow-lan requires a CIDR" + if ! is_valid_cidr "$2"; then + die "Invalid CIDR for --allow-lan: $2" + fi + OPT_ALLOW_LAN=$(append_unique_token "$OPT_ALLOW_LAN" "$2") + shift 2 + ;; + --uninstall) + OPT_UNINSTALL=1 + shift + ;; + --purge) + OPT_PURGE=1 + shift + ;; + --yes) + OPT_YES=1 + shift + ;; + -h|--help) + usage + exit 0 + ;; + *) + die "Unknown argument: $1 (use --help for usage)" + ;; + esac + done + + if [ "$OPT_PURGE" -eq 1 ] && [ "$OPT_UNINSTALL" -ne 1 ]; then + die "--purge can only be used together with --uninstall" + fi + + if [ "$OPT_UNINSTALL" -eq 0 ]; then + if [ -n "$OPT_BINARY" ] && [ -n "$OPT_VERSION" ]; then + die "Cannot specify both --binary and --version" + fi + if [ -z "$OPT_BINARY" ] && [ -z "$OPT_VERSION" ]; then + die "Specify either --binary or --version " + fi + if [ -n "$OPT_BINARY" ] && [ ! -f "$OPT_BINARY" ]; then + die "Binary not found: $OPT_BINARY" + fi + if [ -n "$OPT_VERSION" ]; then + validate_version "$OPT_VERSION" + fi + if [ -n "$OPT_API_URL" ]; then + validate_api_url "$OPT_API_URL" + fi + fi + + # Pre-flight checks before changing anything or escalating privileges + check_environment + + # Single sudo elevation if not root + if [ "$(id -u)" -ne 0 ]; then + if [ "$OPT_UNINSTALL" -eq 1 ]; then + log_info "Root privileges are required to uninstall tegrad (stopping services and removing system files)." + else + log_info "Root privileges are required to install tegrad. This script will:" + log_info " - Create system users/groups: ${TEGRAD_USER}, ${TEGRAD_SRV_USER}" + log_info " - Create directories: ${TEGRAD_BIN_DIR}, ${TEGRAD_STATE_DIR} (0700), ${TEGRAD_SERVERS_DIR} (2770)" + log_info " - Install binary (${TEGRAD_BIN}), wrapper (${TEGRAD_WRAPPER}), systemd units, tmpfiles.d, polkit rule, and network drop-in" + log_info " - Reload systemd and enable/start tegrad.service" + fi + # Re-exec with sudo using parsed flags + set -- + [ -n "$OPT_BINARY" ] && set -- "$@" --binary "$OPT_BINARY" + [ -n "$OPT_VERSION" ] && set -- "$@" --version "$OPT_VERSION" + [ -n "$OPT_API_URL" ] && set -- "$@" --api-url "$OPT_API_URL" + # shellcheck disable=SC2086 -- intentional word splitting on validated CIDR list + for _lan_c in $OPT_ALLOW_LAN; do + set -- "$@" --allow-lan "$_lan_c" + done + [ "$OPT_UNINSTALL" -eq 1 ] && set -- "$@" --uninstall + [ "$OPT_PURGE" -eq 1 ] && set -- "$@" --purge + [ "$OPT_YES" -eq 1 ] && set -- "$@" --yes + exec sudo -- "$0" "$@" + fi + + if [ "$OPT_UNINSTALL" -eq 1 ]; then + do_uninstall "$OPT_PURGE" "$OPT_YES" + exit 0 + fi + + SCRIPT_DIR=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd) + for _req_file in \ + "${SCRIPT_DIR}/units/tegrad.service" \ + "${SCRIPT_DIR}/units/tegrad-server@.service" \ + "${SCRIPT_DIR}/units/tegrad-server@.socket" \ + "${SCRIPT_DIR}/tmpfiles/tegrad.conf" \ + "${SCRIPT_DIR}/polkit/50-tegrad.rules"; do + if [ ! -f "$_req_file" ]; then + die "Missing installer asset: $_req_file" + fi + done + + BINARY_SRC="$OPT_BINARY" + if [ -n "$OPT_VERSION" ]; then + DOWNLOADED_BINARY="" + fetch_release_binary "$OPT_VERSION" + BINARY_SRC="$DOWNLOADED_BINARY" + fi + + log_info "Configuring system users and groups..." + ensure_users_and_groups + + log_info "Configuring directories..." + ensure_directories + + log_info "Installing tegrad binary and wrapper..." + _bin_tmp="${TEGRAD_BIN}.tmp.$$" + install -o root -g root -m 0755 "$BINARY_SRC" "$_bin_tmp" + mv -f "$_bin_tmp" "$TEGRAD_BIN" + install_wrapper + + if [ -n "$OPT_API_URL" ]; then + ensure_config "$OPT_API_URL" 1 + else + ensure_config "$DEFAULT_API_URL" 0 + fi + + log_info "Installing systemd units, tmpfiles.d, and polkit rule..." + render_template_file "${SCRIPT_DIR}/units/tegrad.service" "${SYSTEMD_DIR}/tegrad.service" 0644 + render_template_file "${SCRIPT_DIR}/units/tegrad-server@.service" "${SYSTEMD_DIR}/tegrad-server@.service" 0644 + render_template_file "${SCRIPT_DIR}/units/tegrad-server@.socket" "${SYSTEMD_DIR}/tegrad-server@.socket" 0644 + render_template_file "${SCRIPT_DIR}/tmpfiles/tegrad.conf" "${TMPFILES_FILE}" 0644 + render_template_file "${SCRIPT_DIR}/polkit/50-tegrad.rules" "${POLKIT_RULE_FILE}" 0644 + + if command -v systemd-tmpfiles >/dev/null 2>&1; then + systemd-tmpfiles --create "$TMPFILES_FILE" + else + install -d -o root -g "$TEGRAD_GROUP" -m 0750 "$TEGRAD_RUN_DIR" + fi + + log_info "Generating network isolation drop-in..." + _resolvers=$(collect_resolvers /etc/resolv.conf /run/systemd/resolve/resolv.conf) + _dropin_tmp="${DROPIN_FILE}.tmp.$$" + render_network_dropin "$_resolvers" "$OPT_ALLOW_LAN" > "$_dropin_tmp" + chown root:root "$_dropin_tmp" + chmod 0644 "$_dropin_tmp" + mv -f "$_dropin_tmp" "$DROPIN_FILE" + + log_info "Reloading systemd and starting tegrad.service..." + systemctl daemon-reload + systemctl enable --now tegrad.service + + log_info "Pronto. Agora, para vincular este servidor, rode \`tegrad link\`." +} + +if [ "${TEGRAD_INSTALL_SOURCE_ONLY:-0}" != "1" ]; then + main "$@" +fi diff --git a/install/polkit/50-tegrad.rules b/install/polkit/50-tegrad.rules new file mode 100644 index 0000000..70e9548 --- /dev/null +++ b/install/polkit/50-tegrad.rules @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +// Restrict tegrad to managing only Minecraft server template units. +// Granting org.freedesktop.systemd1.manage-units on arbitrary units +// would allow manipulating privileged services and would be equivalent to root. +polkit.addRule(function(action, subject) { + if ( + action.id === "org.freedesktop.systemd1.manage-units" && + subject.user === "tegrad" + ) { + var unit = action.lookup("unit"); + if ( + typeof unit === "string" && + /^tegrad-server@[a-z0-9][a-z0-9-]{0,62}\.(service|socket)$/.test(unit) + ) { + return polkit.Result.YES; + } + } + return polkit.Result.NOT_HANDLED; +}); diff --git a/install/tmpfiles/tegrad.conf b/install/tmpfiles/tegrad.conf new file mode 100644 index 0000000..6163900 --- /dev/null +++ b/install/tmpfiles/tegrad.conf @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: AGPL-3.0-only +# Copyright (C) 2026 Antônio Miranda + +# Runtime directory for Minecraft server console FIFOs. +# Owned by root:tegrad (0750) so tegrad can write to FIFOs while tegrad-srv +# cannot list the directory. +d @TEGRAD_RUN_DIR@ 0750 root tegrad - diff --git a/install/units/tegrad-server@.service b/install/units/tegrad-server@.service new file mode 100644 index 0000000..a2755b2 --- /dev/null +++ b/install/units/tegrad-server@.service @@ -0,0 +1,52 @@ +# SPDX-License-Identifier: AGPL-3.0-only +# Copyright (C) 2026 Antônio Miranda + +[Unit] +Description=Tegra Minecraft Server (%i) +Requires=tegrad-server@%i.socket +After=network-online.target tegrad-server@%i.socket +Wants=network-online.target + +[Service] +Type=simple +User=tegrad-srv +Group=tegrad-srv +WorkingDirectory=@TEGRAD_SERVERS_DIR@/%i +ExecStart=@TEGRAD_SERVERS_DIR@/%i/start.sh +Restart=no +KillSignal=SIGINT +TimeoutStopSec=60 +StandardInput=socket +StandardOutput=append:@TEGRAD_SERVERS_DIR@/%i/logs/console.log +StandardError=append:@TEGRAD_SERVERS_DIR@/%i/logs/console.log + +# Sandbox: Minecraft mods are untrusted Java code. +# A server cannot read @TEGRAD_STATE_DIR@: enforced by 0700 tegrad:tegrad ownership +# (tegrad-srv is not in the tegrad group) and by ProtectSystem=strict with +# ReadWritePaths scoped strictly to this server's directory. +# MemoryDenyWriteExecute is intentionally omitted because the JVM JIT requires +# executable memory mappings. PrivateNetwork is intentionally omitted because +# the server needs network access; LAN isolation is applied via 10-network.conf. +# Per-server CPU and memory limits are applied dynamically via systemctl set-property. +NoNewPrivileges=yes +ProtectSystem=strict +ReadWritePaths=@TEGRAD_SERVERS_DIR@/%i +ProtectHome=yes +PrivateTmp=yes +PrivateDevices=yes +ProtectKernelTunables=yes +ProtectKernelModules=yes +ProtectKernelLogs=yes +ProtectControlGroups=yes +ProtectProc=invisible +ProcSubset=pid +RestrictSUIDSGID=yes +RestrictNamespaces=yes +RestrictRealtime=yes +LockPersonality=yes +CapabilityBoundingSet= +RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX +SystemCallFilter=@system-service +SystemCallErrorNumber=EPERM +SystemCallArchitectures=native +UMask=0007 diff --git a/install/units/tegrad-server@.socket b/install/units/tegrad-server@.socket new file mode 100644 index 0000000..5fc1f6e --- /dev/null +++ b/install/units/tegrad-server@.socket @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: AGPL-3.0-only +# Copyright (C) 2026 Antônio Miranda + +[Unit] +Description=Tegra Minecraft Server Console FIFO (%i) +PartOf=tegrad-server@%i.service + +[Socket] +# @TEGRAD_RUN_DIR@ is owned by root:tegrad with mode 0750 (via tmpfiles.d), +# so the agent can write console commands to the FIFO while tegrad-srv cannot +# list the directory. The server process does not need directory traversal: +# systemd opens the FIFO itself and passes the fd to tegrad-server@%i.service +# as StandardInput=socket. +ListenFIFO=@TEGRAD_RUN_DIR@/%i.stdin +SocketMode=0660 +SocketUser=tegrad-srv +SocketGroup=tegrad +RemoveOnStop=yes diff --git a/install/units/tegrad.service b/install/units/tegrad.service new file mode 100644 index 0000000..d4f0168 --- /dev/null +++ b/install/units/tegrad.service @@ -0,0 +1,42 @@ +# SPDX-License-Identifier: AGPL-3.0-only +# Copyright (C) 2026 Antônio Miranda + +[Unit] +Description=Tegra Agent +After=network-online.target systemd-tmpfiles-setup.service +Wants=network-online.target + +[Service] +Type=simple +User=tegrad +Group=tegrad +ExecStart=@TEGRAD_BIN@ run +Environment=TEGRAD_STATE_DIR=@TEGRAD_STATE_DIR@ +Restart=always +RestartSec=5 +RestartSteps=5 +RestartMaxDelaySec=60 + +# Sandbox: the agent never runs as root and has no Linux capabilities. +# ProtectSystem=strict mounts the filesystem read-only except ReadWritePaths, +# while AF_UNIX remains allowed so tegrad can connect to the system D-Bus socket +# (/run/dbus/system_bus_socket) to manage tegrad-server@ units under polkit rules. +NoNewPrivileges=yes +ProtectSystem=strict +ReadWritePaths=@TEGRAD_STATE_DIR@ @TEGRAD_SERVERS_DIR@ @TEGRAD_RUN_DIR@ +ProtectHome=yes +PrivateTmp=yes +PrivateDevices=yes +ProtectKernelTunables=yes +ProtectKernelModules=yes +ProtectControlGroups=yes +RestrictSUIDSGID=yes +RestrictNamespaces=yes +LockPersonality=yes +CapabilityBoundingSet= +RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX +SystemCallArchitectures=native +UMask=0077 + +[Install] +WantedBy=multi-user.target diff --git a/src/agent/exec.test.ts b/src/agent/exec.test.ts new file mode 100644 index 0000000..6bcfae5 --- /dev/null +++ b/src/agent/exec.test.ts @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { describe, expect, test } from "bun:test"; +import { runFixed } from "./exec"; + +describe("runFixed", () => { + test("executes a portable command with argv array and returns stdout", async () => { + const res = await runFixed(process.execPath, ["--version"]); + expect(res.code).toBe(0); + expect(res.timedOut).toBe(false); + expect(res.truncated).toBe(false); + expect(res.stdout.trim()).toMatch(/^\d+\.\d+\.\d+/); + }); + + test("does not pass arguments through a shell", async () => { + const marker = "$(echo shell-executed); echo injected"; + const res = await runFixed(process.execPath, [ + "-e", + "process.stdout.write(process.argv[1])", + marker, + ]); + expect(res.code).toBe(0); + expect(res.stdout).toBe(marker); + }); + + test("returns non-zero exit code and stderr when command fails", async () => { + const res = await runFixed(process.execPath, [ + "-e", + 'process.stderr.write("boom"); process.exit(7);', + ]); + expect(res.code).toBe(7); + expect(res.stderr).toBe("boom"); + expect(res.timedOut).toBe(false); + }); + + test("enforces maxOutputBytes cap on stdout", async () => { + const res = await runFixed( + process.execPath, + ["-e", 'process.stdout.write("A".repeat(4096));'], + { maxOutputBytes: 128 }, + ); + expect(res.truncated).toBe(true); + expect(Buffer.byteLength(res.stdout, "utf8")).toBeLessThanOrEqual(128); + }); + + test("enforces timeoutMs and kills long-running child process", async () => { + const res = await runFixed(process.execPath, ["-e", "setTimeout(() => {}, 10000);"], { + timeoutMs: 150, + }); + expect(res.timedOut).toBe(true); + expect(res.code).toBe(-1); + }); +}); diff --git a/src/agent/exec.ts b/src/agent/exec.ts new file mode 100644 index 0000000..4e6f00e --- /dev/null +++ b/src/agent/exec.ts @@ -0,0 +1,154 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; + +export const DEFAULT_EXEC_TIMEOUT_MS = 10_000; +export const DEFAULT_EXEC_MAX_OUTPUT_BYTES = 64 * 1024; + +export interface RunFixedOptions { + readonly timeoutMs?: number; + readonly maxOutputBytes?: number; +} + +export interface RunFixedResult { + readonly code: number; + readonly stdout: string; + readonly stderr: string; + readonly timedOut: boolean; + readonly truncated: boolean; +} + +const commandSchema = z.string().min(1); +const argsSchema = z.array(z.string()); +const optionsSchema = z.object({ + timeoutMs: z.number().int().positive().optional(), + maxOutputBytes: z.number().int().positive().optional(), +}); + +function buildMinimalEnv(platform: NodeJS.Platform = process.platform): Record { + if (platform === "win32") { + const env: Record = {}; + if (process.env.PATH !== undefined) { + env.PATH = process.env.PATH; + } else if (process.env.Path !== undefined) { + env.PATH = process.env.Path; + } + if (process.env.SystemRoot !== undefined) { + env.SystemRoot = process.env.SystemRoot; + } + return env; + } + + return { + PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", + LC_ALL: "C", + }; +} + +async function readStreamCapped( + stream: ReadableStream | null, + maxBytes: number, +): Promise<{ readonly text: string; readonly truncated: boolean }> { + if (stream === null) { + return { text: "", truncated: false }; + } + + const reader = stream.getReader(); + const chunks: Uint8Array[] = []; + let totalBytes = 0; + let truncated = false; + + try { + while (true) { + const { value, done } = await reader.read(); + if (done) { + break; + } + if (value === undefined || value.byteLength === 0) { + continue; + } + if (totalBytes + value.byteLength <= maxBytes) { + chunks.push(value); + totalBytes += value.byteLength; + } else { + const remaining = maxBytes - totalBytes; + if (remaining > 0) { + chunks.push(value.subarray(0, remaining)); + totalBytes += remaining; + } + truncated = true; + await reader.cancel(); + break; + } + } + } catch { + // Stream may abort when process is killed on timeout + } finally { + reader.releaseLock(); + } + + const combined = new Uint8Array(totalBytes); + let offset = 0; + for (const chunk of chunks) { + combined.set(chunk, offset); + offset += chunk.byteLength; + } + + return { + text: new TextDecoder().decode(combined), + truncated, + }; +} + +/** + * Executes a fixed external command with argv array (never via a shell), + * minimal environment, strict timeout, and capped stdout/stderr buffers. + */ +export async function runFixed( + command: string, + args: readonly string[], + options: RunFixedOptions = {}, +): Promise { + const validCommand = commandSchema.parse(command); + const validArgs = argsSchema.parse(args); + const validOptions = optionsSchema.parse(options); + + const timeoutMs = validOptions.timeoutMs ?? DEFAULT_EXEC_TIMEOUT_MS; + const maxOutputBytes = validOptions.maxOutputBytes ?? DEFAULT_EXEC_MAX_OUTPUT_BYTES; + + const proc = Bun.spawn([validCommand, ...validArgs], { + stdin: "ignore", + stdout: "pipe", + stderr: "pipe", + env: buildMinimalEnv(), + }); + + let timedOut = false; + const timer = setTimeout(() => { + timedOut = true; + try { + proc.kill(); + } catch { + // Process may have already exited + } + }, timeoutMs); + + try { + const [stdoutRes, stderrRes, exitCode] = await Promise.all([ + readStreamCapped(proc.stdout, maxOutputBytes), + readStreamCapped(proc.stderr, maxOutputBytes), + proc.exited, + ]); + + return { + code: timedOut ? -1 : exitCode, + stdout: stdoutRes.text, + stderr: stderrRes.text, + timedOut, + truncated: stdoutRes.truncated || stderrRes.truncated, + }; + } finally { + clearTimeout(timer); + } +} diff --git a/src/agent/index.ts b/src/agent/index.ts index 0a455f3..b3ebcb1 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -28,6 +28,13 @@ export { WS_READY_STATE_CONNECTING, WS_READY_STATE_OPEN, } from "./connection"; +export { + DEFAULT_EXEC_MAX_OUTPUT_BYTES, + DEFAULT_EXEC_TIMEOUT_MS, + type RunFixedOptions, + type RunFixedResult, + runFixed, +} from "./exec"; export { type CommandHandler, type CommandHandlerContext, diff --git a/src/cli/args.ts b/src/cli/args.ts index 5c9343d..23d051b 100644 --- a/src/cli/args.ts +++ b/src/cli/args.ts @@ -12,6 +12,7 @@ export type ParsedCliCommand = | { readonly kind: "run" } | { readonly kind: "status" } | { readonly kind: "identity" } + | { readonly kind: "doctor" } | { readonly kind: "link"; readonly options: LinkCliOptions } | { readonly kind: "version" } | { readonly kind: "help" } @@ -43,6 +44,10 @@ export function parseCliArgs(argv: readonly string[]): ParsedCliCommand { return { kind: "identity" }; } + if (first === "doctor" && argv.length === 1) { + return { kind: "doctor" }; + } + if (first === "link") { let add = false; let reset = false; @@ -84,6 +89,7 @@ export function formatUsage(versionLineText: string): string { " link Pair this agent with a Tegra account (--add, --reset, --yes, --allow-unverified)", " status Show local state directory, identity, config, and trust status", " identity Create the agent identity if missing and print its fingerprint", + " doctor Check Linux installation, permissions, units, polkit, and network isolation", "", "Options:", " -v, --version Print version and exit", diff --git a/src/cli/cli.test.ts b/src/cli/cli.test.ts index e178ae0..5765c8c 100644 --- a/src/cli/cli.test.ts +++ b/src/cli/cli.test.ts @@ -139,4 +139,54 @@ describe("CLI", () => { expect(res.code).toBe(1); expect(res.stderr).toContain("config.json"); }); + + test("run refuses to start as root (euid 0) unless TEGRAD_ALLOW_ROOT=1", async () => { + const dir = makeTempDir(); + let stdout = ""; + let stderr = ""; + const refused = await runCli(["run"], { + env: { TEGRAD_STATE_DIR: dir }, + geteuid: () => 0, + stdout: (t) => { + stdout += t; + }, + stderr: (t) => { + stderr += t; + }, + runAgent: async () => 0, + }); + expect(refused).toBe(1); + expect(stdout).toBe(""); + expect(stderr).toContain("root"); + + let allowedStderr = ""; + const allowed = await runCli(["run"], { + env: { TEGRAD_STATE_DIR: dir, TEGRAD_ALLOW_ROOT: "1" }, + geteuid: () => 0, + stdout: () => {}, + stderr: (t) => { + allowedStderr += t; + }, + runAgent: async () => 0, + }); + expect(allowed).toBe(0); + expect(allowedStderr).toBe(""); + }); + + test("doctor subcommand dispatches and exits 0 on non-Linux", async () => { + let stdout = ""; + let stderr = ""; + const code = await runCli(["doctor"], { + doctorOptions: { platform: "win32" }, + stdout: (t) => { + stdout += t; + }, + stderr: (t) => { + stderr += t; + }, + }); + expect(code).toBe(0); + expect(stderr).toBe(""); + expect(stdout).toContain("Linux"); + }); }); diff --git a/src/cli/doctor.test.ts b/src/cli/doctor.test.ts new file mode 100644 index 0000000..ec2d027 --- /dev/null +++ b/src/cli/doctor.test.ts @@ -0,0 +1,171 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { describe, expect, test } from "bun:test"; +import { getStatePaths } from "../agent"; +import { renderNetworkDropIn } from "../install/units"; +import { DEFAULT_DOCTOR_PATHS, type DoctorOptions, runDoctor } from "./doctor"; + +const VALID_PASSWD = [ + "root:x:0:0:root:/root:/bin/bash", + "tegrad:x:991:991::/var/lib/tegrad:/usr/sbin/nologin", + "tegrad-srv:x:992:992::/nonexistent:/usr/sbin/nologin", +].join("\n"); + +const VALID_GROUP = ["root:x:0:", "tegrad:x:991:", "tegrad-srv:x:992:tegrad"].join("\n"); + +const VALID_DROPIN = renderNetworkDropIn({ resolvers: ["127.0.0.53"] }); + +function makeHealthyLinuxOptions(overrides: Partial = {}): { + readonly options: DoctorOptions; + readonly getOutput: () => string; +} { + let output = ""; + const stateDir = "/var/lib/tegrad"; + const statePaths = getStatePaths(stateDir); + const existingFiles = new Set([ + stateDir, + statePaths.identityPath, + statePaths.configPath, + DEFAULT_DOCTOR_PATHS.tegradServicePath, + DEFAULT_DOCTOR_PATHS.serverServicePath, + DEFAULT_DOCTOR_PATHS.serverSocketPath, + DEFAULT_DOCTOR_PATHS.tmpfilesPath, + DEFAULT_DOCTOR_PATHS.polkitRulePath, + DEFAULT_DOCTOR_PATHS.networkDropInPath, + ]); + const modes = new Map([ + [stateDir, 0o40700], + [statePaths.identityPath, 0o100600], + [statePaths.configPath, 0o100600], + ]); + const texts = new Map([ + [DEFAULT_DOCTOR_PATHS.passwdPath, VALID_PASSWD], + [DEFAULT_DOCTOR_PATHS.groupPath, VALID_GROUP], + [DEFAULT_DOCTOR_PATHS.networkDropInPath, VALID_DROPIN], + ]); + + const options: DoctorOptions = { + platform: "linux", + stateDir, + geteuid: () => 991, + exists: (p) => existingFiles.has(p), + statMode: (p) => { + const m = modes.get(p); + if (m === undefined) throw new Error(`ENOENT: ${p}`); + return m; + }, + readText: (p) => { + const t = texts.get(p); + if (t === undefined) throw new Error(`ENOENT: ${p}`); + return t; + }, + runCommand: async (command, args) => { + if (command === "systemctl" && args[0] === "is-active" && args[1] === "tegrad.service") { + return { code: 0, stdout: "active\n", stderr: "" }; + } + return { code: 1, stdout: "", stderr: "unexpected command" }; + }, + stdout: (text) => { + output += text; + }, + ...overrides, + }; + + return { options, getOutput: () => output }; +} + +describe("tegrad doctor", () => { + test("on non-Linux platforms prints notice and exits 0 without running checks", async () => { + let output = ""; + const code = await runDoctor({ + platform: "win32", + stdout: (t) => { + output += t; + }, + }); + expect(code).toBe(0); + expect(output).toContain("Linux"); + expect(output).not.toContain("FALHA"); + }); + + test("returns 0 and prints OK for all checks on a healthy Linux installation", async () => { + const { options, getOutput } = makeHealthyLinuxOptions(); + const code = await runDoctor(options); + expect(code).toBe(0); + expect(getOutput()).not.toContain("FALHA"); + expect(getOutput()).toContain("OK user:"); + expect(getOutput()).toContain("OK state_dir:"); + expect(getOutput()).toContain("OK secret_permissions:"); + expect(getOutput()).toContain("OK network_dropin:"); + expect(getOutput()).toContain("OK group_isolation:"); + expect(getOutput()).toContain("OK group_membership:"); + expect(getOutput()).toContain("OK systemd_service:"); + }); + + test("fails when running as root (euid 0)", async () => { + const { options, getOutput } = makeHealthyLinuxOptions({ geteuid: () => 0 }); + const code = await runDoctor(options); + expect(code).toBe(1); + expect(getOutput()).toContain("FALHA user: running as root"); + }); + + test("fails when state directory mode is not 0700", async () => { + const { options, getOutput } = makeHealthyLinuxOptions({ + statMode: (p) => (p === "/var/lib/tegrad" ? 0o40755 : 0o100600), + }); + const code = await runDoctor(options); + expect(code).toBe(1); + expect(getOutput()).toContain("FALHA state_dir:"); + }); + + test("fails when a secret file mode is more permissive than 0600", async () => { + const { options, getOutput } = makeHealthyLinuxOptions({ + statMode: (p) => { + if (p === "/var/lib/tegrad") return 0o40700; + if (p.endsWith("identity.json")) return 0o100644; + return 0o100600; + }, + }); + const code = await runDoctor(options); + expect(code).toBe(1); + expect(getOutput()).toContain("FALHA secret_permissions:"); + }); + + test("fails when network drop-in is missing required IPAddressDeny ranges", async () => { + const { options, getOutput } = makeHealthyLinuxOptions({ + readText: (p) => { + if (p === DEFAULT_DOCTOR_PATHS.passwdPath) return VALID_PASSWD; + if (p === DEFAULT_DOCTOR_PATHS.groupPath) return VALID_GROUP; + return "[Service]\nIPAddressDeny=10.0.0.0/8\n"; + }, + }); + const code = await runDoctor(options); + expect(code).toBe(1); + expect(getOutput()).toContain("FALHA network_dropin:"); + }); + + test("fails when tegrad-srv is in group tegrad or tegrad is not in tegrad-srv", async () => { + const badGroup = ["root:x:0:", "tegrad:x:991:tegrad-srv", "tegrad-srv:x:992:"].join("\n"); + const { options, getOutput } = makeHealthyLinuxOptions({ + readText: (p) => { + if (p === DEFAULT_DOCTOR_PATHS.passwdPath) return VALID_PASSWD; + if (p === DEFAULT_DOCTOR_PATHS.groupPath) return badGroup; + return VALID_DROPIN; + }, + }); + const code = await runDoctor(options); + expect(code).toBe(1); + expect(getOutput()).toContain("FALHA group_isolation:"); + expect(getOutput()).toContain("FALHA group_membership:"); + }); + + test("fails when tegrad.service is inactive", async () => { + const { options, getOutput } = makeHealthyLinuxOptions({ + runCommand: async () => ({ code: 3, stdout: "inactive\n", stderr: "" }), + }); + const code = await runDoctor(options); + expect(code).toBe(1); + expect(getOutput()).toContain("FALHA systemd_service:"); + }); +}); diff --git a/src/cli/doctor.ts b/src/cli/doctor.ts new file mode 100644 index 0000000..c862577 --- /dev/null +++ b/src/cli/doctor.ts @@ -0,0 +1,411 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { existsSync, readFileSync, statSync } from "node:fs"; +import { getStatePaths, type RunFixedResult, resolveStateDir, runFixed } from "../agent"; +import { NETWORK_DENY_RANGES } from "../install/units"; + +export interface DoctorCheckResult { + readonly name: string; + readonly ok: boolean; + readonly detail: string; +} + +export interface DoctorPaths { + readonly passwdPath: string; + readonly groupPath: string; + readonly tegradServicePath: string; + readonly serverServicePath: string; + readonly serverSocketPath: string; + readonly tmpfilesPath: string; + readonly polkitRulePath: string; + readonly networkDropInPath: string; +} + +export const DEFAULT_DOCTOR_PATHS: DoctorPaths = { + passwdPath: "/etc/passwd", + groupPath: "/etc/group", + tegradServicePath: "/etc/systemd/system/tegrad.service", + serverServicePath: "/etc/systemd/system/tegrad-server@.service", + serverSocketPath: "/etc/systemd/system/tegrad-server@.socket", + tmpfilesPath: "/etc/tmpfiles.d/tegrad.conf", + polkitRulePath: "/etc/polkit-1/rules.d/50-tegrad.rules", + networkDropInPath: "/etc/systemd/system/tegrad-server@.service.d/10-network.conf", +}; + +export interface DoctorOptions { + readonly env?: Readonly>; + readonly platform?: NodeJS.Platform; + readonly stateDir?: string; + readonly paths?: Partial; + readonly geteuid?: () => number; + readonly statMode?: (filePath: string) => number; + readonly exists?: (filePath: string) => boolean; + readonly readText?: (filePath: string) => string; + readonly runCommand?: ( + command: string, + args: readonly string[], + ) => Promise>; + readonly stdout?: (text: string) => void; +} + +interface PasswdEntry { + readonly username: string; + readonly uid: number; + readonly gid: number; +} + +interface GroupEntry { + readonly name: string; + readonly gid: number; + readonly members: readonly string[]; +} + +export function parseEtcPasswd(content: string): Map { + const entries = new Map(); + for (const line of content.split(/\r?\n/)) { + const trimmed = line.trim(); + if (trimmed.length === 0 || trimmed.startsWith("#")) continue; + const fields = trimmed.split(":"); + const username = fields[0]; + const uidStr = fields[2]; + const gidStr = fields[3]; + if (username === undefined || uidStr === undefined || gidStr === undefined) continue; + const uid = Number(uidStr); + const gid = Number(gidStr); + if (!Number.isInteger(uid) || !Number.isInteger(gid)) continue; + entries.set(username, { username, uid, gid }); + } + return entries; +} + +export function parseEtcGroup(content: string): Map { + const entries = new Map(); + for (const line of content.split(/\r?\n/)) { + const trimmed = line.trim(); + if (trimmed.length === 0 || trimmed.startsWith("#")) continue; + const fields = trimmed.split(":"); + const name = fields[0]; + const gidStr = fields[2]; + const membersField = fields[3] ?? ""; + if (name === undefined || gidStr === undefined) continue; + const gid = Number(gidStr); + if (!Number.isInteger(gid)) continue; + const members = membersField + .split(",") + .map((m) => m.trim()) + .filter((m) => m.length > 0); + entries.set(name, { name, gid, members }); + } + return entries; +} + +function isUserInGroup( + username: string, + groupName: string, + passwd: Map, + groups: Map, +): boolean { + const user = passwd.get(username); + const group = groups.get(groupName); + if (user === undefined || group === undefined) { + return false; + } + if (user.gid === group.gid) { + return true; + } + return group.members.includes(username); +} + +function formatMode(mode: number): string { + return (mode & 0o7777).toString(8).padStart(4, "0"); +} + +function extractIpAddressDenyTokens(content: string): Set { + const tokens = new Set(); + for (const rawLine of content.split(/\r?\n/)) { + const line = rawLine.trim(); + if (line.startsWith("#") || line.startsWith(";")) continue; + if (line.startsWith("IPAddressDeny=")) { + const value = line.slice("IPAddressDeny=".length).trim(); + for (const tok of value.split(/\s+/)) { + if (tok.length > 0) { + tokens.add(tok); + } + } + } + } + return tokens; +} + +export async function runDoctor(options: DoctorOptions = {}): Promise { + const platform = options.platform ?? process.platform; + const stdout = options.stdout ?? ((text: string) => process.stdout.write(text)); + + if (platform !== "linux") { + stdout("tegrad doctor only applies to Linux hosts.\n"); + return 0; + } + + const env = options.env ?? process.env; + const stateDir = options.stateDir ?? resolveStateDir(env, platform); + const paths: DoctorPaths = { ...DEFAULT_DOCTOR_PATHS, ...(options.paths ?? {}) }; + const exists = options.exists ?? ((p: string) => existsSync(p)); + const readText = options.readText ?? ((p: string) => readFileSync(p, "utf8")); + const statMode = options.statMode ?? ((p: string) => statSync(p).mode); + const geteuid = options.geteuid ?? (() => process.geteuid?.() ?? -1); + const runCommand = + options.runCommand ?? + ((command: string, args: readonly string[]) => + runFixed(command, args, { timeoutMs: 5_000, maxOutputBytes: 4096 })); + + const results: DoctorCheckResult[] = []; + + let passwd = new Map(); + let groups = new Map(); + let passwdLoaded = false; + let groupLoaded = false; + + try { + passwd = parseEtcPasswd(readText(paths.passwdPath)); + passwdLoaded = true; + } catch { + passwdLoaded = false; + } + + try { + groups = parseEtcGroup(readText(paths.groupPath)); + groupLoaded = true; + } catch { + groupLoaded = false; + } + + // 1. Running as tegrad (and not root) + const euid = geteuid(); + const tegradUser = passwd.get("tegrad"); + if (euid === 0) { + results.push({ + name: "user", + ok: false, + detail: "running as root (euid 0); expected user 'tegrad'", + }); + } else if (!passwdLoaded || tegradUser === undefined) { + results.push({ + name: "user", + ok: false, + detail: `user 'tegrad' not found in ${paths.passwdPath}`, + }); + } else if (euid !== tegradUser.uid) { + results.push({ + name: "user", + ok: false, + detail: `running as euid ${euid}; expected 'tegrad' (uid ${tegradUser.uid})`, + }); + } else { + results.push({ + name: "user", + ok: true, + detail: `running as tegrad (uid ${euid})`, + }); + } + + // 2. State directory mode 0700 + if (!exists(stateDir)) { + results.push({ + name: "state_dir", + ok: false, + detail: `${stateDir} does not exist`, + }); + } else { + try { + const mode = statMode(stateDir) & 0o777; + if (mode === 0o700) { + results.push({ + name: "state_dir", + ok: true, + detail: `${stateDir} mode 0700`, + }); + } else { + results.push({ + name: "state_dir", + ok: false, + detail: `${stateDir} mode is ${formatMode(mode)}, expected 0700`, + }); + } + } catch (err) { + results.push({ + name: "state_dir", + ok: false, + detail: `failed to stat ${stateDir}: ${err instanceof Error ? err.message : String(err)}`, + }); + } + } + + // 3. Secret files mode 0600 + const statePaths = getStatePaths(stateDir); + const secretFiles = [ + statePaths.identityPath, + statePaths.configPath, + statePaths.trustPath, + statePaths.revocationsPath, + statePaths.replayPath, + ]; + const badSecretFiles: string[] = []; + let checkedSecretFiles = 0; + for (const filePath of secretFiles) { + if (!exists(filePath)) continue; + checkedSecretFiles++; + try { + const mode = statMode(filePath) & 0o777; + if (mode !== 0o600) { + badSecretFiles.push(`${filePath} (${formatMode(mode)})`); + } + } catch { + badSecretFiles.push(`${filePath} (unreadable stat)`); + } + } + if (badSecretFiles.length > 0) { + results.push({ + name: "secret_permissions", + ok: false, + detail: `expected 0600, found: ${badSecretFiles.join(", ")}`, + }); + } else { + results.push({ + name: "secret_permissions", + ok: true, + detail: + checkedSecretFiles > 0 + ? `${checkedSecretFiles} state file(s) with mode 0600` + : "no state files present yet", + }); + } + + // 4. Units and tmpfiles exist + const requiredFiles: readonly { readonly label: string; readonly path: string }[] = [ + { label: "unit_tegrad", path: paths.tegradServicePath }, + { label: "unit_server_service", path: paths.serverServicePath }, + { label: "unit_server_socket", path: paths.serverSocketPath }, + { label: "tmpfiles", path: paths.tmpfilesPath }, + { label: "polkit_rule", path: paths.polkitRulePath }, + ]; + for (const item of requiredFiles) { + const present = exists(item.path); + results.push({ + name: item.label, + ok: present, + detail: present ? `${item.path} present` : `${item.path} missing`, + }); + } + + // 5. Network drop-in exists and contains all expected IPAddressDeny ranges + if (!exists(paths.networkDropInPath)) { + results.push({ + name: "network_dropin", + ok: false, + detail: `${paths.networkDropInPath} missing`, + }); + } else { + try { + const content = readText(paths.networkDropInPath); + const denyTokens = extractIpAddressDenyTokens(content); + const missingRanges = NETWORK_DENY_RANGES.filter((range) => !denyTokens.has(range)); + if (missingRanges.length > 0) { + results.push({ + name: "network_dropin", + ok: false, + detail: `${paths.networkDropInPath} missing IPAddressDeny ranges: ${missingRanges.join(", ")}`, + }); + } else { + results.push({ + name: "network_dropin", + ok: true, + detail: `${paths.networkDropInPath} denies all private/loopback ranges`, + }); + } + } catch (err) { + results.push({ + name: "network_dropin", + ok: false, + detail: `failed to read ${paths.networkDropInPath}: ${err instanceof Error ? err.message : String(err)}`, + }); + } + } + + // 6. Group membership isolation: tegrad-srv NOT in tegrad; tegrad IN tegrad-srv + if (!passwdLoaded || !groupLoaded) { + results.push({ + name: "group_isolation", + ok: false, + detail: `could not read ${paths.passwdPath} or ${paths.groupPath}`, + }); + results.push({ + name: "group_membership", + ok: false, + detail: `could not read ${paths.passwdPath} or ${paths.groupPath}`, + }); + } else { + const srvExists = passwd.has("tegrad-srv"); + const srvInTegrad = isUserInGroup("tegrad-srv", "tegrad", passwd, groups); + if (!srvExists) { + results.push({ + name: "group_isolation", + ok: false, + detail: `user 'tegrad-srv' not found in ${paths.passwdPath}`, + }); + } else if (srvInTegrad) { + results.push({ + name: "group_isolation", + ok: false, + detail: "user 'tegrad-srv' must NOT be a member of group 'tegrad'", + }); + } else { + results.push({ + name: "group_isolation", + ok: true, + detail: "user 'tegrad-srv' is not in group 'tegrad'", + }); + } + + const tegradInSrv = isUserInGroup("tegrad", "tegrad-srv", passwd, groups); + if (tegradInSrv) { + results.push({ + name: "group_membership", + ok: true, + detail: "user 'tegrad' is in group 'tegrad-srv'", + }); + } else { + results.push({ + name: "group_membership", + ok: false, + detail: "user 'tegrad' must be a member of group 'tegrad-srv'", + }); + } + } + + // 7. systemd unit status via runFixed (literal arguments only) + try { + const res = await runCommand("systemctl", ["is-active", "tegrad.service"]); + const statusText = res.stdout.trim() || res.stderr.trim() || `exit ${res.code}`; + results.push({ + name: "systemd_service", + ok: res.code === 0 && statusText === "active", + detail: `tegrad.service is ${statusText}`, + }); + } catch (err) { + results.push({ + name: "systemd_service", + ok: false, + detail: `failed to query systemctl: ${err instanceof Error ? err.message : String(err)}`, + }); + } + + let allOk = true; + for (const item of results) { + const tag = item.ok ? "OK" : "FALHA"; + if (!item.ok) allOk = false; + stdout(`${tag.padEnd(5)} ${item.name}: ${item.detail}\n`); + } + + return allOk ? 0 : 1; +} diff --git a/src/cli/main.ts b/src/cli/main.ts index b0572c8..3446901 100644 --- a/src/cli/main.ts +++ b/src/cli/main.ts @@ -17,12 +17,15 @@ import { import { fingerprint } from "../crypto"; import { versionLine } from "../version"; import { formatUsage, parseCliArgs } from "./args"; -import { runAgentLoop } from "./run"; +import { type DoctorOptions, runDoctor } from "./doctor"; +import { assertNotRoot, runAgentLoop } from "./run"; export interface CliDependencies { readonly env?: Readonly>; readonly stdout?: (text: string) => void; readonly stderr?: (text: string) => void; + readonly geteuid?: () => number; + readonly doctorOptions?: Omit; readonly runAgent?: ( stateDir: string, env: Readonly>, @@ -122,13 +125,31 @@ export async function runCli(argv: readonly string[], deps: CliDependencies = {} } } + case "doctor": { + try { + return await runDoctor({ + ...(deps.doctorOptions ?? {}), + env, + stdout, + }); + } catch (err) { + stderr(`${err instanceof Error ? err.message : String(err)}\n`); + return 1; + } + } + case "run": { try { + assertNotRoot(env, deps.geteuid); const stateDir = resolveStateDir(env); if (deps.runAgent) { return await deps.runAgent(stateDir, env); } - return await runAgentLoop({ stateDir, env }); + return await runAgentLoop({ + stateDir, + env, + ...(deps.geteuid !== undefined ? { geteuid: deps.geteuid } : {}), + }); } catch (err) { stderr(`${err instanceof Error ? err.message : String(err)}\n`); return 1; diff --git a/src/cli/run.ts b/src/cli/run.ts index 2672231..06b8355 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -1,6 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda +import { z } from "zod"; import { type AgentConnection, type CommandQueue, @@ -21,6 +22,22 @@ import { type CommandRegistry, createCoreRegistry, type TransportFrame } from ". export const SHUTDOWN_DRAIN_TIMEOUT_MS = 10_000; +const rootEnvSchema = z.object({ + TEGRAD_ALLOW_ROOT: z.string().optional(), +}); + +export function assertNotRoot( + env: Readonly> = process.env, + geteuid: () => number = () => process.geteuid?.() ?? -1, +): void { + const parsed = rootEnvSchema.parse({ TEGRAD_ALLOW_ROOT: env.TEGRAD_ALLOW_ROOT }); + if (geteuid() === 0 && parsed.TEGRAD_ALLOW_ROOT !== "1") { + throw new Error( + 'Refusing to start tegrad as root (euid 0). Run as the dedicated "tegrad" user (or set TEGRAD_ALLOW_ROOT=1 for local development only).', + ); + } +} + export interface AgentRuntime { readonly agentId: string; readonly connection: AgentConnection; @@ -39,12 +56,14 @@ export interface CreateAgentRuntimeOptions { readonly webSocketFactory?: WebSocketFactory; readonly timers?: TimerProvider; readonly now?: () => number; + readonly geteuid?: () => number; } export async function createAgentRuntime( options: CreateAgentRuntimeOptions, ): Promise { const env = options.env ?? process.env; + assertNotRoot(env, options.geteuid); const logger = options.logger ?? createLogger({ env }); const config = loadConfig(options.stateDir, { env }); const agentKeyPair = await loadOrCreateIdentity(options.stateDir); diff --git a/src/install/units.test.ts b/src/install/units.test.ts new file mode 100644 index 0000000..e17918e --- /dev/null +++ b/src/install/units.test.ts @@ -0,0 +1,348 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { describe, expect, test } from "bun:test"; +import { existsSync, readFileSync } from "node:fs"; +import { join, resolve } from "node:path"; +import { + isPrivateOrLoopbackIp, + NETWORK_DENY_RANGES, + parseCidr, + parseIpAddress, + parseResolvConf, + renderNetworkDropIn, +} from "./units"; + +const REPO_ROOT = resolve(import.meta.dir, "../.."); +const INSTALL_DIR = join(REPO_ROOT, "install"); + +function readInstallFile(relPath: string): string { + return readFileSync(join(INSTALL_DIR, relPath), "utf8"); +} + +function parseIniDirectives(content: string): Map { + const map = new Map(); + for (const rawLine of content.split(/\r?\n/)) { + const line = rawLine.trim(); + if (line.length === 0 || line.startsWith("#") || line.startsWith(";") || line.startsWith("[")) { + continue; + } + const eq = line.indexOf("="); + if (eq === -1) continue; + const key = line.slice(0, eq).trim(); + const val = line.slice(eq + 1).trim(); + const existing = map.get(key) ?? []; + existing.push(val); + map.set(key, existing); + } + return map; +} + +function findPosixSh(): string | null { + if (process.platform !== "win32") { + return Bun.which("sh") ?? (existsSync("/bin/sh") ? "/bin/sh" : null); + } + const onPath = Bun.which("sh"); + if (onPath) return onPath; + const gitSh = "C:\\Program Files\\Git\\bin\\sh.exe"; + if (existsSync(gitSh)) return gitSh; + return null; +} + +describe("IP and CIDR parsing / network drop-in rendering", () => { + test("parseIpAddress accepts valid IPv4 and IPv6 and rejects invalid inputs", () => { + expect(parseIpAddress("127.0.0.53")).toEqual({ version: 4, address: "127.0.0.53" }); + expect(parseIpAddress("192.168.1.1")).toEqual({ version: 4, address: "192.168.1.1" }); + expect(parseIpAddress("0.0.0.0")).toEqual({ version: 4, address: "0.0.0.0" }); + expect(parseIpAddress("255.255.255.255")).toEqual({ version: 4, address: "255.255.255.255" }); + expect(parseIpAddress("::1")).toEqual({ version: 6, address: "::1" }); + expect(parseIpAddress("fe80::1")).toEqual({ version: 6, address: "fe80::1" }); + expect(parseIpAddress("fd12:3456:789a::1")).toEqual({ + version: 6, + address: "fd12:3456:789a::1", + }); + expect(parseIpAddress("2001:4860:4860::8888")).toEqual({ + version: 6, + address: "2001:4860:4860::8888", + }); + expect(parseIpAddress("2001:0db8:0000:0000:0000:ff00:0042:8329")).toEqual({ + version: 6, + address: "2001:0db8:0000:0000:0000:ff00:0042:8329", + }); + + // Invalid inputs + expect(parseIpAddress("")).toBeNull(); + expect(parseIpAddress("256.0.0.1")).toBeNull(); + expect(parseIpAddress("192.168.01.1")).toBeNull(); + expect(parseIpAddress("1.2.3")).toBeNull(); + expect(parseIpAddress("1.2.3.4.5")).toBeNull(); + expect(parseIpAddress("fe80::1%eth0")).toBeNull(); + expect(parseIpAddress("1::2::3")).toBeNull(); + expect(parseIpAddress(":::1")).toBeNull(); + expect(parseIpAddress("192.168.1.1;rm -rf /")).toBeNull(); + }); + + test("parseCidr accepts valid IPv4/IPv6 CIDRs and rejects invalid ones", () => { + expect(parseCidr("192.168.1.0/24")).toEqual({ + version: 4, + address: "192.168.1.0", + prefix: 24, + cidr: "192.168.1.0/24", + }); + expect(parseCidr("10.0.0.0/8")).toEqual({ + version: 4, + address: "10.0.0.0", + prefix: 8, + cidr: "10.0.0.0/8", + }); + expect(parseCidr("fd00::/8")).toEqual({ + version: 6, + address: "fd00::", + prefix: 8, + cidr: "fd00::/8", + }); + expect(parseCidr("::1/128")).toEqual({ + version: 6, + address: "::1", + prefix: 128, + cidr: "::1/128", + }); + + expect(parseCidr("192.168.1.0")).toBeNull(); + expect(parseCidr("192.168.1.0/33")).toBeNull(); + expect(parseCidr("192.168.1.0/08")).toBeNull(); + expect(parseCidr("fd00::/129")).toBeNull(); + expect(parseCidr("192.168.1.0/24/1")).toBeNull(); + expect(parseCidr("not-an-ip/24")).toBeNull(); + }); + + test("isPrivateOrLoopbackIp classifies private, loopback, CGNAT, and public IPs accurately", () => { + expect(isPrivateOrLoopbackIp("10.0.0.1")).toBe(true); + expect(isPrivateOrLoopbackIp("172.16.0.1")).toBe(true); + expect(isPrivateOrLoopbackIp("172.31.255.254")).toBe(true); + expect(isPrivateOrLoopbackIp("172.15.0.1")).toBe(false); + expect(isPrivateOrLoopbackIp("172.32.0.1")).toBe(false); + expect(isPrivateOrLoopbackIp("192.168.1.1")).toBe(true); + expect(isPrivateOrLoopbackIp("169.254.169.254")).toBe(true); + expect(isPrivateOrLoopbackIp("100.64.0.1")).toBe(true); + expect(isPrivateOrLoopbackIp("100.127.255.254")).toBe(true); + expect(isPrivateOrLoopbackIp("100.128.0.1")).toBe(false); + expect(isPrivateOrLoopbackIp("127.0.0.53")).toBe(true); + expect(isPrivateOrLoopbackIp("1.1.1.1")).toBe(false); + expect(isPrivateOrLoopbackIp("8.8.8.8")).toBe(false); + + expect(isPrivateOrLoopbackIp("::1")).toBe(true); + expect(isPrivateOrLoopbackIp("0:0:0:0:0:0:0:1")).toBe(true); + expect(isPrivateOrLoopbackIp("fc00::1")).toBe(true); + expect(isPrivateOrLoopbackIp("fd12::1")).toBe(true); + expect(isPrivateOrLoopbackIp("fe80::1")).toBe(true); + expect(isPrivateOrLoopbackIp("febf::1")).toBe(true); + expect(isPrivateOrLoopbackIp("fec0::1")).toBe(false); + expect(isPrivateOrLoopbackIp("2606:4700:4700::1111")).toBe(false); + }); + + test("parseResolvConf extracts valid nameservers and discards malformed lines", () => { + const sample = [ + "# comment", + "search lan.local", + "nameserver 127.0.0.53", + "nameserver\t192.168.1.1 # router", + "nameserver not-an-ip", + "nameserver 192.168.01.1", + "nameserver fe80::1%eth0", + "nameserver fd00::53 ; inline comment", + "nameserver 1.1.1.1", + "options edns0 trust-ad", + ].join("\n"); + + expect(parseResolvConf(sample)).toEqual(["127.0.0.53", "192.168.1.1", "fd00::53", "1.1.1.1"]); + }); + + test("renderNetworkDropIn omits IPAddressAllow when only public resolvers are given", () => { + const out = renderNetworkDropIn({ resolvers: ["1.1.1.1", "8.8.8.8"] }); + expect(out).toContain(`IPAddressDeny=${NETWORK_DENY_RANGES.join(" ")}`); + expect(out).not.toContain("IPAddressAllow="); + }); + + test("renderNetworkDropIn includes private resolvers and allowLan CIDRs deduplicated", () => { + const out = renderNetworkDropIn({ + resolvers: ["127.0.0.53", "192.168.1.1", "1.1.1.1", "127.0.0.53", "fd00::1"], + allowLan: ["192.168.1.0/24", "192.168.1.0/24", "fd00::/8"], + }); + expect(out).toContain( + "IPAddressAllow=127.0.0.53 192.168.1.1 fd00::1 192.168.1.0/24 fd00::/8\n", + ); + }); + + test("renderNetworkDropIn rejects invalid resolver or allowLan entries", () => { + expect(() => renderNetworkDropIn({ resolvers: ["bad-ip"] })).toThrow(); + expect(() => renderNetworkDropIn({ allowLan: ["192.168.1.0"] })).toThrow(); + }); +}); + +describe("install/install.sh parity with renderNetworkDropIn", () => { + const shPath = findPosixSh(); + const parityTest = shPath !== null ? test : test.skip; + + parityTest( + "shell render_network_dropin matches TypeScript output on representative cases", + async () => { + if (shPath === null) return; + const scriptPath = join(INSTALL_DIR, "install.sh").replace(/\\/g, "/"); + + const cases: readonly { readonly resolvers: string[]; readonly allowLan: string[] }[] = [ + { resolvers: [], allowLan: [] }, + { resolvers: ["1.1.1.1", "8.8.8.8", "2606:4700:4700::1111"], allowLan: [] }, + { resolvers: ["127.0.0.53", "192.168.1.1", "1.1.1.1"], allowLan: [] }, + { + resolvers: ["127.0.0.53", "10.0.0.2", "fe80::1", "::1", "10.0.0.2"], + allowLan: ["192.168.10.0/24", "fd00::/8"], + }, + ]; + + for (const c of cases) { + const expected = renderNetworkDropIn(c); + const proc = Bun.spawn( + [ + shPath, + "-c", + 'TEGRAD_INSTALL_SOURCE_ONLY=1 . "$1" && render_network_dropin "$2" "$3"', + "--", + scriptPath, + c.resolvers.join(" "), + c.allowLan.join(" "), + ], + { + stdin: "ignore", + stdout: "pipe", + stderr: "pipe", + }, + ); + const [stdout, stderr, code] = await Promise.all([ + new Response(proc.stdout).text(), + new Response(proc.stderr).text(), + proc.exited, + ]); + expect(stderr).toBe(""); + expect(code).toBe(0); + expect(stdout.replace(/\r\n/g, "\n")).toBe(expected); + } + }, + ); +}); + +describe("Security regression checks on install/ assets", () => { + test("tegrad.service enforces unprivileged user and sandbox directives", () => { + const content = readInstallFile("units/tegrad.service"); + const directives = parseIniDirectives(content); + + expect(directives.get("User")).toEqual(["tegrad"]); + expect(directives.get("User")).not.toContain("root"); + expect(directives.get("Group")).toEqual(["tegrad"]); + expect(directives.get("NoNewPrivileges")).toEqual(["yes"]); + expect(directives.get("ProtectSystem")).toEqual(["strict"]); + expect(directives.get("ProtectHome")).toEqual(["yes"]); + expect(directives.get("PrivateTmp")).toEqual(["yes"]); + expect(directives.get("PrivateDevices")).toEqual(["yes"]); + expect(directives.get("ProtectKernelTunables")).toEqual(["yes"]); + expect(directives.get("ProtectKernelModules")).toEqual(["yes"]); + expect(directives.get("ProtectControlGroups")).toEqual(["yes"]); + expect(directives.get("RestrictSUIDSGID")).toEqual(["yes"]); + expect(directives.get("RestrictNamespaces")).toEqual(["yes"]); + expect(directives.get("LockPersonality")).toEqual(["yes"]); + expect(directives.get("CapabilityBoundingSet")).toEqual([""]); + expect(directives.get("SystemCallArchitectures")).toEqual(["native"]); + expect(directives.get("UMask")).toEqual(["0077"]); + expect(directives.get("RestrictAddressFamilies")?.[0]).toContain("AF_UNIX"); + }); + + test("tegrad-server@.service isolates untrusted Minecraft servers without breaking JVM or networking", () => { + const content = readInstallFile("units/tegrad-server@.service"); + const directives = parseIniDirectives(content); + + expect(directives.get("User")).toEqual(["tegrad-srv"]); + expect(directives.get("Group")).toEqual(["tegrad-srv"]); + expect(directives.get("NoNewPrivileges")).toEqual(["yes"]); + expect(directives.get("ProtectSystem")).toEqual(["strict"]); + expect(directives.get("ProtectHome")).toEqual(["yes"]); + expect(directives.get("PrivateTmp")).toEqual(["yes"]); + expect(directives.get("PrivateDevices")).toEqual(["yes"]); + expect(directives.get("ProtectKernelTunables")).toEqual(["yes"]); + expect(directives.get("ProtectKernelModules")).toEqual(["yes"]); + expect(directives.get("ProtectKernelLogs")).toEqual(["yes"]); + expect(directives.get("ProtectControlGroups")).toEqual(["yes"]); + expect(directives.get("ProtectProc")).toEqual(["invisible"]); + expect(directives.get("ProcSubset")).toEqual(["pid"]); + expect(directives.get("RestrictSUIDSGID")).toEqual(["yes"]); + expect(directives.get("RestrictNamespaces")).toEqual(["yes"]); + expect(directives.get("RestrictRealtime")).toEqual(["yes"]); + expect(directives.get("LockPersonality")).toEqual(["yes"]); + expect(directives.get("CapabilityBoundingSet")).toEqual([""]); + expect(directives.get("SystemCallFilter")).toEqual(["@system-service"]); + expect(directives.get("SystemCallErrorNumber")).toEqual(["EPERM"]); + expect(directives.get("SystemCallArchitectures")).toEqual(["native"]); + expect(directives.get("UMask")).toEqual(["0007"]); + + // Must NOT break JVM or server networking + expect(directives.get("MemoryDenyWriteExecute")).toBeUndefined(); + expect(directives.get("PrivateNetwork")).toBeUndefined(); + + // ReadWritePaths must NEVER grant access to /var/lib/tegrad or @TEGRAD_STATE_DIR@ + const rwTokens = (directives.get("ReadWritePaths") ?? []) + .flatMap((line) => line.split(/\s+/)) + .filter((t) => t.length > 0); + expect(rwTokens.length).toBeGreaterThan(0); + for (const token of rwTokens) { + const rendered = token + .replaceAll("@TEGRAD_STATE_DIR@", "/var/lib/tegrad") + .replaceAll("@TEGRAD_SERVERS_DIR@", "/var/lib/tegrad-servers"); + expect(rendered).not.toBe("/var/lib/tegrad"); + expect(rendered.startsWith("/var/lib/tegrad/")).toBe(false); + } + }); + + test("tegrad-server@.socket and tmpfiles.d configure FIFO ownership and permissions", () => { + const socketContent = readInstallFile("units/tegrad-server@.socket"); + const directives = parseIniDirectives(socketContent); + + expect(directives.get("SocketUser")).toEqual(["tegrad-srv"]); + expect(directives.get("SocketGroup")).toEqual(["tegrad"]); + expect(directives.get("SocketMode")).toEqual(["0660"]); + expect(directives.get("ListenFIFO")).toEqual(["@TEGRAD_RUN_DIR@/%i.stdin"]); + + const tmpfilesContent = readInstallFile("tmpfiles/tegrad.conf"); + expect(tmpfilesContent).toContain("d @TEGRAD_RUN_DIR@ 0750 root tegrad -"); + }); + + test("polkit rule restricts tegrad strictly to tegrad-server@ units", () => { + const rule = readInstallFile("polkit/50-tegrad.rules"); + + expect(rule).toContain('action.id === "org.freedesktop.systemd1.manage-units"'); + expect(rule).toContain('subject.user === "tegrad"'); + expect(rule).toContain("/^tegrad-server@[a-z0-9][a-z0-9-]{0,62}\\.(service|socket)$/"); + expect(rule).toContain("polkit.Result.YES"); + expect(rule).toContain("polkit.Result.NOT_HANDLED"); + }); + + test("install.sh avoids eval, guards every rm -rf with parameter-expansion :?, and uses set -eu", () => { + const script = readInstallFile("install.sh"); + const lines = script.split(/\r?\n/); + + expect(lines[0]).toBe("#!/bin/sh"); + expect(script).toContain("set -eu"); + expect(script).toContain("TODO(signature)"); + + for (const line of lines) { + const stripped = line.trim(); + if (stripped.startsWith("#")) continue; + + // Never invoke eval + expect(stripped).not.toMatch(/(^|[;&|(\s])eval(\s|$)/); + + // Every rm -rf must use ${VAR:?} + if (/\brm\s+-[a-zA-Z]*r[a-zA-Z]*f|\brm\s+-[a-zA-Z]*f[a-zA-Z]*r/.test(stripped)) { + expect(stripped).toMatch(/\$\{[A-Za-z_][A-Za-z0-9_]*:\?\}/); + } + } + }); +}); diff --git a/src/install/units.ts b/src/install/units.ts new file mode 100644 index 0000000..f690a67 --- /dev/null +++ b/src/install/units.ts @@ -0,0 +1,285 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; + +export const NETWORK_DENY_RANGES: readonly string[] = [ + "10.0.0.0/8", + "172.16.0.0/12", + "192.168.0.0/16", + "169.254.0.0/16", + "100.64.0.0/10", + "127.0.0.0/8", + "fc00::/7", + "fe80::/10", + "::1/128", +]; + +export interface ParsedIpAddress { + readonly version: 4 | 6; + readonly address: string; +} + +export interface ParsedCidr { + readonly version: 4 | 6; + readonly address: string; + readonly prefix: number; + readonly cidr: string; +} + +export interface RenderNetworkDropInOptions { + readonly resolvers?: readonly string[]; + readonly allowLan?: readonly string[]; +} + +const renderOptionsSchema = z.object({ + resolvers: z.array(z.string()).optional(), + allowLan: z.array(z.string()).optional(), +}); + +function isUintNoLeadingZero(value: string): boolean { + if (value.length === 0) return false; + if (value === "0") return true; + if (value.startsWith("0")) return false; + return /^[0-9]+$/.test(value); +} + +function parseIpv4Octets(raw: string): readonly [number, number, number, number] | null { + if (raw.length === 0 || !/^[0-9.]+$/.test(raw)) { + return null; + } + const parts = raw.split("."); + if (parts.length !== 4) { + return null; + } + const octets: number[] = []; + for (const part of parts) { + if (!isUintNoLeadingZero(part)) { + return null; + } + const num = Number(part); + if (!Number.isInteger(num) || num < 0 || num > 255) { + return null; + } + octets.push(num); + } + const [a, b, c, d] = octets; + if (a === undefined || b === undefined || c === undefined || d === undefined) { + return null; + } + return [a, b, c, d]; +} + +function expandIpv6Groups(raw: string): readonly string[] | null { + if (raw.length === 0 || !/^[0-9a-fA-F:]+$/.test(raw) || !raw.includes(":")) { + return null; + } + if (raw.includes(":::")) { + return null; + } + if ( + (raw.startsWith(":") && !raw.startsWith("::")) || + (raw.endsWith(":") && !raw.endsWith("::")) + ) { + return null; + } + + const dcIndex = raw.indexOf("::"); + let leftGroups: string[]; + let rightGroups: string[]; + let hasCompression = false; + + if (dcIndex !== -1) { + if (raw.indexOf("::", dcIndex + 2) !== -1) { + return null; + } + hasCompression = true; + const leftPart = raw.slice(0, dcIndex); + const rightPart = raw.slice(dcIndex + 2); + leftGroups = leftPart.length > 0 ? leftPart.split(":") : []; + rightGroups = rightPart.length > 0 ? rightPart.split(":") : []; + } else { + leftGroups = raw.split(":"); + rightGroups = []; + } + + const validateGroup = (group: string): string | null => { + if (group.length === 0 || group.length > 4 || !/^[0-9a-fA-F]+$/.test(group)) { + return null; + } + return group.toLowerCase().padStart(4, "0"); + }; + + const expandedLeft: string[] = []; + for (const g of leftGroups) { + const norm = validateGroup(g); + if (norm === null) return null; + expandedLeft.push(norm); + } + + const expandedRight: string[] = []; + for (const g of rightGroups) { + const norm = validateGroup(g); + if (norm === null) return null; + expandedRight.push(norm); + } + + const totalExplicit = expandedLeft.length + expandedRight.length; + if (hasCompression) { + if (totalExplicit >= 8) { + return null; + } + const missing = 8 - totalExplicit; + return [...expandedLeft, ...Array(missing).fill("0000"), ...expandedRight]; + } + + if (totalExplicit !== 8) { + return null; + } + return expandedLeft; +} + +export function parseIpAddress(raw: string): ParsedIpAddress | null { + if (parseIpv4Octets(raw) !== null) { + return { version: 4, address: raw }; + } + if (expandIpv6Groups(raw) !== null) { + return { version: 6, address: raw }; + } + return null; +} + +export function parseCidr(raw: string): ParsedCidr | null { + const slashIndex = raw.indexOf("/"); + if (slashIndex === -1 || raw.indexOf("/", slashIndex + 1) !== -1) { + return null; + } + const addrPart = raw.slice(0, slashIndex); + const prefixPart = raw.slice(slashIndex + 1); + if (!isUintNoLeadingZero(prefixPart)) { + return null; + } + const prefix = Number(prefixPart); + const parsedIp = parseIpAddress(addrPart); + if (parsedIp === null) { + return null; + } + const maxPrefix = parsedIp.version === 4 ? 32 : 128; + if (!Number.isInteger(prefix) || prefix < 0 || prefix > maxPrefix) { + return null; + } + return { + version: parsedIp.version, + address: parsedIp.address, + prefix, + cidr: `${parsedIp.address}/${prefix}`, + }; +} + +export function isPrivateOrLoopbackIp(raw: string): boolean { + const v4 = parseIpv4Octets(raw); + if (v4 !== null) { + const [a, b] = v4; + // 10.0.0.0/8 + if (a === 10) return true; + // 127.0.0.0/8 + if (a === 127) return true; + // 169.254.0.0/16 + if (a === 169 && b === 254) return true; + // 172.16.0.0/12 + if (a === 172 && b >= 16 && b <= 31) return true; + // 192.168.0.0/16 + if (a === 192 && b === 168) return true; + // 100.64.0.0/10 + if (a === 100 && b >= 64 && b <= 127) return true; + return false; + } + + const v6 = expandIpv6Groups(raw); + if (v6 !== null) { + // ::1/128 + if (v6.join(":") === "0000:0000:0000:0000:0000:0000:0000:0001") { + return true; + } + const first = v6[0]; + if (first === undefined) return false; + // fc00::/7 (fc00..fdff) + if (first.startsWith("fc") || first.startsWith("fd")) { + return true; + } + // fe80::/10 (fe80..febf) + if ( + first.startsWith("fe8") || + first.startsWith("fe9") || + first.startsWith("fea") || + first.startsWith("feb") + ) { + return true; + } + return false; + } + + return false; +} + +export function parseResolvConf(content: string): string[] { + const resolvers: string[] = []; + for (const rawLine of content.split(/\r?\n/)) { + const noHash = rawLine.split("#")[0] ?? ""; + const noSemi = noHash.split(";")[0] ?? ""; + const trimmed = noSemi.replace(/\t/g, " ").trim(); + if (!trimmed.startsWith("nameserver ")) { + continue; + } + const rest = trimmed.slice("nameserver ".length).trim(); + const token = rest.split(" ")[0] ?? ""; + if (parseIpAddress(token) !== null) { + resolvers.push(token); + } + } + return resolvers; +} + +export function renderNetworkDropIn(options: RenderNetworkDropInOptions = {}): string { + const parsed = renderOptionsSchema.parse(options); + const resolvers = parsed.resolvers ?? []; + const allowLan = parsed.allowLan ?? []; + + const allowed: string[] = []; + const seen = new Set(); + + for (const resolver of resolvers) { + if (parseIpAddress(resolver) === null) { + throw new Error(`Invalid resolver IP address: "${resolver}"`); + } + if (isPrivateOrLoopbackIp(resolver) && !seen.has(resolver)) { + seen.add(resolver); + allowed.push(resolver); + } + } + + for (const cidr of allowLan) { + if (parseCidr(cidr) === null) { + throw new Error(`Invalid allowLan CIDR: "${cidr}"`); + } + if (!seen.has(cidr)) { + seen.add(cidr); + allowed.push(cidr); + } + } + + const lines = [ + "# SPDX-License-Identifier: AGPL-3.0-only", + "# Copyright (C) 2026 Antônio Miranda ", + "# Generated by tegrad installer. Re-run installer to refresh DNS resolvers.", + "", + "[Service]", + `IPAddressDeny=${NETWORK_DENY_RANGES.join(" ")}`, + ]; + + if (allowed.length > 0) { + lines.push(`IPAddressAllow=${allowed.join(" ")}`); + } + + return `${lines.join("\n")}\n`; +} From 11cf17ab33727bb3a2185170d9775c02cb2353d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 22 Nov 2026 19:44:19 -0300 Subject: [PATCH 06/59] fix: use valid shellcheck directive syntax in installer --- install/install.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/install/install.sh b/install/install.sh index f8b4ca5..7e0b3e8 100755 --- a/install/install.sh +++ b/install/install.sh @@ -386,7 +386,8 @@ collect_resolvers() { _cr_list=$(parse_resolv_conf_file "$_cr_primary") fi - # shellcheck disable=SC2086 -- intentional word splitting on validated IP list + # intentional word splitting on validated IP list + # shellcheck disable=SC2086 for _cr_ip in $_cr_list; do if [ "$_cr_ip" = "127.0.0.53" ] || [ "$_cr_ip" = "127.0.0.54" ]; then _cr_has_stub=1 @@ -419,14 +420,16 @@ render_network_dropin() { _rd_allow_lan="$2" _rd_allow="" - # shellcheck disable=SC2086 -- intentional word splitting on validated IP list + # intentional word splitting on validated IP list + # shellcheck disable=SC2086 for _rd_ip in $_rd_resolvers; do if is_valid_ip "$_rd_ip" && is_private_or_loopback_ip "$_rd_ip"; then _rd_allow=$(append_unique_token "$_rd_allow" "$_rd_ip") fi done - # shellcheck disable=SC2086 -- intentional word splitting on validated CIDR list + # intentional word splitting on validated CIDR list + # shellcheck disable=SC2086 for _rd_cidr in $_rd_allow_lan; do if is_valid_cidr "$_rd_cidr"; then _rd_allow=$(append_unique_token "$_rd_allow" "$_rd_cidr") @@ -712,7 +715,8 @@ do_uninstall() { # Stop any running server template instances _un_units=$(systemctl list-units --all --no-legend --plain 'tegrad-server@*' 2>/dev/null | awk '{print $1}' || true) - # shellcheck disable=SC2086 -- intentional word splitting on unit names from systemctl + # intentional word splitting on unit names from systemctl + # shellcheck disable=SC2086 for _un_u in $_un_units; do systemctl stop "$_un_u" >/dev/null 2>&1 || true done @@ -854,7 +858,8 @@ main() { [ -n "$OPT_BINARY" ] && set -- "$@" --binary "$OPT_BINARY" [ -n "$OPT_VERSION" ] && set -- "$@" --version "$OPT_VERSION" [ -n "$OPT_API_URL" ] && set -- "$@" --api-url "$OPT_API_URL" - # shellcheck disable=SC2086 -- intentional word splitting on validated CIDR list + # intentional word splitting on validated CIDR list + # shellcheck disable=SC2086 for _lan_c in $OPT_ALLOW_LAN; do set -- "$@" --allow-lan "$_lan_c" done From 44c9287a5b4feb8155bc61855ff89930ecd2b80d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 22 Nov 2026 20:06:01 -0300 Subject: [PATCH 07/59] feat: add confined server file manager and safe zip implementation --- src/files/confinement.test.ts | 423 +++++++++++++++ src/files/confinement.ts | 587 +++++++++++++++++++++ src/files/errors.ts | 47 ++ src/files/index.ts | 84 +++ src/files/manager.test.ts | 801 ++++++++++++++++++++++++++++ src/files/manager.ts | 924 +++++++++++++++++++++++++++++++++ src/files/transfers.ts | 649 +++++++++++++++++++++++ src/files/zip.test.ts | 467 +++++++++++++++++ src/files/zip.ts | 887 +++++++++++++++++++++++++++++++ src/protocol/commands/core.ts | 5 +- src/protocol/commands/files.ts | 267 ++++++++++ src/protocol/index.ts | 27 + 12 files changed, 5167 insertions(+), 1 deletion(-) create mode 100644 src/files/confinement.test.ts create mode 100644 src/files/confinement.ts create mode 100644 src/files/errors.ts create mode 100644 src/files/index.ts create mode 100644 src/files/manager.test.ts create mode 100644 src/files/manager.ts create mode 100644 src/files/transfers.ts create mode 100644 src/files/zip.test.ts create mode 100644 src/files/zip.ts create mode 100644 src/protocol/commands/files.ts diff --git a/src/files/confinement.test.ts b/src/files/confinement.test.ts new file mode 100644 index 0000000..5fc25c0 --- /dev/null +++ b/src/files/confinement.test.ts @@ -0,0 +1,423 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeEach, describe, expect, test } from "bun:test"; +import { + closeSync, + existsSync, + mkdirSync, + mkdtempSync, + readdirSync, + readFileSync, + rmSync, + symlinkSync, + writeFileSync, +} from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { + MAX_COMPONENT_BYTES, + MAX_PATH_BYTES, + mkdirConfined, + openConfinedFileForRead, + resolveConfinedPath, + validateServerId, + validateSingleFileName, + writeConfinedFileAtomic, +} from "./confinement"; +import { type FileErrorCode, FileManagerError } from "./errors"; + +function expectFileError(fn: () => unknown, code: FileErrorCode): void { + try { + fn(); + throw new Error(`Expected FileManagerError(${code}), but succeeded`); + } catch (err) { + expect(err).toBeInstanceOf(FileManagerError); + expect((err as FileManagerError).code).toBe(code); + } +} + +function tryCreateFileSymlink(target: string, linkPath: string): boolean { + try { + symlinkSync(target, linkPath, "file"); + return true; + } catch (err) { + const code = + typeof err === "object" && err !== null && "code" in err + ? (err as { code?: unknown }).code + : undefined; + if (process.platform === "win32" && code === "EPERM") { + return false; + } + throw err; + } +} + +function createDirLink(target: string, linkPath: string): void { + if (process.platform === "win32") { + symlinkSync(target, linkPath, "junction"); + } else { + symlinkSync(target, linkPath, "dir"); + } +} + +describe("confinement", () => { + let rootTmp: string; + let serversDir: string; + let outsideDir: string; + const serverId = "srv-1"; + let serverDir: string; + + beforeEach(() => { + rootTmp = mkdtempSync(join(tmpdir(), "tegrad-confine-")); + serversDir = join(rootTmp, "servers"); + outsideDir = join(rootTmp, "outside"); + serverDir = join(serversDir, serverId); + mkdirSync(serverDir, { recursive: true }); + mkdirSync(outsideDir, { recursive: true }); + writeFileSync(join(outsideDir, "secret.txt"), "top-secret"); + }); + + afterEach(() => { + rmSync(rootTmp, { recursive: true, force: true }); + }); + + test("validates server_id strictly and rejects malicious identifiers", () => { + expect(validateServerId("a")).toBe("a"); + expect(validateServerId("srv-1")).toBe("srv-1"); + expect(validateServerId("0123-abc-xyz")).toBe("0123-abc-xyz"); + expect(validateServerId("a".repeat(63))).toBe("a".repeat(63)); + + const badIds = [ + "", + "../tegrad", + ".runtime", + "UPPER", + "srv_1", + "-leading", + "a".repeat(64), + "srv/1", + "srv\\1", + "srv\0", + "..", + ".", + ]; + for (const bad of badIds) { + expectFileError(() => validateServerId(bad), "invalid_server_id"); + } + }); + + test("blocks directory traversal, backslashes, absolute paths, and encoded separators", () => { + const attacks = [ + "..", + "../etc/passwd", + "a/b/../../../etc/passwd", + "..%2f..", + "..%2fetc%2fpasswd", + "a/..%5csecret", + "\\..\\..", + "a\\b", + "/etc/passwd", + "/", + "C:\\Windows\\System32", + "C:/Windows/System32", + "\\\\server\\share", + "a/./b", + "./a", + "sub/..", + ]; + + for (const attack of attacks) { + expect(() => + resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: attack, + allowRoot: false, + }), + ).toThrow(FileManagerError); + } + }); + + test("blocks NUL bytes, control chars, non-NFC Unicode, excessive length, and empty segments", () => { + expectFileError( + () => + resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: "foo\0bar.txt", + }), + "invalid_path", + ); + + for (const ctrl of ["a\nb.txt", "a\rb.txt", "a\x01b.txt", "a\x1fb.txt", "a\x7fb.txt"]) { + expectFileError( + () => + resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: ctrl, + }), + "invalid_path", + ); + } + + // NFD decomposed "café.txt" must be rejected; NFC composed is allowed. + const nfd = "cafe\u0301.txt"; + const nfc = nfd.normalize("NFC"); + expect(nfd).not.toBe(nfc); + expectFileError( + () => + resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: nfd, + }), + "invalid_path", + ); + const resolvedNfc = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: nfc, + }); + expect(resolvedNfc.relativePath).toBe(nfc); + + // Path > 1024 bytes + const tooLongPath = `${"a".repeat(200)}/${"b".repeat(200)}/${"c".repeat(200)}/${"d".repeat(200)}/${"e".repeat(250)}`; + expect(Buffer.byteLength(tooLongPath, "utf8")).toBeGreaterThan(MAX_PATH_BYTES); + expectFileError( + () => + resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: tooLongPath, + }), + "invalid_path", + ); + + // Component > 255 bytes + const tooLongComp = "a".repeat(MAX_COMPONENT_BYTES + 1); + expectFileError( + () => + resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: tooLongComp, + }), + "invalid_path", + ); + + // Empty segments + expectFileError( + () => + resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: "a//b", + }), + "invalid_path", + ); + expectFileError( + () => + resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: "a/", + }), + "invalid_path", + ); + }); + + test("blocks reserved Windows device names and trailing dots or spaces", () => { + const reserved = [ + "CON", + "con", + "PRN", + "AUX", + "aux.json", + "NUL", + "NUL.txt", + "COM1", + "com9.log", + "LPT1", + "lpt9", + "CONIN$", + "CONOUT$", + "CLOCK$", + "sub/NUL.txt", + "foo.", + "bar ", + "dir./file.txt", + "dir /file.txt", + ]; + + for (const candidate of reserved) { + expectFileError( + () => + resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: candidate, + }), + "invalid_path", + ); + } + }); + + test("blocks .runtime at any nesting level and root operations when allowRoot is false", () => { + for (const p of [".runtime", ".runtime/java", "nested/.runtime/bin"]) { + expectFileError( + () => + resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: p, + }), + "path_traversal", + ); + } + + for (const rootPath of ["", "."]) { + expectFileError( + () => + resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: rootPath, + allowRoot: false, + }), + "root_operation_forbidden", + ); + const allowed = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: rootPath, + allowRoot: true, + }); + expect(allowed.relativePath).toBe(""); + expect(allowed.segments).toEqual([]); + } + }); + + test("validates single file names for rename", () => { + expect(validateSingleFileName("server.properties")).toBe("server.properties"); + for (const bad of ["", "a/b", "a\\b", "..", ".", ".runtime", "NUL.txt", "foo.", "foo\0"]) { + expect(() => validateSingleFileName(bad)).toThrow(FileManagerError); + } + }); + + test("rejects symlink/junction as server root, intermediate directory, or file", () => { + // 1. Server root itself is a junction/symlink + const linkedServerId = "srv-linked"; + createDirLink(outsideDir, join(serversDir, linkedServerId)); + expectFileError( + () => + resolveConfinedPath({ + serversBaseDir: serversDir, + serverId: linkedServerId, + relPath: "secret.txt", + }), + "symlink_forbidden", + ); + + // 2. Intermediate directory symlink/junction pointing outside + const escapeDir = join(serverDir, "escape-dir"); + createDirLink(outsideDir, escapeDir); + expectFileError( + () => + resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: "escape-dir/secret.txt", + }), + "symlink_forbidden", + ); + expectFileError( + () => + mkdirConfined({ + serversBaseDir: serversDir, + serverId, + relPath: "escape-dir/nested/newdir", + }), + "symlink_forbidden", + ); + + // 3. Intermediate directory symlink/junction pointing inside server + const realSub = join(serverDir, "real-sub"); + mkdirSync(realSub); + createDirLink(realSub, join(serverDir, "inner-link")); + expectFileError( + () => + resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: "inner-link/file.txt", + }), + "symlink_forbidden", + ); + + // 4. File symlink pointing outside (skipped gracefully on Windows without Developer Mode) + const fileLinkPath = join(serverDir, "secret-link.txt"); + if (tryCreateFileSymlink(join(outsideDir, "secret.txt"), fileLinkPath)) { + expectFileError( + () => + resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: "secret-link.txt", + }), + "symlink_forbidden", + ); + } + }); + + test("openConfinedFileForRead validates file identity and rejects non-files", () => { + const resolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: "hello.txt", + }); + writeConfinedFileAtomic(resolved, new TextEncoder().encode("hello world")); + + const { fd, stats } = openConfinedFileForRead(resolved); + try { + expect(stats.isFile()).toBe(true); + expect(stats.size).toBe(11); + } finally { + closeSync(fd); + } + + mkdirSync(join(serverDir, "subdir")); + const dirResolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: "subdir", + }); + expectFileError(() => openConfinedFileForRead(dirResolved), "is_a_directory"); + }); + + test("writeConfinedFileAtomic is atomic and leaves no .tmp- files on success or failure", () => { + const resolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: "config.yml", + }); + + writeConfinedFileAtomic(resolved, new TextEncoder().encode("v1")); + expect(readFileSync(resolved.fullPath, "utf8")).toBe("v1"); + expect(readdirSync(serverDir).filter((n) => n.startsWith(".tmp-"))).toEqual([]); + + // Simulated mid-write crash leaves existing file intact and removes .tmp- + expect(() => + writeConfinedFileAtomic(resolved, new TextEncoder().encode("v2-corrupt"), { + writeHook() { + throw new Error("simulated disk failure"); + }, + }), + ).toThrow(FileManagerError); + + expect(readFileSync(resolved.fullPath, "utf8")).toBe("v1"); + expect(readdirSync(serverDir).filter((n) => n.startsWith(".tmp-"))).toEqual([]); + expect(existsSync(resolved.fullPath)).toBe(true); + }); +}); diff --git a/src/files/confinement.ts b/src/files/confinement.ts new file mode 100644 index 0000000..68d2e96 --- /dev/null +++ b/src/files/confinement.ts @@ -0,0 +1,587 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { randomBytes } from "node:crypto"; +import { + chmodSync, + closeSync, + constants as fsConstants, + fstatSync, + fsyncSync, + lstatSync, + mkdirSync, + openSync, + realpathSync, + renameSync, + type Stats, + unlinkSync, + writeSync, +} from "node:fs"; +import { basename, dirname, join, resolve, sep } from "node:path"; +import { SERVER_ID_PATTERN } from "../protocol"; +import { FileManagerError } from "./errors"; + +export const DEFAULT_SERVERS_BASE_DIR = "/var/lib/tegrad-servers"; +export const MAX_PATH_BYTES = 1024; +export const MAX_COMPONENT_BYTES = 255; + +const FORBIDDEN_COMPONENT_NAMES = new Set([".runtime"]); +const RESERVED_WINDOWS_NAME_REGEX = + /^(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9]|CONIN\$|CONOUT\$|CLOCK\$)(?:\.|$)/i; +const WINDOWS_DRIVE_PREFIX_REGEX = /^[A-Za-z]:/; +const ENCODED_TRAVERSAL_REGEX = /%(?:2f|5c|00)/i; +const DEFAULT_FILE_MODE = 0o640; +const DEFAULT_DIR_MODE = 0o750; + +export interface ConfinedPath { + readonly serverId: string; + readonly serverRoot: string; + readonly realServerRoot: string; + readonly relativePath: string; + readonly segments: readonly string[]; + readonly fullPath: string; +} + +export interface ResolveConfinedPathOptions { + readonly serversBaseDir?: string; + readonly serverId: string; + readonly relPath: string; + readonly allowRoot?: boolean; +} + +export interface AtomicWriteOptions { + readonly mode?: number; + readonly createParents?: boolean; + readonly writeHook?: (fd: number, data: Uint8Array) => void; +} + +export function isPosix(platform: NodeJS.Platform = process.platform): boolean { + return platform !== "win32"; +} + +export function isErrnoCode(err: unknown, code: string): boolean { + return ( + typeof err === "object" && + err !== null && + "code" in err && + (err as { readonly code?: unknown }).code === code + ); +} + +export function wrapIoError(err: unknown, context: string): FileManagerError { + if (err instanceof FileManagerError) { + return err; + } + if (isErrnoCode(err, "ENOENT")) { + return new FileManagerError("not_found", `${context}: path does not exist`); + } + if (isErrnoCode(err, "ELOOP")) { + return new FileManagerError("symlink_forbidden", `${context}: symbolic link is not allowed`); + } + if (isErrnoCode(err, "EEXIST")) { + return new FileManagerError("already_exists", `${context}: target already exists`); + } + if (isErrnoCode(err, "ENOTDIR")) { + return new FileManagerError("not_a_directory", `${context}: path component is not a directory`); + } + if (isErrnoCode(err, "EISDIR")) { + return new FileManagerError("is_a_directory", `${context}: path is a directory`); + } + const message = err instanceof Error ? err.message : String(err); + return new FileManagerError("io_error", `${context}: ${message}`); +} + +function hasControlChars(value: string): boolean { + for (let i = 0; i < value.length; i++) { + const code = value.charCodeAt(i); + if (code <= 0x1f || code === 0x7f) { + return true; + } + } + return false; +} + +function assertNormalizedAndSafeChars(value: string, label: string): void { + if (hasControlChars(value)) { + throw new FileManagerError("invalid_path", `${label} contains control or NUL characters`); + } + const normalized = value.normalize("NFC"); + if (normalized !== value || hasControlChars(normalized)) { + throw new FileManagerError("invalid_path", `${label} must be NFC-normalized Unicode`); + } + if (value.includes("\\")) { + throw new FileManagerError("path_traversal", `${label} must not contain backslashes`); + } +} + +export function validateServerId(serverId: string): string { + if ( + typeof serverId !== "string" || + !SERVER_ID_PATTERN.test(serverId) || + FORBIDDEN_COMPONENT_NAMES.has(serverId.toLowerCase()) + ) { + throw new FileManagerError("invalid_server_id", "Invalid server_id"); + } + return serverId; +} + +function validateSegment(segment: string): void { + if (segment.length === 0) { + throw new FileManagerError("invalid_path", "Path must not contain empty segments"); + } + if (segment === "." || segment === "..") { + throw new FileManagerError("path_traversal", `Forbidden path segment "${segment}"`); + } + if (FORBIDDEN_COMPONENT_NAMES.has(segment.toLowerCase())) { + throw new FileManagerError("path_traversal", `Access to "${segment}" is forbidden`); + } + if (ENCODED_TRAVERSAL_REGEX.test(segment)) { + throw new FileManagerError("path_traversal", "Encoded path separator or NUL is forbidden"); + } + if (Buffer.byteLength(segment, "utf8") > MAX_COMPONENT_BYTES) { + throw new FileManagerError( + "invalid_path", + `Path component exceeds ${MAX_COMPONENT_BYTES} bytes`, + ); + } + if (segment.endsWith(".") || segment.endsWith(" ")) { + throw new FileManagerError("invalid_path", "Path component must not end with dot or space"); + } + if (RESERVED_WINDOWS_NAME_REGEX.test(segment)) { + throw new FileManagerError("invalid_path", `Reserved device name "${segment}" is forbidden`); + } +} + +export function validateSingleFileName(name: string): string { + if (typeof name !== "string" || name.length === 0) { + throw new FileManagerError("invalid_path", "File name must not be empty"); + } + assertNormalizedAndSafeChars(name, "File name"); + if (name.includes("/") || WINDOWS_DRIVE_PREFIX_REGEX.test(name)) { + throw new FileManagerError("path_traversal", "File name must be a single path component"); + } + validateSegment(name); + return name; +} + +export function parseAndValidateRelativePath( + relPath: string, + allowRoot: boolean, +): readonly string[] { + if (typeof relPath !== "string") { + throw new FileManagerError("invalid_path", "Path must be a string"); + } + assertNormalizedAndSafeChars(relPath, "Path"); + + if (Buffer.byteLength(relPath, "utf8") > MAX_PATH_BYTES) { + throw new FileManagerError("invalid_path", `Path exceeds maximum length of ${MAX_PATH_BYTES}`); + } + + if (relPath === "" || relPath === ".") { + if (!allowRoot) { + throw new FileManagerError( + "root_operation_forbidden", + "Operation is not permitted on the server root", + ); + } + return []; + } + + if (relPath.startsWith("/") || WINDOWS_DRIVE_PREFIX_REGEX.test(relPath)) { + throw new FileManagerError("path_traversal", "Absolute paths are forbidden"); + } + + const segments = relPath.split("/"); + for (const segment of segments) { + validateSegment(segment); + } + return segments; +} + +function normalizeForPrefixComparison(p: string): string { + return process.platform === "win32" ? p.toLowerCase() : p; +} + +function isStrictlyInsideOrEqual(root: string, candidate: string, allowEqual: boolean): boolean { + const normRoot = normalizeForPrefixComparison(root); + const normCandidate = normalizeForPrefixComparison(candidate); + if (allowEqual && normCandidate === normRoot) { + return true; + } + const prefix = normRoot.endsWith(sep) ? normRoot : `${normRoot}${sep}`; + return normCandidate.startsWith(prefix); +} + +export function resolveServerRoot( + serverId: string, + serversBaseDir: string = DEFAULT_SERVERS_BASE_DIR, +): { readonly serverRoot: string; readonly realServerRoot: string } { + validateServerId(serverId); + const baseDir = resolve(serversBaseDir); + const serverRoot = resolve(baseDir, serverId); + + if (!isStrictlyInsideOrEqual(baseDir, serverRoot, false)) { + throw new FileManagerError("invalid_server_id", "Server root escaped base directory"); + } + + let rootStats: Stats; + try { + rootStats = lstatSync(serverRoot); + } catch (err) { + if (isErrnoCode(err, "ENOENT")) { + throw new FileManagerError("server_not_found", `Server directory does not exist`); + } + throw wrapIoError(err, "Failed to inspect server root"); + } + + if (rootStats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Server root must not be a symbolic link"); + } + if (!rootStats.isDirectory()) { + throw new FileManagerError("server_not_found", "Server root is not a directory"); + } + + let realServerRoot: string; + try { + realServerRoot = realpathSync(serverRoot); + } catch (err) { + throw wrapIoError(err, "Failed to resolve server root"); + } + + return { serverRoot, realServerRoot }; +} + +export function assertNoSymlinkSegments( + serverRoot: string, + realServerRoot: string, + segments: readonly string[], +): void { + let rootStats: Stats; + try { + rootStats = lstatSync(serverRoot); + } catch (err) { + if (isErrnoCode(err, "ENOENT")) { + throw new FileManagerError("server_not_found", "Server directory does not exist"); + } + throw wrapIoError(err, "Failed to inspect server root"); + } + if (rootStats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Server root must not be a symbolic link"); + } + if (!rootStats.isDirectory()) { + throw new FileManagerError("server_not_found", "Server root is not a directory"); + } + + let current = serverRoot; + for (let i = 0; i < segments.length; i++) { + const seg = segments[i]; + if (seg === undefined) { + continue; + } + current = join(current, seg); + let stats: Stats; + try { + stats = lstatSync(current); + } catch (err) { + if (isErrnoCode(err, "ENOENT")) { + break; + } + throw wrapIoError(err, "Failed to inspect path component"); + } + + if (stats.isSymbolicLink()) { + throw new FileManagerError( + "symlink_forbidden", + `Symbolic link encountered at segment "${seg}"`, + ); + } + + let realCurrent: string; + try { + realCurrent = realpathSync(current); + } catch (err) { + throw wrapIoError(err, "Failed to resolve real path"); + } + + if (!isStrictlyInsideOrEqual(realServerRoot, realCurrent, false)) { + throw new FileManagerError("path_traversal", "Real path escaped server root"); + } + + if (i < segments.length - 1 && !stats.isDirectory()) { + throw new FileManagerError( + "not_a_directory", + `Intermediate path component "${seg}" is not a directory`, + ); + } + } +} + +export function resolveConfinedPath(options: ResolveConfinedPathOptions): ConfinedPath { + const allowRoot = options.allowRoot ?? false; + const serverId = validateServerId(options.serverId); + const segments = parseAndValidateRelativePath(options.relPath, allowRoot); + const { serverRoot, realServerRoot } = resolveServerRoot( + serverId, + options.serversBaseDir ?? DEFAULT_SERVERS_BASE_DIR, + ); + + assertNoSymlinkSegments(serverRoot, realServerRoot, segments); + + const fullPath = resolve(serverRoot, ...segments); + if (!isStrictlyInsideOrEqual(serverRoot, fullPath, allowRoot)) { + throw new FileManagerError("path_traversal", "Resolved path escaped server root"); + } + + return { + serverId, + serverRoot, + realServerRoot, + relativePath: segments.join("/"), + segments, + fullPath, + }; +} + +export function assertNoSymlinkPath(resolved: ConfinedPath): void { + assertNoSymlinkSegments(resolved.serverRoot, resolved.realServerRoot, resolved.segments); +} + +export function openConfinedFileForRead(resolved: ConfinedPath): { + readonly fd: number; + readonly stats: Stats; +} { + if (resolved.segments.length === 0) { + throw new FileManagerError("root_operation_forbidden", "Cannot open server root as a file"); + } + assertNoSymlinkPath(resolved); + + let preStat: Stats; + try { + preStat = lstatSync(resolved.fullPath); + } catch (err) { + throw wrapIoError(err, "Failed to stat target file"); + } + + if (preStat.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Target file is a symbolic link"); + } + if (preStat.isDirectory()) { + throw new FileManagerError("is_a_directory", "Target path is a directory"); + } + if (!preStat.isFile()) { + throw new FileManagerError("not_a_file", "Target path is not a regular file"); + } + + const noFollow = fsConstants.O_NOFOLLOW ?? 0; + let fd: number; + try { + fd = openSync(resolved.fullPath, fsConstants.O_RDONLY | noFollow); + } catch (err) { + throw wrapIoError(err, "Failed to open target file"); + } + + try { + const fdStat = fstatSync(fd); + if (!fdStat.isFile()) { + throw new FileManagerError("not_a_file", "Opened descriptor is not a regular file"); + } + if (preStat.dev !== fdStat.dev || preStat.ino !== fdStat.ino) { + throw new FileManagerError("toctou_detected", "File identity changed between lstat and open"); + } + return { fd, stats: fdStat }; + } catch (err) { + try { + closeSync(fd); + } catch { + // ignore close error on failure path + } + throw err; + } +} + +export function mkdirConfined(options: { + readonly serversBaseDir?: string; + readonly serverId: string; + readonly relPath: string; + readonly mode?: number; +}): ConfinedPath { + const mode = options.mode ?? DEFAULT_DIR_MODE; + const resolved = resolveConfinedPath({ + ...(options.serversBaseDir !== undefined ? { serversBaseDir: options.serversBaseDir } : {}), + serverId: options.serverId, + relPath: options.relPath, + allowRoot: false, + }); + + let current = resolved.serverRoot; + for (const seg of resolved.segments) { + current = join(current, seg); + let stats: Stats | undefined; + try { + stats = lstatSync(current); + } catch (err) { + if (!isErrnoCode(err, "ENOENT")) { + throw wrapIoError(err, "Failed to inspect directory component"); + } + } + + if (stats === undefined) { + try { + mkdirSync(current, { mode }); + } catch (err) { + if (!isErrnoCode(err, "EEXIST")) { + throw wrapIoError(err, "Failed to create directory"); + } + } + try { + stats = lstatSync(current); + } catch (err) { + throw wrapIoError(err, "Failed to verify created directory"); + } + } + + if (stats.isSymbolicLink()) { + throw new FileManagerError( + "symlink_forbidden", + `Symbolic link encountered at segment "${seg}"`, + ); + } + if (!stats.isDirectory()) { + throw new FileManagerError("not_a_directory", `Path component "${seg}" is not a directory`); + } + + const realCurrent = realpathSync(current); + if (!isStrictlyInsideOrEqual(resolved.realServerRoot, realCurrent, false)) { + throw new FileManagerError("path_traversal", "Directory escaped server root"); + } + } + + return resolved; +} + +function writeAllBytes(fd: number, data: Uint8Array): void { + let offset = 0; + while (offset < data.byteLength) { + const written = writeSync(fd, data, offset, data.byteLength - offset); + if (written <= 0) { + throw new FileManagerError("io_error", "Short write while persisting file"); + } + offset += written; + } +} + +export function writeConfinedFileAtomic( + resolved: ConfinedPath, + data: Uint8Array, + options: AtomicWriteOptions = {}, +): void { + if (resolved.segments.length === 0) { + throw new FileManagerError("root_operation_forbidden", "Cannot write directly to server root"); + } + + const mode = options.mode ?? DEFAULT_FILE_MODE; + const parentSegments = resolved.segments.slice(0, -1); + + if (options.createParents && parentSegments.length > 0) { + mkdirConfined({ + serversBaseDir: dirname(resolved.serverRoot), + serverId: resolved.serverId, + relPath: parentSegments.join("/"), + }); + } + + assertNoSymlinkPath(resolved); + + const parentDir = dirname(resolved.fullPath); + let parentStats: Stats; + try { + parentStats = lstatSync(parentDir); + } catch (err) { + throw wrapIoError(err, "Parent directory does not exist"); + } + if (parentStats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Parent directory must not be a symbolic link"); + } + if (!parentStats.isDirectory()) { + throw new FileManagerError("not_a_directory", "Parent path is not a directory"); + } + + let existingTarget: Stats | undefined; + try { + existingTarget = lstatSync(resolved.fullPath); + } catch (err) { + if (!isErrnoCode(err, "ENOENT")) { + throw wrapIoError(err, "Failed to inspect target path"); + } + } + if (existingTarget !== undefined) { + if (existingTarget.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Refusing to overwrite symbolic link"); + } + if (existingTarget.isDirectory()) { + throw new FileManagerError("is_a_directory", "Refusing to overwrite directory with file"); + } + } + + const suffix = randomBytes(8).toString("hex"); + const tmpPath = join(parentDir, `.tmp-${basename(resolved.fullPath)}-${process.pid}-${suffix}`); + const noFollow = fsConstants.O_NOFOLLOW ?? 0; + const flags = fsConstants.O_CREAT | fsConstants.O_EXCL | fsConstants.O_WRONLY | noFollow; + + let fd: number | undefined; + let renamed = false; + + try { + fd = openSync(tmpPath, flags, mode); + if (options.writeHook !== undefined) { + options.writeHook(fd, data); + } else { + writeAllBytes(fd, data); + } + fsyncSync(fd); + closeSync(fd); + fd = undefined; + + if (isPosix()) { + chmodSync(tmpPath, mode); + } + + // Re-validate full path right before atomic rename to mitigate TOCTOU. + assertNoSymlinkPath(resolved); + let preRenameTarget: Stats | undefined; + try { + preRenameTarget = lstatSync(resolved.fullPath); + } catch (err) { + if (!isErrnoCode(err, "ENOENT")) { + throw wrapIoError(err, "Failed to re-validate target before rename"); + } + } + if (preRenameTarget !== undefined) { + if (preRenameTarget.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Target became a symbolic link"); + } + if (preRenameTarget.isDirectory()) { + throw new FileManagerError("is_a_directory", "Target became a directory"); + } + } + + renameSync(tmpPath, resolved.fullPath); + renamed = true; + } catch (err) { + if (fd !== undefined) { + try { + closeSync(fd); + } catch { + // ignore cleanup close error + } + } + if (!renamed) { + try { + unlinkSync(tmpPath); + } catch { + // ignore cleanup unlink error + } + } + throw wrapIoError(err, "Failed to write file atomically"); + } +} diff --git a/src/files/errors.ts b/src/files/errors.ts new file mode 100644 index 0000000..f6a7801 --- /dev/null +++ b/src/files/errors.ts @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +export type FileErrorCode = + | "invalid_server_id" + | "server_not_found" + | "invalid_path" + | "path_traversal" + | "symlink_forbidden" + | "root_operation_forbidden" + | "not_found" + | "already_exists" + | "not_a_file" + | "not_a_directory" + | "is_a_directory" + | "file_too_large" + | "copy_limit_exceeded" + | "toctou_detected" + | "invalid_encoding" + | "upload_not_found" + | "upload_limit_exceeded" + | "part_too_large" + | "part_out_of_order" + | "size_mismatch" + | "hash_mismatch" + | "download_not_found" + | "download_limit_exceeded" + | "zip_invalid" + | "zip_slip" + | "zip_symlink_entry" + | "zip_too_many_entries" + | "zip_too_large" + | "zip_entry_too_large" + | "zip_compression_ratio_exceeded" + | "zip_crc_mismatch" + | "zip_unsupported_method" + | "io_error"; + +export class FileManagerError extends Error { + readonly code: FileErrorCode; + + constructor(code: FileErrorCode, message: string) { + super(message); + this.name = "FileManagerError"; + this.code = code; + } +} diff --git a/src/files/index.ts b/src/files/index.ts new file mode 100644 index 0000000..139b784 --- /dev/null +++ b/src/files/index.ts @@ -0,0 +1,84 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +export { + type AtomicWriteOptions, + assertNoSymlinkPath, + assertNoSymlinkSegments, + type ConfinedPath, + DEFAULT_SERVERS_BASE_DIR, + MAX_COMPONENT_BYTES, + MAX_PATH_BYTES, + mkdirConfined, + openConfinedFileForRead, + parseAndValidateRelativePath, + type ResolveConfinedPathOptions, + resolveConfinedPath, + resolveServerRoot, + validateServerId, + validateSingleFileName, + writeConfinedFileAtomic, +} from "./confinement"; +export { type FileErrorCode, FileManagerError } from "./errors"; +export { + DEFAULT_MAX_COPY_BYTES, + DEFAULT_MAX_COPY_FILES, + type FileCopyResult, + type FileEncoding, + type FileListEntry, + type FileListResult, + FileManager, + type FileManagerOptions, + type FileReadResult, + type FileStatResult, + type FileWriteResult, + MAX_READ_WRITE_BYTES, + registerFileCommandHandlers, +} from "./manager"; +export { + DEFAULT_MAX_CONCURRENT_DOWNLOADS, + DEFAULT_MAX_CONCURRENT_UPLOADS, + DEFAULT_MAX_PART_BYTES, + DEFAULT_MAX_UPLOAD_BYTES, + DEFAULT_PART_BYTES, + type DownloadBeginParams, + type DownloadBeginResult, + type DownloadCloseParams, + type DownloadPartParams, + type DownloadPartResult, + type DownloadRangeParams, + type DownloadRangeResult, + decodeStrictBase64, + sha256Hex, + TransferManager, + type TransferManagerOptions, + type UploadAbortParams, + type UploadBeginParams, + type UploadBeginResult, + type UploadCommitParams, + type UploadCommitResult, + type UploadPartParams, + type UploadPartResult, +} from "./transfers"; +export { + crc32, + createZipBuffer, + DEFAULT_MAX_ZIP_FILE_BYTES, + DEFAULT_ZIP_RATIO_MIN_BYTES, + MAX_ZIP_COMPRESSION_RATIO, + MAX_ZIP_CREATE_BYTES, + MAX_ZIP_CREATE_FILES, + MAX_ZIP_ENTRIES, + MAX_ZIP_ENTRY_BYTES, + MAX_ZIP_UNCOMPRESSED_BYTES, + type SafeUnzipBufferOptions, + type SafeUnzipFileOptions, + type SafeUnzipOptions, + type SafeUnzipResult, + type SafeZipFilesOptions, + type SafeZipResult, + safeUnzipBuffer, + safeUnzipFile, + safeZipFiles, + type ZipEntryInput, +} from "./zip"; diff --git a/src/files/manager.test.ts b/src/files/manager.test.ts new file mode 100644 index 0000000..5340b36 --- /dev/null +++ b/src/files/manager.test.ts @@ -0,0 +1,801 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeAll, beforeEach, describe, expect, test } from "bun:test"; +import { + existsSync, + mkdirSync, + mkdtempSync, + readdirSync, + readFileSync, + rmSync, + symlinkSync, + writeFileSync, +} from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { z } from "zod"; +import { createCommandQueue, type TransportCommandFrame } from "../agent/jobs"; +import { createLogger } from "../agent/logger"; +import { fingerprint, generateSigningKeyPair, ready } from "../crypto"; +import { + CommandRegistry, + createCoreRegistry, + createInMemoryTrustContext, + createSignedCommand, + defineCommand, + FILES_COMMANDS, + openAgentMessage, + openCommand, + PROTOCOL_VERSION, + ProtocolError, + type SignedCommand, + signSessionCertificate, + type TransportFrame, +} from "../protocol"; +import { type FileErrorCode, FileManagerError } from "./errors"; +import { FileManager, MAX_READ_WRITE_BYTES, registerFileCommandHandlers } from "./manager"; +import { sha256Hex } from "./transfers"; + +function expectFileError(fn: () => unknown, code: FileErrorCode): void { + try { + fn(); + throw new Error(`Expected FileManagerError(${code}), but succeeded`); + } catch (err) { + expect(err).toBeInstanceOf(FileManagerError); + expect((err as FileManagerError).code).toBe(code); + } +} + +function createDirLink(target: string, linkPath: string): void { + if (process.platform === "win32") { + symlinkSync(target, linkPath, "junction"); + } else { + symlinkSync(target, linkPath, "dir"); + } +} + +function tryCreateFileSymlink(target: string, linkPath: string): boolean { + try { + symlinkSync(target, linkPath, "file"); + return true; + } catch (err) { + const code = + typeof err === "object" && err !== null && "code" in err + ? (err as { code?: unknown }).code + : undefined; + if (process.platform === "win32" && code === "EPERM") { + return false; + } + throw err; + } +} + +function wrapCommand(agentId: string, body: SignedCommand): TransportCommandFrame { + return { + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: agentId }, + body, + }; +} + +function makeSilentLogger() { + return createLogger({ + level: "error", + stdout: () => {}, + stderr: () => {}, + }); +} + +beforeAll(async () => { + await ready(); +}); + +describe("FileManager", () => { + let rootTmp: string; + let serversDir: string; + let outsideDir: string; + const serverId = "mc-prod-1"; + let serverDir: string; + let manager: FileManager; + + beforeEach(() => { + rootTmp = mkdtempSync(join(tmpdir(), "tegrad-fm-")); + serversDir = join(rootTmp, "servers"); + outsideDir = join(rootTmp, "outside"); + serverDir = join(serversDir, serverId); + mkdirSync(serverDir, { recursive: true }); + mkdirSync(outsideDir, { recursive: true }); + writeFileSync(join(outsideDir, "host-secret.txt"), "do-not-leak"); + manager = new FileManager({ serversBaseDir: serversDir }); + }); + + afterEach(() => { + manager.dispose(); + rmSync(rootTmp, { recursive: true, force: true }); + }); + + test("supports full CRUD, mkdir, rename, move, copy, delete, list, and stat", () => { + manager.mkdir({ server_id: serverId, path: "config/nested" }); + manager.write({ + server_id: serverId, + path: "config/nested/app.yml", + content: "difficulty: hard\n", + }); + + const readUtf8 = manager.read({ server_id: serverId, path: "config/nested/app.yml" }); + expect(readUtf8.content).toBe("difficulty: hard\n"); + expect(readUtf8.size).toBe(17); + + const readB64 = manager.read({ + server_id: serverId, + path: "config/nested/app.yml", + encoding: "base64", + }); + expect(Buffer.from(readB64.content, "base64").toString("utf8")).toBe("difficulty: hard\n"); + + const statExisting = manager.stat({ server_id: serverId, path: "config/nested/app.yml" }); + expect(statExisting.exists).toBe(true); + expect(statExisting.type).toBe("file"); + expect(statExisting.size).toBe(17); + + const statMissing = manager.stat({ server_id: serverId, path: "does-not-exist.txt" }); + expect(statMissing).toEqual({ path: "does-not-exist.txt", exists: false }); + + const renamed = manager.rename({ + server_id: serverId, + path: "config/nested/app.yml", + new_name: "settings.yml", + }); + expect(renamed).toEqual({ + from_path: "config/nested/app.yml", + to_path: "config/nested/settings.yml", + }); + + const copied = manager.copy({ + server_id: serverId, + from_path: "config", + to_path: "config-backup", + }); + expect(copied.files_copied).toBe(1); + expect(copied.bytes_copied).toBe(17); + + manager.move({ + server_id: serverId, + from_path: "config-backup/nested/settings.yml", + to_path: "moved.yml", + }); + expect(manager.read({ server_id: serverId, path: "moved.yml" }).content).toBe( + "difficulty: hard\n", + ); + + const listed = manager.list({ server_id: serverId }); + expect(listed.entries.map((e) => `${e.name}:${e.type}`)).toEqual([ + "config:directory", + "config-backup:directory", + "moved.yml:file", + ]); + + // Deleting non-empty directory without recursive fails + expectFileError( + () => manager.delete({ server_id: serverId, path: "config", recursive: false }), + "is_a_directory", + ); + // Recursive delete succeeds + manager.delete({ server_id: serverId, path: "config", recursive: true }); + expect(manager.stat({ server_id: serverId, path: "config" }).exists).toBe(false); + }); + + test("enforces strict 2 MiB ceiling on read and write", () => { + const exactLimit = "A".repeat(MAX_READ_WRITE_BYTES); + const overLimit = "A".repeat(MAX_READ_WRITE_BYTES + 1); + + const wrote = manager.write({ + server_id: serverId, + path: "exact-2mib.txt", + content: exactLimit, + }); + expect(wrote.size).toBe(MAX_READ_WRITE_BYTES); + expect(readdirSync(serverDir).filter((n) => n.startsWith(".tmp-"))).toEqual([]); + + const readBack = manager.read({ server_id: serverId, path: "exact-2mib.txt" }); + expect(readBack.size).toBe(MAX_READ_WRITE_BYTES); + + // 2 MiB + 1 byte fails on write (utf8 and base64) + expectFileError( + () => manager.write({ server_id: serverId, path: "too-big.txt", content: overLimit }), + "file_too_large", + ); + expectFileError( + () => + manager.write({ + server_id: serverId, + path: "too-big-b64.bin", + content: Buffer.alloc(MAX_READ_WRITE_BYTES + 1, 0x42).toString("base64"), + encoding: "base64", + }), + "file_too_large", + ); + + // Pre-existing file of 2 MiB + 1 byte fails on read + writeFileSync(join(serverDir, "large-on-disk.bin"), Buffer.alloc(MAX_READ_WRITE_BYTES + 1)); + expectFileError( + () => manager.read({ server_id: serverId, path: "large-on-disk.bin" }), + "file_too_large", + ); + }); + + test("refuses deleting server root or .runtime", () => { + for (const target of ["", "."]) { + expectFileError( + () => manager.delete({ server_id: serverId, path: target, recursive: true }), + "root_operation_forbidden", + ); + } + expectFileError( + () => manager.delete({ server_id: serverId, path: "/", recursive: true }), + "path_traversal", + ); + expectFileError( + () => manager.delete({ server_id: serverId, path: ".runtime", recursive: true }), + "path_traversal", + ); + expect(existsSync(serverDir)).toBe(true); + }); + + test("refuses symlinks/junctions across all operations and hides them in list", () => { + createDirLink(outsideDir, join(serverDir, "escape-dir")); + mkdirSync(join(serverDir, "normal")); + createDirLink(outsideDir, join(serverDir, "normal", "nested-link")); + writeFileSync(join(serverDir, "regular.txt"), "ok"); + + // list ignores symlinks/junctions without following them + const listed = manager.list({ server_id: serverId }); + expect(listed.entries.map((e) => e.name)).toEqual(["normal", "regular.txt"]); + + // stat, read, write, delete, copy, move, mkdir, zip, unzip all refuse junction/symlink + expectFileError( + () => manager.stat({ server_id: serverId, path: "escape-dir" }), + "symlink_forbidden", + ); + expectFileError( + () => manager.read({ server_id: serverId, path: "escape-dir/host-secret.txt" }), + "symlink_forbidden", + ); + expectFileError( + () => + manager.write({ + server_id: serverId, + path: "escape-dir/pwn.txt", + content: "pwn", + }), + "symlink_forbidden", + ); + expectFileError( + () => manager.delete({ server_id: serverId, path: "escape-dir", recursive: true }), + "symlink_forbidden", + ); + expectFileError( + () => manager.delete({ server_id: serverId, path: "normal", recursive: true }), + "symlink_forbidden", + ); + expectFileError( + () => + manager.copy({ + server_id: serverId, + from_path: "normal", + to_path: "normal-copy", + }), + "symlink_forbidden", + ); + expectFileError( + () => + manager.move({ + server_id: serverId, + from_path: "escape-dir", + to_path: "moved-link", + }), + "symlink_forbidden", + ); + expectFileError( + () => manager.mkdir({ server_id: serverId, path: "escape-dir/sub" }), + "symlink_forbidden", + ); + expectFileError( + () => + manager.zip({ + server_id: serverId, + paths: ["normal"], + dest_path: "bad.zip", + }), + "symlink_forbidden", + ); + + // Also test file symlink if OS permits creating one + const fileSymPath = join(serverDir, "secret-file-link.txt"); + if (tryCreateFileSymlink(join(outsideDir, "host-secret.txt"), fileSymPath)) { + expectFileError( + () => manager.read({ server_id: serverId, path: "secret-file-link.txt" }), + "symlink_forbidden", + ); + expectFileError( + () => + manager.write({ + server_id: serverId, + path: "secret-file-link.txt", + content: "overwrite", + }), + "symlink_forbidden", + ); + expectFileError( + () => manager.stat({ server_id: serverId, path: "secret-file-link.txt" }), + "symlink_forbidden", + ); + expectFileError( + () => manager.delete({ server_id: serverId, path: "secret-file-link.txt" }), + "symlink_forbidden", + ); + } + + // Outside secret file remains untouched! + expect(readFileSync(join(outsideDir, "host-secret.txt"), "utf8")).toBe("do-not-leak"); + }); + + test("copy enforces file count and byte limits and prevents self-nesting", () => { + const limited = new FileManager({ + serversBaseDir: serversDir, + maxCopyFiles: 2, + maxCopyBytes: 100, + }); + limited.mkdir({ server_id: serverId, path: "src" }); + limited.write({ server_id: serverId, path: "src/a.txt", content: "a".repeat(60) }); + limited.write({ server_id: serverId, path: "src/b.txt", content: "b".repeat(60) }); + + expectFileError( + () => limited.copy({ server_id: serverId, from_path: "src", to_path: "src/sub" }), + "invalid_path", + ); + expectFileError( + () => limited.copy({ server_id: serverId, from_path: "src", to_path: "dst" }), + "copy_limit_exceeded", + ); + limited.dispose(); + }); + + test("chunked upload reconstructs multi-part file when SHA-256 matches and cleans up staging", () => { + const part0 = new TextEncoder().encode("first-part-content-"); + const part1 = new TextEncoder().encode("second-part-content-"); + const part2 = new TextEncoder().encode("final-part!"); + const full = new Uint8Array(part0.byteLength + part1.byteLength + part2.byteLength); + full.set(part0, 0); + full.set(part1, part0.byteLength); + full.set(part2, part0.byteLength + part1.byteLength); + const expectedHash = sha256Hex(full); + + const began = manager.uploadBegin({ + server_id: serverId, + path: "mods/example.jar", + total_size: full.byteLength, + sha256: expectedHash, + part_size: 64, + }); + + manager.uploadPart({ + server_id: serverId, + upload_id: began.upload_id, + part_index: 0, + data_base64: Buffer.from(part0).toString("base64"), + }); + manager.uploadPart({ + server_id: serverId, + upload_id: began.upload_id, + part_index: 1, + data_base64: Buffer.from(part1).toString("base64"), + }); + manager.uploadPart({ + server_id: serverId, + upload_id: began.upload_id, + part_index: 2, + data_base64: Buffer.from(part2).toString("base64"), + }); + + const committed = manager.uploadCommit({ + server_id: serverId, + upload_id: began.upload_id, + }); + + expect(committed.path).toBe("mods/example.jar"); + expect(committed.size).toBe(full.byteLength); + expect(committed.sha256).toBe(expectedHash); + expect(new Uint8Array(readFileSync(join(serverDir, "mods", "example.jar")))).toEqual(full); + expect(readdirSync(serverDir).filter((n) => n.startsWith(".tmp-"))).toEqual([]); + }); + + test("chunked upload rejects wrong SHA-256, deletes staging, and leaves destination untouched", () => { + writeFileSync(join(serverDir, "existing.bin"), "original-content"); + const payload = new TextEncoder().encode("malicious-replacement"); + const wrongHash = "0".repeat(64); + + const began = manager.uploadBegin({ + server_id: serverId, + path: "existing.bin", + total_size: payload.byteLength, + sha256: wrongHash, + }); + manager.uploadPart({ + server_id: serverId, + upload_id: began.upload_id, + part_index: 0, + data_base64: Buffer.from(payload).toString("base64"), + }); + + expectFileError( + () => manager.uploadCommit({ server_id: serverId, upload_id: began.upload_id }), + "hash_mismatch", + ); + + expect(readFileSync(join(serverDir, "existing.bin"), "utf8")).toBe("original-content"); + expect(readdirSync(serverDir).filter((n) => n.startsWith(".tmp-"))).toEqual([]); + }); + + test("chunked upload rejects overflow bytes, out-of-order parts, and incomplete commits", () => { + const payload = new TextEncoder().encode("1234567890"); + const began = manager.uploadBegin({ + server_id: serverId, + path: "data.bin", + total_size: 10, + sha256: sha256Hex(payload), + }); + + // Out of order part_index + expectFileError( + () => + manager.uploadPart({ + server_id: serverId, + upload_id: began.upload_id, + part_index: 1, + data_base64: Buffer.from("12345").toString("base64"), + }), + "part_out_of_order", + ); + + // Valid part 0 (6 bytes) + manager.uploadPart({ + server_id: serverId, + upload_id: began.upload_id, + part_index: 0, + data_base64: Buffer.from("123456").toString("base64"), + }); + + // Overflowing total_size (6 + 5 > 10) + expectFileError( + () => + manager.uploadPart({ + server_id: serverId, + upload_id: began.upload_id, + part_index: 1, + data_base64: Buffer.from("78901").toString("base64"), + }), + "size_mismatch", + ); + + // Committing before all 10 bytes arrive fails and cleans up staging + expectFileError( + () => manager.uploadCommit({ server_id: serverId, upload_id: began.upload_id }), + "size_mismatch", + ); + expect(existsSync(join(serverDir, "data.bin"))).toBe(false); + expect(readdirSync(serverDir).filter((n) => n.startsWith(".tmp-"))).toEqual([]); + }); + + test("chunked upload rejects symlink/junction planted between begin and commit and cleans staging", () => { + const payload = new TextEncoder().encode("payload"); + const began = manager.uploadBegin({ + server_id: serverId, + path: "planted-dir/target.txt", + total_size: payload.byteLength, + sha256: sha256Hex(payload), + }); + manager.uploadPart({ + server_id: serverId, + upload_id: began.upload_id, + part_index: 0, + data_base64: Buffer.from(payload).toString("base64"), + }); + + // Attacker plants a directory junction before commit + createDirLink(outsideDir, join(serverDir, "planted-dir")); + + expectFileError( + () => manager.uploadCommit({ server_id: serverId, upload_id: began.upload_id }), + "symlink_forbidden", + ); + expect(existsSync(join(outsideDir, "target.txt"))).toBe(false); + expect(readdirSync(serverDir).filter((n) => n.startsWith(".tmp-"))).toEqual([]); + }); + + test("chunked download and ranged download reconstruct file with SHA-256", () => { + const content = new TextEncoder().encode("0123456789abcdefghijKLMNO"); + writeFileSync(join(serverDir, "world.bin"), content); + + const began = manager.downloadBegin({ + server_id: serverId, + path: "world.bin", + part_size: 10, + }); + expect(began.total_size).toBe(25); + expect(began.total_parts).toBe(3); + + const chunks: Buffer[] = []; + for (let i = 0; i < began.total_parts; i++) { + const part = manager.downloadPart({ + server_id: serverId, + download_id: began.download_id, + part_index: i, + }); + const decoded = Buffer.from(part.data_base64, "base64"); + expect(sha256Hex(new Uint8Array(decoded))).toBe(part.sha256); + expect(part.eof).toBe(i === began.total_parts - 1); + chunks.push(decoded); + } + manager.downloadClose({ server_id: serverId, download_id: began.download_id }); + expect(new Uint8Array(Buffer.concat(chunks))).toEqual(content); + + // Direct ranged download + const range = manager.download({ + server_id: serverId, + path: "world.bin", + offset: 10, + length: 10, + }); + expect(Buffer.from(range.data_base64, "base64").toString("utf8")).toBe("abcdefghij"); + expect(range.eof).toBe(false); + }); +}); + +describe("protocol integration (CommandRegistry, openCommand, CommandQueue)", () => { + let rootTmp: string; + let serversDir: string; + const serverId = "srv-proto"; + + beforeEach(() => { + rootTmp = mkdtempSync(join(tmpdir(), "tegrad-fm-proto-")); + serversDir = join(rootTmp, "servers"); + mkdirSync(join(serversDir, serverId), { recursive: true }); + }); + + afterEach(() => { + rmSync(rootTmp, { recursive: true, force: true }); + }); + + test("registers all FILES_COMMANDS in createCoreRegistry and enforces files.delete as sensitive", async () => { + const registry = createCoreRegistry(); + for (const def of FILES_COMMANDS) { + expect(registry.has(def.type)).toBe(true); + } + expect(registry.get("files.delete")?.sensitive).toBe(true); + expect(registry.get("files.read")?.sensitive).toBe(false); + expect(registry.get("files.write")?.sensitive).toBe(false); + + const account = generateSigningKeyPair(); + const session = generateSigningKeyPair(); + const agent = generateSigningKeyPair(); + const now = 1_700_000_000_000; + + const sessionCert = signSessionCertificate({ + sessionPublicKey: session.publicKey, + accountKeyPair: account, + notBefore: now - 60_000, + notAfter: now + 3_600_000, + }); + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [account.publicKey], + now: () => now, + }); + + // Session key CANNOT execute files.delete (sensitive: true) + const sessionDeleteCmd = createSignedCommand( + { + type: "files.delete", + body: { server_id: serverId, path: "world.txt" }, + agentPublicKey: agent.publicKey, + signer: session, + session: sessionCert, + counter: 1, + now, + }, + registry, + ); + + try { + await openCommand(sessionDeleteCmd, trust, registry); + throw new Error("Expected sensitive_requires_account_key"); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe("sensitive_requires_account_key"); + } + + // Account key CAN execute files.delete + const accountDeleteCmd = createSignedCommand( + { + type: "files.delete", + body: { server_id: serverId, path: "world.txt", recursive: false }, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now, + }, + registry, + ); + const opened = await openCommand(accountDeleteCmd, trust, registry); + expect(opened.header.type).toBe("files.delete"); + expect(opened.body).toEqual({ server_id: serverId, path: "world.txt", recursive: false }); + + // Strict Zod schema rejects malicious server_id at protocol boundary (both client & agent) + const permissiveRegistry = new CommandRegistry().register( + defineCommand({ + type: "files.list", + sensitive: false, + body: z.unknown(), + }), + ); + const badServerIdCmd = createSignedCommand( + { + type: "files.list", + body: { server_id: "../tegrad", path: "" }, + agentPublicKey: agent.publicKey, + signer: session, + session: sessionCert, + counter: 2, + now, + }, + permissiveRegistry, + ); + try { + await openCommand(badServerIdCmd, trust, registry); + throw new Error("Expected invalid_body"); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe("invalid_body"); + } + }); + + test("executes signed files.* commands through CommandQueue and seals result events", async () => { + const account = generateSigningKeyPair(); + const session = generateSigningKeyPair(); + const agent = generateSigningKeyPair(); + const agentId = fingerprint(agent.publicKey); + const now = 1_700_000_000_000; + + const sessionCert = signSessionCertificate({ + sessionPublicKey: session.publicKey, + accountKeyPair: account, + notBefore: now - 60_000, + notAfter: now + 3_600_000, + }); + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [account.publicKey], + now: () => now, + }); + const registry = createCoreRegistry(); + const sent: TransportFrame[] = []; + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (frame) => sent.push(frame), + logger: makeSilentLogger(), + }); + const manager = new FileManager({ serversBaseDir: serversDir }); + registerFileCommandHandlers(queue, manager); + + try { + // 1. files.write signed by session key + const writeCmd = createSignedCommand( + { + type: "files.write", + body: { server_id: serverId, path: "eula.txt", content: "eula=true\n" }, + agentPublicKey: agent.publicKey, + signer: session, + session: sessionCert, + counter: 1, + now, + }, + registry, + ); + await queue.enqueue(wrapCommand(agentId, writeCmd)); + + const writeEvent = sent[0]; + const writeAck = sent[1]; + expect(writeEvent?.kind).toBe("event"); + if (writeEvent?.kind === "event") { + const opened = openAgentMessage(writeEvent.body, agent.publicKey, account); + expect(opened.header.type).toBe("files.write.result"); + expect(opened.body).toEqual({ path: "eula.txt", size: 10 }); + } + expect(writeAck?.kind === "ack" && writeAck.body.ok).toBe(true); + + // 2. files.read signed by session key + const readCmd = createSignedCommand( + { + type: "files.read", + body: { server_id: serverId, path: "eula.txt" }, + agentPublicKey: agent.publicKey, + signer: session, + session: sessionCert, + counter: 2, + now, + }, + registry, + ); + await queue.enqueue(wrapCommand(agentId, readCmd)); + + const readEvent = sent[2]; + expect(readEvent?.kind).toBe("event"); + if (readEvent?.kind === "event") { + const opened = openAgentMessage(readEvent.body, agent.publicKey, account); + expect(opened.header.type).toBe("files.read.result"); + expect(opened.body).toEqual({ + path: "eula.txt", + encoding: "utf8", + content: "eula=true\n", + size: 10, + }); + } + + // 3. files.read with path traversal emits files.error event and handler_error ack + const traversalCmd = createSignedCommand( + { + type: "files.read", + body: { server_id: serverId, path: "../secret.txt" }, + agentPublicKey: agent.publicKey, + signer: session, + session: sessionCert, + counter: 3, + now, + }, + registry, + ); + await queue.enqueue(wrapCommand(agentId, traversalCmd)); + const errEvent = sent[4]; + const errAck = sent[5]; + expect(errEvent?.kind).toBe("event"); + if (errEvent?.kind === "event") { + const opened = openAgentMessage(errEvent.body, agent.publicKey, account); + expect(opened.header.type).toBe("files.error"); + expect((opened.body as { code: string }).code).toBe("path_traversal"); + } + expect( + errAck?.kind === "ack" && !errAck.body.ok && errAck.body.code === "handler_error", + ).toBe(true); + + // 4. files.delete signed by account key + const deleteCmd = createSignedCommand( + { + type: "files.delete", + body: { server_id: serverId, path: "eula.txt" }, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now, + }, + registry, + ); + await queue.enqueue(wrapCommand(agentId, deleteCmd)); + + const deleteEvent = sent[6]; + const deleteAck = sent[7]; + expect(deleteEvent?.kind).toBe("event"); + if (deleteEvent?.kind === "event") { + const opened = openAgentMessage(deleteEvent.body, agent.publicKey, account); + expect(opened.header.type).toBe("files.delete.result"); + expect(opened.body).toEqual({ path: "eula.txt", deleted: true }); + } + expect(deleteAck?.kind === "ack" && deleteAck.body.ok).toBe(true); + } finally { + manager.dispose(); + } + }); +}); diff --git a/src/files/manager.ts b/src/files/manager.ts new file mode 100644 index 0000000..6c16f49 --- /dev/null +++ b/src/files/manager.ts @@ -0,0 +1,924 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { + closeSync, + lstatSync, + readdirSync, + readSync, + renameSync, + rmdirSync, + type Stats, + unlinkSync, +} from "node:fs"; +import { dirname, join } from "node:path"; +import type { CommandQueue } from "../agent/jobs"; +import { + assertNoSymlinkPath, + DEFAULT_SERVERS_BASE_DIR, + isErrnoCode, + mkdirConfined, + openConfinedFileForRead, + resolveConfinedPath, + validateSingleFileName, + wrapIoError, + writeConfinedFileAtomic, +} from "./confinement"; +import { FileManagerError } from "./errors"; +import { + type DownloadBeginParams, + type DownloadBeginResult, + type DownloadCloseParams, + type DownloadPartParams, + type DownloadPartResult, + type DownloadRangeParams, + type DownloadRangeResult, + decodeStrictBase64, + TransferManager, + type UploadAbortParams, + type UploadBeginParams, + type UploadBeginResult, + type UploadCommitParams, + type UploadCommitResult, + type UploadPartParams, + type UploadPartResult, +} from "./transfers"; +import { type SafeUnzipResult, type SafeZipResult, safeUnzipFile, safeZipFiles } from "./zip"; + +export const MAX_READ_WRITE_BYTES = 2 * 1024 * 1024; // 2 MiB +export const DEFAULT_MAX_COPY_FILES = 10_000; +export const DEFAULT_MAX_COPY_BYTES = 2 * 1024 * 1024 * 1024; // 2 GiB + +export type FileEncoding = "utf8" | "base64"; + +export interface FileListEntry { + readonly name: string; + readonly type: "file" | "directory"; + readonly size: number; + readonly mtime_ms: number; +} + +export interface FileListResult { + readonly path: string; + readonly entries: readonly FileListEntry[]; +} + +export interface FileStatResult { + readonly path: string; + readonly exists: boolean; + readonly type?: "file" | "directory"; + readonly size?: number; + readonly mtime_ms?: number; +} + +export interface FileReadResult { + readonly path: string; + readonly encoding: FileEncoding; + readonly content: string; + readonly size: number; +} + +export interface FileWriteResult { + readonly path: string; + readonly size: number; +} + +export interface FileCopyResult { + readonly from_path: string; + readonly to_path: string; + readonly files_copied: number; + readonly bytes_copied: number; +} + +export interface FileManagerOptions { + readonly serversBaseDir?: string; + readonly maxReadWriteBytes?: number; + readonly maxCopyFiles?: number; + readonly maxCopyBytes?: number; + readonly maxUploadBytes?: number; + readonly maxPartBytes?: number; + readonly maxConcurrentUploads?: number; + readonly maxConcurrentDownloads?: number; + readonly maxZipEntries?: number; + readonly maxZipUncompressedBytes?: number; + readonly maxZipEntryBytes?: number; + readonly maxZipCompressionRatio?: number; + readonly zipRatioMinBytes?: number; +} + +function readExactUpToLimit(fd: number, maxBytes: number): Uint8Array { + const chunks: Uint8Array[] = []; + let total = 0; + const scratch = Buffer.allocUnsafe(64 * 1024); + + while (true) { + const toRead = Math.min(scratch.byteLength, maxBytes - total + 1); + const bytesRead = readSync(fd, scratch, 0, toRead, null); + if (bytesRead === 0) { + break; + } + total += bytesRead; + if (total > maxBytes) { + throw new FileManagerError( + "file_too_large", + `File exceeds maximum allowed size of ${maxBytes} bytes`, + ); + } + const copy = new Uint8Array(bytesRead); + copy.set(scratch.subarray(0, bytesRead)); + chunks.push(copy); + } + + const out = new Uint8Array(total); + let offset = 0; + for (const chunk of chunks) { + out.set(chunk, offset); + offset += chunk.byteLength; + } + return out; +} + +function ensureSubtreeHasNoSymlinks(dirFullPath: string): void { + const names = readdirSync(dirFullPath); + for (const name of names) { + const childPath = join(dirFullPath, name); + const stats = lstatSync(childPath); + if (stats.isSymbolicLink()) { + throw new FileManagerError( + "symlink_forbidden", + `Refusing recursive delete containing symbolic link "${name}"`, + ); + } + if (stats.isDirectory()) { + ensureSubtreeHasNoSymlinks(childPath); + } + } +} + +function deleteSubtreeSafely(dirFullPath: string): void { + const names = readdirSync(dirFullPath); + for (const name of names) { + const childPath = join(dirFullPath, name); + const stats = lstatSync(childPath); + if (stats.isSymbolicLink()) { + throw new FileManagerError( + "symlink_forbidden", + `Symbolic link encountered during delete at "${name}"`, + ); + } + if (stats.isDirectory()) { + deleteSubtreeSafely(childPath); + } else { + unlinkSync(childPath); + } + } + rmdirSync(dirFullPath); +} + +export class FileManager { + readonly #serversBaseDir: string; + readonly #maxReadWriteBytes: number; + readonly #maxCopyFiles: number; + readonly #maxCopyBytes: number; + readonly #transfers: TransferManager; + readonly #zipOptions: { + readonly maxEntries?: number; + readonly maxUncompressedBytes?: number; + readonly maxEntryBytes?: number; + readonly maxCompressionRatio?: number; + readonly ratioMinBytes?: number; + }; + + constructor(options: FileManagerOptions = {}) { + this.#serversBaseDir = options.serversBaseDir ?? DEFAULT_SERVERS_BASE_DIR; + this.#maxReadWriteBytes = options.maxReadWriteBytes ?? MAX_READ_WRITE_BYTES; + this.#maxCopyFiles = options.maxCopyFiles ?? DEFAULT_MAX_COPY_FILES; + this.#maxCopyBytes = options.maxCopyBytes ?? DEFAULT_MAX_COPY_BYTES; + this.#transfers = new TransferManager({ + serversBaseDir: this.#serversBaseDir, + ...(options.maxUploadBytes !== undefined ? { maxUploadBytes: options.maxUploadBytes } : {}), + ...(options.maxPartBytes !== undefined ? { maxPartBytes: options.maxPartBytes } : {}), + ...(options.maxConcurrentUploads !== undefined + ? { maxConcurrentUploads: options.maxConcurrentUploads } + : {}), + ...(options.maxConcurrentDownloads !== undefined + ? { maxConcurrentDownloads: options.maxConcurrentDownloads } + : {}), + }); + this.#zipOptions = { + ...(options.maxZipEntries !== undefined ? { maxEntries: options.maxZipEntries } : {}), + ...(options.maxZipUncompressedBytes !== undefined + ? { maxUncompressedBytes: options.maxZipUncompressedBytes } + : {}), + ...(options.maxZipEntryBytes !== undefined + ? { maxEntryBytes: options.maxZipEntryBytes } + : {}), + ...(options.maxZipCompressionRatio !== undefined + ? { maxCompressionRatio: options.maxZipCompressionRatio } + : {}), + ...(options.zipRatioMinBytes !== undefined + ? { ratioMinBytes: options.zipRatioMinBytes } + : {}), + }; + } + + list(params: { readonly server_id: string; readonly path?: string | undefined }): FileListResult { + const resolved = resolveConfinedPath({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + relPath: params.path ?? "", + allowRoot: true, + }); + + let dirStats: Stats; + try { + dirStats = lstatSync(resolved.fullPath); + } catch (err) { + throw wrapIoError(err, "Failed to stat directory"); + } + + if (dirStats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Target directory is a symbolic link"); + } + if (!dirStats.isDirectory()) { + throw new FileManagerError("not_a_directory", "Target path is not a directory"); + } + + const rawNames = readdirSync(resolved.fullPath).sort(); + const entries: FileListEntry[] = []; + + for (const name of rawNames) { + if (name === ".runtime" || name.startsWith(".tmp-upload-")) { + continue; + } + const entryPath = join(resolved.fullPath, name); + let entryStats: Stats; + try { + entryStats = lstatSync(entryPath); + } catch { + continue; + } + + if (entryStats.isSymbolicLink()) { + // Ignore symlinks without following them. + continue; + } + if (entryStats.isDirectory()) { + entries.push({ + name, + type: "directory", + size: 0, + mtime_ms: Math.floor(entryStats.mtimeMs), + }); + } else if (entryStats.isFile()) { + entries.push({ + name, + type: "file", + size: entryStats.size, + mtime_ms: Math.floor(entryStats.mtimeMs), + }); + } + } + + return { + path: resolved.relativePath, + entries, + }; + } + + stat(params: { readonly server_id: string; readonly path: string }): FileStatResult { + const resolved = resolveConfinedPath({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + relPath: params.path, + allowRoot: true, + }); + + let stats: Stats; + try { + stats = lstatSync(resolved.fullPath); + } catch (err) { + if (isErrnoCode(err, "ENOENT")) { + return { path: resolved.relativePath, exists: false }; + } + throw wrapIoError(err, "Failed to stat path"); + } + + if (stats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Target path is a symbolic link"); + } + if (stats.isDirectory()) { + return { + path: resolved.relativePath, + exists: true, + type: "directory", + size: 0, + mtime_ms: Math.floor(stats.mtimeMs), + }; + } + if (stats.isFile()) { + return { + path: resolved.relativePath, + exists: true, + type: "file", + size: stats.size, + mtime_ms: Math.floor(stats.mtimeMs), + }; + } + + throw new FileManagerError("not_a_file", "Unsupported filesystem entry type"); + } + + read(params: { + readonly server_id: string; + readonly path: string; + readonly encoding?: FileEncoding | undefined; + }): FileReadResult { + const encoding = params.encoding ?? "utf8"; + const resolved = resolveConfinedPath({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + relPath: params.path, + allowRoot: false, + }); + + const { fd, stats } = openConfinedFileForRead(resolved); + let data: Uint8Array; + try { + if (stats.size > this.#maxReadWriteBytes) { + throw new FileManagerError( + "file_too_large", + `File size ${stats.size} exceeds maximum direct read limit of ${this.#maxReadWriteBytes} bytes`, + ); + } + data = readExactUpToLimit(fd, this.#maxReadWriteBytes); + } finally { + closeSync(fd); + } + + const content = + encoding === "base64" + ? Buffer.from(data.buffer, data.byteOffset, data.byteLength).toString("base64") + : new TextDecoder("utf-8").decode(data); + + return { + path: resolved.relativePath, + encoding, + content, + size: data.byteLength, + }; + } + + write(params: { + readonly server_id: string; + readonly path: string; + readonly content: string; + readonly encoding?: FileEncoding | undefined; + }): FileWriteResult { + const encoding = params.encoding ?? "utf8"; + const data = + encoding === "base64" + ? decodeStrictBase64(params.content) + : new TextEncoder().encode(params.content); + + if (data.byteLength > this.#maxReadWriteBytes) { + throw new FileManagerError( + "file_too_large", + `Content size ${data.byteLength} exceeds maximum direct write limit of ${this.#maxReadWriteBytes} bytes`, + ); + } + + const resolved = resolveConfinedPath({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + relPath: params.path, + allowRoot: false, + }); + + writeConfinedFileAtomic(resolved, data); + return { + path: resolved.relativePath, + size: data.byteLength, + }; + } + + mkdir(params: { readonly server_id: string; readonly path: string }): { readonly path: string } { + const resolved = mkdirConfined({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + relPath: params.path, + }); + return { path: resolved.relativePath }; + } + + rename(params: { + readonly server_id: string; + readonly path: string; + readonly new_name: string; + }): { readonly from_path: string; readonly to_path: string } { + const sourceResolved = resolveConfinedPath({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + relPath: params.path, + allowRoot: false, + }); + const newName = validateSingleFileName(params.new_name); + const parentSegments = sourceResolved.segments.slice(0, -1); + const destRelPath = [...parentSegments, newName].join("/"); + + return this.move({ + server_id: params.server_id, + from_path: sourceResolved.relativePath, + to_path: destRelPath, + }); + } + + move(params: { + readonly server_id: string; + readonly from_path: string; + readonly to_path: string; + }): { readonly from_path: string; readonly to_path: string } { + const fromResolved = resolveConfinedPath({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + relPath: params.from_path, + allowRoot: false, + }); + const toResolved = resolveConfinedPath({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + relPath: params.to_path, + allowRoot: false, + }); + + if ( + toResolved.relativePath === fromResolved.relativePath || + toResolved.relativePath.startsWith(`${fromResolved.relativePath}/`) + ) { + throw new FileManagerError( + "invalid_path", + "Cannot move a path onto itself or inside its own subtree", + ); + } + + let fromStats: Stats; + try { + fromStats = lstatSync(fromResolved.fullPath); + } catch (err) { + throw wrapIoError(err, "Source path does not exist"); + } + if (fromStats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Cannot move a symbolic link"); + } + + let toStats: Stats | undefined; + try { + toStats = lstatSync(toResolved.fullPath); + } catch (err) { + if (!isErrnoCode(err, "ENOENT")) { + throw wrapIoError(err, "Failed to inspect destination path"); + } + } + if (toStats !== undefined) { + if (toStats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Destination is a symbolic link"); + } + throw new FileManagerError("already_exists", "Destination path already exists"); + } + + const destParent = dirname(toResolved.fullPath); + let destParentStats: Stats; + try { + destParentStats = lstatSync(destParent); + } catch (err) { + throw wrapIoError(err, "Destination parent directory does not exist"); + } + if (destParentStats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Destination parent is a symbolic link"); + } + if (!destParentStats.isDirectory()) { + throw new FileManagerError("not_a_directory", "Destination parent is not a directory"); + } + + assertNoSymlinkPath(fromResolved); + assertNoSymlinkPath(toResolved); + + try { + renameSync(fromResolved.fullPath, toResolved.fullPath); + } catch (err) { + throw wrapIoError(err, "Failed to move path"); + } + + return { + from_path: fromResolved.relativePath, + to_path: toResolved.relativePath, + }; + } + + copy(params: { + readonly server_id: string; + readonly from_path: string; + readonly to_path: string; + }): FileCopyResult { + const fromResolved = resolveConfinedPath({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + relPath: params.from_path, + allowRoot: false, + }); + const toResolved = resolveConfinedPath({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + relPath: params.to_path, + allowRoot: false, + }); + + if ( + toResolved.relativePath === fromResolved.relativePath || + toResolved.relativePath.startsWith(`${fromResolved.relativePath}/`) + ) { + throw new FileManagerError( + "invalid_path", + "Cannot copy a path onto itself or inside its own subtree", + ); + } + + let fromStats: Stats; + try { + fromStats = lstatSync(fromResolved.fullPath); + } catch (err) { + throw wrapIoError(err, "Source path does not exist"); + } + if (fromStats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Cannot copy a symbolic link"); + } + + let toStats: Stats | undefined; + try { + toStats = lstatSync(toResolved.fullPath); + } catch (err) { + if (!isErrnoCode(err, "ENOENT")) { + throw wrapIoError(err, "Failed to inspect destination path"); + } + } + if (toStats !== undefined) { + if (toStats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Destination is a symbolic link"); + } + throw new FileManagerError("already_exists", "Destination path already exists"); + } + + let filesCopied = 0; + let bytesCopied = 0; + + const copyRecursive = (srcRel: string, dstRel: string): void => { + const srcConfined = resolveConfinedPath({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + relPath: srcRel, + allowRoot: false, + }); + const dstConfined = resolveConfinedPath({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + relPath: dstRel, + allowRoot: false, + }); + + const stats = lstatSync(srcConfined.fullPath); + if (stats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", `Cannot copy symbolic link "${srcRel}"`); + } + + if (stats.isDirectory()) { + mkdirConfined({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + relPath: dstConfined.relativePath, + }); + const children = readdirSync(srcConfined.fullPath).sort(); + for (const child of children) { + const childFull = join(srcConfined.fullPath, child); + const childStats = lstatSync(childFull); + if (childStats.isSymbolicLink()) { + throw new FileManagerError( + "symlink_forbidden", + `Cannot copy symbolic link "${srcRel}/${child}"`, + ); + } + copyRecursive( + `${srcConfined.relativePath}/${child}`, + `${dstConfined.relativePath}/${child}`, + ); + } + return; + } + + if (!stats.isFile()) { + throw new FileManagerError("not_a_file", `Cannot copy non-regular file "${srcRel}"`); + } + + if (filesCopied + 1 > this.#maxCopyFiles) { + throw new FileManagerError( + "copy_limit_exceeded", + `Copy exceeds maximum file count of ${this.#maxCopyFiles}`, + ); + } + + const { fd, stats: fdStats } = openConfinedFileForRead(srcConfined); + let data: Uint8Array; + try { + if (bytesCopied + fdStats.size > this.#maxCopyBytes) { + throw new FileManagerError( + "copy_limit_exceeded", + `Copy exceeds maximum total byte limit of ${this.#maxCopyBytes}`, + ); + } + try { + data = readExactUpToLimit(fd, this.#maxCopyBytes - bytesCopied); + } catch (err) { + if (err instanceof FileManagerError && err.code === "file_too_large") { + throw new FileManagerError( + "copy_limit_exceeded", + `Copy exceeds maximum total byte limit of ${this.#maxCopyBytes}`, + ); + } + throw err; + } + } finally { + closeSync(fd); + } + + writeConfinedFileAtomic(dstConfined, data); + filesCopied += 1; + bytesCopied += data.byteLength; + }; + + // Pre-scan directory source for symlinks before writing anything. + if (fromStats.isDirectory()) { + ensureSubtreeHasNoSymlinks(fromResolved.fullPath); + } + + copyRecursive(fromResolved.relativePath, toResolved.relativePath); + return { + from_path: fromResolved.relativePath, + to_path: toResolved.relativePath, + files_copied: filesCopied, + bytes_copied: bytesCopied, + }; + } + + delete(params: { + readonly server_id: string; + readonly path: string; + readonly recursive?: boolean | undefined; + }): { readonly path: string; readonly deleted: boolean } { + const resolved = resolveConfinedPath({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + relPath: params.path, + allowRoot: false, + }); + + let stats: Stats; + try { + stats = lstatSync(resolved.fullPath); + } catch (err) { + throw wrapIoError(err, "Target path does not exist"); + } + + if (stats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Refusing to operate on a symbolic link"); + } + + if (stats.isDirectory()) { + const recursive = params.recursive ?? false; + const children = readdirSync(resolved.fullPath); + if (children.length > 0 && !recursive) { + throw new FileManagerError( + "is_a_directory", + "Directory is not empty; pass recursive: true to delete", + ); + } + if (recursive) { + ensureSubtreeHasNoSymlinks(resolved.fullPath); + deleteSubtreeSafely(resolved.fullPath); + } else { + rmdirSync(resolved.fullPath); + } + return { path: resolved.relativePath, deleted: true }; + } + + try { + unlinkSync(resolved.fullPath); + } catch (err) { + throw wrapIoError(err, "Failed to delete file"); + } + return { path: resolved.relativePath, deleted: true }; + } + + uploadBegin(params: UploadBeginParams): UploadBeginResult { + return this.#transfers.beginUpload(params); + } + + uploadPart(params: UploadPartParams): UploadPartResult { + return this.#transfers.appendUploadPart(params); + } + + uploadCommit(params: UploadCommitParams): UploadCommitResult { + return this.#transfers.commitUpload(params); + } + + uploadAbort(params: UploadAbortParams): { + readonly upload_id: string; + readonly aborted: boolean; + } { + return this.#transfers.abortUpload(params); + } + + downloadBegin(params: DownloadBeginParams): DownloadBeginResult { + return this.#transfers.beginDownload(params); + } + + downloadPart(params: DownloadPartParams): DownloadPartResult { + return this.#transfers.readDownloadPart(params); + } + + downloadClose(params: DownloadCloseParams): { + readonly download_id: string; + readonly closed: boolean; + } { + return this.#transfers.closeDownload(params); + } + + download(params: DownloadRangeParams): DownloadRangeResult { + return this.#transfers.downloadRange(params); + } + + zip(params: { + readonly server_id: string; + readonly paths: readonly string[]; + readonly dest_path: string; + }): SafeZipResult { + return safeZipFiles({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + paths: params.paths, + destPath: params.dest_path, + }); + } + + unzip(params: { + readonly server_id: string; + readonly zip_path: string; + readonly dest_path?: string | undefined; + }): SafeUnzipResult { + return safeUnzipFile({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + zipPath: params.zip_path, + ...(params.dest_path !== undefined ? { destPath: params.dest_path } : {}), + ...this.#zipOptions, + }); + } + + dispose(): void { + this.#transfers.closeAll(); + } +} + +export function registerFileCommandHandlers(queue: CommandQueue, manager: FileManager): void { + function wrap( + eventType: string, + fn: (body: TBody) => unknown, + ): Parameters[1] { + return (opened, ctx) => { + try { + const result = fn(opened.body as TBody); + ctx.sendEvent(eventType, result); + } catch (err) { + if (err instanceof FileManagerError) { + ctx.sendEvent("files.error", { + command_id: opened.header.id, + command_type: opened.header.type, + code: err.code, + message: err.message, + }); + } + throw err; + } + }; + } + + queue.registerHandler( + "files.list", + wrap<{ readonly server_id: string; readonly path?: string }>("files.list.result", (body) => + manager.list(body), + ), + ); + queue.registerHandler( + "files.stat", + wrap<{ readonly server_id: string; readonly path: string }>("files.stat.result", (body) => + manager.stat(body), + ), + ); + queue.registerHandler( + "files.read", + wrap<{ + readonly server_id: string; + readonly path: string; + readonly encoding?: FileEncoding; + }>("files.read.result", (body) => manager.read(body)), + ); + queue.registerHandler( + "files.write", + wrap<{ + readonly server_id: string; + readonly path: string; + readonly content: string; + readonly encoding?: FileEncoding; + }>("files.write.result", (body) => manager.write(body)), + ); + queue.registerHandler( + "files.mkdir", + wrap<{ readonly server_id: string; readonly path: string }>("files.mkdir.result", (body) => + manager.mkdir(body), + ), + ); + queue.registerHandler( + "files.rename", + wrap<{ readonly server_id: string; readonly path: string; readonly new_name: string }>( + "files.rename.result", + (body) => manager.rename(body), + ), + ); + queue.registerHandler( + "files.move", + wrap<{ readonly server_id: string; readonly from_path: string; readonly to_path: string }>( + "files.move.result", + (body) => manager.move(body), + ), + ); + queue.registerHandler( + "files.copy", + wrap<{ readonly server_id: string; readonly from_path: string; readonly to_path: string }>( + "files.copy.result", + (body) => manager.copy(body), + ), + ); + queue.registerHandler( + "files.delete", + wrap<{ readonly server_id: string; readonly path: string; readonly recursive?: boolean }>( + "files.delete.result", + (body) => manager.delete(body), + ), + ); + queue.registerHandler( + "files.upload.begin", + wrap("files.upload.began", (body) => manager.uploadBegin(body)), + ); + queue.registerHandler( + "files.upload.part", + wrap("files.upload.part.result", (body) => manager.uploadPart(body)), + ); + queue.registerHandler( + "files.upload.commit", + wrap("files.upload.committed", (body) => manager.uploadCommit(body)), + ); + queue.registerHandler( + "files.upload.abort", + wrap("files.upload.aborted", (body) => manager.uploadAbort(body)), + ); + queue.registerHandler( + "files.download.begin", + wrap("files.download.began", (body) => manager.downloadBegin(body)), + ); + queue.registerHandler( + "files.download.part", + wrap("files.download.part.result", (body) => manager.downloadPart(body)), + ); + queue.registerHandler( + "files.download.close", + wrap("files.download.closed", (body) => manager.downloadClose(body)), + ); + queue.registerHandler( + "files.download", + wrap("files.download.result", (body) => manager.download(body)), + ); + queue.registerHandler( + "files.zip", + wrap<{ + readonly server_id: string; + readonly paths: readonly string[]; + readonly dest_path: string; + }>("files.zip.result", (body) => manager.zip(body)), + ); + queue.registerHandler( + "files.unzip", + wrap<{ + readonly server_id: string; + readonly zip_path: string; + readonly dest_path?: string; + }>("files.unzip.result", (body) => manager.unzip(body)), + ); +} diff --git a/src/files/transfers.ts b/src/files/transfers.ts new file mode 100644 index 0000000..fb4ebd9 --- /dev/null +++ b/src/files/transfers.ts @@ -0,0 +1,649 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { createHash, type Hash, randomBytes } from "node:crypto"; +import { + chmodSync, + closeSync, + constants as fsConstants, + fsyncSync, + lstatSync, + openSync, + readSync, + renameSync, + type Stats, + unlinkSync, + writeSync, +} from "node:fs"; +import { dirname, join } from "node:path"; +import { SHA256_HEX_PATTERN } from "../protocol"; +import { + assertNoSymlinkPath, + DEFAULT_SERVERS_BASE_DIR, + isErrnoCode, + isPosix, + mkdirConfined, + openConfinedFileForRead, + resolveConfinedPath, + wrapIoError, +} from "./confinement"; +import { FileManagerError } from "./errors"; + +export const DEFAULT_MAX_UPLOAD_BYTES = 2 * 1024 * 1024 * 1024; // 2 GiB +export const DEFAULT_MAX_PART_BYTES = 8 * 1024 * 1024; // 8 MiB +export const DEFAULT_PART_BYTES = 1 * 1024 * 1024; // 1 MiB +export const DEFAULT_MAX_CONCURRENT_UPLOADS = 16; +export const DEFAULT_MAX_CONCURRENT_DOWNLOADS = 16; + +const STRICT_BASE64_REGEX = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/; + +export function decodeStrictBase64(input: string): Uint8Array { + if (input.length === 0) { + return new Uint8Array(0); + } + if (input.length % 4 !== 0 || !STRICT_BASE64_REGEX.test(input)) { + throw new FileManagerError("invalid_encoding", "Invalid base64 payload"); + } + const buf = Buffer.from(input, "base64"); + return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength); +} + +export function sha256Hex(data: Uint8Array): string { + return createHash("sha256").update(data).digest("hex"); +} + +interface UploadSession { + readonly uploadId: string; + readonly serverId: string; + readonly targetRelPath: string; + readonly stagingPath: string; + readonly totalSize: number; + readonly expectedSha256: string; + readonly partSize: number; + readonly hash: Hash; + fd: number | undefined; + nextPartIndex: number; + receivedBytes: number; +} + +interface DownloadSession { + readonly downloadId: string; + readonly serverId: string; + readonly relPath: string; + readonly totalSize: number; + readonly partSize: number; + readonly totalParts: number; + fd: number | undefined; +} + +export interface TransferManagerOptions { + readonly serversBaseDir?: string; + readonly maxUploadBytes?: number; + readonly maxPartBytes?: number; + readonly maxConcurrentUploads?: number; + readonly maxConcurrentDownloads?: number; +} + +export interface UploadBeginParams { + readonly server_id: string; + readonly path: string; + readonly total_size: number; + readonly sha256: string; + readonly part_size?: number | undefined; +} + +export interface UploadBeginResult { + readonly upload_id: string; + readonly path: string; + readonly total_size: number; + readonly part_size: number; +} + +export interface UploadPartParams { + readonly server_id: string; + readonly upload_id: string; + readonly part_index: number; + readonly data_base64: string; +} + +export interface UploadPartResult { + readonly upload_id: string; + readonly part_index: number; + readonly received_bytes: number; +} + +export interface UploadCommitParams { + readonly server_id: string; + readonly upload_id: string; +} + +export interface UploadCommitResult { + readonly upload_id: string; + readonly path: string; + readonly size: number; + readonly sha256: string; +} + +export interface UploadAbortParams { + readonly server_id: string; + readonly upload_id: string; +} + +export interface DownloadBeginParams { + readonly server_id: string; + readonly path: string; + readonly part_size?: number | undefined; +} + +export interface DownloadBeginResult { + readonly download_id: string; + readonly path: string; + readonly total_size: number; + readonly part_size: number; + readonly total_parts: number; +} + +export interface DownloadPartParams { + readonly server_id: string; + readonly download_id: string; + readonly part_index: number; +} + +export interface DownloadPartResult { + readonly download_id: string; + readonly part_index: number; + readonly offset: number; + readonly size: number; + readonly total_size: number; + readonly eof: boolean; + readonly sha256: string; + readonly data_base64: string; +} + +export interface DownloadCloseParams { + readonly server_id: string; + readonly download_id: string; +} + +export interface DownloadRangeParams { + readonly server_id: string; + readonly path: string; + readonly offset: number; + readonly length: number; +} + +export interface DownloadRangeResult { + readonly path: string; + readonly offset: number; + readonly size: number; + readonly total_size: number; + readonly eof: boolean; + readonly sha256: string; + readonly data_base64: string; +} + +function writeAll(fd: number, data: Uint8Array): void { + let offset = 0; + while (offset < data.byteLength) { + const written = writeSync(fd, data, offset, data.byteLength - offset); + if (written <= 0) { + throw new FileManagerError("io_error", "Short write on staging file"); + } + offset += written; + } +} + +export class TransferManager { + readonly #serversBaseDir: string; + readonly #maxUploadBytes: number; + readonly #maxPartBytes: number; + readonly #maxConcurrentUploads: number; + readonly #maxConcurrentDownloads: number; + readonly #uploads = new Map(); + readonly #downloads = new Map(); + + constructor(options: TransferManagerOptions = {}) { + this.#serversBaseDir = options.serversBaseDir ?? DEFAULT_SERVERS_BASE_DIR; + this.#maxUploadBytes = options.maxUploadBytes ?? DEFAULT_MAX_UPLOAD_BYTES; + this.#maxPartBytes = options.maxPartBytes ?? DEFAULT_MAX_PART_BYTES; + this.#maxConcurrentUploads = options.maxConcurrentUploads ?? DEFAULT_MAX_CONCURRENT_UPLOADS; + this.#maxConcurrentDownloads = + options.maxConcurrentDownloads ?? DEFAULT_MAX_CONCURRENT_DOWNLOADS; + } + + #cleanupUpload(session: UploadSession, unlinkStaging: boolean): void { + if (session.fd !== undefined) { + try { + closeSync(session.fd); + } catch { + // ignore close failure on cleanup + } + session.fd = undefined; + } + if (unlinkStaging) { + try { + unlinkSync(session.stagingPath); + } catch { + // ignore unlink failure on cleanup + } + } + } + + #cleanupDownload(session: DownloadSession): void { + if (session.fd !== undefined) { + try { + closeSync(session.fd); + } catch { + // ignore close failure on cleanup + } + session.fd = undefined; + } + } + + beginUpload(params: UploadBeginParams): UploadBeginResult { + if (!Number.isInteger(params.total_size) || params.total_size < 0) { + throw new FileManagerError("size_mismatch", "total_size must be a non-negative integer"); + } + if (params.total_size > this.#maxUploadBytes) { + throw new FileManagerError( + "file_too_large", + `Upload size ${params.total_size} exceeds maximum ${this.#maxUploadBytes}`, + ); + } + if (!SHA256_HEX_PATTERN.test(params.sha256)) { + throw new FileManagerError("hash_mismatch", "Invalid sha256 digest format"); + } + + const requestedPartSize = params.part_size ?? Math.min(DEFAULT_PART_BYTES, this.#maxPartBytes); + if (!Number.isInteger(requestedPartSize) || requestedPartSize <= 0) { + throw new FileManagerError("part_too_large", "part_size must be a positive integer"); + } + if (requestedPartSize > this.#maxPartBytes) { + throw new FileManagerError( + "part_too_large", + `part_size ${requestedPartSize} exceeds maximum ${this.#maxPartBytes}`, + ); + } + + if (this.#uploads.size >= this.#maxConcurrentUploads) { + throw new FileManagerError( + "upload_limit_exceeded", + "Maximum concurrent upload sessions reached", + ); + } + + const resolved = resolveConfinedPath({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + relPath: params.path, + allowRoot: false, + }); + + let existingTarget: Stats | undefined; + try { + existingTarget = lstatSync(resolved.fullPath); + } catch (err) { + if (!isErrnoCode(err, "ENOENT")) { + throw wrapIoError(err, "Failed to inspect upload target"); + } + } + if (existingTarget !== undefined) { + if (existingTarget.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Upload target is a symbolic link"); + } + if (existingTarget.isDirectory()) { + throw new FileManagerError("is_a_directory", "Upload target is a directory"); + } + } + + const uploadId = randomBytes(16).toString("hex"); + const stagingPath = join(resolved.serverRoot, `.tmp-upload-${uploadId}`); + const noFollow = fsConstants.O_NOFOLLOW ?? 0; + const flags = fsConstants.O_CREAT | fsConstants.O_EXCL | fsConstants.O_RDWR | noFollow; + + let fd: number; + try { + fd = openSync(stagingPath, flags, 0o600); + } catch (err) { + throw wrapIoError(err, "Failed to create upload staging file"); + } + + const session: UploadSession = { + uploadId, + serverId: resolved.serverId, + targetRelPath: resolved.relativePath, + stagingPath, + totalSize: params.total_size, + expectedSha256: params.sha256, + partSize: requestedPartSize, + hash: createHash("sha256"), + fd, + nextPartIndex: 0, + receivedBytes: 0, + }; + + this.#uploads.set(uploadId, session); + return { + upload_id: uploadId, + path: resolved.relativePath, + total_size: params.total_size, + part_size: requestedPartSize, + }; + } + + appendUploadPart(params: UploadPartParams): UploadPartResult { + const session = this.#uploads.get(params.upload_id); + if ( + session === undefined || + session.serverId !== params.server_id || + session.fd === undefined + ) { + throw new FileManagerError("upload_not_found", "Upload session not found"); + } + + if (params.part_index !== session.nextPartIndex) { + throw new FileManagerError( + "part_out_of_order", + `Expected part_index ${session.nextPartIndex}, received ${params.part_index}`, + ); + } + + const chunk = decodeStrictBase64(params.data_base64); + if (chunk.byteLength > session.partSize || chunk.byteLength > this.#maxPartBytes) { + throw new FileManagerError( + "part_too_large", + `Part size ${chunk.byteLength} exceeds maximum ${session.partSize}`, + ); + } + + if (session.receivedBytes + chunk.byteLength > session.totalSize) { + throw new FileManagerError( + "size_mismatch", + `Upload part exceeds declared total_size ${session.totalSize}`, + ); + } + + try { + if (chunk.byteLength > 0) { + writeAll(session.fd, chunk); + session.hash.update(chunk); + } + } catch (err) { + throw wrapIoError(err, "Failed to write upload part"); + } + + session.receivedBytes += chunk.byteLength; + session.nextPartIndex += 1; + + return { + upload_id: session.uploadId, + part_index: params.part_index, + received_bytes: session.receivedBytes, + }; + } + + commitUpload(params: UploadCommitParams): UploadCommitResult { + const session = this.#uploads.get(params.upload_id); + if ( + session === undefined || + session.serverId !== params.server_id || + session.fd === undefined + ) { + throw new FileManagerError("upload_not_found", "Upload session not found"); + } + + this.#uploads.delete(session.uploadId); + let renamed = false; + + try { + if (session.receivedBytes !== session.totalSize) { + throw new FileManagerError( + "size_mismatch", + `Received ${session.receivedBytes} bytes, expected ${session.totalSize}`, + ); + } + + const actualSha256 = session.hash.digest("hex"); + if (actualSha256 !== session.expectedSha256) { + throw new FileManagerError( + "hash_mismatch", + "Uploaded content SHA-256 does not match declared digest", + ); + } + + fsyncSync(session.fd); + closeSync(session.fd); + session.fd = undefined; + + const resolved = resolveConfinedPath({ + serversBaseDir: this.#serversBaseDir, + serverId: session.serverId, + relPath: session.targetRelPath, + allowRoot: false, + }); + + const parentSegments = resolved.segments.slice(0, -1); + if (parentSegments.length > 0) { + mkdirConfined({ + serversBaseDir: this.#serversBaseDir, + serverId: session.serverId, + relPath: parentSegments.join("/"), + }); + } + + assertNoSymlinkPath(resolved); + + const parentDir = dirname(resolved.fullPath); + const parentStats = lstatSync(parentDir); + if (parentStats.isSymbolicLink() || !parentStats.isDirectory()) { + throw new FileManagerError("symlink_forbidden", "Invalid upload destination parent"); + } + + let destStats: Stats | undefined; + try { + destStats = lstatSync(resolved.fullPath); + } catch (err) { + if (!isErrnoCode(err, "ENOENT")) { + throw wrapIoError(err, "Failed to inspect upload destination"); + } + } + if (destStats !== undefined) { + if (destStats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Upload destination is a symbolic link"); + } + if (destStats.isDirectory()) { + throw new FileManagerError("is_a_directory", "Upload destination is a directory"); + } + } + + if (isPosix()) { + chmodSync(session.stagingPath, 0o640); + } + + renameSync(session.stagingPath, resolved.fullPath); + renamed = true; + + return { + upload_id: session.uploadId, + path: resolved.relativePath, + size: session.receivedBytes, + sha256: actualSha256, + }; + } catch (err) { + throw wrapIoError(err, "Failed to commit upload"); + } finally { + this.#cleanupUpload(session, !renamed); + } + } + + abortUpload(params: UploadAbortParams): { + readonly upload_id: string; + readonly aborted: boolean; + } { + const session = this.#uploads.get(params.upload_id); + if (session === undefined || session.serverId !== params.server_id) { + throw new FileManagerError("upload_not_found", "Upload session not found"); + } + this.#uploads.delete(session.uploadId); + this.#cleanupUpload(session, true); + return { upload_id: session.uploadId, aborted: true }; + } + + beginDownload(params: DownloadBeginParams): DownloadBeginResult { + const requestedPartSize = params.part_size ?? Math.min(DEFAULT_PART_BYTES, this.#maxPartBytes); + if (!Number.isInteger(requestedPartSize) || requestedPartSize <= 0) { + throw new FileManagerError("part_too_large", "part_size must be a positive integer"); + } + if (requestedPartSize > this.#maxPartBytes) { + throw new FileManagerError( + "part_too_large", + `part_size ${requestedPartSize} exceeds maximum ${this.#maxPartBytes}`, + ); + } + if (this.#downloads.size >= this.#maxConcurrentDownloads) { + throw new FileManagerError( + "download_limit_exceeded", + "Maximum concurrent download sessions reached", + ); + } + + const resolved = resolveConfinedPath({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + relPath: params.path, + allowRoot: false, + }); + + const { fd, stats } = openConfinedFileForRead(resolved); + const downloadId = randomBytes(16).toString("hex"); + const totalParts = stats.size === 0 ? 1 : Math.ceil(stats.size / requestedPartSize); + + const session: DownloadSession = { + downloadId, + serverId: resolved.serverId, + relPath: resolved.relativePath, + totalSize: stats.size, + partSize: requestedPartSize, + totalParts, + fd, + }; + + this.#downloads.set(downloadId, session); + return { + download_id: downloadId, + path: resolved.relativePath, + total_size: stats.size, + part_size: requestedPartSize, + total_parts: totalParts, + }; + } + + readDownloadPart(params: DownloadPartParams): DownloadPartResult { + const session = this.#downloads.get(params.download_id); + if ( + session === undefined || + session.serverId !== params.server_id || + session.fd === undefined + ) { + throw new FileManagerError("download_not_found", "Download session not found"); + } + if ( + !Number.isInteger(params.part_index) || + params.part_index < 0 || + params.part_index >= session.totalParts + ) { + throw new FileManagerError( + "part_out_of_order", + `part_index ${params.part_index} is out of range`, + ); + } + + const offset = params.part_index * session.partSize; + const remaining = Math.max(0, session.totalSize - offset); + const toRead = Math.min(session.partSize, remaining); + const buf = Buffer.allocUnsafe(toRead); + const bytesRead = toRead > 0 ? readSync(session.fd, buf, 0, toRead, offset) : 0; + const slice = buf.subarray(0, bytesRead); + const view = new Uint8Array(slice.buffer, slice.byteOffset, slice.byteLength); + + return { + download_id: session.downloadId, + part_index: params.part_index, + offset, + size: bytesRead, + total_size: session.totalSize, + eof: offset + bytesRead >= session.totalSize, + sha256: sha256Hex(view), + data_base64: slice.toString("base64"), + }; + } + + closeDownload(params: DownloadCloseParams): { + readonly download_id: string; + readonly closed: boolean; + } { + const session = this.#downloads.get(params.download_id); + if (session === undefined || session.serverId !== params.server_id) { + throw new FileManagerError("download_not_found", "Download session not found"); + } + this.#downloads.delete(session.downloadId); + this.#cleanupDownload(session); + return { download_id: session.downloadId, closed: true }; + } + + downloadRange(params: DownloadRangeParams): DownloadRangeResult { + if (!Number.isInteger(params.offset) || params.offset < 0) { + throw new FileManagerError("invalid_path", "offset must be a non-negative integer"); + } + if (!Number.isInteger(params.length) || params.length <= 0) { + throw new FileManagerError("part_too_large", "length must be a positive integer"); + } + if (params.length > this.#maxPartBytes) { + throw new FileManagerError( + "part_too_large", + `Requested length ${params.length} exceeds maximum ${this.#maxPartBytes}`, + ); + } + + const resolved = resolveConfinedPath({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + relPath: params.path, + allowRoot: false, + }); + + const { fd, stats } = openConfinedFileForRead(resolved); + try { + const remaining = Math.max(0, stats.size - params.offset); + const toRead = Math.min(params.length, remaining); + const buf = Buffer.allocUnsafe(toRead); + const bytesRead = toRead > 0 ? readSync(fd, buf, 0, toRead, params.offset) : 0; + const slice = buf.subarray(0, bytesRead); + const view = new Uint8Array(slice.buffer, slice.byteOffset, slice.byteLength); + + return { + path: resolved.relativePath, + offset: params.offset, + size: bytesRead, + total_size: stats.size, + eof: params.offset + bytesRead >= stats.size, + sha256: sha256Hex(view), + data_base64: slice.toString("base64"), + }; + } finally { + closeSync(fd); + } + } + + closeAll(): void { + for (const session of this.#uploads.values()) { + this.#cleanupUpload(session, true); + } + this.#uploads.clear(); + + for (const session of this.#downloads.values()) { + this.#cleanupDownload(session); + } + this.#downloads.clear(); + } +} diff --git a/src/files/zip.test.ts b/src/files/zip.test.ts new file mode 100644 index 0000000..69189fc --- /dev/null +++ b/src/files/zip.test.ts @@ -0,0 +1,467 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeEach, describe, expect, test } from "bun:test"; +import { + existsSync, + mkdirSync, + mkdtempSync, + readdirSync, + readFileSync, + rmSync, + symlinkSync, + writeFileSync, +} from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { deflateRawSync } from "node:zlib"; +import { type FileErrorCode, FileManagerError } from "./errors"; +import { + crc32, + createZipBuffer, + safeUnzipBuffer, + safeUnzipFile, + safeZipFiles, + type ZipEntryInput, +} from "./zip"; + +function expectFileError(fn: () => unknown, code: FileErrorCode): void { + try { + fn(); + throw new Error(`Expected FileManagerError(${code}), but succeeded`); + } catch (err) { + expect(err).toBeInstanceOf(FileManagerError); + expect((err as FileManagerError).code).toBe(code); + } +} + +function createDirLink(target: string, linkPath: string): void { + if (process.platform === "win32") { + symlinkSync(target, linkPath, "junction"); + } else { + symlinkSync(target, linkPath, "dir"); + } +} + +/** + * Builds a raw single-entry ZIP where header fields can be intentionally spoofed + * (for testing spoofed uncompressedSize, bad CRC, bad compression method, encrypted flag, etc.). + */ +function buildForgedSingleEntryZip(params: { + readonly cdName: string; + readonly lfhName?: string; + readonly payload: Uint8Array; + readonly method: number; + readonly flags?: number; + readonly declaredCrc?: number; + readonly declaredUncompressedSize: number; + readonly declaredCompressedSize?: number; + readonly externalAttr?: number; +}): Uint8Array { + const encoder = new TextEncoder(); + const cdNameBytes = encoder.encode(params.cdName); + const lfhNameBytes = encoder.encode(params.lfhName ?? params.cdName); + const flags = params.flags ?? 0x0800; + const crc = params.declaredCrc ?? 0; + const compSize = params.declaredCompressedSize ?? params.payload.byteLength; + const uncompSize = params.declaredUncompressedSize; + const externalAttr = params.externalAttr ?? (0o100644 << 16) >>> 0; + + const lfh = new Uint8Array(30 + lfhNameBytes.byteLength); + const lfhView = new DataView(lfh.buffer); + lfhView.setUint32(0, 0x04034b50, true); + lfhView.setUint16(4, 20, true); + lfhView.setUint16(6, flags, true); + lfhView.setUint16(8, params.method, true); + lfhView.setUint32(14, crc, true); + lfhView.setUint32(18, compSize, true); + lfhView.setUint32(22, uncompSize, true); + lfhView.setUint16(26, lfhNameBytes.byteLength, true); + lfh.set(lfhNameBytes, 30); + + const cdOffset = lfh.byteLength + params.payload.byteLength; + const cdh = new Uint8Array(46 + cdNameBytes.byteLength); + const cdhView = new DataView(cdh.buffer); + cdhView.setUint32(0, 0x02014b50, true); + cdhView.setUint16(4, 0x0314, true); + cdhView.setUint16(6, 20, true); + cdhView.setUint16(8, flags, true); + cdhView.setUint16(10, params.method, true); + cdhView.setUint32(16, crc, true); + cdhView.setUint32(20, compSize, true); + cdhView.setUint32(24, uncompSize, true); + cdhView.setUint16(28, cdNameBytes.byteLength, true); + cdhView.setUint32(38, externalAttr, true); + cdhView.setUint32(42, 0, true); + cdh.set(cdNameBytes, 46); + + const eocd = new Uint8Array(22); + const eocdView = new DataView(eocd.buffer); + eocdView.setUint32(0, 0x06054b50, true); + eocdView.setUint16(8, 1, true); + eocdView.setUint16(10, 1, true); + eocdView.setUint32(12, cdh.byteLength, true); + eocdView.setUint32(16, cdOffset, true); + + const out = new Uint8Array(cdOffset + cdh.byteLength + eocd.byteLength); + out.set(lfh, 0); + out.set(params.payload, lfh.byteLength); + out.set(cdh, cdOffset); + out.set(eocd, cdOffset + cdh.byteLength); + return out; +} + +describe("safe zip and unzip", () => { + let rootTmp: string; + let serversDir: string; + let outsideDir: string; + const serverId = "srv-zip"; + let serverDir: string; + + beforeEach(() => { + rootTmp = mkdtempSync(join(tmpdir(), "tegrad-zip-")); + serversDir = join(rootTmp, "servers"); + outsideDir = join(rootTmp, "outside"); + serverDir = join(serversDir, serverId); + mkdirSync(serverDir, { recursive: true }); + mkdirSync(outsideDir, { recursive: true }); + }); + + afterEach(() => { + rmSync(rootTmp, { recursive: true, force: true }); + }); + + test("crc32 matches IEEE 802.3 standard vector", () => { + const check = crc32(new TextEncoder().encode("123456789")); + expect(check).toBe(0xcbf43926); + }); + + test("roundtrips zip -> unzip with multiple files, nested dirs, empty file, and binary data", () => { + mkdirSync(join(serverDir, "world", "region"), { recursive: true }); + writeFileSync(join(serverDir, "server.properties"), "motd=Tegra Server\n"); + writeFileSync(join(serverDir, "world", "level.dat"), new Uint8Array([0, 1, 2, 255, 128, 42])); + writeFileSync(join(serverDir, "world", "empty.txt"), ""); + writeFileSync(join(serverDir, "world", "region", "r.0.0.mca"), "region-data-".repeat(200)); + + const zipResult = safeZipFiles({ + serversBaseDir: serversDir, + serverId, + paths: ["server.properties", "world"], + destPath: "backup.zip", + }); + + expect(zipResult.destPath).toBe("backup.zip"); + expect(zipResult.entryCount).toBeGreaterThanOrEqual(4); + expect(existsSync(join(serverDir, "backup.zip"))).toBe(true); + + const unzipResult = safeUnzipFile({ + serversBaseDir: serversDir, + serverId, + zipPath: "backup.zip", + destPath: "restored", + }); + + expect(unzipResult.destPath).toBe("restored"); + expect(readFileSync(join(serverDir, "restored", "server.properties"), "utf8")).toBe( + "motd=Tegra Server\n", + ); + expect(new Uint8Array(readFileSync(join(serverDir, "restored", "world", "level.dat")))).toEqual( + new Uint8Array([0, 1, 2, 255, 128, 42]), + ); + expect(readFileSync(join(serverDir, "restored", "world", "empty.txt"), "utf8")).toBe(""); + expect(readFileSync(join(serverDir, "restored", "world", "region", "r.0.0.mca"), "utf8")).toBe( + "region-data-".repeat(200), + ); + }); + + test("rejects zip-slip entries without creating anything outside OR inside", () => { + const evilNames = [ + "../escape.txt", + "sub/../../escape.txt", + "/abs/path.txt", + "back\\slash.txt", + "C:/Windows/evil.txt", + "foo\0bar.txt", + ".runtime/evil.jar", + "NUL.txt", + "sub/CON", + ]; + + for (const evilName of evilNames) { + // Include a benign entry BEFORE the evil entry to prove Phase 1 aborts before writing anything. + const zipBuf = createZipBuffer([ + { name: "benign.txt", data: new TextEncoder().encode("should-not-be-written") }, + { name: evilName, data: new TextEncoder().encode("pwned") }, + ]); + + expectFileError( + () => + safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId, + buffer: zipBuf, + }), + "zip_slip", + ); + + expect(readdirSync(serverDir)).toEqual([]); + expect(existsSync(join(serversDir, "escape.txt"))).toBe(false); + } + }); + + test("rejects ZIP containing UNIX symlink entry (S_IFLNK) before extracting anything", () => { + const zipBuf = createZipBuffer([ + { name: "safe.txt", data: new TextEncoder().encode("ok") }, + { + name: "evil-link", + data: new TextEncoder().encode("/etc/passwd"), + unixMode: 0o120777, + }, + ]); + + expectFileError( + () => + safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId, + buffer: zipBuf, + }), + "zip_symlink_entry", + ); + + expect(readdirSync(serverDir)).toEqual([]); + }); + + test("rejects extracting through an existing symlink/junction in destination", () => { + createDirLink(outsideDir, join(serverDir, "plugins")); + const zipBuf = createZipBuffer([ + { name: "plugins/pwn.txt", data: new TextEncoder().encode("escaped") }, + ]); + + expectFileError( + () => + safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId, + buffer: zipBuf, + }), + "symlink_forbidden", + ); + + expect(existsSync(join(outsideDir, "pwn.txt"))).toBe(false); + }); + + test("safeZipFiles refuses to archive a symlink/junction", () => { + mkdirSync(join(serverDir, "mods")); + createDirLink(outsideDir, join(serverDir, "mods", "linked")); + + expectFileError( + () => + safeZipFiles({ + serversBaseDir: serversDir, + serverId, + paths: ["mods"], + destPath: "out.zip", + }), + "symlink_forbidden", + ); + expect(existsSync(join(serverDir, "out.zip"))).toBe(false); + }); + + test("defends against zip bomb with high declared compression ratio", () => { + // 512 KiB of zeroes compresses to ~550 bytes -> ratio ~950 > 100 + const bombData = new Uint8Array(512 * 1024); + const zipBuf = createZipBuffer([{ name: "bomb.bin", data: bombData }]); + + expectFileError( + () => + safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId, + buffer: zipBuf, + }), + "zip_compression_ratio_exceeded", + ); + expect(readdirSync(serverDir)).toEqual([]); + }); + + test("defends against zip bomb with declared size exceeding total or entry limit", () => { + const data = new TextEncoder().encode("x".repeat(4096)); + const zipBuf = createZipBuffer([ + { name: "a.txt", data, store: true }, + { name: "b.txt", data, store: true }, + ]); + + expectFileError( + () => + safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId, + buffer: zipBuf, + maxEntryBytes: 2048, + }), + "zip_entry_too_large", + ); + + expectFileError( + () => + safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId, + buffer: zipBuf, + maxUncompressedBytes: 5000, + }), + "zip_too_large", + ); + }); + + test("defends against spoofed-header zip bomb where header claims 100 bytes but deflate expands to 4 MiB", () => { + const realPayload = new Uint8Array(4 * 1024 * 1024); // 4 MiB of zeros + const deflated = deflateRawSync(realPayload); + const deflatedBytes = new Uint8Array(deflated.buffer, deflated.byteOffset, deflated.byteLength); + + // Header lies and claims uncompressedSize = 100! + const forgedZip = buildForgedSingleEntryZip({ + cdName: "spoofed.bin", + payload: deflatedBytes, + method: 8, + declaredCrc: crc32(realPayload), + declaredUncompressedSize: 100, + }); + + expectFileError( + () => + safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId, + buffer: forgedZip, + maxCompressionRatio: 10, + ratioMinBytes: 64 * 1024, + }), + "zip_compression_ratio_exceeded", + ); + expect(readdirSync(serverDir)).toEqual([]); + }); + + test("rejects spoofed uncompressedSize even when under maxOutputLength", () => { + const actual = new TextEncoder().encode("this is twenty bytes"); + const deflated = deflateRawSync(actual); + const forgedZip = buildForgedSingleEntryZip({ + cdName: "mismatch.txt", + payload: new Uint8Array(deflated.buffer, deflated.byteOffset, deflated.byteLength), + method: 8, + declaredCrc: crc32(actual), + declaredUncompressedSize: 5, + }); + + expectFileError( + () => + safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId, + buffer: forgedZip, + }), + "zip_invalid", + ); + expect(readdirSync(serverDir)).toEqual([]); + }); + + test("rejects archives exceeding maxEntries", () => { + const entries: ZipEntryInput[] = []; + for (let i = 0; i < 6; i++) { + entries.push({ name: `f${i}.txt`, data: new TextEncoder().encode("x") }); + } + const zipBuf = createZipBuffer(entries); + + expectFileError( + () => + safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId, + buffer: zipBuf, + maxEntries: 5, + }), + "zip_too_many_entries", + ); + expect(readdirSync(serverDir)).toEqual([]); + }); + + test("rejects corrupted CRC-32 checksum", () => { + const data = new TextEncoder().encode("hello world"); + const deflated = deflateRawSync(data); + const forgedZip = buildForgedSingleEntryZip({ + cdName: "badcrc.txt", + payload: new Uint8Array(deflated.buffer, deflated.byteOffset, deflated.byteLength), + method: 8, + declaredCrc: (crc32(data) ^ 0x12345678) >>> 0, + declaredUncompressedSize: data.byteLength, + }); + + expectFileError( + () => + safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId, + buffer: forgedZip, + }), + "zip_crc_mismatch", + ); + expect(readdirSync(serverDir)).toEqual([]); + }); + + test("rejects Local/Central filename mismatch and unsupported compression/encryption", () => { + const data = new TextEncoder().encode("hello"); + const desyncZip = buildForgedSingleEntryZip({ + cdName: "safe.txt", + lfhName: "../evil.txt", + payload: data, + method: 0, + declaredCrc: crc32(data), + declaredUncompressedSize: data.byteLength, + }); + expectFileError( + () => + safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId, + buffer: desyncZip, + }), + "zip_invalid", + ); + + const encryptedZip = buildForgedSingleEntryZip({ + cdName: "secret.txt", + payload: data, + method: 0, + flags: 0x0001, + declaredCrc: crc32(data), + declaredUncompressedSize: data.byteLength, + }); + expectFileError( + () => + safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId, + buffer: encryptedZip, + }), + "zip_unsupported_method", + ); + + const weirdMethodZip = buildForgedSingleEntryZip({ + cdName: "bzip.txt", + payload: data, + method: 12, + declaredCrc: crc32(data), + declaredUncompressedSize: data.byteLength, + }); + expectFileError( + () => + safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId, + buffer: weirdMethodZip, + }), + "zip_unsupported_method", + ); + }); +}); diff --git a/src/files/zip.ts b/src/files/zip.ts new file mode 100644 index 0000000..7b701a9 --- /dev/null +++ b/src/files/zip.ts @@ -0,0 +1,887 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { closeSync, lstatSync, readdirSync, readSync, type Stats } from "node:fs"; +import { join } from "node:path"; +import { deflateRawSync, inflateRawSync } from "node:zlib"; +import { + DEFAULT_SERVERS_BASE_DIR, + mkdirConfined, + openConfinedFileForRead, + resolveConfinedPath, + wrapIoError, + writeConfinedFileAtomic, +} from "./confinement"; +import { FileManagerError } from "./errors"; + +export const MAX_ZIP_ENTRIES = 10_000; +export const MAX_ZIP_UNCOMPRESSED_BYTES = 10 * 1024 * 1024 * 1024; // 10 GiB +export const MAX_ZIP_ENTRY_BYTES = 512 * 1024 * 1024; // 512 MiB +export const MAX_ZIP_COMPRESSION_RATIO = 100; +export const DEFAULT_ZIP_RATIO_MIN_BYTES = 64 * 1024; // 64 KiB +export const DEFAULT_MAX_ZIP_FILE_BYTES = 512 * 1024 * 1024; // 512 MiB +export const MAX_ZIP_CREATE_FILES = 10_000; +export const MAX_ZIP_CREATE_BYTES = 2 * 1024 * 1024 * 1024; // 2 GiB + +const SIG_LOCAL_FILE_HEADER = 0x04034b50; +const SIG_CENTRAL_DIR_HEADER = 0x02014b50; +const SIG_EOCD = 0x06054b50; + +const METHOD_STORE = 0; +const METHOD_DEFLATE = 8; + +const FLAG_ENCRYPTED = 0x0001; +const FLAG_DATA_DESCRIPTOR = 0x0008; +const FLAG_UTF8 = 0x0800; + +const UNIX_MODE_MASK = 0o170000; +const UNIX_MODE_SYMLINK = 0o120000; +const UNIX_MODE_DIRECTORY = 0o040000; +const UNIX_MODE_REGULAR = 0o100000; +const UNIX_MODE_FIFO = 0o010000; +const UNIX_MODE_CHARDEV = 0o020000; +const UNIX_MODE_BLOCKDEV = 0o060000; +const UNIX_MODE_SOCKET = 0o140000; + +const CRC32_TABLE = (() => { + const table = new Uint32Array(256); + for (let i = 0; i < 256; i++) { + let c = i; + for (let k = 0; k < 8; k++) { + c = (c & 1) !== 0 ? 0xedb88320 ^ (c >>> 1) : c >>> 1; + } + table[i] = c >>> 0; + } + return table; +})(); + +export function crc32(data: Uint8Array): number { + let crc = 0xffffffff; + for (let i = 0; i < data.byteLength; i++) { + const b = data[i]; + if (b === undefined) { + continue; + } + const entry = CRC32_TABLE[(crc ^ b) & 0xff]; + if (entry !== undefined) { + crc = entry ^ (crc >>> 8); + } + } + return (crc ^ 0xffffffff) >>> 0; +} + +function toDosTimeDate(date: Date): { readonly dosTime: number; readonly dosDate: number } { + const year = Math.max(1980, Math.min(2107, date.getUTCFullYear())); + const month = date.getUTCMonth() + 1; + const day = date.getUTCDate(); + const hours = date.getUTCHours(); + const minutes = date.getUTCMinutes(); + const seconds = Math.floor(date.getUTCSeconds() / 2); + + const dosTime = (hours << 11) | (minutes << 5) | seconds; + const dosDate = ((year - 1980) << 9) | (month << 5) | day; + return { dosTime, dosDate }; +} + +export interface ZipEntryInput { + readonly name: string; + readonly data: Uint8Array; + readonly isDirectory?: boolean; + readonly mtime?: Date; + readonly unixMode?: number; + readonly store?: boolean; +} + +export function createZipBuffer(entries: readonly ZipEntryInput[]): Uint8Array { + if (entries.length > 0xffff) { + throw new FileManagerError("zip_too_many_entries", "ZIP entry count exceeds 65535 limit"); + } + + const encoder = new TextEncoder(); + const localParts: Uint8Array[] = []; + const centralParts: Uint8Array[] = []; + let offset = 0; + + for (const entry of entries) { + const isDir = entry.isDirectory ?? entry.name.endsWith("/"); + const entryName = isDir && !entry.name.endsWith("/") ? `${entry.name}/` : entry.name; + const nameBytes = encoder.encode(entryName); + const plain = isDir ? new Uint8Array(0) : entry.data; + const checksum = crc32(plain); + + let method = METHOD_STORE; + let payload: Uint8Array = plain; + if (!isDir && !entry.store && plain.byteLength > 0) { + const deflated = deflateRawSync(plain); + const deflatedView = new Uint8Array( + deflated.buffer, + deflated.byteOffset, + deflated.byteLength, + ); + if (deflatedView.byteLength < plain.byteLength) { + method = METHOD_DEFLATE; + payload = deflatedView; + } + } + + const { dosTime, dosDate } = toDosTimeDate(entry.mtime ?? new Date(0)); + const unixMode = + entry.unixMode ?? (isDir ? UNIX_MODE_DIRECTORY | 0o755 : UNIX_MODE_REGULAR | 0o644); + const externalAttr = ((unixMode & 0xffff) << 16) >>> 0; + + // Local file header (30 bytes + name) + const lfh = new Uint8Array(30 + nameBytes.byteLength); + const lfhView = new DataView(lfh.buffer); + lfhView.setUint32(0, SIG_LOCAL_FILE_HEADER, true); + lfhView.setUint16(4, 20, true); // version needed + lfhView.setUint16(6, FLAG_UTF8, true); + lfhView.setUint16(8, method, true); + lfhView.setUint16(10, dosTime, true); + lfhView.setUint16(12, dosDate, true); + lfhView.setUint32(14, checksum, true); + lfhView.setUint32(18, payload.byteLength, true); + lfhView.setUint32(22, plain.byteLength, true); + lfhView.setUint16(26, nameBytes.byteLength, true); + lfhView.setUint16(28, 0, true); // extra length + lfh.set(nameBytes, 30); + + // Central directory header (46 bytes + name) + const cdh = new Uint8Array(46 + nameBytes.byteLength); + const cdhView = new DataView(cdh.buffer); + cdhView.setUint32(0, SIG_CENTRAL_DIR_HEADER, true); + cdhView.setUint16(4, 0x0314, true); // version made by: Unix (3), spec 2.0 (20) + cdhView.setUint16(6, 20, true); // version needed + cdhView.setUint16(8, FLAG_UTF8, true); + cdhView.setUint16(10, method, true); + cdhView.setUint16(12, dosTime, true); + cdhView.setUint16(14, dosDate, true); + cdhView.setUint32(16, checksum, true); + cdhView.setUint32(20, payload.byteLength, true); + cdhView.setUint32(24, plain.byteLength, true); + cdhView.setUint16(28, nameBytes.byteLength, true); + cdhView.setUint16(30, 0, true); // extra length + cdhView.setUint16(32, 0, true); // comment length + cdhView.setUint16(34, 0, true); // disk number start + cdhView.setUint16(36, 0, true); // internal attrs + cdhView.setUint32(38, externalAttr, true); + cdhView.setUint32(42, offset, true); // relative offset of local header + cdh.set(nameBytes, 46); + + localParts.push(lfh, payload); + centralParts.push(cdh); + offset += lfh.byteLength + payload.byteLength; + } + + const cdOffset = offset; + let cdSize = 0; + for (const part of centralParts) { + cdSize += part.byteLength; + } + + const eocd = new Uint8Array(22); + const eocdView = new DataView(eocd.buffer); + eocdView.setUint32(0, SIG_EOCD, true); + eocdView.setUint16(4, 0, true); // disk number + eocdView.setUint16(6, 0, true); // cd start disk + eocdView.setUint16(8, entries.length, true); + eocdView.setUint16(10, entries.length, true); + eocdView.setUint32(12, cdSize, true); + eocdView.setUint32(16, cdOffset, true); + eocdView.setUint16(20, 0, true); // comment length + + const totalLength = cdOffset + cdSize + eocd.byteLength; + const output = new Uint8Array(totalLength); + let cursor = 0; + for (const part of localParts) { + output.set(part, cursor); + cursor += part.byteLength; + } + for (const part of centralParts) { + output.set(part, cursor); + cursor += part.byteLength; + } + output.set(eocd, cursor); + return output; +} + +interface ParsedCentralEntry { + readonly rawName: string; + readonly targetRelPath: string; + readonly isDirectory: boolean; + readonly flags: number; + readonly method: number; + readonly crc32: number; + readonly compressedSize: number; + readonly uncompressedSize: number; + readonly localHeaderOffset: number; +} + +function findEocdOffset(view: DataView, byteLength: number): number { + if (byteLength < 22) { + throw new FileManagerError("zip_invalid", "Archive is smaller than minimum ZIP size"); + } + const minOffset = Math.max(0, byteLength - 22 - 0xffff); + for (let pos = byteLength - 22; pos >= minOffset; pos--) { + if (view.getUint32(pos, true) === SIG_EOCD) { + const commentLength = view.getUint16(pos + 20, true); + if (pos + 22 + commentLength === byteLength) { + return pos; + } + } + } + throw new FileManagerError("zip_invalid", "End of Central Directory record not found"); +} + +function isBufferTooLargeError(err: unknown): boolean { + if (typeof err !== "object" || err === null) { + return false; + } + const code = "code" in err ? (err as { readonly code?: unknown }).code : undefined; + if (code === "ERR_BUFFER_TOO_LARGE") { + return true; + } + const message = err instanceof Error ? err.message : ""; + return /Cannot create a Buffer larger|maxOutputLength|too large/i.test(message); +} + +function readAllFromFd(fd: number, maxBytes: number): Uint8Array { + const chunks: Uint8Array[] = []; + let total = 0; + const scratch = Buffer.allocUnsafe(64 * 1024); + + while (true) { + const toRead = Math.min(scratch.byteLength, maxBytes - total + 1); + const bytesRead = readSync(fd, scratch, 0, toRead, null); + if (bytesRead === 0) { + break; + } + total += bytesRead; + if (total > maxBytes) { + throw new FileManagerError("file_too_large", `File exceeds maximum allowed size`); + } + const copy = new Uint8Array(bytesRead); + copy.set(scratch.subarray(0, bytesRead)); + chunks.push(copy); + } + + const out = new Uint8Array(total); + let pos = 0; + for (const chunk of chunks) { + out.set(chunk, pos); + pos += chunk.byteLength; + } + return out; +} + +export interface SafeUnzipOptions { + readonly serversBaseDir?: string; + readonly serverId: string; + readonly destPath?: string; + readonly maxEntries?: number; + readonly maxUncompressedBytes?: number; + readonly maxEntryBytes?: number; + readonly maxCompressionRatio?: number; + readonly ratioMinBytes?: number; +} + +export interface SafeUnzipBufferOptions extends SafeUnzipOptions { + readonly buffer: Uint8Array; +} + +export interface SafeUnzipFileOptions extends SafeUnzipOptions { + readonly zipPath: string; + readonly maxZipFileBytes?: number; +} + +export interface SafeUnzipResult { + readonly destPath: string; + readonly entryCount: number; + readonly totalBytes: number; + readonly files: readonly string[]; +} + +function validateZipEntryName( + rawName: string, + destRelPath: string, + serversBaseDir: string, + serverId: string, + isDirectoryFlag: boolean, +): { readonly targetRelPath: string; readonly isDirectory: boolean } { + if (rawName.length === 0) { + throw new FileManagerError("zip_invalid", "ZIP entry has empty filename"); + } + if (rawName.includes("\0")) { + throw new FileManagerError("zip_slip", "ZIP entry contains NUL byte"); + } + if (rawName.includes("\\")) { + throw new FileManagerError("zip_slip", "ZIP entry contains backslash"); + } + if (rawName.startsWith("/") || /^[A-Za-z]:/.test(rawName)) { + throw new FileManagerError("zip_slip", "ZIP entry uses absolute path"); + } + + const hasTrailingSlash = rawName.endsWith("/"); + const isDirectory = isDirectoryFlag || hasTrailingSlash; + const trimmed = hasTrailingSlash ? rawName.slice(0, -1) : rawName; + + if (trimmed.length === 0 || trimmed.endsWith("/")) { + throw new FileManagerError("zip_slip", `Invalid ZIP entry path "${rawName}"`); + } + + const combined = destRelPath.length > 0 ? `${destRelPath}/${trimmed}` : trimmed; + + try { + const resolved = resolveConfinedPath({ + serversBaseDir, + serverId, + relPath: combined, + allowRoot: false, + }); + return { targetRelPath: resolved.relativePath, isDirectory }; + } catch (err) { + if (err instanceof FileManagerError) { + if (err.code === "path_traversal" || err.code === "invalid_path") { + throw new FileManagerError("zip_slip", `Unsafe ZIP entry "${rawName}": ${err.message}`); + } + throw err; + } + throw wrapIoError(err, `Failed to validate ZIP entry "${rawName}"`); + } +} + +export function safeUnzipBuffer(options: SafeUnzipBufferOptions): SafeUnzipResult { + const serversBaseDir = options.serversBaseDir ?? DEFAULT_SERVERS_BASE_DIR; + const maxEntries = options.maxEntries ?? MAX_ZIP_ENTRIES; + const maxUncompressedBytes = options.maxUncompressedBytes ?? MAX_ZIP_UNCOMPRESSED_BYTES; + const maxEntryBytes = options.maxEntryBytes ?? MAX_ZIP_ENTRY_BYTES; + const maxCompressionRatio = options.maxCompressionRatio ?? MAX_ZIP_COMPRESSION_RATIO; + const ratioMinBytes = options.ratioMinBytes ?? DEFAULT_ZIP_RATIO_MIN_BYTES; + + const destResolved = resolveConfinedPath({ + serversBaseDir, + serverId: options.serverId, + relPath: options.destPath ?? "", + allowRoot: true, + }); + + const buf = options.buffer; + const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength); + const decoder = new TextDecoder("utf-8", { fatal: true }); + + const eocdOffset = findEocdOffset(view, buf.byteLength); + const diskNumber = view.getUint16(eocdOffset + 4, true); + const cdStartDisk = view.getUint16(eocdOffset + 6, true); + const entriesOnDisk = view.getUint16(eocdOffset + 8, true); + const totalEntries = view.getUint16(eocdOffset + 10, true); + const cdSize = view.getUint32(eocdOffset + 12, true); + const cdOffset = view.getUint32(eocdOffset + 16, true); + + if (diskNumber !== 0 || cdStartDisk !== 0 || entriesOnDisk !== totalEntries) { + throw new FileManagerError("zip_invalid", "Multi-disk ZIP archives are not supported"); + } + if (totalEntries === 0xffff || cdSize === 0xffffffff || cdOffset === 0xffffffff) { + throw new FileManagerError("zip_invalid", "ZIP64 archives are not supported"); + } + if (totalEntries > maxEntries) { + throw new FileManagerError( + "zip_too_many_entries", + `ZIP entry count ${totalEntries} exceeds limit ${maxEntries}`, + ); + } + if (cdOffset + cdSize > eocdOffset) { + throw new FileManagerError("zip_invalid", "Central Directory exceeds archive bounds"); + } + + // Phase 1: Validate every Central Directory entry BEFORE creating any directories or files. + const entries: ParsedCentralEntry[] = []; + const declaredFilePaths = new Set(); + const declaredDirPaths = new Set(); + let declaredTotalUncompressed = 0; + let pos = cdOffset; + const cdEnd = cdOffset + cdSize; + + for (let i = 0; i < totalEntries; i++) { + if (pos + 46 > cdEnd) { + throw new FileManagerError("zip_invalid", "Truncated Central Directory header"); + } + if (view.getUint32(pos, true) !== SIG_CENTRAL_DIR_HEADER) { + throw new FileManagerError("zip_invalid", "Invalid Central Directory header signature"); + } + + const flags = view.getUint16(pos + 8, true); + const method = view.getUint16(pos + 10, true); + const entryCrc = view.getUint32(pos + 16, true); + const compressedSize = view.getUint32(pos + 20, true); + const uncompressedSize = view.getUint32(pos + 24, true); + const nameLen = view.getUint16(pos + 28, true); + const extraLen = view.getUint16(pos + 30, true); + const commentLen = view.getUint16(pos + 32, true); + const externalAttr = view.getUint32(pos + 38, true); + const localHeaderOffset = view.getUint32(pos + 42, true); + + const nextPos = pos + 46 + nameLen + extraLen + commentLen; + if (nextPos > cdEnd) { + throw new FileManagerError("zip_invalid", "Central Directory entry extends past CD end"); + } + + if ((flags & FLAG_ENCRYPTED) !== 0) { + throw new FileManagerError("zip_unsupported_method", "Encrypted ZIP entries are forbidden"); + } + if (method !== METHOD_STORE && method !== METHOD_DEFLATE) { + throw new FileManagerError( + "zip_unsupported_method", + `Unsupported ZIP compression method: ${method}`, + ); + } + + const unixType = (externalAttr >>> 16) & UNIX_MODE_MASK; + if (unixType === UNIX_MODE_SYMLINK) { + throw new FileManagerError( + "zip_symlink_entry", + "Symbolic link entries inside ZIP archives are forbidden", + ); + } + if ( + unixType === UNIX_MODE_FIFO || + unixType === UNIX_MODE_CHARDEV || + unixType === UNIX_MODE_BLOCKDEV || + unixType === UNIX_MODE_SOCKET + ) { + throw new FileManagerError( + "zip_invalid", + "Special UNIX device/FIFO/socket entries are forbidden", + ); + } + + let rawName: string; + try { + rawName = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen)); + } catch { + throw new FileManagerError("zip_invalid", "ZIP entry name is not valid UTF-8"); + } + + const validated = validateZipEntryName( + rawName, + destResolved.relativePath, + serversBaseDir, + options.serverId, + unixType === UNIX_MODE_DIRECTORY, + ); + + if (validated.isDirectory) { + if (compressedSize !== 0 || uncompressedSize !== 0) { + throw new FileManagerError("zip_invalid", "Directory entry must have zero size"); + } + if (declaredFilePaths.has(validated.targetRelPath)) { + throw new FileManagerError("zip_invalid", "Conflicting file and directory path in archive"); + } + declaredDirPaths.add(validated.targetRelPath); + } else { + if ( + declaredFilePaths.has(validated.targetRelPath) || + declaredDirPaths.has(validated.targetRelPath) + ) { + throw new FileManagerError("zip_invalid", "Duplicate or conflicting entry path in archive"); + } + declaredFilePaths.add(validated.targetRelPath); + + const parts = validated.targetRelPath.split("/"); + for (let p = 1; p < parts.length; p++) { + const ancestor = parts.slice(0, p).join("/"); + if (declaredFilePaths.has(ancestor)) { + throw new FileManagerError( + "zip_invalid", + "Conflicting file and directory ancestor in archive", + ); + } + declaredDirPaths.add(ancestor); + } + + if (uncompressedSize > maxEntryBytes) { + throw new FileManagerError( + "zip_entry_too_large", + `ZIP entry "${rawName}" declared size ${uncompressedSize} exceeds limit ${maxEntryBytes}`, + ); + } + + declaredTotalUncompressed += uncompressedSize; + if (declaredTotalUncompressed > maxUncompressedBytes) { + throw new FileManagerError( + "zip_too_large", + `ZIP total declared size exceeds limit ${maxUncompressedBytes}`, + ); + } + + if (method === METHOD_DEFLATE) { + const ratioLimit = Math.max( + ratioMinBytes, + Math.max(1, compressedSize) * maxCompressionRatio, + ); + if (uncompressedSize > ratioLimit) { + throw new FileManagerError( + "zip_compression_ratio_exceeded", + `ZIP entry "${rawName}" exceeds maximum compression ratio`, + ); + } + } else if (compressedSize !== uncompressedSize) { + throw new FileManagerError( + "zip_invalid", + `Stored ZIP entry "${rawName}" has mismatched compressed/uncompressed sizes`, + ); + } + } + + if (localHeaderOffset + 30 > cdOffset) { + throw new FileManagerError("zip_invalid", "Local File Header offset out of bounds"); + } + + entries.push({ + rawName, + targetRelPath: validated.targetRelPath, + isDirectory: validated.isDirectory, + flags, + method, + crc32: entryCrc, + compressedSize, + uncompressedSize, + localHeaderOffset, + }); + + pos = nextPos; + } + + // Phase 2: Extract entries safely with strict runtime decompression budgets. + if (destResolved.relativePath.length > 0) { + mkdirConfined({ + serversBaseDir, + serverId: options.serverId, + relPath: destResolved.relativePath, + }); + } + + let actualTotalBytes = 0; + const extractedFiles: string[] = []; + + for (const entry of entries) { + const lfhOffset = entry.localHeaderOffset; + if (view.getUint32(lfhOffset, true) !== SIG_LOCAL_FILE_HEADER) { + throw new FileManagerError("zip_invalid", "Invalid Local File Header signature"); + } + + const lfhFlags = view.getUint16(lfhOffset + 6, true); + const lfhMethod = view.getUint16(lfhOffset + 8, true); + const lfhCrc = view.getUint32(lfhOffset + 14, true); + const lfhCompressedSize = view.getUint32(lfhOffset + 18, true); + const lfhUncompressedSize = view.getUint32(lfhOffset + 22, true); + const lfhNameLen = view.getUint16(lfhOffset + 26, true); + const lfhExtraLen = view.getUint16(lfhOffset + 28, true); + + const dataStart = lfhOffset + 30 + lfhNameLen + lfhExtraLen; + const dataEnd = dataStart + entry.compressedSize; + if (dataEnd > cdOffset) { + throw new FileManagerError("zip_invalid", "Local File Header data exceeds archive bounds"); + } + if (lfhMethod !== entry.method) { + throw new FileManagerError("zip_invalid", "Local and Central header compression mismatch"); + } + + let lfhName: string; + try { + lfhName = decoder.decode(buf.subarray(lfhOffset + 30, lfhOffset + 30 + lfhNameLen)); + } catch { + throw new FileManagerError("zip_invalid", "Local header filename is not valid UTF-8"); + } + if (lfhName !== entry.rawName) { + throw new FileManagerError("zip_invalid", "Local and Central header filename mismatch"); + } + + const hasDataDescriptor = (lfhFlags & FLAG_DATA_DESCRIPTOR) !== 0; + if ( + !hasDataDescriptor && + (lfhCrc !== entry.crc32 || + lfhCompressedSize !== entry.compressedSize || + lfhUncompressedSize !== entry.uncompressedSize) + ) { + throw new FileManagerError("zip_invalid", "Local and Central header metadata mismatch"); + } + + if (entry.isDirectory) { + mkdirConfined({ + serversBaseDir, + serverId: options.serverId, + relPath: entry.targetRelPath, + }); + continue; + } + + const remainingTotalBudget = maxUncompressedBytes - actualTotalBytes; + if (remainingTotalBudget < 0) { + throw new FileManagerError("zip_too_large", "ZIP total uncompressed byte limit exceeded"); + } + + const compressedData = buf.subarray(dataStart, dataEnd); + let plain: Uint8Array; + + if (entry.method === METHOD_STORE) { + if (compressedData.byteLength > remainingTotalBudget) { + throw new FileManagerError("zip_too_large", "ZIP total uncompressed byte limit exceeded"); + } + if (compressedData.byteLength > maxEntryBytes) { + throw new FileManagerError("zip_entry_too_large", "ZIP entry exceeds maximum byte limit"); + } + plain = compressedData; + } else { + const ratioBudget = Math.max( + ratioMinBytes, + Math.max(1, entry.compressedSize) * maxCompressionRatio, + ); + const maxOutputLength = Math.min(remainingTotalBudget, maxEntryBytes, ratioBudget); + + try { + const inflated = inflateRawSync(compressedData, { maxOutputLength }); + plain = new Uint8Array(inflated.buffer, inflated.byteOffset, inflated.byteLength); + } catch (err) { + if (isBufferTooLargeError(err)) { + if (remainingTotalBudget <= maxEntryBytes && remainingTotalBudget <= ratioBudget) { + throw new FileManagerError( + "zip_too_large", + "Decompressed archive exceeded total uncompressed size budget", + ); + } + if (maxEntryBytes <= ratioBudget) { + throw new FileManagerError( + "zip_entry_too_large", + "Decompressed entry exceeded maximum entry size", + ); + } + throw new FileManagerError( + "zip_compression_ratio_exceeded", + "Decompressed entry exceeded maximum compression ratio", + ); + } + throw new FileManagerError( + "zip_invalid", + `Failed to decompress ZIP entry "${entry.rawName}"`, + ); + } + } + + if (plain.byteLength !== entry.uncompressedSize) { + throw new FileManagerError( + "zip_invalid", + `Actual uncompressed size (${plain.byteLength}) does not match header (${entry.uncompressedSize})`, + ); + } + + if (crc32(plain) !== entry.crc32) { + throw new FileManagerError( + "zip_crc_mismatch", + `CRC-32 mismatch for ZIP entry "${entry.rawName}"`, + ); + } + + actualTotalBytes += plain.byteLength; + if (actualTotalBytes > maxUncompressedBytes) { + throw new FileManagerError("zip_too_large", "ZIP total uncompressed byte limit exceeded"); + } + + const targetResolved = resolveConfinedPath({ + serversBaseDir, + serverId: options.serverId, + relPath: entry.targetRelPath, + allowRoot: false, + }); + writeConfinedFileAtomic(targetResolved, plain, { createParents: true }); + extractedFiles.push(targetResolved.relativePath); + } + + return { + destPath: destResolved.relativePath, + entryCount: entries.length, + totalBytes: actualTotalBytes, + files: extractedFiles, + }; +} + +export function safeUnzipFile(options: SafeUnzipFileOptions): SafeUnzipResult { + const serversBaseDir = options.serversBaseDir ?? DEFAULT_SERVERS_BASE_DIR; + const maxZipFileBytes = options.maxZipFileBytes ?? DEFAULT_MAX_ZIP_FILE_BYTES; + const zipResolved = resolveConfinedPath({ + serversBaseDir, + serverId: options.serverId, + relPath: options.zipPath, + allowRoot: false, + }); + + const { fd, stats } = openConfinedFileForRead(zipResolved); + let buffer: Uint8Array; + try { + if (stats.size > maxZipFileBytes) { + throw new FileManagerError("file_too_large", "ZIP file exceeds maximum readable size"); + } + buffer = readAllFromFd(fd, maxZipFileBytes); + } finally { + closeSync(fd); + } + + return safeUnzipBuffer({ + serversBaseDir, + serverId: options.serverId, + buffer, + ...(options.destPath !== undefined ? { destPath: options.destPath } : {}), + ...(options.maxEntries !== undefined ? { maxEntries: options.maxEntries } : {}), + ...(options.maxUncompressedBytes !== undefined + ? { maxUncompressedBytes: options.maxUncompressedBytes } + : {}), + ...(options.maxEntryBytes !== undefined ? { maxEntryBytes: options.maxEntryBytes } : {}), + ...(options.maxCompressionRatio !== undefined + ? { maxCompressionRatio: options.maxCompressionRatio } + : {}), + ...(options.ratioMinBytes !== undefined ? { ratioMinBytes: options.ratioMinBytes } : {}), + }); +} + +export interface SafeZipFilesOptions { + readonly serversBaseDir?: string; + readonly serverId: string; + readonly paths: readonly string[]; + readonly destPath: string; + readonly maxFiles?: number; + readonly maxTotalBytes?: number; +} + +export interface SafeZipResult { + readonly destPath: string; + readonly entryCount: number; + readonly uncompressedBytes: number; + readonly compressedBytes: number; +} + +export function safeZipFiles(options: SafeZipFilesOptions): SafeZipResult { + if (options.paths.length === 0) { + throw new FileManagerError("invalid_path", "At least one source path is required"); + } + + const serversBaseDir = options.serversBaseDir ?? DEFAULT_SERVERS_BASE_DIR; + const maxFiles = options.maxFiles ?? MAX_ZIP_CREATE_FILES; + const maxTotalBytes = options.maxTotalBytes ?? MAX_ZIP_CREATE_BYTES; + + const destResolved = resolveConfinedPath({ + serversBaseDir, + serverId: options.serverId, + relPath: options.destPath, + allowRoot: false, + }); + + const entries: ZipEntryInput[] = []; + const seenNames = new Set(); + let totalUncompressed = 0; + + function collectEntry(relPath: string): void { + const resolved = resolveConfinedPath({ + serversBaseDir, + serverId: options.serverId, + relPath, + allowRoot: false, + }); + + let stats: Stats; + try { + stats = lstatSync(resolved.fullPath); + } catch (err) { + throw wrapIoError(err, `Failed to stat "${relPath}"`); + } + + if (stats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", `Cannot archive symbolic link "${relPath}"`); + } + + if (stats.isDirectory()) { + if ( + destResolved.relativePath === resolved.relativePath || + destResolved.relativePath.startsWith(`${resolved.relativePath}/`) + ) { + throw new FileManagerError( + "invalid_path", + "Destination ZIP path cannot be inside a source directory", + ); + } + + const dirEntryName = `${resolved.relativePath}/`; + if (!seenNames.has(dirEntryName)) { + if (entries.length >= maxFiles) { + throw new FileManagerError("zip_too_many_entries", "Archive file count limit exceeded"); + } + seenNames.add(dirEntryName); + entries.push({ + name: dirEntryName, + data: new Uint8Array(0), + isDirectory: true, + mtime: stats.mtime, + }); + } + + const children = readdirSync(resolved.fullPath).sort(); + for (const child of children) { + if (child === ".runtime" || child.startsWith(".tmp-")) { + continue; + } + const childFull = join(resolved.fullPath, child); + const childStats = lstatSync(childFull); + if (childStats.isSymbolicLink()) { + throw new FileManagerError( + "symlink_forbidden", + `Cannot archive symbolic link "${resolved.relativePath}/${child}"`, + ); + } + collectEntry(`${resolved.relativePath}/${child}`); + } + return; + } + + if (!stats.isFile()) { + throw new FileManagerError("not_a_file", `Cannot archive non-regular file "${relPath}"`); + } + + if (seenNames.has(resolved.relativePath)) { + return; + } + if (entries.length >= maxFiles) { + throw new FileManagerError("zip_too_many_entries", "Archive file count limit exceeded"); + } + + const { fd, stats: fdStats } = openConfinedFileForRead(resolved); + let data: Uint8Array; + try { + if (totalUncompressed + fdStats.size > maxTotalBytes) { + throw new FileManagerError("zip_too_large", "Archive total size limit exceeded"); + } + data = readAllFromFd(fd, maxTotalBytes - totalUncompressed); + } finally { + closeSync(fd); + } + + totalUncompressed += data.byteLength; + seenNames.add(resolved.relativePath); + entries.push({ + name: resolved.relativePath, + data, + isDirectory: false, + mtime: fdStats.mtime, + }); + } + + for (const sourcePath of options.paths) { + collectEntry(sourcePath); + } + + const archive = createZipBuffer(entries); + writeConfinedFileAtomic(destResolved, archive); + + return { + destPath: destResolved.relativePath, + entryCount: entries.length, + uncompressedBytes: totalUncompressed, + compressedBytes: archive.byteLength, + }; +} diff --git a/src/protocol/commands/core.ts b/src/protocol/commands/core.ts index d9fdf34..0310315 100644 --- a/src/protocol/commands/core.ts +++ b/src/protocol/commands/core.ts @@ -3,6 +3,7 @@ import { z } from "zod"; import { CommandRegistry, defineCommand } from "../registry"; +import { registerFilesCommands } from "./files"; import { registerPairingCommands } from "./pairing"; const serverIdBodySchema = z.object({ @@ -45,5 +46,7 @@ export function registerCoreCommands(registry: CommandRegistry): CommandRegistry } export function createCoreRegistry(): CommandRegistry { - return registerPairingCommands(registerCoreCommands(new CommandRegistry())); + return registerFilesCommands( + registerPairingCommands(registerCoreCommands(new CommandRegistry())), + ); } diff --git a/src/protocol/commands/files.ts b/src/protocol/commands/files.ts new file mode 100644 index 0000000..8b62667 --- /dev/null +++ b/src/protocol/commands/files.ts @@ -0,0 +1,267 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; +import { type CommandRegistry, defineCommand } from "../registry"; + +export const SERVER_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,62}$/; +export const SHA256_HEX_PATTERN = /^[0-9a-f]{64}$/; + +export const serverIdSchema = z.string().regex(SERVER_ID_PATTERN, "Invalid server_id"); +export const fileEncodingSchema = z.enum(["utf8", "base64"]); +export const sha256HexSchema = z + .string() + .regex(SHA256_HEX_PATTERN, "Expected 64 lowercase hex characters"); + +export const filesListCommand = defineCommand({ + type: "files.list", + sensitive: false, + body: z + .object({ + server_id: serverIdSchema, + path: z.string().optional(), + }) + .strict(), +}); + +export const filesStatCommand = defineCommand({ + type: "files.stat", + sensitive: false, + body: z + .object({ + server_id: serverIdSchema, + path: z.string(), + }) + .strict(), +}); + +export const filesReadCommand = defineCommand({ + type: "files.read", + sensitive: false, + body: z + .object({ + server_id: serverIdSchema, + path: z.string().min(1), + encoding: fileEncodingSchema.optional(), + }) + .strict(), +}); + +export const filesWriteCommand = defineCommand({ + type: "files.write", + sensitive: false, + body: z + .object({ + server_id: serverIdSchema, + path: z.string().min(1), + content: z.string(), + encoding: fileEncodingSchema.optional(), + }) + .strict(), +}); + +export const filesMkdirCommand = defineCommand({ + type: "files.mkdir", + sensitive: false, + body: z + .object({ + server_id: serverIdSchema, + path: z.string().min(1), + }) + .strict(), +}); + +export const filesRenameCommand = defineCommand({ + type: "files.rename", + sensitive: false, + body: z + .object({ + server_id: serverIdSchema, + path: z.string().min(1), + new_name: z.string().min(1), + }) + .strict(), +}); + +export const filesMoveCommand = defineCommand({ + type: "files.move", + sensitive: false, + body: z + .object({ + server_id: serverIdSchema, + from_path: z.string().min(1), + to_path: z.string().min(1), + }) + .strict(), +}); + +export const filesCopyCommand = defineCommand({ + type: "files.copy", + sensitive: false, + body: z + .object({ + server_id: serverIdSchema, + from_path: z.string().min(1), + to_path: z.string().min(1), + }) + .strict(), +}); + +export const filesDeleteCommand = defineCommand({ + type: "files.delete", + sensitive: true, + body: z + .object({ + server_id: serverIdSchema, + path: z.string().min(1), + recursive: z.boolean().optional(), + }) + .strict(), +}); + +export const filesUploadBeginCommand = defineCommand({ + type: "files.upload.begin", + sensitive: false, + body: z + .object({ + server_id: serverIdSchema, + path: z.string().min(1), + total_size: z.number().int().nonnegative(), + sha256: sha256HexSchema, + part_size: z.number().int().positive().optional(), + }) + .strict(), +}); + +export const filesUploadPartCommand = defineCommand({ + type: "files.upload.part", + sensitive: false, + body: z + .object({ + server_id: serverIdSchema, + upload_id: z.string().min(1), + part_index: z.number().int().nonnegative(), + data_base64: z.string(), + }) + .strict(), +}); + +export const filesUploadCommitCommand = defineCommand({ + type: "files.upload.commit", + sensitive: false, + body: z + .object({ + server_id: serverIdSchema, + upload_id: z.string().min(1), + }) + .strict(), +}); + +export const filesUploadAbortCommand = defineCommand({ + type: "files.upload.abort", + sensitive: false, + body: z + .object({ + server_id: serverIdSchema, + upload_id: z.string().min(1), + }) + .strict(), +}); + +export const filesDownloadBeginCommand = defineCommand({ + type: "files.download.begin", + sensitive: false, + body: z + .object({ + server_id: serverIdSchema, + path: z.string().min(1), + part_size: z.number().int().positive().optional(), + }) + .strict(), +}); + +export const filesDownloadPartCommand = defineCommand({ + type: "files.download.part", + sensitive: false, + body: z + .object({ + server_id: serverIdSchema, + download_id: z.string().min(1), + part_index: z.number().int().nonnegative(), + }) + .strict(), +}); + +export const filesDownloadCloseCommand = defineCommand({ + type: "files.download.close", + sensitive: false, + body: z + .object({ + server_id: serverIdSchema, + download_id: z.string().min(1), + }) + .strict(), +}); + +export const filesDownloadCommand = defineCommand({ + type: "files.download", + sensitive: false, + body: z + .object({ + server_id: serverIdSchema, + path: z.string().min(1), + offset: z.number().int().nonnegative(), + length: z.number().int().positive(), + }) + .strict(), +}); + +export const filesZipCommand = defineCommand({ + type: "files.zip", + sensitive: false, + body: z + .object({ + server_id: serverIdSchema, + paths: z.array(z.string().min(1)).min(1), + dest_path: z.string().min(1), + }) + .strict(), +}); + +export const filesUnzipCommand = defineCommand({ + type: "files.unzip", + sensitive: false, + body: z + .object({ + server_id: serverIdSchema, + zip_path: z.string().min(1), + dest_path: z.string().optional(), + }) + .strict(), +}); + +export const FILES_COMMANDS = [ + filesListCommand, + filesStatCommand, + filesReadCommand, + filesWriteCommand, + filesMkdirCommand, + filesRenameCommand, + filesMoveCommand, + filesCopyCommand, + filesDeleteCommand, + filesUploadBeginCommand, + filesUploadPartCommand, + filesUploadCommitCommand, + filesUploadAbortCommand, + filesDownloadBeginCommand, + filesDownloadPartCommand, + filesDownloadCloseCommand, + filesDownloadCommand, + filesZipCommand, + filesUnzipCommand, +] as const; + +export function registerFilesCommands(registry: CommandRegistry): CommandRegistry { + return registry.registerAll(FILES_COMMANDS); +} diff --git a/src/protocol/index.ts b/src/protocol/index.ts index 31521ce..1cf18ee 100644 --- a/src/protocol/index.ts +++ b/src/protocol/index.ts @@ -26,6 +26,33 @@ export { serverStartCommand, serverStopCommand, } from "./commands/core"; +export { + FILES_COMMANDS, + fileEncodingSchema, + filesCopyCommand, + filesDeleteCommand, + filesDownloadBeginCommand, + filesDownloadCloseCommand, + filesDownloadCommand, + filesDownloadPartCommand, + filesListCommand, + filesMkdirCommand, + filesReadCommand, + filesRenameCommand, + filesStatCommand, + filesUnzipCommand, + filesUploadAbortCommand, + filesUploadBeginCommand, + filesUploadCommitCommand, + filesUploadPartCommand, + filesWriteCommand, + filesZipCommand, + registerFilesCommands, + SERVER_ID_PATTERN, + SHA256_HEX_PATTERN, + serverIdSchema, + sha256HexSchema, +} from "./commands/files"; export { agentRevocationsSetCommand, PAIRING_COMMANDS, From 08b07b503a3adc3bcb26b7cf332435566f365523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 22 Nov 2026 20:06:10 -0300 Subject: [PATCH 08/59] feat: add Minecraft server runtime, managed Java, loaders, and console --- src/cli/run.ts | 19 + src/protocol/commands/core.ts | 13 +- src/protocol/commands/server.ts | 146 ++++++ src/protocol/errors.ts | 12 +- src/protocol/index.ts | 32 ++ src/server/console.test.ts | 162 +++++++ src/server/console.ts | 319 +++++++++++++ src/server/download.ts | 373 +++++++++++++++ src/server/id-and-script.test.ts | 261 +++++++++++ src/server/id.ts | 85 ++++ src/server/index.ts | 130 ++++++ src/server/java-and-loaders.test.ts | 575 +++++++++++++++++++++++ src/server/java.ts | 292 ++++++++++++ src/server/loaders.ts | 634 ++++++++++++++++++++++++++ src/server/memory-and-systemd.test.ts | 248 ++++++++++ src/server/memory.ts | 84 ++++ src/server/registry.ts | 244 ++++++++++ src/server/runtime.test.ts | 499 ++++++++++++++++++++ src/server/runtime.ts | 488 ++++++++++++++++++++ src/server/start-script.ts | 316 +++++++++++++ src/server/systemd.ts | 225 +++++++++ 21 files changed, 5154 insertions(+), 3 deletions(-) create mode 100644 src/protocol/commands/server.ts create mode 100644 src/server/console.test.ts create mode 100644 src/server/console.ts create mode 100644 src/server/download.ts create mode 100644 src/server/id-and-script.test.ts create mode 100644 src/server/id.ts create mode 100644 src/server/index.ts create mode 100644 src/server/java-and-loaders.test.ts create mode 100644 src/server/java.ts create mode 100644 src/server/loaders.ts create mode 100644 src/server/memory-and-systemd.test.ts create mode 100644 src/server/memory.ts create mode 100644 src/server/registry.ts create mode 100644 src/server/runtime.test.ts create mode 100644 src/server/runtime.ts create mode 100644 src/server/start-script.ts create mode 100644 src/server/systemd.ts diff --git a/src/cli/run.ts b/src/cli/run.ts index 06b8355..27a4aaa 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -19,6 +19,7 @@ import { } from "../agent"; import { fingerprint } from "../crypto"; import { type CommandRegistry, createCoreRegistry, type TransportFrame } from "../protocol"; +import { createServerManager, registerServerHandlers, type ServerManager } from "../server"; export const SHUTDOWN_DRAIN_TIMEOUT_MS = 10_000; @@ -44,12 +45,15 @@ export interface AgentRuntime { readonly queue: CommandQueue; readonly trust: FileTrustContext; readonly logger: Logger; + readonly serverManager?: ServerManager; start(): void; shutdown(drainTimeoutMs?: number): Promise; } export interface CreateAgentRuntimeOptions { readonly stateDir: string; + readonly serversDir?: string; + readonly runDir?: string; readonly env?: Readonly>; readonly logger?: Logger; readonly registry?: CommandRegistry; @@ -88,6 +92,19 @@ export async function createAgentRuntime( }, }); + const configuredServersDir = options.serversDir ?? env.TEGRAD_SERVERS_DIR?.trim(); + const configuredRunDir = options.runDir ?? env.TEGRAD_RUN_DIR?.trim(); + let serverManager: ServerManager | undefined; + if (configuredServersDir && configuredServersDir.length > 0) { + serverManager = createServerManager({ + serversDir: configuredServersDir, + logger, + ...(configuredRunDir && configuredRunDir.length > 0 ? { runDir: configuredRunDir } : {}), + ...(options.now !== undefined ? { now: options.now } : {}), + }); + registerServerHandlers(queue, serverManager); + } + const connection = createAgentConnection({ apiUrl: config.apiUrl, agentId, @@ -112,6 +129,7 @@ export async function createAgentRuntime( queue, trust, logger, + ...(serverManager !== undefined ? { serverManager } : {}), start(): void { logger.info("Starting tegrad", { agentId }); @@ -124,6 +142,7 @@ export async function createAgentRuntime( } shutdownPromise = (async () => { logger.info("Shutting down tegrad"); + serverManager?.close(); connection.stop(); const drained = await queue.drain(drainTimeoutMs); if (!drained) { diff --git a/src/protocol/commands/core.ts b/src/protocol/commands/core.ts index d9fdf34..660584f 100644 --- a/src/protocol/commands/core.ts +++ b/src/protocol/commands/core.ts @@ -4,11 +4,18 @@ import { z } from "zod"; import { CommandRegistry, defineCommand } from "../registry"; import { registerPairingCommands } from "./pairing"; +import { registerServerCommands, serverIdSchema } from "./server"; const serverIdBodySchema = z.object({ server_id: z.string().min(1), }); +const strictServerDeleteBodySchema = z + .object({ + server_id: serverIdSchema, + }) + .strict(); + export const agentPingCommand = defineCommand({ type: "agent.ping", sensitive: false, @@ -30,7 +37,7 @@ export const serverStopCommand = defineCommand({ export const serverDeleteCommand = defineCommand({ type: "server.delete", sensitive: true, - body: serverIdBodySchema, + body: strictServerDeleteBodySchema, }); export const CORE_COMMANDS = [ @@ -45,5 +52,7 @@ export function registerCoreCommands(registry: CommandRegistry): CommandRegistry } export function createCoreRegistry(): CommandRegistry { - return registerPairingCommands(registerCoreCommands(new CommandRegistry())); + return registerServerCommands( + registerPairingCommands(registerCoreCommands(new CommandRegistry())), + ); } diff --git a/src/protocol/commands/server.ts b/src/protocol/commands/server.ts new file mode 100644 index 0000000..57a9442 --- /dev/null +++ b/src/protocol/commands/server.ts @@ -0,0 +1,146 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; +import { type CommandRegistry, defineCommand } from "../registry"; + +export const SERVER_ID_REGEX = /^[a-z0-9][a-z0-9-]{0,62}$/; +export const DEFAULT_SERVER_PORT = 25565; +export const MAX_CONSOLE_LINE_LENGTH = 1024; +export const MIN_SERVER_MEMORY_MB = 512; +export const MAX_SERVER_MEMORY_MB = 1_048_576; +export const MAX_JVM_ARGS = 64; + +export const serverIdSchema = z + .string() + .regex(SERVER_ID_REGEX, "server_id must match ^[a-z0-9][a-z0-9-]{0,62}$"); + +export const serverLoaderSchema = z.enum(["vanilla", "fabric", "forge", "neoforge", "quilt"]); +export type ServerLoader = z.infer; + +export const serverPortSchema = z.number().int().min(1024).max(65535); +export const serverMemoryMbSchema = z + .number() + .int() + .min(MIN_SERVER_MEMORY_MB) + .max(MAX_SERVER_MEMORY_MB); + +export const consoleLineSchema = z + .string() + .min(1) + .max(MAX_CONSOLE_LINE_LENGTH) + .refine((value) => !/[\r\n\0]/.test(value), { + message: "Console line must not contain newline, carriage return, or NUL characters", + }); + +const strictServerIdBodySchema = z + .object({ + server_id: serverIdSchema, + }) + .strict(); + +export const serverCreateBodySchema = z + .object({ + server_id: serverIdSchema, + name: z.string().trim().min(1).max(128), + minecraft_version: z.string().min(1).max(64), + loader: serverLoaderSchema, + loader_version: z.string().min(1).max(64).optional(), + memory_mb: serverMemoryMbSchema, + jvm_args: z.array(z.string()).max(MAX_JVM_ARGS).optional(), + port: serverPortSchema.optional(), + eula_accepted: z.boolean(), + }) + .strict(); + +export const serverUpdateSettingsBodySchema = z + .object({ + server_id: serverIdSchema, + memory_mb: serverMemoryMbSchema.optional(), + jvm_args: z.array(z.string()).max(MAX_JVM_ARGS).optional(), + port: serverPortSchema.optional(), + eula_accepted: z.boolean().optional(), + }) + .strict(); + +export const serverConsoleSendBodySchema = z + .object({ + server_id: serverIdSchema, + line: consoleLineSchema, + }) + .strict(); + +export const serverConsoleSubscribeBodySchema = z + .object({ + server_id: serverIdSchema, + from_offset: z.number().int().nonnegative().optional(), + }) + .strict(); + +export type ServerCreateBody = z.infer; +export type ServerUpdateSettingsBody = z.infer; +export type ServerConsoleSendBody = z.infer; +export type ServerConsoleSubscribeBody = z.infer; + +export const serverCreateCommand = defineCommand({ + type: "server.create", + sensitive: false, + body: serverCreateBodySchema, +}); + +export const serverRestartCommand = defineCommand({ + type: "server.restart", + sensitive: false, + body: strictServerIdBodySchema, +}); + +export const serverStatusCommand = defineCommand({ + type: "server.status", + sensitive: false, + body: strictServerIdBodySchema, +}); + +export const serverListCommand = defineCommand({ + type: "server.list", + sensitive: false, + body: z.object({}).strict(), +}); + +export const serverUpdateSettingsCommand = defineCommand({ + type: "server.update_settings", + sensitive: false, + body: serverUpdateSettingsBodySchema, +}); + +export const serverConsoleSendCommand = defineCommand({ + type: "server.console.send", + sensitive: false, + body: serverConsoleSendBodySchema, +}); + +export const serverConsoleSubscribeCommand = defineCommand({ + type: "server.console.subscribe", + sensitive: false, + body: serverConsoleSubscribeBodySchema, +}); + +export const serverConsoleUnsubscribeCommand = defineCommand({ + type: "server.console.unsubscribe", + sensitive: false, + body: strictServerIdBodySchema, +}); + +export const SERVER_COMMANDS = [ + serverCreateCommand, + serverRestartCommand, + serverStatusCommand, + serverListCommand, + serverUpdateSettingsCommand, + serverConsoleSendCommand, + serverConsoleSubscribeCommand, + serverConsoleUnsubscribeCommand, +] as const; + +export function registerServerCommands(registry: CommandRegistry): CommandRegistry { + return registry.registerAll(SERVER_COMMANDS); +} diff --git a/src/protocol/errors.ts b/src/protocol/errors.ts index b222a24..3292b4f 100644 --- a/src/protocol/errors.ts +++ b/src/protocol/errors.ts @@ -25,7 +25,17 @@ export type ProtocolErrorCode = | "grant_proof_required" | "grant_bad_proof" | "revocation_stale" - | "revocation_not_superset"; + | "revocation_not_superset" + | "insufficient_memory" + | "eula_not_accepted" + | "server_not_found" + | "server_already_exists" + | "server_running" + | "server_stopped" + | "invalid_jvm_args" + | "download_failed" + | "hash_mismatch" + | "systemd_error"; export class ProtocolError extends Error { readonly code: ProtocolErrorCode; diff --git a/src/protocol/index.ts b/src/protocol/index.ts index 31521ce..ed11e6f 100644 --- a/src/protocol/index.ts +++ b/src/protocol/index.ts @@ -31,6 +31,38 @@ export { PAIRING_COMMANDS, registerPairingCommands, } from "./commands/pairing"; +export { + consoleLineSchema, + DEFAULT_SERVER_PORT, + MAX_CONSOLE_LINE_LENGTH, + MAX_JVM_ARGS, + MAX_SERVER_MEMORY_MB, + MIN_SERVER_MEMORY_MB, + registerServerCommands, + SERVER_COMMANDS, + SERVER_ID_REGEX, + type ServerConsoleSendBody, + type ServerConsoleSubscribeBody, + type ServerCreateBody, + type ServerLoader, + type ServerUpdateSettingsBody, + serverConsoleSendBodySchema, + serverConsoleSendCommand, + serverConsoleSubscribeBodySchema, + serverConsoleSubscribeCommand, + serverConsoleUnsubscribeCommand, + serverCreateBodySchema, + serverCreateCommand, + serverIdSchema, + serverListCommand, + serverLoaderSchema, + serverMemoryMbSchema, + serverPortSchema, + serverRestartCommand, + serverStatusCommand, + serverUpdateSettingsBodySchema, + serverUpdateSettingsCommand, +} from "./commands/server"; export { DOMAIN_AGENT_MESSAGE, DOMAIN_COMMAND, diff --git a/src/server/console.test.ts b/src/server/console.test.ts new file mode 100644 index 0000000..f7f823b --- /dev/null +++ b/src/server/console.test.ts @@ -0,0 +1,162 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, describe, expect, test } from "bun:test"; +import { appendFileSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { ProtocolError } from "../protocol"; +import { + type ConsoleLinesEvent, + type ConsoleTimerHandle, + type ConsoleTimerProvider, + createConsoleSubscriptionManager, + defaultWriteFifo, + sendConsoleLine, +} from "./index"; + +const tempDirs: string[] = []; + +function makeTempDir(prefix: string): string { + const dir = mkdtempSync(join(tmpdir(), prefix)); + tempDirs.push(dir); + return dir; +} + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +function makeFakeTimers() { + const callbacks = new Map void>(); + let nextId = 1; + const provider: ConsoleTimerProvider = { + setInterval(fn) { + const id = nextId++; + callbacks.set(id, fn); + return { id }; + }, + clearInterval(handle: ConsoleTimerHandle) { + callbacks.delete(handle.id as number); + }, + }; + return { + provider, + tickAll() { + for (const fn of [...callbacks.values()]) { + fn(); + } + }, + activeCount() { + return callbacks.size; + }, + }; +} + +describe("server.console.send", () => { + test("writes valid line terminated with LF and rejects CR, LF, NUL, empty, and >1024 chars", () => { + const written: { path: string; data: string }[] = []; + sendConsoleLine({ + runDir: "/run/tegrad-server", + serverId: "srv-1", + line: "say hello world", + writeFifoImpl: (path, data) => written.push({ path, data }), + }); + expect(written).toHaveLength(1); + expect(written[0]?.data).toBe("say hello world\n"); + + const invalidLines = ["", "say hi\nstop", "say hi\rstop", "say hi\0stop", "a".repeat(1025)]; + for (const line of invalidLines) { + try { + sendConsoleLine({ + runDir: "/run/tegrad-server", + serverId: "srv-1", + line, + writeFifoImpl: () => {}, + }); + throw new Error(`Expected rejection for line: ${JSON.stringify(line)}`); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe("invalid_body"); + } + } + }); + + test("maps ENOENT/ENXIO from FIFO open to server_stopped", () => { + const missingDir = makeTempDir("tegrad-fifo-missing-"); + try { + defaultWriteFifo(join(missingDir, "srv-1.stdin"), "stop\n"); + throw new Error("Expected server_stopped"); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe("server_stopped"); + } + }); +}); + +describe("console log subscription", () => { + test("streams new lines from offset, enforces per-event & per-second limits, and handles rotation", () => { + const serversDir = makeTempDir("tegrad-console-"); + const logsDir = join(serversDir, "srv-1", "logs"); + mkdirSync(logsDir, { recursive: true }); + const logPath = join(logsDir, "console.log"); + writeFileSync(logPath, "line 1\nline 2\n"); + + const timers = makeFakeTimers(); + let nowMs = 1_000_000; + const manager = createConsoleSubscriptionManager({ + serversDir, + timers: timers.provider, + maxLinesPerEvent: 3, + maxBytesPerEvent: 4096, + maxLinesPerSecond: 5, + now: () => nowMs, + }); + + const events: ConsoleLinesEvent[] = []; + manager.subscribe({ + serverId: "srv-1", + sendEvent: (_type, body) => events.push(body), + }); + + expect(events).toHaveLength(1); + expect(events[0]?.lines).toEqual(["line 1", "line 2"]); + expect(events[0]?.next_offset).toBe(Buffer.byteLength("line 1\nline 2\n")); + expect(events[0]?.reset).toBeUndefined(); + + // Append 5 more lines: per-event cap is 3, and per-second cap is 5 (already emitted 2 -> budget 3 left) + appendFileSync(logPath, "line 3\nline 4\nline 5\nline 6\nline 7\n"); + timers.tickAll(); + expect(events).toHaveLength(2); + expect(events[1]?.lines).toEqual(["line 3", "line 4", "line 5"]); + expect(events[1]?.truncated).toBe(true); + + // Same second: rate limit reached (5 lines already emitted in this 1s window) + timers.tickAll(); + expect(events).toHaveLength(2); + + // Advance clock 1 second: remaining 2 lines delivered + nowMs += 1000; + timers.tickAll(); + expect(events).toHaveLength(3); + expect(events[2]?.lines).toEqual(["line 6", "line 7"]); + + // Simulate log truncation / rotation + writeFileSync(logPath, "fresh boot\n"); + timers.tickAll(); + expect(events).toHaveLength(4); + expect(events[3]?.reset).toBe(true); + expect(events[3]?.lines).toEqual(["fresh boot"]); + expect(events[3]?.next_offset).toBe(Buffer.byteLength("fresh boot\n")); + + expect(timers.activeCount()).toBe(1); + manager.unsubscribe("srv-1"); + expect(timers.activeCount()).toBe(0); + expect(manager.hasSubscription("srv-1")).toBe(false); + }); +}); diff --git a/src/server/console.ts b/src/server/console.ts new file mode 100644 index 0000000..fa65ad8 --- /dev/null +++ b/src/server/console.ts @@ -0,0 +1,319 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { closeSync, constants, existsSync, openSync, readSync, statSync, writeSync } from "node:fs"; +import { consoleLineSchema, ProtocolError } from "../protocol"; +import { assertValidServerId, resolveFifoPath, resolveServerDir, resolveServerSubpath } from "./id"; + +export const DEFAULT_CONSOLE_POLL_MS = 100; +export const MAX_LINES_PER_EVENT = 200; +export const MAX_BYTES_PER_EVENT = 64 * 1024; +export const MAX_LINES_PER_SECOND = 1000; + +export type FifoWriter = (fifoPath: string, data: string) => void; + +export interface ConsoleTimerHandle { + readonly id?: unknown; +} + +export interface ConsoleTimerProvider { + setInterval(fn: () => void, ms: number): ConsoleTimerHandle; + clearInterval(handle: ConsoleTimerHandle): void; +} + +export const defaultConsoleTimers: ConsoleTimerProvider = { + setInterval(fn, ms) { + const id = setInterval(fn, ms); + return { id }; + }, + clearInterval(handle) { + clearInterval(handle.id as ReturnType); + }, +}; + +function getErrnoCode(err: unknown): string | undefined { + if (typeof err === "object" && err !== null && "code" in err) { + const code = (err as { code: unknown }).code; + return typeof code === "string" ? code : undefined; + } + return undefined; +} + +export function defaultWriteFifo(fifoPath: string, data: string): void { + const flags = constants.O_WRONLY | (constants.O_NONBLOCK ?? 0); + let fd: number | undefined; + try { + fd = openSync(fifoPath, flags); + const buf = Buffer.from(data, "utf8"); + let written = 0; + while (written < buf.byteLength) { + written += writeSync(fd, buf, written, buf.byteLength - written); + } + } catch (err) { + const code = getErrnoCode(err); + if (code === "ENXIO" || code === "ENOENT") { + throw new ProtocolError( + "server_stopped", + "Server is not running or console FIFO has no reader", + ); + } + throw new ProtocolError("systemd_error", "Failed to write to server console FIFO"); + } finally { + if (fd !== undefined) { + try { + closeSync(fd); + } catch { + // ignore close failure + } + } + } +} + +export interface SendConsoleLineOptions { + readonly runDir: string; + readonly serverId: string; + readonly line: string; + readonly writeFifoImpl?: FifoWriter; +} + +export function sendConsoleLine(options: SendConsoleLineOptions): void { + const validId = assertValidServerId(options.serverId); + const parsedLine = consoleLineSchema.safeParse(options.line); + if (!parsedLine.success) { + throw new ProtocolError( + "invalid_body", + "Invalid console line: must be 1..1024 chars without CR, LF, or NUL", + ); + } + + const fifoPath = resolveFifoPath(options.runDir, validId); + const writer = options.writeFifoImpl ?? defaultWriteFifo; + writer(fifoPath, `${parsedLine.data}\n`); +} + +export interface ConsoleLinesEvent { + readonly server_id: string; + readonly lines: readonly string[]; + readonly next_offset: number; + readonly reset?: true; + readonly truncated?: true; +} + +export type ConsoleEventEmitter = (type: string, body: ConsoleLinesEvent) => void; + +export interface ConsoleSubscriptionManagerOptions { + readonly serversDir: string; + readonly pollIntervalMs?: number; + readonly maxLinesPerEvent?: number; + readonly maxBytesPerEvent?: number; + readonly maxLinesPerSecond?: number; + readonly timers?: ConsoleTimerProvider; + readonly now?: () => number; +} + +interface ActiveSubscription { + readonly serverId: string; + readonly logPath: string; + readonly sendEvent: ConsoleEventEmitter; + readonly timer: ConsoleTimerHandle; + offset: number; + windowStartMs: number; + windowLineCount: number; +} + +export interface ConsoleSubscriptionManager { + subscribe(params: { + readonly serverId: string; + readonly fromOffset?: number; + readonly sendEvent: ConsoleEventEmitter; + }): void; + unsubscribe(serverId: string): void; + pollOnce(serverId: string): void; + hasSubscription(serverId: string): boolean; + closeAll(): void; +} + +export function createConsoleSubscriptionManager( + options: ConsoleSubscriptionManagerOptions, +): ConsoleSubscriptionManager { + const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_CONSOLE_POLL_MS; + const maxLinesPerEvent = options.maxLinesPerEvent ?? MAX_LINES_PER_EVENT; + const maxBytesPerEvent = options.maxBytesPerEvent ?? MAX_BYTES_PER_EVENT; + const maxLinesPerSecond = options.maxLinesPerSecond ?? MAX_LINES_PER_SECOND; + const timers = options.timers ?? defaultConsoleTimers; + const now = options.now ?? (() => Date.now()); + + const subscriptions = new Map(); + + function pollSubscription(sub: ActiveSubscription): void { + if (!existsSync(sub.logPath)) { + return; + } + + let fileSize: number; + try { + fileSize = statSync(sub.logPath).size; + } catch { + return; + } + + let reset = false; + if (fileSize < sub.offset) { + sub.offset = 0; + reset = true; + } + + const availableBytes = fileSize - sub.offset; + if (availableBytes <= 0) { + if (reset) { + sub.sendEvent("server.console.lines", { + server_id: sub.serverId, + lines: [], + next_offset: 0, + reset: true, + }); + } + return; + } + + const currentTime = now(); + if (currentTime - sub.windowStartMs >= 1000) { + sub.windowStartMs = currentTime; + sub.windowLineCount = 0; + } + + const remainingPerSecond = maxLinesPerSecond - sub.windowLineCount; + if (remainingPerSecond <= 0) { + return; + } + + const lineBudget = Math.min(maxLinesPerEvent, remainingPerSecond); + const bytesToRead = Math.min(availableBytes, maxBytesPerEvent); + const buffer = Buffer.allocUnsafe(bytesToRead); + + let bytesRead = 0; + let fd: number | undefined; + try { + fd = openSync(sub.logPath, "r"); + bytesRead = readSync(fd, buffer, 0, bytesToRead, sub.offset); + } catch { + return; + } finally { + if (fd !== undefined) { + try { + closeSync(fd); + } catch { + // ignore close failure + } + } + } + + if (bytesRead <= 0) { + return; + } + + const slice = buffer.subarray(0, bytesRead); + const lines: string[] = []; + let consumedBytes = 0; + let lineStart = 0; + let truncated = availableBytes > bytesToRead; + + for (let i = 0; i < slice.byteLength; i++) { + if (slice[i] === 0x0a) { + const lineEnd = i > lineStart && slice[i - 1] === 0x0d ? i - 1 : i; + lines.push(slice.subarray(lineStart, lineEnd).toString("utf8")); + consumedBytes = i + 1; + lineStart = i + 1; + + if (lines.length >= lineBudget) { + if (consumedBytes < slice.byteLength || availableBytes > bytesToRead) { + truncated = true; + } + break; + } + } + } + + // If a single line exceeds maxBytesPerEvent without any newline, flush it so the reader makes progress. + if (lines.length === 0 && bytesRead >= maxBytesPerEvent) { + lines.push(slice.toString("utf8")); + consumedBytes = bytesRead; + truncated = true; + } + + if (lines.length === 0 && !reset) { + return; + } + + sub.offset += consumedBytes; + sub.windowLineCount += lines.length; + + const event: ConsoleLinesEvent = { + server_id: sub.serverId, + lines, + next_offset: sub.offset, + ...(reset ? { reset: true as const } : {}), + ...(truncated ? { truncated: true as const } : {}), + }; + sub.sendEvent("server.console.lines", event); + } + + function unsubscribe(serverId: string): void { + const validId = assertValidServerId(serverId); + const existing = subscriptions.get(validId); + if (existing !== undefined) { + timers.clearInterval(existing.timer); + subscriptions.delete(validId); + } + } + + return { + subscribe(params) { + const validId = assertValidServerId(params.serverId); + const serverDir = resolveServerDir(options.serversDir, validId); + if (!existsSync(serverDir)) { + throw new ProtocolError("server_not_found", `Server not found: ${validId}`); + } + const logPath = resolveServerSubpath(serverDir, "logs/console.log"); + + unsubscribe(validId); + + const sub: ActiveSubscription = { + serverId: validId, + logPath, + sendEvent: params.sendEvent, + offset: params.fromOffset ?? 0, + windowStartMs: now(), + windowLineCount: 0, + timer: timers.setInterval(() => { + pollSubscription(sub); + }, pollIntervalMs), + }; + + subscriptions.set(validId, sub); + pollSubscription(sub); + }, + + unsubscribe, + + pollOnce(serverId: string) { + const validId = assertValidServerId(serverId); + const sub = subscriptions.get(validId); + if (sub !== undefined) { + pollSubscription(sub); + } + }, + + hasSubscription(serverId: string) { + const validId = assertValidServerId(serverId); + return subscriptions.has(validId); + }, + + closeAll() { + for (const sub of subscriptions.values()) { + timers.clearInterval(sub.timer); + } + subscriptions.clear(); + }, + }; +} diff --git a/src/server/download.ts b/src/server/download.ts new file mode 100644 index 0000000..eeb3740 --- /dev/null +++ b/src/server/download.ts @@ -0,0 +1,373 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { createHash, randomBytes, timingSafeEqual } from "node:crypto"; +import { + chmodSync, + closeSync, + existsSync, + fsyncSync, + mkdirSync, + openSync, + renameSync, + unlinkSync, + writeSync, +} from "node:fs"; +import { basename, dirname, join } from "node:path"; +import type { z } from "zod"; +import { ProtocolError } from "../protocol"; + +export type FetchLike = (input: string | URL, init?: RequestInit) => Promise; +export type HashAlgorithm = "sha256" | "sha1"; + +export const DEFAULT_MAX_JSON_BYTES = 2 * 1024 * 1024; +export const DEFAULT_MAX_TEXT_BYTES = 256 * 1024; +export const DEFAULT_MAX_BINARY_BYTES = 300 * 1024 * 1024; +export const DEFAULT_MAX_REDIRECTS = 5; +export const DEFAULT_DOWNLOAD_TIMEOUT_MS = 60_000; + +const SHA256_HEX_REGEX = /^[0-9a-f]{64}$/i; +const SHA1_HEX_REGEX = /^[0-9a-f]{40}$/i; + +function isPosix(platform: NodeJS.Platform = process.platform): boolean { + return platform !== "win32"; +} + +export function validateDownloadUrl(rawUrl: string, allowedHosts: ReadonlySet): URL { + let parsed: URL; + try { + parsed = new URL(rawUrl); + } catch { + throw new ProtocolError("download_failed", "Invalid download URL"); + } + + if (parsed.protocol !== "https:") { + throw new ProtocolError( + "download_failed", + `Download URL must use https:// (got ${parsed.protocol})`, + ); + } + + if (parsed.username || parsed.password) { + throw new ProtocolError("download_failed", "Download URL must not contain credentials"); + } + + const host = parsed.hostname.toLowerCase(); + if (!allowedHosts.has(host)) { + throw new ProtocolError("download_failed", `Download host is not allowed: ${host}`); + } + + return parsed; +} + +export interface FetchAllowlistOptions { + readonly allowedHosts: ReadonlySet; + readonly fetchImpl?: FetchLike; + readonly maxRedirects?: number; + readonly timeoutMs?: number; + readonly accept?: string; +} + +export async function fetchWithAllowlist( + rawUrl: string, + options: FetchAllowlistOptions, +): Promise { + const fetchFn: FetchLike = options.fetchImpl ?? ((input, init) => globalThis.fetch(input, init)); + const maxRedirects = options.maxRedirects ?? DEFAULT_MAX_REDIRECTS; + const timeoutMs = options.timeoutMs ?? DEFAULT_DOWNLOAD_TIMEOUT_MS; + + let currentUrl = validateDownloadUrl(rawUrl, options.allowedHosts); + + for (let hop = 0; hop <= maxRedirects; hop++) { + const controller = new AbortController(); + const timer = setTimeout(() => controller.abort(), timeoutMs); + let response: Response; + + try { + const headers: Record = {}; + if (options.accept !== undefined) { + headers.Accept = options.accept; + } + response = await fetchFn(currentUrl.toString(), { + method: "GET", + redirect: "manual", + signal: controller.signal, + headers, + }); + } catch { + throw new ProtocolError("download_failed", `Failed to fetch ${currentUrl.hostname}`); + } finally { + clearTimeout(timer); + } + + if ( + response.status === 301 || + response.status === 302 || + response.status === 303 || + response.status === 307 || + response.status === 308 + ) { + const location = response.headers.get("location"); + if (!location) { + throw new ProtocolError("download_failed", "Redirect response missing Location header"); + } + if (hop === maxRedirects) { + throw new ProtocolError("download_failed", "Exceeded maximum redirect hops"); + } + let nextUrlStr: string; + try { + nextUrlStr = new URL(location, currentUrl).toString(); + } catch { + throw new ProtocolError("download_failed", "Malformed redirect Location URL"); + } + currentUrl = validateDownloadUrl(nextUrlStr, options.allowedHosts); + continue; + } + + if (!response.ok) { + throw new ProtocolError( + "download_failed", + `Download request to ${currentUrl.hostname} failed with HTTP ${response.status}`, + ); + } + + return response; + } + + throw new ProtocolError("download_failed", "Exceeded maximum redirect hops"); +} + +async function readResponseBytesCapped(response: Response, maxBytes: number): Promise { + const contentLengthHeader = response.headers.get("content-length"); + if (contentLengthHeader !== null) { + const declared = Number(contentLengthHeader); + if (Number.isFinite(declared) && declared > maxBytes) { + throw new ProtocolError("download_failed", "Response exceeds maximum allowed size"); + } + } + + if (response.body === null) { + const buf = new Uint8Array(await response.arrayBuffer()); + if (buf.byteLength > maxBytes) { + throw new ProtocolError("download_failed", "Response exceeds maximum allowed size"); + } + return buf; + } + + const reader = response.body.getReader(); + const chunks: Uint8Array[] = []; + let total = 0; + + try { + while (true) { + const { value, done } = await reader.read(); + if (done) { + break; + } + if (value === undefined || value.byteLength === 0) { + continue; + } + total += value.byteLength; + if (total > maxBytes) { + await reader.cancel(); + throw new ProtocolError("download_failed", "Response exceeds maximum allowed size"); + } + chunks.push(value); + } + } finally { + reader.releaseLock(); + } + + const out = new Uint8Array(total); + let offset = 0; + for (const chunk of chunks) { + out.set(chunk, offset); + offset += chunk.byteLength; + } + return out; +} + +export async function fetchTextWithAllowlist( + rawUrl: string, + options: FetchAllowlistOptions & { readonly maxBytes?: number }, +): Promise { + const response = await fetchWithAllowlist(rawUrl, options); + const bytes = await readResponseBytesCapped(response, options.maxBytes ?? DEFAULT_MAX_TEXT_BYTES); + return new TextDecoder("utf-8", { fatal: true }).decode(bytes); +} + +export async function fetchJsonWithAllowlist( + rawUrl: string, + schema: z.ZodType, + options: FetchAllowlistOptions & { readonly maxBytes?: number }, +): Promise { + const response = await fetchWithAllowlist(rawUrl, { + ...options, + accept: options.accept ?? "application/json", + }); + const bytes = await readResponseBytesCapped(response, options.maxBytes ?? DEFAULT_MAX_JSON_BYTES); + + let rawJson: unknown; + try { + rawJson = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes)) as unknown; + } catch { + throw new ProtocolError("download_failed", "Invalid JSON payload from remote endpoint"); + } + + const parsed = schema.safeParse(rawJson); + if (!parsed.success) { + throw new ProtocolError("download_failed", "Remote JSON failed schema validation"); + } + + return parsed.data; +} + +export function normalizeExpectedHash(algorithm: HashAlgorithm, rawHex: string): string { + const trimmed = rawHex.trim().toLowerCase(); + const regex = algorithm === "sha256" ? SHA256_HEX_REGEX : SHA1_HEX_REGEX; + if (!regex.test(trimmed)) { + throw new ProtocolError("hash_mismatch", `Invalid expected ${algorithm} checksum format`); + } + return trimmed; +} + +export function compareHexDigests(actualHex: string, expectedHex: string): boolean { + const a = Buffer.from(actualHex.toLowerCase(), "hex"); + const b = Buffer.from(expectedHex.toLowerCase(), "hex"); + if (a.byteLength === 0 || a.byteLength !== b.byteLength) { + return false; + } + return timingSafeEqual(a, b); +} + +export async function fetchSidecarHash( + rawUrl: string, + algorithm: HashAlgorithm, + options: FetchAllowlistOptions, +): Promise { + const text = await fetchTextWithAllowlist(rawUrl, { + ...options, + maxBytes: 4096, + }); + const token = text.trim().split(/\s+/)[0] ?? ""; + return normalizeExpectedHash(algorithm, token); +} + +export interface DownloadVerifiedFileOptions extends FetchAllowlistOptions { + readonly url: string; + readonly destPath: string; + readonly expectedHash: { + readonly algorithm: HashAlgorithm; + readonly hex: string; + }; + readonly maxBytes?: number; + readonly fileMode?: number; + readonly dirMode?: number; +} + +export async function downloadVerifiedFile( + options: DownloadVerifiedFileOptions, +): Promise<{ readonly bytes: number; readonly hash: string }> { + const expectedHex = normalizeExpectedHash( + options.expectedHash.algorithm, + options.expectedHash.hex, + ); + const maxBytes = options.maxBytes ?? DEFAULT_MAX_BINARY_BYTES; + const fileMode = options.fileMode ?? 0o640; + const dirMode = options.dirMode ?? 0o750; + + const response = await fetchWithAllowlist(options.url, options); + + const contentLengthHeader = response.headers.get("content-length"); + if (contentLengthHeader !== null) { + const declared = Number(contentLengthHeader); + if (Number.isFinite(declared) && declared > maxBytes) { + throw new ProtocolError("download_failed", "Download exceeds maximum allowed size"); + } + } + + const dir = dirname(options.destPath); + mkdirSync(dir, { recursive: true, mode: dirMode }); + if (isPosix()) { + chmodSync(dir, dirMode); + } + + const suffix = randomBytes(8).toString("hex"); + const tmpPath = join(dir, `.tmp-${basename(options.destPath)}-${process.pid}-${suffix}`); + const hasher = createHash(options.expectedHash.algorithm); + let fd: number | undefined; + let totalBytes = 0; + + try { + fd = openSync(tmpPath, "wx", fileMode); + + if (response.body === null) { + const buf = new Uint8Array(await response.arrayBuffer()); + if (buf.byteLength > maxBytes) { + throw new ProtocolError("download_failed", "Download exceeds maximum allowed size"); + } + if (buf.byteLength > 0) { + hasher.update(buf); + writeSync(fd, buf, 0, buf.byteLength); + totalBytes = buf.byteLength; + } + } else { + const reader = response.body.getReader(); + try { + while (true) { + const { value, done } = await reader.read(); + if (done) { + break; + } + if (value === undefined || value.byteLength === 0) { + continue; + } + totalBytes += value.byteLength; + if (totalBytes > maxBytes) { + await reader.cancel(); + throw new ProtocolError("download_failed", "Download exceeds maximum allowed size"); + } + hasher.update(value); + writeSync(fd, value, 0, value.byteLength); + } + } finally { + reader.releaseLock(); + } + } + + fsyncSync(fd); + closeSync(fd); + fd = undefined; + + const actualHex = hasher.digest("hex"); + if (!compareHexDigests(actualHex, expectedHex)) { + throw new ProtocolError( + "hash_mismatch", + `Checksum mismatch (${options.expectedHash.algorithm}) for downloaded artifact`, + ); + } + + if (isPosix()) { + chmodSync(tmpPath, fileMode); + } + + renameSync(tmpPath, options.destPath); + return { bytes: totalBytes, hash: actualHex }; + } catch (err) { + if (fd !== undefined) { + try { + closeSync(fd); + } catch { + // ignore close cleanup failure + } + } + try { + if (existsSync(tmpPath)) { + unlinkSync(tmpPath); + } + } catch { + // ignore unlink cleanup failure + } + throw err; + } +} diff --git a/src/server/id-and-script.test.ts b/src/server/id-and-script.test.ts new file mode 100644 index 0000000..b93a4c9 --- /dev/null +++ b/src/server/id-and-script.test.ts @@ -0,0 +1,261 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { describe, expect, test } from "bun:test"; +import { resolve } from "node:path"; +import { ProtocolError, type ProtocolErrorCode } from "../protocol"; +import { + assertValidServerId, + formatServiceUnit, + formatSocketUnit, + renderStartScript, + resolveFifoPath, + resolveServerDir, + resolveServerSubpath, + SERVER_ID_REGEX, + validateJvmArgs, +} from "./index"; + +function expectProtocolErrorSync(fn: () => unknown, expectedCode: ProtocolErrorCode): void { + try { + fn(); + throw new Error(`Expected ProtocolError(${expectedCode}), but succeeded`); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe(expectedCode); + } +} + +describe("server_id validation and path confinement", () => { + test("accepts valid server IDs matching ^[a-z0-9][a-z0-9-]{0,62}$", () => { + const valid = ["a", "0", "srv1", "survival-2026", "my-mc-server-01", `a${"b".repeat(62)}`]; + for (const id of valid) { + expect(SERVER_ID_REGEX.test(id)).toBe(true); + expect(assertValidServerId(id)).toBe(id); + expect(formatServiceUnit(id)).toBe(`tegrad-server@${id}.service`); + expect(formatSocketUnit(id)).toBe(`tegrad-server@${id}.socket`); + } + }); + + test("rejects invalid server IDs including traversal, uppercase, underscore, and oversize", () => { + const invalid = [ + "", + "-leading-dash", + "UpperCase", + "has_underscore", + "has space", + "..", + "../escape", + "a/b", + "a\\b", + "srv.1", + "srv;id", + "srv\0null", + `a${"b".repeat(63)}`, + ]; + for (const id of invalid) { + expect(SERVER_ID_REGEX.test(id)).toBe(false); + expectProtocolErrorSync(() => assertValidServerId(id), "invalid_body"); + expectProtocolErrorSync( + () => resolveServerDir("/var/lib/tegrad-servers", id), + "invalid_body", + ); + expectProtocolErrorSync(() => resolveFifoPath("/run/tegrad-server", id), "invalid_body"); + expectProtocolErrorSync(() => formatServiceUnit(id), "invalid_body"); + } + }); + + test("resolveServerDir and resolveServerSubpath stay strictly inside root", () => { + const root = resolve("/var/lib/tegrad-servers"); + const srvDir = resolveServerDir(root, "srv-1"); + expect(srvDir).toBe(resolve(root, "srv-1")); + + const logPath = resolveServerSubpath(srvDir, "logs/console.log"); + expect(logPath).toBe(resolve(srvDir, "logs/console.log")); + + expectProtocolErrorSync( + () => resolveServerSubpath(srvDir, "../other/server.jar"), + "invalid_body", + ); + expectProtocolErrorSync(() => resolveServerSubpath(srvDir, "/etc/passwd"), "invalid_body"); + expectProtocolErrorSync(() => resolveServerSubpath(srvDir, "logs/\0bad"), "invalid_body"); + }); +}); + +describe("JVM argument allowlist", () => { + test("accepts curated safe GC flags, stack size, and safe system properties", () => { + const safeArgs = [ + "-Xss2M", + "-XX:+UseG1GC", + "-XX:+ParallelRefProcEnabled", + "-XX:MaxGCPauseMillis=200", + "-XX:+UnlockExperimentalVMOptions", + "-XX:+DisableExplicitGC", + "-XX:+AlwaysPreTouch", + "-XX:G1NewSizePercent=30", + "-XX:G1MaxNewSizePercent=40", + "-XX:G1HeapRegionSize=8M", + "-XX:G1ReservePercent=20", + "-XX:G1HeapWastePercent=5", + "-XX:G1MixedGCCountTarget=4", + "-XX:InitiatingHeapOccupancyPercent=15", + "-XX:G1MixedGCLiveThresholdPercent=90", + "-XX:G1RSetUpdatingPauseTimePercent=5", + "-XX:SurvivorRatio=32", + "-XX:+PerfDisableSharedMem", + "-XX:MaxTenuringThreshold=1", + "-Dlog4j2.formatMsgNoLookups=true", + "-Dusing.aikars.flags=https://mcflags.emc.gs", + "-Daikars.new.flags=true", + ]; + expect(validateJvmArgs(safeArgs)).toEqual(safeArgs); + }); + + test("rejects every injection attempt, unsafe JVM flag, and blocked system property", () => { + const maliciousArgs = [ + "-javaagent:/tmp/evil.jar", + "-javaagent", + "-agentlib:jdwp=transport=dt_socket", + "-agentpath:/tmp/evil.so", + "-cp", + "-classpath", + "--class-path", + "-jar", + "-p", + "--module-path=/tmp", + "--upgrade-module-path=/tmp", + "--patch-module=java.base=/tmp", + "--add-opens=java.base/java.lang=ALL-UNNAMED", + "--add-exports=java.base/sun.misc=ALL-UNNAMED", + "--add-reads=java.base=ALL-UNNAMED", + "--add-modules=ALL-SYSTEM", + "-XX:OnOutOfMemoryError=id", + "-XX:OnError=sh", + "-XX:ErrorFile=/tmp/err", + "-XX:HeapDumpPath=/tmp/dump", + "-XX:LogFile=/tmp/log", + "-XX:CompileCommandFile=/tmp/cmd", + "-XX:SharedArchiveFile=/tmp/jsa", + "-Xbootclasspath/a:/tmp/evil.jar", + "-Xlog:gc*:file=/tmp/gc.log", + "-Xms4096M", + "-Xmx4096M", + "@/etc/passwd", + "@libraries/net/minecraftforge/forge/unix_args.txt", + "-XX:+UseG1GC;id", + "-XX:+UseG1GC|sh", + "-XX:+UseG1GC&id", + "-XX:+UseG1GC$(id)", + "-XX:+UseG1GC`id`", + "-XX:+UseG1GC\nid", + "-XX:+UseG1GC\rid", + "-XX:+UseG1GC\0id", + "-XX:+UseG1GC 'x'", + '-XX:+UseG1GC "x"', + "-XX:+UnknownFlag", + "-XX:MaxGCPauseMillis=200;rm", + "-Djava.security.policy=/tmp/all.policy", + "-Dcom.sun.management.jmxremote.port=9999", + "-Djavax.net.ssl.trustStore=/tmp/ts", + "-Dsun.rmi.transport.tcp.responseTimeout=1", + "-Djava.library.path=/tmp", + "-Duser.home=/root", + "-Djava.io.tmpdir=/tmp", + "-Dlog4j2.formatMsgNoLookups=false", + "-Dfoo.bar=../../etc/passwd", + "", + ]; + + for (const arg of maliciousArgs) { + expectProtocolErrorSync(() => validateJvmArgs([arg]), "invalid_jvm_args"); + } + }); +}); + +describe("start.sh golden tests", () => { + test("Vanilla server start.sh matches exact golden output", () => { + const script = renderStartScript({ + javaBin: "/var/lib/tegrad-servers/.runtime/java/21/bin/java", + memoryMb: 2048, + jvmArgs: ["-XX:+UseG1GC", "-XX:MaxGCPauseMillis=200"], + serverDir: "/var/lib/tegrad-servers/srv1", + launchTarget: { + kind: "jar", + jar_relative_path: "server.jar", + }, + }); + + expect(script).toBe( + [ + "#!/bin/sh", + "set -eu", + "exec '/var/lib/tegrad-servers/.runtime/java/21/bin/java' -Xms2048M -Xmx2048M '-XX:+UseG1GC' '-XX:MaxGCPauseMillis=200' -jar '/var/lib/tegrad-servers/srv1/server.jar' nogui", + "", + ].join("\n"), + ); + }); + + test("Fabric server start.sh matches exact golden output", () => { + const script = renderStartScript({ + javaBin: "/var/lib/tegrad-servers/.runtime/java/21/bin/java", + memoryMb: 4096, + jvmArgs: [], + serverDir: "/var/lib/tegrad-servers/fabric-smp", + launchTarget: { + kind: "jar", + jar_relative_path: "fabric-server-launch.jar", + }, + }); + + expect(script).toBe( + [ + "#!/bin/sh", + "set -eu", + "exec '/var/lib/tegrad-servers/.runtime/java/21/bin/java' -Xms4096M -Xmx4096M -jar '/var/lib/tegrad-servers/fabric-smp/fabric-server-launch.jar' nogui", + "", + ].join("\n"), + ); + }); + + test("Forge/NeoForge unix_args.txt start.sh matches exact golden output", () => { + const forgeScript = renderStartScript({ + javaBin: "/var/lib/tegrad-servers/.runtime/java/17/bin/java", + memoryMb: 6144, + jvmArgs: ["-XX:+UseG1GC"], + serverDir: "/var/lib/tegrad-servers/modded-1", + launchTarget: { + kind: "args_file", + args_file_relative_path: "libraries/net/minecraftforge/forge/1.20.1-47.2.0/unix_args.txt", + }, + }); + + expect(forgeScript).toBe( + [ + "#!/bin/sh", + "set -eu", + "exec '/var/lib/tegrad-servers/.runtime/java/17/bin/java' -Xms6144M -Xmx6144M '-XX:+UseG1GC' '@libraries/net/minecraftforge/forge/1.20.1-47.2.0/unix_args.txt' nogui", + "", + ].join("\n"), + ); + + const neoForgeScript = renderStartScript({ + javaBin: "/var/lib/tegrad-servers/.runtime/java/21/bin/java", + memoryMb: 8192, + jvmArgs: ["-XX:+UseZGC", "-XX:+ZGenerational"], + serverDir: "/var/lib/tegrad-servers/neo-1", + launchTarget: { + kind: "args_file", + args_file_relative_path: "libraries/net/neoforged/neoforge/21.1.72/unix_args.txt", + }, + }); + + expect(neoForgeScript).toBe( + [ + "#!/bin/sh", + "set -eu", + "exec '/var/lib/tegrad-servers/.runtime/java/21/bin/java' -Xms8192M -Xmx8192M '-XX:+UseZGC' '-XX:+ZGenerational' '@libraries/net/neoforged/neoforge/21.1.72/unix_args.txt' nogui", + "", + ].join("\n"), + ); + }); +}); diff --git a/src/server/id.ts b/src/server/id.ts new file mode 100644 index 0000000..2789bdb --- /dev/null +++ b/src/server/id.ts @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { existsSync, realpathSync } from "node:fs"; +import { isAbsolute, relative, resolve } from "node:path"; +import { ProtocolError, SERVER_ID_REGEX, serverIdSchema } from "../protocol"; + +export { SERVER_ID_REGEX, serverIdSchema }; + +export const DEFAULT_SERVERS_DIR = "/var/lib/tegrad-servers"; +export const DEFAULT_RUN_DIR = "/run/tegrad-server"; + +export function assertValidServerId(id: string): string { + const parsed = serverIdSchema.safeParse(id); + if (!parsed.success) { + throw new ProtocolError( + "invalid_body", + "Invalid server_id: must match ^[a-z0-9][a-z0-9-]{0,62}$", + ); + } + return parsed.data; +} + +function assertStrictlyInside(rootDir: string, candidatePath: string, label: string): void { + const resolvedRoot = resolve(rootDir); + const resolvedCandidate = resolve(candidatePath); + const rel = relative(resolvedRoot, resolvedCandidate); + + if (rel.length === 0 || rel === "." || rel.startsWith("..") || isAbsolute(rel)) { + throw new ProtocolError("invalid_body", `${label} escapes allowed directory`); + } + + if (existsSync(resolvedRoot) && existsSync(resolvedCandidate)) { + const realRoot = realpathSync(resolvedRoot); + const realCandidate = realpathSync(resolvedCandidate); + const realRel = relative(realRoot, realCandidate); + if ( + realRel.length === 0 || + realRel === "." || + realRel.startsWith("..") || + isAbsolute(realRel) + ) { + throw new ProtocolError("invalid_body", `${label} symlink escapes allowed directory`); + } + } +} + +export function resolveServerDir(serversDir: string, id: string): string { + const validId = assertValidServerId(id); + const root = resolve(serversDir); + const target = resolve(root, validId); + assertStrictlyInside(root, target, "Server directory"); + return target; +} + +export function resolveServerSubpath(serverDir: string, relativePath: string): string { + if (relativePath.length === 0 || relativePath.includes("\0")) { + throw new ProtocolError("invalid_body", "Invalid server subpath"); + } + if (isAbsolute(relativePath)) { + throw new ProtocolError("invalid_body", "Server subpath must be relative"); + } + const root = resolve(serverDir); + const target = resolve(root, relativePath); + assertStrictlyInside(root, target, "Server subpath"); + return target; +} + +export function resolveFifoPath(runDir: string, id: string): string { + const validId = assertValidServerId(id); + const root = resolve(runDir); + const target = resolve(root, `${validId}.stdin`); + assertStrictlyInside(root, target, "Console FIFO path"); + return target; +} + +export function formatServiceUnit(id: string): string { + const validId = assertValidServerId(id); + return `tegrad-server@${validId}.service`; +} + +export function formatSocketUnit(id: string): string { + const validId = assertValidServerId(id); + return `tegrad-server@${validId}.socket`; +} diff --git a/src/server/index.ts b/src/server/index.ts new file mode 100644 index 0000000..6f7e8c1 --- /dev/null +++ b/src/server/index.ts @@ -0,0 +1,130 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +export { + type ConsoleEventEmitter, + type ConsoleLinesEvent, + type ConsoleSubscriptionManager, + type ConsoleSubscriptionManagerOptions, + type ConsoleTimerHandle, + type ConsoleTimerProvider, + createConsoleSubscriptionManager, + DEFAULT_CONSOLE_POLL_MS, + defaultConsoleTimers, + defaultWriteFifo, + type FifoWriter, + MAX_BYTES_PER_EVENT, + MAX_LINES_PER_EVENT, + MAX_LINES_PER_SECOND, + type SendConsoleLineOptions, + sendConsoleLine, +} from "./console"; +export { + compareHexDigests, + DEFAULT_DOWNLOAD_TIMEOUT_MS, + DEFAULT_MAX_BINARY_BYTES, + DEFAULT_MAX_JSON_BYTES, + DEFAULT_MAX_REDIRECTS, + DEFAULT_MAX_TEXT_BYTES, + type DownloadVerifiedFileOptions, + downloadVerifiedFile, + type FetchAllowlistOptions, + type FetchLike, + fetchJsonWithAllowlist, + fetchSidecarHash, + fetchTextWithAllowlist, + fetchWithAllowlist, + type HashAlgorithm, + normalizeExpectedHash, + validateDownloadUrl, +} from "./download"; +export { + assertValidServerId, + DEFAULT_RUN_DIR, + DEFAULT_SERVERS_DIR, + formatServiceUnit, + formatSocketUnit, + resolveFifoPath, + resolveServerDir, + resolveServerSubpath, + SERVER_ID_REGEX, + serverIdSchema, +} from "./id"; +export { + ADOPTIUM_ALLOWED_HOSTS, + type EnsureJavaRuntimeOptions, + ensureJavaRuntime, + getJavaBinPath, + getRuntimeJavaDir, + type JavaMajor, + type ManagedJavaRuntime, + type RunFixedLike, + resolveAdoptiumArch, + selectJavaMajor, +} from "./java"; +export { + type InstallLoaderOptions, + installServerLoader, + LOADER_ALLOWED_HOSTS, + type LoaderInstallResult, +} from "./loaders"; +export { + checkMemoryForServer, + DEFAULT_MEMINFO_PATH, + type Meminfo, + type MemoryCheckParams, + parseMeminfo, + RESERVED_SYSTEM_MEMORY_MB, + readMeminfo, +} from "./memory"; +export { + EULA_FILE, + getEffectiveLaunchTarget, + isEulaAccepted, + listServerMetadata, + readServerMetadata, + SERVER_METADATA_FILE, + SERVER_PROPERTIES_FILE, + type ServerMetadata, + serverLaunchTargetSchema, + serverMetadataSchema, + type UpdateServerPropertiesOptions, + writeEulaFile, + writeServerMetadata, + writeServerProperties, +} from "./registry"; +export { + createServerManager, + registerServerHandlers, + type ServerManager, + type ServerManagerOptions, + type ServerStatusReport, +} from "./runtime"; +export { + ALLOWED_XX_BOOLEAN_FLAGS, + ALLOWED_XX_VALUE_KEYS, + MAX_JVM_ARG_LENGTH, + posixSingleQuote, + type RenderStartScriptParams, + renderStartScript, + type ServerLaunchTarget, + validateJvmArgs, + validateLaunchTarget, + validateSingleJvmArg, + writeStartScript, +} from "./start-script"; +export { + computeMemoryMaxMb, + DEFAULT_STOP_POLL_INTERVAL_MS, + DEFAULT_STOP_TIMEOUT_MS, + getUnitStatus, + isUnitActive, + isUnitStopped, + MEMORY_MAX_MULTIPLIER, + parseSystemdShowOutput, + type StartServerUnitOptions, + type StopServerUnitOptions, + type SystemdUnitStatus, + startServerUnit, + stopServerUnit, +} from "./systemd"; diff --git a/src/server/java-and-loaders.test.ts b/src/server/java-and-loaders.test.ts new file mode 100644 index 0000000..5953504 --- /dev/null +++ b/src/server/java-and-loaders.test.ts @@ -0,0 +1,575 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, describe, expect, test } from "bun:test"; +import { createHash } from "node:crypto"; +import { existsSync, mkdirSync, mkdtempSync, readdirSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { ProtocolError, type ProtocolErrorCode } from "../protocol"; +import { + ensureJavaRuntime, + type FetchLike, + installServerLoader, + type RunFixedLike, + selectJavaMajor, +} from "./index"; + +const tempDirs: string[] = []; + +function makeTempDir(prefix: string): string { + const dir = mkdtempSync(join(tmpdir(), prefix)); + tempDirs.push(dir); + return dir; +} + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +function sha256Hex(data: Uint8Array | string): string { + return createHash("sha256").update(data).digest("hex"); +} + +function sha1Hex(data: Uint8Array | string): string { + return createHash("sha1").update(data).digest("hex"); +} + +async function expectProtocolError( + promise: Promise, + code: ProtocolErrorCode, +): Promise { + try { + await promise; + throw new Error(`Expected ProtocolError(${code}), but succeeded`); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe(code); + } +} + +describe("selectJavaMajor", () => { + test("maps Minecraft versions to the required Java major version", () => { + expect(selectJavaMajor("1.7.10")).toBe(8); + expect(selectJavaMajor("1.8.9")).toBe(8); + expect(selectJavaMajor("1.12.2")).toBe(8); + expect(selectJavaMajor("1.16.5")).toBe(8); + expect(selectJavaMajor("1.17")).toBe(16); + expect(selectJavaMajor("1.17.1")).toBe(16); + expect(selectJavaMajor("1.18.2")).toBe(17); + expect(selectJavaMajor("1.19.4")).toBe(17); + expect(selectJavaMajor("1.20.4")).toBe(17); + expect(selectJavaMajor("1.20.5")).toBe(21); + expect(selectJavaMajor("1.20.6")).toBe(21); + expect(selectJavaMajor("1.21.4")).toBe(21); + expect(selectJavaMajor("26.1")).toBe(21); + + // Snapshots + expect(selectJavaMajor("20w45a")).toBe(8); + expect(selectJavaMajor("21w19a")).toBe(16); + expect(selectJavaMajor("21w37a")).toBe(17); + expect(selectJavaMajor("24w14a")).toBe(21); + }); + + test("rejects invalid Minecraft version formats", () => { + expect(() => selectJavaMajor("not-a-version")).toThrow(ProtocolError); + }); +}); + +describe("ensureJavaRuntime", () => { + test("verifies SHA-256 across allowed redirect hops, extracts via tar, and reuses cached runtime", async () => { + const serversDir = makeTempDir("tegrad-java-test-"); + const archiveBytes = new TextEncoder().encode("fake-tar-gz-bytes"); + const goodHash = sha256Hex(archiveBytes); + + let fetchCount = 0; + const fetchImpl: FetchLike = async (input) => { + fetchCount++; + const url = String(input); + if (url.startsWith("https://api.adoptium.net/v3/assets/latest/21/hotspot")) { + return new Response( + JSON.stringify([ + { + binary: { + package: { + link: "https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21/jre.tar.gz", + checksum: goodHash, + size: archiveBytes.byteLength, + }, + }, + }, + ]), + { status: 200 }, + ); + } + if (url.startsWith("https://github.com/")) { + return new Response(null, { + status: 302, + headers: { + location: "https://objects.githubusercontent.com/temurin/jre21.tar.gz", + }, + }); + } + if (url === "https://objects.githubusercontent.com/temurin/jre21.tar.gz") { + return new Response(archiveBytes, { status: 200 }); + } + return new Response("not found", { status: 404 }); + }; + + const tarCalls: { cmd: string; args: readonly string[] }[] = []; + const runFixedImpl: RunFixedLike = async (cmd, args) => { + tarCalls.push({ cmd, args }); + const extractDir = args[3]; + if (!extractDir) { + return { code: 1, stdout: "", stderr: "missing dir", timedOut: false, truncated: false }; + } + const binDir = join(extractDir, "jdk-21.0.5-jre", "bin"); + mkdirSync(binDir, { recursive: true }); + writeFileSync(join(binDir, "java"), "#!/bin/sh\n"); + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + }; + + const result = await ensureJavaRuntime({ + serversDir, + minecraftVersion: "1.21.4", + platform: "linux", + fetchImpl, + runFixedImpl, + }); + + expect(result.major).toBe(21); + expect(existsSync(result.javaBin)).toBe(true); + expect(tarCalls).toHaveLength(1); + expect(tarCalls[0]?.cmd).toBe("tar"); + expect(tarCalls[0]?.args[0]).toBe("-xzf"); + + // Second call uses cached runtime without fetching again + const prevFetchCount = fetchCount; + const cached = await ensureJavaRuntime({ + serversDir, + minecraftVersion: "1.21.4", + platform: "linux", + fetchImpl, + runFixedImpl, + }); + expect(cached.javaBin).toBe(result.javaBin); + expect(fetchCount).toBe(prevFetchCount); + }); + + test("deletes temp file and refuses extraction on SHA-256 mismatch", async () => { + const serversDir = makeTempDir("tegrad-java-badhash-"); + let tarCalled = false; + + const fetchImpl: FetchLike = async (input) => { + const url = String(input); + if (url.startsWith("https://api.adoptium.net/")) { + return new Response( + JSON.stringify([ + { + binary: { + package: { + link: "https://objects.githubusercontent.com/temurin/jre21.tar.gz", + checksum: "a".repeat(64), + }, + }, + }, + ]), + { status: 200 }, + ); + } + return new Response(new TextEncoder().encode("tampered-bytes"), { status: 200 }); + }; + + const runFixedImpl: RunFixedLike = async () => { + tarCalled = true; + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + }; + + await expectProtocolError( + ensureJavaRuntime({ + serversDir, + minecraftVersion: "1.21.4", + platform: "linux", + fetchImpl, + runFixedImpl, + }), + "hash_mismatch", + ); + + expect(tarCalled).toBe(false); + const runtimeRoot = join(serversDir, ".runtime", "java"); + if (existsSync(runtimeRoot)) { + expect(readdirSync(runtimeRoot)).toEqual([]); + } + }); + + test("rejects http:// URLs and redirects to disallowed hosts", async () => { + const serversDir = makeTempDir("tegrad-java-host-"); + + const httpFetch: FetchLike = async () => + new Response( + JSON.stringify([ + { + binary: { + package: { + link: "http://api.adoptium.net/insecure.tar.gz", + checksum: "a".repeat(64), + }, + }, + }, + ]), + { status: 200 }, + ); + + await expectProtocolError( + ensureJavaRuntime({ + serversDir, + minecraftVersion: "1.21.4", + platform: "linux", + fetchImpl: httpFetch, + }), + "download_failed", + ); + + const evilRedirectFetch: FetchLike = async (input) => { + const url = String(input); + if (url.startsWith("https://api.adoptium.net/")) { + return new Response( + JSON.stringify([ + { + binary: { + package: { + link: "https://github.com/adoptium/jre.tar.gz", + checksum: "a".repeat(64), + }, + }, + }, + ]), + { status: 200 }, + ); + } + return new Response(null, { + status: 302, + headers: { location: "https://evil.example.com/jre.tar.gz" }, + }); + }; + + await expectProtocolError( + ensureJavaRuntime({ + serversDir, + minecraftVersion: "1.21.4", + platform: "linux", + fetchImpl: evilRedirectFetch, + }), + "download_failed", + ); + }); +}); + +describe("installServerLoader", () => { + test("Vanilla verifies SHA-1 and rejects mismatched hash or disallowed host", async () => { + const serverDir = makeTempDir("tegrad-vanilla-"); + const jarBytes = new TextEncoder().encode("PK-vanilla-server-jar"); + const goodSha1 = sha1Hex(jarBytes); + + const fetchImpl: FetchLike = async (input) => { + const url = String(input); + if (url === "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json") { + return new Response( + JSON.stringify({ + versions: [ + { + id: "1.21.4", + url: "https://piston-meta.mojang.com/v1/packages/abc/1.21.4.json", + }, + ], + }), + { status: 200 }, + ); + } + if (url === "https://piston-meta.mojang.com/v1/packages/abc/1.21.4.json") { + return new Response( + JSON.stringify({ + downloads: { + server: { + sha1: goodSha1, + size: jarBytes.byteLength, + url: "https://piston-data.mojang.com/v1/objects/server.jar", + }, + }, + }), + { status: 200 }, + ); + } + if (url === "https://piston-data.mojang.com/v1/objects/server.jar") { + return new Response(jarBytes, { status: 200 }); + } + return new Response("not found", { status: 404 }); + }; + + const result = await installServerLoader({ + serverDir, + minecraftVersion: "1.21.4", + loader: "vanilla", + javaBin: "/usr/bin/java", + fetchImpl, + }); + + expect(result.loader).toBe("vanilla"); + expect(result.launchTarget).toEqual({ kind: "jar", jar_relative_path: "server.jar" }); + expect(existsSync(join(serverDir, "server.jar"))).toBe(true); + + // Unknown MC version rejected without building arbitrary URL + await expectProtocolError( + installServerLoader({ + serverDir: makeTempDir("tegrad-vanilla-unknown-"), + minecraftVersion: "../evil", + loader: "vanilla", + javaBin: "/usr/bin/java", + fetchImpl, + }), + "download_failed", + ); + + // Tampered JAR fails with hash_mismatch and leaves no server.jar + const badDir = makeTempDir("tegrad-vanilla-tampered-"); + const badFetch: FetchLike = async (input) => { + const url = String(input); + if (url === "https://piston-data.mojang.com/v1/objects/server.jar") { + return new Response(new TextEncoder().encode("corrupted-jar"), { status: 200 }); + } + return fetchImpl(input); + }; + await expectProtocolError( + installServerLoader({ + serverDir: badDir, + minecraftVersion: "1.21.4", + loader: "vanilla", + javaBin: "/usr/bin/java", + fetchImpl: badFetch, + }), + "hash_mismatch", + ); + expect(existsSync(join(badDir, "server.jar"))).toBe(false); + expect(readdirSync(badDir)).toEqual([]); + }); + + test("Fabric validates metadata, checks Maven SHA-256, runs installer, and cleans temp jar", async () => { + const serverDir = makeTempDir("tegrad-fabric-"); + const installerBytes = new TextEncoder().encode("fabric-installer-jar"); + const installerSha256 = sha256Hex(installerBytes); + const installerUrl = + "https://maven.fabricmc.net/net/fabricmc/fabric-installer/1.0.1/fabric-installer-1.0.1.jar"; + + const fetchImpl: FetchLike = async (input) => { + const url = String(input); + if (url === "https://meta.fabricmc.net/v2/versions/game") { + return new Response(JSON.stringify([{ version: "1.21.4", stable: true }]), { status: 200 }); + } + if (url === "https://meta.fabricmc.net/v2/versions/loader") { + return new Response(JSON.stringify([{ version: "0.16.9", stable: true }]), { status: 200 }); + } + if (url === "https://meta.fabricmc.net/v2/versions/installer") { + return new Response( + JSON.stringify([{ version: "1.0.1", url: installerUrl, stable: true }]), + { status: 200 }, + ); + } + if (url === `${installerUrl}.sha256`) { + return new Response(`${installerSha256}\n`, { status: 200 }); + } + if (url === installerUrl) { + return new Response(installerBytes, { status: 200 }); + } + return new Response("not found", { status: 404 }); + }; + + const execCalls: { cmd: string; args: readonly string[] }[] = []; + const runFixedImpl: RunFixedLike = async (cmd, args) => { + execCalls.push({ cmd, args }); + writeFileSync(join(serverDir, "fabric-server-launch.jar"), "launch"); + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + }; + + const result = await installServerLoader({ + serverDir, + minecraftVersion: "1.21.4", + loader: "fabric", + javaBin: "/opt/java/bin/java", + fetchImpl, + runFixedImpl, + }); + + expect(result.loaderVersion).toBe("0.16.9"); + expect(result.launchTarget).toEqual({ + kind: "jar", + jar_relative_path: "fabric-server-launch.jar", + }); + expect(execCalls).toHaveLength(1); + expect(execCalls[0]?.cmd).toBe("/opt/java/bin/java"); + expect(execCalls[0]?.args).toContain("0.16.9"); + // Temp installer jar was deleted + expect(readdirSync(serverDir)).toEqual(["fabric-server-launch.jar"]); + }); + + test("Forge and NeoForge verify Maven checksums, run installer, and produce unix_args.txt target", async () => { + const forgeDir = makeTempDir("tegrad-forge-"); + const forgeInstallerBytes = new TextEncoder().encode("forge-installer"); + const forgeSha256 = sha256Hex(forgeInstallerBytes); + const forgeUrl = + "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.2.0/forge-1.20.1-47.2.0-installer.jar"; + + const forgeFetch: FetchLike = async (input) => { + const url = String(input); + if ( + url === "https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json" + ) { + return new Response(JSON.stringify({ promos: { "1.20.1-recommended": "47.2.0" } }), { + status: 200, + }); + } + if (url === `${forgeUrl}.sha256`) { + return new Response(forgeSha256, { status: 200 }); + } + if (url === forgeUrl) { + return new Response(forgeInstallerBytes, { status: 200 }); + } + return new Response("not found", { status: 404 }); + }; + + const forgeRun: RunFixedLike = async (_cmd, _args) => { + const unixArgsDir = join( + forgeDir, + "libraries", + "net", + "minecraftforge", + "forge", + "1.20.1-47.2.0", + ); + mkdirSync(unixArgsDir, { recursive: true }); + writeFileSync(join(unixArgsDir, "unix_args.txt"), "-cp server.jar\n"); + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + }; + + const forgeResult = await installServerLoader({ + serverDir: forgeDir, + minecraftVersion: "1.20.1", + loader: "forge", + javaBin: "/opt/java/bin/java", + fetchImpl: forgeFetch, + runFixedImpl: forgeRun, + }); + + expect(forgeResult.loaderVersion).toBe("47.2.0"); + expect(forgeResult.launchTarget).toEqual({ + kind: "args_file", + args_file_relative_path: "libraries/net/minecraftforge/forge/1.20.1-47.2.0/unix_args.txt", + }); + + const neoDir = makeTempDir("tegrad-neoforge-"); + const neoInstallerBytes = new TextEncoder().encode("neoforge-installer"); + const neoSha1 = sha1Hex(neoInstallerBytes); + const neoUrl = + "https://maven.neoforged.net/releases/net/neoforged/neoforge/21.1.72/neoforge-21.1.72-installer.jar"; + + const neoFetch: FetchLike = async (input) => { + const url = String(input); + if ( + url === "https://maven.neoforged.net/api/maven/versions/releases/net/neoforged/neoforge" + ) { + return new Response(JSON.stringify({ versions: ["21.1.70", "21.1.72"] }), { status: 200 }); + } + if (url === `${neoUrl}.sha256`) { + return new Response("not found", { status: 404 }); + } + if (url === `${neoUrl}.sha1`) { + return new Response(neoSha1, { status: 200 }); + } + if (url === neoUrl) { + return new Response(neoInstallerBytes, { status: 200 }); + } + return new Response("not found", { status: 404 }); + }; + + const neoRun: RunFixedLike = async () => ({ + code: 0, + stdout: "", + stderr: "", + timedOut: false, + truncated: false, + }); + + const neoResult = await installServerLoader({ + serverDir: neoDir, + minecraftVersion: "1.21.1", + loader: "neoforge", + javaBin: "/opt/java/bin/java", + fetchImpl: neoFetch, + runFixedImpl: neoRun, + }); + + expect(neoResult.loaderVersion).toBe("21.1.72"); + expect(neoResult.launchTarget).toEqual({ + kind: "args_file", + args_file_relative_path: "libraries/net/neoforged/neoforge/21.1.72/unix_args.txt", + }); + }); + + test("Quilt validates metadata, checks Maven SHA-1, and runs installer", async () => { + const quiltDir = makeTempDir("tegrad-quilt-"); + const installerBytes = new TextEncoder().encode("quilt-installer"); + const installerSha1 = sha1Hex(installerBytes); + const installerUrl = + "https://maven.quiltmc.org/repository/release/org/quiltmc/quilt-installer/0.9.2/quilt-installer-0.9.2.jar"; + + const quiltFetch: FetchLike = async (input) => { + const url = String(input); + if (url === "https://meta.quiltmc.org/v3/versions/game") { + return new Response(JSON.stringify([{ version: "1.20.4", stable: true }]), { status: 200 }); + } + if (url === "https://meta.quiltmc.org/v3/versions/loader") { + return new Response(JSON.stringify([{ version: "0.26.4" }]), { status: 200 }); + } + if (url === "https://meta.quiltmc.org/v3/versions/installer") { + return new Response(JSON.stringify([{ version: "0.9.2", url: installerUrl }]), { + status: 200, + }); + } + if (url === `${installerUrl}.sha256`) { + return new Response("not found", { status: 404 }); + } + if (url === `${installerUrl}.sha1`) { + return new Response(installerSha1, { status: 200 }); + } + if (url === installerUrl) { + return new Response(installerBytes, { status: 200 }); + } + return new Response("not found", { status: 404 }); + }; + + const quiltRun: RunFixedLike = async () => { + writeFileSync(join(quiltDir, "quilt-server-launch.jar"), "quilt-launch"); + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + }; + + const result = await installServerLoader({ + serverDir: quiltDir, + minecraftVersion: "1.20.4", + loader: "quilt", + javaBin: "/opt/java/bin/java", + fetchImpl: quiltFetch, + runFixedImpl: quiltRun, + }); + + expect(result.loaderVersion).toBe("0.26.4"); + expect(result.launchTarget).toEqual({ + kind: "jar", + jar_relative_path: "quilt-server-launch.jar", + }); + }); +}); diff --git a/src/server/java.ts b/src/server/java.ts new file mode 100644 index 0000000..c9c6b50 --- /dev/null +++ b/src/server/java.ts @@ -0,0 +1,292 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { randomBytes } from "node:crypto"; +import { + chmodSync, + existsSync, + mkdirSync, + readdirSync, + renameSync, + rmSync, + statSync, +} from "node:fs"; +import { join, resolve } from "node:path"; +import { z } from "zod"; +import { type RunFixedOptions, type RunFixedResult, runFixed } from "../agent/exec"; +import { ProtocolError } from "../protocol"; +import { + DEFAULT_MAX_BINARY_BYTES, + downloadVerifiedFile, + type FetchLike, + fetchJsonWithAllowlist, +} from "./download"; + +export type JavaMajor = 8 | 16 | 17 | 21; + +export type RunFixedLike = ( + command: string, + args: readonly string[], + options?: RunFixedOptions, +) => Promise; + +export const ADOPTIUM_ALLOWED_HOSTS: ReadonlySet = new Set([ + "api.adoptium.net", + "github.com", + "objects.githubusercontent.com", + "release-assets.githubusercontent.com", +]); + +const RUNTIME_DIR_MODE = 0o750; +const RUNTIME_BIN_MODE = 0o750; + +const adoptiumAssetSchema = z.object({ + binary: z.object({ + package: z.object({ + link: z.string().min(1), + checksum: z.string().min(1), + size: z.number().int().positive().optional(), + }), + }), +}); + +const adoptiumAssetsResponseSchema = z.array(adoptiumAssetSchema); + +const STANDARD_MC_VERSION_REGEX = /^(\d+)\.(\d+)(?:\.(\d+))?(?:[-+].*)?$/; +const SNAPSHOT_MC_VERSION_REGEX = /^(\d{2})w(\d{2})[a-z]$/i; + +function isPosix(platform: NodeJS.Platform = process.platform): boolean { + return platform !== "win32"; +} + +export function selectJavaMajor(minecraftVersion: string): JavaMajor { + const trimmed = minecraftVersion.trim(); + + const stdMatch = STANDARD_MC_VERSION_REGEX.exec(trimmed); + if (stdMatch !== null) { + const major = Number(stdMatch[1]); + const minor = Number(stdMatch[2]); + const patch = stdMatch[3] !== undefined ? Number(stdMatch[3]) : 0; + + if (major >= 2) { + return 21; + } + if (major === 1) { + if (minor <= 16) { + return 8; + } + if (minor === 17) { + return 16; + } + if (minor <= 19) { + return 17; + } + if (minor === 20) { + return patch >= 5 ? 21 : 17; + } + return 21; + } + } + + const snapMatch = SNAPSHOT_MC_VERSION_REGEX.exec(trimmed); + if (snapMatch !== null) { + const year = Number(snapMatch[1]); + const week = Number(snapMatch[2]); + if (year > 24 || (year === 24 && week >= 14)) { + return 21; + } + if (year > 21 || (year === 21 && week >= 37)) { + return 17; + } + if (year === 21 && week >= 19) { + return 16; + } + return 8; + } + + throw new ProtocolError( + "invalid_body", + `Unsupported Minecraft version format for Java selection: ${minecraftVersion}`, + ); +} + +export function resolveAdoptiumArch(nodeArch: string = process.arch): "x64" | "aarch64" { + if (nodeArch === "arm64") { + return "aarch64"; + } + return "x64"; +} + +export function getRuntimeJavaDir(serversDir: string, major: JavaMajor): string { + return join(resolve(serversDir), ".runtime", "java", String(major)); +} + +export function getJavaBinPath( + serversDir: string, + major: JavaMajor, + platform: NodeJS.Platform = process.platform, +): string { + const binName = platform === "win32" ? "java.exe" : "java"; + return join(getRuntimeJavaDir(serversDir, major), "bin", binName); +} + +function findExtractedJavaRoot(extractDir: string, binName: string): string | null { + if (existsSync(join(extractDir, "bin", binName))) { + return extractDir; + } + const entries = readdirSync(extractDir, { withFileTypes: true }); + for (const entry of entries) { + if (!entry.isDirectory()) { + continue; + } + const candidate = join(extractDir, entry.name); + if (existsSync(join(candidate, "bin", binName))) { + return candidate; + } + } + return null; +} + +function applyRuntimePermissions(dirPath: string): void { + if (!isPosix()) { + return; + } + chmodSync(dirPath, RUNTIME_DIR_MODE); + const binDir = join(dirPath, "bin"); + if (existsSync(binDir)) { + chmodSync(binDir, RUNTIME_DIR_MODE); + for (const entry of readdirSync(binDir, { withFileTypes: true })) { + const fullPath = join(binDir, entry.name); + if (entry.isFile()) { + chmodSync(fullPath, RUNTIME_BIN_MODE); + } + } + } +} + +export interface EnsureJavaRuntimeOptions { + readonly serversDir: string; + readonly minecraftVersion: string; + readonly arch?: "x64" | "aarch64"; + readonly fetchImpl?: FetchLike; + readonly runFixedImpl?: RunFixedLike; + readonly maxBytes?: number; + readonly platform?: NodeJS.Platform; +} + +export interface ManagedJavaRuntime { + readonly major: JavaMajor; + readonly javaDir: string; + readonly javaBin: string; +} + +async function queryAdoptiumAsset( + major: JavaMajor, + arch: "x64" | "aarch64", + fetchImpl?: FetchLike, +): Promise<{ readonly link: string; readonly checksum: string }> { + const imageTypes: readonly ("jre" | "jdk")[] = ["jre", "jdk"]; + let lastError: unknown; + + for (const imageType of imageTypes) { + const url = `https://api.adoptium.net/v3/assets/latest/${major}/hotspot?architecture=${arch}&image_type=${imageType}&os=linux&vendor=eclipse`; + try { + const assets = await fetchJsonWithAllowlist(url, adoptiumAssetsResponseSchema, { + allowedHosts: ADOPTIUM_ALLOWED_HOSTS, + ...(fetchImpl !== undefined ? { fetchImpl } : {}), + }); + const first = assets[0]; + if (first !== undefined) { + return { + link: first.binary.package.link, + checksum: first.binary.package.checksum, + }; + } + } catch (err) { + lastError = err; + } + } + + if (lastError instanceof ProtocolError) { + throw lastError; + } + throw new ProtocolError("download_failed", `No Adoptium Java ${major} runtime asset available`); +} + +export async function ensureJavaRuntime( + options: EnsureJavaRuntimeOptions, +): Promise { + const major = selectJavaMajor(options.minecraftVersion); + const platform = options.platform ?? process.platform; + const binName = platform === "win32" ? "java.exe" : "java"; + const javaDir = getRuntimeJavaDir(options.serversDir, major); + const javaBin = join(javaDir, "bin", binName); + + if (existsSync(javaBin) && statSync(javaBin).isFile()) { + return { major, javaDir, javaBin }; + } + + const arch = options.arch ?? resolveAdoptiumArch(); + const asset = await queryAdoptiumAsset(major, arch, options.fetchImpl); + + const runtimeRoot = join(resolve(options.serversDir), ".runtime", "java"); + mkdirSync(runtimeRoot, { recursive: true, mode: RUNTIME_DIR_MODE }); + if (isPosix(platform)) { + chmodSync(runtimeRoot, RUNTIME_DIR_MODE); + } + + const suffix = randomBytes(8).toString("hex"); + const archivePath = join(runtimeRoot, `.tmp-java-${major}-${suffix}.tar.gz`); + const extractDir = join(runtimeRoot, `.tmp-extract-${major}-${suffix}`); + const runCmd: RunFixedLike = options.runFixedImpl ?? runFixed; + + try { + await downloadVerifiedFile({ + url: asset.link, + destPath: archivePath, + allowedHosts: ADOPTIUM_ALLOWED_HOSTS, + expectedHash: { + algorithm: "sha256", + hex: asset.checksum, + }, + maxBytes: options.maxBytes ?? DEFAULT_MAX_BINARY_BYTES, + fileMode: 0o640, + dirMode: RUNTIME_DIR_MODE, + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + }); + + mkdirSync(extractDir, { recursive: true, mode: RUNTIME_DIR_MODE }); + const extractResult = await runCmd("tar", ["-xzf", archivePath, "-C", extractDir], { + timeoutMs: 120_000, + }); + if (extractResult.timedOut || extractResult.code !== 0) { + throw new ProtocolError( + "download_failed", + `Failed to extract Java ${major} runtime archive (exit ${extractResult.code})`, + ); + } + + const extractedRoot = findExtractedJavaRoot(extractDir, binName); + if (extractedRoot === null) { + throw new ProtocolError( + "download_failed", + `Extracted Java ${major} archive is missing bin/${binName}`, + ); + } + + if (existsSync(javaDir)) { + rmSync(javaDir, { recursive: true, force: true }); + } + renameSync(extractedRoot, javaDir); + applyRuntimePermissions(javaDir); + + return { major, javaDir, javaBin }; + } finally { + if (existsSync(archivePath)) { + rmSync(archivePath, { force: true }); + } + if (existsSync(extractDir)) { + rmSync(extractDir, { recursive: true, force: true }); + } + } +} diff --git a/src/server/loaders.ts b/src/server/loaders.ts new file mode 100644 index 0000000..5bd37b4 --- /dev/null +++ b/src/server/loaders.ts @@ -0,0 +1,634 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { randomBytes } from "node:crypto"; +import { existsSync, rmSync } from "node:fs"; +import { join } from "node:path"; +import { z } from "zod"; +import { runFixed } from "../agent/exec"; +import { ProtocolError, type ServerLoader } from "../protocol"; +import { + DEFAULT_MAX_BINARY_BYTES, + downloadVerifiedFile, + type FetchLike, + fetchJsonWithAllowlist, + fetchSidecarHash, + fetchTextWithAllowlist, + type HashAlgorithm, +} from "./download"; +import { resolveServerSubpath } from "./id"; +import type { RunFixedLike } from "./java"; +import type { ServerLaunchTarget } from "./start-script"; + +export const LOADER_ALLOWED_HOSTS: ReadonlySet = new Set([ + "piston-meta.mojang.com", + "launchermeta.mojang.com", + "piston-data.mojang.com", + "launcher.mojang.com", + "libraries.minecraft.net", + "meta.fabricmc.net", + "maven.fabricmc.net", + "meta.quiltmc.org", + "maven.quiltmc.org", + "maven.minecraftforge.net", + "files.minecraftforge.net", + "maven.neoforged.net", +]); + +const mojangManifestSchema = z.object({ + versions: z.array( + z.object({ + id: z.string().min(1), + url: z.string().min(1), + }), + ), +}); + +const mojangVersionPackageSchema = z.object({ + downloads: z.object({ + server: z + .object({ + sha1: z.string().min(1), + size: z.number().int().positive().optional(), + url: z.string().min(1), + }) + .optional(), + }), +}); + +const fabricGameVersionsSchema = z.array( + z.object({ + version: z.string().min(1), + stable: z.boolean().optional(), + }), +); + +const fabricLoaderVersionsSchema = z.array( + z.object({ + version: z.string().min(1), + stable: z.boolean().optional(), + }), +); + +const fabricInstallerVersionsSchema = z.array( + z.object({ + version: z.string().min(1), + url: z.string().min(1), + stable: z.boolean().optional(), + }), +); + +const forgePromotionsSchema = z.object({ + promos: z.record(z.string(), z.string()), +}); + +const neoforgeVersionsSchema = z.object({ + versions: z.array(z.string().min(1)), +}); + +export interface InstallLoaderOptions { + readonly serverDir: string; + readonly minecraftVersion: string; + readonly loader: ServerLoader; + readonly loaderVersion?: string; + readonly javaBin: string; + readonly fetchImpl?: FetchLike; + readonly runFixedImpl?: RunFixedLike; + readonly maxBytes?: number; +} + +export interface LoaderInstallResult { + readonly loader: ServerLoader; + readonly minecraftVersion: string; + readonly loaderVersion: string | null; + readonly launchTarget: ServerLaunchTarget; +} + +async function fetchMavenChecksum( + artifactUrl: string, + fetchImpl?: FetchLike, +): Promise<{ readonly algorithm: HashAlgorithm; readonly hex: string }> { + const opts = { + allowedHosts: LOADER_ALLOWED_HOSTS, + ...(fetchImpl !== undefined ? { fetchImpl } : {}), + }; + + try { + const hex = await fetchSidecarHash(`${artifactUrl}.sha256`, "sha256", opts); + return { algorithm: "sha256", hex }; + } catch { + const hex = await fetchSidecarHash(`${artifactUrl}.sha1`, "sha1", opts); + return { algorithm: "sha1", hex }; + } +} + +async function installVanilla(options: InstallLoaderOptions): Promise { + const fetchOpts = { + allowedHosts: LOADER_ALLOWED_HOSTS, + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + }; + + const manifest = await fetchJsonWithAllowlist( + "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json", + mojangManifestSchema, + fetchOpts, + ); + + const versionEntry = manifest.versions.find((v) => v.id === options.minecraftVersion); + if (!versionEntry) { + throw new ProtocolError( + "download_failed", + `Minecraft version not found in official Mojang manifest: ${options.minecraftVersion}`, + ); + } + + const versionPkg = await fetchJsonWithAllowlist( + versionEntry.url, + mojangVersionPackageSchema, + fetchOpts, + ); + + const serverDownload = versionPkg.downloads.server; + if (!serverDownload) { + throw new ProtocolError( + "download_failed", + `No official server JAR available for Minecraft ${versionEntry.id}`, + ); + } + + const destPath = resolveServerSubpath(options.serverDir, "server.jar"); + await downloadVerifiedFile({ + url: serverDownload.url, + destPath, + expectedHash: { + algorithm: "sha1", + hex: serverDownload.sha1, + }, + maxBytes: options.maxBytes ?? DEFAULT_MAX_BINARY_BYTES, + ...fetchOpts, + }); + + return { + loader: "vanilla", + minecraftVersion: versionEntry.id, + loaderVersion: null, + launchTarget: { + kind: "jar", + jar_relative_path: "server.jar", + }, + }; +} + +async function installFabric(options: InstallLoaderOptions): Promise { + const fetchOpts = { + allowedHosts: LOADER_ALLOWED_HOSTS, + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + }; + const runCmd: RunFixedLike = options.runFixedImpl ?? runFixed; + + const gameVersions = await fetchJsonWithAllowlist( + "https://meta.fabricmc.net/v2/versions/game", + fabricGameVersionsSchema, + fetchOpts, + ); + const matchedGame = gameVersions.find((v) => v.version === options.minecraftVersion); + if (!matchedGame) { + throw new ProtocolError( + "download_failed", + `Minecraft version not supported by Fabric: ${options.minecraftVersion}`, + ); + } + + const loaderVersions = await fetchJsonWithAllowlist( + "https://meta.fabricmc.net/v2/versions/loader", + fabricLoaderVersionsSchema, + fetchOpts, + ); + const matchedLoader = + options.loaderVersion !== undefined + ? loaderVersions.find((v) => v.version === options.loaderVersion) + : (loaderVersions.find((v) => v.stable === true) ?? loaderVersions[0]); + if (!matchedLoader) { + throw new ProtocolError( + "download_failed", + `Fabric loader version not found: ${options.loaderVersion ?? "latest"}`, + ); + } + + const installers = await fetchJsonWithAllowlist( + "https://meta.fabricmc.net/v2/versions/installer", + fabricInstallerVersionsSchema, + fetchOpts, + ); + const installer = installers.find((v) => v.stable === true) ?? installers[0]; + if (!installer) { + throw new ProtocolError("download_failed", "No Fabric installer available"); + } + + const expectedHash = await fetchMavenChecksum(installer.url, options.fetchImpl); + const installerPath = join( + options.serverDir, + `.tmp-fabric-installer-${randomBytes(6).toString("hex")}.jar`, + ); + + try { + await downloadVerifiedFile({ + url: installer.url, + destPath: installerPath, + expectedHash, + maxBytes: options.maxBytes ?? DEFAULT_MAX_BINARY_BYTES, + ...fetchOpts, + }); + + const result = await runCmd( + options.javaBin, + [ + "-jar", + installerPath, + "server", + "-mcversion", + matchedGame.version, + "-loader", + matchedLoader.version, + "-downloadMinecraft", + "-dir", + options.serverDir, + ], + { timeoutMs: 300_000 }, + ); + + if (result.timedOut || result.code !== 0) { + throw new ProtocolError( + "download_failed", + `Fabric server installer failed (exit ${result.code})`, + ); + } + } finally { + if (existsSync(installerPath)) { + rmSync(installerPath, { force: true }); + } + } + + const launchJar = existsSync(join(options.serverDir, "fabric-server-launch.jar")) + ? "fabric-server-launch.jar" + : "server.jar"; + + return { + loader: "fabric", + minecraftVersion: matchedGame.version, + loaderVersion: matchedLoader.version, + launchTarget: { + kind: "jar", + jar_relative_path: launchJar, + }, + }; +} + +async function installQuilt(options: InstallLoaderOptions): Promise { + const fetchOpts = { + allowedHosts: LOADER_ALLOWED_HOSTS, + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + }; + const runCmd: RunFixedLike = options.runFixedImpl ?? runFixed; + + const gameVersions = await fetchJsonWithAllowlist( + "https://meta.quiltmc.org/v3/versions/game", + fabricGameVersionsSchema, + fetchOpts, + ); + const matchedGame = gameVersions.find((v) => v.version === options.minecraftVersion); + if (!matchedGame) { + throw new ProtocolError( + "download_failed", + `Minecraft version not supported by Quilt: ${options.minecraftVersion}`, + ); + } + + const loaderVersions = await fetchJsonWithAllowlist( + "https://meta.quiltmc.org/v3/versions/loader", + fabricLoaderVersionsSchema, + fetchOpts, + ); + const matchedLoader = + options.loaderVersion !== undefined + ? loaderVersions.find((v) => v.version === options.loaderVersion) + : (loaderVersions.find((v) => !v.version.includes("beta")) ?? loaderVersions[0]); + if (!matchedLoader) { + throw new ProtocolError( + "download_failed", + `Quilt loader version not found: ${options.loaderVersion ?? "latest"}`, + ); + } + + const installers = await fetchJsonWithAllowlist( + "https://meta.quiltmc.org/v3/versions/installer", + fabricInstallerVersionsSchema, + fetchOpts, + ); + const installer = installers[0]; + if (!installer) { + throw new ProtocolError("download_failed", "No Quilt installer available"); + } + + const expectedHash = await fetchMavenChecksum(installer.url, options.fetchImpl); + const installerPath = join( + options.serverDir, + `.tmp-quilt-installer-${randomBytes(6).toString("hex")}.jar`, + ); + + try { + await downloadVerifiedFile({ + url: installer.url, + destPath: installerPath, + expectedHash, + maxBytes: options.maxBytes ?? DEFAULT_MAX_BINARY_BYTES, + ...fetchOpts, + }); + + const result = await runCmd( + options.javaBin, + [ + "-jar", + installerPath, + "install", + "server", + matchedGame.version, + matchedLoader.version, + "--download-server", + `--install-dir=${options.serverDir}`, + ], + { timeoutMs: 300_000 }, + ); + + if (result.timedOut || result.code !== 0) { + throw new ProtocolError( + "download_failed", + `Quilt server installer failed (exit ${result.code})`, + ); + } + } finally { + if (existsSync(installerPath)) { + rmSync(installerPath, { force: true }); + } + } + + const launchJar = existsSync(join(options.serverDir, "quilt-server-launch.jar")) + ? "quilt-server-launch.jar" + : "server.jar"; + + return { + loader: "quilt", + minecraftVersion: matchedGame.version, + loaderVersion: matchedLoader.version, + launchTarget: { + kind: "jar", + jar_relative_path: launchJar, + }, + }; +} + +function parseMavenMetadataVersions(xml: string): string[] { + const versions: string[] = []; + const regex = /([^<]+)<\/version>/g; + let match = regex.exec(xml); + while (match !== null) { + const val = match[1]?.trim(); + if (val) { + versions.push(val); + } + match = regex.exec(xml); + } + return versions; +} + +async function resolveForgeFullVersion( + minecraftVersion: string, + loaderVersion: string | undefined, + fetchImpl?: FetchLike, +): Promise<{ readonly fullVersion: string; readonly forgeVersion: string }> { + const fetchOpts = { + allowedHosts: LOADER_ALLOWED_HOSTS, + ...(fetchImpl !== undefined ? { fetchImpl } : {}), + }; + + if (loaderVersion !== undefined) { + const metadataXml = await fetchTextWithAllowlist( + "https://maven.minecraftforge.net/net/minecraftforge/forge/maven-metadata.xml", + fetchOpts, + ); + const available = parseMavenMetadataVersions(metadataXml); + const candidate = loaderVersion.startsWith(`${minecraftVersion}-`) + ? loaderVersion + : `${minecraftVersion}-${loaderVersion}`; + const exact = available.find((v) => v === candidate); + if (!exact) { + throw new ProtocolError( + "download_failed", + `Forge version not found in official Maven metadata: ${candidate}`, + ); + } + const forgeOnly = exact.startsWith(`${minecraftVersion}-`) + ? exact.slice(minecraftVersion.length + 1) + : exact; + return { fullVersion: exact, forgeVersion: forgeOnly }; + } + + const promos = await fetchJsonWithAllowlist( + "https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json", + forgePromotionsSchema, + fetchOpts, + ); + const recommended = promos.promos[`${minecraftVersion}-recommended`]; + const latest = promos.promos[`${minecraftVersion}-latest`]; + const chosen = recommended ?? latest; + if (!chosen) { + throw new ProtocolError( + "download_failed", + `No Forge build available for Minecraft ${minecraftVersion}`, + ); + } + return { + fullVersion: `${minecraftVersion}-${chosen}`, + forgeVersion: chosen, + }; +} + +async function installForge(options: InstallLoaderOptions): Promise { + const fetchOpts = { + allowedHosts: LOADER_ALLOWED_HOSTS, + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + }; + const runCmd: RunFixedLike = options.runFixedImpl ?? runFixed; + + const { fullVersion, forgeVersion } = await resolveForgeFullVersion( + options.minecraftVersion, + options.loaderVersion, + options.fetchImpl, + ); + + const installerUrl = `https://maven.minecraftforge.net/net/minecraftforge/forge/${fullVersion}/forge-${fullVersion}-installer.jar`; + const expectedHash = await fetchMavenChecksum(installerUrl, options.fetchImpl); + const installerPath = join( + options.serverDir, + `.tmp-forge-installer-${randomBytes(6).toString("hex")}.jar`, + ); + + try { + await downloadVerifiedFile({ + url: installerUrl, + destPath: installerPath, + expectedHash, + maxBytes: options.maxBytes ?? DEFAULT_MAX_BINARY_BYTES, + ...fetchOpts, + }); + + const result = await runCmd( + options.javaBin, + ["-jar", installerPath, "--installServer", options.serverDir], + { timeoutMs: 300_000 }, + ); + + if (result.timedOut || result.code !== 0) { + throw new ProtocolError( + "download_failed", + `Forge server installer failed (exit ${result.code})`, + ); + } + } finally { + if (existsSync(installerPath)) { + rmSync(installerPath, { force: true }); + } + } + + const unixArgsRel = `libraries/net/minecraftforge/forge/${fullVersion}/unix_args.txt`; + const unixArgsAbs = resolveServerSubpath(options.serverDir, unixArgsRel); + if (existsSync(unixArgsAbs)) { + return { + loader: "forge", + minecraftVersion: options.minecraftVersion, + loaderVersion: forgeVersion, + launchTarget: { + kind: "args_file", + args_file_relative_path: unixArgsRel, + }, + }; + } + + const legacyJar = `forge-${fullVersion}.jar`; + const launchJar = existsSync(join(options.serverDir, legacyJar)) ? legacyJar : "server.jar"; + return { + loader: "forge", + minecraftVersion: options.minecraftVersion, + loaderVersion: forgeVersion, + launchTarget: { + kind: "jar", + jar_relative_path: launchJar, + }, + }; +} + +function neoForgePrefixForMinecraft(minecraftVersion: string): string | null { + const match = /^1\.(\d+)(?:\.(\d+))?$/.exec(minecraftVersion.trim()); + if (!match) { + return null; + } + const minor = match[1]; + const patch = match[2] ?? "0"; + return `${minor}.${patch}.`; +} + +async function installNeoForge(options: InstallLoaderOptions): Promise { + const fetchOpts = { + allowedHosts: LOADER_ALLOWED_HOSTS, + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + }; + const runCmd: RunFixedLike = options.runFixedImpl ?? runFixed; + + const versionsData = await fetchJsonWithAllowlist( + "https://maven.neoforged.net/api/maven/versions/releases/net/neoforged/neoforge", + neoforgeVersionsSchema, + fetchOpts, + ); + + let exactVersion: string | undefined; + if (options.loaderVersion !== undefined) { + exactVersion = versionsData.versions.find((v) => v === options.loaderVersion); + } else { + const prefix = neoForgePrefixForMinecraft(options.minecraftVersion); + if (prefix !== null) { + const matching = versionsData.versions.filter((v) => v.startsWith(prefix)); + exactVersion = matching[matching.length - 1]; + } + } + + if (!exactVersion) { + throw new ProtocolError( + "download_failed", + `NeoForge version not found for Minecraft ${options.minecraftVersion}`, + ); + } + + const installerUrl = `https://maven.neoforged.net/releases/net/neoforged/neoforge/${exactVersion}/neoforge-${exactVersion}-installer.jar`; + const expectedHash = await fetchMavenChecksum(installerUrl, options.fetchImpl); + const installerPath = join( + options.serverDir, + `.tmp-neoforge-installer-${randomBytes(6).toString("hex")}.jar`, + ); + + try { + await downloadVerifiedFile({ + url: installerUrl, + destPath: installerPath, + expectedHash, + maxBytes: options.maxBytes ?? DEFAULT_MAX_BINARY_BYTES, + ...fetchOpts, + }); + + const result = await runCmd( + options.javaBin, + ["-jar", installerPath, "--installServer", options.serverDir], + { timeoutMs: 300_000 }, + ); + + if (result.timedOut || result.code !== 0) { + throw new ProtocolError( + "download_failed", + `NeoForge server installer failed (exit ${result.code})`, + ); + } + } finally { + if (existsSync(installerPath)) { + rmSync(installerPath, { force: true }); + } + } + + const unixArgsRel = `libraries/net/neoforged/neoforge/${exactVersion}/unix_args.txt`; + resolveServerSubpath(options.serverDir, unixArgsRel); + + return { + loader: "neoforge", + minecraftVersion: options.minecraftVersion, + loaderVersion: exactVersion, + launchTarget: { + kind: "args_file", + args_file_relative_path: unixArgsRel, + }, + }; +} + +export async function installServerLoader( + options: InstallLoaderOptions, +): Promise { + switch (options.loader) { + case "vanilla": + return installVanilla(options); + case "fabric": + return installFabric(options); + case "quilt": + return installQuilt(options); + case "forge": + return installForge(options); + case "neoforge": + return installNeoForge(options); + } +} diff --git a/src/server/memory-and-systemd.test.ts b/src/server/memory-and-systemd.test.ts new file mode 100644 index 0000000..93e6b6c --- /dev/null +++ b/src/server/memory-and-systemd.test.ts @@ -0,0 +1,248 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, describe, expect, test } from "bun:test"; +import { mkdtempSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { ProtocolError } from "../protocol"; +import { + checkMemoryForServer, + computeMemoryMaxMb, + getUnitStatus, + parseMeminfo, + parseSystemdShowOutput, + type RunFixedLike, + readMeminfo, + startServerUnit, + stopServerUnit, +} from "./index"; + +const tempDirs: string[] = []; + +function makeTempDir(prefix: string): string { + const dir = mkdtempSync(join(tmpdir(), prefix)); + tempDirs.push(dir); + return dir; +} + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +describe("memory calculation from /proc/meminfo", () => { + test("parses /proc/meminfo and accepts server that fits within budget", () => { + const dir = makeTempDir("tegrad-mem-"); + const meminfoPath = join(dir, "meminfo"); + writeFileSync( + meminfoPath, + [ + "MemTotal: 8388608 kB", // 8192 MB + "MemFree: 2097152 kB", + "MemAvailable: 6291456 kB", // 6144 MB + "Buffers: 131072 kB", + ].join("\n"), + ); + + const info = readMeminfo(meminfoPath); + expect(info).toEqual({ memTotalMb: 8192, memAvailableMb: 6144 }); + + // Running 4096 + requested 2048 = 6144 <= 8192 - 1024 (7168), and 2048 <= 6144 + expect(() => + checkMemoryForServer({ + requestedMemoryMb: 2048, + runningServersMemoryMb: 4096, + meminfo: info, + }), + ).not.toThrow(); + }); + + test("rejects with insufficient_memory when sum exceeds MemTotal - 1024 MB", () => { + const info = parseMeminfo("MemTotal: 8388608 kB\nMemAvailable: 7340032 kB\n"); + // 8192 - 1024 = 7168 max; 4096 + 4096 = 8192 > 7168 + try { + checkMemoryForServer({ + requestedMemoryMb: 4096, + runningServersMemoryMb: 4096, + meminfo: info, + }); + throw new Error("Expected insufficient_memory"); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe("insufficient_memory"); + } + }); + + test("rejects with insufficient_memory when requested memory exceeds MemAvailable", () => { + const info = parseMeminfo("MemTotal: 16777216 kB\nMemAvailable: 1572864 kB\n"); + // Available = 1536 MB, requested = 2048 MB + try { + checkMemoryForServer({ + requestedMemoryMb: 2048, + runningServersMemoryMb: 0, + meminfo: info, + }); + throw new Error("Expected insufficient_memory"); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe("insufficient_memory"); + } + }); +}); + +describe("systemd control", () => { + test("parses systemctl show output including [not set] and numeric MemoryCurrent", () => { + expect( + parseSystemdShowOutput( + "ActiveState=active\nSubState=running\nMainPID=4242\nMemoryCurrent=1073741824\n", + ), + ).toEqual({ + activeState: "active", + subState: "running", + mainPid: 4242, + memoryCurrentBytes: 1_073_741_824, + }); + + expect( + parseSystemdShowOutput( + "ActiveState=inactive\nSubState=dead\nMainPID=0\nMemoryCurrent=[not set]\n", + ), + ).toEqual({ + activeState: "inactive", + subState: "dead", + mainPid: 0, + memoryCurrentBytes: null, + }); + }); + + test("startServerUnit calls systemctl start and set-property with MemoryMax = ceil(mem * 1.25)M", async () => { + const calls: { cmd: string; args: readonly string[] }[] = []; + const runFixedImpl: RunFixedLike = async (cmd, args) => { + calls.push({ cmd, args }); + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + }; + + expect(computeMemoryMaxMb(2048)).toBe(2560); + expect(computeMemoryMaxMb(1500)).toBe(1875); + + await startServerUnit("srv-1", 2048, { runFixedImpl }); + + expect(calls).toEqual([ + { cmd: "systemctl", args: ["start", "tegrad-server@srv-1.service"] }, + { + cmd: "systemctl", + args: ["set-property", "--runtime", "tegrad-server@srv-1.service", "MemoryMax=2560M"], + }, + ]); + }); + + test("stopServerUnit sends 'stop' to FIFO, waits for inactive, and stops socket", async () => { + const fifoWrites: { path: string; data: string }[] = []; + const calls: { cmd: string; args: readonly string[] }[] = []; + let pollCount = 0; + let fakeNow = 1000; + + const runFixedImpl: RunFixedLike = async (cmd, args) => { + calls.push({ cmd, args }); + if (args[0] === "show") { + pollCount++; + const state = pollCount >= 2 ? "inactive" : "active"; + return { + code: 0, + stdout: `ActiveState=${state}\nSubState=dead\nMainPID=0\nMemoryCurrent=[not set]\n`, + stderr: "", + timedOut: false, + truncated: false, + }; + } + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + }; + + const status = await stopServerUnit("srv-1", { + runDir: "/run/tegrad-server", + runFixedImpl, + writeFifoImpl: (path, data) => fifoWrites.push({ path, data }), + pollIntervalMs: 10, + stopTimeoutMs: 500, + now: () => fakeNow, + sleepImpl: async (ms) => { + fakeNow += ms; + }, + }); + + expect(fifoWrites).toHaveLength(1); + expect(fifoWrites[0]?.data).toBe("stop\n"); + expect(status.activeState).toBe("inactive"); + expect(calls[calls.length - 1]).toEqual({ + cmd: "systemctl", + args: ["stop", "tegrad-server@srv-1.socket"], + }); + }); + + test("stopServerUnit falls back to systemctl stop when timeout elapses", async () => { + const calls: { cmd: string; args: readonly string[] }[] = []; + let forcedStopped = false; + let fakeNow = 0; + + const runFixedImpl: RunFixedLike = async (cmd, args) => { + calls.push({ cmd, args }); + if (args[0] === "stop" && args[1] === "tegrad-server@srv-1.service") { + forcedStopped = true; + } + if (args[0] === "show") { + return { + code: 0, + stdout: `ActiveState=${forcedStopped ? "inactive" : "active"}\nSubState=running\nMainPID=100\nMemoryCurrent=1000\n`, + stderr: "", + timedOut: false, + truncated: false, + }; + } + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + }; + + const finalStatus = await stopServerUnit("srv-1", { + runDir: "/run/tegrad-server", + runFixedImpl, + writeFifoImpl: () => { + throw new ProtocolError("server_stopped", "no reader"); + }, + pollIntervalMs: 50, + stopTimeoutMs: 100, + now: () => fakeNow, + sleepImpl: async (ms) => { + fakeNow += ms; + }, + }); + + expect(finalStatus.activeState).toBe("inactive"); + expect( + calls.some((c) => c.args[0] === "stop" && c.args[1] === "tegrad-server@srv-1.service"), + ).toBe(true); + expect( + calls.some((c) => c.args[0] === "stop" && c.args[1] === "tegrad-server@srv-1.socket"), + ).toBe(true); + }); + + test("getUnitStatus validates server_id before calling systemctl", async () => { + let called = false; + const runFixedImpl: RunFixedLike = async () => { + called = true; + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + }; + + try { + await getUnitStatus("../bad", runFixedImpl); + throw new Error("Expected invalid_body"); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe("invalid_body"); + } + expect(called).toBe(false); + }); +}); diff --git a/src/server/memory.ts b/src/server/memory.ts new file mode 100644 index 0000000..13c4c29 --- /dev/null +++ b/src/server/memory.ts @@ -0,0 +1,84 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { readFileSync } from "node:fs"; +import { ProtocolError } from "../protocol"; + +export const DEFAULT_MEMINFO_PATH = "/proc/meminfo"; +export const RESERVED_SYSTEM_MEMORY_MB = 1024; + +export interface Meminfo { + readonly memTotalMb: number; + readonly memAvailableMb: number; +} + +export function parseMeminfo(content: string): Meminfo { + let memTotalKb: number | null = null; + let memAvailableKb: number | null = null; + + for (const rawLine of content.split(/\r?\n/)) { + const match = /^(MemTotal|MemAvailable):\s+(\d+)\s+kB$/i.exec(rawLine.trim()); + if (!match) { + continue; + } + const key = match[1]?.toLowerCase(); + const kb = Number(match[2]); + if (!Number.isSafeInteger(kb) || kb < 0) { + continue; + } + if (key === "memtotal") { + memTotalKb = kb; + } else if (key === "memavailable") { + memAvailableKb = kb; + } + } + + if (memTotalKb === null || memAvailableKb === null) { + throw new ProtocolError( + "insufficient_memory", + "Unable to determine MemTotal and MemAvailable from /proc/meminfo", + ); + } + + return { + memTotalMb: Math.floor(memTotalKb / 1024), + memAvailableMb: Math.floor(memAvailableKb / 1024), + }; +} + +export function readMeminfo(meminfoPath: string = DEFAULT_MEMINFO_PATH): Meminfo { + let raw: string; + try { + raw = readFileSync(meminfoPath, "utf8"); + } catch { + throw new ProtocolError("insufficient_memory", "Failed to read host memory information"); + } + return parseMeminfo(raw); +} + +export interface MemoryCheckParams { + readonly requestedMemoryMb: number; + readonly runningServersMemoryMb: number; + readonly meminfo: Meminfo; + readonly reservedSystemMb?: number; +} + +export function checkMemoryForServer(params: MemoryCheckParams): void { + const reservedSystemMb = params.reservedSystemMb ?? RESERVED_SYSTEM_MEMORY_MB; + const maxAllocatableMb = params.meminfo.memTotalMb - reservedSystemMb; + const totalAllocatedMb = params.runningServersMemoryMb + params.requestedMemoryMb; + + if (totalAllocatedMb > maxAllocatableMb) { + throw new ProtocolError( + "insufficient_memory", + `Requested ${params.requestedMemoryMb} MB plus running ${params.runningServersMemoryMb} MB exceeds host budget (${maxAllocatableMb} MB)`, + ); + } + + if (params.requestedMemoryMb > params.meminfo.memAvailableMb) { + throw new ProtocolError( + "insufficient_memory", + `Requested ${params.requestedMemoryMb} MB exceeds available host memory (${params.meminfo.memAvailableMb} MB)`, + ); + } +} diff --git a/src/server/registry.ts b/src/server/registry.ts new file mode 100644 index 0000000..be8abd8 --- /dev/null +++ b/src/server/registry.ts @@ -0,0 +1,244 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { existsSync, readdirSync, readFileSync } from "node:fs"; +import { join } from "node:path"; +import { z } from "zod"; +import { writeFileAtomic } from "../agent/state"; +import { + MAX_JVM_ARGS, + ProtocolError, + SERVER_ID_REGEX, + serverIdSchema, + serverLoaderSchema, + serverMemoryMbSchema, + serverPortSchema, +} from "../protocol"; +import { resolveServerDir } from "./id"; +import type { ServerLaunchTarget } from "./start-script"; + +export const SERVER_METADATA_FILE = "tegrad-server.json"; +export const EULA_FILE = "eula.txt"; +export const SERVER_PROPERTIES_FILE = "server.properties"; + +const SERVER_FILE_MODE = 0o640; +const SERVER_DIR_MODE = 0o750; + +export const serverLaunchTargetSchema = z.discriminatedUnion("kind", [ + z + .object({ + kind: z.literal("jar"), + jar_relative_path: z.string().min(1), + }) + .strict(), + z + .object({ + kind: z.literal("args_file"), + args_file_relative_path: z.string().min(1), + }) + .strict(), +]); + +export const serverMetadataSchema = z + .object({ + v: z.literal(1), + id: serverIdSchema, + name: z.string().trim().min(1).max(128), + minecraft_version: z.string().min(1).max(64), + loader: serverLoaderSchema, + loader_version: z.string().min(1).max(64).nullable(), + memory_mb: serverMemoryMbSchema, + jvm_args: z.array(z.string()).max(MAX_JVM_ARGS), + port: serverPortSchema, + created_at: z.number().int().nonnegative(), + launch_target: serverLaunchTargetSchema.optional(), + }) + .strict(); + +export type ServerMetadata = z.infer; + +export function getEffectiveLaunchTarget(meta: ServerMetadata): ServerLaunchTarget { + return ( + meta.launch_target ?? { + kind: "jar", + jar_relative_path: "server.jar", + } + ); +} + +export function writeServerMetadata(serversDir: string, metadata: ServerMetadata): void { + const parsed = serverMetadataSchema.safeParse(metadata); + if (!parsed.success) { + throw new ProtocolError("invalid_body", "Invalid server metadata"); + } + const serverDir = resolveServerDir(serversDir, parsed.data.id); + const metadataPath = join(serverDir, SERVER_METADATA_FILE); + const payload = `${JSON.stringify(parsed.data, null, 2)}\n`; + writeFileAtomic(metadataPath, payload, { + mode: SERVER_FILE_MODE, + dirMode: SERVER_DIR_MODE, + }); +} + +export function readServerMetadata(serversDir: string, id: string): ServerMetadata { + const serverDir = resolveServerDir(serversDir, id); + const metadataPath = join(serverDir, SERVER_METADATA_FILE); + if (!existsSync(metadataPath)) { + throw new ProtocolError("server_not_found", `Server not found: ${id}`); + } + + let raw: unknown; + try { + raw = JSON.parse(readFileSync(metadataPath, "utf8")) as unknown; + } catch { + throw new ProtocolError("invalid_format", `Corrupt metadata for server: ${id}`); + } + + const parsed = serverMetadataSchema.safeParse(raw); + if (!parsed.success) { + throw new ProtocolError("invalid_format", `Invalid metadata schema for server: ${id}`); + } + + if (parsed.data.id !== id) { + throw new ProtocolError("invalid_format", `Server metadata id mismatch for ${id}`); + } + + return parsed.data; +} + +export function listServerMetadata(serversDir: string): ServerMetadata[] { + if (!existsSync(serversDir)) { + return []; + } + + const entries = readdirSync(serversDir, { withFileTypes: true }); + const result: ServerMetadata[] = []; + + for (const entry of entries) { + if (!entry.isDirectory()) { + continue; + } + if (!SERVER_ID_REGEX.test(entry.name)) { + continue; + } + const serverDir = resolveServerDir(serversDir, entry.name); + const metadataPath = join(serverDir, SERVER_METADATA_FILE); + if (!existsSync(metadataPath)) { + continue; + } + result.push(readServerMetadata(serversDir, entry.name)); + } + + result.sort((a, b) => a.id.localeCompare(b.id)); + return result; +} + +export function writeEulaFile(serverDir: string, accepted: boolean): void { + const eulaPath = join(serverDir, EULA_FILE); + const content = accepted ? "eula=true\n" : "eula=false\n"; + writeFileAtomic(eulaPath, content, { + mode: SERVER_FILE_MODE, + dirMode: SERVER_DIR_MODE, + }); +} + +export function isEulaAccepted(serverDir: string): boolean { + const eulaPath = join(serverDir, EULA_FILE); + if (!existsSync(eulaPath)) { + return false; + } + + let content: string; + try { + content = readFileSync(eulaPath, "utf8"); + } catch { + return false; + } + + for (const rawLine of content.split(/\r?\n/)) { + const trimmed = rawLine.trim(); + if (trimmed.length === 0 || trimmed.startsWith("#")) { + continue; + } + const eqIndex = trimmed.indexOf("="); + if (eqIndex === -1) { + continue; + } + const key = trimmed.slice(0, eqIndex).trim().toLowerCase(); + const val = trimmed + .slice(eqIndex + 1) + .trim() + .toLowerCase(); + if (key === "eula") { + return val === "true"; + } + } + + return false; +} + +export interface UpdateServerPropertiesOptions { + readonly port: number; + readonly forceOnlineMode?: boolean; +} + +export function writeServerProperties( + serverDir: string, + options: UpdateServerPropertiesOptions, +): void { + const propsPath = join(serverDir, SERVER_PROPERTIES_FILE); + const lines: string[] = []; + + if (existsSync(propsPath)) { + const existing = readFileSync(propsPath, "utf8"); + for (const line of existing.split(/\r?\n/)) { + if (line.length > 0) { + lines.push(line); + } + } + } + + let sawPort = false; + let sawOnlineMode = false; + let sawRcon = false; + + const updated = lines.map((line) => { + const trimmed = line.trim(); + if (trimmed.startsWith("#")) { + return line; + } + const eqIndex = trimmed.indexOf("="); + if (eqIndex === -1) { + return line; + } + const key = trimmed.slice(0, eqIndex).trim(); + if (key === "server-port") { + sawPort = true; + return `server-port=${options.port}`; + } + if (key === "online-mode") { + sawOnlineMode = true; + return options.forceOnlineMode ? "online-mode=true" : line; + } + if (key === "enable-rcon") { + sawRcon = true; + return "enable-rcon=false"; + } + return line; + }); + + if (!sawPort) { + updated.push(`server-port=${options.port}`); + } + if (!sawOnlineMode) { + updated.push("online-mode=true"); + } + if (!sawRcon) { + updated.push("enable-rcon=false"); + } + + writeFileAtomic(propsPath, `${updated.join("\n")}\n`, { + mode: SERVER_FILE_MODE, + dirMode: SERVER_DIR_MODE, + }); +} diff --git a/src/server/runtime.test.ts b/src/server/runtime.test.ts new file mode 100644 index 0000000..515d3ee --- /dev/null +++ b/src/server/runtime.test.ts @@ -0,0 +1,499 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeAll, describe, expect, test } from "bun:test"; +import { createHash } from "node:crypto"; +import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { createCommandQueue, createLogger, type TransportCommandFrame } from "../agent"; +import { fingerprint, generateSigningKeyPair, ready } from "../crypto"; +import { + createCoreRegistry, + createInMemoryTrustContext, + createSignedCommand, + openAgentMessage, + openCommand, + PROTOCOL_VERSION, + ProtocolError, + signSessionCertificate, + type TransportFrame, +} from "../protocol"; +import { + createServerManager, + type FetchLike, + getJavaBinPath, + type RunFixedLike, + registerServerHandlers, +} from "./index"; + +const tempDirs: string[] = []; + +function makeTempDir(prefix: string): string { + const dir = mkdtempSync(join(tmpdir(), prefix)); + tempDirs.push(dir); + return dir; +} + +beforeAll(async () => { + await ready(); +}); + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +function makeSilentLogger() { + return createLogger({ level: "error", stdout: () => {}, stderr: () => {} }); +} + +function makeFakeVanillaFetch(): FetchLike { + const jarBytes = new TextEncoder().encode("PK-vanilla-server"); + const sha1 = createHash("sha1").update(jarBytes).digest("hex"); + + return async (input) => { + const url = String(input); + if (url === "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json") { + return new Response( + JSON.stringify({ + versions: [ + { id: "1.21.4", url: "https://piston-meta.mojang.com/v1/packages/1.21.4.json" }, + ], + }), + { status: 200 }, + ); + } + if (url === "https://piston-meta.mojang.com/v1/packages/1.21.4.json") { + return new Response( + JSON.stringify({ + downloads: { + server: { + sha1, + size: jarBytes.byteLength, + url: "https://piston-data.mojang.com/v1/objects/server.jar", + }, + }, + }), + { status: 200 }, + ); + } + if (url === "https://piston-data.mojang.com/v1/objects/server.jar") { + return new Response(jarBytes, { status: 200 }); + } + return new Response("not found", { status: 404 }); + }; +} + +function preinstallFakeJava(serversDir: string, major: 8 | 16 | 17 | 21): string { + const binPath = getJavaBinPath(serversDir, major, "linux"); + mkdirSync(join(binPath, ".."), { recursive: true }); + writeFileSync(binPath, "#!/bin/sh\n"); + return binPath; +} + +function makeSystemdFake() { + const states = new Map(); + const commands: { cmd: string; args: readonly string[] }[] = []; + let stuckActiveUnit: string | null = null; + + const runFixedImpl: RunFixedLike = async (cmd, args) => { + commands.push({ cmd, args }); + if (cmd === "systemctl") { + const action = args[0]; + if (action === "show") { + const unit = args[3] ?? ""; + const state = states.get(unit) ?? "inactive"; + return { + code: 0, + stdout: `ActiveState=${state}\nSubState=${state === "active" ? "running" : "dead"}\nMainPID=${state === "active" ? 1234 : 0}\nMemoryCurrent=${state === "active" ? 524288000 : "[not set]"}\n`, + stderr: "", + timedOut: false, + truncated: false, + }; + } + if (action === "start") { + const unit = args[1] ?? ""; + states.set(unit, "active"); + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + } + if (action === "stop") { + const unit = args[1] ?? ""; + if (unit !== stuckActiveUnit) { + states.set(unit, "inactive"); + } + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + } + if (action === "set-property") { + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + } + } + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + }; + + return { + states, + commands, + setStuckActive(unit: string | null) { + stuckActiveUnit = unit; + }, + runFixedImpl, + }; +} + +describe("ServerManager lifecycle and command integration", () => { + test("eula_accepted=false creates server with RCON disabled and blocks start until accepted", async () => { + const serversDir = makeTempDir("tegrad-rt-eula-"); + const runDir = makeTempDir("tegrad-rt-run-"); + preinstallFakeJava(serversDir, 21); + + const sysd = makeSystemdFake(); + const manager = createServerManager({ + serversDir, + runDir, + platform: "linux", + fetchImpl: makeFakeVanillaFetch(), + runFixedImpl: sysd.runFixedImpl, + readMeminfoImpl: () => ({ memTotalMb: 16384, memAvailableMb: 12000 }), + now: () => 1_700_000_000_000, + }); + + const created = await manager.createServer({ + server_id: "smp-1", + name: "My SMP", + minecraft_version: "1.21.4", + loader: "vanilla", + memory_mb: 2048, + jvm_args: ["-XX:+UseG1GC"], + eula_accepted: false, + }); + + expect(created.id).toBe("smp-1"); + expect(created.port).toBe(25565); + + const srvDir = join(serversDir, "smp-1"); + expect(existsSync(join(srvDir, "logs"))).toBe(true); + expect(existsSync(join(srvDir, "tegrad-server.json"))).toBe(true); + expect(existsSync(join(srvDir, "start.sh"))).toBe(true); + expect(readFileSync(join(srvDir, "eula.txt"), "utf8")).toBe("eula=false\n"); + + const props = readFileSync(join(srvDir, "server.properties"), "utf8"); + expect(props).toContain("server-port=25565"); + expect(props).toContain("online-mode=true"); + expect(props).toContain("enable-rcon=false"); + + // Start must fail with eula_not_accepted + try { + await manager.startServer("smp-1"); + throw new Error("Expected eula_not_accepted"); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe("eula_not_accepted"); + } + + // Even if someone manually enables RCON in server.properties, update_settings forces it back to false + writeFileSync( + join(srvDir, "server.properties"), + "server-port=25565\nenable-rcon=true\nmotd=Hi\n", + ); + + const updated = manager.updateServerSettings({ + server_id: "smp-1", + memory_mb: 3072, + port: 25570, + eula_accepted: true, + }); + expect(updated.memory_mb).toBe(3072); + expect(updated.port).toBe(25570); + + const updatedProps = readFileSync(join(srvDir, "server.properties"), "utf8"); + expect(updatedProps).toContain("server-port=25570"); + expect(updatedProps).toContain("enable-rcon=false"); + expect(updatedProps).toContain("motd=Hi"); + + const updatedStart = readFileSync(join(srvDir, "start.sh"), "utf8"); + expect(updatedStart).toContain("-Xms3072M -Xmx3072M"); + + // Now start succeeds and applies MemoryMax = ceil(3072 * 1.25) = 3840M + await manager.startServer("smp-1"); + expect( + sysd.commands.some( + (c) => + c.cmd === "systemctl" && c.args[0] === "set-property" && c.args[3] === "MemoryMax=3840M", + ), + ).toBe(true); + + manager.close(); + }); + + test("enforces RAM budget across running servers and refuses delete until confirmed stopped", async () => { + const serversDir = makeTempDir("tegrad-rt-ram-"); + const runDir = makeTempDir("tegrad-rt-ram-run-"); + preinstallFakeJava(serversDir, 21); + + const sysd = makeSystemdFake(); + let fakeNow = 1_700_000_000_000; + const manager = createServerManager({ + serversDir, + runDir, + platform: "linux", + fetchImpl: makeFakeVanillaFetch(), + runFixedImpl: sysd.runFixedImpl, + writeFifoImpl: () => { + // simulate graceful stop on FIFO write unless unit is stuck + }, + readMeminfoImpl: () => ({ memTotalMb: 6144, memAvailableMb: 5000 }), + stopPollIntervalMs: 10, + stopTimeoutMs: 50, + now: () => fakeNow, + sleepImpl: async (ms) => { + fakeNow += ms; + }, + }); + + await manager.createServer({ + server_id: "srv-a", + name: "Server A", + minecraft_version: "1.21.4", + loader: "vanilla", + memory_mb: 3072, + eula_accepted: true, + }); + await manager.createServer({ + server_id: "srv-b", + name: "Server B", + minecraft_version: "1.21.4", + loader: "vanilla", + memory_mb: 3072, + eula_accepted: true, + }); + + await manager.startServer("srv-a"); + + // Host total 6144 - 1024 = 5120 MB budget; 3072 + 3072 = 6144 > 5120 -> insufficient_memory + try { + await manager.startServer("srv-b"); + throw new Error("Expected insufficient_memory"); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe("insufficient_memory"); + } + + // Delete refuses to remove directory if unit cannot be confirmed stopped + sysd.setStuckActive("tegrad-server@srv-a.service"); + try { + await manager.deleteServer("srv-a"); + throw new Error("Expected server_running"); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe("server_running"); + } + expect(existsSync(join(serversDir, "srv-a"))).toBe(true); + + // Once unit stops properly, delete stops and removes the folder + sysd.setStuckActive(null); + await manager.deleteServer("srv-a"); + expect(existsSync(join(serversDir, "srv-a"))).toBe(false); + + manager.close(); + }); + + test("CommandRegistry + CommandQueue + openCommand end-to-end (including sensitive server.delete)", async () => { + const serversDir = makeTempDir("tegrad-rt-e2e-"); + const runDir = makeTempDir("tegrad-rt-e2e-run-"); + preinstallFakeJava(serversDir, 21); + + const agent = generateSigningKeyPair(); + const account = generateSigningKeyPair(); + const session = generateSigningKeyPair(); + const agentId = fingerprint(agent.publicKey); + let now = 1_700_000_000_000; + + const sessionCert = signSessionCertificate({ + sessionPublicKey: session.publicKey, + accountKeyPair: account, + notBefore: now - 60_000, + notAfter: now + 3_600_000, + }); + + const registry = createCoreRegistry(); + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [account.publicKey], + now: () => now, + }); + + const frames: TransportFrame[] = []; + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (frame) => frames.push(frame), + logger: makeSilentLogger(), + }); + + const sysd = makeSystemdFake(); + const fifoWrites: string[] = []; + const manager = createServerManager({ + serversDir, + runDir, + platform: "linux", + fetchImpl: makeFakeVanillaFetch(), + runFixedImpl: sysd.runFixedImpl, + writeFifoImpl: (_path, data) => fifoWrites.push(data), + readMeminfoImpl: () => ({ memTotalMb: 16384, memAvailableMb: 12000 }), + stopPollIntervalMs: 5, + stopTimeoutMs: 20, + now: () => now, + sleepImpl: async (ms) => { + now += ms; + }, + }); + registerServerHandlers(queue, manager); + + const wrap = (cmd: ReturnType): TransportCommandFrame => ({ + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: agentId }, + body: cmd, + }); + + // 1. Session key creates server + const createCmd = createSignedCommand( + { + type: "server.create", + body: { + server_id: "alpha-1", + name: "Alpha Server", + minecraft_version: "1.21.4", + loader: "vanilla", + memory_mb: 2048, + eula_accepted: true, + }, + agentPublicKey: agent.publicKey, + signer: session, + session: sessionCert, + counter: 1, + now, + }, + registry, + ); + await queue.enqueue(wrap(createCmd)); + + // 2. Session key lists servers + const listCmd = createSignedCommand( + { + type: "server.list", + body: {}, + agentPublicKey: agent.publicKey, + signer: session, + session: sessionCert, + counter: 2, + now, + }, + registry, + ); + await queue.enqueue(wrap(listCmd)); + + // 3. Session key starts server and queries status + const startCmd = createSignedCommand( + { + type: "server.start", + body: { server_id: "alpha-1" }, + agentPublicKey: agent.publicKey, + signer: session, + session: sessionCert, + counter: 3, + now, + }, + registry, + ); + await queue.enqueue(wrap(startCmd)); + + const statusCmd = createSignedCommand( + { + type: "server.status", + body: { server_id: "alpha-1" }, + agentPublicKey: agent.publicKey, + signer: session, + session: sessionCert, + counter: 4, + now, + }, + registry, + ); + await queue.enqueue(wrap(statusCmd)); + + // 4. Session key sends console line + const consoleCmd = createSignedCommand( + { + type: "server.console.send", + body: { server_id: "alpha-1", line: "list" }, + agentPublicKey: agent.publicKey, + signer: session, + session: sessionCert, + counter: 5, + now, + }, + registry, + ); + await queue.enqueue(wrap(consoleCmd)); + expect(fifoWrites).toContain("list\n"); + + // 5. Session key CANNOT invoke sensitive server.delete + const sessionDeleteCmd = createSignedCommand( + { + type: "server.delete", + body: { server_id: "alpha-1" }, + agentPublicKey: agent.publicKey, + signer: session, + session: sessionCert, + counter: 6, + now, + }, + registry, + ); + await expect(openCommand(sessionDeleteCmd, trust, registry)).rejects.toThrow(ProtocolError); + + // 6. Account key CAN invoke sensitive server.delete + const accountDeleteCmd = createSignedCommand( + { + type: "server.delete", + body: { server_id: "alpha-1" }, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now, + }, + registry, + ); + await queue.enqueue(wrap(accountDeleteCmd)); + expect(existsSync(join(serversDir, "alpha-1"))).toBe(false); + + // Verify sealed events emitted + const events = frames + .filter((f): f is Extract => f.kind === "event") + .map((f) => openAgentMessage(f.body, agent.publicKey, account)); + + const listEvent = events.find((e) => e.header.type === "server.list.result"); + if (!listEvent) { + throw new Error("Expected server.list.result event"); + } + expect((listEvent.body as { servers: { id: string }[] }).servers.map((s) => s.id)).toEqual([ + "alpha-1", + ]); + + const statusEvent = events.find((e) => e.header.type === "server.status.result"); + if (!statusEvent) { + throw new Error("Expected server.status.result event"); + } + expect((statusEvent.body as { systemd: { active_state: string } }).systemd.active_state).toBe( + "active", + ); + + manager.close(); + }); +}); diff --git a/src/server/runtime.ts b/src/server/runtime.ts new file mode 100644 index 0000000..cd5550d --- /dev/null +++ b/src/server/runtime.ts @@ -0,0 +1,488 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { chmodSync, existsSync, mkdirSync, rmSync } from "node:fs"; +import { join } from "node:path"; +import type { CommandQueue } from "../agent/jobs"; +import type { Logger } from "../agent/logger"; +import { + DEFAULT_SERVER_PORT, + ProtocolError, + type ServerConsoleSendBody, + type ServerConsoleSubscribeBody, + type ServerCreateBody, + type ServerUpdateSettingsBody, +} from "../protocol"; +import { + type ConsoleEventEmitter, + type ConsoleSubscriptionManager, + type ConsoleTimerProvider, + createConsoleSubscriptionManager, + type FifoWriter, + sendConsoleLine, +} from "./console"; +import type { FetchLike } from "./download"; +import { assertValidServerId, DEFAULT_RUN_DIR, DEFAULT_SERVERS_DIR, resolveServerDir } from "./id"; +import { ensureJavaRuntime, getJavaBinPath, type RunFixedLike, selectJavaMajor } from "./java"; +import { installServerLoader } from "./loaders"; +import { + checkMemoryForServer, + DEFAULT_MEMINFO_PATH, + type Meminfo, + RESERVED_SYSTEM_MEMORY_MB, + readMeminfo, +} from "./memory"; +import { + getEffectiveLaunchTarget, + isEulaAccepted, + listServerMetadata, + readServerMetadata, + type ServerMetadata, + writeEulaFile, + writeServerMetadata, + writeServerProperties, +} from "./registry"; +import { validateJvmArgs, writeStartScript } from "./start-script"; +import { + getUnitStatus, + isUnitActive, + isUnitStopped, + type SystemdUnitStatus, + startServerUnit, + stopServerUnit, +} from "./systemd"; + +const SERVER_DIR_MODE = 0o750; + +function isPosix(platform: NodeJS.Platform = process.platform): boolean { + return platform !== "win32"; +} + +export interface ServerStatusReport { + readonly server: ServerMetadata; + readonly eula_accepted: boolean; + readonly systemd: { + readonly active_state: string; + readonly sub_state: string; + readonly main_pid: number; + readonly memory_current_bytes: number | null; + }; +} + +export interface ServerManagerOptions { + readonly serversDir?: string; + readonly runDir?: string; + readonly meminfoPath?: string; + readonly reservedSystemMb?: number; + readonly readMeminfoImpl?: () => Meminfo; + readonly runFixedImpl?: RunFixedLike; + readonly fetchImpl?: FetchLike; + readonly writeFifoImpl?: FifoWriter; + readonly consoleTimers?: ConsoleTimerProvider; + readonly consolePollIntervalMs?: number; + readonly stopPollIntervalMs?: number; + readonly stopTimeoutMs?: number; + readonly sleepImpl?: (ms: number) => Promise; + readonly now?: () => number; + readonly platform?: NodeJS.Platform; + readonly logger?: Logger; +} + +export interface ServerManager { + createServer(params: ServerCreateBody): Promise; + startServer(serverId: string): Promise; + stopServer(serverId: string): Promise; + restartServer(serverId: string): Promise; + deleteServer(serverId: string): Promise; + getServerStatus(serverId: string): Promise; + listServers(): ServerMetadata[]; + updateServerSettings(params: ServerUpdateSettingsBody): ServerMetadata; + sendConsole(serverId: string, line: string): void; + subscribeConsole( + serverId: string, + fromOffset: number | undefined, + sendEvent: ConsoleEventEmitter, + ): void; + unsubscribeConsole(serverId: string): void; + readonly consoleManager: ConsoleSubscriptionManager; + close(): void; +} + +export function createServerManager(options: ServerManagerOptions = {}): ServerManager { + const serversDir = options.serversDir ?? DEFAULT_SERVERS_DIR; + const runDir = options.runDir ?? DEFAULT_RUN_DIR; + const meminfoPath = options.meminfoPath ?? DEFAULT_MEMINFO_PATH; + const now = options.now ?? (() => Date.now()); + const platform = options.platform ?? process.platform; + + const consoleManager = createConsoleSubscriptionManager({ + serversDir, + ...(options.consolePollIntervalMs !== undefined + ? { pollIntervalMs: options.consolePollIntervalMs } + : {}), + ...(options.consoleTimers !== undefined ? { timers: options.consoleTimers } : {}), + now, + }); + + function readHostMeminfo(): Meminfo { + if (options.readMeminfoImpl !== undefined) { + return options.readMeminfoImpl(); + } + return readMeminfo(meminfoPath); + } + + async function computeRunningServersMemoryMb(excludeServerId: string): Promise { + const servers = listServerMetadata(serversDir); + let totalMb = 0; + + for (const server of servers) { + if (server.id === excludeServerId) { + continue; + } + const status = await getUnitStatus(server.id, options.runFixedImpl); + if (isUnitActive(status)) { + totalMb += server.memory_mb; + } + } + + return totalMb; + } + + async function createServer(params: ServerCreateBody): Promise { + const validId = assertValidServerId(params.server_id); + const jvmArgs = validateJvmArgs(params.jvm_args ?? []); + const port = params.port ?? DEFAULT_SERVER_PORT; + const serverDir = resolveServerDir(serversDir, validId); + + if (existsSync(serverDir)) { + throw new ProtocolError("server_already_exists", `Server already exists: ${validId}`); + } + + mkdirSync(serverDir, { recursive: true, mode: SERVER_DIR_MODE }); + const logsDir = join(serverDir, "logs"); + mkdirSync(logsDir, { recursive: true, mode: SERVER_DIR_MODE }); + if (isPosix(platform)) { + chmodSync(serverDir, SERVER_DIR_MODE); + chmodSync(logsDir, SERVER_DIR_MODE); + } + + try { + const javaRuntime = await ensureJavaRuntime({ + serversDir, + minecraftVersion: params.minecraft_version, + platform, + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + ...(options.runFixedImpl !== undefined ? { runFixedImpl: options.runFixedImpl } : {}), + }); + + const loaderResult = await installServerLoader({ + serverDir, + minecraftVersion: params.minecraft_version, + loader: params.loader, + javaBin: javaRuntime.javaBin, + ...(params.loader_version !== undefined ? { loaderVersion: params.loader_version } : {}), + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + ...(options.runFixedImpl !== undefined ? { runFixedImpl: options.runFixedImpl } : {}), + }); + + writeEulaFile(serverDir, params.eula_accepted); + writeServerProperties(serverDir, { port, forceOnlineMode: true }); + writeStartScript(serverDir, { + javaBin: javaRuntime.javaBin, + memoryMb: params.memory_mb, + jvmArgs, + launchTarget: loaderResult.launchTarget, + }); + + const metadata: ServerMetadata = { + v: 1, + id: validId, + name: params.name.trim(), + minecraft_version: loaderResult.minecraftVersion, + loader: loaderResult.loader, + loader_version: loaderResult.loaderVersion, + memory_mb: params.memory_mb, + jvm_args: [...jvmArgs], + port, + created_at: now(), + launch_target: loaderResult.launchTarget, + }; + writeServerMetadata(serversDir, metadata); + + options.logger?.info("Created Minecraft server", { + serverId: validId, + loader: metadata.loader, + minecraftVersion: metadata.minecraft_version, + }); + + return metadata; + } catch (err) { + if (existsSync(serverDir)) { + rmSync(serverDir, { recursive: true, force: true }); + } + throw err; + } + } + + async function startServer(serverId: string): Promise { + const validId = assertValidServerId(serverId); + const meta = readServerMetadata(serversDir, validId); + const serverDir = resolveServerDir(serversDir, validId); + + if (!isEulaAccepted(serverDir)) { + throw new ProtocolError( + "eula_not_accepted", + `Minecraft EULA has not been accepted for server: ${validId}`, + ); + } + + const currentStatus = await getUnitStatus(validId, options.runFixedImpl); + if (isUnitActive(currentStatus)) { + throw new ProtocolError("server_running", `Server is already running: ${validId}`); + } + + const runningServersMemoryMb = await computeRunningServersMemoryMb(validId); + const meminfo = readHostMeminfo(); + checkMemoryForServer({ + requestedMemoryMb: meta.memory_mb, + runningServersMemoryMb, + meminfo, + reservedSystemMb: options.reservedSystemMb ?? RESERVED_SYSTEM_MEMORY_MB, + }); + + await startServerUnit(validId, meta.memory_mb, { + ...(options.runFixedImpl !== undefined ? { runFixedImpl: options.runFixedImpl } : {}), + ...(options.logger !== undefined ? { logger: options.logger } : {}), + }); + } + + async function stopServer(serverId: string): Promise { + const validId = assertValidServerId(serverId); + readServerMetadata(serversDir, validId); + + return stopServerUnit(validId, { + runDir, + now, + ...(options.runFixedImpl !== undefined ? { runFixedImpl: options.runFixedImpl } : {}), + ...(options.writeFifoImpl !== undefined ? { writeFifoImpl: options.writeFifoImpl } : {}), + ...(options.stopPollIntervalMs !== undefined + ? { pollIntervalMs: options.stopPollIntervalMs } + : {}), + ...(options.stopTimeoutMs !== undefined ? { stopTimeoutMs: options.stopTimeoutMs } : {}), + ...(options.sleepImpl !== undefined ? { sleepImpl: options.sleepImpl } : {}), + }); + } + + async function restartServer(serverId: string): Promise { + const validId = assertValidServerId(serverId); + readServerMetadata(serversDir, validId); + const serverDir = resolveServerDir(serversDir, validId); + + if (!isEulaAccepted(serverDir)) { + throw new ProtocolError( + "eula_not_accepted", + `Minecraft EULA has not been accepted for server: ${validId}`, + ); + } + + const currentStatus = await getUnitStatus(validId, options.runFixedImpl); + if (!isUnitStopped(currentStatus)) { + await stopServer(validId); + } + + await startServer(validId); + } + + async function deleteServer(serverId: string): Promise { + const validId = assertValidServerId(serverId); + readServerMetadata(serversDir, validId); + + consoleManager.unsubscribe(validId); + + const status = await getUnitStatus(validId, options.runFixedImpl); + if (!isUnitStopped(status)) { + await stopServer(validId); + const afterStop = await getUnitStatus(validId, options.runFixedImpl); + if (!isUnitStopped(afterStop)) { + throw new ProtocolError( + "server_running", + `Refusing to delete server ${validId}: unit is still ${afterStop.activeState}`, + ); + } + } + + const serverDir = resolveServerDir(serversDir, validId); + rmSync(serverDir, { recursive: true, force: true }); + options.logger?.info("Deleted Minecraft server", { serverId: validId }); + } + + async function getServerStatus(serverId: string): Promise { + const validId = assertValidServerId(serverId); + const server = readServerMetadata(serversDir, validId); + const serverDir = resolveServerDir(serversDir, validId); + const status = await getUnitStatus(validId, options.runFixedImpl); + + return { + server, + eula_accepted: isEulaAccepted(serverDir), + systemd: { + active_state: status.activeState, + sub_state: status.subState, + main_pid: status.mainPid, + memory_current_bytes: status.memoryCurrentBytes, + }, + }; + } + + function listServers(): ServerMetadata[] { + return listServerMetadata(serversDir); + } + + function updateServerSettings(params: ServerUpdateSettingsBody): ServerMetadata { + const validId = assertValidServerId(params.server_id); + const existing = readServerMetadata(serversDir, validId); + const serverDir = resolveServerDir(serversDir, validId); + + const nextMemoryMb = params.memory_mb ?? existing.memory_mb; + const nextJvmArgs = + params.jvm_args !== undefined + ? [...validateJvmArgs(params.jvm_args)] + : [...existing.jvm_args]; + const nextPort = params.port ?? existing.port; + + const updated: ServerMetadata = { + ...existing, + memory_mb: nextMemoryMb, + jvm_args: nextJvmArgs, + port: nextPort, + }; + + writeServerMetadata(serversDir, updated); + writeServerProperties(serverDir, { port: nextPort }); + + if (params.eula_accepted !== undefined) { + writeEulaFile(serverDir, params.eula_accepted); + } + + const javaMajor = selectJavaMajor(updated.minecraft_version); + const javaBin = getJavaBinPath(serversDir, javaMajor, platform); + writeStartScript(serverDir, { + javaBin, + memoryMb: updated.memory_mb, + jvmArgs: updated.jvm_args, + launchTarget: getEffectiveLaunchTarget(updated), + }); + + return updated; + } + + function sendConsole(serverId: string, line: string): void { + const validId = assertValidServerId(serverId); + sendConsoleLine({ + runDir, + serverId: validId, + line, + ...(options.writeFifoImpl !== undefined ? { writeFifoImpl: options.writeFifoImpl } : {}), + }); + } + + function subscribeConsole( + serverId: string, + fromOffset: number | undefined, + sendEvent: ConsoleEventEmitter, + ): void { + consoleManager.subscribe({ + serverId, + sendEvent, + ...(fromOffset !== undefined ? { fromOffset } : {}), + }); + } + + function unsubscribeConsole(serverId: string): void { + consoleManager.unsubscribe(serverId); + } + + return { + createServer, + startServer, + stopServer, + restartServer, + deleteServer, + getServerStatus, + listServers, + updateServerSettings, + sendConsole, + subscribeConsole, + unsubscribeConsole, + consoleManager, + close(): void { + consoleManager.closeAll(); + }, + }; +} + +export function registerServerHandlers(queue: CommandQueue, manager: ServerManager): void { + queue.registerHandler("server.create", async (opened, ctx) => { + const body = opened.body as ServerCreateBody; + const server = await manager.createServer(body); + ctx.sendEvent("server.created", { server }); + }); + + queue.registerHandler("server.start", async (opened, ctx) => { + const body = opened.body as { readonly server_id: string }; + await manager.startServer(body.server_id); + ctx.sendEvent("server.started", { server_id: body.server_id }); + }); + + queue.registerHandler("server.stop", async (opened, ctx) => { + const body = opened.body as { readonly server_id: string }; + await manager.stopServer(body.server_id); + ctx.sendEvent("server.stopped", { server_id: body.server_id }); + }); + + queue.registerHandler("server.restart", async (opened, ctx) => { + const body = opened.body as { readonly server_id: string }; + await manager.restartServer(body.server_id); + ctx.sendEvent("server.restarted", { server_id: body.server_id }); + }); + + queue.registerHandler("server.delete", async (opened, ctx) => { + const body = opened.body as { readonly server_id: string }; + await manager.deleteServer(body.server_id); + ctx.sendEvent("server.deleted", { server_id: body.server_id }); + }); + + queue.registerHandler("server.status", async (opened, ctx) => { + const body = opened.body as { readonly server_id: string }; + const status = await manager.getServerStatus(body.server_id); + ctx.sendEvent("server.status.result", status); + }); + + queue.registerHandler("server.list", (_opened, ctx) => { + const servers = manager.listServers(); + ctx.sendEvent("server.list.result", { servers }); + }); + + queue.registerHandler("server.update_settings", (opened, ctx) => { + const body = opened.body as ServerUpdateSettingsBody; + const server = manager.updateServerSettings(body); + ctx.sendEvent("server.settings.updated", { server }); + }); + + queue.registerHandler("server.console.send", (opened) => { + const body = opened.body as ServerConsoleSendBody; + manager.sendConsole(body.server_id, body.line); + }); + + queue.registerHandler("server.console.subscribe", (opened, ctx) => { + const body = opened.body as ServerConsoleSubscribeBody; + manager.subscribeConsole(body.server_id, body.from_offset, (type, eventBody) => { + ctx.sendEvent(type, eventBody); + }); + }); + + queue.registerHandler("server.console.unsubscribe", (opened) => { + const body = opened.body as { readonly server_id: string }; + manager.unsubscribeConsole(body.server_id); + }); +} diff --git a/src/server/start-script.ts b/src/server/start-script.ts new file mode 100644 index 0000000..1634919 --- /dev/null +++ b/src/server/start-script.ts @@ -0,0 +1,316 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { join } from "node:path"; +import { writeFileAtomic } from "../agent/state"; +import { + MAX_JVM_ARGS, + MAX_SERVER_MEMORY_MB, + MIN_SERVER_MEMORY_MB, + ProtocolError, +} from "../protocol"; + +export const MAX_JVM_ARG_LENGTH = 256; + +const FORBIDDEN_CHARS_REGEX = /[\s\0'"`;|&$\\()<>]/; +const XSS_REGEX = /^-Xss[1-9][0-9]*[kKmM]$/; +const XX_BOOL_REGEX = /^-XX:[+-]([A-Za-z][A-Za-z0-9]*)$/; +const XX_VALUE_REGEX = /^-XX:([A-Za-z][A-Za-z0-9]*)=([0-9]+[kKmMgG]?)$/; +const SYS_PROP_REGEX = /^-D([a-zA-Z0-9_.-]{1,64})=([a-zA-Z0-9_.:/-]{1,128})$/; + +const SAFE_JAR_RELATIVE_PATH_REGEX = /^[a-zA-Z0-9._/-]+\.jar$/; +const SAFE_ARGS_FILE_RELATIVE_PATH_REGEX = /^libraries\/[a-zA-Z0-9._/-]+\/unix_args\.txt$/; + +export const ALLOWED_XX_BOOLEAN_FLAGS: ReadonlySet = new Set([ + "UseG1GC", + "UseZGC", + "ZGenerational", + "ParallelRefProcEnabled", + "UnlockExperimentalVMOptions", + "ExplicitGCInvokesConcurrent", + "AlwaysPreTouch", + "UseStringDeduplication", + "DisableExplicitGC", + "PerfDisableSharedMem", + "UseNUMA", + "UseLargePages", + "UseCompressedOops", + "OptimizeStringConcat", + "UseParallelGC", + "UseSerialGC", + "AlwaysActAsServerClassMachine", +]); + +export const ALLOWED_XX_VALUE_KEYS: ReadonlySet = new Set([ + "MaxGCPauseMillis", + "G1NewSizePercent", + "G1MaxNewSizePercent", + "G1HeapRegionSize", + "G1ReservePercent", + "G1HeapWastePercent", + "G1MixedGCCountTarget", + "InitiatingHeapOccupancyPercent", + "G1MixedGCLiveThresholdPercent", + "G1RSetUpdatingPauseTimePercent", + "SurvivorRatio", + "MaxTenuringThreshold", + "ActiveProcessorCount", + "ParallelGCThreads", + "ConcGCThreads", + "NewRatio", + "SoftRefLRUPolicyMSPerMB", +]); + +const BLOCKED_EXACT_OR_PREFIX_FLAGS: readonly string[] = [ + "-javaagent", + "-agentlib", + "-agentpath", + "-cp", + "-classpath", + "--class-path", + "-jar", + "-p", + "--module-path", + "--upgrade-module-path", + "--patch-module", + "--add-opens", + "--add-exports", + "--add-reads", + "--add-modules", + "-XX:OnOutOfMemoryError", + "-XX:OnError", + "-XX:ErrorFile", + "-XX:HeapDumpPath", + "-XX:LogFile", + "-XX:CompileCommandFile", + "-XX:SharedArchiveFile", + "-Xbootclasspath", + "-Xlog", + "-Xms", + "-Xmx", +]; + +const BLOCKED_SYSTEM_PROPERTY_PREFIXES: readonly string[] = [ + "java.security.", + "com.sun.management.", + "javax.net.", + "sun.rmi.", + "java.rmi.", + "javax.xml.", + "com.sun.jndi.", + "java.naming.", + "org.apache.logging.log4j.", +]; + +const BLOCKED_SYSTEM_PROPERTY_NAMES: ReadonlySet = new Set([ + "jdk.serialfilter", + "java.library.path", + "java.class.path", + "java.ext.dirs", + "java.endorsed.dirs", + "user.dir", + "user.home", + "java.io.tmpdir", + "java.security.manager", + "java.security.policy", +]); + +export type ServerLaunchTarget = + | { readonly kind: "jar"; readonly jar_relative_path: string } + | { readonly kind: "args_file"; readonly args_file_relative_path: string }; + +export function validateSingleJvmArg(arg: string): string { + if (arg.length === 0 || arg.length > MAX_JVM_ARG_LENGTH) { + throw new ProtocolError("invalid_jvm_args", "JVM argument length out of range"); + } + + if (FORBIDDEN_CHARS_REGEX.test(arg)) { + throw new ProtocolError("invalid_jvm_args", "JVM argument contains forbidden characters"); + } + + if (arg.startsWith("@")) { + throw new ProtocolError("invalid_jvm_args", "JVM argument files (@file) are not allowed"); + } + + const lower = arg.toLowerCase(); + for (const blocked of BLOCKED_EXACT_OR_PREFIX_FLAGS) { + const blockedLower = blocked.toLowerCase(); + if ( + lower === blockedLower || + lower.startsWith(`${blockedLower}:`) || + lower.startsWith(`${blockedLower}=`) || + (blockedLower === "-xms" && lower.startsWith("-xms")) || + (blockedLower === "-xmx" && lower.startsWith("-xmx")) || + (blockedLower === "-xbootclasspath" && lower.startsWith("-xbootclasspath")) + ) { + throw new ProtocolError("invalid_jvm_args", `JVM flag is not permitted: ${blocked}`); + } + } + + if (XSS_REGEX.test(arg)) { + return arg; + } + + const boolMatch = XX_BOOL_REGEX.exec(arg); + if (boolMatch !== null) { + const flagName = boolMatch[1] ?? ""; + if (!ALLOWED_XX_BOOLEAN_FLAGS.has(flagName)) { + throw new ProtocolError( + "invalid_jvm_args", + `JVM boolean flag is not allowlisted: ${flagName}`, + ); + } + return arg; + } + + const valueMatch = XX_VALUE_REGEX.exec(arg); + if (valueMatch !== null) { + const key = valueMatch[1] ?? ""; + if (!ALLOWED_XX_VALUE_KEYS.has(key)) { + throw new ProtocolError("invalid_jvm_args", `JVM value flag is not allowlisted: ${key}`); + } + return arg; + } + + const propMatch = SYS_PROP_REGEX.exec(arg); + if (propMatch !== null) { + const name = propMatch[1] ?? ""; + const value = propMatch[2] ?? ""; + const nameLower = name.toLowerCase(); + + if (value.includes("..")) { + throw new ProtocolError("invalid_jvm_args", "System property value must not contain '..'"); + } + + if (nameLower === "log4j2.formatmsgnolookups") { + if (value !== "true") { + throw new ProtocolError( + "invalid_jvm_args", + "log4j2.formatMsgNoLookups may only be set to true", + ); + } + return arg; + } + + if (BLOCKED_SYSTEM_PROPERTY_NAMES.has(nameLower)) { + throw new ProtocolError("invalid_jvm_args", `System property is blocked: ${name}`); + } + + for (const prefix of BLOCKED_SYSTEM_PROPERTY_PREFIXES) { + if (nameLower.startsWith(prefix)) { + throw new ProtocolError( + "invalid_jvm_args", + `System property namespace is blocked: ${name}`, + ); + } + } + + return arg; + } + + throw new ProtocolError("invalid_jvm_args", "JVM argument is not in the allowlist"); +} + +export function validateJvmArgs(args: readonly string[]): readonly string[] { + if (args.length > MAX_JVM_ARGS) { + throw new ProtocolError("invalid_jvm_args", `Too many JVM arguments (max ${MAX_JVM_ARGS})`); + } + return args.map((arg) => validateSingleJvmArg(arg)); +} + +export function posixSingleQuote(value: string): string { + if (/[\r\n\0]/.test(value)) { + throw new ProtocolError("invalid_body", "Shell token must not contain CR, LF, or NUL"); + } + return `'${value.replaceAll("'", "'\\''")}'`; +} + +function joinPosixPath(baseDir: string, relativePath: string): string { + const normalizedBase = baseDir.replaceAll("\\", "/").replace(/\/+$/, ""); + const normalizedRel = relativePath.replaceAll("\\", "/").replace(/^\/+/, ""); + return `${normalizedBase}/${normalizedRel}`; +} + +export function validateLaunchTarget(target: ServerLaunchTarget): ServerLaunchTarget { + if (target.kind === "jar") { + if ( + target.jar_relative_path.includes("..") || + !SAFE_JAR_RELATIVE_PATH_REGEX.test(target.jar_relative_path) + ) { + throw new ProtocolError("invalid_body", "Invalid server JAR launch target path"); + } + return target; + } + + if ( + target.args_file_relative_path.includes("..") || + !SAFE_ARGS_FILE_RELATIVE_PATH_REGEX.test(target.args_file_relative_path) + ) { + throw new ProtocolError("invalid_body", "Invalid server args file launch target path"); + } + return target; +} + +export interface RenderStartScriptParams { + readonly javaBin: string; + readonly memoryMb: number; + readonly jvmArgs: readonly string[]; + readonly serverDir: string; + readonly launchTarget: ServerLaunchTarget; +} + +export function renderStartScript(params: RenderStartScriptParams): string { + if ( + !Number.isInteger(params.memoryMb) || + params.memoryMb < MIN_SERVER_MEMORY_MB || + params.memoryMb > MAX_SERVER_MEMORY_MB + ) { + throw new ProtocolError("invalid_body", "Invalid server memory_mb"); + } + + if (params.javaBin.trim().length === 0 || /[\r\n\0]/.test(params.javaBin)) { + throw new ProtocolError("invalid_body", "Invalid java binary path"); + } + + if (params.serverDir.trim().length === 0 || /[\r\n\0]/.test(params.serverDir)) { + throw new ProtocolError("invalid_body", "Invalid server directory path"); + } + + const safeJvmArgs = validateJvmArgs(params.jvmArgs); + const safeTarget = validateLaunchTarget(params.launchTarget); + + const tokens: string[] = [ + posixSingleQuote(params.javaBin), + `-Xms${params.memoryMb}M`, + `-Xmx${params.memoryMb}M`, + ...safeJvmArgs.map((arg) => posixSingleQuote(arg)), + ]; + + if (safeTarget.kind === "jar") { + const fullJarPath = joinPosixPath(params.serverDir, safeTarget.jar_relative_path); + tokens.push("-jar", posixSingleQuote(fullJarPath), "nogui"); + } else { + tokens.push(posixSingleQuote(`@${safeTarget.args_file_relative_path}`), "nogui"); + } + + return `#!/bin/sh\nset -eu\nexec ${tokens.join(" ")}\n`; +} + +export function writeStartScript( + serverDir: string, + params: Omit & { readonly scriptServerDir?: string }, +): string { + const script = renderStartScript({ + javaBin: params.javaBin, + memoryMb: params.memoryMb, + jvmArgs: params.jvmArgs, + serverDir: params.scriptServerDir ?? serverDir, + launchTarget: params.launchTarget, + }); + const startScriptPath = join(serverDir, "start.sh"); + writeFileAtomic(startScriptPath, script, { + mode: 0o750, + dirMode: 0o750, + }); + return startScriptPath; +} diff --git a/src/server/systemd.ts b/src/server/systemd.ts new file mode 100644 index 0000000..19d0ab3 --- /dev/null +++ b/src/server/systemd.ts @@ -0,0 +1,225 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { runFixed } from "../agent/exec"; +import type { Logger } from "../agent/logger"; +import { ProtocolError } from "../protocol"; +import { type FifoWriter, sendConsoleLine } from "./console"; +import { assertValidServerId, DEFAULT_RUN_DIR, formatServiceUnit, formatSocketUnit } from "./id"; +import type { RunFixedLike } from "./java"; + +export const DEFAULT_STOP_POLL_INTERVAL_MS = 500; +export const DEFAULT_STOP_TIMEOUT_MS = 60_000; +export const MEMORY_MAX_MULTIPLIER = 1.25; + +export interface SystemdUnitStatus { + readonly activeState: string; + readonly subState: string; + readonly mainPid: number; + readonly memoryCurrentBytes: number | null; +} + +export function computeMemoryMaxMb(memoryMb: number): number { + return Math.ceil(memoryMb * MEMORY_MAX_MULTIPLIER); +} + +export function parseSystemdShowOutput(stdout: string): SystemdUnitStatus { + let activeState = "unknown"; + let subState = "unknown"; + let mainPid = 0; + let memoryCurrentBytes: number | null = null; + + for (const rawLine of stdout.split(/\r?\n/)) { + const trimmed = rawLine.trim(); + if (trimmed.length === 0) { + continue; + } + const eqIndex = trimmed.indexOf("="); + if (eqIndex === -1) { + continue; + } + const key = trimmed.slice(0, eqIndex); + const value = trimmed.slice(eqIndex + 1); + + if (key === "ActiveState") { + activeState = value; + } else if (key === "SubState") { + subState = value; + } else if (key === "MainPID") { + const parsed = Number(value); + mainPid = Number.isInteger(parsed) && parsed >= 0 ? parsed : 0; + } else if (key === "MemoryCurrent") { + if (value === "[not set]" || value === "infinity" || value === "18446744073709551615") { + memoryCurrentBytes = null; + } else { + const parsed = Number(value); + memoryCurrentBytes = Number.isSafeInteger(parsed) && parsed >= 0 ? parsed : null; + } + } + } + + return { + activeState, + subState, + mainPid, + memoryCurrentBytes, + }; +} + +export function isUnitActive(status: SystemdUnitStatus): boolean { + return ( + status.activeState === "active" || + status.activeState === "activating" || + status.activeState === "reloading" + ); +} + +export function isUnitStopped(status: SystemdUnitStatus): boolean { + return status.activeState === "inactive" || status.activeState === "failed"; +} + +export async function getUnitStatus( + serverId: string, + runFixedImpl: RunFixedLike = runFixed, +): Promise { + const validId = assertValidServerId(serverId); + const serviceUnit = formatServiceUnit(validId); + const result = await runFixedImpl("systemctl", [ + "show", + "-p", + "ActiveState,SubState,MainPID,MemoryCurrent", + serviceUnit, + ]); + if (result.timedOut || result.code !== 0) { + throw new ProtocolError( + "systemd_error", + `Failed to query systemd status for ${serviceUnit} (exit ${result.code})`, + ); + } + return parseSystemdShowOutput(result.stdout); +} + +export interface StartServerUnitOptions { + readonly runFixedImpl?: RunFixedLike; + readonly logger?: Logger; +} + +export async function startServerUnit( + serverId: string, + memoryMb: number, + options: StartServerUnitOptions = {}, +): Promise { + const validId = assertValidServerId(serverId); + const serviceUnit = formatServiceUnit(validId); + const runCmd: RunFixedLike = options.runFixedImpl ?? runFixed; + + const startResult = await runCmd("systemctl", ["start", serviceUnit]); + if (startResult.timedOut || startResult.code !== 0) { + throw new ProtocolError( + "systemd_error", + `Failed to start ${serviceUnit} (exit ${startResult.code})`, + ); + } + + const maxMb = computeMemoryMaxMb(memoryMb); + const propResult = await runCmd("systemctl", [ + "set-property", + "--runtime", + serviceUnit, + `MemoryMax=${maxMb}M`, + ]); + + if (propResult.timedOut || propResult.code !== 0) { + const stderrLower = propResult.stderr.toLowerCase(); + const isPolkitDenied = + stderrLower.includes("access denied") || + stderrLower.includes("interactive authentication required") || + stderrLower.includes("polkit"); + if (isPolkitDenied) { + options.logger?.warn("systemctl set-property MemoryMax was denied by polkit", { + serverId: validId, + memoryMaxMb: maxMb, + }); + return; + } + throw new ProtocolError( + "systemd_error", + `Failed to apply MemoryMax=${maxMb}M on ${serviceUnit} (exit ${propResult.code})`, + ); + } +} + +export interface StopServerUnitOptions { + readonly runDir?: string; + readonly runFixedImpl?: RunFixedLike; + readonly writeFifoImpl?: FifoWriter; + readonly pollIntervalMs?: number; + readonly stopTimeoutMs?: number; + readonly now?: () => number; + readonly sleepImpl?: (ms: number) => Promise; +} + +async function defaultSleep(ms: number): Promise { + await new Promise((resolve) => { + setTimeout(resolve, ms); + }); +} + +export async function stopServerUnit( + serverId: string, + options: StopServerUnitOptions = {}, +): Promise { + const validId = assertValidServerId(serverId); + const runDir = options.runDir ?? DEFAULT_RUN_DIR; + const runCmd: RunFixedLike = options.runFixedImpl ?? runFixed; + const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_STOP_POLL_INTERVAL_MS; + const stopTimeoutMs = options.stopTimeoutMs ?? DEFAULT_STOP_TIMEOUT_MS; + const now = options.now ?? (() => Date.now()); + const sleep = options.sleepImpl ?? defaultSleep; + + const serviceUnit = formatServiceUnit(validId); + const socketUnit = formatSocketUnit(validId); + + try { + sendConsoleLine({ + runDir, + serverId: validId, + line: "stop", + ...(options.writeFifoImpl !== undefined ? { writeFifoImpl: options.writeFifoImpl } : {}), + }); + } catch (err) { + // If FIFO has no reader or does not exist, proceed to status check and systemctl stop. + if (!(err instanceof ProtocolError && err.code === "server_stopped")) { + throw err; + } + } + + const deadline = now() + stopTimeoutMs; + let lastStatus = await getUnitStatus(validId, runCmd); + + while (!isUnitStopped(lastStatus) && now() < deadline) { + await sleep(pollIntervalMs); + lastStatus = await getUnitStatus(validId, runCmd); + } + + if (!isUnitStopped(lastStatus)) { + const stopService = await runCmd("systemctl", ["stop", serviceUnit]); + if (stopService.timedOut || stopService.code !== 0) { + throw new ProtocolError( + "systemd_error", + `Failed to stop ${serviceUnit} (exit ${stopService.code})`, + ); + } + lastStatus = await getUnitStatus(validId, runCmd); + } + + const stopSocket = await runCmd("systemctl", ["stop", socketUnit]); + if (stopSocket.timedOut || stopSocket.code !== 0) { + throw new ProtocolError( + "systemd_error", + `Failed to stop ${socketUnit} (exit ${stopSocket.code})`, + ); + } + + return lastStatus; +} From 3c1bdb4dffefafc253ec61c90d8b37d901c6516e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 22 Nov 2026 20:06:49 -0300 Subject: [PATCH 09/59] feat: add Ed25519 signed auto-updater, systemd apply units, and release workflow --- .github/workflows/ci.yml | 7 +- .github/workflows/release.yml | 83 ++++ install/README.md | 13 +- install/install.sh | 97 +++- install/units/tegrad-update.path | 12 + install/units/tegrad-update.service | 28 ++ scripts/sign-release.ts | 199 ++++++++ src/agent/paths.ts | 2 + src/agent/state.ts | 54 +++ src/cli/args.ts | 105 ++++- src/cli/doctor.test.ts | 14 + src/cli/doctor.ts | 6 + src/cli/main.ts | 60 ++- src/install/units.test.ts | 135 +++++- src/update/apply.test.ts | 453 +++++++++++++++++++ src/update/apply.ts | 475 +++++++++++++++++++ src/update/channels.test.ts | 110 +++++ src/update/channels.ts | 221 +++++++++ src/update/errors.ts | 32 ++ src/update/index.ts | 93 ++++ src/update/manifest.test.ts | 299 ++++++++++++ src/update/manifest.ts | 482 ++++++++++++++++++++ src/update/release-key.ts | 55 +++ src/update/updater.test.ts | 393 ++++++++++++++++ src/update/updater.ts | 677 ++++++++++++++++++++++++++++ 25 files changed, 4086 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 install/units/tegrad-update.path create mode 100644 install/units/tegrad-update.service create mode 100644 scripts/sign-release.ts create mode 100644 src/update/apply.test.ts create mode 100644 src/update/apply.ts create mode 100644 src/update/channels.test.ts create mode 100644 src/update/channels.ts create mode 100644 src/update/errors.ts create mode 100644 src/update/index.ts create mode 100644 src/update/manifest.test.ts create mode 100644 src/update/manifest.ts create mode 100644 src/update/release-key.ts create mode 100644 src/update/updater.test.ts create mode 100644 src/update/updater.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index be35544..3e5049c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,18 +33,19 @@ jobs: sudo useradd --system --gid tegrad --home-dir /var/lib/tegrad --no-create-home --shell /usr/sbin/nologin tegrad sudo usermod -aG tegrad-srv tegrad sudo install -d -o root -g root -m 0755 /opt/tegrad/bin - sudo install -d -o tegrad -g tegrad -m 0700 /var/lib/tegrad + sudo install -d -o tegrad -g tegrad -m 0700 /var/lib/tegrad /var/lib/tegrad/update sudo install -d -o tegrad-srv -g tegrad-srv -m 2770 /var/lib/tegrad-servers /var/lib/tegrad-servers/test sudo install -d -o root -g tegrad -m 0750 /run/tegrad-server printf '#!/bin/sh\nexit 0\n' | sudo tee /opt/tegrad/bin/tegrad /var/lib/tegrad-servers/test/start.sh >/dev/null sudo chmod 0755 /opt/tegrad/bin/tegrad /var/lib/tegrad-servers/test/start.sh tmp_dir=$(mktemp -d) - for unit in tegrad.service tegrad-server@.service tegrad-server@.socket; do + for unit in tegrad.service tegrad-update.service tegrad-update.path tegrad-server@.service tegrad-server@.socket; do sed \ + -e 's|@TEGRAD_BIN_DIR@|/opt/tegrad/bin|g' \ -e 's|@TEGRAD_BIN@|/opt/tegrad/bin/tegrad|g' \ -e 's|@TEGRAD_STATE_DIR@|/var/lib/tegrad|g' \ -e 's|@TEGRAD_SERVERS_DIR@|/var/lib/tegrad-servers|g' \ -e 's|@TEGRAD_RUN_DIR@|/run/tegrad-server|g' \ "install/units/${unit}" > "${tmp_dir}/${unit}" done - systemd-analyze verify "${tmp_dir}/tegrad.service" "${tmp_dir}/tegrad-server@test.service" "${tmp_dir}/tegrad-server@test.socket" + systemd-analyze verify "${tmp_dir}/tegrad.service" "${tmp_dir}/tegrad-update.service" "${tmp_dir}/tegrad-update.path" "${tmp_dir}/tegrad-server@test.service" "${tmp_dir}/tegrad-server@test.socket" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..cb9cb00 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,83 @@ +name: Release + +on: + release: + types: [published] + schedule: + - cron: "0 6 * * *" + workflow_dispatch: + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - run: bun install --frozen-lockfile + - run: bun run lint + - run: bun run typecheck + - run: bun run test + + - name: Determine release tag and channel + id: meta + env: + EVENT_NAME: ${{ github.event_name }} + RELEASE_TAG: ${{ github.event.release.tag_name }} + run: | + set -eu + if [ "$EVENT_NAME" = "release" ]; then + TAG="$RELEASE_TAG" + else + BASE_VERSION=$(bun -e 'import pkg from "./package.json"; process.stdout.write(pkg.version.split("-")[0] ?? "0.0.0")') + STAMP=$(date -u +%Y%m%d%H%M) + TAG="v${BASE_VERSION}-nightly.${STAMP}" + fi + CHANNEL=$(bun -e 'import { parseReleaseTag } from "./src/update/channels"; process.stdout.write(parseReleaseTag(process.argv[1] ?? "").channel)' -- "$TAG") + printf 'tag=%s\n' "$TAG" >> "$GITHUB_OUTPUT" + printf 'channel=%s\n' "$CHANNEL" >> "$GITHUB_OUTPUT" + + - name: Build Linux release binaries + run: | + set -eu + mkdir -p dist + bun build --compile src/index.ts --target=bun-linux-x64 --outfile dist/tegrad-linux-x64 + bun build --compile src/index.ts --target=bun-linux-arm64 --outfile dist/tegrad-linux-arm64 + + - name: Sign checksums and channel manifest + env: + RELEASE_SIGNING_KEY: ${{ secrets.RELEASE_SIGNING_KEY }} + TAG: ${{ steps.meta.outputs.tag }} + REPO: ${{ github.repository }} + run: | + set -eu + bun scripts/sign-release.ts \ + --tag "$TAG" \ + --assets-dir dist \ + --base-url "https://github.com/${REPO}/releases/download/${TAG}" + + - name: Publish release assets + env: + GH_TOKEN: ${{ github.token }} + EVENT_NAME: ${{ github.event_name }} + TAG: ${{ steps.meta.outputs.tag }} + CHANNEL: ${{ steps.meta.outputs.channel }} + run: | + set -eu + ASSETS="dist/tegrad-linux-x64 dist/tegrad-linux-arm64 dist/SHA256SUMS dist/SHA256SUMS.sig dist/${CHANNEL}.json" + if [ "$EVENT_NAME" = "release" ]; then + # shellcheck disable=SC2086 + gh release upload "$TAG" $ASSETS --clobber + else + # shellcheck disable=SC2086 + gh release create "$TAG" $ASSETS \ + --prerelease \ + --title "$TAG" \ + --notes "Automated nightly build ${TAG}" + fi diff --git a/install/README.md b/install/README.md index 905c6bf..21bcb73 100644 --- a/install/README.md +++ b/install/README.md @@ -8,10 +8,11 @@ - `systemd` running as PID 1 - `polkit` with JavaScript rules support (`/etc/polkit-1/rules.d`) - `sudo` (or root) for the initial installation +- `openssl` (1.1.1+ / 3.x) and `sha256sum` for verifying Ed25519 release signatures (`SHA256SUMS.sig`) on fresh `--version` installs ## Install or update -From a release tag (downloads the binary and verifies `SHA256SUMS`): +From a release tag (downloads the binary, verifies the Ed25519 signature of `SHA256SUMS` via `SHA256SUMS.sig`, and checks the SHA-256 digest before executing or installing): ```sh ./install/install.sh --version v0.1.0 @@ -28,7 +29,15 @@ Optional flags: - `--api-url https://...`: writes `api_url` to `/var/lib/tegrad/config.json` (otherwise created once with `https://api.tegramc.com` and preserved on updates). - `--allow-lan `: allows a private/LAN CIDR in the server network drop-in (can be repeated). -The installer is idempotent: re-running it updates the binary, units, polkit rule, and network drop-in without resetting `/var/lib/tegrad`. +The installer is idempotent: re-running it updates the binary, units (`tegrad.service`, `tegrad-update.path`, `tegrad-update.service`, `tegrad-server@.service`, `tegrad-server@.socket`), polkit rule, and network drop-in without resetting `/var/lib/tegrad`. + +## Signed auto-updates + +`tegrad` checks its configured release channel (`stable`, `beta`, or `nightly`) and stages verified updates into `/var/lib/tegrad/update` (`0700`, owned by `tegrad`). The agent itself never has write access to `/opt/tegrad/bin`. When `/var/lib/tegrad/update/ready.json` appears, `tegrad-update.path` activates the sandboxed `tegrad-update.service`, which runs `/opt/tegrad/bin/tegrad apply-update` as `root`: + +1. Copies the staged binary and manifest into a private root-owned temporary directory inside `/opt/tegrad/bin`. +2. Re-verifies the Ed25519 manifest signature and SHA-256 hash on the root-owned copy (preventing TOCTOU tampering). +3. Backs up the existing binary to `/opt/tegrad/bin/tegrad.prev`, swaps the new binary atomically, restarts `tegrad.service`, and automatically rolls back if the service fails to become active. After installation, link the agent and verify the setup: diff --git a/install/install.sh b/install/install.sh index 7e0b3e8..18374bf 100755 --- a/install/install.sh +++ b/install/install.sh @@ -29,6 +29,10 @@ TMPFILES_FILE="/etc/tmpfiles.d/tegrad.conf" DEFAULT_API_URL="https://api.tegramc.com" RELEASE_BASE_URL="https://github.com/codebyant/tegrad/releases/download" NETWORK_DENY_RANGES="10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 169.254.0.0/16 100.64.0.0/10 127.0.0.0/8 fc00::/7 fe80::/10 ::1/128" +# TODO(release-key): replace placeholder test public key with production offline Ed25519 release signing public key before first public release. +RELEASE_PUBLIC_KEY_PEM='-----BEGIN PUBLIC KEY----- +MCowBQYDK2VwAyEAIVL40Zt5HSRFMkLhXy6rbLfP+ntqXtMAl5YOBpiB2xI= +-----END PUBLIC KEY-----' TMP_DOWNLOAD_DIR="" @@ -57,7 +61,7 @@ Usage: install.sh [options] Install or update tegrad (idempotent): --binary Install a local tegrad binary - --version Download release binary and verify SHA256SUMS + --version Download release binary and verify Ed25519 signature + SHA256SUMS --api-url Write api_url to /var/lib/tegrad/config.json (must be https://) --allow-lan Allow a LAN CIDR in IPAddressAllow (repeatable) @@ -509,6 +513,10 @@ check_environment() { if [ "$(id -u)" -ne 0 ] && ! command -v sudo >/dev/null 2>&1; then die "Root privileges or 'sudo' are required" fi + + if [ -n "${OPT_VERSION:-}" ] && [ ! -x "$TEGRAD_BIN" ] && ! command -v openssl >/dev/null 2>&1; then + die "'openssl' is required to verify Ed25519 release signatures for --version installs" + fi } detect_nologin_shell() { @@ -533,12 +541,51 @@ download_file() { fi } +verify_sha256sums_signature() { + _vs_sums="$1" + _vs_sig="$2" + _vs_tmp="$3" + _vs_pem="${4:-$RELEASE_PUBLIC_KEY_PEM}" + + if ! command -v openssl >/dev/null 2>&1; then + die "'openssl' is required to verify Ed25519 release signatures" + fi + + _vs_raw=$(tr -d '\r\n\t ' < "$_vs_sig") + if [ -z "$_vs_raw" ]; then + die "SHA256SUMS.sig is empty" + fi + + _vs_b64=$(printf '%s' "$_vs_raw" | tr '_-' '/+') + case $(( ${#_vs_b64} % 4 )) in + 0) ;; + 2) _vs_b64="${_vs_b64}==" ;; + 3) _vs_b64="${_vs_b64}=" ;; + *) die "Invalid base64url encoding in SHA256SUMS.sig" ;; + esac + + printf '%s' "$_vs_b64" | openssl base64 -d -A > "${_vs_tmp}/SHA256SUMS.sig.bin" \ + || die "Failed to decode SHA256SUMS.sig" + + printf '%s\n' "$_vs_pem" > "${_vs_tmp}/release-pubkey.pem" + { printf 'TEGRA_SHA256SUMS_V1\000'; cat "$_vs_sums"; } > "${_vs_tmp}/SHA256SUMS.input" + + if ! openssl pkeyutl -verify \ + -pubin -inkey "${_vs_tmp}/release-pubkey.pem" \ + -rawin \ + -in "${_vs_tmp}/SHA256SUMS.input" \ + -sigfile "${_vs_tmp}/SHA256SUMS.sig.bin" >/dev/null 2>&1; then + die "Ed25519 signature verification failed for SHA256SUMS" + fi +} + fetch_release_binary() { _fr_ver="$1" _fr_arch=$(detect_arch) _fr_asset="tegrad-linux-${_fr_arch}" _fr_bin_url="${RELEASE_BASE_URL}/${_fr_ver}/${_fr_asset}" _fr_sums_url="${RELEASE_BASE_URL}/${_fr_ver}/SHA256SUMS" + _fr_sig_url="${RELEASE_BASE_URL}/${_fr_ver}/SHA256SUMS.sig" if ! command -v sha256sum >/dev/null 2>&1; then die "'sha256sum' is required to verify release downloads" @@ -552,8 +599,27 @@ fetch_release_binary() { || die "Failed to download ${_fr_bin_url}" download_file "$_fr_sums_url" "${TMP_DOWNLOAD_DIR}/SHA256SUMS" \ || die "Failed to download ${_fr_sums_url}" + download_file "$_fr_sig_url" "${TMP_DOWNLOAD_DIR}/SHA256SUMS.sig" \ + || die "Failed to download ${_fr_sig_url}" + + if [ -x "$TEGRAD_BIN" ]; then + # Verify Ed25519 signature and SHA-256 using the already-installed root-owned binary + "$TEGRAD_BIN" verify-update \ + --sums "${TMP_DOWNLOAD_DIR}/SHA256SUMS" \ + --sig "${TMP_DOWNLOAD_DIR}/SHA256SUMS.sig" \ + --binary "${TMP_DOWNLOAD_DIR}/${_fr_asset}" \ + --asset "${_fr_asset}" >/dev/null \ + || die "Release signature or SHA-256 verification failed for ${_fr_asset}" + log_info "Ed25519 signature and SHA-256 verified for ${_fr_asset}." + DOWNLOADED_BINARY="${TMP_DOWNLOAD_DIR}/${_fr_asset}" + return 0 + fi - # TODO(signature): verify cryptographic signature of SHA256SUMS before trusting the checksum. + # Fresh install: verify Ed25519 signature of SHA256SUMS with OpenSSL BEFORE trusting checksums or running binary + verify_sha256sums_signature \ + "${TMP_DOWNLOAD_DIR}/SHA256SUMS" \ + "${TMP_DOWNLOAD_DIR}/SHA256SUMS.sig" \ + "${TMP_DOWNLOAD_DIR}" _fr_expected="" while IFS= read -r _fr_line || [ -n "$_fr_line" ]; do @@ -579,7 +645,16 @@ fetch_release_binary() { die "SHA-256 mismatch for ${_fr_asset} (expected ${_fr_expected}, got ${_fr_actual})" fi - log_info "SHA-256 verified for ${_fr_asset}." + # Only execute the downloaded binary after cryptographic signature and SHA-256 have passed + chmod 0755 "${TMP_DOWNLOAD_DIR}/${_fr_asset}" + "${TMP_DOWNLOAD_DIR}/${_fr_asset}" verify-update \ + --sums "${TMP_DOWNLOAD_DIR}/SHA256SUMS" \ + --sig "${TMP_DOWNLOAD_DIR}/SHA256SUMS.sig" \ + --binary "${TMP_DOWNLOAD_DIR}/${_fr_asset}" \ + --asset "${_fr_asset}" >/dev/null \ + || die "Downloaded binary failed verify-update self-check" + + log_info "Ed25519 signature and SHA-256 verified for ${_fr_asset}." DOWNLOADED_BINARY="${TMP_DOWNLOAD_DIR}/${_fr_asset}" } @@ -590,6 +665,7 @@ render_template_file() { _rt_tmp="${_rt_dst}.tmp.$$" sed \ + -e "s|@TEGRAD_BIN_DIR@|${TEGRAD_BIN_DIR}|g" \ -e "s|@TEGRAD_BIN@|${TEGRAD_BIN}|g" \ -e "s|@TEGRAD_STATE_DIR@|${TEGRAD_STATE_DIR}|g" \ -e "s|@TEGRAD_SERVERS_DIR@|${TEGRAD_SERVERS_DIR}|g" \ @@ -651,6 +727,7 @@ ensure_users_and_groups() { ensure_directories() { install -d -o root -g root -m 0755 "$TEGRAD_BIN_DIR" install -d -o "$TEGRAD_USER" -g "$TEGRAD_GROUP" -m 0700 "$TEGRAD_STATE_DIR" + install -d -o "$TEGRAD_USER" -g "$TEGRAD_GROUP" -m 0700 "${TEGRAD_STATE_DIR}/update" install -d -o "$TEGRAD_SRV_USER" -g "$TEGRAD_SRV_GROUP" -m 2770 "$TEGRAD_SERVERS_DIR" chmod 2770 "$TEGRAD_SERVERS_DIR" install -d -o root -g root -m 0755 "$DROPIN_DIR" @@ -711,6 +788,8 @@ do_uninstall() { fi log_info "Stopping tegrad services..." + systemctl disable --now tegrad-update.path >/dev/null 2>&1 || true + systemctl stop tegrad-update.service >/dev/null 2>&1 || true systemctl disable --now tegrad.service >/dev/null 2>&1 || true # Stop any running server template instances @@ -723,13 +802,16 @@ do_uninstall() { rm -f -- \ "${SYSTEMD_DIR}/tegrad.service" \ + "${SYSTEMD_DIR}/tegrad-update.path" \ + "${SYSTEMD_DIR}/tegrad-update.service" \ "${SYSTEMD_DIR}/tegrad-server@.service" \ "${SYSTEMD_DIR}/tegrad-server@.socket" \ "${DROPIN_FILE}" \ "${POLKIT_RULE_FILE}" \ "${TMPFILES_FILE}" \ "${TEGRAD_WRAPPER}" \ - "${TEGRAD_BIN}" + "${TEGRAD_BIN}" \ + "${TEGRAD_BIN}.prev" rmdir "$DROPIN_DIR" 2>/dev/null || true rmdir "$TEGRAD_BIN_DIR" 2>/dev/null || true @@ -877,6 +959,8 @@ main() { SCRIPT_DIR=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd) for _req_file in \ "${SCRIPT_DIR}/units/tegrad.service" \ + "${SCRIPT_DIR}/units/tegrad-update.path" \ + "${SCRIPT_DIR}/units/tegrad-update.service" \ "${SCRIPT_DIR}/units/tegrad-server@.service" \ "${SCRIPT_DIR}/units/tegrad-server@.socket" \ "${SCRIPT_DIR}/tmpfiles/tegrad.conf" \ @@ -913,6 +997,8 @@ main() { log_info "Installing systemd units, tmpfiles.d, and polkit rule..." render_template_file "${SCRIPT_DIR}/units/tegrad.service" "${SYSTEMD_DIR}/tegrad.service" 0644 + render_template_file "${SCRIPT_DIR}/units/tegrad-update.path" "${SYSTEMD_DIR}/tegrad-update.path" 0644 + render_template_file "${SCRIPT_DIR}/units/tegrad-update.service" "${SYSTEMD_DIR}/tegrad-update.service" 0644 render_template_file "${SCRIPT_DIR}/units/tegrad-server@.service" "${SYSTEMD_DIR}/tegrad-server@.service" 0644 render_template_file "${SCRIPT_DIR}/units/tegrad-server@.socket" "${SYSTEMD_DIR}/tegrad-server@.socket" 0644 render_template_file "${SCRIPT_DIR}/tmpfiles/tegrad.conf" "${TMPFILES_FILE}" 0644 @@ -932,9 +1018,10 @@ main() { chmod 0644 "$_dropin_tmp" mv -f "$_dropin_tmp" "$DROPIN_FILE" - log_info "Reloading systemd and starting tegrad.service..." + log_info "Reloading systemd and starting tegrad.service and tegrad-update.path..." systemctl daemon-reload systemctl enable --now tegrad.service + systemctl enable --now tegrad-update.path log_info "Pronto. Agora, para vincular este servidor, rode \`tegrad link\`." } diff --git a/install/units/tegrad-update.path b/install/units/tegrad-update.path new file mode 100644 index 0000000..1677480 --- /dev/null +++ b/install/units/tegrad-update.path @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: AGPL-3.0-only +# Copyright (C) 2026 Antônio Miranda + +[Unit] +Description=Tegra Agent Staged Update Watcher + +[Path] +PathExists=@TEGRAD_STATE_DIR@/update/ready.json +Unit=tegrad-update.service + +[Install] +WantedBy=multi-user.target diff --git a/install/units/tegrad-update.service b/install/units/tegrad-update.service new file mode 100644 index 0000000..43be146 --- /dev/null +++ b/install/units/tegrad-update.service @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: AGPL-3.0-only +# Copyright (C) 2026 Antônio Miranda + +[Unit] +Description=Tegra Agent Signed Update Applicator + +[Service] +Type=oneshot +User=root +Group=root +ExecStart=@TEGRAD_BIN@ apply-update +Environment=TEGRAD_STATE_DIR=@TEGRAD_STATE_DIR@ + +# Sandbox: privileged only to copy/verify/replace @TEGRAD_BIN@ and restart tegrad.service. +NoNewPrivileges=yes +ProtectSystem=strict +ReadWritePaths=@TEGRAD_BIN_DIR@ @TEGRAD_STATE_DIR@/update +ProtectHome=yes +PrivateTmp=yes +PrivateDevices=yes +ProtectKernelTunables=yes +ProtectKernelModules=yes +ProtectControlGroups=yes +RestrictNamespaces=yes +LockPersonality=yes +RestrictAddressFamilies=AF_UNIX +SystemCallArchitectures=native +UMask=0022 diff --git a/scripts/sign-release.ts b/scripts/sign-release.ts new file mode 100644 index 0000000..0f8380c --- /dev/null +++ b/scripts/sign-release.ts @@ -0,0 +1,199 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { existsSync } from "node:fs"; +import { join, resolve } from "node:path"; +import { writeFileAtomic } from "../src/agent/state"; +import { ready } from "../src/crypto"; +import { + computeFileSha256, + formatSha256Sums, + MANIFEST_SCHEMA_VERSION, + parseReleaseSigningKey, + parseReleaseTag, + RELEASE_ASSET_NAMES, + signManifest, + signSha256Sums, + type UnsignedReleaseManifest, +} from "../src/update"; + +export interface SignReleaseCliArgs { + readonly tag: string; + readonly assetsDir: string; + readonly baseUrl: string; + readonly outDir: string; + readonly publishedAt: number; +} + +export interface SignReleaseResult { + readonly channel: "stable" | "beta" | "nightly"; + readonly tag: string; + readonly version: string; + readonly sumsPath: string; + readonly sigPath: string; + readonly manifestPath: string; +} + +export function parseSignReleaseArgs( + argv: readonly string[], + now: number = Date.now(), +): SignReleaseCliArgs { + let tag: string | undefined; + let assetsDir: string | undefined; + let baseUrl: string | undefined; + let outDir: string | undefined; + let publishedAt: number | undefined; + + for (let i = 0; i < argv.length; i++) { + const flag = argv[i]; + const value = argv[i + 1]; + if (flag === "--tag") { + if (value === undefined) throw new Error("--tag requires a value"); + tag = value; + i++; + } else if (flag === "--assets-dir") { + if (value === undefined) throw new Error("--assets-dir requires a value"); + assetsDir = value; + i++; + } else if (flag === "--base-url") { + if (value === undefined) throw new Error("--base-url requires a value"); + baseUrl = value; + i++; + } else if (flag === "--out-dir") { + if (value === undefined) throw new Error("--out-dir requires a value"); + outDir = value; + i++; + } else if (flag === "--published-at") { + if (value === undefined) throw new Error("--published-at requires an integer timestamp (ms)"); + const parsed = Number(value); + if (!Number.isSafeInteger(parsed) || parsed < 0) { + throw new Error(`Invalid --published-at timestamp: "${value}"`); + } + publishedAt = parsed; + i++; + } else { + throw new Error(`Unknown argument: ${String(flag)}`); + } + } + + if (tag === undefined || assetsDir === undefined || baseUrl === undefined) { + throw new Error( + "Usage: bun scripts/sign-release.ts --tag --assets-dir --base-url [--out-dir ] [--published-at ]", + ); + } + + let parsedBaseUrl: URL; + try { + parsedBaseUrl = new URL(baseUrl); + } catch { + throw new Error(`Invalid --base-url: "${baseUrl}"`); + } + if (parsedBaseUrl.protocol !== "https:") { + throw new Error(`--base-url must use https:// (got ${parsedBaseUrl.protocol})`); + } + if (parsedBaseUrl.username.length > 0 || parsedBaseUrl.password.length > 0) { + throw new Error("--base-url must not contain embedded credentials"); + } + + const resolvedAssetsDir = resolve(assetsDir); + return { + tag, + assetsDir: resolvedAssetsDir, + baseUrl: parsedBaseUrl.toString().replace(/\/+$/, ""), + outDir: outDir !== undefined ? resolve(outDir) : resolvedAssetsDir, + publishedAt: publishedAt ?? now, + }; +} + +export async function runSignRelease( + argv: readonly string[], + env: Readonly> = process.env, + now: number = Date.now(), +): Promise { + await ready(); + + const args = parseSignReleaseArgs(argv, now); + const parsedTag = parseReleaseTag(args.tag); + + const rawKey = env.RELEASE_SIGNING_KEY; + if (rawKey === undefined || rawKey.trim().length === 0) { + throw new Error("RELEASE_SIGNING_KEY environment variable is required"); + } + const keyPair = parseReleaseSigningKey(rawKey); + + const x64Name = RELEASE_ASSET_NAMES["linux-x64"]; + const arm64Name = RELEASE_ASSET_NAMES["linux-arm64"]; + const x64Path = join(args.assetsDir, x64Name); + const arm64Path = join(args.assetsDir, arm64Name); + + if (!existsSync(x64Path)) { + throw new Error(`Missing release asset: ${x64Path}`); + } + if (!existsSync(arm64Path)) { + throw new Error(`Missing release asset: ${arm64Path}`); + } + + const [x64Digest, arm64Digest] = await Promise.all([ + computeFileSha256(x64Path), + computeFileSha256(arm64Path), + ]); + + const sumsContent = formatSha256Sums([ + { sha256: x64Digest.sha256, filename: x64Name }, + { sha256: arm64Digest.sha256, filename: arm64Name }, + ]); + const sumsSig = signSha256Sums(sumsContent, keyPair.secretKey); + + const unsignedManifest: UnsignedReleaseManifest = { + v: MANIFEST_SCHEMA_VERSION, + channel: parsedTag.channel, + version: parsedTag.raw, + tag: parsedTag.tag, + published_at: args.publishedAt, + assets: { + "linux-x64": { + url: `${args.baseUrl}/${x64Name}`, + sha256: x64Digest.sha256, + size: x64Digest.size, + }, + "linux-arm64": { + url: `${args.baseUrl}/${arm64Name}`, + sha256: arm64Digest.sha256, + size: arm64Digest.size, + }, + }, + }; + const signedManifest = signManifest(unsignedManifest, keyPair.secretKey); + + const sumsPath = join(args.outDir, "SHA256SUMS"); + const sigPath = join(args.outDir, "SHA256SUMS.sig"); + const manifestPath = join(args.outDir, `${parsedTag.channel}.json`); + + writeFileAtomic(sumsPath, sumsContent, { mode: 0o644, dirMode: 0o755 }); + writeFileAtomic(sigPath, `${sumsSig}\n`, { mode: 0o644, dirMode: 0o755 }); + writeFileAtomic(manifestPath, `${JSON.stringify(signedManifest, null, 2)}\n`, { + mode: 0o644, + dirMode: 0o755, + }); + + return { + channel: parsedTag.channel, + tag: parsedTag.tag, + version: parsedTag.raw, + sumsPath, + sigPath, + manifestPath, + }; +} + +if (import.meta.main) { + try { + const result = await runSignRelease(process.argv.slice(2)); + process.stdout.write( + `Signed ${result.tag} (${result.channel}):\n ${result.sumsPath}\n ${result.sigPath}\n ${result.manifestPath}\n`, + ); + } catch (err) { + process.stderr.write(`Error: ${err instanceof Error ? err.message : String(err)}\n`); + process.exit(1); + } +} diff --git a/src/agent/paths.ts b/src/agent/paths.ts index 49b8f91..a7d786e 100644 --- a/src/agent/paths.ts +++ b/src/agent/paths.ts @@ -18,6 +18,7 @@ export interface StatePaths { readonly trustPath: string; readonly revocationsPath: string; readonly replayPath: string; + readonly updateDir: string; } export function resolveStateDir( @@ -48,5 +49,6 @@ export function getStatePaths(stateDir: string): StatePaths { trustPath: join(stateDir, "trust.json"), revocationsPath: join(stateDir, "revocations.json"), replayPath: join(stateDir, "replay.json"), + updateDir: join(stateDir, "update"), }; } diff --git a/src/agent/state.ts b/src/agent/state.ts index e51da55..630be5f 100644 --- a/src/agent/state.ts +++ b/src/agent/state.ts @@ -56,14 +56,30 @@ const envFlagsSchema = z.object({ TEGRAD_ALLOW_INSECURE: z.string().optional(), }); +const rawUpdateConfigSchema = z + .object({ + channel: z.enum(["stable", "beta", "nightly"]).optional(), + auto: z.boolean().optional(), + manifest_base_url: z.string().min(1).optional(), + }) + .strict(); + const rawConfigSchema = z.object({ api_url: z.string().min(1), link_url: z.string().min(1).optional(), + update: rawUpdateConfigSchema.optional(), }); +export interface AgentUpdateConfig { + readonly channel?: "stable" | "beta" | "nightly"; + readonly auto?: boolean; + readonly manifestBaseUrl?: string; +} + export interface AgentConfig { readonly apiUrl: string; readonly linkUrl?: string; + readonly update?: AgentUpdateConfig; } const identityFileSchema = z.object({ @@ -261,6 +277,31 @@ export function validateLinkUrl(linkUrl: string): string { return parsed.toString(); } +export function validateManifestBaseUrl(manifestBaseUrl: string): string { + let parsed: URL; + try { + parsed = new URL(manifestBaseUrl); + } catch { + throw new StateError(`Invalid update.manifest_base_url: "${manifestBaseUrl}"`); + } + + if (parsed.username || parsed.password) { + throw new StateError("update.manifest_base_url must not contain embedded credentials"); + } + + if (parsed.protocol !== "https:") { + throw new StateError( + `update.manifest_base_url must use https:// (got ${parsed.protocol}//${parsed.host})`, + ); + } + + if (parsed.hash.length > 0) { + throw new StateError("update.manifest_base_url must not contain a URL fragment"); + } + + return parsed.toString(); +} + export interface LoadConfigOptions { readonly allowInsecure?: boolean; readonly env?: Readonly>; @@ -282,9 +323,22 @@ export function loadConfig(stateDir: string, options: LoadConfigOptions = {}): A const apiUrl = validateApiUrl(parsed.data.api_url, allowInsecure); const linkUrl = parsed.data.link_url !== undefined ? validateLinkUrl(parsed.data.link_url) : undefined; + let update: AgentUpdateConfig | undefined; + if (parsed.data.update !== undefined) { + const manifestBaseUrl = + parsed.data.update.manifest_base_url !== undefined + ? validateManifestBaseUrl(parsed.data.update.manifest_base_url) + : undefined; + update = { + ...(parsed.data.update.channel !== undefined ? { channel: parsed.data.update.channel } : {}), + ...(parsed.data.update.auto !== undefined ? { auto: parsed.data.update.auto } : {}), + ...(manifestBaseUrl !== undefined ? { manifestBaseUrl } : {}), + }; + } return { apiUrl, ...(linkUrl !== undefined ? { linkUrl } : {}), + ...(update !== undefined ? { update } : {}), }; } diff --git a/src/cli/args.ts b/src/cli/args.ts index 23d051b..be8bf1c 100644 --- a/src/cli/args.ts +++ b/src/cli/args.ts @@ -8,12 +8,27 @@ export interface LinkCliOptions { readonly allowUnverified: boolean; } +export interface VerifyUpdateCliOptions { + readonly binary: string; + readonly manifest?: string; + readonly sums?: string; + readonly sig?: string; + readonly asset?: string; + readonly channel?: "stable" | "beta" | "nightly"; +} + +export interface ApplyUpdateCliOptions { + readonly allowDowngrade: boolean; +} + export type ParsedCliCommand = | { readonly kind: "run" } | { readonly kind: "status" } | { readonly kind: "identity" } | { readonly kind: "doctor" } | { readonly kind: "link"; readonly options: LinkCliOptions } + | { readonly kind: "verify-update"; readonly options: VerifyUpdateCliOptions } + | { readonly kind: "apply-update"; readonly options: ApplyUpdateCliOptions } | { readonly kind: "version" } | { readonly kind: "help" } | { readonly kind: "unknown"; readonly token: string }; @@ -75,6 +90,84 @@ export function parseCliArgs(argv: readonly string[]): ParsedCliCommand { }; } + if (first === "verify-update") { + let binary: string | undefined; + let manifest: string | undefined; + let sums: string | undefined; + let sig: string | undefined; + let asset: string | undefined; + let channel: "stable" | "beta" | "nightly" | undefined; + + for (let i = 1; i < argv.length; i++) { + const flag = argv[i]; + const next = argv[i + 1]; + if (flag === "--binary" && next !== undefined) { + binary = next; + i++; + } else if (flag === "--manifest" && next !== undefined) { + manifest = next; + i++; + } else if (flag === "--sums" && next !== undefined) { + sums = next; + i++; + } else if (flag === "--sig" && next !== undefined) { + sig = next; + i++; + } else if (flag === "--asset" && next !== undefined) { + asset = next; + i++; + } else if ( + flag === "--channel" && + (next === "stable" || next === "beta" || next === "nightly") + ) { + channel = next; + i++; + } else { + return { kind: "unknown", token: argv.join(" ") }; + } + } + + const hasManifest = manifest !== undefined; + const hasSums = sums !== undefined || sig !== undefined; + if (binary === undefined) { + return { kind: "unknown", token: argv.join(" ") }; + } + if (hasManifest && hasSums) { + return { kind: "unknown", token: argv.join(" ") }; + } + if (!hasManifest && (sums === undefined || sig === undefined)) { + return { kind: "unknown", token: argv.join(" ") }; + } + + return { + kind: "verify-update", + options: { + binary, + ...(manifest !== undefined ? { manifest } : {}), + ...(sums !== undefined ? { sums } : {}), + ...(sig !== undefined ? { sig } : {}), + ...(asset !== undefined ? { asset } : {}), + ...(channel !== undefined ? { channel } : {}), + }, + }; + } + + if (first === "apply-update") { + let allowDowngrade = false; + for (let i = 1; i < argv.length; i++) { + const flag = argv[i]; + if (flag === "--allow-downgrade") { + allowDowngrade = true; + } else { + return { kind: "unknown", token: argv.join(" ") }; + } + } + return { + kind: "apply-update", + options: { allowDowngrade }, + }; + } + return { kind: "unknown", token: argv.join(" ") }; } @@ -85,11 +178,13 @@ export function formatUsage(versionLineText: string): string { "Usage: tegrad ", "", "Commands:", - " run Connect to the control server and process commands", - " link Pair this agent with a Tegra account (--add, --reset, --yes, --allow-unverified)", - " status Show local state directory, identity, config, and trust status", - " identity Create the agent identity if missing and print its fingerprint", - " doctor Check Linux installation, permissions, units, polkit, and network isolation", + " run Connect to the control server and process commands", + " link Pair this agent with a Tegra account (--add, --reset, --yes, --allow-unverified)", + " status Show local state directory, identity, config, and trust status", + " identity Create the agent identity if missing and print its fingerprint", + " doctor Check Linux installation, permissions, units, polkit, and network isolation", + " verify-update Verify a signed release manifest or SHA256SUMS against a binary", + " apply-update Verify and atomically apply a staged update with health check and rollback", "", "Options:", " -v, --version Print version and exit", diff --git a/src/cli/doctor.test.ts b/src/cli/doctor.test.ts index ec2d027..49e3988 100644 --- a/src/cli/doctor.test.ts +++ b/src/cli/doctor.test.ts @@ -28,6 +28,8 @@ function makeHealthyLinuxOptions(overrides: Partial = {}): { statePaths.identityPath, statePaths.configPath, DEFAULT_DOCTOR_PATHS.tegradServicePath, + DEFAULT_DOCTOR_PATHS.updatePathUnitPath, + DEFAULT_DOCTOR_PATHS.updateServiceUnitPath, DEFAULT_DOCTOR_PATHS.serverServicePath, DEFAULT_DOCTOR_PATHS.serverSocketPath, DEFAULT_DOCTOR_PATHS.tmpfilesPath, @@ -168,4 +170,16 @@ describe("tegrad doctor", () => { expect(code).toBe(1); expect(getOutput()).toContain("FALHA systemd_service:"); }); + + test("fails when tegrad-update.path or tegrad-update.service is missing", async () => { + const { options, getOutput } = makeHealthyLinuxOptions({ + exists: (p) => + p !== DEFAULT_DOCTOR_PATHS.updatePathUnitPath && + p !== DEFAULT_DOCTOR_PATHS.updateServiceUnitPath, + }); + const code = await runDoctor(options); + expect(code).toBe(1); + expect(getOutput()).toContain("FALHA unit_update_path:"); + expect(getOutput()).toContain("FALHA unit_update_service:"); + }); }); diff --git a/src/cli/doctor.ts b/src/cli/doctor.ts index c862577..8243d66 100644 --- a/src/cli/doctor.ts +++ b/src/cli/doctor.ts @@ -15,6 +15,8 @@ export interface DoctorPaths { readonly passwdPath: string; readonly groupPath: string; readonly tegradServicePath: string; + readonly updatePathUnitPath: string; + readonly updateServiceUnitPath: string; readonly serverServicePath: string; readonly serverSocketPath: string; readonly tmpfilesPath: string; @@ -26,6 +28,8 @@ export const DEFAULT_DOCTOR_PATHS: DoctorPaths = { passwdPath: "/etc/passwd", groupPath: "/etc/group", tegradServicePath: "/etc/systemd/system/tegrad.service", + updatePathUnitPath: "/etc/systemd/system/tegrad-update.path", + updateServiceUnitPath: "/etc/systemd/system/tegrad-update.service", serverServicePath: "/etc/systemd/system/tegrad-server@.service", serverSocketPath: "/etc/systemd/system/tegrad-server@.socket", tmpfilesPath: "/etc/tmpfiles.d/tegrad.conf", @@ -284,6 +288,8 @@ export async function runDoctor(options: DoctorOptions = {}): Promise { // 4. Units and tmpfiles exist const requiredFiles: readonly { readonly label: string; readonly path: string }[] = [ { label: "unit_tegrad", path: paths.tegradServicePath }, + { label: "unit_update_path", path: paths.updatePathUnitPath }, + { label: "unit_update_service", path: paths.updateServiceUnitPath }, { label: "unit_server_service", path: paths.serverServicePath }, { label: "unit_server_socket", path: paths.serverSocketPath }, { label: "tmpfiles", path: paths.tmpfilesPath }, diff --git a/src/cli/main.ts b/src/cli/main.ts index 3446901..47559bc 100644 --- a/src/cli/main.ts +++ b/src/cli/main.ts @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import { existsSync } from "node:fs"; +import { existsSync, readFileSync } from "node:fs"; import { type FetchLike, getStatePaths, @@ -15,6 +15,12 @@ import { runPairingFlow, } from "../agent"; import { fingerprint } from "../crypto"; +import { + type ApplyUpdateOptions, + applyStagedUpdate, + type VerifyReleaseBinaryOptions, + verifyReleaseBinary, +} from "../update"; import { versionLine } from "../version"; import { formatUsage, parseCliArgs } from "./args"; import { type DoctorOptions, runDoctor } from "./doctor"; @@ -26,6 +32,8 @@ export interface CliDependencies { readonly stderr?: (text: string) => void; readonly geteuid?: () => number; readonly doctorOptions?: Omit; + readonly verifyUpdateOptions?: Pick; + readonly applyUpdateOptions?: Omit; readonly runAgent?: ( stateDir: string, env: Readonly>, @@ -138,6 +146,56 @@ export async function runCli(argv: readonly string[], deps: CliDependencies = {} } } + case "verify-update": { + try { + const opts = parsed.options; + const manifestContent = + opts.manifest !== undefined ? readFileSync(opts.manifest, "utf8") : undefined; + const sha256SumsContent = + opts.sums !== undefined ? readFileSync(opts.sums, "utf8") : undefined; + const sha256SumsSig = opts.sig !== undefined ? readFileSync(opts.sig, "utf8") : undefined; + + const result = await verifyReleaseBinary({ + binaryPath: opts.binary, + ...(manifestContent !== undefined ? { manifestContent } : {}), + ...(sha256SumsContent !== undefined ? { sha256SumsContent } : {}), + ...(sha256SumsSig !== undefined ? { sha256SumsSig } : {}), + ...(opts.asset !== undefined ? { expectedAssetName: opts.asset } : {}), + ...(opts.channel !== undefined ? { expectedChannel: opts.channel } : {}), + ...(deps.verifyUpdateOptions ?? {}), + }); + + if (result.mode === "manifest") { + stdout(`Verified ${result.manifest.tag} (${result.arch}) sha256=${result.sha256}\n`); + } else { + stdout(`Verified ${result.assetName} sha256=${result.sha256}\n`); + } + return 0; + } catch (err) { + stderr(`${err instanceof Error ? err.message : String(err)}\n`); + return 1; + } + } + + case "apply-update": { + try { + const stateDir = resolveStateDir(env); + const { updateDir } = getStatePaths(stateDir); + const result = await applyStagedUpdate({ + updateDir, + ...(deps.applyUpdateOptions ?? {}), + allowDowngrade: parsed.options.allowDowngrade, + }); + stdout( + `Applied ${result.tag} (${result.arch}) sha256=${result.sha256} -> ${result.binPath}\n`, + ); + return 0; + } catch (err) { + stderr(`${err instanceof Error ? err.message : String(err)}\n`); + return 1; + } + } + case "run": { try { assertNotRoot(env, deps.geteuid); diff --git a/src/install/units.test.ts b/src/install/units.test.ts index e17918e..767fd60 100644 --- a/src/install/units.test.ts +++ b/src/install/units.test.ts @@ -2,8 +2,17 @@ // Copyright (C) 2026 Antônio Miranda import { describe, expect, test } from "bun:test"; -import { existsSync, readFileSync } from "node:fs"; +import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; import { join, resolve } from "node:path"; +import { ready, signingKeyPairFromSeed, toBase64Url } from "../crypto"; +import { + computeBytesSha256, + ed25519PublicKeyFromPem, + formatSha256Sums, + getReleasePublicKey, + signSha256Sums, +} from "../update"; import { isPrivateOrLoopbackIp, NETWORK_DENY_RANGES, @@ -254,6 +263,57 @@ describe("Security regression checks on install/ assets", () => { expect(directives.get("SystemCallArchitectures")).toEqual(["native"]); expect(directives.get("UMask")).toEqual(["0077"]); expect(directives.get("RestrictAddressFamilies")?.[0]).toContain("AF_UNIX"); + + // tegrad.service must NEVER have write access to /opt/tegrad/bin or @TEGRAD_BIN_DIR@ + const rwTokens = (directives.get("ReadWritePaths") ?? []) + .flatMap((line) => line.split(/\s+/)) + .filter((t) => t.length > 0); + for (const token of rwTokens) { + const rendered = token + .replaceAll("@TEGRAD_BIN_DIR@", "/opt/tegrad/bin") + .replaceAll("@TEGRAD_BIN@", "/opt/tegrad/bin/tegrad") + .replaceAll("@TEGRAD_STATE_DIR@", "/var/lib/tegrad") + .replaceAll("@TEGRAD_SERVERS_DIR@", "/var/lib/tegrad-servers") + .replaceAll("@TEGRAD_RUN_DIR@", "/run/tegrad-server"); + expect(rendered).not.toBe("/opt/tegrad"); + expect(rendered).not.toBe("/opt/tegrad/bin"); + expect(rendered.startsWith("/opt/tegrad/")).toBe(false); + } + }); + + test("tegrad-update.path and tegrad-update.service enforce strict sandboxing and confined ExecStart", () => { + const pathContent = readInstallFile("units/tegrad-update.path"); + const pathDirectives = parseIniDirectives(pathContent); + expect(pathDirectives.get("PathExists")).toEqual(["@TEGRAD_STATE_DIR@/update/ready.json"]); + expect(pathDirectives.get("Unit")).toEqual(["tegrad-update.service"]); + expect(pathDirectives.get("WantedBy")).toEqual(["multi-user.target"]); + + const serviceContent = readInstallFile("units/tegrad-update.service"); + const directives = parseIniDirectives(serviceContent); + + expect(directives.get("Type")).toEqual(["oneshot"]); + expect(directives.get("User")).toEqual(["root"]); + expect(directives.get("Group")).toEqual(["root"]); + expect(directives.get("ExecStart")).toEqual(["@TEGRAD_BIN@ apply-update"]); + expect(directives.get("NoNewPrivileges")).toEqual(["yes"]); + expect(directives.get("ProtectSystem")).toEqual(["strict"]); + expect(directives.get("ProtectHome")).toEqual(["yes"]); + expect(directives.get("PrivateTmp")).toEqual(["yes"]); + expect(directives.get("PrivateDevices")).toEqual(["yes"]); + expect(directives.get("ProtectKernelTunables")).toEqual(["yes"]); + expect(directives.get("ProtectKernelModules")).toEqual(["yes"]); + expect(directives.get("ProtectControlGroups")).toEqual(["yes"]); + expect(directives.get("RestrictNamespaces")).toEqual(["yes"]); + expect(directives.get("LockPersonality")).toEqual(["yes"]); + expect(directives.get("SystemCallArchitectures")).toEqual(["native"]); + expect(directives.get("RestrictAddressFamilies")).toEqual(["AF_UNIX"]); + expect(directives.get("UMask")).toEqual(["0022"]); + + // ReadWritePaths must be strictly confined to @TEGRAD_BIN_DIR@ and @TEGRAD_STATE_DIR@/update + const rwTokens = (directives.get("ReadWritePaths") ?? []) + .flatMap((line) => line.split(/\s+/)) + .filter((t) => t.length > 0); + expect(rwTokens).toEqual(["@TEGRAD_BIN_DIR@", "@TEGRAD_STATE_DIR@/update"]); }); test("tegrad-server@.service isolates untrusted Minecraft servers without breaking JVM or networking", () => { @@ -324,13 +384,26 @@ describe("Security regression checks on install/ assets", () => { expect(rule).toContain("polkit.Result.NOT_HANDLED"); }); - test("install.sh avoids eval, guards every rm -rf with parameter-expansion :?, and uses set -eu", () => { + test("install.sh avoids eval, guards every rm -rf with parameter-expansion :?, uses set -eu, and verifies SHA256SUMS.sig", () => { const script = readInstallFile("install.sh"); const lines = script.split(/\r?\n/); expect(lines[0]).toBe("#!/bin/sh"); expect(script).toContain("set -eu"); - expect(script).toContain("TODO(signature)"); + expect(script).not.toContain("TODO(signature)"); + expect(script).toContain("SHA256SUMS.sig"); + expect(script).toContain("verify_sha256sums_signature"); + expect(script).toContain("verify-update"); + expect(script).toContain("tegrad-update.path"); + expect(script).toContain("tegrad-update.service"); + + // Embedded PEM key in install.sh must match RELEASE_PUBLIC_KEY_BASE64URL in src/update/release-key.ts + const pemMatch = /-----BEGIN PUBLIC KEY-----[\s\S]*?-----END PUBLIC KEY-----/.exec(script); + expect(pemMatch).not.toBeNull(); + if (pemMatch !== null) { + const shellPubKey = ed25519PublicKeyFromPem(pemMatch[0]); + expect(toBase64Url(shellPubKey)).toBe(toBase64Url(getReleasePublicKey())); + } for (const line of lines) { const stripped = line.trim(); @@ -345,4 +418,60 @@ describe("Security regression checks on install/ assets", () => { } } }); + + const shPath = findPosixSh(); + const hasOpenSsl = Bun.which("openssl") !== null; + const opensslInteropTest = shPath !== null && hasOpenSsl ? test : test.skip; + + opensslInteropTest( + "install.sh verify_sha256sums_signature verifies libsodium Ed25519 signatures and rejects tampering via OpenSSL", + async () => { + if (shPath === null) return; + await ready(); + const tmpDir = mkdtempSync(join(tmpdir(), "tegrad-install-sig-test-")); + try { + const keyPair = signingKeyPairFromSeed(new Uint8Array(32).fill(0x42)); + const sums = formatSha256Sums([ + { sha256: computeBytesSha256(new Uint8Array([1, 2, 3])), filename: "tegrad-linux-x64" }, + ]); + const sig = signSha256Sums(sums, keyPair.secretKey); + + const sumsPath = join(tmpDir, "SHA256SUMS"); + const sigPath = join(tmpDir, "SHA256SUMS.sig"); + writeFileSync(sumsPath, sums, "utf8"); + writeFileSync(sigPath, `${sig}\n`, "utf8"); + + const scriptPath = join(INSTALL_DIR, "install.sh").replace(/\\/g, "/"); + const runVerify = async (sPath: string, gPath: string) => { + const proc = Bun.spawn( + [ + shPath, + "-c", + 'TEGRAD_INSTALL_SOURCE_ONLY=1 . "$1" && verify_sha256sums_signature "$2" "$3" "$4"', + "--", + scriptPath, + sPath.replace(/\\/g, "/"), + gPath.replace(/\\/g, "/"), + tmpDir.replace(/\\/g, "/"), + ], + { stdin: "ignore", stdout: "pipe", stderr: "pipe" }, + ); + const [stderr, code] = await Promise.all([new Response(proc.stderr).text(), proc.exited]); + return { code, stderr }; + }; + + const validRes = await runVerify(sumsPath, sigPath); + expect(validRes.stderr).toBe(""); + expect(validRes.code).toBe(0); + + // Tamper 1 byte in SHA256SUMS -> must fail closed + const badSumsPath = join(tmpDir, "SHA256SUMS.bad"); + writeFileSync(badSumsPath, sums.replace("tegrad-linux-x64", "tegrad-linux-x65"), "utf8"); + const tamperedRes = await runVerify(badSumsPath, sigPath); + expect(tamperedRes.code).not.toBe(0); + } finally { + rmSync(tmpDir, { recursive: true, force: true }); + } + }, + ); }); diff --git a/src/update/apply.test.ts b/src/update/apply.test.ts new file mode 100644 index 0000000..bfa02f4 --- /dev/null +++ b/src/update/apply.test.ts @@ -0,0 +1,453 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeAll, describe, expect, test } from "bun:test"; +import { + existsSync, + mkdirSync, + mkdtempSync, + readFileSync, + rmSync, + symlinkSync, + writeFileSync, +} from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { runCli } from "../cli/main"; +import { generateSigningKeyPair, ready, signingKeyPairFromSeed } from "../crypto"; +import { + applyStagedUpdate, + computeBytesSha256, + MANIFEST_SCHEMA_VERSION, + READY_FILE_NAME, + STAGED_BINARY_NAME, + STAGED_MANIFEST_NAME, + signManifest, + type UnsignedReleaseManifest, + UpdateError, +} from "./index"; + +const TEST_RELEASE_SEED = new Uint8Array(32).fill(0x42); + +const tempDirs: string[] = []; + +function makeTempDir(): string { + const dir = mkdtempSync(join(tmpdir(), "tegrad-apply-test-")); + tempDirs.push(dir); + return dir; +} + +beforeAll(async () => { + await ready(); +}); + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +function stageFixture(params: { + readonly rootDir: string; + readonly currentBinaryBytes: Uint8Array; + readonly stagedBinaryBytes: Uint8Array; + readonly manifestVersion: string; + readonly signingSecretKey: Uint8Array; + readonly hashOverride?: string; +}): { + readonly binDir: string; + readonly binPath: string; + readonly prevBinPath: string; + readonly updateDir: string; +} { + const binDir = join(params.rootDir, "opt-bin"); + const updateDir = join(params.rootDir, "state-update"); + mkdirSync(binDir, { recursive: true }); + mkdirSync(updateDir, { recursive: true }); + + const binPath = join(binDir, "tegrad"); + const prevBinPath = join(binDir, "tegrad.prev"); + writeFileSync(binPath, params.currentBinaryBytes); + + const sha = params.hashOverride ?? computeBytesSha256(params.stagedBinaryBytes); + const unsigned: UnsignedReleaseManifest = { + v: MANIFEST_SCHEMA_VERSION, + channel: "stable", + version: params.manifestVersion, + tag: `v${params.manifestVersion}`, + published_at: 1_795_300_000_000, + assets: { + "linux-x64": { + url: `https://github.com/codebyant/tegrad/releases/download/v${params.manifestVersion}/tegrad-linux-x64`, + sha256: sha, + size: params.stagedBinaryBytes.byteLength, + }, + "linux-arm64": { + url: `https://github.com/codebyant/tegrad/releases/download/v${params.manifestVersion}/tegrad-linux-arm64`, + sha256: sha, + size: params.stagedBinaryBytes.byteLength, + }, + }, + }; + const signed = signManifest(unsigned, params.signingSecretKey); + + writeFileSync(join(updateDir, STAGED_BINARY_NAME), params.stagedBinaryBytes); + writeFileSync(join(updateDir, STAGED_MANIFEST_NAME), JSON.stringify(signed, null, 2), "utf8"); + writeFileSync( + join(updateDir, READY_FILE_NAME), + JSON.stringify({ + v: 1, + channel: "stable", + version: params.manifestVersion, + tag: `v${params.manifestVersion}`, + arch: "linux-x64", + sha256: sha, + size: params.stagedBinaryBytes.byteLength, + staged_at: 1_795_300_000_000, + }), + "utf8", + ); + + return { binDir, binPath, prevBinPath, updateDir }; +} + +describe("applyStagedUpdate (TOCTOU defense, verification, atomic install, rollback)", () => { + test("copies into root staging dir BEFORE verification, resists TOCTOU swap, installs atomically with tegrad.prev, and cleans staging", async () => { + const rootDir = makeTempDir(); + const keyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const oldBytes = new TextEncoder().encode("old-tegrad-v0.1.0"); + const newBytes = new TextEncoder().encode("new-tegrad-v0.2.0-verified"); + const evilSwapBytes = new TextEncoder().encode("EVIL-TOCTOU-SWAP-PAYLOAD!"); + + const fx = stageFixture({ + rootDir, + currentBinaryBytes: oldBytes, + stagedBinaryBytes: newBytes, + manifestVersion: "0.2.0", + signingSecretKey: keyPair.secretKey, + }); + + let verifiedRootBinaryPath = ""; + const calls: string[] = []; + + const result = await applyStagedUpdate({ + updateDir: fx.updateDir, + binPath: fx.binPath, + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + stabilizeMs: 0, + sleep: async () => {}, + afterCopyBeforeVerifyHook: ({ updateDir, rootBinaryPath }) => { + // Simulate compromised unprivileged 'tegrad' user swapping staged-tegrad + // right after the root applicator copied it into /opt/tegrad/bin/.staging-tmp-* + expect(rootBinaryPath.startsWith(fx.binDir)).toBe(true); + writeFileSync(join(updateDir, STAGED_BINARY_NAME), evilSwapBytes); + }, + verifyHook: (rootBinaryPath) => { + verifiedRootBinaryPath = rootBinaryPath; + }, + runCommand: async (command, args) => { + calls.push(`${command} ${args.join(" ")}`); + if (args[0] === "restart") { + return { code: 0, stdout: "", stderr: "" }; + } + if (args[0] === "is-active") { + return { code: 0, stdout: "active\n", stderr: "" }; + } + return { code: 1, stdout: "", stderr: "unexpected" }; + }, + }); + + expect(result.applied).toBe(true); + expect(result.version).toBe("0.2.0"); + expect(verifiedRootBinaryPath.startsWith(fx.binDir)).toBe(true); + + // Installed binary MUST be the verified newBytes, NEVER the TOCTOU-swapped evil payload + expect(Buffer.compare(readFileSync(fx.binPath), Buffer.from(newBytes))).toBe(0); + // Backup tegrad.prev contains old binary + expect(Buffer.compare(readFileSync(fx.prevBinPath), Buffer.from(oldBytes))).toBe(0); + // Staging files removed + expect(existsSync(join(fx.updateDir, READY_FILE_NAME))).toBe(false); + expect(existsSync(join(fx.updateDir, STAGED_BINARY_NAME))).toBe(false); + expect(existsSync(join(fx.updateDir, STAGED_MANIFEST_NAME))).toBe(false); + expect(calls).toEqual([ + "systemctl restart tegrad.service", + "systemctl is-active tegrad.service", + ]); + }); + + test("rejects tampered binary or untrusted signature without modifying installed binary and cleans up ready.json", async () => { + const rootDir = makeTempDir(); + const keyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const attacker = generateSigningKeyPair(); + const oldBytes = new TextEncoder().encode("old-tegrad-v0.1.0"); + const newBytes = new TextEncoder().encode("new-tegrad-v0.2.0"); + + // Case 1: attacker signature + const fx1 = stageFixture({ + rootDir, + currentBinaryBytes: oldBytes, + stagedBinaryBytes: newBytes, + manifestVersion: "0.2.0", + signingSecretKey: attacker.secretKey, + }); + + let restartCalled = false; + await expect( + applyStagedUpdate({ + updateDir: fx1.updateDir, + binPath: fx1.binPath, + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + runCommand: async () => { + restartCalled = true; + return { code: 0, stdout: "active\n", stderr: "" }; + }, + }), + ).rejects.toMatchObject({ code: "bad_manifest_signature" }); + + expect(restartCalled).toBe(false); + expect(Buffer.compare(readFileSync(fx1.binPath), Buffer.from(oldBytes))).toBe(0); + expect(existsSync(join(fx1.updateDir, READY_FILE_NAME))).toBe(false); + + // Case 2: valid signature, tampered staged binary bytes + const rootDir2 = makeTempDir(); + const fx2 = stageFixture({ + rootDir: rootDir2, + currentBinaryBytes: oldBytes, + stagedBinaryBytes: newBytes, + manifestVersion: "0.2.0", + signingSecretKey: keyPair.secretKey, + }); + writeFileSync( + join(fx2.updateDir, STAGED_BINARY_NAME), + new TextEncoder().encode("new-tegrad-v0.2.X"), + ); + + await expect( + applyStagedUpdate({ + updateDir: fx2.updateDir, + binPath: fx2.binPath, + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), + }), + ).rejects.toMatchObject({ code: "hash_mismatch" }); + + expect(Buffer.compare(readFileSync(fx2.binPath), Buffer.from(oldBytes))).toBe(0); + expect(existsSync(join(fx2.updateDir, READY_FILE_NAME))).toBe(false); + }); + + test("rejects downgrade unless explicitly authorized via allowDowngrade", async () => { + const rootDir = makeTempDir(); + const keyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const oldBytes = new TextEncoder().encode("current-v0.3.0"); + const olderBytes = new TextEncoder().encode("older-v0.2.0"); + + const fx = stageFixture({ + rootDir, + currentBinaryBytes: oldBytes, + stagedBinaryBytes: olderBytes, + manifestVersion: "0.2.0", + signingSecretKey: keyPair.secretKey, + }); + + await expect( + applyStagedUpdate({ + updateDir: fx.updateDir, + binPath: fx.binPath, + currentVersion: "0.3.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), + }), + ).rejects.toMatchObject({ code: "downgrade_blocked" }); + + expect(Buffer.compare(readFileSync(fx.binPath), Buffer.from(oldBytes))).toBe(0); + }); + + test("rolls back automatically to tegrad.prev when systemctl restart fails or service fails health check", async () => { + const rootDir = makeTempDir(); + const keyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const oldBytes = new TextEncoder().encode("healthy-v0.1.0"); + const brokenBytes = new TextEncoder().encode("crashing-v0.2.0"); + + // Case 1: systemctl restart fails + const fx1 = stageFixture({ + rootDir, + currentBinaryBytes: oldBytes, + stagedBinaryBytes: brokenBytes, + manifestVersion: "0.2.0", + signingSecretKey: keyPair.secretKey, + }); + + const restartLog1: string[] = []; + let restartAttempts1 = 0; + await expect( + applyStagedUpdate({ + updateDir: fx1.updateDir, + binPath: fx1.binPath, + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + sleep: async () => {}, + runCommand: async (cmd, args) => { + restartLog1.push(`${cmd} ${args.join(" ")}`); + if (args[0] === "restart") { + restartAttempts1++; + if (restartAttempts1 === 1) { + return { code: 1, stdout: "", stderr: "Job failed" }; + } + return { code: 0, stdout: "", stderr: "" }; + } + return { code: 0, stdout: "active\n", stderr: "" }; + }, + }), + ).rejects.toMatchObject({ code: "health_check_failed" }); + + // Binary was restored to oldBytes and service restarted again + expect(Buffer.compare(readFileSync(fx1.binPath), Buffer.from(oldBytes))).toBe(0); + expect(restartLog1).toEqual([ + "systemctl restart tegrad.service", + "systemctl restart tegrad.service", + ]); + + // Case 2: restart succeeds, first is-active is active, then crashes during stabilization check + const rootDir2 = makeTempDir(); + const fx2 = stageFixture({ + rootDir: rootDir2, + currentBinaryBytes: oldBytes, + stagedBinaryBytes: brokenBytes, + manifestVersion: "0.2.0", + signingSecretKey: keyPair.secretKey, + }); + + let isActiveChecks = 0; + let restarts2 = 0; + await expect( + applyStagedUpdate({ + updateDir: fx2.updateDir, + binPath: fx2.binPath, + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + stabilizeMs: 10, + sleep: async () => {}, + runCommand: async (_cmd, args) => { + if (args[0] === "restart") { + restarts2++; + return { code: 0, stdout: "", stderr: "" }; + } + isActiveChecks++; + if (isActiveChecks === 1) { + return { code: 0, stdout: "active\n", stderr: "" }; + } + return { code: 3, stdout: "failed\n", stderr: "" }; + }, + }), + ).rejects.toMatchObject({ code: "health_check_failed" }); + + expect(restarts2).toBe(2); + expect(Buffer.compare(readFileSync(fx2.binPath), Buffer.from(oldBytes))).toBe(0); + }); + + test("rejects symlinks in staged-tegrad or staged-manifest.json", async () => { + const rootDir = makeTempDir(); + const keyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const oldBytes = new TextEncoder().encode("old-v0.1.0"); + const newBytes = new TextEncoder().encode("new-v0.2.0"); + + const fx = stageFixture({ + rootDir, + currentBinaryBytes: oldBytes, + stagedBinaryBytes: newBytes, + manifestVersion: "0.2.0", + signingSecretKey: keyPair.secretKey, + }); + + const externalTarget = join(rootDir, "outside-secret"); + writeFileSync(externalTarget, newBytes); + rmSync(join(fx.updateDir, STAGED_BINARY_NAME)); + + let symlinkCreated = false; + try { + symlinkSync(externalTarget, join(fx.updateDir, STAGED_BINARY_NAME)); + symlinkCreated = true; + } catch { + // Unprivileged Windows without Developer Mode may disallow file symlinks + symlinkCreated = false; + } + + if (!symlinkCreated) { + return; + } + + try { + await applyStagedUpdate({ + updateDir: fx.updateDir, + binPath: fx.binPath, + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), + }); + throw new Error("Expected unsafe_path"); + } catch (err) { + expect(err).toBeInstanceOf(UpdateError); + expect((err as UpdateError).code).toBe("unsafe_path"); + } + + // Installed binary untouched and external target untouched + expect(Buffer.compare(readFileSync(fx.binPath), Buffer.from(oldBytes))).toBe(0); + expect(existsSync(externalTarget)).toBe(true); + }); + + test("CLI apply-update dispatches cleanly and returns exit 0 on success", async () => { + const rootDir = makeTempDir(); + const keyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const oldBytes = new TextEncoder().encode("old-v0.1.0"); + const newBytes = new TextEncoder().encode("new-v0.2.0"); + + const fx = stageFixture({ + rootDir, + currentBinaryBytes: oldBytes, + stagedBinaryBytes: newBytes, + manifestVersion: "0.2.0", + signingSecretKey: keyPair.secretKey, + }); + + let stdout = ""; + let stderr = ""; + const code = await runCli(["apply-update"], { + applyUpdateOptions: { + updateDir: fx.updateDir, + binPath: fx.binPath, + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + stabilizeMs: 0, + sleep: async () => {}, + runCommand: async (_cmd, args) => + args[0] === "is-active" + ? { code: 0, stdout: "active\n", stderr: "" } + : { code: 0, stdout: "", stderr: "" }, + }, + stdout: (t) => { + stdout += t; + }, + stderr: (t) => { + stderr += t; + }, + }); + + expect(code).toBe(0); + expect(stderr).toBe(""); + expect(stdout).toContain("Applied v0.2.0"); + }); +}); diff --git a/src/update/apply.ts b/src/update/apply.ts new file mode 100644 index 0000000..4621ed2 --- /dev/null +++ b/src/update/apply.ts @@ -0,0 +1,475 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { randomBytes as nodeRandomBytes } from "node:crypto"; +import { + chmodSync, + closeSync, + existsSync, + constants as fsConstants, + fstatSync, + fsyncSync, + lstatSync, + mkdirSync, + openSync, + readFileSync, + readSync, + renameSync, + rmSync, + unlinkSync, + writeSync, +} from "node:fs"; +import { dirname, join } from "node:path"; +import { type RunFixedResult, runFixed } from "../agent"; +import { type PublicKey, ready } from "../crypto"; +import { VERSION } from "../version"; +import { shouldUpdate } from "./channels"; +import { UpdateError } from "./errors"; +import { type ReleaseArch, type ReleaseManifest, verifyReleaseBinary } from "./manifest"; +import { + MAX_BINARY_BYTES, + MAX_MANIFEST_BYTES, + READY_FILE_NAME, + STAGED_BINARY_NAME, + STAGED_MANIFEST_NAME, +} from "./updater"; + +export const DEFAULT_BIN_PATH = "/opt/tegrad/bin/tegrad"; +export const DEFAULT_UPDATE_DIR = "/var/lib/tegrad/update"; +export const DEFAULT_SERVICE_NAME = "tegrad.service"; +export const DEFAULT_HEALTH_TIMEOUT_MS = 15_000; +export const DEFAULT_HEALTH_POLL_INTERVAL_MS = 500; +export const DEFAULT_STABILIZE_MS = 1_500; + +const COPY_CHUNK_BYTES = 64 * 1024; +const ROOT_STAGING_DIR_MODE = 0o700; +const ROOT_STAGING_FILE_MODE = 0o600; +const INSTALLED_BINARY_MODE = 0o755; + +function isPosix(platform: NodeJS.Platform = process.platform): boolean { + return platform !== "win32"; +} + +function getNoFollowReadFlags(platform: NodeJS.Platform): number { + if (!isPosix(platform)) { + return fsConstants.O_RDONLY; + } + const noFollow = typeof fsConstants.O_NOFOLLOW === "number" ? fsConstants.O_NOFOLLOW : 0; + return fsConstants.O_RDONLY | noFollow; +} + +function assertNotSymlinkDir(dirPath: string): void { + if (!existsSync(dirPath)) { + throw new UpdateError("unsafe_path", `Directory does not exist: ${dirPath}`); + } + const stat = lstatSync(dirPath); + if (stat.isSymbolicLink() || !stat.isDirectory()) { + throw new UpdateError("unsafe_path", `Refusing to use symlink or non-directory: ${dirPath}`); + } +} + +function assertRegularNonSymlinkFile(filePath: string, maxBytes: number): void { + if (!existsSync(filePath)) { + throw new UpdateError("apply_failed", `Required staged file is missing: ${filePath}`); + } + const stat = lstatSync(filePath); + if (stat.isSymbolicLink()) { + throw new UpdateError("unsafe_path", `Refusing to read symlink: ${filePath}`); + } + if (!stat.isFile()) { + throw new UpdateError("unsafe_path", `Refusing to read non-regular file: ${filePath}`); + } + if (stat.size <= 0) { + throw new UpdateError("apply_failed", `Staged file is empty: ${filePath}`); + } + if (stat.size > maxBytes) { + throw new UpdateError( + "size_limit_exceeded", + `Staged file ${filePath} exceeds maximum size of ${maxBytes} bytes`, + ); + } +} + +function copyRegularFileNoFollow( + srcPath: string, + dstPath: string, + maxBytes: number, + dstMode: number, + platform: NodeJS.Platform, +): number { + assertRegularNonSymlinkFile(srcPath, maxBytes); + + let srcFd: number | undefined; + let dstFd: number | undefined; + let total = 0; + + try { + srcFd = openSync(srcPath, getNoFollowReadFlags(platform)); + const fdStat = fstatSync(srcFd); + if (!fdStat.isFile()) { + throw new UpdateError("unsafe_path", `Opened source is not a regular file: ${srcPath}`); + } + + dstFd = openSync(dstPath, "wx", dstMode); + const buffer = Buffer.allocUnsafe(COPY_CHUNK_BYTES); + + while (true) { + const bytesRead = readSync(srcFd, buffer, 0, buffer.length, null); + if (bytesRead === 0) { + break; + } + total += bytesRead; + if (total > maxBytes) { + throw new UpdateError( + "size_limit_exceeded", + `File ${srcPath} exceeded maximum size of ${maxBytes} bytes during copy`, + ); + } + writeSync(dstFd, buffer, 0, bytesRead); + } + + fsyncSync(dstFd); + closeSync(dstFd); + dstFd = undefined; + + if (isPosix(platform)) { + chmodSync(dstPath, dstMode); + } + + return total; + } catch (err) { + if (dstFd !== undefined) { + try { + closeSync(dstFd); + } catch { + // ignore + } + } + try { + if (existsSync(dstPath)) { + unlinkSync(dstPath); + } + } catch { + // ignore + } + throw err; + } finally { + if (srcFd !== undefined) { + try { + closeSync(srcFd); + } catch { + // ignore + } + } + } +} + +function atomicCopyFile( + srcPath: string, + dstPath: string, + mode: number, + maxBytes: number, + platform: NodeJS.Platform, +): void { + const dir = dirname(dstPath); + const suffix = nodeRandomBytes(8).toString("hex"); + const tmpPath = join(dir, `.tmp-copy-${process.pid}-${suffix}`); + try { + copyRegularFileNoFollow(srcPath, tmpPath, maxBytes, mode, platform); + if (isPosix(platform)) { + chmodSync(tmpPath, mode); + } + renameSync(tmpPath, dstPath); + } catch (err) { + try { + if (existsSync(tmpPath)) { + unlinkSync(tmpPath); + } + } catch { + // ignore + } + throw err; + } +} + +function safeUnlinkIfPresent(filePath: string): void { + try { + const stat = lstatSync(filePath); + if (!stat.isDirectory()) { + unlinkSync(filePath); + } + } catch { + // file does not exist or already removed + } +} + +export type ApplyCommandRunner = ( + command: string, + args: readonly string[], +) => Promise>; + +export interface ApplyUpdateOptions { + readonly updateDir?: string; + readonly binPath?: string; + readonly prevBinPath?: string; + readonly currentVersion?: string; + readonly arch?: ReleaseArch; + readonly publicKey?: PublicKey; + readonly allowDowngrade?: boolean; + readonly serviceName?: string; + readonly healthTimeoutMs?: number; + readonly healthPollIntervalMs?: number; + readonly stabilizeMs?: number; + readonly platform?: NodeJS.Platform; + readonly runCommand?: ApplyCommandRunner; + readonly sleep?: (ms: number) => Promise; + readonly now?: () => number; + readonly afterCopyBeforeVerifyHook?: (context: { + readonly updateDir: string; + readonly rootStagingDir: string; + readonly rootBinaryPath: string; + readonly rootManifestPath: string; + }) => void | Promise; + readonly verifyHook?: (rootBinaryPath: string, rootManifestPath: string) => void | Promise; +} + +export interface ApplyUpdateResult { + readonly applied: true; + readonly previousVersion: string; + readonly version: string; + readonly tag: string; + readonly channel: ReleaseManifest["channel"]; + readonly arch: ReleaseArch; + readonly sha256: string; + readonly binPath: string; + readonly prevBinPath: string; +} + +async function waitForServiceActive( + runCommand: ApplyCommandRunner, + serviceName: string, + healthTimeoutMs: number, + healthPollIntervalMs: number, + stabilizeMs: number, + sleep: (ms: number) => Promise, + now: () => number, +): Promise<{ readonly healthy: boolean; readonly lastStatus: string }> { + const deadline = now() + healthTimeoutMs; + let lastStatus = "unknown"; + + while (true) { + const res = await runCommand("systemctl", ["is-active", serviceName]); + const status = res.stdout.trim() || res.stderr.trim() || `exit-${res.code}`; + lastStatus = status; + + if (res.code === 0 && status === "active") { + if (stabilizeMs <= 0) { + return { healthy: true, lastStatus: "active" }; + } + await sleep(stabilizeMs); + const confirm = await runCommand("systemctl", ["is-active", serviceName]); + const confirmStatus = + confirm.stdout.trim() || confirm.stderr.trim() || `exit-${confirm.code}`; + if (confirm.code === 0 && confirmStatus === "active") { + return { healthy: true, lastStatus: "active" }; + } + return { healthy: false, lastStatus: confirmStatus }; + } + + if (status === "failed") { + return { healthy: false, lastStatus: status }; + } + + const remaining = deadline - now(); + if (remaining <= 0) { + return { healthy: false, lastStatus }; + } + + await sleep(Math.min(healthPollIntervalMs, remaining)); + } +} + +export async function applyStagedUpdate( + options: ApplyUpdateOptions = {}, +): Promise { + await ready(); + + const updateDir = options.updateDir ?? DEFAULT_UPDATE_DIR; + const binPath = options.binPath ?? DEFAULT_BIN_PATH; + const binDir = dirname(binPath); + const prevBinPath = options.prevBinPath ?? `${binPath}.prev`; + const currentVersion = options.currentVersion ?? VERSION; + const serviceName = options.serviceName ?? DEFAULT_SERVICE_NAME; + const healthTimeoutMs = options.healthTimeoutMs ?? DEFAULT_HEALTH_TIMEOUT_MS; + const healthPollIntervalMs = options.healthPollIntervalMs ?? DEFAULT_HEALTH_POLL_INTERVAL_MS; + const stabilizeMs = options.stabilizeMs ?? DEFAULT_STABILIZE_MS; + const platform = options.platform ?? process.platform; + const sleep = + options.sleep ?? ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); + const now = options.now ?? (() => Date.now()); + const runCommand: ApplyCommandRunner = + options.runCommand ?? + ((command, args) => runFixed(command, args, { timeoutMs: 30_000, maxOutputBytes: 8192 })); + + // Verify updateDir and binDir are real directories (never symlinks) + assertNotSymlinkDir(updateDir); + assertNotSymlinkDir(binDir); + + const readyPath = join(updateDir, READY_FILE_NAME); + const stagedBinaryPath = join(updateDir, STAGED_BINARY_NAME); + const stagedManifestPath = join(updateDir, STAGED_MANIFEST_NAME); + + let rootStagingDir: string | null = null; + + try { + // Validate ready.json if present (must not be a symlink) and remove trigger immediately + if (existsSync(readyPath)) { + const readyStat = lstatSync(readyPath); + if (readyStat.isSymbolicLink() || !readyStat.isFile()) { + throw new UpdateError("unsafe_path", `Refusing to process unsafe ready file: ${readyPath}`); + } + safeUnlinkIfPresent(readyPath); + } + + // 1. TOCTOU defense: copy staged files into a root-owned private directory under binDir + // BEFORE verifying signature and SHA-256. The unprivileged 'tegrad' user cannot write + // inside binDir (/opt/tegrad/bin), eliminating any swap window between verify and install. + const suffix = nodeRandomBytes(8).toString("hex"); + rootStagingDir = join(binDir, `.staging-tmp-${process.pid}-${suffix}`); + mkdirSync(rootStagingDir, { mode: ROOT_STAGING_DIR_MODE }); + if (isPosix(platform)) { + chmodSync(rootStagingDir, ROOT_STAGING_DIR_MODE); + } + + const rootManifestPath = join(rootStagingDir, "manifest.json"); + const rootBinaryPath = join(rootStagingDir, "tegrad.new"); + + copyRegularFileNoFollow( + stagedManifestPath, + rootManifestPath, + MAX_MANIFEST_BYTES, + ROOT_STAGING_FILE_MODE, + platform, + ); + copyRegularFileNoFollow( + stagedBinaryPath, + rootBinaryPath, + MAX_BINARY_BYTES, + ROOT_STAGING_FILE_MODE, + platform, + ); + + if (options.afterCopyBeforeVerifyHook !== undefined) { + await options.afterCopyBeforeVerifyHook({ + updateDir, + rootStagingDir, + rootBinaryPath, + rootManifestPath, + }); + } + + // 2. Verify Ed25519 signature of manifest and SHA-256 of binary strictly on root-owned copies + const manifestContent = readFileSync(rootManifestPath, "utf8"); + const verified = await verifyReleaseBinary({ + binaryPath: rootBinaryPath, + manifestContent, + ...(options.arch !== undefined ? { arch: options.arch } : {}), + ...(options.publicKey !== undefined ? { publicKey: options.publicKey } : {}), + }); + + if (verified.mode !== "manifest") { + throw new UpdateError("invalid_manifest", "Expected manifest verification mode"); + } + + if (options.verifyHook !== undefined) { + await options.verifyHook(rootBinaryPath, rootManifestPath); + } + + // 3. Enforce version progression (never trust unprivileged ready.json to enable downgrades) + const allowed = shouldUpdate(currentVersion, verified.manifest.version, { + allowDowngrade: options.allowDowngrade === true, + }); + if (!allowed) { + throw new UpdateError( + "downgrade_blocked", + `Refusing update from ${currentVersion} to ${verified.manifest.version} without explicit downgrade authorization`, + ); + } + + // 4. Backup current binary atomically to tegrad.prev + const hadPrevious = existsSync(binPath); + if (hadPrevious) { + atomicCopyFile(binPath, prevBinPath, INSTALLED_BINARY_MODE, MAX_BINARY_BYTES, platform); + } + + // 5. Atomically install verified binary from root-owned staging dir to binPath + if (isPosix(platform)) { + chmodSync(rootBinaryPath, INSTALLED_BINARY_MODE); + } + renameSync(rootBinaryPath, binPath); + + // 6. Restart tegrad.service and verify health; roll back automatically on failure + const rollback = async (reason: string): Promise => { + if (hadPrevious && existsSync(prevBinPath)) { + try { + atomicCopyFile(prevBinPath, binPath, INSTALLED_BINARY_MODE, MAX_BINARY_BYTES, platform); + await runCommand("systemctl", ["restart", serviceName]); + } catch (rollbackErr) { + throw new UpdateError( + "rollback_failed", + `Update failed (${reason}) and automatic rollback failed: ${ + rollbackErr instanceof Error ? rollbackErr.message : String(rollbackErr) + }`, + ); + } + } + throw new UpdateError("health_check_failed", `Update failed and was rolled back: ${reason}`); + }; + + const restartRes = await runCommand("systemctl", ["restart", serviceName]); + if (restartRes.code !== 0) { + await rollback( + `systemctl restart ${serviceName} exited with code ${restartRes.code}${ + restartRes.stderr.trim() ? `: ${restartRes.stderr.trim()}` : "" + }`, + ); + } + + const health = await waitForServiceActive( + runCommand, + serviceName, + healthTimeoutMs, + healthPollIntervalMs, + stabilizeMs, + sleep, + now, + ); + if (!health.healthy) { + await rollback(`${serviceName} did not stabilize as active (status: ${health.lastStatus})`); + } + + return { + applied: true, + previousVersion: currentVersion, + version: verified.manifest.version, + tag: verified.manifest.tag, + channel: verified.manifest.channel, + arch: verified.arch, + sha256: verified.sha256, + binPath, + prevBinPath, + }; + } finally { + if (rootStagingDir !== null && existsSync(rootStagingDir)) { + try { + rmSync(rootStagingDir, { recursive: true, force: true }); + } catch { + // ignore cleanup errors + } + } + // Always clean up staged files so tegrad-update.path cannot loop on corrupt staging data + safeUnlinkIfPresent(readyPath); + safeUnlinkIfPresent(stagedBinaryPath); + safeUnlinkIfPresent(stagedManifestPath); + } +} diff --git a/src/update/channels.test.ts b/src/update/channels.test.ts new file mode 100644 index 0000000..f370098 --- /dev/null +++ b/src/update/channels.test.ts @@ -0,0 +1,110 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { describe, expect, test } from "bun:test"; +import { + channelFromTag, + compareVersions, + formatNightlyTag, + parseReleaseTag, + parseVersion, + shouldUpdate, + tryParseVersion, + UpdateError, +} from "./index"; + +describe("channels and version parsing", () => { + test("derives stable, beta, and nightly channels from valid tags and versions", () => { + expect(channelFromTag("v1.0.0")).toBe("stable"); + expect(channelFromTag("1.0.0")).toBe("stable"); + expect(channelFromTag("v0.2.0-beta.1")).toBe("beta"); + expect(channelFromTag("0.2.0-beta.12")).toBe("beta"); + expect(channelFromTag("v0.2.0-nightly.202611220600")).toBe("nightly"); + expect(channelFromTag("0.2.0-nightly.202611220600")).toBe("nightly"); + + const parsed = parseReleaseTag("v0.2.0-nightly.202611220600"); + expect(parsed).toEqual({ + raw: "0.2.0-nightly.202611220600", + tag: "v0.2.0-nightly.202611220600", + major: 0, + minor: 2, + patch: 0, + channel: "nightly", + prereleaseNumber: 202611220600, + nightlyTimestamp: "202611220600", + }); + }); + + test("rejects malformed or unsupported tag/version formats", () => { + const invalidInputs = [ + "", + "v1.0", + "v1.0.0.0", + "v01.0.0", + "v1.0.0-alpha.1", + "v1.0.0-rc.1", + "v1.0.0-beta", + "v1.0.0-beta.01", + "v1.0.0-beta.-1", + "v1.0.0-nightly.20261122", + "v1.0.0-nightly.202613010600", + "v1.0.0-nightly.202602300600", + "v1.0.0-nightly.202611222500", + "v1.0.0+build.1", + "latest", + "../v1.0.0", + "v1.0.0;rm -rf /", + ]; + + for (const bad of invalidInputs) { + expect(() => parseVersion(bad)).toThrow(UpdateError); + expect(tryParseVersion(bad)).toBeNull(); + } + + expect(() => parseReleaseTag("1.0.0")).toThrow(UpdateError); + }); + + test("compares versions with strict semver and prerelease precedence", () => { + expect(compareVersions("0.2.0", "0.1.9")).toBe(1); + expect(compareVersions("1.0.0", "0.99.99")).toBe(1); + expect(compareVersions("0.2.0", "0.2.0")).toBe(0); + expect(compareVersions("0.2.0", "v0.2.0")).toBe(0); + + // Same base: stable > nightly > beta + expect(compareVersions("0.2.0", "0.2.0-nightly.202611220600")).toBe(1); + expect(compareVersions("0.2.0-nightly.202611220600", "0.2.0-beta.99")).toBe(1); + expect(compareVersions("0.2.0", "0.2.0-beta.1")).toBe(1); + expect(compareVersions("0.2.0-beta.1", "0.2.0")).toBe(-1); + + // Within beta: numeric ordering (beta.10 > beta.2) + expect(compareVersions("0.2.0-beta.10", "0.2.0-beta.2")).toBe(1); + expect(compareVersions("0.2.0-beta.2", "0.2.0-beta.10")).toBe(-1); + + // Within nightly: chronological UTC timestamp ordering + expect(compareVersions("0.2.0-nightly.202611230600", "0.2.0-nightly.202611220600")).toBe(1); + expect(compareVersions("0.2.0-nightly.202611220600", "0.2.0-nightly.202611230600")).toBe(-1); + }); + + test("shouldUpdate blocks downgrades by default and permits them only when allowDowngrade is true", () => { + expect(shouldUpdate("0.1.0", "0.2.0")).toBe(true); + expect(shouldUpdate("0.2.0-beta.1", "0.2.0")).toBe(true); + expect(shouldUpdate("0.2.0", "0.2.0")).toBe(false); + expect(shouldUpdate("0.2.0", "0.2.0", { allowDowngrade: true })).toBe(false); + + // Downgrade blocked by default + expect(shouldUpdate("0.2.0", "0.1.9")).toBe(false); + expect(shouldUpdate("0.2.0-nightly.202611220600", "0.2.0-beta.1")).toBe(false); + expect(shouldUpdate("0.2.0", "0.2.0-beta.1")).toBe(false); + + // Explicitly requested channel switch / downgrade + expect(shouldUpdate("0.2.0", "0.1.9", { allowDowngrade: true })).toBe(true); + expect( + shouldUpdate("0.2.0-nightly.202611220600", "0.2.0-beta.1", { allowDowngrade: true }), + ).toBe(true); + }); + + test("formatNightlyTag emits UTC YYYYMMDDHHmm tag", () => { + const dt = new Date(Date.UTC(2026, 10, 22, 6, 5, 30)); + expect(formatNightlyTag("0.2.0-beta.1", dt)).toBe("v0.2.0-nightly.202611220605"); + }); +}); diff --git a/src/update/channels.ts b/src/update/channels.ts new file mode 100644 index 0000000..0be5890 --- /dev/null +++ b/src/update/channels.ts @@ -0,0 +1,221 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; +import { UpdateError } from "./errors"; + +export const RELEASE_CHANNELS = ["stable", "beta", "nightly"] as const; +export type ReleaseChannel = (typeof RELEASE_CHANNELS)[number]; + +export const releaseChannelSchema = z.enum(RELEASE_CHANNELS); + +const STABLE_RE = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/; +const BETA_RE = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)-beta\.(0|[1-9]\d*)$/; +const NIGHTLY_RE = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)-nightly\.(\d{12})$/; + +export interface ParsedVersion { + readonly raw: string; + readonly tag: string; + readonly major: number; + readonly minor: number; + readonly patch: number; + readonly channel: ReleaseChannel; + readonly prereleaseNumber: number | null; + readonly nightlyTimestamp: string | null; +} + +const CHANNEL_PRECEDENCE: Readonly> = { + beta: 0, + nightly: 1, + stable: 2, +}; + +function parseSafeUint(text: string): number { + const value = Number(text); + if (!Number.isSafeInteger(value) || value < 0) { + throw new UpdateError("invalid_version", `Invalid numeric component in version: "${text}"`); + } + return value; +} + +function isValidNightlyTimestamp(ts: string): boolean { + if (ts.length !== 12 || !/^\d{12}$/.test(ts)) { + return false; + } + const year = Number(ts.slice(0, 4)); + const month = Number(ts.slice(4, 6)); + const day = Number(ts.slice(6, 8)); + const hour = Number(ts.slice(8, 10)); + const minute = Number(ts.slice(10, 12)); + + if (year < 2000 || month < 1 || month > 12 || day < 1 || day > 31 || hour > 23 || minute > 59) { + return false; + } + + const probe = new Date(Date.UTC(year, month - 1, day, hour, minute)); + return ( + probe.getUTCFullYear() === year && + probe.getUTCMonth() === month - 1 && + probe.getUTCDate() === day && + probe.getUTCHours() === hour && + probe.getUTCMinutes() === minute + ); +} + +export function parseVersion(input: string): ParsedVersion { + if (typeof input !== "string" || input.length === 0 || input.length > 128) { + throw new UpdateError("invalid_version", `Invalid version string: "${String(input)}"`); + } + + const stableMatch = STABLE_RE.exec(input); + if (stableMatch !== null) { + const major = parseSafeUint(stableMatch[1] ?? ""); + const minor = parseSafeUint(stableMatch[2] ?? ""); + const patch = parseSafeUint(stableMatch[3] ?? ""); + const raw = `${major}.${minor}.${patch}`; + return { + raw, + tag: `v${raw}`, + major, + minor, + patch, + channel: "stable", + prereleaseNumber: null, + nightlyTimestamp: null, + }; + } + + const betaMatch = BETA_RE.exec(input); + if (betaMatch !== null) { + const major = parseSafeUint(betaMatch[1] ?? ""); + const minor = parseSafeUint(betaMatch[2] ?? ""); + const patch = parseSafeUint(betaMatch[3] ?? ""); + const betaNum = parseSafeUint(betaMatch[4] ?? ""); + const raw = `${major}.${minor}.${patch}-beta.${betaNum}`; + return { + raw, + tag: `v${raw}`, + major, + minor, + patch, + channel: "beta", + prereleaseNumber: betaNum, + nightlyTimestamp: null, + }; + } + + const nightlyMatch = NIGHTLY_RE.exec(input); + if (nightlyMatch !== null) { + const major = parseSafeUint(nightlyMatch[1] ?? ""); + const minor = parseSafeUint(nightlyMatch[2] ?? ""); + const patch = parseSafeUint(nightlyMatch[3] ?? ""); + const ts = nightlyMatch[4] ?? ""; + if (!isValidNightlyTimestamp(ts)) { + throw new UpdateError( + "invalid_version", + `Invalid nightly UTC timestamp in version: "${input}"`, + ); + } + const raw = `${major}.${minor}.${patch}-nightly.${ts}`; + return { + raw, + tag: `v${raw}`, + major, + minor, + patch, + channel: "nightly", + prereleaseNumber: Number(ts), + nightlyTimestamp: ts, + }; + } + + throw new UpdateError( + "invalid_version", + `Unsupported version or tag format: "${input}" (expected vX.Y.Z, vX.Y.Z-beta.N, or vX.Y.Z-nightly.YYYYMMDDHHmm)`, + ); +} + +export function tryParseVersion(input: string): ParsedVersion | null { + try { + return parseVersion(input); + } catch { + return null; + } +} + +export function channelFromTag(tagOrVersion: string): ReleaseChannel { + return parseVersion(tagOrVersion).channel; +} + +export function parseReleaseTag(tag: string): ParsedVersion { + if (!tag.startsWith("v")) { + throw new UpdateError("invalid_version", `Release tag must start with "v" (got "${tag}")`); + } + return parseVersion(tag); +} + +function compareNumbers(a: number, b: number): -1 | 0 | 1 { + if (a < b) return -1; + if (a > b) return 1; + return 0; +} + +export function compareVersions(a: string | ParsedVersion, b: string | ParsedVersion): -1 | 0 | 1 { + const va = typeof a === "string" ? parseVersion(a) : a; + const vb = typeof b === "string" ? parseVersion(b) : b; + + const maj = compareNumbers(va.major, vb.major); + if (maj !== 0) return maj; + + const min = compareNumbers(va.minor, vb.minor); + if (min !== 0) return min; + + const pat = compareNumbers(va.patch, vb.patch); + if (pat !== 0) return pat; + + const chan = compareNumbers(CHANNEL_PRECEDENCE[va.channel], CHANNEL_PRECEDENCE[vb.channel]); + if (chan !== 0) return chan; + + if (va.channel === "stable") { + return 0; + } + + if (va.channel === "beta") { + return compareNumbers(va.prereleaseNumber ?? 0, vb.prereleaseNumber ?? 0); + } + + const tsA = va.nightlyTimestamp ?? ""; + const tsB = vb.nightlyTimestamp ?? ""; + if (tsA < tsB) return -1; + if (tsA > tsB) return 1; + return 0; +} + +export interface ShouldUpdateOptions { + readonly allowDowngrade?: boolean; +} + +export function shouldUpdate( + currentVersion: string | ParsedVersion, + candidateVersion: string | ParsedVersion, + options: ShouldUpdateOptions = {}, +): boolean { + const cmp = compareVersions(candidateVersion, currentVersion); + if (cmp > 0) { + return true; + } + if (cmp === 0) { + return false; + } + return options.allowDowngrade === true; +} + +export function formatNightlyTag(baseVersion: string, now: Date = new Date()): string { + const parsed = parseVersion(baseVersion); + const yyyy = String(now.getUTCFullYear()).padStart(4, "0"); + const mm = String(now.getUTCMonth() + 1).padStart(2, "0"); + const dd = String(now.getUTCDate()).padStart(2, "0"); + const hh = String(now.getUTCHours()).padStart(2, "0"); + const min = String(now.getUTCMinutes()).padStart(2, "0"); + return `v${parsed.major}.${parsed.minor}.${parsed.patch}-nightly.${yyyy}${mm}${dd}${hh}${min}`; +} diff --git a/src/update/errors.ts b/src/update/errors.ts new file mode 100644 index 0000000..5d5ee58 --- /dev/null +++ b/src/update/errors.ts @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +export type UpdateErrorCode = + | "invalid_version" + | "invalid_manifest" + | "bad_manifest_signature" + | "bad_sums_signature" + | "channel_mismatch" + | "unsupported_arch" + | "invalid_url" + | "host_not_allowed" + | "download_failed" + | "size_mismatch" + | "size_limit_exceeded" + | "hash_mismatch" + | "checksum_not_found" + | "downgrade_blocked" + | "unsafe_path" + | "apply_failed" + | "health_check_failed" + | "rollback_failed"; + +export class UpdateError extends Error { + readonly code: UpdateErrorCode; + + constructor(code: UpdateErrorCode, message: string) { + super(message); + this.name = "UpdateError"; + this.code = code; + } +} diff --git a/src/update/index.ts b/src/update/index.ts new file mode 100644 index 0000000..dd94ac2 --- /dev/null +++ b/src/update/index.ts @@ -0,0 +1,93 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +export { + type ApplyCommandRunner, + type ApplyUpdateOptions, + type ApplyUpdateResult, + applyStagedUpdate, + DEFAULT_BIN_PATH, + DEFAULT_HEALTH_POLL_INTERVAL_MS, + DEFAULT_HEALTH_TIMEOUT_MS, + DEFAULT_SERVICE_NAME, + DEFAULT_STABILIZE_MS, + DEFAULT_UPDATE_DIR, +} from "./apply"; +export { + channelFromTag, + compareVersions, + formatNightlyTag, + type ParsedVersion, + parseReleaseTag, + parseVersion, + RELEASE_CHANNELS, + type ReleaseChannel, + releaseChannelSchema, + type ShouldUpdateOptions, + shouldUpdate, + tryParseVersion, +} from "./channels"; +export { UpdateError, type UpdateErrorCode } from "./errors"; +export { + archFromAssetName, + computeBytesSha256, + computeFileSha256, + DOMAIN_RELEASE_MANIFEST, + DOMAIN_SHA256SUMS, + formatSha256Sums, + MANIFEST_SCHEMA_VERSION, + manifestSigningPayload, + parseReleaseSigningKey, + parseSha256Sums, + RELEASE_ASSET_NAMES, + type ReleaseArch, + type ReleaseAsset, + type ReleaseManifest, + releaseAssetSchema, + releaseManifestSchema, + resolveReleaseArch, + SUPPORTED_RELEASE_ARCHES, + sha256SumsSigningPayload, + signManifest, + signSha256Sums, + type UnsignedReleaseManifest, + unsignedReleaseManifestSchema, + type VerifyManifestOptions, + type VerifyReleaseBinaryOptions, + type VerifyReleaseBinaryResult, + verifyManifest, + verifyReleaseBinary, + verifySha256Sums, +} from "./manifest"; +export { + ed25519PublicKeyFromPem, + ed25519PublicKeyToPem, + getReleasePublicKey, + RELEASE_PUBLIC_KEY_BASE64URL, +} from "./release-key"; +export { + type AutoUpdater, + type AutoUpdaterOptions, + buildManifestUrl, + type CheckForUpdateOptions, + type CheckForUpdateResult, + checkForUpdate, + computeNextCheckDelayMs, + createAutoUpdater, + DEFAULT_ALLOWED_ASSET_HOSTS, + DEFAULT_BINARY_TIMEOUT_MS, + DEFAULT_MANIFEST_BASE_URL, + DEFAULT_MANIFEST_TIMEOUT_MS, + DEFAULT_UPDATE_CHANNEL, + DEFAULT_UPDATE_INTERVAL_MS, + DEFAULT_UPDATE_JITTER_RATIO, + ensureSafeUpdateDir, + MAX_BINARY_BYTES, + MAX_MANIFEST_BYTES, + READY_FILE_NAME, + type ReadyFile, + readyFileSchema, + STAGED_BINARY_NAME, + STAGED_MANIFEST_NAME, + validateAssetUrl, +} from "./updater"; diff --git a/src/update/manifest.test.ts b/src/update/manifest.test.ts new file mode 100644 index 0000000..cccbb1f --- /dev/null +++ b/src/update/manifest.test.ts @@ -0,0 +1,299 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeAll, describe, expect, test } from "bun:test"; +import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { runSignRelease } from "../../scripts/sign-release"; +import { runCli } from "../cli/main"; +import { + fromBase64Url, + generateSigningKeyPair, + ready, + signingKeyPairFromSeed, + toBase64Url, +} from "../crypto"; +import { + computeBytesSha256, + ed25519PublicKeyFromPem, + ed25519PublicKeyToPem, + formatSha256Sums, + getReleasePublicKey, + MANIFEST_SCHEMA_VERSION, + parseReleaseSigningKey, + signManifest, + signSha256Sums, + type UnsignedReleaseManifest, + UpdateError, + verifyManifest, + verifyReleaseBinary, + verifySha256Sums, +} from "./index"; + +// Deterministic test-only seed matching placeholder RELEASE_PUBLIC_KEY_BASE64URL. +// Never store production signing keys or seeds in source code. +const TEST_RELEASE_SEED = new Uint8Array(32).fill(0x42); + +const tempDirs: string[] = []; + +function makeTempDir(): string { + const dir = mkdtempSync(join(tmpdir(), "tegrad-manifest-test-")); + tempDirs.push(dir); + return dir; +} + +beforeAll(async () => { + await ready(); +}); + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +function makeSampleUnsignedManifest( + x64Bytes: Uint8Array, + arm64Bytes: Uint8Array, + overrides: Partial = {}, +): UnsignedReleaseManifest { + return { + v: MANIFEST_SCHEMA_VERSION, + channel: "stable", + version: "0.2.0", + tag: "v0.2.0", + published_at: 1_795_300_000_000, + assets: { + "linux-x64": { + url: "https://github.com/codebyant/tegrad/releases/download/v0.2.0/tegrad-linux-x64", + sha256: computeBytesSha256(x64Bytes), + size: x64Bytes.byteLength, + }, + "linux-arm64": { + url: "https://github.com/codebyant/tegrad/releases/download/v0.2.0/tegrad-linux-arm64", + sha256: computeBytesSha256(arm64Bytes), + size: arm64Bytes.byteLength, + }, + }, + ...overrides, + }; +} + +function flipFirstBitBase64Url(b64u: string): string { + const bytes = fromBase64Url(b64u); + const copy = new Uint8Array(bytes); + copy[0] = (copy[0] ?? 0) ^ 0x01; + return toBase64Url(copy); +} + +describe("release key and PEM encoding", () => { + test("placeholder release public key matches test seed and round-trips through Ed25519 SPKI PEM", () => { + const testKeyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const embedded = getReleasePublicKey(); + expect(toBase64Url(embedded)).toBe(toBase64Url(testKeyPair.publicKey)); + + const pem = ed25519PublicKeyToPem(embedded); + expect(pem).toContain("-----BEGIN PUBLIC KEY-----"); + expect(toBase64Url(ed25519PublicKeyFromPem(pem))).toBe(toBase64Url(embedded)); + + const fromSeed = parseReleaseSigningKey(toBase64Url(TEST_RELEASE_SEED)); + expect(toBase64Url(fromSeed.publicKey)).toBe(toBase64Url(embedded)); + const fromSecret = parseReleaseSigningKey(toBase64Url(testKeyPair.secretKey)); + expect(toBase64Url(fromSecret.publicKey)).toBe(toBase64Url(embedded)); + }); +}); + +describe("Ed25519 release manifest and SHA256SUMS signing/verification", () => { + test("valid signed manifest passes verification and tampered fields fail closed", () => { + const keyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const attacker = generateSigningKeyPair(); + const x64 = new TextEncoder().encode("x64-binary-payload"); + const arm64 = new TextEncoder().encode("arm64-binary-payload"); + + const signed = signManifest(makeSampleUnsignedManifest(x64, arm64), keyPair.secretKey); + const verified = verifyManifest(signed, { expectedChannel: "stable" }); + expect(verified.version).toBe("0.2.0"); + + // 1-bit flip in signature + expect(() => verifyManifest({ ...signed, sig: flipFirstBitBase64Url(signed.sig) })).toThrow( + UpdateError, + ); + + // Tampered version + expect(() => verifyManifest({ ...signed, version: "0.2.1", tag: "v0.2.1" })).toThrow( + UpdateError, + ); + + // Tampered asset URL + expect(() => + verifyManifest({ + ...signed, + assets: { + ...signed.assets, + "linux-x64": { + ...signed.assets["linux-x64"], + url: "https://evil.example/tegrad-linux-x64", + }, + }, + }), + ).toThrow(UpdateError); + + // Tampered asset sha256 (1 nibble changed) + const badHash = + (signed.assets["linux-x64"].sha256.startsWith("0") ? "1" : "0") + + signed.assets["linux-x64"].sha256.slice(1); + expect(() => + verifyManifest({ + ...signed, + assets: { + ...signed.assets, + "linux-x64": { + ...signed.assets["linux-x64"], + sha256: badHash, + }, + }, + }), + ).toThrow(UpdateError); + + // Signed by attacker key + const attackerSigned = signManifest(makeSampleUnsignedManifest(x64, arm64), attacker.secretKey); + try { + verifyManifest(attackerSigned, { publicKey: keyPair.publicKey }); + throw new Error("Expected bad_manifest_signature"); + } catch (err) { + expect(err).toBeInstanceOf(UpdateError); + expect((err as UpdateError).code).toBe("bad_manifest_signature"); + } + + // Channel mismatch fails closed + try { + verifyManifest(signed, { publicKey: keyPair.publicKey, expectedChannel: "beta" }); + throw new Error("Expected channel_mismatch"); + } catch (err) { + expect(err).toBeInstanceOf(UpdateError); + expect((err as UpdateError).code).toBe("channel_mismatch"); + } + }); + + test("SHA256SUMS signing rejects tampered bytes, wrong key, and cross-domain signature reuse", () => { + const keyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const attacker = generateSigningKeyPair(); + const sums = formatSha256Sums([ + { sha256: computeBytesSha256(new Uint8Array([1, 2, 3])), filename: "tegrad-linux-x64" }, + { sha256: computeBytesSha256(new Uint8Array([4, 5, 6])), filename: "tegrad-linux-arm64" }, + ]); + + const sig = signSha256Sums(sums, keyPair.secretKey); + expect(verifySha256Sums(sums, sig, keyPair.publicKey)).toBe(true); + expect(verifySha256Sums(`${sums}\n`, sig, keyPair.publicKey)).toBe(false); + expect(verifySha256Sums(sums, flipFirstBitBase64Url(sig), keyPair.publicKey)).toBe(false); + expect(verifySha256Sums(sums, sig, attacker.publicKey)).toBe(false); + }); + + test("scripts/sign-release.ts signs SHA256SUMS + channel manifest and verifyReleaseBinary + CLI verify-update succeed", async () => { + const dir = makeTempDir(); + const x64Bytes = new TextEncoder().encode("fake-tegrad-linux-x64-elf-bytes"); + const arm64Bytes = new TextEncoder().encode("fake-tegrad-linux-arm64-elf-bytes"); + const x64Path = join(dir, "tegrad-linux-x64"); + const arm64Path = join(dir, "tegrad-linux-arm64"); + writeFileSync(x64Path, x64Bytes); + writeFileSync(arm64Path, arm64Bytes); + + const res = await runSignRelease( + [ + "--tag", + "v0.3.0-beta.2", + "--assets-dir", + dir, + "--base-url", + "https://github.com/codebyant/tegrad/releases/download/v0.3.0-beta.2", + "--published-at", + "1795300000000", + ], + { RELEASE_SIGNING_KEY: toBase64Url(TEST_RELEASE_SEED) }, + ); + + expect(res.channel).toBe("beta"); + expect(res.manifestPath.endsWith("beta.json")).toBe(true); + + const manifestText = readFileSync(res.manifestPath, "utf8"); + const sumsText = readFileSync(res.sumsPath, "utf8"); + const sigText = readFileSync(res.sigPath, "utf8"); + + const v1 = await verifyReleaseBinary({ + binaryPath: x64Path, + manifestContent: manifestText, + arch: "linux-x64", + expectedChannel: "beta", + }); + expect(v1.ok).toBe(true); + expect(v1.mode).toBe("manifest"); + + const v2 = await verifyReleaseBinary({ + binaryPath: arm64Path, + sha256SumsContent: sumsText, + sha256SumsSig: sigText, + expectedAssetName: "tegrad-linux-arm64", + }); + expect(v2.ok).toBe(true); + expect(v2.mode).toBe("sums"); + + // CLI verify-update succeeds for both manifest and sums modes + let cliOut = ""; + let cliErr = ""; + const code1 = await runCli( + ["verify-update", "--binary", x64Path, "--manifest", res.manifestPath, "--channel", "beta"], + { + verifyUpdateOptions: { arch: "linux-x64" }, + stdout: (t) => { + cliOut += t; + }, + stderr: (t) => { + cliErr += t; + }, + }, + ); + expect(code1).toBe(0); + expect(cliErr).toBe(""); + expect(cliOut).toContain("Verified v0.3.0-beta.2"); + + const code2 = await runCli( + [ + "verify-update", + "--binary", + arm64Path, + "--sums", + res.sumsPath, + "--sig", + res.sigPath, + "--asset", + "tegrad-linux-arm64", + ], + { + stdout: () => {}, + stderr: () => {}, + }, + ); + expect(code2).toBe(0); + + // Corrupt 1 byte in binary -> CLI verify-update returns 1 + writeFileSync(x64Path, new TextEncoder().encode("fake-tegrad-linux-x64-elf-byteX")); + let failErr = ""; + const failCode = await runCli( + ["verify-update", "--binary", x64Path, "--manifest", res.manifestPath], + { + verifyUpdateOptions: { arch: "linux-x64" }, + stdout: () => {}, + stderr: (t) => { + failErr += t; + }, + }, + ); + expect(failCode).toBe(1); + expect(failErr).toContain("SHA-256 mismatch"); + }); +}); diff --git a/src/update/manifest.ts b/src/update/manifest.ts new file mode 100644 index 0000000..d34f472 --- /dev/null +++ b/src/update/manifest.ts @@ -0,0 +1,482 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { createHash } from "node:crypto"; +import { createReadStream } from "node:fs"; +import { basename } from "node:path"; +import { z } from "zod"; +import { + canonicalize, + fromBase64Url, + type PublicKey, + ready, + type SecretKey, + SIGNATURE_BYTES, + SIGNING_PUBLIC_KEY_BYTES, + SIGNING_SECRET_KEY_BYTES, + SIGNING_SEED_BYTES, + type SigningKeyPair, + sign, + signingKeyPairFromSeed, + toBase64Url, + verify, +} from "../crypto"; +import { base64UrlSchema } from "../protocol"; +import { + parseReleaseTag, + parseVersion, + type ReleaseChannel, + releaseChannelSchema, +} from "./channels"; +import { UpdateError } from "./errors"; +import { getReleasePublicKey } from "./release-key"; + +const utf8Encoder = new TextEncoder(); + +function concatBytes(...parts: readonly Uint8Array[]): Uint8Array { + let total = 0; + for (const part of parts) { + total += part.length; + } + const out = new Uint8Array(total); + let offset = 0; + for (const part of parts) { + out.set(part, offset); + offset += part.length; + } + return out; +} + +export const MANIFEST_SCHEMA_VERSION = 1 as const; +export const DOMAIN_RELEASE_MANIFEST = utf8Encoder.encode("TEGRA_RELEASE_MANIFEST_V1\0"); +export const DOMAIN_SHA256SUMS = utf8Encoder.encode("TEGRA_SHA256SUMS_V1\0"); + +export const SUPPORTED_RELEASE_ARCHES = ["linux-x64", "linux-arm64"] as const; +export type ReleaseArch = (typeof SUPPORTED_RELEASE_ARCHES)[number]; + +export const RELEASE_ASSET_NAMES: Readonly> = { + "linux-x64": "tegrad-linux-x64", + "linux-arm64": "tegrad-linux-arm64", +}; + +const sha256HexSchema = z.string().regex(/^[0-9a-f]{64}$/); + +const httpsUrlSchema = z.string().refine( + (value) => { + try { + const parsed = new URL(value); + return ( + parsed.protocol === "https:" && + parsed.username.length === 0 && + parsed.password.length === 0 && + parsed.hostname.length > 0 + ); + } catch { + return false; + } + }, + { message: "Asset URL must be a valid https:// URL without embedded credentials" }, +); + +export const releaseAssetSchema = z + .object({ + url: httpsUrlSchema, + sha256: sha256HexSchema, + size: z.number().int().positive(), + }) + .strict(); + +export const unsignedReleaseManifestSchema = z + .object({ + v: z.literal(MANIFEST_SCHEMA_VERSION), + channel: releaseChannelSchema, + version: z.string().min(1), + tag: z.string().min(1), + published_at: z.number().int().nonnegative(), + assets: z + .object({ + "linux-x64": releaseAssetSchema, + "linux-arm64": releaseAssetSchema, + }) + .strict(), + }) + .strict(); + +export const releaseManifestSchema = unsignedReleaseManifestSchema + .extend({ + sig: base64UrlSchema, + }) + .strict(); + +export type ReleaseAsset = z.infer; +export type UnsignedReleaseManifest = z.infer; +export type ReleaseManifest = z.infer; + +export function resolveReleaseArch( + platform: NodeJS.Platform = process.platform, + arch: string = process.arch, +): ReleaseArch { + if (platform !== "linux") { + throw new UpdateError("unsupported_arch", `Auto-update only supports Linux (got ${platform})`); + } + if (arch === "x64") { + return "linux-x64"; + } + if (arch === "arm64") { + return "linux-arm64"; + } + throw new UpdateError("unsupported_arch", `Unsupported Linux architecture: ${arch}`); +} + +export function archFromAssetName(assetName: string): ReleaseArch | null { + if (assetName === RELEASE_ASSET_NAMES["linux-x64"]) return "linux-x64"; + if (assetName === RELEASE_ASSET_NAMES["linux-arm64"]) return "linux-arm64"; + return null; +} + +function assertManifestSemantics(manifest: UnsignedReleaseManifest): void { + const parsedVersion = parseVersion(manifest.version); + const parsedTag = parseReleaseTag(manifest.tag); + if (manifest.version !== parsedVersion.raw) { + throw new UpdateError( + "invalid_manifest", + `Manifest version must be canonical without leading "v" (got "${manifest.version}")`, + ); + } + if (parsedTag.raw !== parsedVersion.raw || manifest.tag !== parsedVersion.tag) { + throw new UpdateError( + "invalid_manifest", + `Manifest tag "${manifest.tag}" does not match version "${manifest.version}"`, + ); + } + if (parsedVersion.channel !== manifest.channel) { + throw new UpdateError( + "channel_mismatch", + `Manifest channel "${manifest.channel}" does not match version "${manifest.version}" (${parsedVersion.channel})`, + ); + } +} + +export function manifestSigningPayload(unsigned: UnsignedReleaseManifest): Uint8Array { + return concatBytes(DOMAIN_RELEASE_MANIFEST, canonicalize(unsigned)); +} + +export function sha256SumsSigningPayload(sumsContent: string | Uint8Array): Uint8Array { + const bytes = typeof sumsContent === "string" ? utf8Encoder.encode(sumsContent) : sumsContent; + return concatBytes(DOMAIN_SHA256SUMS, bytes); +} + +export function parseReleaseSigningKey(rawBase64Url: string): SigningKeyPair { + const trimmed = rawBase64Url.trim(); + let bytes: Uint8Array; + try { + bytes = fromBase64Url(trimmed); + } catch { + throw new UpdateError("bad_manifest_signature", "Invalid base64url encoding for signing key"); + } + + if (bytes.length === SIGNING_SEED_BYTES) { + return signingKeyPairFromSeed(bytes); + } + if (bytes.length === SIGNING_SECRET_KEY_BYTES) { + const publicKey = bytes.subarray( + SIGNING_SECRET_KEY_BYTES - SIGNING_PUBLIC_KEY_BYTES, + SIGNING_SECRET_KEY_BYTES, + ); + return { publicKey, secretKey: bytes }; + } + throw new UpdateError( + "bad_manifest_signature", + `Signing key must be ${SIGNING_SEED_BYTES} bytes (seed) or ${SIGNING_SECRET_KEY_BYTES} bytes (secret key)`, + ); +} + +export function signManifest( + unsigned: UnsignedReleaseManifest, + secretKey: SecretKey, +): ReleaseManifest { + const parsed = unsignedReleaseManifestSchema.safeParse(unsigned); + if (!parsed.success) { + throw new UpdateError("invalid_manifest", "Manifest failed schema validation before signing"); + } + assertManifestSemantics(parsed.data); + + const payload = manifestSigningPayload(parsed.data); + const sigBytes = sign(payload, secretKey); + return { + ...parsed.data, + sig: toBase64Url(sigBytes), + }; +} + +export interface VerifyManifestOptions { + readonly publicKey?: PublicKey; + readonly expectedChannel?: ReleaseChannel; +} + +export function verifyManifest(raw: unknown, options: VerifyManifestOptions = {}): ReleaseManifest { + const parsed = releaseManifestSchema.safeParse(raw); + if (!parsed.success) { + throw new UpdateError("invalid_manifest", "Release manifest failed schema validation"); + } + + const publicKey = options.publicKey ?? getReleasePublicKey(); + const { sig, ...unsigned } = parsed.data; + + let sigBytes: Uint8Array; + try { + sigBytes = fromBase64Url(sig); + } catch { + throw new UpdateError("bad_manifest_signature", "Invalid base64url signature in manifest"); + } + if (sigBytes.length !== SIGNATURE_BYTES) { + throw new UpdateError("bad_manifest_signature", "Invalid signature length in manifest"); + } + + const payload = manifestSigningPayload(unsigned); + if (!verify(payload, sigBytes, publicKey)) { + throw new UpdateError( + "bad_manifest_signature", + "Ed25519 signature verification failed for manifest", + ); + } + + assertManifestSemantics(unsigned); + + if (options.expectedChannel !== undefined && parsed.data.channel !== options.expectedChannel) { + throw new UpdateError( + "channel_mismatch", + `Expected manifest for channel "${options.expectedChannel}", got "${parsed.data.channel}"`, + ); + } + + return parsed.data; +} + +export function signSha256Sums(sumsContent: string | Uint8Array, secretKey: SecretKey): string { + const payload = sha256SumsSigningPayload(sumsContent); + return toBase64Url(sign(payload, secretKey)); +} + +export function verifySha256Sums( + sumsContent: string | Uint8Array, + signatureBase64Url: string, + publicKey: PublicKey = getReleasePublicKey(), +): boolean { + const trimmed = signatureBase64Url.trim(); + let sigBytes: Uint8Array; + try { + sigBytes = fromBase64Url(trimmed); + } catch { + return false; + } + if (sigBytes.length !== SIGNATURE_BYTES) { + return false; + } + const payload = sha256SumsSigningPayload(sumsContent); + return verify(payload, sigBytes, publicKey); +} + +export function parseSha256Sums(content: string): Map { + const map = new Map(); + for (const rawLine of content.split(/\r?\n/)) { + const line = rawLine.trim(); + if (line.length === 0) continue; + const match = /^([0-9a-f]{64})[ \t]+\*?([^\s/\\]+)$/.exec(line); + if (match === null) { + throw new UpdateError("invalid_manifest", `Malformed line in SHA256SUMS: "${line}"`); + } + const sha256 = match[1] ?? ""; + const filename = match[2] ?? ""; + const existing = map.get(filename); + if (existing !== undefined && existing !== sha256) { + throw new UpdateError( + "invalid_manifest", + `Conflicting duplicate SHA256SUMS entries for "${filename}"`, + ); + } + map.set(filename, sha256); + } + return map; +} + +export function formatSha256Sums( + entries: readonly { readonly sha256: string; readonly filename: string }[], +): string { + const sorted = [...entries].sort((a, b) => + a.filename < b.filename ? -1 : a.filename > b.filename ? 1 : 0, + ); + return `${sorted.map((entry) => `${entry.sha256} ${entry.filename}`).join("\n")}\n`; +} + +export function computeBytesSha256(bytes: Uint8Array): string { + return createHash("sha256").update(bytes).digest("hex"); +} + +export function computeFileSha256( + filePath: string, +): Promise<{ readonly sha256: string; readonly size: number }> { + return new Promise((resolve, reject) => { + const hasher = createHash("sha256"); + let size = 0; + const stream = createReadStream(filePath); + + stream.on("data", (chunk: string | Buffer) => { + const buf = typeof chunk === "string" ? Buffer.from(chunk) : chunk; + size += buf.byteLength; + hasher.update(buf); + }); + stream.on("error", (err) => { + reject(err); + }); + stream.on("end", () => { + resolve({ sha256: hasher.digest("hex"), size }); + }); + }); +} + +export interface VerifyReleaseBinaryOptions { + readonly binaryPath: string; + readonly expectedAssetName?: string; + readonly arch?: ReleaseArch; + readonly sha256?: string; + readonly manifestContent?: string | Uint8Array | unknown; + readonly sha256SumsContent?: string | Uint8Array; + readonly sha256SumsSig?: string; + readonly publicKey?: PublicKey; + readonly expectedChannel?: ReleaseChannel; +} + +export type VerifyReleaseBinaryResult = + | { + readonly ok: true; + readonly mode: "manifest"; + readonly sha256: string; + readonly size: number; + readonly arch: ReleaseArch; + readonly manifest: ReleaseManifest; + } + | { + readonly ok: true; + readonly mode: "sums"; + readonly sha256: string; + readonly size: number; + readonly assetName: string; + }; + +export async function verifyReleaseBinary( + options: VerifyReleaseBinaryOptions, +): Promise { + await ready(); + const publicKey = options.publicKey ?? getReleasePublicKey(); + + if (options.manifestContent !== undefined) { + let rawManifest: unknown; + if (typeof options.manifestContent === "string") { + try { + rawManifest = JSON.parse(options.manifestContent) as unknown; + } catch { + throw new UpdateError("invalid_manifest", "Manifest content is not valid JSON"); + } + } else if (options.manifestContent instanceof Uint8Array) { + try { + rawManifest = JSON.parse(new TextDecoder().decode(options.manifestContent)) as unknown; + } catch { + throw new UpdateError("invalid_manifest", "Manifest content is not valid JSON"); + } + } else { + rawManifest = options.manifestContent; + } + + const manifest = verifyManifest(rawManifest, { + publicKey, + ...(options.expectedChannel !== undefined + ? { expectedChannel: options.expectedChannel } + : {}), + }); + + const archFromName = + options.expectedAssetName !== undefined ? archFromAssetName(options.expectedAssetName) : null; + const arch = options.arch ?? archFromName ?? resolveReleaseArch(); + const asset = manifest.assets[arch]; + const { sha256, size } = await computeFileSha256(options.binaryPath); + + if (size !== asset.size) { + throw new UpdateError( + "size_mismatch", + `Binary size mismatch for ${arch}: expected ${asset.size} bytes, got ${size} bytes`, + ); + } + if (sha256 !== asset.sha256) { + throw new UpdateError( + "hash_mismatch", + `Binary SHA-256 mismatch for ${arch}: expected ${asset.sha256}, got ${sha256}`, + ); + } + if (options.sha256 !== undefined && sha256 !== options.sha256.toLowerCase()) { + throw new UpdateError( + "hash_mismatch", + `Binary SHA-256 mismatch: expected ${options.sha256}, got ${sha256}`, + ); + } + + return { + ok: true, + mode: "manifest", + sha256, + size, + arch, + manifest, + }; + } + + if (options.sha256SumsContent !== undefined && options.sha256SumsSig !== undefined) { + if (!verifySha256Sums(options.sha256SumsContent, options.sha256SumsSig, publicKey)) { + throw new UpdateError( + "bad_sums_signature", + "Ed25519 signature verification failed for SHA256SUMS", + ); + } + + const text = + typeof options.sha256SumsContent === "string" + ? options.sha256SumsContent + : new TextDecoder().decode(options.sha256SumsContent); + const sums = parseSha256Sums(text); + const assetName = options.expectedAssetName ?? basename(options.binaryPath); + const expectedHash = sums.get(assetName); + if (expectedHash === undefined) { + throw new UpdateError( + "checksum_not_found", + `Asset "${assetName}" not found in verified SHA256SUMS`, + ); + } + + const { sha256, size } = await computeFileSha256(options.binaryPath); + if (sha256 !== expectedHash) { + throw new UpdateError( + "hash_mismatch", + `Binary SHA-256 mismatch for ${assetName}: expected ${expectedHash}, got ${sha256}`, + ); + } + if (options.sha256 !== undefined && sha256 !== options.sha256.toLowerCase()) { + throw new UpdateError( + "hash_mismatch", + `Binary SHA-256 mismatch: expected ${options.sha256}, got ${sha256}`, + ); + } + + return { + ok: true, + mode: "sums", + sha256, + size, + assetName, + }; + } + + throw new UpdateError( + "invalid_manifest", + "Verification requires either manifestContent or both sha256SumsContent and sha256SumsSig", + ); +} diff --git a/src/update/release-key.ts b/src/update/release-key.ts new file mode 100644 index 0000000..173f721 --- /dev/null +++ b/src/update/release-key.ts @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { fromBase64Url, type PublicKey, SIGNING_PUBLIC_KEY_BYTES } from "../crypto"; +import { UpdateError } from "./errors"; + +// TODO(release-key): replace placeholder test public key with production offline Ed25519 release signing public key before first public release. +export const RELEASE_PUBLIC_KEY_BASE64URL = "IVL40Zt5HSRFMkLhXy6rbLfP-ntqXtMAl5YOBpiB2xI"; + +/** + * Fixed 12-byte ASN.1 DER SubjectPublicKeyInfo prefix for Ed25519 (OID 1.3.101.112). + * Followed directly by the 32-byte raw Ed25519 public key. + */ +const ED25519_SPKI_PREFIX = new Uint8Array([ + 0x30, 0x2a, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x70, 0x03, 0x21, 0x00, +]); + +export function getReleasePublicKey(): PublicKey { + const key = fromBase64Url(RELEASE_PUBLIC_KEY_BASE64URL); + if (key.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new UpdateError( + "bad_manifest_signature", + `Embedded release public key must be ${SIGNING_PUBLIC_KEY_BYTES} bytes`, + ); + } + return key; +} + +export function ed25519PublicKeyToPem(publicKey: PublicKey): string { + if (publicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new RangeError(`Ed25519 public key must be ${SIGNING_PUBLIC_KEY_BYTES} bytes`); + } + const der = new Uint8Array(ED25519_SPKI_PREFIX.length + publicKey.length); + der.set(ED25519_SPKI_PREFIX, 0); + der.set(publicKey, ED25519_SPKI_PREFIX.length); + const b64 = Buffer.from(der).toString("base64"); + return `-----BEGIN PUBLIC KEY-----\n${b64}\n-----END PUBLIC KEY-----\n`; +} + +export function ed25519PublicKeyFromPem(pem: string): PublicKey { + const stripped = pem + .replace(/-----BEGIN PUBLIC KEY-----/g, "") + .replace(/-----END PUBLIC KEY-----/g, "") + .replace(/\s+/g, ""); + const der = new Uint8Array(Buffer.from(stripped, "base64")); + if (der.length !== ED25519_SPKI_PREFIX.length + SIGNING_PUBLIC_KEY_BYTES) { + throw new UpdateError("bad_manifest_signature", "Invalid Ed25519 SPKI PEM length"); + } + for (let i = 0; i < ED25519_SPKI_PREFIX.length; i++) { + if (der[i] !== ED25519_SPKI_PREFIX[i]) { + throw new UpdateError("bad_manifest_signature", "Invalid Ed25519 SPKI DER header"); + } + } + return der.subarray(ED25519_SPKI_PREFIX.length); +} diff --git a/src/update/updater.test.ts b/src/update/updater.test.ts new file mode 100644 index 0000000..ff7a36a --- /dev/null +++ b/src/update/updater.test.ts @@ -0,0 +1,393 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeAll, describe, expect, test } from "bun:test"; +import { + existsSync, + mkdtempSync, + readdirSync, + readFileSync, + rmSync, + statSync, + writeFileSync, +} from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { getStatePaths, loadConfig, StateError, type TimerProvider } from "../agent"; +import { generateSigningKeyPair, ready, signingKeyPairFromSeed } from "../crypto"; +import { + checkForUpdate, + computeBytesSha256, + computeNextCheckDelayMs, + createAutoUpdater, + DEFAULT_UPDATE_INTERVAL_MS, + DEFAULT_UPDATE_JITTER_RATIO, + MANIFEST_SCHEMA_VERSION, + READY_FILE_NAME, + readyFileSchema, + STAGED_BINARY_NAME, + STAGED_MANIFEST_NAME, + signManifest, + type UnsignedReleaseManifest, + UpdateError, +} from "./index"; + +const TEST_RELEASE_SEED = new Uint8Array(32).fill(0x42); + +const tempDirs: string[] = []; + +function makeTempDir(): string { + const dir = mkdtempSync(join(tmpdir(), "tegrad-updater-test-")); + tempDirs.push(dir); + return dir; +} + +beforeAll(async () => { + await ready(); +}); + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +function buildSignedManifest( + version: string, + channel: "stable" | "beta" | "nightly", + binaryBytes: Uint8Array, + secretKey: Uint8Array, + assetUrl: string = `https://github.com/codebyant/tegrad/releases/download/v${version}/tegrad-linux-x64`, +) { + const sha = computeBytesSha256(binaryBytes); + const unsigned: UnsignedReleaseManifest = { + v: MANIFEST_SCHEMA_VERSION, + channel, + version, + tag: `v${version}`, + published_at: 1_795_300_000_000, + assets: { + "linux-x64": { + url: assetUrl, + sha256: sha, + size: binaryBytes.byteLength, + }, + "linux-arm64": { + url: assetUrl.replace("linux-x64", "linux-arm64"), + sha256: sha, + size: binaryBytes.byteLength, + }, + }, + }; + return signManifest(unsigned, secretKey); +} + +describe("updater (checkForUpdate and createAutoUpdater)", () => { + test("verifies manifest signature, downloads binary, checks SHA-256, and stages files with ready.json written last", async () => { + const stateDir = makeTempDir(); + const keyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const binBytes = new TextEncoder().encode("#!/bin/sh\n# never executed by agent\n"); + const manifest = buildSignedManifest("0.2.0", "stable", binBytes, keyPair.secretKey); + const fetchedUrls: string[] = []; + + const result = await checkForUpdate({ + stateDir, + channel: "stable", + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + now: () => 1_795_300_123_000, + fetch: async (input) => { + const url = String(input); + fetchedUrls.push(url); + if (url.endsWith("/stable.json")) { + return new Response(JSON.stringify(manifest), { status: 200 }); + } + if (url === manifest.assets["linux-x64"].url) { + return new Response(binBytes, { + status: 200, + headers: { "content-length": String(binBytes.byteLength) }, + }); + } + return new Response("Not found", { status: 404 }); + }, + }); + + expect(result.status).toBe("staged"); + if (result.status !== "staged") return; + + expect(result.targetVersion).toBe("0.2.0"); + expect(result.sha256).toBe(computeBytesSha256(binBytes)); + expect(fetchedUrls.length).toBe(2); + + const { updateDir } = getStatePaths(stateDir); + expect(existsSync(join(updateDir, STAGED_BINARY_NAME))).toBe(true); + expect(existsSync(join(updateDir, STAGED_MANIFEST_NAME))).toBe(true); + expect(existsSync(join(updateDir, READY_FILE_NAME))).toBe(true); + + const stagedBin = readFileSync(join(updateDir, STAGED_BINARY_NAME)); + expect(Buffer.compare(stagedBin, Buffer.from(binBytes))).toBe(0); + + const readyData = readyFileSchema.parse( + JSON.parse(readFileSync(join(updateDir, READY_FILE_NAME), "utf8")), + ); + expect(readyData.version).toBe("0.2.0"); + expect(readyData.sha256).toBe(computeBytesSha256(binBytes)); + + if (process.platform !== "win32") { + expect(statSync(updateDir).mode & 0o777).toBe(0o700); + expect(statSync(join(updateDir, STAGED_BINARY_NAME)).mode & 0o777).toBe(0o600); + expect(statSync(join(updateDir, STAGED_MANIFEST_NAME)).mode & 0o777).toBe(0o600); + expect(statSync(join(updateDir, READY_FILE_NAME)).mode & 0o777).toBe(0o600); + } + }); + + test("verifies manifest signature BEFORE attempting to download binary", async () => { + const stateDir = makeTempDir(); + const attacker = generateSigningKeyPair(); + const binBytes = new TextEncoder().encode("malicious-binary"); + const forged = buildSignedManifest("9.9.9", "stable", binBytes, attacker.secretKey); + const fetchedUrls: string[] = []; + + try { + await checkForUpdate({ + stateDir, + channel: "stable", + currentVersion: "0.1.0", + arch: "linux-x64", + fetch: async (input) => { + const url = String(input); + fetchedUrls.push(url); + if (url.endsWith("/stable.json")) { + return new Response(JSON.stringify(forged), { status: 200 }); + } + throw new Error("Binary download should never be attempted for an untrusted manifest"); + }, + }); + throw new Error("Expected bad_manifest_signature"); + } catch (err) { + expect(err).toBeInstanceOf(UpdateError); + expect((err as UpdateError).code).toBe("bad_manifest_signature"); + } + + expect(fetchedUrls.length).toBe(1); + const { updateDir } = getStatePaths(stateDir); + expect(existsSync(join(updateDir, READY_FILE_NAME))).toBe(false); + }); + + test("deletes temp file and never creates ready.json when downloaded binary SHA-256 mismatches", async () => { + const stateDir = makeTempDir(); + const keyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const expectedBytes = new TextEncoder().encode("legitimate-binary-bytes"); + const tamperedBytes = new TextEncoder().encode("tampered-binary-byteXXX"); + const manifest = buildSignedManifest("0.2.0", "stable", expectedBytes, keyPair.secretKey); + + try { + await checkForUpdate({ + stateDir, + channel: "stable", + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + fetch: async (input) => { + const url = String(input); + if (url.endsWith("/stable.json")) { + return new Response(JSON.stringify(manifest), { status: 200 }); + } + return new Response(tamperedBytes, { status: 200 }); + }, + }); + throw new Error("Expected hash_mismatch"); + } catch (err) { + expect(err).toBeInstanceOf(UpdateError); + expect((err as UpdateError).code).toBe("hash_mismatch"); + } + + const { updateDir } = getStatePaths(stateDir); + expect(readdirSync(updateDir)).toEqual([]); + expect(existsSync(join(updateDir, READY_FILE_NAME))).toBe(false); + }); + + test("refuses non-https manifest URLs, non-https asset URLs, and disallowed asset hosts", async () => { + const stateDir = makeTempDir(); + const keyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const binBytes = new TextEncoder().encode("binary"); + + // Non-https manifest base URL + await expect( + checkForUpdate({ + stateDir, + manifestBaseUrl: "http://github.com/codebyant/tegrad/releases/latest/download", + currentVersion: "0.1.0", + arch: "linux-x64", + fetch: async () => new Response("{}", { status: 200 }), + }), + ).rejects.toMatchObject({ code: "invalid_url" }); + + // Signed manifest pointing to an untrusted host + const badHostManifest = buildSignedManifest( + "0.2.0", + "stable", + binBytes, + keyPair.secretKey, + "https://evil.attacker.example/tegrad-linux-x64", + ); + + let binaryFetched = false; + await expect( + checkForUpdate({ + stateDir, + channel: "stable", + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + fetch: async (input) => { + if (String(input).endsWith("/stable.json")) { + return new Response(JSON.stringify(badHostManifest), { status: 200 }); + } + binaryFetched = true; + return new Response(binBytes, { status: 200 }); + }, + }), + ).rejects.toMatchObject({ code: "host_not_allowed" }); + + expect(binaryFetched).toBe(false); + }); + + test("returns up_to_date on equal or older version unless allowDowngrade is true", async () => { + const stateDir = makeTempDir(); + const keyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const binBytes = new TextEncoder().encode("older-binary"); + const manifest = buildSignedManifest("0.1.0", "stable", binBytes, keyPair.secretKey); + let binaryDownloads = 0; + + const fakeFetch = async (input: string | URL | Request) => { + if (String(input).endsWith("/stable.json")) { + return new Response(JSON.stringify(manifest), { status: 200 }); + } + binaryDownloads++; + return new Response(binBytes, { status: 200 }); + }; + + const resBlocked = await checkForUpdate({ + stateDir, + channel: "stable", + currentVersion: "0.2.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + fetch: fakeFetch, + }); + expect(resBlocked.status).toBe("up_to_date"); + expect(binaryDownloads).toBe(0); + + const resAllowed = await checkForUpdate({ + stateDir, + channel: "stable", + currentVersion: "0.2.0", + allowDowngrade: true, + arch: "linux-x64", + publicKey: keyPair.publicKey, + fetch: fakeFetch, + }); + expect(resAllowed.status).toBe("staged"); + expect(binaryDownloads).toBe(1); + }); + + test("auto-updater schedules 6h checks with ±10% jitter and respects auto: false", async () => { + expect( + computeNextCheckDelayMs(DEFAULT_UPDATE_INTERVAL_MS, DEFAULT_UPDATE_JITTER_RATIO, () => 0), + ).toBe(Math.round(DEFAULT_UPDATE_INTERVAL_MS * 0.9)); + expect( + computeNextCheckDelayMs(DEFAULT_UPDATE_INTERVAL_MS, DEFAULT_UPDATE_JITTER_RATIO, () => 1), + ).toBe(Math.round(DEFAULT_UPDATE_INTERVAL_MS * 1.1)); + + const stateDir = makeTempDir(); + const scheduled: { fn: () => void; ms: number }[] = []; + const fakeTimers: TimerProvider = { + setTimeout(fn, ms) { + const entry = { fn, ms }; + scheduled.push(entry); + return entry; + }, + clearTimeout() {}, + setInterval() { + return 0; + }, + clearInterval() {}, + now: () => 0, + }; + + const disabled = createAutoUpdater({ + stateDir, + auto: false, + timers: fakeTimers, + fetch: async () => new Response("{}", { status: 404 }), + }); + disabled.start(); + expect(disabled.isRunning()).toBe(false); + expect(scheduled.length).toBe(0); + + const enabled = createAutoUpdater({ + stateDir, + auto: true, + timers: fakeTimers, + random: () => 0.5, + fetch: async () => new Response("{}", { status: 404 }), + }); + enabled.start(); + expect(enabled.isRunning()).toBe(true); + expect(scheduled.length).toBe(1); + expect(scheduled[0]?.ms).toBe(DEFAULT_UPDATE_INTERVAL_MS); + enabled.stop(); + expect(enabled.isRunning()).toBe(false); + }); + + test("loadConfig parses optional update configuration and rejects insecure manifest_base_url", () => { + const stateDir = makeTempDir(); + const { configPath } = getStatePaths(stateDir); + + writeFileSync( + configPath, + JSON.stringify({ + api_url: "https://api.tegramc.com", + update: { + channel: "beta", + auto: false, + manifest_base_url: "https://releases.tegramc.com", + }, + }), + "utf8", + ); + + const cfg = loadConfig(stateDir); + expect(cfg.update).toEqual({ + channel: "beta", + auto: false, + manifestBaseUrl: "https://releases.tegramc.com/", + }); + + writeFileSync( + configPath, + JSON.stringify({ + api_url: "https://api.tegramc.com", + update: { + manifest_base_url: "http://releases.tegramc.com", + }, + }), + "utf8", + ); + expect(() => loadConfig(stateDir)).toThrow(StateError); + }); + + test("updater.ts never invokes child_process, Bun.spawn, or runFixed (never executes downloaded binary)", () => { + const updaterSource = readFileSync(join(import.meta.dir, "updater.ts"), "utf8"); + expect(updaterSource).not.toMatch(/\bBun\.spawn\b/); + expect(updaterSource).not.toMatch(/\bchild_process\b/); + expect(updaterSource).not.toMatch(/\brunFixed\b/); + expect(updaterSource).not.toMatch(/\bexecFile\b/); + expect(updaterSource).not.toMatch(/\bspawnSync\b/); + }); +}); diff --git a/src/update/updater.ts b/src/update/updater.ts new file mode 100644 index 0000000..540bab8 --- /dev/null +++ b/src/update/updater.ts @@ -0,0 +1,677 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { createHash, randomBytes as nodeRandomBytes } from "node:crypto"; +import { + chmodSync, + closeSync, + existsSync, + fsyncSync, + lstatSync, + mkdirSync, + openSync, + renameSync, + unlinkSync, + writeSync, +} from "node:fs"; +import { join } from "node:path"; +import { z } from "zod"; +import { + defaultTimers, + type FetchLike, + getStatePaths, + type Logger, + type TimerHandle, + type TimerProvider, + writeFileAtomic, +} from "../agent"; +import { type PublicKey, ready } from "../crypto"; +import { VERSION } from "../version"; +import { type ReleaseChannel, releaseChannelSchema, shouldUpdate } from "./channels"; +import { UpdateError } from "./errors"; +import { + type ReleaseArch, + type ReleaseManifest, + resolveReleaseArch, + verifyManifest, +} from "./manifest"; + +export const DEFAULT_UPDATE_CHANNEL: ReleaseChannel = "stable"; +export const DEFAULT_UPDATE_INTERVAL_MS = 6 * 60 * 60 * 1000; +export const DEFAULT_UPDATE_JITTER_RATIO = 0.1; +export const DEFAULT_MANIFEST_BASE_URL = + "https://github.com/codebyant/tegrad/releases/latest/download"; + +export const DEFAULT_ALLOWED_ASSET_HOSTS: readonly string[] = [ + "github.com", + "objects.githubusercontent.com", + "release-assets.githubusercontent.com", +]; + +export const MAX_MANIFEST_BYTES = 64 * 1024; +export const MAX_BINARY_BYTES = 200 * 1024 * 1024; +export const DEFAULT_MANIFEST_TIMEOUT_MS = 30_000; +export const DEFAULT_BINARY_TIMEOUT_MS = 120_000; + +export const STAGED_BINARY_NAME = "staged-tegrad"; +export const STAGED_MANIFEST_NAME = "staged-manifest.json"; +export const READY_FILE_NAME = "ready.json"; + +const UPDATE_DIR_MODE = 0o700; +const STAGED_FILE_MODE = 0o600; + +export const readyFileSchema = z + .object({ + v: z.literal(1), + channel: releaseChannelSchema, + version: z.string().min(1), + tag: z.string().min(1), + arch: z.enum(["linux-x64", "linux-arm64"]), + sha256: z.string().regex(/^[0-9a-f]{64}$/), + size: z.number().int().positive(), + staged_at: z.number().int().nonnegative(), + }) + .strict(); + +export type ReadyFile = z.infer; + +function isPosix(platform: NodeJS.Platform = process.platform): boolean { + return platform !== "win32"; +} + +function parseStrictHttpsUrl(rawUrl: string, label: string): URL { + let parsed: URL; + try { + parsed = new URL(rawUrl); + } catch { + throw new UpdateError("invalid_url", `Invalid ${label}: "${rawUrl}"`); + } + + if (parsed.protocol !== "https:") { + throw new UpdateError( + "invalid_url", + `${label} must use https:// (got ${parsed.protocol}//${parsed.host})`, + ); + } + + if (parsed.username.length > 0 || parsed.password.length > 0) { + throw new UpdateError("invalid_url", `${label} must not contain embedded credentials`); + } + + if (parsed.hostname.length === 0) { + throw new UpdateError("invalid_url", `${label} must include a hostname`); + } + + return parsed; +} + +export function validateAssetUrl(rawUrl: string, allowedHosts: ReadonlySet): URL { + const parsed = parseStrictHttpsUrl(rawUrl, "asset URL"); + const host = parsed.hostname.toLowerCase(); + if (!allowedHosts.has(host)) { + throw new UpdateError( + "host_not_allowed", + `Asset URL host "${host}" is not in the allowed host list`, + ); + } + return parsed; +} + +export function buildManifestUrl(manifestBaseUrl: string, channel: ReleaseChannel): string { + const parsed = parseStrictHttpsUrl(manifestBaseUrl, "manifest_base_url"); + const normalized = parsed.toString().replace(/\/+$/, ""); + return `${normalized}/${channel}.json`; +} + +export function ensureSafeUpdateDir( + stateDir: string, + platform: NodeJS.Platform = process.platform, +): string { + if (existsSync(stateDir)) { + const stateStat = lstatSync(stateDir); + if (stateStat.isSymbolicLink() || !stateStat.isDirectory()) { + throw new UpdateError("unsafe_path", `State directory ${stateDir} must be a real directory`); + } + } else { + mkdirSync(stateDir, { recursive: true, mode: UPDATE_DIR_MODE }); + if (isPosix(platform)) { + chmodSync(stateDir, UPDATE_DIR_MODE); + } + } + + const { updateDir } = getStatePaths(stateDir); + if (existsSync(updateDir)) { + const stat = lstatSync(updateDir); + if (stat.isSymbolicLink() || !stat.isDirectory()) { + throw new UpdateError("unsafe_path", `Update directory ${updateDir} must not be a symlink`); + } + if (isPosix(platform)) { + chmodSync(updateDir, UPDATE_DIR_MODE); + } + } else { + mkdirSync(updateDir, { recursive: true, mode: UPDATE_DIR_MODE }); + if (isPosix(platform)) { + chmodSync(updateDir, UPDATE_DIR_MODE); + } + } + + return updateDir; +} + +async function fetchWithTimeout( + fetchImpl: FetchLike, + url: string, + timeoutMs: number, +): Promise { + const controller = new AbortController(); + const timer = setTimeout(() => { + controller.abort(); + }, timeoutMs); + + try { + return await fetchImpl(url, { + method: "GET", + signal: controller.signal, + headers: { + accept: "application/octet-stream, application/json", + }, + }); + } catch (err) { + throw new UpdateError( + "download_failed", + `Failed to fetch ${url}: ${err instanceof Error ? err.message : String(err)}`, + ); + } finally { + clearTimeout(timer); + } +} + +async function readResponseBytesCapped(response: Response, maxBytes: number): Promise { + const contentLengthHeader = response.headers.get("content-length"); + if (contentLengthHeader !== null) { + const declared = Number(contentLengthHeader); + if (Number.isFinite(declared) && declared > maxBytes) { + throw new UpdateError( + "size_limit_exceeded", + `Response exceeds maximum allowed size of ${maxBytes} bytes`, + ); + } + } + + if (response.body === null) { + const arr = new Uint8Array(await response.arrayBuffer()); + if (arr.byteLength > maxBytes) { + throw new UpdateError( + "size_limit_exceeded", + `Response exceeds maximum allowed size of ${maxBytes} bytes`, + ); + } + return arr; + } + + const reader = response.body.getReader(); + const chunks: Uint8Array[] = []; + let total = 0; + + try { + while (true) { + const { value, done } = await reader.read(); + if (done) break; + if (value === undefined || value.byteLength === 0) continue; + total += value.byteLength; + if (total > maxBytes) { + await reader.cancel(); + throw new UpdateError( + "size_limit_exceeded", + `Response exceeds maximum allowed size of ${maxBytes} bytes`, + ); + } + chunks.push(value); + } + } finally { + reader.releaseLock(); + } + + const combined = new Uint8Array(total); + let offset = 0; + for (const chunk of chunks) { + combined.set(chunk, offset); + offset += chunk.byteLength; + } + return combined; +} + +async function downloadAndHashToTempFile( + response: Response, + tmpPath: string, + expectedSize: number, + maxBytes: number, +): Promise<{ readonly sha256: string; readonly size: number }> { + const effectiveCap = Math.min(expectedSize, maxBytes); + const contentLengthHeader = response.headers.get("content-length"); + if (contentLengthHeader !== null) { + const declared = Number(contentLengthHeader); + if (Number.isFinite(declared) && declared > maxBytes) { + throw new UpdateError( + "size_limit_exceeded", + `Binary exceeds maximum allowed size of ${maxBytes} bytes`, + ); + } + if (Number.isFinite(declared) && declared !== expectedSize) { + throw new UpdateError( + "size_mismatch", + `Binary Content-Length (${declared}) does not match manifest size (${expectedSize})`, + ); + } + } + + const hasher = createHash("sha256"); + let total = 0; + let fd: number | undefined; + + try { + fd = openSync(tmpPath, "wx", STAGED_FILE_MODE); + + if (response.body === null) { + const bytes = new Uint8Array(await response.arrayBuffer()); + if (bytes.byteLength > maxBytes) { + throw new UpdateError( + "size_limit_exceeded", + `Binary exceeds maximum allowed size of ${maxBytes} bytes`, + ); + } + if (bytes.byteLength !== expectedSize) { + throw new UpdateError( + "size_mismatch", + `Downloaded binary size (${bytes.byteLength}) does not match manifest size (${expectedSize})`, + ); + } + writeSync(fd, bytes); + hasher.update(bytes); + total = bytes.byteLength; + } else { + const reader = response.body.getReader(); + try { + while (true) { + const { value, done } = await reader.read(); + if (done) break; + if (value === undefined || value.byteLength === 0) continue; + total += value.byteLength; + if (total > maxBytes) { + await reader.cancel(); + throw new UpdateError( + "size_limit_exceeded", + `Binary exceeds maximum allowed size of ${maxBytes} bytes`, + ); + } + if (total > effectiveCap) { + await reader.cancel(); + throw new UpdateError( + "size_mismatch", + `Downloaded binary exceeded manifest size of ${expectedSize} bytes`, + ); + } + writeSync(fd, value); + hasher.update(value); + } + } finally { + reader.releaseLock(); + } + } + + fsyncSync(fd); + closeSync(fd); + fd = undefined; + + if (total !== expectedSize) { + throw new UpdateError( + "size_mismatch", + `Downloaded binary size (${total}) does not match manifest size (${expectedSize})`, + ); + } + + return { sha256: hasher.digest("hex"), size: total }; + } catch (err) { + if (fd !== undefined) { + try { + closeSync(fd); + } catch { + // ignore close error during cleanup + } + } + try { + if (existsSync(tmpPath)) { + unlinkSync(tmpPath); + } + } catch { + // ignore cleanup error + } + throw err; + } +} + +export interface CheckForUpdateOptions { + readonly stateDir: string; + readonly channel?: ReleaseChannel; + readonly currentVersion?: string; + readonly manifestBaseUrl?: string; + readonly allowDowngrade?: boolean; + readonly arch?: ReleaseArch; + readonly publicKey?: PublicKey; + readonly allowedHosts?: readonly string[]; + readonly maxManifestBytes?: number; + readonly maxBinaryBytes?: number; + readonly manifestTimeoutMs?: number; + readonly binaryTimeoutMs?: number; + readonly fetch?: FetchLike; + readonly now?: () => number; + readonly platform?: NodeJS.Platform; +} + +export type CheckForUpdateResult = + | { + readonly status: "up_to_date"; + readonly channel: ReleaseChannel; + readonly currentVersion: string; + readonly latestVersion: string; + } + | { + readonly status: "staged"; + readonly channel: ReleaseChannel; + readonly currentVersion: string; + readonly targetVersion: string; + readonly tag: string; + readonly arch: ReleaseArch; + readonly sha256: string; + readonly size: number; + readonly stagedBinaryPath: string; + readonly stagedManifestPath: string; + readonly readyPath: string; + }; + +export async function checkForUpdate( + options: CheckForUpdateOptions, +): Promise { + await ready(); + + const channel = options.channel ?? DEFAULT_UPDATE_CHANNEL; + const currentVersion = options.currentVersion ?? VERSION; + const manifestBaseUrl = options.manifestBaseUrl ?? DEFAULT_MANIFEST_BASE_URL; + const maxManifestBytes = options.maxManifestBytes ?? MAX_MANIFEST_BYTES; + const maxBinaryBytes = options.maxBinaryBytes ?? MAX_BINARY_BYTES; + const manifestTimeoutMs = options.manifestTimeoutMs ?? DEFAULT_MANIFEST_TIMEOUT_MS; + const binaryTimeoutMs = options.binaryTimeoutMs ?? DEFAULT_BINARY_TIMEOUT_MS; + const fetchImpl = options.fetch ?? fetch; + const now = options.now ?? (() => Date.now()); + const platform = options.platform ?? process.platform; + + const manifestUrl = buildManifestUrl(manifestBaseUrl, channel); + const manifestHost = new URL(manifestUrl).hostname.toLowerCase(); + + const allowedHosts = new Set( + options.allowedHosts !== undefined + ? options.allowedHosts.map((h) => h.toLowerCase()) + : [...DEFAULT_ALLOWED_ASSET_HOSTS, manifestHost], + ); + + // 1. Download manifest with strict size cap and timeout + const manifestResponse = await fetchWithTimeout(fetchImpl, manifestUrl, manifestTimeoutMs); + if (!manifestResponse.ok) { + throw new UpdateError( + "download_failed", + `Failed to download manifest ${manifestUrl}: HTTP ${manifestResponse.status}`, + ); + } + const manifestBytes = await readResponseBytesCapped(manifestResponse, maxManifestBytes); + + let rawManifest: unknown; + try { + rawManifest = JSON.parse(new TextDecoder().decode(manifestBytes)) as unknown; + } catch { + throw new UpdateError("invalid_manifest", "Downloaded release manifest is not valid JSON"); + } + + // 2. Verify Ed25519 signature BEFORE trusting any field in the manifest + const manifest: ReleaseManifest = verifyManifest(rawManifest, { + expectedChannel: channel, + ...(options.publicKey !== undefined ? { publicKey: options.publicKey } : {}), + }); + + // 3. Compare versions + const needsUpdate = shouldUpdate(currentVersion, manifest.version, { + allowDowngrade: options.allowDowngrade === true, + }); + if (!needsUpdate) { + return { + status: "up_to_date", + channel, + currentVersion, + latestVersion: manifest.version, + }; + } + + // 4. Select architecture asset and validate HTTPS + allowed host + size cap + const arch = options.arch ?? resolveReleaseArch(platform); + const asset = manifest.assets[arch]; + validateAssetUrl(asset.url, allowedHosts); + + if (asset.size > maxBinaryBytes) { + throw new UpdateError( + "size_limit_exceeded", + `Manifest asset size (${asset.size}) exceeds maximum allowed size (${maxBinaryBytes})`, + ); + } + + // 5. Ensure /var/lib/tegrad/update exists with mode 0700 and no symlinks + const updateDir = ensureSafeUpdateDir(options.stateDir, platform); + + // 6. Download binary into temporary file inside updateDir + const suffix = nodeRandomBytes(8).toString("hex"); + const tmpBinaryPath = join(updateDir, `.tmp-${STAGED_BINARY_NAME}-${process.pid}-${suffix}`); + const binResponse = await fetchWithTimeout(fetchImpl, asset.url, binaryTimeoutMs); + if (!binResponse.ok) { + throw new UpdateError( + "download_failed", + `Failed to download update binary ${asset.url}: HTTP ${binResponse.status}`, + ); + } + + const { sha256, size } = await downloadAndHashToTempFile( + binResponse, + tmpBinaryPath, + asset.size, + maxBinaryBytes, + ); + + // 7. Verify SHA-256 against signed manifest; delete temp file immediately on mismatch + if (sha256 !== asset.sha256) { + try { + if (existsSync(tmpBinaryPath)) { + unlinkSync(tmpBinaryPath); + } + } catch { + // ignore cleanup error + } + throw new UpdateError( + "hash_mismatch", + `Downloaded binary SHA-256 mismatch (expected ${asset.sha256}, got ${sha256})`, + ); + } + + // 8. Atomically promote staged-tegrad, staged-manifest.json, and LAST ready.json + const stagedBinaryPath = join(updateDir, STAGED_BINARY_NAME); + const stagedManifestPath = join(updateDir, STAGED_MANIFEST_NAME); + const readyPath = join(updateDir, READY_FILE_NAME); + + try { + if (isPosix(platform)) { + chmodSync(tmpBinaryPath, STAGED_FILE_MODE); + } + renameSync(tmpBinaryPath, stagedBinaryPath); + } catch (err) { + try { + if (existsSync(tmpBinaryPath)) { + unlinkSync(tmpBinaryPath); + } + } catch { + // ignore cleanup error + } + throw err; + } + + writeFileAtomic(stagedManifestPath, `${JSON.stringify(manifest, null, 2)}\n`, { + mode: STAGED_FILE_MODE, + dirMode: UPDATE_DIR_MODE, + }); + + const readyPayload: ReadyFile = { + v: 1, + channel, + version: manifest.version, + tag: manifest.tag, + arch, + sha256, + size, + staged_at: now(), + }; + + writeFileAtomic(readyPath, `${JSON.stringify(readyPayload, null, 2)}\n`, { + mode: STAGED_FILE_MODE, + dirMode: UPDATE_DIR_MODE, + }); + + return { + status: "staged", + channel, + currentVersion, + targetVersion: manifest.version, + tag: manifest.tag, + arch, + sha256, + size, + stagedBinaryPath, + stagedManifestPath, + readyPath, + }; +} + +export function computeNextCheckDelayMs( + intervalMs: number = DEFAULT_UPDATE_INTERVAL_MS, + jitterRatio: number = DEFAULT_UPDATE_JITTER_RATIO, + random: () => number = Math.random, +): number { + const clampedRandom = Math.min(1, Math.max(0, random())); + const clampedJitter = Math.min(0.5, Math.max(0, jitterRatio)); + const factor = 1 - clampedJitter + 2 * clampedJitter * clampedRandom; + return Math.max(1, Math.round(intervalMs * factor)); +} + +export interface AutoUpdaterOptions extends CheckForUpdateOptions { + readonly auto?: boolean; + readonly intervalMs?: number; + readonly jitterRatio?: number; + readonly timers?: TimerProvider; + readonly random?: () => number; + readonly logger?: Logger; + readonly onStaged?: (result: Extract) => void; +} + +export interface AutoUpdater { + start(): void; + stop(): void; + checkNow(): Promise; + isRunning(): boolean; +} + +export function createAutoUpdater(options: AutoUpdaterOptions): AutoUpdater { + const auto = options.auto ?? true; + const intervalMs = options.intervalMs ?? DEFAULT_UPDATE_INTERVAL_MS; + const jitterRatio = options.jitterRatio ?? DEFAULT_UPDATE_JITTER_RATIO; + const timers = options.timers ?? defaultTimers; + const random = options.random ?? Math.random; + + let running = false; + let timerHandle: TimerHandle | null = null; + let inFlight: Promise | null = null; + + function clearTimer(): void { + if (timerHandle !== null) { + timers.clearTimeout(timerHandle); + timerHandle = null; + } + } + + function scheduleNext(): void { + if (!running || !auto) { + return; + } + clearTimer(); + const delayMs = computeNextCheckDelayMs(intervalMs, jitterRatio, random); + timerHandle = timers.setTimeout(() => { + timerHandle = null; + if (!running) return; + void runCheck().finally(() => { + if (running) { + scheduleNext(); + } + }); + }, delayMs); + } + + async function runCheck(): Promise { + if (inFlight !== null) { + return inFlight; + } + inFlight = (async () => { + try { + const result = await checkForUpdate(options); + if (result.status === "staged") { + options.logger?.info("Staged verified update", { + channel: result.channel, + version: result.targetVersion, + arch: result.arch, + }); + options.onStaged?.(result); + } else { + options.logger?.debug("Agent is up to date", { + channel: result.channel, + version: result.currentVersion, + }); + } + return result; + } catch (err) { + options.logger?.warn("Update check failed", { + code: err instanceof UpdateError ? err.code : "unknown", + message: err instanceof Error ? err.message : String(err), + }); + return null; + } finally { + inFlight = null; + } + })(); + return inFlight; + } + + return { + start(): void { + if (running || !auto) { + return; + } + running = true; + scheduleNext(); + }, + + stop(): void { + running = false; + clearTimer(); + }, + + checkNow(): Promise { + return runCheck(); + }, + + isRunning(): boolean { + return running; + }, + }; +} From ed4b3c8d33d77a67954a00a7e65b2f0703bda3cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 22 Nov 2026 20:19:26 -0300 Subject: [PATCH 10/59] fix: harden update staging against dangling symlinks, redirect bypass, and runtime startup --- .github/workflows/release.yml | 13 ++ install/install.sh | 8 + src/cli/run.ts | 20 +++ src/install/units.test.ts | 67 ++++++++ src/update/apply.test.ts | 314 +++++++++++++++++++++++++++++++++- src/update/apply.ts | 103 ++++++++--- src/update/updater.test.ts | 31 ++++ src/update/updater.ts | 47 ++++- 8 files changed, 574 insertions(+), 29 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cb9cb00..c881013 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,12 +40,25 @@ jobs: TAG="v${BASE_VERSION}-nightly.${STAMP}" fi CHANNEL=$(bun -e 'import { parseReleaseTag } from "./src/update/channels"; process.stdout.write(parseReleaseTag(process.argv[1] ?? "").channel)' -- "$TAG") + VERSION=$(bun -e 'import { parseReleaseTag } from "./src/update/channels"; process.stdout.write(parseReleaseTag(process.argv[1] ?? "").raw)' -- "$TAG") printf 'tag=%s\n' "$TAG" >> "$GITHUB_OUTPUT" + printf 'version=%s\n' "$VERSION" >> "$GITHUB_OUTPUT" printf 'channel=%s\n' "$CHANNEL" >> "$GITHUB_OUTPUT" - name: Build Linux release binaries + env: + RELEASE_VERSION: ${{ steps.meta.outputs.version }} run: | set -eu + bun -e ' + import { readFileSync, writeFileSync } from "node:fs"; + const ver = process.env.RELEASE_VERSION; + if (!ver) throw new Error("Missing RELEASE_VERSION"); + const src = readFileSync("src/version.ts", "utf8"); + const updated = src.replace(/export const VERSION = "[^"]+";/, `export const VERSION = "${ver}";`); + if (updated === src && !src.includes(`"${ver}"`)) throw new Error("Failed to stamp src/version.ts"); + writeFileSync("src/version.ts", updated, "utf8"); + ' mkdir -p dist bun build --compile src/index.ts --target=bun-linux-x64 --outfile dist/tegrad-linux-x64 bun build --compile src/index.ts --target=bun-linux-arm64 --outfile dist/tegrad-linux-arm64 diff --git a/install/install.sh b/install/install.sh index 18374bf..5e86997 100755 --- a/install/install.sh +++ b/install/install.sh @@ -555,6 +555,14 @@ verify_sha256sums_signature() { if [ -z "$_vs_raw" ]; then die "SHA256SUMS.sig is empty" fi + case "$_vs_raw" in + *[!A-Za-z0-9_-]*) + die "Invalid base64url characters in SHA256SUMS.sig" + ;; + esac + if [ "${#_vs_raw}" -ne 86 ]; then + die "Invalid Ed25519 signature length in SHA256SUMS.sig" + fi _vs_b64=$(printf '%s' "$_vs_raw" | tr '_-' '/+') case $(( ${#_vs_b64} % 4 )) in diff --git a/src/cli/run.ts b/src/cli/run.ts index 06b8355..2a4a5d3 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -9,6 +9,7 @@ import { createCommandQueue, createFileTrustContext, createLogger, + type FetchLike, type FileTrustContext, type Logger, loadConfig, @@ -19,6 +20,7 @@ import { } from "../agent"; import { fingerprint } from "../crypto"; import { type CommandRegistry, createCoreRegistry, type TransportFrame } from "../protocol"; +import { type AutoUpdater, createAutoUpdater } from "../update"; export const SHUTDOWN_DRAIN_TIMEOUT_MS = 10_000; @@ -43,6 +45,7 @@ export interface AgentRuntime { readonly connection: AgentConnection; readonly queue: CommandQueue; readonly trust: FileTrustContext; + readonly updater: AutoUpdater; readonly logger: Logger; start(): void; shutdown(drainTimeoutMs?: number): Promise; @@ -54,6 +57,7 @@ export interface CreateAgentRuntimeOptions { readonly logger?: Logger; readonly registry?: CommandRegistry; readonly webSocketFactory?: WebSocketFactory; + readonly fetch?: FetchLike; readonly timers?: TimerProvider; readonly now?: () => number; readonly geteuid?: () => number; @@ -104,6 +108,19 @@ export async function createAgentRuntime( }); connectionRef = connection; + const updater = createAutoUpdater({ + stateDir: options.stateDir, + logger, + ...(config.update?.channel !== undefined ? { channel: config.update.channel } : {}), + ...(config.update?.auto !== undefined ? { auto: config.update.auto } : {}), + ...(config.update?.manifestBaseUrl !== undefined + ? { manifestBaseUrl: config.update.manifestBaseUrl } + : {}), + ...(options.fetch !== undefined ? { fetch: options.fetch } : {}), + ...(options.timers !== undefined ? { timers: options.timers } : {}), + ...(options.now !== undefined ? { now: options.now } : {}), + }); + let shutdownPromise: Promise | null = null; return { @@ -111,11 +128,13 @@ export async function createAgentRuntime( connection, queue, trust, + updater, logger, start(): void { logger.info("Starting tegrad", { agentId }); connection.start(); + updater.start(); }, shutdown(drainTimeoutMs: number = SHUTDOWN_DRAIN_TIMEOUT_MS): Promise { @@ -124,6 +143,7 @@ export async function createAgentRuntime( } shutdownPromise = (async () => { logger.info("Shutting down tegrad"); + updater.stop(); connection.stop(); const drained = await queue.drain(drainTimeoutMs); if (!drained) { diff --git a/src/install/units.test.ts b/src/install/units.test.ts index 767fd60..5cf27ea 100644 --- a/src/install/units.test.ts +++ b/src/install/units.test.ts @@ -419,6 +419,60 @@ describe("Security regression checks on install/ assets", () => { } }); + test("all @TEGRAD_...@ placeholders in units, tmpfiles, and polkit templates are completely replaced by both install.sh and .github/workflows/ci.yml", () => { + const templateRelPaths = [ + "units/tegrad.service", + "units/tegrad-update.service", + "units/tegrad-update.path", + "units/tegrad-server@.service", + "units/tegrad-server@.socket", + "tmpfiles/tegrad.conf", + "polkit/50-tegrad.rules", + ] as const; + + const installScript = readInstallFile("install.sh"); + const renderFnMatch = /render_template_file\(\)\s*\{([\s\S]*?)\n\}/.exec(installScript); + expect(renderFnMatch).not.toBeNull(); + const renderFnBody = renderFnMatch?.[1] ?? ""; + + const installPlaceholders = new Set(); + for (const match of renderFnBody.matchAll(/s\|(@[A-Z0-9_]+@)\|/g)) { + if (match[1]) { + installPlaceholders.add(match[1]); + } + } + + const ciYaml = readFileSync(join(REPO_ROOT, ".github", "workflows", "ci.yml"), "utf8"); + const ciReplacements = new Map(); + for (const match of ciYaml.matchAll(/s\|(@[A-Z0-9_]+@)\|([^|]+)\|g/g)) { + if (match[1] && match[2]) { + ciReplacements.set(match[1], match[2]); + } + } + + expect(installPlaceholders.size).toBeGreaterThanOrEqual(5); + expect(new Set(ciReplacements.keys())).toEqual(installPlaceholders); + + for (const relPath of templateRelPaths) { + const raw = readInstallFile(relPath); + + // Render using install.sh placeholder set + let renderedByInstaller = raw; + for (const placeholder of installPlaceholders) { + const replacement = ciReplacements.get(placeholder) ?? "/replaced"; + renderedByInstaller = renderedByInstaller.replaceAll(placeholder, replacement); + } + expect(renderedByInstaller).not.toMatch(/@[A-Z0-9_]+@/); + + // Render using ci.yml sed rules + let renderedByCi = raw; + for (const [placeholder, replacement] of ciReplacements.entries()) { + renderedByCi = renderedByCi.replaceAll(placeholder, replacement); + } + expect(renderedByCi).not.toMatch(/@[A-Z0-9_]+@/); + } + }); + const shPath = findPosixSh(); const hasOpenSsl = Bun.which("openssl") !== null; const opensslInteropTest = shPath !== null && hasOpenSsl ? test : test.skip; @@ -469,6 +523,19 @@ describe("Security regression checks on install/ assets", () => { writeFileSync(badSumsPath, sums.replace("tegrad-linux-x64", "tegrad-linux-x65"), "utf8"); const tamperedRes = await runVerify(badSumsPath, sigPath); expect(tamperedRes.code).not.toBe(0); + + // Tamper 1 character in SHA256SUMS.sig -> must fail closed + const badSigPath = join(tmpDir, "SHA256SUMS.sig.bad"); + const flippedFirst = (sig.startsWith("A") ? "B" : "A") + sig.slice(1); + writeFileSync(badSigPath, `${flippedFirst}\n`, "utf8"); + const badSigRes = await runVerify(sumsPath, badSigPath); + expect(badSigRes.code).not.toBe(0); + + // Truncated signature -> must fail closed + const shortSigPath = join(tmpDir, "SHA256SUMS.sig.short"); + writeFileSync(shortSigPath, `${sig.slice(0, 40)}\n`, "utf8"); + const shortSigRes = await runVerify(sumsPath, shortSigPath); + expect(shortSigRes.code).not.toBe(0); } finally { rmSync(tmpDir, { recursive: true, force: true }); } diff --git a/src/update/apply.test.ts b/src/update/apply.test.ts index bfa02f4..3ea1cd2 100644 --- a/src/update/apply.test.ts +++ b/src/update/apply.test.ts @@ -6,9 +6,11 @@ import { existsSync, mkdirSync, mkdtempSync, + readdirSync, readFileSync, rmSync, symlinkSync, + truncateSync, writeFileSync, } from "node:fs"; import { tmpdir } from "node:os"; @@ -19,7 +21,10 @@ import { applyStagedUpdate, computeBytesSha256, MANIFEST_SCHEMA_VERSION, + MAX_BINARY_BYTES, + MAX_MANIFEST_BYTES, READY_FILE_NAME, + type ReleaseChannel, STAGED_BINARY_NAME, STAGED_MANIFEST_NAME, signManifest, @@ -55,8 +60,10 @@ function stageFixture(params: { readonly currentBinaryBytes: Uint8Array; readonly stagedBinaryBytes: Uint8Array; readonly manifestVersion: string; + readonly channel?: ReleaseChannel; readonly signingSecretKey: Uint8Array; readonly hashOverride?: string; + readonly readyVersionOverride?: string; }): { readonly binDir: string; readonly binPath: string; @@ -72,10 +79,11 @@ function stageFixture(params: { const prevBinPath = join(binDir, "tegrad.prev"); writeFileSync(binPath, params.currentBinaryBytes); + const channel = params.channel ?? "stable"; const sha = params.hashOverride ?? computeBytesSha256(params.stagedBinaryBytes); const unsigned: UnsignedReleaseManifest = { v: MANIFEST_SCHEMA_VERSION, - channel: "stable", + channel, version: params.manifestVersion, tag: `v${params.manifestVersion}`, published_at: 1_795_300_000_000, @@ -96,13 +104,14 @@ function stageFixture(params: { writeFileSync(join(updateDir, STAGED_BINARY_NAME), params.stagedBinaryBytes); writeFileSync(join(updateDir, STAGED_MANIFEST_NAME), JSON.stringify(signed, null, 2), "utf8"); + const readyVer = params.readyVersionOverride ?? params.manifestVersion; writeFileSync( join(updateDir, READY_FILE_NAME), JSON.stringify({ v: 1, - channel: "stable", - version: params.manifestVersion, - tag: `v${params.manifestVersion}`, + channel, + version: readyVer, + tag: `v${readyVer}`, arch: "linux-x64", sha256: sha, size: params.stagedBinaryBytes.byteLength, @@ -450,4 +459,301 @@ describe("applyStagedUpdate (TOCTOU defense, verification, atomic install, rollb expect(stderr).toBe(""); expect(stdout).toContain("Applied v0.2.0"); }); + + test("adversarial: blocks replay/downgrade of older signed manifests even when ready.json claims a higher version", async () => { + const keyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const currentBytes = new TextEncoder().encode("current-v0.3.0-binary"); + const vulnerableOldBytes = new TextEncoder().encode("old-vulnerable-v0.0.1-binary"); + + const downgradeCases: readonly { + readonly currentVersion: string; + readonly manifestVersion: string; + readonly channel: ReleaseChannel; + }[] = [ + { currentVersion: "0.3.0", manifestVersion: "0.0.1", channel: "stable" }, + { currentVersion: "0.3.0", manifestVersion: "0.3.0", channel: "stable" }, + { + currentVersion: "0.3.0", + manifestVersion: "0.3.0-nightly.202611220600", + channel: "nightly", + }, + { + currentVersion: "0.3.0-nightly.202611220600", + manifestVersion: "0.3.0-beta.99", + channel: "beta", + }, + { + currentVersion: "0.3.0-nightly.202611230600", + manifestVersion: "0.3.0-nightly.202611220600", + channel: "nightly", + }, + { currentVersion: "0.3.0-beta.10", manifestVersion: "0.3.0-beta.2", channel: "beta" }, + ]; + + for (const tc of downgradeCases) { + const rootDir = makeTempDir(); + // Compromised tegrad user lies in ready.json claiming version 9.9.9, + // while staging a genuinely signed older manifest (tc.manifestVersion). + const fx = stageFixture({ + rootDir, + currentBinaryBytes: currentBytes, + stagedBinaryBytes: vulnerableOldBytes, + manifestVersion: tc.manifestVersion, + channel: tc.channel, + signingSecretKey: keyPair.secretKey, + readyVersionOverride: "9.9.9", + }); + + let systemctlCalled = false; + await expect( + applyStagedUpdate({ + updateDir: fx.updateDir, + binPath: fx.binPath, + currentVersion: tc.currentVersion, + arch: "linux-x64", + publicKey: keyPair.publicKey, + runCommand: async () => { + systemctlCalled = true; + return { code: 0, stdout: "active\n", stderr: "" }; + }, + }), + ).rejects.toMatchObject({ code: "downgrade_blocked" }); + + expect(systemctlCalled).toBe(false); + expect(Buffer.compare(readFileSync(fx.binPath), Buffer.from(currentBytes))).toBe(0); + expect(existsSync(fx.prevBinPath)).toBe(false); + // Staged files and ready.json must be cleaned up so systemd path unit cannot loop + expect(readdirSync(fx.updateDir)).toEqual([]); + expect(readdirSync(fx.binDir)).toEqual(["tegrad"]); + } + }); + + test("adversarial: rejects oversized (10 GB sparse / > MAX_BINARY_BYTES / > MAX_MANIFEST_BYTES) and empty staged files before filling binDir", async () => { + const keyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const currentBytes = new TextEncoder().encode("current-v0.1.0"); + const validBytes = new TextEncoder().encode("new-v0.2.0"); + + // Case 1: 10 GB sparse staged-tegrad file (> MAX_BINARY_BYTES = 200 MiB) + const rootDir1 = makeTempDir(); + const fx1 = stageFixture({ + rootDir: rootDir1, + currentBinaryBytes: currentBytes, + stagedBinaryBytes: validBytes, + manifestVersion: "0.2.0", + signingSecretKey: keyPair.secretKey, + }); + const tenGiB = 10 * 1024 * 1024 * 1024; + truncateSync(join(fx1.updateDir, STAGED_BINARY_NAME), tenGiB); + + await expect( + applyStagedUpdate({ + updateDir: fx1.updateDir, + binPath: fx1.binPath, + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), + }), + ).rejects.toMatchObject({ code: "size_limit_exceeded" }); + + expect(Buffer.compare(readFileSync(fx1.binPath), Buffer.from(currentBytes))).toBe(0); + // No temporary staging dirs left behind in binDir and staged files cleaned up + expect(readdirSync(fx1.binDir)).toEqual(["tegrad"]); + expect(readdirSync(fx1.updateDir)).toEqual([]); + + // Case 2: staged-manifest.json exceeds MAX_MANIFEST_BYTES (64 KiB) + const rootDir2 = makeTempDir(); + const fx2 = stageFixture({ + rootDir: rootDir2, + currentBinaryBytes: currentBytes, + stagedBinaryBytes: validBytes, + manifestVersion: "0.2.0", + signingSecretKey: keyPair.secretKey, + }); + truncateSync(join(fx2.updateDir, STAGED_MANIFEST_NAME), MAX_MANIFEST_BYTES + 1); + + await expect( + applyStagedUpdate({ + updateDir: fx2.updateDir, + binPath: fx2.binPath, + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), + }), + ).rejects.toMatchObject({ code: "size_limit_exceeded" }); + + expect(readdirSync(fx2.binDir)).toEqual(["tegrad"]); + expect(readdirSync(fx2.updateDir)).toEqual([]); + + // Case 3: empty (0-byte) staged-tegrad + const rootDir3 = makeTempDir(); + const fx3 = stageFixture({ + rootDir: rootDir3, + currentBinaryBytes: currentBytes, + stagedBinaryBytes: validBytes, + manifestVersion: "0.2.0", + signingSecretKey: keyPair.secretKey, + }); + truncateSync(join(fx3.updateDir, STAGED_BINARY_NAME), 0); + + await expect( + applyStagedUpdate({ + updateDir: fx3.updateDir, + binPath: fx3.binPath, + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), + }), + ).rejects.toMatchObject({ code: "apply_failed" }); + + expect(MAX_BINARY_BYTES).toBe(200 * 1024 * 1024); + expect(readdirSync(fx3.binDir)).toEqual(["tegrad"]); + expect(readdirSync(fx3.updateDir)).toEqual([]); + }); + + test("adversarial: rejects symlinks, dangling symlinks, and directory replacements for ready.json, staged-manifest.json, staged-tegrad, and updateDir", async () => { + const keyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const currentBytes = new TextEncoder().encode("current-v0.1.0"); + const newBytes = new TextEncoder().encode("new-v0.2.0"); + + // 1. Directory planted where ready.json or staged-tegrad is expected + for (const targetName of [READY_FILE_NAME, STAGED_BINARY_NAME, STAGED_MANIFEST_NAME]) { + const rootDir = makeTempDir(); + const fx = stageFixture({ + rootDir, + currentBinaryBytes: currentBytes, + stagedBinaryBytes: newBytes, + manifestVersion: "0.2.0", + signingSecretKey: keyPair.secretKey, + }); + const targetPath = join(fx.updateDir, targetName); + rmSync(targetPath, { force: true }); + mkdirSync(targetPath); + + await expect( + applyStagedUpdate({ + updateDir: fx.updateDir, + binPath: fx.binPath, + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), + }), + ).rejects.toMatchObject({ code: "unsafe_path" }); + + expect(Buffer.compare(readFileSync(fx.binPath), Buffer.from(currentBytes))).toBe(0); + } + + // 2. Live and dangling symlinks for ready.json, staged-manifest.json, staged-tegrad, and updateDir + const probeDir = makeTempDir(); + let symlinksSupported = false; + try { + const probeTarget = join(probeDir, "target"); + writeFileSync(probeTarget, "ok"); + symlinkSync(probeTarget, join(probeDir, "link")); + symlinksSupported = true; + } catch { + symlinksSupported = false; + } + + if (!symlinksSupported) { + return; + } + + for (const targetName of [READY_FILE_NAME, STAGED_MANIFEST_NAME, STAGED_BINARY_NAME]) { + for (const dangling of [false, true]) { + const rootDir = makeTempDir(); + const fx = stageFixture({ + rootDir, + currentBinaryBytes: currentBytes, + stagedBinaryBytes: newBytes, + manifestVersion: "0.2.0", + signingSecretKey: keyPair.secretKey, + }); + + const externalFile = join(rootDir, "protected-system-file"); + if (!dangling) { + writeFileSync(externalFile, "sensitive-root-content"); + } + const stagedTarget = join(fx.updateDir, targetName); + rmSync(stagedTarget, { force: true }); + symlinkSync(externalFile, stagedTarget); + + await expect( + applyStagedUpdate({ + updateDir: fx.updateDir, + binPath: fx.binPath, + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), + }), + ).rejects.toMatchObject({ code: "unsafe_path" }); + + // External target file must NEVER be deleted or modified + if (!dangling) { + expect(existsSync(externalFile)).toBe(true); + expect(readFileSync(externalFile, "utf8")).toBe("sensitive-root-content"); + } + expect(Buffer.compare(readFileSync(fx.binPath), Buffer.from(currentBytes))).toBe(0); + } + } + + // 3. updateDir itself is a symlink to another directory + const rootDirSym = makeTempDir(); + const fxSym = stageFixture({ + rootDir: rootDirSym, + currentBinaryBytes: currentBytes, + stagedBinaryBytes: newBytes, + manifestVersion: "0.2.0", + signingSecretKey: keyPair.secretKey, + }); + const symlinkUpdateDir = join(rootDirSym, "symlink-update-dir"); + symlinkSync(fxSym.updateDir, symlinkUpdateDir, "dir"); + + await expect( + applyStagedUpdate({ + updateDir: symlinkUpdateDir, + binPath: fxSym.binPath, + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), + }), + ).rejects.toMatchObject({ code: "unsafe_path" }); + + // Files inside the target directory must not have been deleted by finally cleanup + expect(existsSync(join(fxSym.updateDir, READY_FILE_NAME))).toBe(true); + }); + + test("reports rollback_failed if both update restart and rollback restart fail", async () => { + const rootDir = makeTempDir(); + const keyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const oldBytes = new TextEncoder().encode("old-v0.1.0"); + const newBytes = new TextEncoder().encode("new-v0.2.0"); + + const fx = stageFixture({ + rootDir, + currentBinaryBytes: oldBytes, + stagedBinaryBytes: newBytes, + manifestVersion: "0.2.0", + signingSecretKey: keyPair.secretKey, + }); + + await expect( + applyStagedUpdate({ + updateDir: fx.updateDir, + binPath: fx.binPath, + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + runCommand: async () => ({ code: 1, stdout: "", stderr: "systemd bus error" }), + }), + ).rejects.toMatchObject({ code: "rollback_failed" }); + + // Even when systemctl restart failed during rollback, the previous binary was restored on disk + expect(Buffer.compare(readFileSync(fx.binPath), Buffer.from(oldBytes))).toBe(0); + }); }); diff --git a/src/update/apply.ts b/src/update/apply.ts index 4621ed2..b08e216 100644 --- a/src/update/apply.ts +++ b/src/update/apply.ts @@ -16,6 +16,7 @@ import { readSync, renameSync, rmSync, + type Stats, unlinkSync, writeSync, } from "node:fs"; @@ -55,24 +56,41 @@ function getNoFollowReadFlags(platform: NodeJS.Platform): number { return fsConstants.O_RDONLY; } const noFollow = typeof fsConstants.O_NOFOLLOW === "number" ? fsConstants.O_NOFOLLOW : 0; - return fsConstants.O_RDONLY | noFollow; + const nonBlock = typeof fsConstants.O_NONBLOCK === "number" ? fsConstants.O_NONBLOCK : 0; + return fsConstants.O_RDONLY | noFollow | nonBlock; +} + +function lstatOrNull(filePath: string): Stats | null { + try { + return lstatSync(filePath); + } catch (err) { + if ((err as NodeJS.ErrnoException).code === "ENOENT") { + return null; + } + throw err; + } +} + +function isRealDirectory(dirPath: string): boolean { + const stat = lstatOrNull(dirPath); + return stat !== null && !stat.isSymbolicLink() && stat.isDirectory(); } function assertNotSymlinkDir(dirPath: string): void { - if (!existsSync(dirPath)) { + const stat = lstatOrNull(dirPath); + if (stat === null) { throw new UpdateError("unsafe_path", `Directory does not exist: ${dirPath}`); } - const stat = lstatSync(dirPath); if (stat.isSymbolicLink() || !stat.isDirectory()) { throw new UpdateError("unsafe_path", `Refusing to use symlink or non-directory: ${dirPath}`); } } -function assertRegularNonSymlinkFile(filePath: string, maxBytes: number): void { - if (!existsSync(filePath)) { +function assertRegularNonSymlinkFile(filePath: string, maxBytes: number): Stats { + const stat = lstatOrNull(filePath); + if (stat === null) { throw new UpdateError("apply_failed", `Required staged file is missing: ${filePath}`); } - const stat = lstatSync(filePath); if (stat.isSymbolicLink()) { throw new UpdateError("unsafe_path", `Refusing to read symlink: ${filePath}`); } @@ -88,6 +106,7 @@ function assertRegularNonSymlinkFile(filePath: string, maxBytes: number): void { `Staged file ${filePath} exceeds maximum size of ${maxBytes} bytes`, ); } + return stat; } function copyRegularFileNoFollow( @@ -97,18 +116,41 @@ function copyRegularFileNoFollow( dstMode: number, platform: NodeJS.Platform, ): number { - assertRegularNonSymlinkFile(srcPath, maxBytes); + const initialStat = assertRegularNonSymlinkFile(srcPath, maxBytes); let srcFd: number | undefined; let dstFd: number | undefined; let total = 0; try { - srcFd = openSync(srcPath, getNoFollowReadFlags(platform)); + try { + srcFd = openSync(srcPath, getNoFollowReadFlags(platform)); + } catch (err) { + const code = (err as NodeJS.ErrnoException).code; + if (code === "ELOOP") { + throw new UpdateError("unsafe_path", `Refusing to open symlink: ${srcPath}`); + } + throw err; + } const fdStat = fstatSync(srcFd); if (!fdStat.isFile()) { throw new UpdateError("unsafe_path", `Opened source is not a regular file: ${srcPath}`); } + if (isPosix(platform) && (fdStat.ino !== initialStat.ino || fdStat.dev !== initialStat.dev)) { + throw new UpdateError( + "unsafe_path", + `Source file inode changed during open (TOCTOU detected): ${srcPath}`, + ); + } + if (fdStat.size <= 0) { + throw new UpdateError("apply_failed", `Staged file is empty: ${srcPath}`); + } + if (fdStat.size > maxBytes) { + throw new UpdateError( + "size_limit_exceeded", + `Staged file ${srcPath} exceeds maximum size of ${maxBytes} bytes`, + ); + } dstFd = openSync(dstPath, "wx", dstMode); const buffer = Buffer.allocUnsafe(COPY_CHUNK_BYTES); @@ -128,6 +170,10 @@ function copyRegularFileNoFollow( writeSync(dstFd, buffer, 0, bytesRead); } + if (total <= 0) { + throw new UpdateError("apply_failed", `Staged file is empty: ${srcPath}`); + } + fsyncSync(dstFd); closeSync(dstFd); dstFd = undefined; @@ -216,6 +262,8 @@ export interface ApplyUpdateOptions { readonly arch?: ReleaseArch; readonly publicKey?: PublicKey; readonly allowDowngrade?: boolean; + readonly maxManifestBytes?: number; + readonly maxBinaryBytes?: number; readonly serviceName?: string; readonly healthTimeoutMs?: number; readonly healthPollIntervalMs?: number; @@ -299,6 +347,8 @@ export async function applyStagedUpdate( const binDir = dirname(binPath); const prevBinPath = options.prevBinPath ?? `${binPath}.prev`; const currentVersion = options.currentVersion ?? VERSION; + const maxManifestBytes = options.maxManifestBytes ?? MAX_MANIFEST_BYTES; + const maxBinaryBytes = options.maxBinaryBytes ?? MAX_BINARY_BYTES; const serviceName = options.serviceName ?? DEFAULT_SERVICE_NAME; const healthTimeoutMs = options.healthTimeoutMs ?? DEFAULT_HEALTH_TIMEOUT_MS; const healthPollIntervalMs = options.healthPollIntervalMs ?? DEFAULT_HEALTH_POLL_INTERVAL_MS; @@ -311,7 +361,8 @@ export async function applyStagedUpdate( options.runCommand ?? ((command, args) => runFixed(command, args, { timeoutMs: 30_000, maxOutputBytes: 8192 })); - // Verify updateDir and binDir are real directories (never symlinks) + // Verify updateDir (and its parent) and binDir are real directories (never symlinks) + assertNotSymlinkDir(dirname(updateDir)); assertNotSymlinkDir(updateDir); assertNotSymlinkDir(binDir); @@ -322,9 +373,9 @@ export async function applyStagedUpdate( let rootStagingDir: string | null = null; try { - // Validate ready.json if present (must not be a symlink) and remove trigger immediately - if (existsSync(readyPath)) { - const readyStat = lstatSync(readyPath); + // Validate ready.json if present (including dangling symlinks via lstat) and remove trigger immediately + const readyStat = lstatOrNull(readyPath); + if (readyStat !== null) { if (readyStat.isSymbolicLink() || !readyStat.isFile()) { throw new UpdateError("unsafe_path", `Refusing to process unsafe ready file: ${readyPath}`); } @@ -347,14 +398,14 @@ export async function applyStagedUpdate( copyRegularFileNoFollow( stagedManifestPath, rootManifestPath, - MAX_MANIFEST_BYTES, + maxManifestBytes, ROOT_STAGING_FILE_MODE, platform, ); copyRegularFileNoFollow( stagedBinaryPath, rootBinaryPath, - MAX_BINARY_BYTES, + maxBinaryBytes, ROOT_STAGING_FILE_MODE, platform, ); @@ -399,7 +450,7 @@ export async function applyStagedUpdate( // 4. Backup current binary atomically to tegrad.prev const hadPrevious = existsSync(binPath); if (hadPrevious) { - atomicCopyFile(binPath, prevBinPath, INSTALLED_BINARY_MODE, MAX_BINARY_BYTES, platform); + atomicCopyFile(binPath, prevBinPath, INSTALLED_BINARY_MODE, maxBinaryBytes, platform); } // 5. Atomically install verified binary from root-owned staging dir to binPath @@ -412,8 +463,15 @@ export async function applyStagedUpdate( const rollback = async (reason: string): Promise => { if (hadPrevious && existsSync(prevBinPath)) { try { - atomicCopyFile(prevBinPath, binPath, INSTALLED_BINARY_MODE, MAX_BINARY_BYTES, platform); - await runCommand("systemctl", ["restart", serviceName]); + atomicCopyFile(prevBinPath, binPath, INSTALLED_BINARY_MODE, maxBinaryBytes, platform); + const rollbackRestart = await runCommand("systemctl", ["restart", serviceName]); + if (rollbackRestart.code !== 0) { + throw new Error( + `systemctl restart ${serviceName} exited with code ${rollbackRestart.code}${ + rollbackRestart.stderr.trim() ? `: ${rollbackRestart.stderr.trim()}` : "" + }`, + ); + } } catch (rollbackErr) { throw new UpdateError( "rollback_failed", @@ -467,9 +525,12 @@ export async function applyStagedUpdate( // ignore cleanup errors } } - // Always clean up staged files so tegrad-update.path cannot loop on corrupt staging data - safeUnlinkIfPresent(readyPath); - safeUnlinkIfPresent(stagedBinaryPath); - safeUnlinkIfPresent(stagedManifestPath); + // Always clean up staged files so tegrad-update.path cannot loop on corrupt staging data, + // after re-verifying updateDir and its parent are still real directories (never symlinks). + if (isRealDirectory(dirname(updateDir)) && isRealDirectory(updateDir)) { + safeUnlinkIfPresent(readyPath); + safeUnlinkIfPresent(stagedBinaryPath); + safeUnlinkIfPresent(stagedManifestPath); + } } } diff --git a/src/update/updater.test.ts b/src/update/updater.test.ts index ff7a36a..6224934 100644 --- a/src/update/updater.test.ts +++ b/src/update/updater.test.ts @@ -390,4 +390,35 @@ describe("updater (checkForUpdate and createAutoUpdater)", () => { expect(updaterSource).not.toMatch(/\bexecFile\b/); expect(updaterSource).not.toMatch(/\bspawnSync\b/); }); + + test("blocks redirected asset downloads to disallowed hosts or non-https URLs", async () => { + const stateDir = makeTempDir(); + const keyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const binBytes = new TextEncoder().encode("binary-payload"); + const manifest = buildSignedManifest("0.2.0", "stable", binBytes, keyPair.secretKey); + + await expect( + checkForUpdate({ + stateDir, + channel: "stable", + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: keyPair.publicKey, + fetch: async (input) => { + const url = String(input); + if (url.endsWith("/stable.json")) { + return new Response(JSON.stringify(manifest), { status: 200 }); + } + const redirected = new Response(binBytes, { status: 200 }); + Object.defineProperty(redirected, "url", { + value: "https://evil-redirect.attacker.example/tegrad-linux-x64", + }); + return redirected; + }, + }), + ).rejects.toMatchObject({ code: "host_not_allowed" }); + + const { updateDir } = getStatePaths(stateDir); + expect(existsSync(join(updateDir, READY_FILE_NAME))).toBe(false); + }); }); diff --git a/src/update/updater.ts b/src/update/updater.ts index 540bab8..c257903 100644 --- a/src/update/updater.ts +++ b/src/update/updater.ts @@ -11,6 +11,7 @@ import { mkdirSync, openSync, renameSync, + type Stats, unlinkSync, writeSync, } from "node:fs"; @@ -123,12 +124,23 @@ export function buildManifestUrl(manifestBaseUrl: string, channel: ReleaseChanne return `${normalized}/${channel}.json`; } +function lstatOrNull(filePath: string): Stats | null { + try { + return lstatSync(filePath); + } catch (err) { + if ((err as NodeJS.ErrnoException).code === "ENOENT") { + return null; + } + throw err; + } +} + export function ensureSafeUpdateDir( stateDir: string, platform: NodeJS.Platform = process.platform, ): string { - if (existsSync(stateDir)) { - const stateStat = lstatSync(stateDir); + const stateStat = lstatOrNull(stateDir); + if (stateStat !== null) { if (stateStat.isSymbolicLink() || !stateStat.isDirectory()) { throw new UpdateError("unsafe_path", `State directory ${stateDir} must be a real directory`); } @@ -140,8 +152,8 @@ export function ensureSafeUpdateDir( } const { updateDir } = getStatePaths(stateDir); - if (existsSync(updateDir)) { - const stat = lstatSync(updateDir); + const stat = lstatOrNull(updateDir); + if (stat !== null) { if (stat.isSymbolicLink() || !stat.isDirectory()) { throw new UpdateError("unsafe_path", `Update directory ${updateDir} must not be a symlink`); } @@ -422,6 +434,9 @@ export async function checkForUpdate( `Failed to download manifest ${manifestUrl}: HTTP ${manifestResponse.status}`, ); } + if (manifestResponse.url && manifestResponse.url.length > 0) { + parseStrictHttpsUrl(manifestResponse.url, "redirected manifest URL"); + } const manifestBytes = await readResponseBytesCapped(manifestResponse, maxManifestBytes); let rawManifest: unknown; @@ -475,6 +490,9 @@ export async function checkForUpdate( `Failed to download update binary ${asset.url}: HTTP ${binResponse.status}`, ); } + if (binResponse.url && binResponse.url.length > 0) { + validateAssetUrl(binResponse.url, allowedHosts); + } const { sha256, size } = await downloadAndHashToTempFile( binResponse, @@ -503,6 +521,27 @@ export async function checkForUpdate( const stagedManifestPath = join(updateDir, STAGED_MANIFEST_NAME); const readyPath = join(updateDir, READY_FILE_NAME); + // Remove any stale ready.json before updating staged-tegrad and staged-manifest.json + const existingReadyStat = lstatOrNull(readyPath); + if (existingReadyStat !== null) { + if (existingReadyStat.isSymbolicLink() || existingReadyStat.isDirectory()) { + throw new UpdateError( + "unsafe_path", + `Refusing to overwrite non-regular ready file: ${readyPath}`, + ); + } + unlinkSync(readyPath); + } + for (const targetPath of [stagedBinaryPath, stagedManifestPath]) { + const targetStat = lstatOrNull(targetPath); + if (targetStat !== null && (targetStat.isSymbolicLink() || targetStat.isDirectory())) { + throw new UpdateError( + "unsafe_path", + `Refusing to overwrite symlink or directory: ${targetPath}`, + ); + } + } + try { if (isPosix(platform)) { chmodSync(tmpBinaryPath, STAGED_FILE_MODE); From 76ca9ac7b58712def3e3c6642e20bf22775fb16d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 22 Nov 2026 20:23:07 -0300 Subject: [PATCH 11/59] fix: harden file confinement, upload staging isolation, and archive validation --- src/files/adversarial.test.ts | 833 ++++++++++++++++++++++++++++++++++ src/files/confinement.ts | 165 ++++++- src/files/index.ts | 6 + src/files/manager.ts | 271 +++++++++-- src/files/transfers.ts | 198 +++++++- src/files/zip.ts | 254 +++++++---- 6 files changed, 1553 insertions(+), 174 deletions(-) create mode 100644 src/files/adversarial.test.ts diff --git a/src/files/adversarial.test.ts b/src/files/adversarial.test.ts new file mode 100644 index 0000000..dc095c9 --- /dev/null +++ b/src/files/adversarial.test.ts @@ -0,0 +1,833 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeAll, beforeEach, describe, expect, test } from "bun:test"; +import { + closeSync, + existsSync, + mkdirSync, + mkdtempSync, + openSync, + readdirSync, + readFileSync, + rmSync, + symlinkSync, + unlinkSync, + writeFileSync, +} from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { deflateRawSync } from "node:zlib"; +import { createCommandQueue, type TransportCommandFrame } from "../agent/jobs"; +import { createLogger } from "../agent/logger"; +import { fingerprint, generateSigningKeyPair, ready } from "../crypto"; +import { + createCoreRegistry, + createInMemoryTrustContext, + createSignedCommand, + openAgentMessage, + PROTOCOL_VERSION, + type SignedCommand, + signSessionCertificate, + type TransportFrame, +} from "../protocol"; +import { + resolveConfinedPath, + UPLOAD_STAGING_DIR_NAME, + UPLOAD_STAGING_FILE_PREFIX, +} from "./confinement"; +import { type FileErrorCode, FileManagerError } from "./errors"; +import { FileManager, MAX_READ_WRITE_BYTES, registerFileCommandHandlers } from "./manager"; +import { sha256Hex } from "./transfers"; +import { crc32, createZipBuffer, safeUnzipBuffer, safeZipFiles } from "./zip"; + +function expectFileError(fn: () => unknown, code: FileErrorCode): void { + try { + fn(); + throw new Error(`Expected FileManagerError(${code}), but succeeded`); + } catch (err) { + expect(err).toBeInstanceOf(FileManagerError); + expect((err as FileManagerError).code).toBe(code); + } +} + +function createDirLink(target: string, linkPath: string): void { + if (process.platform === "win32") { + symlinkSync(target, linkPath, "junction"); + } else { + symlinkSync(target, linkPath, "dir"); + } +} + +interface RawZipEntrySpec { + readonly cdName: string; + readonly lfhName?: string; + readonly payload: Uint8Array; + readonly method: number; + readonly cdFlags?: number; + readonly lfhFlags?: number; + readonly crc?: number; + readonly declaredCompressedSize?: number; + readonly declaredUncompressedSize: number; + readonly externalAttr?: number; + readonly localHeaderOffsetOverride?: number; +} + +function buildMultiEntryZip(specs: readonly RawZipEntrySpec[]): { + readonly buffer: Uint8Array; + readonly cdOffset: number; + readonly cdSize: number; +} { + const encoder = new TextEncoder(); + const lfhBlocks: Uint8Array[] = []; + const cdhBlocks: Uint8Array[] = []; + const computedOffsets: number[] = []; + let offset = 0; + + for (const spec of specs) { + const lfhNameBytes = encoder.encode(spec.lfhName ?? spec.cdName); + const lfh = new Uint8Array(30 + lfhNameBytes.byteLength); + const lfhView = new DataView(lfh.buffer); + const compSize = spec.declaredCompressedSize ?? spec.payload.byteLength; + const crc = spec.crc ?? 0; + + lfhView.setUint32(0, 0x04034b50, true); + lfhView.setUint16(4, 20, true); + lfhView.setUint16(6, spec.lfhFlags ?? 0x0800, true); + lfhView.setUint16(8, spec.method, true); + lfhView.setUint32(14, crc, true); + lfhView.setUint32(18, compSize, true); + lfhView.setUint32(22, spec.declaredUncompressedSize, true); + lfhView.setUint16(26, lfhNameBytes.byteLength, true); + lfh.set(lfhNameBytes, 30); + + computedOffsets.push(offset); + lfhBlocks.push(lfh, spec.payload); + offset += lfh.byteLength + spec.payload.byteLength; + } + + const cdOffset = offset; + let cdSize = 0; + + for (let i = 0; i < specs.length; i++) { + const spec = specs[i]; + const computedOffset = computedOffsets[i]; + if (spec === undefined || computedOffset === undefined) { + continue; + } + const cdNameBytes = encoder.encode(spec.cdName); + const cdh = new Uint8Array(46 + cdNameBytes.byteLength); + const cdhView = new DataView(cdh.buffer); + const compSize = spec.declaredCompressedSize ?? spec.payload.byteLength; + const crc = spec.crc ?? 0; + + cdhView.setUint32(0, 0x02014b50, true); + cdhView.setUint16(4, 0x0314, true); + cdhView.setUint16(6, 20, true); + cdhView.setUint16(8, spec.cdFlags ?? 0x0800, true); + cdhView.setUint16(10, spec.method, true); + cdhView.setUint32(16, crc, true); + cdhView.setUint32(20, compSize, true); + cdhView.setUint32(24, spec.declaredUncompressedSize, true); + cdhView.setUint16(28, cdNameBytes.byteLength, true); + cdhView.setUint32(38, spec.externalAttr ?? (0o100644 << 16) >>> 0, true); + cdhView.setUint32(42, spec.localHeaderOffsetOverride ?? computedOffset, true); + cdh.set(cdNameBytes, 46); + + cdhBlocks.push(cdh); + cdSize += cdh.byteLength; + } + + const eocd = new Uint8Array(22); + const eocdView = new DataView(eocd.buffer); + eocdView.setUint32(0, 0x06054b50, true); + eocdView.setUint16(8, specs.length, true); + eocdView.setUint16(10, specs.length, true); + eocdView.setUint32(12, cdSize, true); + eocdView.setUint32(16, cdOffset, true); + + const total = cdOffset + cdSize + eocd.byteLength; + const out = new Uint8Array(total); + let cursor = 0; + for (const part of lfhBlocks) { + out.set(part, cursor); + cursor += part.byteLength; + } + for (const part of cdhBlocks) { + out.set(part, cursor); + cursor += part.byteLength; + } + out.set(eocd, cursor); + return { buffer: out, cdOffset, cdSize }; +} + +beforeAll(async () => { + await ready(); +}); + +describe("adversarial file confinement and archive security", () => { + let rootTmp: string; + let serversDir: string; + let outsideDir: string; + const serverId = "srv-adv"; + let serverDir: string; + let manager: FileManager; + + beforeEach(() => { + rootTmp = mkdtempSync(join(tmpdir(), "tegrad-adv-")); + serversDir = join(rootTmp, "servers"); + outsideDir = join(rootTmp, "outside"); + serverDir = join(serversDir, serverId); + mkdirSync(serverDir, { recursive: true }); + mkdirSync(outsideDir, { recursive: true }); + manager = new FileManager({ serversBaseDir: serversDir }); + }); + + afterEach(() => { + manager.dispose(); + rmSync(rootTmp, { recursive: true, force: true }); + }); + + test("upload staging directory cannot be listed, read, written, deleted, moved, zipped, or overwritten via FileManager", () => { + const part0 = new TextEncoder().encode("authentic-part-0-"); + const part1 = new TextEncoder().encode("authentic-part-1"); + const full = new Uint8Array(part0.byteLength + part1.byteLength); + full.set(part0, 0); + full.set(part1, part0.byteLength); + const expectedHash = sha256Hex(full); + + const began = manager.uploadBegin({ + server_id: serverId, + path: "plugins/authentic.jar", + total_size: full.byteLength, + sha256: expectedHash, + part_size: 64, + }); + + manager.uploadPart({ + server_id: serverId, + upload_id: began.upload_id, + part_index: 0, + data_base64: Buffer.from(part0).toString("base64"), + }); + + // Staging directory must stay hidden from directory listing. + expect(manager.list({ server_id: serverId }).entries).toEqual([]); + + const forbiddenPaths = [ + UPLOAD_STAGING_DIR_NAME, + `${UPLOAD_STAGING_DIR_NAME}/${began.upload_id}`, + UPLOAD_STAGING_DIR_NAME.toUpperCase(), + `nested/${UPLOAD_STAGING_DIR_NAME}/x`, + `${UPLOAD_STAGING_FILE_PREFIX}${began.upload_id}`, + ]; + + for (const target of forbiddenPaths) { + expectFileError(() => manager.stat({ server_id: serverId, path: target }), "path_traversal"); + expectFileError(() => manager.read({ server_id: serverId, path: target }), "path_traversal"); + expectFileError( + () => manager.write({ server_id: serverId, path: target, content: "tampered!" }), + "path_traversal", + ); + expectFileError( + () => manager.delete({ server_id: serverId, path: target, recursive: true }), + "path_traversal", + ); + expectFileError( + () => manager.move({ server_id: serverId, from_path: target, to_path: "stolen.bin" }), + "path_traversal", + ); + expectFileError( + () => manager.copy({ server_id: serverId, from_path: target, to_path: "copied.bin" }), + "path_traversal", + ); + expectFileError( + () => manager.zip({ server_id: serverId, paths: [target], dest_path: "leak.zip" }), + "path_traversal", + ); + expectFileError( + () => manager.downloadBegin({ server_id: serverId, path: target }), + "path_traversal", + ); + } + + // Also reject writing into staging via rename, move destination, zip destination, or unzip. + manager.write({ server_id: serverId, path: "benign.txt", content: "hi" }); + expectFileError( + () => + manager.rename({ + server_id: serverId, + path: "benign.txt", + new_name: UPLOAD_STAGING_DIR_NAME, + }), + "path_traversal", + ); + expectFileError( + () => + manager.move({ + server_id: serverId, + from_path: "benign.txt", + to_path: `${UPLOAD_STAGING_DIR_NAME}/${began.upload_id}`, + }), + "path_traversal", + ); + + const maliciousZip = createZipBuffer([ + { + name: `${UPLOAD_STAGING_DIR_NAME}/${began.upload_id}`, + data: new TextEncoder().encode("zip-overwrite"), + }, + ]); + expectFileError( + () => + safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId, + buffer: maliciousZip, + }), + "zip_slip", + ); + + // Complete upload legitimately and confirm clean staging teardown. + manager.uploadPart({ + server_id: serverId, + upload_id: began.upload_id, + part_index: 1, + data_base64: Buffer.from(part1).toString("base64"), + }); + const committed = manager.uploadCommit({ + server_id: serverId, + upload_id: began.upload_id, + }); + expect(committed.sha256).toBe(expectedHash); + expect(new Uint8Array(readFileSync(join(serverDir, "plugins", "authentic.jar")))).toEqual(full); + expect(existsSync(join(serverDir, UPLOAD_STAGING_DIR_NAME))).toBe(false); + }); + + test("upload detects staging file replacement or symlinked staging directory before commit", () => { + const payload = new TextEncoder().encode("valid-upload-bytes"); + const began = manager.uploadBegin({ + server_id: serverId, + path: "safe.bin", + total_size: payload.byteLength, + sha256: sha256Hex(payload), + }); + manager.uploadPart({ + server_id: serverId, + upload_id: began.upload_id, + part_index: 0, + data_base64: Buffer.from(payload).toString("base64"), + }); + + // Replace staging file externally on disk with a different inode. + const stagingFile = join(serverDir, UPLOAD_STAGING_DIR_NAME, began.upload_id); + unlinkSync(stagingFile); + writeFileSync(stagingFile, "tampered-payload!!"); + + expectFileError( + () => manager.uploadCommit({ server_id: serverId, upload_id: began.upload_id }), + "toctou_detected", + ); + expect(existsSync(join(serverDir, "safe.bin"))).toBe(false); + expect(existsSync(join(serverDir, UPLOAD_STAGING_DIR_NAME))).toBe(false); + + // Planting a symlink at .tegrad-uploads before uploadBegin must fail closed. + createDirLink(outsideDir, join(serverDir, UPLOAD_STAGING_DIR_NAME)); + expectFileError( + () => + manager.uploadBegin({ + server_id: serverId, + path: "safe2.bin", + total_size: payload.byteLength, + sha256: sha256Hex(payload), + }), + "symlink_forbidden", + ); + }); + + test("blocks multi-extension Windows reserved names, invisible Unicode chars, and colons/drive segments", () => { + const badNames = [ + "NUL.tar.gz", + "com1.json.bak", + "lpt9.tar.bz2", + "PRN.a.b.c", + "CONIN$.txt", + "CONOUT$.log", + "CLOCK$.dat", + "CON .txt", + "NUL .tar.gz", + "COM\u00B9.txt", + "LPT\u00B2.cfg", + "NUL\u200B.txt", + "file\u200Cname.txt", + "file\u200Dname.txt", + "\uFEFFeula.txt", + "server\u202Etxt.jar", + "soft\u00ADhyphen.txt", + "c1\u0085ctrl.txt", + "line\u2028sep.txt", + "para\u2029sep.txt", + ".runtime\u200B", + ".\u200B.", + "sub/C:/Windows/win.ini", + "C:relative.txt", + "file.txt:ads", + "file.txt::$DATA", + ]; + + for (const bad of badNames) { + expect(() => + resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: bad, + }), + ).toThrow(FileManagerError); + } + + manager.write({ server_id: serverId, path: "rename-src.txt", content: "ok" }); + for (const badNewName of [ + UPLOAD_STAGING_DIR_NAME, + "NUL.tar.gz", + "a\u200Bb.txt", + "a:b.txt", + ".tmp-upload-abc", + ]) { + expect(() => + manager.rename({ + server_id: serverId, + path: "rename-src.txt", + new_name: badNewName, + }), + ).toThrow(FileManagerError); + } + }); + + test("rejects case-insensitive self-copy, self-move, and self-zip, and enforces copy limits atomically", () => { + manager.mkdir({ server_id: serverId, path: "World/region" }); + manager.write({ server_id: serverId, path: "World/level.dat", content: "level" }); + manager.write({ server_id: serverId, path: "World/region/a.mca", content: "region" }); + + if (process.platform === "win32" || process.platform === "darwin") { + expectFileError( + () => manager.copy({ server_id: serverId, from_path: "World", to_path: "world/backup" }), + "invalid_path", + ); + expectFileError( + () => manager.move({ server_id: serverId, from_path: "World", to_path: "world/moved" }), + "invalid_path", + ); + expectFileError( + () => + safeZipFiles({ + serversBaseDir: serversDir, + serverId, + paths: ["World"], + destPath: "world/out.zip", + }), + "invalid_path", + ); + } + + // Pre-scan enforces maxCopyFiles before creating destination directory. + const limited = new FileManager({ + serversBaseDir: serversDir, + maxCopyFiles: 1, + maxCopyBytes: 1000, + }); + try { + expectFileError( + () => limited.copy({ server_id: serverId, from_path: "World", to_path: "WorldCopy" }), + "copy_limit_exceeded", + ); + expect(existsSync(join(serverDir, "WorldCopy"))).toBe(false); + } finally { + limited.dispose(); + } + }); + + test("copy streams files larger than 2 MiB via chunked upload without hitting OOM", () => { + // 2.5 MiB binary pattern > MAX_READ_WRITE_BYTES (2 MiB) and > 64 KiB scratch buffer + const totalSize = 2560 * 1024; + const payload = new Uint8Array(totalSize); + for (let i = 0; i < payload.byteLength; i++) { + payload[i] = (i * 31) & 0xff; + } + const partSize = 1024 * 1024; + const expectedHash = sha256Hex(payload); + const began = manager.uploadBegin({ + server_id: serverId, + path: "big.bin", + total_size: totalSize, + sha256: expectedHash, + part_size: partSize, + }); + let partIdx = 0; + for (let offset = 0; offset < totalSize; offset += partSize) { + const slice = payload.subarray(offset, Math.min(totalSize, offset + partSize)); + manager.uploadPart({ + server_id: serverId, + upload_id: began.upload_id, + part_index: partIdx++, + data_base64: Buffer.from(slice).toString("base64"), + }); + } + manager.uploadCommit({ server_id: serverId, upload_id: began.upload_id }); + + const copied = manager.copy({ + server_id: serverId, + from_path: "big.bin", + to_path: "big-copy.bin", + }); + expect(copied.files_copied).toBe(1); + expect(copied.bytes_copied).toBe(payload.byteLength); + expect(new Uint8Array(readFileSync(join(serverDir, "big-copy.bin")))).toEqual(payload); + }); + + test("recursive delete aborts before deleting sibling files when a nested symlink exists", () => { + manager.mkdir({ server_id: serverId, path: "tree/nested" }); + manager.write({ server_id: serverId, path: "tree/keep-me.txt", content: "intact" }); + createDirLink(outsideDir, join(serverDir, "tree", "nested", "escape")); + + expectFileError( + () => manager.delete({ server_id: serverId, path: "tree", recursive: true }), + "symlink_forbidden", + ); + expect(readFileSync(join(serverDir, "tree", "keep-me.txt"), "utf8")).toBe("intact"); + }); + + test("unzip rejects case-insensitive file/directory collisions and duplicate directories before writing", () => { + const collidingFiles = createZipBuffer([ + { name: "A.txt", data: new TextEncoder().encode("upper") }, + { name: "a.txt", data: new TextEncoder().encode("lower") }, + ]); + expectFileError( + () => safeUnzipBuffer({ serversBaseDir: serversDir, serverId, buffer: collidingFiles }), + "zip_invalid", + ); + expect(readdirSync(serverDir)).toEqual([]); + + const collidingDirAndFile = createZipBuffer([ + { name: "Mods/", data: new Uint8Array(0), isDirectory: true }, + { name: "mods", data: new TextEncoder().encode("file-over-dir") }, + ]); + expectFileError( + () => safeUnzipBuffer({ serversBaseDir: serversDir, serverId, buffer: collidingDirAndFile }), + "zip_invalid", + ); + expect(readdirSync(serverDir)).toEqual([]); + + const collidingDirCasing = createZipBuffer([ + { name: "Config/", data: new Uint8Array(0), isDirectory: true }, + { name: "config/server.yml", data: new TextEncoder().encode("port: 25565") }, + ]); + expectFileError( + () => safeUnzipBuffer({ serversBaseDir: serversDir, serverId, buffer: collidingDirCasing }), + "zip_invalid", + ); + expect(readdirSync(serverDir)).toEqual([]); + + const duplicateExplicitDirs = createZipBuffer([ + { name: "logs/", data: new Uint8Array(0), isDirectory: true }, + { name: "logs/", data: new Uint8Array(0), isDirectory: true }, + ]); + expectFileError( + () => + safeUnzipBuffer({ serversBaseDir: serversDir, serverId, buffer: duplicateExplicitDirs }), + "zip_invalid", + ); + expect(readdirSync(serverDir)).toEqual([]); + }); + + test("unzip rejects overlapping entry offsets, zero-compressed-size deflate, out-of-bounds CD, and special UNIX modes atomically", () => { + const benignPayload = new TextEncoder().encode("benign"); + const sharedPayload = new TextEncoder().encode("shared"); + + // 1. Overlapping offsets (two entries pointing to localHeaderOffset = 0) + const overlapping = buildMultiEntryZip([ + { + cdName: "first.txt", + payload: sharedPayload, + method: 0, + crc: crc32(sharedPayload), + declaredUncompressedSize: sharedPayload.byteLength, + }, + { + cdName: "second.txt", + payload: new Uint8Array(0), + method: 0, + crc: crc32(sharedPayload), + declaredCompressedSize: sharedPayload.byteLength, + declaredUncompressedSize: sharedPayload.byteLength, + localHeaderOffsetOverride: 0, + }, + ]); + expectFileError( + () => safeUnzipBuffer({ serversBaseDir: serversDir, serverId, buffer: overlapping.buffer }), + "zip_invalid", + ); + expect(readdirSync(serverDir)).toEqual([]); + + // 2. Deflate entry with compressedSize = 0 (preceded by valid entry to verify Phase 1 atomicity) + const zeroCompressedDeflate = buildMultiEntryZip([ + { + cdName: "benign.txt", + payload: benignPayload, + method: 0, + crc: crc32(benignPayload), + declaredUncompressedSize: benignPayload.byteLength, + }, + { + cdName: "empty-deflate.txt", + payload: new Uint8Array(0), + method: 8, + crc: crc32(new Uint8Array(0)), + declaredCompressedSize: 0, + declaredUncompressedSize: 0, + }, + ]); + expectFileError( + () => + safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId, + buffer: zeroCompressedDeflate.buffer, + }), + "zip_invalid", + ); + expect(readdirSync(serverDir)).toEqual([]); + + // 3. Truncated / out-of-bounds Central Directory offset & size + const baseZip = createZipBuffer([{ name: "ok.txt", data: benignPayload }]); + const corruptedCd = new Uint8Array(baseZip); + const corruptedView = new DataView(corruptedCd.buffer); + // Corrupt cdOffset in EOCD to point beyond EOCD + corruptedView.setUint32(corruptedCd.byteLength - 6, corruptedCd.byteLength + 100, true); + expectFileError( + () => safeUnzipBuffer({ serversBaseDir: serversDir, serverId, buffer: corruptedCd }), + "zip_invalid", + ); + + // 4. Truncated archive (LFH payload extends into Central Directory) + const truncatedPayloadZip = buildMultiEntryZip([ + { + cdName: "benign.txt", + payload: benignPayload, + method: 0, + crc: crc32(benignPayload), + declaredUncompressedSize: benignPayload.byteLength, + }, + { + cdName: "truncated.txt", + payload: new Uint8Array(4), + method: 0, + crc: crc32(new Uint8Array(100)), + declaredCompressedSize: 100, + declaredUncompressedSize: 100, + }, + ]); + expectFileError( + () => + safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId, + buffer: truncatedPayloadZip.buffer, + }), + "zip_invalid", + ); + expect(readdirSync(serverDir)).toEqual([]); + + // 5. Special UNIX entry types (FIFO, socket, char device) and LFH encryption mismatch + for (const specialMode of [0o010644, 0o020644, 0o060644, 0o140755]) { + const specialZip = buildMultiEntryZip([ + { + cdName: "special", + payload: new Uint8Array(0), + method: 0, + crc: crc32(new Uint8Array(0)), + declaredUncompressedSize: 0, + externalAttr: (specialMode << 16) >>> 0, + }, + ]); + expectFileError( + () => safeUnzipBuffer({ serversBaseDir: serversDir, serverId, buffer: specialZip.buffer }), + "zip_invalid", + ); + } + + const lfhEncryptedZip = buildMultiEntryZip([ + { + cdName: "sneaky-encrypted.txt", + payload: benignPayload, + method: 0, + cdFlags: 0x0800, + lfhFlags: 0x0801, + crc: crc32(benignPayload), + declaredUncompressedSize: benignPayload.byteLength, + }, + ]); + expectFileError( + () => + safeUnzipBuffer({ serversBaseDir: serversDir, serverId, buffer: lfhEncryptedZip.buffer }), + "zip_unsupported_method", + ); + }); + + test("unzip succeeds when 0-byte deflated entry follows entries that consume exact maxUncompressedBytes", () => { + const exactPayload = new TextEncoder().encode("x".repeat(128)); + const deflatedEmpty = deflateRawSync(new Uint8Array(0)); + const deflatedFull = deflateRawSync(exactPayload); + + const zip = buildMultiEntryZip([ + { + cdName: "full.txt", + payload: new Uint8Array( + deflatedFull.buffer, + deflatedFull.byteOffset, + deflatedFull.byteLength, + ), + method: 8, + crc: crc32(exactPayload), + declaredUncompressedSize: exactPayload.byteLength, + }, + { + cdName: "empty.txt", + payload: new Uint8Array( + deflatedEmpty.buffer, + deflatedEmpty.byteOffset, + deflatedEmpty.byteLength, + ), + method: 8, + crc: crc32(new Uint8Array(0)), + declaredUncompressedSize: 0, + }, + ]); + + const res = safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId, + buffer: zip.buffer, + maxUncompressedBytes: 128, + }); + expect(res.totalBytes).toBe(128); + expect(readFileSync(join(serverDir, "full.txt"), "utf8")).toBe("x".repeat(128)); + expect(readFileSync(join(serverDir, "empty.txt"), "utf8")).toBe(""); + }); + + test("does not leak file descriptors across read/write/download/upload error paths", () => { + // 1. Oversized file read fails and releases fd immediately (file can be deleted on Windows). + writeFileSync(join(serverDir, "huge.bin"), Buffer.alloc(MAX_READ_WRITE_BYTES + 1, 0x41)); + expectFileError( + () => manager.read({ server_id: serverId, path: "huge.bin" }), + "file_too_large", + ); + expect(() => manager.delete({ server_id: serverId, path: "huge.bin" })).not.toThrow(); + + // 2. Invalid encoding fails cleanly. + expectFileError( + () => + manager.write({ + server_id: serverId, + path: "bad.txt", + content: "abc", + encoding: "hex" as unknown as "utf8", + }), + "invalid_encoding", + ); + + // 3. Download session errors release fd on close. + manager.write({ server_id: serverId, path: "dl.txt", content: "download-me" }); + const dl = manager.downloadBegin({ server_id: serverId, path: "dl.txt", part_size: 4 }); + expectFileError( + () => + manager.downloadPart({ + server_id: serverId, + download_id: dl.download_id, + part_index: 99, + }), + "part_out_of_order", + ); + manager.downloadClose({ server_id: serverId, download_id: dl.download_id }); + expect(() => manager.delete({ server_id: serverId, path: "dl.txt" })).not.toThrow(); + + // 4. Protocol CommandQueue emits files.error on invalid encoding / zip_slip. + const account = generateSigningKeyPair(); + const session = generateSigningKeyPair(); + const agent = generateSigningKeyPair(); + const agentId = fingerprint(agent.publicKey); + const now = 1_700_000_000_000; + const sessionCert = signSessionCertificate({ + sessionPublicKey: session.publicKey, + accountKeyPair: account, + notBefore: now - 60_000, + notAfter: now + 3_600_000, + }); + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [account.publicKey], + now: () => now, + }); + const registry = createCoreRegistry(); + const sent: TransportFrame[] = []; + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (frame) => sent.push(frame), + logger: createLogger({ level: "error", stdout: () => {}, stderr: () => {} }), + }); + const localMgr = new FileManager({ serversBaseDir: serversDir }); + registerFileCommandHandlers(queue, localMgr); + + const wrap = (body: SignedCommand): TransportCommandFrame => ({ + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: agentId }, + body, + }); + + const badB64Cmd = createSignedCommand( + { + type: "files.write", + body: { + server_id: serverId, + path: "bad-b64.bin", + content: "not!valid!base64", + encoding: "base64", + }, + agentPublicKey: agent.publicKey, + signer: session, + session: sessionCert, + counter: 1, + now, + }, + registry, + ); + + return queue + .enqueue(wrap(badB64Cmd)) + .then(() => { + const ev = sent[0]; + const ack = sent[1]; + expect(ev?.kind).toBe("event"); + if (ev?.kind === "event") { + const opened = openAgentMessage(ev.body, agent.publicKey, account); + expect(opened.header.type).toBe("files.error"); + expect((opened.body as { code: string }).code).toBe("invalid_encoding"); + } + expect(ack?.kind === "ack" && !ack.body.ok && ack.body.code === "handler_error").toBe(true); + }) + .finally(() => { + localMgr.dispose(); + // Verify no open fd lingers inside confinement helper + const f = join(serverDir, "cleanup-check.txt"); + writeFileSync(f, "ok"); + const resolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: "cleanup-check.txt", + }); + expect(resolved.relativePath).toBe("cleanup-check.txt"); + closeSync(openSync(resolved.fullPath, "r")); + }); + }); +}); diff --git a/src/files/confinement.ts b/src/files/confinement.ts index 68d2e96..719d86f 100644 --- a/src/files/confinement.ts +++ b/src/files/confinement.ts @@ -3,8 +3,8 @@ import { randomBytes } from "node:crypto"; import { - chmodSync, closeSync, + fchmodSync, constants as fsConstants, fstatSync, fsyncSync, @@ -24,12 +24,18 @@ import { FileManagerError } from "./errors"; export const DEFAULT_SERVERS_BASE_DIR = "/var/lib/tegrad-servers"; export const MAX_PATH_BYTES = 1024; export const MAX_COMPONENT_BYTES = 255; +export const RUNTIME_DIR_NAME = ".runtime"; +export const UPLOAD_STAGING_DIR_NAME = ".tegrad-uploads"; +export const UPLOAD_STAGING_FILE_PREFIX = ".tmp-upload-"; -const FORBIDDEN_COMPONENT_NAMES = new Set([".runtime"]); +const FORBIDDEN_COMPONENT_NAMES = new Set([RUNTIME_DIR_NAME, UPLOAD_STAGING_DIR_NAME]); const RESERVED_WINDOWS_NAME_REGEX = - /^(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9]|CONIN\$|CONOUT\$|CLOCK\$)(?:\.|$)/i; + /^(?:CON|PRN|AUX|NUL|COM[1-9¹²³]|LPT[1-9¹²³]|CONIN\$|CONOUT\$|CLOCK\$)\s*(?:\.|$)/i; const WINDOWS_DRIVE_PREFIX_REGEX = /^[A-Za-z]:/; const ENCODED_TRAVERSAL_REGEX = /%(?:2f|5c|00)/i; +// Blocks ASCII/C1 control characters (Cc), invisible format/bidi characters (Cf), +// line/paragraph separators (U+2028/U+2029), and known invisible filler code points. +const UNSAFE_UNICODE_CHAR_REGEX = /(?:\p{Cc}|\p{Cf}|\u034F|\u180E|\u2028|\u2029|\u3164|\uFFA0)/u; const DEFAULT_FILE_MODE = 0o640; const DEFAULT_DIR_MODE = 0o750; @@ -91,22 +97,19 @@ export function wrapIoError(err: unknown, context: string): FileManagerError { return new FileManagerError("io_error", `${context}: ${message}`); } -function hasControlChars(value: string): boolean { - for (let i = 0; i < value.length; i++) { - const code = value.charCodeAt(i); - if (code <= 0x1f || code === 0x7f) { - return true; - } - } - return false; +function hasUnsafeChars(value: string): boolean { + return UNSAFE_UNICODE_CHAR_REGEX.test(value); } function assertNormalizedAndSafeChars(value: string, label: string): void { - if (hasControlChars(value)) { - throw new FileManagerError("invalid_path", `${label} contains control or NUL characters`); + if (hasUnsafeChars(value)) { + throw new FileManagerError( + "invalid_path", + `${label} contains control, NUL, or invisible format characters`, + ); } const normalized = value.normalize("NFC"); - if (normalized !== value || hasControlChars(normalized)) { + if (normalized !== value || hasUnsafeChars(normalized)) { throw new FileManagerError("invalid_path", `${label} must be NFC-normalized Unicode`); } if (value.includes("\\")) { @@ -114,6 +117,13 @@ function assertNormalizedAndSafeChars(value: string, label: string): void { } } +export function isSameOrSubpath(parentRel: string, candidateRel: string): boolean { + const caseInsensitive = process.platform === "win32" || process.platform === "darwin"; + const parent = caseInsensitive ? parentRel.toLowerCase() : parentRel; + const candidate = caseInsensitive ? candidateRel.toLowerCase() : candidateRel; + return candidate === parent || candidate.startsWith(`${parent}/`); +} + export function validateServerId(serverId: string): string { if ( typeof serverId !== "string" || @@ -132,9 +142,16 @@ function validateSegment(segment: string): void { if (segment === "." || segment === "..") { throw new FileManagerError("path_traversal", `Forbidden path segment "${segment}"`); } - if (FORBIDDEN_COMPONENT_NAMES.has(segment.toLowerCase())) { + const lower = segment.toLowerCase(); + if (FORBIDDEN_COMPONENT_NAMES.has(lower) || lower.startsWith(UPLOAD_STAGING_FILE_PREFIX)) { throw new FileManagerError("path_traversal", `Access to "${segment}" is forbidden`); } + if (WINDOWS_DRIVE_PREFIX_REGEX.test(segment)) { + throw new FileManagerError("path_traversal", "Drive-prefixed path segments are forbidden"); + } + if (segment.includes(":")) { + throw new FileManagerError("invalid_path", "Path component must not contain ':'"); + } if (ENCODED_TRAVERSAL_REGEX.test(segment)) { throw new FileManagerError("path_traversal", "Encoded path separator or NUL is forbidden"); } @@ -346,6 +363,99 @@ export function assertNoSymlinkPath(resolved: ConfinedPath): void { assertNoSymlinkSegments(resolved.serverRoot, resolved.realServerRoot, resolved.segments); } +export function ensureConfinedInternalDir( + serverRoot: string, + realServerRoot: string, + dirName: string, + mode: number = 0o700, +): string { + const dirPath = join(serverRoot, dirName); + let stats: Stats | undefined; + try { + stats = lstatSync(dirPath); + } catch (err) { + if (!isErrnoCode(err, "ENOENT")) { + throw wrapIoError(err, "Failed to inspect internal directory"); + } + } + + if (stats === undefined) { + try { + mkdirSync(dirPath, { mode }); + } catch (err) { + if (!isErrnoCode(err, "EEXIST")) { + throw wrapIoError(err, "Failed to create internal directory"); + } + } + try { + stats = lstatSync(dirPath); + } catch (err) { + throw wrapIoError(err, "Failed to verify internal directory"); + } + } + + if (stats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", `Internal directory "${dirName}" is a symlink`); + } + if (!stats.isDirectory()) { + throw new FileManagerError("not_a_directory", `Internal path "${dirName}" is not a directory`); + } + + let realDir: string; + try { + realDir = realpathSync(dirPath); + } catch (err) { + throw wrapIoError(err, "Failed to resolve internal directory"); + } + if (!isStrictlyInsideOrEqual(realServerRoot, realDir, false)) { + throw new FileManagerError("path_traversal", "Internal directory escaped server root"); + } + + return dirPath; +} + +export function assertConfinedInternalDir( + serverRoot: string, + realServerRoot: string, + dirPath: string, +): void { + let rootStats: Stats; + try { + rootStats = lstatSync(serverRoot); + } catch (err) { + throw wrapIoError(err, "Failed to inspect server root"); + } + if (rootStats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Server root must not be a symbolic link"); + } + if (!rootStats.isDirectory()) { + throw new FileManagerError("server_not_found", "Server root is not a directory"); + } + + let stats: Stats; + try { + stats = lstatSync(dirPath); + } catch (err) { + throw wrapIoError(err, "Failed to inspect internal directory"); + } + if (stats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Internal directory is a symbolic link"); + } + if (!stats.isDirectory()) { + throw new FileManagerError("not_a_directory", "Internal directory is not a directory"); + } + + let realDir: string; + try { + realDir = realpathSync(dirPath); + } catch (err) { + throw wrapIoError(err, "Failed to resolve internal directory"); + } + if (!isStrictlyInsideOrEqual(realServerRoot, realDir, false)) { + throw new FileManagerError("path_traversal", "Internal directory escaped server root"); + } +} + export function openConfinedFileForRead(resolved: ConfinedPath): { readonly fd: number; readonly stats: Stats; @@ -373,9 +483,10 @@ export function openConfinedFileForRead(resolved: ConfinedPath): { } const noFollow = fsConstants.O_NOFOLLOW ?? 0; + const nonBlock = isPosix() ? (fsConstants.O_NONBLOCK ?? 0) : 0; let fd: number; try { - fd = openSync(resolved.fullPath, fsConstants.O_RDONLY | noFollow); + fd = openSync(resolved.fullPath, fsConstants.O_RDONLY | noFollow | nonBlock); } catch (err) { throw wrapIoError(err, "Failed to open target file"); } @@ -395,7 +506,7 @@ export function openConfinedFileForRead(resolved: ConfinedPath): { } catch { // ignore close error on failure path } - throw err; + throw wrapIoError(err, "Failed to validate opened file"); } } @@ -450,7 +561,12 @@ export function mkdirConfined(options: { throw new FileManagerError("not_a_directory", `Path component "${seg}" is not a directory`); } - const realCurrent = realpathSync(current); + let realCurrent: string; + try { + realCurrent = realpathSync(current); + } catch (err) { + throw wrapIoError(err, "Failed to resolve directory path"); + } if (!isStrictlyInsideOrEqual(resolved.realServerRoot, realCurrent, false)) { throw new FileManagerError("path_traversal", "Directory escaped server root"); } @@ -521,6 +637,9 @@ export function writeConfinedFileAtomic( if (existingTarget.isDirectory()) { throw new FileManagerError("is_a_directory", "Refusing to overwrite directory with file"); } + if (!existingTarget.isFile()) { + throw new FileManagerError("not_a_file", "Refusing to overwrite non-regular file"); + } } const suffix = randomBytes(8).toString("hex"); @@ -539,12 +658,11 @@ export function writeConfinedFileAtomic( writeAllBytes(fd, data); } fsyncSync(fd); - closeSync(fd); - fd = undefined; - if (isPosix()) { - chmodSync(tmpPath, mode); + fchmodSync(fd, mode); } + closeSync(fd); + fd = undefined; // Re-validate full path right before atomic rename to mitigate TOCTOU. assertNoSymlinkPath(resolved); @@ -563,6 +681,9 @@ export function writeConfinedFileAtomic( if (preRenameTarget.isDirectory()) { throw new FileManagerError("is_a_directory", "Target became a directory"); } + if (!preRenameTarget.isFile()) { + throw new FileManagerError("not_a_file", "Target became a non-regular file"); + } } renameSync(tmpPath, resolved.fullPath); diff --git a/src/files/index.ts b/src/files/index.ts index 139b784..6144a3b 100644 --- a/src/files/index.ts +++ b/src/files/index.ts @@ -3,18 +3,24 @@ export { type AtomicWriteOptions, + assertConfinedInternalDir, assertNoSymlinkPath, assertNoSymlinkSegments, type ConfinedPath, DEFAULT_SERVERS_BASE_DIR, + ensureConfinedInternalDir, + isSameOrSubpath, MAX_COMPONENT_BYTES, MAX_PATH_BYTES, mkdirConfined, openConfinedFileForRead, parseAndValidateRelativePath, type ResolveConfinedPathOptions, + RUNTIME_DIR_NAME, resolveConfinedPath, resolveServerRoot, + UPLOAD_STAGING_DIR_NAME, + UPLOAD_STAGING_FILE_PREFIX, validateServerId, validateSingleFileName, writeConfinedFileAtomic, diff --git a/src/files/manager.ts b/src/files/manager.ts index 6c16f49..929afea 100644 --- a/src/files/manager.ts +++ b/src/files/manager.ts @@ -10,6 +10,7 @@ import { rmdirSync, type Stats, unlinkSync, + writeSync, } from "node:fs"; import { dirname, join } from "node:path"; import type { CommandQueue } from "../agent/jobs"; @@ -17,9 +18,13 @@ import { assertNoSymlinkPath, DEFAULT_SERVERS_BASE_DIR, isErrnoCode, + isSameOrSubpath, mkdirConfined, openConfinedFileForRead, + RUNTIME_DIR_NAME, resolveConfinedPath, + UPLOAD_STAGING_DIR_NAME, + UPLOAD_STAGING_FILE_PREFIX, validateSingleFileName, wrapIoError, writeConfinedFileAtomic, @@ -106,6 +111,25 @@ export interface FileManagerOptions { readonly zipRatioMinBytes?: number; } +function validateFileEncoding(encoding: unknown): FileEncoding { + if (encoding === undefined) { + return "utf8"; + } + if (encoding !== "utf8" && encoding !== "base64") { + throw new FileManagerError("invalid_encoding", "Encoding must be 'utf8' or 'base64'"); + } + return encoding; +} + +function isInternalEntryName(name: string): boolean { + return ( + name === RUNTIME_DIR_NAME || + name === UPLOAD_STAGING_DIR_NAME || + name.startsWith(UPLOAD_STAGING_FILE_PREFIX) || + name.startsWith(".tmp-") + ); +} + function readExactUpToLimit(fd: number, maxBytes: number): Uint8Array { const chunks: Uint8Array[] = []; let total = 0; @@ -113,7 +137,12 @@ function readExactUpToLimit(fd: number, maxBytes: number): Uint8Array { while (true) { const toRead = Math.min(scratch.byteLength, maxBytes - total + 1); - const bytesRead = readSync(fd, scratch, 0, toRead, null); + let bytesRead: number; + try { + bytesRead = readSync(fd, scratch, 0, toRead, null); + } catch (err) { + throw wrapIoError(err, "Failed to read file"); + } if (bytesRead === 0) { break; } @@ -138,15 +167,62 @@ function readExactUpToLimit(fd: number, maxBytes: number): Uint8Array { return out; } +function streamCopyWithLimit(srcFd: number, dstFd: number, maxRemainingBytes: number): number { + const scratch = Buffer.allocUnsafe(64 * 1024); + let copied = 0; + + while (true) { + const toRead = Math.min(scratch.byteLength, maxRemainingBytes - copied + 1); + let bytesRead: number; + try { + bytesRead = readSync(srcFd, scratch, 0, toRead, null); + } catch (err) { + throw wrapIoError(err, "Failed to read source file during copy"); + } + if (bytesRead === 0) { + break; + } + copied += bytesRead; + if (copied > maxRemainingBytes) { + throw new FileManagerError("copy_limit_exceeded", "Copy exceeds maximum total byte limit"); + } + let writeOffset = 0; + while (writeOffset < bytesRead) { + let written: number; + try { + written = writeSync(dstFd, scratch, writeOffset, bytesRead - writeOffset); + } catch (err) { + throw wrapIoError(err, "Failed to write copied file"); + } + if (written <= 0) { + throw new FileManagerError("io_error", "Short write while copying file"); + } + writeOffset += written; + } + } + + return copied; +} + function ensureSubtreeHasNoSymlinks(dirFullPath: string): void { - const names = readdirSync(dirFullPath); + let names: string[]; + try { + names = readdirSync(dirFullPath); + } catch (err) { + throw wrapIoError(err, "Failed to read directory"); + } for (const name of names) { const childPath = join(dirFullPath, name); - const stats = lstatSync(childPath); + let stats: Stats; + try { + stats = lstatSync(childPath); + } catch (err) { + throw wrapIoError(err, `Failed to inspect "${name}"`); + } if (stats.isSymbolicLink()) { throw new FileManagerError( "symlink_forbidden", - `Refusing recursive delete containing symbolic link "${name}"`, + `Refusing recursive operation containing symbolic link "${name}"`, ); } if (stats.isDirectory()) { @@ -156,10 +232,20 @@ function ensureSubtreeHasNoSymlinks(dirFullPath: string): void { } function deleteSubtreeSafely(dirFullPath: string): void { - const names = readdirSync(dirFullPath); + let names: string[]; + try { + names = readdirSync(dirFullPath); + } catch (err) { + throw wrapIoError(err, "Failed to read directory during delete"); + } for (const name of names) { const childPath = join(dirFullPath, name); - const stats = lstatSync(childPath); + let stats: Stats; + try { + stats = lstatSync(childPath); + } catch (err) { + throw wrapIoError(err, `Failed to inspect "${name}" during delete`); + } if (stats.isSymbolicLink()) { throw new FileManagerError( "symlink_forbidden", @@ -169,10 +255,18 @@ function deleteSubtreeSafely(dirFullPath: string): void { if (stats.isDirectory()) { deleteSubtreeSafely(childPath); } else { - unlinkSync(childPath); + try { + unlinkSync(childPath); + } catch (err) { + throw wrapIoError(err, `Failed to unlink "${name}"`); + } } } - rmdirSync(dirFullPath); + try { + rmdirSync(dirFullPath); + } catch (err) { + throw wrapIoError(err, "Failed to remove directory"); + } } export class FileManager { @@ -244,11 +338,16 @@ export class FileManager { throw new FileManagerError("not_a_directory", "Target path is not a directory"); } - const rawNames = readdirSync(resolved.fullPath).sort(); + let rawNames: string[]; + try { + rawNames = readdirSync(resolved.fullPath).sort(); + } catch (err) { + throw wrapIoError(err, "Failed to list directory"); + } const entries: FileListEntry[] = []; for (const name of rawNames) { - if (name === ".runtime" || name.startsWith(".tmp-upload-")) { + if (isInternalEntryName(name)) { continue; } const entryPath = join(resolved.fullPath, name); @@ -334,7 +433,7 @@ export class FileManager { readonly path: string; readonly encoding?: FileEncoding | undefined; }): FileReadResult { - const encoding = params.encoding ?? "utf8"; + const encoding = validateFileEncoding(params.encoding); const resolved = resolveConfinedPath({ serversBaseDir: this.#serversBaseDir, serverId: params.server_id, @@ -375,11 +474,20 @@ export class FileManager { readonly content: string; readonly encoding?: FileEncoding | undefined; }): FileWriteResult { - const encoding = params.encoding ?? "utf8"; - const data = - encoding === "base64" - ? decodeStrictBase64(params.content) - : new TextEncoder().encode(params.content); + const encoding = validateFileEncoding(params.encoding); + let data: Uint8Array; + if (encoding === "base64") { + data = decodeStrictBase64(params.content, this.#maxReadWriteBytes); + } else { + const byteLen = Buffer.byteLength(params.content, "utf8"); + if (byteLen > this.#maxReadWriteBytes) { + throw new FileManagerError( + "file_too_large", + `Content size ${byteLen} exceeds maximum direct write limit of ${this.#maxReadWriteBytes} bytes`, + ); + } + data = new TextEncoder().encode(params.content); + } if (data.byteLength > this.#maxReadWriteBytes) { throw new FileManagerError( @@ -451,10 +559,7 @@ export class FileManager { allowRoot: false, }); - if ( - toResolved.relativePath === fromResolved.relativePath || - toResolved.relativePath.startsWith(`${fromResolved.relativePath}/`) - ) { + if (isSameOrSubpath(fromResolved.relativePath, toResolved.relativePath)) { throw new FileManagerError( "invalid_path", "Cannot move a path onto itself or inside its own subtree", @@ -533,10 +638,7 @@ export class FileManager { allowRoot: false, }); - if ( - toResolved.relativePath === fromResolved.relativePath || - toResolved.relativePath.startsWith(`${fromResolved.relativePath}/`) - ) { + if (isSameOrSubpath(fromResolved.relativePath, toResolved.relativePath)) { throw new FileManagerError( "invalid_path", "Cannot copy a path onto itself or inside its own subtree", @@ -568,6 +670,63 @@ export class FileManager { throw new FileManagerError("already_exists", "Destination path already exists"); } + // Pre-scan subtree for symlinks, unsupported types, and count/byte ceilings + // before creating destination directories or files. + let scannedFiles = 0; + let scannedBytes = 0; + const preScan = (fullPath: string, stats: Stats, label: string): void => { + if (stats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", `Cannot copy symbolic link "${label}"`); + } + if (stats.isDirectory()) { + let children: string[]; + try { + children = readdirSync(fullPath).sort(); + } catch (err) { + throw wrapIoError(err, `Failed to read directory "${label}"`); + } + for (const child of children) { + const childFull = join(fullPath, child); + let childStats: Stats; + try { + childStats = lstatSync(childFull); + } catch (err) { + throw wrapIoError(err, `Failed to inspect "${label}/${child}"`); + } + if (childStats.isSymbolicLink()) { + throw new FileManagerError( + "symlink_forbidden", + `Cannot copy symbolic link "${label}/${child}"`, + ); + } + if (isInternalEntryName(child)) { + continue; + } + preScan(childFull, childStats, `${label}/${child}`); + } + return; + } + if (!stats.isFile()) { + throw new FileManagerError("not_a_file", `Cannot copy non-regular file "${label}"`); + } + scannedFiles += 1; + if (scannedFiles > this.#maxCopyFiles) { + throw new FileManagerError( + "copy_limit_exceeded", + `Copy exceeds maximum file count of ${this.#maxCopyFiles}`, + ); + } + scannedBytes += stats.size; + if (scannedBytes > this.#maxCopyBytes) { + throw new FileManagerError( + "copy_limit_exceeded", + `Copy exceeds maximum total byte limit of ${this.#maxCopyBytes}`, + ); + } + }; + + preScan(fromResolved.fullPath, fromStats, fromResolved.relativePath); + let filesCopied = 0; let bytesCopied = 0; @@ -585,7 +744,12 @@ export class FileManager { allowRoot: false, }); - const stats = lstatSync(srcConfined.fullPath); + let stats: Stats; + try { + stats = lstatSync(srcConfined.fullPath); + } catch (err) { + throw wrapIoError(err, `Failed to inspect "${srcRel}"`); + } if (stats.isSymbolicLink()) { throw new FileManagerError("symlink_forbidden", `Cannot copy symbolic link "${srcRel}"`); } @@ -596,16 +760,29 @@ export class FileManager { serverId: params.server_id, relPath: dstConfined.relativePath, }); - const children = readdirSync(srcConfined.fullPath).sort(); + let children: string[]; + try { + children = readdirSync(srcConfined.fullPath).sort(); + } catch (err) { + throw wrapIoError(err, `Failed to read directory "${srcRel}"`); + } for (const child of children) { const childFull = join(srcConfined.fullPath, child); - const childStats = lstatSync(childFull); + let childStats: Stats; + try { + childStats = lstatSync(childFull); + } catch (err) { + throw wrapIoError(err, `Failed to inspect "${srcRel}/${child}"`); + } if (childStats.isSymbolicLink()) { throw new FileManagerError( "symlink_forbidden", `Cannot copy symbolic link "${srcRel}/${child}"`, ); } + if (isInternalEntryName(child)) { + continue; + } copyRecursive( `${srcConfined.relativePath}/${child}`, `${dstConfined.relativePath}/${child}`, @@ -626,7 +803,7 @@ export class FileManager { } const { fd, stats: fdStats } = openConfinedFileForRead(srcConfined); - let data: Uint8Array; + let fileBytes = 0; try { if (bytesCopied + fdStats.size > this.#maxCopyBytes) { throw new FileManagerError( @@ -634,31 +811,20 @@ export class FileManager { `Copy exceeds maximum total byte limit of ${this.#maxCopyBytes}`, ); } - try { - data = readExactUpToLimit(fd, this.#maxCopyBytes - bytesCopied); - } catch (err) { - if (err instanceof FileManagerError && err.code === "file_too_large") { - throw new FileManagerError( - "copy_limit_exceeded", - `Copy exceeds maximum total byte limit of ${this.#maxCopyBytes}`, - ); - } - throw err; - } + const remainingLimit = this.#maxCopyBytes - bytesCopied; + writeConfinedFileAtomic(dstConfined, new Uint8Array(0), { + writeHook(dstFd) { + fileBytes = streamCopyWithLimit(fd, dstFd, remainingLimit); + }, + }); } finally { closeSync(fd); } - writeConfinedFileAtomic(dstConfined, data); filesCopied += 1; - bytesCopied += data.byteLength; + bytesCopied += fileBytes; }; - // Pre-scan directory source for symlinks before writing anything. - if (fromStats.isDirectory()) { - ensureSubtreeHasNoSymlinks(fromResolved.fullPath); - } - copyRecursive(fromResolved.relativePath, toResolved.relativePath); return { from_path: fromResolved.relativePath, @@ -693,7 +859,12 @@ export class FileManager { if (stats.isDirectory()) { const recursive = params.recursive ?? false; - const children = readdirSync(resolved.fullPath); + let children: string[]; + try { + children = readdirSync(resolved.fullPath); + } catch (err) { + throw wrapIoError(err, "Failed to inspect directory"); + } if (children.length > 0 && !recursive) { throw new FileManagerError( "is_a_directory", @@ -704,7 +875,11 @@ export class FileManager { ensureSubtreeHasNoSymlinks(resolved.fullPath); deleteSubtreeSafely(resolved.fullPath); } else { - rmdirSync(resolved.fullPath); + try { + rmdirSync(resolved.fullPath); + } catch (err) { + throw wrapIoError(err, "Failed to remove directory"); + } } return { path: resolved.relativePath, deleted: true }; } diff --git a/src/files/transfers.ts b/src/files/transfers.ts index fb4ebd9..44464ea 100644 --- a/src/files/transfers.ts +++ b/src/files/transfers.ts @@ -3,14 +3,16 @@ import { createHash, type Hash, randomBytes } from "node:crypto"; import { - chmodSync, closeSync, + fchmodSync, constants as fsConstants, + fstatSync, fsyncSync, lstatSync, openSync, readSync, renameSync, + rmdirSync, type Stats, unlinkSync, writeSync, @@ -18,13 +20,16 @@ import { import { dirname, join } from "node:path"; import { SHA256_HEX_PATTERN } from "../protocol"; import { + assertConfinedInternalDir, assertNoSymlinkPath, DEFAULT_SERVERS_BASE_DIR, + ensureConfinedInternalDir, isErrnoCode, isPosix, mkdirConfined, openConfinedFileForRead, resolveConfinedPath, + UPLOAD_STAGING_DIR_NAME, wrapIoError, } from "./confinement"; import { FileManagerError } from "./errors"; @@ -37,13 +42,32 @@ export const DEFAULT_MAX_CONCURRENT_DOWNLOADS = 16; const STRICT_BASE64_REGEX = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/; -export function decodeStrictBase64(input: string): Uint8Array { +export function decodeStrictBase64(input: string, maxDecodedBytes?: number): Uint8Array { if (input.length === 0) { return new Uint8Array(0); } + if (maxDecodedBytes !== undefined) { + const maxEncodedLen = Math.ceil(maxDecodedBytes / 3) * 4; + if (input.length > maxEncodedLen) { + throw new FileManagerError( + "file_too_large", + `Encoded payload exceeds maximum allowed ${maxDecodedBytes} bytes`, + ); + } + } if (input.length % 4 !== 0 || !STRICT_BASE64_REGEX.test(input)) { throw new FileManagerError("invalid_encoding", "Invalid base64 payload"); } + if (maxDecodedBytes !== undefined) { + const padding = input.endsWith("==") ? 2 : input.endsWith("=") ? 1 : 0; + const decodedSize = (input.length / 4) * 3 - padding; + if (decodedSize > maxDecodedBytes) { + throw new FileManagerError( + "file_too_large", + `Decoded payload size ${decodedSize} exceeds maximum ${maxDecodedBytes}`, + ); + } + } const buf = Buffer.from(input, "base64"); return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength); } @@ -56,7 +80,10 @@ interface UploadSession { readonly uploadId: string; readonly serverId: string; readonly targetRelPath: string; + readonly stagingDir: string; readonly stagingPath: string; + readonly stagingDev: number; + readonly stagingIno: number; readonly totalSize: number; readonly expectedSha256: string; readonly partSize: number; @@ -182,10 +209,10 @@ export interface DownloadRangeResult { readonly data_base64: string; } -function writeAll(fd: number, data: Uint8Array): void { +function writeAllAt(fd: number, data: Uint8Array, position: number): void { let offset = 0; while (offset < data.byteLength) { - const written = writeSync(fd, data, offset, data.byteLength - offset); + const written = writeSync(fd, data, offset, data.byteLength - offset, position + offset); if (written <= 0) { throw new FileManagerError("io_error", "Short write on staging file"); } @@ -227,6 +254,11 @@ export class TransferManager { // ignore unlink failure on cleanup } } + try { + rmdirSync(session.stagingDir); + } catch { + // ignore if another upload still uses stagingDir or it does not exist + } } #cleanupDownload(session: DownloadSession): void { @@ -241,7 +273,7 @@ export class TransferManager { } beginUpload(params: UploadBeginParams): UploadBeginResult { - if (!Number.isInteger(params.total_size) || params.total_size < 0) { + if (!Number.isSafeInteger(params.total_size) || params.total_size < 0) { throw new FileManagerError("size_mismatch", "total_size must be a non-negative integer"); } if (params.total_size > this.#maxUploadBytes) { @@ -255,7 +287,7 @@ export class TransferManager { } const requestedPartSize = params.part_size ?? Math.min(DEFAULT_PART_BYTES, this.#maxPartBytes); - if (!Number.isInteger(requestedPartSize) || requestedPartSize <= 0) { + if (!Number.isSafeInteger(requestedPartSize) || requestedPartSize <= 0) { throw new FileManagerError("part_too_large", "part_size must be a positive integer"); } if (requestedPartSize > this.#maxPartBytes) { @@ -294,10 +326,19 @@ export class TransferManager { if (existingTarget.isDirectory()) { throw new FileManagerError("is_a_directory", "Upload target is a directory"); } + if (!existingTarget.isFile()) { + throw new FileManagerError("not_a_file", "Upload target is not a regular file"); + } } + const stagingDir = ensureConfinedInternalDir( + resolved.serverRoot, + resolved.realServerRoot, + UPLOAD_STAGING_DIR_NAME, + 0o700, + ); const uploadId = randomBytes(16).toString("hex"); - const stagingPath = join(resolved.serverRoot, `.tmp-upload-${uploadId}`); + const stagingPath = join(stagingDir, uploadId); const noFollow = fsConstants.O_NOFOLLOW ?? 0; const flags = fsConstants.O_CREAT | fsConstants.O_EXCL | fsConstants.O_RDWR | noFollow; @@ -305,14 +346,47 @@ export class TransferManager { try { fd = openSync(stagingPath, flags, 0o600); } catch (err) { + try { + rmdirSync(stagingDir); + } catch { + // ignore cleanup failure + } throw wrapIoError(err, "Failed to create upload staging file"); } + let stagingStats: Stats; + try { + stagingStats = fstatSync(fd); + if (!stagingStats.isFile()) { + throw new FileManagerError("not_a_file", "Upload staging file is not a regular file"); + } + } catch (err) { + try { + closeSync(fd); + } catch { + // ignore cleanup close error + } + try { + unlinkSync(stagingPath); + } catch { + // ignore cleanup unlink error + } + try { + rmdirSync(stagingDir); + } catch { + // ignore cleanup rmdir error + } + throw wrapIoError(err, "Failed to inspect upload staging file"); + } + const session: UploadSession = { uploadId, serverId: resolved.serverId, targetRelPath: resolved.relativePath, + stagingDir, stagingPath, + stagingDev: stagingStats.dev, + stagingIno: stagingStats.ino, totalSize: params.total_size, expectedSha256: params.sha256, partSize: requestedPartSize, @@ -341,15 +415,28 @@ export class TransferManager { throw new FileManagerError("upload_not_found", "Upload session not found"); } - if (params.part_index !== session.nextPartIndex) { + if (!Number.isSafeInteger(params.part_index) || params.part_index !== session.nextPartIndex) { throw new FileManagerError( "part_out_of_order", `Expected part_index ${session.nextPartIndex}, received ${params.part_index}`, ); } - const chunk = decodeStrictBase64(params.data_base64); - if (chunk.byteLength > session.partSize || chunk.byteLength > this.#maxPartBytes) { + const maxAllowedPartBytes = Math.min(session.partSize, this.#maxPartBytes); + let chunk: Uint8Array; + try { + chunk = decodeStrictBase64(params.data_base64, maxAllowedPartBytes); + } catch (err) { + if (err instanceof FileManagerError && err.code === "file_too_large") { + throw new FileManagerError( + "part_too_large", + `Part size exceeds maximum ${session.partSize}`, + ); + } + throw err; + } + + if (chunk.byteLength > maxAllowedPartBytes) { throw new FileManagerError( "part_too_large", `Part size ${chunk.byteLength} exceeds maximum ${session.partSize}`, @@ -365,7 +452,7 @@ export class TransferManager { try { if (chunk.byteLength > 0) { - writeAll(session.fd, chunk); + writeAllAt(session.fd, chunk, session.receivedBytes); session.hash.update(chunk); } } catch (err) { @@ -411,10 +498,6 @@ export class TransferManager { ); } - fsyncSync(session.fd); - closeSync(session.fd); - session.fd = undefined; - const resolved = resolveConfinedPath({ serversBaseDir: this.#serversBaseDir, serverId: session.serverId, @@ -422,6 +505,45 @@ export class TransferManager { allowRoot: false, }); + assertConfinedInternalDir(resolved.serverRoot, resolved.realServerRoot, session.stagingDir); + + const fdStat = fstatSync(session.fd); + if ( + !fdStat.isFile() || + fdStat.dev !== session.stagingDev || + fdStat.ino !== session.stagingIno + ) { + throw new FileManagerError("toctou_detected", "Upload staging file descriptor changed"); + } + if (fdStat.size !== session.totalSize) { + throw new FileManagerError( + "size_mismatch", + `Staging file size ${fdStat.size} does not match declared ${session.totalSize}`, + ); + } + + const stagingPathStat = lstatSync(session.stagingPath); + if (stagingPathStat.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Upload staging path became a symlink"); + } + if ( + !stagingPathStat.isFile() || + stagingPathStat.dev !== session.stagingDev || + stagingPathStat.ino !== session.stagingIno + ) { + throw new FileManagerError( + "toctou_detected", + "Upload staging path was replaced before commit", + ); + } + + fsyncSync(session.fd); + if (isPosix()) { + fchmodSync(session.fd, 0o640); + } + closeSync(session.fd); + session.fd = undefined; + const parentSegments = resolved.segments.slice(0, -1); if (parentSegments.length > 0) { mkdirConfined({ @@ -435,9 +557,15 @@ export class TransferManager { const parentDir = dirname(resolved.fullPath); const parentStats = lstatSync(parentDir); - if (parentStats.isSymbolicLink() || !parentStats.isDirectory()) { + if (parentStats.isSymbolicLink()) { throw new FileManagerError("symlink_forbidden", "Invalid upload destination parent"); } + if (!parentStats.isDirectory()) { + throw new FileManagerError( + "not_a_directory", + "Upload destination parent is not a directory", + ); + } let destStats: Stats | undefined; try { @@ -454,10 +582,22 @@ export class TransferManager { if (destStats.isDirectory()) { throw new FileManagerError("is_a_directory", "Upload destination is a directory"); } + if (!destStats.isFile()) { + throw new FileManagerError("not_a_file", "Upload destination is not a regular file"); + } } - if (isPosix()) { - chmodSync(session.stagingPath, 0o640); + const preRenameStagingStat = lstatSync(session.stagingPath); + if ( + preRenameStagingStat.isSymbolicLink() || + !preRenameStagingStat.isFile() || + preRenameStagingStat.dev !== session.stagingDev || + preRenameStagingStat.ino !== session.stagingIno + ) { + throw new FileManagerError( + "toctou_detected", + "Upload staging path changed before atomic rename", + ); } renameSync(session.stagingPath, resolved.fullPath); @@ -491,7 +631,7 @@ export class TransferManager { beginDownload(params: DownloadBeginParams): DownloadBeginResult { const requestedPartSize = params.part_size ?? Math.min(DEFAULT_PART_BYTES, this.#maxPartBytes); - if (!Number.isInteger(requestedPartSize) || requestedPartSize <= 0) { + if (!Number.isSafeInteger(requestedPartSize) || requestedPartSize <= 0) { throw new FileManagerError("part_too_large", "part_size must be a positive integer"); } if (requestedPartSize > this.#maxPartBytes) { @@ -548,7 +688,7 @@ export class TransferManager { throw new FileManagerError("download_not_found", "Download session not found"); } if ( - !Number.isInteger(params.part_index) || + !Number.isSafeInteger(params.part_index) || params.part_index < 0 || params.part_index >= session.totalParts ) { @@ -562,7 +702,12 @@ export class TransferManager { const remaining = Math.max(0, session.totalSize - offset); const toRead = Math.min(session.partSize, remaining); const buf = Buffer.allocUnsafe(toRead); - const bytesRead = toRead > 0 ? readSync(session.fd, buf, 0, toRead, offset) : 0; + let bytesRead: number; + try { + bytesRead = toRead > 0 ? readSync(session.fd, buf, 0, toRead, offset) : 0; + } catch (err) { + throw wrapIoError(err, "Failed to read download part"); + } const slice = buf.subarray(0, bytesRead); const view = new Uint8Array(slice.buffer, slice.byteOffset, slice.byteLength); @@ -592,10 +737,10 @@ export class TransferManager { } downloadRange(params: DownloadRangeParams): DownloadRangeResult { - if (!Number.isInteger(params.offset) || params.offset < 0) { + if (!Number.isSafeInteger(params.offset) || params.offset < 0) { throw new FileManagerError("invalid_path", "offset must be a non-negative integer"); } - if (!Number.isInteger(params.length) || params.length <= 0) { + if (!Number.isSafeInteger(params.length) || params.length <= 0) { throw new FileManagerError("part_too_large", "length must be a positive integer"); } if (params.length > this.#maxPartBytes) { @@ -617,7 +762,12 @@ export class TransferManager { const remaining = Math.max(0, stats.size - params.offset); const toRead = Math.min(params.length, remaining); const buf = Buffer.allocUnsafe(toRead); - const bytesRead = toRead > 0 ? readSync(fd, buf, 0, toRead, params.offset) : 0; + let bytesRead: number; + try { + bytesRead = toRead > 0 ? readSync(fd, buf, 0, toRead, params.offset) : 0; + } catch (err) { + throw wrapIoError(err, "Failed to read download range"); + } const slice = buf.subarray(0, bytesRead); const view = new Uint8Array(slice.buffer, slice.byteOffset, slice.byteLength); diff --git a/src/files/zip.ts b/src/files/zip.ts index 7b701a9..13725ba 100644 --- a/src/files/zip.ts +++ b/src/files/zip.ts @@ -6,9 +6,14 @@ import { join } from "node:path"; import { deflateRawSync, inflateRawSync } from "node:zlib"; import { DEFAULT_SERVERS_BASE_DIR, + isErrnoCode, + isSameOrSubpath, mkdirConfined, openConfinedFileForRead, + RUNTIME_DIR_NAME, resolveConfinedPath, + UPLOAD_STAGING_DIR_NAME, + UPLOAD_STAGING_FILE_PREFIX, wrapIoError, writeConfinedFileAtomic, } from "./confinement"; @@ -32,16 +37,15 @@ const METHOD_DEFLATE = 8; const FLAG_ENCRYPTED = 0x0001; const FLAG_DATA_DESCRIPTOR = 0x0008; +const FLAG_STRONG_ENCRYPTED = 0x0040; const FLAG_UTF8 = 0x0800; +const MAX_ZLIB_OUTPUT_BYTES = 4294967296; + const UNIX_MODE_MASK = 0o170000; const UNIX_MODE_SYMLINK = 0o120000; const UNIX_MODE_DIRECTORY = 0o040000; const UNIX_MODE_REGULAR = 0o100000; -const UNIX_MODE_FIFO = 0o010000; -const UNIX_MODE_CHARDEV = 0o020000; -const UNIX_MODE_BLOCKDEV = 0o060000; -const UNIX_MODE_SOCKET = 0o140000; const CRC32_TABLE = (() => { const table = new Uint32Array(256); @@ -178,6 +182,11 @@ export function createZipBuffer(entries: readonly ZipEntryInput[]): Uint8Array { cdSize += part.byteLength; } + const totalLength = cdOffset + cdSize + 22; + if (cdOffset > 0xffffffff || cdSize > 0xffffffff || totalLength > 0xffffffff) { + throw new FileManagerError("zip_too_large", "ZIP archive exceeds 4 GiB ZIP32 limit"); + } + const eocd = new Uint8Array(22); const eocdView = new DataView(eocd.buffer); eocdView.setUint32(0, SIG_EOCD, true); @@ -188,8 +197,6 @@ export function createZipBuffer(entries: readonly ZipEntryInput[]): Uint8Array { eocdView.setUint32(12, cdSize, true); eocdView.setUint32(16, cdOffset, true); eocdView.setUint16(20, 0, true); // comment length - - const totalLength = cdOffset + cdSize + eocd.byteLength; const output = new Uint8Array(totalLength); let cursor = 0; for (const part of localParts) { @@ -214,6 +221,8 @@ interface ParsedCentralEntry { readonly compressedSize: number; readonly uncompressedSize: number; readonly localHeaderOffset: number; + readonly dataStart: number; + readonly dataEnd: number; } function findEocdOffset(view: DataView, byteLength: number): number { @@ -251,7 +260,12 @@ function readAllFromFd(fd: number, maxBytes: number): Uint8Array { while (true) { const toRead = Math.min(scratch.byteLength, maxBytes - total + 1); - const bytesRead = readSync(fd, scratch, 0, toRead, null); + let bytesRead: number; + try { + bytesRead = readSync(fd, scratch, 0, toRead, null); + } catch (err) { + throw wrapIoError(err, "Failed to read file"); + } if (bytesRead === 0) { break; } @@ -392,10 +406,12 @@ export function safeUnzipBuffer(options: SafeUnzipBufferOptions): SafeUnzipResul throw new FileManagerError("zip_invalid", "Central Directory exceeds archive bounds"); } - // Phase 1: Validate every Central Directory entry BEFORE creating any directories or files. + // Phase 1: Validate every Central Directory entry, Local File Header, and byte range + // BEFORE creating any directories or files on disk. const entries: ParsedCentralEntry[] = []; - const declaredFilePaths = new Set(); - const declaredDirPaths = new Set(); + const lowerFiles = new Map(); + const lowerDirs = new Map(); + const explicitDirs = new Set(); let declaredTotalUncompressed = 0; let pos = cdOffset; const cdEnd = cdOffset + cdSize; @@ -424,7 +440,7 @@ export function safeUnzipBuffer(options: SafeUnzipBufferOptions): SafeUnzipResul throw new FileManagerError("zip_invalid", "Central Directory entry extends past CD end"); } - if ((flags & FLAG_ENCRYPTED) !== 0) { + if ((flags & (FLAG_ENCRYPTED | FLAG_STRONG_ENCRYPTED)) !== 0) { throw new FileManagerError("zip_unsupported_method", "Encrypted ZIP entries are forbidden"); } if (method !== METHOD_STORE && method !== METHOD_DEFLATE) { @@ -441,12 +457,7 @@ export function safeUnzipBuffer(options: SafeUnzipBufferOptions): SafeUnzipResul "Symbolic link entries inside ZIP archives are forbidden", ); } - if ( - unixType === UNIX_MODE_FIFO || - unixType === UNIX_MODE_CHARDEV || - unixType === UNIX_MODE_BLOCKDEV || - unixType === UNIX_MODE_SOCKET - ) { + if (unixType !== 0 && unixType !== UNIX_MODE_REGULAR && unixType !== UNIX_MODE_DIRECTORY) { throw new FileManagerError( "zip_invalid", "Special UNIX device/FIFO/socket entries are forbidden", @@ -468,33 +479,53 @@ export function safeUnzipBuffer(options: SafeUnzipBufferOptions): SafeUnzipResul unixType === UNIX_MODE_DIRECTORY, ); + const lowerRelPath = validated.targetRelPath.toLowerCase(); if (validated.isDirectory) { if (compressedSize !== 0 || uncompressedSize !== 0) { throw new FileManagerError("zip_invalid", "Directory entry must have zero size"); } - if (declaredFilePaths.has(validated.targetRelPath)) { + if (lowerFiles.has(lowerRelPath)) { throw new FileManagerError("zip_invalid", "Conflicting file and directory path in archive"); } - declaredDirPaths.add(validated.targetRelPath); + const existingDir = lowerDirs.get(lowerRelPath); + if (existingDir !== undefined && existingDir !== validated.targetRelPath) { + throw new FileManagerError( + "zip_invalid", + "Case-colliding directory paths in archive are forbidden", + ); + } + if (explicitDirs.has(lowerRelPath)) { + throw new FileManagerError("zip_invalid", "Duplicate directory entry in archive"); + } + lowerDirs.set(lowerRelPath, validated.targetRelPath); + explicitDirs.add(lowerRelPath); } else { - if ( - declaredFilePaths.has(validated.targetRelPath) || - declaredDirPaths.has(validated.targetRelPath) - ) { - throw new FileManagerError("zip_invalid", "Duplicate or conflicting entry path in archive"); + if (lowerFiles.has(lowerRelPath) || lowerDirs.has(lowerRelPath)) { + throw new FileManagerError( + "zip_invalid", + "Duplicate or case-colliding entry path in archive", + ); } - declaredFilePaths.add(validated.targetRelPath); + lowerFiles.set(lowerRelPath, validated.targetRelPath); const parts = validated.targetRelPath.split("/"); for (let p = 1; p < parts.length; p++) { const ancestor = parts.slice(0, p).join("/"); - if (declaredFilePaths.has(ancestor)) { + const lowerAncestor = ancestor.toLowerCase(); + if (lowerFiles.has(lowerAncestor)) { throw new FileManagerError( "zip_invalid", "Conflicting file and directory ancestor in archive", ); } - declaredDirPaths.add(ancestor); + const existingAncestorDir = lowerDirs.get(lowerAncestor); + if (existingAncestorDir !== undefined && existingAncestorDir !== ancestor) { + throw new FileManagerError( + "zip_invalid", + "Case-colliding ancestor directory paths in archive are forbidden", + ); + } + lowerDirs.set(lowerAncestor, ancestor); } if (uncompressedSize > maxEntryBytes) { @@ -513,6 +544,12 @@ export function safeUnzipBuffer(options: SafeUnzipBufferOptions): SafeUnzipResul } if (method === METHOD_DEFLATE) { + if (compressedSize === 0) { + throw new FileManagerError( + "zip_invalid", + `Deflated ZIP entry "${rawName}" has zero compressed size`, + ); + } const ratioLimit = Math.max( ratioMinBytes, Math.max(1, compressedSize) * maxCompressionRatio, @@ -534,6 +571,52 @@ export function safeUnzipBuffer(options: SafeUnzipBufferOptions): SafeUnzipResul if (localHeaderOffset + 30 > cdOffset) { throw new FileManagerError("zip_invalid", "Local File Header offset out of bounds"); } + if (view.getUint32(localHeaderOffset, true) !== SIG_LOCAL_FILE_HEADER) { + throw new FileManagerError("zip_invalid", "Invalid Local File Header signature"); + } + + const lfhFlags = view.getUint16(localHeaderOffset + 6, true); + const lfhMethod = view.getUint16(localHeaderOffset + 8, true); + const lfhCrc = view.getUint32(localHeaderOffset + 14, true); + const lfhCompressedSize = view.getUint32(localHeaderOffset + 18, true); + const lfhUncompressedSize = view.getUint32(localHeaderOffset + 22, true); + const lfhNameLen = view.getUint16(localHeaderOffset + 26, true); + const lfhExtraLen = view.getUint16(localHeaderOffset + 28, true); + + if ((lfhFlags & (FLAG_ENCRYPTED | FLAG_STRONG_ENCRYPTED)) !== 0) { + throw new FileManagerError("zip_unsupported_method", "Encrypted ZIP entries are forbidden"); + } + if (lfhMethod !== method) { + throw new FileManagerError("zip_invalid", "Local and Central header compression mismatch"); + } + + const dataStart = localHeaderOffset + 30 + lfhNameLen + lfhExtraLen; + const dataEnd = dataStart + compressedSize; + if (dataEnd > cdOffset) { + throw new FileManagerError("zip_invalid", "Local File Header data exceeds archive bounds"); + } + + let lfhName: string; + try { + lfhName = decoder.decode( + buf.subarray(localHeaderOffset + 30, localHeaderOffset + 30 + lfhNameLen), + ); + } catch { + throw new FileManagerError("zip_invalid", "Local header filename is not valid UTF-8"); + } + if (lfhName !== rawName) { + throw new FileManagerError("zip_invalid", "Local and Central header filename mismatch"); + } + + const hasDataDescriptor = (lfhFlags & FLAG_DATA_DESCRIPTOR) !== 0; + if ( + !hasDataDescriptor && + (lfhCrc !== entryCrc || + lfhCompressedSize !== compressedSize || + lfhUncompressedSize !== uncompressedSize) + ) { + throw new FileManagerError("zip_invalid", "Local and Central header metadata mismatch"); + } entries.push({ rawName, @@ -545,11 +628,27 @@ export function safeUnzipBuffer(options: SafeUnzipBufferOptions): SafeUnzipResul compressedSize, uncompressedSize, localHeaderOffset, + dataStart, + dataEnd, }); pos = nextPos; } + if (pos !== cdEnd) { + throw new FileManagerError("zip_invalid", "Central Directory size does not match entries"); + } + + // Verify no two entries overlap in their [localHeaderOffset, dataEnd) byte ranges. + const sortedRanges = [...entries].sort((a, b) => a.localHeaderOffset - b.localHeaderOffset); + for (let i = 1; i < sortedRanges.length; i++) { + const prev = sortedRanges[i - 1]; + const curr = sortedRanges[i]; + if (prev !== undefined && curr !== undefined && prev.dataEnd > curr.localHeaderOffset) { + throw new FileManagerError("zip_invalid", "Overlapping ZIP entry offsets are forbidden"); + } + } + // Phase 2: Extract entries safely with strict runtime decompression budgets. if (destResolved.relativePath.length > 0) { mkdirConfined({ @@ -563,48 +662,6 @@ export function safeUnzipBuffer(options: SafeUnzipBufferOptions): SafeUnzipResul const extractedFiles: string[] = []; for (const entry of entries) { - const lfhOffset = entry.localHeaderOffset; - if (view.getUint32(lfhOffset, true) !== SIG_LOCAL_FILE_HEADER) { - throw new FileManagerError("zip_invalid", "Invalid Local File Header signature"); - } - - const lfhFlags = view.getUint16(lfhOffset + 6, true); - const lfhMethod = view.getUint16(lfhOffset + 8, true); - const lfhCrc = view.getUint32(lfhOffset + 14, true); - const lfhCompressedSize = view.getUint32(lfhOffset + 18, true); - const lfhUncompressedSize = view.getUint32(lfhOffset + 22, true); - const lfhNameLen = view.getUint16(lfhOffset + 26, true); - const lfhExtraLen = view.getUint16(lfhOffset + 28, true); - - const dataStart = lfhOffset + 30 + lfhNameLen + lfhExtraLen; - const dataEnd = dataStart + entry.compressedSize; - if (dataEnd > cdOffset) { - throw new FileManagerError("zip_invalid", "Local File Header data exceeds archive bounds"); - } - if (lfhMethod !== entry.method) { - throw new FileManagerError("zip_invalid", "Local and Central header compression mismatch"); - } - - let lfhName: string; - try { - lfhName = decoder.decode(buf.subarray(lfhOffset + 30, lfhOffset + 30 + lfhNameLen)); - } catch { - throw new FileManagerError("zip_invalid", "Local header filename is not valid UTF-8"); - } - if (lfhName !== entry.rawName) { - throw new FileManagerError("zip_invalid", "Local and Central header filename mismatch"); - } - - const hasDataDescriptor = (lfhFlags & FLAG_DATA_DESCRIPTOR) !== 0; - if ( - !hasDataDescriptor && - (lfhCrc !== entry.crc32 || - lfhCompressedSize !== entry.compressedSize || - lfhUncompressedSize !== entry.uncompressedSize) - ) { - throw new FileManagerError("zip_invalid", "Local and Central header metadata mismatch"); - } - if (entry.isDirectory) { mkdirConfined({ serversBaseDir, @@ -619,7 +676,7 @@ export function safeUnzipBuffer(options: SafeUnzipBufferOptions): SafeUnzipResul throw new FileManagerError("zip_too_large", "ZIP total uncompressed byte limit exceeded"); } - const compressedData = buf.subarray(dataStart, dataEnd); + const compressedData = buf.subarray(entry.dataStart, entry.dataEnd); let plain: Uint8Array; if (entry.method === METHOD_STORE) { @@ -636,9 +693,10 @@ export function safeUnzipBuffer(options: SafeUnzipBufferOptions): SafeUnzipResul Math.max(1, entry.compressedSize) * maxCompressionRatio, ); const maxOutputLength = Math.min(remainingTotalBudget, maxEntryBytes, ratioBudget); + const boundedMaxOutput = Math.min(MAX_ZLIB_OUTPUT_BYTES, Math.max(1, maxOutputLength)); try { - const inflated = inflateRawSync(compressedData, { maxOutputLength }); + const inflated = inflateRawSync(compressedData, { maxOutputLength: boundedMaxOutput }); plain = new Uint8Array(inflated.buffer, inflated.byteOffset, inflated.byteLength); } catch (err) { if (isBufferTooLargeError(err)) { @@ -664,6 +722,10 @@ export function safeUnzipBuffer(options: SafeUnzipBufferOptions): SafeUnzipResul `Failed to decompress ZIP entry "${entry.rawName}"`, ); } + + if (plain.byteLength > remainingTotalBudget) { + throw new FileManagerError("zip_too_large", "ZIP total uncompressed byte limit exceeded"); + } } if (plain.byteLength !== entry.uncompressedSize) { @@ -773,6 +835,26 @@ export function safeZipFiles(options: SafeZipFilesOptions): SafeZipResult { allowRoot: false, }); + let destStats: Stats | undefined; + try { + destStats = lstatSync(destResolved.fullPath); + } catch (err) { + if (!isErrnoCode(err, "ENOENT")) { + throw wrapIoError(err, "Failed to inspect ZIP destination"); + } + } + if (destStats !== undefined) { + if (destStats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "ZIP destination is a symbolic link"); + } + if (destStats.isDirectory()) { + throw new FileManagerError("is_a_directory", "ZIP destination is a directory"); + } + if (!destStats.isFile()) { + throw new FileManagerError("not_a_file", "ZIP destination is not a regular file"); + } + } + const entries: ZipEntryInput[] = []; const seenNames = new Set(); let totalUncompressed = 0; @@ -797,10 +879,7 @@ export function safeZipFiles(options: SafeZipFilesOptions): SafeZipResult { } if (stats.isDirectory()) { - if ( - destResolved.relativePath === resolved.relativePath || - destResolved.relativePath.startsWith(`${resolved.relativePath}/`) - ) { + if (isSameOrSubpath(resolved.relativePath, destResolved.relativePath)) { throw new FileManagerError( "invalid_path", "Destination ZIP path cannot be inside a source directory", @@ -821,19 +900,34 @@ export function safeZipFiles(options: SafeZipFilesOptions): SafeZipResult { }); } - const children = readdirSync(resolved.fullPath).sort(); + let children: string[]; + try { + children = readdirSync(resolved.fullPath).sort(); + } catch (err) { + throw wrapIoError(err, `Failed to read directory "${relPath}"`); + } for (const child of children) { - if (child === ".runtime" || child.startsWith(".tmp-")) { - continue; - } const childFull = join(resolved.fullPath, child); - const childStats = lstatSync(childFull); + let childStats: Stats; + try { + childStats = lstatSync(childFull); + } catch (err) { + throw wrapIoError(err, `Failed to inspect "${resolved.relativePath}/${child}"`); + } if (childStats.isSymbolicLink()) { throw new FileManagerError( "symlink_forbidden", `Cannot archive symbolic link "${resolved.relativePath}/${child}"`, ); } + if ( + child === RUNTIME_DIR_NAME || + child === UPLOAD_STAGING_DIR_NAME || + child.startsWith(UPLOAD_STAGING_FILE_PREFIX) || + child.startsWith(".tmp-") + ) { + continue; + } collectEntry(`${resolved.relativePath}/${child}`); } return; From 17db9f023af75d6769052675024bf7b79b11a6c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 22 Nov 2026 20:29:41 -0300 Subject: [PATCH 12/59] fix: harden server runtime inputs, console streaming and static invariants --- src/cli/run.ts | 19 +- src/server/adversarial.test.ts | 622 +++++++++++++++++++++++++++++++++ src/server/console.ts | 37 +- src/server/download.ts | 15 +- src/server/id.ts | 62 +++- src/server/java.ts | 37 +- src/server/loaders.ts | 73 ++-- src/server/registry.ts | 134 ++++--- src/server/runtime.ts | 81 +++-- src/server/start-script.ts | 40 ++- 10 files changed, 966 insertions(+), 154 deletions(-) create mode 100644 src/server/adversarial.test.ts diff --git a/src/cli/run.ts b/src/cli/run.ts index 27a4aaa..b659730 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -94,16 +94,15 @@ export async function createAgentRuntime( const configuredServersDir = options.serversDir ?? env.TEGRAD_SERVERS_DIR?.trim(); const configuredRunDir = options.runDir ?? env.TEGRAD_RUN_DIR?.trim(); - let serverManager: ServerManager | undefined; - if (configuredServersDir && configuredServersDir.length > 0) { - serverManager = createServerManager({ - serversDir: configuredServersDir, - logger, - ...(configuredRunDir && configuredRunDir.length > 0 ? { runDir: configuredRunDir } : {}), - ...(options.now !== undefined ? { now: options.now } : {}), - }); - registerServerHandlers(queue, serverManager); - } + const serverManager = createServerManager({ + logger, + ...(configuredServersDir && configuredServersDir.length > 0 + ? { serversDir: configuredServersDir } + : {}), + ...(configuredRunDir && configuredRunDir.length > 0 ? { runDir: configuredRunDir } : {}), + ...(options.now !== undefined ? { now: options.now } : {}), + }); + registerServerHandlers(queue, serverManager); const connection = createAgentConnection({ apiUrl: config.apiUrl, diff --git a/src/server/adversarial.test.ts b/src/server/adversarial.test.ts new file mode 100644 index 0000000..3882590 --- /dev/null +++ b/src/server/adversarial.test.ts @@ -0,0 +1,622 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, describe, expect, test } from "bun:test"; +import { createHash } from "node:crypto"; +import { + appendFileSync, + existsSync, + mkdirSync, + mkdtempSync, + readdirSync, + readFileSync, + rmSync, + symlinkSync, + writeFileSync, +} from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { Glob } from "bun"; +import { createLogger, getStatePaths, loadOrCreateIdentity } from "../agent"; +import { createAgentRuntime } from "../cli/run"; +import { MAX_JVM_ARGS, ProtocolError, type ProtocolErrorCode } from "../protocol"; +import { + type ConsoleLinesEvent, + type ConsoleTimerHandle, + type ConsoleTimerProvider, + createConsoleSubscriptionManager, + createServerManager, + downloadVerifiedFile, + type FetchLike, + fetchWithAllowlist, + getJavaBinPath, + installServerLoader, + LOADER_ALLOWED_HOSTS, + readServerMetadata, + resolveServerSubpath, + selectJavaMajor, + validateDownloadUrl, + validateJvmArgs, + validateLaunchTarget, + writeServerProperties, + writeStartScript, +} from "./index"; + +const tempDirs: string[] = []; + +function makeTempDir(prefix: string): string { + const dir = mkdtempSync(join(tmpdir(), prefix)); + tempDirs.push(dir); + return dir; +} + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +function expectProtocolErrorSync(fn: () => unknown, expectedCode: ProtocolErrorCode): void { + try { + fn(); + throw new Error(`Expected ProtocolError(${expectedCode}), but succeeded`); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe(expectedCode); + } +} + +async function expectProtocolErrorAsync( + promise: Promise, + expectedCode: ProtocolErrorCode, +): Promise { + try { + await promise; + throw new Error(`Expected ProtocolError(${expectedCode}), but succeeded`); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe(expectedCode); + } +} + +describe("adversarial static security invariants on src/server", () => { + test("src/server never opens an inbound port and never invokes a shell", async () => { + const forbiddenPatterns: readonly { name: string; regex: RegExp }[] = [ + { name: "Bun.serve", regex: /\bBun\.serve\b/ }, + { + name: "net/http createServer", + regex: /\b(?:net|https?|http2|tls|dgram)\.createServer\b/, + }, + { + name: "network server module import", + regex: /from\s+["'](?:node:)?(?:net|https?|http2|tls|dgram)["']/, + }, + { name: ".listen(", regex: /\.listen\s*\(/ }, + { name: "new Bun.TCPSocket", regex: /\bnew\s+Bun\.TCPSocket\b/ }, + { name: "Bun.listen", regex: /\bBun\.listen\b/ }, + { name: "child_process", regex: /\bchild_process\b/ }, + { name: "Bun.$", regex: /\bBun\.\$/ }, + { name: "shell: true", regex: /\bshell\s*:\s*true\b/ }, + ]; + + const violations: string[] = []; + let checkedCount = 0; + + for await (const path of new Glob("src/server/**/*.ts").scan(".")) { + if (path.endsWith(".test.ts")) continue; + checkedCount++; + const content = await Bun.file(path).text(); + for (const rule of forbiddenPatterns) { + if (rule.regex.test(content)) { + violations.push(`${path}: matched ${rule.name}`); + } + } + } + + expect(checkedCount).toBeGreaterThan(0); + expect(violations).toEqual([]); + }); +}); + +describe("adversarial JVM args and launch target validation", () => { + test("rejects case-variant flags, control chars, log4j/logback/jdk/proxy properties, and oversized args", () => { + const attacks = [ + "-JAVAAGENT:/tmp/evil.jar", + "-AgentLib:jdwp=transport=dt_socket,server=y", + "-AgentPath:/tmp/lib.so", + "-XMS512M", + "-XMX512M", + "-XBootClasspath/p:/tmp/evil.jar", + "-XLOG:all=warning:file=/etc/passwd", + "-XX:onoutofmemoryerror=sh", + "-XX:onerror=sh", + "-XX:+UseG1GC\t-jar", + "-XX:+UseG1GC\v", + "-XX:+UseG1GC\f", + "-XX:+UseG1GC\\id", + "-XX:+UseG1GC>out", + "-XX:+UseG1GC validateJvmArgs([arg]), "invalid_jvm_args"); + } + + const tooMany = Array.from({ length: MAX_JVM_ARGS + 1 }, () => "-XX:+UseG1GC"); + expectProtocolErrorSync(() => validateJvmArgs(tooMany), "invalid_jvm_args"); + }); + + test("rejects traversal, leading slashes, and arbitrary paths in launchTarget", () => { + const badTargets = [ + { kind: "jar" as const, jar_relative_path: "/etc/evil.jar" }, + { kind: "jar" as const, jar_relative_path: "//evil.jar" }, + { kind: "jar" as const, jar_relative_path: "../evil.jar" }, + { kind: "jar" as const, jar_relative_path: "sub/../evil.jar" }, + { kind: "jar" as const, jar_relative_path: ".hidden.jar" }, + { kind: "jar" as const, jar_relative_path: "server.jar;id" }, + { kind: "args_file" as const, args_file_relative_path: "/etc/passwd" }, + { + kind: "args_file" as const, + args_file_relative_path: "libraries/../../etc/unix_args.txt", + }, + { + kind: "args_file" as const, + args_file_relative_path: "libraries/evil/custom/unix_args.txt", + }, + { + kind: "args_file" as const, + args_file_relative_path: "libraries/net/minecraftforge/forge/1.20.1/../../unix_args.txt", + }, + ]; + + for (const target of badTargets) { + expectProtocolErrorSync(() => validateLaunchTarget(target), "invalid_body"); + } + }); + + test("rejects symlinks and intermediate directory symlinks escaping serverDir", () => { + const rootDir = makeTempDir("tegrad-adv-root-"); + const outsideDir = makeTempDir("tegrad-adv-outside-"); + const serverDir = join(rootDir, "srv-1"); + mkdirSync(serverDir, { recursive: true }); + + const outsideSecret = join(outsideDir, "secret.txt"); + writeFileSync(outsideSecret, "TOP_SECRET_KEY"); + + let symlinksSupported = true; + try { + symlinkSync(outsideSecret, join(serverDir, "eula.txt")); + } catch { + symlinksSupported = false; + } + + if (symlinksSupported) { + expectProtocolErrorSync(() => resolveServerSubpath(serverDir, "eula.txt"), "invalid_body"); + + // Intermediate directory symlink where target file does not exist yet + symlinkSync(outsideDir, join(serverDir, "linked-dir")); + expectProtocolErrorSync( + () => resolveServerSubpath(serverDir, "linked-dir/new-file.txt"), + "invalid_body", + ); + + // Dangling symlink pointing to non-existent file outside + symlinkSync(join(outsideDir, "nonexistent.jar"), join(serverDir, "server.jar")); + expectProtocolErrorSync(() => resolveServerSubpath(serverDir, "server.jar"), "invalid_body"); + expectProtocolErrorSync( + () => + writeStartScript(serverDir, { + javaBin: "/usr/bin/java", + memoryMb: 2048, + jvmArgs: [], + launchTarget: { kind: "jar", jar_relative_path: "server.jar" }, + }), + "invalid_body", + ); + } + }); +}); + +describe("adversarial download streaming, redirects, and version validation", () => { + test("rejects URLs with credentials, non-https protocols, non-standard ports, and excessive redirects", async () => { + expectProtocolErrorSync( + () => validateDownloadUrl("http://piston-meta.mojang.com/a.json", LOADER_ALLOWED_HOSTS), + "download_failed", + ); + expectProtocolErrorSync( + () => + validateDownloadUrl( + "https://user:pass@piston-meta.mojang.com/a.json", + LOADER_ALLOWED_HOSTS, + ), + "download_failed", + ); + expectProtocolErrorSync( + () => validateDownloadUrl("https://piston-meta.mojang.com:8443/a.json", LOADER_ALLOWED_HOSTS), + "download_failed", + ); + expectProtocolErrorSync( + () => validateDownloadUrl("https://evil.mojang.com/a.json", LOADER_ALLOWED_HOSTS), + "download_failed", + ); + + // Redirect loop exceeding maxRedirects + const loopFetch: FetchLike = async () => + new Response(null, { + status: 302, + headers: { location: "https://piston-meta.mojang.com/loop" }, + }); + await expectProtocolErrorAsync( + fetchWithAllowlist("https://piston-meta.mojang.com/start", { + allowedHosts: LOADER_ALLOWED_HOSTS, + fetchImpl: loopFetch, + maxRedirects: 3, + }), + "download_failed", + ); + + // Redirect downgrading to http:// on allowed host + const downgradeFetch: FetchLike = async () => + new Response(null, { + status: 302, + headers: { location: "http://piston-meta.mojang.com/insecure.jar" }, + }); + await expectProtocolErrorAsync( + fetchWithAllowlist("https://piston-meta.mojang.com/start", { + allowedHosts: LOADER_ALLOWED_HOSTS, + fetchImpl: downgradeFetch, + }), + "download_failed", + ); + }); + + test("aborts download and deletes temp file when stream exceeds maxBytes despite lying or missing Content-Length", async () => { + const dir = makeTempDir("tegrad-adv-dl-"); + const destPath = join(dir, "server.jar"); + const chunk = new Uint8Array(64).fill(0x41); + const fakeHash = createHash("sha256").update(chunk).digest("hex"); + + const lyingStreamFetch: FetchLike = async () => { + const stream = new ReadableStream({ + start(controller) { + controller.enqueue(chunk); + controller.enqueue(chunk); + controller.enqueue(chunk); + controller.close(); + }, + }); + return new Response(stream, { + status: 200, + headers: { "content-length": "10" }, // lies about size (actual is 192 bytes) + }); + }; + + await expectProtocolErrorAsync( + downloadVerifiedFile({ + url: "https://piston-data.mojang.com/server.jar", + destPath, + allowedHosts: LOADER_ALLOWED_HOSTS, + expectedHash: { algorithm: "sha256", hex: fakeHash }, + maxBytes: 100, + fetchImpl: lyingStreamFetch, + }), + "download_failed", + ); + + expect(existsSync(destPath)).toBe(false); + expect(readdirSync(dir)).toEqual([]); + }); + + test("rejects path traversal in minecraft_version and loader_version across Java and all loaders", async () => { + expectProtocolErrorSync(() => selectJavaMajor("1.20.1-../../etc/passwd"), "invalid_body"); + expectProtocolErrorSync(() => selectJavaMajor("1.21.4;id"), "invalid_body"); + + const dir = makeTempDir("tegrad-adv-loader-"); + const loaders = ["vanilla", "fabric", "quilt", "forge", "neoforge"] as const; + const badVersions = ["../evil", "1.20.1/../../evil", "1.20.1\\..\\evil", "1.20.1;id", "-flag"]; + + let networkTouched = false; + const forbidNetworkFetch: FetchLike = async () => { + networkTouched = true; + return new Response("unexpected network call", { status: 500 }); + }; + + for (const loader of loaders) { + for (const badVersion of badVersions) { + await expectProtocolErrorAsync( + installServerLoader({ + serverDir: dir, + minecraftVersion: badVersion, + loader, + javaBin: "/usr/bin/java", + fetchImpl: forbidNetworkFetch, + }), + "download_failed", + ); + await expectProtocolErrorAsync( + installServerLoader({ + serverDir: dir, + minecraftVersion: "1.20.1", + loader, + loaderVersion: badVersion, + javaBin: "/usr/bin/java", + fetchImpl: forbidNetworkFetch, + }), + "download_failed", + ); + } + } + expect(networkTouched).toBe(false); + + // Compromised remote Forge promotions returning traversal version string + const evilPromoFetch: FetchLike = async () => + new Response(JSON.stringify({ promos: { "1.20.1-recommended": "../../evil" } }), { + status: 200, + }); + await expectProtocolErrorAsync( + installServerLoader({ + serverDir: dir, + minecraftVersion: "1.20.1", + loader: "forge", + javaBin: "/usr/bin/java", + fetchImpl: evilPromoFetch, + }), + "download_failed", + ); + }); +}); + +describe("adversarial server.properties, metadata, and console streaming", () => { + test("writeServerProperties neutralizes colon/space RCON bypasses, duplicate keys, and invalid ports", () => { + const serverDir = makeTempDir("tegrad-adv-props-"); + const propsPath = join(serverDir, "server.properties"); + + writeFileSync( + propsPath, + [ + "# Minecraft properties", + "! Alternative comment", + "enable-rcon: true", + "enable-rcon true", + "enable-rcon=true", + "online-mode: false", + "online-mode false", + "server-port: 11111", + "server-port=22222", + "motd=Safe Server", + ].join("\n"), + ); + + writeServerProperties(serverDir, { port: 25575 }); + const content = readFileSync(propsPath, "utf8"); + const lines = content.trim().split("\n"); + + expect(lines.filter((l) => l.includes("enable-rcon"))).toEqual(["enable-rcon=false"]); + expect(lines.filter((l) => l.includes("online-mode"))).toEqual(["online-mode=true"]); + expect(lines.filter((l) => l.includes("server-port"))).toEqual(["server-port=25575"]); + expect(lines).toContain("motd=Safe Server"); + + expectProtocolErrorSync(() => writeServerProperties(serverDir, { port: 80 }), "invalid_body"); + expectProtocolErrorSync( + () => writeServerProperties(serverDir, { port: 70000 }), + "invalid_body", + ); + expectProtocolErrorSync( + () => + writeServerProperties(serverDir, { + port: "25565\nenable-rcon=true" as unknown as number, + }), + "invalid_body", + ); + }); + + test("readServerMetadata rejects tampered launch_target or mismatched server id on disk", () => { + const serversDir = makeTempDir("tegrad-adv-meta-"); + const srvDir = join(serversDir, "srv-1"); + mkdirSync(srvDir, { recursive: true }); + + writeFileSync( + join(srvDir, "tegrad-server.json"), + JSON.stringify({ + v: 1, + id: "srv-1", + name: "Tampered", + minecraft_version: "1.21.4", + loader: "vanilla", + loader_version: null, + memory_mb: 2048, + jvm_args: [], + port: 25565, + created_at: 1000, + launch_target: { + kind: "jar", + jar_relative_path: "../../evil.jar", + }, + }), + ); + expectProtocolErrorSync(() => readServerMetadata(serversDir, "srv-1"), "invalid_format"); + }); + + test("restartServer refuses when EULA is not accepted without calling systemctl", async () => { + const serversDir = makeTempDir("tegrad-adv-restart-"); + preinstallJava(serversDir); + + const jarBytes = new TextEncoder().encode("jar"); + const sha1 = createHash("sha1").update(jarBytes).digest("hex"); + let systemctlCalled = false; + + const manager = createServerManager({ + serversDir, + platform: "linux", + fetchImpl: async (input) => { + const url = String(input); + if (url.endsWith("version_manifest_v2.json")) { + return new Response( + JSON.stringify({ + versions: [{ id: "1.21.4", url: "https://piston-meta.mojang.com/v1/1.21.4.json" }], + }), + ); + } + if (url.endsWith("1.21.4.json")) { + return new Response( + JSON.stringify({ + downloads: { + server: { sha1, url: "https://piston-data.mojang.com/server.jar" }, + }, + }), + ); + } + return new Response(jarBytes); + }, + runFixedImpl: async () => { + systemctlCalled = true; + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + }, + }); + + await manager.createServer({ + server_id: "srv-eula", + name: "No EULA", + minecraft_version: "1.21.4", + loader: "vanilla", + memory_mb: 2048, + eula_accepted: false, + }); + + await expectProtocolErrorAsync(manager.restartServer("srv-eula"), "eula_not_accepted"); + expect(systemctlCalled).toBe(false); + manager.close(); + }); + + test("console subscription preserves reset=true across rate-limit window and refuses symlinked console.log", () => { + const serversDir = makeTempDir("tegrad-adv-console-"); + const logsDir = join(serversDir, "srv-1", "logs"); + mkdirSync(logsDir, { recursive: true }); + const logPath = join(logsDir, "console.log"); + writeFileSync(logPath, "l1\nl2\nl3\n"); + + const callbacks = new Map void>(); + let nextId = 1; + const timers: ConsoleTimerProvider = { + setInterval(fn) { + const id = nextId++; + callbacks.set(id, fn); + return { id }; + }, + clearInterval(handle: ConsoleTimerHandle) { + callbacks.delete(handle.id as number); + }, + }; + const tick = () => { + for (const fn of [...callbacks.values()]) fn(); + }; + + let nowMs = 10_000; + const manager = createConsoleSubscriptionManager({ + serversDir, + timers, + maxLinesPerEvent: 5, + maxBytesPerEvent: 16, + maxLinesPerSecond: 3, + now: () => nowMs, + }); + + const events: ConsoleLinesEvent[] = []; + manager.subscribe({ + serverId: "srv-1", + sendEvent: (_type, body) => events.push(body), + }); + + // Initial poll consumed all 3 lines allowed in this 1-second window + expect(events).toHaveLength(1); + expect(events[0]?.lines).toEqual(["l1", "l2", "l3"]); + + // Truncate/rotate file while rate-limited in the same 1-second window + writeFileSync(logPath, "new\n"); + tick(); + // Rate-limited, so no event emitted yet + expect(events).toHaveLength(1); + + // Advance clock to next 1-second window: reset=true MUST still be delivered! + nowMs += 1000; + tick(); + expect(events).toHaveLength(2); + expect(events[1]?.reset).toBe(true); + expect(events[1]?.lines).toEqual(["new"]); + + // Single line exceeding maxBytesPerEvent (16 bytes) without newline is flushed with truncated=true + nowMs += 1000; + appendFileSync(logPath, "0123456789abcdefXYZ"); + tick(); + expect(events).toHaveLength(3); + expect(events[2]?.lines).toEqual(["0123456789abcdef"]); + expect(events[2]?.truncated).toBe(true); + + // Replacing console.log with a symlink to a secret file outside serverDir is ignored + const outsideSecret = join(makeTempDir("tegrad-adv-secret-"), "identity.json"); + writeFileSync(outsideSecret, '{"secret_key":"DO_NOT_LEAK"}\n'); + rmSync(logPath, { force: true }); + let symlinkCreated = true; + try { + symlinkSync(outsideSecret, logPath); + } catch { + symlinkCreated = false; + } + if (symlinkCreated) { + nowMs += 1000; + tick(); + expect(events).toHaveLength(3); + } + + manager.closeAll(); + }); + + test("createAgentRuntime registers serverManager by default even when TEGRAD_SERVERS_DIR is unset", async () => { + const stateDir = makeTempDir("tegrad-adv-runtime-"); + await loadOrCreateIdentity(stateDir); + const { configPath } = getStatePaths(stateDir); + writeFileSync(configPath, JSON.stringify({ api_url: "https://api.tegra.example" }), "utf8"); + + const runtime = await createAgentRuntime({ + stateDir, + env: {}, + logger: createLogger({ level: "error", stdout: () => {}, stderr: () => {} }), + }); + expect(runtime.serverManager).toBeDefined(); + await runtime.shutdown(100); + }); +}); + +function preinstallJava(serversDir: string): void { + const binPath = getJavaBinPath(serversDir, 21, "linux"); + mkdirSync(join(binPath, ".."), { recursive: true }); + writeFileSync(binPath, "#!/bin/sh\n"); +} diff --git a/src/server/console.ts b/src/server/console.ts index fa65ad8..1751368 100644 --- a/src/server/console.ts +++ b/src/server/console.ts @@ -1,7 +1,16 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import { closeSync, constants, existsSync, openSync, readSync, statSync, writeSync } from "node:fs"; +import { + closeSync, + constants, + existsSync, + lstatSync, + openSync, + readSync, + statSync, + writeSync, +} from "node:fs"; import { consoleLineSchema, ProtocolError } from "../protocol"; import { assertValidServerId, resolveFifoPath, resolveServerDir, resolveServerSubpath } from "./id"; @@ -113,10 +122,12 @@ export interface ConsoleSubscriptionManagerOptions { interface ActiveSubscription { readonly serverId: string; + readonly serverDir: string; readonly logPath: string; readonly sendEvent: ConsoleEventEmitter; readonly timer: ConsoleTimerHandle; offset: number; + pendingReset: boolean; windowStartMs: number; windowLineCount: number; } @@ -146,7 +157,14 @@ export function createConsoleSubscriptionManager( const subscriptions = new Map(); function pollSubscription(sub: ActiveSubscription): void { - if (!existsSync(sub.logPath)) { + try { + resolveServerSubpath(sub.serverDir, "logs/console.log"); + } catch { + return; + } + + const lstat = lstatSync(sub.logPath, { throwIfNoEntry: false }); + if (lstat === undefined || lstat.isSymbolicLink() || !lstat.isFile()) { return; } @@ -157,15 +175,17 @@ export function createConsoleSubscriptionManager( return; } - let reset = false; + // Rotation is detected when the file shrinks below the read offset. The log is append-only + // (systemd `append:`), so any truncation by the agent makes it smaller than the offset. if (fileSize < sub.offset) { sub.offset = 0; - reset = true; + sub.pendingReset = true; } const availableBytes = fileSize - sub.offset; if (availableBytes <= 0) { - if (reset) { + if (sub.pendingReset) { + sub.pendingReset = false; sub.sendEvent("server.console.lines", { server_id: sub.serverId, lines: [], @@ -194,7 +214,8 @@ export function createConsoleSubscriptionManager( let bytesRead = 0; let fd: number | undefined; try { - fd = openSync(sub.logPath, "r"); + const openFlags = constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0); + fd = openSync(sub.logPath, openFlags); bytesRead = readSync(fd, buffer, 0, bytesToRead, sub.offset); } catch { return; @@ -241,12 +262,14 @@ export function createConsoleSubscriptionManager( truncated = true; } + const reset = sub.pendingReset; if (lines.length === 0 && !reset) { return; } sub.offset += consumedBytes; sub.windowLineCount += lines.length; + sub.pendingReset = false; const event: ConsoleLinesEvent = { server_id: sub.serverId, @@ -280,9 +303,11 @@ export function createConsoleSubscriptionManager( const sub: ActiveSubscription = { serverId: validId, + serverDir, logPath, sendEvent: params.sendEvent, offset: params.fromOffset ?? 0, + pendingReset: false, windowStartMs: now(), windowLineCount: 0, timer: timers.setInterval(() => { diff --git a/src/server/download.ts b/src/server/download.ts index eeb3740..c91c748 100644 --- a/src/server/download.ts +++ b/src/server/download.ts @@ -52,6 +52,10 @@ export function validateDownloadUrl(rawUrl: string, allowedHosts: ReadonlySet { @@ -308,7 +319,7 @@ export async function downloadVerifiedFile( } if (buf.byteLength > 0) { hasher.update(buf); - writeSync(fd, buf, 0, buf.byteLength); + writeAllSync(fd, buf); totalBytes = buf.byteLength; } } else { @@ -328,7 +339,7 @@ export async function downloadVerifiedFile( throw new ProtocolError("download_failed", "Download exceeds maximum allowed size"); } hasher.update(value); - writeSync(fd, value, 0, value.byteLength); + writeAllSync(fd, value); } } finally { reader.releaseLock(); diff --git a/src/server/id.ts b/src/server/id.ts index 2789bdb..3df4eee 100644 --- a/src/server/id.ts +++ b/src/server/id.ts @@ -1,8 +1,8 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import { existsSync, realpathSync } from "node:fs"; -import { isAbsolute, relative, resolve } from "node:path"; +import { existsSync, lstatSync, realpathSync } from "node:fs"; +import { dirname, isAbsolute, relative, resolve } from "node:path"; import { ProtocolError, SERVER_ID_REGEX, serverIdSchema } from "../protocol"; export { SERVER_ID_REGEX, serverIdSchema }; @@ -21,6 +21,23 @@ export function assertValidServerId(id: string): string { return parsed.data; } +function findDeepestExistingAncestor(targetPath: string, stopAtRoot: string): string | null { + let current = targetPath; + while (true) { + if (existsSync(current)) { + return current; + } + if (current === stopAtRoot) { + return null; + } + const parent = dirname(current); + if (parent === current) { + return null; + } + current = parent; + } +} + function assertStrictlyInside(rootDir: string, candidatePath: string, label: string): void { const resolvedRoot = resolve(rootDir); const resolvedCandidate = resolve(candidatePath); @@ -30,17 +47,38 @@ function assertStrictlyInside(rootDir: string, candidatePath: string, label: str throw new ProtocolError("invalid_body", `${label} escapes allowed directory`); } - if (existsSync(resolvedRoot) && existsSync(resolvedCandidate)) { + const candidateLstat = lstatSync(resolvedCandidate, { throwIfNoEntry: false }); + if (candidateLstat?.isSymbolicLink() && !existsSync(resolvedCandidate)) { + throw new ProtocolError("invalid_body", `${label} dangling symlink is not allowed`); + } + + if (existsSync(resolvedRoot)) { const realRoot = realpathSync(resolvedRoot); - const realCandidate = realpathSync(resolvedCandidate); - const realRel = relative(realRoot, realCandidate); - if ( - realRel.length === 0 || - realRel === "." || - realRel.startsWith("..") || - isAbsolute(realRel) - ) { - throw new ProtocolError("invalid_body", `${label} symlink escapes allowed directory`); + if (existsSync(resolvedCandidate)) { + const realCandidate = realpathSync(resolvedCandidate); + const realRel = relative(realRoot, realCandidate); + if ( + realRel.length === 0 || + realRel === "." || + realRel.startsWith("..") || + isAbsolute(realRel) + ) { + throw new ProtocolError("invalid_body", `${label} symlink escapes allowed directory`); + } + } else { + const ancestor = findDeepestExistingAncestor(resolvedCandidate, resolvedRoot); + if (ancestor !== null && ancestor !== resolvedRoot) { + const realAncestor = realpathSync(ancestor); + const ancestorRel = relative(realRoot, realAncestor); + if ( + ancestorRel.length === 0 || + ancestorRel === "." || + ancestorRel.startsWith("..") || + isAbsolute(ancestorRel) + ) { + throw new ProtocolError("invalid_body", `${label} symlink escapes allowed directory`); + } + } } } } diff --git a/src/server/java.ts b/src/server/java.ts index c9c6b50..54261e0 100644 --- a/src/server/java.ts +++ b/src/server/java.ts @@ -39,6 +39,7 @@ export const ADOPTIUM_ALLOWED_HOSTS: ReadonlySet = new Set([ const RUNTIME_DIR_MODE = 0o750; const RUNTIME_BIN_MODE = 0o750; +const RUNTIME_FILE_MODE = 0o640; const adoptiumAssetSchema = z.object({ binary: z.object({ @@ -52,7 +53,7 @@ const adoptiumAssetSchema = z.object({ const adoptiumAssetsResponseSchema = z.array(adoptiumAssetSchema); -const STANDARD_MC_VERSION_REGEX = /^(\d+)\.(\d+)(?:\.(\d+))?(?:[-+].*)?$/; +const STANDARD_MC_VERSION_REGEX = /^(\d+)\.(\d+)(?:\.(\d+))?(?:[-+][A-Za-z0-9._-]+)?$/; const SNAPSHOT_MC_VERSION_REGEX = /^(\d{2})w(\d{2})[a-z]$/i; function isPosix(platform: NodeJS.Platform = process.platform): boolean { @@ -61,6 +62,12 @@ function isPosix(platform: NodeJS.Platform = process.platform): boolean { export function selectJavaMajor(minecraftVersion: string): JavaMajor { const trimmed = minecraftVersion.trim(); + if (trimmed.includes("..")) { + throw new ProtocolError( + "invalid_body", + `Unsupported Minecraft version format for Java selection: ${minecraftVersion}`, + ); + } const stdMatch = STANDARD_MC_VERSION_REGEX.exec(trimmed); if (stdMatch !== null) { @@ -147,19 +154,25 @@ function findExtractedJavaRoot(extractDir: string, binName: string): string | nu return null; } -function applyRuntimePermissions(dirPath: string): void { +function applyRuntimePermissions(dirPath: string, inBinDir: boolean = false): void { if (!isPosix()) { return; } chmodSync(dirPath, RUNTIME_DIR_MODE); - const binDir = join(dirPath, "bin"); - if (existsSync(binDir)) { - chmodSync(binDir, RUNTIME_DIR_MODE); - for (const entry of readdirSync(binDir, { withFileTypes: true })) { - const fullPath = join(binDir, entry.name); - if (entry.isFile()) { - chmodSync(fullPath, RUNTIME_BIN_MODE); - } + for (const entry of readdirSync(dirPath, { withFileTypes: true })) { + if (entry.isSymbolicLink()) { + continue; + } + const fullPath = join(dirPath, entry.name); + if (entry.isDirectory()) { + applyRuntimePermissions(fullPath, inBinDir || entry.name === "bin"); + } else if (entry.isFile()) { + const isExecutable = + inBinDir || + entry.name === "jspawnhelper" || + entry.name === "jexec" || + (statSync(fullPath).mode & 0o100) !== 0; + chmodSync(fullPath, isExecutable ? RUNTIME_BIN_MODE : RUNTIME_FILE_MODE); } } } @@ -229,9 +242,11 @@ export async function ensureJavaRuntime( const arch = options.arch ?? resolveAdoptiumArch(); const asset = await queryAdoptiumAsset(major, arch, options.fetchImpl); - const runtimeRoot = join(resolve(options.serversDir), ".runtime", "java"); + const dotRuntimeDir = join(resolve(options.serversDir), ".runtime"); + const runtimeRoot = join(dotRuntimeDir, "java"); mkdirSync(runtimeRoot, { recursive: true, mode: RUNTIME_DIR_MODE }); if (isPosix(platform)) { + chmodSync(dotRuntimeDir, RUNTIME_DIR_MODE); chmodSync(runtimeRoot, RUNTIME_DIR_MODE); } diff --git a/src/server/loaders.ts b/src/server/loaders.ts index 5bd37b4..c8cab6e 100644 --- a/src/server/loaders.ts +++ b/src/server/loaders.ts @@ -3,7 +3,6 @@ import { randomBytes } from "node:crypto"; import { existsSync, rmSync } from "node:fs"; -import { join } from "node:path"; import { z } from "zod"; import { runFixed } from "../agent/exec"; import { ProtocolError, type ServerLoader } from "../protocol"; @@ -20,6 +19,15 @@ import { resolveServerSubpath } from "./id"; import type { RunFixedLike } from "./java"; import type { ServerLaunchTarget } from "./start-script"; +const SAFE_VERSION_TOKEN_REGEX = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/; + +export function assertSafeVersionToken(token: string, label: string): string { + if (!SAFE_VERSION_TOKEN_REGEX.test(token) || token.includes("..")) { + throw new ProtocolError("download_failed", `Invalid ${label} version format`); + } + return token; +} + export const LOADER_ALLOWED_HOSTS: ReadonlySet = new Set([ "piston-meta.mojang.com", "launchermeta.mojang.com", @@ -226,7 +234,9 @@ async function installFabric(options: InstallLoaderOptions): Promise { + assertSafeVersionToken(options.minecraftVersion, "Minecraft"); + if (options.loaderVersion !== undefined) { + assertSafeVersionToken(options.loaderVersion, "loader"); + } switch (options.loader) { case "vanilla": return installVanilla(options); diff --git a/src/server/registry.ts b/src/server/registry.ts index be8abd8..6c01c5b 100644 --- a/src/server/registry.ts +++ b/src/server/registry.ts @@ -2,7 +2,6 @@ // Copyright (C) 2026 Antônio Miranda import { existsSync, readdirSync, readFileSync } from "node:fs"; -import { join } from "node:path"; import { z } from "zod"; import { writeFileAtomic } from "../agent/state"; import { @@ -14,30 +13,43 @@ import { serverMemoryMbSchema, serverPortSchema, } from "../protocol"; -import { resolveServerDir } from "./id"; -import type { ServerLaunchTarget } from "./start-script"; +import { resolveServerDir, resolveServerSubpath } from "./id"; +import { type ServerLaunchTarget, validateLaunchTarget } from "./start-script"; export const SERVER_METADATA_FILE = "tegrad-server.json"; export const EULA_FILE = "eula.txt"; export const SERVER_PROPERTIES_FILE = "server.properties"; -const SERVER_FILE_MODE = 0o640; -const SERVER_DIR_MODE = 0o750; - -export const serverLaunchTargetSchema = z.discriminatedUnion("kind", [ - z - .object({ - kind: z.literal("jar"), - jar_relative_path: z.string().min(1), - }) - .strict(), - z - .object({ - kind: z.literal("args_file"), - args_file_relative_path: z.string().min(1), - }) - .strict(), -]); +const SERVER_METADATA_MODE = 0o640; +const SERVER_DATA_FILE_MODE = 0o660; +const SERVER_DIR_MODE = 0o770; + +export const serverLaunchTargetSchema = z + .discriminatedUnion("kind", [ + z + .object({ + kind: z.literal("jar"), + jar_relative_path: z.string().min(1), + }) + .strict(), + z + .object({ + kind: z.literal("args_file"), + args_file_relative_path: z.string().min(1), + }) + .strict(), + ]) + .refine( + (target) => { + try { + validateLaunchTarget(target); + return true; + } catch { + return false; + } + }, + { message: "Invalid launch_target relative path" }, + ); export const serverMetadataSchema = z .object({ @@ -72,17 +84,17 @@ export function writeServerMetadata(serversDir: string, metadata: ServerMetadata throw new ProtocolError("invalid_body", "Invalid server metadata"); } const serverDir = resolveServerDir(serversDir, parsed.data.id); - const metadataPath = join(serverDir, SERVER_METADATA_FILE); + const metadataPath = resolveServerSubpath(serverDir, SERVER_METADATA_FILE); const payload = `${JSON.stringify(parsed.data, null, 2)}\n`; writeFileAtomic(metadataPath, payload, { - mode: SERVER_FILE_MODE, + mode: SERVER_METADATA_MODE, dirMode: SERVER_DIR_MODE, }); } export function readServerMetadata(serversDir: string, id: string): ServerMetadata { const serverDir = resolveServerDir(serversDir, id); - const metadataPath = join(serverDir, SERVER_METADATA_FILE); + const metadataPath = resolveServerSubpath(serverDir, SERVER_METADATA_FILE); if (!existsSync(metadataPath)) { throw new ProtocolError("server_not_found", `Server not found: ${id}`); } @@ -122,7 +134,7 @@ export function listServerMetadata(serversDir: string): ServerMetadata[] { continue; } const serverDir = resolveServerDir(serversDir, entry.name); - const metadataPath = join(serverDir, SERVER_METADATA_FILE); + const metadataPath = resolveServerSubpath(serverDir, SERVER_METADATA_FILE); if (!existsSync(metadataPath)) { continue; } @@ -134,16 +146,16 @@ export function listServerMetadata(serversDir: string): ServerMetadata[] { } export function writeEulaFile(serverDir: string, accepted: boolean): void { - const eulaPath = join(serverDir, EULA_FILE); + const eulaPath = resolveServerSubpath(serverDir, EULA_FILE); const content = accepted ? "eula=true\n" : "eula=false\n"; writeFileAtomic(eulaPath, content, { - mode: SERVER_FILE_MODE, + mode: SERVER_DATA_FILE_MODE, dirMode: SERVER_DIR_MODE, }); } export function isEulaAccepted(serverDir: string): boolean { - const eulaPath = join(serverDir, EULA_FILE); + const eulaPath = resolveServerSubpath(serverDir, EULA_FILE); if (!existsSync(eulaPath)) { return false; } @@ -157,18 +169,15 @@ export function isEulaAccepted(serverDir: string): boolean { for (const rawLine of content.split(/\r?\n/)) { const trimmed = rawLine.trim(); - if (trimmed.length === 0 || trimmed.startsWith("#")) { + if (trimmed.length === 0 || trimmed.startsWith("#") || trimmed.startsWith("!")) { continue; } - const eqIndex = trimmed.indexOf("="); - if (eqIndex === -1) { + const match = /^([a-zA-Z0-9_.-]+)\s*(?:[=:]|\s)\s*(.*)$/.exec(trimmed); + if (!match) { continue; } - const key = trimmed.slice(0, eqIndex).trim().toLowerCase(); - const val = trimmed - .slice(eqIndex + 1) - .trim() - .toLowerCase(); + const key = (match[1] ?? "").toLowerCase(); + const val = (match[2] ?? "").trim().toLowerCase(); if (key === "eula") { return val === "true"; } @@ -186,7 +195,14 @@ export function writeServerProperties( serverDir: string, options: UpdateServerPropertiesOptions, ): void { - const propsPath = join(serverDir, SERVER_PROPERTIES_FILE); + const portParsed = serverPortSchema.safeParse(options.port); + if (!portParsed.success) { + throw new ProtocolError("invalid_body", "Invalid server port"); + } + const validPort = portParsed.data; + const forceOnlineMode = options.forceOnlineMode ?? true; + + const propsPath = resolveServerSubpath(serverDir, SERVER_PROPERTIES_FILE); const lines: string[] = []; if (existsSync(propsPath)) { @@ -202,33 +218,45 @@ export function writeServerProperties( let sawOnlineMode = false; let sawRcon = false; - const updated = lines.map((line) => { + const updated: string[] = []; + for (const line of lines) { const trimmed = line.trim(); - if (trimmed.startsWith("#")) { - return line; + if (trimmed.startsWith("#") || trimmed.startsWith("!")) { + updated.push(line); + continue; } - const eqIndex = trimmed.indexOf("="); - if (eqIndex === -1) { - return line; + const match = /^([a-zA-Z0-9_.-]+)\s*(?:[=:]|\s)\s*(.*)$/.exec(trimmed); + if (!match) { + updated.push(line); + continue; } - const key = trimmed.slice(0, eqIndex).trim(); + const key = match[1] ?? ""; if (key === "server-port") { - sawPort = true; - return `server-port=${options.port}`; + if (!sawPort) { + sawPort = true; + updated.push(`server-port=${validPort}`); + } + continue; } if (key === "online-mode") { - sawOnlineMode = true; - return options.forceOnlineMode ? "online-mode=true" : line; + if (!sawOnlineMode) { + sawOnlineMode = true; + updated.push(forceOnlineMode ? "online-mode=true" : line); + } + continue; } if (key === "enable-rcon") { - sawRcon = true; - return "enable-rcon=false"; + if (!sawRcon) { + sawRcon = true; + updated.push("enable-rcon=false"); + } + continue; } - return line; - }); + updated.push(line); + } if (!sawPort) { - updated.push(`server-port=${options.port}`); + updated.push(`server-port=${validPort}`); } if (!sawOnlineMode) { updated.push("online-mode=true"); @@ -238,7 +266,7 @@ export function writeServerProperties( } writeFileAtomic(propsPath, `${updated.join("\n")}\n`, { - mode: SERVER_FILE_MODE, + mode: SERVER_DATA_FILE_MODE, dirMode: SERVER_DIR_MODE, }); } diff --git a/src/server/runtime.ts b/src/server/runtime.ts index cd5550d..8c45f44 100644 --- a/src/server/runtime.ts +++ b/src/server/runtime.ts @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import { chmodSync, existsSync, mkdirSync, rmSync } from "node:fs"; +import { chmodSync, existsSync, mkdirSync, readdirSync, rmSync } from "node:fs"; import { join } from "node:path"; import type { CommandQueue } from "../agent/jobs"; import type { Logger } from "../agent/logger"; @@ -12,6 +12,8 @@ import { type ServerConsoleSubscribeBody, type ServerCreateBody, type ServerUpdateSettingsBody, + serverCreateBodySchema, + serverUpdateSettingsBodySchema, } from "../protocol"; import { type ConsoleEventEmitter, @@ -52,12 +54,31 @@ import { stopServerUnit, } from "./systemd"; -const SERVER_DIR_MODE = 0o750; +const SERVER_DIR_MODE = 0o770; +const SERVER_DATA_FILE_MODE = 0o660; function isPosix(platform: NodeJS.Platform = process.platform): boolean { return platform !== "win32"; } +function applyServerTreePermissions(dirPath: string, platform: NodeJS.Platform): void { + if (!isPosix(platform)) { + return; + } + chmodSync(dirPath, SERVER_DIR_MODE); + for (const entry of readdirSync(dirPath, { withFileTypes: true })) { + if (entry.isSymbolicLink()) { + continue; + } + const fullPath = join(dirPath, entry.name); + if (entry.isDirectory()) { + applyServerTreePermissions(fullPath, platform); + } else if (entry.isFile()) { + chmodSync(fullPath, SERVER_DATA_FILE_MODE); + } + } +} + export interface ServerStatusReport { readonly server: ServerMetadata; readonly eula_accepted: boolean; @@ -151,7 +172,11 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM async function createServer(params: ServerCreateBody): Promise { const validId = assertValidServerId(params.server_id); const jvmArgs = validateJvmArgs(params.jvm_args ?? []); - const port = params.port ?? DEFAULT_SERVER_PORT; + const parsedParams = serverCreateBodySchema.safeParse(params); + if (!parsedParams.success) { + throw new ProtocolError("invalid_body", "Invalid server.create parameters"); + } + const port = parsedParams.data.port ?? DEFAULT_SERVER_PORT; const serverDir = resolveServerDir(serversDir, validId); if (existsSync(serverDir)) { @@ -169,7 +194,7 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM try { const javaRuntime = await ensureJavaRuntime({ serversDir, - minecraftVersion: params.minecraft_version, + minecraftVersion: parsedParams.data.minecraft_version, platform, ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), ...(options.runFixedImpl !== undefined ? { runFixedImpl: options.runFixedImpl } : {}), @@ -177,19 +202,22 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM const loaderResult = await installServerLoader({ serverDir, - minecraftVersion: params.minecraft_version, - loader: params.loader, + minecraftVersion: parsedParams.data.minecraft_version, + loader: parsedParams.data.loader, javaBin: javaRuntime.javaBin, - ...(params.loader_version !== undefined ? { loaderVersion: params.loader_version } : {}), + ...(parsedParams.data.loader_version !== undefined + ? { loaderVersion: parsedParams.data.loader_version } + : {}), ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), ...(options.runFixedImpl !== undefined ? { runFixedImpl: options.runFixedImpl } : {}), }); - writeEulaFile(serverDir, params.eula_accepted); + applyServerTreePermissions(serverDir, platform); + writeEulaFile(serverDir, parsedParams.data.eula_accepted); writeServerProperties(serverDir, { port, forceOnlineMode: true }); writeStartScript(serverDir, { javaBin: javaRuntime.javaBin, - memoryMb: params.memory_mb, + memoryMb: parsedParams.data.memory_mb, jvmArgs, launchTarget: loaderResult.launchTarget, }); @@ -197,11 +225,11 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM const metadata: ServerMetadata = { v: 1, id: validId, - name: params.name.trim(), + name: parsedParams.data.name.trim(), minecraft_version: loaderResult.minecraftVersion, loader: loaderResult.loader, loader_version: loaderResult.loaderVersion, - memory_mb: params.memory_mb, + memory_mb: parsedParams.data.memory_mb, jvm_args: [...jvmArgs], port, created_at: now(), @@ -340,15 +368,19 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM function updateServerSettings(params: ServerUpdateSettingsBody): ServerMetadata { const validId = assertValidServerId(params.server_id); + const nextJvmArgsValidated = + params.jvm_args !== undefined ? [...validateJvmArgs(params.jvm_args)] : undefined; + const parsedParams = serverUpdateSettingsBodySchema.safeParse(params); + if (!parsedParams.success) { + throw new ProtocolError("invalid_body", "Invalid server.update_settings parameters"); + } + const existing = readServerMetadata(serversDir, validId); const serverDir = resolveServerDir(serversDir, validId); - const nextMemoryMb = params.memory_mb ?? existing.memory_mb; - const nextJvmArgs = - params.jvm_args !== undefined - ? [...validateJvmArgs(params.jvm_args)] - : [...existing.jvm_args]; - const nextPort = params.port ?? existing.port; + const nextMemoryMb = parsedParams.data.memory_mb ?? existing.memory_mb; + const nextJvmArgs = nextJvmArgsValidated ?? [...existing.jvm_args]; + const nextPort = parsedParams.data.port ?? existing.port; const updated: ServerMetadata = { ...existing, @@ -357,13 +389,6 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM port: nextPort, }; - writeServerMetadata(serversDir, updated); - writeServerProperties(serverDir, { port: nextPort }); - - if (params.eula_accepted !== undefined) { - writeEulaFile(serverDir, params.eula_accepted); - } - const javaMajor = selectJavaMajor(updated.minecraft_version); const javaBin = getJavaBinPath(serversDir, javaMajor, platform); writeStartScript(serverDir, { @@ -373,6 +398,14 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM launchTarget: getEffectiveLaunchTarget(updated), }); + writeServerProperties(serverDir, { port: nextPort, forceOnlineMode: true }); + + if (parsedParams.data.eula_accepted !== undefined) { + writeEulaFile(serverDir, parsedParams.data.eula_accepted); + } + + writeServerMetadata(serversDir, updated); + return updated; } diff --git a/src/server/start-script.ts b/src/server/start-script.ts index 1634919..18251b6 100644 --- a/src/server/start-script.ts +++ b/src/server/start-script.ts @@ -1,7 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import { join } from "node:path"; import { writeFileAtomic } from "../agent/state"; import { MAX_JVM_ARGS, @@ -9,17 +8,20 @@ import { MIN_SERVER_MEMORY_MB, ProtocolError, } from "../protocol"; +import { resolveServerSubpath } from "./id"; export const MAX_JVM_ARG_LENGTH = 256; const FORBIDDEN_CHARS_REGEX = /[\s\0'"`;|&$\\()<>]/; -const XSS_REGEX = /^-Xss[1-9][0-9]*[kKmM]$/; +const XSS_REGEX = /^-Xss[1-9][0-9]{0,5}[kKmM]$/; const XX_BOOL_REGEX = /^-XX:[+-]([A-Za-z][A-Za-z0-9]*)$/; const XX_VALUE_REGEX = /^-XX:([A-Za-z][A-Za-z0-9]*)=([0-9]+[kKmMgG]?)$/; const SYS_PROP_REGEX = /^-D([a-zA-Z0-9_.-]{1,64})=([a-zA-Z0-9_.:/-]{1,128})$/; -const SAFE_JAR_RELATIVE_PATH_REGEX = /^[a-zA-Z0-9._/-]+\.jar$/; -const SAFE_ARGS_FILE_RELATIVE_PATH_REGEX = /^libraries\/[a-zA-Z0-9._/-]+\/unix_args\.txt$/; +const SAFE_JAR_RELATIVE_PATH_REGEX = + /^[a-zA-Z0-9][a-zA-Z0-9._+-]*(?:\/[a-zA-Z0-9][a-zA-Z0-9._+-]*)*\.jar$/; +const SAFE_ARGS_FILE_RELATIVE_PATH_REGEX = + /^libraries\/net\/(?:minecraftforge\/forge|neoforged\/neoforge)\/[a-zA-Z0-9._+-]+\/unix_args\.txt$/; export const ALLOWED_XX_BOOLEAN_FLAGS: ReadonlySet = new Set([ "UseG1GC", @@ -92,14 +94,23 @@ const BLOCKED_EXACT_OR_PREFIX_FLAGS: readonly string[] = [ const BLOCKED_SYSTEM_PROPERTY_PREFIXES: readonly string[] = [ "java.security.", - "com.sun.management.", - "javax.net.", - "sun.rmi.", "java.rmi.", - "javax.xml.", - "com.sun.jndi.", "java.naming.", + "java.util.logging.", + "java.protocol.", + "java.net.", + "com.sun.", + "javax.", + "sun.", + "jdk.", "org.apache.logging.log4j.", + "log4j.", + "log4j2.", + "logback.", + "http.", + "https.", + "ftp.", + "socks", ]; const BLOCKED_SYSTEM_PROPERTY_NAMES: ReadonlySet = new Set([ @@ -300,17 +311,22 @@ export function writeStartScript( serverDir: string, params: Omit & { readonly scriptServerDir?: string }, ): string { + const safeTarget = validateLaunchTarget(params.launchTarget); + resolveServerSubpath( + serverDir, + safeTarget.kind === "jar" ? safeTarget.jar_relative_path : safeTarget.args_file_relative_path, + ); const script = renderStartScript({ javaBin: params.javaBin, memoryMb: params.memoryMb, jvmArgs: params.jvmArgs, serverDir: params.scriptServerDir ?? serverDir, - launchTarget: params.launchTarget, + launchTarget: safeTarget, }); - const startScriptPath = join(serverDir, "start.sh"); + const startScriptPath = resolveServerSubpath(serverDir, "start.sh"); writeFileAtomic(startScriptPath, script, { mode: 0o750, - dirMode: 0o750, + dirMode: 0o770, }); return startScriptPath; } From 7572b65a56df8e12ef0b452c1636b3a80103cff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 22 Nov 2026 20:31:49 -0300 Subject: [PATCH 13/59] ci: run systemd-analyze verify with sudo so it can read the servers directory --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e5049c..8f957e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,4 +48,4 @@ jobs: -e 's|@TEGRAD_RUN_DIR@|/run/tegrad-server|g' \ "install/units/${unit}" > "${tmp_dir}/${unit}" done - systemd-analyze verify "${tmp_dir}/tegrad.service" "${tmp_dir}/tegrad-update.service" "${tmp_dir}/tegrad-update.path" "${tmp_dir}/tegrad-server@test.service" "${tmp_dir}/tegrad-server@test.socket" + sudo systemd-analyze verify "${tmp_dir}/tegrad.service" "${tmp_dir}/tegrad-update.service" "${tmp_dir}/tegrad-update.path" "${tmp_dir}/tegrad-server@test.service" "${tmp_dir}/tegrad-server@test.socket" From 90f3ddc0335649be9f7200a62df0168680ec2003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 22 Nov 2026 20:41:29 -0300 Subject: [PATCH 14/59] feat: wire files command handlers into agent runtime --- src/cli/files-wiring.test.ts | 530 +++++++++++++++++++++++++++++++++++ src/cli/run.ts | 11 + 2 files changed, 541 insertions(+) create mode 100644 src/cli/files-wiring.test.ts diff --git a/src/cli/files-wiring.test.ts b/src/cli/files-wiring.test.ts new file mode 100644 index 0000000..0efeceb --- /dev/null +++ b/src/cli/files-wiring.test.ts @@ -0,0 +1,530 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeAll, describe, expect, test } from "bun:test"; +import { createHash } from "node:crypto"; +import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { z } from "zod"; +import { createLogger, getStatePaths, loadOrCreateIdentity } from "../agent"; +import { + fingerprint, + generateSigningKeyPair, + ready, + type SigningKeyPair, + toBase64Url, +} from "../crypto"; +import { + CommandRegistry, + createCoreRegistry, + createSignedCommand, + defineCommand, + FILES_COMMANDS, + openAgentMessage, + PROTOCOL_VERSION, + signSessionCertificate, + type TransportFrame, +} from "../protocol"; +import { createAgentRuntime } from "./run"; + +const tempDirs: string[] = []; + +function makeTempDir(prefix: string): string { + const dir = mkdtempSync(join(tmpdir(), prefix)); + tempDirs.push(dir); + return dir; +} + +function sha256Hex(data: Uint8Array): string { + return createHash("sha256").update(data).digest("hex"); +} + +interface Harness { + readonly stateDir: string; + readonly serversDir: string; + readonly agentPublicKey: Uint8Array; + readonly agentId: string; + readonly account: SigningKeyPair; + readonly session: { + readonly keyPair: SigningKeyPair; + readonly certificate: ReturnType; + }; + readonly now: number; + readonly runtime: Awaited>; + readonly frames: TransportFrame[]; + sendCommand( + type: string, + body: unknown, + options?: { readonly useSession?: boolean }, + ): Promise<{ + readonly ack: Extract; + readonly events: readonly { readonly type: string; readonly body: unknown }[]; + }>; + dispose(): Promise; +} + +async function createHarness(serverId = "srv-1"): Promise { + const stateDir = makeTempDir("tegrad-files-state-"); + const serversDir = makeTempDir("tegrad-files-servers-"); + mkdirSync(join(serversDir, serverId), { recursive: true }); + + const agent = await loadOrCreateIdentity(stateDir); + const agentId = fingerprint(agent.publicKey); + const account = generateSigningKeyPair(); + const sessionKeyPair = generateSigningKeyPair(); + const now = Date.now(); + const sessionCert = signSessionCertificate({ + accountKeyPair: account, + sessionPublicKey: sessionKeyPair.publicKey, + notBefore: now - 1000, + notAfter: now + 3_600_000, + }); + + const { configPath, trustPath } = getStatePaths(stateDir); + writeFileSync(configPath, JSON.stringify({ api_url: "https://api.tegra.example" }), "utf8"); + writeFileSync( + trustPath, + JSON.stringify({ v: 1, accounts: [{ public_key: toBase64Url(account.publicKey) }] }), + "utf8", + ); + + const sentPayloads: TransportFrame[] = []; + const wsRuntime = await createAgentRuntime({ + stateDir, + serversDir, + logger: createLogger({ level: "error", stdout: () => {}, stderr: () => {} }), + now: () => now, + webSocketFactory: () => { + const socket = { + readyState: 1, + onopen: null as (() => void) | null, + onmessage: null as ((event: { readonly data: unknown }) => void) | null, + onclose: null as + | ((event: { readonly code?: number; readonly reason?: string }) => void) + | null, + onerror: null as ((event: unknown) => void) | null, + send(data: string) { + sentPayloads.push(JSON.parse(data) as TransportFrame); + }, + close() { + socket.readyState = 3; + }, + }; + queueMicrotask(() => { + socket.onopen?.(); + }); + return socket; + }, + }); + wsRuntime.start(); + await Promise.resolve(); + + const registry = createCoreRegistry(); + let accountCounter = 1; + let sessionCounter = 1; + + return { + stateDir, + serversDir, + agentPublicKey: agent.publicKey, + agentId, + account, + session: { keyPair: sessionKeyPair, certificate: sessionCert }, + now, + runtime: wsRuntime, + frames: sentPayloads, + async sendCommand(type, body, options = {}) { + const startIdx = sentPayloads.length; + const useSession = options.useSession ?? false; + const signed = createSignedCommand( + { + type, + body, + agentPublicKey: agent.publicKey, + signer: useSession ? sessionKeyPair : account, + ...(useSession ? { session: sessionCert } : {}), + counter: useSession ? sessionCounter++ : accountCounter++, + now, + }, + registry, + ); + await wsRuntime.queue.enqueue({ + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: agentId }, + body: signed, + }); + + const newFrames = sentPayloads.slice(startIdx); + const ack = newFrames.find( + (f): f is Extract => f.kind === "ack", + ); + if (!ack) { + throw new Error(`Expected ack frame for ${type}`); + } + const events = newFrames + .filter((f): f is Extract => f.kind === "event") + .map((f) => { + const opened = openAgentMessage(f.body, agent.publicKey, account); + return { type: opened.header.type, body: opened.body }; + }); + + return { ack, events }; + }, + async dispose() { + await wsRuntime.shutdown(1000); + }, + }; +} + +beforeAll(async () => { + await ready(); +}); + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +describe("files.* runtime wiring", () => { + test("every files.* command in FILES_COMMANDS reaches its handler through createAgentRuntime (never no_handler)", async () => { + const serverId = "srv-1"; + const h = await createHarness(serverId); + const exercised = new Set(); + + try { + expect(h.runtime.fileManager).toBeDefined(); + + // 1. files.mkdir + const mkdirRes = await h.sendCommand("files.mkdir", { + server_id: serverId, + path: "configs", + }); + exercised.add("files.mkdir"); + expect(mkdirRes.ack.body.ok).toBe(true); + expect(mkdirRes.events[0]?.type).toBe("files.mkdir.result"); + + // 2. files.write + const writeRes = await h.sendCommand("files.write", { + server_id: serverId, + path: "configs/app.txt", + content: "hello tegrad", + }); + exercised.add("files.write"); + expect(writeRes.ack.body.ok).toBe(true); + expect(writeRes.events[0]?.type).toBe("files.write.result"); + + // 3. files.list + const listRes = await h.sendCommand("files.list", { + server_id: serverId, + path: "configs", + }); + exercised.add("files.list"); + expect(listRes.ack.body.ok).toBe(true); + expect(listRes.events[0]?.type).toBe("files.list.result"); + + // 4. files.stat + const statRes = await h.sendCommand("files.stat", { + server_id: serverId, + path: "configs/app.txt", + }); + exercised.add("files.stat"); + expect(statRes.ack.body.ok).toBe(true); + expect(statRes.events[0]?.type).toBe("files.stat.result"); + + // 5. files.read + const readRes = await h.sendCommand("files.read", { + server_id: serverId, + path: "configs/app.txt", + }); + exercised.add("files.read"); + expect(readRes.ack.body.ok).toBe(true); + expect(readRes.events[0]?.type).toBe("files.read.result"); + + // 6. files.copy + const copyRes = await h.sendCommand("files.copy", { + server_id: serverId, + from_path: "configs/app.txt", + to_path: "configs/copy.txt", + }); + exercised.add("files.copy"); + expect(copyRes.ack.body.ok).toBe(true); + expect(copyRes.events[0]?.type).toBe("files.copy.result"); + + // 7. files.rename + const renameRes = await h.sendCommand("files.rename", { + server_id: serverId, + path: "configs/copy.txt", + new_name: "renamed.txt", + }); + exercised.add("files.rename"); + expect(renameRes.ack.body.ok).toBe(true); + expect(renameRes.events[0]?.type).toBe("files.rename.result"); + + // 8. files.move + const moveRes = await h.sendCommand("files.move", { + server_id: serverId, + from_path: "configs/renamed.txt", + to_path: "moved.txt", + }); + exercised.add("files.move"); + expect(moveRes.ack.body.ok).toBe(true); + expect(moveRes.events[0]?.type).toBe("files.move.result"); + + // 9. files.zip + const zipRes = await h.sendCommand("files.zip", { + server_id: serverId, + paths: ["configs/app.txt"], + dest_path: "archive.zip", + }); + exercised.add("files.zip"); + expect(zipRes.ack.body.ok).toBe(true); + expect(zipRes.events[0]?.type).toBe("files.zip.result"); + + // 10. files.unzip + const unzipRes = await h.sendCommand("files.unzip", { + server_id: serverId, + zip_path: "archive.zip", + dest_path: "extracted", + }); + exercised.add("files.unzip"); + expect(unzipRes.ack.body.ok).toBe(true); + expect(unzipRes.events[0]?.type).toBe("files.unzip.result"); + + // 11-13. files.upload.begin -> files.upload.part -> files.upload.commit + const uploadBytes = new TextEncoder().encode("chunked upload data"); + const uploadBeginRes = await h.sendCommand("files.upload.begin", { + server_id: serverId, + path: "uploaded.txt", + total_size: uploadBytes.byteLength, + sha256: sha256Hex(uploadBytes), + }); + exercised.add("files.upload.begin"); + expect(uploadBeginRes.ack.body.ok).toBe(true); + const uploadId = (uploadBeginRes.events[0]?.body as { upload_id?: string } | undefined) + ?.upload_id; + expect(uploadId).toBeDefined(); + if (!uploadId) throw new Error("Missing upload_id"); + + const uploadPartRes = await h.sendCommand("files.upload.part", { + server_id: serverId, + upload_id: uploadId, + part_index: 0, + data_base64: Buffer.from(uploadBytes).toString("base64"), + }); + exercised.add("files.upload.part"); + expect(uploadPartRes.ack.body.ok).toBe(true); + + const uploadCommitRes = await h.sendCommand("files.upload.commit", { + server_id: serverId, + upload_id: uploadId, + }); + exercised.add("files.upload.commit"); + expect(uploadCommitRes.ack.body.ok).toBe(true); + + // 14. files.upload.abort + const abortBegin = await h.sendCommand("files.upload.begin", { + server_id: serverId, + path: "aborted.txt", + total_size: uploadBytes.byteLength, + sha256: sha256Hex(uploadBytes), + }); + const abortId = (abortBegin.events[0]?.body as { upload_id?: string } | undefined)?.upload_id; + expect(abortId).toBeDefined(); + if (!abortId) throw new Error("Missing abort upload_id"); + const uploadAbortRes = await h.sendCommand("files.upload.abort", { + server_id: serverId, + upload_id: abortId, + }); + exercised.add("files.upload.abort"); + expect(uploadAbortRes.ack.body.ok).toBe(true); + + // 15-17. files.download.begin -> files.download.part -> files.download.close + const dlBeginRes = await h.sendCommand("files.download.begin", { + server_id: serverId, + path: "uploaded.txt", + }); + exercised.add("files.download.begin"); + expect(dlBeginRes.ack.body.ok).toBe(true); + const downloadId = (dlBeginRes.events[0]?.body as { download_id?: string } | undefined) + ?.download_id; + expect(downloadId).toBeDefined(); + if (!downloadId) throw new Error("Missing download_id"); + + const dlPartRes = await h.sendCommand("files.download.part", { + server_id: serverId, + download_id: downloadId, + part_index: 0, + }); + exercised.add("files.download.part"); + expect(dlPartRes.ack.body.ok).toBe(true); + + const dlCloseRes = await h.sendCommand("files.download.close", { + server_id: serverId, + download_id: downloadId, + }); + exercised.add("files.download.close"); + expect(dlCloseRes.ack.body.ok).toBe(true); + + // 18. files.download (range) + const dlRangeRes = await h.sendCommand("files.download", { + server_id: serverId, + path: "uploaded.txt", + offset: 0, + length: 7, + }); + exercised.add("files.download"); + expect(dlRangeRes.ack.body.ok).toBe(true); + + // 19. files.delete (account key) + const delRes = await h.sendCommand("files.delete", { + server_id: serverId, + path: "moved.txt", + }); + exercised.add("files.delete"); + expect(delRes.ack.body.ok).toBe(true); + expect(delRes.events[0]?.type).toBe("files.delete.result"); + + // Assert 100% coverage of FILES_COMMANDS + const allFileCommandTypes = FILES_COMMANDS.map((c) => c.type).sort(); + expect([...exercised].sort()).toEqual(allFileCommandTypes); + } finally { + await h.dispose(); + } + }); + + test("files.delete rejects session-key signatures and accepts direct account signatures", async () => { + const serverId = "srv-1"; + const h = await createHarness(serverId); + + try { + // Non-destructive commands succeed with session key + const writeRes = await h.sendCommand( + "files.write", + { server_id: serverId, path: "keep.txt", content: "data" }, + { useSession: true }, + ); + expect(writeRes.ack.body.ok).toBe(true); + + // files.delete with session key MUST be rejected + const delWithSession = await h.sendCommand( + "files.delete", + { server_id: serverId, path: "keep.txt" }, + { useSession: true }, + ); + expect(delWithSession.ack.body.ok).toBe(false); + if (!delWithSession.ack.body.ok) { + expect(delWithSession.ack.body.code).toBe("sensitive_requires_account_key"); + } + + // files.delete with direct account key succeeds + const delWithAccount = await h.sendCommand( + "files.delete", + { server_id: serverId, path: "keep.txt" }, + { useSession: false }, + ); + expect(delWithAccount.ack.body.ok).toBe(true); + } finally { + await h.dispose(); + } + }); + + test("rejects invalid server_id and malformed bodies at protocol boundary", async () => { + const h = await createHarness("srv-1"); + const registry = createCoreRegistry(); + + try { + // Bypass client-side schema check by signing with a permissive registry, then enqueueing + // against the real runtime's strict registry. + const permissive = new CommandRegistry(); + for (const cmd of FILES_COMMANDS) { + permissive.register( + defineCommand({ + type: cmd.type, + sensitive: cmd.sensitive, + body: z.unknown(), + }), + ); + } + const badCases: readonly { readonly type: string; readonly body: unknown }[] = [ + { type: "files.list", body: { server_id: "../escape" } }, + { type: "files.read", body: { server_id: "BAD_ID", path: "a.txt" } }, + { + type: "files.write", + body: { server_id: "srv-1", path: "a.txt", content: "x", extra: 1 }, + }, + { type: "files.delete", body: { server_id: "", path: "a.txt" } }, + ]; + + let counter = 100; + for (const bad of badCases) { + const startIdx = h.frames.length; + const signed = createSignedCommand( + { + type: bad.type, + body: bad.body, + agentPublicKey: h.agentPublicKey, + signer: h.account, + counter: counter++, + now: h.now, + }, + permissive, + ); + expect(registry.get(bad.type)).toBeDefined(); + + await h.runtime.queue.enqueue({ + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: h.agentId }, + body: signed, + }); + + const ack = h.frames + .slice(startIdx) + .find((f): f is Extract => f.kind === "ack"); + expect(ack).toBeDefined(); + expect(ack?.body.ok).toBe(false); + if (ack && !ack.body.ok) { + expect(ack.body.code).toBe("invalid_body"); + } + } + } finally { + await h.dispose(); + } + }); + + test("shutdown disposes FileManager active transfers", async () => { + const serverId = "srv-1"; + const h = await createHarness(serverId); + + await h.sendCommand("files.write", { + server_id: serverId, + path: "sample.txt", + content: "hello", + }); + const dlBegin = await h.sendCommand("files.download.begin", { + server_id: serverId, + path: "sample.txt", + }); + expect(dlBegin.ack.body.ok).toBe(true); + const downloadId = (dlBegin.events[0]?.body as { download_id?: string } | undefined) + ?.download_id; + expect(downloadId).toBeDefined(); + if (!downloadId) throw new Error("Missing download_id"); + + await h.dispose(); + + expect(() => + h.runtime.fileManager.downloadPart({ + server_id: serverId, + download_id: downloadId, + part_index: 0, + }), + ).toThrow(); + }); +}); diff --git a/src/cli/run.ts b/src/cli/run.ts index f5f8cae..54b1952 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -19,6 +19,7 @@ import { type WebSocketFactory, } from "../agent"; import { fingerprint } from "../crypto"; +import { FileManager, registerFileCommandHandlers } from "../files"; import { type CommandRegistry, createCoreRegistry, type TransportFrame } from "../protocol"; import { createServerManager, registerServerHandlers, type ServerManager } from "../server"; import { type AutoUpdater, createAutoUpdater } from "../update"; @@ -49,6 +50,7 @@ export interface AgentRuntime { readonly updater: AutoUpdater; readonly logger: Logger; readonly serverManager?: ServerManager; + readonly fileManager: FileManager; start(): void; shutdown(drainTimeoutMs?: number): Promise; } @@ -108,6 +110,13 @@ export async function createAgentRuntime( }); registerServerHandlers(queue, serverManager); + const fileManager = new FileManager( + configuredServersDir && configuredServersDir.length > 0 + ? { serversBaseDir: configuredServersDir } + : {}, + ); + registerFileCommandHandlers(queue, fileManager); + const connection = createAgentConnection({ apiUrl: config.apiUrl, agentId, @@ -147,6 +156,7 @@ export async function createAgentRuntime( updater, logger, ...(serverManager !== undefined ? { serverManager } : {}), + fileManager, start(): void { logger.info("Starting tegrad", { agentId }); @@ -169,6 +179,7 @@ export async function createAgentRuntime( drainTimeoutMs, }); } + fileManager.dispose(); trust.flush(); logger.info("Shutdown complete"); })(); From 9d7aff56b4be9633e84d5b889ed9fadd982de473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 22 Nov 2026 20:48:28 -0300 Subject: [PATCH 15/59] feat: add server state, mod management, origin 3-way sync, and server pack deploy --- src/agent/index.ts | 1 + src/agent/state.ts | 54 ++ src/cli/run.ts | 15 + src/protocol/commands/core.ts | 7 +- src/protocol/commands/state.ts | 261 ++++++++ src/protocol/errors.ts | 8 +- src/protocol/index.ts | 46 ++ src/server/registry.ts | 6 + src/state/backup-hook.ts | 12 + src/state/download.ts | 262 ++++++++ src/state/index.ts | 58 ++ src/state/lock.ts | 18 + src/state/manager.ts | 1088 ++++++++++++++++++++++++++++++++ src/state/state.test.ts | 880 ++++++++++++++++++++++++++ src/state/sync-plan.test.ts | 205 ++++++ src/state/sync-plan.ts | 405 ++++++++++++ 16 files changed, 3323 insertions(+), 3 deletions(-) create mode 100644 src/protocol/commands/state.ts create mode 100644 src/state/backup-hook.ts create mode 100644 src/state/download.ts create mode 100644 src/state/index.ts create mode 100644 src/state/lock.ts create mode 100644 src/state/manager.ts create mode 100644 src/state/state.test.ts create mode 100644 src/state/sync-plan.test.ts create mode 100644 src/state/sync-plan.ts diff --git a/src/agent/index.ts b/src/agent/index.ts index b3ebcb1..166876f 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -107,6 +107,7 @@ export { resetTrustState, StateError, validateApiUrl, + validateCdnHost, validateLinkUrl, writeFileAtomic, } from "./state"; diff --git a/src/agent/state.ts b/src/agent/state.ts index 630be5f..bf8a6dc 100644 --- a/src/agent/state.ts +++ b/src/agent/state.ts @@ -67,6 +67,8 @@ const rawUpdateConfigSchema = z const rawConfigSchema = z.object({ api_url: z.string().min(1), link_url: z.string().min(1).optional(), + cdn_host: z.string().min(1).optional(), + tegra_cdn_host: z.string().min(1).optional(), update: rawUpdateConfigSchema.optional(), }); @@ -79,6 +81,8 @@ export interface AgentUpdateConfig { export interface AgentConfig { readonly apiUrl: string; readonly linkUrl?: string; + readonly cdnHost?: string; + readonly tegraCdnHost?: string; readonly update?: AgentUpdateConfig; } @@ -302,6 +306,48 @@ export function validateManifestBaseUrl(manifestBaseUrl: string): string { return parsed.toString(); } +const HOSTNAME_LABEL_REGEX = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/; + +export function validateCdnHost(rawHost: string): string { + const trimmed = rawHost.trim().toLowerCase(); + if ( + trimmed.length === 0 || + trimmed.length > 253 || + trimmed.includes("/") || + trimmed.includes(":") || + trimmed.includes("@") || + trimmed.includes("?") || + trimmed.includes("#") || + trimmed.includes(" ") + ) { + throw new StateError(`Invalid CDN host in config.json: "${rawHost}"`); + } + + let parsed: URL; + try { + parsed = new URL(`https://${trimmed}`); + } catch { + throw new StateError(`Invalid CDN host in config.json: "${rawHost}"`); + } + + if (parsed.hostname !== trimmed || parsed.port !== "") { + throw new StateError(`Invalid CDN host in config.json: "${rawHost}"`); + } + + const labels = trimmed.split("."); + if (labels.length < 2 || !labels.every((label) => HOSTNAME_LABEL_REGEX.test(label))) { + throw new StateError(`CDN host must be a valid domain hostname: "${rawHost}"`); + } + + // Reject all-numeric TLDs (prevents IPv4 literals like 127.0.0.1). + const tld = labels[labels.length - 1] ?? ""; + if (/^\d+$/.test(tld)) { + throw new StateError(`CDN host must be a domain name, not an IP address: "${rawHost}"`); + } + + return trimmed; +} + export interface LoadConfigOptions { readonly allowInsecure?: boolean; readonly env?: Readonly>; @@ -323,6 +369,12 @@ export function loadConfig(stateDir: string, options: LoadConfigOptions = {}): A const apiUrl = validateApiUrl(parsed.data.api_url, allowInsecure); const linkUrl = parsed.data.link_url !== undefined ? validateLinkUrl(parsed.data.link_url) : undefined; + const cdnHost = + parsed.data.cdn_host !== undefined ? validateCdnHost(parsed.data.cdn_host) : undefined; + const tegraCdnHost = + parsed.data.tegra_cdn_host !== undefined + ? validateCdnHost(parsed.data.tegra_cdn_host) + : undefined; let update: AgentUpdateConfig | undefined; if (parsed.data.update !== undefined) { const manifestBaseUrl = @@ -338,6 +390,8 @@ export function loadConfig(stateDir: string, options: LoadConfigOptions = {}): A return { apiUrl, ...(linkUrl !== undefined ? { linkUrl } : {}), + ...(cdnHost !== undefined ? { cdnHost } : {}), + ...(tegraCdnHost !== undefined ? { tegraCdnHost } : {}), ...(update !== undefined ? { update } : {}), }; } diff --git a/src/cli/run.ts b/src/cli/run.ts index 54b1952..090dc2c 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -22,6 +22,7 @@ import { fingerprint } from "../crypto"; import { FileManager, registerFileCommandHandlers } from "../files"; import { type CommandRegistry, createCoreRegistry, type TransportFrame } from "../protocol"; import { createServerManager, registerServerHandlers, type ServerManager } from "../server"; +import { createStateManager, registerStateHandlers, type StateManager } from "../state"; import { type AutoUpdater, createAutoUpdater } from "../update"; export const SHUTDOWN_DRAIN_TIMEOUT_MS = 10_000; @@ -51,6 +52,7 @@ export interface AgentRuntime { readonly logger: Logger; readonly serverManager?: ServerManager; readonly fileManager: FileManager; + readonly stateManager: StateManager; start(): void; shutdown(drainTimeoutMs?: number): Promise; } @@ -117,6 +119,18 @@ export async function createAgentRuntime( ); registerFileCommandHandlers(queue, fileManager); + const configuredCdnHost = config.tegraCdnHost ?? config.cdnHost; + const stateManager = createStateManager({ + logger, + ...(configuredServersDir && configuredServersDir.length > 0 + ? { serversDir: configuredServersDir } + : {}), + ...(configuredCdnHost !== undefined ? { cdnHost: configuredCdnHost } : {}), + ...(options.fetch !== undefined ? { fetchImpl: options.fetch } : {}), + ...(options.now !== undefined ? { now: options.now } : {}), + }); + registerStateHandlers(queue, stateManager); + const connection = createAgentConnection({ apiUrl: config.apiUrl, agentId, @@ -157,6 +171,7 @@ export async function createAgentRuntime( logger, ...(serverManager !== undefined ? { serverManager } : {}), fileManager, + stateManager, start(): void { logger.info("Starting tegrad", { agentId }); diff --git a/src/protocol/commands/core.ts b/src/protocol/commands/core.ts index 969cb95..f520e3b 100644 --- a/src/protocol/commands/core.ts +++ b/src/protocol/commands/core.ts @@ -6,6 +6,7 @@ import { CommandRegistry, defineCommand } from "../registry"; import { registerFilesCommands } from "./files"; import { registerPairingCommands } from "./pairing"; import { registerServerCommands, serverIdSchema } from "./server"; +import { registerStateCommands } from "./state"; const serverIdBodySchema = z.object({ server_id: z.string().min(1), @@ -53,7 +54,9 @@ export function registerCoreCommands(registry: CommandRegistry): CommandRegistry } export function createCoreRegistry(): CommandRegistry { - return registerServerCommands( - registerFilesCommands(registerPairingCommands(registerCoreCommands(new CommandRegistry()))), + return registerStateCommands( + registerServerCommands( + registerFilesCommands(registerPairingCommands(registerCoreCommands(new CommandRegistry()))), + ), ); } diff --git a/src/protocol/commands/state.ts b/src/protocol/commands/state.ts new file mode 100644 index 0000000..8dcebc4 --- /dev/null +++ b/src/protocol/commands/state.ts @@ -0,0 +1,261 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; +import { type CommandRegistry, defineCommand } from "../registry"; +import { sha256HexSchema } from "./files"; +import { serverIdSchema, serverLoaderSchema } from "./server"; + +export const SHA1_HEX_PATTERN = /^[0-9a-f]{40}$/i; +export const SHA512_HEX_PATTERN = /^[0-9a-f]{128}$/i; + +export const sha1HexSchema = z + .string() + .regex(SHA1_HEX_PATTERN, "Expected 40 hex characters") + .transform((v) => v.toLowerCase()); + +export const sha512HexSchema = z + .string() + .regex(SHA512_HEX_PATTERN, "Expected 128 hex characters") + .transform((v) => v.toLowerCase()); + +export const modSourceSchema = z.enum(["modrinth", "curseforge", "tegra", "local"]); +export type ModSource = z.infer; + +export const modLayerSchema = z.enum(["origin", "user"]); +export type ModLayer = z.infer; + +export const modFileNameSchema = z + .string() + .min(1) + .max(255) + .refine( + (name) => + !name.includes("/") && + !name.includes("\\") && + !name.includes("\0") && + name !== "." && + name !== "..", + { message: "Mod filename must be a single safe filename" }, + ); + +export const serverModEntrySchema = z + .object({ + file: modFileNameSchema, + source: modSourceSchema, + project_id: z.string().min(1).max(128).optional(), + version_id: z.string().min(1).max(128).optional(), + sha1: sha1HexSchema.optional(), + sha256: sha256HexSchema.optional(), + sha512: sha512HexSchema.optional(), + layer: modLayerSchema, + }) + .strict(); + +export type ServerModEntry = z.infer; + +export const serverOriginSchema = z + .discriminatedUnion("kind", [ + z + .object({ + kind: z.literal("modpack"), + source: modSourceSchema, + modpack_id: z.string().min(1).max(128), + version_id: z.string().min(1).max(128), + }) + .strict(), + z + .object({ + kind: z.literal("local"), + note: z.string().max(512).optional(), + }) + .strict(), + ]) + .nullable(); + +export type ServerOrigin = z.infer; + +export const serverOriginSyncStateSchema = z + .object({ + excluded_mod_keys: z.array(z.string().min(1).max(256)).max(4000), + synced_mod_keys: z.array(z.string().min(1).max(256)).max(4000), + removed_origin_files: z.array(z.string().min(1).max(1024)).max(5000).optional(), + synced_files: z.array(z.string().min(1).max(1024)).max(5000).optional(), + last_synced_at: z.string().nullable().optional(), + last_synced_version_id: z.string().min(1).max(128).nullable().optional(), + }) + .strict(); + +export type ServerOriginSyncState = z.infer; + +export const modEnvironmentInfoSchema = z + .object({ + client: z.enum(["required", "optional", "unsupported", "unknown"]).optional(), + server: z.enum(["required", "optional", "unsupported", "unknown"]).optional(), + }) + .strict(); + +export type ModEnvironmentInfo = z.infer; + +export const originPlanModInputSchema = z + .object({ + key: z.string().min(1).max(256), + file: modFileNameSchema, + name: z.string().min(1).max(256).optional(), + enabled: z.boolean().optional(), + source: modSourceSchema.optional(), + project_id: z.string().min(1).max(128).optional(), + version_id: z.string().min(1).max(128).optional(), + url: z.string().url().max(2048).optional(), + sha1: sha1HexSchema.optional(), + sha256: sha256HexSchema.optional(), + sha512: sha512HexSchema.optional(), + environment: modEnvironmentInfoSchema.optional(), + }) + .strict(); + +export type OriginPlanModInput = z.infer; + +export const originPlanFileInputSchema = z + .object({ + path: z.string().min(1).max(1024), + sha1: sha1HexSchema, + sha256: sha256HexSchema.optional(), + size_bytes: z.number().int().nonnegative(), + url: z.string().url().max(2048).optional(), + content_base64: z.string().optional(), + }) + .strict(); + +export type OriginPlanFileInput = z.infer; + +export const serverModsListBodySchema = z + .object({ + server_id: serverIdSchema, + }) + .strict(); + +export const serverModsInstallBodySchema = z + .object({ + server_id: serverIdSchema, + file: modFileNameSchema, + url: z.string().url().max(2048), + source: modSourceSchema, + project_id: z.string().min(1).max(128).optional(), + version_id: z.string().min(1).max(128).optional(), + sha1: sha1HexSchema.optional(), + sha256: sha256HexSchema.optional(), + sha512: sha512HexSchema.optional(), + }) + .strict(); + +export const serverModsRemoveBodySchema = z + .object({ + server_id: serverIdSchema, + file: modFileNameSchema, + }) + .strict(); + +export const serverOriginPlanBodySchema = z + .object({ + server_id: serverIdSchema, + to_version_id: z.string().min(1).max(128), + source: modSourceSchema.optional(), + modpack_id: z.string().min(1).max(128).optional(), + minecraft_version: z.string().min(1).max(64).optional(), + loader: serverLoaderSchema.optional(), + loader_version: z.string().min(1).max(64).nullable().optional(), + mods: z.array(originPlanModInputSchema).max(2000), + files: z.array(originPlanFileInputSchema).max(5000).optional(), + }) + .strict(); + +export const serverOriginApplyBodySchema = z + .object({ + server_id: serverIdSchema, + plan_id: z.string().min(1).max(128), + selected_mod_keys: z.array(z.string().min(1).max(256)).max(2000).optional(), + selected_file_paths: z.array(z.string().min(1).max(1024)).max(5000).optional(), + }) + .strict(); + +export const serverOriginUnlinkBodySchema = z + .object({ + server_id: serverIdSchema, + }) + .strict(); + +export const serverDeployServerpackBodySchema = z + .object({ + server_id: serverIdSchema, + url: z.string().url().max(2048), + sha256: sha256HexSchema.optional(), + sha512: sha512HexSchema.optional(), + sha1: sha1HexSchema.optional(), + origin: serverOriginSchema.optional(), + }) + .strict(); + +export type ServerModsListBody = z.infer; +export type ServerModsInstallBody = z.infer; +export type ServerModsRemoveBody = z.infer; +export type ServerOriginPlanBody = z.infer; +export type ServerOriginApplyBody = z.infer; +export type ServerOriginUnlinkBody = z.infer; +export type ServerDeployServerpackBody = z.infer; + +export const serverModsListCommand = defineCommand({ + type: "server.mods.list", + sensitive: false, + body: serverModsListBodySchema, +}); + +export const serverModsInstallCommand = defineCommand({ + type: "server.mods.install", + sensitive: false, + body: serverModsInstallBodySchema, +}); + +export const serverModsRemoveCommand = defineCommand({ + type: "server.mods.remove", + sensitive: false, + body: serverModsRemoveBodySchema, +}); + +export const serverOriginPlanCommand = defineCommand({ + type: "server.origin.plan", + sensitive: false, + body: serverOriginPlanBodySchema, +}); + +export const serverOriginApplyCommand = defineCommand({ + type: "server.origin.apply", + sensitive: true, + body: serverOriginApplyBodySchema, +}); + +export const serverOriginUnlinkCommand = defineCommand({ + type: "server.origin.unlink", + sensitive: false, + body: serverOriginUnlinkBodySchema, +}); + +export const serverDeployServerpackCommand = defineCommand({ + type: "server.deploy.serverpack", + sensitive: true, + body: serverDeployServerpackBodySchema, +}); + +export const STATE_COMMANDS = [ + serverModsListCommand, + serverModsInstallCommand, + serverModsRemoveCommand, + serverOriginPlanCommand, + serverOriginApplyCommand, + serverOriginUnlinkCommand, + serverDeployServerpackCommand, +] as const; + +export function registerStateCommands(registry: CommandRegistry): CommandRegistry { + return registry.registerAll(STATE_COMMANDS); +} diff --git a/src/protocol/errors.ts b/src/protocol/errors.ts index 3292b4f..346de7f 100644 --- a/src/protocol/errors.ts +++ b/src/protocol/errors.ts @@ -35,7 +35,13 @@ export type ProtocolErrorCode = | "invalid_jvm_args" | "download_failed" | "hash_mismatch" - | "systemd_error"; + | "systemd_error" + | "origin_locked" + | "plan_not_found" + | "plan_expired" + | "plan_stale" + | "mod_not_found" + | "mod_already_exists"; export class ProtocolError extends Error { readonly code: ProtocolErrorCode; diff --git a/src/protocol/index.ts b/src/protocol/index.ts index 7693aa8..2f6ecde 100644 --- a/src/protocol/index.ts +++ b/src/protocol/index.ts @@ -89,6 +89,52 @@ export { serverUpdateSettingsBodySchema, serverUpdateSettingsCommand, } from "./commands/server"; +export { + type ModEnvironmentInfo, + type ModLayer, + type ModSource, + modEnvironmentInfoSchema, + modFileNameSchema, + modLayerSchema, + modSourceSchema, + type OriginPlanFileInput, + type OriginPlanModInput, + originPlanFileInputSchema, + originPlanModInputSchema, + registerStateCommands, + type ServerDeployServerpackBody, + type ServerModEntry, + type ServerModsInstallBody, + type ServerModsListBody, + type ServerModsRemoveBody, + type ServerOrigin, + type ServerOriginApplyBody, + type ServerOriginPlanBody, + type ServerOriginSyncState, + type ServerOriginUnlinkBody, + SHA1_HEX_PATTERN, + SHA512_HEX_PATTERN, + STATE_COMMANDS, + serverDeployServerpackBodySchema, + serverDeployServerpackCommand, + serverModEntrySchema, + serverModsInstallBodySchema, + serverModsInstallCommand, + serverModsListBodySchema, + serverModsListCommand, + serverModsRemoveBodySchema, + serverModsRemoveCommand, + serverOriginApplyBodySchema, + serverOriginApplyCommand, + serverOriginPlanBodySchema, + serverOriginPlanCommand, + serverOriginSchema, + serverOriginSyncStateSchema, + serverOriginUnlinkBodySchema, + serverOriginUnlinkCommand, + sha1HexSchema, + sha512HexSchema, +} from "./commands/state"; export { DOMAIN_AGENT_MESSAGE, DOMAIN_COMMAND, diff --git a/src/server/registry.ts b/src/server/registry.ts index 6c01c5b..14ef7f2 100644 --- a/src/server/registry.ts +++ b/src/server/registry.ts @@ -11,6 +11,9 @@ import { serverIdSchema, serverLoaderSchema, serverMemoryMbSchema, + serverModEntrySchema, + serverOriginSchema, + serverOriginSyncStateSchema, serverPortSchema, } from "../protocol"; import { resolveServerDir, resolveServerSubpath } from "./id"; @@ -64,6 +67,9 @@ export const serverMetadataSchema = z port: serverPortSchema, created_at: z.number().int().nonnegative(), launch_target: serverLaunchTargetSchema.optional(), + mods: z.array(serverModEntrySchema).max(4000).optional(), + origin: serverOriginSchema.optional(), + origin_sync: serverOriginSyncStateSchema.optional(), }) .strict(); diff --git a/src/state/backup-hook.ts b/src/state/backup-hook.ts new file mode 100644 index 0000000..d5eb4a6 --- /dev/null +++ b/src/state/backup-hook.ts @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +export interface BackupHook { + beforeChange(serverId: string): Promise; +} + +export const noopBackupHook: BackupHook = { + async beforeChange(_serverId: string): Promise { + // Intentionally empty default hook. + }, +}; diff --git a/src/state/download.ts b/src/state/download.ts new file mode 100644 index 0000000..a64a11a --- /dev/null +++ b/src/state/download.ts @@ -0,0 +1,262 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { createHash, timingSafeEqual } from "node:crypto"; +import { validateCdnHost } from "../agent/state"; +import { ProtocolError } from "../protocol"; +import type { FetchLike } from "../server/download"; + +export const DEFAULT_MOD_ALLOWED_HOSTS: ReadonlySet = new Set([ + "cdn.modrinth.com", + "edge.forgecdn.net", + "mediafilez.forgecdn.net", +]); + +export const DEFAULT_MAX_MOD_BYTES = 256 * 1024 * 1024; // 256 MiB +export const DEFAULT_MAX_SERVERPACK_BYTES = 512 * 1024 * 1024; // 512 MiB +export const DEFAULT_STATE_MAX_REDIRECTS = 5; +export const DEFAULT_STATE_DOWNLOAD_TIMEOUT_MS = 60_000; + +const SHA1_REGEX = /^[0-9a-f]{40}$/i; +const SHA256_REGEX = /^[0-9a-f]{64}$/i; +const SHA512_REGEX = /^[0-9a-f]{128}$/i; + +export interface ExpectedHashes { + readonly sha1?: string | undefined; + readonly sha256?: string | undefined; + readonly sha512?: string | undefined; +} + +export interface VerifiedDownloadResult { + readonly data: Uint8Array; + readonly bytes: number; + readonly sha1: string; + readonly sha256: string; + readonly sha512: string; +} + +export interface DownloadVerifiedBufferOptions { + readonly url: string; + readonly allowedHosts: ReadonlySet; + readonly expectedHashes?: ExpectedHashes; + readonly maxBytes?: number; + readonly maxRedirects?: number; + readonly timeoutMs?: number; + readonly fetchImpl?: FetchLike; +} + +export function buildAllowedDownloadHosts( + extraHosts: readonly (string | undefined)[] = [], +): ReadonlySet { + const hosts = new Set(DEFAULT_MOD_ALLOWED_HOSTS); + for (const raw of extraHosts) { + if (raw !== undefined && raw.trim().length > 0) { + hosts.add(validateCdnHost(raw)); + } + } + return hosts; +} + +export function validateStateDownloadUrl(rawUrl: string, allowedHosts: ReadonlySet): URL { + let parsed: URL; + try { + parsed = new URL(rawUrl); + } catch { + throw new ProtocolError("download_failed", "Invalid download URL"); + } + + if (parsed.protocol !== "https:") { + throw new ProtocolError( + "download_failed", + `Download URL must use https:// (got ${parsed.protocol})`, + ); + } + + if (parsed.username || parsed.password) { + throw new ProtocolError("download_failed", "Download URL must not contain credentials"); + } + + if (parsed.port !== "") { + throw new ProtocolError("download_failed", "Download URL must not specify a non-standard port"); + } + + const host = parsed.hostname.toLowerCase(); + if (!allowedHosts.has(host)) { + throw new ProtocolError("download_failed", `Download host is not allowed: ${host}`); + } + + return parsed; +} + +function normalizeHash(algorithm: "sha1" | "sha256" | "sha512", raw: string): string { + const trimmed = raw.trim().toLowerCase(); + const regex = + algorithm === "sha1" ? SHA1_REGEX : algorithm === "sha256" ? SHA256_REGEX : SHA512_REGEX; + if (!regex.test(trimmed)) { + throw new ProtocolError("hash_mismatch", `Invalid expected ${algorithm} checksum format`); + } + return trimmed; +} + +function digestsEqual(actualHex: string, expectedHex: string): boolean { + const a = Buffer.from(actualHex.toLowerCase(), "hex"); + const b = Buffer.from(expectedHex.toLowerCase(), "hex"); + if (a.byteLength === 0 || a.byteLength !== b.byteLength) { + return false; + } + return timingSafeEqual(a, b); +} + +async function readCappedBytes(response: Response, maxBytes: number): Promise { + const contentLength = response.headers.get("content-length"); + if (contentLength !== null) { + const declared = Number(contentLength); + if (Number.isFinite(declared) && declared > maxBytes) { + throw new ProtocolError("download_failed", "Download exceeds maximum allowed size"); + } + } + + if (response.body === null) { + const buf = new Uint8Array(await response.arrayBuffer()); + if (buf.byteLength > maxBytes) { + throw new ProtocolError("download_failed", "Download exceeds maximum allowed size"); + } + return buf; + } + + const reader = response.body.getReader(); + const chunks: Uint8Array[] = []; + let total = 0; + + try { + while (true) { + const { value, done } = await reader.read(); + if (done) { + break; + } + if (value === undefined || value.byteLength === 0) { + continue; + } + total += value.byteLength; + if (total > maxBytes) { + await reader.cancel(); + throw new ProtocolError("download_failed", "Download exceeds maximum allowed size"); + } + chunks.push(value); + } + } finally { + reader.releaseLock(); + } + + const out = new Uint8Array(total); + let offset = 0; + for (const chunk of chunks) { + out.set(chunk, offset); + offset += chunk.byteLength; + } + return out; +} + +export async function downloadVerifiedBuffer( + options: DownloadVerifiedBufferOptions, +): Promise { + const expectedSha1 = + options.expectedHashes?.sha1 !== undefined + ? normalizeHash("sha1", options.expectedHashes.sha1) + : undefined; + const expectedSha256 = + options.expectedHashes?.sha256 !== undefined + ? normalizeHash("sha256", options.expectedHashes.sha256) + : undefined; + const expectedSha512 = + options.expectedHashes?.sha512 !== undefined + ? normalizeHash("sha512", options.expectedHashes.sha512) + : undefined; + + const fetchFn: FetchLike = options.fetchImpl ?? ((input, init) => globalThis.fetch(input, init)); + const maxBytes = options.maxBytes ?? DEFAULT_MAX_MOD_BYTES; + const maxRedirects = options.maxRedirects ?? DEFAULT_STATE_MAX_REDIRECTS; + const timeoutMs = options.timeoutMs ?? DEFAULT_STATE_DOWNLOAD_TIMEOUT_MS; + + let currentUrl = validateStateDownloadUrl(options.url, options.allowedHosts); + let finalResponse: Response | null = null; + + for (let hop = 0; hop <= maxRedirects; hop++) { + const controller = new AbortController(); + const timer = setTimeout(() => controller.abort(), timeoutMs); + let response: Response; + + try { + response = await fetchFn(currentUrl.toString(), { + method: "GET", + redirect: "manual", + signal: controller.signal, + }); + } catch { + throw new ProtocolError("download_failed", `Failed to fetch ${currentUrl.hostname}`); + } finally { + clearTimeout(timer); + } + + if ( + response.status === 301 || + response.status === 302 || + response.status === 303 || + response.status === 307 || + response.status === 308 + ) { + const location = response.headers.get("location"); + if (!location) { + throw new ProtocolError("download_failed", "Redirect response missing Location header"); + } + if (hop === maxRedirects) { + throw new ProtocolError("download_failed", "Exceeded maximum redirect hops"); + } + let nextUrlStr: string; + try { + nextUrlStr = new URL(location, currentUrl).toString(); + } catch { + throw new ProtocolError("download_failed", "Malformed redirect Location URL"); + } + currentUrl = validateStateDownloadUrl(nextUrlStr, options.allowedHosts); + continue; + } + + if (!response.ok) { + throw new ProtocolError( + "download_failed", + `Download request to ${currentUrl.hostname} failed with HTTP ${response.status}`, + ); + } + + finalResponse = response; + break; + } + + if (finalResponse === null) { + throw new ProtocolError("download_failed", "Exceeded maximum redirect hops"); + } + + const data = await readCappedBytes(finalResponse, maxBytes); + const sha1 = createHash("sha1").update(data).digest("hex"); + const sha256 = createHash("sha256").update(data).digest("hex"); + const sha512 = createHash("sha512").update(data).digest("hex"); + + if (expectedSha1 !== undefined && !digestsEqual(sha1, expectedSha1)) { + throw new ProtocolError("hash_mismatch", "Downloaded artifact SHA-1 checksum mismatch"); + } + if (expectedSha256 !== undefined && !digestsEqual(sha256, expectedSha256)) { + throw new ProtocolError("hash_mismatch", "Downloaded artifact SHA-256 checksum mismatch"); + } + if (expectedSha512 !== undefined && !digestsEqual(sha512, expectedSha512)) { + throw new ProtocolError("hash_mismatch", "Downloaded artifact SHA-512 checksum mismatch"); + } + + return { + data, + bytes: data.byteLength, + sha1, + sha256, + sha512, + }; +} diff --git a/src/state/index.ts b/src/state/index.ts new file mode 100644 index 0000000..c5c4b45 --- /dev/null +++ b/src/state/index.ts @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +export { type BackupHook, noopBackupHook } from "./backup-hook"; +export { + buildAllowedDownloadHosts, + DEFAULT_MAX_MOD_BYTES, + DEFAULT_MAX_SERVERPACK_BYTES, + DEFAULT_MOD_ALLOWED_HOSTS, + DEFAULT_STATE_DOWNLOAD_TIMEOUT_MS, + DEFAULT_STATE_MAX_REDIRECTS, + type DownloadVerifiedBufferOptions, + downloadVerifiedBuffer, + type ExpectedHashes, + type VerifiedDownloadResult, + validateStateDownloadUrl, +} from "./download"; +export { assertVersionLoaderUnlocked, isVersionLoaderLocked } from "./lock"; +export { + createStateManager, + DEFAULT_MAX_STORED_PLANS, + DEFAULT_PLAN_TTL_MS, + type ModInstallResult, + type ModRemoveResult, + type ModsListResult, + type OriginApplyResult, + type OriginPlanResult, + type OriginUnlinkResult, + registerStateHandlers, + type ServerPackDeployResult, + type StateManager, + type StateManagerOptions, + type UpdateVersionLoaderParams, +} from "./manager"; +export { + buildOriginSyncChanges, + emptyOriginSyncState, + isClientOnly, + isRedistributionRestricted, + isServerContentPath, + type ModExcludedReason, + type ModIdentitySource, + type ModRedistributionInfo, + modIdentityKey, + nextOriginSyncState, + normalizeRelativePath, + type OriginFileChange, + type OriginModChange, + type OriginSyncChanges, + type PlanFile, + type PlanMod, + redistributionFromModrinthLicense, + SERVER_PACK_MANIFEST_FILE, + SERVER_PACK_WORLD_DIR, + shouldCopyOnCreate, + stripDisabledSuffix, + worldArchivePath, +} from "./sync-plan"; diff --git a/src/state/lock.ts b/src/state/lock.ts new file mode 100644 index 0000000..8443e87 --- /dev/null +++ b/src/state/lock.ts @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { ProtocolError } from "../protocol"; +import type { ServerMetadata } from "../server/registry"; + +export function isVersionLoaderLocked(meta: ServerMetadata): boolean { + return meta.origin?.kind === "modpack"; +} + +export function assertVersionLoaderUnlocked(meta: ServerMetadata): void { + if (isVersionLoaderLocked(meta)) { + throw new ProtocolError( + "origin_locked", + `Server "${meta.id}" is linked to a modpack origin; unlink the origin before changing Minecraft version or loader`, + ); + } +} diff --git a/src/state/manager.ts b/src/state/manager.ts new file mode 100644 index 0000000..41ecf9d --- /dev/null +++ b/src/state/manager.ts @@ -0,0 +1,1088 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { createHash, randomBytes } from "node:crypto"; +import { existsSync, lstatSync, readdirSync, readFileSync, unlinkSync } from "node:fs"; +import { join } from "node:path"; +import type { CommandQueue } from "../agent/jobs"; +import type { Logger } from "../agent/logger"; +import { + decodeStrictBase64, + FileManagerError, + resolveConfinedPath, + safeUnzipBuffer, + validateSingleFileName, + writeConfinedFileAtomic, +} from "../files"; +import { + ProtocolError, + type ServerDeployServerpackBody, + type ServerLoader, + type ServerModEntry, + type ServerModsInstallBody, + type ServerModsRemoveBody, + type ServerOrigin, + type ServerOriginApplyBody, + type ServerOriginPlanBody, + type ServerOriginSyncState, + serverDeployServerpackBodySchema, + serverModsInstallBodySchema, + serverModsRemoveBodySchema, + serverOriginApplyBodySchema, + serverOriginPlanBodySchema, +} from "../protocol"; +import type { FetchLike } from "../server/download"; +import { assertValidServerId, DEFAULT_SERVERS_DIR } from "../server/id"; +import { readServerMetadata, type ServerMetadata, writeServerMetadata } from "../server/registry"; +import { type BackupHook, noopBackupHook } from "./backup-hook"; +import { + buildAllowedDownloadHosts, + DEFAULT_MAX_MOD_BYTES, + DEFAULT_MAX_SERVERPACK_BYTES, + downloadVerifiedBuffer, +} from "./download"; +import { assertVersionLoaderUnlocked, isVersionLoaderLocked } from "./lock"; +import { + buildOriginSyncChanges, + emptyOriginSyncState, + isServerContentPath, + modIdentityKey, + nextOriginSyncState, + normalizeRelativePath, + type OriginSyncChanges, + type PlanFile, + type PlanMod, +} from "./sync-plan"; + +export const DEFAULT_PLAN_TTL_MS = 15 * 60 * 1000; // 15 minutes +export const DEFAULT_MAX_STORED_PLANS = 64; +const MODS_DIR = "mods"; + +export interface StateManagerOptions { + readonly serversDir?: string; + readonly cdnHost?: string; + readonly extraAllowedHosts?: readonly string[]; + readonly backupHook?: BackupHook; + readonly backupBeforeChange?: boolean; + readonly fetchImpl?: FetchLike; + readonly maxModBytes?: number; + readonly maxServerPackBytes?: number; + readonly maxRedirects?: number; + readonly downloadTimeoutMs?: number; + readonly planTtlMs?: number; + readonly maxStoredPlans?: number; + readonly now?: () => number; + readonly logger?: Logger; +} + +export interface ModsListResult { + readonly server_id: string; + readonly origin: ServerOrigin; + readonly version_loader_locked: boolean; + readonly mods: readonly ServerModEntry[]; +} + +export interface ModInstallResult { + readonly server_id: string; + readonly mod: ServerModEntry; + readonly bytes: number; +} + +export interface ModRemoveResult { + readonly server_id: string; + readonly file: string; + readonly removed: boolean; + readonly tracked_origin_removal: boolean; +} + +export interface OriginPlanResult { + readonly plan_id: string; + readonly server_id: string; + readonly from_version_id: string | null; + readonly to_version_id: string; + readonly expires_at: number; + readonly state_fingerprint: string; + readonly changes: OriginSyncChanges; +} + +export interface OriginApplyResult { + readonly server_id: string; + readonly plan_id: string; + readonly origin: ServerOrigin; + readonly mods_added: number; + readonly mods_updated: number; + readonly mods_removed: number; + readonly files_written: number; + readonly files_removed: number; +} + +export interface OriginUnlinkResult { + readonly server_id: string; + readonly origin: null; + readonly version_loader_locked: false; +} + +export interface ServerPackDeployResult { + readonly server_id: string; + readonly bytes: number; + readonly sha256: string; + readonly entry_count: number; + readonly extracted_files: readonly string[]; + readonly origin: ServerOrigin; +} + +export interface UpdateVersionLoaderParams { + readonly server_id: string; + readonly minecraft_version?: string; + readonly loader?: ServerLoader; + readonly loader_version?: string | null; +} + +interface StoredOriginPlan { + readonly planId: string; + readonly serverId: string; + readonly createdAt: number; + readonly expiresAt: number; + readonly stateFingerprint: string; + readonly input: ServerOriginPlanBody; + readonly sourceMods: readonly PlanMod[]; + readonly sourceFiles: readonly PlanFile[]; + readonly changes: OriginSyncChanges; +} + +export interface StateManager { + listMods(serverId: string): ModsListResult; + installMod(params: ServerModsInstallBody): Promise; + removeMod(params: ServerModsRemoveBody): ModRemoveResult; + unlinkOrigin(serverId: string): OriginUnlinkResult; + updateVersionLoader(params: UpdateVersionLoaderParams): ServerMetadata; + planOriginSync(params: ServerOriginPlanBody): OriginPlanResult; + applyOriginSync(params: ServerOriginApplyBody): Promise; + deployServerPack(params: ServerDeployServerpackBody): Promise; +} + +function modKeyFromMetadataEntry(entry: ServerModEntry): string { + return modIdentityKey({ + filename: entry.file, + modInfo: entry.project_id !== undefined ? { modId: entry.project_id } : null, + }); +} + +function hashFileSha1(fullPath: string): string { + const content = readFileSync(fullPath); + return createHash("sha1").update(content).digest("hex"); +} + +function hashFileSha256(fullPath: string): string { + const content = readFileSync(fullPath); + return createHash("sha256").update(content).digest("hex"); +} + +function scanExistingServerFiles( + serversDir: string, + serverId: string, + candidatePaths: ReadonlySet, +): PlanFile[] { + const result: PlanFile[] = []; + for (const rel of candidatePaths) { + const norm = normalizeRelativePath(rel); + if (!isServerContentPath(norm)) { + continue; + } + let resolved: ReturnType; + try { + resolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: norm, + allowRoot: false, + }); + } catch { + continue; + } + if (!existsSync(resolved.fullPath)) { + continue; + } + const stats = lstatSync(resolved.fullPath); + if (stats.isSymbolicLink() || !stats.isFile()) { + continue; + } + result.push({ + path: norm, + sha1: hashFileSha1(resolved.fullPath), + size_bytes: stats.size, + }); + } + return result; +} + +function computeServerStateFingerprint( + serversDir: string, + serverId: string, + meta: ServerMetadata, + trackedFilePaths: ReadonlySet, +): string { + const hasher = createHash("sha256"); + hasher.update(JSON.stringify(meta)); + hasher.update("\0"); + + // Include actual mods/ directory files and hashes. + const modsResolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: MODS_DIR, + allowRoot: false, + }); + if (existsSync(modsResolved.fullPath)) { + const stats = lstatSync(modsResolved.fullPath); + if (stats.isDirectory() && !stats.isSymbolicLink()) { + const names = readdirSync(modsResolved.fullPath).sort(); + for (const name of names) { + if (name.startsWith(".tmp-")) { + continue; + } + const full = join(modsResolved.fullPath, name); + const st = lstatSync(full); + if (st.isFile() && !st.isSymbolicLink()) { + hasher.update(`mod:${name}:${st.size}:${hashFileSha256(full)}\n`); + } + } + } + } + + hasher.update("\0"); + const sortedPaths = [...trackedFilePaths].sort(); + for (const rel of sortedPaths) { + const norm = normalizeRelativePath(rel); + let resolved: ReturnType; + try { + resolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: norm, + allowRoot: false, + }); + } catch { + continue; + } + if (!existsSync(resolved.fullPath)) { + hasher.update(`file:${norm}:missing\n`); + continue; + } + const st = lstatSync(resolved.fullPath); + if (st.isFile() && !st.isSymbolicLink()) { + hasher.update(`file:${norm}:${st.size}:${hashFileSha256(resolved.fullPath)}\n`); + } + } + + return hasher.digest("hex"); +} + +function removeConfinedFileIfExists( + serversDir: string, + serverId: string, + relPath: string, +): boolean { + const resolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath, + allowRoot: false, + }); + if (!existsSync(resolved.fullPath)) { + return false; + } + const stats = lstatSync(resolved.fullPath); + if (stats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", `Refusing to delete symlink "${relPath}"`); + } + if (!stats.isFile()) { + throw new FileManagerError("is_a_directory", `Refusing to delete non-file "${relPath}"`); + } + unlinkSync(resolved.fullPath); + return true; +} + +export function createStateManager(options: StateManagerOptions = {}): StateManager { + const serversDir = options.serversDir ?? DEFAULT_SERVERS_DIR; + const allowedHosts = buildAllowedDownloadHosts([ + options.cdnHost, + ...(options.extraAllowedHosts ?? []), + ]); + const backupHook = options.backupHook ?? noopBackupHook; + const backupBeforeChange = options.backupBeforeChange ?? true; + const maxModBytes = options.maxModBytes ?? DEFAULT_MAX_MOD_BYTES; + const maxServerPackBytes = options.maxServerPackBytes ?? DEFAULT_MAX_SERVERPACK_BYTES; + const planTtlMs = options.planTtlMs ?? DEFAULT_PLAN_TTL_MS; + const maxStoredPlans = options.maxStoredPlans ?? DEFAULT_MAX_STORED_PLANS; + const now = options.now ?? (() => Date.now()); + + const plans = new Map(); + + function pruneExpiredPlans(): void { + const current = now(); + for (const [id, plan] of plans) { + if (current > plan.expiresAt) { + plans.delete(id); + } + } + } + + function invalidatePlansForServer(serverId: string): void { + for (const [id, plan] of plans) { + if (plan.serverId === serverId) { + plans.delete(id); + } + } + } + + function listMods(serverId: string): ModsListResult { + const validId = assertValidServerId(serverId); + const meta = readServerMetadata(serversDir, validId); + return { + server_id: validId, + origin: meta.origin ?? null, + version_loader_locked: isVersionLoaderLocked(meta), + mods: meta.mods ?? [], + }; + } + + async function installMod(params: ServerModsInstallBody): Promise { + const parsed = serverModsInstallBodySchema.safeParse(params); + if (!parsed.success) { + throw new ProtocolError("invalid_body", "Invalid server.mods.install parameters"); + } + const { + server_id: serverId, + url, + source, + project_id, + version_id, + sha1, + sha256, + sha512, + } = parsed.data; + const safeFile = validateSingleFileName(parsed.data.file); + const meta = readServerMetadata(serversDir, serverId); + + const downloaded = await downloadVerifiedBuffer({ + url, + allowedHosts, + expectedHashes: { sha1, sha256, sha512 }, + maxBytes: maxModBytes, + ...(options.maxRedirects !== undefined ? { maxRedirects: options.maxRedirects } : {}), + ...(options.downloadTimeoutMs !== undefined ? { timeoutMs: options.downloadTimeoutMs } : {}), + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + }); + + const targetResolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: `${MODS_DIR}/${safeFile}`, + allowRoot: false, + }); + writeConfinedFileAtomic(targetResolved, downloaded.data, { createParents: true }); + + const newEntry: ServerModEntry = { + file: safeFile, + source, + ...(project_id !== undefined ? { project_id } : {}), + ...(version_id !== undefined ? { version_id } : {}), + sha1: downloaded.sha1, + sha256: downloaded.sha256, + sha512: downloaded.sha512, + layer: "user", + }; + + const existingMods = (meta.mods ?? []).filter((m) => m.file !== safeFile); + const nextMeta: ServerMetadata = { + ...meta, + mods: [...existingMods, newEntry].sort((a, b) => a.file.localeCompare(b.file)), + }; + writeServerMetadata(serversDir, nextMeta); + + options.logger?.info("Installed server mod", { serverId, file: safeFile, source }); + + return { + server_id: serverId, + mod: newEntry, + bytes: downloaded.bytes, + }; + } + + function removeMod(params: ServerModsRemoveBody): ModRemoveResult { + const parsed = serverModsRemoveBodySchema.safeParse(params); + if (!parsed.success) { + throw new ProtocolError("invalid_body", "Invalid server.mods.remove parameters"); + } + const serverId = parsed.data.server_id; + const safeFile = validateSingleFileName(parsed.data.file); + const meta = readServerMetadata(serversDir, serverId); + + const existingMods = meta.mods ?? []; + const targetEntry = existingMods.find((m) => m.file === safeFile); + const removedFromDisk = removeConfinedFileIfExists( + serversDir, + serverId, + `${MODS_DIR}/${safeFile}`, + ); + + if (!removedFromDisk && targetEntry === undefined) { + throw new ProtocolError("mod_not_found", `Mod "${safeFile}" not found on server ${serverId}`); + } + + const nextMods = existingMods.filter((m) => m.file !== safeFile); + let nextOriginSync = meta.origin_sync; + let trackedOriginRemoval = false; + + if (targetEntry?.layer === "origin") { + trackedOriginRemoval = true; + const baseSync = meta.origin_sync ?? emptyOriginSyncState(); + const modKey = modKeyFromMetadataEntry(targetEntry); + const excludedSet = new Set(baseSync.excluded_mod_keys); + excludedSet.add(modKey); + const removedFilesSet = new Set(baseSync.removed_origin_files ?? []); + removedFilesSet.add(`${MODS_DIR}/${safeFile}`); + nextOriginSync = { + ...baseSync, + excluded_mod_keys: [...excludedSet].sort(), + removed_origin_files: [...removedFilesSet].sort(), + }; + } + + const nextMeta: ServerMetadata = { + ...meta, + mods: nextMods, + ...(nextOriginSync !== undefined ? { origin_sync: nextOriginSync } : {}), + }; + writeServerMetadata(serversDir, nextMeta); + + options.logger?.info("Removed server mod", { serverId, file: safeFile, trackedOriginRemoval }); + + return { + server_id: serverId, + file: safeFile, + removed: true, + tracked_origin_removal: trackedOriginRemoval, + }; + } + + function unlinkOrigin(serverId: string): OriginUnlinkResult { + const validId = assertValidServerId(serverId); + const meta = readServerMetadata(serversDir, validId); + + const promotedMods: ServerModEntry[] = (meta.mods ?? []).map((mod) => + mod.layer === "origin" ? { ...mod, layer: "user" } : mod, + ); + + const { origin_sync: _droppedSync, ...rest } = meta; + const nextMeta: ServerMetadata = { + ...rest, + origin: null, + mods: promotedMods, + }; + writeServerMetadata(serversDir, nextMeta); + invalidatePlansForServer(validId); + + options.logger?.info("Unlinked server modpack origin", { serverId: validId }); + + return { + server_id: validId, + origin: null, + version_loader_locked: false, + }; + } + + function updateVersionLoader(params: UpdateVersionLoaderParams): ServerMetadata { + const validId = assertValidServerId(params.server_id); + const meta = readServerMetadata(serversDir, validId); + assertVersionLoaderUnlocked(meta); + + const nextMeta: ServerMetadata = { + ...meta, + ...(params.minecraft_version !== undefined + ? { minecraft_version: params.minecraft_version } + : {}), + ...(params.loader !== undefined ? { loader: params.loader } : {}), + ...(params.loader_version !== undefined ? { loader_version: params.loader_version } : {}), + }; + writeServerMetadata(serversDir, nextMeta); + return nextMeta; + } + + function planOriginSync(params: ServerOriginPlanBody): OriginPlanResult { + const parsed = serverOriginPlanBodySchema.safeParse(params); + if (!parsed.success) { + throw new ProtocolError("invalid_body", "Invalid server.origin.plan parameters"); + } + const input = parsed.data; + const serverId = input.server_id; + const meta = readServerMetadata(serversDir, serverId); + const syncState = meta.origin_sync ?? emptyOriginSyncState(); + + // Validate all mod filenames and file paths up front. + const sourceMods: PlanMod[] = input.mods.map((m) => { + const safeFile = validateSingleFileName(m.file); + return { + key: m.key, + filename: safeFile, + enabled: m.enabled ?? true, + name: m.name ?? safeFile, + version: m.version_id, + sha1: m.sha1, + sha512: m.sha512, + environment: m.environment, + }; + }); + + const sourceFiles: PlanFile[] = []; + const candidateFilePaths = new Set(syncState.synced_files ?? []); + for (const f of input.files ?? []) { + const norm = normalizeRelativePath(f.path); + // Enforce confinement on every planned file path. + resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: norm, + allowRoot: false, + }); + if (!isServerContentPath(norm)) { + continue; + } + candidateFilePaths.add(norm); + sourceFiles.push({ + path: norm, + sha1: f.sha1, + size_bytes: f.size_bytes, + }); + } + + const targetMods: PlanMod[] = (meta.mods ?? []).map((m) => ({ + key: modKeyFromMetadataEntry(m), + filename: m.file, + enabled: true, + name: m.file, + version: m.version_id, + sha1: m.sha1, + sha512: m.sha512, + })); + + const targetFiles = scanExistingServerFiles(serversDir, serverId, candidateFilePaths); + + const changes = buildOriginSyncChanges({ + sourceMods, + targetMods, + sourceFiles, + targetFiles, + state: syncState, + }); + + const stateFingerprint = computeServerStateFingerprint( + serversDir, + serverId, + meta, + candidateFilePaths, + ); + + pruneExpiredPlans(); + while (plans.size >= maxStoredPlans) { + const oldestKey = plans.keys().next().value; + if (oldestKey === undefined) { + break; + } + plans.delete(oldestKey); + } + + const createdAt = now(); + const expiresAt = createdAt + planTtlMs; + const planId = randomBytes(16).toString("base64url"); + + plans.set(planId, { + planId, + serverId, + createdAt, + expiresAt, + stateFingerprint, + input, + sourceMods, + sourceFiles, + changes, + }); + + const fromVersionId = meta.origin?.kind === "modpack" ? meta.origin.version_id : null; + + return { + plan_id: planId, + server_id: serverId, + from_version_id: fromVersionId, + to_version_id: input.to_version_id, + expires_at: expiresAt, + state_fingerprint: stateFingerprint, + changes, + }; + } + + async function applyOriginSync(params: ServerOriginApplyBody): Promise { + const parsed = serverOriginApplyBodySchema.safeParse(params); + if (!parsed.success) { + throw new ProtocolError("invalid_body", "Invalid server.origin.apply parameters"); + } + const { server_id: serverId, plan_id: planId } = parsed.data; + const plan = plans.get(planId); + if (plan === undefined || plan.serverId !== serverId) { + throw new ProtocolError("plan_not_found", `Unknown origin sync plan: ${planId}`); + } + + const currentTime = now(); + if (currentTime > plan.expiresAt) { + plans.delete(planId); + throw new ProtocolError("plan_expired", `Origin sync plan has expired: ${planId}`); + } + + const meta = readServerMetadata(serversDir, serverId); + const syncState = meta.origin_sync ?? emptyOriginSyncState(); + const candidateFilePaths = new Set(syncState.synced_files ?? []); + for (const f of plan.sourceFiles) { + candidateFilePaths.add(f.path); + } + + const currentFingerprint = computeServerStateFingerprint( + serversDir, + serverId, + meta, + candidateFilePaths, + ); + if (currentFingerprint !== plan.stateFingerprint) { + plans.delete(planId); + throw new ProtocolError( + "plan_stale", + "Server state changed after plan was generated; generate a new plan before applying", + ); + } + + // Consume plan so it cannot be applied twice. + plans.delete(planId); + + const selectedModKeys = new Set( + parsed.data.selected_mod_keys ?? + plan.changes.mods.filter((c) => c.selected_by_default).map((c) => c.key), + ); + const selectedFilePaths = new Set( + ( + parsed.data.selected_file_paths ?? + plan.changes.files.filter((c) => c.selected_by_default).map((c) => c.path) + ).map(normalizeRelativePath), + ); + + const inputModByKey = new Map(plan.input.mods.map((m) => [m.key, m])); + const inputFileByPath = new Map( + (plan.input.files ?? []).map((f) => [normalizeRelativePath(f.path), f]), + ); + + // Phase 1: Download & verify all required artifacts BEFORE mutating server state or invoking backup hook. + const downloadedMods = new Map< + string, + { + readonly file: string; + readonly data: Uint8Array; + readonly sha1: string; + readonly sha256: string; + readonly sha512: string; + } + >(); + for (const change of plan.changes.mods) { + if (!selectedModKeys.has(change.key)) { + continue; + } + if (change.kind === "added" || change.kind === "updated") { + const spec = inputModByKey.get(change.key); + if (!spec?.url) { + throw new ProtocolError( + "download_failed", + `Missing download URL for planned mod "${change.key}"`, + ); + } + const safeFile = validateSingleFileName(spec.file); + const dl = await downloadVerifiedBuffer({ + url: spec.url, + allowedHosts, + expectedHashes: { sha1: spec.sha1, sha256: spec.sha256, sha512: spec.sha512 }, + maxBytes: maxModBytes, + ...(options.maxRedirects !== undefined ? { maxRedirects: options.maxRedirects } : {}), + ...(options.downloadTimeoutMs !== undefined + ? { timeoutMs: options.downloadTimeoutMs } + : {}), + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + }); + downloadedMods.set(change.key, { + file: safeFile, + data: dl.data, + sha1: dl.sha1, + sha256: dl.sha256, + sha512: dl.sha512, + }); + } + } + + const downloadedFiles = new Map(); + for (const change of plan.changes.files) { + if (!selectedFilePaths.has(change.path)) { + continue; + } + if (change.kind === "added" || change.kind === "changed") { + const spec = inputFileByPath.get(change.path); + if (!spec) { + continue; + } + if (spec.url !== undefined) { + const dl = await downloadVerifiedBuffer({ + url: spec.url, + allowedHosts, + expectedHashes: { sha1: spec.sha1, sha256: spec.sha256 }, + maxBytes: maxModBytes, + ...(options.maxRedirects !== undefined ? { maxRedirects: options.maxRedirects } : {}), + ...(options.downloadTimeoutMs !== undefined + ? { timeoutMs: options.downloadTimeoutMs } + : {}), + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + }); + downloadedFiles.set(change.path, dl.data); + } else if (spec.content_base64 !== undefined) { + const decoded = decodeStrictBase64(spec.content_base64, maxModBytes); + const actualSha1 = createHash("sha1").update(decoded).digest("hex"); + if (actualSha1 !== spec.sha1.toLowerCase()) { + throw new ProtocolError( + "hash_mismatch", + `Checksum mismatch for planned file "${change.path}"`, + ); + } + downloadedFiles.set(change.path, decoded); + } else { + throw new ProtocolError( + "download_failed", + `Missing content or download URL for planned file "${change.path}"`, + ); + } + } + } + + // Phase 2: Invoke backup hook before mutating the server. + if (backupBeforeChange) { + await backupHook.beforeChange(serverId); + } + + // Phase 3: Apply filesystem changes via confined writes/deletions. + let modsAdded = 0; + let modsUpdated = 0; + let modsRemoved = 0; + let filesWritten = 0; + let filesRemoved = 0; + + const currentModsByFile = new Map( + (meta.mods ?? []).map((m) => [m.file, m]), + ); + + const originSource = + plan.input.source ?? (meta.origin?.kind === "modpack" ? meta.origin.source : "tegra"); + + for (const change of plan.changes.mods) { + if (!selectedModKeys.has(change.key)) { + continue; + } + if (change.kind === "removed") { + if (change.target_filename !== undefined) { + const safeTarget = validateSingleFileName(change.target_filename); + removeConfinedFileIfExists(serversDir, serverId, `${MODS_DIR}/${safeTarget}`); + currentModsByFile.delete(safeTarget); + modsRemoved++; + } + continue; + } + + const downloaded = downloadedMods.get(change.key); + const spec = inputModByKey.get(change.key); + if (!downloaded || !spec) { + continue; + } + + if ( + change.kind === "updated" && + change.target_filename !== undefined && + change.target_filename !== downloaded.file + ) { + const oldSafe = validateSingleFileName(change.target_filename); + removeConfinedFileIfExists(serversDir, serverId, `${MODS_DIR}/${oldSafe}`); + currentModsByFile.delete(oldSafe); + } + + const resolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: `${MODS_DIR}/${downloaded.file}`, + allowRoot: false, + }); + writeConfinedFileAtomic(resolved, downloaded.data, { createParents: true }); + + const entry: ServerModEntry = { + file: downloaded.file, + source: spec.source ?? originSource, + ...(spec.project_id !== undefined ? { project_id: spec.project_id } : {}), + ...(spec.version_id !== undefined ? { version_id: spec.version_id } : {}), + sha1: downloaded.sha1, + sha256: downloaded.sha256, + sha512: downloaded.sha512, + layer: "origin", + }; + currentModsByFile.set(downloaded.file, entry); + + if (change.kind === "added") { + modsAdded++; + } else { + modsUpdated++; + } + } + + for (const change of plan.changes.files) { + if (!selectedFilePaths.has(change.path)) { + continue; + } + if (change.kind === "removed") { + if (removeConfinedFileIfExists(serversDir, serverId, change.path)) { + filesRemoved++; + } + continue; + } + const fileData = downloadedFiles.get(change.path); + if (fileData !== undefined) { + const resolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: change.path, + allowRoot: false, + }); + writeConfinedFileAtomic(resolved, fileData, { createParents: true }); + filesWritten++; + } + } + + const nextSync = nextOriginSyncState({ + state: syncState, + modChanges: plan.changes.mods, + fileChanges: plan.changes.files, + selectedModKeys, + selectedFilePaths, + sourceMods: plan.sourceMods, + sourceFiles: plan.sourceFiles, + versionId: plan.input.to_version_id, + nowIso: new Date(currentTime).toISOString(), + }); + + const nextOrigin: ServerOrigin = + plan.input.modpack_id !== undefined + ? { + kind: "modpack", + source: originSource, + modpack_id: plan.input.modpack_id, + version_id: plan.input.to_version_id, + } + : meta.origin?.kind === "modpack" + ? { + ...meta.origin, + version_id: plan.input.to_version_id, + } + : (meta.origin ?? null); + + const nextMeta: ServerMetadata = { + ...meta, + ...(plan.input.minecraft_version !== undefined + ? { minecraft_version: plan.input.minecraft_version } + : {}), + ...(plan.input.loader !== undefined ? { loader: plan.input.loader } : {}), + ...(plan.input.loader_version !== undefined + ? { loader_version: plan.input.loader_version } + : {}), + origin: nextOrigin, + mods: [...currentModsByFile.values()].sort((a, b) => a.file.localeCompare(b.file)), + origin_sync: nextSync, + }; + writeServerMetadata(serversDir, nextMeta); + + options.logger?.info("Applied origin sync plan", { + serverId, + planId, + modsAdded, + modsUpdated, + modsRemoved, + filesWritten, + filesRemoved, + }); + + return { + server_id: serverId, + plan_id: planId, + origin: nextOrigin, + mods_added: modsAdded, + mods_updated: modsUpdated, + mods_removed: modsRemoved, + files_written: filesWritten, + files_removed: filesRemoved, + }; + } + + async function deployServerPack( + params: ServerDeployServerpackBody, + ): Promise { + const parsed = serverDeployServerpackBodySchema.safeParse(params); + if (!parsed.success) { + throw new ProtocolError("invalid_body", "Invalid server.deploy.serverpack parameters"); + } + const { server_id: serverId, url, sha1, sha256, sha512, origin } = parsed.data; + const meta = readServerMetadata(serversDir, serverId); + + // Download & verify hash BEFORE backup hook or extraction. + const downloaded = await downloadVerifiedBuffer({ + url, + allowedHosts, + expectedHashes: { sha1, sha256, sha512 }, + maxBytes: maxServerPackBytes, + ...(options.maxRedirects !== undefined ? { maxRedirects: options.maxRedirects } : {}), + ...(options.downloadTimeoutMs !== undefined ? { timeoutMs: options.downloadTimeoutMs } : {}), + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + }); + + if (backupBeforeChange) { + await backupHook.beforeChange(serverId); + } + + const unzipResult = safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId, + buffer: downloaded.data, + }); + + const nextOrigin: ServerOrigin = origin !== undefined ? origin : (meta.origin ?? null); + const modEntriesByFile = new Map( + (meta.mods ?? []).map((m) => [m.file, m]), + ); + const originSource = nextOrigin?.kind === "modpack" ? nextOrigin.source : "local"; + + const extractedSyncedFiles: string[] = []; + const extractedModKeys: string[] = []; + + for (const relPath of unzipResult.files) { + if (relPath.startsWith(`${MODS_DIR}/`) && !relPath.slice(MODS_DIR.length + 1).includes("/")) { + const fileName = relPath.slice(MODS_DIR.length + 1); + const resolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath, + allowRoot: false, + }); + const fileSha1 = hashFileSha1(resolved.fullPath); + const fileSha256 = hashFileSha256(resolved.fullPath); + const entry: ServerModEntry = { + file: fileName, + source: originSource, + sha1: fileSha1, + sha256: fileSha256, + layer: nextOrigin?.kind === "modpack" ? "origin" : "user", + }; + modEntriesByFile.set(fileName, entry); + extractedModKeys.push(modKeyFromMetadataEntry(entry)); + } else if (isServerContentPath(relPath)) { + extractedSyncedFiles.push(relPath); + } + } + + const nextSync: ServerOriginSyncState | undefined = + nextOrigin?.kind === "modpack" + ? { + excluded_mod_keys: [], + synced_mod_keys: [...new Set(extractedModKeys)].sort(), + removed_origin_files: [], + synced_files: [...new Set(extractedSyncedFiles)].sort(), + last_synced_at: new Date(now()).toISOString(), + last_synced_version_id: nextOrigin.version_id, + } + : meta.origin_sync; + + const nextMeta: ServerMetadata = { + ...meta, + origin: nextOrigin, + mods: [...modEntriesByFile.values()].sort((a, b) => a.file.localeCompare(b.file)), + ...(nextSync !== undefined ? { origin_sync: nextSync } : {}), + }; + writeServerMetadata(serversDir, nextMeta); + invalidatePlansForServer(serverId); + + options.logger?.info("Deployed server pack", { + serverId, + bytes: downloaded.bytes, + entryCount: unzipResult.entryCount, + }); + + return { + server_id: serverId, + bytes: downloaded.bytes, + sha256: downloaded.sha256, + entry_count: unzipResult.entryCount, + extracted_files: unzipResult.files, + origin: nextOrigin, + }; + } + + return { + listMods, + installMod, + removeMod, + unlinkOrigin, + updateVersionLoader, + planOriginSync, + applyOriginSync, + deployServerPack, + }; +} + +export function registerStateHandlers(queue: CommandQueue, manager: StateManager): void { + queue.registerHandler("server.mods.list", (opened, ctx) => { + const body = opened.body as { readonly server_id: string }; + const result = manager.listMods(body.server_id); + ctx.sendEvent("server.mods.list.result", result); + }); + + queue.registerHandler("server.mods.install", async (opened, ctx) => { + const body = opened.body as ServerModsInstallBody; + const result = await manager.installMod(body); + ctx.sendEvent("server.mods.installed", result); + }); + + queue.registerHandler("server.mods.remove", (opened, ctx) => { + const body = opened.body as ServerModsRemoveBody; + const result = manager.removeMod(body); + ctx.sendEvent("server.mods.removed", result); + }); + + queue.registerHandler("server.origin.plan", (opened, ctx) => { + const body = opened.body as ServerOriginPlanBody; + const result = manager.planOriginSync(body); + ctx.sendEvent("server.origin.planned", result); + }); + + queue.registerHandler("server.origin.apply", async (opened, ctx) => { + const body = opened.body as ServerOriginApplyBody; + const result = await manager.applyOriginSync(body); + ctx.sendEvent("server.origin.applied", result); + }); + + queue.registerHandler("server.origin.unlink", (opened, ctx) => { + const body = opened.body as { readonly server_id: string }; + const result = manager.unlinkOrigin(body.server_id); + ctx.sendEvent("server.origin.unlinked", result); + }); + + queue.registerHandler("server.deploy.serverpack", async (opened, ctx) => { + const body = opened.body as ServerDeployServerpackBody; + const result = await manager.deployServerPack(body); + ctx.sendEvent("server.deploy.serverpack.result", result); + }); +} diff --git a/src/state/state.test.ts b/src/state/state.test.ts new file mode 100644 index 0000000..78175f9 --- /dev/null +++ b/src/state/state.test.ts @@ -0,0 +1,880 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeAll, describe, expect, test } from "bun:test"; +import { createHash } from "node:crypto"; +import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { + createLogger, + getStatePaths, + loadConfig, + loadOrCreateIdentity, + validateCdnHost, +} from "../agent"; +import { createAgentRuntime } from "../cli/run"; +import { fingerprint, generateSigningKeyPair, ready, toBase64Url } from "../crypto"; +import { createZipBuffer } from "../files"; +import { + createCoreRegistry, + createSignedCommand, + openAgentMessage, + PROTOCOL_VERSION, + ProtocolError, + STATE_COMMANDS, + signSessionCertificate, + type TransportFrame, +} from "../protocol"; +import type { FetchLike } from "../server/download"; +import { readServerMetadata, type ServerMetadata, writeServerMetadata } from "../server/registry"; +import type { BackupHook } from "./backup-hook"; +import { buildAllowedDownloadHosts, downloadVerifiedBuffer } from "./download"; +import { isVersionLoaderLocked } from "./lock"; +import { createStateManager } from "./manager"; + +const tempDirs: string[] = []; + +function makeTempDir(prefix: string): string { + const dir = mkdtempSync(join(tmpdir(), prefix)); + tempDirs.push(dir); + return dir; +} + +function sha1Hex(data: Uint8Array): string { + return createHash("sha1").update(data).digest("hex"); +} + +function sha256Hex(data: Uint8Array): string { + return createHash("sha256").update(data).digest("hex"); +} + +function sha512Hex(data: Uint8Array): string { + return createHash("sha512").update(data).digest("hex"); +} + +function createTestServer( + serversDir: string, + serverId: string, + overrides: Partial = {}, +): ServerMetadata { + const serverDir = join(serversDir, serverId); + mkdirSync(serverDir, { recursive: true }); + const meta: ServerMetadata = { + v: 1, + id: serverId, + name: "Test Server", + minecraft_version: "1.21.1", + loader: "fabric", + loader_version: "0.16.0", + memory_mb: 2048, + jvm_args: [], + port: 25565, + created_at: 1_700_000_000_000, + ...overrides, + }; + writeServerMetadata(serversDir, meta); + return meta; +} + +function makeMockFetch(routes: Readonly Response>>): FetchLike { + return async (input) => { + const url = typeof input === "string" ? input : input.toString(); + const handler = routes[url]; + if (!handler) { + return new Response("Not Found", { status: 404 }); + } + return handler(); + }; +} + +beforeAll(async () => { + await ready(); +}); + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +describe("metadata backwards compatibility and config cdn_host", () => { + test("reads legacy v1 tegrad-server.json without mods/origin/origin_sync", () => { + const serversDir = makeTempDir("tegrad-state-compat-"); + const serverDir = join(serversDir, "legacy-1"); + mkdirSync(serverDir, { recursive: true }); + writeFileSync( + join(serverDir, "tegrad-server.json"), + JSON.stringify({ + v: 1, + id: "legacy-1", + name: "Legacy", + minecraft_version: "1.20.4", + loader: "vanilla", + loader_version: null, + memory_mb: 2048, + jvm_args: [], + port: 25565, + created_at: 1_700_000_000_000, + }), + "utf8", + ); + + const meta = readServerMetadata(serversDir, "legacy-1"); + expect(meta.mods).toBeUndefined(); + expect(meta.origin).toBeUndefined(); + expect(isVersionLoaderLocked(meta)).toBe(false); + + const mgr = createStateManager({ serversDir }); + const list = mgr.listMods("legacy-1"); + expect(list.mods).toEqual([]); + expect(list.origin).toBeNull(); + expect(list.version_loader_locked).toBe(false); + }); + + test("loadConfig validates optional cdn_host and tegra_cdn_host", () => { + const stateDir = makeTempDir("tegrad-state-cfg-"); + const { configPath } = getStatePaths(stateDir); + writeFileSync( + configPath, + JSON.stringify({ + api_url: "https://api.tegra.example", + cdn_host: "CDN.Tegra.GG", + tegra_cdn_host: "packs.tegra.gg", + }), + "utf8", + ); + + const cfg = loadConfig(stateDir); + expect(cfg.cdnHost).toBe("cdn.tegra.gg"); + expect(cfg.tegraCdnHost).toBe("packs.tegra.gg"); + + expect(() => validateCdnHost("127.0.0.1")).toThrow(); + expect(() => validateCdnHost("localhost")).toThrow(); + expect(() => validateCdnHost("https://cdn.tegra.gg")).toThrow(); + expect(() => validateCdnHost("cdn.tegra.gg:8443")).toThrow(); + expect(() => validateCdnHost("cdn.tegra.gg/path")).toThrow(); + }); +}); + +describe("safe downloads (host allowlist, redirects, size cap, hashes)", () => { + test("allows default hosts and configured Tegra CDN host, rejects disallowed hosts and http", async () => { + const payload = new TextEncoder().encode("mod-jar-bytes"); + const allowedHosts = buildAllowedDownloadHosts(["cdn.tegra.gg"]); + const fetchImpl = makeMockFetch({ + "https://cdn.modrinth.com/data/a/a.jar": () => new Response(payload, { status: 200 }), + "https://cdn.tegra.gg/packs/p.zip": () => new Response(payload, { status: 200 }), + }); + + const ok1 = await downloadVerifiedBuffer({ + url: "https://cdn.modrinth.com/data/a/a.jar", + allowedHosts, + expectedHashes: { sha1: sha1Hex(payload), sha256: sha256Hex(payload) }, + fetchImpl, + }); + expect(ok1.bytes).toBe(payload.byteLength); + + const ok2 = await downloadVerifiedBuffer({ + url: "https://cdn.tegra.gg/packs/p.zip", + allowedHosts, + expectedHashes: { sha512: sha512Hex(payload) }, + fetchImpl, + }); + expect(ok2.sha512).toBe(sha512Hex(payload)); + + await expect( + downloadVerifiedBuffer({ + url: "http://cdn.modrinth.com/data/a/a.jar", + allowedHosts, + fetchImpl, + }), + ).rejects.toMatchObject({ code: "download_failed" }); + + await expect( + downloadVerifiedBuffer({ + url: "https://evil.example/data/a/a.jar", + allowedHosts, + fetchImpl, + }), + ).rejects.toMatchObject({ code: "download_failed" }); + }); + + test("follows redirects within allowlist and blocks redirects outside allowlist or to http", async () => { + const payload = new TextEncoder().encode("redirected-ok"); + const allowedHosts = buildAllowedDownloadHosts(); + const fetchImpl = makeMockFetch({ + "https://cdn.modrinth.com/redir-ok": () => + new Response(null, { + status: 302, + headers: { location: "https://mediafilez.forgecdn.net/final.jar" }, + }), + "https://mediafilez.forgecdn.net/final.jar": () => new Response(payload, { status: 200 }), + "https://cdn.modrinth.com/redir-evil": () => + new Response(null, { + status: 302, + headers: { location: "https://evil.example/steal.jar" }, + }), + "https://cdn.modrinth.com/redir-http": () => + new Response(null, { + status: 302, + headers: { location: "http://cdn.modrinth.com/insecure.jar" }, + }), + "https://cdn.modrinth.com/loop": () => + new Response(null, { + status: 302, + headers: { location: "https://cdn.modrinth.com/loop" }, + }), + }); + + const res = await downloadVerifiedBuffer({ + url: "https://cdn.modrinth.com/redir-ok", + allowedHosts, + fetchImpl, + }); + expect(res.bytes).toBe(payload.byteLength); + + await expect( + downloadVerifiedBuffer({ + url: "https://cdn.modrinth.com/redir-evil", + allowedHosts, + fetchImpl, + }), + ).rejects.toMatchObject({ code: "download_failed" }); + + await expect( + downloadVerifiedBuffer({ + url: "https://cdn.modrinth.com/redir-http", + allowedHosts, + fetchImpl, + }), + ).rejects.toMatchObject({ code: "download_failed" }); + + await expect( + downloadVerifiedBuffer({ + url: "https://cdn.modrinth.com/loop", + allowedHosts, + maxRedirects: 2, + fetchImpl, + }), + ).rejects.toMatchObject({ code: "download_failed" }); + }); + + test("enforces max download size and fails closed on hash mismatch", async () => { + const payload = new Uint8Array(1024).fill(0x41); + const allowedHosts = buildAllowedDownloadHosts(); + const fetchImpl = makeMockFetch({ + "https://edge.forgecdn.net/mod.jar": () => new Response(payload, { status: 200 }), + }); + + await expect( + downloadVerifiedBuffer({ + url: "https://edge.forgecdn.net/mod.jar", + allowedHosts, + maxBytes: 512, + fetchImpl, + }), + ).rejects.toMatchObject({ code: "download_failed" }); + + await expect( + downloadVerifiedBuffer({ + url: "https://edge.forgecdn.net/mod.jar", + allowedHosts, + expectedHashes: { sha256: "0".repeat(64) }, + fetchImpl, + }), + ).rejects.toMatchObject({ code: "hash_mismatch" }); + }); +}); + +describe("StateManager: mods, version/loader lock, origin sync, and server pack deploy", () => { + test("installs and removes mods safely, rejects bad hashes and path traversal", async () => { + const serversDir = makeTempDir("tegrad-state-mods-"); + createTestServer(serversDir, "srv-1"); + const modBytes = new TextEncoder().encode("fabric-api-jar"); + const fetchImpl = makeMockFetch({ + "https://cdn.modrinth.com/fabric-api.jar": () => new Response(modBytes, { status: 200 }), + }); + + const mgr = createStateManager({ serversDir, fetchImpl }); + + // Wrong hash fails closed and writes nothing + await expect( + mgr.installMod({ + server_id: "srv-1", + file: "fabric-api.jar", + url: "https://cdn.modrinth.com/fabric-api.jar", + source: "modrinth", + sha256: "f".repeat(64), + }), + ).rejects.toMatchObject({ code: "hash_mismatch" }); + expect(existsSync(join(serversDir, "srv-1", "mods", "fabric-api.jar"))).toBe(false); + + // Path traversal filename rejected + await expect( + mgr.installMod({ + server_id: "srv-1", + file: "../escape.jar", + url: "https://cdn.modrinth.com/fabric-api.jar", + source: "modrinth", + }), + ).rejects.toBeInstanceOf(ProtocolError); + + // Valid install succeeds and records user layer + const installed = await mgr.installMod({ + server_id: "srv-1", + file: "fabric-api.jar", + url: "https://cdn.modrinth.com/fabric-api.jar", + source: "modrinth", + project_id: "P7dR8mSH", + version_id: "v1", + sha1: sha1Hex(modBytes), + sha256: sha256Hex(modBytes), + }); + expect(installed.mod.layer).toBe("user"); + expect(readFileSync(join(serversDir, "srv-1", "mods", "fabric-api.jar"))).toEqual( + Buffer.from(modBytes), + ); + + const listed = mgr.listMods("srv-1"); + expect(listed.mods.length).toBe(1); + expect(listed.mods[0]?.file).toBe("fabric-api.jar"); + + const removed = mgr.removeMod({ server_id: "srv-1", file: "fabric-api.jar" }); + expect(removed.removed).toBe(true); + expect(removed.tracked_origin_removal).toBe(false); + expect(existsSync(join(serversDir, "srv-1", "mods", "fabric-api.jar"))).toBe(false); + }); + + test("version/loader lock enforced when linked to modpack and unlocked by server.origin.unlink", () => { + const serversDir = makeTempDir("tegrad-state-lock-"); + createTestServer(serversDir, "srv-lock", { + origin: { + kind: "modpack", + source: "modrinth", + modpack_id: "pack-1", + version_id: "1.0.0", + }, + mods: [ + { + file: "origin-mod.jar", + source: "modrinth", + project_id: "m1", + layer: "origin", + }, + ], + }); + + const mgr = createStateManager({ serversDir }); + expect(mgr.listMods("srv-lock").version_loader_locked).toBe(true); + + expect(() => + mgr.updateVersionLoader({ + server_id: "srv-lock", + minecraft_version: "1.21.4", + }), + ).toThrow(ProtocolError); + + try { + mgr.updateVersionLoader({ server_id: "srv-lock", loader: "neoforge" }); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe("origin_locked"); + } + + const unlinked = mgr.unlinkOrigin("srv-lock"); + expect(unlinked.origin).toBeNull(); + expect(unlinked.version_loader_locked).toBe(false); + + const metaAfterUnlink = readServerMetadata(serversDir, "srv-lock"); + expect(metaAfterUnlink.origin).toBeNull(); + expect(metaAfterUnlink.mods?.[0]?.layer).toBe("user"); + + const updated = mgr.updateVersionLoader({ + server_id: "srv-lock", + minecraft_version: "1.21.4", + loader: "neoforge", + loader_version: "21.4.1", + }); + expect(updated.minecraft_version).toBe("1.21.4"); + expect(updated.loader).toBe("neoforge"); + }); + + test("origin plan & apply enforces plan_id validity, expiry, staleness, backup hook, and preserves user additions/removals", async () => { + const serversDir = makeTempDir("tegrad-state-sync-"); + const modABytes = new TextEncoder().encode("mod-a-v1"); + const modBNewBytes = new TextEncoder().encode("mod-b-v2"); + const modCBytes = new TextEncoder().encode("mod-c-v1"); + const userModBytes = new TextEncoder().encode("user-extra-mod"); + const cfgBytes = new TextEncoder().encode("difficulty=hard\n"); + + createTestServer(serversDir, "srv-sync", { + origin: { + kind: "modpack", + source: "tegra", + modpack_id: "pack-alpha", + version_id: "1.0.0", + }, + mods: [ + { + file: "mod-a.jar", + source: "tegra", + project_id: "mod-a", + sha1: sha1Hex(modABytes), + layer: "origin", + }, + { + file: "mod-b-v1.jar", + source: "tegra", + project_id: "mod-b", + sha1: sha1Hex(new TextEncoder().encode("mod-b-v1")), + layer: "origin", + }, + { + file: "mod-gone.jar", + source: "tegra", + project_id: "mod-gone", + sha1: sha1Hex(new TextEncoder().encode("gone")), + layer: "origin", + }, + { + file: "user-extra.jar", + source: "modrinth", + project_id: "user-extra", + sha1: sha1Hex(userModBytes), + layer: "user", + }, + ], + origin_sync: { + excluded_mod_keys: [], + synced_mod_keys: ["id:mod-a", "id:mod-b", "id:mod-gone"], + removed_origin_files: [], + synced_files: [], + last_synced_at: null, + last_synced_version_id: "1.0.0", + }, + }); + mkdirSync(join(serversDir, "srv-sync", "mods"), { recursive: true }); + writeFileSync(join(serversDir, "srv-sync", "mods", "mod-a.jar"), modABytes); + writeFileSync(join(serversDir, "srv-sync", "mods", "mod-b-v1.jar"), "mod-b-v1"); + writeFileSync(join(serversDir, "srv-sync", "mods", "mod-gone.jar"), "gone"); + writeFileSync(join(serversDir, "srv-sync", "mods", "user-extra.jar"), userModBytes); + + let currentTime = 1_700_000_000_000; + const backupCalls: string[] = []; + const backupHook: BackupHook = { + async beforeChange(serverId: string) { + backupCalls.push(serverId); + }, + }; + + const fetchImpl = makeMockFetch({ + "https://cdn.modrinth.com/mod-b-v2.jar": () => new Response(modBNewBytes, { status: 200 }), + "https://cdn.modrinth.com/mod-c.jar": () => new Response(modCBytes, { status: 200 }), + "https://cdn.modrinth.com/mod-a.jar": () => new Response(modABytes, { status: 200 }), + }); + + const mgr = createStateManager({ + serversDir, + backupHook, + fetchImpl, + planTtlMs: 60_000, + now: () => currentTime, + }); + + // User removes an origin mod (mod-a.jar); should be tracked so sync won't re-add it by default + const rmResult = mgr.removeMod({ server_id: "srv-sync", file: "mod-a.jar" }); + expect(rmResult.tracked_origin_removal).toBe(true); + + const planBody = { + server_id: "srv-sync", + to_version_id: "2.0.0", + mods: [ + { + key: "id:mod-a", + file: "mod-a.jar", + project_id: "mod-a", + sha1: sha1Hex(modABytes), + url: "https://cdn.modrinth.com/mod-a.jar", + }, + { + key: "id:mod-b", + file: "mod-b-v2.jar", + project_id: "mod-b", + version_id: "2.0", + sha1: sha1Hex(modBNewBytes), + url: "https://cdn.modrinth.com/mod-b-v2.jar", + }, + { + key: "id:mod-c", + file: "mod-c.jar", + project_id: "mod-c", + sha1: sha1Hex(modCBytes), + url: "https://cdn.modrinth.com/mod-c.jar", + }, + ], + files: [ + { + path: "config/pack.toml", + sha1: sha1Hex(cfgBytes), + size_bytes: cfgBytes.byteLength, + content_base64: Buffer.from(cfgBytes).toString("base64"), + }, + ], + }; + + const plan = mgr.planOriginSync(planBody); + expect(plan.changes.mods.find((m) => m.key === "id:mod-a")?.selected_by_default).toBe(false); + expect(plan.changes.mods.find((m) => m.key === "id:mod-b")?.kind).toBe("updated"); + expect(plan.changes.mods.find((m) => m.key === "id:mod-c")?.kind).toBe("added"); + expect(plan.changes.mods.find((m) => m.key === "id:mod-gone")?.kind).toBe("removed"); + + // Unknown plan_id rejected + await expect( + mgr.applyOriginSync({ server_id: "srv-sync", plan_id: "nonexistent" }), + ).rejects.toMatchObject({ code: "plan_not_found" }); + + // Expired plan rejected + const expiringPlan = mgr.planOriginSync(planBody); + currentTime += 60_001; + await expect( + mgr.applyOriginSync({ server_id: "srv-sync", plan_id: expiringPlan.plan_id }), + ).rejects.toMatchObject({ code: "plan_expired" }); + + // Stale plan rejected when server state changes after planning + const stalePlan = mgr.planOriginSync(planBody); + writeFileSync(join(serversDir, "srv-sync", "mods", "manual-change.jar"), "changed"); + await expect( + mgr.applyOriginSync({ server_id: "srv-sync", plan_id: stalePlan.plan_id }), + ).rejects.toMatchObject({ code: "plan_stale" }); + rmSync(join(serversDir, "srv-sync", "mods", "manual-change.jar")); + + // Path traversal in plan files rejected + expect(() => + mgr.planOriginSync({ + ...planBody, + files: [{ path: "../outside.txt", sha1: sha1Hex(cfgBytes), size_bytes: 1 }], + }), + ).toThrow(); + + // Fresh plan applies cleanly and invokes backupHook once + const freshPlan = mgr.planOriginSync(planBody); + const applied = await mgr.applyOriginSync({ + server_id: "srv-sync", + plan_id: freshPlan.plan_id, + }); + expect(backupCalls).toEqual(["srv-sync"]); + expect(applied.mods_added).toBe(1); + expect(applied.mods_updated).toBe(1); + expect(applied.mods_removed).toBe(1); + expect(applied.files_written).toBe(1); + + // User mod preserved, mod-a still removed, mod-b updated, mod-c added, mod-gone removed + expect(existsSync(join(serversDir, "srv-sync", "mods", "user-extra.jar"))).toBe(true); + expect(existsSync(join(serversDir, "srv-sync", "mods", "mod-a.jar"))).toBe(false); + expect(existsSync(join(serversDir, "srv-sync", "mods", "mod-b-v1.jar"))).toBe(false); + expect(existsSync(join(serversDir, "srv-sync", "mods", "mod-b-v2.jar"))).toBe(true); + expect(existsSync(join(serversDir, "srv-sync", "mods", "mod-c.jar"))).toBe(true); + expect(existsSync(join(serversDir, "srv-sync", "mods", "mod-gone.jar"))).toBe(false); + expect(readFileSync(join(serversDir, "srv-sync", "config", "pack.toml"), "utf8")).toBe( + "difficulty=hard\n", + ); + + // Re-applying consumed plan fails + await expect( + mgr.applyOriginSync({ server_id: "srv-sync", plan_id: freshPlan.plan_id }), + ).rejects.toMatchObject({ code: "plan_not_found" }); + }); + + test("deployServerPack verifies hash, invokes backupHook, extracts safely, and rejects zip-slip", async () => { + const serversDir = makeTempDir("tegrad-state-pack-"); + createTestServer(serversDir, "srv-pack"); + + const goodZip = createZipBuffer([ + { name: "mods/pack-mod.jar", data: new TextEncoder().encode("jar-content") }, + { name: "config/server.toml", data: new TextEncoder().encode("ok=true\n") }, + ]); + const evilZip = createZipBuffer([ + { name: "../escaped.txt", data: new TextEncoder().encode("pwned") }, + ]); + + const backupCalls: string[] = []; + const backupHook: BackupHook = { + async beforeChange(serverId: string) { + backupCalls.push(serverId); + }, + }; + + const fetchImpl = makeMockFetch({ + "https://cdn.tegra.gg/packs/good.zip": () => new Response(goodZip, { status: 200 }), + "https://cdn.tegra.gg/packs/evil.zip": () => new Response(evilZip, { status: 200 }), + }); + + const mgr = createStateManager({ + serversDir, + cdnHost: "cdn.tegra.gg", + backupHook, + fetchImpl, + }); + + // Wrong hash fails BEFORE backup hook or extraction + await expect( + mgr.deployServerPack({ + server_id: "srv-pack", + url: "https://cdn.tegra.gg/packs/good.zip", + sha256: "a".repeat(64), + }), + ).rejects.toMatchObject({ code: "hash_mismatch" }); + expect(backupCalls).toEqual([]); + expect(existsSync(join(serversDir, "srv-pack", "mods", "pack-mod.jar"))).toBe(false); + + // Zip slip rejected + await expect( + mgr.deployServerPack({ + server_id: "srv-pack", + url: "https://cdn.tegra.gg/packs/evil.zip", + sha256: sha256Hex(evilZip), + }), + ).rejects.toThrow(); + expect(existsSync(join(serversDir, "escaped.txt"))).toBe(false); + + // Good pack deploys cleanly + backupCalls.length = 0; + const res = await mgr.deployServerPack({ + server_id: "srv-pack", + url: "https://cdn.tegra.gg/packs/good.zip", + sha256: sha256Hex(goodZip), + origin: { + kind: "modpack", + source: "tegra", + modpack_id: "official-pack", + version_id: "1.0.0", + }, + }); + expect(backupCalls).toEqual(["srv-pack"]); + expect(res.extracted_files).toEqual(["mods/pack-mod.jar", "config/server.toml"]); + expect(existsSync(join(serversDir, "srv-pack", "mods", "pack-mod.jar"))).toBe(true); + + const meta = readServerMetadata(serversDir, "srv-pack"); + expect(meta.origin).toEqual({ + kind: "modpack", + source: "tegra", + modpack_id: "official-pack", + version_id: "1.0.0", + }); + expect(meta.mods?.[0]?.layer).toBe("origin"); + }); +}); + +describe("state commands protocol & runtime wiring", () => { + test("all STATE_COMMANDS reach handlers through createAgentRuntime and enforce sensitive rules", async () => { + const stateDir = makeTempDir("tegrad-state-rt-"); + const serversDir = makeTempDir("tegrad-state-rt-srv-"); + createTestServer(serversDir, "srv-rt"); + + const agent = await loadOrCreateIdentity(stateDir); + const agentId = fingerprint(agent.publicKey); + const account = generateSigningKeyPair(); + const sessionKey = generateSigningKeyPair(); + const now = Date.now(); + const sessionCert = signSessionCertificate({ + accountKeyPair: account, + sessionPublicKey: sessionKey.publicKey, + notBefore: now - 1000, + notAfter: now + 3_600_000, + }); + + const { configPath, trustPath } = getStatePaths(stateDir); + writeFileSync( + configPath, + JSON.stringify({ api_url: "https://api.tegra.example", tegra_cdn_host: "cdn.tegra.gg" }), + "utf8", + ); + writeFileSync( + trustPath, + JSON.stringify({ v: 1, accounts: [{ public_key: toBase64Url(account.publicKey) }] }), + "utf8", + ); + + const modBytes = new TextEncoder().encode("runtime-mod"); + const packZip = createZipBuffer([ + { name: "config/hello.txt", data: new TextEncoder().encode("hi") }, + ]); + const fetchImpl = makeMockFetch({ + "https://cdn.modrinth.com/m.jar": () => new Response(modBytes, { status: 200 }), + "https://cdn.tegra.gg/pack.zip": () => new Response(packZip, { status: 200 }), + }); + + const sent: TransportFrame[] = []; + const runtime = await createAgentRuntime({ + stateDir, + serversDir, + fetch: fetchImpl, + logger: createLogger({ level: "error", stdout: () => {}, stderr: () => {} }), + now: () => now, + webSocketFactory: () => { + const socket = { + readyState: 1, + onopen: null as (() => void) | null, + onmessage: null as ((ev: { readonly data: unknown }) => void) | null, + onclose: null as + | ((ev: { readonly code?: number; readonly reason?: string }) => void) + | null, + onerror: null as ((ev: unknown) => void) | null, + send(data: string) { + sent.push(JSON.parse(data) as TransportFrame); + }, + close() { + socket.readyState = 3; + }, + }; + queueMicrotask(() => socket.onopen?.()); + return socket; + }, + }); + runtime.start(); + await Promise.resolve(); + + const registry = createCoreRegistry(); + let accCounter = 1; + let sessCounter = 1; + + async function send(type: string, body: unknown, useSession: boolean) { + const start = sent.length; + const signed = createSignedCommand( + { + type, + body, + agentPublicKey: agent.publicKey, + signer: useSession ? sessionKey : account, + ...(useSession ? { session: sessionCert } : {}), + counter: useSession ? sessCounter++ : accCounter++, + now, + }, + registry, + ); + await runtime.queue.enqueue({ + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: agentId }, + body: signed, + }); + const slice = sent.slice(start); + const ack = slice.find( + (f): f is Extract => f.kind === "ack", + ); + const events = slice + .filter((f): f is Extract => f.kind === "event") + .map((f) => { + const opened = openAgentMessage(f.body, agent.publicKey, account); + return { type: opened.header.type, body: opened.body }; + }); + return { ack, events }; + } + + const exercised = new Set(); + try { + // Non-sensitive commands work with session key + const listRes = await send("server.mods.list", { server_id: "srv-rt" }, true); + exercised.add("server.mods.list"); + expect(listRes.ack?.body.ok).toBe(true); + + const installRes = await send( + "server.mods.install", + { + server_id: "srv-rt", + file: "m.jar", + url: "https://cdn.modrinth.com/m.jar", + source: "modrinth", + sha256: sha256Hex(modBytes), + }, + true, + ); + exercised.add("server.mods.install"); + expect(installRes.ack?.body.ok).toBe(true); + + const removeRes = await send( + "server.mods.remove", + { server_id: "srv-rt", file: "m.jar" }, + true, + ); + exercised.add("server.mods.remove"); + expect(removeRes.ack?.body.ok).toBe(true); + + const planRes = await send( + "server.origin.plan", + { + server_id: "srv-rt", + to_version_id: "1.0.0", + modpack_id: "pack-rt", + source: "tegra", + mods: [], + }, + true, + ); + exercised.add("server.origin.plan"); + expect(planRes.ack?.body.ok).toBe(true); + const planId = (planRes.events[0]?.body as { plan_id?: string } | undefined)?.plan_id; + expect(planId).toBeDefined(); + if (!planId) throw new Error("Missing plan_id"); + + // Sensitive: server.origin.apply rejects session key, accepts account key + const applySession = await send( + "server.origin.apply", + { server_id: "srv-rt", plan_id: planId }, + true, + ); + expect(applySession.ack?.body.ok).toBe(false); + if (applySession.ack && !applySession.ack.body.ok) { + expect(applySession.ack.body.code).toBe("sensitive_requires_account_key"); + } + + const applyAccount = await send( + "server.origin.apply", + { server_id: "srv-rt", plan_id: planId }, + false, + ); + exercised.add("server.origin.apply"); + expect(applyAccount.ack?.body.ok).toBe(true); + + // Non-sensitive: server.origin.unlink works with session key + const unlinkRes = await send("server.origin.unlink", { server_id: "srv-rt" }, true); + exercised.add("server.origin.unlink"); + expect(unlinkRes.ack?.body.ok).toBe(true); + + // Sensitive: server.deploy.serverpack rejects session key, accepts account key + const deploySession = await send( + "server.deploy.serverpack", + { + server_id: "srv-rt", + url: "https://cdn.tegra.gg/pack.zip", + sha256: sha256Hex(packZip), + }, + true, + ); + expect(deploySession.ack?.body.ok).toBe(false); + if (deploySession.ack && !deploySession.ack.body.ok) { + expect(deploySession.ack.body.code).toBe("sensitive_requires_account_key"); + } + + const deployAccount = await send( + "server.deploy.serverpack", + { + server_id: "srv-rt", + url: "https://cdn.tegra.gg/pack.zip", + sha256: sha256Hex(packZip), + }, + false, + ); + exercised.add("server.deploy.serverpack"); + expect(deployAccount.ack?.body.ok).toBe(true); + + // Verify 100% coverage of STATE_COMMANDS + expect([...exercised].sort()).toEqual(STATE_COMMANDS.map((c) => c.type).sort()); + } finally { + await runtime.shutdown(1000); + } + }); +}); diff --git a/src/state/sync-plan.test.ts b/src/state/sync-plan.test.ts new file mode 100644 index 0000000..4994d4b --- /dev/null +++ b/src/state/sync-plan.test.ts @@ -0,0 +1,205 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { describe, expect, test } from "bun:test"; +import { + buildOriginSyncChanges, + emptyOriginSyncState, + isClientOnly, + isRedistributionRestricted, + isServerContentPath, + modIdentityKey, + nextOriginSyncState, + type PlanMod, + redistributionFromModrinthLicense, + shouldCopyOnCreate, + worldArchivePath, +} from "./sync-plan"; + +const both = { client: "required", server: "required" } as const; +const clientOnly = { client: "required", server: "unsupported" } as const; + +function mod(key: string, sha1: string, overrides: Partial = {}): PlanMod { + return { + key, + filename: `${key}.jar`, + enabled: true, + name: key, + sha1, + environment: both, + ...overrides, + }; +} + +describe("server pack paths", () => { + test("keeps server content and drops client and internal data", () => { + expect(isServerContentPath("config/create.toml")).toBe(true); + expect(isServerContentPath("kubejs/server_scripts/a.js")).toBe(true); + expect(isServerContentPath("server.properties")).toBe(true); + expect(isServerContentPath("options.txt")).toBe(false); + expect(isServerContentPath("resourcepacks/pack.zip")).toBe(false); + expect(isServerContentPath("saves/World/level.dat")).toBe(false); + expect(isServerContentPath("mods/a.jar")).toBe(false); + expect(isServerContentPath(".tegra/state.json")).toBe(false); + expect(isServerContentPath(".runtime/run.pid")).toBe(false); + expect(isServerContentPath("tegrad-server.json")).toBe(false); + expect(isServerContentPath("latest.log")).toBe(false); + expect(isServerContentPath("hs_err_pid123.log")).toBe(false); + }); + + test("copies saves only when asked", () => { + expect(shouldCopyOnCreate("saves/World/level.dat", false)).toBe(false); + expect(shouldCopyOnCreate("saves/World/level.dat", true)).toBe(true); + expect(shouldCopyOnCreate("mods/a.jar", false)).toBe(true); + expect(shouldCopyOnCreate("screenshots/a.png", true)).toBe(false); + }); + + test("maps a singleplayer world to the server world folder", () => { + expect(worldArchivePath("My World", "saves/My World/region/r.0.0.mca")).toBe( + "world/region/r.0.0.mca", + ); + expect(worldArchivePath("My World", "saves/Other/level.dat")).toBeNull(); + }); +}); + +describe("mod identity and licenses", () => { + test("prefers provider id, then name, then filename", () => { + expect( + modIdentityKey({ filename: "a.jar", modInfo: { modId: "AANobbMI", name: "Sodium" } }), + ).toBe("id:aanobbmi"); + expect(modIdentityKey({ filename: "a.jar", modInfo: { name: "Sodium" } })).toBe("name:sodium"); + expect(modIdentityKey({ filename: "Sodium-1.0.jar.disabled" })).toBe("file:sodium-1.0.jar"); + }); + + test("treats all rights reserved as restricted and custom licenses as unknown", () => { + expect(redistributionFromModrinthLicense("MIT").allowed).toBe(true); + expect(isRedistributionRestricted(redistributionFromModrinthLicense("MIT"))).toBe(false); + expect(redistributionFromModrinthLicense("LicenseRef-All-Rights-Reserved").allowed).toBe(false); + expect( + isRedistributionRestricted( + redistributionFromModrinthLicense("LicenseRef-All-Rights-Reserved"), + ), + ).toBe(true); + expect(redistributionFromModrinthLicense("LicenseRef-Custom").allowed).toBeNull(); + expect(redistributionFromModrinthLicense(undefined).allowed).toBeNull(); + }); + + test("detects client-only environment", () => { + expect(isClientOnly(clientOnly)).toBe(true); + expect(isClientOnly(both)).toBe(false); + expect(isClientOnly(null)).toBe(false); + }); +}); + +describe("origin 3-way sync diff", () => { + test("adds new mods, updates changed ones, removes dropped origin mods, and preserves user mods", () => { + const state = { ...emptyOriginSyncState(), synced_mod_keys: ["a", "b", "gone"] }; + const changes = buildOriginSyncChanges({ + sourceMods: [mod("a", "1"), mod("b", "2-new"), mod("c", "3")], + targetMods: [mod("a", "1"), mod("b", "2-old"), mod("gone", "4"), mod("essentials", "5")], + sourceFiles: [], + targetFiles: [], + state, + }); + expect(changes.mods.map((change) => [change.key, change.kind])).toEqual([ + ["b", "updated"], + ["c", "added"], + ["gone", "removed"], + ]); + }); + + test("never brings back mods the user excluded or removed locally", () => { + const state = { + ...emptyOriginSyncState(), + excluded_mod_keys: ["rejected"], + synced_mod_keys: ["deleted"], + }; + const changes = buildOriginSyncChanges({ + sourceMods: [mod("rejected", "1"), mod("deleted", "2")], + targetMods: [], + sourceFiles: [], + targetFiles: [], + state, + }); + expect(changes.mods).toMatchObject([ + { key: "deleted", excluded_reason: "removed_locally", selected_by_default: false }, + { key: "rejected", excluded_reason: "excluded", selected_by_default: false }, + ]); + }); + + test("flags client-only additions and ignores disabled source mods", () => { + const changes = buildOriginSyncChanges({ + sourceMods: [ + mod("sodium", "1", { environment: clientOnly }), + mod("off", "2", { enabled: false }), + ], + targetMods: [], + sourceFiles: [], + targetFiles: [], + state: emptyOriginSyncState(), + }); + expect(changes.mods).toMatchObject([ + { key: "sodium", client_only: true, selected_by_default: true }, + ]); + }); + + test("lists added, changed, and removed config files while preserving local removals and user files", () => { + const state = { + ...emptyOriginSyncState(), + synced_files: ["config/a.toml", "config/b.toml", "config/dropped.toml"], + removed_origin_files: ["config/user-deleted.toml"], + }; + const changes = buildOriginSyncChanges({ + sourceMods: [], + targetMods: [], + sourceFiles: [ + { path: "config/a.toml", sha1: "1", size_bytes: 1 }, + { path: "config/b.toml", sha1: "2", size_bytes: 1 }, + { path: "config/c.toml", sha1: "3", size_bytes: 1 }, + { path: "config/user-deleted.toml", sha1: "4", size_bytes: 1 }, + ], + targetFiles: [ + { path: "config/a.toml", sha1: "1", size_bytes: 1 }, + { path: "config/b.toml", sha1: "x", size_bytes: 1 }, + { path: "config/dropped.toml", sha1: "5", size_bytes: 1 }, + { path: "config/user-added.toml", sha1: "6", size_bytes: 1 }, + ], + state, + }); + expect(changes.files).toEqual([ + { path: "config/b.toml", kind: "changed", size_bytes: 1, selected_by_default: true }, + { path: "config/c.toml", kind: "added", size_bytes: 1, selected_by_default: true }, + { path: "config/dropped.toml", kind: "removed", size_bytes: 1, selected_by_default: true }, + { + path: "config/user-deleted.toml", + kind: "added", + size_bytes: 1, + excluded_reason: "removed_locally", + selected_by_default: false, + }, + ]); + }); + + test("records rejected additions and re-included mods in the next state", () => { + const state = { ...emptyOriginSyncState(), excluded_mod_keys: ["back"] }; + const sourceMods = [mod("new", "1"), mod("back", "2")]; + const changes = buildOriginSyncChanges({ + sourceMods, + targetMods: [], + sourceFiles: [], + targetFiles: [], + state, + }); + const next = nextOriginSyncState({ + state, + modChanges: changes.mods, + selectedModKeys: new Set(["back"]), + sourceMods, + versionId: "v2", + nowIso: "2026-09-27T00:00:00.000Z", + }); + expect(next.excluded_mod_keys).toEqual(["new"]); + expect(next.synced_mod_keys).toEqual(["back", "new"]); + expect(next.last_synced_version_id).toBe("v2"); + }); +}); diff --git a/src/state/sync-plan.ts b/src/state/sync-plan.ts new file mode 100644 index 0000000..8b5c6ed --- /dev/null +++ b/src/state/sync-plan.ts @@ -0,0 +1,405 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import type { ModEnvironmentInfo, ServerOriginSyncState } from "../protocol"; + +export const SERVER_PACK_MANIFEST_FILE = "tegra.manifest.json"; +export const SERVER_PACK_WORLD_DIR = "world"; + +const CLIENT_ONLY_ROOT_DIRS = new Set([ + "mods", + "saves", + "resourcepacks", + "shaderpacks", + "screenshots", + "logs", + "crash-reports", + "backups", + "downloads", + "debug", + "journeymap", + "xaero", + "xaeroworldmap", + "xaerowaypoints", + ".tegra", + ".fabric", + ".mixin.out", + ".cache", + ".runtime", + ".tegrad-uploads", +]); + +const CLIENT_ONLY_ROOT_FILES = new Set([ + "options.txt", + "optionsof.txt", + "optionsshaders.txt", + "servers.dat", + "servers.dat_old", + "usercache.json", + "usernamecache.json", + "realms_persistence.json", + "command_history.txt", + "mods-manifest.json", + "modpack.json", + "tegrad-server.json", + "start.sh", +]); + +const CREATE_COPY_EXCLUDED_DIRS = new Set([ + "resourcepacks", + "shaderpacks", + "screenshots", + "logs", + "crash-reports", + "backups", + "debug", + ".tegra", + ".fabric", + ".mixin.out", + ".cache", + ".runtime", + ".tegrad-uploads", +]); + +export function normalizeRelativePath(filePath: string): string { + return filePath.replace(/\\/g, "/").replace(/^\/+/, ""); +} + +function rootSegment(relativePath: string): string { + return (normalizeRelativePath(relativePath).split("/")[0] ?? "").toLowerCase(); +} + +export function isServerContentPath(relativePath: string): boolean { + const normalized = normalizeRelativePath(relativePath); + if (!normalized) { + return false; + } + const segments = normalized.split("/"); + const root = (segments[0] ?? "").toLowerCase(); + if (segments.length === 1) { + if (CLIENT_ONLY_ROOT_FILES.has(root)) { + return false; + } + if (root.endsWith(".log") || root.startsWith("hs_err")) { + return false; + } + return true; + } + return !CLIENT_ONLY_ROOT_DIRS.has(root); +} + +export function shouldCopyOnCreate(relativePath: string, includeSaves: boolean): boolean { + const root = rootSegment(relativePath); + if (!root) { + return true; + } + if (root === "saves") { + return includeSaves; + } + return !CREATE_COPY_EXCLUDED_DIRS.has(root); +} + +export function worldArchivePath(worldName: string, relativePath: string): string | null { + const normalized = normalizeRelativePath(relativePath); + const prefix = `saves/${worldName}/`; + if (!normalized.startsWith(prefix)) { + return null; + } + const rest = normalized.slice(prefix.length); + return rest ? `${SERVER_PACK_WORLD_DIR}/${rest}` : null; +} + +export function stripDisabledSuffix(filename: string): string { + return filename.replace(/\.disabled$/i, ""); +} + +export interface ModIdentitySource { + readonly filename: string; + readonly modInfo?: { readonly modId?: string; readonly name?: string } | null; +} + +export function modIdentityKey(entry: ModIdentitySource): string { + const modId = + typeof entry.modInfo?.modId === "string" ? entry.modInfo.modId.trim().toLowerCase() : ""; + if (modId) { + return `id:${modId}`; + } + const name = + typeof entry.modInfo?.name === "string" ? entry.modInfo.name.trim().toLowerCase() : ""; + if (name) { + return `name:${name}`; + } + return `file:${stripDisabledSuffix(entry.filename).toLowerCase()}`; +} + +export interface ModRedistributionInfo { + readonly allowed: boolean | null; + readonly license?: string; +} + +export function isClientOnly(environment?: ModEnvironmentInfo | null): boolean { + return environment?.server === "unsupported"; +} + +export function isRedistributionRestricted(redistribution?: ModRedistributionInfo | null): boolean { + return redistribution?.allowed === false; +} + +export function redistributionFromModrinthLicense(licenseId: unknown): ModRedistributionInfo { + const id = typeof licenseId === "string" ? licenseId.trim() : ""; + if (!id) { + return { allowed: null }; + } + if (id === "LicenseRef-All-Rights-Reserved") { + return { allowed: false, license: id }; + } + if (id.startsWith("LicenseRef-")) { + return { allowed: null, license: id }; + } + return { allowed: true, license: id }; +} + +export interface PlanMod { + readonly key: string; + readonly filename: string; + readonly enabled: boolean; + readonly name: string; + readonly version?: string | undefined; + readonly sha1?: string | undefined; + readonly sha512?: string | undefined; + readonly environment?: ModEnvironmentInfo | undefined; +} + +export interface PlanFile { + readonly path: string; + readonly sha1: string; + readonly size_bytes: number; +} + +export type ModExcludedReason = "excluded" | "removed_locally"; + +export interface OriginModChange { + readonly key: string; + readonly name: string; + readonly kind: "added" | "updated" | "removed"; + readonly source_filename?: string; + readonly target_filename?: string; + readonly source_version?: string; + readonly target_version?: string; + readonly client_only: boolean; + readonly excluded_reason?: ModExcludedReason; + readonly selected_by_default: boolean; +} + +export interface OriginFileChange { + readonly path: string; + readonly kind: "added" | "changed" | "removed"; + readonly size_bytes: number; + readonly excluded_reason?: "removed_locally"; + readonly selected_by_default: boolean; +} + +export interface OriginSyncChanges { + readonly mods: readonly OriginModChange[]; + readonly files: readonly OriginFileChange[]; +} + +export function emptyOriginSyncState(): ServerOriginSyncState { + return { + excluded_mod_keys: [], + synced_mod_keys: [], + removed_origin_files: [], + synced_files: [], + last_synced_at: null, + last_synced_version_id: null, + }; +} + +function hasModContentChanged(source: PlanMod, target: PlanMod): boolean { + if (source.sha512 && target.sha512) { + return source.sha512.toLowerCase() !== target.sha512.toLowerCase(); + } + if (source.sha1 && target.sha1) { + return source.sha1.toLowerCase() !== target.sha1.toLowerCase(); + } + if (source.version && target.version) { + return source.version !== target.version; + } + return false; +} + +export function buildOriginSyncChanges(input: { + readonly sourceMods: readonly PlanMod[]; + readonly targetMods: readonly PlanMod[]; + readonly sourceFiles: readonly PlanFile[]; + readonly targetFiles: readonly PlanFile[]; + readonly state: ServerOriginSyncState; +}): OriginSyncChanges { + const sourceMods = input.sourceMods.filter((mod) => mod.enabled); + const sourceByKey = new Map(sourceMods.map((mod) => [mod.key, mod])); + const targetByKey = new Map(input.targetMods.map((mod) => [mod.key, mod])); + const explicitExcluded = new Set(input.state.excluded_mod_keys); + const synced = new Set(input.state.synced_mod_keys); + const removedOriginFiles = new Set( + (input.state.removed_origin_files ?? []).map(normalizeRelativePath), + ); + const syncedFiles = new Set((input.state.synced_files ?? []).map(normalizeRelativePath)); + + const mods: OriginModChange[] = []; + for (const source of sourceMods) { + const target = targetByKey.get(source.key); + const clientOnly = isClientOnly(source.environment); + if (!target) { + const excludedReason: ModExcludedReason | undefined = explicitExcluded.has(source.key) + ? "excluded" + : synced.has(source.key) + ? "removed_locally" + : undefined; + mods.push({ + key: source.key, + name: source.name, + kind: "added", + source_filename: source.filename, + ...(source.version !== undefined ? { source_version: source.version } : {}), + client_only: clientOnly, + ...(excludedReason !== undefined ? { excluded_reason: excludedReason } : {}), + selected_by_default: excludedReason === undefined, + }); + continue; + } + + if (hasModContentChanged(source, target)) { + mods.push({ + key: source.key, + name: source.name, + kind: "updated", + source_filename: source.filename, + target_filename: target.filename, + ...(source.version !== undefined ? { source_version: source.version } : {}), + ...(target.version !== undefined ? { target_version: target.version } : {}), + client_only: clientOnly, + selected_by_default: true, + }); + } + } + + for (const target of input.targetMods) { + if (sourceByKey.has(target.key) || !synced.has(target.key)) { + continue; + } + mods.push({ + key: target.key, + name: target.name, + kind: "removed", + target_filename: target.filename, + ...(target.version !== undefined ? { target_version: target.version } : {}), + client_only: isClientOnly(target.environment), + selected_by_default: true, + }); + } + + const sourceFilesByPath = new Map( + input.sourceFiles.map((file) => [normalizeRelativePath(file.path), file]), + ); + const targetFilesByPath = new Map( + input.targetFiles.map((file) => [normalizeRelativePath(file.path), file]), + ); + + const files: OriginFileChange[] = []; + for (const [normPath, source] of sourceFilesByPath) { + const target = targetFilesByPath.get(normPath); + if (!target) { + const wasRemovedLocally = removedOriginFiles.has(normPath) || syncedFiles.has(normPath); + files.push({ + path: normPath, + kind: "added", + size_bytes: source.size_bytes, + ...(wasRemovedLocally ? { excluded_reason: "removed_locally" as const } : {}), + selected_by_default: !wasRemovedLocally, + }); + } else if (target.sha1.toLowerCase() !== source.sha1.toLowerCase()) { + files.push({ + path: normPath, + kind: "changed", + size_bytes: source.size_bytes, + selected_by_default: true, + }); + } + } + + for (const [normPath, target] of targetFilesByPath) { + if (sourceFilesByPath.has(normPath) || !syncedFiles.has(normPath)) { + continue; + } + files.push({ + path: normPath, + kind: "removed", + size_bytes: target.size_bytes, + selected_by_default: true, + }); + } + + const byLabel = (a: { name?: string; path?: string }, b: { name?: string; path?: string }) => + String(a.name ?? a.path).localeCompare(String(b.name ?? b.path), undefined, { + sensitivity: "base", + }); + + return { + mods: mods.sort(byLabel), + files: files.sort(byLabel), + }; +} + +export function nextOriginSyncState(input: { + readonly state: ServerOriginSyncState; + readonly modChanges: readonly OriginModChange[]; + readonly fileChanges?: readonly OriginFileChange[]; + readonly selectedModKeys: ReadonlySet; + readonly selectedFilePaths?: ReadonlySet; + readonly sourceMods: readonly PlanMod[]; + readonly sourceFiles?: readonly PlanFile[]; + readonly versionId: string; + readonly nowIso: string; +}): ServerOriginSyncState { + const excluded = new Set(input.state.excluded_mod_keys); + for (const change of input.modChanges) { + if (change.kind !== "added") { + continue; + } + if (input.selectedModKeys.has(change.key)) { + excluded.delete(change.key); + } else if (change.excluded_reason === undefined) { + excluded.add(change.key); + } + } + + const removedFiles = new Set((input.state.removed_origin_files ?? []).map(normalizeRelativePath)); + const selectedFiles = input.selectedFilePaths ?? new Set(); + for (const change of input.fileChanges ?? []) { + if (change.kind !== "added") { + continue; + } + if (selectedFiles.has(change.path)) { + removedFiles.delete(change.path); + } else { + removedFiles.add(change.path); + } + } + + const syncedModKeys = [ + ...new Set(input.sourceMods.filter((mod) => mod.enabled).map((mod) => mod.key)), + ].sort(); + + const syncedFiles = [ + ...new Set((input.sourceFiles ?? []).map((f) => normalizeRelativePath(f.path))), + ].sort(); + + return { + excluded_mod_keys: [...excluded].sort(), + synced_mod_keys: syncedModKeys, + removed_origin_files: [...removedFiles].sort(), + synced_files: syncedFiles, + last_synced_at: input.nowIso, + last_synced_version_id: input.versionId, + }; +} From bf153571fd29c7489ca2df1d39269de8b92314f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 22 Nov 2026 20:49:20 -0300 Subject: [PATCH 16/59] feat: add backup destinations, world consistency, and protocol commands --- .github/workflows/ci.yml | 3 +- install/install.sh | 5 + install/units/tegrad.service | 2 +- src/backup/archive.ts | 385 +++++++++++ src/backup/backup.test.ts | 922 +++++++++++++++++++++++++ src/backup/config.ts | 369 ++++++++++ src/backup/destinations/local.ts | 234 +++++++ src/backup/destinations/s3.ts | 206 ++++++ src/backup/destinations/tegra-cloud.ts | 303 ++++++++ src/backup/index.ts | 75 ++ src/backup/manager.ts | 535 ++++++++++++++ src/backup/scheduler.ts | 110 +++ src/backup/types.ts | 141 ++++ src/install/units.test.ts | 26 + src/protocol/commands/backup.ts | 173 +++++ src/protocol/commands/core.ts | 9 +- src/protocol/errors.ts | 5 +- src/protocol/index.ts | 35 + 18 files changed, 3532 insertions(+), 6 deletions(-) create mode 100644 src/backup/archive.ts create mode 100644 src/backup/backup.test.ts create mode 100644 src/backup/config.ts create mode 100644 src/backup/destinations/local.ts create mode 100644 src/backup/destinations/s3.ts create mode 100644 src/backup/destinations/tegra-cloud.ts create mode 100644 src/backup/index.ts create mode 100644 src/backup/manager.ts create mode 100644 src/backup/scheduler.ts create mode 100644 src/backup/types.ts create mode 100644 src/protocol/commands/backup.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f957e5..2a13ac0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: sudo useradd --system --gid tegrad --home-dir /var/lib/tegrad --no-create-home --shell /usr/sbin/nologin tegrad sudo usermod -aG tegrad-srv tegrad sudo install -d -o root -g root -m 0755 /opt/tegrad/bin - sudo install -d -o tegrad -g tegrad -m 0700 /var/lib/tegrad /var/lib/tegrad/update + sudo install -d -o tegrad -g tegrad -m 0700 /var/lib/tegrad /var/lib/tegrad/update /var/lib/tegrad-backups sudo install -d -o tegrad-srv -g tegrad-srv -m 2770 /var/lib/tegrad-servers /var/lib/tegrad-servers/test sudo install -d -o root -g tegrad -m 0750 /run/tegrad-server printf '#!/bin/sh\nexit 0\n' | sudo tee /opt/tegrad/bin/tegrad /var/lib/tegrad-servers/test/start.sh >/dev/null @@ -45,6 +45,7 @@ jobs: -e 's|@TEGRAD_BIN@|/opt/tegrad/bin/tegrad|g' \ -e 's|@TEGRAD_STATE_DIR@|/var/lib/tegrad|g' \ -e 's|@TEGRAD_SERVERS_DIR@|/var/lib/tegrad-servers|g' \ + -e 's|@TEGRAD_BACKUPS_DIR@|/var/lib/tegrad-backups|g' \ -e 's|@TEGRAD_RUN_DIR@|/run/tegrad-server|g' \ "install/units/${unit}" > "${tmp_dir}/${unit}" done diff --git a/install/install.sh b/install/install.sh index 5e86997..2041dce 100755 --- a/install/install.sh +++ b/install/install.sh @@ -17,6 +17,7 @@ TEGRAD_WRAPPER="/usr/local/bin/tegrad" TEGRAD_STATE_DIR="/var/lib/tegrad" TEGRAD_CONFIG_FILE="/var/lib/tegrad/config.json" TEGRAD_SERVERS_DIR="/var/lib/tegrad-servers" +TEGRAD_BACKUPS_DIR="/var/lib/tegrad-backups" TEGRAD_RUN_DIR="/run/tegrad-server" SYSTEMD_DIR="/etc/systemd/system" @@ -677,6 +678,7 @@ render_template_file() { -e "s|@TEGRAD_BIN@|${TEGRAD_BIN}|g" \ -e "s|@TEGRAD_STATE_DIR@|${TEGRAD_STATE_DIR}|g" \ -e "s|@TEGRAD_SERVERS_DIR@|${TEGRAD_SERVERS_DIR}|g" \ + -e "s|@TEGRAD_BACKUPS_DIR@|${TEGRAD_BACKUPS_DIR}|g" \ -e "s|@TEGRAD_RUN_DIR@|${TEGRAD_RUN_DIR}|g" \ "$_rt_src" > "$_rt_tmp" @@ -738,6 +740,8 @@ ensure_directories() { install -d -o "$TEGRAD_USER" -g "$TEGRAD_GROUP" -m 0700 "${TEGRAD_STATE_DIR}/update" install -d -o "$TEGRAD_SRV_USER" -g "$TEGRAD_SRV_GROUP" -m 2770 "$TEGRAD_SERVERS_DIR" chmod 2770 "$TEGRAD_SERVERS_DIR" + install -d -o "$TEGRAD_USER" -g "$TEGRAD_GROUP" -m 0700 "$TEGRAD_BACKUPS_DIR" + chmod 0700 "$TEGRAD_BACKUPS_DIR" install -d -o root -g root -m 0755 "$DROPIN_DIR" install -d -o root -g root -m 0755 "$POLKIT_RULES_DIR" } @@ -831,6 +835,7 @@ do_uninstall() { log_info "Purging data directories and system users..." rm -rf -- "${TEGRAD_STATE_DIR:?}" rm -rf -- "${TEGRAD_SERVERS_DIR:?}" + rm -rf -- "${TEGRAD_BACKUPS_DIR:?}" rm -rf -- "${TEGRAD_RUN_DIR:?}" if id -u "$TEGRAD_USER" >/dev/null 2>&1; then userdel "$TEGRAD_USER" 2>/dev/null || true diff --git a/install/units/tegrad.service b/install/units/tegrad.service index d4f0168..7115edd 100644 --- a/install/units/tegrad.service +++ b/install/units/tegrad.service @@ -23,7 +23,7 @@ RestartMaxDelaySec=60 # (/run/dbus/system_bus_socket) to manage tegrad-server@ units under polkit rules. NoNewPrivileges=yes ProtectSystem=strict -ReadWritePaths=@TEGRAD_STATE_DIR@ @TEGRAD_SERVERS_DIR@ @TEGRAD_RUN_DIR@ +ReadWritePaths=@TEGRAD_STATE_DIR@ @TEGRAD_SERVERS_DIR@ @TEGRAD_RUN_DIR@ @TEGRAD_BACKUPS_DIR@ ProtectHome=yes PrivateTmp=yes PrivateDevices=yes diff --git a/src/backup/archive.ts b/src/backup/archive.ts new file mode 100644 index 0000000..bfd3bfb --- /dev/null +++ b/src/backup/archive.ts @@ -0,0 +1,385 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { + closeSync, + constants, + existsSync, + lstatSync, + openSync, + readdirSync, + readSync, + type Stats, + statSync, +} from "node:fs"; +import { join } from "node:path"; +import type { Logger } from "../agent/logger"; +import { + createZipBuffer, + DEFAULT_SERVERS_BASE_DIR, + MAX_ZIP_CREATE_BYTES, + MAX_ZIP_CREATE_FILES, + openConfinedFileForRead, + RUNTIME_DIR_NAME, + resolveConfinedPath, + resolveServerRoot, + type SafeUnzipResult, + safeUnzipBuffer, + sha256Hex, + UPLOAD_STAGING_DIR_NAME, + UPLOAD_STAGING_FILE_PREFIX, + validateServerId, + type ZipEntryInput, +} from "../files"; +import { ProtocolError } from "../protocol"; +import type { ServerRuntimeProvider } from "./types"; + +export const DEFAULT_SAVE_TIMEOUT_MS = 30_000; +export const DEFAULT_SAVE_POLL_INTERVAL_MS = 100; + +const SAVE_CONFIRMATION_PATTERN = /Saved the (?:game|world)/i; + +function readAllFromFd(fd: number, maxBytes: number): Uint8Array { + const chunks: Uint8Array[] = []; + let total = 0; + const scratch = Buffer.allocUnsafe(64 * 1024); + + while (true) { + const toRead = Math.min(scratch.byteLength, maxBytes - total + 1); + const bytesRead = readSync(fd, scratch, 0, toRead, null); + if (bytesRead === 0) { + break; + } + total += bytesRead; + if (total > maxBytes) { + throw new ProtocolError("backup_failed", "Server archive exceeds maximum allowed size"); + } + const copy = new Uint8Array(bytesRead); + copy.set(scratch.subarray(0, bytesRead)); + chunks.push(copy); + } + + const out = new Uint8Array(total); + let pos = 0; + for (const chunk of chunks) { + out.set(chunk, pos); + pos += chunk.byteLength; + } + return out; +} + +function getConsoleLogSize(logPath: string): number { + const lstat = lstatSync(logPath, { throwIfNoEntry: false }); + if (lstat === undefined || lstat.isSymbolicLink() || !lstat.isFile()) { + return 0; + } + return statSync(logPath).size; +} + +function readLogTailText( + logPath: string, + fromOffset: number, +): { + readonly text: string; + readonly nextOffset: number; +} { + const lstat = lstatSync(logPath, { throwIfNoEntry: false }); + if (lstat === undefined || lstat.isSymbolicLink() || !lstat.isFile()) { + return { text: "", nextOffset: fromOffset }; + } + + const size = statSync(logPath).size; + const effectiveOffset = size < fromOffset ? 0 : fromOffset; + const available = size - effectiveOffset; + if (available <= 0) { + return { text: "", nextOffset: effectiveOffset }; + } + + const toRead = Math.min(available, 256 * 1024); + const buf = Buffer.allocUnsafe(toRead); + const openFlags = constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0); + let fd: number | undefined; + try { + fd = openSync(logPath, openFlags); + const bytesRead = readSync(fd, buf, 0, toRead, effectiveOffset); + if (bytesRead <= 0) { + return { text: "", nextOffset: effectiveOffset }; + } + return { + text: buf.subarray(0, bytesRead).toString("utf8"), + nextOffset: effectiveOffset + bytesRead, + }; + } catch { + return { text: "", nextOffset: effectiveOffset }; + } finally { + if (fd !== undefined) { + try { + closeSync(fd); + } catch { + // ignore close failure + } + } + } +} + +export interface WaitForSaveOptions { + readonly logPath: string; + readonly startOffset: number; + readonly timeoutMs: number; + readonly pollIntervalMs: number; + readonly now: () => number; + readonly sleep: (ms: number) => Promise; +} + +export async function waitForSaveConfirmation(options: WaitForSaveOptions): Promise { + const deadline = options.now() + options.timeoutMs; + let offset = options.startOffset; + let buffer = ""; + + while (true) { + const chunk = readLogTailText(options.logPath, offset); + offset = chunk.nextOffset; + if (chunk.text.length > 0) { + buffer += chunk.text; + if (SAVE_CONFIRMATION_PATTERN.test(buffer)) { + return; + } + // Keep only the last 4 KiB to avoid unbounded memory growth on noisy logs. + if (buffer.length > 4096) { + buffer = buffer.slice(buffer.length - 4096); + } + } + + if (options.now() >= deadline) { + throw new ProtocolError( + "backup_failed", + `Timed out waiting for Minecraft server save confirmation after ${options.timeoutMs}ms`, + ); + } + + const remaining = Math.max(1, Math.min(options.pollIntervalMs, deadline - options.now())); + await options.sleep(remaining); + } +} + +export interface ArchiveServerDirectoryOptions { + readonly serversBaseDir?: string; + readonly serverId: string; + readonly maxFiles?: number; + readonly maxTotalBytes?: number; + readonly logger?: Logger; +} + +export interface ServerArchiveResult { + readonly buffer: Uint8Array; + readonly sha256: string; + readonly entryCount: number; + readonly uncompressedBytes: number; +} + +export function archiveServerDirectory( + options: ArchiveServerDirectoryOptions, +): ServerArchiveResult { + const serversBaseDir = options.serversBaseDir ?? DEFAULT_SERVERS_BASE_DIR; + const validId = validateServerId(options.serverId); + const maxFiles = options.maxFiles ?? MAX_ZIP_CREATE_FILES; + const maxTotalBytes = options.maxTotalBytes ?? MAX_ZIP_CREATE_BYTES; + + const { realServerRoot } = resolveServerRoot(validId, serversBaseDir); + if (!existsSync(realServerRoot)) { + throw new ProtocolError("server_not_found", `Server directory not found: ${validId}`); + } + + const entries: ZipEntryInput[] = []; + let totalUncompressed = 0; + + function walkDir(relDir: string): void { + const resolvedDir = resolveConfinedPath({ + serversBaseDir, + serverId: validId, + relPath: relDir, + allowRoot: true, + }); + + const children = readdirSync(resolvedDir.fullPath).sort(); + for (const child of children) { + if ( + child === RUNTIME_DIR_NAME || + child === UPLOAD_STAGING_DIR_NAME || + child.startsWith(UPLOAD_STAGING_FILE_PREFIX) || + child.startsWith(".tmp-") + ) { + continue; + } + + const childRel = relDir.length > 0 ? `${relDir}/${child}` : child; + const childFull = join(resolvedDir.fullPath, child); + const stats: Stats = lstatSync(childFull); + + if (stats.isSymbolicLink()) { + options.logger?.warn("Skipping symbolic link while archiving server backup", { + serverId: validId, + path: childRel, + }); + continue; + } + + if (stats.isDirectory()) { + if (entries.length >= maxFiles) { + throw new ProtocolError("backup_failed", "Backup archive entry count limit exceeded"); + } + entries.push({ + name: `${childRel}/`, + data: new Uint8Array(0), + isDirectory: true, + mtime: stats.mtime, + }); + walkDir(childRel); + continue; + } + + if (!stats.isFile()) { + continue; + } + + if (entries.length >= maxFiles) { + throw new ProtocolError("backup_failed", "Backup archive entry count limit exceeded"); + } + + const confinedFile = resolveConfinedPath({ + serversBaseDir, + serverId: validId, + relPath: childRel, + allowRoot: false, + }); + const { fd, stats: fdStats } = openConfinedFileForRead(confinedFile); + let data: Uint8Array; + try { + if (totalUncompressed + fdStats.size > maxTotalBytes) { + throw new ProtocolError("backup_failed", "Backup archive total size limit exceeded"); + } + data = readAllFromFd(fd, maxTotalBytes - totalUncompressed); + } finally { + closeSync(fd); + } + + totalUncompressed += data.byteLength; + entries.push({ + name: childRel, + data, + isDirectory: false, + mtime: fdStats.mtime, + }); + } + } + + walkDir(""); + + const buffer = createZipBuffer(entries); + const sha256 = sha256Hex(buffer); + + return { + buffer, + sha256, + entryCount: entries.length, + uncompressedBytes: totalUncompressed, + }; +} + +export interface CreateConsistentArchiveOptions { + readonly serversBaseDir?: string; + readonly serverId: string; + readonly runtime?: ServerRuntimeProvider; + readonly saveTimeoutMs?: number; + readonly savePollIntervalMs?: number; + readonly maxFiles?: number; + readonly maxTotalBytes?: number; + readonly now?: () => number; + readonly sleep?: (ms: number) => Promise; + readonly logger?: Logger; + readonly archiveImpl?: (options: ArchiveServerDirectoryOptions) => ServerArchiveResult; +} + +export async function createConsistentServerArchive( + options: CreateConsistentArchiveOptions, +): Promise { + const serversBaseDir = options.serversBaseDir ?? DEFAULT_SERVERS_BASE_DIR; + const validId = validateServerId(options.serverId); + const saveTimeoutMs = options.saveTimeoutMs ?? DEFAULT_SAVE_TIMEOUT_MS; + const savePollIntervalMs = options.savePollIntervalMs ?? DEFAULT_SAVE_POLL_INTERVAL_MS; + const now = options.now ?? (() => Date.now()); + const sleep = options.sleep ?? ((ms: number) => new Promise((r) => setTimeout(r, ms))); + const archiveFn = options.archiveImpl ?? archiveServerDirectory; + + const isRunning = + options.runtime !== undefined ? await options.runtime.isRunning(validId) : false; + + if (!isRunning || options.runtime === undefined) { + return archiveFn({ + serversBaseDir, + serverId: validId, + ...(options.maxFiles !== undefined ? { maxFiles: options.maxFiles } : {}), + ...(options.maxTotalBytes !== undefined ? { maxTotalBytes: options.maxTotalBytes } : {}), + ...(options.logger !== undefined ? { logger: options.logger } : {}), + }); + } + + const { realServerRoot } = resolveServerRoot(validId, serversBaseDir); + const logPath = join(realServerRoot, "logs", "console.log"); + const startOffset = getConsoleLogSize(logPath); + + await options.runtime.sendConsole(validId, "save-off"); + try { + await options.runtime.sendConsole(validId, "save-all flush"); + await waitForSaveConfirmation({ + logPath, + startOffset, + timeoutMs: saveTimeoutMs, + pollIntervalMs: savePollIntervalMs, + now, + sleep, + }); + return archiveFn({ + serversBaseDir, + serverId: validId, + ...(options.maxFiles !== undefined ? { maxFiles: options.maxFiles } : {}), + ...(options.maxTotalBytes !== undefined ? { maxTotalBytes: options.maxTotalBytes } : {}), + ...(options.logger !== undefined ? { logger: options.logger } : {}), + }); + } finally { + try { + await options.runtime.sendConsole(validId, "save-on"); + } catch (err) { + options.logger?.error("Failed to re-enable saving (save-on) after backup", { + serverId: validId, + errName: err instanceof Error ? err.name : "Error", + }); + } + } +} + +export interface RestoreServerArchiveOptions { + readonly serversBaseDir?: string; + readonly serverId: string; + readonly archive: Uint8Array; + readonly maxEntries?: number; + readonly maxUncompressedBytes?: number; + readonly maxEntryBytes?: number; +} + +export function restoreServerArchive(options: RestoreServerArchiveOptions): SafeUnzipResult { + const serversBaseDir = options.serversBaseDir ?? DEFAULT_SERVERS_BASE_DIR; + const validId = validateServerId(options.serverId); + + return safeUnzipBuffer({ + serversBaseDir, + serverId: validId, + buffer: options.archive, + destPath: "", + ...(options.maxEntries !== undefined ? { maxEntries: options.maxEntries } : {}), + ...(options.maxUncompressedBytes !== undefined + ? { maxUncompressedBytes: options.maxUncompressedBytes } + : {}), + ...(options.maxEntryBytes !== undefined ? { maxEntryBytes: options.maxEntryBytes } : {}), + }); +} diff --git a/src/backup/backup.test.ts b/src/backup/backup.test.ts new file mode 100644 index 0000000..510a6b4 --- /dev/null +++ b/src/backup/backup.test.ts @@ -0,0 +1,922 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, describe, expect, test } from "bun:test"; +import { + appendFileSync, + chmodSync, + existsSync, + mkdirSync, + mkdtempSync, + readFileSync, + rmSync, + statSync, + writeFileSync, +} from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { createCommandQueue } from "../agent/jobs"; +import { createLogger } from "../agent/logger"; +import { generateSigningKeyPair, ready, toBase64Url } from "../crypto"; +import { createZipBuffer } from "../files"; +import { + createCoreRegistry, + createInMemoryTrustContext, + createSignedCommand, + openAgentMessage, + openCommand, + PROTOCOL_VERSION, + ProtocolError, + signSessionCertificate, + type TransportFrame, +} from "../protocol"; +import { + type BackupDestination, + type BackupMetadata, + type BackupTimerHandle, + type BackupTimerProvider, + createBackupHook, + createBackupManager, + registerBackupHandlers, + type ServerRuntimeProvider, +} from "./index"; + +const tempDirs: string[] = []; + +function makeTempDir(prefix: string): string { + const dir = mkdtempSync(join(tmpdir(), prefix)); + tempDirs.push(dir); + return dir; +} + +function createSampleServer( + serversDir: string, + serverId: string, + files: Readonly>, +): string { + const serverDir = join(serversDir, serverId); + mkdirSync(join(serverDir, "logs"), { recursive: true }); + for (const [relPath, content] of Object.entries(files)) { + const fullPath = join(serverDir, relPath); + mkdirSync(join(fullPath, ".."), { recursive: true }); + writeFileSync(fullPath, content, "utf8"); + } + return serverDir; +} + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir !== undefined) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +describe("Local backups, rotation, and independent destinations", () => { + test("creates local backups, rotates oldest beyond retention_count, and enforces 0700/0600 on POSIX", async () => { + const root = makeTempDir("tegrad-bkp-local-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + createSampleServer(serversDir, "survival", { + "world/level.dat": "level-v1", + "server.properties": "motd=Hello\n", + }); + + let clock = 1_700_000_000_000; + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + now: () => { + clock += 1000; + return clock; + }, + }); + + manager.setConfig({ + server_id: "survival", + local: { enabled: true, retention_count: 2 }, + }); + + const b1 = await manager.createBackup({ server_id: "survival", note: "first" }); + const b2 = await manager.createBackup({ server_id: "survival", note: "second" }); + const b3 = await manager.createBackup({ server_id: "survival", note: "third" }); + + expect(b1.destinations).toHaveLength(1); + expect(b1.destinations[0]?.ok).toBe(true); + expect(b3.destinations[0]?.ok).toBe(true); + + const listed = await manager.listBackups({ server_id: "survival" }); + expect(listed.errors).toEqual([]); + expect(listed.backups.map((b) => b.id)).toEqual([b3.backup_id, b2.backup_id]); + expect(existsSync(join(backupsDir, "survival", `${b1.backup_id}.zip`))).toBe(false); + + if (process.platform !== "win32") { + expect(statSync(backupsDir).mode & 0o777).toBe(0o700); + expect(statSync(join(backupsDir, "survival")).mode & 0o777).toBe(0o700); + expect(statSync(join(backupsDir, "survival", `${b3.backup_id}.zip`)).mode & 0o777).toBe( + 0o600, + ); + } + }); + + test("all destinations disabled is valid and succeeds cleanly", async () => { + const root = makeTempDir("tegrad-bkp-none-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + createSampleServer(serversDir, "creative", { "server.properties": "motd=Creative\n" }); + + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + }); + + const cfg = manager.setConfig({ + server_id: "creative", + local: { enabled: false }, + s3: { enabled: false }, + tegra_cloud: { enabled: false }, + }); + expect(cfg.local.enabled).toBe(false); + expect(cfg.s3.enabled).toBe(false); + expect(cfg.tegra_cloud.enabled).toBe(false); + + const created = await manager.createBackup({ server_id: "creative" }); + expect(created.destinations).toEqual([]); + expect(created.size_bytes).toBe(0); + + const listed = await manager.listBackups({ server_id: "creative" }); + expect(listed.backups).toEqual([]); + expect(listed.errors).toEqual([]); + }); + + test("failure of one destination does not abort or crash other destinations", async () => { + const root = makeTempDir("tegrad-bkp-iso-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + createSampleServer(serversDir, "smp", { "world/region.mca": "chunk-data" }); + + const uploadedToGood: string[] = []; + const failingDest: BackupDestination = { + kind: "s3", + isEnabled: () => true, + async upload() { + throw new Error("Simulated S3 outage"); + }, + async list() { + throw new Error("Simulated S3 list outage"); + }, + async download() { + throw new Error("Simulated S3 download outage"); + }, + async delete() { + throw new Error("Simulated S3 delete outage"); + }, + }; + + const goodDest: BackupDestination = { + kind: "local", + isEnabled: () => true, + async upload(archive, ctx): Promise { + uploadedToGood.push(ctx.backupId); + return { + id: ctx.backupId, + server_id: ctx.serverId, + created_at: ctx.createdAt, + size_bytes: archive.byteLength, + sha256: ctx.sha256, + trigger: ctx.trigger, + destination: "local", + }; + }, + async list(): Promise { + return []; + }, + async download() { + return new Uint8Array(0); + }, + async delete() {}, + }; + + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + destinations: [failingDest, goodDest], + }); + + const result = await manager.createBackup({ server_id: "smp" }); + expect(result.destinations).toHaveLength(2); + expect(result.destinations[0]).toMatchObject({ + destination: "s3", + ok: false, + error: "Simulated S3 outage", + }); + expect(result.destinations[1]).toMatchObject({ + destination: "local", + ok: true, + }); + expect(uploadedToGood).toEqual([result.backup_id]); + + const listed = await manager.listBackups({ server_id: "smp" }); + expect(listed.errors).toEqual([{ destination: "s3", error: "Simulated S3 list outage" }]); + }); +}); + +describe("World consistency (save-off / save-all flush / save-on)", () => { + test("sends save-off, save-all flush, waits for confirmation, archives, and sends save-on when running", async () => { + const root = makeTempDir("tegrad-bkp-running-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + const serverDir = createSampleServer(serversDir, "live", { + "world/level.dat": "world-bytes", + "logs/console.log": "[12:00:00] [Server thread/INFO]: Done!\n", + }); + + const sentLines: string[] = []; + const runtime: ServerRuntimeProvider = { + isRunning: async () => true, + sendConsole(_serverId, line) { + sentLines.push(line); + if (line === "save-all flush") { + appendFileSync( + join(serverDir, "logs", "console.log"), + "[12:00:01] [Server thread/INFO]: Saved the game\n", + ); + } + }, + }; + + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + runtime, + saveTimeoutMs: 500, + savePollIntervalMs: 5, + }); + + const res = await manager.createBackup({ server_id: "live" }); + expect(res.destinations[0]?.ok).toBe(true); + expect(sentLines).toEqual(["save-off", "save-all flush", "save-on"]); + }); + + test("ALWAYS sends save-on in finally even when waiting for save confirmation times out", async () => { + const root = makeTempDir("tegrad-bkp-timeout-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + createSampleServer(serversDir, "stuck", { + "world/level.dat": "world-bytes", + "logs/console.log": "[12:00:00] [Server thread/INFO]: Running...\n", + }); + + const sentLines: string[] = []; + let clock = 1000; + const runtime: ServerRuntimeProvider = { + isRunning: async () => true, + sendConsole(_serverId, line) { + sentLines.push(line); + }, + }; + + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + runtime, + saveTimeoutMs: 50, + savePollIntervalMs: 10, + now: () => clock, + sleep: async (ms) => { + clock += ms; + }, + }); + + await expect(manager.createBackup({ server_id: "stuck" })).rejects.toThrow( + /Timed out waiting for Minecraft server save confirmation/, + ); + expect(sentLines).toEqual(["save-off", "save-all flush", "save-on"]); + }); + + test("ALWAYS sends save-on in finally even when archiving throws", async () => { + const root = makeTempDir("tegrad-bkp-archfail-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + const serverDir = createSampleServer(serversDir, "errsrv", { + "logs/console.log": "", + }); + + const sentLines: string[] = []; + const runtime: ServerRuntimeProvider = { + isRunning: async () => true, + sendConsole(_serverId, line) { + sentLines.push(line); + if (line === "save-all flush") { + appendFileSync( + join(serverDir, "logs", "console.log"), + "[12:00:01] [Server thread/INFO]: Saved the world\n", + ); + } + }, + }; + + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + runtime, + saveTimeoutMs: 500, + savePollIntervalMs: 5, + archiveImpl: () => { + throw new Error("Simulated archive I/O failure"); + }, + }); + + await expect(manager.createBackup({ server_id: "errsrv" })).rejects.toThrow( + "Simulated archive I/O failure", + ); + expect(sentLines).toEqual(["save-off", "save-all flush", "save-on"]); + }); + + test("archives directly without console commands when server is stopped", async () => { + const root = makeTempDir("tegrad-bkp-stopped-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + createSampleServer(serversDir, "offline", { "world/level.dat": "stopped-world" }); + + const sentLines: string[] = []; + const runtime: ServerRuntimeProvider = { + isRunning: async () => false, + sendConsole(_serverId, line) { + sentLines.push(line); + }, + }; + + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + runtime, + }); + + const res = await manager.createBackup({ server_id: "offline" }); + expect(res.destinations[0]?.ok).toBe(true); + expect(sentLines).toEqual([]); + }); +}); + +describe("BackupHook and scheduled backups", () => { + test("BackupHook runs backup by default (auto_before_change: true) and skips when toggled off", async () => { + const root = makeTempDir("tegrad-bkp-hook-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + createSampleServer(serversDir, "modded", { "mods/example.jar": "jar-bytes" }); + + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + }); + const hook = createBackupHook(manager); + + // Default auto_before_change is true + expect(manager.getConfig("modded").auto_before_change).toBe(true); + await hook.beforeChange("modded"); + let listed = await manager.listBackups({ server_id: "modded" }); + expect(listed.backups).toHaveLength(1); + expect(listed.backups[0]?.trigger).toBe("before_change"); + + // Disable auto_before_change + manager.setConfig({ server_id: "modded", auto_before_change: false }); + await hook.beforeChange("modded"); + listed = await manager.listBackups({ server_id: "modded" }); + expect(listed.backups).toHaveLength(1); + }); + + test("scheduler runs per-server interval backups and honors schedule retention_count", async () => { + const root = makeTempDir("tegrad-bkp-sched-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + createSampleServer(serversDir, "hourly", { "world/level.dat": "v1" }); + + const scheduledCallbacks: { fn: () => void; ms: number; cleared: boolean }[] = []; + const fakeTimers: BackupTimerProvider = { + setInterval(fn, ms): BackupTimerHandle { + const entry = { fn, ms, cleared: false }; + scheduledCallbacks.push(entry); + return { id: entry }; + }, + clearInterval(handle) { + const entry = handle.id as { cleared: boolean }; + entry.cleared = true; + }, + }; + + let clock = 1_700_000_000_000; + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + timers: fakeTimers, + now: () => { + clock += 1000; + return clock; + }, + }); + + manager.setConfig({ + server_id: "hourly", + schedule: { enabled: true, interval_minutes: 60, retention_count: 1 }, + }); + + expect(scheduledCallbacks).toHaveLength(1); + expect(scheduledCallbacks[0]?.ms).toBe(60 * 60_000); + + scheduledCallbacks[0]?.fn(); + await new Promise((r) => setTimeout(r, 20)); + scheduledCallbacks[0]?.fn(); + await new Promise((r) => setTimeout(r, 20)); + + const listed = await manager.listBackups({ server_id: "hourly" }); + expect(listed.backups).toHaveLength(1); + expect(listed.backups[0]?.trigger).toBe("scheduled"); + + manager.close(); + expect(scheduledCallbacks[0]?.cleared).toBe(true); + }); +}); + +describe("Restore with safety backup and confinement", () => { + test("takes a pre_restore safety backup before restoring files and rejects zip-slip archives", async () => { + const root = makeTempDir("tegrad-bkp-restore-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + const serverDir = createSampleServer(serversDir, "restorable", { + "world/level.dat": "original-v1", + }); + + let clock = 1_700_000_000_000; + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + now: () => { + clock += 1000; + return clock; + }, + }); + + const originalBackup = await manager.createBackup({ server_id: "restorable" }); + // Mutate current server state + writeFileSync(join(serverDir, "world", "level.dat"), "corrupted-v2", "utf8"); + + const restoreRes = await manager.restoreBackup({ + server_id: "restorable", + backup_id: originalBackup.backup_id, + }); + + expect(restoreRes.destination).toBe("local"); + expect(restoreRes.safety_backup?.trigger).toBe("pre_restore"); + expect(readFileSync(join(serverDir, "world", "level.dat"), "utf8")).toBe("original-v1"); + + const listed = await manager.listBackups({ server_id: "restorable" }); + expect(listed.backups.some((b) => b.trigger === "pre_restore")).toBe(true); + + // Tamper local zip with zip-slip entry -> restore must fail closed + const evilZip = createZipBuffer([ + { name: "../escaped.txt", data: new TextEncoder().encode("pwned") }, + ]); + writeFileSync(join(backupsDir, "restorable", `${originalBackup.backup_id}.zip`), evilZip); + await expect( + manager.restoreBackup({ + server_id: "restorable", + backup_id: originalBackup.backup_id, + }), + ).rejects.toThrow(); + expect(existsSync(join(serversDir, "escaped.txt"))).toBe(false); + }); +}); + +describe("S3 and Tegra Cloud destinations with fake HTTP servers", () => { + test("S3 destination uploads, lists, downloads, rotates, deletes, and never leaks secrets", async () => { + const root = makeTempDir("tegrad-bkp-s3-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + createSampleServer(serversDir, "s3srv", { "world/level.dat": "s3-world-v1" }); + + const objects = new Map(); + const server = Bun.serve({ + port: 0, + hostname: "127.0.0.1", + async fetch(req) { + const url = new URL(req.url); + const key = url.pathname.replace(/^\/+/, ""); + if (req.method === "PUT") { + const bytes = new Uint8Array(await req.arrayBuffer()); + objects.set(key, bytes); + return new Response(null, { status: 200, headers: { ETag: '"abc"' } }); + } + if (req.method === "HEAD") { + const obj = objects.get(key); + if (obj === undefined) { + return new Response(null, { status: 404 }); + } + return new Response(null, { + status: 200, + headers: { "Content-Length": String(obj.byteLength) }, + }); + } + if (req.method === "GET") { + const obj = objects.get(key); + if (obj === undefined) { + return new Response("Not Found", { status: 404 }); + } + return new Response(obj, { status: 200 }); + } + if (req.method === "DELETE") { + objects.delete(key); + return new Response(null, { status: 204 }); + } + return new Response("Method Not Allowed", { status: 405 }); + }, + }); + + const logLines: string[] = []; + const logger = createLogger({ + level: "debug", + stdout: (line) => logLines.push(line), + stderr: (line) => logLines.push(line), + }); + + try { + const secretKey = "SUPER_SECRET_S3_KEY_DO_NOT_LOG"; + const accessKey = "AKIA_TEST_ACCESS_KEY"; + let clock = 1_700_000_000_000; + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + allowInsecure: true, + logger, + now: () => { + clock += 1000; + return clock; + }, + }); + + const cfg = manager.setConfig({ + server_id: "s3srv", + local: { enabled: false }, + s3: { + enabled: true, + bucket: "tegra-backups", + region: "us-east-1", + endpoint: `http://127.0.0.1:${server.port}`, + prefix: "prod", + retention_count: 1, + access_key_id: accessKey, + secret_access_key: secretKey, + }, + }); + + expect(cfg.s3.credentials_configured).toBe(true); + expect(JSON.stringify(cfg)).not.toContain(secretKey); + expect(JSON.stringify(cfg)).not.toContain(accessKey); + + if (process.platform !== "win32") { + const credsPath = manager.configStore.s3CredentialsPath; + expect(statSync(credsPath).mode & 0o777).toBe(0o600); + } + + const b1 = await manager.createBackup({ server_id: "s3srv" }); + expect(b1.destinations).toHaveLength(1); + expect(b1.destinations[0]?.ok).toBe(true); + + const b2 = await manager.createBackup({ server_id: "s3srv" }); + expect(b2.destinations[0]?.ok).toBe(true); + + // Rotation kept only b2 + const listed = await manager.listBackups({ server_id: "s3srv", destination: "s3" }); + expect(listed.backups.map((b) => b.id)).toEqual([b2.backup_id]); + expect(objects.has(`tegra-backups/prod/s3srv/${b1.backup_id}.zip`)).toBe(false); + expect(objects.has(`tegra-backups/prod/s3srv/${b2.backup_id}.zip`)).toBe(true); + + // Restore from S3 + writeFileSync(join(serversDir, "s3srv", "world", "level.dat"), "changed", "utf8"); + const restored = await manager.restoreBackup({ + server_id: "s3srv", + backup_id: b2.backup_id, + destination: "s3", + }); + expect(restored.destination).toBe("s3"); + expect(readFileSync(join(serversDir, "s3srv", "world", "level.dat"), "utf8")).toBe( + "s3-world-v1", + ); + + // Delete from S3 + await manager.deleteBackup({ + server_id: "s3srv", + backup_id: b2.backup_id, + destination: "s3", + }); + expect(objects.has(`tegra-backups/prod/s3srv/${b2.backup_id}.zip`)).toBe(false); + + // Verify secrets never appeared in logs + const allLogs = logLines.join("\n"); + expect(allLogs).not.toContain(secretKey); + expect(allLogs).not.toContain(accessKey); + + // On POSIX, permissive credentials file must be rejected by assertStrictPermissions + if (process.platform !== "win32") { + chmodSync(manager.configStore.s3CredentialsPath, 0o644); + expect(() => manager.configStore.getS3Credentials("s3srv")).toThrow(/0600/); + } + } finally { + server.stop(true); + } + }); + + test("Tegra Cloud destination uploads and downloads via presigned URLs, enforces HTTPS and size limits", async () => { + const root = makeTempDir("tegrad-bkp-cloud-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + createSampleServer(serversDir, "cloudsrv", { "world/level.dat": "cloud-world-v1" }); + + let receivedBody: Uint8Array | undefined; + let receivedShaHeader: string | null = null; + const server = Bun.serve({ + port: 0, + hostname: "127.0.0.1", + async fetch(req) { + if (req.method === "PUT") { + receivedShaHeader = req.headers.get("x-tegra-backup-sha256"); + receivedBody = new Uint8Array(await req.arrayBuffer()); + return new Response(null, { status: 200 }); + } + if (req.method === "GET") { + if (receivedBody === undefined) { + return new Response("Not Found", { status: 404 }); + } + return new Response(receivedBody, { status: 200 }); + } + return new Response("Method Not Allowed", { status: 405 }); + }, + }); + + try { + const uploadUrl = `http://127.0.0.1:${server.port}/upload?sig=secret-presigned-token`; + const downloadUrl = `http://127.0.0.1:${server.port}/download?sig=secret-download-token`; + + // Strict mode (allowInsecure: false) rejects http:// loopback URLs + const strictManager = createBackupManager({ + stateDir: join(root, "state-strict"), + serversBaseDir: serversDir, + allowInsecure: false, + }); + strictManager.setConfig({ + server_id: "cloudsrv", + local: { enabled: false }, + tegra_cloud: { enabled: true }, + }); + const strictRes = await strictManager.createBackup({ + server_id: "cloudsrv", + tegra_cloud_upload_url: uploadUrl, + }); + expect(strictRes.destinations[0]?.ok).toBe(false); + expect(strictRes.destinations[0]?.error).toMatch(/https:\/\//); + + // Insecure test mode allows loopback HTTP + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + allowInsecure: true, + }); + manager.setConfig({ + server_id: "cloudsrv", + local: { enabled: false }, + tegra_cloud: { enabled: true }, + }); + + const created = await manager.createBackup({ + server_id: "cloudsrv", + tegra_cloud_upload_url: uploadUrl, + }); + expect(created.destinations[0]?.ok).toBe(true); + expect(receivedBody?.byteLength).toBe(created.size_bytes); + expect(receivedShaHeader as string | null).toBe(created.sha256); + + // Presigned URL must never be persisted on disk + const indexContent = readFileSync(join(stateDir, "backup-cloud-index.json"), "utf8"); + expect(indexContent).not.toContain("secret-presigned-token"); + + // Restore from Tegra Cloud presigned download URL + writeFileSync(join(serversDir, "cloudsrv", "world", "level.dat"), "mutated", "utf8"); + const restored = await manager.restoreBackup({ + server_id: "cloudsrv", + backup_id: created.backup_id, + destination: "tegra_cloud", + tegra_cloud_download_url: downloadUrl, + }); + expect(restored.destination).toBe("tegra_cloud"); + expect(readFileSync(join(serversDir, "cloudsrv", "world", "level.dat"), "utf8")).toBe( + "cloud-world-v1", + ); + } finally { + server.stop(true); + } + }); +}); + +describe("Protocol commands, sensitivity, and server_id validation", () => { + test("server.backup.restore and server.backup.delete reject session keys and accept direct account keys", async () => { + await ready(); + const agentKeyPair = generateSigningKeyPair(); + const accountKeyPair = generateSigningKeyPair(); + const sessionKeyPair = generateSigningKeyPair(); + const registry = createCoreRegistry(); + const nowMs = 1_700_000_000_000; + + const sessionCert = signSessionCertificate({ + accountKeyPair, + sessionPublicKey: sessionKeyPair.publicKey, + notBefore: nowMs - 1000, + notAfter: nowMs + 60_000, + id: toBase64Url(new Uint8Array(16).fill(1)), + }); + + const trust = createInMemoryTrustContext({ + agentKeyPair, + trustedAccountKeys: [accountKeyPair.publicKey], + now: () => nowMs, + }); + + // Session key rejected for server.backup.restore + const restoreWithSession = createSignedCommand( + { + type: "server.backup.restore", + body: { server_id: "smp", backup_id: "bkp-1" }, + agentPublicKey: agentKeyPair.publicKey, + signer: sessionKeyPair, + session: sessionCert, + counter: 1, + now: nowMs, + }, + registry, + ); + try { + await openCommand(restoreWithSession, trust, registry); + expect.unreachable("Expected sensitive_requires_account_key"); + } catch (err) { + expect(err instanceof ProtocolError && err.code).toBe("sensitive_requires_account_key"); + } + + // Session key rejected for server.backup.delete + const deleteWithSession = createSignedCommand( + { + type: "server.backup.delete", + body: { server_id: "smp", backup_id: "bkp-1" }, + agentPublicKey: agentKeyPair.publicKey, + signer: sessionKeyPair, + session: sessionCert, + counter: 2, + now: nowMs, + }, + registry, + ); + try { + await openCommand(deleteWithSession, trust, registry); + expect.unreachable("Expected sensitive_requires_account_key"); + } catch (err) { + expect(err instanceof ProtocolError && err.code).toBe("sensitive_requires_account_key"); + } + + // Direct account key accepted for server.backup.restore + const restoreWithAccount = createSignedCommand( + { + type: "server.backup.restore", + body: { server_id: "smp", backup_id: "bkp-1" }, + agentPublicKey: agentKeyPair.publicKey, + signer: accountKeyPair, + counter: 1, + now: nowMs, + }, + registry, + ); + const openedRestore = await openCommand(restoreWithAccount, trust, registry); + expect(openedRestore.header.type).toBe("server.backup.restore"); + + // Invalid server_id rejected at protocol boundary + expect(() => + createSignedCommand( + { + type: "server.backup.create", + body: { server_id: "../etc" }, + agentPublicKey: agentKeyPair.publicKey, + signer: accountKeyPair, + counter: 2, + now: nowMs, + }, + registry, + ), + ).toThrow(ProtocolError); + }); + + test("registerBackupHandlers executes config, create, list, restore, and delete through CommandQueue", async () => { + await ready(); + const root = makeTempDir("tegrad-bkp-queue-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + createSampleServer(serversDir, "qserver", { "world/level.dat": "queue-v1" }); + + const agentKeyPair = generateSigningKeyPair(); + const accountKeyPair = generateSigningKeyPair(); + const nowMs = 1_700_000_000_000; + const registry = createCoreRegistry(); + const trust = createInMemoryTrustContext({ + agentKeyPair, + trustedAccountKeys: [accountKeyPair.publicKey], + now: () => nowMs, + }); + + const frames: TransportFrame[] = []; + const logger = createLogger({ level: "error", stdout: () => {}, stderr: () => {} }); + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (frame) => frames.push(frame), + logger, + }); + + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + now: () => nowMs, + }); + registerBackupHandlers(queue, manager); + + let counter = 1; + const sendCmd = async (type: string, body: unknown) => { + const signed = createSignedCommand( + { + type, + body, + agentPublicKey: agentKeyPair.publicKey, + signer: accountKeyPair, + counter: counter++, + now: nowMs, + }, + registry, + ); + await queue.enqueue({ + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: "agent-1" }, + body: signed, + }); + }; + + await sendCmd("server.backup.config.set", { + server_id: "qserver", + local: { enabled: true, retention_count: 5 }, + }); + await sendCmd("server.backup.create", { server_id: "qserver", note: "from-queue" }); + await sendCmd("server.backup.list", { server_id: "qserver" }); + + const events = frames + .filter((f): f is Extract => f.kind === "event") + .map((f) => openAgentMessage(f.body, agentKeyPair.publicKey, accountKeyPair)); + + expect(events.map((e) => e.header.type)).toEqual([ + "server.backup.config.updated", + "server.backup.created", + "server.backup.list.result", + ]); + + const createdBody = events[1]?.body as { readonly backup_id: string }; + await sendCmd("server.backup.restore", { + server_id: "qserver", + backup_id: createdBody.backup_id, + }); + await sendCmd("server.backup.delete", { + server_id: "qserver", + backup_id: createdBody.backup_id, + }); + + const acks = frames.filter( + (f): f is Extract => f.kind === "ack", + ); + expect(acks).toHaveLength(5); + expect(acks.every((a) => a.body.ok)).toBe(true); + }); +}); diff --git a/src/backup/config.ts b/src/backup/config.ts new file mode 100644 index 0000000..0407d8d --- /dev/null +++ b/src/backup/config.ts @@ -0,0 +1,369 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { existsSync, readFileSync } from "node:fs"; +import { join } from "node:path"; +import { z } from "zod"; +import { assertStrictPermissions, writeFileAtomic } from "../agent/state"; +import { + backupScheduleConfigSchema, + MAX_BACKUP_RETENTION_COUNT, + MIN_BACKUP_RETENTION_COUNT, + ProtocolError, + type ServerBackupConfigSetBody, + serverBackupConfigSetBodySchema, + serverIdSchema, +} from "../protocol"; +import type { S3Credentials, ServerBackupConfig } from "./types"; + +export const DEFAULT_LOCAL_RETENTION_COUNT = 10; +export const DEFAULT_S3_RETENTION_COUNT = 10; +export const DEFAULT_TEGRA_CLOUD_RETENTION_COUNT = 10; + +const SECRET_FILE_MODE = 0o600; +const STATE_DIR_MODE = 0o700; + +const storedS3ConfigSchema = z + .object({ + enabled: z.boolean(), + bucket: z.string().min(1).max(255).optional(), + region: z.string().min(1).max(64).optional(), + endpoint: z.string().min(1).max(512).optional(), + prefix: z.string().max(256).optional(), + retention_count: z + .number() + .int() + .min(MIN_BACKUP_RETENTION_COUNT) + .max(MAX_BACKUP_RETENTION_COUNT), + }) + .strict(); + +const storedServerBackupConfigSchema = z + .object({ + auto_before_change: z.boolean(), + schedule: backupScheduleConfigSchema.optional(), + local: z + .object({ + enabled: z.boolean(), + retention_count: z + .number() + .int() + .min(MIN_BACKUP_RETENTION_COUNT) + .max(MAX_BACKUP_RETENTION_COUNT), + }) + .strict(), + s3: storedS3ConfigSchema, + tegra_cloud: z + .object({ + enabled: z.boolean(), + retention_count: z + .number() + .int() + .min(MIN_BACKUP_RETENTION_COUNT) + .max(MAX_BACKUP_RETENTION_COUNT), + }) + .strict(), + }) + .strict(); + +type StoredServerBackupConfig = z.infer; + +const backupConfigFileSchema = z + .object({ + v: z.literal(1), + servers: z.record(serverIdSchema, storedServerBackupConfigSchema), + }) + .strict(); + +const s3CredentialsEntrySchema = z + .object({ + access_key_id: z.string().min(1).max(256), + secret_access_key: z.string().min(1).max(256), + session_token: z.string().min(1).max(2048).optional(), + }) + .strict(); + +const s3CredentialsFileSchema = z + .object({ + v: z.literal(1), + servers: z.record(serverIdSchema, s3CredentialsEntrySchema), + }) + .strict(); + +export function validateRemoteHttpsUrl( + rawUrl: string, + label: string, + allowInsecure: boolean, +): string { + let parsed: URL; + try { + parsed = new URL(rawUrl); + } catch { + throw new ProtocolError("backup_config_invalid", `Invalid ${label}: "${rawUrl}"`); + } + + if (parsed.username.length > 0 || parsed.password.length > 0) { + throw new ProtocolError("backup_config_invalid", `${label} must not contain credentials`); + } + + if (parsed.hash.length > 0) { + throw new ProtocolError("backup_config_invalid", `${label} must not contain a URL fragment`); + } + + if (parsed.protocol === "https:") { + return parsed.toString(); + } + + const isLoopback = + parsed.hostname === "localhost" || + parsed.hostname === "127.0.0.1" || + parsed.hostname === "[::1]" || + parsed.hostname === "::1"; + + if (allowInsecure && parsed.protocol === "http:" && isLoopback) { + return parsed.toString(); + } + + throw new ProtocolError( + "backup_config_invalid", + `${label} must use https:// (got ${parsed.protocol}//${parsed.host})`, + ); +} + +function defaultStoredConfig(): StoredServerBackupConfig { + return { + auto_before_change: true, + local: { + enabled: true, + retention_count: DEFAULT_LOCAL_RETENTION_COUNT, + }, + s3: { + enabled: false, + retention_count: DEFAULT_S3_RETENTION_COUNT, + }, + tegra_cloud: { + enabled: false, + retention_count: DEFAULT_TEGRA_CLOUD_RETENTION_COUNT, + }, + }; +} + +function readJsonOrNull(filePath: string, strictPerms: boolean): unknown | null { + if (!existsSync(filePath)) { + return null; + } + if (strictPerms) { + assertStrictPermissions(filePath); + } + let raw: string; + try { + raw = readFileSync(filePath, "utf8"); + } catch (err) { + throw new ProtocolError( + "backup_config_invalid", + `Failed to read backup state file: ${err instanceof Error ? err.message : String(err)}`, + ); + } + try { + return JSON.parse(raw) as unknown; + } catch { + throw new ProtocolError("backup_config_invalid", "Malformed JSON in backup state file"); + } +} + +export interface BackupConfigStoreOptions { + readonly stateDir: string; + readonly allowInsecure?: boolean; +} + +export class BackupConfigStore { + readonly configPath: string; + readonly s3CredentialsPath: string; + private readonly allowInsecure: boolean; + + constructor(options: BackupConfigStoreOptions) { + this.configPath = join(options.stateDir, "backup-config.json"); + this.s3CredentialsPath = join(options.stateDir, "backup-s3-credentials.json"); + this.allowInsecure = options.allowInsecure ?? false; + } + + private readAllConfigs(): Record { + const raw = readJsonOrNull(this.configPath, false); + if (raw === null) { + return {}; + } + const parsed = backupConfigFileSchema.safeParse(raw); + if (!parsed.success) { + throw new ProtocolError("backup_config_invalid", "Invalid backup-config.json"); + } + return { ...parsed.data.servers }; + } + + private writeAllConfigs(servers: Record): void { + const payload = `${JSON.stringify({ v: 1, servers }, null, 2)}\n`; + writeFileAtomic(this.configPath, payload, { + mode: SECRET_FILE_MODE, + dirMode: STATE_DIR_MODE, + }); + } + + private readAllS3Credentials(): Record { + const raw = readJsonOrNull(this.s3CredentialsPath, true); + if (raw === null) { + return {}; + } + const parsed = s3CredentialsFileSchema.safeParse(raw); + if (!parsed.success) { + throw new ProtocolError("backup_config_invalid", "Invalid backup-s3-credentials.json"); + } + return { ...parsed.data.servers }; + } + + private writeAllS3Credentials(servers: Record): void { + const payload = `${JSON.stringify({ v: 1, servers }, null, 2)}\n`; + writeFileAtomic(this.s3CredentialsPath, payload, { + mode: SECRET_FILE_MODE, + dirMode: STATE_DIR_MODE, + }); + } + + getS3Credentials(serverId: string): S3Credentials | null { + const validId = serverIdSchema.parse(serverId); + const all = this.readAllS3Credentials(); + return all[validId] ?? null; + } + + getServerConfig(serverId: string): ServerBackupConfig { + const validId = serverIdSchema.parse(serverId); + const all = this.readAllConfigs(); + const stored = all[validId] ?? defaultStoredConfig(); + const creds = this.getS3Credentials(validId); + + return { + server_id: validId, + auto_before_change: stored.auto_before_change, + ...(stored.schedule !== undefined ? { schedule: stored.schedule } : {}), + local: { ...stored.local }, + s3: { + ...stored.s3, + credentials_configured: creds !== null, + }, + tegra_cloud: { ...stored.tegra_cloud }, + }; + } + + listConfiguredServerIds(): string[] { + return Object.keys(this.readAllConfigs()).sort(); + } + + setServerConfig(input: ServerBackupConfigSetBody): ServerBackupConfig { + const parsed = serverBackupConfigSetBodySchema.safeParse(input); + if (!parsed.success) { + throw new ProtocolError("invalid_body", "Invalid server.backup.config.set parameters"); + } + + const data = parsed.data; + const validId = data.server_id; + const allConfigs = this.readAllConfigs(); + const existing = allConfigs[validId] ?? defaultStoredConfig(); + + const nextLocal = + data.local !== undefined + ? { + enabled: data.local.enabled, + retention_count: data.local.retention_count ?? existing.local.retention_count, + } + : existing.local; + + const nextTegraCloud = + data.tegra_cloud !== undefined + ? { + enabled: data.tegra_cloud.enabled, + retention_count: + data.tegra_cloud.retention_count ?? existing.tegra_cloud.retention_count, + } + : existing.tegra_cloud; + + let nextS3 = existing.s3; + let credsToSave: S3Credentials | undefined; + + if (data.s3 !== undefined) { + const endpoint = + data.s3.endpoint !== undefined + ? validateRemoteHttpsUrl(data.s3.endpoint, "s3.endpoint", this.allowInsecure) + : existing.s3.endpoint; + const bucket = data.s3.bucket ?? existing.s3.bucket; + const region = data.s3.region ?? existing.s3.region; + const prefix = data.s3.prefix ?? existing.s3.prefix; + const retentionCount = data.s3.retention_count ?? existing.s3.retention_count; + + if (data.s3.access_key_id !== undefined || data.s3.secret_access_key !== undefined) { + if (data.s3.access_key_id === undefined || data.s3.secret_access_key === undefined) { + throw new ProtocolError( + "backup_config_invalid", + "Both s3.access_key_id and s3.secret_access_key must be provided together", + ); + } + credsToSave = { + access_key_id: data.s3.access_key_id, + secret_access_key: data.s3.secret_access_key, + ...(data.s3.session_token !== undefined ? { session_token: data.s3.session_token } : {}), + }; + } + + if (data.s3.enabled) { + if (bucket === undefined || bucket.length === 0) { + throw new ProtocolError( + "backup_config_invalid", + "s3.bucket is required when S3 is enabled", + ); + } + if (endpoint === undefined || endpoint.length === 0) { + throw new ProtocolError( + "backup_config_invalid", + "s3.endpoint is required when S3 is enabled", + ); + } + const existingCreds = credsToSave ?? this.getS3Credentials(validId); + if (existingCreds === null) { + throw new ProtocolError( + "backup_config_invalid", + "S3 credentials are required when S3 is enabled", + ); + } + } + + nextS3 = { + enabled: data.s3.enabled, + ...(bucket !== undefined ? { bucket } : {}), + ...(region !== undefined ? { region } : {}), + ...(endpoint !== undefined ? { endpoint } : {}), + ...(prefix !== undefined ? { prefix } : {}), + retention_count: retentionCount, + }; + } + + const nextConfig: StoredServerBackupConfig = { + auto_before_change: data.auto_before_change ?? existing.auto_before_change, + ...(data.schedule !== undefined + ? { schedule: data.schedule } + : existing.schedule !== undefined + ? { schedule: existing.schedule } + : {}), + local: nextLocal, + s3: nextS3, + tegra_cloud: nextTegraCloud, + }; + + if (credsToSave !== undefined) { + const allCreds = this.readAllS3Credentials(); + allCreds[validId] = credsToSave; + this.writeAllS3Credentials(allCreds); + } + + allConfigs[validId] = nextConfig; + this.writeAllConfigs(allConfigs); + + return this.getServerConfig(validId); + } +} diff --git a/src/backup/destinations/local.ts b/src/backup/destinations/local.ts new file mode 100644 index 0000000..52801d1 --- /dev/null +++ b/src/backup/destinations/local.ts @@ -0,0 +1,234 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { randomBytes } from "node:crypto"; +import { + chmodSync, + closeSync, + existsSync, + fsyncSync, + lstatSync, + mkdirSync, + openSync, + readdirSync, + readFileSync, + renameSync, + unlinkSync, + writeFileSync, +} from "node:fs"; +import { basename, dirname, join } from "node:path"; +import { z } from "zod"; +import { writeFileAtomic } from "../../agent/state"; +import { backupIdSchema, ProtocolError, serverIdSchema } from "../../protocol"; +import type { BackupConfigStore } from "../config"; +import type { BackupDestination, BackupMetadata, BackupUploadContext } from "../types"; + +export const DEFAULT_LOCAL_BACKUPS_DIR = "/var/lib/tegrad-backups"; + +const BACKUP_DIR_MODE = 0o700; +const BACKUP_FILE_MODE = 0o600; + +const localMetadataSchema = z + .object({ + id: backupIdSchema, + server_id: serverIdSchema, + created_at: z.number().int().nonnegative(), + size_bytes: z.number().int().nonnegative(), + sha256: z.string().regex(/^[0-9a-f]{64}$/), + trigger: z.enum(["manual", "scheduled", "before_change", "pre_restore"]), + destination: z.literal("local"), + note: z.string().max(256).optional(), + }) + .strict(); + +function isPosix(platform: NodeJS.Platform = process.platform): boolean { + return platform !== "win32"; +} + +function ensurePrivateDir(dirPath: string): void { + mkdirSync(dirPath, { recursive: true, mode: BACKUP_DIR_MODE }); + if (isPosix()) { + chmodSync(dirPath, BACKUP_DIR_MODE); + } +} + +function writeBinaryAtomic(filePath: string, data: Uint8Array): void { + const dir = dirname(filePath); + ensurePrivateDir(dir); + + const suffix = randomBytes(8).toString("hex"); + const tmpPath = join(dir, `.tmp-${basename(filePath)}-${process.pid}-${suffix}`); + let fd: number | undefined; + try { + fd = openSync(tmpPath, "wx", BACKUP_FILE_MODE); + writeFileSync(fd, data); + fsyncSync(fd); + closeSync(fd); + fd = undefined; + + if (isPosix()) { + chmodSync(tmpPath, BACKUP_FILE_MODE); + } + renameSync(tmpPath, filePath); + } catch (err) { + if (fd !== undefined) { + try { + closeSync(fd); + } catch { + // ignore close failure + } + } + try { + if (existsSync(tmpPath)) { + unlinkSync(tmpPath); + } + } catch { + // ignore cleanup failure + } + throw err; + } +} + +export interface LocalBackupDestinationOptions { + readonly backupsDir?: string; + readonly configStore: BackupConfigStore; +} + +export class LocalBackupDestination implements BackupDestination { + readonly kind = "local" as const; + readonly backupsDir: string; + private readonly configStore: BackupConfigStore; + + constructor(options: LocalBackupDestinationOptions) { + this.backupsDir = options.backupsDir ?? DEFAULT_LOCAL_BACKUPS_DIR; + this.configStore = options.configStore; + } + + isEnabled(serverId: string): boolean { + return this.configStore.getServerConfig(serverId).local.enabled; + } + + private getServerBackupDir(serverId: string): string { + const validId = serverIdSchema.parse(serverId); + return join(this.backupsDir, validId); + } + + private getBackupPaths( + serverId: string, + backupId: string, + ): { readonly zipPath: string; readonly metaPath: string } { + const validBackupId = backupIdSchema.parse(backupId); + const serverDir = this.getServerBackupDir(serverId); + return { + zipPath: join(serverDir, `${validBackupId}.zip`), + metaPath: join(serverDir, `${validBackupId}.json`), + }; + } + + async upload(archive: Uint8Array, ctx: BackupUploadContext): Promise { + const validServerId = serverIdSchema.parse(ctx.serverId); + const validBackupId = backupIdSchema.parse(ctx.backupId); + ensurePrivateDir(this.backupsDir); + ensurePrivateDir(this.getServerBackupDir(validServerId)); + + const { zipPath, metaPath } = this.getBackupPaths(validServerId, validBackupId); + writeBinaryAtomic(zipPath, archive); + + const metadata: BackupMetadata = { + id: validBackupId, + server_id: validServerId, + created_at: ctx.createdAt, + size_bytes: archive.byteLength, + sha256: ctx.sha256, + trigger: ctx.trigger, + destination: "local", + ...(ctx.note !== undefined ? { note: ctx.note } : {}), + }; + + writeFileAtomic(metaPath, `${JSON.stringify(metadata, null, 2)}\n`, { + mode: BACKUP_FILE_MODE, + dirMode: BACKUP_DIR_MODE, + }); + + const retention = + ctx.retentionCount ?? this.configStore.getServerConfig(validServerId).local.retention_count; + await this.rotate(validServerId, retention); + + return metadata; + } + + private async rotate(serverId: string, retentionCount: number): Promise { + const backups = await this.list(serverId); + if (backups.length <= retentionCount) { + return; + } + const toRemove = backups.slice(retentionCount); + for (const old of toRemove) { + try { + await this.delete(serverId, old.id); + } catch { + // Ignore individual rotation delete errors + } + } + } + + async list(serverId: string): Promise { + const serverDir = this.getServerBackupDir(serverId); + if (!existsSync(serverDir)) { + return []; + } + + const entries = readdirSync(serverDir); + const results: BackupMetadata[] = []; + + for (const name of entries) { + if (!name.endsWith(".json") || name.startsWith(".tmp-")) { + continue; + } + const fullPath = join(serverDir, name); + const stat = lstatSync(fullPath, { throwIfNoEntry: false }); + if (stat === undefined || stat.isSymbolicLink() || !stat.isFile()) { + continue; + } + try { + const parsed = localMetadataSchema.safeParse(JSON.parse(readFileSync(fullPath, "utf8"))); + if (parsed.success && parsed.data.server_id === serverId) { + results.push(parsed.data); + } + } catch { + // Ignore corrupt metadata files during listing + } + } + + results.sort((a, b) => b.created_at - a.created_at || b.id.localeCompare(a.id)); + return results; + } + + async download(serverId: string, backupId: string): Promise { + const { zipPath } = this.getBackupPaths(serverId, backupId); + const stat = lstatSync(zipPath, { throwIfNoEntry: false }); + if (stat === undefined) { + throw new ProtocolError("backup_not_found", `Local backup not found: ${backupId}`); + } + if (stat.isSymbolicLink() || !stat.isFile()) { + throw new ProtocolError("backup_failed", `Invalid local backup archive: ${backupId}`); + } + const buf = readFileSync(zipPath); + return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength); + } + + async delete(serverId: string, backupId: string): Promise { + const { zipPath, metaPath } = this.getBackupPaths(serverId, backupId); + const zipExists = existsSync(zipPath); + const metaExists = existsSync(metaPath); + if (!zipExists && !metaExists) { + throw new ProtocolError("backup_not_found", `Local backup not found: ${backupId}`); + } + if (zipExists) { + unlinkSync(zipPath); + } + if (metaExists) { + unlinkSync(metaPath); + } + } +} diff --git a/src/backup/destinations/s3.ts b/src/backup/destinations/s3.ts new file mode 100644 index 0000000..5b091d3 --- /dev/null +++ b/src/backup/destinations/s3.ts @@ -0,0 +1,206 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; +import { backupIdSchema, ProtocolError, serverIdSchema } from "../../protocol"; +import { type BackupConfigStore, validateRemoteHttpsUrl } from "../config"; +import type { BackupDestination, BackupMetadata, BackupUploadContext } from "../types"; + +const s3MetadataSchema = z + .object({ + id: backupIdSchema, + server_id: serverIdSchema, + created_at: z.number().int().nonnegative(), + size_bytes: z.number().int().nonnegative(), + sha256: z.string().regex(/^[0-9a-f]{64}$/), + trigger: z.enum(["manual", "scheduled", "before_change", "pre_restore"]), + destination: z.literal("s3"), + note: z.string().max(256).optional(), + }) + .strict(); + +const s3IndexSchema = z + .object({ + v: z.literal(1), + backups: z.array(s3MetadataSchema), + }) + .strict(); + +function normalizePrefix(prefix: string | undefined): string { + if (!prefix) { + return ""; + } + const trimmed = prefix.replace(/^\/+/, "").replace(/\/+$/, ""); + return trimmed.length > 0 ? `${trimmed}/` : ""; +} + +export interface S3BackupDestinationOptions { + readonly configStore: BackupConfigStore; + readonly allowInsecure?: boolean; +} + +export class S3BackupDestination implements BackupDestination { + readonly kind = "s3" as const; + private readonly configStore: BackupConfigStore; + private readonly allowInsecure: boolean; + + constructor(options: S3BackupDestinationOptions) { + this.configStore = options.configStore; + this.allowInsecure = options.allowInsecure ?? false; + } + + isEnabled(serverId: string): boolean { + return this.configStore.getServerConfig(serverId).s3.enabled; + } + + private createClient(serverId: string): { + readonly client: Bun.S3Client; + readonly prefix: string; + readonly retentionCount: number; + } { + const validServerId = serverIdSchema.parse(serverId); + const cfg = this.configStore.getServerConfig(validServerId).s3; + if (!cfg.enabled) { + throw new ProtocolError("backup_config_invalid", "S3 backup destination is not enabled"); + } + if (!cfg.bucket || !cfg.endpoint) { + throw new ProtocolError("backup_config_invalid", "S3 bucket and endpoint must be configured"); + } + + const endpoint = validateRemoteHttpsUrl(cfg.endpoint, "s3.endpoint", this.allowInsecure); + const creds = this.configStore.getS3Credentials(validServerId); + if (creds === null) { + throw new ProtocolError("backup_config_invalid", "S3 credentials are not configured"); + } + + const client = new Bun.S3Client({ + accessKeyId: creds.access_key_id, + secretAccessKey: creds.secret_access_key, + ...(creds.session_token !== undefined ? { sessionToken: creds.session_token } : {}), + bucket: cfg.bucket, + endpoint, + ...(cfg.region !== undefined ? { region: cfg.region } : {}), + }); + + return { + client, + prefix: normalizePrefix(cfg.prefix), + retentionCount: cfg.retention_count, + }; + } + + private archiveKey(prefix: string, serverId: string, backupId: string): string { + return `${prefix}${serverId}/${backupId}.zip`; + } + + private indexKey(prefix: string, serverId: string): string { + return `${prefix}${serverId}/index.json`; + } + + private async readIndex( + client: Bun.S3Client, + prefix: string, + serverId: string, + ): Promise { + const key = this.indexKey(prefix, serverId); + try { + const exists = await client.exists(key); + if (!exists) { + return []; + } + const text = await client.file(key).text(); + const parsed = s3IndexSchema.safeParse(JSON.parse(text)); + if (!parsed.success) { + return []; + } + return [...parsed.data.backups]; + } catch { + return []; + } + } + + private async writeIndex( + client: Bun.S3Client, + prefix: string, + serverId: string, + backups: readonly BackupMetadata[], + ): Promise { + const key = this.indexKey(prefix, serverId); + const payload = `${JSON.stringify({ v: 1, backups }, null, 2)}\n`; + await client.write(key, payload, { type: "application/json" }); + } + + async upload(archive: Uint8Array, ctx: BackupUploadContext): Promise { + const validServerId = serverIdSchema.parse(ctx.serverId); + const validBackupId = backupIdSchema.parse(ctx.backupId); + const { client, prefix, retentionCount } = this.createClient(validServerId); + + const key = this.archiveKey(prefix, validServerId, validBackupId); + await client.write(key, archive, { type: "application/zip" }); + + const metadata: BackupMetadata = { + id: validBackupId, + server_id: validServerId, + created_at: ctx.createdAt, + size_bytes: archive.byteLength, + sha256: ctx.sha256, + trigger: ctx.trigger, + destination: "s3", + ...(ctx.note !== undefined ? { note: ctx.note } : {}), + }; + + const existing = await this.readIndex(client, prefix, validServerId); + const combined = [metadata, ...existing.filter((b) => b.id !== validBackupId)].sort( + (a, b) => b.created_at - a.created_at || b.id.localeCompare(a.id), + ); + + const limit = ctx.retentionCount ?? retentionCount; + const kept = combined.slice(0, limit); + const evicted = combined.slice(limit); + + for (const old of evicted) { + try { + await client.delete(this.archiveKey(prefix, validServerId, old.id)); + } catch { + // Ignore individual eviction delete errors + } + } + + await this.writeIndex(client, prefix, validServerId, kept); + return metadata; + } + + async list(serverId: string): Promise { + const validServerId = serverIdSchema.parse(serverId); + const { client, prefix } = this.createClient(validServerId); + const items = await this.readIndex(client, prefix, validServerId); + items.sort((a, b) => b.created_at - a.created_at || b.id.localeCompare(a.id)); + return items; + } + + async download(serverId: string, backupId: string): Promise { + const validServerId = serverIdSchema.parse(serverId); + const validBackupId = backupIdSchema.parse(backupId); + const { client, prefix } = this.createClient(validServerId); + const key = this.archiveKey(prefix, validServerId, validBackupId); + + const exists = await client.exists(key); + if (!exists) { + throw new ProtocolError("backup_not_found", `S3 backup not found: ${validBackupId}`); + } + + return client.file(key).bytes(); + } + + async delete(serverId: string, backupId: string): Promise { + const validServerId = serverIdSchema.parse(serverId); + const validBackupId = backupIdSchema.parse(backupId); + const { client, prefix } = this.createClient(validServerId); + const key = this.archiveKey(prefix, validServerId, validBackupId); + + await client.delete(key); + const existing = await this.readIndex(client, prefix, validServerId); + const next = existing.filter((b) => b.id !== validBackupId); + await this.writeIndex(client, prefix, validServerId, next); + } +} diff --git a/src/backup/destinations/tegra-cloud.ts b/src/backup/destinations/tegra-cloud.ts new file mode 100644 index 0000000..c62480e --- /dev/null +++ b/src/backup/destinations/tegra-cloud.ts @@ -0,0 +1,303 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { existsSync, readFileSync } from "node:fs"; +import { join } from "node:path"; +import { z } from "zod"; +import { writeFileAtomic } from "../../agent/state"; +import { backupIdSchema, ProtocolError, serverIdSchema } from "../../protocol"; +import { type BackupConfigStore, validateRemoteHttpsUrl } from "../config"; +import type { + BackupDestination, + BackupDownloadOptions, + BackupMetadata, + BackupUploadContext, +} from "../types"; + +export const DEFAULT_TEGRA_CLOUD_TIMEOUT_MS = 120_000; +export const DEFAULT_TEGRA_CLOUD_MAX_BYTES = 2 * 1024 * 1024 * 1024; // 2 GiB + +const SECRET_FILE_MODE = 0o600; +const STATE_DIR_MODE = 0o700; + +const cloudMetadataSchema = z + .object({ + id: backupIdSchema, + server_id: serverIdSchema, + created_at: z.number().int().nonnegative(), + size_bytes: z.number().int().nonnegative(), + sha256: z.string().regex(/^[0-9a-f]{64}$/), + trigger: z.enum(["manual", "scheduled", "before_change", "pre_restore"]), + destination: z.literal("tegra_cloud"), + note: z.string().max(256).optional(), + }) + .strict(); + +const cloudIndexFileSchema = z + .object({ + v: z.literal(1), + servers: z.record(serverIdSchema, z.array(cloudMetadataSchema)), + }) + .strict(); + +export type CloudFetchLike = (input: string | URL, init?: RequestInit) => Promise; + +/** + * Tegra Cloud backup destination using short-lived presigned URLs provided by + * the control plane per operation: + * + * - Upload contract: + * `PUT ` with `Content-Type: application/zip`, + * `Content-Length`, `X-Tegra-Backup-Id`, `X-Tegra-Server-Id`, and + * `X-Tegra-Backup-Sha256`. Redirects are rejected (`redirect: "error"`). + * Expects any 2xx response. + * + * - Download contract (for restore): + * `GET ` with `redirect: "error"`. Expects 200 OK + * and streams up to `maxBytes`. + * + * Presigned URLs are never persisted on disk or logged. + */ +export interface TegraCloudBackupDestinationOptions { + readonly stateDir: string; + readonly configStore: BackupConfigStore; + readonly allowInsecure?: boolean; + readonly timeoutMs?: number; + readonly maxBytes?: number; + readonly fetchImpl?: CloudFetchLike; +} + +async function readResponseBytesCapped(response: Response, maxBytes: number): Promise { + const contentLengthHeader = response.headers.get("content-length"); + if (contentLengthHeader !== null) { + const declared = Number(contentLengthHeader); + if (Number.isFinite(declared) && declared > maxBytes) { + throw new ProtocolError( + "backup_failed", + `Tegra Cloud download exceeds maximum allowed size (${maxBytes} bytes)`, + ); + } + } + + if (response.body === null) { + return new Uint8Array(0); + } + + const reader = response.body.getReader(); + const chunks: Uint8Array[] = []; + let total = 0; + + try { + while (true) { + const { value, done } = await reader.read(); + if (done) { + break; + } + if (value === undefined || value.byteLength === 0) { + continue; + } + total += value.byteLength; + if (total > maxBytes) { + await reader.cancel(); + throw new ProtocolError( + "backup_failed", + `Tegra Cloud download exceeds maximum allowed size (${maxBytes} bytes)`, + ); + } + chunks.push(value); + } + } finally { + reader.releaseLock(); + } + + const out = new Uint8Array(total); + let offset = 0; + for (const chunk of chunks) { + out.set(chunk, offset); + offset += chunk.byteLength; + } + return out; +} + +export class TegraCloudBackupDestination implements BackupDestination { + readonly kind = "tegra_cloud" as const; + readonly indexPath: string; + private readonly configStore: BackupConfigStore; + private readonly allowInsecure: boolean; + private readonly timeoutMs: number; + private readonly maxBytes: number; + private readonly fetchImpl: CloudFetchLike; + + constructor(options: TegraCloudBackupDestinationOptions) { + this.indexPath = join(options.stateDir, "backup-cloud-index.json"); + this.configStore = options.configStore; + this.allowInsecure = options.allowInsecure ?? false; + this.timeoutMs = options.timeoutMs ?? DEFAULT_TEGRA_CLOUD_TIMEOUT_MS; + this.maxBytes = options.maxBytes ?? DEFAULT_TEGRA_CLOUD_MAX_BYTES; + this.fetchImpl = options.fetchImpl ?? ((input, init) => fetch(input, init)); + } + + isEnabled(serverId: string): boolean { + return this.configStore.getServerConfig(serverId).tegra_cloud.enabled; + } + + private readIndex(): Record { + if (!existsSync(this.indexPath)) { + return {}; + } + try { + const parsed = cloudIndexFileSchema.safeParse( + JSON.parse(readFileSync(this.indexPath, "utf8")), + ); + if (!parsed.success) { + return {}; + } + const copy: Record = {}; + for (const [sid, list] of Object.entries(parsed.data.servers)) { + copy[sid] = [...list]; + } + return copy; + } catch { + return {}; + } + } + + private writeIndex(servers: Record): void { + const payload = `${JSON.stringify({ v: 1, servers }, null, 2)}\n`; + writeFileAtomic(this.indexPath, payload, { + mode: SECRET_FILE_MODE, + dirMode: STATE_DIR_MODE, + }); + } + + async upload(archive: Uint8Array, ctx: BackupUploadContext): Promise { + const validServerId = serverIdSchema.parse(ctx.serverId); + const validBackupId = backupIdSchema.parse(ctx.backupId); + + if (!ctx.presignedUploadUrl) { + throw new ProtocolError( + "backup_failed", + "Tegra Cloud upload requires a presigned upload URL", + ); + } + + if (archive.byteLength > this.maxBytes) { + throw new ProtocolError( + "backup_failed", + `Backup archive size (${archive.byteLength}) exceeds Tegra Cloud limit (${this.maxBytes})`, + ); + } + + const validatedUrl = validateRemoteHttpsUrl( + ctx.presignedUploadUrl, + "tegra_cloud_upload_url", + this.allowInsecure, + ); + + const response = await this.fetchImpl(validatedUrl, { + method: "PUT", + headers: { + "Content-Type": "application/zip", + "Content-Length": String(archive.byteLength), + "X-Tegra-Backup-Id": validBackupId, + "X-Tegra-Server-Id": validServerId, + "X-Tegra-Backup-Sha256": ctx.sha256, + }, + body: archive, + redirect: "error", + signal: AbortSignal.timeout(this.timeoutMs), + }); + + if (!response.ok) { + throw new ProtocolError( + "backup_failed", + `Tegra Cloud upload failed with HTTP ${response.status}`, + ); + } + + const metadata: BackupMetadata = { + id: validBackupId, + server_id: validServerId, + created_at: ctx.createdAt, + size_bytes: archive.byteLength, + sha256: ctx.sha256, + trigger: ctx.trigger, + destination: "tegra_cloud", + ...(ctx.note !== undefined ? { note: ctx.note } : {}), + }; + + const index = this.readIndex(); + const existing = index[validServerId] ?? []; + const retention = + ctx.retentionCount ?? + this.configStore.getServerConfig(validServerId).tegra_cloud.retention_count; + const next = [metadata, ...existing.filter((b) => b.id !== validBackupId)] + .sort((a, b) => b.created_at - a.created_at || b.id.localeCompare(a.id)) + .slice(0, retention); + index[validServerId] = next; + this.writeIndex(index); + + return metadata; + } + + async list(serverId: string): Promise { + const validServerId = serverIdSchema.parse(serverId); + const index = this.readIndex(); + const list = index[validServerId] ?? []; + return [...list].sort((a, b) => b.created_at - a.created_at || b.id.localeCompare(a.id)); + } + + async download( + serverId: string, + backupId: string, + options?: BackupDownloadOptions, + ): Promise { + serverIdSchema.parse(serverId); + backupIdSchema.parse(backupId); + + const rawUrl = options?.presignedDownloadUrl; + if (!rawUrl) { + throw new ProtocolError( + "backup_failed", + "Tegra Cloud restore requires a presigned download URL", + ); + } + + const validatedUrl = validateRemoteHttpsUrl( + rawUrl, + "tegra_cloud_download_url", + this.allowInsecure, + ); + + const response = await this.fetchImpl(validatedUrl, { + method: "GET", + redirect: "error", + signal: AbortSignal.timeout(this.timeoutMs), + }); + + if (response.status === 404) { + throw new ProtocolError("backup_not_found", `Tegra Cloud backup not found: ${backupId}`); + } + if (!response.ok) { + throw new ProtocolError( + "backup_failed", + `Tegra Cloud download failed with HTTP ${response.status}`, + ); + } + + return readResponseBytesCapped(response, this.maxBytes); + } + + async delete(serverId: string, backupId: string): Promise { + const validServerId = serverIdSchema.parse(serverId); + const validBackupId = backupIdSchema.parse(backupId); + const index = this.readIndex(); + const existing = index[validServerId] ?? []; + const next = existing.filter((b) => b.id !== validBackupId); + if (next.length === existing.length) { + throw new ProtocolError("backup_not_found", `Tegra Cloud backup not found: ${validBackupId}`); + } + index[validServerId] = next; + this.writeIndex(index); + } +} diff --git a/src/backup/index.ts b/src/backup/index.ts new file mode 100644 index 0000000..776985e --- /dev/null +++ b/src/backup/index.ts @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +export { + type ArchiveServerDirectoryOptions, + archiveServerDirectory, + type CreateConsistentArchiveOptions, + createConsistentServerArchive, + DEFAULT_SAVE_POLL_INTERVAL_MS, + DEFAULT_SAVE_TIMEOUT_MS, + type RestoreServerArchiveOptions, + restoreServerArchive, + type ServerArchiveResult, + type WaitForSaveOptions, + waitForSaveConfirmation, +} from "./archive"; +export { + BackupConfigStore, + type BackupConfigStoreOptions, + DEFAULT_LOCAL_RETENTION_COUNT, + DEFAULT_S3_RETENTION_COUNT, + DEFAULT_TEGRA_CLOUD_RETENTION_COUNT, + validateRemoteHttpsUrl, +} from "./config"; +export { + DEFAULT_LOCAL_BACKUPS_DIR, + LocalBackupDestination, + type LocalBackupDestinationOptions, +} from "./destinations/local"; +export { + S3BackupDestination, + type S3BackupDestinationOptions, +} from "./destinations/s3"; +export { + type CloudFetchLike, + DEFAULT_TEGRA_CLOUD_MAX_BYTES, + DEFAULT_TEGRA_CLOUD_TIMEOUT_MS, + TegraCloudBackupDestination, + type TegraCloudBackupDestinationOptions, +} from "./destinations/tegra-cloud"; +export { + type BackupManager, + type BackupManagerOptions, + type CreateBackupOptions, + createBackupHook, + createBackupManager, + registerBackupHandlers, +} from "./manager"; +export { + type BackupScheduler, + type BackupSchedulerOptions, + type BackupTimerHandle, + type BackupTimerProvider, + createBackupScheduler, + defaultBackupTimers, +} from "./scheduler"; +export type { + BackupCreateResult, + BackupDeleteDestinationResult, + BackupDeleteResult, + BackupDestination, + BackupDestinationError, + BackupDestinationOutcome, + BackupDownloadOptions, + BackupHook, + BackupListResult, + BackupMetadata, + BackupRestoreResult, + BackupTrigger, + BackupUploadContext, + S3Credentials, + ServerBackupConfig, + ServerBackupS3PublicConfig, + ServerRuntimeProvider, +} from "./types"; diff --git a/src/backup/manager.ts b/src/backup/manager.ts new file mode 100644 index 0000000..94b0c2b --- /dev/null +++ b/src/backup/manager.ts @@ -0,0 +1,535 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { randomBytes } from "node:crypto"; +import type { CommandQueue } from "../agent/jobs"; +import type { Logger } from "../agent/logger"; +import { DEFAULT_SERVERS_BASE_DIR } from "../files"; +import { + type BackupDestinationKind, + backupIdSchema, + ProtocolError, + type ServerBackupConfigSetBody, + type ServerBackupCreateBody, + type ServerBackupDeleteBody, + type ServerBackupListBody, + type ServerBackupRestoreBody, + serverIdSchema, +} from "../protocol"; +import { + type ArchiveServerDirectoryOptions, + createConsistentServerArchive, + restoreServerArchive, + type ServerArchiveResult, +} from "./archive"; +import { BackupConfigStore } from "./config"; +import { DEFAULT_LOCAL_BACKUPS_DIR, LocalBackupDestination } from "./destinations/local"; +import { S3BackupDestination } from "./destinations/s3"; +import { type CloudFetchLike, TegraCloudBackupDestination } from "./destinations/tegra-cloud"; +import { type BackupScheduler, type BackupTimerProvider, createBackupScheduler } from "./scheduler"; +import type { + BackupCreateResult, + BackupDeleteDestinationResult, + BackupDeleteResult, + BackupDestination, + BackupDestinationError, + BackupDestinationOutcome, + BackupHook, + BackupMetadata, + BackupRestoreResult, + BackupTrigger, + ServerBackupConfig, + ServerRuntimeProvider, +} from "./types"; + +function formatBackupId(timestampMs: number): string { + const date = new Date(timestampMs); + const pad = (n: number, width = 2) => String(n).padStart(width, "0"); + const stamp = [ + date.getUTCFullYear(), + pad(date.getUTCMonth() + 1), + pad(date.getUTCDate()), + "-", + pad(date.getUTCHours()), + pad(date.getUTCMinutes()), + pad(date.getUTCSeconds()), + ].join(""); + const rand = randomBytes(4).toString("hex"); + return `bkp-${stamp}-${rand}`; +} + +export interface CreateBackupOptions { + readonly server_id: string; + readonly trigger?: BackupTrigger; + readonly note?: string; + readonly retention_count?: number; + readonly tegra_cloud_upload_url?: string; +} + +export interface BackupManagerOptions { + readonly stateDir: string; + readonly serversBaseDir?: string; + readonly localBackupsDir?: string; + readonly runtime?: ServerRuntimeProvider; + readonly destinations?: readonly BackupDestination[]; + readonly allowInsecure?: boolean; + readonly saveTimeoutMs?: number; + readonly savePollIntervalMs?: number; + readonly cloudTimeoutMs?: number; + readonly cloudMaxBytes?: number; + readonly cloudFetchImpl?: CloudFetchLike; + readonly maxArchiveFiles?: number; + readonly maxArchiveBytes?: number; + readonly timers?: BackupTimerProvider; + readonly now?: () => number; + readonly sleep?: (ms: number) => Promise; + readonly logger?: Logger; + readonly archiveImpl?: (options: ArchiveServerDirectoryOptions) => ServerArchiveResult; +} + +export interface BackupManager { + readonly configStore: BackupConfigStore; + readonly scheduler: BackupScheduler; + getConfig(serverId: string): ServerBackupConfig; + setConfig(params: ServerBackupConfigSetBody): ServerBackupConfig; + createBackup(params: CreateBackupOptions): Promise; + listBackups(params: ServerBackupListBody): Promise<{ + readonly server_id: string; + readonly backups: readonly BackupMetadata[]; + readonly errors: readonly BackupDestinationError[]; + }>; + deleteBackup(params: ServerBackupDeleteBody): Promise; + restoreBackup(params: ServerBackupRestoreBody): Promise; + createBackupHook(): BackupHook; + start(): void; + close(): void; +} + +export function createBackupManager(options: BackupManagerOptions): BackupManager { + const serversBaseDir = options.serversBaseDir ?? DEFAULT_SERVERS_BASE_DIR; + const allowInsecure = options.allowInsecure ?? false; + const now = options.now ?? (() => Date.now()); + + const configStore = new BackupConfigStore({ + stateDir: options.stateDir, + allowInsecure, + }); + + const destinations: readonly BackupDestination[] = options.destinations ?? [ + new LocalBackupDestination({ + backupsDir: options.localBackupsDir ?? DEFAULT_LOCAL_BACKUPS_DIR, + configStore, + }), + new S3BackupDestination({ + configStore, + allowInsecure, + }), + new TegraCloudBackupDestination({ + stateDir: options.stateDir, + configStore, + allowInsecure, + ...(options.cloudTimeoutMs !== undefined ? { timeoutMs: options.cloudTimeoutMs } : {}), + ...(options.cloudMaxBytes !== undefined ? { maxBytes: options.cloudMaxBytes } : {}), + ...(options.cloudFetchImpl !== undefined ? { fetchImpl: options.cloudFetchImpl } : {}), + }), + ]; + + const destinationMap = new Map(); + for (const dest of destinations) { + destinationMap.set(dest.kind, dest); + } + + function getConfig(serverId: string): ServerBackupConfig { + return configStore.getServerConfig(serverId); + } + + async function createBackup(params: CreateBackupOptions): Promise { + const validServerId = serverIdSchema.parse(params.server_id); + const trigger: BackupTrigger = params.trigger ?? "manual"; + const createdAt = now(); + const backupId = formatBackupId(createdAt); + + const enabledDestinations = destinations.filter((d) => d.isEnabled(validServerId)); + if (enabledDestinations.length === 0) { + return { + backup_id: backupId, + server_id: validServerId, + created_at: createdAt, + size_bytes: 0, + sha256: "", + trigger, + destinations: [], + }; + } + + const archiveResult = await createConsistentServerArchive({ + serversBaseDir, + serverId: validServerId, + ...(options.runtime !== undefined ? { runtime: options.runtime } : {}), + ...(options.saveTimeoutMs !== undefined ? { saveTimeoutMs: options.saveTimeoutMs } : {}), + ...(options.savePollIntervalMs !== undefined + ? { savePollIntervalMs: options.savePollIntervalMs } + : {}), + ...(options.maxArchiveFiles !== undefined ? { maxFiles: options.maxArchiveFiles } : {}), + ...(options.maxArchiveBytes !== undefined ? { maxTotalBytes: options.maxArchiveBytes } : {}), + now, + ...(options.sleep !== undefined ? { sleep: options.sleep } : {}), + ...(options.logger !== undefined ? { logger: options.logger } : {}), + ...(options.archiveImpl !== undefined ? { archiveImpl: options.archiveImpl } : {}), + }); + + const outcomes: BackupDestinationOutcome[] = []; + for (const dest of enabledDestinations) { + try { + const meta = await dest.upload(archiveResult.buffer, { + serverId: validServerId, + backupId, + createdAt, + sha256: archiveResult.sha256, + trigger, + ...(params.note !== undefined ? { note: params.note } : {}), + ...(params.retention_count !== undefined + ? { retentionCount: params.retention_count } + : {}), + ...(dest.kind === "tegra_cloud" && params.tegra_cloud_upload_url !== undefined + ? { presignedUploadUrl: params.tegra_cloud_upload_url } + : {}), + }); + outcomes.push({ + destination: dest.kind, + ok: true, + backup: meta, + }); + } catch (err) { + const message = err instanceof Error ? err.message : String(err); + options.logger?.error("Backup destination upload failed", { + serverId: validServerId, + backupId, + destination: dest.kind, + errName: err instanceof Error ? err.name : "Error", + }); + outcomes.push({ + destination: dest.kind, + ok: false, + error: message, + }); + } + } + + return { + backup_id: backupId, + server_id: validServerId, + created_at: createdAt, + size_bytes: archiveResult.buffer.byteLength, + sha256: archiveResult.sha256, + trigger, + destinations: outcomes, + }; + } + + async function listBackups(params: ServerBackupListBody): Promise<{ + readonly server_id: string; + readonly backups: readonly BackupMetadata[]; + readonly errors: readonly BackupDestinationError[]; + }> { + const validServerId = serverIdSchema.parse(params.server_id); + const targets = + params.destination !== undefined + ? ([destinationMap.get(params.destination)].filter( + (d): d is BackupDestination => d !== undefined, + ) as BackupDestination[]) + : destinations.filter((d) => d.isEnabled(validServerId)); + + const allBackups: BackupMetadata[] = []; + const errors: BackupDestinationError[] = []; + + for (const dest of targets) { + try { + const list = await dest.list(validServerId); + allBackups.push(...list); + } catch (err) { + errors.push({ + destination: dest.kind, + error: err instanceof Error ? err.message : String(err), + }); + } + } + + allBackups.sort((a, b) => b.created_at - a.created_at || b.id.localeCompare(a.id)); + return { + server_id: validServerId, + backups: allBackups, + errors, + }; + } + + async function deleteBackup(params: ServerBackupDeleteBody): Promise { + const validServerId = serverIdSchema.parse(params.server_id); + const validBackupId = backupIdSchema.parse(params.backup_id); + + if (params.destination !== undefined) { + const dest = destinationMap.get(params.destination); + if (dest === undefined) { + throw new ProtocolError( + "backup_config_invalid", + `Unknown backup destination: ${params.destination}`, + ); + } + await dest.delete(validServerId, validBackupId); + return { + server_id: validServerId, + backup_id: validBackupId, + results: [{ destination: dest.kind, ok: true }], + }; + } + + const targets = destinations.filter((d) => d.isEnabled(validServerId)); + const results: BackupDeleteDestinationResult[] = []; + let allNotFound = targets.length > 0; + + for (const dest of targets) { + try { + await dest.delete(validServerId, validBackupId); + results.push({ destination: dest.kind, ok: true }); + allNotFound = false; + } catch (err) { + if (!(err instanceof ProtocolError && err.code === "backup_not_found")) { + allNotFound = false; + } + results.push({ + destination: dest.kind, + ok: false, + error: err instanceof Error ? err.message : String(err), + }); + } + } + + if (allNotFound) { + throw new ProtocolError("backup_not_found", `Backup not found: ${validBackupId}`); + } + + return { + server_id: validServerId, + backup_id: validBackupId, + results, + }; + } + + async function resolveRestoreDestination( + serverId: string, + backupId: string, + explicit?: BackupDestinationKind, + ): Promise { + if (explicit !== undefined) { + const dest = destinationMap.get(explicit); + if (dest === undefined) { + throw new ProtocolError("backup_config_invalid", `Unknown backup destination: ${explicit}`); + } + return dest; + } + + for (const dest of destinations) { + if (!dest.isEnabled(serverId)) { + continue; + } + try { + const items = await dest.list(serverId); + if (items.some((item) => item.id === backupId)) { + return dest; + } + } catch { + // Continue checking other destinations + } + } + + const localDest = destinationMap.get("local"); + if (localDest !== undefined) { + return localDest; + } + + throw new ProtocolError("backup_not_found", `Backup not found: ${backupId}`); + } + + async function restoreBackup(params: ServerBackupRestoreBody): Promise { + const validServerId = serverIdSchema.parse(params.server_id); + const validBackupId = backupIdSchema.parse(params.backup_id); + + const sourceDest = await resolveRestoreDestination( + validServerId, + validBackupId, + params.destination, + ); + + const archive = await sourceDest.download(validServerId, validBackupId, { + ...(params.tegra_cloud_download_url !== undefined + ? { presignedDownloadUrl: params.tegra_cloud_download_url } + : {}), + }); + + // Always take a safety backup of the current server state before restoring. + let safetyBackup: BackupCreateResult; + const enabled = destinations.filter((d) => d.isEnabled(validServerId)); + if (enabled.length > 0) { + safetyBackup = await createBackup({ + server_id: validServerId, + trigger: "pre_restore", + note: `Safety backup before restoring ${validBackupId}`, + }); + } else { + const createdAt = now(); + const safetyId = formatBackupId(createdAt); + const localDest = destinationMap.get("local"); + if (localDest !== undefined) { + const currentArchive = await createConsistentServerArchive({ + serversBaseDir, + serverId: validServerId, + ...(options.runtime !== undefined ? { runtime: options.runtime } : {}), + ...(options.saveTimeoutMs !== undefined ? { saveTimeoutMs: options.saveTimeoutMs } : {}), + ...(options.savePollIntervalMs !== undefined + ? { savePollIntervalMs: options.savePollIntervalMs } + : {}), + now, + ...(options.sleep !== undefined ? { sleep: options.sleep } : {}), + ...(options.logger !== undefined ? { logger: options.logger } : {}), + ...(options.archiveImpl !== undefined ? { archiveImpl: options.archiveImpl } : {}), + }); + const meta = await localDest.upload(currentArchive.buffer, { + serverId: validServerId, + backupId: safetyId, + createdAt, + sha256: currentArchive.sha256, + trigger: "pre_restore", + note: `Safety backup before restoring ${validBackupId}`, + }); + safetyBackup = { + backup_id: safetyId, + server_id: validServerId, + created_at: createdAt, + size_bytes: currentArchive.buffer.byteLength, + sha256: currentArchive.sha256, + trigger: "pre_restore", + destinations: [{ destination: "local", ok: true, backup: meta }], + }; + } else { + safetyBackup = { + backup_id: safetyId, + server_id: validServerId, + created_at: createdAt, + size_bytes: 0, + sha256: "", + trigger: "pre_restore", + destinations: [], + }; + } + } + + const extracted = restoreServerArchive({ + serversBaseDir, + serverId: validServerId, + archive, + }); + + return { + server_id: validServerId, + backup_id: validBackupId, + destination: sourceDest.kind, + safety_backup: safetyBackup, + restored_files: extracted.files.length, + restored_bytes: extracted.totalBytes, + }; + } + + const scheduler = createBackupScheduler({ + configStore, + runScheduledBackup: async (serverId, retentionCount) => { + await createBackup({ + server_id: serverId, + trigger: "scheduled", + retention_count: retentionCount, + }); + }, + ...(options.timers !== undefined ? { timers: options.timers } : {}), + ...(options.logger !== undefined ? { logger: options.logger } : {}), + }); + + function setConfig(params: ServerBackupConfigSetBody): ServerBackupConfig { + const updated = configStore.setServerConfig(params); + scheduler.syncServer(updated.server_id, updated.schedule); + return updated; + } + + const manager: BackupManager = { + configStore, + scheduler, + getConfig, + setConfig, + createBackup, + listBackups, + deleteBackup, + restoreBackup, + createBackupHook: () => createBackupHook(manager), + start() { + scheduler.start(); + }, + close() { + scheduler.stop(); + }, + }; + + return manager; +} + +export function createBackupHook(manager: BackupManager): BackupHook { + return { + async beforeChange(serverId: string): Promise { + const validId = serverIdSchema.parse(serverId); + const cfg = manager.getConfig(validId); + if (!cfg.auto_before_change) { + return; + } + await manager.createBackup({ + server_id: validId, + trigger: "before_change", + }); + }, + }; +} + +export function registerBackupHandlers(queue: CommandQueue, manager: BackupManager): void { + queue.registerHandler("server.backup.config.set", (opened, ctx) => { + const body = opened.body as ServerBackupConfigSetBody; + const config = manager.setConfig(body); + ctx.sendEvent("server.backup.config.updated", { config }); + }); + + queue.registerHandler("server.backup.create", async (opened, ctx) => { + const body = opened.body as ServerBackupCreateBody; + const result = await manager.createBackup({ + server_id: body.server_id, + trigger: "manual", + ...(body.note !== undefined ? { note: body.note } : {}), + ...(body.tegra_cloud_upload_url !== undefined + ? { tegra_cloud_upload_url: body.tegra_cloud_upload_url } + : {}), + }); + ctx.sendEvent("server.backup.created", result); + }); + + queue.registerHandler("server.backup.list", async (opened, ctx) => { + const body = opened.body as ServerBackupListBody; + const result = await manager.listBackups(body); + ctx.sendEvent("server.backup.list.result", result); + }); + + queue.registerHandler("server.backup.delete", async (opened, ctx) => { + const body = opened.body as ServerBackupDeleteBody; + const result = await manager.deleteBackup(body); + ctx.sendEvent("server.backup.deleted", result); + }); + + queue.registerHandler("server.backup.restore", async (opened, ctx) => { + const body = opened.body as ServerBackupRestoreBody; + const result = await manager.restoreBackup(body); + ctx.sendEvent("server.backup.restored", result); + }); +} diff --git a/src/backup/scheduler.ts b/src/backup/scheduler.ts new file mode 100644 index 0000000..04ed1a1 --- /dev/null +++ b/src/backup/scheduler.ts @@ -0,0 +1,110 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import type { Logger } from "../agent/logger"; +import type { BackupScheduleConfig } from "../protocol"; +import type { BackupConfigStore } from "./config"; + +export interface BackupTimerHandle { + readonly id?: unknown; +} + +export interface BackupTimerProvider { + setInterval(fn: () => void, ms: number): BackupTimerHandle; + clearInterval(handle: BackupTimerHandle): void; +} + +export const defaultBackupTimers: BackupTimerProvider = { + setInterval(fn, ms) { + const id = setInterval(fn, ms); + return { id }; + }, + clearInterval(handle) { + clearInterval(handle.id as ReturnType); + }, +}; + +export interface BackupSchedulerOptions { + readonly configStore: BackupConfigStore; + readonly runScheduledBackup: (serverId: string, retentionCount: number) => Promise; + readonly timers?: BackupTimerProvider; + readonly logger?: Logger; +} + +export interface BackupScheduler { + start(): void; + syncServer(serverId: string, schedule?: BackupScheduleConfig): void; + stop(): void; + getScheduledServerIds(): string[]; +} + +export function createBackupScheduler(options: BackupSchedulerOptions): BackupScheduler { + const timers = options.timers ?? defaultBackupTimers; + const activeTimers = new Map(); + const inFlight = new Set(); + + function clearServer(serverId: string): void { + const existing = activeTimers.get(serverId); + if (existing !== undefined) { + timers.clearInterval(existing); + activeTimers.delete(serverId); + } + } + + function syncServer(serverId: string, schedule?: BackupScheduleConfig): void { + clearServer(serverId); + if (schedule === undefined || !schedule.enabled) { + return; + } + + const intervalMs = schedule.interval_minutes * 60_000; + const retentionCount = schedule.retention_count; + const handle = timers.setInterval(() => { + if (inFlight.has(serverId)) { + options.logger?.warn("Skipping scheduled backup because previous backup is still running", { + serverId, + }); + return; + } + inFlight.add(serverId); + void options + .runScheduledBackup(serverId, retentionCount) + .catch((err: unknown) => { + options.logger?.error("Scheduled backup failed", { + serverId, + errName: err instanceof Error ? err.name : "Error", + }); + }) + .finally(() => { + inFlight.delete(serverId); + }); + }, intervalMs); + + activeTimers.set(serverId, handle); + } + + function start(): void { + for (const serverId of options.configStore.listConfiguredServerIds()) { + const cfg = options.configStore.getServerConfig(serverId); + syncServer(serverId, cfg.schedule); + } + } + + function stop(): void { + for (const handle of activeTimers.values()) { + timers.clearInterval(handle); + } + activeTimers.clear(); + } + + function getScheduledServerIds(): string[] { + return [...activeTimers.keys()].sort(); + } + + return { + start, + syncServer, + stop, + getScheduledServerIds, + }; +} diff --git a/src/backup/types.ts b/src/backup/types.ts new file mode 100644 index 0000000..3c5eb20 --- /dev/null +++ b/src/backup/types.ts @@ -0,0 +1,141 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import type { BackupDestinationKind, BackupScheduleConfig } from "../protocol"; + +export type BackupTrigger = "manual" | "scheduled" | "before_change" | "pre_restore"; + +export interface BackupMetadata { + readonly id: string; + readonly server_id: string; + readonly created_at: number; + readonly size_bytes: number; + readonly sha256: string; + readonly trigger: BackupTrigger; + readonly destination: BackupDestinationKind; + readonly note?: string | undefined; +} + +export interface BackupUploadContext { + readonly serverId: string; + readonly backupId: string; + readonly createdAt: number; + readonly sha256: string; + readonly trigger: BackupTrigger; + readonly note?: string; + readonly retentionCount?: number; + readonly presignedUploadUrl?: string; +} + +export interface BackupDownloadOptions { + readonly presignedDownloadUrl?: string; +} + +export interface BackupDestination { + readonly kind: BackupDestinationKind; + isEnabled(serverId: string): boolean; + upload(archive: Uint8Array, ctx: BackupUploadContext): Promise; + list(serverId: string): Promise; + download( + serverId: string, + backupId: string, + options?: BackupDownloadOptions, + ): Promise; + delete(serverId: string, backupId: string): Promise; +} + +export interface BackupDestinationOutcome { + readonly destination: BackupDestinationKind; + readonly ok: boolean; + readonly backup?: BackupMetadata; + readonly error?: string; +} + +export interface BackupCreateResult { + readonly backup_id: string; + readonly server_id: string; + readonly created_at: number; + readonly size_bytes: number; + readonly sha256: string; + readonly trigger: BackupTrigger; + readonly destinations: readonly BackupDestinationOutcome[]; +} + +export interface BackupDestinationError { + readonly destination: BackupDestinationKind; + readonly error: string; +} + +export interface BackupListResult { + readonly server_id: string; + readonly backups: readonly BackupMetadata[]; + readonly errors: readonly BackupDestinationError[]; +} + +export interface BackupDeleteDestinationResult { + readonly destination: BackupDestinationKind; + readonly ok: boolean; + readonly error?: string; +} + +export interface BackupDeleteResult { + readonly server_id: string; + readonly backup_id: string; + readonly results: readonly BackupDeleteDestinationResult[]; +} + +export interface BackupRestoreResult { + readonly server_id: string; + readonly backup_id: string; + readonly destination: BackupDestinationKind; + readonly safety_backup?: BackupCreateResult; + readonly restored_files: number; + readonly restored_bytes: number; +} + +/** + * Structural hook invoked before server state changes (e.g. deploy/sync). + */ +export interface BackupHook { + beforeChange(serverId: string): Promise; +} + +/** + * Minimal runtime surface needed by the backup subsystem to coordinate + * world consistency on running Minecraft servers. + */ +export interface ServerRuntimeProvider { + isRunning(serverId: string): Promise; + sendConsole(serverId: string, line: string): void | Promise; +} + +export interface S3Credentials { + readonly access_key_id: string; + readonly secret_access_key: string; + readonly session_token?: string | undefined; +} + +export interface ServerBackupS3PublicConfig { + readonly enabled: boolean; + readonly bucket?: string | undefined; + readonly region?: string | undefined; + readonly endpoint?: string | undefined; + readonly prefix?: string | undefined; + readonly retention_count: number; + readonly credentials_configured: boolean; +} + +export interface ServerBackupConfig { + readonly server_id: string; + readonly auto_before_change: boolean; + readonly schedule?: BackupScheduleConfig | undefined; + readonly local: { + readonly enabled: boolean; + readonly retention_count: number; + }; + readonly s3: ServerBackupS3PublicConfig; + readonly tegra_cloud: { + readonly enabled: boolean; + readonly retention_count: number; + }; +} diff --git a/src/install/units.test.ts b/src/install/units.test.ts index 5cf27ea..6839e57 100644 --- a/src/install/units.test.ts +++ b/src/install/units.test.ts @@ -268,17 +268,43 @@ describe("Security regression checks on install/ assets", () => { const rwTokens = (directives.get("ReadWritePaths") ?? []) .flatMap((line) => line.split(/\s+/)) .filter((t) => t.length > 0); + const renderedRwTokens: string[] = []; for (const token of rwTokens) { const rendered = token .replaceAll("@TEGRAD_BIN_DIR@", "/opt/tegrad/bin") .replaceAll("@TEGRAD_BIN@", "/opt/tegrad/bin/tegrad") .replaceAll("@TEGRAD_STATE_DIR@", "/var/lib/tegrad") .replaceAll("@TEGRAD_SERVERS_DIR@", "/var/lib/tegrad-servers") + .replaceAll("@TEGRAD_BACKUPS_DIR@", "/var/lib/tegrad-backups") .replaceAll("@TEGRAD_RUN_DIR@", "/run/tegrad-server"); + renderedRwTokens.push(rendered); expect(rendered).not.toBe("/opt/tegrad"); expect(rendered).not.toBe("/opt/tegrad/bin"); expect(rendered.startsWith("/opt/tegrad/")).toBe(false); } + expect(renderedRwTokens).toContain("/var/lib/tegrad-backups"); + }); + + test("backup directory /var/lib/tegrad-backups is owned by tegrad with 0700 and isolated from servers", () => { + const script = readInstallFile("install.sh"); + expect(script).toContain('TEGRAD_BACKUPS_DIR="/var/lib/tegrad-backups"'); + expect(script).toContain( + 'install -d -o "$TEGRAD_USER" -g "$TEGRAD_GROUP" -m 0700 "$TEGRAD_BACKUPS_DIR"', + ); + expect(script).toContain('chmod 0700 "$TEGRAD_BACKUPS_DIR"'); + + const serverService = readInstallFile("units/tegrad-server@.service"); + const serverDirectives = parseIniDirectives(serverService); + const serverRw = (serverDirectives.get("ReadWritePaths") ?? []) + .flatMap((line) => line.split(/\s+/)) + .filter((t) => t.length > 0); + for (const token of serverRw) { + const rendered = token + .replaceAll("@TEGRAD_BACKUPS_DIR@", "/var/lib/tegrad-backups") + .replaceAll("@TEGRAD_SERVERS_DIR@", "/var/lib/tegrad-servers"); + expect(rendered).not.toBe("/var/lib/tegrad-backups"); + expect(rendered.startsWith("/var/lib/tegrad-backups/")).toBe(false); + } }); test("tegrad-update.path and tegrad-update.service enforce strict sandboxing and confined ExecStart", () => { diff --git a/src/protocol/commands/backup.ts b/src/protocol/commands/backup.ts new file mode 100644 index 0000000..1d747a6 --- /dev/null +++ b/src/protocol/commands/backup.ts @@ -0,0 +1,173 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; +import { type CommandRegistry, defineCommand } from "../registry"; +import { serverIdSchema } from "./server"; + +export const BACKUP_ID_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/; +export const MIN_BACKUP_INTERVAL_MINUTES = 5; +export const MAX_BACKUP_INTERVAL_MINUTES = 43_200; // 30 days +export const MIN_BACKUP_RETENTION_COUNT = 1; +export const MAX_BACKUP_RETENTION_COUNT = 1000; + +export const backupIdSchema = z + .string() + .regex(BACKUP_ID_REGEX, "backup_id must match ^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"); + +export const backupDestinationKindSchema = z.enum(["local", "s3", "tegra_cloud"]); +export type BackupDestinationKind = z.infer; + +export const backupScheduleConfigSchema = z + .object({ + enabled: z.boolean(), + interval_minutes: z + .number() + .int() + .min(MIN_BACKUP_INTERVAL_MINUTES) + .max(MAX_BACKUP_INTERVAL_MINUTES), + retention_count: z + .number() + .int() + .min(MIN_BACKUP_RETENTION_COUNT) + .max(MAX_BACKUP_RETENTION_COUNT), + }) + .strict(); + +export const backupLocalConfigSchema = z + .object({ + enabled: z.boolean(), + retention_count: z + .number() + .int() + .min(MIN_BACKUP_RETENTION_COUNT) + .max(MAX_BACKUP_RETENTION_COUNT) + .optional(), + }) + .strict(); + +export const backupS3ConfigSchema = z + .object({ + enabled: z.boolean(), + bucket: z.string().min(1).max(255).optional(), + region: z.string().min(1).max(64).optional(), + endpoint: z.string().min(1).max(512).optional(), + prefix: z.string().max(256).optional(), + retention_count: z + .number() + .int() + .min(MIN_BACKUP_RETENTION_COUNT) + .max(MAX_BACKUP_RETENTION_COUNT) + .optional(), + access_key_id: z.string().min(1).max(256).optional(), + secret_access_key: z.string().min(1).max(256).optional(), + session_token: z.string().min(1).max(2048).optional(), + }) + .strict(); + +export const backupTegraCloudConfigSchema = z + .object({ + enabled: z.boolean(), + retention_count: z + .number() + .int() + .min(MIN_BACKUP_RETENTION_COUNT) + .max(MAX_BACKUP_RETENTION_COUNT) + .optional(), + }) + .strict(); + +export const serverBackupConfigSetBodySchema = z + .object({ + server_id: serverIdSchema, + auto_before_change: z.boolean().optional(), + schedule: backupScheduleConfigSchema.optional(), + local: backupLocalConfigSchema.optional(), + s3: backupS3ConfigSchema.optional(), + tegra_cloud: backupTegraCloudConfigSchema.optional(), + }) + .strict(); + +export const serverBackupCreateBodySchema = z + .object({ + server_id: serverIdSchema, + note: z.string().max(256).optional(), + tegra_cloud_upload_url: z.string().min(1).max(4096).optional(), + }) + .strict(); + +export const serverBackupListBodySchema = z + .object({ + server_id: serverIdSchema, + destination: backupDestinationKindSchema.optional(), + }) + .strict(); + +export const serverBackupDeleteBodySchema = z + .object({ + server_id: serverIdSchema, + backup_id: backupIdSchema, + destination: backupDestinationKindSchema.optional(), + }) + .strict(); + +export const serverBackupRestoreBodySchema = z + .object({ + server_id: serverIdSchema, + backup_id: backupIdSchema, + destination: backupDestinationKindSchema.optional(), + tegra_cloud_download_url: z.string().min(1).max(4096).optional(), + }) + .strict(); + +export type BackupScheduleConfig = z.infer; +export type BackupLocalConfig = z.infer; +export type BackupS3ConfigInput = z.infer; +export type BackupTegraCloudConfig = z.infer; +export type ServerBackupConfigSetBody = z.infer; +export type ServerBackupCreateBody = z.infer; +export type ServerBackupListBody = z.infer; +export type ServerBackupDeleteBody = z.infer; +export type ServerBackupRestoreBody = z.infer; + +export const serverBackupConfigSetCommand = defineCommand({ + type: "server.backup.config.set", + sensitive: false, + body: serverBackupConfigSetBodySchema, +}); + +export const serverBackupCreateCommand = defineCommand({ + type: "server.backup.create", + sensitive: false, + body: serverBackupCreateBodySchema, +}); + +export const serverBackupListCommand = defineCommand({ + type: "server.backup.list", + sensitive: false, + body: serverBackupListBodySchema, +}); + +export const serverBackupDeleteCommand = defineCommand({ + type: "server.backup.delete", + sensitive: true, + body: serverBackupDeleteBodySchema, +}); + +export const serverBackupRestoreCommand = defineCommand({ + type: "server.backup.restore", + sensitive: true, + body: serverBackupRestoreBodySchema, +}); + +export const BACKUP_COMMANDS = [ + serverBackupConfigSetCommand, + serverBackupCreateCommand, + serverBackupListCommand, + serverBackupDeleteCommand, + serverBackupRestoreCommand, +] as const; + +export function registerBackupCommands(registry: CommandRegistry): CommandRegistry { + return registry.registerAll(BACKUP_COMMANDS); +} diff --git a/src/protocol/commands/core.ts b/src/protocol/commands/core.ts index f520e3b..41fb843 100644 --- a/src/protocol/commands/core.ts +++ b/src/protocol/commands/core.ts @@ -3,6 +3,7 @@ import { z } from "zod"; import { CommandRegistry, defineCommand } from "../registry"; +import { registerBackupCommands } from "./backup"; import { registerFilesCommands } from "./files"; import { registerPairingCommands } from "./pairing"; import { registerServerCommands, serverIdSchema } from "./server"; @@ -54,9 +55,11 @@ export function registerCoreCommands(registry: CommandRegistry): CommandRegistry } export function createCoreRegistry(): CommandRegistry { - return registerStateCommands( - registerServerCommands( - registerFilesCommands(registerPairingCommands(registerCoreCommands(new CommandRegistry()))), + return registerBackupCommands( + registerStateCommands( + registerServerCommands( + registerFilesCommands(registerPairingCommands(registerCoreCommands(new CommandRegistry()))), + ), ), ); } diff --git a/src/protocol/errors.ts b/src/protocol/errors.ts index 346de7f..7cc4e73 100644 --- a/src/protocol/errors.ts +++ b/src/protocol/errors.ts @@ -41,7 +41,10 @@ export type ProtocolErrorCode = | "plan_expired" | "plan_stale" | "mod_not_found" - | "mod_already_exists"; + | "mod_already_exists" + | "backup_not_found" + | "backup_failed" + | "backup_config_invalid"; export class ProtocolError extends Error { readonly code: ProtocolErrorCode; diff --git a/src/protocol/index.ts b/src/protocol/index.ts index 2f6ecde..d6944f1 100644 --- a/src/protocol/index.ts +++ b/src/protocol/index.ts @@ -17,6 +17,41 @@ export { type OpenedCommand, openCommand, } from "./command"; +export { + BACKUP_COMMANDS, + BACKUP_ID_REGEX, + type BackupDestinationKind, + type BackupLocalConfig, + type BackupS3ConfigInput, + type BackupScheduleConfig, + type BackupTegraCloudConfig, + backupDestinationKindSchema, + backupIdSchema, + backupLocalConfigSchema, + backupS3ConfigSchema, + backupScheduleConfigSchema, + backupTegraCloudConfigSchema, + MAX_BACKUP_INTERVAL_MINUTES, + MAX_BACKUP_RETENTION_COUNT, + MIN_BACKUP_INTERVAL_MINUTES, + MIN_BACKUP_RETENTION_COUNT, + registerBackupCommands, + type ServerBackupConfigSetBody, + type ServerBackupCreateBody, + type ServerBackupDeleteBody, + type ServerBackupListBody, + type ServerBackupRestoreBody, + serverBackupConfigSetBodySchema, + serverBackupConfigSetCommand, + serverBackupCreateBodySchema, + serverBackupCreateCommand, + serverBackupDeleteBodySchema, + serverBackupDeleteCommand, + serverBackupListBodySchema, + serverBackupListCommand, + serverBackupRestoreBodySchema, + serverBackupRestoreCommand, +} from "./commands/backup"; export { agentPingCommand, CORE_COMMANDS, From 86f6b2c55bf334d4650888bceda4a2eb274828cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 22 Nov 2026 20:54:16 -0300 Subject: [PATCH 17/59] feat: add playit headless tunnel manager and protocol commands --- src/protocol/commands/core.ts | 13 +- src/protocol/commands/tunnel.ts | 58 +++++ src/protocol/errors.ts | 6 +- src/protocol/index.ts | 12 + src/tunnel/binary.ts | 303 ++++++++++++++++++++++ src/tunnel/index.ts | 37 +++ src/tunnel/key.ts | 79 ++++++ src/tunnel/playit.test.ts | 429 ++++++++++++++++++++++++++++++++ src/tunnel/playit.ts | 326 ++++++++++++++++++++++++ 9 files changed, 1258 insertions(+), 5 deletions(-) create mode 100644 src/protocol/commands/tunnel.ts create mode 100644 src/tunnel/binary.ts create mode 100644 src/tunnel/index.ts create mode 100644 src/tunnel/key.ts create mode 100644 src/tunnel/playit.test.ts create mode 100644 src/tunnel/playit.ts diff --git a/src/protocol/commands/core.ts b/src/protocol/commands/core.ts index 41fb843..7dd804e 100644 --- a/src/protocol/commands/core.ts +++ b/src/protocol/commands/core.ts @@ -8,6 +8,7 @@ import { registerFilesCommands } from "./files"; import { registerPairingCommands } from "./pairing"; import { registerServerCommands, serverIdSchema } from "./server"; import { registerStateCommands } from "./state"; +import { registerTunnelCommands } from "./tunnel"; const serverIdBodySchema = z.object({ server_id: z.string().min(1), @@ -55,10 +56,14 @@ export function registerCoreCommands(registry: CommandRegistry): CommandRegistry } export function createCoreRegistry(): CommandRegistry { - return registerBackupCommands( - registerStateCommands( - registerServerCommands( - registerFilesCommands(registerPairingCommands(registerCoreCommands(new CommandRegistry()))), + return registerTunnelCommands( + registerBackupCommands( + registerStateCommands( + registerServerCommands( + registerFilesCommands( + registerPairingCommands(registerCoreCommands(new CommandRegistry())), + ), + ), ), ), ); diff --git a/src/protocol/commands/tunnel.ts b/src/protocol/commands/tunnel.ts new file mode 100644 index 0000000..61ec33f --- /dev/null +++ b/src/protocol/commands/tunnel.ts @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; +import { type CommandRegistry, defineCommand } from "../registry"; + +export const PLAYIT_SECRET_KEY_REGEX = /^[0-9a-fA-F]{16,256}$/; + +export const playitSecretKeySchema = z + .string() + .trim() + .regex(PLAYIT_SECRET_KEY_REGEX, "secret_key must be a 16-256 character hexadecimal string") + .refine((value) => value.length % 2 === 0, { + message: "secret_key must have an even number of hexadecimal characters", + }); + +export const tunnelPlayitSetKeyBodySchema = z + .object({ + secret_key: playitSecretKeySchema, + }) + .strict(); + +export type TunnelPlayitSetKeyBody = z.infer; + +export const tunnelPlayitSetKeyCommand = defineCommand({ + type: "tunnel.playit.set_key", + sensitive: true, + body: tunnelPlayitSetKeyBodySchema, +}); + +export const tunnelPlayitStartCommand = defineCommand({ + type: "tunnel.playit.start", + sensitive: false, + body: z.object({}).strict(), +}); + +export const tunnelPlayitStopCommand = defineCommand({ + type: "tunnel.playit.stop", + sensitive: false, + body: z.object({}).strict(), +}); + +export const tunnelPlayitStatusCommand = defineCommand({ + type: "tunnel.playit.status", + sensitive: false, + body: z.object({}).strict(), +}); + +export const TUNNEL_COMMANDS = [ + tunnelPlayitSetKeyCommand, + tunnelPlayitStartCommand, + tunnelPlayitStopCommand, + tunnelPlayitStatusCommand, +] as const; + +export function registerTunnelCommands(registry: CommandRegistry): CommandRegistry { + return registry.registerAll(TUNNEL_COMMANDS); +} diff --git a/src/protocol/errors.ts b/src/protocol/errors.ts index 7cc4e73..621b77b 100644 --- a/src/protocol/errors.ts +++ b/src/protocol/errors.ts @@ -44,7 +44,11 @@ export type ProtocolErrorCode = | "mod_already_exists" | "backup_not_found" | "backup_failed" - | "backup_config_invalid"; + | "backup_config_invalid" + | "tunnel_not_configured" + | "tunnel_already_running" + | "tunnel_not_running" + | "tunnel_failed"; export class ProtocolError extends Error { readonly code: ProtocolErrorCode; diff --git a/src/protocol/index.ts b/src/protocol/index.ts index d6944f1..6f79afd 100644 --- a/src/protocol/index.ts +++ b/src/protocol/index.ts @@ -170,6 +170,18 @@ export { sha1HexSchema, sha512HexSchema, } from "./commands/state"; +export { + PLAYIT_SECRET_KEY_REGEX, + playitSecretKeySchema, + registerTunnelCommands, + TUNNEL_COMMANDS, + type TunnelPlayitSetKeyBody, + tunnelPlayitSetKeyBodySchema, + tunnelPlayitSetKeyCommand, + tunnelPlayitStartCommand, + tunnelPlayitStatusCommand, + tunnelPlayitStopCommand, +} from "./commands/tunnel"; export { DOMAIN_AGENT_MESSAGE, DOMAIN_COMMAND, diff --git a/src/tunnel/binary.ts b/src/tunnel/binary.ts new file mode 100644 index 0000000..8b099b6 --- /dev/null +++ b/src/tunnel/binary.ts @@ -0,0 +1,303 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { createHash, randomBytes } from "node:crypto"; +import { + chmodSync, + closeSync, + existsSync, + fsyncSync, + lstatSync, + mkdirSync, + openSync, + readFileSync, + renameSync, + unlinkSync, + writeFileSync, +} from "node:fs"; +import { basename, dirname, join } from "node:path"; +import { ProtocolError } from "../protocol"; + +export const PLAYIT_VERSION = "v2.0.2"; +export const DEFAULT_PLAYIT_DOWNLOAD_TIMEOUT_MS = 60_000; +export const DEFAULT_PLAYIT_MAX_BINARY_BYTES = 64 * 1024 * 1024; // 64 MiB + +const ALLOWED_DOWNLOAD_HOSTS = new Set([ + "github.com", + "objects.githubusercontent.com", + "release-assets.githubusercontent.com", +]); + +const MAX_REDIRECTS = 5; +const BIN_DIR_MODE = 0o700; +const BIN_FILE_MODE = 0o700; + +export type PlayitPlatform = "linux-x64" | "linux-arm64"; + +export interface PinnedPlayitAsset { + readonly version: string; + readonly platform: PlayitPlatform; + readonly assetName: string; + readonly url: string; + readonly sha256: string; +} + +export const PLAYIT_RELEASE_ASSETS: Readonly> = { + "linux-x64": { + version: PLAYIT_VERSION, + platform: "linux-x64", + assetName: "playit-linux-amd64", + url: `https://github.com/playit-cloud/playit-agent/releases/download/${PLAYIT_VERSION}/playit-linux-amd64`, + sha256: "9d27a8dbb4d2d8a7107fcabfa33028c789a30a64c97a36447fe4afb94e08dde9", + }, + "linux-arm64": { + version: PLAYIT_VERSION, + platform: "linux-arm64", + assetName: "playit-linux-aarch64", + url: `https://github.com/playit-cloud/playit-agent/releases/download/${PLAYIT_VERSION}/playit-linux-aarch64`, + sha256: "aed86fc2b82a772ca0e1d5cddec6c3123f96e12a099f7ae45aaa59a9a430a2cd", + }, +}; + +export type TunnelFetchLike = (input: string | URL, init?: RequestInit) => Promise; + +function isPosix(platform: NodeJS.Platform = process.platform): boolean { + return platform !== "win32"; +} + +export function resolvePlayitPlatform( + platform: NodeJS.Platform = process.platform, + arch: string = process.arch, +): PlayitPlatform { + if (platform !== "linux") { + throw new ProtocolError( + "tunnel_failed", + `Unsupported platform for playit binary: ${platform} (only linux is supported)`, + ); + } + if (arch === "x64") { + return "linux-x64"; + } + if (arch === "arm64") { + return "linux-arm64"; + } + throw new ProtocolError( + "tunnel_failed", + `Unsupported architecture for playit binary: ${arch} (supported: x64, arm64)`, + ); +} + +export function getPlayitBinaryPath(stateDir: string): string { + return join(stateDir, "bin", "playitd"); +} + +export function computeSha256Hex(data: Uint8Array): string { + return createHash("sha256").update(data).digest("hex"); +} + +export function verifyFileSha256(filePath: string, expectedSha256: string): boolean { + const stat = lstatSync(filePath, { throwIfNoEntry: false }); + if (stat === undefined || stat.isSymbolicLink() || !stat.isFile()) { + return false; + } + const bytes = readFileSync(filePath); + const actual = computeSha256Hex(new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength)); + return actual === expectedSha256.toLowerCase(); +} + +function validateDownloadUrl(rawUrl: string, allowInsecure: boolean): URL { + let parsed: URL; + try { + parsed = new URL(rawUrl); + } catch { + throw new ProtocolError("download_failed", `Invalid playit download URL: "${rawUrl}"`); + } + if (parsed.username.length > 0 || parsed.password.length > 0) { + throw new ProtocolError("download_failed", "Playit download URL must not contain credentials"); + } + if (parsed.protocol === "https:") { + if (!ALLOWED_DOWNLOAD_HOSTS.has(parsed.hostname)) { + throw new ProtocolError( + "download_failed", + `Disallowed playit download host: ${parsed.hostname}`, + ); + } + return parsed; + } + const isLoopback = parsed.hostname === "127.0.0.1" || parsed.hostname === "localhost"; + if (allowInsecure && parsed.protocol === "http:" && isLoopback) { + return parsed; + } + throw new ProtocolError("download_failed", `Playit download URL must use https://`); +} + +async function fetchWithValidatedRedirects( + initialUrl: string, + fetchImpl: TunnelFetchLike, + timeoutMs: number, + maxBytes: number, + allowInsecure: boolean, +): Promise { + let currentUrl = validateDownloadUrl(initialUrl, allowInsecure).toString(); + + for (let hop = 0; hop <= MAX_REDIRECTS; hop++) { + const response = await fetchImpl(currentUrl, { + method: "GET", + redirect: "manual", + signal: AbortSignal.timeout(timeoutMs), + }); + + if (response.status >= 300 && response.status < 400) { + const location = response.headers.get("location"); + if (!location) { + throw new ProtocolError("download_failed", "Playit download redirect missing Location"); + } + const nextUrl = new URL(location, currentUrl).toString(); + currentUrl = validateDownloadUrl(nextUrl, allowInsecure).toString(); + continue; + } + + if (!response.ok) { + throw new ProtocolError( + "download_failed", + `Failed to download playit binary (HTTP ${response.status})`, + ); + } + + const declaredLength = response.headers.get("content-length"); + if (declaredLength !== null) { + const parsedLen = Number(declaredLength); + if (Number.isFinite(parsedLen) && parsedLen > maxBytes) { + throw new ProtocolError("download_failed", "Playit binary exceeds maximum size limit"); + } + } + + if (response.body === null) { + return new Uint8Array(0); + } + + const reader = response.body.getReader(); + const chunks: Uint8Array[] = []; + let total = 0; + + try { + while (true) { + const { value, done } = await reader.read(); + if (done) { + break; + } + if (value === undefined || value.byteLength === 0) { + continue; + } + total += value.byteLength; + if (total > maxBytes) { + await reader.cancel(); + throw new ProtocolError("download_failed", "Playit binary exceeds maximum size limit"); + } + chunks.push(value); + } + } finally { + reader.releaseLock(); + } + + const combined = new Uint8Array(total); + let offset = 0; + for (const chunk of chunks) { + combined.set(chunk, offset); + offset += chunk.byteLength; + } + return combined; + } + + throw new ProtocolError("download_failed", "Too many redirects while downloading playit binary"); +} + +function writeExecutableAtomic(filePath: string, data: Uint8Array): void { + const dir = dirname(filePath); + mkdirSync(dir, { recursive: true, mode: BIN_DIR_MODE }); + if (isPosix()) { + chmodSync(dir, BIN_DIR_MODE); + } + + const suffix = randomBytes(8).toString("hex"); + const tmpPath = join(dir, `.tmp-${basename(filePath)}-${process.pid}-${suffix}`); + let fd: number | undefined; + try { + fd = openSync(tmpPath, "wx", BIN_FILE_MODE); + writeFileSync(fd, data); + fsyncSync(fd); + closeSync(fd); + fd = undefined; + if (isPosix()) { + chmodSync(tmpPath, BIN_FILE_MODE); + } + renameSync(tmpPath, filePath); + } catch (err) { + if (fd !== undefined) { + try { + closeSync(fd); + } catch { + // ignore close failure + } + } + try { + if (existsSync(tmpPath)) { + unlinkSync(tmpPath); + } + } catch { + // ignore cleanup failure + } + throw err; + } +} + +export interface EnsurePlayitBinaryOptions { + readonly stateDir: string; + readonly asset?: PinnedPlayitAsset; + readonly platform?: NodeJS.Platform; + readonly arch?: string; + readonly fetchImpl?: TunnelFetchLike; + readonly timeoutMs?: number; + readonly maxBytes?: number; + readonly allowInsecure?: boolean; +} + +/** + * Ensures the pinned playitd binary exists at `/bin/playitd` and + * matches its pinned SHA-256 digest before returning its path. + */ +export async function ensurePlayitBinary(options: EnsurePlayitBinaryOptions): Promise { + const asset = + options.asset ?? PLAYIT_RELEASE_ASSETS[resolvePlayitPlatform(options.platform, options.arch)]; + const binaryPath = getPlayitBinaryPath(options.stateDir); + + if (existsSync(binaryPath)) { + if (verifyFileSha256(binaryPath, asset.sha256)) { + return binaryPath; + } + throw new ProtocolError( + "hash_mismatch", + `Existing playit binary at ${binaryPath} failed SHA-256 verification`, + ); + } + + const fetchImpl = options.fetchImpl ?? ((input, init) => fetch(input, init)); + const bytes = await fetchWithValidatedRedirects( + asset.url, + fetchImpl, + options.timeoutMs ?? DEFAULT_PLAYIT_DOWNLOAD_TIMEOUT_MS, + options.maxBytes ?? DEFAULT_PLAYIT_MAX_BINARY_BYTES, + options.allowInsecure ?? false, + ); + + const actualHash = computeSha256Hex(bytes); + if (actualHash !== asset.sha256.toLowerCase()) { + throw new ProtocolError( + "hash_mismatch", + `Downloaded playit binary SHA-256 mismatch (expected ${asset.sha256}, got ${actualHash})`, + ); + } + + writeExecutableAtomic(binaryPath, bytes); + return binaryPath; +} diff --git a/src/tunnel/index.ts b/src/tunnel/index.ts new file mode 100644 index 0000000..c2f867c --- /dev/null +++ b/src/tunnel/index.ts @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +export { + computeSha256Hex, + DEFAULT_PLAYIT_DOWNLOAD_TIMEOUT_MS, + DEFAULT_PLAYIT_MAX_BINARY_BYTES, + type EnsurePlayitBinaryOptions, + ensurePlayitBinary, + getPlayitBinaryPath, + type PinnedPlayitAsset, + PLAYIT_RELEASE_ASSETS, + PLAYIT_VERSION, + type PlayitPlatform, + resolvePlayitPlatform, + type TunnelFetchLike, + verifyFileSha256, +} from "./binary"; +export { + assertPlayitSecretKey, + getPlayitKeyPath, + hasPlayitSecretKey, + PLAYIT_KEY_FILENAME, + savePlayitSecretKey, +} from "./key"; +export { + buildPlayitSpawnSpec, + createPlayitTunnelManager, + DEFAULT_TUNNEL_STOP_TIMEOUT_MS, + type PlayitSpawnSpec, + type PlayitTunnelManager, + type PlayitTunnelManagerOptions, + type PlayitTunnelStatus, + registerTunnelHandlers, + type SpawnedTunnelProcess, + type TunnelSpawnLike, +} from "./playit"; diff --git a/src/tunnel/key.ts b/src/tunnel/key.ts new file mode 100644 index 0000000..e923ec2 --- /dev/null +++ b/src/tunnel/key.ts @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { existsSync, lstatSync, readFileSync } from "node:fs"; +import { join } from "node:path"; +import { assertStrictPermissions, writeFileAtomic } from "../agent/state"; +import { ProtocolError, playitSecretKeySchema } from "../protocol"; + +export const PLAYIT_KEY_FILENAME = "playit.key"; + +const SECRET_FILE_MODE = 0o600; +const STATE_DIR_MODE = 0o700; + +export function getPlayitKeyPath(stateDir: string): string { + return join(stateDir, PLAYIT_KEY_FILENAME); +} + +/** + * Validates and atomically stores the playit secret key at `/playit.key` + * with strict 0600 permissions. The key is never logged. + */ +export function savePlayitSecretKey(stateDir: string, secretKey: string): string { + const parsed = playitSecretKeySchema.safeParse(secretKey); + if (!parsed.success) { + throw new ProtocolError("invalid_body", "Invalid playit secret key format"); + } + + const keyPath = getPlayitKeyPath(stateDir); + writeFileAtomic(keyPath, `${parsed.data}\n`, { + mode: SECRET_FILE_MODE, + dirMode: STATE_DIR_MODE, + }); + return keyPath; +} + +/** + * Verifies `/playit.key` exists, is not a symlink, enforces 0600 + * permissions on POSIX, and contains a syntactically valid secret key. + * Does not return the key contents. + */ +export function assertPlayitSecretKey(stateDir: string): string { + const keyPath = getPlayitKeyPath(stateDir); + if (!existsSync(keyPath)) { + throw new ProtocolError("tunnel_not_configured", "Playit secret key is not configured"); + } + + const stat = lstatSync(keyPath); + if (stat.isSymbolicLink() || !stat.isFile()) { + throw new ProtocolError("tunnel_failed", "Playit secret key path must be a regular file"); + } + + assertStrictPermissions(keyPath); + + let raw: string; + try { + raw = readFileSync(keyPath, "utf8"); + } catch (err) { + throw new ProtocolError( + "tunnel_failed", + `Failed to read playit secret key: ${err instanceof Error ? err.message : String(err)}`, + ); + } + + const parsed = playitSecretKeySchema.safeParse(raw); + if (!parsed.success) { + throw new ProtocolError("tunnel_failed", "Stored playit secret key is invalid"); + } + + return keyPath; +} + +export function hasPlayitSecretKey(stateDir: string): boolean { + try { + assertPlayitSecretKey(stateDir); + return true; + } catch { + return false; + } +} diff --git a/src/tunnel/playit.test.ts b/src/tunnel/playit.test.ts new file mode 100644 index 0000000..1e24103 --- /dev/null +++ b/src/tunnel/playit.test.ts @@ -0,0 +1,429 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, describe, expect, test } from "bun:test"; +import { chmodSync, existsSync, mkdtempSync, readFileSync, rmSync, statSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { createCommandQueue } from "../agent/jobs"; +import { createLogger } from "../agent/logger"; +import { generateSigningKeyPair, ready, toBase64Url } from "../crypto"; +import { + createCoreRegistry, + createInMemoryTrustContext, + createSignedCommand, + openAgentMessage, + openCommand, + PROTOCOL_VERSION, + ProtocolError, + signSessionCertificate, + type TransportFrame, +} from "../protocol"; +import { + assertPlayitSecretKey, + buildPlayitSpawnSpec, + computeSha256Hex, + createPlayitTunnelManager, + ensurePlayitBinary, + getPlayitBinaryPath, + getPlayitKeyPath, + type PinnedPlayitAsset, + PLAYIT_RELEASE_ASSETS, + PLAYIT_VERSION, + registerTunnelHandlers, + resolvePlayitPlatform, + type SpawnedTunnelProcess, + savePlayitSecretKey, + type TunnelSpawnLike, +} from "./index"; + +const tempDirs: string[] = []; + +function makeTempDir(prefix: string): string { + const dir = mkdtempSync(join(tmpdir(), prefix)); + tempDirs.push(dir); + return dir; +} + +const VALID_HEX_KEY = "a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90"; + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir !== undefined) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +describe("Playit secret key storage and permissions", () => { + test("writes playit.key with 0600 permissions, validates format, and rejects permissive mode on POSIX", () => { + const stateDir = makeTempDir("tegrad-playit-key-"); + const keyPath = savePlayitSecretKey(stateDir, VALID_HEX_KEY); + expect(keyPath).toBe(getPlayitKeyPath(stateDir)); + expect(readFileSync(keyPath, "utf8").trim()).toBe(VALID_HEX_KEY); + expect(assertPlayitSecretKey(stateDir)).toBe(keyPath); + + // Invalid keys rejected + expect(() => savePlayitSecretKey(stateDir, "not-hex-key")).toThrow(ProtocolError); + expect(() => savePlayitSecretKey(stateDir, "abc")).toThrow(ProtocolError); + + if (process.platform !== "win32") { + expect(statSync(keyPath).mode & 0o777).toBe(0o600); + chmodSync(keyPath, 0o644); + expect(() => assertPlayitSecretKey(stateDir)).toThrow(/0600/); + } + }); +}); + +describe("Playit pinned binary download and SHA-256 verification", () => { + test("pins linux-x64 and linux-arm64 release assets with 64-char SHA-256 hashes", () => { + expect(PLAYIT_VERSION).toBe("v2.0.2"); + expect(resolvePlayitPlatform("linux", "x64")).toBe("linux-x64"); + expect(resolvePlayitPlatform("linux", "arm64")).toBe("linux-arm64"); + expect(() => resolvePlayitPlatform("win32", "x64")).toThrow(ProtocolError); + + for (const platform of ["linux-x64", "linux-arm64"] as const) { + const asset = PLAYIT_RELEASE_ASSETS[platform]; + expect(asset.url.startsWith("https://github.com/playit-cloud/playit-agent/")).toBe(true); + expect(asset.sha256).toMatch(/^[0-9a-f]{64}$/); + } + }); + + test("downloads binary, verifies SHA-256 before installing, and rejects tampered bytes", async () => { + const stateDir = makeTempDir("tegrad-playit-bin-"); + const goodBytes = new TextEncoder().encode("#!/bin/sh\necho fake-playitd\n"); + const goodHash = computeSha256Hex(goodBytes); + + const pinnedAsset: PinnedPlayitAsset = { + version: PLAYIT_VERSION, + platform: "linux-x64", + assetName: "playit-linux-amd64", + url: "https://github.com/playit-cloud/playit-agent/releases/download/v2.0.2/playit-linux-amd64", + sha256: goodHash, + }; + + // Tampered download must fail with hash_mismatch and leave no binary on disk + const tamperedDir = makeTempDir("tegrad-playit-bad-"); + await expect( + ensurePlayitBinary({ + stateDir: tamperedDir, + asset: pinnedAsset, + fetchImpl: async () => new Response(new TextEncoder().encode("tampered-binary")), + }), + ).rejects.toThrow(/SHA-256 mismatch/); + expect(existsSync(getPlayitBinaryPath(tamperedDir))).toBe(false); + + // Valid download installs binary and passes subsequent verification without re-downloading + let fetchCount = 0; + const binPath = await ensurePlayitBinary({ + stateDir, + asset: pinnedAsset, + fetchImpl: async () => { + fetchCount++; + return new Response(goodBytes); + }, + }); + expect(binPath).toBe(getPlayitBinaryPath(stateDir)); + expect(fetchCount).toBe(1); + + const cachedPath = await ensurePlayitBinary({ + stateDir, + asset: pinnedAsset, + fetchImpl: async () => { + fetchCount++; + return new Response(goodBytes); + }, + }); + expect(cachedPath).toBe(binPath); + expect(fetchCount).toBe(1); + }); +}); + +describe("Playit process supervision, spawn args/env, and secret redaction", () => { + test("spawns playitd with fixed argv, no shell, minimal env, and never exposes secret key in args/env/logs/status", async () => { + const stateDir = makeTempDir("tegrad-playit-run-"); + const fakeBinBytes = new TextEncoder().encode("fake-playitd-binary"); + const fakeAsset: PinnedPlayitAsset = { + version: PLAYIT_VERSION, + platform: "linux-x64", + assetName: "playit-linux-amd64", + url: "https://github.com/playit-cloud/playit-agent/releases/download/v2.0.2/playit-linux-amd64", + sha256: computeSha256Hex(fakeBinBytes), + }; + + const logLines: string[] = []; + const logger = createLogger({ + level: "debug", + stdout: (line) => logLines.push(line), + stderr: (line) => logLines.push(line), + }); + + let spawnedCmd: readonly string[] | undefined; + let spawnedEnv: Readonly> | undefined; + let resolveExit: ((code: number) => void) | undefined; + const killedSignals: (number | NodeJS.Signals | undefined)[] = []; + + const fakeSpawn: TunnelSpawnLike = (cmd, opts): SpawnedTunnelProcess => { + spawnedCmd = cmd; + spawnedEnv = opts.env; + const exited = new Promise((resolve) => { + resolveExit = resolve; + }); + return { + pid: 4242, + exited, + kill(signal) { + killedSignals.push(signal); + resolveExit?.(0); + }, + }; + }; + + const manager = createPlayitTunnelManager({ + stateDir, + asset: fakeAsset, + platform: "linux", + fetchImpl: async () => new Response(fakeBinBytes), + spawnImpl: fakeSpawn, + now: () => 1_700_000_000_000, + logger, + }); + + // Cannot start before key is set + await expect(manager.start()).rejects.toThrow(ProtocolError); + + manager.setKey(VALID_HEX_KEY); + expect(manager.status()).toMatchObject({ + configured: true, + running: false, + pid: null, + version: PLAYIT_VERSION, + }); + + const started = await manager.start(); + expect(started.running).toBe(true); + expect(started.pid).toBe(4242); + + // Verify fixed argv (no shell, secret passed via --secret-path file, NOT inline) + expect(spawnedCmd).toEqual([ + getPlayitBinaryPath(stateDir), + "--secret-path", + getPlayitKeyPath(stateDir), + "--socket-path", + join(stateDir, "playit.sock"), + "--cert-dir", + join(stateDir, "playit-certs"), + ]); + expect(spawnedCmd?.join(" ")).not.toContain(VALID_HEX_KEY); + + // Verify minimal environment + expect(spawnedEnv).toEqual({ + PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", + LC_ALL: "C", + }); + expect(JSON.stringify(spawnedEnv)).not.toContain(VALID_HEX_KEY); + + // Starting twice fails + await expect(manager.start()).rejects.toThrow(ProtocolError); + + const stopped = await manager.stop(); + expect(stopped.running).toBe(false); + expect(stopped.pid).toBeNull(); + expect(killedSignals).toEqual(["SIGTERM"]); + + // Verify secret key never appears in logs or status + const allLogs = logLines.join("\n"); + expect(allLogs).not.toContain(VALID_HEX_KEY); + expect(JSON.stringify(started)).not.toContain(VALID_HEX_KEY); + expect(JSON.stringify(stopped)).not.toContain(VALID_HEX_KEY); + + // buildPlayitSpawnSpec matches directly + const spec = buildPlayitSpawnSpec({ + binaryPath: "/var/lib/tegrad/bin/playitd", + stateDir: "/var/lib/tegrad", + keyPath: "/var/lib/tegrad/playit.key", + platform: "linux", + }); + expect(spec.args).toEqual([ + "--secret-path", + "/var/lib/tegrad/playit.key", + "--socket-path", + join("/var/lib/tegrad", "playit.sock"), + "--cert-dir", + join("/var/lib/tegrad", "playit-certs"), + ]); + }); +}); + +describe("Tunnel protocol commands and sensitivity enforcement", () => { + test("tunnel.playit.set_key is rejected with session key and accepted with direct account key", async () => { + await ready(); + const agentKeyPair = generateSigningKeyPair(); + const accountKeyPair = generateSigningKeyPair(); + const sessionKeyPair = generateSigningKeyPair(); + const registry = createCoreRegistry(); + const nowMs = 1_700_000_000_000; + + const sessionCert = signSessionCertificate({ + accountKeyPair, + sessionPublicKey: sessionKeyPair.publicKey, + notBefore: nowMs - 1000, + notAfter: nowMs + 60_000, + id: toBase64Url(new Uint8Array(16).fill(7)), + }); + + const trust = createInMemoryTrustContext({ + agentKeyPair, + trustedAccountKeys: [accountKeyPair.publicKey], + now: () => nowMs, + }); + + // Session key rejected for tunnel.playit.set_key + const setKeyWithSession = createSignedCommand( + { + type: "tunnel.playit.set_key", + body: { secret_key: VALID_HEX_KEY }, + agentPublicKey: agentKeyPair.publicKey, + signer: sessionKeyPair, + session: sessionCert, + counter: 1, + now: nowMs, + }, + registry, + ); + try { + await openCommand(setKeyWithSession, trust, registry); + expect.unreachable("Expected sensitive_requires_account_key"); + } catch (err) { + expect(err instanceof ProtocolError && err.code).toBe("sensitive_requires_account_key"); + } + + // Session key accepted for tunnel.playit.status + const statusWithSession = createSignedCommand( + { + type: "tunnel.playit.status", + body: {}, + agentPublicKey: agentKeyPair.publicKey, + signer: sessionKeyPair, + session: sessionCert, + counter: 2, + now: nowMs, + }, + registry, + ); + const openedStatus = await openCommand(statusWithSession, trust, registry); + expect(openedStatus.header.type).toBe("tunnel.playit.status"); + + // Direct account key accepted for tunnel.playit.set_key + const setKeyWithAccount = createSignedCommand( + { + type: "tunnel.playit.set_key", + body: { secret_key: VALID_HEX_KEY }, + agentPublicKey: agentKeyPair.publicKey, + signer: accountKeyPair, + counter: 1, + now: nowMs, + }, + registry, + ); + const openedSetKey = await openCommand(setKeyWithAccount, trust, registry); + expect(openedSetKey.header.type).toBe("tunnel.playit.set_key"); + }); + + test("registerTunnelHandlers executes set_key, status, start, stop via CommandQueue", async () => { + await ready(); + const stateDir = makeTempDir("tegrad-playit-queue-"); + const fakeBinBytes = new TextEncoder().encode("fake-playitd"); + const fakeAsset: PinnedPlayitAsset = { + version: PLAYIT_VERSION, + platform: "linux-x64", + assetName: "playit-linux-amd64", + url: "https://github.com/playit-cloud/playit-agent/releases/download/v2.0.2/playit-linux-amd64", + sha256: computeSha256Hex(fakeBinBytes), + }; + + const agentKeyPair = generateSigningKeyPair(); + const accountKeyPair = generateSigningKeyPair(); + const nowMs = 1_700_000_000_000; + const registry = createCoreRegistry(); + const trust = createInMemoryTrustContext({ + agentKeyPair, + trustedAccountKeys: [accountKeyPair.publicKey], + now: () => nowMs, + }); + + const frames: TransportFrame[] = []; + const logger = createLogger({ level: "error", stdout: () => {}, stderr: () => {} }); + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (frame) => frames.push(frame), + logger, + }); + + const manager = createPlayitTunnelManager({ + stateDir, + asset: fakeAsset, + platform: "linux", + fetchImpl: async () => new Response(fakeBinBytes), + spawnImpl: () => { + let done: ((code: number) => void) | undefined; + return { + pid: 9001, + exited: new Promise((r) => { + done = r; + }), + kill() { + done?.(0); + }, + }; + }, + now: () => nowMs, + }); + registerTunnelHandlers(queue, manager); + + let counter = 1; + const sendCmd = async (type: string, body: unknown) => { + const signed = createSignedCommand( + { + type, + body, + agentPublicKey: agentKeyPair.publicKey, + signer: accountKeyPair, + counter: counter++, + now: nowMs, + }, + registry, + ); + await queue.enqueue({ + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: "agent-1" }, + body: signed, + }); + }; + + await sendCmd("tunnel.playit.set_key", { secret_key: VALID_HEX_KEY }); + await sendCmd("tunnel.playit.start", {}); + await sendCmd("tunnel.playit.status", {}); + await sendCmd("tunnel.playit.stop", {}); + + const events = frames + .filter((f): f is Extract => f.kind === "event") + .map((f) => openAgentMessage(f.body, agentKeyPair.publicKey, accountKeyPair)); + + expect(events.map((e) => e.header.type)).toEqual([ + "tunnel.playit.key_updated", + "tunnel.playit.started", + "tunnel.playit.status.result", + "tunnel.playit.stopped", + ]); + + const acks = frames.filter( + (f): f is Extract => f.kind === "ack", + ); + expect(acks).toHaveLength(4); + expect(acks.every((a) => a.body.ok)).toBe(true); + }); +}); diff --git a/src/tunnel/playit.ts b/src/tunnel/playit.ts new file mode 100644 index 0000000..2834e80 --- /dev/null +++ b/src/tunnel/playit.ts @@ -0,0 +1,326 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { mkdirSync } from "node:fs"; +import { join } from "node:path"; +import type { CommandQueue } from "../agent/jobs"; +import type { Logger } from "../agent/logger"; +import { ProtocolError, type TunnelPlayitSetKeyBody } from "../protocol"; +import { + ensurePlayitBinary, + type PinnedPlayitAsset, + PLAYIT_VERSION, + type TunnelFetchLike, +} from "./binary"; +import { assertPlayitSecretKey, hasPlayitSecretKey, savePlayitSecretKey } from "./key"; + +export const DEFAULT_TUNNEL_STOP_TIMEOUT_MS = 5_000; + +export interface PlayitSpawnSpec { + readonly binaryPath: string; + readonly args: readonly string[]; + readonly env: Readonly>; +} + +export interface SpawnedTunnelProcess { + readonly pid: number; + readonly exited: Promise; + kill(signal?: number | NodeJS.Signals): void; +} + +export type TunnelSpawnLike = ( + cmd: readonly string[], + options: { + readonly stdin: "ignore"; + readonly stdout: "pipe"; + readonly stderr: "pipe"; + readonly env: Readonly>; + }, +) => SpawnedTunnelProcess; + +export interface PlayitTunnelStatus { + readonly configured: boolean; + readonly running: boolean; + readonly pid: number | null; + readonly version: string; + readonly started_at: number | null; + readonly last_exit_code: number | null; + readonly last_error: string | null; +} + +export interface PlayitTunnelManagerOptions { + readonly stateDir: string; + readonly asset?: PinnedPlayitAsset; + readonly platform?: NodeJS.Platform; + readonly arch?: string; + readonly fetchImpl?: TunnelFetchLike; + readonly spawnImpl?: TunnelSpawnLike; + readonly allowInsecure?: boolean; + readonly stopTimeoutMs?: number; + readonly now?: () => number; + readonly logger?: Logger; +} + +export interface PlayitTunnelManager { + setKey(secretKey: string): void; + start(): Promise; + stop(): Promise; + status(): PlayitTunnelStatus; + close(): Promise; +} + +function buildMinimalTunnelEnv( + platform: NodeJS.Platform = process.platform, +): Record { + if (platform === "win32") { + const env: Record = {}; + if (process.env.PATH !== undefined) { + env.PATH = process.env.PATH; + } else if (process.env.Path !== undefined) { + env.PATH = process.env.Path; + } + if (process.env.SystemRoot !== undefined) { + env.SystemRoot = process.env.SystemRoot; + } + return env; + } + + return { + PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", + LC_ALL: "C", + }; +} + +/** + * Builds the fixed argv and minimal environment for spawning playitd headlessly. + * Never invokes a shell and never puts the secret key in argv or environment. + */ +export function buildPlayitSpawnSpec(options: { + readonly binaryPath: string; + readonly stateDir: string; + readonly keyPath: string; + readonly platform?: NodeJS.Platform; +}): PlayitSpawnSpec { + const socketPath = join(options.stateDir, "playit.sock"); + const certDir = join(options.stateDir, "playit-certs"); + + return { + binaryPath: options.binaryPath, + args: ["--secret-path", options.keyPath, "--socket-path", socketPath, "--cert-dir", certDir], + env: buildMinimalTunnelEnv(options.platform), + }; +} + +function defaultSpawn( + cmd: readonly string[], + options: { + readonly stdin: "ignore"; + readonly stdout: "pipe"; + readonly stderr: "pipe"; + readonly env: Readonly>; + }, +): SpawnedTunnelProcess { + const proc = Bun.spawn([...cmd], { + stdin: options.stdin, + stdout: options.stdout, + stderr: options.stderr, + env: { ...options.env }, + }); + return { + pid: proc.pid, + exited: proc.exited, + kill(signal?: number | NodeJS.Signals) { + proc.kill(signal); + }, + }; +} + +export function createPlayitTunnelManager( + options: PlayitTunnelManagerOptions, +): PlayitTunnelManager { + const now = options.now ?? (() => Date.now()); + const spawnImpl = options.spawnImpl ?? defaultSpawn; + const stopTimeoutMs = options.stopTimeoutMs ?? DEFAULT_TUNNEL_STOP_TIMEOUT_MS; + const version = options.asset?.version ?? PLAYIT_VERSION; + + let activeProc: SpawnedTunnelProcess | null = null; + let startedAt: number | null = null; + let lastExitCode: number | null = null; + let lastError: string | null = null; + + function status(): PlayitTunnelStatus { + return { + configured: hasPlayitSecretKey(options.stateDir), + running: activeProc !== null, + pid: activeProc?.pid ?? null, + version, + started_at: startedAt, + last_exit_code: lastExitCode, + last_error: lastError, + }; + } + + function setKey(secretKey: string): void { + savePlayitSecretKey(options.stateDir, secretKey); + lastError = null; + options.logger?.info("Updated playit tunnel secret key", { + configured: true, + }); + } + + async function start(): Promise { + if (activeProc !== null) { + throw new ProtocolError("tunnel_already_running", "Playit tunnel is already running"); + } + + const keyPath = assertPlayitSecretKey(options.stateDir); + const binaryPath = await ensurePlayitBinary({ + stateDir: options.stateDir, + ...(options.asset !== undefined ? { asset: options.asset } : {}), + ...(options.platform !== undefined ? { platform: options.platform } : {}), + ...(options.arch !== undefined ? { arch: options.arch } : {}), + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + ...(options.allowInsecure !== undefined ? { allowInsecure: options.allowInsecure } : {}), + }); + + const certDir = join(options.stateDir, "playit-certs"); + mkdirSync(certDir, { recursive: true, mode: 0o700 }); + + const spec = buildPlayitSpawnSpec({ + binaryPath, + stateDir: options.stateDir, + keyPath, + ...(options.platform !== undefined ? { platform: options.platform } : {}), + }); + + const proc = spawnImpl([spec.binaryPath, ...spec.args], { + stdin: "ignore", + stdout: "pipe", + stderr: "pipe", + env: spec.env, + }); + + activeProc = proc; + startedAt = now(); + lastError = null; + + options.logger?.info("Started playit tunnel process", { + pid: proc.pid, + version, + }); + + void proc.exited + .then((code) => { + if (activeProc === proc) { + activeProc = null; + startedAt = null; + } + lastExitCode = code; + if (code !== 0) { + lastError = `Playit process exited with code ${code}`; + options.logger?.warn("Playit tunnel process exited with non-zero code", { + pid: proc.pid, + code, + }); + } else { + options.logger?.info("Playit tunnel process exited cleanly", { + pid: proc.pid, + code, + }); + } + }) + .catch((err: unknown) => { + if (activeProc === proc) { + activeProc = null; + startedAt = null; + } + lastError = err instanceof Error ? err.message : String(err); + }); + + return status(); + } + + async function stop(): Promise { + if (activeProc === null) { + throw new ProtocolError("tunnel_not_running", "Playit tunnel is not running"); + } + + const proc = activeProc; + try { + proc.kill("SIGTERM"); + } catch { + // Process may have already exited + } + + let timer: ReturnType | undefined; + try { + const exitedInTime = await Promise.race([ + proc.exited.then(() => true), + new Promise((resolve) => { + timer = setTimeout(() => resolve(false), stopTimeoutMs); + }), + ]); + if (!exitedInTime) { + try { + proc.kill("SIGKILL"); + } catch { + // ignore + } + } + } finally { + if (timer !== undefined) { + clearTimeout(timer); + } + } + + if (activeProc === proc) { + activeProc = null; + startedAt = null; + } + + return status(); + } + + async function close(): Promise { + if (activeProc !== null) { + try { + await stop(); + } catch { + // ignore stop errors on shutdown + } + } + } + + return { + setKey, + start, + stop, + status, + close, + }; +} + +export function registerTunnelHandlers(queue: CommandQueue, manager: PlayitTunnelManager): void { + queue.registerHandler("tunnel.playit.set_key", (opened, ctx) => { + const body = opened.body as TunnelPlayitSetKeyBody; + manager.setKey(body.secret_key); + ctx.sendEvent("tunnel.playit.key_updated", { + configured: true, + }); + }); + + queue.registerHandler("tunnel.playit.start", async (_opened, ctx) => { + const current = await manager.start(); + ctx.sendEvent("tunnel.playit.started", current); + }); + + queue.registerHandler("tunnel.playit.stop", async (_opened, ctx) => { + const current = await manager.stop(); + ctx.sendEvent("tunnel.playit.stopped", current); + }); + + queue.registerHandler("tunnel.playit.status", (_opened, ctx) => { + const current = manager.status(); + ctx.sendEvent("tunnel.playit.status.result", current); + }); +} From 8ba569055f6b3e5f0d661e6e5148c82893b2ef51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 22 Nov 2026 20:58:31 -0300 Subject: [PATCH 18/59] feat: wire backup hook, backup handlers, and playit tunnel into agent runtime --- src/cli/run.ts | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/src/cli/run.ts b/src/cli/run.ts index 090dc2c..42c70fe 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -18,11 +18,17 @@ import { type TimerProvider, type WebSocketFactory, } from "../agent"; +import { type BackupManager, createBackupManager, registerBackupHandlers } from "../backup"; import { fingerprint } from "../crypto"; import { FileManager, registerFileCommandHandlers } from "../files"; import { type CommandRegistry, createCoreRegistry, type TransportFrame } from "../protocol"; import { createServerManager, registerServerHandlers, type ServerManager } from "../server"; import { createStateManager, registerStateHandlers, type StateManager } from "../state"; +import { + createPlayitTunnelManager, + type PlayitTunnelManager, + registerTunnelHandlers, +} from "../tunnel"; import { type AutoUpdater, createAutoUpdater } from "../update"; export const SHUTDOWN_DRAIN_TIMEOUT_MS = 10_000; @@ -53,6 +59,8 @@ export interface AgentRuntime { readonly serverManager?: ServerManager; readonly fileManager: FileManager; readonly stateManager: StateManager; + readonly backupManager: BackupManager; + readonly tunnelManager: PlayitTunnelManager; start(): void; shutdown(drainTimeoutMs?: number): Promise; } @@ -60,6 +68,7 @@ export interface AgentRuntime { export interface CreateAgentRuntimeOptions { readonly stateDir: string; readonly serversDir?: string; + readonly backupsDir?: string; readonly runDir?: string; readonly env?: Readonly>; readonly logger?: Logger; @@ -119,6 +128,48 @@ export async function createAgentRuntime( ); registerFileCommandHandlers(queue, fileManager); + const configuredBackupsDir = options.backupsDir ?? env.TEGRAD_BACKUPS_DIR?.trim(); + const backupManager = createBackupManager({ + stateDir: options.stateDir, + logger, + ...(configuredServersDir && configuredServersDir.length > 0 + ? { serversBaseDir: configuredServersDir } + : {}), + ...(configuredBackupsDir && configuredBackupsDir.length > 0 + ? { localBackupsDir: configuredBackupsDir } + : {}), + runtime: { + isRunning: async (serverId: string): Promise => { + try { + const status = await serverManager.getServerStatus(serverId); + return ( + status.systemd.active_state === "active" || status.systemd.active_state === "activating" + ); + } catch { + return false; + } + }, + sendConsole: (serverId: string, line: string): void => { + serverManager.sendConsole(serverId, line); + }, + }, + ...(options.fetch !== undefined ? { cloudFetchImpl: options.fetch } : {}), + ...(options.timers !== undefined + ? { + timers: { + setInterval: (fn: () => void, ms: number) => ({ + id: options.timers?.setInterval(fn, ms), + }), + clearInterval: (handle: { readonly id?: unknown }) => { + options.timers?.clearInterval(handle.id); + }, + }, + } + : {}), + ...(options.now !== undefined ? { now: options.now } : {}), + }); + registerBackupHandlers(queue, backupManager); + const configuredCdnHost = config.tegraCdnHost ?? config.cdnHost; const stateManager = createStateManager({ logger, @@ -126,11 +177,20 @@ export async function createAgentRuntime( ? { serversDir: configuredServersDir } : {}), ...(configuredCdnHost !== undefined ? { cdnHost: configuredCdnHost } : {}), + backupHook: backupManager.createBackupHook(), ...(options.fetch !== undefined ? { fetchImpl: options.fetch } : {}), ...(options.now !== undefined ? { now: options.now } : {}), }); registerStateHandlers(queue, stateManager); + const tunnelManager = createPlayitTunnelManager({ + stateDir: options.stateDir, + logger, + ...(options.fetch !== undefined ? { fetchImpl: options.fetch } : {}), + ...(options.now !== undefined ? { now: options.now } : {}), + }); + registerTunnelHandlers(queue, tunnelManager); + const connection = createAgentConnection({ apiUrl: config.apiUrl, agentId, @@ -172,11 +232,14 @@ export async function createAgentRuntime( ...(serverManager !== undefined ? { serverManager } : {}), fileManager, stateManager, + backupManager, + tunnelManager, start(): void { logger.info("Starting tegrad", { agentId }); connection.start(); updater.start(); + backupManager.start(); }, shutdown(drainTimeoutMs: number = SHUTDOWN_DRAIN_TIMEOUT_MS): Promise { @@ -186,6 +249,8 @@ export async function createAgentRuntime( shutdownPromise = (async () => { logger.info("Shutting down tegrad"); updater.stop(); + backupManager.close(); + await tunnelManager.close(); serverManager?.close(); connection.stop(); const drained = await queue.drain(drainTimeoutMs); From 9dc3046f1fdd70b9e6236c373a97cd3067ac5e55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 22 Nov 2026 21:12:11 -0300 Subject: [PATCH 19/59] fix: harden state, backup, and tunnel security boundaries --- install/install.sh | 8 +- src/backup/archive.ts | 24 ++- src/backup/backup.test.ts | 272 +++++++++++++++++++++++++ src/backup/config.ts | 100 +++++++-- src/backup/destinations/local.ts | 59 +++++- src/backup/destinations/s3.ts | 107 +++++++++- src/backup/destinations/tegra-cloud.ts | 138 ++++++++++--- src/backup/index.ts | 1 + src/backup/manager.ts | 105 +++++----- src/cli/files-wiring.test.ts | 2 + src/files/zip.ts | 9 + src/protocol/commands/backup.ts | 37 +++- src/protocol/commands/state.ts | 37 +++- src/protocol/index.ts | 3 + src/state/download.ts | 102 ++++++---- src/state/manager.ts | 46 ++++- src/state/state.test.ts | 192 +++++++++++++++++ src/tunnel/binary.ts | 179 ++++++++++------ src/tunnel/playit.test.ts | 182 ++++++++++++++++- src/tunnel/playit.ts | 159 +++++++++------ 20 files changed, 1462 insertions(+), 300 deletions(-) diff --git a/install/install.sh b/install/install.sh index 2041dce..1a896b0 100755 --- a/install/install.sh +++ b/install/install.sh @@ -788,8 +788,8 @@ do_uninstall() { _un_yes="$2" if [ "$_un_purge" -eq 1 ] && [ "$_un_yes" -ne 1 ]; then - printf 'WARNING: --purge will permanently delete %s, %s, and users %s/%s.\n' \ - "$TEGRAD_STATE_DIR" "$TEGRAD_SERVERS_DIR" "$TEGRAD_USER" "$TEGRAD_SRV_USER" + printf 'WARNING: --purge will permanently delete %s, %s, %s, and users %s/%s.\n' \ + "$TEGRAD_STATE_DIR" "$TEGRAD_SERVERS_DIR" "$TEGRAD_BACKUPS_DIR" "$TEGRAD_USER" "$TEGRAD_SRV_USER" printf 'Type "yes" to confirm: ' if ! IFS= read -r _un_confirm; then die "Aborted." @@ -851,7 +851,7 @@ do_uninstall() { fi log_info "tegrad uninstalled and purged." else - log_info "tegrad uninstalled. Data in ${TEGRAD_STATE_DIR} and ${TEGRAD_SERVERS_DIR} and system users were preserved." + log_info "tegrad uninstalled. Data in ${TEGRAD_STATE_DIR}, ${TEGRAD_SERVERS_DIR}, and ${TEGRAD_BACKUPS_DIR} and system users were preserved." fi } @@ -944,7 +944,7 @@ main() { else log_info "Root privileges are required to install tegrad. This script will:" log_info " - Create system users/groups: ${TEGRAD_USER}, ${TEGRAD_SRV_USER}" - log_info " - Create directories: ${TEGRAD_BIN_DIR}, ${TEGRAD_STATE_DIR} (0700), ${TEGRAD_SERVERS_DIR} (2770)" + log_info " - Create directories: ${TEGRAD_BIN_DIR}, ${TEGRAD_STATE_DIR} (0700), ${TEGRAD_SERVERS_DIR} (2770), ${TEGRAD_BACKUPS_DIR} (0700)" log_info " - Install binary (${TEGRAD_BIN}), wrapper (${TEGRAD_WRAPPER}), systemd units, tmpfiles.d, polkit rule, and network drop-in" log_info " - Reload systemd and enable/start tegrad.service" fi diff --git a/src/backup/archive.ts b/src/backup/archive.ts index bfd3bfb..632ca04 100644 --- a/src/backup/archive.ts +++ b/src/backup/archive.ts @@ -5,12 +5,12 @@ import { closeSync, constants, existsSync, + fstatSync, lstatSync, openSync, readdirSync, readSync, type Stats, - statSync, } from "node:fs"; import { join } from "node:path"; import type { Logger } from "../agent/logger"; @@ -38,6 +38,7 @@ export const DEFAULT_SAVE_TIMEOUT_MS = 30_000; export const DEFAULT_SAVE_POLL_INTERVAL_MS = 100; const SAVE_CONFIRMATION_PATTERN = /Saved the (?:game|world)/i; +const PROTECTED_RESTORE_PATHS: ReadonlySet = new Set(["start.sh"]); function readAllFromFd(fd: number, maxBytes: number): Uint8Array { const chunks: Uint8Array[] = []; @@ -73,7 +74,7 @@ function getConsoleLogSize(logPath: string): number { if (lstat === undefined || lstat.isSymbolicLink() || !lstat.isFile()) { return 0; } - return statSync(logPath).size; + return lstat.size; } function readLogTailText( @@ -88,7 +89,7 @@ function readLogTailText( return { text: "", nextOffset: fromOffset }; } - const size = statSync(logPath).size; + const size = lstat.size; const effectiveOffset = size < fromOffset ? 0 : fromOffset; const available = size - effectiveOffset; if (available <= 0) { @@ -101,6 +102,10 @@ function readLogTailText( let fd: number | undefined; try { fd = openSync(logPath, openFlags); + const fdStat = fstatSync(fd); + if (!fdStat.isFile()) { + return { text: "", nextOffset: effectiveOffset }; + } const bytesRead = readSync(fd, buf, 0, toRead, effectiveOffset); if (bytesRead <= 0) { return { text: "", nextOffset: effectiveOffset }; @@ -207,7 +212,8 @@ export function archiveServerDirectory( child === RUNTIME_DIR_NAME || child === UPLOAD_STAGING_DIR_NAME || child.startsWith(UPLOAD_STAGING_FILE_PREFIX) || - child.startsWith(".tmp-") + child.startsWith(".tmp-") || + (relDir.length === 0 && child === "start.sh") ) { continue; } @@ -324,8 +330,13 @@ export async function createConsistentServerArchive( }); } - const { realServerRoot } = resolveServerRoot(validId, serversBaseDir); - const logPath = join(realServerRoot, "logs", "console.log"); + const logResolved = resolveConfinedPath({ + serversBaseDir, + serverId: validId, + relPath: "logs/console.log", + allowRoot: false, + }); + const logPath = logResolved.fullPath; const startOffset = getConsoleLogSize(logPath); await options.runtime.sendConsole(validId, "save-off"); @@ -376,6 +387,7 @@ export function restoreServerArchive(options: RestoreServerArchiveOptions): Safe serverId: validId, buffer: options.archive, destPath: "", + forbiddenPaths: PROTECTED_RESTORE_PATHS, ...(options.maxEntries !== undefined ? { maxEntries: options.maxEntries } : {}), ...(options.maxUncompressedBytes !== undefined ? { maxUncompressedBytes: options.maxUncompressedBytes } diff --git a/src/backup/backup.test.ts b/src/backup/backup.test.ts index 510a6b4..0527f0d 100644 --- a/src/backup/backup.test.ts +++ b/src/backup/backup.test.ts @@ -565,6 +565,7 @@ describe("S3 and Tegra Cloud destinations with fake HTTP servers", () => { const manager = createBackupManager({ stateDir, serversBaseDir: serversDir, + localBackupsDir: join(root, "backups"), allowInsecure: true, logger, now: () => { @@ -680,6 +681,7 @@ describe("S3 and Tegra Cloud destinations with fake HTTP servers", () => { const strictManager = createBackupManager({ stateDir: join(root, "state-strict"), serversBaseDir: serversDir, + localBackupsDir: join(root, "backups-strict"), allowInsecure: false, }); strictManager.setConfig({ @@ -698,6 +700,7 @@ describe("S3 and Tegra Cloud destinations with fake HTTP servers", () => { const manager = createBackupManager({ stateDir, serversBaseDir: serversDir, + localBackupsDir: join(root, "backups"), allowInsecure: true, }); manager.setConfig({ @@ -920,3 +923,272 @@ describe("Protocol commands, sensitivity, and server_id validation", () => { expect(acks.every((a) => a.body.ok)).toBe(true); }); }); + +describe("Adversarial backup security checks", () => { + test("never leaks presigned URL query tokens in validation errors, fetch errors, or logs", async () => { + const root = makeTempDir("tegrad-bkp-adv-redact-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + createSampleServer(serversDir, "cloudredact", { "world/level.dat": "v1" }); + + const secretToken = "X-Amz-Signature=TOP_SECRET_PRESIGNED_TOKEN_987654321"; + const logLines: string[] = []; + const logger = createLogger({ + level: "debug", + stdout: (line) => logLines.push(line), + stderr: (line) => logLines.push(line), + }); + + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + allowInsecure: false, + logger, + cloudFetchImpl: async (url) => { + throw new Error(`Simulated network failure for ${String(url)}`); + }, + }); + manager.setConfig({ + server_id: "cloudredact", + local: { enabled: false }, + tegra_cloud: { enabled: true }, + }); + + // 1. Malformed URL with secret query token + const badRes = await manager.createBackup({ + server_id: "cloudredact", + tegra_cloud_upload_url: `not a valid url?${secretToken}`, + }); + expect(badRes.destinations[0]?.ok).toBe(false); + expect(badRes.destinations[0]?.error).not.toContain(secretToken); + + // 2. HTTP URL rejected in strict mode + const httpRes = await manager.createBackup({ + server_id: "cloudredact", + tegra_cloud_upload_url: `http://127.0.0.1:9000/upload?${secretToken}`, + }); + expect(httpRes.destinations[0]?.ok).toBe(false); + expect(httpRes.destinations[0]?.error).not.toContain(secretToken); + + // 3. Valid HTTPS URL whose fetch throws raw error containing the URL + const fetchErrRes = await manager.createBackup({ + server_id: "cloudredact", + tegra_cloud_upload_url: `https://backups.tegra.example/upload?${secretToken}`, + }); + expect(fetchErrRes.destinations[0]?.ok).toBe(false); + expect(fetchErrRes.destinations[0]?.error).not.toContain(secretToken); + + // 4. Download error must also never leak presigned token + try { + await manager.restoreBackup({ + server_id: "cloudredact", + backup_id: "bkp-nonexistent", + destination: "tegra_cloud", + tegra_cloud_download_url: `https://backups.tegra.example/download?${secretToken}`, + }); + expect.unreachable("Expected restore to fail"); + } catch (err) { + const msg = err instanceof Error ? err.message : String(err); + expect(msg).not.toContain(secretToken); + } + + expect(logLines.join("\n")).not.toContain(secretToken); + }); + + test("blocks SSRF private/loopback HTTPS targets, redirects, host allowlist violations, and streaming overflow on Tegra Cloud", async () => { + const root = makeTempDir("tegrad-bkp-adv-ssrf-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + createSampleServer(serversDir, "ssrf", { "world/level.dat": "data" }); + + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + allowInsecure: false, + cloudAllowedHosts: new Set(["backups.tegra.example"]), + cloudMaxBytes: 1024, + cloudFetchImpl: async (input) => { + const url = String(input); + if (url.includes("/redirect")) { + return new Response(null, { + status: 302, + headers: { location: "https://evil.example/steal" }, + }); + } + const stream = new ReadableStream({ + start(controller) { + controller.enqueue(new Uint8Array(600).fill(0x41)); + controller.enqueue(new Uint8Array(600).fill(0x42)); + controller.close(); + }, + }); + return new Response(stream, { status: 200 }); + }, + }); + manager.setConfig({ + server_id: "ssrf", + local: { enabled: false }, + tegra_cloud: { enabled: true }, + }); + + const ssrfUrls = [ + "https://127.0.0.1/upload?sig=1", + "https://169.254.169.254/latest/meta-data/", + "https://10.0.0.1/internal", + "https://192.168.1.1/router", + "https://[::1]/local", + "https://[::ffff:127.0.0.1]/mapped", + "https://localhost/admin", + "https://evil.example/upload", + "https://backups.tegra.example:8443/upload", + ]; + for (const url of ssrfUrls) { + const res = await manager.createBackup({ + server_id: "ssrf", + tegra_cloud_upload_url: url, + }); + expect(res.destinations[0]?.ok).toBe(false); + expect(res.destinations[0]?.error).toMatch( + /not allowed|private or loopback|non-standard port/i, + ); + } + + // Redirect on upload rejected + const redirUpload = await manager.createBackup({ + server_id: "ssrf", + tegra_cloud_upload_url: "https://backups.tegra.example/redirect", + }); + expect(redirUpload.destinations[0]?.ok).toBe(false); + expect(redirUpload.destinations[0]?.error).toMatch(/redirect/i); + + // Redirect on download rejected + await expect( + manager.restoreBackup({ + server_id: "ssrf", + backup_id: "bkp-1", + destination: "tegra_cloud", + tegra_cloud_download_url: "https://backups.tegra.example/redirect", + }), + ).rejects.toMatchObject({ code: "backup_failed" }); + + // Streaming overflow without Content-Length rejected + await expect( + manager.restoreBackup({ + server_id: "ssrf", + backup_id: "bkp-1", + destination: "tegra_cloud", + tegra_cloud_download_url: "https://backups.tegra.example/overflow", + }), + ).rejects.toMatchObject({ code: "backup_failed" }); + }); + + test("rejects traversal in backup_id and S3 bucket/prefix and prevents start.sh overwrite during restore", async () => { + const root = makeTempDir("tegrad-bkp-adv-paths-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + const serverDir = createSampleServer(serversDir, "safe-srv", { + "world/level.dat": "good-world", + "start.sh": "#!/bin/sh\nexec java -jar server.jar nogui\n", + }); + + const evilStartZip = createZipBuffer([ + { name: "start.sh", data: new TextEncoder().encode("#!/bin/sh\necho pwned\n") }, + { name: "world/level.dat", data: new TextEncoder().encode("replaced") }, + ]); + + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + allowInsecure: false, + cloudFetchImpl: async () => new Response(evilStartZip, { status: 200 }), + }); + + // Traversal backup_id rejected + for (const badId of ["../escape", "a/b", "..", ".hidden", "id\\win"]) { + await expect( + manager.deleteBackup({ server_id: "safe-srv", backup_id: badId }), + ).rejects.toThrow(); + } + + // Invalid S3 bucket / prefix rejected + expect(() => + manager.setConfig({ + server_id: "safe-srv", + s3: { + enabled: false, + bucket: "../other-bucket", + }, + }), + ).toThrow(ProtocolError); + + expect(() => + manager.setConfig({ + server_id: "safe-srv", + s3: { + enabled: false, + prefix: "../../other-server", + }, + }), + ).toThrow(ProtocolError); + + // Local backup omits start.sh so restoring an agent-created backup succeeds cleanly + const created = await manager.createBackup({ server_id: "safe-srv" }); + writeFileSync(join(serverDir, "world", "level.dat"), "mutated", "utf8"); + const restored = await manager.restoreBackup({ + server_id: "safe-srv", + backup_id: created.backup_id, + }); + expect(restored.safety_backup?.destinations.some((d) => d.ok)).toBe(true); + expect(readFileSync(join(serverDir, "world", "level.dat"), "utf8")).toBe("good-world"); + + // Remote archive attempting to overwrite start.sh MUST fail closed + await expect( + manager.restoreBackup({ + server_id: "safe-srv", + backup_id: "bkp-remote-evil", + destination: "tegra_cloud", + tegra_cloud_download_url: "https://backups.tegra.example/evil.zip", + }), + ).rejects.toThrow(/protected path/i); + expect(readFileSync(join(serverDir, "start.sh"), "utf8")).toBe( + "#!/bin/sh\nexec java -jar server.jar nogui\n", + ); + }); + + test("fails closed with hash_mismatch when local backup archive is tampered", async () => { + const root = makeTempDir("tegrad-bkp-adv-hash-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + createSampleServer(serversDir, "hashsrv", { "world/level.dat": "original" }); + + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + }); + const created = await manager.createBackup({ server_id: "hashsrv" }); + + // Replace archive bytes with a different valid zip while keeping original metadata hash + const tamperedZip = createZipBuffer([ + { name: "world/level.dat", data: new TextEncoder().encode("tampered") }, + ]); + writeFileSync(join(backupsDir, "hashsrv", `${created.backup_id}.zip`), tamperedZip); + + await expect( + manager.restoreBackup({ + server_id: "hashsrv", + backup_id: created.backup_id, + }), + ).rejects.toMatchObject({ code: "hash_mismatch" }); + expect(readFileSync(join(serversDir, "hashsrv", "world", "level.dat"), "utf8")).toBe( + "original", + ); + }); +}); diff --git a/src/backup/config.ts b/src/backup/config.ts index 0407d8d..dd1ad12 100644 --- a/src/backup/config.ts +++ b/src/backup/config.ts @@ -11,6 +11,9 @@ import { MIN_BACKUP_RETENTION_COUNT, ProtocolError, type ServerBackupConfigSetBody, + s3BucketSchema, + s3PrefixSchema, + s3RegionSchema, serverBackupConfigSetBodySchema, serverIdSchema, } from "../protocol"; @@ -26,10 +29,10 @@ const STATE_DIR_MODE = 0o700; const storedS3ConfigSchema = z .object({ enabled: z.boolean(), - bucket: z.string().min(1).max(255).optional(), - region: z.string().min(1).max(64).optional(), + bucket: s3BucketSchema.optional(), + region: s3RegionSchema.optional(), endpoint: z.string().min(1).max(512).optional(), - prefix: z.string().max(256).optional(), + prefix: s3PrefixSchema.optional(), retention_count: z .number() .int() @@ -90,16 +93,71 @@ const s3CredentialsFileSchema = z }) .strict(); +function isPrivateOrLoopbackIpv4(ip: string): boolean { + const parts = ip.split("."); + if (parts.length !== 4) { + return false; + } + const nums = parts.map((p) => Number(p)); + if (nums.some((n) => !Number.isInteger(n) || n < 0 || n > 255)) { + return false; + } + const a = nums[0] ?? -1; + const b = nums[1] ?? -1; + if (a === 0 || a === 10 || a === 127) return true; + if (a === 169 && b === 254) return true; + if (a === 172 && b >= 16 && b <= 31) return true; + if (a === 192 && b === 168) return true; + if (a === 100 && b >= 64 && b <= 127) return true; + return false; +} + +function isBlockedPrivateOrLoopbackHost(rawHostname: string): boolean { + const host = rawHostname.toLowerCase().replace(/^\[/, "").replace(/\]$/, ""); + if (host === "localhost" || host.endsWith(".localhost")) { + return true; + } + if (/^\d{1,3}(?:\.\d{1,3}){3}$/.test(host)) { + return isPrivateOrLoopbackIpv4(host); + } + if (host.includes(":")) { + if (host === "::" || host === "::1" || /^0*(?::0*){6}:0*1$/.test(host)) { + return true; + } + const mappedV4 = /^::ffff:(\d{1,3}(?:\.\d{1,3}){3})$/.exec(host); + if (mappedV4?.[1] !== undefined) { + return isPrivateOrLoopbackIpv4(mappedV4[1]); + } + const mappedHex = /^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/.exec(host); + if (mappedHex?.[1] !== undefined && mappedHex[2] !== undefined) { + const hi = Number.parseInt(mappedHex[1], 16); + const lo = Number.parseInt(mappedHex[2], 16); + const ip = `${(hi >> 8) & 0xff}.${hi & 0xff}.${(lo >> 8) & 0xff}.${lo & 0xff}`; + return isPrivateOrLoopbackIpv4(ip); + } + const first = host.split(":")[0] ?? ""; + if (/^(?:fc|fd|fe[89ab])/.test(first)) { + return true; + } + } + return false; +} + +export function redactUrlQueryStrings(message: string): string { + return message.replace(/(https?:\/\/[^\s"'<>?]+)\?[^\s"'<>]+/gi, "$1?"); +} + export function validateRemoteHttpsUrl( rawUrl: string, label: string, allowInsecure: boolean, + allowedHosts?: ReadonlySet, ): string { let parsed: URL; try { parsed = new URL(rawUrl); } catch { - throw new ProtocolError("backup_config_invalid", `Invalid ${label}: "${rawUrl}"`); + throw new ProtocolError("backup_config_invalid", `Invalid ${label}`); } if (parsed.username.length > 0 || parsed.password.length > 0) { @@ -110,24 +168,38 @@ export function validateRemoteHttpsUrl( throw new ProtocolError("backup_config_invalid", `${label} must not contain a URL fragment`); } + const host = parsed.hostname.toLowerCase(); + const isLoopback = + host === "localhost" || host === "127.0.0.1" || host === "[::1]" || host === "::1"; + if (parsed.protocol === "https:") { + if (!allowInsecure) { + if (isBlockedPrivateOrLoopbackHost(host)) { + throw new ProtocolError( + "backup_config_invalid", + `${label} must not target a private or loopback address`, + ); + } + if (allowedHosts !== undefined) { + if (parsed.port !== "") { + throw new ProtocolError( + "backup_config_invalid", + `${label} must not specify a non-standard port`, + ); + } + if (!allowedHosts.has(host)) { + throw new ProtocolError("backup_config_invalid", `${label} host is not allowed`); + } + } + } return parsed.toString(); } - const isLoopback = - parsed.hostname === "localhost" || - parsed.hostname === "127.0.0.1" || - parsed.hostname === "[::1]" || - parsed.hostname === "::1"; - if (allowInsecure && parsed.protocol === "http:" && isLoopback) { return parsed.toString(); } - throw new ProtocolError( - "backup_config_invalid", - `${label} must use https:// (got ${parsed.protocol}//${parsed.host})`, - ); + throw new ProtocolError("backup_config_invalid", `${label} must use https://`); } function defaultStoredConfig(): StoredServerBackupConfig { diff --git a/src/backup/destinations/local.ts b/src/backup/destinations/local.ts index 52801d1..7c34bbc 100644 --- a/src/backup/destinations/local.ts +++ b/src/backup/destinations/local.ts @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import { randomBytes } from "node:crypto"; +import { createHash, randomBytes, timingSafeEqual } from "node:crypto"; import { chmodSync, closeSync, @@ -24,10 +24,20 @@ import type { BackupConfigStore } from "../config"; import type { BackupDestination, BackupMetadata, BackupUploadContext } from "../types"; export const DEFAULT_LOCAL_BACKUPS_DIR = "/var/lib/tegrad-backups"; +export const DEFAULT_LOCAL_MAX_BACKUP_BYTES = 2 * 1024 * 1024 * 1024; // 2 GiB const BACKUP_DIR_MODE = 0o700; const BACKUP_FILE_MODE = 0o600; +function sha256Equal(actualHex: string, expectedHex: string): boolean { + const a = Buffer.from(actualHex.toLowerCase(), "hex"); + const b = Buffer.from(expectedHex.toLowerCase(), "hex"); + if (a.byteLength === 0 || a.byteLength !== b.byteLength) { + return false; + } + return timingSafeEqual(a, b); +} + const localMetadataSchema = z .object({ id: backupIdSchema, @@ -205,7 +215,7 @@ export class LocalBackupDestination implements BackupDestination { } async download(serverId: string, backupId: string): Promise { - const { zipPath } = this.getBackupPaths(serverId, backupId); + const { zipPath, metaPath } = this.getBackupPaths(serverId, backupId); const stat = lstatSync(zipPath, { throwIfNoEntry: false }); if (stat === undefined) { throw new ProtocolError("backup_not_found", `Local backup not found: ${backupId}`); @@ -213,21 +223,54 @@ export class LocalBackupDestination implements BackupDestination { if (stat.isSymbolicLink() || !stat.isFile()) { throw new ProtocolError("backup_failed", `Invalid local backup archive: ${backupId}`); } + if (stat.size > DEFAULT_LOCAL_MAX_BACKUP_BYTES) { + throw new ProtocolError("backup_failed", "Local backup archive exceeds maximum allowed size"); + } const buf = readFileSync(zipPath); - return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength); + const bytes = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength); + + const metaStat = lstatSync(metaPath, { throwIfNoEntry: false }); + if (metaStat !== undefined && !metaStat.isSymbolicLink() && metaStat.isFile()) { + let expectedSha256: string | undefined; + try { + const parsed = localMetadataSchema.safeParse(JSON.parse(readFileSync(metaPath, "utf8"))); + if (parsed.success && parsed.data.id === backupId && parsed.data.server_id === serverId) { + expectedSha256 = parsed.data.sha256; + } + } catch { + throw new ProtocolError("backup_failed", `Corrupt local backup metadata: ${backupId}`); + } + if (expectedSha256 !== undefined) { + const actualSha256 = createHash("sha256").update(bytes).digest("hex"); + if (!sha256Equal(actualSha256, expectedSha256)) { + throw new ProtocolError( + "hash_mismatch", + `Local backup failed SHA-256 verification: ${backupId}`, + ); + } + } + } + + return bytes; } async delete(serverId: string, backupId: string): Promise { const { zipPath, metaPath } = this.getBackupPaths(serverId, backupId); - const zipExists = existsSync(zipPath); - const metaExists = existsSync(metaPath); - if (!zipExists && !metaExists) { + const zipStat = lstatSync(zipPath, { throwIfNoEntry: false }); + const metaStat = lstatSync(metaPath, { throwIfNoEntry: false }); + if (zipStat === undefined && metaStat === undefined) { throw new ProtocolError("backup_not_found", `Local backup not found: ${backupId}`); } - if (zipExists) { + if (zipStat !== undefined) { + if (zipStat.isSymbolicLink() || !zipStat.isFile()) { + throw new ProtocolError("backup_failed", `Refusing to delete non-regular backup file`); + } unlinkSync(zipPath); } - if (metaExists) { + if (metaStat !== undefined) { + if (metaStat.isSymbolicLink() || !metaStat.isFile()) { + throw new ProtocolError("backup_failed", `Refusing to delete non-regular metadata file`); + } unlinkSync(metaPath); } } diff --git a/src/backup/destinations/s3.ts b/src/backup/destinations/s3.ts index 5b091d3..5bce0fa 100644 --- a/src/backup/destinations/s3.ts +++ b/src/backup/destinations/s3.ts @@ -1,11 +1,60 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda +import { createHash, timingSafeEqual } from "node:crypto"; import { z } from "zod"; import { backupIdSchema, ProtocolError, serverIdSchema } from "../../protocol"; import { type BackupConfigStore, validateRemoteHttpsUrl } from "../config"; import type { BackupDestination, BackupMetadata, BackupUploadContext } from "../types"; +export const DEFAULT_S3_MAX_BACKUP_BYTES = 2 * 1024 * 1024 * 1024; // 2 GiB + +function sha256Equal(actualHex: string, expectedHex: string): boolean { + const a = Buffer.from(actualHex.toLowerCase(), "hex"); + const b = Buffer.from(expectedHex.toLowerCase(), "hex"); + if (a.byteLength === 0 || a.byteLength !== b.byteLength) { + return false; + } + return timingSafeEqual(a, b); +} + +async function readStreamCapped( + stream: ReadableStream, + maxBytes: number, +): Promise { + const reader = stream.getReader(); + const chunks: Uint8Array[] = []; + let total = 0; + + try { + while (true) { + const { value, done } = await reader.read(); + if (done) { + break; + } + if (value === undefined || value.byteLength === 0) { + continue; + } + total += value.byteLength; + if (total > maxBytes) { + await reader.cancel(); + throw new ProtocolError("backup_failed", "S3 backup download exceeds maximum allowed size"); + } + chunks.push(value); + } + } finally { + reader.releaseLock(); + } + + const out = new Uint8Array(total); + let offset = 0; + for (const chunk of chunks) { + out.set(chunk, offset); + offset += chunk.byteLength; + } + return out; +} + const s3MetadataSchema = z .object({ id: backupIdSchema, @@ -37,16 +86,19 @@ function normalizePrefix(prefix: string | undefined): string { export interface S3BackupDestinationOptions { readonly configStore: BackupConfigStore; readonly allowInsecure?: boolean; + readonly maxBytes?: number; } export class S3BackupDestination implements BackupDestination { readonly kind = "s3" as const; private readonly configStore: BackupConfigStore; private readonly allowInsecure: boolean; + private readonly maxBytes: number; constructor(options: S3BackupDestinationOptions) { this.configStore = options.configStore; this.allowInsecure = options.allowInsecure ?? false; + this.maxBytes = options.maxBytes ?? DEFAULT_S3_MAX_BACKUP_BYTES; } isEnabled(serverId: string): boolean { @@ -136,7 +188,11 @@ export class S3BackupDestination implements BackupDestination { const { client, prefix, retentionCount } = this.createClient(validServerId); const key = this.archiveKey(prefix, validServerId, validBackupId); - await client.write(key, archive, { type: "application/zip" }); + try { + await client.write(key, archive, { type: "application/zip" }); + } catch { + throw new ProtocolError("backup_failed", "Failed to upload backup archive to S3"); + } const metadata: BackupMetadata = { id: validBackupId, @@ -166,7 +222,11 @@ export class S3BackupDestination implements BackupDestination { } } - await this.writeIndex(client, prefix, validServerId, kept); + try { + await this.writeIndex(client, prefix, validServerId, kept); + } catch { + throw new ProtocolError("backup_failed", "Failed to update S3 backup index"); + } return metadata; } @@ -184,12 +244,39 @@ export class S3BackupDestination implements BackupDestination { const { client, prefix } = this.createClient(validServerId); const key = this.archiveKey(prefix, validServerId, validBackupId); - const exists = await client.exists(key); + let exists: boolean; + try { + exists = await client.exists(key); + } catch { + throw new ProtocolError("backup_failed", "Failed to check S3 backup existence"); + } if (!exists) { throw new ProtocolError("backup_not_found", `S3 backup not found: ${validBackupId}`); } - return client.file(key).bytes(); + let bytes: Uint8Array; + try { + bytes = await readStreamCapped(client.file(key).stream(), this.maxBytes); + } catch (err) { + if (err instanceof ProtocolError) { + throw err; + } + throw new ProtocolError("backup_failed", "Failed to download backup archive from S3"); + } + + const index = await this.readIndex(client, prefix, validServerId); + const indexed = index.find((entry) => entry.id === validBackupId); + if (indexed !== undefined) { + const actualSha256 = createHash("sha256").update(bytes).digest("hex"); + if (!sha256Equal(actualSha256, indexed.sha256)) { + throw new ProtocolError( + "hash_mismatch", + `S3 backup failed SHA-256 verification: ${validBackupId}`, + ); + } + } + + return bytes; } async delete(serverId: string, backupId: string): Promise { @@ -198,9 +285,17 @@ export class S3BackupDestination implements BackupDestination { const { client, prefix } = this.createClient(validServerId); const key = this.archiveKey(prefix, validServerId, validBackupId); - await client.delete(key); + try { + await client.delete(key); + } catch { + throw new ProtocolError("backup_failed", "Failed to delete backup archive from S3"); + } const existing = await this.readIndex(client, prefix, validServerId); const next = existing.filter((b) => b.id !== validBackupId); - await this.writeIndex(client, prefix, validServerId, next); + try { + await this.writeIndex(client, prefix, validServerId, next); + } catch { + throw new ProtocolError("backup_failed", "Failed to update S3 backup index"); + } } } diff --git a/src/backup/destinations/tegra-cloud.ts b/src/backup/destinations/tegra-cloud.ts index c62480e..a7281b6 100644 --- a/src/backup/destinations/tegra-cloud.ts +++ b/src/backup/destinations/tegra-cloud.ts @@ -1,6 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda +import { createHash, timingSafeEqual } from "node:crypto"; import { existsSync, readFileSync } from "node:fs"; import { join } from "node:path"; import { z } from "zod"; @@ -62,11 +63,21 @@ export interface TegraCloudBackupDestinationOptions { readonly stateDir: string; readonly configStore: BackupConfigStore; readonly allowInsecure?: boolean; + readonly allowedHosts?: ReadonlySet; readonly timeoutMs?: number; readonly maxBytes?: number; readonly fetchImpl?: CloudFetchLike; } +function sha256Equal(actualHex: string, expectedHex: string): boolean { + const a = Buffer.from(actualHex.toLowerCase(), "hex"); + const b = Buffer.from(expectedHex.toLowerCase(), "hex"); + if (a.byteLength === 0 || a.byteLength !== b.byteLength) { + return false; + } + return timingSafeEqual(a, b); +} + async function readResponseBytesCapped(response: Response, maxBytes: number): Promise { const contentLengthHeader = response.headers.get("content-length"); if (contentLengthHeader !== null) { @@ -80,7 +91,14 @@ async function readResponseBytesCapped(response: Response, maxBytes: number): Pr } if (response.body === null) { - return new Uint8Array(0); + const buf = new Uint8Array(await response.arrayBuffer()); + if (buf.byteLength > maxBytes) { + throw new ProtocolError( + "backup_failed", + `Tegra Cloud download exceeds maximum allowed size (${maxBytes} bytes)`, + ); + } + return buf; } const reader = response.body.getReader(); @@ -124,6 +142,7 @@ export class TegraCloudBackupDestination implements BackupDestination { readonly indexPath: string; private readonly configStore: BackupConfigStore; private readonly allowInsecure: boolean; + private readonly allowedHosts: ReadonlySet | undefined; private readonly timeoutMs: number; private readonly maxBytes: number; private readonly fetchImpl: CloudFetchLike; @@ -132,6 +151,7 @@ export class TegraCloudBackupDestination implements BackupDestination { this.indexPath = join(options.stateDir, "backup-cloud-index.json"); this.configStore = options.configStore; this.allowInsecure = options.allowInsecure ?? false; + this.allowedHosts = options.allowedHosts; this.timeoutMs = options.timeoutMs ?? DEFAULT_TEGRA_CLOUD_TIMEOUT_MS; this.maxBytes = options.maxBytes ?? DEFAULT_TEGRA_CLOUD_MAX_BYTES; this.fetchImpl = options.fetchImpl ?? ((input, init) => fetch(input, init)); @@ -192,23 +212,39 @@ export class TegraCloudBackupDestination implements BackupDestination { ctx.presignedUploadUrl, "tegra_cloud_upload_url", this.allowInsecure, + this.allowedHosts, ); - const response = await this.fetchImpl(validatedUrl, { - method: "PUT", - headers: { - "Content-Type": "application/zip", - "Content-Length": String(archive.byteLength), - "X-Tegra-Backup-Id": validBackupId, - "X-Tegra-Server-Id": validServerId, - "X-Tegra-Backup-Sha256": ctx.sha256, - }, - body: archive, - redirect: "error", - signal: AbortSignal.timeout(this.timeoutMs), - }); + const controller = new AbortController(); + const timer = setTimeout(() => controller.abort(), this.timeoutMs); + let response: Response; + try { + response = await this.fetchImpl(validatedUrl, { + method: "PUT", + headers: { + "Content-Type": "application/zip", + "Content-Length": String(archive.byteLength), + "X-Tegra-Backup-Id": validBackupId, + "X-Tegra-Server-Id": validServerId, + "X-Tegra-Backup-Sha256": ctx.sha256, + }, + body: archive, + redirect: "manual", + signal: controller.signal, + }); + } catch { + throw new ProtocolError("backup_failed", "Tegra Cloud upload request failed"); + } finally { + clearTimeout(timer); + } + + if (response.status >= 300 && response.status < 400) { + void response.body?.cancel().catch(() => {}); + throw new ProtocolError("backup_failed", "Tegra Cloud upload redirects are not allowed"); + } if (!response.ok) { + void response.body?.cancel().catch(() => {}); throw new ProtocolError( "backup_failed", `Tegra Cloud upload failed with HTTP ${response.status}`, @@ -252,8 +288,8 @@ export class TegraCloudBackupDestination implements BackupDestination { backupId: string, options?: BackupDownloadOptions, ): Promise { - serverIdSchema.parse(serverId); - backupIdSchema.parse(backupId); + const validServerId = serverIdSchema.parse(serverId); + const validBackupId = backupIdSchema.parse(backupId); const rawUrl = options?.presignedDownloadUrl; if (!rawUrl) { @@ -267,25 +303,69 @@ export class TegraCloudBackupDestination implements BackupDestination { rawUrl, "tegra_cloud_download_url", this.allowInsecure, + this.allowedHosts, ); - const response = await this.fetchImpl(validatedUrl, { - method: "GET", - redirect: "error", - signal: AbortSignal.timeout(this.timeoutMs), - }); + const controller = new AbortController(); + const timer = setTimeout(() => controller.abort(), this.timeoutMs); + let bytes: Uint8Array; + try { + let response: Response; + try { + response = await this.fetchImpl(validatedUrl, { + method: "GET", + redirect: "manual", + signal: controller.signal, + }); + } catch { + throw new ProtocolError("backup_failed", "Tegra Cloud download request failed"); + } - if (response.status === 404) { - throw new ProtocolError("backup_not_found", `Tegra Cloud backup not found: ${backupId}`); + if (response.status >= 300 && response.status < 400) { + void response.body?.cancel().catch(() => {}); + throw new ProtocolError("backup_failed", "Tegra Cloud download redirects are not allowed"); + } + + if (response.status === 404) { + void response.body?.cancel().catch(() => {}); + throw new ProtocolError( + "backup_not_found", + `Tegra Cloud backup not found: ${validBackupId}`, + ); + } + if (!response.ok) { + void response.body?.cancel().catch(() => {}); + throw new ProtocolError( + "backup_failed", + `Tegra Cloud download failed with HTTP ${response.status}`, + ); + } + + try { + bytes = await readResponseBytesCapped(response, this.maxBytes); + } catch (err) { + if (err instanceof ProtocolError) { + throw err; + } + throw new ProtocolError("backup_failed", "Tegra Cloud download stream failed"); + } + } finally { + clearTimeout(timer); } - if (!response.ok) { - throw new ProtocolError( - "backup_failed", - `Tegra Cloud download failed with HTTP ${response.status}`, - ); + + const index = this.readIndex(); + const indexed = (index[validServerId] ?? []).find((entry) => entry.id === validBackupId); + if (indexed !== undefined) { + const actualSha256 = createHash("sha256").update(bytes).digest("hex"); + if (!sha256Equal(actualSha256, indexed.sha256)) { + throw new ProtocolError( + "hash_mismatch", + `Tegra Cloud backup failed SHA-256 verification: ${validBackupId}`, + ); + } } - return readResponseBytesCapped(response, this.maxBytes); + return bytes; } async delete(serverId: string, backupId: string): Promise { diff --git a/src/backup/index.ts b/src/backup/index.ts index 776985e..b3cd06d 100644 --- a/src/backup/index.ts +++ b/src/backup/index.ts @@ -20,6 +20,7 @@ export { DEFAULT_LOCAL_RETENTION_COUNT, DEFAULT_S3_RETENTION_COUNT, DEFAULT_TEGRA_CLOUD_RETENTION_COUNT, + redactUrlQueryStrings, validateRemoteHttpsUrl, } from "./config"; export { diff --git a/src/backup/manager.ts b/src/backup/manager.ts index 94b0c2b..34bf4fb 100644 --- a/src/backup/manager.ts +++ b/src/backup/manager.ts @@ -22,7 +22,7 @@ import { restoreServerArchive, type ServerArchiveResult, } from "./archive"; -import { BackupConfigStore } from "./config"; +import { BackupConfigStore, redactUrlQueryStrings } from "./config"; import { DEFAULT_LOCAL_BACKUPS_DIR, LocalBackupDestination } from "./destinations/local"; import { S3BackupDestination } from "./destinations/s3"; import { type CloudFetchLike, TegraCloudBackupDestination } from "./destinations/tegra-cloud"; @@ -77,7 +77,9 @@ export interface BackupManagerOptions { readonly savePollIntervalMs?: number; readonly cloudTimeoutMs?: number; readonly cloudMaxBytes?: number; + readonly cloudAllowedHosts?: ReadonlySet; readonly cloudFetchImpl?: CloudFetchLike; + readonly s3MaxBytes?: number; readonly maxArchiveFiles?: number; readonly maxArchiveBytes?: number; readonly timers?: BackupTimerProvider; @@ -123,11 +125,15 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage new S3BackupDestination({ configStore, allowInsecure, + ...(options.s3MaxBytes !== undefined ? { maxBytes: options.s3MaxBytes } : {}), }), new TegraCloudBackupDestination({ stateDir: options.stateDir, configStore, allowInsecure, + ...(options.cloudAllowedHosts !== undefined + ? { allowedHosts: options.cloudAllowedHosts } + : {}), ...(options.cloudTimeoutMs !== undefined ? { timeoutMs: options.cloudTimeoutMs } : {}), ...(options.cloudMaxBytes !== undefined ? { maxBytes: options.cloudMaxBytes } : {}), ...(options.cloudFetchImpl !== undefined ? { fetchImpl: options.cloudFetchImpl } : {}), @@ -201,7 +207,7 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage backup: meta, }); } catch (err) { - const message = err instanceof Error ? err.message : String(err); + const message = redactUrlQueryStrings(err instanceof Error ? err.message : String(err)); options.logger?.error("Backup destination upload failed", { serverId: validServerId, backupId, @@ -250,7 +256,7 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage } catch (err) { errors.push({ destination: dest.kind, - error: err instanceof Error ? err.message : String(err), + error: redactUrlQueryStrings(err instanceof Error ? err.message : String(err)), }); } } @@ -299,7 +305,7 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage results.push({ destination: dest.kind, ok: false, - error: err instanceof Error ? err.message : String(err), + error: redactUrlQueryStrings(err instanceof Error ? err.message : String(err)), }); } } @@ -367,60 +373,63 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage }); // Always take a safety backup of the current server state before restoring. - let safetyBackup: BackupCreateResult; + let safetyBackup: BackupCreateResult | undefined; const enabled = destinations.filter((d) => d.isEnabled(validServerId)); if (enabled.length > 0) { - safetyBackup = await createBackup({ + const candidate = await createBackup({ server_id: validServerId, trigger: "pre_restore", note: `Safety backup before restoring ${validBackupId}`, }); - } else { + if (candidate.destinations.some((d) => d.ok)) { + safetyBackup = candidate; + } + } + + if (safetyBackup === undefined) { const createdAt = now(); const safetyId = formatBackupId(createdAt); const localDest = destinationMap.get("local"); - if (localDest !== undefined) { - const currentArchive = await createConsistentServerArchive({ - serversBaseDir, - serverId: validServerId, - ...(options.runtime !== undefined ? { runtime: options.runtime } : {}), - ...(options.saveTimeoutMs !== undefined ? { saveTimeoutMs: options.saveTimeoutMs } : {}), - ...(options.savePollIntervalMs !== undefined - ? { savePollIntervalMs: options.savePollIntervalMs } - : {}), - now, - ...(options.sleep !== undefined ? { sleep: options.sleep } : {}), - ...(options.logger !== undefined ? { logger: options.logger } : {}), - ...(options.archiveImpl !== undefined ? { archiveImpl: options.archiveImpl } : {}), - }); - const meta = await localDest.upload(currentArchive.buffer, { - serverId: validServerId, - backupId: safetyId, - createdAt, - sha256: currentArchive.sha256, - trigger: "pre_restore", - note: `Safety backup before restoring ${validBackupId}`, - }); - safetyBackup = { - backup_id: safetyId, - server_id: validServerId, - created_at: createdAt, - size_bytes: currentArchive.buffer.byteLength, - sha256: currentArchive.sha256, - trigger: "pre_restore", - destinations: [{ destination: "local", ok: true, backup: meta }], - }; - } else { - safetyBackup = { - backup_id: safetyId, - server_id: validServerId, - created_at: createdAt, - size_bytes: 0, - sha256: "", - trigger: "pre_restore", - destinations: [], - }; + if (localDest === undefined) { + throw new ProtocolError( + "backup_failed", + "Failed to create pre-restore safety backup before restoring", + ); } + const currentArchive = await createConsistentServerArchive({ + serversBaseDir, + serverId: validServerId, + ...(options.runtime !== undefined ? { runtime: options.runtime } : {}), + ...(options.saveTimeoutMs !== undefined ? { saveTimeoutMs: options.saveTimeoutMs } : {}), + ...(options.savePollIntervalMs !== undefined + ? { savePollIntervalMs: options.savePollIntervalMs } + : {}), + ...(options.maxArchiveFiles !== undefined ? { maxFiles: options.maxArchiveFiles } : {}), + ...(options.maxArchiveBytes !== undefined + ? { maxTotalBytes: options.maxArchiveBytes } + : {}), + now, + ...(options.sleep !== undefined ? { sleep: options.sleep } : {}), + ...(options.logger !== undefined ? { logger: options.logger } : {}), + ...(options.archiveImpl !== undefined ? { archiveImpl: options.archiveImpl } : {}), + }); + const meta = await localDest.upload(currentArchive.buffer, { + serverId: validServerId, + backupId: safetyId, + createdAt, + sha256: currentArchive.sha256, + trigger: "pre_restore", + note: `Safety backup before restoring ${validBackupId}`, + }); + safetyBackup = { + backup_id: safetyId, + server_id: validServerId, + created_at: createdAt, + size_bytes: currentArchive.buffer.byteLength, + sha256: currentArchive.sha256, + trigger: "pre_restore", + destinations: [{ destination: "local", ok: true, backup: meta }], + }; } const extracted = restoreServerArchive({ diff --git a/src/cli/files-wiring.test.ts b/src/cli/files-wiring.test.ts index 0efeceb..055d18f 100644 --- a/src/cli/files-wiring.test.ts +++ b/src/cli/files-wiring.test.ts @@ -67,6 +67,7 @@ interface Harness { async function createHarness(serverId = "srv-1"): Promise { const stateDir = makeTempDir("tegrad-files-state-"); const serversDir = makeTempDir("tegrad-files-servers-"); + const backupsDir = makeTempDir("tegrad-files-backups-"); mkdirSync(join(serversDir, serverId), { recursive: true }); const agent = await loadOrCreateIdentity(stateDir); @@ -93,6 +94,7 @@ async function createHarness(serverId = "srv-1"): Promise { const wsRuntime = await createAgentRuntime({ stateDir, serversDir, + backupsDir, logger: createLogger({ level: "error", stdout: () => {}, stderr: () => {} }), now: () => now, webSocketFactory: () => { diff --git a/src/files/zip.ts b/src/files/zip.ts index 13725ba..9e9b543 100644 --- a/src/files/zip.ts +++ b/src/files/zip.ts @@ -296,6 +296,7 @@ export interface SafeUnzipOptions { readonly maxEntryBytes?: number; readonly maxCompressionRatio?: number; readonly ratioMinBytes?: number; + readonly forbiddenPaths?: ReadonlySet; } export interface SafeUnzipBufferOptions extends SafeUnzipOptions { @@ -370,6 +371,10 @@ export function safeUnzipBuffer(options: SafeUnzipBufferOptions): SafeUnzipResul const maxEntryBytes = options.maxEntryBytes ?? MAX_ZIP_ENTRY_BYTES; const maxCompressionRatio = options.maxCompressionRatio ?? MAX_ZIP_COMPRESSION_RATIO; const ratioMinBytes = options.ratioMinBytes ?? DEFAULT_ZIP_RATIO_MIN_BYTES; + const forbiddenPathsLower = + options.forbiddenPaths !== undefined + ? new Set([...options.forbiddenPaths].map((p) => p.replace(/^\/+/, "").toLowerCase())) + : undefined; const destResolved = resolveConfinedPath({ serversBaseDir, @@ -480,6 +485,9 @@ export function safeUnzipBuffer(options: SafeUnzipBufferOptions): SafeUnzipResul ); const lowerRelPath = validated.targetRelPath.toLowerCase(); + if (forbiddenPathsLower?.has(lowerRelPath)) { + throw new FileManagerError("zip_slip", `Refusing to extract protected path "${rawName}"`); + } if (validated.isDirectory) { if (compressedSize !== 0 || uncompressedSize !== 0) { throw new FileManagerError("zip_invalid", "Directory entry must have zero size"); @@ -800,6 +808,7 @@ export function safeUnzipFile(options: SafeUnzipFileOptions): SafeUnzipResult { ? { maxCompressionRatio: options.maxCompressionRatio } : {}), ...(options.ratioMinBytes !== undefined ? { ratioMinBytes: options.ratioMinBytes } : {}), + ...(options.forbiddenPaths !== undefined ? { forbiddenPaths: options.forbiddenPaths } : {}), }); } diff --git a/src/protocol/commands/backup.ts b/src/protocol/commands/backup.ts index 1d747a6..cd98ae1 100644 --- a/src/protocol/commands/backup.ts +++ b/src/protocol/commands/backup.ts @@ -46,13 +46,44 @@ export const backupLocalConfigSchema = z }) .strict(); +const S3_BUCKET_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,253}[a-zA-Z0-9]?$/; +const S3_REGION_REGEX = /^[a-zA-Z0-9-]{1,64}$/; +const CONTROL_CHAR_REGEX = /\p{Cc}/u; + +export const s3BucketSchema = z + .string() + .min(1) + .max(255) + .regex(S3_BUCKET_REGEX, "Invalid S3 bucket name") + .refine((value) => !value.includes(".."), { message: "S3 bucket name must not contain '..'" }); + +export const s3RegionSchema = z.string().min(1).max(64).regex(S3_REGION_REGEX, "Invalid S3 region"); + +export const s3PrefixSchema = z + .string() + .max(256) + .refine( + (value) => { + if ( + CONTROL_CHAR_REGEX.test(value) || + value.includes("\\") || + value.includes("?") || + value.includes("#") + ) { + return false; + } + return !value.split("/").some((segment) => segment === "." || segment === ".."); + }, + { message: "Invalid S3 prefix" }, + ); + export const backupS3ConfigSchema = z .object({ enabled: z.boolean(), - bucket: z.string().min(1).max(255).optional(), - region: z.string().min(1).max(64).optional(), + bucket: s3BucketSchema.optional(), + region: s3RegionSchema.optional(), endpoint: z.string().min(1).max(512).optional(), - prefix: z.string().max(256).optional(), + prefix: s3PrefixSchema.optional(), retention_count: z .number() .int() diff --git a/src/protocol/commands/state.ts b/src/protocol/commands/state.ts index 8dcebc4..a44a579 100644 --- a/src/protocol/commands/state.ts +++ b/src/protocol/commands/state.ts @@ -25,17 +25,42 @@ export type ModSource = z.infer; export const modLayerSchema = z.enum(["origin", "user"]); export type ModLayer = z.infer; +const MOD_UNSAFE_UNICODE_REGEX = /(?:\p{Cc}|\p{Cf}|\u034F|\u180E|\u2028|\u2029|\u3164|\uFFA0)/u; +const MOD_ENCODED_TRAVERSAL_REGEX = /%(?:2f|5c|00)/i; +const MOD_RESERVED_WINDOWS_REGEX = + /^(?:CON|PRN|AUX|NUL|COM[1-9¹²³]|LPT[1-9¹²³]|CONIN\$|CONOUT\$|CLOCK\$)\s*(?:\.|$)/i; +const MOD_FORBIDDEN_NAMES = new Set([".runtime", ".tegrad-uploads"]); + export const modFileNameSchema = z .string() .min(1) .max(255) .refine( - (name) => - !name.includes("/") && - !name.includes("\\") && - !name.includes("\0") && - name !== "." && - name !== "..", + (name) => { + if ( + name.includes("/") || + name.includes("\\") || + name.includes("\0") || + name.includes(":") || + name === "." || + name === ".." || + name.endsWith(".") || + name.endsWith(" ") + ) { + return false; + } + if (MOD_UNSAFE_UNICODE_REGEX.test(name) || name.normalize("NFC") !== name) { + return false; + } + if (MOD_ENCODED_TRAVERSAL_REGEX.test(name) || MOD_RESERVED_WINDOWS_REGEX.test(name)) { + return false; + } + const lower = name.toLowerCase(); + if (MOD_FORBIDDEN_NAMES.has(lower) || lower.startsWith(".tmp-upload-")) { + return false; + } + return new TextEncoder().encode(name).byteLength <= 255; + }, { message: "Mod filename must be a single safe filename" }, ); diff --git a/src/protocol/index.ts b/src/protocol/index.ts index 6f79afd..4b78aec 100644 --- a/src/protocol/index.ts +++ b/src/protocol/index.ts @@ -41,6 +41,9 @@ export { type ServerBackupDeleteBody, type ServerBackupListBody, type ServerBackupRestoreBody, + s3BucketSchema, + s3PrefixSchema, + s3RegionSchema, serverBackupConfigSetBodySchema, serverBackupConfigSetCommand, serverBackupCreateBodySchema, diff --git a/src/state/download.ts b/src/state/download.ts index a64a11a..d875587 100644 --- a/src/state/download.ts +++ b/src/state/download.ts @@ -80,6 +80,10 @@ export function validateStateDownloadUrl(rawUrl: string, allowedHosts: ReadonlyS throw new ProtocolError("download_failed", "Download URL must not specify a non-standard port"); } + if (parsed.hash.length > 0) { + throw new ProtocolError("download_failed", "Download URL must not contain a URL fragment"); + } + const host = parsed.hostname.toLowerCase(); if (!allowedHosts.has(host)) { throw new ProtocolError("download_failed", `Download host is not allowed: ${host}`); @@ -179,65 +183,77 @@ export async function downloadVerifiedBuffer( const timeoutMs = options.timeoutMs ?? DEFAULT_STATE_DOWNLOAD_TIMEOUT_MS; let currentUrl = validateStateDownloadUrl(options.url, options.allowedHosts); - let finalResponse: Response | null = null; + let data: Uint8Array | null = null; for (let hop = 0; hop <= maxRedirects; hop++) { const controller = new AbortController(); const timer = setTimeout(() => controller.abort(), timeoutMs); - let response: Response; try { - response = await fetchFn(currentUrl.toString(), { - method: "GET", - redirect: "manual", - signal: controller.signal, - }); - } catch { - throw new ProtocolError("download_failed", `Failed to fetch ${currentUrl.hostname}`); - } finally { - clearTimeout(timer); - } + let response: Response; + try { + response = await fetchFn(currentUrl.toString(), { + method: "GET", + redirect: "manual", + signal: controller.signal, + }); + } catch { + throw new ProtocolError("download_failed", `Failed to fetch ${currentUrl.hostname}`); + } - if ( - response.status === 301 || - response.status === 302 || - response.status === 303 || - response.status === 307 || - response.status === 308 - ) { - const location = response.headers.get("location"); - if (!location) { - throw new ProtocolError("download_failed", "Redirect response missing Location header"); + if ( + response.status === 301 || + response.status === 302 || + response.status === 303 || + response.status === 307 || + response.status === 308 + ) { + void response.body?.cancel().catch(() => {}); + const location = response.headers.get("location"); + if (!location) { + throw new ProtocolError("download_failed", "Redirect response missing Location header"); + } + if (hop === maxRedirects) { + throw new ProtocolError("download_failed", "Exceeded maximum redirect hops"); + } + let nextUrlStr: string; + try { + nextUrlStr = new URL(location, currentUrl).toString(); + } catch { + throw new ProtocolError("download_failed", "Malformed redirect Location URL"); + } + currentUrl = validateStateDownloadUrl(nextUrlStr, options.allowedHosts); + continue; } - if (hop === maxRedirects) { - throw new ProtocolError("download_failed", "Exceeded maximum redirect hops"); + + if (!response.ok) { + void response.body?.cancel().catch(() => {}); + throw new ProtocolError( + "download_failed", + `Download request to ${currentUrl.hostname} failed with HTTP ${response.status}`, + ); } - let nextUrlStr: string; + try { - nextUrlStr = new URL(location, currentUrl).toString(); - } catch { - throw new ProtocolError("download_failed", "Malformed redirect Location URL"); + data = await readCappedBytes(response, maxBytes); + } catch (err) { + if (err instanceof ProtocolError) { + throw err; + } + throw new ProtocolError( + "download_failed", + `Failed while reading response from ${currentUrl.hostname}`, + ); } - currentUrl = validateStateDownloadUrl(nextUrlStr, options.allowedHosts); - continue; - } - - if (!response.ok) { - throw new ProtocolError( - "download_failed", - `Download request to ${currentUrl.hostname} failed with HTTP ${response.status}`, - ); + break; + } finally { + clearTimeout(timer); } - - finalResponse = response; - break; } - if (finalResponse === null) { + if (data === null) { throw new ProtocolError("download_failed", "Exceeded maximum redirect hops"); } - - const data = await readCappedBytes(finalResponse, maxBytes); const sha1 = createHash("sha1").update(data).digest("hex"); const sha256 = createHash("sha256").update(data).digest("hex"); const sha512 = createHash("sha512").update(data).digest("hex"); diff --git a/src/state/manager.ts b/src/state/manager.ts index 41ecf9d..ff5a1f8 100644 --- a/src/state/manager.ts +++ b/src/state/manager.ts @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import { createHash, randomBytes } from "node:crypto"; +import { createHash, randomBytes, timingSafeEqual } from "node:crypto"; import { existsSync, lstatSync, readdirSync, readFileSync, unlinkSync } from "node:fs"; import { join } from "node:path"; import type { CommandQueue } from "../agent/jobs"; @@ -161,6 +161,17 @@ export interface StateManager { deployServerPack(params: ServerDeployServerpackBody): Promise; } +const PROTECTED_SERVERPACK_PATHS: ReadonlySet = new Set(["start.sh", "tegrad-server.json"]); + +function hexDigestsEqual(actualHex: string, expectedHex: string): boolean { + const a = Buffer.from(actualHex.toLowerCase(), "hex"); + const b = Buffer.from(expectedHex.toLowerCase(), "hex"); + if (a.byteLength === 0 || a.byteLength !== b.byteLength) { + return false; + } + return timingSafeEqual(a, b); +} + function modKeyFromMetadataEntry(entry: ServerModEntry): string { return modIdentityKey({ filename: entry.file, @@ -540,12 +551,19 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana for (const f of input.files ?? []) { const norm = normalizeRelativePath(f.path); // Enforce confinement on every planned file path. - resolveConfinedPath({ - serversBaseDir: serversDir, - serverId, - relPath: norm, - allowRoot: false, - }); + try { + resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: norm, + allowRoot: false, + }); + } catch (err) { + if (err instanceof FileManagerError) { + throw new ProtocolError("invalid_body", `Invalid planned file path: ${err.message}`); + } + throw err; + } if (!isServerContentPath(norm)) { continue; } @@ -750,12 +768,21 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana } else if (spec.content_base64 !== undefined) { const decoded = decodeStrictBase64(spec.content_base64, maxModBytes); const actualSha1 = createHash("sha1").update(decoded).digest("hex"); - if (actualSha1 !== spec.sha1.toLowerCase()) { + if (!hexDigestsEqual(actualSha1, spec.sha1)) { throw new ProtocolError( "hash_mismatch", `Checksum mismatch for planned file "${change.path}"`, ); } + if (spec.sha256 !== undefined) { + const actualSha256 = createHash("sha256").update(decoded).digest("hex"); + if (!hexDigestsEqual(actualSha256, spec.sha256)) { + throw new ProtocolError( + "hash_mismatch", + `SHA-256 checksum mismatch for planned file "${change.path}"`, + ); + } + } downloadedFiles.set(change.path, decoded); } else { throw new ProtocolError( @@ -958,6 +985,7 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana serversBaseDir: serversDir, serverId, buffer: downloaded.data, + forbiddenPaths: PROTECTED_SERVERPACK_PATHS, }); const nextOrigin: ServerOrigin = origin !== undefined ? origin : (meta.origin ?? null); @@ -971,7 +999,7 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana for (const relPath of unzipResult.files) { if (relPath.startsWith(`${MODS_DIR}/`) && !relPath.slice(MODS_DIR.length + 1).includes("/")) { - const fileName = relPath.slice(MODS_DIR.length + 1); + const fileName = validateSingleFileName(relPath.slice(MODS_DIR.length + 1)); const resolved = resolveConfinedPath({ serversBaseDir: serversDir, serverId, diff --git a/src/state/state.test.ts b/src/state/state.test.ts index 78175f9..12a5292 100644 --- a/src/state/state.test.ts +++ b/src/state/state.test.ts @@ -672,6 +672,7 @@ describe("state commands protocol & runtime wiring", () => { test("all STATE_COMMANDS reach handlers through createAgentRuntime and enforce sensitive rules", async () => { const stateDir = makeTempDir("tegrad-state-rt-"); const serversDir = makeTempDir("tegrad-state-rt-srv-"); + const backupsDir = makeTempDir("tegrad-state-rt-bkp-"); createTestServer(serversDir, "srv-rt"); const agent = await loadOrCreateIdentity(stateDir); @@ -711,6 +712,7 @@ describe("state commands protocol & runtime wiring", () => { const runtime = await createAgentRuntime({ stateDir, serversDir, + backupsDir, fetch: fetchImpl, logger: createLogger({ level: "error", stdout: () => {}, stderr: () => {} }), now: () => now, @@ -873,8 +875,198 @@ describe("state commands protocol & runtime wiring", () => { // Verify 100% coverage of STATE_COMMANDS expect([...exercised].sort()).toEqual(STATE_COMMANDS.map((c) => c.type).sort()); + + // Verify BackupHook wired through createAgentRuntime created before_change backups + // for both server.origin.apply and server.deploy.serverpack + const backups = await runtime.backupManager.listBackups({ server_id: "srv-rt" }); + expect( + backups.backups.filter((b) => b.trigger === "before_change").length, + ).toBeGreaterThanOrEqual(2); } finally { await runtime.shutdown(1000); } }); }); + +describe("adversarial security checks for state downloads, mods, and server packs", () => { + test("enforces streaming size cap even when Content-Length is missing or understated", async () => { + const allowedHosts = buildAllowedDownloadHosts(); + const streamingFetch: FetchLike = async () => { + const stream = new ReadableStream({ + start(controller) { + controller.enqueue(new Uint8Array(64).fill(0x41)); + controller.enqueue(new Uint8Array(64).fill(0x42)); + controller.close(); + }, + }); + return new Response(stream, { + status: 200, + headers: { "Content-Length": "10" }, + }); + }; + + await expect( + downloadVerifiedBuffer({ + url: "https://cdn.modrinth.com/streamed.jar", + allowedHosts, + maxBytes: 100, + fetchImpl: streamingFetch, + }), + ).rejects.toMatchObject({ code: "download_failed" }); + }); + + test("rejects redirects with non-standard port, credentials, or URL fragment", async () => { + const allowedHosts = buildAllowedDownloadHosts(); + const fetchImpl = makeMockFetch({ + "https://cdn.modrinth.com/port": () => + new Response(null, { + status: 302, + headers: { location: "https://cdn.modrinth.com:8443/mod.jar" }, + }), + "https://cdn.modrinth.com/creds": () => + new Response(null, { + status: 302, + headers: { location: "https://user:pass@cdn.modrinth.com/mod.jar" }, + }), + "https://cdn.modrinth.com/frag": () => + new Response(null, { + status: 302, + headers: { location: "https://cdn.modrinth.com/mod.jar#section" }, + }), + }); + + for (const url of [ + "https://cdn.modrinth.com/port", + "https://cdn.modrinth.com/creds", + "https://cdn.modrinth.com/frag", + ]) { + await expect(downloadVerifiedBuffer({ url, allowedHosts, fetchImpl })).rejects.toMatchObject({ + code: "download_failed", + }); + } + }); + + test("rejects traversal, encoded separators, reserved names, and bidi chars in mod filenames", async () => { + const serversDir = makeTempDir("tegrad-state-adv-mod-"); + createTestServer(serversDir, "srv-adv"); + const fetchImpl = makeMockFetch({ + "https://cdn.modrinth.com/ok.jar": () => new Response(new Uint8Array([1, 2, 3])), + }); + const mgr = createStateManager({ serversDir, fetchImpl }); + + const maliciousNames = [ + "../escape.jar", + "sub/mod.jar", + "sub\\mod.jar", + "mod\0.jar", + "CON.jar", + "mod.jar.", + "mod.jar ", + "a:b.jar", + "..%2fescape.jar", + ".tmp-upload-x.jar", + ".runtime", + "mod\u202Eraj.exe", + ]; + + for (const file of maliciousNames) { + await expect( + mgr.installMod({ + server_id: "srv-adv", + file, + url: "https://cdn.modrinth.com/ok.jar", + source: "modrinth", + }), + ).rejects.toMatchObject({ code: "invalid_body" }); + } + }); + + test("server.deploy.serverpack refuses archives attempting to overwrite start.sh or tegrad-server.json", async () => { + const serversDir = makeTempDir("tegrad-state-adv-pack-"); + createTestServer(serversDir, "srv-prot"); + const startShPath = join(serversDir, "srv-prot", "start.sh"); + writeFileSync(startShPath, "#!/bin/sh\nexec java -jar server.jar nogui\n", "utf8"); + const originalMetaJson = readFileSync( + join(serversDir, "srv-prot", "tegrad-server.json"), + "utf8", + ); + + const zipWithStartSh = createZipBuffer([ + { name: "start.sh", data: new TextEncoder().encode("#!/bin/sh\nid > /tmp/pwned\n") }, + { name: "config/a.txt", data: new TextEncoder().encode("x") }, + ]); + const zipWithMetadata = createZipBuffer([ + { name: "tegrad-server.json", data: new TextEncoder().encode('{"tampered":true}') }, + ]); + + const fetchImpl = makeMockFetch({ + "https://cdn.tegra.gg/start.zip": () => new Response(zipWithStartSh, { status: 200 }), + "https://cdn.tegra.gg/meta.zip": () => new Response(zipWithMetadata, { status: 200 }), + }); + + const mgr = createStateManager({ + serversDir, + cdnHost: "cdn.tegra.gg", + fetchImpl, + backupBeforeChange: false, + }); + + await expect( + mgr.deployServerPack({ + server_id: "srv-prot", + url: "https://cdn.tegra.gg/start.zip", + sha256: sha256Hex(zipWithStartSh), + }), + ).rejects.toThrow(/protected path/i); + expect(readFileSync(startShPath, "utf8")).toBe("#!/bin/sh\nexec java -jar server.jar nogui\n"); + expect(existsSync(join(serversDir, "srv-prot", "config", "a.txt"))).toBe(false); + + await expect( + mgr.deployServerPack({ + server_id: "srv-prot", + url: "https://cdn.tegra.gg/meta.zip", + sha256: sha256Hex(zipWithMetadata), + }), + ).rejects.toThrow(/protected path/i); + expect(readFileSync(join(serversDir, "srv-prot", "tegrad-server.json"), "utf8")).toBe( + originalMetaJson, + ); + }); + + test("origin apply verifies sha256 on inline content_base64 files and fails closed before backupHook", async () => { + const serversDir = makeTempDir("tegrad-state-adv-b64-"); + createTestServer(serversDir, "srv-b64"); + const content = new TextEncoder().encode("safe-config=1\n"); + const backupCalls: string[] = []; + + const mgr = createStateManager({ + serversDir, + backupHook: { + async beforeChange(id) { + backupCalls.push(id); + }, + }, + }); + + const plan = mgr.planOriginSync({ + server_id: "srv-b64", + to_version_id: "2.0.0", + mods: [], + files: [ + { + path: "config/test.cfg", + sha1: sha1Hex(content), + sha256: "0".repeat(64), + size_bytes: content.byteLength, + content_base64: Buffer.from(content).toString("base64"), + }, + ], + }); + + await expect( + mgr.applyOriginSync({ server_id: "srv-b64", plan_id: plan.plan_id }), + ).rejects.toMatchObject({ code: "hash_mismatch" }); + expect(backupCalls).toEqual([]); + expect(existsSync(join(serversDir, "srv-b64", "config", "test.cfg"))).toBe(false); + }); +}); diff --git a/src/tunnel/binary.ts b/src/tunnel/binary.ts index 8b099b6..de2e72b 100644 --- a/src/tunnel/binary.ts +++ b/src/tunnel/binary.ts @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import { createHash, randomBytes } from "node:crypto"; +import { createHash, randomBytes, timingSafeEqual } from "node:crypto"; import { chmodSync, closeSync, @@ -95,6 +95,15 @@ export function computeSha256Hex(data: Uint8Array): string { return createHash("sha256").update(data).digest("hex"); } +function sha256Equal(actualHex: string, expectedHex: string): boolean { + const a = Buffer.from(actualHex.toLowerCase(), "hex"); + const b = Buffer.from(expectedHex.toLowerCase(), "hex"); + if (a.byteLength === 0 || a.byteLength !== b.byteLength) { + return false; + } + return timingSafeEqual(a, b); +} + export function verifyFileSha256(filePath: string, expectedSha256: string): boolean { const stat = lstatSync(filePath, { throwIfNoEntry: false }); if (stat === undefined || stat.isSymbolicLink() || !stat.isFile()) { @@ -102,7 +111,7 @@ export function verifyFileSha256(filePath: string, expectedSha256: string): bool } const bytes = readFileSync(filePath); const actual = computeSha256Hex(new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength)); - return actual === expectedSha256.toLowerCase(); + return sha256Equal(actual, expectedSha256); } function validateDownloadUrl(rawUrl: string, allowInsecure: boolean): URL { @@ -110,25 +119,33 @@ function validateDownloadUrl(rawUrl: string, allowInsecure: boolean): URL { try { parsed = new URL(rawUrl); } catch { - throw new ProtocolError("download_failed", `Invalid playit download URL: "${rawUrl}"`); + throw new ProtocolError("download_failed", "Invalid playit download URL"); } if (parsed.username.length > 0 || parsed.password.length > 0) { throw new ProtocolError("download_failed", "Playit download URL must not contain credentials"); } + if (parsed.hash.length > 0) { + throw new ProtocolError("download_failed", "Playit download URL must not contain a fragment"); + } + const host = parsed.hostname.toLowerCase(); if (parsed.protocol === "https:") { - if (!ALLOWED_DOWNLOAD_HOSTS.has(parsed.hostname)) { + if (parsed.port !== "") { throw new ProtocolError( "download_failed", - `Disallowed playit download host: ${parsed.hostname}`, + "Playit download URL must not specify a non-standard port", ); } + if (!ALLOWED_DOWNLOAD_HOSTS.has(host)) { + throw new ProtocolError("download_failed", `Disallowed playit download host: ${host}`); + } return parsed; } - const isLoopback = parsed.hostname === "127.0.0.1" || parsed.hostname === "localhost"; + const isLoopback = + host === "127.0.0.1" || host === "localhost" || host === "[::1]" || host === "::1"; if (allowInsecure && parsed.protocol === "http:" && isLoopback) { return parsed; } - throw new ProtocolError("download_failed", `Playit download URL must use https://`); + throw new ProtocolError("download_failed", "Playit download URL must use https://"); } async function fetchWithValidatedRedirects( @@ -141,72 +158,107 @@ async function fetchWithValidatedRedirects( let currentUrl = validateDownloadUrl(initialUrl, allowInsecure).toString(); for (let hop = 0; hop <= MAX_REDIRECTS; hop++) { - const response = await fetchImpl(currentUrl, { - method: "GET", - redirect: "manual", - signal: AbortSignal.timeout(timeoutMs), - }); - - if (response.status >= 300 && response.status < 400) { - const location = response.headers.get("location"); - if (!location) { - throw new ProtocolError("download_failed", "Playit download redirect missing Location"); - } - const nextUrl = new URL(location, currentUrl).toString(); - currentUrl = validateDownloadUrl(nextUrl, allowInsecure).toString(); - continue; - } + const controller = new AbortController(); + const timer = setTimeout(() => controller.abort(), timeoutMs); - if (!response.ok) { - throw new ProtocolError( - "download_failed", - `Failed to download playit binary (HTTP ${response.status})`, - ); - } + try { + let response: Response; + try { + response = await fetchImpl(currentUrl, { + method: "GET", + redirect: "manual", + signal: controller.signal, + }); + } catch { + throw new ProtocolError("download_failed", "Failed to download playit binary"); + } - const declaredLength = response.headers.get("content-length"); - if (declaredLength !== null) { - const parsedLen = Number(declaredLength); - if (Number.isFinite(parsedLen) && parsedLen > maxBytes) { - throw new ProtocolError("download_failed", "Playit binary exceeds maximum size limit"); + if (response.status >= 300 && response.status < 400) { + void response.body?.cancel().catch(() => {}); + const location = response.headers.get("location"); + if (!location) { + throw new ProtocolError("download_failed", "Playit download redirect missing Location"); + } + if (hop === MAX_REDIRECTS) { + throw new ProtocolError( + "download_failed", + "Too many redirects while downloading playit binary", + ); + } + let nextUrl: string; + try { + nextUrl = new URL(location, currentUrl).toString(); + } catch { + throw new ProtocolError("download_failed", "Malformed playit redirect Location URL"); + } + currentUrl = validateDownloadUrl(nextUrl, allowInsecure).toString(); + continue; } - } - if (response.body === null) { - return new Uint8Array(0); - } + if (!response.ok) { + void response.body?.cancel().catch(() => {}); + throw new ProtocolError( + "download_failed", + `Failed to download playit binary (HTTP ${response.status})`, + ); + } - const reader = response.body.getReader(); - const chunks: Uint8Array[] = []; - let total = 0; + const declaredLength = response.headers.get("content-length"); + if (declaredLength !== null) { + const parsedLen = Number(declaredLength); + if (Number.isFinite(parsedLen) && parsedLen > maxBytes) { + void response.body?.cancel().catch(() => {}); + throw new ProtocolError("download_failed", "Playit binary exceeds maximum size limit"); + } + } - try { - while (true) { - const { value, done } = await reader.read(); - if (done) { - break; + if (response.body === null) { + const buf = new Uint8Array(await response.arrayBuffer()); + if (buf.byteLength > maxBytes) { + throw new ProtocolError("download_failed", "Playit binary exceeds maximum size limit"); } - if (value === undefined || value.byteLength === 0) { - continue; + return buf; + } + + const reader = response.body.getReader(); + const chunks: Uint8Array[] = []; + let total = 0; + + try { + while (true) { + const { value, done } = await reader.read(); + if (done) { + break; + } + if (value === undefined || value.byteLength === 0) { + continue; + } + total += value.byteLength; + if (total > maxBytes) { + await reader.cancel(); + throw new ProtocolError("download_failed", "Playit binary exceeds maximum size limit"); + } + chunks.push(value); } - total += value.byteLength; - if (total > maxBytes) { - await reader.cancel(); - throw new ProtocolError("download_failed", "Playit binary exceeds maximum size limit"); + } catch (err) { + if (err instanceof ProtocolError) { + throw err; } - chunks.push(value); + throw new ProtocolError("download_failed", "Failed while reading playit binary stream"); + } finally { + reader.releaseLock(); } - } finally { - reader.releaseLock(); - } - const combined = new Uint8Array(total); - let offset = 0; - for (const chunk of chunks) { - combined.set(chunk, offset); - offset += chunk.byteLength; + const combined = new Uint8Array(total); + let offset = 0; + for (const chunk of chunks) { + combined.set(chunk, offset); + offset += chunk.byteLength; + } + return combined; + } finally { + clearTimeout(timer); } - return combined; } throw new ProtocolError("download_failed", "Too many redirects while downloading playit binary"); @@ -271,7 +323,8 @@ export async function ensurePlayitBinary(options: EnsurePlayitBinaryOptions): Pr options.asset ?? PLAYIT_RELEASE_ASSETS[resolvePlayitPlatform(options.platform, options.arch)]; const binaryPath = getPlayitBinaryPath(options.stateDir); - if (existsSync(binaryPath)) { + const existingStat = lstatSync(binaryPath, { throwIfNoEntry: false }); + if (existingStat !== undefined) { if (verifyFileSha256(binaryPath, asset.sha256)) { return binaryPath; } @@ -291,7 +344,7 @@ export async function ensurePlayitBinary(options: EnsurePlayitBinaryOptions): Pr ); const actualHash = computeSha256Hex(bytes); - if (actualHash !== asset.sha256.toLowerCase()) { + if (!sha256Equal(actualHash, asset.sha256)) { throw new ProtocolError( "hash_mismatch", `Downloaded playit binary SHA-256 mismatch (expected ${asset.sha256}, got ${actualHash})`, diff --git a/src/tunnel/playit.test.ts b/src/tunnel/playit.test.ts index 1e24103..d5c016c 100644 --- a/src/tunnel/playit.test.ts +++ b/src/tunnel/playit.test.ts @@ -2,7 +2,16 @@ // Copyright (C) 2026 Antônio Miranda import { afterEach, describe, expect, test } from "bun:test"; -import { chmodSync, existsSync, mkdtempSync, readFileSync, rmSync, statSync } from "node:fs"; +import { + chmodSync, + existsSync, + mkdirSync, + mkdtempSync, + readFileSync, + rmSync, + statSync, + writeFileSync, +} from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; import { createCommandQueue } from "../agent/jobs"; @@ -427,3 +436,174 @@ describe("Tunnel protocol commands and sensitivity enforcement", () => { expect(acks.every((a) => a.body.ok)).toBe(true); }); }); + +describe("Adversarial playit security checks", () => { + test("blocks redirect to disallowed host, HTTP downgrade, non-standard port, redirect loop, and streaming size overflow", async () => { + const baseAsset: PinnedPlayitAsset = { + version: PLAYIT_VERSION, + platform: "linux-x64", + assetName: "playit-linux-amd64", + url: "https://github.com/playit-cloud/playit-agent/releases/download/v2.0.2/playit-linux-amd64", + sha256: "a".repeat(64), + }; + + // Redirect to disallowed host + await expect( + ensurePlayitBinary({ + stateDir: makeTempDir("tegrad-playit-adv-1-"), + asset: baseAsset, + fetchImpl: async () => + new Response(null, { + status: 302, + headers: { location: "https://evil.example/playitd" }, + }), + }), + ).rejects.toMatchObject({ code: "download_failed" }); + + // Redirect HTTP downgrade + await expect( + ensurePlayitBinary({ + stateDir: makeTempDir("tegrad-playit-adv-2-"), + asset: baseAsset, + fetchImpl: async () => + new Response(null, { + status: 302, + headers: { location: "http://github.com/playitd" }, + }), + }), + ).rejects.toMatchObject({ code: "download_failed" }); + + // Redirect to non-standard port on allowed host + await expect( + ensurePlayitBinary({ + stateDir: makeTempDir("tegrad-playit-adv-3-"), + asset: baseAsset, + fetchImpl: async () => + new Response(null, { + status: 302, + headers: { location: "https://github.com:8443/playitd" }, + }), + }), + ).rejects.toMatchObject({ code: "download_failed" }); + + // Infinite redirect loop within allowlist + await expect( + ensurePlayitBinary({ + stateDir: makeTempDir("tegrad-playit-adv-4-"), + asset: baseAsset, + fetchImpl: async () => + new Response(null, { + status: 302, + headers: { location: "https://objects.githubusercontent.com/loop" }, + }), + }), + ).rejects.toMatchObject({ code: "download_failed" }); + + // Streaming overflow without Content-Length + await expect( + ensurePlayitBinary({ + stateDir: makeTempDir("tegrad-playit-adv-5-"), + asset: baseAsset, + maxBytes: 64, + fetchImpl: async () => + new Response( + new ReadableStream({ + start(controller) { + controller.enqueue(new Uint8Array(40).fill(0x55)); + controller.enqueue(new Uint8Array(40).fill(0x66)); + controller.close(); + }, + }), + { status: 200 }, + ), + }), + ).rejects.toMatchObject({ code: "download_failed" }); + }); + + test("fails closed if existing playitd binary on disk is tampered and prevents concurrent double-start", async () => { + const stateDir = makeTempDir("tegrad-playit-adv-tamper-"); + const goodBytes = new TextEncoder().encode("valid-playitd"); + const goodAsset: PinnedPlayitAsset = { + version: PLAYIT_VERSION, + platform: "linux-x64", + assetName: "playit-linux-amd64", + url: "https://github.com/playit-cloud/playit-agent/releases/download/v2.0.2/playit-linux-amd64", + sha256: computeSha256Hex(goodBytes), + }; + + // Pre-populate a tampered binary at /bin/playitd + const binPath = getPlayitBinaryPath(stateDir); + mkdirSync(join(stateDir, "bin"), { recursive: true }); + writeFileSync(binPath, "malicious-replacement"); + + let spawnCount = 0; + const manager = createPlayitTunnelManager({ + stateDir, + asset: goodAsset, + platform: "linux", + spawnImpl: () => { + spawnCount++; + return { + pid: 1234, + exited: new Promise(() => {}), + kill() {}, + }; + }, + }); + manager.setKey(VALID_HEX_KEY); + + await expect(manager.start()).rejects.toMatchObject({ code: "hash_mismatch" }); + expect(spawnCount).toBe(0); + + // Concurrent start calls must not spawn two processes + const raceDir = makeTempDir("tegrad-playit-adv-race-"); + let releaseDownload: (() => void) | undefined; + let raceSpawns = 0; + const raceManager = createPlayitTunnelManager({ + stateDir: raceDir, + asset: goodAsset, + platform: "linux", + fetchImpl: async () => { + await new Promise((resolve) => { + releaseDownload = resolve; + }); + return new Response(goodBytes); + }, + spawnImpl: () => { + raceSpawns++; + let done: ((code: number) => void) | undefined; + return { + pid: 5678, + exited: new Promise((resolve) => { + done = resolve; + }), + kill() { + done?.(0); + }, + }; + }, + }); + raceManager.setKey(VALID_HEX_KEY); + + const first = raceManager.start(); + const second = raceManager.start(); + await expect(second).rejects.toMatchObject({ code: "tunnel_already_running" }); + releaseDownload?.(); + const started = await first; + expect(started.running).toBe(true); + expect(raceSpawns).toBe(1); + await raceManager.close(); + }); + + test("invalid secret key error never echoes the key material", () => { + const stateDir = makeTempDir("tegrad-playit-adv-key-"); + const leakyInvalidKey = "not-hex-SECRET_PLAYIT_TOKEN_VALUE_12345"; + try { + savePlayitSecretKey(stateDir, leakyInvalidKey); + expect.unreachable("Expected invalid_body"); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as Error).message).not.toContain("SECRET_PLAYIT_TOKEN_VALUE_12345"); + } + }); +}); diff --git a/src/tunnel/playit.ts b/src/tunnel/playit.ts index 2834e80..285bccf 100644 --- a/src/tunnel/playit.ts +++ b/src/tunnel/playit.ts @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import { mkdirSync } from "node:fs"; +import { chmodSync, lstatSync, mkdirSync } from "node:fs"; import { join } from "node:path"; import type { CommandQueue } from "../agent/jobs"; import type { Logger } from "../agent/logger"; @@ -111,6 +111,27 @@ export function buildPlayitSpawnSpec(options: { }; } +function drainStream(stream: ReadableStream | number | undefined): void { + if (stream === undefined || typeof stream === "number") { + return; + } + const reader = stream.getReader(); + void (async () => { + try { + while (true) { + const { done } = await reader.read(); + if (done) { + break; + } + } + } catch { + // ignore stream read errors on process exit + } finally { + reader.releaseLock(); + } + })(); +} + function defaultSpawn( cmd: readonly string[], options: { @@ -126,6 +147,8 @@ function defaultSpawn( stderr: options.stderr, env: { ...options.env }, }); + drainStream(proc.stdout); + drainStream(proc.stderr); return { pid: proc.pid, exited: proc.exited, @@ -144,6 +167,7 @@ export function createPlayitTunnelManager( const version = options.asset?.version ?? PLAYIT_VERSION; let activeProc: SpawnedTunnelProcess | null = null; + let starting = false; let startedAt: number | null = null; let lastExitCode: number | null = null; let lastError: string | null = null; @@ -169,75 +193,90 @@ export function createPlayitTunnelManager( } async function start(): Promise { - if (activeProc !== null) { + if (activeProc !== null || starting) { throw new ProtocolError("tunnel_already_running", "Playit tunnel is already running"); } + starting = true; - const keyPath = assertPlayitSecretKey(options.stateDir); - const binaryPath = await ensurePlayitBinary({ - stateDir: options.stateDir, - ...(options.asset !== undefined ? { asset: options.asset } : {}), - ...(options.platform !== undefined ? { platform: options.platform } : {}), - ...(options.arch !== undefined ? { arch: options.arch } : {}), - ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), - ...(options.allowInsecure !== undefined ? { allowInsecure: options.allowInsecure } : {}), - }); - - const certDir = join(options.stateDir, "playit-certs"); - mkdirSync(certDir, { recursive: true, mode: 0o700 }); + try { + const keyPath = assertPlayitSecretKey(options.stateDir); + const binaryPath = await ensurePlayitBinary({ + stateDir: options.stateDir, + ...(options.asset !== undefined ? { asset: options.asset } : {}), + ...(options.platform !== undefined ? { platform: options.platform } : {}), + ...(options.arch !== undefined ? { arch: options.arch } : {}), + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + ...(options.allowInsecure !== undefined ? { allowInsecure: options.allowInsecure } : {}), + }); - const spec = buildPlayitSpawnSpec({ - binaryPath, - stateDir: options.stateDir, - keyPath, - ...(options.platform !== undefined ? { platform: options.platform } : {}), - }); + const certDir = join(options.stateDir, "playit-certs"); + const existingCertDir = lstatSync(certDir, { throwIfNoEntry: false }); + if (existingCertDir !== undefined) { + if (existingCertDir.isSymbolicLink() || !existingCertDir.isDirectory()) { + throw new ProtocolError("tunnel_failed", "Playit certificate directory is invalid"); + } + } else { + mkdirSync(certDir, { recursive: true, mode: 0o700 }); + } + if (process.platform !== "win32") { + chmodSync(certDir, 0o700); + } - const proc = spawnImpl([spec.binaryPath, ...spec.args], { - stdin: "ignore", - stdout: "pipe", - stderr: "pipe", - env: spec.env, - }); + const spec = buildPlayitSpawnSpec({ + binaryPath, + stateDir: options.stateDir, + keyPath, + ...(options.platform !== undefined ? { platform: options.platform } : {}), + }); - activeProc = proc; - startedAt = now(); - lastError = null; + const proc = spawnImpl([spec.binaryPath, ...spec.args], { + stdin: "ignore", + stdout: "pipe", + stderr: "pipe", + env: spec.env, + }); - options.logger?.info("Started playit tunnel process", { - pid: proc.pid, - version, - }); + activeProc = proc; + startedAt = now(); + lastError = null; - void proc.exited - .then((code) => { - if (activeProc === proc) { - activeProc = null; - startedAt = null; - } - lastExitCode = code; - if (code !== 0) { - lastError = `Playit process exited with code ${code}`; - options.logger?.warn("Playit tunnel process exited with non-zero code", { - pid: proc.pid, - code, - }); - } else { - options.logger?.info("Playit tunnel process exited cleanly", { - pid: proc.pid, - code, - }); - } - }) - .catch((err: unknown) => { - if (activeProc === proc) { - activeProc = null; - startedAt = null; - } - lastError = err instanceof Error ? err.message : String(err); + options.logger?.info("Started playit tunnel process", { + pid: proc.pid, + version, }); - return status(); + void proc.exited + .then((code) => { + if (activeProc === proc) { + activeProc = null; + startedAt = null; + } + lastExitCode = code; + if (code !== 0) { + lastError = `Playit process exited with code ${code}`; + options.logger?.warn("Playit tunnel process exited with non-zero code", { + pid: proc.pid, + code, + }); + } else { + options.logger?.info("Playit tunnel process exited cleanly", { + pid: proc.pid, + code, + }); + } + }) + .catch(() => { + if (activeProc === proc) { + activeProc = null; + startedAt = null; + } + lastError = "Playit process terminated unexpectedly"; + }); + + return status(); + } finally { + starting = false; + } } async function stop(): Promise { From 9cfb0e9ea63149e2b3f0b68c52e697ed72f2ba03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Mon, 23 Nov 2026 00:09:10 -0300 Subject: [PATCH 20/59] feat: build the protocol, crypto and vault libraries for consumption by tag --- .gitattributes | 2 + .github/workflows/ci.yml | 1 + biome.json | 2 +- lib/chunks/index-kcrag88y.js | 359 ++ lib/chunks/index-ztead7tp.js | 1468 ++++++++ lib/crypto/index.js | 76 + lib/protocol/index.js | 347 ++ lib/types/crypto/aead.d.ts | 6 + lib/types/crypto/box.d.ts | 3 + lib/types/crypto/canonical.d.ts | 1 + lib/types/crypto/encoding.d.ts | 3 + lib/types/crypto/hash.d.ts | 2 + lib/types/crypto/index.d.ts | 8 + lib/types/crypto/kdf.d.ts | 16 + lib/types/crypto/signing.d.ts | 17 + lib/types/crypto/sodium.d.ts | 5 + lib/types/protocol/agent-message.d.ts | 17 + lib/types/protocol/command.d.ts | 28 + lib/types/protocol/commands/backup.d.ts | 203 + lib/types/protocol/commands/core.d.ts | 20 + lib/types/protocol/commands/files.d.ts | 180 + lib/types/protocol/commands/pairing.d.ts | 20 + lib/types/protocol/commands/server.d.ts | 122 + lib/types/protocol/commands/state.d.ts | 388 ++ lib/types/protocol/commands/tunnel.d.ts | 18 + lib/types/protocol/domains.d.ts | 9 + lib/types/protocol/errors.d.ts | 5 + lib/types/protocol/index.d.ts | 17 + lib/types/protocol/pairing.d.ts | 53 + lib/types/protocol/registry.d.ts | 19 + lib/types/protocol/revocation.d.ts | 9 + lib/types/protocol/schemas.d.ts | 225 ++ lib/types/protocol/session.d.ts | 15 + lib/types/protocol/trust.d.ts | 20 + lib/types/vault/blob.d.ts | 49 + lib/types/vault/counter.d.ts | 5 + lib/types/vault/errors.d.ts | 5 + lib/types/vault/index.d.ts | 7 + lib/types/vault/password.d.ts | 12 + lib/types/vault/recovery-code.d.ts | 5 + lib/types/vault/session.d.ts | 41 + lib/types/vault/vault.d.ts | 36 + lib/vault/index.js | 4341 ++++++++++++++++++++++ package.json | 27 +- scripts/build-lib.ts | 39 + tsconfig.lib.json | 14 + 46 files changed, 8259 insertions(+), 6 deletions(-) create mode 100644 lib/chunks/index-kcrag88y.js create mode 100644 lib/chunks/index-ztead7tp.js create mode 100644 lib/crypto/index.js create mode 100644 lib/protocol/index.js create mode 100644 lib/types/crypto/aead.d.ts create mode 100644 lib/types/crypto/box.d.ts create mode 100644 lib/types/crypto/canonical.d.ts create mode 100644 lib/types/crypto/encoding.d.ts create mode 100644 lib/types/crypto/hash.d.ts create mode 100644 lib/types/crypto/index.d.ts create mode 100644 lib/types/crypto/kdf.d.ts create mode 100644 lib/types/crypto/signing.d.ts create mode 100644 lib/types/crypto/sodium.d.ts create mode 100644 lib/types/protocol/agent-message.d.ts create mode 100644 lib/types/protocol/command.d.ts create mode 100644 lib/types/protocol/commands/backup.d.ts create mode 100644 lib/types/protocol/commands/core.d.ts create mode 100644 lib/types/protocol/commands/files.d.ts create mode 100644 lib/types/protocol/commands/pairing.d.ts create mode 100644 lib/types/protocol/commands/server.d.ts create mode 100644 lib/types/protocol/commands/state.d.ts create mode 100644 lib/types/protocol/commands/tunnel.d.ts create mode 100644 lib/types/protocol/domains.d.ts create mode 100644 lib/types/protocol/errors.d.ts create mode 100644 lib/types/protocol/index.d.ts create mode 100644 lib/types/protocol/pairing.d.ts create mode 100644 lib/types/protocol/registry.d.ts create mode 100644 lib/types/protocol/revocation.d.ts create mode 100644 lib/types/protocol/schemas.d.ts create mode 100644 lib/types/protocol/session.d.ts create mode 100644 lib/types/protocol/trust.d.ts create mode 100644 lib/types/vault/blob.d.ts create mode 100644 lib/types/vault/counter.d.ts create mode 100644 lib/types/vault/errors.d.ts create mode 100644 lib/types/vault/index.d.ts create mode 100644 lib/types/vault/password.d.ts create mode 100644 lib/types/vault/recovery-code.d.ts create mode 100644 lib/types/vault/session.d.ts create mode 100644 lib/types/vault/vault.d.ts create mode 100644 lib/vault/index.js create mode 100644 scripts/build-lib.ts create mode 100644 tsconfig.lib.json diff --git a/.gitattributes b/.gitattributes index 6313b56..a0c0534 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,3 @@ * text=auto eol=lf +# Generated by `bun run build:lib`; consumed through git tags. +lib/** linguist-generated=true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a13ac0..cbd780f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,7 @@ jobs: - run: bun run lint - run: bun run typecheck - run: bun run test + - run: bun run check:lib install-checks: runs-on: ubuntu-latest diff --git a/biome.json b/biome.json index c680ab0..1437432 100644 --- a/biome.json +++ b/biome.json @@ -1,6 +1,6 @@ { "$schema": "https://biomejs.dev/schemas/2.6.8/schema.json", - "files": { "includes": ["**", "!dist", "!node_modules"] }, + "files": { "includes": ["**", "!dist", "!lib", "!node_modules"] }, "formatter": { "indentStyle": "space", "indentWidth": 2, "lineWidth": 100 }, "linter": { "enabled": true, diff --git a/lib/chunks/index-kcrag88y.js b/lib/chunks/index-kcrag88y.js new file mode 100644 index 0000000..2447c3c --- /dev/null +++ b/lib/chunks/index-kcrag88y.js @@ -0,0 +1,359 @@ +// src/crypto/sodium.ts +import sodium from "libsodium-wrappers-sumo"; +var initialized = false; +async function ready() { + if (initialized) + return; + await sodium.ready; + initialized = true; +} +function getSodium() { + if (!initialized) { + throw new Error("Crypto module is not initialized. Call await ready() first."); + } + return sodium; +} +function randomBytes(length) { + if (!Number.isInteger(length) || length < 0) { + throw new RangeError("length must be a non-negative integer"); + } + return getSodium().randombytes_buf(length); +} +function memzero(buffer) { + getSodium().memzero(buffer); +} + +// src/crypto/aead.ts +var SYMMETRIC_KEY_BYTES = 32; +var AEAD_NONCE_BYTES = 24; +var AEAD_TAG_BYTES = 16; +function generateSymmetricKey() { + return getSodium().randombytes_buf(SYMMETRIC_KEY_BYTES); +} +function aeadEncrypt(plaintext, key, associatedData) { + const s = getSodium(); + if (key.length !== SYMMETRIC_KEY_BYTES) { + throw new RangeError(`Symmetric key must be ${SYMMETRIC_KEY_BYTES} bytes`); + } + const nonce = s.randombytes_buf(AEAD_NONCE_BYTES); + const ciphertext = s.crypto_aead_xchacha20poly1305_ietf_encrypt(plaintext, associatedData ?? null, null, nonce, key); + const out = new Uint8Array(AEAD_NONCE_BYTES + ciphertext.length); + out.set(nonce, 0); + out.set(ciphertext, AEAD_NONCE_BYTES); + return out; +} +function aeadDecrypt(ciphertext, key, associatedData) { + const s = getSodium(); + if (key.length !== SYMMETRIC_KEY_BYTES) { + throw new RangeError(`Symmetric key must be ${SYMMETRIC_KEY_BYTES} bytes`); + } + if (ciphertext.length < AEAD_NONCE_BYTES + AEAD_TAG_BYTES) { + throw new Error("Ciphertext is too short"); + } + const nonce = ciphertext.subarray(0, AEAD_NONCE_BYTES); + const body = ciphertext.subarray(AEAD_NONCE_BYTES); + return s.crypto_aead_xchacha20poly1305_ietf_decrypt(null, body, associatedData ?? null, nonce, key); +} +// src/crypto/encoding.ts +var BASE64URL_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; +var BASE32_ALPHABET = "abcdefghijklmnopqrstuvwxyz234567"; +var BASE64URL_LOOKUP = new Int8Array(128).fill(-1); +for (let i = 0;i < BASE64URL_ALPHABET.length; i++) { + BASE64URL_LOOKUP[BASE64URL_ALPHABET.charCodeAt(i)] = i; +} +function toBase64Url(bytes) { + let out = ""; + const len = bytes.length; + let i = 0; + for (;i + 2 < len; i += 3) { + const b0 = bytes[i] ?? 0; + const b1 = bytes[i + 1] ?? 0; + const b2 = bytes[i + 2] ?? 0; + const triple = b0 << 16 | b1 << 8 | b2; + out += (BASE64URL_ALPHABET[triple >>> 18 & 63] ?? "") + (BASE64URL_ALPHABET[triple >>> 12 & 63] ?? "") + (BASE64URL_ALPHABET[triple >>> 6 & 63] ?? "") + (BASE64URL_ALPHABET[triple & 63] ?? ""); + } + const remaining = len - i; + if (remaining === 1) { + const b0 = bytes[i] ?? 0; + out += (BASE64URL_ALPHABET[b0 >>> 2 & 63] ?? "") + (BASE64URL_ALPHABET[b0 << 4 & 63] ?? ""); + } else if (remaining === 2) { + const b0 = bytes[i] ?? 0; + const b1 = bytes[i + 1] ?? 0; + out += (BASE64URL_ALPHABET[b0 >>> 2 & 63] ?? "") + (BASE64URL_ALPHABET[(b0 << 4 | b1 >>> 4) & 63] ?? "") + (BASE64URL_ALPHABET[b1 << 2 & 63] ?? ""); + } + return out; +} +function fromBase64Url(text) { + const len = text.length; + const rem = len % 4; + if (rem === 1) { + throw new Error("Invalid base64url length"); + } + const byteLen = Math.floor(len * 3 / 4); + const out = new Uint8Array(byteLen); + let outIdx = 0; + let i = 0; + const decodeChar = (idx) => { + const code = text.charCodeAt(idx); + if (code >= 128) + throw new Error("Invalid base64url character"); + const val = BASE64URL_LOOKUP[code] ?? -1; + if (val < 0) + throw new Error("Invalid base64url character"); + return val; + }; + for (;i + 3 < len; i += 4) { + const c0 = decodeChar(i); + const c1 = decodeChar(i + 1); + const c2 = decodeChar(i + 2); + const c3 = decodeChar(i + 3); + const triple = c0 << 18 | c1 << 12 | c2 << 6 | c3; + out[outIdx++] = triple >>> 16 & 255; + out[outIdx++] = triple >>> 8 & 255; + out[outIdx++] = triple & 255; + } + if (rem === 2) { + const c0 = decodeChar(i); + const c1 = decodeChar(i + 1); + if ((c1 & 15) !== 0) { + throw new Error("Non-canonical base64url trailing bits"); + } + out[outIdx++] = c0 << 2 | c1 >>> 4; + } else if (rem === 3) { + const c0 = decodeChar(i); + const c1 = decodeChar(i + 1); + const c2 = decodeChar(i + 2); + if ((c2 & 3) !== 0) { + throw new Error("Non-canonical base64url trailing bits"); + } + out[outIdx++] = c0 << 2 | c1 >>> 4; + out[outIdx++] = (c1 & 15) << 4 | c2 >>> 2; + } + return out; +} +function toBase32(bytes) { + let out = ""; + let buffer = 0; + let bitsLeft = 0; + for (let i = 0;i < bytes.length; i++) { + buffer = buffer << 8 | (bytes[i] ?? 0); + bitsLeft += 8; + while (bitsLeft >= 5) { + bitsLeft -= 5; + out += BASE32_ALPHABET[buffer >>> bitsLeft & 31] ?? ""; + } + } + if (bitsLeft > 0) { + out += BASE32_ALPHABET[buffer << 5 - bitsLeft & 31] ?? ""; + } + return out; +} + +// src/crypto/signing.ts +var SIGNING_PUBLIC_KEY_BYTES = 32; +var SIGNING_SECRET_KEY_BYTES = 64; +var SIGNING_SEED_BYTES = 32; +var SIGNATURE_BYTES = 64; +var FINGERPRINT_HASH_BYTES = 32; +var FINGERPRINT_TRUNCATED_BYTES = 20; +function generateSigningKeyPair() { + const s = getSodium(); + const kp = s.crypto_sign_keypair(); + return { + publicKey: kp.publicKey, + secretKey: kp.privateKey + }; +} +function signingKeyPairFromSeed(seed) { + const s = getSodium(); + if (seed.length !== SIGNING_SEED_BYTES) { + throw new RangeError(`Signing seed must be ${SIGNING_SEED_BYTES} bytes`); + } + const kp = s.crypto_sign_seed_keypair(seed); + return { + publicKey: kp.publicKey, + secretKey: kp.privateKey + }; +} +function sign(message, secretKey) { + const s = getSodium(); + if (secretKey.length !== SIGNING_SECRET_KEY_BYTES) { + throw new RangeError(`Signing secret key must be ${SIGNING_SECRET_KEY_BYTES} bytes`); + } + return s.crypto_sign_detached(message, secretKey); +} +function verify(message, signature, publicKey) { + const s = getSodium(); + if (signature.length !== SIGNATURE_BYTES || publicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + return false; + } + try { + return s.crypto_sign_verify_detached(signature, message, publicKey); + } catch { + return false; + } +} +function fingerprint(publicKey) { + const s = getSodium(); + if (publicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new RangeError(`Public key must be ${SIGNING_PUBLIC_KEY_BYTES} bytes`); + } + const digest = s.crypto_generichash(FINGERPRINT_HASH_BYTES, publicKey, null); + return toBase32(digest.subarray(0, FINGERPRINT_TRUNCATED_BYTES)); +} + +// src/crypto/box.ts +function sealTo(plaintext, recipientSigningPublicKey) { + const s = getSodium(); + if (recipientSigningPublicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new RangeError(`Recipient public key must be ${SIGNING_PUBLIC_KEY_BYTES} bytes`); + } + const curvePk = s.crypto_sign_ed25519_pk_to_curve25519(recipientSigningPublicKey); + return s.crypto_box_seal(plaintext, curvePk); +} +function openSealed(ciphertext, recipientSigningKeyPair) { + const s = getSodium(); + if (recipientSigningKeyPair.publicKey.length !== SIGNING_PUBLIC_KEY_BYTES || recipientSigningKeyPair.secretKey.length !== SIGNING_SECRET_KEY_BYTES) { + throw new RangeError("Invalid recipient signing key pair length"); + } + const curvePk = s.crypto_sign_ed25519_pk_to_curve25519(recipientSigningKeyPair.publicKey); + const curveSk = s.crypto_sign_ed25519_sk_to_curve25519(recipientSigningKeyPair.secretKey); + try { + return s.crypto_box_seal_open(ciphertext, curvePk, curveSk); + } finally { + s.memzero(curveSk); + } +} +// src/crypto/canonical.ts +var utf8Encoder = new TextEncoder; +function compareCodeUnits(a, b) { + if (a < b) + return -1; + if (a > b) + return 1; + return 0; +} +function serializeCanonical(value, ancestors) { + if (value === null) + return "null"; + switch (typeof value) { + case "boolean": + return value ? "true" : "false"; + case "number": { + if (!Number.isFinite(value)) { + throw new TypeError("Cannot canonicalize non-finite number"); + } + return Object.is(value, -0) ? "0" : JSON.stringify(value); + } + case "string": + return JSON.stringify(value); + case "undefined": + case "function": + case "symbol": + case "bigint": + throw new TypeError(`Cannot canonicalize value of type ${typeof value}`); + case "object": { + if (ancestors.has(value)) { + throw new TypeError("Cannot canonicalize circular reference"); + } + if (Array.isArray(value)) { + ancestors.add(value); + try { + const items = []; + for (let i = 0;i < value.length; i++) { + items.push(serializeCanonical(value[i], ancestors)); + } + return `[${items.join(",")}]`; + } finally { + ancestors.delete(value); + } + } + const proto = Object.getPrototypeOf(value); + if (proto !== Object.prototype && proto !== null) { + throw new TypeError("Cannot canonicalize non-plain object"); + } + ancestors.add(value); + try { + const record = value; + const keys = Object.keys(record).filter((k) => record[k] !== undefined).sort(compareCodeUnits); + const entries = []; + for (const key of keys) { + entries.push(`${JSON.stringify(key)}:${serializeCanonical(record[key], ancestors)}`); + } + return `{${entries.join(",")}}`; + } finally { + ancestors.delete(value); + } + } + default: + throw new TypeError(`Cannot canonicalize value of type ${typeof value}`); + } +} +function canonicalize(value) { + return utf8Encoder.encode(serializeCanonical(value, new Set)); +} +// src/crypto/hash.ts +var HASH_BYTES = 32; +function hash(data, key) { + const s = getSodium(); + if (key !== undefined) { + if (key.length < s.crypto_generichash_KEYBYTES_MIN || key.length > s.crypto_generichash_KEYBYTES_MAX) { + throw new RangeError(`Hash key must be between ${s.crypto_generichash_KEYBYTES_MIN} and ${s.crypto_generichash_KEYBYTES_MAX} bytes`); + } + return s.crypto_generichash(HASH_BYTES, data, key); + } + return s.crypto_generichash(HASH_BYTES, data, null); +} +// src/crypto/kdf.ts +var KDF_ALG_ARGON2ID13 = "argon2id13"; +var KDF_SALT_BYTES = 16; +var KDF_KEY_BYTES = 32; +var KDF_FLOOR = { + alg: KDF_ALG_ARGON2ID13, + opslimit: 3, + memlimit: 128 * 1024 * 1024 +}; +var KDF_MODERATE = { + alg: KDF_ALG_ARGON2ID13, + opslimit: 3, + memlimit: 256 * 1024 * 1024 +}; +var utf8Encoder2 = new TextEncoder; +function generateSalt() { + return getSodium().randombytes_buf(KDF_SALT_BYTES); +} +function assertKdfParams(params) { + if (typeof params !== "object" || params === null) { + throw new Error("KDF parameters must be an object"); + } + const record = params; + if (record.alg !== KDF_ALG_ARGON2ID13) { + throw new Error(`Unsupported KDF algorithm: expected ${KDF_ALG_ARGON2ID13}`); + } + if (typeof record.opslimit !== "number" || !Number.isSafeInteger(record.opslimit) || record.opslimit < KDF_FLOOR.opslimit) { + throw new Error(`KDF opslimit must be an integer >= ${KDF_FLOOR.opslimit}`); + } + if (typeof record.memlimit !== "number" || !Number.isSafeInteger(record.memlimit) || record.memlimit < KDF_FLOOR.memlimit) { + throw new Error(`KDF memlimit must be an integer >= ${KDF_FLOOR.memlimit}`); + } + if (!(record.salt instanceof Uint8Array) || record.salt.length !== KDF_SALT_BYTES) { + throw new Error(`KDF salt must be a Uint8Array of ${KDF_SALT_BYTES} bytes`); + } +} +function deriveKeyFromPassword(password, params, keyLength = KDF_KEY_BYTES) { + const s = getSodium(); + assertKdfParams(params); + if (!Number.isSafeInteger(keyLength) || keyLength < 16) { + throw new RangeError("Derived key length must be an integer >= 16"); + } + const isString = typeof password === "string"; + const pwBytes = isString ? utf8Encoder2.encode(password) : password; + try { + return s.crypto_pwhash(keyLength, pwBytes, params.salt, params.opslimit, params.memlimit, s.crypto_pwhash_ALG_ARGON2ID13); + } finally { + if (isString) { + s.memzero(pwBytes); + } + } +} +export { ready, randomBytes, memzero, SYMMETRIC_KEY_BYTES, AEAD_NONCE_BYTES, AEAD_TAG_BYTES, generateSymmetricKey, aeadEncrypt, aeadDecrypt, toBase64Url, fromBase64Url, toBase32, SIGNING_PUBLIC_KEY_BYTES, SIGNING_SECRET_KEY_BYTES, SIGNING_SEED_BYTES, SIGNATURE_BYTES, FINGERPRINT_HASH_BYTES, FINGERPRINT_TRUNCATED_BYTES, generateSigningKeyPair, signingKeyPairFromSeed, sign, verify, fingerprint, sealTo, openSealed, canonicalize, HASH_BYTES, hash, KDF_ALG_ARGON2ID13, KDF_SALT_BYTES, KDF_KEY_BYTES, KDF_FLOOR, KDF_MODERATE, generateSalt, assertKdfParams, deriveKeyFromPassword }; diff --git a/lib/chunks/index-ztead7tp.js b/lib/chunks/index-ztead7tp.js new file mode 100644 index 0000000..69f02e0 --- /dev/null +++ b/lib/chunks/index-ztead7tp.js @@ -0,0 +1,1468 @@ +import { + HASH_BYTES, + SIGNING_PUBLIC_KEY_BYTES, + canonicalize, + fingerprint, + fromBase64Url, + hash, + openSealed, + randomBytes, + sealTo, + sign, + toBase64Url, + verify +} from "./index-kcrag88y.js"; + +// src/protocol/errors.ts +class ProtocolError extends Error { + code; + constructor(code, message) { + super(message); + this.name = "ProtocolError"; + this.code = code; + } +} + +// src/protocol/domains.ts +var PROTOCOL_VERSION = 1; +var utf8Encoder = new TextEncoder; +var DOMAIN_COMMAND = utf8Encoder.encode("tegrad/command/v1\x00"); +var DOMAIN_SESSION = utf8Encoder.encode("tegrad/session/v1\x00"); +var DOMAIN_AGENT_MESSAGE = utf8Encoder.encode("tegrad/agent-message/v1\x00"); +var DOMAIN_REVOCATION = utf8Encoder.encode("tegrad/revocation/v1\x00"); +var DOMAIN_TRUST_GRANT = utf8Encoder.encode("tegrad/trust-grant/v1\x00"); +var DOMAIN_PAIRING_PROOF = utf8Encoder.encode("tegrad/pairing-proof/v1\x00"); +function concatBytes(...parts) { + let total = 0; + for (const part of parts) { + total += part.length; + } + const out = new Uint8Array(total); + let offset = 0; + for (const part of parts) { + out.set(part, offset); + offset += part.length; + } + return out; +} +function assertSupportedVersion(value) { + if (typeof value === "object" && value !== null && "v" in value) { + const version = value.v; + if (version !== PROTOCOL_VERSION) { + throw new ProtocolError("unsupported_version", "Unsupported protocol version"); + } + } +} + +// src/protocol/schemas.ts +import { z } from "zod"; +var keyIdSchema = z.string().regex(/^[a-z2-7]{32}$/, "Invalid KeyId"); +var base64UrlSchema = z.string().min(1).regex(/^[A-Za-z0-9_-]+$/, "Invalid base64url"); +var sessionCertificateSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + session_key: base64UrlSchema, + account: keyIdSchema, + not_before: z.number().int().nonnegative(), + not_after: z.number().int().nonnegative(), + id: base64UrlSchema, + sig: base64UrlSchema +}); +var commandHeaderSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + id: base64UrlSchema, + type: z.string().min(1), + agent: keyIdSchema, + signer: keyIdSchema, + issued_at: z.number().int().nonnegative(), + expires_at: z.number().int().nonnegative(), + counter: z.number().int().nonnegative() +}); +var signedCommandSchema = z.object({ + header: commandHeaderSchema, + payload: base64UrlSchema, + session: sessionCertificateSchema.optional(), + sig: base64UrlSchema +}); +var agentMessageHeaderSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + id: base64UrlSchema, + type: z.string().min(1), + agent: keyIdSchema, + recipient: keyIdSchema, + sent_at: z.number().int().nonnegative(), + seq: z.number().int().nonnegative() +}); +var agentMessageSchema = z.object({ + header: agentMessageHeaderSchema, + payload: base64UrlSchema, + sig: base64UrlSchema +}); +var revocationListSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + account: keyIdSchema, + issued_at: z.number().int().nonnegative(), + revoked: z.array(base64UrlSchema), + sig: base64UrlSchema +}); +var transportCommandFrameSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + kind: z.literal("command"), + route: z.object({ + agent: keyIdSchema + }), + body: signedCommandSchema +}); +var transportEventFrameSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + kind: z.literal("event"), + route: z.object({ + agent: keyIdSchema, + recipient: keyIdSchema + }), + body: agentMessageSchema +}); +var transportAckFrameSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + kind: z.literal("ack"), + route: z.object({ + agent: keyIdSchema + }), + body: z.object({ + id: base64UrlSchema, + ok: z.boolean(), + code: z.string().optional() + }) +}); +var transportPingFrameSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + kind: z.literal("ping"), + route: z.object({ + agent: keyIdSchema + }), + body: z.object({ + ts: z.number().int().nonnegative() + }) +}); +var transportFrameSchema = z.discriminatedUnion("kind", [ + transportCommandFrameSchema, + transportEventFrameSchema, + transportAckFrameSchema, + transportPingFrameSchema +]); + +// src/protocol/agent-message.ts +var utf8Decoder = new TextDecoder("utf-8", { fatal: true }); +function sealAgentMessage(params) { + const header = { + v: PROTOCOL_VERSION, + id: params.id ?? toBase64Url(randomBytes(16)), + type: params.type, + agent: fingerprint(params.agentKeyPair.publicKey), + recipient: fingerprint(params.recipientPublicKey), + sent_at: params.sentAt, + seq: params.seq + }; + const payloadBytes = sealTo(canonicalize(params.body), params.recipientPublicKey); + const signingInput = concatBytes(DOMAIN_AGENT_MESSAGE, canonicalize(header), payloadBytes); + const signature = sign(signingInput, params.agentKeyPair.secretKey); + return { + header, + payload: toBase64Url(payloadBytes), + sig: toBase64Url(signature) + }; +} +function openAgentMessage(message, agentPublicKey, recipientKeyPair) { + if (typeof message === "object" && message !== null && "header" in message) { + assertSupportedVersion(message.header); + } + const parsed = agentMessageSchema.safeParse(message); + if (!parsed.success) { + throw new ProtocolError("invalid_format", "Malformed agent message"); + } + const { header, payload, sig } = parsed.data; + if (header.agent !== fingerprint(agentPublicKey)) { + throw new ProtocolError("wrong_agent", "Agent message sender mismatch"); + } + if (header.recipient !== fingerprint(recipientKeyPair.publicKey)) { + throw new ProtocolError("wrong_recipient", "Agent message recipient mismatch"); + } + let payloadBytes; + try { + payloadBytes = fromBase64Url(payload); + } catch { + throw new ProtocolError("invalid_format", "Invalid payload encoding"); + } + let signatureBytes; + try { + signatureBytes = fromBase64Url(sig); + } catch { + throw new ProtocolError("bad_signature", "Invalid signature encoding"); + } + const signingInput = concatBytes(DOMAIN_AGENT_MESSAGE, canonicalize(header), payloadBytes); + if (!verify(signingInput, signatureBytes, agentPublicKey)) { + throw new ProtocolError("bad_signature", "Invalid agent message signature"); + } + let plaintext; + try { + plaintext = openSealed(payloadBytes, recipientKeyPair); + } catch { + throw new ProtocolError("decrypt_failed", "Failed to decrypt agent message payload"); + } + let body; + try { + body = JSON.parse(utf8Decoder.decode(plaintext)); + } catch { + throw new ProtocolError("invalid_body", "Agent message payload is not valid JSON"); + } + return { header, body }; +} +// src/protocol/session.ts +function signSessionCertificate(params) { + if (params.sessionPublicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new RangeError(`Session public key must be ${SIGNING_PUBLIC_KEY_BYTES} bytes`); + } + if (!Number.isSafeInteger(params.notBefore) || !Number.isSafeInteger(params.notAfter)) { + throw new RangeError("Session validity timestamps must be safe integers"); + } + if (params.notBefore < 0 || params.notAfter <= params.notBefore) { + throw new RangeError("Invalid session certificate validity window"); + } + const unsigned = { + v: PROTOCOL_VERSION, + session_key: toBase64Url(params.sessionPublicKey), + account: fingerprint(params.accountKeyPair.publicKey), + not_before: params.notBefore, + not_after: params.notAfter, + id: params.id ?? toBase64Url(randomBytes(16)) + }; + const signingInput = concatBytes(DOMAIN_SESSION, canonicalize(unsigned)); + const signature = sign(signingInput, params.accountKeyPair.secretKey); + return { + ...unsigned, + sig: toBase64Url(signature) + }; +} +function verifySessionCertificate(certificate, accountPublicKey, atTime) { + assertSupportedVersion(certificate); + const parsed = sessionCertificateSchema.safeParse(certificate); + if (!parsed.success) { + throw new ProtocolError("session_invalid", "Malformed session certificate"); + } + const cert = parsed.data; + if (cert.account !== fingerprint(accountPublicKey)) { + throw new ProtocolError("session_invalid", "Session certificate account mismatch"); + } + if (cert.not_after <= cert.not_before) { + throw new ProtocolError("session_invalid", "Session certificate has invalid validity window"); + } + if (atTime !== undefined && (atTime < cert.not_before || atTime >= cert.not_after)) { + throw new ProtocolError("session_invalid", "Session certificate is not valid at this time"); + } + let sessionPublicKey; + let signatureBytes; + try { + sessionPublicKey = fromBase64Url(cert.session_key); + signatureBytes = fromBase64Url(cert.sig); + } catch { + throw new ProtocolError("session_invalid", "Invalid base64url encoding in session certificate"); + } + if (sessionPublicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new ProtocolError("session_invalid", "Invalid session public key length"); + } + const { sig: _sig, ...unsigned } = cert; + const signingInput = concatBytes(DOMAIN_SESSION, canonicalize(unsigned)); + if (!verify(signingInput, signatureBytes, accountPublicKey)) { + throw new ProtocolError("session_invalid", "Invalid session certificate signature"); + } + return { + certificate: cert, + sessionPublicKey + }; +} + +// src/protocol/command.ts +var COMMAND_ID_BYTES = 16; +var DEFAULT_COMMAND_TTL_MS = 5 * 60 * 1000; +var MAX_COMMAND_TTL_MS = 10 * 60 * 1000; +var MAX_CLOCK_SKEW_MS = 30 * 1000; +var utf8Decoder2 = new TextDecoder("utf-8", { fatal: true }); +function createSignedCommand(params, registry) { + const definition = registry.get(params.type); + if (!definition) { + throw new ProtocolError("unknown_command", "Unknown command type"); + } + const parsedBody = definition.body.safeParse(params.body); + if (!parsedBody.success) { + throw new ProtocolError("invalid_body", "Command body failed schema validation"); + } + const ttlMs = params.ttlMs ?? DEFAULT_COMMAND_TTL_MS; + const header = { + v: PROTOCOL_VERSION, + id: params.id ?? toBase64Url(randomBytes(COMMAND_ID_BYTES)), + type: params.type, + agent: fingerprint(params.agentPublicKey), + signer: fingerprint(params.signer.publicKey), + issued_at: params.now, + expires_at: params.now + ttlMs, + counter: params.counter + }; + const payloadBytes = sealTo(canonicalize(parsedBody.data), params.agentPublicKey); + const signingInput = concatBytes(DOMAIN_COMMAND, canonicalize(header), payloadBytes); + const signature = sign(signingInput, params.signer.secretKey); + const command = { + header, + payload: toBase64Url(payloadBytes), + ...params.session !== undefined ? { session: params.session } : {}, + sig: toBase64Url(signature) + }; + return command; +} +async function openCommand(command, trust, registry) { + if (typeof command === "object" && command !== null) { + if ("header" in command) { + assertSupportedVersion(command.header); + } + if ("session" in command && command.session !== undefined) { + assertSupportedVersion(command.session); + } + } + const parsed = signedCommandSchema.safeParse(command); + if (!parsed.success) { + throw new ProtocolError("invalid_format", "Malformed signed command"); + } + const { header, payload, session, sig } = parsed.data; + let idBytes; + try { + idBytes = fromBase64Url(header.id); + } catch { + throw new ProtocolError("invalid_format", "Invalid command id encoding"); + } + if (idBytes.length !== COMMAND_ID_BYTES) { + throw new ProtocolError("invalid_format", "Invalid command id length"); + } + const localAgentId = fingerprint(trust.agentKeyPair.publicKey); + if (header.agent !== localAgentId) { + throw new ProtocolError("wrong_agent", "Command is addressed to a different agent"); + } + const now = trust.now(); + if (header.expires_at <= header.issued_at) { + throw new ProtocolError("expired", "Command expiration is not after issuance"); + } + if (header.expires_at - header.issued_at > MAX_COMMAND_TTL_MS) { + throw new ProtocolError("ttl_too_long", "Command lifetime exceeds maximum allowed window"); + } + if (header.issued_at > now + MAX_CLOCK_SKEW_MS) { + throw new ProtocolError("not_yet_valid", "Command issued_at is in the future"); + } + if (now >= header.expires_at) { + throw new ProtocolError("expired", "Command has expired"); + } + let signerPublicKey; + let signerType; + let accountId; + let sessionId; + if (session !== undefined) { + const accountPublicKey = trust.isTrustedAccountKey(session.account); + if (accountPublicKey === null) { + throw new ProtocolError("untrusted_signer", "Session certificate account key is not trusted"); + } + if (trust.isSessionRevoked(session.id)) { + throw new ProtocolError("session_revoked", "Session certificate has been revoked"); + } + const verifiedSession = verifySessionCertificate(session, accountPublicKey, header.issued_at); + if (fingerprint(verifiedSession.sessionPublicKey) !== header.signer) { + throw new ProtocolError("session_invalid", "Session certificate key does not match command signer"); + } + signerPublicKey = verifiedSession.sessionPublicKey; + signerType = "session"; + accountId = session.account; + sessionId = session.id; + } else { + const accountPublicKey = trust.isTrustedAccountKey(header.signer); + if (accountPublicKey === null) { + throw new ProtocolError("untrusted_signer", "Command signer is not a trusted account key"); + } + signerPublicKey = accountPublicKey; + signerType = "account"; + accountId = header.signer; + } + let payloadBytes; + try { + payloadBytes = fromBase64Url(payload); + } catch { + throw new ProtocolError("invalid_format", "Invalid payload encoding"); + } + let signatureBytes; + try { + signatureBytes = fromBase64Url(sig); + } catch { + throw new ProtocolError("bad_signature", "Invalid signature encoding"); + } + const signingInput = concatBytes(DOMAIN_COMMAND, canonicalize(header), payloadBytes); + if (!verify(signingInput, signatureBytes, signerPublicKey)) { + throw new ProtocolError("bad_signature", "Invalid command signature"); + } + if (!trust.claimCommand(header.signer, header.id, header.counter)) { + throw new ProtocolError("replayed", "Command replay or non-increasing counter detected"); + } + let plaintext; + try { + plaintext = openSealed(payloadBytes, trust.agentKeyPair); + } catch { + throw new ProtocolError("decrypt_failed", "Failed to decrypt command payload"); + } + const definition = registry.get(header.type); + if (!definition) { + throw new ProtocolError("unknown_command", "Unknown command type"); + } + let rawBody; + try { + rawBody = JSON.parse(utf8Decoder2.decode(plaintext)); + } catch { + throw new ProtocolError("invalid_body", "Decrypted command payload is not valid JSON"); + } + const bodyResult = definition.body.safeParse(rawBody); + if (!bodyResult.success) { + throw new ProtocolError("invalid_body", "Command body failed schema validation"); + } + if (definition.sensitive && signerType !== "account") { + throw new ProtocolError("sensitive_requires_account_key", "Sensitive command must be signed directly by an account key"); + } + return { + header, + body: bodyResult.data, + signerType, + accountId, + ...sessionId !== undefined ? { sessionId } : {} + }; +} +// src/protocol/commands/backup.ts +import { z as z3 } from "zod"; + +// src/protocol/registry.ts +function defineCommand(definition) { + return { + type: definition.type, + sensitive: definition.sensitive, + body: definition.body + }; +} + +class CommandRegistry { + #commands = new Map; + register(definition) { + if (this.#commands.has(definition.type)) { + throw new Error(`Command already registered: ${definition.type}`); + } + this.#commands.set(definition.type, definition); + return this; + } + registerAll(definitions) { + for (const definition of definitions) { + this.register(definition); + } + return this; + } + get(type) { + return this.#commands.get(type); + } + has(type) { + return this.#commands.has(type); + } + types() { + return [...this.#commands.keys()]; + } +} + +// src/protocol/commands/server.ts +import { z as z2 } from "zod"; +var SERVER_ID_REGEX = /^[a-z0-9][a-z0-9-]{0,62}$/; +var DEFAULT_SERVER_PORT = 25565; +var MAX_CONSOLE_LINE_LENGTH = 1024; +var MIN_SERVER_MEMORY_MB = 512; +var MAX_SERVER_MEMORY_MB = 1048576; +var MAX_JVM_ARGS = 64; +var serverIdSchema = z2.string().regex(SERVER_ID_REGEX, "server_id must match ^[a-z0-9][a-z0-9-]{0,62}$"); +var serverLoaderSchema = z2.enum(["vanilla", "fabric", "forge", "neoforge", "quilt"]); +var serverPortSchema = z2.number().int().min(1024).max(65535); +var serverMemoryMbSchema = z2.number().int().min(MIN_SERVER_MEMORY_MB).max(MAX_SERVER_MEMORY_MB); +var consoleLineSchema = z2.string().min(1).max(MAX_CONSOLE_LINE_LENGTH).refine((value) => !/[\r\n\0]/.test(value), { + message: "Console line must not contain newline, carriage return, or NUL characters" +}); +var strictServerIdBodySchema = z2.object({ + server_id: serverIdSchema +}).strict(); +var serverCreateBodySchema = z2.object({ + server_id: serverIdSchema, + name: z2.string().trim().min(1).max(128), + minecraft_version: z2.string().min(1).max(64), + loader: serverLoaderSchema, + loader_version: z2.string().min(1).max(64).optional(), + memory_mb: serverMemoryMbSchema, + jvm_args: z2.array(z2.string()).max(MAX_JVM_ARGS).optional(), + port: serverPortSchema.optional(), + eula_accepted: z2.boolean() +}).strict(); +var serverUpdateSettingsBodySchema = z2.object({ + server_id: serverIdSchema, + memory_mb: serverMemoryMbSchema.optional(), + jvm_args: z2.array(z2.string()).max(MAX_JVM_ARGS).optional(), + port: serverPortSchema.optional(), + eula_accepted: z2.boolean().optional() +}).strict(); +var serverConsoleSendBodySchema = z2.object({ + server_id: serverIdSchema, + line: consoleLineSchema +}).strict(); +var serverConsoleSubscribeBodySchema = z2.object({ + server_id: serverIdSchema, + from_offset: z2.number().int().nonnegative().optional() +}).strict(); +var serverCreateCommand = defineCommand({ + type: "server.create", + sensitive: false, + body: serverCreateBodySchema +}); +var serverRestartCommand = defineCommand({ + type: "server.restart", + sensitive: false, + body: strictServerIdBodySchema +}); +var serverStatusCommand = defineCommand({ + type: "server.status", + sensitive: false, + body: strictServerIdBodySchema +}); +var serverListCommand = defineCommand({ + type: "server.list", + sensitive: false, + body: z2.object({}).strict() +}); +var serverUpdateSettingsCommand = defineCommand({ + type: "server.update_settings", + sensitive: false, + body: serverUpdateSettingsBodySchema +}); +var serverConsoleSendCommand = defineCommand({ + type: "server.console.send", + sensitive: false, + body: serverConsoleSendBodySchema +}); +var serverConsoleSubscribeCommand = defineCommand({ + type: "server.console.subscribe", + sensitive: false, + body: serverConsoleSubscribeBodySchema +}); +var serverConsoleUnsubscribeCommand = defineCommand({ + type: "server.console.unsubscribe", + sensitive: false, + body: strictServerIdBodySchema +}); +var SERVER_COMMANDS = [ + serverCreateCommand, + serverRestartCommand, + serverStatusCommand, + serverListCommand, + serverUpdateSettingsCommand, + serverConsoleSendCommand, + serverConsoleSubscribeCommand, + serverConsoleUnsubscribeCommand +]; +function registerServerCommands(registry) { + return registry.registerAll(SERVER_COMMANDS); +} + +// src/protocol/commands/backup.ts +var BACKUP_ID_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/; +var MIN_BACKUP_INTERVAL_MINUTES = 5; +var MAX_BACKUP_INTERVAL_MINUTES = 43200; +var MIN_BACKUP_RETENTION_COUNT = 1; +var MAX_BACKUP_RETENTION_COUNT = 1000; +var backupIdSchema = z3.string().regex(BACKUP_ID_REGEX, "backup_id must match ^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"); +var backupDestinationKindSchema = z3.enum(["local", "s3", "tegra_cloud"]); +var backupScheduleConfigSchema = z3.object({ + enabled: z3.boolean(), + interval_minutes: z3.number().int().min(MIN_BACKUP_INTERVAL_MINUTES).max(MAX_BACKUP_INTERVAL_MINUTES), + retention_count: z3.number().int().min(MIN_BACKUP_RETENTION_COUNT).max(MAX_BACKUP_RETENTION_COUNT) +}).strict(); +var backupLocalConfigSchema = z3.object({ + enabled: z3.boolean(), + retention_count: z3.number().int().min(MIN_BACKUP_RETENTION_COUNT).max(MAX_BACKUP_RETENTION_COUNT).optional() +}).strict(); +var S3_BUCKET_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,253}[a-zA-Z0-9]?$/; +var S3_REGION_REGEX = /^[a-zA-Z0-9-]{1,64}$/; +var CONTROL_CHAR_REGEX = /\p{Cc}/u; +var s3BucketSchema = z3.string().min(1).max(255).regex(S3_BUCKET_REGEX, "Invalid S3 bucket name").refine((value) => !value.includes(".."), { message: "S3 bucket name must not contain '..'" }); +var s3RegionSchema = z3.string().min(1).max(64).regex(S3_REGION_REGEX, "Invalid S3 region"); +var s3PrefixSchema = z3.string().max(256).refine((value) => { + if (CONTROL_CHAR_REGEX.test(value) || value.includes("\\") || value.includes("?") || value.includes("#")) { + return false; + } + return !value.split("/").some((segment) => segment === "." || segment === ".."); +}, { message: "Invalid S3 prefix" }); +var backupS3ConfigSchema = z3.object({ + enabled: z3.boolean(), + bucket: s3BucketSchema.optional(), + region: s3RegionSchema.optional(), + endpoint: z3.string().min(1).max(512).optional(), + prefix: s3PrefixSchema.optional(), + retention_count: z3.number().int().min(MIN_BACKUP_RETENTION_COUNT).max(MAX_BACKUP_RETENTION_COUNT).optional(), + access_key_id: z3.string().min(1).max(256).optional(), + secret_access_key: z3.string().min(1).max(256).optional(), + session_token: z3.string().min(1).max(2048).optional() +}).strict(); +var backupTegraCloudConfigSchema = z3.object({ + enabled: z3.boolean(), + retention_count: z3.number().int().min(MIN_BACKUP_RETENTION_COUNT).max(MAX_BACKUP_RETENTION_COUNT).optional() +}).strict(); +var serverBackupConfigSetBodySchema = z3.object({ + server_id: serverIdSchema, + auto_before_change: z3.boolean().optional(), + schedule: backupScheduleConfigSchema.optional(), + local: backupLocalConfigSchema.optional(), + s3: backupS3ConfigSchema.optional(), + tegra_cloud: backupTegraCloudConfigSchema.optional() +}).strict(); +var serverBackupCreateBodySchema = z3.object({ + server_id: serverIdSchema, + note: z3.string().max(256).optional(), + tegra_cloud_upload_url: z3.string().min(1).max(4096).optional() +}).strict(); +var serverBackupListBodySchema = z3.object({ + server_id: serverIdSchema, + destination: backupDestinationKindSchema.optional() +}).strict(); +var serverBackupDeleteBodySchema = z3.object({ + server_id: serverIdSchema, + backup_id: backupIdSchema, + destination: backupDestinationKindSchema.optional() +}).strict(); +var serverBackupRestoreBodySchema = z3.object({ + server_id: serverIdSchema, + backup_id: backupIdSchema, + destination: backupDestinationKindSchema.optional(), + tegra_cloud_download_url: z3.string().min(1).max(4096).optional() +}).strict(); +var serverBackupConfigSetCommand = defineCommand({ + type: "server.backup.config.set", + sensitive: false, + body: serverBackupConfigSetBodySchema +}); +var serverBackupCreateCommand = defineCommand({ + type: "server.backup.create", + sensitive: false, + body: serverBackupCreateBodySchema +}); +var serverBackupListCommand = defineCommand({ + type: "server.backup.list", + sensitive: false, + body: serverBackupListBodySchema +}); +var serverBackupDeleteCommand = defineCommand({ + type: "server.backup.delete", + sensitive: true, + body: serverBackupDeleteBodySchema +}); +var serverBackupRestoreCommand = defineCommand({ + type: "server.backup.restore", + sensitive: true, + body: serverBackupRestoreBodySchema +}); +var BACKUP_COMMANDS = [ + serverBackupConfigSetCommand, + serverBackupCreateCommand, + serverBackupListCommand, + serverBackupDeleteCommand, + serverBackupRestoreCommand +]; +function registerBackupCommands(registry) { + return registry.registerAll(BACKUP_COMMANDS); +} +// src/protocol/commands/core.ts +import { z as z8 } from "zod"; + +// src/protocol/commands/files.ts +import { z as z4 } from "zod"; +var SERVER_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,62}$/; +var SHA256_HEX_PATTERN = /^[0-9a-f]{64}$/; +var fileEncodingSchema = z4.enum(["utf8", "base64"]); +var sha256HexSchema = z4.string().regex(SHA256_HEX_PATTERN, "Expected 64 lowercase hex characters"); +var filesListCommand = defineCommand({ + type: "files.list", + sensitive: false, + body: z4.object({ + server_id: serverIdSchema, + path: z4.string().optional() + }).strict() +}); +var filesStatCommand = defineCommand({ + type: "files.stat", + sensitive: false, + body: z4.object({ + server_id: serverIdSchema, + path: z4.string() + }).strict() +}); +var filesReadCommand = defineCommand({ + type: "files.read", + sensitive: false, + body: z4.object({ + server_id: serverIdSchema, + path: z4.string().min(1), + encoding: fileEncodingSchema.optional() + }).strict() +}); +var filesWriteCommand = defineCommand({ + type: "files.write", + sensitive: false, + body: z4.object({ + server_id: serverIdSchema, + path: z4.string().min(1), + content: z4.string(), + encoding: fileEncodingSchema.optional() + }).strict() +}); +var filesMkdirCommand = defineCommand({ + type: "files.mkdir", + sensitive: false, + body: z4.object({ + server_id: serverIdSchema, + path: z4.string().min(1) + }).strict() +}); +var filesRenameCommand = defineCommand({ + type: "files.rename", + sensitive: false, + body: z4.object({ + server_id: serverIdSchema, + path: z4.string().min(1), + new_name: z4.string().min(1) + }).strict() +}); +var filesMoveCommand = defineCommand({ + type: "files.move", + sensitive: false, + body: z4.object({ + server_id: serverIdSchema, + from_path: z4.string().min(1), + to_path: z4.string().min(1) + }).strict() +}); +var filesCopyCommand = defineCommand({ + type: "files.copy", + sensitive: false, + body: z4.object({ + server_id: serverIdSchema, + from_path: z4.string().min(1), + to_path: z4.string().min(1) + }).strict() +}); +var filesDeleteCommand = defineCommand({ + type: "files.delete", + sensitive: true, + body: z4.object({ + server_id: serverIdSchema, + path: z4.string().min(1), + recursive: z4.boolean().optional() + }).strict() +}); +var filesUploadBeginCommand = defineCommand({ + type: "files.upload.begin", + sensitive: false, + body: z4.object({ + server_id: serverIdSchema, + path: z4.string().min(1), + total_size: z4.number().int().nonnegative(), + sha256: sha256HexSchema, + part_size: z4.number().int().positive().optional() + }).strict() +}); +var filesUploadPartCommand = defineCommand({ + type: "files.upload.part", + sensitive: false, + body: z4.object({ + server_id: serverIdSchema, + upload_id: z4.string().min(1), + part_index: z4.number().int().nonnegative(), + data_base64: z4.string() + }).strict() +}); +var filesUploadCommitCommand = defineCommand({ + type: "files.upload.commit", + sensitive: false, + body: z4.object({ + server_id: serverIdSchema, + upload_id: z4.string().min(1) + }).strict() +}); +var filesUploadAbortCommand = defineCommand({ + type: "files.upload.abort", + sensitive: false, + body: z4.object({ + server_id: serverIdSchema, + upload_id: z4.string().min(1) + }).strict() +}); +var filesDownloadBeginCommand = defineCommand({ + type: "files.download.begin", + sensitive: false, + body: z4.object({ + server_id: serverIdSchema, + path: z4.string().min(1), + part_size: z4.number().int().positive().optional() + }).strict() +}); +var filesDownloadPartCommand = defineCommand({ + type: "files.download.part", + sensitive: false, + body: z4.object({ + server_id: serverIdSchema, + download_id: z4.string().min(1), + part_index: z4.number().int().nonnegative() + }).strict() +}); +var filesDownloadCloseCommand = defineCommand({ + type: "files.download.close", + sensitive: false, + body: z4.object({ + server_id: serverIdSchema, + download_id: z4.string().min(1) + }).strict() +}); +var filesDownloadCommand = defineCommand({ + type: "files.download", + sensitive: false, + body: z4.object({ + server_id: serverIdSchema, + path: z4.string().min(1), + offset: z4.number().int().nonnegative(), + length: z4.number().int().positive() + }).strict() +}); +var filesZipCommand = defineCommand({ + type: "files.zip", + sensitive: false, + body: z4.object({ + server_id: serverIdSchema, + paths: z4.array(z4.string().min(1)).min(1), + dest_path: z4.string().min(1) + }).strict() +}); +var filesUnzipCommand = defineCommand({ + type: "files.unzip", + sensitive: false, + body: z4.object({ + server_id: serverIdSchema, + zip_path: z4.string().min(1), + dest_path: z4.string().optional() + }).strict() +}); +var FILES_COMMANDS = [ + filesListCommand, + filesStatCommand, + filesReadCommand, + filesWriteCommand, + filesMkdirCommand, + filesRenameCommand, + filesMoveCommand, + filesCopyCommand, + filesDeleteCommand, + filesUploadBeginCommand, + filesUploadPartCommand, + filesUploadCommitCommand, + filesUploadAbortCommand, + filesDownloadBeginCommand, + filesDownloadPartCommand, + filesDownloadCloseCommand, + filesDownloadCommand, + filesZipCommand, + filesUnzipCommand +]; +function registerFilesCommands(registry) { + return registry.registerAll(FILES_COMMANDS); +} + +// src/protocol/commands/pairing.ts +import { z as z5 } from "zod"; +var agentRevocationsSetCommand = defineCommand({ + type: "agent.revocations.set", + sensitive: false, + body: z5.object({ + list: revocationListSchema + }) +}); +var PAIRING_COMMANDS = [agentRevocationsSetCommand]; +function registerPairingCommands(registry) { + return registry.registerAll(PAIRING_COMMANDS); +} + +// src/protocol/commands/state.ts +import { z as z6 } from "zod"; +var SHA1_HEX_PATTERN = /^[0-9a-f]{40}$/i; +var SHA512_HEX_PATTERN = /^[0-9a-f]{128}$/i; +var sha1HexSchema = z6.string().regex(SHA1_HEX_PATTERN, "Expected 40 hex characters").transform((v) => v.toLowerCase()); +var sha512HexSchema = z6.string().regex(SHA512_HEX_PATTERN, "Expected 128 hex characters").transform((v) => v.toLowerCase()); +var modSourceSchema = z6.enum(["modrinth", "curseforge", "tegra", "local"]); +var modLayerSchema = z6.enum(["origin", "user"]); +var MOD_UNSAFE_UNICODE_REGEX = /(?:\p{Cc}|\p{Cf}|\u034F|\u180E|\u2028|\u2029|\u3164|\uFFA0)/u; +var MOD_ENCODED_TRAVERSAL_REGEX = /%(?:2f|5c|00)/i; +var MOD_RESERVED_WINDOWS_REGEX = /^(?:CON|PRN|AUX|NUL|COM[1-9¹²³]|LPT[1-9¹²³]|CONIN\$|CONOUT\$|CLOCK\$)\s*(?:\.|$)/i; +var MOD_FORBIDDEN_NAMES = new Set([".runtime", ".tegrad-uploads"]); +var modFileNameSchema = z6.string().min(1).max(255).refine((name) => { + if (name.includes("/") || name.includes("\\") || name.includes("\x00") || name.includes(":") || name === "." || name === ".." || name.endsWith(".") || name.endsWith(" ")) { + return false; + } + if (MOD_UNSAFE_UNICODE_REGEX.test(name) || name.normalize("NFC") !== name) { + return false; + } + if (MOD_ENCODED_TRAVERSAL_REGEX.test(name) || MOD_RESERVED_WINDOWS_REGEX.test(name)) { + return false; + } + const lower = name.toLowerCase(); + if (MOD_FORBIDDEN_NAMES.has(lower) || lower.startsWith(".tmp-upload-")) { + return false; + } + return new TextEncoder().encode(name).byteLength <= 255; +}, { message: "Mod filename must be a single safe filename" }); +var serverModEntrySchema = z6.object({ + file: modFileNameSchema, + source: modSourceSchema, + project_id: z6.string().min(1).max(128).optional(), + version_id: z6.string().min(1).max(128).optional(), + sha1: sha1HexSchema.optional(), + sha256: sha256HexSchema.optional(), + sha512: sha512HexSchema.optional(), + layer: modLayerSchema +}).strict(); +var serverOriginSchema = z6.discriminatedUnion("kind", [ + z6.object({ + kind: z6.literal("modpack"), + source: modSourceSchema, + modpack_id: z6.string().min(1).max(128), + version_id: z6.string().min(1).max(128) + }).strict(), + z6.object({ + kind: z6.literal("local"), + note: z6.string().max(512).optional() + }).strict() +]).nullable(); +var serverOriginSyncStateSchema = z6.object({ + excluded_mod_keys: z6.array(z6.string().min(1).max(256)).max(4000), + synced_mod_keys: z6.array(z6.string().min(1).max(256)).max(4000), + removed_origin_files: z6.array(z6.string().min(1).max(1024)).max(5000).optional(), + synced_files: z6.array(z6.string().min(1).max(1024)).max(5000).optional(), + last_synced_at: z6.string().nullable().optional(), + last_synced_version_id: z6.string().min(1).max(128).nullable().optional() +}).strict(); +var modEnvironmentInfoSchema = z6.object({ + client: z6.enum(["required", "optional", "unsupported", "unknown"]).optional(), + server: z6.enum(["required", "optional", "unsupported", "unknown"]).optional() +}).strict(); +var originPlanModInputSchema = z6.object({ + key: z6.string().min(1).max(256), + file: modFileNameSchema, + name: z6.string().min(1).max(256).optional(), + enabled: z6.boolean().optional(), + source: modSourceSchema.optional(), + project_id: z6.string().min(1).max(128).optional(), + version_id: z6.string().min(1).max(128).optional(), + url: z6.string().url().max(2048).optional(), + sha1: sha1HexSchema.optional(), + sha256: sha256HexSchema.optional(), + sha512: sha512HexSchema.optional(), + environment: modEnvironmentInfoSchema.optional() +}).strict(); +var originPlanFileInputSchema = z6.object({ + path: z6.string().min(1).max(1024), + sha1: sha1HexSchema, + sha256: sha256HexSchema.optional(), + size_bytes: z6.number().int().nonnegative(), + url: z6.string().url().max(2048).optional(), + content_base64: z6.string().optional() +}).strict(); +var serverModsListBodySchema = z6.object({ + server_id: serverIdSchema +}).strict(); +var serverModsInstallBodySchema = z6.object({ + server_id: serverIdSchema, + file: modFileNameSchema, + url: z6.string().url().max(2048), + source: modSourceSchema, + project_id: z6.string().min(1).max(128).optional(), + version_id: z6.string().min(1).max(128).optional(), + sha1: sha1HexSchema.optional(), + sha256: sha256HexSchema.optional(), + sha512: sha512HexSchema.optional() +}).strict(); +var serverModsRemoveBodySchema = z6.object({ + server_id: serverIdSchema, + file: modFileNameSchema +}).strict(); +var serverOriginPlanBodySchema = z6.object({ + server_id: serverIdSchema, + to_version_id: z6.string().min(1).max(128), + source: modSourceSchema.optional(), + modpack_id: z6.string().min(1).max(128).optional(), + minecraft_version: z6.string().min(1).max(64).optional(), + loader: serverLoaderSchema.optional(), + loader_version: z6.string().min(1).max(64).nullable().optional(), + mods: z6.array(originPlanModInputSchema).max(2000), + files: z6.array(originPlanFileInputSchema).max(5000).optional() +}).strict(); +var serverOriginApplyBodySchema = z6.object({ + server_id: serverIdSchema, + plan_id: z6.string().min(1).max(128), + selected_mod_keys: z6.array(z6.string().min(1).max(256)).max(2000).optional(), + selected_file_paths: z6.array(z6.string().min(1).max(1024)).max(5000).optional() +}).strict(); +var serverOriginUnlinkBodySchema = z6.object({ + server_id: serverIdSchema +}).strict(); +var serverDeployServerpackBodySchema = z6.object({ + server_id: serverIdSchema, + url: z6.string().url().max(2048), + sha256: sha256HexSchema.optional(), + sha512: sha512HexSchema.optional(), + sha1: sha1HexSchema.optional(), + origin: serverOriginSchema.optional() +}).strict(); +var serverModsListCommand = defineCommand({ + type: "server.mods.list", + sensitive: false, + body: serverModsListBodySchema +}); +var serverModsInstallCommand = defineCommand({ + type: "server.mods.install", + sensitive: false, + body: serverModsInstallBodySchema +}); +var serverModsRemoveCommand = defineCommand({ + type: "server.mods.remove", + sensitive: false, + body: serverModsRemoveBodySchema +}); +var serverOriginPlanCommand = defineCommand({ + type: "server.origin.plan", + sensitive: false, + body: serverOriginPlanBodySchema +}); +var serverOriginApplyCommand = defineCommand({ + type: "server.origin.apply", + sensitive: true, + body: serverOriginApplyBodySchema +}); +var serverOriginUnlinkCommand = defineCommand({ + type: "server.origin.unlink", + sensitive: false, + body: serverOriginUnlinkBodySchema +}); +var serverDeployServerpackCommand = defineCommand({ + type: "server.deploy.serverpack", + sensitive: true, + body: serverDeployServerpackBodySchema +}); +var STATE_COMMANDS = [ + serverModsListCommand, + serverModsInstallCommand, + serverModsRemoveCommand, + serverOriginPlanCommand, + serverOriginApplyCommand, + serverOriginUnlinkCommand, + serverDeployServerpackCommand +]; +function registerStateCommands(registry) { + return registry.registerAll(STATE_COMMANDS); +} + +// src/protocol/commands/tunnel.ts +import { z as z7 } from "zod"; +var PLAYIT_SECRET_KEY_REGEX = /^[0-9a-fA-F]{16,256}$/; +var playitSecretKeySchema = z7.string().trim().regex(PLAYIT_SECRET_KEY_REGEX, "secret_key must be a 16-256 character hexadecimal string").refine((value) => value.length % 2 === 0, { + message: "secret_key must have an even number of hexadecimal characters" +}); +var tunnelPlayitSetKeyBodySchema = z7.object({ + secret_key: playitSecretKeySchema +}).strict(); +var tunnelPlayitSetKeyCommand = defineCommand({ + type: "tunnel.playit.set_key", + sensitive: true, + body: tunnelPlayitSetKeyBodySchema +}); +var tunnelPlayitStartCommand = defineCommand({ + type: "tunnel.playit.start", + sensitive: false, + body: z7.object({}).strict() +}); +var tunnelPlayitStopCommand = defineCommand({ + type: "tunnel.playit.stop", + sensitive: false, + body: z7.object({}).strict() +}); +var tunnelPlayitStatusCommand = defineCommand({ + type: "tunnel.playit.status", + sensitive: false, + body: z7.object({}).strict() +}); +var TUNNEL_COMMANDS = [ + tunnelPlayitSetKeyCommand, + tunnelPlayitStartCommand, + tunnelPlayitStopCommand, + tunnelPlayitStatusCommand +]; +function registerTunnelCommands(registry) { + return registry.registerAll(TUNNEL_COMMANDS); +} + +// src/protocol/commands/core.ts +var serverIdBodySchema = z8.object({ + server_id: z8.string().min(1) +}); +var strictServerDeleteBodySchema = z8.object({ + server_id: serverIdSchema +}).strict(); +var agentPingCommand = defineCommand({ + type: "agent.ping", + sensitive: false, + body: z8.object({}).strict() +}); +var serverStartCommand = defineCommand({ + type: "server.start", + sensitive: false, + body: serverIdBodySchema +}); +var serverStopCommand = defineCommand({ + type: "server.stop", + sensitive: false, + body: serverIdBodySchema +}); +var serverDeleteCommand = defineCommand({ + type: "server.delete", + sensitive: true, + body: strictServerDeleteBodySchema +}); +var CORE_COMMANDS = [ + agentPingCommand, + serverStartCommand, + serverStopCommand, + serverDeleteCommand +]; +function registerCoreCommands(registry) { + return registry.registerAll(CORE_COMMANDS); +} +function createCoreRegistry() { + return registerTunnelCommands(registerBackupCommands(registerStateCommands(registerServerCommands(registerFilesCommands(registerPairingCommands(registerCoreCommands(new CommandRegistry))))))); +} +// src/protocol/pairing.ts +import { z as z9 } from "zod"; +var PAIRING_CODE_LENGTH = 10; +var PAIRING_SECRET_BYTES = 16; +var DEFAULT_TRUST_GRANT_TTL_MS = 10 * 60 * 1000; +var MAX_TRUST_GRANT_TTL_MS = 15 * 60 * 1000; +var CROCKFORD_ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"; +var PAIRING_CODE_REGEX = /^[0-9A-HJKMNP-TV-Z]{10}$/; +var pairingCodeSchema = z9.string().regex(PAIRING_CODE_REGEX, "Invalid pairing code"); +var trustGrantSchema = z9.object({ + v: z9.literal(PROTOCOL_VERSION), + kind: z9.literal("agent-pairing"), + account_key: base64UrlSchema, + agent: keyIdSchema, + issued_at: z9.number().int().nonnegative(), + expires_at: z9.number().int().nonnegative(), + proof: base64UrlSchema.optional(), + sig: base64UrlSchema +}); +function bytesEqual(a, b) { + if (a.length !== b.length) { + return false; + } + let diff = 0; + for (let i = 0;i < a.length; i++) { + diff |= (a[i] ?? 0) ^ (b[i] ?? 0); + } + return diff === 0; +} +function decodeSecretBytes(secret) { + let bytes; + if (typeof secret === "string") { + if (!base64UrlSchema.safeParse(secret).success) { + return null; + } + try { + bytes = fromBase64Url(secret); + } catch { + return null; + } + } else { + bytes = secret; + } + if (bytes.length !== PAIRING_SECRET_BYTES) { + return null; + } + return bytes; +} +function generatePairingCode() { + const bytes = randomBytes(PAIRING_CODE_LENGTH); + let out = ""; + for (let i = 0;i < PAIRING_CODE_LENGTH; i++) { + const idx = (bytes[i] ?? 0) & 31; + out += CROCKFORD_ALPHABET[idx] ?? ""; + } + return out; +} +function generatePairingSecret() { + return toBase64Url(randomBytes(PAIRING_SECRET_BYTES)); +} +function buildPairingFragment(params) { + if (!pairingCodeSchema.safeParse(params.code).success) { + throw new ProtocolError("invalid_format", "Invalid pairing code"); + } + if (decodeSecretBytes(params.secret) === null) { + throw new ProtocolError("invalid_format", "Invalid pairing secret"); + } + if (!keyIdSchema.safeParse(params.agentFingerprint).success) { + throw new ProtocolError("invalid_format", "Invalid agent fingerprint"); + } + return `${params.code}.${params.secret}.${params.agentFingerprint}`; +} +function parsePairingFragment(text) { + const raw = text.startsWith("#") ? text.slice(1) : text; + if (raw.length === 0) { + throw new ProtocolError("invalid_format", "Empty pairing fragment"); + } + const parts = raw.split("."); + if (parts.length === 1) { + const code = parts[0] ?? ""; + if (!pairingCodeSchema.safeParse(code).success) { + throw new ProtocolError("invalid_format", "Invalid pairing code"); + } + return { code }; + } + if (parts.length === 3) { + const code = parts[0] ?? ""; + const secret = parts[1] ?? ""; + const agentFingerprint = parts[2] ?? ""; + if (!pairingCodeSchema.safeParse(code).success) { + throw new ProtocolError("invalid_format", "Invalid pairing code"); + } + if (decodeSecretBytes(secret) === null) { + throw new ProtocolError("invalid_format", "Invalid pairing secret"); + } + const parsedFp = keyIdSchema.safeParse(agentFingerprint); + if (!parsedFp.success) { + throw new ProtocolError("invalid_format", "Invalid agent fingerprint"); + } + return { + code, + secret, + agentFingerprint: parsedFp.data + }; + } + throw new ProtocolError("invalid_format", "Malformed pairing fragment"); +} +function computePairingProof(base, secretBytes) { + const input = concatBytes(DOMAIN_PAIRING_PROOF, canonicalize(base)); + return hash(input, secretBytes); +} +function signTrustGrant(params) { + if (!Number.isSafeInteger(params.issuedAt) || params.issuedAt < 0) { + throw new RangeError("issuedAt must be a non-negative safe integer"); + } + if (params.agentPublicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new RangeError(`Agent public key must be ${SIGNING_PUBLIC_KEY_BYTES} bytes`); + } + const ttlMs = params.ttlMs ?? DEFAULT_TRUST_GRANT_TTL_MS; + if (!Number.isSafeInteger(ttlMs) || ttlMs <= 0 || ttlMs > MAX_TRUST_GRANT_TTL_MS) { + throw new RangeError(`ttlMs must be a positive safe integer at most ${MAX_TRUST_GRANT_TTL_MS} ms`); + } + const base = { + v: PROTOCOL_VERSION, + kind: "agent-pairing", + account_key: toBase64Url(params.accountKeyPair.publicKey), + agent: fingerprint(params.agentPublicKey), + issued_at: params.issuedAt, + expires_at: params.issuedAt + ttlMs + }; + let proof; + if (params.secret !== undefined) { + const secretBytes = decodeSecretBytes(params.secret); + if (secretBytes === null) { + throw new RangeError(`Pairing secret must be ${PAIRING_SECRET_BYTES} bytes`); + } + proof = toBase64Url(computePairingProof(base, secretBytes)); + } + const unsigned = proof !== undefined ? { ...base, proof } : base; + const signingInput = concatBytes(DOMAIN_TRUST_GRANT, canonicalize(unsigned)); + const signature = sign(signingInput, params.accountKeyPair.secretKey); + return { + ...unsigned, + sig: toBase64Url(signature) + }; +} +function verifyTrustGrant(grant, options) { + assertSupportedVersion(grant); + const parsed = trustGrantSchema.safeParse(grant); + if (!parsed.success) { + throw new ProtocolError("grant_invalid", "Malformed trust grant"); + } + const data = parsed.data; + if (data.expires_at <= data.issued_at) { + throw new ProtocolError("grant_invalid", "Trust grant expiration is not after issuance"); + } + if (data.expires_at - data.issued_at > MAX_TRUST_GRANT_TTL_MS) { + throw new ProtocolError("grant_invalid", "Trust grant lifetime exceeds maximum allowed window"); + } + let accountPublicKey; + try { + accountPublicKey = fromBase64Url(data.account_key); + } catch { + throw new ProtocolError("grant_invalid", "Invalid account_key encoding in trust grant"); + } + if (accountPublicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new ProtocolError("grant_invalid", "Invalid account_key length in trust grant"); + } + const expectedAgent = fingerprint(options.agentPublicKey); + if (data.agent !== expectedAgent) { + throw new ProtocolError("grant_wrong_agent", "Trust grant is addressed to a different agent"); + } + if (data.issued_at > options.now + MAX_CLOCK_SKEW_MS) { + throw new ProtocolError("not_yet_valid", "Trust grant issued_at is in the future"); + } + if (options.now >= data.expires_at) { + throw new ProtocolError("grant_expired", "Trust grant has expired"); + } + let signatureBytes; + try { + signatureBytes = fromBase64Url(data.sig); + } catch { + throw new ProtocolError("grant_bad_signature", "Invalid trust grant signature encoding"); + } + const base = { + v: data.v, + kind: data.kind, + account_key: data.account_key, + agent: data.agent, + issued_at: data.issued_at, + expires_at: data.expires_at + }; + const unsigned = data.proof !== undefined ? { ...base, proof: data.proof } : base; + const signingInput = concatBytes(DOMAIN_TRUST_GRANT, canonicalize(unsigned)); + if (!verify(signingInput, signatureBytes, accountPublicKey)) { + throw new ProtocolError("grant_bad_signature", "Invalid trust grant signature"); + } + let proven = false; + if (data.proof === undefined) { + if (options.requireProof) { + throw new ProtocolError("grant_proof_required", "Trust grant is missing pairing proof"); + } + } else { + if (options.secret === undefined) { + throw new ProtocolError("grant_bad_proof", "Pairing secret unavailable to verify proof"); + } + const secretBytes = decodeSecretBytes(options.secret); + if (secretBytes === null) { + throw new ProtocolError("grant_bad_proof", "Invalid pairing secret"); + } + let proofBytes; + try { + proofBytes = fromBase64Url(data.proof); + } catch { + throw new ProtocolError("grant_bad_proof", "Invalid proof encoding"); + } + if (proofBytes.length !== HASH_BYTES) { + throw new ProtocolError("grant_bad_proof", "Invalid proof length"); + } + const expectedProof = computePairingProof(base, secretBytes); + if (!bytesEqual(proofBytes, expectedProof)) { + throw new ProtocolError("grant_bad_proof", "Pairing proof does not match secret"); + } + proven = true; + } + return { + accountPublicKey, + accountId: fingerprint(accountPublicKey), + proven + }; +} +// src/protocol/revocation.ts +function signRevocationList(params) { + if (!Number.isSafeInteger(params.issuedAt) || params.issuedAt < 0) { + throw new RangeError("issuedAt must be a non-negative safe integer"); + } + const unsigned = { + v: PROTOCOL_VERSION, + account: fingerprint(params.accountKeyPair.publicKey), + issued_at: params.issuedAt, + revoked: [...params.revoked] + }; + const signingInput = concatBytes(DOMAIN_REVOCATION, canonicalize(unsigned)); + const signature = sign(signingInput, params.accountKeyPair.secretKey); + return { + ...unsigned, + sig: toBase64Url(signature) + }; +} +function verifyRevocationList(list, accountPublicKey) { + assertSupportedVersion(list); + const parsed = revocationListSchema.safeParse(list); + if (!parsed.success) { + throw new ProtocolError("invalid_format", "Malformed revocation list"); + } + const data = parsed.data; + if (data.account !== fingerprint(accountPublicKey)) { + throw new ProtocolError("untrusted_signer", "Revocation list account mismatch"); + } + let signatureBytes; + try { + signatureBytes = fromBase64Url(data.sig); + } catch { + throw new ProtocolError("bad_signature", "Invalid revocation list signature encoding"); + } + const { sig: _sig, ...unsigned } = data; + const signingInput = concatBytes(DOMAIN_REVOCATION, canonicalize(unsigned)); + if (!verify(signingInput, signatureBytes, accountPublicKey)) { + throw new ProtocolError("bad_signature", "Invalid revocation list signature"); + } + return data; +} +// src/protocol/trust.ts +function createInMemoryTrustContext(options) { + const trusted = new Map; + for (const key of options.trustedAccountKeys) { + trusted.set(fingerprint(key), key); + } + const revoked = new Set(options.revokedSessionIds); + const seenIds = new Set; + const lastCounters = new Map; + let clock = options.now ?? (() => Date.now()); + return { + agentKeyPair: options.agentKeyPair, + isTrustedAccountKey(id) { + return trusted.get(id) ?? null; + }, + isSessionRevoked(certificateId) { + return revoked.has(certificateId); + }, + now() { + return clock(); + }, + claimCommand(signer, id, counter) { + if (seenIds.has(id)) { + return false; + } + const prev = lastCounters.get(signer); + if (prev !== undefined && counter <= prev) { + return false; + } + seenIds.add(id); + lastCounters.set(signer, counter); + return true; + }, + revokeSession(certificateId) { + revoked.add(certificateId); + }, + setNow(nextClock) { + clock = nextClock; + } + }; +} +export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, transportFrameSchema, sealAgentMessage, openAgentMessage, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, serverCreateBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverCreateCommand, serverRestartCommand, serverStatusCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; diff --git a/lib/crypto/index.js b/lib/crypto/index.js new file mode 100644 index 0000000..48aba73 --- /dev/null +++ b/lib/crypto/index.js @@ -0,0 +1,76 @@ +import { + AEAD_NONCE_BYTES, + AEAD_TAG_BYTES, + FINGERPRINT_HASH_BYTES, + FINGERPRINT_TRUNCATED_BYTES, + HASH_BYTES, + KDF_ALG_ARGON2ID13, + KDF_FLOOR, + KDF_KEY_BYTES, + KDF_MODERATE, + KDF_SALT_BYTES, + SIGNATURE_BYTES, + SIGNING_PUBLIC_KEY_BYTES, + SIGNING_SECRET_KEY_BYTES, + SIGNING_SEED_BYTES, + SYMMETRIC_KEY_BYTES, + aeadDecrypt, + aeadEncrypt, + assertKdfParams, + canonicalize, + deriveKeyFromPassword, + fingerprint, + fromBase64Url, + generateSalt, + generateSigningKeyPair, + generateSymmetricKey, + hash, + memzero, + openSealed, + randomBytes, + ready, + sealTo, + sign, + signingKeyPairFromSeed, + toBase32, + toBase64Url, + verify +} from "../chunks/index-kcrag88y.js"; +export { + verify, + toBase64Url, + toBase32, + signingKeyPairFromSeed, + sign, + sealTo, + ready, + randomBytes, + openSealed, + memzero, + hash, + generateSymmetricKey, + generateSigningKeyPair, + generateSalt, + fromBase64Url, + fingerprint, + deriveKeyFromPassword, + canonicalize, + assertKdfParams, + aeadEncrypt, + aeadDecrypt, + SYMMETRIC_KEY_BYTES, + SIGNING_SEED_BYTES, + SIGNING_SECRET_KEY_BYTES, + SIGNING_PUBLIC_KEY_BYTES, + SIGNATURE_BYTES, + KDF_SALT_BYTES, + KDF_MODERATE, + KDF_KEY_BYTES, + KDF_FLOOR, + KDF_ALG_ARGON2ID13, + HASH_BYTES, + FINGERPRINT_TRUNCATED_BYTES, + FINGERPRINT_HASH_BYTES, + AEAD_TAG_BYTES, + AEAD_NONCE_BYTES +}; diff --git a/lib/protocol/index.js b/lib/protocol/index.js new file mode 100644 index 0000000..08bee31 --- /dev/null +++ b/lib/protocol/index.js @@ -0,0 +1,347 @@ +import { + BACKUP_COMMANDS, + BACKUP_ID_REGEX, + COMMAND_ID_BYTES, + CORE_COMMANDS, + CommandRegistry, + DEFAULT_COMMAND_TTL_MS, + DEFAULT_SERVER_PORT, + DEFAULT_TRUST_GRANT_TTL_MS, + DOMAIN_AGENT_MESSAGE, + DOMAIN_COMMAND, + DOMAIN_PAIRING_PROOF, + DOMAIN_REVOCATION, + DOMAIN_SESSION, + DOMAIN_TRUST_GRANT, + FILES_COMMANDS, + MAX_BACKUP_INTERVAL_MINUTES, + MAX_BACKUP_RETENTION_COUNT, + MAX_CLOCK_SKEW_MS, + MAX_COMMAND_TTL_MS, + MAX_CONSOLE_LINE_LENGTH, + MAX_JVM_ARGS, + MAX_SERVER_MEMORY_MB, + MAX_TRUST_GRANT_TTL_MS, + MIN_BACKUP_INTERVAL_MINUTES, + MIN_BACKUP_RETENTION_COUNT, + MIN_SERVER_MEMORY_MB, + PAIRING_CODE_LENGTH, + PAIRING_COMMANDS, + PAIRING_SECRET_BYTES, + PLAYIT_SECRET_KEY_REGEX, + PROTOCOL_VERSION, + ProtocolError, + SERVER_COMMANDS, + SERVER_ID_PATTERN, + SERVER_ID_REGEX, + SHA1_HEX_PATTERN, + SHA256_HEX_PATTERN, + SHA512_HEX_PATTERN, + STATE_COMMANDS, + TUNNEL_COMMANDS, + agentMessageHeaderSchema, + agentMessageSchema, + agentPingCommand, + agentRevocationsSetCommand, + backupDestinationKindSchema, + backupIdSchema, + backupLocalConfigSchema, + backupS3ConfigSchema, + backupScheduleConfigSchema, + backupTegraCloudConfigSchema, + base64UrlSchema, + buildPairingFragment, + commandHeaderSchema, + consoleLineSchema, + createCoreRegistry, + createInMemoryTrustContext, + createSignedCommand, + defineCommand, + fileEncodingSchema, + filesCopyCommand, + filesDeleteCommand, + filesDownloadBeginCommand, + filesDownloadCloseCommand, + filesDownloadCommand, + filesDownloadPartCommand, + filesListCommand, + filesMkdirCommand, + filesReadCommand, + filesRenameCommand, + filesStatCommand, + filesUnzipCommand, + filesUploadAbortCommand, + filesUploadBeginCommand, + filesUploadCommitCommand, + filesUploadPartCommand, + filesWriteCommand, + filesZipCommand, + generatePairingCode, + generatePairingSecret, + keyIdSchema, + modEnvironmentInfoSchema, + modFileNameSchema, + modLayerSchema, + modSourceSchema, + openAgentMessage, + openCommand, + originPlanFileInputSchema, + originPlanModInputSchema, + pairingCodeSchema, + parsePairingFragment, + playitSecretKeySchema, + registerBackupCommands, + registerCoreCommands, + registerFilesCommands, + registerPairingCommands, + registerServerCommands, + registerStateCommands, + registerTunnelCommands, + revocationListSchema, + s3BucketSchema, + s3PrefixSchema, + s3RegionSchema, + sealAgentMessage, + serverBackupConfigSetBodySchema, + serverBackupConfigSetCommand, + serverBackupCreateBodySchema, + serverBackupCreateCommand, + serverBackupDeleteBodySchema, + serverBackupDeleteCommand, + serverBackupListBodySchema, + serverBackupListCommand, + serverBackupRestoreBodySchema, + serverBackupRestoreCommand, + serverConsoleSendBodySchema, + serverConsoleSendCommand, + serverConsoleSubscribeBodySchema, + serverConsoleSubscribeCommand, + serverConsoleUnsubscribeCommand, + serverCreateBodySchema, + serverCreateCommand, + serverDeleteCommand, + serverDeployServerpackBodySchema, + serverDeployServerpackCommand, + serverIdSchema, + serverListCommand, + serverLoaderSchema, + serverMemoryMbSchema, + serverModEntrySchema, + serverModsInstallBodySchema, + serverModsInstallCommand, + serverModsListBodySchema, + serverModsListCommand, + serverModsRemoveBodySchema, + serverModsRemoveCommand, + serverOriginApplyBodySchema, + serverOriginApplyCommand, + serverOriginPlanBodySchema, + serverOriginPlanCommand, + serverOriginSchema, + serverOriginSyncStateSchema, + serverOriginUnlinkBodySchema, + serverOriginUnlinkCommand, + serverPortSchema, + serverRestartCommand, + serverStartCommand, + serverStatusCommand, + serverStopCommand, + serverUpdateSettingsBodySchema, + serverUpdateSettingsCommand, + sessionCertificateSchema, + sha1HexSchema, + sha256HexSchema, + sha512HexSchema, + signRevocationList, + signSessionCertificate, + signTrustGrant, + signedCommandSchema, + transportAckFrameSchema, + transportCommandFrameSchema, + transportEventFrameSchema, + transportFrameSchema, + transportPingFrameSchema, + trustGrantSchema, + tunnelPlayitSetKeyBodySchema, + tunnelPlayitSetKeyCommand, + tunnelPlayitStartCommand, + tunnelPlayitStatusCommand, + tunnelPlayitStopCommand, + verifyRevocationList, + verifySessionCertificate, + verifyTrustGrant +} from "../chunks/index-ztead7tp.js"; +import"../chunks/index-kcrag88y.js"; +export { + verifyTrustGrant, + verifySessionCertificate, + verifyRevocationList, + tunnelPlayitStopCommand, + tunnelPlayitStatusCommand, + tunnelPlayitStartCommand, + tunnelPlayitSetKeyCommand, + tunnelPlayitSetKeyBodySchema, + trustGrantSchema, + transportPingFrameSchema, + transportFrameSchema, + transportEventFrameSchema, + transportCommandFrameSchema, + transportAckFrameSchema, + signedCommandSchema, + signTrustGrant, + signSessionCertificate, + signRevocationList, + sha512HexSchema, + sha256HexSchema, + sha1HexSchema, + sessionCertificateSchema, + serverUpdateSettingsCommand, + serverUpdateSettingsBodySchema, + serverStopCommand, + serverStatusCommand, + serverStartCommand, + serverRestartCommand, + serverPortSchema, + serverOriginUnlinkCommand, + serverOriginUnlinkBodySchema, + serverOriginSyncStateSchema, + serverOriginSchema, + serverOriginPlanCommand, + serverOriginPlanBodySchema, + serverOriginApplyCommand, + serverOriginApplyBodySchema, + serverModsRemoveCommand, + serverModsRemoveBodySchema, + serverModsListCommand, + serverModsListBodySchema, + serverModsInstallCommand, + serverModsInstallBodySchema, + serverModEntrySchema, + serverMemoryMbSchema, + serverLoaderSchema, + serverListCommand, + serverIdSchema, + serverDeployServerpackCommand, + serverDeployServerpackBodySchema, + serverDeleteCommand, + serverCreateCommand, + serverCreateBodySchema, + serverConsoleUnsubscribeCommand, + serverConsoleSubscribeCommand, + serverConsoleSubscribeBodySchema, + serverConsoleSendCommand, + serverConsoleSendBodySchema, + serverBackupRestoreCommand, + serverBackupRestoreBodySchema, + serverBackupListCommand, + serverBackupListBodySchema, + serverBackupDeleteCommand, + serverBackupDeleteBodySchema, + serverBackupCreateCommand, + serverBackupCreateBodySchema, + serverBackupConfigSetCommand, + serverBackupConfigSetBodySchema, + sealAgentMessage, + s3RegionSchema, + s3PrefixSchema, + s3BucketSchema, + revocationListSchema, + registerTunnelCommands, + registerStateCommands, + registerServerCommands, + registerPairingCommands, + registerFilesCommands, + registerCoreCommands, + registerBackupCommands, + playitSecretKeySchema, + parsePairingFragment, + pairingCodeSchema, + originPlanModInputSchema, + originPlanFileInputSchema, + openCommand, + openAgentMessage, + modSourceSchema, + modLayerSchema, + modFileNameSchema, + modEnvironmentInfoSchema, + keyIdSchema, + generatePairingSecret, + generatePairingCode, + filesZipCommand, + filesWriteCommand, + filesUploadPartCommand, + filesUploadCommitCommand, + filesUploadBeginCommand, + filesUploadAbortCommand, + filesUnzipCommand, + filesStatCommand, + filesRenameCommand, + filesReadCommand, + filesMkdirCommand, + filesListCommand, + filesDownloadPartCommand, + filesDownloadCommand, + filesDownloadCloseCommand, + filesDownloadBeginCommand, + filesDeleteCommand, + filesCopyCommand, + fileEncodingSchema, + defineCommand, + createSignedCommand, + createInMemoryTrustContext, + createCoreRegistry, + consoleLineSchema, + commandHeaderSchema, + buildPairingFragment, + base64UrlSchema, + backupTegraCloudConfigSchema, + backupScheduleConfigSchema, + backupS3ConfigSchema, + backupLocalConfigSchema, + backupIdSchema, + backupDestinationKindSchema, + agentRevocationsSetCommand, + agentPingCommand, + agentMessageSchema, + agentMessageHeaderSchema, + TUNNEL_COMMANDS, + STATE_COMMANDS, + SHA512_HEX_PATTERN, + SHA256_HEX_PATTERN, + SHA1_HEX_PATTERN, + SERVER_ID_REGEX, + SERVER_ID_PATTERN, + SERVER_COMMANDS, + ProtocolError, + PROTOCOL_VERSION, + PLAYIT_SECRET_KEY_REGEX, + PAIRING_SECRET_BYTES, + PAIRING_COMMANDS, + PAIRING_CODE_LENGTH, + MIN_SERVER_MEMORY_MB, + MIN_BACKUP_RETENTION_COUNT, + MIN_BACKUP_INTERVAL_MINUTES, + MAX_TRUST_GRANT_TTL_MS, + MAX_SERVER_MEMORY_MB, + MAX_JVM_ARGS, + MAX_CONSOLE_LINE_LENGTH, + MAX_COMMAND_TTL_MS, + MAX_CLOCK_SKEW_MS, + MAX_BACKUP_RETENTION_COUNT, + MAX_BACKUP_INTERVAL_MINUTES, + FILES_COMMANDS, + DOMAIN_TRUST_GRANT, + DOMAIN_SESSION, + DOMAIN_REVOCATION, + DOMAIN_PAIRING_PROOF, + DOMAIN_COMMAND, + DOMAIN_AGENT_MESSAGE, + DEFAULT_TRUST_GRANT_TTL_MS, + DEFAULT_SERVER_PORT, + DEFAULT_COMMAND_TTL_MS, + CommandRegistry, + CORE_COMMANDS, + COMMAND_ID_BYTES, + BACKUP_ID_REGEX, + BACKUP_COMMANDS +}; diff --git a/lib/types/crypto/aead.d.ts b/lib/types/crypto/aead.d.ts new file mode 100644 index 0000000..0cc20c4 --- /dev/null +++ b/lib/types/crypto/aead.d.ts @@ -0,0 +1,6 @@ +export declare const SYMMETRIC_KEY_BYTES = 32; +export declare const AEAD_NONCE_BYTES = 24; +export declare const AEAD_TAG_BYTES = 16; +export declare function generateSymmetricKey(): Uint8Array; +export declare function aeadEncrypt(plaintext: Uint8Array, key: Uint8Array, associatedData?: Uint8Array): Uint8Array; +export declare function aeadDecrypt(ciphertext: Uint8Array, key: Uint8Array, associatedData?: Uint8Array): Uint8Array; diff --git a/lib/types/crypto/box.d.ts b/lib/types/crypto/box.d.ts new file mode 100644 index 0000000..bb2f0cc --- /dev/null +++ b/lib/types/crypto/box.d.ts @@ -0,0 +1,3 @@ +import { type PublicKey, type SigningKeyPair } from "./signing"; +export declare function sealTo(plaintext: Uint8Array, recipientSigningPublicKey: PublicKey): Uint8Array; +export declare function openSealed(ciphertext: Uint8Array, recipientSigningKeyPair: SigningKeyPair): Uint8Array; diff --git a/lib/types/crypto/canonical.d.ts b/lib/types/crypto/canonical.d.ts new file mode 100644 index 0000000..2780192 --- /dev/null +++ b/lib/types/crypto/canonical.d.ts @@ -0,0 +1 @@ +export declare function canonicalize(value: unknown): Uint8Array; diff --git a/lib/types/crypto/encoding.d.ts b/lib/types/crypto/encoding.d.ts new file mode 100644 index 0000000..30ae8db --- /dev/null +++ b/lib/types/crypto/encoding.d.ts @@ -0,0 +1,3 @@ +export declare function toBase64Url(bytes: Uint8Array): string; +export declare function fromBase64Url(text: string): Uint8Array; +export declare function toBase32(bytes: Uint8Array): string; diff --git a/lib/types/crypto/hash.d.ts b/lib/types/crypto/hash.d.ts new file mode 100644 index 0000000..8fdabeb --- /dev/null +++ b/lib/types/crypto/hash.d.ts @@ -0,0 +1,2 @@ +export declare const HASH_BYTES = 32; +export declare function hash(data: Uint8Array, key?: Uint8Array): Uint8Array; diff --git a/lib/types/crypto/index.d.ts b/lib/types/crypto/index.d.ts new file mode 100644 index 0000000..033edcc --- /dev/null +++ b/lib/types/crypto/index.d.ts @@ -0,0 +1,8 @@ +export { AEAD_NONCE_BYTES, AEAD_TAG_BYTES, aeadDecrypt, aeadEncrypt, generateSymmetricKey, SYMMETRIC_KEY_BYTES, } from "./aead"; +export { openSealed, sealTo } from "./box"; +export { canonicalize } from "./canonical"; +export { fromBase64Url, toBase32, toBase64Url } from "./encoding"; +export { HASH_BYTES, hash } from "./hash"; +export { assertKdfParams, deriveKeyFromPassword, generateSalt, KDF_ALG_ARGON2ID13, KDF_FLOOR, KDF_KEY_BYTES, KDF_MODERATE, KDF_SALT_BYTES, type KdfParams, type KdfPreset, } from "./kdf"; +export { FINGERPRINT_HASH_BYTES, FINGERPRINT_TRUNCATED_BYTES, fingerprint, generateSigningKeyPair, type PublicKey, type SecretKey, SIGNATURE_BYTES, SIGNING_PUBLIC_KEY_BYTES, SIGNING_SECRET_KEY_BYTES, SIGNING_SEED_BYTES, type SigningKeyPair, sign, signingKeyPairFromSeed, verify, } from "./signing"; +export { memzero, randomBytes, ready } from "./sodium"; diff --git a/lib/types/crypto/kdf.d.ts b/lib/types/crypto/kdf.d.ts new file mode 100644 index 0000000..03ab9db --- /dev/null +++ b/lib/types/crypto/kdf.d.ts @@ -0,0 +1,16 @@ +export declare const KDF_ALG_ARGON2ID13: "argon2id13"; +export declare const KDF_SALT_BYTES = 16; +export declare const KDF_KEY_BYTES = 32; +export interface KdfPreset { + readonly alg: typeof KDF_ALG_ARGON2ID13; + readonly opslimit: number; + readonly memlimit: number; +} +export interface KdfParams extends KdfPreset { + readonly salt: Uint8Array; +} +export declare const KDF_FLOOR: KdfPreset; +export declare const KDF_MODERATE: KdfPreset; +export declare function generateSalt(): Uint8Array; +export declare function assertKdfParams(params: unknown): asserts params is KdfParams; +export declare function deriveKeyFromPassword(password: string | Uint8Array, params: KdfParams, keyLength?: number): Uint8Array; diff --git a/lib/types/crypto/signing.d.ts b/lib/types/crypto/signing.d.ts new file mode 100644 index 0000000..80c5afa --- /dev/null +++ b/lib/types/crypto/signing.d.ts @@ -0,0 +1,17 @@ +export declare const SIGNING_PUBLIC_KEY_BYTES = 32; +export declare const SIGNING_SECRET_KEY_BYTES = 64; +export declare const SIGNING_SEED_BYTES = 32; +export declare const SIGNATURE_BYTES = 64; +export declare const FINGERPRINT_HASH_BYTES = 32; +export declare const FINGERPRINT_TRUNCATED_BYTES = 20; +export type PublicKey = Uint8Array; +export type SecretKey = Uint8Array; +export interface SigningKeyPair { + readonly publicKey: PublicKey; + readonly secretKey: SecretKey; +} +export declare function generateSigningKeyPair(): SigningKeyPair; +export declare function signingKeyPairFromSeed(seed: Uint8Array): SigningKeyPair; +export declare function sign(message: Uint8Array, secretKey: SecretKey): Uint8Array; +export declare function verify(message: Uint8Array, signature: Uint8Array, publicKey: PublicKey): boolean; +export declare function fingerprint(publicKey: PublicKey): string; diff --git a/lib/types/crypto/sodium.d.ts b/lib/types/crypto/sodium.d.ts new file mode 100644 index 0000000..76dd735 --- /dev/null +++ b/lib/types/crypto/sodium.d.ts @@ -0,0 +1,5 @@ +import sodium from "libsodium-wrappers-sumo"; +export declare function ready(): Promise; +export declare function getSodium(): typeof sodium; +export declare function randomBytes(length: number): Uint8Array; +export declare function memzero(buffer: Uint8Array): void; diff --git a/lib/types/protocol/agent-message.d.ts b/lib/types/protocol/agent-message.d.ts new file mode 100644 index 0000000..6e5e1dc --- /dev/null +++ b/lib/types/protocol/agent-message.d.ts @@ -0,0 +1,17 @@ +import { type PublicKey, type SigningKeyPair } from "../crypto"; +import { type AgentMessage, type AgentMessageHeader } from "./schemas"; +export interface SealAgentMessageParams { + readonly type: string; + readonly body: unknown; + readonly agentKeyPair: SigningKeyPair; + readonly recipientPublicKey: PublicKey; + readonly sentAt: number; + readonly seq: number; + readonly id?: string; +} +export interface OpenedAgentMessage { + readonly header: AgentMessageHeader; + readonly body: unknown; +} +export declare function sealAgentMessage(params: SealAgentMessageParams): AgentMessage; +export declare function openAgentMessage(message: unknown, agentPublicKey: PublicKey, recipientKeyPair: SigningKeyPair): OpenedAgentMessage; diff --git a/lib/types/protocol/command.d.ts b/lib/types/protocol/command.d.ts new file mode 100644 index 0000000..a45abbe --- /dev/null +++ b/lib/types/protocol/command.d.ts @@ -0,0 +1,28 @@ +import { type PublicKey, type SigningKeyPair } from "../crypto"; +import type { CommandRegistry } from "./registry"; +import { type CommandHeader, type KeyId, type SessionCertificate, type SignedCommand } from "./schemas"; +import type { TrustContext } from "./trust"; +export declare const COMMAND_ID_BYTES = 16; +export declare const DEFAULT_COMMAND_TTL_MS: number; +export declare const MAX_COMMAND_TTL_MS: number; +export declare const MAX_CLOCK_SKEW_MS: number; +export interface CreateSignedCommandParams { + readonly type: string; + readonly body: unknown; + readonly agentPublicKey: PublicKey; + readonly signer: SigningKeyPair; + readonly session?: SessionCertificate; + readonly counter: number; + readonly now: number; + readonly ttlMs?: number; + readonly id?: string; +} +export interface OpenedCommand { + readonly header: CommandHeader; + readonly body: TBody; + readonly signerType: "account" | "session"; + readonly accountId: KeyId; + readonly sessionId?: string; +} +export declare function createSignedCommand(params: CreateSignedCommandParams, registry: CommandRegistry): SignedCommand; +export declare function openCommand(command: unknown, trust: TrustContext, registry: CommandRegistry): Promise; diff --git a/lib/types/protocol/commands/backup.d.ts b/lib/types/protocol/commands/backup.d.ts new file mode 100644 index 0000000..4da6662 --- /dev/null +++ b/lib/types/protocol/commands/backup.d.ts @@ -0,0 +1,203 @@ +import { z } from "zod"; +import { type CommandRegistry } from "../registry"; +export declare const BACKUP_ID_REGEX: RegExp; +export declare const MIN_BACKUP_INTERVAL_MINUTES = 5; +export declare const MAX_BACKUP_INTERVAL_MINUTES = 43200; +export declare const MIN_BACKUP_RETENTION_COUNT = 1; +export declare const MAX_BACKUP_RETENTION_COUNT = 1000; +export declare const backupIdSchema: z.ZodString; +export declare const backupDestinationKindSchema: z.ZodEnum<{ + local: "local"; + s3: "s3"; + tegra_cloud: "tegra_cloud"; +}>; +export type BackupDestinationKind = z.infer; +export declare const backupScheduleConfigSchema: z.ZodObject<{ + enabled: z.ZodBoolean; + interval_minutes: z.ZodNumber; + retention_count: z.ZodNumber; +}, z.core.$strict>; +export declare const backupLocalConfigSchema: z.ZodObject<{ + enabled: z.ZodBoolean; + retention_count: z.ZodOptional; +}, z.core.$strict>; +export declare const s3BucketSchema: z.ZodString; +export declare const s3RegionSchema: z.ZodString; +export declare const s3PrefixSchema: z.ZodString; +export declare const backupS3ConfigSchema: z.ZodObject<{ + enabled: z.ZodBoolean; + bucket: z.ZodOptional; + region: z.ZodOptional; + endpoint: z.ZodOptional; + prefix: z.ZodOptional; + retention_count: z.ZodOptional; + access_key_id: z.ZodOptional; + secret_access_key: z.ZodOptional; + session_token: z.ZodOptional; +}, z.core.$strict>; +export declare const backupTegraCloudConfigSchema: z.ZodObject<{ + enabled: z.ZodBoolean; + retention_count: z.ZodOptional; +}, z.core.$strict>; +export declare const serverBackupConfigSetBodySchema: z.ZodObject<{ + server_id: z.ZodString; + auto_before_change: z.ZodOptional; + schedule: z.ZodOptional>; + local: z.ZodOptional; + }, z.core.$strict>>; + s3: z.ZodOptional; + region: z.ZodOptional; + endpoint: z.ZodOptional; + prefix: z.ZodOptional; + retention_count: z.ZodOptional; + access_key_id: z.ZodOptional; + secret_access_key: z.ZodOptional; + session_token: z.ZodOptional; + }, z.core.$strict>>; + tegra_cloud: z.ZodOptional; + }, z.core.$strict>>; +}, z.core.$strict>; +export declare const serverBackupCreateBodySchema: z.ZodObject<{ + server_id: z.ZodString; + note: z.ZodOptional; + tegra_cloud_upload_url: z.ZodOptional; +}, z.core.$strict>; +export declare const serverBackupListBodySchema: z.ZodObject<{ + server_id: z.ZodString; + destination: z.ZodOptional>; +}, z.core.$strict>; +export declare const serverBackupDeleteBodySchema: z.ZodObject<{ + server_id: z.ZodString; + backup_id: z.ZodString; + destination: z.ZodOptional>; +}, z.core.$strict>; +export declare const serverBackupRestoreBodySchema: z.ZodObject<{ + server_id: z.ZodString; + backup_id: z.ZodString; + destination: z.ZodOptional>; + tegra_cloud_download_url: z.ZodOptional; +}, z.core.$strict>; +export type BackupScheduleConfig = z.infer; +export type BackupLocalConfig = z.infer; +export type BackupS3ConfigInput = z.infer; +export type BackupTegraCloudConfig = z.infer; +export type ServerBackupConfigSetBody = z.infer; +export type ServerBackupCreateBody = z.infer; +export type ServerBackupListBody = z.infer; +export type ServerBackupDeleteBody = z.infer; +export type ServerBackupRestoreBody = z.infer; +export declare const serverBackupConfigSetCommand: import("..").CommandDefinition<"server.backup.config.set", { + server_id: string; + auto_before_change?: boolean | undefined; + schedule?: { + enabled: boolean; + interval_minutes: number; + retention_count: number; + } | undefined; + local?: { + enabled: boolean; + retention_count?: number | undefined; + } | undefined; + s3?: { + enabled: boolean; + bucket?: string | undefined; + region?: string | undefined; + endpoint?: string | undefined; + prefix?: string | undefined; + retention_count?: number | undefined; + access_key_id?: string | undefined; + secret_access_key?: string | undefined; + session_token?: string | undefined; + } | undefined; + tegra_cloud?: { + enabled: boolean; + retention_count?: number | undefined; + } | undefined; +}>; +export declare const serverBackupCreateCommand: import("..").CommandDefinition<"server.backup.create", { + server_id: string; + note?: string | undefined; + tegra_cloud_upload_url?: string | undefined; +}>; +export declare const serverBackupListCommand: import("..").CommandDefinition<"server.backup.list", { + server_id: string; + destination?: "local" | "s3" | "tegra_cloud" | undefined; +}>; +export declare const serverBackupDeleteCommand: import("..").CommandDefinition<"server.backup.delete", { + server_id: string; + backup_id: string; + destination?: "local" | "s3" | "tegra_cloud" | undefined; +}>; +export declare const serverBackupRestoreCommand: import("..").CommandDefinition<"server.backup.restore", { + server_id: string; + backup_id: string; + destination?: "local" | "s3" | "tegra_cloud" | undefined; + tegra_cloud_download_url?: string | undefined; +}>; +export declare const BACKUP_COMMANDS: readonly [import("..").CommandDefinition<"server.backup.config.set", { + server_id: string; + auto_before_change?: boolean | undefined; + schedule?: { + enabled: boolean; + interval_minutes: number; + retention_count: number; + } | undefined; + local?: { + enabled: boolean; + retention_count?: number | undefined; + } | undefined; + s3?: { + enabled: boolean; + bucket?: string | undefined; + region?: string | undefined; + endpoint?: string | undefined; + prefix?: string | undefined; + retention_count?: number | undefined; + access_key_id?: string | undefined; + secret_access_key?: string | undefined; + session_token?: string | undefined; + } | undefined; + tegra_cloud?: { + enabled: boolean; + retention_count?: number | undefined; + } | undefined; +}>, import("..").CommandDefinition<"server.backup.create", { + server_id: string; + note?: string | undefined; + tegra_cloud_upload_url?: string | undefined; +}>, import("..").CommandDefinition<"server.backup.list", { + server_id: string; + destination?: "local" | "s3" | "tegra_cloud" | undefined; +}>, import("..").CommandDefinition<"server.backup.delete", { + server_id: string; + backup_id: string; + destination?: "local" | "s3" | "tegra_cloud" | undefined; +}>, import("..").CommandDefinition<"server.backup.restore", { + server_id: string; + backup_id: string; + destination?: "local" | "s3" | "tegra_cloud" | undefined; + tegra_cloud_download_url?: string | undefined; +}>]; +export declare function registerBackupCommands(registry: CommandRegistry): CommandRegistry; diff --git a/lib/types/protocol/commands/core.d.ts b/lib/types/protocol/commands/core.d.ts new file mode 100644 index 0000000..cd7e40e --- /dev/null +++ b/lib/types/protocol/commands/core.d.ts @@ -0,0 +1,20 @@ +import { CommandRegistry } from "../registry"; +export declare const agentPingCommand: import("..").CommandDefinition<"agent.ping", Record>; +export declare const serverStartCommand: import("..").CommandDefinition<"server.start", { + server_id: string; +}>; +export declare const serverStopCommand: import("..").CommandDefinition<"server.stop", { + server_id: string; +}>; +export declare const serverDeleteCommand: import("..").CommandDefinition<"server.delete", { + server_id: string; +}>; +export declare const CORE_COMMANDS: readonly [import("..").CommandDefinition<"agent.ping", Record>, import("..").CommandDefinition<"server.start", { + server_id: string; +}>, import("..").CommandDefinition<"server.stop", { + server_id: string; +}>, import("..").CommandDefinition<"server.delete", { + server_id: string; +}>]; +export declare function registerCoreCommands(registry: CommandRegistry): CommandRegistry; +export declare function createCoreRegistry(): CommandRegistry; diff --git a/lib/types/protocol/commands/files.d.ts b/lib/types/protocol/commands/files.d.ts new file mode 100644 index 0000000..1dc4ffc --- /dev/null +++ b/lib/types/protocol/commands/files.d.ts @@ -0,0 +1,180 @@ +import { z } from "zod"; +import { type CommandRegistry } from "../registry"; +export declare const SERVER_ID_PATTERN: RegExp; +export declare const SHA256_HEX_PATTERN: RegExp; +export declare const fileEncodingSchema: z.ZodEnum<{ + base64: "base64"; + utf8: "utf8"; +}>; +export declare const sha256HexSchema: z.ZodString; +export declare const filesListCommand: import("..").CommandDefinition<"files.list", { + server_id: string; + path?: string | undefined; +}>; +export declare const filesStatCommand: import("..").CommandDefinition<"files.stat", { + server_id: string; + path: string; +}>; +export declare const filesReadCommand: import("..").CommandDefinition<"files.read", { + server_id: string; + path: string; + encoding?: "base64" | "utf8" | undefined; +}>; +export declare const filesWriteCommand: import("..").CommandDefinition<"files.write", { + server_id: string; + path: string; + content: string; + encoding?: "base64" | "utf8" | undefined; +}>; +export declare const filesMkdirCommand: import("..").CommandDefinition<"files.mkdir", { + server_id: string; + path: string; +}>; +export declare const filesRenameCommand: import("..").CommandDefinition<"files.rename", { + server_id: string; + path: string; + new_name: string; +}>; +export declare const filesMoveCommand: import("..").CommandDefinition<"files.move", { + server_id: string; + from_path: string; + to_path: string; +}>; +export declare const filesCopyCommand: import("..").CommandDefinition<"files.copy", { + server_id: string; + from_path: string; + to_path: string; +}>; +export declare const filesDeleteCommand: import("..").CommandDefinition<"files.delete", { + server_id: string; + path: string; + recursive?: boolean | undefined; +}>; +export declare const filesUploadBeginCommand: import("..").CommandDefinition<"files.upload.begin", { + server_id: string; + path: string; + total_size: number; + sha256: string; + part_size?: number | undefined; +}>; +export declare const filesUploadPartCommand: import("..").CommandDefinition<"files.upload.part", { + server_id: string; + upload_id: string; + part_index: number; + data_base64: string; +}>; +export declare const filesUploadCommitCommand: import("..").CommandDefinition<"files.upload.commit", { + server_id: string; + upload_id: string; +}>; +export declare const filesUploadAbortCommand: import("..").CommandDefinition<"files.upload.abort", { + server_id: string; + upload_id: string; +}>; +export declare const filesDownloadBeginCommand: import("..").CommandDefinition<"files.download.begin", { + server_id: string; + path: string; + part_size?: number | undefined; +}>; +export declare const filesDownloadPartCommand: import("..").CommandDefinition<"files.download.part", { + server_id: string; + download_id: string; + part_index: number; +}>; +export declare const filesDownloadCloseCommand: import("..").CommandDefinition<"files.download.close", { + server_id: string; + download_id: string; +}>; +export declare const filesDownloadCommand: import("..").CommandDefinition<"files.download", { + server_id: string; + path: string; + offset: number; + length: number; +}>; +export declare const filesZipCommand: import("..").CommandDefinition<"files.zip", { + server_id: string; + paths: string[]; + dest_path: string; +}>; +export declare const filesUnzipCommand: import("..").CommandDefinition<"files.unzip", { + server_id: string; + zip_path: string; + dest_path?: string | undefined; +}>; +export declare const FILES_COMMANDS: readonly [import("..").CommandDefinition<"files.list", { + server_id: string; + path?: string | undefined; +}>, import("..").CommandDefinition<"files.stat", { + server_id: string; + path: string; +}>, import("..").CommandDefinition<"files.read", { + server_id: string; + path: string; + encoding?: "base64" | "utf8" | undefined; +}>, import("..").CommandDefinition<"files.write", { + server_id: string; + path: string; + content: string; + encoding?: "base64" | "utf8" | undefined; +}>, import("..").CommandDefinition<"files.mkdir", { + server_id: string; + path: string; +}>, import("..").CommandDefinition<"files.rename", { + server_id: string; + path: string; + new_name: string; +}>, import("..").CommandDefinition<"files.move", { + server_id: string; + from_path: string; + to_path: string; +}>, import("..").CommandDefinition<"files.copy", { + server_id: string; + from_path: string; + to_path: string; +}>, import("..").CommandDefinition<"files.delete", { + server_id: string; + path: string; + recursive?: boolean | undefined; +}>, import("..").CommandDefinition<"files.upload.begin", { + server_id: string; + path: string; + total_size: number; + sha256: string; + part_size?: number | undefined; +}>, import("..").CommandDefinition<"files.upload.part", { + server_id: string; + upload_id: string; + part_index: number; + data_base64: string; +}>, import("..").CommandDefinition<"files.upload.commit", { + server_id: string; + upload_id: string; +}>, import("..").CommandDefinition<"files.upload.abort", { + server_id: string; + upload_id: string; +}>, import("..").CommandDefinition<"files.download.begin", { + server_id: string; + path: string; + part_size?: number | undefined; +}>, import("..").CommandDefinition<"files.download.part", { + server_id: string; + download_id: string; + part_index: number; +}>, import("..").CommandDefinition<"files.download.close", { + server_id: string; + download_id: string; +}>, import("..").CommandDefinition<"files.download", { + server_id: string; + path: string; + offset: number; + length: number; +}>, import("..").CommandDefinition<"files.zip", { + server_id: string; + paths: string[]; + dest_path: string; +}>, import("..").CommandDefinition<"files.unzip", { + server_id: string; + zip_path: string; + dest_path?: string | undefined; +}>]; +export declare function registerFilesCommands(registry: CommandRegistry): CommandRegistry; diff --git a/lib/types/protocol/commands/pairing.d.ts b/lib/types/protocol/commands/pairing.d.ts new file mode 100644 index 0000000..8bc8549 --- /dev/null +++ b/lib/types/protocol/commands/pairing.d.ts @@ -0,0 +1,20 @@ +import { type CommandRegistry } from "../registry"; +export declare const agentRevocationsSetCommand: import("..").CommandDefinition<"agent.revocations.set", { + list: { + v: 1; + account: string; + issued_at: number; + revoked: string[]; + sig: string; + }; +}>; +export declare const PAIRING_COMMANDS: readonly [import("..").CommandDefinition<"agent.revocations.set", { + list: { + v: 1; + account: string; + issued_at: number; + revoked: string[]; + sig: string; + }; +}>]; +export declare function registerPairingCommands(registry: CommandRegistry): CommandRegistry; diff --git a/lib/types/protocol/commands/server.d.ts b/lib/types/protocol/commands/server.d.ts new file mode 100644 index 0000000..71f306b --- /dev/null +++ b/lib/types/protocol/commands/server.d.ts @@ -0,0 +1,122 @@ +import { z } from "zod"; +import { type CommandRegistry } from "../registry"; +export declare const SERVER_ID_REGEX: RegExp; +export declare const DEFAULT_SERVER_PORT = 25565; +export declare const MAX_CONSOLE_LINE_LENGTH = 1024; +export declare const MIN_SERVER_MEMORY_MB = 512; +export declare const MAX_SERVER_MEMORY_MB = 1048576; +export declare const MAX_JVM_ARGS = 64; +export declare const serverIdSchema: z.ZodString; +export declare const serverLoaderSchema: z.ZodEnum<{ + fabric: "fabric"; + forge: "forge"; + neoforge: "neoforge"; + quilt: "quilt"; + vanilla: "vanilla"; +}>; +export type ServerLoader = z.infer; +export declare const serverPortSchema: z.ZodNumber; +export declare const serverMemoryMbSchema: z.ZodNumber; +export declare const consoleLineSchema: z.ZodString; +export declare const serverCreateBodySchema: z.ZodObject<{ + server_id: z.ZodString; + name: z.ZodString; + minecraft_version: z.ZodString; + loader: z.ZodEnum<{ + fabric: "fabric"; + forge: "forge"; + neoforge: "neoforge"; + quilt: "quilt"; + vanilla: "vanilla"; + }>; + loader_version: z.ZodOptional; + memory_mb: z.ZodNumber; + jvm_args: z.ZodOptional>; + port: z.ZodOptional; + eula_accepted: z.ZodBoolean; +}, z.core.$strict>; +export declare const serverUpdateSettingsBodySchema: z.ZodObject<{ + server_id: z.ZodString; + memory_mb: z.ZodOptional; + jvm_args: z.ZodOptional>; + port: z.ZodOptional; + eula_accepted: z.ZodOptional; +}, z.core.$strict>; +export declare const serverConsoleSendBodySchema: z.ZodObject<{ + server_id: z.ZodString; + line: z.ZodString; +}, z.core.$strict>; +export declare const serverConsoleSubscribeBodySchema: z.ZodObject<{ + server_id: z.ZodString; + from_offset: z.ZodOptional; +}, z.core.$strict>; +export type ServerCreateBody = z.infer; +export type ServerUpdateSettingsBody = z.infer; +export type ServerConsoleSendBody = z.infer; +export type ServerConsoleSubscribeBody = z.infer; +export declare const serverCreateCommand: import("..").CommandDefinition<"server.create", { + server_id: string; + name: string; + minecraft_version: string; + loader: "fabric" | "forge" | "neoforge" | "quilt" | "vanilla"; + loader_version?: string | undefined; + memory_mb: number; + jvm_args?: string[] | undefined; + port?: number | undefined; + eula_accepted: boolean; +}>; +export declare const serverRestartCommand: import("..").CommandDefinition<"server.restart", { + server_id: string; +}>; +export declare const serverStatusCommand: import("..").CommandDefinition<"server.status", { + server_id: string; +}>; +export declare const serverListCommand: import("..").CommandDefinition<"server.list", Record>; +export declare const serverUpdateSettingsCommand: import("..").CommandDefinition<"server.update_settings", { + server_id: string; + memory_mb?: number | undefined; + jvm_args?: string[] | undefined; + port?: number | undefined; + eula_accepted?: boolean | undefined; +}>; +export declare const serverConsoleSendCommand: import("..").CommandDefinition<"server.console.send", { + server_id: string; + line: string; +}>; +export declare const serverConsoleSubscribeCommand: import("..").CommandDefinition<"server.console.subscribe", { + server_id: string; + from_offset?: number | undefined; +}>; +export declare const serverConsoleUnsubscribeCommand: import("..").CommandDefinition<"server.console.unsubscribe", { + server_id: string; +}>; +export declare const SERVER_COMMANDS: readonly [import("..").CommandDefinition<"server.create", { + server_id: string; + name: string; + minecraft_version: string; + loader: "fabric" | "forge" | "neoforge" | "quilt" | "vanilla"; + loader_version?: string | undefined; + memory_mb: number; + jvm_args?: string[] | undefined; + port?: number | undefined; + eula_accepted: boolean; +}>, import("..").CommandDefinition<"server.restart", { + server_id: string; +}>, import("..").CommandDefinition<"server.status", { + server_id: string; +}>, import("..").CommandDefinition<"server.list", Record>, import("..").CommandDefinition<"server.update_settings", { + server_id: string; + memory_mb?: number | undefined; + jvm_args?: string[] | undefined; + port?: number | undefined; + eula_accepted?: boolean | undefined; +}>, import("..").CommandDefinition<"server.console.send", { + server_id: string; + line: string; +}>, import("..").CommandDefinition<"server.console.subscribe", { + server_id: string; + from_offset?: number | undefined; +}>, import("..").CommandDefinition<"server.console.unsubscribe", { + server_id: string; +}>]; +export declare function registerServerCommands(registry: CommandRegistry): CommandRegistry; diff --git a/lib/types/protocol/commands/state.d.ts b/lib/types/protocol/commands/state.d.ts new file mode 100644 index 0000000..a7b411d --- /dev/null +++ b/lib/types/protocol/commands/state.d.ts @@ -0,0 +1,388 @@ +import { z } from "zod"; +import { type CommandRegistry } from "../registry"; +export declare const SHA1_HEX_PATTERN: RegExp; +export declare const SHA512_HEX_PATTERN: RegExp; +export declare const sha1HexSchema: z.ZodPipe>; +export declare const sha512HexSchema: z.ZodPipe>; +export declare const modSourceSchema: z.ZodEnum<{ + curseforge: "curseforge"; + local: "local"; + modrinth: "modrinth"; + tegra: "tegra"; +}>; +export type ModSource = z.infer; +export declare const modLayerSchema: z.ZodEnum<{ + origin: "origin"; + user: "user"; +}>; +export type ModLayer = z.infer; +export declare const modFileNameSchema: z.ZodString; +export declare const serverModEntrySchema: z.ZodObject<{ + file: z.ZodString; + source: z.ZodEnum<{ + curseforge: "curseforge"; + local: "local"; + modrinth: "modrinth"; + tegra: "tegra"; + }>; + project_id: z.ZodOptional; + version_id: z.ZodOptional; + sha1: z.ZodOptional>>; + sha256: z.ZodOptional; + sha512: z.ZodOptional>>; + layer: z.ZodEnum<{ + origin: "origin"; + user: "user"; + }>; +}, z.core.$strict>; +export type ServerModEntry = z.infer; +export declare const serverOriginSchema: z.ZodNullable; + source: z.ZodEnum<{ + curseforge: "curseforge"; + local: "local"; + modrinth: "modrinth"; + tegra: "tegra"; + }>; + modpack_id: z.ZodString; + version_id: z.ZodString; +}, z.core.$strict>, z.ZodObject<{ + kind: z.ZodLiteral<"local">; + note: z.ZodOptional; +}, z.core.$strict>], "kind">>; +export type ServerOrigin = z.infer; +export declare const serverOriginSyncStateSchema: z.ZodObject<{ + excluded_mod_keys: z.ZodArray; + synced_mod_keys: z.ZodArray; + removed_origin_files: z.ZodOptional>; + synced_files: z.ZodOptional>; + last_synced_at: z.ZodOptional>; + last_synced_version_id: z.ZodOptional>; +}, z.core.$strict>; +export type ServerOriginSyncState = z.infer; +export declare const modEnvironmentInfoSchema: z.ZodObject<{ + client: z.ZodOptional>; + server: z.ZodOptional>; +}, z.core.$strict>; +export type ModEnvironmentInfo = z.infer; +export declare const originPlanModInputSchema: z.ZodObject<{ + key: z.ZodString; + file: z.ZodString; + name: z.ZodOptional; + enabled: z.ZodOptional; + source: z.ZodOptional>; + project_id: z.ZodOptional; + version_id: z.ZodOptional; + url: z.ZodOptional; + sha1: z.ZodOptional>>; + sha256: z.ZodOptional; + sha512: z.ZodOptional>>; + environment: z.ZodOptional>; + server: z.ZodOptional>; + }, z.core.$strict>>; +}, z.core.$strict>; +export type OriginPlanModInput = z.infer; +export declare const originPlanFileInputSchema: z.ZodObject<{ + path: z.ZodString; + sha1: z.ZodPipe>; + sha256: z.ZodOptional; + size_bytes: z.ZodNumber; + url: z.ZodOptional; + content_base64: z.ZodOptional; +}, z.core.$strict>; +export type OriginPlanFileInput = z.infer; +export declare const serverModsListBodySchema: z.ZodObject<{ + server_id: z.ZodString; +}, z.core.$strict>; +export declare const serverModsInstallBodySchema: z.ZodObject<{ + server_id: z.ZodString; + file: z.ZodString; + url: z.ZodString; + source: z.ZodEnum<{ + curseforge: "curseforge"; + local: "local"; + modrinth: "modrinth"; + tegra: "tegra"; + }>; + project_id: z.ZodOptional; + version_id: z.ZodOptional; + sha1: z.ZodOptional>>; + sha256: z.ZodOptional; + sha512: z.ZodOptional>>; +}, z.core.$strict>; +export declare const serverModsRemoveBodySchema: z.ZodObject<{ + server_id: z.ZodString; + file: z.ZodString; +}, z.core.$strict>; +export declare const serverOriginPlanBodySchema: z.ZodObject<{ + server_id: z.ZodString; + to_version_id: z.ZodString; + source: z.ZodOptional>; + modpack_id: z.ZodOptional; + minecraft_version: z.ZodOptional; + loader: z.ZodOptional>; + loader_version: z.ZodOptional>; + mods: z.ZodArray; + enabled: z.ZodOptional; + source: z.ZodOptional>; + project_id: z.ZodOptional; + version_id: z.ZodOptional; + url: z.ZodOptional; + sha1: z.ZodOptional>>; + sha256: z.ZodOptional; + sha512: z.ZodOptional>>; + environment: z.ZodOptional>; + server: z.ZodOptional>; + }, z.core.$strict>>; + }, z.core.$strict>>; + files: z.ZodOptional>; + sha256: z.ZodOptional; + size_bytes: z.ZodNumber; + url: z.ZodOptional; + content_base64: z.ZodOptional; + }, z.core.$strict>>>; +}, z.core.$strict>; +export declare const serverOriginApplyBodySchema: z.ZodObject<{ + server_id: z.ZodString; + plan_id: z.ZodString; + selected_mod_keys: z.ZodOptional>; + selected_file_paths: z.ZodOptional>; +}, z.core.$strict>; +export declare const serverOriginUnlinkBodySchema: z.ZodObject<{ + server_id: z.ZodString; +}, z.core.$strict>; +export declare const serverDeployServerpackBodySchema: z.ZodObject<{ + server_id: z.ZodString; + url: z.ZodString; + sha256: z.ZodOptional; + sha512: z.ZodOptional>>; + sha1: z.ZodOptional>>; + origin: z.ZodOptional; + source: z.ZodEnum<{ + curseforge: "curseforge"; + local: "local"; + modrinth: "modrinth"; + tegra: "tegra"; + }>; + modpack_id: z.ZodString; + version_id: z.ZodString; + }, z.core.$strict>, z.ZodObject<{ + kind: z.ZodLiteral<"local">; + note: z.ZodOptional; + }, z.core.$strict>], "kind">>>; +}, z.core.$strict>; +export type ServerModsListBody = z.infer; +export type ServerModsInstallBody = z.infer; +export type ServerModsRemoveBody = z.infer; +export type ServerOriginPlanBody = z.infer; +export type ServerOriginApplyBody = z.infer; +export type ServerOriginUnlinkBody = z.infer; +export type ServerDeployServerpackBody = z.infer; +export declare const serverModsListCommand: import("..").CommandDefinition<"server.mods.list", { + server_id: string; +}>; +export declare const serverModsInstallCommand: import("..").CommandDefinition<"server.mods.install", { + server_id: string; + file: string; + url: string; + source: "curseforge" | "local" | "modrinth" | "tegra"; + project_id?: string | undefined; + version_id?: string | undefined; + sha1?: string | undefined; + sha256?: string | undefined; + sha512?: string | undefined; +}>; +export declare const serverModsRemoveCommand: import("..").CommandDefinition<"server.mods.remove", { + server_id: string; + file: string; +}>; +export declare const serverOriginPlanCommand: import("..").CommandDefinition<"server.origin.plan", { + server_id: string; + to_version_id: string; + source?: "curseforge" | "local" | "modrinth" | "tegra" | undefined; + modpack_id?: string | undefined; + minecraft_version?: string | undefined; + loader?: "fabric" | "forge" | "neoforge" | "quilt" | "vanilla" | undefined; + loader_version?: string | null | undefined; + mods: { + key: string; + file: string; + name?: string | undefined; + enabled?: boolean | undefined; + source?: "curseforge" | "local" | "modrinth" | "tegra" | undefined; + project_id?: string | undefined; + version_id?: string | undefined; + url?: string | undefined; + sha1?: string | undefined; + sha256?: string | undefined; + sha512?: string | undefined; + environment?: { + client?: "optional" | "required" | "unknown" | "unsupported" | undefined; + server?: "optional" | "required" | "unknown" | "unsupported" | undefined; + } | undefined; + }[]; + files?: { + path: string; + sha1: string; + sha256?: string | undefined; + size_bytes: number; + url?: string | undefined; + content_base64?: string | undefined; + }[] | undefined; +}>; +export declare const serverOriginApplyCommand: import("..").CommandDefinition<"server.origin.apply", { + server_id: string; + plan_id: string; + selected_mod_keys?: string[] | undefined; + selected_file_paths?: string[] | undefined; +}>; +export declare const serverOriginUnlinkCommand: import("..").CommandDefinition<"server.origin.unlink", { + server_id: string; +}>; +export declare const serverDeployServerpackCommand: import("..").CommandDefinition<"server.deploy.serverpack", { + server_id: string; + url: string; + sha256?: string | undefined; + sha512?: string | undefined; + sha1?: string | undefined; + origin?: { + kind: "modpack"; + source: "curseforge" | "local" | "modrinth" | "tegra"; + modpack_id: string; + version_id: string; + } | { + kind: "local"; + note?: string | undefined; + } | null | undefined; +}>; +export declare const STATE_COMMANDS: readonly [import("..").CommandDefinition<"server.mods.list", { + server_id: string; +}>, import("..").CommandDefinition<"server.mods.install", { + server_id: string; + file: string; + url: string; + source: "curseforge" | "local" | "modrinth" | "tegra"; + project_id?: string | undefined; + version_id?: string | undefined; + sha1?: string | undefined; + sha256?: string | undefined; + sha512?: string | undefined; +}>, import("..").CommandDefinition<"server.mods.remove", { + server_id: string; + file: string; +}>, import("..").CommandDefinition<"server.origin.plan", { + server_id: string; + to_version_id: string; + source?: "curseforge" | "local" | "modrinth" | "tegra" | undefined; + modpack_id?: string | undefined; + minecraft_version?: string | undefined; + loader?: "fabric" | "forge" | "neoforge" | "quilt" | "vanilla" | undefined; + loader_version?: string | null | undefined; + mods: { + key: string; + file: string; + name?: string | undefined; + enabled?: boolean | undefined; + source?: "curseforge" | "local" | "modrinth" | "tegra" | undefined; + project_id?: string | undefined; + version_id?: string | undefined; + url?: string | undefined; + sha1?: string | undefined; + sha256?: string | undefined; + sha512?: string | undefined; + environment?: { + client?: "optional" | "required" | "unknown" | "unsupported" | undefined; + server?: "optional" | "required" | "unknown" | "unsupported" | undefined; + } | undefined; + }[]; + files?: { + path: string; + sha1: string; + sha256?: string | undefined; + size_bytes: number; + url?: string | undefined; + content_base64?: string | undefined; + }[] | undefined; +}>, import("..").CommandDefinition<"server.origin.apply", { + server_id: string; + plan_id: string; + selected_mod_keys?: string[] | undefined; + selected_file_paths?: string[] | undefined; +}>, import("..").CommandDefinition<"server.origin.unlink", { + server_id: string; +}>, import("..").CommandDefinition<"server.deploy.serverpack", { + server_id: string; + url: string; + sha256?: string | undefined; + sha512?: string | undefined; + sha1?: string | undefined; + origin?: { + kind: "modpack"; + source: "curseforge" | "local" | "modrinth" | "tegra"; + modpack_id: string; + version_id: string; + } | { + kind: "local"; + note?: string | undefined; + } | null | undefined; +}>]; +export declare function registerStateCommands(registry: CommandRegistry): CommandRegistry; diff --git a/lib/types/protocol/commands/tunnel.d.ts b/lib/types/protocol/commands/tunnel.d.ts new file mode 100644 index 0000000..5fb1fe8 --- /dev/null +++ b/lib/types/protocol/commands/tunnel.d.ts @@ -0,0 +1,18 @@ +import { z } from "zod"; +import { type CommandRegistry } from "../registry"; +export declare const PLAYIT_SECRET_KEY_REGEX: RegExp; +export declare const playitSecretKeySchema: z.ZodString; +export declare const tunnelPlayitSetKeyBodySchema: z.ZodObject<{ + secret_key: z.ZodString; +}, z.core.$strict>; +export type TunnelPlayitSetKeyBody = z.infer; +export declare const tunnelPlayitSetKeyCommand: import("..").CommandDefinition<"tunnel.playit.set_key", { + secret_key: string; +}>; +export declare const tunnelPlayitStartCommand: import("..").CommandDefinition<"tunnel.playit.start", Record>; +export declare const tunnelPlayitStopCommand: import("..").CommandDefinition<"tunnel.playit.stop", Record>; +export declare const tunnelPlayitStatusCommand: import("..").CommandDefinition<"tunnel.playit.status", Record>; +export declare const TUNNEL_COMMANDS: readonly [import("..").CommandDefinition<"tunnel.playit.set_key", { + secret_key: string; +}>, import("..").CommandDefinition<"tunnel.playit.start", Record>, import("..").CommandDefinition<"tunnel.playit.stop", Record>, import("..").CommandDefinition<"tunnel.playit.status", Record>]; +export declare function registerTunnelCommands(registry: CommandRegistry): CommandRegistry; diff --git a/lib/types/protocol/domains.d.ts b/lib/types/protocol/domains.d.ts new file mode 100644 index 0000000..f9e66aa --- /dev/null +++ b/lib/types/protocol/domains.d.ts @@ -0,0 +1,9 @@ +export declare const PROTOCOL_VERSION: 1; +export declare const DOMAIN_COMMAND: Uint8Array; +export declare const DOMAIN_SESSION: Uint8Array; +export declare const DOMAIN_AGENT_MESSAGE: Uint8Array; +export declare const DOMAIN_REVOCATION: Uint8Array; +export declare const DOMAIN_TRUST_GRANT: Uint8Array; +export declare const DOMAIN_PAIRING_PROOF: Uint8Array; +export declare function concatBytes(...parts: readonly Uint8Array[]): Uint8Array; +export declare function assertSupportedVersion(value: unknown): void; diff --git a/lib/types/protocol/errors.d.ts b/lib/types/protocol/errors.d.ts new file mode 100644 index 0000000..ef24847 --- /dev/null +++ b/lib/types/protocol/errors.d.ts @@ -0,0 +1,5 @@ +export type ProtocolErrorCode = "invalid_format" | "unsupported_version" | "wrong_agent" | "wrong_recipient" | "expired" | "not_yet_valid" | "ttl_too_long" | "untrusted_signer" | "bad_signature" | "session_invalid" | "session_revoked" | "replayed" | "unknown_command" | "invalid_body" | "sensitive_requires_account_key" | "decrypt_failed" | "grant_invalid" | "grant_wrong_agent" | "grant_expired" | "grant_bad_signature" | "grant_proof_required" | "grant_bad_proof" | "revocation_stale" | "revocation_not_superset" | "insufficient_memory" | "eula_not_accepted" | "server_not_found" | "server_already_exists" | "server_running" | "server_stopped" | "invalid_jvm_args" | "download_failed" | "hash_mismatch" | "systemd_error" | "origin_locked" | "plan_not_found" | "plan_expired" | "plan_stale" | "mod_not_found" | "mod_already_exists" | "backup_not_found" | "backup_failed" | "backup_config_invalid" | "tunnel_not_configured" | "tunnel_already_running" | "tunnel_not_running" | "tunnel_failed"; +export declare class ProtocolError extends Error { + readonly code: ProtocolErrorCode; + constructor(code: ProtocolErrorCode, message: string); +} diff --git a/lib/types/protocol/index.d.ts b/lib/types/protocol/index.d.ts new file mode 100644 index 0000000..0d5fe71 --- /dev/null +++ b/lib/types/protocol/index.d.ts @@ -0,0 +1,17 @@ +export { type OpenedAgentMessage, openAgentMessage, type SealAgentMessageParams, sealAgentMessage, } from "./agent-message"; +export { COMMAND_ID_BYTES, type CreateSignedCommandParams, createSignedCommand, DEFAULT_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, MAX_COMMAND_TTL_MS, type OpenedCommand, openCommand, } from "./command"; +export { BACKUP_COMMANDS, BACKUP_ID_REGEX, type BackupDestinationKind, type BackupLocalConfig, type BackupS3ConfigInput, type BackupScheduleConfig, type BackupTegraCloudConfig, backupDestinationKindSchema, backupIdSchema, backupLocalConfigSchema, backupS3ConfigSchema, backupScheduleConfigSchema, backupTegraCloudConfigSchema, MAX_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_RETENTION_COUNT, MIN_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, registerBackupCommands, type ServerBackupConfigSetBody, type ServerBackupCreateBody, type ServerBackupDeleteBody, type ServerBackupListBody, type ServerBackupRestoreBody, s3BucketSchema, s3PrefixSchema, s3RegionSchema, serverBackupConfigSetBodySchema, serverBackupConfigSetCommand, serverBackupCreateBodySchema, serverBackupCreateCommand, serverBackupDeleteBodySchema, serverBackupDeleteCommand, serverBackupListBodySchema, serverBackupListCommand, serverBackupRestoreBodySchema, serverBackupRestoreCommand, } from "./commands/backup"; +export { agentPingCommand, CORE_COMMANDS, createCoreRegistry, registerCoreCommands, serverDeleteCommand, serverStartCommand, serverStopCommand, } from "./commands/core"; +export { FILES_COMMANDS, fileEncodingSchema, filesCopyCommand, filesDeleteCommand, filesDownloadBeginCommand, filesDownloadCloseCommand, filesDownloadCommand, filesDownloadPartCommand, filesListCommand, filesMkdirCommand, filesReadCommand, filesRenameCommand, filesStatCommand, filesUnzipCommand, filesUploadAbortCommand, filesUploadBeginCommand, filesUploadCommitCommand, filesUploadPartCommand, filesWriteCommand, filesZipCommand, registerFilesCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, sha256HexSchema, } from "./commands/files"; +export { agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, } from "./commands/pairing"; +export { consoleLineSchema, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MAX_JVM_ARGS, MAX_SERVER_MEMORY_MB, MIN_SERVER_MEMORY_MB, registerServerCommands, SERVER_COMMANDS, SERVER_ID_REGEX, type ServerConsoleSendBody, type ServerConsoleSubscribeBody, type ServerCreateBody, type ServerLoader, type ServerUpdateSettingsBody, serverConsoleSendBodySchema, serverConsoleSendCommand, serverConsoleSubscribeBodySchema, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, serverCreateBodySchema, serverCreateCommand, serverIdSchema, serverListCommand, serverLoaderSchema, serverMemoryMbSchema, serverPortSchema, serverRestartCommand, serverStatusCommand, serverUpdateSettingsBodySchema, serverUpdateSettingsCommand, } from "./commands/server"; +export { type ModEnvironmentInfo, type ModLayer, type ModSource, modEnvironmentInfoSchema, modFileNameSchema, modLayerSchema, modSourceSchema, type OriginPlanFileInput, type OriginPlanModInput, originPlanFileInputSchema, originPlanModInputSchema, registerStateCommands, type ServerDeployServerpackBody, type ServerModEntry, type ServerModsInstallBody, type ServerModsListBody, type ServerModsRemoveBody, type ServerOrigin, type ServerOriginApplyBody, type ServerOriginPlanBody, type ServerOriginSyncState, type ServerOriginUnlinkBody, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, STATE_COMMANDS, serverDeployServerpackBodySchema, serverDeployServerpackCommand, serverModEntrySchema, serverModsInstallBodySchema, serverModsInstallCommand, serverModsListBodySchema, serverModsListCommand, serverModsRemoveBodySchema, serverModsRemoveCommand, serverOriginApplyBodySchema, serverOriginApplyCommand, serverOriginPlanBodySchema, serverOriginPlanCommand, serverOriginSchema, serverOriginSyncStateSchema, serverOriginUnlinkBodySchema, serverOriginUnlinkCommand, sha1HexSchema, sha512HexSchema, } from "./commands/state"; +export { PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, registerTunnelCommands, TUNNEL_COMMANDS, type TunnelPlayitSetKeyBody, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStatusCommand, tunnelPlayitStopCommand, } from "./commands/tunnel"; +export { DOMAIN_AGENT_MESSAGE, DOMAIN_COMMAND, DOMAIN_PAIRING_PROOF, DOMAIN_REVOCATION, DOMAIN_SESSION, DOMAIN_TRUST_GRANT, PROTOCOL_VERSION, } from "./domains"; +export { ProtocolError, type ProtocolErrorCode } from "./errors"; +export { type BuildPairingFragmentParams, buildPairingFragment, DEFAULT_TRUST_GRANT_TTL_MS, generatePairingCode, generatePairingSecret, MAX_TRUST_GRANT_TTL_MS, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, type PairingFragment, pairingCodeSchema, parsePairingFragment, type SignTrustGrantParams, signTrustGrant, type TrustGrant, trustGrantSchema, type VerifiedTrustGrant, type VerifyTrustGrantOptions, verifyTrustGrant, } from "./pairing"; +export { type CommandDefinition, CommandRegistry, defineCommand } from "./registry"; +export { type SignRevocationListParams, signRevocationList, verifyRevocationList, } from "./revocation"; +export { type AgentMessage, type AgentMessageHeader, agentMessageHeaderSchema, agentMessageSchema, base64UrlSchema, type CommandHeader, commandHeaderSchema, type KeyId, keyIdSchema, type RevocationList, revocationListSchema, type SessionCertificate, type SignedCommand, sessionCertificateSchema, signedCommandSchema, type TransportFrame, transportAckFrameSchema, transportCommandFrameSchema, transportEventFrameSchema, transportFrameSchema, transportPingFrameSchema, } from "./schemas"; +export { type SignSessionCertificateParams, signSessionCertificate, type VerifiedSessionCertificate, verifySessionCertificate, } from "./session"; +export { createInMemoryTrustContext, type InMemoryTrustContext, type InMemoryTrustContextOptions, type TrustContext, } from "./trust"; diff --git a/lib/types/protocol/pairing.d.ts b/lib/types/protocol/pairing.d.ts new file mode 100644 index 0000000..778613b --- /dev/null +++ b/lib/types/protocol/pairing.d.ts @@ -0,0 +1,53 @@ +import { z } from "zod"; +import { type PublicKey, type SigningKeyPair } from "../crypto"; +import { type KeyId } from "./schemas"; +export declare const PAIRING_CODE_LENGTH = 10; +export declare const PAIRING_SECRET_BYTES = 16; +export declare const DEFAULT_TRUST_GRANT_TTL_MS: number; +export declare const MAX_TRUST_GRANT_TTL_MS: number; +export declare const pairingCodeSchema: z.ZodString; +export declare const trustGrantSchema: z.ZodObject<{ + v: z.ZodLiteral<1>; + kind: z.ZodLiteral<"agent-pairing">; + account_key: z.ZodString; + agent: z.ZodString; + issued_at: z.ZodNumber; + expires_at: z.ZodNumber; + proof: z.ZodOptional; + sig: z.ZodString; +}, z.core.$strip>; +export type TrustGrant = z.infer; +export interface PairingFragment { + readonly code: string; + readonly secret?: string; + readonly agentFingerprint?: KeyId; +} +export interface BuildPairingFragmentParams { + readonly code: string; + readonly secret: string; + readonly agentFingerprint: KeyId; +} +export interface SignTrustGrantParams { + readonly accountKeyPair: SigningKeyPair; + readonly agentPublicKey: PublicKey; + readonly secret?: string | Uint8Array; + readonly issuedAt: number; + readonly ttlMs?: number; +} +export interface VerifyTrustGrantOptions { + readonly agentPublicKey: PublicKey; + readonly secret?: string | Uint8Array; + readonly now: number; + readonly requireProof: boolean; +} +export interface VerifiedTrustGrant { + readonly accountPublicKey: PublicKey; + readonly accountId: KeyId; + readonly proven: boolean; +} +export declare function generatePairingCode(): string; +export declare function generatePairingSecret(): string; +export declare function buildPairingFragment(params: BuildPairingFragmentParams): string; +export declare function parsePairingFragment(text: string): PairingFragment; +export declare function signTrustGrant(params: SignTrustGrantParams): TrustGrant; +export declare function verifyTrustGrant(grant: unknown, options: VerifyTrustGrantOptions): VerifiedTrustGrant; diff --git a/lib/types/protocol/registry.d.ts b/lib/types/protocol/registry.d.ts new file mode 100644 index 0000000..3d67991 --- /dev/null +++ b/lib/types/protocol/registry.d.ts @@ -0,0 +1,19 @@ +import type { z } from "zod"; +export interface CommandDefinition { + readonly type: TType; + readonly sensitive: boolean; + readonly body: z.ZodType; +} +export declare function defineCommand(definition: { + readonly type: TType; + readonly sensitive: boolean; + readonly body: z.ZodType; +}): CommandDefinition; +export declare class CommandRegistry { + #private; + register(definition: CommandDefinition): this; + registerAll(definitions: readonly CommandDefinition[]): this; + get(type: string): CommandDefinition | undefined; + has(type: string): boolean; + types(): string[]; +} diff --git a/lib/types/protocol/revocation.d.ts b/lib/types/protocol/revocation.d.ts new file mode 100644 index 0000000..a6402d0 --- /dev/null +++ b/lib/types/protocol/revocation.d.ts @@ -0,0 +1,9 @@ +import { type PublicKey, type SigningKeyPair } from "../crypto"; +import { type RevocationList } from "./schemas"; +export interface SignRevocationListParams { + readonly accountKeyPair: SigningKeyPair; + readonly issuedAt: number; + readonly revoked: readonly string[]; +} +export declare function signRevocationList(params: SignRevocationListParams): RevocationList; +export declare function verifyRevocationList(list: unknown, accountPublicKey: PublicKey): RevocationList; diff --git a/lib/types/protocol/schemas.d.ts b/lib/types/protocol/schemas.d.ts new file mode 100644 index 0000000..8aeddb0 --- /dev/null +++ b/lib/types/protocol/schemas.d.ts @@ -0,0 +1,225 @@ +import { z } from "zod"; +export declare const keyIdSchema: z.ZodString; +export type KeyId = z.infer; +export declare const base64UrlSchema: z.ZodString; +export declare const sessionCertificateSchema: z.ZodObject<{ + v: z.ZodLiteral<1>; + session_key: z.ZodString; + account: z.ZodString; + not_before: z.ZodNumber; + not_after: z.ZodNumber; + id: z.ZodString; + sig: z.ZodString; +}, z.core.$strip>; +export type SessionCertificate = z.infer; +export declare const commandHeaderSchema: z.ZodObject<{ + v: z.ZodLiteral<1>; + id: z.ZodString; + type: z.ZodString; + agent: z.ZodString; + signer: z.ZodString; + issued_at: z.ZodNumber; + expires_at: z.ZodNumber; + counter: z.ZodNumber; +}, z.core.$strip>; +export type CommandHeader = z.infer; +export declare const signedCommandSchema: z.ZodObject<{ + header: z.ZodObject<{ + v: z.ZodLiteral<1>; + id: z.ZodString; + type: z.ZodString; + agent: z.ZodString; + signer: z.ZodString; + issued_at: z.ZodNumber; + expires_at: z.ZodNumber; + counter: z.ZodNumber; + }, z.core.$strip>; + payload: z.ZodString; + session: z.ZodOptional; + session_key: z.ZodString; + account: z.ZodString; + not_before: z.ZodNumber; + not_after: z.ZodNumber; + id: z.ZodString; + sig: z.ZodString; + }, z.core.$strip>>; + sig: z.ZodString; +}, z.core.$strip>; +export type SignedCommand = z.infer; +export declare const agentMessageHeaderSchema: z.ZodObject<{ + v: z.ZodLiteral<1>; + id: z.ZodString; + type: z.ZodString; + agent: z.ZodString; + recipient: z.ZodString; + sent_at: z.ZodNumber; + seq: z.ZodNumber; +}, z.core.$strip>; +export type AgentMessageHeader = z.infer; +export declare const agentMessageSchema: z.ZodObject<{ + header: z.ZodObject<{ + v: z.ZodLiteral<1>; + id: z.ZodString; + type: z.ZodString; + agent: z.ZodString; + recipient: z.ZodString; + sent_at: z.ZodNumber; + seq: z.ZodNumber; + }, z.core.$strip>; + payload: z.ZodString; + sig: z.ZodString; +}, z.core.$strip>; +export type AgentMessage = z.infer; +export declare const revocationListSchema: z.ZodObject<{ + v: z.ZodLiteral<1>; + account: z.ZodString; + issued_at: z.ZodNumber; + revoked: z.ZodArray; + sig: z.ZodString; +}, z.core.$strip>; +export type RevocationList = z.infer; +export declare const transportCommandFrameSchema: z.ZodObject<{ + v: z.ZodLiteral<1>; + kind: z.ZodLiteral<"command">; + route: z.ZodObject<{ + agent: z.ZodString; + }, z.core.$strip>; + body: z.ZodObject<{ + header: z.ZodObject<{ + v: z.ZodLiteral<1>; + id: z.ZodString; + type: z.ZodString; + agent: z.ZodString; + signer: z.ZodString; + issued_at: z.ZodNumber; + expires_at: z.ZodNumber; + counter: z.ZodNumber; + }, z.core.$strip>; + payload: z.ZodString; + session: z.ZodOptional; + session_key: z.ZodString; + account: z.ZodString; + not_before: z.ZodNumber; + not_after: z.ZodNumber; + id: z.ZodString; + sig: z.ZodString; + }, z.core.$strip>>; + sig: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>; +export declare const transportEventFrameSchema: z.ZodObject<{ + v: z.ZodLiteral<1>; + kind: z.ZodLiteral<"event">; + route: z.ZodObject<{ + agent: z.ZodString; + recipient: z.ZodString; + }, z.core.$strip>; + body: z.ZodObject<{ + header: z.ZodObject<{ + v: z.ZodLiteral<1>; + id: z.ZodString; + type: z.ZodString; + agent: z.ZodString; + recipient: z.ZodString; + sent_at: z.ZodNumber; + seq: z.ZodNumber; + }, z.core.$strip>; + payload: z.ZodString; + sig: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>; +export declare const transportAckFrameSchema: z.ZodObject<{ + v: z.ZodLiteral<1>; + kind: z.ZodLiteral<"ack">; + route: z.ZodObject<{ + agent: z.ZodString; + }, z.core.$strip>; + body: z.ZodObject<{ + id: z.ZodString; + ok: z.ZodBoolean; + code: z.ZodOptional; + }, z.core.$strip>; +}, z.core.$strip>; +export declare const transportPingFrameSchema: z.ZodObject<{ + v: z.ZodLiteral<1>; + kind: z.ZodLiteral<"ping">; + route: z.ZodObject<{ + agent: z.ZodString; + }, z.core.$strip>; + body: z.ZodObject<{ + ts: z.ZodNumber; + }, z.core.$strip>; +}, z.core.$strip>; +export declare const transportFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ + v: z.ZodLiteral<1>; + kind: z.ZodLiteral<"command">; + route: z.ZodObject<{ + agent: z.ZodString; + }, z.core.$strip>; + body: z.ZodObject<{ + header: z.ZodObject<{ + v: z.ZodLiteral<1>; + id: z.ZodString; + type: z.ZodString; + agent: z.ZodString; + signer: z.ZodString; + issued_at: z.ZodNumber; + expires_at: z.ZodNumber; + counter: z.ZodNumber; + }, z.core.$strip>; + payload: z.ZodString; + session: z.ZodOptional; + session_key: z.ZodString; + account: z.ZodString; + not_before: z.ZodNumber; + not_after: z.ZodNumber; + id: z.ZodString; + sig: z.ZodString; + }, z.core.$strip>>; + sig: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + v: z.ZodLiteral<1>; + kind: z.ZodLiteral<"event">; + route: z.ZodObject<{ + agent: z.ZodString; + recipient: z.ZodString; + }, z.core.$strip>; + body: z.ZodObject<{ + header: z.ZodObject<{ + v: z.ZodLiteral<1>; + id: z.ZodString; + type: z.ZodString; + agent: z.ZodString; + recipient: z.ZodString; + sent_at: z.ZodNumber; + seq: z.ZodNumber; + }, z.core.$strip>; + payload: z.ZodString; + sig: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + v: z.ZodLiteral<1>; + kind: z.ZodLiteral<"ack">; + route: z.ZodObject<{ + agent: z.ZodString; + }, z.core.$strip>; + body: z.ZodObject<{ + id: z.ZodString; + ok: z.ZodBoolean; + code: z.ZodOptional; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + v: z.ZodLiteral<1>; + kind: z.ZodLiteral<"ping">; + route: z.ZodObject<{ + agent: z.ZodString; + }, z.core.$strip>; + body: z.ZodObject<{ + ts: z.ZodNumber; + }, z.core.$strip>; +}, z.core.$strip>], "kind">; +export type TransportFrame = z.infer; diff --git a/lib/types/protocol/session.d.ts b/lib/types/protocol/session.d.ts new file mode 100644 index 0000000..4ff053e --- /dev/null +++ b/lib/types/protocol/session.d.ts @@ -0,0 +1,15 @@ +import { type PublicKey, type SigningKeyPair } from "../crypto"; +import { type SessionCertificate } from "./schemas"; +export interface SignSessionCertificateParams { + readonly sessionPublicKey: PublicKey; + readonly accountKeyPair: SigningKeyPair; + readonly notBefore: number; + readonly notAfter: number; + readonly id?: string; +} +export interface VerifiedSessionCertificate { + readonly certificate: SessionCertificate; + readonly sessionPublicKey: PublicKey; +} +export declare function signSessionCertificate(params: SignSessionCertificateParams): SessionCertificate; +export declare function verifySessionCertificate(certificate: unknown, accountPublicKey: PublicKey, atTime?: number): VerifiedSessionCertificate; diff --git a/lib/types/protocol/trust.d.ts b/lib/types/protocol/trust.d.ts new file mode 100644 index 0000000..c3ac1d2 --- /dev/null +++ b/lib/types/protocol/trust.d.ts @@ -0,0 +1,20 @@ +import { type PublicKey, type SigningKeyPair } from "../crypto"; +import type { KeyId } from "./schemas"; +export interface TrustContext { + readonly agentKeyPair: SigningKeyPair; + isTrustedAccountKey(id: KeyId): PublicKey | null; + isSessionRevoked(certificateId: string): boolean; + now(): number; + claimCommand(signer: KeyId, id: string, counter: number): boolean; +} +export interface InMemoryTrustContextOptions { + readonly agentKeyPair: SigningKeyPair; + readonly trustedAccountKeys: readonly PublicKey[]; + readonly revokedSessionIds?: Iterable; + readonly now?: () => number; +} +export interface InMemoryTrustContext extends TrustContext { + revokeSession(certificateId: string): void; + setNow(clock: () => number): void; +} +export declare function createInMemoryTrustContext(options: InMemoryTrustContextOptions): InMemoryTrustContext; diff --git a/lib/types/vault/blob.d.ts b/lib/types/vault/blob.d.ts new file mode 100644 index 0000000..9359cc1 --- /dev/null +++ b/lib/types/vault/blob.d.ts @@ -0,0 +1,49 @@ +import { z } from "zod"; +import { type KdfParams } from "../crypto"; +import { type KeyId } from "../protocol"; +export declare const VAULT_VERSION: 1; +export declare const vaultKdfSchema: z.ZodObject<{ + alg: z.ZodLiteral<"argon2id13">; + opslimit: z.ZodNumber; + memlimit: z.ZodNumber; + salt: z.ZodString; +}, z.core.$strip>; +export declare const vaultBlobSchema: z.ZodObject<{ + v: z.ZodLiteral<1>; + account: z.ZodString; + public_key: z.ZodString; + created_at: z.ZodNumber; + password: z.ZodObject<{ + kdf: z.ZodObject<{ + alg: z.ZodLiteral<"argon2id13">; + opslimit: z.ZodNumber; + memlimit: z.ZodNumber; + salt: z.ZodString; + }, z.core.$strip>; + wrapped_secret: z.ZodString; + }, z.core.$strip>; + recovery: z.ZodObject<{ + wrapped_secret: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>; +export type VaultKdf = z.infer; +export type VaultBlob = z.infer; +export interface ParsedVaultBlob { + readonly blob: VaultBlob; + readonly publicKeyBytes: Uint8Array; + readonly kdfParams: KdfParams; + readonly passwordWrapped: Uint8Array; + readonly recoveryWrapped: Uint8Array; +} +export declare function parseVaultBlob(input: unknown): ParsedVaultBlob; +export declare function buildPasswordAad(fields: { + readonly v: typeof VAULT_VERSION; + readonly account: KeyId; + readonly public_key: string; + readonly kdf: VaultKdf; +}): Uint8Array; +export declare function buildRecoveryAad(fields: { + readonly v: typeof VAULT_VERSION; + readonly account: KeyId; + readonly public_key: string; +}): Uint8Array; diff --git a/lib/types/vault/counter.d.ts b/lib/types/vault/counter.d.ts new file mode 100644 index 0000000..d7f5e77 --- /dev/null +++ b/lib/types/vault/counter.d.ts @@ -0,0 +1,5 @@ +import type { KeyId } from "../protocol"; +export interface CounterStore { + next(signer: KeyId, now: number): Promise; +} +export declare function createMemoryCounterStore(): CounterStore; diff --git a/lib/types/vault/errors.d.ts b/lib/types/vault/errors.d.ts new file mode 100644 index 0000000..055aede --- /dev/null +++ b/lib/types/vault/errors.d.ts @@ -0,0 +1,5 @@ +export type VaultErrorCode = "weak_password" | "wrong_password" | "unlock_failed" | "invalid_blob" | "invalid_recovery_code" | "locked" | "invalid_session"; +export declare class VaultError extends Error { + readonly code: VaultErrorCode; + constructor(code: VaultErrorCode, message: string); +} diff --git a/lib/types/vault/index.d.ts b/lib/types/vault/index.d.ts new file mode 100644 index 0000000..00c2645 --- /dev/null +++ b/lib/types/vault/index.d.ts @@ -0,0 +1,7 @@ +export { buildPasswordAad, buildRecoveryAad, type ParsedVaultBlob, parseVaultBlob, VAULT_VERSION, type VaultBlob, type VaultKdf, vaultBlobSchema, vaultKdfSchema, } from "./blob"; +export { type CounterStore, createMemoryCounterStore } from "./counter"; +export { VaultError, type VaultErrorCode } from "./errors"; +export { MIN_PASSWORD_LENGTH, MIN_PASSWORD_SCORE, type PasswordValidationResult, type ValidatePasswordOptions, validatePassword, } from "./password"; +export { deriveRecoveryKey, formatRecoveryCode, generateRecoveryCodeBytes, parseRecoveryCode, RECOVERY_CODE_BYTES, } from "./recovery-code"; +export { createCommandFromSession, createSensitiveCommand, type IssueSessionOptions, isSessionExpired, issueSession, parseSession, SESSION_DURATION_MS, type Session, type SessionDuration, type SignRevocationParams, serializeSession, sessionExpiresAt, signRevocation, type VaultCommandParams, } from "./session"; +export { type ChangePasswordOptions, type CreateVaultParams, type CreateVaultResult, changePassword, createVault, type RotateRecoveryCodeResult, resetPasswordWithRecovery, rotateRecoveryCode, type UnlockedVault, unlockVault, unlockVaultWithRecovery, withUnlockedVault, } from "./vault"; diff --git a/lib/types/vault/password.d.ts b/lib/types/vault/password.d.ts new file mode 100644 index 0000000..e050928 --- /dev/null +++ b/lib/types/vault/password.d.ts @@ -0,0 +1,12 @@ +export declare const MIN_PASSWORD_LENGTH = 12; +export declare const MIN_PASSWORD_SCORE = 3; +export interface ValidatePasswordOptions { + readonly userInputs?: readonly string[]; +} +export type PasswordValidationResult = { + readonly ok: true; +} | { + readonly ok: false; + readonly reason: "too_short" | "too_weak"; +}; +export declare function validatePassword(password: string, options?: ValidatePasswordOptions): PasswordValidationResult; diff --git a/lib/types/vault/recovery-code.d.ts b/lib/types/vault/recovery-code.d.ts new file mode 100644 index 0000000..77779f7 --- /dev/null +++ b/lib/types/vault/recovery-code.d.ts @@ -0,0 +1,5 @@ +export declare const RECOVERY_CODE_BYTES = 32; +export declare function generateRecoveryCodeBytes(): Uint8Array; +export declare function formatRecoveryCode(bytes: Uint8Array): string; +export declare function parseRecoveryCode(code: string): Uint8Array; +export declare function deriveRecoveryKey(codeBytes: Uint8Array): Uint8Array; diff --git a/lib/types/vault/session.d.ts b/lib/types/vault/session.d.ts new file mode 100644 index 0000000..e7b8e9b --- /dev/null +++ b/lib/types/vault/session.d.ts @@ -0,0 +1,41 @@ +import { type PublicKey, type SigningKeyPair } from "../crypto"; +import { type CommandRegistry, type RevocationList, type SessionCertificate, type SignedCommand } from "../protocol"; +import type { UnlockedVault } from "./vault"; +export declare const SESSION_DURATION_MS: { + readonly "24h": number; + readonly "7d": number; + readonly "30d": number; + readonly remember: number; +}; +export type SessionDuration = keyof typeof SESSION_DURATION_MS; +export interface Session { + readonly keyPair: SigningKeyPair; + readonly certificate: SessionCertificate; +} +export interface IssueSessionOptions { + readonly duration: SessionDuration; + readonly now?: number; + readonly id?: string; +} +export interface VaultCommandParams { + readonly type: string; + readonly body: unknown; + readonly agentPublicKey: PublicKey; + readonly counter: number; + readonly now: number; + readonly registry: CommandRegistry; + readonly ttlMs?: number; + readonly id?: string; +} +export interface SignRevocationParams { + readonly revoked: readonly string[]; + readonly now: number; +} +export declare function issueSession(unlocked: UnlockedVault, options: IssueSessionOptions): Session; +export declare function serializeSession(session: Session): string; +export declare function parseSession(text: string): Session; +export declare function sessionExpiresAt(session: Session): number; +export declare function isSessionExpired(session: Session, now?: number): boolean; +export declare function createCommandFromSession(session: Session, params: VaultCommandParams): SignedCommand; +export declare function createSensitiveCommand(unlocked: UnlockedVault, params: VaultCommandParams): SignedCommand; +export declare function signRevocation(unlocked: UnlockedVault, params: SignRevocationParams): RevocationList; diff --git a/lib/types/vault/vault.d.ts b/lib/types/vault/vault.d.ts new file mode 100644 index 0000000..442ca55 --- /dev/null +++ b/lib/types/vault/vault.d.ts @@ -0,0 +1,36 @@ +import { type KdfPreset, type PublicKey, type SigningKeyPair } from "../crypto"; +import type { KeyId } from "../protocol"; +import { type VaultBlob } from "./blob"; +export interface UnlockedVault { + readonly account: KeyId; + readonly publicKey: PublicKey; + readonly keyPair: SigningKeyPair; + lock(): void; +} +export interface CreateVaultParams { + readonly password: string; + readonly now?: number; + readonly kdf?: KdfPreset; + readonly userInputs?: readonly string[]; +} +export interface CreateVaultResult { + readonly blob: VaultBlob; + readonly recoveryCode: string; + readonly unlocked: UnlockedVault; +} +export interface ChangePasswordOptions { + readonly now?: number; + readonly kdf?: KdfPreset; + readonly userInputs?: readonly string[]; +} +export interface RotateRecoveryCodeResult { + readonly blob: VaultBlob; + readonly recoveryCode: string; +} +export declare function createVault(params: CreateVaultParams): CreateVaultResult; +export declare function unlockVault(blob: unknown, password: string): UnlockedVault; +export declare function unlockVaultWithRecovery(blob: unknown, recoveryCode: string): UnlockedVault; +export declare function withUnlockedVault(blob: unknown, password: string, fn: (unlocked: UnlockedVault) => T | Promise): Promise; +export declare function changePassword(blob: unknown, oldPassword: string, newPassword: string, options?: ChangePasswordOptions): VaultBlob; +export declare function rotateRecoveryCode(blob: unknown, password: string): RotateRecoveryCodeResult; +export declare function resetPasswordWithRecovery(blob: unknown, recoveryCode: string, newPassword: string, options?: ChangePasswordOptions): VaultBlob; diff --git a/lib/vault/index.js b/lib/vault/index.js new file mode 100644 index 0000000..54bbb90 --- /dev/null +++ b/lib/vault/index.js @@ -0,0 +1,4341 @@ +import { + base64UrlSchema, + createSignedCommand, + keyIdSchema, + sessionCertificateSchema, + signRevocationList, + signSessionCertificate +} from "../chunks/index-ztead7tp.js"; +import { + KDF_ALG_ARGON2ID13, + KDF_MODERATE, + SIGNING_PUBLIC_KEY_BYTES, + SIGNING_SECRET_KEY_BYTES, + SIGNING_SEED_BYTES, + aeadDecrypt, + aeadEncrypt, + assertKdfParams, + canonicalize, + deriveKeyFromPassword, + fingerprint, + fromBase64Url, + generateSalt, + generateSigningKeyPair, + hash, + memzero, + randomBytes, + signingKeyPairFromSeed, + toBase64Url +} from "../chunks/index-kcrag88y.js"; + +// src/vault/blob.ts +import { z } from "zod"; + +// src/vault/errors.ts +class VaultError extends Error { + code; + constructor(code, message) { + super(message); + this.name = "VaultError"; + this.code = code; + } +} + +// src/vault/blob.ts +var VAULT_VERSION = 1; +var vaultKdfSchema = z.object({ + alg: z.literal(KDF_ALG_ARGON2ID13), + opslimit: z.number().int().positive(), + memlimit: z.number().int().positive(), + salt: base64UrlSchema +}); +var vaultBlobSchema = z.object({ + v: z.literal(VAULT_VERSION), + account: keyIdSchema, + public_key: base64UrlSchema, + created_at: z.number().int().nonnegative(), + password: z.object({ + kdf: vaultKdfSchema, + wrapped_secret: base64UrlSchema + }), + recovery: z.object({ + wrapped_secret: base64UrlSchema + }) +}); +function parseVaultBlob(input) { + const parsed = vaultBlobSchema.safeParse(input); + if (!parsed.success) { + throw new VaultError("invalid_blob", "Malformed vault blob"); + } + const blob = parsed.data; + let publicKeyBytes; + let saltBytes; + let passwordWrapped; + let recoveryWrapped; + try { + publicKeyBytes = fromBase64Url(blob.public_key); + saltBytes = fromBase64Url(blob.password.kdf.salt); + passwordWrapped = fromBase64Url(blob.password.wrapped_secret); + recoveryWrapped = fromBase64Url(blob.recovery.wrapped_secret); + } catch { + throw new VaultError("invalid_blob", "Invalid base64url encoding in vault blob"); + } + if (publicKeyBytes.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new VaultError("invalid_blob", "Invalid account public key length in vault blob"); + } + const kdfParams = { + alg: blob.password.kdf.alg, + opslimit: blob.password.kdf.opslimit, + memlimit: blob.password.kdf.memlimit, + salt: saltBytes + }; + try { + assertKdfParams(kdfParams); + } catch { + throw new VaultError("invalid_blob", "Vault blob KDF parameters do not meet minimum floor"); + } + return { + blob, + publicKeyBytes, + kdfParams, + passwordWrapped, + recoveryWrapped + }; +} +function buildPasswordAad(fields) { + return canonicalize({ + context: "tegra-vault-v1:password", + v: fields.v, + account: fields.account, + public_key: fields.public_key, + kdf: { + alg: fields.kdf.alg, + opslimit: fields.kdf.opslimit, + memlimit: fields.kdf.memlimit, + salt: fields.kdf.salt + } + }); +} +function buildRecoveryAad(fields) { + return canonicalize({ + context: "tegra-vault-v1:recovery", + v: fields.v, + account: fields.account, + public_key: fields.public_key + }); +} +// src/vault/counter.ts +function createMemoryCounterStore() { + const lastBySigner = new Map; + return { + async next(signer, now) { + if (!Number.isSafeInteger(now) || now < 0) { + throw new RangeError("now must be a non-negative safe integer"); + } + const prev = lastBySigner.get(signer); + const value = prev === undefined ? now : Math.max(prev + 1, now); + lastBySigner.set(signer, value); + return value; + } + }; +} +// node_modules/@zxcvbn-ts/core/dist/utils/helper.mjs +var extend = (listToExtend, list) => { + for (let i = 0;i < list.length; i += 1) { + listToExtend.push(list[i]); + } +}; +var SURROGATE_PAIR = /[\ud800-\udbff][\udc00-\udfff]/g; +var isHighSurrogate = (code) => code >= 55296 && code <= 56319; +var isLowSurrogate = (code) => code >= 56320 && code <= 57343; +var isSurrogatePairAt = (string, index) => isHighSurrogate(string.charCodeAt(index)) && isLowSurrogate(string.charCodeAt(index + 1)); +var countCharacters = (string) => { + var _a, _b; + return string.length - ((_b = (_a = string.match(SURROGATE_PAIR)) === null || _a === undefined ? undefined : _a.length) !== null && _b !== undefined ? _b : 0); +}; +var isDictionaryNamed = (dictionaryName, name) => dictionaryName.startsWith(name) && (dictionaryName.length === name.length || dictionaryName[name.length] === "-"); +var toLowerCase = (string) => string.replace(/İ/g, "i").toLowerCase(); + +// node_modules/@zxcvbn-ts/core/dist/data/dateSplits.mjs +var dateSplits = { + 4: [ + [1, 2], + [2, 3] + ], + 5: [ + [1, 3], + [2, 3], + [2, 4] + ], + 6: [ + [1, 2], + [2, 4], + [4, 5] + ], + 7: [ + [1, 3], + [2, 3], + [4, 5], + [4, 6] + ], + 8: [ + [2, 4], + [4, 6] + ] +}; + +// node_modules/@zxcvbn-ts/core/dist/data/const.mjs +var DATE_MAX_YEAR = 2099; +var DATE_MIN_YEAR = 1000; +var DATE_SPLITS = dateSplits; +var BRUTEFORCE_CARDINALITY = 10; +var MIN_GUESSES_BEFORE_GROWING_SEQUENCE = 1e4; +var MIN_SUBMATCH_GUESSES_SINGLE_CHAR = 10; +var MIN_SUBMATCH_GUESSES_MULTI_CHAR = 50; +var MIN_YEAR_SPACE = 21; +var START_UPPER = /^[A-Z\xbf-\xdf][^A-Z\xbf-\xdf]+$/; +var END_UPPER = /^[^A-Z\xbf-\xdf]+[A-Z\xbf-\xdf]$/; +var ALL_UPPER = /^[A-Z\xbf-\xdf]+$/; +var ALL_UPPER_INVERTED = /^[^a-z\xdf-\xff]+$/; +var ALL_LOWER = /^[a-z\xdf-\xff]+$/; +var ALL_LOWER_INVERTED = /^[^A-Z\xbf-\xdf]+$/; +var ONE_LOWER = /[a-z\xdf-\xff]/; +var ONE_UPPER = /[A-Z\xbf-\xdf]/; +var ALPHA_INVERTED = /[^A-Za-z\xbf-\xdf]/gi; +var ALL_DIGIT = /^\d+$/; +var REFERENCE_YEAR = new Date().getFullYear(); +var REGEXEN = { + recentYear: /19\d\d|20\d\d/g +}; +var SEPARATOR_CHARS = [" ", ",", ";", ":", "|", "/", "\\", "_", ".", "-"]; +var SEPARATOR_CHAR_COUNT = SEPARATOR_CHARS.length; +var WORD_SEQUENCE_SEPARATOR_CHARS = new Set([" ", "-", "_", "."]); +var WORD_SEQUENCE_LETTER_GAP_OPTIONS = 26; +var ESCAPE_REGEX = /[.*+?^${}()|[\]\\]/g; + +// node_modules/@zxcvbn-ts/core/dist/types.mjs +class MatcherBaseClass { + constructor(options) { + this.options = options; + } +} + +// node_modules/@zxcvbn-ts/core/dist/matcher/date/matching.mjs +class MatchDate extends MatcherBaseClass { + match({ + password + }) { + const matches = [...this.getMatchesWithoutSeparator(password), ...this.getMatchesWithSeparator(password)]; + const filteredMatches = this.filterNoise(matches); + return filteredMatches; + } + getMatchesWithSeparator(password) { + const matches = []; + const maybeDateWithSeparator = /^(\d{1,4})([\s/\\_.-])(\d{1,2})\2(\d{1,4})$/; + for (let i = 0;i <= Math.abs(password.length - 6); i += 1) { + for (let j = i + 5;j <= i + 9; j += 1) { + if (j >= password.length) { + break; + } + const token = password.slice(i, j + 1); + const regexMatch = maybeDateWithSeparator.exec(token); + if (regexMatch != null) { + const dmy = this.mapIntegersToDayMonthYear([parseInt(regexMatch[1], 10), parseInt(regexMatch[3], 10), parseInt(regexMatch[4], 10)]); + if (dmy != null) { + matches.push({ + pattern: "date", + token, + i, + j, + separator: regexMatch[2], + year: dmy.year, + month: dmy.month, + day: dmy.day + }); + } + } + } + } + return matches; + } + getMatchesWithoutSeparator(password) { + const matches = []; + const maybeDateNoSeparator = /^\d{4,8}$/; + const metric = (candidate) => Math.abs(candidate.year - REFERENCE_YEAR); + for (let i = 0;i <= Math.abs(password.length - 4); i += 1) { + for (let j = i + 3;j <= i + 7; j += 1) { + if (j >= password.length) { + break; + } + const token = password.slice(i, j + 1); + if (maybeDateNoSeparator.exec(token)) { + const candidates = []; + const index = token.length; + const splittedDates = DATE_SPLITS[index]; + splittedDates.forEach(([k, l]) => { + const dmy = this.mapIntegersToDayMonthYear([parseInt(token.slice(0, k), 10), parseInt(token.slice(k, l), 10), parseInt(token.slice(l), 10)]); + if (dmy != null) { + candidates.push(dmy); + } + }); + if (candidates.length > 0) { + let bestCandidate = candidates[0]; + let minDistance = metric(candidates[0]); + candidates.slice(1).forEach((candidate) => { + const distance = metric(candidate); + if (distance < minDistance) { + bestCandidate = candidate; + minDistance = distance; + } + }); + matches.push({ + pattern: "date", + token, + i, + j, + separator: "", + year: bestCandidate.year, + month: bestCandidate.month, + day: bestCandidate.day + }); + } + } + } + } + return matches; + } + filterNoise(matches) { + if (matches.length === 0) { + return []; + } + const sortedMatches = [...matches].sort((a, b) => { + if (a.i !== b.i) { + return a.i - b.i; + } + return b.j - a.j; + }); + const result = []; + let maxJ = -1; + for (const match of sortedMatches) { + if (match.j > maxJ) { + result.push(match); + maxJ = match.j; + } + } + return result; + } + mapIntegersToDayMonthYear(integers) { + if (integers[1] > 31 || integers[1] <= 0) { + return null; + } + let over12 = 0; + let over31 = 0; + let under1 = 0; + for (let o = 0, len1 = integers.length;o < len1; o += 1) { + const int = integers[o]; + if (int > 99 && int < DATE_MIN_YEAR || int > DATE_MAX_YEAR) { + return null; + } + if (int > 31) { + over31 += 1; + } + if (int > 12) { + over12 += 1; + } + if (int <= 0) { + under1 += 1; + } + } + if (over31 >= 2 || over12 === 3 || under1 >= 2) { + return null; + } + return this.getDayMonth(integers); + } + getDayMonth(integers) { + const possibleYearSplits = [ + [integers[2], integers.slice(0, 2)], + [integers[0], integers.slice(1, 3)] + ]; + const possibleYearSplitsLength = possibleYearSplits.length; + for (let j = 0;j < possibleYearSplitsLength; j += 1) { + const [y, rest] = possibleYearSplits[j]; + if (DATE_MIN_YEAR <= y && y <= DATE_MAX_YEAR) { + const dm = this.mapIntegersToDayMonth(rest); + if (dm != null) { + return { + year: y, + month: dm.month, + day: dm.day + }; + } + return null; + } + } + for (let k = 0;k < possibleYearSplitsLength; k += 1) { + const [y, rest] = possibleYearSplits[k]; + const dm = this.mapIntegersToDayMonth(rest); + if (dm != null) { + return { + year: this.twoToFourDigitYear(y), + month: dm.month, + day: dm.day + }; + } + } + return null; + } + mapIntegersToDayMonth(integers) { + const temp = [integers, integers.slice().reverse()]; + for (let i = 0;i < temp.length; i += 1) { + const data = temp[i]; + const day = data[0]; + const month = data[1]; + if (day >= 1 && day <= 31 && month >= 1 && month <= 12) { + return { + day, + month + }; + } + } + return null; + } + twoToFourDigitYear(year) { + if (year > 50) { + return year + 1900; + } + return year + 2000; + } +} + +// node_modules/fastest-levenshtein/esm/mod.js +var peq = new Uint32Array(65536); +var myers_32 = (a, b) => { + const n = a.length; + const m = b.length; + const lst = 1 << n - 1; + let pv = -1; + let mv = 0; + let sc = n; + let i = n; + while (i--) { + peq[a.charCodeAt(i)] |= 1 << i; + } + for (i = 0;i < m; i++) { + let eq = peq[b.charCodeAt(i)]; + const xv = eq | mv; + eq |= (eq & pv) + pv ^ pv; + mv |= ~(eq | pv); + pv &= eq; + if (mv & lst) { + sc++; + } + if (pv & lst) { + sc--; + } + mv = mv << 1 | 1; + pv = pv << 1 | ~(xv | mv); + mv &= xv; + } + i = n; + while (i--) { + peq[a.charCodeAt(i)] = 0; + } + return sc; +}; +var myers_x = (b, a) => { + const n = a.length; + const m = b.length; + const mhc = []; + const phc = []; + const hsize = Math.ceil(n / 32); + const vsize = Math.ceil(m / 32); + for (let i = 0;i < hsize; i++) { + phc[i] = -1; + mhc[i] = 0; + } + let j = 0; + for (;j < vsize - 1; j++) { + let mv2 = 0; + let pv2 = -1; + const start2 = j * 32; + const vlen2 = Math.min(32, m) + start2; + for (let k = start2;k < vlen2; k++) { + peq[b.charCodeAt(k)] |= 1 << k; + } + for (let i = 0;i < n; i++) { + const eq = peq[a.charCodeAt(i)]; + const pb = phc[i / 32 | 0] >>> i & 1; + const mb = mhc[i / 32 | 0] >>> i & 1; + const xv = eq | mv2; + const xh = ((eq | mb) & pv2) + pv2 ^ pv2 | eq | mb; + let ph = mv2 | ~(xh | pv2); + let mh = pv2 & xh; + if (ph >>> 31 ^ pb) { + phc[i / 32 | 0] ^= 1 << i; + } + if (mh >>> 31 ^ mb) { + mhc[i / 32 | 0] ^= 1 << i; + } + ph = ph << 1 | pb; + mh = mh << 1 | mb; + pv2 = mh | ~(xv | ph); + mv2 = ph & xv; + } + for (let k = start2;k < vlen2; k++) { + peq[b.charCodeAt(k)] = 0; + } + } + let mv = 0; + let pv = -1; + const start = j * 32; + const vlen = Math.min(32, m - start) + start; + for (let k = start;k < vlen; k++) { + peq[b.charCodeAt(k)] |= 1 << k; + } + let score = m; + for (let i = 0;i < n; i++) { + const eq = peq[a.charCodeAt(i)]; + const pb = phc[i / 32 | 0] >>> i & 1; + const mb = mhc[i / 32 | 0] >>> i & 1; + const xv = eq | mv; + const xh = ((eq | mb) & pv) + pv ^ pv | eq | mb; + let ph = mv | ~(xh | pv); + let mh = pv & xh; + score += ph >>> m - 1 & 1; + score -= mh >>> m - 1 & 1; + if (ph >>> 31 ^ pb) { + phc[i / 32 | 0] ^= 1 << i; + } + if (mh >>> 31 ^ mb) { + mhc[i / 32 | 0] ^= 1 << i; + } + ph = ph << 1 | pb; + mh = mh << 1 | mb; + pv = mh | ~(xv | ph); + mv = ph & xv; + } + for (let k = start;k < vlen; k++) { + peq[b.charCodeAt(k)] = 0; + } + return score; +}; +var distance = (a, b) => { + if (a.length < b.length) { + const tmp = b; + b = a; + a = tmp; + } + if (b.length === 0) { + return a.length; + } + if (a.length <= 32) { + return myers_32(a, b); + } + return myers_x(a, b); +}; + +// node_modules/@zxcvbn-ts/core/dist/utils/levenshtein.mjs +var PLACEHOLDER = "￿"; +var codePointDistance = (first, second) => { + let previousRow = Array.from({ + length: second.length + 1 + }, (_, index) => index); + first.forEach((firstCharacter, firstIndex) => { + const row = [firstIndex + 1]; + second.forEach((secondCharacter, secondIndex) => { + row.push(Math.min(previousRow[secondIndex + 1] + 1, row[secondIndex] + 1, previousRow[secondIndex] + (firstCharacter === secondCharacter ? 0 : 1))); + }); + previousRow = row; + }); + return previousRow[second.length]; +}; +var createGetDistance = (password) => { + const passwordCharacters = Array.from(password); + const hasSurrogatePairs = password.length !== passwordCharacters.length; + const passwordCodeUnits = hasSurrogatePairs ? passwordCharacters.map((character) => character.length > 1 ? PLACEHOLDER : character).join("") : password; + return (entry, entryLength) => entry.length === entryLength && !(hasSurrogatePairs && entry.includes(PLACEHOLDER)) ? distance(passwordCodeUnits, entry) : codePointDistance(passwordCharacters, Array.from(entry)); +}; +var getCharacterMask = (string) => { + let mask = 0; + for (let index = 0;index < string.length; index += 1) { + const code = string.charCodeAt(index); + if (!isHighSurrogate(code)) { + mask |= 1 << code % 30; + } + } + return mask; +}; +var hasMoreBits = (value, limit) => { + let rest = value; + for (let count = 0;count < limit; count += 1) { + rest &= rest - 1; + } + return rest !== 0; +}; +var entriesByLengthCache = new WeakMap; +var sortByRank = (group) => { + const { + entries, + ranks + } = group; + if (ranks.every((rank, index) => index === 0 || ranks[index - 1] <= rank)) { + return; + } + const order = ranks.map((_, index) => index).sort((first, second) => ranks[first] - ranks[second]); + group.entries = order.map((index) => entries[index]); + group.ranks = order.map((index) => ranks[index]); +}; +var getEntriesByLength = (dictionary) => { + const cached = entriesByLengthCache.get(dictionary); + if (cached) { + return cached; + } + const entriesByLength = new Map; + const { + entries, + ranks + } = dictionary.getEntries(); + entries.forEach((entry, index) => { + if (entry === "") { + return; + } + const length = countCharacters(entry); + let group = entriesByLength.get(length); + if (!group) { + group = { + entries: [], + ranks: [], + masks: new Int32Array(0) + }; + entriesByLength.set(length, group); + } + group.entries.push(entry); + group.ranks.push(ranks[index]); + }); + entriesByLength.forEach((group) => { + sortByRank(group); + group.masks = Int32Array.from(group.entries, getCharacterMask); + }); + entriesByLengthCache.set(dictionary, entriesByLength); + return entriesByLength; +}; +var findInGroup = ({ + group: { + entries, + ranks, + masks + }, + entryLength, + threshold, + getDistance, + passwordMask, + found +}) => { + const maxDifferentCharacters = Math.min(Math.floor(threshold), 30); + const foundRank = found ? found.rank : Infinity; + for (let index = 0;index < entries.length && ranks[index] < foundRank; index += 1) { + const mask = masks[index]; + if (hasMoreBits(mask & ~passwordMask, maxDifferentCharacters) || hasMoreBits(passwordMask & ~mask, maxDifferentCharacters)) { + continue; + } + const entryDistance = getDistance(entries[index], entryLength); + if (entryDistance <= threshold) { + return { + rank: ranks[index], + entry: entries[index], + distance: entryDistance + }; + } + } + return found; +}; +var findLevenshteinEntry = (password, dictionary, threshold, passwordRank) => { + const entriesByLength = getEntriesByLength(dictionary); + const passwordLength = countCharacters(password); + const getDistance = createGetDistance(password); + const passwordMask = getCharacterMask(password); + let found = passwordRank === undefined ? undefined : { + rank: passwordRank, + entry: password, + distance: 0 + }; + const lengthDifference = (entryLength) => Math.abs(entryLength - passwordLength); + Array.from(entriesByLength.keys()).filter((entryLength) => lengthDifference(entryLength) <= threshold).sort((first, second) => lengthDifference(first) - lengthDifference(second)).forEach((entryLength) => { + found = findInGroup({ + group: entriesByLength.get(entryLength), + entryLength, + threshold, + getDistance, + passwordMask, + found + }); + }); + return found; +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/dictionary/WordRanges.mjs +class WordRanges { + constructor(wordIndex, userInputsWordIndex) { + this.wordIndex = wordIndex; + this.userInputsWordIndex = userInputsWordIndex; + this.range = new Int32Array(2); + this.userInputsRange = new Int32Array(2); + } + reset() { + this.range[0] = 0; + this.range[1] = this.wordIndex.words.length; + this.userInputsRange[0] = 0; + this.userInputsRange[1] = this.userInputsWordIndex ? this.userInputsWordIndex.words.length : 0; + } + copy({ + range, + userInputsRange + }) { + this.range[0] = range[0]; + this.range[1] = range[1]; + this.userInputsRange[0] = userInputsRange[0]; + this.userInputsRange[1] = userInputsRange[1]; + } + narrow(depth, code) { + let searches = 0; + if (this.range[0] < this.range[1]) { + this.wordIndex.narrow(this.range, depth, code); + searches += 1; + } + if (this.userInputsWordIndex && this.userInputsRange[0] < this.userInputsRange[1]) { + this.userInputsWordIndex.narrow(this.userInputsRange, depth, code); + searches += 1; + } + return searches; + } + isEmpty() { + return this.range[0] >= this.range[1] && this.userInputsRange[0] >= this.userInputsRange[1]; + } + getWord(length) { + return this.range[0] < this.range[1] && this.wordIndex.words[this.range[0]].length === length ? this.range[0] : -1; + } + getUserInputsRank(length) { + return this.userInputsWordIndex && this.userInputsRange[0] < this.userInputsRange[1] && this.userInputsWordIndex.words[this.userInputsRange[0]].length === length ? this.userInputsWordIndex.getRank(this.userInputsRange[0], 0) : undefined; + } + getUserInput() { + return this.userInputsWordIndex.words[this.userInputsRange[0]]; + } +} + +// node_modules/@zxcvbn-ts/core/dist/matcher/dictionary/matching.mjs +var USER_INPUTS = "userInputs"; +var getUserInputsPosition = (wordIndex) => { + const position = wordIndex.dictionaryNames.indexOf(USER_INPUTS); + return position === -1 ? wordIndex.dictionaryNames.length : position; +}; +var userInputsMaxWordSizeCache = new WeakMap; +var getUserInputsMaxWordSize = (userInputsWordIndex) => { + let maxWordSize = userInputsMaxWordSizeCache.get(userInputsWordIndex); + if (maxWordSize === undefined) { + maxWordSize = userInputsWordIndex.words.reduce((max, word) => Math.max(max, countCharacters(word)), 0); + userInputsMaxWordSizeCache.set(userInputsWordIndex, maxWordSize); + } + return maxWordSize; +}; +var combineLevenshteinDictionaries = (first, second) => ({ + getEntries: () => { + const { + entries, + ranks + } = first.getEntries(); + const seen = new Set(entries); + const secondEntries = second.getEntries(); + secondEntries.entries.forEach((entry, index) => { + if (!seen.has(entry)) { + entries.push(entry); + ranks.push(secondEntries.ranks[index]); + } + }); + return { + entries, + ranks + }; + }, + getRank: (entry) => { + var _a; + return (_a = first.getRank(entry)) !== null && _a !== undefined ? _a : second.getRank(entry); + } +}); +var userInputsLevenshteinCache = new WeakMap; +var getUserInputsLevenshteinDictionary = (wordIndex, userInputsWordIndex) => { + let byUserInputs = userInputsLevenshteinCache.get(wordIndex); + if (!byUserInputs) { + byUserInputs = new WeakMap; + userInputsLevenshteinCache.set(wordIndex, byUserInputs); + } + let dictionary = byUserInputs.get(userInputsWordIndex); + if (!dictionary) { + const userInputs = userInputsWordIndex.getLevenshteinDictionary(0); + const optionsDictionary = wordIndex.dictionaryNames.indexOf(USER_INPUTS); + dictionary = optionsDictionary === -1 ? userInputs : combineLevenshteinDictionaries(userInputs, wordIndex.getLevenshteinDictionary(optionsDictionary)); + byUserInputs.set(userInputsWordIndex, dictionary); + } + return dictionary; +}; + +class MatchDictionary extends MatcherBaseClass { + match({ + password, + userInputsOptions + }) { + const matches = []; + const passwordLength = password.length; + const passwordLower = toLowerCase(password); + const { + wordIndex, + useLevenshteinDistance + } = this.options; + const userInputsPosition = getUserInputsPosition(wordIndex); + const userInputsWordIndex = userInputsOptions === null || userInputsOptions === undefined ? undefined : userInputsOptions.wordIndex; + const addMatches = (i, j, hits) => { + const usedPassword = passwordLower.slice(i, j + 1); + hits.forEach(({ + dictionaryName, + rank, + ...levenshtein + }) => { + matches.push({ + pattern: "dictionary", + i, + j, + token: password.slice(i, j + 1), + matchedWord: usedPassword, + rank, + dictionaryName, + reversed: false, + l33t: false, + ...levenshtein + }); + }); + }; + const ranges = new WordRanges(wordIndex, userInputsWordIndex); + for (let i = 0;i < passwordLength; i += 1) { + ranges.reset(); + for (let j = i;j < passwordLength; j += 1) { + const depth = j - i; + ranges.narrow(depth, passwordLower.charCodeAt(j)); + if (ranges.isEmpty()) { + break; + } + const isFullPassword = i === 0 && j === passwordLength - 1; + if (useLevenshteinDistance && isFullPassword) { + break; + } + const word = ranges.getWord(depth + 1); + const userInputsRank = ranges.getUserInputsRank(depth + 1); + if (word !== -1 || userInputsRank !== undefined) { + addMatches(i, j, this.getHits(word, userInputsRank, userInputsPosition)); + } + } + if (i === 0 && useLevenshteinDistance) { + addMatches(0, passwordLength - 1, this.getLevenshteinHits(passwordLower, userInputsWordIndex)); + } + } + return matches; + } + getHits(word, userInputsRank, userInputsDictionary) { + const { + wordIndex + } = this.options; + const { + dictionaryNames, + hitStart, + hitDictionary, + hitRank + } = wordIndex; + const hits = []; + let remainingUserInputsRank = userInputsRank; + if (word !== -1) { + for (let hit = hitStart[word];hit < hitStart[word + 1]; hit += 1) { + const dictionary = hitDictionary[hit]; + if (remainingUserInputsRank !== undefined && dictionary >= userInputsDictionary) { + hits.push({ + dictionaryName: USER_INPUTS, + rank: remainingUserInputsRank + }); + remainingUserInputsRank = undefined; + if (dictionary === userInputsDictionary) { + continue; + } + } + hits.push({ + dictionaryName: dictionaryNames[dictionary], + rank: hitRank[hit] + }); + } + } + if (remainingUserInputsRank !== undefined) { + hits.push({ + dictionaryName: USER_INPUTS, + rank: remainingUserInputsRank + }); + } + return hits; + } + getLevenshteinHits(usedPassword, userInputsWordIndex) { + const { + wordIndex, + dictionaryMaxWordSizes, + levenshteinThreshold + } = this.options; + const { + dictionaryNames + } = wordIndex; + const passwordLength = countCharacters(usedPassword); + const hits = []; + const addHit = (dictionaryName, dictionary, maxWordSize) => { + const rank = dictionary.getRank(usedPassword); + const found = passwordLength - maxWordSize > levenshteinThreshold ? undefined : findLevenshteinEntry(usedPassword, dictionary, levenshteinThreshold, rank); + if (found && found.entry !== usedPassword) { + hits.push({ + dictionaryName, + rank: found.rank, + levenshteinDistance: found.distance, + levenshteinDistanceEntry: found.entry + }); + } else if (rank !== undefined) { + hits.push({ + dictionaryName, + rank + }); + } + }; + const userInputsDictionary = getUserInputsPosition(wordIndex); + for (let dictionary = 0;dictionary <= dictionaryNames.length; dictionary += 1) { + if (dictionary === userInputsDictionary && userInputsWordIndex) { + addHit(USER_INPUTS, getUserInputsLevenshteinDictionary(wordIndex, userInputsWordIndex), Math.max(getUserInputsMaxWordSize(userInputsWordIndex), dictionaryMaxWordSizes[USER_INPUTS] || 0)); + } else if (dictionary < dictionaryNames.length) { + const name = dictionaryNames[dictionary]; + addHit(name, wordIndex.getLevenshteinDictionary(dictionary), dictionaryMaxWordSizes[name]); + } + } + return hits; + } +} + +// node_modules/@zxcvbn-ts/core/dist/matcher/dictionary/variants/matching/unmunger/getCleanPasswords.mjs +class CleanPasswords { + constructor({ + substr, + limit, + trieRoot + }) { + this.buffer = []; + this.finalPasswords = []; + this.substr = substr; + this.limit = limit; + this.trieRoot = trieRoot; + } + getAllPossibleSubsAtIndex(index) { + const nodes = []; + let cur = this.trieRoot; + for (let i = index;i < this.substr.length; i += 1) { + const character = this.substr.charAt(i); + cur = cur.getChild(character); + if (!cur) { + break; + } + nodes.push(cur); + } + return nodes; + } + helper({ + index, + subIndex, + changes, + lastSubLetter, + consecutiveSubCount + }) { + if (this.finalPasswords.length >= this.limit) { + return; + } + if (index === this.substr.length) { + this.finalPasswords.push({ + password: this.buffer.join(""), + changes + }); + return; + } + const nodes = [...this.getAllPossibleSubsAtIndex(index)]; + let hasSubs = false; + for (let i = index + nodes.length - 1;i >= index; i -= 1) { + const cur = nodes[i - index]; + const sub = cur.parents.join(""); + if (cur.isTerminal()) { + if (lastSubLetter === sub && consecutiveSubCount >= 3) { + continue; + } + hasSubs = true; + const letters = cur.subs; + for (const letter of letters) { + this.buffer.push(letter); + const newSubs = changes.concat({ + i: subIndex, + letter, + substitution: sub + }); + this.helper({ + index: index + sub.length, + subIndex: subIndex + letter.length, + changes: newSubs, + lastSubLetter: sub, + consecutiveSubCount: lastSubLetter === sub ? consecutiveSubCount + 1 : 1 + }); + this.buffer.pop(); + if (this.finalPasswords.length >= this.limit) { + return; + } + } + } + } + if (!hasSubs) { + const firstChar = this.substr.charAt(index); + this.buffer.push(firstChar); + this.helper({ + index: index + 1, + subIndex: subIndex + 1, + changes, + lastSubLetter, + consecutiveSubCount + }); + this.buffer.pop(); + } + } + getAll() { + this.helper({ + index: 0, + subIndex: 0, + changes: [], + lastSubLetter: undefined, + consecutiveSubCount: 0 + }); + return this.finalPasswords; + } +} +var getCleanPasswords = (password, limit, trieRoot) => { + const helper = new CleanPasswords({ + substr: password, + limit, + trieRoot + }); + return helper.getAll(); +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/dictionary/variants/matching/l33t.mjs +var L33T_NARROW_BUDGET = 1e5; +var getSubs = (changes) => { + const subs = []; + const subDisplay = []; + const seenSubs = new Set; + changes.forEach(({ + letter, + substitution + }) => { + const subKey = `${letter}-${substitution}`; + if (!seenSubs.has(subKey)) { + seenSubs.add(subKey); + subs.push({ + letter, + substitution + }); + subDisplay.push(`${substitution} -> ${letter}`); + } + }); + return { + subs, + subDisplay: subDisplay.join(", ") + }; +}; + +class L33tWalk { + constructor(options) { + this.changes = []; + this.rangesByDepth = []; + this.start = 0; + this.substitutionsAt = []; + this.lastSubstitution = -1; + this.narrowCount = 0; + this.narrowLimit = 0; + this.stopped = false; + this.largestShare = 0; + this.options = options; + this.password = options.password; + this.passwordLower = toLowerCase(options.password); + for (let position = 0;position < this.password.length; position += 1) { + const matching = this.getSubstitutionsAt(position); + this.substitutionsAt.push(matching); + if (matching.length > 0) { + this.lastSubstitution = position; + } + } + } + run() { + this.ensureRanges(0); + let stoppedStarts = this.walkEveryStart(); + while (stoppedStarts.length > 0 && this.narrowCount < this.options.budget) { + this.largestShare *= 2; + stoppedStarts = stoppedStarts.filter((start) => this.walkStart(start, this.largestShare)); + } + } + walkEveryStart() { + const stoppedStarts = []; + for (let start = 0;start <= this.lastSubstitution; start += 1) { + const startsLeft = this.lastSubstitution - start + 1; + const budgetLeft = Math.max(0, this.options.budget - this.narrowCount); + const share = Math.ceil(budgetLeft / startsLeft); + this.largestShare = Math.max(this.largestShare, share); + if (this.walkStart(start, share)) { + stoppedStarts.push(start); + } + } + return stoppedStarts; + } + walkStart(start, share) { + this.start = start; + this.rangesByDepth[0].reset(); + this.narrowLimit = Math.min(this.narrowCount + share, this.options.budget); + this.stopped = false; + this.walk(start, 0); + return this.stopped; + } + hasBudget() { + if (this.narrowCount >= this.narrowLimit) { + this.stopped = true; + return false; + } + return true; + } + ensureRanges(depth) { + const { + wordIndex, + userInputsWordIndex + } = this.options; + for (let next = this.rangesByDepth.length;next <= depth; next += 1) { + this.rangesByDepth.push(new WordRanges(wordIndex, userInputsWordIndex)); + } + } + narrow(depth, characters) { + this.ensureRanges(depth + characters.length); + const ranges = this.rangesByDepth[depth + characters.length]; + ranges.copy(this.rangesByDepth[depth]); + for (let index = 0;index < characters.length; index += 1) { + this.narrowCount += ranges.narrow(depth + index, characters.charCodeAt(index)); + if (ranges.isEmpty()) { + return false; + } + } + return true; + } + emit(position, depth) { + const { + wordIndex, + onWord + } = this.options; + const ranges = this.rangesByDepth[depth]; + const word = ranges.getWord(depth); + const userInputsRank = ranges.getUserInputsRank(depth); + if (word !== -1 || userInputsRank !== undefined) { + onWord({ + i: this.start, + j: position - 1, + matchedWord: word === -1 ? ranges.getUserInput() : wordIndex.words[word], + word, + userInputsRank, + changes: this.changes + }); + } + } + getSubstitutionsAt(position) { + const { + substitutions + } = this.options; + const lower = this.passwordLower.charAt(position); + const character = this.password.charAt(position); + const matching = (substitutions.get(lower) || []).filter(({ + substitution + }) => this.passwordLower.startsWith(substitution, position) || this.password.startsWith(substitution, position)); + if (character !== lower) { + (substitutions.get(character) || []).forEach((candidate) => { + if (this.password.startsWith(candidate.substitution, position)) { + matching.push(candidate); + } + }); + } + return matching; + } + walk(position, depth) { + if (depth > 0 && this.changes.length > 0) { + this.emit(position, depth); + } + if (position === this.password.length || this.changes.length === 0 && position > this.lastSubstitution) { + return; + } + for (const { + substitution, + letters, + lettersLower + } of this.substitutionsAt[position]) { + for (let index = 0;index < letters.length; index += 1) { + const letterLower = lettersLower[index]; + if (this.hasBudget() && this.narrow(depth, letterLower)) { + this.changes.push({ + i: position, + letter: letters[index], + substitution + }); + this.walk(position + substitution.length, depth + letterLower.length); + this.changes.pop(); + } + } + } + if (this.hasBudget() && this.narrow(depth, this.passwordLower.charAt(position))) { + this.walk(position + 1, depth + 1); + } + } +} + +class MatchL33t extends MatchDictionary { + constructor() { + super(...arguments); + this.narrowBudget = L33T_NARROW_BUDGET; + } + match({ + password, + userInputsOptions + }) { + const matches = []; + const seen = new Set; + const { + wordIndex + } = this.options; + const userInputsWordIndex = userInputsOptions === null || userInputsOptions === undefined ? undefined : userInputsOptions.wordIndex; + const addMatches = ({ + i, + j, + matchedWord, + changes + }, getHits, seenWords) => { + const wordKey = `${i}\x00${j}\x00${matchedWord}`; + if (seenWords.has(wordKey)) { + return; + } + seenWords.add(wordKey); + const token = password.slice(i, j + 1); + if (toLowerCase(token) === matchedWord || countCharacters(token) <= 1) { + return; + } + let extras; + getHits().forEach(({ + dictionaryName, + rank, + ...levenshtein + }) => { + const key = `${wordKey}\x00${dictionaryName}`; + if (seen.has(key)) { + return; + } + seen.add(key); + extras !== null && extras !== undefined || (extras = getSubs(changes)); + matches.push({ + pattern: "dictionary", + i, + j, + token, + matchedWord, + rank, + dictionaryName, + reversed: false, + l33t: true, + ...levenshtein, + ...extras + }); + }); + }; + if (this.options.useLevenshteinDistance) { + const seenLevenshteinWords = new Set; + getCleanPasswords(password, this.options.l33tMaxSubstitutions, this.options.trieNodeRoot).forEach(({ + password: subbedPassword, + changes + }) => { + if (changes.length === 0) { + return; + } + const matchedWord = toLowerCase(subbedPassword); + addMatches({ + i: 0, + j: password.length - 1, + matchedWord, + changes + }, () => this.getLevenshteinHits(matchedWord, userInputsWordIndex), seenLevenshteinWords); + }); + } + const userInputsPosition = getUserInputsPosition(wordIndex); + const seenWalkWords = new Set; + new L33tWalk({ + password, + substitutions: this.options.l33tSubstitutions, + wordIndex, + userInputsWordIndex, + budget: this.narrowBudget, + onWord: (found) => { + addMatches(found, () => this.getHits(found.word, found.userInputsRank, userInputsPosition), seenWalkWords); + } + }).run(); + return matches; + } +} + +// node_modules/@zxcvbn-ts/core/dist/matcher/dictionary/variants/matching/reverse.mjs +class MatchReverse extends MatchDictionary { + match(matchOptions) { + const passwordReversed = Array.from(matchOptions.password).reverse().join(""); + return super.match({ + ...matchOptions, + password: passwordReversed + }).map((match) => ({ + ...match, + token: Array.from(match.token).reverse().join(""), + reversed: true, + i: matchOptions.password.length - 1 - match.j, + j: matchOptions.password.length - 1 - match.i + })); + } +} + +// node_modules/@zxcvbn-ts/core/dist/matcher/regex/matching.mjs +class MatchRegex extends MatcherBaseClass { + match({ + password + }) { + const matches = []; + Object.keys(REGEXEN).forEach((name) => { + const regex = REGEXEN[name]; + regex.lastIndex = 0; + let regexMatch; + while (regexMatch = regex.exec(password)) { + const token = regexMatch[0]; + matches.push({ + pattern: "regex", + token, + i: regexMatch.index, + j: regexMatch.index + regexMatch[0].length - 1, + regexName: name, + regexMatch + }); + } + }); + return matches; + } +} + +// node_modules/@zxcvbn-ts/core/dist/scoring/utils.mjs +var LOG10 = Math.log(10); +var factorials = [1]; +var utils = { + nCk(n, k) { + let count = n; + if (k > count) { + return 0; + } + if (k === 0) { + return 1; + } + let coEff = 1; + for (let i = 1;i <= k; i += 1) { + coEff *= count; + coEff /= i; + count -= 1; + } + return coEff; + }, + factorial(n) { + for (let i = factorials.length;i <= n; i += 1) { + factorials[i] = factorials[i - 1] * i; + } + return factorials[n]; + }, + log10(n) { + if (n === 0) + return 0; + return Math.log(n) / LOG10; + } +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/bruteforce/scoring.mjs +var bruteforceGuesses = (tokenLength) => { + let guesses = BRUTEFORCE_CARDINALITY ** tokenLength; + if (guesses === Number.POSITIVE_INFINITY) { + guesses = Number.MAX_VALUE; + } + let minGuesses; + if (tokenLength === 1) { + minGuesses = MIN_SUBMATCH_GUESSES_SINGLE_CHAR + 1; + } else { + minGuesses = MIN_SUBMATCH_GUESSES_MULTI_CHAR + 1; + } + return Math.max(guesses, minGuesses); +}; +var bruteforceMatcher = ({ + token +}) => bruteforceGuesses(countCharacters(token)); + +// node_modules/@zxcvbn-ts/core/dist/matcher/date/scoring.mjs +var dateMatcher = ({ + year, + separator +}) => { + const yearSpace = Math.max(Math.abs(year - REFERENCE_YEAR), MIN_YEAR_SPACE); + let guesses = yearSpace * 365; + if (separator) { + guesses *= 4; + } + return guesses; +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/dictionary/variants/scoring/uppercase.mjs +var getVariations = (cleanedWord) => { + const wordArray = cleanedWord.split(""); + const upperCaseCount = wordArray.filter((char) => char.match(ONE_UPPER)).length; + const lowerCaseCount = wordArray.filter((char) => char.match(ONE_LOWER)).length; + let variations = 0; + const variationLength = Math.min(upperCaseCount, lowerCaseCount); + for (let i = 1;i <= variationLength; i += 1) { + variations += utils.nCk(upperCaseCount + lowerCaseCount, i); + } + return variations; +}; +var uppercaseVariant = (word) => { + const cleanedWord = word.replace(ALPHA_INVERTED, ""); + if (cleanedWord.match(ALL_LOWER_INVERTED) || cleanedWord.toLowerCase() === cleanedWord) { + return 1; + } + const commonCases = [START_UPPER, END_UPPER, ALL_UPPER_INVERTED]; + const commonCasesLength = commonCases.length; + for (let i = 0;i < commonCasesLength; i += 1) { + const regex = commonCases[i]; + if (cleanedWord.match(regex)) { + return 2; + } + } + return getVariations(cleanedWord); +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/dictionary/variants/scoring/l33t.mjs +var countSubstring = (string, substring) => { + let count = 0; + let pos = string.indexOf(substring); + while (pos >= 0) { + count += 1; + pos = string.indexOf(substring, pos + substring.length); + } + return count; +}; +var getCounts = ({ + sub, + token +}) => { + const tokenLower = token.toLowerCase(); + const subbedCount = countSubstring(tokenLower, sub.substitution); + const unsubbedCount = countSubstring(tokenLower, sub.letter); + return { + subbedCount, + unsubbedCount + }; +}; +var l33tVariant = ({ + l33t, + subs, + token +}) => { + if (!l33t) { + return 1; + } + let variations = 1; + subs.forEach((sub) => { + const { + subbedCount, + unsubbedCount + } = getCounts({ + sub, + token + }); + if (subbedCount === 0 || unsubbedCount === 0) { + variations *= 2; + } else { + const p = Math.min(unsubbedCount, subbedCount); + let possibilities = 0; + for (let i = 1;i <= p; i += 1) { + possibilities += utils.nCk(unsubbedCount + subbedCount, i); + } + variations *= possibilities; + } + }); + return variations; +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/dictionary/scoring.mjs +var dictionaryMatcher = ({ + rank, + reversed, + l33t, + subs, + token, + dictionaryName +}) => { + const baseGuesses = rank; + const uppercaseVariations = uppercaseVariant(token); + const l33tVariations = l33tVariant({ + l33t, + subs, + token + }); + const reversedVariations = reversed && 2 || 1; + let calculation; + if (isDictionaryNamed(dictionaryName, "diceware")) { + calculation = 6 ** 5 / 2; + } else { + calculation = baseGuesses * uppercaseVariations * l33tVariations * reversedVariations; + } + return { + baseGuesses, + uppercaseVariations, + l33tVariations, + calculation + }; +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/regex/scoring.mjs +var regexMatcher = ({ + regexName, + regexMatch, + token +}) => { + const charClassBases = { + alphaLower: 26, + alphaUpper: 26, + alpha: 52, + alphanumeric: 62, + digits: 10, + symbols: 33 + }; + if (regexName in charClassBases) { + return charClassBases[regexName] ** token.length; + } + switch (regexName) { + case "recentYear": + return Math.max(Math.abs(parseInt(regexMatch[0], 10) - REFERENCE_YEAR), MIN_YEAR_SPACE); + } + return 0; +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/repeat/scoring.mjs +var repeatMatcher = ({ + baseGuesses, + repeatCount +}) => baseGuesses * repeatCount; + +// node_modules/@zxcvbn-ts/core/dist/matcher/sequence/scoring.mjs +var sequenceMatcher = ({ + token, + ascending +}) => { + const firstChr = token.charAt(0); + let baseGuesses; + const startingPoints = ["a", "A", "z", "Z", "0", "1", "9"]; + if (startingPoints.includes(firstChr)) { + baseGuesses = 4; + } else if (/\d/.exec(firstChr)) { + baseGuesses = 10; + } else { + baseGuesses = 26; + } + if (!ascending) { + baseGuesses *= 2; + } + return baseGuesses * countCharacters(token); +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/spatial/scoring.mjs +var calcAverageDegree = (graph) => { + let average = 0; + Object.keys(graph).forEach((key) => { + const neighbors = graph[key]; + average += neighbors.filter((entry) => !!entry).length; + }); + average /= Object.entries(graph).length; + return average; +}; +var estimatePossiblePatterns = (graphEntry, { + token, + turns +}) => { + const startingPosition = Object.keys(graphEntry).length; + const averageDegree = calcAverageDegree(graphEntry); + let guesses = 0; + const tokenLength = token.length; + for (let i = 2;i <= tokenLength; i += 1) { + const possibleTurns = Math.min(turns, i - 1); + for (let j = 1;j <= possibleTurns; j += 1) { + guesses += utils.nCk(i - 1, j - 1) * startingPosition * averageDegree ** j; + } + } + return guesses; +}; +var spatialMatcher = ({ + graph, + token, + shiftedCount, + turns +}, options) => { + let guesses = estimatePossiblePatterns(options.graphs[graph], { + token, + turns + }); + if (shiftedCount) { + const unShiftedCount = token.length - shiftedCount; + if (shiftedCount === 0 || unShiftedCount === 0) { + guesses *= 2; + } else { + let shiftedVariations = 0; + for (let i = 1;i <= Math.min(shiftedCount, unShiftedCount); i += 1) { + shiftedVariations += utils.nCk(shiftedCount + unShiftedCount, i); + } + guesses *= shiftedVariations; + } + } + return Math.round(guesses); +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/separator/scoring.mjs +var separatorMatcher = () => { + return SEPARATOR_CHAR_COUNT; +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/wordSequence/scoring.mjs +var product = (values) => values.reduce((result, value) => result * value, 1); +var gapOptions = (gap) => WORD_SEQUENCE_SEPARATOR_CHARS.has(gap[0]) ? WORD_SEQUENCE_SEPARATOR_CHARS.size : WORD_SEQUENCE_LETTER_GAP_OPTIONS; +var gapVariations = (gap) => new Set(gap).size === 1 ? gapOptions(gap) * gap.length : gapOptions(gap) ** gap.length; +var separatorVariations = (separators = []) => { + const gaps = separators.filter((gap) => gap !== ""); + if (gaps.length === 0) { + return 1; + } + const placements = gaps.length === separators.length ? 1 : 2 ** separators.length; + if (new Set(gaps).size === 1) { + return placements * gapVariations(gaps[0]); + } + if (new Set(gaps.join("")).size === 1) { + return placements * gapOptions(gaps[0]) * product(gaps.map((gap) => gap.length)); + } + return placements * product(gaps.map((gap) => gapVariations(gap))); +}; +var wordSequenceMatcher = (match) => { + if (match.pattern !== "wordSequence") { + return 0; + } + const baseGuesses = utils.factorial(match.wordCount); + const lengthPenalty = 2 ** (match.wordCount - 2); + return baseGuesses * lengthPenalty * separatorVariations(match.separators); +}; + +// node_modules/@zxcvbn-ts/core/dist/scoring/estimate.mjs +var getMinGuesses = (match, password) => { + let minGuesses = 1; + if (match.token.length < password.length) { + if (match.token.length <= 2 && countCharacters(match.token) === 1) { + minGuesses = MIN_SUBMATCH_GUESSES_SINGLE_CHAR; + } else { + minGuesses = MIN_SUBMATCH_GUESSES_MULTI_CHAR; + } + } + return minGuesses; +}; +var matchers = { + bruteforce: bruteforceMatcher, + date: dateMatcher, + dictionary: dictionaryMatcher, + regex: regexMatcher, + repeat: repeatMatcher, + sequence: sequenceMatcher, + spatial: spatialMatcher, + separator: separatorMatcher, + wordSequence: wordSequenceMatcher +}; +var getScoring = (options, name, match) => { + if (matchers[name]) { + return matchers[name](match, options); + } + if (options.matchers[name] && "scoring" in options.matchers[name]) { + return options.matchers[name].scoring(match, options); + } + return 0; +}; +var estimatedFloors = new WeakMap; +var getGuesses = (options, match) => { + const estimationResult = getScoring(options, match.pattern, match); + if (typeof estimationResult === "number") { + return estimationResult; + } + if (match.pattern === "dictionary") { + match.baseGuesses = estimationResult.baseGuesses; + match.uppercaseVariations = estimationResult.uppercaseVariations; + match.l33tVariations = estimationResult.l33tVariations; + return estimationResult.calculation; + } + return 0; +}; +var estimateGuesses = (options, match, password) => { + if ("guesses" in match && match.guesses != null) { + const estimatedFloor = match.guesses > MIN_SUBMATCH_GUESSES_MULTI_CHAR ? undefined : estimatedFloors.get(match); + if (estimatedFloor === undefined || estimatedFloor === getMinGuesses(match, password)) { + return match; + } + } + const minGuesses = getMinGuesses(match, password); + const estimated = match; + const matchGuesses = Math.max(getGuesses(options, estimated), minGuesses); + estimated.guesses = matchGuesses; + if (matchGuesses <= MIN_SUBMATCH_GUESSES_MULTI_CHAR) { + estimatedFloors.set(estimated, minGuesses); + } + estimated.guessesLog10 = utils.log10(matchGuesses); + return estimated; +}; + +// node_modules/@zxcvbn-ts/core/dist/scoring/index.mjs +var isBruteforce = (match) => typeof match === "number" || match.pattern === "bruteforce"; +var BOUND_TOLERANCE = 0.000000001; + +class Scoring { + constructor(options) { + this.options = options; + this.password = ""; + this.state = { + bestMatches: [], + guessesProduct: [], + totalGuesses: [] + }; + this.excludeAdditive = false; + this.factorials = [1]; + this.additivePenalties = [1]; + this.bestUpTo = new Float64Array(1); + this.endIndex = 0; + this.characterCounts = new Int32Array(1); + this.bruteforceGuessesByLength = []; + this.startBounds = new Float64Array(1); + this.startLengths = []; + } + makeBruteforceMatch(i, j) { + return { + pattern: "bruteforce", + token: this.password.slice(i, j + 1), + i, + j + }; + } + prepare(password) { + const passwordLength = password.length; + this.factorials = [1]; + this.additivePenalties = [1]; + this.bruteforceGuessesByLength = [bruteforceGuesses(0)]; + for (let n = 1;n <= passwordLength + 1; n += 1) { + this.factorials[n] = utils.factorial(n); + this.additivePenalties[n] = MIN_GUESSES_BEFORE_GROWING_SEQUENCE ** (n - 1); + this.bruteforceGuessesByLength[n] = bruteforceGuesses(n); + } + this.bestUpTo = new Float64Array(passwordLength + 2); + this.prepareCharacterCounts(password); + this.startBounds = new Float64Array(passwordLength); + this.startLengths = []; + this.state = { + bestMatches: Array.from({ + length: passwordLength + }, () => []), + guessesProduct: Array.from({ + length: passwordLength + }, () => []), + totalGuesses: Array.from({ + length: passwordLength + }, () => []) + }; + } + prepareCharacterCounts(password) { + const passwordLength = password.length; + this.characterCounts = new Int32Array(passwordLength + 1); + for (let index = 0;index < passwordLength; index += 1) { + const isPairedLowSurrogate = index > 0 && isSurrogatePairAt(password, index - 1); + this.characterCounts[index + 1] = this.characterCounts[index] + (isPairedLowSurrogate ? 0 : 1); + } + } + countTokenCharacters(i, j) { + const counts = this.characterCounts; + let count = counts[j + 1] - counts[i]; + if (counts[i + 1] === counts[i]) { + count += 1; + } + return count; + } + update(match, guesses, sequenceLength) { + const { + endIndex + } = this; + let pi = guesses; + if (sequenceLength > 1) { + const i = typeof match === "number" ? match : match.i; + pi *= this.state.guessesProduct[i - 1][sequenceLength - 1]; + } + let sequenceGuesses = this.factorials[sequenceLength] * pi; + if (!this.excludeAdditive) { + sequenceGuesses += this.additivePenalties[sequenceLength]; + } + const competingGuesses = this.state.totalGuesses[endIndex]; + const { + bestUpTo + } = this; + if (sequenceGuesses === Number.POSITIVE_INFINITY) { + const maxCompetingLength = Math.min(sequenceLength, competingGuesses.length - 1); + for (let length = 1;length <= maxCompetingLength; length += 1) { + if (competingGuesses[length] !== undefined) { + return; + } + } + } else if (bestUpTo[sequenceLength] <= sequenceGuesses) { + return; + } + for (let length = sequenceLength;length <= endIndex + 1 && bestUpTo[length] > sequenceGuesses; length += 1) { + bestUpTo[length] = sequenceGuesses; + } + competingGuesses[sequenceLength] = sequenceGuesses; + this.state.bestMatches[endIndex][sequenceLength] = match; + this.state.guessesProduct[endIndex][sequenceLength] = pi; + } + boundStart(i) { + const previousBestMatches = this.state.bestMatches[i - 1]; + const previousGuessesProduct = this.state.guessesProduct[i - 1]; + const lengths = []; + let bound = Number.POSITIVE_INFINITY; + for (let sequenceLength = 1;sequenceLength < previousBestMatches.length; sequenceLength += 1) { + const lastMatch = previousBestMatches[sequenceLength]; + if (lastMatch !== undefined && !isBruteforce(lastMatch)) { + lengths.push(sequenceLength); + bound = Math.min(bound, Math.log10(this.factorials[sequenceLength + 1] * previousGuessesProduct[sequenceLength])); + } + } + this.startBounds[i] = bound - this.characterCounts[i]; + this.startLengths[i] = lengths; + } + bruteforceUpdate(passwordCharIndex) { + this.update(0, this.bruteforceGuessesByLength[this.countTokenCharacters(0, passwordCharIndex)], 1); + const skipFrom = Math.log10(this.bestUpTo[2]) - this.characterCounts[passwordCharIndex + 1] + BOUND_TOLERANCE; + for (let i = 1;i <= passwordCharIndex; i += 1) { + if (this.startBounds[i] >= skipFrom) { + continue; + } + const lengths = this.startLengths[i]; + const guesses = this.bruteforceGuessesByLength[this.countTokenCharacters(i, passwordCharIndex)]; + for (const sequenceLength of lengths) { + this.update(i, guesses, sequenceLength + 1); + } + } + } + step(endIndex, matchesAtEnd) { + this.endIndex = endIndex; + this.bestUpTo.fill(Number.POSITIVE_INFINITY, 0, endIndex + 2); + matchesAtEnd.forEach((match) => { + const estimatedMatch = estimateGuesses(this.options, match, this.password); + const { + i, + guesses + } = estimatedMatch; + if (i > 0) { + const previousBestMatches = this.state.bestMatches[i - 1]; + for (let sequenceLength = 1;sequenceLength < previousBestMatches.length; sequenceLength += 1) { + if (previousBestMatches[sequenceLength] !== undefined) { + this.update(estimatedMatch, guesses, sequenceLength + 1); + } + } + } else { + this.update(estimatedMatch, guesses, 1); + } + }); + this.bruteforceUpdate(endIndex); + if (endIndex + 1 < this.password.length) { + this.boundStart(endIndex + 1); + } + } + getBestSequenceLength(passwordLength) { + let sequenceLength = 0; + let fewestGuesses = Number.POSITIVE_INFINITY; + const totalGuessesAtLastChar = this.state.totalGuesses[passwordLength - 1]; + if (totalGuessesAtLastChar) { + for (let candidateSequenceLength = 1;candidateSequenceLength < totalGuessesAtLastChar.length; candidateSequenceLength += 1) { + const candidateMetricMatch = totalGuessesAtLastChar[candidateSequenceLength]; + if (candidateMetricMatch !== undefined && candidateMetricMatch < fewestGuesses) { + sequenceLength = candidateSequenceLength; + fewestGuesses = candidateMetricMatch; + } + } + } + return sequenceLength; + } + unwind(passwordLength) { + const optimalMatchSequence = []; + let endIndex = passwordLength - 1; + let sequenceLength = this.getBestSequenceLength(passwordLength); + while (endIndex >= 0) { + const bestMatch = this.state.bestMatches[endIndex][sequenceLength]; + const match = typeof bestMatch === "number" ? estimateGuesses(this.options, this.makeBruteforceMatch(bestMatch, endIndex), this.password) : bestMatch; + optimalMatchSequence.unshift(match); + endIndex = match.i - 1; + sequenceLength -= 1; + } + return optimalMatchSequence; + } + mostGuessableMatchSequence(password, matches, excludeAdditive = false) { + this.password = password; + this.excludeAdditive = excludeAdditive; + const passwordLength = password.length; + const matchesByCoordinateJ = Array.from({ + length: passwordLength + }, () => []); + matches.forEach((match) => { + matchesByCoordinateJ[match.j].push(match); + }); + matchesByCoordinateJ.forEach((matchesAtJ) => matchesAtJ.sort((m1, m2) => m1.i - m2.i)); + this.prepare(password); + for (let endIndex = 0;endIndex < passwordLength; endIndex += 1) { + this.step(endIndex, matchesByCoordinateJ[endIndex]); + } + const optimalMatchSequence = this.unwind(passwordLength); + const optimalSequenceLength = optimalMatchSequence.length; + const guesses = this.getGuesses(password, optimalSequenceLength); + return { + password, + guesses, + guessesLog10: utils.log10(guesses), + sequence: optimalMatchSequence + }; + } + getGuesses(password, optimalSequenceLength) { + const passwordLength = password.length; + if (password.length === 0) { + return 1; + } else { + return this.state.totalGuesses[passwordLength - 1][optimalSequenceLength]; + } + } +} + +// node_modules/@zxcvbn-ts/core/dist/matcher/repeat/matching.mjs +class MatchRepeat extends MatcherBaseClass { + constructor(options) { + super(options); + this.scoring = new Scoring(options); + } + match(matchOptions) { + const { + password + } = matchOptions; + const memoizedResults = new Map; + const matches = []; + let lastIndex = 0; + while (lastIndex < password.length) { + const greedyMatch = this.getGreedyMatch(password, lastIndex); + const lazyMatch = this.getLazyMatch(password, lastIndex); + if (greedyMatch == null) { + break; + } + const { + match, + baseToken + } = this.setMatchToken(greedyMatch, lazyMatch); + if (match) { + const j = match.index + match[0].length - 1; + const baseGuesses = this.getBaseGuesses(baseToken, matchOptions, memoizedResults); + matches.push(this.normalizeMatch(baseToken, j, match, baseGuesses)); + lastIndex = j + 1; + } + } + const hasPromises = matches.some((match) => { + return match instanceof Promise; + }); + if (hasPromises) { + return Promise.all(matches); + } + return matches; + } + normalizeMatch(baseToken, j, match, baseGuesses) { + const baseMatch = { + pattern: "repeat", + i: match.index, + j, + token: match[0], + baseToken, + baseGuesses: 0, + repeatCount: match[0].length / baseToken.length + }; + if (baseGuesses instanceof Promise) { + return baseGuesses.then((resolvedBaseGuesses) => { + return { + ...baseMatch, + baseGuesses: resolvedBaseGuesses + }; + }); + } + return { + ...baseMatch, + baseGuesses + }; + } + getGreedyMatch(password, lastIndex) { + MatchRepeat.GREEDY.lastIndex = lastIndex; + return MatchRepeat.GREEDY.exec(password); + } + getLazyMatch(password, lastIndex) { + MatchRepeat.LAZY.lastIndex = lastIndex; + return MatchRepeat.LAZY.exec(password); + } + setMatchToken(greedyMatch, lazyMatch) { + let match; + let baseToken = ""; + if (lazyMatch && greedyMatch[0].length > lazyMatch[0].length) { + match = greedyMatch; + const temp = MatchRepeat.LAZY_ANCHORED.exec(match[0]); + if (temp) { + baseToken = temp[1]; + } + } else { + match = lazyMatch; + if (match) { + baseToken = match[1]; + } + } + return { + match, + baseToken + }; + } + getBaseGuesses(baseToken, { + omniMatch, + userInputsOptions + }, memoizedResults) { + if (memoizedResults.has(baseToken)) { + return memoizedResults.get(baseToken); + } + const matches = omniMatch.match(baseToken, userInputsOptions); + let result; + if (matches instanceof Promise) { + result = matches.then((resolvedMatches) => { + const baseAnalysis = this.scoring.mostGuessableMatchSequence(baseToken, resolvedMatches); + return baseAnalysis.guesses; + }); + } else { + const baseAnalysis = this.scoring.mostGuessableMatchSequence(baseToken, matches); + result = baseAnalysis.guesses; + } + memoizedResults.set(baseToken, result); + return result; + } +} +MatchRepeat.GREEDY = /(.+)\1+/gu; +MatchRepeat.LAZY = /(.+?)\1+/gu; +MatchRepeat.LAZY_ANCHORED = /^(.+?)\1+$/u; + +// node_modules/@zxcvbn-ts/core/dist/matcher/sequence/matching.mjs +class MatchSequence extends MatcherBaseClass { + constructor() { + super(...arguments); + this.MAX_DELTA = 5; + } + match({ + password + }) { + const result = []; + const characters = Array.from(password); + if (characters.length <= 1) { + return []; + } + const unitOffsets = []; + let unitOffset = 0; + characters.forEach((character) => { + unitOffsets.push(unitOffset); + unitOffset += character.length; + }); + const lastUnitIndex = (charIndex) => unitOffsets[charIndex] + characters[charIndex].length - 1; + let i = 0; + let lastDelta = null; + const charactersLength = characters.length; + for (let k = 1;k < charactersLength; k += 1) { + const delta = characters[k].codePointAt(0) - characters[k - 1].codePointAt(0); + if (lastDelta === null) { + lastDelta = delta; + } + if (delta !== lastDelta) { + const j = k - 1; + this.update({ + i: unitOffsets[i], + j: lastUnitIndex(j), + characterCount: j - i + 1, + delta: lastDelta, + password, + result + }); + i = j; + lastDelta = delta; + } + } + this.update({ + i: unitOffsets[i], + j: lastUnitIndex(charactersLength - 1), + characterCount: charactersLength - i, + delta: lastDelta, + password, + result + }); + return result; + } + update({ + i, + j, + characterCount, + delta, + password, + result + }) { + if (characterCount > 2 || Math.abs(delta) === 1) { + const absoluteDelta = Math.abs(delta); + if (absoluteDelta > 0 && absoluteDelta <= this.MAX_DELTA) { + const token = password.slice(i, j + 1); + const { + sequenceName, + sequenceSpace + } = this.getSequence(token); + return result.push({ + pattern: "sequence", + i, + j, + token, + sequenceName, + sequenceSpace, + ascending: delta > 0 + }); + } + } + return null; + } + getSequence(token) { + let sequenceName = "unicode"; + let sequenceSpace = 26; + if (ALL_LOWER.test(token)) { + sequenceName = "lower"; + sequenceSpace = 26; + } else if (ALL_UPPER.test(token)) { + sequenceName = "upper"; + sequenceSpace = 26; + } else if (ALL_DIGIT.test(token)) { + sequenceName = "digits"; + sequenceSpace = 10; + } + return { + sequenceName, + sequenceSpace + }; + } +} + +// node_modules/@zxcvbn-ts/core/dist/matcher/spatial/matching.mjs +class MatchSpatial extends MatcherBaseClass { + match({ + password + }) { + const matches = []; + Object.keys(this.options.graphs).forEach((graphName) => { + const graph = this.options.graphs[graphName]; + extend(matches, this.helper(password, graph, graphName)); + }); + return matches; + } + checkIfShifted(graphName, password, index) { + if (!graphName.includes("keypad") && MatchSpatial.SHIFTED_RX.test(password.charAt(index))) { + return 1; + } + return 0; + } + helper(password, graph, graphName) { + let shiftedCount; + const matches = []; + let i = 0; + const passwordLength = password.length; + while (i < passwordLength - 1) { + let j = i + 1; + let lastDirection = null; + let turns = 0; + shiftedCount = this.checkIfShifted(graphName, password, i); + let prevCharAdjacents = graph[password.charAt(i)] || []; + while (true) { + let found = false; + let curDirection = -1; + if (j < passwordLength) { + const curChar = password.charAt(j); + const adjacentsLength = prevCharAdjacents.length; + for (let k = 0;k < adjacentsLength; k += 1) { + const adjacent = prevCharAdjacents[k]; + curDirection += 1; + if (adjacent) { + const adjacentIndex = adjacent.indexOf(curChar); + if (adjacentIndex !== -1) { + found = true; + if (adjacentIndex === 1) { + shiftedCount += 1; + } + const foundDirection = curDirection; + if (lastDirection !== foundDirection) { + turns += 1; + lastDirection = foundDirection; + } + break; + } + } + } + } + if (found) { + prevCharAdjacents = graph[password.charAt(j)] || []; + j += 1; + } else { + if (j - i > 2) { + matches.push({ + pattern: "spatial", + i, + j: j - 1, + token: password.slice(i, j), + graph: graphName, + turns, + shiftedCount + }); + } + i = j; + break; + } + } + } + return matches; + } +} +MatchSpatial.SHIFTED_RX = /[~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?]/; + +// node_modules/@zxcvbn-ts/core/dist/matcher/separator/matching.mjs +var separatorChars = new Set(SEPARATOR_CHARS); + +class MatchSeparator extends MatcherBaseClass { + static getMostUsedSeparatorChar(password) { + const counts = new Map; + for (const char of password) { + if (separatorChars.has(char)) { + counts.set(char, (counts.get(char) || 0) + 1); + } + } + let maxChar; + let maxCount = 0; + for (const [char, count] of counts.entries()) { + if (count > maxCount) { + maxCount = count; + maxChar = char; + } + } + if (maxCount < 2) { + return; + } + return maxChar; + } + static getSeparatorRegex(separator) { + const escaped = separator.replace(ESCAPE_REGEX, "\\$&"); + return new RegExp(`([^${escaped} +])(${escaped})(?!${escaped})`, "g"); + } + match({ + password + }) { + const result = []; + if (password.length === 0) + return result; + const mostUsedSpecial = MatchSeparator.getMostUsedSeparatorChar(password); + if (mostUsedSpecial === undefined) + return result; + const isSeparator = MatchSeparator.getSeparatorRegex(mostUsedSpecial); + for (const match of password.matchAll(isSeparator)) { + const i = match.index + 1; + result.push({ + pattern: "separator", + token: mostUsedSpecial, + i, + j: i + }); + } + return result; + } +} + +// node_modules/@zxcvbn-ts/core/dist/matcher/wordSequence/matching.mjs +var isSeparatorRun = (text) => { + for (const char of text) { + if (!WORD_SEQUENCE_SEPARATOR_CHARS.has(char)) { + return false; + } + } + return true; +}; + +class MatchWordSequence extends MatcherBaseClass { + match(matchOptions) { + const { + password, + matches = [] + } = matchOptions; + const dictionaryMatches = matches.filter((match) => match.pattern === "dictionary" && this.options.isWordSequence(match.dictionaryName)); + const filteredDictionaryMatches = this.filterDictionaryMatches(dictionaryMatches); + return this.findWordSequences(filteredDictionaryMatches, password); + } + filterDictionaryMatches(matches) { + return matches.sort((a, b) => { + if (a.i !== b.i) + return a.i - b.i; + if (a.j !== b.j) + return a.j - b.j; + if (a.reversed !== b.reversed) + return a.reversed ? 1 : -1; + if (a.l33t !== b.l33t) + return a.l33t ? 1 : -1; + return a.rank - b.rank; + }).reduce((acc, match) => { + const last = acc[acc.length - 1]; + if (!last || match.i > last.j) { + acc.push(match); + } + return acc; + }, []); + } + findWordSequences(wordMatches, password) { + const sequences = []; + if (wordMatches.length === 0) { + return sequences; + } + for (let startIdx = 0;startIdx < wordMatches.length; startIdx += 1) { + const sequencesFromStart = this.findSequencesFromStart(wordMatches, startIdx, password); + sequences.push(...sequencesFromStart); + } + return sequences; + } + findSequencesFromStart(sortedMatches, startIdx, password) { + const sequences = []; + const startMatch = sortedMatches[startIdx]; + const currentSequence = [startMatch]; + for (let nextIdx = startIdx + 1;nextIdx < sortedMatches.length; nextIdx += 1) { + const nextMatch = sortedMatches[nextIdx]; + if (!this.isValidWordSequence(currentSequence, nextMatch, password)) { + break; + } + const lastWord = currentSequence[currentSequence.length - 1]; + if (currentSequence.length > 1 && nextMatch.i - lastWord.j > 2) { + sequences.push(this.createWordSequenceMatch(currentSequence, password)); + } + currentSequence.push(nextMatch); + } + if (currentSequence.length > 1) { + sequences.push(this.createWordSequenceMatch(currentSequence, password)); + } + return sequences; + } + isValidWordSequence(currentSequence, nextMatch, password) { + const lastWord = currentSequence[currentSequence.length - 1]; + const textBetween = password.slice(lastWord.j + 1, nextMatch.i); + const hasValidSeparator = isSeparatorRun(textBetween); + const isCamelCase = textBetween.length === 1 && textBetween === textBetween.toUpperCase() && textBetween !== textBetween.toLowerCase(); + return hasValidSeparator || isCamelCase; + } + createWordSequenceMatch(sequence, password) { + const firstMatch = sequence[0]; + const lastMatch = sequence[sequence.length - 1]; + const words = sequence.map((match) => match.matchedWord); + const separators = sequence.slice(1).map((match, index) => password.slice(sequence[index].j + 1, match.i)); + const ranks = sequence.map((match) => match.rank); + const ascending = ranks.every((rank, i) => i === 0 || rank >= ranks[i - 1]); + const dictionaryNames = sequence.map((match) => match.dictionaryName); + const dictionaryName = this.getMostCommon(dictionaryNames) || firstMatch.dictionaryName; + return { + pattern: "wordSequence", + i: firstMatch.i, + j: lastMatch.j, + token: password.slice(firstMatch.i, lastMatch.j + 1), + words, + wordCount: words.length, + dictionaryName, + ascending, + separators + }; + } + getMostCommon(array) { + if (array.length === 0) + return null; + const counts = new Map; + let maxCount = 0; + let mostCommon = null; + array.forEach((item) => { + const count = (counts.get(item) || 0) + 1; + counts.set(item, count); + if (count > maxCount) { + maxCount = count; + mostCommon = item; + } + }); + return mostCommon; + } +} + +// node_modules/@zxcvbn-ts/core/dist/matcher/dictionary/WordIndex.mjs +var INSERTION_SORT_SIZE = 24; +var flatten = (lists) => { + let count = 0; + lists.forEach(({ + words + }) => { + count += words.length; + }); + const entries = { + words: new Array(count), + dictionaries: new Uint16Array(count), + ranks: new Int32Array(count) + }; + let entry = 0; + lists.forEach(({ + words + }, dictionary) => { + for (let index = 0;index < words.length; index += 1) { + entries.words[entry] = String(words[index]); + entries.dictionaries[entry] = dictionary; + entries.ranks[entry] = index + 1; + entry += 1; + } + }); + return entries; +}; +var getCharacterIds = (words) => { + const ids = new Uint32Array(65536); + words.forEach((word) => { + for (let index = 0;index < word.length; index += 1) { + ids[word.charCodeAt(index)] = 1; + } + }); + let count = 0; + for (let code = 0;code < ids.length; code += 1) { + if (ids[code] !== 0) { + count += 1; + ids[code] = count; + } + } + return { + ids, + count + }; +}; + +class EntrySorter { + constructor(words) { + this.words = words; + this.keys = new Uint16Array(0); + this.ids = new Uint32Array(0); + this.idCount = 0; + this.countsByDepth = []; + this.idsByDepth = []; + this.order = new Int32Array(words.length); + for (let index = 0;index < words.length; index += 1) { + this.order[index] = index; + } + this.buffer = new Int32Array(words.length); + } + sort() { + if (this.words.length >= INSERTION_SORT_SIZE) { + const { + ids, + count + } = getCharacterIds(this.words); + this.ids = ids; + this.idCount = count; + this.keys = count < 65536 ? new Uint16Array(this.words.length) : new Uint32Array(this.words.length); + } + this.sortRange(0, this.words.length, 0); + return this.order; + } + getId(word, depth) { + return depth < word.length ? this.ids[word.charCodeAt(depth)] : 0; + } + getState(depth) { + if (!this.countsByDepth[depth]) { + this.countsByDepth[depth] = new Int32Array(this.idCount + 1); + this.idsByDepth[depth] = new Int32Array(this.idCount + 1); + } + return { + counts: this.countsByDepth[depth], + idsInRange: this.idsByDepth[depth] + }; + } + sortRange(start, end, depth) { + if (end - start < INSERTION_SORT_SIZE) { + this.insertionSort(start, end, depth); + return; + } + const { + order, + buffer, + keys, + words + } = this; + const { + counts, + idsInRange + } = this.getState(depth); + let idCount = 0; + for (let index = start;index < end; index += 1) { + const id = this.getId(words[order[index]], depth); + keys[index] = id; + if (counts[id] === 0) { + idsInRange[idCount] = id; + idCount += 1; + } + counts[id] += 1; + } + const sortedIds = idsInRange.subarray(0, idCount).sort(); + let bucketStart = start; + sortedIds.forEach((id) => { + const count = counts[id]; + counts[id] = bucketStart; + bucketStart += count; + }); + for (let index = start;index < end; index += 1) { + const id = keys[index]; + buffer[counts[id]] = order[index]; + counts[id] += 1; + } + order.set(buffer.subarray(start, end), start); + bucketStart = start; + sortedIds.forEach((id) => { + const bucketEnd = counts[id]; + if (id !== 0 && bucketEnd - bucketStart > 1) { + this.sortRange(bucketStart, bucketEnd, depth + 1); + } + bucketStart = bucketEnd; + counts[id] = 0; + }); + } + compare(first, second, depth) { + let index = depth; + while (index < first.length && index < second.length && first.charCodeAt(index) === second.charCodeAt(index)) { + index += 1; + } + const firstCode = index < first.length ? first.charCodeAt(index) : -1; + const secondCode = index < second.length ? second.charCodeAt(index) : -1; + return firstCode - secondCode; + } + insertionSort(start, end, depth) { + const { + order, + words + } = this; + for (let index = start + 1;index < end; index += 1) { + const entry = order[index]; + let target = index; + while (target > start && this.compare(words[order[target - 1]], words[entry], depth) > 0) { + order[target] = order[target - 1]; + target -= 1; + } + order[target] = entry; + } + } +} + +class WordIndex { + constructor(lists = []) { + this.findRange = new Int32Array(2); + this.firstCharacters = new Map; + this.levenshteinDictionaries = []; + this.listSizes = lists.map(({ + words: words2 + }) => words2.length); + this.dictionaryNames = lists.map(({ + name + }) => name); + const entries = flatten(lists); + const order = new EntrySorter(entries.words).sort(); + const words = []; + const hitStart = new Int32Array(order.length + 1); + const hitDictionary = lists.length <= 256 ? new Uint8Array(order.length) : new Uint16Array(order.length); + const hitRank = new Int32Array(order.length); + let hitCount = 0; + let previousWord; + order.forEach((entry) => { + const word = entries.words[entry]; + const dictionary = entries.dictionaries[entry]; + if (word !== previousWord) { + hitStart[words.length] = hitCount; + words.push(word); + previousWord = word; + } else if (hitDictionary[hitCount - 1] === dictionary) { + hitRank[hitCount - 1] = entries.ranks[entry]; + return; + } + hitDictionary[hitCount] = dictionary; + hitRank[hitCount] = entries.ranks[entry]; + hitCount += 1; + }); + hitStart[words.length] = hitCount; + this.words = words; + this.hitStart = hitStart.slice(0, words.length + 1); + this.hitDictionary = hitDictionary.slice(0, hitCount); + this.hitRank = hitRank.slice(0, hitCount); + this.firstCharacterStarts = this.getFirstCharacterStarts(); + } + getFirstCharacterStarts() { + const starts = []; + this.words.forEach((word, index) => { + if (word.length === 0) { + return; + } + const code = word.charCodeAt(0); + if (!this.firstCharacters.has(code)) { + this.firstCharacters.set(code, starts.length); + starts.push(index); + } + }); + starts.push(this.words.length); + return Int32Array.from(starts); + } + findFirst(start, end, depth, code) { + let low = start; + let high = end; + while (low < high) { + const middle = low + high >>> 1; + const word = this.words[middle]; + const middleCode = depth < word.length ? word.charCodeAt(depth) : -1; + if (middleCode < code) { + low = middle + 1; + } else { + high = middle; + } + } + return low; + } + narrow(range, depth, code) { + if (depth === 0 && range[0] === 0 && range[1] === this.words.length) { + const position = this.firstCharacters.get(code); + if (position === undefined) { + range[0] = range[1]; + } else { + range[0] = this.firstCharacterStarts[position]; + range[1] = this.firstCharacterStarts[position + 1]; + } + return; + } + const first = this.findFirst(range[0], range[1], depth, code); + range[1] = this.findFirst(first, range[1], depth, code + 1); + range[0] = first; + } + find(word) { + const range = this.findRange; + range[0] = 0; + range[1] = this.words.length; + for (let depth = 0;depth < word.length && range[0] < range[1]; depth += 1) { + this.narrow(range, depth, word.charCodeAt(depth)); + } + return range[0] < range[1] && this.words[range[0]].length === word.length ? range[0] : -1; + } + getLevenshteinDictionary(dictionary) { + let levenshteinDictionary = this.levenshteinDictionaries[dictionary]; + if (!levenshteinDictionary) { + levenshteinDictionary = { + getEntries: () => this.getEntries(dictionary), + getRank: (entry) => this.getRank(this.find(entry), dictionary) + }; + this.levenshteinDictionaries[dictionary] = levenshteinDictionary; + } + return levenshteinDictionary; + } + getWordsByRank(dictionary) { + if (!this.wordsByRank) { + const wordsByRank = this.listSizes.map((size) => new Int32Array(size)); + for (let wordIndex = 0;wordIndex < this.words.length; wordIndex += 1) { + for (let hit = this.hitStart[wordIndex];hit < this.hitStart[wordIndex + 1]; hit += 1) { + wordsByRank[this.hitDictionary[hit]][this.hitRank[hit] - 1] = wordIndex + 1; + } + } + this.wordsByRank = wordsByRank; + } + return this.wordsByRank[dictionary]; + } + getEntries(dictionary) { + const entries = []; + const ranks = []; + this.getWordsByRank(dictionary).forEach((word, index) => { + if (word > 0) { + entries.push(this.words[word - 1]); + ranks.push(index + 1); + } + }); + return { + entries, + ranks + }; + } + getRank(wordIndex, dictionary) { + if (wordIndex < 0) { + return; + } + for (let hit = this.hitStart[wordIndex];hit < this.hitStart[wordIndex + 1]; hit += 1) { + if (this.hitDictionary[hit] === dictionary) { + return this.hitRank[hit]; + } + } + return; + } +} + +// node_modules/@zxcvbn-ts/core/dist/Matching.mjs +var withWordIndex = (userInputsOptions) => { + if (!userInputsOptions || userInputsOptions.wordIndex) { + return userInputsOptions; + } + const words = Object.entries(userInputsOptions.rankedDictionary).sort((first, second) => first[1] - second[1]).map(([word]) => word); + return { + ...userInputsOptions, + wordIndex: new WordIndex([{ + name: "userInputs", + words + }]) + }; +}; + +class Matching { + constructor(options) { + this.options = options; + this.matchers = {}; + this.matchers = { + date: new MatchDate(this.options), + dictionary: new MatchDictionary(this.options), + dictionaryL33t: new MatchL33t(this.options), + dictionaryReverse: new MatchReverse(this.options), + regex: new MatchRegex(this.options), + repeat: new MatchRepeat(this.options), + sequence: new MatchSequence(this.options), + spatial: new MatchSpatial(this.options), + separator: new MatchSeparator(this.options), + wordSequence: new MatchWordSequence(this.options) + }; + Object.entries(this.options.matchers).forEach(([key, Matcher]) => { + this.matchers[key] = new Matcher.Matching(this.options); + }); + } + match(password, givenUserInputsOptions) { + const userInputsOptions = withWordIndex(givenUserInputsOptions); + const matches = []; + const promises = []; + const { + wordSequence, + ...otherMatchers + } = this.matchers; + const add = (name, result) => { + extend(matches, name in this.options.matchers ? result.map((match) => ({ + ...match + })) : result); + }; + Object.entries(otherMatchers).forEach(([name, matcher]) => { + const result = matcher.match({ + password, + omniMatch: this, + userInputsOptions + }); + if (result instanceof Promise) { + promises.push(result.then((response) => { + add(name, response); + return response; + })); + } else { + add(name, result); + } + }); + const runWordSequence = () => { + if (!wordSequence) { + return matches; + } + const result = wordSequence.match({ + password, + omniMatch: this, + userInputsOptions, + matches: matches.slice() + }); + if (result instanceof Promise) { + return result.then((response) => { + add("wordSequence", response); + return matches; + }); + } + add("wordSequence", result); + return matches; + }; + if (promises.length > 0) { + return Promise.all(promises).then(runWordSequence); + } + return runWordSequence(); + } +} + +// node_modules/@zxcvbn-ts/core/dist/TimeEstimates.mjs +var SECOND = 1; +var MINUTE = SECOND * 60; +var HOUR = MINUTE * 60; +var DAY = HOUR * 24; +var MONTH = DAY * 31; +var YEAR = MONTH * 12; +var CENTURY = YEAR * 100; +var times = { + second: SECOND, + minute: MINUTE, + hour: HOUR, + day: DAY, + month: MONTH, + year: YEAR, + century: CENTURY +}; +var timeEstimationValuesDefaults = { + scoring: { + 0: 1000, + 1: 1e6, + 2: 1e8, + 3: 10000000000 + }, + attackTime: { + onlineThrottlingXPerHour: 100, + onlineNoThrottlingXPerSecond: 10, + offlineSlowHashingXPerSecond: 1e4, + offlineFastHashingXPerSecond: 10000000000 + } +}; + +class TimeEstimates { + constructor(options) { + this.options = options; + } + estimateAttackTimes(guesses) { + const crackTimesSeconds = this.calculateCrackTimesSeconds(guesses); + const crackTimes = {}; + Object.keys(crackTimesSeconds).forEach((crackTime) => { + const usedScenario = crackTime; + const seconds = crackTimesSeconds[usedScenario]; + const { + base, + displayStr + } = this.displayTime(seconds); + crackTimes[usedScenario] = { + base, + seconds, + display: this.translate(displayStr, base) + }; + }); + return { + crackTimes, + score: this.guessesToScore(guesses) + }; + } + calculateCrackTimesSeconds(guesses) { + const attackTimesOptions = this.options.timeEstimationValues.attackTime; + return { + onlineThrottlingXPerHour: guesses / (attackTimesOptions.onlineThrottlingXPerHour / 3600), + onlineNoThrottlingXPerSecond: guesses / attackTimesOptions.onlineNoThrottlingXPerSecond, + offlineSlowHashingXPerSecond: guesses / attackTimesOptions.offlineSlowHashingXPerSecond, + offlineFastHashingXPerSecond: guesses / attackTimesOptions.offlineFastHashingXPerSecond + }; + } + guessesToScore(guesses) { + const scoringOptions = this.options.timeEstimationValues.scoring; + const DELTA = 5; + if (guesses < scoringOptions[0] + DELTA) { + return 0; + } + if (guesses < scoringOptions[1] + DELTA) { + return 1; + } + if (guesses < scoringOptions[2] + DELTA) { + return 2; + } + if (guesses < scoringOptions[3] + DELTA) { + return 3; + } + return 4; + } + displayTime(seconds) { + let displayStr = "centuries"; + let base = null; + const timeKeys = Object.keys(times); + const foundIndex = timeKeys.findIndex((time) => seconds < times[time]); + if (foundIndex > -1) { + displayStr = timeKeys[foundIndex - 1]; + if (foundIndex !== 0) { + base = Math.round(seconds / times[displayStr]); + } else { + displayStr = "ltSecond"; + } + } + return { + base, + displayStr + }; + } + translate(displayStr, value) { + let key = displayStr; + if (value !== null && value !== 1) { + key += "s"; + } + const { + timeEstimation + } = this.options.translations; + const translation = timeEstimation[key]; + if (typeof translation === "function") { + return translation(value); + } + return translation.replace("{base}", `${value}`); + } +} + +// node_modules/@zxcvbn-ts/core/dist/matcher/bruteforce/feedback.mjs +var bruteforceMatcher2 = () => { + return null; +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/date/feedback.mjs +var dateMatcher2 = (options) => { + return { + warning: options.translations.warnings.dates, + suggestions: [options.translations.suggestions.dates] + }; +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/dictionary/feedback.mjs +var getDictionaryWarningPassword = (options, match, isSoleMatch) => { + let warning = null; + if (isSoleMatch && !match.l33t && !match.reversed) { + if (match.rank <= 10) { + warning = options.translations.warnings.topTen; + } else if (match.rank <= 100) { + warning = options.translations.warnings.topHundred; + } else { + warning = options.translations.warnings.common; + } + } else if (match.guessesLog10 <= 4) { + warning = options.translations.warnings.similarToCommon; + } + return warning; +}; +var getDictionaryWarningWikipedia = (options, match, isSoleMatch) => { + let warning = null; + if (isSoleMatch) { + warning = options.translations.warnings.wordByItself; + } + return warning; +}; +var getDictionaryWarningNames = (options, match, isSoleMatch) => { + if (isSoleMatch) { + return options.translations.warnings.namesByThemselves; + } + return options.translations.warnings.commonNames; +}; +var getDictionaryWarning = (options, match, isSoleMatch) => { + const dictName = match.dictionaryName; + const isAName = dictName.toLowerCase().includes("lastnames") || dictName.toLowerCase().includes("firstnames") || dictName.toLowerCase().includes("names"); + if (dictName.includes("passwords")) { + return getDictionaryWarningPassword(options, match, isSoleMatch); + } + if (dictName.includes("wikipedia")) { + return getDictionaryWarningWikipedia(options, match, isSoleMatch); + } + if (isAName) { + return getDictionaryWarningNames(options, match, isSoleMatch); + } + if (dictName.includes("userInputs")) { + return options.translations.warnings.userInputs; + } + return null; +}; +var dictionaryMatcher2 = (options, match, isSoleMatch) => { + const warning = getDictionaryWarning(options, match, isSoleMatch); + const suggestions = []; + const word = match.token; + if (word.match(START_UPPER)) { + suggestions.push(options.translations.suggestions.capitalization); + } else if (word.match(ALL_UPPER_INVERTED) && word.toLowerCase() !== word) { + suggestions.push(options.translations.suggestions.allUppercase); + } + if (match.reversed && countCharacters(match.token) >= 4) { + suggestions.push(options.translations.suggestions.reverseWords); + } + if (match.l33t) { + suggestions.push(options.translations.suggestions.l33t); + } + return { + warning, + suggestions + }; +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/regex/feedback.mjs +var regexMatcher2 = (options, match) => { + if (match.regexName === "recentYear") { + return { + warning: options.translations.warnings.recentYears, + suggestions: [options.translations.suggestions.recentYears, options.translations.suggestions.associatedYears] + }; + } + return { + warning: null, + suggestions: [] + }; +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/repeat/feedback.mjs +var repeatMatcher2 = (options, match) => { + let warning = options.translations.warnings.extendedRepeat; + if (countCharacters(match.baseToken) === 1) { + warning = options.translations.warnings.simpleRepeat; + } + return { + warning, + suggestions: [options.translations.suggestions.repeated] + }; +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/sequence/feedback.mjs +var sequenceMatcher2 = (options) => { + return { + warning: options.translations.warnings.sequences, + suggestions: [options.translations.suggestions.sequences] + }; +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/spatial/feedback.mjs +var spatialMatcher2 = (options, match) => { + let warning = options.translations.warnings.keyPattern; + if (match.turns === 1) { + warning = options.translations.warnings.straightRow; + } + return { + warning, + suggestions: [options.translations.suggestions.longerKeyboardPattern] + }; +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/separator/feedback.mjs +var separatorMatcher2 = () => { + return null; +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/wordSequence/feedback.mjs +var wordSequenceMatcher2 = (options, match) => { + if (match.pattern !== "wordSequence") { + return null; + } + if (match.dictionaryName === "userInputs") { + return { + warning: options.translations.warnings.userInputs, + suggestions: [options.translations.suggestions.useWords] + }; + } + let warning = null; + const suggestions = []; + if (match.wordCount >= 3) { + warning = options.translations.warnings.sequences; + } + if (match.ascending) { + suggestions.push(options.translations.suggestions.sequences); + } else { + suggestions.push(options.translations.suggestions.anotherWord); + } + if (match.wordCount > 2) { + suggestions.push(options.translations.suggestions.useWords); + } + return { + warning, + suggestions + }; +}; + +// node_modules/@zxcvbn-ts/core/dist/Feedback.mjs +var createFeedback = (suggestions) => ({ + warning: null, + suggestions: suggestions !== null && suggestions !== undefined ? suggestions : [] +}); + +class Feedback { + constructor(options) { + this.options = options; + this.matchers = {}; + this.matchers = { + bruteforce: bruteforceMatcher2, + date: dateMatcher2, + dictionary: dictionaryMatcher2, + regex: regexMatcher2, + repeat: repeatMatcher2, + sequence: sequenceMatcher2, + spatial: spatialMatcher2, + separator: separatorMatcher2, + wordSequence: wordSequenceMatcher2 + }; + Object.entries(this.options.matchers).forEach(([key, matcher]) => { + if (matcher.feedback) { + this.matchers[key] = matcher.feedback; + } + }); + } + getFeedback(score, sequence) { + if (sequence.length === 0) { + return createFeedback([this.options.translations.suggestions.useWords, this.options.translations.suggestions.noNeed]); + } + if (score > 2) { + return createFeedback(); + } + const extraFeedback = this.options.translations.suggestions.anotherWord; + const longestMatch = this.getLongestMatch(sequence); + let feedback = this.getMatchFeedback(longestMatch, sequence.length === 1); + if (feedback !== null && feedback !== undefined) { + feedback.suggestions.unshift(extraFeedback); + } else { + feedback = createFeedback([extraFeedback]); + } + return feedback; + } + getLongestMatch(sequence) { + let longestMatch = sequence[0]; + let longestLength = countCharacters(longestMatch.token); + for (let i = 1;i < sequence.length; i += 1) { + const match = sequence[i]; + const length = countCharacters(match.token); + if (length > longestLength) { + longestMatch = match; + longestLength = length; + } + } + return longestMatch; + } + getMatchFeedback(match, isSoleMatch) { + if (this.matchers[match.pattern]) { + return this.matchers[match.pattern](this.options, match, isSoleMatch); + } + return createFeedback(); + } +} + +// node_modules/@zxcvbn-ts/core/dist/data/l33tTable.mjs +var l33tTable = { + a: ["4", "@"], + b: ["8"], + c: ["(", "{", "[", "<"], + d: ["6", "|)"], + e: ["3"], + f: ["#"], + g: ["6", "9", "&"], + h: ["#", "|-|"], + i: ["1", "!", "|"], + k: ["<", "|<"], + l: ["!", "1", "|", "7"], + m: ["^^", "nn", "2n", "/\\\\/\\\\"], + n: ["//"], + o: ["0", "()"], + q: ["9"], + u: ["|_|"], + s: ["$", "5"], + t: ["+", "7"], + v: ["<", ">", "/"], + w: ["^/", "uu", "vv", "2u", "2v", "\\\\/\\\\/"], + x: ["%", "><"], + z: ["2"] +}; + +// node_modules/@zxcvbn-ts/core/dist/data/translationKeys.mjs +var translationKeys = { + warnings: { + straightRow: "straightRow", + keyPattern: "keyPattern", + simpleRepeat: "simpleRepeat", + extendedRepeat: "extendedRepeat", + sequences: "sequences", + recentYears: "recentYears", + dates: "dates", + topTen: "topTen", + topHundred: "topHundred", + common: "common", + similarToCommon: "similarToCommon", + wordByItself: "wordByItself", + namesByThemselves: "namesByThemselves", + commonNames: "commonNames", + userInputs: "userInputs", + pwned: "pwned" + }, + suggestions: { + l33t: "l33t", + reverseWords: "reverseWords", + allUppercase: "allUppercase", + capitalization: "capitalization", + dates: "dates", + recentYears: "recentYears", + associatedYears: "associatedYears", + sequences: "sequences", + repeated: "repeated", + longerKeyboardPattern: "longerKeyboardPattern", + anotherWord: "anotherWord", + useWords: "useWords", + noNeed: "noNeed", + pwned: "pwned" + }, + timeEstimation: { + ltSecond: "ltSecond", + second: "second", + seconds: "seconds", + minute: "minute", + minutes: "minutes", + hour: "hour", + hours: "hours", + day: "day", + days: "days", + month: "month", + months: "months", + year: "year", + years: "years", + centuries: "centuries" + } +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/dictionary/variants/matching/unmunger/TrieNode.mjs +class TrieNode { + constructor(parents = []) { + this.parents = parents; + this.children = new Map; + } + addSub(key, ...subs) { + const firstChar = key.charAt(0); + if (!this.children.has(firstChar)) { + this.children.set(firstChar, new TrieNode([...this.parents, firstChar])); + } + let cur = this.children.get(firstChar); + for (let i = 1;i < key.length; i += 1) { + const c = key.charAt(i); + if (!cur.hasChild(c)) { + cur.addChild(c); + } + cur = cur.getChild(c); + } + cur.subs = (cur.subs || []).concat(subs); + return this; + } + getChild(child) { + return this.children.get(child); + } + isTerminal() { + return !!this.subs; + } + addChild(child) { + if (!this.hasChild(child)) { + this.children.set(child, new TrieNode([...this.parents, child])); + } + } + hasChild(child) { + return this.children.has(child); + } +} + +// node_modules/@zxcvbn-ts/core/dist/matcher/dictionary/wordLists.mjs +var buildRankedDictionary = (list) => { + const result = {}; + list.forEach((word, index) => { + result[word] = index + 1; + }); + return result; +}; +var getMaxWordSize = (list) => { + return list.reduce((max, word) => Math.max(max, word.toString().length), 0); +}; +var sanitizeUserInputs = (list) => { + const sanitizedInputs = []; + list.forEach((input) => { + const inputType = typeof input; + if (inputType === "string" || inputType === "number" || inputType === "boolean") { + sanitizedInputs.push(toLowerCase(input.toString())); + } + }); + return sanitizedInputs; +}; +var createUserInputsOptions = (dictionary) => { + const sanitizedInputs = dictionary ? sanitizeUserInputs(dictionary) : []; + const maxWordSize = dictionary ? getMaxWordSize(dictionary) : 0; + let rankedDictionary; + return { + wordIndex: new WordIndex([{ + name: "userInputs", + words: sanitizedInputs + }]), + get rankedDictionary() { + rankedDictionary !== null && rankedDictionary !== undefined || (rankedDictionary = buildRankedDictionary(sanitizedInputs)); + return rankedDictionary; + }, + rankedDictionaryMaxWordSize: maxWordSize + }; +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/dictionary/variants/matching/unmunger/l33tTableToTrieNode.mjs +var l33tTableToTrieNode = (l33tTable2, triNode) => { + Object.entries(l33tTable2).forEach(([letter, substitutions]) => { + substitutions.forEach((substitution) => { + triNode.addSub(substitution, letter); + }); + }); + return triNode; +}; + +// node_modules/@zxcvbn-ts/core/dist/matcher/dictionary/variants/matching/l33tSubstitutions.mjs +var getL33tSubstitutions = (l33tTable2) => { + const bySubstitution = new Map; + Object.entries(l33tTable2).forEach(([letter, substitutions]) => { + substitutions.forEach((substitution) => { + if (substitution === "") { + return; + } + let entry = bySubstitution.get(substitution); + if (!entry) { + entry = { + substitution, + letters: [], + lettersLower: [] + }; + bySubstitution.set(substitution, entry); + } + if (!entry.letters.includes(letter)) { + entry.letters.push(letter); + entry.lettersLower.push(toLowerCase(letter)); + } + }); + }); + const result = new Map; + bySubstitution.forEach((entry) => { + const firstCharacter = entry.substitution.charAt(0); + const entries = result.get(firstCharacter) || []; + entries.push(entry); + result.set(firstCharacter, entries); + }); + result.forEach((entries) => entries.sort((first, second) => second.substitution.length - first.substitution.length)); + return result; +}; + +// node_modules/@zxcvbn-ts/core/dist/runtimeChecks.mjs +var checkL33tTable = (l33tTable2) => { + if (typeof l33tTable2 !== "object" || l33tTable2 === null) { + throw new Error("l33tTable must be an object"); + } + Object.values(l33tTable2).forEach((substitutions) => { + if (!Array.isArray(substitutions)) { + throw new Error("l33tTable substitutions must be an array"); + } + substitutions.forEach((substitution) => { + if (typeof substitution !== "string") { + throw new Error("l33tTable substitutions must be strings"); + } + }); + }); +}; +var checkDictionary = (dictionary) => { + if (typeof dictionary !== "object" || dictionary === null) { + throw new Error("dictionary must be an object"); + } + Object.values(dictionary).forEach((list) => { + if (!Array.isArray(list)) { + throw new Error("dictionary list must be an array"); + } + list.forEach((el) => { + if (typeof el !== "string" && typeof el !== "number") { + throw new Error("dictionary entries must be strings or numbers"); + } + }); + }); +}; +var checkGraphs = (graphs) => { + if (typeof graphs !== "object" || graphs === null) { + throw new Error("graphs must be an object"); + } + Object.values(graphs).forEach((graph) => { + if (typeof graph !== "object" || graph === null) { + throw new Error("graph must be an object"); + } + Object.values(graph).forEach((adjacencies) => { + if (!Array.isArray(adjacencies)) { + throw new Error("graph adjacencies must be an array"); + } + adjacencies.forEach((adjacency) => { + if (typeof adjacency !== "string" && adjacency !== null) { + throw new Error("graph adjacency must be a string or null"); + } + }); + }); + }); +}; +var checkUseLevenshteinDistance = (useLevenshteinDistance) => { + if (typeof useLevenshteinDistance !== "boolean") { + throw new Error("useLevenshteinDistance must be a boolean"); + } +}; +var checkLevenshteinThreshold = (levenshteinThreshold) => { + if (typeof levenshteinThreshold !== "number" || levenshteinThreshold < 0) { + throw new Error("levenshteinThreshold must be a non-negative number"); + } +}; +var checkL33tMaxSubstitutions = (l33tMaxSubstitutions) => { + if (typeof l33tMaxSubstitutions !== "number" || l33tMaxSubstitutions < 0) { + throw new Error("l33tMaxSubstitutions must be a non-negative number"); + } +}; +var checkMaxLength = (maxLength) => { + if (typeof maxLength !== "number" || maxLength < 0) { + throw new Error("maxLength must be a non-negative number"); + } +}; +var checkMatcher = (name, matcher) => { + if (typeof name !== "string") { + throw new Error("matcher name must be a string"); + } + if (typeof matcher !== "object" || matcher === null) { + throw new Error(`matcher ${name} must be an object`); + } + if (typeof matcher.feedback !== "function") { + throw new Error(`matcher ${name}.feedback must be a function`); + } + if (typeof matcher.scoring !== "function") { + throw new Error(`matcher ${name}.scoring must be a function`); + } + if (typeof matcher.Matching !== "function") { + throw new Error(`matcher ${name}.Matching must be a constructor`); + } +}; +var checkCustomMatchers = (customMatchers) => { + if (typeof customMatchers !== "object" || customMatchers === null) { + throw new Error("customMatchers must be an object"); + } +}; +var checkCustomTranslations = (translations) => { + const invalidKeys = []; + Object.keys(translationKeys).forEach((type) => { + if (type in translations) { + const translationType = type; + Object.keys(translationKeys[translationType]).forEach((key) => { + const translation = translations[translationType][key]; + if (typeof translation !== "string" && typeof translation !== "function") { + invalidKeys.push(`${type}.${key}`); + } + }); + } else { + invalidKeys.push(type); + } + }); + return invalidKeys; +}; +var checkTimeEstimationValues = (timeEstimationValues) => { + if (typeof timeEstimationValues !== "object" || timeEstimationValues === null) { + throw new Error("timeEstimationValues must be an object"); + } + Object.keys(timeEstimationValuesDefaults).forEach((key) => { + if (!(key in timeEstimationValues)) { + throw new Error(`timeEstimationValues.${key} is required`); + } + const data = timeEstimationValues[key]; + if (typeof data !== "object" || data === null) { + throw new Error(`timeEstimationValues.${key} must be an object`); + } + Object.keys(timeEstimationValuesDefaults[key]).forEach((subKey) => { + if (!(subKey in data)) { + throw new Error(`timeEstimationValues.${key}.${subKey} is required`); + } + const value = data[subKey]; + if (typeof value !== "number") { + throw new Error(`timeEstimationValues.${key}.${subKey} must be a number`); + } + if (value < timeEstimationValuesDefaults[key][subKey]) { + throw new Error("Time estimation values are not to be allowed to be less than default"); + } + }); + }); +}; + +// node_modules/@zxcvbn-ts/core/dist/Options.mjs +class Options { + constructor(options = {}, customMatchers = {}) { + this.matchers = {}; + this.l33tTable = l33tTable; + this.trieNodeRoot = new TrieNode; + this.l33tSubstitutions = getL33tSubstitutions(l33tTable); + this.dictionary = { + userInputs: [] + }; + this.wordIndex = new WordIndex; + this.dictionaryMaxWordSizes = {}; + this.translations = translationKeys; + this.graphs = {}; + this.useLevenshteinDistance = false; + this.levenshteinThreshold = 2; + this.l33tMaxSubstitutions = 100; + this.maxLength = 256; + this.wordSequenceNames = ["cardinalNumbers", "ordinalNumbers", "daysOfWeek", "months", "seasons", "timePeriods", "rainbowColors", "directions", "intermediateDirections", "sizeProgression", "militaryAlphabet", "planets", "zodiacSigns", "chineseZodiac", "userInputs"]; + this.timeEstimationValues = { + scoring: { + ...timeEstimationValuesDefaults.scoring + }, + attackTime: { + ...timeEstimationValuesDefaults.attackTime + } + }; + checkCustomMatchers(customMatchers); + this.setOptions(options); + Object.entries(customMatchers).forEach(([name, matcher]) => { + checkMatcher(name, matcher); + this.addMatcher(name, matcher); + }); + } + get rankedDictionaries() { + if (this.cachedRankedDictionaries === undefined) { + const rankedDictionaries = {}; + Object.keys(this.dictionary).forEach((name) => { + rankedDictionaries[name] = buildRankedDictionary(this.dictionary[name]); + }); + this.cachedRankedDictionaries = rankedDictionaries; + } + return this.cachedRankedDictionaries; + } + get rankedDictionariesMaxWordSize() { + return this.dictionaryMaxWordSizes; + } + isWordSequence(key) { + return this.wordSequenceNames.some((name) => isDictionaryNamed(key, name)); + } + setOptions(options = {}) { + if (options.l33tTable) { + checkL33tTable(options.l33tTable); + this.l33tTable = options.l33tTable; + this.l33tSubstitutions = getL33tSubstitutions(options.l33tTable); + } + if (options.dictionary) { + checkDictionary(options.dictionary); + this.dictionary = options.dictionary; + this.setWordIndex(); + } + if (options.translations) { + this.setTranslations(options.translations); + } + if (options.graphs) { + checkGraphs(options.graphs); + this.graphs = options.graphs; + } + if (options.useLevenshteinDistance !== undefined) { + checkUseLevenshteinDistance(options.useLevenshteinDistance); + this.useLevenshteinDistance = options.useLevenshteinDistance; + } + if (this.useLevenshteinDistance) { + this.trieNodeRoot = l33tTableToTrieNode(this.l33tTable, new TrieNode); + } + if (options.levenshteinThreshold !== undefined) { + checkLevenshteinThreshold(options.levenshteinThreshold); + this.levenshteinThreshold = options.levenshteinThreshold; + } + if (options.l33tMaxSubstitutions !== undefined) { + checkL33tMaxSubstitutions(options.l33tMaxSubstitutions); + this.l33tMaxSubstitutions = options.l33tMaxSubstitutions; + } + if (options.maxLength !== undefined) { + checkMaxLength(options.maxLength); + this.maxLength = options.maxLength; + } + if (options.timeEstimationValues !== undefined) { + checkTimeEstimationValues(options.timeEstimationValues); + this.timeEstimationValues = { + scoring: { + ...options.timeEstimationValues.scoring + }, + attackTime: { + ...options.timeEstimationValues.attackTime + } + }; + } + } + setTranslations(translations) { + const invalidKeys = checkCustomTranslations(translations); + if (invalidKeys.length > 0) { + throw new Error(`Invalid translations object, missing or invalid keys: ${invalidKeys.join(", ")}`); + } + this.translations = translations; + } + setWordIndex() { + const dictionaryMaxWordSizes = {}; + const names = Object.keys(this.dictionary); + names.forEach((name) => { + dictionaryMaxWordSizes[name] = getMaxWordSize(this.dictionary[name]); + }); + this.wordIndex = new WordIndex(names.map((name) => ({ + name, + words: this.dictionary[name] + }))); + this.dictionaryMaxWordSizes = dictionaryMaxWordSizes; + } + getUserInputsOptions(dictionary) { + const { + cachedUserInputs + } = this; + const isCacheHit = this.cachedUserInputsOptions !== undefined && (dictionary === undefined ? cachedUserInputs === undefined : (cachedUserInputs === null || cachedUserInputs === undefined ? undefined : cachedUserInputs.length) === dictionary.length && cachedUserInputs.every((value, index) => value === dictionary[index])); + if (isCacheHit) { + return this.cachedUserInputsOptions; + } + const userInputsOptions = createUserInputsOptions(dictionary); + this.cachedUserInputs = dictionary ? [...dictionary] : undefined; + this.cachedUserInputsOptions = userInputsOptions; + return userInputsOptions; + } + addMatcher(name, matcher) { + if (this.matchers[name]) { + console.info(`Matcher ${name} already exists`); + } else { + this.matchers[name] = matcher; + } + } +} +// node_modules/@zxcvbn-ts/core/dist/index.mjs +var time = () => new Date().getTime(); + +class ZxcvbnFactory { + constructor(options = {}, customMatchers = {}) { + this.options = new Options(options, customMatchers); + this.scoring = new Scoring(this.options); + this.matching = new Matching(this.options); + this.feedback = new Feedback(this.options); + this.timeEstimates = new TimeEstimates(this.options); + } + estimateAttackTimes(guesses) { + return this.timeEstimates.estimateAttackTimes(guesses); + } + getFeedback(score, sequence) { + return this.feedback.getFeedback(score, sequence); + } + createReturnValue(resolvedMatches, password, start) { + const matchSequence = this.scoring.mostGuessableMatchSequence(password, resolvedMatches); + const calcTime = time() - start; + const attackTimes = this.estimateAttackTimes(matchSequence.guesses); + return { + calcTime, + ...matchSequence, + ...attackTimes, + feedback: this.getFeedback(attackTimes.score, matchSequence.sequence) + }; + } + getMatches(password, userInputs) { + const userInputsOptions = this.options.getUserInputsOptions(userInputs); + return this.matching.match(password, userInputsOptions); + } + check(password, userInputs) { + const { + reducedPassword, + start + } = this.prepareCheck(password); + const matches = this.getMatches(reducedPassword, userInputs); + if (matches instanceof Promise) { + throw new Error("You are using a Promised matcher, please use `checkAsync` for it."); + } + return this.createReturnValue(matches, reducedPassword, start); + } + async checkAsync(password, userInputs) { + const { + reducedPassword, + start + } = this.prepareCheck(password); + const matches = await this.getMatches(reducedPassword, userInputs); + return this.createReturnValue(matches, reducedPassword, start); + } + prepareCheck(password) { + let end = this.options.maxLength; + if (isSurrogatePairAt(password, end - 1)) { + end -= 1; + } + return { + reducedPassword: password.substring(0, end), + start: time() + }; + } +} + +// node_modules/@zxcvbn-ts/language-common/dist/adjacencyGraphs.json.mjs +var tempAdjacencyGraphs = { azerty: { "0": ["ç9", null, null, ")°", "pP", "oO"], "1": ["²~", null, null, "é2", "aA", null], "2": ["&1", null, null, '"3', "zZ", "aA"], "3": ["é2", null, null, "'4", "eE", "zZ"], "4": ['"3', null, null, "(5", "rR", "eE"], "5": ["'4", null, null, "-6", "tT", "rR"], "6": ["(5", null, null, "è7", "yY", "tT"], "7": ["-6", null, null, "_8", "uU", "yY"], "8": ["è7", null, null, "ç9", "iI", "uU"], "9": ["_8", null, null, "à0", "oO", "iI"], "²": [null, null, null, "&1", null, null], "~": [null, null, null, "&1", null, null], "&": ["²~", null, null, "é2", "aA", null], "é": ["&1", null, null, '"3', "zZ", "aA"], '"': ["pP", ")°", "+=", "$£", "ù%", "mM"], "'": ['"3', null, null, "(5", "rR", "eE"], "(": ["'4", null, null, "-6", "tT", "rR"], "-": ["(5", null, null, "è7", "yY", "tT"], "è": ["-6", null, null, "_8", "uU", "yY"], _: ["è7", null, null, "ç9", "iI", "uU"], "ç": ["_8", null, null, "à0", "oO", "iI"], "à": ["ç9", null, null, ")°", "pP", "oO"], ")": ["à0", null, null, "+=", '^"', "pP"], "°": ["à0", null, null, "+=", '^"', "pP"], "+": [")°", null, null, null, "$£", '^"'], "=": [")°", null, null, null, "$£", '^"'], a: [null, "&1", "é2", "zZ", "qQ", null], A: [null, "&1", "é2", "zZ", "qQ", null], z: ["aA", "é2", '"3', "eE", "sS", "qQ"], Z: ["aA", "é2", '"3', "eE", "sS", "qQ"], e: ["zZ", '"3', "'4", "rR", "dD", "sS"], E: ["zZ", '"3', "'4", "rR", "dD", "sS"], r: ["eE", "'4", "(5", "tT", "fF", "dD"], R: ["eE", "'4", "(5", "tT", "fF", "dD"], t: ["rR", "(5", "-6", "yY", "gG", "fF"], T: ["rR", "(5", "-6", "yY", "gG", "fF"], y: ["tT", "-6", "è7", "uU", "hH", "gG"], Y: ["tT", "-6", "è7", "uU", "hH", "gG"], u: ["yY", "è7", "_8", "iI", "jJ", "hH"], U: ["yY", "è7", "_8", "iI", "jJ", "hH"], i: ["uU", "_8", "ç9", "oO", "kK", "jJ"], I: ["uU", "_8", "ç9", "oO", "kK", "jJ"], o: ["iI", "ç9", "à0", "pP", "lL", "kK"], O: ["iI", "ç9", "à0", "pP", "lL", "kK"], p: ["oO", "à0", ")°", '^"', "mM", "lL"], P: ["oO", "à0", ")°", '^"', "mM", "lL"], "^": ["pP", ")°", "+=", "$£", "ù%", "mM"], $: ['^"', "+=", null, null, "*µ", "ù%"], "£": ['^"', "+=", null, null, "*µ", "ù%"], q: [null, "aA", "zZ", "sS", "wW", "<>"], Q: [null, "aA", "zZ", "sS", "wW", "<>"], s: ["qQ", "zZ", "eE", "dD", "xX", "wW"], S: ["qQ", "zZ", "eE", "dD", "xX", "wW"], d: ["sS", "eE", "rR", "fF", "cC", "xX"], D: ["sS", "eE", "rR", "fF", "cC", "xX"], f: ["dD", "rR", "tT", "gG", "vV", "cC"], F: ["dD", "rR", "tT", "gG", "vV", "cC"], g: ["fF", "tT", "yY", "hH", "bB", "vV"], G: ["fF", "tT", "yY", "hH", "bB", "vV"], h: ["gG", "yY", "uU", "jJ", "nN", "bB"], H: ["gG", "yY", "uU", "jJ", "nN", "bB"], j: ["hH", "uU", "iI", "kK", ",?", "nN"], J: ["hH", "uU", "iI", "kK", ",?", "nN"], k: ["jJ", "iI", "oO", "lL", ";.", ",?"], K: ["jJ", "iI", "oO", "lL", ";.", ",?"], l: ["kK", "oO", "pP", "mM", ":/", ";."], L: ["kK", "oO", "pP", "mM", ":/", ";."], m: ["lL", "pP", '^"', "ù%", "!§", ":/"], M: ["lL", "pP", '^"', "ù%", "!§", ":/"], "ù": ["mM", '^"', "$£", "*µ", null, "!§"], "%": ["mM", '^"', "$£", "*µ", null, "!§"], "*": ["ù%", "$£", null, null, null, null], "µ": ["ù%", "$£", null, null, null, null], "<": [null, null, "qQ", "wW", null, null], ">": [null, null, "qQ", "wW", null, null], w: ["<>", "qQ", "sS", "xX", null, null], W: ["<>", "qQ", "sS", "xX", null, null], x: ["wW", "sS", "dD", "cC", null, null], X: ["wW", "sS", "dD", "cC", null, null], c: ["xX", "dD", "fF", "vV", null, null], C: ["xX", "dD", "fF", "vV", null, null], v: ["cC", "fF", "gG", "bB", null, null], V: ["cC", "fF", "gG", "bB", null, null], b: ["vV", "gG", "hH", "nN", null, null], B: ["vV", "gG", "hH", "nN", null, null], n: ["bB", "hH", "jJ", ",?", null, null], N: ["bB", "hH", "jJ", ",?", null, null], ",": ["nN", "jJ", "kK", ";.", null, null], "?": ["nN", "jJ", "kK", ";.", null, null], ";": [",?", "kK", "lL", ":/", null, null], ".": [",?", "kK", "lL", ":/", null, null], ":": [";.", "lL", "mM", "!§", null, null], "/": [";.", "lL", "mM", "!§", null, null], "!": [":/", "mM", "ù%", null, null, null], "§": [":/", "mM", "ù%", null, null, null] }, dvorak: { "0": ["9(", null, null, "[{", "lL", "rR"], "1": ["`~", null, null, "2@", `'"`, null], "2": ["1!", null, null, "3#", ",<", `'"`], "3": ["2@", null, null, "4$", ".>", ",<"], "4": ["3#", null, null, "5%", "pP", ".>"], "5": ["4$", null, null, "6^", "yY", "pP"], "6": ["5%", null, null, "7&", "fF", "yY"], "7": ["6^", null, null, "8*", "gG", "fF"], "8": ["7&", null, null, "9(", "cC", "gG"], "9": ["8*", null, null, "0)", "rR", "cC"], "`": [null, null, null, "1!", null, null], "~": [null, null, null, "1!", null, null], "!": ["`~", null, null, "2@", `'"`, null], "@": ["1!", null, null, "3#", ",<", `'"`], "#": ["2@", null, null, "4$", ".>", ",<"], $: ["3#", null, null, "5%", "pP", ".>"], "%": ["4$", null, null, "6^", "yY", "pP"], "^": ["5%", null, null, "7&", "fF", "yY"], "&": ["6^", null, null, "8*", "gG", "fF"], "*": ["7&", null, null, "9(", "cC", "gG"], "(": ["8*", null, null, "0)", "rR", "cC"], ")": ["9(", null, null, "[{", "lL", "rR"], "[": ["0)", null, null, "]}", "/?", "lL"], "{": ["0)", null, null, "]}", "/?", "lL"], "]": ["[{", null, null, null, "=+", "/?"], "}": ["[{", null, null, null, "=+", "/?"], "'": [null, "1!", "2@", ",<", "aA", null], '"': [null, "1!", "2@", ",<", "aA", null], ",": [`'"`, "2@", "3#", ".>", "oO", "aA"], "<": [`'"`, "2@", "3#", ".>", "oO", "aA"], ".": [",<", "3#", "4$", "pP", "eE", "oO"], ">": [",<", "3#", "4$", "pP", "eE", "oO"], p: [".>", "4$", "5%", "yY", "uU", "eE"], P: [".>", "4$", "5%", "yY", "uU", "eE"], y: ["pP", "5%", "6^", "fF", "iI", "uU"], Y: ["pP", "5%", "6^", "fF", "iI", "uU"], f: ["yY", "6^", "7&", "gG", "dD", "iI"], F: ["yY", "6^", "7&", "gG", "dD", "iI"], g: ["fF", "7&", "8*", "cC", "hH", "dD"], G: ["fF", "7&", "8*", "cC", "hH", "dD"], c: ["gG", "8*", "9(", "rR", "tT", "hH"], C: ["gG", "8*", "9(", "rR", "tT", "hH"], r: ["cC", "9(", "0)", "lL", "nN", "tT"], R: ["cC", "9(", "0)", "lL", "nN", "tT"], l: ["rR", "0)", "[{", "/?", "sS", "nN"], L: ["rR", "0)", "[{", "/?", "sS", "nN"], "/": ["lL", "[{", "]}", "=+", "-_", "sS"], "?": ["lL", "[{", "]}", "=+", "-_", "sS"], "=": ["/?", "]}", null, "\\|", null, "-_"], "+": ["/?", "]}", null, "\\|", null, "-_"], "\\": ["=+", null, null, null, null, null], "|": ["=+", null, null, null, null, null], a: [null, `'"`, ",<", "oO", ";:", null], A: [null, `'"`, ",<", "oO", ";:", null], o: ["aA", ",<", ".>", "eE", "qQ", ";:"], O: ["aA", ",<", ".>", "eE", "qQ", ";:"], e: ["oO", ".>", "pP", "uU", "jJ", "qQ"], E: ["oO", ".>", "pP", "uU", "jJ", "qQ"], u: ["eE", "pP", "yY", "iI", "kK", "jJ"], U: ["eE", "pP", "yY", "iI", "kK", "jJ"], i: ["uU", "yY", "fF", "dD", "xX", "kK"], I: ["uU", "yY", "fF", "dD", "xX", "kK"], d: ["iI", "fF", "gG", "hH", "bB", "xX"], D: ["iI", "fF", "gG", "hH", "bB", "xX"], h: ["dD", "gG", "cC", "tT", "mM", "bB"], H: ["dD", "gG", "cC", "tT", "mM", "bB"], t: ["hH", "cC", "rR", "nN", "wW", "mM"], T: ["hH", "cC", "rR", "nN", "wW", "mM"], n: ["tT", "rR", "lL", "sS", "vV", "wW"], N: ["tT", "rR", "lL", "sS", "vV", "wW"], s: ["nN", "lL", "/?", "-_", "zZ", "vV"], S: ["nN", "lL", "/?", "-_", "zZ", "vV"], "-": ["sS", "/?", "=+", null, null, "zZ"], _: ["sS", "/?", "=+", null, null, "zZ"], ";": [null, "aA", "oO", "qQ", null, null], ":": [null, "aA", "oO", "qQ", null, null], q: [";:", "oO", "eE", "jJ", null, null], Q: [";:", "oO", "eE", "jJ", null, null], j: ["qQ", "eE", "uU", "kK", null, null], J: ["qQ", "eE", "uU", "kK", null, null], k: ["jJ", "uU", "iI", "xX", null, null], K: ["jJ", "uU", "iI", "xX", null, null], x: ["kK", "iI", "dD", "bB", null, null], X: ["kK", "iI", "dD", "bB", null, null], b: ["xX", "dD", "hH", "mM", null, null], B: ["xX", "dD", "hH", "mM", null, null], m: ["bB", "hH", "tT", "wW", null, null], M: ["bB", "hH", "tT", "wW", null, null], w: ["mM", "tT", "nN", "vV", null, null], W: ["mM", "tT", "nN", "vV", null, null], v: ["wW", "nN", "sS", "zZ", null, null], V: ["wW", "nN", "sS", "zZ", null, null], z: ["vV", "sS", "-_", null, null, null], Z: ["vV", "sS", "-_", null, null, null] }, jcuken: { "0": ["9(", null, null, "-_", "зЗ", "щЩ"], "1": ["ёЁ", null, null, '2"', "йЙ", null], "2": ["1!", null, null, "3#", "цЦ", "йЙ"], "3": ['2"', null, null, "4*", "уУ", "цЦ"], "4": ["3#", null, null, "5:", "кК", "уУ"], "5": ["4*", null, null, "6,", "еЕ", "кК"], "6": ["5:", null, null, "7.", "нН", "еЕ"], "7": ["6,", null, null, "8;", "гГ", "нН"], "8": ["7.", null, null, "9(", "шШ", "гГ"], "9": ["8;", null, null, "0)", "щЩ", "шШ"], "ё": [null, null, null, "1!", null, null], "Ё": [null, null, null, "1!", null, null], "!": ["ёЁ", null, null, '2"', "йЙ", null], '"': ["1!", null, null, "3#", "цЦ", "йЙ"], "#": ['2"', null, null, "4*", "уУ", "цЦ"], "*": ["3#", null, null, "5:", "кК", "уУ"], ":": ["4*", null, null, "6,", "еЕ", "кК"], ",": ["5:", null, null, "7.", "нН", "еЕ"], ".": ["6,", null, null, "8;", "гГ", "нН"], ";": ["7.", null, null, "9(", "шШ", "гГ"], "(": ["8;", null, null, "0)", "щЩ", "шШ"], ")": ["9(", null, null, "-_", "зЗ", "щЩ"], "-": ["0)", null, null, "=+", "хХ", "зЗ"], _: ["0)", null, null, "=+", "хХ", "зЗ"], "=": ["-_", null, null, null, "ъЪ", "хХ"], "+": ["-_", null, null, null, "ъЪ", "хХ"], "й": [null, "1!", '2"', "цЦ", "фФ", null], "Й": [null, "1!", '2"', "цЦ", "фФ", null], "ц": ["йЙ", '2"', "3#", "уУ", "ыЫ", "фФ"], "Ц": ["йЙ", '2"', "3#", "уУ", "ыЫ", "фФ"], "у": ["цЦ", "3#", "4*", "кК", "вВ", "ыЫ"], "У": ["цЦ", "3#", "4*", "кК", "вВ", "ыЫ"], "к": ["уУ", "4*", "5:", "еЕ", "аА", "вВ"], "К": ["уУ", "4*", "5:", "еЕ", "аА", "вВ"], "е": ["кК", "5:", "6,", "нН", "пП", "аА"], "Е": ["кК", "5:", "6,", "нН", "пП", "аА"], "н": ["еЕ", "6,", "7.", "гГ", "рР", "пП"], "Н": ["еЕ", "6,", "7.", "гГ", "рР", "пП"], "г": ["нН", "7.", "8;", "шШ", "оО", "рР"], "Г": ["нН", "7.", "8;", "шШ", "оО", "рР"], "ш": ["гГ", "8;", "9(", "щЩ", "лЛ", "оО"], "Ш": ["гГ", "8;", "9(", "щЩ", "лЛ", "оО"], "щ": ["шШ", "9(", "0)", "зЗ", "дД", "лЛ"], "Щ": ["шШ", "9(", "0)", "зЗ", "дД", "лЛ"], "з": ["щЩ", "0)", "-_", "хХ", "жЖ", "дД"], "З": ["щЩ", "0)", "-_", "хХ", "жЖ", "дД"], "х": ["зЗ", "-_", "=+", "ъЪ", "эЭ", "жЖ"], "Х": ["зЗ", "-_", "=+", "ъЪ", "эЭ", "жЖ"], "ъ": ["хХ", "=+", null, "\\|", null, "эЭ"], "Ъ": ["хХ", "=+", null, "\\|", null, "эЭ"], "\\": ["ъЪ", null, null, null, null, null], "|": ["ъЪ", null, null, null, null, null], "ф": [null, "йЙ", "цЦ", "ыЫ", "яЯ", null], "Ф": [null, "йЙ", "цЦ", "ыЫ", "яЯ", null], "ы": ["фФ", "цЦ", "уУ", "вВ", "чЧ", "яЯ"], "Ы": ["фФ", "цЦ", "уУ", "вВ", "чЧ", "яЯ"], "в": ["ыЫ", "уУ", "кК", "аА", "сС", "чЧ"], "В": ["ыЫ", "уУ", "кК", "аА", "сС", "чЧ"], "а": ["вВ", "кК", "еЕ", "пП", "мМ", "сС"], "А": ["вВ", "кК", "еЕ", "пП", "мМ", "сС"], "п": ["аА", "еЕ", "нН", "рР", "иИ", "мМ"], "П": ["аА", "еЕ", "нН", "рР", "иИ", "мМ"], "р": ["пП", "нН", "гГ", "оО", "тТ", "иИ"], "Р": ["пП", "нН", "гГ", "оО", "тТ", "иИ"], "о": ["рР", "гГ", "шШ", "лЛ", "ьЬ", "тТ"], "О": ["рР", "гГ", "шШ", "лЛ", "ьЬ", "тТ"], "л": ["оО", "шШ", "щЩ", "дД", "бБ", "ьЬ"], "Л": ["оО", "шШ", "щЩ", "дД", "бБ", "ьЬ"], "д": ["лЛ", "щЩ", "зЗ", "жЖ", "юЮ", "бБ"], "Д": ["лЛ", "щЩ", "зЗ", "жЖ", "юЮ", "бБ"], "ж": ["дД", "зЗ", "хХ", "эЭ", "/?", "юЮ"], "Ж": ["дД", "зЗ", "хХ", "эЭ", "/?", "юЮ"], "э": ["жЖ", "хХ", "ъЪ", null, null, "/?"], "Э": ["жЖ", "хХ", "ъЪ", null, null, "/?"], "я": [null, "фФ", "ыЫ", "чЧ", null, null], "Я": [null, "фФ", "ыЫ", "чЧ", null, null], "ч": ["яЯ", "ыЫ", "вВ", "сС", null, null], "Ч": ["яЯ", "ыЫ", "вВ", "сС", null, null], "с": ["чЧ", "вВ", "аА", "мМ", null, null], "С": ["чЧ", "вВ", "аА", "мМ", null, null], "м": ["сС", "аА", "пП", "иИ", null, null], "М": ["сС", "аА", "пП", "иИ", null, null], "и": ["мМ", "пП", "рР", "тТ", null, null], "И": ["мМ", "пП", "рР", "тТ", null, null], "т": ["иИ", "рР", "оО", "ьЬ", null, null], "Т": ["иИ", "рР", "оО", "ьЬ", null, null], "ь": ["тТ", "оО", "лЛ", "бБ", null, null], "Ь": ["тТ", "оО", "лЛ", "бБ", null, null], "б": ["ьЬ", "лЛ", "дД", "юЮ", null, null], "Б": ["ьЬ", "лЛ", "дД", "юЮ", null, null], "ю": ["бБ", "дД", "жЖ", "/?", null, null], "Ю": ["бБ", "дД", "жЖ", "/?", null, null], "/": ["юЮ", "жЖ", "эЭ", null, null, null], "?": ["юЮ", "жЖ", "эЭ", null, null, null] }, keypad: { "0": [null, "1", "2", "3", ".", null, null, null], "1": [null, null, "4", "5", "2", "0", null, null], "2": ["1", "4", "5", "6", "3", ".", "0", null], "3": ["2", "5", "6", null, null, null, ".", "0"], "4": [null, null, "7", "8", "5", "2", "1", null], "5": ["4", "7", "8", "9", "6", "3", "2", "1"], "6": ["5", "8", "9", "+", null, null, "3", "2"], "7": [null, null, null, "/", "8", "5", "4", null], "8": ["7", null, "/", "*", "9", "6", "5", "4"], "9": ["8", "/", "*", "-", "+", null, "6", "5"], "/": [null, null, null, null, "*", "9", "8", "7"], "*": ["/", null, null, null, "-", "+", "9", "8"], "-": ["*", null, null, null, null, null, "+", "9"], "+": ["9", "*", "-", null, null, null, null, "6"], ".": ["0", "2", "3", null, null, null, null, null] }, keypadMac: { "0": [null, "1", "2", "3", ".", null, null, null], "1": [null, null, "4", "5", "2", "0", null, null], "2": ["1", "4", "5", "6", "3", ".", "0", null], "3": ["2", "5", "6", "+", null, null, ".", "0"], "4": [null, null, "7", "8", "5", "2", "1", null], "5": ["4", "7", "8", "9", "6", "3", "2", "1"], "6": ["5", "8", "9", "-", "+", null, "3", "2"], "7": [null, null, null, "=", "8", "5", "4", null], "8": ["7", null, "=", "/", "9", "6", "5", "4"], "9": ["8", "=", "/", "*", "-", "+", "6", "5"], "=": [null, null, null, null, "/", "9", "8", "7"], "/": ["=", null, null, null, "*", "-", "9", "8"], "*": ["/", null, null, null, null, null, "-", "9"], "-": ["9", "/", "*", null, null, null, "+", "6"], "+": ["6", "9", "-", null, null, null, null, "3"], ".": ["0", "2", "3", null, null, null, null, null] }, qwerty: { "0": ["9(", null, null, "-_", "pP", "oO"], "1": ["`~", null, null, "2@", "qQ", null], "2": ["1!", null, null, "3#", "wW", "qQ"], "3": ["2@", null, null, "4$", "eE", "wW"], "4": ["3#", null, null, "5%", "rR", "eE"], "5": ["4$", null, null, "6^", "tT", "rR"], "6": ["5%", null, null, "7&", "yY", "tT"], "7": ["6^", null, null, "8*", "uU", "yY"], "8": ["7&", null, null, "9(", "iI", "uU"], "9": ["8*", null, null, "0)", "oO", "iI"], "`": [null, null, null, "1!", null, null], "~": [null, null, null, "1!", null, null], "!": ["`~", null, null, "2@", "qQ", null], "@": ["1!", null, null, "3#", "wW", "qQ"], "#": ["2@", null, null, "4$", "eE", "wW"], $: ["3#", null, null, "5%", "rR", "eE"], "%": ["4$", null, null, "6^", "tT", "rR"], "^": ["5%", null, null, "7&", "yY", "tT"], "&": ["6^", null, null, "8*", "uU", "yY"], "*": ["7&", null, null, "9(", "iI", "uU"], "(": ["8*", null, null, "0)", "oO", "iI"], ")": ["9(", null, null, "-_", "pP", "oO"], "-": ["0)", null, null, "=+", "[{", "pP"], _: ["0)", null, null, "=+", "[{", "pP"], "=": ["-_", null, null, null, "]}", "[{"], "+": ["-_", null, null, null, "]}", "[{"], q: [null, "1!", "2@", "wW", "aA", null], Q: [null, "1!", "2@", "wW", "aA", null], w: ["qQ", "2@", "3#", "eE", "sS", "aA"], W: ["qQ", "2@", "3#", "eE", "sS", "aA"], e: ["wW", "3#", "4$", "rR", "dD", "sS"], E: ["wW", "3#", "4$", "rR", "dD", "sS"], r: ["eE", "4$", "5%", "tT", "fF", "dD"], R: ["eE", "4$", "5%", "tT", "fF", "dD"], t: ["rR", "5%", "6^", "yY", "gG", "fF"], T: ["rR", "5%", "6^", "yY", "gG", "fF"], y: ["tT", "6^", "7&", "uU", "hH", "gG"], Y: ["tT", "6^", "7&", "uU", "hH", "gG"], u: ["yY", "7&", "8*", "iI", "jJ", "hH"], U: ["yY", "7&", "8*", "iI", "jJ", "hH"], i: ["uU", "8*", "9(", "oO", "kK", "jJ"], I: ["uU", "8*", "9(", "oO", "kK", "jJ"], o: ["iI", "9(", "0)", "pP", "lL", "kK"], O: ["iI", "9(", "0)", "pP", "lL", "kK"], p: ["oO", "0)", "-_", "[{", ";:", "lL"], P: ["oO", "0)", "-_", "[{", ";:", "lL"], "[": ["pP", "-_", "=+", "]}", `'"`, ";:"], "{": ["pP", "-_", "=+", "]}", `'"`, ";:"], "]": ["[{", "=+", null, "\\|", null, `'"`], "}": ["[{", "=+", null, "\\|", null, `'"`], "\\": ["]}", null, null, null, null, null], "|": ["]}", null, null, null, null, null], a: [null, "qQ", "wW", "sS", "zZ", null], A: [null, "qQ", "wW", "sS", "zZ", null], s: ["aA", "wW", "eE", "dD", "xX", "zZ"], S: ["aA", "wW", "eE", "dD", "xX", "zZ"], d: ["sS", "eE", "rR", "fF", "cC", "xX"], D: ["sS", "eE", "rR", "fF", "cC", "xX"], f: ["dD", "rR", "tT", "gG", "vV", "cC"], F: ["dD", "rR", "tT", "gG", "vV", "cC"], g: ["fF", "tT", "yY", "hH", "bB", "vV"], G: ["fF", "tT", "yY", "hH", "bB", "vV"], h: ["gG", "yY", "uU", "jJ", "nN", "bB"], H: ["gG", "yY", "uU", "jJ", "nN", "bB"], j: ["hH", "uU", "iI", "kK", "mM", "nN"], J: ["hH", "uU", "iI", "kK", "mM", "nN"], k: ["jJ", "iI", "oO", "lL", ",<", "mM"], K: ["jJ", "iI", "oO", "lL", ",<", "mM"], l: ["kK", "oO", "pP", ";:", ".>", ",<"], L: ["kK", "oO", "pP", ";:", ".>", ",<"], ";": ["lL", "pP", "[{", `'"`, "/?", ".>"], ":": ["lL", "pP", "[{", `'"`, "/?", ".>"], "'": [";:", "[{", "]}", null, null, "/?"], '"': [";:", "[{", "]}", null, null, "/?"], z: [null, "aA", "sS", "xX", null, null], Z: [null, "aA", "sS", "xX", null, null], x: ["zZ", "sS", "dD", "cC", null, null], X: ["zZ", "sS", "dD", "cC", null, null], c: ["xX", "dD", "fF", "vV", null, null], C: ["xX", "dD", "fF", "vV", null, null], v: ["cC", "fF", "gG", "bB", null, null], V: ["cC", "fF", "gG", "bB", null, null], b: ["vV", "gG", "hH", "nN", null, null], B: ["vV", "gG", "hH", "nN", null, null], n: ["bB", "hH", "jJ", "mM", null, null], N: ["bB", "hH", "jJ", "mM", null, null], m: ["nN", "jJ", "kK", ",<", null, null], M: ["nN", "jJ", "kK", ",<", null, null], ",": ["mM", "kK", "lL", ".>", null, null], "<": ["mM", "kK", "lL", ".>", null, null], ".": [",<", "lL", ";:", "/?", null, null], ">": [",<", "lL", ";:", "/?", null, null], "/": [".>", ";:", `'"`, null, null, null], "?": [".>", ";:", `'"`, null, null, null] }, qwertz: { "0": ["9)", null, null, "ß?", "pP", "oO"], "1": ["^°", null, null, '2"', "qQ", null], "2": ["1!", null, null, "3§", "wW", "qQ"], "3": ['2"', null, null, "4$", "eE", "wW"], "4": ["3§", null, null, "5%", "rR", "eE"], "5": ["4$", null, null, "6&", "tT", "rR"], "6": ["5%", null, null, "7/", "zZ", "tT"], "7": ["6&", null, null, "8(", "uU", "zZ"], "8": ["7/", null, null, "9)", "iI", "uU"], "9": ["8(", null, null, "0=", "oO", "iI"], "^": [null, null, null, "1!", null, null], "°": [null, null, null, "1!", null, null], "!": ["^°", null, null, '2"', "qQ", null], '"': ["1!", null, null, "3§", "wW", "qQ"], "§": ['2"', null, null, "4$", "eE", "wW"], $: ["3§", null, null, "5%", "rR", "eE"], "%": ["4$", null, null, "6&", "tT", "rR"], "&": ["5%", null, null, "7/", "zZ", "tT"], "/": ["6&", null, null, "8(", "uU", "zZ"], "(": ["7/", null, null, "9)", "iI", "uU"], ")": ["8(", null, null, "0=", "oO", "iI"], "=": ["9)", null, null, "ß?", "pP", "oO"], "ß": ["0=", null, null, "´`", "üÜ", "pP"], "?": ["0=", null, null, "´`", "üÜ", "pP"], "´": ["ß?", null, null, null, "+*", "üÜ"], "`": ["ß?", null, null, null, "+*", "üÜ"], q: [null, "1!", '2"', "wW", "aA", null], Q: [null, "1!", '2"', "wW", "aA", null], w: ["qQ", '2"', "3§", "eE", "sS", "aA"], W: ["qQ", '2"', "3§", "eE", "sS", "aA"], e: ["wW", "3§", "4$", "rR", "dD", "sS"], E: ["wW", "3§", "4$", "rR", "dD", "sS"], r: ["eE", "4$", "5%", "tT", "fF", "dD"], R: ["eE", "4$", "5%", "tT", "fF", "dD"], t: ["rR", "5%", "6&", "zZ", "gG", "fF"], T: ["rR", "5%", "6&", "zZ", "gG", "fF"], z: ["tT", "6&", "7/", "uU", "hH", "gG"], Z: ["tT", "6&", "7/", "uU", "hH", "gG"], u: ["zZ", "7/", "8(", "iI", "jJ", "hH"], U: ["zZ", "7/", "8(", "iI", "jJ", "hH"], i: ["uU", "8(", "9)", "oO", "kK", "jJ"], I: ["uU", "8(", "9)", "oO", "kK", "jJ"], o: ["iI", "9)", "0=", "pP", "lL", "kK"], O: ["iI", "9)", "0=", "pP", "lL", "kK"], p: ["oO", "0=", "ß?", "üÜ", "öÖ", "lL"], P: ["oO", "0=", "ß?", "üÜ", "öÖ", "lL"], "ü": ["pP", "ß?", "´`", "+*", "äÄ", "öÖ"], "Ü": ["pP", "ß?", "´`", "+*", "äÄ", "öÖ"], "+": ["üÜ", "´`", null, null, "#'", "äÄ"], "*": ["üÜ", "´`", null, null, "#'", "äÄ"], a: [null, "qQ", "wW", "sS", "yY", "<>"], A: [null, "qQ", "wW", "sS", "yY", "<>"], s: ["aA", "wW", "eE", "dD", "xX", "yY"], S: ["aA", "wW", "eE", "dD", "xX", "yY"], d: ["sS", "eE", "rR", "fF", "cC", "xX"], D: ["sS", "eE", "rR", "fF", "cC", "xX"], f: ["dD", "rR", "tT", "gG", "vV", "cC"], F: ["dD", "rR", "tT", "gG", "vV", "cC"], g: ["fF", "tT", "zZ", "hH", "bB", "vV"], G: ["fF", "tT", "zZ", "hH", "bB", "vV"], h: ["gG", "zZ", "uU", "jJ", "nN", "bB"], H: ["gG", "zZ", "uU", "jJ", "nN", "bB"], j: ["hH", "uU", "iI", "kK", "mM", "nN"], J: ["hH", "uU", "iI", "kK", "mM", "nN"], k: ["jJ", "iI", "oO", "lL", ",;", "mM"], K: ["jJ", "iI", "oO", "lL", ",;", "mM"], l: ["kK", "oO", "pP", "öÖ", ".:", ",;"], L: ["kK", "oO", "pP", "öÖ", ".:", ",;"], "ö": ["lL", "pP", "üÜ", "äÄ", "-_", ".:"], "Ö": ["lL", "pP", "üÜ", "äÄ", "-_", ".:"], "ä": ["öÖ", "üÜ", "+*", "#'", null, "-_"], "Ä": ["öÖ", "üÜ", "+*", "#'", null, "-_"], "#": ["äÄ", "+*", null, null, null, null], "'": ["äÄ", "+*", null, null, null, null], "<": [null, null, "aA", "yY", null, null], ">": [null, null, "aA", "yY", null, null], y: ["<>", "aA", "sS", "xX", null, null], Y: ["<>", "aA", "sS", "xX", null, null], x: ["yY", "sS", "dD", "cC", null, null], X: ["yY", "sS", "dD", "cC", null, null], c: ["xX", "dD", "fF", "vV", null, null], C: ["xX", "dD", "fF", "vV", null, null], v: ["cC", "fF", "gG", "bB", null, null], V: ["cC", "fF", "gG", "bB", null, null], b: ["vV", "gG", "hH", "nN", null, null], B: ["vV", "gG", "hH", "nN", null, null], n: ["bB", "hH", "jJ", "mM", null, null], N: ["bB", "hH", "jJ", "mM", null, null], m: ["nN", "jJ", "kK", ",;", null, null], M: ["nN", "jJ", "kK", ",;", null, null], ",": ["mM", "kK", "lL", ".:", null, null], ";": ["mM", "kK", "lL", ".:", null, null], ".": [",;", "lL", "öÖ", "-_", null, null], ":": [",;", "lL", "öÖ", "-_", null, null], "-": [".:", "öÖ", "äÄ", null, null, null], _: [".:", "öÖ", "äÄ", null, null, null] } }; + +// node_modules/@zxcvbn-ts/dictionary-compression/dist/decompress.mjs +function decompress(encodedString) { + const decompressedArray = encodedString.split(/([A-Z])/g); + const decompressedData = []; + let last = ""; + let i; + for (i = 1;i < decompressedArray.length; i += 2) { + last = last.slice(0, decompressedArray[i].charCodeAt(0) - 65) + decompressedArray[i + 1]; + decompressedData.push(last); + } + return decompressedData; +} + +// node_modules/@zxcvbn-ts/language-common/dist/diceware.json.mjs +var diceware = decompress("AabacusCdomenFinalCideEingDlityClazeDeCnormalCrasionGveDeastDidgeDoadDuptlyCsenceFteeGlyDintheDoluteFveDtainEractDurdBccentDlaimEimateDompanyEuntDuracyGteEstomCetoneChinessFgCidCornCquaintEireCreDobatEnymCtingEonEvateHorFeFismHtGtyDressDsCutelyFnessBerationDobicsEsolFpaceBfarCfairDectedGingHonDidavitEliateErmExDlictedEuentDordDrontClameDoatDutterCootCraidCterglowFlifeFmathGostFnoonBgedDlessDncyEdaEtCgregateChastCileEityDngCnosticConizeGingEyCreeableIyFdFingFmentDoundBheadCoyBideDsCmBjarBlabasterDrmCbatrossDumCfalfaCgebraDorithmCiasDbiDenableGteFsDkeDveCkalineGzeCmanacDightyDostCoeDftDhaDneEgsideDofCphabetCrightCthoughDitudeDoCuminumEniCwaysBmarettoDzeEinglyCberDianceEguityGousEtionHusDulanceEshCendableFmentFsEityCiableDcablyDdDgoDnoDssCmoniaGumCnestyDioticCongDuntCperageDleEifierGyEyCuckDletDsableEedFmentFrEingBnacondaDerobicDgramDtomistGyCchorFvyDientCdroidCemiaFcDurismDwCgelfishFicErDledFrFsEingDrilyFnessDuishedElarCimalFteGingHonGorEeEosityCkleCnexDotateEuncerEyingDuallyEityCointerDtherCsweringCtacidErcticDeaterElopeEnnaeDhemEillEologyDibodyEcsEdoteEheroEquelyHsGityErustEtoxicFrustEviralHusDlerDonymDsyCvilCybodyDhowDmoreDoneDplaceDthingEimeDwayEhereBortaBpacheCostleCpealingFrFseGingEndageGixEtiteGzerDlaudGseEeEianceFcantFedEyDointeeDraisalHerEehendEoachFvalGeCricotElDonCtitudeDlyBquaDeductBrbitraryHteCdentlyCeaDnaCguableHyEeCiseCmadilloDbandDchairDedDfulDholeDingDlessDoireEredFyDrestDyComaDseDundEsalCrangeEyDestDivalFeDoganceHtCsonCtBscendFsionFtErtainChamedDenEsDyCideCkewCleepCparagusDectDirateFeFinCtonishEundDrideEologyFnautGomyDuteBtlanticEsComDnableDpCriumDociousEphyCtachEinDemptEndantGeeFtionHveEstDicEreEtudeDractorEibuteCypicalBuctionCdaciousGtyDibleGyEenceEoEtionCgmentedDustCthenticEorDismFticDographEmakerGtedHicEpilotBvailableDlancheDtarCengeFingEueDrageEsionEtCiationForDdCoidBwaitDkenDrdEeChileCkwardCningCokeCryBxisAbabbleFingDiedDoonCckacheEboardGnedEdropEedFrEfieldGreEhandEingElandsGshFessFightGtFogEpackFedalErestFoomEshiftFideFlidFpaceGinFtabHgeEtalkFrackEupEwardGshGterEyardDonDteriaHumCdassDgeDlandEyDnessCffleFingCgelDfulDgageEedEieFnessGgEyDpipeDuetteCkedEryEshopDingClanceGingDconyDmyDsamicCmbooCnanaDishFterDjoDkableEbookEedFrEingEnoteErollDnerEisterDsheeDterCrbecueFdFllFrDcodeDgeEraphDistaEtoneDleyDmaidFnDnDometerDrackGudaEelFtteEicadeFerDstoolDtenderFrerCshDicallyFsElEnEsDketCtboyDchDhDonDsDtalionEeredGingGyEingEleCubleCzookaBlabberDdderEeDhDmeEingDnchingEdnessEkDsphemeIyEtDtancyGtlyDzerEingCeachEkDepDmishDndDssCightedDmpDngEkedGrFingFsDpDssfulDtzDzzardCoatedFingDbDgDomersFingEperDtDuseCubberDffDishDndererEtDrbEredFyEtDshEteryBoasterFfulFingDtCbbedEingEleDcatDsledDtailCdaciousDyCggedEleDusCilCkClsterDtCnanzaDdedEingElessDedEheadElessFikeEyDfireDnetDsaiDusDyCogeymanEiemanDkDndocksDtedEhEieFngElaceFegEsDzyCraxDingDoughDrowerGingCssCtanicalGstFyDchDhDtleFingEomCunceFingFyEdingFlessEtifulCvineCxcarDerDingDlikeDyBreachEthDechesGingEderFingEzeFyDthrenDweryEingCiarDbeDckDdeEgedDgadeEhtDlliantDmDngEkDsketFlyFnessEtleDttleCoadbandFcastFenFlyFnessFsideFwaysDilerFingDkenFrDnchialFoEzeFingDokEmDughtDwbeatEnnoseEseFingCuisingDnchEetteEtDshEselsDteEishlyBubbleFingFyCccaneerDkedFtEleEshotFkinEtoothEwheatCddhismHtEingEyDgetCffaloEedFrEingEoonCggyClbDgeEinessEurDkDldogGzerEfightFrogEhornEionFshEpenEringEseyeEwhipEyCnchDdleDgeeDionDkbedEhouseEmateDnyDtCsboyDhDilyDloadDtDybodyCzzAcabanaDbageEieDdriverDleDooseCcheDkleDtiEusCddieEyDetDillacDmiumCgeChootsCkeClamariFityDciumEulateGusDiberFrateDmDoricGeDzoneCmcorderDeoEraDisoleDperEfireEingEsiteEusCnalEryDcelDdiedEleEyDeDineEsterDnabisEedEingEonFtDolaEnEpenerFyDteenDyonCpableGyEcityDeDillaryEtalFolDpedDricornDsizeEuleDtionFvateGeGityEureCramelEtEvanDbonDdboardEedEiacFganFnalEstockDefullyEgiverElessEssEtakerDgoDingDlessEoadDmakerDnageFtionEivalGoreDolDpenterHryEoolFrtDriedEotFuselEyDtelEloadEonFonEridgeEwheelDveEingDwashCscadeDeDhDingFoDketDsetteDuallyGtyCtacombElogFystGzeEpultEractEtonicDcallEhableFerFingFyDererFingDfightFshDhedralEouseDlikeDnapEipDsupDtailEishlyEleEyDwalkCucasianEusDsalFtionEeEingDterizeEionGusCvalierFryDiarEtyBedarCleryEstialDibacyGteDticCmentCnsusCramicsDemonyDtainlyHtyEifiedGyCsareanDspoolBhafeEfingDinErDliceElengeDmberEomileEpionDnceEgeEnelEtDosDperoneElainEpedEsEterDracterEbroilEcoalEgerFingEiotFtyEmEredEterFingDseEingEteFiseGtyDtroomEterFingFyCeatingDddarDekErEseFyDfDmicalsFstEoDrisherEubDssEtDvronEyDwableEerEingEyCiefDhuahuaDldcareFhoodFishFlessGikeEiElDmpDpDrpingFyDtchatDvalryEeClorideGneCoiceDkeholdEingDmpDoserFingFyDpDsenDwderEtimeCromeCubbyDckDgDmmyEpDnkDrnDteBiderClantroCnchDemaDnamonCrcleFingEularHteFsCtableEdelEtionDizenDricEusDyCvicElBladDimDmbakeEmyEorEpEshellDngEkingDppedGrFingDrifyFnetFtyDshEpEsDtterDuseDvicleDwDyCeanErEtEverDftDnchDrgymanEicalEkDverCickerDentDmateGicDngEicEkingDpDqueCoakDbberDckDneEingDsableEureDthesFingDudDverCubbedFingEhouseDmpEsilyFyDnkyDsteredDtchEterBoachDgulantDstalFerFingFlandGineDtDuthorCbaltDblerDwebCcoaEnutCdCeditorDrceDxistCffeeDounderCgnitionHveDwheelCherenceHtEsiveCilCkeClaDdDeslawDiseumDlageFpseFrEectedHorEideFeFsionDonialGstGzeFyEssalDtCmaDeDfortEyDicEngDmaEenceGdGtFrceEodeGityGoreFnFtionEuteGingDpactedIrHlyHorFnionGyFreEelEileElyEonentFsedHrGiteGtGureFundEressFisedEuterGingDradeCncaveEealFdedFptFrnedGtEhEiergeFseEludeEreteEurDdenseEimentFtionEoneEuciveGtorFitDeDfessFttiEidantGentHrGingFgureFnedGingFrmElictEormFundErontEusedGingHonDgenialFstedEratsFessDicalDjoinedEureGorDnectedHorDsensusGtEoleGingFnantEtableGntFrainGictGuctEultFmerGingDtactFinerEemptFndGtedHlyHsFstFxtEortFurEriteFolEusionDveneGtCpartnerDeDiedFrElotEngEousDperDyCralDkDnballFreadEcobEeaFdFrEfieldFlakeEhuskEmealEstalkEyDonaryFerDporalHteDralEectEidorEodeGingFsiveDsageEetDtexCsignerDmeticsEicEosDponsorDtCttageEonCuchDghDldDntableFdownFingFlessFryFyDrierCvenantErEtedFingCynessCzilyEnessDyBrabbingEgrassElikeEmeatDdleFingDfterFilyFsmanFworkFyDmpDnberryEeEialFumEkDteDveEingDwfishElersFingDyfishEonDzedEilyFnessEyCeamedGrFlikeEseFingEtableFeFionGveFureDdibleHyFtDedDmeDoleDpeEtDscentEtedFingFlessDviceDwlessEmanGteCibDcketDedErDmpEsonDngeFingEkleGyDspedFingFlyFnessFyDteriaEterCoakDckDokEnDpDssDuchEtonDwbarEdEnCucialDdelyFnessDellyFnessFtyDmbEmiestFyEpetFledDncherGingGyDsaderEhableFedGrFingEtDxCyingDpticDstalBubbyholeDeDicalFleCcumberCddleFyCfflinkClinaryDminateDpableEritDtivateEuralGeCpbearerDcakeDidDpedEingCrableEtorDdleDeDfewDingDledFrEinessGgEyDryDseEiveEorDtainElyEsyDvatureEeEyCshyDpDsedDtardEodianGyFmaryGerGizeGsCtBycleEicFngFstClinderCmbalCtoplasmItAdabCdCffodilCggerCilyDntilyFyDryDsyCllyingCnceEingDdelionFrEruffEyDgerEleFingCredevilEsDinglyDkenedGingEishEnessEroomDlingDnDtDwinismCshDtardlyCtaDebookDingCughterDntingCwdlerDnCybedEreakDcareDdreamDlightEongDroomDtimeCzzlerFingBeaconDfeningEnessDlerEingEmakerEtDnCbatableFeFingDitDriefDtlessEorDugEnkCcadeEfElEthlonEyDeasedEitFverGingEmberEncyFtEptionHveDibelEdableEmalFeterEpherDkDlaredEineDodeEmposeEratedHorEyDreaseFeCdicateHorDuceFtCedDmDpenElyEnessCfaceFingEmeEultDeatEctionHveEndantGerFseGiveErralGedDianceGtEleFingEneFiteDlateGionGorEectedHorDogErestDraudEostDtlyDuseDyCgradedGingEeaseFeChydrateCityCjectedClayDegateHorEteFionDicacyGteFiousEghtedEriousGumEvererHyDouseDtaDugeEsionExeCmandingDeaningGorDiseDocracyHtEteFionDystifyCnaturedDiableFlEmDoteDseEityDtalEistEureDyCodorantGizeCpartedGureDictDleteGionEoredFyDortEseDravedGityEecateFssEiveDthDutizeFyCrailEngedDbyDivedCsecrateErveGingDignateGedHrGingDkboundEtopEworkDolateDpairEiseFteDtinyFtuteEructCtachedEilDectionHveGorEntionErgentEstDonateHorExifyDractCuceCvalueDiancyGtFteGionGorEceEousDotedlyGeFionEurerGingFtlyCxterityGousBiabetesGicEolicDgnosesHisEramDlDmeterDperEhragmDryCceDingDtateGionGorCfficultEusedHrGionHveCgClationDigenceHtDlDuteCmeDinishDlyDmedFrDnessDpleCnerDgbatEhyEinessEoEyDingDnerCoceseDxideCplomaDpedFrEingCrectedGionHveGlyGoryEnessDtinessCsabledEgreeEllowErmFrayEsterDbandEeliefEurseDcardEernEhargeEloseEolorFuntGrseFverEussDdainDengageDfigureDgraceDhDinfectDjoinDkDlikeGingEocateFdgeFyalDmantleFyEissEountDobeyErderEwnDparateGityFtchEenseFrsalHedIrElaceGyFeaseEosalGeEroveEuteDregardEuptDsuadeDtanceGtFsteEillFnctEortEractFessFictFustCtchDtoDzyCvidableFedGndGrsFingEnelyFgFityEsibleIyGonGveDorceeCzzinessEyBoableCcileDkDtrineDumentCdgeEyCilyDngCleDlarEhouseEopEyDphinCmainDelikeEsticDinionFoesCnatedFionForDorDutCodleDrbellEframeEknobEmanGtEnailEpostEstepGopEwayDzyCrkDmitoryDsalCsageDeCttedCublingDcheCveCwnDryCzeBrabDggingEonflyGishEsterDinableGgeFedGrFpipeDmaticHzeDnkDperyDsticDwCeadedFfulFlockEmboatFilyFlandGessGikeFtFyErilyFyDnchDssDwCibbleDedErDftDllerFingDnkableFingDppingFyDvableEenFrFwayEingDzzleGyConeDolEpDpdownEboxEkickEletEoutEperDveDwnEsilyCudgeDmCyBubbedDiouslyCchessDkbillEingElingEtailEyDtCdeCffelCgoutChCkeCllerEnessDyCmpingElingEsterCoCpeDlexEicateGityCrableGyEtionDessDingCskDtCtifulDyCvetBwarfCeebDlledGrFingCindleGingBynamicGteEstyCslexiaHcAeachCgleCracheDdrumDflapEulDlobeEyDmarkEuffDphoneEieceElugsDringDshotDthenFlikeHngGyFwormFyDwigCsefulElDiestElyEnessFgDtboundEcoastEerEwardCtableDenEryDingDsBbayConyDokBcardCcentricChoClairDipseCologistGyDnomicHstGyDsphereEystemBdgeDinessFgDyCitionEorCucatedGionGorBelBffectiveGsDicientDortBggbeaterDingDnogDplantDshellComaniacDtismGticBitherBjectBlaborateDsticDtedCbowCdercareFlyEstCectableFionGveDphantDvateGingHonGorEenCfCigibleHyDminateDteEismDxirCkClipseFticCmCongatedDpeDquenceHtCsewhereCudeDsiveCvesBmailCbargoFkEssyEttledDellishErEzzleDlazeEemDodyElismEssDroiderCceeCeraldEgencyCissionDtCoteEiconFonCpathicGyDerorDhasesGisHzeFticDiricalDloyedHeHrDoriumEwerDtierFnessEyCuBnableDctmentDmelCchantedEiladaDircleDloseGureDodeEreEunterFrageDroachEustEyptCdangerDearedGingEdDingDlessDnoteDocrineErphinFseEwmentDpointDurableGnceFingCergeticFizeFyCforcedHrCgagedFingDineDorgeDravedHrGingEossDulfChanceCigmaticCjoyableIyFerFingFmentClargedGingDightenEstedCquirerCrageDichDollCslaveDnareDureCtailEngledDeringFtainDicingEreEtleFyDombEurageDrapEeeFnchEustEywayDwineCunciateCvelopeDiableHyEousEsionDoyDyCzymeBpicDdemicFrmalHisEuralDlepsyGticEogueDphanyDsodeBqualEteFionForDinoxEpmentEtyEvocalBradicateDsableEedFrEureCgonomicCrandFtEticDorCuptBscalateHorEpableGdeFistErgotCkimoCophagusCpionageDressoCquireCsayDenceFtialCtablishEteDeemedDimateHorDrangedEogenBtchingCernalFityChanolDerDicallyFsBuphemismBvacuateFeeDdeDluateHorDporateDsionFveCenDrgladeFreenEybodyFdayFoneCictDdenceGtDlCokeDlutionEveBxactDltedDmpleCcavateHorDeedingEptionEssDhangeDitableFingDlaimEudeGingFsionHveDretionGoryDursionEsableIyFeCemplaryGifyFtionDrciserEtDsCfoliateChaleEustDumeCileDstingDtCodusDnerateDrcismHtCpandFseGionHveDectantEditedIrElEndFsesGiveErtDireFingDlainEetiveEicitEodeFitFreGingDonentErterEsableFeFureDressDulsionCquisiteCtendedGingFtFuateEriorFnalDinctDortionDraditeFsEovertEudeGingCuberantAfableDricDulousCcebookEclothEdownElessFiftEplateEtedDialElityEngDsimileDtionEoidFrEsheetEualDultyCdeDingCilingClconDlDseEifyCmeDiliarFyEneEshedCnaticDciedFnessEyDfareDgDningDtasizeGticGyCscismDtballEerEingEnessCucetCvorableIyFedFingGteCxBeastCderalDoraCebleDdDlCistyClineDttipCminineGsmHtGzeDurCnceEingDderCrmentDnlikeDociousGtyDretEisEyDvorCsterEivalGeGityCtalDchCverBiberCctionCddleFingDelityDgetingGyCfteenEhEiethEyCgmentDureFineClingDledFrEingDmDterEhErateCnaleFistGzeFlyEnceGialDchDenessErDickyEshedHrGingEteDlessEikeCscallyCtCveBlaccidDgmanEpoleEshipFtickGoneDilDkilyEyDmeEmableDnkedFingEnelsDpDringDshbackGulbFcardFilyGngFyEkDtbedEfootElyEnessEtenGredIrHyFopEwareFormDvoredGfulGingDxseedCedDshedFyCickDerDghtDnchEgEtDpDrtCoatDckDggingDpDralEistDssDunderCyableEwayDerDingDoverDpaperBoamCeCgCilClicDkDlicleEowCndlingFyEnessEueDtCodDlDtageEballGthFoardEerEgearEhillFoldEingElessEmanEnoteEpadGthFrintErestEsieForeEwearForkCssilDterCunderFingEtainCxCyerBractionFureDgileGityEmentEranceHtDilDmeEingDnticDternalDyedEingEsCeckledHsDebaseFeeFieEdomEfallEhandEingEloadFyEmasonEnessEstyleEwareGyFillEzableFingDightDnchEziedFyDquencyHtDshDtfulEtedCictionDdayEgeDedEndDghtenGfulEidityGlyDllDngeDsbeeEkDtterDvolousColicDmDntDstbiteFedFilyGngFlikeFyDthDwnDzenCuctoseDgalityGlyDitDstrateCyingAgabCffeCgCinfullyEingEsClaDlantlyEeriaGyFyEonFwsEstoneDoreDvanizeCmblingDeDingDmaCnderDglyEreneEwayCpCrageDbageDdenDgleDlandEicDmentDnetEishDterCsCthererGingDingCugingDntletDzeCveCwkCzingBearCckoCekCigerCmCnderDericFousEticsDreDtileElemanFyEsCographyDlogicHstGyDmetricHyCraniumDbilDiatricDmicideFnateElessEproofCstateGionEureCtawayDtingDupBiantCbberishDletCddilyFnessEyCftCgabyteEhertzEnticDgleFingFyDoloClledEsCmmickCrdleCveawayEnErDingCzmoDzardBlacialFerDdeEiatorElyDmorousFurDnceFingEdularDreEingDssDucomaDzingCeamingDefulCiderEingDmmerEpseDstenDtchEterEzyCoaterFingDomilyFyDrifiedIrGyFousEyDssDveDwingEwormCucoseDeDtenEinousEtonBnarlyDtBoalDtskinCesCgglesCingCldfishEmineEsmithDfDiathCnadDdolaDeDgCodDeyDfballEinessEyDgleDnCpherCreDgedFousDyCslingDsipCthicDtenCutCwnBrabDcefulFlessEiousDdationEedFrEientFngEuallyGteDffitiEtedFingDinDnddadFkidFlyFmaFpaFsonEiteEnyEolaEtEularDpeEhEpleGingDspEsDtifiedGyFngFtudeEuityDvelFnessFsFyardEitateGyEyDyDzingCeasilyDedilyFlessFyEnEterFingDwDyhoundCidDefEvanceFingFousDllDmaceGingEeEinessEyDnchEningDpDstleDtCoggilyFyDinDomEveFingFyDpeDundEpedEtDveDwerEingElCubDdgeFingDelingDfflyDmbleGingGyEpilyDngeEtBuacamoleCidableFnceEeEingDlelessDseClfDlibleEyDpCmballDdropDminessGgEyCrgleFingDuCshDtoEyCtlessDsDterCyCzzlerByrationAhabitableGntGtFualCckedFrEingEsawCdCgglerCikuClfDogenDtDvedFsCmburgerDletDmockDperDsterFringCndbagGllFookFrakeEcartFlapHspFraftFuffEedEfulEgripFunEheldEinessFworkElebarGdGrFingEmadeEoffEpickFrintErailEsawFetFfreeFhakeFtandEwashForkGvenFriteEymanDgnailEoutFverEupDkeringEieEyCphazardDpeningEierGstFlyFnessEyCrborDdcopyGreGverEdiskEenedHrGingEhatFeadEinessElyEnessEshipEwareFiredFoodEyDmfulElessEonicaIsHzeGyDnessDpistDshDvestCshDsleDteEilyFnessEyCtboxDchbackFeryGtFingFlingDeDlessDredCuntCvenCzardDelnutDilyEnessFgDyBeadacheEbandFoardEcountEdressEedFrEfirstEgearEingElampFessFockEphoneFieceErestFoomEscarfFetFmanFtandGoneEwayFearDpDtDveEilyFnessGgCdgeEingCftinessEyCliumDmetDperEfulEingElessFineCmlockDstitchCnceEhmanDnaCraldDbalEicideEsDitageDmitDoicsFsmDringDselfDtzCsitancyHtGteCxagonFramBubcapCddleFingCffCgClaDkDlCmanDbleFingFyDidEliateGtyDmingEusDongousEristFlessFousDpbackEedDveeCnchbackDdredthDgerErilyFyDkDterEingEressEsmanCrdleDledFrEingDrayEicaneFedEyDtCsbandDhDkedEinessCtBybridCdrantFtedGionEogenFxideCperlinkFtextDhenDnosesGisFticHsmItHzeDocrisyHteAibuprofenBceCinessEgCkyConCyBdealismHtGzeFlyFnessDnticalGfyGtyDologyCiocyEmClyBglooCnitionDoreCuanaBllicitlyDusionGveBmageEinaryGesGgCbecileCitateGionCmatureDerseGionDinentDobileEdestErallyFtalEvableIyDunityGzeCpairedEleErtEtientDeachEdingEndingErfectFialDishDlantEementEicateGitEodeFsionHveEyDoliteErtantGerEseFingEtenceIyHtEundDreciseEintFsonEomptuFperFveGingHseEudentDulseGiveEreFityBodineEzeCnBpadChoneCodBrateCkConCregularDigateEtableIyGntGteBslamicGstColatedGingHonDtopeCsueEingBtalicizeGsCemCineraryCunesBvoryCyAjabCckalEetEknifeEpotCilbirdFreakEerEhouseClapenoCmCnitorDuaryCrgonDringCsmineCundiceEtCvaCwedDlessEineDsCybirdDwalkerCzzBeepDringlyClliedEyCrseyCsterCtBiffyCgsawCmmyCngleFingDxCttersGyBobCckeyEstrapCggerEingChnCiningCkesterDinglyCllinessEyDtCtCvialCyfullyDlesslyDousDrideDstickBubilanceHtCdgeEinglyDicialHryDoCggleFingDularCiceEinessEyCjitsuCkeboxClyCmbleEoDpCnctionFureDeDiorEperDkieEmanEyardCristDorDyCsticeFfierGyElyEnessCvenileAkabobCngarooCraokeEteDmaBebabCenlyEnessDpCgClpCnnelCptCrchiefDoseneCttleBickClnDobyteEgramEmeterEwattDtCmonoCndleFingFyEnessEredDeticDfolkDgDshipEmanEwomanCssableEerEingCtchenDeDtenEyCwiBleenexBnapsackCeeDltCickersCollBoalaCokyCsherBryptonBudosCngAlaboredGrFingGousDradorCdderDiesDleDybugElikeCggedEingDoonCirCkeCnceDdedEfallFillEingEladyFessFineFordEmarkGssFineEownerEscapeFideFlideDguageDkinessEyDternCpdogDelDpedEingDtopCrdDgeDkCshDsoDtCtchDeDherDitudeDrineDterEicedCunchEderFryDrelCvenderDishCxativeCzilyEnessDyBecturerCftCgacyElDendDgedEingsDibleGyEslateDoDroomDumeDwarmerEorkCmonCndDgthDsDtCotardCsserCtdownDhargicHyDterEuceCvelErageFsDitateHorBiabilityEleCbertyDrarianGyCckingDoriceCdCfeDterEingEoffCgamentCkelyEnessEwiseDingClacDlyDyCmbDeadeElightEsDitDpingEnessCneDgoEuiniGstDingDkedDoleumDseedDtConCpCquefyFurEidCspDtCtigateHorDmusDterEleCvableDedElyErEstockDidlyEngCzardBubricantHteCcidDkilyFnessElessDrativeCdicrousCggedCkewarmCllabyCmberDinanceFousDpinessGgFshCnacyErDchboxFeonFroomFtimeDgCrchDeDidnessDkCshlyEnessDterEfullyEilyFnessErousEyCxuriousFyByingCricallyFismHtFsAmacarenaFoniEwDeDhineGistCgazineDentaDgotDicalFianDmaDnesiumFticHsmHzeEifierGyFtudeEoliaChoganyCimedCjesticGyDoretteFityCkeoverErEshiftDingClformedDtCmaDmalFryEogramCnagerFingEteeDdarinFteGoryEolinDgerEleEoEyDhandleEoleFodEuntDicottiFureEfestoElaDkindDlikeFnessEyDmadeDnedEishDorDpowerDtisEraDualDyCpCrathonEudingDbledGsFingDchDdiDgarineHtaEinDigoldEnaFeEtalFimeDlinDmaladeDoonDriedEowEyDshlandFyEupialDvelousDxismCscotEulineDhedEingDsagerEesEiveDtiffCtadorDchbookHxFerFingFlessDerialFnalGityDhDingDriarchFmonyFxEonDtedFrDurelyFingGtyCuveCverickCximizeFumCybeDdayDflowerBoanerEingCbileFityGzeDsterCchaDkerEupCdifiedFyDularGtorFeCistenFnessFureClarEssesDdDecularHeEhillDluskCmCnasteryDdayDetaryFizeEybagsFlessFwiseDgooseErelDitorDkhoodDogamyFramElogueEpolyErailEtoneFypeExideDsieurEoonEtrousDthlyDumentCocherDdinessEyDingDnbeamEedElightGkeGtEriseEscapeFhineFtoneEwalkCpCraleFityFlyDbidityGlyDphineHgDseDtalityGlyEicianFfiedGyEuaryCsaicDsyDtCthballEproofDionEvateHorFeDocrossErDtoCuntableGinFedFingDrnerFfulDseEinessEtacheEyDthCvableDeDieEngCwerDingBuchDkCdCgClberryDchDeDledFtsDtipleHyFtaskGudeCmbleFingEoDmifiedGyEyDpsCnchkinDdaneDicipalCppetCralDkinessEyDmuringCscularDeumDhilyFnessEroomEyDicDketEinessEyDtangFrdEerEinessEyCtableEteFionDeDilatedHorEnyDtDualCzzleByselfDpaceDtifiedGyCthAnachoCgCilCmeDingCnnyDometerCpeDkinDpedEingEyCrrowCstilyFnessCtionalEveFityDuralFeFistCuticalCvigateHorDyBearbyEestElyEnessDtlyEnessCbulaFizerCctarCgateFionGveDlectorEigeeHntDotiateCmesesFisConCphewCrdDvousEyCstCtCurologyFnFsisFticDterEronCverCxtBibbleCcknameDotineCeceCftyCmbleFyCneteenFiethDjaDtendoEhBuclearFiFusCggetCllifyCmberEingElyEnessDeralGteHorFicFousCptialsCrseryEingDtureCtcaseDlikeDmegDrientDshellDtinessEyCzzleBylonAoafCkCsisCtBbedienceHtCituaryCjectCligateFedEvionHusDongCnoxiousCoeCscureGityDervantGerGingEssedGionHveDoleteDtacleEinateEructCtainDrusiveDuseCviousBccultistEpancyHtFierFyCeanDlotCtagonEneDoberEpusBgleBilCnkDtmentBkayBldCiveCympicsBmegaDnCinousDssionDtCnivoreBnboardCcomingCgoingCionClineDookerDyCscreenDetDhoreDlaughtDtageCtoCwardCyxBopsCzeDyBpacityDlCenDrableFteGingHonHveGorCiumCossumCponentEseFingGteDressedHorCtCulentlyBsmosisBtherCterBuchCghtCnceCtageDbackEidEoardFundEreakEurstDcastElassEomeDdatedEoorsDerDfieldFtElankDgoingErowDhouseDingDlastEetEineEookEyingDmatchEostDnumberDplayedEostFurEutDrageFnkEeachEightDscoreEellEhineFootEiderEkirtsEmartEourceEpokenDtakesEhinkDwardEeighEitBvalDryCenDractFllFrchEbidGllGteFlownFoardGokFuiltEcastFoatGmeGokFrowdEdraftHwnGessGiveFueEeagerGterFxertEfedGedFillFlowFullEgrownEhandHgGulFeadHrHtFungEjoyedEkillElaborGidGpGyFoadGokGrdFyingEnightEpassGyFlantHyFowerFriceErateFeachItFideGpeFuleGnEshootHtFightGzedFleepFoldFpendFtateHyGepGockGuffFweetEtakeFhrowFimeFlyFoneFureHnEuseEvalueFiewEwriteBwlBxfordCidantFtionEizeGingCygenDmoronBysterBzoneApacedEmakerDificGerGsmHtFyCddedEingEleFingDlockCganDerDingCjamasClaceEtableDmDpableEitateDtryCmperedHrGsEhletCnamaDcakeEreasDdaEemicDgDhandleDicDningDoramaHicDtherEomimeEryEsEyhoseCparazziEyaDerDrikaDyrusCrabolaEchuteEdeFoxEgraphEkeetElegalFysesHisGzeEmedicGterFountEsailFiteHicDcelEhedFmentDdonDishDkaEingEwayDlorDmesanDoleDrotDsleyEnipDtakeEedEingFtionElyEnerEridgeEyCssableHyFgeEcodeEengerFrbyEingFonFveGismEoverEportEwordDtaEedFlEimeEorEramiEureEyCtchworkFyDernalGityDhDienceGtEoDriarchFotEolFnageGizeCuperCvementErEstoneDilionEngCwingCyableDbackDcheckDdayDeeErDingDmentDphoneDrollBebbleFyCcanDtinDuliarCddlingDiatricEcureEgreeDometerCgboardClicanDletDtDvisCnalizeFtyDcilDdantEingDholderDknifeDnantEilessEyDpalDsionDtagonGramCpCrceiveFntEhEolateDennialDfectedHlyEumeDiscopeFhDjurerGyDkinessEyDmDoxideDpetualElexedDsecuteFvereEuadedIrCskyDoDsimismItDterEicideCtalDiteFionDriEoleumDtedEicoatFnessEyDuniaBhantomCobiaDenixDnebookFyEicsFnessEyDsphateDtoCraseFingBlacardFteEidlyDnkEnerEtDsmaEterFicDtedEformEingGumEonicEterEypusDusibleIyDyableEbackEerEfulEgroupEhouseEingElistEmakerGteEoffEpenEroomEsetEthingFimeDzaCeadingEtDdgeDntifulFyDthoraDxiglasCiableCodDpDtDwDyCuckDgDnderEgingDralDsDtoniumCywoodBoachCdCemDtCgoCintedGrFingFlessFyDseEonCkerDingClarDiceFyEoEshEtelyDkaDoDyesterEgonFraphEmerCnchoDdDyCpcornDeDlarDperEyDsicleDulaceGrGteCrcupineDkDousDridgeDtableFlEfolioEholeEionElyEsideCserDhDingDsibleHyEumDtageFlEboxEcardEedFrEingEnasalEureEwarCuchDnceFingEdDringDtCwderedGingGyDerDwowCxBraisingDnceFingEkerFishFsterDyerEingCeacherGingGyEmbleDcinctFseGionEookEutDdatorEefineEictDfaceEixElightEormedDgameEnancyHtDheatedDlaunchFwEudeDmiereFsesFumDnatalDoccupyErderDpaidFyElanEpyDschoolFribeEeasonFtEhowEidentEoakEsEumeGingDteenFndedIrGseFxtEtyEzelDvailFlentEentEiewFousDwarFshedCidefulDedDmalFrilyGyFteEerEpDncessEtDorDsmEonEsyEtineDvacyFteGizeDzeCoactiveDbableHyFtionEeEingFoticElemDcedureFssElaimEreateEurerDdigalGyEuceGtDfaneGityEessedHorEileEoundEuselyDgenyEnosisEramFessDjectorDlogueFngedDmenadeEinentEoterGionEpterGlyDneEgEounceEtoDofingFreadFsDpellerFrlyGtyEonentFsalGeEsDrateDtectorFgeeEonFtypeFzoanEractFudeDudDvableEedFnEidedHrGingFnceGgEokeGingFloneDwessElerFingDximityEyDzacCudeEishlyDneEingCyBsychicBublicFsherCckerCebloCgCllDmonaryDpDsateEeDverizeCmaDiceDmelCnchEtualHteGredDgentDisherDkCpilDpetEyCrchaseDebloodFredElyEnessDgatoryEeEingDifierFyEstEtanFyDpleFishEoselyDrDseEuableGntFitDveyorCshcartFhairEerEinessGgEoverEpinEupEyCtdownDtCzzleFingByramidDomaniaCthonAquackDdrantDilEntlyDkeEingDlifiedIrGyFtyEmDntumDrrelFyEteredHlyHsGtCenchDryCickenFlyFnessFsandGtepDetDllEtDntetFupleDrkDtDverDzzicalCotableFtionEeArabidCceDingEsmDkDoonCdarDialFnceGtlyFtedGionGorEoEshCffleDtCgeDgedDingDweedCiderDlcarEingEroadEwayDsinCkeDingCllyCmbleFingDpDrodCnchEidityDdomDgedFrEingDkedEingDsackDtingEsCreDityCscalDhDpingCvageDenDineFgEoliEshingBeabsorbDchEquireEtionGveForDffirmDmDnalyzeDppearFlyFointFroveDrrangeEviewDsonEsignFureDttachDwakeCbalanceEteDelDirthDootErnEundDuffEildGtErialEttalCcallEntEptureEstDedeEntEssDhargerDipientEtalFeDklessDlaimEinerGingEuseGiveDognizeEilEllectForEncileFfirmFveneEpyErdEuntFpEveryDreateDtalFngleEifiedGyDycledHrGingCemergeDnactEterFryDxamineCferableFeeGnceDillEnanceFedGryFingGshDlectedHorFxEuxDocusEldErestFmatGedHrGistDractFinEeezeFshEiedDuelingEndErbishFnishEsalFeFingEtableFeCgainEliaFlyDgaeDimeEonEsterGrarHyDressFtfulEoupDularGteHorChabDeatDireDydrateCimburseDssueDterateCjoiceGingFnCkindleClapseGingEtableFedFionGveExEyDearnFseEntingDiableHyFnceGtEcEeveGingEghtEshEveDoadEcateFkDuctantDyCmakeErkFryEtchDedialFyEmberDinderGfulEssionExDnantDodelerEldErseEteEvableGlFedGrFingCnameDdererGingEitionDegadeEwableIyGlFedDounceEvateHorDtableFlEedFrCoccupyGrDpenDrderCpackageGingEintFrEveEyingFmentDealFtedHrEntDhraseDlaceFyEicaEyDorterEseFsessFtDressedEimandFntFseEoachFcessFduceFgramDsDtileGianDugnantElsionHveErposeEtableIyCquestEireFsiteCrouteDunCsaleEmpleDcuerDealFrchElectFlerEmbleEndFtEtDhapeEootEuffleDidenceIyHtFualGeEgnedElientEstantGingEzeDoluteFvedEnantGteErtEurceDpectDubmitEltEmeEpplyErfaceFrectCtailFnerGingEkeEliateDentionDhinkDinalEredGeFingDoldEolErtedEuchDraceGtFinEeadGtEialFevalHerEyDurnDyingEpeCunionFteDsableEeCvealElerEngeFueErbFedGnceHdFsalGeGingHonFtDisableFeFionGtEvableGlFerFingDocableEkeEltFverGingCwardEshDindEreDordFkDrapEiteBhymeBibbonDcageCceDhesElyEnessDketyDottaCddanceEenDeDingCflingDtCggingDidDorCmlessDmedCndDkDseEingCotCpcordDenessFingDpingEleFingDtideCseDingDkDottoCtalinDzyCvalDerbankGedGoatFsideEterFingBoamerEingDstCbbingDeDinDoticsDustCckbandEerFtEfishEinessGgElikeEslideFtarEyCgueCmanDpCpeDingCsterDyCttenEingDundaCuletteDndingGshFnessFupFwormDtineGgCverDingCyalBubbedFrEingEleDdownDyCckusCdderCgCinedCleCmbleFingDmageDorCnaroundDdownDnerEingEyDtDwayCptureCralCseDhDtCtAsabbathDotageCcramentEedEificeCddenElebagGdFingDlyDnessCfariDeguardEhouseElyEnessDfronCgaDeDgingEyCidDntCkeCladEmiEriedFyDineDonEonDsaDtDutaryFeDvageGingFtionCmeDpleFingCnctionGtyFuaryDdalEbagGnkGrFlastFoxEedEfishEingElotEpaperFitEstoneHrmEwormEyDitaryFizerDkDtaCplingDpinessEyCrcasmGticDdineCshDquatchDsyCtchelDiableEnEricalEsfiedGyDurateFdayCucinessEyDnaCvageEnnaDedDingsEorDorCxophoneCyBcabbedFyDldedFingEeEingElionFopEpingDmDndalEnerFingEtDpegoatDrceFityEecrowFdEfEilyFnessEringEyDvengerCenicCheduleEmaticFeFingDillingDnappsDolarCienceFtistDonCoffDldingDneDopEterDpeDrchEebookFcardFdFlessFrEingEnEpionDtchDundrelEredFingEtingFsDwlingCrabbleEgglyEmbledIrEpEtchEwnyDeenDibbleFeFingEmmageEptDollEogeEungerDubbedHrEffyEnchEtinyCubaDffDlptorGureDrvyDttleBecludedGingFsionDondDrecyFtDtionalEorDularErelyFityCdanEteFionGveDimentDuceFingCgmentCismicDzingCldomDectedGionHveGorDfDtzerCmanticDesterDicolonEfinalEnarEsoftFweetCnateForDdDiorDoritaDsationEitiveHzeEuallyFousCpiaDtemberEicEumCquelFnceFsterCriesDmonDotoninDpentDratedDveEiceFngCsameDsionsCtbackDtingEleFingDupCvenfoldFteenGhGyErityBhabbyDckDdedEilyFnessGgEowEyDftDkableEilyFnessGgEyDleElotGwDmeEpooErockDnkEtyDpeEingDreEpenerGrFieFlyFnessDwlCeathDdDepEtDlfElEterEveFingDrryCieldDfterFingFlessFyDmmerFyDndigEeEgleEinessGgEyDpDrtDveringCockDneDpliftEperFingEtalkDreEtageFcakeGutFenGrFhandFlistGyFnessFsFwaveFyDutDveDwbizEcaseEdownEerEgirlEingEmanEnEoffEpieceFlaceEroomEyCrankEpnelDedderGingEwdlyDiekEllEmpEneFkEvelDoudedDubberyFsEgEnkCuckingDdderDffleGingDnDshDtCyBiameseCberianDlingCdingCerraDstaCftCghingClencedHrFtDicaFonDkDlinessEyDoDtDverCmilarlyFeDmeringDpleFifyFyCncereGityDgerEingEleEularDisterDlessDnerDuousCpCrenCsterCtcomDterEingDuatedGionCxfoldDteenEhEiesGthEyfoldCzableGyDeDingDzleFingBkaterEingCedaddleDletalGonDpticDtchDwedFrCidDedErEsDingDlledGtFfulDmmedGrFingEpilyDncareEheadElessEningFyEtightDpperFingDrmishEtDttleCydiverDlightFneDpeDrocketDwardBlabDckedGrFingFnessFsDinDmDnderEgDppingEstickDshedFingDteEherDwCedDekEpEtEveDptCiceableFdFrEingEkDderFshowEingDghtedGingGlyDmnessEyDngingFshotEkyDpDtDverCobberyDganDpedEingEpilyFyDtDuchingGyCudgeDgDmDrpDshCyBmallDrtlyFnessDsherFingFupCellEtingCileEinglyDrkDteEhEtenCockDgDkedFlessEinessGgEyDlderDothDtherCudgeFyDgglerGingElyEnessBnackDggedDkingDpDreElDzzyCeakDerEzeFingCideDffDppetFingDtchCooperEzeDreEingEkelEtDutDwbirdFoardGundEcapEdriftGopEfallFieldFlakeEinessElessEmanEplowEshoeFtormFuitEyCubDffDggleElyEnessBpeakErfishFheadFmanGintDciesFmenEkedFledFsEtacleGtorFrumEulateDechEdDllbindFerFingDndableFerFingEtDwChereFicalDinxCiderDedDffyDllEtDnachFlEdleEnerFingEoutEsterEyDralEitedGismGsGualClashedGingGyEtterDeenEndidGorDiceFingEnterDotchyDurgeCoilageFedGrFingFsDkenFsmanDngeFyEsorDofEkilyFyElEnDreEtingFsFyDtlessFightEtedGrFingFyDusalFeEtCrainEngEwlEyDeeDigEngFkledIrFtEteDoutDuceEngDyCudDrDtterCyglassBquabbleEdEllEnderEshEttedHrGingDeakFlerGingFmishEegeeFzeGingDidEggleHyEntEreFtEshierGyBtabilityHzeEleDckDdiumDffDgeEingEnantGteDinableFedFingFlessDlemateFnessElingGonDminaEmerEpDndEkDpleFingDrboardEchEdomFustEfishEgazerEingEkElessGtFightGtEringFyEshipEterFingFleGingFupEvedFingDshDteEicFsticEueFreFsFteGoryDunchDysCeadfastFierGlyFyingEmDedEpErableFingFsmanDgosaurDllarDmDnchFilDpDreoEileGityHzeElingEnnessFumDwCickDffenFlyFnessEleFingDllnessEtDmulantHteGiGusDngerFilyGngFrayFyEkingFyDpendEulateDrDtchCockDicDkeDleDmpDnewallHreGorkEingEyDodEgeElEpDplightEpableGgeFedGrFingEwatchDrableFgeEeroomFwideEmDutDveDwawayEingCraddleEgglerEinedHrGingEngelyHrGleEtegicHyFusEwEyDeakFmEetEngthFuousEpEssEtchEwnDickenFtEdeEfeEkeFingEveFingDobeEdeEllerEngboxGlyGmanDuckFtureEdelEggleEmEngEtCubbedFleGyFornDccoEkDdentEiedFoEyDffedFingFyDmbleGingEpDngEnedGrFingEtDporDrdilyFyCylingFshlyGtFzedEusBuaveCbarcticEtomicDdivideEuedFingDfloorDgroupDheaderDjectDleaseFtFvelEimeDmarineEergeGsedEitterDpanelFrElotErimeDscribeHptEectorEideGingHzeGyEoilFnicEtanceEystemDtextEitleElyEotalEractEypeDurbDwayEooferDzeroCcculentDhDtionCddenDokuDsCffererGingEiceFxEocateErageCgarDgestCingDtableHyEcaseEorClfateEideFteEurDkDlenDphateFuricDtryCperbowlFglueFheroFiorFjetFmanGomFnovaFviseDperElierFyEortDremacyGeCrchargeDelyEnessDfaceGingEboardEerDgeryEicalFngDnameDpassElusEriseDrealFnderEogateFundDveyEivalGeGingGorCshiDpectFndGseDtainedIrBwabDddlingDggerDmplandDnDppingDrmDyCearEtDepDllDptDrveCifterFlyFnessDmmableFerFingEsuitEwearDngerFingDpeDrlDtchDvelDzzleCoonedEpEshDreEnCungBycamoreCmpathyEhonicHyEtomCnapseDdromeDergyDopsesGisDthesisGticCrupCstemAtshirtBabascoDbyDlefulFsFtFwareEoidCckinessGgEleFingEyDoDtfulEicalGsFleElessCdpoleCekwondoCgCintedCkeDingClcumDismanDlDonCmaleDenessErDperCnkDnedFryEingDtrumCpelessEredFingEstryDiocaDpingDsCrantulaDgetDmacDnishDotDtarElyEnessCskDselDteEinessGgEyCtteredEleFingEooCuntCvernBhankDtDwCeaterFricsDeDftDmeDologyErizeDrmalFosDsaurusEeEisEpianCickenGtFnessDevingGshDghDmbleDngEkElyEnerGssFingDrstilyHngGyEteenFyCongDrnDseDusandCrashDeadFtenEefoldDiftEllEveFingDoatEbbingEngEttleEwawayFbackFerFingCudDmbEpingDrsdayDsCwartingCyselfBiaraCbiaCdalDbitDinessFgsDyCgerDhtenFlyFnessFropeFwadDressCleDingDlDtCmidEngDothyCnderboxDfoilDgleFingFyDkerElingDselEmithDtDworkDyCpoffDpedFrEingDtoeingFpCringCssueBraceEingEkEtionForDdeEingFtionDfficDgedyDilingFsideEnEtorDnceEquilEsferGormFlateFpireGortHseDpdoorEezeGoidEpedGrFingEsDshDvelFrseFstyDyCeacheryEdingFmillEsonEtDbleDeDkkerDmbleGingEorDnchEdDspassCiageElEngleDbesmanEunalGeFtaryGeDcepsEkeryFilyGngFleFsterFyEolorEycleDdentDedDfleEocalsDllionEogyDmesterEmerFingEnessDnityDoDpodEpingDumphDvialCoddenDllingDmboneDphyEicalGsDubleGingEghEsersEtDwelCuceEkDffleDmpDnksDstableFeeFfulFingFlessDthCyBubbyDelessDularCckingCesdayCgCitionClipCmbleFingDmyCrbanEineEofanFjetEulentDfDkeyDmoilDretDtleCskCtorDuCxBweakDedEtEzersDlveDntiethFyDrpCiceDddleGingDgDlightDneEsDrlDstableFedGrFingFyDtchEterBycoonCingCkeAudderBltimateHumDraBmbilicalDrellaCpireBnabashedEleDdornedEvisedDfraidDiredDlignedEteredDrmoredDshamedDuditedDwakeFreCbakedElanceDeatenEndFtDiasedEttenDlendedFssedEockDoltedEundedExedDraidedEidleEokenDuckledEndleErnedEttonCcannyEppedEringDertainDhainFngedFrtedEeckDivilDladFimedFmpedFspEeEipEoakFgFthedDoatedEiledEloredEmbedFmonEokedErkFruptEuntedFpleFthEverDrossFwnEushedDuredFiousFledEtCdamagedEtedEuntedDeadEcidedEfinedErageGrmFcoatHokGutFdogHneFfedHedGootFgoGradFhandFlineIgFmineGostFpaidHssHyFrateFtakeGoneHokHwFuseFwearHntGireEsiredDilutedEvidedDockedEingEneDraftedEessEilledDustedDyingCearnedFthEseFilyFyEtableFenDditedDlectedDndingEgagedEviedDqualDthicalDvenDxpiredFosedCfailingFrEstenEzedDeelingDiledFledEttedGingExableFedDlawedDocusedEldEundedDramedEeezeEostedFzenDundedCglazedEovedEueDodlyDradedEeasedDuardedEidedChappilyGyErmedDealthyFrdGingFtedElpfulDiddenEngeEtchedDolyEokCicornEycleDfiedGrEormedHlyEyDmpededDnjuredEstallFuredEvitedDonDquelyDsexualEonEsuedDtDversalHeCjustlyCkemptDindDnottedFwingGnClacedEtchEwfulDeadedFrnedFshEssEveledDightedEkableEmitedEnedFkedEstedEtEvableDoadedHrEckedGingEvableFedGlyFingDuckilyGyCmadeEnagedFnedEppedErkedEskedGingEtchedDindfulExableFedDoldedEralEvableFedFingCnamableFedEturalDeededErveGingDoticedCopenedEposedCpackEddedEidFntedFredEvedDeeledDickedElotedEnnedDlannedGtedEeasedFdgedEowedEugDopularDrovenCquoteCrankedEtedEveledDeachedFdFlEelingEfinedElatedEntedEstEtiredEvisedDiggedEpeEvaledDoastedEbedEllDuffledElyEshedCsaddleEfeEidEltedEvedForyDcathedEentedErewDealedFtedEcuredEeingFmlyFnElectFfishEntEttledDhackleFkenFvedHnEeatheEippedDightlyFnedDkilledDlicedDmoothDnapDocialEiledEldFvedErtedDpoiledFkenDtableFffedFmpedEeadyFrileEirredFtchEoppedEuckFffedEylishDubtleHyEitedEreDwornCtaggedEintedEkenEmedEngledEppedExedDhawedEreadDidyEeElEmedGlyEtledDoastedEldEuchedDrackedFinedEeatedEiedFmmedEueFthDurnedDwistDyingCusableEedEualCvaluedEriedFyingDeiledGingEntedDiableEsitedDocalCwantedErlikeFyEshedEtchedDeaveEdElcomeFlDieldyEllingEndEredEttingDomanlyErldlyFnFriedFthyEundEvenDrappedEittenCzipBpbeatCchuckDomingEuntryCdateCfrontCgradeCheavalEldDillDoldCliftedGingDoadConCperCrightEsingEverDoarEotCscaleDideDtageFirsFrtFteEreamFokeDwingCtakeDightDownDurnedCwardDindBraniumCbanCchinCethaneCgencyFtDingCologistGyBsableDgeCeableDdDlesslyDrCherCualBtensilCilityFzeCmostCopiaCterAvacancyFtEteFionCgabondDrancyGtlyDuelyFnessCliantEdEumDleyDuablesEeCnillaEshEtyDquishDtageCporizerCriableHyEedFtyEousDmintDnishDsityDyingCscularDelineDtlyEnessBealCganDgieChicularClcroDocityDvetCndettaEingEorDeeringDgefulDomousDtricleEureDueEsCrbalizeGlyEoseDdictDifyDseEionEusDtebraeEicalFgoDyCsselDtCteranDoCxinglyBiabilityEleCbesCceDinityDtoryCdeoCewableEerEingElessEpointCgorousCllageFinCndicateDeyardDtageColateGionGorEetEinCperCralDtualFousDusCsaDcosityFusDelikeDibleGyEonEtingForDorDtaCtalityGzeFlyEminsCvaciousDidlyFnessCxenBocalistGzeFlyEtionCiceEingDdClatileDleyDtageDumesCterDingCucherCwedElCyageAwackinessCdCferDfleCgedErEsDgleDonCkeDingClkDmartDnutDrusDtzCndDnabeDtedEingCsabiDhableEbasinFoardGwlEclothEdayEedFrEhouseEingEoutEroomEstandEtubDpDtingCtchDerCvinessFgDyBhackingFyDmDrfCeatDneverCiffDmsicalDnnyEyDskingCoeverDleDmeverDopeeFingFsCyBickCdelyEnDgetDowDthCeldableFerCfeDiCkipediaCldcardGtEerEfireFowlElandFifeFyEnessDledEfullyEingEowEpowerDtCmpCnceEingDdDgDkingDnerEingsDterCpeCredElessDingDyCsdomDeDhDplikeEyDtfulCzardBobbleFingFyCkClfDverineCmanhoodFkindFlessGikeGyDbCofDingDlDzyCrdDkDriedGrFsomeEyDseningEhiperEtCundCvenCwBrangleDthCeathDckageFerFingDnchCiggleGyDnkleGyDstDtingEtenCongdoerFedFfulFlyFnessDughtAxboxBeroxAyahooCmCnkingCppingCrdDnBeahDrbookElingFyEningDstCllingDpCnCsterdayBiddishCeldCnCppeeAcheetahAyodelCgaDurtCnderCyoBummyAzapBealousCbraCnCppelinCroCstfullyEyBigzaggedCpfileDpingEyDsCtBodiacCmbieCneDingCokeeperDlogistGyDm"); + +// node_modules/@zxcvbn-ts/language-common/dist/passwords.json.mjs +var passwords = decompress("A123456ApasswordA12345678AqwertyA123456789FEB11111B234567AdragonA123123AbaseballAabc123AfootballAmonkeyAletmeinAshadowAmasterA696969AmichaelBustangA666666AqwertyuiopA123321D4567890ApussyAsupermanA1qaz2wsxA7777777AfuckyouAjordanAqazwsxAjenniferA123qweA000000AkillerAtrustno1AhunterBarleyAzxcvbnmAasdfghAbusterAandrewAbatmanAsoccerAtiggerAcharlieArobertAsunshineAthomasAiloveyouAfuckmeArangerAdanielAhockeyAgeorgeAcomputerAmichelleAjessicaAstarwarsAassholeApepperAklasterA112233AzxcvbnAfreedomAprincessAjoshuaAmaggieApassAgingerA11111111B31313AfuckAamandaBshleyAloveAcheeseA159753AnicoleAsummerAmatthewAchelseaAdallasAbitemeAmatrixAwilliamAyankeesA6969AtaylorAcorvetteAaustinBccessAmartinAheatherAthunderAmerlinAsecretAdiamondAhelloAanthonyAhammerAfuckerA1234qwerAsilverAgfhjkmAjustinApatrickArichardAbaileyAinternetAsamanthaAgolferAscooterAtestAorangeAcookieAq1w2e3r4t5AmaverickAjacksonAsparkyAmickeyAphoenixAbigdogAsnoopyAguitarAwhateverAchickenAmorganAandreaAcamaroAmercedesApeanutAferrariAcowboyAfalconAwelcomeAsamsungBexyBteelersAjosephAsmokeyAdakotaAmelissaAarsenalAboomerAeaglesAtigersAmarinaAnascarAboobooAgatewayAporscheAyellowAmonsterAspiderAdiabloAhannahAbulldogAjuniorAlondonApurpleAcompaqAlakersAicemanAqwer1234AhardcoreAcowboysAmoneyAbananaAncc1701AbostonBrandonAtennisAjohnnyAmillerAq1w2e3r4AcoffeeAscoobyA123654AedwardAnikitaAmotherAyamahaAbrandyBarneyAchesterAfuckoffAoliverAcharlesAplayerAknightAforeverAstevenArangersAmidnightAchicagoAbigdaddyAredsoxAvictoriaAbadboyAangelApleaseAfenderAchrisAjasperCmesAslayerArabbitAnatashaArachelAbigdickAmarineAwizardAmarlboroAraidersAprinceAcasperAfishingBlowerAcrystalAjasmineApantiesAiwantuAadidasAwinnerDterAgandalfApassword1AenterAghbdtnA1q2w3e4rAangelaAmikeAgoldenAlaurenAcocacolaAjordan23AwinstonAmadisonAangelsAblowmeApantherAsexsexAbigtitsAspankyAbitchAshannonBophieAjohnsonAasdfasdfAdavidAhornyAthx1138BoyotaBigerAmurphyAdickAcanadaAdanielleA12344321AblowjobA8675309AjonathanAliverpooAmuffinAcooperAapplesAjackieAdennisAblackAqwerty123Apassw0rdAjohnAabcd1234AsandraApokemonA123abcAslipknotAcarlosAqazxswA123456aAscorpionAqwaszxAnathanAbutterAstartrekArainbowAasdfghjklArazzBedskinsAnewyorkAgeminiAcameronAqazwsxedcAfloridaAliverpoolAturtleAnicholasAvikingAboogerAwilsonAsierraAbuttheadAdoctorArocketA159357AvictorAdolphinsAcaptainAbanditAjaguarApackersBookieBeachesA789456AasdfAblueAdolphinAhelpmeAtuckerBhemanBiffanyAmaxwellAjeremyAqwertyuiAshitheadAdebbieAalbertAmaddogAloversAmonicaAalexAunitedAgiantsAnirvanaAmetallicAhotdogArosebudAmountainAbenjaminAwarriorAstupidAelephantAsuckitDcessAbond007AjackassAbonnieAalexisApornAluckyAjasonAscorpioBamsonAq1w2e3Arush2112AazertyAfreddyAdriverAwillieAcalvinA1q2w3e4r5tAsydneyAgatorsAdexterAred123A12345aF6qAbubbaAcreativeAgolfAvoodooAhappyAarthurAtroubleAamericaAnissanAgunnerArebeccaAstellaAgarfieldBordonAjessieAbullshitAparkerAasdfghjkA5150AfuckingAapolloAjackA1qazxsw2A2112AeminemAdecemberAlegendAairborneAbeavisAaugustAbearAappleAbrooklynAgodzillaAskippyAbuddyA4815162342AqwertAkittenAmagicAshelbyAbeaverAphantomAfredAnothingAasdasdAwilliamsAxavierAbravesAdarknessAblink182AtravisAcopperAtomcatAplatinumAqweqweAgirlsA01012011AbigboyAgreenApowerA102030AanimalApoliceA11223344AonlineAvoyagerAlifehackA12qwaszxAfishAsniperA315475AtrinityAwalterAblazerAheavenAloverAsnowballAplayboyAbubblesAlovemeAhootersAcricketAmarvinAwillowAdonkeyAtopgunAnintendoAsaturnAfamilyAnovemberAgabrielAdestinyApakistanBumpkinAdigitalAsergeyAchanceAexplorerAredwingsAprivateAtherockArunnerAtitsA789456123AlasvegasAguinnessAbeatlesAfireAcassieBhristinAqwerty1Aasdf1234AcelticAbroncosAandreyA007007AbabygirlAnelsonAdonaldAscottAeclipseAcartmanAfluffyAlouiseAmichiganAtestingAcarolinaAlittleAsamuelAalexandeAbirdieAsteveAcherryApanteraAsharonAgibsonAvampireAmexicoAdickheadApeterAbuffaloAmontanaAgeniusAbeerAflyersAmaximusAschoolAminecraftAlovelyAstalkerAmetallicaAdoggieAcarterAkristinaBimberlyAspencerDedyAbarbaraAsnickersBabrinaAcarmenAmarcusAbroncoAyankeeAfriendsAparadiseAlol123AdreamsAmagnumAhorsesAcoolBarolineA147258369AlacrosseAou812AgooberAmemberAqwertyuAenigmaAscottyApimpinAbollocksBrianAcockAsurferBammyAgenesisApoohbearAdaveAstarAasd123AqweasdzxcAbabyAracingAfriendAhello1BawaiiAeagle1AbillyAviperAoctoberAvanessaApoopooAeinsteinAboobiesAstanleyA12345qAwalkerAbitchesApaulAdrowssapAstephenAcourtneyAsimpleAalaskaAbadgerAactionAjakeAbillAdeniseAjesterA111222AspitfireAdrummerAforestApatriciaAmaryjaneAchampionAdieselAsvetlanaArockAfridayAkevinAmarkAgregoryApamelaAfrankAhotrodA147258AchevyAandersonAlucky1AdouglasAwestsideAsecurityAgoogleAbadassAshortyAtesterBhumperAhitmanAmozartAgeneralAreddogAboobsAzaq12wsxAmusicA010203AlizardAalexanderAmelanieAa123456AruslanA123456789aAvincentAeagleA1232323qAsweetAteresaAscarfaceA147852Aqwerty12Aa12345AmarshallAoliviaAveronicaApornoAbuddhaAspiritAfrankieAmoney1AstargateAantonioAlibertyAnatalieAmercuryAnarutoAqwe123A12345qwertAsuzukiBemperfiAkingApopcornAspookyAmarleyAsystemAbrittanyAclaudiaAkellyAscotlandAfreeAkittyAcherokeeAvikingsAsimpsonsAdeathAleslieArascalAqweasdAjimmyAloveyouAhummerAmichael1AallisonArockyApatchesArussiaAadrianAjupiterApenguinAcumshotAhowardApassionAhondaAvfhbyfAandreAvladimirAfranklinAsandmanA123789AinfinityAhomerAbastardAraiderApassportAassmanAsuckerAfantasyAbulldogsA1234554321AhorneyAdominoAbudlightAironmanAdisneyAnormanAusuckballz1AsoftballAbishopAfrancisAbrutusAfordAredrumAbrookeBigredAjeffreyCsusAfktrcfylhAkarinaAmarinesAkawasakiAdiggerAirelandAoksanaAfiremanAcougarCllegeAshitAaliciaArussellAhoustonAmondayAbradleyAcuntAsarahAniggerAjusticeAsuperAwildcatsAtinkerAduncanBancerAlogitechAavalonAswordfisAevertonAreggieAmotorolaAalexandrAmollyAtimothyAhentaiApussy1AclaireApatriotsAmadonnaAcoloradoAeugeneAducatiAkermitAjuventusAindianAconnorAgaloreAfreeuserAsmoothAhouseAtitanicAboogieAsimpsonAwarcraftBolverinAelizabetAarizonaAsaintsAvalentinAgeorgiaAasdfgAtest123AaccordAmattAbaxterAdenverAmitchellAchristApassword123AyfnfifAslutBmithBtinkyAzacharyArolandAnaughtyBcc1701dAspidermaAchopperAbrendaAhello123AextremeAvirginiaAwaterAskylineApoopAzombieApearljamAfroggyApirateAfylhtqAvisionA123qweasdAawesomeBlyssaAdreamerApredatorAbulletAempireAwolfAcharlie1AkirillA123123aApeopleCnisAelvisApanthersAskipperAnemesisApeekabooArasdzv3AsimonAalisonArolltideAamericanAcardinalAarnoldAchevelleAdaddyApsychoAhappy1AdangerAmookieAwankerAmanutdA9379992AtommyAhobbesAvegetaAgoblueA852456AburtonAfyfcnfcbzApicardA159951AbobbyAwindowsAloverboyEloveAvfrcbvBictoryA123654789AbambamAturkeyAseregaAtweetyAhiphopAgalinaAchangemeAroosterApolinaAberlinAsuckmeAtaurusAelectricAronaldAavatarA134679AmineAraptorAalpha1AmaksimAspringAbrazilAericAbigcockAnewportAhardAkennethAhendrixAmadmaxAenglandAa1b2c3BlphaAsublimeAbritneyAfranceAdarksideAbigmanAherculesAlawrenceAwolfpackAclassicAletmein1BincolnAronaldoA741852963AspidermanA1q2w3eAblizzardAcheyenneA123456789qAwombatAbubba1Atiger1AcjkysirjAraymondAbrotherAkristenApandoraAdevilsAzxc123AsimoneAholidayAwildcatAhorseAkramerA12312B47852369Abuddy1AsterlingAcaesarAalabamaAcarrieAbondageBasketballAsportsApussycatBickleAcatch22AleatherAshaggyAa1b2c3d4AchronicAflowersAqaz123Bqq111ArobbieAadminAgracieAamberAfreepassAairplaneAperfectAkodiakAbillybobAkatanaAsunsetAcrazyAgoodAstingrayAmariaAannaAsnowmanAphpbbAangel1AchocolatAzeppelinAgarciaAdetroitAwolvesApontiacAcandyAfirebirdAvaginaAgundamApanzerAoutlawAtimeAprettyAfisherAconnieAhoneyAbusinessAtrevorAredheadAhardonAgreendayAtarheelsA01011980AnastyaAhellfireAcobraAengineerAdragon1AsavageBerviceDenityBashaAmicheleAdudeAlickmeAfireballA1029384756AwhiteArememberAdarkstarAmirandaAflashAmustang1A01011A124578AharveyAoscarAstrikeAfreddieApavilionAbeautyBobafettA01012000AadamAdbrnjhbzAjeffAbigmacAchris1AdukeAclintonAbowlingAjennyAnataliAfutureAharrisonAjonesAwallaceBelcome1AswimmingAapacheArulezApyramidAdodgersAgirlAwhynotAfuckitAdefenderAteensAmorrisAtrooperA135790AcancerApreciousBackardAluciferApopeyeAweaselA142536AravenAicecreamAstewartAtannerAswordfishAblondeAsandyApresarioArockstarAviktorAmanagerAcherylAnortonAjames1AcontrolAwutangAairforceAjulianAatlantaApimpAspikeAthailandAlookingAcasinoA741852A21122112AparisAmouseAlennonA456123AbluebirdAtheoneAhawkeyeCckerAlisaAdustinAelaineAnfnmzyfAsailorAcatfishAgoldfishAmaximaAtattooAbarbieAlightAdesignApervertAmachineAhermanAwranglerArocksAtrucksAnipplesAroscoeAtornadoAjerryAlightsAbubbleAcadillacA666999AmadmanAorlandoApegasusAtargetAlonghornBauraAphilipAbrownsAeatmeAstefanAcannonAdilbertAballerAmicrosoftAwinnieAchristiaAkatieAqazwsx123AshooterAxfilesAqazqazAlesbianAstreetBeattleAcoronaAamateurActhutqApreludeA246810AbeachAmalibuAfreakyAassassinAintegraAatlantisA123qweasdzxcApussiesAdragonsAiloveuAmonkey1AunicornAlonewolfAreginaA753951AstealthAkristinAtonyApeeweeAopenupAbobcatAstaceyBoftwareAnewtonAleonardoAstudentBrinivasAangelinaAyoungAenjoyAvalentinaAtriggerAzaqwsxAlolitaAathenaAshotgunAcoyoteAbruinsAveronikaAdollarAcountryArocky1AjokerAbabydollAlestatAwordpassAhottieAsmileyApotterArandomAsweetyAbutterflyAwoodyAchipperAsnakeBamuraiAvideoAgizmoAmaddieAdevildogAvalerieAmistressAflipperBreedom1AexpressApowersAsoso123aljgAcessnaAteacherAgoldieAmooseApolarisBigletAcookiesAelenaAmontrealAhjvfirfAladiesAwolfgangAfatboyAscullyAfatherAsingleAwickedAdaisyAfetishBoobarAcastleAtickleAbunnyApepsiAballsAtransamAdfvgbhA31415926Aoicu812AimpalaAsundayAbootyAhotstuffAronnieAjasminAryanAgambitAtoshibaAbasketbaAlancerAbirthdayAtexasAstephaniAjessica1AhookerAknicksA314159ArobertoAstingerAtesttestAfuckyou2AkathleenAsavannahBhamrockAbensonAsquirtAdeftonesAtruckerAnickAredneckAgoldbergAalfredAblasterAsiemensBhellyArenegadeAmansonAsubaruAibanezAblondieAhamiltonAcaseyAswingerAreaperAcristinaAminnieByloveAharryAgalaxyAlindsayAdudleyAfarmerAgloriaAspecialAblahblahAenterpriA1234abcdAtravelAbabylon5BigoneAsweetpeaBugarBmokeBkeeterAfuckedAindianaAgreatAfickenAtrfnthbyfAmaster1AfreemanAcurtisAsmittyAmarinoAjoanneAbigfootAescortAbabesAcheckAlarisaAtrumpetCistanAspartanAbabylonAasdfghjAsisterAvaleraAstormyApaladinAandreasAcavalierAmarathonAhamletAaardvarkAbutterflBigboobsAmisterBanchesterAyankees1ArustyAnapoleonAsevenAindigoAhornetAskaterAjeromeApierreAwonderAtorontoAroseAindiansAkarateAbuckeyesA01011990AjulieAhesoyamAfredfredAchargerAhighlandAsweetieAhollandA1qaz2wsx3edcAchiefsAdiamondsAbuckeyeAauroraAhotsexAcampbellAgriffinAbrandiAredmanApassworAchandlerAdrpepperAmonikaBaidenAelizabethAleonardAbernieBrownApornstarAgardenAstormAautumnA12345678910AlindaAthuglifeAmillieAjungleApencilAtomtomAinsaneApizzaAtimberAjesus1AsherlockAmariahAaudreyAdavid1A1a2b3cAhamsterAaragornApioneerAtechnoAcatdogAlollolAtriumphAsidneyA141627A321654AfktrctqAnoneAsophiaAmorpheusAislandAwetpussyAhobbitAblablaAeroticAshadow1AaaronApascalAsampsonAconsumerAjustmeAmarionAstonesAchrissyAtylerAnadineAmarieAgoforitAburgerApitbullAkelseyAadgjmptwAspartakAgermanAkarenBissmeAhuntingAkaiserAmarthaAcolorsAartistAharoldAbassAitaliaAsammieAbarcelonaAmarioAnicolasAvirginApebblesAsundanceAisabellaAoverlordAemeraldAcallieAdoggyAirinaAracecarAisabelleAgermanyA1478963AgoddessAchangeAwesleyAnippleAbasketAjoejoeAhollyApoisonAzipperAalpineAshirleyAelementAhuskersAmarcelAeddieAdannyAchristyApussysAsakuraAchichiAinsideAultimateAdirtyAnicolaBcc1701eAblackieAq12345AomegaAwatsonArommelAmatthew1AgeronimoAnikkiAcasertaAtrojanA123qwe123AphilipsAsergioAnuggetAsammy1AtarzanAbassmanAwarrenAtrixieAchicksAaleksandrAcreamAwebsterAhelpAsherryAmanuelAportugalAdodgerAanakinAbobbobCmberAmichelBadnessAsuperflyAq1w2e3r4t5y6AloserA123asdAflorenceAyvonneAfatcatAglobalAybrbnfAenergyAdesireAwrinkle1AsoldierAbiancaAsexualAwarlockAmartinaAbabeA951753A11235813A51505150AandreiAlarryAseminoleApeaceAalejandrAwesthamAconcreteAaccess14AharrisAmargaretAhectorAchristopAnakedAladybugBetmein2AnetworkAbernardAweedAtintinAqazxswedcAtromboneAchuckApleasureArhbcnbyfAhomeBistoryAblueskyAshermanAloganAjanuaryAoneloveAcottonBhristianBdtnkfyfAsunnyAarchieAholdenAwhoreAbriannaAvfvjxrfAtitansAstallionAlindseyAsingerAtruckAsmileApartyAmissyAhansoloAangeloAjoannaAnataliaAbeagleAphillipBanamaAsmilesAblue22AjuiceAqawsedAinfernoAmoonCngooseAconnectAkingkongAsnatchAflatronAsex4meAbluemoonAturboArockerApersonalAemilyAblessedAsnakesAdominicAjoeyAforgetBingerAbeetleAjamaicaAalbertoB1234567AmulderAfuckyou1AjamieAsusanAimmortalAheadApassatBlasticA123454321AdietcokeAspunkyBuckAlongAanthony1AwhiskeyAmonitorAgiovanniAcactusAripperAspyderAmarkusAplanetAmagic1AteenApattonAexigenAstickyAwatersAslutsAnolimitAdanielaAhollywooAabigailBpple1AmorrisonAkatrinaAtrunksA1234321AandyBssassBlwaysAdianaBeedeeA14789632AcliffordAaprilAspeedAjapanAmissionApicklesAmillionAsailingAfreakAholmesAboneheadAfernandoAghbdtnbrA112358A911911AcharlottAdeltaAyomamaAdarrenArubberAnewmanAmolly1A1123581321AfasterAcummingAberthaAmemphisAsylviaAopenAilovesexAmauriceAwilliam1AhongkongAolgaAjumperAunrealAgeheimArodneyAnylonsAsebastiaApentiumAlegionAshalomAkennedyA555666AbrooksAmovieAdodgeBreamAgrahamAspriteAcuriousApacificAloulouAfuntimeAphillyAferretAninersAorionAwerewolfAmiltonAcantonaAkingdomAstarsAafricaAofficeAboeingAgilbertAabgrtyuApiratesAsuper123BheilaAfrenchAsweetsAcooldudeApalmerAeternityAlollipopAtottenhaAgreen1AstockingAmoniqueAanythingAfosterAirishAjackoffA7895123AbiscuitAdrizztAcameraBolumbiaAfossilAmoomooBakaveliAtraceyAcolt45ArobinsonAisabelAmartiniAsalmonBhastaAjerseyAverbatimAmaniacAsnapperBatan666AnastyAsolomonApatriotAjacobAstandardBhavedAblackcatAasdzxcApunkrockAraistlinAinfantryAqwerty12345A4128AdillonAgeraldAtwisterAricardoAwaterlooAcjkywtBlaytonBrimsonAserenaA01012010AoxfordAmaxmaxAdenisAflightAcondorAseinfeldBilviaAbiggieAmaxineBusicmanAravensAteddyAcolleenAbruceAwolfmanAsharksAmegadethAcosmosAvelvetAbuttAkeeperAfoxtrotAgarrettAblack1AdamienAantonAsesameBkywalkeAgn56gn56AbansheeAcatsAsquirrelAwolverineAdogsAsunriseArickAghostAwesternAgrendelAsucksAroxanneAprivetAlegolasAfrogBelixAmarlinAstoneAherbertAlvbnhbqAqazwsxedAcarrotAbladesAfrostyAstardustA121314AhelenaAbrownieAgroovyApennyAbutlerAcoolioAtwilightAdaytonaAlickerApeanutsAintrepidApikachuAtrainsAmollieAvanhalenAjerichoAhersheyAstriderAlobsterApunisherAgraceAbirdAzaq123AbottomAninjaA1234567aAmurrayAkansasAshogunAgoblinAsearchAneptuneAballAshowtimeAdarwinAamadeusAsuzanneAfuckfuckAseven7Ajason1A111222333AoldmanAbrunoAshowmeAhenryAgetsomeAmuscleAobiwanAsupportArfrfirfAskittlesAekaterinaAgoldAwhitneyAsharkAmaestroAanalAdanniAtankerAenglishAtarheelAfighterAthanksAblue123AhannibalAcapitalAnewlifeAanubisAgothicAchaosAbluesAcindyAsabineAthunder1AromanAprestonCincesAbrendanAslickA123456zAevelynApythonAtest1ArichieAtequilaAbossAcodyAdevilAchelsea1BloverAdeleteAmirageAbloodAsurfingA1q2w3e4r5t6yAbentleyAportlandCtatoAbagginsAreviewAporterAchubbyApanasonicAsandiegoBoonersAbuffyCckAtinaAderrickApenelopeAblackdogAharmonyAfusionAdimaAmatureClcolmAallenAmaryAbuttonsA1a2b3c4dAcalifornAsafetyAplaytimeAdaggerAmoscowAswallowAwarriorsAbytemeAstimpyAgangsterAlucasAchristineAturnerAiversonAlesterAchargersAliquidAasdf123AmushroomAcrackerAdingdongAlucky7AmistyAnymetsA456852ArobinAbigguyAmobileAtazmanAgregAnimrodBewpassAmiamiAcrusaderAbuggerAstrangerAdkflbvbhAanastasiaAmarcoAvolumeAmastersBonroeBiguelAdoodleAcollinsApowderAarcherAgotchaAbattleAdublinAslapshotAguardianA147896325AjaniceAcharlyAseptembeAphotosAknightsAwoody1AshortAangelicaAnookieAmilanoApepsi1AscarlettBtuartAdamianAgrizzlyA123098D321123AcamilleAscruffyAbrasilAlatinoAkittycatApoopieAmunchkinAlorenzoArammsteinA1701BpassworAbananasCrcelonAsantiagoAthegameArobert1AhellAworldAgerardApicassoAviper1AwalnutAkolobokAblackmanAwisdomAtranceAstarcraftAparrotAqualityAbladeApinkAauburnAgoodluckAeatshitAdorothyBustyAengineAcoltraneAgorillaAwheelsAkaterinaAtamaraApostalAfuck_insideAlutherAranger1Apass123AcarloCssidyAdiscoverAoaklandAandrew1AspankingAosirisAdumbassAshaney14A192837465AlonestarApingAbridgeBingoBenderAannieAstonecolAdookieAmeridianAsallyAmegamanAheather1A25802580AracerxBjntyjrAsiriusAfireflyArichard1AjuliaAalexandraAmadridAterryAgriffeyAwomenAphoebeAzaq1xsw2AweezerAbeautifulAvioletAledzepBowriderArandyAgangstaBhjcnjAparadoxAtacobellA123698745AlovingAcatalinaAvertigoAhalflifeAcarsonAsergeiBhilohAjohnjohnAsobakaAbuffettAaliensAsadieAchuckyAbonjourAkangarooAjazzBoshAthompsonAsinnerBocratesDcer1AkeyboardA0.0.000AstevieA0007AjeepAtreborAfinishAdarkAlukeAsprintBhazamAladyAnationalAcelicaAsarah1BcarletAformula1AhooverAsommerAfrancesAhotboyAcynthiaAqwerasdfA12369874ApenguinsAbondAformulaArebelsAfuckfaceAelwoodAmelvinAhonda1AvacationAkissAragnarokAbolloxAlexmarkAasshole1Amailcreated5240AlorraineA258456AclaudeArockonAduckBodgeramAtacomaAromeoAwookieAprodigyAtempestAvfheczAflamesAsebastianAcolombiaAbangAkitkatAoblivionAmysteryAsithlordBerverAmolsonBustangsAincubusAsmokerA123qazAwindowAscoobydoA1122ArescueAbigballsAzxcv1234AcarpetAtitleistArichmondAdirectorAlawyerAmeganAjuanAmagnoliaAcelesteAmelindaAlucyAwrightAjimbobAgolfingAkennyArogerAbobbieAxanaduAtardisAblueeyesAheartsAdixieApussy69BooperAshamanAmersedesA102938B2312312AspringerAimagineAjanineApatrick1AkenwoodA123zxcAdoggAgarbageAmartinezAtopperAcowboys1ArobertsAlizzieAashtonAelliottAoracleAsheenaAchloeAnuttertoolsAmallardA123987B122334455AanalsexAshemaleAgateway1AmikeyAasterixAfaithAmonkeysAimperialAjimboAcoolerAgratefulBillianApeterpanAkingstonAyourmomAsleepyAgremlinAprinterAhudsonApa55wordAstudAfrecklesAbirdmanAfrank1AaussieAestherAdefiantAmargaritaA445566AdeadheadApoloAanimeAtatyanaAjackalAfroggerAbridgetAwayneAresearchAtobiasAmarinersArootbeerAblondesAdonnieAkatrinAweatherAaspirineAfredericAparolaBhotoAchildrenAaccountAisraelAstephanieBhaolinAnoodlesAcelineAwillyEisAforgotAscooter1AhalloAmandyAthomas1A11112222ArogersApalaceAsantosAohyeahAmagnusAlaurieAcreampieAamazonAkissesAqueenAludwigAfatassAplymouthAjustdoitAassfuckAnellieA1234567qC121A987456A6751520AputterAbrokenAnopassAletsgoAbryanBonesAharley1AtatianaAcamelBhampsAlightninAmassiveAcamelotAboscoAdeannaAgizmodoAspideyAcalienteAaezakmiA456654AgoodtimeAmypassArollerAcatherinAactiveApoohBaytonAlonelyAredalertAbruceleeAsmokinAporkchopAastrosBquariusAraiders1AthankyouAkevin1AatomicAfletcherAshoppingAa1s2d3f4AmasonArusty1AmarianAvanillaAhunter1AunknownAsapphireAtempleAqwert123AmarvelAbeckhamAqazwsxedcrfvAkaktusA753159AmyselfAsoonerAblackyAelvis1AhastingsAbuster1Apower1AblackjacAaggiesAscreamApictureA123321qAabc12AjudithAiforgotAkasperAcxfcnmtAbangkokA01012001AshittyBpectrumAeduardAvaderAjammerApainterBrimusAveritasAernestAkristiAchevroleAamber1CsterdamAslappyAvalleyA1221Ahorny1ApeteAhitlerAclancyAspankmeAgrannyAavengerAsatanCsha1Ausa123Adiamond1ArosemaryAhuskerAcandymanAbeatriceAscrappyAjohn316AsimbaAfalconsAdylanAfront242AharderAatlanticAlabradorA123456qwertyAsmudgeByracuseBouthernAmelodyAtimmyAelijahAcenterAdarlingAthroatAstuffAfatmanAkrishnaAsanchezApanchoAgatorApacmanAcommandoAdelta1AvulcanAbushAclitorisAlemonsAaliceA8j4ye3uzAbonerAkeithAodessaAbarkleyAmonopolyBethodAkelleyAsaraApunkinBineapplAcelticsAlesbiansA223344AspaceAgangbangAbennettAarea51AlickAflyboyAhamburgAaaa111BsianAcarolAspartansAtrickyAromashkaA123456aaAsnugglesAphoenix1AboatAinfinitiAandersAbillieAlifeAhomer1AdragoAblakeAhermesAjesseAgooseAjeremiahAvivianAannetteAhomerunAdeadAforrestAcarolynA1234567890qAtopcatAhaydenAcosworthAvectraAgroverBoodbyeAcharlotteBuddlesAbossmanAhorndogAdobermanAgaryAtelefonAdawgAqawsedrfAivanovAdurangoApeugeotAkiller1AfrancoAkyleAplumberAbellArbhbkkApaulineAexigentAbrandon1AlagunaAemmanuelAwebmasterAbowlerAleopardAstrongAthekingAredbullAalanApicsAbeastAviktoriaAporsche9AbreezeAtopdogAstarbuckAomega1AdanceCltonAfuckersAoscar1AhungryAbeefcakeArealityAgjkbyfAspeakerBhelleyAgodsmackAclarenceAwriterAloveitAkingpinAnokiaAvalhallaAnightAstarfishAanarchyAherbieAblacksAcontentA906090AsailboatAdesertAfitnessAbrandoBohicaAachillesAtractorAjordan1Ancc1701aAdrakeAbullAhiddenAkickerAarsenal1AlabtecAnapassAbartApa55w0rdAameliaAtuesdayAfrontierAswingersAjimmy1AcaitlinAmuppetAterrorAlegacyAfarsideAterminatorAbellaAmatildaAkentuckyAjackson1AdoughboyAramonaAbuttholeAphilliesAjrcfyfA789654AcamelsAdannyboyAoakleyAdaniel1AnebraskaAlatinAdoubleAqwertyuioAsabbathAchangApinkfloyAhomersAstrikerAlookerAfallenAmarylandAluckydogAazamatAseptemberAiguanaAoklahomaAmolokoAqwerty123456Aagent007AvfrcbvrfAjavierAvetteAdaniilAcommandArhondaAstudioApistolAmilesAskiingAfrankyAstonerAconradAselectAtanyaAhousesAborisApuppyAelliotAcharmedAvladikAnathalieAwhocaresA666777AmaynardAvkontakteAihateyouApuppiesAzidaneAeileenAdilligafAcrashAmandingoBoneysAtyroneAfunnyAnevadaAkotenokAmysticAcaliforniaA123457AbudmanAchurchBarltonArafaelAtechnicsAboneAstickAgolfballArookieApandaAlaptopAtodayA01011991AjennieAtritonAriverAtrojansAbungholeAzvezdaA132435B5426378AhurricanAcentralAstripperAdaleAfilterAjethroAsnowAgustavAivanAescapeAgizmo1AhawkAigorAaberdeenAshaneAlespaulArfnthbyfAenterpriseAbutchAdthjybrfA963852A1366613AcutterAsplashAhandsomeAoilersArandallAcashAnofearAcupcakeAexcalibuAbatman1AmomoneyAgbpltwAbiggerBelindaAsvetikApossumAmetalBoocowAbrothersBethanyAkeystoneAbabyboyAflamingoAsuper1AfirefoxAbogdanAccbillApasswortAsoleilAlancelotAmelissa1AvipersAmarilynAtdutybqAjulietAleaderAmaddenArussianAaustraliaAsabinaAchaseBoolmanAbabiesAskinnyAzaphodAraven1AkamikazeAveronaAbaconAnoodleArebelAdoobieBesignerCadmanAattackAvortexAkillmeAdogmanApokemon1AgopherAsomethinAdanilaA12332AreaganAapollo13Achevy1BancelAtorresA000007AfreaksAazsxdcAsassyAdonnaBraculaAplayBonchoAbearbearBootsAengageAsteve1AdeskjetAbradfordBitch1AhammersAdeeznutsAwarhammerArangers1AtightAjustineAralphAfabianAlewisAcasey1Asummer1AblueblueAmarissaAoregonAbubbasAsinatraAhiltonAmeatballBailmanAdawsonAcolumbusAmanchestActhulhuAmacdaddyBightyCchaelaAgrandmaAreadyAsterlinAcartoonAsummitA123456789zAsentinelAtolkienAbicycleApeter1AblowBeverlyBreastAlickitAkathyAcrazy1AmeghanAuniverseAcaponeAjennaBuliusAwendyAbryantAtrueloveAhelenA123456kAnancyAeatpussyAhaileyAkitty1Adaisy1AchairA362436AbowserAkathrynAsexygirlAfernandAelevenArocketsAbillyboyAmilitaryAdemonBavisAjamesbonAiloveyoAtexas1BrafficAsaintAdaddy1AredhotAmicrosofAsonicAmiracleCcrolabAgofishApantyhosBilotAlifetimeArugbyAmaydayAaikidoAninaAstar69A01011985AconnerButlassAtreeBhekidAgordon24AtheodoreBittiesAswedenAfunctionApolskaAdanieAgangA73501505AmarketAscotchAlansingAelviraAbloodyAsexxAhustlerAanfieldAcokeAsmutAcatmanArushAbonitaAtracyAsonyAfastA1234qweC25Apasswor1Airish1AcheersAtinmanAairbusApetersAchinaAazsxdcfvAsantanaAhayleyAstationAgabrieAscottieAoriolesAjenny1A01011970AcharltonAsaunAfortunaAdfkthbzArustamAwarlordAretardAfatimaAultimaAkongAbigmoneyA4runnerArottenAbettyAgrumpyAorangesAkelly1AsuperstarAfordf150AasdfjklAboxingAxtremeAdenaliAselenaAzxcasdAhuskiesA128500AterminalAwilburAkristyAwildfireAvladislavAbikiniAthorAhollywoodAmayhemAsultanAgretchenAfigaroAsixersBpartaBaratogaA321654987ArunningA01011981Acloud9Amusic1BodelsCjoAgreenbayAcancunAmarleneAtrinidadBammyAchewieAhopeAnumber1Abilly1AfeetAcrunchAbigbirdAmellonAchicken1AbigtimeAfashionApiccoloAfabieA789123ArjirfrgbdeBoversAmeatloafAhyperionAsandroArightnowAjarheadAarmaniAtreasureAmiriamAhansenAnaturalA01011986AlisalisaAsportAbizkitAchester1Ajasmine1AmaradonaA1066AsayangAcharliArfhbyfAutopiaAanacondaAjapaneseAcamillaBoconutAgovolsAemersonAmemoryAcatherineAjediAcosmoBruiseAgiantArickyAdragoonAwoofwoofAgiorgiApackerCss1234BoontangAemily1AilliniAchristopherAdavidsAzaqxswAsandy1ApedroAsticksArevengeAexodusAreebokAchanelAalbatrosAcabbageAgokuAwallyAbeanerAquincyAgreensAtomatoCbyAchiefArichardsAturkey50AadrianaAkenworthAhappy123AdeborahBownAcooterAdinosaurAholyshitAeeyoreAmoviesAdanaAlionkingAcreamyAadultApoodleAtsunamiAhappydayA321123AknopkaAtommy1AbogartAcorradoAvolleyAtyler1AchickensAorgasmAwhisperAflyingBirstAchocolateAwalleyeAhopperAkatie1AseanAtwistedAchaserApepper1AmemorexAericssonA1001D000AjensenApositiveAcrazybabAscienceAfriscoAdongAjoseAzorroAromanceAsherwoodCaniaArereirfAsausageAmilanaAtashaAvfvekzAprofitAzenithAfugaziAjunebugAclemsonApolniypizdec0211AtootsieAfktrcfylhfAcomicsAzxcasdqweAvfczyzA150781AwernerAaspireAhardrockAcondomCcksArachaelAgringoAanhyeuemAmadelineArichAbeckyAcanonAfebruaryAalienBbc12345AharperAjustin1AstocksAmarcosAsamsung1AclaptonArobertaAcolemanAapplepieAskywalkerAfubarAtheresaAkoshkaAtundraAvitalikAarjayAgmoneyAbigsexyAingridApillowAgandalf1Alucky13AfingersAsamiamAdeanBavidsonAskorpionAcandleAnobodyAhellyeahAbetterAaustraliAdrewArockhardAboobAeasyAbearsAsparkleAjohannaAeverestArfrnecAhedgehogA13243546AwolfieAsurfAbobby1AfartAyosemiteAmarisaAvoyeurAbaddogBradAjazzmanAdicksAtoolBempAcheetahA1qa2ws3edAslackerBteeleAmikemikeAwoodApooppoopAamerica1AbarsikAvaleriaAdeniskaAbr0d3rAfrightAkarolinaBirstenAvfksirfAkumeBenshinAbootieAcycloneAstarshipAmontyAballoonAmaxellAdildoArupertA0.0.0.000AmilenaAbonsaiAlionAsalvadorAgreatoneAvernonA50centAsliderAlillianAadmiralAceciliaAstolenAalbionAboysAmidgetAfuckinBreepornAnikolaAamanda1AhithereAfootball1A222333A78945612AdamnitBinamoAfrancoisAchengBalicoAduchessAscratchApowellBackers1AstefanoAfortuneAnyjetsAartemisArobotechCadkillAbackdoorArastamanAfiestaBeliciaAallianceAfletchAjerkoffAkillbillAgoliathAcinnamonAramblerAmalakaAtekkenAsojdlg123aljgA321456A18436572A963852741AcarreraAbangbangAjeanetteAmarcAfritzAramsesAoperatorAshadoAdusterAspankAwibbleAalibabaAmechanicAkeywestAswordAamsterdaAhal9000AbristolApingpongArasputinAmarianneAhooterAtaraArctybzAsandersAfaggotAkristaAprestoAmajesticA332211AnguyenAfowlerApasswordsAbuttmanAsnake1BpursAcarlApompeyAtridentAviagraAqwert1Abrian1AkipperCngfishAzxcvbnm1AgotohellAangieAguestBarageAheidiAmattieAsluttyAisaiahAsteelerAwrestlinApooterAdivineAemmaAroute66AclipperBharleyAmacrossArailroadAlineage2AolegA420247AseamusBwimmerAne1469AjokersAthursdayAchicoAa123456789AsolnceAerikAkimberAguinessApussieAmathewAnatureAmatadorAsparksAtyphoonAhankAsecret1AretiredAsubwayBlaveAivanovaAghettoAflorianAlove69AvermontAtangAktyjxrfAlolipopAmoose1AspearsAyzermanApetersonAmagickAphillipsAcinderAnwo4lifeAflash1AshearerApupsikAcharles1AdfkthfAallsopA162534A456321A000001AcityAqwer123AgrapesA123123qApippenAbelleAchadAvenusAkcj9wx5nAsex123AdammitAbarryAcavemanBritterAunderdogAr2d2c3poAskydiveArenaultAonlymeAgeorge1AmurderAsnoopdogAjayhawkAhotshotAcaramelAbroadwayAkinkyAthebossAfuckherAtrainCoutAdingAumbrellaAfeatherAcreditAsplinterAdepecheAseekerAfuckthisArespectAcrysisAdirectAanimalsAchemicalByclopsA1000B22333B35246A789987A123789456AchivasAjamesbondAblackhawApasspassAsinclairAteamAmegapassAbeanieAtranslatorAhellooAmagicmanAcuntsAphilAfishesAsuperstaAgiuseppeAcaligulaAkillAshannon1AjuggaloAfrozenAquattroAusmcAmeredithAjavaAwassupArosieAbullseyeAsaturdayApornosAcohibaAashley1AfloppyAalucardAdeaconAheartAtabithaAkristineAnicole1AtunafishAgreat1Bfhjkm123Adallas1Axbox360AdkflbckfdAkickassAp0015123A10203A200000A7753191A12131415AvietnamAkendallApearlAsafariAgonzoAcrawfordAbob123AklingonAjacob1ArainAlooserAgoalieAdamageAmaureenAwestAdawnAtazmaniaAcigarsAfacialAcobra1AdeepthroatAmalinaAsilenceBamaraAdfktynbyfAfangAcruiserAvectorAtommyboyAjeanAbankerAhorizonAchainsawAbuttonBigbearAforfunAabrahamA123456rAastridAcaroleAandresAsharkyAenter1Avh5150AroyalsAchristinaAsmallAmisfitAworkAyousuckAlouisAfalloutAmarino13AscaniaAmaxxAnudistAgetmoneyAbudweiseAqazwsx12AsongAbelieveBrightonAabsolutAkungfuBostyaAmonacoAdeath1AgunnersAvfhufhbnfAmamapapaA1230AminimeAblueboyApenthousAchrisblnAstephAwhiteyAeuropaAjadeAbertieAdaphneAgrouchoAchampAbennyAgrantAmirrorAvillageAtraderAstrokeAwalrusAsusanneAnumberAsabresAnipperAwomanAfloydAsnowboarAundertakerAflounderAmoneymanApattyAbottleAlove123AkahunaAcanadianAwolf359AviewsonicAcoolguyArulesAdowntownAwagnerAstrangeAfabricAtrishaAitalianAybrjkfqAcypressA01011989Aqwerty1234AeastsideAsneakersApassmeAtopherBaylor1AgolfgolfAbarberAsinbadAfrodoApanasoniAcraigAalfaAmybabyAskidooAchicago1AmassimoAbackAjillianAcat123Aq123456AsparrowBeniorAdalejrAthecatAfucku2AsnappleAmondeoAleanneAemmittAthanatosAz1x2c3AghjcnjnfrAmaximumAsmegmaAthesimsAwhitesoxAchongA778899A2128506AbonkersAposeidonAmusicaAdougAjohannesAgargoyleA0420AolivierAhamboneAbluedogAintruderAsunnydayAcyberBomputeAkidsAsmellyBpawnAwapbbsAanswerAstudlyApoppyBaperAferrari1AsimonaBolutionAmadison1AnewcastlAadonisAgoodmanAsexxxxAeuropeAgoldstarAagainAquantumAbuckshotAstaticAturbo1AdollarsA01011988AtitaniumAholly1AericaAdanzigAsadie1AjabroniAlibraryAjourneyAbeastieAchronoAdangA1024A555777AedwardsAjaneAtest1234AgunnarAfedericoAkornAcustomAlanceA1qwertyAassholesAdaewooAjessAbrianaAwatcherAsuperman1AalbinaAsunfloweAdorianAbabyblueApremierAstaplesAnikeAstereoAwestwoodAapple123Amouse1AusnavyAboomboomAfreshBlorida1AsasukeAdharmaApiscesAmotherlodeBultipleloAhangAbikeAsapperBcannerAmariusAzeusAracerAcallawayAuserAbayernAroverAlamontAriversAsnoopAoverAwalmartAmichealAstarfireAtheendAsteelAtigger1AeroticaAaaliyahAdoogieAreneeApaintbalAwinston1Asexy69ApaintA123qwertyAtysonAjoshua1AnewbieAknickersAlokomotivA112211B92837AhotredAufkbyfApanther1Adodge1AlaurelAshawnA12345zAwasserAscott1AjessicAthirteenArjycnfynbyAavalanchAoutkastAtrumanAmagpieAscoutAphilippeBoetryAmartin1AhavefunAmichellAcubbiesAlosersAhotpussyAdeejayAfghtkmAdroopyAblossomA333666A777888AallmineA01011984AzerocoolAjanetAtomorrowAgodfatherAabbyAgreeceAsecondAreadingAgreeneAsaschaAbustedAmingAbimmerAoriginalAcbr600AoceanAanneAbuilderAdemonsAnitramApuddingAbounceAdonutsA01011987AfuckuAnewyork1AjeanneAidontknowAaudia4BlekseyAvfvfgfgfAleonidAsmokesAmylifeAbeerbeerAsimsAredfishAharry1AworkingArodmanAbeachesA1x2zkg8wAhairyAcontactAstartAluisAbogeyAprissyA123456sAgegcbrAtightsAinsertAcarlaAdanteAberettaAfrancescAjewelsAsearayApadresAceleronAmittensAquartzAziggyAdiehardAmicronAsyncmasterAcornellBhristieAstunnerAhockey1Asimon1ArtyueheAhoosierAzxasqw12ApeytonAcheese1Aorange1ApaintballAbingA4121AmonalisaAqueensAterrapinAa1s2d3AspongebobAbuzzAattitudeAbackupAwhiskyAclevelanAlingAcedricAmarinAbarefootAarturAchucklesAbarrettAmeatheadAbigassAou8122AtittyAspike1AgretzkyA02071986AkosmosAcfitymrfAbigglesAcambiamiAsexy1A12345678qA03082006AthongsAblessingAwhatAaleksandraAginger1AtwinkleAgladiatorBollumAsouthparkArabotaAmazafakaA336699AgoodboyAcarbonAscubaAtangoAstoneyAbrentAweaverBillAvolvoAfootbalApianomanAgastonAcasanovaAtravelerAclarkAstumpyAhawkeyesAclarinetAlooneyAmommyBaggotAfelipeAbucketAsexAeduardoAfreezeAsoundBexymanAjohnboyAdianAsnaponAdeeznutzAwarthogAvegasArooneyAhoney1AfutbolBilthyAsteamAcarinaA1012A90210A10203040B23aaaAmustardAboricuaAmeowmeowBasteBellowAlove1Aabc1234AsunshinAbengalsAcombatAgoofyAwhatsupAsauronAkrystalAalinaAlover1Amonster1AprophetAjoker1AlocoCvesexAtwinsBriangleAbookerAreeferAnickelAveniceAxanderAstripAvalenciaA01011910AlordArhiannonAcrystal1AsmegheadAvaleriAandromedaA12qwasC345679AdiverAcerberusAjames007AsputnikAgrooveAlambertAusarmyAmoreAtiberiusAzigzagAstingAabcd123AbeanAwelderAradioApetraAfocusAgabriellAcandiceAsalamanderAeternalAsilver1Abunny1AmotleyAresidentAhayabusaAmarciaAramboAtogetherArainmanApoochieBurdueAredwoodBippleAbuzzardAwangAredwingAboobieAjulietteAmonkeAhokiesAphishA1q2w3e4r5AcrjhgbjyAjaggerAnokia6300ArockfordAshouAtuanAgoldwingA1007C101AbrewsterBermudaAzeroAthegreatAproxyAconfusedAbadgirlAlolaAbacardiAsweet1AderekAwhiskersAspacemanBtarmanArebecca1AtrialAkarmaAclaudioA12qw34erAallstarAcarolinAgesperrtAlynnAswordsArastaAwildmanAnikolayAkangAslinkyAwrestlingAjamie1AmohammedApinheadAhackedAlogan1AsersolutionApenny1AoverkillArhfcjnrfAmishkaBontgom240A123451AbananeBulldog1ApersonBublicAfesterAsomethingA12345qweAlionsAhelmetAbuffy1AripkenAfriskyAchangedAgamesAhigginsAtrapperApiperAwindsorAsupremeAib6ub9AkayleeAathensAnorwayArunescapeAoasisAjillAhurleyAlightningAdbrnjhAshunAchunA11223A235689A784512A14725836B9411945Aedward1AdariusAchipAhillAmidwayAkoolAhoosiersAvinnieArecoveryAciceroAnapsterAlionelAamazingAtrackerAlaserA01011992AadrienneAroadkingAmenaceAsecureBtonedAbr549AthedogAsacredBquashAniceAsmokingAponyAfengAillusionA01091989AwoohooArachel1AmedicineAantoineAleavemealoneAbagiraAmegatronA787898A5551212AorchidAreaderAcometBlownAzippyAcompanyAdoghouseAstacyAwildAarmyAmaximA12345678aApaulaAbravoBuddahAjaybirdAchuckieAlookAmaria1BorningAdinoApeachAtoddAhannaAchuangAmortgageAidiotAheinekenAsaleenArulezzzAfishing1AmassageAsonicsAmoonlightAbuttsAmotherfuckerA02071982ApobedaAbenficaApokerAkashmirArealmadridAballoonsAoptimusAchunkyAgsxr750AtinkerbellAchouAshaiA135792468AcommonAstarterAbrewerBabyfaceApantsAgregorAdogfoodAhardcockAdeluxeAbigmikeA01011975AblackbirBookwormAhamptonAjefferyAsalomonAgodfatheAmeisterAangusAintelAseahawksAeagles1AtalismanAblackjackAeraserAcollinApissingAhawaiianAzhongAmianA1005A7779311AmichaeAbergerAalphabetAtriciaAbeautifuAmishaBaryannA123456654321AadamsAjennArileyAxxx123AreallyAsally1AmortimerAtongueAgator1AcenturyAsanchoAremoteAdarkmanAbuddieAroadrunnApizzasAlexusApassword2AmedusaAhealthAstalinAtoledoAcubswinAdutchAlillyAbeowulfAcharleneAwilliaAchristmasApoolAhandymanAf**kApacersAuniqueAeleanorAdigital1Amissy1AcloudsAtiffany1AcgfhnfrAbreastsAchinookAjust4meAnutsA01011993AweddingAcalgaryAdutchessAgfhjkm1AheckfyAmax123AludmilaAgongA12301230AnovaAshellAloriAsiteAbecauseAcheaterAfamousAdelphiAcathyAwareagleAmartineAgromitAspongeAashleeAvalkyrieAyodaAgloryAteddy1ApasswdAidontknoAsmithsAmohamedAteddybeaAkillersAboxsterAfiveAdragonballAbeast1BabybabyAmermaidAqazwsx1AsatanaAdolphin1AbhbirfAforyouAmisty1Anasty1AqazzaqAhongApuddinAchaoAshangAzheiAquanAinuyashaA1213AstanfordApeacockAasswordAmiseryAdesireeAbarnesAsullivanAbeamerAdigglerAmedicalA1pussyAwishboneAcircleApropertyAripleyAthedudeAcloudAfistingAaustin1BlexiaAbeemerAjaydenAgameoverAsparky1AredlineAveneraAlinda1AsalseroAfuckoff1Aadam12AlustAfytxrfAsergiAkittykatAspanishBinisterAindiaAvedderAgonavyAmanowarA02021987AnovellAlangAcolonelArancidAdiaoA147369Adragon12AchromeAfriendlyAaa123456AdestroyAtittenAelectraApollyAgeoffreyAnewpass6Abella1AeurekaAonetimeAphoneAkatherineAottoAlakotaAclaymoreAhotboxAasiaAbannerAmadinaA02011985AmanuelaAbitchassArubyAsportingAbartmanAmatthewsAcheckersAplayingA01011977B2041986AcarmelAgabrielaAdfcbkbqAnimbusAwrestleAbullsA02081988AjktymrfAalexalexApreacherAgamecubeA02051986AmustafaAsvobodaA123321aAcircusAarmagedonBlenkaAplaystationAz1x2c3v4AlengAqingAcongAzhengA02091987A1369B2011987AmagicalAparkAclaudiAmarine1ArhtdtlrjApabloAthumbsAcamperAdoitnowAgoawayAsubzeroAcharityAhootieAfaceApissoffAjamminAbethBlackoutAcrowAdarrellAcocaineAbcfieldsAskylarArollingAloadedAmilkmanAlotusAdavideAbigbuttAelectronAjohannAdevil666A12345tAcheeksAskateBilveradAlighterA02021988AhassanA02031986ApotheadAoliver1AgobucksA123456qwAsquallAthunderbA02101985AcourageApippinAghostriderAantoniAkaitlynAnengApengAmiaoAtengAxuanBiaoA1017C20B492A654123A794613AreynoldsAcannabisAxerxesAipswichAninjasAmangoAfarleyAlucilleApinkyAjimmieAnudeAdieterAannikaAmitchAsouthparAmarikaAjackson5AdickieAjetskiAfinanceAtdutybzAdianneAforwardAjenkinsAbrightAabsoluteAmorgan1AbilboAmusashiAferrisAiamgodAlipstickA1234567890aAlaurenceA02061985D11987AmandarinAbaseball1AquestAtottenhamAadultsAyfnfkmzAkleopatraAtulipsAnongApiaoAruanAzhuangAchaiAdirtbikeA111333A369963A1236987B357924680AshebaApickupAdwayneAothelloAmariAkatherinAforumAsonnyA12qw12AriderAa11111AwarnerAnorthernAcinemaBameltoeApetrovAbluefishAfuzzyApheonixAiscoolAsecretsA02021986AeliteAtoonAmodenaAbertAmarshaAslipperyAkissingAcaravanAdivorceAtankAbeatleAjumpAakiraAsanfranA01011983A1qaz2wsAcheechA000111AbadmanA02091986AsamtronApalomaAyangAdoloresAsvetaAqweasd123AshadowsAmollydogAannabellAstarcrafAghblehjrAvasilisaAjamesonAchuaiAdengAqiaoAzhouCunAjiangAluanAsangAyingAscorpio1AbeansAslimAillinoisAwarningAebonyAmeatAjockeyAdeadpoolAhillaryAbearcatAcapriceAfarscapeAevanAbigtitAlassieAzappaAsanderAnicolAsunflowerAhopelessAsheriffAcarpedieAbankAlove12AasdfzxcvAsherriAmarchAbingo1Aslave1AbartonAshepherdA02021984AgatoradeAkeeganAhighAcameron1Aguitar1AtoolmanAbarkerAspectreApusseyAnuggetsAborussiaAmantisA01011982AbanzaiAarianaAflexibleAchloe1AmulletAgraphicsAfyutkbyfA123qq123AmancityAtemplarAstoriesAyfcntymrfA02081984H7AfergieArecordsAthedoorsA7ugd5hip2jAgawkerApussymanAskylerAelizavetaAcoltonAhuaiAsengAxiangAzhuaiAguaiA02061986AsoloAmoritzCnteAlemonAstrengthAtalonArhinoAcowboy1AsusanaBonomaAthreeAmackAspinnerAallanAkellerAwebmasteAaaron1AgreaseAaugustusAraquelAalejandroAchimeraArufusAstretchAticketAbacchusAkendraAtwentyAcorsairAkinderAargentinaAcorleoneAzhaiAspiceAmickey1AvampiresAdomainAiomegaAheaterA02031984D21985AhoverAalex123AltybcrfAartemkaAxxxpassAqiongAtingAhippieAjingArengAtianBongA2580A123455A21031988A987456321ApolandAdeutschAbabyloveBeckerAspeedoAbrettAoceansAslapperAletterAharvardAbonjoviAmazdaAvirtualAcosmicAleonAsnuffyAblazeAsergeantAmaggie1AdragonbaAspurs1BtonecoldAhellosAjacquesAregisterAbuttercuA01020304AhuangA01011999AmillionsEwallApatienceAchryslerAmerlotAbullfrogAlatinasAa12345678A02011986Axyz123AistanbulAphoeniAashleighA02081989AkotakuAuniversalAnoelleAbinladenAartemAshanghaiAporsche1AcastroAgabriel1AcengBhuoAjiongAxiongAsheiAmengAhansAwraithApierceAjayhawksAkilroyAamateursAdotcomAcattleAdaemonAntktajyAbarbadosArenataAthomaAbalanceAmikey1AchanAnomoreApdtplfAcanyonAkaylaAjackpotAmetsAorion1ApulsarAbaronAmarkerAchippyAnightmareAmonarchAhamishAaubreyAredsAknockersAdipshitAalexeyAmaloneAathlonAhubertAchevroletAeddie1AvadimAeverettAnapoliAmynameAbellyAcobaltCunterAdialogAhouse1AaugustaAsmokieAcristianBoolnessCugarsAscreenA02041984AcriminalAhardwareAramonesAbobdylanAningAcapslockA02061989ArongAzarazaAciccioAteddybearAalishaAgfhjkmgfhjkmAchuiAliangApianAniaoA1123B20676B47963AgadgetAshinerAlaurentAfulhamAmissouriAcarlitosAdwightAheleneBalifaxAdogshitAentropyAcoldbeerAsilentAlostAsillyAnetscapeAboomAedgarAdog123Agolfer1AcountyAdeepAfreewayAsyzygyAandromedAgameAmediaAwingsAbrigitteAdanny1AyeahbabyAdiegoAyolandaAeldoradoAhollowAcrackAeastwoodAmonkey12AguntherAparanoidAanitaAsexyboyArainbow6AsoulmateAgoonerAdrunkApersikAlesleyAgenevaA9293709b13AmicrophoneAkakashkaA02021983A50spanksA111111aAfgtkmcbyAmclarenAspreadAgengAshuoAzhuiAduanAnuanAqiangAwengAshuangA159632A9562876A1234567891AbambooBrittneyAfastballAcreatureBardsAjust4funAmatteoAfuckyoAhackAsmashingAfootAwashingtonAarleneAbaggioAcarlitoAjones1AhopefulAastroAhondasAsnookerBophiAredbirdAbigblueAannie1AdynastyAmephistoAtemp123BrainerArebel1AicebergAshitfaceAfountainAspecialkAestrellaAsomeA02031987AgenericAbuddyboyAstevensA02041983AarcadiaA02051983AmanningAnikitosApiramidaA02021989AviolettaAbailey1ApianoAspencer1BalasanaAq2w3e4r5AmaxxxxAzangAshutupAthingAsuanAheritageAliaoA1022B223B5975B1221122AbrowningAhomerjAtiburonAobelixAkrisAchopinA02041982AinsomniaAhooperApromiseAcygnusAtheaterAromeroAjellyAplasmaAkissmyassAhereAninja1AsubmitBpider1AbudapestAjaysonAsexysexyAjordaAcitizenAsaharaApinkfloydAcardAstrokerApavlovBlayboy1BaswordAamigoAheynowAarturoAfightAventuraAsandwichAfraserAyummyAhomeboyAroyalAtestpassAgamecockAmiloBaxwell1CgicianAfemaleAwildcardAsassy1AmagazineAtelephonAbigfishAtripodAkuaiAlazarusAcleoAlickingAdundeeA1234asdfA02081986A1a2s3d4fAbrodieAmisfitsAslavikArochelleAsleeperBeekingApringlesAbutcherApatricAiverson3AnanookA02041987H8Avsjasnel12AdarklordAlovelessAbruno1AradioheaA02011988AcangAshaoCengAguangAshuaiAxingA1011A2469A12365AkarinAhughesAgiorgioAmaximeAsphinxArecklessAtripleAbaldwinAtaxmanAorientAdesmondAmarriedAzhjckfdAmordorAhuntAromanoAjiggamanAramseyAofficerAlovebugAsam123Atiger123AclassicsAhooliganAplutoAgeorgAboltonAscrabbleAjezebelAmajorA010180AjellybeaAmason1AshockAdrakonAseadooAmexicanAhawaii50ApharmacyAdoorAlenaAabnormalApatriceAconcordeAalfredoA01011979B2081985AcdtnbrAqazwsxedc123ApuffyAislanderA02101984AchantalAjakejakeA02011980AyjdsqgfhjkmAbunniesCshidoAkazantipAstrawberryAverizonAmaksimkaAdupontAcrusherAjiaoAzongBhangApangA1211C24C3465A655321Aghost1ApremiumAwg8e3wjfAcoreyA426hemiAgoatAdianeAchannelAprojectAholeActhtufAarrowAmeaganAtootieAbountyBlue12A02021982Aporno1AkfhbcfBirstyAhowdyAramrodAsweetnesAmaster12Abird33BummerAcorollaAandersenAblondAraceAdarrylAsenatorAfergusonAdonovanA123456qweAthelmaAdynamiteAgertrudeAdoomsdayArhjrjlbkAhjccbzAplayersAmariposaAkiller12AozzyAmazda626AexcaliburAmarcelloAbuttfuckAmooreAsamsunAmasamuneAzhaoAniangAzhuoA02071984A998877A12365478AdarleneAbessieBrainsAnorthAattilaAclownsBhestnutAwooferAmodelA1qa2wsAmosesAsomeoneAlindrosAtinyAdottieAcivicAjulyAa1a2a3Amerlin1AanthraxAlilianAimationAbeaconAtripperAsnoopy1AvsegdaAtiger2AursulaAfullmoonAspikerCortyAforceApornpornAcitadelAjacobsAmichael2AvolcomAdynamoAamerikaA02031985AbombersAhannah1AburritoAandrea1AinspironAforsakenAspockAmalloryAlanternAnextelAgoirishAsnowboardAhaggisAcallumAviolinAlollypopAinsanityAplaceboAcreationAglacierA02061988AstepanAzanderAdabearsAwater1AkatarinaAilovemeAsexxxyAmoonbeamAwebberAgonzalezAhenry1AtiaoCgger2A4417A7007A69696A147741A258852AdoggerApeckerAstiffyBenatorsAcreateAjuneAwingmanApumpkinsAfelix1AwindsurfAernieAmickAwatchAgreen123AjarvisAzephyrAfishmanAdellAreddevilAwantedAsheridanAlarry1AnicholeAbronzeAconcordArjhjktdfAkellieAbakerAzalupaAkillkillAavenueBsddsaAbunkerAwrenchApaddleAschalkeAcobainAshannaApoopyAbrokerAmouthAwoodlandAyvetteAsuicideAvanguardAaviationAexoticAheatAstanislavA02081982AsuperbAq1q2q3AfergusAmihailAvfibyfA02051982Ayankees2AmobydickAicu812AsausagesAtuningAfrancescoAganeshAanastasiyaAnevermindApresidenAfaithfulAkerstinAvfitymrfBarvaraAhappinessA1z2x3cAroboticsAzuanAnangAshuiA225588A369258AnormalAdeerAbigcatAstoreA02011984Akaren1AtechCmppassAlaura1AonetwoApostmanAweirdAuranusAhighheelAalohaAcigarApussAstylusAgobearsAduckieAstratusAthongBigers1Ajimbo1Amandy1ApippoAconoverAsopranoAjingleAfirewallApolopoloAdollyApepitoBiazzaAradicalAaloneAmailAboxerA02031982AreloadAevolutionAjulie1AgrandeAdrummer1AtipperAfuckme1A02061980AbatteryAdogcatAbubba69AdriveAkirbyAcandaceAdigimonAbombayAmarianaAsowhatApussy123Cmpkin1AlipsAdownloadAfandangoAkamilaApopperAdusty1AgoreAbengArangAbianAcuanAsmokey1A1112A369852A1000000B234560AlennyAqwerty11AmypasswordAlouieAearnhardAdancingAsimmonsAairportAsnappyAangelikaAfishinAboxersAicehouseAqqqqq1AcrampsAbassetAdogboyAhallAabstrAsoftailAtitanAsantaAkilljoyAfischerAelectroAmygirlAdelilahAmisfit99AnutmegA111qqqAchristmaAkittensBrustyAscriptAzaqxswcdeAbigbossAfalcon1BloresAguyverAcoachAfender1ApraiseCowlerAharvestAlatinaAasdf12AclitAmorenoAerinA02061987D91983B1081989AspikesAzxcvbnm123AjubileeAshanAchoiceAyugiohAtoasterApineappleAharrypotterAgorgeousAnamasteAcarnageAyongAzengAredsox1AbiaoAhengAkengBuangA1013C23B2051988AalissaAniggaAdaytonAchrissAniceguyAmagelanAqwert12345AalmondAclubAbumperApartnerAvikings1A123qwAmartyAspongeboAerikaAjudyAghostsAbroncos1AhookupAbigbenAhammer1AwifeyAcindy1Barmex2AenricoAstarstarAgillesAchillinAsupermaAradioheadAhavanaAlumberApistonsAviktoriyaAgameboyArobotAsantafeAholidaysAjennifeAmckenzieAreddwarfAdodgers1AcascadeAkidrockApinballAisaacAbangerA05051987B2071987C101989C041985AarrowsAcookie1Alondon1AplatypusBassword12AfoxyA02071980A1z2x3c4vAabrakadabraAdoofusApassesAshantiAbarronAmariannaAlongbowAservicesA02101987AheroesAlivingAmankindAstasikAjetsAbeardogAlongjohnA123000B34679852AglennA01011900Anikki1AalessandroAgarionAliveAjuanitaAhonoluluAnygiantsAslick1AbustyAinstallAniceassAstringAboozerAmarsAastraAjunior1AabbottApuffinAdogbertAqueenieAmother1Biller1BusclesAhighwayAvisaA02091984AcottageCmptonAsteffiAromansAbeermanAmegan1AwindmillAguitarsAearthAfreebirdAslamdunkBnowflakAtastyAdelightAnightsAbiologyAjoseph1AemiliaAbronsonAfrostAirishmanAbadgersAstateA02091981AbergkampApixiesAtrainingAwarrior1AplaystatAmilkAoatmealAmudvayneAairwolfAseasonAlottieAdudedudeAjackjackBohndeerAzildjianAmagnetAvjcrdfA02061983D41981AhammondAramirezA02091980AmangAaptivaBnaiAqwer12AgidgetA1121A78945A153624A333777A22041987AstopAkjkszpjAmanoloAjerry1AbruiserAchillyAmedionAjosephinAgiraffeAjaredApaulinaAfishboneAedisonAcaughtAgasmanBenesis1ApocketAmoondogAcharterBamilaAimpactAtboneAbigblockArudyAtowersAkryptonAhallieAjeffersoApelicanAaltimaAclippersAgetoutAcompassAkimmieAchambersAwinnersApaulieAspoonBuckingAalbanyAtoffeeBheatreAneverApavelA111111qAclimberAmarlonBicroAthisisitAarmandAultraAaladinAmonkeyboAcomfortA123456lAepsilonAidunnoAdeath666AstressAhounddogApallmallA02051988Aangel123A02041979AkateAwebhompasAmonstersApictursA02051987AsairamA02081977B5051985B2071988AeasterAcobrasAballinAcomancheAlandonAseverinA15051981A26061987AwhiteoutAroadsterAbasebalAstone55AdrifterAeastonAwerderAnorwichAstubbyCefanieAclayAgeneAmike123AellieAversaceAfoodAvisualAheinrichArecordAwhite1AbowwowAellenAundertakAdemoAhookemAanastasiAfictionAmedicAcolnagoAstorm1AboosterAfestivalAzzzxxxAcoolcoolAqwe123qweAsinnedAforeveAsqueezeA02031981Amazdarx7AanthonAdivingAshockerAhewlettAcrossAsuttonAchoochooA08031986B2051989AmilanAdefenseA123456789sAiloveyou2AfidelioAwelcomA123456mAwordAlithiumA02051984D61984AkisskissAcbr900rrAbritishAfrancAkingsAmama123AlovelifeAhellboyAchipmunkAgood123654AsaiyanAchase1AbluebellAfederalAtrustAformatAkjrjvjnbdActrhtnA1234qwAhollieAcelebAfuckinsideA1215B11000A987123A10011986B1051987B3041988A21031987AkirkAwashingtAtkbpfdtnfAsenseiBmirnoffAmydickAspamAmacbethAcabronAguessApipelineAmike1AclydeAdalsheAjames123AzebraAmortalAfishheadAgustavoAvintageA06061986ApigeonAcarverAwinner1AgypsyAkonstantinAbetaAfreefreeAsheba1Bummer99AnewcastleAkrasotkaA01031988AkomodoA02091985AjuicyApunkAstarlighAflyfishAwirelessAcarmanA81fukkcAmanilaAnathan1AolesyaAsalomeAlowellAtorpedoAswitchAmotionAsharpAtoejamAjulienApuppetAbucetaAscoobydooA02021979Asuper12AkorolevaAlineageAmichaelsAredroseAcloseAyogibearAredbaronAcoderedAtesting1AfrogmanA02021981AtatarinAazazelAmoskvaAkitchenAfreesexAnascar24ApresidentA7894561230AnewsAmykidsAbitterAhighburyAzachary1AtrannyAredfoxA02061982A1002B35791AusernameAachtungAjohnny1AspottyBurvivorAprogramCayerAtransitAsanityBeagullAflankerAcockerAqwerty7AwandererAsoccer12AfuckheadAzodiacAisabellAcostelloAvirgilAnutterArockiesAirinkaAwashburnAcatwomanAupyoursAkelvinAlemonadeAchilliAbearcatsAchefAitsmeAgravityAchevysAsolitudeBunny1AcocksuckAminervaAboomer1AdeeperA01011978B2011989AohshitAveraAcricket1Asugar1AroberAslowhandAtommieArossAjsbachAlorenaAdinaraAparadigmAsmoke1AlilithAnostromoAboraboraAarkansasAchiaraAsavannaApresleyAbolognaAterminatAhabibiAcontestAsushiAmarkizAsigmaArainbow1AbdsmBlamAfantasiaAstephen1AmildredA02041989AgrandpaAundergroundAjohnson1Apeaches1AcnfybckfdAghbywtccfA02101986AbigbobA11081989B2021988B3041987B4061991A20061988B1011989B2021989B4061986A30051985A74108520AjoelAslaterAcomedyAmartiAgrandBeorgieAwildbillAsmartAkentAlarissaAgilliganAblastAhornetsAbrainBerkeleyApool6123AbirgitAmaggiAarmstronA3000gtA01061990AcorndogAhilaryAtroyA123qwerAlaneApiggyAdestinAtropicalAsundevilBhinobiAhoraceAgaggingAhurricaneAvolkswagAwasabiA01011960AnursesAbmw325A02021976AzanzibarAreillyAmustang6Atrouble1AangelusAchineseAsissyBunfireAtonightAsoniaBneakyAreportA02071981AcoventryAjeremy1AgtnhjdbxA03041991AsekretA45m2do5bsAundeadAqazwsAmadcatAhotoneAeasternA123ewqAdanieleAnirvana1AlasvegaAamorcitAwastedAsidekickApizza1A02031979AyfnfkbArevolverAjackass1AcleopatrAnfytxrfAjermaineAgbhfvblfAkalinaA02081983Amarines1A1031B102C25B235B72839A420000A635241A18011987A23041987AciscoAeverlastAhopkinsAnitroAvader1AsouthAnationAtinkerbeAlamerAboatingAglassAbluesmanAwestonAleroyAcustomerAphysicsA12qw12qwApaoloAdakota1AquentinAmessiahAhitachiAmarjorieAkrissyAshawnaAconanAwoodieAtrollAgroupsApenguin1AspikeyAfattyAvillaAdenmarkAstephanAbirddogAcyborgAkeenanAtokiohotelAstraightAnautilusAkieranAslayer1ArubbleAhighlanderAredeyeAjustusAfirefireBromA02071983AschmidtAlongdongAboilerAmargieAheidi1AsuckersAwaffleAkhanAsonataAlopezAthereAskyhawkAjoebobAarmadaAsimba1Ablues1A07071987AreflexAthreesomAasdqwe123A02021973B1121986AamericAgotenAloudAghjcnjgfhjkmA02011981B1071986B2091989D71989Anokia6233Aghbdtn123Aasdfgh01AsistersAvalentineAyuanAmonty1AcoleA1812B0031988D71987B2121990B3031987B4111986B9061987C101987A24011985B5081988B8041987A123456123AbigheadAmatthiasAchangesAdescentAmazda6AfenwayAtacoAeggmanAaaaaa1AjonnyAbuddy123Aprivate1AdogfaceAbowmanAirishkaAshibbyAantoniaBstralAnudesAteenageAentermeAthecrowAandyod22AscoreAcompleteAriveraAbelmontAtiggeAjunkieAfredrickAdanielsAvickieAcandy1AbennieAskinnerArazorAumpireAblancoAfearlessAcitroenArollinsAsluggoAtorinoAantelopeAmarseilleAaramisAemilieAcompaq1AgryphonAmalachiApantera1AviewsoniAethanAyeahAmarbleA02081980AreptileA02021990AchandraAkilleAdindomA01091987AevangelionAhandballAnancy1AbarselonaAdravenAzxcasdqwe123AsandrineAfuck1AsprinterAfyfnjkbqA01041985B2101988AstinkerApalmtreeAsonyericssonAhottiesArampageAseabeeAchickA1776A987321A10011990D51987C101986B1061985B2121985B3061986B4021985B7051988A20111986B2011988B5800852B8021992AgordoAbigpimpAquestionAsoccer10AboytoyAquasarAcarpenteAspartan1AamandAlucaApasadenaAbiatchBenoitAglockAcoldplayAexpertAaudiAmario1AcastorAdeadlyAfairlaneAjoe123AelcaminoAcallistoAglamourAdatsunAstudmanAhansonAmentorAtomahawkAshamusAgladiatoAdiaperAkeishaAstupid1CylesBqueakAcaymanArunawayAdentistAnavyAskipAfantomasAthewhoAzippoAcastilloAluckAariannaAhoneybeeApapitoAyamahar1AholycowA02031989AukraineAdoorsAwildwoodAyellow1AskibumAgamblerAhelperA09051945AbestBrown1AmaliceAdavid123AkarachiAjewelAexciteAtoiletAcorinneAmortonAjohngaltAsweetnessAoptionsAlorettaAmcdonaldAsf49ersApalermoAbuffalo1AplayaAlambdaA02031980B1121988AgideonAmattheA02101981AmedvedAcheshireAsuperiorA08121986AministryAtrinitroApebbleAcasper1AbismillahArosesAelefantAplayer1AcapricornAharlemA04041991AnikolaiAvendettaAbobdoleA03041986Awizard1A02101983AmanfredApinky1AbikerAmargaritAbigpoppaAsuccess1AijrjkflAvoyager1AasimovAbruce1Awinter1Ailoveyou1A01011995AdominikA1210A24680A100500B96969A415263A11051990B6051987H9B7061988A20031987D91991B1031990B2021986B5031987C121987B7061988B8011987D21990B9011985D51989D71983A30041986Aparis1AlimitedAvitaminAcalibraAzarinaAperryAiforgetA04041988AglasgowAshrimpAantaresAholaAantoninaAjamessAhetfieldAwarezAbigonesAcutiepieBhapmanAbolitasAdimasAnonenoneAbestbuyApapillonAbaritoneAknockAeightAstreamBleepBtephaneAfreefallAvjqgfhjkmAshowA0000007ApriestAjulesAmischiefArogueAhateAfoxyladyBlipAernestoAdominionAviennaAmacmanAenforcerAdevoA3x7pxrAparolAtophatAmeganeAdungeonAleedsutdAf00tballAmingusAskilletArobinsAtwiggyAbitchyAgigglesAremingtoAalbertaAducksArfvfcenhfAbookA02011983AotisAderparolA02051980AquebecAemperorAbusteA05051989AsynergyA08051990B2041980AshakiraAolderAasdqweA01041988D61986AmamamiaAcleopatraArosarioAfinlandAmodernAcarnivalA01011994AdmitriyAcoolcatApurple1AghjuhfvvfAknucklesAmahlerAkayleighBlasteA1003C25B204A4200A224466A1234123B1121986B2031985H7B3121985B5011987D51990C101986B8061990D91985A20051988D91988B1051991C101986B2071986A30031988B1011987AnotusedAbigdawgAgrinchAchipsAletmeiAsluggerA02071978AmentalAharddickAbrandBozoApacoAkojakAtabascoAchelseAspudAricoAkeepoutBokomoAfirefighAaddisonAbarney1BlowfishA1dragonAhugoAsamiraBexyladyCvensA08031985AstacieArusty2AdimplesApostAtunaAalexandreAwhiteboyAroger1AfilmsAcromwellAmagnetoAkernelAcarrollAminemineAdontknowA02011982AacmilanAwp2003wpAsanfordArefereeAlakesideApolishA123456ruAnoname123AscreamerAcalimeroAportalAkfgjxrfAconwayArockieA02101979C051985AdfktynbyAfranciscAswingingA02041974Acygnusx1AtruckingA08081988AobsidianAsalesAaudittAmoney123A02031988AoxygenAroswellAtowerA01031989D11974ApapersBopovaA03031986AgiovannaAsasha_007AthecureA02051978AbigbangAlfybbkApizdecA12345qwA02071979AzolotoAmarijuanaA02031977D51976AkimballAjaguarsAkordell1BerouacA142857A258369A999666A10101990B3021990B4021986B5021985B6121987B7011987A21051988B2031984D41988B3021986B4111989B5041988D91987B6031988B7081990A30041987A07091990AstrykerAksushaAentryAromaAmapleAchokeBassandrAmoonlighAfenrisA12345sAduffmanAfuck123Ajohn123Adirty1AblueballBigbootyAcarsAwrestlerAsalopeBexxyAdinnerAbuildingAmoparAcecileAfishfishAparamediAcapricorArobocopBimmerAhardoneAw_passA4everAevilAalice1AnomadBuclearAasgardAseriesAadventA01031985AuniversaAjorgeAkestrelAspannerAguidoAcheddarBarlos1AlalakersAacuraAcherriesAeclipse1AanchorAcoldAyoyomaAdarkangelAaspenAbahamutAlittle1AwhistlerA57chevyAsmackdowAgalantAbukkakeAleopoldAoptionAstrawberAfacebookAsusannaAbookieAcrustyAqwedsaAnineAextraAmatrix1A02051981B1021990AtransferAbreannaAmothersAclarissaApeachyBrozacB@ssw0rdAlokiAscuba1AbootysAargentinAflameAbricksAslimshadyAdkflbrAnokian73Achris123A11111qAkrolikAjoshuAkorovaAjohncenaAmagpiesApicturesAcevthrbAsuckmydickBpankerAdogpoundA02051973AimprezaA02041975A132456B45236A357159A741963A10041986D71988B1021985B3071984B4081985B5071987B7111985B8091986B9011989D31985C283746A21011988G91B2061988B3031990B4111987B5011990D91990A31031988AnotebookAbrandy1AprospectAbettinaAgymnastAjktxrfAsenecaAzxcv123AkseniaArudolfAmarquisAhugeAdaylightAgolden1Aq11111AtribalAzackAblue32AjohndoeAhejsanAbiteme1AjeannieAlemmeinAsalemApetrovaAclutchAdjangoAsexgodDxxAcapetownAtupacAcartman1AratmanA09021988AvladAfortressAcanucksA01091985AvirusAchochaAserpentAwalletAinterAtelephoneAeggplantAapril1AcameroArooferAnazgulAfussballAcardiffAperfect1Awendy1Ahallo123AfktyrfApufunga7782AamoreA02041978AfactoryAdoggy1AbudweiserAalanisAloser1AmarseillAjanelleAwealthAaddictAgoodgirlAtimeoutAwolfpacA02051972AcamdenAliverpool1AtenchiA05061990AgodlikeAuniversityAturnipAbeakerAvincent1Ak.lvbkfA010191D31984B2031983ArepairAnbvjatqAvehpbrAsouthpawBylvesteAredhatAforever1AwingnutApatrolAmagellanAvampirAcaptain1AassasinBikmanAtrailerAmariyaAtaekwondoA258963A7896321A10081989B1031988D71988B2041986H8D61988B3011987H8D51987B4011986D21990B5011985D41988B6051988A22021988D71987D91988C121987B3021989D41986D51985B5101988A30081984AsonyfuckBtyleAllamasAcliftonAireneAsabrina1A02031978ApunchAnonameAgoldfingAmarie1A1234zxcvAjumboAhelmutAmavericAricardAantonyAhappy2Amarcius2Asusan1AballetApentagonAsawyerAfaith1AginaApearsonAhotgirlsAflasherAtracerAboaterAshoesApeppeAjoyceAcornwallAgoodieAdevonAbenitoButtersAangus1AsixpackAmandrakeAbubbles1AearthlinkAlookoutAslammerAventureAgaggedAonionA01071987AtruthAariesA12345mAlakewoodBoveyaAdogwoodAmoney12ConshinAringAwyomingAsuburbanAchallengAolympusAvolkovAopendoorA01011976B4041983AcommandeAstanley1AhoopsAjonathonAdiablo2A08081986AseymourAbeach1AashleAoreoAmurzikAbubba123A02051977AnavigatorArightAgratisAmyrtleAnativeAtripAlakers1AtwelveA02081976AhellokittyAarcticAfkbyjxrfArasmusAwormixArandy1A02091988B7071977B3021986AmilleniumAradarA07071990AgerrardA05071984B1041987AgothAasiansAgateway2AcamarossAbluejaysAgaellA333444A10031987C101985D21987B1061991C121985B2071989D81985B3061987B4101987B5071986H8B6021990B7061989C101986B8021984D41986D51988C101987B9051987D61990C121989A20041986D81991D91986C121989B1061986B2011986B3051990B4031988B6031990B7041990D61985D71987B9061990D71985A30041985A135798642AlekkerAqazxcvAbordersAdaviesAmidniteAlloydAbeaterA05071988AwhatwhatAoptimistAdamonA02071985AgotmilkAblue99AclockAdeckerAlarkinAroadAlorenAredskinAhungAbremenAenternowAknight1Aprince1BageA01051989B3081989AbimboApeace1Adestiny1Abeavis1AhattrickAaaasssA1a2s3dAdejavuAmarkieAou8123A1masterAstart1Atest12Abeatles1AscrewA2fast4uAdaddyoAnatasha1AbordeauxAstone1A12345qwerAblaineAvanessa1AroughAalchemyA09041987Aqwert40AhottAtherock1ArealAilovegodAsolarisAprotonAlinksAcardinalsAmarriageAdiscoApeggyAspenceAfannyAcomingAswedishAespressoAauggieA02071975AvbkfirfAdougieAp4ssw0rdAricharAnowayBightwishAsaigonAholesAjocelynAgsxr1000A23skidooAplatonAghhh47hj7649Ashadow12BpeedwayA01041992H0AdevinAleedsA09031988AtimoshaAroadrunnerAironmaidenAmackieAsupernovAdelfinAtoriamosA06041988AceasarAtransApatches1AoberonAvjkjrjAcapecodAglowAnevetsA1008B23567B47896A875421A10061986B1051984H6D91989B2041990D51986G90C121988B4041988B5021990D51985C111988B6051985B7041991A20021988D41988B1061985B2061989D81986B5071990C111987B6061985A30011985AmamacitaCdAderfAsandieAjaimeAlongerAcowgirlAstigmataAmunchAgonzalesAalenaA01121987Apass1AdataAshagAnineinchAa1234AwaterboyAklondikeAiloveAfinallyAbombAspiralAboulderAodysseyAamigosAsomersetA01031986ApainAburnsAmulliganAkrokodilAexploreAlawsonAcharonApeeperAredcarAfellowAambersAsloppyBaviorBchatzAmoronAq2w3e4AhardballAazertyuiArepublicApatchAreggaeAcanuckAromanticAvauxhallAboston1AangelicAemilioAdoggiesAtennis1AadvanceA02061977AaroundA159357aA06021987AspoonsArfntymrfAalmightyAdeputyA06081987AtosserAstratforAmississippiAsuckdickAhouston1AeatingAintercourseApower123AcloserA01021989AlenochkaAmarijuanA02031975AglobusAstervaAdomingoAlimewireAterefonAcoorsA04041990AsuslikBteauaAblue1234CedsoeA12345qwertyAgreedyA01061988AiriskaAhtubcnhfwbzAzasadaAsandrAawesome1AbeezerAchamp1AfunstuffAevgeniyAbballApatriciAcuervoAprintingA111777A357951A10011983B1011990B4011989D31988B5021986B6051990B7031987D71989B8021988C111987B9061985A20031991B1041992B4031990D91986B5011986D61985B7081986B8051987B9051985D61989ApastorAfunkyAtheforceAchiquitaAstrapAyessirAdamanA05081988AbeechAstreetsAchaos1AwxcvbnAadmin1Aholein1AmaseratiAberryAqqqwwwAgeezerAcoralBabernetAjoecoolAnastiaAeggheadAdorisAsheepdogAterrellAjomamaAkaneAarmandoAhairballAchristaAaileenAclarkeAinsightAafrikaAvancouveAtenderAmunichA02071976A123456789mAgrandamAbradyAlucianoAalcoholAsheepAdefaultAidefixAcyprusAtreesAscheisseAmontana1ConeyAambroseAhoffmanApimpdaddAbaltimorAjennajAm123456AnorbertAcallAjaegerAmash4077AwatfordAdavinciAmizzouAsteven1AgocubsAsquareApigpenA123456tAhoudiniAjewishAtomasAkirklandAopheliaAriccardoA07051990AanotherArodeoAlunaAbonanzaAlhfrjyA02061976AsigmachiArevolutionAdragon69AfirenzeA03041980AselinaAabsolutelyAlbackAghbrjkArfhnjirfA05091988Asammy123Bophie1AcvthnmBolonialAtoolboxA04061986AhunteAringoAbongoA02101976AazertAjunkAbananAhowellAmagic32AlilianaAq1234567AmedinaAridersAelway7AilikepieA09021989AtoonarmyAladdieA01031983AfootjobA06051986AkronosAeskimoAwolfenAnatalie1AbarleyApancakeAbigdicksAdabombAcashmoneA02081981AjunioA02041977Adylan1A01021988AmonicA1004A3006A123459A223322A556677A996633A1235789A5201314A11011991D71985D81987B2071987D81984C101988B3031986B4021987D71987B5051987D81991B6011989D61986C111990B7071985B8051990D61985B9071986H8C101990A20031988B1021985B2021985D41986D61941G87D71989D81983C121983H6B3011985D21985B4061987H8B5011985D41985D61986C101989B6021987B7031989B8021985D51986AlololAmyxworldAaudioAkristianAsamohtAdominiquAjoemamaAgabberAtoocoolAarielAtwinkieAzxasqwAmarceloAdarkangeApersonaAscrapperAdelawareAtyson1AprogressAcafc91AkurtAshuttleAlinkAgabrieleAsmoothieBlimshadA08071987Aq123456789AyoutubeAfranksAnorrisAyasminAoutsideAsandra1AhottestAcumslutAtriplehAmannAstarrAmoralesAvqsablpzlaApathfindAtraceAelisabetAdoitAevolutioAfishonAbooksA02021980AflicksApeanut1AvelocityAranchAannmarieAbarry1AgthcbrAbiggunAdolemiteAvagabondAoutbackAsexoAwoodstocA02081979AmacleodAplasticsAjavelinAbootsyA02021991B8061987AaolsucksAc2h5ohA02031973AsofiaAredboneAklizmaArachelleApetuniaBumperAall4oneAmohawkAloboAbillabonArockinAncc74656Aaustin31AbaylorA04061991AkoolaidAgranadaAallegroA02021971AalinkaAnevermoreAmikaelAp0o9i8u7AforgetitAsmith1AmontagApoker1Afrodo1AbelovedBreakerAtasha1AhoneysApassword9AreginaldAsheebaAkiller123A02091976AwivesAdukedukeAarchangeAfuck69AmetroidBinimoniAwizardsAhellsingArocknrolA02041976AfabioA03071987AzaqwsxcdeAmax333AwankingAawfulAmorrowindAfriendsterAirvingAgooddayAmodelsneAbumbleAkenny1AnatalyAjulianaAcirrusAsammA03111987AnittanyAdogboneAstorageA05061986B4041985ApunkerA02011975ApurplAfuturamaAskateboardA6996A132465B0031991C111986B1081990C111987D21987B2011989D61986C121982H7B3111990B4021983D51990D71988C101988B5011986D71985D81988D91987B6031990C101987B7041987D61986B9011987D51986D71990A20021986B1041985D81987C111985B2021990D31991D41985D61990B3061990B4051990B6031984H7B7031987D91985B9051990D81985G90C111989D21987A30121987B1121990AesquireAhomemadeAkiteboyAherewegoAbedfordAdirkAlonesomeAboxcarApanda1BornkingAblackbirdAdickensAnokia1AfourAclimaxAgotribeAbleachAcheekyBucumberAvipergtsAscooby1AawnyceA123qwertAmuhammadAsummer69AjeepsterAalex12Ahello12BarborAacidburnAharaldAcallingAdingoAfirebladAchristiApinnacleAshodanA11111aAfallonA03061987B2101977AdeniroA08041986AdudemanAharrierAjellybeanAbuffetAmarinerAfoolishAwildoneApeterbilAallgoodAfieldsAdilbert1AsalamiAbugsAestelleAlightingAmegaAbutkusAelvispAhomeworkArusselAdonnerCktorAtycoonAcementAromeo1A04051988AottawaAbiggunsAlillieAfellatioAweed420AemmettAkiwiAbarflyA03031988AbaracudaAnewyearAflipflopAraleighAsingaporBpermaA04081987AmaxdogAsasha123AopennowAthedonAsedonaBixtyAterraAbluntsAlinkinBanderAalisaA02091977A12345abcA05051990AcrackersAdoubledAwarhammeAproviewAmasterbateAstarwars1A02091975AstatusA01011971AfemalesBlamengoAbehappyAlfitymrfAqwe321AstarwarBnowbirdA123456789dAcorwinAbradley1Afucker1AazzerA02101980AlagnafAdaughterAcubsAnavysealA01081990AcarebearAprotectAkamasutraAbastardsAdelmarAmusicalAdeathsAmetallAsteffenA01061987B2051975AwiseguyApimpingArobin1A515000A1598753B0041983D61987D81985C293847B1011987D71986B2051985C101985B3111984B4071986C881488B5051986B6061985B7011990D21985D91987C101987B8011986D21986D41990B9091988C111987A20011989D51985D71986B1071989C111990D21986B3011990D21988D51986B4011990D21991D61992C121986B5011993B6041986G91D51988B7011988D51987B8021986D71986B9011987A31011990Agators1A02071971AwhiplashAlaraAfuckme2AadrianoAboyzAhatredAreserveAdracoArainydayAmercedeAgrinAsmart1BtaffordAmoneCtorAontarioAstangAgardnerAweekendAjakartaAshonufAclovisAdrumAgothamAjugheadAgolfgtiAdooleyAsandAnightmarAwetterAjohnny5Atanya1A03051987B1051988AcomeinAmeadowA69camaroAchessieAmarshalAphyllisAmutantAdingleAchelleAnauticaAhaleyAcamberAdragonflAsennaAbigjohnAheelsAstickmanBamboA03071986AhiziadAsexybitchApuppydogA5wr2i7h8AdevilleApacinoCragonBointerAs123456AtarponAmelanie1AsproutAdurhamAapollo11Abigdog1AwheelerAspliffBickAgonzo1ArockwellAvfntvfnbrfAmelissAnarniaAeleonoraAleftyAchewyApaydayAatlasBlleycatBmbrosiaAdrumsAlindenAtrustmeAaustriaAphialphaAexchangeArageAlokilokiAtarakanAcartoonsA02091973B1051986AbungleAcontractA03011987AkolokolAdaisydogApenetrationA06041987AlaetitiaAgohomeA03031990B2101978ApushkinAleighAmustang2AgianniAwordupAorchardAfreddy1AadrenalinAgoldeneyAluckyoneA06031983AtusclAkathy1AescaladeA0192837465AgerbilAblancaAwidgetAsamuel1AfyutkjxtrA01011973B2071977D81974AtouchingBrinity1A04091986AsitesApookeyA1q2q3qAcharismaA07081986AinloveArainbowsAgrassAkolbasaA07091982AnewarkA12345qazAbootsieAinterneAraphaelCtedAclevelandA02061979AhenrikArollAbandit1A08051987AjeniferAcocksuckerA03031993A222777A777999A1234566B0011988D31989D41990D61984D71985B1071989D91984C111986B2011985D21985D31988D51989D91988C111990D21989C348765B4011987H8D21989D81988C121989B5021983D31988D61988D91988C111984B6011987C111982B8021987D31991B9021990C101986D11986A20011988D21985D31986D61986D81986B1051986D71987C101989B2051986D71983B3031987D51987G91B4011987D71987C101986D11990B5021988B6031986D91986C101986D11985B7021991C111985B8031982D41992D61986C121984B9041985A30011986D61987B1121987H8B69258147ApointAhello2A05021988AdragsterAbismarckAcambridgBliffA1michaelAhonorAbuzzerAsupraAtreefrogAkerryAreasonAfrogsAblake1AtreetopAcatcherAdickyAxantiaAdaiseyAsiobhanAlisterAdomeAstrelokAautoAgammaAjelloAhawkinsA123456789qweAprosperBitchAstanAworkoutBaltonAcatnipAdima123A06071983AtraumaAsebringAmichalAnounoursAkittieAburningAdrillerAangela1AthierryAluminaAspeakersAbrennanArabbitsAcolinAbuttercupAneonAatticusApuzzleAsixty9AmallorcaAdelaneyAburnAcheckerAjabberAalexander1AmelroseAzyjxrfAnormandyAarianeAdbnfkbrAbambiAluciaAblue42AwilderAthumper1AkillaAmasterpA02051979AplayballAscamperA7777777aAlauren1AwonderfulAsignalAbaseBenessereAfreeeA01021985AgettingAsmackdownAmelonsA02051990Atrumpet1Acooper1ApandasAchainsAasdffdsaA03041987Afavorite6AmelinaAsexybabeAcannibalAfostersAbeethoveAskipper1A02091971B1051990AburnerAnthvbyfnjhAmeowBalaysiaArugby1AazertyuiopA02091982ArocknrollAbynthytnAgrace1AapriliaA02011990AvenomAitalyAmeierAshenApavementA03051986AstocktonA06061987ApeppersAtantraAguillaumA32167A777333A888999A10041991C101989D21985H6B1011989D41991D61989D81988C101986B2021991D51987B3021987D81985B4031989D41987G92D81990D91990B5041987D71983D81990D91989B6021987B7021987D61991B8011988D41991D51987D61991D81988C121984B9031987D91990A20041990D51989D61984B1021987D71992D81985B2061985D71990D81991D91986C111985B3061992D71985D91987C121986B4021988D31987D41988D81988B5051985C121985B6051986D61986D71987B7041985B8051985G90D71987A30041991D51989D61983D71986C111987A789654123A007bondAreddAmannyAgiuliaAcasterAjupiter1AreadersAmoosesAworthyAroyaltyAjonasAritaAsegblue2AtrustnoAdixie1AhansolAgumbyAphish1AenriqueAbodyA123456wAabcdefg1ApaulpaulAgannibalAearlAcompactAfroschAskylarkAhalloweeAkenobiBittysAandrewsAyoung1AterrierAdirtAfarmAmarblesAticklishA07071985AfrenchyAoffshoreAjazzyAsexyoneAalgebraClison1Alucas1Aspecial1AhyundaiBotassAsexmanD69AoliveAleinadAfarmboyA02041973AmiddleAclementAamethystAletsdoitAgofastAthrasherAplatoAsoulArideAnotredamAmurphy1AcandyassAtravis1AhannesAspoogeBystemsAgatsbyAjunkmailAladderAuptownAshowerAchillAflower2AkarineA09051986AmattyAairmanA06011988Awayne1AvolleybaAstayoutAliberty1AabacabAblancheBuckleyBouncerAvodkaAbettybooAshaunaA02061981AmangaA02011979C101973AmuslimA08011986AcutieAilikeitA06061985B1051985AconstantAlonghairAtheirAkaboomAelmiraAamatoryA09081988Aq1w2e3rAnavajoAalcatrazAolenkaA01021987B9091986B5021987AmynameisA08071988AlarsonAsunshine1A04051985ApowerfulA04061984AsephirothApanterCssword01AcasioAsummersA02061972Acomputer1A1qazxsw23edcAjesus123AnikolasAruggerA05031991AsparklesAbosco1AskinheadBonysonyBnickerApancakesAcharlie2ApilgrimAananasAcontraAsheldonAgeneralsBrishaAmontecarAbriggsA02061974B10390AploppyA7894A115599A321678A951357A1234561G8B0011992D61989D71990D81983G90B1041990B2071988G90D81983H8D91991C101984G90D21986G91C211221B3071990C101987D21983B4041986B5031990B6031988D71987G91D91987C121986B8111986D21983H7B9061992D91983A20051987D61990C101988D21986H8B1031985C121985B2011985D51991D71991C121989B3031986D51983D91986C111987B4071991C101989B5081986B6071986H9C101987B7021990D31986D61983B8061988B9031988D61985H8A30011987D31986G92D91989C121986B1031987D51985C101987A1234567899ArenateBadeonAsergbestA08111984AtalbotApatheticAerrorsAspringsAneedlesArestartAstockAhikingAaucklandAjimmysApearlsAallen1A01041980AbillbillAhazardAcalvin1CpitalsA02031990ApizzamanAfitterAbiitAtazzAulyssesAjehovahAstitchAitismeAdelpieroAwindAnevilleBicoA09111987A1234rewqAvirginieAaliveAgruntAemilAoctopusA04111988AtampabayApuppy1AratboyA1qazzaq1Aplayboy2AgabbyA1millionAvampire1AplaymateAzorro1A08101986AdfcbkbcfAcarrotsAisthemanAjarrettAyamatoArumbleAilovepussyAwonderboyAmontroseAdunlopAwerdnaAcassandraBlementeAtralalaAcollieAswooshA06031992AdreamcasAtrackAsliverAlondoAcocoaArfgecnfA05051991ArollinApaintingAmakakaA04041987AthebearA01071984Azxcvb123A05011987B4061987AlockdownAblacklabAriffraffAlegsAkahluaAfidelityA05111986B8121987Afrankie1AalexiAwingerA07071988D51987AedmontonA07071982ApressureAstreamingAamstelAsupernovaA02081973AfujitsuA05031990AfluffAtango1AsamanthApanicAnapalmA08051989Ajustice1A09081985B7071984AcamilAblubberA02031991B1021992AtujhrfAgatitAtittsAcampingCbleAbabycakeBudgieAdaniAvfndtqAfuckme69AhewittAspotAfrederikAmotocrosA01101987ArustydogApinetreeA07101987A120689B357911B0031990H3D41987D51990D61985D71986D91984B1031983D51988D71987B2071991D81987G90C111985G91D31213B3021985D61985D71987B4101986B5011983D61985D81986D91985C111989D21987B6061987H8D81986D91988B7021989D51987H9G90B8011985D21992D31988D51989C101985B9021991D61991A20041985D61983D71988B1031984D61988B2011992D31986D51987H9D61984D71984H5D91991B3061989D91985H9C111989B4091991C121987B5031983G91D41991D51987D61987D81985B6081986B7021992D31992C111989B8011988D81986G90C101986B9011982D61986D91987A30011990D51987B1051993D71990A44332211A66613666A1234509876Akeith1AdufferAollieAbentonAtetsuoAglassesAnestorAfeelgoodAcolaBleanerAroccoAbenny1AsmirnovAroxyAdummyAlooseAmaximoAicelandAtigercatAcitationAblitzAicecubeAburnoutApuckAtwistAassesAnoelApanheadAadelinaAhanumanAsunlightA02061971AcupoiAbigtruckAphatArolexA06061981AexeterAr2d2AkingkingAlilbitAcanada1ArhubarbAmortenAtrooper1AcusterAbufordApapamamaAmouserAbowtieAperkinsAtoastAshark1AhusbandAbetsyAjeffersonAseriousAelementsAzapperA02031974AharrietAcumminsA02051970AsemperAherringA123456asAsonic1AacceptAvideo1AbuckyA07071989AlemansAwinonaAfinderAtrebleApassword99Bopcorn1AstellarA04041986AsaskiaAdoreenAchavezAblue11AfurballA08021990Aasd222A02021978AcornerA05121990B3091983B6021986AtitfuckA02011977AsalmanAbagpussA01081985B4071986B1091992Ablue23A09051987B7041987AdarinaAfrancineA05031987AredstarCvolutiAmommy1AsniffingAchouchouAgiants1AquickAgarethAusmarineA03051988B1121990AdresdenAjulioAdoomA09091988B1081992B2041972B7101984C021991B3041983A123456qqqAmalishAplanesAvideosAentersA08081990AnymphoA123456dApajeroA03031992Aleft4deadAengland1AbooyahAconquestAdelldellAbrestAeuniceAmomdadAslonikAnursingAbismarkAlol12345A01011972Amet2002A123456nAgarnetA02061978Arambo1AbonnerA07081987AgogatorsAplease1AcashmoneyA09041986AblobbyA04071988B2011976AdimitriA3ip76k2A07091988AfabiennAikloA123450B0021986H7D51988D81987D91986C101980H8B1081986D91985H6B2021984D31990D61987D71984C101989B3031989D51990D61991D71985H9D91984C101982H8G92B4051983D61988D91987B5011988D61984C101991D21983B6011986D21988D31986D41985C101986D21991B7041985H6D61987D71986H7C111987D21985B8091987C121812F985G90B9041985D51983D81987C111985A20011983D31985G90D51983D71984C101987B1021989D51990D91989C101987H8D11986B2051988D91984G90C111988B3021983G92D41988D61987D91991B4071992C101984G90D21988H9B5021986D31984C111991B6031991C121989B7091991B9041988A30101988D21985H8B1051987G91C121985H6AcyranoBrappyAvolcanoAeatmenowA02111987ArenatoAgoodyearAbuddA08031987AspoiledAkamillaAhogtiedAomarAlunchboxAmantleApiercingAmakaylaAcyrusAasdfgh1AmufasaAbeauBoobearAtownArudeboyBiversidAhemlockAjohn1AonionsA01091988B3031984AholgerAscissorsAhoundAcrescentAerectionAliberoAhairAentranceAfduecnAweare138AitalianoArufus1AmatchboxAramjetAacapulcoAmohammadAtrekAweinerAlebowskiA03031987AridgeAsurpriseBhampooAlovermanAmonkA12345rAabracadabraA03061985Adiver1BuaneBnsadmAfishermanAtoomuchAathomeA01061983AwhattheA08041985AsomedayAdan123AcelebrityAmadagaskarCrcinAvaleryAmaisonAforlifeAmindyAazraelBlainAdreamingAhardyAmercury1AhfytnrbA01051980D71990AmacintosAtennesseAhardwoodAsweetheartAprideAinvestA03071985AmariamArhfcfdbwfBonaldinhoAmasterbatingAdiscusAfabulousAsextoyAthisAinstantAduckmanAcaracasAbegemotAparlamentAmigueAalpha123AsylvieAnadiaA04031991AvegittoA02011971ArequiemAmisiekAaltoidsAnaughty1A09031987B3061986B2061990B5051986D61989Amazda3ArhinosApaladin1Aasdfg123AliliyaA06011982AdragonballzAretireAtheseA07021980AhellasA07061988ArfhfvtkmrfAcapcomArjhjkmAassAkicksassAdentalAhoresBarmanA07041989AsharpeA09041985B5061988B3101991B7031989AlookinApoptartA02081970Ajeter2ApugsleyAgambleA08081989AhawksAjordan2AgladysBraniteAsqdwfeA5000A111555B23890A334455A777666A1231234B0011980D31980D41984D71989B1031986D41985D61984H6H7D91990C111991B2021990D41991D71992D81993D91986C111984B3041989D51986D71982D81986D91986H8B4031986B5011990D31991D51989G92D71990D81989B6041988D91990B7051983D71990D91985B8031986D71986H9G90C111983B9041986D71989D81986C121988A20031992D61987G91D81990B1021988G90D31986D41987G91C101983D11983D21989B2071988G92B3031983D41991C101987D11986B4041984H5H6D51989D61985D71990C101988G91B5021985D41987D51980H8D71983H5H7D91989G91B6011986G90D21992D61989G91D71984B7071988C111990B8021983D71985C121989B9031990D41989D51992A30051986H8D61988B1051982AgoldeneyeAinterestAharmonAmelaniAzachAspleenAalfonsoAjeeperA07081984AnatedoggA09051984AemanuelAlocksA1qazxswAtammy1AlizzyAmentholApharaoAalteregoAdonna1AfickAbauhausAalexxxAbrookAjerkAcbr900Amedic1AvaughnAsimple1ApongAlakeAibrahimAhuskers1AmogwaiAowenAaol123AbenjamiAnickyArabbit1AadelaideAsmurfBkirtAnineballAshadyAmafiaAtiamatAaircraftAbamaAhavingAdipsetAloggerAmamasAgerryA04111991AtrentonAaltairA01041993AjinglesAmallratsAbackboneAcleverAstantonAdipperAinnocentAunlockAchenAdonjuanAharleAtermiteA05041985A49ersAmissieAdiamonAencoreAforbesAziggy1AfollowAtrashAfreestyleA03061988AzerozeroAshovelAmatisseAanonymousAlaserjetBeeannAparkourAwatermanAballsackBluejayAshakurAwelkomAdangerousAghjcnbnenrfAhackingA01031981AflyerAinformationA03091988B7041988B1061992AbabybearAhighlifeAradugaAfavoriteAlaser1AaisanAprobesAsuckedAljxtymrfA05071985AbeccaAtrinitronAbeatAclipsAthumbAdesktopAmuffin1AthingsAsupersonicAblueberrA123q123AsatchmoA05081992Aclaudia1Ademon666AnatalyaApookyAvictoriAlegosA06061988Adiana1AgloverA03041984AborodaAtamerlanA1qw23er4AchamberA03041989AqwerasdfzxcvAmarielA06041984B4071987Aflyers88Anokia5800Astewart1A01071988Aiceman1A01041983AbathingAchessAmangosArapperAdarkoneApokemoA05081986AdoucheAredwineAismailA02091978B6101989AhumphreyAjustiA03031991AmaximkaAcashflowAireland1BmplantsAjuniperAgraysonA08071985Acantona7AbobmarleyAshojouAgrammaAprincesaAbendoverA04021990Ajulia1A05121988AgiggleAcloudyA03011991Apenis1AgotenksAsopranosA159263A250588A333555A456987A963258A1237895B0021983D81991D91985C101991B1021990D41986H7D61988B2041987D81986D91990C101986D21984B3021991D31991D61990D71991D81987D91987B4021991D41991D51987C101983G91B5031987C111986D21985B6011985G91D61990C111989B7021986D31992C111988D21986H7B8011984D61986H7B9011985D21985D71983A20011987D51986D61980C101986B1021986D41990D91990C111989D21988B2041991D51990D61991D91985H7C446688B3021991D51984D61985D71986D91982B4041990B5051989D81987H9D91992B6041983H8D51990C111984D21987B7061990D91983C101987H9B8021989D41988D51988D71984B9031982D41987D51987D71986D81982H7C111987H8D21984H8A30061985H9D71992C101987B1011985D51986D81989C101991AlarsenAkappaAworkerAmustang5AsparkAplacidAdownerAscrewyAamigaAhillbillApearl1AklausAaaaa1111AsimonsAmortisAlelandAbinderBorderAchemistAflower1AoralAgoneAbuster12AcarlisleAprotocolAdynamicAajaxAtalksA05061983AtuxedoAcookA01051987AamatureAtriplexAdudesAturbosAjennifer1AedgeAringerA03061984AjokeAgrimaceAjarrodAsocceAfeathersAnemrac58AriddleAxianAwonderfuAsurgeryAqweasdzxc123AbourbonAdickdickAbiteA06061990B8021989AannaannaApimpdaddyAbauraAcommanderAhelsinkiAbasilA8inchesAcyclonesAbongAmacaroniApolluxAfunkAmotownAfiddleAthebeastAmarauderArodrigoAoysterA09101985AlistenAfruityA06021989AchachiAhandAgizzmoA01041989AblinkyBraves1AprimeAhancockAespanaAlennoxAcorinnaAfrisbeeAlanciaA02031970AsapphicA09051990B6091989B2021977A123456gAhomepageAspock1AdimadimaAwomansA03101985B4051987AhalloweenApinkieAmetal1A07021987AcheerleaersAshopperA05041986Asoccer11AjosiahAredheadsAwellerAscoutsAphotonAmetallica1AgarlicA03121986AgreywolfAestrellA06081986AdivaAghjcnjqAalvaroA06081988AegorkaA06031986ArfhfylfiA08111983B1031980B8061986B6051987D71984AreevesApicksA123456789rAreloadedAhollaAmierdaA04061990D21985AgigabyteAflvbybcnhfnjhAdortmundAkoreanBaraokeAsashkaAgodblessAalldayAflipper1Apro100AjurassicAexperiencedAthebestA05101984AnimitzAlove1234AtrigunAcoolhandAbanana1AkcchiefsA09011990AdickerAbaboonA05091987B8071986AbarefeetA1111qqqqAjesperAbelkinAzoomzoomAasdasd123AmadcowA101091mAgreedisgoodA198A5683A918273A7412369A10011989D21988D41989D51986D71983C101987D11989B1021984H7H8D51989C121990B2031986D61980D71982B3021984C121989B4031990D51986D91988H9C111987C785236B5021991D31986H9D51991D81980B6021989D41986D51986B7081990B8091984C101989B9011986D91986A20021990H1D51984C111987B1011985G90D41986D61989D71990D81990D91987C121987B2031987D81987B3021984D61988B4021985D61984D81990B5021983H4C111988B6041990D81983B7011990D51986G91D61989D71983D91984H7B8011989D41983D51989D71988C121990B9011988G90D41984H6D61984D81988A30081989D91985B1031990A77347734A1020304050A0001AsuedeAmargotAwillardAtetrisAcypherA05081989AgavinAneverminAapricotAlegmanAarizona1Blex1234A111aaaAtrickAnopasswordAabacusA55bgatesAmotoAtucsonA123456789987654321ArosewoodAshane1AdankAanalogAoutsiderAminnesotAganjaA07111987AdarthvadA06111986ApaulinAgetoffAchappyArangeAsalsaAolemissA07041985B6071986AwarwickAbaby123AtaffyArubiconAbellagioAredlightAhandbagAaztnmAsweepsAbaberuthAgirlieAmessengerAteensexApeabodyAabc123456AcopenhagAmaxiAnoles1AbigalAlavalampApatrikAdougalAculinaryAwannabeAamelieA4youAliptonAbeckham7Ariley1AcummAdoughnutAtessieAhortonAtrueblueBotoroAhoganAlineAkillianAasdfqwerAbrambleBowlAadvancedAelwayAmontereyAsourceAwhoresAmytimeAseasideAwhatupBaterfalAsickboyAbukowskiAsmile1A07061986AunionAfreedoAbogusAmetroAarsenaBimeeA05081987AverenaAfigureAtbirdAangel2AlianA06051983B8081983Amario66AkaraAspookAbigblackAgianlucaA02061973AgolfproA02101975Anokia123A09041990AtaichiAsmotherAas123456A06081990AblackhawkAcharleAonlyoneA05041990Aaccess1AdtkjcbgtlAwaveAsalvatoreAdavedaveAgilmoreA03071984AtribbleA05041991AwanrltwAjettaAkristin1AalexaA03021987B1041986ApyonAsatelliteA04021987AfestusAwazzupA05071983B4031982AdaredeviBuckduckA08021985B3051985B7031986ArecallAkamikadzeA09061990B3111986B1091986B8081979AbiohazardA05071986D51982Aphantom1A1q2q3q4qA06071990B3011986AalekseiAtrampleA05041983B7021989B1031991AaviatorA08011988Apoppy1AsaritaAfrazierAdfytxrfAyinyangAaragonAdeathnoteApertinantAlilwayneAsierra1AmeteorAvidesAhakrBotgirlA06111990AblackberryApoopheadAglitterA04061988AbbkingA08031988AstilettoAasswipeAwearingAgallariesAfungusAmammothA02011978A1234567aaAriverratAjesse1A04011990AfishtankA04081985AdominiqueAzurichAgriffithAnightowlAwaitingA04111989AcivicsiAvaleriyaAtabathaAdrivenAnatchezA114477B0051989C111983D21989B1031987G90D81983H4H5C101990B2021987D61984G90C345677B3031990D51988D61989D81982H8D91990C101985G90D11985H6D21990B4031985D61985D81986C101989B5031984D41983D81984C101983D11985H7D21989B6021982D61984D71986D81985B7011985H6C111989B8041983H8D51982D81989B9101989A20011985D71985C111984D21985B1011986D51983H9D61987D71983H5H6B2081990D91983C101988B3021987D31989D71988B4011986H9C101987D21984G90B5041983H4D91984C121986B6011989D21990D91985C121984H5B7011983H5D21986D41987C121988B8021984D41986D61984H5D81985C121986H7H8B9031983D71988D91990A30041988D71983B1071986A741258963ApretzelAmypornAexportAjoelleAqweasdzxAskilledAlandAgizmosAsiliconAlizzardAdeltasAstandbyAtopolinoAblahBuddydogArrpass1AorgyAcare1839AtitmanAqqwweeAthinkAdick1AbreakAneilAkismetAhappymanAaaa123AdeadspinAcrispyAeighteenAminiAhartfordAmongoAsofttailA04051990AschumiAbeaversAjupiter2A1loveAlucky123AzeldaBuluAltkmabyAmuffyAblazersAdogmeatA04121986AmustanAjoanAblondsAstonewalAissuesAmidlandAlawmanAmyspace1AflemingAdingbatAhotratsApowermanAsoldatAwhalesAsmartassA08081985AbedlamAwaldoAchitownAnestleAz12345AwoodmanAqwerty13AprototypeAstrifeAdipstickAangellAcelinaBrapAdarkelfAlizaAsurveyorAvisitorAnascar1A1234qazAatreidesAicarusAnicetitsAchopper1A03021982AbellacoAamorBltheaAz1x2c3v4b5AfelineAmastermindA05121985AmanunitedAamonraBhmedA05121983B1071989Aalex1AcfvceyuAzoneA112233445566A010181AalcatelA123456vAcivilwarA05101986C021989AgaymenAharcoreAcorazoA03081984AdownhillBallas22A2hot4uAmendozaAinteracialApusyyAclintAshitshitAwaterskiA01061985B6071988AallahAgoose1AsocksA07011989B3101983Aass123A07031988B5051988B1011950AmonkeyboyAaudia6A01041979ApjkjnjAcontourA07031985B5061987B6031988ApassordAturtlesAdaniellBtxyjcnmA01111990Aprincess1AyfcntyfA06111984B1041981AnosferatuA02101974C091974AheliosAoswaldAekmzyfA09051983B4121987B6031984AfynjirfA06071985AtayloAprophecyA02091979Afunny1AvincenzoApitchersAreneBainingAsealteamAmousesAkakashiApaxtonAtortoiseAcravingApackAkuanAjimbeamAsummeAintegralAnotnowAdrag0nAstart123Alight1AchewbaccAdeerhuntAgreenmanAwinter99AhooyahA02021974B9011987AmyworldA04121985B2081975A444555A902100B99888A10021985D41982D81988D91988H9C111981H8D21979B1041988D71984D91983C111979G83B2041985D71983H5D91987B3021989D81984G90C121984B4021988D61982D71983D91982C121986B5021988D81985C101987B6021983D31987C111987B7021988D71984D81988B8011989B9071985C101982H3D21985H6A20041981D61989D71981D91984B1121984B2021984D81985B3011984H8H9D31988D61983D81986B4071989C121985B5011988D71989D81983D91988B6051987C111987B7051984D81989C121986B8031984D71989C101988B9011983D91986A30061986B1011983D71985D81985A789632145A1357908642AdasaniAmiami1AkikimoraAnothing1A04051983AkarlA03011984AvantageAfudgeA01081980AredoneAdunbarAsonoraApeaveyAmanuAbarrageBonovoxAwillemAriceAslashAcarmeAlocutusAbryan1AocelotAhamperArocky2AbelairAmercerAaaabbbAgentleAmike1234AgirliesArootAchuck1AdensityAcontinueAgalileoAviragoCckyAgroundAcrazymanAdoodlesAhydroA08061989AattractAvolvo1Abear1AjordonA2wsx3edcAbertramAlapochkaAwormA09121983B6071987AwdtnjxtrAbatistaAxxxxxx1ApintoA05101983Aaudi80AmorgothAkubrickAdemon1AchargeBalypsoAdisasterAsuckcockArippedAmakeitsoAanton1AequinoxAbenjiAfishyBullerAlonnieAolympicAtalkAbrackenBizzareAsammysAcamero1AmetooAsableAkurtisAfivestarAbelineaAscrewyouA123456789vAabraxasAsentryAtotalAoaktreeAhonestyAolympiaAcaddyAadidas1AdaniellaAassholApersianAspiffyAjaguar1AshotAforeplayAmizunoAcantonAdaffyAtimesAfisterA02061975Aa1a2a3a4AblueberryAgizmodo1A01021986ApaperinoAbisexualArodrigueA06081985B3101989AdarrelAohmygodAlfybkfBibertadA01021980AshurikAlockAmartianAdanilkaAanimatedA02081971AeldiabloAmashkaAnateAwomamAlunaticA04081989AskolkoApoop123AbluestarAagassiBladdinAticklerA08041988B3021989AyouknowA03031989B7041986AmatriAjackie1AtaipanAcool123AmarkmarkA02081972B1071985B7081989D71986B4041984AhondurasAtobydogA01051983AquakeAneutronAvolleyballA04011988AcarolaAnachosAhatterApizzahutA03071989AtequierA07071980B1061984Aq1q2q3q4q5AconverseAmaxpowerAopusAdragonflyAfishcakeAmississiAgirls1Apic'sAseductiveAntktdbpjhAsolaceAtadpoleA03101988AgalaryAtraktorAhappinesAbengalAhotlipsAportiaAvegittaAhotelAbadabingA05051980B8091988AbikersAzimmerAstormsA03081988AmoonmanAnightwinApitcherAcomeonA01091984Akenneth1Araymond1AbonersA02071974AdoneAhilltopAsprocketAownageApassmastA3000A741258A852258A986532B99000A10031985H6D51983H5B1011980D31982H4D41983D71983D81982C101985B2011988D21986D31989D41983C101987B3011981H5D51985H9D61983H4D71983C121988B4031984D81989C101985D11989D21987B5031985D41985D71984D91983B6031985C111983D21982H5B7021982D91984C111982B8031981D51985D71988D81986B9021982D31980D41987D61984H6A20011984D31984D91983B1051985D91984H8B3031985D81984C101988B4021986H7D51986H7D71986D81987B5051984D71986D91985C121982B6011981D21985D41984D81985B7031985D41988D71984B8051981D81984D91984H5C111986H7B9061987D71987D81983C121985A30061982A99762000A123456987A918273645AshineAruthAlandmarkAgravesAharpoonAfleshAdiversAaugustinAmark1AnathanieAkissmyasAmantraAsmithersAgeorginaAbdfyjdAcaliCseAabdullahAenvelopeAsurfer1AdealerAmartAracersAblue1ArussAmagentaAshellsBternCoppedbyAloopAclimbingA7groutAmutleyAbeverleyAedcrfvAalessandA04071983AgraduateA01081988Aspiderman1AforeskinAalpinaAmeggieAjesus777AstephensAfishermaAcullenAnassauA03091986Arocket1AconfirmA123456789oAfriday13AritterAaddressAleavesAjenningsArandolphAguillermAbenedictBismillaApragueAheyyouA07011988AhondacbrAspunkAevansAlourdesCcustAwhoknowsAbluntAtherapyAghbdtnrfrltkfAmelisaAcanaryAvfhujifAcolorApaisleyAbooger1AjonesyAsaffronAconsultAbigdick1AsephirotA05031988AzxccxzAtyrantAruthieAnewuserAfiredogAshieldAcorneliaAfieldA04121988Aqaz123wsxA1z2x3c4v5bAnokia5530A09051985B6031985AgabrielleAbreadAanfisaAelpasoAposterA07091985A123456fAnegativeAwebsol76A03031983B4121984B7021986B5051983B1031987B2051974AbrennaAgarnerA09071984AsokolovaCulflyAalysonAdiapersA09011985AfoxfireAindia123AweaponAhugobossAkontolAfuzzy1AwebsolutionsA01071980B4051984ArevealAbadboysA06101986C061982AbaddestAshowingA06011987B7101985AthinkingAmalikaA01111987AwerterAopenitAfinalfantasyA20spanksAtimoxa94AmalinkaArhjkbrAmamochkaAciaociaoAgodspeedAmonsteAayanamiA1234567890zAmazda323AjonathaAtictacAlockoutAasideAgangbangedAutjhubqAwally1AgagarinAreubenAmorganaAospreyAnurlanA05031986AlovehateAqianA04011987AguanAsafewayAyaroslavAhookersAnorfolkAshoeBkydiverAtreyApisserAmagic123AseadogAdogfartAkristen1A04111986B2101982A25252A120986B30680A214365A515051A777555A895623A9111961A10101983D11987D21984B1011982H5C101987D21984B2021980D41984C111987B3011983H4D31985D51983D71988C111988D21986B4061984C111988D21988B5041982D61983D81987B6041984D71983D91986C101985B7011701D81984C111986B8021982D41985D81987C111984B9041988D81985H8A20021981D61981D81987B1011987D21983H4D91986C121980B2051980C101985D11982B3091983C111982H5B4051985C101985B5021978G87D91986C101986B6011987D91984C101984D21983B7011986D31983D71982B8021981D31986D51983D61983D91987B9101985A30011983D51984AsurveyAqq123456AwilliAsquirtsAprofileAarchitecAphilippAbuddysAmikkelA01071983A1bitchAcreepersAopiateA09121987AhoratioAkristieAbergenAgetitAdfhdfhfApaigeAjeffrey1AfroggieAaspirinAdidierCveAcame11CnineA12345dAbandAtrentDetreeAbigdAgodawgsAleonieApetrovichArotaryApommesAreturnAlionheartAmayaAchairmanAplaneAhoneybunAgolfnutA06111985B9071987A1qaz2wsx3edc4rfvAjohnnieAbuckerAslimjimA2sweetAandyandyBllstateAchristopheAticklingAzingerAletme1nAdarianAtopsecretAjosepAreconBoostersAinstinctAteaserAdaddysAbigbucksAhumbugA03071983Abuddy2ApusssyAcrumbsArainerAskunkAeloiseAwsxedcAsmallsArhino1Ailya1234AdeniedAfightingAdirtydogA03091984AankaraAgaylordAlosangelesApippen33AsenateAqueen1Amarty1BerchantAadventureAfranciscoAleonidasAenderAblade1AprayersAflandersAwizzardAbucksAespritAspoonerAvancouverAjeepersAdingerAsugarsBystem1AkenzieAgeorgia1AjoleneAgucciAhorrorAtrout1AsandbergBusieqBcrotumAletsfuckAslipperAlighthouBaughingAdanishAb12345ApistonAgeneral1AlocolocoAqw123456AdaredevilA02011974ArhfcjnfAindiraA05061985Abears1A07081982Achickenwing101Aboris1AicecoldAspainAheroAfresnoAvalleywaAlivewireA05021985B1041982B4121982AdashaAlivelifeA05121986B7121987AwebsiteAproducerA08031983AdebraAchadwickArosebud1A987654321aAyorkieAfantomAkontaktAmouseyAtellerA03101984B9071986AcatfightAa1b2c3d4e5AedwinArehbwfAheavenlyBonestAtribeA01101985AloveisAblackopsAgalwayAdiannaA04081986AhydrogenAsarasaraApakistaAwiccanBafflesApavlikA02121983Acool12Aracer1AtrueAsniper1BlutteyAantonovAwombleAfaraonAobjectsAlehjxrfAsplendidAvodafoneBfcnthAslapnutsAgodivaAberniceAwachtwoordAdewaltAnolesAhobartAbp2002Anancy123AseboraA02041970B1011961B9101986Asandman1AbuddiesAralphieApufferAtracy1AfujifilmAcoochieAmarcellaAtristaAvbienrfAbaronnA6669A101080B20786C4038A258000A1475369B0041985D51984D71984C121982B1021981D91987C111982B2051981C121977G81B3031980D41984B4031987D41984D81982D91986B5011981D51982D61987C121986B6071985C111986B7031983H4D51986D91986C121983B8071983B9081983A20011981D21983D31980D51981C111985B1051984B2041983C121982B3041985D61980D71984B4081986C101980D11983D21982C681012B5031986D41980C111986B6061983B7061984D71985B8031983D71983D91982C111984B9031986D51984H6D91982H5C111983D21986A30011980D71985C101984H6B1031986C101986D21983A123581321AplaceBianosAcleanAbig1AcandiesAqpalzmApunkassA05091985AjoystickAamaliaBddictedAfloweAroadwayAbustleA010170AribbitAthirtyAmethosA02091972AblockAanthony7Avictory1AnermalAloadAaxioAshaylaBnyderAphoto1BeddlerAgoofy1ApiggiesAramsApashaA01121984ArockrockAaccess99AvixenAludacrisAblinkAwilhelmAnineteenAcocacolAflintAcousinAsalinasAgetlostAanytimeAbeermeAfringeAdecimalAlionhearAalexusA6uldv8AeditorAquant4307sAtammieAinfoAstripesBeawolfBwiftyAdorkAflashmanAbogotaAdasherAladyboyAgraywolfA07041983AqaywsxAparadisAz123456AmaurizioAplantsAbullitAjessiAelmoAmusicianAinfectedAgerhardBarrisonAbadboy1AkickAforsbergBlatheadAeagle2AokinawaAsaxophonBmoochAbundyAmonaAdopeA09121982AcomcastAsilkBarajevoAa1s2d3f4g5AloaderAtonytonyAezekielAbigjimAtatjanaAmuschiAbasementAlacosteAfernandeAcometsA123456cAgdtrfbAsusieBquidAmpegsBonkey69AsabreA02081978ArowingA01061979AseamanArebootAwinfieldAbahamasCtman12AmorenaAniggersA06051985AsingaporeAtimurAlincoln1Ahorse1AindainAdoradoAindonAduffyAescorpioAorpheusArfgbnjirfAmolly123BartaAsherylAmygirlsAunderwearAmauriciAnikonBewnessAhippoAredlegAghbdtndctvA01091979AslavaAgerberAbooboo1A08101980AgoofballAzxcvasdfAlegendaAsicknessA05081985B4061982B7021984AhugetitsAgfynthfA01091980Astar123A02031976A3rjs1la7qeAinternalA07061985AsquertingAfirestormAp0o9i8Anissan1AstarlightA01121985B6061983B3051984AtortureAblackiceBandiApassword11AmathiasA01081986Ajessica2AmailruAtangerinAdragon01AkittiesAqazxsw123AsmirnovaAranetkiAunbelievableArhythmAnastenaAbernardoAwarcraft3AshannoAoscarsAglovesAzebrasAbazookaAinfamousAhousewifesAnfhfrfyAglendaAfamilAstopitAkatelynAhillsideAprivacyAhospitalAralph1AodinAmacgyverA02061970B5041984A1009A748596A10031984C101982B1051979G85C121981B2031984D41978C121980B3091985B4021984D51985D61983C111982H4B5051983D81983C101984B6011983D61983B7021983D31985D41984D61983H5B8061984D71981B9111984D21982A20021980D31983D41984D81984H5C121982B1061983D71982D91985B2101981H3D21985B3011980H2D31980C121983B4011983D21983D31985B5121983B6031985B7051985D81985B9091980A30061981C121984B1071983A74123698A159753456AmacacoAfreakedAbigred1AvinceAchevys10AacclaimAcesareAlahoreAblokeAsamirBurvivalAgutterAhooters1AnoahArisingAdouglas1ArushmoreAdawgsAgarlandArebelzAandroidAhoochieAgibson1AshakerAkelliAcourtAvirgoAbasicAsciroccoAfuzzballAmikadoAlilyAfrogfrogAhotspurBeliumAtoadA03041985A911turboAbeefAdetroit1AadministratorAcornholeAmonica1A0o9i8u7yAhoseAterry1AletmeseeAoffspringAargyleAnatahaAaaaaaa1Aschool1Amike23A02031972AclemensAjohnstonAdaniel12BustAcodeAshredderBweeneyAwednesdaAestateAraidenAtrufflesAnathanielAfantasiesAimageAdunhillAchowchowAatlanta1AcheckmatAphreakAstarliteAcalebAjacketAtruck1AallnightAvgirlAhorsemenBigherAshopAjosephineA05111982Adante1A1mustangApregnantAromarioAfirehawkAsparhawkAcosmo1BrosbyApokeyAfavorite2AstirlingBilveradoAfreewillAlabiaAvegas1AstoogeAglendaleAa111111B4techA02031971Agroupd2013AvflfufcrfhArugratAaerosmitAraptureAeyesAangel666Abmw318Acrash1AfaridaAjediknigAclose-upApoundingBissedA06021984B2121981AlesbainApulledAalertAnexus6AfuntimesBmaleAgfgfvfvfAsantiagAcorinaAevangeliAarcheryAstokesA02041971B3051981AlacrimosaAastro1AbionicleAvisitedA04091985AestebanAmadonna1Abutch1Asooners1AorangA06121982AdevilmanAlamborghiniA03011985B7081983B8061984AwoodsAangelitArockeyAtunnelAbaggiesA03051979ArjhjdfAcnfkrthA08071983B5031984AnadejdaAexperienceApietroAcarpediemAgarretAreznorAschubertBhelby1ApoissonAfranBhntvrfAcaitlynApicnicAbassoonAmilamberBotocrossAeuphoriaAbrowndogAasdasAluckymeAdomenicoAtelecomAskeeter1AbajinganCker1A08061985AhuskyAscorpionsArapierAlydiaA123321123321A06101985AbertrandAfrenchieA09051981AfucksA09121985AcarstenAjachinAmutterAcookingApassfanAblaze1A03121985Aservice1AyfnfirfAsleepingArjcvjcAbabemagnetAtimothy1AmimosaA232425A651550B66333D1313A9874123A10081981C241024B1001001D51982D61980D81980B2041982D51983C345687E9876B3081983B5021984C121984B6061981D81980C111984B7061982D91981B8041984D51984B9091980A20101982H4B1041983C101980B2061982B3041983H4B4021984D31980D51979D91984C111982B5051983D71984B7031984C111984D21981B8111982B9011980A30111982B1121982Abmw2002AnudityAzoomerAswatchAkareemAblenderApresentAduckyAslowAmerrillAheavyBorsemanAmidoriAbopperAtiresAasthmaAwhaleAhummelAneroAwendellAbigunsAarmstrongAsnapshotAdarthAvividAwyattBandaAreleaseAnurseA1234abcAchingonAquake3ApriyankaAhunter12AsanjayAeuclidAtoolsAeastAtahitiAlibidoAnielsenAbranchBuffaAsometimeApilot1Alotus1AekimAabbeyAprestigeAhomelyAcorpsA1passwordAloomisAhawthornAnickieAchristoAswissAoptimaAaqwzsxAsigmarAlexus1AbalboaAgreatestAwageAmainlandAshimmerAriddlerAoffroadAbulletinAdutchmanApasscodeAcrownAramadaAstriperBoundsAalleyAbravo1AcampAworshipAcarlingAdempseyA09081984AtugboatAroman1BegionalAbernhardAgregory1A05031981AassmunchAbeatrizAcazzoAassloverArocky123A04041982Adiablo1AsevilleAtiptopAzaq12345AcarmineAsizzleAgauchoAbuckarooApuddlesAcreedBhoochBompAtonyaAsexpotAdiplomatAtitoAaleshaAmorrowAkobeAethan1AkarambaAskeletonAcorazonA06081983Asexy123BamueAeatme1AwintersAfutyn007AlakerA02101972AmannheimApicherAcamaro1A02101970AadriannaAboardBionicAdisney1AacidAhackersAdominickAbeforeAwellingtAnashAfubar1AlynetteAdancer1AjollyAromaniaAfernandaAdragon123Amanager1AcalendarApennywisAecuadorAkomputerAsaxmanArudolphAdevineA04081978B7121984AteapotApictereAalonsoA07011980AplumbingA07111982AthetruthArosaAspeed1A04081982B6011984AjustinbieberA08031980AgulnaraAalex01A09111983Amadala11AdineroAshakesApunaniAnokia5130AquinnAthickAhybridAkakarotAsuntzuAlockerroomAdima1995A09101984AvanessAyeahyeahAejaculationApictuersA07101983AdeboraAcravenAnianAwrinklesApoonAdumbAbaron1BeelineAloyolaAbettyboopAopenmeAelodieA2300mjAlakshmiAfrederickAhuanAdaydreamAfriends1Adenis1A01121980AbreathAvfhbyjxrfAinnaAdominikaA02021975A153759A333999B141592A10071980D81982B1031980D41980D61983C121980B2021983D31982D41977D51982D91982H3C345123B3031983D91982B5071980H1B6011982B7111979B8061982D81982B9011981C121978A20021982D41980D71983B1031981D51979D61980D81980B3021982D71981C101981B4031981B5011983D91983B6031982C101983D11978B7011982C111982B8071982B9061982D71982A30091983A963258741AfallingAagentAsmoke420Acobra427AmarcelaArochardAthighsAreedAkidneyAextensaAcherieAexcessBmbalmerAbasketbalAtailgateAsalvatorAnikoBocturneAsexymamaArebekahAlilmanAcraneAaassddAterranAdisabledAsonjaA12345wAbinkyAgoatsAricky1ApapabearAwednesdayAlisenokAmuffinsAshinigamiAcajunApanoramaAscout1AillmaticAflexArhodesAtortugaBicktockAfantasy1AmissesA08041980AwoodstockAaligatorAhockeBellnoAjianAmojojojoAkonyorAearthlinApinchAoldfartAlovejoyApussy2AreindeerAthomsonAshivaBupplyAtexansAcitrusAundertowAsailA05061981Aalabama1Afreedom2AjewellAindyAmonolithAnastenkaA123456yAramonAorbitalAmeonlyAbonghitAfullbackAbigwormAeviloneAhotmamaAelevatorAprudenceAradar1AprivatAneworderAchurchilAnonstopAsmithyAjiggaAgoarmyAtroublesAzardozAcorbinAl3tm31nAnorwoodAdizzyBagmarAmakerAfzappaAbasherAlukasAsfgiantsApussyloverAxxx777AnewoneAqwedsazxcAlionessAmontoyaAdabullsAcortezAdivx1AworldsAbeatingAvulvaArugratsAnewstartAavantiAcontortionistAjapaneesAreviewsAcapoeiraAjavieAgayboyAbonzaiAvivitronAdreamcastAfruitbatAlegendsAmichelle1AcornAattorneyBdmin123Arosie1AmjolnirAfraggleAvbifyzA05061980AinsecureA01061982ApushokA08041982AbelizeAwillie1Atom123AcautionAbigdadA09031981AsaibabaAramzesAarmageddonAcsyjxtrA06021981AdelphineAcasablancaAalejandraA03031982AfhctybqAwdtnjrA123qwe123qweAciaoAamoAquakerAhustleAmyfriendApaolaAmagdalenaAwifesAknickerlessAtrotterAbillabongAdiscoveryAfhvfutljyAmy3sonsAspermBethAcerebusAthumbnilsAweenieAs12345ApupkinAslasherAwilmaBelcome2AhesterA02021972AkrakenAlebanonAneedleAtoulouseAfireman1AlinuxAdelboyAsalesmanBurfsupAfootmanAorgasmsAwoodworkAtoastyA03071980B2011972AdaedalusAstarfoxAviolatorA123412A300465A666555A987789A10021982D41979D91980C101975G81B1041974C101982B2011979D21982D41980D51980B3071979C111982D21982B4051982B5041980D71982C101982B6041978B8031980H2D61981D71979C121979B9051977D61982D81982A22071981D91981C121978B3041982C121982B4081982B5011982D31980B7731828B9041982C101982D21982A30051981D61979G80D71982D81982Amike69Ajasper1AdominiAstratAyamaha1Aalexis1Aq1q2q3q4A04071982AvoltronAcecilAzimbabweAtoniAbudliteAnewproject2004AcreeperAshimanoAmonkey2AwingAcatfoodAspartyAmoochieAcreatorAsergeAamourAredstormAcantorAaabbccAschultzA1monkeyAluckysAallmanAjasonsAbrisbaneAdagobertAxyzzyAgateAmurphAbigjoeAsativaBtinger1AfozzieAcouplesAwindows1AluigiAnataschaAkennwortAempire1AalatamAbarbara1AarnaudA02011973ArammsteiAbubba2AwingzeroAswampyA3edc4rfvAelmerAlighthouseAfordtrucAletmeinnAgrinderAstinksAnebulaAdestroyerAsublime1Arogue1AathleticApraxisA12345vAchateauAfranciAstinky1AlorienAfantastiAjumanjiAmanAcummerAsverigeAmichele1AcluelessAspamspamAbelfastAnigeriaAcostanzaAbeyonceAmoniesAplannerAskinAjonboyAmorticiaAdrywallAsunkistApdiddyAmasseyAcsyekzBampusAboots1BigpenisAvanityBette1Adevil1AlingerieAreesesAiphoneAcorkyAimpulseAdiamanteA1a2s3d4f5gAshawn1AmarymaryAalfaromeAsledgeBhinjiAqawsedrftgAprelude1AsinfulBhitterAmiles1AriversideA03101979B2071972AgreenteaAiiyamaA07041980Amarley1AparsonsAgivemeAimthemanAsharmaA09071981Agabby1Aqazwsxedc1AevanescenceAhentiAw00t88AmotdepasseAporsche911AalessioBcemanBrrakisApussy4meAshelterAbecky1ArositaAmunsterAkickflipAemineAgocatsA03031981ArodgerAboogersAlandroveBongshotAwoodenAsuperbowAlistA02071970AcomicbookdbAprostoArfhlbyfkAkfcnjxrfBavkazA01101979ArobotsAforgeAmarlinsAscoobieAanthony2AparamoreAhfljcnmAbuckwheaApornographicBlokijA03021979B1071978AminnesotaAlambchopAchangoAmoney2AsilviAanakondaAcjytxrfAsanjoseAarcangelAkolesoAj3qq4h7h2vAstarbucksAcoreAallieAmahaloAnigger1AsamdogAgfhjdjpAlitleAtransexualAwebcamAboliviAvfpfafrfAlucianAjosieAm12345ApetiteAarchangelAwww123Apiper1AcheebaAbraveheartAmyspaceAlux2000ApaddyAemiliA08081981AmasturbationAbunnieAcollectAtulipAhomebrewAwhitesAboingoA04101980AberserkAfordf350AthrustApilotsAcheesyAleelooAstar12AzealotsAcamel1A07081981B2071973AmilkywayAforesterAbabemagnA02051971A101077B21281A615243A10011001B1081978C111978B2111981B3121980B4051977G81C121979B7051981C101980B9021980D51981A20011980B1011981C101981D21978B2031981D81981B3051980B4111981B5111978B6031980B7011981B8031981B9071981C121981A30071979B1051977D71980A1213141516AellisAgemini1AswimAmaxpayneAgoogle1AblissAduracellAarmoredA12lockedAalonzoAdetectAcashewAkryptoAhattieAshrinkAcustardAmochaAalbinoAroomAspanky1AgatesAacdcAsinghAxxxzzzAalliedAlibraAmaryamCgooAbillowsAchief1DnchinAbenzAsonny1Aronald1A123456789pAheeledAramsteinAcoffeesAswingAadrockAnoreenAburgessAnopeAtwatAscottsAbrittAcoasterAaltecAscrollAtippyAlesbosAkookieAforallAtrousersAcybersexBowsAbugmanAwildlifeAtopspinBerriAprontoAcristinAzzxxccAshaftAcorvet07AtiberianAkevin123AbufferAurlaubAdoorknobAmonday1AchesteAthanosAfaisalArichterAsaltydogAbullwinkAshevchenkoBpace1AblankedAdarnellA1qwertAmistakeBorozovaBdoggBaximilianAoperaAsentraAdiamantAsteinerBodapopAadriaAheadacheAgstringAhellohelAmessierAalvinBrthur1AneedforspeedApanacheAa123456aAfirebladeAironman1AdevilmaycryAtricksAasmodeusArodentAmikaylaAironAshawneeAbraveheaAchemistryAabbey1AvfhnsirfAsomebodyBharpieAmypasswoA05081977AvoronaAcradleAtableAasd456A01011967ApennstatAmilfnewBomsuckAcookiA01081978AhotdogsAmarselAcocktailAsosiskaAinternAuncleAmotherfuAorwellAselmerAmarajadeAlesbeanApoundedAscarabAprincetoAfruitArapunzelAhernandeAytngfhjkzAphonesAcorrectAmaximus1Apegasus1AchatAdisturbedAbillsAiamcoolApionerAbalrogA03051980Adreamer1AevildeadAaggieA01051979AltymubAeverquesA06081979AsongokuAdeepthroAgfhjkm12AtkfkdgAhaloAblessed1AticalAbartokAklopklopAtheboysAcoltA12345asdAfishfaceAyankee1AcheweyAkjiflmAcntgfyAgrettaAm0nkeyAnemesis1AgorillazAkombatAfyyeirfAnarutAwineAsevenof9AviciousAsargeAgitaraAmanhattaAelektraAsixteenAkseniyaAursitesuxAsachinAzhanAvovaArevival47AdetectivAbusinessbabeA123456789lAbedrockArjitxrfAdenniAyfnfitymrfAstoogesA04101977AfastcarAibilltesA02091970AdropkickAsk8ordieAotterAmontecarloApeacefulAbreatheAflavorAameteurAveronicA04061980Aenter123AchristelA09051975AcowboyupAjuliAgoetheAspidersAfialkaA1234kekcAkostikArdfhnbhfAmarishkaAvikaA555222A630112A753357A837519A1122334A3698741B984240A10061980B1101979B2011980D71980C340987E5612B3245768B4031978G80D41976B7051979D91979B8061980A20011979B2334455B3021977H8B5071978B7111978B8101979A30031979A890098890AtanakaAapollo1AmotorsAroyboyAmargoAturk182AbobbAhoneydewAbroadAoriginAmonsoonAoutlawsAthedukeAcedarsAladybirdAquaintAddddd1Abbbbbb1Acccccc1Afucmy69ApuffAbreezyAchaunceyAsmellerAcambridgeAsigridBuccesApass12AulrichAbeebopAfokkerAmaryanneAperrinAfourteenAaslanAblindAreddog1AborgesAderickAwasherAjanet1AgeckoAbiker1AllamaAavalancheAsnowman1ApatronAclyde1AbanaanAiceteaApetrusAsheltonAlorenzAsceneryBexymeAbullockAnikiAaurelieAmike12ArestlessAsunbeamAbluenoseAnot4youAdollAleticiaAporkAlinusAwsxzaqAcayenneAklaatuAclickAvickiAcharlie123AfremontAoptiplexA123456qqAbulldawgAomegaredAcaldwellBommentAheatheAchowderArenee1AbarnieAhowieA1fuckAcurleyAflangeAtwinAmessageAlargeAbastetAyelloAhermannAjelenaAfuckthatAcandlesA123456abAgenocideAcharmingAlosangelAimpalassAfartmanArealtorAputaAsorrowApendejoAflyguyAtokyoAlasersAzapataAcrissyAlockedA123abAskynetAmarybethAnewpass1AseahorseAgoodsexAab1234Azxcvb12345AloreleiAmachinesAcorvettA02021970AcazzoneAallaA07041979Amonkey123AscumbagAfuckmehardAmaster123AgoldrushAtrailersBoday1A03071978Aadrian1AfilippoAcapital1AwyvernAlotharAturtle1ArowdyAdeviceAasd12345Aqwerty78AwhateveAvtldtlmAlovely1BbvjxrfA09091979AcasualAkazanovaAmagadanA12345kArktjgfnhfAinsiderAjazminAbitchsAspaldingBantacruAalisherA01011966AsunderlaA1a2b3c4d5eApumaA09051978B8031977AsnoopdoggAnokia5230AfktyeirfAeverton1A01011965AghjdthrfA01031976AvfhbirfAbhbcrfA123mudarAkerrieAudachaA159753aAgeibcnbrAlovemAhulkAblondinkaAchildCeesArobynApingvinAaveryA123456789123Al58jkdjp!A1a2a3a4aAgandolfAhartleyAdarknesAfeverAkatyaAfuntikAproductAbayleeBignutsAvideoesAbeachbumAwaffenssA123qweasAbraxtonAoedipusAquest1AshotokanA02101971AfridgeAhulksterArbcekzAbrickApoobearAeatme69AsamadamsAheather2AmastermiAsammydogAignatiusAredwallAtoohotAdragraceAgraphicAbooterAchris12AmonkeymanAslipknoAwrigleyAvorlonAlol5BbtestA1006B41516A222555A665544A10101977B3081978B5031975B9041978A21041978B2011975D41976B3021975D51978D61976B8071978B9091977A43046721A123698741AyoshiAsanity72AniggazAhussainA03021978Afrank123AingramAnaughtAthaliaAabbaArasta69ApoetsAdriftingBeepakAcontestsAbrandenBowieAskinsAglassmanAtaiwanAxmasAdamionA1moneyArt6ytereAcesarAhomelessAdaytekAmark123Azippy1AyourmamaApartnersAnavigatoAgoatboyAmadduxAbuckeye1Aangel12AcostaricAnutellaAterranceAjaninaAbarksAallysonAvangoghAangelesAnewport1AbabelApeanuAcaralhoAleverAsaddleAdanmanAfour20AevergreeAminimumAutahjazzAcomeAxxx666ArobsonAnickolasArb26dettAalthorAmarinkaAsnowyAjeffjeffAnegroAbuffAdoggysAbetty1AlookupAbarakaAmummyAtopazAcynthia1AfeelingAinfiniteAcrockettAgatitoAkeeshaAangeAthethingAlovesAswiftAbigshowAviking1AjakesterAcochiseAhazmatAjohanAsmackAwilly1Abrenda1AsoftAjames2Atwins2AwoodsideAhombreAgeilAtorrentAzzz111AbugsbunnAfuriousAroachCsannaAnettieAtexacoAbushmanAsmartyBtripeBkillsApontiac1AanechkaBquilaAwishesAmanualAransomAfred1AinvictusAsnifferAmarnieArawhideBoscoAvaliantAtontoAzoomAwolvieAeverydayArussell1AfeederAdelsolAcandysAangelokAvasiliyAaustin316AmitchelAkbctyjrAnaplesAapple2AbiggirlAmemoriesAjesus7AadventurAtequieroCacher1AasscockAgrilsAjacquiAabstractAbubblegumAfistAcallofdutyAdickweedApunjabBorn4meAboohooAthatsmeAhershey1AirishaAbosshogAcontrol1AfukingAhousewifeAtemptressAbelle1Adima55Achris2AwarsawAverygoodAhogwartsAwingchunAheinleinA01051974AprincAmysticalAsurgeonAbloodsApavlovaAaerosmithAtoothAblackbeltAhotshitAmanueAagathaAethernetAbulls23Aqaz741AeightbalAsolnishkoA01011968AsnowflakeAfirestarAdjkjlzAhornymanAmandersAgirfriendAlebron23AgrammyApoppieAtimelordAmilhouseAkumarAleningradAcaterinaAavroraAqwerty99AjanewayAcneltynAsestraA03061977AromanovAcoryAshaunAkayla1AallblackAcerberAirakliAanna2614AulrikeApussyeatAwakeupAmackenziAdaniloAmasterbaitingAuncencoredAdimpleAmanifestAsongbirdAtripletsApamelAdeviousAsukebeAghjnjnbgAbdfyjdfAchuanAgforceApyramid1AsubmarinApartizanAbettisAdokkenApastaA123456bAchoppersAplanetaAfuckmApattiAsaab900AvandalAsnafuAbigboy1AphishyArewindAmanateeAfred1234AyitbosAlovelAvbhevbhAdesperadoAchewy1AyeshuaAfabiaApapitAseabassA159852B97777A335577B57753A555333A777111A1235813B0121976B4021977B5121977B8273645A22091977A31071977AcallahanAsiennaAniklasAsvenAnogardAmarshAjackoAdeuceAechoAdmbandAmanualsAvargasAhomoAmickyAthrillerAilikesexAmarina1AantwerpAnormaAbulls1A1letmeinAbarbAericericAlittlemaAboatsArashidAcaspeApatriziaAlove11A070462AhookAxmanA12345654321AwapapapaAsarinaAwoofAformeAhoserAcraftyAmistralAarielleAgravisAnirvanAdavis1A1911a1AbuickAraymanAhornyguyAcarajoAmiamorAcommerceAnecklaceAradio1AfifteenAsimplyAcannondaAseventeenBports1AbambinoAcartierAblackcockAnexusAbarracudApathfinderAsammiAcrewAfuckshitAleeroyAscroogeAbrunetteAparsifalAbirthday4AalkalineAchinoAshitfuckAmuffdiveAsageAnfy.irfAbobertBedroomBoarderAaccount1AcourierAabcxyzAlampardAzooropaAguardAedthomAbriansAlemon1AglennweiAantigoneAishmaelAmrbillAhenleyAdragonzApizdaAbeepbeepAhotbabesAfordf250AbullerAacerAmotorcycAspadesAbatmaAakashaAcoolgirlAskullsAricksterAunderAomicronAgenderAmagandaAtheshitAhirschAsnowdogAboxterAcitibankAdelgadoAnewdayAmarmiteAozzieAgoodguyCbigredAriver1A007700AharrysAoasis1AbrutalAprofessorAfkbyrfAcvbhyjdfAtrishAleagueAbiscuitsAangeleAcassie1AedmundA03041975AvaughanAtenerifeAasssAgoodlifeAqwaszx12AvolkswagenA1qazxcAsouthsideAfulcrumAmaurolarastefyAgumboAspartan117AconceptClumboA08081976AmiamoAdanilAriptideAyanks1AmamontAhedgesAtaterAyuliyaAperegrinAantonio1AmunsonAnikaAjigsawAfeanorAraindropAbavariaAlockerAbeyondAperkeleAlaracroftAnovikovaAjoeblowAfatheadAplumA0000000000oAbonnie1AfynjybyfAmolotokAthoughtA12345678900AhotlegsAparanoiaAcabooseAmarkizaAdegreeAporsheAdolphiAsabakaAgermany1AfakepassAbecoolAsupernaturalAtecumsehAchathamAtonyhawkAskatingAfrancescaAmahalkitaArubenAaptekaAnikita1ArebornAmaineAthistleApfloydBituresArover1AyngwieAcreepyArutgersAilovepornAhallo1Acherry1AfalstaffAclerksAshuanAdominateBeborah1AlibbyAgolfmanAsigma1AbassinDtianAhunter2AlancasterApumkinAgamerAastonvilAjaymanAbobmarleAfritz1AnatedogAhennessyAproduceAelvis123AnonmembeAtrampAfullAbonethugAterriersBooltimeAfedorovAsharon1AterrenceAzhuanAvirginiAkrasotaArussian7A3004B62514A699669A777000A823762A1230123B596321A3151020A11122233B2041976B3011976A23021973AfionaAgliderApyramidsAkoalaAleroy1AchasAhornAstandsAgrimeAchiliApixieAroseroseAshootAflareAalbert1AviewAportAseattle1BaundersAokmijnAlolololAschnuffiAeddyApotatoesAbeanbagAjoyfulAmaritaAragnarAphaedrusAskillzAregentAbarclayAflashyAmarketingAraptorsAprimaAfearAstefaniaAballardAcxfcnkbdfzAadelineAdropAstreakAlasalleAguesswhoAidiotsAlindsay1AdavidcAnicky1Asamson1AmatrosAzxcvvcxzAtiffBonkaAepsonAjoaquinAmikiAjamesbAarchApoi098AdrinkerApassthieAtestibilAmuellerCrielBarriottAsnookieBummertimeAmusic123AhelphelpAtheedgeAfannieAtakamineAwoodrowAbigpussyAlouisaAbalderAparker1AduckhuntAcandieAironhorsAbagelsAvibrateAdalejr8AmoonerAgrayAhelen1AtulaneAniagaraApolly1AronnyAlemmingsApluto1AbeckAfactorAtheclashAboromirAsundownAashtrayAprimalAunicorn1Ashadow01AcaminoAluckieAsparkeyAcoupleAzappa1Ajessie1AhamburgerAlucentAdittoAcakeBolossusAgotyoassAqwerty2AnixonAclassAqaz12345AgohanAsatoriAbigbuttsAzzz123AelberethAblaster1AlagwagonAgumby1AfeniksAdavidbAceaserAfuckyeahAlocationAcorganBatalogBhiksAmodlesApenetratingAforgottenAwalkingAacademyBsylumApokemon123AgbcmrfAopticalAfaustAthesaintAmonteroBalakasAelement1AamnesiaAsonneAmorbidAastalavistaAnhfrnjhAasdfg12345A05051975AgaelicAhazelAsaratovAbhbyrfAelisaAvfkbyfAprofessionalA123123zAhermioneAbeijingAmarketinAsegretoAmowgliBisiaczekAshandyAmamo4kaAjoungAprickAgymnasticBoodfellAveteranAsexsexseAaxemanAgulliverAnatalAlettersAjuneauA01081975AdjdjxrfAcristalArostovAvolkodavA02011970AybrbnjcAbigmamaAdomainlock2005AmullerAdazzleAstefaniAyouandmeAsovietAkattenAleafsAriddickApinguinAdoggggAgaleriesAscandinavianApintailAlakers24Aflowers1AraketaAbachAjeadmiArerfhtreAscooteApappyAedmondA666666aAvepsrfAcraftAbilbo1Ahell666AmacintoshAsoberAosamaAenoughAzaxscdAdhjnvytyjubAkillzoneAcujoAyamahar6Abasebal1AlabonteAhomer123AgrandpriApremiereAovationAsmokedogAametuerAtahoeAhalcyonAleftBaureAdeicideAgarnettAwatermelonArockmanAjohn12AmayfieldCshaAhardworkAlance1Askippy1Amango1AstaindAcassiAussyAdogAlasttimeAr4e3w2q1AeyeballApeaceoutAvivaldiAfriday1A1dallasAkimmyAsergAangelineAjayceeAsilveAdetailsAexpress1AkatzenAx72jhhu3zA1q2w3A222444A885522A999111A1234569B4031972C7896321A369852147AgrowlerBoodyAbookcaseAkingtutAcookerAluganoAnewhouseAmojaveAfranckAbeaksAdomesticAacetateAmaciekButtleyAchiccoAscorpiAblackcocFboyBarlowApatataAdobberAmathieuAram1500AdoggydogAbrockA123456asdAfuckemAnumbersAp455w0rdAgiselaAmenschArattleAblairArabbiBedwolfAmauroAslicerAbutchieAcomplexAwilliam2AnigelAplacesA1rangerAbobcatsAenvisionAgazelleA!qaz2wsxA67camaroAalgernonA12qwertyAcordobaAbaywatchAthrawnAbyronAdefconAgmanAsexyassA01011964Aphoenix2ArsalinasAnickelsAgometsAblockedAnever1ApunterAallegraAlarssonArowenaAstaffAhawks1AdangerouAerrorAheadlessAbeaumontAevergreenAfrasierAlastAdonutAacura1AbradshawAosgoodAbarracudaAtomservoAgreatsexAdbreczAzekeAf15eagleAdewayneAcadmanAspanielAnemoAfoolAradiusAcedarArentalAgo2hellAboleroAyesterdaAflippyAzelda1AfuckofAarmanBlexeiAginolaAjerkyA1qazse4Amarvin1BonkeymaAaquariumAcbr600rrAmoversCsaicAcronicBlusterAmystuffAarcaneAdickeyAtomateAkuwaitAgoochiArepomanAdogmaApayton34AbassbassA123456789kAbugattiBlackassAsnakemanAmaratAgenghisBrampsAescherAsincityAcanon1AvaldezApolaroidAhotmanAwitchBorldcupAsolarAletsplayAslideAdeutschlandAjordynAsaab9000AamoremioAkjifhfAfamily1AgretaAmagicsAvaselineAalligatorAseventyAlearjetAcomputersAdimensionApackard1AcraveAnackedAshadeAbhjxrfAuhbujhbqAcitronAkodiak1AphrasesBomidorAgolfclubAace123AlonghornsAholdemAchance1AwellhungAtryagainAkillahAcolomboAdodgesAsaddamAalfalfaAjanuary1AbluntedAfurmanAmysecretApfqxbrAdruidAjenna1AqweewqAgopackAzolushkaAshayneAcopper1AfanaticAcatdaddyAstella1A17171717aaApfkegfAloglatinAgbyudbyAbarrelAsamantaAriggerAgirslAphotogAmustang9Achipper1AspideAnadezhdaAliteAedinburgApanties1AmariposAdingo1AexcellenAsokolovArjnzhfAdashkaArooterApandora1AromanovaAvfylfhbyAeragonAlusciousAmayfairAsonyvaioAflipmodeAbormanAyorktownAstatesAjbond007AtypeA777vladAsilly1AherculeAdoggystyleBkflbvbhjdbxAgoodwillAsofiyaAwatchingAescobarAhandleBolaholaAdavidoffAmichAprancerArobinhoodAmachomanAklaudiaAhenningAdebbie1AmccarthyAprotossAtittysAbeekerA12s3t4p55AmomsanaladventureAfabrizioAhumbleAstratoAforemanAtheman1AavengersAkrugerApipeAivanhoeAoctober1AdatingAtomboyAsealDweedBixtyninAtooncesAerica1AreaverAchrisbAsoledaAtrekkerAdatabaseAcortinaAnicholaAtwostepAwigglesAgjhjkmAbobbysAeasypayAdealAelisabethAchevy2AgooniesAlesbensAcueballAfuckedupAmeandyouAhickoryAeverquestAomertaAfun4meAsupersCnbirdAremingtonAhotterAjason123AolivesAmanageA01011958AschmuckAkramAevelinaAtimmy1AlancasteAhd764nw5d7e1vb1AloloxxA3001A25000A123698A224488A622521A747400A852963A10101968A69213124A78963214AbriefsAgarterAcheyanneAmentosAortegaAgingeAunited1Akeksa12AjuanitoAginscootBaijinAabruptAub6ib9AkodakAbloopersBobberAfinalAmaddyAanthemAtorqueAflubberAmothraAsteveoAclaraAslamAnolanAsnuggleAdshadeApolicyAgoosemanAbabushkaA123bbbApattersoAfragileBelicityAplummerAbushelAkolibriAgoalAblondie1CuemanAcrocodilAsport1Afirst1AsectionAzzzzz1AsocialAacaciaAbmw320AminuteAyahwehAbudsA5tgb6yhnAqazwsxedcrfvtgbAcamelot1AguiltyAhelplessAsoccer13Ajazzy1AnugentAsweetassBober1ArickieAmajor1AbootlegCnzoAgetmeinAfineAponyboyAandiAwaldo1AsebastieAgroveAshibumiAboogalooAmarlowAangelitoAcarlinAandrejAebony1AmyboysAzztopAhottyAlombardAfrancis1AgalleryApeternorthAfreiheitAkindredAvalentinoAtessaAa1a2a3a4a5Avictor1A357magA000000aAleahcimAhitman47Aporn123AgetinAwinchestAkonradAnicknickAorleansAaleksanderAblue44AmilleAshadesAconsueloAdantesApimpsterAbutchyAguevaraAdandyAcliffyAlifeisgoodAsplatterAmatiasAzxcvbn1AcamiloAblowerAfeetfeetCrrarAdarthvaderAynotAgeorgesAbruno123AwayerAsecreAcaseydogAamarilloA1basebalAsatellitAmustang8Abrent1AdentonAtiffanAshiftyAmateAcezer121AsonyaAgomezAtheoAromulusCbbinsAlooperAdoomedAkleenexA123hfjdk147AcarlottaAoralsexAkimchiAcrayonAmasterkeyAblackbelAcarambaAbelgiumAdrjynfrntAfamiliaAlotus123AhappydogAquarterAinsertionsAbuchananAmonkey11AsidewindAmissingAfettishAstorysAnewjobAparollAbigpunAhannoverAlangleyApoliticsAassaultAcimbomAasdfjkl;AohbabyAchronosAlogicalAm0nk3yApookie1AtylersA4rfv3edcAdelphinAvfnbkmlfAeleven11AvishnuA123qwe456AgrapeapeAandreevAsananeAkthjxrfA654321aAdeathrowAmerlynAonepieceAwaterpoloArattlerAdragon13Avoodoo1ApilsnerAdonnyApeepersAanna123AtechniquesArodinaAstetsonAburatinoAdistanceAfacefuckCbiolAmorgaAijrjkflrfAavangardAvolkovaAnaruto1AvineyardAqazxsw12AcalculusArfhfgepAbuttbuttAchina1AmaybeAjack1AmorleyAzz8807zplAarchonAbignastyAemmitt22AtoesAamidalaAromaromaAmaddisonAstamfordAdropdeadAerasureAbrittaAlopataAbadguyAfarrellAhuntersAcassiusAerickaAtracksArouterA123456789012ApissA8phrowz622AswansonAqazplmAballs1Adragon11AhawkerAsameAblondyAchastityAslippyAlindsey1AhatterasAclaudineAben123AskullAfoxcg33AwicketAlucianaAcorporalAmazda1AindexAtrucker1AhillsArushrushAgotigersAeatme2AiloveitAganjamanAmeowmixAvegas123AsheetsAgeologyAspice1AlaceyAwiggleAraveAtim123Adude123AchelseyArebbyt34AcletusAimhornyAhawkeye1AchinAmischaBypussyAslayersAjannaBeffroAlizard1AklopikA123mashaAtalgatA1hxboqg2ArooteditA3003A123458A999777A100200300AuniversiAsexyredBabrinAtoyota1ApriscillAyanksAokayAb123456Aevil666AlexingkyAdavid12Aeight8AmurdockAsteel1AmandolinAteamworkAmalagaAc3por2d2AsmashAcrowbarAdawnsAgunner1AcarefreeAguruAromeAfootloveAxratedAredwing1AmuskratAcarmen1AgiveitupBspotAwilmerArenoAsexeAcleaningAblowme1A121212qAassfaceArastusAandre1A085tzzqiAusmc0311AtanechkaAelgatoAaguilaAfuckallAloveme89Atest2CrribleCufelAgoodnessApuppysAglenwoodAceckbrAretsamAstar1BhiznitBambaAhottubAufhvjybzAdildosAmongolAcrowleyBool1ApenalA1shadowAmartin6AfultonAallrightAgoodwinAtucker1AsevillaAbobbiAlatexAshiftAclaypoolBar123BheckitAsydney1AvampAimzadiAgandonAwindyAjulieannAgreyhounA063dyjuyAtriviaAdamnAshamilApushingAreliantAbooperAcreviceAnyyankeeApenfoldAcalamityAkajakApaganAconquerAdeweyBillweedApantyhoseAcavalryAgolf1AcrankAarabellaAforcesAmauricioAjazmineAgophersCodisonAayrtonA123321zAbucsAloudogAtobaccoAspade1AcorpseAkayakAplasterAseviyiAallyAluv2epusAmomentA12345cAtaxiAnoobAhackerzAthewallBigreAalphamanAsimcityAbowl300ApedersenAjackdogAfeedmeA44magnumAapples1AbarnabyAwrittenAblankAsoledadAassassinsAqwerty777Aboris123A01478520Ajared1AsquireAdrevilAarseAharpuaAangie1AslainteAindy500AmarusyaAsummer12Ahelpme1AaugustoAbachelorCdnaamhereAnevermorAmattinglAlavenderApatateArasterAmattmattAtexassAheadshotAopen1234AtopsecreAbootDbedAmarikoArenatAmckennaAbrigadaAdonald1A088011Agordon1AcuteAbatgirlAhotchickAbanksAmonique1Awillow1AfabiolaAalannaAcordeliaAbolivaApolarAtitan1AakatsukiAfresh1AopenopenAgeraldinAfreelandAmike01ArodriguezAprincessaAmiranda1AfedericaA5hsu75kpotAgbgbcmrfAragmanA0102030405AfabienneAabudfvAk.jdmAmamitaAhellowAbabygirAsantinoAcarthageAraulAcorsicaAmoonshineAchrissy1AtouchAlucienAbrother1AnaomiAuzumymwAgooddogAaquafinaAcarneyAvolandAdbnfkzAcatholicAindycarAbrysonBassettAalexandruAdawgs1A123456abcApolice1Aloveyou2AdeepblueAargentAnovifarmAalrightAholiday1Ablack123Aducati99AmannnAseleneAmoonstarAfinneganAcontainsAschatziAamoresAnbuhtyjrAsexy12BatanasAjohndeereAultramanAsamantha1Aocean1AdbnfkbqAr2d2c3p0AbadkarmaAteejayAwahooAfuneralArandom1AleninAniggasAswallowsBeraphimAbigbadAdamnedAbaldurAwendysAracoonApeter01Amarco1AhawkwindArufflesAhatchetAvwgolfAcoltsAzydfhmAhardingAlabattAtiger7AassclownAcrunchyAredneck1AmailboxAjamaica1AcervezaBatalystAdaviddApassword3FerdBepsi123Aopen123AmindAcolonyBlassyAlivesAtrojans1AblaiseAshirazAfastcarsApolinkaArundmcApantieAfailsafeAirisBnsertionAmodemAdkflbvbhjdyfApassedAhilfigerAbusinkaBronco1A55chevyAcaffeineAkleinAcipherAqwerty77AmargauxAjackerAigorekAellaApornpassAsmuttyBtasAmatveyA123258A253634A427900A515253A1725782B2345432A32165498A74185296A3216732167AwhalerAmichael3AstufferBphereAdivorcedAbartekAanteaterCetteAmustang0AredshiftAfentonAcableguyAkillroyCngsizeAcollectiA2w3e4rAbuffalosAsteve123AresumeAbryceAxxxxx1AbrutisAwarehousAbaylinerAaxelAcatterBrusadeAflowAsoupAkilgoreAshannyAbasserApittAkiloAcharles2AsmokedApattayaAcoolboyAsolracBuikodenAyear2005AbenchAshyguyAlumpyAgangrelAdakineAbuffysBillionAdevelopAbushedAporn69Asingle1AwhoopassApressA0o9i8uAgardensAmarigoldAkermit1Ayyyyyy1Aallan1BqualungAjamisonAsummer01AarcadeAtitusAwedgeAsteamerAperroAricochetAdaysAjaydeeAliamAwoodsonAhipposAcumeaterBhico1AjesussArickeyAkasumiAningunaA112233aArandAprocessBamela1AnickiAralphyAchristy1A1sexyAnicholsAgoldmanA112233qAmargitAtransforAhartAroland1Acoffee1ApapayaAcarlsonAjacketsAarslanAfelonyAandrew12AhaynesAindiana1Astrange1AdartAalexandriaDssiaAgarthAjoseluisAcentreAleno4kaAsaabAlearningAkathrinAwolfwolfAthorstenAcarol1AluckymanAtennesseeAkirby1AneeditAhallmarkAsaturn1Aleeds1AtillerAalex11AmahalAgfnhbjnApolarbeaAcvbhyjdAlouise1AgfcgjhnAblackie1AmostwantedAhereticAloveme1Apentium4BoopsieAall4meArazielAerwinA1qaz!qazAandurilAresourceAtailAdarlinAprime1AbroodwarAxterraAjimmy123Agolfing1AopensesameAnadegdaBinaninaA8phrowz624AchemistrAwardAgulnazAqwert12AnumlockAprisonAnitroxAmorozovAjanuarAgfhjkzytnAaeynbrAporkyAlol1234AprosperoAbrowniesAflyers1Amaster01ApipersAmammaBindlessArakkausAcobrayaAmywifeAdarkerAytrhjvfynApercyAlicoriceAallstarsAkosovaAangel7AmemnochAlalalandAgiacomoAschastieAcrfprfAarsenalfcAdurdenAteabagAalpha7AbarakudaAstellAfloyd1Awestham1AplutonAbondarenkoAmarykayAanatoliyAwysiwygAstampedeAdaneAanandaAmyhouseAcarissaAloveyou1AsaopauloAtinker1AjamesdApassionsAdream1AmexicAlollAfreemeAmobbdeepAflintstoAendlessAlovegodAcovenantAsound1Arobert2AtigressAkabukiAcapriAdance1AnessieAbeersAserialAbooberAtrophyAzhenAphillip1AlemmingAmapet123456AsteakAyodayodaAvladvladApleasantAvergetenAfunky1AcalcuttaAbmw525A3465xxxAhalibutAincestAmuskieAvfr750AhangmanAyfafyzAmanhattanAsailfishBummertiArevoltBightonAfoxhoundAbudgetAgunslingBonadsAlustyAh2opoloAcooloneAbluedeviBoswellAyessAthorntonApatterAboilersBackspacAsnacksArosalieAvictoAdaffodilApussylickerAcrushA10sne1AmagaliAchaplinAessenceApochtaAredrockAsergejAghjvtntqAblindaxA197A9000A123454A333221A456258A963369A1212121C041961B3572468A48151623A123321456ArerehepfAnicedayAcounterstrikeAtitanic1AburlyAforumwpAdolly1AsceptreAmickieBustang3AalfonsAwhodatAbaphometAcloggyAlionlionAkaseyAbobAlonglegsAfloraAlimponeAoldoneAfire1AoilmanAgwenAnormAbastosAchrist1AabdullaAbiffAgatoAzxcvb1AkostasAhot123Afred123AstarskyAdapperAgood4uAlemieuxAamadorAthunderbirdAnipponAinvisAfalcoAconan1AlockheedAvoitureArockrollBegalAjeepjeepAparkingAderbyBiddleBrinkAadam25AsandysAmarcus1Aadam1AbigtoeAhandsBendersonAwicked1AlaughAtakashiAladlesAducksoupAsullyApalominoAtest11AgreyAshroomAbuster01AtasteApineAyesterdayAmaxfliAcabinetAdannAmosquitoAbuggyAleahA01011963AarubaAsabianA1assholeA26exkpAforkliftAnumber9AjerusalemAdddddd1Bennis1Anomar5AplanningAteenieAaquamanAmaribelAjesuscAbacksApsycheAbooty1AhometownAacesAprisonerAsextonAtoonsAjustAbigdaveArequestAfranzAtheoryAawayAquackAltdjxrfAmileniumAvegitaAjodeciAkenyaAloungeAmeltdownBammamiaAcaribouApostov1000Aworld1Aanita1ApussylovAflapperBancyApopsAnameAevgeniiApumpAelrondAtigger12AberkutBullyAcadetsAimportAlimpbizkitAbicepsAsaphireAredhead1AtheworldApointsAilya1992AcultureAuser345AjuvenileCmpingAomsairamAspeedy1A12345678901Awhatever1AdustydogAyfnfkbzAafroditaBriaBntoshkaAwasdwasdAambitionAraoulAarrow1AgannonBumballBilletteAchampionsAacousticAforumsAcharlie3ApennstateAreederAwheelAbball1Asmooth1AcolombiAkhalidAtesteAcelticfcAtooltoolAhorseyCllisAzhenyaAbonghitsAsolidsnakeAoldschoolAmymotherAromanaAlongtimeA01011955AasasinAmatterAyfhenjAcumonmeBristianoAnolimitsAgalaxieAnorikoAmichael9AtestedAdeliveryAmessi10AlotionAessendonAratdogAlegolandAtashkentAskyline1BargentAplagueArhfcfdxbrAasteriosAnbvjifAseahawkAdominatorApleasemeAvicecityAjunkyardAnokia3250Aaloha1AmagnavoxAcountAinvestorAamosAconnectionAfocus1AmommieAnathaAwhoamiAlakingsAkatharinAfrenzyBilimonAhellohelloAlaurasA33rjhjdsAbunnysAmarch13AgogetaAfightclubBrankiA1a2a3aAilluminaAcopenhagenAdennyAlopasAmetalgearAthinkpadBkfkdgoAbastard1AfenixAlovesmeAswankyAlovefeetAbilliardAwaltersAbarebackAcinderellaAtouchdowAeliseAlimpopoAgussieArooster1AcoolbeanAgaladrielAthirdArinconAshowboatCabbaAcreatineAdominicaAbones1AintenseAdahliaAfucingA123rrrArainierAtruckinAsocrateAbeeperAsushi1BhippingBidewaysAbuttplugAsorryAmatthew2AsearcherAhartmanAjenniAchestyAnickleAyourAappletonAsandiAgarryBetsdownAtandemAgoldfingerApioneer1AvolodyaAchilloutAerasmusAoctober2AmeetingAohioAdanmarkAqwezxcAronaldo7Ad12345AwestlifeAmadisoAgfdkbrAprashantAthelast1AvadimkaAmateuszA5566A10000B11666B24356B31415C5799B45632A315920B22223A555000D556A789852A1478520B3576479B59753123A333666999Awalter1AtristarA1footbalArakeshAhayesAsandydogAmustanggAangelofwarAblue69AfilmA151nxjmtAgoheelsApuertoAgsxr600AprimeraAvesperArubbingAlucas123AsmugglesApeoplesAcisco1AbethanAcwouiAaaaaaaa1AschneiderAketchupAversionAnonsenseApsychnauAvaldepenAbantamApetterAhatemeAmemoAcharmAdupaAshadow2AkirkwoodAdragon99Aparty1AanselmoAcamaraAschuleBting1AultrasAweaponsAlevel42Awalker1AroygbivAskazkaAfiftyAscotttBnoogansAadelaidaA1batmanA2wsxzaq1AgloveAyogurtAnoonanAvolsAboringAsatchelAraisinAwrongAcurlyA1killerAindicaAdinaAliverApickAtrustn01AsplurgeAobrienAchisoxBretinAfairwayAcrimson1ArapidAalecAkovalenkoApassfindAforgivenAwisconsiAletmein22AballgagAelite1Aboss302AcarwashAmike11AnataAderevoAmakotoAcarmeloAasphaltAmavericksAlinemanAasssssAstinkAnikkoAsailor1AaztecaAtartanAerfolgAcavalloAagyvorcAwardenAtwodogsAmelonAjoshua12AbehemothApriceA123321qweAiloveu2AremyBomainAaudi100AtuffyA7hrdnw23AchosenAghjnjrjkAsixtynineAflossieAswanseaAmaroonDsikAhorusAbluebearA8ballAtitloverAkilkennyAjackelAagnesAglenAresetAmycockAcfiekzArice80Azaq1xsw2cde3AtuttleAviper123AdestroyeAzcxfcnkbdfAbarabanAteresAsatan1AmarianoAchocolate1AashlynBbigail1AcodeblueAdunkinAslayer666Ahaley1AminotaurAscoopAtalesAhavocAgoodstufAargonautBnnabelleAlucky777Anumber6AleilaniAbaldrickAnitrousAmetropolAhernandezAadonaiAfootbal1AjuancarloAfuckyou123ApipiskaAagnieszkaBrmitageAbubbaaAindonesiaAempiresAariochAfavorite8AbartlettAcognacAsauceAmaster11AapelsinApoweradeAchobitsAshadow11AparliamentAbladerunnerBatigolAcharmsAtracieAfireworkAlanguageAbesiktasBaltikaAvfvfvskfhfveA01011962A1a2a3a4a5aAgilmourAmackeyAsaltAorlando1AisabeAaleksaAgfhfljrcAkrasnodarAlunarAblink18AtoplessAmakarovAtarantulAmeaghanAovertimeAfy.nrfAdavecoleAjetsonAwontonAmousepadAbrowneyeAtalentAbrendenAschwanzAandersoAvioletaAecstasyAbrowneCianna1AnacionalAdfghjcAred12345AvfhbyrfAmathildeAdoodieAyukonAkikoAvenezuelAkochamcieAvthctltcAbuddha1BianchiAfavorite7CmiliAwildcat1AhoundsAaztecsAk123456AandoverAgoodoneAryjgrfAmetalicaAskateboaApiemanAshooter1Aolivia1AsilvanaAorange12AredbeardApaulusAlouis1AnectarArocks1Asampson1AcolourAschwartzAtheflashAperezAnatalkaAhitterAfuckeAnokian70BfvfhfAtyrellApass99AlugnutAomankoAgy3yt2rglsAfuckupAoscar123Aderrick1AsideAgrant1AembassyArivieraAnomadsAstewAfemmesAzhuaApuddleAasd123asdAjackmanAcubanoBarlyAmyangelAscruffy1Abrutus1BizarreAlongdickAnetwork1AclitlickArafflesA1busterAfathomAghtktcnmAnosferatAfomocoApennAdumpsterAjudgeAdirtbagAjediknightAnighthawArerfhfxfAcharliesAdvaderAshady1AoverloadAkitty123AmorliiApassw0rAtamunaAladygagaAhotsauceAdmitryBimasikAhfleufBtubyfA100001B23369C4816A233223A333222A444777A500000A1233211D4432A3234412C63827A7415963A246813579Aeric1Acoach1AsallasAlisboaAmnbvcxz1AdiscreetCablAinterexAnealAbrasiliaBirdie1AnvidiaArajeshAaccess2BmirApostureAgriffonArepytwjdfAsheltieAdaisymaeAkillyouAauthorAgixxerAtacitAfuck0ffAwhopperAleoneAnascar3AjanusAsensualBimpson1Adavid2AmeyerAplusAchampagnAbirthday1AgrifterAvincenAasdfg1AcloseupAspinachAautocadA3e2w1qAstoryAmillAjacksArikerAsamhainAiawgk2AaztecA07101962AbeethovenAchocoboAkatyAgreekAadrienA1loverAnelsoAfluffy1AcluesAeekAdiscountAwadeAmikkiApapichulAconmanArancheroA1jennifeAdoveAauctionAwavesAsassieAcharacteAk2trixAeightyAclassic1AbodiesAlovesexyAthissuckAgunsmokeAcrappieAkhalilAgohogsApoochAorcaBlds442AjerkingAgibbonsAdartsAmaryjoAslut69BhanaAbibleAgubberAmoneybagBasaAcowmanAndirishAbypassBumblebeAhalfmoonAairbornAjim123AgremlinsAzzzzzz1AjunoAmuffAthatcherAjeremAkarlaAlindAtelevizorAvostokAtelecastAatlas1AdavidjAreliefAtormentA1fuckmeAazizApelikanAsouthsidAmichaApickerA1harleyAmormonAguideAsex1AhendersoAmettssAfuckfestAgreggAkylieAchacalAfoghornAhornyboyAretailAfarcryAkarapuzAprintArealmsAtitiesAmultisynBichael8AsectorAdagestanAqweqwe123A123456789abcAnubianAyasmineAhellokitAblowjobsAjelly1AtoggleAballeAocarinaAbootiesAcheerAsodaAboscoe01AjoachimAtristan1AdoggoneAthematrixAwsxqazAbadlandsAgalacticAdonkey1AcommodorAkings1Asoccer2Apassion1AjamilaAmackenzieAknockoutAtessAanjaliAmalcolm1AbigpimpiAsneakerAbrian123AwinchesterAmainAsnikersAflhtyfkbyAcarter1AhrvatskaAd123456AonlyAtacticalAimcoolAnikitinAoctaviaAsvetkaAhondacivicAdreamersAspartacuByrinxAafghanAbrabusAmariettaAararatAtimelessAsable1BteelheaActdfcnjgjkmAwatashiAconkerAwelcome123AmyszkaAdragon7AlostsoulAjagr68Apoopy1AwilsoA123456hArubbishAdoodahAangel13AevgeniyaArfkbyfAhiberniaAq1234567890AmansionAcashmanAserenAloredanaA123456789nAkukolkaAsinjinAlfhbyfApi314159BatitAfarterBkmnthyfnbdfArazzleAbiggdoggAknifeAoriflameAratsAgtkmvtymAtotallyAcrisisAjoyce1AdaytimeArockydogApasportAytyfdbcnmAmickeBananaAdimebagAonline1AmotheAredfiveAgeorgiBaneshaAinternet1BwantsexArasta1Atigger01AvitaliyAghbrjkbcnAmugwumpAreporterAchuchaAknullaApetra1AashesBvgustAfronteraAbigpapaAgrapeAtony1AganjubasArodionAveneziaAsignalsApendragoA1234567uAintelligenceAhariboBotbabeAelishaArocketmaAhammerheAdarkmoonAthematriApopsicleAjewboyAboggieArocketmanAhellomeArugerAviolaAratfinkAglock17AsemenAforce1AmargoshaAgeishaA68camaroAibilljpfAkevinsAbigstickAlehmanA1bigdogAwestieAsaladAmilfordAsweet16Agypsy1AvoyageAjukeboxBacksoArichesAmartinoAstephyBhrikeAjadziaApassageAdemocratAiloveherAottersAmilashkaAfloriaAbiggestAswedeAmatt1AhoesAfunnymanAsawdustAemachinesArob123AplayboysArandalAtwiztidAcharlAdave123AsatrianiAlolwutAwobbleAlucky2AsusannAfaulknerAgospelAxavier1AsuzieAtablesAroderickAbloominArjyjgkzAjohnnAlowdownAghjcnjghjcnjAstrannikBatinAmegafonAthomas12A123123eAmarkoAibill01Aghbdtn12Aadmin18533362A15151B35531A271828A777444A1231231D3210B475963A2234562A5641110A7555545A12233445B59753852A777888999AdomenowAwowserAstrollerAjerrygA014789AtazdevilAdale03Asarah123AcrossbowAbiggArocco1Aabc321A08154711AcriticalAborgAoldnavyAfreetimeA001100AkingrichAtupeloAfunhouseAclarionAlynneAhun999AplayfulAcaptBoopAswatAtrader12AparadeAdickmanAbogieAprasadAheart1Aroberto1AbillybAmetalsAbillingA013579Adave1AmaterialAhottie1AtoxicAshiningAlemondAwhkzycAnjdevilsAmikaAhotwifeBrfzlzAdiane1AgravelAthundersAamanAnoseAmounta1nBuratAandrosAjanaAinformAroyaleAinternatAcamaroz2Apaper1AdamagerAmageAtoshiba1ApinewoodAdick69A1qay2wsxA2wsxcde3AnihongoAthinkerBrust1Aaugust1AjabbaAstockingsAelena1BgorovAhiroshiAsureAfuturesAboobs1AholeinonAmazingerAonetonAempressA%%passwoAvampyreAcanadApokey1AclocksAhoochAjamestA2cool4uAcollege1A8ballsAtreacleAak1234AblazinBonefishApass01AislandsAhomiesAxmenAblue45AfairviewAbigfoot1AfunnAcramerAmillion1AchewbaccaAenfieldApiramideBatrick2AjuggleAchumpAsc00terAgalahadAwinter12AbettieAinchesAdecaturAhatfieldAbluelineAfishnetAunderworldApiranhaAninoAlagerAfreightAcatfish1AorlandAbourqueDndAmaxmanAjiggyAyackwinAgirlfriendAbatemanAinterpolAsydneAtideAdandfaAwindstarAtenpinAskittleAbluegillAedithAbratAlizavetaAfatpussyAisgreatAstlouisAberezaBaloneyAst0n3AbeckettAcamaro69AwackerAjeevesAgobucsAplayer69AhommerAtherionAcadenceAbelugaApolgaraAsamaelAjosefAcrazy8Aqqqqqq1AgroupAwarcraft1Aa123321AqwerfdsaAincomeAnutsackApeteroseAqqqq1111AviewerAmardukAarchitectAmansurButaborAbitchinAzamboniA123456pAckfdbrA123456zxcAmofoAallureAmcleanA13579-AjacqueAsmurfsAtruffleAmarcieAgimmeAjack123AqazedcArosetteAcentrinoAmarxAaguileraBmherstApaula1AnikitAsegaAphotoesAheraldAkobe08AwonderlandAbingosAmemorialBidwestAtrashmanAdanielitAgreen12Aasd1234AfonzieAclubberAinvaderAartofwarAlexiconAkeysApuckettAmetal666AdrippingAflamerAmansellAflapjackAkassieA123xyzAsamwiseAraider1AnewworldAorganicAlandscapAverifyAcristiAtemp1234A23176djivanfrosAsalamandraAvbkbwbzAljrnjhA123456789qwertyAnullAoktoberAdeimosBzxtckfdAsobrietyAtookieAcasaAangeleyeAyecgaaAhotcockAsaturn5AthetachiAdickfaceAiddqdAadvocateAnasdaqAschooAmarmaAnokia5300AeditionAgemstoneAminionAnonrev67AamormiAgodofwarAsmallvilleAqwertasdfgAdthjxrfArfntyjrAmashinaAaudis4Alisa69AstampsAastroboyAwoodwardAarmeniaAdeloresAubnfhfAcyberonlineAgalatasarayAvbkfyfAsexybabyAhendrix1AmitsubishiAnotredameAblacksunAqazxswedcvfrAvittorioAazsxdcfvgbAtillieAshaktiAkaramelkaAshadow13Acapa200AnovikovAcatalinAqwertyasdfghAglamurAmobilAcathy1Adevils1ApatrykAhitomiAdominic1AgallardoArjyatnrfAimperiumBnflamesAbugsbunnyAnicholas1Avlad1996AarinaAjakersAdragon88Aconnie1Aastra1Aconnect1AukrainaAfreezerApiedmontAbagwellAqwe789AgrassyAkatrina1AdavidmBorseyAblade2BigdoggApheasantAblastoffAginger12AconvoyAvenus1AstevesApablo1AtuborgAindahousAlaredoAilovemyselfAparasiteAvoltaireA123456jAtouchmeAdelanoAbanjoBronteArobinhooAwallace1Aseven77AnewageAcummingsAshorty1AjimiApolska1AlaracrofAbosstoneAquixoteAtribesAjustin12Asystem32Azebra1ApigdogAbluenoteAnibblesAflossyAislamAsk8terAbrentforAshariAgoldmineAwellingtonAbassistAmannerAfortyAgoodtimesAmichiAcamillAmousseAcolgateAbuddaAwtpfhmAschwinnAholleyAsincereAdewittAwantitAhumptyAexploiteAgiddyupAdopeyAgreedoAmewtwoAsaluteAreverbAmorgenAuselessAlapdanceAcvzefh1gkcAmaniaAwater123AkillemallAguyuteAjoyrideAnelson1AmatveiCrloweAdrivingAvelcroApusherAlfybkrfAcraig1AbublikAfantasticArockingAscooby2AcnthdfBovertAramazanAgailAiwantyouArepytwjdBadianceAlethalAruthlessAsweetheaApeter123BoohbeaAvolodinAolechkaAkapustaA01011957A89600506779AsandeepApablitoAdamage11A212223B35711A524645B55444D0666A748159263A987412365ApissantAmichael7AcaddisBhickeBountry1ApogoAjerrysAhatersAcumloadAraccoonAepaulsonAperilsAslurredAhermitAcards1ApowerpcAkalleAariadneAbungalowAdragApatsyAsemajAgartenAbrandieAtrippAchatteAjjjjj1Agggggg1Appppp1AloadingAstomperBellerAjamalAcafeA1aaaaaAjohn1234AaureliusAmonetBan123AbuttsexAgiftedAmerliAcubaAetienneAgraingerAcharcoalAeatmeeAmarisolAxytfu7AstandAvultureAronaldo9AsorayaAkonaAhomebaseAyannickAtakeAlanaAadrianneA1chrisAsensatioA1georgeBbubbaBdiamondBgolferAburkeAmclaneAconejoAedwardssAcrybabyA3edcvfr4A1qw23eAterenceAgeorge12AduneAlazyAplayoffsBasseAlovegunAking123AclosedAandreas1AmonthApanchitoAfranticAjys6wzAtrain1Aout3xfApicard1AmunchieAfellowesAthirdeyeAalfaromeoAhellionAisacs155Apaige1AjoanieAdominusAhubbardAroodypooAstars1AmcleodAoopsAscootersAdbrf134AsludgeApaul123Atahoe1AbugsyAetniesAjesuschristAmaverick1Adragons1AashmanApalmettoAsylvaniaAgerardoAtobagoAfavre4AhanselAthebesAverticalApsycho1AaureliaAfordmanAchandaBallmeAw1w2w3w4AlaunchAproteusAmelbournAdesperadAsave13txArelaxAangleAhotwheelAbretagneAarabicAtrinketAstarlaA300zxAphattyAcasparAsportsteAaidaApickettAterraceAshipAragingAmadsenCrcyAvatolocoAghostmanAjedimastApringleAfuturaAbungieAprakashAmuncherAsunrise1Aclinton1AblingblingApembrokeAfatimAarseholeAbarretAslayer66Aanimal1AframerAboredApsychnaut1AbonitoBegoodAstartedAmollysAharlanAprairieAbradenAodysseusApizzapieAsilver12AdesiresAalpha12BccentAreverseAdriver1Aguess1AwargamesAelissaAwinkleAgiveAmysterioAdarkknightAactorAcareerAintegra1AblondiAwestcoastAscotiaAxfactorAbanderasA4r3e2w1qAcrabbyAfatluvr69AtrilogyAxsw21qazAdenisaAyjdsqujlAfeliceAslimed123AkawaiiAmalvinaA1q2q3q4q5qAsailormoonAhabanaAvarsityAcurrentAbig123AsameerAleviAteleAspanksAindians1AbabycakesAsarahsAteddybAschweizAmack10ArougeAcreativAscoobAwoosterAdiesel1AoldhamApussyeaterAghfdlfAnikita123AmuenchenAsashokAyanaAqwerty22AmedicinaAgabriellaAcristiaAalex22AstussyApetersenAmaraAcyber1AmercyAden123AizzicamAwarptenAnokia3310AsamoletAreactionAscott123AwhosyourdaddyAprikolAblack2AegorovaAauraloAjapan1ArafaeAastoriaAcarcassAbill1AtagheuerAdexter1AweebleAxthtgfirfA1234567zAkochanieAoc247nguczAcariocaAmanishAgiannaAorkiox.AkingairAsquishA1111111111zzAtiredAporn4lifeAanatomyAsnooksAillegalAwarpedAslimerAlittlebiAsiberianAlimerickAtoysAxboxliveAspawn1AignacioAgafferAparishArostikAlunchAbaileAmopar1AdeskAkratosAprettygirlAcalvaryAmoonpieAthejokerAgreenyAcoyotesBlericAridingAcuntlickAmetalmanAfreak1AchantelApounderAleicesteAosborneAhandcuffAwarhawkAtemperAprincetonAtrollsAkailuaApeaches2AministerAthree3AbillysAwifeAcum4meAsitrucAfirestorArhapsodyAnodoubtAangels1AjeronimoAdenise1AmakemoneyAannemariAironmaidAutvolsAchevymanAresistAbungeeAready1AhugecockArefreshAtooshortAprimetimAyogiAsylvesterAcompaAthomas2AlasherAoceans11AtuggerArichard2ApassingAvaldemarAjetaimeAbear12AyendorAtoobadAgoodiesAdeath123AoutcastAsafeAdarkwingAtaylor12AwipeoutAchrismAjeepcj7AnikitinaAabramsAjawsAnicknameAyomommaAcoopersBerealAflyawayAcaitlin1Aslipknot1AmuaddibAnellyA123456oAramoneAdima1996AfnkfynblfAskypilotAnewstyleAlevaniA0wnsyo0A123sasA258741A335533A451236B79373A554455C5888A741236A852654A951159B68574A12332112B3579246A96385274A159875321A326159487A789123456A1223334444AalvarezAtimboAluckyboyAmullinsAasecretAboobyAramairAmissA2112rushAchicasAduranduranAhiroAgunmanAdailyApescatorAdte4uwAgaetanoAchapinAmerrickAlinseyAbraydenArulzApolice22AgiovannAtrinaAcandiAsilvaAbakersBoner1BurnleyBbbbb1AthebombAelite11AbirdyAsexslaveAhobbsAgansterAbuckieBosworthAheinzAmulberryAelohimAwillysApurgenAwaterfallAskeletorAplantAannettApulameaAmccabeAcaballoAruleAhumanAdisco1AitworksAsantoBteph1AidiomAwalkAasslickAgaysexAbebopAcreepAnoticeApepsicolaAwinampAoctavianAlove22AserebroAqwerty00Aeeeee1A123123123qAdetailAitachiBlove69AsquiggyAw4g8atAmachoBontaukAdwarfAterrieA1jordanA4snz9gAhot2trotAblue33AthugAdeloreanAbiancoAmatthew7AstepAishikawaAsimeonAmagyarAbaldyBulletsAexplodeAhashAboggleBurgersAaliasApedro1BrimoAdocumentAjessikaAretepAzorglubAwilcoxAfistfuckAdixonAbarnettAfreddApedrosAgfhkfvtynAomega2Arunner1AgormanAsexyguyCagateAwhitney1AjailbirdAarrowheaAtaintedAsexbombAcasablanBreekAqazxswedAmoneymoneyBiroslavAdagwoodAshowcaseAbulldog2BarcaAomega3AcolletteApolkmnAsorcererBex6969ApatoAhemicudaAsaberAhotel6AstargazeAfunguyA1111aaaaAtweetApolkaAweirdoAimogenAblingAadams1AconflictAironheadAshortsBmartsAbones69Afuck777AmooseyAwinkyAcnhtktwAfktrcfylhjdbxApoppetAcharCecksAvfnhbwfAscimitarAnikolausAmikaelaAashishAorientalAtrippinAhellotheAparoleAnordicAchatterAreverendBonaldo1AovenAnegritAwhiskey1AedinburghAgeminAhondacrxAzaxscdvfAlatviaAzepplinApopularAvoltageAkitten1AslapArebirthAvoetbalAas1234AorderAanton123ApervasiveAkelly123AgoodnewsAastonvillaAchevalAmilagroApepper12AstewieAashley12AcachorroAimbackAtruckersAsysadminAolivettiA89015173454AmamedovApeteyArjcnbrAmultimediaAdaddy123AnavarroAmanitouAsymphonyBanjuanAtoronto1AemachineAfktrcfylhjdyfAphuketAasdfjkAdanni1AmalcomAcnfcbrAregretAscotty1AbonfireAvaz21099AsandalsAreklamaAviolentAslammedAjoseluiAploverAsmartiesAhealeyAwarsAroxanaAstangerBunitaAhanoverAgenesiAfrankfurAgodwinAhorny69AgfhnbpfyAbubbyAsvetlankaAcuthbertAstewardApassword4AalcatAodetteAblue21Astealth1Anaked1AdeclanAnagromAyardbirdAgodfreyAmorkovkaAatdhfkmAgjgeufqAdmitriiAkisskaAqwaszx123AvirtuaAdragon22AarhangelApercivalAfrescaAminakoAkban667AmuaythaiAwhitmanAnyknicksAmahalkoAyorkshirArodrigAenkeliBcho45AmolinaAjunctionAguitarraAtatianAherefordAsweeperAbadger1Atippy1CghtassAmetro1AhoddleAjackson2AtaekwondAisland1AphenixAmoses1BillerliAlaylaAcstrikeA123123qweAstapleAqwer4321AdivisionAgr8fulAfeyenoordAsolidAmorriganAdtythfAhello2uAapathyAparolparolAvermont1AkamehameAroundAjake12AarschlochAcatloverAwhatthefuckAmadokaAbigshotBaggerAdogfishAcalcioAdirewolfAkarmenAjakedogAreaper1A1357911qArochesteApittbullAhondoAracheBoma123AbethannAjobsAbernard1AterminusAwaldenAtrigger1ApennstAgrandprixAfuture1AdrinksAcomicbookAjapanesAexcellAjeanieAsonnyboyBexboyAbennett1Adaniela1AtwingoAmoneyyAlickemAslydogArumpleAlucindaBogan5AeltoroApartiesAlawdogAgibbonAhelloyouAgunterAjimmy2AfencerAstarksAredtruckAtrexAcutiesBhevyz71AmikoAheaderAwalkmanA1nicoleAsurfinAkosherBindbudAmorrisseAtraffordAupdateAmymoneyBatchAevenflowAconcertAgenevievAmarishaAoneshotAkonfetkaBnowledgeAirvineAhalflife2AlaxmanAmausAsk84lifeAfuck12AversusA123456789wAdawg1Benis123A12344321qAfyutkjrAghblehrbAlbfyjxrfAdronAlollol1AkurosakiA4000A123333D666A567765A789321A963741B76431A4637324A11121314B9844891A21125150A132465798A243462536AtommysAbrandtBmwm3AredbirdsAmintAskelterAwestportArock1AslackingAcrystaAsoldier1AhostedAannualAmakemoneAindigloAstringsAantoniusAlegalA3someAbogey1AculoAoliviAfrehleyAeadgbeAtalon1A541233432442AdmitriApatriot1Afish1AhossAweightsAtakehanaA12345eArobert12BatchetAgermaineAchainAbecketArotterdaAvicenteAfcbayernApirataAtoosweetAlove13AnoloveA380zlikiAknarfAstartacAmilesdAschwarzA1robertAcoastA4freeAwarholAfigmentAbellevueBayviewAprizrakAarigatoAsallieBcoresAmonica2AtiramisuA1daddyAreggie1AmamboAbelarusAwetlandsApracticeA12qwaszAsssss1AluckeyAwatermelApauloBlatoonAjohnmishAorange8AgumpAnatasAseraphAt34vfrc1991AhecateAmelvilleAstuttgartAfffff1AbolivarAmuffiAcheck1AwestgateAhr3ytmAtheravenAsuperdupAfolderAskoalAmzepabBaria123AwinifredAadagioAbenningAabulafiaBl9agdAoemdlgAdhip6aAcrankyA7uftyxAantiochAtrustnooneApapercutAenergizeAorioleAbarnsleyAalexanAhoopsterAeightballAtoughguyAbabygurlAmoore1AdeadeyeAfermatAazerAdalilaBoctor1AmahoneyAcircuitAblanketAspooky1AnadaArazorbacApaintsAschlongAbrazzersAcornholiBhampagneAsingingAyokohamaAbigboiAkayaAbrewAfiretrucAthurstonAepiphoneAgatewaysAchicago2Amexico1Atransam1Aseven11AedwarAproverbsAbulldoApatricioBioneeAgood2goAellen1AbrianjoAdavidaApuravidaAshockingAbaby1A123456qazAchaseyAwarfareAdurandAtremereAvfhrbpAgloriousAcatchAsoccer15BtrategyAq1w2e3r4tAstalloneApayneAnailsAjeterAishtarAbugagaAarishaAsunderlandBeven777Aa12345aAcarrierAsandy123AcapitolAstringerApennerAyingyangAkramer1Achevy454AanamariaAiloveporAghandiAbeauty1AgfhrehAasdewqChantiAtoughAshannaraAkremlinAwhatisitAniuniaAconfigAkakarotoAfriendshipAnurbekAbuzzsawAcandidAsuperboyAcellularAdressAmariconApacificaAteacupAweedmanAannabelAphantasmAantmanAsalvationAfinalfanAcogitoAyummy1AsepulturaAazerty123BdidaAtigerlilAadrenaliAhellbentAminaAguderianAsamurai1AgrimlockAairwalkAplayboAankletBenimaApampersAcallerAbaltimoreArenderAarenaAwilson1AbeautAairforce1BsdasdasAgirdleArebeldeAnewlife1AbatterAtexas2AseafoodAdahc1AcheesecakeArebeccAtestmeAswindonAizabellaA123qaz123AkardonAbrindleAshotgun1AnorthstaAsherwinArosettaAkindnessBusanagiAdicemanAjunfanAalainaAshakeAcharlie9AmalishkaAaa1234AszevaszApepitArobbyAiskanderAfgjrfkbgcbcArfgbnfyAkatenokA123456789qazA555555aAa123123AcabrioAhome123AdreamyA55555aAaol999AsammyboyAbagpipesAdimarikA4rfv5tgbArewardAismaelAaliskaAcjrjkjdfAbarsukAfroggy1A3girlsAlebronAceltic1AmamitAfreedom7AbuldogAalyssa1AvfrcbvecAutilityAbutter1AmelloAcfhfnjdAfavoritAhaha123AkellysAoliveiraAtigerwooAbrewersAgarrett1AcnjvfnjkjuAlover69AcambodiaBenturionAanime1AwarzoneAverityAcoletteAvfiekzArediskaAneptunAonclickAfidelisApiazza31Aboogie1AspandexA1234qwertyAihateuAliberalAostrichAdoremiAsheliaBcooter2AmickeymouseAvjhrjdrfArainboAcreamerAilonaArolandoAgrasshopAsnottyAcolleen1AbauerAwonketteAernie1AmelonieAvasyaApatrick9Ajake1AklootzakAjake123AgeniuAtroutsAvsijyjrAbritainAlandryCterAbubbadogAmustang7AghbrjkmyjAmakarovaAeffectAkohlerAbetoAtravelleBiedupAchevronAdeereAelvira26Asteelers1AcompusaArejectAbootneckBigginAred1234AwatkinsAcuckooAsharoAgohawksAou812icA000006Abobby123AnutzAyoohooAredsox04Aladybug1AfuckslutAbigdeeAmcgwireAcansecoAjoannAhotpantsAshawBlavesAaluminumAgrizliAmyleneAnodrogAadelphiaAfrederiAtavernBhomas01Agolgo13AcrimeAmcguireAcoffinApassword69AsupperAlolitAstalker1AmatchesApanaceaAkeatonAr12345AportmanBrefectAlakeviewAjonathan1AmedievalAlolloAhammers1AtowingAflaviaAneogeoAall4u8AlongbeacBinaAravageAnetworksAjonessAcindersAlesboAjansenAalbaniaAlarry123Ahansolo1A4904s677075Akirill123Apaul1AjemoederAshadow123AoddjobAreddragonAw12345ArespektAkeviA12345iAdawggyAorlovaAnatashkaA123555A222888C4422B42526A475869A12345671E7890B9933991A44445555A135797531B111122222AtincupAmrbrownxxAharley01A007jamesAflyhighAsonnetAcordellAlove23Astrike1Aapache1AfreestylAbarmanAhardheadAl2g7k3ApollockAceltics1AjuergenAsoccer7AmaribeAballzAyamahAmellonsAshadow69AtrashyAgunsAmittenAweberAandy123AcainAfartripperAggggg1Aeeeeee1AsuperbeeAturkishAknowledgAeyecandyBugenBngelAtopfuelAbudiceAeatmerawAasteroidAcrewcomAblisterAkhaledAcheetaA12345fAabcdef1Aellie1AagustinAspectraAdoqvq3AkswbduAbrowns1AparkeAoconnorAcerberaAanselmAsister1Akitty2AdivxAphipsiAtommAmaximalAfrannyAmarimbaAjusterAbulldoggAmavrickAvanderAmerryCyersA1williamAc6h12o6A1jamesAfloggerAcarmexAletitbeAmylordAsteeler1AkosovoAbobdogAredhawkAsquonkAlamarAsycamoreAtigermanAmossA009900AhowlerAcleaverAsquishyBhinyAmarkyAbethelApkxe62A2fchbgAladydogAfun123ApascaleAewtosiAaaa340Amp8o6dAtyvugqAnowhereAhard1Atequila1Ahunter01AtzpvawAdiogenesAmacrosCrillioAxngwojArealdealAgreeksAlarrysAferrari3AcrapsAfidoAcheezeCilidogAlanmanAwinston2AmozzerAregimentAgroganBerhardtAastanaCdf1CakuraApeople1Asoccer14AwebbAdavidlApower2A013cpfzaAbmw325iApompierAfredderfAhodgesAnietzschAblueroseAworkshopAbharatAqpwoeirutyAsymbolA12345trewqAhillmanAwoodysAritchieAdefiant1BustoffAganymedeAchapelAmaxieAthelemaAclearAsatanicAbeastsA1234rmvbAfreeloveAdaniel2AaqswdefrApootieAnumbnutsAquetzalAwalleyAsiemens1Alove2AjuggsAwhistleAkakaduAjay123AantiguaBmanda18AminidiscAblablablAvoicesArazdvatriAsensorApakistaniAmaddog1Ababygirl1AfylhtqrfAalhambraCastairAukflbjkecAgonefishAbiteme69AkozerogAxcountryAhakeemAbigwillyAhumboldtAfaceoffAgreenbudAcolbyAiluvsexAchester2AoverrideAdestroAbosniaBlackstaAscooby12AerickAsherpaAgodsonArules1AjumpmanBointsAbiscuit1Beaver1AsalamandAchantellEge1AacostaApoliAcarmelaAjenny69AmilagrosAkaileyAcoffeBhelseafcAparoliAmementoAgtnhjdfAroxanA10inchesAt123456AfelipAmikhailA0147896325AlynxAdarkjediAkatana1AblackroseAfalcon16AgodisloveAaldoAregionAq1a2z3AghjkjuAweronikaArankinAg00berAagostoAhaircutAblue13AvfhvtkflAprimroseBassword0Alondon12AkukuruzaBozlovArfpfynbgAfarrahAjackiAdragon76AgamingBrenadeAcristoAbritAkasparovAflipsideAkadettA12345gAmemyselfAgfgjxrfAkiddAdoritosAghbdtnbrbAmicrosAdashadashaAblue55AwessonAhellyaAdaniel123AsavantAghbdtnghbdtnAjuarezAvalerie1ArfhjkbyfAboazAevelyAkukushkaAlatitudeAbarbie1AsistemaActhuttdyfAstrelecBonechkaAxtkjdtrAchiccaAbelochkaAatlantCybrcArerjkrfAgnusmasArasenganApackmanAtransportAeaterAmarjanAulysseAscribbleAcdtnjxrfAjarredAmarbellaAsparcoAlandlordA1cowboyAblackberAalvarAelninoAcarguyAselenAameliApackers4Amartini1AschlampeAred321AcaroAassmasteAcapitanAlouloAanasaziAnatashAmaxim1BrhappyAgolf12AshizzleAjledfyxbrAvika123AchurchillAmiraclesAhooplaAtimohaAricardo1Apassword1234A07831505ApikeAmonkeeAbigskyAnbvcxwAfoolioAsaint1BilverfoAlilly1AsabotageAtackleAballer1AspoonmanAbabybooCnderaAfred12Acupcake1AswanAcongressBhiselAgfhfifAbmw123Axrp23qAleo123AbritneysAdrinkingAsideshowAppspankpA4lifeAgearheadAbarkAjamiesAkamilAropeAhookedAq8zo8wzqA1winnerAbassfishCtman99AqueerArider1AaccountsAetoileAkinky1AfedericAjokingAdannon4AstratosAcarbineAjiggerAgamersAscottishAbiggyAtemporarAstumpAmultisyncAboingAslingerAhollydogAscribeAneukenA12345678900987654321Abella123AkariAmoonieAlovepussyAsumnerAkanedaAlexingtoAcanadienAbluearmyAwrxstiAluzernAknivesAbobboBlytheAlaverneAproblemAdollfaceAletitridAjuventuAgoodfoodAsuper7AkelsieApeterbiltAgetalifeAporkerAsunnieBhock5BtairwayAdriver8ArahasiaAnakitaAbonhamAmillsAtroopersAhalfpintAbrowserAwestcoasAdeusexAcostaAsteadyA3stoogesAtoolshedAcanesAbuddy12AmattmanAdrdoomAtimingArapidsAgoobersApepsisAbuttocksAlausanneAsebastienAwildroseAdoormanAiwantinAbocephusAloveme2AdaviApatsAsqueakyAnafetsAjeanineAlotteryAkatinaBenyonAjesucristAghbdtn1AskyblueAbestfriendAgraemeAqazxsw21AkallieAhoward1AfavourAkingsleyAstacy1AdmoneyAwashereAgreenwooAproblemsAdebateAsharikAcoconutsAibill123A08522580AflorencAlena123AfussbalAimagesAharry123AkatushaA20001A113322B23234B33113C5792A333888A555111C7744A1001001B212123A2583458A11924704B2345666B9877891A25251325A43211234A123123321AtitsnassAconneryAerika1Aheaven1A123asd123AhauntedAfreenetAtestme2AmabelAjumbleAwallisAgnasher23AregisAgreasyAsinfoniaArjw7x4AwavpztAnewguyAbirthday21AgabiAdad2ownuAjaspeAfleetAmauiAreksioA1pillowA019283Aelaine22AmrbrownxAyyyyy1Aiiiiii1Ahhhhhhh1Acurtis1AtestyAspenserAdominosAprobeBhaserAadolfAwashAmatteBobyAsureshBhootingAqw1234Amitch1AhopefullApiotrekAjordan12AdolfanAgnagetApwxd5xAtronAgotloveAreplayA8dihc6Aqbg26iAamtrakAupnfmcAheronsAbluemaxAtrotskyArecycleAwikingAmanzanaAsupersonAcommieAherbAford1AlamesaAbringitAcamellAjoonasAsereneAintellAleilaAabdulBlex13AhyperAqwerzxcvAgrubberAcanelaAichabodAvibratorA1hunterAhillbillyAwestwindAhotlineAsnowy1A1tiggerAiggyAcoversApigletsAbronxAframeAyakuzaAalex99A154ugeiuAcryptoBlarkieAeducationAgandalf2AcorvusAichiroAduluthArosalindAparamedicAscenicA111111aaAschneeAopelAdowneyAlustfulAg3ujwgAreddragoAwinsAhufmqwBellouAmeddleAlikeitAmanwhoreCmasitaAaassddffAsexmeApowerbooAcrackseviAford150A51051051051AdaveyAfidgetAcup2006A383pdjvlAplanetxBipoAlandingArottweilAplayeAkarlosAnazarethAgudrunAtercelApaperboyAdraperAbochumAadjustAscrantonAnotagainA2girlsAspringstAdrumlineAsalamatAlagoonApowermacAwoainiAducklingArellikAiiiii1AcanabisArjynfrnAvestaxAburbankAcheckingAkiraAwisemanAafricanAbrendan1AfontaineAwizkidAdragon2ArominaAeasy123AweiserAhotrod1AmaskAjiujitsuAbuckeyBacklashAquarkApennieA2w3e4r5tAancientAneuronAporn1A270873_AwellsAcolt1911BhicAhahahAknockerAmyhomeAbulovaAshingoAthisoneAgorditoAjennysBudasAkickitAtolstoyAdingusAchangeitAwinningApossibleAfuckloveAmozillaAchipieAdoma77nsAlostoneAhoopstarAalamoAcositaAstrangleAvenom121293AfrolovaAcorrieAhatcherAblue01AfabregasAambassadorAmiriaAvacuumAfree4allAvbktyfAwelkom01AguessitAassaAcuntsoupA12345zxcvbAblacksheAosbourneAcatarinaAmoss84AchalupaAgargamelAanutkaAgomerAatticaAzealotAmadonnAgolf18Aporno69AcoronadoAkaplanAchaossAjizzAcommodoreAteiubescAvfvf123AmeatmanAhellcatAoutlookAprometheAbaikalAmelissa2AanuradhaAberlinerAjesuApainkillerAreviewpaApepsioneAcassAfriedaAmontesAsalinaAblack12AsladeAgtkmvtybArockportAharrypotAclairAnewmoonAvodoleyAconfuseApositivoAteddieAderek1AmaidApflybwfAhumperAfoosballAkiplingAfoxtrot1AgonzaleAvivianaAriker1AsaltanatAkjgfnfAvfvfbgfgfAhadokenAsycloneAmythosAgigoloAbiggsAkelly001AhamburgeAduffbeerAjennife1AsaywhatAamanda12AwebhompassAa7777777AcountachAwembleyAcumfaceApiano1AbatesBritney1AworksAseagullsAgrungeAanabelBlfa156BmyleeAguatemalAzamoraAgtxtymrfAlibertaAhelpdeskAmazdarx8AgfhjkmxbrAfuckinaAgehrigAscampAcruzazulAgiselleAcolonApollitoAhermosAlovecrafAdarienAaliciAcastawayAdiankaAgecko1Awings1ApeoriaAbreakersAthisismeAmaster2Asherman1AalmeraCpacinoAmallAgameraAmeadowsAlouie1AincognitoAbadoneAdefenceAvictoria1AannamariAsuzenetAmarissa1ArollieAquality1AcnhjqrfAmanuniteAqwerty21AandreeAdockersApurityBackageAsarasotaAcheckmateAboondockAvredinaAgarciAnokia5310AhappydaysAlandroverAkfvgjxrfAchesterfieldAopensesaAcrossfireAsenna1AapocalypseAthetickAwildblueAdragon66AjunkerAtransporAspokaneAnec3520Alocoman0AtenniAsubmarineAneveragainBokia6303AmovingAcookies1ApowerupAgalenaAmoneymakerAwestbromAhaggardAautobahnAdenver1AshuaAcycleAjasonbAgazzaAofficialAphantomsAwesley1A1patrickAbenji1AsuzyAwesterAfatcockAnew123AsprinkleAdeepseaAsamsaraAjuliesAmaldiniAquick1ApurchaseA1helloAdriversAclientAshaynaAinterestsAmets86AdrydenBothedewBefjamAbilly123AfelixxAscalesA010203040506Anumber2AbingerAnigga1Achicken2Alibby1AkevlarAmgoblueAshakeyBparkieApatersonAgizmo123AsandrockAbinkieBubberAshakaAtommygunAhockey12Apimp69Ausmc1775Aopen4meAfightcluAcapsAaudia3Akasia1AtanjaBhundeAgandhiAmauserAlakers32AgriffBorgonAdragon23AbigbuckAheybabyAbridgettAlexiAiloveyou!AsocietyBmokeweedAgibsonsgAfirefighterAozzie1AfunsexAseagraveAdarlaAbourneAmadhouseAbookmarkAsolomanAcarusoAsissy1AtristenA[start]Amookie1Aits420AoneApantyAbroncos7AwindexAdobsonAbellsAteriAvonnegutArobbie1AdrawingAboliviaAfightersAcachondoAkasandraAchelsea2AhomersimAerosAsyncmastBpirit1AhaywardAdoraemonAchaoticAnurse1AroxieAvasiliiAfartingAtarasArodeo1AcroatiaAjohn11Alol12Af00barAalpha3Asamsung2AcherishApullerAberriesAeugeniAtyler123ArfnthbyrfAteaseAhandlerApepinoAmontagneApatelA4wheelAgraffitiAsmile123AtrustingAnewportsAtopgun1AshankApericoAtreatAlfiekzAhjvfyjdfAqwe123asdAcrestaAsogoodAtmoneyAwoogieAkbytqrfAlost4815162342AkozlovaAmobil1AplatformAsiliconeAnareshAart131313A45645A113355B23432E44B78500B92168A999333A2580456A55832811A98745632B9887766A124578963A314159265B21456987AeagleoneAcrazyzilAkristalAyssupAdimensioApenneyAblacktopAacrobatAkentonAnachoAtrapAsrilankaAmuddyAbedtimeAsessionAtyler2ApimpleAjjjjjj1A12345678cAclausAslipknot666Abatman69AfinleyBfffff1AsqrunchAgobrownsAwellcomeAbear123AmontagueAaccessnoAsweetie1A123zzzAirlandAupdownA6stringAspiceyApatentAtratataAiamgayAchristofAbucksterAgldmeoAm5wkqfAratpackAmariosAjake01A1martinAgiulioAmerrittAl8g3bkdeAbommelAgeirbyAwallerAsunstarAimissyouAbakeryAabbieBr3yuk3Agoober1A4r5t6yAsalladAtrial1ApershingAxenaAmanchuAhcleebAx24ik3Arazor1AscotAdummiesAfrigidAbobbyyAtawneeApigsAgreddyAsamiAccccc1Ahhhhh1A102030405060AmarksApatch1AgarveyAjust4youAantillesAbethany1AdeadliftAgordo1AvisionsAshankarBouthendAglotestAbrianneAsxhq65AlindasAedgewiseAmathAabracadaAdrummersAscxakvAt26gn4AwinslowAcalhounAshifterA3cudjzAxqgannAteenagerApxx3eftpAladaAarchiveAf9lmwdAdurango1Ahihje863AoakwoodAalmaApaybackAgeorge2AmoldovaAw0rm1AbondsAjdeereAdapzu455AchuchoApassword6AgabeAleisureAcudaAhicksAballonCreAcool99A123katAlowlifeCvinAjoeboyAalpha06AfiatAmoosemanAonkelzAcoffeyAbuckleAskooterAgreen2AaaronsAheathAoneeyeAgr8oneAqwerty6AjuicesAmerhabaAbowhuntAgodboyAscratchyBex666Apostov10AmicaAtooterAjimbosA2sexy2hoAcumalotAthaddeusAkassandraAstadiumAramaAstjabnAkatie123AgabbieAfastbackAtrailsAcfvjktnAphone1AreliableAohiostatAjellyfisAmoronsAbigbillApidarasAbrazil1AfuckmenowAbullheadAaustin12A1234abAmiraAarsenalfAtemporaryAghbynthAlollyAglistAranger99AvjkjltwAutyyflbqAbaguvixAphydeauxAmindy1AsevenupAqwertyu1AnumarkAlettuceAdummy1BreadA78girlAdionneAmongo1AsylvainAdthyjcnmAskate1AenableAronalAhellraiserAabpbrfAdongerAeminem1Aafrica1Bccess12AtimexAcidkid86BortlandAaceshighAkimberleAverizon1AulisseAgabyCrdeniaAbewareBoxer1AgriffenAbiotechAcigar1AsecretoAtomokoBesting123AshipyardAorange44ApepsimaxAsalem1Awolves1AqsdfghAfallAlyudmilaAmichaeljAanna12Anaruto12AtangerineAloyaltyAmichelinAtelemarkAshemalesAdaisy123BoudoAsmilerAadult1Adragon10AstarionAclaire1AdreamonAhappysBfgcjlbzAcheetoAgemmaAshahidAcoopeAsoccer22AanonimAesmeraldaAthrillAfabienAtaylor2AfilippAariadnaAbluefinAkitanaAfrdfhbevBerdinandAwinstoAvavilonAcaliberAkanadaAiloveamyAlynchAgogreenAollie1AfloreAdoorwayAkaitlinAtallinnAdiscAalphaoneAcheer1AkamalaAcensorDtauriAmobiusCrenAsenhaAtoriAnataliyaAcheapAdbrnjhjdbxAfavorite5AnbnfybrA123qwe321AestellaAcxfcnmttcnmAsupergirlAkennetArexonaAthorpeAlthgfhjkmAwtpmjgdaAmarlenAweaponxAniceoneAgametimeAraydenAindependentAarianAzujlrfAfilesAhammarbyAgrizzly1AalloverAlthtdjApollardAidahoAonyxBbeliskAasdfgh12AfloridAcougar1Aamanda69AtelevisionAoldiesAcamposAkmfdmAanatolArockitAmadeiraAbeastyAlovellAteacheAgoogle123AchargedAplanotAmyersAindianaliAsayangkuAmyriamAkongenAdeadmeatAsarumanAapostolAinteractAcracker1AletmeinnowAfrienAishotAangelinAmonkey7A11223344qAspoon1BkatesBexy1234Amaster99AewelinaAcoldfireAvicki1Aranger01AtenchuA9inchesAtelevisiAsherrieAvirtueAclimb7Amark1234Ahogan1AgreeneyeAkoreaAmyfamilyApickles1AheathersApaprikaBreston1AwellesAfiddlerAnomad1ArudedogAbrusselsAgentryAkiller7AjeepmanAbluegrasAdarkenAwireAbarbarianAperfectoAcarla1AoperationAbartendeBlazer1AcartAbobbinsBlackboxAcharger1ApharaohAwoodduckAcoolieAdicklessAthalesBimeportAclonesAjohanneAlsutigerAfreddie1AverdunAbuster11A1234567890sAskytommyAjerryleeAhobokenAcadr14nuAtimmieAready2goAsuicidalAwellAtokenbadAhotguyAkeyserAmy3kidsAconsumeAhoboArossiaAscrambleApi3141AjodyAshepardA1066adAreview69AdeaconsAmustdieAwexfordAfilbertAtaniaAcandy2Ahunting1Aaragorn1Ahappy69ApalealeAcom2AmuleAsailing1AexcelAballbagAlimaperuAracineAnashvillAkellybAtropicApineconeAcentaurAscubadivAtracy71Ahistory1A1summerAnokidsAstartsArebecaBaymonAboatmanBillyjoeAsheriAbridgesArfrltkfAtazzzzAbonessAkillingAmakersAgames1Alions1AyesiamAthrashAnolimit8AinkjetAsquidsArhbcnbyjxrfAunidenAmarta1AdogbiteAoklickAtallyhoAhomeyAlarsAparol1AradiomanApirate1AboonerAmontanAgarfielAsatana666Aq55555AwallAbonjouAspaceyAnx74205AsundinAcharmed1AholsteinApolaris1Agolf72AflamingAsavanaAmalletApetrolAclemson1ApriscillaAstuff1AtoroBurkey1Asochi2014AghostridAsexmachineAthurmanAmagdalenAdallastxBoctoApoweredAgnbxrfAraffaeleAstarfleeAmarcopolAdribbleAportugaAgrigioAdorogaBemonicAlaughterAasnaebAgatechAnjkcnsqAstepanovaAnarimanAegorAnikolaevaAmarkedA123456789gAmaksikAlittletonBockwoodAstepanovAmark22AnikolaevAvanyarespektA3008A123345B52535B98200A203040B82860A654456A852147A12312345B8821221A23049307A55556666A134679258Amichael6A0070AredgreenAsteffAdaddioAfreebieA123danAqqh92rAdcpughAheavydAopenedAmusterAdanimalAredblueAmediumAdanthemaAodieAbasicsAwaltAlevelAandriyAkatzeAzafiraAstraycatBicilyAelricAjohnpaulAfffffff1AlowerAzzzzzzz1Awolf666AleonoraAsimmerAtomcat1AviolenceAfailureAdozerAgtfullamAfollowmeBritterAandrew2ArudderA1charlieAnimda2kApoilkjAmartelAapostleAbabetteArolanApicoloAwishAsiemenAmasakiAd6o8pmAingeborgAlifterAforensicA7bgiqkAsupervisorAnicole2ArecoilAwendelA1701dAdgl70460Asosa21AquixtarAhuggerAbelloAfuenteAsussexAcellphonAmatmanAabelAlovetitsAdigiviewAporcheAchubbsBorey1Agreen3AmissileAjackyAwolf1Ahusky1AilovemomAredmondAfensterAbondage1AtaggartAdjgabbabAmember1AbangorAherbalB4x3dAbodineAheelAgertAtake8422AchristenArebellAprimerAnailAbankingAwaterpolAhadrianAmarconiApackratAtinoAdanoAmaxtorAbbb747Ach5nmkAwithyouA5rxypnAdoozerAfuaqz4AmendezAbjornAjailbaitAbonoAtreemanAlenoreAacun3t1xAchgobndgArasta220Aluft4AechelonAphelpsAmike13A123456iAforeAomar10AudbwskAtommy2AredcatAstriker1AfernandezAroman123BeviloAmacarenaAshaggerAletmein6AsaturnoBexloverBlyfoxAjamboAchooseAwheatAmartynAoctagonAcherrApasqualeAspeedsApegasoAjlaudioAphredAradiosAborrisAcashmereAmolotovAdmanAmpowerAlookatmeAdutch1AbateauAhouse123ApentaxAradiatorA1thunderAzoltanAluvfurAmugsyAbangersAvaz2107AalistairAdumberAchinacatAteddy2AginoAjenovaAsokratesAmaddoxAredfordAwabbitAasdfasAomegasAvistaAgunghoAchoclateAmassAreeseAmonaroBatlockAbeszoptadAsmiley1BartreA12monkeyAmiramarAnolimit9AfoucaultAcitiesAfktyjxrfAssssss1Awwwww1Aqw12er34AaqswdeAfromageAdeamonAcochonAtiestoAfriendsteApollenAhardcore1AtolikA1fuckyouAapple12AguerreroAwoobieCrmwoodAsaleemAtajmahalAgretelApucaraAdemianAstudent1Aaq1sw2de3BidanaAclimbAmadonaAqwerty123456789ApaypalA1pepperAgameonAegoistAlove143AacidrainAfarside1ApepsicolAfortune12Alove21AtalkingAedenAtarheel1Asimon123Apassword7AganderBoogle12AflakesBarhanAteddy123AserdarAadrenalineAvigilantAlakelandAqwertyu8AadityaAcolibriAjessica0ApsalmsAmalamuteBegamanxAclareAbereniceA123456789xAsoccer17AgremioAtampaAkochamAguerraAcaesar1AuhbyujAgrossAalyssArosebowlAnoofAlewis1AesperanzA89231243658sAcostaricaAnaveenAmillenniumAobviousAiseedeadpeopleAgoblue1ArjdfktyrjAalpha2AdouglassAcourtney1AsuchkaAmatematikaAnikitkaAmalikAfargoAhenry14AvfrfhjysAtransformersAolga123AstuffyAtribe1AbooboAratbagAdevilmaycry4Aanother1AbaranovAsteinwayArahmanAsodiumAasromaAzaratustraAdbjktnnfAghbhjlfApfchfytwAmama1234Cgda1AgarandAisraeAhellomotoAperrosAdrgonzoAslaveboyAimperatorAdasha123AskykingAanabolicAmonstrAbooyaaAtigranAbongosAvenkatAalligatoAchamonixAblood1BallenAfreeman1AweenerAkristeBtjyblAhedwigAtrogdorAcharlie5ArubiesAmotivateAgolovaAytrezaApassword5AgraceyAceliaAdenemeAtornado1Asecret12BimranAmrpinkBujeresAquietAeagleeyeAvologdaAtorstenAfoxbatAandoneDre123AvehpbkrfAqweasdzxc1AmurzilkaAsolitariAtempusAwilliam3Aforest1AlbyfvjAbratanAgfnhbrAfatty1AanglerAdepechemodeAzombiesBanozaAias100AhoseheadArobroyAfuckassAtallmanAmarcellAgznybwf13Aassa1234AvyjujnjxbtAserendipAavenger1Acombat123654AarsenAxaccess2AmidianAvlad1997AlittlemanA12e3e456A69a20aAminniBadrasAfortytwoBerariAgo1234AhueyAminnowAfrancaApopeAballssAilovekimAteflonApauletteAquicksilverAribbonAthatAzinaidaAteleportAquintAbigcocksArimshotAbarbosAghzybrAtrespassAnastyboyAmine2306AgogglesAbessAearnhardtAcrisAstartupAqwerty66ApeacheAtrevor1AbiotchA1soccerAsuperdAdfcmrfAcurranAfeedbackAclaudiusAbasslineAxsw23edcAjuninhoAbathroomAprecious1AdunkAwanderAdog1AsalvatioApiggy1Akkkkk1Aryan1AcozumelAstoopsBchoonerArobyn1AnikkieAmullinAgenuineAchimaeraAdispatchAqqaazzAcontrolsAtbone1AspyglassAjack12Apoiu0987Asummer06Abud420AsaracenAgardenerAhoneybAtweeterAfindmeAkacperArescue1AitstimeAgood12345AplayasAdevildriverAkolyanBiller2ApennywiseAcelestiaAroseyApullingsArimbaudApentium1AchickyBandycanAwonder1A321ewqAsturgisAhellenAprimaryAdarthmauAcumulusAvinnyAgnosisAkewlAjetsetAmyassAonelove1Aferrari2Abigtits1AhotelsAbreaksAnalgasAmilleniuBckinleyAf150AholderAsunny123AhungerAleandroApaul12AhoodAjadakissAnunzioAharvey1AcrowesAtoyotAjames23AdixiedogApoppinAkatiApaulchenAscarecroArfvtgbAskunkyAmilwaukeAstefaAlucydogAfixitAlegloverAdodger1AconchaAnacionaAmaria6AthereseAbentley1As1107dBaints1BmellAcabbieApaymentAwetoneAtigger69AhappyboyAmarciArammerAhoops1AmisskittAxrayAtheone1AporschAaalborgA1danielArelisysAmarisoBisha1ArfhfufylfAplastic1ArfnhbyAkamaAsteelyBoulmanAcanes1AtillyAdigger1AbladerunAkeeblerAginuwineAcontrastBrack1AzigazagaAiceman69AsanjeevAintrigueAteetimeAgitlerAsergeevAbraveAradishApaolAfarmallAdbrekzAjkmufAqqqqqqq1AdilshodAgaetaAjmoneyAefbcapa201ArobbiAintheassAytcnjhAmikeysAvova123A1dawgB14411B59874B71819B97000A225522B32629B52627A300000B26598A654987B67788A774411A852123D741A5550123A7550055A9788960A19391945A54132442A456123789D789123A1112131415A3141592654AdeckAjames11Amichael0AeljefeAsqueakerAmagdaAagendaAjohnsAgobillsAkeinesApersiaAhoopAjennyffBoschiAmedlockAelektroA00133AsaltyAhumbertoApicasso1AnetzwerkAranger2AwiredAart123AsourisAheymanAddddddd1A2002tiiAdeliverAthunder2A1gingerAproctorAcharlie6AtragicAflickaApervAgoldeAevidenceApodariaAajemAqwertyytrewqA2hotAbadgirlsAnewyorAsmoothyBtrombAputzAloveboatAgonzaloAonemanAricflairAxeroxAsnapAmilliAsilvioAlucifer1AfileAnadinAtweekerAmonty123AdirtyboyAoutlawzAnick12A043aaaA56qhxsAqcfmtzAugejvpAd6wnroApunkieAenglanAsuper8A1thomasAsempriniBr20detAassistA4meonlyAambulancAwotanAgalaxy1Ahanna1AcalvertAmuttonAfarmersAmark12Axakep1234AcattAdieseAadlerAmybitchBerkinAdogfightA1dickAhowdy1Asammy12A2wsx1qazAfucker69AcorranA1orangeAwolferAjimenezAxwingAqwerty5AvatechAmariasAsubwooferBeagramsAlbvekzArudiAjeroenAwulfgarAtheronAremarkAstepheAarachnidAvanilleAhotdamnA.adgjmApledgeAikarusAjiggleApocketsAcasey123AarmadillAdiaboloAhorstA3ki42xA4zqaufAonewayAq9umozA3mpz4rAyy5rbfscAlllll1AnochanceAw123456ApapercliAfhntvbqAskyeAdehpyeAzsmj2vAdavid69AredondoA2n6wvqAbeelchAp3wqawAschweinAlove4uAbuzzersAdolittleA4moneyAsn00pyA2good4uAmihaelaA1972chevAcranberrAsesamAdutchyA121212aAberylAcareyAphuongAtrickleAnomercyAgossipAsusiBcrewedAjudeAhappymeAmelnikAuwrl7cA4wwvteAargentoAhisashiAgsxr1100AconcertoAbubbleguAgreen5AmellieAernstAforest11AandradeAtommy123AflorinAalmostAmakitaAgiant1AdiazAmodeApassssAjamesbond007BobberAdefamerA6chid8Aptfe3xxpAroofingAairheadApervert1AmainmanAbassesAadgjmptAwaldorfAelmoreAcornbreaA123123123aAa987654321AglobeAbeasleyAdont4getAkingsxAgolf69AthermalAmerkurAduncan1AbooneAmehmetAhelloworldAcolin1BhristosAfruitsAgiorgiaAclarityBheeriosAqwedcxzasAtgbyhnAacerviewAgettyAbatterseAsnowingAclticicAmof6681AchrystalArereczAcoupeAjaclynAsaxonAkoufaxAa55555AgoodtogoAletmein7AbaysideAtoranaAdonnasAhumpAponceAferdinanAbigbabyAhoneypotAmilkboneAooooo1AumbertoAasd123456AchairsBabowaboAwrinkle5AstrekozaAkfylsiAcaballerAnannyAkaffeeAsleuthAvasilekAjacqueliAsmallvilAanna1987CdreevaArfnfcnhjafAokidokiAtanstaafAedelweisAfreedom3AbirminghamAtelnetAabfkrfAsuperduperA098123AcrossingAfindoutApasserAvfkmdbyfAsadistAgusterAmatrix2Agold123A123a123AvfvfgfgfzAlovepornAownedAlarry33AfcportoAmocha1AsamprasAhimeraA123123qweqweAjuliannaAdabossAcamera1Adoris1AsavemeAhinataAeasierAmailtoApolecatAthatsitAmagneticAkaragandaAatrainAelanorAnaruto123AbrahmsAsantoshAdeathstaAkroshkaA9638vAbutteAeintrachAhealthyAmaleAvfhcbrApedigreeAquake1AjacquelineAtatankaAnote1234Abigal1AcampionAsergey1AfreerideAalex777A123456789bAasq321AcdznjckfdApornsiteAgfccdjhlAhikaruAgeraldineAyear2000AandymanAtoonpornApallasAukflbfnjhArusalkaAjameson1AfarhadBlairAluebriAkoffieBinseyBarupsArfhfcmAguitaAkristjanAcumminAhelicoptAshiverAeugeniaAalex32AwhitepowerAdisturbeAmercurAawakenAdrakulaAanonymouAgalaAkrytenAmierdA4815162342lostAkamiAtoodlesArfvbrflptAsasha1996AledzeppelinArkfdbfnehfAhitechBakkinenAgblfhfcsA1q2a3zAprincipeAalien1Avirgo1Alove4everAfalcons1AharrieApokemon12AelephanArhfcysqAstrokesAarchesAplato1AfgntrfAantonellAmarusiaAxxxmanAdfcbkmtdAscarface1Akobe24AmodanoAangel777BtkinsAupgradeAruffrydeAuzumakiAstar11Arfn.irfAburgundyAgfdkjdfAringo1AdannieAangussAghjcnj123AimhotepAgjyxbrAsnailAruslanaAbrooke1Achosen1AredhouseAangel22AfuckmehaAq12345678AveritechAkaosAbarbariaAedwinaApongoAstudio54AzxcvbnmmBemfiraAorion2BlorinA123456eAbrett1AmineralAatlantidaAlucky3AmamukaAberserkerAantohaAlastochkaArecon1AshootmeAhobbes1Abh90210AfujiAmosdefAflushAsurfing1Amemphis1ArajaA335533aaAverminAruffAprofessoA999111999qAkfgekzAaspen1AgoshenAstarlingAawsomeAf3gh65Ashadows1AloveyoA4z34l0tsAtranmereAgiulianoAbarnetAnewellAhornsAsugarbeaAgonzagaBallopApassmasterAcaviarAschneideAilovehimAchaucerAkumquatAmantaAgipperAbannedAfabriceAmacduffAstacey1BkipjackBharkeyAbarkingAhorseshoAnokia8800AdaimlerAcoolestAesotericAtest01Aleslie1AvitaliAotherAjuly23AunlimitedAbigbassAmajereAloveu2Amisty123AtreetopsAiwannaAcoronetApynchonAherzogAkillallApoplarAcuisineAswimmer1AkickmeAshimmyAgiggs11Acandy123AmarylouAcomicAvolitionAchinamanAbennetDjieAking1ArottieAleipzigAjeanlucAfishfoodAenzoAmarmotAapril12AjuicerAsavingBurroundAlittleonAstickerAbedpanAlimaAjuice1A1z2z3zAmaritimeAhyacinthAflatlineBordhamAmorphineAthornAsaitekAlancersAplumperAjericho1Aslash1AjointAchrispAbrookieAcolderAguatemalaAmalteseAtwisted1AwitchesAgrouchAcoverAmonkey13AtuscanAsummer05AwillingAdrexelAcannotAmadziaAblueyesAhotdog1Aamber123AhurtmeAp12345Abob1Ajack1234AphideltAmcnabbAdarrinAhotspotAdogstarAnailerAshlongAfastlaneAgobbleAohiostateAjester1AdiskAkoolioAharvickAglock21AeggsAmontegoAstudmuffAblazedApeekerBrotegeAripcurlAnegrasAcount0AsuperdogAranger21AblackbeaAtakeshiAbishop1AsigmanuAdjdxbrAsluts1AgrassoAdiscipleAkennedy1AcichlidAkingmeAhosemanAmarch1AcarouselAdesadeAtimersAgreedAkatiesAsickanAlastingAjugsAsmith123AcopycatAmapleleaAdragon21A123456789qqqArealtimeAinferno1AsanibelAdarkwolfAgodsloveAkarpovAtravestiAzaragozaAtaffy1AboardsAkimmy1AjazzboAsiempreAweightAcdjkjxmA090909tAmmmmm1AnessAcharlie7AbrendonAdumperAckjybrAjimmybAmelkorAnikoleAsenha123AallaloneAtotemAbollockAlolitasAjuice2Atower1AsunghileBimbasAlhepmzAnick123AseldomBurreyBhadowfaAmadballAcrocodileAliveruneAsuka123AhamradioAvandamAiddqdidkfaAsexyfeetAyhntgbAsandeeAgeoffAnatachaAgeordieAmartin12AbulgariaAjohnsoAp00kieAbitch123AcjcbcrfAfrankoAballgameAdastanAwrest666BildroidAcbhbecAqazxsA12345678zFasCqw34AcdtnrfAdontAfabiAevgeshaBrhfbyfAnylonA123456789tAqq123456789AkristinkaAilyaA78n3s5afAleraA4rkpktA199A3005D9A85245A95175A153426C9487D963B87211B97500C8000A258025A669966A775533B89520A889988A900000A1020304B233214D45689B5987532A42042042B9527843A62717315A123459876A555666777A0000001Anokian95AgnatsumA00096462AredriderAcomputadorAbullrideBigtymerAzoloftAmakeloveAbillingsAnalaAg9zns4Aozlq6qwmAdunnAall4youApookerAthemasterAcabinApitstopAbruinAhobiecatAnovartisAautobotAhardhatAshelly1AangolaBmatuersAchelsieAbbbbbbb1Ajjjjjjj1AgerasimAmoleAbarkley1A123wwwAcarolcoxAshadow99AtopmanAantivirusBbcde123AskullyAunholyAmangerA123fuckAjolieAblessAgwju3gApzaiu8AgourmetAroyal1AshootersAbuttons1AredeemedAhughA368ejhihA57np39At4nvp7ApieterA1spiderAvkaxcsAseventeeA808stateAtrialsArockysAhuttonAfatjoeAnamelessAguinnesAsyntaxA87t5hdfAboederA.ktxrfAbobbijoAkatoAjeannaA1andrewA2bad4uAjazzerAmasterloAtrustnooApanochaA1bigdickAsavage1AcarineCsimirAzambiaAasasaAsmedleyAredroverAbovineAfuelAsufferAgraveAmaggie11AliftingAangel01Acookie12AspicerAmechApacific1AtopekaAshellieAjochenAlegend1Adolphin2AanelkaAelfquestAharveBerpesAbrookingAinfinitAnnagqxAsalutBocketAemyeuanhAjurgenAzlzfrhAschorschAbrianbAslowrideA3qvqodAhpk2qcAiqzzt580Anjqcw4Apn5jvwAwhymeBreckerAcingularAhawaii1Ayvtte545AelysiumAfdm7edAcantrellAhostileAikilz083ActhuluAwpf8euAcicciAlilredAgallagheAreadmeAbridget1BodyshopBabalooAzxcv12AnofxAdraganAaloysiusAberserkeAcohenA554uzpadAvcradqAlegsexAhzze929bAuyxnydAkidderAwinter01AjamieleeAgrimesAturingAcobrajetAhorneAbabbleAgravyAfrannieAzaskarAjesusisAphotomanAgrangeAintj3aAkissssAfairfaxAtrs8f7Aissue43Aepvjb6Aornw6dAtanmanAvasilevaAsylvia1Beven1AdimeAforgotteAdaurenAartworkAsanity729Btewar1Alotus7ApinnerAoldsmobiAwc18c2AjodiAwojtekAbirdiesArockbottAbashfulAmaheshAlovegirlAsuper2AalicanteAjuicy1AtrippingAflavioAjockerAchopAmongoliaAomega7AbustanutAdrakkarApainlessAvivienAfairmontAharley12A1qwertyuAdunamisAcupidAagonyAextreme1A811pahcAreadAshaverApittsburghAred456AduckerAvespaAkineticAjoker123AconceptsApatrick7AtheodorAitaly1AcocolocoAspazBhirinAhockey99AmartinsAlawlessAzebulonAwild1AhaseAcaneAgardinerAsadnessBlutwifeAeieioA12345678912AtimebombAcasandraAkazbekAalbundyAfeb2000Azenit2011AfeliksAjosefinaAarthuAdank420Ahax0redAplanet1AmuggsyAcbcmrbAbadcatAsergeevnaArjcntyrjAgnomesAcubaseAabcdef123AwestlakeAbearshareAsashimiAwhatnotAbrandon2AkaufmanAsword1AaffairBquinasBhmadAdanutaAcadaverArjnjgtcAasdfghjkl123ApendragonAsexseAwatchmenApizza123AkudosAmateoAquercusArossi46AvampiroAskater1AthewayAlimabeanAallah1ApeacesA1234qwerasdfAadam123AshirakAmafaldaAbigtenAaddamsAfuckyou7AmattiaAcologneAericksonAchessmanAsavatageAquake2AsidorovAtradeAalex2000AnortelAannalisaBsd12AfightonAsheppardAvittoriaAelliAaeroAlisa123Apass1wordAhopkigAmanchesteAblue56AviceroyAzx123456AdiditAjg3h4hfnAbigpimpinAnabeelAtinytimAaggie1AcalaveraAhunter11AcrushedAtheboyAbehindAhazelnutAgaelleBeekArashadAsalavatAasdfgh123Blaska1Aqwer12345AairedaleAprimetimeAairlineA123qwe456rtyAsetterArossiAproteinAcurveCckoldAtrivialAcierraAtoninoAbecksA1234567890qwAolamideAvlad7788AalinochkaAmonkey10Aaq1sw2BtkinsonAwengerAalfieAgoodheadAelizabeth1AsurfersAamiga1Amonkey99AsuerteArustemAironponyA88keysAgogetitAtony123Avaz2109Ajack11ArjntyjxtrAghtpbltynAawardsAbuenoAauroreAsturgeonAcvtifhbrbAvalentiAprimaveraAstephieAnfbcbzAwantsomeAbirdsAanjingAfynjifAsonic2Abullet1A11111zAsleazeAlangerAmuffieAnokia7610AtombstonAbadkittyAg12345Aasdfghjkl1Acable1AalskdjfhgAbluessAsolnzeA00007ApoonamAteens1AmilenAkokakolaAgirlssAibragimAbecca1AcountyliAdjljktqA1234567dAgsxr11AbadmintonAnervousAkalinkaAvjybnjhAlupitaAghjcnjrdfibyjAlolloneAgojiraAblowme69AsemenovAdfktyjrAsmitty1AzinedineAlightsabAmagisterAqapmocAcakesAlenovoAphenomAdragon5AfedorovaAmom4u4mmAhjlbyfAparabolaAmechtaAdanil8098AlookieAorange77AmcdonaldsAcoorsligCbblersAredriverAtriforceAregularAhecnfvAdoggie1AgilbertoBuillaumeBalactusAreshmaAguineaAsevilia1Apebbles1AnfyufhAyouwishAr3ady41tAbaileeAaustiAcutegirlAtaipeiAblackholAgreen11AolddogAdavrosAoliveoilAsixnineAchironAfrediAshelley1Aomega123ArepmvfAbentAheroinAdogbreatAheythereApikachu1AlovebirdAsorrentoAmaggie2AcurtainAunderparAtiger69AsantacruzAottomanAbaxter1AcarvinAmcbrideAdoggystyAhintonAcondoAsimsonAtechieAgoterpsBrendel1Ajeff24Anitro1A1supermaAhorny2AwelldoneAglobal1AcoonassAgradyAfeynmanApupuceAgodisgoodAbr00klynAdunce1AgbpackerAsexmeupAbucky1AskeetAbrokeApayrollAconnor1Cmpaq12AsendingBhaggy1AbriandAcrm114AdynastarAlyleAetowerAsuntanBammy2Avision1AchrissieAmudderAchris22Bab4ma99AkitteBlimenkoAhotmomAmegabyteAstrummerAnascar88Abears85AghostdogAqueenbeeAm6cjy69u35AfroggiesAlonsdaleAsmilingAthor5200AhurricanesAsnipeAgoodfellasA123456xAkingerAtalonsApussypussyBelucheAcherubArusty123BailwayAgrommitAdiciembrAapril10AmoodyBachine1AsonaliAbaseba11Amikey123AhardtimeAlittleeAmethodmanAtabbyAponiesAcomcast1A1pass1pageAstymieAmckinneyAshitbirdAheaveAsharkmanAanusAouchAtommytAjoker69Asummer20AnashvilleAjohanna1AtomatoesAgibbyAyasminaApennysAgoddess1Asquid1AbombaAslut1Azombie1AwinkieAdevlinAonly4meAcccpAstarletBweepAbrodyAaeiouAleviathaAghbdtnbr1AmisatoAjoshua2AbluecatAdongleAgretschAdrakenAlifesuckAkerriB12345AsadeAdiego1Asanta1AjordansAmoveonAbomber1AstompAridleyAoffsprinAultra1A1qa2ws3eAnbvjirfAblue25AlessAocean11AbrendAleptonAproviderAhungaryAmarekAgocanesAfaustoAgetlaidA3syqo15hilAleonard1AbrethartAchriscAlongwoodAshavenBleepersAyamamotoAasterix1ArecentAdamiaBiosesamoAcrackheaAsundropAmexicanoBoogleAnosajAkaizenAfullsailApallinoAazathothAdanthemanAkariyaAintranetAmasyanyaAemanueleAbigdealAsaveAwebster1A1qazwsxAsenseBoapAjavamanAtinkerbelAbuttmuncAgabriel2Adima12AsilkyAkamehamehaAselloutAessexAbysunsuAhuskies1A12345taAjesuitAstratocaAd1i2m3a4AmaverikAlebedevaAnjnetsAmanishaAvjhjpjdfAgjkbyjxrfAzxcvbnm12AkuleshovAfreelancAmagazinAexternalAkamranArfhfntkmBizwanAmunkeyAhimmelAybrjkftdbxAhawkmoonAmironovaAbudgeAgavrikAmixailAasfnhg66AvitalyaAmcardleAfhntv1998A8008A75395B8678A123580B47123B61718B81920A430799B44222A555999C7711A616913B66111A4071505A12346789C481632B9922991B59753258B122112211B357997531AmrbrownAdrahcirAtabbycatAzxcvbn12A11qq22wwBsexyredAgeorge01AbladerBoomeAplaygirlAbosleyAevadAha8fypAslick50BkydogAhhhhhh1AconsulAsunrayAmyxworld4Aandi03AhobbyAbrujahAjustinaA1testAbirthday54A0raziel0Amaine1ClenaAclubpenguinAeveningAbubaBobbydAmichael4AgoddogApokeAautopassAdeviantAmaster3AsarahbAdakotAsherbertAnogoodApookiBromoteA11c645dfAduke3dBizzy1Apretty1AcelestBheerioAopieAqwepoiAasdlkjAkatjaAmaseAstudboyAdataloreAvvvvv1AbellesAhersonAshayBtudentsAwomensAobscureAasdfg12Anick1234Aeagle123A123redAsonnenAbowersAtimber1Alonely1AareyukescClingtonAgenevieveAwatch1A14vbqk9pAab123456BdamantAjamesrA4wcqjnA6bjvpeA863abgsgAqn632oAactorsAwiltonAbigbAturbo2AbracesApsswrdBaganiniAeliasAcorvett1AmarcioCster69AosakaAmortarAtherocAbambaAesmeraldApolloA1grandAlamaA1loversAsalaamA2bigtitsAargentumAradagastAbigloadAnohack04AquickieAscatmanApattieAstampAfinestAcn42qjAbatboyCbsAextasyAcurtAswankBadlerAplokijuhAalanaAfrontAvegaAta8g4wAbeatitBackhoeAx35v8lAhamster1AilovejenAcmfnpuAmwq6qlzoBasahiroAhubbleA201jedlzAndeyl5AmortAqwertyuiop123AgeryfeAlzbs2twzArxmtkpAzxcvbn123AspammyAfacesitAwhippedAdrake1Agangsta1Aacls2hAbuckwheatBob1234AyeehawAgriffyAcrapolaA2kgwaiAsimhrqArolex1AsabinAfettAgerry1Affvdj474Amonster2Ar29hqqAinternationalAdukedogArichmanAmac123A551scasiAarcturusAomega5Alacey1AtransformerAgolfer23AfootlongAazaleaAscrewbalAindependAsliceAcelinAoutdoorsAclark1Apain4meBrimetime21A2b8riedtAssptx452Awanker1AbarbiAsunnyboyAtmjxn151Ayqlgr667AhalfAbeulahAthunder5AdoyleA13579aAraygunAblueredBreeAmumblesAatreyuAstageAmichae1BjordanAfabolousAspring1AmichaeldAaldricAstick1AtrekkieAgambinoAfilibertAauntieApussylicAjq24ncBardinAschalkAretlawAqcactwAdflbvrfAmatt11AwardogAsasha2AcntgfirfAheathrowAdigestAkissarmyA3mta3AchumleyAhappyoneAdevin1Amichael5Abatman01BowdenAmmouseAbenediktAhunter123AklausiAromantikAmanny1AchazzAlazerAwoodruffAboeing74AmillardA1scooterAcronosAmike77Agrand1AflightsBourthAhiphop1ApaloaltoAschnappsAdavidkApeterjAelementaAteodorAquicklyAkafkaAlotteAzetaAdcunitedAcubbieAwangerAbabes1Ahorses1A.ktymrfAmeccaAsubmissiAmoutonBarcopoloAsupersexAazimutAgotoAcharlie4AkolyaArafikiA1austinAfuckhardAlimpbizkAcrownvicApoppaAluisitoAdavidoAbiggirlsAsmudgerAtbirdsAj12345AodenseAalan12BquaAcanibusBheese12Akelly2AglitchAaaron123AhackmeAarchanaAmatherAaminaAibillAjonnieAgetsmartAmasonsAurchinApostitAzonkerApass11Amoney4meAwarchildAbmw540AamadeoAilariaAshadowmaBtalingradAkoetsu13AburnsideAmamabearAbeirutAconnectiBfvehfqAsamapiAguyanaAviscountAstokeAcharmainAbeaufortApericlesAdolomiteAgeneraAservusAaltoidAvanceAbangladeshAjodieAandrzejAjames7Amonkey77Baster22Aviper2AatriumAbalefireBowling1AsumerkiArevivalAdesperadosAmatahariAybhdfyfAmamanAadmiral1Agerrity1AnetwareAsupport1AchallengerAsonia1AmaritzaAstripclubApatrycjaAcanberraAtissotAsagitariAdjhjyfAsplungeAtriumph1AinvasionAsex1234Achubby1BojonesAflushingAariel1AgfhjkmmBolakersA237081aAevgeniaAzx123456789AhellothereAinessaAsoonBaun24865709AkbcbxrfAinsurancAmercury7Ajojo12AstrutterAaguilarAhopkins1Ax123456Alove777AsalmaAnovembeAiluvpornAvalterAsnakeeyeAhapkidoApupperAlabattsAfiction7Abruins1AnoshitAsayanaAthirstyAsheffieldAbvgthfnjhAtennis12AboozeApoop12AapokalipsisA111222333aAcumshotsAanneliesBventuraAbergAhootAsubrosaAwildthinA666666qAlifesucksAphantom2BalomAshakirAcfvfhfBthuttdbxAalexsandrAcnhjbntkmAsasha2010AmuhtarAlbhtrnjhArihannaAmaldivesB1234567Afallout2BridaAhaddockBbxfhlAperfumeAvasquezAmahalkitBodestoAjericoAkalaniAcrittersAspider12Basha1995AbackerAgjhjctyjrAminimalAtalleyAhotboysAlindaaA1silverAkillieAmorris1AvfrfhjdfAserafimBherifAcnhtrjpfAmartina1AkarstenAcvetokAmoremoneAsexnowApoopiesAswetlanaAmagicaBom123AgoodwoodAsdsadee23BoleiA1pioneeAmarmeladCynard1AqazxcvbnAsecret123AnikushaAyfcnz123AantiAcalaisAmadison2CstercaAq1w2e3r4t5y6u7Aavatar1Acomet1AkirstinAandrey123AthamesAdallaBeadwoodAwolandAcorrinaAangel11AblasenAmynewpasAcambriaArealmAmaiden1AvsevolodApankajCrrishAtaltosAwildwestAteasemeAantoshaA4z3al0tsAtekilaAshygirl1BalamAwildstarAhomer2AarseniyAraspberrAashlandAsteamboaAbmw330BuzzyAchicosAphatassAtecateAmetrosAshelliAarschAsandmannApeartreeAsnapper1AidontcareAfridaysAkilliansAdiceAscampiAdrumsetAgaggerApappasAbalzacAdupont24Akimber45AhellerAletmein0Abangkok1AparrisAglock22AbearmanAgorilla1Aromeo123AclariceAeagle5AliberteAjason2Aenigma1AtubitzenAnewfieAdellaAeconomicAcasey2AvilleAlilkimAgilgamesAakira1AnitwitApoleA123456789fAdeerhunterAtrippyAbrassBataviaDman2Asoccer9Aemerald1AnicolaiAbrittanBattlefieldAmike22ApulseArenardAwladimirAdibbleAelvinAnnnnn1AorbitAambushAspawn2BhitholeAhello5Astrat1AplentyAmittens1AdatalifeAcopelandAboodogA708090aAdomino1Asummer2AkendalAlockeAkruegerApudgeAeagle3AlochnessAsargonAchimpyBarlos2AsnoozeAexposureAcrotchAhardcorBermosaAshotsAmontessAlongoneAelenkaBverythingAlaundryAjeannineAlondon22AnemesiAspeedracBabbatAcripplerAlisetteAsarge1A777angelAmaxwelBitziAbitch69Asony123AgetitonAmastiffAculverAdeveloperAfilipinoAgordieAslurpeeAhurdleAfoxgloveAmichaelcAsugarrayApenissAnothinAspacerAvbrjkfApipperAshanksAgearAmolemanBilaBustang4AfatdogAnecronAmaddie1AchomperAsnookyAclambakeAsharp1AchochozArodolfoAcubfanAfamilyguyAsales1AmanpowerAboyscoutAscipioAeagles05Abinky1AphobosAbistroAloser123Akenny123AevolveAluvbugAalohomoraAbeardAspadeAhollerAkimcheeApoundAlabratAsheffielAtarget1AchocoApurple12Adiablo66AbumblebeeAundiesAsummer11Alondon99AkarensAseawaysAfish1234AundergroAxzsawq21AsellersAkemperAshell1AmalibogAfoxxAlikeAvovchikAnatusikAcortesAhadleyAfucker11AroaddoggAbuckfastAcooleyAjello1AinspectoAtorreAjackdaniA1hammerApatrick8BittsburAmicro1Ajamie123AboscoeAhellraisAsharpsAownsuA23dp4xAkilla1AtorranceAsynapseAcardiacAleavingAcaterhamA1234qwertAmasterchAspinAcirqueAwattsAhalleyApopoloAmixerAbujhtrAcuddles1AownzyouAvolvosAcrazy123AmoreheadAgriffin1AromanromanAvalerkaAd1lakissAedward12Asoccer3Athomas123AownzAzaq12wsAhellspawnAyanochkaAdantistBoc123AwigginsA098890AmamulyaAhomelandAprogrammerAshutdownAdima1997AnakamuraA4506802aAqqqwwweeeAholden1AlovestoryBenusikAqqq123AdicanioAloveuAfastfoodAmimi92139Aghost123AshaniBandalAleannaAjimmydAmrcleanAhendrikAr123456ApierrBernilleA0137485Akodaira52Blingon1AeisteeArebrovAvfrcbrAirontreeAolyaArameshA989244342aA5005A123963B98500A247365A313233B31234A543216A996699A1010101B123456B234565F76B598741A2741001A12345600A52678677B5667788A77777778A123456781A0003AdoromichApornomanAgogirlBracelanApoopfaceA1wildcatBcomputeAchris11CazA10inchAletmein9A686xqxfgA04975756AdockerApilot123AfolsomA090808qweAbloomAnastjaAartisticAdanijelaApajaroAwilfredAklepAreccosAservalAfire777Ababe23AcumnowAsunfishAi81u812AworkitBarrantBhippetAbaumApunkyAwithloveAstarfuckAnederlandAxholesAceceliaAburton1AdementedA1zzzzzAbrando1A1aaaaaaaApotteryAdiggityA11bravoAhackmanAalpine1AluojianhuaAemailAcommentsAsmasherAjanetteA495rus19Ajack22Acaveman1Awer123A123xxxAgriffinsAlarrybAwigglyAholyAkugm7bAgibletAnpyxr5Aetvww4ByphedApktmxrAvdlxucAxjznq5Anumber7AbentlyAsnipesAarkhamAkarma1AemilianoAmajestyAkieferAredbarchApravdaAoperatioA123456zxAvitesseAnokia6120AmarkosAschifferAviktoriyAadeleAgolfinAsweet69BiameseAeternal1Adave12CrrianAaccesAdrakesAmonkerBission1A1eagleAmaddy1AbootcampAuser1AgestapoAshiloAgertrudAcsfbr5yyAewyuzaAtoosexyAroystonApinggolfAjamescAmifuneAtwiceAlucky5AhandbookAjumpinAbingbongAvanmanAaccidentAgandalAywvxpzAmick7278A9skw5gAvpmfszAyxkck878AqhxbijAxirt2kA565hlgqoAnorth1Abr5499AextacyBgyptAgimletAabyssAdemeterA4_lifeA8womysAms6nudAfx3tuoAluv2fuckAarsenal2AponderBuschelA7kbe9dAnt5d27AchbjunAgsgba368AztmfcqAdarreArussia1AgreetingAutahApioneersAbartjekApoppiesBussy7AaronBbsurdAsiebenAannette1AmccoyAtwitchAmuppetsBakoCggyAduallyAerebusAsatan66AqdarcvAtabooApatternA80070633pcAstryderAcoolkidAsucker1Aalfred1AgetnakedAfelliniAparallaxAvballAorionsAkayak1AdavidkinAstabiloAtibetA4allAbozemanAsatsumaAallthatAwileyAingram01Aklem1AcardenasAplazmaAspjfetAtheredAfreyaAsamsAwhitedogAemotionAaudio1AtorbenAportosAmowermanAlacyAgowestAfylhjvtlfAcabibbleAsauberAl8v53xApapiAmidnighAfriedmanAnantesAfred69AnemisisAminouAciscokidAmakeksa11AkwanArimjobAcamarAnightmanAivannaAmedfordBultiAschumacherAragtopAtryingApolarbearAwhackoAfillerAscotsmanApepitaAbigdaddAnighthawkAdarterAhogsAcrookedAjohnny69AbancroftAoctopussAnesterAbonou2AprenticeAstiffApillarAgrandadAa123Bllstar1CesisAfleetwooAalmazBa12345BngeliquAchiltonAskankA55555qApoi123AweldonAhacker1AdelrioAbarelyAscarlet1AurbanAnewpointAptybnxtvgbjyAagencyBleksAbelialAnight1AalbatrossAstar99AbriannAabc123abcAqsefthAblackburBonitBahrainAalegriaAsuzuki1AkannanAlobitoAthisisAmcmahonAgfif1991ApiggysBalestineAlingerAmellissaAjujitsuAlambadaAkayakingAalex1996BnnushkaAmighty1AresponseAloveableAmariannBulder1AfreiburgAkindbudsAcroucherA123as123Ajack01AqweasAsnooperAgladstonAxpressAlickherAblenheimAexcalibeAzidane10AtasmaniaAloopyAgemma1AmalaikaAtycobbAshearer9AchrissiArusslandAbiblesAroxetteAbiteme2Aeae21157Ascore1Achase123BompoundAmoroniAniteAtemporalA123zxc123AtassieAquicksilAbingo123AelefanteAhotArocky6Aadriana1AteamoAaa123321AporthosAhealingAvertexAforbiddeAtimofeyAfumanchuAlevinApsalm23AdanvilleAevgenyAsamsung123AasshatA123654aAtimofeiAsylvanAblue66ArfnfgekmnfAcarolyn1ApaperoBoiu1234AnfvthkfyAwwfwcwAalbacoreAraintreeAdemigodAnotoriouAanywayA12345lAisobelAyfgjktjyAlawtonApthrfkjAfyabcfAjuggernautArashmiAaliyahAphilly1AwiseAaristotleAghjgecrBulmiraAmillersAdallas12AzaqqazA12345qqAmillenniAhoppyAcowboAdexteAbassman1Ashirley1AcinziaAalberto1AbarneAredhookAlarinsoAchileAjune22Apassword13AkamasutrA123a321AkaramelAgeorgiyAangelo4ekAzaqwsx123Aalex1990AmydreamAundercoverA1236987zAantiquesAptktysqAalternativeAlaviniaAcandelaAdenialAcleavageAhighwindAwishmasterAalisa1AviktoriAnightwolfAhikariAlovespornAponchikArascal1AmercurioAgarcia1AlasombraAjaredletoAlombardiAputangAdamascusApridurokAmaggiemaAinvalidpAmadeleineApolniypizdec110211Aone4allAsasha12AkaulitzAqwaszAlogisticAbeehiveArosemariAcaliforniAkendrickAcelestinAavalon1A12345nAallanonAgattoAboostBreakfasAdfkmrbhbzAalreadyAqpwoeiAholdingAbmw520Aamsterdam1ApeglegAalvaradoAwinniAlamentAkondorAsummer10ApatchyAthankgodA1girlsAcollarAmedellinAducks1AfilipeA123456789qwAarchibaldAroarAasbestosAdrunk1AjanellAcorsetAsilver7Aabcd12AlalalAepisode1AbuttloveA1qa2ws3ed4rfAstupiAjetbalanceAguzmanAloopholeAmoisesAblackaddAiamtheoneAbonoboApenniesAinformatAmidnight1Aqwertyuiop1AhustonAazbukaAcarrera4AsnuffAdtlmvfAjesus12AzackaryA1chickenAstraussAgauntletAsineadArawiswarAstrongerAivan123AbannanaApotomacAaprilsArusrapAgovernorAharris1ButchinsArfghbpApop123BaradoxxAbuttfaceAlietuvaAfriend1AdineshAfenerbahceAkenyattaAhornyoneAspankedAhaterAmaniakAteresitaAlove2011AvernAskavenAcaspianAalizeeAbagelDgins1BradlyAranchoAmoucheApetroAichbinsAexitAgertieAamandineAhensonAseventhAferretsAasconaAshortieBlippersAfockerAchiggerAjames01AchillerAbiochemA0rangeAscott2AteardropAbaneAkraussAforteAbassboatAwatchesCnkersAcarpenterAvitaraAyeagerAwarrioAbrooks1Afarmer1AbeachboyCnson1AmayberryAtrusteeAsuddenBimonsayAkaterinkaAholbrookAkenderAdistrictAverycoolAprufrockA12345zxcAdjamaalAlogicAgangstAlizardsAbassmastAdominAsniderAkettleAholymolyAlaramieAzaxxonAhazzardAmcgowanAhamstersAsupergirAmiataAcraftsAm1sf1tAhamburg1Aboobies1AnairobiAmonmouthAatlastAbrady12AfoothillAkenneyAthehulkA1davidAsparky12AbobbleAtrainmanAruckusAgonolesAtardis1AcruzerAhornieAbabycatAoakland1Ame1234AretardedAbillydAchunkBanoeAjeff1AdirtydAjiminyAsandlerBingAfatcat1AserpicoAfreudAharriAplayazAgadzooksApornograAdragnetAmargeAbeertjeAsolsticeAz123456789Aassword1AnewpasswordAconsoleAgasolineAcatwalkAtigrenokAmicahApoppenAsexdogBpruceBacramenAcorrineAbonkAlisbonAdiscgolfAflynnAkmg365AmariachiAtinhorseArfkmrekznjhApiecesAmannieAguzziAbigfunAkissassBhorneAsaab93A1accessAbradpittAmonkey22AtimepassAbigdogsAzxc321AcommunityAgreenwoodAshanerAbaronsAkeeper1AhighballAradmanAbigdanAmandelaBybuddyAtraciAladyluckAragdollApoundsAtopfliteAbighurtAlongcutAasshole2AprettyboAmitsubisAsuaveBnoopsBlitherAoscar2AyoursAwiggumAfavreCrtfaceAproustAwasteAbiminiAcocoricoAmozart1AprolineAv12345Abrownie1A1qwerty1B234567tAspooksAmyshitAgenerationAparkwayAbogus1AgirlzAblueduckApussyyAmatt123Aannie2Adragon0AestelaAnokiasAmelchiorAonfireAgrindAelfstoneAnumber5AeverythiAcopsAtouchdownAredtailAevetsBchoesAtiffaniBechnoloAbullittAmine12Apimpin1AstanlyAozzmanApaul1234AchiapetAdfkthbqAtissueAleopoldoAjaybeeApuertoricoAliteonAtrajanAnogginAmtndewAcarmellaAmymusicAjustynaBournalAwelcome12Asc00byBlowlyAfrictionAcollierCondogAalamedaAherreraAbrushAspeaker1AloislaneAproperAnewman1Avicky1AringsAburundukDnettAgmctruckA1qaz2wAazwebitaliaAjulianneAmirelaAsprewellCacesAfrancaisAloqseAmullenAstonewallAjonny5AprofesorAsuperman2AroguesAkimberlAchoppyAminstrelAturbineAdbrnjhjdyfApimmelAhotwaterAdefcon1AcallanAjaime1Aduke1Afishy1AitdxtyrjAfernandesAjazzieAtatungAfraudAverygoodbotAdragosAguido1AvfhecmrfApickle1ArfhfvtkmAblue2Arock123AuniteAgosiaAtraviAscruffAruger1AteethAindeedAscytheAdietrichAkoronaAhabitatBeadcaseA123456789zxcA9988aaAdfcbkmtdfAkoshechkaAmercureAyukiAdima12345CcksonAvitalyAmaksimusAwizarAdjkrjlfdAleightonAmooseheaAeleganceAmondoAtype40AfyfrjylfAvfkbyrfApiercedAfreitagAsambucaA1um83zArattAmesserAsnooginsAorigamiAsecondsBhroomsAranger11AvjzgjxnfAgangstarAquickenAlerochkaAkakkaAfighter1AasslickerAlayoutAmusiAshivanAfuckholeAtimonAvw198m2nAhanterApaskaAzaharovAkaskadAmark69AvfhbifAsigsauerAv123456Amaxim1935AsardorAwenef45313A3007A45454A74185A151617B99000A492529A666888A1357900A3364068A10111213B5975321B9966991D92000A24681357A31121910B4524815A96321478B8741236A159357258A741236985B94613852A00001AespanolAcarameloAmunchiesAyankA1tigerAdooberAmaximiliAgainesAswampfoxA1boomerAskimanA260zntpcAov3ajyAqguvytAbartyApsylockeAholen1A12packAgrenadaAsugarbearAjlhanesAaabbccddAneumanAblackeyeAflyer1Amarilyn1AdrummondAnocodeAcostasAsyphonAtikiAelvissAsuffolkAbigdog69AcodfishAlastoneAdarylApentium3AdionysusAcharminAford9402Atttttt1Bk421AlorrieAsilverstA1johnnyAcreavenAleveloneAalonaBnonAgoombaAscottiAtoreyAkokaneeAqazxsw1A12345678987654321Arrrrr1AdesotoAsherry1AcaeserAemeryAjimmAsuzeAashlieAqaswedAplopAjohnathanAcorvairAstrandAadolfoAgold1AsassAhevnm4AjowgnxAfwsadnAdraconisAphish420AibxnsmAwhdbtpAbonusAportsmouAmarceAsexxy1AparaArockzAveedubAwongAttttt1AkeeleyAtempgodAhawkdog79AnoraAchaneyAadolphAyourselfApepperoniAcajun1Bock1Ajoey1A427cobraAardvarkAlover2A5t6y7u8iAdavinaA1angelAstjamesAeduard1Awarrior2AhomesAboopAxxxsexAefyregAlysanderAzaq11qazAspinalAchris69ApigmanA1xxxxxAaccess20AgotitAhammeAkomatsuAsquirterBhortstoAmellisaAsleepy1AgrangerAfreestuffAzw6syjAsaab95AndaswfAwu4etdAartmanA4dwvjjAvp6y38AbobbygAwatchdogAjo9k2jw2Aoqglh565AcyzkhwArazorsAhonda2Cuse2AnurgleAfqkw5mAsseexxAarroyoApmdmsctsA640xwfkvAmsnxbiAscullAginger2AbowhunteAaffinityAtest99AsloopyAbagheeraAangel69AbeatriAjennerArincewindBodentsA19mtpgam19AkittAminetteAcubbies1AdorinaAmirjamAstuntArabbittAholasAwoodsinkAscorchAaxolotlAmoparsAcalderAp3e85trAalphonseAc123456AiamthemaAmagnaArclakiAnitsujApoetAbirthday299A4tlvedAc7lrwuAsexisfunAduranAeggbertAparol999AflotsamAasscrackAbuxtonAfleuryAmty3rhAalarmAchatoAa654321Blpha5A1234567wAgenaAnewjerseyAconrailBeltic88Adjg4bb4bAtulsaBrinity3A69dudeAcutie1Apistons1AsnookApanama1BhilleshAjamaalAduffAbeepA2112yyzAcardiganAsangerBoldiersAybrbnrfApetrAqweszxcDrty88Awookie1AendymionAhundAsearock6Ahondo1AeyespyAragsAgrantedAdigdugAtacosAaerialAcayugaAballparkAvwjettaA24pnz6kcAfarrisAsabaAlovergirAraviAsumatraAdeaddogAvoltAranmaAnikkiiAchris21Afudge1AbumpArallyAtwocatsAslk230AblackmenAhiramA1212qqAmanaAarnold1AhibeesAomegamanAdoriaAprettyboyAdasha1A54321aAbarclaysAkjkbnfAhundredAqweasd12AvvvbbbA333z333AschemeAalemaniaAredskyAmilfAdauphinAturismoAkawasakAhusker1Aoranges1Aalfa147AthreatAdraconAsteroidsA1guitarAtuczno18Aplaystation3Akiller666AscoubidouAantheaAjerusaleAtradingAnewton1AspycamsAtm371855BiberiumAcarrie1ClderonAiwantitAalessandraAflawlessA06225930AroflmaoAbakayaroAdropzoneAacademicAlefty1AnewhavenAcascadesAmithrilAtributeAquantum1AkitsuneAharleydAsonic123ArawksApimpshitAhadesAunforgivenAdelta9ArowlandAackermanAsandorAapplesauceA31217221027711Aprodigy1AirvinAalfie1AsachemAmonkey01A123456789qqAbuffy123AwisconsinAarakisBsdjklAwaddleAfireworksBucktheworldAsexybeastAanaheimAutjvtnhbzAhiawathaAjoker7Apussy3ArotterdamAmallard1AahfywbzAjoseph10AespositoApseudoAcocoonAroflcopterAanfield1AcheburashkaAali123A12345xArochdaleAmelangeAkavithaAvariableAgoldsinkArequiredAamanda11AcanceAamalgamAhshfd4n279AabercromAprostockAtechnicA343104kyAluntikAhtlbcrfAdvorakAgondorAcordlessAshammyAvjzctvmzAmimozaAaugsburgAnezabudkaAlillekeAmasterchiefCchinAfuryAbriscoAticklemeApargolfAmaloneyBonkey3AcombineAajtdmwAbaroloAsvarogAdragon00AcyjdsvujljvAmikolaAgenieAjewelryApoligonA159753159753AlunitaAextremAinnuendoAjacob6Aq111111AsaritAdelugeAmonamiAsandovalAkomarovaAnecromancerAhabsAjimmerAalex77A159753qArjktcjAmarijaBedvedevAinitialAcatsdogsAking1234Aripken8AimpossibleAcampeonAfkbyf001ArfhectkmAtatooineAghjcnbAxzibitAguadalupAbluefoxAteddysAatillaAexplicitAstraponAjason12ArockoAthunder7AimhereAeddiesArectumAber02AcaraAtheologyAbalticAemanuelaAbongo1AdeltaforceArosariAtonicAgtivr6AwoodcockAhardmanAmurder1BonalizaA1jessicaAkarmanAlambrettAiridiumAsolar1AlehighAconditionBhatonAindia1ApharohAhayastanAammoAoverlandAtinkAbearsharAvanquishAiaapptfcorAsilencerAclayton1AbebitAtitanikAisaac1Agolfvr6AvfrfrfAmasha123AasburyAgetbentAhustler1ApearAkimikoAletitiaAonlyyouAvecmrfAmrbungleAkarolineApornografiaAcubbyAhardinAfirestarterAcolole57AdreyfusAajcuivd289AbirdlandAlondon11AtaliesinAapplemacAcornetAmartyrApaschaAfarkleAmarysiaAarethaAkenshiroBinArubyredAoldspiceAdima1993Aqwe123rtyAfdfnfhAw8gkz2x1AgodzilaAasennaAcigarettAequityAsteelmanBalt55AhebrewAintegerAbigboobApavellAdjohn11AbignoseAgiggsyAbirdhouseAgunslingerAbackpackCdboy69AvarietyAspankitAbaghdadA12345bAsquadAjulietaAtimmerAcodydogAhalo123Ajordan11AbuckskinAtoenailAbruce2AgobamaAaxlroseAdeliciousAfooterAmashAbandit12AcatBowboys2Abanjo1AwordsAcarnalAfuckyou69AbuffieAgenovaAcrabAwichitaAvfhnbybAwerwolfAflash123AcivilAhellomanAsillyboyAveggieAholland1AlongviewBatterAmasonryAhound1AbastionApurzelAnisseAproceedAmotokoAfreeportAtrstno1AdarkknigAvolunteeAscubaproAtivoliAcounchacAbigpigAshadow7AmanaguaAtweety1A7777755102qAbikingAsaidAflutieApolyAfijiAharley11AmudhoneyAteatimeAdarockAtesticleAexecutivAwienerAthebeachApollAmrbeanAchicaAmadeleinAenemyAdollieAcameliaAforty2Amatthew8AbigdicAthroughBrillianAspeederAbeer1AjazzbassAcuddleAweather1Apoiu123AgojetsAraingerAcortexBrayolaAtamikaAevelinAmanderAlove77Asupra1Aplumber1AcrichtonAlapperAinvisibleAbenjamin1Adover1AcatmandoAichigoAbenhurDnyboyAschneckeAfriedricAmanicAscandalAmusiqueAcourseAneutrinoAkartalApikappAhartlandAwizzAcaleb1AspringfieldAhutchApinkpussAtribblesAliquorAoswegoAgillyAsouth1A1samanthAdictionaryA2pacAtbonesAsureshotAwooddoorAnowayoutAstaminaAlatoyaCkers34AtestitAheyjoeCnriAsuckthisAbigtittsBostoAsaltlakeAtheratAgusherAtalkerAcustomsAideasAdelasoulAfallout3AnilremAbigman1AnewtAkickass1Atheresa1Amach1AbikerboyAmoonglowAsideoutAmarcianoAnascar2Ajames69AmackayAloverrAvaljeanAhubbyAroscoe1AkatmanduAhotbodApaulina1Aryno23AlogitecAhandyAmusicsAstrumpfBcarAbmw325isAhangoverAgreendogApastelAmetro2033AtombstoneAbrucknerAltleirfAcollantsAgrouperAsivartAinlineAsmoochieAexcellentAdickiesAbenladenApitbulArobert3BealtyAphilmontAblue77AnooneAperry1AdarknightAknicks1Athegame1A1melissaAbacon1AsweatAconvictAfinishedAmodemsAducky1Aredskin1ApopimpAnokia3230AjimjamAtoucanAfroglegsAincubus1AzoinksAcobakaAyfnecbrAcrasherAusersAwinnipegClloAhello1234AmoominAprimaverAfordtruckAyzerman1AcharliebAleicesterAsetupApearceAreplaceBosemarieAkelsey1AbransonAmakeupAfrank2Abuster2AcochranAkayakerAmasherAwareA1taylorBjesusAgooglAloraAmartin2AspearAyes90125AcopterA86metsAmarquesAethelAmadeAdallas21Asex12345Anascar20AkidmanAstarryBeatonAlegendaryArowdy1AjustforfunApereiraBavel1AsolangeAvergaAherpderpAprimaxAfkg7h4f3v6AmariajosAjadaAenriquAcastelloAmistAflorida2AcottagesAred5AlostloveAdominaAroboAtumbleAparis123Ajames99Amatrix3AperformaAsupermanboyArivalAspecopsAdictionaA0okm9ijnAcrapperArhfdxtyrjAjune29BefferAsampleAjenny123AavondaleAsteelsAmaceCsturbaAsveta123ArevelationAtelekomAs456123789AtbilisiApiratAschumachAorganAdakingAgeforceAsakic19AmylovAcarefulAskorpion39AkinkosAlyndonAbakuganAmireilleAvfylfhbyrfAnoviceAtralfazAsuzukApasta1Adima2010Asummer0Agreen7AsmurfyAdownlowAmaritAdimonAfreelancerAtujheirfAsteinAqwerty321AmevefalkcakkAf123456AaaaaaasAmendelAdima1234E2000Amama12A230857zAtickerAdatniggaBmitrievAirochkaAfierceAmeteoraAgfyfcjybrAp4sswordAfvthbrfBedorAkaliAdestructAolive1Aq1w2eAwerty1AstasyaAmagomedAquicksanAigromaniaAfrancoiAnissaAspinningAvfhctkmApashkaAkim123AfnordAjimmygAtarasovaAsorokaAinkognitoAtishkaAkarinkaClaAjonsonAshock123BemenovaAhatesyouAm69fg2wAunableAtujazopiAconsenseA99941A119911B23645D777B33159B44000B59123A215487B34523B46800B72829A555551A666000A4500455A5552555A7558795A8318131A12332145C435687B4938685B5975346A38972091A40028922A51842543A123452000F5432F6780A333222111AhemanAchessmasterAamekpassA007jrApetrosAzz123456AchachAmartin7AhuffmanAableAherveBoagieAemileeA72d5tnAyippeeAchowAdragulaAairmaxAsequoiaAjarodAhallowAcelebsAamy123AtorchAnicolas1ApingaAbassingwAgerdaAdeliaAcrockerAb1afraA1iiiiiAsparticuAcountingAjeanpaulAsobeitBlothAdavidgAjeffieBustin11AfantomenA1starwarBhockeyAcrickeAfakeAbeefyAvixensA1zxcvbnmAstarssAelleAinnowAroaddogAgobblerBlueckAhappy12AmotorheaAhelloweenArebaA21crackAmaurice1AelocinAperkyAfirefly1A123456789aaAepwr49AgeemanAunderworAabarthAlocksmitAd9unglAvolvos40A7xm5rqAarwpls4uAgbhcf2AsigmundAde7mdfAjakobAalphasAeuskadiArogue2AziadmaAdemondAm1911a1AgridlockAlipinskiAdoraArainbow2Aou8124meArulesyouAfiretruckAkellA1chanceAseminolesAfastedAjessica7Aall4u2cAgodisgooAeuroAgsxrAseikoAfreddy12AcandybarAabc456AjonaAcarla10BuccioloBornholioAyyyyyyy1AwebstarAinhouseArivaldoA1phoenixAkattieAcalviAqrhmisAcheckoutAvettemanAbuick1Awaqw3pA2004rjAdelta4AptbdhwAorbitaAredmoonAguppyAdarbyAqcmfd454AtusymoAnevaehAstuccoAareaAnbvibtAgethighAkqigb7A2kash6zqAdlanodAspotterAmangasAduke11AfinchApokesmotAamoebaAlenny1ArockfishAmd2020AdaveyboyArickerApyf8ahA1baileyAsandboxBlickricApotatoeAd9ebk7AcurvesAsangriaAwp2005AlagrangeAauditorAjalal123AfifthAsometimesAatheistAcossieAnikolajAdeidreAogreArileydogAmeditateAboutitAi62gbqAtapeAcivicsAbigman2AmaplesAgirl78AfoggyAhemiAsharingAajayAcorbettAasterAlunkerAslimeApasteAhello99AconstrucAjoinBmanAeltonAluvpussyAdick12AhollisteAcxfcnmAbraindeaDvosAsquadronAbairdAnobleAgoddardAboltAshoreArolaAtawnyAmarlenaAairbagAipanemaAnaughtyboyAherschelAxakepyAsky123AphlegmAarnhemAhomewoodAyukon1AjimmycAhoggerAnobbyAbipolarAgermaniaCelongAtijgerAbob666AscholarAtexmexAadmin2AenergieAfoleyAcockringAreplicaAsteve69Bnickers1AmiloscAconvertAbittleAandrettiAonedayAcocteauAhappy7AtateAshetlandAcarlos12AballaAgoatmanAwellnessAsandokanApeedeeCndulumAyummieAchrisdAlawnboyAbobbybAkinneyBtyxbrAphisigAoldsmobileAdavexAnicklausAdfcbktrAmystereAhandelAzorrosAkimbaAsepulturBiciliaAtakaAromeosAmanyakAnowwowtgA1a2b3c4AheartlessAnetgearAmy3girlsAfktdnbyfAhooch1Ashadow1212Boccer21AnopasswoAsuarezAellocoApusserAzaraA1joshuaAhondacivAtempest1AalakazamAduffy1Amoney01Avilla1Ahej123Ateam3xAnolimit5AhacksawAverdeAbiohazarBmw323AtellmeAaugust2AborisovAspots3AgoingAbrehznevAcasper12ApilarAilovelifeAhomedepoAcaterpillarAnoiseAripoffAsk8boardAhannah01AleviathanAjanitorA1234567890qweApeternorAbailey12Apeewee1AatleticoAcubswin1AacademiaEiaAqzwxecAhardbodyAbonds25ArentonAfruitcakAmaduroAdudeloveAqwerty2010Afreaky1AecstacyBl546218AfabianaAdeion21AkappasigAflorian1AanathemaAsuperpuperAgilbert1AbirchAcasper2A8lettersAtemplateAacuariAtvxtjk7rArubensAxenocideArutlandAsasha1234AbarrysBeaver69Anikki2AdcowboysAyessssAoverdoseAcfdtkbqAkzueirfAblackmagAtuffy1AcodemanAgamma1Aroger123Ag00gleAagbdlcidAjesus3AmalawiAvitoriaAroshanAhfcgbplzqA1qasw2Arattolo58Agreen99AbatataAmerdeAdnstuffAapril17AglavineAbubble1Apassw0rd1AchristerAmike2BoosieAfootball12Admb2010Aking69Ah00tersBedimaptfcorAmateusAcalientAtomatApollitAjuehtwAkalimaAturkBwistyAricherAazertyuAgotikaApdtpljxrfAassman1A1234567rAangel5AuniformAhockey2BerkulesAjames12Asausage1AzorbaApoopersAsharinganApozitivAjaimatadiAmossimoArfcgthAfuck1234AlovehurtsAturdAwashingAeric12AjuilletArajeevAfootball2AsanandreasAlisa01AcreosoteAamistaApiligrimAdragon77AelectronicAtrujilloAdragonfireAlennieAalessandrBz123456AelenbergAcosmopolitanBasseyAenamoradAalevtinaAmanciniAgfhjkm2Ahip-hopAelektrikAjasondAqazedctgbAkasimirAsalamaAnadezdaAmausiAilovepusAzxc12345AroadstarAkasparAsevastopolAanniesButechreAbrowncowBeautiful1AnaziraArjpzdrfAdjkujuhflAvaz2106AtwinzAcheriAlildevilAdanubeAredknappAmarielaAvitoAgreatsAtester1AmilliganAstifflerA1fuckerAbill123AaltitudeAusmc69AalukardAsailerAestebaAiamhappyAbayaderaAsashasApencil1AzacharAsweetpBoccer99AeatcumAambientAroksanaAsony1234Aazerty1AzaebaliAshitassAinspireAwestwardAarrivaAcyecvevhbrAlorealAjessica8AanamariAfrfltvbzAsweethearAerevanAxtvgbjyAgeneveAvolvo850AevermoreAmoxieAchelsea0Agenius1AdrexlerAqaz1wsx2Aasdasd1AknobAmuerteAstrider1BashaaAnihao123AreligionAartem1Acamille1AanistonAfrnhbcfAmechanicalAoskarAcouchApomonaAdressageAkellyannA1999arAtommiAstrippersAchris99AwhipArulezzAchicubsAantonellaAdeletedAfragmentAmoney7AseverusAredfredAsebastian1AmcgregorAjoniAredeemerAbesterArtynfdhAartemonAfloodAartieAflameboyAsperryAnathan12AdukesterAkennerAscorpio7AathleteApourquoiAvfrcbv123AshlomoAguesArocky3A4815162342aAbiskitAovertureAchutneyAnitehawkAkrogerAmilehighAcrawfishAhornydogAtigerpawAradostAmyopiaAoxnardAdelbertAevgeniAmathew1Ak1234567AbanditoBigrobAtensorAoldschooArecruitAartillerA00197400AthebullAsection8AbandaidAcannesAracecarsAkelly69AsessionsAmathewsAnamibiaAvovochkaA06060AretroAhoneybeaA11111111aArangers9Alobster1AbelovaAdamon1Astormy1Ajosie1Bulian1AtallyAcattyAevertonfAkagomeAsangeetaAtorrieAstarwar1AkattAspring99AoutdoorAsockAosvaldoAminnie1Asti2000Aherman1Bolly123AsuperbadAroninAbuddyleeApepper01AcoatesCuncilAdjhvbrcBirkpittAgolfcartAmanitobaAgreenerAjacintaBeepcj5AcrazyboyAdanicaAriggsAblitz1Amaster23ApfeifferAnavarreA1hornyAseniorsAuclaAgowingsAiforgot1AtownsendAlawrunApetey1AivoryAtiger01AnavyblueAavemariaAvivianeAtheclownAmakemeAroxaneAdinmammaAsupermarAprobertAneenerArosebudsAnottinghA01011901ArfhbyjxrfAostrovAseedAdelta2Asheila1AwaylandAkesslerBatelynnAblue88BuccaneeAchihuahuAmookie12AparachutAafdjhbnAoneillAbergeracApopmartAdohertyAjessicasAcurly1AvaraderoAredrum1AceejayAvivahateAmalayaAdiegAsharks1AjoplinAcarleyAlaceAcivic1AgobuffsAcoleslawAserenadeArastafariAshotgunsAtrumpAbreezerAsittingBpankeyAdiggersAhahaha1AferreiraAbojangleAlyndsayAphase1BussylipAluckycatAmatt1234AnotoriousAhorny123AthugginAsadiedogAdaddieAbigdaddy1AmackdaddAlinesBakers8Agood1AromualdAbudwiserAiggypopAanguillaAenter2AtwinboysAknobbyAjohnson2Arambo123AhandbagsAmoneymakAnorcalAgripperApentium2AspecialsAhenrysAmaggie12AdomaniApartytimAgracie1ApacificoArelianceAastrovanAcollingwAblueballsAvortecAghhh47hj764ApopstarAzagrebAsqueekAajhneyfAignatzAuglyAmerdaAjanuary2AgunnAjames5AhideawayAisgoodAhazel1AoscardogAtrinitAluke1A1pantherAblack13A1slayerApimpiAcybermanAb00merAfractalArandiAcomebackAbladderAronnie1Apanther2A1matthewApitbull1AdrivesAmasters1AshelbAfreakshowAmilkshakAgetpaidAizzyAkeiferAjockAspectorAbiscayneAlaurynApriorityAoakridgeArockssAweedheadAmerleAvoodoo2AjohnnybAmanagementAsabbath1Abob101Ajillian1AlyndseyAgolfersAroberts1AtauchenAbobbyboyArocket88Aseventy7AdurantAtazman1Ahaslo1AplateAfrance1AcocodogAwuschelAkolaAdekkerApionexAboyAryan11AmycroftAswerveAtiktakApepper123Amatthew9AjoesakicAktutylfAufkfrnbrfAcyclops1AmongerAhalogenAwaynesAsicnarfAhawkingAvaleriyAgogiantsAcrawlerAwinter11AjackryanAsexylegsAelguapoAmajorsA1234asdAgloriAsc0tlandAgaetanAmcdowellAjameAtinfloorAstrattonAfishbaitA5t4r3e2w1qA1scottAfredddAnougatAthermoAdillAquagmireAcarly1BoolbeansAprintersAchakaAreinhardCdcloudAkillerbeAjewel1ArennieAfetchBire911AcalamariAblancAcalliAdomenicApariahAfiltersAa1b2cAgearboxBolfeAmollycatAclickerAsanpedroAoldtimerAdogdayAjaliscoAtaysonAdreams1AfairfielBorfreeAcarteAstarfuryAcocopuffAratraceAsmurf1AcroftAfullmetalAtravoltaAmalibu1Abmw330ciAnerudaApappaAfinsterAblueiceAwhereAznbvjdAcannondaleAbetteAdinkleAkindAb0ll0cksAcrackheadAfriskieAliveevilAcurious1Alancer1Az1234567AasdfasdAperiodAeldarAdelta123Aboston12AputnamAgreggyAichibanAwolf69Alvbnhbq1AtopdeviceApink123A09877890AgradesAslava1AadvantagAprinter1BontoonA1johnAqwerty10AtotalwarAunderwooA123q321AbillionsAflame1AnfnfhbyAdanny123AcockyAsupertraArvd420AhomegrowAgottiAflipyouAsupermenBhad0wAghbdtAq1w2e3r4t5y6u7i8AgjrtvjyApedro123AlbyfhfBimeAkayceeAmutualAredrosesAbigfellaAjoy123ArudeAgauravAmasterofAwww111Akiller66AnotyouAbilderAender1AbyajhvfnbrfAmonolitAsweetgirlAuruguayAcookie59AshinobuAdbityrfAnelliAzqjphsyf6ctifguAflamencoBischeAmaitreBorebeerAklopAedvardAgoleafsAskyhighBuzanne1AironroadArhjirfAsandrinAmicheAkathAmidconAviktorijaAtimoxaAexerciseAfabriziAnoncapa0AmarleApopolAspeedingAredstoneAolimpiaA11qq11AtallguyAmadriAfuzzAsanyaAprono1Atyrik123AdevicesAkavitaAnatalia1ApucciniAtatersAgthtcnhjqrfAk9dls02aAtakagiA1hxboqg2sAlhbjkjubz2957704ApulleyAm0rn3ApradeepAsergikAnurikAdevo2706Aroman222Atamwsn3sjaA6000A123423C5678B35711B83461B98400A227722B33391A369147A481516A526452B54433A998899C9998A1232123B313666D4520B596357A7355608A8543852A9632147A13324124A36460341A77778888A81726354B6753099B8351132C889999A123123456A299792458A481516234A0009AboobisAdenman85AbinaryAnapierAroberta1A007AmorelandAxeonA55555nAbuschAjasper12AdoleAnadrojAsepticAleetchAcabinboyAshinesActcnhfAopopop11A134kzbipAgsewfmckAyhwnqcAdzakuniAamadeus1AblucherAteengirlAbellsoutApescadoAace1AfreeeeAarundelAshowersAdopplerAbelgarioAsexxesArose12AsocialdAbeandipA1bulldogB012nwAhypnodannyAwildsideAanjanaAcliveAfromvBlorAeatitAcavernA1cccccBxxxxxxAaleksandAqaz123456AchicagAtetonsAbiteme12AwhittierAcavscoutAborneoA1qazxcvbB23456782000EasAdrloveAnerdA1234aAcyrus1Bisco123AalfabetaA123kidAjulie456AcharvelBandAyumikoAontherocAh2slcaAapogeeAclapton1ArepeatAjohn69AyakmanAhaydukeAblingbliAdeckardA545ettvyAbjhgfiA2wj2k9ojAalianzaCcaponeAcoooolAflagshipAgjmptwArunwayAmuirheadAdeftoneAmonica69AnabokovAhightimeAnatedawgAhodgeBepcatAeastwestBgonAgiuseppAlights1A213qwe879ApiehonkiiAmurdochAfootsieBredoAhorney1AchevA12345aaF6ssApeppyAanglesAsuzetteAnascar99AadenaAstoresAllibAvg08k714AbaerchenAvictimAtamia1AcocaAwarpathAfinbarAopenwideAinsane1A1chelseaAtime1AnextA1ferrariAanna2000Ababy2000AchewAgepardAtifosiAnoideaAgfhjkm007AontimeAcq2kphAwvj5npAconcordiAgrouseAarschlocAqwertaAsurrealAcorderoAsubitoAhomicideA89172735872AfaroutAeeeeeee1Adakota12AferrerA23jordanAtimothAzacheryAlinda123Atri5a3A3a5irtAyja3voApondA1blueA747bbbAe5pftuAy9enkjAmagnum1AerichAtroutmanAandrewjackieAshaheenAknuckleAchablisA5lyednAzpxvwyAalina1Ahot4youAdante123Auiegu451AbtnjeyAvgfun4A4pussyA7ovtgimcAgracefulAseasonsAlibertA766rglqyAclumsyAtomeAfeliAsapphoAking12AmonorailAsuccubusAwarlock1Billia1Axxxxxxx1AbeercanAdamngoodAlaloApussyfuckAbootsmanAlsdlsd12Abmw530A1yellowAbubby1AsonicxAhandjobAnujbhcAscorelanApot420AboonieAmobsterAgilesAaishaAprometheusAcinderelAarmagedoAewingAbrennerAdirtballAcapeAtootallBhemaAjesusislordAyankeempAjupilerAzxgdqnAbeetle1Asabre1AnovembreAmegatAsucessAforgiveAbigmac1A1qazxsw23edcvfr4B23456zzAjalapenoArizzoAaustenAbrandon0BintangAfenceAintimateAcomanderAitsmineAbootayAnefertitiAincredibleAmywordAannickAdukesAspatulaAfaerieAwhoopsAchakraAalexandAvirginsAantlerAsloaneAvalheruAturbodogAspeakAamaterasuAmastercardAbridesAdorothy1Apaddy1AavensisAjbabyAhard4uAcathouseAhajimeAcornflakAkswissAonlyone4ApjflkorkAfrankfurtAmiroAherthaArancherAcatsmeowA8uiazpAkankerAexposedApluckyBacker1AshantyAkonijnAguest1Ajune17Aslage33Ahairy1Arfj422AsplitBocballApirrelloAanchoragAbigginsAlamersAmulchArose123AepochAsergey123Aalicia1A3xboboboAbrakesAarchivesApirates1AspacebarAburrAcfvlehfrBrippleAmadhuriApeekab00A9379992aAhaciendaAbad123AnescafeAtakeoffAjoshua01ApacketAshilpaAtigrisAsonntagAmistydogAengine1Acarter15AthedevilArjhjkmbienAa9387670aAcellarAbarbarosAmonday12AdicksuckAabaddonBlex00AfatdaddyAsecurity1AcrabtreeAraven123AkiranBtrcecA1fireAsophie12Afred99AvitaeAmrjonesAtonedupAcutlerAsugareeAabuseAepisodeApixie1AaresAcartonAalison1A1111111qAtopsAboopieAsoccer20Agerald1AachilleAyankees0Alove14AdodgeviperApoppysAguitar12Acollins1AtequillaAmercedes1Aa1l2e3x4AcrestBhoctawA2110seA1adam12AhollowayAchikenA07070Amummy1Azaq123wsxAferndaleAjam123AghbdtngjrfAloveeeA.adgjmptwAbandungAvictoireAzadrotAmanoAkingfisherAgasparAandrew01AfcbarcelonaAbadboBeamAramosAwargodAagentsAfacileAandronAflutterAdagnyAprovenceAqwerty89ApreciosAmaintainArhodanAsidewinderAall4uAgorodokAn123456AspellingAmcfaddenAalenushkaBfricAotelloAflickAalways1AmertonAzsxdcfAslovakiaAloveislifeAsoccer16AbrilliantAasdf12345AsondraAcoloniaAalladinAjuliebAscarecrowAbaldAicecreaAhockey11Aangela12AvbhjckfdfAsalukiBmk7366BprayArichlandAak47Amylove1Awelcome8AsimplexAanna2010AlampoonAsnakerAfisher1AbatsApercy1Aharley2Abirthday5AilikeyouAulsterAloveherAfirewoodBreshmanBlight1AalaskanAgoforit1AwebstersAbellasAaurorAframesAputasAapolonElonAzmxncbvArjpthjuAkotopesAlena2010AcfytxrfAghjrehfnehfAhingisAalex69AsnowdropApopovAticklesA4321rewqA123qweqweAopelastraAwerthrfAchelsea6AmirceaBelmacAkazakovAmonitoAlesbian1AsiouxAmalkavAnarayanAqazwsxedc12Ateresa1AkjiflrfAhockey10AkentavrAfredrikAnapoleoAliverp00lAcessna17AfeatureAsuspendeAairjordanAstang1Amaster10AbillardAnyquistArezedaAdiablo666AkaranAmizredheArfvbkkfAthiefAyanshi1982AstargazerAjulia123Amandy123Cx2000AthissucksAbrentonAtiannaAandrew123Apass2AfantasmaAamritaAwinthropAamylynnAberlitAkilianAdjkrjdfAangeliCnekeAkiller99AmarlborAhoney2AplanetsAhashemA024680A1andreaAedoardoAskylinAfourierAwerthvfyAantiqueAparoolAmorgan2AkaktysBoteczekAclemenceBaioAapples12AchennaiAanimaAmartynaAemericaBxbntkmAchivaAantoneAobsoleteAblood123AslowpokeApimpsAjordan01AfrancyAazaliaAluthienAzasranecAstudleyAchuckie1AthegirlsAaries1AsamualAarmageddAliliaAraspberryBemedyAarturikAcheliosAschaeferAdbacksAsevendusAmultimedAvaz2108AdimsumAroxburyAbaselineAscrewsAbitches1AhowlingAscale1AblarneyBunkyAgruntsAdogloverAbagpipeAseakingCptembrAdjembeAjailAalphabetaAletmein3AbrewskiAkenoAdavid7AkalininaAjake11AvialliAfantaAheskeyAgeddyleeApantryAgizmo69Abrittany1AjasonrAclarksAbiggreenCrminghAtracker1AwagonAchingyAravens1AbangbusBcnjhbzAtruth1AnationsAdavidhAhonda250ApyramideAaugust16AxthysqArikimaruAfred01AgrimsbyAred1AgoodrichAcurryAmillie1AtazzieAbierAfirstoneAlurchAhullcityAbeachsAseymoreAyyz2112AcarlieAsidney1AbartenderAhawkmanAgodukeAmonamourBy2kidsAcubanBamaroz28AwedgieBheatiesAbassieAlupusAmavrikAbatman7AcamilloAmissedAolesiaAunlimiteAqsawbbsApuppieAgaydarAskimmerAflukeAorvilleAdarioAuuuuu1Awwwwww1AconfidenAbobbbbAduke01Acharlie8Asnoop1AblindsAmacsan26Aglock23AbiomedBrittenAhuntedAcarlton1AavillaAbear69ArfpfymAnotimeAsunmoonAgocardsAshameAprogrammAfishboyAswampAhaywoodAclarksonAjudokaAdigweedAroflAhyper1Amedia1ArenoirAbunny123AdeadbeatAholAredcrossAdanielle1AstanleAbluejeanAkayleyAidiotaAbanana12AkillabeeAriflemanAiseeyouAcareAnatas666AmuttBoriartyAharingAtomcat14AbigairBeginAchattyAkstateAbootymanA12qw34er56tyApadillaAgunther1AbelieverAzxcvbnm.AschmoeApronAverbalAgranitAhoney123Apassword00AslicksAfiona1AblinkerAdreadsAsheaApiramidBlantersAjolandaAforsterAgerman1AchomskyAsarennaBpiegelAhollybAbernadetAmentAalex2112BctivateAneverdieAmanning1AnnssnnAbuck1Awar3demoAboomtownAcindylouAfeldmanAbifferAsolaraAbillgateApenaltyAtandyAwaverlyApenis123AscouterArichard7AhoneybearArawdogAmrskinAcheetosAnewzealandAtrumpetsAlorenzo1Avolcom1A1fredAtrapdoorAsexy11AveracruzAglideAhardtailAcorpsmanAboss1AoctaneArachealAbottomsA23wesdxcAp4ssAblunt420AveroAfuchsAbigjayA1rocksAceltic67Ablowjob1Alloyd1AchelseafAblockerAdruidsAstimpy1AreddyAcopyAnasserApropaneAboobmanAsancheAtwainAhummer1AirondoorAtractorsAislandersAbillyboAkingdom1AdraftAnagualAdrunkenAchristopher1AbitchedupAlucyluAbuffett1AosbornAshirtAnivramAaristotlA159753456852AikkeAnandoAdonegalAawacsAblackpooBonnyAdavionAsalazarBhieldsAt3fkvkmjAhuevosAspank1Athree11AcollantAblind1AfencingAventrueAperrierAlagartoAgolf11AnetvideoAexclusiveAblumenAshaolin1Aphilips1AnoaccessAmason123AjennybAgodlovesAtiger12Abob12345Dby2AyoungerAchucksBlint1BarriageAbondarAyonkersAtomwaitsAjunior2Abetsy1AfedoraAludovicApoorboyAgeniusnetAtuckAcfrehfAjeopardyAmcintoshAcorvetAsmackerAgrosseAfrolicAjudsonAkrazyAdemandAtiger99AsnorkelAtechno1AnorcrossAsilky1CgnupAcivicexAmaisieAcollectionApassword10A33ds5xAtigerwoodsAbenficApassioAnewjerseAfish123AmikelBascotAdefianceAforgotitAmerlin12Aintel1AaynrandAchicago7BrocusAisgayAbrunnerAwolverinesAunknown1A7sevenAtexas123BattoosAbujhmAarchie1Abaseball2AlongballAjunglistAcornbreadApanic1BilatusAacer123AmotherfuckAqwerty3AkeyholeAporno123AsmartieAdaisy2AcamaronAmargo1Achris01Apatty1AdeltaoneAstardogAiowaAhateyouAcaptivaAarclightAsnoopy12AmagiAdracheAright1AmcgrathAblesseAwindsongAtoogoodAlightsaberAskoal1AlasagneAstavrosBkippAmoremoneyA123321qqAtimewarpAgillAnikon1Ajoseph12Akerry1AinuyashAtootsAsupercarBhaitanAololoAhardlineCssAbassaleAwhatthehAneverlandAcortneyAthornsAhashishAorange2BshkoshAnokia5228AsmolenskAjordan22Ayeah11Acunt69AmyballsAedouardAgrunt1Amojo69BetropolisAtort02AleapfrogAaccord1ApermitAtascamAdavidpAkamil1AservantAcash12AfreemailAgoddamnAdaliAzxcvfdsaAmazahakaAdjghjcAmaitaiAsneakAdanny2A1234567890wAqwerty666Aparol123Alove2000Aginger11AtreehouseAnugget1AyojimboAwolfgarAdaytona1AriotAuthvfyAkrauseAmatrix12Asssssss1AazsxdcfAcat222ArockyboyBeese1AsirenaAwow123AdenisovAvfhrbpfAguardsAkondom25A1211123aAawatarAtanzaniaAdumbass1AfantikAdimon4ikA123werAgfhfyjzAktybyuhflApablosAfeelmeBlemmingAsuzieqBcreechAjuiceyAmotorheadA123123sAidkfaAplaya1Bolo1234AkirilAerlanCbolA123654qAkovalevAsiouxsieApassword23AsylviAjosh1Avlad1995AslickerAtimelineAmatthieuAstuart1BachasAbhbyfAfetish01AwessonnnAlefthandAceltiAjeffreAglock19AheatwaveAginnyAjanssonAgerontoAsuspectA1bearAnurbolApitufoAmarkovaAharlowBenriqueAkishoreAjasonmAsylwiaBkippingAwarszawaAmercAtamilaAmaryjoyAladyffestaAinstallutilAlekbyxxxAnetworkingpeAcomicsansApnp0c08AzvbxrplAtarasovAyuo67AolegnarutoA200A4002A20000A106666B23400B48888B95000C8900A258789A302731B75125A556655A666425A778811A1123581B236547B357246A2481632A5782790A12342000A21436587A36987412A66669999A123654987A444555666A1236547890A0002AdrogbaAshahA1chevyAbunchAsomersAwehttamAdaddy2AbrigadeAcr250rAbogiesAsmallfryA6458zn7aAqvw6n2AhasbroAwolfiAspoonyAdavid01AmatildAtoobigAbirthday3BlakeyAsatchAkcufAstaceAhinesAunicornsAm69fg1wAdiseaseAterrysAscootsAdefeatAlyndaApelotaAlithium1A1beavisAoctobeApleaserAchippersAkarolAnichol1AjjjkkkApenmouseAbearcat1AdeliAkisserAvbitymrfA1steveAsp00kyAjerky1A1aaaaaaB23abcdAcongoA12345abcdeAabcde1AgeilesauAlustingAmontgomeApompanoAcum123AmikesA128moBjonesAgimpAjasonxAdga9laAv2jmszBogelAcasey22ByrilAbabuBruce10Asm9934AaristoAkill666AfihdfvAsd3lpgdrAllcooljAidteulAhardassCgenAdalglishAmike24AhavenAnatwestAseatAbmw535AskorpioA1corvettApuntangAolliAjagerAimpalerAstealAtincanAgatekeepAspurrierA1abc2A669e53e1AkarishmaAhabitA1smithAshackA1clutchAtwopacAarrestBvery1AwilcoAmatt12AphikapAnemracA1p2o3iAe3w2q1AdaboysAgooner1ApugslyAliftAspammerAceciliAfreekAbrian2AphunkyAtensionAf1f2f3A1dddddBfffffByyyyyAschoolsDickAdonatoAlarrywnAsteffieAgodsAf00b4rAmanniAlen2ski1AschismAyakumoA474jdvffAnellaAjmzacfAkringleAsymow8A625vrobgAdwml9fAzesyrmvuAifghjbAdamned69AfirewireAdateAcde34rfvBqnwhyBuxldvAjenmt3AvallejoArincewinAbuddycatBigA7pvn4tAyqmbevgkAbloomerAcammieAsh4d0w3dAgfxqx686AboyleApharoahA2b4dnvsxAtakedownAscammerAbuzzedBastardoAgolf99AulisesAkonamiAholidaAdanikaAgobruinsAandrew13AmannersCtthe1ApaisteBornloveArainyAfortisAbronco2Adarby1AbeatnikAkiller23AsoftbalAd2000lbAmindedAcheungAwcksdypkA254xtpssA3tmnejAue8fpwAharmony1AbustAwolf12AkaylieArlzwp503AfuentesAall4u2AgrowthA83y6pvA5qnzjxAvitaAbayshoreAtits1AlasagnaAqwerty02AduvallAmomentumA1morganAchungBarrAharpAquant4307A1arthurAdragon3AsexsiteA09090AbalbesAjearlyAmcfarlandAaustintxAreddawgD12AaidanAvanishAjgthfnjhAlvjdp383AfuhrfzgcAgriffey1AdickmeAballingApatagoniAmhorganAholmanAvaliumAwavmanukAjetmanArapalaAmegumiAloisAchynaAevolAtootAfalcorAsimoBhrike01AbroccoliAnivekAcharlotAdaisymayAplumpAasleepAlowboyAqpful542AtamereAalbaAegbertAtaintAsk2000AmeltonAfridolinAvirus1ArasheedAadastraAmike18BeanoneA000009AdredayAtogoAsarajaneAblue52AschmittAhea666AleonelAsigtauAnorthwesAalexa1AborlandAtrixBoby1AduplicateAphiladelphiaBookaAjohnny99ApirelliAdontaeAsukramAwhatthehellAohwellAtripoliArosalesAmerlin69AappelsAdrewmanAcharmeAsaxonsAcreed1AwideAkaren2BolovratAmanleyAescorpionAvolvos80AnenaAea53g5Apepper76Ar1chardApasswardBlonkerAminkaAnikeairAraffertyA1starAacuransxAgiftApiggieAshoobyAgunners1A1blackAa19l1980A1shot2A89211375759AvagnerAabcde12345A1qaz3edcAmansoAleafs1A123456aaaBqqqqqAnutshellAmountApagodaAjumpman23AmustanggtAhotcumAisabella1AalesiaAnaturaAsweetpeAabusedAmumbaiAsexyloveAgiantessA88002000600Alsia9dnb9yAcamaleonAlucky12AmakeAcathleenAyouAshasta1AfatheAthebluesAsibeliusAmanonAshane123Anatasha2AoneringAabramovaAwalleye1BhyteshaAbaranovaAedgardAbriantAdeeppurpleAservice01AeveryoneAasdflkjhBce1210AdominationAangeliqueAspaceboyAagamemnoAsettlersAgoldorakAcahillAticketsAkipelovAduffelAjessyAdayanA123456789iAjohn99Amerlin01AgjkbyrfAcreative1AbreitlinAgohabsgoAspaghettiAbeavis69AcrespoAparksideAashfordAmalvernAdancesAaddictionAimeshApassword8AdareAutjuhfabzAjor23danA221195wsAoktober7AjehovaAserega123Aboy123Asilver11Amelinda1AalloAqwaszx1AtecktonikApincheAvioletteAagent99Amax777AtimberwoArocky13AbazzzzAasdfjkl1Bezakmi1AkiaraAbadfishA005500AtechnologyApelusaAeyeballsAproductiAimagine1Amonte1A755dfxAwarmAfyfyfcAspk666AklipschBtnj2010AarmondAmisskittyAchargers1Aagent1Amartin11Aa1234567890Amike00AbohemianAcruzAarmpitCchiAblimeyAdorothAwallabyAyardAalmiraAsarangAz123456zAdfnheirfAaaa555AbalsamAmorganeAzoidbergApolicAwildman1AhonchoAsurviveAnautiqueAgfhjkm22AiloveassAmonterreApaparoachAtwistersAdawkinsCshenkaAbirilloAseverineAalphaomegaAhirokoAaaa777Bnna1988BpprovedAstone32Afrogger1Aangel9AlampAveryhotAbailey01AardentAwondersAdalamarAasturiasAelendilAbiancAjuanitAmadcapA12345abBqaz@wsxAreanimatorAangelochekBrtem2010AvekmnbrAbenefitsAalex21AranjanAanastasiyAcateringAdeanoAkorsarAwindsor1AkorvinAazaz09A1234554321qAdeadman1BolfinDemit1ApokerfaceArealmadriAwhitewolfAquigleyAtheghostAstellinaAtesoroAgeorge11AmoulinAdtnfkmAstreetballAastarothAteapartyAmonet1A12345zxAvodoleiAfroinlavenAjaggedAmudcatAbaseball3AofeliaAberlin1AschaapAchilangoAduendeA15s9pu03AbadgeAshainaAweasel1Aandy1BmegaAbrimstonAfreundAwoodlawnAcapitaAdominantAmydogAlonerAkumar1AdimochkaAsixgunBplitterAarshavinAcheriseAgostosoAkrokusAmatiaAjuveAgoonersAivankaApetrovnaAqwert54321AverdiAclimbonAescadaAkennygAangel6Acocacola1AarieCtem123Aspike123AmightymoAhariomAanna1BsparagusAvfuyjkbzAazizaAhabaneroAfreedom5AmariellaAfoundatiAseashoreAdevilboyAalabalaAesperanzaAgoeaglesAquinceAtelefonoA1234567kAfirecatApjcgujratAdumpAapril6Acruiser1AgetawayBagherAserkanApeanutbutterAsimba123AredseaBastasAquattro6AhemmeligAchamoisAtanithAbreaker1AcallasAdiabetesAartisanAkibbleAchanningAqwert1234AatariAsnaiperBplodgeAlolpopAraniAhxp4lifeAcloneAtwice2A1playerAhellyesAmisaBurmanskAboy4u2ownnycAscumAbear11BunchesApepsicoAkiller11BahnAexplore1AhopingAsuckit69CrfboarAbossesApraporAbeholderA2bornot2bAmiller31Ahello9AspudsAballer23Amario123AgellarAcrazycatAbaltazarAlittleboAbuttmunchAgatormanAtwogirlsAbosoxAgrapplerAharley69AbambushAiamhereAcricketsAlongbeachAfizzleAramboneAkikkerAcantikAdepositBaisysAwestern1AtenorAroadieAbaobabAmonkfishAkellymAchameleoAyorkAbarbwireBefreeAspiroAoverlookAvtufgjkbcBoldemarAbornfreeBarnyardAredfireAwetcuntAitchyAoceaneAbarnumAsploogeAmicasaAferrari5Abritt1AdomiAsuckmeoffAconstanceA1234567bAtarkanAfendeArealgoodAmaxxxAtanishaAsammie1ApipetkaAhimuraAludlowAvandammeA7xswzaqAbavarianAsarah2Bummer00AnastymanApettyAhotwheelsAgoramsAtailorAgolfer12AinsureAfernAbowler1AddgirlsAmichelobAcowpieAbeerbongAchopsAlove33CgosAvettesAcrayfishAstevekAminusAfirehousBerryA1heatherAbeegeeBackspaceAfrenchfrArustysAbumerangApounceAbutheadAmikedAsatansAhesloAbluecarAliberateAfuckyou!AbighornAschmooAparkviewA2bornot2AshitballBalivaAthayerAnadia1AdarksoulAbeogradAjordan123ArassvetBoxydogAprongerAskynyrdBticky1Apainter1AhearseApeapodAway2goAclown1AveryniceApauliAjorgenAmartesanaAwutang36Aphoenix7Asally123Ac43qpul5rzAinvalidAfocusedAbethieAstilesA159753zAconairAmermaidsA777winArockheadAplayhardBrincipaAtsv1860AshoeboxBootyAfartedAjasonpAdallas11AmadoneAjamespBrcfyjxrfAbhutanAmuscatAblablAmommaAscaredAmcgeeAfunboyAhugedickAcapellaAballersBigchiefAmojomanAcabinetsAscootAdementiaBimwitApoop1AkellenAdogstyleAbudaBigfanAkimberly1AfosgateAlargerAgetrichAbodyhammAjasoncAthriceAsintraBtarr1Arodney1AchuckerAdevotionAelbowsAbigstuffAmajinbuuAjoemanAeliza1AwinxclubAgunshipAmisawaApitbullsBrovidenAdragon9Amaria2AsweaterBimone1AmarielleAbondedBillboAsuzannaAhobieAdiamond3AchipsterAtoyboyAcheneyAphitauAsaddieAkansas1AbacksideAdavidruizAopiumAdrillBetlefAminersAschlumpfAwm00022Agreen22AespaceAw00tAcriscoAbitcheduAeugene1AhangoutAcelloAyensidAjulius1AroundersAnumberonAcirclesAslayer69AblacksexFhawksAforzimaAwitch1AbunsAlee123AcrossfirBodenameAblottoBologna1Ajob314Basmine2AmufflerAdalmatioAranger12ApavlushaAjenny2AsuckmycockA741852kkAtravel1Afuntime1AmybuttAtroyboyAmillionaireAbriley2AjasoAmovementAexcelsioAninjamanAdessertAwaldemarAmesquiteAanniedogAstaleyAbobbinAredsoApeanuts1Ad78unhxqAredwood1AmarsbarAanklesAtrololoAcordovaAtrudyAsnakeyAdrumssAfreakoutAspanisAradleyAdinkAnoonerAracing1AplugAgraham1AtrademanArunning1Agarfield1AheadersAgrandmasterAnitrogenAilovegirlsAdapimpAfrequencAtrolleyAzzr1100Am1chaelAstiflerAmelodieAnokia6230AchillingAingodwetrustAthunder9AmishanyaAlittlebitAs4114dAfalcon2AminicoopAdisketteAcobra2ArockeAk1llerAowensAjasonnAkennysAdeadlockAcornell1Ageek01dApepsi2AtoxicityAmesaAskeetsAmoose123AhenriettAdohcvtecAhologramAgreaterAmidasBacanudoAdakota01AfidelAtoneAcreoleBharles3BameleonCnardAgranpAmoosejawAofflineAcostumeBlooneyAmaster5AchriskAbulleAemoryAcountersAjustfunAicewindAenzymeApolymerAminecraft123Afinance1Adignity7AleaveAchelsea8AjcnhjdApierrotAharrisoAlondon20BightbulAproductsA1ashleyAwwe123AultimoAnightwingAkarina1AfornowAdavidleeAwhatnowAdaddyyCnilovAmickey12AsarahcBlayeA4crankerAcureAteremokAgoodbeerAwhatifAsweeterAcatdog1AlifesonAq123456qAduncan21AlerxstAseanjohnAlaura123Aparker12AlonglifeAsoccer4AmashenkaAtitaniAdesantAnremtpAshaniceAmayflyApokemon2Basha123AfatalityAkiskaAdome69Ahorndog1Aqw12qwArunescape1A7f4df451AtwinkyAstandartBhamiAwestwingAtippmannAfatbobArfnmrfAmarquezAcomposerAintheendAnuttyAdoedelAcommishAdavidrAzermattAmonkey5Aqwerty111Ajeep95AnesterovArightsAkappasAabkbvjyAwaheguruApastasAjobsearcAaw96b6Amika00AdramaAgeologAturtoiseAorange3ArieslingAanastasijaAkashifArfhfynbyAkarthikAnatasaAfischAmorgan12Aigor123AgooseyAfelicidaAwhisper1Amanuel1ArostislavAbear01AdbyjuhflAroxannAthomas11Anokia3110AgjvbljhApiknikAlosharaAnamronApaulanerAglory1AkristelAsewardApass69BfhfpfAkbnthfnehfAfickerAlopas123Ageneric1AsucramAerkinaAsafinaAvolgogradAfk8bhydbAwinnipeg261AfuturAcegthgfhjkmAmanicsAwhoareyouAdigitaAmotorolAzerkaloAdusty197ArennerAghbphfrBokartAkkkkkk1AberezuckiyAmy2girlsAjaguaAmarina123Aole4kaApussylickBigtailsAabigaiAconeheadAnegrilAsandhyaAgangsteAhiroyukiAjinxAteachersAmustard1AsunsAgulnurAcrushmeAhfccbzAmegapolisAsatoshiAmodifiedAvfvektxrfAjasontA12345678qweAroom112Akarolina1Asanek94AkairatAscriptoAktr1996AvlasovAdigitalproduAinstalldevicAberbatovApiterAmoldirAp123456AsherzodA2509mmhA123456@Ammm666A7000A36936A78787A113311B23213C5478B58272B79355B97800C8300C9200A222999B34432A332233C9311B45543B92781A442244C4333D666C6655A556699C7799A600000B16879B97769A700007C3751C8090A852369B88111C9900A975310A1234512F78B453145B654321A2835493A3334444B891576A6031769B666667B820055A7894561A12332100D45698B9216801C899891C977991A22221111A123452345B59357456A666999666A951753852B63214785B99888777AbillyrayAgulfAcryingAsirensAavocatAselfishAdunhamAwalteAmaartenAyellAvitalinaAnetcomAalterAxswqazAminamiAdun6smAzsfmpvAvoyager2Acrf450AdevilishAseemoreAchrisaAtaxicabAmontAdave69AcobberAnolan1AhuxleyAjoedogApimpdadAyesmanAjazzzzA1j9e7f6fAmottBasterb8CndaAwarlord1AhookedupAmatilda1A1powerAedgewoodArichard3A1eeeeeBgggggAtrojan1A1zzzzzzzAggggggg1A1rosebudAmarthAstoutApussy21AwhartonAkucingAabcd12345AworthAbyron1AmotdepasAasdfghj1ArodgersApeepAcameoAjoey123AallianzBntlersCgiAmetartClissa6Atennis11AacornAmasterbA4playAparadisoAhotstufAa131313AtapoutA4ng62tAcoolingAtorontArembrandAsmokyAnqdgxzAwqmfuhAdevlt4BynxyuAmxaigtg5AtinnerAdorsaiAlipperAsoccer18ApeterpAsamediAangliaA04325956AtweedyAcheryl1DtAnashuaAspikedAdiggeAsteamyAfortunAan83546921an13AtercesAblacA1appleBbuddyAforrest1A1grizzlyAobserverA1richardAbigjonA1kittyAwolfdogAspain1AtatertotAstanley2A0p9o8iAronniAamigo1AwankApenthouseAscanAjblazeAkatrineAvfhufhbnrfAtanneAbodgerAplanAtoastedAfilthBoiegrasAtiffany2Acompute1Aviper9AlupineAnewdelhiAbatman11Achris23BontaineApeekAmeagainAsharifAxswzaqAanna21AtoeringAmardiAtgwdvuAwallstreAnirmalA305pwzlrAnbu3cdAikalcrAtbivbnAcriticAiyaayasAe6z8jhAzjduc3Ayr8wdxcqAluisaAsumitomoAjibxhqAchevellAhillyAnotyoursAsniper12Ailoveme1AdiddyAmisseyAbmw318iBitemAsterneAazuyweAbarrakudaAspawn666BlurpAyelnatsAwarlordsAfcazmjAspaniardAvasiliAsam138989AbestiaAhoschiArobbinAqwerty33AbobbymAmystikalAdrawdeAgeorgetownAextrasAcatalanAradial9AlameAchicanoAscrumpyAuvmrysezA7u8i9o0pAhotmoveAgshockAmersonApizzaboyCnto1BandorAdrowningArookie1AbetrayedAsonarAflashbacAliefdeAabramovAgillieAbilly2BoonBerty75AminogueAsummer04AiraidaAtrillionAsexisgoodAhen3ryArenwodA1houseAbooyaA4mnvehAanakin1Ao236nqAagapeArovnogodAisengardArookAwilli1AmapsAgotoitAqwe123456Adark123A67vetteAhoser1AwesdxcAmcduffAsandsAoleanderAchronic1AexpeditiAskellyAmaster7A1958promanAiagoAhippyAflashesAcamaro67A454dfmcqAheadhuntApussyboyAyellow12AtbbucsAgatheringAmarlaAnicosnnAhedonistAgreekgodAthetaAfrances1Aandy12AgraciaAamarAkappa1AfrankenAmarkhegartyAdavemanAthrottleAkristopherAgregoriAkoenigAoaxacaAncc170AdummieAbrunelAastra123AnecroAbinghamAaegisAthomAmilkshakeA1crazyAnewhopeAoffice1AjoselitoAportoAtillmanAskunksAarbeitAsmooveA123qazwsxAfonsecaAtomato1Aaustin11AgtnhjdAmishimaAshaddyAenergy1Apeach1Ayt1300AnewshoesAaaa12345DabbbbAolavAqawsedrftgyhAtarantinoAdiablo11AabhishekAcaseysAdrawerAqawsed123ApunchedAcbr1000ArccolaBhett32AantaniAbadass1Blue02Adrums1AgamletAsymmetryBtudyAdoghotAabc123456789AmelbourneAsamarkandAadiletBbdulaAwilkinsAljcnegAestefanAchino1AinfernalAghjuhtccAbartman1AmohicanAruggedApapyrusAvip123Ajasmine5AsesamoAamanda01Amuffy1AxenonAlumpy1AbramptonArositCuletteAtesting2Aaccess123AexecutorAofferAalternatAwomersleAdblockAemmanueAspacedA777777aAaugust25AnicholAkarandashAtristramAalberBction1Abb123456AyolandAmoppelAjemimaAalicatAgrowingAadam1234Ajigei743ksAaugust11Acharlie0AlocateAcharlestAsnowfallAtowncarAnagasakiAarcher1AfilomenaAranaAsteaksA123456789asApreciosaAtommasoActvtyjdAadvokatCxel187AtoystoryAavocadoAunicorAmike21CdgardAellis1Atool69Bhomas19AbangaloreAkataAidlewildAtrythisAsilversAdelfiAfranciscaAgraikosApolitoAcjxb2014Aemerson1A42qwerty42AmogulsAluciAdawidekAkaren123AwapitiAoldguyAillini1Ajoker666AveterokAgr00vyAnostraArammstein1AcraxxxsAmithrandAfhbirfAautumn1BikoAfishkaAjabba1AstratsAbibbleAaldrinAstructurAchloe123AdimedrolAalex23ArubinaAgetrealAchinitaAmuffdiverAkazumiAgodislovAat_aspApflhjnAcegthgegthApornographyAdionisAyfcnzAgfhjkbotAmareAbernarA7653ajl1AgreenieAtigger11AanteroAshintoAcecilyAascendAminnetteAvesselAgreen69AcampariAbigloveAaleAvinogradAsamvelAlesnikAqazsedcftA123321qweewqA0987654321aAseredaAalesyaAjlbyjxrfAujkjdjkjvrfApunhetaAkbdthgekmAmerlinoA1029384756qAmrsmithAwidderAgatitaAmerrill1AquiksilverAchallengeAisaiah1AbelgorodAaristoteA1234567vAcuritibaAlindemanAcristAtomjonesAalicesAmixtureApicassAchongoAettoreAashton1AcacapipiAmcgrawAbeloitAchichAmrgreenAramadanAendzoneAvtkrbqAnoisetteAcrumpetAalloutAshamaAlfplhfgthvfAcaveAitalian1AhighfiveAlove01AchalmersAallisoAontherocksApoolmanArfhfrfnbwfAsorianoAmedicinAsneezeAlaurAomega9AdorkusAkoldunAdeandreAchupaAsanteriaArekbrjdfAdeathstarAmoneymonAericsonApunjabiAmystiqueAcrystalsAgumshoeCido8AfvcnthlfvAwinneAqwerty69AfuckwitAanvilsCkitaA0u812AlodossAgeorginAtimberlaA033028pwAfuck11AcondomsAdowningAcdfoliAlabelAmichel1Aasian1Am1garandAbilbaoAandrAlumberjackAgiganteBhbdfnAprioraAmaradonAbundasAindigo1Atigers01AnorthstarAilonkaAbigwillAstrainAproberAnekkidAburberryAdoogleAkrasavicaAvfvekbxrfAanna1989AscouseAhernanAbutterbaBadnewsAanimationGorAbethesdaAtomek1AespadaAminoltaArfgtkmrfAsloneczkoAkononenkoAbureauAhunter99AgembirdAvfnhjcrbyBaz2110Across1AdillionAtrailer1AbalalaikaAkarimovAfranchisAnicola1AshumaherAkartoshkaAbassssAraidBedman1ByjgjxrfAisaevaAanywhereAhebertAcrevetteBorsaCckmanAsophia1AredlegsAfallen1AshutterAlinwoodAfebruarAdogballsAbassproAelianaAmisterioAjason5AarmenianA2004-10-Abigtime1BrooklyAkiddingAblah123AstreakerBpellsAincludeAroadtripAhollidayAstrataCubbsAbuterflyAvulgarAeastern1AassheadA1wizardAsikiciAgnomikAaureliCstin123AelloboAboredomAsackAcashedA1pleaseAghjcnjnfAjbirdAbahaAfuturoAsireneAkalininApistacheAbaileysApasswrdAclean1AbaitAthebearsAgreen6AshortysAdavid3AgovindaAdirektorAharmonicAmeridaAnarayanaAgiants56AsalisburAmiata1Ageorge3AweezieApatric1Aterry2Awinnie1AtyghbnAcock69AredappleAbrain1A1ballsAdenisonAlickedAairsoftAorioles1Abambam1AwickerAfinneyAplmoknAhipsterAbrilligAwhitetaiAkelloggAfavorite3AeducatioAscrapsBaber1Abailey10ArobberAbatchAjunkiesAbanshee1DyanAshuffleBarahmAcaracolArhtfnbdAdanialAbabciaApasswoAcarole1AapemanAbasenjiAglencoeBrumbleAsashadogAmaureen1AchibearsAbarrowAscorelandAtrulsAnirmalaAbouchardAsybilAbradmanAroger2AmansteinAwantonAbatcaveAgerrard8Abmw316AhatesAaustin01AchrislBlara1Ashack1A19371ayjAdemolayAwindows9DteAkoala1AbermanAneworleansAvanechkaAfar7766ArareAaerostarAtitans1Amoon123Axxx111Abigboy12AelsinoreAmantasAjoshieAsosaAcaperAgiseleAmardigraAauckland2010Abrandi1AconniAdeltachiAhockey19AveroniqueAmilkdudApuebloAlubbockAfresherAscouserAzuesAdigitAceleryAnozzleAbeernutsAwolf01AguysAc3poAmanolitoAgazza1AtrailAsexiestAbelladonA4freedomArebel2A074401AironbirdAprettAozoneAevelineAgnarlyAlordikAbeer30BobsterAtarkusAmatty1Asusie1Adavids1Anintendo64Ababe69AmufcAwolfman1AuniverAjoesAsatnamAbichonAall4u3AtakeitAmissy2AwordlifeAquovadisAplanktonAlurkerAeric1234AfoofightAdiabolicBuhastAomahaAtaliskerA1234qqAsiberiaAliebeAstrawAjimmyboyAsusanbBirenAbrianmApelleAr3vi3wpassAcoco123AfucknutAhello69AtbontbAchorizoAbreanneAgobuffs2AtipsyAhabariAparentsAcharleeAlagersAraven69AyfltymrfAsacramentoAbeaudogAcanariesAflimflamAbighouseAhousepenAdale88AlustigAflyrodAampereAlittlejoAnannieAhotbodyAironmikeAblade123AallblacksAgreen23Aironman2AbimotaCngooAneedsexAoneluvAshonuffAgiffordAjason25AboogaAlyingAbigstudAhellspawAgococksAdoughAjuanchoAgoonieAwallstAdarkmanxAneuspeedAbillgatesAfj1200AenginesAbuddy7AmrspockAithacaAaugust31AjackinAchristian1Amarlin1AlookseeAhecklerAironsinkAdairyAclosetApittmanAcloughAgoodgodAnorman1AfastoneAyasmiAlegalizeAwarbirdBigginBahoosAbathAprattAhokieAkaratAiloveu1A****meAlifelineArainbow7BhenjqAladydiAmiyamotoApromoButamadreAhonkeyAvalveAs1lverAbrownyAhayleeAdeepdiveAphantasyAganstaAsteve01AtasmanApushitAstaplerAknighAsawmillAtuffguyAgrace123AkathieAbreadmanCanAwideglidAtreessAnaveedAprotosAninerAsoccer5AzzzzxxxxAmammalAfantasy7AcalliopeAjerome1AgossamerAthehipAaeiouyAtestuserAhello3AsharesAbraves10A1amandaAsucker69AbuildersAcorkeyAmonkiesAlicenseAcfif123AvolkerApartyboyAlobstersAharold1Ajonny1AdonnellAw2dlww3v5pAjakemanBohn01AmilkyBergerAdovetailAgoober12AklineAfunksterA4me2noAmandragoraAleto2010AseesawApeterbAmytruckAspirouAomgkremidiaAhempAdogbreathBaybreakAnorton1Aknight12Amagoo1Apeter12Ashit123BalingerAbubbieAtimberlakeAcrickettAtelstarAshysterAjacob2AdedhedAtrack1AmegastarAbutterfly1AsheckyAdollar1AmilwaukeeAtrimmerAcharisAskippeAgillian1Ajake99Amst3000ApazzwordAfurryAwoodfordAeclipse9AjackdanielsAresidentevilAclaretAforsytheAlockhartAmookeyA1merlinAruthannAjavabeanBoinerAstraitAleader1AheadsBappierApatcheAwinkAbunny2AdaffyducAstoopidAchristalAzyltrcAranger5A6xe8j2z4AapplebeeAimajicaAmarceauAlisamariAcalibanAtragedyAaugusAhousecatArequinAfe126fdAnintendo1Agfhjkm11AmackdadAeduardo1ApolicemaA1freedomAdragon25ApelusAcarlos123AoffenseAtowsonAremusAmancity1Alogan123AcuttingAziggy123Aqwerty23Acasper99AminivanArandom123AcopierAqazwsxeAdionAmindenAblessmeAlovesyouAgallowayAoffsetAmancowAredshoesApondscumAmainerAdaftpunkAblackburnAnowAshoppinAlinus1AdemiAhelixAgrimmyAepicAuniversAcorky1Cunter1AworkhardAmethaneAsunnysidBpeechBolomon1AfalseAredboyAhungwellAgreerApeggy1AuconnAolcrackmasterAmonkeys1Agamer1Apoppy123AhiphoAficktjuvAsharAviggenAsmellsAoscarrAdayanaAybrjkftdAgeyserAjack10Aprince12AmayorAaksarbenA987654321zAliljonAbnfkbzAcujo31AmorbiusAsmiteAkiller69AchangepaAs7fhs127BpudmanApremier1BaintedAherbert1AcybernetFiaAryderAvfhbfyyfAkwiatekAnovgorodAdauletAkarate1Asasa123AalbcazAkevin12Ashaun1AhbhlairAjohn31AghjcnjrdfifAebenezerAthamanAhotmaleAmaricelaAsexywifeAmilleniaA1234567890zzzAdenzelArfnz90Aharrison1An12345AmeanAkardinalAwolframAeumesmoAlisa1AestoniaAcleodogAlfdbl11AdisplayAmegryanAvodka1AdobbinAscoopsAgo4itAeconomicsAsplatAnavidadAmariuszAseeyouAminchiaBajortomAoxymoronAelistonAleclairAducati1AzhjckfdfAthreesomeAdima1992AjackedAtmanAbenettonAimportantAperrButariaAbrasiAtango2AqwertyasdAmessyA4809594qAhysteriaAstuntmanAbolotoAdookerBima1990AsamuriAdima1999AufyljyAhoneA1mikeAjoeblackAnukeAjacob123AmudmanAtaz123AintentAmangust6403CrviAdozer1AgetdownAscatAkoks888AemptyAuprightAfreespaceAtaylerAmultikAesterAlizzy1AgrasshopperBalaxAmouse123AtakerAearwigAmmmmmm1AktyecbrAwelshmanAzhannaApascaAsatan6Aaa1111aaAplatinAfannBulleAseiferAlthtdyzBitterArocklandAfred11AhickeyAmagnatA1234567sH8sAuekmyfhfAmartialAjimmyjAnewspaperA0p9o8i7uAfreedomsAjetta1AgfhjkAvlad1998AschillerAflintstoneAredbull1AtrunkAunityAqweasdqweAoddworldAa801016AtarkinAhideAchildreAsilvestrAgreaserAsexdriveApingzingAsnake123AghjhjrAzcegthAdkflbdjcnjrAj123456AbcgfybzBunko18AmoonunitAwhitemanAkils123AjunkmanBimmyjamAsportsterAlajollaAmembraneAsid123AfreehandAvariantAmaksAzaq12wAmonkey21AlectureAekaterina20Avika2010AqzwxecrvAlaputaxxAvladislavaAfetish69AexploiterA32615948wormsA196A5003A7001A66699A123211B35795B57953B98700A213141B67605B76115A316769A405060B56838B64811A678910A741147B75577C7771B89632A824655B67530A908070B95511A1020315B232323D4599B597530A3247562A5681392A6345789A7224763A8902792A13245678C579135B5975300B9866891A22223333A44448888A92702689A123456788H98A753951852AminhasenhaAcablesAbrinkleyAnamtabAmanga1AcadetAmrloverAhurstAdragon64AcbrownAherbstAmariner1AdemetriaAingoAvampyrAhomesickAleftoverAquatroAbogdanaAhimitsuAminiskirAfahjlbnfAcargoAdashitAwouterAphantoAhomerjayAtypicalArobiAtuesday1AgammasAewq321AaboutBaaa1A1cccccccAupupa68AinventAreginAbassoAsensesAmorgan01A5432112345AglimmerA45autoAadnamaAbulls123AroyceAkissyAmonoAaphroditeAdimitrisAstakanB1234567Aalex12345AbathtubAgold12Alickme69AblowupAjansportAcool11Abill1234Amolly12AdeleonAslickyAanhnhoemApensionAluckycharmAkeithbAslutty3AcincoAgreengreenAincognitAmpetroffAwc4funAmaddoAo4izdmxuA878kckxyAoddballAlazyacresAproject1Aqaz12wsxAjamsAgallonAsteverAawardAnudgeArolfAtaylormaAblair1AlesbiaAmarwanAlacrossAvery1AkatsA1bigAginsbergAcat1AtrampsApatrick3Ahotsex69ArapeAtoolongA1cowboysAchapA1rockyA4funA1pizzaAreboundByan123AsinnetAbushesAdecembeAgarden1AburtAmandysAshorterAovertonAcherAjoopAsex2000AvasilyAdevil123AvfrcbvjdfAsilversiAarnster55AhairlessAfreddiAdominatiAassemblyAgwbush1AsnowshoeBelwynAjuanasAsecuritAreformA2196dcAdreamer2AfairladyA1bbbbbAandrea11Axxxx1ArolloA0072563AbullpenAisotweAcrowsA94rwpeAluetdiApvjeguAglock9mmA4gxrzemqAjkne9yBtuac3myAqmpq39zrAyejntbA4g3izhoxAsuzjv8AkriegerA93pn75Aat4gftlwAljb4dt7nAwmegrfuxAmaytagAshoulderA000005AliebenAmonstaAqr5mx7Aduke123A4sexAdolinaAfatkidBred22Amarie123AbarbosaA4x7wjrA7ertu3dsAu4slpwraAiluv69ApoeticAdecipherAcazzo1AwooglinA1sunshinA6jhwmqkuAhumbertAsnoopy2AberliAomalleyAadelAnanotechAjanvierApeppermintAcaterpilAnorma1AachmedAgaussAshagmeAanalslutAmadmikeAchiefs1Ab929ezzhAshawshanAaminorA9kyq6fgeAhildaA7f8srtAschulzAgedeonA12345asdfgAhevonenAwayfarerAkillemalAsoloyoA682regkhApetercAscottoAfoundAelginAagricolaAleblancAkimbleAmuradAleadfootAcooneyAreneeeAdownfallAtommydAbastilleAcryptAjump23AdruunaAmarryAcharle1AdumboAlifeboatArussiansAconduitAkairosAsenderAgermaAparkaveAimesAminimaxAutfp5eAyujyd360AcristaArivenBocawearAffejAufgyndmvAfreedom4ApresariAb7mgukAporschesBiolinAarneAegroegAguppieAtearsAalex007Alogitech1AallayAcobra123AgamedayAdelennAsr20dettAbusdriveAuvdwgtAphoebusAkurganAstormieAdrwhoAjtkirkAaristonAshadow3Aandrew88AbigwaveAcheesecaAretrieveAzzxxccvvAparisienAqazokmAnewmexicAeverest1Acmgang1Adave13AfritzyAbabyhueyAhonda99A006900AashwinAjanessaAdontcareAc00li0AfucklifeAhunnieAjuggerAaaronbAmashedAjason3A7gorwellAbuttnutAyelenaApaint1AchandApilotoAgodeepAtempoAbrunosA567rntvmAtunisiaAheat7777BarrybAfhnehxbrAsmokeitAbuddy23AshinigamArandersAcheekA1bravesAwhitakerAanthony0AmamonAbrigitAqueenyAcatlinAjesus2AlostboyAcaboAapple22AtenoreAmercutioAdanburyAvehicleAstudsAtreehousAcrawdadAonceApornmanCkersAcarter12Aa54321AkartingAneedsomeAasdfrewqAmatveevaBilionAalex1959Bugust12ApainfulBleasAblitzenAholeraBillcresAkobebryantAlol123456Adark666AsherBonofgodArakkerAtruckmanAsunnydAqazxsw2Ajmh1978AmerkelAloverboAkalleankaAmesterA1buttheaAnbvfnbAalex02ApullmanAbugabooAskate123AtemitopeAapril13Ajumbo1AalibekBnyutaAwoodwindAharamiAsebora64AbachmanA1qwertyuiopAcrabcakeAbasileBoeing1BankoneAmelinAdivinityAgoomieAsaudanAwaleedApelmenAtiger200AgatlinAviborgAgivenAfoxwoodsAslackApicoAdirtymanAlawntraxAswamiAdabbleAmarginAbadbobAdinsdaleAargoAshaliniAwiccaArandoAzoulouAunforgivAsanctuarArjvgm.nthAsouthbayAtwins1Aclipper1Aacmilan1AtaucherArfpzdrfAownerAmakingCtataBethod1BishutkaAdorotaArelishAatombombAopen1AverysexyAgavin1Ablack3AfiniteAhubbahubAsorokinaAflavourBrankaAohyeah1A112233aaA2502557iAcarla51Bhicago0BoletaBxzdsaewqAlegionerAtortueAmillertimeAerrewayAjertootAdbrownAarcanaBshley11Afylh.irfAartist1AcomputadoraAlafayettAandreeaAtalibanA123456789eAgordolee85Aforever21AmumdadCnchenAserenitAmonopoliCsleyAwestendAportilloAkevingArfktylfhmAseetherAhuskieAdovajbAfirsttimAslidersAloginovaAblackoneAgblfhfcAalicjaAeurocardAhockey21AtimberwolfAironchefAfucknutsAdignityAmm111qmAvidaAkotek1AjabbarAfdhjhfAcaracaAparazitAgunnyAhydraAahjkjdAnokia6630ArobertsoAceriseAbigdoAsentinalAajnjuhfabzA212121qazAgjytltkmybrAqweqazAaileronCrcrewAteslaAvirtuagirlArfkbybyfApeanut12AsunghiAmagpies1AanissaAbucks1ApussycaAmukeshAdon123AlbpfqythAwineryAgeujdrfAbadmojoAakbarAzhukovAa1234bBfhfjyAersatzAcloud1AwhitingAborntorunAilovejesusAwonkaAverochkaAlamborginiAilovejesAspeculumAfhifdbyAlodgeAwizard12ArachidAmargareAwinstonsAbabilonAhfvbkmAbarbraAwaikikiAalyonaAspagettiArossellaAmarlboro1AruffianAxenophonAsalty1AvanesA38gjgeuftdAsasha1988AalekseevAsilver2Aalex95AsensationAalex1973AvorobeyAmama2010Aalena2010AharrowAprestigioAnapolAchitarraArebellioAalex1991AcornyAmachadoAhelloallAcavaloAsasha12345ArjrfrjkfApaula123AsanchesAgwbushAas12345AbarmaleyAkatharinaAeveliAjannieBetblackAsportinAnedvedAmilenkoAparovozAa121212Blfredo1AvenezuelaAgrizzAkarla1AsardarAkameronAhabibAantsBlino4kaAtdutifAfabianoAkolesnikA012345678910AkathrineAtwenty20AmcintyreAjb007AsortedAtadmichaelsAjose1Awyatt1AroselynAhardon1Anascar03AsexkitteAzydecoAmariesCckerA6339cndhAharley99AstrongholdAbuffy2AfahbrfAalotAlornaAballoon1AgrimAthekillerAaltavistaAvhou812AturandotAinfraredAcristopherAscrubAalwayBngelo1AshalimarAwillaAsweety1AdingosAlapdogAkeralaAhairpieA1111111aApressmanAsmokersAflashgAaselAjeff1234BustinbiebeAhotel1A1dolphinAstefAaninhaAb00gerAmatrix69AbioshockAane4kaAyfcnfcmzAremembeAavocetBntoxaAlisichkaAperaltaAstudioworksAheikeAjanisAilluminatiAaq12wsAmatheusAsonnieAvfhnbyAstate1AguelphBeraldoAandy11AcjytxrjAgoose2AhowitzerAgfhfdjpAbackwardAhardawayAangel99AcarinAangelbabAshokoladAmadison3Apancake1AmicrowavAsunilBayonaraAturaAanjelaAborisovaAtkachenkoAasdf11AghjcnbvtyzAfuckyoubitchAantalyaAqwerasdAsleipnirAtrash1AasseaterBvrillavigneAstrausAflatlandApizdetsAubvyfpbzAobsessionAtrader1Aasd321Aivan2010AziffAdiablosAtizianaAara123AshkolaAarsenicAyesicanAshapeAbonjour1Asunsh1neBocks1AkarlmarxAvtufajyAfoxs14AgevorgAa32tv8lsAmaster00Alalala1AgodswillAdallas01AkonovalovAartyomAsananBoccer123Aass1AwariorAaztec1AfelicidadAbuenosAlyubovAbacardi1AkaliningradArattlesnAautomaticAoleg1995Aindian1AboomboxAlifetecAbills1Brooklyn1AmcgillAbailey2AcellphoneAhummerh2AkeylargoA1bananaAsusansAlakers12AmanilowAadvisorAeagle7AlovecockAgracesAdiplomAjaydogApartysAfittanAlimboAdollarbiAmagmaAbalooAfree1AvorpalAterpsAjunior12Ax1x2x3Atiger11Amatrix13AchummyAjulio1AbatonAfairAinspectorAmultipleAnicole11AbaptistAgeckosBoleafsgAhaloreachAgregorioAbarbellAfunbagsAdollsAblonde1AhickmanAbarcodeAshakespeAbridgetteAgmcz71Acocoa1ApradoAsearsAmeoffAburleyAsasamiAbarnA1maggieAbarney12BeverageAshoelaceAfreedAkurwamacAcatinhatAsimpsoAkatiehAjayjay1AwalshAbasia1Ainside1AgoogieAvolvov70AbasqueAlester1Anokia5320Asuperma1AcrazedAspencer2Agambit1BraciAtujhjdfAfreckleAbeaches1Crtha1AlaticsApanties2CrklandAwhipitAskyhookAmadison9AcarrilloAhagridAbernie1AserveAhibiscusAmydogsAsnowwhitAelaine1AmitsuAfatalAcheatAsantaclaAfree4meAprescottAchesneyAmossadAgrizzleyAbeejayAamistadAcalabriaAstatenAlarrybirA1steelerAnikhilAcindysAtombraidAboriquaAkakawkaAdeerparkAmeeeAnibbleAshredBkylaneAflapAproductionAhaveApeejayAwildthingAmissoulaA00000001AsearchinAconorA452073tAmadhatteAfanny1BenrirAhendrickAbhbyjxrfAamonteAtommyleeAlabelleAmonica12Averitas1AayeshaAlucky69BargoAincomingAbranden1AterrasArexxApolizeiAtristeAkalamazoAsaphirAlieblingArubinAbluefireApitaAwoodbirdAconstantineAelinorAfamily01AkimoAw8stedAcharmerAspoilerAitaliAgrundyBostosaAiamsexyAgobluesAderrickhCshawnAhitmenBunter69BealerAlabambaAhottiAmoney4Aneptune1AtrevoAripazhaA26429vadimAripper1AgerritAflymanAnovassAhollysAbelmarAweegeeArexdogApigboyAdave99Amaster77ApiglettAsuckmydiArolloutAsteedaAblowjoAphonemanAmynutsAfacialsAtickAneworleaAmassimilianoAsasquatcAibizaAmegansAloveoneAbrowns99Achips1AspicesAchanceyAsam2000Apussy11Acall911AredhairAchevy350AwigwamAnoreagaAstjohnAelectionArevereAtylerbAruffneckAputneyAidiot1AsmokeoneAcadburyAbill99AparcellsAemily2AvalvesAfatratAlombardoBikemikeAtrashcanAwaylonAmandieAbitchboyAmarryherAlady12AcoorslightArenaudAboats1AparrotheAredwings1AfritosAcyclingAdeltasigAinsectAbirdman1Acarlo1AqawsedrAdutchesAtrenchApursuitAjonnybAdamoclesAcaroline1AlloydsAslugAblackdicAx12345Achinese1ApugwashAlikewhoaAcanalAshadow22AtantrumAmoney111ArayleneAgodpasiAshallowAp1234567Agucci1Asummer07BhareAteachingAsupermaxAregginAexecutiveAchaos666AburgAschalke0ApsycholoAscorpio2AjeansApaperclipArastafarAsalzburgAchiantiAblue2000AdeirdreAstarrrAbonzo1Asintesi07Arey619Avgfun8AclarkkenAlondon2Bucky8ApeerlessAoctober8AdarinAchelsea4AwormholeAurlacherAtopaz1AdodsonAlp2568csktAspicyBexfunBp1derBcoobaAanimateAretinaAswellAbrittonAreynardAskins1AcarlsbergBhrisxAmelvinsAgonzalAproofAeasyrideAtravelsA****youAratfaceAmasamiAbakkerAcjloveAlegrandAbanannaAnapoleanAkevinbAwaltherAyankees7AmacroAbeast666AjelszoAcardioAjames3Atanya123Aphil413AastonAclioAshamankingApartagasAbotafogoAsanbornAhonkyAdrainsAjosefinAoxcartAdisorderAvenom1Apepper2BroximaAcumsuckerBbr929BhapsticAlammasAcireAitoutAsecretarAcoolguy1Awoody123ApadreAcumloverAtarbabyAscooter7AniftyAjabaAantietamAsydney12AlimitAtouringAhexagonAdevon1AreunionAereiamjhAsmeagolAclaretsBhapterAdulcineaAcrutchBanucks1AgnoccaAcelulaAbeach69AelbowAnhfdvfnjkju123AfriarsAcroutonAhappy100Apenny123AelbartoAweededAmudsharkAwebmanAsallysAgolionsA1w2w3w4wAtruck2AcodymanAstr8edgeAgattoneAxcaliburAcossackAveroniquAgettysburgAbvgthbzAwidespreAsunkingAgjikbdctyfAc12345AparentAvidadi1AcaddieAlesliAbarsoomAdrasticAcahek0980AiglesiasAcalvin69AkryptoniAdupa123AguildwarsAfairyAlol123123Ascottie1AbraceletAcandycaneAmeritAchris3Adima1994Amelissa7Ailoveyou123Adanger1A1mickeyAsavagAnephilimApumpkiAfatsAcliff1AtoadieAnewhomeApouletAnissan350zAch33s3AtullAmassacreAchalkyApureAmontgomeryAcabaretAshineyAcharmaineAthefoxAdoomerAchester7ApoochyAmadagascarAtgo4466AdarrowAmaddmaxxApastryAghostyAbowhunterAgottliebAleverageApooderAmonkey23AjackylAkevinkAnathan0ArainmakeAcrackedApotter1AmagistrAjune27AnutcaseApattAsweet123AfrolovAmordredAbromleyAxplorerAcablemanAgkfytnfAmanolAzippy123AdaycareBeanneBude1998BamarisApowerpowerF7Afree123Ahemi426AreddingAwaffenAvinterAjune21Amuffin12Balik1A742617000027AvbnmrfAlocalAnoway1Ajeff123AindiesAdeagleAscuderiaAgilmanAripcordAsilverfoxAchameleonAsilenthillAoscaApogiakoAramsayAnilknarfAcyfqgthAknottyAdaisieEukeAnavigateAtigers12Asucks1AtwinssAxcatAhogwashArentAtenshiAnewburghAshinA1mouseAdfhtymtBembelAshandaA311musicAnoneyaAstephanyAtoast1AstressedAcristyAperseusAshiva1AisakovArevenantAfluteAqazxcvbnmApopkornA0147258369AxfqybrAjetlagAboroAnessaAcampeoAminoucheAkukarekuAledzeppeAdeadlineCnwerBilligasApppppp1AdenissAtupac1ArfvxfnrfAleppardAdrumnbassAshowgirlAeknockAdelticAqqwweerrA744744zAtane4kaAflatbushAsuisseAelusiveAstalker123Azxc123zxcAmetatronAghostlyAdolphins1AhoneymoonAcbvjyfAmoderatorAlimpdickA5t6y7uAdinkyAprotoolsAteenyAjayman1AuhfvjnfAjersey1AelderAbankaiAcaptureAhomeworldAdownundeAegyptianAgondolinA1qasw23edA007008Astation1Avolvo240Banilla1AtodaysAmousemanAdartmoutAqazxcdewsAdctktyyfzApantheAmoresexApon32029A1234567lAeric123AdialerAjarmanAmarcuAlovelovAhitman1AlollipoAexaminerAriddenAhollisterAprimo1Amax33484AchangingAzenitAjuicemanAnoclueAputainAradical1Ahenry123AkalekaAgolf56AcrypticAnarkomanAq2w3e4rAfifa2008A000777fffaA41d8cd98f00bAundertakeAbomboAhfccdtnAgoodgameAmarusaAnecromanAdontaskAfrosty1A123sexAiamhornyAeverlongAkatiaA4311111qAnudelambApinkpantAschachAtombraiderAmiller2AspotsBacrificeA12345678mAag764ksAghfplybrAscrappy1AhoodooBappyyAlololyo123AshylockAironsideAtricky1A01081988mA1bitemeAbooboo12AyournameAugandaAjaimieAtomas1AmovadoAnemvxyheqdd5oqxyxyziAthunder3AjujubeAhellholeAtomkatAporpoiseAolympicsAredrockeAsanjarAtraffic1AjsmithApololoAjameskAkalelAshamAmalboroAnigel1AjuliyaAkostyanAbandit01AkapitanBeli_14ApfqxjyjrAvishenkaAkolya1ArolsenAsidorovaAtitovaAulugbekAadv12775AgblfhfcbyfAmochajApavlenkoAsephanAhoveparkA19952009saAkr9z40syAaaa123aA4001A9009A34778A45685A56565A123445D678B37946B47789B55555C9789B97100C8600A222666C3311B46824E90B84655A316497A443322B55445A526282B55123B79300A666420C7766A779977B85612A888555A926337A1010220B357642B726354A3578951B630000C57549A4034407A11335577B2123434C343412E5670B4071789B9733791A33334444A46775575A57392632A85852008A98798798A123456654B42536789B133557799A00009999AspycamAhirsuteA0006C10Ahermes1A2183rmAscrubsArotcivAvinylAmaratikAclaude1AnursultanBoentryAtrouble2Apaul01Admh415BemetrioAraiders2AbunnsAchoicesAmolineA248ujnfkAvinbylrjAycwvrxxhAkcajApoochie1A1charlesAdeadendButtonA7452trAanatoleAq12345qAoctaveAbrucesA0128umAbirthday10AgrandorgueAkubotaBensaiAwebheadAprongBickelCllow1BetergAgrubbyAfeuerwehrAvalenciArummyA1jjjjjApasswo1AhusseinAeldridgeAchubbaAwifey200Aololo123A1passAmelenaAilovemusicAboydAginsengA321cbaAfatbackAtapperAcamronAdazedBrizzitAluziferAbobyAfirstsonAceisi123AgatewaAbarrieAmedmanAbonemanAruss120AmyladyArock12A123123fAern3stoAciousAspineAmozarAsusanne1AenteringAshielaAflorentB8yruxojAtefjpsBoltecAaftermathA2getherAemilysAralphsA16473aAleducAroundupAloser2AjupiteAfacadeAlove99AorgasmicAthesnakeAstgeorgeAdavid5AswannyAvaleAsinaApippa1AthicknesAkristallAencartaAmintyAadamoBircavA49ers1A1truckBeaglesAmadelynA1fenderAluv269AacdeehanAfreemaAlinksysA1jeffreyAmac1BikeygAslacker1AmontagnaAwilleyAsseccaAhondacarAabacabbAzippo1AlovesongAmoebiusAcyanideAmatkhauBotorradAredoakAtonka1AmondaAabsintheAiiiiiii1Apants1AchiaBourtsAskybluesA456123aAwabashAvipermanAaleciaAgatekeeperA01234567890AremoveA267ksyjfAredvetteAac2zxdtyAhxxrvwcyAlardassAalan1AnoddyAatwaterBrunAsimpleplanArampantAcincinnatiA1pookieAcuzzAhj8z6eAx5dxwpAmodestAbatman23AeyebrowAanimals1AlavigneAzomu9qAnokia6230iAsnitchAhunt4redAdarknighAcptnz062Andshnx4sAwnmaz7sdAdurandalA8xuuobe4Acmu9ggzhAapple3Bngel3AcribbageAduboisAbitcheBearclawAtreatsA1diabloAjanbamAbigeasyBlink1AttamAwhirlingAoctober3AmanomanAbsmithAmatildeCndiArrrrrr1AchumAsnowieAfumbleAcabibleAmoomoo1Asummer98Alieve27Amustang69AexocetAnadegeAbapezmAup9x8rwwAbodegaAdeflep27AshaftedA8vjzusAcornballAlopez1Amama11A1amberAanjaAtightendApaquitoAsnowmassAayacdcAearlyAgiulianaAchariotAharleeAgiuliAandieAkeanuAqbertAelkcitAprismAsasquatchAlewie622AessenAfellowsAgrindersAkzsfj874AbargainAirmaAnofagsArustlerAdevils2A7inchesAnimbleAarmenAsoundmanAvernaAalchemistBpril7AhoppersAthundercBintableAbasiliskAyomammaAkayla123AmotomanAa3jtniA12345rewqAnightimeAmxyzptlkAohboyAbanterAfatoneAtriviumAmeetAdezemberAledgerAmolokaiAbossdogAguitarmaAwaderhAphotoshoAtobiaAjunior24AsilkeAarcanumAspitBhillingAranger69AleicaAkellie1Afrank12Aapril22AmekongAcarlitAreutersAtowtruckAmeloneAranger75AtoymanAboeing77AsuitAgoslingAkevin2AtubaAxohzi3g4Akfnju842A0147852369Araptor1ClstonAgreen77AheyjudeAmissy123AgreenwayAmaiyeuemAnccpl25282AthicluvAgodardAbroncos2AgartnerAivonneAnorwegenAmoviemanAdeepwateAsukiBevereAeshortAbuffaloeBaby69Asad123ApipesAvillanA705499fhAbarbecueAwhatthefA123456789yAallochkaAfinesseApolo12AmaggioAspam967888Bummer03Aaaa12A123321qazAbelousAponytailBsw333333Aford123Aletmein4AfldjrfnAsissieAalmasAcheckedAjensAlicksAmungoAgracelandAmathisAfuckoff2AcharacterAmathematicsAtoutouneApauseA1tiffanyArosebuAklinkerAvaz21093AaudreApath13AshabbyAch1tt1ckAmasha1998Avinny1AghbjhbntnAfitzAgazetaAagamemnonAmanorAfortunatBltkbyfAtwinkApangetAshyanneAnumber3AbayonneBohemiaAopticsAabroadAmoom4242AkeenAbeginnerAaldebaraAeclipse2Apass22AceruleanAbonscottAclemBalbearsAjunkyArainmakerAsnakeeyesAbleedingAsignatureApandabearAcrocoAfelinaAjeraldAchrisbrownAactressAdima1985AazzurraAhallwayAgemini69AmadaAlateralusAchivalryAparavozCnda123AsupercooAworldcomAbaroneAmydaddyA1q3e5t7uAlyricsAnaomi1Aasdf67nmAchiquitArev2000AtigresAmarloAleonaAximenAanemoneAmommy123Aasdasd12Amickey01AbrentfordApuszekAapple13AenduroAsmile4meAbashirAkeithsAbebop1Afelipe1AhappyjoyBrothgarAbiggiAaurelioBctrosAdiversioAmarie2AtrentoAbilliamAamarillAluxorAcentral1AsignonAujkjdfA8928190aAtravellerAbartoloAlucifer666A123fourAfamilieAagentxAkaligulaAelodiAzidanAportsmouthAboludoAmoimemeAyourmom1AekilpoolApuneetAghjcnjnfr1Ajackpot1AahmetAthedeadA123456qwerAdestiniAnolifeAbraddockAirock.Asanchez1AlocaAalfaroBngerAranger02AarchmageAboneyardAvaz2101AtankistAsteve121ArehjgfnrfAant123AcreamyouAbluetoothAmystery1Barried1AcairoAsurfaceAthesisAlistopadApepper11AbroadbandAcfkfvfylhfAavailableA1michellAcorrado1AfghbjhbAkumariAgauthierAalex2010AkuzmichAredemptionAblankaAsnusmumrikAcytujdbrAallan123AleaseApostcardAcoolman1AlangstonAshadowruAkillinAmarzenaDilenaAbo243nsAomega13AdillerArichardsonAzanudaAhanaAchiarAtemppasswordAneopetsA111a111An.kmgfyAstomatologAfktrcttdAalekseevaAiecnhbrAgjkrjdybrAsobolevBergeevaAlomonosovAa123456zAvfhvtkflrfAraffaelloAstrelaAlala123AdannybAawsedrAcostcoAserbiaAgutierreAbeer12ApalmeirasAbaksikAmindgameAfrdfkfyuAjune24AchinchilAalex10ArfhkcjyAmarakeshAbretonAelmer251Akylie1AorthodoxAterps1AprojectsAjake1234AflblfcAwpoolejrAalias1AstaticxAqq12345AgarnierA1234567qwAandrew22AcobwebAblackpoolAsalmon1AaliyaAserendipityAtrees1AinertiaAkyliemAalleBppletreAsateliteAalisoAfromhellAalmatAdesignsAjeremiaAmaralAjuggalo1AmourningAbarnaulAplaygolfAromawkaAgarbage1AsadiesAalvin1AzaharovaAmusickAastonmartinAsolutionsAhelpmAfamily5AshivaniAdarumaBeutscheAford22Acrazy4uAannie123Amadison0Burphy01AhuntsmanAaurinkoAcubeAmaricaAbaklanAshwetaAkissme1AfynjybjAp030710p$e4oAmuseumAweasleAjeromAskywalkAgerlindeAsolidusAomgwtfbbqAassfuckeAforuAsombraAreamerA0o9i8u7y6tAanders1AcelicagtAsarkisApleomaxAgodisgreatAchris13A3techsrlAorenburgA80637852730AgreyhoundA7418529630Aandy69Asilvia1AlengthBateraluAserdceAnemezidaAappelAwrexhamAstashAguernseyAempathyAbotswanaAwiktoriaAmolochAtanukiAdjljgflAjoeAmarisAluckiesAnoteAfy.njxrfAaa123123AteddiesBricolorAkikirikiAranmanAstevensoAbarbarisAujhijrAannarborAfbi11213AsenegalA123ertAbagel1AeliotAlauriArfhnbyfAvillasArhfcyjlfhAturkiyeAestefaniAfirehoseAservoAgrace17AarbiterAbanderosAtatooAmama1963ApunksnotdeadAtanner1Biger6Aaustralia1AkeymanAlordsothAsweetpussyAloolAdude11AmultiplelogBillyAiamthemanAjetblueAdubaiAgnormanAkomlosAufhhbgjnnthAguildAarmourAyamakasiAcabezonCseihApiglet1A7elephantsAa000000AsharkieAyellow22AdrussAappleseedBshokAfynfyfyfhbdeAbirthday6BluedevilsAomg123AassemblerAsergantAfestinaAtwizzlerAaamaaxAgfhfcjkmrfAbarrynovApunt0itAbruno12AvfvfktyfAkasey1AmackdaddyAdancersAmwss474AwhitestaAturnbAbackyardAcaribeAazonicAvetalikAbaby1234Asureno13AkluivertAflatusAmickeymoAnicerackAfalconerAjacksterAbahamaAwatson1AlibrasAbahramAraincoatAbuzzmanAmanchildAspurs123A07931505AsmokepotAbigwigAscoubidou2AbenelliAnimdaAjaihindAchihuahuaAbaldieDiAmissleAjasminaAbalkanAkarin1AthrowAblastersAoiseauAmyronArapidoAenjoyitAdoodadAkhushiAloweAmantle7AbigboAnightcrawlerAtigerboyAowen10AbandidoAsupertedAbanditsAtankersAlivestrongAchrisjAsmoochesAbangingAheikoAgrilloAspaghettAleopardsAbigblue1Atrident1AcandideAzaneAorange99Alevel1BightersAbaptisteAelvis77AbaradaAkarabasAquiverAsamanth1AfodaseAharmlessAshantelAweekAjkl123AsitgesAbartek1BigmackBogosArailAgomez1AmanhuntAcubalibrAkenpoArosinaAwombat1ApawsAsammyyApurposeAhausAfishlipsAasdf4321AintoitAellisonAsaurusApostageAmapleleafsAweldingAbrahmaBernAfunkeyApoptartsAbrilloAwaters1Binter00AbassplayAeudoraA1porscheAporn1234AsebastAbathoryBuckwildAmonkey20Ai81b4uAkimotaAmurphysApostbankAsuperjetAduisburgAharrydogAlaurabAsnippyAraven3AdorotheaAsexsex1Aextra300A1q2s3cAboobysAtallulahAdowlingAboomanAladygirlAisabelaAvfiekmrfAbuddy3AmahoneAalpha01AepiphanyAlittledoAsurfcityAqueenbAsameasAmtwapa1aAbengals1AspindleAmonkey24AlasterAboriskaAneighborAsketchAhussarAdoctorjAjeepinAzappedAphish123AjgordonAbear99AtubbyAnetmanAtopdawgAcandleboAdaniel01ApositivAbeautiesAwarehouseAsam1AhannelorAblue15AmeeeeeAsaturneApearlyAirwinAfelderAreggiA5tgbnhy6AjessicamA1johnsonArepentAwilliam7AgeometryAdunedinAbegoniaAjunior123AthemasteAqaz12AsomaliaAmilan1AwolfeAbubba22A7ofnineApavlinAbulldog7AfleaArainman1AcallistaApassword21AdannonArobinsoAsegredoAfreedom9AcabanaAfox123AmedvedevaAblondinAfitzerAshafferAliberty2AjackasAferret1AaraceliAmoonliteAp2ssw0rdAfreakerAdoverAbryce1AdonalAmoon1AstandupBunnysAhimselfAorchidsAhappy5AbenitaAmitzieAbennApensacolaAeminem12AsissyboyAloraineAtakayukiBerminBallAbergmanAcheerleaderBdavisAbertaAhemligtAbenidormAportableAmurcielagoAcumsAlegolas1AensignAalone1Asunny7Acommand1BzarA666satanArednecksAgreentreAdaniel4AsolnyshkoAjellyfishAford4x4AolearyAbaby01BhavaniAplaystation2Am0b1l3AcoachmanAloveyAerotikAmichailAsexysexAfedexBunnyguyAtammysAsolderAarnieApeacock1AsandownAirocz28ByaoyasAminorBacabreAbigbroAleft4dead2Afuckyou12Awrestle1AdegaussAsuper5Arobert01AflickerAsmokey12AbearingAalemapAperritoAcool69AlebaronAbigtomDpappaAheartbreAbootycalAiglooAkayaksAdicklickAathena1Ajarhead1AharbourAboobssAchynnaAjusticAshirtsAblackerBiglouDtopAnewcarAmaster13AlimpApopeye1AboardingAwomackAlucretiaArocky5AstunnaAwutang1AnomargAknights1AreefAshortdogAforsureAtea4twoAjoyousAicepickAmotorbikeAswatteamBcarfacAjuggernaAhownowAlawncareAbikesAmike44AbilbobBloombergAokieAdoublesAgawker1AamazonasAdalejr88AjimboyArhiannaAsparrow1AacornsAmacdonalAbillygoaAasshole3AmessAsparky11AomgwtfAbugeyeAsmokey01AbaskinAcrassAfabrikaAthumpAwestsidAkangooAdreddAengagedAassociatAdowntimeAsongohanBnowball1AhooligansAbrunswicAsafety1AconcacAharwoodA1foreverAkrayzieAaltosaxAtysonsAgreenday1Ablack22AhydrantAshazbotAzealandAinstructAblackdickAgreyfoxBlock1AcmoneyArealmanAlmfaoAshepCaft1AholstenAiforgotitAparticleAgretzky9AbombshelArifleAceleste1AalderaanAcorona1AdadoAwest123AloweryAwhore1AlovemanAblouseAcompaq3AtrinitiAcarlyleAhonkerAlokijuAblownAvivaAlegoAworldwidAextra1AcarnegieAfenwickAjordan99AbluetickAk123456789Abob2000AfajitaAessayonsAbmw320iAsweetiAemployeeAbob2AtincouchAcindy2AkatlynAmiroslavaAsamsoAbosco123AcagneyAbooboo69AmurdererAfindAnafanyaAspiffApornloverAmovie1Aredskins1Abogdan123A123456789.AnicolettApolopolAjmol01AnicklasA1111qqAyfdbufnjhAlandisAffff1Abeatles4AmrkittyAgraffixA1titsAcerroAbonoedgeAdonnellyArandy2Awright1AsammycatBkunk1A1234567mAtassApower9AdeadsexyAbookertBadluckAmercenarDlin99ApenelopaAdude1Anascar8AjoebooAlizbethAgjkysqgbpltwBolf123AerniesAgarudaAbazukaAstasiaAglasssAworksuckAhairdoApartyonAspecialiAbehaveAslipArainfallAdusty123CkeblueAreptilesAmsdnA1winterAwilshireAtireAjohn22Acmc09AtexanAbettylouAhagakureApmdmsctskBumbaaAschottAflyingvAbuffy16AtupperAlove269AdisneylandAmarcelleAyouareAdurbanAlifeguarAperchAstonemanAphoenix8AmishelAwitnessAmookiApatrick0AmuzzleAhaleAmilkman1AbruderAcornelAappliedAnicole12AbrodeurAticketmasterAnumber20AsuperfreAcannonbaAsandy69AribeyeAcoastalAmaserAfubuAmillaAducatAteepeeBompkinsAgateway3Afuckyou0AhasherAdwellApotionAhang10Acarson1A1xrg4kcqAcbr929rrAdeangeloAmotorbikAhideoutApussy101Acamp0017AduganAco437atAbottlesAdoormatAtimmy123ApaolinoAhunter22AceramicAst1100Avvvvvv1AkrondorAnenitAgustavo1AeclecticAapril26AhamlinAsprinA1greenAkatiebAsteven2BhanonA123456789cAacurarsxAslut543BequelAinhereBdeaApouncerAfishieAaudia8Asoccer69BettleAmammoth1Afighting54Amike25AwormsAfontanaAchaiseAvfr800AsordfishAnofateAhellgateAdctvghbdfAqantasAsprint1AwallopAsixsix6ArepvtyrjAzxcasdqwAstackAmattersApartonAuraniumAmonkey6AwarcrafApwnageAcoleman1Ajunebug1AtargaAcachouAstrategApullupAtrustyAirockAoceanoAedmundoA135135abApsalm69AloreneAelementalAloneAperkmanAsalguodAviper99AbackhandAserranoAdewey1AqwertyasAmailman1Ared007AstankyBoaringAmoduleAindoorAbizarroBrick1AmichelaApreciouA01telemike01AsuzannAjaruleAscout2BpenderA1millerAwendallAformanAmartieAyvonne1ApsychAytnhjufnmAelectra1AoneidaAintegritAstrikesApoppBuddyAruslan123AappelsinAminerAschmidt1Apostal1AteroristArehnrfAvengenceAmaroon5AjuanmaAkassidyAgreek1ApimpjuiceArepytxbrAother1Agen0303AkarimaAheavy1A02020AdashApalenqueAmixingAlaikaAiamfreeAbigearsAdamirAcontessaAkerriganAdanoneAyaninaA111222qAloveforeverAstratocasterAmotorollaAujujkmA123456789zxAstevoAfugitiveApoker123Aqaz1234Anoodles1AlakeshowAsoccer33Adark1AnosgothAredbudAjordan7AhjcnjdAgoosesAdarren1AicculusAmaulAzxcdsaAblueseaAprovistaAwithnailAspiritusAquiet1AcruellaAtemp1Adavid26BeliciouAmoney777BetadataAhydeAshitbagAimfreeAgfkmvfAduncaBiana123Amark01Anikita2000A11aa11Allllll1AqwaszxqwAmoooooAklapauciusAramiroAbear101AvfktymrfzAsmokey2AdraculAkeith123AslickoAwetassAdooferAtubamanAphaseAlabelsAjimmy69AnfymrfAactingArjcnzyAdemon123AmarchenkoAde1987maAmo5kvaAbonniAcronaldoApetermanAtelecasterAmegaman1AneophyteAlmaoAstanzaAfgdfgdfgAgfgekzA1986irachkaAdfcz123Aabc125A110491gAdctvghbdtnAniblickAperformanceA51094didiAmajickArobert11AdolbyAgfhjkm13AlapinAstarikAmartusiaAvfrcbvevAmarkovAdogma1AthingyAlosenordAevitaAjigga1BungfrauAzxcvbnmzArottweilerAzxc1234Bero00AmenudoAhotfeetBardupAgamessAkaitlynnAsisyphusAmets69AlimoAgoofApascualAeatshit1AolsenAkazakAdragon6Alucky9AkzktxrfAfermerAcontactsAalabama123AfayeAcrazyfrogAanthon1AtiktonikAferrumAlavandaAdhtlbyfAlianaAromaiAtrantorAg123456AhookahAyoyo123AghjcnjzCost16BattacaAfotografAgilberBbjythArosco1AdumplingAflower12AnovastarAyfcnz1AblackstarAiownyouAgerdApi31415AtentacleAfieldingAvasilinaAlero4kaA1tommyAididitAjlbyjxtcndjAmike26AwwerawAlukaszBoosee123ApalantirAflint1AmapperAvirgin1AflooringAcalculatorAiloveme2AthemoonAradmirAghjcnjqgfhjkmAsheelaBpookerBquealerAkeesApeace123AzxcqweasdAmurakamiAprocessorAharpoAbullshiAkrishnAstar22AgalinkaArbhgbxAmessiArahulAnina123AgeemoneyA0000000000dAser123AitalienAvintelokAparfilevAgrundleA1jackAmatthew3Aaccess22AmoikkaBiguelitAglenn1AvivienneAstasonAhfrtnfAmjujujAnallepuhAimagingAbissjopArutabegaAjaneiroAmonitor1AkazakovaAmistral1AshakalAbatman123AselmaA5544332211AoptimumAkenwood1ApypsikAinstallsqlstAklubnikaA123456789101AjjonesAvassarAmoogieAvid2600Axfiles1AjeffyAbuster22AsoloveyAgeneratorAola123Ageolog323Aa3eilm2s2yAfailedAbyabybnbAyfcnzyfcnzAtwistaAltcnhjthAz1z2z3Amonika1AcompatibleAuto29321AmaderaAearn381AsoreillyAis_a_botA531879fizA4007A36363A44556A123579D852C5412D521D689B31517B46969B51500C3351C4263B64379C6666C7943B96400C7300D600C8910E20A200001B41455B55225C8147D654B61397A333000C4433C6633C7733A428054B42200C4000B77041A678901A709394B54321B86110C9551A800500A963147A1362840B472583B593570A2521659A5551298A6060842A8546404A11223355B2345611F789B9719870C911992D55991A85200258A112233445B72839456A369874125A789632147A1472583690B597532486AhakanApammyAadidas12AcruelAwilliammAblue00A1234567890mAbbbbbb99Atekken3AbechtelA1memberAsnufflesAbillykBb334AtakakoAbabaluAexileAtapiocaAcbr600f3AgrendenA245lufpqAytdxz2caAhallowboyAranger6AbayerAskirtsAhartmannAinsuranceAfatgirlsAclahayAhondacrvAouthouseAasapAgotriceAtanaAsutterAfuckmenoArugburnAweihnachteA2twinsAheimerBubbellAjongAmegiddoAfloriAvalidateAtimoth1A24loverAabsentA11111aaaaaBhhhhhAccccccc1Abridge1AstaggerAjimmy12AgreennAcranesAheatingAmario5AronjonAhotboiAnorsemanAhildeAsundaypunchAbirthday100AgorgesAjoesmithChn44Aglenn74Adef456AfotballAberndAjohnnyboAlynseyAblakesAlisa1234AbooomA1princeAtudorAsanmanAzombie13AbjarneAancella2Ashawn41Apandora2Ack6znp42AretnuhA1herbierAusafAanalfuckAmaranellAveronikA1w2q3r4eAemb377AfisheApass999AclaybirdAshashiAderby1AfredyApelvisAchevytruAgismoAaristaAryan22AkitcatA36ddAbattle1AkilerAdynomiteAbeer4meAsonshineAdoug1BamnyouAharry2BopalongAtribuneA1fishingApaladineA1worldAbulgakovA1wwwwwAmycatsAhdbikerAanthony3AyourassAbreakfastAloryAnigerAroofAkowloonAcherokeAdwarf1A33st33ArobinhAtoniteAasmodeanAcome2meBalbearAkennybAdustin23AmisticAsnoweyA1bbbbbbbBforAimranAluis1A1happyAcrispinApromisesAsuckmycoAmjollnirA5w76rnqpAcaptionAfarfallaAtroikaAlecterA4fa82hyxAx4ww5qdrAforum1AbarbelAford01AwitcherAkevincAavrilApeter2AtalktomeAslonAearsAhot1Aa7nz8546Afkojn6gbAzldej102AastromanApreteenAtestinAvfdhifAkpydskcwAlg2wmgvrApointersAbone1Aunb4g9tyA65pjv22AnhojA46dorisAnicole23Abigsexy1A1surferAqwerty01A3e4r5tAallen123AheliAzebra3AendgameAunluckyAcounselApetitAlittleoneAoohrahAkristAangrickAkeshaAcba321AwaynerAjohn33Acody1ArosalbaAbrownlovApacerAsheetAallisterAshaderAwltfg4taArocket69AblueskieAmandrekiAxsvnd4b2Aapa195Azip100AvanyaAdm6tzsgpAkerenAdpostonA8i9o0pArdgpl3dsAkcmfwesgAtennA1derfulAtanisAaquamannAoceanicAsexfiendAguentherAbriaAlibtechAklaus1Ajerry2A4jjchoAracecar1AhackeAwtcacqAgennadiyAnectarinAbigal37AxelaAbigedAnotesAcrissAfrommeAinheatArosenApoidogAmotormanAboner69AweeklyAmyheartAjvtuepipAdc3ubnAanalystAswissairBhoresAcamachoAvoroninAcurrieAdialAbagsAtimberlandAcobbBarpA1matrixAlinebackAgggg1A8363eddyAareyouArosedaleAgandalf3A1234567890qazApenderAmushinApgszt6mdAredlandsAstartnowAtitmouseAjohnwaynAnike23AavonAcamaleunApeepshowAlizetteA1monsterAfreakshoAtabalugaAfefolicoAcontreraAlevineAshaveArobert99BinkerAwackAaccountingAcoimbraAjimdavisAskywalk1AramanAharrAwhineAgripAthedocAdomodoAexclusivAkimmAgershwinAfailteAbenefitAgefestAlegomanAsocalAheidisAwachoviaAqwe1234567Ai12345AkumaAsafeu851ApastAlongtongAcokemanAmagillaAjagmanAshannanAbaggieBlindmanAhermineAdebbyAmtnmanAvalerioAasdaAcindy69Ajohnson4AquintonAauraAvalley1AscabbyAnegraAkatydidAasssexAbigbrothAquintaAvallonAzanardiAlutscherAbuster99AkournikoAfinger1AdevilmayAstockcarAalemanAharibolAtelefoneAa23456Ab1234567AvasiliskAuploadAclassactAtodieforAbbbb1Aqqqq1Auuuuuu1AnhfnfnfAstrike3Aandrew11AhusainAtreblaAichbinAmaster55AilovemylifeAjoshua3AantonovaAvalkiriaAintelinsideAsquiresAanastasAberwickAgarenaAbelo4kaAcincinnaAhasanArjdfkmxerAgoldtreeAforbinAballa007CtterieArouteAteodoroA12345jAtorrenteA1elvisAauburn1Afaith123Aamber2AheraclesAshakespeareAabm1224AbennevisAulianaAlowkeyAbobbob1AsamadhiAjabellAparmanA66chevyAmonkey00AhomieAcastlesBomradesAamericasAshithead1AmonumentAtremorAverbotenAthordogCespianAmodelingAaverageAmafiosoAadamskiAbritniArupert1AsalleArajuAmaranelloAsham69AphishinAhefferArapid1AfishersAscubadAemilybAlilaAsanctuaryAthinkbigAfktrcfylh1AtwinklesAmarch2BymailAflvbhfkAdentA1managerAhidalgoAtrendyAfalcon11AmuchachoAdarwin1AmatematicaAsadaAartur1Achicken123AperritAmonkeybuA0sister0Ay4kuz4AanalloveAmaximus2AyjdjcnbfAgunbladeAalonsBnna1984Aeagle99Alisa12AoctaviusAgcheckouAcbcntvfAasd123qweAcowabungAamazonkaA12341234qAsheepsAfktirfAchouchoApawel1AstokrotkaAalmatyAghjcgtrnAfoxyroxyAaguilasAflorenciAsilkcutAcormacAaheadAsandy2AasmaraBlinaalinaAhenry8Arambler1AconfidenceA12344321aAnewbabyAranger7ApoussinAduckeyAhappensAskylightAdecadeAbatistutaAliebherrAbabieAvijayAbeaver12AkleskoAjanice1AsnowdonAmatulinoAhowdieAajnjuhfaAinvoiceAgreen8AcalumetAblue14AzzzxxxcccAmessengeAatljhjdfArossignolAarlingtoAfkbcrfAshark01AkonicaApenskeAranetkaAalabamAbutt1AastonmarAkaunasAdelta6AautogodBlgeriaAbigmaxxxAresoluteAgetfuckedApinguinoAscoop1AbammerBigunAmm259upAcelularAarchibalAjuanjoseAcharissaAmarihuanaAsidewalkAeldritchAromerAantoApalmeiraAsasha1992AmercatorAparolameaCnamAtacitusAaleshkaAgfvznmAsasha2000Awww333Anastya1995AcomandoAkuzminaAaftermatAcfifArudenkoAdervishAprotectionAjuly20Asharky7AzastavaAbristol1AsashasashaAgraciasAbeta1AsweetdreamA123654zAgolf01Aand123AgaribaldClatasaraAmadalinaAnazarovaAa666666AcytuehjxrfAknopo4kaAnike1234AelsaAworldwarA4me2knowAelena123AgiggaloAsalvadoAmilano1AalmanacBzucarBntennaAf12345AsokadaAprincesseAaz12345AbuckmanAhoneypieAalphadogBnneliBlsscanA7jokx7b9duAfaustusAbresciaAtribunalApreciseAsparrowsAkyle1AdepotAandrei123AsundialAmatrix01AwebguyAbmw318isAelmersApokemonsAmoney5AblackholeAsun123Arulez1AmadhuAchippewaAamparoAmaxwell7Afuckyou6AellandAsingeBuiteAanaellAiluvtitsAcholeraAkilbosikAdesiraeAacuarioAcheyennAjudgesAstuttgarAandreiaAvanesaAandreykaAfylhttdfAcoulterAflatron1AtelefoonAmasha1Aandrei1AvascoAsweettAfrederiksbergAspinozaAvelosipedAblackmetalAculitoAandrew10AlovergirlAhuggiesAserenadaAcnhtkjrAamberleeArothmansAanna13Abambi1AvfyxtcnthAappolloAjbrutonAqagsudAangelitaAmaldonadoA1knightAdorsettAengine2AvfuflfyAaggarwalAtattoo1AlfytxrfAkot123AaniramAvika1998AjulianeAteh012Aanna1986AbkmlfhAlamourAmatrix7AklimovaAusethis1A123abc123AanushaAhousebedBero63AmarandaAanyoneAmaltbyAgraphixAmlesp31AgurkanBfgfrfhkjAcalderaAsendAroxanne1AunderwatAconchitaAarabiaAradiatioAdonkeysAsnailsAkoolhaasAsofia1BapporoAkzintiAnbuhbwfAvjnjhjkfAarkangelCtem777AbabyruthAteatroAmagical123Agfhjkm135AchanelleArushfanAscrewmeAweinbergAq1w1e1Ahannah11Atwenty1AhellyeaArespublikaAhasloAbiggioAunclesamAthehunAsevernAbambouAchubbAvillainArfyfgkzAhpmrbm41AgrayfoxAbaby12Aalexis01AmarrymeAforward1AbadaboomAhardtoonCteloveAmensuckAkickbuttAeddie123AbadseedAsweden1AyjdujhjlAbabcockAiraqApanthers1AbagdadAcharroAbuddyyBooblessArussell2AtazzerAsuperbowlAironicAtiptonAstarzAclamAhome12AeruptionAgoonAujnbrfAdillardAtechdeckAbustersA1murphyAcomradeAkenya1AdrumerAjaidenAkleanerAseemeAbuttnuttBalls2Doo1AironhorseAmontenegroAfamineAwas.hereAomnibusAashley01AgreeneggAeuropeanAscooter6BpiritsAbandanaAsuzyqAbenhoganAlifestyleAbullyboyBandyApoutineAmandalayApistol1Ahello22Adavid77AmysiteAtamponAayannaArebecca2Aipswich1A1edwardApowwowAdeliriumArugby2Aswiss1AlovesporAs5r8ed67sAcowboy22AlivelyAcumAputtAbarney11AjammingAsexpistolsAnegrosAbarreraAsaviolaAgroovy1Asanders1Abear2327AlatourAquincunxAlogicaAbarterBronx1Achuck123Aiop890AbasaltAhammer22AbaselAvfvfgfgf123Abasil1AmathildaAotter1AcherriAvibesAknuddelAjuhaniAfetterAgalateaAcarolina1A22q04w90eAmollymooBirellaAvlad777Abatman13AsaxophoneAjohnsmithAxpressmusicAdima1998AnicotineAtuppenceAsexmaniaAchachoAsevisgurAchick1Akd189nlcihApolkaudiAthoradinAbeaner1AilushaAcolfaxAyankees3Athomas10AsiroccoA1sparkyAgoldie1Aoooooo1Awwwwwww1AplatesAmignonA7elevenAcream1AbcrichBudman1Amartha1AstacksAelliott1Amelissa3Ajohn23Asheep1Blick123AimmuneAstoolA0773417kAaugust17Aeagles20AirieAcyclone1Atigger99AbendogAcookinAmickey7AshanahanAducati74AwhipperAecclesAclothesAbeaglesAskidmarkAfritzzAhunkAgrummanAlogging7Abears34AstrippedAashley69AroadhogAmidgeAstudmuffinAboldBucketsBeantownArollsAkurtcobainAsunset1AboodleAlove24AbeckmanBajskorvAidontnoAportvaleArelayerAnomoneyAlenoraAshamenAbeeferAmonkey66AlingusApagerAbrewcrewAmollybAgillespiAmother2AafterAdedalusAfootboyAboogAjose98AobsessioAgogosoxAbellabooBob007AsleighAcjhjrfBhorusAmalvinAvlad1994AbilliAceramicsAmaruniAbroken1AcelebritAelvis69AseppelAestrellitAfelix123AkrillinAgodogsBrolschAmrblondeArousseauBachael1ApetalAsolitairAnatural1AchuchiAdorsetAkiller01Ainvest1AsiegelBamuel12AboooAmelanie2Astudio1ArosiesAzebedeeAharnessAaolcomAduane1Asooner1Aregis1Athomas13AscyllaAviolet1AwakeboarAsabersAfrescoAbilbobagAoou812AbrainiacBball23BusmanAkimbo1Aredfish1AknowAdeep111Abill2ArotorAgallegoAcarboneAlanzarotAcamshaftBhrista1AarmadilloAtrappedAkillerbAfatsoAbootycallBigballAlessonAfrank69AcariAspeedieA1peanutAautomagAgoodpussyArussel1AjaysoncjAdwdrumsAinbedAsnowwhiteAmuscle1AbigfeetAchinitoAyeseniaAcoors1Asophie2AchachingA2enterAonemoreAsuckaAtiger22AnowaymanAhardpackAemanAfireboyAmangoesAskinner1ArugglesAloftusAphilip1AsniffyArattyAhalimaAphinupiArocky4AmillertiAiwojimaAcorkAtobiAnomarA1bloodAzrjdktdfAblackflyApretendeAlucky6AjazzminAwoodponyAredlionAspeed2Amaxwell2AclockerAslidesAcokeisitAveloceAhalftimeAguinness1Aphoenix3AhammeredArachel69Atony88Aicecube1AakitasAingaAbillbobApomponAcompressAsugerAwilliam0Arich123AcdexswzaqApoohbear1AchessyAbinkleyAzirconAoctober6AtiffanieAendureAducttapeAmisty2AdragonfiAmolleyAiro4kaAkruemelAflippersAdgthtlAfalcon12ApinguAgiancarloAfeather1AbiarritzAphysicalAharadaAgevaudanAhummeAsolidsnaAheronAleather1AcumsuckAslobberAdennysAttocsAcourtneBhunliAbriankAashley2ApagedownAgrandma1Abuddy01AdeskproAcondonAyankees4AmattressAtemp01AmajikAdragon20BianasAcolor1AdespairAssvegetaBneaksAoverdrivAcheese2CaneAthechampApanther5AalanfahyAwilliam6AalianzAdasbootAtassadarAmetalgeaAwilliam8Ac0rvetteAprosperityAred911Amelon1Ahelpme2AtangentAncc1864Ahonda123AbdfyeirfAnokia2700AwaterbedAscoubidou6BpackleAblubAlaytonAjoey21AbollixAcrystal2AdarceyAstratmanAbluesky1Achess1AphatfarmAwillowsAsheenAmillerliteAbeverlAdowjonesAmickey11Atrooper2BiggersCerraAgofasterAmarkus1BcdanielAoooooo99AlegolaAgnomeAfifty50AmikehuntBontezAinterstaAbugsy1Aearth1AubiqueAasdfg1234AdeezAanvilAssapAelizaAbeardownAhedonismAmagnus1AnyyanksArattenAfaktorAsheena1AmarrowAnegritoAboschAlytdybrAisabel1AjimandanneAtommybAmccannAkekskek1AbusenArubeAnotlobAbolitaBruins77AkallistiAbrattaxAkalle1AsashenkaAfrostbitAkwiettieApervertsAdaniel3AbassheadAceltic1888AbookmanA123qwe12Aedward2Adiamond7ArosscoAcreek1Abooster1ArootsAp3nnywizAborisenkoA45coltAheismanAbosshoggA4294967296AcatbertAboucherBilletAmichael12BateriaBuledeerAwillsA1doctorAvickersAboywondeBckhereAparissAwonderboAgrooverAlespaul1AchinatowAstartingAbrowniAgennaroAmotorcycleAexcellenceAprice1AmeinAbreakingAfishhookAwilkesAjames00AcarolannAgamecocksAchile1AbullwinkleAgasserAjibberAriobravoAsnookumsAvinoAbrielleAgrogAfanboyAranma12BiflesAtwolvesAdecember1AqazqweAkendall1AredialAcapstanAspunky1AgigantorAcairnsAtaylor01AbrunAmuckerApoiulkjhAdearA944turboAriverplateAfuckmyassAbuzzzzCbba12FbubAwhatevaAprisonbreakAhondamanAtalulaAdelacruzAbuggedAflogAghjrehjhAkarimovaAskeltonAenergizerAcdtnkfyrfAgostateAbraves95A3f3fpht7opAporkypigAjoakimArubberduAdonthateArfvtgbyhnAcomatoseBlarisseAzodiakAtumadreAcaineAbubbles2Acameron2Ataurus1Asmelly1AapplegatAstingersArockmeAfitteA1camaroAculeroAunhappyAssgokuAmaster21ClinoisAyeahrighApoopeeAdopeheadAchewbacaAjesseeAcarla123AmedicsAfitness1AkyoceraAaphroditAjoaquiAhappy99AjackarooAsharynAdepeche1AgrendalApoliticAlightmanAnitemareAcassidy1Akirsten1ApanmanAdaschaA1cookieAmachinaApachecoAchumlyAbalmoralAdelrayAcnhfyybrAshitty1AceresArealmadrAmalabarAtigerrAalfa155AhjlbjyAsakurAfullredAlopiAdiego123Amicrolab1Ashania1AupsmanAram2500A28infernAmuselmanAjugglerAcooking1AqazxdrAchicco22AtwooneAdarionAclaimsAvfvf2011Aqazwsx1234A171204jAketamineAbuster21Ahopeful1AswollenAgjgjdfAbloembolAmediciAyoungoneAberkleyAsteve2AluiAroller1AcyclesAdustin1AtkachukAcivilianAemily123AdeployAcorinthAsillymeAgator2AsammmyAhornet1AalbatorAupperAjamiAloranthosAdoneitAkungenAdebbie69AliverpoolfcAmadmaAtoolingAmikasaAcrfnbyfAheinz57Amark11AidentityAmoriahBikeybAjosefaAmisteryAshenlongArse2540AgreshnikAabundanceAodelayAscareAdrizzt1AflagmanAtiddlesAsailawayBtarbursBcramAgbrfxeA!qazxsw2AsiestaAwetwillyAfather1AsnoppyApurple01AhandsoffAdiamonddAscrapAnfqcjyAroddersAduchess1AjonnyboyArobert123AjacobsenAkalugaAliza2000AhangtenAmodel1Awert1234AmadamAthewormAesperoAlinneaDdros8AsheratonApudge1AmidtownAdumassArjyatnfAgetsumAfallenangelAcateyeAfeyenoorAlambo1BtybcjdfAgirlyAteachAred111AvtkmybrAsharronA55555dAmereteBirror1Adiamond6A00000aAstrykeAroosevelAd0ct0rAsexxxxxxApass10AelvinaAgiordanoAdavid13AvirgilioAgrissomAwarren1Achacha1AdfadanBima1989ApolygonAgrittyAdavidwAkuruptAracefanAkazuAharddrivAfiredawgAdarcy1A1a2s3d4f5g6hAblack666AcelebratAmichaelbAco2000Amets1986AplaymeAkmfdm1AwilkieAmugginsAlaforgeApippaAseashellAxenogearAcornfedAdaleksAjesusis1AcheerleaArenfieldAtessa1Amadness1Agary123AeyedocA4iterAhoodlumAbigsurAnataleBoonieAbsheep75ArolodexBrrrrrr1Aalmaz666AefremovAsdpassBuggestAcellAwhalersApanderAdimidrolA80988218126AdumontBell123A00998877AdinamiteAsmytheA118a105bAtoenailsAneweraAvika1996AkollerAooopppAfoodieAljhjufAgodessAconstancAgrimmAb00biesAstuffitAfire69AifufkbyfAelainAsektorA00000007AniggeAtanushaAdochkaA1w2w3wAregistrAjokerrAmahendraAcolts1BnhfcnmAgoochAwayoutAgeriAwillie12BeemanAhornballAmagnuBolly2Acash1Aj0nathanAcrashedAyankees9AtranzitA12345$AsobolevaAteamsterAquimbyAshockersAelegantAmerckxAladonnaA100yearsAhiromiAluapAmookAsovereignBilasAvangarAjesse123AbonethugsAnick01AdripikAab12cd34AwithinAschusterB62i93AnukemAlena1982AsoapyApointeAjustin10AeasygoAnonrevAchampioAsimba2AelinaAninetyAkatenkaAexampleA17071994aAtktyfAcjkysirAtogepiAunknowAgauloiseA9livesAleigh1Apaintball1AbadmintoAtouristAparvizAlouderAfraiseAgautieBuilhermeA111111zAblacksabAleannDchimAsecret2B123456789AmarykateAfreakmeAthinnerAshedevilAmousieAslot2009AhighgateApantssAvladimiAcrjhjcnmAschuylerAreeceApink1Bolopolo09AfeuerwehA9noize9AroundsAtranquilAbycnbnenAatkbrcAselfok2013AfullhousAlittlebitchApussybitchAstitchesAtheking1AsexsellsBwinger1AhelpfulApatmanArhind101BotterAnordBicegirlAgumperAtokyo1AsuziAtrotAkaterinAmannaAjimbooAm7hsqstmAstufffAfreeonesAbombadilAleighannAmerl1nAyousuck1ApeoplAjoker12Aangel21Acb207slAgalloAlennartAmax007AtiffyAbrucewayneAivanaAgauthieAh2oskiA123321sApeggy12AtruenoAbailey11AtiernAmaxine1AbastonAspookieAmine1AlightfooApunkrawkAwichsenAknight99AdummysAludmillaB0swf9gxAhanksterAdfktynbyrfAcv141abAkalyaniAeus1sue1AsexybitcAnatalaAgb15kv99AstaciAbimbo38A01478963AphishingAsasha1997AfackyouAtatiana1Ajamal1Anexus1AgreeneyesAslava123AizumrudAkatya123AmarleeA123456qwertApistolsAlollerAvika2011AmariskaAncstateAverlaatAphatboyAlisabethAnesteaAtom1Aak470000A10987654321AkurosawaAladybuAvalerikApoltavaAfuckyouguysA754740g0Ajuris01AgarfildAmakarenkoAlebedevAvlasovaAroma1993AhjcnbckfdAtsubasaAulyanaAspanner1Anikki123AmaksatAr7112sAdirectoryAwaitronAlizottesAnata123AheckfyxbrAnikita95AzamiraBz6319AshdwlndsApremiumcashAramilAtos8217Biribon12BornikeA9004A10048A78978A123212D342D452D589B32333B49521B59456B82838B96800E20C7430C8206F7D701C9103D430A223366C6622B43122B55555A369741D874B82436A424365B93949A515069B27952B56644A665259C6222A777222B85001C9963A888777A1011111B232580B313131C57913B597532A2597174A3440172A4206969A5792076A6969696A8481068A9811020A11111118C223300G11D51422B2345699D56789B4142135D59265B8254288B9755791C944991A30624700B1415927B6925814B7583867A44556677B5645645A51525354B2545856B8565254A66005918B7390436A78621323A102030405B23451234D578951A753951456A870621345A000002D5D8AderosaAretsubCwsterAtsetAmattiAsachaAdemarcoArichar1Agolfer01Ajegr2d2AnollerAhondacrApass88AlittlegiAnihaomaAbrittaniA67stangB8stangAds7zamnwAwycombeAfodaAstivoneAneerajAtitoneCranaA1jacksonAapologyAhoddlingAeggrollAzuccheroAritoAbrainyAthousandA1001sinAscheissAinformerA1marineBbillA72chevyAvenetianA1simpsonAsickleAadpassAletmegoAzillaArichyAschlangeA1ggggggAbdaddyA1jjjjjjjAnewpass3AermineA308winAdrum66Aporn11A1brandonAmaulwurfAace1062AnaturalsAsellAtannenbauAmoniAkcngAqwerttrewqA048roA1superAjose12AmayhewArunvsAsuperaA1abcdefgAranitaAfritzeAtigereyeAchiffonAbobbyjAqwe456A123jlbAadobeBkshayAdobbsAeventsAbama12AphobiaAscott12A5stringAblanchAq22222AbloggerAlunersAsexiAandrew6AgiselAsux2buCmoAgreatgooAmirkoArandieAtonnaApinoyakoAmarcus2AxufrgemwAsonofsamAcheopsAweihnachtenAblackrosAgoobeB5wks9AzwillingAmaandagAasdzxc123Amilo17AalicAevertoAparaguayAanthony9AraissaApuffy1AwattAboscosAardmoreApiesekAstableAcarlsbadAabc1CigaleAbaddog1Afish99A255oooAcharly1Adenny1AmilkaAking99Ajack99A1oooooBboogerAkalimeraA1warriorAgoddesAtripletAnairdaAjackhammAtiger25AnospamAtbearAhonda200BalloduA1carlosAlolopcAyrrim7ArolloverA1babyAtehranAmoonrakeAagile1Amelvin1AjdogAwisdom1AreganAhal2000AfuckitallAquartAteaganAvbnhjafyAcoolwhipAsignaturBexygirlsAaspectAfcc5nky2Arvgmw2glAdro8smwqAmbkugegsAchris25AwhooshAguniteAmyriadAazfpc310AbreadsAdogfuckAmoochAthetaxiAeventAdaywalkerAmrpibbAapples2AedmondsAalice123A2much4uAbubbAkeywest1AwejrpfpuBwr8x9puBatchmanAtarzan1AgustafAcrueAngc4565A2i5fdruvAhkger286Aqmezrxg4Arz93qpmqAneededAschwabAjavier1AskidrowAbuzzkillAsierra01AmandelAcanvasAnicksfunAjerrybAcrockAsommer1Arick1AgibbApasswordpasswordAvurdf5i2Axyh28af4AkzkmrfAeuro2000AblackwhiteAguenterAkmn5hcAou812aAsujathaAarmyof1AsidingBaisg002AaudraAcheryAmusketAeklhigczAicicleAschool12AbigbonerBrancaArul3zAamberrA158uefasAlifesuxA5thgbqiAtriathloAjamshidAteufelo7AgermainButierrezBravy1ApulpAwodahsAalexxAffggyyoAdivedeepAlaz2937A4ebouux8ApoopiAamitAmaniAroxie1AcorneliusAjonahAathlon64AbebertApsych0AsaginawAdoogAwinner12AcarvalhoAgrumpy1AhandicapAmonkey4Ar4zpm3A7seven7AhotlantaAschoolgirlieAtamiAmvtnr765Aym3cautjAtangleAjaydog472Bjvwd4Acum2meBamryAdifferenAbriceAduarteAstillAbama1AvesterAnumptyAhballAgusmanApensAsmalltitA00700A1rangersApassthiefAdwl610AbalinAfoghatAbankshotAhackettAcessna15AthesameAdelesAaekaraAbbondsAaoi856Adell50AsaishaAruebenA4cancelAswisherAdollerA123321wAbaldmanAjohnathaA1zxcvbnAblobAdoriAspawnsArigidAstoliAtresorAgtnhjdyfAbootmortApurple11AcasoAantonio2AharakiriBighjumpAamenAnicole18AbackdrafAcausticAborodinaAhawkeyArallyeAbailyAmajaAbad11badA104328qAbogomolAsoupppAtechmanAentertaiAspecAmoroccoAcoraAsabbethA99fordAfast1AmommysAconnorsAtable54781AmufferAgjlfhjrApaulyAfregatBantasAgoletaBrabberAellehcimAalbrightAcomandAgericomA4realAbensamApardonAmarvAwhitetailAknudsenAagent86AdagobahAhtmlAgroucho1AcalpolyBhuloAsanfranciscoAfindingAmerlin11AbrandanAmervinAbrucewApakiAtavaszAdiamondbAkanakoAgorgeAaiwaAcandoBhangerAownage123AbugmenotAmelisAstillherAfourplayAwolfeeArazvanAtraxxasAentrarAband1tAmulemanAbond0007Awow12345AatomAmassieBkonjiAeastbayAramanaAturbotAstruppiAbimbo1BoxxerAandreikaAbigalsApkunzipAbelly1Aaaron12Ajoseph2Astar77AjennycApeludoAodonnellAhewsonAdiemA123qweasdzxAmuskanAdebussyAsniper01AhamzahAgoofusAsalimaAeasy1234AyarrakAabbasArjycnbnewbzAtoontownAcheckitoAsaskatooAcleo123Adianne1ApumpingAz1z2z3z4AmaschaAblood666AvestaCryAgotyouAmermaid1AchinkyAsklaveBinatra1AhotbotAcoolio1Abeverly1Aanna1985AhogtieAfateAgreenleeAcjkjdtqAmuhammedAidealAbigtedAdkalisApicketAalyshaBerobicsArestauraAxavieAeireAcanbeefAallstonAferarriAclownboyAicedA456rtyAdockAlabourArockets1Astrong1AkodeordAfunfunfuAironlungAlatishaAruckerAeatassAalskdjfhAbigdongAhtcnjhfyA123a456Ablack23AmamusiaAprimesAgalvestoAamaranthAcorvette1Aa1b1c1AloftonApogodaAcleocatAilovemarAalex2A89876065093raxAaracelAgoodbossAstaterAtiburon1AjjjdslAanishaBdilbekAcoplandAdiadoraAcaciqueBbhtymAinverseAdesemberAsl1200AfarmingAlektorApasswAsdbakerActhuttdfAkevinmAiamthe1AsiegheilAchilisAjorelBitterbuAsammy7AtronicArutterApersephoAzaq12qazAmtgoxAwizardryAreviewpassAsambukaAnathan01AmsconfigAarianna1AlouisianAanarchy1BlphaomeCievaBpexAheather6AanarAfleeceAyorkshireAalertsAkohsamuiAfatdickAadidas11AhoracioAjazmynAcascadaAlanfearAapples123AkulikovAtoonsexApirocaAflameonAmarch11AkoskeshApcitraAagnes1AnewzealaAsafraneAzoedogBaphod42Aav473dvAsf161pnAtranscendAshurikenBaudadeAtomaAkamilekApoker0AballastAsurabayaAlove20ApreggoAahmed1AnastikAdunwoodyBirtygirlAmartheAaidan1AconvergeAhtyfnfAgrigoryanAaniaAsebring1AairmailA1icemanAaishiteruAshortcutArangers2AblackheaArumpoleAscorpio6Atoto99ApraveenAmarstonAdeidaraAkristoAdenhaagAaugust24Adaniel0AghjrjgtyrjAakitaBnswersAlarionovAnausicaaAairlinesAprototypAandorraAvangelisAtango123AneelamAwalhallaAmansourAvanillAaurelienAremorseApinoyAglasnostAisaiaAlovehinaAbestboyAleanderAalaricAchanteAsongsAaerithAquaresmaAgizmodo2AweymouthAphaedraArufussAarrowheadAclassiAfaramirAidinahuiAconejAalex1995B159753ArhfcbdfzAkonfetaAjumpjetA1234567qwertyuAsorentoAliliputBytghjgtnhjdcrAwonderwallA111222333000AisidorAassa123Blex1985AmerengueAchulitaCelsiAalex1987AfiorentinaAmansfielAgod123AescrowAareyukeAvaz2115AindahouseAsex777AchiquiAavataAcagliariAioannaAgranatAluciusAfktrcfylAnhecsyfujkjdtAalfordAneumannAqwertyyAmama1961ApornostarAalina123B123456bAkickinAmilediBalaAbrittniAchelsea7BthlwtAtarelkaAelladaAiversoBsthebesAfuck666Awalkman555Acowd00dAalmeriaAjoanna1AatamanAethiopiaA17711771sAtraviesoAaqueminiAkristina1AberliozAsandiaArecobaAjerkyboyAgumdropAicandoitAlenchikAzgjybzArose1Aforest99AwishingA3611jcmgAamazing1AkathmanduAmeekerAspring12AkaylinAanisimovAwoman1AharlockAterezaAmoney99AarmineAhumtumAmeghaAnottodayAfunkieAluceroAkenshin1AgordenAcognitAfsd9shtyuAphiloAvideomanAbigbird1AybrjkftdyfAcamionAbpvtyfAvoroninaAlocosAzaqwsxcderfvArebateAflaco1AavengeAhvidovreAdakota2A9638527410AassetsAblumeAlucky99AercoleAlaszloAfylhtq1AannapoliAmisha123AseemnemaailmAanderlechtAtigertigAsoccer09AleonovAzebra123ApriscilaAmargretAwakeAchulaBactus1ArockshoxAmissyouAhyggeAkazamaAbasketsAcanopyAandziaCna1990CetkaCna1997AybrbnbyfAjxfhjdfirfA5c92v5h6Apurple13AqwaszxerdfcvCeasd1AatarisAgialloAslonkoAlucozadeAantananarivuAdunnoAmaywoodAgbplf123ApawelekAmakeitAanna1994AgeroinBfhfyjbrAfvfnjhbAsucessoAdiamond2AphilbertAsilmarilAvenom123AgrandsonAredhillAlistingAantonio3AheimdallAfirstone123AkarlmascAsungodAapartmentAvermeerAregattaAartimusAplat1numAdick123DtatorAcrispAnellAmoom4261AcorgiAdistantAthoughtsApa$$w0rdAstyxAmaxthedoAlogan2ApushistikAunclebobAcubalibreAarmorA(nullAcanada99AmistieAshipmateAfibonacciAartemis1AbunnymanAkokainAasdfasdf1Acock22AgopnikAbravadoAeeyore1AthebeatlAmontesaAvadersAassssAglanceAsandanA09080706Asilver99AvasileAmsouthwaAzjses9evpaAou81269Abrandon6Apiccolo1AazerbaijanAwahoooAseau55AhergoodBotloveAwhipmeAoutlaw1Amisfits1AbilbosAhogheadAernest1AhumanoidAc43dae874dAtaradoBomAminkApenquinAtest3Aseattle2AkenaidogAdepartmentA123123qqAbalataApinkeyAminotAdemiseAnattyAjune12AhimalayaApinkertoAbigballaAdewdropAbashAsmall1AchodeAtoonamiAfuerteAlawinaApeyoteArobinhoAberry1Amypass1AwonderwoAdancer2AnotmineA9ballApaycheckAjesussavesAbrother2Arodman91AdopemanAapple11AhammockA1penguinApugdogAmicmacAforbiddenAcaramonAjordenAprophet1Ablack9Ajuly16AglamisAninja9AscreaminAphilosophyAkillswitBeggerArebeldAczekoladaAw8woordAracinAhammettAjazzman1AbargeAanabelleAbartendAfinnlandAbarnabasFrdAjayneArhettBeinaA1justinAviper69AdemetraAligetiAdiana2AlawnmoweArockyyAab55484ApapasmurfAktm250Ap3orionAjazzedAcalvesAgloria1AbarstowAneo123Achelsea3ArockandrAbigboysAshellacAburntAdarkness1AhappyguyAjacoAgreenlanternApolockAuntitledAbattyAcbufhtnfApython1AnedkellyAsassy123AcamsAkreatorAlamppostAbonapartA8vfhnfAbatman21Ajoker777Arobin123Aventura1Apeter22Abattery1AphiliAbobbyjoeAyomismoApainkillAantiheroAcarriAspartak1922AboomersAgervaisAbeemanAcruisesAgulnarBoldenboAbazaarAgenovevaBlassjawAredarmyDshirtA1loveyouAbasketball1BearcubAnnnnnn1Auuuuuuu1Amarley12AwheatonAcoronasBhlorineA67mustanAbuddy4Apoo_Axyzzy1AreynaldoAinandoutAtazzmanAnormandAcousteauAhello6AspecbootAhiccupAjunior01AcastellAgoldiAmylesAfaithsAim2coolAlegion1Aredsox11AhotfunA0112358Abyteme1AqazwsxqazwsxAnikkisAabby123AscottmAfloorsAcornhuskAbunkieAdefcon4AclashAmarkpBykissAlinkinparkAsoybeanAculebraAfuzzieAcantona1AditkaAbeastie1Amessiah1AkissthisAbeatoffAtequilAcymruBheeseyCompAhejmeddigAredcardAbeckieAintermilanA1lightAcakewalkApitterAclustersBhasmoAosceolaApoolsideAreebAbeer69E1234AgobullsAchimayAyfz450ApimpstaAbernardiArocket21A000000zAenormousAanitAswansongAhelicopterApouletteAtheodoraAbellowsAcreamsAbelowAdolphin9ApaterAdarth1Acookie2AsmokeeA1ladybugAregeditAgood4youAfrance98AproutAkensingtAinspectAhangerApsychicAbilleeAscsa316Ablue28Admb2011AwithoutApeter69Brivate5AteenslutAbomberoApawneeAfroggAeleanor1AonesApiotrAvassagoAaugust15Aedgar1AthiagoAbrandon7AgustoAcheatingAtarbitBippieAlandersAbwanaAmauritiusAhithere1AflexscanA2305822qAnickeyAbillygAkawikaAtomjerryAiamsamAchrisgAnnmasterAbradleAoboyAbelladogAcool1234AgautamAdreamgirlAsuperman123AmanimalAensembleAhailey1AsimplAbaseball12Adirt49Aformel1ApornostaAamber69Adivine5AbichoAdooperAsuperdudeAarnie1AbrucieBiddyAfishbowlAwhitewolAdcp500BevochkaAlittlebearAsparky99Amary1AgoshawkAnothing0AsuckfuckAjohn55Amario12AdukiesAbeanheadAgoatheadAfaith2AjohnyAtigers11AcannibusApenpalAjohnnydAfastdrawAhalfordAnotmeAhefnerAdaddymacAthibaultApottyAmorriApromopasAcardedAtheredsBarawaApowerplaAwallpapeAmorgaineAbettis36Aaust1nAmatt01ApalmAthrusterA1themanBbigmacAliberty7AgreeneryAbigmouthDtAdennis2AstokerAdildo1AhangersAmarch15AjohndAwetworksAcrossroaAgunfightAbunky1ArockcityAtingleAheywoodAgordyButentagAdirtybirAkimboAwillis1AmotoxApepoteAbushwickAsharon69Amystic1AkinkAstatAkatiedogAgreatdanAhasturBoundogAtestererAschroedeArunninAmultipasAlizabethAchico123AlundAgillisAsayuriAkumar123AchannelsAshana1ApecosAbirdcageAracquelAwashearAshamelessAracheleAk1200rsAtools1AkissfanAsassydogAyellow5AoptiquestAbirdsongAforecastAkingssAtirpitzAbisonAlalunaAmini14Abobby12Acooper12AmistysAbyoungAsammy69AtoscanaArhodeAmodifyAcleanupAflagAsnake2Amymoney1AcntgfyjdfAblackfinFheartBrady1ArobotecAjoker13AgrimreapAashamanAwalsallAmotoguzzAkathiAmoney23ApeterkAwhoaAthekidsBemple1AlogcabinAthornyAgordanAbykemoAneverwinterAtwiddleAbreedAstevie1ApinokioAmclarenf1AstickboyAbloodlusAcintaAtorrentsAblueoneApussy12AboogiemaBnm123AdepaulAbluedragonAdelayAscorpianAfsunolesAjanuariAstandrewAdolceA87e5nclizryAjustin01AastronAflatAginger123Abmw750ilAstronzoAcanesfanAwelchAkathryn1AgijoeAluvsexAnomisA65mustanAshoemanAbritchesAstumperAkiller13AterrillAfortune1Ajojo123Bustin123AbobrikAhotdickAbocaAcindeeAbodieBrenAcer980ArafaleAdfyjdf846AfutebolApinarellAnepalAdude1234AjkmxbrAwilmarApepluvAzantacAfuckthemAmattiasBicky1AgiampaoloAdanny001AshakenApaceAbouncyApuppetsBancreasAtampicoAmickiAsupermarioAunion1AlollieBichenAmodestyAturambarAhammAusopenApretenderAchattingAeagle21AmyheroAkilledApandorasAhottunaAseverAroofusAbuddogAryan01AsatireAballs123Amagic2AnosaintsAmartenAleafAdukersAmccallAlovesuckAfillmoreAbrandy12AchevyssAryslanAkleinerAbuster3Barney01Aou812345ApaullyAconor1Bhildren2BarrionAlongfordApub113AsofunBhakyAchinkAmcknightAroisinBedhorseAfuckgirlAgordon2Anapster1Adoodle1Apanzer1AamazedAhebronAsasafrasApublishAbridgerAtoptenAmiami305AantrimAsecure1AtoscaAletmeinoArobotoAlesabreAgrizzyAvideogamAbruceyAtylerjAclubsAwales1ApointmanAgehennaAdaniel21AgopokesAranger98AabbydogAlou1988AsathyaAwreckAspankme1Abuck123AthankAstuntsAhammer99AartichokAgthtrhtcnjrAjimmy99AbushmastAfilipAsailormoAamershamAsamatAcoolfoolA1bullshiAmmmnnnAvoidAlucycatAbutterbeanApie123AvfrcbvvfrcbvAcanmanAmahatmaAlove88AmermanAbyrneAcgtwbfkbcnAelroyAlacrimosAmaudeAcaballAarisiaAmccainAcarajAdameonAteenloveApalace1Aseabass1ApinedaAtaratataAfittaAmarmaladAcameron7AmahoganyAhuntressAredwhiteAinteriorAnbibyfAjune28AlechefAmudslideAcanoneosAnaliniAkahalaAicemaAfinaleAriminiAemberAzxc12Aimage1Aerwin1AcarrolApathAgoaterAoctober7Achannel1AnaturistAchrishAkilmerAcatboyAshapiroAbeattyAjayboyAauthcodeAmaster0Arusty5AlatriceAsmith22Akicker1AsurfsideAglasgow1ArfycthdfAclementsAingersolAdaniel11AselrahcAdonna123Amaryann1AannamariaAtallerAbaseball9Asteph123AdonsdadAsystem12AmarcelitAwrestling1AteddAorange10AlancesAchokerAarowanaAsilver33Achris10AdelhiAatworkAhobsonAscoopyAmercedApalpatinAmusic2AdishesAsmurphBilverfiA1beerAstarkAcorneliuAdesign1AinsigniaAthestoneAcoolsAyoghurtAdrainAsinger1A5411pimoAdima2009AzimmermaAcowboy12AstalkeAexcitedAwiggerAsoxfanAretired1AsodoffAkolia123Aharley13Asarah69Adude69ByannaAgrillAacme34AsigmapiAbigloserA47ds8xAcougerArebenokAfuckyAcrenshawArobyAesteemAr1234567AjoshmanAsputnik1AcroakerAridgesAtittiAraverAschueyAlexmark1AsalernoAcestmoiAshereeAgood123Aaugust9AmastermaAhelterAlove4youActvtyjdfApasskingAsayanAoleg1994A9379992qAsamboyAphotograAaachenAstainAawesomAsleeveAquackerApooky1Acapital5Ahandy1ApoppydogAembraceAferrarisAclementiAkennedApunishAsinge11Bemperf1Amaria12Dcin1AfafnirAmarquiseAfeldsparAsthgrtstAtylenolArobert22AhassleAspootyAlovethemAdeuce1AkillemAthreadAshort1AqwertyzAkittykitAmonster7Afrench1Aginny1AliveoakAsilvermaAkoldingAclinicAsamAmama12345A1mooseAdnevnikAgenialApoopoo1AfloorAaqwzsxedcAmarshal1AgreentreeAqweqwe12AconleyApresenceBurple2AdruckerApentagramAhfnfneqAlolita1AnjhyfljAmargeraApumpkin2Abond00ApowerhouAemmajaneAterri1A1qazxdr5AsponsorAdarkhorsAsuperxAmineonlyAredderAelectrAtorridAjaylenAdragoon1AtimmAlotrfotr34AcaffreysAzvfrfcbAserinaAgladiolusAryder1AhotspursAboutiqueAdisneBriscollArussoAgettysbuAholeshotApixelArecoverAshazam1Aviper7AlogansAp0o9i8u7y6Adave1234AritualApeggysueAjameswAkoreshAtillAllama1AherberAmushkaAlovedAplant1AbogeysBaldheadAnestaAevercleaAdctdjkjlA1nnnnnAmuseAvbkkbjyArkbvtyrjA123321aaAterminatoArfghjyAmonday2AlolnoobAnextdoorAgigaAsantorinAhardestAemergencAawdrgyjilpAthefrogAflibbleApapagenoAboomerangA555555dAquietkeyAskripkaAtimbuktuA123qqqAkanatAmrbigAhardy1A123lol123D4qwerasdfzxcvAgorditAkorolevAdiannAlionsdenApappnaseAtweakerAxexeylhfAdouglaAqazwsx12345Astudly1AarenroneAitalia1Agateway9AjesuschrAaxelleAeclipsAterrificAedibeyAmoney69Ahonor1ApowerstrAbigsexxyAthesims2AdrillingAsuckit1AdthjybxrfAlbvfcbrAthrallApanasonikAoinkerAroryAemblemApolkaudioAxbox36AasilasAnicetryAleticiAnerminAsalimAagsharAyeehaaAhockey22A111luzerAmongrelAboognishAkierraCmonoApbyfblfAthx113Agtogto43AlidiyaApepsimanAjason13AeiffelApoloniaAfathead1AnolaAstation2Aps253535Adragon666AmashoutqAnfyz123AalstonAdumbshitAtoyota91AstruggleAnewloveAmuttlyAgonzosAselassieAgatinhoAshmuckAiddqdiddqdAbikmanAtcglyuedBoucheAapple5BssmasterAned467AjamboreeAyjdbrjdfAelise1AstockholAtoplayAmatrix99AsofikoAa1b2c3dAthvfrjdfAemilkaAvalenokAbananzaAgribbleAsat321321AespnAtintiAfeleciaAhank1AquintanaAalexandra1A1234512iAbimbosAjorge1Agfgf1234AapocalypAb0n3AspiriBtarlineAraffaelAgastoAfabfiveAsharonaAlovebugsAmarcus12ApikachAreapeAcepseounApinkpussyAcityboyAw1w2w3A321ret32Ababyboy1AfastmanAmorrisseyAnintendAmickey22Asasha11Ajkz123Anokiax2AguilleAnilesAferdiAsovereigAremiAferrellAqwest123AstiefelAozzy666Aagapov58Attttttt1AjunkfoodAnfyrbcnAprofilesAironfistAsqueekyAhjvfynbrfBondavfrCmer69Apens66AcockgobblerAtimatiAdad123AtornadosAoleg123Adude12Amario64Arichard0A12345qqqAsummonerAmclaren1AgilgameshAdiavoloAcvzefh1gkAmarleenAwm2006AhardguyAgalleriesAnokianAmaks123Anikita1998AlusterAbirderAlucas12ApicaAblarghAtetasAfurkaAgodheadApowerrAkumikoAmamulaAcimboAdexturAmollAgassAshithappensAgallusAsergio1Acheetah1AlindyAcornishArudigerAaimee1ApoconoAtopcopAiloveboobiesAhambone1Aabcdef12AklosterAgeorgyAirina1AgigantAhereiamAjanssenAsommarAnick11Airish123Atree1AghjcnjgbpltwAshahrukhAlongboarAmargaret1AvfnehsvAluigi1AnomamesAputtanaAtr1993Aw1234567AquantexAmikeeeAviktoryAphineasAhammertimeAmayfloweAavr7000AteeterAheckfyfAjndfkbAhatmanAcbr600f4Atv612seAjason22AsmackyAbliss7Adeskjet1A0cdh0v99ueAmossbergAtuffAmiracle1AhuliganAcheezAprecisioAkarpovaAnapkinAroman777Ammcm19Aklaudia1AvfvjynAroadrashAnaraAmedical1AcrazzyAnokiaaAperfectionAlilloAnazarenkoArfhbyrfAhjvjxrfAdctulfArevelatiBfnfhbyfAlove2010AimportanAjordanaB1234567Azaqwsx1AshaqAlactateAjesus33AburrowsAmike34ArafterAgcheckoutArfgecnfcerfAmammyAselectorCcuredAwootenAlacroixAminddocAsweeetAmaierBobilityAsudhakarAjulijaAmalcolmxAkamalCkosjaCrimApreetiA0101ddAkisaAvlad123AfizikaApangaeaAyfl.irfAl123456AnanetteAdescriptionAaccountblocAoctavioAhardwareidAtidbitAscriptsA287hf71hAmrmagooAromanenkoAmkvdariBdmaiwa3BsinfoAosipovAtimt42Aybrbnf_25AnurjanAgfccgjhnAsvetasvetaAhavvocA123321azAlosbravoAsanekAthd1shrAshashAimaccessAgxlmxbewymAn8skfswaAufdibyjdAbublukA4060A6001A10078B4028B7098A50000B4354A78965A115511C9966B23592D699D978C4365C5690B37955B43000C4444B97200C8020D800C9410A204060B24455C8822A316271B65214B82563A414243B41232C4888B83422A545645A665566C6444B87887A747200B89056A880888C7766A1010321B233215B346795B512198A2022958B121212B525252B797349A3816778A5556633A7085506B506751A9124852B556035A11119999B2457896B5975391B9372846D80018C822891D55891A46466452A51502112B5495746B7699434A61808861A87062134A98766789A159357123D951159A777555333A999666333A2468013579AdclxviA1digitalAa8kd47v5AsupercopBtallAenfantAgentlemanAssbt8ae2AjackfrostAdoda99AwhitAchevyyCristo1AhenrA2500hdAmouldAthemisA000008AshinchanAwinderAdimesApetermAqwerty09AfioccoAnitsuaAhappieAibelieveAmchaleAknopflerAhanleyAparsleyAthecure1Ahorizon1AchuckoAwalter34Abuster88AfastestAwendigoAplatinaAfordfocusAcontroAverymuchAoldpussyAbmanA1bbbbbbBeeeeeeeAeasy1Azachar1A1xxxxxxxAjasonjAbob111AgreeseAarlenBl123456AoompahAscottbApurdyAachimA121ebayAarzenAgoodjobAshadow88AbigtimAatep1Bustin2Adragon98A1asdfghjAcoco12AbertoneA123testDboots1AtplateAdav123AopalAsss123AdivadCetmarAsoftcoreAhathawayAcamilla1ApenfloorAvisigothAleetAbullnutsAelixirAmark13AsingapurBcotlanBhadow14BamoAmatveevAblue92AaliaAelfriedeAanimal2000Acarlos6A7imjfstwA9hmlpyjdA478jfszkAmerlin21AhamburAjheregAalgiersAspecterAracismAbungAjuly1ArefinnejAnokia7070Ajimbo69AimhomeAtobias1AcrazydAlalitAelvesAlozanoAdeedlitAnicksAdamselAlichkingAhubertusAsuspendApantymanAmomanAnewyorkeAvfhnsyjdfAliza2009A1monthAabnerCraBdolphusAbunyanA1rockBbigdaddBalexAbombsA2ballsAromperA1sarahAgableAdeliteAlittlebAplainAbreederA5aliveAtaprootAmalariaApaolo1BoolsA1packersAhammer69Agolfer11A1badgerAqwe1234AsimbacatAyodaddyAthewolfAlightbulbAinoutAliarAigniteAaltmanAfillesAliloneAarnolBngeliaAbuffsBeltAhoffmannAxxxyyyA123321456654AdecentAcurraheeAemanueAnicole3Aholly2AtruantApagesAaassaaApauleBeniAdkjfghdkAstorkA1hondaBcreativAa6pihdAsd3utre7AchkdskAvoiceAwrongwayAsassy2AreinerAtorquayAwunderAdemetriAqueenas8151AbigbriAdamian1AjustforfAmccool24AimaniAhedj2n4qAofclr278AdudderAmacross7AjohnnnAforplayAgilroyAdotsonAjeff12ArosebuddAtwotoneAschwingAwewizAjabroni1AdukemanAangeleyesApipeutvjAdormanAlamerzA2h0t4meAwallstreetAtiburoAgoodbyBlebAmooresAburundiAtabletopArichard9AacehighAbendisAgorilaAbilly5BellybutA12345678iAinvernesAmediasAconductoAtootingAmethod7AbarrabasAsoftball1AhooksAvoorheesAmoonstafaAbarabbasAescort1Algnu9dAmustaineAcalimerAsummer13AaerdnaA1drummerAalbert12Atony12AindianerAscanmanApanther6Ademon6AticoAbyersAcopeApeteraAduramaxAsissiAarseniiAdossAaccobraAscottsdaAbrazenAhymenApoppiAdukeyBagoAerathiaAgeraA44magAperthAaaazzzBdelheidAcamel123Ajackie69An7td4bjlAlaurencBukas1ApekingAloploprockAmarkinAissmallAgiveitAjosh12AricheyAgborv526AyaglasphAblessyouAreferAdsmithAacer12AfranziAmarietteAcapoAmistermeAbineAcheckm8Apussy6AconnellA1qazwsxedcAwhynotmeAmonteiroAcageAdottAakronA125wmAauntjudyAwaltripAficaA1234567890987654321AblofeldBarnacleAmarlins1AfeliciAlegs11AsigninAtrottersAflyboy1Adudley1AakumaAjoxury8fA5speedAfifa2010AgotimeAtrim7gunBoday2AlarkAdonaldduckAbuster123BrandeBooyakaAgeralAandrea12Acapone1A1234567890qwertyAbarthArabbit66AfeedsAlomondAabandonAbooleanAmonster9AhydeparkAopeningAdevil69Ageorge13AazrealAconnecteAmontseBatthew5ArushmanAjhrl0821AhandilyAkosssssAnightfalAsixer3Aphoenix9Aanthony5AosloAarmani1AkaufmannAgemeniAsnowcatAkissedAflippeAenlighteAdavid21Aelmer1A86chevyxAf14tomcatArelicA29palmsAkoichiAmaliBeltA98xa29AygfxbkgtAadamsonAturbo911Apussy5AjimbAsvenskaAgreyhawkAkeriAvolanteAchristiaanAgirls69AanchoratAlovessBilliAsanskritAajax01Aqueens1AhanfordAgaymanAendingAgimmesumAbigtexAeatmyassAdogbert1AazimuthAtruegritAjenifferAtarga1Aedward11Axenon1AtottiAq1w2e3r4t5y6u7i8o9p0Ahonda450AgigemagsAa112233C59357Bnna1982AsammonsAghibliAbiedronkaAdmitrijAgreshamA12345678wAtechn9neAshihanA6gcf636iAprimus1BlayhouseAgangster1Aash123AjerkinAtrabantAguitarmanArakasAsportageAdenver7AbogdanovaAchevy11AghfgjhAhesoyam1AasherAnottinghamAmorganstanleyAbobbytAamanda10BirbrushAhubbaAmilburnAcharitAfreecellAastronomyAwarpAcurlewApakaloloAhockey4AvfrcbvjdAbullardAnevergiveupAanupamAchivas1Aandrea99AminimAarenasAromansonAnepentheAmorefunAbelaAgoncharAmadhatterAle33pxAfredrauAaccess88AeugenioAimpossibAscrappAmoreliaAscratch1Ahollywood1AstewarBacrificAbmw750Aaiden1AsiffrediAnantuckeAdrew1AacmeAwiley1AkravchenkoArochesterAdarkstaAsanantonAmary69Alooking4Aangel007AbubblAwearAadamaFsAbmw328Amother12AbillaAexcaliberAbandmanAhello101AmishraAsawtoothAa1234aAdawid1AbonnApistolaAtheriverAalfonseAbasket1Asophieh6AbluewaveAkoketkaAseymurA123321qwAborodinAfelicitaBrederAazizbekBdiosAbankruptA1arsenalAbirthday2AedcwsxqazAmark3434AsybaseAvalmetAbackwoodAsunday1AmolodecAlarousseAspawn7Anokia5200AtaylorcAdeflepAmamaligaAkajlasAwowlook1Amanchester1Atelus01AmotelAqqqaaaAnatasha123Acasio1Asys64738Aalex1974AnostradamusAtrish1AnewbornAal1716A654321zAepervierAafroditeApoopypanArecon7Askydive1AbokserAjawbreakApenchairAkaretaAaldebaranBkinfeevAsilkeborgApensacolAg0dz1ll4AsanctionAjesuschrisAnn527hpAdollaAmilkmaidAterrell1Aepsilon1Alillian1AcrhbgrfAmaxsimAcathrynAfelicidadeAezequielAmatrixxAekbnrfAjunaidAamiraApolly123Anumber8AvaffanculoAbotanikAjhnjgtl12AarxangelAmalyshkaAbarsicApetshopAfhrflbqA0123654789AallthewayAzoltarAmaasikasAsunsetsBolid1A59382113kevinpAcacheroAresortApassword!AkarizmaAashramAtarragonAmama1964Ajoshua0ApartAsilverstoneAchaparraAtetleyAhavokAbumsAsaraannApipemanAnumbA1chesterAreset1AmassiBonarchsAasmodeyAsarahhAzapidooAconnor11Asane4ekAjourney1A9988776655Ablue135AjnrhjqczAdaggersA123vikaAilfordA1legendAanna2002AtombBsunami1Arolltide1AybrbnjcbrAportisheadAfree30Aredcar27AfootieAmoskwaAcougars1AblackhorseApetertAferrinaAcstockAav626ssAmacedoniaAsi711neAroblesAdtcyeirfA1234567890pApicture1AcolumnBartagenAvolodiaAfolgoreAalex1975AkatemossAalegnaAburzumAalex1981AdigitexAfktrcttdfAyfxfkmybrAevropaA123654789aAsasha777Aalena1AleshkaAglashaAytpyf.Abloody1AanconaCderAhaustoolAcbljhjdfAalex1971A134679aAnorthsideAskyesethAalex97AfrontosaAandressAdiamond4AluansantanaAbloomingAscudderArondoAtimaAfredoniaAanyaAvaleria1AcorriganAjawa350AcontrasenaAelmwoodAqwe123qwe123Achange12Ayellow3AcubanaAofcourseAromance1Agenesis2AfuckthemallAdilaraAalina1995AlubimayaBisicaAcardssAhappynessAweaselsAparanoyaAhifiveAvbitkmBiniciusAalley1AcharlestonAtitaniaAalliAboing747AalliesAparliameAhunglowAlandoAbossssAwomen1AufkjxrfAmamadaApatientBooksterBarapetA1hardonAshavonAadrianna1ApaintersAferreroAloreAstargirlAmaristApennydogAonlyone1Aamanda123Bshley123AsatyamAgreen45Afucking1BestivaAbuldozerAaxiomAslenderApheonix1AamigasAnegritaAmeduzaAheavymetalAbobrovBebAashrafAsargsyanA1flowersAapril15Alaura2AifoptfcorAmiyvarxarAlovableAanahitDisAtruelovAflaviAvarshaAdekalAstimorolApotapovaAanatoliAlubimkaAfylhsqAcathrineAdorcasAcarroAmazepaA147258369aAqw12345Aandrew99AfargusAhalleAclarkkentAandrey1AgjkzrjdfAbetmenAyfeiybrbAbumholeAluvbekkiAsparky01AholcombAderrenAjakesAamberdogApersona1AmultiscanAbeloved1AhotbitchAadvertAvarelaAdannydAtruskawkaAangel17Asascha1AeatmeatAv00d00AtagadaAanilAyoshikoAanime123AsannaAoutpostAantoniojAflyvholmBhutynbyfAbernerAaaa123456Asone4kaAdonkeykongAgtnhjpfdjlcrBowronAhurryupAintoAlovepussAsusan69Bexy22AownsAavtoritetBntonia1AconnyAninjutsuAred100Adima777AmansikkaBodem1Aodt4p6sv8Azxcvbn123456AgjpbnbdAimacAapache64BessedaiBpertureAsultryAmonitor2AtotenkopfAdogphil3650Achicago5Afine1AarabianAputanginaAlove15Atony45AbabyphatAartfulAjason11AhanibalAdontgotmAundoneAverucaChxbrAarjunaCkashaApouchAasslickeAphilippinesAcantinaAwideopenAchitraArun4funAmoleculeAunseenAbarschAhakunaAdavinchiAzxcasd123AscraplandAmethanolAbmw328iAfrog1Aspiderman3Aphezc419hvAimeldaAreviewerAblassAwerty123AlassiterAcomicbooksA64chevyAastonvAzcxfcnkbdfzAperrineA1videoAborealisAa333444Azsecyus56AawakeAbigboneBooboo11Ad50gnnArjirfA4815162342qAzzaaqqAthugloveArkellyAbadderAletoAbear13ArecessAbaerAraptor22AbltynbabrfwbzApestBoacherAmedtechAbaba123Avaz2114A1exploreArobbobAamerica2AricciAmasterbaAbajaBmw528Anelly1AgreenlanAchopsueyAkokotAbalance1Apussy4Amoondog1CiseBeekoAbardAflynavyAhaymanAcotton1Alayla1AkatuhaAdestiny2Ahappy6AironfishAtracey1Ajasmine7AbetrayalAmcgradyAballroomAgeethaAkronikAchittyAoneputtAhumpinAstonehengeAlazer1AmunchyAzachariaApedalAbananas1Aflute1AbrilleA1frankApuntoAwarhammer40kAtnt123AboxmanAhemingwaAcjymrfAhello23Acobra12Ajordan45AfurnaceAcantoAgeneraleAmine11Barch17Akiller77AwilliamjAjimbo2AlettermaAwar123AolsonAsteroidApeanut11AseamlessArugbymanAplywoodAdanyAfranco1AkrissAexecuteAxanthAangeldogApottersAhatrickAshenmueAgrandam1AlayerArosehillAtuckeAparsonAzackeryA1cricketAfencesAswift1AkinglearAcessna172BallaAbaroqueAgbpltw123AshadowmanArstlneAmockbaAolga1976Apd25Abowie1AmyhoneyAguadalupeA1bastardAbaseball7Acottage1Ahomerun1AbleuAspike2AgreendaAmonkeybuttAfartsAjaysAsyndicateBomething1AcraigerApasswordstandardBierre1AdorotheeAbastogneBrandon3AiamgreatA358hkypAoverflowAsiddisAcoffee2Amarcia1AchancyAfairchilAhitsAbatmonhAdoodyAwildonAbatteriesAtom204AvonnieAexciterAsundogAgti16vAottomAratarosAtonchinAjoesphAchicken0AmissysAdell11AbodhiAmaprchem56458CgnitApaswoordAleedsuniAdance123AbballsAppppppp1A1kkkkkBlllllAcity1Ammmmmmm1Annnnnnn1AelessarAbobo123Auser123AbobolinkAgandalf0AbeckysA1giantsAuddersAfreezingAchappieAmaddawgAhextallAamiga500AhotcuntAscubasAdietAfurtherAinfotechAmoose69CtoxxxArightyAgundam00AspeckAbermuda1AtylerdAmaerskAvendingAblightAcameloAbackd00rAcheyenne1A1kingAdrummingAtgbxtcrbqAlovezp1314Abuster69AtwistysAwhatluckAriptide1AkaloAplaygrouAconstructionAtangsooAbreweryAthankuAortezzaAkillasAbeatboxAslutfuckAostseeAbeatmeAkiddoAcorpAmomoney1AeagerAfractalsApolkadotBrince11AseemeeAmilnerAbigtittyAformAkimberleyAslaveryAoptimus1AiluvuApickensAlondon01AsteamboatAemelyAcomfort1Asammy11AbriancAlitebeerAhampsterAsmalldogArealsexBomannAcartman2AblastedAjeep99AsunburstAengelsAtoby12AmugenAalbertjrA0101198AwantsexAegoisteApjkeirfAmaddog69AobjectAbelinda1AomniAelvirAgammonAemma01Aawesome2AmaximuAthickerAstokedAcosmodogAbijouxAfallsAbeltranCn1234ApoopedAfatmikeAmamadouAbenwinAmichouAbendAmedicusAjustine1AbendixAmorphiusAbiplaneAgoodbye1AbrillianAkirbysAwroteAsnaggleAkenjiAlankfordApr1ncessAglass1AlaotzuAnuaddn9561AbennerAmetalheadBamapapAjollymonAfield1AjanetsAtrompeteAmatchbox20Arambo2AbenzeneBozo123AlifestylAbobiApachangaAdroolAbuzzwordCggAgfhfpbnAadaptecAhallooAroslynAgrenobleAmariana1Agreen420Aspring00Ahelp123Avitalik1ApapasAgavrilovA123qwe1Asteve22AdermotAindigAcody11Bassie12AunderhilAfireplugAbobcat12AovercomeAbruce123AknowlesApooleAg1234567Ausmc1ArustAbrianwAlokomotiApegasAnightwisAsleddogAred333AjamesmAonizukaAmelonyAscooby11Abrody1AnoirAobvious1AkeltonAbasuraApolicemanAjameseAbautistaAzzzz1AbicepAemporiumAkolortAchevy3A1nascarApatriots1AchrisreyApadawanAeatherApinky123Astud69Athc420Agolf1234Birl1AfucktoyApinkflAloreliAbigbubbaA2letmeinAilikepussyAgodsgiftAjune14Achevy69AtechnicaAdummerAflindersAbouvierAelway07Ajames6AbigeAliljoeAgravedigAjakeyboyAlongboardAhighspeeAsaraleeAjadedA12inchesAgrizzlieAhockey69AbiggumsAleghornAbigjakeAtomtom1AgoskinsAjekyllAgaffneyAmackinBonkey9Anigger123AlilmikeAsnappy1AbigoAgomangoAmantarayAwhiteheaApushAray123BedhawksAnewcomerAhondas2000Asteve12AdicksterAruddyAskinny1BunburnAcumshot1Abonkers1Adoors1AconvairAkyjellyAflabbyBord11AthroatfuckAimladrisAhimmlerCkerAmcnairA85bearsAhotsAwaiterA12playApartner1Ajuly21AnibiruAcommunitAmitzi1Aalucard1AlathamAbanthaAjackoff1AmadnesAclittyAspider10AcabledogAfigaAeaglemanAtidwellApeggieAdrachenAlzhan16889Atight1AladedaAchestAbittenAigor1994AunisonAchamp123AbrooksieAfrogman1AlasseAbubbamanAaugust22ApassswordAnoodle1Astang50Acoco11Abrennan1A1cherryAmagic7AtwinturbApamplonaAtangosAclawsApastureAslingAboycottBaseball11AwelcomesAscc1975AnailedAkrilleAcunt1AharumiAdouchebagAfuhrerArossignoAnuggets1AyoungmanAblazingBilllyAclothingAdoggy123AcraigsAkrakatoaAsnowstorAchurch1Aorange11Achester3AmotdepassAzymurgyAleytonAharrypAbloomersAwisperAdale3AequineAselectaAfatman1AhumansAfuckuallAmamasboyAzaireApurple69Ashopping1Adelta7Amoon69Ablue24AmiyukiAjuvis123AnoremacAicewaterAdamianoAblurryAjoshua99AimaginationAviper01AdoodArammanAapeshitAcrimeaAkenpo1Ashit12A007000Arichard8AlompocAestesAurbanaAirene1AquadAmcclureAfreedom8AnephewAcoppersAflash2Acarrot1A2big4uA5nizzaAlateniteA789456123aAimperiaAbubba11Apasha1AnikolaevnaBokia6131AevenparAhoosier1AkwiatuszekAgtnhjczyAfjdkslAinter1Anokia6500AspuddyAkiba1zAvova1994AchiconyAenglish1Abondra12AmeatwadAfatfreeAcongasAsamboraAforeignAstonieAbustaAohmyAfahayekAboobs69AsnackAwriteApiper2CmphardAcootieAbellunoBooty69DchieAgreen4Abobcat1AwintermuArjnjatqAiberiaAbornAj0shuaAbeckham23AdeleriumA1rabbitAcaseyboyAsleazyAredsox20Ajustice2AdebbiAvenomousAscorpiusAboundaryAeditAgondolaAstabbinAtoyboxAfight1AdennAva2001AladyloveAsnifflesAeintrittAlanesraAnavymanAslangAascentAjessica3AvanhornAplatinuAcookbookAdarbAstorm7AbradburyAkanmax1994Athunder0AgundogApallinaAduck1Aroach1Acubby1AholdeAisbestAtaylor9AreeperAhammer11Acompaq123Afourx4Ahockey9A7mary3AbusinesAsocorroAwagoneerAdanniashAmarkhamAdavid11AinfidelAshockeyAcaringAhammer12AburlponyAram123AplatonicAnels0nAangel77AsarcasmAkensethAhasselAmax1998Ascience1AlawnAcabin1Aox3fordAplatiniAsparkle1Bervice321Achristi1AbrunobBot2010AretterAcooper11AiraffertAguillermoAhammieAgnasherAcleanersAwooodyAtiedomiAsveiksAwifey1Ayams7AjohnnaAflipoffAsnazzyAabc123aAjanieAdave55A1christiApotholeAman1Ajack5225AvwpassatAburltreeAmorningsAcosmo123Athomas21Bonto1AjadenA1snoopyApocusAcaveatAsubzero1AjuliasAsansonAoaktownArodderAbullrunAhappyhapAyasacracAdiscordAcomaAgreenhouseAshampoo1AreiterAqwerty32AtizianoAcandanceBoloringAtwincamAsupermomAeasypassAporkpieAmannixAundernetAendeavorApablitAwiremanAtalaveraBobascoArodeosAvaultAkarmannAshamelesAtaylor11AchippieAguthrieAretracAbrevardAgamemasterAbpgjldsgjldthnfAcassisDtingAniagraAdearbornAstrikersAeffectsAxiaoyua123AwriterspaceApasswd1Cntera6Atttttt99AmanagemeAhornets1AsosexyAciccioneAregal1AemokidAchaikaAjumpshotAaekdbAsharperAclockworAstarrsAkatiebugAchillsApincherAreynaldAguybrushAmusic101AtabacoAfleurAmaxcatAewing33Acontrol2AtoadmanBrixie1AmarmaladeAbeerssAarsenal0Ajasmine3Aspeedy2AkamazAclancy1AjanneAcooper2Adeuce22Ath0masAzpflhjn1Ajimbob1AhundenAclawA1rocketAelbertAconfettiCorslitA12monkeysAslavkoAmatrix123AhelensAearlgreyAshabazzAwildchilAthroneAcountessAanthroAcovenAmarzipanAcoyote1AsofakingA1crystalAgfhfvgfvgfvAeetfukAmouse2Agonzo123AstandingBolusAbeagle1AkleptoAcraig123Butlass1BramAjimbo123AflappyAsignAmillionaAsactownA1horseAkryptoniteArockstaAcreativ1AdarksunAsavedAwisteriaAmustang67AsceneBanjosA69erA123456789jA08080AeinsteiAsofiAmarcos1ArepmvbxApass1worAqueballAspardaAfondleAroy123Amatthew0AhoyasaxaAposseBunchyAworfBaringAgamgeeAmethodmaAsaladinAlisaannAholinessAprince2DsmaAdamilolaAkolawoleArichard4Ajesus4meAlostboysArabiesAqwerty789Ashadow10Amarge1AsamarAatwoodAghtlfntkmAbarabashA1luckyArugby8Atriton1AcnfhsqAkasiaAtigerfanAoliver2AmoparmanAcuddlyAizzardA9z5ve9rrczArocker1BazerAjackmeofAmamma1AringwoodA1gandalfAkahlessAsplattAdisableAcathayAtickledAsexy21ArbhjxrfAgreta1ArustyboyAmoodAfietsbelAhitchAone2oneAdippyAwalesAhotshot1AcynthiAacheronAev700Agfg65h7BoldenboyAd1d2d3AkgvebmqyAvader123Aslava2Agizmo2Afalcon69AatheneAxfhkbrAscarletsAdogman1ApfhbyfBongo1AdopamineAlaverdaAdumbfuckCke12AgraphiteApimperAraqueAtigers2Adimo4kaAfiveironAwilberAjade1Ablowme2Amine69AkatyushaAgreen55Asnoopy69AhailerisAdandelionAjumbosA6846kg3rAdenis1988AtopnotchAskankyBpinnersAazerty12AjerbearAassass1AprintsAintercomAcheezitA1rainbowAcaritasAbrondbyAfifa2011A1q2345ApioliAashlynnAlooking1Atyson123AkramitAwindwardAmorrowinAchangeme1AgdanskAlifelessAdarcyAfaberA123qw123AyukikoAlexus300A12345abcdAjungle1Asword123Ajanus1AwetsexBharfratAbespinAheavymetAmountainsAsoarerAandiamoAgfghbrfAlfiekmrfAparaisoA1q1q1q1AtlbyjhjuAd1234567Asony12Awindows2Adavid4ArattlersAhersheAdavid10Apalmer1Aworld123AsuperdavArothAgruberA1golfAanadrolAhauserAdoloreAspartacusAjan123AlarkspurAtashasAmudboneAblessingsAlexxusBocAhippo1Ais3yeuscAdobieAfearmeAqazxcdewAcannon1AoakvilleAnhfkbdfkbAsugardogAenigmAnothanksA1996gtaAdwellsAkalleankA5678ytrAujhjl312Ascanner1AfourstarAwhomeAilike69ApartymanAstar1234AkissaAjoshua19AstevehAbrickyAkotovaAboss429BdfysxAnotchAivan1985Acanada12AkappamanAchiroAsahalinAfordgtAdemonaCn12345DiAgaudeamusAsaturAviviaAkolonkaAtaganrogAgashA1muffinAstuffingBoccer19ArosebushA1asswordAziffleAhannah12AskyfirApoker2AfrankeAdimon95AlambAmailerAdanangAzse4xdr5AgussAkaizerAghjtrnAqwertgfdsaApyramid7AuplinkApriscaAcommandosAsloeberAfuckit1AqscwdvAdiapasonCnamitBrumandbassAhanswurstAyfcnzvjzAdinky1AtoritoBulipanBsmithAdixon1A0147852AdlanorAshavkatAtoppdoggAflywheelAxxxjayAstaples1ArockytopApewterAmixersA7777777sAmaguireAdupreeAmarino1AfiendAhuskerduAsokolApilsburyAfatbitchAemma22AdonatelloAtamadaAmesohornyAdomingAgramAmike99AsuitcaseAkailayuCka22AstuffedAbrascoAmanchaAuaeuaemanAdonttellArifrafAsergei1AindustryAwolleyAgunny1Asurfer69BafadoB0ccerAgreeAtallestAiampurehaha2AdukenukemAsamatronApussykatAtrekbikeAstopperAheadhunterAracerx1AschenkerAbounderAsemaj1A19851985pAptichkaAmunchoAquarksAohlalaArf6666AfelixxxxAmickey2Acarpet1AbuffalAscooperA1falconAeagles12AshadowfaxAbrandnewA102030qAshocksAeconomistAarmastusAgranvillA134679qAmunkeeAelamanCena2010Amaks2010AgerberaAjones2Amamma123Aqwer1209AdontforgAwxcvbAkevin69AtdfyutkbjyAsurfeAjkbvgbflfAkolosovApeterburgAq1a1z1Bazxswedc123AfootslavApower666Ariver123AlimitsA456asdAhallo12Avlad1234Afreedom0AkafedraAhunnyArestoreAisaacsAnastya2010AmaremmaAflorenAjayhawk1Afoster1AcounteAsearockBierrAmarqueBexicaliAdead13AmathieAstargatAhesoyam123AinvisiblAmorseAgreen17AtupacshakurAfyutkAstartreAghjcnjabkzAdecembreApenguiAromantikaAqwertyuiop10AnoonAfarrierAracketAcheetahsAfatgirlAplaygroundBositionA1989ccAshaloAredsandA7777777zAhfcnfvfyAassasinsAhollyyAengine3AginnieAcvbn123AjpthjdfAdune2000AnanoAzxcvb1234AgraziaAfevralA4rzp8ab7AwaratseaAnokiadermoBjhvjpAbordenAmichikoAblankmanAa123654AwallsAabkbggAjames22AnadanoA1gatewayAhourAcolbertAstinkyfingerAcuntfingerAlittlewhoreA12stepAflashnetCetch1Aultra123AlittlegirlAbladezA123-123AblackmorAframe1AbusybeeAfuckyou8Aschalke04AwhalenAsukkelApretoriaAtanushkaAschecterAmike12345AturnAlarinaAheathenAc00kieAfuelsAjasmin1AgroundhoAapril21Afalco02AkarelAbastaAjuttaAsexfreakAhomefreeAsnowhiteArougesAigor1234AmasturbateAblackhatAvoivodAbuttheaAgbljhfcsA24gordonAwinamAsoniAnicolas2AsuprasBextimeAgridironAhelgeAlosfix16AilovecockAred222AlillAcartmaAqwsazxAblue10AsanycoAmileAturtlAzwezdaAcjdthitycndjAviper12AdewarAhomeroArockbottomAsouthwesAhazeAglock40BavaecA1s1h1e1f1AchinnaAmariamiAshandiAgraftonAcondosAfyfnjkmtdyfAheidieAgouldAenkiduAdugan1AgintonicAkonnichiAmohanAgladAplethoraAmaestro1AalabasteAqazxsweAuhtqneyuAsuperheroAguy123Atiger8AgusevA4077mashAvergesseAhooker1A1qayxsw2Ajeffery1CrrodAsheikhAkkk666Apele10Ahiggins1Aterry123BoccataAsexytimeApostieAthespotBroopApedritoAhome77AleiaAferraraArambosAkat123AsyrupAlimbaughAeybdthcbntnAqazwsx11AfktrcfylhjdAjune26AravshanAslayers1AmobilaAtracy123Aweezer1AkirpichAgreatwhiAkompasAformattersAespinosaAirina123AmetoyouClnikovaAsaqartveloAverondaAjessica6AkmdtyjrAtautt1Ajake5253AsewaneeAzimmermanAvakantieApillAjoaquimAroanokeBapemeAlovesickAcalenderAjossieAtraxdataAflyfishiAmaktubAoutbreakAtedbearAayi000Ajordan18AmaitlandAthebeatlesAmadmax1AspurssAmynewbotsBichaellAzagadkaAcjfrfAmandarinkaAthekiwi1AwaleraAkbpjxrfAvillevaloArunfastAmariupolAlikesitApornloAvishalAsolomaAnfnmzyrfAodinthorAtriadaAicam4usbAcompletedAvfif123ApartsAfancy1AnetnwlnkAilovelucAmaniekAluxuryAmashamashaAadaptersAraversAwebtvsA1mattAbodirogaAnetsnipApchealthBngfiltA413276191qAlennon1AasdcxzAprotectedAsavinaAperformingAcorperfmonsyCntrollerApredatorsBaulinkaAservisAkrimmlA25563oAtrevogaAwestinArichiAtalonesiAvova12345Afjnq8915Bylhtq95Adei008AsaveliyAneel21AwaferAvladimir1A02551670Atony_tAzavilovA4030A5001A6070A10020B5058A26058A54545A77879A109876B17711B23888C4536C5000D267B35642C6900B41592C2500C5678C7456B59000B65432B96100C7010D101D700C8505E20C9020A201980B23355B58046A311420B42500A420666B44111A500600B11647B43211B52255D861A645202A777123B89512A888889A963214A1111112C69900B231230D7654B357924B597535A2580258A6942987A8520456C38622B807031A9933162A12213443C758698B3467985B5253545C975312B9216811C801982D21983D31985E3891C921993D32916A24688642C861793A31021364C359092B6985214A55378008B6836803A76689295A112358132B23987456B47369258D852963A213546879A794613258A824358553A987654123A1234562000B346798520AshanteAdeadmoinA6043dkfAroastAcoonAbigwavesA0080AgameplayBomesA%e2%82%acAquintainAlommerseAcentraAspook1AreppepAselurAkpcofgsAjockstraAporsche2Aavalon11AjennykAcommoAnosrednaAswizzleAchrisblA4speedAbarbarossaAmadarchodAtime123AkatoomAbebetoA48n25rccAcentricAnounourAmerry1A1861brrAcaptainkAdubesorAfriedAyawetagAoglalaAkontikiA1sexsexArhfcyjzhcrAkareAmonica01AlockedupAbertie1AschnuffCuba10AbobbybobAnittiAkarunaAtimexxAv55555A1ffffffBjjjjjjBzzzzzzBiiiiiiiAbigassesAsorrelA****erAluckystrAolafAweihnachtsbauAhoppieAnetAagateAmaticArufus2A1234567892000AfredricAjamesaA1234567887654321AnikosA1abcdefAjaxsonAandrew17A12345678dAflippoAspandauAcrackpotAforcedAtoshiroAn0th1ngA1spankyAmaxA1asdfghAdino12Alucy11AerdfcvAmiceAbasiaAspasmA133andreAchingadaApurgeAlitenAclock1AfunA10293847qpAparksArmfiddAa22222AgoranAz3cn2ervAhazel5BullAwwjdAbieneAenhancedAlovelandAmaracaAkiddieAcentroAdaseinAmaria3A8secondsAbeetAcrooksAgageAanselAdiablo23Asalsa1Aace111BnonymerAmahaAlucy1Amanutd1AtevionAweetabixA2000jeepAgodlessAabagailAmalloyA1fishAglock9A1sucksBmontanaAexpiredA1vaderAmobile1Aoldno7A1rachelAbr1ttanyAgiganticAlickme2A1tigersAlaminaBeggyAreikoA1augustAstigmaA2wsx4rfvAogoshiAtampa1Agirls4meA1irishAjames4Acqub6553AbaldeaglAandy2000AbboyAdweebApietAjosiewAcabbagesAtaniAsexybeasAtruongAkraftAicebearAblueroomAantoninAranger9AfarberAtrembleAgileadAopinionApeewee51ArockwoodAgroinAchelloAeveryAmrmikeAbart316AzapatoAmovies23Acritter1Abg6njokfAentradaAbennoAaugusteAwetdogAmolluskBarky1AdonkingAjzf7qf2eAvkfwx046AballadAnaumovaAarriveAcannelleA1angelaAmoltenAnone1Aaugust29Ahappy8Aaaa666Astupid12A1qwe2AtrevonAforsaleAlove98AnsyncA5gtgiaxmAodgez8j3Apqnr67w5Amazdamx5CcondoAdiscmanAallanaArapideA300zxttB12masAkmanAdebeersApalace22AdjctvmArfvbkmAdivinAscurvyAbedbugAsquidlyAbabyfacAtdeir8b2AarabAguitar69Abrillo021AfincherAmeetooAskymanAmickaelAtenorsaxAlupeAbroozeAprovidianAalex1983AminfdAsuprattAukqmwhj6AdsobwickAsassycatAdmfxhkjuA46and2AposhA2childrenAbishkekAcombsAsomaliAhobnobApudding1BisswordAconnollyAletmeonAhowhighAjuntasAgrowAdroneAaddpassAkewellAcauseBhanchoAholioAkevinnAwhitecatAgautierAokaykkAmarantzAdenali1AelainaAsnow123BpannersAtanzenAsemtexBpike69AjgtxzbhrAnewmoneyApurgatorAh9iymxmcA2ykn5ccfApasspageAmayflowerAnoskcajAprimasAjambosAmogliAstickdaddy77AcannoAlorna1AyardmanAmanojAharlotAeboneeAspacebalAabcd1AsanjaAcrateAsumterAmadrigalArolyatAlopeskAkhongbietApudderBaigowAspeedsterAazzurroAcaptain2A1therockAanomieAslevinA1littleAbubblyAsweetu70AdefendAblank1AgeronimAmickeysAgkfdfybtAzaqxsw123Amuppet1Acoffee11ApentableAdrakcapA123456789000AmarinusAhavefun1BighestAbob69AchichoAhello11A123maxAstrideAfacial1AmegatonAimplantA014702580369AlynnetteAbirthday26Aenron714AasadAluandaAjed1054AheydudeAsamsam1BpotlighAriordanAtimidAwilbur1AflakeAtsalagiA76ersAjames10Adak001Amama777AsaranskAblue72A7654321aApurcellAshibainuApidorasAcantAgeorgia2AmarimarAorphanAwholesaleAcapri50AbayamonAhoneydogAbruiseAgrisouAaldrichAmartinetAnuttAang238AbigrickAmaintA123qwaszxAbrutuA44e3ebdaAbernadetteAscaryAdaishiAmoney100Aspuds1BhwingAasdfgh123456AguitareAjayzAdoreneAlaser123Afall99AraunchyApyroAslamminAfilaAbahiaAhonda01AgreetingsAprofitsAsegoviaA3bearsAteen1AappealApaul11AartefactAstoppedbAronsonAdaffyduckAcompass1AurgentAvegetAjordan20Achevy01Aaa123456789AmygalAwasdwasd1AdurdomAassmonkeBlex74AmassonAtyreseAsarahtAfozzyAlvbnhbtdfAjoshua5A1cassieAchica1Athomas0Aspartan11A4seasonsAhockey14AkinsellaAstthomasAaassAvertAtoby22AsyndicatAgreatmanBod666AjamesyAm7n56xoAhoney12Afive55AafghanistanAjennanAtremblayAcalifornia1AfurniturAnecronomiconAoligarhAsamuraixAliudmilaAisdeadAesbjergAabercrombieAhollister1AbellamyAashaBraujoAencounterAaeneasAridderAwelcome01AfolgersArigginsAshowoffApalevoAantantaCgel20ArafaelaAtlalocAconnardAsexual1AcalipsoAsslazioAbri5kev6AlilacAairborn1AmatrimAborrachoA2vrd6AsungamAolesicaAalex111AusermaneAtubby1Aserious1AmauricAazureAtocoolAstella12Ac0l0rad0AbryanaAjyothiAsohoAbacteriaAsarahaAdynamicsBetectiveAsport123BayakaAacumenAmoonshotAraynerAfatal1tyAhymanAventure1AapplebyAfooeyAmoscow1Asantana1A1234aaAlitespeeAfootball123Aopen12AvfufpbyAretypeAadam01Asigge1Atony69AboogleAdeepikaAmenardsApassat99AlemuelBawlerAcsm101AadebayoDlanteA1mercedeAalex15Ajunior13AbroomsAlaketahoAdartmouthAcool-caAkatterAicebabyAcapitanoAadjusterA89032073168AdaxterAgeneticAmonk3yAvansAackbarAeconomiaAhershilCather9Aanthony8BdrianeAorange88Af1f2f3f4BenomenAdeiselAhowlinAyfhrjnbrbAandyboyAqwer11AseatleonAdimancheAlogin1AschreibeAapollo12ApassoverAkristofAhappenArajahAoutside1AfieroAqazqaz123AbeegeesAaffeAmetlifeAamizadeAghjuhfvbcnAdfktyrbAbreak1AobafgkmArfhfntAafrika2002DomanAqqqqwwwwAtapestryAmystAagatkaActrhtnyjAzipdriveAmotaroAagatheApatinoAseemannAalex1982AkneecapAzontikAsluggyAgangesAparlayAschlossBagittariusAbobo1ApreludesAaguilAprofilAtitan2AbombermanAalex1976A1albertAyouthCkosukaAcommercialAmamiAvictory7AbertuzziAmundellAdaniel6AgoliveAfishpondAzse45rdxA1234554321aAaigerimBrsonAmortalkombatAwarspiteAblack10AramirAcessna1AoperateAbangalorAharley03BedgeAgineokAjedi01AqwerasAakademiaAmishmashAsantanApeacemakerAcycle1Ashaq34AartemaAmyloverAlucky4Adale33Atony22AarkadyA1oliverAtrabajoAakmaralAnesterovaAcalgary1AvtldtltdAfrxtgbAaskarAhoroshoAcandooApfuflrfAlloo999Aartem1995Blex1998Ah200svrmAlove3AabeilleArynnerAprodojoAbismilahAfortAguitar01AaltonBnimalsexArainesAalydarAclermontAbydandAdarkfireApa437tuAalina2006AeleonorApujolsAmustekBeilingAchicago9AvernostAtorres9ArezaAbeybladeAwlafigaAstormbriAbalatonAwalstibAbadboyzAcicciaAalex1989AbagmanAatalantaAlegends1AemotionsAkarlitoAgemini12AlobzikAminotavrAsorokinA123qwerty123Aal1916wApalladinAsoccer6ApapirusAchanel5Aalex88AfostexAcucinaBsyekmrfAalex24Eand1AlexaAjittersAlestat1Achicago3BolinsAburroAgendalfA1carolinAprelude9Asan123AfgjcnjkAproghouseAthegodAsookieAdiesiraeAqwaszx11AflaquitAhappylifeAwinston6AemergencyAvictoriyaApotapovA1secretAbreeze1Aalina2010AmillanAjackson9AingresAlickpussyAobsessedAcesaAwaspArfcgthcrbqAkellyjAvoshodAlovebuArejoiceAtinchairAmoney77Aalina1998I4F2011AgjgjxrfAmarco123Anata1980ApoznanAq1234qAdinahCvinaAanastaciaAcontexA123456789zzApondusAmama1970AkamakaziAcookie123AarisCashiAlkjhgfdsazxAescaflowneAsigma2AjarretAmendozAdefault1AjoselitAsystemofadownAbrianeAjune15AwahineAsaharAhijodeputaAthemackCunder6Aalpha69Aplay2winAbiduleAcasitaAstunner1AporosenokAnopasaranAtontosAaltec1EzzaA14ss88Aandrew9Amichell1AimaloserAsara123Aihateyou1AwolfoneAqaz123wsx456Ahighway1A1speedyAmuchachaAawo8rx3wa8tAxiomaraAdulceAmoney1234AatlantiAtallboyAbabybluAhorndoggAwpassAvespucciAnimrod1AsamantAaminArajputAsodomyAtoastersAnevermanAsoloyAasemAteamomuchAdevoteeAnewbloodAkareenaAtrace1ArmracingAkizzieApornclubAnaumenkoAanabeAchanel1Awer138AverbatiAtulpanAnastyanastyaAsistemAqazwsxcAangelangelAcinqueAavogadroBngelzAhoangenAlambert1Astratus1AfengshuiAbonaireAforzaromaAnurichAsupermeAandy76AchimpAhoughtonAjackiechAexpress2Aandrey1992Brtem1992ArosenrotAthugstoolsAlohotronApandemoniumAtubgtnBhesunAyelrahAluton1AsupaflyA028526AfoundationAstoreyAkarenwBvartiraAangellaAtileAredwinAcameron0Aplhy6hqlAspiengAdiamond0Abk.irfAinfixAviolettAsonglineAdogheadAmoraleAanithaAczarnyAthegirlAsamsung9AnazaretAvigorAdestructionAbringitonAprivet123AfynjyjdfAquicksandAgadinaCylorAdfymrfAarnoAfufnfrhbcnbAannoyAcarinoBhinadolAanthony4AvjqvbhAarmymanAhenry5Aeddie666AbodoBabareAnokiae51A008800Asanta234A2boobsAfindusAmogulAlincoln7AfusilierAmarcelinAbaconsArozaAbodybuilAaquaticAhyderabadAwroclawAbazongazAeusebioApakistan1CsionAleonorAgeequeAmadalenaAquestorAcontaxAzxcvbnm123456789Af22raptorAyggdrasiAchris200AgulfstreAmononokeAarvindAtootsie1AkovacsAmeditationBybabeAjas4anAbaby22Ajames13AlatrobeAdeadsoulAkalashAprivadoAaaaa1122AmallardsA2278124qAhjvfyAlollol12AtrayAyelhsaAelgordoAprevailAlover123ArattraceAazoresBlla98AbirdbathAimpressAegypt1AaugerA34erdfcvAdarkseedAnikolay9AazatAbravadaBujhm123AkasperokAnotgoodAqueequegA1vampireAkeatsApotvinAcool22AnytimesAbuffonAikmvw103Brina1991AmudbugBememAashley19Aripley1AbailieBooboo2Acookie13Alove4eveAbakaAstreet1Apeyton18AlongmanAthresherAopusoneAsteffanAzxcvbnmaAchaplainAhfpdjlAfrasseAgrailAmellyArauchenAferreA1celticAmasonicAkeatingAsnotAball1A124c41Adagger1AgayguyAba25547ApatitoAflyers99Acookie11AfiredeptAheather7Awalker2AlemmonAsplitsAbanananaAme2youAdfhtybrApuertoriAbryan123AwarhorseAashes1AjaffaApatatinaAbangbrosAuptheassA37kazooAmegan2AbearssAfred20Amuffin11BykittyAstepsideBmoke20AboubouleAtramAdaystarAcovingtoAwarhamerAniccoloArhtyltkmAsatchel1AchriAbarbaroAoldfieldAtamarApeter7CppinoAmoviebufBarderAsmile2AmostroAyamaha12AtripsAjabariAexpressoAwartburgAtrillAirnbruAbakesaleAcharlusAbugger1Amattylad10A1barneyAlullabyAchiccAbocmanAsekirarrAhesseAkerberosAfranky1AweaveAsweetpusAjasmine9AconditioAkrystaAlexingtonAessentialAkarloffAbarsAcdtnfAdeemanAbraceBleacherApimpmanAfalcon3AdragonlaAnomiAburmeseBrauseAsixflagsAdennieApitcher1AtorockAjeffrey4AcatchmeAspangleApreppyAdakota99AshakersAbasseAmotzartAturner1ApatatAfreakboyAtullerAhofnerAammanAkillermanAbjorkAdarkniteAmagic69Arobin2AheehawAilovelucyAgroceryAmildewAgothic1BallenAradiantAbordelloBritaniaApreserveAtristonBommyyAbayardAkablamAbayouDtownBurrito1AkilowattAdedhamAwallieAmomanddadBegan123Atiger23AstjohnsAtwenty2Apass111CramountAleedsuAbadmofoBreakdanceAprocess1A1dakotaAsturmAblockbusAdavid9AkierstenAcourt1Ajuly27AvaduzAchessmasAspittleAbrett123Bigboy11AevbukbAcoinApotsmokeAnodnarbAblademanAtafkapAeric99AblackwooA1qaz0okmAnotepadAbuellerAcomAlauren12Acolts18BamneelyAooicu812AchispaAthebandAmoney21Aorion3AwspanicAestheAblomeAstars2AwoodchucAyomama1AairwaysAparker01AmilitarAkeksa2Aclk430Adog2AjackfrosAsightAandrew23Abeardog1AclitringAosasunaAcurtainsA1newlifeAcodered1CcotteAsexstuffAludvigApeckAwelcome4Atigre1Aashley24AcathieAsinglesAlokitAnewyork2AsmittenAgodownAfigvamAhoppelAmichal1Asunshin1AplazaAbisousApetty43AtanelornAexposAsnatch1AmantecaAlunacyCckyyAribsBoleplayAkipsAupskirtApecanAalcoholiAjohn10AwhassupAinnateAhectoAisgodAsharipovAjordan9AalgoreAorion123AsuomiAgandalf7AinstitutAlilacsAsvolochAbell1EiniArunneAmuchA07078AvijayaAunder1AbreadfanAmitsouApablo123AroselineAfourkidsArobot1AdeebeeAramireAsantiniAcoalAspermeAvirgosBgfun2Apalermo1Aspider7Bunny2BhipsA9hotpoinAlovinitAcarpeBinemaxApenguin8Aasshole123Asantana5CtisfactionAoakdaleAkkkdddAfaucetAeuropArooney10AlatinusBexusisAbultacoAahjkjdfAtelescopAkobayashAcfiekmrfAberger1Aartcast2AbigbullAkelseAberniAmonroviaAtechnikBrafalgaAbinkButaneBigberthAfuesseAquartz1AfiregodAkiss123AliseAbiafraAflopsyAmooreaAeric11AdannoAgullitAbetter1ButtssAthebusAraven13Bockstar1Agfhjkm777AdronesArobbenAcrazyjAdeadfishAragtimeAfitzgeraAkl?benhavnAbiggameAenigma2AquackersAchiphiAmagichatAlightspeAbruiser1Akenneth2AthinlineAblue30AinnovaAblackbooAsharaAgoodstuffCpinathAbossladyAchimairaBonnellyAsnoochAchinnuAsataniv1993Ajoshua10AfourtyCrtranAsymantecAturntablAintrudeAhobbes12AbieberA1234567890dAperuanAfarmlandA88mikeArugby123Acoffee12AiambigalAbrentwooBigdonAnipples1Al12345Aboating1AkingshitAmagical1AdoglegAbigmaxAdoodlebuAteenfuckAjustme1AshatterApimpjuicAmacdadAow8jtcs8tAcountrybAneedajobAchelsea5Aangus123AtuscanyAchris5AvanburenApokermanBrevertAdelta5Asexy4meBmokeweeBassysAcumhardAbigfooAsolanaAthreeeAcheeseburgerAdebra1BarvinAjazz1234AsurfboardAbigkevAkipper1AberlingoAcherrypiAgmacAchickletAmaximizeAjagrAlivefreeAsexpicsBheldon1Afubar123AvannasxBiolentjAbrenda69Axtr451Apanther8AbigrigDsamAacuraclAwazooApureevilAstuffsApimpin69Acherry12Alove5683AhappytimAcbljhtyrjAbrownnAadapterAburton12Acrystal0AraindogAmiller01AdukenukeAamexAsindhuBtillersBanchinAphoenix0Bassword22AwilleeAshempAderrekAgrumpApassssapAblanksAanalysisAjensonAquailAforgetmeAboredboi4uAyyyy1Awarrior3Amankind1AcuntholeAsawadeeAdeclineAfaggetAcoralieAboobies2AkottonAcavallaAtineAonelovAalbatroAsnakebitAmichael123A1hotdogAlinetteAheresyAdaniel9ApabstAdgoinsAwarmanAblowjBisquitBloodredAridemeAhardc0reAjustonceAporol777AethicsAjkellyArockhopperAsilver77Bamba1BupercatAdrew11Apatch123AnabiscoApattenAhpvtebAcubsfanAworldnetAchaser1AhotchkisApackers2AkalamazooAscully1AblaatA1pantiesAlikemeAmax1AnickersAplastikAthorneAlowersAmartijnAwrapperAnosmasAtalk87AmadininaCnning18AregencyAmontblancAroadrageAhitmeA1yamahaAtinroofAaaaassssBbuelaAstoner1Aelephant1AkociakAregulaAcorpusAjamesdeaAglowwormAbluedevilAexplorer1AchangaAk.ljxrfA1brianApoesAmingleAcaleb123Abliss1AchevalierAtolkien1AblackbAcoolbreeBatapultAsonoioAcosimoBhunksAtakemeAbobby18AhijinxAchechAsunseAnicole01AhilliardAkeepsakeAriograndAchamberlAbluedog1AmusicloverAyachtAlibertinAanamikaAblues2Amike2000Akd5396bAweenAblumpkinAjolietAfranklyAgrappaAexceedAapril14AfiverAhard69AnbhtqaAbigsmallAcloveAhamadaA1fridayAsuck1AloveladyAgodsendAelsieAtarmacAmikey2BamiyaAbonkerAdigital2Ab26354AlogoutAgood4meAredsox19AkillitAhammer01AbobjonesAkrypton1AgbkbuhbvAnothereAfolioBulhamfcAcarrerasAnot4u2cAwert12AsadomasoAbanaan123AhenrieA789qweAboilermaAindienAcykloneAdipascucAred666Awater12AlisbethAhiheelsAohotnikAslickoneAothersideAcasper123BountrAtimerBheflyAnitrosAhornysAmikejoneAboodieAdragon4ApumbaAsexxybjA2dumb2liveAwu9942AbookingAfetusAladder1AomnislashAhakaoneAsketchyAlottoAredsox99Adelta88A12qwerAamberlyAredsox12ApopartAdiplomaAminutesAcorcoranCnklinAipvtebAgogolfAspareAdelongeAganibalAfounderAboyfriendAyannisAadkinsAdeath6AantiflagAbrianpAadroitAcatrinaAequateAkiller00AralliartAfrodo2AyanniAbigteeAlandscapeAfzr600Abrandon8AhalstedAbreaArecifeAparkheadAbraunAfodderAbravo7AlorieAdizzleAchartAkamikaziAbreakoutAcowboys0Ahotdog12AbooferAsimferopolAjeebusBuanpablBeremiAsubscriberA002200Ablack5AcrossmanAusmc01Aapril9Amonkey14Aevan1AsilverchAglock45AtolucaA4nick8ApralineAchuluthuAsalomAreisenApookie11AshazaamAfreeway1AmountieAhelgaAbroganBurrfootAmalaconAboiseAelway1Afree12AkrakowAsummer02AbronwynDodAdemetriuAorosie1Aradio123Achris33AreidAfeeneyAraven11BideredAgoninersAkyle123AdragstarArandleAchloesAlandauAkareltjeAq12we3AwillyboyAburnedAcagivaAjackie01AbugssgubAkendoAanimesAfiresArawrAorange6AmidilandAford50Amoney3BanaraAcharlizeAbudsterA671fsa75ytA1harryAbuffy1maAhunt0802ApizzleAwelcome0AconstantinAtremendoAkesselA22tangoAking11AhfpldfnhbApassinAfarinaAbushwackAdimitryApeneAjblproAa1s2d3f4g5h6AmahinaAcbhtqaAbvlgariAlatelyAmasqueAfortknoxAtanyshkaAchris999Borsair1ApapierAsleepsAyolandeAprunesAzipcodeAcamsterAkazuyaAmonoxideAtameraAcia123BochinoAspinnakeAbrave1AskycladAyamadaAkarolinAjameslAchuvakAlafleurAeddie2A2hot4youAjayteeAogdenAadviceAtestamentAguanoAhowlAcanterArevelAgogetterAcanarioAmurcielaAyoda123Astartrek1Acody123AnewtoAzemanovaApa55wdBlayboy6Aminnesota_hpAwashingtoAintubateAmarocasAcaution1BouponBataniaAmendesBko09ijnApineapple1AglaciusAtomatoeArehmanAsamfoxAmoo123AbulldozerArachellApippoloAolemiss1AlividAnot4u2noAsquatBtrongboAnathaliaAzorro123AwhamAmiahAreggie31Atree123AconnoApeugeoAlickinAzolaAenolagayAgfgfifAyoungsAtortAcelos1Asilence1AbigtunaAleftieAcfdbyfBhingaAmythicAallardAnewlife2Ailoveyou11AshantaAquellAchuckdBx18kaAwristAcharliemBollect1Atony44AamorosoAparachuteAlovegameApfizerAmadman1AprincesitAjinxedAgullaAashcroftAstepashkaAchernovAaltoAbellendCano002AmainstreApaolitAwokingAunited99AchinniAfanclubAyjhbkmcrAcartmenAhidekiAdraco1Aa1s2d3fAilikepornAmatsuiAgawainAantichristAjesicaAunicronAspammmAelenorAnikkitaAselect1Al0nd0nA1cooperAfun4allAcassellAjenelleAg0awayAyetiArcfhlfcAcolin123AtyphonAcommand2AjacobsonA1escobar2AkoontzAasguardBteaseAbabyboAsasha1993Atigger3AshiversAfucker12Alukas123AharsinghAsooty1AkangolAtachyonCmaAwinner69Ahooters6Ascott11AmrmojoAcoastieAbranfordAarminiaArattrapAfender12ApotteAjedimasterAnantucketAdigitsAsteam181FforumsArhonda1AlovelineAadidas69AunionsA420smokeAcressidaAtopangaAlovehurtAtoreadorAhellboundAgimpyAmatrixxxAjhonnyAcronusApercussionAspace199AgwendoliAthothDr99AjacuzziAfanniesBlowingAabiodunAdestineeAkrackerAbasseyAshockwavBweatyAwcrfxtvgbjyAasdflkjAtigger13Adylan2Ailoveyou12AcnfnbcnbrfA122333444455555AmakennaAnorwalkA2401pedroApolkiloAmontageAtilemanAmacbookAsexinessAkudos4everAdisarmA1lindaAmarillionAcunninghAphelgeA69pussyAlatchingAnastya123AcuyahogaApoopoAregineAsydneeAdiglerApippo1AludicAsummer22Ajust4uAlovejoneAe12345AruizAvalentAnetwork2Avfvf12AerxtgbAkrekerAvladimirovnaArankAousoonerAjackson6Asweet666AjlettierAruffinAbodeanA55555rAwolveAdelfinoAfavorite4AdefectAyoshi1AlegshowBlbeanArampartAdonkeAsakicAichwillA111222333444555AdjtiestoAs1s2s3s4AwhatisA132foreverAddd123AtgkbxfgyAindonesiAdddsssAlfybkjdAmmxxmmAdr8350AblunderAshit1AdavidtBreameAwatchoutAmarch23BomsAsocoolAassertAlachesisA1timeAdameA1-octAimissuAlol1AwrinkleAzipposAcumquatAtemujinBubularAbaboAjoanne1Asilver22AopelgtAirelanAdivine1ApopcorAbuhjvfybzAecosseAtiger5AoldskoolAdaniel7AlilmamaAmarmarisAporno2Adaniel5Akevin11AtartApokemon00Asavannah1Adracula1AcerebroAhektorAilovemyfamilyAjulemandAkingmanAdannym88AroosAmello1AbigelowAwelcome5Aindiana7Asou812AmicrobeA770129jiAdrongoAcheatsAjillyAremmusAkevinrAdave01Csha2010Alakers08AescrimaBmpire11AteamlosiAfredieAdeadmau5Atiger21AfernieA1andonlyAlbvekmrfAracer2AmichaeljacksonAhumanityAprorokAstarfleetBarah7A2legitAfirdausApadrinoAdavid777AemilyannAtealAphilouAsuccess2Acall06Asquad51AdresserA6yhn7ujmAepsteinAjaguarxjApassitAcoroneApeugeot406AdewarsCcibelAgocartAkornetAeuclid90AbarmaleiApoiuyt1AmyturnAelitesAbaldeagleAglennyBerasimovaAchancesAwerkenAstainlessAdemomanAgrindingAcopernicAmunson15Axxx12345Ajack2000BokerjokerAmatthew6AkcidAironcityApatti1A1mmmmmB23llllAdomovoyBylandogBonaldoAroboticAphoenix5AmiddletoAlena12AhatebreeAconsultaAdaddBifferenceAcumberlaAaquariuAsulacoAmazdarxAfrontlineAcorineAifiksrAsarmatBpam69BtuporBapoAdoom12AjeffhardyAlizikoAclaveAyeahrightAcorkieAweruleAelric1AfreudeAdragonageAvalmontAdenis1984AmarialAdessarAhockey13Arobert8AukrnetAfedererAdeppBonnAserver1AummagummaAlozinkaAginetteArecipeAositoArfpfyjdfAchancAthomasdAcurivaAexorcistAfuckmylifeAmisha1111AvfhbyfvfhbyfAqwaszxedcAlollol123AduceAevh5150Aonetwo12Acecilia1AhowiesAyeababyAinsulinAoleg1996AmushroomsAdianochkaAroma1990AfollyAbiggusAduperAsitoAhokutoAdigiAsharleneAnargizaAmasianiaAdimanA1234567890oAqwertyuiop12345AtrfnthbyA1qa2ws3ed4rf5tgAsavchenkoAfenomenoAkrystleAfreyjaAtabby1AgfdkjdAdittyAweeksAzionAhomyakAkacieAvbhjh123AchipmonkAwinter2AfederovAsig229AiluvmeAnirvana9ApfqxtyjrAdoohanDgie1AcobblerAkoalasAcastillAdragon05AilkaevApitbossAvaz21074Aqwerty4AnewpasswAhappy13Ayuitre12ApartridgAdragon19AilovetitsAtybaltAjacklynAapril24ApalletAal1916AfliperAqsceszAervinAthatguyAmariselaAscrapyA111loxAfleabagBromvermineAselhurstAphase2AutrechtAtopshelfAnyyankeesAsympathyBupertAgfitymrfAhanakoAdylansAblackdraAfire13AkevindApoekieAtrunks1AsnowdenAthedreamApenmanAtrrim777AnicoletteAbdr529AhornierAscatterBasha2011AquadraAlindacAtime2goAqwerty999AruffusBbgtkjdAyodudeApower5Bumpk1nAfrost1996ApenhorseAnetpassAwoodfishAkitaAlainth88AminorityAdutchieAam4h39d8nhAjackmeAkki177hkAorion7Asanders2AkoblenzAopelagilaAflhrciAmadmax11AthecountAwidespreadAbigjuggsArfntyfAbhecbrAquixoticAcranstonAolesjaAtuskAgibsoAlovedickA03038ApriveAwebsolutionssuAnosliwAratiugAel345612Aadonis1BmadeusptfcorAjacopoAkuolemaAwin123AmakavelAjulie123AbabochkaApimp1AjasmiAsouthsAdjkxbwfAmuffinmanAqwertasdAninja123AluthorAqwerty100AstudenBpinneAmisiek1AuthvfybzApimaouAsilver01Amartin01AvfrfhjdAmacross1AlazarevAstarwoodAyamaharAgood4nowAclearyAgerarAwretchedAladleAfotzeBrownAdogs1AqazsewAbibigonAhoney69Aqwerty8AfallengunAlindamAphalanxAfalloutboyAuhfdbwfgfAfanatikAhawaiAlondon123Akelli1A1insideAl1750sqAcanalcAtestdriveAharshaAsurrendeAfatboy1AkalenderApoint1AglossyAueptkmAtema1234AerikssonAtoemanAkernowAmonginiArfvbkfAkillerbeeAsirius1AnfkbcvfyAcbarkleyAjustlookAfilmstarAgruppaAhappyfaceAmayoAicequeenApresidenteAfestBkrjujkbrAkkkkkkk1A9085603566AstockerAbumsenAspritzerAnissenAfilatovaAminicooperAhouserAsony1Amister2Arush211Abaggio10AlittlefuckGmingeAguitar11AtommycatAfitnesAmike31ArecluseAsmallvillAlordsAbyrjuybnjAiubireAscallyAvisitAkershawAjoseph11AorianaAscholesAnfhtkrfAlaptop1AmusikAstanislaAmythAracecar02Agrass1Aeight888AthepowerAab12345Adead1AgrossmanApunter12Awaves1Asonja1BkillerAkingratAzygoteAalondraAwalnutsAisoldeApillsAkevinhAshannon2AengineeringAiceboxAtiikeriAmoody1BavisAtheringAshrekAfrogssAadalbertAhanseAkabutoAjawboneAfruitcakeAyjdbrjdAjamaicAgritsAstratcatBexyboBuckmy1kAmassive1AyoshioAwinter0AgrappleAminiclipAskinnassBhibuyaBmile4uAgregoAmoney8AilovedickAniewiemAgabriel12AmirandAvikinAgoshaAturgaAkisulyaAgomer1BalenAonlinAcaimanAmanutAsorenAmedinAgayathriBinger69AsnowbalAjaydeAalskdjAgoducksAstangsBummer08AprostreetAjunior8AkempAgators96Amaxie1Acastle1AhoopleAscrewuAkatie2AgbljhfcAmeister1ArosaliaAcarletonAgoodmorningAmaslovaAgreatzyoAherbie1Backed1AthreepioAduke33AjamesgAmickey69AsinnfeinAquiksilvAlavaAgeigerAmooserAsueannAnewspapeAraminaAcolucciAmommy2AolliebAramiAkeywordAsambo1BhantAjohn77AzeratulAgladbachAbundleAgromovaAkiborgAjohansenBameshAlizzie1AzuckerAsb211stAkennelAlove55ApukimakAthesims3AkatinkaAmurenaAjahblessAstorminAmiller12Atrigger2AjasongAcezanneAsexy01AlidaAvalerianArepmvbyfAtrinity7AdoctorwhAsadmanAnine09AcomethAtinkleAvolunteerAspecialinstaBweet2AnaumovAtahiraA111111wAvthrehbqAmadaraA123456789asdAgoaheadAbrandon00AkarolinkaAvfcmrfActhulhu1AdrugsAjuancarlosBimmyzAtroutbumAkalamburAtaisonBrilliumBijuanaAmsvcr71AneveragaBhfycajhvthsArfnthbyf1988AllloootttBissalissaAhollageAkbpfdtnfA.kzirfAnthtvjrAkravitzAjimmypA00000tyAcdtnkzxjrAtrixiAjack23AstockporCumpsAfidodidoAmcclainAstarbaseAharlequiAnufcAsatcomAjasonkAswitzerAjoshua11Amike007AnietzscheAmatt21Akimber1Asuperman12AmakenzieAtechnicalBransitsAmunecaAthewordAwillow01Aphantom3Anymets1AsweetiesAjimmy6AnudegirlApangitAtiaraAjockoAgreen33AmessagesAestrelaAjuliettaAdarthmaulArollrockAcurzonAksyushaBamelia2011BhalifAyelena03ApundaiAleolionAyfneczAvladaAklaraAtailsAo123456Arock69A5elementAlugerAqwertyu123AnjkmrjzA123456rrrAkomarovAdbrbyuAvika1995Amax2010Anastya1996Abond9007ApassoutAmetal123AnadyaAparaklast1974AmaryjanAshaggAmdmgatewAserjikAlapo4kaAmichaelmAbegemotikAsunbannaAyarddogAserafimaAblade55AsettingsArhfvfnjhcrAfairlessAjscriptAmailliwAs12345678AwebuivalidatAadvantageAnataxaAja0000AtomassAmsorcloledbrAphenmarrAf56307AinetcfgAnondriversigAbrowseuiAsasha1994Amike1969Aasdasd22Azaq!2wsxAphotowizAtanguyAfreeclusAaregdoneA123456789qwerAmanifoldAwordzA20091989qAnikita99Aojp123456ApivkooAzhipoAv123456789A9085084232Alolkin09AsarvarAbypopAfm12mn12AvovanAtu190022A8096468644qAzverevA8090A9001D7A14038D58B8068A20038D68B6028B9024A45632A65656A78791A108888B18801E11C9955B23569C9834B32546D613C5798C6666D913B43333B53246C9630B97901C8305D603C9308D500F8A200007B12325B31456C2222C3307C4561C5555B46801C8624B58012B66643A321671A400000B23956B32100B86255A523252A663366C6123A718293B41776C4637B73400C4477C6677A963210A1112223B231233D6798D9056B371280B478523B766734A2008200B323232B505198A3434245A4258195B707570B930321A5318008B455555B557940A6741314A8522003A9001668B104587B293709B512369A11012566C114444C234567B2345656B3467982C571113B4314314B5935746B9761977C801984D41989D91959A36169544A45678912A51501984B5443322A67899876A78978978A88887777A91328378B8256518A102938475B23123789D456321B59357852A212009164A1212312121B928374655AjgjesqA0020Aelena1971AhawkwoodAdnomyarAsexaddictAcool23AyocrackAsissinitA123ewqasdAkayteeAdanniiAarsenal9Asexyred1Agoogle10ArateApapoAdknightAloveallAcrustAremmahAmaxsamAfreeuseAdandelioAspillerApmtgjnblAqcxdw8ryAaffirmAdbm123dmAreportsA123jokerAfinanciaAeurolineAleydenAjimkirkAameritecAtopazzAgeoffreAmusic11AbaffleAlilcroweAoldmansAlikesdickAshowitAzhv84kvAcharles0Abitter1AlechatAprostAsparkpluBavoyA10121vAtimoteoAq1w2AmuieAnobullAdiodeAmexican1AseveralAjuanjoAliesAdraftingA1shellyBautopasAautopas1Awwww1A1gggggggAtallenAfrozenfishAmorelloAnuggettAhainesAyellow7AraideAa13579AdranrebAharishAmatrix19A12345672000AonetwothreeAboop4Ahouse12AnarfApimp13Atuesday2BarrantAstpiliotAcar12345A098poiAasdzxAhillerA96328iAhenry12A14u2nvAtemplar1AoutboundAzoroAyasuhiroAcataractAerdnaAzsergnAjustinbAwazzkaprivetAalievAralfAouachitaAfunoneAdabl1125AnollieAeldestBzraAsandburgAcousinsAscorcherAtahoesAcharlessAjeanmarcA1701abAmonalisAdebuggerAjason69AlewistonAsysmanAkainAcashinAwillerAmyemailAincaAcanisAjonassAepatb1AweihnachtsbaumAmrwhiteAsockenAbayern1A19deltaAbernalAadoreBgustaAbowl36A1bigfishAgetinnowAtravAdrakoA1hawaiiBpeachesBvetteAchief123A1sierraAthemeA1kevinAevil1ArounderA1winstonAsugar2Amopar440AdishwashAartboyAnonnahsAcaptaiA2wsxxsw2AillwillA1qwerty2ArascaAdjfpassAbasharAxeniaA1alexisAuserpassAimanAdrummeAllabtoofAfiredAgangstersAbelindAdawg69An2deepApivoAnosniborAoreganoAvitalAsafonovaAbeaversxAaboveBndy22AyesyesyeArowboatAjaboAhotstudBamdanAtaroAskarlettAfliegeAhamidAveniseAyougotitAgargleAaloeveraAjack2AkhmerBurgn01Ahzgg9umcAtobytoAch3coohAahabAdmarinkAquasimodAphysicAhpsalgayA5daxbAanniAfrankzapAthesmithAlupinAoct2888AregimeAfossil1Abenz12AfleetwoodAandrea2A2accessAstjudeAdamastaAfloodsBjysk762Avre2nc3zAhearts1AtanagerAfalcon5BoresA1beaverAzwt2sbzlAjacobbA1privateAchandosAviglenA1212aaAbrannonAsazdAwebbyApasstraderAgateeeA123dogAnorsemenArunrigAadumasAoakenAjjjj1Acatman1AknuteAas5ffz17iAyusukeAcdgirlsAq4n2jdehAvmdnygfuAmerlin2AgroggyAperronAavdeevAmcflyAauditArobertosAbigboy40Apacker4AkazmanAvengerAreece1AprosserAadminsAgasperAwatchersAlbnjgtmpAmungAwedge1Ae2fq7fzjAalonAsportsmenAdallenCckelAholywoodAsykesBhipleyAfuckyourAdogmaticAfinal4AwillsonAsharon12AjiffyAbumfuckAhayden1AbowlinAfalconeAnikey63AquickyAmoooAcindylAlada2110AallycatAbruxelleAalex26AbabajiAtvmarciaAchilesAseattle7Buper412Amarch21A3kingsAtakecareAlogonA4teensApeterdA152gecznAfarragutAbikeboyAtasteeAjammieAfrank51AgolgothaAhercAshantellApikey13AintroublAchris198AeatpieAantonaAlupoAtricksterAeckerdAtoby11AkayeAzlatanArobinbAshianneAchester9AgypsumAspirosAjoshua7AryleighAadmanAdonvitoAkravinAichiro51AgroovinAaugust19AzeekAcookeAanimalesAsophie3ApenileAniemtelAtest22Ajohnboy1Aandrew69AmayursAwickeAfickdichAbruce69AmocajoAaposAjwestAparisiAingriAgreekboyAslutzAbilly69AlegatoAasukaAtriesteAfuckaAshumwayAmark77AnaylorAwestiesAtomchAblah1234A69stangAmandmsAorange9A00948230AbondoneAtr2amp25AbettypAdtrainAyomanAwamozartA8428ldAspongyAdampAgiampiAorestesArjpkjdfAarthur69Abuffy44AchinatownAwheelingAyolanda1Aa1111111AgreenwavA911rsrAkazakhstanAwaylandeAmabuhayAppooiiAonspeedArationalAhornymeAchuck2AgasanovAdelucaA97fordAdakaryAoldsAautismAvtr1000AfoamyAjames8AteamaseAprobegtAoptiquesApiffleBrince55Asdh686drthAallahuakbarApianinoAargosAdeeringArjhjdf777Asadie2AavengedBnton1992Aford99Asutvsc5ysaaAqaz26101778Abbb111Aaaa333ArevlonA123mmmAjeremiasAartemartemAbailbondAholtonAsexsitesApassworddAgurpreetAaegeanAradialAsanek123AporndogAjoshua123Aflowers2AsnaresAnjqjnfAamicusApillageAbadgers1Amarch20AkamchatkaAjacobusAgoliatAkalamataAtejanoAsplendorAmaryleeA123abvAbabe1Agoofy123AabadanAshadowrunAanniebAbeebleAfkmabzAapril4Aonetwo3AbryonyAdaniel69AbemineAchuchBesare5Awsx123AmkjhfgAbucket1AramfanAwordpasAduplexApotolokAturkeAlikethisArobeAlachlanAacidbathAdallas88AtatarkaA1homerAabogadoAfoxxxAleclercAvtecAtallisAlanceloBizarA66mustangAprogonAchauncyAlovecraftAutythfkAperkinAmerlin10AgyozoAuser1122AsunspotAdenis1987Akiller9AderflaAbarataArobert0Aaccess10AfatcowAsamurai7BuleimanAcabotAvivian1AsmokenAmouloudAsilvergoAakimovaAshaziaAforzaAboogeAacolyteBlex98AsalamonAmonetaAalastorAmaximillAactivexDuaryArovertAelsalvadorAadam21AnulifeAjohn21AoutriderAfukoffAghostreconAlaurettaAnecron99AgearsofwarAfootball6Aapple9AterranovaAulrikaAdassAchieftaiAmercede1AadelyaAdaliaAbongtokeAaspirantAhotnessAgranataAyoda69Aadmin12Abunia3AliloAsukaAbrowneyesAadmiraAvirtuosoAadmirerAphotoshopAjune23AlauritaAalmondsAgjdtkbntkmAsupercalAdontdoitAfarooqAbabysAadvance1AcatrinAsicilianAescolaAharry5Aqqq777ApanathaArfvtymAusefulAfluxApuckerAaeroplaneAvaz2105AkfgecbrAsarettaAknickAlaranjaAafhvfwtdnAtrans1Avovan_ltApfefferAfktrcfylhjdfAlunar2AeverAalex86AcanadiensBghfdjxybrAnarineAkamilkaAleninaAaishwaryaAtaburetkaAandrey12AghosterAvthokiesBbhjndjhtwAstroudAalinAserafinApichonAradaAhola123AaniolekBgustiAcrm0624Ahockey123ArjdfktdfAdotnetAkbkbxrfAfaroukAalina12AgadflyAmatt23AantoinAsweetmanAaksanaAroma1995AnewmediaArhbcnbAesmithAshashankAmaddog01AhyperlitAswapnaAovaltineAbitch2AaxleAmcitraAdiablo69BogggyAnabilaAohyesAghbcnfdAmilkerAwonderbrAuhjpysqApurinaAbunnies1Afylhtq123AbullgodAakimovAbarmenAzxcv4321Astatic1Aou81234AcbkmdfAlibra1AgipsyAsasha13Achicken6AfanfareAviolin1Aalan123AgalanApositanoAsanremoBhippoApanther9AtibbarAst123stAforty1Ablowjob69AsavanahAxtcnthAweskerAreglisseAferien12A1coffeeAfhbyjxrfAnicolleAzhongguoAprokurorAcfymrfAgorbunovAproninBfhfnecnhfBeresvetAalionaAdfkmltvfhAirkutskApasword1AnhfrnjhbcnAdjkrjdAlove007Aalena123AcarismaApodarokAbasterAgznfxjrApride1AxtutdfhfAtoolkitAdfkthbrAtroll1AproblemasAsapitoAalex06EsanderE2009AkamakiriAmarsalaAhostAtouaregAcfnfyfArevellAntktgepbrAronaldo99Az1x2c3v4b5n6m7AgaviotaAfrosyaAmicaelApalacioAetherealAheccrbqAkonoplyaAghjgfufylfBiottoAnumericAreddevilsAbiologBuheirfAalkashAnokia5610AedifierAfyfnjkmtdbxApepsi12AduettoAunderstandAnyrangerAaspirinaAkemerovoAalhimikAnicole123AtraitorAmontellaApeachfuzAholdonAgreat123Aucht36AlzlzdfczAalina2002AfifnfyAprohorAdomodedovoAybreczAhalfwayAdanilovaAroseanneA222222aAdarkmageAwerrewAnhfkzkzAlindalouAghjatccjhAbulldog5AshortmanAdiabolikAgoogle2AqqqqqqwAsplicerBtoffelAmodaddyAwapbbs_1AghjnbdjcnjzybtA555aaaAbigguy1AsecretaApollaAevanderAlocutus1AelkeAvepsrfynArockersAgrafixAprotozoaBuissantAaccess01AfynjyAgorilla9AalternativaAmatthewdBetalcoreAjordan10AdctvcjcfnmAhannah22Bomer22AamarokAhightechAcobra5Aqwertyuiop12AblogAgerri1AliviaAmumfordAtrackstaAdejesusAambulanceAcalidaAhindustanAkuramaAaminkaAraminAstiffieAfureliseAkaliforniaAsubspaceAammoniaA02588520AamorcitoAorange01Anautica1AlovebabyAdragonmaAsonnenscheinAmagalAkatinasApeggysAenergiaAballsoutAclaudiuAservetteAanandA06068AcorporatAking10Aarsenal123AsapatoAhawkesAleventAanastasyaAufkxjyjrAgjlcnfdfAbalinorAsexkittenB9te949fAmamouBoderatoAbulldozeAnemiroffAasa123BndranikBrachneAnobody1AapacerAtima123AjaroslavAfktrcfylthAmicaelaAandy01AstokecitAaotearoaAgkfnjyAegor123AankaAzxc123456AartemiAyoshimiAjasper2AphooeyA1sugarAanna12345Akarol1AanxietyAzasxcdArincessAtravkaArebonAangel8F18Adolphin6AforgetmenotAproverbAmontero1AturnkeyAcomputer12A12345qazwsxAfranciaAgazetteAmadison4A136611gtAjen123AmcmasterAcrosby87AbeatrixA1slutsAbelldandyAkaprizAsharpie1AdentmanAjaanAastra334566ApalaminoAbright1AdiebitchBemonioAparkurAmargheritaAspartak1AmartymarAanubis1A00000000aAghjnbdjufpAmalishiCndoAriskyAinfalicallAvicenzaBacancesApluckAapplejuiBshleaAtrains1AappraiseAkungsanAapril27AmarinaroAhakimAcontrollAdracosAaramBsholeApoliciaAdodobirdAamoremiBudubonAqw3rtyAarendaAbirthday36AargusAuniversidadAtinmouseAvonsclanAqwerty0AfrazerAlaputaAelectronicsAcaballeroBheburekBloud69ApolisAchidoriAnoserAbattenAximenaAartem1994I1Azxcvbnm1234AcunningAtuttiAastronomAscuba123ApratibhaAguitaristAwapku1AnavigationAtijeanAashatAuhtvkby17AmatelotAxxxwowApumpsBositronAallah786Bsdqwe12Abollock1BetitoArfhvfyftdAasuncionAtempo1AangelfacAmyspace2AsharpyAauxerreAelevatioAavinashAzolushka2A24beersAbulldog8AshelAfabfourAzorropeAbaddAvoodoo69AlinearArattlesnakeAnitrateAsushisAmegafon77AivetteAahamayAsouthwestAbaggyAmarissAjc05595AballsyAsteerAmaveric1AyasmeenAkojackAhejsan123Aguide1AhogfanAmollerAakellaAbalerinaAjetboyApiledrivAlampard8AflattopAwasterAclapperAadderAwoolAsasha111Aball123Asonic593BmallerAblowpopAfantasmApalaniAsombreroAarmchairAhaguenauAkukenAprolongAbananamanApeelerArugby9AsantandeAagustusAchief2AanointedAfucksticAsmurfettArealhardAfeastAbanjomanAditchAmakenaAcalvin12AspecialistAbluntmanAgraycatArococoAbanzayAreymysterioAmudpieAcampoAhavannaAespagneAchasesBorruptA04088Alove10Asatin1Aworking1Abarca1A2hot4meAlazyboyAhuntinAduvalAthegreat1AmibbesAbarfBlargAchris6AbandarArefugeeAsparky69Alena2011Aminimax1AfutballAmissydogArocinantAsonne1Abarrett1ArosadoAinventorAbarrierA1turboAschnitzelAbarrosAlavernAterranoAblackeApolimerAbeergoodAubitchAsmugglerAoliver01AsixtysixAbardotAgantengAbernaAkyleregnAeliezerAdaniel19AcheckinAq777777AkearneyAtigger22AfaultyAbaskeCobab6AtedescoAjackfruiAmarijaneAfinal1AtubbieA789456123qAbatcatAelianeAgreen42AbathgateAthejamAfatass1Atiger3Astarcraft2Atimothy2AunderweaApinkyyAbattlestarAlaufenAdanzigerAshiner1AmccallumAbeardenBayleyAsregitArainforestAlifeisAdivine2Awwwooo1234AlilmacAairjordaAmarkersAthunder12AlawsonsAjack13Abeatles6AaugieAmichaelpAcincyAvandreadApolitikaAbluebirAgoodingAken123Ablack6Bobby4AsargeantArekmubyfAlatteAnurseryAkill123Abubba7Ahello7AutmostAfurtadoAgo4brokeAdavid6AbbwloverAgoldtopAskidmoreAcrown1AlockupAcnttcbAbrandy2Bill2455AozwaldAweiderAgolfer69AchipotleAathertonAevanstonAmusicboxAcupcakesAfloydsAbinkerApicaboAbeachyAversace1AcodyboyAronsterA50centsAhuckAsuperjApass1821Abenny2CaniesAsmooth15AgreybearAkelly12Aalberta1AgrudgeAanytimetodayAsorpresaAconfessAbeastmanApassword88AaccountaAzrx1100AtanlinesAmelodAspecialpAbutthea1BetsieAmachoneAf0cus1AklovnAleather9Ad41d8cArashley198AmultiscaAlipidAassfuckerAbeckham1AcloakAkimba1AjeffbeckAspider2AcaladanAoverseasAjeffersAgunnisonAburfordAclickitAyes123Abonanza1AenfuegoAwoodburyAgotribe1Ajordan98AsaloonAfigonaAweissAev7000AshitmanAbeeswaxAfrost1AthenetAshaneeAbobaApanther7AhangtimeAbellumAnimajnebApapoteAsalgarAbelfourDladonnaAmaloAbruneAjarethAmurph1AwonderwaAbelongAdoubtAendersAdanechkaAamoursAlobster2Adaddy3Axwing1AmarreroAdragonmanAshawnsBveto4kaAnadnerbAtagmanAmoneybagsAcaddy1AlibertasApookAhestonAassfuck1AtrevinoAstarwars123AfootloosAespoirAboffinAkalle123Agarcia12Aledzep1AbriangAeddingsAprussiaAindurainAsuperbobAbeotchAfiction9AbeppeAquartersAhjcnbrAeingangAtigger7Aclear1Alucky10AblcktrnAmecanoApantheraAbeast11AmoolahAlianeAbernie51AgetitnowAjesus01AnannerAillicitAradar123AnoeliaAjanelA11kingAsalineAcalamarAhostyAbertiAferrarifAhackarenAstblowAtatyoDer1AspazzCider8AcadmusAbeth69Asarah13BheppyBony678Apete14AnikopolAredtopAgoinApowerof3AchesssApoolboyAmarsbarsAgungraveBrave1A123321iAchevetteAscooby69AbojackAratliffAmetalheaAtwineAmyjdxtcxksAboubouneAlumpkinAfirebirAidontcarA4peaceAshiloh1AgroanAtennis01AdevelopeAntktdbpjh1994A1ussyAoilcanAjonny123Akrishna1Arover123ApeladoAgizzyAbibliotekaAghanaAboris2AphilemonAboots123AcooldogAblackgirAwiskersAcookyAdoggodAlcrastesAzzztopAgoldoneAdariaAkeeferAtoothpicAhertzAmistycatAvoyager7AclothAsnakeyesAtnvolsAbigdikA38ddAdevanteAbigbugAmacyBorphAbrian12BigbudAfirewateAnick1234-rem936AwetpussAbigcock1AemmaroseAjasonaApumpedAreddickAweedsAduckbuttBaniel00A1flyersAevenstarAblocksBakermanAlickpussAishardA1boobooAjohnieAchevvyAmestreAwarrior6AtyraAravenlofAalteraAmingerAhoorayAkickboxAdonahueAvegasmanAfoulballAtelluridAashley10AfoodsAshawtyAfutileBalcon01Atyrone1BopsideAjames19AsmarterBlurpyAcrazy2AlovelaceAattack1AfriesAmarkisAtimmayAcantstopAfellerA1nissanAmossyoakAconrad1AnicnacAcarrickAsummaryAtamiyaAoliphantAestreetAhome1ApapasmurAguesssAhasbeenAtimdogDmysAdandieAfleshbotAsuckemAhobbitsAyonderAtenseAnichelleAwinbigAhawaiiguyAgartersAtransalpAcarperAdimabilanAspillAdaniel10AelevationAsarita2BhatnerAtitianAciumAkoufax32AprivatesAjettasAalgerieAssnakeAconnor12Awilliam4AsilkieA12stringAstaufferAamocoAbrown2AfreakinAresinAmudhenAchocAfacesAredsox24Acamry1Aexcel1AhorsepowerApromo1Anadine1AmiasmaBeetmeAlailaAbinfordAcoloAgfhfyjqzAextra330AreggioA1birdieAtristinAbeast123Akeegan1AsamcatAparamounAcheeserBardmanAhattoriAtreechAlocksleyAmaxmotivesAnina1AtoolfanAseminarAmetal69AbitwiseAhockey33Athomas7AkookAheadroomAkatieeAozzmosisAsloopAtolkeinAcochraneApurple3AdreadfulAfirestonAcatch2Aserena1AmosheAcamilitAblackdragonA96fordA2500aaAdragon33Ablunt1Aneed4speedAirish88Atbird1ApluggerAmalakiAblackwidAsoylentAbacallAleonardo1Asnuggles1AnightshadeA1234567jAchoppeAbabylon6Aanal69Ablaze420AjetboatA1accordApotpieAbleedAchardAblurAcassiopeAhoggAoi812AblotterAmagiconeApolopoAdelta12AxboxAchandleAwolf123AhellhounAargonAjapan10AcollectoAredsox3AblowhardAknittingAbrunodogAwhodamanAx002tp00AfisheadAsoccer77AfoxesAradiumAlakesAcompacAraider12AsniffAbluelightAgaynorAbundaoAscott3AviceAredrobinAj10e5d4AroachesAcobra777AblueboysEwateBoomer12AjitterAcowdogAawesome123Acrystal7Astrip4meA1troubleAbandit11Am_roeselBaclarenB123456789AwethepeopleA111zzzzzAbeaulieuAnevinsAvettAbobbobboDobCneyCbo1234BlackpusBobo12Aturbo6AduckpondAnarendraApimpdadyAwirenutAiceman11Agoose5Anji90okmAtheman22ApuffdaddAnewmexicoAsuck69AhubrisAmoistAfrigateAskagenArsturboAnikko1AbobsmithAstatistikaAcypress1Ajethro1AothersAmalaka1Anetware1AresipsaAsheerAkutterAdesdemonAtimoshkaAbolatAkulikovaAvinegarAfujimoApipponeAvitamineAspears1AbucklesAwallace2Asex4freeAhead1ArenobAhoskinsAmandogAbonita1Azero000AhappyhappyAscooter5Achester8AboucheAcamus1Apussy9AbuggieBoogymanAkittykittyAhortenseAportnoyAopen321AboombaAchriswBdtnkfyAall4u9AvalidAcorsanoAkantotAlopotok01AboostedAshocker1AbuttttAnikki69Aruben1AiluvitAshadow23A200190ruAbubba8BoreAhogansAtemp12AwebpassAvolvos60ApassiveAvlad2011ApagansBrincipAboobear1AmaccomAnorwestAbobbyorrAfynjy123Awolf100Aboston11AyeahmanAswordsmaAmama22AzxcvbasdfgAplokijuAslipper1AhardwickApickwickAbowling3AhaglerAwombatsAminkeyAboxster1A987654321gAmegamaAdelilaAshazzaAwolf13AkfgeirfAprozakAjourdanAorange22Arobert19Aowen11ArenrutApuenteAvsythbAknotheadAaikman8Anemesis2AphilliAchaddyA1juniorAshelby2Arock22Apinky2AgoodloveAchoirboyAvikesAqwaserAcocomoAbrasil1AstonyAvikings2AanastaciAjimmypagAwelcome7AspitzAamitechAharley20AkenmoreAdvdcomAvitalogyArfybreksAtrick1AvisionarApussygalAcheatersAturtle2AkimmiAnunyaAlandmanAaugust20Apaul99AbrinksAmagnoliAolivier1AlackeyAimperatoAfire1234Aapril16AvehvfycrAmypuppyAbigjohn1ArobustAseptiembrAcisco69AbrothelAjenkinArobert23Ah397pnvrAlogoffAolinArisky1AunifiedAgoteamAhibernianArobertrAamazon1Arosebud7Awilson2Aenrique1AghislainAcompostAsaloAbuildAmilfhunterBa123123123AprioryAsamiaAxjy6721Anatalie2AroykeaneAshireAmamatataAcrazycAmikieAjackie2AbubbahAhackeditAdugganAclauseAbuck13BroncAgodfleshApornogAiamkingAdale38Abuffa1AsaulAgreen15AnonaAq123123AgungadinAstevegAchinaskiAfaithyAstorm12AtoadfrogAwestoverArabidAautomatiAsquirtleAcheezyAburbonAllebpmacAslavicAcamusAburrellAchikaraAdurexAplowboyAimbueAhormoneAwagner1AtheproAletmein5AduderAscaleAfastfunAconner1Astinker1BeekArestonAsyoungAdugwayArojoAwholeAkafka1AcatsssCmpus100AshamalAnacho1Afire12AeldonArangeroverAmohammaAskyblue1AcanalesAroamerAmorgansAlopeCgjamAfifty5AcapaAbrowardAingenierAranger3Adaddy69AcapuletAford350Atiger00Aenergy12Amarch14Burphy11Alydia1AparashaAnielsonAsaxoAtobbieApiloteAheather4AleonesAcharisseBarminaAvergilAcolegiataAlincolAsmootheAcarwash1AlatrellAeiderAbubbleboxAloquitAstanhopeAwiseassAnutsacA1qazxsAenjoy1BarnestA1pumpkinAphantom7AsuperpowerAdogdaysAu23456AsilvanBlagelseAtwothreeAdannygAbftestBallsdeepAalphasigAcccdemoAfire123Aclaire2Aaugust10Alth1108A1rustyAgoirish1AbxdumbArabbit69AtravailAchantal1AgreenpeaAbergen09ApetticoaAclasseBeilidhAsalterAlucidityAmanureAcentrumAqaz321AchilenoAmaskedAcexfhfA99rangerAestoppelAcarter80ArusticAunitAherderAfcgbhbyAgimmieAsunithaAonslowAmenardAcastAflagpoleAnicole0AchisholmAsouschefAcaterAriveratAmakaluApubliusAdancinAchezAthomasjAbmw540iAnaziAsignsAkasiAshootsBtackerAlateAiceman44AnicelyAvengeanceAchris100F24BosetteBlearwatBhumpyAkoolkatAjamesjamesAckflrbqAj1964AstreamsA18n28n24aAcoastersAshergarAnauticalAringo123BeachAtanitaAeconomyAjohnny12AhalberdAdillingeCvideAfatb0yAc00perBosenzaAslobodaAmoomanBarion1Aarsenal7AsunderAneedAdaimonAezmoneyAchestersAaidenAhuguesApatrick5Aaikman08Arobert4AelspethAroenickAwriter1AfoxmulderAjamjarAscurlockAdinkusAiconA1sailorAnalgeneAsnarfAallie1AcrackyAhenkieA1friendAquiqueAbandicootAdeath13AwiggyAmaster4Ajr1234Ahillary1ArumbaAbloodlustAshadow00AbambinaAyummiesAmelanyAcutoffAfreeholdBunnelAgrammarAmatthew4AitdoesAmnemonicAfubaredAdannysAnikiforAscubamanBaavedraAdtheyxbrAshirleAletsseeAtamplierAgorillasApelican1Afiction6AthwackAonetwo34AgunsmithAmurphydoAfallout1Aspectre1AjabberwoAtacticsAredryderAfightsAdean1AjesusgodAkickingAmusical1AloppolAjosephaArebel12AorganistAtoshkaAdangitAarchimedAspringsteenAwowsersApeeingAyamoon6AdangelAmiruvor79Afalcon7Amiatamx5AdogpileBfczAharukaAbirthday28AcrownsAstenAgeorgioAsinaloaAwilly123AjumpupAllabesabAcliqueAvicelordAlenardAhopper1AgerryberAfiascoBre_ak8yjAnahlikAepson1AdumpyAjergensAitsasecretAtakeoutAmountai1AwurstAbongwaterA1londonAfordsAheroineApepper14AraysAdereksAqweqwAmolarAfordgt40ArfhfdfyAhallelujahBunnybunAprankAmegamonAtuffgongAgymnast1Abutter11A123xyi2AtatarstanAoussamaAfiannaAtechniciAschwedenAthrobberAjacksonsApilgrimsAtech1AdeadzoneAkahlanAdethklokAxzsawqAcybrthcAbuck01Aqq123123Awilliams1Ac32649135Aflash33AspacejamAholycrapAdaman1AtummybedAnusratAdaniel26AsevennAkingpinsAdima1991AmacdogAspencer5AusagiAthecakeisalieAslushyBophie01Apenny2AmeeshaBagikAjerry69AdaddysgirlAirondeskAjasmine123AtomuchAmosias98AeseninAraleigh1AheadyAdaisy3112AzootsuitArubyroseAparallelAvova1992Adave2AjeffryAhardeeAletiziaAdutyAvfhfnbrA1986metsAdillyAenclaveAmafia1Aboomer22AswiftsAedwards1AfyodorAgemini13AmonteeAeagles11Asnafu2AcintakuAmossmanBaks5843Alincoln2AacessAgre69kikAcore2duoAublhjgjybrfAasheAdaniel20AmassimAhardcor1AorochimaruAhjlbntkbAparadoksAghjuhfvvbcnAdorightAbkmyehAfigure8BredaBuckyaAscamp1AontheoutsideAlouis123AmoonwalkBercury2AamenraArichelleAlafranceAdetourAhosersA5150vhAsexkingAalomarAwealthyAjahloveAringdingAapollo8AnefertitAmorriseyAtailhookAbujhmbujhmAthedarkAmeteoroAfelicia1AtinuvielAistinaAlolzBgkp500AgrandkidsAdarling1AredhedAdazzlerAchuckleAjager1AplumpyAvsajyjrBbhjckfdAzcfvfzkexifzAmax1234A1daveAlogginsApangolinAmarhabaAlatin1Adave22AsalfordAfiscalAescape1AfairbankAgrepwAernesAdesiAyieldAsoundwavAgreg78AsexmadAelvis99Arooney1AchiefyApilsungAdennis12CmolitionAlogisticsAdavinAphilosAlavonneAwhizzerAupiterAbluejay1Akosta1AsustanonAkylaAtiptoeAmedleyBarine21AnasaAwinsomeAdctvgbplfAxxxp455w0rd5Alllllll1Aooooooo1AgammelAdevanA1jerryAdeath2AqwertasdfgzxcvbAvegeta1AbrighamAmaxxamBoooseAilovetitClestAdebiBoesitAvallartaAabby12AlongjumpBittleguyAmagritteAdilnozaAsaltwaterAkokaineAsporeAdream2Bestiny7BragonssAklaipedaAsuckme1BcitraAdelightsAsmellyfeAreyesAdeutschlAharley88Abirthday27AembalmAvfvekmrfAkristie1BelebekA99strenghtAdenis2011Astalker2ApopeyA1stunnerAjessejamesAmolarsBadlenAwest1234Ajeter1BuditAsilver69Agreen9AtwentyonAdrstrangAyannicAjenna123AmalindaAcivic97Arusty21AshineonAcabinsAbuyerAwonderwomanAkanabisAwert21Afktif6115AkakahaA54gv768A826248sAleecherAkinkysexAgeekboyA62vetteAscuba2AbunterAussy1AtowserAsemmelAdochenkaAfujikoAnadjaAfirebugAsnake12Btarbug1AqueridaAmeesterAdiggitAparcelAoutlandAzsexdrAhotty1AdaltoApcgamerAdima3452AmaksimovAdima2011Bolphin5AkakdelaAp1nkb178AwarrantyApointblankAdinochkaAmama1965A1scorpioAdiosAmeasureAseitnapArfnz123AghjatccbjyfkAwitchyAgestaltAeatadickAdiscordiAonwardAsalsasAciderAjackhammerAnascaAhelpingAlamer1AsicherAetherAplayer21Asoccer23Arobert5AsirromAdeadfredAcornelisAbr5490AcntgfyjdBiaraAiloveyou22A1startreAjasper01AgromovAmelitaAnfhfctyrjAwonderlaAcygnetAberlin1945AstarkeyAmissionsBaxmax1AsortArambleAnovatoAfelixcatAvbhjyjdfAaksjdlasdakj89879Adominik1Atiger10AdocterA0000aaaaApussylipsBolo99AluciousAsenoritaAwaimeaAcjhjrbyfAdiamond8AcriketAterror1AvaletudoAgenoAmonitAjunitoAdoublejAsup3rmanAtigrAstryperApapa12A101054yyArbceyzAjehutyAweilandAkovalevaApelhamAisdamanAmandalaApercussiAvarkenAsallydogAnaruto010A1maddogAsissy123AartanisAthimbleAjune1503Araptor01ApoppersAmercy1AeamonnArs2000A23wkoa0fp78dkAevgenAsumsungAyhnujmAamerikAlucerAolga12A1488ssApalaciosAtriadA1sophieAerkebulanAnorthpoleAmarinamarinaAfdfyufhlAbalouAgbgtnrfAfifaAmastertAgilleAershovAreddeadAestefaniaAhoppingAsakiAibragimovAtenor1AradistAalbuquerqAjuliettAtimofeevaAsemperfAgrace2AcarameAjackpot3AchampoAlazarevaAramseAtrevAchristophAreptymrfAnextgenAguitarheroA50cenAhellbounAquintenAevrikaA00198Avaliant1Anokian82AtortillaAskytelAfatima753357AclemenApaloaltAsegundoAtelegrapAelemenAbigbrotherAredhat50AlongfellAmarijkeAlyricalAcucciolAtropicoAmistiApascal1AfiremaAredmaApendejAfacemanApoirotA123qwaAmirindaAtwatsBiger77AbkmifnAnthvbyfnjh2Aalgebra1AzugangAfalkenAlukaAsamson12AallwaysApjkmabhzAleandraAterroristAislamabadAsixpenceA6inchesArocksterAbluegreenA205gtiAreadynowAthing1Aitsme2BlyasAporridgeAlacrosse1AgalleonAsakinaAprolineaAmelomanAosiriAc7e4f8ezqhAprobablyAleadAfootsyA112233qqAmoveAstas1992ApinaArashaAlexus11AdkfcntkbyAjustin2AzafhjdfArjkjrjkmxbrAhcirApizarroAturinAmaggie01AsamuraAlatexxA123vv123AfarmhousAgthcjyfkAweyfvbAoctobreAjackass2Afusion1AduckheadAfilialAstar21BhowbizAjuanchBamaAregina1Ajordan00AfghghghBireiceAbirthday133AdirtycuntAjizzeaterAnaughtyaArebekaAshamrocAt66hksAfisheyeAasdf0987Aryan12AparmaCssmanAirongoatAsatyrBultanaArobert00Cses1AhowareyoA1magicAbebitaAforrealAtakefiveAreinholdAw3e4r5t6AlovegirlsApoweClkanCmmeAfoo123AilovefeeAwkmcpmnAprotectiAmansfieldArocket7Avaz21083AardennesAporsche8Amy_passAwackoAtrek5200AklingerAgamer123BoodnightAfrancis2ApinponAgeorge123AsarakawaAdrawohAgermanoAjake69Awilma1AjeannettAohiostAfreddoAmichigaAcuminAtourAstorm123CrosekAfreekyAmama1Axcat_xcaApicasoAsheetalBatineBondheimAlove0AudineseAgurkenA6215mila6215AprzemekAgirasoleAdathoAmarkuAtommy55Ail2fw2Asmd123AlizardkiBoh123AfunkerAlutzAseeingAfutboAseniseviyorAmauditA5unshineAquasiCinn1Aadi7id5AtraillsAjobsearchAfitzgeraldAhaltAgauraCrikAbmvm3e46gtrAhowie1AgalatasaAmiguel1Bail123Cry12Ajoshua23Agirls2Abible1Amarket1ApinkladyA1floridaAguardiaAnymphAblackadderAzkexifzAdallas33Agary1AflirtAethan123Ahamlet1AgauharAnewpass2AprirodaAgirishAkouklaA2606642yraAkgmtvaAcapucineAmahoomarAiloveyou143AmasteryAshangoBchokkAvalentinkaCrenikAsaipanApoutanaA111222aArussiAsandi1Bhit1234AbuttockAmaisuradzeAxsw2zaq1AuthfcbvA2008m2009AgregerA123b321AbabuinAkensingtonAmaggie10Azaq12wsxcde3AkennAoskar123Ashaka1AglueBreg13AdufusAgogaAoliver99Agoodboy1ApinkysAgooglyApublixAkossAqqq11Agq361hyBrifonAsatisfyApageupAmagsAshebadogAinxsAtucanoAdiagonalAjohn13AsmegAfgjkbyfhbzAgrind1AwheneverAhappiestAletmein123Agenius123AchinchillaAhockey77AgvancaAkeenerAgates1Aothello1Ahhhh1Atwain1AvfvfifAsuzie1AloliAharvest1ArjhjyfAshauncA1q3e5t7u9oApadovaAkaylynnAroskildeAhepburnCrbert0AratmirApol123456BroudAhirokiAlatinosAjuice5Aastros1AkippyAtariqAmurasakiAhubcapAscorpArowleyApampaAindiAk9vvos0aAmasha2011Aronaldo123Asoccer01AuplandAiamawesomeAlove4meAeisbaerAplushkaAkatushkaAjokermanAimboredArollersAtropicanaAsergeevichAloggingAdiamond9Aaccess16Asandy12At1234567AautocarApaycheck1AkissmyAdebaserArajendraActhdbcAvfubcnhAjamdownAvioleBoronovAblitzkriegAirairaaAubvyfcnbrfAbushmasterApilipenkoAkmdbwfAmirumirApcmciaAminaretsAhjvfirf1Alera2000A123456zzzAthommyAnathanaeApopochkaAbardakAkallisDmanAdecisionAbrookesAkelloggsAjake13AkalyanAmj2345Asilver5AjhonatanAmike33ApuckheadAridgewayAmotera15ArobbAworldwideAjammersAtimpaniAbackhomeAcandyfingerAstayrudeAakvariumAjohan1AstarscreamApatricia1AjasonhAkimmerAprologAsalvageAonlygodAdeathbloAb0hicaAjohnjrAlakerfanAkevin7AboxstersAjune1Arommel1AangoraAjerry123AsachikoBtephen2AlaniAthesimpsonsAborn2runAmaddiAnouveauAsigchiAredbird1ApadlockBetrikAquelleAgreatnesAmariamarAtomaszAmascittiAfeebleAsexwaxAtoshiCdd12AgohogsgoAaaa123aaaAkurwaA210689nAmakcimAdtybfvbyAkeneandAsizeBporkAnahtanAicefireAsiddhartAmst3kArajkumarAkiselevAvolodjaArock1234AtalentedAhammerheadAkatebushAgznybwfAsurgeAkozanostraAmalyshCgaAloveme12AzadnicaAvfieyzAohranaA1234567890lAsamyBkotinaAmark10DinochkaBininaAsahtm069AbcnbyfApolyakovaAmaintenanceAraptors1Amisia1Alove12345BjkkfhApapa123AvfhmzyfAcarnavalAvladivostokAbigrodAsaleAwxc123AzoeyAazsxdc123AlarrygArobert6AlavrikA1raidersAsqloledbAaddingAyfcnhjtybtAvitalik123AoinkAscooter3AgjhjlfcjqrbArustikAleon123AnatronAcabezaAmatt22Anixon1AcandyeaterAjammygirlAlittleslutAmocelotAovermarsAcarlsberAmakayla1BoemanA7samuraiAhelpctrAnexxusAm1m2m3m4Alove777321777ArellimAcorratecAsniper123Amjbnbna1AyoshimitsuAsupermAcscompAmax12345Csha2010AreddawnAeventlogAvfif1986AactivationA1sharkAwminetAcitbannaAmutinyApodiatryAmessinaAnicki1A192837465qAbellerAokmnjiAvjkjnjrAgfhfdjpbrAmostafaAluggageAvoronovaAosipovaA123456789aaaAsettingAieinfo5Apoopie1AnfyzAkopa1994Anastya1997AcnthdjxrfAnurgulAoksankaA4815162342lfAnepbr2009AswetikAvardannArahul123CsulAsnh4lifeAzalinaAw74156900Acelt29Apfqwtd27121988Azxcvbn3215AserdaDgey7BssataAtekkonA16fretbAtimoteAcnfc35762209A221133zAhassagjsA4050C80A9008A10088B4078B9038A20058B4048B6048B9038D48A33669A89586A96385A113411E56C4466C6211B23233D478E98C4563C5480D896C7266D576B34267D652C5789C8500B47000C9200B57359C9654B72165C7777C9328B87420B96500C7506D610D802C8100D510D620D707D802F3E10C9004E90D404F6D520D610A213456B22221F3C6688B32123B46642D969B86685A345123B58853B61619C9987A422119B44455B56963B95812A542678B51155C2233B65758C7432A636332B96977C9999A741369B76655C7007B87899A887788C8666A901234C7629B51623B97755C9555A1213456C34556D6951C58963B478965B590753D3575A2236345B580147B947251A4050328A6657684A7106189A9035768B517883A12101492D41618C341231E5543D78945C601196B5161718C541632B9688691C811983D61987D88891A22224444E8888C360679A33331111C445566A41513042B5683968A56259090A66778899A71727374B4125896B8789898A91929394A123234345E58789B47963258A222222000A383295502A451236789A741963852B89951123A987321654A1324354657B994200414A2143658709AholtBeadspinA0040AerskineAmerlin7AeffieAtdfqugl5AmembeA123happyAhahahahAmarch10AgeneseoAyooperA66stangAgiucilArobbiehAsmilieAclosterAswivelAcoppercoAwsbadminArandybCmtoughAlindsay2AdigbyApernellAmarmo3Akassa1Aass904Abird333AspearmanAkg5698ApercentCbbles2AbrandsBlakecaAcombosA1motherAfox1AchapperAlovesazzAquartetAhohnerAnataleeAbigbosAfarrarAyllekAinfraAnikolA1ddddddAfranwayA1hhhhhhhAguppy1AbuttboyAcarmen2AsensitivAeasleyBcnirpAamc20277AnamrepusAadamssAgarpAjimmiAassessA12345677654321AarronAjj9999AkekkutApornboyAshkiperAkitty7Abacchus1Achester123Aron123AfirstaidAcanopusBhantelleAfalklandAhayashiAincidentAschnuckiAgreen13Alovers1Akm83wa00AdantonArivermanAilikeikeAaaron2AfetischAmc6288AperrysBaris75Aamg921Acarlos68AbillyjoBlueprintA1531bsAzcgihlkeAeinstienAomysutAardenAgottenAtrebor1Agismo1Aserpent1AraritanAcalibreAgus123AdoorbellAefraiApoochiAmondeAemmausAjerrAbutton1AwildfirAalvaritoAcaesarsAguerillaBooner01AvitebskAnordmanAcubs1AutyyflmtdyfAalfettaAmiteAabsolut1BttilioAexcitingAbusstopAgoodallAatonalBndrew00AlampshadeBesyaApaulitaA6y7u8iAkorgm1AastaBndrew8AgamemanA1badassA78fordA1caseyAcoke1AredloverAmonchiAtamuCtumAalex55Ahaha1234CmalAluckydayAzxcvbnmmnbvcxzAcode3Arocket01A1stephenAmerde1AgenleeA1vikingAwsxcdeArecnepsAedisniA5seks7A1uuuuuBhundredBmagnetoAvipperA1cockAsivaAmonkey19Aangel200Abilly8AdesigAfalcon21AsorbetAfuckintiAabakusAjack55Aclimber1AlyonsAundergrounAlimelighAaralA123321lAbowlesAfinkAskidderAbaseball21Aokk34125AsylviahansAmeijerAcastillaAsuckmydicBpyrosAajonesBdditionApass23AshadwellA21952qAbodenseeAgofferAfubu05AamstradApvhpx6AgreenberAkippaxAmarinasAlemontAchoccyBallie1AalternAtankmanA0187541AaladinoAroot138Am0ntlureAallproB1b2AdebtfreeAredflagAvisitingAnzceg251Apibzk431AzmpimejeAboonedogAallendeBccounAwtsfjmi7AtwinpeaksAforlornApimpdoggAaustin97AzippieAherbiAmsujoeAaltamiraAkatie12Among1niAjokkerAbad1AschoenAgfhjkmrfAlynch1AkyotoAalesiAwhitlockAasilAcaesaAandrew21AbrijamAlucerneBbvfhbrAsessoAgreencatAbertyBigballerBoseArdq5ww4xAdonitaAmatthew10AbigboatArandysAzendenAmech6666AfernwoodAomytvc15AastrologAmonkmanAseltzerAbittnerBunnerAcgzfrhufAacotecAneggyAboracayAuxmdzi4oAashley22BndrewbCgel66Alvd9341AbearboonAdekcahAcivilizationArustywAscrubberAdaphne1ArebbeccaAkeikoAaryanAblackwellAhannArmpopAbigsmurfAwwwxxxAjohnnoAcmigtvo7Atiger86Ah72sfibbnlAmutt22puAbjonesArathboneAargumentsBndrewjAlogoAbrollyAcobbleAmusic5AswainAonelifeAafriendAdessieAtina1AcharliedAsally2AhousingAchicaneAkincaidApaidAjerkitAleadingAsgegukbmBlaineAroniAcartoon1Ahendrix2Ageorge10Bilbert2707AcuriosoAyamaAsparesA123poiAmikerAseeallAimemineAwtpmjgAsandmaAydnarbAhobbeAmonrealAtspeter1AsrawratsAundneAchellyAkarendAindobokepAespirituAhonda2000AnfgbpltwqAfuckersssAavantisBddersA12345loveAcarrosAburgerkiA63chevyAloonerAseadoo96AroebuckAsarah200Aakira123AmspaulAtigertigerAqwqw1212Athomas3AjrracingAfreesurfAacinomAbryguyAkanus1Aas2579A66mustanAkinshasaAshankerAbrasovA98stangAexuperyAchampion1Aeagle69A4girlsAlolomgAoldgoldArancid1AabbeyroaAforfarAgavilanAslainte6CoogyBubskinAupdropAsimonovaAnicole69AtescosApizzaaAnicosiaAgateway7AjizzmanAnaggingAilovebriAwildcat7Amatt25Aw1408776wAgreenwicAkatmanA4sureAtrucks1AfuckyouaAjoeyjojoAvgy78uhbAgatinhaAbabe12AdbrecmrfAtaifunAcumsalotAavariceAjjamesAschroederBexy23AboogsAdavid25AmichaeleApolka1AnekromantAmoundsAplato2AtextileAdeepredAsandritaAmucusAripeAujhjljrAvortechAgeraniumCtbackAnorgeAsosliteAdanAlongingAqwerty56Alight2AturbozAsolo44ApoopdickAamilcarAbassiAgeddonAnaniAsandy3AbertilAritzA98cobraApuregoldA78vetteAslappy1A4p9f8njaAsapiensAanna88A77sunsetAaaurafmfAhasmikAgoldzAstudiosAbuddy111A1pamelaAbujinkanAmustang66Abb1234A9874563210ArogetsAaa1998CabbbcccDdddAmoon12Adundee1AkokoroApharaonAmisiaczek1AinbhkbwAadnanAmeerkatAbatman9AharbingerA333333aAscandiskAbigmooseA1blasterAnatasha5Aaaron8AconnAjoesephApinocchioAoliver12AheckleAoutkast1AboinkAaugust28AmaurerAbayareaBravo20Anoway123AshivamAiskandarAhfcnbirfAmalmsteeAgetin1AalihanAswitcherAab123Abma2002Aiverson1Awinter07AcucoAjanuszAkameraAmamataAabbasovDie1AmuranoAhollAabbotAcoco1234Adecember2Aabe5AprovaAbeholdBastichAthegreekAalex1980AmaldonadA1peterAabidjanArehanaAboooooA123456789*AmalayAgrandkidAdoingitAhughjassAas123AmuhammaAerundaA123123qwAdiana2002AfdsafAalimovAgfnhjyAdeniszAabubakrAjones123AalphabravoAcertifiedAbeamishAlucydog1CrcherAewankoAsnapple1B211278AalysiaBvionicsAeriepaAkristi1Amichael13Alange9xAkerygmaAcrazyhorApoiqweAmarine12AcopleyAsukhoiAapril30AprogresAreset123AkottayamAdanknugsAtriathlonAjoshua04AcruzeiroAdarkroomAtgifAranger82Aandrea10BlizeAblacklabelAalaineAmywayApropelAfanta123AbobblesAanakin99Cdrew33A2n3055AmeribelAthug4lifeAfixedAglassicAparagon1AgibraltaAbloodhouAtilleieAcoldoneAbadhabitAlouise01AevaluateAfindaupair007AredrosAmets1AemmitAsasha5Aqq123321AannettaCthony12BdilAwhippleAkambingAteeniesAfungibleAserge1Aalina2009AozzymanAktyj4rfAcorsarAalaniBdidas23G99AyoupornAstrohsAbfltuaAxnttcbAdragon06AallpassBmerica7Adaddy21Amario6AonlyloveApp04aAstuttAwtigerBantAgjkjdbyrfAq7w8e9AblitzkriArosanaAhardkoreAffviiiAjixianAmaricAbiologiaAshaoliAeric69AsaiyajinAmovies1AbetweenAheffnerAsyndromeAnaughty2AlestaAcervantesBourtyApalladioBrowler1AgalapagoAafrican1Aichiban1AcatsupBhrisnAe214fre21AvindieselAafnbvfBndres1AultimatumAfifa2000A1turtleAmercedezAaftergloBgata1Bstra12Altybc123AnavillusAcaillouAhamtaroAmarksmanAsantoriniAglucasAcarmen00AjedidiahAabhtqaAironmaAanna1979AmotylekAvernieAhurtsAthemannAcapsuleAswineBas123AalvaA30secondsAthegr81AbevisAadg123BikaBkerkeAbabykoAsmokiAkabanchikAaimhighAvasilevAulrtabA33333vAfruit1Apredator1AairtimeAmuddddAdiracAvfeukbAlabudaAflashmeAsupermacAbiturboAsanmarcoAdominoesAalex73AhillelAyessongsAjensen1AholleAblahblaAsungAcatullusAvadim1995AlusakaAmeltinAnodnolAautobodyAq3dm17AakikoAstar33AlimonadA7777777fAcassyAkayodeAmalachyAfootball10BkmnfbhAwarhawksAanna1992AbalabamaA1qaz2wsx3AbarchettAalacranAbosco2AcanoesAlovesuAcladdaghAalpha135792468AbaronessAwrenAalloraBubieAlouisvilAboeing747AalaniaAparol12345AwetlandAnata1977Aitalias1Anokia12Asandra69Avoyager6AseabirdAhv120dvAes206enAmiticoAroseannAliberdadeBathropAartur4ikApalladiumAinshallahAdfktxrfAghtdtlvtldtlAnewyork0Abatman00Aolga1991Aalena1992DisterAedwardcullenAamorosBlejandro1AfktrcfAvfrcbvtyrjBtnhj2033As1a2s3h4a5Afkbyf123AazerokA123alexAalex87CkogolikAzxc123qweAnjnjirfAw1w2w3w4w5AkfdfylfBlubnichkaA20162016upAvjqfyutkArestart1AgordienkoAlena22AkardelenAalex555AbuggermeAoutletAalex1992ApolancoArodionovA1katieAfafyfcmtdAalex1993AgfhfktkjuhfvAqazwsx123456Aalex66A55555sAapril29ApyfrjvcndjAsexo69AmoskowAanytkaAmillionerAsoaresAcomidaAgofsu338Aamber12Aprincess2A147369aAright4Beading1AdrusillaAsweetdreamsAasdfvcxzAmaiaAtomasaAstrasseA70780070780AumisushiAwingtsunAstromAcancun1Aharley4AtomsonAnicaraguAgerasimovAbapassAvoldemorAtrotter1AcosminAbudda1Anokia1600Aalina2000Alena1234AannemarieApetruhaAazerbaycanBlisaalisaEha1A1geminiAlutheranAstepkaAazlk2141Blla123Brtem2000Ah0lygr41lAnation1AsalonAxxx999AjigglyAfreejackAparsnipAdiya2003AragweedAtawny20AanfiskaAelmhurstAallisAcarolynnAm0nkeyb0Aalpha6AcasillasApodstavaA2-octA06251106AeliaAhanaleiAlytdybrbdfvgbhfAgypsydogAraver1Awolf99Ajagger1ArabitAalouetteAelement2Agrace7Asaxon1A1sallyAyaseminAhathorAprovidiaAsantanderBuccess7Apeace2Adenis1989AcarolsAanashaAtindoorA0406198AkarrieAjoaoAamarantaAsenhasBandiesAbanjosAneckkAzieglerAhegemonAasd123asd123Aparola12Aroom101AputanaAfigtreeAjordan6AhulahoopAmibebA02143006AastrodogBmuletBeroflotAsahilAkorvetAparedesAaugust21Az12345zAflurryAsenthilAmagiusBexico2AfashistAbillerAlovegoodAscooter8AtendulkarAamy1Aoctober31AevetteAmousemouseBilkingA04098AtechnAarteAdomingueA7777777qAsollyBhalom1AivankoAjulitAastriBzaliyaArobert24AsvenskAfilofaxAbettina1AschmidBantamariaAferraroApasswordasswordAandrea00AmeloniAronoAqweasdzxc12Aandrea69AnightfallArestBonaldinho10AgrushaAfernando1AgostosaoAbelomorAhoticeAbabnikAzxcvqwerAamantActdthysqAandriaAbmwpowerAaudirs4BnnyAconsult1Ausa1776AabuelitaAholdupAcosmeticBaledoniAa2345678BnushkaAcrocAfunniesAangel2010AbombardeAgirlygirlAdrake2AcarmonaAgoosieAangelfaceAingressAk1f4c8AangelieAchippeAdemon13AhernandoAladogaAfr33d0mAvfvfxrfAzakariaAanna11F998E77EbellaAzooparkApavel123ArosalitaAsupeAmalibBeliAyjuufyjAcanariasAnot4meAattemptArfvbgtApatricksAvincenteAmironenkoAsalviaAkfrhbvjpfAlxdumbAgermesAslackersBvensps820ApogosyanAshakeelAapartAequalApifagorAbuzzard1AscampyAdistalAmclarenfA12andriy14AcharadeA123vvv123AonimushaAunderwaterAbarristeAseaquestAmiserAcaliburnAlabyrinthA#name?AbujhtdbxAcristobalCepusculoAmuckelAepidemiaAchupakabraAmascaraAfortyoneAmaryseBontreuxAjorge123AarseneA000999888AednaAp@ssw0rAartem1998Atheman2AchiemseeAbelmondoAartur123ArefusedAyakudzaAmaksimussAipo54tj45uy856As123456sAaznprideAuhohAkerstin1AaskariA3616615aAun4givenAlaudrupAphatazzAgapingAdogmatixAastrasBvaloAbudlight1Aqazxsw22Abadboy123AishornyAbecker1AfinancialAkaviarApuddin1AtulleyAstern1AautobusAcfgfa03A1jakeAvlad12Ajedi99AslimeyBnakepitAbaby31Aktc110AsolidsAisthebestAb1t3m3AgfhjklAtherocksAbrianfAjune30AupyachkaAbadstuffAchinosAwaterfallsAraffleAkuricaAzippersAevery1AstixAbaggageAoceaniaAjimmmyAreality5AbuggsyAprivetikAbranstonAgohabsAfdjtsaAshitfireAboulevarA1mavericAchamorroAfrickAcalifBookmanArossmanAnightcraAmaranathApumpitupAbaldwin1AgroomAshadow20AfarmeApuntAkeksAwestside1ApieroAseveAamoureuxAkent1AcavaliersAbananenAfamilleAbretBurpAlick1AstalionAballzzAmervynAkazooAjonah1Astone2BchnitzeA1brotherAbrotheAhornerAdrdreArtyu4567Abanana69Asplash1Ake12fe13AdentistaAhayekAwannaseeAvivaceAblue18BangcockAchris77AsofaAkronicAbangmeDkyAimjakie123AcruisingAforkAgreen75Asnook1AchouetteAblaster2DtherAmoistureAbantuAzappAnhatrangAapril18A1billyAwolcottAnicksterAgemini6AjackasssAcollege2ArubberduckAkaka123AmacavityAhal2001AlouissArikkiAcheckupAnikegolfAkotyaraArobertsonAtressAgarboAblakerBowzerAplatinum1AbdogA1purpleAlarryboyBegendarAwarpigAh0ckeyAincorrectAbishoBarrAvilleneuveArosalinaAlaughsArasberryAheelerAcassey1AblueeeAasianlovAkakka12A1whiteAtimezoneAnewberryApatches2AsantasA1driverAsaskia1AbassmasterAmoneyshoAunnamedAbart01Asesame1AchefdomAbooobsAfantasieAmarlene1AjamessssAmuadibAnovember1A1yankeesAloxpidrA1suckerAkiller21Acedar1BompeteAbass1234AsnappersAhummer99AmamourAbloopBass11AhobbitonAsheehanAlbyfvbnAwrathApitmanBharmaAsuckme69Abatman22AmcmillanAgospursAbabygirl2AkaminaAberrieAaramatA12q34w56eAreturnsAbatman3Ajedi1AtriadeAbatorAwinter13Abmx4lifeAstuckerAwjc200AmirrorsAstashaAtamperAexhaustAwhitneAagnosticAgracchusAdavisonAboloAmomo123ArecorderAsex4everAamerican1AlatticeAgodzillBateway5Arovers1Aslammer1Abubba99Aweed123Abball15Black47Aelite2AcastingsAxz33333AlovecatAsabrosaAjeremy2A2shortAboodlesAwatson0Abuddy9Apoptart1Abrian5Arussell7AsammysosAlankyAbobby5AlookatAcharter1A1mollyAhabbo123BornedAgo49ersAbigdawg1Agodzils4s7AnuttinAashburnApsycho72AbrianlAfalcon4Ajimmy11AbillycAchemAtesto12AfuzzbuttAultracashAbeerguyAmegan7Aemail1Abooby1Ayankees23AmaceoAwanda1AjhendrixAedwin1AquorumAdespinaAsun32Arocket2Abeach2AcbreezeAwikingerAdorkboyAruggieroBobert71AblehBillllAearwaxAmeanieAskiing1A12345678lAcasper13Adan3Awood1AgirlfrieAmrfishAtameAbears2AtaylormadeAwedgesAdick11AzerohourAsilentboAgasketAboston99AlondresAnathaliAsarahdAcharles9AbutterbeAkittycat1AdecayAfollettAwinston3Aozone1AxtvjlfyAecurbAcodieAgwarAbunsenBlowjob6Aflanker7Aqaz123qazAhopsAshoehornAradfordAeroicaA95jeepAsheffwedAgeorgie1Aadler1Ahunter5AbenjArachel7Ajake00AtowandaAmoose7AtweezerAberikAfleckAarmyofonArustangAboudinAthorinAdstarsAcockloverAbubba13AlyricAvf279smAbrooklinAsvenjaAkippersA1tennisAjazmiAangel100AcaritaAblue222AcomposeAkuntAmetaphorAnorwich1ArutledgeAglastronAmangooAziggieAdunlapAbilouteAmuddy1Ababylon1AcopyrightAleodogAkiller45AbenniAchris26AholymanAcalleAtigger10AkarupspcAillusionsAbailey99A89semtsriutyAjoshyAoliver123Abjc210ArhumbaAholly12AjuiceboxAceltAwickAberl1952Agareth1AevelyneAamarantAberetAneelyAasanteApanaAbergeronApittsAnosleepAdavid99Alucia1AgeminisA1voyagerAbabe1987AvirussAduffydogAlibrary1AzipzapAgoodguysAkissmAragersAmachAdunkerAicenineAcody01AdaywalkeAgateway6AschatjeAdruhay17AtalusAvika12345AforeveryoungAjames777AfordfocuAsierra12AnosbigAbroker1AjazzmineAhondacAshoutAbadboys2AharlieAsouleaterApunanyAhoyasAjigglesAgonadAwendAbryan2BiznesCgmac12AtrisAdiscosAbeastiesAcamanoAvandyAflanneryApurple7Aytrewq11AvalerAbaseball10AvasserAmaggie123Afw190dAtaarnaAsanduskyAwaycoolAthaiAchingAsuper21Ajackson4AsoldoutAmarch3AchoduAziggydogAsaucesAdakotasApointbreakAmaxxumAfillyAsunocoAblackandBiankaAexxonAjiveA23843dimaAiluvatarAgherkinAbs2010Blue16E20Alove6Acarolin1AreelBinker1AtatasApeter3AdaisiesAfishing4AnyislesAfuckher1AbigwilliAgetsome1AbreizhAconciseAjennahAblizzard1AgizmodogAfaithlessAkatrinkaApackingAtrymeAbigtimerAmartin21ApalleAscarredAtarquinAcumtomeAbluegrassAthumper2AbutkisAsteve3AbigcA7elephantAscrumpAchiquitoAmoxie7AlonghaulAbullshit1A2timesAgayleAsdicmt7seytnAplayboy3A1bigtitsAmaxxieAtheblackA54chevyAdiverdowAtitsassAirishboyA1bigmanAbigdog2Acasey12AramchargAshitttAjustin99Abuffalo7AiamsocoolAsavingsAcarpetsAfeversAbigfish1AnewburyAgoodlordBdogApharmdAalltimeAwhoppersAtony99AfazerBootfuckAwillianAthedude1Abiggy1Aphantom4A666xxxAzeeshanAsridharAbratpackAmitinoAbigjackA12inchApixelsAkilleenAcbr600f2Amoose23AbigkahunAkennedy12Ahappy21AoptionalAsupriseAkathy69AtexasboyAbigpimpnAgrizzleAholla1BardieBumberAdeedee1AschlitzAclaymanAsynchroA1josephAtheloveAcatskillAmoranAthebeanAjerkerAcccc1Ayellow8AitsmeeAbudzAtylerca310AhogwildAcyclistBougar11Agoliath1AthreedayA52xmaxAfrodobagAranger13AherbsAphigamAshaneyAasdasdaAdjeter2Abill063Asex101AhelloworAartherAsnafu1ApaddlerAbristolcAfarrowAnudge1Ascamper1AhooptyAasteriaAchaliceBipollaAtechnicianAdabearAsadiemaeAph0enixAgobletAstuckAopusxxAallybongAswearerAjannikAnixonsAmontieAjaymeAbulldog6AharleymaAbrad22Arebels1AbabybirdAladenAbrassyAzheng2568AomglolAburgosAtacos1ApotentAmorettiAtractor1AboogeyAemoneyAgiancarlAplease12AwestfielAgmcjimmyAblondie2AtrulyAcaryAbobmanAkiller22AolssonApodrugaAchowmeinAblacktieAleeeAranch1AdustedApetrieAkaitlyn1Atiger9Adylan123Balton1AmoverAtable1AaolsuxAweed1AnoloseAblack99Apowder1AburritosAshakazulApaul04Adeath66AblacksonblonAtricksteAcigaretteAsasuke123AderelictAtalbertAkumiteAhellsbelArallenAbrandon5Amanson1A1nstantAbravo123AfloralAmagic12Ablack69AshoelessAhyruleAsaidinAcowboys3AentreAfritolayAbigbear1Atottenham1Bhirteen13AitalieAmensosAtabryantAgreenguyAcammanAbudlighA72305zAsunglassesAgrovesAsaufenArosie123AsaddlesAcougaBhimera1A420842084208555AzorkAsexypassAdrew123AfrankzappaArmanisAnsnabh76Aladies1Asecret99Arfnz11Anightmare1AorgansAlantern1AorochiAchrisiAslayer123AgoodnighAmrblueAaztlanAblossomsA11jackAkerplunkAcutoutAblowsAshipmanAed1234Ablue333Ach3ch2ohAspritAblueboxAtomcruisAroyals1Awer234AgrasssAmariamariaAelzorroCdoraA1specialAbuddy5AtenorsAdogbonesAcooderAgizmocatArebecca9AcasinAglennaAsaspursAtgacbAbelushiAitsme1AmaconAfishfryAtammiAboggyApoop11Baper123Aru4692ApheobeAresearch1AigmtvaAgrisAstruckAxehrf2011Aaussie1AsammyjoAcaptain7Abobbi1AtheaAapril11AdaffydAgateway0Anewport2AphiladelAsecret00AhowareyouAtexas69AeldredAcarmelitAbmfc2353AponchAmaster32AineedsexAchimneyA666hellAastaireAstogieAjazzizAgallupAexplosivAmichigan1Aboner2Atadpole1Bungdom6AmcfarlanAbobbyvAmohinderAclk320AgiovaniA19thholeAspunkerAmybaby1Acancer69ApucciAquepasaAmanon1AforestmanAworr3619AmaffiaAcorporationAvinsonAtheramsArjvgjnAellswortAckfdrfAlion12Achad1AorthoAjamesjAmuteAbonjovAtaylor10AlousyAf67342AcammerBobyAdoobyCwn1AtextAbookemAflatboatAgaggleAflatbedAcuminmeAquitAcroonerBoncernA2w93jpa4AlevellerAdude22Bee123ApelosaAloopedAhpesojA0pxAjeriApapermanAtakethatAcorneyBarlasAgussetAcarmine1Aglobe1AhagarAliz8tysiuAartilleryAwetzlarAstillerAbot_schokkAlimonadeAireland3AsamsaAdinkieAsapphirAlitaAcopiesCleenAmartin19AboxerdogAknocksAbedas1Amax528Akyle11AsilvermoAfish12AlungAfree99A00sevenA2br02bAchimpsAteagueAmuddogAarrogantAstup1dBhadoeAlisaloveAwynterAtexas5AhondaaApeaches3Agobucks1CredsoxAwind0wsAmuddAkukarachaBileyAoneilAfootball7Aidontknow1AwettAdakota11Aballin23Ahidden1Abulldog3Ahockey30AbraziliaAdonatellaAmindspriAarribaAdddd1Ataylor6AspionkopApedrAmikeschAkarolaAaerospacAbldassAsweetiepieAkatiewAgorkyAbrentwoodAdogtownAjordyAemmonsBdwardoAqualcommArastlinBufinoAtwinkiesApingeye2Arichard5AsewellAdekalbAcadeAmax666Cker1AtunisieAjanosAchloedogAghotiAjamie12AsuppleBkyhawk1AwombaAmanolisAobninskAravennaAcyrilleAbutler1ApruneAroutineAconroyAfdfsfafAs11111AkalvinAchipchopAkittyhawAmansoorAarbuckleAjazmine1AakinomAbastropAonmeAasdf456Abenno007AdustiBexter12AchelsyAtexas22AroadraceBatcatApauleyBenwindoAwinston9Ajasmine0AdryflyAbear98AredcoatAgreen88Aalkanaft123Am0nsterAliberty9Acarrera1Aandrew7AcavidAjktrcfylhAbubba111AtropicsAnotrubAwormyAplay123Ajulia666AsmoopyAmoonbarAgatorfanAilliadAturntableAdienstagAstarshinAcandy69AdyexrfAfunformeAloves1A3childrenAgunzAkevin9Athink1Amays24AtatonkaAchevy57Arocha2AdecoyAcajunsAantoninoAslapheadAbully1AlokatorAcoolinAstar23AmurmelAlxgiwylApantatAyvesAchar4uAgordy1AkinskiAbushkaAsnortAcamrynAredlabelBichardcAlocdogAjune16AsawbladeArubber1AasdfzxcAwoodbineAdubbieAjake22AanimasAhavasuAcrazyhorseApaylessAmaddAktjynsq40147A1a2a3a4a5a6aAlolmanAq123321qAjamiebAloaferAhfgbhfAbullnuts2003AstasisAburner1Aheath1Adopey01AlittlefoApoormanAnelson11AsolteroAcandle1AstatueApopcorn2Atotti10AratbertA05058Aduke13Ashauna1AclinchBhampyBatbirdAone23456AslapnutzAlukesterAwaitAcharles7Afrank21AmiquelApalitoAzippo123Apass3sAcatseyeCmeron9ArassilonAhackneyAfreemontAbj200ex1AnibletAcappy1FAsimonnBensibleAfeelAarnetteApokieAturnbullAkrista1BokopellAredtideAfinalsAemiratesAbuzzy1AcumbriaAvidalocaAcarlos10Amiami123AgastoneAdelongAstorm2AcarnivorAtoolman1AickyAjackrussApegaseArafaAcasadoAmundoAilovesamAcdogBowsruleAboojumAwheels1AchasmAdundasAcharles4AgreysonAtennis22AlongtailAmukkulaAsenior1AeddieboyAsvtcobraA9231wcfAchicago23AnjptyaAblueskiesAhogdogAsunflower1AnicebuttAcchaiyasAhonorsAmaster9AassortedAcderfvAgoyanksAabsalomAventAcecil1Ared555Ajason23AleadersAmangusAtofuAgjyjvfhtdfAniceboyAcerf123Aranger66Aqwertyui1AfleshyAlumber1Ayankee23Aninety9Apooh1Aswing1BpikersAhocuspocusAricemanAnagsheadAchiperCanduArakkasanAkikowuAcoolidgeBreditcaAdiehard1A3timesAcharizardAbhattiBbnyxyxAhelpme96Aace2luvAgarrickAfourtraxAchasmanCienAsumanAelasticAconnectoAanninaApinoAcameron6AfernanAhjvfynbrAblue34AleihakAcastaBhikaAmasalaAsimonsaysAlove4AchinadollAjackdawAlanierAks1977AworkersAsuka11AtaekwonAgefccgaAbugginA1cobraAwest12AuiorewAheimlichAjaneenAmartysAstooges3Apuppy3AbatfinkAtankdogApasswort1Anice1AcometaAsleeper1AnoonehackmeApsycho78Arhh8319AazulAcieloAfoxrunAlothlorienA1xavierAtoptottyAbackoffBillie1AozarksApeter11AconstantaBasbahAtwinstarBheborgA67chevyAcody13A1psychoAvaluesApootAscaffoldAaa111111AcarmackAbotherApernillaAlexxAb0neheadAsergiuAam56789A1bostonAvalueAmitaAfoutreAiceman01AjasonleeBohnmcAtomtoAcharlotte1AscheduleAcroydonAannieeApolo123AcjdtcnmAlegend2AroperAsswordAmontana2AlynyrdAdynoAwhackAnonnieAlaplaceArossiniAflingAcreaseAphantom0Aginger01BthangA1rulesBcrackerAstickitAjamaicanAsprite1AnohopeArachAblacksheepAshelleApreviewAlantanaAgemsAlbc999AdriftAcranberryAtl1000Ajulie2AtumbinAcuteakoCm69Ahondo17AaddidasAhomageAfsid3nAmadruga2Ademon2AbellaireBulldogs1Apauline1AmoocherAlion123At5r4e3w2q1AconfedAlintonAguamAbollenApussy420AdeeannAfelix2AverneAstarwars3AretreatAbebitoAraven666AcrocketAserafinaA1jasmineAsaturninAplasticpAss6z2sw6luAroadsAfrugalAneurosisAfivekidsAsnoopy13AconnexAagainstAwimbledonAryebreadAsevenoutAcruzanAeagles5AtwinksAphoenix6Aemma123AcjkytxyfzAangiesAsportoAquinceyAfooferAnouvelleA2sexy4uAcatolicaAspy007AzmanAfrostbiteAkelly5AcursorAstoney1BitepassApederastAtasha123CngledAgoggleA1raiderAgoherdAamstbbAcubansAgeorge99AcucaAkneelAbroadbanAthecultAwidewAcumstainArjvfhjdfAhijackAlick69Asuper99AlongestAhightideA1mountaiAstarzzBweetboyBhirowAiddqd88AbeisbolA1serviceAshowme1AiforgotiAcherokee1AsupermodAdawnieAharolAjessupAx1y2z3AdrugfreeAalex8899AmaideAtupacsApelonAoilers1Alesley1Ashelbygt500AusnretAkaleighAdmiller12asA1mookieAmaelstroApoison1Aerotica1Ared1soxAgurumayiArhett1BockandrollAissexyAomenAevgenijAcaesar12AgoldsteiAsalasAagain1ApoulAsalomon1Aalpha9Adima77Aface2faceA050605rostikB1470258AdemonikAhappycatAngentotAdenise01AgrandmasAfootballsAmikellArichardoA19960610iljaAdeshonBjljghjdjlAranierAlfieyzAjake02Abundy1A1faithAbkqtzaAhand2000A7410258963Afreesex1AdaileyAtazzyAdakotahAmorena1Akar120cAearnhartAaugust30AharveysAjesusfreakAtompettyAkristoferA1texasAopaqueAmonroAdevil66BamirkaCrnitAloserkidActhueyzAtiffanysAgoolinerAunleashedAdinodogAoldboyAhotpornAdave11Aripken08AdracAlineage123Ajeter02AdannaApersistAmadelinAhammer00A1dancerAketchumAstepsAmarina15Asexy2AnoeliAmj1234Aandrews1AtryoutAhecmaxAtarantulaA1jackieAhotboy1Apantera2Asandra11EersoAkursantAdfhrhfanApermanentA123123wAescorpiAsienaAdariAjuly31AalineAdangeAjeffwsb1AhippiesAmoggieAbonniesAqwe123321ArevenueA123456zxcvbnAfabio1Adragon18AtruemanAgoodfellaAfizbanAdumarsAericccAcaninoAliberiaAsuzanAdarkieApfchfyrfAkaiokenAbooyeahAthebatAblah12AlachenAshittAleonidaAgorditaAtrent1AselanneAtishA1carmenAnikonf5AberkshirAmoney13AvfkmxbrAdtynbkznjhAroman12AdaryaA123321dAribalkaAlamonteAsuperbikAjellymanAmarcheAkalpanaAmydearAsmokie1ApoopsterAsmile101Bex4funAthankfulAyespleaseAtheseusAdreherBave77Ajuly12AneuromanAanimal2Alizzy123Adave41Alucille1AcatrionaAaudir8Adavid22BieboldAcripAsummer09AcoachkApizza2AwhoopieAdeuce2AwritingAgizmoeAsuperdaveAhorseshitA80361665abcAginger99Amorning1DgueAdaxadaApowmiaAmaricopaAraiserAflash5AcallowayAvoodoo22Asasuke12Awinner2AnacnudAthegoatArogelioA8218yxfzAtextbookAsawa212AfaustinoAadrenolinAmark2A0123698745AkamelotAevilliveAlillysAjoker2Avintage1Aeric1132AsamogonAdrdeathAservicAwedding1AluckeeAapril2AmartellArocko1AfrogfaceAmarcs1997A2q3w4eAparamonA12345qaAsonnysAharryhooAnalaniAdeepsixBogmeat1Afoolish1AdeivisAirishladA1angelsAklavierAtoad24AhongfundAdogbuttAcanfieldAlionhartAafternoonAzerglingAdeniska1A1dollarAarcadia1AdeltatauAjktujdbxAdemidovDchenkoAsillymanAkosmonavtAabcd123456AdemiurgArelicsAiceman22AforestryA102030aAgarvinAferencAvjhjpjdAemersoAfournierAdenis1983D040791AoberstAcopperfiAmaggie99BccloudApuppy123Aroma2010AlonleyAeghfdktybtAnokia5700AbarnhartAfred66Amonster123A9731553197AnadiAlufthansAfuckthroatAsantafe1Cmmie01AgalacticaAmaster66Art3460014Atorpedo1ApencilsAschroderAfatpigAsportscaAomen666AmtdewAastronautAthebrainAupinyaApablAjennyyAbvncnbnvvbnAelates_yAgundamwingAspecial7Aaurora1BrizonA1banditAsimensAhjvfirAtruittAletmeoutAelenasAorenAmarcuseckosAnicholas9AbergieApatton1AdidenkoAfeetsAdisputeAflorenciaAkamelAgripeAhamannAdigdogAbeeldbuisAweare1Ajosh123AdrillsBima13DkaAavtomatAwerty12345Adima1983AhousemusicAduffieAmazda123AfucktardAdinhoAplutoniuAhobgoblinAdustmanB36rkqdffAusualAsrbijaAdjeterAmanthaA9953rbAmixmasterAak471996Ageorge69BuapoAprogressiveAchris8AfantazyAporshe911AjuniAsnejanaArulezzzzAyoussefApass28Awolf22AiwillwinAkukurukuAncc-1701ApasswurdAzxcqweA1hardcorAapollo17ApppoooAlauralArhbdtnrfAgtnheirfAtallicaAgoalsAljcnfkbApmedicAdoc_0815AgabbanaAhappy11BotheadAvolgaAdrawAvegetablAdustbinAtinselAdreamonlineA89057003343Aedik123ApoesjeCiseAgosselinAelectro1Awordpass1AtaskerAplhfdcndeqAangelfirAgtynfujyAiddqd890AolliedogAwinstononeAdozzerBragon44Amonkey42AcoppeAjojobaAdortheApumiceAfitzroyAdragon35AsewersAgeneral2AshaftyAdreaArestrictAlalala123AdreamteamAsomaBurenoAdelta3AferdieAsuperuseAjigabooAedinorogAcheck6AsixstrinAlacsapAe6pz84qfcjAvladlenAlippsAmucsajAgrommetAsquiggleAeminem11Az1x2c3v4b5n6AdeshaunAkingringAe123456Asmokey22BalidaA872rlcfoAmanlyAeagle9ArewardsAfaceliftAsoleAh1d2b3Aeddie3Aretard1Ajjj123AdahmerAmarcel1A89181502334Agremlin1Atelecom1AsamueleBuvorovAentertainmentBlena1975AoclockAsexsAifkfdfAelayneAshrdluAtubeAfairytailAestellAfantasy8ArunoAvocalsApimpitAabcabc55AplatterBingi3Aad12345678AseptAestradaAmaisoBurcielagAsinglAbrancoAlacunaAdoulosAgothiArjkmwjAmor_passA121212zAjaninAgreengreA123asAfox12345Aevets1ArdflhfnAuhfyfnAvesuviusAqsefthukoAminnie2A360modenAsafronovaAlakers2CmparAjohn2AmandAboogers1A159357qAmathildArabbit12Aforget1AmaxinAneronAfuckstickAeyesonlyAyeomanAgriggsAlaetitiAtelefon1AhennepinA0606198AberthAmultipassAaudiaAbill22AfabiusAcochabambArafalAplaystatioBeluchAamaliAlucieAnow0newAkobebryaA89063032220mAjohncenAacca3344AfreewinAnassarAliftedAvadim1996Amariah1AphillAsultaApicklAstalingrAvfhbz007A5858855abcAivory1ApolinAfallacyAosirusAresolveCnaldoAyfhrjvfyAonly4uAacts238Awinter98Ahector1AnesterenkoAfdnjhbpfwbzBarahAraggerAbantikAfcnfkfdbcnfAshabnamAjcyjdfAfarmvillAsilver21Alucky22AdauntiviAtoofastAdiablo123AharleysAzipper1AmillenArandeeAhastyAtzeentchAxuaujbAespinozaAlazioAmegabassAfedotovBominaAsoccer8A917190qqAtummyAwes123Achicken4Afuck99Bish11AgustaveAplaisirAretraiteAfeltonAkevinlAybrjkftdfAferchAcalypso1AputoAbobbie1Apeter5Aferrari4Ajohn25AmojojoAq12we34rAcntkkfAhushAbadiman28200Aa3930571AhjpjxrfAwwwww77AujyxfhjdfAfranklynAgoutdbAludoBammerAgitanesAblackwolAmazdamx3Aarsenal14Azexts364325AfilatovDippovAvlad2010A123ewqasdcxzAfuckoff666ApollysAdentureAfiorellAcvyx76hAspruntAmerzarioAcharlie111AbdfyjdyfAhawk12AkingkonAparty01BlumbAbeck69AwestpoinAloginovAjess1caBavertAtyler12Ajenn1ferAgolfer20As1s2s3AnhbujyjvtnhbzAgayAmike10Aschultz1Aadv0927AweaknessAmiami99A1stellaAtelavivAmoonsBichaeltAfquekmAhaha12AmaestrApokusAsiskinA1unitedApiesAtofuckAsuperdutAzzz777AtwisteAallofitAgrimreaperAdevastatorAge0rgeAubnkthrfgenAvgfunAfoxdieAmankatoAclubbingArossyAjuntaAfreakdogAyavin4AsaoirseAmerdesAjuliana1ApontiaAfubar69AbiggenAmaiden666ArangersfAwinter09Atee0sAfredericoDemindAsquad1AglobesBuarraBopackgoAjimmy5AsusubabyAlothianAfrem77Amanzey20AheinAshrineAnataljaAmorozAbrushyAkasselApolniypizdec1102AufptkmAthanAninja2Agmoney1AmarigolAvfvjxrf1AtrucAmihaelAyakimaAredbankAstar6767Akiller6AmonikAwetlipsAsufferingAveneciaApfunkAfunnysBenerbahcAtreverAsasukAfurbyApiaggioAmuraA2004-11-Ane_e_pod_chehylAmolliAtryitAhotdoBayleAbhbirAgunitAbelgaratA1gabrielAwilkinsoAmustikkaAsapfirAdengadAsandhillA89132664230AwalkersA7mmmagAkartinaAmama1960Aybrjkfq1AretriverAkev123A1billionAnaruto0AsalamancAredbulAcoloursAlottiAgo4itnowAdiarioAtobleroneAmohammeA.hjxrfAhappy200B12345Ateacher2AsiskoAirina1989AbritneAschnellAgetajobAmazatlanAtrueliesArosiAthundercatAmodularAoldblueAhastingAlupitAignaciAtommykAsteve0Arocket12AsalohcinAburdenA1w2e3r4tAhellaAgregsterBeneticsAsquatsApossum1AmdxpainAfoldersAmrcoolAdragonforceAnaruto99AtrixterArunner12AvaninaA80camaroApeppieAcobra99AriskAinviteAvfvfnfyzAnthk12345A010203aAbetty123AskillzzA000000qAgunner01Atbone69AguramiAtomomiAkabouterAclubmedA111000zAredpointAgreenleaAraserAsunshine69Bandi1172ArjpkjljqAhd764nw5d7e1vbvAroyjonesAmoon1234AjosAsandlotAfirewalkAriccardAshutoutAileanaAyfltuaAnobunagaAtothetopAstud1Ao1l2e3g4Afyfcnfcbz1Agolos1EvinAmutateAalumniAgorbunovaAltybcAheidihoAsaturn2AhispanicAnumber10Atyphoon1Abmwk75sAking13AseabrookAholdArockdogAtdavisApussy24Aretep1Apower01Atraci1AmableAhucksterAzeynepAkostonAvernerAq26606AagahajaAmistikAhp189dnBakerA4ever4Apappy1AknuckleheadAharringtAeagles22Ais211tnApm209mtAaezakmi123AhemantAlefteeArandymanAvoodoo3AprostotakBinkerAlastcallAcairnAmarusyAfafyfcbqAmolly13AapplejuiceAfucku1Alove200AcoverallAdbnfkbyfAthomsenAjettApljhjdmtA89614774181Aannada2Adickens1AmakiA1reddogAtoshibAgrayson1Bfgf123Abrown123AcitabriaAtrashedAleopard1Apony76AbuicksAschnuffeAbrandonnAmayumiAfootball5AsanaAterra1AdfhbfynAfaggot1Adragon17AsilentiumArfkbajhybzAnjkmznnbAtwoodsAjaycobAlollipop1AbiomanAvillegasArita123Aguyver1AbushraA086421AametistA1qwerty7ApopiA123123asdAcole12BbcmrfAsuperstrAjason01AokochaAstanthemAx123456xAredassAteddybeerBranniesAjelwayAshadow9AkolomnaAjasonwAhotrodsBendriAolga1234Astephanie1AindeepAjktcmrfAsystem58AmortarsAswimbikeAgfhtymAkasatkaAsiren1ApepperonAuserexecuteBniquenessApauljrAirenaAvolvofh12AirusikAspesionalAmarusjaAtermitA12345ssAnormal1Arc.irfApetrushkaAbrusselAmotildaAantwerp1Aivan1996EivanovAn1a2t3a4AmadroxArutgerAizabelaApapichuloAamber01Ajustin3AshelbygtAkris123AlifeguardAshmilyBloanAjeanettBdavisAkissitAluccianoAfixitmanAjazmanAbabalolaAjamie2Amango123Asam12345Atwelve12AphippsAwankherAsexy101Araiders0ApotsdamCli10AanneliseAsigurdAleeAmatthewjAsallyannAmetreeAknight7BayleenAsimon12AlesmisAkss2773ApurdeyAjaykayAvoyeur1AjitendraAtroublAsadie123AtrekerApiddleButtyAmarshall1AbetseyAjosephphone7Arocky11AtowelAfreyfvfnfnfAhottsexxAnicelegsAjjohnsonAnascar08AkaisarAfunnycarAmaryanArutabagaA0l8kchekAmel123AjiggasAnagoyaAlike123AminimoAvbkzdrfAwhoareyoAmax1992AvazgenAthetfordAsemperfi1CllingAarequipaAtemplerAjoe999Asakura1AjohnpassAranger10AtrekstarAcarscaBlubcaptAjose123A69mustanAramon1AgandakoAyk2602AhaiderAloopingAas12az23AbelzagorAloonieAronaAmacysAufdhbrAvicious1ArushhourAziomekAkarasikAjustmineAkarterAnizmo400rAamanda96AkatyakatyaAdividerAjuttu123AkenichiAurraccoAvespa123AlirikaAkirillovCselevaAsladkayaBtarchilAkiteAvalakasAkiuhnm1AukfvehAvalera123Aa789456123A061096mAopossumAsaucerAz11111AnovosibirskAvfhxtyrjA1successAdiamandApenguin6AmalutkaAravnosAkotikA80972694711AkondratDovalovaArussian6Asahtm131AmdmolicAsignedAcertclasAmass234AnikotinAqewretAkrasavchikCishnanAbowenAm1m2m3AcdbymzBvtnfyfAsss555ApooheadAstockholmAtaffAbiglipsApaul10AihateyoAolga1979A12345qwert7AzapotecAluisfigoArachel01AhuckleApurple77Aangel10Arundll32Asummer7A7sombaAquietmanArossiyaAkirushaApotenzaAunderageAthurberAmexicaAfishfingerA5345321aaAadm15575AdietpepsAmelissasAenchanteAcacheAacdc123ArikiApol123AsurgutAkordellAlocal1DuraApeanutbuAdoubletApietjeAgthtrfnbgjktA1122qqwwAmontydogAnilsAsasitareAaa123456sAvtlbwbyfAsantiChtm038Adunnowho89AmoschinoBahmudAoleaut32AnosorogAmaks1995Aviggen37AneylandAvika12Astevens1AmaslovBt73sbAurlmonAmdmsii64AapppatchAhtmlctlApackagesAnetnovelAconfiguratioAmdmnttd2AsyssecAmdmgl004AehidkbdAsahtm082AcompilingAmsoracle32reApansyCtrick4AtuviejaApilchardAbritanniAcomponentAmdmnis1uAvika1234AknowsAsacoremsgAanitasAsasha1991Bpiffy1BysteAmorales1Btgl5rAsharanBetupenu2Ajaws1221AinterruptApass2012AtoryApikaCtmans4AcommunicAmsdascBtr1996Aboy1cool23Amelvin69AsiziniciAgbfcnhsAoleg1985AnavisiteAckjytyjrAgbpltw147AstrelkaA4solomonAsasha1998Arick69A5f68t9Avgbh12AminntwinArednoseDballAvinogradovApodvinsevAshopmenuAkoboldA3dwe45AsaimonArauf123AhigashiAroma1996AshuhratBerikAnadlerAkrebsenAmylakeBa1lc0AstratpAdedbolAbhrh0h2oof6xbqjehAvoxstrangeAka12rm12A193570356033A87654321vvA2012qwAdimazaryaAxpcrew"); + +// node_modules/@zxcvbn-ts/language-common/dist/index.mjs +var dictionary = { + "diceware-common": diceware, + "passwords-common": passwords +}; +var adjacencyGraphs = tempAdjacencyGraphs; + +// node_modules/@zxcvbn-ts/language-en/dist/commonWords.json.mjs +var commonWords = decompress("AyouAtheBoA'sAitA'tAofAthatAandAisBnAmeAforAonAthisA'mAhaveAwasBeAmyA'reAyourAbeAknowAwhatAdoAnotAareAwithAcanAdonAheAjustAlikeA'llAhereAallAnoAoutAupAgetAaboutArightAhimAohAgoAatAthereAsoAherAoneA'veAyeahAgotAtheyAbutAwantBillAthinkAifAnowAsheAfromAwellAseeAasAgoingAhisAtimeAbackAusAdidAyesAanAthemAgonnaCodAbeenAwereBouldAhadAcomeAheyBowAwhoAneedAokayBurAwhenAtakeAsomeBayA'dAwhyAdidnAorAreallyAcouldAwayAmanAtooAdownAhasAletAbyAsomethingAmoreAtellAmakeAthenAmeanAoverAlittleAneverAsaidApeopleAshouldAlookAoffAveryAloveAonlyAdoingAmuchAamAthingAanyAwhereAtwoAintoAevenAthankAbecauseAstillAfindAgiveAsorryAworkAdayAhelpAlifeAfirstAanythingAsureAagainAtheirDseAotherAthanAgodAwonAawayAmr.AbeforeAthoughtAhomeAtalkAmustAtoldAnightAcallAthingsAbetterAaroundAlastBongAalwaysAfeelAputAyearsAafterApleaseAthoseAsirAplaceAlotAnameAmadeAdoesnAguysAmoneyAeverEythingAgreatAnothingAkeepAdoneAguyAthroughAleaveAwantedAkindAhappenedAnewAbeingClieveAoldAcomingAdoesAcameBourseAwrongAleftAbigAhouseAmightAgirlA..AbadAstopAhelloAownAuhAhearAworldAsomeoneAunderstandAelseAtalkingAisnAenoughAtodayAgettingAfatherAmaybeAcareAfoundAmusicAeveryAaskAsameAanotherAfineBamilyAkillAtryingAwentAlookingAthreeAwaitAcarAtogetherAshowAbestAstayAwasnAyourselfAjobAmanyAniceAdeadAalreadyAfriendArealCmemberAmindAsawBonAnextAhiAwhichAmotherAwannaAtryBhanksAroomAhellCardAseenAfuckingAwomanCuldnAmayAknewAliveAbabyBitAwholeAideaAheadAusedAboyAokAmorningAhardAwithoutAtookAcalledAalsoAshitBayingAdaysAmostAstartAmatterAuseAreadyAgottaAmeetAdoorAahAyetAbothAprettyAmyselfBoveAguessAactuallyAwhileAendAphoneAsuchAgoneAfewAhavenAwifeApersonAagoAbrotherAkilledAproblemAhappyAaloneAfriendsAmenAfaceAschoolAworryAcouldnBaseAlostAdadAplayArunAheartAonceAdieAanyoneAhopeAbringAwantsAfuckAtonightAbusinessAtrueAuntilAsinceAeachAsoonBaysAeveryoneAtomorrowAhandAthinkingAworkingAhappenCvingAyearApartAeatAmomAstuffAlooksAkidsAlaterBistenAhuhAminuteAsecondAlateAgaveAturnAwaterAkidBnowsAopenAchangeAmeansAdifferentAminutesAinsideAeyesAbeautifulAfarApoliceCintAunderAprobablyAcrazyAtakingAaskedAhurtAchanceAdealAainAmakingApayAdaughterAplayingAfunAtimesAhitAsideAhandsAmakesAableAbodyAimportantAholdAdeathAstoryAcomesAfightAsupposedAleastAmomentArestAumAsetBtartedAcloseAyoungAdrinkAagainstAexcuseAafraidAgameAanymoreAwordBishAfiveAweekAthoughAmissAeasyAsleepAreasonAmineAwaitingAdr.AwatchAgoesAexactlyAgetsAitsAcheckAhoursAbehindAnumberAwowApartyAtruthAquiteAhusbandAshotAmarriedAchildAbetweenAcauseAfireAquestionAmetAtellingAfourAbroughtBloodBreakAsisterAemAteamBroubleCiedAfrontAsitAforgetAreadAtownAdiedAcoupleAarenAneedsAlineAwalkAchildrenApowerAbecomeAofficeAplanAalmostAgirlsAfoodAspeakAyoursAgunAaliveAcutAfeelingAoutsideAsafeAtrustAnewsAaheadAsaveAeitherAsomebodyBtandAmrs.AfreeAanswerAhateBighAmonthsAeverybodyAbuyAhmmAwhateverAfullAhalfAloseAwomenAalongAseemsAfactArunningAcoolAdearAbedAlightAorderAwhoaAcountryAdoctorAclearA10AboysAsentDdAlivingAwarApastAbyeAdogAjohnAtakenAhotAleavingBivesApickAscaredAparentsAfunnyAcityApromiseAstupidAcannotAdinnerAshouldnAassCkingAcompanyAladyAwinApossibleAhimselfAseriousAbookAmrAsortAhourAanywayAsoundBhallAhappensAsixAlordAsickAtopAfeltAtouchAjackAsenseBmallA20AseemAmeetingAdamnAspecialAjesusAperfectAcaptainAluckAfastAcontrolAbitchAwordsAhumanAlaughsAhairBospitalAmurderAdreamAshutAknownAsighsAcoldAfutureAgladAworkedAdriveAcatchAanybodyAlaughingAmillionAlongerAoohAlieAcallingAfigureCnallyAlookedAothersA'amAblackAshootAfaultA30AworriedAhoneyAsomewhereAweeksAchangedAbossAhappeningAseeingAdanceAsecretAdateAfallAtakesAlovedAsignAquestionsAwerenApieceAairAchucklesCoiceAfeetAneededAturnedAbetAmovingAreturnAvoiceAamazingAgivingAstrongAlearnAgivenAsamAweirdBhiteAlessAworthAearlyAchristmasAbeatAtillA00AonesAcleanAeyeAsongCundsBtraightBhipAwriteAratherAsweetAfollowAmissingApainAnobodyApictureAwelcomeAexplainAtenAcoffeeAworksAkeptAyaAdefinitelyAwonderAprotectAbusyAcaughtAkiddingAluckyAevidenceAmistakeBadAweddingAmeantAdecidedAstepAroadAbuildingAinformationAreportAalrightAwatchingAcarefulAeveningAtvArideAlandAworseAsituationAentireApullAmmBovieAtiredAhurryAsexAhandleAsometimesBystemAmouthAactAbirthdayAthrowAattackAlawAfinishAdarkAmaAclassAyesterdayAmessageAkingAwonderfulAcompletelyAlyingAmichaelAbrokeAexpectAmonthApoorAmm-hmmAjoeAquietAsellAbagAusingAfloorAtalkedAleadAgroundAhasnApassAstreetAclothesAforeverAdangerousAwearAdropAredAdaddyAacrossAbornAsingleAthinksAspeakingAhangAfrankAtestAageAtableAdavidAms.AanywhereAyorkAhistoryA15AgeorgeAtrainAranAareaAnearAduringAswearApaidAmarryAfeelsAi-iAspendAboxAcharlieAmiddleAstrangeAuncleAroundAboughtAterribleAcourtAagreeAstateAboatAproudAquickAmikeAtomAspaceBecurityAjoinAsittingAaccidentAforgotDwardAtotallyAsavedAhaArelationshipAlistAcrimeAstationAnormalAsupposeAfishAgentlemenAwearingAmasterAsceneAchargeAmissedAfellAstoppedAkeyAbuddyAfixAofferApersonalAinsteadAshortAfearAringAprisonAsimpleAgroupAamericanAcalmAdifficultAfightingAmessAtripArecordApositionAangryAletterAwakeAfinishedAshareAhonestAdeepAfairAcryingAmarriageA100AkissAcoverAsevenAhideAseatApresentAlunchAballAsmartAimagineAkillingAdareAcertainArealizeCspectAinterestedAmmmApaperAsadAgoldAproblemsAmajestyAhotelApeaceAcallsA12AinvolvedAcardAfoolAdecisionAmovedAstandingAdarlingAperhapsArockAbrainA50AsoulAinterestingAvisitAbrokenAupsetAmaryAsmellBtartingAhorseAtoughAkillerAhungryAattentionAquicklyApresidentAamericaAearthApeterAgovernmentAlovelyAspentBurpriseAflyApublicAbarAstickAteaAbecameAcuteAjamesAenglishAappreciateAforceAblowAfilmAgirlfriendAacceptAleeBaughAbenAeightAladiesAproveAyepAstoreAwithinBalkingApaulAsingAwindowAlikesAsecondsAdudeBressAcontactAplaneAiceAcameraAdrunkAhugeAchristAsupportAcontinuesBryAsakeAgiftAmilesAabsolutelyAlivedCkedAwallAlovesAcellAafternoonAbankAtruckAcopAofficerCtenApartnerAserviceAgeneralAblueAstuckAchiefBertainlyAeatingAdoubtAjokeAenjoyBxperienceAboyfriendAcopsAlawyerAteachAnoneAscreamingBunAputtingAreachAholdingAgruntsAtreeApassedAapartmentAclubAidiotArulesAfavoriteBorgiveArichAcountAmissionAcontinueAdrivingAradioAmachineAdifferenceAwhetherAdyingAjailAwroteAbeginningAharryAfieldBavorBeelingsAmagicAchooseAboardAevilAshopApatientAhundredAcollegeAprivateAbastardAseaAlearnedAmatchAnervousAalexAspotAwindAvideoAcarryAuponAthirdApleasureAriskAkimAridAdreamsAimmediatelyAexcitedAstayingApromisedAnamedAtypeAoweAstarAwineAlisteningAworstAimpossibleAgrowAsleepingAearlierAslowAvictimAdecideAglassAhelpingAarmyAfinalAcashAmateAgivesAquitAfootAhenryAblameAdollarsApickedAbusAhelpedAescapeAbillAthousandAherselfAfrenchAenergyAarrestAgoodbyeAaddressA'allAyoAenemyAallowedAwaysAbiggerAmaxAaahAtasteAourselvesAshoesAhonorAfitAweaponAbuildAowAthemselvesAsurprisedAfiguredApushAsearchAbunchAfuckinAbeginAeverywhereAunlessAhidingAgaspsAtrackAhadnAordersAjimmyAteacherAlowAjimAcongratulationsAkitchenAbobAinnocentAfurtherAbearBotherAdrinkingAarmAlevelAwillingAusuallyAseriouslyAplayedAbooksAarmsCtBctingAholeApressureBlanetAlockedAdeserveAobviouslyAtonyAstealAkeepingAbuiltAstartsAdrugsAmemoryAnamesAbattleAraceAchurchAbeerAwasteAtreatAsuitAgrabAdetectiveAmentionAgottenAshhAdramaticAstageAjumpAsuddenlyAhopingBeroAplacesAarrivedAnickAholyAdirtyAehAdestroyAapartAstoleAnoticeAcompleteAfiredApressAclosedAshowedAopportunityAplansBriceAsteveAlegAcomputerBatAltBieutenantAfollowingAvillageAlegsApicturesAdutyAjudgeAdangerAapologizeAnarratorAcloserAlosingAsmileAuh-huhAsuspectAactionAkeepsAbesidesAextraAmamaApregnantAmarkAwitnessA11AlondonAconversationAturnsAwritingAbreakfastAadmitAskyAwonderingAheavyAcrewAexceptArollAbathroomAgunsCiltyAbloodyAgreenAwarmAgruntingAughAkickAsmokeAupstairsAformAaboveAseemedAchickenAbombAreadingAgasAcolorAprinceAdannyAthroatAsarahAcostAitselfAneckAtwiceAstudyAnoseAsummerAinterestAengineAburnAplaysAemptyAi.AtightAawAcrowdAbillyAringingAsingingBtrengthBoldApulledAfreshAbottomAknifeAweekendAshootingAresponsibleAallowAspiritAhearingAclientA40AwalkedAcolonelAfatAislandAcakeAasleepAcornerBrapAskinArichardAstoriesAinvestigationAbroArestaurantAgroansBoddamnAjohnnyAnineAcookApowerfulAflightAmedicalAheldAdrugAaccountAbrothersArainAbottleAfamousAtaughtArayAshowsAawesomeAridiculousAfolksAcheersAweaponsBrittenAtrialAraiseAparkDisAwhooAbiggestAlocalAadviceAmainAontoAdueAassholeAmoonAsurviveAfileAplanningAtellsBrainingAlockAkeysAbreathingArelaxAmilitaryAawfulAlanguageAbreathAprofessorAknowingAlaughterAdogsApreparedAchrisAdriverAbringingAriverAnecessaryAguardAphotoAspokeApantsAliedCghtsAmurderedAjakeAgrandAsoftApracticeAclearlyAleavesAcommonAtowardsAagentAtrulyAolderAaudienceAbobbyAwildAcareerAlotsAmonsterAlaAanimalsAloudAflyingAcodeAfakeAcarsAdroppedAcheckedAhatAemergencyAbirdAhangingAmattersAtommyAconsiderAanimalAlargeAruleAhurtsAnatureAflowersAcampArealizedAawareArogerAneitherAjaneAbullshitAespeciallyAringsAendedAsimplyAwhoseAsightAleaderAbeyondAfuckedAtargetAsillyAadamAsurgeryAconditionAdoubleAblindAmeatAgamesAsergeantAliesAfaithAlettingAserveAhoweverAgreatestAcomfortableAplentyAcheeringAspeedAnoticedBumbersAstarsAdiscussApurposeAbelongBandAmrsAcrossAgoodnessAbegAnoteAcorrectAouttaAsizeApayingAeddieAconcernedBupAqueenAstudentAtapeAknockAcharacterAeasierAissueBncredibleAmarketAcriminalAoughtAbreakingAarrestedAfocusAguestAprogramBathAendsAteethAsuperAlayAdepartmentAkindaAtravelAseveralAagreedAmajorAfeedCllowAhealthApapersArobertAvoteAcharlesAtrickAfindingApiecesAmommyAcreamApossiblyAshameAnaturalAjusticeAheavenAbeautyAcreateAfbiAprocessDjectAchallengeAturningAideasBnvitedAdestroyedAseasonAweakArecognizeCsponsibilityAsweetheartAchineseAbeachAmumAbellAoperationAsoldiersAjinAbodiesAopenedAdanAwhomAaddApointsAcreditAfailedAgoshAopinionAviewAgayArecordsAdressedAcousinAbelievedAmembersAsomehowAkevinAchairAfasterAcreatedAdumbAmilkAremainApropertyAbreatheAnowhereAaffordAmartinAnopeAgermanAaccessA25AdistanceBeBancingAreceivedAmanagerAswordAresearchAheatAnahAbringsAcardsAbaseAmemberAinterviewAproofAopeningAlabAsouthAdocAhighnessAbirdsAunitedAinsaneAforgottenAdamageApackAsellingAdryAweightApretendAshirtAperfectlyAstudentsAballsAeasilyA24AmemoriesAstayedAamountAchatterAlocationAbirthAnearlyAfanAexpectedAhorribleAdanielAfallingAthrewAfollowedAstatesAhmAghostAmoviesAstolenAfillAmedicineAheadingAorderedAkateAexampleAshoutingAlatelyAopensBilAdeskAsuggestAbiteAdaveAcommunityBaresAgraceA18AscreamsBignalAbucksAcenterAindistinctAgoinAcopyAmattAheadsAamongAdrawArecentlyAannaAjealousAexpectingAnoiseAregretAnorthAwestAsuddenAauntAmountainAexistAshowerAindeedAbraveAticketAdoorsAsafetyAdatingAlinesAsuicideAoursAbridgeAgrewAshowingAusualAseesAbulletAconnectionCmmandAtotalAdevilAthoughtsAsanAcontractAfateAsocialApreferAcommanderAthomasApoolAandyAjasonAapplauseAroofAhardlyAdisappearedAeventAfemaleAmadamAsendingAdetailsAreleaseAhandsomeAbarelyAcausedAlooseAscienceAforcedAintroduceAharderAcoveredAbeganAlonelyAryanAwashAnutsAlossAbrightAlikelyAownerAalthoughAscaryAjourneyAharmAstreetsAjerryAoriginalAdeliciousAjeffAamyAweatherAsoldierAdnaAscottBplitAchestAdirectorApopAstaffAmentionedAdoinAexcitingAsantaA200AmealAfingerAblockAliterallyAstoneAprayAroseBeturnedAspanishBundayAfingersBreedomBamiliarAstyleArussianAbasicallyAcasesBhangesAuniverseAsignedAlettersAstrikeAmaleAplannedAhoAgrowingApeteA'causeAruinedAenterAtieAstomachAdickAfridayAlisaAateAobviousAcomplicatedAanswersAspeechArachelAericAsettleAtinyAuglyAdiscoveredArealityAearsAreasonsAburiedAayeAcompetitionAmoodAhorsesApartsClAwilliamAmanageAhiddenAdivorceAreachedApermissionAsimonAfindsAheadedAsleptAchoseAgrandmaA16AvanArunsAsooAdrinksAeggsAdigAbritishAsaturdayAexpensiveAattackedAhiredAwetAremindAnonsenseAtreesA14AbabeAliftBegalAvictimsAmapAruinApocketAbrianAfuneralAlucyBessonAsuccessAgrownAlarryAguestsAstatementAalarmAjapaneseAresultsAhappinessAsweetieAassumeAthousandsAphotosBrepareAraisedAfarmAgateAprincessAroughAnorAsavingBtormApantingAtongueAenglandAtenseAyoungerAsiteAneighborhoodAcheeseAfoughtApowersAfredArevengeAfamiliesAhallAwalterApapaAwatchedAplayerBaintAavoidAmodelAaliceBrthurAfilledAwooAprofessionalArequestAspareAgangAsecretsBhapeAbuyingAsoonerAwhoeverAfranceApairAdealingAspreadAbreadAcelebrateApersonallyAledAproperAsubjectAyellingAbedroomAdataAbikeAthreatAcuriousAemilyAclockAdownstairsAjobsAcoatBarefullyAtheoryAinviteAnightsArightsAgratefulAtearsAkangAscareAgaryAmovesAtrapArentAbasedArushAgeniusAslowlyAwallsAtourAhumansAtextAconfusedAhanAplantAdeliverAbelongsAmeaningAdirectionAofficialAflatBoreignAcommittedAbrilliantAsugarAbecomesAposAmurdererAstopsAotherwiseAministerAunderstoodApageAhigherAunitAtermsAwarningA500AtradeAfantasticAstrongerApostBlateAartistAsocietyAwoundA13ApaintingAcookingBancerAohhAjiAburningAcrashAparticularAhonestlyAfacesAinspectorAalAgentlemanAyourselvesAwoodsApickingCgAromanticAticketsAregularBoleAspellAissuesAsoupAawakeAfancyAknowledgeAclaireAancientAsourceApatientsAchargesDngingAboringAkellyApercentAgiantAdeeplyAadvantageAthemeA17AcapableAofferedDicersAfixedAmotherfuckerAbeepingAfootballApoundsAaccordingAgrandpaArateAconcernAsufferAapparentlyAsolveAedAgardenAenemiesA'clockAasideAoceanAdoctorsAlukeAbarryAtimAmanagedAkickedAhealthyAperiodAinsuranceAappearApoisonAwaitedAnurseAshotsAglassesAtallAforestAshakeAvehicleAchocolateAdiesAcarryingAproperlyAwinnerAtreatmentBhiefAbleedingAdefenseAphysicalAavailableAclosesAphilAairportAbadlyAfailAburnedAgroaningAjacketAmariaAdroveAangelAnakedAcrackAbabiesAassistantAeastApositiveAmistakesAdirectlyAsnowAgraveA60AbecomingAtoiletAplusAemmaAlauraAperA'iiAvacationClueAjoshAtalentAriseCckAcheapAextremelyAbuttAfortuneAshockAwokeAedgeAashamedAdrAincidentAgrandfatherAspringApullingAcheckingArescueAappointmentAtreasureAdisappearAcarlAresultCAincludingAmediaAtouchedAstoodAillAperformanceAtreatedAfirmApalaceAexactAjerkAwashingtonAconnectedAannieAwheneverAappearsAheartsAskillsAuselessAgoalAimageAjoyAillegalAalanAlicenseAjuryAswitchAbonesAlouisAeffectAbagsAscheduleAeffortAconsideredAknockingApreciousAmetalAclaimBarterApoliticalAviolenceAbelowAchinaAearAbathAtrafficAlipsAfilesAjokingApianoAratAsheriffBtepsAeventuallyAtedAloverAcamerasAdiseaseAkyleAriceBeleasedAthrowingBiedAonlineAfullyAliarAnationAeggAmysteryAwinterAcourageApillsAeuropeAprotectionAwinningAheavilyAmaggieAsatAbleepAconvinceAsuccessfulApassingAsuckApissedAjacksonAtipAsufferingAmirrorAreceiveAaffairAmondayBiracleAsexyAformerAunfortunatelyAbeatingAelizabethAlaidApizzaAscoreCrewedAªâAdeviceAremainsAminAleoAoddApresenceAgentleAchicagoAdeanAfreakBorcesAactualAjoeyAhongAshoppingBistersAcaliforniaAgrandmotherAromeAahhAhuntingAboneAnationalAemotionalAseanAhuntAcenturyAsmithBignsAjennyApopularArareAjungAattorneyAsongsAridingAsexualAarriveAhatedAtoastBrappedApushedAcureAtelevisionAlowerAtechnologyAexcellentAjoAconvincedAitalianAdragAborrowArefuseAliAshiftBwimAcoachAst.BacrificeAhelenAclueAservedAreportsAdesperateBarknessAjonesAspeaksAmexicoAescapedAkneesAstealingAmercyAprogressAroomsAshoulderAcastAangerArudeBepeatAcurrentAmomentsAexpertAsolutionBmellsBurelyAdesireAsimilarAnotesAwarrantAbuttonBlewAlovingAcreatureAprideAfallenAstrangerAexchangeAkindsAabilityAleadsAseparateBquareApunchAvictoryAclosingCeaningAfriendshipAdecentAsurfaceApotAscreamAexhalesAcleverAflowerAtearAfactoryAstairsCudioBusanAtrashA300AamericansAhookAmillionsAhelpsAwoodAequipmentAgradeAchatAerAwideAsearchingAterryAwitchAremoveAscoffsCreenAmaterialAdirectAspyAhugAfishingAidAchuckAspendingAhowardAwarnAcircumstancesAamenAeatenAtestsAloadAindianAtaskAparkingAtalksAchancesAguardsApureAordinaryAtaylorAwantingAvisionAunderstandingArouteAblessAwheelAsaleAbrideBackgroundAvictorAmailAprovideAgarageAreputationAjaeAsecureApieAalienApleasedAjulieAdebtAjuiceAkarenAfalseAlakeAhireAspokenAindiaAlearningAdependsAyellowApriestAupbeatAdustAbruceAhousesAmaskAsentenceApityAcarriedAdisgustingBemonAchosenAstaringAroyAtrustedApardonArocksAgodsAhornAputsAdisappointedBefendAmidnightApotentialAunusualAwiseAuniformArememberedAclarkAmorganAleadingAbehaviorAmountainsAsucksAambulanceApushingAjoinedAsuspensefulAattitudeAsilentBcrewAcastleCmpaignAropeAclicksBhainAtailAconfidenceAsaraAjapanAshipsAdesignAu.s.AbrainsArangeAabandonedAhundredsAsilverAcustodyAdesertAclientsBurseAmm-hmAidentityAexplosionBveAhittingBurtingAseriesAembarrassingAmerryAcabAholidayApilotAjuliaAeventsAoptionAhankAgordonApissAcustomersAdongAfriendlyAapproachAsharpBuspiciousAwireAsettingArobinAalcoholBndrewAsauceAactorAcollectAgregBorgeousAchristianAhighlyCtsAguaranteeAnightmareAseekAmindsAattemptApanicAcandyAstandsAengagedBlevatorAborderAfruitBallsAprisonerAclearsAintelligenceAdetailAfailureAentirelyAmayorAhatesAwishesApatrickAconferenceAknockedAwhereverAmonkeyAdestinyAtraceAearnAfellasAmostlyAtroopsAchucklingArowAstockAarmedAbasementAestateAanneAobjectAlilyAdishBefeatBirtAmentalAtelephoneAfactsAwinsAagreementAjamieAsidesAoliverAjayAbravoAtransferAbeginsAacceptedAcoincidenceCmmitAdumpAprotectingAblowsAalertAcowA19AthrownApenAsometimeAwingsAreporterAstaysAblowingAstoppingAversionAwaveAjackieAfiringAwriterAfleshAsettledAperformAoppositeAfootageAmessedAusefulAgaspingAsilenceAyupAbrownAchasingAuniqueAtitleAstudyingAzeroAfellaAcountingAsolidBmokingAboredAtiresAwastingAdozenAagentsAchildhoodAyiAembarrassedAhehAdeliveryAimpressedAjessicaAcuttingAmarksA45AmovementAdecisionsAcarolBhaseAgermanyAzoneAtexasAsonsAmassiveAnastyAjohnsonAauthorityAcircleAimpressiveAmiAwhoreAamandaAtrainedAurgentAlackApartiesAtankAintenseAaprilAhungAlindaAviolentAsnakeBlipAabbyApreviouslyAcrossedAsurvivedBhadowAjesseArewardAspecificAquietlyAbeltAmodernAjordanApolicyAbillionAyuAsomedayAbeastAlibraryAintendAhollywoodAjumpedAdollAplayersAtylerAnothinAafricaAteachingAsoftlyAclimbAmollyAtempleAinjuredAthreatenedAbeepsAfansAmisterAseniorAceremonyAgoldenAprizeBassionAwitnessesAgtAparkerAjuneApossibilityAgarbageAbelovedAstressAloserAbettyAdramaAyangAdeservesAlaunchAuh-ohAtrailAexplanationAsandAclosetAthinAreportedAharveyAassureAdegreesCckAmessagesAnewspaperAdougBisasterAreactionAenteredAroyalAadultAconfidentAmysteriousAsaltAmarcusAshineApunishmentAkidnappedAapproachingAsinAfourthAbalanceAwindowsAmartyAsecAchirpingAgatherAlosCanA'monAuncomfortableAdesignedArelatedBobberyAbutterAtaeAsomethinAentranceAbreaksAguitarAepisodeAsallyAdenyAvirusApackageAshyAvegasAcruelAendingAwayneAbowAmadameAbackupAtoneAphonesAgreaterAsupplyAadvanceAbarsArossAkissedAfrankieAburyAaboardAbethAcouchA10,000AwarnedAseoAmixedAproductAignoreAbelievesAqualityAtowardA80AchatteringBrimesAlifetimeAsufferedAtriggerBheaterAsecretaryAdollarAmmm-hmmAlatestAedwardAarticleAofferingAmagazineAargueAkingdomAsportsBwingAkillsAbetrayedAcultureApoliticsAteamsAneighborAcrushAbarkingAeunAworriesAboundAnathanAdukeAcabinArecallAchampagneAxiaoAchefCloeAbastardsAstanAgainA90AtricksAhannahApartnersAassaultAcomfortAllAaccusedAconfirmAyardAsensitiveAhillAkatieAfuelAresponseA21AfashionAgearAtunnelAasksAnegativeAwilsonAcapitalAworkersAsectionAbulletsAconfirmedAjosephAsandwichBtatusAemperorAselfishAguideAlfAgutsAstruggleAdonnaApatheticAtheeAannoyingAvoicesAunitsAoutfitAjointAyouthArefusedA22AattendAlouApainfulAgymAjokesAdawnAtermAmacAheckAshoeAyayAheeAfootstepsAactionsAvincentAtaxiAbaseballBeggingAcustomerApunkAfeverAsubtitlesApretendingAblakeAdiggingAsmilingAa.m.AominousAwalletAvaluableAlsAciaArollingAnuclearAtoyAimpressionAsuitsAangelaAdrawingAbrandAmurdersAsobbingAmargaretAbowlAcheatingAeducationAmixAquarterAthunderAbustAfedAdaAremovedAspeciesAmillerAenjoyingAironArecentAflagAagencyBliAmaidAnormallyAchoiBooperAsweatAoptionsAmassAjessAactivityAconfessAtherapyAunknownAtracksAbillsAsystemsAcharlotteAswimmingBelfAtuesdayBowerAgrowlingAsquadAcigaretteAextraordinaryAchargedAmiserableAshownAusesAbye-byeAdeliveredAawkwardAcostsBaveAbehalfAconditionsA1,000AloyalAsophieAenjoyedAdemandAnetworkAwavesAtouchingAromanAhitlerArobAexitAcrisisAthursdayAplasticAcollectionAindustryAcreaturesAansweringAclearedAnaAworeAmileAlawsAblastAnancyAfreakingAslaveAprisonersAreckonAsurveillanceApussyAgenerationAdishesAbeefAhomeworkArobotAwastedAbangArevealCcordingAlucasApinkAforthAspiritsAkoreaAlegendAboxesCotsAtimingBhyBalkinAarrangedApatternAripAwolfAmustnAneighborsAhostAinvestigateCterruptCsistAwalksAcleanedArapeAchampionBominAmarieAgunshotAnearbyAofficiallyAargumentAkongAchairmanAdreamingAmichelleAprimeAdegreeAgenerousAexamAjangAfinancialAexerciseAkenAcosAdragonAangelesBpologyArussiaAjeanAidentifyAconfessionAscriptAcowardAwoundedAstevenAwoundsAseatsAuniversityAbuzzingAelectionAbarbaraAinfluenceAsingerAjuniorAthroughoutApersonalityAcheerBentralAjenniferAbeatenAgloryAcontestAjonathanAoffenseAcharmingAronAincrediblyA23AconcertAdescribeAstephenBervantAchickAearnedBxperimentAboomAplacedA‐‐AteddyAconsideringAgiftsAsurroundedAjungleAoscarAthickBoddAlewisAelAfederalAeaseArickyAjeremyAwhistleAfrightenedAlandingAdeterminedAmatthewAbradAwrapAflowAremindsAmightyAemotionsAcrownApackedAsafelyAkoreanAreplaceAdocumentsAcellsAdivorcedAreliefAappleAsurrenderAenvironmentAwhirringAunderneathAnerveAcatsAbatAframeAloadedAmakeupAtriesAmarthaAdroppingA35AimaginationApeeBarticularlyAcarlosAaaronAthouAstakeAdistantAninaAdennisAhopesAtaxAoliviaAblownAgettinAconstructionAhidApreventAholesAcoastAmessingAbenefitAnephewAdumpedAarrangeBlbertApracticallyAcatherineAfilmsAdrankAgeeAsoundedAprofileAshockedAwhisperingAprintAtortureBrunkAgolfAownsAgood-byeAterritoryAcharityAgrassAhomesAmotionAellenAinternetAstruckCarvingAladAjudgmentApurseAgoodnightAfenceAcapturedAadventureApetAroutineAservicesAaccentAsignatureApreviousAtraitorBemperatureAunbelievableAcheatAmotiveAyoonAworryingAshelterAjustinAsharedAbailArebeccaAscratchAhyunAsenatorAhelpfulAchoicesAattacksAplainAguiltAtravelingAanniversaryAghostsAprintsAwalkerAholdsAderekAanthonyAorganizationAsmallerAexperiencedAoddsAkennyAbasicAlistenedAfacilityAlimitAwipeAstableAcompaniesAinformAduckApitchAkissingAfoolishAimpactAterriblyAgrantBuessingAsoulsAmeantimeAansweredAsampleAinvestigatingBanAlandedAfrozenAannAclinicAinstrumentalAappearedAtastesAhopedAeffectsAbotheringAgreetingsAattractiveAcostumeAlinkAsneakAcitizensAvisitingAdealerAundergroundAaccountsAcurrentlyAprotectedAterrificAprocedureAboutAtraditionAnailAbostonAlaundryAthroneAsomeplaceAcomplexAinstructionsCtentionApunishedAsteelAcaredAjacobAdatesArumblingBeasonableAexistenceAbehaveAfacingAclassicAhealAskullAcoleCnsequencesAinternationalAdevelopedAsucceedAdavisAhelicopterAfocusedAniggaArespondAsaladAflewAjoiningAsinkAbellyAnavyAhabitAfloridaAcageBountyAdailyAlawyersAtinaAsheepAjooAangleAconscienceBriminalsAnobleAcancelAitalyAshoutAralphAproductionArandomAstrategyAanytimeAmathAsalesAaverageAindividualAsetsAjewishAtrackingAoccasionAshedBportAbugAtestingAstubbornAparentAorangeAnateAsuppliesAwarriorAbladeAhighestAwuAstandardAgermansAceoAvampireAnecklaceAmonstersAbesideAhonourAfranciscoAmagicalAexhaustedAmistakenAdeeperAcriedAwangAcookedAharoldA70AmonsieurAdowntownBylanAwonderedAcreepyBausingAimaginedAlizAcoreAapplyAouchAmachinesAgoodsAreturningAconnectCuncilBhenBlickingAjeezAsacredAchillAmonicaAelectricityAhersAloyaltyAjudyAgrossAblocksAclaimsAethanAcommentAsealAheroesAemployeesAstrangersAatmosphereAp.m.AseokArepresentAgrabbedAdefendantAequalAthreateningAcaptureAliquorAauntieAservingCssionAbullAanxiousBgesAexpressAbustedAserialAmasonAsatisfiedAworthyAgovernorAprayerAcoughingAdianaArussellAwednesdayAhumanityAl.a.AterroristAunableAclassesAwailingAlookinAyellAsolvedAchaosAsuspectsAjoonAbeingsAsmoothAlessonsAcharmAmarsAcarrieAdrillAexposedApipeAearlAinvitationAactiveAinjuryAslippedAwilliamsAunhappyAmultipleAengagementAdraggedAmayaApresentsAberlinAcriticalBloudsAtraumaAslightlyAtalentedAsueArobbedAtattooAsteadyBirenAvirginiaAburdenAspinAfavourAmickeyAcheatedAinformedAdamnedAsteppedAproceedBowderAwingAlevelsAdaughtersAtestifyAmarchAdiamondAsharingBtonesCabbedAchipsAmonitorAobsessedAchannelA911AtuneAruthAcolorsAplantsAbadgeAdespiteAworkerAcivilAashleyAbibleAfliesArandyAcommitteeAmuseumAtoolsAexistsApitAtentAlionAtokyoAabsoluteAbegunAmudApleasantAchecksBatchingAexApeacefulAreligionA400ArabbitAdistrictAoxygenAsurvivalAescortAactressAproposalAtragedyAcomplainAfrancisAbitchesBlessedAmetersAfantasyAtendApulseAjewsAextremeAfavouriteAgriefAchanAresistAunionAcountriesAdifferentlyArumorsApassesAfairyAcharactersBaseyAlinAshouldersAcookiesAtigerBransferredAfilthyAnicoleAfifthAreligiousAidiotsApaperworkAkeithAunderwearAaddedAtransportAfighterAattachedApunishAboAresourcesAmerelyAscaleAafterwardsAsuBandyAmatchesAfightsAproduceAcraigAkickingAinterestsAscreechingAemployeeAactsAhostageAnoahAvinceAkneeAflashAgusArelationshipsA39AsinsBhakingAdiamondsArecoverApaysAhailAcreatingAstructureAtestimonyArottenAletsAhollyApatAmiamiArapedAbombsAliverAbeneathAtreatingAmarryingAaffectApourAauthoritiesAremoteAjumpingAbasketballArequiredAeverydayAproposeAoccurredAfiguresAtribeAincreaseAportAgroupsAinventedAdiscoverAbudgetAmoAfreezeAwheelsAgloriaAnaturallyAcommercialAprickBaymentAsammyAb.AscientistArealiseAbondAwivesAchipAalbumAfiresAweaknessAjunkAaugustAhalfwayArussiansAsurgeonBlideAclownAbriefAreviewAassignmentAtoysAcloudAseparatedArecordedAschoolsAdrivesAcoveringAintelligentAbottlesApileAdreamedBestructionAlockerApinAalleyAbeansAconversationsAabuseAstudiedAphotographAwashedAminorAfridgeAritaApatienceAfieldsAlouiseAblessingArippedBecommendAbayAstanleyApennyAareasAbellsAconstantlyAzoeAdonaldBessertAappropriateAhandedAfraudAprofitAoiAmalcolmAplatesAhappilyAartsAillnessAalibiAitemAskipAnoonApaAmiaBedicationAjulyAscientistsApossessionAspitBtringAappearanceBimAfurnitureAbishopAcorpseCuntsAspainAtobyAelectricAfitsAvalleyAhopefullyA48AjanetAheadacheAskillAarguingAleakAfeedingAowenAharrisAwarehouseAstrugglingAloganApatrolAmisunderstandingAstretchAgrantedAdianeAhunterBeadquartersAjunAevaAadmireAteachersCrrifiedAromanceAprivacyAdemonsAsalaryAvictoriaAcarolineAgreekAmenuAbarneyAchaAdaisyAcigarettesAhalloweenAshellArequireAwhispersBeedAlightningAwillieAmobileAsiAachieveArubyApostedAwendyAdamagedAmummyAownedAnovelAmuscleCrphyAjudgesApreparingAvisitedAmaintainAinvisibleAratsAgamblingCtheredAcapAracingAbetrayAcomplaintAlogAsatelliteBnapBharkBortsAroundsAglovesAdrawnAexpressionAcriesAenteringAcanadaAassumedA27AliamAveAitemsArifleApagesCssportAsymbolAquartersA5,000AentryAslapBhinAexplainedAdopeAfestivalAsearchedAcommunicationAwealthAlincolnAcombatAdancerApriorityAindistinctlyAchamberAunfortunateAnetAbaitAnormanArequiresAcitizenAinstanceAfoolsAtroublesAbatteryAfreezingAlousyAdressingAgrandsonArecoveredAmitchAbuildingsAdrivenAblahAyardsAinsultArevolutionAeffectiveAdiegoAflipAvicAcomparedAnicelyAtapBhirstyA26AchopAnecessarilyAaidAdevelopmentAfinestAbatmanAstickingAretiredAsendsAcaesarAwrappedAmannerAabandonAmarshallApromisesAhoneymoonAstripAloisArelievedAvotesAalexanderAinvestmentAbrushAunfairAbeyBookedAtemporaryAactedAbarnAshortlyAcircusAsungApoisonedAtaleAdescriptionAtwinsAaustraliaBbroadAdelayAconcentrateAtravisAsailAporkAbotheredBucketAyöuAcrashingAthereforeAcolleaguesAyellsA2,000AraymondApaintedAaffairsAdeafAtagAwhiskeyAsticksAburnsAsealedAtestedAsocksAcornAelenaAneilArageAellieAjamAmeetingsCanwhileAsethAbangingAmusicalAsteakAregardingAmexicanAformsAronnieAhumorAirishAhandledArocketAtemperAsensesAquestioningAmoralAfriedAappealAintroducedAenginesAconcernsAbennyAmouseAremainingAeatsAtechniqueAclosestAlapAphilipAsaferAnoraAdeservedAroadsAjonAmoaningAcentsAvirginA100,000AprosecutorAcompletedAproBillBopulationAyeonAsuggestedAmanagementAcounterAplotAgibbsAhammerAleadersBandsAquinnAsoilAbidAinjuriesAclayAbaileyAstudiesAcutsBockApromotionAdropsAconceptAdrewAcolleagueAleonardAranchAtubeAsuggestingAinfectedAcreativeAladsAreturnsAiiAmethodAdiveAvesselA150AsamanthaAburntAadmittedAjoanApotatoesBenisAlendAultimateAnervesAinnerAmannersAempireAbitterBeardAcitiesAidentifiedAfingerprintsAsuspectedAdisturbAchangArepairAfordBundAallenAhummingAlaborAcoinAlaneAmeasureApoemAdepressedAkittyAbumBlanketAwagonAgoatAmeganAvulnerableAelliotAloversAscanAfetchAtwentyAraisingAuh-uhAbonnieAscientificAtraditionalAdiscussionApigsAundercoverAfelixAgrowsAbasisAoperateAwarrenAadArawAdietAtoothAlanceAnestAjillAstorageAprovedAsheetA28ArevealedAscenesBaintAnatalieAlimitedAsodaAlargestAaliensAbackwardsAnieceAshieldAbitsAintendedArileyBequestedAcloselyAnelsonApoundAawardAspencerAheatherAyeAtoesArecognizedAstrokeAtwistAconnorAforgivenessAprovidedAengineerAa1AseAannouncementAwisdomAinterfereAconspiracyAvariousAmartialAsupperAtechnicallyAwearsBatersAcolourArelativesCverendAdeadlyAbrandonBoatsAtonsAfoxAnapAhomelessAfontAproducerBassengersAjetAgabrielAunderstandsAjenAcolinAunexpectedAapproveAgutAluAcausesAlungsAhomicideAkarlAfranklinAheightAinternalAadvancedAregisteredAannounceArelyAfunctionBondAspecificallyAadmiralAsydneyAa.AbeatsAanalysisAdetermineApumpBersonnelAfascinatingAvisitorsAsqueezeAinchAtornApocketsAlawrenceAflavorAcommunicateBhimesApamAneedleArecipeAgrahamAovernightAshittyAholmesAcombinationAtoolAcelebrationApoliteAlaurenApatchAbranchAovenAginaAbanksAfuckerAmotorAgroundsApolicemanAalphaAcandidateAelephantAunconsciousAassignedAmoronAleagueAawfullyAcelebratingAreceptionAbudBendAgrayAsonnyArisingAgigglesAdeputyAparkedAhipAthievesAsoberApackingAmallAadorableAhappierAjulianAimmediateA50,000AsymptomsAhonoredAoperatingAkindnessAtypesAallahAtowelAactorsAjewelryAeffortsAfleetAyanAartistsBngelsAgrowlsAmountAtonAmothersAcontentAhorrorAjerseyAsargeAmotelAsuperiorAkidnappingAelectronicAdelicateAimagesAsamplesAauditionApermanentArootAassistanceAthreatenAseptemberAconflictAsangAcomplainingAmistressAshawnAconductAvietnamAadultsAincludeAlitAplanesBrincipalAoathAinspiredAcomedyCwboyAmelAregionAturkeyAworldsAdeathsAoopsAfooledAenormousAperspectiveAweiAlayingAprayersEingAmitchellAaggressiveAremarkableAhookedBarshAwhistlingAcooperateAevanBxplodeAwadeAdemandsAlocatedAmarcoAoctoberAcenturiesAsevereAmarshalAsuitcaseArainingAharperAlazyCughedAdevelopAamongstAtracyAbeepCarsAdefeatedAcableAinfectionAthanksgivingAstationsAphaseAslavesAfranklyAgrannyAtireAkyungArubAgatesAspottedApromAdepositApillowAmoscowAsoccerAupperAvanessaAobeyAfilmingAbelongedAstabBoapAcrashedApotatoAindiansAfabulousAorganizedAspiritualAinchesAnickyAsignificantBeoulAdaleAsupermanAburstAcommissionerDpeteAnailsAlargerAtragicAvalentineAstatueAdatedAtechAsinghAvisualAconstantAalikeAtissueAjuanAshaneAcrossingAheavensAwornAspotsAmassageAcontinuedAsackAkhanAnamAdiscussedAsoreApopeAdocumentAplantedAbootAwesternAparadiseBornAnutAsmarterAinsistedAchristineAjazzAphysicallyAyooAfreddyAhighwayAwhipAchristopherAholidaysAdoorbellArumorAbritainAshoreAawwAcomaAkillersAwidowAlameBimitsAforgettingAdeniedAfundsAinstantAaudreyAdivineApracticingAgatheringApuppyAeternalAdrawerAradiationAattackingAclaraAtroyAaffectedAbasketAtiesApaintingsAimpressAfloatingAdebbieAunlikeAwashingArexAvastAfeeAidealAcattleArockyAsighingAvaultAborrowedAexcusesAdoughApokerAarrivesAhoodAemailAfillingAboozeAwickedAshiningCooterAabsurdAleonAhumbleAdutchAnaughtyAarnoldApoetryAlectureAandersonAlighterAguAcrystalAexcitementAoldestAclothingAradarAemotionAreactAfiledAsecretlyAcartAamberAchemicalAhandlingAobjectsArecoveryAdignityAarrivalAsteamAvideosAan1AmadnessAquoteArapAgeezAcasinoAbleedAdivisionAautopsyAintentionsAbumpAindependentAfairlyAluggageAancestorsAfussAapologiesAnovemberAtitsAacademyAsurprisesAashesAroaringAcomplimentBursedAtennisAreverseCportingAconAsheetsAkitAblockedAcluesAewAnedAwaltAroommateAdiscoveryApenaltyAwreckAbureauAgigAmelissaAstellaAannouncerAcindyBonnectionsAblondeAmickAturnerA32AbakerAthreatsAupsideAleatherAhopAblaringAsharesAregisterAdealsAavenueAsovietAoperationsAbelievingAfearsAassholesAtypicalAcargoAdutiesAbuddiesAwishedAdrownAlosesAbeckyAladderAbroadAaccidentallyAstareAcameronApositionsAhoustonAwipedAoperaAlaptopAcrushedAbrooklynAdingsAconsciousnessAarrangementsAdisplayAsharonAintelAbaconAdebateAhelmetAtaxesAfoundationAdanaAgroomAprotocolAactivitiesAeraAdescribedCcadesAriskyBetreatApubAcommitmentAallisonAcomputersAterroristsAdiaryAspoilAdisturbingAviceAmiguelAchiCantingAwallaceAcocaineAboldAshadowsAheelsAlatinAclimbingAerrorAgenerationsAtaraAjoelAsigningAbugsAscarAreplacedAadoptedAcarlaAimproveAexistedAremindedBisksAaircraftAflamesAdecemberAlampAgravityAopponentAelementsAwatsonAcontrolledAtenderAcarpetAsunshineAceilingAvitalAsebastianAadviseAexplainsAovercomeAclaimedAproductsAtrucksAdestinationAfinnAkennedyAapplicationAelderAprimaryBermitAservantsAtryinAritualAensureAgreyAdugAfoulAbooAstinkAmobAacidAterrorAentertainmentAgripAhonkingAkayAtrevorArhythmAbarrelAdiningAmuffledAjeongAi-AjulesAtherapistAdistractedAcompareAtwistedAeliAparadeAyunAbenchAvolunteerAphotographsAno.AmarkedAermBmbraceAtablesAenvelopeAstressedAraidAwhaAglobalAcentreBonclusionAjournalistAeerieAswallowAheroinAraAlanaAmingAfixingAapprovalAmagnificentAcurtisBliffAlocateArearAveronicaAgimmeAisaacAdetectivesA'erAbratAcalBhapterAhackAbargainAtensionAfreddieAassumingAtrailerAassesAtubAfarmerAdarnAbeliefAe-mailAarrangementAresidenceAcollinsAtapesAprivilegeAarchieAdisagreeAmikeyAleAdestroyingAsuiteAcoughsAhardestAattractedApsychoAswitchedAinhalesAflameAmealsArelativeAdealtAsmashApuzzleBrotestAarghAparanoidAwhimperingAhawaiiAcorporateAsidAalfredAleslieAdedicatedAheirAappetiteBttemptedAliuAshoutsAvisitorAfinishingAhectorAcatholicBonfusingArehearsalAadrianAhelplessArankAuhhAhillsAgunfireAbacksAcampusBopiesAbenjaminAarrivingAsliceAwristBebsiteAgeneBunshotsAashA36AguardianAzooAexecutedAgraduateAsuspendedAjanuaryAwallyAnewspapersAofficialsAbreachAgeorgiaAaccurateAreachingAliquidAadditionAupdateApoleAcookieAsolarAdorothyApaigeAsworeArejectedAbroadcastAmotorcycleAdoubtsAgigglingAversusAtossAmereAwakingAestablishedAsitsAbuckAchasedAstuffedBo-calledAgalaxyArepayCsistanceAvegetablesAnarrowAcontactedBrackedAassistApanAhostagesAcontraryAsuggestionBtringsBandraAlobbyArosieAantonioAthrilledAlambAassuredAhonAlloydAdouglasAhealingAworthlessAloudlyAjongAclanAwardAreceivingAstreamAmannyAbeamAcanceledAdeniseBallasAzhangAvotedAgumAclubsArosaAherrAbonusArubbishAbrutalAphoebeAstrictAplatformAsnackAtastyAhallwayApracticalAscotlandAd.AcycleAlegacyAtickingBrickyAretireAlnA75AscentBnifflesAcounselApsychicAramAcontrolsAdependAkatherineAarmorAriAlingAstrikesAeuropeanAoffendedAdelightedAcollarAtheftAappAcommissionAstoresAfeastAkurtAcuntAnegotiateAscheduledAbareAdisappointBefendingApresentationAnaiveAaustinAneatAblankAsoloArichieAfacedAboardingAfaintBormalArobbieAmeetsBirandaApreyAsurprisingAhintAafricanAivanAcoinsAexposeAforbiddenApasswordAcelebrityAsirensAimperialAelementAchuckleAnoodlesArosesAconnieArolledAwarriorsAprosecutionArubberAconcreteAmanhattanAsuckedApearlAbingoAsequenceAdjAmiseryAcreakingAjessieAshawBatanAgenuineApointingBaceAgossipAcouplesAperryAcoffinAmansionAinspirationAlydiaAconsentAthankfulAimportanceAtwinAparoleAbenefitsAhopelessApointedBicnicAconfessedAnikkiAarrowAdrumAclaudiaAdecidesAmegAalternativeAelsewhereAimportantlyAmadisonA20,000AprovenAspinningByncAdrownedAslutAchicksAsomberAhudsonAelectricalAkentAclickAobjectionAterrifyingAjaAshaveAmusclesAromeoAdrainAleanAsharplyAjewAcertificateAhatredAenAdiscussingAcokeAendlessAtanksAseedAbreezeAsorrowAlenaAdirectionsAcontactsAsweepAlemonAcirclesAtoeAretirementAscandalAnativeA3,000AconvenientAballoonAslightAbrother-in-lawAsuspicionAbananaAhauntedAyuanAiikeAkaiApirateAformedAcowsAtargetsAperformedBalmerAsprayAexcellencyAi.d.AbrendaApettyAaliciaAexploreAmedalAangieAthumbAahemApreciselyAanaBbsenceAmessyAalisonAphotographerAweeAduncanAgridAcassieAphoenixAvainAspreadingBkinnyApabloAold-fashionedApassageAscumAqingAcollapseAfolkAaccomplishedAdaylightAstinksAvodkaAeconomyBgyptAlexAtorturedAperimeterAchickensAaffectionAplugAschemeAmaterialsAgwenAownersAdullAzachApaulaAblokeAouterAsituationsAmortalArattlingAprofessionAsomewhatAprovesAtraveledAinvasionBrisAmankindAcoordinatesCmicAencounterAverdictAreedAdockA600AcarsonAwanderingAcodyAstrongestBlamsAbrakesAcapacityAfreakedAtournamentAcandlesAstarkAairplaneAhearsAallowsAcorrectedAtangAgloriousAeditorAkissesAtipsAluxuryApublishedAknightAassociateAfoolingAauctionAexecutiveA'youAdisturbedAanxietyAbushAanonymousAwhewApaleA42AsuckerAbackyardAniggerAabilitiesAbreastAandreaAsayinAlipAoriginallyAgaspAdressesAincludedAdummyAperformingAteresaAcandleAhomerAbeverlyAhouseholdAwolvesAshoveAmurrayAingredientsAfortAgilAcollectedAruiningAmorrisAculpritAexpensesAinstinctAsweaterAeternityAmatureAbaiAconvictedAgalleryAbernardAexecutionBnvyAmarineAphraseAdismissedArandallAdeerAperfumeAavoidingBrrogantAgreedyAegoAmethodsAexperiencesAthudsAbullyAreportersApurpleAnaziArespectedCgretsAgentlyAisraelAstuartAandreAowesAdeceasedAcrawlAallianceAhandyAwitnessedAtheoAlibertyAcaringAswornAbeggedApacificAfollowsAsixthAgratitudeAhungerAfletcherAavaBccompanyAskirtAentitledAdesignerAfathersAchessAannouncedAfacebookAeagerAstephanieAzackAelaineAfortunateAzombieAseekingAribsAwakesAcocktailAtessAcalebBorrectlyAdeeAworshipApanelAsumBourcesAmissileAha-haAkeenAtroubledAkingsAwindsAex-wifeAcakesAgrowthAreferenceAempressAbedsAj.AoffersAreservationAbernieBoothAclassifiedApierceAsubwayAwoodyAqualifiedApierreAcreepAankleAmodelsAseedsAgotchaAwhoo-hooArootsAcivilianAremembersAscenarioAengageApursueAmarioArelationsAseattleAbubbleAclausAhiyaAtheatreArotAspiderAcrackingCuiseAsubjectsAallergicApraiseCegnancyAappliedAhyahAillusionAsteppingBouthernApattyAtheirsAsheldonAvaluesAmeredithAapprovedAharrisonAforbidAlasAyoungestAtombApassengerAresortAwhaleAdeclareAhesitateAvehiclesAgpsAnightmaresAgeneticAdizzyAkidneyAsheilaAdialAnicknameAtechnicalBideAlennyAcraneAinvitingAskiesAexclusiveAwarsAshrimpAcrabAnicholasAfulfillAno-oneApassionateAcarriageApistolAincomeAchairsAtopicAwealthyArudyAfameCithfulAdisguiseAsuitableAexamineAbraceletAwhimpersApopsArentedAthompsonArelaxedAbrookeAvibeAcarmenAvanishedAbreastsAfistAdimeAgothamAcooperationAdeedAfosterAlengthArepublicAspillAcollectingAspicyArollsAbrunoAglennAcollapsedAthusAphillipAscrewingAcabinetAfledArodeBecogniseAnowadaysAsicknessAeliminateAcontainCmpromiseAshiAblamingAiraqAdoomedAvillainAchainsAleadershipAdesiresArupeesAfionaAerinAbrickAluckilyBikingApepperAloopAfrogAelvisBnforcementAhilariousAsmashedAchoosingAwinstonAkindlyAminimumApossessedAscoresAfriesAcomradeApriorAbounceAstiffAendureBxceptionAblackmailApalmAchoAlosersAbarbecueAtrumpAherdAsupremeAreggieAprincipleAshotgunApeggyAestablishApoetAditchAbeersAcoversAsurvivorsAcemeteryAzhaoAlolaAyou-AmsAjuAfightersAnoisesAkathyAcivilizationAsingsAcreationAfengAsacrificedAformulaAbusinessmanAcontainsAassetsAhyeAcheekA2ndAchadAplagueAcuredAsamuelAmatesAhalAjarAelectedAforgivenAclipApoppedA29AmeltAkirkAjennaAspoiledAdisciplineAmotherfuckersAgreetAteenagerAreplyAtrainsAhonestyAmoleAveraAwhatsoeverAtracesAlouderAnursesAguessedAforeheadAdentistAwhereaboutsAlabelAhoonAplanetsAwyattAsalAqinAkaraAlogicArarelyAfuriousAcongressAsashaBobsBignalsAmcgeeAclearingAqiApouringAblairAsympathyBtewAjadeAfloatAsandwichesAfireworksAnaomiAimmunityAsnacksAmodeAtrackedArestingAgood-lookingAreunionAfuAbeeAvalAadamsAcodesAdudesAjudgingAcracklingBhapAdomesticAruledAobserveAshuttleAcafeBompoundAi-i-iAahaA250AconfusionAstaticAlizzieAwebAinitialAquestionedAvampiresApricesAwritesAmedsAburkeAjeffreyAdeclaredAfollowersAshrinkAmaximumA99AproposedAroryApursuitAbeesAstuntBilkAbiologicalAswellBleepyAassassinApsychiatristAdisgraceAapologiseAharvardAinvolveAdepthAsnakesAconvincingAkidnapAeleanorAlawnAboxingAscaringAtilAracistAdebtsAcorporalAhobbyAnearestAheartbeatAarseAsunsetBtatementsAtremendousAkaneAfatalAvioletAintimateAtransmissionAspoonAgestureAdrowningAmajorityAinstinctsArevvingAedgarAtrophyApullsBersuadeArealisedAposeAatlanticAdraftAericaAomarAroastAcrucialArestoreAdistressAbuttonsAorbitAlunaticAinkAgranddaughterAdigitalAscaresArepresentsAgraduatedAsellsBwordsAwoodenAsausageAidolAgradesAfrustratedAstandardsAransomAauthorAowedAmeiArespectsAessentialAfarmersAlaserAfebruaryAintactAsister-in-lawBeatedAreliableAkiddoAgainedAfailingApersonsAinnocenceAtrickedAdatabaseAmovementsAblamedBowlingAchinAmissesAsharksAliftedAnicerAclatteringAreferringAtreatsA1stAstrictlyAhornsAafghanistanAcellarAfluidApoundingAsuggestsBakesBettlementBleepsAcannonAthirtyAcampingAorleansAgloveAc.AorgansAthudAspeakerAwormAfiftyAbreathesAexpectationsApreciseAspiteAhamAireneAapplesAfloorsAcommentsDplaintsAleafAexpertsAfurAblur3.7AviciousAsighCsAadditionalAstewartAambitionAd.c.AsupportingArelevantAdroneAinfoAembarrassAaveryAneedingAmm-mmAflorenceAjulietAwongAcrawlingBarriesArecklessAindicateAbellaBarnesAmonaAwatchesAdecadeAfarewellAproducedAmulderAfryAlegallyAjanAreplacementAprojectsAorganAfogAshockingAbrand-newAcleanerAinstrumentBgnoredAsincereAmosesAniAcoalAagendaAremainedAleapAerikArajAdrakeAlocksAmarvinApicksAtoxicAhockeyAshinyAdunnoAtoreAgooseAlightlyAasiaAshipmentAhatchAresidentsAhatsAchallengesApoisoningArescuedAsofiaAchemistryAtumorAfragileAdistractAtolerateAhansAroarsApresentedAfluAlickApotterAexplosivesAcathyA31AsadnessAasianAcherryAshakespeareAcontrollingAdriedAmooreBanualAbaekAunlikelyAstronglyAdepressionAresolveAyongAoccurAreachesAinterrogationApublicityAciviliansBlerkAtouchesApromisingAdriversAfastestAprankAbrennanApedroAultimatelyArigAshirleyBniffsAtripsBwelveAsoftwareAbetsAchampBottonAernieAmelanieAinvestAgambleAeasternAburgerAdemocracyArebelAwrestlingAtuckerArangAhowdyAintegrityAtextsBhrowsAengineeringAlegendaryAinterviewsAcinemaBamAstallAclothAluisAbaldAfadesAmonkApondAexplainingAthinkinAcolumnAprescriptionAsubmitAharmlessAconsciousAthreadAclimateAbearingAinterruptingAknivesAjeansAbuddhaAdifferencesAcopperBhengAlightingArashApoopAthuddingAissuedAfavorsAsullivanAviewsAfloodAcalvinAhugoAstevieAwaitressAlegitimateAcorruptApurchaseAnannyAfifteenAcuriosityAgoddessAdoyleAbennettAscholarshipAlogicalAunhAscreechApancakesAjaredAdraggingAadministrationAcourtesyAaiiAorchestralAeagleAweighAeraseAbrettA33AmutualBessengerAshootsAyenAcupsAhospitalsA800AfoldAanywaysAmarvelousAchewAdevotedAbradyBattlesAvickyAcompromisedAdamonAmentallyAwellsAoffensiveAgenerallyAmauriceAgraduationAayAcraftAbuzzAlinkedAphilosophyAellaAbribeAt.AreceiptAvolumeAameliaAunnecessaryAoutcomeAdwightAcrowdedAdipAincreasedAhamiltonAsavingsAopportunitiesAsquealingBtarveAbicycleBoobsAphysicsAarcherAcongratulateAexperimentsAquickerAchristinaBracksAhaircutAemotionallyArushingAquittingApiratesAhwangAottoAgarlicA20thAdisorderAsmokedAregardsAchesterAbombingAdeliberatelyAadvisedAinvestigatorAdiceAobjectiveAwaiterAmonkeysAboreAtravelsApastaAquestArealmAbachelorAfortunatelyAhyungAdontApleadAumbrellaApencilAsimpsonAbaronAachievedAyingApromotedAjiangAdomAanchorAbongAassetAbentAparticipateAtextedApuppetAjust-AregardAfictionAgalAwesAminesAcounselorAenterpriseArestaurantsAcurtainBlydeAvillaAcourtroomAinappropriateBsolatedApsychologicalAcampbellAdingAwhistlesAsparkAlouieAsailorAjewelsAflynnAshelfAhostileAeliminatedAbeanAmythAportalAgapAunderwaterAsneakingAcousinsAwitchesAtrustingAson-in-lawAthoughtfulAguidanceAcoolerAmasksAlawsuitBynnAorphanAdesperatelyA2000AbinAgavinAconquerAlotteryAhowlingApossibilitiesAintentAdevelopingAwithdrawAjournalApatternsAshortsAbartA38AkicksAmagazinesAsherlockApercyAbuyerAsophisticatedAkwangApressingAstAinevitableAbunnyAfangAconsistentAbuysApadAannualAimmortalAvarietyA37AresidentAfactorAencourageAsurroundingBcamAcolonyAnazisAswampAhandfulAawhileApossessAreadsAbriefcaseApiperAaddingAlayerAcalendarAwillyAaccomplishA80sAmorgueAchelseaAresignAmeasuresAequallyAcompanionAframedBacialAaddictAforcingApathsAfailsAisabelAchallengingAelegantAteenageAetAatlantaAivyAsailingAmouthsBandyAviolationApleaAoperatorAdancedAsoleAlivelyAbettingAfrequencyAchuAbountyAhealedAbutcherAhughAfreelyAstingAindividualsAshopsCirtsAfabricAspiesAexpenseAborisApollyAsweatingA3rdAfearedAdividedAsylviaAmastersAsofaAdaughter-in-lawAchokingAbluesApeanutAhaeAofficesAwigAstampAgriffinAembassyAcornersAdaphneAchopperA51AfeatureAoccupiedAfellowsAprotectiveAopposedAkilometersArangerAwaAloadsAruinsAtreasonAflowingArehabCspondingAtearingAbothersAharvestAwanderAgangsterAsentimentalApoliticiansAshannonApunchedAapproximatelyArushedAbassAresponsibilitiesAevansBducatedAharrietAsmilesAprostituteAkansasAhumiliatedAmillAbakeAcherylAministryAscissorsAattractAjonahAinsectsAchampionshipAtradingAeugeneAtunnelsAgarciaAsectorAdexterAchartAobservationAappointedAcommunicationsAfierceAabductedAcultAdifficultyAboydAvetAspectacularAturtleAporchAaccusingBbigailBccuseAkiraAbizarreArobotsAapproachedArascalAgarrettAambassadorAtheoriesAbrazilA'm-iAsitesAcorruptionAviaAbalconyAdozensAbutterflyAestherA1000AbackedAmagicianAoverseasAsucceededAacknowledgeBllowingAlesterAreeseAalliesAexamsAdiscountAflushAgeorgieAsimoneBexuallyAdinerAuniformsAfederationAracesAcansAjeffersonAmuslimApervertAsnoringAessentiallyAdammitArobinsonAgoalsArallyAaceAessenceAsourAhuaAvisitsArugAbroadwayAtalesAcubaAdrumsBenAbehaviourAsukBtrawAorganicAriotAmugAprinciplesAsmelledAchargingAattendingAreduceAglueAexplosiveAunstableApoppingAselectedBcottyAgabeAtastedAlyricsAorphanageAdespairAbackpackAmediumAbackingAyogaAbaxterAarizonaA34ArecommendedAambitiousAtianAmaintenanceBurmuringAweekendsAambushAvestAadjustAbeautifullyAnailedAlinedAe.AshutterAjoyceAportraitAorderingAdawsonApresumeAgrainAlifestyleA4thAstirAevelynAcoughAyinAolAdeltaAhaltAagnesAfartAcircuitAphysicianAsetupAveinsAlungAsophiaAblockingAseventhAhusbandsAbattlefieldAwheelchairApuddingBretendedAlandlordAscarfAresumeAbradleyAprofitsAdreamtAforkAexaminationBarthquakeAignorantAtopsAgroceryAlureAslightestBhadeAvotingAcatchesAepicAconfidentialAlipstickAbuzzesAknocksAsmackAdoseAconsiderationAsunnyAhuntersAstunningBortedAjonasAirelandAdestinedAgongAserenaAballetArodneyAtransplantAoughtaAreaganAnanaAspyingAgideonAchunAatticAinstantlyAporterArivalAblessingsAclearanceAsultanApanickedAsuckingAcarbonBhulAfittingAcustomAinvestedApodAbraAurgeAstefanAwhiningAlesbianAidenticalAellisAdeedsAposterAdeadlineAinstitutionAridesAdevicesAunpleasantAopinionsAbatteriesAdetroitAm.AcountedAtowelsAdisappearanceAcreatesAminusArapidlyAlaurelApreserveAherebyAbarksAgrudgeAaccompliceAdcAhackedAprepAmissilesAhaulAwiresAuntoAbodyguardAextendAsketchBuperheroA120AhunchAshutsAexecuteAbarrierAcasualAkiAshenAhissingAstoveAnasaAcordAsubstanceBireAobsessionAvisibleAnanAeasterBxtentApilotsAmaniacAspecialistAvengeanceAcynthiaAdollsBistractionAmotherfuckingApopcornAcctvAropesApointlessAdonorApantiesAimprovedAjrAlastedArogersAsubtleAcancelledAklausAdialogueAhabitsAyuriAflirtingAwizardAeconomicAthoroughlyAleaseAmakerAcontinuingAmisunderstoodAilAreynoldsAdelayedAhappiestAlaurieAcompassionA55AlaunchedAincludesAconvictionCmradesAdonkeyAspilledAtalentsAscarsArainbowAbelleAyachtAgirlfriendsAdealersAexplodedAshAmercedesAnotebookAcorridorAfeathersAconradAsecuredAwhisperAprayedAohioAtorchArioAedithAhaleyAbensonAxiArebelsAlionelAreducedAformationArefusesAvacuumAeliteAherculesAdetectedAmarilynAsentencedAamateurAsuccessfullyAconventionAmarketingApressedAalexisAdreadfulAnorthernAoriginAingAautographBlecAhometownAcontractsAthoroughAmusicianAjingAaccountantAlearntAspockAvowAcueAapolloAvalerieArobertsAbrassAhiringAshiftsAinspectionAsupervisorAaghApipesAcorpsAaaahAhonorableAaccidentsAdemandingAlocationsAmonroeAfisherAtunaAreferAbillieAmiraclesApotentiallyAswallowedAabortionAtextingAsensibleAchattingAlindsayAnursingAflourAantonAgeneratorAjacquesAsusieAmoansAstrainAalcoholicAchandlerCildishAstashAcostumesAtrapsA'iAacceptingAmarionApartnershipAclevelandBoconutAvillagersApledgeAscoutAdenverAfeesA30,000ArodAonionsAtripleAcarolinaAscullyAbertAinsultedAlistedAdaeAcombinedAhelenaByoBallelujahAjawAcellphoneAtranslationAyelledAspermAd.a.AfadeAluciferBongestAcasualtiesAbrakeAwelfareAswissArememberingAconstableDfrontAhookerAlutherAyahAevacuateAspineAadoreAeinsteinAgilbertA's-AcarloAtravellingApolishAforensicAmortgageAartieAtinAhutAgerryAseungAactivatedAmodestAappreciatedA47AcentAp.a.AbreedAcreaksAtiffanyAvivianAcourtneyAdisappointmentApoliticianAmarcAantidoteAsleeveBkiAricoAj.r.AinnAdivideAgroundedAlidAstevensAbetrayalAkatAtanyaAbakedAconfirmationAdetentionAwondersAarabicAbartenderAfundingAsalmonAannoyedAcontainedAriskingAmaddieApumpkinAo.k.AadvertisingAconsultAimAstainBalesmanBiblingsAphiladelphiaAmurderersAoverwhelmingAtouristsAquidAreflectionAbusinessesAavengeAgrillAfiancéAblinkAhoseAchokeAsniffingAmarchingArejectAdefinitionAalongsideAfiancéeAnolanAmother-in-lawAponyAsupportedAtomatoApainsAfreezerAunderestimateAmechanicAtechniquesArequestsAmargeAreminderApredictDcinctAstackArecognitionAexpandAviolinAbonAdefenceAfreaksAhangsAstalkingArogueAseasAlivAhistoricalAshanghaiAdeliveringAjoshuaAgruntAefficientAswitzerlandAfrustratingCostArailroadAhandwritingAclassroomAsectAautomaticAchoirAsweetsAglowAivAwanAvaginaAhousingA72AarticlesAchffffffAmeaninglessAthrillAawaitsAsenateAfleeAxuAabrahamAburtAregardlessAbauerAculturalAjjAtammyAboilAdemonstrationArunwayAdaggerAsqueakingAdocumentaryAmomsAfeaturesAcottageAloriAorganizeAshookBummonedBatisfactionAdesertedAsplendidAjellyAcurtainsAalmightyAminingAwaxAdetectAbossesAhammondAaltogetherAnotionAsipAhannaAjammedAariAwhooshingAmackApainterAsunlightAechoingAobligedAservesA65AtrialsApovertyAfrighteningAinaudibleAdependingAahhhAstarfleetBhippingAmatchingAovertimeAshepherdAtrayApensionAfartherAoutstandingAsaulBtraightenAcheeksAdisrespectAsidneyBensorsAclappingAscoredArookieAinterviewedFnAwaistA52AignoringAbumpedAeurosAbunkerBabaCrkAarrestingAguaranteedArackAinventionAserverAbondsAcompetitiveAwarmthAinstrumentsA49AfiguringAginAcontainerApurposesAislandsAaudioArepresentativeAadoptAshatteredAcoronerAjoseAsurvivorAdonnieAterminalAmainlyAclarenceApimpAwormsAbitesAtannerAshallowAlossesAconcentrationAmechanicalAwardenAscatteredApeakAtrousersAlandscapeAfugitiveAselectionAdisposalAstickyArobeAbillionsAgingerAmurderingAdelightfulAreserveAwinnersAdefensiveAexposureAhandcuffsAassaultedAtyAboltAamazedAmentorAspecialtyAabusedAworkshopAbreakdownAducksAallyAfranBountainAdorisAexperiencingAreginaAflatteredAhikeAjustifyAcigarAgreedAaisleAhonksApinchAmaeAclimbedAboundariesAtallerApmAhangedArisesAprintedAdivingAwarpAshellyAinteriorCstalledAkrishnaAexpeditionAhandingAdearestAburialAfloydAcandidatesDadianBlaimingAdanteAsubAamusingAidentificationAshuttingAprogramsAdiApatriciaAabeAnypdAassociatesAzombiesAproteinBhonyAcopeAveniceAnunApropertiesAnadiaAhornyAwritersArestoredAlionsArighteousAartificialAmustacheAbridgetAentertainAantsAprogrammeArelationAyeongArainsAliteratureAjealousyAinvolvementAbatchAlobsterAdelhiBanielleAeldermanAwardrobeAnealBoisyAretrieveCbuildAcommittingAhermanAgownAarchitectAeldersAclamoringAshovelAaigooAfrodoAlethalAreidAmeterAviewersAapplaudingAchiliAfrancsAmushroomsBemorialApickupArefrigeratorAclassicalAsemesterAdynamiteAcountrysideAdirectedAspendsAranksAg.BregoryArolandAphonedAindustrialAreflectAclaytonAwiredAsparedAloungeAshermanArustlingAgreatlyAjediAcdAdetailedAmiloAblendArespectableAcustomsAteaseAriskedAyueAthaiAassassinationAhartAgraspAneednAresignationAinstagramAoutrageousAdisappearsAblondAoverwhelmedAciaoAharborAfeatherAbannedAprobationA200,000Aha-ha-haAmarinesAex-husbandAbrooksAgeraldArustyAshorterAlunaA21stAjurisdictionAbakingAtimmyBappingAinvestigatedAerasedArealisticAexclaimsAcountlessAoppaAvipAsalonAmattressAusaAracketAjasmineAinheritanceAregulationsAworkinAbandsAgraciousAvolunteersAunluckyAanitaAsoughtAtelegramAregistrationAcheaperAbeckettAvoidAfilmedAequalsAsponsorAmontyAjaniceAdinosaurAslaughterAmonitoringAriversAkinAlonelinessAwarmingAshellsAacceptableAwhArumAsacrificesAammoBssociatedAdonovanAnilesAlaboratoryBocalsAhotelsAathleteAzhouAbrandyAglobeAagreesAsniperAruthlessAsnuckBummonAdennyAmelodyAsaddleAmiceAizzyAdeepestAfeiAreconsiderAimmuneAslappedAexoticApublishAtownsAauthorizedAdepartureAbeastsAravenAglenAinstituteAbranchesAseizeBcumbagAnationsAsockA70sAspellsBhelbyAtouristAalaskaAhahAnixonAinquiryAjollyA700AdelAta-daAdixonBragonsAautoAdarrenBischargedAsunriseAcruzA5thAtrentAdangAoffendAhushApremisesAgreeceAvolcanoAdiagnosisBevastatedAlapdA10thAacquiredAjerusalemAcarelessAdaniAnigelArentalAbuzzerAsatisfyAvowsAhayesAswingingAchemicalsAmanagingAlistensAcheerfulAsurvivingBhaftAbruisesBoostAoofAcoloradoAtracedAsoniaAmoonlightAastronautAcharleyAtickArelateAtrustsAcartelAreignAurineAsinkingAlastsApropositionAjasperBudithAobligationAstuAheroicAmuAbladesAfulfilledAinvolvesAbryanAinheritedArollerAheidiAswapAevolutionAresolvedAzhenAtrishA15thAwishingAfinalsAclarkeA7thAprettierAchannelsArulerAaidsAcozyAmagneticAfareAhorizonAslippingAdebAclaudeBreekAstrayA12thAmatchedAcocksAgrandparentsAvisionsAbreathsAonionAsnarlingAwhippedAamountsAharmonyBumiliatingAsmiledAronaldAmaidenAaustralianAozAammunitionAexaminedAsurgicalAattractionBnyhowAguoAaltarAspaceshipAescapingAqualitiesAhardwareAdancesAkevAtellinA't-AkoAedenApouredAukAdifficultiesAhairyAteenagersArestlessAsamuraiAknotAinformantAhipsAdonationAgenuinelyAmerlinAlucaBegitAauthenticAfinchAdonateApart-timeAentertainingAmumbaiAspikeAhuntedArecommendationAinterferenceAvenusAboilingAsubmarineAinmatesAsurfA43AgiftedAjamalAdotApsstAstammersAdimensionAacquaintanceAgiAhigginsAfeelinAdaredBesignsAthAvonAsincerelyAvegetableArulingAmissionsAbloomArepeatingAslamAdriftAfortressBacilitiesAtattoosArunnerBadiusAdevonAsupermarketAromansAskilledAeighthAsweptApetersonArapidApissingAliningAunlockApaymentsAhughesAwhoresAdormBeceivedAasylumA'maAcarlyArendezvousAtongArooseveltAshivaAlustAraviAventureAattemptingArobbingAsadieAoccasionallyAattemptsAtossedArepresentingAfaintedAargumentsAportionAdodgeAsalvationAdamAtomatoesAlayersAarmiesAbananasApokeAinvestorsArecruitAmattyAsteerBavageB.ArajaAimaginingAsightsAlorenzoAstinkingAnapoleonAsensationAmarishaAstacyApauseAcompetingApawnAarrowsAceaseAjenkinsAuniteAmississippiAhathAdisabledAmarinaAtreatyAhoorayAscoopAphenomenonAspider-manAcricketAjeannieAcurryAradicalAcaneAbehavingAswedishApdAspiceAcrookedAeldestAinvolvingAadoptionBrteryAjunkieAinsultingCdicatesAtimelineAcongratsAtacticsAautomaticallyAseongAtobaccoAowlAcassAaspectAvomitAzekeAhahaA18thAprovingBolandAaddictionAbeliefsAindependenceAclapBampsBourtsBautiousAslackAcoverageAreservedAmetresAvolunteeredAoverboardAseizedAdisappointingAbeccaArelieveApigeonAsquirrelArebellionAyeaAbangsAinstructorAloadingAutterlyAbarbieArailwayAgoogleApronounceAfinanceAsolomonAcautionAtokenAincreasingAbedtimeAchartsCewingAspaAupsettingAwhackAcrowArangersAoxfordAfreedAsaluteBhieldsAfractureAstakesAmumblingAassemblyAhustleApalsBeculiarArunninAdarcyAtriumphArefusingAxiangAsnapsA19thAexpertiseAmillieAleverageAscotchAdepressingAclumsyAtanAsupposedlyBtadiumAearringsAsabrinaAwagesAdemonstrateAbrodyAinfiniteAdrawingsAabuApakistanA13thAhawkAirrelevantBnjusticeAcamilleAp.AchoresAventAwenAinnitAbryceAdirectorsBooAknotsAnerdApairsAxinAfrightenAgoaAbaltimoreApeekAsolArailAmicrophoneAtargetedAcricketsAlangAhospitalityAverifyAevolvedAbittenAsupportiveAphewAbriefingAscoundrelAinjectionAtateAcoloredAvoyageAexhibitionBlderlyAjumpsAbluntBalloonsAaffectsAtriggeredBurkishBhorAacresAdrivewayAelaborateAgroceriesAinitiativeAclownsAhendersonAvikiApriestsAfuseAstrikingAtranslateAeditionAjoannaAdefineAmockArazorAlogsAwhitneyAsloppyBelf-defenseAarabAjupiterAexpelledAhollandAarenaAbabysitterArationalAnicoAsnappedAregularlyAcontextAegyptianAseparationAperfectionAhaoAfeedsAbusterAiranAassociationApromoteArenAinterruptedAcastingAfelonyAobstacleAinventoryAhayAtollAplaygroundAferryBorgedBlownAtakinBougherAneedlesAmarijuanaAwesleyAelbowAcorpsesAextendedAspaghettiApoisonousA14thAunpredictableAproceduresAethelAconsortAt-shirtAemploymentAcrashesAsimmonsAextensionAduelAmeltedAharassmentAdischargeAtrainerAdisappearingAtidyAmwahAdamienAirresponsibleAsweatyAconvictAvirtueAwavingAinvestigatorsAninjaAconclusionsBrawfordAmontanaAboardsAelevenAbiddingAaxeAcrookAziAcongressmanAlanguagesA90sAfruitsAreddingtonAmilanApeacefullyAlimoAtippedAdancersAcooksAslowerAdenyingAgrandchildrenAhousekeeperApentagonAchoppedAmimiBakinAgrown-upAviennaAflightsAoppositionBllieApreferredAmanipulateAskippedAbelongingsAsufficientAleakedAgreaseAdollyAcliveCattersAdebrisAcrappyAmethAgazeCilAextractApetsBsychopathAironicAparticlesAtemporarilyAbricksApetitionAdinosaursAnotifyArussAbordersAsaAheelAencounteredAflippedAentersAcondolencesAsessionsBteeringAniggasAbitingAprobeAoliveAcomedianAwombAbadassAwalshAcompassApoemsAundoApubliclyAbunkAstressfulAcafeteriaAnatashaAmedAprofoundAattendedAexhibitAshaunAtargetingAenthusiasmAmapsAkookAcontentsAqueensAmechanismAswatAfather-in-lawAscrapAauntyAveilAsyrupAprogrammedDcessingAlookoutCng-termAclawsArestroomAhwaA01AnumerousAjudgedAelephantsAantiqueBgedAtransformAmyungAdeceiveAheightsAkrisA20sAotisAleahAdistortedAnumbAiiiAjuliusAscrubAliftingAfull-timeAwretchedAsavesAvillagesAcropAmanuelApsychologyAdiscreetAsoundingAcomplimentsArevolutionaryAarmstrongAtowBeasingAquentinAgrenadeAslipperyAnashAtabAguardingBrabbingAchambersApostsAcunningAalterAmake-upAinstructedAcompensationAadventuresAreactorAkramerAglanceAdrunkenAconvenienceAmalloryAseasonsAhistoricCdesAmichiganAobtainAlanAtransitionAmerchantAprovidingBineAoverheardAsubtitleAoftheAdeaAcyrusAdiplomaticAstartledAhip-hopApastorAandrewsAprophecyAufoAlensAsuzanneAmadridAglowingAasapAcollectorAtraitorsAclintonAoccasionsAcarvedAliangArabbitsAtributeAmintAhenceApukeAstitchesAdoeAhayleyAselectAquarrelApitifulAlodgeAdentalAgrindAhottestAvibratingAjeromeApotionAsushiBabotageAneighboursAmalikAestablishmentAgabbyAarjunA4,000ActAdonnyAmustardAkilosAvalveArongAcarrierAshittingAdashA85AbikesAdeweyAzipAtubesAsquealAflowsAbanacekAwildernessAbubblesAtransformedFportationAqueAteachesAfaggotAmuleAfedsAwaitsAluoAreferredAdominicAapologizingAprestonAsmartestAlesAkennethAturfAdelightAlockingAmarcelAtutorAmillionaireAbeckBaggageAedwardsAncisAbathingApoppyAfocusingAbuffaloAslitAthirstApunchingAclassyAnatAcontinentAaccusationsAdiseasesAstrangledAcoloursAembarrassmentAnurseryAhairsAjosieAdiazAfucksAvijayArecorderAharleyAactivateAcerealAmourningAolympicsAdeleteAbanquetAmissyAwandaAinspireAstoredArepresentedAneighbourAencouragedAprimitiveAtimerAribAgemmaAcaitlinAbamBreakthroughAunarmedAfemalesAcarnivalBoncerningAoverlappingAtaiAbacteriaAvesselsAaddictedAscreamedAratesAstaceyAexceptionalArelaxingAvietnameseAhuArefugeBaeA95A8thAolympicAleakingAsplashArippingAchallengedApermanentlyAa-aAmadmanAbutlerAhooAfunkyAagonyAcorporationAthailandAimpulseApredictedAmidstAlockdownAgibsonAsmugglingAbathtubAlillyAcondemnedAintroductionAamsterdamAbankruptBpAaeAsuspensionAiâAbeholdAexplosionsAbiscuitsAutterAexclaimingAsaviorAdruggedAmicAseonAengineersAdiscoAweirdoApracticedAfuckersAbakeryAhystericalArefreshingA60sAmartaApurelyAseizureAkungAcompartmentApeelAtequilaApennsylvaniaAscarlettApunchesBamelaAmalesAshinesAinsanityAgangsAmirrorsAsubstituteAcommandsApurchasedAx-rayAappreciationAlimbAhumiliationAdvdAmildAsurveyAtorresApowellAuh-AhotterAimpatientBnsightAsaneAopAbanditsAwrightAforensicsAemployerA44AmerchandiseApartialAflirtAoverallAvernonAhideousAerrandAstatedApacksAdislikeAtailsAechoAbushesBeaconApaulieAsymbolsAroarAsettlingAmeaningfulAlumpAinheritAestimateAwheatAcoryAnewestAfelicityAtreasuresAglimpseAtaliesinAreadingsApreacherAvisaAmorphineAnickelAcreepsAincidentsAshapedApiesAviolatedAmasterpieceAsyndromeAgenderAavoidedApeachAconnectingAjuicyAverseAflockAelsaAisabellaAlilAresentAspearBeverelyAfilingAtypingAjedAlyleAnicestAbatsButtsAdaltonAtroublingA25,000AvanishCccineAweddingsAunlockedAk.AdillonAtraditionsArespondedAdanielsAtackleArepeatedlyAelectionsAconfuseAlopezAherbsAcoolestAyoutubeAbluffingAfinaleAartisticAstripperArefugeesAorchestraAgagArolesAloAstruggledAresetAsmallestAlilaBemonadeAtemptationAchurchillAdiscretionAcoupAreneeAlaraAtwitterAstrollDawberryAprovidesAaddsAphillipsAmoldAautumnBmazonAconductedBupboardAfrasierAqianAimprisonedAoperationalAgonAfoodsAkeeperAsheerAhauntAsmoothlyApajamasAcuffsAtheresaAjewelApreparationAnewtonApriyaAbustingBreeAmassacreAeasiestAdistributionAingredientAflashlightAnuisanceAcategoryBondomAshattersAmutteringBillsAyankeeAsewingApreparationsAswedenAbargeAnewlyAwaitinAslaveryAprofessionalsAgooAdoorstepAcavesAbulliedAcribAfreshmanBootprintsAconsultantAspeechesArobbersApattersonAdreAshowersAtacticalAwerewolfAmeltingAparallelAtoniAlowestAunacceptableApresidentialAwhalesAmiriamAjingleAhastingsAallieAfitzAspeedingAedgesAwillisAapparentAmetaphorAvalidAserumAkneelAstalkerAmusiciansAsaltyAkellerAcombAgraveyardAscratchingAmemoAquizAneutralAhenriApumpingAmysteriesAcurrencyAwageAsewerAfrancesAgaoAvoiceoverAevacuationAtractorAunemployedAapproachesAweepBrathAjanitorAhuiAtrippedAdefiniteAawaitBimingAnsaAwitAthugsApolicemenAstartersAungratefulAimprovementAdicksA'brienAduAcourthouseAnotedAthankingAcallerAparlorAheavenlyAfishyAloansAsnitchAunAsadlyArealizingAbuffyAwhoopingApursuingCppiesAflagsAaddressesAbaAschmidtArequestingAgladlyBaAmisunderstandAfeedbackAcherishAproducingAregainAtraffickingAfloodedAimaginaryAlorraineAfrankensteinAelijahAsuggestionsAcavalryAfoundedAdeclineAcomplainedArupertAto-ArelativelyAapologizedAsupernaturalAdeterminationAcementAstreakAbootyAhuangApostersAshavedAfannyAoccupationAsewAcartwrightAadmiredAoakAintellectualAdrippingAequippedAsmellingAtreyAbeggarAaiBssessmentAsingaporeAtradedAstealsAtitanAadmissionAriggedAferrariAchoosesAnegotiationsAesAsolemnAaltitudeAkeyboardAsantiagoAviralAongoingAinventAboyfriendsAslotAblanketsAcelebratedAincomingAsuperintendentApyramidAreservationsBoughlyA41AdetectorAcontributionAmademoiselleAcoraAkindergartenAburgersAvickiAsolitaryBhakenDmelessAyummyApeanutsAgenesAmoeAoffenceArmAbroomAstrapAneighbourhoodAcivilizedAleashAbankerAhaiAscopeAfreakinAmadelineArockingAsanctuaryAdrawsBevastatingAlackingAemployedAhurricaneAezraAhollowAreinforcementsAfortyAdispatchAcapeAh.AummAslaughteredAexpressedAfluteAlinksAironyAmaxwellAdiagnosedAbetsyAsunglassesAand-andAkarateAripeAguardedAstagesAchapelAexhaustingAmichelAsenseiAhazelAlizardAshippedAfernandoAcountessAheadachesAmotivationAvaseAdevotionAsweetestAobservedAjaiAchorusAdespiseAsolvingAmottoBazeAjerksAdismissBecidingAunfinishedAmarissaAfavoritesArepairsAslippersBhuAmccoyApinnedAheatingAsentencesAinterceptAheistAsnatchApetrolAgravesAskeletonAquarantineAhawkinsAohhhAridgeAdeletedCpthsApayrollAachievementAfakingAdarrylAmoreoverAkumarAgraduallyAunderstandableAkwonAdariusAouiAangeloBlteredAyelpsAouncesA180AyaoApickleAconductingAramonAfilthApsychAkaylaAobamaAwiiiAprotectsAvegetarianAmontgomeryA1,500AnoticingAbrendanAconsumedAatomicAwarmerAbuildsAadaAgabrielleAminiCcrowaveAwreckedA101AsherryAvirtuallyAgraysonAvanillaApermittedAbuggerAagenciesAcurveAmaydayAnormaA46AdaresAsceneryAnudeAragAcrushingAgrapesAdynamicAteAjiaApotsBastryAsmokesAriderAcomparisonAbragAgasolineAhomelandAwheelerAfrancineAninthAshengAfunctionsArubbingBeformAawardsA6thAtemptedArumblesAharmedAaholdAsuitedAclangingAtriangleAoptimisticAquantumApharmacyAmovinAinspiringAgreeneAyaleAtuckAviktorAstrippedAhannibalArhymeAconsiderableAhqAkillingsAvagueAdaringBwayneAr.AlegendsAbatesAfearlessAdronesAabelBpeAbeaverAcropsBanalAikeA16thAmellowAzhuAtunedAholdenArecoveringAseduceAgraciasAdarkestAtoothbrushAmargotAuneasyAtabletAjokerAchequeAemailsAmotivatedAconsoleAworldwideAisabelleArelayAlongingAkirbyAportlandAdexAhallsAwillowAbutterfliesAallowanceAsunkAribbonAadrenalineAprAjulioAbewareAinmateAurbanAgreatnessApredatorAcarrotsAtextureBristanAblogAhandlesAaddressedArobertoA000AbutchAcondoAmixtureAhassanAtrackerAcosmicA'neillApikeAnarratingAmisfortuneAcontractorAterrorismAupsAfewerAmarkerAcomebackAforeignersA11thAsanchezAadvisorAhopefulAfireplaceAexploringAdemandedAfreakyAdisneyApsychiatricAtribesAsidewaysAcelebritiesBubanApsychologistAtummyArobberAvileAaspirinAindianaAstocksAheartlessAooohAresignedAceliaAsplashingAvenueAroamAallegedAsouvenirAruAclosureAdraculaAspringsAopenlyAsurprisinglyBoakedAleaningAheatedAsummitAriflesAlimeAsneakyAartilleryAwhoopsAbraveryAjavierAvergeAyieldAonboardAmatthewsAnosesAtessaBorturingAgravyAzoeyAanalyzeAhyukAexpectsAqueerArepublicanAneAinsistsApeytonAwoAsecondaryAperceptionAspeakersAcoatsAvocalizingAconcussionAacquaintedArestrictedAbomberAdebutAevaluationAadaptAsierraAcartoonAremindingAspacesApoAbluffAinvestigationsAslowingAcapsuleAhavinAdiscipleApaycheckAacademicAcardiacAfrederickAbackstageAscratchedAcurfewAstonedAclankingAmagnusAexitsAmaureenAshanArichardsAbrentAnightclubAsinisterAosmanAgetawayArepAdomeAbyronAfilterBantasiesAcalculationsAswollenAdiapersAjorgeAwhitesAmurdochAsuspicionsAgainingArehearseAskateAmatAcamelAbiologyAelementaryArepeatedAweaverAasteroidAcommunistAerrandsAmixingApredatorsAwalesAcoreyAdocksAcharterApassportsAenvironmentalAburtonAcontemptAgrabsAadsAbarracksAnotoriousAjackassAmachineryBindyAaccountingA110ArahulAdumpingA17thAstrangelyAwhiskyAinterferingAsquawkingAhullA15,000AextensiveAkerryAapartmentsAprivatelyAsailedBhackAantibioticsAphotographyAnkööAbunsA'nAdarwinAhomemadeAbrieflyAskatingAgretchenAcrowdsBonvoyAvoicemailAcowardsAabsentAounceAthugAmiltonAdenseAtappedAreleasingAchristiansAnoelAremotelyApreliminaryAepisodesAcassidyAraftAconsiderateCmfortingAdenialAcrossesAstormsAcommandingAshrieksAinvincibleApearlsAfadAbehavedAvintageAantoineAseparatelyAcontributeAspotlightArottingAclackingAsplittingAgorillaAminaAtysonAmatteredAheadlinesAmaddyAzeusAmanchesterApsychoticAdisturbanceBowagerAjeepAallegationsAregimeAobstaclesAbreedingAe-mailsApactA'knowAdisputeAalvinAsidewalkAathletesAforrestAcalfAdoomAfaxAxenaAernestAginnyAindicationAtoiletsAssAfallonAgreetingAobtainedAmelancholyAcallieAflintAtowersAlentAchimingAswellingApricelessAcollateralAfianceAdoloresBecoratedAcloneAtrudyAphyllisAremovingAgeoffreyAbuggingAcaoAyogurtAcrustAbatterAprototypeBortugueseA500,000AshapesArewardedA98AmumblesAgoatsAwhilstAcardinalAtimothyAzhengAcarrotBlassmatesAinterventionAwell-knownAessayAdungeonAclareAaxAnegotiatingAgrievingAveteranAholtAethicsAvirgilAmuhammadAkarmaAsponsoredApegAmarianneAtaAdarkerAmateoAculturesAlavaAslimAjulienAkiteAunbearableAoswaldAeyebrowsAbabblingAvinnieApasteAdistinguishedAencouragingAvanceAparalyzedAbiancaAzhiAriddleAshortcutCadyArevsAkentuckyAsloanAfishermanAashoreBrrestsAseveredAketchupAtickleAhatingAresolutionAcockyAalternateAloosenApierAscannerAcanvasA--AunreasonableAbrighterAhandkerchiefAfundamentalAbrokerAweighsAcaféAmanipulatedAleonardoAgokuAunderworldAthrustAchowAoutfitsAarguedAlivinAinsecureAgretaAcolumbiaApeasCnelopeAhumiliateAburglarAholaAtensAfadingAbarbAturkAintriguingAfritzAplumberAwristsAsandersAairlineArecruitedApunishingAmacgyverAbouncingAelizaAmcdonaldAseñorAliabilityAnotifiedAfranzAsubmittedAtormentAincompetentAfoamAcombineAsuccessorAoutsiderA's-itAcollectiveAmonthlyA40,000AspidersAjaxAprovokeAbiAignoranceAscansAnellAknoxAtjAlordsAregimentAorphansAratingsApositivelyAlarsAburnerAgradyAbrockAgardenerAdevilsAroyaltyAgracieAtaoAoverrideAcanyonAmeowApublisherAlimbsAexperimentalAphantomAexplodingAblackoutAlistsAstarboardAolgaAreelAshrineAearningApuertoAcohenAweakerAbusesAliableApercentageAsantosAincapableAcomplicationsAstabbingBhatteringAbypassAcassandraAwillinglyAsustainedAbriggsAknightsAplasmaAtremblingApinsAmissusBotivesApowerlessAouAillegallyAnormAoctopusAtuitionAerikaAsuperstarAfrozeAbarrelsAclawAmuslimsAstationedDlinAbeaAsteepAajayAintentionallyAtoughestAdiaperAkaraokeAcounselingAwelcomingAjeArufusAslickAtyingAdotsAsawyerAherbertAmarbleAeileenAbeijingAsqueaksAprettiestAscoldAbrunchAproposingAkittenAjuvenileAlaceyAsmashingArebornAworkoutAalmaAmorseAcristinaAkettleAantAisolationBoveAfascinatedAmafiaAjournalistsAedieAinsectApinkyAsafestAhonorsAvaticanAforestsAcrippleApunksAmopAchetAplatoonAmainlandAscottishAparrotBintAwanderedAconqueredAphillyAnevadaA'emAmeteorAgrilledAcinderellaAmiraAtobiasAequationAplayinAdecencyAclinkingAjudeAremorseAjaimeAbailedAarielAsimplerAdangersAapplyingAdoubtedAsniffBailorsAmonksAalabamaAfrequentlyAand-AbonjourApumpedAfrustrationAproducersAimplyingAhackerAnervouslyAalarmsApeasantAluthorAcostaAurgentlyAstemBpeciallyAhulkAdisrespectfulAconsequenceDfrontedAapprenticeAkendallAvocalAstereoAricardoAspittingAaggressionBwaitingApostponeAhoganAstumbledAthumbsAlabsAmedicArepairedAcolorfulAtrimAex-boyfriendArattleAunawareAdripAchimneyAjulietteA50sAboiledAsnatchedAchillyAsignaturesAflareAbreakupAchampionsAmoustacheAbeinAprotocolsArachaelAthe-AinconvenienceAangusAsinnerAphilippeAtrampAlibbyAinfantCvadedAallanAsecrecyAnovelsAoverheadAadmittingAfrogsBingernailsAdiskAclintBocoAdonatedAexileApoorlyAmagnumAblancheAtenthAfillsAbenderCltsAgutterAsingersAtransmitterAfagAvirtualAdickheadAcommunitiesAschultzAboxerBanAatlantisAbombayAequivalentAhangoverAnorwayAtrumpetAbindAmedicinesAtransformationAamusementAspongeAabductionAuntieAdearlyAexercisesAblindedAdrillingAidleA350AtribalAmistAscrewsAtransactionAheapAflavorsBoreignerAtrespassingAcrackersAprophetAhogAdakotaAtorontoAreaderAconservativeAdisciplesAflankArealizesAuserAfragmentsAhwanAinvadeAmerciAfakedAeliseAtruceAfrancoAstrandedAmetroAcarltonAinstallAxavierAplayfulAthat-AappointmentsAhackingAcrewsArichestAewingAy-youA9thAdameAforgetsAtestifiedApokingAdelusionalAsurfingAtennesseeAveinAmonteAgulfAsubstantialAchopsAwagerAoceansAweeklyAoklahomaAchancellorAtelescopeAshakesAagreeingAparliamentAroutesBevealsAlucilleAspookyAnegroApuffAlootArosemaryAcontagiousAemmettAstampsBwineAretardedAarchitectureAtemperaturesAsquealsAconfinedApartyingAricherAprintingAtashaAswingsBtraightforwardAhuggingAexquisiteAnegotiationAblastingBrothelAtreatmentsAmomentumAfraserBirmlyAbullyingAfarmingAheritageAbulbAcourageousCltAstrangleAbedroomsAcolbyAblaresAgiganticAcrateAstudAmengAupgradeAcaravanAsoyAimmatureAneverthelessAingridAoperatedAcaptionedApendingAaccusationAscooterAtroopAexcessiveA900AmarriagesAbuffetAclearerAappearancesAjoseonAginoAelliottApaybackAacquireAlisbonAhormonesAkatrinaAintruderArevealingAfeminineAmushroomAheavierAdeceptionAfingerprintAprobstAbridgesAstrainingBhovedAbasesAdevAhostingAraysAoregonAbeatriceAkidnapperAmuteAcourtyardAdefyAningAfunctioningAdistinctAtightlyAherbAliarsAsupergirlAexpandingAmalArainyAdefendedBadsArapistAbledAcourierAsuperiorsBookAjodyAcommsAformingAporridgeAhindiAloftAnarcoticsAhyeonAflatterAwarnerAevieApingAwarfareApacketArooftopAmaraAfistsAmartinezAvulgarAcrowsAlabourAveganAklingonAdownloadAkidneysAcainAlindseyApigeonsAvicinityAaddisonAdarylA300,000AuncoveredAtasksAchokedAamigoAoperativeAunderestimatedAshavingAmadonnaAbunAscrapingAreindeerAcommotionAfindingsAdepartAgangstersAfrontierAuniversalAvivAsatellitesAdarlinAunidentifiedAsuffersAharlemAiraAvegaAcalmlyCraAmanifestAgeneralsAwearyBoolAstephAkimberlyAsignificanceAcoursesAshhhAbarberAdiversionBoorwayAexternalAthrillingAgladysAhauntingAsinclairAtropicalApeoplesAxiaAnbspArunawayAaffectingApoirotBrocessedAsquashAgandalfAcarringtonBontestantsAdawgAaxelAf.AbangedAhesitationAmooAcriticismAtastingAdrawersAcondomsAstrategicAcaptiveApublishingArampAcloakAbelieverAragingAtraumaticAcommentatorAmassesA54AsleevesAcurbAemployAcrabsBaribbeanBonsolationAhigh-pitchedAyankeesAdedicationAmendAcabbageAsensorAindustriesAbronxAlimpAconventAmanuscriptAcountdownBlinicalAboomingAjointsAdecorationsAthighsAluciaAmaloneCrgoAfreemanAutmostAmarketsAopposeAswanAzealandAcoopAscholarBweepingAincreasesAtailorArafaelAbundleAdeborahAextractionAforgeArightfulAwaltzAunloadAhamburgerAarroganceAmorrisonAo.AmercifulAinitiallyApersuadedAstoolAeliasAchristyBantAmaineAhardyAwilmaAartifactsArozAtravelledAbaoA88AlizaAmagnetAgenerosityA6,000AconnecticutAterraceAbanishedAdubaiAlillianAspeculationA30sAsuedAcommunicatingAinclinedBdaAstainsAexistingAdoubledAvillainsAl.AclarityAluluAconfirmsAanticipatedAmarathonAcheolAplottingAimmigrationAattendantAmembershipAearliestA'estAneglectedAedmundAbourbonAmournAslipsApitcherA2012AeliminationAchauffeurAmutantAsterlingArocketsApaulineAgroanAicuAstunnedAahmedAloneAdamagesAstantonBeolA53AnavalAkristenAsuvBhamefulApenthouseAbuyersAghettoAworthwhileApeasantsAj.j.AlearnsAhenAv.AsiegeAbatheAdoveAinterviewingBtaliansAgramsApineappleA'ightAoverdoseAradhaAfactoriesAwagnerApaddyAbumpsA57AmoronsAskiingAimmenseAdyeAex-girlfriendAharlanAwandAthesisAsuingArestrainingAsaloonArichmondAnodAstretchedAdemoAcrueltyAmtAseafoodAthumpingAdriftingAshoutedAfrightAvaughnAclarifyAtheodoreAimminentAstitchAdineBeaconAbabylonBlossomAciscoBhalkAritualsAinfirmaryBstanbulAdanishAvotersAtealAscalesA64ApersistentBorscheAdumplingsAthroatsAgenerateApryAtiringAbanditAhebrewAacheAexpiredAboyleAmarleyAinterpolAmarshAdemonicAassassinsAstirringAlakhsAflawAsilasAfuzzyAargentinaAtagsAburglaryBlastedAmockingAcarolynAgeoffAblouseAharnessAgallonsAnipplesAfergusonAdaveyAmeritAenduredA5000AmoraleAtransportedAfarmsAcompetitorsAjudgementAafterlifeAcigarsAduhAcreditsAauraApennAreferencesAdinoAgemAstructuresArodeoAheadlineBicksAmommaAwinkAsuttonA58AdesmondAoverreactingAconvertBrystalsAoxAdiscAmeasuredAhydeAlicenceAprotectorAlikewiseAcertaintyBarveAshankarAoccursAskippingAface-to-faceAwenchAleviAdrainedAmailboxAbowlsAtrumanAskipperBpinalAharassingAbuckleAepidemicApageantAlatteAsculptureAtitansAdwarfAlouisianaAdisguisedAconnectsAdesignatedAweaknessesAstripesAccccccBhungAdinnersAbingAgoonsAdustinArecessAaspectsAliberalAsydApossessionsAinitialsAdespicableAbouquetAjackpotAwormholeAvacantAngAconcludedAshampooBympatheticAchrissyAexploitAtenantAmaiAcleoAmedalsAetcAstarvedAlordshipAspecimenBtabilityAreviewsAunderwayAswitchingAquarterbackApreservedBacoAillinoisAeffectivelyAjoséAentityAbrittanyAenjoysAmabelA'anAassembledAstanfordAhoraceAcocoaAbruiseAmortyAassumptionAshriekingBeminarApredictableAdwellAsupportsAcollisionAkathleenAintuitionAelfAcyrilApostcardAtighterAstupidityAmarquisAcuzAbraggingAplacingAatmAfinishesAcrankApupilAmoralityAgenevaAconstitutionAlt.AabdomenAspacecraftArajuAwithstandAcrippledAgandhiAvinegarAenergeticAyumAprivilegesAscrapeAconsultingBharmsAraisesAallegianceAthighAgerardAhillaryApoliciesAbbcAsundaysAforemanAbut-BooneAramaAbenedictAauroraAspreadsAhikingAdenmarkAcarverAbankingAreceiptsAdescentAexcessAsergeiAhossAprogrammingAcutieAsurgeAcommercialsApropagandaAnunsAabsorbAextinctApushesBittsburghBackagesAyuckAbroadcastingAchocolatesAlizzyAthirteenAbillionaireAaccidentalAeyewitnessAregAorlandoAselfieAarcticAmonAdisconnectedAkimchiAfuryBlexibleArespectfulAauAorgasmAscarletAtendsAplumbingAcatastropheAwebsterAdecorateAslateAnovaAroosterAmermaidAuprightAdetainedAmriAf.b.i.BreewayAprioritiesArightyAi..AsubconsciousAqualifyAinterrogateAvulcanAsurroundAtonicAstallingAnderAanomalyAbollocksAcinnamonApneumoniaAleiAconveyAmaxineAterrainApicardBlazaAmonasteryAietAberriesArinAbaeAtisAslugAmemphisAreadersAanklesAvouchAtypewriterAnortonAamendsA56AbannerAvenomAtheaAathleticAgardnerAassembleAbyungAshakilyAcalculatedA68AsageAnonAintroducingAaliasA'uldAprecautionAvirginityAicedAmarcyAcolombiaAarkAnoodleAcreatorAprospectAdoraAnaggingAgeekAbreak-inAanglesAmortonAhomosexualAchefsAhaleAweepingAnikitaAsittinAdestructiveAsnappingBoakAcometArehearsingAfloraAbambooApolarAwrappingAfacultyAconsumeAimitatesAhypocriteAwhereasAswayAbombedBeachesAdecreeAcolemanCmfortablyAhelicoptersAtariqAprovinceAbeforehandAfrancescaAzoomAsalvageAnarrativeAhamletAinputAentrustedAnaplesApooAmanlyBorningsAimitatingAwontAownershipAmcgarrettAdaytimeArollinAblissAchaeAgreeksAunityAbarrettAswiftApropAalbertoAradioactiveAbiscuitAworkplaceAsneakersAapronAlogoAshelleyAceteraAalasAroverAlightenAprivilegedAislamAcolumbusAgrooveAcubeBhoppingAabnormalAriggsAcheerleaderAunsubAmeditationAgamblerA'cAechoesAamnesiaAlaunchingAbuenosAmercuryAoffenderAzaneAwokenAcompetentAaccountableAkatyAparachuteAintimidatedAhooverAsquidAkaranAglamorousAahnAsamsonAredemptionAslidingAwitsAhazardAsailsBkyeAfluidsArestsAinfamousAbloodshedAx.AcredibilityAjeanneAgardensAtenantsAemergeBdnaAdarrinAholinessAfounderAxueAperpAhitchAoccasionalApronouncedAtapedAwrenchAunwellAnecksAstandbyAroamingAbandageAawarenessAbeauArichesAmelindaApupilsAwookAtransparentAidentitiesAhoffmanAwithdrawalAsorrowsAarsonAuptightAsuperbAbraceAformallyAbashA2016AjudasAremedyAcrawledAgodfatherAprostitutesAsuicidalAtitanicAnadineAscrambledAlitterApreventedActuAupdatedAstatuesArecipesAtuckedBrippingAjoanneAinstructionBgorAgrimAmentioningAretiringAblackmailingAmuffinAwarrantsAmaidsAzacAflatteringAtartAobjectionsAmagistrateBe-AseeksAdryerAattorneysAsnortsAperishAhorrificAcompensateApracticesAundoneAfianceeAparksAaleAshad0AroommatesAmarianAamosAjenningsAsealsAteenAwrongedAhideoutAlowlyAhowieArhodesAsweetnessAalgorithmAlexiAjeremiahAcompelledAbokAkikiAappearingAreneAstrappedApersonalitiesA86A'theAexpansionAsustainAa-AmossAspontaneousAit.AvikingAensignAastridAmalfunctionAfalconAresidueAniggersAmaoAcopiedAbruteAcrudeApartlyAhumourAthelmaAdolphinAhastyAunprecedentedAflashingAsincerityBlammedAcaptioningAflippingAmartiniAsuckersAintensifiesAprobabilityAbasicsAsleighCoaneBaintsAresemblanceAgallagherAasthmaBrtifactBdeleAcaliberAreactionsAheartbrokenAtrustworthyAauthorizationAscratchesAedisonAjetsAkidnappersAmarjorieAhostsAcuffAwiderAreceiverAlaylaAfleeingAbeethovenAcannonsAbeatlesA25thAministersAchristieBracklesApremiereArattlesAchapmanAopponentsAcompellingAdestroysAis-AgiantsAsavannahAprecisionAstashedAferrisAcareersAwinnieAdoucheAcrunchBolderAmozartBaudeAinvestorAexcusedAindicatedAwoo-hooCahAdisposeAnoticesAcomicsAstagedAgreasyApostingBrominentAcowardlyAhostessAguineaAchainedAflawsAreplacingAchaoticCemoAincompleteAdampAyou.AattachBffirmativeAvomitingAcleopatraAmedievalAcontroversialAlinaAdowryAsteroidsAbookingAunniAcrispyAapocalypseAinferiorAdiabetesAcupcakeBirculationAduchessAtameAproductiveAflingAaccessoryBnyaAprosecuteAhmphAignitionAsimulationAaccompaniedAorganizationsAditchedAelevatedAsonyaAprosAoutsidersAhasteAcadillacAnewmanAcambridgeAexplodesAskinnerAbrinkAhildaAspitsAchunkAbirthdaysAarnieAwisconsinBrestleAslyAjanineAthankedAjieAprinterAshooAtrollAloafAmissouriAincreasinglyAdonutsAparamedicsAimprovingAsausagesAastonishingAtitlesAcheesyAgrindingAenthusiasticAhydrogenApiggyAnotchAdumpsterAsurrenderedAobservingAcawingBoolingAwiserAstammeringAbetrayingAtoursA2011AtrendAlapsAannoyAweaselAtravelerAnobelApanamaAoff-screenAagathaAitchAlangleyAbondingAheilAfrequentAcoachingAstrawberriesAgypsyAperformancesAturksAsensedAyikesAabortAsyriaAtakArumoursAbabysittingAfullerAvargasAconvertedAsternAtonguesAescapesApickyAo.r.AunicornAcleanersApillowsAkgbAfinanciallyArhondaAbattalionAprattAmartyrAthresholdAcowboysAdilemmaAsinnersAaimedArejectionApatentAsellerApenetrateAeyeballsApleasesAsentimentAastronautsApaddleAbabysitAsmellyAestimatedAarmoredAuberAdeliberateBisgustAturtlesAfragranceAlenAryderAtemptingArisenBagnarAhaileyAinitiatedAscoutsA---ApikaBrecautionsAoverlyAwelcomedAtorpedoAfinancesAchinatownAbartonAacceptanceAgranAwaterfallAperkinsAspellingBizesAcobbAgoddammitAbeckerAdeckerAguidedAcasuallyAs.h.i.e.l.d.AdarleneAlornaAabbottAstinkyAgovernmentsAcuisineAdependentAcbsAhassleApadsAappealingBmbitionsAsavagesAandersAproceedingsBarticleAbrightestAjeopardyAvanityAoutbreakAguanApcAleftoversAbumperAtreadAdeployedApitsAconcludeApeedAvibratesAseniorsAfieryAstaircaseAmcA2015AdoggyArodriguezAinterveneAnosyAattaboyAwildlifeAparishAinfluencedAstretchingAit-AstuffingAleroyAripperAmorninAxuanAgaleAnevilleAmarvellousAcocksuckerArecruitsAirvingAminersAshitsAcapsBelesteAuncertainAslayAconeAborgAjustineAcomplyBalculateAroastedAprofitableAjosephineAbelongingAchapsAweighingAheedAdaneAwebbAductAhumpAcaviarAeliotAbarcelonaAcupcakesAvikramAadvocateAtarzanAdolphinsAlambertA66AreichAdefinedAprefersAbangkokAdistractingAeverettAchurchesBlassmateBairoAquincyAdalAreactedAbladderAiowaAhumphreyAidealsAvitaminsAsullyBolutionsAabideAregionalAstanceAposingAupcomingA97AparentingAutahAfairiesAbethanyAscreeningAdefensesAprostitutionBlantingAtunesAmanslaughterBodelingAramonaAassignmentsA05AtypicallyA2010AcrocodileAparasiteAmetallicAgrieveAjensenAagitatedAmckayAambushedApokémonArivalsAcravingArabbiAtingBaiwanAführerAspectacleAresistingAtoleranceAnessAgomezAe5e5e5AcannedAraidedAimmigrantsApresentingAcliffordAsurgeriesArefugeeCmarksAoverdueAsquatAwahAmildredAjewelleryAscreensAcrichtonAramseyAlesserApumpsAbikiniAperformerAemergedAvibesAwendellAdeliveriesAburyingAdustyAteammatesAchingAsakuraAdownhillAamirAmandatoryAoralAminnesotaAconditioningAvaletAuncoverAyeoAprobableAopsAlassBorettaBairAdedicateAforgivingAetaAreefAisraeliA23rdApollsAcorneredAmessesAtrivialAboardedAformidableAserpentApensiveAinjectedAfusionAexaggeratingAneuralAmelvinAlayoutAconfiscatedAnecessityAlawsonAimpulsiveAsectionsApetraAsteeleAnapkinAryuAhousewifeAvitalsAtroublesomeApepAdesiredAcircumstanceAjamaicaAdescribingAlettuceBonesomeAhollerAsurvivesAlupinAprosperityBaoloArevolverAabbeyAorganizingAfactorsAprescribedAhybridAconcealAjethroAoyArepliedAcirclingAheadphonesAstrugglesBíA3000Ain-lawsAroAmosqueAviableApicassoAhawaiianAkirstenAcharleneAhooksAexchangedAmarcosAdepartedA140AdimensionsAfiberAmemorizeAcorruptedAintimacyAsaturnAcocktailsAremyAcaloriesAmonitorsAiotAwell-beingAlast-minuteAtalibanAbrothAgarfieldAcrowleyAracialAimposeAmadeleineAaustriaAheroineAcriticAreluctantAmassachusettsAwalkinAcrispAmanagesAtornadoAdistributeAhumAdictionaryAappliesAfloodingAmaskedAgrapeAsnoopingApetersAwh-whatAshadesAyokoArobberiesAintersectionAcontaminatedAorderlyAimplantAcorporationsAbrewAspanApleasuresAripleyAshakyAbennetAqueueAshelvesApicklesAgrumpyAlacksAcovertAsatisfyingAphilippinesAbrazilianAcecilApoojaAconventionalAfiA2013ArentingAbubbaArohanAsankAdomainAlurkingAdirectingAforgaveAone-wayAconductorAspenceBolelyAdimAratingAcommenceAfoldedAsubpoenaAgentsA69AshortageApeppersAboundsAruthieAcoasterAwedAlengthsAdynastyAopiumAcheekyAfurthermoreAdialingAbenjiAidioticAslidesAnightfallA8,000AgeumAisolateAreviveAconstructedA92AmoniqueAshredAmilitiaAtofuAsegmentAleaksAtempAsixteenAcolleenAslammingBenorAhashAinspectAtangledAimpressionsAthriveAleopardAantonyAexpressingApopularityAarchivesBmpAbouncedAenzoAvaluedAapplicationsAslopeAhissesAleverA2008AterminatedAshortyAmcqueenAvoodooAyerAsupportersBimultaneouslyAhuggedAsupplierAdickieAclutchBablesA67AlelandAalejandroBidanArenoAcarmichaelAarrayAwraithAeditingAweighedAsinnedAodinArevenueAadjournedAsuppressAreyesAconvictionsDceivedAabsorbedAfayeAsparklingAtigersAorsonAdoughnutsAw-whatAramenAsemenAacAbrutallyAcomposedAtellyApenniesAtacosArhymesAinterceptedAreunitedAcynicalAtreacherousAfundraiserBartsAblur1AfrigginAconstanceBandaceBriticizeApikachuAseymourAxanderAsexualityAemilioAfadedBracturedAme.AcompanionsApenguinAtrajectoryAgrenadesAoystersAbombersAvoyagerAxingArandomlyAcomfyAattackerAkiddinAseducedAeddyArepentAindulgeAmodifiedBartianApragueAlimitationsAautomobileAevolveAdonationsApermitsBartingAsteaksAtitoAanjaliA62AoffspringAtacoAsurroundingsAmergerAstenchDpfatherAjustifiedAuploadAfiddleAnewbornAroxyAsladeBensationalApitchingAmysticalAsuzyAbalancedBorrowingAoprahAcrackerAeighteenAthreatensAj.d.AintercourseCsensitiveA02AxieAboltsBabesAdinozzoAbeamsAlickingAsettlesAunclearAstarringAtwenty-fiveAguruAextraterrestrialBvacuatedBcstasyAtacticAinsignificantAthingyAcrunchingBheAmineralAunstoppableAefficiencyArossiAorangesAbigfootBentleyAlunchtimeAassignAraspberryAmemorableAfoeBlavourArewriteAquackAluredAhunkBomecomingAadmirableAjacketsAalpsAgroveAeducationalAmoralsAitchyAsaunaAlighthouseApropsAvigilanteAmaneuverAdrummerAcredibleAsurgeonsAflickAdemiseAkenyaAcompositionAbelgiumAacuteAstockingsA61AmanningAukraineAyοuBvonneArootingAcoachesAscroogeAbathsApipAinsistingApupAgalaAdecoyAblaineAalzheimerAtrenchAgrandchildAramirezAhmmmAtomasAheaterA40sAspartacusApeepAdialedAsdhA93AcongregationAvladimirAscrollAmalibuAbentonAlynchArefinedAphenomenalAblamesAoutrageAelectronicsAabandoningAtellerAdownsAreciteAjogAelvesAtonesAleilaAscoobyAinjectAdairyAicyAawardedAteslaAboogieAinterpretationAwestonAstickerAdireAassessAcontainmentAaweAshaolinAgiovanniAaccountedAimprisonmentA63AstewieAconcealedAbandagesAsparrowA59AindictmentCternshipAsedativeBhiftedAgloomyAsquadronAmurdockAjarvisAsermonAirritatingAempty-handedAathenaAvitoArevelationAverticalAberryAyeah.AlastingAmoduleAwarmedAfourteenAakiraAhandshakeArefereeAcutestAdsAhallucinationsAscoldedAfrickinApractiseAomerAperiodsAsurnameAcrankyAsportingAairborneAeligibleAindoorsAwindshieldAjoinsAsilentlyAcreativityAintimidatingAkyotoAenviousAfreightAlaysAgodzillaAupdatesAvoluntarilyAfiremanAhungarianAvictoriousAappointAmccarthyAneedyAinvitationsApreachAalarmedAprejudiceAresentmentAcircuitsBastroAoutlawAtillyAcubsAgestapoAeminenceAcredentialsAgyuAmonumentAhansonAcompetitorAtittiesAmadlyCcyAauspiciousAschneiderAparanormalAmanorAeroticAcobraAscanningApoweredAfaultsAathensAtalbotAraylanAwi-fiAfittedAadvantagesA130AsovietsAoffshoreAbuddhistAcapitolAmerchantsApawAsnowingAkleinAyukiAsarcasticApoeticAendangeredAnavigateAthermalA'haraAunpackBsersAnathanielApatronAlimAbessAanalystAperezAcontainingAportableArotationApartedAbookstoreAattendanceApraisedAalfieAmischiefAdigsAperpetratorAextinctionAjumperAmarlonBinnieAunnaturalAtemptAvelvetAcasketAfirewoodAhoundAdesAaidenAchillingAhopkinsAliteraryBottaAmandarinAajAscreechesAjournalismAultrasoundAshahAteamworkAbruisedAchronicAhookingAroccoAirsA2001AdumbassApuzzlesAspelledAdresserAcprAhanaAdaftAupholdAdemocraticAcoordinateAslaterAmediterraneanAfailuresApancakeAseventeenAadvancesAethicalAreceivesAinfluentialAone-on-oneAcheyenneBreepingBatastrophicAsonicApursuedAhippieAmechanicsA2014AinitiateAfirearmsAjaceAabusiveAdetonatorAcradleAarabsAkittAempathyAtabletsAgeunBibberishAturdAoutdoorsAlotusAirrationalAtrekAexposingCaggerateAmexicansAtendencyAalexandraAslicesAmaintainedAalphahffAguaranteesAeclipseAmastermindAanalyzedA81AafarAgearsAtavernAdelilahAplatterAhardshipAencryptedAinvestmentsAdeceivingAmurphAsolicitorA'mmaAparanoiaAdiscloseAstatisticsAcockpitAsundownAprisonsAantennaAhariAcooperatingAexamplesAdesperationAaccustomedAboarAsmuggleAcomponentsAtranslatorAordealAcertifiedAoutnumberedAbmwAmooseArelentlessAagingA160AkmAlaceAmontrealAsidekickBhoresAflemingAguidingAsergioAprevailAimmortalityAdepositionAcanteenAwhinniesAnetworksBickedAlabelsAhighlightAinsultsAboulevardAmariAintriguedAgigiAdebraAliverpoolApurityAdorkAomegaAcrooksArecruitingAledgerAblacksAfirefighterAdoughnutAself-esteemAorganisedAmatildaAstarterAbackwardAexhaustAhangarAnorwegianAbudsArefundA87AwailsArainedAlampsArepresentationBandolphAnellieAtskAcoulsonAbeadsAproducesCincesAcaryAvelocityAspeechlessAfurnaceAwitchcraftA96AintensityAdeclinedAhookersAinsertAhobbsApuppetsAsphereAavatarAeveningsAlouisaBeighAeverlastingBxaminerAbertieAlifelongAsookieAnayArupaulAfitnessAoutrunAeduardoAcardboardBeciliaAnominatedAmaestroAhrAcockroachAshiftingApedalBanelsAsmugBtargateApadreAunclesAtransferringBitA82ApensAledgeArationsAmarciaAosakaAragsAbryantAstrangestAquarryAmeyerAconfrontationApoliticallyAenglishmanAleelaAdefectAbendingAglitterAdeportedAcentersAgilesAcameramanAbasilAlanternAdudleyAclinkAdeployApersianAsneezeAteensApipelineAchuteAoccupyAcesarA78AtranslatedAstaredAclocksA1,200AgoddamnedAoutdoorAboilerAreversedAprematureArsApeaAmiddle-agedAlilithAratioAonstageAcapabilitiesAduaneBownloadedAbodyguardsAflyerAserversAmarrowAcaretakerAsalimAkimmyApjAcompatibleAmashAwinchesterAprizesAamendmentAwiselyAthakurBabsAkaA2017AriotsAproudlyAresearchingAnominationAmarriesBenaceArelyingAbulletinApawsAspookedAliaisonAhavocAbullsAvermontAbungalowAqiuAzivaAstrengthenAcurlyA24-hourAviolateArequirementsAmicahAdisobeyAmonstrousAsyntheticAplumAbulletproofAstand-upArvAcomponentAanticipateAwgbhAearringAslicedArefillCcognisedAallergyAwretchAhonouredAcuddleAnooseAbudgeArenownedAstrokesAcrumbsAdiscoveringAworfBipingAreaperAauditionsAsightingsAbrightonAcontestantAfranchiseArestedAhugsAadmirerAburstingCAcoralAinstitutionsAsowAbrusselsAweedsAembeddedAautomatedArescheduleAperuAtemporalArewardsApandaBearsonAbaldwinAtilesAcounterfeitAformalityAeyesightAbathroomsAeditAdavyAruralAunexpectedlyAresurrectionAnativesA1945AtapsAcomAsupervisionBeeminglyAbrotherhoodAmarylandCchoAwilburAdishonestAsikAhupAstealthAexteriorApanickingAretardApissesAfreudAcondemnArevoltAallergiesAelectromagneticAlineupAsoakingAopposingAdaviesAsylvesterApillarAvividAariseAsuzieAtrinityApyramidsAbruisingAcriticsCatesAshitholeAcomprehendBagesAsuburbsAwafflesAcontrastAannouncingAviewingAfucked-upAmarginAprovisionsAiconAadjustedAmelbourneApiercedAdreadAneighsAomeletAiqBcelandAclamAfunctionalAspiralAfracturesAcallinAadjustmentAtwilightAlecturesAamuletAbattlingArailsAmicheleAkilometresAwatermelonAtentsAchicoDrpsAbribesAfortunesAbulliesAobedientAunavailableAcoxAhorriblyAdetourAfoleyAthrottleAcluelessApoolsAgunpowderAstepmotherAmannixAequalityAbarkerAluciusBianAwirelessAfishermenBraternityAmamAboobAsupAw.AslashAhostelAimportedAkeAertuğrulAsmuggledAgogglesAdisregardAmeltsAforebodingAcommandedAintendsAhagAsqueezedAdirkAsalsaAbabuAedibleAaerialAgalaxiesAloweredAfollow-upAinvestingAwrapsAinvitesAwindyAlooAclingAblossomsAreviewedAnorrisApitchedBlasterBashaAneglectAextortionAinteractAregrettedAcontainersApodcastAapplaudAdon`tAtroutAmistyAslimeAairplanesAfossilAbronzeA2009AtightenAhedgeApatrolsAinterpretAtuAlamAaccordinglyAversionsAcraterAlotionAspectrumAremovalAparcelAreconApalmsAgrailAdepotAclatterAslowedAthinnerAgermsAmunichAgraphicAseaweedAmuddyAsovereignAnamingAmoonsAcoloniesApodsAfeatAshootersAadolfAcroresAlucienAbucketsAoh.AdougieAtitusAhandbagAfencesAcrumbleAlovinAdescendAmosquitoApresidencyAambroseAremarkAwhatnotAstainedAdentAgoldfishAcarpenterApeteyA12,000AdinaAseldomAelleAmichaelsAglitchAbankruptcyAyes.Afirst-classAacceptsAmiraculousAgelAcooperativeAright-handAcheonAinconvenientAalexaAretainAdiarrheaAshamanAmathematicsAcoveAspicesAexaminingAsmurfAalligatorAvousAhobbiesAwhooshAmaintainingA30thAprincetonArhythmicAdeclarationAmuttersAsuppliedAridersAcoBuckooAbarrenAfractionAcumAtangoAbummerAeverestAmergeAlockeAheads-upAstockholmBolitudeAcornyAliftsAdothAunemploymentAdepositsAzipperAinfiltrateBmmoralAdefenderApluckBhilosopherAdeviAemmyAmercerCmorizedAtyrantAboboAkiloAgoofyAflapAcaineAyoungstersAdublinAneroAtoothpasteAdroughtAreservesAcaramelAdixieAracismAhatunAdevelopmentsCmentiaAtweetAwellingtonAdistinctionAfearfulAposseArs.AdominantAfrequenciesAconstructAnorthwestAwarsawAdartArescuingAswearingAmmm-mmmAtoasterAplantationAzonesAgaugeArubbleAhumsAcavityAobstructionAabyssAmangoAstatAmammaAjinglingAmarleneAvoice-overAunsolvedAdetonateAsheridanAcubBleanseAsuspenseAalvarezAkylieAiconicAmeasuringAadoredBppreciatesAhansenAmoroccoAtamaraAeducateAscalpAcalmedAsaudiAlunarAfryingAblurAramsayAatomAyoo-hooAwallpaperAregionsAfolderAminorityAstackedAcashierA2004AtoadAcomparingApolesAconcentratedAquitsAwagonsAprofessionallyAfargoAvitaminAsecondlyAadmirationAstablesAeccentricAwhackedAstreamingAmoiraAgiggleAbetaAjacquelineAchumpAhoaxAspringfieldAdecisiveA2006AdonutAcateringAinfrastructureAknow-AroxanneAillusionsAa.j.AmyersAconwayAphotographedAbreachedAmidAbreakerAredeemAdominiqueAlyonAchantAscrewdriverAintercomAtextbookAshaltBaeAcologneAblokesAknow.ApesosAsizzlingAwindingAintimidateAhaydenAvinciAfattyAalbumsAknucklesAcarvingAforemostAgraduatingAsenselessAprohibitedAunseenAdescendedAtrashedAdifferAbaghdadCdgesAleylaApartiallyAniaAexceptionsA2020AfestiveAangelicaAtemplesAdisneylandBescendantsAc.j.ArowanAnortheastAboundaryAsensingAwhinesAyouseAattachmentAinteractionAemptiedAwhimAnauseousAoffendersAhivAwheeAemilAliteralAaubreyAknobAfitzgeraldAcucumberAyou-youAorganisationAconfidentialityAmedicationsAjackedAblushAdecayA2005AassassinateArankingAopenerAsylvieAweaveAresourceAlegionAhoratioAincorrectAcacklingAsnarlsAfowlerAunlimitedAwiringAgoodwillAskatesAtransitAbrutalityAhiveAallegedlyAindexAmashedAencouragementAvideotapeAjinxAmilligramsA91AdisruptAancestorAkatyaAorganismAiifeAenlistedApeeledAdescribesAbracesAtrophiesAcraziestBontinuousAraquelAhubertAloggedAstatingAfunkAengagingArecordingsAdiverAjeopardizeAwildlyAsparksAlaunderingAbosomAdecoratingAaccommodateAflashesAprosecutorsAlonnieAenriqueAinvestigativeAlasagnaAtrailsBhatsAmeatballsAyatesAabdulAhelperApauloAskullsAunsettlingAt.j.ApenguinsAgarthAbritneyAscholarsAmanpowerAhiroAweddedAunderpantsAreflectedAmeasurementsAipAtadAsyringeAnonstopAarchAcasingArustApapiAmanufacturingAsloganAjianAbuggedAstraightenedAeltonAoverlookedApengAbrigadeA250,000AexplorationAleisureAstrengthsAminimalAfulfillingAoneselfAsteinAnagAspreeAluisaAreceptionistAjoggingAdeclanAuploadedAembracedAdimitriAtruthfulAdeliaAregainedAstaleAmascotAdryingAmoistAdevlinAshushApeersAfreshenAbubblingAcarmineAsonjaAassistantsAimperativeArecognizesAsiobhanBhiveringAbig-timeAsketchesArehearsalsAclamsAsensitivityAnbcAartworkAernestoAmelonAtwatAsnifflingApfftAsweeterAcold-bloodedAbogusApluggedAedwinAdartsBealingsAgeorgesAkelseyAmatingAirresistibleAdecksAminiatureBooneyArodrigoAnemoAespressoAhairdresserA'malleyAmanagersAcallenA1ch008733f0AthickerAbulkAgeorginaAsymbolicAreleasesAjpAcathedralAdisgustedAbellamyA2,500AfratA2003AsicilyAdoormanAedoAcartoonsAbattingAsuperstitiousAdisadvantageAconsumptionAspeedsArevoirCsumesAmountedAcruiserAexclusivelyA60,000AdeeksAraphaelAmarkingsAstumbleAcushionAblueprintsAretailA03AoverlookAsuffocatingAgravelAflamingAvictorianAshouldaAweightsAlivestockAterrenceApollutionAintrudeAunwantedAbrewsterAtechnicianAslumberA10-4Avs.AduplicateApoeAdominateAobnoxiousAice-creamAliberatedAneighingApremA2018AhanginArubbedAcolumnsAmoleculesApremiumAfootprintAkyuAchewedAmyeongAdictateA84AmilAblazingAtransmitAitchingAposhAchevyAhettyAsuspendAxianAbindingAdinahAnashvilleAballisticsAdiplomaA1980AwhisperedAgarrisonAolegAtileAmuttAverbalA'm-AredheadAparAfuneralsAbuckleyBlackedAcraveAspillingArodsAgenieAdoublesAprogressiveAritchieAcheungAidsAsociallyAdraftedAthumpAirinaAdieselAfascistAtruthsApasAmutantsBarchedAdepartmentsArussoAchillsAintrusionAdeityAleedsAasherBaAsaddamAobligationsAgunmanAspouseBinglesAviolatingAinterrogatedAachillesAslappingAproportionAhadesAsecretiveApolitelyAhiltonAenchantedAcharacteristicsAreassuringAflyersAawakenAfutileBluffyAchumAbusinessmenAquantityAu.AsouthwestApleadingAbeautiesAwiggleAtattooedAemirAcover-upAterminateAresearchersAforecastAactivelyAtaggedAgamingBrinAdamianAclipsAwreckageAresembleAquestionableAknockoutAzakAbribedAshiteAfleaAwas-AgroverAbumsAabdominalAomApinpointBantryAlargelyAmanipulatingAdeliversAunrealAterriAjacobsAfirepowerAderrickClusionAroyceAchicAdispatchedAjarsAbridalAimproviseAsuperficialAmisplacedA24thAannetteAluciousAshitheadAliceA'lAexpectationAzuluArefrainAwrestlerAjabAhopperA04AhavanaAquotAcurrentsAstirredBixtyAcollaborationAoutletAshuttersBkirtsAresultedAstrungAreopenAdoubtingAcaffeineApreachingAdonâAflushedAsacrificingAclusterBouidA89Ahalf-hourA2002AexorcismAreactingAmasteredAoysterAcorkApornoBhdBeeingAmosquitoesBeowsAsortaAhabitatAgraffitiAprestigiousAapieceAfunniestAprocessionAyonderAgreenhouseArelicAboredomAconcubineAnicolaAyöurAdistributedAinquiriesAdistractionsAshaAprovokedAdamagingAtransporterArueA360AintensiveArenderAgaggingAreevesAmuffinsAlowellAframesBloAsuitcasesAjaviAsharpeA‫‫AreclaimAunreliableAziggyAwhimsicalApavilionAtestifyingAmarblesAfirstlyAnovakAfragmentAnippleAaddictsApromotingAcsiAwithdrawnAexecutivesApornographyAgalsAsalemAballroomAimmigrantAsaundersAraccoonAheinousAsymptomAanandBwakenedAregardedBaoAgradAsteamedAalfredoAsapAjerichoAshayApouchAjockeyAgatewayAmentalityAcrownedAbiopsyAprotestingAstuffyAbomBeakAswamAescobarAreubenAchemistAdefendantsAparticipatingAblackmailedAheadmasterAobscureAatomsAimplantsAadiosAursulaAsleeperBhareholdersArudolphAoriginsAatmosphericBpacheAgrowlAvolleyballAadequateAgurglingAcallahanBoncentratingAhinduAmustangA50-50Athis-AguillermoA2007AsqueezingBeizuresAwebberAchubbyAamateursAcharadeAjawsAbundyAmoodyAsanityAladenAacknowledgedAparsonsAthreadsArespectfullyAbratsAarabiaAspleenAdecorationA22ndAnileA7,000AzehraApizzasAalfAbbA1.5AjockApreoccupiedAgluedAcorrectionsArobbyBecreateAconcludesAachievementsAmurderousAtackyAplainsAencountersAtrembleAcommApicturedAlicensedAreasoningAthineArobynA73AconquestAschemesAinhabitantsBdentifyingAspinachAamarApantherAleftoverAsedanAgoldmanAhandlerAintellectAhardshipsAprotestsAhomieAwintersAtanakaAprueAswitchesArepublicansAtrenchesAelbowsAvolcanicAoutputAhorsepowerAcosmosAzenAsalivaArohitAdisabilityAalphabetAvolunteeringAunleashAantarcticaApilesAolivesArepresentativesAdreamerAthorntonApiAlinenAbleachAwittyAdelusionsAcdcBosmoAdeemedAprescottAdaiAfumesApittAhollisBigh-endAisaiahAannabelleArenderedApepeBaydayAlatchAelevatorsAachingAorientationAtotoAzorroAhamsterApolishedAwildestAtesticlesAislamicAdrasticAbredBerkeleyAwhippingAskunkAupstateAinternsAfungusBeliciaAdictatorAstriveAbondedAsykesApeachesAgivinAconvertibleArobesAsalvatoreApreferenceAdunkAlokiAchariotApainkillersAhospitalizedAtyrannyApretendsAcircumstantialAsnailAnohAlaverneAinventorArethinkAconsidersAblanksAunfamiliarArobertaA1985AplungeAwhicheverAstingsAthe-theAlensesBucAaideAsquirtAwilkesAsleepoverApostponedAweirdestAuraniumAexperimentingAbackseatAdunnAblushingAnavigationApollAalistairAowensAprospectsAcursingBellularApatsyAcerebralBanoeCmelotAtrunksAkathrynAincenseApandemicAomenAassassinatedApavementA1989AcelestialAbernadetteAdishwasherApansAneptuneAfischerAnerdsAcliffsAhomeyArobbinsAwimpAcontactingAp.d.A94AwillardAsharmaAowningArimAsyndicateBponsorsAduckyAforfeitAcapabilityAunfaithfulAmomoApyleAjohnnieAchristianityAwoofAthaAscorpionAfloatsBaAknackAinsidesAlinusAemergenciesAalertedAfeudAskinsAjoyfulA1999AhealerAleaArockedAswimmerAproceedingAdumpsAtaintedBorpedoesAsuctionAarturoA76AquotaAchongAmicroscopeAwhirsAtakeoffApresumablyAgiraffeAstairwellAgreensAexaggeratedAspunAluxuriousAsightingAfudgeApersuasiveCndantAtreasuryApandoraAverifiedAstungAjeonAcompassionateAdigitsAportugalAarrangingAcontinuouslyAmanufacturerAjoanieBaneyAbrewingAcarefreeAstylishAolsenBperativesAwhatchaAnikoAbriefedAuncommonAmapleAgriffithAadjustingAharassAuterusAlauAmustafaAirregularAstabilizeAjumpyAreflectsAsqueakAelisaAimbecileAurgencyAzappingAnapkinsAruckusAtamAsodAwhiteyApinchedAsetbackAthatcherAjun.AholderAgabiAkittensAdiversAhijackedAblinkingBeneficialAsweeneyAremarkablyAblindsAculinaryBhimeAsarcasmAcheaterAemersonAclangsAdungBramaticallyBelaneyAgainsAsissyAadventurousAmoralesAspoonsAzhongAgoodbyesAfertilityApunctureAnicolasAmanipulationAabusingAcasperAplutoBroximityAdiscussionsAmuckAgabyAhandicappedAcomboAmetropolisAtriumphantAbowelAkoreansAcutterAthankfullyAportfolioBupsAjonnyAanalAenhanceAshatterBcatterAveteransAundoubtedlyAimportAflatsAlynetteAthornAgrown-upsAcooingCnflictsAwelshAsparkleAmortalsAtriggersAbravelyAinsulinAadaptedAdramafeverAtransportingAsprungAincisionAparalysisAmotherfuckinAastrayAriftAlandonAregulationAsearchesAhilaryAshabbyAdangerouslyAalliedAtexApoloAskeletonsAarcadeAshaggyAweakestAgruesomeCeerAnonethelessAsororityAtendernessAlasersAparametersAmoanAbourneAholedAdesigningAsnortingAlullabyAphenomenaAmm-mmmApatrioticAcaptainsAbedsideApostureAmidgetAponiesAinsuredAquApinocchioAbuilderAundressedAnipAmaddoxAsuperstitionAconsulateAstylesAhyeongAgeniusesAnetsAstarlingAmohammedAhuoAcamillaAgoodmanAachesApharaohAfurryAserkanAandréAdarbyAstretcherAlakesAheathAtorsoApulpBosedAfangsAnoblesAgillianAestebanAanatomyArecyclingAclimaxAjejuAgaiusAmolecularA12-year-oldAseasonedAclauseApuddleAdistinctiveAweakenedAsackedAplaintiffAassailantAmoistureAdivertAritesAmotorbikeAcasualtyAlistingAspoilingAflawlessBatigueAmarkersAunforgivableAluckiestAgospelCliathAtwistingAshovingAinterfaceAsheppardAdissolveAprofessorsAaskinAhypothesisBammeredAkeatonAbrunetteBurritoAerrorsAbravestArapperAfishesAdisableAflopAanticipationAgravitationalAbirminghamAtarAwolfeAmeltdownAjimboAexplanationsAharmfulAelusiveAdistressedAsquirrelsAmutinyAapbAtamperedAfarrellArowsAtravelersAfinerAedaApurposelyBarasitesAcrazierBlotApresidentsAdiscoveriesAexpressionsAduskAsalvadorAtοA83AramboAfelonAcontributedAbowmanAharassedAuptownAprestigeAenjoyableAbrawlAsquaredAnicholsAmattieAcostingAthornsAfairnessAquieterAblacksmithAraulAshangAchileAskepticalApetalsAindebtedAdemocratsAbelgianAmortArunnersAicebergAgeezerAfirearmAbloomingAwateringAcyberAoverratedAfrannyAmessiahAsewersAingeniousAcloudyAabcAespionageAfibersAinfantryAtossingAgenreAselinaAmarnieAintentionalAalyssaAduffyAoperatesAt-shirtsAsuperheroesAguidoAfongArachAobsceneAdevoteAbowsAjugAspikesAlockhartAd.j.AbeggarsArenewAflourishAtollingAmarkingAsoutheastAeelApenanceAspoilsAbeginningsAshaoAoleAmarianaAcoyoteAanimationAdisciplinaryAswearsAkarinAfertileBashionedApranksAinfraredAwrinklesAnauseaAeyeballAsignorAcharlestonAmuggedAcheckpointAbradfordBienAnumberedAgardeningAmainstreamAresultingAwilderAunderageAcharcoalAdeputiesAhoveringArecitalAbelindaAslanderAunleashedAlalaAslimyAclariceAsumsBhowcaseAfarmhouseAdivisionsAmeddlingAandreiAdisgracedA77AadmiringAclampAvowedAwyomingAdalyAcrockettAwhiffAperilAconsAsortingArightlyAwheezingAsiblingAmeddleAbahAkristinAherbalArumourAgoldieAconfinementArighteousnessAmaternityAcorrespondenceArestraintAapprehendedBdmitsApatriotAmanuAbacksideAjoysAhunCmilityAolafAburstsAshuffleAwedgeAexpandedAhit-and-runAflawedAluigiAmatrixAscrapsAmarlaAwattsBoongAprecedentA'm-aAannaliseAmagicallyAright.AfrenchmanA2019AfrançoisApickledAconcertsAhallucinatingAvinnyAgracefulAcasteAgenesisAblimeyAmindingArestrictionsAcaucasianCmilaBommunistsAlodgedAsoothingAmiranAplaqueAgrandkidsAradiosAcentimetersAseparatingAviolentlyA1944AeurekaAnukeAyearningAdisarmAbirdieAtrixieAhampshireAconnorsAtreacheryAcockroachesAselmaAgoonAwernerAzapAjanieAgrissomBeographyAamuseAtiaAearthlyAhorrorsAgranddadAfoolishnessAaluminumAtoxAresearcherApascalAflappingAbrushedAstoopAretributionAblastsAtownsendArebuiltApreventingAafterwardAfaintlyAscarceAtranceAsatisfactoryAmonitoredAunnecessarilyAicingAvladAhurtfulAknittingAdeprivedAroundedAmarxAlunchesAblindlyAsummersAoverloadAcatalogAbevAsummonsAo.j.AmpAuncertaintyAlibrarianAverminAjammingAhowlsAprojectorAbradshawApharmaceuticalAfeministAmoyaAblazeAorionAplannerAintakeAcyanideA1997AraniAlaiAcharitableAsaigonAdessertsAâªAqualificationsAwidelyA3dApaintsAmoonshineA'dayAmichaelaAcrampAkaliAgeneticallyAnatoAlukaAbraceletsAzeynepAnickiAbummedAexhaleAwaldenAprimarilyAsquaresAbowieAreganAfirsthandAold-schoolAjohanAlatterAereAperceiveAchuckyAesteemedAreviewingAproneAravingAkhalilBermitAdigestAyearbookAperksAdistinguishAcontroversyAbusanAgeneratedAalexandriaAtestamentAporAguidesAnbaAlickedAbudapestAkwanAstreamsAoverrunAsonarAdisconnectA1500AlsnApearAashokAtoriAchamberlainBamouflageA1998Aback-upAattractsArosterAhaulingAclarksonAdriftedAruizAurnAmaritalAasgardAtimberAgallonAoh-ohApestAaloudAgeAfleetingAstilesAcamdenArejoiceAneighborhoodsAmikaAeaglesAhoudiniA450AfetusAhardcoreAdorianAseagullsBacksAliberationAbarefootAsiberiaAaccomplicesAmaríaAfrictionAewwAthreesomeA71AshrekAundressAmiladyAlistenerAweirderAjapsA06AvinAhoovesAoutsAschedulesAhorrifyingApoohDfAl-AkelsoAcontributionsAjuddAangelinaAfaultyAkipAdisastrousAbloodlineApotteryAhurrayAscannedAlyraAbrandsAinvadingAdefinitiveAentertainedAdrugstoreAturmoilByresAbumpyAstingyApowAoverdoAdocumentedAronnyApreppedAcaAauditAone-timeA105AdignifiedAunbornAstockingAcnnAofflineAremarriedAobligatedAaddressingAhodginsAgrumblingAdumbestAbaptizedAshikAegyptiansAshepardAcodedAdesignersAsamirAmercenaryAdioxideArumbleAfrownAshagAplausibleAspecsAbackboneAairesAintroAdefenselessAoaklandEeyApotentAmanufactureCrvelAdiggerAcomposerAswipeAdiplomatBadaAguildAtransactionsAmilkyAlandladyAexercisingAcubesAunharmedAahjussiArubenAprojectionAoverthrowArapingAeconomicsAreapAgoodwinAdetectionApricksAmagdaApencilsAcontemporaryAunderwoodArefersAhuckAviAfamineAsuperviseAlingerieAmaternalAbiffAoreAchanelAindifferentAposesAcrossroadsBopyingAsmearAcopingAtraumatizedAstructuralAmoranAestAsybilAguiBesturesAbankersAjocelynAgapsA150,000AluncheonAdeniesAtamilAscoringAmccallA07AswarmAleavinAdescendantAplacementAclingingAstrawsAdockingAbearerAvikingsAreconstructionAapesAserAmayonnaiseAbaliAradiantAmingleAendingsA'andAcruisingAinfiltratedAdavenportAanguishAufosAreboundAmythologyAgoldbergAbrushingApostmortemA125AheaveAbottledAmajesticAlivelihoodAbhaiAromanoBugbyAemptinessAdepositedAlocketAcatfishAq.AballotAoppressionAcollapsingAdoggieAcelloAblondieAduoApresentlyAhygieneAkendraAbeetleAduesApatioAaccordAparagraphAfingertipsAaerynAoutpostAconfirmingAbonfireAsofterAmikiAdisobeyedAsorcererAorbAthrivingAswellsAninoAdisposedA1990AwarningsAharmonAfundedAabiAbitternessAspecificsAunmarriedAbuffAscalpelAbroccoliAnearerAconsumerAhernandezAraidsAamesAundermineAdrinkerAactivistAhintsAadvancingAjerkingAintestinesAfelipeAwhineAunbelievablyAcunninghamAencryptionAgyeongAmiscarriageAcaponeAfoldingAcupidAbjornAwhizAdevourAmaverickAdiscomfortAlawfulAhardingAboomerBrutusAfatimaAdiscriminationAhostilityAticklesApyoAmackenzieAscrambleAekgAtissuesAmindedBasculineAashaAsgt.AdisplayedAaffectionateAhelmAsvenAjtAbutsAambientAoatmealAirritatedAconsultationAjournalsAalimonyAviolationsAdonorsAphysicistAcommissionedClombianAbambiAmendozaBarloweAcleansAgigsAstokesAwhooshesAazizAvendingAspatAgalacticaArespiratoryAfirmsAsufficeAdiversityAtrillingAhatefulAtraitsAaresArungAdelegationAsalineAunworthyAextrasAunfitAifyouApressuredAruseAmaliciousAincAdepartingAsergeAuhmApiercingAcontractedAanthemAvpArichardsonAnobilityAaxlAsimAdurationAbeverageAcurlAjfkAbargainingAmoundAfretAyolandaApubertyAstompAcylinderBonsultedAvuBelmaAwinslowAhumblyAgeeseAaccuracyBwolAlaoBobeAdrenchedAhistorianAleaguesAetiquetteAcapturingAsimmsAchordAmohanAwonderfullyAspookAobligeAbagelAorgyAdciAfashionableApreposterousAribbonsAi--iAtyroneApleasingAgrainsAnegligenceAescortedAappallingAslainAreplicaA80,000AspinsAavengersAflashyAstarshipAterritoriesAglamourAconditionerAappealsAgallowsApegasusAderangedAcarrollAringoAjurorsAbuggyAspadesAreyAgodfreyAhelmetsBarpAtailingBhat-thatAgaysAsophomoreAgrubAutilityAnianBamasteAinterpreterAhotshotAfrauA28thAantiquesAcostelloAzeldaAadamantAbarnabyAheoAgrangerAanesthesiaAlendingAventsAsiegfriedAvulturesAresistedAflusteredAdisagreementAconstantineAshillingsAe.r.ApunAandiAbumpingAaccuratelyDessedAbriannaAdisastersAjosefAvoluntaryBirginsAmuseAgemsAstaminaAhecticAforbesAyawnsAcrotchAandromedaAvivaAmentionsAdominatedAvernAassumptionsAtoleratedAproblematicAunusuallyAanalyzingAmaceApsychedAkemalBryptonAlarsonAdellaAi-itAclemAadulteryAfoundingAenforceAchargerAtroupeArothAteriAprescribeAfranticAslowsAvictoriesAjdAincentiveAtroublemakerAgeneratorsAteeAretainerAevaluateAcaroleAfalloutAhonoluluAfrenzyAbrowniesBord0AarchiveAtrolleyAciderAbart.AtouchdownAdrainingAtraineeBoryAscriptsAresourcefulAlong-distanceApledgedArougeBehabilitationAjaffaAanuAsilvaAreillyAinformingAmarshmallowsA08AtransmittedAresidentialAhardworkingAabstractAm.e.BainframeAbrandtAinquireAtuxAsteadilyAlabeledA1942AhowlAsinksAformalitiesAdemolitionAaaaahAstraightawayAtouchyAstickersBentencingArationAblindfoldAteachingsAnoonaAguntherAbonerAadvertisementAplatinumAakbarArandAmiaoArudderAfunnierAparticipationAfayAhypnosisBonkAraoulApredicamentAhelgaAjodieAclassicsAmanhoodAflairAlonerAinhaleAventilationAaudiencesAcollegesAstagingAbooingAah-haApretentiousAmothAhologramAarsenalAreliveAquoAdependedAgollyAdialectAmanufacturedA74AcdsAbullockA1988AhorsebackAcaldwellA16-year-oldAreductionAheleneAtabithaAjonesyAhamptonAgustavAsodiumAmargieAunhealthyAbachAvendorAferociousAarmourAboltonAmeeraAyorkshireAcherriesAunannouncedAenlightenedAairlockAbahamasAmickyAdeploymentAcovidAbygonesAacquittedAwaltersApatchesAsignificantlyAmyrtleAconfessingApagerAdisciplinedAoverseeAwieldAmeadowAforgeryA'aAunanimousAsinatraAplayboyAnewtAreconcileAbodilyBermudaAconceiveBassetteBeceAdaxAnellyAclichéAmercenariesAscramAoutskirtsAunrelatedAearpAresemblesAcactusAgramAbakersAcontrollerAsociopathAfrancescoAresponsesAdroidAstrategiesArikerAschemingAbuchananAwithdrewAscrubbingAhamburgAdisqualifiedAcheatsBertificatesAbottomsAnataliaAadjustmentsAgrimmAaccess.wgbh.orgAbotAvocabularyAinterruptionAsexistAmorallyAbarlowAvineAthorneAstuntsBhrapnelBabotagedAhypotheticalAtalkerAhoodieAl`mAeiffelAnebraskaAconnerAunprofessionalAkegAstalkBedatedAindefinitelyAfreyaAcrusadeAnighttimeAreassureAoff-limitsAgavelBeetaAputinAbrainwashedA1994AwashesAaquariumBftAlanesAbarriersAobsessiveAtormentedAcleanupAhodgesAstumpApick-upAaryanAmareAfiendAtoxinAmathematicalAgrampsAdmvAcomplexionAheavyweightAcollectsAgillAentrepreneurAblenderAsaxonAvolatileAhutchAactressesAupwardsAsterileCretchesAiraqiAentrustAtalismanAointmentAsquawksAhealsAclashAinjectionsCdigenousArestorationAcopenhagenAdarnellA1968A007AisisAwhoopAsanjayAcursesBollectorsAedinburghAdashingAashtrayBdministrativeAu.s.a.AdavidsonAsledAfugitivesAsabineAdemonstratedAengineeredAmillyAfirefightersAyeeAtuxedoBrillionAperceivedAconstitutionalAimplyAenhancedAx-raysAshimBtupidestAregroupAcreedAaccomplishmentAexplosiveskullAsimplestBprinkleAmortimerAvirtuousAcheckupAlucrativeAwipesAdrummingA1969AuprisingAhondaAparticipatedAchugAadministratorAtraceyArewardingAassistingAhealthierAfinAbessieAripsAm.o.AcommandersAmm.Bix-upAbegsAmurielAheartbreakAreinsAcoffeesApossessesAlitersAcbiAidahoAczechAraveAgahApoetsAleanneAfictionalBramingApattiAadvertiseBrseholeAcompletionAvealAredoAobedienceAcharlyAtediousAswappedAhoytAdickensAcoronationAwaiAedgyAmeticulousAharbourAcapitalismAjerkyAevidentlyAcommonlyAunsafeAbleakAstakeoutAodAgrudgesAdisclosureAmouthingAspeculateAmyraAgroovyAunwillingAderAworldlyAhitchcockAshushingAdeceitAonwardsAdazzlingAstephensBacramentoAr2ApreppingCoctorAmichelangeloAstripsBelenaAlylaBireAexpelAswungAlingerAviperAblueberryAyouâAstunAmutationA2.5AkabirAbelieversArestrainAhurleyAsucceedsAcjAruiAgertrudeAbuckinghamAanyplaceAvacationsAlemonsAbikerAvirtuesAcarrAimpulsesAacousticAregentAtimidAadministerAoptimismAgalloAbilboAstarvationAenterprisesAtoxinsAdingingAtempoAfeAvibrationsAtightsAclanksAbelievableApassionsAcotAfry0AchaoAwatkinsAsmoothieAexhaustionAjan.AoddlyAselflessAnumber-oneAguessesA1984AvacateAprosperousAdegenerateCtectingAsaucerApietroAhammeringAexploitedA1970ArappingAlumberAindonesiaAquotesAwrongsAdensityAarkansasA'connorAptsdAthrustersAcoworkersA09AauthorizeAmitAdidiAkelAsuffocateAbrandedAreflexAoskarAprosecutedAfriendshipsAchunksAunsureAriteAlennoxAwhitmanAdestroyerArelicsBiddenAhorridAsturdyAcapt.AdiscouragedAromaAmhmApussBaramedicAclapsAsariAimplicationsAwaldoAboilsAmanuallyAproposalsAussAchuanAmortalityAbinocularsAairfieldAlaurentAperformersA1941AparentalAcrematedAimitateAhallowedAreasonablyAmixerAbarricadeAunauthorizedAlackedAerraticAaromaAprosperAdobbsAsuccessionBkywalkerApianistAcedricAlsdAhungaryAfrx0AtheatricalAaviApeacockAinvalidAbiasAfencingAcarcassAbrandiAtuningAvaderAsprayedBhredsAlyinAiranianAalohaAconorAadiAweissAhandcuffedAreflexesAmagnitudeAall-timeAfanfareAcyclesAarleneAstudiosBesameAfoilBendAblurryAstatuteApilAwaryAt.c.AessexAmathsApassiveAfungA1992AundeadAtankerAmansonAvibrantAdosesAstrikerAfinlandAheartacheAsolemnlyAturbulenceAwiAkisserAbuttersAhoopsAandroidAresidencyAdandyAuntouchedAhingesAz.AmediocreAsriAriddlesAgastonAcircularBheeseburgerAsrjanapalaAhallucinationAcortezAezekielAchoreographyApreventsAinstallationApetersburgAgookAinfinityAlovebirdsAmakeoverCckeyAlemAherbieAcherishedBareyAhatchetAanastasiaBuntsAbidderAnineteenAyahooAtemplarAanakinBbbotAuhtredAtransfersAceremoniesApussiesBriscillaAvialAslabAromaniaAmultiplyAjeanieAayaAtraderAadlerAfiskAexecutionerAsheeshAoriginatedAstigAit-itAtouringAgregorAnicAmisguidedA1996AryeAlesbiansAoh-hoArigidAdramasAmortarAcalvesAoversightAstagBcannersAguardiansAbrosAaccordanceAtrojanA27thAakaAtajAsinfulBlurpingAmailmanAgriffAcompletingAproceedsAfertilizerAcomptonAjaguarAsequelAfarceAdispositionAandieApakistaniBilgrimageAfull-onAsparkyAjoyousAengravedAcrumblingAjunctionA1987AwaltonAupbringingAhellerAfrontalBamAtugAsnipersApasoAcivilizationsAhoopAdumAgammaAelisabethAdehydratedA1995AunderstatementAleft-handedAoutlineAeaterArogApicAwronglyAunjustAhiccupsAfrailAtrooperAbaptistAexiledAheartbreakingAfreshlyBinancingAscottieAalarmingAearthquakesAdunhamAhootingAmunnaAquirkyAnitrogenAeditedAodorAlecterAfriggingAenableAjillianAhubAfreighterDelanceCancoisAgodmotherAcriteriaAstampedArinkBadiatorAacquaintancesAcorleoneAyousArinseAevictedA79AfuhrerAstormedAprincessesAconsiderablyAturnoutArenounceAweakenAjamesonAsubjectedBchmuckApainlessAendlesslyBxcludedAvalentinaAstrainedAatlasArefreshAkowalskiAzedAmuscularAfyiAreligionsAmakersAcylonAarousedAbcAsmileyAyouthfulAancestralBirlinesAblizzardApeekingAscoldingArupturedAmarketplaceAtheoreticalAyakuzaAoutgoingAalbaAimpeccableAsenBnoreAmcclaneAladyshipAduboisAbraunAemergingArobertsonApervertedAmilwaukeeAwankerAinvadersAbristolAappsApagedAearningsAtwinkleAjoongAu.n.AqiaoArakeAaustrianCdibleApoursAsheikhApointyAlamarAchitteringBamperAsurrealAcappuccinoAset-upAtippingApredictionBatelAdosageAriddanceAmindsetAenlightenAportsAshowdownBpecializedAkatoAfussingAconsistsAafloatA170AnormandyAosborneAteammateAstraussAliliAjohannaAwatchmanAamusedArosenAlandryAenvelopesAsymphonyAknickersAlinkingAjeanetteAhoppingA1986AsheaAbeaumontArouletteAmistookAkillinAnflAguidelinesAdippedAaugustusAlennonAcaptivityAbulbsAaccommodationAindividuallyAfoundationsAgustavoAemileAaccessibleAsilencedAundergoAgilliganAsplashesCankAgagsAself-destructAmedallionAruoAintoxicatedAcullenAarloAvaguelyAperjuryAsmokerAclose-upApushyAtakeoverBullyAsurrogateAlazarusA400,000AabbieAloonyAkinkyAariaAhartleyAboobyAyumiAcholesterolAfloodsAmidwifeAdragoAtradesAmarvAswabAcluckingAdefaultAunforgettableAscarierAmusterAsoftballAinevitablyAbuildersAcasseroleBouldaAunnoticedAjodiAvaleAdiabeticAbeirutAseekerAunfoldAcouponApatronsAknitAanewAlorryAtonyaAcouncilmanAhastAassuranceArabiesAappendixAputtinAsheltersAnot-AstatsAlailaAcrampedAmanipulativeAsettingsAconnedAplightAsitterArebuildingAsubstancesAwrenApreviewArecalledAmeghanAheartyBusseinAfleasCaresAdormantAalmondAsmugglerAfuturesArenaissanceAkooAloanedAbetchaAlowlifeAwreckingAzacharyAgenocideAaldoApurgeAlakshmiAfavoursAdewAsuperpowersAindyAdiagnosticAvineyardAjellyfishAcustomaryAgeminiAxunArebootAsandalsApriorsAdroolingAmiddayAdodgyAnikolaiAitineraryAlemmeAsympathizeAcouponsAinspirationalAforwardsAnawAlegislationAzaraArenewedAtransmittingAcarlsonAkangarooAhenrikAcartmanArivalryAwindsorAattireAsatoAfellowshipAarteriesAlaurenceAcastlesAbrochureAsoftenA's-eyeArotateBightfullyApodiumAguvAabundanceArankedAcrestAethnicAbretAsketchyAromeroAveerAinvaluableAgunnarAoutingAgreetedAhomesickAwinesAsr.AquotingAkarimAimpliedAamazinglyAstokedAclickedAtelegraphAerectionAtechnologicalAseparatesAkapoorAmodestyAinfectAboltedAdiplomacyAyankAsuperpowerAlukasAskateboardArooApatchedAconversionAslashedAhemingwayAabsAtobinAhortonAwhat-whatAromanianAearnsAarmoryAsenileAmargueriteAvaluablesAkappaAcoilCmmonwealthAwavedAtrifleAhigh-schoolAextractedAdistancesAzurichAimplementAzodiacAsubmissionAghastlyApleadedAgangaAsmacksAreuniteAduetAcalmingAslingAhomageAscenariosApiledAinflictedAoutlawsAabruptlyAcongoAstate-of-the-artArockfordAinventionsAharemA96,460AbasketsAcomplicateAturboAparticipantsAdownfallArecAbidsA220AphotographersAhormoneAgovernAacceleratorApeabodyAsneezesAupgradedAfalselyAbleatingAjojoAheadlightsBard-onAcecileApersonaAgohanA1950sAtyreAlakhAcognacAviewedAringtoneAstressingAmurmursAunthinkableAplowAmammalsAcassiusAassistedAcommodoreAupsetsAsitaA9-1-1AweptAteenyAsprayingBlapsAashtonA1991AfilmmakerAaneurysmArequirementAhandicapAdaoAupliftingApeckAjennieAself-respectApresumedAmuellerAinterferedAendeavorAulcerAscoutingAdottieAtutoringAheraAcivilisationAhigh-techAfartingAspecialistsAimagingAhydraAstrippersArattledAmeritsAdumb-assAwitnessingAdroolAcommerceAticksAsprainedBhootinAfergusAbrowAtowedAsaiApoweringAwaffleApraisesAtransAclansAbarbariansAfoursAcrucifiedBincinnatiBoppersAmysteriouslyAassaultingCaAgeronimoAdiscardedAcostlyAevidentAhuanBearingsAbowelsAlockwoodAivoryAenduranceAhonourableApacesAtruthfullyAbriberyAtractionAseatbeltBaddestAoppressedAlike-AcitizenshipAbiblicalArebelliousAvortexBestedAimitationAvenezuelaAfrankyAeisenhowerAtracingAreservoirAtransfusionAmaggotsA'itAdoryAsightedAhueyBomoAdiscoversAcreamyBolossalAenvoyAswiftlyAregistryAalignedBishaAslugsAlikenessAbailingAdescendingAmetropolitanAobserverAdecipherAswoopArhinoAdiverseAfaithfullyAadviserAgrantsAsuspectingAfactionAsamaritanAgodspeedAexceptionallyAsteinerAdefectiveAmailedAtwistsAlavenderAcommentaryAsmackingAcrummyAafrican-americanAproportionsBilingAclockworkAsoarApelvisAstallionAfiremenAcontractorsAdeservingAinformerAplankAhermioneBancockAorchardAkonoAsnowmanAcadetAgiorgioAmishaAgilmoreAmissionaryBedicinalAcatholicsAbruvAevolvingAmouthfulAsuzukiBtrideBo-AanomaliesAdismissalAgrammarArespondsApacketsAfulfilAawakeningBuschwitzAplutoniumAgarethAdeokApattonAshamAcancelingAprairieAmikhailAnationwideAchildbirthAbleedsAacesAunethicalAroscoeAstewardAphrasesAhootAgraftAmoriartyA1982AhorizontalBighlightsA1979AwatchinAvasquezAraiAprocessesAscapegoatAreplicateAinboundAnegotiatedAsuburbanAneoAdevisedAmarshaAendangerAchopsticksAbroodingAdetainAcustardAfussyAdenisAhaystackAacquisitionAquadrantAblancaAmuseumsAcoltonAequityAdesirableAcorneliusAsimilaritiesAmackerelA26thAworshippedAgasesAscariestAcromwellAlimousineAinfectiousAgulpsA15-year-oldAtakeoutAintrudersAhurrahAfortnightAmythsAerenAinstructAwoeAdrillsArehearsedAdentonAbillboardAhawkeyeAcockingAmotionsAenlightenmentAcidAberthaAriveraAcordsApollenAmarcieAfetishApillarsAdurantBeliriousArealitiesAimpliesAvigilantAthrillerAcheerleadersAspearsAmanhuntAgrazieAexportAcasinosAemiliaAhoppedAnetflixAbourgeoisAparvatiAruggedA1993AinterrogatingAhuntsCmanitarianAslobBeatingAertugrulAillegitimateAsaturdaysAindecentCcompetenceAan5AornamentsAkarevAelsieAdunbarAbiggieBashedAshreddedBcumbagsA750ArafeApressuresAsnagAbrightlyAkensiAbookieAjurorAvendettaAscreenplayAderbyAtranscriptAshort-termApeerAstompingAhemorrhageAmcbrideAfeaturedAwashroomAo2AcrimsonApottyBavelAcasingsAoutdatedAelopeAbatteredAjebAblackieAdelaysAukrainianAjudicialAdrunkardAmariusAcurvesAlaszloAagreeableAforyouAnostalgicAlongedAhareAcharismaApayneAnon-stopAtantrumAcalciumAsheffieldAtrippA1972AspikedApayoffAtorchesAurgesAsantoApostmanAcarriersCiAsnappyAhauntsAclippedAvinesAn-noAswimsuitAboxersApeaksAsocialistAinscriptionAdetonationAjbAtrespassAlingeringAcleansingA2021AmorbidAbetteAmerrickAindictedAsoxAaladdinAmtvAomahaAjunkyardAisobelAkingdomsAvogelAcommendAparadoxAmanureAsulkingAdanversAmatrimonyAspoiltBhortestAauggieAtroopersAdeviousAcooledAalfonsoAsummaryApublicationAfullestAseeinAcomplicationAaveAsproutsAmakAhamburgersAcatalinaArollinsAginsengAtumbleBaelsApractisingAstatureAninjasAobservationsAhoroscopeAforumAretaliationAhitchedAcasanovaAbossyAcol.AseasoningAtiltAmarisaAenergiesAsojuAdumbledoreAmadhuAclonesAminerAsuffocatedBtaggeringAhomicidesAfeebleBabianAembracingAinhumanAshoweredAneutralizeAbuckyAarunAorganiseAlawsuitsAwilcoxArejectingAgunningBrootAhypeAbaronessApastureAlifelineAsettlersBandsAlovableAtop-secretAinitiationAdeveloperAcutlerAbonnetAquaintAsalazarAinlandAagricultureAnarrowedAmayhemAeternallyAtechnologiesBramBimedApaparazziAtibetAlearnerAshivBmittyAplugsAnewportAcamsAunionsAreckoningAinnovationAfoAheirloomAexplorerAbopBeheadedAthrashAkingstonAofferingsAvibrationAridleyAcollierAdelicacyAweaponryApathologistAdredgeAsuhAinsomniaA1940AhairstyleAascendAgarretArevokedApainfullyAlestAcatcherAeditorialAklingonsAvicarAshantiAtheatersAhiroshiAadversaryAeatinAamazeAkeatingAchiuAavalancheAtypedAmauraAhumaneAforksAenduringAattentiveAgarmentAdibsAshekharAcheesecakeAthievingAkenjiAfootingAricaAmillimeterAcrownsAregularsAversesAmnh-mnhAsabbathAmanilaAlistenersAstabilizedAhysteriaAcommandantAstarbuckAunspeakableAevenlyAibrahimAhauledAlockupAmi6A29thAhondoAcrunchyBhilledAb.a.AalbanyAcoconutsAvegetaAreginaldAboulderCastAcomfortsAtapingAkaplanAzebraAmaturityAdeclaringAreconnaissanceAglasgowAsnobAcompromisingAslayerArestartAdissolvedAincriminatingAendorsementAunrestAtardisAsteamingAradishAfernAdrummondAfarawayAcrazinessAruntAa-haAprogressingCudentAhenriettaAsplitsAdevinA1983AetherealAconsistentlyAmenacingAbunniesAversaAsleeplessAreal-lifeAdraperAmetalsApatientlyAchainsawAmischievousAhendrixAsnuffAludwigAfollyAconfideAarthritisAdeliAshootingsAwake-upAtuesdaysArenovationAleopoldAspeckBwordsmanAdrunksAafghanAkosherAtackAon.AwonderlandAinterviewerAgreat-grandfatherAlarkinAeyelidsAlimaAortizAleanedAheinrichAapAwarheadAco-workersAbookerAtrollsAperishedAobi-wanAandreasA1ch00b889f9AwillsAcornellAahjummaAmeenaAcheckmateBamelsAtelAsnotAolympusAsuppressedApakAchippedAfeaturingAbelfastAheartfeltAesmeAtidesAcolonAdrinkinAtamperingAelectAtensedAretreatingAcuddyAunimaginableAmuratAwalkersAvansAtotemAwondrousApersuasionAhorrifiedAstitchedAwileyAherringAreactsAzhanAinuyashaAstarbucksApatteringAlate-nightAblindingAn.AgoblinAcontaminationAwouidAjuvieAchiefsApalateAdellAcopycatBhaptersAgwangAprotestersBicketAklinkAvancouverArochelleAmitzvahAsidelinesAisleAdoreenA1975AwillaAhikaruAatoneAcryinAsubordinateAone-manAconsecutiveAdownrightAuninvitedAreproduceAoblivionAestablishingAcompactAscrapedApippaAcherAquickestAcharismaticArecollectionAsayidAemeraldAwinningsAtraitAextravagantAbanterAmeteoriteAinexperiencedAbrBiasedBendsAwin-winAspAdamascusAstrippingAballardArésuméAcharmedBompetitionsBastilloAselvesAgageAtrioAwigsAregrettingAnorfolkAgiselleAtrampledAspongebobAirmaAcodAnewarkAabominationAfloristAciAstrainsAneonA240AmannAjuicesAhensAtribunalAritzAauxiliaryApossumAcolonialAbatonAorganismsAinformalAclinksApearceAdionAbloodstreamAdreamyAsingularAaggravatedAshrinkingAkobeAdarlingsAmashaAshunAprofilesAcylonsBosmeticsArebirthAployAindoorAgallantAfdaAnassauAboosterAcatchyAyusufAimplicatedAone-nightAdriscollAblindfoldedAobsoleteAmussoliniAconciergeAmotorcyclesAwalletsAstacksArecipientAtyrellAduanAchanningAnikiAbobbieAsocketBneakedAindicatingA1978AideologyAgopalAdodgingAcontinentsAfaucetA'tisAstarrAgordoArecommendationsAcortexAaccessoriesAnarutoAfringeAstrapsAtelephonedAdoverAcelineAblindnessAdesksAmilkshakeAstaresAmordorBasterchefApioneerAhustlerAcurtAmeselfAadministeredApolygraphA17-year-oldAupside-downApaganAsuicidesAhardenedAranaAkesslerAgainesAlandmarkAbaptismAsubspaceAinabilityAdiameterCstraughtAproxyAdocumentationAmidwestAcannabisAnutrientsAmimicsAcabinsAmossadAivarApavedAelectricianAmugsAarcAgourmetAsadisticArewindApokedAidolsAdodgersAatrocitiesAvaliantAsurajBputteringAchordsAahoyArepulsiveAjunkiesAfirewallAdisposableBasAcabinetsAdoorknobAmavisArockefellerAimpostorAmacbethAcollapsesAbioAhendricksAkaiserAwellerApalestineAhiroshimaAearnestAslumAlumpsAbathedAvolcanoesApooleAgrimesAcentauriAbeiAconvenientlyAjoaquinAdisgracefulAcasaAspartanAprehistoricAavocadoBdrianaAswampedAconfessionsAretrievedAmolestedAracerAgoodiesAboraAmegaAgullibleApeiAulyssesApistolsCcsAnewbieAcontractionsAresslerAcapitalistAyodaAinseparableAbernsteinAnotificationAbrigConsonBearingsA1973AdownsideAcorrespondentAtsunamiAfastenAmigraineAvisitationAlollipopAtijuanaAcartsAsnickersAleukemiaAmalaysiaAvoilaAfragrantAextraditionAmeditateAcorrectionAfatesAsweatshirtAapplaudsAtidalAsyncedBhogunAkananAdroidsA‐iAjell-oA1967AalanaAcountrymenAshacklesAconspiredBaressAlineageApressesAmisjudgedAyogiAimpotentAhomicidalAwhatsAbanishAlassieAindigestionAwannabeAintrudingAoutrightAnightingaleArepeatsAapprehendAreducingAmcgillAradAcultivateAjinglesAeruptionAtransmissionsAshowtimeApilarAifsAkaoruAdefeatingApredecessorAtradersAspecimensBhocksAmoiArefusalAquanAunderlyingAlocallyAkamalAfloresAdisperseAhagenAkyokoAformerlyAapparatusAcorridorsAbitchingApotassiumAiastAolivierApowderedCodleAmandateAsensualAlifelessAgucciAtortoiseCppedAhoundsArichterAhead-onAgrandeAforsakenAalainAmantleAarchbishopAsunbaeAairportsAsshAmushAipadAgalleyAcoopedAfatedAwerewolvesAmacdonaldAcmAenlistAguptaAconclusiveAhypocrisyAnewlywedsAultraAspecializeAprof.AunravelAoverreactedAporcelainAcoordinatedAadoresArematchAchaperoneButerAguttedAfrostingAnegotiatorAdarlaAcourtingBheerleadingAincarceratedAprovidenceBlotsAday-to-dayBealershipAfakesAangrilyAsupporterBilviaAriverdaleAshapingAilliterateAtiniestAsewnAgiaAlorelaiAbig-assBenefactorAagriculturalAdippingApeggedAimposedArowingAnuttyAboloAhesitatedAcoffinsAhatchedAprakashAcraftyArestoringAbubblyAkincaidAdannoAmomentarilyAjumboAfridaysAaddictiveA's-thatAdanglingApromptlyBenetratedAla-laAvirusesAseverAgoghAneighboringAholdupAexhalingCcellenceApokemonAlunaticsAelviraAchallengerA'argoAevictionAgunpointAuniAoracleAmacheteAkelvinAinsiderCdestructibleAblueprintApintsAmindlessAreconnectAprontoBennilessAfeistyAsteedA1200ApluckedBastriesAflorrickAsolaceAprotestantAconsumingAstormyAhypnotizedAceasedAalbuquerqueAfloatedApoisonsAtuvokAof-AbarbarianAjanaAheraldAbuttocksAneurologicalAmethaneAcontrabandAobeyedAigniteAcoastalBlienteleAdeathbedAreinstatedA1960AmckenzieAbroadsAsameerBchwartzArevoltingAcampfireAunimportantAspeedyAachievingAwasherAunexplainedAjohnsAwhomeverApiaAlikelihoodAclaryAsmokeyAinsanelyAcaliArattedAkneelingAneatlyAkeiAlabyrinthAgeneticsA0hAhowellBandymanAremnantsAjudgmentalAizzieBnflictAbreatherBloatedAplayoffsAimposterAunkindAenslavedBllyAcalculatingAburgundyAsewageArepairingAbelliesAsnoopAcacklesAorchidAsouvenirsAeavesdroppingAworld-classAswallowingBpectatorsAhottieBearstAtallestAgraduatesAcoalitionAmacaroniAkingsleyAgarlandAdistinctlyAbrillianceBestowedAringerApreparesAfathomAconsistencyAmineralsAbasinApompousAiongAgenevieveAleninAum-ArepaidAliaAdebatingAgirlyAcelebrationsAblockadeAno-goodAseriousnessA1970sAogreAmockeryAdivaAwolAcipherAgiddyAbarbaricArootedAarmandoAiookAgallAhouseworkAsandroAdominationAbeseechAspecialsBcarredAj.t.AgoreAroadblockAhumidityAceremonialAferdinandAcrampsAalonzoBrmandApairedAricanAprizedAjukeboxAchirpAwilloughbyAcallumAbruhAjerAunheardAtopicsAsenatorsAecstaticAfidelAtatianaAbeadArembrandtAdonatingAphelpsAmargaritaAenrolledAniangAlockersAhamptonsAgaribaldiAboutiqueAmammyAyeastAprostateAmysticAjiuAtestosteroneAjanisAc.i.a.AwidowsAtrinaAmalariaAjarodAornamentAcanopyAweaklyAstimulatingBhyamAinsolentAquantitiesAflushingAco2AmayoAramblingAlebanonAbutcheredAfabricatedAmaltAgumballAeunuchA103B963AreliedAbrushesAsauronAfascinationAreinforcedAdetectorsAtheoristsAmercilessAsecuringAoverruledAnectarAcoincidencesAmillion-dollarAextraterrestrialsArulersAportraitsAhackersAanarchyAnoveltyAatfAsereneAexploredAsluttyApercivalAcloverBoloringAramosBookAimprovementsAmunAcrosbyAmahadevAwilhelmAchinoAmenusAloomisAharringtonAcanaryAtoledoAcarnageAryoAlizardsAexceededArevivedAsweatersAokay.AmillenniumAbridesmaidAsmackedAravineAbordenAviewerAcontingencyAstewardessAmoodsAlashAkarlaAloatheAwickA'weApepsiAlancelotAbarrowAimposingAprovincialAadoAimplantedAblandAeleganceApaternityAdonnellyAcovenAracedAhooperAsidingAfestivitiesAtwenty-fourAheh-hehAscrutinyAmartAgiuseppeAsobApolAmutilatedArelishA1980sAreincarnationCd-handedApuffsAuphillAtrailingAdwellingAgymnasticsAanestheticAconstructiveAphilosophicalAdodgedAuntrueAmastAgenitalsAcryptAwritingsAnuggetsAxiuAp.s.BostcardsAvulnerabilityAsupplyingBcrapesA1943AtalonBerminationApatrollingAbreathtakingAampleAstutteringAcusterAbreathedAlucindaAshutdownAraggedAfearsomeAalpAlagAernstArailingAcomplimentaryAweirAmiddletonAjudahAaccomplishmentsAmisconductAdelgadoAtaliaAsublimeAglacierAaffidavitAsmallpoxAurgedAinnovativeAhollowayAnearingA70,000AstartleApraisingAfabioAnutritionAgrizzlyAdidntAhubbyAdiligenceAgingerbreadAcalcuttaAboxedAdrivinAcarlisleAfijiAeganAvariablesAmasturbateAcanisterAburbankAcivicAsordidAfrontsBorthcomingAdekeAplottedAgleeAwidespreadAballisticAnovelistAthank-youAbarredAkyraAaccelerateAyee-hawAcorinneAalrightyAratedAmjAsamiAluceAjekyllAborderlineAhigh-profileAgunnedAenabledAultimatumAstayinBimplicityAuntouchableAcollectionsAbrilliantlyAnostrilsAbartlettAtrainersAmokAdrapesAalexeiAl.a.p.d.AconceptionAantoniaBarghAmariahAhiccupAequationsAbehavesBagginsAtcAdelawareAclarissaAstylistBiouxAhesitatingApuckAhesitantAlaytonAdispatcherAvaAbogAhard-workingAunpaidAoperatorsAinnocentsAniagaraAfavoredApeelingAbrethrenAattaAscrubbedArockinAplainlyAloweAairspaceAscootAgringoAprojectedAcandiceAsurferBtrandBkisAproviderA'onnAcognitiveApedophileAclangAmalloyAflossAdespisedAslipperAroarkeAlimboAflaggedAviolaAtombsAgoodyAswallowsAbernardoAsqueakyAwarwickAtiBenureApalermoAdictatorshipAchateauAbarclayAanusAmulesAlucianoA.38Aman-madeAcourt-martialA1947AimageryA14-year-oldAbritsAmaliceAlewAjayneAbedfordAhotchAlancasterAtallyAvisibilityAsweepsAramyeonApervAdisplaysAbyulBergerAnigeriaAahmadApostalAharmonicaAtendenciesAseasideApsycheBerfectedAmowAcomediansAminivanCmicBeinAhaitiAminorsAcaterpillarAyoungsterAskylerAroboticAmeatballAconvictsClumboAhitterAanimatedAhimmlerAattractingAshepArealizationAairwayAyearnArabidAtungAresideAgirlieAcambodiaAfrightensAchandraArechargeAenchantingAnehaAautographsAvalvesArealtorAconanBlubhouseAbertramAinadequateAfluentA1960sAsinanAgypsiesAfollowerArushesAakiAcacheAoverflowingAalternativesAlecturingAyorkerAkimbleAglazeAdumplingAstatenArelaxationAnever-endingAtalkativeAbombingsAkiranAcrosswordAannouncementsAelectrocutedAflutterAimproperAdetachedAcalamityApaintersAliviaAextendsAtherapeuticAwackyAelmerApremierAcrocodilesAsolidarityA1965AtoroAmoderateApenitentiaryAmigrationAstepdadAwalnutAfalconeAoffensesAwouldaAlafayetteAadvisingAsmugglersAtendingAenjoymentAgeometryAconesDduitAbarbedAmagsAentrancesAdaycareAraisinsA1974AsolvesAescortingAvalleysAmondaysAcahillAsippingAnephewsAlightweightAaryaAcommodityAdummiesAballerinaApretextAjakobAaramAretchingAprescriptionsAkunApulmonaryAdelegatesAthursdaysAmaneuversA1939AevolutionaryAconcedeAattainAokinawaAceleryAlambsAhazardousAeloiseAdesolateAbrazenApersecutionAcolouredAperpetualAviagraAkristinaAhawksAinspiresAfavorableAtheoreticallyAgrinderAfiascoAcowardiceAwaitersAinternallyAdefinesAcurlsAvisionaryAopheliaAjean-lucAhadleyAbroochAretaliateAvincenzoAthamesAcashedAnuAsimbaBtoreroomAresilientApetrifiedAgadgetsAsewedAextraordinarilyAmedicallyAhathawayAfiltersAdrainsBatAoccultAltdAhpdAtwigAoopAmelancholicAhippiesAlushAresistantAitâAshiroAchouAsanctionedAwastelandAtragicallyApoopedBharmacistAghostbustersAevadeAwildeAcommuteAbickeringArafaAmildlyAgraniteAplanetaryAunorthodoxAchaiAstartinAmarshmallowAoccurringAboldlyAconceptsAresigningAmarseilleAbackgroundsAcommitsEuneAdyedAcoyAwitherAstalledAhyungnimAberserkAabodeAslopesAoverlookingAmedinaArascalsAhermannAemployersAstrifeAburgessAstimulateApresleyAmotorsAlifeguardAtoastedArestraintsBisottoAacceleratingAdistributorAhousekeepingAdarrellAhemorrhagingAcriticizedBommunionAteasedAshinjiApatriceAcomprehensiveAludicrousAinduceAresidesAportionsAbeginnerAgroomingAfilipinoAcalculationAhamishAcontradictBheeredAsuppliersAchaplinAsafariAdvdsAprimalAshipmentsAresidualAfunnelBlakesAsquadsArestrainedAglareAcommunismBampaignsAsmallvilleApussycatAeseAchimpAboopAmotivateAfanciedAterminatorAdevelopsAcramAimploreArowdyAnachosAforeplayCggyAadelaideAmeowingAbouncyAmicroscopicAinfluencesA104AunloadingCofficialAswipedApeepingAskidBcubaAflipsAslidAeggplantAfightinAdrilledAkazAbouncerA1966AprentissAtrotAsherwoodArainesAmaudAterritorialApepperoniAbobbiAstallsAmarkusAyulAmmmmAcadeAauditioningAtampaAfieldingAhonoringBigh-speedArentsAyarnAfreezesAlannisterArefAwhorehouseBe-weAtinklingA'ilAflaskAcatalogueArepercussionsAaddyAfanciesAkieranAdolAcabeAgritAcarpetsAsurplusAkendrickAecosystemAdisordersAaspenA1964AacceleratedAleoneAharmingAfanaticAcoletteAwilkinsAcordeliaAundAshootoutAnainaAbagelsAgreenwichAfrankfurtArespectingAstalkedAnottinghamAfreeingAdharmaAmorkAeyebrowAcranberryAsardinesAmaximAsignoraApopeyeAjohannAbrowningAaspirationsArecommendingAwaverlyAdialysisAhandgunAlamontAstockedBleepwalkingArodentAinsertedAauthorsAfinleyAalignAmarkhamAcontinuallyAalignmentAcloggedAsaharaAdoubtfulAtoddlerBriciaBinkerAimpenetrableAprixAdemolishedAcorroborateApoorerAkeypadAfentonAgorillasAumaAmauiAironingAskankA'butAphotographicAvoltsAseamusBleazyAteaspoonAhorrendousBealthcareAabductBnalogyAnukesAmonetBythicalA'll-iAband-aidAswarmingByphilisAkuAhere-AcollideAbloodbathAmckennaApilgrimBacingAcultivationAbanglesAmerrilyAsilverwareAtimetableAgitAfridaAscientificallyAfoxesAiphoneAoutragedAbinsAupwardAscoobAmagiciansAextinguisherAtucsonAunpreparedAsquireAgenAcuiAbizAmunchAhermitAexcitedlyAcaptionsAstomachsAhasanAdebriefAherpesAdivyaAuniversesAhierarchyAuniversitiesAchazAsaludAneelaAmutuallyAdurgaAtiresomeAruptureAkimonoAlootingAhyderabadAgauntletApervertsA12,460AwiltAunmarkedAlexieAsoaringAwithholdingAdepriveAamidstAfixesAdancinAauditoriumArockerAogdenAscarcelyAprodigyAuncannyAsentimentsAraghuAlovejoyAcontenderAbowenAasparagusAteiiBaroAalgaeAbirthmarkAminkAconsensusAwhiskersAquillAwidowerAinquestAguineasAdamselAramuAjackyAfickleAspace-timeAmortuaryAbestowAdrearyBossierAirwinAsnailsAmuttonAexploitingAtoilAkeepersAaccompanyingAspankingBingle-handedlyBuluAinningAagreementsAulteriorAbillingAyvetteAcampsiteArosalieAsnoresAjustificationAdownwardAfearingAdormitoryAstuttersArampageAcuresAraincoatAerrolAmeyersAadjacentAredneckAcookerAentertainerA112AintricateApritchardAfrickingAleiaAgrotesqueAnevermindAhoofAfaradayAdolanAroundingAboliviaAschoolteacherApesteringAralphieAexplicitAaestheticAdiligentApositionedAscarecrowAyawningAdelinquentAoutcastAnominateBaughtA1976AsplinterBkinnedAmundaneAnegroesAspokesmanA'ohAillicitAcinchAtaskedAinfectionsAbenevolentAvcrAaltercationAsentinelAappetizerArelatingAebayAmeccaAforeAminimizeAbarleyAlanternsAdumberAaudacityBlumniAgyeAchandelierAenclosedAburnettAappliancesArjAvoilàAterenceAheirsAgayleCrveyArbAuntraceableAspiritedAjazzyAtulsaAstartlingAfagsBorgivesArooneyApassagesAhattieAmousseAtechniciansAaidingBll-outAslicingArumoredAparrishAeuropeansAdipshitAblurredAfigAemojiAharuAneuroticAexchangingAtahitiAreliesAmojoAliliesAburmaArealmsAfiancãAchavezAturgutAestelleBlixirAbrennerApaxtonAbrittAcheapestBastsAflashedAnurtureAkeyesArajeshApassionatelyAcuntsBandiesAelopedBvasiveBmbarkAamishAswagAhiresAmuzzleAconspiringAwingmanAmetaAdiscreditAcircledAfrivolousAbacheloretteAslangAmeadeAauthenticityAcrowbarAairedAtwo-bitAccAbeardedAsightseeingAmm‐hmmAbondageAgeorgetownAchasesBartonAdirectiveAwussAmammothAelifAheliumApredictionsAvaliumAmatronAclementineAbyunAconfederateAmamiAschizophreniaApantAnicknamesAeliminatingAunisonAsalariesBimsAmillionairesAendorseAvandalismAturkeysApewAintenselyAconfiscateBampedAwaterlooAliberateAclimbsAairsAswansonBelimApropulsionAdonnerCminoAcharmerAjugglingAshawlAcrusherBalmsA1981AstablerAdickyAreckonsAairtightAmonarchyAhomeroomAcharitiesAsaxophoneAtaniaAnabAwilfredAfortheAcheckbookAinflationAkremlinAhijackAjourneysAhawthorneAcompanionshipAgianniA180,460AtarpAintegratedAdouchebagAadolescentAtumblingAhorseshitBereafterAspawnAgrapefruitAanubisAtatArecreationAhillbillyAtvsAgadgetAsufficientlyAcovenantAalibisAoctaviaAcomplainsAstapleAcollarsAbilkoAnadaAfezAdecreaseAcrazedAreplayAmaximusCeveAlegionsAmarcelloA9,000AraffleAshitloadArejectsAtokAmonarchAcatererAthankyouArustleAaccordionA00ffffAlifetimesAesteemAangeAsecludedArainaAi‐iAtitaniumAgodforsakenAmeatloafAselfishnessApopulatedAbullshittingAriledAdependableAcompelAmcnamaraBartinisAflandersAgreenlandAadmissionsArefreshmentsAaffectionsAestimatesAdearieAnestsAgurneyAscandalousAdragsBeodorantAsusceptibleAoccurrenceAnewcomerAfranksAeyAarmenianAprovocativeAsafeguardAdeepakAcorAwizardsAtruffleAspadeBchizophrenicArejoinAbalaAafternoonsAtemperamentAsynthAridiculouslyAsubordinatesAoptimusArepressedAnishaAkhalidAvegetationAtentaclesAsugarsAgrumblesCandadAshrewdArhodeAjamsAcontinentalAspecializesAromulanAmassagesAbaggedAdaleksAbrightenCownieAperceptiveAdishonorAnudgeAsustainableBorry.AremainderAone-sidedAwienerArolexAprasadAoverweightAnotebooksAminionsAtangibleAflukeAatheistAc-4Afscy110A.45AsunilAcodingAvoltageAbazaarAclaustrophobicAmisledBarloAcorbettCmposeAextendingBightyAfossilsAsweetheartsBtakedAmonacoAluzAimpersonatingCmenselyAaftermathAoniyAdykeAbenignApenicillinAevasionAweirdosCllesAmartiansAtraditionallyAreflectingAironsAtechnoApresumptuousAjennAcosmeticAburnhamAraynaAunansweredAgloatAwhinnyingAostrichAlogisticsAinterstateAmartineAvestsApuncturedAhustlingAflushesAbrookAfscx110AcollaborateAevacAwailAbargingArameshAchennaiBasablancaApsychologicallyAcuttersAballadAstevensonAmacarthurAroadsideAweberAtrendingAseemaBnortAjuanitaAwhat-AimperfectAaddamsAscoundrelsBhopliftingAmstollA'stAfrazierAhide-and-seekAichiAswayedAgroinAemailedAgrammyAburrowsAshelteredAdiminishedAoutlookAinformantsAprofoundlyAstrongholdAhappeninAalmondsAflutteringAseveranceAmaniAcyclingAbarnettAreeceAgrinningAfundamentallyAevilsAmayerAentitiesAaggressivelyA1977AticklingAcrutchesAalgeriaAcriticizingArizzoAcabaretAmoltenAclockedBolourfulA102AmarkoAkempAfishedA2022AtiffAsaltedAobsessingAtombstoneAsurroundsBoggyAexcludeAiggyAunholyApunctualBratapAintimidationArelocateAmooingArenéAincidentallyAmockedAbennieAsaltsAklingerAwatergateAresearchedAlifesaverAguangAtaxpayersAlong-rangeAvultureAbrieAwadAsubsAclancyAprocessorAexceedAwrinkledApottsAtwitchAmarAindependentlyAbloomsAaortaAeeAaustenAsweatsApurchasesAexplorersAfujiAmahoneyAgumsAstandpointAreassignedAtransformingAadoptingAtaekAphineasA1971AbreweryAwillingnessAmaguireAinhalerAlotteAforwardedAex-conAprometheusAlocoAsalamiAquanticoAmmhmmAlibertiesAtriviaAscramblingAhonoraryAversaillesArolloApulitzerAtoplessAmountingBannequinAdesertsAclinicsAbertaApolishingAodessaAdisruptedApropellerAdualAjapAweirdlyApenetrationAmayanAfatsoAspotlessAmanoloApukingBilgrimsAharshlyAelmoAatticusAstemsAvectorAtaggartAallegationAthoughtlessAresurrectedAbipolarAhistoricallyAadvisorsA'raAdiabloAknowinglyArecognizingAintolerableArainbowsAgonerAsobrietyAproverbAabedApoxAseizingAnasalAclairAharaldArotatingA3-dAholocaustAcoordinatorBhoppersAbeatingsAsosAemissionsAcharacteristicArishiAcategoriesAtrumpetsAoasisAvolumesAdilatedBefiedAloweringAheathenAgoofAblowjobAwarpedAleapsAportiaAdementedAlashesAtourismAemergesAmakotoCrtyrsAdovesAshrunkAdoublingAundertakingAsinginAproceededAtalBrademarkAsuryaAzodAtwentiesAquakeAmuralAgarzaBlideAcontraptionAdetonatedAyamamotoAoversleptAcabotApryingAquotedAcarotidAnoblemanAmushyAlupeAastoundingAunloadedAavivAenidAfinancialsAaxisAmodifyAcenteredApreschoolEervingAburdensBorneCscoAaimsArhysAsmokyArecruitmentAwalkie-talkieAsaladsAridiculeAdietrichAhostedAgambledA35,000AdevastationAsparringAmesaAkitchensAmedusaAchewieAnamelessAdriesAterranceAstubbornnessAridinApunjabAformatAdismantleAsulfurAleechAjemBiffyAplatoAmaxieCruAfatefulAdelegateAastonBffordableAptaAhazeAbufferAurghAnostalgiaAsproutAcorpAworld-famousAcanineAsocietiesAjeffriesAmarinAcourteousAdosAnegativesAbedrockAtranquilAhalvesAcorkyAerrAdevaAmonologueAcushionsAmonumentsAdivertedAwidthAantoinetteBrchaeologistAhuddleAcherokeeAovalAhauserAraidingAmonopolyAgondorAdaybreakAqueenieAtwenty-twoApristineAconeyAstumblingArephraseApretzelAhere.AfastingAthermometerAdisruptionAgovernessAburdenedAparkinsonAfueledAcantoneseAvolvoAprovocationAbonoAkcAcondoneAinspectorsBmpoliteAepsteinAcampersAnetherlandsAgeneratingAdeformedAcondescendingAdreadedAclosetsAzionAprovincesAingenuityAwessexAhigh-levelAcomplexityArundownApunyBressuringAexploitsApulsingAcyborgAarsenicAsirsAplatformsAvaleriaAstimulationAnationalsAmandelaAfartedAmodificationsAcornwallCnjureAsmokinAliseAcontributingA250,250AtakashiAposeidonAbadgerAtremendouslyAlamaAjacksAgreggAcoordinationAthrashedBittyAyungAinsufficientAhighlandAreeksAmidgeAjanewayAmunicipalBediciAflatteryAepiAreopenedAwolfgangAindifferenceCvoiceAgibbonsAcompositeBlaudioAulrichAsorceryApremeditatedAopen-mindedAkovacAninetyAremakeAoverturnedAnicholsonAbealeArosarioAsanfordAchemotherapyAaptBccelerationAdeductionAleprechaunAkiddAglossAehhAprojectionsAmonumentalAcartelsAawokeAdojoAcobblerAberniceAinfinitelyAfacadeAbrandoAusbAexciteAbrahAwrinkleAmormonAfinderAcombingAmckinleyAunifiedAserbianAfive-oAarabianApsychosisAdefiningAwingedAmorenoAsarumanAmehmetAbraddockAitoBntoxicationAdiscreetlyAbordeauxAi`mAgracesAsympathiesAreelingAloopholeAkeikoAobservantAintendingAsnyderAjamaicanAcateAwarmsAincorporateAe-mailedAdiagramAactivistsAtikiAexpendableAgoosebumpsAcabsBonsulAreddyAjimmieA1955AgauriAdubiousBiabolicalAadversityAvendorsAsyrianAphoningAdisloyalAe.t.ApersistAarchaeologistsAcuratorAbsAunwindAimprintAfifiAbiographyAkashmirAbriAschoolingBquashedAroswellAtoyotaAqualifiesAglorifiedAretroApretzelsAmerleArheaAdescriptionsAunoAritterAwoodhouseAundefeatedAreinforceAunlocksAgownsAimpendingAfultonAbalboaAowwBrchestratedAlarsenAtinderApremiseBitchesAmerrierAcombinationsAhapAgossipingAexesAwoonAschematicsBandersonAdodAoatsAnotreAintroductionsAhoverAglandsAbrigitteAgorgeAreconstructAcoastlineAbergAattitudesA.‬AvanyaAicarusAcrabtreeAdanesAbillingsAvengefulAreckonedAtabooArygelAdistortionAtinglingAcadetsAunsuccessfulAtakedaAharukaAresentedAaugustineAslurpsBheddingAmurmurAcocoonAdutchmanAshiverAperaltaAmake-believeAsantiAadamaBzraBmanAeuniceAshoAnavigatorAexploitationA175AoilsAgloomAfinesAenquiryAsubmarinesAannihilationAveeAorchidsBdoAgenerouslyAexemplaryAlimpingAreformedAnyuAlatinoAentriesAtrippinAinsistentAaccommodationsAsudanAdistrictsApiousAforresterAozzyAdockedArobustAinducedAtherebyArudiAosloAastonishedAbrasAozzieAmagnetsAimpartialAwebsitesAowlsAtrickingAspurA31stArapesAillustriousAcleaverAschoolgirlApatriotismAvinylAscallopsAgumpAsensoryAbridesAarticulateAtranscriptsAbarfAhurriedAguatemalaBood-for-nothingAedmondAamaraAwichitaAtoyingAprivyAsootheAherdsAfuzzBorciblyAcolaAholdinAemtAdaraAnoelleAmatteoAsilhouetteAprolongedAyeolAredundantAdefeatsAtensionsAnotaryArevisitAbattleshipAconqueringAveterinarianAnudityAsampsonAmilaAgormanAassemblymanA'artagnanApersecutedAhyeokAy.AnemesisAheroismAunconditionalAtendedAshovelsAinhabitedAadityaAflakeApuzzledCkedAodetteAchaplainAslaughterhouseAdelayingAcontemplateAalgebraAnuggetAunconventionalAponytailArashidAluffyCcieAjessiAfarnsworthApasturesAthrashingAsnowballBhareholderApackagingAhypotheticallyAspatterAknicksAjailedAfairfaxAnotionsAprojectingAliterAsunscreenAcrossbowA1950AparsleyBurchasingBonchAmilkingAhereditaryAaccumulatedAwednesdaysAspaciousAgalileoAfurthestAprosecutingAblackwoodAobituaryAtime-outAintoxicatingAsharpenAproclaimAorcsAmiraculouslyAdesiAlucianAdysonAbebeCthlehemAseasonalAdiscourageAtranquilizerArearrangeAmerrillAsalaamAmantraAisraelisAgretelAeradicateAstutterAjossAmegatronAsubmergedBoundtrackBeamsAplungedAwelcomesAeyelashesAmarisolAholleringAcharredBedarAyamatoAintrigueApettingAgotsAwardsAstefanoAdemocratAheightenedAdemotedAinventingAvogueAillnessesAgrillingAmalpracticeAjoffreyAsupposingAfinsAsiriAhiramAplasteredArhetoricalAfirehouseAbehavioralAhyperspaceApointersBangAcyprusAsuperiorityAunavoidableAhumankindAflexA210AconcessionAmunitionsAyelpingAhaloAcapturesAwinterfellAattendantsAdividingAprogressedAmasturbatingAeuroAwartimeAklanAdecorAlugAwhipsAnuh-uhAghostlyAwhitAmonsignorAgaeArooftopsApedestalAmileageAignacioAfoldsAshamedA1962AtrendyBootAarmageddonAelevateAlisbethAgabriellaAburpAlapseAabdullahAveyAunprotectedAkabulAwarm-upAthorpeAhotlineAcompressionArapunzelAvariationAcommitmentsAprovokingAscrawnyAknuckleAalliancesAmy-AwilfordAaviationAstraight-upApalestinianAblackjackAimplicateA'heAtuttleAannabelAfiercelyAwhistlerAperformsAjiveAtootsAplumpAkiddiesArelapseAmisunderstandingsAresurrectAcoyotesAkourtneyAsecretariesAemphasisAobliviousAkristaAblabberingAaimeeBbnerAfinesseAs2AgauzeAbridegroomAlacedAhopelesslyCboA20-year-oldAsprintAdempseyAmammalAgioAchitchatAshardsAlifeboatAastronomyAcarouselAwell.ArenegadeAinterimAaangApresidingAbanjoAremiAphysiciansAlateralAunderdogAretreatedApiccoloBedestrianAfestusAsubsequentAhallieAdeficitAoverhearAch00ffffArecessionClevanceAchoreAneedlessAtyphoonAadvancementAwholesaleAplatingA're-AinvokeAhearseAmotherlandAfoesAkamAbarackAreconciliationAdahAmaggotAstellarAorbitingAcommandoApatronizeAdecoratorAtodAlucidAjanelleAhkAdivorcingAlexingtonAkayaAimprovAvamosAtractArochesterAbreedsA10-year-oldApongAknowledgeableAconstellationAorientalAcomoBheerioAboschAperverseAmarginsAnoviceAhorsBazyAinstallingAtupacAenmityAmopingAkanyeAgmAzeeAslutsArickshawAmeadowsAcrawleyBaitlynAtwo-wayAmishapAwoodwardBeavingAholdingsAarsonistA1930sAfoolproofAhealyAcesareAlobstersAgladiatorAfamishedAdiscardAaugieA4000AthanosAsmittenAgunmenAkrautsAaldenAzetaAsepticAroachApreferablyAhallwaysAeulogyAdynamicsAopeningsBoh-oohAcirculatingAmahalAhimalayasAbimboAwarshipAventilatorAbuggersAseinfeldAundetectedArapistsAunattendedAskypeAcuddlyBontemplatingAveggiesAtsarAkimuraAjigAg.i.AdeserterAcoworkerAexterminateAafricansAcomfortedAbaneAmalfunctioningAblasphemyBeigeAlarcenyAaccentsAloreleiAkenshinA365AundergoingAslotsAreiAkievAimmersedAsupervisedAdetestAconspicuousAroutinesAbonkersAannikaAhellholeAgangnamAsurfacesAcsuBreationsAlandslideAhungoverAetherAhairpinAvistaAbaffledAwithdrawingAseasickAgaiaArecklesslyAmannedAbergmanAundertakeArainforestAembezzlementAowingAwholesomeAtovAguthrieAsculpturesBatinAdeannaAuncontrollableAsassyAjoleneAdeterminesAhumpingAgoebbelsAfesterAabundantAstasisApathwayAhugelyAjiroAkaleAavailApushoverAjermaineAflapsAcurvedAattilaAkgAlibyaAincheonAduiAlight-yearsAinfidelityAheftyAsupplementAtumorsAddAreveredAinflammationAcroweAsutureAhumptyBemisphereAexecutingApicturingAenormouslyAharvestingAbiologistAundeniableAramónAbawkAnightlyAdustedAburglarsAmanicureArositaAinsightsAglandAspoutAnappingAswedeAalbanianAfruitcakeAmanuelaAjugheadAgo-toAoutwardAnavarroAhomeboyAdariaAwhirlwindAkickerA13-year-oldAscavengerAlincAinhalingAwonkaApamphletAterraAseismicBcotsAfinnishAbangaloreAstricklandArosyAchinamanAlauncherAhistoriesBanukkahAsilApathologyAdisapproveAstiflerAborgiaAmean-AhermesAdaytonAcoronaryA50thAindicationsAcompensatedAbilalAthrobbingAnestorAhydraulicAsonyBhireAbikersBainesApasswordsAbinaryAtiberiusAwolverineAsurpassAcompulsiveAupstandingBclaAlonAcraftsAbabsAretainedAshouidArusticAinjunctionAgsAbetrothedAhostilesAdegradingAbakuganAhorizonsAconsensualAwaterfrontAslumsApanthersAkinderAexcruciatingBvacuatingAmementoAbeneficiaryAoverreactAvishnuAreinAmartinaA'connellAuproarAmerylAforeseeAchattyAswirlingAlenientAfacilitateAclutchesA108AlicensesAmatchmakerAexaggerationAsneezingAroadblocksAsureshArivieraAimpairedAaniAquitterApipingAbraverAtranslatingAmanifestoAcommunicatedA​​AinitiatingArecoversAgobbleAdiseasedAapplicantsAtorchedAmobyAarmpitA'courseA2.0AlimitlessAhurdleAarraignmentArespectiveAosamaAshalomAaudiBlloyAcarnegieAwritArightoAqcAmorganaAunlawfulAsit-downAmlaAfatterAmarshalsAconflictedCsyAbellowsBallparkAferretAarcheryAdevouredAhandmadeAnewerAbirchAzeArhettApappyAcardassianAfuelsAmisdemeanorAipodAcompoundsAxoAlocatingAforsakeAeyewitnessesAbotchedAhigh-rankingAdearsAleviathanAentourageAchantsAkeenanAcagedApainedAnicotineAfrannieAbeddingAwarheadsAbaloneyAladdieAindispensableAsusannaAlyndonAhobbitAwinchAsparklyBon-of-a-bitchArampantAprospectiveAaidaAconceitedBartridgeApromptAenragedAhippoAacreAminneapolisAlatitudeAsundaeAlawfullyAupfrontAloggingAfoggAartemisAwalkieArahlAhawkingAjudgmentsAdoomsdayAbrainyAmangaA'neilAenvironmentsAtakeshiApbsAgeeksArutledgeAoutletsAtransponderAbreak-upAharboringAtollsAordainedAaragornAovertakeAnomineeAfeloniesAdarnedA190AsophBcrollsAlenoreAsherylAdiagnoseApulsesAteleportAfarahAunaccountedAroofsAventuraAortegaAfive-starAsprinklesAquagmireAfloorboardsAcarlottaAlyonsAdixAcandidAappeaseAhashtagAganeshAopticalAheapsAbannersAprudenceBlaguedAmistletoeAbarbershopAvertebraeAsummertimeAcelsiusAmillenniaAescalateAunrealisticApush-upsAfitchAdisorientedAbashirAamorAoffscreenAmazelAwithheldAkilogramsAgrantingAduranAwilBarlockAin-houseAhesterAdoddAclicheAduffelAlacrosseAchampionshipsAslagAhypocriticalAdeadbeatAmiddle-classA230AlodgingBeftyAgulAarchitectsBnnihilateAthirty-fiveAdunAyappingAwithholdAplymouthAinsinuatingAhubbleAdecafAnutcaseArevisedAcontradictionAscriptureAwhirlAsantanaAyamadaAjemmaAeditorsAcholeraAtimelessAcarmelaAgatorAunpackingAroperAholsterAdivulgeAconsumersBalculatorAscofieldBelf-consciousAcavedApartridgeAmaddenAinjureAlowryAheywoodAfluffApenaltiesAodieAfascistsAvariationsAlevyAtockAstereotypeAdigestiveAbjArenewalAmccordAbarkleyAvariableAthemesAffff00AbowedAsilvioAraidersApenceAtolerantArecycleAfactionsAwynonnaAreptileAmeaslesAeuAthinkerAfursAencoreAtauntingAkayleeAdudAclimberAdefianceAaspireArecycledAattackersAoilyAnightcapAmilordAismailAcaterAyakAdowneyAcoupledBhooAtreasuredAhospiceAmardiAarisesAlakersAturinAhaskellAcarpAmadgeAjacuzziAriversideAkitsAeagerlyAanonymouslyAliegeAgollumAtoenailsAmetsAgoblinsAcheetahApetrovAnathalieAamigosAwestminsterAbalancingAemphasizeApremonitionAkareemAbargedAmenopauseAhousewivesAflavoursAdemonstrationsAbuilt-inAsicilianArecapAdodgerAkindestAintervenedAfinalistsAroderickAgenericAfecesAcheck-upAburpsA18-year-oldAmeaslyAkeepinAbitchyAalleysAundertakerAtaggingApublicistAthongAleapingAchronicleAarchibaldAuncoolApasadenaAreekCzaApriestessBaddlesAhomiesAd.w.AcarbsAvossArenataAnachoAjensAinaugurationAhighwaysAtickledAdmitriBevoutAmacauAdisguisesAmendezAflintstoneAwexlerAlandlineAdisputesAtechsAdominanceAbannisterAfriedrichAsnowyAreadilyAerosA‐yeahAtrufflesCagediesAvishalAswannBhufflingAgraphicsAcylindersAamnestyAurgingAlennieAquenchAprejudicedAself-centeredAgrasAalphonseAwrapperAsporesAplunderAcristalArefineryAassaultsAshuddersApollutedAleechesAbraidAascertainAthawAdepletedAsuitorAvalorAnoirAaristotleAcompulsionAsexiestAchilliArevivalAinfernalAdamesAthat`sAfloralAsmearedAmoriBiddlemanAdarthAtranslatesAmemoirsBatlockAinsolenceAefficientlyAsubdueAlisterAquarkA1.2AbeetlesAoriApenisesAmccabeAarkhamAtimelyAwaldorfAnikolaAgiuliaAchokesAwarehousesAtabloidAbirthrightApanchoAmoversA75,000AguitarsAenricoAdepravedAbombshellAfusedAviolettaAshudderingAhymnAaddieAmccannAheiressAdeirdreAhomingAsubbingAbelaAxanaxAvigilAtwainAsiddharthAproteinsAcandlelightArecurringAfaintestAbord1AspartaBhoweringApioneersAlarkAnailingAtehranAhoweAdeactivatedAtiaraAshaggingAminhApubicAcheckersApimpsAnibbleAmonsoonAgunnerAmarchesAkagomeAgukAdemolishAbritAquadAmappedAusherAmisleadingBaiaAgnomeAda-daAtintinAcurriculumAblistersAtraversAjoltAhouAto-doAhispanicAstoringAdetachmentAsaiyanApuffyBrognosisAjurassicAspoutingAconservationAstranglingAelasticAbindsAmathiasCdhouseAbouldersAavengedAoutburstAmeditatingAlindenBottieAdictatesAboundlessAlaunchesAconferencesA1961AtraysAnightgownAdickinsonAbriefsBottomlessCsniaAco-workerAdivesBeactivateApurestAcroftAbetraysAdiariesBrive-inAhakA118AchristaAsiriusAoptimistA'ladyAappetizersAsmeltApyjamasAsweetlyAdislocatedAoverlapAmccainAlife-threateningAblackoutsBe-AuntiedAmade-upAtabloidsAintestineAdamnationAhelsingCrrmannAdevoeAyeungAtextbooksAgrandeurAbowingAmaterAanwarApalacesAsupervisingAcanvassAvacancyAreproachAnutritiousAdelphineAcardioBompletesApreservationAmaintainsAditchingAchuckedBonfrontingAatopAfaintingAestatesAthumpsAsurrenderingAhearsayAelkAdupedAselfiesAracetrackAorvilleAhe-heBurryingAvaginalAshenanigansAindicatorAerectAbureaucracyAvoAunchartedAdesireeAmcguireAappropriatelyAsanaAtormentingCppingAsettlementsAimaginableAumbilicalApawnsAreyyanAsuperhumanAhubbardAsapnaAomeletteAmeringueAinterpretedAcavernAscourgeBwayingAbrittleAvisuallyAmullerBargaritasAbuoyBalkiAmappingAhousewarmingAfamouslyAempAappealedAgroundbreakingAhomosexualsAcanadiansAespositoAmowerAwandersArefreshedAimpoundAdyinAoriginalsAmassacredCniacsAblossomedAamiAsimmerAmarinoAdisrespectedAwaterproofAsharperApromoterAirritateAescalatedAtroughCappingAsandmanA999Amodern-dayAlairdAexcavationAhogsAsubscribeAcontendAbridesmaidsAlinerAwobblyAlawmanAscripturesAgrievancesAvanishingAunhappinessAsmall-timeAportrayedAalonsoAtribuneAstitchingAdeemAsubscriptionAcompressionsA117,460AbustsArolfApardonedAwhitakerAloboAanchoviesAsutterBhitlessAisaAguinnessAstandinAquailAcatheterAbrigadierAcommemorateAwindmillAspideyAreloadAmusketeersBidtownAcaymanAdavinaAsavvyAwoohooAgrogAmarisAlatexAextremesAsaitoAreptilesAperilousAmaliaAcreakAyanksAnarcAmetabolismAvalhallaAt-minusAmornBirageAredsAhewittAinsecurityAemmetAdisclosedAcookbookAbelAhe-manAmacleodAincurableAexhibitsAliaoAhousematesAinvoluntaryAdouble-checkAunh-unhBtilizeAbusiestApsAdaleyAbaboonAtrampolineApurcellAnikAcheddarAslushAmessinAroastingAkurtzAhalloAcrumbAselectiveAissuingAshillingAhailedAparlourAdizzinessA'tyouAmuppetAforgetfulBivesAcounsellorAbuntyAautismApathologicalBediatricianAgripsAsubtitlingBhroudBaviourCgaAnestingAtartsAparaAcbcAdanniAplaybookAguerrillaAsteadAdirectoryAsitcomAorbitalAcubicAharvestedAshuiArun-inAnookAdildoBarioAchatsAmcgregorAchangerBavanaughAugliestAbenitoAself-controlAdoableAswamiAeelsAsurfacedAmaturedAtrustyAseductiveAcampaigningApoppinsAshrinksAwackoAplattAhey.AgazingAcomplianceAlimestoneAjohannesAfirstbornAlourdesAwrongfulAhickAedictAlaboredAdefectsAtwo-thirdsAna-naAcubicleAkebabAj.p.AvialsAgimmickAboomsAmdAjehovahAchiangAtidingsAsickerApoachedAbonusesAahhhhApalomaAcoca-colaAdarhkBominionAquiltAloopsAmakoAclothedAthrillsArubsBoxieAquintAkaufmanA600,000ApaladinAcontestsCmmonerAsnowedBituatedAkobayashiAexhilaratingAmakiAhandiworkAarchitecturalAsnareAkenobiAimaginativeAconfidedAwe-Alow-levelAgrateAfreelandBorgingAcongAactivationAprenupAvisasAfilialAtelephonesAcoosAhammersAraccoonsAprofilingAkryptonianAhandcuffArenaultAovercameAmarseillesBinedAsunsArecitingAkrystleAdittoArutAprodigalAseductionAcoolsBiceroAdeprivationAcavemanAhissArigorousAc.o.BhastityAfive-yearAtandyAestrangedAcroreAbewitchedAautopilotAbairdAaquamanArutherfordAkensingtonAmorrowAkarthikAcountiesAyankedAtwosAstrangulationAforbidsAsinbadAhagridArippleAlitigationAcummingsAstripeAdwarvesAblazesBaddestArelocatedAgraspingAcreamsBoncurAvieAtaxisAvisualizeAcoercedAembryoAbloodthirstyAallegraAwitheredAroachesAscamsAnakamuraAtempletonAsequencesArafAparchedAmedicsAinstancesAwreathBaspAhoeApollingAscrubsAcombiningApatriotsAinconsiderateAcarnalAοfAmanifestationAforefathersAcerseiAgrazeAtokugawaAaslanAcounselorsBleansedBicadaAserenityApetrieAcussAraleighApaoAmathildeAkeroseneAsexierBhoneAhijackingAcommunalAsd-6AgopiAcheckpointsAblatantBazAcathAmelodramaticAaroseAgistAemeryAnanceAassumesAvetsApenalAvoterAspillsAnepalApoignantAmerlynAlamborghiniAfmBairytaleAcrittersAwhiskBarlordAanonymityAherniaAcalmerAskaterBadderAoarsAseventyAalamoAfurnishedAsamuelsAnighAaaghAfestivalsApippinAhivesAvaryAlassiterAdustingAvaporAfemurAdeluxeAamissAtechnicalityAshifuAgoroAstaffordApoisedAneutralizedAmontagueAleungAhypothermiaBistoriansAupstreamAsix-year-oldAreumAfolkloreAanticsApebbleAmotherhoodAethicAduvalAbranAmeatsBanufacturersAdatabasesAfarleyAmunchingBadsAfallinAsofíaAx-menApilatesAlouvreAboonA1800sAfetchingAdukAshoelacesAwillpowerAsickeningAdownstreamBanielaAroeAmeanestAlt`sAporkyAzerosAsnugAmeekAcanistersAannoysBdeAlangdonAeight-year-oldAbubAthreesAdelennAbirthplaceAcyclopsAsealingAlesleyAdetergentBistressingAminefieldAgarryBouldAassemblingAmajorsAignoresAsputtersAomgAchewyBalhounAnamiCrcissisticAcultivatedBloningAextinguishedAcuringAsanctionsAunwiseAoaksAguillotineAhoistAfabricsAcannesAvocationAsix-packAgracefullyAbrodieAarouseBdriftAbeardsA19-year-oldAwhollyAumbrellasAtrendsAheiAchestnutAtamedAhornetAescortsAdouble-crossAself-righteousArampartAhurlAdistrustAcochranApawneeAwearinAmanicAgonzoAwaiverAquebecAgarmentsAseulAnarrowsAfellerAhacksAvampiroAperpetratorsAagileAteamedApearsBassagewayAobservatoryAafflictionAmarwanAcastorApurgatoryAmothsBaheshAjestAwhitehallAsearsAivesAconstantinopleAappaAkimballAcopyrightBannibalAlavishAtreadmillAchakotayAslingshotApotionsAbrandingAprophetsAjoblessAsadistAunpopularCattractiveAbitcoinAyumaAhogwartsAvocalsAcubansAstairwayAlong-lostAget-togetherBlutenAyear-oldAaltonAshortenAwildfireAvarsityAunfairlyApersistenceAolympiaAkrustyAoverworkedAlandscapesAdaisiesAsynagogueAlocomotiveAdeludedAchaneyAbalmAadoptiveAgillsAtatumApercussiveAflinchAunpunishedAswimsA'oeuvresAglockApayloadAneglectingAderivedAcoarseAincorporatedAatkinsBbAmasqueradeAthree-wayAbroodAteasAreassuredAtaoistAfleischmanAdalekAtonnesAhengAbribingAndAarAyoshidaAthunderclapAgruberAlaxmiAdecapitatedAanthraxAloyaltiesAj.b.AgathersAinspectedAdazzleAyoureAtailedAceramicCAmindfulBcflyAbeyoncéAoffendingAnewcastleAjuggleAwringAfresnoAbleedinAdiaphragmAfontaineBaggotsAcrammedAappetitAdankeAoverjoyedAmiyagiAculturedAsongwriterAp.i.AkeishaAbeamingAhammockAsyBansaAcorneliaAtbAgarAtelepathicAvaultsAgrasshopperAfedericoAanticipatingAropedAbelgradeApopulationsA1959ApoachingAmobilizeAbackdoorAmongoliaAdecorativeAbransonAtemperedArollersApurringAmatsAgonzalesAslenderAmalaApiningBredictingAchihuahuaAabettingAsiennaAmutatedAsculptorAhindAgarnerAdeadliestAstarryApenetratingAeskimoAmertAalcatrazAno-noAegonAregrettableApinkieAchunkyA1900AprogressionAnutshellAmalhotraAcrypticAwrongdoingAottomanAinezAzoAsmartsAgordyAunevenAshaunaAjohnstonAdahliaAwoodworkAvickAstrutBpecterAfireballBortifiedAgenghisAmergedAteoAgonzaloAcrutchAvantageAkolyaAgeraldineAfictitiousAtipsyAemilieAdo-AcondorAblendedAstormingAperkAkriegerAhakanAbashingAvanquishedAstraysBpokespersonBanchoAmpsBclarenAkommandantAgoalieAdeoAcharAusagiAprawnsAtwenty-oneBrentonAirreplaceableAelwoodAcloudedAretakeAnegativityAkelleyAdemonstratingApinballAcongressionalAbouncesAcovetedAutensilsAreproductionAquéApossessiveAcadaverAtravellerAhomosexualityAretractAexpireBsmeraldaAcrockAamitAendangeringAdelightsAscandalsApunishableAgonzalezAbrisketAdooleyAfreshmenAabusesAriddledAembroideryAblondesApost-mortemAkatzAgallopingAdisruptingAceasesA1958AtriggeringAnorahAcrescentAnickelsAkrugerAobjectivesAgazetteAdysfunctionalAceilingsBlementAneganAkahnAarchaeologicalAtriadAsuriAculpritsAscrapbookAhatersAsodasAthadAstarlightAappalledBnnihilatedCarchistAsmotherBeagullAcompressedAbuickAshellfishAmimeBayfieldAlettyAfluxAclonedAflowedAnerdyAfestAregulateAin-lawAcrockerAsnickeringAgovernedAmimickingAaeroplaneAmagAlacyAjagAgagaAaoiAlacerationsAcomancheAhanumanDgerAdiosAboobiesAwinnBeldAklaraAhyenaAgeishaAflashbackA1920sAeggnogAdeficiencyAcouncilorAtwitchingArajanAfull-scaleAsalesmenAhatchesAdenizAsimulatorBtationaryArenovationsAbonaAnurturingAraisinApunjabiAmongrelAhuzzahAdispenseAcompromisesCalsAsofieApledgesAjunoAsocratesAhumidApiedAsurpassedBimpsonsBavoryAmortifiedAtyraAsmootherArosalindAminceAsci-fiAhindsightAunlockingAodysseyAlovinglyAkiddieAexclaimAalligatorsAkhannaAhousedAcrapsAoff-lineAmoatAlife-changingAhanselAphysiqueAunicornsAdonkeysAeastwoodAping-pongAgeologicalBamblersAcauliflowerAyuiAofyouAdisorderlyAbeetsAastronomicalAmahjongAdaydreamingAblackmailerArecreationalApliersAnintendoAvanquishAtoxicologyAharpoonAcutleryAadventurerAweiiAlengAscenicAmobilityAelevationAdrainageAtorranceAvanishesA'thisAjunglesAglaringApertinentAmeshAdoctrineAbrittaAvindictiveAhailingAdashboardAchipperAuglierApartakeAfentanylAs.t.a.r.AlagoonAvaccinesAsapphireAyippeeAhyenasAexcelAgen.AfrightfulAconserveAsubjectiveAjr.AstrickenArigbyAliberatingAbartholomewAzhaanAundiesAadvertisedAprolongAmattressesAsprainArustlesAnecessitiesArepelAoverflowAuntimelyAacapulcoAsmart-assAdictatedAfanaticsAdisplacedAvicenteAperchAnewfoundAinfestedAfinancedAcheeryAafflictedA1918AsucceedingAmauryAthereafterArequiringCbaAnandoAcreptAyukoAintervalsAsinusAellisonAabruptApolicingAgrazingAflunkedAriffAwateredAa.d.AfleurAsplashedBlopBhedsAfenderAensembleAtermitesAspiltAbeomA1938AlootedAkariAinsubordinationAskeeterArelatesAexecutionsAcoincidentalAmvpAforcefullyAorgasmsAjeevesAcoordinatingAtrampleAoh-oh-ohAclooneyArommelAflammableAcrucifyAracersAgoddamAbertrandAy-yesAvroomArookiesAshapiroAdisagreedAteapotA40thAfetalAclaudetteAavonAgassedAastraAyemenAtouchéAmathematicianAkimiAinteractionsAblingAfingernailAcourtesanAaggieApublishersAclippingsAprostheticAmalignantAfrisbeeBidelityAtickedAopticsAmoleculeAbicyclesAsigAbehaviorsAabsorbingAjuniorsAethiopiaAbuttholeAmintsAconroyAverdeAmuggingAalinaAkhloéAhotsApelvicAjuarezAcontinuumAempoweredAcordellArdAheartedAcreditorsAonwardAhystericallyArailwaysA1952AoverallsAincriminateAexitingAhumorousAskylarA'inAairstripAnext-doorA'reillyAironicallyAalgorithmsAmachAtanningAnitrateArikersAaccountabilityAp1AhumbledAgalacticAwickhamAgnarlyAantimatterAgitaArorschachBiggingAharkAcombustionAaliasesAsolesAonce-in-a-lifetimeAhandbookAexpirationAtokensAsavorApacemakerAmorpheusAfuck-upAplumsAoccupyingAinvasiveAguiseAcolonistsAkhunAintuitiveAdominicanAclankAsneaksAa-andAweldingAvicodinAprowessAnicheAjudoAistAconferAwarblingAhamidAcoachedArigsAdroningAniecesAcurledAfarthestAplateauAneelixAbarrAtwirlAbengaliAmonoxideAvicesArafiAjigsawAdunesA650AstripedBiliconAhuntingtonAawaitedAmorettiAislaAwaiveAusageApamperedAdieterBecodeAwateryAsicklyBummoningArakeshAlogicallyAw-waitAflexibilityArugsAorientAmasturbationAgregorioAdimesA270AstrollingAfredericAanteAho-hoAchuckieAwentworthAautobiographyAtrashyBangleAgobAdeuceAcouncillorApolioAescalatingAveggieAunbreakableAstrandsAnolaAl-iAfinedAmisleadAfeldmanAkarinaAuniquelyAstintA1800AdeceitfulAwould-beAkatarinaAclandestineAunresolvedAocdAmahmoudAfantasizeApounceAcrowningArubinAneinAlalAfrigidAclarinetAwhoo-hoo-hooApeppermintAgeneratesAcarlyleAarrivalsAsyracuseAconfettiAirritableAreportedlyAinsurgentsAcurdAwarshipsAticklishAcuesBarriagesAthawneAchianaAbaselineAah-ahAsparkedAparchmentAordinanceAmaniacallyAb.c.AvibrateArenderingAjcAclingyAduressBistributingAappétitAsedateAromanticallyAmicroAhisselfAfrostyAcaboAepiphanyAalleywayAtakumiAhoodsAcorralAblueberriesAunbeatableAtomásAsoundlyAnewscasterAexertAdiligentlyAtudorAobstructingAdoctorateAbrewerAquinceAripplesApruneAmessagingAflipperAbailiffArecedingAcannibalsAoverthinkAimprovisedAhooligansAammoniaAstackingAenviedA320AeyeingAjaseAit`sAflapjackAtetherAsailboatAadelaAuvAlaviniaAreproductiveAfruityAabandonmentAmistreatedBathieuAhitherAblendingAprogrammerAkeaneAjosiahAbarricadesAallahuAdenounceAlebowskiAchestsAmalachiAstocktonAyuenAonsetBlsonA1948AshipyardApekingAsubsequentlyAponderAspringtimeAinsatiableAcrybabyA260AworkingsBynnAi.v.AaintAtulipAstomachacheBpottingAinadvertentlyAparisianAkillianAguacamoleAfriedmanAcrushesAredeemedBabbleAincarcerationAessaysAdehydrationBauntingAbuttingApersiaAcadyAboycottAjudAhairdoAtumourAdisAmadagascarAcaleAarlingtonA1957AtransparencyAsohoAdabAnebulaAminervaAinconsistentAgaulAdoritAatwoodAliraAsnoozeAamayaAoverloadedAdiplomatsAprefectureAbackfiredAzapataAdiminishAhenchmenAmelodicAlouseAjokersAfive-year-oldAexistentialAtiktokAspinelessAevictArevolvesAorphanedAbachelorsAmendedAcallousAyellowstoneAswansAmistakingAductsAwharfAsmall-townBeducingAbeeperBrenAhawkeAdetoxAsabbaticalAremembranceAluxAheadlessAdoggettApeskyAlow-keyAglumAchernobylAschoolboyAnoddingAdrownsArepliesAprowlAcourtshipAsahibAentangledAlavatoryAintegrationAnomadAportalsAmistrialAjewelerAansonAspiedAmascaraAhitmanAcrossfireBancellationAsuccumbAphaserAkathAzestAreviseAgapingAsatanicAgeorgAvomitedArepsApharmaceuticalsAfaaBdrAbaptisteAlengthyAgildaAmarekAkennelAsynchronizedAbuildupAadrienAcapriAhillsideAbreakinBowlerAmcallisterAquarantinedAcaperAbermanAv8AolaAblazerBrightnessAseraBcrew-upAmaynardAhematomaAseverideAmeasurementAelyseAgrrAfirecrackerAbathrobeAlankaAarithmeticAyou`reAsizedAovergrownAkernAdisarmedAbisexualAannouncesAinteractingAchecklistApretenseAstrivingAterrorsAmomentaryAcarelesslyAsmotheredBlackingAreflectiveAfrecklesAclacksAetceteraAdouble-crossedAleonaAappreciativeAwalnutsApamphletsAon-lineAimprisonAgritsAdysfunctionAcloakingAbonsoirApriceyAbufordBriceA119Au-turnAdemeanorAbuttermilkAasukaApompeyAnightclubsAdimensionalApickinAgatsbyAself-confidenceAangBbramsAwalk-inAshardApathwaysAdulyAtamponApubsAintegralAewanApaddingtonAkenanAnegligentAintimatelyAedwinaAtryoutsAlicksAguillaumeAstrayedAhonoursAbieberAfujikoAdrifterAasphaltAperseveranceAglendaAelmAcauldronBhuggingAsupplementsBtarchBhiversApheasantAlaunderAkick-assAtakeawayAgynecologistAfittestAcomplementAhobbitsAcherieAswappingBtart-upAfatalitiesAtwo-facedBelepathyAflungAtibetanAgeologistAdefuseAburninAarkadyAon-siteAfraudulentAremovesAhordeAokey-dokeyAaztecAnigerianAindictAhobsonApurifyAdoaAwoodrowAuntoldAdislikesA1953AindianapolisAschedulingAhakeemArowenaAmoreauAdefendersAcardiffApendletonAgabrielaAdisturbancesAchlorineAphobiaAjulianaAsemiAexperimentedApromptedA280AsectorsAparticipantAharrowAforwardingAblipAaccessingAtuberculosisAsluiceBafekeepingAmummiesAchaserAteylaAsheltonApinchingAhosesAglucoseAbulgarianAveronaAscornAignitedAwaitressesAblunderAevA11,000AthorinAelektraAsunkenAneanderthalsAenlargedAyehAvietAtinoAhead-to-headAgenomeAthriceAhibernationAcirculateAremusCbekahAoyeAnabbedAbugleAgeigerAfull-blownAabout-A'âAsuburbAgomerAnazarethAerichAlocksmithAinfluencerAchantalAbulgariaAmetaphorsAlynneAieftAcompArothsteinAastaAverneAsparingAfiletAlardAdipperAinesAsuitorsAeloquentAtamiAambulancesAswindlerAlochAbittyAambassadorsAbreakersAadrienneAwilliamsonAtruckerAmehAunderstudyApigletAwaywardAtweetingAsocialismAmoroccanAaccountantsAthyselfAhboAintervalAhenceforthBaniAkickinAgiulioAwoesAslammerBandovalApresentableAmusselsAentiretyAacupunctureAcaffreyAsnowsAmowgliAchristeningAmylesAcounterattackAdefneAreplacementsAambiguousAoppenheimerAjaggerAendgameAcraftsmanshipAadmirersAwaxedAotAduckingAnandiniAfenAseverityAhelpersAfoolishlyAeminentAdoghouseAsubduedAlarvaeAhinderAstakingAlindberghAwallerAspontaneouslyAright-handedAonoAattributeAdisksAcaillouAarbitraryAyo-yoAcombedAkryptoniteAdaggersAbarristerAscoffingAconscientiousAzoraAwovenAstoutAlangstonAinconclusiveAeffieAnoticeableAgunfightAantibodiesA3,500AmongolsAinfernoAchestnutsAroddyAjittersAcliftonAburrowAtraffickersAstabsAgrazedBohAsecuritiesAworst-caseAlymanAblowoutAscorchedAmilitantAcoatedAangrierAmidtermApermCninsulaAhe-AfoyerAoverseeingAmessengersAindonesianAshebaAremissionAcriticallyAkolkataAflickeringAunsuspectingAfriedaAastronomersA'whatAdevereauxAahmetAtaipeiAstinkinAkuwaitBatiaAswampsAmurtaughAacknowledgingAhard-earnedAconnollyAalteringAibizaAtransgenderBhree-dayAoptionalAgoryeoAbinderBenzAmagmaAladdersAkoranAhombreAwoodstockAsvetlanaAroyaltiesAprocureAfruitfulAdeenaAheinzAbuddhismAscammedAgermAdembeAepilepsyAsnuggleAmolesAcritterAsundanceArefreshmentAnarcissistAheterosexualAdifferentiateAmi5AcucumbersAsasquatchArhetoricAstrollerAenzymeApolkaAmilkmanAbraxtonBlobAshirlAmisreadBechanismsAkeralaAcommaBhimpsAauthorisedAseminaryAironedAavalonApoachersArublesBabbAprimoAobeyingAfideAextinguishAdormsBirtbagA115AdisobeyingDgruntledAbulldogA'toAswirlBplendorAforearmAskysoultanAouthouseBafAscentedAfernandezAdefyingAchivalryAsulkBetbacksAforty-fiveCnzAcatchphraseAwrestlersAhoesBalifaxAfixatedAnauticalAsoiledAimpactsAhelplessnessAfusesAeruptedAsilkyBebAcorvetteAthunderstormAhim-AfundraisingAaxesAvigilantesAsidelineAcatalystAunrulyAclubbingAtierBa-taAlesionsAtastelessApickpocketAigtAgopherAsloshingAacpApreventionAejectAbotsAsomaliaAreincarnatedAprerogativeAexceedinglyAapachesApsychiatryBrotagonistDpaneBetiteAor-A3.5AnourishmentAunplugAfilmmakersAundoingAmaisieApsychiatristsAneuronsAconcealingBensusAbergenAsocializeAconventionsAoverthinkingAingestedAglimmerAassertAtorahAoh-ho-hoAslayingBentryArevolvingAdonahueAtauntArupeeAhigher-upsAptAinjectingAreversalAproverbialAimbalanceAgigoloArunnyAexcaliburAswitchboardAdrizzleAirreversibleBntolerantCstinctivelyAhutsAaspiringAsoulmateAhakimAdevelopersAbibiAmusicalsAtwigsAgardeAchopinAsteamerAchryslerA1933AmykaAdrive-byAcelticAancientsAhosAcan`tApusherAenrollAdisbandedAboastingAregisAnight-nightAmerry-go-roundA0,700AmathesonAbonaparteAzheAturbulentApoorestAhands-onAshimmeringAgraciouslyAshaktiArigorBhythmicallyAnietzscheAgushingAd.n.a.BenimAcyA'rAnatsuAjumpsuitBessupAsaruAproprietorAabortedAronanAollyAjoniBakartaAamericanoAexterminationAunchangedAmolassesAdeviseAballotsAsupernovaBarcophagusAindulgenceAgimAunconditionallyAsacrificialAgulpAsotoBkillfulAmikaelAhumanoidAcrassusA225ApeckerAt.v.AperkyAtalynAscholarshipsAromulansAmaltaAdozedArevAenigmaAdawesAbelmontAvoldemortAmbaAgrownupsAcomprehensionAunpackedAshilAmihoAcanvassingCrtridgesAtinkAsimulateArustedAmausoleumAtrespassesAcrixusAtwerpAoooAvhsAhemAexpiresAbittersweetAafootAustAsmashesAoutcomesAgummyAdissatisfiedAclemensAo-okayAmulliganAwidenAthicknessAruddyBegenerationAkilometerAbritchesAsiskoAthink-ApsychopathsAbisonAspectaclesAohhhhAlubeAinsecuritiesBmaginationsAblanchardAtaserAskippyAcheck-inAvasuAsleepinArapportAjugularAhalf-brotherAmutedAsquattingArosaryAemblemAcorrespondingAwelchAdoggoneAyouthsAsanctionAhyperAgertieAcanalsAthat.AmiteAaussieApluralAfirefliesAoverwhelmAnikhilAworshipsApancreasAmermaidsAflirtyAcraziesBooperatedAbeckhamAarchersAscorpioApivotBasscodeAwickednessAhalleyAfloppyBerengiAvulcansAdawnedAstephanAracksAmouldAfamedAantarcticBgonizingAtakersAprawnAkanAdispleasedArattlesnakeAlandoAkeeAgunnBreenerBovernorsAspaniardAtahoeAreadeAimpureAclouseauAtienBetanusAstorytellingAbuttercreamAaronAuncleanAdefconnAtrickeryAsuccessesBconesAprojectileCimedAfaroukAclerksAverAsashimiArojasAmongolianAloiteringAcrowderAvariedAattributesAheatsAgoguryeoAexcursionAwhitmoreArenaAleft-handAstarskyAlindyAtraskAsanjanaA‐ohAlomaxAchassisAionAconfineA114ApairingAnobunagaAmonoAone-eyedAconglomerateAsectsAgo.AattributedBbbasAchromeAremingtonApinesBaulsonAdwyerAconstituentsBhAtopsideAmathisAgabAcookeAauditionedAwholeheartedlyAstandoffBhowroomApandeyAw-weBeaklingAunfriendlyAtamponsAgolferAcremationAvalkyrieDentinoAkiaAvermaAneanderthalAinexplicableAhulaAyawnAtaintAriaAhairlineAformationsAdeterioratingAcloutArevelationsAherreraAflannelA's-his-nameAharvAsecond-handAgraphBoofingAmissinAsentientAloomingAfremontAcookinAoff-dutyAfrenchyAawkwardlyAlongevityAjanusAdresdenAchaliceAbillboardsAjarrettAebolaAkeyholeAanalystsAvascularAmickiAyipAassurancesAchaudharyAtorAspielbergAreikoApricklyAnocturnalAlicoriceAbotoxAcivilisedAleónAhelsinkiAflattenedAbuzzedBingleyAsciencesAalmeidaAuglinessAtoolboxAshepherdsAcalculusAbakersfieldAspirituallyAdubbedAkaterinaAflagshipAcontractionAtorqueAnewcomersAlorenaAhaynesAchiselAopieAdrasticallyAshotgunsApoochBiggybackAnuckyBicknamedAirishmanAcelebratesAmohammadArudenessAautisticArinaAlolAfulfillmentBitzpatrickBeritAsergeyAdownloadingAshieldingAricAodaAhorneAall-powerfulAyugoslaviaAtreasurerAriosAautobotsAvcAchameleonAblinkedAsharpenedAquicksandAoutliveAstandstillAnodesAcontinuityAsmudgeBanitationApeopieAbutchersAsiuAmicrophonesBassivelyAheathrowBartmanAamericasApuBlacentaAlevAcésarAskimAlegoAconnellyAvigorousAtransportsAitchesAwandererAtaxpayerAspunkBermonsApalanquinAbloomedBalooAwisestAdislikedAmassimoAwhimsAturnipAhypocritesAmusashiAgloucesterApossessingAb.j.AasteroidsBlmsAslewAfliersAzolaAexitedAcutting-edgeAinhabitAgarnishAfredoBondnessAnationalityAmastersonAfahrenheitAencouragesAcougarAettaAvalentinAencodedAvalenciaAsimranAincomprehensibleAstumpedAflirtedAslothAimpactedAsiegAcurlingBamiA1956AqualifyingAinfantsAconfessionalAlebronAconfidentlyArevolutionariesAlettinArayburnAnosebleedAenablesAdobbyAshortcomingsCamblesAferalAsupermodelBpedAquartetAtownspeopleAphoneyAcandidacyAxboxAuppedAtweetsApeAhepatitisCadinAdostAtaurusAcheckoutCattedAravishingAinquisitionAhuffsAcorsetAnikeAmembraneAcompetedAwhenceAprecariousBebblesAelectronsA18,000AverbAlosinAdashedAbystanderAguesthouseAclampsAworkloadAverityAlaborersAidlingAunspokenAinherentAunaAphasersAbrainiacAsquawkApatentedAcrispsBbAoverdoingAinsulationAeavesdropA800,000AtinkleAmonetaryAwidowedAplatonicAretrospectAworkforceAsnoutBidedAimprovesAtastefulApursesAbattledAtriageAsasukeAobAlucreziaCtzAimpertinentAhomesteadAgoverningAfinalizedAadaptingAgroddAbingeAatrociousAsg-1BenpaiAplumbAhokkaidoAthomAcross-countryAbrokersAacquiringAplaylistAdead-endAmmaAkristyAblitzAtenaciousAdeductAloreAhahahaAredirectAmyronAgooeyAdracoAboothsAattachmentsAyorkersAgourdAspacedAbonyAvipsAreprimandCigningApastimeAcoldestAbridgerAverificationAsubversiveAfail-safeAterrorizedAreignsApoppinAunderestimatingAovercookedApresenterAaffiliatedAdjangoAaquaBngelicBiringAineffectiveAfixerA600,700AsanctityAmansfieldAgalleriesAbharatAgeordieApraysAmolyAgolfingAetchedA'donnellAchequesCasAvenomousAnicaraguaAconstitutesAsquelchingAmagnifyingAlinearAinquisitiveCdraBmprobableAkinseyAduffAterrorizingAcroissantAaminAmilestoneAformanAnaiAgalenAappetitesAcapsulesAtycoonAsnipAintubateAdeterminingAabhiAlacesAexterminatedAtimonAskimmingAmaximizeAberthAtarmacAantlersAblasterAunearthedAoverprotectiveAc-sectionAmurkyBirzaAkaoriAinterstellarAgrundyAunforeseenAtopangaAmangyAcorp.AbacterialAapprovesAravagedA'onAnirvanaAidlyAfirst-rateAskipsAcorrectionalAblowerAleasedAenochAventingAportrayAmind-blowingAfiscalAcannonballAadverseApidginBost-opAantibioticAdemirAwillfulAvivienAtruckingAoxideAibmAtwenty-threeAczechoslovakiaAbad-assAstrattonAenquireAcalderAbeveragesA550AsnaggedAregenerateAguitaristAbeamedAoppositesAwalrusAreadinessAnothingnessAcoatingAyearlyAprovisionAhellishAreopeningAgranddaddyBeordiAbileAscooby-dooApumpkinsAdumboAcuffedAsoraAexpediteAronaldoAoverkillAframeworkAarmpitsAunscathedAtwo-hourArolls-royceAforbadeAchairwomanAbefriendAshakinAinstabilityAcaddyAsmithersAraptorAnucleusAharlowAlebaneseAgrievanceAcrazeAscorchingAakikoAbeavisAinterruptionsAgiveawayAdecadentAfodderAsovereigntyAnoooAfavouritesAguinevereAastorAroundaboutAdopamineAstampedeBpruceAprobesAnorikoAshaftsAkatnissAseamAjettAfaiAdominatingBissectApaddedAforcefulAadieuArogelioAleningradAholdersAcanterburyAbayonetAmopedAjayaAindisposedAusableArosAloudestAgoldsteinBentAissaAprematurelyAbuffoonBffA106AutteredApreferencesAandrésAthereseAdowningAcravenAgarbledAfor-AessentialsAconfigurationDditionedAshudderAretchesAhighsAallrightAyasminAscepterAmittAbohannonAfilloryAcomicalAswaggerAmiserablyAgyungAbyeolAozoneAhaywardAdaddiesAbuttercupAuneducatedA‫iAcrucifixAbathhouseAyolkAvatAtulipsAsymmetryApaiAbrayAloftyAglancesAbozoA'learyAcrankingAyokohamaAinfidelsAcharadesApoundedAfriarAdepictedAsystematicallyAkojiAairshipAenforcedAaquariusA111AscrabbleBabotagingAioAdiscsEriminateAcroakingAtemplarsApawnedAclutchingAllamaAinstallmentAtrishaAillogicalAduganAtitledAobstinateAerasingAbraisedAloudspeakerAgraderA100thAsupremacyAmileyAbaby-sitAackermanApelletsAagAfocusesAbaylorA1600AlestradeAannulmentAtantrumsAspaniardsBayonaraAgrownupAturnoverAhessAbulldozerAthing-AoutdoneAno-showAprecedesAclaudiusBellmateAbosleyAsootAleperAindiesA1,800AvolkswagenAtesticleAsutherlandAmioAdevoidAreinstateAcolombiansAwembleyAstepmomAconsentedAtriumphsDcklingAjanglingAhalftimeAforteA'eApumbaaBieaseAflattenAstorytellerAvickieAsilencerAmordecaiAfinneganAzephyrAmangoesAfar-fetchedAvalidateAmasseuseAlappingAdottedArantingA1954AreconciledAturbanAheresyCadsetAcelebratoryAinternationallyAcaptivesAasbestosAhackettAzoyaApromotionalAetienneAbugsyApsychosAincestAhexAexterminatorAlottoAhybridsAguerreroAmcculloughAleansAasiansAsyllableAlieutenantsAtheftsAyuuAwhackingAdissertationAcastielAsenderAmangledAηeApromotionsAsorenBareeAhookyAcordonAsegAparticularsAexplicitlyAtop-notchAleakyAadjournAteluguAsiloBheikAnomAdezAbyrneAglitteringAduckedAaphroditeAservoAmouchAholographicAcheesesAthundercatsAmomentousAkishanAnaoAglowsAcondosAlithiumAiceboxAblackboardAconvertingAlanieAcavendishAaliaAurchinAten-year-oldAresentfulAporesAhanksAanissaAleveledAjimiAabrasionsAhanyangAfennelAhigh-classAdecliningAget-goAtwitBremorAmellieAbirthingBackfireAunparalleledAmatiasAsaberAeruptAshipwreckAhandsomelyAtrisAdurhamAislandersBaAdetAqualificationAprioritizeAmisaBelonsAbreathlessAsayaAhellaAdelicatelyAbenefitedAangeredAstationeryAproclaimedAinsufferableAbenchesAlowsAforetoldAdengA're-youAaishAgiverAdangleAsponsorshipBhieldedApuzzlingAarchesAhewesAapparitionAspecifiedAincapacitatedAcomparableApureeAselfridgeAmateyAaugustaAstaplerAdisturbsApacinoAshakerAmilosAcrowingAwreakAsuppressionAcommendableAavertedAdinnertimeAstuck-upBimilarityAinfuriatingAcpsAtorturesAslumpAcvBharmaineBawsAbernAshanaAnursedAhangmanAsumnerCarezAconsignmentAsweetyBerbsAmemoirAhardinAlecturerAberylA1949AstridesAmontageAsunflowerArepetitionCducesAconcessionsAup.AquickieAdeportationAspecialityApusAhypnotizeAstompedCannisBhimmyAparamountAkyeongBeelAserbiaApetrovichAdisrespectingCalsAwhartonAstatisticallyAdigestionAsecularBaucersAravioliAgravelyArodentsAcrunchesAimmaculateAgrinchAislesBrrigationAwishfulAsuturesAobliteratedAdribbleBonaAwrecksAremarryAfrauleinBayedAcashingAspecificationsAreverenceAingramAcartilageAwarrantyAinadmissibleCtegrateAconnivingAsorelyBashBcanlonAcommieAmaxedAflimsyAwatanabeAtickerAscornedAreinforcementApayoutAkeatsArecountAoooohAhookupAfigmentAconsciouslyAwatchfulArelocationAboatingAalchemyAopalApessimisticAcordialAsiliconeBaddledAmobsterAhalsteadAvibratorAtransylvaniaAsellersAinherentlyAal-qaedaAlingoAradicallyAbakArectifyAomoAtopherApayinAcabbieAhypnoticBigh-riskAexaminationsAwarrickAnetworkingAgibraltarAfairestAcompiledAtoothacheArenovatedAherodAgaulleAaward-winningAtourniquetBackledBrick-or-treatingAniallAlibrariesAdisobedienceAcoronaAaxleAmidwayAsnoopyAdefiesAspecAradcliffeApkAlocustsAbawlingAoutsmartAhopinAunfoldingAmixesAdoodleAbaptizeAwavelengthAsanitaryAquestionnaireAmycroftAconjectureAabracadabraA't-donBrourkeAguerrillasAfinalizeAversatileAdebsAuh-uh-uhAright-wingAbinkyApecanAgradersAcompartmentsAbarbraAintellectualsBmplementedAhelAeichmannAblindsidedAvettedAshruthiAbookkeeperAransackedAdineshAregisteringAmozzarellaAknuckleheadArhodaAbusinesswomanAanimosityA1937AwhinyAhighlightedAyaahAoarAtripletsAexpulsionAadvisoryArelievingBarestApeddlingAmillimetersAhedgehogAdefendsAsyllablesAmasseyAarchaeologyAyorubaAnomineesAmillicentAchompingAflashlightsAotherworldlyAnimbleAmelmanBanfredAfirecrackersApimpleAinstructorsAapprehensiveAsusannahAmotorwayAnavajoAgeorgianAadhereAsalmaAmayansAlidiaAbirthsA107Afive-minuteAcoilsAtachibanaArankinAhaywireAdownedAvetoAscoopedAphasesAnilsArudolfAneurologistAgeologyAdebriefingAavengerBustraliansAlandingsAajaxAnimAlongtimeAelectronAtopperAscarfaceAi.a.AflicksAoccupationalAnagasakiAin-betweenAhodgeAcharlatanAreceptiveAgangstaAwestenAfarrowAthunderbirdAheaviestBarkerAcollinAshortcutsAmataAescrowAwineryAcorrespondArajivAsatyaApractitionerBertainingAmontereyAichAyujiAprofessionalismAojA'liAin-ArevokeAkaanAcomparesAboardroomAakAregimenAprimaAdreadfullyAcollidedAspursAcitadelAmultitudeAhalseyAfeasibleAengagementsAastrologyCsigningAtrotterApronunciationBlaywrightAgrrrAcroatiaAstepsonBherriAhindusAoptimalBfyourAmitsukoAfrancieAascendedAhummusAgatheringsAduttonAammaAwilshireArikaAlashingAsprinklersArepentanceApaddlingAzimmermanAtwinklingBo-toBransformsAbroaderA109AnoddedAmendingAscarringArottedAconflictingA1946AunsettledArerouteAtrumpsAcitrusAsdiApaletteAkal-elAjackingAinvisibilityBmplicationA1920AobjectivelyArahAdecreasedAadmiresAvastlyAfreedomsAdispersedAatrocityAbengalAdeceptiveAcontingentAlimelightAinhaledAgiriAdrop-offAbarrageAadminA211AdukesAurinatingAnecklacesAlolitaAclippingBamaroAadulthoodAcroakAa.r.g.u.s.AqueasyAforefrontAsubmissiveAfirst-degreeAclergyArappersCnchoAgableAemmanuelAchimpanzeeAmccartneyAdegradedAstigmaAlearAugandaAno-goAmanageableAvitalityAjkAgazaAchidiAherriotAvittorioAprohibitionAhoodlumsAyusukeAvisualsAnecktieBavidAmhmmAhospitableAdisfiguredAcongratulatedAproofsBoultryAviolatesAroamedAdisdainAizumiAcomplicitAbusierAsurgicallyAmusketAieyasuAgpAsickleAfräuleinAtiggerAmgAconsumesAvaccinatedAmicrochipAjimenezAemissaryAbaldrickAmcnallyBailingAbumblebeeAreformsAaye-ayeAthere-AganAfixinBoundersAboardwalkAself-defenceCgregationAmeaningsAcraftedAspectatorApagingAimamAcold-heartedAsnowflakeAhangoutAwilhelminaAshoppersAmaidensAseamstressAmegumiBallsAdungeonsAtighteningBaftAshingAralliesAenchantmentAreversingAbeheadAwallowApradaAorbitsAgrovelAconstituteAoutreachAflickerAexpressesAwartsArpgBeefsAoscarsAloveliestAzebAfryerAdisbeliefAunveilingAdissectionBominoesAsubterraneanBaid-A.22AphysicistsAmasculinityAp.o.AaptitudeAscorpiusArudelyAnapsAj'AfemoralAurinateAdaffyAnefariousAaaaaahAunwelcomeAsnowstormAfalcoApadmaAoldenAieaveAtonsilsBactAopticAinklingAmeticulouslyAexcitesBnsuringAabsolveAputtAoozingAarlissAoffendsAnightstandAhushedBainesAconveyorCmpelsAspoonfulBelectingCvilleApropheciesAbayouApazAjawohlAilyaAflierAhormonalBigh-poweredAfarrahAzucchiniAkindredAgoddamnitAa.k.a.AsopranoAphiAoppressiveAgrocerAbolognaAsatchelAdecayingAcritiqueAswimmersAprotestorsBlaidAovercoatAdisplayingAteemingAresponsiveAmetreAlevineAexcavatorAcraftsmanAastronomerAuplinkAtrackersAsoresAlexusBaxAdoo-dooAcrampingBarburetorAtrimmedAspecifyArousingAcommunicatorAhoochAfreestyleAbocaAchekovAbureaucraticAadmissibleAcahootsAothelloAare-BltmanAyapAmerA1936AwankAhoshiArotsAilluminateAhartfordAahabBblazeApoopingAdeclaresAcarlinAstaceAextortAdaimonAbraggAathosAvalidationAlyricAspeculatingAiolausAdinAbroncoAareyouAmalkovichAsaetAimpudentAgangesAenquiriesAdripsAanointedBmidBrianaAstubbsArigsbyAlumpyAgundamAdifferentialAbarterAsorceressApeachyAfive-0ArollyAoutageAglaciersAstirsAhingeAgaffAshankAandresAtidyingAfigsAcrenshawAannexAsimulationsApatentsAorganizerAdecreedAsignalingAcroissantsBonfuciusAtherapistsAvarietiesAumpireAotterAebonyAsymbolizesAcleavageAsiameseBchnappsAdeloresA't.ApatronizingA'moresAfuentesAbefallAvailAlacerationAchloroformAsuedeAmamanAcommandmentsAtelemetryAsmirkAennisAvickersAstupidlyAlatentAbraidsAanatolyApailAedemaAwrestledApalestiniansAmultipliedAbleachersAsimulatedArashlyAlnspectorAcheeseburgersAarmchairAwell-AuranusAplasticsAbucharestAaufAkotoAfermentedAdunneA14,000AzariAvrAseniorityAexperimentationAcalaisAalleviateAsubpoenaedAfoyleAheungAfinelyAquartAinquiringAheartilyAfiddlingBeederAinclinationAfoxyAtenorAclean-upAy-yeahAfountainsAtakerAzuAprudeAinhibitionsAcornerstoneAtoothpickAspinsterAlearyAiedAnorthwesternAvivienneArhoadesAhittinAflokiAdescendsAwhamAtroublemakersAmistressesAconceivableAbargainedAyadaAgroupieCeatsAabsolutionAupgradesAaristocratAspousesBemifinalsAhickeyAstrummingAchowderAtarnishedAbuenoAfillyAbleatsAsuspiciouslyAgloverAboggsAaxelrodAnylonAcranesAremandedAinvertedApinnacleAdeposedAassadAmistakenlyAdruAcountersAfastenedAcrèmeAunintelligibleA'nucklesAhootsBawkesAdouAabolishedAweenieAspringerAhastaAchurningAthymeAradicalsApesticidesAtrusteeAbiggsAstrykerBlogansArubiesBainfallApigstyArelentlesslyAmortgagesAgpaAvaughanAhasslingCmperAtelescopesAheathcliffAbootedAsinkholeAprimordialAinformsAkeungAwainwrightAinaccurateAmoppingAdistantlyAvasectomyAosirisAgreat-grandmotherAoversizedAhwiBaterAgliderAsophisticationApantyAnotoriouslyAforesightAdroppingsAbridgetteAunravelingAseineAfreshwaterAbaggingAsnatchingBhredderAgladiatorsAcremeAtarotAso-soBmartassAquigleyAnurturedAextensionsAchadwickAorpheusAenvisionedAcheongAroboticsAhamzaAtingleAretrievalAthronesAobjectedAdeflectAcheneyAplaybackAfirefightAexclamationAhereticAaltheaAwalmartAflyinAconspireBhildsCattersA1917AouyangBffsetA'enA16,000AklicksAproactiveAcorrectingA1990sAsuitesAreardonAboo-booArelinquishAtntApyreBoint-blankAlulaBeaptAhorsemanAengulfedAvoightAriotingAdocileAmetricAjaggedAstinkerAintertwinedAhourlyAfaulknerAcrackpotAbanzaiAtip-offAsledgehammerAloosenedAembryosAchanduAlagerAbrimAwedlockApeddlerAanemiaAburglariesAventuredAadolescenceAtableclothAheadwayBardeepAbarbequeAverballyAmagnesiumAardenAspitefulBelf-pityAwilkinsonAoomeAhutchinsonAdreamersA135AwaxingAloinsBaughinAcounsellingAattainedAsphinxBaturatedAgroomedAindulgingAhumanlyAnanduAastralAsplintersAogAinfatuatedAgillyAwhimperAuploadingAnamelyAscorpionsAmodificationAejectedAosbornAdoor-to-doorB-dayAshriekApoutAhuntleyAbowersAutherAspamApedigreeAkoichiAdismalAtremorsBamperAhold-upAcosetteAstackhouseAfranckAbogeyBallastAmeanerBccormickAalcoholismAsquishingAranjitAmcgrathAkhaledAinnateAfroAthyroidAmochaAcrawlsAanchoredAsondraA1930AgullsAcircumcisedAsomersetAmicrobesAdeviantAtoutAkuiAhard-coreAflakyAbramAapophisAjaydenAboroughAsuppressingAlorenAconformAxiongAsuiApilateAhave-AaerobicsAtoothlessAmessed-upAhandwrittenAweakeningAsanemAlingersAconsummateAadaptationAshinedAlackeyAheartbeatsAdelucaAcoincidentallyAwikipediaAneutronAhockAsideshowAphysiologyAmigrainesAjean-pierreAirvAalfaAthierryAmanuscriptsAwarmlyAtoppleAblack-and-whiteAanimeAtianaAlyndseyAintergalacticAsupplementalBensationsAline-upAkitesAdianneArhythmsAis-isAkool-aidAtutAsedationAnanniesAincantationAblancAthunderingAmarksmanAsweetenBhovelingBandhyaAheartburnAaidedAsisterhoodAmamieAkrautAendearingAdoolittleAunresponsiveAskynetAregalAbrothelsAvenisonAreal-estateAmichelinAdeduceAstankAknow-howAflunkAdestroyersAwheelbarrowAshearsBedativesApauperAlynAgreetsAaffinityAridiculedAnoaBewsletterAmarciAlivingstonAinflatableApaychecksAkorraAinsightfulAgunnyAcensorshipAramificationsAfélixAdivorcesA1914AtablespoonsAswindleAaccumulateApaceyAlastlyAdropoutAmadrasAquicheAnazAgertAextremistsAdominickAyavuzAtubbsAdisagreementsAseñoraAoversteppedAhomophobicAexceedsConeratedAhumphB-howAcatapultAoverpowerAmidoriAlowersAfeverishAdubAapexA11-year-oldAheadstrongAgreasedAcontusionsAtenacityAremandA'm--iAmarlowAbaaAsubscribersBaucyApartiedAbyrdBroadcastsAsplatterBanskritApryceAguttersAankletAtoshArangesApryorAivanovichAdaydreamAmanifestsAtruckloadAludoAattractionsBrmaniBbaloneAtranquilityAsickoBhopkeeperAkatharineAdismantledBebatesAcantonAsaoClingerAknackeredAshockerAlandfillAmargauxAelementalAworkaholicArip-offApivotalAjulianneAburritosAcloakedAluiBandersAcovetArancherCmmedAmuffyAchrissieArantAprefectAdisengageCnedAbashfulAgumboAresonanceCnardAturnaroundAswindledBtdAcommonersAstarredAkrystalAcomplimentedAnerimanAdowntonAcoolantAretraceAmuadAgoutAescalatorAcommendationAsamarAproductivityAdivinityAbringinAtashAexemptA‐youAprobieAodellAbahtCjoranAantidepressantsAturbineAperfectionistAlevinAishidaAbalticAreassuranceAdamningAbritanniaAyokeAwackAtetsuoApheebsAoverdosedAhudAcapricornAzoningAwealthiestApee-peeAgaggedAconsiderationsAastuteAprotectorsAcoughedAunforgivingAtakahashiAspatialAroweAsacAbuenasA30-year-oldAspudBhushesAreactorsAfiatAtraineesApornographicAmehtaAtucoAkkAfacelessAattagirlAussrAmullinsAinfestationAon-AhoardingAfoxtrotCotworkAdiagnosticsAcruellyA4400AichigoApricedAmittsAhuffAgreendaleAexchangesAassuresAdemographicAcashmereAdaytonaAcalligraphyAbeautAsneezedApeepsAbackdropAscuseAmisakiAdiwaliAc4AbahadurAauldAcraigslistAapproximateAsurgingAmarquezAftlAdmAcangAunknowinglyCcalledAmarikoAinstallmentsAchasteAinventiveAmobilizedAdisbarredBenzelAalbaniaApaulinaAlazloAbustlingA2-3AutopiaAtweetedAscaffoldingAoahuAc.i.AsummatBpoonerApunishmentsAnominalAfrobisherAco-opCnverseAphotonAbunkersApiracyAcristoAyunaArelivingAno-brainerAmeningitisAlupoAfortitudeAefendiAtrinketsAlisteninAegosArahimApersuadingAmergingAfrostbiteAepaAlaineyA'polAperpsAghoulAfaxedAdestiniesAsparklesAkalAcontentedBhezAtyrionBkApaddingAjamisonAbatwomanAsaucesAone-thirdAesperanzaA1,400AliftoffBarge-scaleAgluten-freeAfaeAcontentionAunusedAperuvianAcozAincineratedAcallyAkasieAhanoverAbetoAmaliAhussyAcreatorsAlouisvilleCrdyAfelonsAwaverAgedAsunsetsCperstitionsArecognizableAoléAenforcerAstuntmanAtowingAsellinAhachiAgashAcripplingAandesAzuoAvidalArackedAjabbaAfondueAyieldedAnyeAlocatorAultravioletAsticklerBaddenedApollockAanilAreinventAcitedAstockholdersBméagolBcoopsAimpeachmentAatleastA201Aone-offAjacksonvilleAnozzleAlpAhopsAdraftsAramiroAphilosophersAgcpdAnavigationalAhurricanesAshorelineAposterityAkelloggAgymnasiumAalertsAglazedAwiltonAsamplingAreputableAprotégéAcrustyBollusionAalaikumAsociableBeclusionArobbBackingAquinlanAjailsAirenaAdwarfsBaedalusAwedgedAsawdustCvoyAnotableBapaAalcoholicsAmilhouseAhollidayAdisruptiveAsir.AmotelsAjohn-boyAconvergeCaxBhevalierArevertAhurdlesAkokoAdiemAcountenanceAmaniaAinsureAfonzieAemptyingAwobbleArupaAmajaBosleyBinbariAgivensAmarcianoAnonexistentAfaresAout-AwakefieldAkelpAfeatheredAcorbinAtresAphilanthropistAghoulsAvadimAoxenAhyperdriveAflanaganAjean-claudeAhenshawAmigrateAelonAshatAqaedaApetalAmistrustAcrayonsAor-orAludlowAshindigAroguesAhobbesAadeptAmichikoArisaBekhaAmoldyAlaymanAclustersAlaughingstockAunfulfilledAstudsAnegotiableAfrockAboseAzappedApollardAdecepticonsAtauAailmentAthermostatAsmytheAexpandsAsakiAnairobiAflauntAblissfulAtildaArelativityCcollectAmonikaAdeadlinesAankletsAmauricioAjerk-offAcriminallyAtoweringAsustenanceAfrustrationsAenclosureAstuffsAlookyAbeastlyAalexandreA138,460AplaystationAkandiAfiverAcleverlyAblackbeardAanxiouslyBchAstairAlaw-abidingAdegradationAbajaA1940sAsalisburyAmaneAlettermanAmotorcadeCnstrosityA6000AcardassiansA117AmuyAbrainlessArenalAgazelleAchristmasesAbookiesArenovatingAimogenAtweakAproductionsAdeportAbellowingAskateboardingAneurosurgeonAleniencyAkamalaAalotAtapestryAstabilizingAfaustA1,100AyvesAninesA'ingAimmortalsAhouseholdsAstereotypesBquishBparBaffronAofaAinstigatedAsoullessAresumedBationallyAentrepreneursAnarakuAiodineAchoreographerAluringAmarqueeAjavaAdefamationAacneA2500AsteeredAgellerAchitAarneArealismAmarmaladeAconfessesAsorrowfulAinspectionsAbaristaApreetiAabsorbsAsuccumbedAploughAgutlessAenginAvoucherAupdatingApythonBingingAmemosBallardAbrainstormBlancoAfascismAevaluatedAcrusoeAbluetoothApaytonAjocksAthree-quartersAmikoAgettysburgAecuadorAapologizesAsecondhandAontarioAbaltarAfletchAdownerAblacknessA90,000AceeA302AstonehengeAprobingBierrotAoperasAnascarAveritableAsansAinteractiveAnutmegAblockageAactinAunhandAorhanAcomposureAtransplantsAreddingBainerAflackArepairmanAluckierAinductionAhalf-nakedAdemAsqueamishBpankedAroutedAmatthiasAinwardAwebsAsharonaAresinBagesAenderAdetailingAunmannedAmissionariesAliquidsAelectoralAvividlyAneedlesslyAknow-it-allA'ntAidealistAc.bgAlodgingsAjoveAgennaroAconjunctionCmpetenceAqiangAlewdAexorcistDdusAbogartAundyingAbecAabscessAcollaboratorCexistAtorettoAcanonAascentAyaseminAshadowyA'll-AhoneAdemetriusAcoherentAsosaAlurchAknowedAjaegerAextremistAcorrineCnnoisseurCmmandosAahsokaAsukiBantinoAdejaAponderosaAmunniAerwinAslaughteringAmisfortunesAindieAleafletsAwujiAtwo-yearAquackingAidentifiesAgruelingAsambaAblackburnBekaAvinodAurduAtromboneAmumsAbungeeAeuphemismAcardiologistAyukonAquixoteAunturnedAsasCchinAhipsterAdelinquentsAintermissionAcrackheadApaineAscientologyAmaitlandAinsigniaAhoundingAyu-miAprovisionalAjugsAinningsAhooliganAgnomesAsousAhagueAlookerAjerkedAkruegerAtravellersAproposesBositioningAlegitimatelyApathogenAoutlawedAtightenedAcomatoseAmelvilleAlintAhiltAregulatorAbalancesArobsAgustAcontaminateAakashAlinoAgoddardAdefibrillatorAconversingDcubinesBhrissakeAvexAold-timerAlisAdeloreanAarcadiaAurinalApumaAlife-formAdevilishApistachioAautomobilesBfter-schoolApsychedelicAnyangAmiltAklutzAruffBomiBefuelAlookitAcaroAgrandmasterAsubaruBtalksAmoorBasteryAchristmastimeAsystematicApottersAjâAdaisukeAtricksterBhatâAnavelAhastilyA206AwestchesterAstatisticalAhymnsAdrydenAall-nighterAremodelAakaneAreluctantlyCferralAbestieAmisbehaveAgo-aheadAcuddlingAweldedApreferableAstrategistAlatimerAaltoAieastAbeaucoupAallezAutilitiesArepressionAinsidiousCdirectlyAcompulsoryAbbqAshynessArespondersAbillionairesAraspberriesAcosimaAspasmAimpersonateAhourglassBirschAdoppelgangerAnihanAinvoicesAtextileAnine-year-oldAdojAbinghamAtengAmerciaAdomingoAcosbyAstubAblackadderAcanâCllersAbeehiveAmetasAjadaAhydrantAdocumentariesAnobuAditchesApaulyAdodoAautonomyAthermosArumpAlundBashedAhydratedAfsbAaloofAslashingAchemAbanningAavengingAyamAreggaeAskydivingBhorthandBeawaterAconstipatedAyelpAstepdaughterAinflatedAdestituteA187AzeroesAoutnumberAhenchmanAfather-sonApredatoryAconquerorAunderminingAroostAinfatuationAdarkenedAquartzAhildyAtargaryenAproprietaryAleifAconfinesAbrewedAmuirAinterferesAsandboxAgoldilocksAerectedAasliA42ndAwacoAshilohAnasserAdimplesAsuffolkApop-upAmosheAfairchildAblackwellAasanoAearpieceA'brianAyour-AequatorAseventy-fiveBachsAcervicalAdocumentingAelinorAvisorAromBenovateAmolochAantichristAscabAivfAgruntlngAdefencesAchoeA,0000,0000,0000AsieAquarrelsAoverpricedAfootholdAcharteredAabortionsApacifistAclowningAovariesAinconceivableAdreadingAautographedAstalingradArosenbergBeimburseAmercAkyunAenthusiastAright-AladybugAjustifiesAhennaAcontinuationAaphrodisiacAslacksAreluctanceAkovacsAgodsonAtwenty-sixAenzymesAaccelerantAidealisticAschoolworkApedalsAlessenAhideyoshiAdazeAarmingAyumeAthree-dimensionalAhanoiAdeitiesAclutterAwinthropArelaysAjubileeAfouledCndlyAaftershaveAmidasAkristiAheroicsA97,275A289,275AsquirmAnow-AkhrushchevAjafarAfleeceBabricationAtongsAprevailedAneighborlyAamputateArelaxesAganderAclimbersA123AthomsonAscrotumAgrubbyBeonAfirst-aidApurifiedAbangladeshAgazeboAenablingAcatoAtake-offAaccusesAtrimmingAracketsAperthBawnshopAexponentiallyAdevoteeAharlotAcystBommencingAstorkAmandalorianAdrysdaleAsultryAarguablyAsawingAone-AfiestaAbitterlyAsludgeAoutburstsAgallopAemoryApooperBartneredAcarinaAsliverAparryAembodimentAdemiAviolinistA40-year-oldAbelchesAsavitarAiveApitiedAfixationArenditionAfibreBerideAdoctoredAmahiAbravaAwhitleyAleniAhalibutAfatihAalbertaAdraxArawhideAkeeganAalbeitAmuckingAhome-cookedAexpectancyBmreAtrailersAevidencesAaminaAzeddAtoteCastingAswishAeldridgeAapprehensionAreminisceAmischaAice-coldAgranthamApiersAlatrineAavertA1,300AstingingBpaceshipsAmanoAconlonAblowinAweirdnessAt.k.AproudestAleicesterAjoãoAinfidelAhealeyAenticeAapplianceBbackAtwenty-sevenAsleepyheadAluftwaffeAdesistAsizableCx-monthDesAlaheyAgodsendAshowbizA'thatAstagecoachBnowflakesBelinAinfusionAwastesAstranglerAemperorsAcreamedAvoyagesArockwellAejAbodegaAtravestyAgoryAcissyAadonisAviceroyAovensAcaptivatedAreprogramAbrakingBearableBack-to-backAtreadingBhunderboltAlunchboxAcolbertCdexAph.d.AmunroAlobbyingBinghuAflakAdigitAbrantAtelegramsAscotApsychopathicAbreakoutCacketAsprinklerApatchingAdéjàAclitorisAandersenAlagerthaAdo-overAbraggedArebelledAhordesAdonaldsonAbutteredAstillsBerranoAmatineeAlytaAhoodlumAexfilAcreditedAbellevueAwantonApoldarkAdisownCdnâAshucksAciroAbrainwashingBombardmentAtemperamentalAgonna-BillesAskilletApost-traumaticAlibelAjennerAdidn`tA4.5AinsAdentistsAwellnessAreprieveAnapalmAmotivationalAcorriganBaregiverAbuyeoAstorybrookeAfranticallyAspheresAderelictAsmartphoneAofthisAhalitAcommitteesBaligulaAbrahmsAagilityAtemptationsAsubsidiaryAinhalationAdoniAcuthbertAalgiersAscrappyAhyperventilatingAevaluationsAchileanB.c.AtoadsAsubmittingAmgmAwaterfallsAtwasBransformerAsaxAinscribedAstrappingAarifAputnamAdecompositionAscuffleAroomieBequisitionAgothicAforgerAbrochuresA25-year-oldAyiddishAstressesAparcelsAmicrosoftAvouAniuAwarmestAstowAinciteAthirty-twoAeegAclippersBellphonesAbelittleA1929AweepsAsurfersApaolaAimpromptuAgleamingAbowledBabcockAreplenishApoachAboomerangAuhuraAsternumAdundeeApestsAfirst-timeAdisappearancesAwonderinAlikableAhearthAfigaroAbeatrizBackstabbingA​​​AwiretapAone-of-a-kindAnixBeed-to-knowAheathensAasphyxiationAsponsoringAmisoAkazakhstanAheadbandAenslaveBmbarkedAantiquitiesAwakeyAstirlingAwall-eAticAminoritiesAlavonAcommissionsAmolinaAhazardsClimeAaudaciousBcidsAstylingAunbalancedAshrimpsAholodeckAdeferAsquishyAwoozyAsylarAphilipsBaintballAmiyukiAhollingAdisinfectantAwhatsappAjiminyAcrassAspikingArespirationAgregsonAcobwebsAlieuAhelmutAtransientAsasakiAordnanceAinformativeAbazookaAterrorizeAobeseAjackalAyukAvaledictorianAmesserAillustrateAgymnastAchlorideAlarissaAmitziAlooselyAgiovannaA1,600ArecluseAjiaoAamendBdmittedlyAbureaucratsAvsAunfoundedAkieraAdojinAtwo-manAokeyAlasseAfeatsAestaAdisownedAyeomAmeadAembersAbrungAvegAclaspApintoAfrenchieAcarvingsAblimpBestsellerAorthodoxAa-teamAunhingedAracehorseAcheckinAattestAsplatApheromonesBaroledAvertigoAsecond-rateAmusaAdwellsAplanksAdazedAmcmahonAredmondAobtainingAtournamentsArourkeBemediesAtrusteesAreappearAmontoyaA13,000AstructuredArhubarbAconsultantsAbodenBajorAtrapezeAvocalistAoccupantsAnarrow-mindedAdruckerAaffordedArsvpApubesAlusciousBion-oAempiresAcitationAseñoritaAroyaleBestrictBaindropsAclericalCassroomsAsymmetricalArailroadsApestilenceAoverbearingAextractingAi.t.AwasrtAspectorAravensAembracesBludedAclearyBhffff00AbollywoodAnissanAmowingAhepburnAunsaidAperpetratedAnitwitAdupreeBowAchickenedAhatchingAexpeditionsAwith-AturninAneuroAextracurricularAbabblesAsusanaApriusAhorseshoeAemitAlangeAtrumpetingAscarvesArunner-upAorenAiiveAreinaApartisansAideallyAhatcherAconjugalAassociationsCcendingAscoreboardApaternalAhalf-assedAfrayAdisplacementAthree-year-oldAprofilerAcommandmentAbrotherlyAthrowinAsouffléAremodelingAmittensAdeterrentAbatiatusAanjuBcornAgaitAwagedAupriverAsurfboardAhastenAaramisAplungerAfilteredAdiscordAbundlesAanteriorA1400ApromoBorcupineBendulumAmeeksAdismemberedAnominationsAfairerAexhibitedAdoozyA212A165AstrategicallyAcounterpartApingedAodysseusAjailhouseAmontecitoAregistersApoongAdecimatedAarterialBnne-marieApinningAmaysAdisagreesAa.i.AstrengthenedAbigelowAovercomingAjunctureAgurglesAfalterAabernathyAmollieAbrownsAth-thatAsouthamptonAfauxAtripledA'theyAskylightAmongolAveterinaryAsteamyAprotestedBilotingBeakedAincineratorAc.t.ApeltAcross-examinationAtannedAkilnAconstructingAacquittalAspongesAringleaderApompeiiAharmoniousAvenuesAtsuiAspotterAeinarAwallisAtyrantsApediatricAincomparableAcongratulatingBapricaAtruApotusBlaguesAmanciniAdistastefulAappendicitisAenlighteningAbaby-sitterAseemingApersevereCckingAho-ho-hoAailingAr2-d2AjanzoAfarnonAcorkscrewCnstellationsAreconveneAgaelAl`llAincorrectlyAdougalApimplesBajamaAmelodramaAdavosAbureaucratAmakingsAdisappointmentsAcompostAamaliaAscattingAlive-inAemeraldsAancestryArepetitiveCcommendsAbarbadosAphysiologicalAboresAimfAdoormatAantwerpAlrmAwishboneAtranspiredFferenceBishAsoftenedAgratifyingAcommissaryAbuuAaccommodatingAmarcellusAeatersAbuyinAanchorsArevolutionsAinjunCflamedAfolsomAdanubeAbusboyAorcA33,460AperipheralAequilibriumAdoyouAchechnyaAstethoscopeAjeanineAfacetimeAwheelhouseAvisiontextApulsatingAtolliverAseamanAericksonAouijaAkaijuArecuperateApietyAeyedAconfusesBleanlyA'yaAkalindaAcounteractAputtyAluckedAabileneAnawabAlokAhinataAgutenAembroideredAavoidsAgulliverAenglishmenAcrisAparachutesAfloggedAtacklingAproblemoBinotAdimaBeflectorAchuyAbeowulfAcrumblesAyoshiAsprangBmallsAevillyApacAhuttonAdeterAconservatoryAsimultaneousBheriffsBmAgrapplingAergoAcreaseAretrialAdecorumAalluringArinnaAmessagedAsquanderAkinksAinfiltrationAbackstoryAwinkingAtsukasaAleisurelyAhell-bentAchakraAuninhabitedAtoraAovationAheonAchristopheAburmeseAridgesApolicewomanAneulAivoAbest-sellingBaekjeAtransvestiteAshort-livedAgillespieAbuddingBholaAself-preservationArunawaysAgilroyAcavitiesAmayfairAlandmarksAhazingAcinematicAreputationsAquiAkung-fuAhandoutAgrislyAcan-AorinAexecutorAlibidoAinhumaneA'tsApoutingAjarrodAderailAamplifiedAkalebAukuleleAstoogeAregulatedAlobosAgrapevineAdreaminBetonatorsAnutterAgerdaAtadaAshunnedAkioskAmartínAiittleAwincesArosewoodBesemblingAplanktonAone-horseAgirdleAdunkirkAbadmintonAartistryAsurgesAcorrelationBheekbonesA,cgAair-conditioningAbarnumA432AwilledAspidermanApcpArasputinAdebacleAthereofArearviewAmagdalenaAacademicsAscruplesAreaiiyApolaroidAmanifestedAdepartsAboathouseBewilderedAh.r.AvouchedArevolveBosettaAone-armedAhim.AcatacombsAbodAfamiliarityAdemonstratesAtrianglesAshillaAlemonisAraphAcollectivelyAwaspsAcombinesAendeavorsAcallowayAmohawkBaritimeAdufresneAtrevAligatureApesterAmarcellaAcardiganAspewingApullinAboostersAstefAimpracticalAfarmlandAarmadaBbominableAterrifiesArittenhouseAgswAconundrumAwopBatcherAuscA'norAathleticsAtraffickerApauletteAmoderationAdrapeAattendsAvenetianAjust-justAall-americanAvarunAmatchmakingAgetupAbaldyAspenserArepellentAlitresAdhsAnakAjuliAunregisteredAloonAdoofusBenouncedAwhittakerAalysonA1932AimpetuousAflashbacksAcircuitryAerosionAdokAcarelessnessAapricotArhineAsimilarlyAgrippingAdecision-makingAspiralingBhoddyAenticingAdeppAbarmanAworshippingAoptedAdaintyAsatsAartificiallyAtrillsAflavoredAburrCllpenA'tilApart-timerAmultiverseAdaresayAcrikeyBollaboratingAabductionsAskyscrapersApsychologistsAlighteningAinspectingAfriskyA127AturretAlongsA'edAchillinAblackbirdAzieglerAmagnetismAguzmanAconningAmakeshiftAbatemanAawryAforeseenAcappedAbeetApercussionAhuddledB-heyAfreshnessAup-AschubertAascensionAmaseratiAhabitableAunscrupulousAspartansBmogAnitroAmajoredAlactoseAdyerA1935AnaniAdagAah-ah-ahAencyclopediaAconstituencyAwoodlandAnodeAirregularitiesAcranialBhesapeakeAhydraulicsAderivativeA405AsegmentsBableAnagarAminamiAhobartBightowerAfawltyAyonAunnervingAthis-thisAshellingApickettAfrontlineAbudgetsAwimbledonAoverdidAgougeAfifeAceosApaveAlehmanAkesAhotheadA'hareAaristocracyAconsistAbabelAfluctuationsCamingoAdurableBobermanAstainlessAlandscapingAcrayonBostcoApartitionAfarsiAudayAtuscanyArev.AdalaiAtownhouseApapalAfiniteAmolesterAastrologerChwinApractisedAnow.CgginBiftyAmy-myAdefiantBantonAalaskanAtracerAloafersAknowlesAfootwearAcatwalkAthrivesAsquirmingAgod-givenAscanlanEdinavianAwildcatsAniroAlife-formsAjefeAingaAgropingAfillingsAwheeledAsumoBeunghyeAinhibitorAcarmelAgamerAvillagerAalishaCbinoAbreachesBenoitAsingledCberianBeatbeltsAkayeAdarrowAaldermanA‐whatAketamineAphotographingAeverytimeAactivatingAradioedAoncologistAnisAmodeledA1919AspatulaBcreenedAbikinisAunconsciouslyAradiologyAperversionAkevlarAhandoverAfillmoreBabrizioAcarpoolAbolderBabbleAmortisAhoggingBaltedAcarusoAreelsApyongyangAdemeaningAaorticBlterationsAmurrAhuxleyAdespisesAalightAtrynaAsipsAlaosAanthropologistAmootBaxiAbunksAthirdsAmunsonAlucíaAexpressiveBpitomeAdeckedAviolinsAu-boatAthaddeusAlegitimacyAwessonAsufferingsBlingingAguantanamoAsassAparoAmalletAflagpoleBoldersAcopilotAwastefulAmadiAcilantroAstrenuousBimplifyAoverhaulAdeonAtripodApolyesterAfresherAcravesBorpusAmizukiAtubaAsutraCgeAnazirAmutationsBeta-humanAchiropractorAsouthforkAprivatesBarrotsAmccloudAhersheyAdocsBeterioratedAassessedAobesityAlurksAheadstoneAgoogledAepilepticAdullesA747AviiiAturdsApointerAgranadaAcompressAall-nightAstrokingBchroederAroughedAdumasAconnBartierAvaldezAtick-tockAskyscraperAgalileeAsouthboundAfund-raiserAwithdrawalsAsubtitledArebellingAj.c.A850AzeppelinAnhsAadnanApaprikaAarmanBguilarApreachedAkailashAhaircutsAbrawnA128AuriAred-hotAoctavianAkimberAcornishAblytheAobsessAadhesiveArimsA2-1AvariesApleasantlyBayphoneAincognitoAexcrementAcroniesAuppercutAsinaiAroseanneAcontagionAblossomingAhellsAelectrifiedAcrumbledBhastainAantiAwroughtAsodomAmethodicalAholiAgeethaAsoamesAoverturnAnarayanAmcleodAcalendarsApowerhouseAantelopeAsalmanAreal-timeAparadesAfriskAcouplingAunofficiallyAdeacAanalyseApomegranateAbustleAwarholApleadsAkringleAjim-bobAincubatorAdoleAbrowsingAstartupApippiAmucusAemployingAdocketBawkinsAshayneBcoutedErAkirklandAinfectingAhorsemenAgiacomoAcometsAb.p.AjackalsAfour-year-oldAcontinuanceDdemningBaracasAbangerApuffedAiraniansAgrievousApixieAkingpinAgodlessAcockedCllarboneAboningAsentriesArocApickingsA420AtankedAstardateAalisaAdishonorableAboogerAmisinformedBanholeAcenterpieceAbroadenA1951AsoulfulBelf-inflictedAluxembourgAexercisedAdispenserDcrepancyAinterrogationsAmeagerAforkliftAdiaAconveyedAundisturbedAvaginasApolkAhintingAordinarilyAfilmmakingAdispensaryAtotaledAstringerAman-to-manAlodeAdisconnectsAbicepsBetrayerAcontradictoryAamazesAnielsenAmuddledAdebitAantwonAspeakerphoneAlaundromatAcushyBaputoAdrowsyAtreadstoneAgranvilleAflourishingAdillAmantisAcartonsAbreezyAzealAvictimizedAstavrosAnotherAmisconceptionAlitteredAkineticAdupontAmagnoliaAtriangulateAoozeArousseauAmessiAvalidityArevereAjuanaAgrossmanAvaneAsrApsiBorthosAvitaAtzuAgoing-awayAblyAtwisterAoinkAbirdyA275Aseven-year-oldBardarAoverpassAinfusedAgroupiesAconspiratorsAbreaBatistaAleenaAsprinkledAmoritzAsymbolismArecaptureApleasantriesAmelroseAimprovisingBf-ifAfrançoiseAeahAburroughsApurgedAintellectuallyAfarhadAthumbprintAsaharApoppaAwhizzingAlawtonAtwo-weekAsingularityApsychicsAlawnsAshifterAhueAfatalityA700,000AtrinketBinsAplaitAmercilesslyAdopeyAcomposingAhustlersAfilletAco-pilotAbasingAtsaAshawnaApausedAsubconsciouslyArapidsAfootballerAeuropaAtoxicityAsharpestAformulasBlaggAeeeAtridentAsweatpantsArodgersAmidlifeAjeeringAfeminismAmarsellusAdobsonAaccursedAshariAbidenAatwaterAluxuriesBargoAkind-heartedAgantAfurnishAmarcelaAfrittersAvampAsanjuAembezzledAwhoringAulcersAmohamedAunpluggedAnilAmaximeAabnormalitiesAho-dongAgrangeA'angeloAdisorganizedAyetiAsnapshotAproseAyankingAtrollingAstone-coldApiñataAnegativelyAre-electionAputzAooAdialoguesAbalthazarApatronageAtheatricsAmellyAculminationAzuriAguamAvasilyCnguardAshortedAwaggingAmerchA200,200AtripeAself-destructiveAmuskAljAhomeownerBercAbruntAraftersAthinkersAcretinAbluAunveilAmalwareAlorneAgenoaAcentresAundergoneAhandlersAargoAviewpointAher-AbancroftAlauderdaleAincurredAscyllaArescheduledAnayaAgulpingAaimlesslyAunjustlyAempathizeAclungA201,460A192,210AunbrokenAnessaAmemorabiliaAzhuangAimpressionableAhefnerAsoapsBmithsonianAdeliberationAangolaAnieAheloAgaelicAcomediesAarslanAranchersAhigh-fiveAcoincideBhampsAtexturesAchamomileAainsleyAmaloryAlaughableAinfallibleAfurloughBatherlandAdistilleryAchannelingAtillmanAgleasonAdisarrayAcontradictionsAracketeeringAparaguayAluchaAsoon-to-beAkerrAgearboxAenvisionAdabbleAapparelBmplifyBidesAtropicsAdraftingAundocumentedAreflectionsAprouderAhoo-hooAcommentedAtagonAstamperAquarterlyAcamaraderieAspringsteenAnarcoticAmortarsAladleAfireflyAcraisAarduousApegsAmilnerAlimitingAinexcusableAdetachAyieldsAsabinaArock-paper-scissorsAnygmaAilsaAcleggAblisterAmolestAclotsAbarksdaleAadjoiningBctivatesAtarnishAmultinationalBcnultyAfraudsAclaudineBaterinaAattachéAtigAprogrammesAlombardAthen-AicemanAboneheadApesticideAl-lAkeepsakeAgazApastyAclipboardAswivelBhakedownAnewsroomAgreenwoodAforthwithAplentifulAlexyAjeepersApriesthoodBesetasClhamBantyhoseAmarpleClfunctionedAcrisesAtormentsAparkmanAweathermanAhijackersBandoutsAgunterAeyelinerAdeliriumAcensorAtelevisedAofeliaAmcmanusAduneAkaitlinAhatterAtortillaApluggingAimpartAgrampaAfireworkAdisintegrateA22-year-oldAtirelesslyAshashiAgladesAthetaArimmerAlightheartedAdiasAkajalAcpAtheseusBestimoniesAprobAmarianoAlaptopsAhanleyArecruiterAproclamationAshiftyAimpoundedAestoniaAcultivatingBross-referenceAb.s.AautonomousAemsBffectivenessAcontractingAamiraAtoupeeBabbyAlookieArestrictionAfinkAdestinationsAjaeseokAcutthroatAbenjyAstand-inAeppsAacedApadlockAnerve-rackingAlandlordsAilluminatingAhighlandsAbaluAwomanizerAcomplacentBhickenshitAwinifredArepertoireApleasurableAfowlAbuild-upAinaAcruisersA1912A'karAtimersAlifespanBedgersAkardashianAhensonAsonaAinstantaneousAhunchbackAbriskAantisocialAscotiaAparadigmAlattesAgeographicAlumberjackAbroomstickAsmoothiesAhdAfetchedAbookcaseA185AmeechAindicatorsAhe`sAeulAworshipedAelatedAbelizeAfrightfullyA'aiAtennerAmarinatedAhand-to-handAdiscourseBecreasingAconquestsAbrain-deadAvidaAtandemAsigmundAderailedAcautiouslyAbluntlyAmishraBarysAjyotiBasAincitingAhoarseAvirgoAsurveysAmarlinAjaneiroAferhatAblighApainkillerAimpedimentAhesAsivaAromyAintrepidAclogAarrhythmiaBaarghAswabsAquiveringAprevailsAhaitianAcampionAunbecomingAmanchuriaAhoiAdkAbereavedAnaokiAbartletAresistsAprimateAobserversAwell-behavedArealistAplaymateAhoodedAgustoAenemaBcologicalAtime-AshroudedAmidgetsBethadoneAworking-classAvelcroAsizzleBelf-sufficientAplaintiffsAmagdaleneArougherAclarificationAabolishAtoidAextremitiesAtakedownApackardAwagAmeteorsAintestinalAadversariesAupholsteryAtokiAsignifyAwinonaAtailoredAsachaAprenticeAkeelerAdissentAbulgeAambienceAmisuseAjuilliardAdorkyAc.t.u.AbraydenBoggedAsplatteredBhortenedAmulletAwhoa-ohAikAsaladinAmulanCggerBogulBackieAiconsAgrippedAdevouringAreactiveAincorrigibleAglancedArudimentaryApiplupAhardballAfrenchmenBatheredAeuphoriaAdiscontentAuhhhAsigmaAnullBappyAlamentAjihadAlollyAkirstieAgardinerAfalsifiedAbenevolenceAstarfishAprodAdipsAbastilleAswedesApansyAoldieAraffertyAqueersAjolieAgoranAfscx100AbeecherAschwarzeneggerAmedicatedAhoardAbacklashAjuriesAattentionsAzukoApruittAlirasAfocalAslurringAreferendumAfixturesAbaggyAwieldingAdefectedAconjuredAblockbusterAmidtermsBehraAfirst-handAcynicismBertificationAkaedeAeraserAreasonedAnatsumiAgiulianoAcynicAtakiAsalvagedAroarkBeally-AmorayAtubsAexpoAoutspokenAkissingerAhélèneAcancellingAthriftCereinAorganisingBff-keyAkreeAcolsonBleanlinessAspeedsterBcurvyBaltwaterAcoonAshuangAgoodieAyachtsAgorbachevAespnCophagusAbleepingAlongitudeAcalumAbonedAsinhaAlassoAepiduralAargghAtwenty-eightAsheathAcommentingA155AuncheckedAsharifAraptureAbookshopAsymbioteAbandagedAatropineAzanderAshinjukuDbuyaAfacultiesApontiacAgermaineAªiAa.c.AshaqBcammingApingsA120,000AwillemAgasketAacostaAdanicaAsuzuBcrewyAbartowskiAtoshiAsay-ApaisleyAlukAadvantageousAsummarizeBcrantonAquaidAkleenexAizAconfessorAyamsAtranscendAjansenAnuptialAmortgagedAsuoApimpingAmasseurAhollisterBardenAgustaveAarchaicAnasirAlucianaAtaskmasterAroyalsBemoApeetaAmontAinquiredBlluminatiAdisagreeableBeteriorationAblueyAsnapeAprecedenceBopsicleAjezAeustaceAcommonsAspottyCinnerArunesAoaAfoalAdarinAstowedAprepaidBicnicsAkonstantinAbistroAundetectableArefineAmikesAlymphAgroundworkAchop-chopAself-helpAposteriorAcaptorsAprejudicesBeriscopeAozanAgradualAdiggleAbloggerB-butAsurreyAoverheatingAboostedAnitrousAkatrineAjokedAherculeAfishinAdisbandAclinicallyAboyzAsculptedAfabricateAverandaAsunburnApersiansAluminousAantsyAsianArewritingAsocketsAhalf-breedAexcavatedAclackBgArhymingAwatchdogAnyuckAidrisAgogolAdiscernAbroderickBlogsAlannistersAhyangAchompAshabbatBcouringAlionessAcaptAyoghurtAreconsideredAdrabAtightropeAsolsticeAremnantAknobsAdillingerAhenleyAdaliaAfoolinAspriteAmoverBisfitsAyazAexonerateAdudsBoublyBavideAscribblingArecourseAmamboAintersectAharmsAvagabondAseminarsAmangerAbride-to-beAlawlessAbystandersAzoomingAshoot-outBaxonsAlivenApunsAoutcastsAmartinoAadderallAtiptoeAone-yearAhondurasAarnoAthangAnielsAkattegatCbaddiAhippyAdividesAventuresAunitingAcoppedBhiltonAspiritualityAjumpinAicelandicAgalapagosAsolangeAextensivelyAdoradoBentedAcustodianAscreenwriterAplumeBaralegalAmcphersonAkyoAeducatingAboarsA'thereAprolificAmetaphoricallyCdiationAhempAfairbanksAnear-deathAbozosAwarlordsAschoolyardAhabibAcoercionBlementeBhimeraBelibateAaloftAunconfirmedCanimouslyApackerAcorcoranAriddlerApardonsAkochAtake-outAsarajevoAlendsAkoalaAdiscountsAbossingAariesAclogsAamonAvanderbiltAsecurelyAflooringAsportyAmelodiesAilluminatedAviuArichnessAoffencesAadriannaAvioletsBentriloquistAunguardedAtrimesterBhis.AmaconAabuelaAoverheatedAdeviateAcajunAstarksAdinkAbradenAargentineAmicsDrofilmAlegislatureAcoutureBhutneyAunitesAswainAnatsumeAlovemakingAemtsAcrappedAundueAoverpoweredAmouthpieceBacabreAindiscretionAhunchesBahnAgastricAcrosshairsBompatibilityBentimetresCcilyA'unAincarnationAwakandaAunsavoryAtoppingsBhwartedAshamelesslyApinoAnarayanaAlock-upAbootlegAreclaimedApacifyAciteAblue-eyedApeacekeeperAhitomiAcanesAadiósAundertakenBh-hmmAmasterpiecesAaokiAfaridAbrowneApartisanAfirAdinghyAconfidantAdoggAangeliqueBll-starAsearedAmopeAcongresswomanAarmouredAebAbreadcrumbsA17,000AenhancementAcycloneBoastersAtroveAstiflingApastramiAliberalsAchardonnayAmanoeuvreAfryeAephraimAfaberAsubtletyAfuturisticAblowtorchAjinxedAanalogAu.s.s.AemitsAdamnitAbuzzardAsadakoArakingApredecessorsAmorleyAleopardsAchaletAgannonAharnessedAgraspedAfscy100AwrongfullyArebAleonidasAinefficientAtutorialAfooAcupboardsAbulkheadAprototypesAluauAtagalogAséanceAnorthboundAmigrantsAlividAcollaboratorsAsturgisAnorseAmoonlitA9mmAweasleyAterrifyAmirAregistrarBallyingAmanaAchipmunkApluckingAdenturesAgigantorAeconomicallyAdazzledAunaffectedAtaikAleonidAestellaAconvertsAthingiesBennysonAstatisticAnannaAindividualityAbreakthroughsAla-la-laAgranolaBod-fearingBaneshaAcasparAsevensAmutilationAcrackleAsupermarketsArole-playingAquiverAeradicatedAberetAstifledAoshinAchummyAboingAankaraAservicedAdookuAfredaBluorescentAeugeniaAbristowAvasesAnarniaAmmeAfoieArefuteAimpossibilityAungerAinsurrectionAdoñaAromancesAassortedAswelledBtillnessAlinensAhallidayAgloatingAadalindAretrievingAesterAdaenerysAcesspoolBrusaderBannibalismAshow-offAoftAnurembergAkarachiAdefinitivelyBarAclosenessAtarekAsnivelingArandiApattingAnice-lookingAluciAinferiorityAhurtinAbackpacksAwell-trainedAmediocrityAkaosAgleamAbaronsAadvertAluvBawnmowerAinsistenceBllustrationAhouseboatAunrequitedAnavigatingAconspiraciesAspringingApharaohsAmemeAlaneyAheadmistressAdietsBedeAcoulterBaterersAsnapperAhajiAsimpletonApulleyAhumveeBintedAbreenAzhuoAsuisBeedyAparmesanAlidsAfriscoBiendsAkimmieAindulgedCcompatibleAgringosAcaminoAaversionAtupperwareAstowawayBnottyBiegelBcpdBparesAnitaAmumbleAlumbarAeastonAvouchersAubbeAhas-beenAexpresslyAcoordinatorsAwallowingAincarnateAdahmerAschillerAmisinterpretedAalbrightA철의AserenadeClf-madeAreedsApulpitAkostyaAickyAdesertersAbilliardAstimulusAhittersAtubbyArwandaAimpositionAcomplicityAsculptingAdissuadeAmullenAirritationAgoalkeeperAjutsuAimpaledAforeclosureAdickheadsAbayonetsAawakensBcidityAimportsAfillerAwiedersehenAtunisiaAmyriadAandoBboriginalAcrematoriumAsedimentArodolfoApetersenAjubalAemptiesAmolestingAcornedAunnieAsarcasticallyAnoorAbaselessAtwo-timeAcomputeAsocializingBhitterAhey-heyAcovingtonAbrynBleederA1934AthirtiesBerrellAradishesAqueenslandAperiodicAgyeon-wooAcongenitalAstockbrokerArhinocerosAmm-mm-mmAjiggleAfoonBlourishedAaberdeenAtolstoyApdaBaellaAkoenigAcluckAapplicantAviviAsolicitingAburakAsimaAhaasAfeeiAdruidBefiledAsnowdenAplaytimeAcastileAarchangelAtorchwoodAstimulatedArealisticallyAoverpoweringAmuchoAassessingAwilliAnadjaAtrigger-happyAmountsBadderAflanksAcravingsAbionicAshuttlesAjumpersCdaismAvedaAtaubAstay-at-homeAreceptorsAoutsmartedAlitreAilanaAhorusAadvisableAsleekArollieAmorselAfirst-yearAcreteAbozerAamenitiesAsluggishBanadaAnervousnessAfundamentalsAcongressmenAngoAmaniacalAgroovesAallottedAtoffeeAhardmanAdivertingAhustledAdoesntBispelA45,000Ar.j.AcogAelroyAdoingsAchappieBaribouAsiftAemittingCbolismAbefittingAyamashitaAspoilerA'soApullmanAeyelidBarfulAcrepeBompressorAbirgitteArihannaA'est-ceAbatteringAappreciatingAcrowdingAshackledAryookAobstructAlullAintroducesCcaAaugustoAwagingAvigorAshakaApedicureAbiologicallyAworkmenBell-dressedAsiphonApalmaAdeckhandAclovisBarneyAspooksBieveAre-entryCalisingAco-operateAbavariaAntAhesitatesAbetelAzillionAsubatomicAmetinAassassinationsAsanctumApiaceAmoronicAkayakAincumbentAchit-chatBandorAbrendonAyowAspasmsAhitchhikingAboogAalpineAcheatersAtendonAmuddleAgoateeAtrampsAloathsomeApledAlillieAcatwomanApreAnagaAelectiveAprecipiceBaralysedAimaAgambiAbeaversBaratheonAsexesAryungAlupusAkirstyAjitteryAexhibitingAcontendersAunpleasantnessAfoliageAevadingBonsApreservesAlexxAjang-geumAcmdrAsaverAfloweryAsteadfastBahebApanditAatonementAwhupApamperAlifeboatsAepinephrineAchilAbefriendedBaskAtouredBinkeringAghanaAfemmeClineAescalationAtreadsAraineyAnowtAgustingAbasqueAtaiwaneseAhennessyAadoringAlaborerAhorstBeaderAchandaAbozBismarckAtiltedAensuredAsecretariatBagarAkushAevaporateAchewsAassertiveAunderminedAtataAkunlunBnittedAigAhomelyBarcourtAgnawingAkantoAsnapchatAjor-elAcirculatedAailsAsconeAresyncAmassaAteamingAnyssaAdenhamAtenderlyAmookieAzapsAwinkedAversaceAunsuitableAsandstormAkaylieAhilltopAwestsideApretensesAlothbrokAiittieAdeteriorateAbaymaxAmiaowAculverAbumpkinA'tjustAresilienceApac-manA1931AzebrasAwristwatchAscavengersApicturesqueAnairAknaveAcowgirlBlarifiedAatticaAsewardArenatoApetroleumAmoonlightingAfinneyAtrinidadAgallowayAconveneAhammerheadAsupervisorsAlazarAjohannesburgAservitudeBcorseseAinduAcenkBalvertAyou-know-whoApandasAmarillaAkahlanAanarchistsAwartAkrakenAhush-hushBalliwellAadvertisementsAsussexAperfumesAmassagingAliqueurAkookyAipoAavidAunderstandablyAsquintAprowlingAmalteseAgrittyCaingerAappraisalAswordsmanshipBullenAmarsdenAliddyAdomesticatedA207AthoracicAstimuliBforzaAmingyuBanualsAkraftAaquaticAtweakedArespiratorAstringingBniffedAgradingAcalypsoA325AultramanAtracheaAprimatesAnormsAminotaurAchakaAjotAdidierAcliqueAteleportationAoathsAbloodhoundAmansionsAcochiseAboeingAcomplimentingBarolsA203AvaluationAtwo-year-oldAqueryAfondaAcrusadersAtallahasseeAfeudalAeruptionsAcommonplaceBabbagesAscaffoldAleasesAtweezersAkwameA1.6AkellermanAhubrisAcocksuckersBentimeterA192,220AsquanderedAroyallyBearrangedAlagosAjeopardizedAgermainAtheologyApurificationAloxleyAsatoruAredactedApassoverA'kayAfreyAensuresAamputationA1.3AundressingAquarreledAnourishAincendiaryAgerhardtAfinnaAdahlAsharpeningAreelectionAmiriBecnunAiguanaAt-rexAsenoraAhuxtableAdorksAamalAsheenaAeyreAdouble-crossingAbreederAtrampasAnadyaAkidnappingsAgrosslyAardentAponyoAmiserAdeejayAcross-examineBhevronAblatantlyAsyringesApieroAmalachyAdepravityAwesterosAskylineAhardisonAgruAdonatelloA310AworkshopsBindscreenAviveAtejAcustom-madeBonstraintsAbeaufortAslowestAlightedAfozzieAcaiiAakuAvigilanceAentailAcuppaArespiteApromiscuousAsidetrackedAnochesAcouriersAamazonsAindicativeAculturallyAbackupsAyosemiteAvomitsAesquireAweiyoungAturmericA'sjustAsignoreArosebudBesortsAbolsheviksBetrothalAnutritionalAmaisAhummingbirdAdecentlyAchittyAbuckingBarricadedAstatesideBhinichiAhughieAelectrodesAwaveringAp.r.AgizmoAdegradeAberingAhtAflayBibAcondensedCldsAtoughenArancidApresumptionAembalmingAtweetyAkwaiAexecAbedriddenAknightleyA'elannaAcrossoverArenfieldAparodyCncreaticAglidingAfontanaAcohnAauctionedAinoueAgwendolynBiffordAsolisAmasAlndiaAestimationAdrywallAwesenAschooledAnugentAmemorizingAdinersAayeshaBllocatedAtetheredAproficientBleasAvagrantApensionsAhemorrhoidsAezAabstinenceAwhiplashAleavenworthAveiledAunderwentAtempestAwalledAthree-hourAjalalAindecisiveAchibaAvaporizedAturingAmozAliveryAdesertionAbillion-dollarAgood-byesAdiceyAatreidesAumiArejoicingApissyAjesterAhairlessAdress-upAbodhiAinauguralAgottiAi.q.AcavalierAvarmaAturbinesAretreatsBamoAperoxideAmesmerizedAillegalsAhadiAexeterAdeckardAintubationAbagpipesAsvuBaroyanCppyAjeopardizingAgreenleafAcooAmotownAsuspendersCn-wooAmagnanimousAfixtureAdismountAchumpsAgovindaAcladAbuttonedA375,5AsandiApumBlaceboAooh-ooh-oohAmormonsAlukewarmAkubrickBayoAindescribableAchimpanzeesA126AentrailsAdowntimeAcafesAarlenAtractorsBoruAmacarenaAcleanestAsmokersBalomeAjauntyAbuddAstiffsAplayfullyAmageApelletAenlargeA24-7AweinsteinAcervixAtakaAsennaAmountaintopAhurledAbulgingBlackpoolA375AtemperanceAsenaApostponingAkravitzBishoreAjanekAheipAempoweringAreiterateAdisobedientBesertingAclappedAbapuAprovenzaAforsterAbootiesBarnabasCkesAtreAsculptAconcoctedAserpentsAmonogamousAearleAconchBhildlessBarteAassailantsAkamikazeAflat-outAvesuviusAundiscoveredAstandishAinfluencingAhelpinAcfoAstatutoryBatomiAmauledAinactiveAdecommissionedAclairvoyantAamputatedA10kAweaponizedAswahiliBaturationArectumAhalloranAmerrittAderryBadeAberettaAteacupA'sheaApunitiveAtreatableAshreddingAji-eunAgérardAsombreArononAchewbaccaAunfoldsAturquoiseAhenningAeyesoreAcarlitoCnyonsAbarmaidAosgoodAjailerAdumontAbaboonsAsquadronsArevisionAmightiestAbooby-trappedAregretfulAfinalistAbaleAminxAexposesCcessivelyAcuckoldBraftsmenBhapoAbluebirdCeepsBitchinAalexiAw-wellAtressesAsay-soArestitutionCinerAlurkAcourt-martialedBalleighAawkwardnessAnanitesAlovellBangfordAw-whyAsokkaBeekersAneneAmathewAalienatedApimAdominusAbroylesAsickbayAgesundheitAcrumpledBoursingAalvaroCbieBkinBffirmAlong-timeAgeriAailmentsAroutinelyAimpatienceAhuffingA340A1916AundividedAthree-yearAshelCamingAblabbingAvaryingAtruckersApursuitsAmyrnaAcrocAstingerApasqualeCleyAmayhewAebenezerAlow-lifeCllipopsAcaydenAsplintA'sheApasaAobliterateAfingeredAemberAaristocratsBpologeticAorgiesAcryptoAsoireeAoutlinedAeconomicalAdevoteesAwankersAredecoratingAmeatyAin-depthAentrapmentAclassifyA7-elevenAendowedAavenuesA8-year-oldAtortillasAgroggyAfungiBraughtAbothersomeBamsiAyuraAup-to-dateAoverdoneAmagnaAdishonestyAconcoctionAaoAseanceAoreganoAimperfectionsAdebatedAchauAborneoAadventurersAprotestantsAgo-goBawainAcoresAbedbugsAastroAresidingAentailsBijiAappointingAupheldAsymbolizeApiyaAkepnerAburlesqueBroken-downAadelineAuncutAshrugBarinAafreshBbandonsAzincAshoelaceAbodieAjuniperAhamlinAgalindoAflorianAreplacesAconsentingAsynonymousBcot-freeAparadingAh-heAavinashBgamemnonAsardineAprozacAmolotovAhortenseAdobieBetaineesAbupApostageAgutierrezAfatsAtteokbokkiAstreaksBlackerAchaunceyAsaxenaArelayedAmily2BcneilApoliAhodorAchoralArykerBomulusBamsesAgimbapAoutgrownAdeuxAliversAgacyAsuleymanAmariamAkotaAcross-referencedBlothsBheckeredAbecksBankrollAadequatelyAup-tempoAtheresAsofiAmajidAtotsA's-heAprintersAnon-existentAinequalityA,defaultAbreadthAarethaAwingerAuncoveringAprecededAnavAchevroletAuniformedAtemplateArawlinsAexaltedArosaleeAkeeneAgondolaAfondantAkaoAhuggyAgeraldoAperchedAichiroAratanApapayaAorgAmandrakeAcemeteriesAbetter-lookingAwhirlpoolAsulApositivityAmalayAevergreenAbestiesCgoneAprussianBarishionersA235AsãoApseudonymBruAfloggingBeenyAcompadreAkeyedAhonorablyAdeductedAcrayfishBonstablesA'nealAyukioAtwo-timingBhiA‐noAmaimedAjean-paulAdishonoredAcutletAbabetteAsteersBhrewAfaisalAsanatoriumAmnhAeightsAyeagerAinvulnerableAfabledA72,432AthurmanAindiscreetAfactualAdiscontinuedAcossackAblightAvettingBarnishAtobeyAsurAlowdownCrcaAiostAbrahmaAwomanhoodAtwo-dayAsmithereensAriverbankAmegaphoneAkiffAheh-heh-hehAbangersAmodellingBanonAithacaBnstallationsAunderprivilegedAmaximilianAstockpileArun-of-the-millApeelsAdutifulAabuserAkatsumotoAintermittentAmayflowerAhinaAgiraffesAskitBemperAmathurAwizAscrappedAkondoAglamAochoaAman-AeliminatesAwhereinAthirty-sixAhorseyAgladstoneAlovesickBentilsAkiplingAjangleAvigorouslyAregainsAimprintedAbikingAtruestBablespoonAshaggedAplowingAblackenedBestestAalgerianAlitaAdawningCmsAunwaveringAsamiraAprancingBlungingCaythingAinnkeeperAhakuAglisteningAuntrainedAtuskBranquilizersApoltergeistAmodemAgutsyAdosedBarkroomAquadrupleAnosAmeetinAideologicalAventricleAmosaicAlymeAcrudAbelvedereAwipersAtolerableAsuffocationBhirtlessAgearingA122AtusksAknockinAethiopianAdraughtBiddleAángelArockiesAbuckledAreunionsAeceAdiorAbrexitA0800AwilliamsburgAus-AtaxingAkronerAhigh-qualityAtransmittersAsquawAmartinsAfigurinesAaisoAvascoAtankersAstoolsAradioactivityAnomeAhindranceBarrowingAenvoysAcomputerizedA4,500A1910AtrashingAsmoochesAmid-tempoBediatorAburnersAarrakisBdornedAinclusiveAfatmaAcreepedBlavicleAtreatiesAmournfulAgildedAeunuchsAcopperfieldBastratedAbreak-insAashbyA215AisolatingBneptAbardAjuniAfigurativelyAemploysAyushinAtremblesBioAsayingsCnitariumAmufflerAlacAflamboyantBirst-everAstokerAno-AhydrateAbuongiornoA145AregressionApuffingBhotoshopAintentsAcorruptingAbylawsBowdenArikoBazaAghulAartisteBmusesAtamarAreprimandedAgentlenessBangreneAdivedArenéeApiranhaAlobotomyAgoodeAtubingBravAsusuBquabbleAchlamydiaAblacklistedBiometricAvineyardsAstreisandAqualmsApiscesAfutonAdysenteryAlunacyAinflateAgarberAblockheadAanikaAyamaguchiAsucculentBquidwardAexceedingAdrumstickBing-dongBecidedlyAcomandanteAmartyrdomAimprovisationAfemaAchemicallyAanchorageAmamasAliquidateCkeableAdown-tempoAaspirationAmannequinsAfarrAeughAairwaysAirreparableAfilipAbhaskarAstaplesAgearedAfibresAbehestAeonniArizAmasakiAloomAinstitutionalizedCdirectB1AfashionsAdefA1928AwassupAumbertoAteganApunctualityAnotorietyAenigmaticAcelibacyAbafflingAtryoutCickleAsynchroAmakinoAlansingAhaggleAgrievedAdolceAteagueAshadowingAmaneuveringAhard-assAferbAcoffersAwaltzingAsomApattiesAkinkAcobAallowancesAsubtlyArayaAmilanoAloavesAtrillionsBidiedArasmusApondsAgiddyupAdimwitCgitallyAclemencyAabundantlyAtimbersApurrAorneryAsagittariusAportsmouthAoxyAlymphomaAhellfireAd.b.AbloodedAttAsend-offArummyAnyeoAishikawaAhinesBairbrushAfantasizingAchopraAapocalypticAcaratsAsunderlandBterilizedAoverstepA'myAflip-flopsAangstAsneakerBkedaddleAremoverApigtailsAlook-seeAepicenterAdisabilitiesAinformallyAbeat-upAairyAthunkAchinkAanxietiesAoutedAnewbiesApeddleAdeniabilityAclottingAbookshelfAyukaAu.k.AskepticismBinaloaAkunalBalaAbustinAwhispererAstalagAquahogApinkertonAmarquiseAevaporatedAcharltonAapologisingAplumbersAkinshipA-iAazadAsunupAkenichiAitty-bittyAbullionAak-47AcommiesBincoArheumatismAkosovoAheartwarmingAeggshellsArhinosAoverhearingAmaroonAimpalaAgrovesAdiyAclassificationAterminallyBaffyAoptAfootmanAdoggiesAwimpsAsuspendingBherApaddockAold-timeAmumboAfableAracineApetitionsCstoAwettingArenegotiateAprecinctsAdugganBictatorsAatriumAnoreenAmisdeedsAfastballAmotifCldsAdeviationAmasterfulAgloriesAellAdemonstratorsAconfederacyAanyhooBmassedAhartmannAapologisedAgayatriAfeastingAdaniloAaabriaAsabreAnuthouseAlecturedAkindlingAexclusionAcornfieldAtouAno.1AmoundsAgluttonAcardinalsA460AscatteringAju-mongAinnermostAcomputingAaurelioAunnamedAimmaterialAastoriaArehabilitatedAgrandmothersAblotAunreachableAtomboyAscatAdowdA116AtwineAsoybeanAeditionsAcaptivatingAanecdoteAsathyaAlathamAhoffaAdugoutAchihiroAautopsiesBggravationArenouncedAponziAmotherlyAhalf-sisterAegotisticalAabbsAmarshesAexcelsiorAvaudevilleAsmiteAplummetAnosingAmultiplyingAgo-AembargoAcoleslawBhippingCechenAwaterfordAself-absorbedAoutweighAhikersAcolAamokAzippingAtermiteAsuzeBpacingBensibilityAmarkyAkobaAgoddessesAcomprisedAbesiegedAtraumasDpperAnotchesAjezebelAhorowitzAfrakAtestifiesAserraApushinAnoonanAmouth-to-mouthCinesAluresAjoyrideAgoyaA121AlaloAbixbyA113AsnitchingBaburoAlataA1700AtoastyAsnitchedAmournedBatsumotoAx-filesAputaAconklinAupscaleAtacAstalemateApragmaticAkneltAamplifierAjammerCdedAgawkingAfrowningAruyiBeminiscingAirrefutableAballerAuntowardAhangersAadornAwrappersAspinesAnutjobAinaccessibleAcorrespondsAboostingA1300AschematicAjosãAhaneyAcuminAnuysAlzAfriezaA411AmaskingAfreesAunmistakableCgodlyAtylenolArawlingsAmetabolicBcduckAdarenAsolventAredecorateApiccadillyA'keefeAworthingtonAscrumptiousAravenousAquayleAmarinadeAgroundingAfοrAdecompressionAspewAprocuredBlantationsAjakeyAinflictingAfakerAdigginAaffrontAsmotheringAmaquisAdisgustsBegeneratesAbeanieAwheezesAtraitorousAmouthwashAcruellaAall-newAnarnAdartmouthAcomethBhivalrousAsmoochingAperseusAheart-to-heartAdrivelA351AsacramentAman.AhideawayAeonAsuntanAremissAinconsistenciesAepifanioAdiscerningAconnellBhasmAturtleneckAshortnessApaloAmoragAadvisersAultronAtinnyAgrouseBermánAestáAzoidbergAtanzArenuCcitedAkegsAfantasiaAsunderAresuscitateAforty-eightAceasefireAnooooAbeyonceA273AstéphaneApramAloinAgood.AcagneyArusselAlyndaAkasperAagitationArattingAleakageAflooredAlesionAinvaderAhayateAdeletingAchimneysAsjAredfordAnobodiesAearnestlyAdexterityAarmitageAsincerestAriffraffAlyBundyBowlifesAgrumbleBalahadAdisposingAunifyAlobesAkanoA8000AwaveriderCrnsAeppesAunlicensedAswerveAkofiBiiiAcrazy-assAarminAwaivedApenchantAmahoganyAchumsAbargainsAparleyAdismantlingAswigBouthsideAraiderApitchersAgentlerBaulsAdissipateAreapersAillustrationsAdistributorsAbriarAsparkingApappuAkionAasterBriannaAvicsAtirelessAsafesAingeAcuttinAyeowAusefulnessAsluggerAnostradamusAjuanitoAghtAcavernsCpriciousAsacrilegeAentreeAdeployingAclawedAbodeAyonkersAhedgesAasunderArenoirCdevelopmentAgenitaliaAfatherlyAanaestheticArealisesAoff-roadAgolemCingsBillisAforlornAnostrilAjiltedAtwitteringAsuleimanAi-i-i-iAgruelAwolffAsupersonicBakamotoAparalyzeAnevAin-inBf-AdriftsAcountermeasuresAacronymAhazelnutAconsistedAabbaAthawedAsubstantiallyBparrowsBáturAnaduAleewayAbombardedAapprisedA350,000Avice-presidentAskewerAo.d.AenduresAdusterBeepaAassortmentA237Aself-interestAomensAiuAeducatorAudonAtyrAstardomAroshanAweakensAthaneAhereticsAanvilAwoollyAspecialtiesAquirkApaxAeggheadsBepAdissolvesAprenatalAludmilaAeatonAcoupeAbrisbaneBishopsBallgameAwherebyAnonprofitBiruhaAleprosyAgloballyAflippersAcreweAworkupAsawsAneighbouringAminionAlubricantAkwokAgrouchyAclaudB.e.o.AslavingArentalsAlimesAhigh-riseAenrichAbuzzersBanishmentApreyingAgridsAbuggeredBestedAtraciAsmeeAduvallAbeaterApiotrAhardwoodAcaptionBredBinderAalphabeticalAsommersBlummingBhrillAmesAstockadeA'noAmathewsAdouseAcrucifixionAsubsideBpraysAnarrateAmdmaAkayleighAarabellaAyearnsAscoffCallopAvandalizedAsãAryokoAfawnAunsupervisedAscriptedAcoronavirusClossusAaydanBntiquatedAwilliesAtransgressionsAishAsimeonAmortenAdribblingAconstipationAtroiAobeysAgautamAcheaplyAshishioAgundogduAbros.AvaccinationApagansAnztAlatchedAcultsBosgroveAprimerAafter-partyCfluentApushpaBanicsAzitAstonewallApiazzaBeppinoAlyricalAspurtAjabberingAex-copAbriscoeAopportunistBbelixAnomiAisraelitesAtumBhrusterAmotoAflogAbasemanAwelderAstahlAmainsAdorseyAboiseAmamoruAforcepsA0600ArationingAp.e.AmommiesAgratificationAbut-butAaristocraticCgusAwigglingAsahilApressurizedAconfoundedAbongoAftAwooingAsuperstarsBignifiesBheenBenoritaArouseAhaengAgracedAeyelashAcurAadvocatingAdigestedAchappelleA5.00AtambourineAneverlandAmckinneyAlandownerCboratoriesAgonorrheaAforeseeableAbattlegroundAwolfieBarringAmarceloAloveyBegislativeAhuaiAbrainstormingAkouAbonnyAyoussefAxiaoyuAturnbullBamaAsystemicBpansAkarpAcongaAyessirAwukongAspecializingAdeep-friedArangingAgordieAembezzlingAcouchesAradfordAbeatinAresembledAindustrialistAexemptionBntertainersAdohBisintegratedAconvenedAvoltaireAtoenailAso-and-soArivetingApick-me-upAyaraAishmaelAapostlesAzooeyA60thAyamazakiAtendonsAryongApompAjordyAbarbecuedCckwoodsAmiddle-earthAimbecilesAbogeymanBeginnersAamitabhaAοnAunwittinglyAshhhhArotorAimpAhypertensionAwatertightAvivekAsteroidAmanipulatorAlarynxAhonkyAreappearedAobscurityAmunicipalityAkadirAampsAsusanneAdismayAvexedAsithBadettinAnuoAinexpensiveAarsesBcornsAoatesAtranBanoAsoddingAlainAundecidedAresAquakerApocketbookAmansAkimbapAisâBmperviousAassimilateArovingAmilkshakesAjavedAcringeAbloodstainsAadministeringAutilizedAimranAgrassesBanzDacheAfortune-tellerAmottAtuanAstumpsBemblanceAgeometricAch00ff00AtacksAsmurfsA1100AwonkyAnumbnessAkeywordAiainAbobbingBequeathA720Afifty-fiftyAcanaanAazizeAv.i.p.AsymposiumBomething-BhinglesAkazuoAjudiAinstaAbrimmingAs.s.A's-her-nameAsalihArescuesBalliedAimpersonationAtunicAsauerkrautAroniAjusAindigoAshouAndaAmahirAheavingAthurstonAsiyaAmanjuAgreyhoundAunificationArevolutionizeCtainingApeekabooAinanimateAabductingA1922AmoraAlocalityAguidebookAworsenedAupheavalAretardsAottersAjockeysAanthropologyAdepositionsAtossesAkhloeAwylieAswervedAenactAdorotaAchurnAshowinAnatalyaAmidairAbulmaAacidicAwhelanAvixenAresoluteAputridAhatfieldAfalafelAenrichedAdouble-checkedAchandniAaffiliationAzingAvidyaAperfectingAgwynethAdepictAclockwiseAbrimstoneAsugaryAretinaAplowedAdraytonBismissingAswastikaAretiresAjargonAeuiAdesignationAwhiterAturnipsAsuaveArebuttalApistonAkilluaAhuntinAgrindsAteaserBchaikovskyAongAnicholeAmedevacAengravingAchelsAboutsAwebcamAvernaArepayingAmonogamyAharAeasygoingAcoinedAinsulatedAcopierAdeukCcodedAeventfulAcinematographyAdrapedAcoolidgeArouterApeñaAgardenersAalineAleightonAgelatinAdebaucheryA205AundesirableAstaggeredBomaliBiddhuAmidsummerBasqueradingAknee-deepAperiAminglingAdissolvingAc.d.A401AshivaniBchoolhouseArecallsAkenziAforty-twoAemulateAanesthesiologistBlexxAtangerineApetitAhideoAgullyAfatallyAbelloAvietcongAshrutiApoiseAlegworkAkowloonAespheniAcapuaAstrudelAlaunderedAinoperableAelectraAdelicaciesBanforthAchildlikeAavAtritonArefundsAjabalAclenchedA9000A790A1927AstrengtheningAquirksAobscuredAakariAsuppleA's--itAdefectorAbrysonAwhitfieldAunseemlyAtrouserArikkiAmumpsAlynchingAdiffuseAcalibreAbaysAsearingAespAdaredevilAtardyAchittiAbenjieBallsyAayseBrisenAtricycleAsoleilBhe-Apop-popBlywoodAh.p.d.AdodgeballAriddickAharwoodAdothrakiAbullseyeAsweatedAdeafeningAovertakenAnutcrackerAimpersonalAhostilitiesAdeplorableCnominatorAsinusesAmincedAkandyAincurAhelluvaAyoυAtogoApolitenessAjourneyedAidyllicAhankyAfactoAeasingAcommissarAbolshevikAable-bodiedAservingsAkrakowBickoffAdamperAbaudelaireCby-sittingAvacatedAtinglyAshorthandedBcouredBapiensApassive-aggressiveAburpingArecallingApanickyAkiwiAiouAhindenburgAtybaltAspot-onAponderingAiraqisAherschelAclumpAresonateAkingcastilloAguardianshipAfinlayAwilyBaresAjackoAinvariablyAhiggsAdopingAcontusionAarnottAzelenaArocheApelicanAloneliestAflamethrowerA202AwavyAtransformersAdavieAchocoBatch-upAlayinAknuckleheadsAthere.AlayeredAinnardsAbutteryA2.50AtolgaAmagellanAha-ha-ha-haApeekedAgimpAdebutedAcremateBadAkeynoteAgarterAtetsuA1.8AnonaAmailsAkeylethBanaAcoldnessBlovesBapitalistsA245AtwinkieBayApotomacBlopAnewlywedAminhoBanifoldAhousemateA147AestrogenAcabooseAarmisticeAsquatsAmoldingAgeographicalAcatatonicAskirmishAkarnaAharknessAfigurineAdictationAboogeymanBlocBickerAtundraAoverdriveBrigamiBfthemAmaudieAhershelAchuckingAbrackettBoazAwicketAsmsAremindersAlayoffsAkiltAcapitalizeCfãAvolitionAlagunaAinstinctiveAcutenessAbreastfeedingBadgeringAapplaudedAscreaminAfractionsAsomaArevelApioneeringAjang-hoonAinfluenzaAstorybookAcolumnistAativanAunafraidAp.j.AmemorandumAkangaroosAalessandroAwhat`sAstragglersBmoochBakuragiArun-downAphotocopyAonslaughtAnuhAgarrityAcroquetBaspianAstewedBnuffedArowleyAoverestimateAnarrowlyAimpotenceAchicaAshogunateAexpanseBnactedAannoyanceAnasAv-fibAloopholesCndoAflorAcompatriotsAbleachedAregionalsAofcourseAlibyanAkataraAfull-fledgedAevaluatingAbludAavailabilityAxanaduAwilmingtonAmarlboroAdisproveAcitingAbheemAandroidsArubeAflabbyAall-inAmoldedAguevaraBaragesAamorousAquacksAlugerAgarnetAcollaredAbilliardsAreroutedAex-wivesAchampaAxiiiAportersBeacekeepersAhayworthAmigratingAliptonAburiesAhsuAwinnipegAprotonAobsidianAgreenbergAspicAoutgunnedAheartbreakerAeventualAyugiAwindpipeAtexanAstiiiArommieBesponsiblyAhuggerAfumbleAtannenAstraighteningArewrittenApunk-assAoverdressedAmustyAaccomplishingAwellbeingAlicensingAkogaAendangermentAchonAzipsAunderhandedAthoroughbredBaliAsoupsArestructuringAprevailingBerspectivesAmcgrawAformaldehydeAbranniganBookkeepingAsipowiczAlahoreAwarpathAomiAimaginesAcirqueAsky-highAradianceAcontrollersAbrowsAterminalsAsadeAgazedAdentsAbrutesAalliAyagamiAmarigoldAdispleasureAaldousBditiAkanedaAhousemaidAdayaAbookingsAselcanAottawaAmockinglyAloaferAkikyoAcrapperBandlestickA'mereAlooneyAimpregnableAheadlightAgurujiAfabAdinnaAaylaBgroundAsatiArumiAlight-headedAkatjaAhard-boiledAstunkConerAfull-grownCckheadBloozyAadmiraltyAskittishBelbyArattyAmoorsAivánAcourtedA1.50ArondaA're-weAparkwayAdignitariesAvassalAscruffyApartonAgallbladderAramadanAexorciseAdirtierAcould-BarpentryArummageAcrabbeBapitalsClamariAbanalApunishesAmichonneAbaharAacceleratesAwant-AshockinglyArivaAmongAlifelikeAgelatoAcumberlandAaightAsketchingAreconstructedAindictmentsAdopedAcollageAwudangAsurveyorCbtractBelf-servingAjacobyAgrandioseAdreyfussAuntrustworthyAtroisAbravadoApredeterminedAloebAgot-AearplugsAcorianderBarthageAvinoAquranAprowlerAlandisAgalvinAsuzetteBhojiAdonaghyBecoysAstardustBportsmanCicedArecreatedAhitchhikeAfatteningAencampmentAtuckingAseerAphonographAaberrationAyadavApalpableAeidAskewersApaneAnationalistAeduardAbrowserAasifAfour-wheelAchristenedAstraitjacketAmahatmaAlaredoAhomeworldBeiferAcreoleAaragonBnalysedAunwrapAregainingAnamesakeAmadmenAlidocaineAjadenAhuskyBingAdunphyAajitAramoneAflintstonesAcandiedAbloodsAyukikoArerunAfittingsAbhanuA50-year-oldA‪iAwaikikiAtypoAswoopedBarkAoliAjoxerAducatsAbirkhoffAallureAverticallyAsubscriberApopulaceAendorsedAundersideAhayashiAcheapskateAzimmerAmoosAbakshiAwindowsillAsquabblingBkeletorAmaterialisticAfedexAduceAturn-onAslurpArankingsAprofessionsBlayoffAm.j.AgorAsmolderingAmariachiAcoolersAskeletalApurviewAnandaAdouglassAcuspBreativelyAbaitingAwoodpeckerAsheriAkwakBonradAjournalisticAhmsAwormholesAprintoutBagodaAlucioAfrakkingAcolomboAmalikaAfrownedAdistinguishingAblubberingAastaireAshioriBatoshiAlovey-doveyAindignationAcyranoBollaboratedAten-fourApregnanciesBlummerAintrusiveCgestAghostedAexpenditureAbeatrixAarnaudAtraceableArecklessnessAkiaraBandaharA'ifAhandpickedAcushingAzimbabweAstalloneArynAdebatableAage-oldAsonuBideburnsApolluteAfernandAdeducedAcordayAarborB.d.a.AwhitechapelAducklingAbrineBeckonsAyou-know-whatAup-and-comingAt0ArewindingAdistilledAbreechBatmobileAaltersAscentsArylandAimmeasurableAerdalAconquersAwifeyAnothingsAkuanAgarnettAshinerApearlyAishaAfredrikBortsAbigotBattalionsAadvisementAurAlatifAkendalAjudeaAimpoverishedAderiveAbavarianAvisceralAsensibilitiesAreciprocateBandalAmathildaAhepAdiscrepanciesAbojackAapplesauceAmuchasBagnetoAintriguesAhi-yahAephramAdumptyAvirileAmewAlenoAhimuraAfinancierAyashAsnitchesBiamBcratchyAone-twoAmauAhitchhikerArepugnantAquellAgrandsonsAemanatingAdisconcertingAbreezesAannapolisAtoothpicksBhey-theyAreentryAinbredAgraffAshopperAkungfuAcobblepotAadvocatesAxerxesAtanzaniaAprincipalsAnandiAdeliveranceAcoffeyAbaumAtriflingAragedApercentagesAlaginaAkaputAfamilialAeastmanAshazamApersephoneAoccupantAmeierBaroonedAkashiAbianchiAarrAmelinaAgravestoneBossipsAre-createApromenadeAmontezAinfamyA5-0AtrivetteAsorBignaledBchumannArearedAphilharmonicAhalleAfreebieAblurtApfeifferAdecimalAcratersAmobstersAcussingBarjackingAbooyahAtribecaBerminologyAsbsAmauroAgo-betweenAearthlingsA1925AtautAprussiaAelectronicallyAsheelaApigmentAmidlandAimportingAhardieAbuckshotBalesArevenuesApatriarchAoutpatientAidealismAhunsCmeBayatoClf-witA0,000AspacemanAgoetheAfuselageBaustoAdoriAcommoditiesAvwAsetsukoAfanaticalAcannoliAbountifulAapprenticeshipAundisputedAoriginalityAmadsenAbrixtonAroutingAcripplesBallbackAbobaAstorylineAmisinformationDcalculationAi.e.AarrivederciAtushBriangularAstorehouseAparsonAmunchiesAlucknowAfootyAdupeBandruffAcornbreadAbainAmiyamotoAdissectedAbarronAmundyAdanieleAabhimanyuAwordingAviciouslyAterrestrialApymAnarrowingAbarrymoreAabidingAresuscitationCcoilAquarrelingAplunderedBarakeetAmulhollandBoanaAbadlandsAschindlerAmaurizioAsentimentalityAosAlistingsAdiffAckAboromirAuneAsdAoustedAleversAcowerBhromosomeA330AxevAoverzealousAllcBinebackerAjaylinAdaniellaAuziAmarriottAincentivesAevergladesAcravedBommencedAsurrendersAmotivationsAgenitalAdietaryAshaniApromotesAmcgovernAiffyAfairsAcleveAspankyAcooleyBhoosyAboudoirAalvaAsorcerersAphotogenicAmadanAkneecapAhiromiAempowerBllsworthAcroaksBootAtommasoAinfiltratingCésAdaliAcouscousBhiyoAwillowsAochAnon-negotiableAchromosomesAunendingAtimoAnevinsAminibarAgãAearhartAwrinklyArubbersBenamedCmixCeAponchoAlazinessAinflammatoryAgradedAelitesAcowlAsixpenceAgrendelAdermatologistAcharacterizeAnarcissismAfelizAconvincesAburrellAtripoliAsownBhebangBaabAmuldoonAimpunityAglossyAforgeriesAcheeriosA828AsporeClendidlyArowboatAluanneAbeheadingAamazementAmethamphetamineAskepticAromainApausesAeasedAcutoffAyangzhouAwriggleAmoriaAfuscoAseenuAevalAsee-throughAdisinfectAcosimoAtyphoidAruneAbethesdaAaileenBaaA'yApetrelliCndejoAimpossiblyAhaughtyAfiddlerAapronsAsayuriAmimaAinfancyAcelticsBalibratedAweathersAroninApickerAhandbagsAfroggyAconneryAtrannyBomokoArepaymentAoutbackAmethodologyAlobbyistAencasedAdeathlyAuptoAseabedAharukoAdawdleAblendsAunfathomableAteensyAshimaAmalevolentAjustifiableAinfluencersAblamelessAavant-gardeBrmeniansAtwo-and-a-halfApolymerBedestriansAnomadsAmangalAinnuendoAtouretteAstupiderAnordicAjodhaAruddAlaramieAbolivianAstrewnAmalfoyDaysianAlachlanAferraraAburkhardtAassimilatedAtootsieBen-hutAperceptionsAmorrieAdrumrollBetrimentalAconsortiumFlidateAhomeownersAfesteringAdictatingAchivesAbyzantineAnathAchristiAantisepticAupstartAsurlyAdredgingA54,460AthwartAstealthyCroudAdilutedAafroArashadCdekAoedipusAmotherlessBijoAhumongousAalbatrossAunderratedAsnarfAroboAflanneryAvlogArectoryAmondoAgangwayAbulkyA3-4AmilfAjizzAex-militaryA19th-centuryAtarantulaAspawnedAnoyanBightlifeAdominatesAselfishlyBalvoApatterAnantucketAcavingA132AoctavioAincessantAhaymeAdreyfusBekkerAmiscalculatedAjay-zAinstillAgomorrahBanymedeAenforcingAdmitryAcochraneAthem-Afine.AcufflinksAricochetBeactionaryAoldsAlightyearAgrasshoppersAcarcassesAalaricAunwrittenAstruttingCopwatchApocahontasAkajiAbalkansAskatersBilveryAopennessBbjectivityAillustratedAcheechAbackhandAquotationAplagiarismBeesAglendaleAbotanicalBloodiedAaggravatingAsolicitationAkojakAgramophoneAdigbyAtaterAfifaAsuziBkulkingAruffianAnewsstandAmacklinDgregorAclawingBhalmersArydellAloudmouthAhabitualAfeliceAcommandeerAunintentionallyAthornyAsiftingAmillennialAlithuaniaCebermanAhoskinsAfreshenerAeamesAcounterpartsAwindfallBallopAtheatresAkamaAtownshipArushmoreAjillyAdiscouragingAboughsAarraignedArudraAlaxativeCunchersAhakunaAbaezAartefactsAvegetariansAribbitAmonotonousAknoxvilleAcheerfullyAbrokerageAstimulatesAminskAhumblingAboleynAantagonizeBislesAterrierAmervAflickingAdbAaelitaAfiftiesAdreaAthrivedAshangguanAraúlAmorelliAfizzAdilithiumAcarruthersAvizierAschmittAmaroniAeastboundAbackwaterAwindmillsApanduAliberaceAkelliAfyodorAdakeAyurikoAthatyouAmilkedCgrantAkavanaughAimpregnatedAheimlichAgnocchiAeggmanAworld-renownedAunderstaffedAstepanArectalApackagedAoppressorsAtaniAmotiAfei-hungAcokesAbeneAall-AmcconnellAintermediaryAhypedAconcertoAbilledArodgerAdelindaAantiquityAwrangleAtibiaBhickensAmoneypennyAwestwoodAprickedAdrierAbanuA'alA‫‫‫‫AzhugeAtrilogyAsantiniAreprogrammedApresentationsBersonalizedCltsAinfluxAdecomposedAtornadoesBchAramiAnaraAklaxonAhollaAelvinAdragonflyBisillusionedAwalkwayApelantAbolinAaffectionatelyAtobeAspectacularlyAprotonsBlus-oneAawokenAtintedAlebeauAbyersAannulledAviggoAuptonAstraitsBeaboardArickiAflocksAcrickBonstabularyBlergymanBhittersAaoyamaAstumblesCipendAnaeAcellarsAprogenyBineapplesAlittAkazukiAi-isAhandkerchiefsAdo-doAuppityBnscheduledApillageAkneecapsAhootervilleAdracBinarsBeposeAaiwaysAtwirlingAsuperboyCggestiveBpectralApersecuteAkotaroAfanningAcreeperBlotheBanningAalertingAtwelfthBarikArelatableAlaxmanAbelligerentA217C4AtlcAm.d.AinterpretingAbacchusA1915ApurrsAorientedAlunAaforementionedAremBacistsAmoroAlightsaberAkumbayaAhuskAgalvestonAceramicsBateredAacrobatAwhatyouAvinickAopposesAlynchedAfiercestAdefconAamphetaminesAu2AeversAdepressAarchimedesAsunitaAhwarangAacquisitionsA1924AsidewalksArenewableBadhikaAgentryAclashesAalastairAleticiaAextraordinaireAvowelAmenialAinstitutionalAforagingAusmanAretractionAplayroomAloopyAatariAyasAunderfootAtherAsterilizeAkrishAinformersBmmerseBchabodAetonAspeedboatAreputedAperplexedAoverlordAarousingAvirAsoundproofBeeleyA2023AtempersApee-weeAversedAseijiAovercrowdedAmusketsAill-fatedAbettinaBarrieAwretchesAsikesBawedAherdingAdeformityAucAprofanityAmanchuAhummerAabstainAshitheadsBandrineAkoiAexploratoryBlkinsAdwindlingAanomalousAratchetAflexingAd.e.a.AusinAtutorsAspeerBobaAprismAneffAmummifiedBadhavAlistonAforfeitedAelopingAbilgeBattleshipsAyourjobAwehrmachtAunopenedAservicingAluanAextenuatingAdeductionsAcoventryAaahhAunghAright-oAoverthrownAmoderatelyBasaoAlindermanAkrabsAfloaterAnationallyAmishilAivanaAforageBattenAeveyAbrentwoodAabbiAwhistleblowerAsecond-guessingAnihatAmatataBuahBiscommunicationA586AseashoreBalamArapsAgirardAasrielArestfulApresbyterianAvolkerAstubsBatisfiesAmbcBaoriAdjinnAcoliseumAburnoutAtatsuyaAreminiscentAoccurrencesAhotchnerAcaterpillarsAsicBelloutApropelBhosphorusAgdrAcroatianAbideAauditorBrtukAsolitaireAhandprintAcobaltAbilletAthought-AhidinBarunAfrayedAcentipedeAanemicAkorayAinnovationsAbusybodyBatshitAarubaAwhalingAunsatisfiedAroamsAok.Along-standingAjoesAblubberAtweakingAoncomingAmeta-humansAfruitlessAdownwardsBilAclockingAaldrinA12-hourAtestyCntacleAmigratedAdietingAarguesA22,000AviiAsistineCde-by-sideAmikamiAadvertisersAslipstreamBhut-eyeCizukaAmotivatesAharaAgroomsAdebutanteAbroganAshortagesAradleyAnuiAmeâAjoplinAcostanzaCngeeAacknowledgesAworsenAshipwreckedBawmillAmaldivesAlightheadedAgeorgetteAcross-eyedBhoongAandreyAtwenty-nineAleft-wingAinertAopinionatedAlasagneAjazAginzaAcoralsBatesAsultanaBtasiAlifebloodAcoltraneAabnormallyAphillipeAlet`sAimpasseAhundredthAbanginAtartarusAsyneBcabsBalanderAregimentsAcyndiAyanziAraspyApotluckAhiatusAduvetBisapprovalAbonnerAasternA10-yearAzumaAoksanaBffedAquotasAnounAhikariAgeoAemergenceAcolludedAbarrowsAattachingArecreatingAhamstersAclammyA'byeAboozingCatloadAalternatingAthird-rateAsanoAprobateBianosAmillionthBeteoritesAzengAwitheringAsoftnessAluannAhee-chulAguangzhouAbattlefieldsAaudraAzippedAwork-relatedAsulleyBalamancaArambaldiAoverseerAcopelandCdisAvinaigretteApuddlesAloaderAkerriganAget-AcategoricallyAbuzzardsAairwavesA305AyolksAmistreatAkeanuAbeaconsBarnsA137AwillfullyAnappiesAkornClAclampedAspluttersBkimmedBilencesAruthlesslyAgrecoAbaalAwadingAuninterruptedAtramplingBibbsAlocalizedBandyAbassamAargyleAswinginAold-timersAkeremAdozeAwell-offAnguyenAfeelersBatherhoodAburenBrynnBlabAunselfishAstoneyAchynaAsweeperBubterfugeAredeemingCcordersAfruitionA35thAundisclosedAsumiDanApredominantlyBariahAironcladAgrown-assAtwitchyBalonsAsmithsAhillyAfluttersAannuallyAsimiApoacherAmothershipAechoedAdiscreditedAchiaraAbeavA1812AtrapdoorApatsAhullenAchildcareAah-chooAwildcatAtomoAsavageryAlarvaAfast-foodAdelveAuncAshatnerAjin-seokAhalf-bakedAemojisAccpdAbragaAassociatingAlamppostAjohnathanAfumingAdashaAcongestionAashramAself-loathingAnoseyAhussainAenergizedAbrowseAaaaghAsmudgedBavitriAparliamentaryAmarielAkyAdoggedAmaloneyAhungariansBonedAcompileBlampettAredheadedAkittiesAcolonoscopyAimpudenceAbutcheringAasamiAwhoppingAvolleyBintonApecsAobituariesAmetaphysicalAcameoAblackwaterB.b.Ayee-haAshettyApedophilesAemancipationBlinAconductsAbb-8AweightedAsupervillainArestonApanzerAexcavateAdominguezBefileA20-yearAstoogesA666AvariantAsubtextAinvigoratingCsertionAdecomposingAchariotsAbatgirlAanchovyCalyticalA7.5AziweiApre-opAorangutanBjaiAlodgerAendoAcadmusAbansheeAsquattersAmisbehavingAkasimAhollanderAggAdecontaminationAveeraAstreetcarCatutesAlife-supportAkafkaAhoundedAa-plusAunrecognizableAstampingAreliabilityAlaineAfilizAdarkenAbludgeonedAwasabiApacedAgudduArefuelingApuntCgsleyBitchforkAinstructingAeludeAdetectsAcabanaAaztecsAmirroredAidiocyAhalf-deadAgryffindorAcyclistBruisesAbartendersAtootingAsimónAloutAkohAintoleranceAhogarthAdrinkersBolledAcurieBonnyAparasiticAhoggBi.AceciAwaahAshoeboxApateAnorbertBishiAmettleDamorphosisAjoyoungAexcludingAbeholdenAsnobsBaanviAnoradAlimitationAfleetsBathomsAdistortAcamiloAbiblesBarringtonA21-year-oldAplushAmohiniBeggieAdollhouseAcaymansAoctaviusAmodAgatekeeperAdousedBewittAcrescendoCaniumBitywideAbeattyAwere-ApainingAkarolinaAjoaoAwhistledAvacanciesAshe-raAphloxBelleAfrenziedAbasementsAsecond-guessApungentBotholesAmentoringAoccupiesAnozomiAgotoAarvinAshawshankBergeantsAroséAperilsAmacintoshAinconspicuousAeffortlessAshininBakaiAkfcAgauravAprecautionaryAone-leggedAfrackingAτheAswoonArednecksAmatsudaAkurosawaAinvestigatesAbutterfieldAsnifferAmahlerAglitchesAflailingAvaxAsirreeArashmiAfrolicAendicottAactionableAunveiledAnoiAkrausAimpressingAaerospaceAmarikaAdropletsAtennantAshirinAprofuselyAknockoffAfront-rowBloweringAerdemAwindedAuncooperativeAtranslationsAprogressesAchimBerberusAbannonAtrawlerAghbAfoamingBast-forwardAconsecratedA2-0AunexploredDarthAtatsAmasaAamaiaAyearnedAtoothbrushesAmunchkinBarinerAjeterAbulldogsAsumerianBtaggerBherbetApickeringAguadalupeAambianceAmilliganAcorsageBease-fireAyeeshAstapletonApringleAnaokoAmowedAjujuAweatheredAoldiesAcybertronAuneventfulAnyaBotifyingAblisteringAspellmanBmutBlantAproprietyAoutsetAmcmillanAjudsonAheisenbergAdecrepitAcrimeaA1,700AsugarcoatAriyaAmatadorAimmaAfleshyAdrunkennessAwinchellBheatleyAsalutAmountainsideAhallucinateAcossacksA1913AshaliniAphilippaAfidgetingAautomotiveAumutAhuckleberryBennesseyAakagiAmilenaAclitAtahirAmcdowellAladylikeAkadyAgatoradeAcoatesAbuh-byeAourselfAmuppetsBendelAlaid-backAforsytheAcrawfishAtreehouseCanscendsArothschildAleachAjunkoAgwiAexcelledAdwellersAxeroxAprofAjabbarAgiannaAconduitsBhaewonAtearfulAstingrayAnuanceAleadethAjust--iBerseysAemanuelAconsolingAmccluskeyAboaBlemishBitsyDch-assAposturingBatrolmanAoff-siteAfrugalAabsent-mindedA216A124AwattAsweetwaterAqunAniteAadenAspannerAreenactmentAletâAgrappleAextravaganzaAnexusAiqbalBnvokedCnocentlyAsteadmanBhotaCinobuApgAorthopedicAminasAdrive-throughBisqualifyAcompilingAacousticsAsyllabusBcroungeAkaminiAebenAcicadasAabsurdityAtriniBhеAmeghnaAlovelierAgrowinAfrontiersAcomanchesAutaAraffiAmundoCayAfraggleAzahraApoopsAmotivatingAfelliniAconsequentlyApatriarchyAkazumiAh.g.AadorationAkannaAhandanAfirst-bornAcounterfeitingBastrateAbouchardCogersAunexplainableAleonoraCipzigAiabAevadedAchiliesAweekdayAtazAsustainingBnartAmusicallyAlilianaAjackhammerAgobblingAsoledadBizeableAmãAdelanoAboatmanAoutpostsAnichtAloomsAkavitaAinboxAgothAcgiBaressesAstrohCatelyApurposefullyAmentorsAleasingAjuliánAcapersAaestheticsAwarrantedAsecond-degreeArotterdamCadkillBeadinAincursionAgouCemonAchazzAtoulouseAnudesAliloAhanakoAgeriatricAfiratAanaisAtomaAstraitAroxApredictsBapAnanjingAijustAenrollmentAamicableA1.4AreparationsAperiodicallyAmawAinescapableAdisregardedAcascadeAtime-consumingAroomingAmayberryAfrancoiseAartichokeAtutuAstimulantBoaredAresortedAlow-downAclingsAbest-lookingBarstowAoriginateAnetoAjaclynAfidoAconverterAten-yearAhigh-valueAesuAdestructAallotmentAsuperfluousBtanhopeBeleneAfobAeleventhAunqualifiedAsquarelyArobsonApradoAmilligramAcranstonAsequinsBcaledBafeguardsArazorsAprestoAmordredAinconveniencedAgayeAfrostedAblyeB1AalterationAtraverseArrAprotegeCitchettAlooserAklineAdecryptAaqabaA301AunhookAomissionAmaryamAc-3poAnanetteAlabradorAkentonAincoherentAdialogBepictionAsemifinalAmkAanselAsaxeAportmanBarlorsAnoriAemitterAcrouchBomedicA209AshoppedAprunesAnoblemenAmedellinAbutâAalsAsaviorsAmadoffAlootersAkrillinBarineAgallivantingAfilippoAuprootAlovelaceAdeptAabnormalityAwildebeestAsachikoApeople-AoutwitBiledAjeeAgengAfairy-taleAdermotAclobberAwashed-upAsurmiseApavingAmythologicalAignitesAformulateAe.b.AcamouflagedAarfBlchemistAsquirtingBpazAhaνeAcenturionAall-aroundBgeingAzoroAstuporAmeaAfemininityBcAdweebAanti-aircraftAswankyBanctimoniousAhandgunsAearthyAdelphiAcybermenAbenchedAsubpoenasApembertonAout.AnicuAmarconiAfoiledAbozxphdA15-minuteAworkmanshipAswillBigridApicoAmisspelledAlepersAeruptsAdoerAmortemBijaAfeyBast-pacedAwha-AtypistAmoniesBenstrualAkhlyenAinertiaAdeokmanAcoachmanBemilAsixtiesBcribbleArefinementApluckyAkudoAcrewmenAwesternersAunlovedAn.y.p.d.AauctionsAunknownsAtyphusBhroesAsillaAprosciuttoAmurthyAisildurBngerAgiddyapAdensBarnleyAcondolenceBannaeAaslamArefiningBainstormAfutilityAmmmhmmBichalAdividendsAbeckmanAapathyAshort-sightedAruffleAquintusApatagoniaAmongooseAgood-naturedAvassalsAhoneysAflanAcaravansA1905AuncouthAsaboteurAremodeledAd.o.a.AborderingBeasleyBachchanAantennasAschnitzelAreplyingApeek-a-booAmargheritaAfreudianAdownpourAcallaghanA7000AwolseyAtrespassersAschumacherArealtyAmontroseAknowinAhm-mmAdefencelessAagendasA5-year-oldAwingingAtelepathAleblancAemceeAcombatantsAinferCappropriatelyAholbrookAdianAchristenAboyerA00amAsoberedAresonatesAcasAvideotapesAsandalArehabilitateApledgingAlyeAcatholicismApollutingAmojaveAepsilonAbunkhouseBrownstoneBlaiseAazulBlienateA227Aworn-outAshekelsAleleAgaudyAbiryaniApricingAdivorceeAcustodialBircumcisionAauntiesAretainersAlittle-AkirinAjumbleAfuchsBellersAbiaAshriveledArerunsAisntBmpersonatorAgovernmentalAfrBergAexportsBndeavourAwrithingAconvulsionsAbummingAyakovAwestboundAsix-footAmisheardAencounteringAclevererAbaywatchAampedAwatAstumpyArumpleAnazliAchasinAwikileaksAstepbrotherAoonaAbucklesBrainwashAauthorisationAwittAserotoninAclarisseAruxinApawanAfleesAcontemplativeAwildsBal-martAteethingAshortstopAmesmerizingAloloAhelplesslyAauditedBrrghAsoftieBalinasAmidlandsAkeystoneAjudiciaryAdamnedestAclose-upsAspenderArangaAmarinateAfoothillsAdοBepartmentalAcallanAtoucheAsnipeBlytherinBkiffAbassettAkorbenAextraditedAautoimmuneAtacomaAsatsukiAlabelledAdruggingAadjectiveAwaylonAtartarAprofessAoh-A'lordAgovindAconvoysAtotCnioAspiroAplaydateAobieAmizunoBarinetteAcancunAslayedBallieAplanetariumAjiwanAhalenAgettyCrbilAchorizoBabalA380AvalidatedAriccardoApizzeriaCggiesAlatinaAknock-knockBeeleyAevangelineA750,000AvespaAtsaiAorwellAmedicareAkazumaAhajimeAgrovelingAentwinedAavecBpuBlexiaBccumulationAyauAtiramisuArashesAover-the-topAnatsukiAdarkwingAbandwidthAsproutedBepsisApoughkeepsieAmetaphoricalAhikerBaysAbeeswaxA62,432AweepyAunderlinedAteaspoonsAmetallicaAibnAhearinAbegginAwaningAunfoldedAsugarcaneBcribeAraggedyAnaïveAingallsAgobletBentlemanlyAfascinatesClkAlombardoAhezbollahAallysonCbyAtussleApongoAmuiAlemurAkebabsAflatmateAall-you-can-eatAvikA'sâAmcclarenAjacobsonAdoorwaysAconditionalAbatouAsquishedArivendellAobstructedA1911AuntreatedAtoastsAsulphurBingletonCmplisticAresolutionsAparatroopersAmotionlessDher-daughterBachine-gunAexcavatingAcommunicatesBemalBapitanCndymanAmunroeAjoviBeffersonianAforbiddingBeignAestrellaBarphonesAbabysittersAundercookedAsteepedAriordanAluteBeithAisengardAummmApuneBotencyAkhaleesiAhestonAworrisomeBay-AnonsensicalAinterestinglyAdaylightsAaminoAvastnessCnderpumpAunderlingsAoatAmallusChaloAhumphriesAguggenheimAvowelsAtopekaAintensifiedAhaganAgarcíaAflemishAejectionAdottyBilationA945AtontoAmatisseCnoharAtiwariAsidearmBegregatedAringsideAprescribingAowtBmittedAlernerA'chaAcappellaAextraditeBlectrolytesAanokhiAtosserAsaratogaArouAlandownersAknοwBirillAconcordeAqaAnon-profitAiflAhurstAdorotheaBawnsAconcordBhieftainBancelsAbotanistAtragerAfoxholeAtrafalgarAranceBicottaAmyanmarAlucretiaAji-wonAgenjiAemiA20-minuteA144AweezyAunintentionalAtrojansA'tooleAresolvingAockAmeemawAerlichBnthusiastsAdedicatingAçaAbogdanBacktrackAstrictestApeasyAmukaiAlapelAanglingAximenaAtesterAsmithyArummagingAoidAgodlyAeiseAcarnationsAweaselsAtronBhey-Amon-elAkurosakiAholisticAgreeneryAvipersAseltzerAreeferAproteusDspectingAolmoArumbaApollackBerrinAknighthoodAbosnianAadvisesAsalutationsAmignonAflikAboldnessAstagnantBowingAnapoliAiagoAcustomizedAmozzieAjefferyAcautionaryAbhavaniAuralAretrieverAmcintyreAjean-louisAgwynnAfaginAdevineAchienAaggressorAzuckerbergAvaporizeAswipingBhimadaApallaviAheavy-dutyAgrottoAdunceBingyBependenceAcorpsmanCnsolidatedA6-year-oldAosbourneAcypressBancersAsearAhokageBandballAgruffBlibBatorsAex-consBmpowermentAundergradAsinkerArestlessnessAhadjiAgarbAacevedaAtoshioAblaAstratosphereCickinAreinhardtAinfractionBmplementingAabductorAsizzlesAreprehensibleAp.t.AcolludingAbarbecuesAsnowboardingAfailingsAappletonBlaAtimmonsAmonteroAhailsAcooganCntentmentAyoshikoAwalkmanAtootieAhikedAendorphinsAdirtiestA10000AruffiansAfatiguedAerieAcrispinBaressingAtransgressionBimeoutBaillightAnauseatingAjessyAgannicusAfuriouslyAdandelionAabdelA1-0AnongAlilianAfantasizedAagraAwiperBhirlingAsynthesizerBanitizerAorganizersAmartelAkokoroBirkmanAinterrogatorCfertileAfalsehoodArendersAmoseAlàAinscriptionsAduryodhanBiscreteBebilitatingBanyAbrittasAadaptableAvideotapedAkampAconcentrationsA24-year-oldAstauffenbergApushkinAexleyAdroverBo.AcurveballA1-1AwweApettigrewAmetzAisotopeAfertilizedA34thA208AwrongdoingsAmalnutritionAingrateAfoursomeAclashingAblinksCasphemousAxueyingAunsBh‐huhAstetsonApoppersAnangAapostleAwrayAuntestedAtumbledBetsuyaAsnowfallAracquetballAlevelingAkimmelAinseminationAdisembarkAcompliantDmandeeredAaneelaAsubwaysApfcAoutlivedA'orAhildeBeyaAemigratedAtatteredAsosukeArambleAmanionAgrassyBoulashAcontemptibleBhiakiAwheelingAneveAmatildeAitsukiAgoeringAentanglementAcageyApublicationsAnobitaAinitiativesAflippinBarewellsA1923AunbridledArollercoasterBeconnectedAmassacresAshuntAgoddaughterAfrequentedAcrandallAbreathableEdwinnerAavocadosAwrigleyAtlBamalesAkhakiAinstitutedAauditoryBmbienAwedgieAshinsengumiAriverbedAoverestimatedAgarboAdiggersAthirty-eightAk.c.AimplodeAchâteauAbumbleA7,500AwylerApreludeAimpertinenceAgrandfathersAcayenneAbrionyAunprovokedAtracksuitAsnowmobileBeiAinhumansCdefiniteAentreatBkoAadoraAuniversallyDsAnotwithstandingAmacaoAethicallyAdisarmingBecipheredAbeauregardAsouAmedleyAlibraAkazamaAfrazerAeun-sungAdankAcollidingA290AwatermelonsAsuckyCbstationBpeltAderanAaffirmationAstrong-willedDeepBouffleBhowmanAretinalAninnyAlaborsAforgoAcutbacksAorlovAmphAhallerAgyunAeggheadAco-operationAtwerkBentativeAslouchAntsbAmethodistAlombardiAcantaloupeAargosA3-0AwatchersAtheonAimpressesAhootersAfernandaAashfordAzanAmilfordAwitherspoonAseepingAplateletsAo-negAjoshiAdrawbridgeBiminishingAyamaAwhirrsAposerBennantAobsessionsAkinneyAjuleAgrievesAfizzyAcapisceAbutt-headAstealinBingsongyArampsAlegolasAkarelAeinAboroughsAactivismA0kAwieldsAtactfulAsuzakuBnootyAparamilitaryAempatheticAdopplerAcroydonBommuterAtrottingArepulsedAo.b.AmaisyAkickbacksAwhaddyaAredoneAgrishaAdjsAariadneBlbaniansAwokAswaysBiestaAproceduralAmckeeAinheritsAgoannaAacclaimedAscandinaviaAlaudaAfat-assAdersAaartiApropellersDhibitsAnakaAheart-shapedAdirectsAaleppoAresurfacedAlustfulAferAbeaksApacifierAthunderstormsAstoicAkundanAbecause-AworidAtenementAromneyAkodakAforegoAceresBarry-onAbracingBarnaclesA303AnewfoundlandAinhospitableAexpresswayAcapacitorAspeculatedAnymphAmuch-neededBontmartreAkamiAfissionAdorsetBissectingCnkyAufcAtuggingApuntersAknifedAgasparAembodyAcihangirAeldonAdoakesAcalgaryAboastedAabjectArcAgizaAfrigateAdorindaAbrillBotanyAridgewayAmacphersonAligamentAfaitAeruptingBmbankmentAchavaAуouAmulwrayAgarrickAcpuAboykaA480AshallowsAincinerateAfantasticallyAunderpaidAsollyBanderAlovettAk-9AinfringementAdiscordantAvermouthAsledgeBeashellsApbAfettAstoppinAreceiversBazor-sharpAoverconfidentAnotarizedAhotdogAevokeAcolosseumCbyAyuckyAtenderloinAstratfordBleightAhickokAbhagatAwhoopeeAprostheticsBerforatedAoverworkAnoblestBaiduAlaniAhornedAfearneArewroteAmathematicallyAkeplerAahhhhhBdhdAbibAabraAwooedAtweedAcongratulationD.BataclysmicAattorney-clientBldrichBghaAsusyBcotsmanApunchyAnotepadAmirokuAbyrnesAraciallyAgerriAbrackenBlackyAloopedAboyishAsociologyArodinAhoffArealsAporshaAkanjiAgundersonAfujiwaraAcrannyBhiseledAblabberAtrembledArevivingAprohibitAnyahAlightmanAirritatesAaluminiumAuruguayAtsubakiAkikoAinjectorAastoundedAyοurAtangiersAstore-boughtApuppeteerBalsyAmarkovAakemiAgibberingAacquitAyayaApositivesBickupsBantomimeAlaggingAhorseshoesAgogoBeologistsAdressmakerAcontessaAandrzejAputterAjabsAxindiAslabsBhangri-laBerpicoCe-AreptilianApushersAlaskyAbelsonAaggravateAtogethernessAsignorinaAmaddeningAk9AjanakiAcamcorderAuppingAsassenachArostovAlilahAeliaAboastsAwestinghouseAjoachimBepAgratingAepAdunlopAcassettesAbtsBroussardAakronAtherapiesAsemi-finalsApiercesAnousBeapolitanAmaduraiAlike-mindedAkatsuragiAjeevaAinvasionsAhyattBipposAdelugeAcadaversAartyA23-year-oldAvacuumingAgroganAfortifyAeczemaAdornAcrabbyAboggAavoidanceBccumulatingAtahaniAshe-sheAplummetingAhvitserkAgaloreAantennaeAstrengthensBifuAnyetAjumbledAguadalajaraAdiggsCeuAymcaAtorrentAsimcoeBchraderAquieroAisadoraBmpedeAcheetosAsecnavAgraemeAfoghornAcomplicatesBlucksAblackberryAspeakeasyAresupplyAmayoralAluccaAinstantaneouslyAfuelingBloorboardAdozerAbuy-inBourgeoisieAswooshAfordhamAbuonCddhistsAruffledAoversteppingAbriefingsAtartareAmockingbirdBantelAcoyleBapesAboosAajarAwinksAutAlitteringAgamoraAconvergingAshakiraAreshmaAoverviewBut-of-townAjetsonAinsincereAdapperAbroachBaitedAappetizingAreacherBarityApresideAhumbugAdisguisingAcrepesAteahouseApillowcaseBersistsAoutlandishAmocksBixed-upBetatronBcpheeAjoggerAfoolhardyAamarilloAsaracenCisApunchlineAhi-yaAglimpsesAflopsAdistalAabdicateAuncivilizedAtownsfolkAsynthesizeBheetalArenzoBaftsAminnaAbel-airAsaltzmanAinjuringAfergieAdid-Achoo-chooAwell-deservedApageantsAincubationAhandbrakeAdiagramsAbirdsongAscorchAresentsApratAmollAkaboomAfukushimaAcosplayAbrianaAstandupBnotloutApessimistAneelAmontaukAbottlingA312A2200AoughtnBne-womanAnellaAlaunchpadAgilliamAsquirtsBlasherArainwaterAphAmonahanAintensifyingAdiyaArepoAmediateAgaugesAreposeBaziaAmanifestingAlmAhamasAflounderA'amourAyuppieAwristbandAvillainousAmartyredAhome-madeAdomenicoAbeagleBaguetteA0900Aworry.AfrettingBilteringAdesolationAaguaA247AutilizingAresoundingAnodsAlapdogAhayatAgambitAdeliberationsAaikoAshroomsArenewingAhitchingAfoundryAtoyedAstickupArifeBetrogradeApreysAikeaAhallmarkAspreadsheetApookieAendorsementsAtriumphedApreemptiveAofhisAmar.AdiscolorationAatvBldridgeAtrappBouchdownsAsmidgeBelf-respectingAreignedApjsAmongoAiadAbypassedAakashiAone-dayAjibAheatersAfragmentedBealtyAebbAclear-cutAletdownAinstilledAdioAamelieBirbnbAwh-whyBeâAthornhillApiersonAdurandAamiableAsuper-duperAmournersAhornetsAgatoAentrustingAdlAcommencementAandrosAtierneyAsandbagsClveAfindersAc.o.d.A950AthraceAskankyAopioidAmacedoniaAjesúsAhickoryAgriseldaAfurnishingsAcarlotaAbuzzkillAwreakingAthree-leggedAsecond-in-commandAoff-seasonAhazmatAarcheologistAstalkersBhobhaAmitigatingBcleanBarginalAivorAgunneryAdickingAcleftAamoreAokadaAcroppedAwoosterAsupercarAproustBottedAnotingBightieAjourAindustriousAdohertyAcormacAajummaAsteepleArun-insAjoulesAhotaruAdebbyAcallistoAa.mAzoosAscissorBamaraApayalAléaAdozingAcheeA2.3AtrimmingsAradialAforeskinAbuhAunrelentingAshonaAmaradonaAirfanAchoonCildeAthirty-oneAshiraCeehanAplyBinheadAindignityAentitlementAcrewmanAwellâCightlessAroganAmásAleapinlarAgodwinBartersAflahertyAwinkleArumpoleApermittingAmottaBcenroeAlilacAgowerAflamencoBather-daughterAeffortlesslyBamonAbrahminAaviatorAvenerableAtinselArennyAdaehanAwillonaAthumperBardinessAstokeAlorenzAgooksAconduciveAviscountApostpartumAdesaiAsphincterApaltryAheistsBawAdeejAbaahubaliAtraipsingBaglishAsikhAprovenanceBelinAonlookersAnotjustAkarolAembodiesAdorBecompressAcontributorAtoâBamsinAsuezBtaggBleazeAmerrinAfine-lookingAdistancingCetrichsonBesdemonaAauthorizingAsissiesAmiuraCsfitAdauntlessAcrankedA1921AvaleraAupkeepApayoffsCraphernaliaAhandheldAgropeAengrossedAsodomyArefillsApalpitationsAmisstepAfenwickAeomAcarpentersAaboundAsalonsAheadlinerAdansAboyhoodBeadyAsubletBocialiteBargentArepressAinsurmountableAfrz0AbettermentA138AjigenAcallusesAboom-boomA182B29AwistfulAquibbleAoutdoAcorsicaBlevernessApyungAnunneryAlllAcomplexesBhessboardBandisAstripteaseAponcherelloAmobsA‐itAbarrioAtattersAsimonsAroslinBearrangingAmeloAi-lAgnawAvectorsAuntappedClistedAneutralityAkomalAheydayAgangingAbigotryAwetterAshigeruBeethingAmathersAinjunsAbiaoBackgammonAshowgirlAmorticiaAkayiAcontemplationCmposersAsemanticsAroughingApisaAmuruganAcãAamenableB-areAundercutAshad2AmcbainAkudosBawasakiAbokuAuncuffAcorradoCncealmentAvolgaAquarteredAimproperlyAhologramsAeskimosAdregsAcoladaAbolsterAaureliusAstupendousAplummetedAfuegoBiltrationAethanolAayukawaAsnorkelAovertonAheliosAgearyAfront-pageBornellAboisBlowjobsAskierAmisgivingsAdejectedAtwaAsurveyingApatilAmaj.AgrimyAdispatchesBíasAy0uAwe`reAtenfoldAstatesmanBputnikAreadoutBanchesAgrandestAd.o.d.BepressiveAcircumferenceAbilateralBand-aidsAabsolvedAushaAsubsidesBtoddardBlawAifweA'connerAbookwormBellboyAveneerAtusuBoranagaAp.mAmunsterAhysterectomyBealthiestAgrossedBauthamAfortuitousAeardrumsAwonâArefresherAmurakamiBalekAhoppyAguardiaAbosAyimAsqualorB.o.s.AnumericalAmotivatorAcoochieAtravoltaAspitzBnookerAninerA.iAweekdaysAunleashingAtellersAkeiraAcharacterizedBarpetingAwhacksAvenerationAlomanAembodiedAbrashBluthA963AdemosAcraftingBhekhovAahjusshiAvenezuelanBaselineAmelbaAknapsackAiookingAdammeAbuckwheatAstillmanAinfantileBmmersionAdesecratedAalihanAthcApatmoreAlakhanAhunkyBoarderAfingeringAexposéAclémentAbatcaveAsousaApiecedAmightnAlandauAkalleAdumbfoundedAbeysAseminalAplayhouseAlarAjaqAguadalcanalAfoyAdepictsAclichésA0,0Athree-monthAspeculativeBliderArecuperatingAnursemaidAmajinAholgerBanzoAgargoyleAfielderAdaemonAcheshireAamadorAwrexhamAsubsidiesAjamilAcriticiseAtivoBhayerAself-destructionBakurakoAobscenityAmorelAgeuAundergarmentsAthinningBectonicAstillwaterBgcAinquisitorAhenrietteAgranderBcsAbaskingAwechatAtamraAinheritingAgangbangerAcarboAwahooAvictorsAunattainableAfirewallsBessAcranberriesAblehBacklogAtenuousAkeisukeAbarkedAamendedAunconstitutionalAslurAmorticianAdisputedBeunanAbrayingBattyAalbrechtAwoolfAtmzAshinoAmaesterAdisloyaltyAcoralineAapplicableBdventAtachyonAstabilizerAopioidsBmeletsAhieroglyphicsBabitatsA228AsmirkingBcarboroughArenkoAoverpaidBfhereAmedalistAhappeningsAcleatsAtoddlersAold-timeyAjoanaAhassledAgaetaAbearersAanti-semiticAparmaAoppressAdijonAcloudingAbutterscotchAshackletonArowlandAkingmanAgilfoyleAfornicationAdistortsAbackroomAperchanceAmccallisterAimplosionAquenchedAphantomsBatersonCragonAnοtAmitesBathisonAkurdishAjamilaAchitraAbirdiesAwestwardAsonnetApulaskiAailsaBguirreAramsAorlaAmu-deokBedfordAlannyAaraBpothecaryBnkaAvíctorAflorentineAdesktopAbarnardAusurpAthirty-threeAshout-outArichlyApropheticBeroAjanitorsAdirectorateAclaveBhoreographedAbijouBecketAtywinAovulatingAjohanssonAhpAgwynBriffithsAfremenAeyeballingAdismissiveA142AyaddaArumplestiltskinBescindedAoccipitalAniklausAkyushuAglindaBittesAwantinAscurryAroundupBeplicatorsAmagnateAjackmanAzitherAsynapticBirloinAnabooAkluxAhurlingAaridBlamedaAmajestiesAfamiliaAbarabbasAauctioneerAstir-friedAphilosophiesAoptimumAmifflinAkoyAerodedAvyingAryuzakiAmuthuAdashwoodAcopernicusCotiesAtonicsArectangleAphotonsAmaimAkavyaAinteractedCsinuateAhummelAfriendliesAerraticallyAchallengersAxiaoqiArosenthalBadiatingApentagramAlinglongAgileadAemporiumAcivilityAvaljeanAprofaneAmeenakshiAdemelzaAclaustrophobiaBarlitosAbubsBridgeportBatchesAziaAreplicatedApotholeAofthatAjeetAgrugBaddafiAdraftyAasahiAyieldingAforthrightAenterprisingAangularAwinkyAstametsBpauldingBeãAfunny-lookingAclericA3.2AwagsApartnershipsAintubatedAhornerAevolvesBightiesAazatAthanklessAshittinAreemApayableAglorifyAemoAdacoitAcorabethBanvasesAbakuAarroyoAthéodenAsplatteringApay-per-viewAlaudeAharpingAdmsBevoursAbloodlinesAardaBmjadAwheelchairsAsnaresAmetzgerAkurodaAeconomiesAdecryptionAbackersAabsintheAwaterwaysAgilbertoAemikoAgroundhogAedouardAdecreasesAtantaiAscavengingApolarityAmystiqueBargaAlindsBeprechaunsAjosAcreelA24,000AtimelinesAshaluBatireCng-wooAqasimAmüllerAkronosBickbackAguarantorAdishonourAbandanaAapartheidAtadpoleAstopperApuckerAhungrierAdischargingCgnifyAchoppyA1926AtrixAruskAmisAiwoA'hadarAfungalAworshippersAvillainyAscrewed-upArunaroundAoraAkrugAcoldlyAacluAwell-respectedAthemedAsonataBaskiaAmultiplicationBobilizingBakethAforearmsAdnrAculpaBatharticDcoA440AunoccupiedAtoodlesArecipientsAoutbidBdiousAmoisturizerAcrusadesBha-chaAanjaAwinfieldAunderbellyAnibblingAluggingAinsubordinateAhystericsBopelessnessAfantasticalAseaverBcytheAnuptialsBettieAlbsAjuárezAhealersAbrennaBlowbackAaustriansApreachersAosamuAman-eatingAkentaAgerberAdirectivesBecodingAabhayA38thAvatoAgimliAburgledBittuAadjectivesAparrAovertAlimberAjjajangmyeonAsuffrageArotaryAkenyonAcécileAbushelAzongBéAvillasApresBadawanAorderliesAjettisonAdetaineeAconclusivelyAachtungA10000,0AterminatingAknowwhatAishaanBnjusticesAfullnessAdownwindArescindApituitaryAmeeAhabeasAgustsAdesignateAashleighA555AuncontrollablyAtoughnessAnraAharleeAgood-lookinAdruidsAcollisionsAyu-riAvulnerabilitiesAseepAramseAhampsteadAdown-to-earthBicedBecepticonAzonedApranksterAjettyAfeltonAvibingAsonoraBluggedArationalizeApyotrAhilliardAestablishmentsAdiffersAtribulationsAsqueezesAletoAheadfirstAdirectionalAcullyAfour-hourBlemmingAcorrosiveAuntangleAshetlandAintercedeAboweryBerkAmisbehavedBarxistAkiyoshiAferocityAamitaAtakeruAshavesBabaAlovelessAkasugaAdissolutionAcarisiAbudgingBritonsAalphah00A32ndA0.5Awell-educatedBanttoAtailgateAnyborgAla-la-la-laAjerriAconfrontsAbreachingAtheoremArekindleApariAnighty-nightAkimaAigaAhillmanBarriganAgenaAcuriouslyBommemorativeAannabethBmphibiousAyuliaAtakuAnourishingAmolarAhovelAdoraemonCnghyunAcutletsBarnivorousAbohemianAunmaskAmid-airAdisorientationAairlinerAthrowerAreactivateAledaAgamAemancipatedAsomewheresArubikAnelloAisaacsAfour-yearAconciseAunsolicitedAsubcommitteeBtiltsBhingenBandpaperAresidencesAgavAbelatedAattachesA425AsparseAinclusionAgriswoldAcamposAwieldedArenaldoAniamhAmilitantsAlook-alikeAinterconnectedCsertingAhumpbackAguerillaAelectrocuteAtancrediAkitaAjagguAezequielAdo-gooderAbanksyAayferAsvetaArefluxApremiumsBallyAfibrosisBerventBailsafeAelitistA9-year-oldAthemselfAoverwhelminglyAinebriatedAfavourableAajussiAvertebraAu-boatsAtoninoBelltaleAparent-teacherAgeezersBarakAdisembodiedAbiochemicalAno-no-noAlupitaAinauspiciousAconsistingAalekBgrippaAtrippyAselectionsAphiloAhottiesAcopterAthirty-sevenBarynAsomethingsBcoopingApruningAflavorfulAdaphAanselmoAwhatâAshitstormCearArectangularAone-bedroomAmcdermottAfigureheadAellinghamAarcheologyAwoodedAsnazzyBiltAfarisCncifulAerisAbroomsA451AsumptuousAroaredAoutrankAmagpieAlikAduplicatedBiscountedAcomingsBfdAxiwuAwritinAshihBalutingApalletAimpairmentAhyung-nimAfissureAcurleyAppAmasteringAcorsoAarcheologicalAunbiasedAswordplayBquarepantsAracyA‐okayAhoulihanAgdAfortiesAeclecticAbrokeredAusoppArucksackBemorsefulApendragonAironsideAfar-offAdastanAafrican-americansAyear-roundAhakoneAdolittleBilipAartisanA1,000,000AzevAxanApsychoanalysisAnosebleedsAmalivoreAcoweringAbracketsAspokaneBemtexCamlessAhairedAguy-AchutesAback-AarbitrationBnagramAvoicedAstillbornAkerseyAhippopotamusAghostingAdeusAcawAwide-openArieBavanaApowdersAogataAmanojAjustifyingAidentifiableAgabbarAfloppedAdialledAuntidyAtranqAjailbreakAfairfieldAcanoesAbuyoutAanspaughBmitabhAkeltonAgoofedAryomaAloathedAfindlayAsnideAhemlockAclamorAartemA0fAupgradingAsecond-classAquartsAgarlandsAcartagenaAaveragesAwheatonAvalleAtogaAshelteringAnewspapermanAilluminationAfuckupAcertifyBardassiaAboiBlockerA264,460AvarianceAtessieApeacocksAmachuAlackeysAinnocuousAgalavanAdrawbackBimaggioBecadenceAcantrellAulfAthinkyouAsilksBhokoApittedAmadokaAbucknerBlurtedAasakuraAprogressivelyBittmanCgletsAmitigateCshimaAgidgetAfiindAperlaBannedAopportuneAmotorboatAlarrabeeAimpuritiesAgredenkoAsimple-mindedBachiAkaitlynAgratedAambiguityAslow-motionAreassessAoglingAhardwickCppendAguaranteeingAfrescoAdissAshuffledAnickersAlaguardiaAieAcrappingAtwo-minuteBorbenAsmilinBhackedAmiddleweightAkathieAinconsequentialAfreezaAelongatedAdiddyAcrackinAbankedAsnowballsBeverusAexcommunicatedAcohesiveBarnivoresCnsuAbegrudgeA'2AwolfmanAsuzumeCnbathingArickeyAminsBcgintyAdealinAturnoffApeppyAnimueAjesuitAhorsingAdefinitionsAcaressedAtomorrowsAprovenceBolackBiercingsBaperweightAon-screenAlightbulbAindochinaAdoddsBioceseAwind-upAmanamiAcrammingAτhatAnerve-wrackingAlyftAinterveningAczarBarsickAauthenticatedAtaxedAstewardsDppinApretenceBalpAmodulesBitaAtwo-AsurveillingBerizawaAprecedingAleeksAkernelAeffingAdunderAballplayerAandâAsaiyansAmetcalfAinclineAf1AelvishAdeviatedAcontraireAbrunswickAsatsumaAlithuanianAjointlyAhedyAwintertimeApolentaAcul-de-sacAbreakfastsBerensonAasheAvikasAtoleratingAnalanAfieAdegenerationAyoung-jaAsecretarialArokApolanskiAoverheatAlambdaAinstigateAbadshahAterAquintonAknopeAharsherAeriAantoniAorsiniAnonviolentBewsreelAgriggsAdoctor-patientAcarmeloAbattousaiA28-year-oldArotatesAnudistBearyAderogatoryCnnisonAyanaAronaBeactivatedAlmpossibleAinternedA221AwinklerBhite-collarAtillieAshancaiAnewsomeAmouAextravaganceB-mailingAmishapsAinexplicablyAbookletAziegfeldAharborsAgracelandAearnerAbidetAwell-likedArefrigeratorsCevaluateAovarianAmasochistAwildlingsAtwo-bedroomAshenzhenArituApersimmonAnuanAmolestationAkotterAilseAhooliAunclaimedAtempuraAmatedAkissinAbarbossaAanecdotesBbbessAsoongApainstakingAnrAmeatheadAbagleyAafisAunremarkableArefrigeratedBadiateAclamouringAyu-jinAunquoteAmolesleyBertonAisoldeAeerilyAcovid-19BadenAbangleAairbagAritualisticCcansApiranhasAloosingAimplicatingAhenhouseAgunfighterAduplicatesAcarpeAshithouseBcampArecantAokraAhygienicAbratvaBloominAtakayamaAstyrofoamBketchedBchoolerAeveninBlectrocutionAduelingAcicelyAvoleAryAmeowthAindulgentBllsAfervorAecologyAdethklokAcryogenicBonclaveAabsorptionAsubsidedAncaaAmuttsBandiAlooseningAkazanAhoroscopesAdoltAsleddingBillApractitionersAjingjingAexcusez-moiAcarerAblockersBillaA10-minuteA‐yesAsubduralBhuklaCarkdogBexismBaudisAmuirfieldAinterplanetaryBawAhavAgunkBreenpeaceAstrikersAmerlotCnonAlevitateAhalehAfour-starAexpectantAcapcomCitAtoddyAlayoverAjueAhasselhoffAgovernanceAveroAstarfireBhaniaAprioryAnuancesAhigh-pressureAchartedAbushyCndledA1900sAwell-informedAnilsenAmontenegroBalickAlatkaAgafferAevensAchloéAbrandenburgA195AsuckeredAprevalentAmustachesBahmudCebyAkoryAfarmedAex-partnerAbravesAyusefAwhippleAsweatshopAhavishamAgrainyAengagesAcombsAbirthedAurchinsBptempoAspontaneityBimmeringBhereeAmuffBasamuneCnnerismsAglassmanAconjuringAayakoBbrasiveA197AtransitioningAshallotsApokeyBarallelsAnagoyaAfairviewAbig-shotA‐thatAnyxlyAmyspaceAknutAheadyAgrammaAcorneaAarmadilloBpplejackAmarstonAivanovaAdry-cleaningAbrittneyBeelzebubA68,430AwedgesAtrBonerAniklasAkearnsAhurtlingAbougieBattlestarAtriadsA'dibAdepictingAavrilAverenaAsnowpiercerBemi-finalApinaAdidstAcassioAslanderedBcrewupAkeycardAhomelanderAdecreesA1700sAsussAnomadicAgirlishAfistfightAdoldamA415AyowlsAtransfusionsArizzoliCgoBaghavAlong-awaitedAindiscretionsAexhumeAchemistsAzordonAwaistbandAundignifiedAservicemenAmisusedAlifestylesAjurgenAgrifterAbexAworkoutsAtoiBapewormAskatedApneumothoraxAoutcryAmisatoBaleficentAhomosAdraganAconsuelaEervativesAbargesArespectabilityCcheckApeeringAorificeAmusketeerAleafletAhuberAgehrigAcreightonBatalanAaquiAzhaAyasinAtwo-headedBrickierAredheadsApashtoAi.p.AblareAarvindAunconsciousnessAtsoukalosBoussaintAstrategizeBelf-portraitApeyoteAmorgensternCdiAlogbookBatviaAivanhoeAhypnotistBigh-strungAdodsonBeep-seaAclipperAanglo-saxonBcmeAwilcoAflirtsCatulenceAworkmanBienersAtaxicabAkohlAilonaAdenningAchinnaBensoredAbullhornAtweaksAprankingAmuradAkeriAgrettaAfriendlierAchroniclesA35-year-oldAtoodle-ooAquasimodoAdestabilizeAcomparativeAammoniumAtwylaAreplicatorAkonyaB2AhagglingAforsakingBlamingosAcavemenAbubbieBackerAautobotA10pmAsampledAfifty-fiveAadministratorsAzeligAtripathiAsystolicArileAclobberedAtrappingsAsolicitorsApreyedBffAninety-nineAemissionBlginAsummedBhanksBadlerApuriAlittlefootAaromaticBdolfoAtwo-for-oneArepaintAmembranesAlobbyistsBanderAworseningAvarmintAsleepersBingle-handedBantAhanniganAdrunkardsAsoberingBhoo-inAkidderAhazarAfeversA136AsourcedAregrettablyCenaApolyAmountainousAjordiAscootersAplatypusAimaniAflirtatiousAarbyAtanisAsneerAjumanjiAcampgroundAugoAtwinkiesAsnapshotsBhit-facedArepentedCgulatorsCachableAjoaquínAimperialismAgod.AcardiovascularA10sAsonoBeussAprecursorAkjAjustlyAfumblingAdownloadsAcolicAtanjaAmerrimentAinvadesAcontinualBapuletAyasmineArompApieterAnickingAswordfishBoryAoveAmangAkhitanAgraftsAdissociativeAcircaA99.9A6.5AseditionApreliminariesBicchuAgoofballAenolaAcountinCnchitaAamethystAwhopperAtempsAsienaBerdarBcribbledAmagnificenceAkuntaAingrainedAhaikuAdeliciouslyAcouncilwomanAblastersBffsAyarAwryAstuntedAredesignApromissoryAmadreAgood-luckAsprinklingBleepoversBequesteredApersistedBarnellAoreosAmutateBanifestationsAjenniAdisheartenedAcolletteBhristosAamourAyachtingAuhuhAtastierAshimizuBaritaAphippsAindioAgallantryAbegetsAanorexicAwestleyAtransplantedAsynchronizeBingedBcalingAryeonAmacchiatoAgrayskullAdum-dumAmicrowavesAfccAdownsizingAyasukoAstrychnineApeléAoverwatchAkidnapsAgullBlancingAcpdAbrugesBorschtAapplebyAtuttiBransistorAremarkedApreceptorBaintbrushAnot.AcramerAvienneseAsupercomputerBhastriApenetratesAlawyeredAkellAfrazzledAdrumsticksBecedentAamenadielA222,460AtransmitsBip-topAroanokeAmarniAloaningAbalsamicAskittersBcalyBangriaDbornAreuseApredestinedAmengeleAharkenAdependencyAcatnipAzionistAspanielBcreamerAportrayalAjailbirdAinvokingCterludeAhedwigCadmanAbradburyBailoutAtrodAoverridingAfringesAsickestBantasAoutdidAkodaAgoopAfawcettAeckhartA156AsoarsAp.c.AhamsAfeeneyAdoggingAcitationsBhangelingBaltechAvittlesAunzipAtapiocaAshort-staffedBerratedApunkyAljustAcemAvalerianAserbAred-headedAnomineAmillennialsBalfunctionsAhon.BinkleyAcarnivoreA204AtyrannosaurusApetuniaAmiakaBeirAkennedysAjtpAfishlegsAbedouinAananyaBcknowledgementCcompaniesC-12AovertureAkuoAdowlingBissipatedAbraidedA404AwigginsBaringApolarisBeregrineAoutlastBbligatoryAmoseyCrwennaCnasteriesAkazuyaAgenresAevelBmittedAcutoutAbelarusAsardiniaAleannAkensAhaciendaAclearestBhikaBameramenAunsightlyAsangoAopiatesAlabourersAknievelBimberleyAhonchoAemmanuelleAcaulfieldAmarbellaAknottedAimperfectionAconceitArelocatingAeuphoricA777AunchangingAth-thisApythagorasAnagiAivanovAhiyahAducBratAclunkAbunsenAayoA30-minuteAzoëAmizAdiallingAcomic-conBalorieA26-year-oldArusBebukeAhanlonAex-convictAbartendingAzaAtransitionalAsharpnessAkilljoyAgrasslandsAdeductibleAbrubakerBogotaAteatBahsinAspielAodeAmorrisseyBatteAjun-hoAidiomAachooAtaekoAshimmerAretainsAqueuingAmikkelAheronAcorruptsAboyoAtraffickedAshavingsAraillyApretenderBerfumedAnincompoopBatural-bornAmcclureAcoolnessAbidingBalmyAarcaneAvilleAtimberlakeAreassignmentAplatedBastedAiversonAfledglingAanaphylacticAvapeAtrotskyAsubstitutedAprobabilitiesAnicolaiAmanservantAiruAgrandmasAflirtationAdroppinAcannaAbyeonAaegonAzenoAunwashedAgamersAforegroundBirstsAchandeliersA'boutAuncontrolledAtrifectaAkalpanaAholmanAenvironmentallyAapprenticesBlyAtransportersAstarkeyApurgingBamperingAmehdiAtreadwellBhunderousBerranAroostersAmotherfuckAlittlestAcockeyedAvaporsAorganisationsAmojitoAjammiesAbeakerAadditionallyAtributesAretentionAphotoshootAorbsAneumannAthird-degreeAsorensonBiaAplannersAfallujahAdistortingBhruvAbreakdownsA234AvikaAthruDowbackAsunflowersAherzogBasslesAdpAbronteAstifleCeffiBourdoughBesshomaruAodourAlivingstoneCspAhutchinsAegregiousAconsummatedAarseholesAspikyAripplingAornaAlightnessAcurzonBlearwaterAbullfighterAtattooingAstraighterBorbonneClidsBandeepApenaBauAmoulinAltsBianaAknAjensonAhazzardCngoversAfencedAvuittonAunmatchedAon-stageAmp3AletteringAenhancesAsaddensAroanBenownAflauntingAessieA'whenAtolkienAmumm-raAjackassesAhsiaoBoshinoAfreewaysAdrazenAcassiniAshesAmaybesAhugginsBeheAunmaskedApowsAhalilAchambermaidAbogotáBackpackingApauliAnormalcyBewsweekAlissaBanningAflockingAdotingBelmarCgasAculpepperBonnersBanstAauthenticateAwrite-offBon`tAshort-handedBalzburgArevisionsBatnaAprosperoAmulberryAevermoreAdeidreAttsAsaggingAoff-guardAhaldemanAoverwhelmsAmomentoBantelpieceAgatAdorsalAkanakoAcontradictingCerceAamericanaBdditionsAtruerAsoftestAroadieAloungingBiteracyAinfuseAhennyCartlandAcaptorA402AreinstatementAprecociousBiquedAmobilesAlenderBakotaAfistfulAdelectableAchoosersAaqueductA2100ApietAof-ofAnorwegiansAm.c.AleggingsAhaywoodAfluctuatingAturpentineAsonogramBcammerApoonamAneelyAmalinaAliquidatedAinsurgencyAgablesAdrovesAbungaBastianArãAmajoringAhodjaAdubakuBakAattAvauxhallAsilvermanArubioBegineApistachiosAngaiAlogisticalAkyung-hoonAwitsecAvargaClentiAsurpassesAmosquesAjustâAincitedAdevastateAcolvinAbreastfeedAvaccinationsAshipmatesBcalpsAoberonAnavabiClaAmccauleyAleafyAgsrBodardAcreasyBordonedAbabluAshowyBeo-wooArenlyApalinAiglooAdatelineAblechBekirA134AoftentimesAnyAlividityAimeldaAdesecrateBawdlingAcreviceAameerAwell-manneredAunderdogsAstacieBhrivelAred-eyeApezuelaAomnipotentAiniquityAhervéAwozniakBaterworksAthieveryArickieBegulatoryAquintessentialApsychotherapyBatriarchalAooh-hooAgreat-great-grandfatherAdefamedB-donAcryptocurrencyAbuffaloesA12-gaugeAslashesAfrontingBancierAbabajiAassertionA242AobeliskAgareAelkaAcontradictsAmiroAjadziaAgo-getterAcyborgsA1903Awu-tangAuniquenessAsibelAreconfigureEgnisesAis.AharumiAagnewAsaddlesAparlayAnewbornsAluizAfiendishAtumultuousBhree-timeApasserbyAnicksAfamiiyAdurstBark-hairedAsethuAphilippineAkaitoAgekkoAcommendedAwrigglingAshoemakerAprabhaAnurAmailroomAindistinguishableAescaladeAdeficientAcomprendeCjonesAbumblingBaldingAadvilA967AwankingAscrimmageAmustangsAdauphinAbereavementAadrianoAyeehawAsquatterBolicitBequencingAparticulatesAforevermoreAaeroplanesA520AticktockBelecastAstealthilyAnewkirkAher.AdyslexicAcorinthiansAbereftAamélieAteflonAmobilizationBikadoAhéctorAelicitAdorneBiagonalAadmirablyApedalingBassepartoutAinletAestablishesAbraithwaiteAtallulahArikiA'rentAnepotismAjimaAintermediateAemfAdiplomasAcloveCinchBaricatureAbarisAactualityAvandalsAtranslucentBhebesBapasAnogAmasalaCaAlow-incomeAkhadijahAingmarAhaddockAdefameAcaulderAaarónAwolowitzAundisciplinedAtreasonousAqatarApranceAj1Ahook-upCjoBeadgearAembassiesAbadmouthAaucklandA'aimeA65,000AvocalizesBacationingAtodoAstarbaseAricciAinsurgentAassessmentsA.44A213AteddiBamuraAsingsongAretractedApresidedAno-flyBelleAmozambiqueAgrimeAfootnoteBennerBavoritismAdisengagedAbanerjeeAmussAlorriesAharshestAdeprivingBabbledAunzipsAtuoAstyBowedAperpetuateAnankingAmasaruAgrizzBaksitalA1.7AzootAteelaAlibAewaAconvergenceBhunyAblackestAaaahhhAmeehanAintravenousAcapriceDpAbullshBalAspiveyApurvisBlant-basedAmeijiAloathingBndianBeapedAharkonnenAgooglyAeodBntrenchedAdittyAchrissakesAashrafAoperaticAlintonAhillbilliesCghlanderAgisaengAcarmAasterixAtune-upAspaldingAnetherworldAmarkieAlegalityAjump-startAcrainAbloodstainedA7-year-oldAswishingBproutingAprofiledAmolloyAenamelAcheriAapprovingAuterineAtoyouAmikaelsonAflaredAeconomistAdiscriminatingEiplinesAcoburnBhibsAbosomsBa-baAalvaradoAreplicasApascoeAjeannetteAhasegawaCrmoniesCndsomestAgeorgyAcave-inAsubstitutionAlaurelsAkrillBasumiAfeministsA'dellAcbdAbruiserBegumAameAyutaAwoo-jinAta-dahAself-awareAmasonsAlungeAchanneledAæµAu.sAsenegalAromancingAnorwichAmisspokeAlonnyAfenwayAdevonshireAbloodlustAassangeAtangyAsurrogatesAreyanCstockAorcaAlowingCvelinessAgisborneBaltAflurryAzigAvermeerDdiAsavinAportoAflagrantAeye-to-eyeAskittlesBissiApappasAoxycontinBpportunisticAhyperionAgündüzAduluthAarianeBjobAwaldronAsollozzoBchuylerAoversawAnourishedAmasatoAexecsBstradaAcontestedAbalkanAtaekwondoAsquealedAomniAjoustBacobiAdimpleAcornflakesAsynapsesArajeevAprocreateAnippingAmyaAcarbAsayakaAmomokoAelodieAten-minuteAkeychainAcontemplatedAup-frontAreassembleAincisionsBmplicitlyAheirloomsAelspethAcancerousAalpacaB.a.AwobblingAvoraciousBizagAurielAstrokedBlobsAisotopesAholiestAepitaphAdisadvantagedAcymbalsBottagesAwoodruffBaistcoatAmedeaBcveighAkeenlyAhorizontallyAfirst-nameAdοnAairbagsAtimbuktuArikuBachidApontiusAhairsprayAevyAcruelestCistianoBontrivedBakewalkAbowlesAwreckerAsuvsApropelledAmalayalamAginsbergAbunchesBiotechA198AsnarlAcrystallineBlenchAavramAplanterBendrickAneed-AgaultAfreshestBeastsAcourageouslyAwiretapsAshibataBeamenAjacquiAhunchedAbushedA'bannonA2000sAstreamersCaunchBmokescreenAjemimaAcletusBhamAbequeathedAatkinsonBspergerBaaaaahAyeobAsomersaultCcietalBhauryaAromeshAmurderessAjimenaAbuoysA458AzimAsinghaniaBhangyanAon-callAmalenaCdeaAkylaAexpeditedButhanasiaAblipsA30pmAswordsmenAnarcoAgaffneyAfrancBoreclosedBiberglassAcobainAburkhalterBishAartefactAwhoa-hoAtopazBeleportedAbridleBoarderAweanAsireeArepealApoplarBenalizedAlocksleyAjuicedAcomparisonsDmander-in-chiefAbairnA370B04AwestlakeAunsteadyAsiredBhuttlecraftAjumaAinterceptingAdaanAtelfordAswiftyBorbetAexertionAdecayedAsustainsAmathematiciansAheave-hoBalvedAbardotAakiyamaAvegetativeAunwarrantedAopeAnationalismAgibAfscy150AdailiesAcrossroadA501AwatchtowerAsupremelyAquoiAnoblerAhunkerAfranchisesBalsettoAeunsuAcardiAboo-hooAadilAuninhabitableAscoochArezAprobedAmonikerAlobBapsedAfavouredAcpaBleverestBengizAvirgAropingApembrokeAmollariAfaithlessCcedownAestesAdruggieAbugginBonneBaderAzigzagAshingleArecedeAlopsidedAgreyjoyCammysBassyAfecalAcorwinBhildressAbalfourAamityAunsulliedAtaeyangAsit-upsAreynardAnscAmotheringBejíaAisakAadvancementsAvisageAseizesApowerpointAenchiladaAdecomposeAcrinklingAbreslinAartsyA162Await.Apissed-offA'nowAmightierBartellAlaughlinAiotaBll-manneredAhidekiAbaudelairesA't-iAstdsCaciAproletariatAoffhandAhirokoAgroundlessAfrickAcloppingBheatinAbellhopBajieA2.00A00pmApenmanshipA'forAcourtiersCrroboratedAamountedAyabukiAwhitlockAvindicatedA'unsAtoe-to-toeAquizzesAkochiAfreebiesAeeyoreAcabrónAarelysAsidhuApetticoatAelegantlyAcuttlefishAvictoriansAthiagoAreal-worldApattedAmearsBargarineCndatedAlikeyAcritAtime.Apre-medAnikosAmeridianAlevinsonAintensifyAconquerorsAamadeusAji-hoonAcomforterAbigtimeA231AwalidAthorwaldAnastiestAmarmadukeAkohlerAhaggardAgeyserAtakeoAslippinAnandorCderAill-advisedAgöringAfoggiestAempiricalAarnAuncomplicatedAswayzeAfluctuationAcroakedAblindfoldsApiece-of-shitAlilliAkanzakiAdspAadrenalAwhaddayaAstabilizersBcurryingBavagelyAradheAhanneAfigueroaAdisserviceAclashedBhanginAwhiskedAreprisalsAplacateAoutlinesAmachikoAholmAenchantéAcrocsBomplexitiesAblakelyAajiAwimpyAstyxBabuAprofitedBent-upAmaresAdarkseidAakioAswimsuitsAokayedAdistractsAcarolingAbeatboxingAwhereforeAvandalAsynthesizedBoothesAjiangnanAhobokenAdelacroixAtelepathsAsmartyBikanderAritalinAkyosukeAissB.c.u.AhouseguestCffmannBarshadAchristophAbrassiereAair-conditionedBfter-hoursBbhorApeugeotAoffloadAnehruAmenelausAelaAdried-upAweirdedAtigressAstruckerAnanobotsAhectaresAdrusillaAcorrieAtychoAstentAparietalAkamillaAhygienistAgiulianiAexcitableBventualityAcoastsAxiaoyaoAtetBadashiAlangerAbeauchampAwall-to-wallAvampsAtakagiAsanjiAreestablishBamjetAoutbreaksAloveableBigamentsAignatiusAhustonAfleetwoodAenronBminemBlbaAcotillionAtalismansAhoistedAaruA80-year-oldAwhiteheadAtoppledAskidsBitrepApeckishAnorwoodAincessantlyAdovBefrostAconferredAannoyinglyAzornAyiuAtelevisionsAsynergyBu-jinBifengAmagistratesAincorporatingAfavorablyAendowmentAboardersAwoundingAswingerA's-letAscudderArotatedBathApioneeredBhrasingAliterateAkrampusAinteriorsAattenboroughAwell-connectedAsummationApistonsBaiseCedophileAotaBssAmackayAkualaAfarhanAtearyAsturgeonBatokoAmisogynistAin-flightAfelledBatherlessAcrosswalkBontraceptionCmmissionersAmaterializeAkarAeiAdimasAcommerciallyBadenceAblackstoneAargentinianCcheologistsAsplendourAregimentalAoncologyAnobukoBapierAmacleishAibuprofenAgoldfarbAelyBggsyAchafingAbrunettesAzachariahAyourseifAukrainiansAsymbioticBtenographerBame-sexArecoupAphilistinesAolympianBcAgendarmesAfreerAcrustsBompositionsBlaremontAsplurgeBcottsdaleArawlsAopenersAlaudanumAcombustibleAuntamedAsillinessAravesAmintyBarginalizedChendraAl`veAinfectsAfattestAdonalAcristobalBambodianAbraziliansBarringClzacAvenkmanApellAkuboAislamabadBcebergsAgivethAfaneAwoodhullBeaklingsAverdunAswarmedBtubbleAproppedBarableAneurosurgeryBautilusAmukeshAhanımAejaculateAcalliopeAbarometerAschoolmasterApresidenteBigheadedAmethinksAkristineAfscx150AcredenceBovertlyCrmanAappraisedAunderlingAsycamoreBeveringApushupsAkayceClyanAenquirerAdumbbellBanvilleAbouquetsAschaefferArohrApocketedAogresAmuntAkomodoAhermanoBauAdeaderBcpAchiffonBapaAapparitionsBllegingAyomAsegueArediscoverAinterceptsAgilletteAcattyAtribbianiAmincemeatAjesperAdownriverAblumAtinfoilBalmudAoniAmantaCitreAappuAplainclothesAmagooAdiarrhoeaAarrearsAyesesAtantalizingAsandstoneAreferencedApomAmementosAkakaAharmonicAdeflectingAclunksAbonanzaBlacklistAanniAzaiAwastinAstepsisterApatriziaAmonarchsAi`llAhibernatingAdong-jaeAcronkiteBlearancesAbehind-the-scenesAayrtonAusernameAthreadyAryotaAheroicallyAdeiBa-da-daAchandAbelayAajaAthoreauAsocialistsBilvanaAhaplessAdisapprovedAcondimentsAashtraysAtheoristAsheldrakeApsychosomaticAobtuseAmarzipanAkbsAjessaAdastardlyAcoppingAbodineBelgiansAwinchestersAv.p.AtawnyAstaffedAoustAmotorbikesBhAtweedleAself-worthBcarabApenitentAlookoutsBitchfieldAjarringAanti-matterAwhoooAquinoaApurdueAnestledAhashishAembarkingAdistortionsAcharuAbumpersAachievesCademiaA1860AtrailedAspandexBandalwoodAnaveenAmessalaAlasalleAinflexibleAhuh-uhAforesawAdominatrixAarthdalAspitfireAohmAmind-bogglingAgunslingerDnersAbondsmanAanointBccostedAwell-doneAstonyAoverseesAnight-timeAmosbyBelodiousA'gannAconsoledAbainbridgeAsnobbyApokesAnitroglycerinAmuddBclaughlinAexhumedAdvrBoctoringAcarrilloAbesetAunseeAtrommelAmake-outAkohakuAhankeringAgossAdeferredAclosed-captionedAbettieAkruppAinventorsAglimpsedAfarukAcélineAtauntsCrrAquintanaAmarinaraAlatinosAhedleyAeugenioAdemarcoBarpaAcolesAballingAyeimyAskinheadBcramblerAinterjectAhardsubCllucinogenicAchristoAartooAracecarAquartermasterAodileAesmaBlrondAcontentiousAapplebeeA33rdAunfeelingBenoAtricorderAstrombergArindsBeclusiveApeacemakerAmillersAcappyAsubliminalBpoolAre-electedApoppetAtuppenceBrebleBomeBaikingAsharpshooterAprejudicialBarenthoodAkowtowAcalvaryAtelenovelaAsocialsAptolemyAoppressorAnazareneAmaisonAliberiaAkemperAisiAexactingAadjutantAretailersAponceAmme.AindisputableAhimalayanAfawningAchachaAbasantiAaughtB-listAsongwritingBkolAlapsesAincidentalAgovBayaAexhaustiveCcavationsAchrishellAadairAprobationaryAmmmmmAdustbinAconfidanteAbungAarmouryA168AsalutesArukiaApertainsAoutwardsAnonnatusAkielCddosAwhuppedArichelieuBeddishAprologueBackinAerrantAdrunkerAyoshiokaAtouchy-feelyAswingersBilliestArackhamApsshBlanninAnonchalantAeditor-in-chiefAbutteringBackboardApurdyBittanceAmisdirectionBammothsA'gerAdeferenceAyagyuAundergraduateAturntableBhinlyAsaschaAoverloadingAmertzA'howAcurvatureAbreathinAamboAwreathsAvoluptuousAstreamlinedBidleAlook-AkilogramBardashiansCng-hoAedmundsAchalkboardAbrawlingBedpanAtipperAredundancyAlvBife-savingAfreelancerAdulcineaAcessnaAbremerBoughA148AresortingApolinaBetitionedAormAgranddaughtersAduelsAtriteAoomphAredirectedAmodestoAkeyserAgumptionBottliebBeesAemilianoBeveeAaslıhanAyevgenyAwithersAverbatimAtextilesAstiffedBketchbookBhuaiAplayaBharmaAengelAdolphBepositoryAbubblegumBanisterAyılmazAv.a.AstammerBagesAroisinApâtéAmeanieAlinnBaertesAjuriBlAgougedAvirginieAparadedAgripeAfoxturkiveBertilizeAexpungedAcompensatingA3poAvilaAstrepArecalibrateAhoneycombAfarragutAbylineAunyieldingAslavedAraineAprimAopaAdorenAcentrifugeAboyceBluesyAyunhoAstorefrontAredecoratedAnorthumberlandAlocaAjoseyAfavoringAenthusiasticallyAveilsAuticaAmartiAkotokoAinternmentAcenterfoldAsmurfetteBensiblyAoopsieAmarlenaAlugosiBidoAjaffeAemailingAdmzAcontributesA1776A've-iAtsAsyedAkarlssonAhye-jinAfurnacesAconkedBhakrasAbleuAtelepathicallyBacklesApanderingFmoniumAoutweighsBddballAkileyAjeffersAgetchaAfrederikAbltAaffiliateAshindoBafe-depositAparalyzingAinglewoodAcaratA218AtamikaAslitsAred-hairedAminoAjazzedAhotcakesAflingsAeyeglassesAdearerAcurtsyAapricotsBndrãAvehicularAmahmutAlovecraftBife-A82ndAworkhouseAsunwooAimanAgrowersBoboAexhibitionsAazraelAwhitingAshizukuAperspirationAmotoringAlivestreamAknock-offAintentlyAcockamamieAworkableAsubstantiateBpeculationsBhrubsAjefferiesAfaramirAappendectomyBmuroAwaitressingAvalourAtamakiAstadiumsAreykjavikApiedmontAofftheAnatsukoAmothraBikasaAgeekyAbiterAtsuAspiritusBhakurApopoBmsAmufasaAkorsakAhmm-mmAgameraAbaskinAtranscendentAsameeraAnarrationAmitoAloginAfabienneAcolonizationAbuffettAunsoundAshtickCerifBgApissantCecingAnon-violentBikaAgagarinAunderhillAsidelinedBhastaArelievesAphilbyAfermentationAcongestedCmbativeChortsAalbanAwickerBheelieAstanfieldBongbirdBlumpedBineadArumpusAnaacpAgenealogyAchathamAanna-katBerosolAtutankhamunAsprintingBhenarAreplaceableApitaAmorningstarAjoynerAforecloseBiirstAcroatoanBlaA345AyäAsolosAinfarctionAgiddapBauguinAemigrateAcornsAbeanbagAtokeBiltingAshephardCamansAplaymatesAo.c.AharadaAeffeminateAdown.BecoderAbreadsAaizawaAunintendedAtotesAswarmsBongrimAindiraDerAhobieAgiddy-upAeloquenceAbisqueAasinineAunsanitaryAthrustingAsnorkelingAmaharashtraAlutheranAhurriedlyBigh-stakesAguessworkAemphysemaAdomesAcranksBo-starAaffidavitsA'4AspecksBeptumArefrigerationAmorellAjudgyBoelleAfreakishBascinateAentrepreneurialAdae-soAbirkoffB0AsubmersibleBeventiesAregencyAleonieAhumbertAdegenerativeA1865AnaggedAcroneBondemnationBlementsAanniversariesAsplutteringBoftyBhortsightedCapeshifterAricketyApoo-pooAmasturbatedAdelfinoAbrunaA1906AsportsmanshipBaganAmiscarriagesAliabilitiesAdrummersBcfsAchpAblomkvistAazumaA4.0ArebarAlemursAkaseyAgreenhornAdrollAcritiquesAblaneAall-importantAtyrannicalBighAstupid-assAglaucomaAculpableAbeholderAyahtzeeApickersAmahAhereaboutsAcanberraAbulldozersBlowedAseparatistsApinpointedAorchestrateAmilleAlennierAheretoAentréeAdoubtlessAanswerableAsyriansAjin-taeAflunkyAcerenAbernardinoAwhoopedAtierraAryeongBespectivelyAorchardsAgulchAcosaAbentoA8pmA36thA183AyukuBammeringAvoglerAsolidifyAredoingApiusAdissatisfactionAbarkeepAxivAtrangApeacetimeAlook.AferretsAcryoBlineAbachmanAtoiletriesBexansArenameAoceanicAmorBinatoAkhushiAhoyAalexeyA223A172AwavelengthsAslobberingArodmanAprogrammersAmmhBavAgirthAspoilersAorelAmessinaAhomegrownAfrillsAexorbitantC-girlfriendsAasahinaA1908Asweet-talkBhinsCelledArustlersAmonolithAintracranialAfloppingAex-boyfriendsBvaporatesAdomineeringAcisternBhristianeAalejandraA2.2AroomyAdukatBeflectedAwifiAprocessorsBlisskenBerpetuallyAmontserratAdreddBebtorsAcyberneticAvirilityAtoilingAscaldingApootieBaralyticAopusAimperceptibleAhirokiAcriticismsBomteAbuonaAvichyAraftingApogoAnippedAhumpsAcoachellaAvisiblyAtactlessAsubmergeAkickballAdicksonAco-hostBameroonAburnsideBarbaAarmeniaAtechnologicallyAsuccubusAlimeyAzoinksAstuttgartArindAostracizedA‫‫iAgobiAcast-ironAsulfuricArepelledAprimariesAkilgoreAheiioAeduAdebriefedAcappieCesarsAbronwynAtoyotomiCuyaAlingeredAknockoutsAikariAbeiieveA1885Asen.AprostAmoxieBirkoBaribelCgusAin.AgamblesAcocaAmailerAc.whiteAafireA900,000AyoichiB2kAthoBableclothsAmodusAgoffBertyAditAconfiscatingBloggingAarmamentsAzephAtruroCansformativeAshingoBcuffAlightestAfossAdampenAυouAseiyaApujaAmeenyBarauderAkamilAjohnsonsAenticedAclantonA43rdAtemperateBadpolesAsmall-mindedBamoanAmatrimonialAgoingtoAtutoredAround-the-clockBecepAmemesAlakerAkilometreAgrouchAdemotionAcartoonistAbeatleA30-yearA2,200AperrierAmotorizedBenendezAimmigratedAelectrifyingForateAdemetriAcontaminatingDleyAbloodshotAunstuckAnumAkonAjesuitsAhoynesAgalinaAformulatedEativeAcivilisationsBelalAand--andA45thA143AyardleyAverifyingAsidebarBaggyAorganizationalAnipsAgrifAfondleAdisadvantagesBaiquiriAarousalAwozAunderseaApassableAmeatwadBarkosAuprootedAtesticularApost-itBercocetAmarchettiAleftistAgoslingAdetainingAconceivablyAundamagedAstinsonArajniApugAobstetricianAnagisaAlegalizedAgangbangersAcertifiableAsandbagArochefortApenningtonBarasolAnecklineAdisagreeingCldosAciccioAadjustableApowwowAoriginatingAmatriarchClinAgwonAdeadwoodAcurvyBaplanAburialsAasimBccompanimentA7pmAroofingAmeepAléonAjiyaAcomerBhinsAatheistsB.p.BllenbyAwalkie-talkiesAqurAprincelyBeonAldAkoujiBibbutzBeefeAgerardoBatedAfoosballAdisintegratingAcirrhosisAtriflesBiagoAoff-worldAneighAhorseradishAeardrumAdunlapAbuxtonAworshipingAskintBelf-containedArizaAperpetuityAkhakisAji-wooAgoochAdorchesterAcosmonautAwhammyAtamerArestroomsAmechaAlatherAjamiClapeñoAhipstersAgovernsBet-upAenergizeAcontritionAamnioticBdmittanceAtabathaAsunblockArole-playAprotectionsA'oAnorthmanBesbittAkeitaAgeckoBame-changerAbastAayhanBntibodyAsichuanArehanApost-warAirvineAeucalyptusAdaeguAboisterousAyowlingAselectsAlamiaAjalopyAcostasAa-1AworcesterBalkaboutAvigAnavarreAmid-levelAlettieAkumikoAexpositionAdisappointsA5pmAvdAstipulatedAredmanAone-hourAjaundiceAidolizedAcodeineAapproachableAspeedoBoft-heartedBhackleAreorganizeAnewsmanAhandlebarsAemaBcosystemsBagernessAwell-adjustedAtonneAsubstitutesBanctifiedAmaybelleAhollersBeddaAfitterAchatterboxA7.30AmintedAiongerAwhiskeysAsavantApepaAoutwithAmiepAgeorgianaAfosteredAerectileBffigyAcomparativelyAantifreezeAvámonosAunabomberAtalcumAsuzhouAobjectingAimbuedAhaqqaniAfaunaAcounterintelligenceAbroadcasterBowerA2.4AtereAsclerosisArigaBemedialAmerdeAkeyboardsAinedibleAhauptmannAgymsAfloodgatesAcoedAaddictionsAwiltedAuppersAtorturousAskinny-dippingBcavengeBartreAmanchurianCchiavelliAirieAextinguishersBdvardAdoughertyAwmdBhistle-blowerAroopAportrayingAferisAbadeAaldersonBcumenA60-year-oldAzhixiaoBenithAwaltherAvulgarityAn0AtawdryCsmaniaCilorsApreferentialBetyaAkatrinAiskenderAfuckfaceAdiluteAchesterfieldAboboiboyAathelstanAwesternsAuninterestingAsuppositionBerengetiBchnellApatrikCppaAnastyaAmothballsBcginnisAjarlAhow-howAamendmentsAprofitingAhumboldtAgiornoAcristianBardamomAthickenAroblesAmelendezBandibleClnourishedCgisteriumAimperialistAequateAalloBcclaimAyangtzeAmaclarenAhebrewsAforkedAdumpstersAcragenBompetencyAwolcottAsociopathicBibleyBanyaAoutgrowAflunkingAesotericAcomplicatingAbranchingAwincingAshape-shifterArotorsAcrescendosBalleAasthmaticAsquirrellyBensualityAraggingApartneringA'n'rollAkrytenAcondemnsAannalsA307AtaxationAspectreAprecedentsBhileasAmingledAgorenAcroixAwithdrawsAtwentiethAshrikeApronounsBlaîtAovertookAimplementationAhurAdispersalBeludeAcross-checkAbadaA125,000AudoAreissAparkaAgreat-auntAextortingAdevotingAclaretBhurrosCantelleAblow-upBiochemistryAteardropAnabilAcut-offBonstruedAspecialisedAjigglingAeenyAdriftwoodBivinationAc.w.AbunchyBreakawayBlindsideBeechAuntenableAsprigAneutrinoAleekAjabariAfundamentalistAdecompBaryllAyoshinoAtumblerAmulcahyBooningAleveragedAkosukeBamenAdoteBeflatedBagmarAcogsAplunkettAi.r.s.AgaspardAembalmedBarthsAdongfangAboozerAthaliaAricksAmagnifiedAinceptionAheadshotAforeheadsAenamoredAsundarBaraswatiAphlegmAlow-rentAgroupingBinormousAfraternizingAconfrontationalAveronikaAstansfieldAranjeetAkantDdorAcheckerAbedspreadAtimeframeApilotedAmadwomanAkumuAjeopardiseAhuronAandaleAundeniablyAnativityAanaheimBloeA241AwandsAtseBortoisesBhrushArasheedAprincipledAmimosasAlame-assAhee-heeAgrenouilleAblessesAyukariAobligingAmiseriesBediumsAgorgonBarvinAcowleyCnversationalC-edAawe-inspiringAwide-eyedAtianqiAsixty-fiveBeljukApopperAmitsuhaAjinnAfredericksAescapeesAdurangoAbauAwestportAporousBassinAoutfittedAmassagedAimitatedAharpoAgutturalBlobesAdelbertAwringerAsojiAre-upApeatBansiesAnilaAmazdaAlethargicAkkkAflabbergastedAentreesAbaskervilleAvivianeAsnogArationaleAoperandiAgadAfiggisAchandruBctvsAbarakAalphasAstainingAmaryannAby-productAartichokesAwaveredApurserAlift-offAgaylordAdoogieAvoughtBermilionAscalpedApossumsBennedAnever-AinterpretationsAflutesAbunkingAagitateAmisogynisticAfrownsAenhancingAcrossingsArinaldiBedefineBampartsAquarrellingAprovidersAkmartAcorrectiveBloaksAsarsApetrusAlynxAinaneAdeaneAcrayAbastionAwilesBannabesAscorerAgarfunkelAchauvinistAarrangesCnettBimlessAtorreAslitherApastsAnooAmiscarriedAlumAjosefinaAfrittataDngAb-52AtranssexualFitionsAslitheringAlandfallAdesecrationAcarmodyCliphAammanAwinoAsudhaBtarburstBkinningAkazonAjianghuAinuitAhyugaAferriesAdineroAbefallenAwilly-nillyAprashantAneutrinosAjengaAfritterAbandwagonAappendageBftertasteAredditAokeydokeyAmariettaAicebreakerAhypochondriacBaaAanbuA248AusoAstatewideArahmanApipsqueakBahAmeliodasAlimosAgreeleyAendoraBcgAcsAbeheldAaniaBgatheDAtolsonAsubsidiariesBtrutsAmail-orderAkickboxingAhoofbeatsCcus-pocusBigh-gradeAentropyAcarrionAaforeA306AsilkenBelf-doubtAeloquentlyAdulceAcalderonAacrylicAsucklingBlanderingAhypodermicAgyeonggiBropedAdraupadiBachauAchosunBantinaA47thAtoiledAswabbedBhohokuBalmonellaApneumaticAnumbingAmatsuiAlohanAhandsyAcarbohydratesAanimatorsA'whyAwh-Asoo-hyunBizingArevaApowerfullyAnarcisseAhardensCigAbromleyBaritoneAadrenalinAyakkingAtpAsaintlyAkazeAcaucusAyeniAneuteredAkissyCnoAcontestingAunscrewAtarnationAstepfordAmikaylaBatchboxAkasiaAjewellerAburroAalphabeticallyAuteAtrespassedAreattachApharmaciesAniniAmirthAharnessingAgromitAdhabiAclodAblinkyAairmanA.357AyahikoAswitchbladeBaloonsAready-madeAphoniesBainstakinglyAmanceAhaventCruhiAgushAfixer-upperA1.1AticoAsprawlingBovereignsBchoolgirlsBalasAnanoAfirestormAenvelopedCsuingAcarnationAbewitchingAreunitingAortonAnagsAmahaCgogAkrumAfantaAanythinAzilchBatoichiAyavallaAspicerBcavoAphuAjugglerAgwangjuAbouncersAascotBnhAwh-whereAtreetopsBarrantAskinwalkerBhreveportAride-alongAponderedBersonifiedAhightailBarrimanAfulfillsAdrainpipeAwomanlyApygmyAmeiliAlarderAfranãBlesh-eatingAelleryA232AtetchAsurveyedAoboeAmodestlyAhatchbackCrnessesAelapsedAdundarAbuckoAaerodynamicAochoAmalarkeyAconmanClonizedAblackberriesAazusaA4-5AvoyeurBicariouslyBeeruAuhâAslickerBakuraiApremonitionsBizzazzBecansAmatherAsylvainBouthlandBcaredy-catAmythicButilateAkippurBarmicCmlaAfluentlyBitzroyAcyberspaceAbygoneBlitzenBeltranAalissaA70thAvaliantlyAunserAtendoAsofteningCâBeyfiBammieAprithviBassagewaysAnanamiAmurder-suicideBoritaBistsCreyaBercierCchanicallyAk.o.AinstructiveAangelusCataAurinaryAtunnelingBhings-AshortwaveCadingAplagiarizedBensacolaAheparinAgalleysAcoeAamadoA236AthimbleArobespierreAinterpersonalAandhraA3.50A10amAursaAaccuserApadméAnumeroAmimosaBarybethAlaleAinhibitorsAguavaAdaggettAbotswanaA2,400AstrasserBalespersonAravageCcAmoniAkrishnanAhaemorrhageAfortificationsAdenselyAcydBathedralsAbronchitisAaudaAsuwaBome-AreligiouslyAprolongingBlacidAoverreactionAhibernateAguttingAconceptualAballadsAwhoo-whooAtoo.Asecond-bestArotatorBelapsedBadiumApastoralAonesieAmorphBerchandisingAleveeAgatlingCnglandAchibiAarugulaAwarlegganAragnarokAquietsAprovokesBoppiesAnoriegaBeurosisAlgbtAinsinuationsAfreddoAcastrationAbarnyardCckfiresA430A2-2At-boneAstrangenessCamfordBhovesCivajiAroughestAnotablyAmsgBedellínBcelroyAenlistingAcaramelsAbelchAacknowledgmentA9amAwearerAvincennesAtmiAsquelchesBlidersAmclntyreAcicBataractsAairmenAwell-versedBarlocksAtrystApush-upAgrowedAvenerealAtribesmenBoulonAprocreationAoff-puttingAmuneAinfertilityAharpyAguerraAforyourA6pmAwell-oiledAvaldesAsurrogacyCperchargedBtubbornlyAmonsantoAhellboyBattoriAembarrassesAdunkedAclutteredBamoAworkdayBidmoreAtopicalApufferAnοAmullAklondikeAgerrardAevpBrzaAcorrodedBabreraAvitroArun-throughBescuersCplicatingAhyacinthBashimotoAfrommAescalatesAdistancedBemerolBarienAcousteauAtelecomBasterAsaeedAronsonApalletsAolofAlumenAhadrianAflankingAengulfAcredit-cardA18th-centuryA꽃다지AwoodmanAtwitchesApoopyAnaylorAwideningAscallionsArampagingAnibblesAmiyuAhamadaAgemstoneAfabriceAdaffodilsAafghansAwetsAtrumpedApriedAmyleneBodicumBclintockAhernandoBang-upsAgrasslandAflakedAdetoursAchatsworthBelestineAburdensomeAsedonaBcarcityAprotrudingDficiencyAnprAmahdiAhardwiredAdilapidatedAcirceAzhaiAsidekicksAraucousApinchesAmountieAkakeruAgaetanoAeikoAbaruchA1907AunifyingAoverexcitedAmouthyBarenAkrollAjuvenilesAhighlandersAfarberAdivvyAcuttyA'challaAbadgersAamaarBlyaA'10AtelethonAsnatchesBkinheadsArosamundBiserAmiscellaneousAlacroixAimmoralityBgboAhargroveCndoffCkusanziAgunshipAerasmusAcharonAadultererAweinerAtomiAsorayaBelf-proclaimedAquandaryApakistanisAloraAjokinBean-baptisteAglintAcasketsAboo-yahAspudsBnarkyBinningAruanAmartheAimperiumAgimmicksAdelosAcountrymanAamatoAsilosArequisitionedAliferAhelixAboucherA1-2AvolkoffAsammiAruskinApasteurAnettingAflacoBearlesslyAbeniAyelenaAun-americanAsurvivalistAopiateAkraussBatharinaAipekAchristendomBalibrateAuncompromisingApostmarkAmongrelsAkimikoAglynnAflaringAdossAczechsAbrokenheartedAauthoritativeBquíA412A152AvictimologyAunwedAthurgoodAliber8AisaakAhm-hmAclotheslineA137,432AwakenAv.o.AunplannedA'supApouchesAosmondAmameAhazanAdoganAchattanoogaAvivaldiAshizukoAragerApittingAmarvelsCdeiraAlallyAchiaA157AweldonAtactileArestoresAposthumousAmotorcarAlow-gradeBanskyAheartstringsAgroundskeeperBaggleAfarmingtonAdouble-edgedAcuervoAvocationalAsubmissionsBhriAnattieAmysticismAjoyfullyAhotspotAdevelopmentalBarlingtonAavisA1890AsoloistBingle-mindedAriflingBeinventedApremeditationBlaquesBangsAmurdocBorehouseAcircumventAbotwinAaggrievedAurkelAtompkinsAspearheadBlatteryBeesawArelentAprobiemAfull-bodyBaringAeurydiceAaureliaAyuhAxiaobeiAsevdaArunoffBoscoAm.i.t.BigBannuAdingoBenaAconvincinglyAastrologicalBbsenteeA27,000AwouldstAthriftyAstineApontAfeteAentrapAcontingenciesEeAbootleggerAauthenticationBlessandraAsharkeyBapsArunwaysBaringAmutterAjiamingAhypotensiveAexasperatedAdorgonBicaprioAazureBll-clearA57thAstoopedAliposuctionAhyundaiAgeppettoAdyesBillardAblissfullyAalamosAtoonAscuttleApeepholeAmcfaddenBannaAkashAfaithfulnessAdreadsBostoyevskyBiwanAcongratulatoryAbirjuAamerBcrobaticsAηeyA‐weAtonedAsulliedApursuesAimpeachAgaynorAconvolutedAandreeaBkshayAventricularAsharpenerAreversibleAmunchausenAlinoleumAhubbubAg.d.AcurateBonstrainedA'chaimAaigoBbrasionAwazowskiAshipshapeAminoruAdenserAunsungAsoldieringBnatcherApopsiclesAjuicerAdigestingAyumikoAwilkersonAtanjiroAsnackingBenecaBaoriArobocopAkuzcoAjahAhinkyAconsolesAbookmanA308AtremaineAreyhanBattlesnakesAproportionalAhye-junB.q.AcataclysmAbloodstainAwaistlineAtheâBarantinoAspokesApatchettAmarlboroughAgaiAcarpalAyou--youAsteve-oCarinAnormieBeutronsAmicaAkiyokoAcouBiaraAbuoyancyA9834AswensonArecuseApanningAmeereenBccAismaelAcookoutBlunkingAbelchingBannermanAálexAworkroomAviseAnarrowerAinterceptionAaughAstriderBpawningBouthernersAredwoodAinsidersAexponentialBquipAcollaborativeCgburnAbuttedBolshoiBluegrassAwinnebagoAvoorheesAsmoakBidecarBhackingAreddickAnine-nineAmoppedBidwivesAjordansAcommeAayahuascaAwhy-whyAsupremacistArealnessAquakesAmorraAlawlessnessAensuedAxianyangAscusiApermissibleBandavasCblitoAmatiAlupanAitaliaAhaticeClf-cockedAfernsAarigatoAvoicemailsAstaveBcepticalAintangibleCdecisionAhot-wireAgianAdecapitationAculhaneAbretonAassuredlyAwardensAtomoeArowedBeimbursedAhacksawAfour-leggedBacetsAwordedAunconscionableAsympathizersBiddharthaAomitAjinnyAirateAhigh-energyBalf-eatenAdowntroddenBeedeeAcoddleAbettsAzippersAtrekkingAshantyArepossessedAnotificationsAinaudiblyAhalstonAgoodlyAchurroCronosAaegeanAprodigiousBereiraAlockieAkazooAheaddressAgrouchoAfaithsAdazAconsortingAadolphBcrobatsA3pmA1863AwellesleyAshortingBandfordAreincarnateApropensityBaragraphsAjinyowonAheadboardAforty-sevenAcampoAbonsaiAupholdingAsweatinBeedlingsAnickieAjiffAhuntsvilleBotdogsAface-offAcihanAbevanAwoodshedBidenedBhitewashAstateroomBhowmanshipApoodlesAnilssonAmousetrapAlatchesAknightedAjin-wooAfetaAconsueloAauthoritarianAseededBaleemApublicizeAoverruleElayAnicetiesAgreat-greatAcongregateAbalconiesA'areAall-knowingA0700AvolodyaBikkiAusdAturncoatBopographyAsakakiApatheticallyAmuraliBansourAlentilBaureAjerrodAheydrichAfjordBallbackAcaravaggioCgAbonitaBjörnBigwigsAsuccessiveBnippyBettinBchofieldArereadCapingApiñaAnewsreaderAliaiseAfoodieAbroken-heartedAarrowheadA130,000AturnpikeAsympathiseBhacksAreputeCconnectingAoddestAnarinAlumpurAgoldfingerAethnicityAbarretAundulyAtantamountAnaturesAkamiyaAglowedAescapadeBncephalitisAbreckAazumiAshortbreadArominaAkimoAinfuriatedBglesiasAharbingerAclavinBhuffedAblue-collarAabercrombieAramanApolynesianAlydeckerAhanky-pankyAblaireBattlebotsAzoltanAwordgirlAshorteningAnassarAkauAfreeloaderAblack-marketAatrophyAv-tachAsurfedCpermassiveArockersBaptorsAhikesAfujitaAdissidentAcondominiumAauditingBlderaanAtorinoAstrolledAhastinapurAcharlemagneAyodelingAvoltronAtuenAstandardizedBlavicBhakespeareanAprophesiedAowariAmurugaBeddledAintrovertedAhotbedAbarrackAanatomicalAusurpedBnburdenAtrollopAsumruBofasArenegadesAkeoghanAinnumerableAhm-hmmAfree-for-allAdiversifyAaffiliationsAwouldntAullaAskanksArebootingAkaaliAjwaAindiscriminatelyAharishAellingtonAdubbingAbrentonAvigoBalerioAunderpassAsoftenerApostponementAmeraAhot-bloodedAellipticalAdeathstrokeAcentigradeA101stAtintAswearengenBhow-and-tellAorphanagesCganicallyBogwayAminibusAlienAiateAfragilityAeasy-peasyAcleanserA151Awould-AtiersArivetsBailingsApandyAmanoeuvresDavCcaroonsAgyeomAferrarisAdyslexiaBillyAchunghaeAbaggieAweiweiAstrasbourgApsalmBhobiasBercentileAnishAmigoCd-30sAlong-hairedBevityCcherousAgyeolAbahiaAtauntedAsextingAoccupationsAkennerAgenoveseA26,000AwarthogAtattagliaAstarshipsBobelAroaldAmasonicAlamarrAcratchitAbeulahAayuAwoojinAtundeBsukushiBa-raAstrong-armBpurnedBonofabitchAkuttyAhemorrhoidAgreenvilleBodaiAfermentAelioBco-friendlyAdescartesAawashBchmedAto-goAsientoBhape-shiftingArusskiesBpgsAmoochBasseCnmadeAlslandAhemaAguffAenrightAdong-jooAbrinkleyBespokeBaroneAknockersAgazpachoAchengxuAbeefingDchamAaffleckAwhirAtongue-tiedCjoAstyledBhakersArazedCilroadedApre-existingAnightshadeAburlapBa-bawkAaakashA3amAwaferAoishiAgelflingAcharissaBandlesticksAbeamerAamicablyA5kAundercarriageAtophAskyrocketedApetriAon-boardAkhartoumAhattonAgauntAcabernetAbulkheadsAassistsAunderminesArangoonAlivableCddellAjaywalkingAgazesAfairgroundAerskineBnosAatypicalAwranglerAummaAself-explanatoryBang-minAovercomesAn.s.a.AgenerationalAflatlineBaceliftAeekAco-conspiratorAapprehendingA540AunraveledAthere`sAshaylaArechargedAoreoAjaipurAhokeyAfuriesAbinfordAa.s.a.p.AvittoriaAunsubstantiatedAtdAovershadowedBrnateAnuancedAmcavoyBadelynAdoesnâBetonatingAairheadAyoshioAtabascoAschoonerAratiosAm.i.a.BanipulatesAjasminAimproprietyAflaviaBeedersAdogfightAbutlersAanatoleAthirty-fourA'scuseArubensApoolingAmilitiasBedicaidAgottfriedAf4Abald-headedAanderssonAwhoahAtoyamaArountreeBedressApresumingAorabeoniAmojitosBitchumAhowardsCningAgudrunAcómoAbubbyAarnessBmcBflameA133AwholesalerBasntAsnipingApitch-blackAmatchbookAleggedAhomeboysAcinemasBhipmunksBaramelizedAbacteriumAaugusteBrchdukeAzumbaAterraformingBatersAsandlerAredfernBatchettAputoAkinsmanAinterracialBllustratorAh.u.e.AerasesAdressingsAyaelAspireAkilgraveBatanaAdrumbeatBetonatesAzpmAvelascoAthrowedAsubbuBnubBhereArigginsBetrospectiveCcompenseAmckinnonBakeryCharajAirrigateAhippocampusAdissidentsAaikenBdageAwareAveracruzAuncomfortablyAsaekiAregenerativeAprancerAoutingsAjeepsAinfrontAcopaAanything-BmuletsAshopkeepersAquorumApregoAgoldaAfarnumAderelictionAcrierBoombsAbirdhouseA32,000ApodcastsAmenagerieAenthralledAdisinformationAcumbersomeAbegatBabylonianAtwo-faceAraqApezAobiAmatchupCgnifyAlorasA‐heyAgoldmineAcroutonsBolonizeBhoshuAbortusBack.AasyaAzsAvivreAsunburnedBlogApaulsenCnacheAgreat-uncleAejaculationAcalibanAathenianA70-year-oldA238A100kAtangerinesAsynthesisAmemAkiriAincidenceBearnAflatliningAyurtAmayweatherAfamiliarizeAelectroshockAcouldntCrticalCntiCincidesAbreakupsA315At.o.AoberstAlancashireAhydroAgargoylesAclean-cutAbreechesAweavesAunfavorableCbuttonAsitarBeparatistAminstrelAhammAacutelyArennieApterodactylAnoooooAlemmyB.b.BafitteAimitationsAgipsyAfendersAerikssonBnlargementAduplexBingedAchurchyardA.andAwhimsyAtoyaAsumatraArelayingAprabhuAnikolajAlamestCddAgargleAextortedAcalmnessAbolusBarziniAanginaA9pmA1909AyuukiAnycAmeannessAlorAktAjelliesAdespondentAbrerA75thArukawaBesentingAimmobilizedAhosedAguzmánAdisruptsAcruxAbhuvanBenefactorsBabiAawesomenessBbreastAveluBashCrysAsarekAhand-pickedAgibbyAfookAcodenameAvitallyAquinApeepersAmarksmanshipAkiliAgroupedAflagstaffAdevdasAcorroborationAbriaAahuA1-6AwormwoodAshimonAlazAinevitabilityAdelightfullyAcompoundedCleyBallingsAbodhisattvaAaioneBdidasA317A180,000AroshiBe-establishApuddingsAone-handedAkeywordsAconcededBhuenBelinaBammyAbutcheryCbonicBedchamberAargumentativeA2300AwitlessAvassarAswirlsApérezBakiAkriegAheadlongAchickpeasAwhoopiAsombreroApublishesBrosperedAomanAkobolAhaifaAfilingsAcellistAbicepBeachedAastrophysicistBngierAwaysideAslappyAnegateAlimehouseAjacintaAimpulsivelyAflickedAdrawbacksAcriminologyCetinsAbodiceAwoohBhittierAtejaAshoplifterAnylonsAcrucibleBlemenceAyasuAwaltzedAvallejoAshitbagArevisingApapuaAlgbtqAdasherA3-1AyagaAkyaBeanAhoo-ahAfun-lovingAbyeongBombardBaptisedAwenchesAvioletteAunderstatedAtuxedosCgboatBasselsAsudsBtockholderAphuongAnadirAlustyAkibbleAashlandBirfieldsAyunnanAvalyrianAunilateralAspousalApennyworthAnuriAiolaAgod-awfulAfarradayCireAescapeeAcollagenAskimpyBhitfacedBeon-wooApronouncingAkasparAifheAhijabAfraternalAcrouchingBlickerBanariesAblabbermouthAafterthoughtA475AwymanAvasyaAsigurdArethinkingBavanAnormalityAmugglesAkoolAhimuroAburlyBiohazardBeetrootAamidalaBlternatorAwisteriaAtorturerAsulkyBcopesAparmAmelanomaAlockboxAjusticesBhansiAgandyAdurinAamaneA59thAunequivocallyAstottlemeyerAricochetingAocpAionsBnventsAgusterAegressAdisparityBeadlockAattendeesA2024AtubmanAfournierBaintsAchorA2.8AshinigamiArock-solidBatifiedAlow-fatAcurranAblindersAauburnBlcoveAunattachedAsigneApervyAkellieAjoannAfeudsAbrailleAargentineanBmygdalaAyilmazAthackerayAsalinaAralstonAninetiesAkronkAirrevocableAhonorificsAfibonacciAdebtorAconfoundDcussionsAbaxtersAzhukovAsigilApshAmobbedBingoBaedaAjamestownAegomaniacAass-kickingAyellinAwilfridAusurperAtrimbleBendersAsnortedAottomansAmintonAlong-lastingAkristianBostaAhertzAfrasAchisholmAbusbyBlankenshipA154Ayu-rimCichiAsleetAromaniansAmcgarryBalfeasanceAkrayAimogeneAfawkesAdispatchingAcuddledBapraAbloodlessBest-sellerAansariAuaAtesseractBalaCelonsAsqualidBporadicBoilsArakedApixleyAopryAnigerAmuralsAlikeâAcuddlesAbiologistsAwild-gooseAtulioAsoirBensuousBcrappingAresurfaceBay-rayAmustaBorelloBajnuAgyoAcanaveralAautotrophsAtugtekinAreceptacleApridesAootyB.g.AmoroseBessieursAkurokawaAgrubsAcypherBamusAbuenaBloomerAyeatsAsoulmatesBkyrocketBhrunkenCangelaBabahArumouredCbénBeinforcingCaApolaroidsBetroAlarueAkemAiistenAhornblowerBerdedAcrouchedBhartersD-cha-chaAbloomingdaleAphooeyAm.r.i.AheimdallAghaziAdeemsAchotuApromotersAmarmeeAlife-longAjanuszAayersAvioletaAt-thatAsmearingBcreeningsBadiqAmodifyingAkoshAguapoBribbleAexaggeratesAcosmopolitanAbonhamBackstreetAaiyoBbaddonAtruantCansceiverBailoringAspliceBimonaArolodexBepaintedBanvirApinataAmolarsAenchiladasAbooedAarletteA2,300A've-AsweetenerAreunificationApoiiceAbuttheadBrattonAapneaA'thApalazzoAokaAmusteredBachetesAgreenieAfrylockAdaisAcorrosionA'avAraduAprelimAothmanAnymphomaniacAkwongAhomemakerBandshakesAfollow-throughAcocklesBindiAautomationBppropriationAwashburnAvaleryAthongsAsuretyAresectionApvcBidgeAmoonstoneAemphaticallyAbluebellA19,000B864AtestimonialAsuitablyBplinteredBoyuzBickensAreshapeApromicinBetulantAmercutioBalleableAhypnotismAdisablingBeepenAbang-upAaccoladesA409AyoniAprankedAminogueAk-popAhankaAforgesAdncBisclosingAbloombergAvirtuosoAsucreAperplexingAenormityAcordobaAbaylissAagrabahAweedingBalcottAshowstopperArubiconAmulchAinterdimensionalAhuttBalf-mileAgraphiteAdoodlesBarianAchatterjeeAskillfullyAreclaimingAflinchedAdoranBisputingAcomplainantAbiddersAyunusAmopsB-myBeekerAivsAfabricatingAdrexelAbluefinAsweetiesBoosBalehArequiemAqbApopovAmcfarlandAkuryakinBenzoAfrillyAcordovaBanvassedAwingateAsaying-AgilaAcausewayAbarfedA173AwindbagAstreakingAmysterioAforumsAdisassembleAcutiesBatalogsAyoo-jinAthrustsBenzinAstockpilingBoonyangAroqueAprospectorAnostraAmasakoAlubbockAjulienneAinterruptsAgassingAdykesBroopyA54thA153AsterilizationBelf-awarenessAgold-platedAfataleAenquiredAciaranBashewAwetlandsBatermanAvenkatAtyreeBelexApernellAkaluAflourishesAcohesionAyellerAsmockAromanovAnot-notAkasiAjeffordsAimhotepAgallifreyAclaptonBensureAbimbosAtransformationsAriotersApavlovAmtaAkayakingAgravestBobbledAbremenBellefleurAyouichiAtitaAs-sorryBpooningBkimpBapporoCgAhogwashBepaticAfondestBast-trackAdokgoBietzBharamA28,000Ayour-yourAvarshaAthompkinsAstormtrooperAmultimillion-dollarAinducingAfour-letterAburblingBorrowsBarcaAmidwesternBagruderAlópezAkmsAjewellAhalf-timeAgiancarloAfosteringBazeAelfoAdunkingAway.AungAmiwaAjameyAilluminatesAhaskinsAcrabbAbenningAtucksAstructurallyBkewedAryulAmiraiAdyeingAchompsBatastrophesClistaAavalorAtrumbullAsheratonAritsukoAperrineAmournsBakunouchiAheinekenDdelbergBamillAalevAtobiBeasesAstarletBoapyBagitariArifkinBed-bloodedAcorneringA4pmA1901AresyncedDettingBamesesAnothing.BittiBeeAmeritoriousAgersonAfuehrerBreedmanAbartokCd-temperedA3-2AtutsAspunkyAplaygroundsAmandaloreDagerialAkazuAgqBongsunAfedeAeludesAdynamoA158AwhoopsieAneimanAdesnaAcheetahsAarenasAyanceyAwingspanAtypewritersBwingeAsockedBetoBcarransAmerciesAflyntCippantA4-year-oldAsashayArpmBneAprostrateAmikaelaBemorialsAkrogerBneadBarpovAhydroxideBelipadAfedoraAevoCerything-AdionneAbeefsAwestmorelandAsweetenedBhlomoAlaputaAkagamiAdefectionAausaA255AscarranAovaryAindecencyAcounterproductiveA939AwindermereAtheologicalAs-soAreliantCassignAproverbsAlusterAjavertAindelibleBmplementsAh2oAfilipinosAexportedBasy-goingDelAcoiledAackA2pmA1902AwithstoodAupstageAsamoaAgood-heartedAdantesAballiAakersBdolescentsAtranscribedAs.w.a.t.AroomfulApediatricsAmonotonyAkäAimpregnateAgondoCdivaBlidersA'atAvicksburgAmutilationsAlike-likeAfreakishlyAexhumationAdown-AcapsizedAairliftBgtAsitchAorthodontistAmuchachoAlabourerAdoritosBae-suAcorinthBhandigarhBellblockAbolandBettersAavilaBmaAx-ratedA'upAszBleepwalkArepositoryCferencingCcapturedApillagingAnagataAinstigatorAgetzAfannieAbungledAaperitifBislingAveidtAshreyaAmerrimanAhello.AfolliclesBlawlesslyBishbowlA.50AsteakhouseArevolvedBajasthanAorallyAloopingBeotardAhi-hoBemorrhagicAgujaratAfortunaAdiscontinueAseducesArewireAponAgratuitousAcataloguedAwaterbedArearingBawrAnewscastAjun-shikAheadquarterBanäAgungBangwonAfisheryAbãAastrophysicsBntaresAyeon-heeAluridAkarrasAhigh-securityBarboredAgolfersAfxAdeep-seatedAcontributorsAbehradAaslıBllocationBdiniAuavAtankingCllisAsolidifiedAomeAmin-hoAfrolickingAchrysanthemumAbellasAaaliyahAtamingAsubsidyBought-afterAnikkoCcklebyAinvernessAglBandhijiAtippyAreplayingAprimevalBaraffinAorlyAmilliAlalitaAdilbertAbenefitingAxiaoyuanAwoooAtelecommunicationsAsulfateCgaBtillwellBmorgasbordBemisArecantedApeacekeepingAmapoAcreditorAbuteauAalmanacAzarekAyugoAvinayAunfetteredAtotemsAswindlingBous-chefBighedAkitanoAje-hyeokAinconsolableAhotnessCorahBieroglyphsAfootfallsAalgernonApreppyBaperboyCliAostentatiousBceansideAjankoAginnieAfortressesBlyoverAenysAcommodusBamilloAabusersA90210AthundersBannoyAohoAhijackerAgraveyardsAfuck-upsBootpathAclaymoreBastellanoAbreedersBeeplngBbc.co.ukAamtrakBerodynamicsAtamarindA's-aApridefulAjacintoAgeinAflossingAblur2BasraAatmsAwoolseyAtangierApriyankaAfrankenBockerAaleksandrA226Ayear-endAworkspaceBengBaddleAvernacularAtibbyAsunniDdaesBkaBhibaAmutatingAkurataAhindleyAbagmanAtsukiBattleAsalahArabinApapyrusAjayeAindignantBmmobileAhappy-go-luckyAgrassrootsAferroAdiscernibleAcountermeasureAastonishmentAverbsAtranslatorsBhermonuclearAsuzanApulsarAmandolinAlayneAill-gottenAgrilleAbernhardtA80thAqiongApathfinderAoanAmachadoAknollAflecksAdiscriminatedAcotterAboilersAtop-of-the-lineAsoul-searchingAnevinAmid-lifeBermanAï½AcommendationsBautionedA55,000AweaponizeAvirulentAstephensonAporeAofficiateAnorthmenAdispensationCgressAcirculatoryAbulgerBrunerAaloisA6amAslantedBaboteursApecosAmayorsAkorAjanosAfroyAarmamentAwhoa-oh-ohAtitiArothmanAlittle-knownAkpAitunesCjustAginsburgBeorgiAfransAdubrowBriftersAboerAsurefireAorthoAmidoriyaBedavoyAlaw-enforcementAhospitalizationAcrockeryBlemenzaAbarmyAarisingAtianjinAshoalsAregentsAicarlyAhawleyAcontourCmmuniquéBlausesAbeefyAtyrolArabbisAmagentaAlattimerAjacopoAiciclesAframe-upAdefunctAchandanAblankedAzlotysAunassumingAnon-disclosureBationalistsAloundsAkaulderAhyun-sooBi-techAthirteenthAsideboardAryujiApredatesBenroseAforaAequestrianAdaydreamsAbrickmanBookstoresAzeroedAyorktownA'yesAtraumatizingBalkieAsteinbergArienBentonApheromoneAogamiAharveAarisAwhaaAswoopingBtaffsBnowboardAlonelierAjvAirAfugueAcripsAbookmarkAaranBmbivalentAvilmaAshekAriddingApazziAnudieAlaminatedAinterAgridlockCeat-lookingAexilesAdogvilleAcartwrightsAbravermanAasmodeusA1888AvalmontAshan-tsaiAnakiaAmotoristBanleyAinaishingiAcompliedAare-areAzweiAwordplayAtechnicolorAspectrometerBimplifiedArainierAnetherBaganoAmilestonesAkilimanjaroAinsipidAherzlAdissedBeviledAcourt-appointedAboulogneAayakaAuedaAtansyAsymptomaticBtellBlurredBhueArdxBamyaAprotomoleculeAmercsBaratAhaulsAflapjacksAcordiallyBassiopeiaAbuellerAanacondaAstretchyBengBandpiperAnegotiatorsAlong-windedAgraftonAfunctionalityAever-changingAtufanAsemi-automaticAremadeAquimbyAnizamAlenoxAimpersonatedAheeraAgarglingAdetestableAclarifyingAscience-fictionAretaliatedBationalityAlindAkhmerAinfieldAgriddleAeveythingBncinoAsmartlyApersimmonsAnatiAlancerAjellicleAfreemasonsAeroticaAdoodlingAbunyanAanimateA4.2Awell-fedAumarAsrinuBciaticaBalamanderCckingAroofieBajiApawingCrisiansAmoussaBedianAinferenceAheroinesAburnt-outBattlementsA1897Around-tripBelegatedAphelanAottAmailboxesAleclercAinexperienceAhyoidAflatlyAestonianBmphasizedAxoxoAwashoutAself-sacrificeAphatBerjuredBathogensAmcmurphyBargaeryAkarnakAjuicingAgussieAfleabagAdefraudAcriminalityBloakroomAbjarneBesottedCemerBahrainAaloysiusAtakadaAspasticBolanoAnamekAmagnificationAlisetteAgremlinBordAagarnAwatneyCbashAresonatedAoctaveAconsultsBathcartCseworkerAbelliniAushersAseaviewBcowlAovercastAnonoAhalterAffffffAdisgustinglyAchérieAbeguilingAvirenAmuerteBerveBccormackAldäAhosannaBernanAerickAdelkoA139AskunksBchoolersAregsAprerequisiteBhilanthropyCeasantsAmauserCnticoreAlongshanksBightersAinfractionsAextractsAdecipheringBaejeonA8.30AvolmAtogusaBearfullyAsuburbiaBlingsApersecutingAnighthorseAm1AkendricksAhinderedAgotenAfull-sizeAdrug-relatedBerivativesAcourse.BhloBementedAangledCabelBlyoshaAwadaAschlegelAruslanAnight-AmesopotamiaAlabelingAhigh-pricedAgriftAfrothBlip-flopAdoodyAcowellCmmutersBellophaneAa-cominAthrongAstunnerCaffersArianaAmasonryAhinderingBeerBang-upAfireproofAdislocationAcandelaAballpointAyunqiAwordsworthBhoo-hoo-hoo-hooAswoopsAraheemAphasedAmurtaghBamiyaAgyulAberkowitzAswapsB.u.v.BinghamArevertedApesteredAmodesBid-20sBessierBayumiAlatinumAkahunaAinhibitAgratefullyAewingsAduduAcalifornianAboswellAalluraAspanningBociopathsBeepsApurerBershingAmild-manneredCkelAhavetoAgraphsAfossilizedAbelievethAayanoAreeveAnaturalistAjulietaAhobosBewlettAgulletBranniesBeraltAfirmamentAchappedAblunt-forceBaldnessAand-and-andA192,230AuesugiAself-indulgentAquittersAneddyAlookeeBeyAgwanAevocativeAblackerBefore-CanstalkAaravindBffordsAtraumatisedAmilburnAgabbingAdionysusAconcludingCmmodeBaspereA'amatoA131Athree-pointAscrollingCholarlyAraspingApradeshAoveractiveButlyingBgawaAletitiaBabiaAgokceBanjaAcostnerAbasieAalabasterBbdiAyancyAskinnierBcripAprissyBlatitudesBatrisAmeldAdollopAcrumpetsBowanBartedA6,500A3.8AwazAqueenanAparthenonAoutstretchedBlyaAkuangAdoiBerivesBanzigAchaucerBarbonaraAbloodiestBeauticianAae-jeongAwhittleAtailingsCesanAsupeBlinkAmauritiusAhoyleAconlanAbisbeeAarvidBmritaBlcottAyukieBostBellowsAstoriedAremmyAprefaceAmaritzaAlugoAjørgenBet-laggedAblowfishBernhardBastaAtae-sooApoxyAjoystickAhitchhikersAfireballsAcariAbonzoBidamBelcherAvalaAunsatisfactoryBlsterAtidbitAsign-upBalernoAovercookAmisdemeanorsAjubeiAhovercraftBayamaAex-loverAdissingBaichiAchouxAbitteBelittlingAakoAnarrativesAmeleeAlestatAgratifiedAcockneyAartisansBltitudesAsoheeBlimmingApreachesAmuggersBcfeelyAinjuriousAalveyBffiliatesBbsencesA30amAyigitAun-fucking-believableAturpinAshadowedApitchforksAovertakingBnce-overAnicoletteAmaladyAjamboreeAhairdryerAgrillsAfootstepBlaccidAdisregardingAwomackAshaleBcintillatingAre-enterAprimusBeleBalisadesDatableAmajorcaAhand-in-handAgarsonAeywaBscapadesAdarjeelingAculpabilityBolouringAbrigidBirdmanAattunedAtransatlanticAshirkApliableBickpocketsAnegligibleAmatsudairaCrathonsAcoitusAworldviewAt.s.BinsleyBhaoAstillerCapledArajatAparfaitAokuboAmuhammedBilletAluthorcorpAinwardsCnaCaraAhippocraticBeadhunterAdecimateCaringAcopacabanaCnsultationsCmplacencyBhavoAburrowingBinhBeltersAunequalArevoltedAnhlBeurologyAmultitaskingBanfrediAheartachesAfracturingAcolónAbroomeCainwavesAxiaomanAwhoa-ho-hoA'twasAsiphonedAquestsAnegligeeAl.j.AgardaAexoskeletonBnrichmentAcarneAbringerAantlerBltruisticBgataAtakethAre-openAogleAholleredAfaredAefficacyAdiddlyAchasersAblackingAzenigataAteatimeAolfactoryCdmanBaxacaAmayuAfondlingAenchantBarthlingAdetrimentCarbornAburgCgattiBooniesBad-lookingAall-purposeAsympathizerBtrobeCir-fryAroebuckApaysonAnobbyBewellAkindheartedAinsulateAfitzyAexpansiveAbuntAwell-to-doAundeterminedAthirdlyAsnowmenApunctuationAmicrochipsAlongfellowAioriAguatemalanBendersAdouchebagsAcomasBlichãAbarbaryA1870AzhenyaAwebbedAnicaAleviticusDel-headedAkathmanduAjoieAgirliesAfpAdismembermentBeulAcorderoCnformityCmbatantAbertoBamaA10.30A....AthaisApitfallsBeddlersAnumeralsAmillardBalliAkifAjabezAgeneticistAbaselAvexingAtocBheodoraAoverlooksAfrom-AequinoxAcapacitiesAbeverleyBartsA50kAstereotypicalBmoothedBlimmerAon-airAmarrakechClayaAknowthatAjakubAgroundwaterAendorsingAdialectsAbuttockAanti-semitismAunsanctionedAslocumAquinineApavarottiAhuevosAcadillacsAackroydAsylBhould-ApotsieBantsuitAorestesAhooeyBendrikCllmanAgalwayAecmoAabhorrentBaahhAvecchioAtongaAshockwaveBchoolmatesArestorativeAlegalizeAgunshipsAfonderAelectroAbobcatBlazedAthérèseAsherpaArediscoveredAoutboardAmanishAlaurynAforegoneAbastienAausterityAwintonAultrasonicAstewingArepentingCdskinsCaiAoutshineAhalf-dozenAfifteenthAexportingAduffleAchilliesBandieAbarracudaAambrosiaAstewardessesAprezBisserAlullabiesBocustBlewellynAkearneyAheâAfriendlessAeriksenBntitlesAcourtesansCnversationalistDdensationBarryinAbrienneAarribaAtimepieceAskeweredAroadhouseAmonocleChamadAkumiBdAbloodsuckerA314AweitzBaterwayAvayaAurinationApuncturesBixelsAokazakiBfitAjervisAimporterAeurghBlysiumAdiagnosesAcontoursAveroniqueAtorosAsuesAreciprocatedApalpatineAmatsuCndoA'asAant-manAτheyAwarblesAurquhartAtax-freeAshuoAg.w.BnatAfendingAdagoAbrighamA174AtrujilloAstrakerBaheonbuArochaAmughalAingratitudeAhyun-seoCdrationAdishingAbreamA30-dayAtri-stateAstarscreamArear-viewBajputAkronorAinundatedBdeologiesAhalfwitAfedorAcartwheelsAyahoosAtorpedoedBhem.AqrfAnigeAkinjAilkAexecutionersBmmitAcreasesAallendeBbolitionAtoriesAsyntaxBtrumpetAresonatingAmadiganAletterboxAeuclidAyts.mxAwalk-throughAvasAtutsiCscanBootinAscoldsArémiAmilitary-gradeBassingAlycanBaxativesBãAkeisterAguys-A'gradyAforgettableAearshotAcobbleBanneryAawningBkitoBgitatorsBchedA49thAyonduAxmasA'sullivanAsequelsAokieAnoblyAmihaiBaximum-securityCndaAlittletonAkaguraAfrailtyBarooqAconsigliereBatapultsAbankruptedAalcideAzealousAvitalyAsunnydaleBcipioCammersAniskaAmagiAlarssonAglacialAeun-sooAbeckoningAaramaicAvagAreijiCekingAmyseifAkublaiAintroductoryAfaveClconsCcetAcoriAbuzzyAzaheerAstipulateBpiffyBalomonAroxaneBeconsideringApatrolledAoverqualifiedAnkBettlesAm.k.AfrustrateAdispensedAbovineBarbarousAasceticBinsworthA10-13ArianAno-manBerysAmethodicallyAkieAjavelinAclAstovesBoybeansBeobBamwiseArumsfeldApuebloAofherAmiyaCreAloveliesAkoryoAjerriesAgambinoAduplicitousAcorduroyAarmbandAxlAwoodsenAshrubAmisjudgeAkandaAincestuousAhandstandAgluttonyAcoruscantCncussedChaagenBartaDetakersAabrahamsAzitoAwell-roundedAtayyarAshrankBaksCdoAmillingAglitchingAdoornailA'donAdelroyCanoAbeddedA8.5AtuckeredBight-lippedBhicketAsynchAruffoApo-poAnevaAmungoAhunnicuttBermiaAgradientAcotsAanthillCalysingBdelAyingyingAsquabblesBarisAlatvianCmazeAfumiAeasesAdusseldorfBorieBisavowBecoAbendyAacetoneAskeetBeryeongB-AprominenceBooledAorganizesAlysanderAgargamelAfãAdomoBelineAartisanalAvoirAskiddingBawed-offCmsungAreplicationApradeepAmoriyamaAkneelsBerchiefAhorvathAfacilitatedAdismemberAattacheBslanbeyBppalachianA10.000AwhinnyAtriBiptoeingAscrew-upsArefurbishedAmetteBarceauAleaderboardAhaversAguileAfluttershyAexxonBphemeralAcarbonateAadjournmentAupliftAsteppeAmiliBenziesAlevonAhoracioBarrisburgA256A10-15AunwittingAtottenhamAsharpieAnutellaBapeAmellonBakaylaAimagawaAfujiiAelectricsAa-bombAwookieeBicksArecessesAplungesAlooniesAkurumiAhandmaidenAguardoBtoAdescendentAcartwheelAbleachingAabsurdlyAsvrBoftensBegaArhodeyBedidAhumerusBaramAdreamlandAbaklavaAsumireBozeBelf-taughtAnejatBame-callingAkenaiAjohnnoA'isAgrataAfazioAdelongAunspoiledAthackeryArunaboutApolluxAhangzhouAgolanAcubbyBommutedBlose-knitAbutteBrightensBonersAaugustinBdvocatedA2,700AslavaBhankedAonyxAnorvilleAjonathonAinvoluntarilyCdenturedAgenusA23,000AtsangBemptressAsiphoningAresumingAmcquaidAkannanAisabelaAhamstringAgrenadaAbaysideAwanderersAtriathlonBime-sensitiveArotcBeproducingAnunezAlibrariansBeesAkreizlerAexaminesAbrakebillsAaireadyA4x4AtsukishimaAseoyeongArakAnine-millimeterAhmoBaldolAbuoyantAzakiAseepedBchoolmateBakuApeyamiAonodaAnosferatuAlatersAkeelyAjo-joAedgedAdownersBabblingAberesfordAallocateBethelflaedAobedientlyAmislaidAlingxuBeftsAfuelledAdispleaseBelicatessenAcorroboratingBackleAbrrAwillinAthoraxArammingAnagelAmumbo-jumboBoneymakerBaizeAlandmineAjeffyAglugAdogmaAcaninesAbluffsBasAarbitrarilyBnti-warAwimClkieAunappreciatedAtailor-madeAshit-holeArufflesBoublesAmariannaAkenzieAflBeignedAexuberantBnlistmentAdrippedAcooperatesAbicarbonateAargentoBpertureA192AzafarAwalkiesAvisualizationAmetadataAhmm-hmmAgulagAdonatesA9.30AvolkovBestaAsmartphonesAralloApreviewsAnakajimaAhellyCikeAgleanAdispensingAchaimBardiothoracicAaptlyAscopingAreproducedAnoxiousAintelligentlyAextrapolateAdistendedAbullet-proofBegetAwikusAsnafuBedgwickBcrewballApindarAoompaAmortallyAhickmanAgrigoryBaborAfishmanA'dearAcreepierAbedlamAassuringAυοuAunfilialAstillsonBhimlaAriskierApontoonAmaharajaAkikiwakaA'helloAfollowinAcorsicanAbmoAtowneBaysteeAsetiAmystifiedBeteorologistBccallumAlakewoodAkvnBidoAhomophobiaAglorianaAexcessesAbezosAa-okayBltaA364AtulaBopoAsheetaAreversesAlinguisticAjobeAexquisitelyCcelsAconcoctAbjørnAacademicallyAwetvAunwrappedAtwerkingAsussmanAprenuptialAoccupancyAnomaAmosquitosAkiiiedAhymanAcrawlerAburlingtonBlundersAakselAvermillionAprayinAoutsourceAmiyoBaigretAimplicitAfridgesBishmongerAdislodgedBanburyAcommutingAbioweaponAribeiroAproprietressAmanicuristAloafingAharunaAeffendiAclassicallyAaylinBnti-socialBbettedAquinceañeraAproximalBalesAimpactfulB-ifAephAbrewsA60-40AzaphodAtamahomeAsquidsBorrentoBawadaArewritesCcord-breakingAploddingAnauseatedAharlandAeenieAcrevicesBaiiedAbrawlsBalwantAanti-tankA246AtoastersAsupplementaryArecollectionsBarerAqingqiuAornamentalAmonseigneurAkurokiAjuanchoAgeetAfiskeAdivisiveBecryptedAcarreraAarturAzippyAtrudeauBachycardiaAsibylBavouryArogeBamblingsApotpourriAmagnificentlyAlelouchAjedediahAdelinquencyAcoffeehouseBheckupsBaucasusAbhauA3500AwaltzesAsutcliffeArumblingsCkaAmiuAlycansAkishenCdmanAirradiatedAhoriAenquiringAday-AbriocheAvellaAone.AkanataAjaniDgoAgrierAdividendBeutschAcrosswordsBhaffBevicheCrealsAbkBackflipAamaroAyuwenAweissmanAthree-pieceApsalmsAmacedonianAkiyomiAjunketBamunaAcrackdownAbrutalizedAadaptiveAzenaAsquallBprintsBkepticsAmaliciouslyAkoharuAji-hoAgoodspeedAflatbushAdictionAcoppolaAalbionAwildflowersAtreblinkaAsprinterBourpussBadaArouenAinstigatingAhubieBammyAfoulsAducklingsBohaA186Awee-weeAstringyAplumesBanthroAnorrieBaruDdoAleonorAkerimAconspiratorBhaperonesBappuccinosAbormannAantiguaAveeredAtwo-dimensionalAshort-temperedArestrictingApig-headedBeripheryAmosulBacneilAlife-and-deathAkinchAilanAheadlockAdemeanAcandiaceAbrightenedAtatsuoArequisiteApacquiaoAmerlotteAkikeAinverseAhot-airAdumaBismayedBenominationAbologneseAvoice-mailAtailpipeAsejongCe.ArebootedAmaryanneAlilleAforty-threeAcoincidedBatarinaCimanAbudweiserBogoBest-caseC1AwiiAunbearablyAtinklesAsurfacingBannaAquillsApipelinesBatternedAmanufacturesAletterheadAhypoxiaAdemureCclinesAchiffreAbarbarismAarwenA8amA167AweiboAseopBayethAregimesApityingAimpatientlyBchinoseAhostessesAgreenfieldBerAdivinelyAcampusesAadvocacyAwestbrookAsesCabiscuitAkapilAimpassableAhot-temperedBaggisAgoinesAfulcrumAdoctoralAcoattailsAbriscoA'tacAshut-inCrinesAmultiAindomitableAhotpotBarvesterAgitmoAexcusingBun-hoAconferringAbreast-feedingBatsmanAamoBdemA37thAthirty-nineAmookAheadliningBalf-lifeAforetellAdunningAbriareosCackenreidBalinAyanyanAovershotBcularAlogosBaceratedAconcourseAattendingsAzhiruoAwatashiAskilfulArosalineBeformingApublicizedBoolsideAnoughtAmallikaAkryptoAgo-kartAfree-rangeBairwayAdemolishingAboorishAakaiBhmonA249AviabilityAroller-coasterAphilanthropicAmeghaAlinguistAittAhumpedBaruoClalAgraterBenkiAbyproductAadachiA193,284AschruteAresellCjuvenationApunterBloAhammersmithCimAfixableCneryAcroquettesA815AxiangyangAvatsAtakakoAstenslandCarlaBanctiApreconceivedAoffingAkalashnikovAjassiAhirstAgeothermalAcarstairsAanzuAsgtArhodBevueCemaAnunaBomuraAmichiBensAinfomercialAhi-fiAchiantiBantorAbarbiesAstallionsAravagesAmemoriseAlowensteinAjust-iAivanovnaAhydrochloricBarpsichordAgreenwayAfeigningAexpedientB.t.a.Bighty-fiveBastsideAdentistryAcondenserAbosworthBeepedCckwithBaerA5,500Arent-freeApaperbackAminhyeokCgratoryAhereinAgovtAdangledAchiidAanti-depressantsAzagrebAxuanjiAwell-placedBarmersAsubscriptionsAraffaeleApuréeBsychoanalystBersistentlyAloaBightfootAhiraAeamonnAcortisoneAanderBll-dayCienationAtulsiAsvendArevolutionizedAnoboruAmcguinnessBanilowAhee-doBafizAgrindstoneAeateryAdurabilityB.i.BalrympleAtribulationBon-tonApersonableAobsessivelyAmezzanineAjaehyunAhoversAgretzkyAdurianCnkinBefusedAcurableAbodybuildingBetrayalsAalienatingBbnormalsAsubstandardBtilettoAriarioAphasingAmiami-dadeAllamasAiidaAeunseomAdibbleAcolumbineBlosetedAbianAstenBnlBix-hourAproddedAnon-alcoholicAmidfieldBaariAin-chargeAhighlightingAgooseberryAemittersA146A0nAulnaAsunroofCccessorsBeranoBatishArubberyAmansiAindentationAgerhardAdaddy-oAbullwinkleBongosCgeysAzantAtyeAsunainaArastaAquadsAokey-dokeAnon-englishAmurliAinshallahAfiefAedwardesAcelluliteAyanoAvalliAstirrupsBìArefineriesApervasiveBarsaAoodAluoyangAhumphreysBemoglobinAgolAfairytalesAagitatorAwataruAsustainabilityCgar-freeBekaiAqtAminimalistAgrowerAdissimilarAcesurAberkshireAarrynBllegoryBccordsAyoreAuzbekistanBrologistAtamaleAshuraAretractorApolaBerfectoAneurotoxinCcromancerAkauaiCrtikAfour-doorAbefellAwhyteAstricterAnimbusAfairmontAbanknotesA327B18A0neAstargazerBcabbardAlifeguardsAghislaineAblasphemeBergeracBanquetsAwispBhelpAmisinterpretAlistlessAhairdressersCgsAfinickyAdoesn`tAcougarsCrtoBauterizeAassertingAzasaAtarryAshadowhuntersAprospectusBerturbedAnippyBa-na-naAjenksAhrothgarBousekeepersAbrattBlabbedA584A140,000AtrèsAstand-byArockoAprocuringAinversionAhandelAfumbledAdislodgeAchablisBensorsBaseloadA'arcyAaligningA4-0A313B.00AyannAuuhAphilistineAmelekBacroAlegosAjaanAgenoAfrancaBalstaffAdodieBistinctionsAcrime-fightingCeamerBookeryAbo-raAastonishBnalysesAwashclothAunusableAso.AriyadhBestructureEartedAmarionetteAlaboringAhubbaAg-manAdokeyBamiA456AvenmoAtwo-stepCatsBatsuAswimminCamyBtimulantsArinsedApukesBleiadesBermafrostAºàAjaqobisAionaBnsecticideAhetCfAcouncilsBhappellBammieAvassiliAtrifledBelekinesisAshinobiApummeledBensionerAlucienneBilacsAkhomeiniAhynekAgrindrAbawlAauxBposA251AmolestersAloanerBinersAhartiganAgangedAfranknessAchronologicalAblowhardBalledAtodorokiAstealerBchulzAredaApurposefulBinkmanAmetronomeAkojimaAhmongAfar-reachingAexertedAdeadbeatsAcounterclockwiseCmpoteA1,2,3AzorbaAyuletideAwhatchamacallitAvoxAtrothBenmaAsaadAraunchyApillaiAo-ohAnutritionistBihalAlowreyAjinuAgodseyAfeel-goodAesraAdisheveledAcountertopsBavaAbluebeardAaccidentlyAyingluoAtinkerbellCmingsAshoalBbkAreformationAquick-wittedAmartiniqueAl.d.BbjAincorruptibleBdolizeAeddingtonAdonsAcretaceousCackheadsBleaAbunwonA44thAyamanAwordboyAvapourAunhelpfulAtractsBohruBattletaleAsteamboatBkiddedApileupAmagaAhymenAflingingBishiesAeunjaeAcontractualBeltsBarraroAbrigadesA1600sAwigandBafersAseshBapphiresApfizerAnumbskullAleventAillustratesBce-skatingAhoodiesBinkleAdeficienciesAcrazilyA30-secondA243AxiaoqianAwladekBhitestoneAvitacAunlawfullyAtunisAreservoirsApropellantAopaqueBhhhhhAnaryAjulanAinsertsDcrutableAbilingualAtotalityBhibaultBermedAprimroseAmujinBillimetreAlucreciaBieslAjovialAharvestsAexemptedBvanderAdualityAbajrangiA48thAtraBechnicalitiesApostwarA'oeuvreAmundtAbullfightBoxcarBallantineAtranscendedBight-knitAsubservientArunnethAparkesAnecrosisAmountbattenCsebyAkiddyAinputsAhanimAembroiderAdefectorsCclarationsAbetseyAa-a-aA311AveracityAtteokbokkisubsAself-evidentAreconstructiveAprophesyBetermanAnikolasAmoldovaBarredAl.aAkolchakAdioramaAbyzantiumAair-raidAxhosaAwantyouAvladivostokAusheredBnaccompaniedAstonewallingBomersArescuerAml6BchaleAinterventionsAfootballersBiancAeight-hourAcrossfitBounseledAwieBeanedAroadwayApoindexterAmamoAluxanAkirazAgizelleAenforcersAcoughlinAbrocadeBasaraCroqueAspiralsAprynneAneriAlodgesAhalesAedelweissAdark-skinnedAazkabanAzoloftAweylandAsosoA'rejustAquanzhenApringlesBouncedAmeenieBarklAlaguertaAkurdsBakashiAhaverfordAdrive-thruAbohemiaA20-somethingAtrigAshionAroomiesAparameterAlunchingAgratinBizzardAfidgetAcoladasAabisholaAventuringAtangentAsungkyunkwanCbvertBpiegelAnutrientAmisaoAlevitationAexcursionsBaAbulgogiBeautifuiAawardingAsyndicatesApredictiveBittsBersonalsAnenA'morningAinvestsAhuertaBrtAfaxesAe.j.AdormitoriesBiphtheriaAbrucieBlousesBaelishCcallAslatedBhaverAmccreadyAjosetteBeevanAiedsAexaminersAda-eunAavariceBcademiesA357AyipsAxviAwasimAswindlersAperennialAobservesAlobbiedAkarstenAjankiAixBnadequacyBantoAhyperactiveBeavy-handedAfoetusAeditsAcherubAbrutishAamphibianBkeemA141B060AyohanAspinninApatchworkAosoAhannesAfashionablyAdeepensAchrysalisAunbeknownstAproclaimingAnewsworthyCarsAmvaBidsomerAloniAkwunAimpeachedAhumanoidsBomelessnessAdrunkenlyBimmerAclubbedAassassinatingBkechiAtollyAsalterAmin-jiAludovicAgerronAchromiumAbalanAzealotAwebbyAvallartaAserafinaAreenactAnuriaAmedium-sizedBahoneAharrelsonAfirmerAcasterlyA2-year-oldAwell-meaningCirdoesAundertookAsphericalBhindeArevisitingCstrictiveAquantifyAplunderingAonizukaBffstageAmechanizedAlopeBesboAgripingAfeudingAdeputizedAammiAzoéAsculleryAreichstagAnicodemusAgarudaCntryAeladioAdigitizedBecibelsAbootleggingAathertonBh-ha-haA710AuncaringAso-yeonBamyArosannaBazeApoutyAnayakAminosBarquessAloxAexertingBggshellAchristensenAapatheticAwilfAstick-upBeethaAnottingAmanneredAinner-cityAdeetsAboostsAantivirusBkitaA871A52ndAwrungA'wellAthreesomesAspeedwayBelviArutlandAmurataBerkelAequestriaBarbudsAburned-outBiharAwatariAverdictsAtvaAsteeperBhaquilleApreoccupationAoberoiAmin-wooCllaAereborAdisapprovingA20-footAulrikAstaffingAnordAmarketedAjawlineAiaterAestuaryBquitableAbulldozeBragsAηowAwaterholeAsu-yeonCre.CdhirBit-inBhipleyAnopdAmarã­aAjauntAinjectorsAgiseleBereBamekeeperAcollectibleA262AuntillAteleporterAserfsBaplingCitamaAplumageAoffsideAneelamAmisplaceAlarussoAgusteauAdeliberatingAblatheringAschuesterApunkedAmooredAjairoAindiscriminateBgnitingAgrandparentBermanicAfederalesBallacyAdankoAcannonballsAbroadlyAspreadsheetsBhiaAregeneratingCctifiedAoverwroughtAmastermindedAhairballAerectionsBnslavementAbunionsAwarlikeAvandaAtravelinBillerAsold-outBlip-upBhaughnessyBchoolchildrenDiffAromanoffBasmussenAmonterreyAkumaAbrittonBookshelvesAallaBdelinaAzorinAs.o.b.ApulverizedAnyxAmillisecondsBentholAkalyaniAjapnaamAheinieAevidentiaryAclompingBhaiseBamryAbandedAanatoliaAzhiweiAteegerBaborArajahAmastectomyAliuliAkatagiriAirrevocablyBncasBdoAglastonburyBertrudAfoxxAcollieAbountiesBiddleBansiAartworksAzinaAvictoireAthrummingAsudaneseBmearsBeabirdsAradiologistAorganistAnapsterAkathirAjerzyAindustrialistsAfikriAeehAbancoAtropicCepidationApreserverBerceivesBackersAkrebsAfirebirdAcorrespondentsBascadingAaglowBclB6AvillanelleAslaversBing-songArottweilerAprojectilesBhuketA'nightAmassagerB4AjunkyAinfuserAheavinessAgallardoAc-canBaskCnanAavatarsAzaireAyoliAxiomaraAunmitigatedAstaceeBhuffleboardBeldonBawaAmisfireAkennelsAjorahAintrinsicAhaddieAgazillionAdischargesAbedloeA'5A1862AunauthorisedAoffworldAmurongAlow-budgetAkaibaAi`veAgrigorAflailAdouble-parkedAchickieAblankieBizarroBartlebyAtomahawkBelekineticBaboosB.a.AsmudgesBeaplaneAripenAphallicBerpendicularAgodlikeAflockedAdiversionsAabοutApesoCruseAnukedBa-raeAhuseyinCmidifierA‫‫gtAezgiA'doA27-year-oldA1850Atop-shelfBhereaboutsAsleuthCackersAmooringAinstrumentalsAhibikiAgunaAdestabilizingAcoddlingAalderAspryBeyitApotsdamAka-kuiAfabulouslyAelwayAcymbalBarnyAselwynAproddingBlethoraBhysicalityAmildewBaldonadoAlacquerAkhuranaAgrandmamaAfund-raisingAexorcismsAdimmedBepositingAchinksAatsushiBmassA'6Awork-upAtownieAsluicingBebastienAreceptorAmoscaCntezumaAjackrabbitAihopAhijoAfour-leafBive-mileAexpendituresAdisinterestedAchristmassyAbicarbBelittledAaltBdamsonAsunbaenimBnobbishBmollettBcrutinizedAphysioBear-shapedAlipschitzAkaceyAdragginAcorsetsCncealsCcksuckingBarmelitaAboratAabscondedCramAzaferAwoodleyAtransmutationBeakAsolaBecondedAnvaBeronAkehoeAjujitsuAhatchlingsA620AunzippingAtaishiAsuuBmartenBloshedAroslynApolloA'pleaseAmandelAkongsangAjeriAintrudedBgnoramusAcompilationAasymmetricalChleeBnguishedA3,200AwitchyAturretsAsalaciousAjakesAinêsBcicleAgonersAdurdenBitaAconfrontationsCllingwoodAstowawaysArohypnolBenaudAnivenBadiyaAlewinskyAkaleidoscopeAjinnahAhansungAcyclistsAavianBscertainedBrchipelagoBlorsA171AvacuumedAutteringAtahaAmodsAgoings-onAdecisivelyAcysticBheeverBandiAtorridAssshBpeakinAmurrowAkampfAgiordanoAfussesAdoronAcinematographerBhocolate-coveredBatchersAblinkerAwadsworthAvervainAundidAreintroduceAmi-ranAhypothermicBargreavesAgoldyAfraidAecbertAduoduoBiminishesBeceiverAcoverallsBaiusAshiyuAoligarchsAlinhAileneAhãAglittersAdeductiveAchairpersonAbrûléeBosunAalokAshaktimaanBectionalsAplease-BensionersAisseiAghoulishAfleuryAdirtbagsAcoventBentennialAbukowskiBaltoA20th-centuryAwaneAuhnAtorrentialBhuleAsun-hoCdoAranveerApronounBerignonAobjectionableAmoderatorBartinelliAgrungeBooglingAexciseAbefitsA503AziyaAvagrantsAunknowableAragtimeAnon-smokingAkazuhikoAfor-forAcoolieBharlottesvilleAbecaBarebackCmbaAvulvaAtightensBhenceAr.a.ApreventativeBalmeAmadhuriAkarloffAhumoringAdownbeatBãAcohortCckerBhoyAbattedAaugmentedBmberleA178AthistleBaxidermyAslungBarkarApbhtAout-of-controlAnourBationalitiesAmultitudesAludovicoAhousemanCt-headedBesseAdtAcopiousAbovaryBindersA2,800ArecognizanceAmormontAjunuhAethosAdrummedBashcamAbigwigAauctioningBirwolfBbacusA5-6A2amAvityaAtugsBhorazineAsunaBcolaBaigoAretortCappearsAnullahAmaturingAharbinAchartingAabominationsA1898AtrudiAsyntheticsBtudiousAreloadingAoverdrawnAninAmooncakeAindelicateAhopscotchBerbivoresAdryersBiscretionaryAco-ownerBhieCanghoAbujjiA144,432ArossoAoverstayedAnirmalaAholstAexpendedBlasticityAbrechtAtmBhrobAsoutaArousedBhadeBemitApimpedAman-eaterAkuenAjoustingAencircledAcuttingsBolorlessAweinbergAsweepstakesBtipulationBlobberBemestersBawakoAparkourAoverthereAgracielaBaloshesAempathAdaehoA100.000AvangerAthermiteAsusBionAoutgrewAkukAhoraAconnectorCllectiblesA640A285AyoloAuninterestedAsorrierBentinelsApropagateBipsAmadrigalAinstructsCcantationsAhelleAearmarkedAbokoAamritsarAveroneAtaijiAslinkyArearsAnougatAj-justA2-5B33AtriplicateAsilhouettesBcaldedA'ryApotheadAnonnaAmi-naAkojiroAgun-wooAdingusBenaliCmilleAcatharsisAbogsAaurelieBntiochAálvaroA1861AyokelsAtirednessAsuenAportaClygamyBedanticAnavidadAmensaBacitAinoculatedAgraysonsAcoloredsBafésAburgeoningBluffedBhabhiAasexualBnalyzerAwutheringArodrickAphotosynthesisAmannheimAlockheedAimpactingAcourtierAakeAtheorizedAstaphBoppyAruth-anneBenterAodorsAnooksAmiyakoCtyaAlmperialBavanyaAinhibitedAgospelsAduquesneAclimatesAbiscottiBaicaoAacquaintAvamonosAthoracotomyAstubbyCoweBecuresAraffApsychicallyBhilliesAmobleyBaterializedCstsAkalahariAhouseboyBigh-frequencyAfalklandsAexpertlyAborgesAwiltshireAunleashesAsunstrokeBavileAmanetAlitigatorAhuntsmanBokutoAeunhaAdumpyBampeningAunawaresAsouzaBhippoApaisaAmoustachesCck-upAlight-skinnedCdaAfromeAdown-lowBeryaAclichesCeaveAayanamiAআমAvillanuevaBesperChementlyAreinholdCdeemerApollyannaAloiterAinitiatesAfaiiAemissariesAcrash-landedAbeardsleyAarjunaBirtimeAunjustifiedAtrade-offAnubBame-AmitralAluxorAinmanAgraftingAedsonAdicleAcorfuCme-onAbiodiversityAsymoneBtockroomBafeguardingArocíoBicinAorchestratingAlocaleAkristoffAbulsharBlushedCadesmithsBellagioBayonneAa-riBnleA184Aself-drivingBanyeongAguangdongAeverdeenAdeionAcorinnaCntradictedAblunderingAayatollahAworAtradesmanAspurredAperceAorryAnecronomiconAhutuCmaAconiAbwanaAamherstBlenaBgasshiA176AsupermodelsBcufflingBamosasAnaritaAinterningAfalconerAextricateAd-doAyoriAthousandthAsiggyBhittiestAmiffedAl.t.AjorgensenAitsumoBovedAhindustanAgramercyAfredrickAdemigodAcooterCleenAbodybuilderAassimilationAwho-AsexinessAprecipitationAmagesAkusanagiAhoughtonBankieAguildersAforfeitureAcopedCnoverBhippyBampaignedAbinduAunopposedAsoonestCapboxBinaArakhiApushbackAnymphsAmuchachosAknockerAhiguchiAgluingAdecAbloomersAantidepressantA385A219AmounaAloringBaryngitisAhunksAgaviriaAferranteAziraBhivagoAwigglesAvirginianAuptakeAtotalsBhrombosisAespinosaAbrootsBloodsuckersBeneficiariesAarielleAvivaciousAteamstersAsickenedBhahidBelflesslyBaithArolfeApoulticeBattieAnon-humanAforgetfulnessAextremityCploresAdrexlerBisreputableBeal-breakerBarkoAbendedAtakuyaAsοBpottersBhortcakeCintaroApromptingBausingAoraleBlliAneytiriAmin-jaeAheigh-hoAdramaticsAcellmatesAbeoccaCdsheetsBabbittAayåBloA3-year-oldAtinglesAsymbolicallyAretailerApillsburyBaratrooperAcashewsAbibimbapAamunetB.g.AtooropAreheatApresent-dayDdisposedBanelingAoxycodoneAminiaturesBellorAhoedownBarmonizingAcoronadoCntemporariesBlumpsAbolivarAwakey-wakeyAverucaAthird-partyAsonejiBhamuAroutAomuraAlillDianeAimmovableAerolBlmoreAdreidelBevisingBaigoAc-spineBqBarjackedAbouvierBarcodeCllerinasA321AtetsuroAsshhAramonesApioAnarcanAmotleyBazAjunieAflayedAediblesBarth-2AanarkaliBggroAu.f.o.Athumbs-upAspreaderBchaeferBacrilegiousAmarchandAkemiAjonesingAholBerrickBand-me-downAfornicateBaucetsCrrisAdhotiAchauhanBarambaAbellowBariA295AvigourArotisserieBhapsodyAovercompensatingAnotationAjawboneAimprudentAgooberAbmxBerleAarafatA10-1AsachetAreelectedApammyAopen-and-shutAmeerkatBaryaAlandminesAeffectedAdetectableCscriptiveAbilluA257AwinduCdestArakugoAnssAjemmyAilaAhanamichiAgoldeneyeBilmanAfetAconjoinedBardiologyCnfieldAbellybuttonBalluCbliA2.7AtakanoAshainaAreciprocalAdenouncingAacrobaticBbattoirAwhassupAtaskerAsolarisApseudoAnfsAmitchelAjean-marcAfrankelBidgetyAexpellingAcujoBortisolCnstantinAaâA58thAwashersCllaAsommeBelf-involvedCaworldBcrubberAplaypenAmillisecondAheadpieceAfaridaAeyalAcricketerBhinookBalibrationAbloodhoundsBiddyBarrisAatreyuAvallahiAtykeAswatiBtrumsBpotifyBotaBauArejoicedAmoratoriumAkevorkianAgrandstandBaucheAdwAceraA72ndAtwo-personBomekBetrisCrracesArosinaBepositionAnominatingAmunozAjeollaBanetteAglaserAelationAconveysDdéBherbourgAboomersCnnevilleBeltedA5021A2.1ArealignApropofolAmotherboardBiyazakiAgodparentsAendersBfeAcharlatansA.7A1893B77AunderdevelopedAtombstonesArejoicesAmehmedAdeutscheAcircusesBheepAamoebaAweevilAstrayingCiltonBorry-BikhsBhaeAr.v.BedrumBacemanAplexusAjoiAinflameAestimatingBnergonAdisintegrationAchinchillaAbotticelliAalumA390A20-davidAunconcernedAtae-suApudgyAlassesAjohansenAhighnessesAgodricAdeparturesBansonAasakoBbysmalAswooshingAreacquaintedAneckingBavinAmieAhartsfieldAfertilizationAd.s.AcataniaAbenchmarkCen-AyousefAseyahBanduskyApoonBeelerAnobisAhideoutsAgrade-aAcollardAsecretedAqilinAplattersAnowakAminiskirtAkodiakBazehayaAheightenBardnessAeffAzaleAwithalAtrelawneyBasmanianAstashingBing-alongAprattleAnimitzAmacmillanAlife-or-deathAjareauAgravediggerAflinchingBablesAcurlersBommencesAbreelandBoranAyeon-wooAtaperAshuriCirazAproclaimsAoisAnubianAkrabbyAjockoBjamppongAcrochetBompactorAbritaBalramAaccreditedAwetsuitCll-armedAtopsy-turvyAsubmachineBtarvinBemyonApipedBammiAnonfatAkagaAemotionlessAdreamboatBisherBeficitsAbracedBouillabaisseBlutoAallegesAvalkyriesAteeny-tinyAstafferBecsApaduaAlongoAgowronAapplegateBngadBleckA2dAwoodcockAmean.AfewestCatherstoneAepoxyAcroninBieloAbussAwell-builtAundersecretaryAtushyBallinnAsueyAqrApomonaAmiddlemenBajorlyAlankyAharrietteAfruttiBalsifyAembroiledAdhanrajA32-year-oldA2bAteeteringAslaverArickmanBeekedAhombresAfredericaBolksyAeggedAdong-guBiscothequeBenteAcounteredBanteensAamphetamineBboveboardAwyntonBristbandsBasjustAsandingArennAprojectionistBlantainBineyCckwickBaniniAmentoredAkusakaBravDuseAhamedAcadiAborn-againBagpipeAall-seeingA874AyaeAvotreAtalentlessAspewedCarklersArustingApadillaAmiredAjãAflightyBinnsDgertipAdraziAcullingBakedAbloggersAauthoriseAyuleAwho-whoAmyocardialBosCnopolizeBónicaAipinAheadshotsAeffusionAdisenfranchisedBamselsAbrunnerAalbinA48-hourA.​AwranglingA'tâAswaneeArivertonBepresentationsAnecroticAm.p.AlakshmanAhookahBaishiAdecapitateAcorrectnessCexistenceBagliostroAbaredAaleidaAtuffAstaBoliderAramadaCisaApredicatedAninersAmi-poongBaybe-Cn-childAjesselAdisarmamentBeverauxAaspiredAtumiAsurestBeppukuApewsAmumbledBixersBattiaAking-sizeAinterchangeableAconductorsAabaA502AvaziriAtiptonApbrAlife-sizeAicAhonokaAgeniiAfenixAdebonairAchiekoCalkyBelebsBanerAblotterAanoAworleyBeemsAtommieBelephoningAsuraA's-sheAsommelierAoscorpAmeechumAkiowaAgummiBoetzAc.p.AtrashcanDnspoBardesAscarsdaleBajidApyeongBremaritalBiayBeoniesAminnowAfour-eyesCrthisAembellishedAdefecateBanzigerA36,000A1876AyoutoAworkstationAthonyArosalynBivasAparrisDamourAbrainchildBlaneyBagwellCfflesAsoniBeven-yearAreshootApurifyingFierAmcgowanAlatenessCkesideAkilljoysAdakarAcygnusAbirdcageAadvertsA224AuntouchablesAtakingsAragtagAnagusAkennaAhard-pressedCndmaidAgravitateDndbabyAfortune-tellingBarthingAcarmillaAbonnA6.30Aupsy-daisyAtransitionedAshylockAhand-me-downsAbelterCelineBackfiringAadriaticA166Atug-of-warBeriyakiAsprocketBchmucksAplace-AoverseenAkombatA‫‫‫‫gtAcreedyAavedonA5amAscaredyA're-theyApalaisAnon-essentialCcAmadibaAgenteelAfincherAesteAcategorizeAautobiographicalBsuraA406AyosukeAtenetsAsafiyeAregulatingAproximaAneaterAmalignCcallanAléoAjenaAinducesAgrafAfacetiousAaetherAwilmerAvoltesBegansAtwo-storyAslaysAlamboAishiiAhofstadterAcusackAbagheeraAwebbingAkubaBruseAhye-wonBeinBarmanDisAgenaroAchock-fullAbucklandA39thAshardaArappelAoverlordsAjsaAinauguratedAhairstylesAgaseousAferventlyAdoorknobsAbromanceBottleneckAanti-governmentBerosmithBdulationAunprovenAshipyardsAoshimaAnuckAmullingAharrodsAfreeboAdipstickAchupacabraAbrezhnevAangelikaAyumekoAtotalitarianAshamrockApyreneesAnoisilyAhashemAgrimaldiCeshamAfavelaAextramaritalBspinozaAdolliesBayalAbrrrA322AtukBh-theBadokoroAspritzCirosBheeranBelflessnessAmacadamiaAlompocAhomeysAfull-lengthAeven-AdaryaAcoimbatoreAblochAayumiA455AwickedlyBarpingAvueAunchainAresourcefulnessCboundsAprocurementAmountiesChinderAkumariBendoAinexhaustibleAhahahahaAguess-AeleniAdersuClanceyAanonBleisterAyeltsinA-whatAplay-by-playBasskeyAmooneeBichaBeasurableAloweryBiquidationAgrumioAfreckleCaiserAeuropolAdeucesAcardiomyopathyCiaphasAspywareBaekoCdismArosalesAporpoiseBirelliAotomoAhayakawaAforsyteBacilitatorAbatonsAagosAyutakaAunilaterallyAtrevilleAreassembledAphilippEanderingBalladiumAkuririnAground-breakingAburleyBarbosaAagain-A1895AwhiskerBatershedA'uAstockyBplattersCindleCakeAprabhakarAmortifyingBanxAhalf-priceAflowerpotAdiagonallyBavisonAchelAbriefcasesAahmadiAzaynAventilateAsignifyingAhaggertyAdagonAchandramukhiA5.5A'3BwithAunfocusedAstriationsArecastCapedBanjanAnastinessA'moreAmitsuoBaseAkusumAhardheadedAfoshanAdacoitsA100sAwhiieAthermalsBastiestAstuddedBsiArungsBe-evaluateApusanBroletarianCiamAoverdraftAinfirmAhey-oAdroversBonatellaAchoirsCickenpoxAastonishinglyAsoaksBhoeshineApunisherBinewoodBaraplegicAnullifyAmlle.AgenoviaAfive-dayCoreAcillaBhizuruAariasA625A4amAyuanjiaAtimorBescoArehashCcurrenceBadiatesAqiqiAoutrageouslyAmisadventureBaraisAinaugurateAgladnessAerroneousAddtAclioAbackhoeA199AutensilAtrousseauAmeditativeBachinAlasciviousAkitchenerBatiAimplicatesAhollowedAflaviusAextra-largeAdominaBingleAcookbooksAbenniA355AyossiAveenaAunsecuredAtheyreArivalriesAoxfordshireAmonogrammedBicrobeAkaseAingestingAgorgugBnawedAfour-dayAembellishAbohmBaddiesAandiamoBficionadoAunquestionablyAtamponadeAsubstitutingBplit-secondBhermAperniciousAoh-oh-oh-ohAnooneBametagAmoosikAleytonAhubcapsBallmarksAfinitoBeintAedmondsAat-A7.50AwindbreakerAsung-jaeBeducerCamlesslyArinaldoApsychotropicBippenAlast-ditchAeun-heeAdefraudedAcazAbrownsvilleAadriA160,000AplAoutfieldBfmyAmussoBiscreantAkannadaAheadspaceBarukiAgοAfractalAcuA1.25AunderlineAtulliusAsnellBauvageAraghavanAnefertitiAgotta-BargantuanAfikretAabuelitaAwujingBoolenAsingularlyApiratedAobstinacyAmalignedB3AgetraerBallupAchapinAbihariAappropriatedAunrestrainedAthree-and-a-halfAsolidlyAnaksuAmclovinAintheDeractsAgraftedBlazingAfusingAdisruptorBepletionAbravedAanjin-sanAzhouzhouAwouidnBishy-washyBhat--whatBastebasketAundevelopedEservingAtrottersBomsAsusiBquirtedBhysterArotationsAquakingApaquitaAomniscientAn-wordBakednessAloyalistsAkilmerBeitelAglamorAflatbedAemineAblighterAaramunAunfreezeAtoomeyAschweitzerA'roundArampingApeckedAnitBcicAkassAjoshyAickAhelmsAglutesAfalsifyingAentombedAco-ordinatesCmplyingBlunkyAbhallaBeemanCbbanburgBadmouthingAaynBveragingAwellingAsubscribedBautéedAresponderApsychedelicsBapáAkeshavAfa-la-la-la-laAexclusivityAdmtAcvsAbloatAthorndykeAsvenssonBpecialiseBh-sheAmuncieBarcelineAkuroBieferAimmersiveBciAexuberanceBlamAdashesAaioliAus.AtrubelApop-tartsCcusBeckhamAnigeriansAmousyAkoreyAhowserCltzBaddadAgougingAdulledAclermontBasedAbungalowsAagaveAwhitestAum-hmmAtaelonAsteamshipAmusselAlayeringAglobAfriendliestAdisusedAbu-yeonBaubleAuiAspotlightsAlawmenAgrandstandingAattritionA.5A00,000Awell-preparedAtwistyAresnickAmeerAjejoongwonBadAinnsBmmortalizedEbilizeAhanbokAg-stringAfunctionedAeboshiAdemeritsCadlierA‐andAaccentuateAxandraAusainAspacesuitBatineArfAmuzakB.s.BopeyCkpoBarylinAkavanaghAjaganAibenAheteroAelevatingAat-riskBppeasedAunsympatheticAtriumphantlyAstrodeBpliffBeaquestAregeneratedApredispositionAnumbnutsAincoherentlyAheismanAguerillasBreenbackBlassyAdozaBeignBarrelAcomic-bookBaveatCnterAbaracusA901AyorikoAunflatteringCdervaluedAsnsBhishArufBoofiesBegularityApitiableAmellowedDisBasayukiAjumongAgraziaDbleBeneralissimoAexecutesAdecathlonBaniel-sanAconsciencesClmBhevAbonkAabhishekA229A163Awill-Atae-sungAstrigoiBmeagolApursuantAmoonrakerAlearninAisamuAgroovingAbloggingAaspirinsA701AwipeoutAventedAuriahAsix-figureAriqBepentantAphotocopiesBeakingAmoonbaseBattiClhunAimpedingAgloriouslyAcoldplayBaddieAbobsBigotsAarisaAsurmisedAromanaCcinanteBathodApumpinBrecludeAnext-levelAmukhtarAinfightingAempanadasAdotesBelegatedAconsonantsC-existBharoAbodyworkA1oAyuzuAxxxAwetbackCird-lookingAsuckleBtompsBiciliansBhell-shockedBavourAregattaBacheAplimptonAnaritsuguAminyBeryemBacaronsAlamentingAhitmenAeye-openerAdubeyAclaysBatskillsAbiometricsA286AvideotapingA'viAunchallengedAnewlinAminusculeBeikoAlainieAgeniesAfolliesAdeadpoolAcowabungaCntraceptiveAauditorsA'1Ax-manAtriangulationAspellboundBolderArationedAöäAmimAinertialAflorinsAbeeboA510AwelpAstatesmenBell-outArajjoAqueegAmireilleAleffertsAgrosvenorBangmoAdeflateAcheukAbadderAaustereAundergrowthCadulteratedAscribblesArokuAmenaCiniangAlivyAhomegirlCllandaiseAgiulianaAchantedBardingAbaldricA324AzulemaAvalanceAshavenBeegerBchemedCantArainforestsAneenaAmolAhypothesesCeondoAdeepuAconsonantCmplementaryAbuntingBroad-mindedAawakesA265AthawingAsecretionsArefocusApuffinBotemkinAmitsubishiAlexaAirregularityBndivisibleAemuBggingAdiggityBethroneAcentrifugalAbig-cityAayalaA309AschwarzBaleswomanApummelBixarAmulti-millionBeltonBarquetteAluísAhibiscusAflitBizzingCtzhughAcullBliffieBherishesAbrantleyAwowedAtarragonAsuppertimeBlowpokeA'rollArevvedAministriesBanniAleutnantAkilbrideAjuggernautAfingerprintedAernestineAdienAcoddledAyarenAstreamedBnoggingApursuersAoverdosesAnouveauBaveAmargeneAkonnichiwaAfirefightingAepsomAdaríoAaqualadA'7A66,430AweldsAschemerArepurposedAprofessedAopen-airAloireBaffertyAinyoungCtersectionsAherefordAghettosAdisqualificationAcustomizeBonstructionsBlosuresAavignonA239A193AzsaAyoyoBasirAstilettosBouthpawAnelsBamibiaAlocusAkwanzaaBernelsAjuliannaBamiesonAgershwinAdwellingsAchuchoAbreadsticksAzalachenkoAwringingAsanitizedArevolversCprogrammingApitbullAnanaharaAengraveAcadreAbleatAaryansAunrestrictedAtorstenAsheraBeok-jinArinkuCmuruBeidenApeppeAmancusoAlightenedBatticeAkinoshitaAirvinAcrucesAbunionAalbusA51stAyeah-ArinconBenzAone-tenthAholliBanjoAevitaAdiaoAaikawaA708A53rdAzealotsAten-footAstreetlightsBlursBinnermanAoffsAmacgruberAjukeAhithertoBagarAexternallyBgorAduguBrogoBearyAcomstockAbhaiyaAaliyarBfA1840AworrierAsuitingBantoshAresignsBatifyAoctopusesAlimousinesBayoutsAjinaeAconsortsAboobieAaugmentBmariA403AzitsAymirAwebtoonAtoaAspyderB.e.c.AreclamationA'ofAipsBnoperativeBkedaAheifersAguardhouseBilliesAfundraisersAevokesAdroughtsBisobeysAcoochCnveningAbordelloBaggiesAalgrenBkhenatenAw-whereBhitbyAtuviaBeppeiAsuper-hotArevitalizeAonurAlodzAhardcastleAgift-wrappedAfannedAezoAclutchedAbrigandsA2,600AweeniesAtrowelAskylarkBhearedArnaBefilledApromiscuityBandiAnormansBaimaAmagnifiqueAlatourAdroopingAcylindricalAwrenchesAvanquishingAsunsinBonomaArelianceCflectorApreventiveBhotoshoppedBedsAkildareAhalf-humanAglaberBamaAduarteBonatoBikeAcreeksBalicoAbárbaraAurameshiBnhurtAstrollsAmahurAji-yongAinnovatorAhocBillerAchiquitaAarticulatedBny-BfrikaansA244AzanzibarAwoefullyBildnessAtweenAshakthiBcBana-chanArivetedApreservativesBentAoboiAmaltedAhirumaAgyeonAfloweredAdomonAvindicationAunsophisticatedAtsanBaylaAresentmentsAquidditchAprosthesisBardnerCntheonAoggyAnocheAmargateAllewelynAkekeAgloAdoobieBividerBcsAcortCnstituentAbabineauxAwouAvadaAuninhibitedAtatooineApastelAone-trackEhalfAivankaBtsy-bitsyAfastidiousAerasAcedeB.b.AbutchieAasteriskBctually-A0500AterezaAskyrocketingBhe`sBeashellAreesAmendelssohnBarginallyAlockyAkoreatownAhoodooAemphaticAcolliderAbastogneAzoranAyodelAverdanaAtime-honoredBaichiAsindhuAprattlingAnicholAmartynAlow-classBinkageDguiniAhuesBirayamaAfaecesAcapoteAbewilderingAadelitaA3.6AoverflowsAjordieAidlenessAdeflectionAbacardiAwarm-heartedAunsealedAstringentBavinoArecitationApsychotherapistBachecoAoriginatesAmutesBisogynyBcnairCknightAkanagawaAhomepageAgreelyAeorahaAchinamenA1-5AunwillinglyCeaseAsuper-secretBolonBeventy-twoClleckCimeiBcratcherAplaguingBhdsAnavaAmumfordBbAeye-catchingAbotulismAastoundA149A0-2AyookAubiquitousAtavernsAslovakiaAlysAjung-wooAhumdrumBalf-wayAevandroAdosaBefeatistCbiAchopstickAbulimicAvikrantAteardropsAslocombeBhambhuApsyduckAmaulAkingsguardBaminskyAgyroBiftingAertAconchaCdfishBatechismAbristlesBlofeldAuffAstancesBonnetsBautéCkumaAruthlessnessAno-winAminamotoAlindstromAjaymesAglidesBaussAfrontedAensueAchibi-usaAamanoAwigglyBestinAuliAstep-by-stepBpongyArachmaninoffAniobeBaqahdahAmeddlesomeAhymieAebertAcortinaCnfiningBhaperoningAbuchmanAtrussArayanAmitsuruAiguanasAhalf-assAgarnierAfact-findingAcorksA'νeAwatchmakerAturanAswelteringApylonsAobaAmummificationBodernizeBaruyamaAloyallyAkombuchaBerriAgiselaBeographicallyAelizabethanAdarfurAcrystallizedBongenialAananBcharyaAyelloAvictimlessAurethraAtodaBhéoAstairwellsBnot-nosedBkateboardsApincheAoxytocinAnitwitsAkairuAjeonjuAgheeAdenialsAbirkinAyourfatherAwazooAtirithAstrivesAprissAjahanAandsA'accordA1904AtoniaAsarasotaArugerBanchingAnovicesAmaliniAjaninaAhyeongnimBotchkissAgalleonAdisorientingAcook-offBhizuAbuffsA362AwiretappingAszeBhadowhunterAreprisalApretrialAone-adam-12AmalpAhunky-doryBierBemmedBavreAfeisalAclusterfuckAbadnessA316A110thA0.05AxiyanAtantoAnightwingAmescalineAkrantzAengBlectingBggplantsAdefacedAcolludeBitroenBhironAbopeBehemothAalkaAzathrasAsyndicatedBtasDr-crossedBixteenthBhinnosukeArhaenyraBe-examineAkodaiAjacekAgueroAdopesCgiesAbucklingA7amA1ah00AzoomedAwoo-hoo-hooAtamirAntacBeutraliseAmotherfAlivvyAhard-headedAenvironmentalistsA100-year-oldAswervingBtefaniAriverboatApanamanianAmekongAkingslayerFbridgeBerouacAgentileBarishAfarlowCnciestAcrumpetAbulletinsAartisticallyAvarnerAsantoroAprecrimeAout-of-stateAnewsflashAmogoBarathiAkneadingAilyasAgypBoldwaterAferrarsAdethronedAcrevasseBhaeriAbhutanAvarmintsAsubdivisionBhabnamArednessBaynorApro-lifeAnorbitAjanuAineffectualAglynAfreeloadersBorstmanAcredoBorrelateBhrysanthemumsAalperBestheticallyAsnubbedBalvagingAkravenAintricaciesBmplausibleAgophersAexpendA'etatAdokkanBelishCcaturAcerebroBarlsbadAbookmakerBelugaAaggregateAstewsBlArezianAquashApoyrazCstmasterAheededAgoodfellowAepipenAdetestedAconceivingAwontonAthickestCey`reArantsApodiatristAknappAhurriesBong-chulCme.AgreggsAbeckonAyeouidoAw-w-whatBittleAsuckinAramshaAkrissyAjinkiesAflickersAdozyBay-oldCllianceAcriticisedBoldbloodBhildhoodsAyamahaAunshakableAtoleratesAsineApylonAotoAmetoBambaAjack-jackAfactoredAenviesAdid.BauAblusterA'8A323A21,000AzelenkaAwalAvaldemarAplease.AooooohAmubarakAlionheartAkantaAfacialsAcondescendBarbineAarsenioBiyaA512AyonaAsnagsBmeltingBangerArejuvenatedAkutnerAjérômeAironmanBamAgang-relatedAevildoersAconnallyAby-electionBakiCitsAarchenemyAzamaAtorrenteAsilencioBhaiAploughingAonii-chanAmorelandBisshapenDrepresentedAisoBgarashiAhip-hipAfifty-twoAarsonistsBlpertAwolframAumâAself-employedBalesgirlArowdiesBayeCtchedCsgotraAkrispyBismetAfrequentsBorthatBiliiAcrawAwoolyAtrickiBoshiroAstopoverBixersBharBankaArodríguezBicochetsAondaAmaltiAkaderAguppyBleanedAferrymanAericssonBntrywayAbricklayerCatwurstBenghaziCltwayAangliaBmphibiansBbydosAyayoiCgmurAutopianAthitherAsolderingAreynaldoAqualifierApre-trialCanAmiscreantsAjung-hwaAinstalmentAhissyBauntingsAgawdAeclipsedAbarbecuingAaggressivenessA85,000Awha-whatAvittiAt.t.BreacleCamellAsouthieBlightedBantyAresaleApinochetAnelAmitraBaggiAhowellsBauteCllamAexterminatingAdiagnosingAcutthroatsAbullcrapAvenAkaramoAfranklynBornicatingBacilitatingAembedAdebussyAcfBamphorAbrazenlyBelfryBabysatAangiogramAspittinAploughedBerjureAoscillatorCageAinactionAgroundersCevilleAfreelancingAearthforceAcutesyAwrite-upAsix-inchAribcageAoff-bookAmoney-BcclellanAintrovertAgottAenviableAdgAcrasterBoupletBlassifiedsBentaurAbrambleBarroomDingClaclavaAatlanteanA1896AurinalsAtutelageAsuvarovBpragueCortscasterBniggersBcroungingAreaversApomeroyAomoiAnebuchadnezzarBakanoAlufthansaBimbicAjutlandAisn`tClanderAhabitationAgrumpBennyAfootballsAconfidentiallyAbangorAarunaBlysBdjusterA417AtyphoonsBoscaAsnoredApoisonerAnipponAmitsuhideBelaniaCjiaBamáAjalapenoAfogartyAdronaAbullshitterAwreakedBherewithalAvxAtriesteBeam-buildingAspanglerAreferralsAoxymoronAneillAkokAjocastaBihoonAettoreAdriestBeutschlandAconveyingDsecrateA410AsayoAresonantCformatoryCchargingAnariAmin-youngBcbealAlegaciesAg.p.s.Adry-cleanedAcompressesBasterAbusloadBailiffsAavivaBppraiserBmassingBishwaryaA1880AteepeeAstegmanBhandongBantoriniCipanAravingsAquatermainAoutliningAmercifullyBatterhornAjiaxinAgothsAearth-shatteringAdeclassifiedAcrime-sceneBorollaAbonfiresBarbersAarmoireAyearbooksAvoidsAunpublishedAsquanderingBpicsBo-heeBanguAredderBattlerApickaxeAgrimsbyAforty-fourAbruinsAalakAwendigoAthoroughfareAresetsAquayAostensiblyAmouthedAliaodongAinterredAgirolamoAechelonAcruciallyBoliBategorizedAbenjamínAzazaA'saApucciniAnightmarishAkiryuBeeferAjanniAhomewardBajjiAcrA'comeAcallawayAbuckarooAasgardianA342A164AzayAxylophoneBiaofengAvosAnon-violenceBarumiAmergersBanlinessAgreen-eyedAforecastsBive-hourAeye-openingAcommitedAanujAshapelyBegalApraetorAoversleepAmlAhyperboleAflophouseBatheadAc.monoBivviesBhortlesA9.5AyahwehAwellmanAtucciArayyanApillagedAmind-setAgestationAbikramBarbituratesA½ïAworyAtrinAself-disciplineBapersteinApayedAoftheseAmohitAc.whitec.monoBonvoAalloysBgonizedA1373AsundialBchusterBandorApaupersAmoselyBasamiAkateyAhanbeiAcreeBornwallisCltsAastrideA10-footAwitchingCccanBallingAsommerBhwetaCitshowBeahorseAoutagesBlinAneedleworkBãoAmountaineeringCgadishuAlygiaBuangBadaAkizzyAjudgementsAimpostersAhornsbyAfiresideAduckmanBeceivesCarthAbiarritzBhushanAwisecracksAthaleAsolverAlitanyAhokeBairdressingAgoudaBlobalizationAfitzwilliamAenrollingAambushesA9-11A46thAtwiddlingBropezBhursbyAsoo-jinBinagBaotomeCnaeArostovaBesidedApogueBageantryAmirakuruAki-taeBakarotAhimikoAdisplaceAbypassingBengtAaverseAshuckCinhwaAprovostAostiaAnearsightedBarratedAmiraeBeisterCchBaudlinAkareninaAguddiBirardiAbiloxiAarchdioceseBlkalineBdèleAzazuAthinnersA's-thereAsatterfieldArennerApinwheelAmikkiBalagaCceyAleandroAjockstrapAinoculationAfatehAdatakAcripesBarleneAbroilBlack-eyedAantigoneA1899AransackCdioheadApritheeAout-of-bodyAinhabitingAfoundlingAcourtlandCttaCrrespondedBhoreographAboycottingAahhhhhhBdelleAshaanBchmoozeArufioApossesBervsAonscreenAmukherjeeAlongmireBecherAknowâAhubsBopewellAconfidingBantwellAbigotedAabsorbentAwesterleyAunrefinedArepossessAphilomenaCallusAnessieAinductedAgrigoriAeducatorsAalleluiaA30-footAwegenerAvorenusAunearthlyAsluggingAqueriesApurtyBelosiBaddiesAobscenitiesAmafeeCcduffAitalicAgryllsCookeyAdorukAcrimpBlaybourneAangaBlphah3dB-gameA125thAtortugaBestersA's-whatAschooiAperseveredCepedAmorgAgabrieleAclarionAblitheringAantwanA11pmAteeny-weenyAshazDwneeBalutedArcaApathanAmatíasAlockoutAhoneysuckleClcombAfieldworkBerrellAdeauvilleBamoclesAcouidnBathleenAbinksAatmospheresAwooleyAtswanaBimurAreedeApocketfulAmedialAjurisdictionalAgentlestAfreightersAearlobesAdurrellAcornmealAbuaAagnosticAtunstallBennisonApressmanCairiesAmontesBantrasAkeunAincapacitateAdesotoCpictionsCeganAtrajectoriesBhunderbirdsBableauAshunjiAracquetApraveshBissinAkwangheeBansukeDekoCguyaAhisakoBarakiriCnd-heldCddonfieldAfather-AcoderBlosed-circuitAbushwickA-youAwhoo-oohBell-readAturn-offAstakeoutsBignallingBhizuAmcconaugheyAkakarrotAgendarmeAfauntleroyAdreadlocksBoulaAconsummationDcettaAwoodsmanAviniciusAunderhandApyroAnon-lethalAmeachamAlookalikeAkryptoniansAhardeningCndeAguanoAforkyAdeformitiesAcrunchedBlottedAasphyxiatedBnatomicallyAtweakerAsubcontractorAraidenAone-to-oneCaBkitaAldiotAkurtisBoriAjellybeansAharesAgyeongsangAforayAduskyAcranniesBondimentBasshanAbruBedpostBasharAyegorBasudaAwitwickyAunhappilyAtime-travelAsubcutaneousBhadApicketingAmuckyAjannAhard-hittingAcolterAantheaAvorlonsAsokolovArotomAparoleeAniggahAmoreyBegazordAgeistAerredBndearmentAdishearteningAcerebellumAbutyouBoudreauCgieAartfulCnhemBppellateBnimatorAwhy-AtraynorBaseAsquashingBkirmishesArepressiveCdesignedAquietestCesoApoppycockBlay-offsBarkinAnorth-eastAmotoristsDher-CbiusAhockneyBarbouringCndcraftedAgood-AframptonAdeceptivelyAchongqingCildersAbronskiAaponeA29-year-oldAwuhanAvannaAturkmenAroversAposiesBeace-lovingAmadaniAkyojinBuwabaraBittredgeAgreenpointAfissuresAenhancementsAconsignedAboshBelly-upA3bAyettaBamashAvapingAurinatedBnrecognizedAschaferCattersBalivatingArajveerAporterhouseAozakiBughttaAmansellAjiggsBettisonedClloAhoneybeeAgratisAfalteringAexpelliarmusBradicationAdragonfliesAcountertopCncentratesBhachiBastawaysAamamiyaBguA50-footAyamagataAtromavilleAsmoothestAquakersApachinkoAmiyabeAlavageAesoAdindinBemographicsAburgosAa-comingAyusifAwarneAthird-yearBanabeAstar-spangledApincersAhooplaBerderAgizmosAfortunetellerAdrususA‫andAοutAzissouAtorchingAsoon-shinBebasAneilsonAjwAgratuityAflounderingAeurovisionAderbyshireAbroncBlobsAashitakaBnikiAunderdressedAtinnedAsulibanAmord-sithAlegislatorsAguidelineAcurrenciesA2.6B400AzippoAwinfreyAsunbatheBigiBhrubberyAramrodAplatoonsAneedlepointAmustaphaAlotharBeekieAkentoAgirl-AfootlockerAentertainsAdondeAcorporealAbruniA3chff8000AsignageBerapApincerAoutwittedAnoelaniBezukoBanotechnologyAmmhmAlisztAhelmsmanAchunhyangAwhetAtightestBhree-minuteAstuckeyBeherApeevedAopulentBff-AmismatchedAkinteBatsuraAjovanAinconsistencyAfine-toothAdiogenesAcoefficientBhokerAbeachheadA­àAp.k.AnassimBãAicoAhotheadedBeartthrobAerasersBdmontonAdyadBeterredAbullingdonBadriAanteaterA191Ay-y-youAvaccinateAtsunamisAshouidnApopesAlatrinesAhayamiAgοtAfluorideAbirgitAavastBtcBscendantAuptickAswattingBisterlyBcalaAreinventingAplowsCaBetitionerAmarrAhumanelyBawthornAestasAdibnyAcalculonAammuCbushingBethelredAthracianAsuperblyBquirtleBealantAmitsuCsdiagnosedBatzoB-16AleiterAjordanianBean-michelAgarden-varietyAdosingC-goodersBance-offAchickeningAbesterAapproximationAtrespasserBendulkarBatiAswumBtrumCoryboardBavannaAraindropAquiqueAlinguisticsBanghamAhosseinAguyanaCacAfuckin`AdishonorablyAaranyaA0.1AtweedyAstoreysBquigglyBolicitedBcruffAquarterbacksAolavAnitinAmendesAlogueAfullertonBire-breathingAdisinfectedBeepenedAalanisA196AworsleyAtremontAstacheBpyrosAroiBeliablyAmineyAhatsuneAdistributesDproportionateCe-hardAcalabriaAblippingBeefedBayardAauroreAsubjugatedBtratagemBhivamBethiBcamanderArimbaudApeonyAoutpouringBlesonAmcdeereAkirikoAdongguBakaraAcentralizedAbullfrogBlu-rayAyucatanAthickeningAsalleAreroutingAkocowaAhundred-dollarAgregoireAenvironmentalistAdotedBalmatianAanjouBltanAwell-equippedAvaletsAtsutomuBalleyAskincareArinkoBhymedBestorerApericardiumAmewsAi.d.sAhatinAeun-jiBmergentBffyBachotherAc.k.AanastomosisBhmAwellickE-earnedAtaejunAjohnyAinterlockAhuntressBeebie-jeebiesAcoaxedBenterpiecesBanoeingAaphasiaAzeonBanyAvoicingAtungstenAslatsBegundoBcarecrowsAprotectorateEAlhasaBeglessAkittoAferociouslyAbiscayneAacreageBbbreviationAwinninAtorreyAsubhashBomewayAmetastasizedAkousukeBikuAindeedyAínAidealizedAhand-offAfuck-allAevangelicalAcorbyAbraveheartA347AyagoAwhosAshin-aeAred-lightAphosphorousBarlanceAnctAmakgeolliAimpassionedAgoughAedificeAdenver-carringtonA'cosAcock-upAbeliveBandstandAagain.A'11AτhisAwhitworthAunfilteredAtimeshareCldenBavonAstranglesEight-aAperforationAolympiadAkindaichiAflankedAcoorsBelebAbroadbandAaltruismAweddinAvelvetyAsnehaAreviewerApreexistingBetaAleannaAkawadaAjannaAirrationallyAhobAdevoAcordyAbrainwaveBoorA21st-centuryAzor-elBiyanAyalaAtekBalkersAspatsBneakinBchillingAnorthumbriaCdaAjiyeonAhvacAglitteryAfibulaAdalbyAchanderD-chingBalrissianAbarrelingCd-mouthingAtantricAspeederBnipsBelf-sustainingBchopenhauerAraahAprecedeBarabolicAoverridesBbservationalAmelikeAkyrieAhangingsAerimBndangersBdgingAboyntonAadsoAweightyAvishwanathAstraddlingAprefixBornosAmcclainBattelAl-letAkishaAhideouslyAgoodallBianlucaAdunstonCetsAarnazCastooAwinstoneAthanks.AsleepwalkerBerialsCcond-yearAmorlandBeagreBariposaAhobbleBalf-dayAgrief-strickenAforesterAdramBorcasAclaridgeAbuckedAwuxianBaxmanAstradivariusBippinAqueuesAparachutedAon-onAnoteworthyAkujoAhitchhikedAgassesAfetusesAemmerichAdredgedAcheekboneBarstenAbigamyA3,600A1886AzambiaAwobbuffetBeaversBarlowAtricklesAsokarBhopliftCaftedBcionAretrovirusAnakagawaAmizushimaBclaneBarburgAgallantlyAenrichingBarmuffsAdassAcourtsideCntBhul-sooAayanA2oAunnervedAshujiCaniceArosaliaBebecaApinealBhrasedAovulationAlifesavingAkatsumiAjellybeanAarendelleBnnuityAsubtletiesBhmuelArandoAquadrantsAmillstoneBartenAibsAfabienAbreastplateAagarwalAworthingBilfulAunicefAtarsAsmarty-pantsAretracingApreethiBikeyBhoAnagaiAmpdBickeBessnerAjabbingAisiahAhaesooAforewarnedBlutteredAbulldozedAalfalfaAwightAvilAunsolvableAsteelersBowsBickenBe-yeonArejuvenateAmegalithicAkinsmenBenyanAhoo-haCnky-tonkAgobberAforefingerAeugenieAcoollyAbeckaBajoransA660AwoodcutterAvenaAupper-classAtreetopBerminusAruckerAorkoAnordstromAlittlefingerAkibaAjahaAirisaAgood-iookingAfilipeBellatioAeyefulBscherAdizAcoastingAblackguardBestsellingCrgdorfB12AarchivedAtight-assAspiraledBlayersBearchersDfaringApoteAoutdoorsyBrochimaruAnarcissusAmulledAlonersBegibleAipswichAfreezersBansubsAdominikAconcertedAbiographerA602A1.00Aunderstand-Atrumped-upAsuruBtarkwoodBilencingBhukranAreceptionsApxBoseyCkAnietzscheanAlivelihoodsAkuramaAhunanAfigurativeAdramamineBandelionsAcrumblyBlenchingBandidlyAanalyzesA4.50AyosefAvirginalAticsArhydianAplantersAmillilitersAkinfolkAjettaA'jAimprintsAgujaratiAentrancedAdirtiedAbollingerBejesusAwell-writtenAtomaszAshowgirlsAruzekBeparteeCgulatesAp.o.w.A'onzzAlocAkaleyAji-youngAextremismAdetmerAcondenseBhuncheonBapsizeAburkBledsoeAabcsAtrumboBizzyCborBhrallAsupermaxCfferersBteelyBlittingAreconstructingApaltrowAknowyouAinnovateAfumigatedBinanciersAexudeAdominicansAciudadBapoClciferAayselBdapterAuniquaDcycleAtop-levelBempeAstabiliseBpacelyBetteeBairaAr-rightBossiniApathosCnditjiAnonceAmeteorologicalBainlineAleeryAkatsuAelsterAdicklessAboozyBendersCllyacheAanorexiaAwhitenessAswitcherooApom-pomsBaraphraseAmevkibeBarkupAkeshaAimpresarioDlodedAhelgeCatstrokeAeun-seoCgenicsBmbarassingAcoffeemakerAblushesBelushiBailsAangersBlethiometerDssaAwell-bredAunskilledAtone-deafBiebreakerBhrowawayAslanderousBhearingAneolutionAmid-termBegalomaniacAkansaiAgalraAdidoAcocteauAbullardBackyardsAautomatonCgmentationA7-adam-15AunbuttonedAtirsoBacticianAstraddleBprawledBetsunaAquotationsAkoaBarnatakaAjabberAhalfordAgawkAflatfootAcock-a-doodle-dooAbattersAaztBghhAyibaiAstaircasesBlopingBcampiApiscatellaAmascarponeAlecheAk-paxAgoringAclunkerAbaraA4bAwomenfolkBhysAunsignedAsmaugBhoheiCiraishiArafiqAquesadillaApositronicAoutsourcingAnagumoAkhalifaAhackneyAgrouperAcounterfeiterBlassierAbenningtonDesClievinAtosaChBawneyCneAsieepBhelvedBfpdBafehouseAportholeBhaedraBetterBanderAmoisheBelloBateysCluAjemaineAinside-outAhoveredAdo-it-yourselfBeafnessAcarolaAbooberA6-4AyaltaAwunderbarAundertakersAstefaniaBhort-rangeAresuscitatedApixiesAnakatomiAlukeyBoosedBessenedAinterposingAflasherAeligibilityAchockAbestialAaskewBlaraAyoshihikoBanhuiAwell-paidAtrejoBheorizeBartanAsongwritersBnickerArulingsBepopulateAoratorBkjaAnettedAmamacitaAireAhuwAfragAdaimyoAceylonAbuildinBabujiAup-and-upAtsaoAstreamlineBcrapyardAlight-heartedAkoheiAhemmingsA'étatAencroachingBlysianBconomistsAceydaAbiancoAairbaseA707AwrackedBearinessAvronskyAuncertaintiesAtotingAstraightsAriggBaincoatsAoff-courseAlengthenBarocheAkewBaganAjumpsuitsAinoAhomeschooledBee-hawAgammyAdnBamodarAaoshiB-holeA820A4-2AwoolworthBell-madeAteleprompterAstarstruckBlurryBharpshootersAraydorCtonApuntaBersonificationAömerAmm-kayBarrakeshAdo-do-doAcop-outBlimacticAbloodsuckingBaddieAandorianA560A45-year-oldAÿÿAvijuAtushanBoo-BashiAsanneAryosukeAmenschAlotionsAkaurAhigh-altitudeBaiderAbonelessBillingsleyBenadrylBashaA1001AvalideA't--iAtapestriesAseptAreapplyAquarriesAnymphoAmodulationBedallionsBcmurrayAkbs2AhaeriAfirmnessAdoppelgangersBiversionaryBarklyAcondoningCmmendatoreDersAwaterlineAvenousBandeAswimwearBeeumAroofiedBecognisingApurebredClloBerversionsAoversAmenstruationBaidservantAkisaragiAelectricallyAdyleAcell-phoneA222AyesterdaysDhivaAsubsectionBaviAmíoBind-controlAloudonAkhalAhavaAembryAdartingAcognitionBhurnedAbournemouthBeekeeperBasteAairfareAshadedAno.2AmistreatmentBanchaAkittridgeAgracchusAexhilarationAdickeyAbrokebackBickBhopalBetwixtAwatermarkAstrataCalwartBakura-chanArunaCmpelstiltskinBesurgenceApepiCnknifeAmuntzBahalakshmiAhpvAcleteBinqueBharlestownAblackbloodBingumA419AtranscriptionAoccuredAmatsonCrinatingAlatikaAingotsAherbalistAfabiolaAcompressingBirieAaplentyA63rdAwoefulBhizzA‐wellAthick-skinnedAshaziaBaintedArepeaterApolypsAover-AmaterialismCraudersAkazukoAidgieAfertiliserAdisruptionsAcloisterBastelAbmBardenAassuageBrdennesBnsA264A181AwhitlyBahlbergAtasedAseasicknessArevelsAorrBh-ho-ho-hoAmyrrhBochizukiAloofahAji-yeonAiorekAhackmanAfievelAcowhandCrtésCnfucianAagelessAtranquillityAstereosBkidmoreArelieverAnosediveAluegoAkaratA'justAdwellerBissensionAbayuCnsAallegiancesBdditivesAupinAsurvivalistsAphishingAoakesAlendersBakeviewCingAilyAgbhAfonsecaAendoscopyAcursoryBonvulsingAbootstrapBailiAalgoAtestimonialsAscreenshotArectorAosvaldoAliliaAharlequinAgochujangBibbersAdabneyAclass-actionBiphersBaboodleAarchyBparnaBcquiresA‪youAx.o.AwajAschueBamaArtApopulateBlaythingsAmmm-mmm-mmmBeisnerA'letAkawaiAhermitageAfraternizeA5gAworsensBhiteboardAshikiArutgersAoverachieverAlauderAdroopBoenjangBeludingAconveniencesClorblindAbubberAwait-AsopranosBleuthingApetrAostrichesBptometristAhad-AgalyaAbonbonsBefallsAasswipeChcroftBniseA612AwoodburyAupshotAsodomizedAryunAnoamAeagletonAdrebinAcolonelsA'aiiA50000Aweapons-gradeAunrivaledAtwo-mileAmultimillionaireBoccasinsAiooksAghostwriterAflightlessAelectriciansBavesAduty-freeBesiringAcodgerBatelynCffertyA4.00AwheatiesA'twantAsynopsisBtreetlightBomeonesBlimerBhutteredBchoolboysAreadjustAprussiansAmondegoAfriskedBokAdouble-checkingBeliciousnessBannerAcannyAbaräCndyAalhambraAtunAryukAprearrangedAmisconstruedAharfordAfrithAdoubtfireCohickeyBatoAbenignoBaberAuncookedAtiffaniAspeedometerBhigeBekiApepitoBallAneuronAmavericksA'haransAhairpieceAglyphsAernaBllerAdizzyingAcatersCsillasAathleticismA752AumeAstandoffishBorry-assBloveniaBeftonB.a.t.AquiltsAozuBtsuAmodernityBi-youngClaneseBanicuredAincrementsAhyun-wooBaroonDebrainedAfortescueAeminentlyAdallyAcross-referencingCaniotomyBostumedCnfectionBhaebolAbotchAyeong-cheolAvibraniumAujaeAsplicedBnakebiteBisiBharkslayerBabiBã­ArukhAomaAliteBampertAhayekAgreaseballAfrz-0.05Ceak-outBarmhandAcoopersAbegottenA110,000AwiseassAulisesAtropicanaCigonometryAproofreadDclivitiesAmethanolAlisten-Bady-in-waitingAhendryAgreinerCBablerAecklieAdwalinBuperBootAcontriteBlaesAbuttleCrchBrennenAantiviralBberrantAtatyanaCranAsothebyBaddlebagsArstAnarcosAhaveaAdurbanAcho-wonAaddendumAwealthierAu.n.c.l.e.Bgly-assAtaglineAskyaArun-upBebateAovertlyAnuevoBoshAmoanedAirresponsiblyAhenrykAguaAfunneledBragrancesAdependentsAback-and-forthAarimaAsejinAr-ratedAprotractedAneesonAmitsunariBcnealAholoAdivasAcernBactiAbormanA585B70Awe`llAvalensAundergoesAtwo-pieceBomlinAstorytellersBhruggedBekarApeppaAmultiplesBargretheAknoAfurlongAdragnetBeanieA'd-AconfederatesCkedBlaritaBervantesAah-ah-ah-ahBchievableAthereâBamayoAsarangFArobbinAoverturesAnattyAmixtapeAjustinaDsiBamminClenAgrondCabberBaraAflaxAepsAcommasBhastiseBassockAblackenBadenAzuckermanAyippingAwhoompArooferApelicansAmastercardCndalayCdhavanAjanneAinstalmentsBkukoAhandsetAgchqAcribsAberateAwoveAunromanticCexplodedCdershirtAtyposAsynclaireBpritzerBhinomiyaBemiautomaticAquarlesAprospectorsAordAnareshAmelnickAkoraBnockdownBeeledAgrandkidBlitzAedmAcity-wideBancellationsAbrockmanBoudreauxBellyachingEickAamityvilleA450,000AyongqiAwhen-AtupperAsizzlerBeikoCedingAryersonBustomAmedicateAloinclothAkeynesAizuAflorinBensterBalistaAcynAaspirationalBrirangBchyA2-4AyannickAutiAtrenchardBomcatBhespianAself-imageCagalAremunerationAout-of-workAhairpinsAgrabbyBabbanaAfunnelingBindinAdrudgeryBepressesAconsumerismClonialismDlegiateBhemaAbismillahAaiyooBdulterousA4.6Awork-AsceptreAprudieBoringAmykonosBorbiusAkubelikBetteringCsselCrshawAieavingAgranaryBoadAf-wordBake-assAdrenBevoreBaesoAcraddockBlusteredAasunaBbootA9-millimeterAtutorialsBakaoAsteBhh-shh-shhArentersAphongAmidlineBeenuBatoboAkamehamehaAincomesAdilaurentisAbellinghamBalrajAavnerBliyahBdaineA343AzaizenAshambuAringinBappedApleaserBerditionAnondisclosureAmangroveAlungedAhonouringAamazonianA408A2050AvilletteAtomfooleryBhumbelinaAseungkwanClvaArovereAnorthwardBitricAmisconceptionsBaddalenaAlundgrenAkinsellaAhoagieBayrideCrithCnedaAentanglementsCcloseAdevikaAalchemistsBfghaniBdjustsCinaAuncommonlyAsmoothingArear-endedAnewburyCedinAkooksAhuskiesAemoriAdreyerAasuCcendsBll-naturalA407AtsungA'thenAshrimpingCowaArikBefereesCexamineApullerBetitioningAovercrowdingBppressingAmultitaskAgroutAfetishesCrmentingAdong-seokBefibAcontraptionsBhechensBamachoAburglarizedAanushkaAyokelBears-BakupAtunerAstorksCiffnessBkiersBilicaArondellBiff-raffAputteringClleysBagersAmarjanAitalianoAhowledAgorkyAdisapprovesBanbyAcooneyBausticAalumnusAteleportingEmachusAsquiggyBelf-importantArepealedCbsAlawmakersAknickknacksCeeledBaveriAimport-exportAgibbAearlobeAdixitAchangshengAa-oneAteachableAstoryboardsBodsA'shaughnessyAsendoAreconcilingBangedAoverextendedAnokAmnemonicAliberatorAhorse-drawnBawaiiansAgreenspanDasingAflotationBatiguesAeuphratesBstásAbuckmanBluebirdsBillableAanalyticsA0.2AvicomteAuninspiredAtorrioAnastierAlife-alteringAjewelersAitvBncontinenceBljimaeAhookfangAboastfulAzappAsteppenwolfBheepdogApsaBenneyBaypalCtronisingAkiyoAgummiesBeum-jaAflyboyAdoktorB.l.AcystsBhuiAblamAall-whiteAwearilyAtepidAstrongboxBitcomsBchlepAprefrontalBlataBeoriaAodorlessAloyAequalizerBlishaAchangeableAaksBctonAwoodchuckBarfieldAultimaAsaucepanArockstarBedfieldBavelCmlalApernilleBaavoAnewswomanAmochouBinioneseAlahiriCgoAkingsmanAhiv-positiveAdownplayAcleansesAaurasBntagonistBmidaBleshaA1,900Awest-allenAteacupsBaeraCchycardicAsurveilClfideBisyphusBendinBcathingBaddlebagApudgeBrovoBharrellAoutboundBkiAmicroorganismsBanateeAklickAjuventusBoggedAhecateAfurtiveAdynastiesBorfmanAcataractAbobsledAyamunaAtartarsAshanikaAphotocopierAjamaicansAhablaAfs35AemmieAbrancaBarnacleAwildenAu-umAtackedAstabilizationBpur-of-the-momentCoilsportBhaiiAretinueAoff-campusAnamidaAmondeBasahiroAiyerBnstrumentationAgemstonesAchalkedAanchormanA11amAyahyaAtaxidermistAstrangleholdBetupsApapillonAoranAminkyungBachinationsAlongstreetBaundererAjacoAinglésAfuchsiaBace-liftAeigerAbillowingAweigh-inAurnsAtayshiaAmothmanCngoliansBadoAlustingAherringsAgristleBlickAdevalosCleAchumleyCintuBedarsBaswellAaudrinaBntagonisticBll.Aweak-assAtriangulatedBachyAswathiBtuntmenCockwellAposersAone-quarterAlennartAkonaAh-holdAgalvanizedAeun-uBclipsesBbbaAchardAbushelsBassetAthree-quarterAstollerBeabrookBcapulaBaengAretinasCalisationApetarAmercadoBcmurdoAimmemorialAhusksBallucinogenAdruryBistillBarryAconstitutedAbuggiesAarikBmateurishBdheredAvariniaAunisexAsundryCbsidizeBociologicalBaifArekallAquinjetApericardialAobliqueAmoonshinersBercedes-benzAkanameAfrootAcaustonCcaoAaxedBrrogantlyBchilleA1880sA'yourAveeringAtightnessBaruApreeBointeAnetherfieldAmauveAkippersAhey-CdgehogsAglasswareAfrédéricAehmAboreholeBaranAzamboniAyorickAwitterAvirgeAustedAsüleymanBhipwrecksApessimismAnazismAlitoAkoothrappaliAhitotsuAenfieldBarthwormAdhdAcoqCntaminantsClostomyAblah-blah-blahAabdicationA159AzaaraAya-hooAsecreteArathoreAposthumouslyBatroniseClliativeAminnyAlassardCliCeAkentaroAjae-youngAgooniesAensuesAdufferAbuddy-buddyBonannoBeatnikAanoukA'9A808A1aAvelezAtoymanBammiAslghsBign-offBchottDeherazadeAreworkCinforcesAmusgraveBsnbcBmsBean-spiritedAjunpyoBplAinorganicAgreysonAfontstyleBairgroundsAdrinkableBouble-timeAafnanAwizardryClberforceAsalvageableAoverlandAmallorcaAlyoshaBong-assBinchpinBeeringAkymAindefensibleAgothenburgAfurleyBootlooseAfirstAewellBpidermisAdoo-wopAcreakyBompetitivenessAalonBkinaA1-2-3AvagabondsAsuzuranBettlerApurveyorBachoAnorth-westCnviolenceBadalAleanderAillusionistAhalf-emptyAguerinAfayetteAbombardingAarujBnticipatoryCdertonBmoralAzamoraAvorlonBaishaliAtomanCkoAsubjectingBpurtingBign-inBhivanyaAralfAozawaAmore-Cney-launderingBagneAlongbottomBeopoldoAjandiAgowriAfranciscanBedyaAerodingBlectrodeAdoncasterAcuratedAburdetteAaudubonBineAvapidAunsustainableAtwerpsA's--thatAsomersaultsBnippingArhinestonesBekindledApervertingA'oneAnovickBinety-eightAmeteoricAlermontovA'lehAjang-goAgarneredAfrothingBibrillationAduttaBemoralizedAadaptsA268A192,200AwhosoeverAtumbleweedBiberAspasBouredBe-riApãAi0Ahae-wonAgodownAeyvallahBxhibitionistAconsolidatingBapitaAbirdseedAartemusAworcestershireApulverizeBitmastersAover-the-counterBne-shotAmochiBacaAjohanneAdeuteriumCrvishAcross-checkedBitizenryBausalityAbulimiaBomaCdesBlurringAantitoxinBmanzaBdaptationsAsudokuCbclavianApulengBoitierAopen-endedBkeydokeAnunchucksAmuckedBcclintockAkahlessAhideyoriBae-youngAgoodyearBamgeeAfarfetchedAdiversifiedAcounterterrorismAbeninCkjaeAafieldBaaaaaahAstarvesBitkaBholtoAromanticsBenegeAplantagenetAoscillatingBphthalmologistAnevermoreAmichioAlevittAkhatriAhallowsAgreat.AdragosBelleAclumsinessAbroncosBhaijaanBeastieAangioA5.30B05AtreatiseAstretchersAresearchesAquinceyApitilessBatinaAmolehillBiasmaAheapedAgangbustersAflueAdrenchAcorinaCntrasBhatoBapitaineAbeekmanA1206AzabelAtotoroBariffAreaffirmApixelAoohsAjavadiAimplantationAhosaCllingerAgood-nightAflickaBdAexhilaratedBmboldenedAcrinklesAbelicoffA3.7AstigmataBawantCdatAroosCbyAqingmingApughBimentoCckfordBastorsAolleAmazesCksimAhandjobAforty-nineAdemocraticallyAcourt-orderedAbrattyA1892AusdaBllmanAtrouperAscallionAretrofittedApestleAoolongAmyriamBeerabAjoubertAionicAfrondAdalíAappyBntagonizingBirspeedA333AuekiAsurnamesBcoliosisBaebaArotaAoverbookedAkoshienAjungiAheadsetsAgomesAelliAdillerAcompsClumAbutternutBozemanAaussiesA'whoAstubbedCearnsBlovakBayersArounderCbinsBepressingApertainAoverstatingAnichelleBerudaAmedullaAlarabeeAjacAeveryponyCaporatingAburlAyongsanBeomanAunsuccessfullyAthalliumAsuperglueBelf-harmArolloutApommelAoutaBrrinAkurdogluCntiAhospitalisedBabloAfinsterCbbingAdistrustfulCm-wittedAchaniAassertedBrousesCaiBliyaB.k.AyugoslavAthird-worldAstemmingBledsBhh-shhAnotteAmichAkamaliAflavouredAdeaverAcigAbruneiAantacidAyouveAtariffsAnortheasternBaeviaAmutineersAlopBelaAiasAhypothalamusBullabalooAdaomingAceptA1chffffffAstargazingBhinjiroAradiatorsAmurilloBigsBccaffreyBarseillaiseAkrispiesAjanitorialAdownsizeBa-songAcerkutayAbridaBeatdownAall-nightersDegeBizuA161AwwfBhittlingAuncieAstep-motherBquintingBpanxArobieApriestleyBolynesiaBaraphrasingAkozueAguhnAflaggingAdarkiesAcussedAzakirAteatsAshabanaAreticentCjoinedApetrovnaAomicronAmin-junAimmutableAhaydnAgung-hoBambonAconglomeratesAbrokenwoodA287AyaarAtributaryBh-theyBeletubbiesBarinAskimmerBhoppinAraggedlyApotentialsAmornayBcsBatchstickAgraystoneAfinalityBearfullyAdisconnectingAconnectivityAbequestAashitaA285,460AprotesterDsecutionsCemieresBoliticBacifiedAmarketableAloulouAkepplerAhaliAducktalesBelivererAchargersEanAbittersAarbogastA1890sAyarmulkeAwadedAundesirablesAtidbitsAsubversionAroseyBhinestoneBeplenishedCadershipApankajAofthoseCfalAneymarAkaylonAimpetusB.m.AdomicileBishaBeflectorsAberlusconiBanyanA591A42,000AviserysB6AundersignedAthoughtfulnessBae-hoAsystBelahArocklandApredictabilityBeckerwoodAoffredAnoniDessentialAmervynAluceroAkovakBick-offBerbAincontrovertibleAhomeschoolingAgoldarBayathriAdrug-dealingBorritBeath-defyingAcrumpAbrucknerAaquinasArent-a-copAquestionnairesApirouetteBastiesAnokesAmiguelitoBarkumAluizaCdendorffBolliBisiBestrangeAdarlAcluBabronAbushidoBlondsA8.00A414A3.4AzouAwatchmenAthisâDnking-BestesAstoplightCipulatesBprattApromosBoorhouseBipiBaracetamolAmethuselahAlceAhae-kangAdoubloonsBickersonBelmonicoAcribbingBorneasAwyndhamAtekkenAsu-miCbcontractorsBkivviesArelaunchBadicalizedAqualifiersAkerAinterchangeGeptorAdevilleAbaldevAashurAwhitelighterBelBallenbergAvicarageAteiiingAsquabBenthilApinkertonsAookAnorringtonAminakoAjurisdictionsBean-doAfritziAegocentricAchacoAbhagwanAzookeeperAunmadeAshelvingBavChirCcristyAroshniCck-hardBésumésAprimesBavlovichAoozesAneeluAkhaiBetchAirumaAdefectingAcumulativeBorroboratesC-conspiratorsBhicanoAbuffoonsBanquoAairbenderAvenuAstingersBnippedAryangButgerBonniCastsApettinessAnanteAlevitatingAirresponsibilityAeun-jaeAdisparagingAcommemoratingClbycoBalogeroAaltairAwindowlessAvisualizingAtendrilsAseungaBébastienAreadyingBadovanAphillBanoramicCleontologistAichikawaAglistenBautierAfisticuffsBbAegbertAcreepiestBivicsBhirringAbonneyAalleywaysAyukimuraAtumblersBhree-weekAstoolieBhit-tonDnwellCallowerBelf-reliantBalcedoArockawayApresident-electBilferingAniangniangAmotocrossBiggyBelikAiyingBnosukeAgreavesAflakingAevianBssenAdominatorBeyBan4jemAatiyeBrbiterBlarmistBdenaAtikkaAoff-balanceAjacindaAinsinuationCcalculableAhis-AbossedBiochemistAanthologyAyeon-sooAunrepentantAtommenAscriptwriterArojoBeigerAkageyamaAjohnstoneAhidalgoAflat-screenBilamentBemiAdonnellAcreepersBounter-attackBholoAbethelAanistonA12.5AzellerAwoweeAtranscribeAsmackdownBacsArigelApleatsAmindfulnessBccullochAkhôngBajaChiAjaggersAingeborgAfelsonAdurasBissonanceAcreggBhayaAbaccaratAyvonAunblemishedAthreadingAscuttlingBaikiAporcoBeonsAnolAmatchaAliquoredBawyeringAísAintrospectiveAhallucinatedAflavoringAeliseoAcocoonsBelluloidAbogiesBlackfootBawdyAall-starsA15-yearAwaldAungluedAseaworthyArakesApigmentsCckensAmarceAhaltsAfilletsAerkangAdemeritAcommemorationAarbuckleA179AzainAworshipersAsnugglingArigolettoAoverthrewBff-the-booksAnorteAmoonshinerBellishAinhumanityAgoferBenevièveAflanniganAcuishleA'avinAataA2046A0-1AtarlyAsynchronizationBhenandoahBayerArehmanApiss-poorBazuCanAoverestimatingAnaymanAmasseriaAjoshingAgrimoireAeoAdebunkAcatchinA830A1492AzeroingAwilberAvestibuleAsubstantiveBpinelliBhoopApinochleBeerlessAnew-foundCetaAmonétBctavishAkanaeAjonestownAintegratingAhung-overAfrellAdowngradedAconscriptedA865AyuppiesAtweekBteBevyeAswirlyBpin-offAretrofitBésistanceAquietedApapacyAootAnonnyAmoffatBinseoBashingAlaboursAjubilantAinterloperAgrayerAfourteenthCrty-sixAevertonAdropoutsBicBaminiAclear-headedAbigweldBeretsBaublesCthoryA416AstifferBhaheenArozzCck-a-byeApolarizedAnumbuhAmisakoBerriweatherAhigh-maintenanceAdecanterAcruisinBanaAblumeBehaviouralAawedA12-stepAwendiBastrelAtrionAstir-crazyBerlingAquittinApre-weddingAmonasticAleezaAinigoCflectionAhecklingAgrishamCavitasB.g.AfritoAentitleAdeviantsAcarbonatedAbambinoAandradeAwwiiBindupCelderCcketsBerAvergerAtremblayAssireumBquaringBnakeskinArock-and-rollBecruitersApermianAjanssenAforcibleBacsimileAenvelopCcircleAdutchyAcoveyBataloguesAbeebeAzaidAyawAtrimmerBarredAsaskatchewanAroloBitikA'meAlongstandingCathBivethCp-syncAkanonAgilgameshAfunnilyCckwitAevidencedBcoAdrinaAconfluenceBanoClamitiesAbumpkinsBrittenAannabellaBkkaAsparinglyBanjeevAreveilleAobsessive-compulsiveAnondescriptAmoserAkermieAimprisoningAhockleyAgonadsAfaziletAdampersAciciAburbsBathurstCnishingAwheyBatercolorsAunconnectedAslimeballBatiricalCndwichedAplay-dohBetroniusAoakwoodAnarcsAkiss-assAjijiBavaneseAhandfulsAgrandiBod-AfalwellAcastawayDsyAwrestlemaniaAsunnysideBomething-somethingBhroudsBciutoAregressAnullifiedAjaxonAhouse-AgunsmokeAerikoAchildishnessAblood-stainedBig-boyBhairavA0400AwoodworkingAuphamAtoyoBhunderaBachAsurrattAransackingApromptsAnishimiyaAkoizumiAimpostorsAhalf-fullAguhAfinalizingAd-didAcommandeeringBhipotleBandlelitCliphateCfAbroadsideAwinehouseBeimarAvisserAtitaniaApleuralAoverlappedEflowedAlipoAfaysalAcosmonautsCmmentatorsAbrunelAtygraBiffinAsoothsayerBerhatCdAreconfiguredBamírezAprojectorsDhibitingAmaharajahAkjellAhhmBavensAgustafsonAfizzleAencompassesAdiminutiveAwow.BalderAviratBaldaAundertowAtradesmenBitubaBailspinAsymbiosisBtroganoffAquinteroAmiramarAlinuxBatheAkirAinhabitantAhydrangeasAgdpAescalanteAwarringtonAvisBerstappenAtoshikoBhoraBameraArrrAprofferD-choiceAlancesAkdkAjonjoAfilamentsBfpAerodeAdiggoryCfferingAchildrensAzoologistAvoyAsainsburyArhyleeBeikaAprominentlyCecipitatedBhariseesAneutralizingAmombasaBargitAlacsAhydroelectricAeurasianAconditionersAbustersBrandishingBenoîtBamm-bammAairflowBgassiAtopplingAryunosukeAmoondogCnorailBani-pediAlemmingsAkamakuraAiustAgilberteCgantoBerdAfast-movingAexcerptAcoming-outAbautistaAavalanchesAνoAyanniAviaductAtrillAsuzannaBophoclesBextonAroundhouseApalatialAofhimBcgAmoresBightilyBchughAlife-givingAkinglyAhazelnutsC-riAdisingenuousCckwadAcorvusAbreBonaventureAvaloisAtwixBorsteinAstephaneCatuetteBmokehouseBexlessCtterAmtacBistreatingAliquidityAipadsAgnomeoAconstructsClonnaBloughAbixBassoonAasimovBroraBdlaiAwoodsboroBell-intentionedAvarrickAtrappersA‐thankAtensileAsynagoguesAparishionerDapetEdisAozgurAlove-AjetpackAhyo-jinBow-AfireplacesAextraneousAdisassembledAcompedAbromAapprovalsBbeerA33,000AwrenchedAviscousAusrAswampyBelf-careAoakenshieldAnimrodAmoneylenderBemorisedBarkoviansAjenardAgrunerAfeatheryAernAdisinheritedAchinarAbreannaBladdersBellevilleAall-consumingApareeAobadiahAlunchroomCcarioAihabAhypnotizingAdündarAcursiveAbullfightingBaxAarlenaBpostropheBccordedAsleazebagBignpostArecitalsApawelAmyjobBodiglianiBisdirectCnute.BañanaA'ltAlehmannAkomatsuAipaAhelmandBalflingAdramatizedBo-sanAcubitsBinBelieAbodaciousBacksidesAwoodardAth-thereAsugarmanBontBhakuntalaAparadoxicalAnorthernersBimmiAliquefiedAkilroyAjong-unAintercostalCgratesBmpartedAhertfordshireDeticalAfubukiAdog-eat-dogBevaneAcrustaceansCissAboneyAarcadesBoyagiBngelouAzinAxaviAwantonlyAsugimotoBteinemBequentialAralphyAonsiteAfrankoAdistinguishesAbutaneBohrBinkAwisemanAteenaBaffetaAstirrupCenosisBouth-eastAripenedApuritanBerumalAnettleAmorphedBchenryBacreadyAjogsAindoctrinationAgladeAdaebakAcheltenhamAbludgeoningAatheniansAªtheAa-okBmanthaAwell-balancedBalk-insAunzippedCappealingAtalbertAstrongmanBhinoharaBcraperAreverieAooh-la-laAnisaBacelleAjardineAindemnityAcurdsBrimeanBlaiborneAalitaBbalonesAzicoAsubjugateBtatlerBniggeringBheungDavesArevelryCsedaApostingsBersonageAoberynAlivelierAkortBakAjunjieAgremlinsBoody-goodyCldenbeardAeclairAdissipatesAcowenBlaspedBarreyAbartyCmboozledAappropriationsBnti-inflammatoryA589AziffelAwadsAsymbolizedBocializedBhanthiA'poseAmarcelleAlorazepamBeelooAfive-dollarAepidemicsBctoplasmAcounterpointAborgiasAauerbachBnimalisticBbdulhamidA530AvarroAsubroutineBpacexBhafferBempaiBalientAproxiesAoveractingAlaminateAjuraAhey-ohAfucking-AevisceratedBrtanBmbezzleAcolonicBloak-and-daggerAbroadcastedBoggleBifrostAwoodlawnAtyagiBheronAremotestAparticipatesAoroAmanusAji-wookAhookupsBeiiAfalling-outAextra-specialAdespotAcalisthenicsAarcsA.32A'yeahAwhittledBaiversAvaliAunderwhelmingAtiananmenBest-driveArewiredApaterAmichaelsonBanicuresAlayawayAkokduAinteragencyCquirerAfullmetalAdostoevskyAcharisseBandylandAbattenAaggressorsAuneasinessAtowlerAstéphanieArotterBenjieCeledApocketingAoverthrowingAlyndeAkoufaxBatriAgoldsmithAdandridgeAculvertBolfaxAamisBltarsA'wasAspookingClicingBkiedAmass-producedAluanaAkodyAhypnotisedAelevatesAcielBhandiAbovieAadiraAthesaurusBamikoAsouthwesternBnatchersArambunctiousApasseAlaetitiaAjolietAhaeunAgellarBayestAfeynmanAdownturnBeeringAchickyBephiroAbindingsAasystoleA4-1AziadAyubabaAwiddleBallflowerAverilyAstarmanBiftedBhannaBamplerAlocosCad-bearingAklumpAjiggyAhomophobeAdistasteAcornstarchAbariumAabieAw-w-waitAvennelaAthree-bedroomEadedAspinnersBeafloorArosettiBandaApsoriasisBaroleesAnicolásAmid-centuryBachinaAjagdishAfrizzyAcompatriotFrtmentalizeAazaleaBmbersonA341AwendallAv12AtonoCday-BhermodynamicsAslurpeeBibellaBcribesAracehorsesAoskaBne-upAnuitAminisculeAlikeyouAintervenesAevanstonBterniaAdumbwaiterBoughboyAcontaminantCdependentAbipartisanAashiBnti-americanAyesteryearAtransplantationAsubmitsAretractableCorganizingCadiedBaneApawnbrokerAovertheAmakarovAjessopAhsAgentrificationAfrivolityAdarkeningAbronzedAaudAunkemptAtrellisAswapnaBumbitchBhimuraBagetAprettilyAnight-visionBanosecondAmanderleyAlipsticksAiookedAhorseplayBeartiesAgregorianBorskiBhoshAenablerAdossiersCorbellsAcobrasAbarraAa-trainAyoruBannisAvinzAtwixtAstrap-onBouth-westBhuichiBewsClf-improvementApre-warBlacardBereAooh-ooh-ooh-oohAmontagBightaBarxismAluiseBegitimizeAkipperAhyeongsunBouse-to-houseAgornAfaraAdaviAcomeuppanceCckatooCaxingBathouseA4.3Au.a.Ashort-circuitArepelsAproliferationAorganicsAneuroscienceAmandatesAkotobukiAinsinuatedAgelatinousBalbraithAfrellingAextractorBrshonAcartingAbrowerBarçaCntuAapeshitBlludedAtauriAsubjugationAqureshiApetticoatsBarsnipAidfAhummingbirdsBalpernAgymnastsBonzálezAflossieBertilizersAengelsAdssBiscipliningAyoung-chulAtinctureBalliedAsuxArevengedAlvpdAguzzlingAfrothyAenthusedBmulsionBewAdagwonAbenedickAtranscendentalAstandoutBioBhemCahinAretaliatoryApersonasAmeet-and-greetBacleanAleatheryBampshadeAjokinglyAhavesAfullbackAeroticismAbluerBehroozAarchwayBbdallahA3aAοneAwise-assAspurnArnBivetAquincannonAprioritizingBhryneAm2AkamuiAhyoriBonkedAfaustusAemmysAdisgracingClanBaiquirisAcouplingsCrelliA1.9Atwo-monthBhoughtfullyAsloshesBhropshireApracticalityAnarshaAlippmanAkirovAingestionAgracingAcrosstalkBhowkBemreBarliCpitulateAbludgeonBethanBankbookAanointingBdamasA17th-centuryAyashaAwashoeEboardAvisionariesAunblockAsuaAresectApassers-byAorloAmismatchBegahertzBangleAinclinationsAhynkelAgibblerCadaAfootmenAeryBnchantressBadieAconcealerAberndCnnoAamphitheaterAwildfiresBaftingAuninformedAtwo-leggedBonkinBenuredAskirtingBeungriArupturesAmusnBaiselAjoryBiulingBappAintermittentlyBkonAheepAguvnorBrosseBirisAescargotAdowncastBawoodAcosmologyCpycatsBhutzpahAvenkyBaricoseAstainesAquarrelledAoorahAnupAkuzeyBeesBarliAharmonizeAevictingBncyclopediasAdüsseldorfAcouplaBanonsAbirkAawkBhiA1789AwaheyAtippiAsukhiBtamosBpyroBharpayAphotojournalistAoyaAnenaAmarksmenCkeoversAkaroAiroquoisAhoodwinkedBieiAgrossestAfuhrmanBorty-oneBeinbergAdickonBhillonAcorinthianCchinBharminglyAbessyCadedAaulusBffableBaaarghAworkbenchAvaliseAtriceratopsBíoAscrupulousArenegedCgroupingApovBanchayatAmysticsBedicisAgratesBloboAentry-levelAduplicityBonatiBisquietingAcinderellyBecilieBamembertAbonifaceBlightedA299AweatherbyAstunninglyCabilisedBaint-tropezAnaivetyAmcandrewBarleeCcaulayAlatAincisorsAdavrosAbrbAalvisBeonAyokaiAunequivocalAtummiesAsanshiroAramalloAportsideBannaAmagnussenAlonginusBazaroAinspirationsAholier-than-thouAgobsAfoul-mouthedCnAdomesticallyBmaAculledBrawlspaceBarcinomaAbiographiesBabbageA907AyudaAwrenchingAtwilaAseldenBcuffedAreikiCgretfullyApg-13BachaAnayeonAmumtazBash-upAjaggiAirisesAfillersDiBalteredAcarcettiAa4A11.30A0300Aworld-Bell-organizedBaxesAumamiAteterboroBalkiesChitianAstrange-lookingBokchoBignboardBcuttlebuttAromanticismApreordainedAnucleiAmasukaChabharataCdhaviAltalianAkillickAinazumaAhighballAduyguBoudouAcopulationAburpedBadalAtattlerAsyncingBaet-byulApygBatentlyAmikotoAlichtensteinBecktorAinsomniacAgiorgiaAfree-spiritedAenclaveAduttBomainsBamnableAcastesAbrokeringBenitezAxizhouAunreadableAtôiAstrainerBloughBickosBhahrukhBenkuArahmAnassifAminnelliClgramBascotsCherAjoaquimAitaBncensedAhowsAgood-sizedAeverlyBmbryonicAdoo-dahAcovetingBluedBhumuAburnleyCffersBelénAantihistamineBh-hahBfter-dinnerA216,432Awar-tornAsaplingsAmurchisonBitochondrialBesutBan-hoursAkitschAjelenaAgwendolenAfukuokaAcowbellBarewCpillariesCn-doAbehindsAayresBcropolisAyasserAvintDdicateAtruncheonAstonebridgeBkitterBituCgourneyArfidBestaurateurCibenCadoutsApetyrCrlmanAnitpickCkolayAlinderAklAjacoboAhangryAginetteBambiniAexpiryAdrissAconscriptionCkeheadAbradleeAazazelBy-yi-yiBssembliesBm-BlvyA490A190,245AwaldmanAv-8AtrussedBime-travelingAswimminglyBendaiApyramusAolekAkiraraAjolsonAhalpertAetsukoBenAdolbyBishwashingAchechiAbriefestAanywhoA319A100,100A001AsynchronicityBsaBpiresBojournBlapstickBhamefullyBevimBcramblesArigidityBestorethBcmpAorgasmicBne-monthAnamsanAmountaineerAiousA'imAgaietyAearthwormsAcroupierAbombaA961A471A326AwarninAvidBedatBaniAudderAtransvestitesBowaCss-upAsemaBcreenplaysArosmundAoccamAmidlerAlumberingBothalAkarunaAjaguarsAface-downAcomputer-generatedBhicoryBarradineCmpbellsAberserkerAarvnBdoptsA740AtraggAmnuBaîtreAlocomotivesBifesBessingAkoehlerAjolliesAhearnAgravesiteBibneyAflatbreadAd-structsA'daAcalzoneAboimlerBedpansBarbsAasphyxiaBkkadianBftershockAzuzuAwhoieAsurpassingCffocatesBtorybotsBhillBederArehiredAnoticeablyAliquoriceAinducementAhinakoAguguAexorcisedBmasculatedAdachshundAchivasAaquinoBdhamAzeoAunquenchableAtsugumiBogether-BnAszymanskiBebastiánArs.100Apower-hungryAnantesAmissing-personsCnjaeAjonsonAhumiliatesAgulabBreat-grandsonBleefullyAdeathtrapAcarolersAbuchenwaldBhimaAakramA607Atwo-inchA'seAsarojaArotiCbesonAprioritizedBancettaAnarAmangosCdyAgame-changingAfernandesA'dwyerAcubiclesBonjurerBarvesAaaravAwolfsbaneAtobrukBanuAspateDceportAresurrectingCjoiningAphilandererAmunkBalvaB16AlazybonesAhypoxicAgrossingAelkeAdisclaimerAcommonalityAbozzCgglesBeakersAa.t.f.BcolytesAzarahAyvanAtruscottBhurberAswathBquealerBputumCoofBleevelessBimulatingAremediedApsychobabbleBhalanxAone-roomAjeomAhaphazardAfecklessAetchingBpochAdemeterAbellyfulAaccusersAwritheBakedAultimatumsAstoningBooyangAramziAoverworkingBff-rampAnazifAmonologuesAlightninAkoroAjarheadAitaewonAhalf-heartedAgroomerAfront-runnerAdidnaAvagrancyAtakezoAraeesApreconceptionsBartialsAonenessCassisAnightyAmungAlinemanBachieAiterationBmposesAgoing-AculminatingAbestowsA300-poundAwaylandAunimpressedAsusumuCmerBteerageBhuteyeCizuokaArs.10BeorganizationAnimmoAkantaroCbleAi.r.BndentationsAhephaestusAgascoigneAfour-eyedAexpectinAdesiccatedAcutlassAbackacheAas-Awasn`tAvacAtharAshamesBcootyAreznikCclinerBayanneApuddinAnothBewsreelsAliaisonsAjibunAgrindelwaldCavestonesBamutAexceptedAdurkinAcarlsenAallahabadBjokeBgrippinaBdditiveAstuyvesantBakshiA'outAninety-fiveAlustrousCchoAkindleBentleyCenerBamekonaAintractableAhot-dogCoterAfuuBredericoAdivorcéeAcarabinieriAbealBallingerA4kA2aAwildlingAtracheotomyBetsusaigaAsir-AneurosesAji-sungAhappenstanceCllyuAgeorgiouAdishonouredAassentBnoopA4.30A3oA1889AwhitherAvarnaAunpatrioticAsherloqueBcrapingsArhdBe-enactmentCbellionsAperimortemAnarasimhaAmarutiAhtoAgolmaalAdorfBevotionalAcraAbudgieBronBiltmoreBerkleyAvtAunencumberedB0AtúBhree-manCorfinnBangosAsmilerBhowboatingCamsherAremberCcededAnadsAmarocas62AkoreshBhadijaAjonoAinvalidateAha-youngAfriendlinessAeastwardAcompassesBacophonyAbootleggersBenzeneBathesAa-gonnaA50.000AvishwaAugliesAtransverseB-birdBaipingCcticallyApankotAmagnetizedAinternshipsAgurusBraysAemeiAding-a-lingAcost-effectiveBhiharuBarissaAbronchialBeignetsAangèleBlaeddinAzitiAyaksAwernherAvolatilityB.c.Au-haulAtalosAspringboardBcrubbersBamaritansArumsonApomeranianBerspiringAneskiAmicronsAkiuBassieAinterrogatorsAhazımAfushimiBilibusterBebAdisparageAco-counselBhin-chinAbrandanAwasâAunmanageableAtaeyongAstromAreimbursementCenterAposnerAoohingAneversBazcaAhertoCckleAfallopianAentomologistAdigimonAcomebacksCeurBheap-assAbuckboardBiodegradableAwhite-hairedAsecond-floorAruinationBeverberatingCdialAoverblownBne-stopAmcrnBanheimAloosensAjanoAhaldaneAfukudaBreeze-driedAdisrepairCazepamAcriticisingA2.30A1881AtramsBeedAswipesBupremesBippyBhalimarAo.s.AntsBganAmi-namAjuxtapositionAisrBppoBnordinateAhullsBintonBandprintsAdisparateBengueBaxamAcordlessBalculatesAbuschClentBrownedAandrejAyeong-jaeAwhinerAuttersAsourayaCrghumCfã­aBherrieAqianqianAmimesBarietteAknickAhijikataAgrizzliesAdenchAcross-sectionAbyrdeAandoverA969A.25AtsunadeBo.AsagaraAreductiveAproblemaAmontclairAincontinentAhalf-pastAfrondsAdissonantDlocateAconstraintC-founderBlincherBhichiAbellmanA38,000AzarinaAuntiiAtoughieAreformerApurimBrickingAoldhamBbstructionsAmenorahAkaiaAhaberAguerreBravitonAfulfilmentBaganAcultivatorBorbynCntortionistAborkBlurbBittermanAasshatAzainabAyoshimuraAwestmoreCrertAtarsusAshenzhouBelf-obsessedBcalpelsAparticulateCbstAoutwardlyAmitsuiAlieselAilgazAhochstetterAeloraAchisatoBabbyAbenedettoBacktoAarchanaBppraiseBeshaAzitaAyuyaCnoAwaylaidAt-thisBreatinBhinnestAsh-BavoringCdistsApumiceAnuñezAjugglersBarndyceAinroadsAgreysBorgAfranciscaBahAelastigirlAdresslerAbipBeauteousAyitzhakAxiaotianBeniaAunsubsAspongingAprendergastDmedBortraysAo-kayAmoltoAkickassAjurekAimaiAhollingsworthAemeliaAdimlyAconcentricAbolatBlitzedBimAazaleasBnthropologicalBgustínA50pAyoung-minAvestigeAtansAslouchingBhadoBcopedAquickensApiaoBasoliniCrt-timersAmagadhaAlaplandCncersAjsAisaoBadyAhighbrowAfrankincenseDcasAdanderAcontentedlyCmmittalAbrickedAambidextrousBdversarialA507AwhackoAunspecifiedBeharaAthird-classAsquelchBchollDnabelAlow-cutAknowestAinvertBboAhedgingBaltingAgameplayAfei-hongAedwardianAdrop-deadBeckingBatteAbranwellBig-noseAannexedBllanonAvetteAtunisianCiBalmadgeAsufiBtrongholdsCencilBoobinBeasoningsAririAquarterfinalsAproseccoBoconosAmicrobialAkainanCdamAhomeschoolAgazellesA'ereAdoormenBewiAcrackerjackBertaintiesAboatshedAvivianaAunosAtinnitusAsubparBcapegoatsAreorganizedApanoramaClmdaleAnam-soonAmealtimeAloompaAjaxxAinterminableAglow-in-the-darkAeldoradoAduisAclaypoolAbertinelliBatterseaAverifiableAsurgedBonaliCloniusAphosphateBawterAlibreAknellAhooliganismAdurbinBevasAconkBibAbigglesBenfordAtrick-or-treatAsortieBhipmanBealeBatanistsAquotientAparadisoAnipperCckelodeonAmarriageableAlibyansAioseAharkinColeAfuddAemmittDelineAconvalescentDstrictedAbrawlerBarbarossaAarraysBkhtarBbortingA284AspitballingBkynyrdBerpentineApyrotechnicsBithyAlawfordAkostasAjambalayaCgoAinflatingBmpaleAflavioAevokedBntrappedAcreepinBommuniqueBaronAbloomfieldBierkoBang-bangA514AwalkenAtommoBipsterAstruthersBnakedBarcomaAmizoguchiAkikuchiAembezzlerAdodeBepotsAcottleAbelladonnaCatonAayazAuhhuhAstoickBhuyaCodBequencerArulebookAorbiterAmoonbeamsCdelledBingusCfuneBattisCrjoryAlfyouA'heyAhelanBand-holdingClaAgossipyAfriend-Ad.h.AcommunicatorsAbrestBontecouAazerbaijanA957Awhite-hotAunfairnessAtiltsAsimmondsBánchezArangoAlenoraAjogiBinaAinwoodAgynaecologistAfumeBixateBallibleAemrahAdisrespectsBan-ahAboovAangloA½àAwith-withBackosAunicronAswatchesBpoonfulsCearheadedBmoteBhampoosAponteBalerAnightstickAlichenBactateAkeiichiAjeannotAgrisAfraAconcordiaAbrontosaurusBoundingBawledAayyAzahirAworryinBiryAtatyaAsupremacistsArmbAproblem-solvingBizarroCcketsAmiezeCchiruBainwaringA'll-weAlaugh-inAkodiAiftheyAgodlinessAfumikoBorestryCggedAcuevasBoastguardBliquesBcsAb.o.BasaltAarinBegisA504AwiningAurkoBnsealAtotalingBanaAssrBimonsonArociAplanckBepperedAoutflankAmyersonBitzvahsAkadenAhajjAgrenobleBilchristAfreefallBerraroAelloAdumbassesBgpAcigsAbrookfieldAamparoAyoshieBeonggwangAwiltingBastAuh‐ohAtrick-or-treatersBhird-gradeAsimoBeskaAmurdaughBaleficAlaciAiieAhamdiAcoldheartedAbfBarteringCnkyCdassesAaviatorsBtrialBiiveAthree-starArolandoApneumoAmirroringBattedCrvelouslyAemmiAchieflyBessationBataloniaCrbon-basedAbraidingBooksellerAashworthAwheezeBeird-assAtraumatizeBarunAsöğütArom-comBicochetedAkabukiAjojiBirenAhelterDiportDaBangoutsAfleecedAcrumpleAboatswainBleedersAattentivelyA7-11A200thAyoshAunsatisfyingAtwangBsingBingeBhatawayBaranskyCmmanyAprajapatiAnikesAmoonwalkBini-barAlyreAkorhanChliBirishimaAhot-waterCochieAgwendolineAfindAfaizalAdhAcopywriterDaceticAbord3BestialityAaccomplishesAvjAuteroAtollboothAraphaChmetAmuslinAgreenhousesBallstonesAfajitasAenverAchancedBasksAblood-suckingBen-hurBarfingCllaratAasaiBnzioBllmanA541A40-footAzoomsA'whereAwerkBagersAtime-shareAswoleBplinteringBidorovBhiatsuBandhuAreinhardAputneyBauleyAoodlesBne-pieceAmcdougalBammogramAloathesBetiCapfrogAineligibleAgodotAdolemiteAcharliAbewitchAasakusaBrghhBcuityA413A274A0.3Awh-wh-whatBallanderAvallonAulyAtunneyAsinger-songwriterArocioApillockBaternoAolyAnylaBewhouseColithicAmeridaAkalinaAhuiquanBmmphBeftAesophagealBobardAdunsonBownsizedAconsolidationAavniBlvesBdonaiAⴀⴀ㸀AwagstaffAvarneyAsumitraApalleAo-negativeAnavorskiAmitigationAlibertineCaneAjonesesChanssenAincandescentAhendricksonAgeysersCttysAcross-dressingBontemptuousBanapésAbtAalgonquinAzandraAversatilityAtalbottAswishesBtepladderBaroAkinshasaAinterlinkedC-personAhoo-hoo-hooBendrickAgi-beomBalanAfinisherBabiAevacueesBazyAdustpanBot-comBispersingClateAconstrictorBhigsAbaumannA12.50AzonaBbzAyellow-belliedAvriesBisitationsCncenteBacayAsuck-upBeryozhaAravenwoodApatrolmenAoverburdenAnhaAmitchieBcuBartensAloudspeakersCngingsBevelledAhalf-pintCckyAgibletsAfunniesAdreamlikeAasinA516A1848AstemmedBrinivasBoo-geunAravnAnakayamaAmomijiAleathersAk.k.AhypertensiveAgrinsAemigrationA1868AwilksAundefendedAthorsenAsatanistAresignationsApupkinBalmerstonAmárquezAkanazawaAexacerbatedAdetweilerAbayingA7500A525A192,240Aweak-mindedAtumblesBruffautBouch-upBhing.AsuwonCng-hoBooahBix-yearCndAreisBawsonAnapoleonicAministerialAluliBovelornAhodgsonAglandularBingAcaledoniaAbatuAannulAwell-plannedAughhAswindonBushmaA's-landApsychoactiveBlantainsBarsAmajAhawaiAglowyBarcelleAfrzBanaticismAdemoralizingAcorlissAbenniganAautonomicAyakkoAwaterloggedAuprisingsAtaitAswanseaBteamrollerBniffleArudnickAquirkeAnordbergAkinkoAjuhuBordanaAgumbyBrecianAfblAenhancerAdiscussesAconsecutivelyBard-carryingAblitheBhartiBasilicaCrneysAabstractionAthen.AshortfallCikokuBanniangAprocrastinatingBlyingBincusAkiyomoriBawashimaAjoon-binAinhabitsAfrmAelectrostaticAdeputizeAcleonDan-shavenBhernovAbackstabberAarriettyA1228AxxAuntaintedAtbdAsurfboardsBplintsAricardBeiterApreeminentBermanenceBanesAovershadowAluminolAillusoryAfinanCggyAeretriaAdipshitsBeploymentsAcrisprBonveyanceCmpetesAbulgariansBassinetCffleAar-15BngkorBk-47sAwife-AvaleskaAthese-Asuper-coolApritamAmesdamesAloggersCdiAkordAhingedAguardrailBrammAfontainebleauAexterminatorsAdisorderedAcausalAbtobAa.p.b.A100mAvibratoAtollerBivoliCnerBacitAserendipityArunkleBhodesiaBemote-controlledApumphreyAoverriddenAnidAmysoreBlleBagisterAlong-leggedAjunpeiAhadoAfifty-threeCcusAexcruciatinglyAdisrobeAco-operativeAblackbloodsAavantiBndalusiaBgahBftonAventilatedBasudevAtequilasAstratosBharpensAringedCmaBedundanciesAoxnardAnuttersAmastermindsAlojackAkhyberAhamaAgrandlyAencompassBmpathicAdenominationsBaffodilAcronusBompriseBamelliaAbigamistAapaBlarminglyBgitatingAwindomAvovaAteiAseo-jinBayedAraspsDAparadoxesAopposableAl`dAkorvoAineptitudeAhiltsBephaistionBalf-and-halfAfoamyBahadAdessieAcucarachaBasbahAbrunsonCisBedfellowsCamenAwildmanBhalenAuntalentedAtingsBhrillersBengoApre-nupAmurasakiAjae-minAindividualismAhighsmithAgallipoliAcontraCldwaterBentredBatalogingAadriánAyingqiAwhealAvodkasAshilpaBeeyouBackerCbanArodriguesAplaintiveAnimaBameplateAmorriganBashallahAkrissiBohinoorAjerkoffAhisashiBerewithAculminatedBobbledAbootstrapsCdnarBeerusBalineseCguettesDramAassaneBnti-gravityAunasAstussyBourcingBilaBhowboatCanxiBcooby-dooby-dooAreinstatingBatatouilleAphoebusAmachiAlafiteAirrespectiveAfaruqAcristóbalBhulakCaracterizationAbenihanaAyeoningAundiagnosedAtuffnutBatsuhikoAstylingsBpaceyBafetiesAringmasterApainlesslyAofficiantAmarquesaAlondonersBeukaemiaAkassyAhibbertBerdersBafsaAencrustedAbreathalyzerBlood-soakedBaedalAacaciaAwotanAunregulatedAtwikiBulkinghornAseyranBéApvt.BrudishAoddityAncoBavigatedAlock-inBiquefyAkeepsakesAj.l.AironiesBllyaCiaAhearedAgemaAfosseBerragamoAedgewiseAdixielandBefusingCepeningAcompensationsBhaleAazimAzangAvoltBishwasAtokioBaillightsAsuffragetteBhrinkageBcuttledCalpingBarAraglanApiafBerishableAmimicryCcrocosmAkoeAhara-kiriAgalvanAfast-trackedAdead-onAcouricAbrandiesBabakAayahA12-inchAvijiAstonersBhantaBeacrestAroxburyBenãCdcoatsCcitesAnealeAmouldyAjochenBin-youngAinterpretersBccAfaçadeAehrlichAdotcomCbbinsBeconstructedBammedAcomsAassalamuBmplifiesBcolyteCcumulatesA1871AvandenbergAuselesslyBncharacteristicAtezukaBaaniAsearleAomnipresentAnaikAmisreadingAkaewAjoinerAhidakaBeideggerAeleonoraA'elAdeceptionsAcomeyBlampingAbronnBluishAaltimeterAy-yourBoshikawaAwhoa-whoa-whoaBeltsAoutmatchedBoh-hoo-hooB.kBffshootAmeditatedAladybirdAkieshaAgangplankAeudoraAducatiBodgsonBatsunAcaityAbright-eyedAandrettiAtucaBecumsehBaisAsnipesBhinersBchumerAoutweighedAmantuaAlutonBappedAkaminoAjarekAgustaAfraternitiesAestoAdeuteronomyCforestationBamarClalAcrohnBleganeBhippendalesBayleeDetanaCtapultedAbelafonteAximenAvamsiAunnaturallyAtrawlAstabbingsBpray-paintedCitterBeatonBcummyAruntsApreparednessBasser-byAoutranksAnewberryCcatiBavigatorsAmiddlingBcnabBartínezAlanierAketchumAiteAdressyBoucheyCersBartboardAbrodskyCeast-feedBlackgateBitchedBakeriesAadventuringAwhuppingAtashiroAsoyaBmithfieldBimpaticoArewindsAprosaicBortfoliosAoldsmobileAnumberingAmuraiBenacinglyAlumiereAkristieAjindalAimmaturityAgroomsmenAdimmingAcycledAbreathlesslyAaspersionsBmalfiBckerAyeoguAvezAtepeAsmidgenAneo-naziCglectsAmephistoBagillaAlouellaAidea-AhamperedAfhlostonBainterAdilettanteBeadlockedAcarpaccioAb-plusBeep-beepBasterA252AtinsdaleAshempBepulvedaArestartingApuncherBasséCrasAnudgingAmucousAlayupAgentilesCilsAdookieAconfederationCmplementsAarkenstoneAyohBaiAwell-preservedAtroubieAstravinskyBide-effectsApull-upsBredominantEnisoneAoptimizeAnoguchiBegAmullahBansoorDipulationsDhandledAlanguishAkiriyamaAjaidaAintAhubbellAfresheningBloeAeun-youngAdomyojiAcounterbalanceAbowtieBighornBankrollingAτhereAunbelieversBlAtsoAsynthsBuneBilverbackBeon-hoBayeonCverioAramessesApremieredBaralyzesAmonkfishBisstepsAlearnersAjyothiAhippolytaBeraldsClpingsAfellingAdribblesBewyAassessorBlley-oopAyoung-heeAwintergreenAtorukBheisCattaboyBannaAskitsAroustA'rightArhoApredilectionAneedfulAmasudaAkjartanAilariaAhemsworthAgrandpasAfreneticDeloadingAe-i-e-i-oAcloudlessCambakeBabledA990A65thA5.6A15-20AyamchaAwedsAvoltaAthird-generationBeary-eyedBakumaAstashesBprightlyBatedAridiculingBeveBaginiAnuñoAmuscledBongoloidBénageBaritaAlorieAimpeccablyAheyesAfaunAcuedBrackpotsBomelyAbrickerAarsedBbgBahhhA5-starAwuntchBorkhorseAtwosomeBuraAszechuanBhugBelf-confidentAromaniAperpetuatingBarbatClatesAoshaAnudgedBoshimuriCkiaAminecraftAeweBndemicAdownrangeAconformedBeaselesslyAblacksmithsBandraAyoungbloodBanisCminiAstuccoBkaaraBainthoodAranbirCkshaApridedBhinAlausanneAkuronumaBaliaAirishmenAhighgardenBermieAfloatinAevertAclaroBhuggaAblizzardsBathtubsAattainingBirbendingA50-yardA150,150AtikoAscabiesArohAprobativeBonyvilleBerimetersAnewfangledBaotoAmodellAj.w.AinkedAheadstonesAb-minusBevyClialA6-0AwogAvilifiedAthemistoklesAsuckaBignetBaravananArenanCbrandApykeBuckettBroppingDctologistAnunoBockB-notBigBawalAmulticulturalBcgonagallAlinguineAjeongyeonAinvocationAfirthAelvenAdiscriminatoryCnarAcrustaceanAboatyardBerberCltingCeneAassisiBnnasBblaA254B030A1860sAwinthorpeAunhygienicAtouchinCrviAsubsidizedBhinagawaBequoiaBafiyahApassersbyAoligarchCd-ageAneuterAmusculatureBcdanielAkhamAjeddakAhernánAdeuk-guAaboutyouAzambranoA‫youAweb-dlAsurveilledBecretary-generalApropositionedBastingAopen-heartAmunchesBoneysAjanjaAhorcruxAfinalisedAcrawlinBonfiguredBézanneAbunglingAygAxvAvassilyDhtiAuntyingAturnstileAsofBlothsBecretionAportwennAobitAnaanAmcfarlaneAk.p.BiboshAjanvierAinseminatedAhikmetBaydonAfizzlingAestelaBpithelialsAdungareesBevitoBaynaAcontrollableBhortlingBacaAbatraAzzAvayuAtuggBransactionalBallyhoAsuppositoryBlaytonBakinaAresolvesAmikuBangrovesAlive-actionAkazamiC-chingAhenriqueAgruellingBeolAdubenkoAcounterintuitiveAbuellBirdbrainAwell-documentedBalkoutAsalgadoAnibblerAmalkaChmoodAkoenBettlesAinferredAgesseritBaladrielAferrerAemmalinBditorialsAcarleyAbonitoBlowholeAanaesthesiaBmuckA86thA70,432A0000,0000,0000AvoidedAscrunchieArandomnessApoontangAoverreachAnaugatuckAmillikenBeerkatsBallickCchinistAliyaCviusAkrullBleinfeldAionosphereAhoonjaeAgaliciaAflattersAcockerelBampfiresAbindiyaBeaujolaisBasinsAaeneasA1882B0-20Ayo-kaiAweymouthAtuitionsB-dogAstandingsBhintoAresplendentCloadedApreventableBoochieAoyamaAmenstruatingAlottBibationAhypotenuseAbreakageBolanBetadineBablooA1549AvalenAunleadedAtrainorAsorowitschArightingApunjabisBamplonaAofâAnogalesAmyrcellaAkomarovBirschAjypBhonBambaCbberwockyAinfeldAhazlittAemphasiseAdanoAcrossbowsBataAburbageBockBehavioursAaelleA90-year-oldAtsubasaAsure-fireBkeksisApederAmuggyAgrassedAfjordsAex-fiancéBlectrolyteCainaAdistillationBaughters-in-lawAchesneyAbeshteCnsonhurstBad-mouthA1870sAyuzhangBo-hoAvijayaAtenementsAsweet-talkingBprawlBoutheasternBhowcasingAredefinedApuritanicalBorteCpulistBenderAmujinjuBirabelleAiscariotBnconveniencesAgulluAersAdominosAcross-examinedBallisterAbird-watchingAa-twoBrmaanCashBntioxidantsA356AwormyAvicapAthree-AsteppesBhanghaiedArobboApocketknifeAmusesAlafleurAharkinsAgoku-sanAfriggBattiesAeckhardtAchoirboyBavortingAbondiBeragonBallplayersAasgerBproposBolBfoulA8,500A4-3AwennerströmBanna-AvonnegutAumpAtopsoilAsymphoniesBlo-moAquarter-mileAmanyaAlibertadAkleptomaniacAfurioAestãAdeandraDf-muteAcampariAboganAamputeeBh.A427AtaxmanAshipmateApatchouliAmalverdeAlanguishingAinalienableAhelmsleyAd1AcornucopiaCnnotationAbeckonedAacsA1,250AwatercressAtharnBaperedAscrewdriversApsrBrophylacticBawningCckyAoverstatedAgodavariBarridoAfã¼hrerAeugenBrectusAdoofenshmirtzBisillusionBíazBemoteAbefriendingAyou`llAwalgreensAvillefortArecognisableBapierApancreatitisAnpcBewgateBasryAmarstenAhotwireAflittingCangeAexhaustsBlisAbunchedBleeckerBarthAaromasB.l.i.e.AworthinessAtrenwithCampingAswooningBtiffenBpeckledApigalleAmilksBarcinAjivingAishtarAhuh-huhAfour-inchCrward-thinkingBlnB-AdeliverymanAcrisscrossBlotildeBheonbugwanAblackballedBahamaAzaiusAwobblesAvoice-activatedBandergelderAunimpeachableAtaguchiAswankBquiresBelf-medicatingCahawksBcorcherBarsaparillaAradiatedApyareBorschesAnovgorodAmoochingAlyellAkamelAjuntaAignobleAhatakeAfantineAelinaAamplyAsindyBhriverCawarmaDbbosBelf-discoveryBatyrArubesBémyApresetB-pleaseAoverpopulationBbjectorAnarcolepsyAlimerickAin-haBliadAfifty-sixAequineAdisbelieveAchideBasserolesAbroiledBaseballsAalaykumBd-libAziplocAyutoBingzhouAtanglingAsmugglesBhariaArustlerBawiCmanaAokaforAmurtasimBonogramAjorgenAimmodestAhuntsmenBollerinAgoldblumAecAd.u.i.BefensibleAanabelleBgustinAzilongAvaultingAtumultCbularAswabbingBtylistsBneeringBikandarBextantAreformersAmabAlkeAjin-juBeppeAhabituallyAfragmentationBive-timeAenglish-speakingAdiscosBemolitionsAcurtinBoleridgeBlansmenAboylanCundedAanchoringAyoullAwraithsAsumpBpurtsBituationalBhihoBchönBainzArootinBemember-AquipsApayoutsCin-in-the-assAmittenBattinglyAlinzAkierkegaardBasiusAjebediahAightAhousebrokenCneypotBidekoBeapingBairnetAflashpointAedorasAdisembarkedAcapiAantidotesCcA1894AаndAyi-jinAvasiliusAtimboAstabilizesBpinozaBhondaBcrutinizeBareesAradarsApgeAnazimAmummaBom-and-popAleckieAkeyshawnAjürgenAhyperventilateBispanicsAgüntherAfinkleAcarnivalsAbrophyBowlersA38-year-oldAtezAstrikeoutBpigotBollowayApre-gameBornographerAobservableAmordenBcdonaldsAlustsBodgersBamentedAitwasAghaniAfrogmanBontsAeurasiaAdariAcounselsC-optedBhafeAbulbulCdgetedBrackAadriaA444AyoutuberAwarpsAupwindAthwackAslow-movingBendoffCbringAruttingBeprobateCgressedAprecipitateBilcherBhotonicBeronAordinancesBikoAno-accountAmilsBaracasAjuhiBattAhiaAfootagesBerdieAcalabreseAbookmakingAanaphylaxisA1891AxiaoxiAwoo-hyeolAtanneryAskeltonAperegrinAmidoAk-martAjammersAit.iB-i-AhordakAfootsieAeshaAcarmellaAayşeBppendagesBndriBmabellaBesopBbdicatedAyukihiraBağızAwarcraftAtarnAsumidaBharkyAroxtonBegaleApuyoBower-upAmorgenBarsaliAlemongrassAji-aAgοingB-spotBoodsonBhostfaceBabsAfrocksAdalesAcuchilloBrudelyAantoneA1883AtumnusBryonAstrikinglyBcrewinBabersArevulsionCgistrationsAp.oBlatzAout-of-dateAnehemiahAmeimeiCaganAlow-techAkraangAholleyAguessinAfull-sizedAdrizzlingBourAcrozierBattlemenCpitánB1AbenedictionAarkadinAzappaAwestfieldAtrayvonBelemarketerBaosCigaAsuturingCppressesBlicerBabAravAovertonesBffbeatAmugwortAliberatorsBanciaAinopportuneCbreedingAgermanicusBangneungAformulatingAexclalmlngAdecoratorsAcindersBhucksAby-Bed-stuyBassistAashishBll-girlsAyoulAwirBeltonBaxyAviluAtulaneBicketedArumbledBoneApetuniasAmonaghanBiddlesexAlflAkanhaiyaAhyeongkyuBongdaeBarpoonsAfingermarksAcuriositiesBonvictingDservingAbrimmerAaftereffectsAzoologyBeinaAyouzhouAwilkAtwiggyBurntBiiiAproponentBostgraduateBenfoldBarteAopulenceAmohsenBinwooDajAhathorClf-inchAfrighteninglyBisheriesAenshrinedAcharingAburkhartBowserBerniniAairliftedBcetateA702AyunfanAviteA'uldsAtrawlingBasselAserfBchlongBarpAreviledAprize-winningAkramdenAgrappaAfilmwaysBalmouthAevacuationsAcut-outBontrastingAb.d.BandaAagniAsuccinctBneedBlow-wittedBhallotAriverrunAprintoutsAoutlandsAnormalizeBakulAmutagenAjiriAguffawsBretchDat-great-greatAfrenchiesBine-tuningAdeakinsAclip-onAbandoAtusAskBhortlistBamboArealyApramodAmontevideoBaraudingAkahloAjoylessAhostelsCnest-to-godBigh-fivingBandrailAengravingsAdrawn-outDgonballsBarceyAcirculatesBhrystalBasimirAayesAuncoversAsujataBambongArubdownBobocarAprovoloneBomegranatesBigmentationBarentageAnicenessBarnsAmasashiB3ganAkindledBemblefordBatelynAhydrocarbonsBouseguestsCneydewAgreengrocerBlutinousAfussedAcriticizesBhronicallyAbilaterallyBathshebaAalphabetsA511A1sAwindhamCggumAvitaleArheeAmoncadaAlittlefieldAhulloBolosuiteAfulhamCckableBrizzleAcruddyCeasedBongenialityBairnsAbranchedBest-knownA361AsufficedCbberBobbedApatrashAnievesAmattiasCpplethorpeCengAkaylynAitadakimasuBnter-dimensionalAhikoBendonBarmonicsAgustafBrossieAfettuccineAdeshawnCnbyBan-danAyokiAweirdingAtsuyoshiBachyonsAsuccumbingBohokuBeahawkBcutChillingerApatchyCppiAmorselsBanã­nAkirkwoodAgynAfermiAduntschAcongestiveAbapAanglicanA513A267Asmall-scaleBhapelessBcrumArausApendantsAoceaniaA-noAmyerAlapidusAischemicBntrospectionAemphasizingAdubrovnikBeerfieldAcrokerAbiminiAanalogiesBll-pointsBimesAyrsBoukoAtwofoldBeresiBalktoAsinkholesBhiftersAringlingAout-of-the-wayAnightshirtAminimiseCdgardAlumpedBisten.AkrendlerAjihanBam-packedAhairstylistAgarçonAfollicleAdormammuAchanchalBaenAbloodlettingAassignsA34-year-oldAwilmotBhitcombBaterboardingAvandalizingCmooseAuploadsBnpredictabilityAtepeeCmerityAspuriousBoothedBalvaArohiniBavagingAquirtApumpernickelAoutsourcedAnichollsAmirrenBargAlyudaAkkukBimonosAjollaAiqiyiAheaviesAgauthierAfrustratesAeradicatingAclopBarpentierAbridieBelfortAylgazAvukAtormentorBaggertAsubcultureBalespeopleAmurchBokeyBilvertonAkhaAi-95AfinnyAdumbbellsBiffusedBekuAculperBhronologyAbulbousBarristersA271AwithstandingAuggaAtemujinCesBarpsCp-dancingAsubxpacioBchmoozingAreadableAquaaludesAoliveiraAnermalAkick-startAhumiliationsBeavyweightsAeauAdreiBepositorsAcyanoticAyo-hanAxiaoyouAwaeAtimetablesBhatchAsubroutinesBplashyBnuggledBhikishimaCarptonBafecrackerAramayanaAprotagonistsAoohhAmidsectionAloachAinstinctualBlyichAhuffyBolierBerbivoreCbronAfutariAeun-suhBldritchAcheck-upsB2AbongsunBlakeyAàìA825AwomanizingAvanderAsupersedesAringersBevvitBawdonApsilocybinAnsB-oBiluferCcaraguanAminimizingCkloBan-hoCinsailAlincolnshireAkeggerAj.k.AiitAhillcrestAgallyAfunnestBistulaBelderBalsehoodsAearthboundAdaigunderAcawdorCssianAbunniculaBoogie-woogieBieglerAaracyBnglerA737Awhoo-whoo-whooBeek-longCavedAsundariBasiAprettiesAnumbedBachtAmolluskBishkaBexBatthieuAjaggaAhumdingerAgungaBrunwaldAfaustinoAdespairingAcleitusAbradmanAandoriansBjusshiA360-degreeAunscientificCassailableAthingamajigAsubhumanBorensenCo-youngAprofitabilityBimpinAmathuraClmöAkrellBillaAj.m.AflasksAevaporationAda-da-da-daAchurnsAbrothers-in-lawBilbaoBackstrokeAalamutBdmiralsA2025AtruxBabletopAstanislavBedgewickAplayboysBeeweeBarachutingAoff.AnewlandAmurmanskBaximoCroneyAlaparotomyAkanpurAinchingAhuluBoppinBerniatedAgardeniasAerdoganAdwindleBisbandingAcolor-codedBachesAbruleeBenidormAaardvarkAyoung-jaeBeopAwalk-upAsewellArosariaBizwanAmatch-upCdcapCchiavellianAlnternetBittlerAkaminskiAitinerantBmplodingAhollowsBackensackAgottmikAflineBixingsAexoBnsnareAdharamdasAcuisinesBonservativelyCmmingBassavaAavionicsBnecdotalA421Awell-spokenAtheodorBenthsAsubeteBmythBloopBentoxAprompterBadlockedAop-edAno-nonsenseAmuskratBizuhoClitarilyBewlingAlolliesAiconographyAhamanCllaAgoproBaoyangAfairleyAecclesiasticalAcombustBheetaraEsesteakAbegbieBathwaterA100-footAzidaneAsvalbardBivajiBhockwavesCarknadoAo-2AmcdonoughCarthurAj.f.AindigentAfifty-oneBatahAexsanguinationAdagurAconjuresAbjurmanAyoheiAweightlessnessAsurveyorsBhaynaBeongjaeAricklesBeschedulingCparationCiserA'pennyAnetballAmorroBedlabBakeupsAliltingBanzmannAi.a.d.AhunhBellosBastenedAfavoreAdowngradeBiscourteousAconsultancyBliffhangerAbeguileAaddledBbuzzA3.30AvildanBeritasAthinnedAsrideviBpendinBippedBegerBauvignonB0ArespondentCmigioAplateletAmulattoBcintoshAkameAjob-AhuikeAfatwaAeveyoneBconChizenAdeshmukhBarmodyAc.yellowBhiidrenAbreakableAastrosBlixAzurgAwolverinesAsurface-to-airBlagsArevoltsCsettlementApavementsAmarielleAloicAhigh-spiritedBarshnessAgeenaAcostarCngoleseBlairvoyanceBappingAbicAauctioneeringBgo-AwoodlandsAtouch-and-goAsoeBmootBenzoDgokuApenileAosawaAmaroAlcdBakeshoreAenyaAdunhillCchampBodgesCbeBeftDrostedAcummingBatrionaDfishedAbuffetsBosemanAattheBsadBlicjaBinaAzingerAwertherBaldemarAvitusAunimaginativeAtuscaloosaBomieBhwacksBenguBayaAspasskyBidewinderBearchlightsBalaAotaniAkingshipAjagaAinterpretsAholdoutBelensBappC-ha-ha-ha-haAglebBamestopAdelaineAbdsmA200-poundA1.000AtallmadgeCe-heeAslapperBalieriCbianApassivelyAone-year-oldAmccartyAluschekAjesuAincarnationsAguinanAfamily-AderriereAcostiganCndonBamptownAam.AtourneyCggleAsure-ArewiringCcheckedAquadriplegicBingmuApetrovicAnickersonAmini-meClderCkawaBcafeeAlozanoAjumped-upAhermaphroditeAgoraAforensicallyBainAemilienAdintCeyiBegaAcriterionBonfidencesCmptrollerBhettaAbiriyaniAagnèsA3cha5acb4A1cha5acb4AwhiskingAvocalistsAtentativelyAstoopingCep-dadBervicemanAryaApreparatoryAoktoberfestBb-gynAnoeBazarAlayoffCngtonAkripkeAjefAhotshotsCrikBard-wonAfloatyBeastedAemanatesBhhhAdupreAchandranC000000BantankerousAblackfaceBeataBallonAargonCakiBndersonsA1884AyardstickAwearableAsuperstructureBmackersAorchestrationAnodulesBaysayersAmi-jinCdshipmanBaelstromAkotetsuAinterlockingCstallsAhitchensAgengarAelissaBclipsoAcleaninBhengduBascaAbussesBlenheimBerenCefcakeBanfieldAarangA6.2A435A3chffffffAyamiAwholesalersAunsinkableAtwo-shoesAspinksDcinessBkrullBharkbaitAroystonApostmarkedBlucksAoverchargedAno-nameAmoney-makingBaykoAlyttonBoyalistAkyoheiBirkpatrickAjacobiteAismetBridiumAhermosaAfurnishingAeighty-sixAdarkensCnnAcassellAboltingBiatchAasumanAzaoAvalentinesAuddersArinsingApocoBinterestBeeperBawełAnibsAjoyridingAhothouseBailstoneAg0AfreezinAduty-boundBarciAbhishmaAallayBccommodatedDlimatedA2,000,000AwelterweightAunravelsCdeservedAtilleyBhoughtlesslyBereseBakayukiAsearchinBaxonyAraisonAquangAparadineAmuggleAinnesAgaslightingAfortificationAdongjuBemocraciesBamuAcrinkleBheliosAboutiquesBloatingAannihilatingA328AveneratedAunimaginablyAtokitaBelegraphedAsoo-hoCmervilleBmartnessBangramAprime-timeAmouriBetooAledbetterAdjingAbowlineBlemishesAahoAzosiaAyoung-wooAvcrsAtineBhickenedAsummarilyBolariumA‐soAshe-devilBchizoBaunièreAronjaCller-skatingApentecostCmberleyAmodulatorBissisAlamentableAknock-outAinterpretiveCefficiencyAhuguetteCbcapBornigoldAfactoringAenhancersAdu-sikActoBhampionedAbungholeBrigandAaamirA331AzanuckAyamashiroAwhere-whereAuh-uh-uh-uhAtuskegeeBrachBkoBaikoAsupersCnbeamBterilityBprayerBitiAribbingAprimetimeAnon-threateningAmagicsAlgB.c.AkawalskyAhiggyAfordsAceaselessAbed-and-breakfastBajiAandaBmieBguileraA12,432AwittenAtake-homeAsupposesCellenBtathamBqueezyBkulkBandbarCbraAruriApectoralAnaengmyeonAloiAkarynAhumanistAgopBaboAfour-manAdewarCrenAcromBobblestoneB.m.BashiersAblursCankaAandreyevichBbsalomA1980-somethingA0kayAwoman-AsunnyvaleBteinbrennerArianneBejectionsAplanetoidAnephilimAmincingCcrogramsAlanglyAjingqiuBeannineAincorporationBll-temperedAhard-nosedAgendarmerieAfrescoesBitzsimmonsAendowAduraAcreechAbreastfedBoomhauerAaibileenBdverselyAzoharAviscontiAtwo-seaterBeletypeAsheepskinBergeyevichAroseannaBitsuCffingApounderCssiblesCrtofinoAone-and-a-halfAminimallyAlanyardAjuulAinhibitionAheraclesAezelAdoriaAcatamaranAballinAankerBmplitudeBilesBbnegationA64,000A1850sAtemptsAsilvanoAre-readClaxantApreceptsCadhanAjun-yeongBankyAindeterminateAhome-BeloiseA‐heAgumdropsBisAcourtroomsBalienteAbraggartBndAarmbandsAwuornosBhitemanBastelandsAspiritualistAqui-gonApre-schoolBarsifalAlvyAkoontzCmAjotaroCsefineClinarBananAiphonesAhelmerBammocksAgaspedAfondledBarneseAetchingsAdushaneBisreputeBécorBealershipsAcortesAburkettBeachfrontAall-inclusiveA169AtrolleysBhinsAsilverstoneArookerBecliningBavedApiqueBertAmonotoneAlucillaAkbBarnAimpressivelyAginnCganteAever-lovingAdivulgedAcressidaBataloguingAbocheAanemoneBbsolutesCductorsBadhiA.380AweevilsAunpardonableAschrodingerAreinhartAneathAmontelBishandledAlotsoAjung-minAgyeongseongAfrouBederallyAexculpatoryDlamationsCacerbateBrogenousBlse-AdavianCchaAandronicusBdaptabilityBcheronAwormedBesternerBarblerAundeclaredAstrindbergCianBimperingApitifullyCmpernelAopahAmurdaBisprintCni-martAlifterBemuelAispBcacAhockedBighwaymanBee-kwanBaemorrhagingAfizzledCnbarBerranAechollsAcounterofferAamoryAyunshenAtooleyAslsBhikhaAroyaBeamDlestApaengAmisfiredCnefieldsAkyeong-rimBerstinAítAheyliaAgreylockAfour-wayBlybyBinaliseAcalabasasAbullittBig-heartedAadanaA5.2AzonkedAwhattaBell-groomedBaftAvoulez-vousAtsuruBhemysciraAswaggeringBportsmenA'souzaAprosecutorialBinksAodditiesAnightdressBaldoAmabuseAlogginsAkelsieAjunebugAhunkeredBalf-manAgoredCjiraCbshiteAfinnickAcopleyBatfightAbompBassanioAabraxasCdurrahmanA506AzulusAyentlAwhiskiesAsondheimBcholasticBamiaArabenAorbisonAnookieBeighbourhoodsBataAmilieuBangeAjhBaggeryAhildegardCgh-voltageAgroovinBaniAforsythBiddledAéseAelopementAdeploreAc.i.d.BhiragAbrighteningBeadleAa-allA335AyoohooAwpcAunescoAterranovaA'tchaAstrozziBoo-ahArovBeverentCamedApoulBardoAminnickBembershipsAlippyAinsofarAfrοmAexasperatingAdoctoreA'd-iAcullodenBorrectsCntrerasAblack-tieBiosphereAanibalBhoraA610AwhovilleAvolkAunwillingnessAthanatosBejadaAsoilingBasaArefitCcurrentAquiltingApondicherryBatootieAnοwAhocksAglaredBet-out-of-jail-freeAfiedlerAellcrysAdmcAbravingBorrowerAaway.BitorCrbrushBccruedA5.000A297A188Ayeah-yeahAwrackingAueoAswintonCaddlingBkeffingtonBelf-appointedBcorecardAricketsApragmatistBippoAm-maybeBituAkaiguAjaffarAeun-haAdilemmasCd-didAcorazonCde-namedBhalicesAare.BllfatherA630AwhiteningAtuggedAstephanoBocoBeñoresAroopaBazzle-dazzleAnirrtiBandhiniAmurderfaceBorningsideBillarAjimmiedBaundicedAhyperbaricBelplineAfanboyAeirikAdrynessAchoudharyBarnabyAblowupCasBankrolledA98.6A352A263AyouselfAwombatAsubbedBhreeAroveApanisseAon-rampAmi-hoAhobbledBandsomerAgunplayAdetestsAbinaBahadirCchmannAattractivenessBssafBromatherapyB.b.A272AwikiBarbucksAvenalAthree-ringBell-allAsumãCárezBtokelyBportacusBouthernerBanitizeArebrandingAquelleApre-emptiveBhnomBedophiliaBaddledAmorguesBeatlugAkitamiAjunkerAiovineAhypnotherapyAemaciatedAdredBisinheritCnosBesecratingAcommensurateBhieftainsAblisteredBake-offA20.000AwussyAuweAsutrasBetonClvamBandedArivkinBabApropositionsAobstetricsAmaturesAlorrieBickinBa-la-la-la-laAgizzardsAfrontlinesBerreiraCasibilityAdwindledBachengActhulhuA23.976Atrue.BeutonicAshiloBearchlightArialtoBecuperationApungBenitenceA'notAlook-outAkremeAjihadistAishigamiAgbBatchamanAenvelopsAdefilingAc-minusAbodiBandleaderAyilanAvetoedAuralsBppsalaAtwinkBenancyClephotoArieslingBepulseApreeningBollutantsAnooooooAlegbaBcAingratiateCfiltratorsBmploredAgolionBayerAfunfairBiruzeAemotiveAdoubtersBisrespectfullyAcuernoBrusadingBarvelAbottomedAalastorA37,000Ayee-hahAwenjingAunidentifiableAtullBrudgingBoolingAsoranBlaughtersBimianArepatriationApopulousClsonBermissionsAovertiredAnoronBetworkedAmontpellierBetricsCmoruAkaninAhouse-sittingBigh-heeledAguildsBelsAdemeanourBaesungAconvergedBhan-youngBallasAbakaAaigA99thA601A3.9A253AutteranceAtroelsBhomasonAstephieBophomoresArojaBe-routeCcountedBamanujanApretoriaBost-apocalypticAnitsAmyoungBoonbeamBegamindBaderoAlyorBinimentAjsocBoséphineAittyBnconveniencingBllegibleAhoardedBayloftAgcAfundamentalistsAd.c.i.AcruisedBonstitutionallyCmpadresBicekBhelmsfordDetoBenturies-oldEimetreAburhanBlasphemerAayngaranButhenticallyBlternatesBboundsA1887A먹는게낙AwakeupAulrikeAtradecraftAsinewArivkaAojoAmunchkinsAlankanAhabAewoksBstefanAcatrinaAburdeningBromideCinkmanAarzuCnsBlstonBfonsoA470AwalpoleAunlearnAtheloniousBenerifeClescopicAstoppageBeverinAroughshodAmrphBelchiorBapesAlinkletterBazerAismayAhillsboroughAfogelAdafnaAcodersAbenjaminsAatelierBrchedBncillaryBdoptionsAwarm-upsAtruckinBooleAsierrasAprescribesBfffAoxleyBverdramaticAmyopicAjokesterAipkissBnformationalBandAhyejinBumanitiesBinAglyphBatwickB8AfennAdolingAcoedsBhevelleAbridgingAanthropologistsA712A45-minuteA1.0AtempusAsub-basementBhinzaemonAoverstatementBrificesAmullinBorning-afterBenloBaybourneCthayusCnitobaAlapelsAknitsBingoBelsBaramAhitchesAduplicationBiogoAcolumbianAbrinyAalesA20000AyorkieBajimaAwinn-dixieAsupervisoryA.srtAshimazakiBeditiousB.a.r.a.h.ApolecatCiAonslowAlysaAgastritisCmbyAetruscanBspoBngorgedCdeavoursAdongsBamianoAbotherinBatedAagustinaBdjunctAwordyAunclogAtraversedBodosAstarchedBpearheadingBherwinBaavikArepastApilkingtonCkesAnanakoAlubricationBiverwurstBate-modelAkandinskyAizumoAgriggAfeckinAeighth-gradeAdruggistBaddaAchiyokoCantillyAberylliumAalsaceA580AzikaAwhereofAsqBigniorArenateAmoyerBegatonsAkunoAimplantingAgardAfearlessnessBazedCllowAescalatorsBmbarassedBkAcottonmouthAbasketballsCrettaAaverillBrrowheadsA7.2A336AwoodbridgeAvouchingAsomethBduBaracensAritzyBaãApinupAmoisturizeAlugsBangloisAkrebbsBhufuBawaharaAfabianaAeartherAclowAbeldingAwill.Avery-Atwo-dollarBomitaApathologistsAneedhamBaimAmukBontparnasseBachismoAloyolaCck-downAknavesAjuneauBarrahCcobsenAheitorAguilt-freeBoo-gooCncaAemrysBlricAdisembowelAcombosBhangeoverAbryCoke-assBoormanBasuA‐allA6-footAwaivingAviktoriaAtaskforceArecessedAplay-actingBiãBgaBarochialAoverstateAmisusingAletaAknee-highBaydenAgmosAdóndeAchestertonAborlandBeldenAazoresAworkaroundAstand-offAponytailsAorchestrasBdometerAmicrotsBedium-rareAlordeAjynAfabriAexudesBpilogueBnsenadaAdisintegratesAcubedB.p.r.AadheringAvampirismCiAunwinnableAtalk-AshogoArouxBelinquishedAplacementsAordellBne-linersBlympiansAmilkmaidAlie-downBandscaperAkingaBataAjatinAinextricablyAhrsAfandomAdoctrinesBec.AcahideAbig-screenBedbugBalajiAaspiresBircraftsAwadiAvoilãBaultedAundersteerAtypesettingBhumbingAstoreyArunyonAplathBictorialBerceivingAondemandkoreaAno-o-oBecktiesAmosswoodBentheBanhandleAlugeBnsteadBeanerAi.o.u.Ahigh-velocityAgeraniumsBanpatClactusAfull-bloodedBeinsteinAetchAdefraudingBaryAcuseBonquistadorsBhiricahuaAbroilerBitersAaugurBdalineA90thAshinpeiAredondoApırılBièceBericlesBaquitoAminderBanassasAloutsBame-oAizmirAheredityAgumshoeAfaroAeighteenthAdreymanAchauffeursBallistaAbrideyBlur3AatollA718A515B0-mileAwhalerAvandalizeAunproductiveAtigrisBhrobsApagetAoverhangEconfidenceAnriAmillwoodAiwanBndignitiesCcisorAgalvatronAfunnelsBorecastingAdorrieAcyclicalBhihuaAboneyardAambuA0-60AυeahAwtfBell-establishedCightliftingAvardenAunfunnyAtop-tierBakamuraAsteinbeckBeojinBang-miAnihAkoyamaAfiduciaryAdeepikaAccuAbomburAabinAwhinedAtranswarpBhingieBertiaryAstylizedBeowonArathboneApreambleBermutationsBarraAokamotoAkitaiAizukuBncanAgüeroBrimaceBhanshyamAfiaAdisturbinglyAconfiscationAbletchleyBegleyBagchiAashyBrnavBmmarBldaBeronauticsBcupuncturistA189AyeongjuAvenableAtitillatingAscrunchBatanismArealtorsAmiwakoBamo-chanAloverboyAintimatedAhegelAguthredBlycolAcustodiansBortexiphanAboondocksAayumuBdvicesA1.75AyanzhiAtrivediBomãBeresitaCmAsyhanArefsCdistributeApretendersBenultimateCeredAneiAlaughlngAkrycekAhaanAgorgonzolaCong-bokBlobetrottersAekimAduckburgBaughertyAcrasherBollabBatchphrasesCrdenasAayaneBvonleaButolycusCbergineAumberAtypefaceBortelliniAsweatshirtsBhe-wolfBcrapperArishabhCri13BajkumarApigskinBfeiferBeuAoherAnumataBighthawkBeutralizesAmigrationsAlaitCboriousAjulianoBinxyAinsulatingBll-equippedAhonoriaAgoyBeldingAfarazAetomidateAdavutAclosinCericsBhillerCainsawsBannolisAbobbleheadBaumanAabolitionistAwarm-bloodedAvamanosAunluckiestAsugiBimulatesAqingzhouApreservativeBeculiaritiesBarallaxAnorthsideAmittalCnd-numbingBccraeBanganeseAlickety-splitAhomerunAdictionariesAcanoodlingAblowersBirBeastmasterAanishaBlgeriansA72-hourAx-rayedAunfortunatesAthree-mileBeleborianBaggerAsummaBocioeconomicArancorApudBinholeAoprAnorthamptonAmuffetAlimpedBatchingAkaifengAinsensitivityBmpairBdentAhoarselyAgeopoliticalBamboaAdreadnoughtBoonAcorningBeausescuAbiasesAaveragedA41stA2,100AwinnetouAvilliersAtumoursBotenkopfBhawsAstudebakerArelishedAperkedAneutralisedAmorbidlyCdifierBarinersAlexcorpCechingAkurskBernsAjunichiAhürremAgutenbergBravimetricAdefacingAcondonedA'ciockAchlorophyllAbreadedBilfranAabagailAyaaahAwoodfordBell-litAsun-youngBtrategizingBinglehandedlyAremotesAquickenAperillaAmercurialAleviedAkovarAjuviaAidolizesAhermeticallyCavysetBarpsAfurballBeyzaAclimesBaptivateCnnulaAbuffedBanaAarmor-piercingBcetyleneBbberlineA200kAzoilaAwhitesideBelliesAvondaBivaanAurcaAtriple-aB.r.Bie-inAstraplessBhotaroBaccoApoitiersAnitty-grittyAmodularAluneBiveseyAiudAglazerBastrointestinalAfuck-BeloniousAeight-ballAcsisBhangfengAbrevityAasylumsBffirmedA45-degreeA3.0A261A18-wheelerAwaterhouseAuninsuredAsempleClf-relianceBanosukeArevertsAnanuAmoolahBahamAjiuyiAheavesBashtagsAfine-assCddlyAdoobiAconnectiveBar-AbluntsBetelgeuseCaulieuA604A258AwynneB-whoBhitehouseAspenglerBekouBchmitzAricheAotakuAnietzscheansAmontalbanoCisturizingBaximizingCkikoAlumberghAkenoAjinxiaBainAindustrializedAhargraveAfukoBirelightBarkleB-16AdramatizeBeep-rootedAcucoBhhotuBentipedesAarpiBdolpheA469B42A19-2AtownesBatsumiAsundaramBtaggersBchafferBarooArigorsApenneAmunseyBrisBouldsCthefruckerBeanâAlove-hateAindulgencesAhumpbacksBooahAgerritBaaraAfinchleyAeverythinBhsanB.d.AdumperBouble-crosserBispelledBefensivelyAcryerCipBhangleBelestiaAbravestoneBeratingA20kA1859AzlatanAumpteenthAtriplesBacsAstressorCorekeeperBhiitakeApull-outAobscuringAmayneCcnamaraAlowlandsAkakuAjae-huiAitisAh-helloCbombBankeyDd-paintedAduckieBrug-inducedAclutteringAboardinghouseAasumaCsemblywomanDayBnspA4500B2-year-oldA194AwhatevsAsoorajBlandersBchizophrenicsArockfishBeamsAquesadillasApsyBaganiniAovertakesAmurariBiyabiBasochisticCdaAlvadAkoalasBasaiAjostlingColAhard-to-getCilstormAgold-diggerAfreonAdesperadoAcarburettorAbrokawAarantxaAweenyBageredAupturnedAsycophantsAprefecturalAmanhunterAlethargyAkoslovAjumbaAhumperdinckBippocratesBarlotsCneulAgrowledAdisavowedClly-dallyBelegatingAcome-AbutterfingersCglerBerlinerA'banionAavmBdministrationsAxueyueBsAthere-thereBabernacleAsnoozingBinasiAnon-fatBagatoAmonkeyingBillimetresBalaiseAlockettBeraAkurapikaBayisAjalAioanAgakAfrigBlatlinedAdichBebauchedAcmdr.AapolloniaBntagonismCnumBlludingAyoungstownBellowtailAuncoordinatedAtopsyBheyâBaehoAsottoBhiinaBencalkapimiArojosBiffsAquote-unquoteApyeBillowcasesAomelettesAnotre-dameAmiekeAlonzoBegislatorAklaatuAjackfruitAinstructionalCoculateAhadenAelectromagnetAcradledBioseBapitalisticAbelliAarchivalBnyangBmbivalenceBlfonseBfterglowA422A1875AvisceraCrajAuncharacteristicallyAsouthwardBeparationsBaltinessArzaApenhAnafisaAmssBetaphysicsCrcantileAlambethAkovicAjottedBanaeAinlayA‐howAhomewreckerAeresBccentricitiesAdruggiesBogeAcompulsionsBhunchuCiricoAbrusqueCoachedBiomassBenicioAalpacasA613AyashodaAtruthfulnessBoymakerCrtBiptoesArolyApillboxBermeatesAosmosisAnight.AjailorCcsCbbedAhirogenClA‐goodAcydneyBounterfeitersCnfitDcedingCmpulsivelyBanastaAbrain-damagedBozeAadulteressBbouA714AziyuAyeojuAvowingAt.p.ArylieAprincipallyBewterschmidtAopecBnee-chanAnaeuriAmooringsB-mrAkutcherAicesAhocusBeineAguffawingBreaserAfeveredAdppBivergentBescendentsAcognizantBarboneAbasiliskA730AviscosityCdarAtyneBremayneBolanAschenectadyAreanimatedApcrBan-searedAmallowAlongstockingCckjawAkrissAgobblersAforebearsBaggyAelectromagnetismAdomineBefaultedAcravatBhuseokAbutterworthBizarrelyBasalClmoralCkrCirdiAadkinsA20-mileA1amB70,000AzambeziAtinkaAswastikasBeraphimBchoenAmikkoBentBassoudAleontesAkarooAju-wonCrisprudenceBianyuAiliacAhustlinBanesDazawaAgirderBataAex-fiancéeAdampnessAcounterweightCndescensionBiriAbulbasaurBoldestBamsıAasmaBlbiA'aboutA49ersA1869Atwo-partBeodoroCgridyBailboneAstockpiledBpyglassBleep-deprivedBausalitoAprivatizationBarsnipsAmordechaiAinexorablyCcursionsBmplacableAfly-fishingBair-hairedAeaganAcapshawAbioweaponsBergoglioAa3AzalmanAyamenAwakaAvacuumsAsnakingBhowoffDveledBawamuraApentothalAmo-suBatsukoAlog-inBieutCcencesAkumquatAhusbandryBartwellAgoodfellasBökhanBobletsBarrisonsAfreundAeviAdementorsAbourguignonBlur8Aa-wastingBrentA6-7Azero-toleranceAwileAtumsBadeuszAspecialisesBlumbersBervileArepellantAponyboyDtusBitiesClafBeakyBascaleClaverCiuteAoverheadsAmen-BaurierAkinkaidAjubilationAincitementAhopiBitoCjaAgummerAfirestoneAeuronAdyatlovBeepwaterAcroppingBeceliaBapedAb-rollBabyfaceAalcazarA4,200AxingchenAwilsonsAtilburyBaylorsCekangAstokingBorriestBidestepAooh-weeAnegraBaaniAmonkeesAlucidityAillustratingAhmmmmBaestenAderisionAconductiveAbothwellAargentBgneseA1795AyuzheBou`veCavAwirthAvelAunmovedAteruAstatehoodBeljuksAryoheiBinoAmuch.BisbehaviorAlynleyAimpartialityAhammettCberdasheryAgraydonBeroAfifty-eightBastest-growingCrrelAcrowneBornballCerciveAbustyBorealisAaubryAzordAxiaofeiAwistromBatchdogsCifAulrikaAturleyAsubripBtilgarBorrelBhuttlepodBelf-reflectionDectivelyApshhBreferringBedesAmaneuveredAlomaBloronaBifeformsBeydenAimpersonationsAh.w.BemorrhagesBangangClf-wittedAemiratesAbreacherAwoopBeezAstep-fatherBoodBhiarBeung-giCo-yeonBcrawledBarinaArefractionAprimitivesBavlovaAmutteredCffleBorphingAkarthiAhermClveticaAgrammaticalAfar-flungAerhanAdottoreBidrtAcoagulationBlaptrapDmmedBinnaBankerA'canAblockchainBio-signsCnghamtonBeginninCbopAyildizBeong-roBarnsAthesesAslushyAreynaldBanklessApardAoperettaAnairaAliechtensteinAkonishiBallieAjealouslyAi.c.Ahighest-rankingBamerAforgivableAexploitativeBndouAdressageBirektorAcherishingAbasiaAanti-agingBllentownBbagnaleAzekiAxyAvoicelessAursusAtatamiCrpaulinAstrenuouslyBohnBlimaneCam-dunkBhekhawatBanctifyArecceApucksAoutlierAnishimuraCne-to-fiveAmoseleyBichealAlow-hangingCverlyBleóAhishamAfatuousAeriksonAditoAchahineBarcerCbdriverAbotsfordCotsyBakugoAulaAsniderBkelterBatayArhiannonBevokingCutersBationalizationCmã³nAooooAmotomeBillwallAjuratiAirrepressibleBnfinitesimalBlithyiaAhighbornAevangelistAcall-CanAbroomhildaBat-shitAardorCcadianA-andAaccompliBbidesA12-year-oldsAwhaaatAvelourBalidatingBãAtonkaBhree-headedBemudginAstreamerBmarmyBhinsukeBeychellesCllarsBcudCaliaArikakoBevampA'reilyApagliacciAoswaldoAnuwaAlohitangBissyAkumiteAinheritorBmbibeAgriefsBortAfouadBairylandAexcludesAdinanathCchotomyAcompartmentalizedAburdettBokuraBelenCatersAanttiCimatronicA90-minuteA4gAyorAtuaBhuslyBakeiAspfBaunterCleneAoverstayAmergesBarsupialAlumberyardAjisooAejaculatedAderailmentAchomskyBargillAbuggeryBeetlejuiceBarbarityA'afterA2600AwestworldCilAvideographerAtekkamanAsmushedBhort-circuitedAreshuffleApleatedAnyukBourishesAhiroseAfurrowBreelancersAentAdakshaAcheck-outCatroomBesiumAburrisBansheesClenciagaAavigdorBnnapurnaAunforeseeableAtomlinsonCffBhatchedBeasdaleAstrahmCarlingsBnivellingBixerBhirkingArooksBefillingCassuresAone-minuteAngosBa-na-na-naAmicromanageBaulingAkourtAgloucestershireAdilawarBenkerAcarousingAaffirmingAveyselAtidwellAstationmasterBprucedBenilityAryeolApatricioDisserieAowieAnataleAmiramaxBatheusAheaAdinesBeviationsDasenaAcure-allBinnabonBhookityAbongsBlah-blahBettinAalsatianA337AzaragozaAwhite-trashBanted-AsyndicationAquipApull-upBiratingBattenClmettoAorcasAmultipliesAhomebodyAguildfordAfibrousAespañolAdispossessedDlikingBecelerationAcruelerBompactedAbusinesslikeBanyonAalolaAwhatsitAstupefyBözeBeitaBculptorsAroughneckBigorouslyBeebokApostmatesAlobbiesBnternationalBauperAisidroBncorporatesAhee-jinAfructoseBorgettinCmoAdeliberatedBaesilAbelthazorBarretteAayodhyaBppointsBnachronismBmbarAzobelleAwh-whoCistBestarAthe--theAsupervillainsBokBamosaCkurabaArosetteBeappearanceBafikiAperpetrateBatseyCcifistsAoff-chanceAmckendrickAlacticAkeckAjun-haBeopardizesBakAindoctrinatedBdolatryAdisrupterAbunkedBlood-redBigsAaomoriBfflictionsAyesssAvice-versaAtipperaryAsummerhouseBhanhaiBahabApre-recordedAmironovA'maraAlongworthAintuitivelyAhow-toCme-schooledAginyuAfaxingAcreeganBlinchedBelluloseAboriCmb-makingBillonBataanA000000AxiaolouA'vAsofianeAravennaAplaneteersA'mrAminnowsBeet-upCachumAlewtonAknockoffsBeyholesAgleesonAfouquetBerdinandoCncerAenrageAdubeAarchetypeA00.00AzohraAwardingClk-onAunfurledAtsukamotoBraffordBomoyaAsymbiontBpinyCermsBixty-threeArepurposeCbukedApoofyBicture-perfectBealAnibbledAmorphinAkofunBnee-jerkAinkyBivingAhimmelAfibsAextracurricularsAdownheartedBimwittedBetainmentAcuestaBounsellorsBhoctawBalpurniaAbetasCleagueredAalignsA73rdAzhongxinAyo-yosBabuAucosAstevoBelectorAremakingApinterAmuranishiBhatreBcnabbAkurdistanAji-naAinoculationsAhey-hoBaniwaAgunduzBrrrrAdispassionateAcreatinineBontrastsAbremmerBloomingtonB-17AaskyouA90-degreeAvaishuAunderappreciatedAtrickiestCansistorsBayoAsatchArepaysCmovableCciprocityBadaApellegrinoAmarshakCcieAlyricistAkinskiAjasminaAirreparablyBngrownAhouchiAgusherBeyhatuAflattererAdong-wookAchubCauvinisticBarnavalAbraulioBoy-girlCotingBlazersDtherAauthorizesBnuradhaBgostinoA288AsulimanBnowplowBcowlingAriniApranavAoff-brandAmuruBaghraAkerwinBazimAinvictusBmperialistsAgavanCuntletsAequipmentsBastendersAdeadshotAcolmanBharcuterieBayCicosCbbiesAbernaysAamplifyingA2.9A----Ayang-soonAwanedAventressAsolanaBhoshoneBeung-heeCe-wonBayuArubleAphonebookAneglectfulBaivelyAmaikoAlndlstlnctlyA'leAkuatoBlonopinAjiménezAestevezBisnerAco-signCmtesseAbuttloadBaylinCrclaysAaxewBeronauticalAvendettasAunsoldAshinjoApithBhilosophicallyBernodAoverusedButvotedAniñoBeatnessAmikBachaAkids-AintersectingAhedaAeejitAcovetsAbekAalyceCunAzalemAvpnAutopiumBnhookedAtiradeAsubversivesBhornBcaldBakthiArs.500AoddaAno-no-no-noBeonatalAmocchiBeineAhigh-mindedBey-hey-heyBawesCllowayAgeosanAfull-bodiedAexceptingAdartmoorAchaperonAblinkersA459"); + +// node_modules/@zxcvbn-ts/language-en/dist/firstnames.json.mjs +var firstnames = decompress("AaarenDikaBbagaelFilCbeEyDiEeDyEeCigaelFilFleCraBdaDhDlineDnDraCdaDiEaEeDyCelEaFidaHeEeEheidEiceFnaGdGeElaFeDnaDyCiDanaDnaCoraEeFeEneCreaDiaFensFnGaGeGnaHeEenaGneBerielGaGlBftonBgCaceDtaEhaFeCgiEeDyCnaDellaEsFeFseEtaDolaCrethaBidaEnCgneisClaDeEeFnEneEyDiEnaEsDsunDynCmeEeDilCndreaDsleeGyFieBjayBlaineDmedaDnaFhEeEnaDyneCbertaGinaIeDinaCeciaDdaDeceEnDjandraIinaDnaEeDssandraDtaEheaDxEaFndraIinaEiFaFnaGeFsCfiEeDredaDyCiDaDcaEeFaEiaDdaEiaDeDkaEeeDnaEeDsEaEhaEonEsaEunDxDzaClaDeenEgraEneDiEanoraEeEnaEsFonFsaExDsunDxDyEceEnEsFonCmaDedaEriaEtaDiraFeCoiseFiaDysiaCtaDheaCveraFtaDinaFiaEraCyceDdaDsEaEeEiaEonEsFaBmabelGleDleaFeFtaEiaFeFtaEleDndaFiGeFyDraEgoDtaCberFlyDurCeDliaFeFnaGeFtaCiDeDiDlDtieEyCmamariaCyDeBnaDbalEelGlaHeDlieseFseEleseFiseDstasiaIeHsiaDtolaCdeeFeEreaDiEeDraEeaGnaFeFiEiaGnaFetteEomacheDyCestassiaDtEtFaFeCgeElFaFeFiaGcaGkaGnaHeGqueGtaFleDieElDyCiaDcaDssaDtaEraCjanetteDelaCnD-marieDaE-dianaJeFmariaEbalFelHaHlIaIeEdianaIeEleeFieseGseEmariaIeDeE-corinneFmarieEcorinneElieseGseEmarieEttaGeDiEceEeEsFsaDmariaHeDnoraDoraDyCselmaDleyDticeCtheFaEiaGthiaDoinetteEnellaGttaFiaGeHttaGnaCyaBppoloniaCrilFetteBraDbelGaGeGlaHeCdaEthDeenEliaGsFlaGeEnFeFiaDineEsFjEthDraDyceEsEthCethaCiadneEnaDdathaDelFaFlaGeClanaDeeFnEnFaFeEtaFteEyneDieFneEnaFdaFeDueneDyEnFeCynBshelyDiaEenElDlaFnEeeFighFnFyEiFeEyCiaCtraEidFxBtalantaChenaFeClantaGeBubertaDineDreeFtteFyEieEyCdiEeDraEeFyEieEyFeDyCgustaGeGinaIeCndreaCraDeaElFeaFiaGeDiaEeEliaDlieDooraEraFeCstinGaGeBvaCelineDrilEylCieDsDvaFhCrilEtBynAbabDaraDbEetteEieDetteDitaDsCmbiFeEyCrbEabraFraH-anneHanneEeFeFtteFyEiFeEraEyDiDrieEyCsiaCthshebaDshevaBeaDtriceGsaGxGzCbeCccaDkaEiFeEyCeCilulDtrisCkkiClDiaEciaEndaEtaDlEaFncaEeEinaDvaEiaCnditeDedettaFictaGktaEttaDitaDniFeEyDoiteCreniceEtDgetDnaFdeneHtteGinaIeFrdinaJeEelleFteGtaHeEiFceFeFtaEyDriFeEyDtEaEeEhaFeEiFeFnaGeEyDylFeCssEieEyCthEanneGyEenaEinaDseyEyDtaEeF-annFannIeEiFnaGeEyFeCulahCvDerieFleeHyGieGyDvyBiancaEkaCbbieEyFeDiCddieEyDgetCliDlEiFeEyFeCnniFeEyCrdEieDgitGtaBlairFeDkeFleeHyDncaFhGaGeCinniGeFyDssFeDtheCondellIeFieFyCytheBobbeFeFtteEiFeEyFeDetteDinaFeGtteCnitaDneeEiFbelleFeEyBranaEdaisFeGaFiGceGeGseFyCeanneErDeEnaDnEaEdaEnFaDttCiaEnaFnaGeDdeEgetHteEieDerEttaDgidGaFtGtaHeDnaEeyEnFaEyDtEaEneyFiEtFaGnHeyHiHyFeGnyFneHyGiCookFeFsCunhildaIeCyanaDnEaEnFaFeBuffyCnniFeEyAcaciliaGeChraCiristionaDtlinErinClDidaDlaEeyEiFdaFeEyDypsoCmDalaDelFlaGiaDiElaFeFlaGeDmiFeEyCndaceEiFceFdaGeFeFsEraEyCpriceCraElieDenFaEsaFsaGeEyDiEaEeElFynEnFaFeEottaEssaEtaFtaDlaEeeGnFnGeFyEieFnGaGeFtaEotaGtaEyFeFnGnHeDmaEelGaGiaHnaHtaGlaHeFnGcitaEinaGeFtaEonDoElF-jeanFaGnHnFeGeFinHaHeFjeanFynHeHnEnDreeEiFeFssaEollEyDyElEnCsandraDeyDiEeDsEandraIeIyFundraEeyEiFeEondraEyCtarinaDeErinaDhaFrinaIeEeFeFrinIaIeEiFeEleenGneErinHeFynEyFleenDiEeEnaDlainaEeeEinDrinaFonaDyCyeDlaBeceliaDilFeGyFiaFlaFyCilCleEneEstaGeGiaHnaIeGynIaDiaEeEnaFdaFeFkaEsseDkaDleCsyaBhadDndaGlFraEnaEtalHleDrilFnFsGsaHeFtaGyElaFeanGenGnaHeFineFotHtaIeEmainIeGneFianGneGonEoEylDstityCelsaeFeaGyFieFyDrEeFyEiFanneFceFdaFeFlynInFnFseGhElynEriGtaFyEyFeFlDslieCiarraDckieFyDquiaGtaCloEeFtteErisCrisFsieGyFtaHbelKlaHlIleHnGeanHlHnGiHanJaJeHeHnIaIeGyHeHnaDysaFlerFtalGeHlBicelyDilyCelClkaCndaEeeFlynFrellaEiFeEraEyDnamonCssieeEyBlairFeDraFbelleEeFstaFtaGtaHeFyEiFbelFceFeFndaGeFssaHeFtaEyDudeGlleGttaIeFiaGeGnaHeCeaDmEenceGtiaInaJeEmieFyDoEpatraDrissaCioCoDeDrisDtildaDvisBodeeDiEeDyCleenEneEttaGeDleenFnFteGteEieFneEyCnDcettinaEhitaEordiaDniFeEyDsolataEtanceIiaIyHtaIiaJnaKeEuelaHoCokieCraEbelHlaIeElFieGneFynDdeliaHeFyEiFeEulaEyDeenEllaEndaFeEttaGeEyDiEeEllaEnaFeFnaGeEssGaDlissEyDnelaGiaGleEieEyDrenaFyEiFanneFeFnaGeGneEyDtneyDyCsettaGeDtanzaCurtenayFnayGeyBrinDsEsieFyEtaGbelGlFenFiGeGnHaHeGonnaFyCystaGlFieBthrineBybDilFlCmbreCndeEiFaFeEyDtheaFiaGeFyAdaceyDiaEeDyCelCffiFeEyCgmarChliaCileDseyEiFeEyCleEnnaDiaElaDlasDorisCmaraFisDitaCnaDellGaEtteDiEaEcaFeEelaGeGlaHeEkaElaEtFaDnaEiFeEyFeDyaEelleFtteCpheneEnaFeCraDbEieEyDceeFyEiFeEyDdaDeenEllGeDiEaEceDlaEeenFneEineEleenDonDrelleEylDseyEieDyaElEnCshaDiEeDyaCthaCuneCveenEtaDidaEnaFeEtaCwnEaCyleDnaBdeneBeCanaEeEnaFeCbDbiFeEyDeeEraDiDorFaGhDraCdeDieDraCeD deeDannGeDdeeDnaDrdreDynChliaCidreDnaDrdreClDaDcinaGeDiaElaGhEndaDlEaEyDoraFesFiaGsDphineHiaCmeterFraGiaHsCnaDiEceEseDnaEiFeEyDyEsFeConneCsdemonaDiraeFeeFiCvaEnDiEnFaFneDonFdraFnaGeEraBiCahannDnEaEdraEeF-marieFmarieEnFaFeFneCdiDoCenaDrdreCnaEhDnieEyConEeEisEneCtaCxDieBnirenBodeDiEeDyCeCllEeyEiFeEyDoresFitaIsCmenigaDingaFiGcaGqueCnaDellaGeEttaDiaEcaEelleDnaFmarieEiFeEyCraEliaGnFynHnIeDeEenEliaFlaGeEnaFeEttaGeEyDiEaFnEceEeEneEsFaFeEtaDoEliceGsaEteaGyaFheaHeGyDreeEiFeFsEyDtheaFyDyCsiCtDiDtiFeEyBreDddyEiConaCuDciFeFllEyDsiFeFllaEyBulceFaEiFaGnaFeFneHaEyDseaCstyByanEaEeEnFaFeCnaEhAeachelleCdaDieEthClasaidCrthaCsterBbaCbaConeeEyBdaCdiEeDyCeDeDlineDnCiDeDnDtaEhFaFeDvaCnaCwinaCyDthFeBffieBileenDisCmileCrenaBkaterinaBlainaFeDnaEeDyneCbertaGinaIeCeanorHaHeDctraDenDnaEeEiEoreDonoraHeCfieDredaEidaFedaCgaCianoraHeDciaDeDnorGeDsaFbetIhItaEeEhaEsaDtaDzaFbetIhCkaDeClaEdineDeEnFeEtteDiEeEssaDyEnFnCmiraCnaDoraFeCoisaFeDnoreDraCsaDbethDeEtEyDiEeEnoreDpethDyCvaDeraDinaEraCwiraCynDseFeEhaEiaEsaBmCaDleeEiaCeldaEiaFnaGeFtaEyneDraCileeEiFaFeFneEyClynFnGeCmaEleeFineFynHnIeDelineEyDiEeDyEeCogeneCyleFeBngraciaCidCricaFhettaEkaEquetaBolandaGeBranCdaCenaCicaEhaEkaDkaDnEaEnFaCmaDengardeFtrudeDinaFiaGeCnaElineDestaGineCthaCynBsmaEriaDeEraldaCsaDieDyCtaDelFeFlGaGeErDherDrellaHitaBthelFdaFinHdHeFynDylCtaDiEeDyBudoraCgeniaGeDineClaElieCniceCphemiaCstaciaBvaDleenDngeliaInJaJeEiaEneCeDleenEinaGeEynDyCieDtaConneCvieDyCyBydeDieBzmeraldaAfaeCinaDthCllonCnDchetteFonEieEyDechkaDiaDniFeEyDyaCraEhEndDicaDraFhFndCunEieDstinaHeCwnEeEiaCyDdraDeEtteDinaDreDthFeBedericaDoraCleciaDicdadFeFiaGtyFleEpaEshaEtaEzaCneliaCodoraCrdinandaJeDnEandaHeHinaEeCyBiannFaCdelaFiaGtyCfiEneCliaEdeEppaCnaConaEnaFulaDrenzeBleurFetteCoDrEaFnceEeFllaFnceHiaGtiaGzaFtteEiFaFdaFeFnaGdaFsEriGeFyEyDssiGeFyCssBranEceneGsHcaFineGscaHkaFoiseFyneEkFieFyEniGeFyDydaCedEaEdiGeFyEeliaFricaIkaHqueEiFaEraFikaDidaCiedaFerikeBulviaAgabbeyEiFeDeyDiEeDrielHaHlIaIeIiaFlaDyCeDlCilCleDinaCrlandDnetGteCtesCvraEielleCyDeElDlaEeFenFneDnorBelyaCnaDeEvaFieveFraDiaDnaEiFeFferEyDoveraDvieveCorgeGannaJeGnaGtaHtaIeFiaHnaInaJeGeGnaHeCraldaGineDdaDhardineDiEannaHeDladinaDmainHeFnaDriFeFleeEyDtEaEiFeErudHaHeHisEyBiacintaDnaEinaEnaCgiClbertaHeHinaJeDdaDemetteDlEanEiFanFeFganEyCnaDelleEvraDgerDniFeFferEyCorgiaDvannaCpsyCraldaCselaFeFlaGeCudittaDliaFettaDstinaCzelaBladEiEysCedaDnEdaEineEnFaFieGsCoriFaGnaHeEyCynEdaEisEnisBnniBodivaCldaFrinaEiFaFeFnaEyBraceEiaFeDtaEiaGnaDyEceDziaCeerDtaFlEchenEeFlEhelEnaEtaCierDseldaEselBuendolenEevereEnaCglielmaCiDllemaHetteDnevereEnaCnillaCsDellaDsiFeEyDtaEiFeEyBwenEdolenHinHynEethGteEnethFiGeFyEoraGeCynEethEneBypsyAhadriaCileeEyCleighEtteEyDiEeEmedaDleyEiFeEyCnaDnaFhEiFeFsEyCppyCrleneFyEiFeDmoniaHeGyDriFeGtHtIaIeFotHtCttiFeEyCyleyCzelBeathFerCdaDdaEiFeDiDvigGeDwigGaDyCidaEiFeClainaGeDenF-elizabethFaFeFkaDgaEeDliDoiseDsaDynCndrikaDkaDrieGtaHtaIeEyettaCphzibahCrmiaFnaGeGiaFoneDtaEhaCsterEherEiaCttiFeEyBilaryDdaFgardJeEeFgaardHrdeEyDlaryEiaryCndaBolliFeEyF-anneFanneCneyDorFiaCpeCratiaDtenseHiaBuldaByacinthIaIeIiaJeCndaAiantheBbbieDyBdaDliaFnaGeCellFeDtteBleanaFeDneCiseCkaClaCsaDeCysaEeEsaBmeldaCogenGeDjeanBnaCdiraCesEitaEsaDzCgaEbergForgDeEbergForgErDridDunnaCnaBolandeFtheCnaCrminaBraCenaEeCinaDsDtaCmaBsaDbelGitaGlaHeDdoraDhellaCeabalCidoraDsCobelCsiEeDyBvettFeCieConneDryCyBzabelAjacentaDindaFtaGhaHeDkelynEiFeElinFynEquelinKeEyDlinEynDquelinJeHynJnGnettaKeGttaIeFiGeDynthCdaDeCimeEieDneCmiEeEmaDmieCnDaEyaFeDdyDeEanEczkaEenElFaFlaGeEneFnaEssaEtFaFtaGeEvaEyDiaEceEeEferEnaFeEsEthDkaDnaEelGleDotDyCquelinGynFnettaJeEithCsminGaGeCymeFeDneFllCzminBeanEaEeFlleFtteEieFneEnaFeGtteFieGneChannaCleneCmieEmaGhDmieEyCnDaDdaDelleDiEcaEeceEferFferEleeEneDnEaEeeFtteEiFcaFeFferFleeFneEyCraleeDeDiDmaineDrieFleeGynFneEyFleeCssEaFlinGynFmineGynEeFlynEiFcaFeFkaEyCwelFlGeBillEanaGeFyneEeenFneEiFanFeEyCnnyBoC annC-annGeCanEaEeEieEnFaFeGsCbeyDiEeEnaDyEeEnaCcelinHeFynHeCdeeDiEeDyCeannDlaEieElFaFeGnFyGnEynnDteDyChannaHhDnaFthEetteEnaCiceCjoCleeFnEneEttaDiEeEneDyEnFnCnellDiEeEsCrdainFnGaGnaDeyDiEeDrieEyCscelinDeeEfaFinaEphaGinaIeEyDiEeDselynDyCurdanCyDaEnFnDceFlinDeBsandyeBuanaEitaCdiEeEthGaDyEeCietaCleeDiEaFnaGeGnHaHeEeFnneFtGaGtaHeEnaFeEssaEtaCneEtteDiaEeEnaCstinaGeGnByotiAkaceyDieDyCelaCiDaDlaEeFyDtlinFynHnCjaCkalinaClaDeenaDiEeElaEnaFdaGiDliEyCmekoDilaGhFlahCndaceEyDiaDyaCraE-lynnEleeFynnDeEeElEnFaDiEaEeElFynnEnFaFeEottaEsaFsaEtaDlaEeeGnFnGeEieEottaHeEyFnDmenDnaDolFaFeFinaHeFyEnDrahEieEyDyElFinEnCseyDsEandraEeyEiFaFeCtDaElinDeEeErinaHeEyDhEaFrinaIeGynEeFrinaIeGynEiFeEleenFinErineFynHeEyFeDiEeEnaFeFkaDleenEinDrinaGeGkaDtiFeDuschaFhaDyEaCyDceeDeDlaEeFeFyEilEynBeeleyEiaEyClceyEiFeEyDilaDlenFyEiFaFeFnaEsieEyFannDseyEiEyCndraFeDnaCriEannHeDriFeFllFnEyDstinCsleyEieDsiaGhCttiFeEyCvinaDynBiCahDlCeleDrstenCkeliaCleyCmDberleeIyHiHyInEraDmiFeEyCnnaCpDpEieEyCraDbeeEieEyDiDstenHiFiGnFynCsseeEiahFeCtDtiFeEyCzzeeEieBlaraEikaErisaBonstanceHzeCoCraElFleDdulaDeEllaEnEssaDiEeDneyDrieEyBrisEsieFyEtaGlGnFeGlGnFiGenGnHaHeFyGnCystaGlHleFleFynaBylaDeEnDieElaDynnCmCnthiaCrstinAla verneCceeEyDieDyCdonnaCetitiaCinaEeyCnaEeDeEtteEyDiEeEtaDnaEiEyCraEineDiEnaFeEsaFsaDkDyssaCtashiaDiaEshaDrenaEinaCuraFineFlGeeEeFeGnFlGlaFnGaGeFttaHeEiFanneFceFeEynCvenaErnaGeDinaFiaGeCylaDneFyBeaDhDndraEnFaEorGaCbbieCdaCeDannGeDlaFhDnaDsaEeCgraCiaDghFaDlaFhDshaClaEhEndDiaCnaDeeEtteDkaDnaDoraFeCodoraDineDlaEineDnaFnieEeFlleEieEoraGeEtineFyneDraCshiaDleyEiFeEyDyaCtaDhiaDiciaEshaEtiaEziaDtaEiFeEyCxiEeEneEsDyCylaCzlieBiaDnEaEeEnaFeCbDbeyEiFeEyCchaCdaDiaCesaClDaEhEsDiaFnGeFsEthDlaEiFanFsElieEyDyEanCnDaDdEaEiFeEsayFeyFyEyDeaEllEtFteDnEeaFllFtEieDzyCraCsaEbethDbethDeEttaGeDhaEeDsaEiFeEyCtaCukaCvDaDiaDvieEyFyDyCzDaEbethDbethDetteDzieEyBoellaCisEeClaDetaDitaDlyCnaDeeDiDnaEiFeCraEinGeEleeFieFynDeeFnEleiFleEnFaFeFzaEttaGeDiEaFnnaHeEeEleeFynEndaFeEtaDnaEeDraineFyneEiFeFnEyDyCttaEeEiFeEyCuDellaDisaFeGtteDtitiaBuCceDiEaFnaEeFnneElaFiaFleEnaFdaFeEtaDkyDretiaDyCdovikaCellaFeCisaEeClaDitaDuCraDetteDleenFneEineCsaCzBydaDiaEeCnDdaEeFlGlEsayFeyFieEyDeaElleEttGeDnEaEeFaFllHeFtGtHeDseyCssaAmabDelFleDleCdaElenaFynDdalenaEiFeEyDelFaineFeineGnaHeFinHaHeFlaGeFonFynDgeDlenEinDonnaDyCeDganCgDdaFiaFlenIaIeDgeeEiFeEyChalaFiaCiaDbleDgaEhdilnDrEeDseyEieDtildeClaEnieDenaDiaEnaFdaGeEssaGiaDlissaEorieGyDorieFyDvaEinaDyndaCmeDieCndaEiFeEyDonDyaCraEbelDcelaGiaGlaHeHinaJeEhelleEiFaFeFleGleEyDeahEnFaEssaDgaFlitGoFretIaIeIhaJeItaJeGitaFuxEeFauxFryFtGteEiFeFtEoFtEretEueriteEyDiEaFmFnGaGnHaHeEbelHleGthEceEdelEeF-annGjeanneFannFjeanneFlGeGleInFttaHeEgoldEjoEkaEleeFinFlinFynEnFaFnaEonEquillaEsFaFkaFsaEtaFsaEyaDjEaEeEiFeEorieGyEyDketaDlaFneEeahFeGnFnaGeFyEieFneEoEynDnaEeFyEiFaFeDquitaDrileeFsGsaDshaEiellaDtaEelleEgueritaEhaFeGnaEiFcaFeFnaFtaEyFnneDyEaFnnHaHeEbelleGthEellenEjaneFoElFeeFinHdaFouFynneEroseEsFaCshaCteldaDhildaHeDildaGeDtiFeEyCudEeEieDraEeFenHeFneEineFseFtaFziaCvisDraCxDiEeEneDyCyDbelleDeBeadEeDganEhanDraCchelleCgDanDenDgiFeEyDhanGnChetabelCiClDaEmieEniaGeFthaFyDbaDesaFsaDicentEnaFdaGeEsaGndeIraFendaHtFsaGeEtaFtaDlaEiFcentFeFsaGentEoneyEyDodeeFieFyEnieFyEsaDvaCrcedesEiFeEyDedithIeDidelFithEelEleeFynEsFsaDlEaEeEinaGeDnaDolaDraleeEidieFeGlleFleHeGiGlGyEyDseyDylCtaBiaCcaelaDhaelaHinaJeHlaFlEelGeGinaIeGlHeDkiFeEyCdgeCgnonGneDuelaGitaCkaelaClDdredFidDenaDicentEssentDkaDliFcentFeFsentEyDzieCmiCnDaDdaEyDervaEttaGeDnaFminnieEeEiFeEnieEyDtaCof melaCquelaCraEbelHlaIeEnFdaDeielleFlleEllaGeDiamEllaDnaCshaDsieEyDtiEyCtziBodestaGiaHneGyCinaDraCllEeeEiFeEyCmmyCnaEhDicaEkaEqueCraDeenEnaDganGaGicaGneEenDiaEssaDnaCselleCynaDraCzelleBuffinDiEnellaCireCreilDialEelGleByraEhEndaDiamEllaDleFneDnaDtaEiaFceFeEleAnadaDeanEenDiaEneEyaDyEaClaniCnDaEnneDceFeFyEiFeEyDeteFteDiEceEneDnetteEiFeEyDonComaEiCraDiEkoCtDaElaFeeFieGnaHeFyaEshaFsiaDhaliaHeDividadDkaDtyBealaCdaDdaDiCelyCilaEeElaFeCliaEeDlEeEiFeEyCrissaEtaDtEaEeEiFeEyCssaEiFeEyDtaCttaEiFeEleEyCvsaCysaBicholGeGleDkiFeEyDolFaFeGaGtteFiGnaHeFleCkanikiDeDiDkiFeDolettaFiaCnaDettaGeDnettaHeDonCssaEeEieEyCtaCxieBoamiCelEaniElFaFeFynEynDmiClaEnaDieDlieCmiCnaEhDiEeDnaFhCraEhDeanEenEneDinaFeDmaDriFeEyCveliaBydiaCssaAoctaviaBdeleEiaFndaElaFeDssaDttaFeCiliaEleBfeliaElaCiliaBlaCenkaCgaCiaDmpiaDveFtteEiaFeDyClieDyCvaCwenCympeFiaGeBndreaCeidaCidaBonaBpalEinaGeCheliaGeBraDleeEiaFeElaFeCelEeeEiaFeElaFeCianaClyCsaDolaCtensiaBthaDeliaFlaDiliaGeCtilieApageCigeClomaCmDelaFinaFlaDmiFeEyCndoraDsieEyColaEinaCpagenaCtDienceDricaGeGiaFziaDsyDtiFeEyCulaEeFttaHeEiFeFnaGeFtaEyCviaDlaBearlFaFeFineCgDeenDgiFeEyCnDelopaHeDniFeEyCpiEtaCriEaDlEaEeDriFneEyDsisCtDaDraEinaEonellaGiaHllaJeDuniaBhaedraDidraCebeDdraDliaCilEipaGpaHeHineFsElidaGeGsFyEomenaCoebeCylisElidaGsFysEysBiaCerEetteEretteDtraCperDpaEyBollyFannaCohCppyCrtiaBrisEcaFellaFillaEsieCuDdenceEiEyDeAqueenieDntinDridaCinnEtaGnaFillaGnaArachaelEelGeGleCeDannCfDaEelaGiaHtaChalDelCinaEeCkelClinaCmonaFdaCnaDdaEeeFneEiFeEyDeeDiEaEceEqueDnaCphaelaCquelGaCsiaDlaCvenCyDchelDeDnaEellDshellBeaCbaDbeccaDeEcaFcaFkaEkaGhFkahCeDbaDnaDtaDvaCganDgiFeDinaFeCikoDnaEeCmyCnaEeEtaFeDeEeEllGeDieDnieCtaDhaCvkahCyDnaBheaDbaDtaEtaCiamonEnnaFonCodaEiaFeEyDnaEdaBianeEnonEonCcaDcaDiDkiFeEyCkiDkiCnaCsaCtaCvaEleeDiDkahDyBoanaEnaFeCbbiFeFnEyFnDenaFiaErtaDinFaFetHtIaIeFiaDyEnCchEellHaHeFtteCdaDiEeEnaCisCmolaEnaFdaDyCnaEldaDdaDicaDnaEiFcaFeEyCobbieCraDiEeDyCsDaEbelHlaIeEleenFiaGeGndIaIeHeFynHdEmondFundEnaFnaGeDeEannHaHeEliaGnHeFlaGeEmariaIeHyFondeEneEttaGeDhelleDieEnaEtaDlynDmundaDyCwDeEnaCxanaFeFnaGeDiEeEneDyCzDalieGnEmondEnnaGeDeEleFlaGeDinaBubettaDiEaEeEnaDyCpertaCthEannHeEeEiFeEyByannCccaAsabaDinaFeDraEinaCchaCdaDellaDieDyeCideeClDaidhDleeEiFeEyFannIeDomaFeFiCmDanthaEraFiaDmyCndeEiFeEraEyFeCpphiraHeCraE-annEannEhEjaneDeeEnaFeEtteDiEnaFeEtaCschaDhaEenkaCudraDndraCvinaCyreBcarletHtBeanEaCkaClaDenaFeEstinaDiaEeEnaFdaFeDlaEeDmaCnaCphiraCrenaFeBhaeDinaFeDlnaFeDnaEdaFeeGighFieFraFyEeEiFeEnaGhFenFonEonEtaFeeDraFiEiFaFtyElFaFeenGneFineEonGaEronEylDunFaDwnFaFeeDyElaGhFynHnEnaFeCeaDbaDelaGghGhEnaEreeDilaG-kathrynGhDlEaFghEbaFiFyEiaElFeyFiGeFyDnaDrEeeEiFeFllGynElineEriGeFyEyeFlCinaDrElFeeHnGneGyFineCoshanaHnaBianaEnaCbDbieEyDealElFlaGeDillaDleyDylFlaGeCdoneyFiaFnieCgridCleEasDvaFnaEiaFeCmonaFeGtteFneCndeeCobhanDuxFieCselyDileDsieEyCusanBofiaEeCndraDiaDjaDniFeEnieEyDyaCpheyEiFaFeEroniaCrchaCsannaBtaceFeFyEiFaFeEyDfaniDrElaFeneFinErCefaFniaHeEfaneFiGeDllaDphaGnaHiIeHnieFenieFiGeGneDshaDvanaEenaCoddardDrmFiGeFyBueDllenCkeyDiClaCnnyDshineCsanFaFettaFnGaHhGeDetteDiEeDyCzannGaGeDetteDiEeDyBybilFaFlaGeDylCdelFleDneyClviaAtabathaDbathaEiFeFthaEyDinaEthaCffyCliaDliaFeEouEulahEyDyaFhCmarFaGhFraDeraDiEkoDmaFraEiFeEyDqrahDraCnaDdiFeEyDhyaDiEaEtansyDsyDyaCraEhDraFhDynCshaDiaCteDianaGiaDumCwnyaDshaBedDdaEiFeEyDiDraCenaCirtzaCodoraCraDesaFeFinaGtaFsaDiEannDraEiFeFjoEyFeDsinaDzaCssEaEiFeEyBhaliaCeaEdoraDdaDklaDlmaDoEdoraGsiaDresaGeGinaHtaGsaEineCiaComasaGinIaIeBienaDrneyEtzaCffEaniHeGyEiFeEyCldaEiFeEyDlieEyCmDiDmiFeEyDotheaCnaDeCphaniHeGyCshEaBobeEyDiDyEeCinetteCmaEsinaHeDiDmiFeEyCniEaEeDyEaEeCotsieCreyDiEeDrieDyCvaDeBraceeFyEiFeEyCennaDsaEchaEsaCiciaDnaDshFaEtaDxEiFeEyCudaEeFyEiFeEyDlaBuesdayBwilaCylaBybiEeCneAulaClaCricaEkaGumekoFeBmekoBnaBrsaElaDolaDulaFinaHeBtaAvalDareeFiaDeEdaEnciaFeFkaFtiaHnaIeEraFiaGeFyGeDidaEnaDliFeEyDmaDryCnDdaDessaDiaDnaEiFeEyDyaBedaClmaDvetCnitaDusCraEdisDeEnaFeDieeEleEnaFeDlaDnaEiceDonicaGkaHeGqueCvayBiCckiFeEyDtoriaCdaCkiDkiEyClhelminaDmaCnDaDitaDniFeEyColaFnteEeFtGtaHeCrgieFnaGiaHeCtaDiaDoriaDtoriaCvDaDiEaFnGaGnaHeEeFnGeGneEyanDyanGneBonniFeEyBykyAwallieFsFwEyDyCndaEieFsDetaDidsBendaEelineEiFeEyFeDonaGhBhitneyBileenDhelminaJeDieDlaFbellaFminaEettaHeEiFeEowEyFtDmaEetteDonaFeEwCndyDiEfredDnaFhEeEiFeFfredEyDonaGhBrenEnieBylmaCnnEeEieEyAxavieraBenaDiaByliaEnaAyalondaCsmeenEinBelenaCttaEieEyCvetteBnesDzBokoClandaGeFeFtheCshiFkoCvonndaBsabelBvetteConneAzabrinaCharaCndraDetaCraEhDiaDlaBeaCldaDmaCnaDiaBiaClviaCtaDellaBoeClaCndaEraDnyaCraEhEnaDinaFeBsa zsaDzsaBulemaCzana"); + +// node_modules/@zxcvbn-ts/language-en/dist/lastnames.json.mjs +var lastnames = decompress("AsmithAjohnsonAwilliamsAjonesAbrownAdavisAmillerAwilsonAmooreAtaylorAandersonAthomasAjacksonAwhiteAharrisAmartinAthompsonAgarciaAmartinezArobinsonAclarkArodriguezAlewisCeAwalkerAhallAallenAyoungAhernandezAkingAwrightAlopezAhillAscottAgreenAadamsAbakerAgonzalezAnelsonAcarterAmitchellAperezArobertsAturnerAphillipsAcampbellAparkerAevansBdwardsAcollinsAstewartBanchezAmorrisArogersBeedAcookAmorganAbellAmurphyAbaileyAriveraAcooperArichardsonAcoxAhowardAwardAtorresApetersonAgrayAramirezAjamesAwatsonAbrooksAkellyAsandersApriceAbennettAwoodAbarnesArossAhendersonAcolemanAjenkinsAperryBowellAlongApattersonAhughesAfloresAwashingtonAbutlerAsimmonsAfosterAgonzalesAbryantAalexanderArussellAgriffinAdiazAhayesAmyersAfordAhamiltonAgrahamAsullivanAwallaceBoodsAcoleAwestAjordanAowensAreynoldsAfisherAellisAharrisonAgibsonAmcdonaldAcruzAmarshallAortizAgomezAmurrayAfreemanAwellsCbbAsimpsonBtevensAtuckerAporterAhunterBicksAcrawfordAhenryAboydAmasonBoralesAkennedyAwarrenAdixonAramosBeyesAburnsAgordonAshawAholmesAriceBobertsonAhuntAblackAdanielsApalmerAmillsAnicholsAgrantAknightAfergusonAroseAstoneAhawkinsAdunnAperkinsAhudsonAspencerAgardnerAstephensApayneBierceAberryAmatthewsAarnoldAwagnerBillisArayAwatkinsAolsonAcarrollAduncanAsnyderAhartAcunninghamAbradleyAlaneAandrewsAruizAharperAfoxArileyAarmstrongAcarpenterAweaverAgreeneAlawrenceAelliottAchavezAsimsAaustinApetersAkelleyAfranklinAlawsonAfieldsAgutierrezAryanAschmidtAcarrAvasquezAcastilloAwheelerAchapmanAoliverAmontgomeryArichardsAwilliamsonAjohnstonAbanksAmeyerAbishopAmccoyAhowellAalvarezAmorrisonAhansenAfernandezAgarzaAharveyAlittleAburtonAstanleyAnguyenAgeorgeAjacobsAreidAkimAfullerAlynchAdeanAgilbertBarrettAromeroAwelchAlarsonAfrazierAburkeAhansonAdayAmendozaBorenoAbowmanAmedinaAfowlerAbrewerAhoffmanAcarlsonAsilvaApearsonAhollandAdouglasAflemingAjensenAvargasAbyrdAdavidsonAhopkinsAmayAterryAherreraAwadeAsotoAwaltersAcurtisAnealAcaldwellAloweAjenningsAbarnettAgravesAjimenezAhortonAsheltonAbarrettAobrienAcastroAsuttonAgregoryAmckinneyAlucasAmilesAcraigArodriquezAchambersAholtAlambertAfletcherAwattsAbatesAhaleArhodesApenaAbeckAnewmanAhaynesAmcdanielBendezAbushAvaughnAparksAdawsonAsantiagoAnorrisAhardyAloveAsteeleAcurryApowersAschultzAbarkerAguzmanApageAmunozAballAkellerAchandlerAweberAleonardAwalshAlyonsAramseyAwolfeAschneiderAmullinsAbensonAsharpAbowenAdanielAbarberAcummingsAhinesAbaldwinAgriffithAvaldezAhubbardAsalazarAreevesAwarnerAstevensonAburgessAsantosAtateAcrossAgarnerAmannCckBossAthorntonAdennisAmcgeeAfarmerAdelgadoAaguilarAvegaAgloverAmanningAcohenAharmonArodgersCbbinsAnewtonAtoddAblairAhigginsAingramAreeseAcannonAstricklandAtownsendApotterAgoodwinAwaltonAroweAhamptonAortegaApattonAswansonAjosephAfrancisAgoodmanAmaldonadoAyatesAbeckerAericksonAhodgesAriosAconnerAadkinsAwebsterAnormanAmaloneAhammondAflowersAcobbAmoodyAquinnAblakeAmaxwellApopeAfloydAosborneApaulAmccarthyAguerreroAlindseyAestradaAsandovalAgibbsAtylerAgrossAfitzgeraldAstokesAdoyleAshermanBaundersAwiseAcolonAgillAalvaradoAgreerApadillaAsimonAwatersAnunezAballardAschwartzAmcbrideAhoustonAchristensenAkleinAprattAbriggsAparsonsAmclaughlinAzimmermanAfrenchAbuchananAmoranAcopelandAroyApittmanAbradyAmccormickAhollowayAbrockApooleAfrankAloganAowenAbassAmarshAdrakeAwongAjeffersonAparkAmortonAabbottAsparksApatrickAnortonAhuffAclaytonAmasseyAlloydAfigueroaAcarsonAbowersArobersonAbartonAtranAlambAharringtonAcaseyAbooneAcortezBlarkeAmathisAsingletonAwilkinsAcainAbryanAunderwoodAhoganAmckenzieAcollierAlunaAphelpsAmcguireAallisonAbridgesAwilkersonAnashAsummersAatkinsAwilcoxApittsAconleyAmarquezAburnettArichardAcochranBhaseAdavenportAhoodAgatesAclayAayalaAsawyerAromanAvazquezAdickersonAhodgeAacostaAflynnAespinozaAnicholsonAmonroeAwolfAmorrowAkirkArandallAanthonyAwhitakerAoconnorAskinnerAwareAmolinaAkirbyAhuffmanAbradfordAcharlesAgilmoreAdominguezAonealAbruceAlangAcombsAkramerAheathBancockAgallagherCinesAshafferCortAwigginsAmathewsBcclainAfischerAwallAsmallAmeltonAhensleyAbondAdyerAcameronAgrimesAcontrerasBhristianAwyattAbaxterAsnowAmosleyAshepherdAlarsenAhooverAbeasleyAglennApetersenAwhiteheadAmeyersAkeithAgarrisonAvincentAshieldsAhornAsavageAolsenAschroederAhartmanAwoodardAmuellerAkempAdeleonAboothApatelAcalhounAwileyAeatonAclineAnavarroAharrellAlesterAhumphreyAparrishAduranAhutchinsonBessAdorseyAbullockAroblesAbeardAdaltonAavilaAvanceArichAblackwellAyorkAjohnsAblankenshipAtrevinoAsalinasAcamposApruittAmosesAcallahanAgoldenAmontoyaAhardinAguerraAmcdowellAcareyAstaffordAgallegosAhensonAwilkinsonAbookerAmerrittBirandaAatkinsonAorrAdeckerAhobbsAprestonAtannerAknoxApachecoAstephensonAglassArojasAserranoAmarksAhickmanAenglishAsweeneyBtrongAprinceAmcclureAconwayAwalterArothAmaynardAfarrellAloweryAhurstAnixonAweissAtrujilloAellisonAsloanAjuarezAwintersAmcleanArandolphAleonAboyerAvillarrealAmccallAgentryAcarrilloAkentAayersAlaraAshannonBextonApaceAhullAleblancAbrowningAvelasquezAleachAchangAhouseAsellersAherringAnobleAfoleyAbartlettAmercadoAlandryAdurhamAwallsAbarrAmckeeAbauerAriversAeverettAbradshawApughAvelezArushAestesAdodsonAmorseAsheppardAweeksAcamachoAbeanBarronAlivingstonAmiddletonAspearsAbranchBlevinsAchenAkerrAmcconnellAhatfieldCrdingAashleyAsolisAhermanAfrostAgilesAblackburnAwilliamApenningtonAwoodwardAfinleyAmcintoshAkochAbestAsolomonAmcculloughAdudleyAnolanAblanchardArivasAbrennanAmejiaAkaneAbentonAjoyceAbuckleyAhaleyAvalentineAmaddoxArussoAmcknightAbuckAmoonBcmillanAcrosbyAbergAdotsonAmaysAroachAchurchCanArichmondAmeadowsAfaulknerAoneillAknappBlineAbarryAochoaAjacobsonAgayAaveryAhendricksBorneAshepardAhebertAcherryBardenasAmcintyreAwhitneyBallerAholmanAdonaldsonAcantuAterrellAmorinAgillespieAfuentesAtillmanAsanfordAbentleyApeckAkeyAsalasArollinsAgambleAdicksonAbattleAsantanaAcabreraBervantesAhoweBintonBurleyAspenceAzamoraAyangAmcneilAsuarezAcaseApettyAgouldAmcfarlandAsampsonAcarverAbrayArosarioAmacdonaldAstoutAhesterAmelendezAdillonAfarleyAhopperAgallowayApottsAbernardAjoynerAsteinAaguirreAosbornAmercerAbenderAfrancoArowlandAsykesAbenjaminAtravisApickettAcraneAsearsAmayoAdunlapAhaydenAwilderAmckayAcoffeyAmccartyAewingAcooleyAvaughanAbonnerAcottonAholderAstarkAferrellAcantrellAfultonAlynnBottAcalderonArosaApollardAhooperAburchAmullenAfryAriddleAlevyAdavidBukeAodonnellAguyAmichaelAbrittAfrederickAdaughertyAbergerAdillardAalstonAjarvisAfryeAriggsAchaneyAodomAduffyAfitzpatrickAvalenzuelaAmerrillBayerAalfordAmcphersonAacevedoAdonovanAbarreraAalbertAcoteAreillyAcomptonAraymondAmooneyBcgowanAcraftBlevelandDmonsAwynnAnielsenAbairdAstantonBniderArosalesAbrightAwittAstuartAhaysBoldenArutledgeAkinneyAclementsBastanedaAslaterAhahnAemersonAconradAburksAdelaneyApateAlancasterAsweetAjusticeAtysonAsharpeAwhitfieldAtalleyAmaciasAirwinAburrisAratliffAmccrayBaddenAkaufmanAbeachAgoffAcashAboltonAmcfaddenAlevineAgoodAbyersAkirklandCddAworkmanAcarneyAdaleAmcleodAholcombAenglandAfinchAheadAburtAhendrixAsosaAhaneyAfranksAsargentAnievesAdownsArasmussenAbirdAhewittAlindsayBeAforemanAvalenciaAoneilAdelacruzAvinsonAdejesusAhydeAforbesAgilliamButhrieAwootenAhuberAbarlowBoyleAmcmahonAbucknerArochaApuckettAlangleyAknowlesAcookeAvelazquezAwhitleyAnoelAvangAsheaArouseAhartleyAmayfieldAelderArankinAhannaAcowanAluceroAarroyoAslaughterAhaasAoconnellAminorAkendrickAshirleyAkendallAboucherAarcherAboggsAodellAdoughertyAandersenAnewellAcroweAwangAfriedmanAblandAswainAholleyAfelixApearceAchildsAyarbroughAgalvanAproctorAmeeksAlozanoAmoraArangelAbaconAvillanuevaAschaeferArosadoAhelmsAboyceAgossAstinsonBmartAlakeAibarraAhutchinsAcovingtonAreynaAgreggAwernerAcrowleyAhatcherAmackeyAbunchAwomackApolkAjamisonAdoddAchildressFersBampAvillaAdyeAspringerAmahoneyAdaileyAbelcherAlockhartAgriggsAcostaCnnorAbrandtAwinterBaldenAmoserAtracyBatumAmccannAakersAlutzApryorAlawAorozcoAmcallisterAlugoAdaviesAshoemakerAmadisonArutherfordAnewsomeAmageeAchamberlainAblantonAsimmsAgodfreyAflanaganAcrumBordovaAescobarAdowningAsinclairAdonahueAkruegerAmcginnisAgoreAfarrisAwebberAcorbettAandradeAstarrAlyonAyoderAhastingsAmcgrathAspiveyAkrauseAhardenAcrabtreeAkirkpatrickAhollisAbrandonAarringtonAervinAcliftonAritterAmcgheeAboldenAmaloneyAgagnonAdunbarAponceBikeAmayesAheardAbeattyAmobleyAkimballAbuttsAmontesAherbertAgradyAeldridgeAbraunAhammAgibbonsAseymourAmoyerBanleyAherronAplummerAelmoreAcramerAgaryAruckerAhiltonAblueApiersonAfontenotBieldArubioAgraceBoldsteinAelkinsAwillsAnovakAjohnAhickeyAworleyAgormanAkatzAdickinsonAbroussardAfritzAwoodruffAcrowBhristopherAbrittonAforrestAnanceAlehmanAbinghamAzunigaAwhaleyAshaferAcoffmanAstewardAdelarosaAnixBeelyBumbersAmataCnuelAdavilaAmccabeAkesslerAemeryAbowlingAhinkleAwelshApaganAgoldbergCinsAcrouchBuevasAquinonesAmcdermottAhendricksonAsamuelsAdentonAbergeronAlamAiveyAlockeAhainesAthurmanAsnellAhoskinsAbyrneAmiltonAwinstonAarthurCiasAstanfordAroeAcorbinAbeltranAchappellAhurtAdowneyColeyAtuttleAcouchApaytonAmcelroyAcrockettAgrovesAclementAleslieAcartwrightAdickeyAmcgillAduboisAmunizAerwinAselfAtolbertAdempseyAcisnerosAsewellAlathamAgarlandAvigilAtapiaAsterlingAraineyAnorwoodAlacyAstroudAmeadeAamosAtiptonAlordAkuhnAhilliardAbonillaAteagueAcourtneyAgunnAhoAgreenwoodAcorreaAreeceAwestonApoeAtrentApinedaBhippsAfreyAkaiserAamesApaigeAgunterAschmittAmilliganAespinosaAcarltonAbowdenAvickersAlowryApritchardAcostelloApiperAmcclellanAlovellAdrewAsheehanAquickAhatchAdobsonAsinghAjeffriesAhollingsworthAsorensenAmezaAfinkAdonnellyAburrellBrunoAtomlinsonAcolbertAbillingsAritchieAheltonAsutherlandApeoplesAmcqueenAgastonAthomasonAmckinleyAgivensAcrockerAvogelArobisonAdunhamAcokerAswartzAkeysAlillyBadnerAhannahAwillardArichterAhargroveAedmondsAbrantleyAalbrightAmurdockAboswellAmullerAquinteroApadgettAkenneyAdalyAconnollyApierreAinmanAquintanaAlundAbarnardAvillegasAsimonsAlandAhugginsAtidwellAsandersonAbullardAmcclendonAduarteBraperAmeredithBarreroAdwyerAabramsAstoverAgoodeAfraserAcrewsAbernalAsmileyAgodwinAfishAconklinAmcnealAbacaAesparzaAcrowderAbowerAnicholasAchungAbrewsterAmcneillAdickArodriguesAlealAcoatesArainesAmccainDordBinerAholbrookAswiftAdukesAcarlisleAaldridgeBckermanAstarksAricksAhollidayAferrisAhairstonAsheffieldAlangeAfountainAmarinoAdossAbettsAkaplanAcarmichaelAbloomAruffinApennAkernAbowlesAsizemoreAlarkinAdupreeAjewellAsilverBealsAmetcalfAhutchisonBenleyAfarrAcastleAmccauleyAhankinsAgustafsonAdealAcurranAashAwaddellArameyAcatesApollockAmajorAirvinAcumminsAmesserAhellerAdewittAlinAfunkAcornettApalaciosAgalindoAcanoAhathawayAsingerAphamAenriquezAaaronAsalgadoApelletierBainterAwisemanAblountAhandAfelicianoAtempleAhouserAdohertyAmeadBcgrawAtoneyAswanAmelvinAcappsAblancoDckmonAwesleyAthomsonAmcmanusAfairAburkettApostAgleasonArudolphAottAdickensAcormierAvossArushingBosenbergAhurdAdumasAbenitezAarellanoAstoryAmarinAcaudillAbraggAjaramilloAhuertaAgipsonAcolvinAbiggsAvelaAplattAcassidyAtompkinsAmccollumAkayAgabrielAdolanBaleyAcrumpAstreetBneedAkilgoreAgroveCimmAdavisonAbrunsonApraterAmarcumAdevineAkyleAdodgeAstrattonArosasAchoiAtrippAledbetterBayAhightowerBaywoodAfeldmanAeppsAyeagerAposeyAsylvesterBcruggsAcopeAstubbsAricheyAovertonAtrotterAspragueAcorderoAbutcherCrgerAstilesAburgosAwoodsonAhornerAbassettApurcellAhaskinsAgeeAakinsBbrahamAhoytAzieglerAspauldingAhadleyAgrubbsAsumnerAmurilloAzavalaAshookAlockwoodAjarrettAdriscollBahlAthorpeAsheridanAredmondAputnamAmcwilliamsCraeAcornellAfeltonAromanoAjoinerAsadlerAhedrickBagerEnAfitchAcoulterAthackerAmansfieldAlangstonAguidryAferreiraAcorleyCnnArossiAlackeyAcodyAbaezAsaenzAmcnamaraAdarnellAmichelBcmullenCkennaCdonoughAlinkAengelAbrowneAroperApeacockAeubanksAdrummondAstringerApritchettBarhamAmimsAlandersAhamAgraysonAstacyBchaferAeganAtimmonsAoharaAkeenAhamlinAfinnAcortesAmcnairAlouisAcliffordAnadeauAmoseleyBichaudArosenAoakesAkurtzAjeffersAcallowayAbealBautistaAwinnAsuggsBternCapletonAlylesBairdAmontanoAdiamondBawkinsArolandAhaganAgoldmanAbrysonBarajasAlovettAseguraAmetzAlockettBangfordAhinsonAeastmanArockAhooksAwoodyAsmallwoodBhapiroAcrowellAwhalenAtriplettAhookerAchatmanAaldrichAcahillAyoungbloodBbarraAstallingsBheetsBamuelAreederApersonBackAlaceyAconnellyAbatemanAabernathyAwinklerClkesAmastersAhackettAgrangerBillisAschmitzBappAnapierAsouzaAlanierAgomesAweirAoteroAledfordAburroughsBabcockAventuraAsiegelAduganAclintonBhristieAbledsoeAatwoodAwrayAvarnerAspanglerAottoAanayaAstaleyAkraftAfournierAeddyAbelangerAwolffAthorneAbynumBurnetteBoykinAswensonApurvisBinaAkhanAduvallBarbyAxiongAkauffmanAaliAyuAhealyAengleAcoronaAbenoitAvalleAsteinerBpicerBhaverArandleAlundyAdowAchinBalvertAstatonAneffAkearneyAdardenAoakleyAmedeirosBccrackenAcrenshawAblockBeaverAperdueAdillAwhittakerAtobinAcorneliusAwashburnAhogueAgoodrichAeasleyAbravoAdennisonAveraAshipleyAkernsAjorgensenAcrainAabelAvillalobosAmaurerAlongoriaAkeeneAcoonAsierraAwitherspoonAstaplesApettitAkincaidAeasonAmadridAecholsAluskAwuAstahlAcurrieAthayerAshultzCerwoodAmcnallyAseayAnorthAmaherAkennyAhopeAgagneAbarrowAnavaAmylesBorelandAhoneycuttBearnAdiggsAcaronAwhittenBestbrookAstovallAraglandAqueenAmunsonBeierAlooneyAkimbleAjollyAhobsonAlondonAgoddardAculverAburrApresleyAnegronAconnellAtovarAmarcusAhuddlestonBammerAashbyAsalterArootApendletonAolearyAnickersonAmyrickAjuddBacobsenAelliotAbainAadairAstarnesBheldonAmatosAlightAbusbyAherndonBanleyAbellamyAjackAdotyAbartleyAyazzieArowellAparsonAgiffordAcullenBhristiansenAbenavidesBarnhartAtalbotAmockAcrandallBonnorsAbondsAwhittAgageAbergmanAarredondoBddisonAmarionAlujanAdowdyAjerniganAhuynhAbouchardAduttonArhoadesAouelletteAkiserArubinAherringtonBareAdennyAblackmanBabbAallredAruddApaulsonAogdenAkoenigAjacobAirvingAgeigerAbegayAparraAchampionAlassiterAhawkAespositoAchoAwaldronAvernonAransomApratherAkeenanAjeanAgroverAchaconAvickAsandsAroarkAparrAmayberryAgreenbergAcoleyAbrunerAwhitmanAskaggsBhipmanAmeansAlearyAhuttonAromoAmedranoAladdAkruseAfriendAdarlingAaskewAvalentinAschulzAalfaroAtaborAmohrAgalloAbermudezApereiraAisaacAblissAreavesAflintAcomerAbostonAwoodallAnaquinAguevaraAearlAdelongAcarrierApickensAbrandAtilleyAschafferAreadAlimAknutsonAfentonAdoranAchuAvogtBannAprescottAmclainAlandisAcorcoranAambroseAzapataAhyattBemphillAfaulkAcallAdoveAboudreauxAaragonAwhitlockAtrejoBackettAshearerBaldanaAhanksAgoldAdriverAmckinnonAkoehlerAchampagneAbourgeoisApoolAkeyesAgoodsonAfooteAearlyAlunsfordAgoldsmithAfloodAwinslowAsamsAreaganAmccloudAhoughAesquivelAnaylorAloomisAcoronadoAludwigAbraswellBeardenAsherrillAhuangAfaganAezellBdmondsonAcyrBroninAnunnAlemonAguilloryBrierAduboseAtraylorAryderAdobbinsAcoyleAaponteAwhitmoreAsmallsArowanAmalloyAcardonaAbraxtonBordenAhumphriesAcarrascoAruffAmetzgerAhuntleyBinojosaAfinneyAmadsenAhongBillsAernstAdozierAburkhartBowserAperaltaAdaigleAwhittingtonAsorensonBaucedoArocheBeddingAloydAfugateAavalosAwaiteAlindAhustonBayAbenedictAhawthorneCmbyAboylesClesAreganAfaustAcrookAbeamBargerAhindsAgallardoAeliasAwilloughbyEinghamDburnAeckertAbuschAzepedaAworthingtonAtinsleyArussAliAhoffBawleyAcarmonaAvarelaArectorAnewcombAmalloryAkinseyAdubeAwhatleyAstrangeAragsdaleAivyAbernsteinCcerraAyostAmattsonAlyAfelderAcheekAlukeAhandyAgrossmanBauthierAescobedoAbradenBeckmanAmottAhillmanAgilAflahertyAdykesBoeAstocktonCearnsAloftonAkitchenAcoatsBavazosAbeaversBarriosAtangAparishAmosherAlincolnAcardwellBolesAburnhamAwellerAlemonsAbeebeAaguileraAringAparnellAharmanAcoutureAalleyAschumacherAreddAdobbsAblumCalockAmerchantAennisAdensonAcottrellBhesterAbrannonBagleyAavilesAwattAsousaArosenthalConeyAdietzAblankApaquetteAmcclellandAduffAvelascoAlentzAgrubbAburrowsBarbourAulrichAshockleyAraderAgermanAbeyerAmixonAlaytonAaltmanConzoAweathersAtitusAstonerBquiresBhippApriestAlipscombAcutlerBaballeroAzimmerAwillettAthurstonAstoreyAmedleyAlyleAeppersonAshahAmcmillianAbaggettAtorrezAlawsAhirschAdentAcoreyApoirierBeacheyAjacquesAfarrarAcreechAbarthAtrimbleAfranceAdupreAalbrechtAsampleAlawlerAcrispBonroyBhadwickAwetzelAnesbittAmurryAjamesonAwilhelmApattenAmintonBatsonAkimbroughAiversonAguinnBaleAfortuneAcroftAtothApulliamAnugentBewbyAlittlejohnAdiasAcanalesAbernierBaronDneyAsingletaryArenteriaApruettAmchughBabryAlandrumAbrowerAweldonAstoddardAruthAcagleAstjohnBcalesAkohlerBelloggAhopsonAgantAtharpAgannAzeiglerApringleAhammonsAfairchildAdeatonAchavisBarnesArowleyAmatlockAlibbyAkearnsAirizarryAcarringtonAstarkeyApepperAlopesAjarrellAfayAcravenAbeverlyBaumAspainAlittlefieldCnnAhumphreysBookBighAetheridgeAcuellarBhastainDnceAbundyAspeerBkeltonAquirozApyleBortilloCnderAmoultonBachadoAliuAkillianAhutsonBitchcockAellsworthAdowlingAcloudAburdickAspannApedersenAlevinCggettAhaywardCckerAdietrichAbeaulieuBarksdaleAwakefieldAsnowdenAparisAbriscoeBowieBermanAogleAmcgregorAlaughlinAhelmAburdenAwheatleyAschreiberApressleyBarrisAngAalanizBgeeAurbanAswannBnodgrassBchusterAradfordAmonkBattinglyCinAlamarAharpAgirardAcheneyAyanceyAwagonerAridleyAlombardoBauAhudginsAgaskinsAduckworthAcoeCburnAwilleyApradoAnewberryAmaganaAhammondsAelamAwhippleAsladeBernaAojedaAlilesAdormanBiehlAangelAuptonAreardonAmichaelsAkelseyAgoetzAellerAbaumanCerAaugustineAlayneAhummelAbrennerAamayaBdamsonAornelasAdowellAcloutierBhristyBastellanosAwingBellmanAsaylorAorourkeAmoyaCntalvoAkilpatrickAharleyAdurbinAshellAoldhamAkangAgarvinAfossAbranhamBartholomewAtempletonAmaguireAholtonAalonsoAriderAmonahanBccormackAbeatyAandersAstreeterAnietoDlsonAmoffettAlankfordAkeatingAheckAgatlinAdelatorreAcallawayAadcockAworrellAungerArobinetteAnowakAjeterAbrunnerAashtonAsteenAparrottAoverstreetAnoblesAmontanezAlutherAclevengerAbrinkleyAtrahanAquarlesApickeringBedersonAjansenAgranthamBilchristAcrespoAaikenAschellDaefferAlorenzBeyvaAharmsAdysonAwallisApeaseAleavittAhymanAchengBavanaughAbattsAwardenAseamanArockwellAquezadaApaxtonAlinderAhouckAfontaineAdurantAcarusoAadlerApimentelAmizeAlytleAdonaldAclearyBasonAackerAswitzerBalmonAisaacsAhigginbothamBanAwatermanAvandykeAstamperBiskBhulerAriddickBedmanAmcmahanAlevesqueAhattonAbronsonBollingerAarnettAokeefeAgerberBannonAfarnsworthAbaughmanAsilvermanBatterfieldAroyalAmccraryAkowalskiAjoyAgrigsbyCecoAcabralAtroutArinehartAmahonAlintonAgoodenAcurleyAbaughAwymanBeinerAschwabDulerAmorrisseyBahanAcoyAbunnAandrewAthrasherAspearAwaggonerAshelleyArobertAquallsApurdyAmcwhorterBauldinCrkAjordonAgilmanAperrymanAnewsomAmenardBartinoAgrafAbillingsleyAartisAsimpkinsBalisburyAquintanillaAgillilandAfraleyBoustAcrouseAscarboroughAngoAgrissomAfultzAricoAmarlowDkhamCdrigalAlawtonAbarfieldAwhitingAvarneyAschwarzAhueyAgoochAarceAwheatAtruongApoulinAmackenzieAleoneAhurtadoAselbyAgaitherAfortnerAculpepperBoughlinAbrinsonBoudreauBarkleyClesAsteppAholmAtanAschillingAmorrellAkahnAheatonAgamezAdouglassAcauseyAbrothersAturpinAshanksBchraderAmeekAisomAhardisonAcarranzaAyanezAwayAscrogginsChofieldArunyonBatcliffAmurrellBoellerAirbyAcurrierAbutterfieldAyeeAralstonApullenBinsonAestepBastAcarboneAlanceAhawksAellingtonAcasillasAspurlockBikesAmotleyBccartneyAkrugerAisbellAhouleAfranciscoAburkBoneAtomlinAshelbyAquigleyAneumannAlovelaceAfennellAcolbyBheathamAbustamanteAskidmoreAhidalgoAformanAculpAbowensBetancourtAaquinoArobbBeaAmilnerBartelAgreshamAwilesArickettsAgavinAdowdAcollazoAbosticBlakelyAsherrodApowerAkenyonAgandyAebertAdeloachAcaryAbullAallardAsauerArobinsAolivaresAgilletteAchestnutAbourqueApaineAlymanAhiteBauserAdevoreAcrawleyBhapaAvuAtobiasBalbertApoindexterAmillardBeadorBcduffieBattoxAkrausAharkinsAchoateAbessAwrenAsledgeBanbornAoutlawAkinderAgearyAcornwellAbarclayAadamBbneyAsewardArhoadsAhowlandAfortierAeasterAbennerAvinesAtubbsBroutmanArappAnoeAmccurdyAharderAdelucaAwestmorelandAsouthAhavensAguajardoAelyAclaryAsealAmeehanAherzogAguillenAashcraftAwaughArennerAmilamAjungAelrodAchurchillAbufordBreauxBolinAasherAwindhamAtiradoApembertonAnolenDandAknottAemmonsAcornishBhristensonAbrownleeBarbeeAwaldropApittAolveraAlombardiAgruberBaffneyAegglestonAbandaAarchuletaAstillBloneAprewittBfeifferAnettlesAmenaBcadamsAhenningAgardinerAcromwellBhisholmAburlesonBoxAvestAoglesbyAmccarterBalcolmAlumpkinBarueAgreyAwoffordAvanhornAthornBeelAswaffordBtclairCanfieldAocampoAherrmannBannonAarsenaultAroushAmcalisterAhiattAgundersonAforsytheAdugganBelvalleAcintronAwilksBeinsteinAuribeArizzoAnoyesAmclendonAgurleyAbetheaAwinsteadAmaplesAharryAguytonBiordanoAaldermanAvaldesApolancoBappasAlivelyAgroganCiffithsAboboAarevaloAwhitsonAsowellArendonAmatthewAjulianAfernandesBarrowAedmondAbenavidezAayresBliceaAstumpBmalleyBeitzBchulteAgilleyBallantAdeweyAcasperCnfieldAwolfordAomalleyAmcnuttEltyCgovernAhardmanDbinAcowartBhavarriaAbrinkBeckettBagwellAarmsteadBnglinBbreuAreynosoAkrebsAjettAhoffmannAgreenfieldAforteAburneyBroomeAsissonAparentAjudeAyoungerAtrammellApartridgeAmarvinCceAlomaxBemieuxAgossettAfrantzBogleAcooneyAbroughtonApenceBaulsenAneilAmuncyBcarthurAhollinsAedwardAbeauchampAwithersAosorioAmulliganAhoyleAfoyAdockeryAcockrellAbegleyAamadorArobyBainsAlindquistAgentileAeverhartAbohannonAwylieAthaoAsommersApurnellBalmaAfortinAdunningAbreedenAvailAphelanCanAmarxAcosbyClburnBhongAbolingBiddleAledesmaAgaddisAdenneyAchowAbuenoBerriosAwickerAtolliverBhibodeauxAnagleAlavoieAfiskAdoAcristAbarbosaAreedyAmarchAlocklearAkolbAhimesAbehrensCckwithEhamAweemsBahlAshorterCackelfordAreesAmuseAfreeAcerdaAvaladezAthibodeauAsaavedraAridgewayBeiterAmchenryBajorsAlachanceAkeatonAisraelAferraraBalconAclemensAblockerAapplegateApazAneedhamAmojicaAkuykendallAhamelAescamillaAdoughtyAburchettAainsworthAwilburAvidalAupchurchAthigpenAstraussBpruillBowersArigginsCckerAmccombsAharlowAgarnettAbuffingtonAyiAsoteloAolivasAnegreteAmoreyBaconAlogsdonBapointeAflorenceAcatheyAbigelowBelloAwestfallAstubblefieldApeakAlindleyAjeffreyAheinBawesAfarringtonAedgeAbreenBirchAwildeAsteedBepulvedaAreinhardtAproffittAminterBessinaBcnabbBaierAkeelerAgamboaAdonohueBexterAbashamAshinnAorlandoAcrooksBotaAbordersBillsBachmanAtisdaleBavaresAschmidApickardAjasperAgulleyAfonsecaAdelossantosAcondonBlancyAbatistaAwicksBadsworthAnewAmartellAloBittletonAisonAhaagAfolsomAbrumfieldCoylesCitoAmirelesBcdonnellAleclairAhamblinAgoughAfanningAbinderAwinfieldBhitworthAsorianoApalumboAnewkirkAmangumAhutchersonAcomstockBecilBarlinAbeallBairAwendtBattersCllingAputmanAotooleBlivaAmorleyBaresAlemusAkeenerAjefferyAhundleyAdialBamicoAbillupsAstrotherAmcfarlaneAlammAeavesAcrutcherBaraballoCntyAatwellAtaftAsilerArustBawlsEingsAprietoAnilesAmcneelyCafeeAhulseyBarlanCckneyAgalvezAescalanteAdelagarzaAcriderBharltonAbandyAwilbanksAstoweCeinbergBamsonArenfroAmastersonDsieAlanhamAhaskellCmrickAfortAdehartAcardAburdetteBransonBourneBabinAalemanAworthyAtibbsAsweatBmootBlackAparadisCckardAmullAluceAhoughtonAganttAfurmanAdannerAchristiansonAburgeBroderickAashfordBrndtBlmeidaAstallworthBhadeBearcyBagerAnoonanAmclemoreCintireBaxeyAlavigneAjobeAirelandAferrerBalkAedgarAcoffinAbyrnesAarandaBpodacaAstampsAroundsApeekAolmsteadAlewandowskiAkaminskiAherAdunawayAbrunsCackettAamatoAreichAmcclungAlacroixAkoontzAherrickBardestyAflandersAcousinsBloseBatoCdeAvickeryAshankAnagelAdupuisAcroteauBotterBableAstuckeyCineAporterfieldBauleyAnyeAmoffittAluAknudsenAhardwickAgoforthAdupontAbluntBarrowsDnhillAshullArashClphApennyAlorenzoCftisBemayAkitchensAhorvathAgrenierAfuchsBairbanksAculbertsonBalkinsAburnsideBeattieAashworthBlbertsonAwertzAvoBaughtCllejoAtyreeBurkCckBijerinaAsageApicardBetermanAotisAmarroquinEAlantzAhoangAdemarcoBailyAconeAberubeBarnetteAwhartonAstinnettBlocumBcanlonBanderApintoAmancusoAlimaAjudgeAheadleyAepsteinAcountsBlarksonBarnahanAbriceBorenAarteagaBdameAzookAwhittleEehurstBenzelAsaxtonArheaBeddickApuenteAhazelCndleyCggertyAearleyAdevlinBallasAchaffinBadyAahmedBcunaAsolanoBiglerApollackBendergrassAostranderAjanesAfrancoisBineAcrutchfieldBordellBhamberlinAbrubakerBaptisteAwillsonAreisAneeleyAmullinBercierAliraBaymanAkeelingAhigdonAguestAforresterAespinalAdionAchapinBarlAwarfieldAtoledoApulidoBeeblesAnagyAmontagueBelloAlearAjaegerAhoggAgraffAfurrAderrickAcaveCnadaAsolizApooreAmendenhallBclaurinBaestasAlowAgableAbeltBarrazaAtilleryAsneadApondAneillAmccullochDorkleAlightfootAhutchingsBollomanBarnessAdornAcouncilAbockAzielinskiAturleyBreadwellAstpierreCarlingBomersAoswaldAmerrickBarquisAivoryAeasterlingAbivensAtruittApostonBarryAontiverosBlivarezAnevilleAmoreauBedlinBaAlenzAknowltonAfairleyAcobbsBhisolmAbannisterAwoodworthAtolerAocasioAnoriegaBeumanAmoyeBilburnBcclanahanAlilleyAhanesAflanneryAdellingerBanielsonAcontiAblodgettBeersAweatherfordAstrainAkarrAhittAdenhamAcusterBobleBloughBasteelAbolducBatchelorAammonsAwhitlowAtierneyAstatenBibleyBeifertBchubertBalcedoAmattisonAlaneyAhaggardAgroomsAdixBeesAcromerBooksClsonBaswellAzarateAswisherBtaceyBhinAraganApridgenAmcveyBathenyAleighBafleurAfranzBerraroAduggerAwhitesideArigsbyAmcmurrayAlehmannBargeAjacobyAhildebrandBendrickCadrickAgoadAfincherAdruryAborgesAarchibaldBlbersAwoodcockAtrappAsoaresBeatonArichieAmonsonAluckettBindbergAkoppBeetonAhsuBealeyAgarveyCddyAfainAburchfieldBadgerAwentworthAstrandCackBpoonerBaucierClesArubyBicciAplunkettBannellAnessAlegerAhoyAfreitasBongAelizondoAduvalAchunBalvinAbeaudoinAurbinaAstockArickardApartinAmoeBcgrewCclintockAledouxAforsythBaisonAdevriesAbertrandAwassonAtiltonAscarbroughAprideAohAleungBarryAirvineAgarberAdenningAcorralClleyBastleberryAbowlinCganBealeBainesAtrueCiceArayburnAparkinsonCkAnunesAmcmillenAleahyDAkimmelAhiggsAfulmerAcardenAbedfordAtaggartAspearmanAregisterAprichardAmorrillAkoonceAheinzCdgesAguentherBriceAfindleyAearleAdoverAcreightonAbootheBayerAarreolaAvitaleBallesAseeAraneyApeterAosgoodAlowellAhanlonAburleyBoundsAwordenBeatherlyAvetterAtanakaAstiltnerBellAnevarezAmosbyCnteroBelanconAharterCmerAgobleBladdenBistCnnAakinAzaragozaAtownsBarverAsammonsAroysterAoreillyAmuirBoreheadAlusterAkingsleyBelsoAgrishamBlynnAbaumannAalvesAyountAtamayoDApatersonAoatesAmenendezAlongoAhargisAgreenleeBillenAdesantisAconoverAbreedloveAwayneAsumpterBchererAruppBeichertAherediaAfallonAcreelBohnBlemmonsBasasAbickfordBeltonBachAwillifordBhitcombAtennantAsutterBtullBessionsAmccallumBansonAlangloisAkeelDganAemanuelAdangeloDcyCmronAclappDntonAbankstonAtrinidadAoliveiraAmintzBcinnisBartensCbeAlasterAjolleyAirishAhildrethBefnerAglaserAduckettBemersAbrockmanBlaisBackAalcornBgnewAtoliverBiceAsongBeeleyAnajeraAmusserBcfallAlaplanteAgalvinAfajardoAdoanAcoyneCpleyBlawsonBheungAbaroneAwynneBoodleyAtremblayAstollBparrowEkmanBchweitzerBasserCmplesAroneyBamonAleggBaiAjoeAheimAfariasAconcepcionClwellBhristmanAbratcherAalbaAwinchesterAupshawAsoutherlandCrrellBhayBellsAmountBccloskeyBartindaleAluttrellBovelessEjoyBinaresBatimerAhollyAembryAcoombsAbrattonBostickDsAvenableAtuggleBoroAstaggsBandlinAjefferiesAheckmanAgriffisAcraytonBlemAbuttonBrowderAallanAthortonAsturgillBprouseAroyerCusseauBidenourApogueBeralesCeplesAmetzlerCsaBccutcheonCbeeAjayAhornsbyBeffnerAcorriganAarmijoAvueAromeoAplanteBeytonBaredesAmacklinAhusseyBodgsonAgranadosAfriasAcarmanAbrentBecnelBattenAalmanzaAturneyBealAsturgeonAmeekerBcdanielsAlimonAkeeneyDAhuttoBolguinAgorhamAfishmanCerroAblanchetteArodrigueBeddyAosburnBdenAlermaAkirkwoodBeeferAhaugenCmmettAchalmersBarlosAbrinkmanBaumgartnerAzhangAvalerioAtellezAsteffenBhumateBaulsAripleyAkemperAjacksAguffeyAeversAcraddockBarvalhoAblaylockBanuelosClderasAwoodenBheatonAturnbullAshumanApointerAmosierBccueAligonAkozlowskiAjohansenAingleAherrAbrionesAsouthernBnipesArickmanApipkinBeaceBantojaAoroscoAmonizAlawlessAkunkelAhibbardAgalarzaAenosAbusseyAsettleBchottBalcidoAperreaultAmcdougalCcoolAhaightAgarrisAferryAeastonAconyersAathertonAwimberlyAutleyAstephenBpellmanBmithsonBlagleBkipperAritcheyBandApetitAosullivanBaksAnuttAmcvayCcrearyBayhewAknollAjewettAharwoodCileyAcardozaAasheBrriagaBndresAzellerAwirthBhitmireAstaufferBpringArountreeBeddenAmccaffreyBartzAlovingBaroseCngdonAhumesAgaskinAfaberAdollBevitoAcassAalmondAwingfieldEateAvillarealAtynerAsmothersBeversonArenoApennellAmaupinAleightonAjanssenAhassellCllmanDcombAfolseBitzsimmonsBaheyAcranfordAbolenBattlesEagliaAwooldridgeBeedAtraskArosserBegaladoAmcewenAkeefeAfuquaAechevarriaAdomingoBangAcaroAboyntonAandrusAwildAvieraBanmeterAtaberAspradlinBeibertAprovostCenticeAoliphantAlaporteAhwangBatchettCssAgreinerAfreedmanAcovertBhiltonAbyarsAwieseAvenegasAswankBhraderAroderickCbergeAmullisBortensenBccuneBarloweAkirchnerBeckAisaacsonAhostetlerBalversonAguntherBriswoldBerardAfennerAdurdenAblackwoodBertramAahrensAsawyersCvoyAnaborsAmcswainBackayAloyBavenderCshCbbeAjessupAhubertAfullertonAdonnellAcruseCittendenBorreiaBentenoBaudleCnadyCllenderAalarconBhernAwinfreyAtribbleBomAstylesBalleyArodenAmusgroveBinnickAfortenberryAcarrionAbuntingBethelBatisteAwooBhitedAunderhillAstillwellBilviaArauchApippinBerrinAmessengerBanciniAlisterAkinardAhartmannAfleckAbroadwayAwiltAtreadwayBhornhillAspeedCaldingBamAraffertyApitreBatinoAordonezAlinkousAkelleherAhomanClidayAgalbraithAfeeneyAdorrisAcurtinBowardBamarilloAbussCnnellBoltBeelerAautryBlcalaAwitteBentzAstidhamBhivelyAnunleyAmeachamBartinsAlemkeCfebvreAkayeAhynesBorowitzCppeClcombeAestrellaAdunneBerrAcochraneAbrittainBedardCauregardAtorrenceAstrunkBoriaBimonsonBhumakerBcogginsApackerAoconnerAmoriartyAleroyAkuntzAivesAhutchesonBoranBalesAgarmonAfittsAdellAbohnAatchisonAworthBisniewskiCllAvanwinkleAsturmBalleeAprosserAmoenAlundbergAkunzBohlBeaneAjorgensonBaynesAfunderburkBreedCameAdurrAcreamerBosgroveBandelariaAberlinBatsonAvanhooseAthomsenBeeterAsommerBmythBenaAredmonAorellanaAmanessAlennonAheflinAgouletAfrickBorneyAdollarAbunkerAasburyBguiarAtalbottAsouthardApleasantAmoweryBearsAlemmonAkriegerAhicksonAgraciaAelstonAduongBelgadilloBaytonCsilvaAconawayBatronAbrutonCadburyBordelonBivinsCttnerBergstromCalsAabellAwhelanAtraversBejadaApulleyBinoAnorfleetBealyAmaesAloperAheldAgeraldBatewoodAfriersonCeundBinneganAcuppBoveyBatalanoAboehmBaderAyoonAwalstonAtenneyAsipesArollerBawlinsAmedlockBccaskillEllisterBarcotteCcleanAhugheyBenkeBarwellAgladneyBilsonAdewAchismBaskeyAbrandenburgBaylorAvillasenorBealBanAthatcherAstegallBhoreApetrieAnowlinBavarreteAmuhammadAlombardCftinBemasterAkrollBovachBimbrellCdwellAhershbergerAfulcherAengAcantwellAbustosBolandCbbittBinkleyAwesterCisAverdinAtongBillerAsiscoBharkeyBeymoreArosenbaumChrAquinonezApinkstonAnationAmalleyAlogueBessardCrnerCbronAkraussBlingerAhalsteadDlerAgetzAburrowBrantAalgerAvictorAshoresBcullyApoundsBfeiferBerronAnelmsAmunnBcmasterCkenneyBannsAknudsonAhutchensCskeyAgoebelAflaggAcushmanBlickBastellanoCrderAbumgarnerBlaineBibleAwamplerAspinksArobsonAneelAmcreynoldsBathiasCasAloeraAkasperAjoseBensonAflorezAcoonsAbuckinghamBroganBerrymanAwilmothDhiteAthrashAshephardBeidelBchulzeAroldanApettisAobryanAmakiCckieAhatleyAfrazerBioreBallsAchesserAbuiBottomsBissonBenefieldAallmanAwilkeAtrudeauBimmAshifflettArauAmundyBillikenBayersAleakeAkohnAhuntingtonBorsleyBermannAguerinAfryerCizzellBoretBlemmingBifeAcriswellBarbajalAbozemanCisvertAarchieBntonioCguloAwallenAtappAsilversAramsayAosheaBrtaAmollBckeeverCgeheeAlucianoBinvilleAkieferBetchumAhowertonAgroceBaylordCssAfuscoAcorbittAblytheBetzBartelsAamaralBielloAyooAweddleAtroyAsunBperryBeilerArunyanBaleyAoverbyBsteenBldsAmckeownBauroCtneyAlauerCttimoreAhindmanBartwellAfredricksonEericksAespinoAcleggBarswellCmbellAburkholderAaugustAwoodburyBelkerAtottenBhornburgCeriaultAstittCammDckhouseBimoneBchollBaxonArifeBazoAquinlanApinkertonAolivoAnesmithBallAmattosAleakBaffertyAjustusAgironBeerAfielderAeagleAdraytonBortchAconnersDgerBhauAboatwrightBilliotBardenAarmentaBntoineAtibbettsAsteadmanBlatteryBidesArinaldiBaynorDfordApinckneyBettigrewAnickelAmilneBattesonAhalseyAgonsalvesAfellowsAdurandBesimoneAcowleyFsAbrillBarhamDelaDbaAashmoreAwithrowAvalentiAtejedaAspriggsBayreClernoAplaceBeltierCelAmerrimanBathesonAlowmanBindstromAhylandBomerBaAgirouxAfriesCasierAearlsAdugasBamonCbneyAcolladoAbrisenoBaxleyAandreAwordBhyteBengerAvanoverDburenAthielAschindlerEllerArigbyApomeroyBassmoreAmarbleCnzoChaffeyAlindgrenBaflammeAgreathouseAfiteBerrariAcalabreseAbayneAyamamotoAwickAtownesBhamesAsteelAreinhartApeelerAnaranjoAmontezBcdadeBastCrkleyDchandAleeperAkongBellumAhudgensBennesseyBaddenAguessBaineyAcoppolaAborregoCllingBeaneAaultAslatonApolandBapeAnullAmulkeyAlightnerBangerAhillardAglasgowAfabianAethridgeBnrightAderosaAbaskinAalfredAweinbergAturmanBinkerAsomervilleApardoAnollAlashleyAingrahamAhillerBendonAglazeAfloraAcothranCokseyCnteBarricoAappleBbnerAwooleyAswopeBummerlinBturgisEdivantCottBpurgeonCillmanCeightArousselApoppAnutterAmckeonBazzaCgnusonAlanningAkozakAjankowskiAheywardAforsterAcorwinBallaghanAbaysAworthamAusherAtheriotAsayersCboArupertApolingAnathanAloyaBiebermanBeviBarocheCbelleAhowesBarrAgarayAfogartyAeversonAdurkinBominquezAchavesDmblissAalfonsoAwitcherClberAvieiraBandiverAterrillAstokerBchreinerAnestorAmoormanAliddellBewBawhornAkrugAironsAhyltonBollenbeckBerrinCmbreeBairAgoolsbyDdinBilmerAfoltzAdinkinsBaughtryAcabanAbrimDleyBilodeauBearAwyantAvergaraAtallentAswearingenBtroupBherryBcribnerArogerAquillenApitmanAmonacoBccantsBaxfieldCrtinsonAlandonAholtzAflournoyAbrookinsDdyBaumgardnerAangeloAstraubBillsAroybalCundtreeAoswaltAmoneyBcgriffCdougallCclearyBaggardAgraggBoodingCdinezAdoolittleCnatoAcowellBassellAbrackenAappelBhmadAzambranoAreuterApereaAoliveAnakamuraAmonaghanBickensBcclintonEaryBarlerAkishAjudkinsAgilbreathAfreeseBlaniganBeltsAerdmannAdoddsAchewAbrownellCazilBoatrightBarretoAslaytonBandbergCldivarApettwayAodumAnarvaezAmoultrieCntemayorBerrellAleesAkeyserAhokeBardawayCnnanAgilbertsonAfoggAdumontBeberryAcogginsBarreraAbuxtonCcherBroadnaxBeesonAaraujoBppletonBmundsonBguayoBckleyAyocumAworshamAshiversCellyBanchesCccoArobeyBhodenApenderAochsAmccurryBaderaAluongCisAknottsAjackmanAheinrichBargraveAgaultAforestAcomeauxBhitwoodDldBarawayAboettcherBernhardtBarrientosAzinkAwickhamBhitemanAthorpAstillmanBettlesBchoonoverAroqueBiddellBeyApilcherBhiferAnovotnyAmapleCcleodAhardeeCaseAgriderAfredrickAearnestAdoucetteAclausenBhristmasAbevinsCamonBadilloAtolleyBindallAsouleBnookBebastianCaleApitcherCnkneyBellegrinoAnowellBemethBailAmondragonBclaneAlundgrenAingallsAhudspethBixsonAgearhartAfurlongAdownesBionneCbbleBeyoungAcornejoBamaraAbrookshireBoyetteAwolcottAtraceyAsurrattBellarsCgalBalyerAreeveBauschAphilipsAlabonteAharoAgowerAfreelandBawcettAeadsAdriggersBonleyAcollettBageAbromleyBoatmanBallingerDdridgeAvolzAtrombleyAstongeBilasBhanahanArivardBhyneApedrozaAmatiasCllardAjamiesonAhedgepethBartnettAestevezCkridgeAdenmanAchiuDnnBatlettCrmackAbuieBookBechtelCardsleyBardCllouAwindsorAulmerAstormBkeenArobledoBinconBeitzApiazzaBearlAmungerBotenBcmichaelAloftusBedetAkerseyAgroffAfowlkesClkAcrumptonBolletteBlouseAbettisAvillagomezAtimmermanAstromBaulCntoroAroddyAphillipBenrodAmusselmanBacphersonAleboeufAharlessCddadAguidoBoldingAfulkersonBanninAdulaneyBowdellBeaneAcottleBejaBateAbosleyBengeAalbrittonAvoigtAtrowbridgeAsoileauBeelyAromeChdeApearsallBaulkAorthAnasonAmotaBcmullinBarquardtCdiganAhoagAgillumBayleCbbardAfenwickDderAeckAdanforthAcushingBressDedBazaresCsanovaAbeyCttencourtBarringerCberAstansberryBchrammArutterBiveroBaceAoquendoAnecaiseAmoutonCntenegroBileyBcgoughBarraCcmillanAlockBamontagneAjassoCimeAhorstBetrickCilmanAgaytanCllAfriedBortneyAedenAdingleBesjardinsBabbsAburbankBrighamCelandBeamanBannerAarriolaAyarboroughAwallinAtreatBoscanoAstowersAreissApichardoAortonAmitchelCchelsBcnameeCcroryAleathermanAkellCisterAjeromeAhorningBargettAguayAfridayBerroAdeboerBagostinoAclementeBhristBarperAbowlerBlanksBeaudryAwillieAtowleBafoyaAstricklinDaderBoperCnnierBigmonBchenkBaddlerArodmanApedigoAmendesAlunnBohrBahrAkingsburyAjarmanAhumeBollimanCfmannBaworthCrrelsonCmbrickAflickAedmundsAdacostaAcrossmanBolstonBhaplinBarrellAbuddAweilerBaitsAviolaBalentinoAtranthamBarrAstraightBolorioAroebuckApoweBlankBettusBalmCganoAminkAlukerBeathersAjoslinAhartzellAgambrellAfearsAdeutschAcepedaBartyCputoAbrewingtonBedellBallewAapplewhiteAwarnockClzAurenaAtudorAreelApiggBartonAmickelsonBeagherBclellanCculleyBandelAleechBavalleeAkraemerBlingBippCngstonBehoeAhochstetlerBarrimanAgregoireCabowskiBosselinBammonAfancherAedensAdesaiAbuttBrannanAarmendarizAwoolseyBhitehouseCetstoneAusseryAtowneDerBestaBallmanAstuderCraitCeinmetzBorrellsBaucedaArolfeBaeApaddockAmitchemBcginnCcreaAluckBovatoBingAhazenAgilpinBaynorAfikeAdevoeClrioAcurielAburkhardtBristolBodeBackusAaltonAzinnAwatanabeCchterAvanpeltAturnageAshanerBchroderBatoAriordanAquimbyAportisAnataleAmckoyCcownBarkerAlucioAkilmerBarlAhotchkissBesseBalbertAgwinnBodseyAdesmondClisleAchrismanBanterAbrookAarbogastBngellBcreeAyancyAwoolleyBessonCatherspoonAtrainorAstockmanBpillerBipeArooksBeavisApropstBorrasAneilsonAmullensAloucksBlewellynBamontAkumarBoesterBlingensmithBirschBesterAhonakerCdsonBennessyClmickAgarrityDibayAfeeAdrainAcasarezCllisAbotelloBayAaycockBvantBngleAwingardBaymanAtullyBheisenAszymanskiBtansburyBegoviaArudyBainwaterApreeceBirtleBadronAminceyBckelveyBathesCrtyAlarrabeeAkornegayBlugAjudyAingersollAhechtAgermainAeggersAdykstraBenisCeringCcoteauCasonDringAcofieldBarriganAbrushBonhamBahrAaucoinBpplebyBlmonteAyagerAwombleBimmerBeimerAvanderpoolAstancilBprinkleAromineBemingtonApfaffBeckhamAoliveraAmerazBazeAlathropAkoehnAjonasAhazeltonClvorsonDlockCddockAducharmeBehavenAcoltonBaruthersAbrehmBosworthDtBlowBiasBeemanBasileCneAaikensAzacharyAwoldBaltherAtabbAsuberBtrawnCocksFerBhireyBchlosserBalvadorAriedelBembertCimerApylesBickleBeeleAmerriweatherAletourneauBattaAkidderAhixonCllisCghtBerbstCnriquezBaygoodCmillAgabelAfrittsAeubankAdutyBawesAcorrellCffeeBhaAbusheyCchholzBrothertonCidgeBottsBarnwellAaugerBtchleyAwestphalAveilleuxAulloaAtrumanAstutzmanBhriverAryalsApriorBilkingtonAnewportAmoyersBiracleBarrsCngrumCdduxAlockardBaingAkuhlAharneyCmmockDlettAfelkerAdoerrBepriestAcarrasquilloDothersAbogleBloodBischoffBergenAalbaneseAwyckoffAvermillionBansickleAthibaultBetreaultAstickneyBhoemakeAruggieroBawsonCcineAphilpotBaschalAmcelhaneyBathisonAlegrandBapierreAkwanBremerAjilesAhilbertAgeyerAfairclothAehlersBgbertAdesrosiersBalrympleAcottenBashmanCdenaAbreedingBoardmanAalcarazBhnAwyrickAtherrienBankersleyAstricklerApuryearBlourdeBattisonCrdueAmilanBcgintyCevoyAlandrethAkuhnsBoonAhewettAgiddensAeveretteBmerickBadesAdeangelisAcosmeBeballosAbirdsongBenhamCmisAarmourBnguianoDelesAwelbornAtsosieAstormsBhoupBessomsBamaniegoAroodCjoBhinehartBabyAnorthcuttAmyerBunguiaBorehouseEBcdevittBateoCllettAlozadaBemoineAkuehnAhallettAgrimBillardBaylorCrmanCllaherAfeasterBarisAdarrowDdarAconeyBarreonAbyronBraithwaiteBoylanDettCrnBixlerCghamBenfordBarraganDnumAzuberAwycheBestcottAviningAstoltzfusBimondsBhupeBabinArubleBittenhouseCchmanAperroneAmulhollandBillanBeisterBathewAlomeliAkiteAjemisonAhulettBollerBickersonBeroldBazelwoodAgriffenBauseAfordeAeisenbergAdilworthAcharronDissonAbrodieCistowCeunigCaceBoutwellBentzClkBaylessCtchelderCranCezaAzimmermannAweathersbyAvolkAtooleBheisBedescoAshineBearleBchenckBatterwhiteCndyAruelasBoyceBankinsApartidaAnesbitAmorelBenchacaAlevasseurAkaylorAjohnstoneAhulseBollarBerseyBarriganDbisonAguyerBishCeseBerlachCllerCislerAfalconeAernestBlwellAdoucetBeeseBarrAcorderBhafinAbylerBussellCrdettBrasherBoweBellingerBastianCrnerAalleyneAwilbornBeilCgnerBalesAtatroAspitzerBmithersBchoenAresendezApeteBarisiAovermanBbrianAmuddBoyBclarenBahlerCggioAlindnerBalondeCcasseCboyAkillionBahlAjessenBamersonAhoukBenshawAgustinBroomCaberAdurstCenasBaveyAcundiffBonlonClungaCakleyBhilesBapersAbuellBrickerBissonnetteCrminghamBartzCgbyAzayasAvolpeAtreeceBoombsBhomBerrazasAswinneyBkilesBilveiraBhouseBennAramboDageAnezAmouaBarlinClikAlanghamAkylesAholstonCaglandBerdCctorAfellerAemoryAdenisonAcorlissBarrawayAburfordBickelAambrizBbercrombieAyamadaAwinnerBeidnerBaddleAverduzcoAthurmondAswindleBchrockBanabriaArosenbergerAprobstBeabodyAolingerAneighborsBazarioAmccaffertyCbroomCabeeBazurCtherneCpesAleverettAkillingsworthAheislerAgriegoCandeBosnellAfrankelGBerranteCnnAelmerBhrlichAchristophersoCickCasseDncellorBatonAbrunelleBlyCoomfieldBabbittAazevedoBbramsonClesCeytaAyoumansAwozniakBainwrightAsummerBtowellBmithermanBitesBamuelsonArungeCleBothmanCsenfeldAquanApeakeAoxfordBwingsBlmosAmunroBoreiraAleatherwoodBarkinsAkrantzBovacsBizerCndredBarnesAjaffeAhubbellBoseyBauckCroldAgoodellAfavorsAerdmanAdvorakBoaneAcuretonBoferAbuehlerBiermanBerndtBantaAannisBbramCdullahAwarwickCltzAturcotteBrinhBorreyAstithBegerBachsAquesadaApinderBeppersBascualEhallCrkhurstAozunaBsterAnichollsAmortimerAlheureuxBavalleyAkimuraAjablonskiAhaunAgourleyBilliganAfixAderbyAcroyBottoBargillAburwellDgettCckmanBrettBooherAadornoAwrennBhittemoreAuriasAszaboBaylesCizArutlandBaelAplantBharrBenneyClkeyAogradyAnickellAmusickBoatsBatherCssaAlaurentAkirschnerCefferBellarAhendershotAgottCdoyBadsonAfurtadoBiedlerAerskineBdisonAdutcherBeverBaggettAchevalierCaoAbrakeBallesterosAamersonBlejandroAwingoBaldonAtrottAspikesBilveyBhowersBchlegelArueBitzApepinClayoBarsleyClermoAmooreheadBchaleAlettAkocherBilburnAiglesiasAhumbleClbertCckabyBixBavenCrtfordDdimanAgurneyBriggCassoBoingsAfillmoreBarberAdepewBandreaCmeAcowenCvarrubiasCryAburrusBracyAardoinAthompkinsAsuzukiBtandleyArusselBadcliffeApohlBersaudDcyBarenteauCbonAnewsonDhouseBapolitanoAmulcahyBayaClaveAkeimAhootenBernandesCffernanCarneAgreenleafBlickAfuhrmanBetterBariaAdishmanCckensonAcritesDssBlapperBhenaultBastorFAbuggBoveCnneyBlessingAardBndertonBllgoodCdersonAwoodmanBisdomBarrickAtoomeyDleyBarrantAsummervilleBtebbinsBokolBinkBearlesBchutzEmannDeerAremillardBaperAproulxBalmoreAmonroyBiguelBessierCloDansonBashburnCnzanoAlussierBovelyBienAjenksAhuneycuttBartwigAgrimsleyAfulkBieldingCdlerAengstromBldredAdantzlerAcrandellBhingBalderAbrumleyCetonCannDmlettBoykinsBiancoBancroftAalmarazCcantarAwhitmerEenerBeltonAvineyardAsuArahnApaquinAmizellCxBcmillinCkeanBarstonCcielAlundquistBouieBigginsBampkinAkranzBoskiBirkhamAjiminezAhazzardCrrodAgrazianoDmmerBendronBarridoAfordhamAenglertBlwoodAdrydenBemossClunaAcrabbBomeauBlaudioAbrummettBlumeBenallyAwesselAvanbuskirkAthorsonAstumpfCockwellAroccoBeamsBadtkeCckleyApeltonAniemiBewlandClsenAmorrissetteBiramontesBcginleyCcluskeyBarleyDchantAluevanoBampeCilAjeffcoatAinfanteAhuBinmanAgaonaAerbBadyAdesmaraisCcostaBansbyAciscoBhoeAbreckenridgeBostwickCrgBianchiBeerAalbertsBdrianAwilkieBhortonAvargoAtaitAsylviaBoucyBchumanAousleyAmumfordAlumBippertBeathBavergneCliberteAkirkseyBennerAjohnsenAizzoAhilesAgullettBreenwellBasparClbreathCitanAericsonAduckBelapazAcroomBottinghamBliftAbushnellBoozerBiceBernardoCasonAarrowoodAwaringAvoorheesAtruaxAshreveCockeyBchatzBandiferArubinoBozierCseberryCllAplayerBieperBedenAnesterBaveAmurpheyBalinowskiCcgregorAliangBafranceAkunkleBirkmanAjorgeAhippBastyCddixAgervaisDdesBarfieldCmacheAfoutsBitzwaterAdillinghamBemingCandaAcedenoBannadyAbursonBouldinAarceneauxAwoodhouseBhitfordBescottCltyCigelAtorgersonCmsAsurberCnderlandBternerBetzerBalvatoreAriojasApumphreyCgaBedroBatchAmettsBcgarryCcandlessBagillAlupoBovelandBlamasBeclercAkoonsBahlerAhussBolbertBeintzBauptAgrimmettBaskillAflowerAellingsonAdorrBingessBeweeseCsilvaAcrossleyBordeiroCnverseDdeBheeksBalderaCirnsAburmeisterDkhalterBrawnerBottAyoungsAvierraBalladaresAtiffanyAshrumDopshireBevillaAruskBoofCdarteApedrazaAninoAmontanaBerinoBcminnBarkleCppAluciaBajoieAkoernerBittrellBatoAhyderBollifieldBeiserBazlettAgreenwaldAfantAeldredgeAdreherBelafuenteAcravensBlaypoolAbeecherAaronsonBlanisAworthenCjcikBingerBhitacreBellingtonAvalverdeDdiviaAtroupeBhrowerAswindellButtlesChBtromanBpiresBlateBhealyBarverDtinCdowskiArondeauClonBickBexBasconApriddyBineBaulinoAnolteAmunroeBolloyBellonBciverAlykinsBogginsBillieBenoirAklotzBempfAjoneAhuppBollowellEanderBaynieCssanCrknessEerAgottliebAfrithAeddinsAdriskellBoggettBensmoreAcharetteBassadyCrrolAbyrumBurchamCggsBennAwhittedBarringtonAvandusenCillancourtAstegerBpellBiebertBcofieldAquirkApurserBlumbAorcuttAnorthernDdstromAmoselyBichalskiBcphailCdavidCcrawBartiniDcheseCnninoAleoCfevreBargentCnzaAkressAishamAhunsakerBochBildebrandtAguarinoBrijalvaCaybillAfickAewellCaldAdeangeloAcusickBrumleyBostonBathcartCrruthersAbullingtonBrianBowesBlainDckfordBarbozaAyinglingAwoodlandBertCilandAvargaAsilversteinCeversBhusterDmwayBcudderArunnelsCmseyBenfroeAprovencherBolleyAmohlerBiddlebrooksAkutzBosterCrnAgrowDthBliddenAfazioAdeenAcornCpperBhipmanCenowethCamplinBedilloBarreroDmodyAbucklesBrienBoutinCschBillBerkowitzAaltamiranoAwilfongCegandBaitesAtruesdaleBoussaintCbeyBedderAsteelmanBiroisBchnellArobichaudBidgeCchburgAprayBlumleyBizarroCercyAortegoBbergAneaceAmusicBickeyBertzBcnewBattaAlawyerCppCirAkiblerAjessieAhowlettCllisterCferBattenCglerAgermanyAfalgoustAengelhardtBberleBastwoodAdombrowskiBinsmoreBayeAcoolBasaresCponeAbraudBalchAautreyAwendelAtyndallBoyAstrobelColtzBpinelliBerratoArochesterBeberCalBathboneApalominoAnoahBickelsAmayleCthersCchAloefflerBittrellBevinsonCongCmireCjeuneBazoCsleyAkollerBennardAjesterAhoelscherBintzBagermanAgreavesAforeAeudyBnglerAcorralesDdesAbrunetBidwellBennetBareAtyrrellBharpeAswintonBtriblingCevenBouthworthBisnerosBhaneBavoieCmonsAruvalcabaBoscoeBiesBamerAomaraAmosquedaBillarBcpeakBacomberAluckeyBittonBehrBavinAhubbsBoardBibbsBagansAfutrellAexumBvensonAdicksAcullerBhouBarbaughCllenAbrashearBloomerCakeneyBiglerAaddingtonAwoodfordBitterAunruhAtolentinoAsumrallBtgermainBmockBhererBalemArochelleBaynerApoolerAoquinnAneroAmilanoBcglothlinBarsAlindenAkowalBerriganAibrahimAharvellCnrahanAgoodallBeistAfussellCngBerebeeCdericoAeleyBggertAdorsettBingmanBestefanoAcolucciBlemmerBaesarAburnellBrumbaughBoddieBerryhillAavelarBlcantaraBbbeyAwinderDchellAvandenbergAtrotmanBhurberCibeaultAstlouisCilwellBperlingBhattuckBarmientoAruppertCmphBenaudBandazzoCdemacherAquilesApearmanBalomoAmercurioAlowreyBindemanBawlorCrosaCnderCbrecqueAkimberAhovisClifieldBenningerBawkesCrtfieldCnnCgueAgenoveseBarrickAfudgeBrinkAeddingsAdinhBearAcutterBribbsBonstantBalvilloAbuntonBrodeurBoldingBlandingAagostoAzahnAwienerAtrussellBewClloCixeiraAstephanBpeckBharmaDnklinBealyBcanlanBantamariaAroundyCbichauxBingerCgneyAprevostBolsonBhilipBassAnordAmoxleyChammedBedfordBccaslinCardleBacarthurAlewinBasherAketchamCiserAheineBackworthAgroseCizzleCassBillmanBartnerEhAfrazeeBleuryBastAedsonCmonsonAderryCckAcronkBonantAburressDginBroomDckingtonBolickCgerBirchfieldCllingtonBailyChenaAarmbrusterBnsonAyohoAwilcherAtinneyCmberlakeBhomaCielenAsutphinBtultzBikoraBerraBchulmanDefflerBantillanArobinBegoApreciadoBinkhamAmondayBickleAluuBomasBizotteBentDardAkellermanCilAjuanBohansonAhernadezBartsfieldCngCberAgorskiAfarkasAeberhardtAduquetteBelanoAcropperBozartCckerhamBhambleeBartagenaChoonAbuzzellBristerCewtonBlackshearBenfieldAastonChburnBrrudaAwetmoreCiseAvaccaroAtucciAsudduthBtrombergCoopsBhowalterCearsArunionBowdenCsenblumBiffleBenfrowAperesAobryantAnicolasAleftwichBarkCnderosAkistlerClloughBerleyBastnerAhoggardBartungAguertinBovanBatlingCileyAfullmerDfordBlattAesquibelBndicottBdmistonCelsteinAdufresneBresslerBickmanAcheeAbusseBonnettCgartBerardBarringtonAarenaBntonAyoshidaAvelardeCachBanhoutenCchonAtolsonDmanBennysonAstitesBolerBhuttArugglesBhoneApeguesAongAneeseAmuroBoncriefBeffordBcpheeCmorrisCeachernCclurgBansourCiCderAleijaCcompteBafountainCbrieAjaquezAhealdBashCrtleAgainerAfrisbyBarinaAeidsonBdgertonAdykeBurrettChonAcuomoBobosBervantezAbybeeBrockwayBorowskiBinionBeeryAarguelloBmaroBctonAyuenAwintonCgfallBeekleyAvidrineBannoyAtardiffAshoopCillingBchickBandCffordAprendergastBilgrimBellerinAosunaAnissenBalleyAmoritzCllerBessnerEickCrryEifieldBcguinnessBatherlyCrcanoChoneAlemosCbrunAjaraAhofferBewlettCrrenCckerBawsCugCckAgwinBoberBilliardAfredetteBavelaAecheverriaAdownerCnofrioBesrochersCeAcrozierBorsonBlydeAbechtoldAarguetaBparicioAzamudioAwilletteBestoverEermanAutterAtroyerBhiesBapleyAslavinBhirkBandlerAroopBimmerBaymerCngeCdcliffAottenAmoorerBilletBckibbenCcutchenCavoyDdooBayorgaCstinCrtineauDekCdoreAlefloreAkroegerBennonAjimersonBavierAhostetterCrnbackBendleyBanceAguardadoBranadoBowenCodaleAflinnCeetwoodBitzAdurkeeCpreyBipietroClleyAclyburnAbrawleyBeckleyAaranaAweatherbyAvollmerBictoriaBestalAtunnellBriggBingleBakahashiAsweattBtorerBnappBhiverArookerBedBathbunApoissonBerrineFBastorCrmerDkeDeCpaClmieriAnottinghamAmidkiffBechamBccomasCalpineAloveladyBillardBallyAknoppBileCgerAhaileAguptaBoldsberryBilreathAfulksBriesenCanzenBlackBindlayBerlandAdreyerBoreBennardCckardCboseAcrimBoulombeCrkBhanceyBantorAbrantonBissellBarnsAwoolardBithamBassermanCldoAspiegelBhoffnerBcholzAruchBossmanBeadyApetryBalacioCezAnearyAmortensonBillsapCeleCckBenkeBckimCanallyBartinesCnorClcomAlemleyBarochelleAklausDttBaufmannCppAhelmerCdgeBalloranAglissonAfrechetteBontanaAenochBaganAdrumBistefanoBanleyAcreekmoreBhartierDffeeBarilloAburgBolingerBerkleyCnzBassoDhCrrierAzelayaAwoodringBitkowskiClmotDkensCelandAvirgilBerdugoAurquhartAtsaiBimmsAswigerCaimBussmanBcarlettApiresAmolnarBcateeBauriceAlowderCosBinkerBandesAkingeryBeeleyAhuffordBigaBendrenBammackDannAgillamBerhardtAfellAeugeneBdelmanBbyAdelkCansAcurlBonstantineBleaverCaarBasianoCrruthDlyleAbumpBrophyBolanosBibbsBessetteCggsBaugherCrtelAaverillBndresenBminBldenBdamesAwildmanAviaBalenteAturnbowBseAswinkBublettBtrohDingfellowAridgwayApuglieseBoteatBangAohareAneubauerAmurchisonBohamedBingoAluckyBemmonsAkwonBellamCanAjarmonAhydenBudakBollingerBenkelCmingwayBassonCnselClterCireAgoodnightBinsbergCllispieAfogelBloryAetterBlledgeBckmanAdeasAcurrinBraftonBoomerClterBlaxtonAbulterBraddockBowyerBlizzardBinnsDgBellowsBaskervilleCrrosAansleyAwoolfBightBaldmanCdleyAtullBrullBeschAstruckCoufferCadlerBlayBhubertBedilloBantacruzAreinkeBaleighApoynterAneriCaleBatividadAmowryCralezCngerBitchumBerrymanBanionCcdougallAluxBitchfieldBeyCvittCpageBasalleCineAkhouryBavanaghCrnsAivieAhuebnerBodgkinsBalpinAgaricaAeversoleAdutraCnaganCffeyBillmanEionBevilleCarbornBamatoAcoursonDlsonAburdineBryceBousquetCninBishAatencioAwestbrooksBagesAvacaAtyeBonerCmasBillisAswettBurfaceBtrubleCanfillBonClorzanoBlusherBippleCmClvasBhultsBchexnayderBaezArodasBagerApulverBlazaBentonBaniaguaAmenesesBcfarlinCauleyBatzCloyCgruderAlohmanBandaCcombeAjaimesAhomClzerDstBeilBacklerAgrundyCegorBilkeyAfarnhamAdurfeeCntonDstonCdaBewsBanaAcraverBorriveauCnwellClellaBhamblessAbremerBoutteDrassaBlaisdellBackmanCbineauxAaudetteBllemanAtownerBaverasCrangoAsullinsCiterBtallardBolbergBchlueterApoulosBimentalAowsleyBlivierBkelleyAnationsAmoffattBetcalfeCekinsCdellinBcglynnCcowanBarriottDableAlennoxBamoureuxAkossBerbyBarpAjasonAisenbergAhowzeCckenberryBighsmithBarbourCllmarkAgusmanBreeleyBiddingsBaudetCllupAfleenorAeicherBdingtonAdimaggioBementElloCcastroAcruiseAbushmanBrundageCookerGBourgCardBlackstockBergmannCatonBanisterAargoBpplingAwortmanBattersonAvillalpandoAtillotsonCgheAsundbergBternbergCameyBpeaksBhipeBeegerBcarberryBattlerCinArothsteinApoteetBlowmanBettifordCnlandCachBartainCnkeyAoylerBgletreeCburnAmotonBillionBerkelBaskCrkusAlucierBazarusCvelleCkeyAkratzBinserBershawAjosephsonBesseAimhoffBbanezAhendryBammonAfrisbieDedrichCawleyDgaBoresterAeskewBmmertAdrennanBoyonCminickBandridgeAcummingBawleyCrvajalAbraceyBelisleBateyAahnerAwysockiBeiserAvelizAtincherAsherlockBantoDsoneDkeyDdstromCleArohrerBisnerApridemoreBfefferBersingerCeryAoubreBrangeAnowickiAmusgraveCrdochCllinaxBccaryBathieuAlivengoodBeonardoAkyserBlinkBimesBellnerBavanaughCstenAimesAhoeyBinshawBalleyCkeAguruleBrubeCilloBeterBattoCrverDretsonAfarwellAeilandAdunfordBecarloAcorsoDeClmanDlardBleghornBhasteenBavenderCrlileClvoAbyerlyBrogdonDadwaterCeaultBonoBerginChrBallengerAamickAyanAviceAtamezAstifflerCeinkeBimmonBhankleBchallerBalmonsCckettCadArideoutBeaderBatcliffeCoCnsonDdellAplascenciaBettersonAolszewskiCneyCguinAnilssonBevelsAmorelliCntielDgeBichellEaelsonBertensBcchesneyCalpinBathewsonAlowerCudermilkBineberryCggettBampAkinlawCghtAjustBostAherefordBardemanClpernDlidayCferAgaulAfrielCeitagCancesBorsbergAevangelistaAdoeringBicarloBendyClpCguzmanBameronAcurtissBousinCsperBharleyBauthenCoCmperAbradberryBoutonCnnellBixbyCeberBeveridgeClleCdwellBarhorstCnnonCltazarCierAayotteBttawayBrenasBlexBbregoAwatfordAvalleyAturgeonCnstallBhaxtonDiBenorioAstottsChilaireBpikerBheddBengCaboltBcalfBalyersAruhlBowlettCbinettApfisterBerlmanCpeBarkmanDadiseAolinAnunnallyBorvellBapperAmodlinBckellarCcleanBascarenasCnchesterAleibowitzCdezmaAkuhlmanBobayashiAhunleyBolmquistBinkleyBazardCrtsellAgribbleCavelyAfifieldAeliasonAdoctorCakAcrosslandBoverBlairBarletonAbuttersBridgemanBojorquezCggessBankerAautenAwoosleyBineBhiteleyBexlerAtwomeyBullisBownleyCAstandridgeDmpBpringsBantoyoAruedaBiendeauBevellAplessAottingerAnigroCcklesAmulveyBenefeeBcshaneCloughlinCkinzieBarrowDkeyDianoAlockridgeBipseyAknisleyCepperBittsCelAjinksAhathcockAgodinBallegoAfikesBecteauAestabrookBllingerAdustinCnlopCdekBiegoAcountrymanBhauvinDthamAbullinsBrownfieldBoughtonBloodworthBibbBaucomCrbieriAaubinBrmitageBlessiBbsherCbateAzitoAwooleryBiggsBackerAvioletteAtynesBolleBellesBarterAswareyBtrodeCockdaleCellaCalnakerBpinaBchiffBaariArisleyBeadingBamerizCkesApettawayCnnerBaulusClladinoAomearaAmontelongoBelnickChtaBcgaryCcourtElloughBarchettiCnzanaresAlowtherBeivaBauderdaleCfontaineAkowalczykBnightonAjoubertBaworskiAideAhuthCrdleCngBousleyBackmanAgulickBordyBilstrapBehrkeCbhartBaudetteAfoxworthBingerAessexBndresAdunkleAclareBiminoBardinalCddellAbrauerDleyBodineBlackmoreBeldenBackerAayerBndressBlvaAwisnerBalkAvuongBalliereAtwiggBsoBavarezAstrahanCeibCaubBowderBhouldersBeiberBchuttDarfEdeArodriquesBisingerBenshawBathChmanApresnellBillowCattBasqualeAniemanCcolBevinsAmilfordBcilwainCgahaCcullyDombBayeCssengaleCcedoAlinesBesherClandAkearseAjaureguiAhustedCdnallBolmbergBertelDsheyBardieAglidewellAfraustoBassettAdashClessandroChlgrenAcorumCnstantinoDlinClquittDomboBlaycombBarleyDdinCncelAbullerBoringCneyCcanegraBlazerBiggersBenedettoAaraizaBndinoBlbinAzornAwerthCismanBalleyAvanegasAulibarriAtowersEBedfordCasleyAsuttleBteffensCcyrBquireBmytheBingleyCfuentesBhuckBessionBchramBassAriegerCdenhourCckertDhersonBaybornCbeCabApendleyBastoreAordwayAmoynihanBellottBckissickCgannCcreadyBauneyCrrufoAlistBenhartBazarCfaveAkeeleBautzAjardineChnkeCcoboAhordBardcastleCgemanAgriffeyBiglioBehringAfortsonAduqueCplessisBonnerBickenBerosierCitzBalessioAcyrusBramBhiBenterBastlemanCndelarioCllisonCceresAbozarthBilesBejaranoCechBashawAavinaBrmentroutBngusBlverezBcordAzackAwaterhouseAvereenBanlandinghamAuhlAstrawserBhotwellBeveranceCltzerBchoonmakerEckDaubEffnerAroederCdrigezBiffeBhineBasberryCncourtCileyAquadeApursleyBroutyBerdomoAoxleyBstermanAnickensAmurphreeBountsCnteBeridaBausCtternCsseCrtinelliCnganAlutesCdwickBoneyBaureanoCsaterAknightenBissingerCmseyBessingerAhoneaCllingsheadCckettBeyerCronAgurrolaBoveBlasscockBillettBalanAfeatherstoneAeckhardtAduronCnsonBasherAculbrethBowdenDansBlaypooleBhurchwellCabotBavinessCterCstonCllanAbyingtonBurkeyBodenBeckfordAatwaterBrmsCchambaultBlveyCsupAyonAwhisenantBeeseAvoylesBerretAtsangBessierAsweitzerBherwinCaughnessyArevisCmyAprineBhilpottBeavyBaynterCrmenterAovalleBffuttAnightingaleBewlinBakanoAmyattButhBohanBcmillonCcarleyElebBaxsonCrinelliCleyCcyAlistonBetendreAkainAhuntsmanBirstBagertyAgulledgeBreenwayCajedaBortonCinesBittensAfredericksonBanelliAembreeBichelbergerAdunkinCllBixsonCllowBefeliceAchumleyAburleighBorkowskiBinetteCggerstaffBerglundCllerAaudetBrbuckleBllainCfanoAzanderAyoungmanAwittmanBeintraubAvanzantCdenAtwittyBraderBoonBillAstollingsCandiferBpinnerBinesBhopeBcaliseBavilleAromansAposadaBisanoAotteAnolascoBapoliAmierBerkleCndiolaClcherCjiasBcmurryCcallaBarkowitzDineCnisClletteCcfarlaneAloughCoperBandinAkittleCnsellaDnardAhobartBeraldClmanDlmanBartsockClfordCgeAgordanBlasserBaytonCttisCstelumDpardAfrischBorceBitzhughAecksteinBberlyAdowdenBespainAcrumplerCottyBornelisonCllinDinBhouinardCamnessBatlinCnnAbumgardnerCddeBranumDdfieldEdyBorstBirdwellBentBazanCnkDasCdeAaubreyBrangoBhearnBddisAzumwaltAwurthBilkCdenerBagstaffAvellaAurrutiaAterwilligerBartAsteinmanCaatsBloatArivesCggleBevelsCichardAprickettBoffBitzerBetroCllAnorthrupBicksAmolineBielkeBaynorCllonCgnessAlingleDdellCebBeskoCbeauBammersCfondAkiernanBetronAjuradoAholmgrenBilburnBayashiCshimotoCrbaughCnsAguillotBardAfroehlichBelipeCinbergBalcoAdufourBreesBoneyBiepBelaoBavesCilAcuttingBrowsonBossCngdonBarnerCmarenaAbutterworthCrlingameBouffardBlochBilyeuBartaCkkeCillargeonAaventBquilarBkeBhoAzeringueAyehBarberAwolfsonBendellAvoglerCelkerAtrussCoxellBhriftAstrouseBpielmanBistrunkBhowsBevignyBchullerDaafAruffnerBouthCsemanBicciardiAperazaCgramAoverturfBlanderBdanielAneuAmillnerBelchorBaxieCrvelDoneyCchucaDalusoAlivesayBayfieldCskowskiAkwiatkowskiBoBileyDbyAjulienAhoveyBeywoodBaymanCvardCrvilleCighCgoodAgriecoBlassmanBebhardtBarryAfreezeBleischerBannAelsonBcclesAcunhaBrumbCewAblakleyBardwellAabshireAwoodhamBinesBelterBargoAvarnadoAtuttBraynorAswaneyBvobodaBtrickerCoffelCambaughBicklerBhacklefordBelmanCaverBansomDmiguelAroystonCurkeCckettBiouxApuleoBitchfordBersonsAnormandBardiAmulvaneyBiddaughBannersClekAlodgeBeosBathanAkujawaBimbroCllebrewAjoshuaAhoulihanCbbyBinckleyBerodCplerBamnerDmelCllowellAgonsalezBingerichBambillAfunkhouserBrickeBewellBalknerAendsleyAdulinBrennenBeaverBambrosioAcloverBhadwellBeasarBastanonCnonAburkesBruneCiscoDnkerBowkerCldtBernerCeCaumontDirdBazemoreCrrickAarnetteBlbanoAyountsAwunderlichBeidmanAvannessAtuBolandBheobaldAsticklerCeigerCangerBpiesCectorBollarsBmedleyBeibelBcovilleBaitoAryeBummelCdeBowlesCuleauCosCganCemerBeamBayaApurkeyBriesterBerreiraCnickBaulinCrkinsAovercashBlesonAnicelyBevesAmuldrowBinardCdgettCchalakBelgarBcentireCauliffeBartiEeAlydonBindholmBeybaCaderBangevinCgasseCfayetteAkeslerCltonBaoCminskyAjumpBaggersAhumbertCckBowarthBinrichsCgleyAguptonCimondBravoisBiguereAfretwellBontesBeeleyBaucherCllAevanBichhornBckerBarpAdoleBingerBerryberryCmarsCelAcopenhaverCllinsworthDangeloBloydCaiborneBaulfieldCrlsenClzadaCffeyAbroadusCennemanBouieCdnarBlaneyEcDdesBeltzChlingCginBarahonaAyunBockeyAwinkleDdomCmerClfordBashAvillatoroAtrexlerBeranBaliaferroAsydnorBwinsonBnellingBmtihBiuCmontonFeauxIBherrerBeaveyBcheelArushtonCpeCanoBodneyBippyBeinerDffBabinowitzAquachApenleyAodleAnockAminnichBckownCcarverCandrewAlongleyBauxCmotheCfreniereAkroppCickBatesAjepsonAhuieBowseDieBenriquesBaydonCughtCtterCrtzogDkeyAgrimaldoBoshornCrmleyBluckBilroyDlenwaterCffinAfolksBlukerBederAeyreBshelmanBakinsAdryerBisneyBetwilerClrosarioBavissonAcelestineBatalanCnningCltonAbusterBrammerBotelhoBlakneyBartellAaverettBskinsBkerAzakAworcesterBitmerCserCnkelmanCdmerBhittierBesternCitzelBardellCgersAullmanAtupperBingleyClghmanBaltonAsimardBedaBchellerBalaArundellBostCaBibeiroBabideauAprimmBorchCliteBinonBeartAostromBberAnystromBussbaumCrseBaughtonAmurrBoorheadCntiEeiroBelsonCissnerBclinCgruderBarottaCkowskiCjewskiCdewellAluntCkensBeiningerCbelBakinCgunaAkeplerAjaquesAhunnicuttDgerfordBoopesBertzCinsBammersClliburtonAgrossoCavittBlasperBideonBallmanEawayAfunkeClbrightBalgoutAeakinAdostieCradoBewberryCroseAcutshallBramptonBostanzoCllettiBloningerCaytorBhiangBanterburyCmpagnaAburdBrokawDaddusCetzCainardBinfordClbreyAalpertBitkenBhlersAzajacAyaleAwoolfolkBittenCndleBaylandAtramelBittleBalaveraAsuterBtraleyCetsonBpechtBommervilleClomanCBkeensBigmanCbertBhaversBchuckDmitBartainCbolArosenblattClloBashidCbbAprovinceBolstonAnybergBorthropBavarraAmuldoonEerBikesellBcdougaldCburneyBauricioCriscalAluiBozierBingerfeltBegereBatourCgunasCcourAkurthCBillenCelyBayserChleAjuliusAisleyAhuertasBowerBinzBaughAgummBivenBaliciaAfortunatoBlakeAdunleavyCgginsBobyBigiovanniBevaneyCltoroAcribbCankBorpuzDonelCmfortCenBharbonneauBaineAburchetteBlakeyFmoreBergquistCeneCaudetteBaylesCllanceCkkerCilesAasberryBrwoodAzuckerAwillmanBhitesellBaldDcottAvancleaveAtrumpCailAstrasserBimasBhortsCickBchleicherDaalBalehArotzBesnickBaphaelCinerAparteeAollisDerBdayAnolesAmundayBountainCngBillicanBerwinBazzolaCnsellCgallanesAllanesBewellenCporeAkisnerBeeseeAjimBeanlouisAinghamAhornbeckBermesBawnCrtzDberCffnerAgutshallDhBraysDmsBowanAfinlayDkelsteinAeylerBnloeAdunganBiezBearmanBannAcullBrossonCeekBhronisterBassityCmpionCllihanAbutzBreazealeBlumenthalBillyBerkeyBattyEonCrgeAarvizuBlexisCdereteDanaCbaughBbernethyAworkClterBilleAtweedBollefsonBhomassonBeterCstermanAsproulCatesBouthwickDkupBkellyBenterCaleyBawickiCrgeantArossiterDemondBeppApoundBinkCferAormsbyAnickelsonBaumannAmorabitoCnzonBillsapsEenBcelrathBarcouxCntoothCdsonCcneilDkinnonAlouqueBeisterBampleyAkushnerBrouseBirwanAjuneBesseeBansonChnCcquezAislasAhuttBolladayBillyerBepburnCnselBarroldAguadalupeBingrichBeisBalesAfultsBinnellBerriCatherstonAepleyBbersoleBamesAduniganBryeBismukeBevaughnClorenzoBamianoAconferCllumBlowerECaussenDckBaylorCwthonCsiasCrrenoDloAbluhmBingamanBewleyClewCcknerCamerBarefootAauldBmeyAwolfenbargerBilkeyCcklundBaltmanAvillalbaBaleroDdovinosAungBllrichAtyusBwymanBrostBardifCnguayAstriplingCeinbachBhumpertBasakiCppingtonCnduskyAreinholdEertAquijanoApyeBoorBlacenciaBinkardBhinneyBerrottaDnellBarrettAoxendineBwensbyBrmanAnunoAmoriBcrobertsCneeseCkameyCcullumBarkelDdisCinesAlueckCbinBeflerDflerBaveryCriosCbarberaAkershnerAjoseyBeanbaptisteAizaguirreAhermosilloBavilandCrtshornCmletCfnerAginterBettyAfranckBiskeAemmettAdufreneBoodyBavieCngerfieldChlbergAcuthbertsonBroneBoffeltBlausBhidesterCessonBauleyDdellCntaraCmpoCinesAbullisCcciBrochuBoscoCgardBickerstaffBenningAarzolaBntonelliBdkinsonAzellersAwulfBorsleyColridgeBhittonBesterfieldBalczakAvassarAtruettEbloodCawickBownsleyCppingCbarBelfordAsungBteversonCaggBittonCllBherrellBergentBchoenfeldBarabiaArutkowskiCbensteinBigdonAprentissBomerleauBlumleeBhoenixCilbrickBeerBattyDnodeAoloughlinBbregonAnussBapoleonAmorellCoseBikellBeleBcinerneyCguiganCbrayerAloreDCokCllarBakesAkuehlBinzerBampAjoplinBacobiAhowellsClsteinBeddenBasslerCrtyClleAgreigCanvilleBougeCodrumBerhartCierCddesBastAforehandBerreeCndleyCltnerBangAesquedaBncarnacionBichlerBggerBdmundsonBatmonAdragonBoudCnohoeDelsonBilorenzoCgiacomoDginsBelozierCjongBanfordAcrippenBoppageCgswellBlardyBioffiBabeAbrunetteCesnahanCambleBlomquistCackstoneBillerBevisDanCthuneCnbowBatyCsingerClcomAandesBmanBgueroBdkissonAyandellAwildsBhisenhuntBeigandCedenAvoightBillarAtrottierBillettAsuazoBetserBcurryChuhDreckDauerBamoraAroaneBinkerBeimersCasonBatchfordApopovichBarkinAnicholBatalAmelvilleBcbrydeBagdalenoAloehrCckmanBingoBeducBaroccaCoCmereCclairAkrallBorteCgerAjumperBalbertAhughsBigbeeBentonCaneyBaithAgumpBreesonBoodloeBholstonBasperCgliardiAfregosoBarthingCbrizioAensorBlswickCginBklundBaddyAdrouinBortonBizonBerouenCliaCherreraBavyCrkCmpierAcullumEeyBowgillBardosoEinaleAbrodskyDadbentCimmerDcenoCanscumBolyardDeyBenningtonCadleBaurCllentineAazureBultmanCgustusBsuncionBrciniegaBguilaBcevesAyepezBapAwoodrumBethingtonCissmanAvelozAtrustyCoupCammelBheodoreBarpleyAstiversCeckBprayberryEgginsCitlerDersBohnBeagravesBchiffmanArudnickBizoCccioBennieAquintonCackenbushApumaBlottBearcyBaradaCizAmunfordBoskowitzBeaseBcnaryCcuskerBattAlozoyaCngmireCeschBaskyAkuhlmannBriegBoziolCwalewskiCnradBindleAjowersClinBacoAhuaBorganBineClemanBepnerCiseCadyBawkinsonCnniganCbermanAguilfordBrimaldiBillesBartonCglianoAfrugeBollettBiscusBerrettiAebnerBasterdayCnesAdirksCmarcoBepalmaCforestBanceAcruceCaigheadBhristnerBandlerCdwellAburchellCettnerBrintonCeedCazierDnnenDmeBovaCmarBlakesleeBelknapBangsClzerAatheyBrmesBlvisDersonDardoCterAzhaoAyeungCnAwheelockBestlundDselsAvolkmanAthreadgillCelenBandyCgueCAsymonsBwinfordBturtevantCrakaCierCagnerBegarraCawrightBackArutanBouxBinglerCkerBamsdellAquattlebaumApurifoyBoulsonBermenterCloquinBasleyCgelAosmanBbannonAnygaardBipperBewcomerAmunosBottaBeadorsBcquistonCnielCmannCcraeBayneCtteCrtineAlucyBegaultCchnerBackAkuceraBrohnCatzerBoopmanAjudsonBeskeAhorrocksCmesCckBibblerBessonCrshBarvinClvorsenAgrinerEdleBlenCadstoneBarofaloAframptonBorbisBernandoAeddingtonAdiorioCngusBewarCsalvoAcurcioBreasyBorteseDdobaCnnallyBluffBascioCpuanoCnadayClabroAbussardBraytonBorjaBigleyAarnoneCguellesBcuffAzamarripaAwootonClfgangBidnerDemanAthreattCieleBemplinCetersAsynderBwintDckBturgesCognerCedmanBprattBixCegfriedBhetlerBcullBavinoCtherArothwellCokCneClfBheeAquevedoAprivettBouliotCcheBickelBetrilloCllegriniCasleeBartlowAoteyAnunneryAmorelockFloBeunierCssingerBckieCcubbinDarronBariaAlerchBavineDertyCriviereCmkinAkuglerBrolBisselBeeterAhummerCbbleBickoxBetzelBaynerCgyCdlockAgrohCegorioBottschalkCodsellBloriaBerryBassawayCrrardClliganAfyeBirthBendersonCinsteinAetienneBnglemanBmrickBllenderAdrewsBoironBegrawCeganBartAcrissmanBorrCoksonCilBleavesBharestDppleEarroBastanoCrpioAbyerBuffordBridgewaterGrsCandesBorreroCnannoAaubeBnchetaBbarcaDdAyungBimAwoosterDdrowBimbushCllhiteEamsCgleyBeisbergBardlawAvigueBanhookAunknowAtorreBaskerCrboxAstrachanCandardBloverBhamblinBempleBchuylerDrimsherBayerClzmanDomonArubalcavaBilesCckeyBeneauCichelBayfieldCbonApyattBrindleBossClitoBlemmonsBesceCrraultDeyraAostrowskiAnilsenCemeyerCckAmunseyDdellBoncadaBiceliBeaderBcmastersCkeehanBatsumotoCrronDdenAlizarragaCngenfelterBewallenBaurenceCnganCmannaAkovacBinslerBephartCownBassCmmererAjeffreysAhysellBouseholderCsmerBardnettCnnerAguyetteBreeningBlazerBinderAfrommBortunaBluellenBinkleBeyCsslerAessaryBiseleAdurenBittmerAcrochetBosentinoCganCelhoBavinCrrizalesCmpuzanoAbroughBowCppCokmanCbbBlouinBeesleyBattistaCscomCkkenCdgettAarnesonBnselmoBlbinoBhumadaBgustinAwoodyardCltersBiremanCltonDlisonBarmanCnCldrupAvowellBantasselCleAtwomblyBoomerBennisonCetsCdeschiAswannerDllowBtutzCellyBheehyBchermerhornCalaBandidgeCltersDoCechaoAroseboroClleBesslerCnzDnCdfordBaposaCinboltApompeyBelfreyAorndorffBneyAnolinBimmonsBeyBardoneAmyhreBormanBinesBenjivarBcgloneCcammonBaxonCrisDcianoCnusCidenAlowranceCrenzenCnerganCllisBittlesCndahlBansingCmasCchAkusterBrawczykBnuthCechtBirkendallBeittCeverBantorAjarboeAhoyeCuchensClterDsingerBickokBerbClwigDgesonCaterBassettCrnerCmmanDesCdfieldAgoreeCldfarbBaughanDdreauCntzCllionAfradyBotiBlesherBerrinBaughtAengramBlbertAdoneganBesouzaCgrootAcutrightBrowlCinerBokeCanBlinkscalesBhewningCaviraBatchingsCrlockAbyeBulgerCenrostroBramblettDckBoulwareCrdeauxCokoutBitnerCrtBaranowskiCisdenAaugustinBllmonCbertoBcklinAyoakumAwilbournBhislerBeinbergerBasherAvasquesCnzandtDattaAtroxlerBomesBindleCmsBhrockmortonCachAstpeterClaurentCensonBpryCitzBongerBnavelyBlyCeeperBhroyerCortridgeCenkBevierCabrookBcrivnerBaltzmanArosenberryCckwoodCbesonCanBeiserCdwineBamiresCberAprofitBosnerCphamBipesCotrowskiCnardBeterkinClhamCifferCayDveyAnadlerAmussoBiloDlettBestasBcgowenBarquesDascoCnriquezDosCirAlippsBesserCikerCedsAkrummBnorrBinslowBesselCndricksClmAitoBrickBckesAhurlburtBortaCekstraBeuerClmuthCatherlyBampsonCgarEAgreenlawCauBodbeyBingrasClliesCbbBaydenCuvinCrrowAfontanezBlorioCeischmanBinkeBasanoCnCithAezzellBwersBvelandBckenrodeAduclosBrummBimmickBelanceyCfazioCaconBashiellCmianAcusackBrowtherCiggerCayBoolidgeCldironBlelandBhalfantBasselCpeCmireCbralesAbroomfieldCittinghamDssonDckeyCazielEellDgdonBoulangerCsCmanChannanBeemBartoDreDleyCptistAazarBshbaughBrmisteadBlmazanBdamskiAzendejasAwinburnCllaimsDhoitBestberryCntzelDdlingBagerAvisserBanscoyDkirkClleeAtweedyBhornberryAsweenyBtalkerBpradlingCanoBmelserBhimBechristBchallCaifeAruggCbenBothrockCeslerBiehlCdingsBenderBansdellCdkeApineroBetreeCndergastClusoCcoraroBascoeCnekAoshiroAnoonBavarretteAmurguiaBooresCbergBikeCchaelisBcwhirterCsweeneyCquadeCcayBaukCrianiDceauCndevilleCedaAlundeCdlowBoebBindoEermanBeveilleCithBarockCmbrechtAkulpBinsleyCmberlinBestersonAjacintoAiceAhuiBoyosBelfrichBankeCilAguillermoBrisbyBoyetteCuveiaBlazierBileBerenaClinasBasawayCrdenAfunchesCjimotoBlyntBenskeCllersChrAeslingerCcaleraBncisoAduleyBittmanCneenCllerBevaultBaoAcollingsBlymerCowersBhaversDrlandBastorenaEelloCmargoAbunceCllenBoyesCrchersFardtBirnbaumDdsallCllmanBenitesBankheadAangeBmmermanBdkisonAyuanAwinegarCckmanBearBarrDnkeAvilleneuveBeaseyBassalloCnnattaCdnaisAtwilleyBrueloveBoweryCmblinBippettBheissBalkingtonDamantesAswartDngerBtreitDawCinesCablerBpurlingBobelBineCmmersBhippyDflettCearinBauterCnderlinAruschCnkleCckmanBorieCeschCbertoBichertBehmBandelCginAquesenberryApuentesBlylerCotkinBaughAoshaughnessyBhalloranAnorsworthyBiemannBaderAmoorefieldDneyhamCdicaBiyamotoCckelBebaneBckinnieBazurekCncillaAlukasBovinsCughlinCtzBindsleyCddleBevanCdermanCclaireBasseterCpointCmoreauxCfolletteAkubiakBirtleyBefferBaczmarekAjennetteAhousmanCneyBiersCbbertBerrodCgartyBathornCrshAgreenhawCaftonBoveaBardenerAfutchCrstBrisbeeCedCankoBorcierDanBlickingerBairfieldAeureBmrichCbreyBdgingtonBcklundDardAduranteBeyoClvecchioCedsBadeAcurreyCffBreswellBottrillBasavantCrtierDgileCpelCmmackClfeeAbuzzardCrseDrussBrustCousseauCidwellCaatenBorkholderBloomquistBjorkBarteltAarpBmburgeyAyearyBaoAwhitefieldAvinyardCcenteBanvalkenburgAtwitchellBimminsBesterBapperAstringhamCarcherBpottsBlaughBimonsenBhefferBequeiraArosatiCdeBhymesBezaCcordAquintApollakBeirceBatilloCrkersonCivaAnilsonCceBevinBarcisseCirAmittonBerriamDcedCinersBckainCelveenCbethBarsdenDezCnkeChurinCbreyAluperAkrullBeesAilesAhunsickerBornbuckleCltzclawBirtCnnantBestonCringCmenwayCgwoodCarnsBaltermanDlsAguiterrezBroteCanilloDingerBlascoBilderBarrenDlockDeyAfuBryarCedricksCaizerBoxxCsheeBerrelCltyCathersAeverittDnsBsserBlkinBberhartAdursoCguayBriskillBosterBewallCveauCmpsDaioClrealDeoDayCemBarrahAcumberbatchClbersonBranmerBordleClganBhesleyBavalloCstellonHiCrrerasDnellDmonEenDlucciAbottomCntragerBlumbergCasingameBectonAayonBrtripClineBndujarBlkireCderBganAzukowskiCckermanBehrAwroblewskiCigleyBoodsideBiggintonBestmanEgateCrtsBashamCrdlowClserCitersAtellerBadlockAstuckCringfieldCimpsonDckleyCarbuckDndishBpurlinCindlerCellerCaethBotomayorCkBluderBhryockCepardsonCatleyBcannellBantistevanArosnerCllandBhodeBestoCinhardBathburnApriscoBoulsenBinneyBharesBennockBastranaAoviedoBstlerAnotoBaumanAmulfordBoiseCberlyBirabalCngBetoyerDhenyCntzerCldrumBcinturffCelyeaCdougleBassaroAlumpkinsBovedayCfgrenCeBiretteBesperanceCfkowitzCdgerBauzonCinCchapelleAkurzBlassenBeoughCmptonBaelinAjeffordsAimAhuotBsiehBoyerCrwitzCppCeftBennigBaskinAgrillBourdineClightlyBirouardAfulghamBritschCeerCasherBoulkBirestoneCorentinoBedorCatherAensleyCglehartBellsBbelAdunphyBonahoeBimasCleoCbenedettoBabrowskiAcrickBoonrodCnderCddingtonBhunnCoyCaputBernaBarreiroClahanAbraggsBourdonCnerCllmanBittleBenChmBauderCttCrrerasAaubuchonBnzaloneBdamoAzhouBerbeBacheryAwittyCrtCllcoxBestbergCikelBaymireAvromanBinciBallejosAtutorBruesdellCouttDttaBollisonDesBichenorBaiAsymondsBurlesCndayBtrayerCgeorgeBrokaBorrentinoClaresBnelsonBilvestriCkorskiBhawverBchumakerDorrEoleyCatesBatterleeDchellCcksArymerBoselliCbitailleBiegelCcherBegisCamesAprovenzanoDperCiestleyBlaisanceBetteyBalomaresAomanAnowakowskiBaceAmonetteBinyardBclambChoneCcarrollBassonCrcoCgoonCddyAlundinBozaBicataBesleyConhardtCmaBandwehrAkircherCnchBarpinskiAjohannsenAhussainBoughtalingCskinsonCllawayDemanCbgoodBiltCebertAgrosCamBogginBentleCisslerBadboisCbaldonAfleshmanCanniganBilesBairmanAeppBilersAdycusBunmireCffieldBowlerBittoBeloatchChaanCemerAcornerBlaybornBhristoffersoCilsonCesneyCatfieldDrlieBasterCrronCnaleCmdenAbuffBrigmanCanstetterBosseCrtonCnarBlauBironBeagleBarrosoAarvinCispeAzachariasCbelAyaegerAworksColfordBhetzelBeakleyAveatchBandeusenAtuftsBroxelDcheCaverBownselCshBalaricoAswilleyBterrettDngerBpringfieldCeakmanBowardsCursDdersGClesCbersBnoddyBmitherBiasBhuteCoafCahanBchuetzCaggsBantiniArossonClenCbidouxBentasCcioApixleyBawlowskiEakCullCscalAoverbeyBrearBliveriCdenburgAnuttingBaugleAmoteCssmanCorBisnerClazzoCchelsonBeiBcenteeCcullarDreeCaleerBazzoneCximCrshalCndellDahanClottCisonetDllouxAlumleyBowrieCuviereBipinskiCndemannBeppertCopoldCasureDfBabargeAkubikBniselyCeppBenworthyDnellyClchBargCnterAignacioAhyerBouchinCsleyFrCllonEemanBeitmanCbbBagginsAgwaltneyBuinBreenmanBouldingCrdenCodyearBeraciCorgesBathersAfrisonBeaginBalconerAespadaBrvingCiksonBisenhauerBderBbelingAdurginBrownBowdleBinwiddieBelcastilloCdrickAcrimminsBovellCurnoyerCriaChanBataldoCrpentierCnasCmpaAbrodeCashearsBlaserBicknellBerkCdnarBarwickAascencioBlthoffCmodovarCamoAzirkleBabalaAxuAwolvertonBinebrennerBetherellCstlakeCgenerCddingtonAvongAtutenBrosclairCimCesslerBherouxBeskeAswordCinehartCensenBundquistBouthallCchaBizerClverbergBhorttCimizuCerrardDnCaefferBethBcheidEetzBaraviaCnnerArubinsteinBozellCmerBingoBheaumeBeisingerBavenCndlesApullumBetrellaBayanCppCbloAnordinDcrossBicolettiDholesBewboldBakagawaAmrazBonteithBilsteadDlinerBellenBccardleBatthiasCrcyAluftBooCckerBiptakDpBeitchBatimoreCrrisonCndauCbordeAkovalAizquierdoAhymelBoskinClteCeferBayworthCusmanCrrillEelDdtAgullyBrooverCinnellCeenspanCaverDndberryBorrellCldenbergCguenBillelandBarrAfusonBoyeBeltDdmannAeverlyAdyessCalBunniganBownieClbyBivineBeatherageBatesCnnaAcoseyCrradoBheeverBelayaBaverCshionCplingerCnslerAbyrgeBruderCewDuerDslinCazeltonBotkinCnneauDesDdurantChananCgueCesCdnerCatnerBlattBickleyBelliveauCilerDerCcksteadBartCngCchmannAatkinBronBndreasBltizerClowayDaireCbroBbronAzellmerAyetterClvertonAwiltshireCensBhiddenBaitAviramontesBanwormerAtopperBarantinoCnksleyAsumlinBtrauchEngCiceBpahnBosebeeBigalaBhroutBeamonBchrumDneckDantzBaidAruddyBomigCehlBenningerCdingApyneBolakChlmanBasillasAoldfieldDakerBhanlonBgilvieAnorbergCletteBiesBeufeldCllisAmummertClvihillDlaneyBonteleoneBendoncaCisnerBcmullanCcluneyBattisCssengillCnfrediAluedtkeBounsburyCraBiberatoreBeekCaseBazaroCmphereCforgeAkuoBooAjourdanAismailBorioBniguezBkedaAhublerBodgdonCckingBeacockBaslamCralsonCnshawDnumCllamCdenAgarnesDcesCmmageDbinoAfinkelBaucettChyAestebanBhrhardtBggenAdusekCrrantCbayBonesBeyCpasqualeCluciaCgraffCerCcampBavalosCrwinCnAcullinsBonardBlouserDntzBifuentesBhicoCappelDffinsBelisBarwileAbyramBruggemanCickCesslerCathwaiteDsfieldDdburnBooseDnCdieBlosserCasBiseBertschDnardiFbeCngtsonBarretteAastorgaBrmandBntoneBldayCbeeBbrahamsonAyarnellAwiltseDeCebeBaguespackAvasserAuphamAtyreBurekCneBraxlerBorainCmaszewskiBinninDerDdellBeedAstyronCahlmanDabBpoonCellsBkibaBhihCeperdBeidlCcorBchutteBanfilippoAruderBondonBeinaCarickBankAprocterEhaskaBettengillBaulyAneilsenBallyAmutterCllenaxBoranoBeadsBcnaughtonCmurtryDathCkinseyBatthesCssenburgCrlarDgolisDcosClinCgallonCckinAlovetteCughranCringCngstreetCiselleBenihanBaubAkunzeCllBoepkeBnightsBerwinBalinowskiCganAinnisDesAhusbandBoltzmanBeinemannBarshmanCiderCackAgussBrondinCissettCeenawaltCavelBoudyCodlettCldstonCkeyCinBardeaClavizCffordCbrielsonAfurlowBritchBordyceClgerAelizaldeBhlertBckhoffCclestonBaleyAdubinBolphinBieterDmerBeschampsClapenaCciccoCboltBaumAcullinanBrittendonCaseBosseyCppockCotsClyerDumbusBluckBhamberlandBaneAburkheadCmpusCchanBormanDkCeBirkholzBerardiCndaChnkeBarterAauerBmezquitaAwotringBirtzCngertCesnerBhitesidesBeyantBainscottAvivianBeneziaBarnellAtusseyBrainerBollBhurlowBackCbaresAstiverCellCarkeDnhopeEekBislerCnnottCdneyCcilianoBhehanBelphCagerBcurlockCrantonBantucciEangeloCltsmanAruelBoppCllingCggeBettigCnwickCidyEerCdfieldAquamApremoBortBierBeetBarenteColucciCnClmquistAormeBhlerBggAnethertonAmutchlerBoritaBistrettaCnnisCddendorfBenzelDdosaEelsonCauxBcspaddenCquaidCnattBanigaultDeyCgerAlungCkesBoprestiBirianoCptonBetsonCchugaBazenbyCuriaCrimoreAkwokCakBruppEaDmBopecBinchenCferBerneyFrCnnisonCgleyBaysCrcherAjustisBohsonBellisonBankeAisabellAhuskinsBolzmanDlieBinojosCghlandBefleyCBatmakerCrteCllowayEenbeckAgoodwynBlaspieBillianBeiseAfullwoodBrymanCewCakesDireBarrerAenlowCgenBllzeyBcklesBarlesClyAdunkleyBrinkardCeilingCaegerBinardoCllsBesrochesDantiagoAcurrentDleeBrumbleyCitchlowBouryEtrightCffieldBleekBhristenCarpentierBardoneCplesCntinAbuntinCgbeeBrinkerhoffCackinBourlandChlCgdanBlassingameBeachamBanningAaugusteBndreasenBmannBlmonCejoBdelmanBbstonAzenoAyergerAwymerBoodberryBindleyBhiteakerBestfieldCibelBannerCldrepAvitalCllaniBanarsdaleAutterbackBpdikeAtriggsBopeteClarBignerBhomsBauberCrvinCllyAswineyCeatmanBtudebakerCreetsCennettCatesDrrettDnnardDlveyBonnenbergBmitheyBieberCcklesBhinaultBegarsBangerClmeronArotheBizziCneCcardBestrepoBallsCgusaAquirogaApingBhungBeroCggBavlikCpenfussAoropezaBmarBkaneAneerDBathanielAmudgeBozingoClinaroBikelBcvickerCgarveyCfallsCcraneyBatusCgersAllanosBivermoreCssCnehanBetoCitnerBaymonCwingDerenceCcourseAkwongBollarBneelandBeoCnnettCllettBangasAjanzenAhutterCseClingBossChnCfmeisterBewesCrnBarjoCbibAgustCiceBrullonCeggsCayerDnierDbleBowdyBianniniBetchellBartmanDnicaCneyCllimoreAfrayBettersCrgersonBarlowCgundesAexleyBstevesBndersBdenfieldBasterwoodAdrakefordBipasqualeBesousaDhieldsCeterCdmonCbordBaughteryAcuttsBourtemancheEseyCppleComesCllisECgburnBloptonBhoquetteCaidezBastrejonClhoonAburbachCllochCchmanBruhnBohonBloughBienBelmontBaynesCrstowAzemanBackeryAyardleyCmashitaAwulffBilkenDiamsCckershamCbleBhipkeyBedgeworthBalmsleyDkupAvreelandBerrillBaleraAumanaAtraubBimothyAswingleFBummeyBtroupeCockstillCeffeyEanskiCatlerDppBpeightsBonsClariCderbergBlickBhunkCoreyCewmakerDildsBchifferDankEffBagersArodgerCchonBiserCckettBealeBaglinApoonCllyDenBlataBitcockBercivalBalenChlAoronaBberleAnoceraBavasCultAmullingsBouserCosCntejanoDrealBinickCddlebrookBeeceBcmillionCcullenBauckCrshburnCilletChaneyCgnerCclinAluceyBitteralCppincottBeiteDsCaksBaurieCmarreAkostAjurgensBesusCrkinsBagerAhurwitzCghleyBotalingCrstmanChmanCckerBivelyCppsCleBesslerCrmansonCpworthCnnCllandCdlundBarklessCiglerAgutierezCmBrindstaffBlantzBiardinaBerkenBadsdenAfredaBinnertyBeldBarnumAencinasBltonBagerAdrakesBennieAcutlipCrtsingerBoutoCrtinasDbyBhoiceCiassonBarleDballoAbrindleBorumCberBlaggBirkBerthiaumeCahmBatresCsnightCrbaraCckesAaxtellBustCBtterberryBlvaresCtCegriaBbeAyowBipAwoodellCjciechowskiBinfreeDbushCestBesnerBaxCmsleyCkemanAvernerAtruexCaftonBomanBhorsenECeusBellierBallantAszetoBtropeCillsCageBorgBimkinsBhueyCaulBervinDioDafinCniorCbringBalgueroCbaAryersonBudderCarkBotherChrbaughGchDanCgersonBisherCggBeeserApryceCokopCinsDebeCejeanBinheiroBetroneEiCnsonCarlmanBarikhClCirAnatoliAmurakamiCllikinEaneBotesCrningstarCnksBcveighCgradyDaugheyCcurleyBasiCrchanCnskeCineCezAlusbyBindeCleCkensCconBerouxCmaireCgetteBaxCskeyCpradeDlantCdyAkolarBittredgeCnleyBerberBanagyAjohannesBettonBayneCnuaryDikAippolitoBnouyeAhunsingerBowleyDeryCrrellCosierClthausBinerClsonDderbrandBasanCrtzlerDnishDadaCnsfordClliganCgedornAgwynnBudinoBreensteinEarCaceyBoudeauCseCodnerBinsburgBerthDnerAfyfeBujiiBrierCenetteBolmarBleisherFchmannBetzerCrnAeisenmanBarhartAdupuyCnkelbergerBrummerCexlerBillingerDbeckCanaBewaldCmbyCfordBaniellCkeAcraineBomoBleverBhesnutBasadyCrstensDrickDinoEgnanCncholaCleAbushongCrmanConoBrownlowDachCittenDckhouseBoydenCultonCrneDlandChrerBlubaughBeverCrggrenCnevidesAarochoCendsBmezcuaBlmendarezAzalewskiAwitzelCnkfieldClhoiteAvaraCngundyDfleetDettenDdergriffAurbanskiAtyrellBroianoBickleBhibodauxAstrausConekingCjeanCillingsDffCangeBquareBpeicherDegleBowaBmeltzerBlawsonBimmondsBhuttleworthBerpaCngerCidmanBchweigerDlossDimmelDechterBaylerCbbDatiniAronanCdiguezBigglemanCchinsBeepCamerApruntyBorathBlunkBilandBhilbrookBettittCrnaDalezBascaleCdulaAoboyleAnivensCckolsAmurphCndtEenBontijoBcmanisCgraneCcrimmonBanziDgoldClickCharCddockAlustBoseyCopBittenCnerBeffCedyCavellBadueAkrahnBlugeAjunkerAiversenBmlerAhurttCizarCbbertBowingtonCllomonDdrenCisingtonBiseBeidenBaugeCrtiganAgutirrezBriffieCeenhillCattonDnataBottfriedBertzBautreauxAfurryDeyCnderburgBlippenBitzgibbonBergusCliceAeyeAdyarBruckerBonoghueBildyBeversCtweilerCspresCnbyCgeorgeAcuetoBranstonBourvilleBlukeyBirilloBhonCiversBaudilloCttAbuteraClluckCckmasterBraunsteinDcamonteBourdeauCrderCnnetteCbadillaCazBlackledgeBeshearsCrnhardDgesonBaverCrthelClsamoCkAazizBwadButhementBltomDieriBbelsAziglerBhuAyounkerBeomansCarwoodAwursterBingetBhitsettBechslerCatherwaxBathenCrrinerCnamakerClravenAviensBandemarkDcampAuchidaAtrianaBinocoBerpstraCllisBarinDantoCkacsAstuddardCruthersDoutCillerBpataroBoderquistBligerBilbermanBhurtleffCeetzBchillingerAritchBeifBaybonCtzlaffCdleyAputtDneyBrimeCessBinetteErBetrinBariseAosbourneAnymanBorthingtonCblittBishimuraBellCherBallsCccaratoAmuchaBounceBironCllisBeaneyBcnicholsCkinnisCjunkinCduffyBaxCrcelloCnriqueDnionDgualClveauxCinsAlumsdenCcienBohmannBipeCghtseyBemastersCistBaxtonCverriereCtorreCmonsAkralBopfBnauerBittBaulCrasCmpsAjusinoBanisAislamAhullingerCgesBornungBiserBempelClselBassingerCrgravesCmmesCllbergAgutmanCmbsBruverCaddyBonsalesDcalvesBlennonBilfordBenoAfreshourBlippoBiferBewCrminBasonCrrishCllinAewertBsteppCcuderoBnsmingerBmmanuelCbertonBlmsClerbeBideAdysartBouganBierkingCcusBetrickCrocheCpueCmartinoClosreyesBalkeAculbreathBrownoverCislerCassBorsiBhagnonBentersBavanaghCssonCrolloCdwalladerAburnleyDciagaEhardBroadheadBorisCozeClteCdyBerensCllmanEardBarilAardenBntonucciBmadoBllieAwolfgramBinsorCmbishClbertCerBallachAviverosBentoBarleyCnslykeDgorderAtouchstoneCmkoBiemannBhroopBamuraClmadgeAswayzeBturdevantCrauserColzCenbergCaytonBpohnCillersFaneBlussCoaneCavensBimonettiBhofnerCeadBenecalCalesBchuelerDleyDachtBauveCrnoClsburyArothschildCsierBinesBevelesCinCdusDfernCckBanneyCggsAproutCillCebleCagerBlemonsBippenClonCccirilloBewittCsinaCcoraAotaniBrsiniBllieBestreichBdeaBcallaghanAnorthupBiehausBewbergBasserCrronAmonarrezBishlerBcsherryCelfreshBayonCuerCtticeCshCrroneDmolejoDiniEeDaClmCchenAluncefordBoewenBivermanCtwinCnscottBevinsCnoxCgaspiCemanCavyBannonCmsonDbdinCbarreAknouseBlemmDinschmidtBirklinBeelsAjulianoAhowserCttCsierDeaCpwoodClyfieldCdnettBirshBeimannDghtCckelBargerCmilCjekAgurganusCnningBrangeBonzalasCgginsBerowBaydosCrdunoCnleyCleyAfarnerAesterBnglesBmondCertBllenburgBdickAduellCblinBorazioCngBimondCederichBewaltCpuyCmpsterDariaChoyosCarthDlbaBaneAczechBroseCespinBogdillBlinardBiprianoBhretienCalkBernyCnicerosClestinBapleCchoAburrillChrCcklandBranamBoysenCveeCosClerBlomCaskoBeyersClzDmonteCdnarzCckmannCaudinBazileCrbeauClentineAabrahamsCleAzielkeAyunkerBeatesAwrobelBikeBhisnantCerryBagnonAvoganBansantDnestClloAulleryAtowlesDellBigerBhillBaorminaCnnehillCingAstorrsCicklesCetlerBparlingBoltBilcoxBheardCadleBemanClleckBchlemmerDerBapienCinzArumbleBoyeCsamondCmainBizzutoBeschCntzBatherCschCnieriApurtellBrimmerBortwoodCntiusDsBletcherDdgerBirkleCllsburyBentecostDgBaxsonAortezCganBlesAnewbornAmullettCirheadBouzonCrkCllettChnBitchamBelilloCeCddersBcmillerCcleeryDaugheyBandersCkCciejewskiDaulayAluteBipmanBewterBarocqueCngtonAkrinerBnippBilleenBarnClishCczorAjonsonBerezBarrardCndaAhymesBollmanEandsworthECbdyBitchBennenCmmerBaginsCddoxAguitierrezCernseyBorsuchBholsonBenovaBazawayCunaCmmonsAfreelsBonvilleBlyCorianCeetBettermanBavaCrquharDishCbelaAescotoBisenAdossettCrityDfmanBemmerChnBawleyCrbonneCmoreDmAcrosleyDnDmptonCichtonBotnerCrdonCnerlyClvardBlausonBhessDesemanCarityBavallaroCstilleCbelloAburganCffumBrussCassfieldBowermanCthwellCrgenCnaparteCmbardCivinDssonneaultCgnerCddenCanBlancheBittingerCckhamBedollaBaleCinbridgeAaybarBvendanoBshlockBmidonBlmanzarBkridgeBckermannAzagerAyongAxavierAworrallBinansClseyCghtmanBestrickCnnerBarneDfordAvervilleAutechtBpsonAtumaBsengBroncosoDllingerBorbertBaulbeeAsutterfieldBtoughDrchDnebrakerDlleCilsonDefelCeptoeEneyDnderDmpleCaggersBpurrierCrayCinneyCenglerBmarttBkoogBilvisCegBhufordBelfridgeCguinCdgwickCaseBcottiChroerDlenkerDillBavareseCpienzaCnsonDdefurClamoneArusnakCdisillBoyaltyCthermelCcaBesendizClifordBascoCifordAquisenberryDjadaApullinsCccioBostellCppeBinterCcheBetrucciCllegrinDaezBattiDonCscoCrkesCdenCbstAorchardBlmstedAnewlonAmynattBustafaBowerCrroneDeeCffatBixsonCnnerDClletteBederosBcgahanCconvilleBaughanCssingillCranoCcriAlovernBichtensteinBeonettiChnerBawleyCramieCppinChtiCgoCcayoAkuesterBneeBincadeAjuniorChlBoslynBironBessopCrryBaroszCinAhultsBogeCdginsCbanBinksonCllyardBerzigDveyCnriksenBawkerCuseCrdCnkersonAgregsonBollidayBilcreaseBessnerCraceBarwoodDstCillardAflinchumBishelEbackClkinsBentressBabreAethierBspanaBisnerBhrhartBfirdAdrennonBominyFiqueFgueBipaoloCnanCmartinoBeskinsCnglerCfreitasEancoBancerChlinAcutshawDhbertBroyleDthersCitchfieldBowieCstnerCppedgeDesBicconeBhampBesarBaufieldCpoCmbronFidgeAbuserCrnesChlCendiaBrindleyCechtBourgoinComerBlackshireBirgeBenningerCmbryCilCgayeBarrentineDksCntonClmerCityAauerbachBmblerBlexandreBckersonAzurcherBellAwynkoopBallickCidAvosBizcainoBesterCaleBandermarkGfordAtuthillBrivetteBhiessenBewksburyBaoCbronAswimCaseyDniganBtoughtonEdtCimsonCeckerDadCallBpadyBoutherBmoakBklarBimcoxCdwellBharonBeybertCscoCemanCabornBchwenkDmelingArossignolCbillardEcheauxBiveriaCppeonCdgleyBemaleyChkopCddishCachBauscherCchelAquirionApuseyBrudenCesslerBotvinCspisilBaradisoCngburnClmateerAownbyBtwellBsterbergCmondBlssonCdBberlanderAnusbaumBovackCkesBicastroBehlsBayCberAmulhernBotterCretzBilianBercedesBckeelCclayDartBatsudaCryDtucciDpleDkoDciniakCnesDciaCkerCcraeAlybargerBintDebergerBevingstonCcroyBattimerCseterAkulickBrierBnutsenBlemBinneDkadeBettermanCrstetterGnBaramAjuryBoshiBinBentCfcoatAhillierEhouseBettingerCnthornDlineClzerCitzmanDnemanCenanBaughtonCrisDbertCmanAgrinsteadCemillionBorbyBiraldoCoiaBerardiEghtyBauntCtsonCrdinCnsCmmillDesCinAfriedlanderCahmBossettDdickCrthDbushCndrenBleckensteinBitchettClerBelizCistAewartBvelynBstersBlsnerBdginCdieBasterlyAdussaultCrazoBonBevereauxCshotelCckertBarganDeAcornmanCnkleDditCmmanderBlaunchDbaughBhuteCeesmanDaCarneyElestonBasellaCroneDbonellCnipeCmpanaCllesCbezasEllAbuttramCstillosDkirkBoylandCurkeBlakeleyBigBerumenDrierCnchClliChrendtBaumbachCrtschCneyAarambulaBlldredgeDbrittonAziembaBandersAyoungquistCshiokaCheAwunderBoodfinCjtowiczBinkelClmoreDlbanksBesolowskiCndlandBalkoAvotawBanekAuriarteCbanoAturnipseedBricheCautmanBowlerCkarzBemplesCfftCegardenAsyedBwigartBtrykerCollerCaplerDnsfieldBmitCelleyBicardBhulmanCewDarEhanCarptonBelvidgeBchlesingerBavellCndfordCbatinoArosenbloomCepkeBishBhamesBenkenCgerBappaportAquartermanApuigBrasadBoplarBizanoCgottCckBhairBetrickBattCscuaCramoreCpineauAolivieriBgrenAnordenCgaBisbetAmunkDchCiBorvantDoCloneyBerzCngCltzerDlingerChlBcnealyCkernanChaneyCcleskeyCandrewsBaytonDorCrkertDescaDcellusCnerDdujanoClpassCcintyreAlyttonCallBummusBongshoreEfellowCkeyCcherBeveretteCpeCfeverCesonCdererBampertCgroneCAkreiderBorthBnopfBleistBissBeltnerDlingBasparCpplerAjustinBosephsBiangAhuckinsBoraceClubCfstetterCehnBigginsonBenningsCidBavelCuerCrndenDgreavesCngerAguildDdiBrateDndyFstaffBozaCodridgeEfellowCggansCdleyBiustiClyardBeogheganBalyonCetaAfunesBontBlorCanaryBalesAerlandsonBllettCiaBdingerAdziedzicBuerrBraughnBonohoBimatteoBevosCmatteoCgnanBarlingtonCnisCmChlstromEkeAczajkowskiBumbieClbertBrosierDleyBorryBlingerBheshireCalkerBephasBaywoodCvalierCpehartClesCdizAbussiereCrrissDkartBrundidgeConsteinCeezeCadtBoydstonCstromCrelCllesBlayDckwelderBissettBeversCsterCrnardinoCnefielCloteCedleCcklesBaysingerCsslerCrteeDlettDgasDefieldCptistaAarterburnCmasBppersonBmorosoCedeeAzulloBellnerAyeltonAwillemsDkinCgginCdmanBelkCingartenBallaAviersBessCrdiCazeyBannoteAtullosBrudellCowerDsperCimmCewBousignantCppCccoBhoresonBerhuneBatomAsunigaCmterBteevesCansellBoltisBlossCavenBingBhislerCeriffCanleyBervantesCldersCgrestCeseDberBchaibleBavalaCrtorAruttCmbaughCisBotenCesslerBitenourCneyBestivoCneDardBakestrawECchalAquirosApullinBrudhommeCimeauxCestridgeEswoodBonteClzinCarchBittengerCggottCckellBhaneufBarvinDmleyClmeriCisleyAozmentBrmondCdazBnoBleaBbanionBakmanAnovickBicklasBemecBappiAmundBorfinBeraClgozaDbyBcgoldrickCelwainCchristianDawBarquartDlattDkovichChrAluptonCcusBorussoBermanCddyCamanDchmanBavalleCdukeAkummerBouryCnopkaChCeppBlossDckBhalilBernanBappelAjakesAinoueAhutsellBowleCnoreCleCckmanEadayBiltzBetheringtonCsserCrshmanCngCffronCadenBaskettCrtlineDnedAguillemetteCglielmoCercioBreenbaumBorisBlinesBilmourBardellaCddCblerDbertAfuselierBreudenburgCagosoBollisBlemingsBeltmanCbusBarrenCllisAevertBkstromBastridgeAdyckBufaultCbreuilBresserCapeauBominguesClezalBinkelCdonatoBevittDaneCmottBaughtreyDbertCsCrrellAcreasonCaryBostillaBhippsCeatwoodBarmeanCntonCffreyAburgherCkerBrunkCodbeckCantnerEdyBolivarCernerCdkinBielBettyCncomoCllinoDiveauCauvaisEpreBaylisCskettCrcusDberaCltzAasayBrneyCcuriBnkneyBgostiniBddyAzwillingBubiaBollingerBeitzAyardCnesAwinshipDninghamCcklineBebreBaddingtonAvosburghBesselsCrrettCdderBarnumCndeventerCccaAusryAtowryCuchetCokesCnkinBimkoCbbittsBhedfordBarletonCltyDamantezCfollaAsuggBtreckerCirlingCeffanBpivaBlapeBiemensBhatzerBeylerCamansBchmaltzDipperBassoCilorAruppeCnnerBoyalsCudebushBippleCemerCcharsonBevillaCichenbachBatleyCilsbackAquayleApoplinCormanCntonCloDlittCitrasBiscitelliCedraCcklesBewCreraCopleCnwellCltBaulineCrkhillCladinoAoreCamBlmoCiverasEarriaBgormanAnearBaronCAmuncieBowbrayCronesDettiCnnBittsCnksDarikCmmsCllironFngtonEhouseBessersmithBcnettCkinstryCgeorgeCdillCateerBazzeoCtchettChoodCberyAlundellBoudenCsoyaBiskBezamaCibCboBanoueDfordCfortuneAkumpBroneCepsBottCpeckyClodziejBnucklesBinmanCmmonsBeltyBasterCrlsonCniaAjulesBoyalCbBennerBasinskiCndreauAisenhourAhunzikerChnBoudeDchinsCltmanCdoBeymanCntgesCdbergBayneDcraftCrshbargerFawDrissDingCnsellDfordDdlerCmburgElenAgunnellBroatBoreckiCchenourBleesonBenestCiserBabrieleAfulghumBrieseDdleyCeebornCaileyBlaugherBialaAettingerCheredgeBspitiaBriksenBngelbrechtEbretsonBlieBickhoffBdneyCelenBberhardBastinCkesAdriggsBonerDaghyBisalvoBeshongBahmsDlquistAcurrenBripeCeeDagerBorleCnatserCmmonsCgginCderCaxumBlossonDdfelterCassenBhittendenBastillejaDaleCrteeDriereCnupDizalesAburgoonCngerCgarinCchanonBruningDckCookesDadwellCierCekkeDeseCaceroBowleyDersoxCseCgarBlossomCauserDckerBjorklundBelairBaumerCslerCrbCltimoreCizeCdenAaumanBmundsenCoreBlvarengaBdanDmczykAyerkesDbyBawnCmaguchiAwortheyClkBixomCersmaDczorekBhiddonBeyerCtheringtonCinBatchmanCrfCnsleyAveselyClazcoBannormanClasquezAutzBrsoAturcoDbevilleBrivettBorranceCothakerDheyCndreauBhalerAsylvainBwindlerDgertDderBtinerCeverDffesCampleyDirBmidtBkeeteBilvestreBhyCuttsCockCealeyBeiglerBchweizerDuldtDlichtingDerrBaulsberryCnerArosinDatoClingChnBixCsterBemleyDickCcinosBammCabeApursellBoythressCliCkornyBlumBettryDreyDittCnmanBaysonCquetCppalardoAoutlandBscarBrensteinAnuttallCckolsBottBimmoAmurtaghBousseauDlderConeyhanCakBinchCeraBercuriCighanBcnellyCguffinCcreeryDlaskeyBanCinorAluongoCndstromBoughmanCoseCboDbBinhartCbertyBeverCuCiterChouxDnBaresCpanCnghorneCmonCdwigDsonAkuzmaBreitzerBnopBeechCaBadlecAjoBhonsonBantzAinglisAhuskClmeBouselCfmanBilleryBeidenreichCapsBaslettCrtingFgCmlerCltonDlumAgutierresCidaCerrierBrossiCessDenhalghCavelleBowCslinCnyeaBipeBerstnerBasserCrceauCnnawayCmaCllopCiserAfulliloveBoutzCssumBlannaganBarriorCllerAericksenBntrekinCochsCglundBllenbergerBastlandCrwoodAdudashCBrozdBesotoClphCkkerCjohnCgarmoCfeoDalcoCbloisBacusAcuddBrossenDomsDnanBostinEanzaCrdrayCmerfordCllieDegroveDdwellBlaassenBhartrandBastiglioneCrteDdellaDberryCppDobiancoCngelosiAbuchBrunellDckerCockettCizendineDnegarDmerCaseBosqueCnkClgerChanonFBlazekBerningDganCnnetteCaucheminBattisteCrraCloghAavisCalloneBubryBshcroftCencioBrledgeBnchondoBmyBlvordBchesonAzaleskiAyonkerAwyssCcoffBoodburnBiningerDdersCllmonCechmannBestleyCatherholtBarnickDdleDburtonAvolkertBirginCllanvevaBeitBassCnallenAtungBoribioCothmanBiggsBhornsberryDmeBepperCepleCboBassoneCnnAsultanBtuckerCotlerDnemanCehleCanbackDllcupBpurrCeersCadaBolumBmolenBinnClvernailBholesCivesCainBecrestCagleBchuetteDochDniedersDildEavoneHDarffBanteeDdellClvoArollingsGBivenburgCtzmanCstCoCcardoBeynosaCtanaCiberCgnierBarickCnsomeCllApropesCallBoynerCndsCitraBlasterBippinsCnionCccoloBhuBerilloCnroseDdergraftClchatCedBatenaudeClkoAodomsCdoAnovoaConeBewburnCgriBantzAmosserDhierClterDinariDerBillmanBeurerCndelBcrayCnicholasDerneyCkillipCilvainCadoryBatterCsterCrmolDinezCnzerDkinCkrisCjeskiCgnusCffeiAluomaCmanCebkeCbyBomonacoCarBitchfordCntzCchtBevensonCggeBaughterCniganAkromCegerBoopCberBlimaBittermanCnkeadCmbellClianCbbeBendigCmmerBashAjenkinAinnissAhurlbutCnsuckerCgoCckabeeBoxieCglundCckensmithCadleyBinkelCgueraBerrmanCinerBausmannDbrichCssenCnlinCllinanCglundDbergAgulloEionBronerCeenwaltCandBoodwillCngCbertBlowackiCessnerBinesCldersleeveFaBerkeDhardCbhardBattonDelyClassoAfralickBouseBluhartyBaucetteCirfaxAevanoffBlserClardBgertonBdieBctorBblingAdunkelChartBrysdaleBostalCreyClphDesBismukesCgregorioDbyBeweesCramusCnnistonEettCloneyDaughterBarcyAcuneoCmberlandBrottsDsswhiteCemeansDaseyBottmanDhernCstalesDnerCrpusDaCnstableClliganCbbleBlutterBhuppCevezCatmonDiresBaplanCffeeCbanaAburroughDdittCcklerBrunswickCouillardDadyBowlbyCuleyCrgmanCltzCddyBlackstonBirdsellBedgoodBateCsilCrtosDrigaFeDnaDcenasCnachCccusAauclairBshmanBrterCendtBnsellBllumsDsopDenderCberDarranBdelsonAzollAwysongBimbleyCldesBhitisEehillDckerBeymouthCllDdyBarkDehamCddyAviveirosCtoCdesBecchioBathCndorenEerhoofAunreinBeckerAtsanBrepanierDgreBorkelsonCnCblerBineoCmmerAswopesDffordCeetenCartsBummerfieldDlerBtuckyCrozierCigallDckelCennisDlzerDelyBolarBlaydenBkillernBhurtzCelorElenbargerCandDbazzBeoBcroggsChwandtDrecengostDoenrockDirmerBandridgeAruzickaBozekCwlandsCserEndahlCmanowskiEineClstonBinkCggioBeichmanCdondoCayBawlinsonCskinCineAquandtApurpuraDdueBrunedaCevatteDttymanBinedoCerroCdgeonBhillippiBfeilBenixCasleyBaroAoverallBspinaBrtegonBgataDraAnormandinDdmanBimsBassarAmotzCrlanCoringClesCirBizrahiCreCnayaCllwoodCkulaBessmerCikleBctaggartCgonagleCewanCcaslandEneEfferyCalexanderBattocksEieDrangaCrtoneDklandDavillaCnnoDlyDchaClleryCgnoAlorentzCcklinBivingstoneCpfordCningerDeCaoBepleyCmingDelinCadbetterBawhonCttinCngworthyCmpmanDbethDarrCheyAkrajewskiBloppBinnisonBestnerCrryCnnellBarimAjozwiakBakubowskiCggerAiveryBshmaelBliffBddingsAhudkinsBousemanClzDdermanCehneBighfillCettBeskettCldtCdmanBayslettCtchellCsseCmonDadaCkalaCislipCffeyCckbarthAguoCllicksonCerretteCanBreenblattBoudreauCngoraCdboutBlaudeBillsEisonCgliottiBarganoCllucciEiDanteAfrasureBodorBizerCshburnCnkbeinerDckBagerAesteyCpirituBppingerDerlyBmigBckleyAdrayBorschBilleBevitaCslauriersCmeryClormeDbosqueBauphinCntonioAcurdBrumeCownBozadCssetteCmachoBlimerBhadbourneBespedesBaytonCstaldoCrpinoDlsCpozziCnelaCdetAbuzardCsickCrlisonBrinkmannDdgeforthBourbeauCrnsteinCotsCnfiglioCiceCeseBiondiClskiBettonCrwickDlangaChanCcraftBarrientezCnhClkeDderramaCheCchandAatlasBrmerCceoBliffCatorreAzermenoBaneAyounceDBeomanBamasakiAwrotenBormCodbyBinerClmerDlitsDcoxonBehmeyerBaterburyCssCnnCkeCchtelAvizcarraCnceCctoryBeitchBanderbiltClloneEeryAurenoAtyerBippsCedemanBhebergeBexeiraBaubCpscottAstuttsDltsDkesCaffBpinkBottileBmithwickBlaneBimeoneClvesterCegristBhifferCeedyDafferBeverinCllmanBcottoChuppEellerDreierDoolcraftEenbergerDnabelBangsterCmfordClibaArylesCansBossettiCdriguzBischCelBezendesCsterCncherCckerBathjenAprofittBoteeteClizziBerrigoBatridgeAosbyBrvisBppermanEnheimBnoratoBlaughlinBhaganBglesBehlerBbyrneAnuzzoBickleBeaseDgleBavaretteCgataAmustoBorningDisonCntzCgensenBizerCragliaCngusCglioreBeridethCngesCllorBcnearDabCloudCelligottCcollomBaynesCrquetteDkowskiDcantonioDCldanadoCkinCceyAlundeenBovinCnginoBisleCnthicumCmonesBesureDageCisureBauverDbachCtshawCryCphamCcosteDherAkutcherBnickerbockerBlosCinglerCeimanBittlesonCmbrelEerlyBemmererClsonCeseBamCllasAjurgensenCnkinsDeauCergensBolliffBelksBanickiDgAinnocentCglesDeAhuguleyDgardBowtonCneClfordDdingCgleBippleBeimbachDderFlBavenerCttawayCrrahCnscomDkinsonCmdanAgridleyBouletteEartCodspeedErowCBirardiBentBautreauCnzDdaraCmblinClipeauAfyffeBurrowClpBricksCaseDndsenBoutDlksDcheCskeyCrgeyCorCbbsBinkleaDchamCgueiredoBestaCrrierCllmanAeslickBilermanBckartBaglinAdunfeeCmondBrewryBouseCminoBimickCenerCckertBeinesCgreeCclueBawCttiloCnkoAcustodioCcciaBrunkCispinBorpDnwallDeaCppinCnsidineDiglioDboyCllarCckrumBluteCewisCaudeBhristianoCannellHBerratoCcereBatoeCstillonGeCrstarphenDmoucheCpertonAbuteauCryCmpersBreyDntonCazealDssardFDgaDdhamBourgetCrrelliDbaCothbyChrDmCehmeCdinBlossDcherBizzellCekerBerthelotDnardiniDendsCnardClserBazeCrtlingDrientesEasDciaCnfieldAaurandBrtmanCnottCendCdisBmonBlmaguerCleeCbaradoCamedaBbdoAzuehlkeBoellerAyokoyamaCcomAwyllieBoolumBintDlandDkClnerDmesBhitlatchBesterveltBalthallDkowiakDburnAvivianoBanderhoffClezAugaldeAtrumbullBodaroBilfordCddCbbitsBerranovaCmplemanBannenbaumClmageCbarezAswearenginCartwoodBvendsenBtrumDackCorieDckardCeinbeckCarnsDnkoFiewiczDcksEhBprolesCenserBmothermanBlusserBinhaClberCefertCddiquiBhuffCerburneBeldonCddonBchweigertDroeterDmuckerBaffoldArutzCndleBosinskiDenowCgalskiBidoutBhymerBeplogleCginaCdaBaygozaCtnerCscoeChmAquincyCastApryCessnellDdmoreBouCrtoBleasantsBigfordBavoneCtnaudeCrramoreCpadopoulosClmatierAouztsBshieldsBrtisBlmedaCdenBkamotoAnorbyBitzCebuhrBeviusCimanDdigCeceAmurawskiBrozBoylanCultryCstellerCringDgantiCokCffetBettlerCrloCngelDdelsohnCliDchiorBcmeansCfaddinCcullersDollisterDloyEaineBauryCserCrtelliCntheyClkinCioCgwoodDinnisCbonAlutonCsherCchtBobatoBevisCtellierCgendreBaurelCtsonCrmonDgoCndreneauEgrafCmbersonAkurlandBresgeBormanDandoBlapperBitsonCnyonDcheloeBawamotoEkamiAjenneyCanpierreAiversBssaBnceAhughDBondaCllierEarsCernerCdgkinsonBiottCbbittsBerlihyCnricksCavnerBayhurstCrvillDewoodCnselmanDningAgwynBustavsonBroundsCizzardDnderCaybealDvleyBorneyCllCehringCdinesCbeilBlickmanBiulianoCmbelCftBeibBayhartCttiCinsCdberryAfreiCaiseBouchCrstEmanCldenCglemanBigaroBettyCelyBabryAeuryBstillBplingBlaminBchavarriaAdutilCryeaCmaisBragoBownardCuthitColinCbosBisonCngesCeboldBesiletsDhazoCpazCgennaroBallAcyphersBryerCoceCismanCedleBoriellCppCopCmposClmeneroCgarBliffBhapelBarnevaleCmpanellaCleyDderoneAburtchBrouwerCehmerCassellDffordBourquinEnChnertBlewettCassDkesBhaktaBesserCrgeCllisBalfourAaveraBustriaBpplinBmmonBlsopCeshireBkbarAzollerBapienAwymoreCbleBolkenBixCckstromBhobreyCighamBesterlundClschCisserEnerDnstockChnerBatlingtonCkelandCferAvirgenCctorinoBeltriCithAurichCestiBmbergerAtwedtBuohyBschidaBrumbleCoiaCistanDmmerBoppsCnnBiernanBhreetDallCetfordBeneyckBartagliaAswordsBtrohlDeaterDausbaughEdleyConecipherCeadhamCanselDlcupDbileBprengerDadleyCeierBouthwoodCrrelsBlezakBkowBirmansCmentalClkCffordCevertBhoverCeleyBelzerBcrivenChwindtEanDrothBaylorsCragosaCntClaamCephanArouttDseyCsClfesBiekeDderCchesonBedingerBasnickCpozaCmbertCfaelAquistApyronBunchCllmanBrzybylskiCidmoreBooleyBinesBerkinsonDineDhamCcorCavlerBartingtonCntonAoliverioCagueBhmanCearnAnoyolaBicolaiBebelAmurthaCffBowreyCroneyDgensternDantCntyDsourChammadCffitBijaresBeriwetherCndietaClendrezCjoradoBckittrickDeyEnnyElvyEchnieCelvainCcoinBazzarellaDonCurinCtthiesCstonDkeCrzanoDmonDburgerCngusEinoClletAluoBosadaCndonoCbdellBipsonBesniakCightyDCagueBavallieCreauCperleECforceDfeyAkuehnerBravitzBowalskyChrBinsmanBepplerCnnemerCiperCelyBalerAjunBelinekBarnaginAissacCaksonAhypesButzlerClsBorakBitzCceBerrellCnsleeCitzDssDmanBastingCrtwickDmerDlandCmmontreeCldemanCkesAguseCillotteCardBroleauCeveDenoughBolubDsonDdschmidtEerCdboltBilmartinCesCbbyBerenCnthnerDdreauCmmillBaymonClyeanDeanoAfriarBolkertsBleemanBitzgibbonsBerrantiClanBarrandAeoffBngerElsAducksworthCbyBryCumhellerBouthittCrisCnisBixionCttrichCalsBessertDcoteauxCpaulCnkerCmuthDeloClacerdaCforgeBanosClleyCigneaultAcybulskiBrystalCistobalBothrenCrnsDkeryCpasCcoBlubbCoreBhittyDchesterCeryCaronDmberDceBatanzaroCstonguayDsellaCrollDlbergCmmarataClleCjigasAbyasBuzbeeCseyCrlingCfkinBrzezinskiCunCicknerCabhamBollerCdilyCckmanBleichCakemanBisbeeCerBezansonCvilacquaCsawCrrianDkeleyCquetteCaufordBaumgartenDdoinCtieCsalduaCrdinCngertDesCcklundAavitiaBrtzCcheyBpelBmicoBlamBdenAzebrowskiAyokotaAwormleyCottonDdieCmacBiltzCgingtonBhitehornDsmanBeisgerberDgleCedmanBatkinCsilewskiCdlingtonDkinsAviveretteCdaurriElesBezinaBanleerDhoyDguilderDbruntAuyBpdegraffAtylorBrinkleBouchetteBilsonDmanBenganBarkingtonAsurrettCperCmmyBtreetmanDaughterCeereCallingBpruellCadaroBolleyBmathersBilveraCemsBhrefflerColarBeldenBchaperBamayoaAruggeriBowenCssoDenbalmCoseveltFCnquilloCgowskiBexfordCpassCnziDickDdaChbergCaperBanckCffaCckersCapApugsleyDlisiBrinzDmusBoundersCnCmpaBlasenciaBipkinsCllarBetroskyClleyBaulsEiCrkisonDisienCngleDcoastClazzoloAowenbyBverbayBrrisClowskiAnippBewbernCddCalonBajarAmysliwiecCronDesBussonCrrietaCnsellCmmaCldowneyBoyleCwenCseCrejonCodieCnierBikkelsenCersBetzingerClinBcquayCpeekCneeleyCglothinDhieCdonellCcumberDranieCbeanBayhughCrtsDencoCngesAlynamBupienCffCebbertBohCflinCcocoDhBisCnkeCghtleBewellynCishmanCbowEuefCanosBanzDdyEaverdeCcefieldAkylerBueblerBropfDekerBluesnerCassBimberlingClkennyCkerBetterClemenCaslerBawamuraCrstDdosAjeremiahBaredAigoAhusemanEbyCrlbertCardBottingerCrnbergerCppsCldsworthBensenCiligCeterBarpoleCakAgutowskiCnnelsBrimmerDeveCavattDndersonBotcherBleavesBenaoBarfinkelAfrerichsBousheeBlaneryBinnieBeldtBaginAewaltBllefsonBilerBckhartBastepAdwightBigirolamoCdomenicoBeveraClavegaCfilippoCbuskBaubCmianiAcupplesCddyBrofootBourterCtoCstiganCrningDmanDlettCopermanCllisonCghlanCbbinsCadyDchmanBlothierCientCearBipollaBhmielewskiCiodoCattertonDppelleDirezBeronBaspersonDlerDadosCrrowDolinaDlinoDicoDdilloCouetteCntoDavanCmbraAbyardButerbaughCseCcyDkwalterCbbBrydCissetteCaultDdwellBoshearsCrchertBlansettEchDdeBiondoClboCehlBesseyCrtaCllesEaCeksEmanCaufortBaylissCrdsleyAavillaBstudilloBrditoBnwarCtunezBmenBderholtBbateAyowellBinBearbyCAwurstBoolvertonEbrightBildermuthBhittenburgEelyBetterDherbeeCnzClliverFngDcomeBasonCrriorDlickAvoorhiesBivierCllinesCdaBerdeCigaBargheseCnwykEingerdenDhorneAumsteadAtwiggsBusingBregoBompsonBinkleBhomanDleBatmanCrttAsudaBtudleyCrockDawbridgeCokelyCecCangDlterBpeidelCaffordDdeBontagCkolowskiBkillmanCelleyCalskiBisonCppelCnquefieldDCegleBherCarrowBetliffCraCllnerDigCiboldCeryBcriberChullDruppDippersBayCulsburyCoCntilloDorDchoArufusCbalcabaBoosaCnkCbbsCacheBiverCebeBeinosoAquinAprudeCeussBottorffCntiffBlouffeBicouDklesimerBettyjohnEiCnalozaBarmeleeDdeeClazzoAoverholtBgawaBfarrellAnovaCltingCdaBicolaDksonBevittDeuBavarreCmAmurrowCnzClloyBonzoBillimanBetivierCrlinoBcpetersCkissackDeenCgurkCfeeDarrenCelweeDachinCdonaghCcarvilleBayhallCttoonCrtelloDconiDburyCoCnzellaClyDecCitlandCheuCclennanAlykeBueraBoyolaCwensteinCshCpiccoloCngacreCmanCdenCaizaBieberCbbeyBenhardtCfebreBauterbachDritsenCssCroccoDimerCnsfordDclosCmayClAkulikowskiBriebelBosinskiBleinmanFerDcknerBistnerDsnerEellClroyBennaCislerCebleCaneyBaleAjolyBimisonBeansAiknerAhurseyBruskaBoveCuCstDkingCoseClleCeppnerBittleDchensCrthCnermanClarioCgbyBertzogCntzDslerCistDerCggBasselCrpeDaCnkCinCgopianAgrimshawCadoBowinDansCogeDdlowCeringBleatonBidleyCannoneBasconCrneauCmbrelClazAfuentezBrisinaCesquezCaherBittingBeuersteinCltenAevermanBstellBrtelCazoBnsignCdoBllermanBichornBdgellBbronBakerAdundasDcansonCcheneDanBombroskiDanCckBickisonBewoodyCloeraDahoussayeCjeanCgroatCcaroCarmondBashnerClesAcrossettCesseyBowgerCurtsFCrnetteDboCplinCoverCndieCkleyBiceroBeaserBannadayCllananCdleAbuscherCllionCcklinBrueningDcknerCoseCananDdwayBotsfordCrtzDelliCnettiClanCergerBloombergBingmanClgerBernsDingerDesCetsDdeCaudetDchumBaughnCtorCstienDquezCrreiroDgaDattaClserCillieAaxfordBtteberyBrakakiBnnunziataCdrzejewskiBmentEdolaBdcoxBbrilAzenonCitlerBangCmbranaAybanezBagiAwolakBilcoxsonBhiteselFhairBeyandCstendorfClkeCinmannDCesnerDkesCdelDdingCatherallBarthenAvoseBillaltaDaCatorBazCltierraAurbanekAtulleyBrojanowskiCapaniBoupsCrpeyCmitaBindalCemanBevisCdrowBaulCshCmmaroAsylvaBwiderskiCeetingBundBtutlerCockingCichCernsDgnerCalderBplawnCeirsBouthwellCltysBmeadBlyeBkipworthBiposCmmermanCgmundCdhuBhufflerCingletonCadwickBermonsCefeldtBcipioChwankeDrefflerDiroDeiberBandozCmselAruddellBoyseCuillardCtellaCsalezCmriellDmelBizerCnerCckardsBhotonCemBeppertBaylCulstonCposoDierCinvilleCdelAquinneyApurdieCfferBizzoCncusBetrusCndeltonEarvisCltzCgueroCeteBatricioDchettCrrinoCpkeCmClafoxAottleyBstbyBritzCenBganBdegaardBatmanAnoellBidaCcollBewhallDbillCtzerDtletonCblettAmurleyCngoClhallBoscaCrissetteDfordCntagDsenBitzelCskellCnderBehaffeyBcquillenClennanCgrailCcreightBayvilleDsonetCustCthiesonCstrangeloDkellCrtinaCnzClmbergCkelaCdrugaAluzBottsCngneckerCgstonBittellCskaCndauerCllibridgeBevronCtchworthCshCffelCdayCamonBauraAkulasECcharskiBromerCaatzBoniecznyDenCmarBivettCrtsCnnearBershCithleyDferAjudahBimenesBeppesenBasminCnssonAhuntsberryDdCittCffineBosfordCpesClmstromDlenCdginBirschmanCltnerDlikerCbnerBennisCltCidelbergCgerCerBartnessDdrickClladayAgulaCillaumeCerrieroBrunewaldCosseCiffethCenzCassiDndisonBintherCmenezCllinghamEhamBessClmanCarheartBaskellCriepyCminoCllienDentineAfuquayBromanDelichCiedelBoosCmbyCchtBlytheBiqueroaClsonDipCerrosBettCdeleBaschingCrneyDgoAevertsDnBtzelBlzeyBichnerBgerBatmanAduckerDhesneBonatiCmenechCllardCdrillBinapoliBennClfinoDcidDauneEtteCemsBaluzAcussonCllisonCeCadradoBrumrineDickshankCoslandDllCiddleCepeauBoutuDeyCrtCppingerCllmanCckburnDaBlayborneDflinBissellBhowdhuryCicoineCenierBausbyDlderCssanoDnerCrdielAburnerBruntonDchCoxtonDsiusDokingCancoDccoBourgaultCssermanCoksCnetCldsDanderChmanCelterBlohmCeaCaiseBischofCllieBeusCllewBastaracheECrtolomeDkDcombFCllsDkDasCkosAaveyBtnipBshbrookBrnoCbourBquirreBppellBldacoCcazarCbanBhlstromBbadieAzylstraBickBhengAyotherAwyseBunschBhittyBeistAvroomanBineCllalonCdrioBavraCsbinderCnmatreDdornAugarteAturbervilleCelBrogdonBownCupinConeCllesonBinkhamDchCanoBestonCerCaBawneyCplinCntDseyAswayneButcliffeCndermanCitsBtrothersEmainCorkDneburnerDlteEpDehrCingleyCegmanCanglBpinellaDerBoulesCmmerfieldBippCmekCdersBhufeltDeCorCiresCellenbergerDelyBerviceCpeCabergBchwingDerrerCalzoBaverCsseCrvisCntoraDsburyCllsDeemArylandCbickiBuggieriBothenbergCsensteinCquemoreCllisonCddenBivetCtaCdlonCcheDcardiBeileyCgnerCchBayoCwleyCngerCffCdabaughAquonCillAprivetteCangeBickrellBerinoCnningBankratzAorlandiAnyquistBorrellDenBaplesCleCkashimaAmusselwhiteCrrinDchCllinixFcanEanBorneauCndorClinarCBinjaresDixDgleDchewCllDewskiCkkelsonCfflinBessingCrkleyCisCasBcroyCphearsonCneelCmunnDorrowCdormanCcroskeyDollDluskyEaranDampbellBazzarielloCuzyDchCstroCrtinekDsalaDcantelChleAlydaBuciusEaniCbbersBouderCbelBinseyDchCllerBegrosBaydenCpineCnsberryCgeCforestCbriolaAkogaBnuppBlimekBittingerCrchoffCnzelCllingerDbourneBetnerCpleyCmbleCllsCarBayaCrstenCneshiroCmmAjoinesCachimBanelleCcobusAilerAholgateCarBiseyCrdClyardBeslinCrzbergCnniganCglandBartlCnerDdelAgualtieriBreenlyCasserDnBoetschCdboldBillandCdneyCbneyCancolaBettingerBarzonDretClleDganoCierCertnerAfustonBreelBortesBlockBiorilloCggsBenstermacherCdlerBacerCbianoAevinsBusebioClerBsquerBnyeartBlemBisenhowerCchBdgerlyAdurocherDganCffinBroletCewesBottsCssantosCllyCckinsBirksenCfioreCerksCckermanDeBeryCnaultCmareeClmonteDcambreBaysCultonCrstChleAcurnuttCllyEiganCevaBrosslinEkeyDmartieDftsBovinCuteeDntessCstCppaCoganCndreyDcannonCgerBloerCatterbuckBieslakBhumbleyCoudhuryCiaramonteCarboneauDiBarnealCppelloCmpisiCllicoatAburgoyneCcholzBrumbackCosnanDgdenDderCendleDeceBownCuCserCndyClsterDlBlufordCandonBiscoeBevillCnceBattinCselCrtramDnabyDmoreClbuenaCdgleyCckstromAauyeungBterBrrellanoCantBnsariBllingCejandreCcockCaimoBguinaldoBaronsAzuritaBeigerBawackiAyutzyBargerAwygantBurmCestBolframBitherellCsneskiBhitbyCelchelBeiszEingerEhaarChrCdgeBaxmanCldschmidtDckCggenerAvosburgBitaCllelaBercherCntersBanscyocDdyneClenzaAuttBrickBngarBlmAtumlinBsaoBryonCudelCeiberBowCberBiplerCllsonCedemannBhornleyBetraultCmmeBarranceCckittAsykoraBweetmanCatzellButliffChrBturtzCrubDayhornCormerCevesonDngelDinfeldtBpiroDekerCethDroBozaCuliereDcieBnedekerBliferBkillingsBituCniardCmeonCgnorelliDgersBhultisCrewsburyCippeeDmpCerronDplerCarplessDdrickBevertFsCmonDmesCiterCgersBclafaniCiortinoChroyerEackDoenbergEberDeidtEeleBatterCrtoriDrisEattClvaggioDadinoCkamotoCineArymanBumleyCggerioCcksBoughtonComCbardsBiccaBexroadCslerCnyDtschlerCdrickDickCagleBaymoCpeCkerCcetteApyburnBrittCessonFmanBoughBlainBisaniBerzDrasClzerCdrosaBalosDmisanoCilleAoremCbisonBliverosAnourseCrdquistBewburyClliganBawrockiAmylerBumawBorphisCldenhauerBiyashiroCgnoneCckelsenDhalecBestaBcreeCquearyCninchDeillyClellandDawhornCgreevyCconkeyBattesCselliCrtenEDcucciCnseauDjarrezClbroughCchinCbieAlyndeCkesBuerasBokkenDenBinzyCllisDienthalBeveyCglerCedomCbowitzBazzaroCrabeeCpinskiCngnerEenfeldCmpkinsDotteDbrightCgardeCdouceurCbradorDountyDlancDergeAkyteBroonDnCakerBoubaBirwinCncerCmblerBeglerCachBatzmanEerClmanAjourneyBimmersonBenningBanusAiacovelliAhustDonDbyCmpheryCfnagelBonigClseyDomanChlCggeBinderliterCldebrantCckBeyCmbyClleCintzelmanDdrickCaronDpBazelipCukCsbrouckCrtonEinDpsterCnsleyDchettCarAguthridgeClbransonCillCerreraBrundCosvenorCistCellDarCanberryBonserBiuntaDlianiCllonEmoreEanCbbonBettysClbBanoClliherAfullenBreseCatesBoxwellBleishmanDenerBieldenBerreraCngCllsCemsterBauntleroyCilsAevattBspyBnoBmmerichBdwinClerBasthamAdunavantCcaBrinnonBoweCrganCllingerBiversCpalmaCfrancoCetrickBenzerCmarestCleeDarivaEnyCcesareCbellisCaversDrdorffBaweCrosaDleyClzellChlenAcurtoCppsCnniffCdeBrivelloDppsCesswellBousarCttaCmpoCloradoBlyneCaysonBearleyBataniaCriniDgoCnteroCliAbuttreyElerCrpeeClkleyCitronCdaCblitzBryerDdenCouilletteDttDokmanDnkCeshearsDnnenCannumEdlDmanDcewellBoyterCmbergerCldCgenCedingCbBlauveltDndfordBiggerCermannDleckiCbbyBertholdDkmanClvinDlomyDandChneCechamCcherCamsBaxCsshamCrretCleyCcchusAauxierBtkisonBryCochaCechigaBnspachCBlgarinCcottCbertyBgerBdolphBckmanBbdulDallahAzwickBiemerBastrowCjicekAyokumDleyAwittrockCnebargerClkerDhamBhithamBetzlerCstlingEburyCndlerCllbornCitzmanFDghtBallnerDdroupAvrabelBowelsClkerBitielloCscontiCllicanaCbbertBeseyBannatterDgilderDdervortFgriftDalstyneCllecilloAusreyAtynanBurpenCllerBrislerBownsonBillmonBhrelkeldCornellBerrioBauntonCrryDdyAswobodaCihartBustaitaCittBtuberCrineCookeyCmartinCigerCainbrookBolemBmailBlighBipleCebenBhumakeCrinerCowmanCinerCeenDcklerBeimCcristBcogginChultheisDmalzDendelDacherBavardCulterCntillanesDdifordEeClzerDvatoDtzCkaiAryckmanCantBuckBonaldCckerBittenberryCstauDkCchartBhynesBeyerCuletCserCdingtonDdingtonCbelloCasorBafteryCbagoCaschAquintanarApylantBuringtonBrovencalDmCioleauCestwoodBothierCpaClsterDitteCffenbergerBinnerCetrzakBettieCnaflorCllotEhamBaylorDeurCpasCikAoyolaBsbournBrzechowskiBppenheimerBlesenBjaBhlAnuckollsBordbergConkesterCldBittaCblettBeuhausCslerCdBanneyAmyrieButchBottoCsqueraCrenaCntaltoFgnaBizelleCncyCllikanEayDerDbournCkelsCguesCesnerBershonDrowDlinCliaCigsCaleyBcraneyCmartinClachlanCgeehanCferrenCdoleCcaulleyCanultyBaziarzCulCteerCrtinsenDsonDiottiCnnaDgDceClbonChCgnussonCclachlanDekAlurieCcBownCrangerCnonBisenbyCnsleyDgerBenkCavensDrnedBauritzenCthemCshbrookCndmanCmarcheEntiaCguerreDrangeAkoganBlingbeilBistCmpelDeCerBerfootCnnamerCllemsBammerDenAjessCpsenBarniganAislerCheeCabelAhuxCngateCmmellCltgrenCffakerBrubyBoverCrnickCoserDleyCgganBiranoClleyCghamBeuserCnricksonDegarCllwigCideCdleyBasegawaCrttCmbrightClfacreCfleyAguionDnanBrunwaldCotheCiesCeaneyCandaDbillBothardCssmanEerEardDhaCldnerCbinBlossBinyardClkesDdenBersonCphartCnglerBautierCssettCronCndhiClushaDlagerDdamezAfulmoreBritscheBowlesCutchCrwardCotmanBluddCakesBerrieraEeroGiCnimoreCgleyDanCarnBarrierCnslerDeClzoneCirweatherAethertonBlsberryAdykemaBuppstadtCnnamDklinCetDCdgeonCbucBoxeyCryCnmoyerCdgenBisantoCnglerCmattiaCldayCgennaroCedrichBerossettCputyDpCmasiCgraffenreidCakinsDdyBavinCigreCddarioAczerwinskiBullensCbbageBracraftBonstanceCmesDbestClettiCghillBlerkCaybrooksDssBhristofferseCiesaCasonDmorroBessnaClentanoBayerCrolanDnegieCpetilloCllierCdoganCbaAbyromDnsBurrowesDketDdgeDbageCkowskiCchholtzBruntEgardtEettiDmbelowDggerCoadhurstCiganceCandowBouknightCttorffFmleyCsargeCrgerCnaCmbardierClognaCgganBlumerCechaBirneyDklandBetancesCranCnnyDesClinDgraveCalerBauchCthCshirCrtowDoDnhouseDileCllwegCisleyDnsCehrCdillaCchusEerFlderAauzenneBtenBstleBllisBgarwalBdgerCamekAziolkowskiCnkeBazuetaCmoranoAyounkinAwonBittigDmanCnsettDklesCedmanBhitnerEcherBetherbyCstraEhoffChrleCeBagamanAvorisBicknairBegasCasleyBaughCnishDderburgCllettaAtunneyBrumboDluckDemanDbyComblyDjanBourvilleCstadoCneBitcombCmpsonCgnorBhrushDesherCiedeBewsBamplinCffCckerAsyversonClvestreBummerallBtumbaughCrouthDakerEdfordConeyDkleyCeinhoffFbergerCairsBpignerBolteroBnivelyBlettenBinklerDegalCmoesCllerCgelBhoeCireDnkleCellmanFerDatsCarerBelvageCdlakCaBchriverDimkeDeuermanDanzBavoryCultersDersCisArusinCmfeltChlandBozarCsboroughCnningClphDoffCgueCbieBivieraCmerCehleCccoBheinBetzlaffCismanDmannCBayesCubCminezAquesinberryApuaBrocopioCioloDntzCewettDasCahlBortugalCoveyBloofCatzDistedBinzonDeiroCckneyBetrovichCrlChrsonCetsBavonCutzCscarellaCrasColiniClsCffordAoyerBvelletteButtenDenCrsBrdunaBdriscollBberlinAnosalBivenCsbettBeversBathansonAmuleCkaiBozeeCwersCtykaCrencyCntfordCllicaDdenBittenCserCnaCllenderCdgetteBesserlyClendyCiselDdingerCanyBcnittDemarCmakinCgaughCcaaBaurielloDdlinCtzkeDtiaEeoDsumuraCsudaCngelsCloofDiziaChmoudCglioneCddixAlucchesiBochnerBinquistDoCetzBeventhalCopardCmanskiCiserBauryDberCmberthAkussCngClikCiperBroutBotterCrtChlmeierCfflerCellerBnipeCaussBleiberBisseeCrstDchClgoBerlinCllisonChlBalbAjordenBantzenCmarAinabinetBkardAhusmanCnsbergerDdtCcksBoutzDseknechtCotsCgsettDansBintzeBessionCnaultCmmingClsleyCinenCffingtonCberlingCasleyDlBazleyDeltineCytonDseCwkeCstonCrwardDvardDrowCnnemanCffordCdnotAguerroBraigDhmBowinsCrdilloCosbyBlattBibbensBhentBerrardDmannCilCboCanBarlingDdenhireDbuttCgnerAfurgusonCnchessCjiwaraEtaBrileyDgoBorsheeClkesBillerBernaldDberCingoldBavoriteCulCrrellyCirbankDllaAestelleCpeyChlemanBrtlChartFdtCbeBlseaClsDmanBisenhartBhmannBarnhardtAduplantisClacCcoteBravesBoschClceBivitoCtchCmauroBerringerCmeoDartiniClimaChnerCgenCfranciscoDoorCdeauxCbnamAcypertButrerCsumanoDtisBrokerBourtoisCstantinoCrmackDbeilCpherCnlanDklingCgdellBilleyBhapdelaineBendejasBastigliaDsetteDhinCrstensenDolCprioClcoteDawayAbyfieldButnerCshwayCrrittBrownerDbstCinerDghtonDdgerDckleyCendelCattenFDinerdDckmanBowneCuckCrundaDdnerCnenfantCerDhmerCdifordBleauCankinshipEeDhaBittingCssonetteCgbyCbeauBeverageCrmudesDkeDgevinFrsonCndelClvilleCchardCarceDdlesBatzCrtlowDrenAayoubBvansBumillerBrvisoCpinCnwineCmwoodCentDhartCcandBntleBmbrosinoBlongiCmClshouseBhartBguonAziebarthBeledonBakrzewskiAyuhasBingstBedinakAwommackBinnettDglerClcoxenBhitmarshDstlerBaytCtleyCsserCrkentinAvollCgelsangCegeleBivancoCntonCllafaneDesBersaceDCnneBanwagonerGenenDleuvenDaukenAuseltonBrenAtrumbauerCittCeadawayBozierCpeCmczakDberlinDasiniCllettFrBitsworthCrrellCllyBaveraCrnowskiCnouyeCllAswarthoutButeraCretteBtyersFCipeDcklandCeveDmbridgeDarnCarkesDnberryDhrBpinoDcherCerberDeceBooCnntagBnellerBmallingBlowikDcumbCivaCempCamaBitzCstoDemoreCndelarBhiptonDllingsCeeleyCarberDddixBevernsFinoFCnsabaughCderCawellDmonsBchrantzDoolerDefferEererCaliaBaumCntibanezDoDjuanCmpleyCilerCbellaDbaghAroyallCttmanBivenbarkCkardCcketsonFlBethmanCilyCddinCasonerDdeBastCnalloEAquintalApungCcciBrotoDsperieCimCeusserDslarBowleyCstmaBinnixCllaCetschCckerelDaBharrisBetwayDilloCrinDedaCnnypackerEebakerCdrickBatinDchellCrodiDmanCntanoCduaDroAosterhoutBrnerBppBlivarBhlsonBdonoghueBcegueraBberryAnovelloCgueraBewquistDcombeCihoffChringCesCbekerBauAmundoCllenixBorriseyDontaDilloDefieldCngilloClinoBintoCdgleyCchieBenziesCdvedCchlingCalyBcshanCquaigCneesCgladeDarityEheyCduffBayweatherCstropietroEenCrantoCniscalcoCizeChmoodCddocksDayCchaCagAlukenBoppClleyBlanasBitzDherlandCndenbergCeuBetcherCntiniCmelleCetCcuyerCberBaursenCtchCrrickCntiguaDglinaisClliCfeverCbatEdieAkurtBrogmanBohutBnarrBlimasCarBittelsonCrschbaumCntzelDcannonCmmellCllgoreBettnerClschBarleCpoorAjohanssonCckBenkinsonBanneyAisabelleBrahetaBnsleyAhyslopCBumanCckstepBolleranCerrBinzeDnenkampClgerCgginCcklinBerouxCnkleClferCikkinenCckstallElerCavenerBaydelCvemanCubertCrropDnoisCnsardDoverCmmittCliburtonCefnerCdsellCakensonAguynnCizarBroutDszBooCmerCllaCdbyBlanzEcyBivanCesenBerstBaymanCrrawayCborAfurnessBriskCemontCaryBorandBessendenCrrignoCaronBavreauCulksClboAewenBvertonBurichBtchisonBsterlyBntwistleBllingsworthCdersBkBisenbarthBdelsonBckelBarnshawAdunnebackBoyalCnnellanClinBibiaseBeschenesCrmodyCnmarkCgregorioBarnallCntDsereauDaherCmmannDesAczarneckiBuylerCstardCmminghamCffieEeeCdneyCadraBriglerCegerBoughlanCrvinDtrightDchadoCnneryDfortiDdronClosimoDcloughDaCheeBlaireBiottiBhillDenCeckCackoBevallosBavittEnsCstagnaDhwellCrrozzaEaraCpraCmpasCllasCisonDCggianoCbotAbynoeBuswellCrpoDnamDgesCergerDlowDcheCckleBruniDmmittCodersenCieseCeitCakebillDatzBoyersCughnerCrrorDquezCnelliChnerBlazeDkerDckmerBissetteCbbinsBhattEiaBesslerCrghDesfordCnsenDningfieldDitoCllantoniChlerCehlerCazleyDuchesneBargoCnnermanCltesDogDlantyneCdAaxelsonBpgarBokiBnstettBlejosCcocerCburyBicheleBhlBcklesAzerangueChnerBankCcariasAyoungbergCrkeBarbroAxieAwydraBorthleyClbertBittmerDheringtonCshartCreCnnieDklemanCllilamsEerCedemanBhittinghamEbeckCetselDlessBesterbergClcherCgmanBaterfieldCsingerCrfelCnnamakerClbornCdaAvoglBizcarrondoCtelaClledaBerasCnutiDeyAulreyBhligAturciosBremperBorianDbettBhrailkillBerronesCitelbaumCemsBayAswoopeBunseriBtutesCthomasCrohmEbleDiegelDeicherCodolaCinchcombCevesDppeDmDllerCaudtDrnerDmantEDckpoleBprankleCecialeCahrBowdersCvaCluriCderlundBlinkardBkatesBjogrenBirianniCewertCckelsDaBhugartCoultsCiveDmerDerEldCepleyDeranCarperBevinDereCtoCgundoCdlacekBcuderiChurmanEelkeDoltenDlaterDislerEefelbeinDalkBanonCeCbalaAruyleDbalCfCebBowseyCsolCcheleauBishelCppeyCnggoldCevesCdingerBewCtherfordCmpeCithBafterDfaeleAquintoAputzCrdomClsDaskiBroppCincipatoCeissCadaBolanskyCchBlathBittardCnnockBfarrDnnenstielBennimanBaulingCtchenCschkeCrkeyCndoAoverlyBuimetBttmanDerBstlundBrmistonBcchipintiAnowackiCrredCackBishidaCllesCcodemusBethCaleyAmyricksBurffCngiaClletBotsingerCscatoCrtDadoCorsCnnierClyneuxCdzelewskiBiuraCnichClitelloDbrandtCchalikBeserveCrleCndivilClaraCadowBcnishCelhannonCcroyEadyBazzellaCuleCtteraDhenaDasCssDcorroCroneDinelloDguezDcellCnwaringDhartDganoCggiAlymonButerCseCkasikCizCdlumCczakBowenthalCssettCrentzenEdoCngworthCmantoBisiDhCpskyCnckCedtkeBeveringCssmanCmondDboCdonneCathamBauferCnphearDglaisDdoCmphearDbertonCfonCdeCcrossAkyzerBrokCingCellDhbielCatochvilDchBovarCstkaBnudtsonCaackBliebertCahnBirkleyCmzeyBettleCrrickCnnersonCeslerBarlinCnAjennyBanousekDAimelBcenhourAhylerBungerCdockBouptCppingCopsClquinDimanDahanCdappBiresCllenCckmonBersomCnrichClveyCidtEemanCdstromDinCbronBayterCrnDdageDborClstedChneCgemannAguzikCelBroesbeckCittonCegoCazianiDstyDneyBouinCssageClstonCheenCdinaBladeBiorgiCambroneBerrityFshDoDlingBaulkeCrlickClianoCiterChaganCgnierAfriddleCedericksenCanquiBollansbeeCersterBluryBitzmauriceCoriniCnlaysonCeckeCckesDhterBerronDdinandBarrelCcklerAeymanBscarcegaBrricoClerCbyBngmanDelmannBlsassClistonBddlemanBadieAdummerBrostBorroughEanceColanCnalsonCmenicoBitullioDtmarCshonConisioCkeBevinneyCsirDchampCrricksonClamoraCitchCchantBaveCnekChmenAcurciCdjoeBrumbleCoxtonCeasmanCaneyDderBowlingCulstonCrtinaDlewECplandCnveryChrsBluneCausingBiprianiCnnamonCancioloBhubbCittumCenardCarlesworthGboisDmpineEleeDgoyaBasselmanCrdelloCpassoCnnellaClderwoodAbyfordButtarsCsheeCrrageCentelloBrzozowskiCynerCumitCookoverDnnerDmbergCixeyDnnDgantiCemnerCawnDnscomeEniganDdsherBozekCulayCrmannCngiornoCllinChlerCgertCdenhamerBloseCindBivonaCtterCllipsCblerBenferDedettiClueDlangerDfordChnCermanBarnhardtCltzellDlingDducciCinterCbineauEchCadeAattwoodBsmusCaroBrtiagaBprilCplebaumBngCdingBmarDkerBllsupDigoodCersBginCarBchenbachBbramowitzCbasBasenAzehnderAyoppBelleDdellAwynterBoodmanseeEingCllBinborneCllseyEefordCdgerBhitenEchurchCangBenCissingerDnmanEgartnerDdlerBaltripECgarCffordAvitaglianoCllalvazoFcortaCgnaCckreyDiniBentimigliaBandenboschClvoDazquezAutseyBrbaniakBnzuetaAtrombettaCevizoDmbleyEaineCaversoBoresClanBillisonCetjenBeeCachoutBaubeCthamCrwaterDbellAsydowCBwimsCaderBtriplinCopsDltenbergCeinhauerElEgerwaldCarkweatherDllmanBquierBparacinoDnDdaforaBhifletDbataCevlinDrrickCakeBessumsCrvaisCntersCeversDlyeCarfossDbrooksBcolesChwagerDromDmeltzerDeffelBaxCwinCterfielCrdinaCnromanDeDdinClamancaEdinCkCbiaArustinDhinCleyCeterBowCtterCsenzweigClesCheCderCckeyCBiterCethDdCdingDdlesEerBennickCmmersDerClyeaCilleyCderBasheedCkowskiCbinAqueenerApurselBrueCowellCittsDmoCeslerBouncyCrcheEaroCllmanBleasCanasBinkleyDegarClgerBhilsonBettiesCrrodinCndergrastBataoCsternakDsarelliDkoCrshallCnosDellaClomboCdilloAoyamaBverlockEbeckBttersonBrrellCnellasBpitzBkellyBfficerBbandoAnoggleBicosiaBettoCgrinBataliCkayamaCgaoCdelAmusialCrrillEahCnschCcciBrozekBoyesCwrerCrisDaisCorhouseCnicoDeDdyDcayoCleBiltenbergerDsapDoneDlikinDardoCkaCchealsDcoBeyersonCricleCndellCinhardtCachumBcleroyCgrayDonigalBaultsbyCtisDheneyDamorosCrroDcilFalCntzDningsCltbyDchowCioranoChnDlumCglioCeCberryAlustigCellenBongwellEeneckerCflandCcascioBinneyFmanCghtyBevellDayCnahanCmenChtoCbaronBanctotCmyCinezCffoonCbombardAkujawskiBrogerCeutzerBorhonenCndoCllmanChanCgutBnausBiviCttelCnnerDdigEelCeselCdneyCbbyBhangBettlerEererCpnerClliherCenumBanodeCilAjulyChaszBowettClicoeurBeonAiserBngrassiaBmaiAhutchcraftCmistonClingsCkillCizengaCgleyCddleBoseCrnyakCdderBisleCllenbrandFCguchiBertzlerDdonCppnerECitmannCckartBazlewoodCylesDekCwthornDkinCuglandCslerCrbuckCppelCmblyFetonCgamanAguzziClletteCinyardBroggCiseDffingBotoCsneyCodsCleyDdblattBledhillBirtonCltnerDlockDhamDfillanCblinBentnerChlertEBartenDneyDlowDettCllesDeanaAfutralChrBriedlandCansonFenBouldsCllmerDandBlaxDvinBirkinsCllionCgueredoBerrillCnsterDleyBauverCrfanCctorAeusticeBpplerBngelmanFkeBmmerBlzyClwoodDerbeeCksBhretBbbertAdurrahCprasCbuqueBragooBonlonClloffCiBibellaBerricoCmkoDarBarringtonAczaplaBrookerCeaghCanorEerDftsDbillBoyerCwmanDherdCttoneCstilloEerEasDenzaCrkerCllinsonCelloBlingmanFermanCabornBitizenBhmuraCausseEdhryDpellDncyBerroneBavesErlyCulkinsCrnCmpfieldEanelliCllahamCdoretteAbutkovichCskeCrrierDkleyCnyardCdgeCckelewDhheitBromanCesciaCaselDinBoysterCoeCnomoDnetDdiChnsackCbbyBlombergCanfordBilderbackCgginsBentlyChrendsCegleCdoyaCchtolCaubienBayerlCumgartEeisterCrrattDloweDkmanDbagalloCldreeCineDlCggsCcoteAaylwardBshurstBrvidsonCthursCrietaDeyEguinDantCnerCmorCizmendiBnkerBmisCendBlphinClbrightBikinBcresAzupanCchowskiBeollaBanchezChradnikDlerAyounanBeaterDrtaBarringtonCntisAwoomerCllardDfingerCernerBitekCshonDenerCngerterClletDdingCedemannBeiselCdekingCaryBaybrightCrdwellClkinsDdorfAvothCitBirdenCloriaDlagranBastaDhonCqueraCntassellDderlindenGgriftDcurenClentaAunderdahlAtyraCgartBwiningDfordBurlingtonClliusCbmanBrowellCieuCansueBousantCrgersenCokerCnyCmeDaCcciBippinsCnnerCmlinCllinghastCdmoreBetiCdrickBaceyAswanbergBundeCmmittEerfordEaCeBtratmanEndbergCorckDberCeitzCayerDuberDigerBponaugleDffordCaranoDgnolaBokoloskiBnayBloughBkowronskiBieckBhimkusCethDrkCanklesDkespeareDhidBevyCrgeantCnegalCidenFllCarlsEightBchwalmDugDilkeEerDeckBawtelleCntoreEaDksDdquistEenClingCbineCathoffArybergBustadCffingCdnickiCaneBozziCwseCsenauCdesBisserCgginCessEeBhotenBeineckeDgleDchlingCdnerCbeloBaynesCimondiCheCdaAquerryDlletteApulsiferBrochnowCettyCatoBoultonDdrierCllDicastroDhemusDasekCissantChlmannBlotnerBitkinDaCoCnkettClotCekarskiCchonBhilippeBfauBetroffDermannCplinskiCllerCcinovskyCarseBattilloDagueCrlierDentiDchmanCneCffAotaBrtnerCosAnolleyCakesBighCcolosiFayBewnamCtterBassCpolesCkataEmotoAmurielCckBorlockDagaCntillaDgeauClitorChneyBitchenerBeyerhoffCdelBcniffCmonagleCglownEincheyDarrityCcrightDorveyEnnelDargoBazzeiCtulaCstroianniDsingaleCringEcleDcCnsDnonEixEeyDgerDaloCloDanChonyCdrilCckowiakFDintoshAlurryCczynskiDkeDarelliEBoudDCseeCrenceCiaconoChseCderBipariCnebargerDdamoodCmbaughBettsCleuxCepDderCardBaxsonCwryCverdiereCughtonCstraAkurekBrissEhnanCetschmerDbsbachBontosBnobelCaufBlickCevenCawitterBitchinCrkendollCnkelDgreyClbournBensingerDnerlyBaminAjustinianoCrekCnkinCliaCdonBordahlBeanesBarrellsCmalAiwamotoBsrealChidaBnesBmmelCanBhleAhyreBurnCnnCltmanCffstetlerEerCbnerBoweyCrneyCotonCltsDscherDenCggattBilaireBerzCnneClstromDlicksonCinleinCckathornFrdCatherDrtDdleeBauptmanDgheyCttCrringDfordCmmillDedClperinCigCgwoodDstromAgunnellsDdlachCardiolaBreenoFlandBonceCldsbyCbelBisiCllinsFeBermanoCibelBaugerCrriottDbarinoCnderCjewskiAfunariCllbrightCellBritzlerCeshwaterDasBortinoDbusCndaBlohrCemisterBischCnksBenstermakerCldsteinBawCrhatDahCnkhauserCggCderAexlineBmighBguiaBdmanBcklerBastburnAdyBunmoreCbuissonDinskyBrayerBoverspikeCubledayCtenCrnerClsonChrmannBislaCrenzoCpaolaCnesCckieCblasiBewolfCsantiCnnehyCmmingClkerCcolaBavillaEdsCughtridgeCrvilleDlandCnzyDdyCgenaisAculottaBruzadoDdupCoswellBoverdaleElliCutsCrbellCplanColbaughCnyerDleeDigliaroCmiskeyCberlyBlendeningCairmontBienfuegosBhojnackiCilcoteCampneyBassaraDazzaEdoCrewDbinDabajalClcagniCilCddyAbusbeeCrtsDbridgeCngeDdickChlerCckerDholtzBruenCoceCiteDgnacDerlyDdgmanCahamDdishBoyingtonCrjasCnnieEDhommeChlenCgardusCckelmanBlickCackerbyBizierCroCnneyBertoliniEinFECntoDoClgardeDdingCckelDerrilBazalduaCyesDardCrrusEisDosDaCllowDboaCkewellCginskiCdalamentiCckhausAavilezBuvilBtteberryBrdonBnzalduaCelloBmslerCoCbrosioBlthouseClesCixCbertiFsonBitchisonBguinagaAziemannCckefooseBerrChCckBartmanChmCbriskieAyohnBellowhairCatonBarnallCpleAwolskiBixonCnfordCllnerEmsBhitsittCeelwrightBeyandtCssCngerdCatherholtzBattenbargerClrathDpoleDdripAvogesBioletCnzantCarsBeresCnezianoCillonBawterCughnsCnwartDostrandClienteDderasAuhrigAtunisonCllochBrostleCeasterCaywickBoyeCmsonDaselloGkBippitCnajeroCftCendaBhoringtonCierryEmeDbeauCakkarBewellCstClferAsweetserBumBtratfordEcenerCokeCiversonCellingDfanCavrosBpeakerCatzDgnoliBorgeCberBlevinCabaughBimsonBhuppCoultzDttsCiromaCetleyDrrowDffeyCawgoDmburgerBesterCgravesCeligCatsBcioneauxChwartzkopfFbeDolesDmuckDluterEechtDillaciFdgenEeberDeweEcterCarpelliDglioneBautterCntelliDdmanClmiCbadoAryerCdbergCbaBushfordCnningDkCddickBotondoDeCsenfieldCesnerCcchioBitzerCppelCmesCffelCchisonCbbleBeynoldCshChnBattiCsorDnakeCppoldCndoCdosevichApuliceCffBrichettDbbleBoynorBlowdenBitzenDtsleyEerCgeonBhilyawEippsBetiteCstanaCrroDoneDaCilCdoneBawlowiczCtteeCrtenDlinDiseauDedezDdonCntherCekCcificoAottsBstrowCornioClundBrsoBotenBnkenCielCanBllisonBhlsenDingerBdowdAniemiecBeubertCmbhardCavesDtheryBakasoneAmyersonButoCntzDezCmmeECjicaCiseCenchBorrissClockBishoeCnierBetzgarCroCiserCeseCalsBcsweenCquireFnnCpheetersCkellerCilrathCgownCdavisCcuenDlentonBaxhamCtsuiCrrinerDletteCntleDsurDcinoClandCjkaCischCheuxCdryEizCckleyEeAlydickButtermanCppinoCndahlBovingoodCudonCngmoreBippmanCeferBevequeCscarbeauCmmerCdgerwoodBawverDrieCtteaCskoChmanAkulpaCkowskiDlaCbotaDalaBrizanEDkorianCavetzDmpBowaleskiBnoblochBlostermanHCepperBirvenCnnamanFirdCllamCeslingBesnerCeblerCagleBarlsCpinosCntnerCbaAjuniousBefferysBacquetAizziBshiiBrionBfillAhyunBotardCrmanCppesDkinCkansonCdaCcuttCaglinBitesCraiCndleDchCltyDdCerCckleCblerBenrichsCmpsteadClmersDlardCimsDdlerCarstBawbakerCuCrkleroadDariCnneyEafordCmidDburgerCltomDlfordAguilliamsCeretteBryderCosecloseDenCimleyCeenidgeEkCaffamBoucherCodenoughCldsboroughEieBlosterCantonDdsonEdingBheeBethersCrsteinCeseyCddieBayerCwCverCunttCrtlandDrigaDoutteCoCnAfronkCitzeCenzelBorgioneBluittCinchbaughCachBioritoCnanEmoreCmbresCllmanDeCgeroaCcklinBeherCddersenBambroCirbairnAevesBsperanzaCcalonaBlseyBisensteinBhrenbergBargleAdressCaneBorothyDiaCganBivelyBewolfeCttmanCsiderioDchCnnenDkCmarisClsignoreCjarnetteCereCdmanBawsDnCuphinaisCnzDtinDnenbergClbyAcurrenceClwellCestaBrostonEsnoDmleyCisciCawBoryellCoterCndraClumbiaDpittsDasCachBlinkCevingerDrmontBistrunkCriloBhiricoDarelloBephusCcenaBavaliereCugheyCsimirCrwellDlonDbonaroDaveoCntleyCllejasCgneyCdieuxCbanissAbushardCrlewDasCdzinskiCcklewBruneauDmmerDeggemannCotzmanDssDadCittianDmageDlesDckmanCenemanDitensteinCandelDckinsBoydstunCttaCsketCrosDgmannDdeauCnifacioCltenCehmanBlundellCoodsawBjerkeBiffleCckettFrsBevilleCrgrenEeyCnzingClfioreCirneCckertCboutBaumertCtteyCrtmanDrsEiereDceloDbeCllietChamCbstAautonBsperCbellBrzateCgentoCelCakiDiBpoBntleyBmodeoCmannBllynDensworthCdapeBkeyBbeitaAzweifelBengCilerBamorClenskiAyzaguirreBousefBetmanBauAwyerBoolwineChlgemuthEersBittenbergCngroveDdCmsattCllimasDkensonDdeyFrmanDczynskiCgtonBhorleyBellonsEesFCirichDdemanFCeklyCastBasmundCrshawClsonDdnerDchDbergCgenerEmanAvriezeBossenCrceCorhisCnderheideBiruetCcariBerneClasquesBautourCrtanianDonaCnkeurenDdineEermeerAurseryBnderdownBhrichClmanAtworekCineCellmanDedieButinoCrmelleCbbBroopCivediDanoCevathanDeseDanorEcyCainaBophamCenjesBippettsCeuBhomureCatchDnBetzlaffDtertonCnaCllCamerBappanCnkClcottCggAszczepanskiByringBuraceClzerCgrueDarmanCessBtyonsCwartCupkaCreyDaubeEteCoddartDckbridgeCjamesCingerCeimleDenbergCartDmandDllerDhlyDgerBpurginCrowConslerCeasCainhourBonesBmitsCelcerBlovakCatenBingleterryCmienCdebottomCbrianBhellhammerEburneCamboBepedaCigelBcoginCiannaChmollEelzerDeuDachterBavantCusedaCtcherCndorCmpsellArughCfenerCdolfBotenberryCssowEbachCotsCllmanCdriqueEeguezDkeyDaBisingCniCgganCentsDdlBhinesBessCinboldBaschkeCrdinCinCcicotAquillinApushardBrimroseDesCesseyDcourtCattsBostelCppellBlumerBingreeCeroniBflugBetreEarcaDerkaCruDkinDgandeDanioCnnaCkarCaBaulhusCsquarielloCrrasDmentierDaCnzerCmplinAoviattBsterhoudtEndorfCmunBrtmanCloffCbanBnofrioBlvedaCtmanBkeeffeBcanaAnunemakerBovyCffsingerBishCdayBetheryCstleCmitzCidertBadalCckAmuszynskiCnstermanClherinBortimoreEerCntesinoEalvanGbanoCmonDanDCganBinnsCllwardEingCchelsenFalBewbornCtroDayerCnschCloyCggsCadersBcsorleyCmenaminCleadDauchlinCguffeyEckinDlaughlinCferronCentyreCcrumDawleyCbainBayhueCuCtzenDtonCrseeDrinDlandDkumCntillaDfreCltaCkuchCdlockCclarenDauleyAluzierCthyCfkinCcenaBoudinCthropCrchCnaCllCadholtBisaCppoldCkesCchtmanCbertoCakosBewickiCvettElCntineCjaCgreeBawheadCuroDderCrdCnmanDkDingCmaClorAkrobCigerDegelCejciDiselBozelCsCnkelClstadCenenCcsisBnoblockCebelBlopferCeeBildayBestenCrbsCmpkerCathleyBazeeCwasakiCurCmerDakaCllenbachCfkaAjerrellChleBaycoxCrdinChnsAivesterAhyppoliteCcheBusbandsCrCppertClinCbleyBorseyDnakClzwarthDmonDlabaughDawayCdesCakBinesleyCllwigEebrandCghfieldBeslopCrradaCndryxCllumsCitDshmanDndelBayslipDfordCstieCrtgroveCnusCkimCinsCdnottAgundersenClinoCidrozCebertBressettDenhouseCaydonDmlingDhnBoupilCryDelickCodreauEnoughClayCingCersBlatzBillikinCesekeCammarinoBetmanCronimoDardoCnslerBazdaCribaldiChanAfuryCnderburkeCkudaCgittCerstBortmanDsgrenDmicaBlukeCinkBittonBeltzCketeCitChrenbachBaroneDinasEesCgenAewinBsquilinCchBnderleBlleryFsBkbergBgliBffingerAdymondBulleDaCheCdneyCaneBowlessDerCrmineyCppColingCmerBisherCllenbeckCfilippoCbernardoBeyoeCvillierCnleyClandCfibaughCebCbowBauerCttaCrcangeloCoustCmelioChmDlmanAcypherBurlingGCpitCltonCencaBroppDkeCemerCaceBosioCrzineCombeCmanCloneEmaDlingwoodDettaCderreCckeCblerBlaybrookBircleCncottaCmminoBhristoffGinaCisumDllemiCevereCaeDchereBervoneDmakCfaluBaubleCtherCsoCrnsDcamoDboCpocciaDelloGCninoCmbareriClviCbinessAbushellCrttDsteinDkleCnnerDdrenCechlerBryandCusoCownsteinEDuseDdtDadenCisbinDghtmanDdgettCenesDitenbachCazzellEeeDmwellEhallDdstreetBoytonCwlandCulterCssertCnuraDebrakeDacciCeckBlystoneBirchardClalCddyCbeeBevansCthkeCrtelsenDneyDgfeldCnwareCllonEahCenBattertonCrberioCmberCgdonCdeauxAaverittBugsburgerBtesBrvieConowitzCensCchCayaBngelosCdradaBmellCanteBlvinCmyDquistClsBispuroBguillonDdeloBdmireBcyCetoBbbotCalosAzdenekBarembaCccariaAyoussefAwronaCinkleCedeBottonColstonClpertDlmanBinceCmberleyCllmoreEettsCkoffCederCckertBhitenackBernickClteDdenCiskopfEenbergerDchBallingtonDderAvosslerCreBigoCerlingCctorineBerdunCncillDaBazguezCsselCnzileDvlietDtreaseDnostrandDderveerJnDcilAuyedaBmphreyBhlerBberAtutsonCrrentineCllierCgwellBrundyCipodiBomerEiDasiFelliCkarskiBisherCbbetsBhweattCistleCarringtonBesarClescoCasdaleBatemCniguchiAsurielCdlerBtutsmanDrmanCriteDelowEightDawderEnskyEhlCoursDngCinebaughDltsElsonCeyerDlleDffyFensmeierCathamBquillanteBpiessCargoBouthwardCllerCdenBnuggsCellgroveBmyersCiddyBlonakerBkylesCowronBivilsCqueirosCersCddallBhortyDntzCinglerDleyDbleyCerardDlnuttDdrickCasteenBerenoClkeBcovilDlaChuettFsslerDreckengostEanzDoeppDneidermanDlangerDieleDeuermannErtzEidlerEffDanerEmberCardinaBavedraCulnierCterCrroCmbranoClomoneCbourinAruudCttenCffinoCddockBowserCussellCsengartenCmingerCllinsonChmanCeserCdenbergCberdsBidgellBhodusBeynagaCxrodeCvelleCmpelDigioCisingDlingCetzBayosCvenscroftFellCulersonCsmussonDkDeCgonAquesnelCashieApuzoCterbaughBtakBrostCisbreyDncipeDcerCatteBounceyCrtmanCntiousCmerantzBlatterDnckBilkentonDarskiCanoBhegleyBertuitDlaCntaClcCfferCchCaglerBavelkaDaoCtmanCskettCrrillaDdiniCpazianCnterClinDeyCiCgesCetzoldCckettDheoAostremBrsbornBlmedoBkamuraBilerBhmBglesbeeBatisCklandAnucklesBotterCrdykeCgueiraBiswanderCbertBesbyClomsBadingCabAmunnsCllarkeyBoudyCretCnninClderCdisetteCczygembaDtezumaBischkeCroCngsClotDledgeDhornDeraCelesCckleyDhelleDekBetellusCrschDolaDcureCncerCllinECinkeBcquillanCmurtrieCkillopEernanDendrickDamieCilvaineCguffieDonigleDarrahCfetridgeCenaneyCdowCcutchanDallieCadamBaycockDbeeCtteiCssiEerDielloCrthDshellDmoDksberryEellDchalCnrossDganaroCllyEowCilhotCgyarCdonnaDeroDdingEalenaCcfarlandAlynesBushCgarCckieDcaBovittDeridgeCuxCthCsoCrenzanaDanceCckleyEamyBittlerDmanDkeCebelCchtenbergerDeaBeverichCtarteCsesneCnoCgleiterCffewBaurinDniusCswellDsenDalaCrawayEmoreCndrithDconDahanCicheCfordCchermeierAkunstCgelCckDhtaCbeBorusCppesClbeCerberCchanBnittelBluckCeveDineBitchCrtonDkerCntzDghornDdellCmreyClduffDcreaseCcklighterCbbleBervinCplingerCoghCllogCethCaleyBazmierczakCrnerCmelClinaCczynskiAjuelBoyeBermanCppsonBawadCsikCquaCnuszDcoAislandBnskeepCksCgoldDAhyndmanCmerBunteDkinsCmberCffstutlerEinesCdonDecBovlandCuzeDtDglandCpfCnClsappleDnessDlenbachCffmeisterBitchingsCrataCeberCckelBeweyCrrimanDmansenDandezCnzeCffelfingerCdgecockBazlittDelriggCycockCrrenDnageDlingDcrowCnnoldDlineDelDberryCmmersleyDernikClliwellCjdukCithcockCffCdawayCanAgullattCilbaultDdottiBrunerCissonDevesCanatoDcieDbertBoverCrkaBlueckBirardinCorgioCeslerBerstenDingCersBautDlinCskampCrbettCllivanEandCethAfullenkampEamBriedrichsCeireDeneyDdenburgCappierBowkesCreeBleurantDigDagleBitzsimonsCschettiCorenzaCnneranClippiCguerasBeslerCrtigCnnelCltmannDpsDmleeBayeCnnonCmiliaCirallDlCddenAesslingerBnfingerBlsasserCmendorfClisorBinhornBhrmanBgnerBdmistenClundBbingerAdymentCkemanBurlingCnstanEmoreCgalCerBrescherBoyelCwnCsseyCnelanCckstaderCbynsBivisClksCdierBesrosierDantoCppeCngCloshDangeCfrankCboBauberCrtezCquilaCnkertChnAcyganBusicCrfmanBroghanDffCigerCevistonCaysDveyDndleDilDgoEheadBousineauDchmanCthronCrellaCnineCllerDbergCgleyCatneyDleBlendeninCaywellDgonBifaldiBhoiniereCickeringEaCennaultCavarinDttinDlouxElisBesarioCrtainBazarezCughmanCtledgeCseboltCrrelEaDlowCpoteCnezCmilloCliendoDbertCiroAbylsmaBustleDkeyDchmanCrkhardDghardtEardConocoreCnkleyDgardDdrickCmbreyCiceCffkinBrundigeCockwellCionDnDantCedesonCansfordEnockDkefieldDckensDbantBoxerCwdoinCuyerCtheCorCnavitaClligBlurtonDnkCankeEckBirdenCerbaumBevingtonCutlerCttersEcherCraCnwayDgstonDeshCharCdsoleCcentiCachyBattersbyCstaCrtmessEleEkowiakDskyDrioDlettaDfootCnegasCllinDdonadoDAazconaBvantsBustellCngstDeCmannCdiaBtterburyBsselinCmussenChlineCbillBrvizoCnotCiolaCdreyBngstadtCastasioBmsdenCorCermanBlredCmedaClingtonCewineCcinaCbericoCasBhlgrenBguasCrawalCostaBdolphsenCdieBcreCeyBburtoClerAzwiebelBukBeppCntzAybarboBarberryCmauchiEshiroAwurtzBronskiBorsterCottenDlCngusCltzDanskiBitzkeDheyCsecarverCnghamDeingerEgardenDdholzClgusCesenDckCdrickCckliffeBhittenbergBestbyCrleyCngertDdorfCimarDckCckerlyBatrousCsdenClfordCinrightChlstromCdlowAvrbaBoisinBivesDasCtelloCllescasEavicencioFnovaCalpandoBetranoCronaCnselBassellCranoCnriperDkleeckDduyneEerpolDantwerpClenzulaAudellAturnquistCffBrickettCembleCambleBingeyECmbersCetzBhonCiemCenBerceroCnnerDagliaCasterBarltonCittCggertCbonAswardDbyBuydamCritaCmanCgarCddethBtumboDdivantCroblDetchEichCowDodleyDeckerCillwagonDckleCellmacherDfanikDedleyCarbirdDkeDinbackDckerBpeirCathBommerfeldCltaniDieCjkaCbotaDieskiDczakBmullenBleethCaymakerBkolnickDglundBiresCnglerCllimanBhrockCottCirahDmekCepperdDfflerDelerCarrockEmanDlashBeyfriedDboldClanderCipDfriedCdorDlockCbestaCagoBcuttCrivensCiaccaChultzeDoemakerDleiferEagelFchterDemppEiderCarboroBantiDgDdhuCllyDimCiaArylanderCburnButiglianoCoccoClandCdloffBottCsenburgGeckCmbergerDanelliChloffEfingCddaEBitaccoCellyDckCcklesEenbackerBhettBespassCisnerDneckDghardChbeinCgaCdwoodDdixBazorCwlesCverCttlerDledgeDhmanCmsburgCisorCdovichDiganAquailApuskarCrteeBriestlyCestidgeGEslyBozoCttingerCrtierEaDcelliCplawskiClinCintsCeppelmanCcockBlumpCantzDcekBiroCnnellDkowskiCetzCconeBhilbeckBflumBevetoCrretCntzBayerCuletteCtlanDernoCpageorgeCeAovermyerElandBsierBrwigCumCoszBquinBpieBdaBchsnerBathoutAnygardBorvilleDthwayBiverCcolsonBewhartCryCitzelBathCnezAmustardCrnaneBortellaroDrealeDinoEarityDgadoCorehouseCngielloCltonBirzaCnnixCllspaughDbyDandCguezCcklesDhauxBentoCluginDroseDitoCineckeChrCaresBcneeceCkaneCglassonDirtElveryCcullerDowenEokDlinticDallonBazzottaDaCyseDedaCtousekDleyCrtynDoonDneyFllDlingDcelinoCnuelitoCltosDsonCireChiCffucciCckenCassAlyttleCndCdenBukasiewiczCebbersBoveringEallCrdsCngtinCkCbueDergCanBipkaConCnenCghtbodyCchtyBevertDCttieriDsingerCpakCmmondDbkeCitzBassoDiterCngoDdsmanCmirandeDeyCberAkutaCleszaCaBrenzDinerFEgerCaushaarBottkeCserCrnreichCpczynskiCnecnyCkCffCehlCcianBnaubBmetzBluenderCenkeDemanBitzmillerCrshClmanDdowCelbasaBetelsenCsingerCndraChrCefBauzlarichCrterChreAjunkBongCbinCaquinBinkinsDesBeffressBaquithCilletCblonowskiAishikawaBreyBngersonCdelicatoCAhuntzingerCismanCettBowsonCugeCsackCraCoblerCltzenEsclawDlingworthGCbergDaughBilkerDgefortCggenbothamBeyenCtzlerCsselCnnesseeDdrieCllmannCftCeschBaymondGDeCvlikDisDerlandCusCrstadDristonDmDjuDdegreeCnkeyDdsCmpshireDmellDakerClbrookEergAguptillCntrumDdermanGClarteCarnieriCBrollCippoCeelyCaveDmlichBohCeweyDtzingerCdingBiraudCeferCbersonBennaroCmmellCaringBaylesCudinCtzDtsCscaCrnCndeeCmmelClindezDatiCgliardoAfulopCkushimaBriedtCetzDnzDebergDdericCavelBountaineCrryDckCnnerBlippinCewellingCansburgBilipponeBettigCnlonClterDkinsCinBazCvorDeroCulconCrverDlessChnestockCcemireCasAeyerBvettDryBssesCcarenoBnseyCnalsCgelkingBmpeyCilyBlviraClithorpeBfflerBdlingCgleyAdurrellCnkersonBraheimBominaDbroskyCescherCbbinBivensCnataleCmitriCeguezDdeBevivoElbissDaulCtermanCsjardinDhaiesCmoClpozoDoreyDmanDappEmaterCibertCgroffCbelakBapolitoCnoCcruzDanayAcushenberryBruzeCosbieCeganBousinoCrrieEaoDneyCokinghamCnryCllingsworthDdrenCbianCateBlaussBhryslerDistineGenberryCmielCauezDrtersDitBesareCllaBayaCstenadaDhenCptainCntrelleDovaDdyDaryCmpioneDelClixteCicedoAbyerleyButteryGCrdaDchillCnClmerEanCesingCczekDkholzDhnerElerCbanBryneCutusDnkhorstDmseyEerCownsonDkerDdnaxCezinskiCazileDvermanDsilDnningDdlyBoyeCuldenDghCssardDakCrthDgmeyerEeBlowersCaschkeDnnEkenbakerBiscegliaCllingsleaCalekBeverlinCseckerCrquistCnignoDaventeClizaireCisnerChrmanCausoleilDBaylonEeyCssiDnettDilioDdenDcoCnerjeeClliCkeCgnellCdyAaveretteBugustaBrzuCnCchambeaultCboledaDaughCataBntrimBmrheinCerineBlpersCfreyCconCbusDertiniBguinigaBdayBcquavivaCcardiAzygmontCchBollnerCbelBinckBertucheBaragosaCleDdivarAyingBeadonAwykoffBoullardClfrumChlfordBisonDeleyEcupCnchenbachCltsieBhittleseyEelowFfordBeverCstrichCrtmanCnselDrichCisbrodCglarzCdderburnCatherheadDseBarringCndCdleighAvoltzBiseCllanoCcarioBermeulenBazquesCskoCrugheseCngiesonDfossenDeppsDderploegDcleveCleriusAuyeharaBnsworthAtwerskyBurrellCnerBsuiBrunzoCousdaleCenthamCaughberBorgrimsonCppinCkarCbiaBippensCgueBhongCiryCackstonBerhaarCnnyBassinCdeoAsweigartButherlinCmrellCenBtuhrCrzeleckiDosniderDeiffCottlemyerDrmentElieDnesiferDgsdillCenzelDmenDllhornDidlDckleinCattonDpleDngleBpratlingCoorCightCelmanDceCanosDdoniBouthersClaCbolBmyreBlaybaughBizeloveCrmonsCmingtonClversmithCguenzaCerenBhelmanCawnDrplesEifDckBevilleCsslerCrrataDinoDafiniCmienClveyCedorfCckmanCawoodBcrewsEenCobyCicchitanoChornEmmerDnitzerDleusnerEabachDielDepersDaberCallyBautnerCrtwellCnterreDdageClviaEettiDsmanDlisDaisCintCegerCbleDatCarArutherCssomCoffCmeryCbottomBozelleCwtonCutonCtoloCstadDeboroughCrickCncoCllsCherCberieDareBittsCsonCppeCnkeDgwoodCghterCeserCdeauxCckersonBenfrewClefordCinschDmanDfsteckDdheadCdfearnDdoutCauxBanceCmCdoDebaughAquinbyDggAprovoEenzaGceDphetCidgeonCaylowBowelCulterCrtnerCntbriandCliceCirrierEerBlateroBixlerCntorCgmanCersallDlCchetteBhouCillisGppeCarisDlenBetscheCrrierCnfieldClosiCbleyCatBawloskiEikCvlickDelCtzDoutCscucciEhCrrinelloDekhCntaleoDnoneDkowDgbornCganiCcelliAortCsiCileyCdunoBommenBliveroBkadaBconCheltreeBbermanAnylandBossCrlingCltonCbileBittiCshimotoBghiemBeunerDbergerCifertCgusBavalCglerAmullallyBouldenCrraDquechoDoccoCotsCnicaBizzellCrskyDabitoCnardiClhollandCkusCjangosCchenerEalekBethvinCrritCnterDeelyClodyCiersChringCesCdalBcwhirtDainCphatterCnicholDaughtClartyCivorCginnessDaughyCferrinDateCclennyEardDaskeyEllionCamisBathisenCrtonDsicoDinerDchiCniDgioneCgdaCcaraegAlupiCndayCkowskiCciousBociceroCachBittlewoodEDleCphamCnleyDdonCghtfordCeserBeyendeckerCweyCsaneCnziDartECisingerChrmanCfebureCandroBazardCycockCverCunerCstrapesEingerDkerCrkeyDgerCnserDphereDdeyDCmptonDarkCgerAkummCllmanBrzeminskiCasnerDmBoranCningChlsDenCbelBniffenDckCeipCappenbergerDckBlumppCausnerBitamuraCslingCrshnerCnlochDgmanDCmeryBestlerCllenDeherCehnCarleyBasprzakCryCmpfDererClisChanCestnerCdelCbelAjungeCckettBoyntCrstadBetterClleyCfferisECansonneBanecekCffeeCckoAizzardBstreCherwoodBpockBannuzziAhypoliteBusseinCmfeldCckleberryBotzCseinCnahniClzworthDdridgeEawayDadayCdakBitchmanCpplerCncheyCllinDerCbdonBeveyCthCpferCnnemanCmsleyDmingsHerClbertGgCinzeCerenDCberBaverCuffCswellCrvisonDtsonDshbergerDrymanEiesCnnibalDeCmsherCggettDemeierCeckerCddonCberkornAguttmanEierrezDhmillerCilletEbertCginoBrumblesCiffyCegersonECanadaFBoyaCransonCnsoulinCettlDrtzDCdlewskiBlandonDdBilsdorfDloglyDkisonCardDmpaoloBheenBettingsCsellCrshonBaumerCrtrellDsideDriganDmanyDlitzFngtonCmetCilAfussCrloughCnstonDaroBrixCascaDncoeurBorsheyCoseBlatleyDglerBilsDlersCckettBethCnnellyDclClchCdrickCbresBazekasCrnanCirlessAewanBtsittyBnterlineBlvinCsworthCliffDCebyCdrethBidemBdgecombCdsBbarbAdworkinBusenberryCrranceDopanDfeyCngyDdonCmbletonCffelCbonDberlyBrozCinkwaterCesselBoughtieCshierCrrellDaCpleConanCnadioCllisonCigBitzlerCshnerDcherCmaioCgmanCfalcoCemBevinoDensCrosiaCppenDaolaCnizDardoCmosDayClgiudiceBaviCnielsenCllyCisChmerAcutsforthCsimanoCringtonCmbeeBryanCusoeCowdenCeteDssmanCapoBowensCupeDncillCtyDnoirCrreiraCpenCnsiglioCmbesCfferCckrillCadBlogstonCasenBhockCesnuttCarrierDinDdburnBernigliaCbulaBastruitaEillaEaldiDebeerDagrandeCrtaDralesDnleyDdonDascoCpshawDronDpielloDitoCnneyDdelaCminitiClifanoEcoDabriaCiazzoChallAbuscemiCrtnerDgdorfDeauDdoCffaloeCchwaldBrwonCunkeDmmondFCoeDciousEatoDCitainDskiFerDghtwellCesettDinerCazeauEDymanDndisDmerDdeenBoykoCurbonCssiDhartCrtleCnielloCmgardnerClzDenbaughChlingEandCchenekBlustCoxhamDweCishCackwaterBjellandBirosDkheadCedermanCckleCalaszewskiBevilDerleyCumerCttingerCsseCrnettDmejoCmentClfieldCcklerCatriceBaxendaleCtdorfCstinDhoreDcombeCrtlebaughDshCllantineChlCdonCchelorAautinCdieBstinCkeyCcherBrrigoCbeiterBntesCgersBmburnCaranteBlvidrezCthausClmondCfieriCdingerBkerleyCanaBikinsBderBcebedoCcardoBbilaCerleDleCboudAzollarsBimmererCemanBerbyClmanDlarsAyuleBoshimuraCntsBeatsBantCmanakaAwylandBuenscheBormanDdlawChlBinslettDbergClmethDlcuttCersDmerCckwireDhmanBhittingDdbeeBestergardCmmerCllnerCishauptDnertCedonBaynickCsielewskiCrenClworthDlingfordDkeCechterAvivianiCttiCllagranaCenCcksBenemaBarnesEadoeDdenCnpattenDordenDderzeeFnburgFheyCllsEartaDderramaDadeAurmanBleryAtusaCftBripoliDmpeDckeyBortoraDrensDchiaCftBjadenBisonCndelBhurmonCodeBardugnoCncrediCketaCillonCgleAsytsmaCmesBwindallDcegoodCartoutBundstromCmnersCltonBtudstillEentCroopConerockCmarieClawrenceCemmDinhauserFertDffensenEanoGiakCarckDlzerBpidleCakeBowinskiCsnowskiCrberCmmaClidayDdnerCjaCderstromFCckwellCbusBnowballBloopBkeeterBinnerDkfieldCmerlyClgueroCggCemersDgmundCdleBhumColtisCkreliCeikhCattlesDrlowDoDmbaughDikhBerraoDafinoClleyFCelCdberryCcordCatBchunkEchDorElzeDneeDmiederDleichDimpfDerfBatterthwaiteCssonCrkisianDinanaCnzoneClvasDoneDidoCikiChrArusherDekECppelCbiDelBoughCthfussEenbergerCssellDenquistEbrookCmitoEnesClandoFCkerCehrigCckholdDcaCbuckBissCnaldoCghtDgenbachBezentesCutherDbenCnoldsDchCmusDsenCllerDfCitzelDherChderCdekerBameroChaimCdiceAquijasCaleyApurgasonBrumCoudfootDckDbertCintupDmerEaveraCenattCaticoBolichCdkowkaDestaBlattnerDsseDmondonBittmonCppengerCneoCerpontBetzoldEDtiwayEersDroskiEikCsolaCrshallDlmutterCnepentCevyCchacekCarsDdenBazosCviaCscarelliCrmDilloDfaitColettiClombaDenciaCgaduanAoxnerBverfieldEcastBulletteCkBstroffCeiBmarahBlenickCahBdemAnygrenBotaroCrthcottCdineBilgesBeymanCveCuendorfCptuneCislerCaultBarcisoCffAmuscarellaCnBostCrrisetteDphewDeinDCntvilleEufarEesinosFrrosoDgoldDaCjarroCitosoCdeBirarchiEndoCnogueCliciCgaCdyettCchnaBeyCuserCssanaCnzieEDdicinoCloneDlishEerFCintsCchemCalerBcwilliamDhiteCquigganCphillipsDartlandCnellisCmackinClaughinCkinnyDeithanCguirkDillivrayDarrEheeCfaulEdinCeuenCcullahDonicoDlarenDaulElleyFisterBazerCysonDhanCugeriGCttixEewsCslowskiDekCrtirDschDquessDonDkwellEowDinaroEettaDcinekCnnerFllaDgoCllenCjeedChnkeDabirCgbyDallanCdereCchnikAlybrandBuqueCndholmCedersCcianCbinskiBowyCewBippardCnsonDdbladCghtcapBevitskyDensConardiCntonDgyelECitzelDchtCaverBaubscherCshuaCrussoDrimoreCntermanDniDasaCmoureauxDbrosEornEertiCllCgosCfuenteDerriereCconteAkygerBupiecCnzmanCehneCderCbatBroghCeidlerCawiecDuthDtkyBottwitzCrbCnoClmanDesarCeppelBnapperBlingenbergBjosBeppelCnnanCltzCalohaBaselCrneyCnneCmrowskiCgawaAjooChnosnCesphBilekBarvieDretCnskyCcqueminDoxEmeAitalianoBriarteBngwersenBmbodenBglesiaAhuyserCrstonEhCntoonCdmanBoyingCrsmanDriganDnbakerDiuchiCpewellCopCmmelDeyerClzingerDmerDlowBipsherCnchmanCltsCgginbottomCebBeyneCsslingDlerCrtleinDfordDasCnricksenDnemannDeryDdershottCmstreetCineyCckertCatleyBazellDanCyashidaCuslerCrtsoeEhDriottFgerDpinDdistyEgeCoCnnamanFhsCmpDmersmithDitonClsellDdermanCggeCbelAguslerDhikenCrrCmmerCllickBrundenCoschCeenburgDbDaverCatzDjalesBourlayCttoCrleyCodpastureCdardBloriosoDorCascockBizziCroirCbeaultBauldinDerCrtinDrelsCmberClloglyEeyCdeAfusaroBrippCeyerDibergCanzoniDgaleBostonCrtiDnessCltsDlowellCardBlomCingCettDitasCammBinoDnenDchumClippelliCckelBeuchtCilerCenstraCaginsBaverCuxDlkenberryCrabaughCndelCllenDerCivreDreyCceyAexnerBvensenBrionCbenBptingCpingChraimBngbergBlsenClingwoodDenBisenmannCchmanBhleBdsallBaglesAdurallCplerCnkerCmlaoCfordDfieCddingBriesBoungCrantesCnahooCmenickCllinsCblesBipiazzaCnoCmeoCehmCciccoBevinDenportCsormeauxCrrowCpaoloCnverDiseCmasClprioreDosantosDaCgreeniaDenhardtCfrancescoDenbaughCetsCbonisCaryBazeyCrgieCmbrosiaClalCgenAcunCenBrupiCossanCichlowCequeBouttsDnceCramCnstanteDnonClleloCitCcklinCblentzDeyCardBluttsCinganCawDmpittDeysBiullaCminiCampaBhristonCoatCiouCenailCavousBattoDalfamoCsterlineDsinelliDpersCrrowayDlenDithersCppelCloDlowDandraCgleyCffertyAbyunCamButtnerDhCrtenshawDgetDfieldDeshCntCltmanDowCchtaEmannBrunettDemmerEggemanCittoDneyDmhallDbiescaCeslerCazanDshierDrDndstetterFiBozeConstraBluittComgrenCattnerDsiDdenBittermanClbyCerceDlloBettesCrtoneDreyDnatDberichCnshoofDdicksonClowDlefeuilleCdnarskiDdingfieldCckermanCastonBavaroCtallaCsyeDkinsCrtolottaEkowskiDrancoDkettCndDaszakCmeDbergerClsleyDlasDickiDdingECduraAaymondClorDesworthBxleyCelrodBubertBrmondCizaBpicellaBnstineCkromCgevineErCdreottiFaBltoCspaughCpaughCmadaClinderCexandraDquinCanBguillardCronCenaBfanadorBckerleyBbrevCdallaBaronsonAzyndaBuccoBippBetinaCnzClinskiAyoungrenCchumBearsleyBankeyAwoodforkChlwendCelfelBisteDmerCnzerDkerClkisonCggerCerengaBhippsCeelingBestrayDchCldCibleCdellDdellBawrzyniakCskoDhintonCntzCltsDlanderCinChlenCchowiakAvoshellBiteriCreCllafuerteCeyraCauBescioCrrierDheyBauseCndermolenGhorstCloisDlaDcourtCcekAuzzleBmlandCBlmanClandAturveyCleyBrembathDesCabertBowsendCtmanCewsCbyBitoCschDbyCppingCerceBhiviergeBenenbaumCagleBacyCblerAszewczykBwearnginBuireBturrockDbbeCronachCouteEdemireDnebergCerbaDjskalDierDhrDcklerFelDarmanEkleyCarDnforthEcillDllsBrourBprowlCevakBoleCkoloffCdermanBnoverBleemanCaubaughBitzmanCmplerDmerDesCegalCdotiDlerDerEnerDdiqiBhiremanDmaCeroanCadduckBeyalCntellDnettDkoDecaDCligmanCipelCekinsCabaughBcoutenChweinsbergEartzbergDurrEltDrickDoeningDmitmeyerDlicherEagerDackEarCavuzzoDrpaBassanoCntigoDdavolDCmpselDmsDetClzanoDyardsDvaCidiCbirCamDbArunionsDdquistBousselleDndCtunnoCsesDchCmneyChnerCffCckhillEefellerDamoraBmBingleCggieCcklefsBexroatCvesElCussCtaCpkaCntfroCinekeCcoreDaldeCaseBawlingCvencraftEloCppaCndolCmsierDerezChimiFCdneyCceyCbornDalaisAquebedeauxApujolCchalskiBrothroDffitCiggeDdeauxCevoBortalesDcoCpovicDekEjoyCmpeiBlumberDdeCatnerEeBizzutoDerCstoneCllerCerriDhlCckertCaseckiBhongCilippBeughCsqueiraCrrettDfettiDcellCnhollowCltoDlettBavlakCuloEaCtriciaCstoriusCrsellDralesDejaDcellCppanCjakAowusuBvittBryCrickBniellBlliffCberdingBesterlingBdwyerBceguedaBbeyDrmillerAnylanderBulphBottageCrthamDgardCdalBielCcolsBewhardCllumCiraBazzaroCssifCrducciClbandianCilsAmusilCrgaDaokaCmperClroyBountjoyCsseyCretonEaCntoroEesdeocaFalegreEanyeGdonCkCisanChlCdestoGeBitraCsterCnsonDjarezClbourneCchaelsenBetheneyCstreDcherCrvisCnnengaClgarejoCisingerDningerBcwatersCkernEndreeChargueCglothlenDibbonDavockCduffeeCclurkinDauslandErdellEmbridgeBazzoniCyenCxtonCwsonCuffrayCttinsonFlaDsunagaDerCsciaCrseDotzEisDkinEeeDcinkoGCnvilleDtylaDserDryDderscheidCllariDiaDechaDcombCjerusCilmanCcinnisCbeyAlyfordButhCpercioChmanCedkeBovickCssingECrraineCokabaughCngwayDeCiselCgiudiceCffredoCcustCbeDaughBizaolaCversCttlepageCnnenCmmerCebschEmanBeydenCvitanEsonEerDenDalleyCttingaCssleyEigCpineCightDckCggioCffingwellEertDeversCdlowCatonDnderDmingBazosCvioletteCufferCtzCsorsaDchCrinCportaCnterDgstaffDdiCmicaDbsonEeDarcaEnEgnaCjeunesseCfontantDlerCbrumCaksoAkushCetherCcharBrukConerDhCidlerCeuzerBovatsCprowskiChoutBnicelyCellBluttsBindrickCddyBhannaBetcherCrschnerDfienCnseyDleyDanCmplinCllerhouseCeslingDpDnaCasBaplinCnadyCmpenAjutrasCngersClioBeschkeCnBanowskiDasAiskraBmperatoBkerdBgoeAhynemanEkBusainCrrellCltquistDlettDenCfCbertyBoyteCssainCrnsteinDiCptonClmsDlmannDdmanEemanDbenCffertBimelCllsmanEaryBerdtCllyerEenCisterDmerDdeckerCdgpethEepathCbelCatwoleBayerCusnerCskewDeldenCrtranftDschDresDpsDdimonClmDleeEahanCckleyEenbergDheyCapalaAguynesCnnersonDbyClottaCdgerBromanCignonDebelCegoriDenanCauerBourdCrinDgoneCoslinDldCltzDdbergerCbbleBlotfeltyCassfordDnceDdwinBiuffreClpatrickBermaineDdtsCnnaCiselBaylerCunceDldingCteleyCssmanDhCrsonDronDandCngestadCllowDboCbrielliAfullingtonCcciBrumCiedenDbergCascoDnceseBowleCucherCthergillCrakerCnderCisyCgalBlurryCennikenBitzhenryCshbeinCntonClmoreDiceBeolaClberbaumBausnaughtCscianoCrrahDquharsonCiresAestridgeCsmanBnzCriquesBmmickBkkerCdahlBismanBggletonBddingerBakleCgarAdurioCnwoodyChaimeCenesCdenDasBresherEelBouttCnlanDathanCmkeCbrowolskiBingeeCmmittDeryClulloBeveauxDalleCsperDnoyersDautelsCrouinDbyshireCnmonDaCmskiCluccaDpinoDmontDlerCjulioCiblerChneDaroCgnerCforeCermanCcuirDkmanCasyEeDnerBawdyCughdrillCrrigoDityCnieleClbeyCgenhartCffronAcurroDnutteDatoloBruikshankCosswellElinDneyDftonCiadoCeceliusBosciaCnniffCmmodoreCltharpDonnaDlyerEingtonCbbleyCacheBlontsDeCiettCemansCaraBidBhristoFpCinaDariniECeatamEdleDCaunceyDndDddBerveraDulliDezoCdanoBayetanoCwthorneCvalieriCttaneoCrylDtlidgeDrithersEeiraEancoDgleCndanozaCmilleDburnClenderDderinDcagnoChnCddenAbyhamButtryCrryEuelDkittDgioEenerCescherCckalewBrymerCumettDgnoliEmanCosnahanDnderDeckelDdersonCisbonDnsfieldEksCeseeDgmanCannerDmbilaDilsfordBouskaCsterCruckiDtnerDoughsDgesonCnierCmbaClenderCeschDkeBloydCeyBingerCllingDbroCeryCchrestBezioCvelCrrettDmeoDgdollDcierCnzelDtlerDnettsClnapDliniCitzChrendCdnarczykCarseBatmanCrtoliniGDrettaDberoEaroCnvelosDkesCllengeeDdonAayeBusmusBtilanoDenzaBschenbrennerBroraCmstongBquilinoBppleberryHeColinarBntosCglesCdrepontCconaBmesquitaBlvinoCtschulerClinCireBinslieBgularBeschlimanBccettaBbdullaCbeAzwartBufeltBonaBirbelCngaroClnickiBentenoECmkeBayacCrrellaAyoshimotoBearoutAwrenchBorldCmerCltmanDinDeryDdtBittsEnerDherowCnwardDrowCemannCchmannBhitwellEelawCeelessCalleyBeyCssnerCnzlDeCatherbeeBayeCttlesCnkeClkesDdeckAvonrudenCisineCgusBittetoeCllalvaFcisCctorianBergeCnturiniHDsonBanloanDhooserDduzerEeverFrwalGheydenDbeekFbberCllanceDesChleAurbainBpshurBmfleetAtwistBsujiBrybusCioloDmarchiCezzaDnholmBoveyCurignyCrryEainDgesonCngueCmeyBischlerCnklerDderCcknorCbblesEalsBhroneberryCormahlenCibertFauxCeurerBempletCgelerBavernierCubmanCmashiroCllonEaricoCboadaAsypherCbertBwyersCitalskiDngerCedbergButherCrprenantCllenDikCgdenCderCchanEBtrubeDoopeDittmatterDeettDaughnEsburgCjacquesCimageFcDfterCgelaisCeinhartDhlikDffensonDenbergenCanberyDlloneBprungDaggsCotoCilmanCenoCanbauerDllaDgnoloBolimanDanCbolikBnelgroveDddenBmaleBliterCankardBircyCgnorBhutterDrtliffECowCirkeyDCewmakeCamsDdleyEdoxBgroBerfassCppalaCgawaEllaCaberryBcrutonCismChweinEartzmanFntesDomerEenbornDlottmannDisslerDeurerEpisEideggerBaunierDdersCssmanCnnicolasDderfurClserCgarCfferCeedCdberryCbanAryceCbakBuxCmoreDmellEageCdasillBozmanCtaCssinDellFCmbergCjeroCchinEellCbideauDargeCathBiskoCngelEdahlCeraDmannCbasBevardCnnaDegarCinwaldChmanCgalCelsDCdelCasonsBaysorCthkeCpozoCmptonDakerCkowCiaCdinCcoDkhamDcaDanelliCbunAquarantaApurvesCndtBrotsmanDsperCeziosoDsuttiEidentEgravesBoydrasCrtnoyEalatinCpCntesCehlerCbleteCatBlumadoreCeimanBizanaCscopoCrainoCnelliCllaiCckenDhaDcoliBhilenBettewayDrosCskinCruginiDrellaDniceCperCnsingerCmbletonBatronCssmanCrrentCnettaDcakeCllasDkaCisCgliaCdmoreAoumBttesenBstCerBrtmannCmandCiolDckBlerBkaforBhairBbertEholtzerAnumberBowlandCsekCrdeenClfCgleCbrigaBicleyDcumBewinghamCumeisterDgebauerCtherlandCrneyCissEDderCeldBailorAmustainDsmanDanteCrtonDdenCnyonCldrewBottonCscosoEhellaCrozDmonDelosDaceConeCntesanoFmurroEasFlboClanderBleczkoBiyakeCtschkeCngerDelliEarCllenerChelichCedemaCahBetzerCryDriganDckCnnellaCmbrenoClecioDderChlingEerCdcalfCcheCalingBcqueeneyCphaulCmickleDeenDainsCleesCgowinCfarlainCdivittCcotterEnnDlaneDasterCbayEthBayoralDeuxCtsuoCsurDsmanCrzetteDtensenDlettDkieEgrafDcinkowskiEhbanksEellaCnsirDdezDcilClagonCgnaniCdoniaDillEaCckiewiczDgillivrayDdowellDbethCbeeAlundbladBovvornDingsCretoBinzDwoodDnellDebaughDdstedtEbloomEaCmbergCebigCckteigDhtenbergDariBexCwisonCvarioFCpperCnzenDdermanCmarrCinenDderCgrandeCfortCbleuCaskDrnDcockBazanoCwalinCvenCplacaCntDgsamEoneDdressEenFCmorteCirseyDdlawCffinCcknerDazeCbudaDreeDellaDarAkyerBuyperClinskiEgChnertCcheraCbicekBruckebergEhtenCiderBotchCrnfeldDenCoglerCllDeChnkeDliCfoedCellingBluthDmpCopfensteinCippelDngeCettDmpDisCannBitzmanCnnanDgsberryDdDaClmonDlpackDbaneCjowskiCesDrsteadBetteringCsselmanCntonDningtonDistonChrerCarlDlaBassaDaharaCntzClinCinaAjupinCntunenCaresBoynesCvelCosBnBiggettsBervisDabekCnnisonBasoCnzAizattBshibashiBannottiAhymasBunekeCletBougenCrvatDstmannCppleCltkampDstenChensteinCefleCbackBineyCemstraBerwigDterDriottDmsenDdmanEerDbigCmClperDlingDbigCitkampDnrichsEeckeDlemanCffleyCavrinDstonBaymakerCuensteinCrtlageDlinDigDdenbrookCnkinCmiterCgensElAgrizzellDestFeEfCennanCadenBosseCrderCldinCatleyBillespiDbrideCelCanniBhostonBetterCrshmanCisingerChringerCdeonCbertBaxiolaCwronskiCuCthrightDchellCrgiuloEClangCdisonAfyockBurnissDbyCnnellBrizellCenkelDeburgCankhouserEchiBoulgerCrmbyDkeyCnteClsonDletteBlickerCavorsEellBineganCllDippiniBerenczGeCnnesseyCgginsCehanBazzinoDenbakerCustoDnceCrrajDnellDlerDabeeClkowskiCcioAetzlerChingtonBsterlineCperCkerBrxlebenCicssonEkBnghBmlingBlridgeClenwoodCfrinkBkhoffBisertDCfertCchenlaubBgnorCgebrechtBdlinCbergBbleCerBaslerAduweCttaDrembleCsseaultCrneyCnworthCmireCkemanCfnerCeyCbleBreeseBozalCuvilleDgalComCneBiverCtmoreCstinCmuzioCldineCgnanCeterichDckmanCdonnaBhillonBezernCvereuxDallCttyDamoreCrksenDemerDasCnslowDoDicolaDbowCmmaDilleClisaEraDawderEraEhantyCjongeCiningerCdiosDerickCcellesCbusDruynDordeCakBauenhauerCrseyDingCnsieClmanCkinCgleyAczajaBybartButchinCrringtonDbeloBroucherCinklawCeminCattyDnfieldDffordBowherDboyCuvillionDturierDnterCrterCombesCntosDsoliniDnaughtonDelyCltraneDlomCckettBlepperDavengerCaroEkinBiriacoCeslaCchonCancioGBhynowethCuangCrzanowskiDistionColewaCipleyDlcottCeyneDslockDnevertDersCarlotDgollaDbollaBesenaCruttiBavaCulCssoneEinEeseDausEliCrtledgeDstenDdamoneDciaDbonneauGiDabelloCpozzoliDellaDCnnataCmpoverdeEeauDbreEerosClveryDnanDmesDleyFryDiseCcciottiFatoreAbutterbaughCrgoEamyDellCndeCmbaloughCelDchnerCchannonBryonCunnCostDadfootCittanCevardDdaCazelDyboyDsierBoyeaCxxCthCsoDioCruffDdaCngiovanniClerjackCedekerBlyeCumsteinEenfeldCinnCeakleyCatterDnBjornsonBisignanoCllickCeniekBhattiBevacquaCttertonCrraDenbaumCnsingerDnefieldClvinsDsonDlinCighleyCecroftCaudreauBaynardCutchDschCschCrtlesonEhelemyDakClzanoDistreriCilerCgnallDgCeAaustonCgustynBslingerChalintubbiBrtistCjonaCebaloCabBppelbaumBnnaCgstDertElucciCdryDerssonBmorimCaviscaBlwardCveloEarCumbaughCsobrookCliDgeierDendeCdreteBkiyamaBhlquistBdolphsonCdarioBcoffBbelsonCastaAzulaufBirkindBeoliCmlickaBawislakCppiaCnellaAyelvingtonCatmanBanniAwraggBissingDchmeierCrtaDenClmouthDliardEertEaertDdtBhelpleyBestwoodCingartDdenbachFmannCathermanDklandBatwoodDtleyDersonCmbachClzerDdowCagAvorpahlClkmannBitoloCsitacionCnceletteDaCggianoCethCdanaBertDnaDgesDdejoCnzonClardiBarianDgusCndermeulenEamDasseEmanAutzingerBriosteguiBplingerAtwissBumlinsonBschanzBrunnellCoungEblefieldDjacekCialCeloarCanmerBouchtonCrsielloDinaCotleCkiCepferBippinFeBhronsonComesBezenoCxadaCstaniDsmerCrrelEaDlizziCmpelDbladorBaylerCwilCschCmesClorDericoAswindermanCeetlandCagerBulserDlensCbiaBturgellDmpffDfflebeamDckiCrohmeyerDebelDaughanEckbeinCobaughCetzDlterDinmannFfeldDfaniDcherCanwoodEislawskiEderBpezialeBoppeCniClCbotkaBnipeBmuinBliderCeeBkerrettBjobergBittigCmonelliEDaClvioEerioHaDsbyDlmanCenkiewiczCckCaBhomoDffDenerCibaCerfeyDhaneCawlBexsonCttonCrgiClvyCidersCegmillerCbreeCaburyBcrogginConyersChwalbDurgElenbergFdDrageDowEnDnurEellerDmidtkeDlatterDiefferDenkelEelerDauweckerErtzEchererCafeBayeghCvidgeCurCrlesDkissianGDconeCgucioCffellCengerCcherAryleeBuvoloCstonCpleClisonCgeCffoCehlDckertCdmanDieCbertBozeboomCysdenDlanceCthchildCsseDecransCdrickDiCckmoreCbnettDertiBivettDaCtzelCersonCcottaDkenBezacCndellCmoCitmanDndlCebCddicEellCbuckCaliBayeCsoCmthunDsdenDeauClphsCkCgoCczAquinterosHEleyDggleCaidApurvinesDintonDdumCmmillCgliaCettBtacekBrzybylaCowseDvidenceCestwichCachtBoutreDcherCrteraClinskyCageBlattsBineauDckardClsonDlingDkinsDiCkesCgramCetilaCckronCaBhilippiEhowerBfluegerCalzgrafBettiboneEDrosinoCrsingDrinoDottiDieraEDedoDaltoCnnywellEelDCllegrenEaCdrosoBaulosEdingCtesCsekCramoColinoCnganibanDetoCluchAozakiBwnbeyBverfeltButmanBpperBnstadBlandBkudaBertelClkeAnormandeauDdbyEahlCeckerCblinCBiswongerDhiokaBettCphewCgleyCedlesCdeauBateraCchmanCasAmusichCnginBourerDnseyCttolaDhershedCskalDbeyCriniDelesCodCntaluoDeypennyDdaCenchCatesDdBixerCssildineDiewiczCrabellaCnottDnifieldDcksClumDaniCkelsonBestayerDsCrtesDrihewDlosDittClnykCdlenDerCanBcveaCquarrieFinClucasDesterCkitrickDennonCinnesCgroryEanahanDlameryDivneyElvrayCcuistonFnDrystalDolleyDlerkinFnonDameyCaninchBazariegosCynezCttioliCstronardiDoneCrzettDslandDiDguliesEolinClatestaEchiCinerDettaCgrathCeseCdkinsDeirosDambaCcksonDCbenAlytchBundgreenCmbCkachCickCetkemeyerDchtefeldCdyDdenCckowCbinskyBowesCutCrensonDanCpintoCobyCnesBivseyCskeyDbyCntnerDdowEblomCmingCechtyBethCsniewskiCnigCmondsCisyChrerDnenDmkuhlCethDrDksCchlerCbsockBavereCutenschlageDghridgeDderbackFnslagerCssondeCroqueDameeEcuenteCpeyrouseCmpronDersFCinoCgueEardiaCfromboiseDataCcountDhowiczAkysarBwiecienBuffelCeterBronenbergCistensenGkDngsDeselCeyDbbsDamerCabbeBossmanDakowskiFCpaczCnkolCepsellDningEBnerrCapikBluttzCockeCenkDmmeCappBitchellDaCssaneCrkbrideDchhoffCnterDselDgslandCmmerDlerClloranCeserBhalsaEafBettelCrekesCplinCntnerDnebrewDisonClloughEmanCattsDseyBauppiCtonCriCnnerCmpaCllCiCczorowskiEmarskiAjuarbeBordisonCnathanCbstBezierskiCanbartBarquinCneyCgodzinskiAishakCettCaBnfantinoBmburgiaBllingworthAhysmithCnsonCdrickBurlaCntonDnellCmbertsonBousandCttleCschCosCnnChltCdelCchmuthBixenbaughCslopDawCntzenClgendorfDcheyCggensBersmanDraraCndrixsonGksCmondDmingwayDingerClgrenCiseyDlmannChnCgnaCffernBawrylakCvertyCugerCslemCrnettDbCppCnzlikDwayDbyDanCmricDmakerClasCgenbuchCckingCbeckAgwozdzButterCniaCiseCadarramaBrubaughCivasDffiethDebCewellDgorichCazierDeberDcianoBowensCodpasterCndekChrCffneyCdbeeBitlinCslerCnCllyardEoolyDchrestDboCerlachDblerCangBeskeCrvasioDtnerChlingCeterBausCttisonDicaDhingsECssnerEertCrabedianCmonDerosClbanCbourelCalAfuocoCllenwiderCdalaBrisciaCanceschiniBorondaCntanillaBloreyFntinoFCegleDchaBislerDchbachCoritaCnesCguraDginsCcheraBesterCrraCarBawleyDbushCusettCrnesDagoCircloughChieCbianiAeverestCansonButseyBshbaughDBrtleBppleyBnglehardtDelhardBmswilerBlzaClingCderkinCandBfawBdstromCmundCgemonBctonCheverriBbrightBarheartAdynesCgertCchesBulmageChnDamelCesCbreyEayDbsBroneCeyDweryDierBorvalDoughDaisCnlinDatelliCkeChmCetschCbekBittyCsbrowCngDardiCllahuntyJCersEDkmannCangeloBeskinDchaineCpaoliCnnerCmyanDontDarayClilloDeeuwCibelCcatoCblasioDartoloBaubenspeckCrnerDdonCnzigerDialsCmewoodClpiazDlmanEaireAcunniffeCmpstonDboCberoBruzanConkhiteCitelliDmiCeeganDanCaycraftDterDnfillBoytCurchesneDfalCrradinoDprewClvilleCccoCbyBlinchDcknerCavetteDggettBiriglianoCesielskiBhristainCesbroCaveraDrdBastenedaEanedoEDseusDaCruanaDneroCppelliDellanCnedyDcroCmilleriCleroCdaAburghartDbidgeClferCisCdniewskiCckoBruneyDghCossardDdmerkelDckmannCingDgmondDereCemmerDckDauCautigamDschDndenbergerEDganBozellCwsherCshCrgiaDeyComhowerCnnevilleDamCllandCiseCeveDttgerDrsmaCatengBlivenCazierDncaDhnikBjornstadBittonCssCrkettCllingslyCagioniBettleCrtucciEolinoDmeaDgnerDberCnsleyDdixenCltramiDloneEandCinChringerCgumCansBayonaCtizCssinDketteCrtolomeoHEholowDkanDishDettDdoCmburgClleriniEaDisCkleyCilonCchichaCbiarzAayarsBxtonCelBwongCeCaltBuslanderDhermanCmickBthensDaCchinsonBslettCkrenBrrowsmithDasCnholdCmagostCeyCcosDhibequeBntunesDillaCnCdrasBmyxCisonCeroBlzateCphonseDerClerCiotoCexandriaBignerBgtarapCbayaniBdamiBchornCeuedoDdoBbundisCerDeAzuccaroBiglarCerDbellEaBamzowChlAyurkoDickBonkersBerianCamanBarmanCnnChnCdonDaoAwoodbridgeClskeDlenbergCjtczakBnukBitheriteCntherDickCdellCckensBhichardCeelisBeselyCntzellEholdCmpleCisenburgerChlingCgerCaksBaterCssinkCrnClquistCdmanCcasterCageAvolivaBlcekBillafanaCgliottiDerCernesCandsBeyCselkaCrsteegDoDhoevenCndettiClardoBatterCsconcellosCrnCnwagnerDvoorhisDheckeDduynEervoortGsliceCloneDlierCilsAuvalleBrsuaCendaBprightChoffAtustinCrtonDnboughDckCllioCchBruehartCopeaDesterCippeDcaricoCevarthenDmblyCaceDbueEerBotoCsiCalBinleyDglerCmoteoCffinCenCcerBhurgoodCormanCerriaultDelBessmanCkulveCjeraCbbsBaverniaCrpeyCllmadgeCkemotoAszotBylvestBwindollCearingerCantekEerDinstonBusiCrretteDCppleCllengerCdderthEarthCckowBtriderDegeEamDassburgCovalDtzDnehamCilleyGDerwaltCfleurCeuckDrmerCclaireCanoDkerDhlerDbleinBrinivasanBquillaceBprvillDoullDauCorerFCittlerCeelmanCarrEkesDngDgnuoloBosinskiCrtoDkinCndagCllersCciaBnarrBmrekarColkaBlyterCovinskyCiwaCavikDtterBkiverCeemCalaBitzesDslerDlerCnkoCmserCeglerCderisBhrewsberryCoopmanDaffCiraDndlerDmminDllCenkelDmwellDhornBeveraCrgioCmonesClsorDlerCkulskiCguiCchrestBcotChwerFbachDurDmiesingDlickEenderDeblerEarDapiroBauroDnderDageCtterlyCraivaEcinoCpersteinCnmartinDluisDdtErockCmmetDaClkCkataCiniCckriderArysBussumEiEawBozzellDaCwletteCthbergCssanoDebrockCmanskiFikGECigerECehrCdenbergerElaDCchfordBistowDpoliCpperCgoCesgoDbelCberaDaudoBhodaBeysCsendesCpineCisdorfEchCbmanBasmusDkeCnumCmesDbinDanCjewskiCffieldCdyDichCatzAquinnieApyperButhoffBrowDehlCibylCettiEeDsbyBoyerCwelsonCrteousCquetteCoserCllanBlossCewaCantsDcideBionCnnickDalesDCllotEeDatoCggeeCetrowskiDrmariniCckfordDcardBhenixBeveyCtrowskiEilloseCsekCrrottiDfectoCpplerEardCnfoldCllitierEandChowicCdrettiBaulesCsseroDhaCnzaCllanteDauCkeleCcettiCavolaAoveryEsonButlerBseguedaBrdBplingerBldenkampBkBhernBettingBdumsBbaAnowlenDackCrdlundCblettDbeBiermanCchelsonCblockBewbroughCstCmetzCesonDdlemanCcessaryBavinCstasiDlundCramoreCkkenDanishiCjarroAmushrushCmaCleroBorganfieldDemanDainCquinCntroseEerrosaDsivaisDroigDjeDfortCisesCffaCeckelCbbsBitchCsiakCresElezCneoEauClnesCkeskaCchelinEalowskiBeszarosDsineoDhellCrtenColaCntonDdsEeCmmottCliusChanBcnickleCmorranClennonEishDaineCkendryEllEighanCisaacDeCguinnDillisCfatridgeErlingCelravyCdonaldsCcullaDonnaughyKeyDhristonCbeathBayrCtyasDthiesenDsuuraDinezDhysDarazzoCskerDdenDcioCrtisDrinanDinucciDgerumDengoCntheDskerDoogianDkeyDigoEerDginiDdelbaumClteseDsamDloDiszewskiCinolfiCharajCggartDarCffettCcmasterDkyDdonnellCbleAlyversCnBuzziCtmanCkBoverDanCnzoDgestFrbeamCfthouseCethenCdiBlorensBizardoEmaDCtscherCsowskiCpskiEettDkinCnzeyDemanCmerickDbDasCgeCermanDboldCbertiBevertonEneCsueurCnserDkerCmmeCgnonCfrancoisCdwellBavecchiaCurichGellaCtinoCnniganDdorCmprechtDountainEreEnicaDmertDboyDarqueEcchiaClleyCgaceCcorteEmbAkyllonenCkerCeBuschelCpferCndeCcinskiCbackiCanBroenkeCechBozielCvacichCthariEDekCstelnikDloskiBnolesCabeBmiecikBlingmanDethermesCeffmanDesCaiberBittellCsslingDingerCntnerDoshitaCenerBhouriBermanCliiCirnCezerBaupCthanCserCrlsenCpurCndollCmmelCheleAjustesenCeBonasonChnsrudCerlingCchimBespersenCongCnnessCdlickaBakobAisamanBnghramDenitoBmperialBadarolaAhyndBuxtableCweCronDlessCmpalCghstonEartDgettDarCetherBowdyshellCutchensDseworthCskieClshouserDmenDloranChlerCeflerCdsdonCchmanBjortBippertFCnzmanCllockDdenFBeynDdenECrgertCnriksonDningsenDdelClgetDfDbingCintzmanCggieDeCcoxCatheringtonDreBaxtonCverstockFlyCtlerCseltonECrtzfeldEenDkenDgrowDanCntonCmmarDamotoClperDkoCckathornCberleCakeAgunnoeDkelClyasCineyDlbeauDderCerrantCdgelCariscoBrossenFbergDppDomeDbeCemmingerDenleyCaubergerDbensteinBowersCstomskiDierCodenowCnzolesClidayCettleDnsCatesBlymphCavinDsscoDdysEfelterDckinBithensCrgisCmpelClbrethEeauCffenCannottiBholarBervasiDtschDnattCphardtCncoChrCddisCarBaseCrrottEetteCpinskiCnterDserDgiEemiECllinaDdiCilesCetanoCdomskiCccioneAfuschettoCrtickDfaroCllmanBrutosDchterCoggeCeytagDudenthalDgoeCanzoneEkumEciaFeschiDctionBorysDeroClkersCilBlugCitterCemonsBitzerCrpoCnizioCliaultCggCddlerCchtnerBetterolfCrringerCilBayneCrroCddisAezzoCelleBynonBvittButslerCellBscovedoBrneCikssonBnriguezBmpsonBlkingtonDBisenmengerCdtCchenbergerBhrmannBdigerBarlywineCcretAduzanCnningtonCfferCcasseCbielBrovinCagerFBonhamDatEClingerCkkenCepkeCdwellCchertyBistasioDandroCnizCgangiCdionBezzuttiCvoraCtmerCshonCrrigoCntlerCmouraDeterErittDayoErkFioClzellDneroDgrossoCjarnettCbernardiCarmasBauCshnawCrisCnksEerDglerCignaultCfoeCceAcuretCmberledgeClkinCbaBrownerDcketCawshawDunDnshawDgleBourserCstellaCrnforthDkillDdyCopersmithCnzemiusDnettFlyDdictEelloDchaCmleyCltDlenChoonCdayBlugstonCowneyCippardDnkenbeardEesCellandCauseDphamDnceyDboughBichyDaleseBhuckDaCittickDsomEleyDnoEchillaCeramieBerritosDconeCnaBawoodCvnessCtanzariteCsadaCrvellDpDmichealDllDdozoCplinCndiaDbyCmmonCllisterFganDkinCillouetAbuzzelliCteCstilloCrseyDgesonCppClsonDlsCistCffeyCczkowskiDkbeeDioBruecknerCozDokhartDngDckmeyerDbergCittenhamDsboisDdgmonEeCeyerDdeDakfieldFeyCaunerDniganEdewieEcheDgerDderBovellCuthotCstockDmaDemanDcheeCrthwickDnemanDerEkComershineCniCmmaritoClmanDewareCisseCehlkeCdleBlashEcoDkesleyDcklockGeyBittickCrksDdinDcherClbaoCckCbyBertoniEinoGiDsonDnDkebileDgstresserCnneDeventoClzerDtreDlomoEeroseCilkeCgemanCbeeCazerDvenDmishBaymonCstonEidasDomDketDeyCrtlesDoniEcioDnetDcliftCnvilleClthazorDlezaDkcomCiresDliffFeDkCggottDenCchnerCbingtonDelAasmarCkinBrveloCtegaCrendondoEagaDambideCquetteConoffCicoCgentieriCevalosCchboldBpuzzoBntczakCkenyCgelleFiniCfinsonBmerCbergCarillasBltierDenburgCspachCosaClsbrookCexopoulosDemCdredCbertsenBkersonBinsleyBglerBdleyCdamsBcobaChilleBbplanalpCellaCareAzwolinskiBollicofferDaBinsCffBennerDderClnickDenkaCchesBauchaDalaCppaCngariCgorskiAyoutseyCrkerBellBassoCrdeDboughAxiaoAwooleverDdsmallEfolkCndersCbigBixsonCttwerCrtanenCnsonDgerdClkeningDhelmsCerzbickiDchmanBhitesBeyrickCssellCnrickDningCltzCinrichDandChuntBareingClthCibelChlquistAvonaCelkelBitekCnsantDcenteClarCelCcarsBermetteEaCntDnerCazieBaydaCshawCronDdemanCndeveldeDbrocklinCleryDCccarezzaAurquidezCieCbachCamBngaroBmaliBlshAtutwilerCrnbaughCmminelloCiteCellerBruloveCohaCivinoDsdaleDppettDbbettCeptowDmainCavelsteadDutweinFmannDmDegerBonelliCmsicDichDasuloFinoCleCdhunterCborgBischerCrpakDcuitCnnonEelDesDaCmbsCldenCedeBhummCroneEgmortonCorndikeFburghEenDmannCerrellCauDmmavongBetrickCssitoreDreauCicherCafordBauscherDerCnabeClamoCkeuchiCiteCdychAsweetonDckerCartzentrubeEnerBurrellDbaughCppaCnshineCmbryCchyBtutevilleDdtCromerGDengConestreetDckleyCmichelCickerCfortCernishaDnsrudDinhardtFbackEchenCaubleDsiakDrzykDngoEderferDchowiakBpringstonDatlinEcklenConsellerCilkerDegelmanCellacyDiserCazianiDderDckmanEeBorumCphaCllisEenbergerDivanDheimCkolskyCggeBmyserCitleyBloasCinkerBkoraCiffCareBiverdElsCskaCordiaCmmeringDkoDeClmonDanoCegerDboldBhuklaCrevesCounDrtleDnkwilerDalsCimmelDelEhCerbondyDnkmanDinDaronEnCatzDnholtzDfranEfDckettBgroiBewallCveryCthiCssaCquraCpulvadoDerCntenoDdejoCmmensCippCglerCegersCdwickDoreCchlerCbastianoBcovelDttonDpelChwendEartingDutterDrierDonsEltesDnetzerFlleDmutzDlichterDellingDamsFpCarberDllanEisiDffidiBaxbyCwreyCuvageauDderCrrettCnzoDtizoEellaEanderDdezFlCmmonClsedoDgeCilorsCgunCfiCderCcchettiCblanDerCadeArunnionDkelDgCmboCeschDggCckleDhtiCbensDanoBozyckiCupeDfsCsselDmarinDeroEnwaldElleCncaCmosCllaChlingEederCellDhmCchefortECbothamBivenburghCopelCedererCdlenCasBhudyBeynardCtterCspessCppondDkoCngifoCinkingDcheltCehCdeniusCbolledoBaymundoCuhCtajczakCpleyCnalliCmieCittCdloffEeCbbittAquayDntApusateriCffinbergerCertaBrovencioDanoCiviteraCengerDllwitzBoussonCtierCsterCrtzElockEhEelaFeDchiaCllickDinskiDferDanskiEchekBlutaCourdCaucheBitnerContkowskiCleggiCerottiCcoCacenteBhiniseeCaupBfostBettingerEetDrichDoCrsleyEadDlsteinDkoDeCndersCiferCcoCarBayCwleyCshCrrackDadyCpenCngilinanDdolfoCloneDmertreeCdinAouBtteyEmBstroskiBrnsteinCmondeBnstottCcaleBltremariCcottCanBishiCenBdonellEaldCeBbesoDirneBatleyAnusserBovoDickiCreenDaBitschkeCstlerCmCkkelCeseDrenbergDldDdzwieckiDblaEelCcklinBeyhartCwsumCvaresBageotteDaiAmyungButzCrataEllesCnnerlynCmpowerCeggeCckleDhmoreBoulthropCtlCskosCrtlandDringDmileDimotoEkawaDgonDdecaiCntourEDganDellBiyasatoCshCnshewCmbsCllinFardChmCddlemissCanoBewCsickCrlanCndonsaDchClonsonDlingCccaCachemBctigheCnelisCmurtreyFphyCkessonEnrickElvieCjunkinsCgoryDirrDeeverCfieldCelhinneyCcrossenDommonDannonBazyckCwyerCullCtuteDhiesCschinoCrzanDtinieDrotteDmionDkarianDinacciDgoliesEesonDciaEelDakEiaEcleCnygoatsDoDkerEDdichEersonCltzDmquistDacaraCjetteCisCgnanDlioccaCdinaDaraCcwilliamsDqueenDcallumAlydeDayButrickCrzDveyCmbrerasChrsECeBowrimoreDndesDersCurencoDgeeCronaCngstrethChtCfquistCewensteinCbosBizardiCverpoolConbergerCmoliCljenquistCguoriCeblCburdBeukhardtCtiziaCsinskiCpistoCnziniCisenringDpoldDerCggittDareCaphartBazorDagaCveyCueDdermilkDckCssalleCrssonDisonCnzoDtzyDnersDgtryDdfordDcourCmourDbertsonCloneCirsonDnhartCgrecaCcinaCbrancheDateAkurtenbachCipersCechleDCboBrinskyCauserDegerDchtBozeliskiDarCwalikCtlerDeckiCsloskyDelCobClasinskiCizumiChlmanCffmanBnuttCoreCaffBmiecBlammBittlerDnerCrkebyCperCndlerClmartinDlingsGDbrideBerchnerCndellCddyCaveneyDrsleyBarrasDlssonDalisCppesDadiaCllmanEioDilCderAjurkiewiczBoyaChannBitchakuCllsonBexCuneBarrattDchowCnakAivinsCansBsenhartBnocencioDaBmhofBaconoAhyndsButchingHClsmanEizerCestonCddlesonBrbekBowryCuseyDnshellCsickCrtmanDsemanDkyDineCotmanCneywellFestewaClsteDienDbrooksCffmeyerDCeseDnigBirschfeldCldenbrandCgsonDneyCbertDbettsBewlinCsleyCrroldDmonDitageCpkerCnwoodClblingCinzmanDdtbrinkCdgerBaveyCthewayCrtshorneDpelCningDdelmanCmalainenEdCltDaszCigwoodCggansCckshawAguzzoCnnerDdrumCilbeaultCgliuzzaFelmiCeCderianBruwellDnowEdmanDenCotzkeDssnickleDomesDdeDchowskiDbCeinEfDenwallFupCasslDnnisEdfieldDmesDbskiEeBouldsberryCthamCschCodyElingEermoteCnzaleClebiowskiDdsonCdloveBlanvilleBillinDkersonCesslerCambalvoDcominiFbbeBhioBergenCntzDrichClorminoDberCitnerDmerBauthreauxDltneyCrvieDeauDboEaczCnoeDgwerDdarillaClyenDtDluzzoEonDardoCgerCddieCberEhartCarderAfusilierCrnariDbeeCguaBruthCohmanCiskeDlotDdmanCescasDierCayerDnzeseEklynFenberryDinBosseCresmanDbessCotBloridaDokCetesDerEkEgleBishburneDcaliniCnniganDiClipiakCgueiraCeroCcekCaschettiBerrenEandoDmanDgussonCnechCinerDgCesBauldsCteCrissCntasiaClorDkeAewingsBversleyEdingBuniceBtlingBssenBrskinBnstromCricoCgebretsenCderBmmaBitelCchbergerBhlerBekhoffBdringtonCmonstonCgmonCesBberleinAdwinellBuxCpeeCnkleeEDgeyDaginCmoulinCggarCenezCdzicDenhoefferCceyCbBrouillardCeibelbisDgerDesmanCaughonBownenCubleCrminyCminicDbeckClmanCeblerBittbernerCshawDantiCnicolaDhamCminoCllingCfrancescoCcelloCbertBeshazerDerioDcoteauCruyterDingCpintoCnteCmusDattosErsicoCludeCkokCbritoDoisCakinDBayleyCwseyCuriaCtsonCrtyDsowDraghDensbourgCllevaDbecCddAcutcherCrbCngCelloCadrosBruteEchleyCispinoElipEcoCevierDekmurCanceDggEerBozbyCyanCxonCvaltCuillardCstleyEilowDsairtCrvinoDiglianoDdaroDbridgeEanCorDlerCnkelDgDaryCltrainDlopyDginDenDbathCiroCffieCchrumCbbettBlopperCiburnCendenonDmonEentiCausiBirinoCnaBhurnEchmanCilcuttCerneyDethamDatomCatelainDndraDlifourBesaCrvenkaDulloDretaDboneCcchiniEarelliBawthornCvaleroCtalinaCstnerElenEineDimiroDdorphCrtmillFellDroEigerDleeDiasDavellaCppasDenCnteyDedoCmusoDpsEanaroDeroDbriaClzadoDlejoDigiuriCfaroCdotteCcaceAbyrantBusbeyCrtleDresDnworthDggrafDbackCnteDkeClleCgosCdlongCckhalterDcellatoBrummetDffDbeckCoukDtenDskyDnerCittleDslinDmmDllhartDdghamEeauCenneckeFaDerElandDdesenCandenDckneyFeenBozaCyumCwdryEishCuwensDvierDgieDcheCttenfieldCstianDsieDlerDchertCroffDelloComCnserDfieldDCleDdueCgaczCemerBluthCoxomCickenstaffCessingerDazardCatzDnchetDcksherBirchlerCnningDkowskiCltzDottaDagodyCgbeeCeriDhleCdlackBetkerDhersFllCrthaDoDnacchiDminghamDkshireCnvenutoDsmanDoffDcivengaCmanCllowEanyDflowerDchCkkerCjarCiselDchnerCganCedyCasDnblossomBawekCusDgusCttieEershellDesonCsqueDfordCrtoneDrittDkoCnnCmfordCltripDonDliewEamDdusAaylingBvelinoBshwellDlandBrseneauCroyosCmendarezCitaCgustCchulettaDementBntonacciDhisDalCnanCdreeDermanBmsterCiriCadonBlverazCtomariDmannDenhofenClersDbeeDawayDCeoCcoserErtaBkhtarBhunaBgramonteCardBdkersonBchordBbtCdiCairAzurnBoellnerBirkConBeeBarroDcoCmboCiserDnoCchryAyoudCnanBniguezBepesCoCllockEenCattsDrlingBatskoCnnoneAwylerBoodridgeClfromDaverEninCjnarDciakBittmannEichCswellDserCntersteenDelandCllingEfordCgintonDfieldCermanCceCaterBhitselEbreadCellerBettsteinCrlingCnteDigCmpeClzCinholdDgeltDchmanCdemeyerDdelBaysDmentDcasterCunekaCtzkaDtonCrnellFckeDmackDderCndsCldvogelEridgeChsCgganerCddillAvyasBoughtCttaCilesBirgaCnerCllellaEaverdeFnedaCeleCckroyDencioBeveCtereCrmilyeaDleyDburgCntrescaDoDardEncioClaquezCenstraCaBasilCnzeeDwieDtineEDschoyckDniceDkampenDicekDderslootGpoelGlindeCllieresAuzzellCelacBrangaBptainCdykeBongBntiedtBmbrellDaughErgerBlysseClmannDahAtutkoCrturroDnmireEleyDcottDbyfillDanoCminelloDblesonBsouBruscottDlsonCoutnerDneDllCinkleinCemmelDdwayDaseCaynhamDwBottyCrtiDregrossaDokCmkinsDainoBkachBireyCnsmanCmpeCefenauerDdtCdballBhwaitesCulinCroneburgCornsEellEburnCiemannHCesingCamBerrienEanceClfairBaybronCssonFCrroCnenbaumClentCilorCddeoDaCbornDiosAszekelyCatkowskiBylveBwinefordCartzfagerDntonDgertyBurrencyCnderlinCmerlinCeroCddithCbletteBtumpeDeveDdyDckertCryckerDuveEssEbbeDoughEthmannDahleCoutnerDoksburyDnesFbargerDkeyDfferCimmelDefCephansDmperDltenpohlElatoDinleDgemanDfflerDerEgeDckmanCapelDnsberyEalandDhleyDgnaroDchowskiBquibbBprungerDouleDeheEenEcherCosatoCiveryBouterCpherCmmerfeldtCfferBnowbergerCapeBmylieDerCackBlaydonDttonDghtBkoviraCeansBjolundDdinBiragusaCngeltonDatraClisCebenalerBhuffieldCobeCiringDmabukuroDltsCerleyEbertDldenDilDdlockDarnCaubDrbonoDpleyDndsDheenDffnerBervantezCntzDeyClinCitzingerDderChrCgoDallCedsCbastienBcimecaChwenckFissEarkFlbeDuckerDronceEagDoutenEppeEmakerDnarrDmiedEaderDlichtEagDieldEanoDeveErbarthDaumburgGanCarpinoBavinonCssamanCrahCporitoCnvilleDtilliEaanaDdaClzmannDmanCksCgravesCfranCcconeCAruttyCssettCpardCmpDbleyCffinsCachoBozemaCxasCutsonDrkDghtCtundaDermundCsmanDetteCrkCokeClinChmDlmanECeskeDckerCberEnsonBisoCnneCmaCinaCgsbeeDglesCesterCalsBhinehardtBeynaudDburnCwisCvermannCutzelCtzCndeEallCistadDndersDchardtChrigEerCcendezCamyBazCulsCtzDtrayCsbandCponeCgleDinsCdicanCczkaDhelsCburnDrenDoinCAquesnellCaintanceApuccinelliBrunerCouseEdDsiseDfferDchazkaDbascoCeviteCayerBourCrtellDcherCpocaCnchoCmroyDaClskyEgroveDidoreCdrazaBlymaleCesciaDauCatteEoBizziCnchonCcotDcioneDazoBhilibertCebusBfohlBetellCssoDanteCrvisDrinsDleyDkeyDeidaCnateClosoDleritoCffleyCddicordCcinaCaleDksBayetteCxmanCwlikowskiCvyDlovCtryDmonDilDerDakCsquaDcheCrtykaDodyDmeterDesDdiConessaDCnozzoDamenoClettaCitAoyervidesBssmanChimaBrtliebCsakCleansBnleyCBldroydBkanoBhoraBffleyBestreicherBdonovanChamCegardBbstCriantDechtAnuccioBowlingDdenCvelliGCstCrstromDfolkDdgrenCpperCllerBisongerDkanenCenhuisEaberBeuwirthDmeyerCiceBaugherCimanCgamineAmustinCrriettaDdaughCnarClberryChlbauerBroczkowskiBowdyCuwDselDntcastleCscowitzFCrroDesiDagoComawCntroyEpasEiethEanaroDgelliDCllisonEetteDdovanCharBizunoCtchelleCshraDenheimerCnshallDozziDniefieldDionClhousCgliaccioDdalCckellBeyeringCthotCsterDlerCriweatherCnsingEahDgeDdolaEiblesClocheDnikDlasCinertChrhoffCdasCcklerBctagueCspiritDheaCquownEillerClarneyCkineyDearneyCguyerCfarlanEdyenCdanialFelCcurtisDrohanDorryDluneDantFnaFdlishCaloonBayallCverCuneCtzaDtyDsuzakiDottDheyDeosCsonerDinoDCrzulloEDylandDsolekDquardDioDchettaDberryCnzioneDyDtheiDkaDgramEleEelDdatoDcillasCmmenClinaDettaEckiCjkutCgesCestreCcphailDoDneillDadamAlysiakCneBuxtonCptakCndmarkCginbillBovalloCuthanDsteauDpeCttiCprestoCnsdaleDgsworthChnesCghryDemannCfaroCeberCcastroBivingsCtzingerDtsCottaCngardDebackDdyEhorstCllCdeCckliterCbermanBewinskiCvandowskiCimbachDferDdholtDbyEelFeChrkeDnherrCgoCeseDnCdoCchCblondCapDheyBazzariCwranceDlisDhorneDesCvignaDellCuzierDterDmannCtshaDouretteEnaDneyCskaCrnerDmoreDkeDenceCpierCnzarinDdsCmmeyDkeDinackDastusGerCcewellCbarrCabsAkutchCperCnaCbisBrzemienCupinskiCeppsDegerCanerDmmerBountzCtheCrpelaCmaraClendaEkChnenCelzerEschCcurekBnokeCauffDggsDbBluverCoseCienCahrBitagawaCsslerCrsteinCnnonEebrewEamonCmminsClgourDcoyneCesterDhmBhaBesselringCrestesCnnistonEamoreDebrewCldermanCitelCfauverBatzenbergerDtCstDselDeyCrolCmaraClmbachCizerDwiDnzAjurczykCmonvilleCliarBourdainChndrowDanningGesenCffrionCbesBerdeCntzschDkensDdroCllersonCfferdsBaureCquishCnewayCgoAiwasakiBshmanCazaBnmonClowCclanBldefonsoBkeBezziBanniCcovettoAhyldahlBuxholdCserCmpherysDburgCltDlenderDburtCckabayBowethCvermaleEnCutmanDriganCsekCpgoodCmrichClstineEclawCkamaCffpauirEnerCchsteinGatterEbergBjelmBiscoxCnsleyDksDemanElineDckClbunBewinsCrzingDtzbergEensteinDreaDingtonDculesCnrieDmanDgstCmmenClmkeDgersonCinsohnDglCgstadDgenFCftiCathcockBaylettCupertDflerCtalaCslipCrtlessEjeEisDpoldDmsenDbachCntenDingtonCmmenDeisterCllstromCbershamEggerAgussmanCndyCitterezDsingerDlfoyleBroulxCismerDesbachCaweDllDftDbenBouldenCrnickDiCokinCnzalazDyerDderClphinDlerCergenBlossonDrCadinBirdlerCllimFansEaspieDhoolyDdonCgnacCblerDbinsCardinoDmpietroBettmanCrringerEaldDlichCorgiouGaGCiselmanChmanBauzeCnglCmageCllianEenEatinDenEaCinorChrAfurbushClferChrmannBritterDisDendlyEdlyCeudenbergerDesEmonCatusDnsBoulkeCslerCrquerCntanClwellDdsCellerCdgeCbesBlorekCissDghtCesnerDgelBitzloffCserCrstDminDestineCnfrockDebergCguresCegelCcklingBespermanCrnadezClberCimsterCazelBavreCughnCtulaCsoneCrronDonDinoClveyDkenbergDeyEttiCethCckrellAezekielBspeCkolaCcottCawBrpsCkerCathBnfieldBmfingerCburyDletonCanueleCBlversClwangerDegoodBinsteinCchingerBggeCelandBdgettBchardBblenBastmondAduteauCrlandDeCnlavyDgeeCketteCgayCboiseDeyBsouzaBruckCalleBoubekCrtaDchEeCpsonClneyCckterBistlerDsCppelDernaCnaCchiaraDerboBewindtDanCveneyDargasCutscherDelCtterCssCrringtonDobertsDnCponteCnogeanDardiGCmaryFcusFaisClucasDoeDmonicoDisiEoDducaDaineCihlChmerCepCcosteDhickDaturDCbruceDoldDellCatsBauntCquilanteCmbrosiDasClinCisyChmanDlemCffinCcquelAcutrellCsanoCrtnerDrensDnowCppettCmmiskeyCllersDhaneBrullCossinDpseyDmieDffordCiscuoloEafulliCegoDedenBovelloFCrseDreraDnersDdnerEierCplenDemanCntiniEerasDsalvoDduffEoCmpherDasClliverDanChillDenourCglianoCddCckayneBlumCowdusCaridaDnceDirdayDggBitronDinoCrielloCcciarelliBhrostowskiDistleyGiansFcoFDestCislerDeffoCerneEicoFanDirsCauhanDrterDmblinBerraCperoClliniDiaDesteEdonCjkaBavagnaroCuffmanCtaneseCstrilloFellonDserlyDinoDeresCrthenDseDragherDpentieriDmonyEerDlozziDadineCppolaDeceDaldiCntresEosDevariEteClcaterraDCdiganCbbellAbyrnCkowskiButchkoCslerDhawDchmannCrowDiDgmanCnselmeyerDningChrmanCdnickCcksonEhannonBrunjesDmmelEleveDckmanCouhardEghamDstromDermanDcksCisonDningEdisiCeretonDonDitlingDedonCasseauxDnamanDmonDckenridgeBoyanCxleyCumanDillionCttingFCsshartCrupDnerDdonaroCotCnsignoreEallClterCjkoChneDlmannCgusDdonCenCdenschatzCckovenCbrowBlondinCissettDgenCasiniDnkenburgBjorkmanBistlineDsetCrdowCondolilloCelskiEeCddixFngerCanchiniBevensDardCtancurCrnskoetterEetEardezDlinerEandDkheimerDentCnschDeschClleauCdingfieldCckstromEimDhlerCachlerBazzellCsaCrtoszekDschDrellDnasFbaDillasDbierCltodanoEierraDleDintDdiEersonGamaEaufDcazarDayCizDrosCbaAazimBxeBversaDllanedaBusburnCrelioCilaCgustoBtwillBrtilesDerberryCoCnowDaudEllCmandoCgyleCesDnzCduiniCchilaCakawaBpplemanClinBntoniniCsteyCglenCdrosBmwegCstutzCariDdeoBlyCteriCoiClebachDahCeyCamilloBirhartBhrendtBfricaBegerterBdragnaCmasCderlyGeyDairBbelarCbamonteCadiAzurekCndelCidemaCelkeCckBoggCdyBetsCchDcaBavaletaCrrAyousifCesCastBeagleyBaneyDdaCckelAwylesCkeBoolmanElardDdisFnCnderlyCmblesCloszynDlamBnekBmsBittieDheeCssmanDhamCntleEhropDokurDchClmarthDlhoiteDdnerCkelCeserDnCckeCatrekBhitehallCetstineDelusBeyrauchDersCsterlingCndelkenClnerDderCinrebEheimerDlbacherDheDderCckerCadBatlerDkinsonCsmerDkiewiczDikCrnekeDesCngerinCmbleClkenCkerEleyChlgrenEbergCglerCchobAvorhiesCnseggernBittitowCrgilioCnkCllarruelFmilGarFlovosCdmarCctoreroBespaCrtreesDissimoCltmanCcchioneCalsBarroneDmaCnveenDterpoolDeckDdyckDciseDausdalElphenCldiviezoAurtonCeyBpdegroveBnrueBlbrichAtysingerCoBwiddyBunsonBrueheartCoyanCierCaweekDffordBozziCulouseDchCstoEeCrezCokeCniniDgeCmerlinClmieCbeBippenCernoCchyBhussCreatDanCornburyDneCeunissenDlmonDallBextorCtersCshCnnisDgDchCkautzChraniCatDsDreCBavennerCrtaglioneCnskiDisDgumaEemanDeyCmmenDburriGelloClsmaDlieCkedaCiraCheriCdemyDdeiCaffeAszymczakCczepaniakCafranskiBwygertCemCartzlanderButleyCpernawCndellCllivantCdermanDburyCaresBtueberCrommeDikerDeeperEckEbeConehouseDiaDhrDdghillCirewaltDckCerryDphanieDnstromEeDinbrecherDarCdenisCanphillEiszewskiEardDhlhutDchowiczBrivastavaBpongDmerCinosaEdelCeraCarkBowardCppCoterCnnekFClandCjournerCederCbolewskiBnellingsCareBmolaCetanaDalCarrBlomaCigarBkenandoreCalskyBitterCssomCrkoCmkinClverthornDmanCkkinkCgnorileCddensBhumskyCriderCoultaDnkDmakerCippeyDmadaDllingburgDffletDelsCepheardDerinDddenDcklesCarrieffEpleyDppellDneyfeltDmpineDeferDddockFBforzaBevertsonCtzlerCpichCnneDatoreCmentilliClwayDoverDlickCigworthCftonCegarsCbournCaquistDlockDbreezeBcriverCintoChumerElkeDryverEinerEamekDoonFlfieldEnbergerDniederFderDlitzEatherDirtzingerDermanEnkerEinerFbleDausEkelEadBaxeCvelyDaryCrdinasCntarelliDschagrinEDpedroDjoseDdraEineFgoEgrenEerfordEahlClzwedelEarDvinoEatierraDminenDiernoDbergChagunCeleeCbelArynearsonCkerBupprechtCnquistCmrillChnkeBoviraCttenbergCsoffDeteEbroughCppoloCopeCmasCleyChrbackDlfsCgriguezCelCdriguizDewaldCbackBizorCttCppeeColoCnkenbergerCggsbyDelCemanDdeselCdeauCckeBhineboltCeaultBevakClfordCinsmithDchmannDCgulaCdlingerDheadBaynoDcroftCveCusDppCthmannCstorferDeyCponiCntzDnoDesDdalCmpDnauthChalCddatzAquattrocchiDngApurchaseCllisDancoBrydeCohaskaCimianoCezDvattDchtlBottleDenzaCrtesDowskiCppletonCntilloDgClkaDitzFiCggiBlonkaCaskettDczekBizzutiEaroCsciottaCppensCnkinsDillaEDgitoreCerceyCckupDcolaEioniFanoBhyCilpsFEoEmonEbinBfliegerBezzulloCtrusoEeaDittiDhCshlakaiDchelCrsicoGhettiEechinoDrisDlowDicoDgolaCnnistonCmbrokeCllmanCkarekCirsonCarceyDlerBavlicekCssinoDquarelloDionCrzychEialeDgaCpaliaEdakisCinoCciniAoyenBwnesCczarzakButleyCeletteBttosenDingBstwinkleCmentChitaCarioBrlowCiordanCeficeCantesEDhoodBpelBlpinCiveriaBkonCerlundCazakiBhtaBffermanAnyceButallBortheyDciaCorChBiehoffDderhauserCckolsonBguyBeylonCwstromCvillCtzCsselrodtCmesCallyBauyenCscimentoCrdellaCnniAmyrenBurchinsonCnterDsterDdschenkCjalliCckleroyCBoussaDretDldsCttramEeCseyCrreCntreuilEonEellanoDningerDhollenDgeonDestimeEgroDdesirDceauxClaCgaCeningCcciaBiskoEeDhawCnturnDgioneDervaClsteinDosDlaDksDhouseCchlEelettiEalsBesiaCrsonDasCnifeeClusoDlaDickChlmanCffertCdozaCcumCakerDhlBczealCwattersComberCmonigleCkiddyCgranorDearyDawCeneryDlderryCduffeyCcuistionDruddenEossinDoshElganDlishEenahanEamDarttFrellCbaneCBayburyEenCwCuldenDceriCtkoDhieEeisEaiCsucciDsiahCrtoranoEnezEindelcampDschkeDovichDkiewiczDinaccioDhefkaDcrumCntonEelDnarinoDloveDghamDascoClpicaDlerneeDinskyDhotraCishEelDnvilleCharreyCgidCertzCdaCclaughlinDinaDdermottDallisterEdangdangCackAlynkCdicBuyandoCtkeCpinacciCnzDdstenCllCjanoChnCeckeDbbeCdolphCckmanEerFnbillHachDidoBowneyDitzCvaglioCuroDkDdyEerbackCrickDenziniFsenFcCmuscioCguidiceCcknerEartDhridgeBitakerCsoweCptrapCnnaneDharesDdforsEenmuthDcourtDaCkeCewDsDbowitzBevengoodCskovecDchConiCnnardCgnerCaserEDnDdinghamBazarskiCylandCuritoDluDghnerFmanFeryDbeCtiolaisCsserreGCrsDrowEeaCpsleyCntripEhierDgwellEelierDdakerCmpiDondDblinEieCkinsCippleCgrimasCfrancoisDfitteCdayCckoDavaCborDiancaAkutschCskeCnertCblyCamooBrummelCiseCenekDiserCauszDskaDkowskiDdelBozikDaCtowskiCslowCrberCjimaCchelBnabjianBlunderDghCinkhammerDewerCeverDberCagesDasBizziarCtchelCshimotoCrschenmanIbaumCnnickEDkleDerDdlaEallDcaideClsonDlinsECghtlingerCenzleCahBhimBetchersideCrlClsoeDkerCizerDrCepersBawanoECveneyCthCsparekCplowitzCntrowitzEDoffEDnCmaliiCltDetaDbachDauliEtaEsCiglerCchelAjuranCbbBonkerFClivetteDesCasBividenBewelCffusCantyBarviDdonCnvierDoskoGiDiszewskiFhDekAiwanskiBulianoBsabellaBrleBngmireBmberBjamesBiamsBhrigBchikawaAhynumButzelDtsCskinDakCrndonCntsingerCmmCletteCitronCgueninDgDeeCelskampCchBowenCvanecCstonEettlerCrsfallDodyskiClzhauerDlimonEenderCgarthCffelmeyerBistandDsemDelCrayamaCnegardnerDdeDchcliffeCltbrandDsingerDlstromDeyCckenbottomEamCbleyBeyingCwsonCtlandCrschDlongDdaCnzelDshallDdlerDceClsonDfenCinbachDkkilaCggsCfferonCbardCathcoteDrlDberlinBauthDschildDghneyDchCttoriCsteDleyCrtpenceDrounEierDelsonDdgroveEelCnsbroughDdsomeFhoeElyCluskaDlyEingDfhillEertyCkansonCistDrgroveChnerCggCfeleCalandAguttierezDknechtCnnarsonDlockCmmersheimerCllatteCityDlmetteChlCenetteCardinoBroshongDberCippDllotFiCeulichDtzingerDenwaldtCavenDssmanDnbergDeserEffFDbowEauBotchyCswickDaCrdineerDczycaCodchildClzDlihueDdwireEbachCffredoBlassburnDeserBillilanCganteCereDgerCdcumbCarrussoDnnelliBettleCsualdiDchkeCrwigDvaseCoffrionCntilcoreEherCmesDberlingCllesCitzCeslinCdneyCbauerBayeCwronCviaCutneyDstadCsmenCrgusCnskeDgerClvisDlingerFchioEettaCedeCdlinCbyDrielsenDoriaultAfurlanDgersonCjiokaCgettCehrerBriscoDntDgonCevertCautschiDkerDdetteBoulkesCrslundDniCoCntenetteDesClzDmerDlmanDkmanBlourneyCicknerCemmingsDischackerCanderDmentBithianCsterCorelloHiEavantiCeckCckeCallosDccoBeuerCrringtonDnholzDiaDgursonCickCblesBavilaCulkinghamCthCrnamClterCkhouriCirhurstDlingChsAevaBstrelloCsickCpreeCmondCkelsonCcueDatelBrebiaBpperleyClerBnyartCgelbertCdersonBmmittCchBlisondoDCfordCBkmanBickDhmannBhrichClenBdwardsonCleyCghillCelBastesFrbrooksCglesonDenCdeAdyleButkiewiczCnnaganDcilClingBrumgooleConeyCeyfusCaganBowtyCscherCrnanDemusCoganCnahoFeyCmbkowskiCltonDenCbratzBiveleyCttemoreDschCsqueDhmonDchCricksonCppolitoCmuccioClgerCefenderferCcolaCblasioDelloBevanCttmerCschnerDbiensCrushaCnkinsCmonbreunDchakClucchiDpreteDoyDizEneDapCiterDgnanCgiacomoDaetanoCfuscoCdeCboardDiaseCavilleDdwylerBavanzoCughtonCrterDrinCnserDdradeEoCmpeerClzielDenCinDCgueAczekanskiButwrightDliffCrleCozzoCnningtonHFghamCmingsBrowstonDakCittleDspellEostomoCearEchCaigueDbbsBozziEaCxeCwsertCvielloCuseDllCttierCstagliolaCrraDpeningDmanyDlessDkernCntehDquestDkeyDesDdittDatyClombDluraEedgeDinsDgateDesonEmonCinsCfflandCcciaCastBloughertyCewellDckleyDavelandCarnoDmpBivilsClloCfelliCeslukBhumDiCristisonHanaCowningDuteauEngCildresCerringtonDnetteDevesDairsCaddockBernochDinoBazierCthyCstelDselberryDertaCrveyDtonEDryEisFeDmantDielloDdarelliDasEccioloCpitanoCntoniEaveDcioCmpilloDCllensDderoDamiaCheeDanElanCbanillaElAbywaterCnesCasseeButkusCskerDhbyDackCrtisDrolaDokerDniasEDlockDhamDakCllaCffinEaCeningCdneyCchannanFlterCaBruleDglerCoxsonDunDshCisseyEbyDnleeEkmeyerDmleyDckellCethDgerDesCankDkerBozakCwldsDersockCusmanEhieCtzCrdwellCnkowskiDineEfayDesteelCldinChringerDlanderCeckerCcookEckCblettDbettCasDrmanBleserCazejewskiDusteinFeyDncarteDizeDcksonFeterFardBischCrchettCllaDderCernerDnvenuDlinskiCalasDginiBeynonDlCttiniDhanyDcherCssentDharaDchCrndDgemannFauxDdanCnsDedictoDdallCltronFamDlvilleCischChneyCemerDchlerCckumEsBatzerDteCstidaDsetteDleyDeCrtoshFloneDracloughDnickDketEdollDingerDgesDellaDbianEatiCnnanDderasCllesDdoDasubramaniECigChnCchmeierCbyakCasDrsAayusoBxtBvingerCellaBusbrooksCllCgelloBtkesonErsonCherleyDanBssadCebedoBrrisonCmonDfieldDbrustClingtonCkinCchambeauBntonellisCgottiCdyBmoroseCiniCbornCanoBluarezCmaClgaierDegoodCesDnCdamaCbertineBkiBirdBhsingCmannBguadoCostinoHelliCnesBdwellCsitCelsteinDBctisCiernoCheeBbbsDittAzwagermanBuercherBinnoBettlerCffBavalzaCuggCrzyckiCppullaCnottiCchmanEerAyundtBslasBounesCntzBglesiasBeskeCllowCarginBaugerCmaneAxangAwylamBrobleskiCatchfordBorkerCodleeClseyDfinbargerChlenhausBittlerEenmyerDkopCshmanCntzDkelmannDdusDbornCmsCltroutDshireDlmottEistonDemonDbourneCedykCdmannCcklandEesDhertBhitsellDsenandDdbyBetzCstmeyerCrtheimDnertDleDkheiserCngCldinCissenbornDngardEfeldDhlDghtmanDchelChrheimCgrzynDmannCaringBaszakCnkumDglerClthourEermireDstadDdrenDbertDawenderChlundEertGsCchAvuncannonBroomCedenburghBonkCllmarCisinetBlahosBiscardiCresCppermanColanteCdroBesseyDperCronDgariDbeckCnturinoClasteguiCgterBarasCnweyDvrankenEalkenburDorsdaleEliEchtenDierDeveryEDduserEersteenFllEallCllotFnEezFlyCdenaisAutheBseryBngaBltschClomAtyminskiBwogoodBursiDayCngateBruxilloDlockCovatoDiseCipiDnksDmboliDckelCeziseDfryDenDbilcockCaviesoDchtenbergBouheyDgasCrtorellaDmeyDelliDborgDanCmekDassiCllersonDdenCdaCbonBjelmelandBitmusClburyCetjeBhurnerDmCropeCornbroughCibaudeauCackerayBesoroCrritoDnesCichCcsonCaterDgardenBatschCralloCpanesCnbergCmmAsylvisBwenorDdlundCaggerButfinCraCndtEinCmmersonDatzkukuCltemeierDivanCggittCermannBturkieEgessDmphDemkeCruckhoffDoseEderDideEcklenGDeibFDawtherEtisEhmCortzErerEinoDhlerFDckelCinnetteDleDeberCenslandDffenhagenEanowiczDeverDagallCatumDpleyDnishEdifordFenDmosDhleckerDdtlerBpratleyEkerCositoCickardCeharDesDaringCangleDlloneBoxCulardCrelDaCpkoCodCnnenCmCllyDesbeeDdanoCbeyDczykBnedegarEdonBmolinskiFkBlotaDmanCeighCavickBkorupskiDlnikCirvinCeelsCainsDhanDarBiwiecCverlyFDakCrkCntonDorDcellClbersteinCeminskiCdelingerBhurmanDnnarahCirerDdlerCerlinDppersonDmanskiCarumEtrandDpardDnafeltDmpDderDckeltonBeyerCrokaDnasDightDanoCnguptaCmperClingerCithDdlerCehusenDfriedDdBcovellDrzelliDniersChwindFchtenberEerinFnkeEadererDusslerEnemanEmpertEltheissDrollFepferGdenEimpfDookFfEmburgEenfeldtGerDnoorDmickDlerethDindeleEldtGknechtDemmelDarfenbergEnnoFeEerEdCearceCardinoBawkaDinskiCvocaDeryCultsDcerCrpyDisDdinhaDafinCnkarDjurjoDderferDagustinCmudioDmartinoDasClzDmenDlieDkeldDamonCkuraiDodaCfleyCdaCchseArydenCbackBussowEeyCprechtCmpleCffiniCdzinskiDelDdenDBoveroCutledgeDssinFeEerDgeauCsieEcaCmeyDanielloClfsCgoffDneCdriquzEequezDinCcrayDkeCbbinBiviereDetteCskeDenhooverCndfleischDaudoCmbeyChaCghiCdnerDlingDenBhueBeyomeDnoldsonCuschCnsingEchDnelsDderosCiningerEersDgelChmerCgierCffCefCdlinCcchiaCaumeDgorBayneCweCttiganCskaDhedCntaDftDdlettEaCmiezDellaCllisCjanCisbeckDmondoDbleCgoneCckliffeAquirinoGgCeroCaifeApykeBuruggananDsifullDkettDdonCnchesDClosDlingCcciaBrovanceDpperCeisDhnCataDsekDngerDdierBortorEleyEeCpielDescuCmalesClowyDlettDitisFDeyDChlerCggioCetCdolakCagBlymelCoegerCantyBiskuraCrroneFDosoCnskyCleDantCckerillDcolominiDartCascikBhannBetruzzelliDosaCrssonDrettaDkowskiDilliDcifieldDaultCppelCmberClotteDcherCixotoChlCatrossDrlsteinDcherBaydenDaCwelekCveyCudaCthakCrrilloDnessDleeColiCnnebakerClomarEDmbergCganelliCffrathCdovanoDdenCchuckiAoverCandoBthmanBsowskiClerCikaBrsburnClowskyCegelBppeltCferCdykeBnellBmerBlivosBkumuraCoroBgasBfferBelschlaegerBdetteDrBcanasBbrionCarrBasCreAnyhusCenhuisBunnelleyDamakerCckelsBoydCwlanCvakovichCteboomCrvielDtzDmentDlandCltDieBixsonCtkaCssleyDhiyamaClandCewiadomskiDmeierDlandCckeyDholsenBewarkCugentCtoCrrenCinDkirkDghCdrowCaveBazaireCvaroEltaCsworthyDifCniClepaCkaoEiCdolnyAmyklebustBusselCrthyDatoreFCndieClverhillCilenburgCetzelCdraDgettBrozinskiBouraCttingerCrsonDettoEntinDdanCorelandDersCntsEoneGdoEieroDserrateDieDatEresClloEetDacekCkryChrmannDabirCgaveroCesCceriBiyoshiCtznerCsraDCrrDaCnishDgeDcklerClroyDleDeskiDanesiCkoChokDalikCeczkowskiBesserliDkillDenbrinkCrtonDryweatherDklCnserDnerDkDdenDapaceClbourneCkusCinzerECersBctigueCquittyCpheronCmurdieClearyDaffertyCkinzyEbbinDethanCinteeCgurlCeachranCdowallDermittCcuaigDreedyDoskeyDloskyEintickEeeseDanlessBazzuccoEoccoDurkiewiczDariegoCyhornCxcyCvityCuzeyDldingCtuszewskiDtssonEkeDsushitaFnoEkoDkinDhurDesCstermanDsettEartGiDhniCrtellaDrenDgottaDderDczakDanEdiagaCnwarrenDtiniEerFlliDsoDgoneDfredoniaCldenDboeufDangaCkaraCisonEanoDrsDlhiotCgriDicCdronDoleCckallDduffDartneyAlyndsBusaneCffmanCaBouthDghmillerFeedCtspeichCrenziEeCosliDkerCngeEaneckerDeroChmeyerCezaCbsteinDnerDerBittmanDalienCppeCntsDearCjewskiCgasCebertGmannCberatiBezcanoCvinthalCssorEDieurCnningDgelDCmpkeEDarCitzkeDnweberCgroneDeCderBawnickiCuthDnDgharyCtinCssleyDhwayCrriveeDgenDeCnouetteDnoDgilleEenDdingDaCmonteClinDaCibleCfrattaDorteCcuestaDerCboreEeDeauAkwasniewskiBunselmanChrCchlerDBrugmanDckenbergCotzerDemerCistDgbaumCekeDismanFlerDftCasnowEDgBouyateDghCtzCsturaCrnerEblumDczynskiCppaDczykCnzCmorowskiCllenDanderCepnickDhneCchisBnochCippersCaebelBlippDnedinstDmczykDerCementCaphakeBislerCnzieDesDdleyCmpleDmDbelClkerDbornCbbeyBhongBetchieCrbowCnnemoreFbeckFallyEdyDmoreCmnitzDlerDeryClnhoferDlstromEisEamsCiterDrsteadCenyDlinDfauverCamsBautzmanDsCtayamaCssonEimDparianDeCrwoskiCpuscinskiCnekoCmerlingDadaClkaDarCkacekCczmarczykAjuricaCnesBournellClliffeChnseyCelBindraCmenzBetteCspersonCridoCnretteDcksCchBayroeDoDeCvensCskotCrosCquetCnowiakCmeCegersCckelAizumiBthCaliaBrelanBonBnzunzaBmotoCmeBglehartBannoneEaconeAhuylerCssainiCrlockEbuttCprichCmphryClslanderCelsmanCdelsonEcekBsiaBrehaBoylandCwkCusholderEdenDffCrkeyCnanCmmeCltzbergDlyfieldEingsEenbaughCkensonCgrefeDlandCelCdgkinCchhalterBjelleBittsonCndermanDchliffeCmeClyerDbyCbshmanBeydtCwellDardCtuCstandDlepCrridgeDnerEandeDmandezGceDboldConCnthorneDionDaoCmingClmkampDlbergCidgerkenDchelChlCgedusCftyCckathorneCarronBaymerDcookCvlicekCusladenCsemanCrtsookEogDnsEeDmannDenCnserdDnersDekampCmraDleyDelinDbletCkimiCgleDinCehnDckCcklemanCackeAgulanCirandDlesCggemosCerrieriFeiroEecaCdielCccioneCblerBruenwaldCitzDeserCeweDnonDgersenDfeDenerDchEcoCavetteDssiaDnholmEerEdiDhanDdowskiEneyDczykBouthierCttschallCrackeCoteeDdknightEineCnzaleaDtermanDalezCmmClemanDdtoothEstoneEeyDanCesDnDllerEDckeCdekCanBlunzCoydDdowskiCinskiCaweBirodDdleyCovanniCndiCllingsDdnerCgerCesbrechtDrkeECboneyCaquintoDnnakopouloDimoDccioEaloneBesselCrouldDltDholdDaldsCnsonDereuxCllatlyCigelChrigDleCerdesCaganBawelCvinaCussCtwoodDhmanCsterCrskeDrattDmsDisCnsburgCmmellDbaleFClimoreCdwayDouryAfurrerDnishDinoCllardCkuiChrerBryouCiesnerEdliGFbergCeyermuthDminDdellCazeDnkenBoughtCthDeCrtiniDneaDmanekDkerDgetteClanCisterCglesongBlinckCewellenCatenDigBitgeraldCschelsCrmanCnstadDkelmanDisterDderDaBettesFrhoffCrriterDchCnnessyCltusEesCinmanBarveDryEallDagClzaranoDckDangaCkhouryCireEbrotherCgleyDginsCcteauAewerCbankBvolaCenerBustisCgenioBstwickDelCsaCpinolaCcutiaDhmannBrpeldingCnsbergerClingBntzCriqueCgelhartCbodyBmickBlsingerClinwoodFgsenEcottCkindBisingerDenbeiszDchenCmerCgnerCchhorstBhmkeBglestonCgettCeBfurdBdgeworthBckelsBbeyDrlingBagletonAdwigginsCeckBunningsEavantCmlerDanCgueCerksenCdeckBreisbachCawdyEbaughDineDggooBowseCvelCughtonDdsDbravaCrtDshorstDnierColenCnavanCminqueFionGkFgezDeDClderECbiesBkBiskinDanoCrdenCponioDirroCmockCltzDlaboughDeyCkesCggesDerolamoCelCckerDharryDeccoCbartolomeoCamantBewireCvoneCsseckerCrtingerDousselleDkCpauwEloCnherderCmeyerEtroDastusClvillarDoyeEsriosDgrecoDargeEngelCjonghCitschCgiorgioEdioCfreeseDoeCcambraCbenedettoCaderickBazaCuzatDghenbaughCtoCssCrwishCntuonoEonCmmeyerCloiaDeoCggCceyAcurtsCnyDneenClverhouseCervoCcinellaCbitBrummDdoCowfordDutDtteauDssfieldDokeDmCitzDstaldiDckmoreDbbinCemeensCayneDdduckBouvertierCttamCssioCrreyDdreyCplonDassConeDdyCntoisDslaDnelleyEardDgoEletonDdryDceptionClteyDindresDgroveDferDasurdoCckerDhellCbbinBlouthierDssDonanCizbeCennonCayburnFournDusellDsbyDgettBiskowskiCrrincioneCnqueDelliCmagliaCaburriBhristianiGesonCladekCizmarDnniciDarellaCevrierEesDrnowDongDltonCarletteDninDmDligojBelestinoBayceCveyDarettaCughronCtmullDapanoCsioDhawCrulloEalhoDthonEelliDrubaEereDolusDmineDlstromEiDforaDelloDbaryDCpletteCnnellDcillaCmpellDmarotaDiloDejoDarataCisseCcioppoCbbagestalkDatuEnasAbylesBuxbaumCtlandDchCrringtonDnsedEinghamDlinghamDgyCitragoCffettCetiDhringCdayCcksEnellDhbinderDeyBrusterDnstonDmbyDinsCouilletDsiousDomesDdinEdyDchardCitschEcherDerleyCezinaDssiFetteElowDndenDierECaymerDsuellEhDnscombEinEdleyDhlerDchtEamontesDbsonBoyneCxellCweryCvardCutelleDletteCttiniDkinsCsenDciaEarinoCrichDesEmanDdoyEleyEenetCquetCocksClnerCissyDlardChnenDallCeningCcciaEellaCbeBlythCitzCewCacksmithBivianoCttoCselCnstockDesClliterCgsbyDhorseCelawskiCckmoreBettinEenhausenCssonDeauCrtonDroaDntsonEasDisfordDhowDgsmaCnyoEardDteDnionDkoClskyDlavanceDascoErdoCidlerChringCgnaudDaCfortCekCdoreDdardCcknellCardsleeFallDganBaylyCuzaDtzDsmanDmlerCttersonFnfieldCssfordEeDemoreCruchDtholfDsDmanDayEbasCnghartDezClsamDlesterEaghDdockCgnoliDheriCcusDhoDcamAaxsonBverhartEDBustillCberryBthansCcittyCayBstaritaCcoleseBrtzerDsCrasmithCgenbrightCescoCbCanjoBppleyardDenzellerDCiladoBntonettiDisCnettDasCgwinCdrisFesEeozziDoDisDereggCastasiaBmyotCinovCelungEioCasonBlviarClendorfDdayCiceCdredgeCcivarCayaDpaiBiringtonCnaClorBhrnsCmadiBgrestaCentBffolterBeschlimannBdneyCerholdDllCachiBckissBbenCdelhamidCarBaseAzorillaDdanCllmanCchBipfelCmmerleCkeCelBhongBensCladaBamanChnerCdoraCcharCborowskiDinskiAyzquierdoBoshizawaCriBieldingBertonChlCargainDkleyBamaokaCgleCblonskiAwyniaDeCersBrzesinskiCyeCistonBoolumsEenDdlockFeCnserCmbacherCllschlagerEenDfleyEerBisseDellCrsingCnstanleyEleyDieckiEarskiDgeDesettDdellDberryCllyardEemsenDkoszDenskyCkleCfordCenkeEekeDderholdDboldCdickCckenhauserBhitrockDsnerDneryCerleyDdbeeDadonCaryBesslingEellsCnningerDdrothEeCllardCirickDnkaufChrmanCechCathersbeeBaterfordCrtonDnckeDmDdripClstromDksEowskiDcuttCightDCgmanDgettCdfordAvowlesCrmwaldCndranChsBittDaloCserCnasCllenaEaneuvaFfrancaGlorDainCgilanteCcoryCanaEDlBerucchiDraCnzkeDskeCleyCileCederBaskeDconezCrgasonDbleCnwertDtolDscooterDmetreEaanenDhiseDettaEatonDdykErielEorpEewaterFrveldenGsteltGhoefGbeckDbibberDalstineEcoreCldespinoCillEesCgliardoAursiniCreaCiveDegasBmphressBcciBballeAtyroneCnonBwinerButtonCdelaCazonBroisiCipplettDasCescottDichelDdoCanterBozerCxeyCrtoriciDnowCpolskiDiaDelDalianCnneDdreClaCepkeBiuCsdellDcarenoBhornborrowDmisonCilgesCeuretDrienCangDgardDcherBexterCrzoDesaCpCnpennyCmpestaCetzCaffBavellaCussigCttonCslerCrrenceDdieDazonCntilloDneyDksonDgenCmburoCkesCboneAszilagyiByphersBwistakDatkowskiCeigertCayzerDppBvehlaButphenDchCsaCrmaDlsCndermeyerFenClekCiteCghrueCdolBturmsDparDmDckmanCroleEhmanDeedEbeckDausserEsselCpaulCortsErDmmesCmaryCjulienCikaDggersChillCevickDrmanDphanyEanekDmlerDlmanGckDinkampFbockCcroixDharlesCaudingerDrryDnlyDllsworthFeyDinsBrockBpritzerDacklinCinuzziDdellDceCeyrerDrbeckDndloveDedyDckmanCargurDngenbergDidBowleCulierCtolongoCstreCreyCnierCmogyiDeraCloDdoCfiaCderholmBnootsEksDkeDdderlyCideCeeBmokeCithhartDllieCayDllmanBliwinskiCentzDddCagerBkogenECardaDlickyBiwekCttersonCstiDselDCnopoliCmiltonFaDensonClvertoothDosCgginsCelerCburtCanezBhurleyDlarDecraftCreevesConDllenbergerDenCishidoDppsEesDnallCerfieldCaweDrrettFardDnkmanEDmBessumCrvissEelloDiceDdaCmlerDenzaClmonDlenDeyCidnerDbChgalCelbachCdivyCbrenDoCanezDgrovesFenFaveDbronBchwertnerFgelEarzerDrunkEieferEederEankDoppEnfeldEenwetterDnallFckenbergHDmutzlerEiererFdgallDlupEoemerEittDermannFffEllenbergDainEedlerEbelCacciaBayeCxmanCurezCsseenDnettDCrtiDraDberDanCntoyEeramoDsoucyDdoElesEburgEauCmraDahaClonDizarDamCindonCgaserCeteunCduskyCckmanCbaterCasAruthvenCszkowskiDcheCmpfChterDenkampCfoCdgeDdleBowleeDandCuthierDgeotCtramelDanCswellDtenDilloCokardDdeCngstadCllieCiderCffeCettgerCdickCchezEatCadsBivkinDadeneiraCstonDsoDeCnderknechtCisCggsbeeCfkinCekerDgleDdyCchwineEmonDciutiEardoDardsonBhewBevoirDierCmsbergDiszewskiDboldCllaCinkenDlandDdelDchartChakCdwayDnourDiferDgateDenbaughDburnCapDdusBaybuckCuhuffDdaCtteDhjeCppleyCndsCmseyerFurEdaleDoDarizCitzDschDnoneChrCgasaCfalskiCdunzAquenzerDjaDenanApyunBuzCtzierCskasCrringtonDiCntCllarBruseCingDmeauCevetteDuettDstoFageBownellEallCtthoffDratzDhDerCsthumaDenCrrittCpkinCormonClidoroDesDcynCkoraCerBluvioseCockCevaCackeBioliCngletonDchbackFCerettiCcconeCatkowskiBhilleyDbbsCayDganBfundBeyerCttersenGDrucelliEopoulosEasDixCsterCrksCppermanCnnickDadoClotDisCedenCchonCalBazminoCtchinCsierbCrranDillaDdyDcellsDagasEdeeCpinCnkoDgrazioEelinanDdyaDcheriDasClmiterDlaresDinkasDekCgliaroCckhamDittiAozierBverbaughBurslerCimetteBttesonCsukaChonBsmundsonBrozCgillCdeneauxCamaBppyCheimBnkstBltmannsCstadCofsonClivierCenDjniczakBkuraDnaCeyBhrtCarraBguendoCierBffermannBetzelCchsleBdorDhertyCdiBckermanCchiogrossoBbryonDemskiAnyreenClundDenCholmBuonCanesBorrickDisDdellDburyConerCnoCmuraCleDdenDaCfsingerCcitoCbelBiedbalaDbergallCcoliniFeDklausBevilsCuburgerCmerofskyEcekBazarenoCstriECncyCgorskiAmyreBuzzeyCttonDschlerDherCsumeciCranakaEmotoEdEchCnsDnoDcriefCgrageCeckeBozerCyetCwlesCtternCsmanDconiCrineDgeDavecEdCneymakerEsDcurDarezClzahnCgliaCeschCdyDisettBitnickDhcellDchinerCstryDercolaCrabileCnvielleDoDklerDifieldEchielloDdellDasianClteerDlweeEsteinEienCkrutChalyCgginsCchardBezoCtznerCsquitaCrvinDriwetherDkDfeldDcikEadanteCntionDnaDdizabalEerCmbersCluskyDquistDladoDerEndesCkeelCiggsCgginsonCckBcwherterDayneCsparrenCreaCneffEaseCmurrinCkeagChughesCguinessDiltonCelreathEhoneFenneyEdowneyCcurtainFeDoskerEryFmicDlineEeaveEatcheyDarneyEnseCallenBazzieDinDanecCyetteCutzDserDnCttasDhurinEiesenCssmannDriDiasDcoloEettiEagniCrzolfDuskaDtainFDszalekDolfDmasDlorDkwoodDinesGroEerEchDcomEianteEhmanFioDbachCnzoneDteyDninaDhardtDfredDaoisClmgrenDloneeEinEaryDetteCkinsonGDarewiczCinwaringDdaDavaCgroDouyrkDettCederCdyunDuenaDenEiraCcnamaraDkinsEelDinnesEaDgowanAlyssyCerlyCallsButterCnneyCksaCdemanCcidiDciBowdenCvierCughridgeCschCryDsonDenzanoDdenDberCpardoCosierDmerCngsdorfEchampsDcarCkerCgwoodCeffelholzCckmillerBivotiCnfordDenbergerDdloffEenbaumCmogesCllaDeyCghthillFbourneCeskeBezaCvelsDandoskiCuckCpereConhartCnonCmmaDlerCisingDnonenChtinenDanCetchDmingCdyardDwithDinghamCclereDkCbertCandryBazzellCyoDeCxenCwtherDnDeranceCvoyDertuFdeCurenCtoucheDnerDhenCstDkinDhbaughDcalaCrroqueDickDaiaCplumeCnzilottaDnomDdriganEoltEessDciaCmkinsCllaDkCkemanDatosCibChayCgraveDerquistCfoyDlecheCderCbradaAkwiecinskiButnerCnshierClakowskiCjakCehnleCbisiakBrzyminskiCughCoisCitikosDllDenerCewsonDtzschmarFDsseDiterEscherDbelCautDnsDlingDhenbuhlBounsCtsonCssowCprivaCnkleClterDkDichChnerCeppenDnigsCckDhanskiCbusBnowlingDuffDerzerCippelBloberdanzCeinertCarichDassenBizzieCsamoreCrnDalyCppsCnsonDnemanDgtonDeCmbrielClleCckCbodeauxBhamvongsaBeylonCverCserCrtzDchevalCnnethDdrixEleDCmptEleCeseyCatsEleyBazmierskiDdaDarianCwashimaCtschCsunDsnerEemDperskiDingerDchakCrelsCntolaDaCmaiClthoffDlaDaniChrsDanekCcherAjurasekCniperDgelsCkesCelfsCdiceDaCBosselynCnssonDakCensCbsonBegedeCeCanjacquesBaworowskiCspersCnnsenEerDkowiakEDiakCckowskiElinCbbourAiyerBvesonCanBsnerBniquezCgwersonDberCaBmbrognoBlleBkeharaBannelliAhysonBuxfordCsethCrnsEeyDlesCnningsCmbargerClanCisingaCghettFnCdlerCbiakBrickoBowCverstenCttelCsakaCrschDmannDdgeCnzellCmburgCltenDmeDlopeterEinsworthFbaughDbergChmannCenstineCdellDdeCbertBivesCterCrkoCpolitoCnzmannDrichsenDgerDcksClzDbornCghleyDashiCeattCckenBeverlyCschCrvertDshkowitzDrerasDmannsDgetCnriguezDnonDgelClmlingerEigDenDdmanCizerDnitzDfnerDdornCglinCfflerCbnerCathmanDslipBazlipCymesDaseCwverDCvermaleDasCuberCshimDenauerCrvelDtneyEelDshaDpineDkriderEinDerDclerodeCnzelyDniEaganCmpelDmerschmidtDarCllumsEinCinlineDdCggartCfenCerCdiarisDadCckfordCbeebAguymonCtteryCnnettCllCilletteEianoEbeauxDherDgnardCerryCdeCcmanCadianBrzybowskiDelakCussendorfDmetDenhagenDdzinskiCoundDssmannDfCissoEantiDffittsDesbaumCellaDgstonCavelineDnduskyFinettiDmmBoynesCwingCudieCsmanCrtDslineDalskiCodsteinEroeElinEheartFartCnzelezDthierCldsworthyEadeCettelDrlitzDpfertDhnerCbenEilleBlockCiemCeichCassonEcoeDdwellBiustoCrdnerCppleCllerCesingCammonaBhormleyBermonDingerDgelyDberichCpnerCnsDierCmmeClsingerCigleCbbiaBaynerCvittCtrellCstineauDiewskiDcoigneCrroDinCnongDgaClpinDlusDiziaCjdaChmCgenCffiganAfurnoEiaDgasonBronczakCishmanDessErdichCeshDestoneCantaEkovichBorsDresFrBlorisFdoFaCisDcekCensDgalCamencoBinklerEenbinderDefrockClterDpoDionCermanDldmanBerreyraDnendezDgesonDaCncilCithDghtCdericiFerCchtnerCaganBausnaughDbertCtaCrmanDinellaCntauzziDaraClsoDardeauCgnaniCbroAexcellBwtonBveyDrettsDCartsBtheringtonBstremeraDisDabrooksCsigCplinDenschiedBrnzenCichBppesDardBntwisleBmmiCisonBlisonCguezabalCedgeCbazBislerCdenCchorstEertBgleCglerDimannBdeyBckermanChelbergerBbbsCanksAdziakBycheDeBuschCrossDleyDateCnsworthCmkeClekChlCgginCffordCdziakCcrepinCbreeFDieDasBrosteCiskoCewniakBoxtatorCwtinDnumCubetCttleCsierDhiCrstEetDnbuschDenCnzeDicaCmanskiEgalaChseCernerEflerCbleDkinsBiltsCgiulioDaetanoCetzelCddleCckelBezarnCvoyEssEnshireFDillaDereCtersCsvergnesDhayDenaCrossDCpedroCnsleyCmorestGFaDirjianDerchantDatteisFeoClgardoDfaveroDaurentisEmarEcyCitrichDsherCgraciaFafCfriesDilippisCcourseyCbruinDiasiDarCardenDlyBayhoffCvinoCrvinDrisawDbyshireCquinoCprileCnialDhDahyClsantoDlavalleCineCgelCdamoCcyDunhaCbadieAczyzButsingerCrneyCppernellCnliffeCmbyCllopEinaneCginiCdmoreDaCcuzzaDhBrumbyCouserDckCittonEchleyDstyCemonaEarDhanDaryCascoDllDbbeBozzolinoDierCynerCuvillierDntermanDlthardDdrietCttomCrzoDnuttDkranDdsEaCpelinConanCnsoloDrowEanDnertonDkwrightDdrenCmpDlyDiskyClliEetDelloDbeckDarussoCinerChronCdereCcksCbiaBlyCusterDreCowserDvisCingenpeelCenneyEdanielDmensonDereDcklerCaybaughDsonBirulloDauloColekCampiBhristopherseKCovanecDpraDlCiemCestnuttFermanDrnoffEmakDletteDckettsCarpiaEoEgoisDmpmanDllenderDfinsBerrutoCliCaBazenaveCyCvaluzziCuthonDdyCtinoDerinaDanoCstellDsaroGinoCrranoDozzaEwDmickleDlyonEewDdenaCputiDleyDalboCnsecoDdellaDalCmptonEosanoCllerosFjaFgariDicaDarcoEisCillierChueCdenheadFasCberaAbuzzoCstoDsmannDenbarkCrzynskiDsleyEellDleDkleoEetteDczykCmsteadCllettCikemaCenaventuraDgeDchelCdreauDhramCcknamBryeCushwoodDmbalowDlotteDingtonDdererCownsDugherDmfieldDegeDdheadDcklesbyDadieCizuelaDtzDsendineDllaDggemanDertonDdgefordCeyfogleDvigDuningerDsseEetteDlsfordDitbachDadCayleyDundDnscomEdoFnerDhmDboyEbleBozmanCyteDnesDkenCwellDanCutetDseDletFCttcherCsquezCrrellDiaDdesDchardCnsonDinoDasEmicoClstadEerDlisDichDfCkerCileauChacCguckiDrenCegerCdzionyDoDleyCbackBlytherCightCenkerCazinaDseDmerDcknallFmondBitzCserDcardiCnzCltonDlotteEafuerteCgfordCeglerCbberBhandariBeyersdorfCvelleCttendorfCssardCrtscheDneDlingerDishDanekCntsonFenDskinDoyEistDitzClongiaDmoreDkaDenCitzelEerFlChrnsCckworthEaCaudionDryEeDmesDboutEerBazzanoDinetCucumCtrezCswellDtosDcombCrthaDstadDrilleauxEettoFsiDonaDkhurstEeDdalesDczakEaDashCnfillCmbinoClonekDmesDlonDkoDestrieriDdinoEelliCkenCizaChnerCekCdourDmanDleyDiaCckmonDichDcaAayscueCoCnesBustenDielloCringerCilesBspinwallCkwithBrtigaCroligaCnsCmanCellanesCacenaBntwineDunaCselmiFCnenCgelinoGDarolaCdraeBmparoCodioCieCeenBlwineCverioCtroDobelloDemusCquiciraClyDphinDemandDamCessioBkpanCermanBionaCkmanBgyemanCredanoBdamikEczakBcreyChillesCevadoBbuCreoDahamsenCildAzwickerCeigBuvichCmpanoCluagaCbekBornesCglmannBiminskiDbelmanBhanelBenorCchmanBaunerCmarronCffinoAyusufBtuarteBokeBettCrkovichClderBawCsudaCppCnkeeCdenCckleyDcarinoAxiaAwytchCreBussowBorthingDmwoodEackDldsDdsworthEellCodroofEingtonEhamsEdellCllnerCjtkowskiDcickiCganBlodarczykBixtedCthingtonEemCslerCrickCnterhalterDskiDneDemillerCmettCltfongDlibrandEesDkosDbonCktorCggersECegmannCckliffCbergBhittlerFentonElingFedgeEherspoonEersFcottonFbirdCearyBetherillCstmarkEabyCrtenbergerCntlandDstromDkerCllenCierCgleitnerCdekindBawersCsselCrehimeCnkDderseeCltmonEersheidDbridgeCkelyEhamCjdaCitheDdelichChlerDingtonCgsterCdelAvuyovichColoClichCkovichBolmerDlrathEbrechtCgelgesangCellerBlachBivarCtulloDanzaCskerDalliCrayCnningDiardCllapandoFmanCerCarDllBerstraeteDmilyaDdonCnnCltenDisBaseyCnovenErderDlueDheelDderwoudeGheideFnheuvelGbosFbergEalDblarcomDakenEckerCllianDineDentCineDleCdnerAuttechBriosteCbanikBnrathCnaschCderkoflerBeharaBdyAtyrerCburskiBwaddleBurntineCnisCllockBrunkCoppDiloCitschDolaDgoDbouEleyDCetheweyDssDlaDharneDfethenCaylerDxDutDngEelDgerDczykBowsleyCrrecillasDnatoreDkDivioEelloColesDdleCmmeClosaDenCcaBitteringtonCpswordCnklenbergCmCgneyDertBhygersonCurnECreatsCorstadEnbergEesenDmastonDlenCickeCeilerDbeauDauxCakerBewaniCufelCtleyCrrebonneEanoDpeningCllyDaCigDchertCgethoffCeleBatarCshjianCrteCntonDimotoCmimiDasClmanCalAszydlowskiCostakBwoyerCerdlowDedenDdaCankeEderDckhammerBuyamaCrianoEDdamCprenantCndetCmmertonCltDeimanCffridgeCbyBtychCudenyDbbinsCruppEckmanDiefEctlandDemchaEhlDamelCoyDutamireDrozukEdahlDpherDlleyEfiDegerDckhausenCjulianCivansonDntonEchfieldDglerDeglitzCgermaineCeuerEberEartDpterEnowskiEanianDimerDfanelliDbnerDarsEnsCaynerDubinDtzDsikDrnEmerEgelDnzioneEkovichEDmourDibDdelmanGDchuraBquadritoBprinklesFgsteadDaggCigelmyerDelerFbergCaurBovocoolDereignCundaraDliaDffrantCsCrceCnkinCdhiCbleBniffenBmouseCittleEheeCedickCallerBlowinskiDvacekDminskiCiceBkowronekDkanCanesBivertsonCnyardDkaDardCmoninGanDmionsClcottDbergCefkenCddonBhuttlesworthDbinEeckCiroEakiDpperDnaDltDklesDdelerCentonDlveyElitoEhorseCawcroftDttoDnholtzerDmonskyDllDddenBeymerDfarthCwerCtlockCrvantDratosECpuluedaCnayCmmelDansClvigDkirkEDigsonDdinCipleDersenDdlingEenstickerCckerCarsonBcordoDllardDgganDbeeCiandraEldoneChwimmerFegerEeerEanzDutzenhoferEetzeDrodtEieverFberEempFcongostEaederDonbergEltzFleEettleFnemannHDnitkerDmuhlEithDlotterbeckEeppenbachFeDickelEbiDeinFdeFbeGDaumbergErdeinEalmaCantlinGeburyBayleCusedoDrerCssoneCrracinoDicCnzDtinoEarpiaFnoGielloDghaDdvikEoralFbalEercockDantonioClviejoDsberryDoisDazerCgonDlibeneDelDalCeternDfongCdiqCboriDallosArygielBushlowCncoClliEerCffcornCessDbushCdlongDinDgersDesillErmanCckiDinskiCbnerDinsonEanoCanBoznowskiDanskiCwsonDerCunsavilleDdabushCtundoDhellDchfordCsilesDhakDettiEnkranzCrerCllysonCkoszCjekCitmanChrsCgelCeweCdrigesDockerDgersonDanEkCcqueDhholzEelCbicheauDbinsonCadyBitchotteCpplingerEetoeCngstaffEenbergDardCglerDhtmireCesenDkCdgesCchnerEbergCbackCalBhynerCeesBesseCnnoDeeDdlemanDCiszEenauerDnschmidtFEholtEardDfsnyderChfeldDaCgesterCffittCdlerDiskeCcknerEartCbollosoGarCasonoverEnerEerDnoDghBavalCttermanDiganDerCspCnesesDdolfCmilDdasDbergCjaniemiCilDdCggioDelDainCdeDakerCcioppiCbinovichAquickleCertermousDalCartucciDnderDinApynesButzelCrlClizziCgliaresBrusakDeterCotanoDppsCimackDeurCestaDisterCawlDtleyDirieBozzoCwlessCveyCttorfDeCstleyCrzioDtsEneyCnziDtorieroFEDcedeleonClimeniDhamusDeDanCetkerDllnitzCdgurskiBlottsCiegoCaugherDntenbergDirDgmannBizzitolaCttingerDcavageCschkeContekCntarDnowEeoDleyDgelDelloCmentaCllardCkerCetrasDreCcassoBhillpsBflegerCahlBezzutiCtruccelliEelloDeetCscatoreCruzziEsseDottaEnaDiniDettiElmanDcifulCppinCnnixFnoDalosaCmbleClzDtzerDphreyDoteDlumEecchiaDikanCitzCelsCbworthCaryBawlickiCvelichCsterDquarellaDkeyDeurDchelCrslowDrowFtDlowEettFrDgoDcoCprockiCnepintoEbiancoDdyEeyCmphileDintuanDerClusoDeoCkerCgettCczkowskiAozburnBvingtonCermeyerBuelletBsterlundClinCegueraCakiBrrockCmsbeeClikowskiCganistaCeganDbaughCabuenaBpenshawBntiverozCdoBmohundroBllomDivierreCivenciaCeyCazabalBkinoDBffenbergerBestmannBckerBbarBakesonAnuzumCrreBowinskiCvoselCrquistDdlieCoraniCnnemacherClderBjokuBiznikCwaCssCnnemanDerCmtzCemczykDderCcoloDhlosCblackBewyearDtownDillDcomCversonCuhartDenschwandeCstlerCnnoCjmanCifferDdlingerCgliaCedsCaringBazarianCvorCryDayanCngleCkamaCishDkCdolskiAmuscatoCrphreyDdickDchieDatallaCnnisDdwillerDceyFCllenbachDhearnDcaheyChammedCchowBountfordDdryCskoCrvayDricalEDosDmannDgenDedockDdenEarskiDavekEndiEleCoradianCntejoFgutEanDsantoDfordDcusClinasDekChdCehrleFingCdzeleskiDelDafferiCalaDkeBiyahiraCtaniCschelCngesDellaCmesCllesDbrettDanesCkolajczykDamiBeucciCtlerDhvenDgeCssmoreEerschmidtDrobianDerveyCrsealCnorEnDearClottDleyDfiCinhartCgivernDeathCesterDlerDganCdoffDlerCckleyCathDrnsBcquiggCpaddenClureCkellipsEithenCglatheryDinnesDhanCdonelCcullomDrakenFckinDonathyDloeEaughryFflinDarrenEigCaulayDffeeBazzucaCytubbyDnerDmiCttielloEhisFeesFaiDhiasonCstrogiovannEellerDhackCrucciDtoranaEinizEerFllaroDstellerDrisEaraDoniEldaEccoDitnDgoDeshEadyDchioneDbutDananEgnoCppsCnrriquezDnyEisFDginaEanelliDceraCmonClochDlozziEerCjchrzakDanoCinellaChannaCertensCdonCcumberDioceDhugaElinEidaEalaCbraAlynneCbbertBuvertCttsErullCpezCkehartCdewigCchsingerBoyalCvecchioCuissaintDghneyCttieCstrohDeCrtonDetteCpemanDaroCngsDerDdoCmberaCkietekCikoChrenzDanCftiesCcklarEabyCbiancoCaderDBlanoBiveseyCtsterDerCskeCnskyDneDdbeckCmesCcudineBeyuaCvieCttermanConelliCnzoEeDtsCitaoDfDdeckerDboldChneCganEcyCfaveCehyCdueCcountDeaCadleyBazzaraDcanoDaldeCyerCviDanchaFDCudeCtuDtyDoCrranagaCpidusDentaCngridgeEeveldFlDesDdowskiEgrenEfriedCmeDattinaCllierCirmoreChaieCgazoEnCfoeDluerEameDeversCdaCcossDhneyCbreckGheDayCaAkwasnikBuzykCtznerCshnirDekCrtzmanDianClhanekCklinskiChCenyCczynskiCbitzCangBruschkeCousDmpelCitzDmpleDeseCenzerDisCatzkeDneDgeDebelBozubDmaCuriDdelkaCtcherDasCsticDhDarCpkoEaCoyCnigsbergDarskiClmerChlmeyerCbbeBnoopDedlerDckeCippleFenbergDckrehmCeiselBlussCossnerCipfelCawiterDsenBittlesCssackCrtlandDschenmannDckofCphartCnstlerDionCltonDlmanCehlDfBettCslingDkeCrsteinCppleCneippCmpsonEelClpChmDlerDCeranDdyCbertCastDrbeyBawaguchiCupuDbleCtzenbachDeDcherCrtesDpowiczEfDenDbanCnzlerDarekCmperDanClsowDafutCeserDrcherDoDdingAjurewiczClsonBozwickCllieChniganDllCchumBewkesCstesDkaCrseyDebBaysonCurezCreckiCnsmaDosikDdrisCminChrCcotCbsAivensBtsonBsenhowerBovinoCnescuBngrumDelsCchBmrieClayBhlenfeldCdeBgouBbachAhuyettCrryCppeCltbergDlihenCgiCesoEmanBsiaoBronekBovdeCusewrightDlahanDghamDchenCstlerEerDangCrnikEesDioCnyumptewaDeymanErCmmerdingClsworthDlobaughEinsheadEandsGDecekDdorfCkesCgstonCeslyCdkinsonDgmanEensCchstedlerEhauserCbbieCareBnatBissDkeyCrschyCnostrozaDkDgCllmerEianEermanCetalaDrroCcklingEingbottomBeyeCubuschCsselschwardCrriotDnonDmidaEansCntschelDningsonEekeDkDingerCltsleyDmleEiniakEesDlnerEmuthDkeCitmeyerDrdDnleEickeEandezDmsothElichDbelCgyiDganCfelCeralallCdringtonCacoxBazlegroveDelettCymoreCvenhillCutalaCscallCrvieDtrickElingDrerDlesDgenraderCnshewDlyDklaDischDcoxCmmannDbeltonClsethDliseyEeckEasCisleyDrrDneyFrDlstockCertelAguzekCyettCsterDslerCrwitzDkaCnsolusCinaneDdenCgliottiCevinEarraDrardCdaitisCadeloupeBschwindBrupeDmbachDenesFbergCosserDmDdskiEenCizzelDttenDswaldEhaberDnageDmwoodEsDffonFiesDbbenCewDssleyDnDenstreetDalishCavettDntzEfieldEadeBowellCssomCrskyDingCodnowEfriendEemoteClobDlnickEadayDdwynEsboroFErickChringDnCettschDrtzenDlzCdinhoCansBlumacCeisnerDenCassnerDnzerDdueBjelajBivhanCrtyDoneDgentiCorgianniClpatricDlihanEetDbarCerutEhartCbertCanottiEnettoEelliDmbancoBharingBeurtsCttisEelCstCrmaniDdisDbitzCppertCnningsCmmerClvinDlertChlerCddingsCaronDchBazailleCyheartCuldDkelDdioCtoDhingCsqueCrstkaEeeDringerDofanoEDnseyDigenDciasDbeCnoungDfieldDawayCmeroCluskaDsterDlacherDinskiEmiEkDeazziDdoEamesDasEnisCglioCffCeddertCdapeeAfussnerCrukawaChsCerteEstenbergBryrearCuitsCoeseCingerDesonFenhahnElerEdeCeymuthFanDudenbergDmanDdricksenDchCaschDntumEkinEcaDgoEnoliBouquetCssenDkettCrnerDmosaEisanoDgetCoksCnsClinoBlottDorCeschDnerDmmonsCatteryDnaginDminoEandBitzeraldCndlingClsingerDlyawEingerCechterBerreDdonCldkampBazzioCviaCulconerDghnanDbelCsslerDoCrreyEareDnworthDlandCirrowDlleChertyCgnantCbulaDbriAeylicioBsteveDalaCpericuetaCcajedaBrlichBquiaBpsonBnrriquezComotoCmonCgemannBmmersonElClerCilioBlstadClweinDersonCiottDassenCchertBisenbeisElCkenberryCchholzBhmerBdrisCgersonBcheniqueBberleyBansAdziukBykhouseBworakButtCpasCntzDsheeDovantDnawayCmmermuthCersonCddyCcoteyDhonEesneauDciCbordDerryDachBrummondsCoegeCishDerCexelDschEbachDnnerDchslerBowenCtterCsreisDerCrwardDinDfCorCmeierClerEmanDbowEinCbrunzEanskyDbersteinBlouhyBiosdadoCngmannCmmerDarinoGaCllyEenburgDauraCekenCckhausCbblesEenCamanteBewildeDaardCvichDenneyDauxCttingerCsrobertsCrshemEchDitaEcksonCpinaCorioDliveiraCnzlerDtremontDobleCmsharDondDintEcheleDelClzerDvalDorbeDliDbridgeDanoyFcyEhoyaCkleCitrickDsChnertCgrateCfranceCetzDgCcosterDenaCarmentBaughetyCttCrroughCnzerDteDielovichDdurandDcauseCloDgleishCisleyCftCdlaniDdonaEioCcpanoAcyprianButilloCshCrzDvinCnaCmberCllomCdworthCbasBryslerDdermanCummeyEblyCookshanksDesCiscioneDmesCespiEciDaserCatonDmpDdleBowinDdreyCutcherCttermanCsselmanDgriffCrtnerDsiniDporanDnielFckDdtsEialCpeningColmanCnnickDliskDelliCmmonDitoCltenDlingEettaDdivarDclasureDantuonoEizziCggeshallCckmanEfieldCbournEDarrubiasBlyattConeyEchCimesCecknerDaroCaybourneDvinDridgeDffeyBiufoCsneroCpolloneCeslikDjkaCchockiDchettiCanfloneBhruscielDistesenCmielowiecCirinoDllisDhuahuaChounCevasDhabCavianoEariaDstenDrbonnetDnleyDmpouxFaDlifouxBerioCdotalCchBavettEndishCtoireCstronovoEellucciHowEanerDsoEelsEattFrDhonCrtrightDrosEisalezFgEejoDnicelliEettDliseFneDhartDenDdovaEellDchiDamCquiasCpperDizziDanoCnnedyCmpeseClvelloDlonEinsFesFcuttDixEnEffDderaroFiraCdrielDmusEanCccamiseAbuysCttermoreDayCstamenteDaCrmesterDkardDhansDgertDeDdinCllmanDinCelnaDhnerCdinCcoDkhanonBryarsCutgerDsDmittEDerDcatoCoyhillEDwnriggFieDssartDokingsDdenDcklehurstFertCistoEkeyEbaneDngleDesDarCessmanDnCanyanEdsDmsonEmellDllierBozichCyselCwthorpeDronDinCutilierDlosElionDghterCttiglieriCrrusoEowEeggineDnsDkoskiDgheseDensteinDanECotonCnvillainDiniDgDelloCllsCitnottDkeChnetFnkampDmerCesonDnekeCdeyCcchinoCbrowskiDicBluesteinCoomingdaleDggCewittDnmanDckCaszakDnkenbeckleEdoEchfieldFatoDlackDkenshipDckettBispingCrknerDckheadCngleDeauCllielCgnessCesDrerBhallaBeyerleinCwCteshCslerCrzinsDtalanDntsenEaDgoEanzaCnnisEeyDkertDjamenDincasaDgochiaDdleEanaDchoffDbrookClsitoEhawDinskyDakECigertDdlemanChenCfusCelDbeeCdonieCckstrandEerleCatoDrsBauguessEhanDerleCttisDisCstoneEilleDsettiDhorCryDtunekEolettiDroDnoEicleDlageDkusEdullDiDcellosDbarinoDanskiFickCnkertDcheroDCmbrickEergFnekClthropDmacedaDlmanDistrieriDcombDboniEiCkshiCgnerDentCdasciCcotDheCbuDioneEcDersDbsAawkwardBvitabileCersDnaCanceBusleyCkerCdasDCbutBthearnCchesonBstorinoCplundClanianCkariChmeadCbyCaiBrterburyDalejoCquetaFroCosteguiCnellCmeliCistaCenderCcaCballoBpreaCplenFgarthCfelBntonelloElinDkowiakCgisEoneDermanElilliCdujoDrickDerbergBmigonCbersCalfitanoBlvisoDezCticeDesCmarezCltonDstonDgeyerDegrettiCiagaCgoodCbergDarezEladejoBkreBitkinBhlesDbergBgnelloBdrienCinolfiCamisBbramekColtCitongAzurichDawskiCfallCbkeBizzoCppererCnnerDdaCllerEBevallosCsatiCnzenDtnerCllmannDinskyBboralBarconeCpalacCldanaCkesErChniserCcherlCbawaEnehAyumBouseDreeDnisCrtyCnceBeroDkeyCckCarganBauchCshinskiCmboAxiangAwrinnDghtsmanBortonEleyDlandColworthEfreyDdheadCltjerDfendenDdenDcheskyCjickCessnerBitwerDtersDchardCsslerDnieskiDinskiCnnikeDkowskiEelsDgenterDemanEgardnerCmpyClridgeDmontDlyEiansGmsenDhideEelmsenHiDdrickEenDandCkerCgglesworthCebuschCddowsonCantDcekBhittetGrEelockFisDleyBestropeEpfahlEinDsmanEingerDemannDbyCrtheimerCpplerCnkeDglerDderClpCitznerDssbergEenbornDpertDmanDdmannChrsigEenbergCemesEanBaynerCstonDicekDcomFCrmathDbrittonCltnerDlensteinDdochEalDaCideCdlingerDhamsAvulloBoorheisCnbargenClnerDlstedtEmanDdCgeBittorioCrtueDginiaColettCneyDciguerraDalCllataFrrvelDanovaCgorDneaultCewDlmaBeynaCssellaCrsteeghDderberCnierEceDdittiClottaCjaranoCilCcchiaGBastineDguezCrellaCnryDnahDhyningEussEoffFesenDdivortEevenderFrlipGkooiFbrinkDcottCllienEasFndinghamDiquetteDasekCheyCgottAuyematsuBrbaniCanBppBnoCionBmbachBdoAtyonCmaBwyfordCombleyDhigButterrowCrnesDkingtonDchiCnksCmeyDbagaCinstraBsukamotoCchetterBrusselDbeyCovillionDthDstelDnCinkaEeDbbeyDarsiCevorDtoCautzDgesserBoomanDlsonCnozziCmkiewiczDbDassoClinDfreeCelleBisorCryCnstmanCmmermannCllieCcknerCburcioBhunbergCrontonCompsomCeilCayneDggardBeschnerCnsleyDeryCmpestCllmanEadoDepCigenCatorDllBayagCvisCttersallCssoniCrshisCppinEeCnsleyCloneDfordCinterChaCguchiCchenyCbakAszymczykCwajaCopinskiCeByvertsenBwoggerCitcherDstDllingDerczekEchDckardDatekCezeyDpsonDezyCaringenDnaganDilesDdeBveumDnningsenDcButtieCpryCngaCmmerhillEarsClitBtysCutesmanDpakDmpoDllerDekerjuergeDckettGlEhlikDardCruttonDopEmskiEebelDehlowDauseEnoFeyEdlingCoyleDrmoDpyraDotsEpDnisDltenburgDiberDesselCitzerDenDchterCezziDwertDplerDinkrausDgemannDeplesEnburgEleyCaszakEkoDrksonDnwickEkeEiferEgelDinEBquiersBproutDingsteenDaglinFinsEberryCoelstraCisakDrkoDlleDdelCeyerDroniDnstDakCartzElinEacioDmanDinhowerBowCuersDchetCsbeeCrnDiceDboCquiCmerClonCehlCdergrenCcorroCbieBmuckerCsithColeyFnskyIiEderCethersBlusarCoweyDnskiCemmonsCatkinEesDppyDneyDgterDcumBkutnikCrzypekCibbeBjostromDquistBivretCtkoCscaCnnettDeathCmoniDarEoClvestroDlemanDkwoodDhaDfiesDberhornDacciCgristCeczkowskiGaBhureDlzDgrueCrodeCownDvlinDrtellDnkaCiyouDraishiDplettCeuDrmerEickDngDeksDdCarronDntzDkirDheedDdoanEidDckfordDbotBeungDfertCttyEersCrvisEerDresFllDpicoEasDafineCnsenigDftCmenecFDasEanClveraDlmeyerCkCgarCeverDneyDligerDhaferDbachCbbenCawardDryElEbyBcotlandDrdinoDlieriEaroChwiebertEartzeFnerDuurEpbachEmackerFEdelEbbeDroaderEamelDollmeyerEenherrFfflerFderDnurrEorrEeemanEakeFibleDmausDlotterDinkeEmmingFekEkoraDeulenErpingFmerFbEmberEllhaseEdlerDanckEffhauserGertEdlerCarolaEfoFfDntlingDffBaywardDasCxburyCvinDelDastanoEnnahCultCtreCrkarCntellanDdmeierCmpicaClvesenDtisDloumEingDceDatinoFaEmyCfeCdowskyDlierCbbatiniDatelliElEdosArydzewskiCbkaDczykBuzCsconiCprightCfinoDfaloCdigerFDaCbyorBoyeaCxberryCverCuzerDmeliotisCstonDsmannDkoDettaEneFbluthElandDascoEnoElCrabaughCmieDaroClstadDlowChrichCghairDalaCetsDnDmmichDlfsDkerDdlEelCdeheaverDdenberryCckstadDchiCbirdsDbenDasciottiEinaBizzottoEioCttleDcherCssmanDedenCpaConCntharamyDehimerDckClingCkeCetschlinDsenbergDmenschneidDlandCckenbaughIchDhesBhodyBevellsCutterCspressDnikCntonCmmelCitmeyerEanDsterDnsteinEoEkemeyerDfschneiderDersonDchleChmeierDlCgineCedsCdeCcordsDarCbeiroBaybournCwlCutioDgustDdenbushEalesCttanCshadCpuanoDoportCntanenDsbottomDerCmkissoonDbousekCioDnfordCdakovichDCbenhorstAquiversDspeDntinEoesEceDliciCattroneEesDnceDleApurswellDporaCleraDcherCckhaberBryerCuyneDitDdencioCowsDtzmanEheroDsperoHiFalCivottDtchetDemCestDllDerEDddyEaCavataDdhanBotockiCstierEemaDseDadasCrembaCpperDichakCntiCmrenkeDponiDaricoCllokDkinghornDinoCckBloughCentyCaterDgmanBipherCnzoneDkletonClletteFrsEDapilCgnoneEatelliCersolDphoCctonDkrelEetDhardDchiCatekBharoDnthanouvonBettingillGatoDrovitsDhtelDersheimCrshingDrezEaDgramDetzEgoDchesCnnelloHaEantDdryDazCllishCeksCcantyCareBaysourCvlovichDickDelkoCustianCtzerDsyDeteDadiaCszkiewiczDeDculliEascioCrrotteDlorDajonCparoEndreaConeCntaleonDningDicciaDchoDarelloClmeterDlanDardyChmeierCdgetDelAoysterCaBxborrowBvesonButwaterBttawayCakeBstermeyerCmerCinskiDeckiBroakCndoffCmsCkinCegonCdiwayBpatzBnsurezCishiBligerBkuboCoyeBhlmannBffordDnerDerdahlBesterleDchBdonnelCehDbralskiBbieCermeierEhausenDnshainEchainBatsAnuteCltyBorringtonDlinDeDdlingEhoffEerEanDalsCgalesCboaBitscheCermannDnhausDdringhausEbalskiCcolellaFaisDkleberryDewanderBewfieldCurohrDmeierCttervilleCrsesianDnDioDbyEonneCitzDghboursHrDdeckerCatDsonDdBavratilDesCstaseDirDcaCrineEmatsuDdDayananCppoCmmClboneCkonechnyCbarroAmyottButhlerCscatelloCrrielDinDdersCoioCndelDafoClchCkherjeeCffolettoCessigCckeyDherBrukBoydCwellDattCutrayDrningDCtzerCsterCrtisDgenrothEaDatayaCntrossEezumaFrrozaFmaranoFlloEbriandEavonFqueDigoldDforteClgardDeskiChsinDeadCfieldCerbeDderCchizukiBiyazakiEsakiCtalCskinDchlerCnusDniearDeroClosevicDdenhallDaCkhailCelschCddenCchonskiEniakEitschEelottiGiGfelderEandCaoBetelusCrktDandoGaCntzDeleyDakerCmoryClinoCirChaffyCehlDchCczyworBcweeneyCumberCredmondCneerDayCmikleDakenClaurineFglinEneyCkuneDinniesDagueChattieCgrapthDlothenDathCfolleyCdannellCcurtyDortDlymondsEimonEamyDaughanErtanEnEddenCburnieGettDryarCannallyDlevyFeseBaytorenaDrantDolDlandDeauxCuterCtthewsonDhiewDernFaCslowDhoreDakiCrucoDtorellEenezDryEujoEisonDounDkwayEosFffEmanDianDelloDbryEanDandaCphisCnueleDselDganelloDdrellEozaDardEgoCltbaDlickEakDineEkowskiCjureDcherCiseChlCffitEeoCduenoDlemDariagaCcvaneDklerDconnellEhiEaroneAlyngDchardBuraCnningDeauDdenCmbraEertCethCdingtonCckadoDchiniDateroCallenBozeauCwenCveraElockCuckCthianCrioEmerDgeDettoCnghenryDasCiseauChrmanCgelCftCcksEieBlerenaBivingtonCuzziCscombCppeattCouCnhardtDdelofEboCmehouseDageClloEianDburnCggonsCdsterDdyEickCchCberatoCanDBeysathCwellingCsneyDerDcanoConetteCntschDiusCmmoEingDckeCinCggetteDerskiDardCeverDteCdinCcomteEcqCakesDbBazarzCyousCwreyDeryCuzeDtzDghinghouseCtulippeDtusEanzioDerCscanoCrmerDisDcherCpriseDinDageCnoDgsethEmanElandDdstromFbergFawEramCmphierDendolaDbertyCkhaniDerCjaraCgrowDmanCdewigErmanDdenCcrueDlaireDhutEnerAkwitBvammeEButscherCshiCrganCnschDdertDCljuCkeneCdoCbinDesErskiBrystofiakCuppaDlDkowskiDegelConemeyerDckCistonCetzerDnnCalikDfftDbillBozisekCvichDermanDatchErikCtlowskiCsmalaDkyDirDaCrpiDnbluthCppenCoistraChlheppCfahlCenemanDbelCczurCbrinDashigawaEBnutesonCoffDbleCipperDerimCeisleyBlusmanCocCitzingDnkoEefelterCemetsonDinpeterCauserDtteDrenFBissamCrkhartDchmeierCnzingerDdtDcyEeyCmotoCllingworthDcullenDburyCetzmanDnleDdrowskiCdaneBhamoDliliBetterlingDchemCssenichFllCppCnonDningEadyDdziorCmppainenCllermannCirnsDlenDfferChewCelanCaweDtorDlyDdyBathmanCstlerEanesDsabCrrenDpinDauEthanasisECpsDlunDaunCnnenbergDipeDderFlDasEnCmkeCltenbachDlenbergerEamDiDeyCftonDerCblerCaihueAjupiterCndtCbileeBovanovichCjolaChnstadCdonCachinBinrightBewCssickCronimoDaldCnneClsmaCannotteEgillesBaworskyCubertCrryEetteFauDettCnosDeckaDczakClomoCgodaDlaCcquierCberAiwataBvanoffBsolaCermanCaisDacksBronBnversoCfingerBbsenAhyserClanCbargerBweeButchensonFcroftCsarCrlebausCnsleyDkerCmmingbirdDbersonClstDonChtalaCgillDghinsCffmasterCckebaBrabovskyBowdenCversonCutsDskeeperEhCstenCrrasDchlerDCpkeCokeCnieCltsoiDsombackDowayDmsteadCistionChnsteinDeiselCguetDgleDensonCffstetterElerEaDeCeflingCagueBizerCrschfieldDonakaDaldoCnoteDgstonDdDamanCllieEesheimDdermanCestandBeyserECwsDCrtlerDreroEandezCppeCnleDkensiefkenDiganDandezEganCmbergerDanClserDmichDlingerDfrickDdenbrandCinonenEeckDkesDdkampCglarCffrenCelanCdgebethCckmannEamanDhmerBazelhurstCwkenCverkampDatoneCusauerCschCrwickDtseFDrowerDleDgroderDdwayEingerEemonDbeckCntCmreDbergCllbackCistenDlstoneChlCgnerDmanDemeyerCeusslerCckwellCbyCatajaAgverreroBustovichEaveDkeDheeCrskiDnettDaCntoDselmanCglerCdmundsonDinasCarneriBrumbineDisCotzDsskopfEmanEbierCinterDlleyDegerCewalDsslerDaserCausDsmanEerDnnanEathDmerDboskiBoyneCwlerCttwaldEesmanCshayCrrDovitzDesCossensDdierEhueCnzelesEalosDnellaClombDickDembiewskiCekeCdzikCarBlosserCendenningHingCatterDsBittingsEerCsinDcombeCmlinCllitzerFckFandDbCglerCddenCbeauDbleCanunzioEnattasioBertelmanDosaEldDlandDigDeckeDbinoCnzDovesiDetClrudCitgeyDszlerChrleinBazzoCwrysCvilanesCuldenCteCrthwaiteDmoeDgisDaCnnettClligherEerFherEahanDfordDChnCcekCbertAfusterCruyaDseCjiharaChrimanBruitDehCommeEDemmingCiskneyDetasCeilerDeloveDberDarCanklFenfieldEeyEckeBoxworthyCrmellaDingerDgueEeCnnesbeckDcecaCllandCderaEBlorescaCeurentDshnerDntgeDischhackerDegerDcherCamDirEmBivecoatCrebaughCorettiCnucaneClleyCguroaEerdaCddelkeBeurtadoCtterlyCsselCmiaCildChlingCgettCddeCchterBawverCustinoDlhaberCtchettCssnachtDhawDelCrrugiaEanDnessDhartDbmanCmaClwellDvoDlingDkensteinDinCilorDginCgundoEeDnanDerstromCdenAeytchisonClesBwyBvonCerageCangelistBstrinDorgaCpondaDindolaCcherFDarsegaEndonBrvenCdingBplinBnixCgladeDdahlCckBmmetteCberyFsonBltzrothCseDayedClerbyEnsChardCfersCazeguiBisermannClertsonCbenBhrhardDesmanBgolfCnewCginsBfronCflandBduardoCminsterCgestonCeBckstromDhardDfordCholesBbsenBatherlyCstlickCrnheartDAdykhuizenCasButtweilerDkaDchCsenburyGeryCrreDnilEellDieDhanDandoCpriestCnsmoorEeithDnumDmanDlevyCmaCludeDongCignanCgarCfekCcosDhaineECbowBrowneDssDllingerDkeCiggarsCedgeCawhornDchDbekBoyneCukasCrvilDowEskiDnakDmerDianCnnelsonEaEDivanDderoCmpeClleCakesBizaCxieCvirgilioCtoreCstelDimoneDbroCpieroCngsonCluzioDlehayDbertCgiorgioCflorioCetzlerEschEerleDrolfEkerCcostanzoDesareBexheimerCwitteEngCvotiDincentisDaryCutschmanCttloffDienneCstasioEDpardDmetDlatteDfossesCriseDenzoCppnerDoloCnoyerEonDnoEeDistonEkeDesCmoyaDickFcoDetriouDangeClvaDorgeDleyDisioDhoyoDgrandeEattoDcourDairCinertCgruyEaveDeyterCfinoDfenbaughCenerCcookDantCboeDlancCatleyDrmittDleDguiarBayanCusDbermanCtzCseCryDttDochaDioEDdisCpperCnowskiDcelCmiCllmannDereDbaCkanCiseDlingChanCgnanDgsDanAczarkowskiDplinskiButtenCrticeDentonEDboyDaCllitonDberthCcchiaraCbbisonBsaszarBrytserCotzerDssgroveFerEhawDissantDccoCitzerCevelingDssyDpsDeseCaticEeDigoFenEbDcchioloDbleBoykendallCwickCvilleCuzensDtchDsensEainDnselmanDltCtterellEDhamCrsautDriereEedorDnetFliaDkumDeasDdozaDbetDathersCnwillDtreasDsuegraEtanzaDollyDedyCmpanionDinsDbeeClosiEmDmenaresDlymoreEeranDinaDawEtruglioEntroGonioCheaCgillCdnerDeDdingCckramDanougherCbineBluckeyEasCowardDkeCishamDpperDnebellDffeCendenenBisowskiCrelliDaoloCoccaCntoraCescoCbrianBhupkaDggCristmannComaCivertonDrinosDnenDmentiEaCeuvrontDslaEherEebroDrnDhebarDatumCastineDpnickEelleDmbleyBercyCliusDanoBayeaCvicchiCttellDanachEcutanCstelluccioHaniDsmeyerEettaEadaDpiDhmoreDebierDanasCrrothersEizalFveauEeteroEadineDosellaDnineDmelDloniDkhuffDdosiFDchidiDavelloEnzaFdangCpesCntrallDposDoyDnizzaroDionEdaDhamDgemiFDdleDcelliereDardCmardaClverleyDogeroDlendarDameCdretteCcheroDcavaleCbrerosHEaraDlerAbutzerDteDrickDalaCstiosDserDicDhornEerCrmasterDlDklandEinsEertDguenoEraffDenElDdonDckDbyCoyCnkCmfordClockCjnowskiCggieCffyCdineCccieroCbierBrzoskaCydgesCumlowCosseauDoksherDkkeDekerCittinDstleDanoFdCettschneideDsnanDntsonEneisEderCazleDssilEingtonDnstromEonEkerEdweinFauEaDlleyDileyDgueDdeBozziCwndsDmerCurnesEDcheyCttoDelerCrroelEaDoskiCothroydDrdCnnyDgaDatoEdonnaClejackDdmanCiserCggioDackiCerboomDhnleinEleCdahCbstCakBluemelCockmonCitchDncoeCeierCaydesDsiusBittelCrCnsfeldDdelClottiDliottDbrewChmCersnerDlatCdrowskiCcklerCasiDncaBholaCatBewickCtzenDtridgeEiDschCsleyDheroDaCrtoliDsteinDrienGEellDmelDenguerCnzerDsingDnieDedixCmoClileCilmanChuninDrmannCdientCchtCauleEdreaultDlleDgleyBayukDotDliffCugessCttistoniDrumCsinskiDgallCrtolomeiEnikElEkoEholomayFlowEgisDsnessEkiDletteDickmanDgenDdonDcliffDbuEarDakatEcaniEbanCnosDkoDiaCmbachClokEgunDlyDdiniDckEerDashCimDlorChmDarCgshawDgerlyCdieDalCckuesCbinoCAaydelottBwbreyBversanoCansinoBuyonCkampCjlaCgensteinBstacioDCplinCatoDnoBruizuCtaleCrickCneecherCmelinDbresterDacostCkellCgueDraveCeizagaDasBpoloBnzuresEaldaCtwiDillonDenorCnandChaltCgoveDlemyerEadaDianoDeloniCdayaCcrumCagnosBmmiratiCescuaDricaCbrosiusCackerEherDbileBlvizoDernazDaraCtobelliIDhauserDermanDavillaCsipCphonsoCmeydaEterDanClscheidDamanCiottaDciaDbertiCghamdiCfonzoCbistonDertaFdingCarieDnoBjaBilesBhsanCrenstorffClerBerniBcklandChorCeroDboDBbshierCruzzoDomCoodCnetCendDggCbruzzeseBabergAzyskButellCmsteinDmoChlkeCehlsdorffCchDconiBortmanChnBivCngoneEgEaleCmaCentekDgBervasDgerCnkCldinCissDdersCdikerCaBavodnyCrazuaCpponeEalaDantaCniboniDchiCmpedriCllerCkrajsekCgarCdroznyCblockiEeAyustCnkBoungkinCstenCckersDhimBerkeDenaCastBanosCmAwysingerCnerBrisleyBoznickiCrtzDsellCotersDnDlcockDdkeCnnacottClnikBittstockEingDryDfieldDcraftCssmannEinkDehartDcountCronenCpfCnterrowdDgettDdonEishGchEesCltbankDlmarthEickDerCeselerDdmaierEersteinFnheftDbergCckwareEkiserEellBhittmoreEkerEegoatEcraftDsonantEbyCetsellDdonBestryEcoatCrnimontCntlingDdlandtDclCisgarberDningerDkleDgoldElDchbrodtChrliDeCegeCareBatlandCssmannCrzechaDrixEellDnackCplesCntlandDgerDdreiEerDatCmpoleCltjenEerscheidDigoraDdingFeDczykCkinsCitmanDrDnioChpekecheDlmanCgleyDenknechtCdleDdoupsEingCckAvuonoCillemotCgteveenBosmusCrkinkDiesCndraCelzBlashiBivoCtelliDaliCscarraCrgoCnetCmontCllegaEardCgnolaCereckCdettoCcoyBessellDcoviCrrosDnierEagliaDginDdoneEierDastequiCjarBasileECrnadoreDdaroCnzantenDsumerenEchuyverDleeuwenDhoweFozerDessDdewalkerFvoordeGeerFrzwaagGweideGhydeFllenDamburgElstCllinDkDerieEntiniDcarcelDascoEdaoCcherAurquijoBnterreinerCsickerDerCrauCdercofflerBhmBffelmanBemuraCdaAtyszkoDkaCmonCceCackeBwinamButasCssingCrmelDkowskiEelDchettaCpickCmblinCkesCfteDoCeyDllCckermanBsutsumiDchiyaBryCossbachCivittDppiFenseeDmbachDlloFerDbleEeEbyCevisanDschCamonteDffDdBouseyCtaroCrregrosaEalbaDnCllyCfilDaniCbiassenBippyCogangcoCnoDnesDgstromEenDeDdolCfftEeeCetBhuesenCrustonDondsonCornsburyFesCieryElmanECeilenDdeCateDneDlackerDdenBeuscherCrracinaDellDadaCpferCnnesseeGonDantCmoresDkinCllersGiaCaqueDlerDcheyBavakoliCurasDcherCtorCrtaglinoDpyCpeCnneryDiCmsDlinDbeCllisDamanteCkayamaEkiEgiCiblCffeCdesseECbelingDagAszokeDcCalaDdyBysakClverDerBwongerCiggettCenssonDisDersEneDanyFeyCartwoutDmyDlesDbBusmanCrmanDgeonCndbladCmmersetGhaysDerallCleCgimotoCbramanianBturchDppDnkardDmppCruiksmaDopesEmyerFquistDedeDazzaEufCornioloEjohannDnumEierEecypherFbergerDllarDkkeEanDetzelEckelDcknerFingerFholmFertFdillDbbeCitzelEelyDrgusDgersCettnerFlerDrlinEbenzDmpDllutiDinmeyerFingerFauerEgerwaltEderDadyCavrouDufenbergerDssiDrinDnkusEawayDmmerDkemDinoDhlneckerDgnittaDelensDalBrsenBprottDiggDenkleGelEitzerDaqueEndelCottedDrnCivakDraDewakEthEringCerowDhDckingDaseEdCargerDnierDllBowerCuthcottCsnaCranCokramCndersClakChrDlCfrankoCderlingCchorCbonBmutzDdrickCithjDdBlosserCikerCenkerDightDgerDetCabyBkousenCillingDbinskiCeetersFEsCaneDfidasBivicDertsenFsCtraDoCracusaCnickiCmpersDleyDbeckClberbergCeverDgwarthCdmanDdonsEleCbbettCBhumardDbrooksCoughDrbDptawDltyDffstallCiverdeckerDningerDmasakiDfrinEflerCestonDrrEillEeDpeardDlquistElsEerCaveDufDrrarEpnackDnonDmsiddeenEbleyDllenbergerDdlerDbanDBferraBeysCxauerCveyEroCtlakDaCskoCrsenDratoreDdulaCnechalCldomridgeCilhamerDferDdlitzChnertCdamCbronDerEkCaversDrBcullarkCrogerCovillCiasciaErraChweersEarzeDummerEltesEchardtJDrieberEenkFifelsDowalterEultzElerEfillFfDnuererEettlerDmitkeFegeDloopEingerEessmanHerEageterDiessFferEavoniDerzerFichEchtmanEbelDarpmanEichEapCappaticciDdlockBavocchiaDiniDersEDageauCuvageDseDerweinCryDwaryDnicolaCntoneFliEaluciaFcruceDsoucieDkoffDesDdriEermanCmmartanoClmonsonEelaEansDlazDisCkumaDowskiCjdakChmCgredoCfritCdeCckeyCbioEnoFaAryboltBuzzoCthstromDaCssinFanEakDkoEinDieckiDcherCparCmbergerCllanDiffsonChlmanCgerCfenachtCelleCdisellECcciCbleeDertoEckBowettCugeCttinghausDonDhgebFaberEermichCstekDsiniDkelleyDingEDewellEbushDbergConCninCmesburgElusClleyFrsonFfsonDinsDensCisChrigEbacherDlandDenDCgnessCesDringDhrickDbkeCdregezDabaughCcksEinghamCbleeDelCadcapBizzoloCviezzoDestEronCstoDslerDenCppentropDkaCnnDguetteEeringDdoneEelsCmCefferDdmanEeDckeDbowCddlebargerBhomeDddCatiganDmeBeyersCwitzerCvaleeCtzerDtingerCschkeCquaCperCopellCnzelmanDneDkerEDickerDdinaEelCmundDmeleDiaszDaklusFCitsmaEmeierDswigEhusDningDmDdingerDckEheCgansCffettCesorDkieCdpathDdittCchtzigelFCbelCardenBaynosoCxterCtkowskiCsuloDsmussenEelDpberryDerCppleyeEeCndyErupElemanCmsonDpeyDmingDaCinierDderCdziewiczAquirarteDntyneDckelCeryCattriniDrryDkenbushDileApytelButtyCshawDchCrslowCnzoCllamCgmireCelloCBrzekopCussDiettCovowDpheteDcacciniCitzDllamanDessCetlowDstiaEhaEcodDastCaytorDshadDinoBozziCunderCttengerDashCradaCpplewellCnzoDterCmmierCllandDidoriDaskyECkCitierDssoDreDntCfahlCdolskyDellBluegerCoweDtzEnikDchCiskaCessnerCautDtzerDkeBizzinoEaCrogCquetteCphoCocheCntosDkertDetClkertonDchDarzCgnataroCermatteoCcozziDklerEetteDhlerBhilogeneCeasantCareDngBfrognerCistererBettinelliDruzziEovicEettiDermeierCstoneEerfieldDsinDchCrskyDruzzaEottEittEettiFraDoutkaEniFDetDdewDazzoCppeCnoDberthyDagosClesEchCiperDghtCffermanCddieCckenpaughCanBayenCvloskiEicaCullinCttieEesonCssonEeyFEalacquaDquiniDkelCrterEchDriottEellaEazDmelyDizoEsianCpelianDasergiCntojzFDichDchalClysDmsDloneDinskiEDevicECgelsCciorekDhoDellaCarAozbunBverwegEholserCallesButhouseDcaltBtterbeinDaBstergrenCherCbonBrzechCwickCricoCopesaCnCmesCillionBpalBnoratiCnenBmaryBlkCdingBkonskiCimotoBhlrichCayonBguinCleyBftedahlCfenCallonBeltjenBdamBckmondDimeyCeanBbermeyerEdorfCannerDlleBardCkdenAnyhanCdamBumanBoyerCtteDhsteinDestineCserCrkCldeCaBishiharaFCkolicChartCetupskiDsenDhusDceCdifferCcoulinElaysenDklowFEesonDhterEollBgyunBewshamDmannCveuxCuzilDmayerCtlandCssenDheimClliDkeCcocheaBazariCvyDorroDarezEnCtterEDerCstaCrvaizDdelliCppCkaharaCirnCggDerDanoCfzigerDfzigerCdelsonAmuzzilloCrriEeyDgiaDciaCnoDierClqueenDliniksDkinsDikChsCffleyBozellCynahanCungerCttleyDilCsemanEbyDakowskiCrtenFllDrisroeEeroDminoDlandDgerFnthalerDenElleDawskiEscaEngFdCogCntneyEeraFeEaneFgneDsDohanDnettDkhouseDcureCmphardClyneauxDlesFnkopfDetteDandChsDmandDlkeCessnerDrsCckusDcioBlinarBizzelleCttlerDriDchussonFenCstrotElerDchCrielloCnkinDingerDerichEhartDdermanFnDahanClonasDlonEhollandEesonFrberndEageDitanteEonisDhoanDdenbergerDburyCkolajczakDlosDkolaDesCgneaultCfsudCetusDszalaDlnickiCdyCchonEiokaEeauEaeliDaliBetheDalloCsslerDchCrowEneyDgenthalerDesDcyCnueyDousekDningEDghiniDdiaCmmerClotDlowEenthinEandDandCixnerDsenheimerDnekeEdersChrensDligCglioCdskerDicineDeroFiosCabonBcwrightCrightDeathDaryCquirterEerryEaryCphieCnurlenDelleyEeDairyCmanamyEhenCkowenDiverEnlayDearinCirvinDntryeChorseDaffieCgroartyDoffDivernCeniryDlhineyCdiarmidCcullarsEbbinsDrimonDoveryEmmonsDlourDarrickFeyEllenCbrienCarthyBayoneDbinCximoDamCuraisDghnCtzekDtsDinDhreEiaDeenDavaCssoEarFnetDingaleDcaroCrthalerEesDsoEhmanEalisDranoDoltFdDkinsDgulisDdirosianDchianoFakDandolaFaCnuesDtisEeDsukhaniEiDnanDicciaDgineDeryDdigoEaDcellCmoClstromDoufDenfantFaDdenadoDandruccoloEkEbananCkinoCjCisonaveDnordFEardDllardDaChmudDdiDapatraEleyEffyCgouirkDlarasDatEnECffiaCdrazoFnoDitzCckertFllarHDhtDchiaEarthyCahsAlytalCeBuzarEderCtjenCngerDanCmaCkinsChmannCersCdvigsenDlamDemannCchiniDenteCbranoDowDerEckBowingCvenCupDiseDgeCscoCrtsDmandDenzettiCngfordEdenEbrakeCkhmatovCgeCevenDserCcketDeyDatelliBitkaCstaDonbeeDenbeeDcanoCranzoCquoriCptrotConettiDCnscombDkovichDingtonDgefeltDdlerEigEallDcksDanderFCmburgErickEachCkosCghthallCfordCetzkeDbeCddicoatCckleyDhterCbelCasDpisBezoCwanCvitzDesgueErsonDanderCuthauserCtbetterCsuerDmeisterDlyCrerCppanenDinskiCotaCnherrCmbrickClonekCistenEsDnsEgangEbergerFachDkamDdigChtonenDnertDewCgierCfchikCcyDonteDherCbrechtCatherDperBawterDrenzCvyCurDderbaughFnEatoCttingDskoDiniCssereFigneDpinaDoDlieDkowitzEeDerEnbyDcolaCriosaDcadeCpeteErouseCnuzaDtingEagneDsdaleDphierDgmaidEellaDeseDdrusCmprosDensCizureDtinenDgleChmCgueuxDorioEmarsinoDascaEnaCfontDlenDavorErgeCducerDnierDesmaCcognataDklandDerteCbuffDorinDineDauveAkuzioCstererDsmanDelDchCrutzDdylaCpkaCnzlerDsmanDiDeyDcClishEgaDagaCilanChreDnkeCemmerleDkerCdlaDelkaCbinskiEckiDalBrzyzanowskiCupickaDmwiedeEmeCossDpidlowskiDkosDellCitzerDbsCeitlowEsherCaynakDssDnzlerDmbBozyraDickiCvalikFchikEcevicCtulaDrbaDelesCsowskiDkelaDibaDcinskiEhCryDabCppleEerFlmanGCnwinskiDCloskyGiDinskyHiDbeckDasaCepfCdaCchevarFrtCbsBnustDeppelCoyCieriemFCellerCappertBlitzDntworthEkenbergEckCeindienstDebDckerBjellbergBittenDsmillerCsorDielDeCrboCoCnzleDkaidDgsfordEryCmptonDelDberleyCllmonEickDgallonDcherChnCgginsCeckerBherCaleelBeziahCttellDchenCshishianCrstingEchDinsDcherCnoDefickCmphEaClsheimerDlnEenbergerCkahunaCislingDrnanDmigChnCalCBauppDfholdEfmannCtzenbergDonaCszynskiEubaDsebaumDaCrtyeEchnerDstensDpinskyDmelyDelDasekCpralDerCnelosDaheleCmpmannEeClpDlusEevigFnDiszewskiDeohanoDchthalerDamaEhikiCiliChawaiCgeyAjustissCrkowskiDgensmeyerCilfsBosueCplingCndahlCmesCiceChannessenCeckelBezewskiEkCswaldCrveyCppsenCnnigesFferEettCmmottCffsEryBaurequiCnischEckFeCcekDarusoAiwanickiBshiharaCenbergerCbisterBruegasBnzerCyartCscoreCnocentiCglishCfantolinoCdovinaCabaBmondiCdiekeCbertBllesBdaBarocciCnnucciAhuverCtleyCsserDmannCpfCntsbergerDnewellCllumCitDshChCghsonCftDstetlerCeserCdnellBovdenCusenDghtlingCthCssackDhawCrsfordDryDnbacherDdeCppenstedtDkinsonCnzaDorCmannClzmeisterDycrossDversonDtzlanderDroydDmlundDlywoodDdernessGfieldDckCjnackiChlfeldDenbergerCgansonFcampCffsesCeraufDllDfertCdumDerCckenburyCageBisserichDlipCronsCppensteelGCnkstonDdesDchcliffDCmmelCllberryDdringCesterDfnarCdesCbberdFnBeyligerEDesCviaCuCttrickCrtDshaDnandzDkelDberCnscheidDnesyDlyDeganEbryDchCmsathDmDkenDannCltzelDlriegelCjnyCinlEkeDdingerCgemanCfferanCdglinCbdonCarnenEingDpeDgyDdingsEdBazelbakerCvlickCuschildtDryCssenfritzDenbeckEltineCrtsteinEryEnellDstonDpoolDmenDdisterEeyFrsDboltEinsonDawayCqueCnsmannEerEchEberryDkelDiganDelineCmpeDonsDmerstoneGleFEargrenDeltonDbergerDasakiClprinDmanDlihanDenDdaneCilsDfleyDCgesDadornCdwinCbichtDermehlAgylesButzmanDekunstCstasonDewelleCrnseyEeeCntermanCminaClliverDbrandsonCiterezCerinoDdryCcwaCardarramaDglianoDdagnoBrulkeCooteEdyDftDenewegDchowCippeDmsteadDepentrogCeenfeldFawayDbeCaziosiDwDvinaDssieDpesDnzowEdjeanEbyDmacyDcesBozalezCyerCtchCsdenCrnyDmontCodnessEgionCnyaDnermanCmpertClishEgoskiDdmannCikeCetzeCdeauxBlennaCazaDsselEpyDnderDdyBiumarroCtelmanCsondiDmondiCrvanDtenDondaCovincoCnkelClsterCesyDrmanCddinsCardiniDninoBheaBeurinCttDsonCrreroDmondDeCntsyEaDnetteDitoEsDeDdlerCltzCissChretCgenheimerCffertCetingCbelBavetteEndaCumondDdiosoCtzkeEaDtshallDonDchelCsperiDkaDiorowskiCrritsonFgusDnierFckDdinierEenasDcyDateCndolfiCmmDelDbelCllmonEemoreEatiCinousEforthChringCffeyCeblerCdzinskiDburyCbriDeDaAfykeBurtawDnasDcronCnnDckClwoodDvioDlmoreCkumotoCestDryDnteDlBrymireCushCohlichDedgeDdgeCitzingerDckerCericksDinEdDggiaroCattoDnziEciscusDlixBowbleCtheringhamCslienDhieCrtmannDseyDknerCppianoCntanettaDohemaCglerCcklerBlutyDscheDdCorinFCenoryDhartyDeksCaxmanDshDmingBiumaraCtzmorrisCnnicumDkleyDeranCllhartDipiCjalCeldsonCckenDarraBetchCstermanDsCrrymanDnerDgasonDellCnnernCmmerCldmeierCeserDnanCderickDakCbboCazellDringBazzoneCuthDsetDroteDlkerDbionCtzingerCsickCnguyCmbroughClksChlCbioCaitaAexlerBwensBstradoDenEenCquivezCpejoCmiolCguerraCcoBrtzCspamerCnstesCismanChardCeauxCcanbrackCbesBppleBntsmingerDrikenCslowCnettCgquistDlebertEanderDesserErtEmanECersonCdBmhoffCgeCeraldBltingClnerDenbergHckerCioCfertCdenCawarBkstrandBisonDmontDenbrandtEmanDchensBhrgottBgleyCertBddlemonBconomyCkersonGleyDbergCheverryBbertsBarthmanDnhartCpenCchusAdykasBustDiCrningDingDdanCnomesDcombeCmeCllenFaDayDCffettCbsDardBrookCenthCahosDgoneBowninEhamDisDhowerDardCvalinaCstCpazoCoseCnsonDnanCminskiCllarhideDinarDeckiDbeeCegeCckusCblerDkinDiasBivollDineyCtterDmanCssingerDmangCrlamCnneenDiDgwallDeDCloretoDmoreDlamanCkemanCiorioCghtonCffleyCeudonneDtelDringerEcksDnhartDkragerDfendorfCckeDamilloCbritoDonaBezeeuwCwhurstCvinsFeyCupreeCtherageCspinoDmithDjarlaisDhnerEaDanctisCrringDousseEbertisDidderDegoDdenCprosperoFfioDpingDerroCntyDoncourtDcklauCmlerDirchyanEchielDesaEreDaggioClungEiseDmoralEastroGDligattiEeDenaDasbourErmeFgyEgrangeEfontaineCistEsDghanChoffCgraziaDmanCfossesErrestCeksCcouxDarolisCbuhrDergDarrFiCarmonEeEdurffBaywaltDerCvorenDignonEauCuteuilFriveDlCrnleyDlinDakjyCpiceCnnunzioDisonEelloCmarioClonzoDlisDeskeEnbergCizDnsEesCgneseCdyDeyAczyzewskiCaporElewskiDjkaByganiewiczButtinoDronaCssinsDanelliCperusCndyCmiskeyEnsCizonCffiaEeEariCccaroCbieBryderCusonCounseDmedyCingCeerDdeurDaBozortDineCweeDderyCventryCuserDrtwayEingtonCtmanCstlowEellCrtonDsaroDrieriFckEadiniDonDenDdDbiDadoCpusDpengerCoperwoodDntzEceCntreraDnealyDellCmtoisDpereDminsGgsDegysDaClyarDoDlisterFckEellaDerDbornChranCgbillCffenCcuzzoBlynesCosterDckCippDngingsmithCemenceCaymanDssonEDreyFnceDgueBiubalCtrinoDarellaCroneCpponeriCndrichCmoClibertoCchowskiDcarelloDalaBhuraDbbuckCronisDistliebFsCizekDttesterDquitoDmentoDldreeDaneseCevretteDeseDcoCastangDrgualafDpmonDntryDhalDfetzBezarCruantesDrilloEanoDecedesDamiCgielskiBavalleroCtinellaCssataDlinDanoEcchiaCruthDtretteEenDodineDnrikeEallDmicleDlanFcciDisEagaDdineFminoEaniDbonaraDanoCpuaDponiEellanoDoraleDelliCnuppDtrelEoneEerberryDnizzoEanDeloEerDdillEeeCmpbelDineroDbleCluyaDlicottDkCitoCffieCdenDavidCcyDhuEolaCbrejaDilesDadaCamanoAbyranConBuyckCssmanEieDhnerCrstonDnisonDkmanEhammerDesDdeshawCmpassCllingerEersDgrinCgayCffaloCdakCczynskiDkendorfDcieriCbrigBryntesonCunzEmeierEkowEettoFlliDmwellDggmanDckiEculeriCozovichDwingDtmanDdaDckerDadstreetCixDtsonDnckDmmageDghtlyDerreDdenstineCezenskiFeDvikDstDntlingerGeyDidenbachDckelEhDakerCazzleDughtonEchDttinFainDnhanEfordEerEderDlyDegelmannDbecBoytDackCwrenDlCvianCughanCttonDnerCsquesCrzeaDreDonDnhorstDgstromDellaCopCntempoDniwellEesDjourDilloDanoClekCholDatyCffaCetcherDsenDppleDhlerDdeckerDckxCdiCalBloodsworthFgoodDmeDckettCixtCanchettDckhurstFabyBjornbergBitzerDtenbenderDlerCrchallCnnickerDggeliCllettDberryCjouCglowCerlyDlbyDgelBeuCrzasDteEagnolliDrethDnhartDgumDentsonFsonDdyDcegeayCntleEivegnaEhamDscoterDnsEickDjamineDezeEttEkeDdureEixFckDauidesClmanDlusEottEefleurEasDjanDgardCithDnlichDerleChmeCeversDrmannDchingCdwardDrosianDnerDekerCchelDeraCaubrunDrdmoreDlmearBazinDerCumhoerEgarnerDknechtCttsonEiestCsultoDterDquesDistaEliereDhiCrzeyEDtusFccaEekDreroFcaDnoskiEdtDklowDibeauDetteEsEntineEillesDchDbreEeriEagelataDawEttoEnoskiDCptiseCnksonEeyEardDikCltzleyDlenDkeyDiusDderstonCkulaDalarCffutoCergaCdoniCckousDhtelErachDcariCbineEloniaCarAazbillCadBycoxCallaBvolioBusterberryCghtryCfderheideCchBttanasioChaydeCcherBstorCseltaClinDamChwoodDrafDbacherCbridgeCakuraBrzagaCriazaDezEquinDantsCmigerDenterosDbristerCkoCgumedoEijoCdolinoCciaCbizoCavjoBperBnzaldoCtuDrikinDonyFiaFettyDinoroDhonDenucciCsteadCneseCkrumCdreasonEadoDaverdeCastosDbleBmsterdamDpokerCrineDeinCorinCelCbrosiniDerBlsbrookCnuttCmasiClessioDateefCisonCdousDerinkDazBkmalCardBitonDesCnscoughCkeyBhrendsClmBguadaCansBdelmannDbisiCdessoCawayDmaitisBckisonBbudCendrothCdurDoolBamodtAzywiecBwiefelhoferCahlenBuninoCehlBmudaColekBizzaCskaCnserDkievichDgerEarelliCesmerDgenfussDbolBettlemoyerEelCrvosCnkeCmbowerClechowskiDaskoCiseCekDbBarlengaDekCidiChnowEkeDarisCchDateCbrockiDoracAyurchakCenglingBounieEgersDellCttCshinoCrksDdyCchemBericoDdonCiserCarousEickDneyBbarroBasutakeDinCnkeDishEkCmazakiEtCggiAximenezAwyzardCnderClyCkleButzkeCoriCertzDbkerBrightselBorobelDlieDfordDekColsonDdromeElyFingCntorDdraCltemathDlmerDinskiDfertCjtanikFkChlfarthCesteCbbletonBitzDtmeyerDcheyCsotzkeyDnewskiDmanCrchCppertCnebergCmpeeCluszDtseyDligFarEersEadsenDfredDdhaberEayCghamDgenCewelDtingEbrockDselFhanDrsemaDgertCdneyDmarkCcksonEingsDhernBhtieCittieElingerEfillEebreadDspellCettenDeleyGsGnCatcottBeylandCterCstrupEphalenElyFandDslerDolickDlerDcheCrryDoDneckeDkhovenCllspeakEingsDfordDanderCissgerberEheitDnsDllDgnerChrmannEleyDmeierCgeCersCaversBatringCssumEmanEilDhabaughDcherCryDthDbingtonCncaCmmackDboldtCltermanDkingtonEenhorstDinskiCkleyCggCdellAvuckovichBoogdCllerCkesCgleDelsbergCdickaBisseringDageCpondCncikCllalonaDCckermanBettelDetoCsselDpermanDcoCrtucciDsawDbaCntrisDeciaDdelaDanziCldhuizenChrsCerDBayCughenCsilopoulosDcocuCrvelDnoDlasFndDioDeschiCnwyheEeeldenDsciverDnamanDluvenEooEaninghamDkomenDhoutEamplerDgorpGdenDellaDdresarEisEeyachtFwerkerFvsenFrwallGcookGbergDbergenClkoDesquezErianoEnCchulaEaAuzeeBvaBselmanBrizarDonCbenBpthegroveBnzickerCsellCickBmscheidCinCanzorBlloCickiBhlirBddinAtytlerCmesonCgerBwisdaleCedellEdleBurreyDesEllDCpaCittCbervilleDbyBrynerCumpowerEboreDlyCoglenDffDeschCivisonnoDttoFenEleDppanyDngaliCethewayDonDnchDjosDgoningDffertCaycheffDvaliDuthEernichtDnsouEeEaBovesCstaCrpDnquistEesDchioCppingsCorDksCnksCmblinsonDalaCllinchiEesCkichChCfteCdmanDdyBitzeCmponeCllemaCerDnkenCblierBhybergCursbyErellEmCrumanCorstedEleyDmerDenCissenCeimerDeCaynDnpaengDmmavongsaDlmanBexieraEdorCverbaughCskaCrnulloCplicaDeCnoDholderDbuschErinkCmbyCjedorCitsworthDchmannChanCgtmeyerCesDmBaysCubertDaresCschlerCrtamellaDquinioDbuttonCppendorfDijaCnsilDnahillCmondongClahytewaCkashimaCeckerCboraDinDbertAszymkowskiEanowskiByversenCrettDacuseCnnottCdnesBwimmCeneyDaregeneCartzelDnstromBvedinBussCryanDreyCppliceDnetCobodaCndbyCmayaEbatClzenCkovatyDhuCgermanDalskiEiCdweeksDbeckCcharskiBtutheitDmfollDffleCruykEtzEmpfDowbridgeEthmanEjnyEhscheinEffolinoDibbleDevelEnkeEmmingEhleDattmanEnakEmEckeCoudamireDrksDppDnebreakerDltDicaDferDckhamFfischCjusteCitelerDmanDllionsFabowerDerleCerlaceEkDppsDnquistEnerDllmanDinesFbaughHcherElingEdelDffeeCavinohaEerDstnyEiukDrrickEliperGnDnifordEerEdreFeferFaferEczykDllsmithDglianoDehleEblerDdyEtmillerBquyresBpurbeckCrunkDangerCoonamoreDdenCildeCezioDrosEandioDcchioDarinCayerDllinaDdafinoBovieCtelloCrtorEinoDrowDosElaDbelloCnnerDdayCmesClowayDedadCensDllnerCderblomCbinBniezekCearyBmylyCutnickCootsDldtCitzEreskiCallenDdesBlunakerDkaCownDvickDcombCingerDfeDckerCeeterCankerBkufcaDbisCrockiCovCjeiCiltonElCarkeDlkaEakDffBixkillerCtzeDerCskoCrmanDlsCnotteEnDcockEebaughCmmomsDilienClviusDtonDlowayCkkemaCerackiDnkoDmonEerDfkerDbergFnsFCcurellaDolaDkleBhumockEiloffDffstallDemakerDartDCroffDeeveCostakDrtesErCivleyDntakuEdoDmomuraDigiCerowEburnDppsDnefieldDlvinEstadEpDildDamanCaulisDrrerEpsFesEeefDppyEeroDnorEdyDdBeyllerCvernCssomDleyCrvidioDrinDoDgeCptonEerCnnottDgstockDffDeseCmpriniDoneDbratClvaDlaDbigCinerDfDdtChrtCemannDlbinderCdlayCbertCaringDholmDcordDburgCBcungioCroggieDitchfieldEptureEmpsherDabeckCoreEcaDbeyCivallyChwulstEinnFesonEeryFppeEartzenburDurzEmmElenburgEffEerholzDryerEagerDorschEnhardtEenfelderFckFbDnitzlerFckEautzDmigEelterFichelDlunegerEosbergFbohmEenzFmbachFismanGningGffGderDinkElzEfflerEaviDeuerEmoniaFanElbDaulFfelbergeErerFdtFbachEbackerCeeCavoneDrthEfoneDleseBayneDedCvitzCtterlundEazahnDowCstreCrrDjeantDffDdellaCntoyaFniEaiDkowskiDftDdowFeEhausEeferCmpeyFriDmarcoDiaDekDayEanClvadoreDtnessDsgiverDlerDazEnoCkalECintlouisDleChotaCggeseDastumeEnCdriDakCchezCalfrankEDdehAryuCnnCleyECggCbarczykBuzichCyterCvoCpelCoppCndlettEeEallDckCkavinaCggianoCfiCefCbrightDboBowbottomCuteCtnerDmanDhweilerElisbergerCsseauGnEaDoDiekDhiaDenkransFerFcrantzJsElloCquesCokstoolCndoCmasantaEckCkusChwederCgCethlerDdigerCdwellDrigusDenbeckEferDarmelCckmanEholtEfordDhowEesCblinEezFDersCatBizzaDviDkCxieCveiroCusCtschardDrovatoCsiDheCpponCnksDgsEleyEgenbergEeisenCmandoClleyCjosCeksEenDchmanCddleyCcordDkabaughDhmeierEesinBeyoldsCxachCvereCquenaCppucciDosaCnzulliDterDaultCmondiniClicCitherDsigDfsniderEerDbsomeEertChorDmannCedusCdshawDfoxCczekDuperoDorDkardDherCarDlbutoBazerCymanDcraftDasCwleCviscioniDettoEnelleCuthDpCttliffFeyDhfonDajCsnicCppleyeaDaportCnsfordDnCmpersadDisDcharanCinhaEforthCgansEinsCfidiDfetyCduchaDskyDlerDatzCczkowskiDkCbenoldAquraishiCinerlyDetCerciaCarnstromBianApusserCppoCllanDisCgelCcciniDaBrunaCowantDvinesDnkCinkletonEdallDmasDesmeyerDdgettCeventoDtiDsserEnallEerenEasFCchalCattisEilloDskaDkBowisDderlyCstlewaitGDchCrteusEalDrazCpwellDoffDlaskiCniatoskiCllinaEeDhillDettiDaskiCkorneyDeCintdexterEsetteCBloszajCittCetzEschDmelDitezCayfordDxcoDtekDmbeckDgensDcidoBisarskiCnuelasDnetteDickDellDciaroDalClzDtzDlionDkintonDarCkulCepenburgDningDhlerDdrahitaDchockiCcknellEerFlsimerDhDarielloBhoeukCillipsonEbertCerigoDlkaBeveriniCtronisEinaEashFmaleFgliaCryDsoniusDringtonFllDpallDotDmanDagineCntlandDnycuffEingerFeEachioDhallDdexterDcilDalverClzelDterDowEDiCinadoCdleyCcueDoreDharCairsBaynesDanoCwelkCvlockEichDichDekCutlerDlikCtmoreDellaEeDalanoCssiniEeriDkellCrriganDmarDaynoCparelliCntusoEeDicoDduroDagosCmaClmoDlottaDingDaminoCkeCjtasCilthorpeChlerCgonDlinawanEeyDetCetzECdleyCclebDificDheloDerDcioneCbeyAozleyCimekCawaBwneyButramCnCilletteCdekerkCchBstroskyDermillerGannFlohFfeldCsenfortCoriaChellBrsinoDchelnCrisonCorkeCfCellanoDjuelaCdoyneBpsahlClandBnofreCagaBmahonyBlszowkaDhanCligCiffDenCexyCdridgeDfatherDerCaldeBkunDmotoCtavecCinCaBhmeClemacherCanesianBdnealCgersCerkirkCdenBcainBbradovichBakeyAnusseyCnziatoDozDnenkampDcioBovielloDacekCthstineCstrandCrthumDsenDlanderDkusDgaardDenaEdCbregaBiziolekCnnemannCevasDratkoDngDdermeyerHaierCcollsCangBewhamDcomeDbergerCvillsDensElCumillerCttiDCsslerCriaCmetClonDlonEerCisenDllyDferDdCgroCeringDhouseDfDdlerCbergallCalisBaumoffDfzingerCrumDroEamoreDaineCppsCnsteelCmisnakDannyCllieCkhleCitoCccariCbbAmyracleEChandBwakitwileBuzzyCscolinoFEenteEatFraDacchiaECrrishDfinDayCnnellyDleyDivezDdineEahlDariCllingEennexGdoreDkheyDinixDdersChlCenchowDllnerCdgetFrCckenfussDhlerBozenaCviusCuldinCtolaCsseriEaDelleCryDsellDrishDlesDieDgusonDescoDckCppinCosmanDnsCntuoriEonoFgomeryEisEerioGDsalveDgomeryEarDdelloDcivaisDardEganCltDlenhauerDdremEonadoDanoCklerCisantDlanenChrmanDamadCgerElCdineFEcDhaDenaBlynekBiyaCttigaEanDcheltreeCssDfeldtDenerCrchandaniDallesCotkeDskyCntyEeyDsDnieDceDassianErCmisClonDloyEisonDitoDfortDbradtCkulichDosDlasChelcicCgliorisiICeschCduraCcletteDheleGaDaleBezeyCwsDesCttertCskerDichDecherCrthieDsmanEereauDrithewFottFngDendaDchenEardoDatiCntzelEisEelDottiEDgleDdoliaCllickEettDicharDhornDendresDchiorreCitzlerChtaniDrtensCganCditzDeirasCckesCBcteerFCparlandCniellDealeyCmanawayCleonDayEvrinCklveenDinzeyDenEandDaleCilwraithEroyCgrealDouganDettiganDareyCfeetersCelhanyCdarisCcomisFberElmFlinsIGamEachDloryEennonDathernErtheyFsonFrelFgarEndlesEmishEllyEgeCbreartyCanenyEallenDlarneyDfertyBazzoDyDurowskiDiqueCyorasDdenCxberryCullerCtusiakDtsenEheyEersDkinsDhiasenEeDeusEDalkaCsulloDsayDhakDcroftCrtinexEensonDsigliaEellaFilleDoudasEtteDnerDloDkesDinaDetEnoEanDcinkiewiczEhelDasiganCnzuetaEanillaDternachDringDqueroDoniDneDkowskiDjarresDgenEatDdonadoEiaDciasDbeckCmrosDCltezDliaEarFEDenDaspinaEhanEgisiEchowskiCkowskyDinenDepeaceCjkowskiDidDesticErcinCiseyDnguyDlliardDgnanChlmanDaCgsamenDpusaoDnanoDleyDedanzDarelliEddinoCennerCdnickDdreyDaffariCcnaughtonDmullenDkseyEnightEiDisaacEejczykEagDhoEenryEamerDguireDdougalEanielDcormackEabeCbbottEAlynottDdonCmCdiaCcanBuyCtwinCscombeFDardiCriaCnettaDdsfordCmasCisiCevanosDckenhoffCdgateDdCcheriniCbbsBozadoCvieCurensDnsberryDghreyFaryCttonCsserDhbaughDerEkeDcalzoDCrtzCperenaCotsDsleDmanCngstaffEobardiEbottomCmayEsneyChrmannDmillerCgalboCetzDffelCdwickDrigueCckremBleraCarenaBivCttrelEmannCsserCppaDnerCnnemannDggDdemuthFenCmboClligCkinsCghtsCeuranceDsmannHDndoCckertDhliterBeyvasDrerCwyCubnerCttersCsslieDnickDmerisesCrnoCquireCperaDardCnskeDeauCmpkaDmenEDereCinhartDchnerFerDbmanChmbergCgginsCbedaCavengoodDnardBazaroffCventureDantCusterDmeaCtigoCsotaDhureDeckiDcurainCrtigueDoucheCppeDlauntFceCnumDsdellDpherDoieDkardDiadoDgowskiEhornEfieldFeldtDdtEinghamEermanEavazoCmpoEkeEerDeryDbeyDadridCllemandCisureDgoCguerDermanEmanDaresCcosseDhappelleCbsDornEnneAkyungBuziaCttDilCsCryloDowskiDigerCpchoClzerDesaFChsDneBrutzDsDpkaConbergDmkaDeseCizekDvanekDshnaDngelCeissCatofilDppDkowskyDckeBozlowCyCwaldCverDaleskiCthakotaCstenDkinenDitzkeCrffDeyDbarDCpplinDlinCosCnynDczakCmpDoClberDashEkowskiChmCgenCestnerDglerCdamaCcikDhheiserCblerDaraBnezevichDiflCapchuckDbbBlutzDgmanCosnerCingelDmeshDceCeyDppeDmkeDinmannFhansFbergDffnerDckleyCaseBistoDsickEelburgCrstenEchmanDksEnerEeyDchmanCplingCnvilleDnunenDgdomCmmeyFrleDbleyCltyEsDlmeyerEileaEayCestDrceDpertDlmanBhalidBewalCszlerDsonDichCrwoodDksiekEhoffDboDanenComuangtaiCnterDnelleyDiryDdzierskiCmpnerDmisDerlingClsayDchnerDaCithlyDpeCggCerCaheyBaywoodDesCwaharaCsuboskiDtendieckDsinDprzykCrrakerDnofskiDmanDgerFDellaDbowskiCpphahnDCnnelCmrathDinerDanskyCluaDtzDpakoffDkbrennerCkuCibCehlerCckleyCberAjustoCrisEchDgensonDezCnorDielDckerCgoCbertBowellCvanovicCsiahCostenCncasCmaChnsoDannsCdoinCckersCansBinwrightDenezCmesonBerrettDgensDdenFeCppersonCndrasCanfrancoisBazwaCussiCsterCrzombekDencioCnochaCkabCdlowiecCcobsmaDhAizaquirreBwaokaBvaskaBturbeBsraelsonCmaelClesCachsenDakBrlandBnzerilloCsognaCgegneriDalsbeCciongCagakiBdolBcenogleAhyonCettDrsBuyckCttiEenDnakCssarDkyCrrleDfordDdeCpperCnkinEeleFDCmannChtasaariCggerDelECfftCegelBrobskyCenBoylesCwlinCvsepianDengaDatterCudekCtzeCsslerEfeldEeiniCrtenEDrDgenDenCopiiDnDglandCntzDnoldCmewoodClwayDtgreweEanDstromFegeDlwayEingshedHEenbackEardDbertonCinesCgelandCfstadCetgerDnCaglundBirotaCntermeisterDnenDdersGerDcheeCmelfarbDberClzerDlingEersFgasDdingerCgnightDhmanCerholzerBeydeCttichCskethCrzfeldEerDshensonFbergDnandoDmenegildoDethErraEdaDbinDatyErdCpaCnschelDrichsenDnesFbergerDingburgEgDdronEericksCmpleEeDmingsenDlerClvieDmlyEbrechtDingFDfreyDbleDaireCizmanDsserDnyEbaughDghDdemannHDbergerCgelCerdtDgDfnerCckermanFndorfCavinDdmanBaynesworthDlockDakawaCwksleyEingCverstickCutDsenDkeDboldCttanFbaughCstenDstedtDhemDelhorstCrristDpstDoldsenDmisonDkemaEDisonEriDcusFmEourtEharikCnzelDveyDtzDscheEbergerDnigDkenDhardtDfDauerCmberlinClwardDsallEDlquistEmonDkDbachDatCjdasCinsworthDkChmCggerEarCderElDdickCckmannCaschDfAguzzettaDyCttermanDmannDkowskiCstineCrskyDnerCnsolleyCmpertDbelCllaCilmainEianiDerCersEeroFnaDbaraCadianaBrunderCothoffDslandEhDosDhsEmannDepperDdiCizzaffiDssingerDppiDndeDffeeCetherDningerDigoDgorskiEerEaDenbergerCazaDttanDsseEDnoDmbyDdillaBovinCutremoutDlasCtayCslingCreyEnDdnerCossenDnDdwaterCnzagaDyoDskaDgalvesCmillionDbosClonkaDlmanDdtrapEammerDasEbECganCffmanCeppingerCdkinDetteBloreDmbCaunerDsseyEnerBividenCuffridaCshalCovanelliCnozaDnsDdlespergerEhartCllemDgerCggeyCebnerCbbsonCacomoFloneEconeFhinoBhereEardiniIBfellerBettsCrwitzDvinDstleDfinDemiaDcakCneralFDcarelliChronEmannCffersCeryCaterBawlikCudinoCrsiaDrahanFbrantDofoloDiglianoDfinkleDelickDdockiDafolaCppaCntnerEherDgelhoffCmarraClstadDlyEikFerDimbaEDassiCigeCdsbyCbbyEinDakAfyallBurneyCnezClwiderDsonCkunagaCjikawaCgereCertesCdaBrysonCumpCothinghamDningEcilloDhlingDbergDatsCitchmanDscheDedrichsenFmannDdgeEdellECeschDntzelEoDlowDimuthEdelDehanEbyFurnDdieuEeriksenFenCazellDyserDtzkeEtiniDnzeEichEcesconJDmesFrDiserDgmanDckBoxeCwlstonCsbergCrtnaDnataroDdenCotsDdyCgtDliaDertyElsonBlygareCoweDrentineCinnerCemCattenEhEerDhavenDdBjeldBitanidesCstlerDhbaughCrschingDemanCnzelDicalDgarClosaDicettiDbyCerstEraCcklenDherBersnerDrufinoFcciDoDnsDlendaDkoDgerstromFCntyEDnimoreDdtCmatCluxDmanDdhausCisthamelDjooDertagChrmanDlCezellDnyDbackCdiganDderCchnerCaryBaysonDlorCuteuxDstiniDreDciDberCttigCrruggioEensDeDaciCntiniGDnoEingsDielCllawDkerFnhagenCjenChrnerCbelDacherAeytchesonCsterBxfordCelDBvettsDnstadCankoBurestiCberBtcittyBstlerDherCsnerDingerCplainDenshadeDanolEillatCcribanoDorciaBrringtonDettEraClangerCenrichDksonCberBntingerCsworthDellCnoDenCglinDblomEersonCciniasCamaBmelBlzieCsbreeCmoDanDClebrachtCkanCfstromCersonDazerEmCdrigeCcockBinspahrCkeCdschunDCckmanDheleFBhlkeBguchiCginkBdouardCgehillBckesBblinCbertsBavensonCrvinDdleyCgonCderAdzubakByllaCckmanBwireButrowDileCszaDtmanDingCryeeDupanDtschiHeDellCnnyEeganDkenDCmmClakCkerElowCfortDilhoDfeeCettDckCdzinskiDasikCckwallDheminCbrowDisEckiDaBrustDckmanCinnenCewettFlDitzlerDckmanCappoDffenDbantBoyenCwdingCubCrsonEchnerDringtonDneyDmaierDffDcyCngesDellyFCmangueClsDlahiteDeseDdoCileyChrmanDnDenyCcetiCbryEinskiDeyBivincenzoCschingerCrussoDoccoCpianoCopCnittoDehartCmsdaleDinichDalantaCllavouDelloCfuscoDfeyFnderferFeDeliceDabioCetzmanEemanDpenbrockDckmannCceyDampliCbariCazdeleonDlloBewitzEelCvollFDincentEerDendorfDalkCttenDragliaDhomasDerEmpleCslerDharnaisDantyCroccoDmerDksDitoEckDhammerDaneyCquattroCpassEduaConCnzelDyesFrDtinoDlingerDealCmoryEpoulosEntignyGeDezaClsolDrossoDpitEapaDouiseEneEDmundoEoreEarDlapaoleraDfinFerroDeonardisEnickDcarloFmpoHDawyerFareErocaEluzEhuntEguardiaCkeyserDayCjaegerEckomeChayEssCgraffenriedDenhartDanCeverDdrickCckelbaumDhicoDentEccoDasasCbrockDonaDeaumontDarrosEcaCarmoreDngelusDlmeidaBawoodCvneyCudtCtriCsguptaCrringEacottDiusDcusCoudCnsburyDnelsDishEelskiDehyDceyCmourDbraDanClcourCiseyChlheimerCgonCdismanCcuntoDamaraCbeAcyrulikCphertBwikBussenCrlesDitDbyEoCnasErdEnanCmptonClcasiCiCcinottaDcoBsubakBruthirdDmwellEmittEedyCouthamelDnceDmackCistinaEafiDminCestoEcenzoDmoneseDedonDditCankshawBozzensCveDalCurtwrightEcelleDplandDnihanDllardCtrellCsgraveCrnfieldEelioDishDdouaDbitCppersmithConfieldDlsCnvilleDtrellEentoDserDrodDnoleDgroveDeryDdrayClverDtmanDfleshDcordDavitoErCileCgganCenenCdlingDaCckroftFelEerillDcaCberleyCasterBloudenDsCiveDshDntEkscaleCesterCammerBityDtadinoDranoCresiCllisCccarelliCborowskiCarloEdulloBhrittonCoppDoCircoDlcoatCevarieDslakDrnakCayDtterjeeGnEagnierDstinDppuisDnningFeyDmplainDlupskyEfinDfferDdekEdertonBestoneEeroEariCrrosDmenoCntolaCdroneBayouetteCvanElieroCsuseDtriconeEorenoEenEanadaFgnolaDstevensEioFEanovaDpariDherEattDcoDassaEdCrvilleEelDtlandEegenaDseyFnDrinoFloDpinteyroDmleyDlstonFsonDieEddiEcofeDelDdyEucciDbyDangeloCpriottiFaEarioDeloCnulDtuaElowDnyDgialosiDepaDdlandCmpoloEiDorsDinoDfieldDeloDareroEehoClvanoDlumEisteDdarellaDcuttEanoCissieCgerCccamoCbotageDbleAbymanBuzbyCtkowskiCsslerDicoDhyEoviskyDbinDardElacchiCrtmanDrousEidgeEerDnoDinDgetteDdockEierDckhardCntenDgayDdageCmbyCltemaDinskiDanCkhariCganskiCerkleDnDhlDCdzynskiCckhamCbBrykDdonCuyereDnsvoldEnettEkerEfieldDmbleDeCozinaDssmanEeyDokensDersmaDdrickDckmeierFhouseCiskyDnklyEeEcefieldDghentiEanteDenoEdeDdenbaughFgroomDckettDaCeskeDnerEchleyDitkreutzFbartEsterEningEghnerEdelDhonEenyDardEnEkellEchCazillDymillerDumEDshawDnsomEdolinoEcatoEaganDffDdingDckerGnburyEherDaschBoylenDdaDantonCwlusDditchCutotEhilletteDrsiquotEjollyEetDquetDlericeDerDchillonGeCttinDeilhoCskoDackCrysDsDlaDjonDghiDahCotyEenDreCnuzDneDgersDetaDawitzEnniCmerCllenEardFDioCisseauDesDaniChorquezCghossianCespflugEerDhlDgelCdrickDkinsDensteinEllCckoverDciCbbsCalsDhnDdwayBlumaDettCoorDmkerCevensDthenDeckerCayneyDskeEettiDncasDcknerFieBjorkquistCerkBizubCsonoDgesDaillonCrrDnieDesDdtailEineCnaCllockEingerFgEetCgwoodDalkCelickiCddickCccumCaforeBhagatBezaCyahCxCvierDellCuteCtzerDthauserDhayFrdCshawCrtholfEelsDridgeDnotEathFbeiDksonEovitzEichDgstenEetDeznyDdinCougherCnthinDhaimDenatiEjanCmissCloateDlucciEsEottiEingFdoEaireFfioreCkinsDeleCishChnkenCerlyCddoCcketFCbeauCauchaineFageDdlingDcherBazarCysmoreDersCunDlchDcherCttoDonDheCsoraCruffiDtimusEholemewDrickmanFbeauEedaEackDoodyDnessEDmerDillariEasDginearEDdeDboneEatoFrinColoyCnsalDgleDducciEelCmbeckClterDlifEerEadaresDkusDdyEiviaDcerzakDazsCkshDrDemeierCiseyDnerDllyCggeCduaDiniCchtellErodtEorskiDakCbulaDleDjeckDeckiAazbellByudanBwaiBvitaDnoCellarBuzatCtmanDioDeryCsmanDlandClabaughCgleDhenbaughDeriCdiBttlesonDigDalCorBsselmeierCklandCielloCchBryaCtolaCslanianCronDezolaCnesenDauCmsterDintroutDentoDatoCkenbergCiazaCguinCensonDiasCchutEiboldCaveDndBppelmanFloBntonsonFiewiczDillEguaCninoDessElerCgustiaDryDiolilloDelicoCdreulaFenFassiDesonErDaCaniaDdioBmiconeCentaBlzagaCwardtCuaradoCtrecheDicCsobrooksCpernCmodovaDasCltopDistonEoCipioDcandroDbozekCguireCffCcaldeCbornDeryFryDanyFiFezCaviBkkermanBhlheimBgrestiCnelliCilarDbCgasBftonConsoBdilDCankDmskyBcriCcursoBbruzzeseDewCelnCdullaiFkarimDelrahmanCbenanteCatiellDlozAzyskowskiBwiefelBurmillerCpancicCnoCmstegDbrennenDayaCllingerDegerBozayaCurkosCrrillaDkoClocsikBittelCobroCmmerlyHiCllmerCgmondCererDberCdeBevenbergenCphierCmelClazoCitlinDserChringCgerCdianCarfossBbranekBayaCtarainCssoCrnDillaECppDfCnghiEeCmaconaCleskyDazarCkiCfarCdeAyuskoCrmanDkovichChaszBoungeBiuBeastedBarritoDkDboroCnnuzziDkovichDagawaCgoCffeAwyndhamCmsCandBuenschBryalsCubelBoroszColstenhulmeClpeDnerDgamotDfmanCjtaszekCeppelDhrCdarskiBizwerCttkopCssemanDorDhumDchmannFCrkkalaConCntjenEermuteHantelDksEeyDhamDdschitlCllowEitzerFerEetsFnbrinkGEaimsonDfahrtDenkinFDdeboerDchekCgrenDnallDgingtonCersonDgmanEelCdmayerDerDderCckeyFrsDalBhitonEentonFleatherDstonDrleyCethamDatlyBetenkampCstenbergerHargerEallCrblowCngelClsonEchmeyerDlmannEbrockDaCkenborgCiterDsensteinChmannCedaCdeCbleyBaverCufordCterworthDchornCssingerEellDpDiutaCrnixFngEesDmothDlingDilaDgaDburgCnzerDtDerEkClwynDleDknerDinDetzkoErEntaCinerDlesChrCddelCctorDhtlerEsmanEowskiAvulgamoreCkelichBoteCstDkampCrwerkCngphakdyClpiDleDinoCeksCdopichBittoneCrdinDagCnroeDegarDdiolaClmontDlerrealEanevaFlobasFdaDhauerDchisFesCggianiDCeuxDtsDntDlleDjoCdovichCchiBeysCverkaCrserDonesiDnoyDmontDhinesEeyenDenEbDanoCnutoDtryFoneCltzDoDazguezCeserBasseyDqueCrinDazaEdyCquezFranoCnsteenwykEchoickDroekelDnordenDlentDgrouwEelderDesElliDderkarGbeekFnburghFkieftGampDcuraEootenFneyEampenDariaClvanoDletteFroDitonEnDeriEkDdovinoEiviesoCkasCgasCdalaCccarellaDantiAurrabazoCguhartCdaCbinoDasBpmeyerBmphlettBlerioBitzBchimuraCcelloAtysdalCBweedleBurrubiatesIrtesEiDnhamDkoDbenCpinCmultyCffeyCckeyFttDholskiCbolinoDergenBsuboiCchumperlinEoepeBrynowskiDbaCuslowDogDmballDdelleCojilloCnkaCizarryDgueiroElethDcomiCesseltDntacosteEdellEaryDmlDlevenDherneDasureCayerDvinoDugottDppeyDnbargerDmontanoEellDinumFoEllDbuccoBownsellCurtillottDarCscaniCrrellaDgusonDdaCpComesCnnerCmmasinoDaroClveDefreeCguchiCfflemireDanelliCdyCceCbaccoCanDlsonBkacikBironeCppleEeryCnsonDnellCmperDmersDesDblinClottaDlbergCjerniaCggesDarCelkingBhyngConenDmleyEbsCimmeschDerCeveninDodorovIpouloCarnishEaldsonDckaberryBewariCtuDterCrsigniCpezanoCnnonEentCichmanCehanBayloeCusCtisDaDCshimaCrufelliDlowDkowskiEaDgettDanEbokijaCppenCnzerDousDigawaDejaCmmoCllericoEadaDkDhelmCkeharaDataCgliaviaCfferCdmanCcdolDconiCblesAszewczakDredyCantoBympsonDmesCersCdneyCasBwinnyDerkCendsenDigardDezeyEsyEnElyEdDazyCaugerDnsbroughEgoEdaDmpDllowsDggertyBvatekBurvantDowkaDinaCozziCnstromDfordDdsethEahlCmmerillDidaDblerDaClymaDlaDiemanCitCgiyamaCellCdoDdrethCcherBturnEkeyDdzinskiElerDckmeyerCryjewskiDoyEtmanElloEikEedeDeebyEdnyDaziEyEwdermanEitonCowerDudmireDrmontDpkaDnebackDldtEarzGskiDckmasterDbbCivasonDrkDppEesDngelDkeDebelDddCeurerDrleyGDproEovichEhsonDnsethEersonDlloDinbrookEdleyDhlinDgmaierDfanowDeseEnhuisCavelyFDutzEntonDterDsDrtupFtFinErattEgellEcevichDnkEisEdingEcliffFhfieldEbroughDkesDhmerEeliDebellDdtlanderEheimBroufeDczynskiCnskyCeavesCaderBqueoBpulerCroatDingmeyerDengelerCortDlarCivackDnaleDeglerDckermanCessardDnnerDichCazianoDracoDlterBowellsCvichCuthmaydFgateCttoDomayerCsayaCrvilloDrelCosCngcoCmersetFoCllDdanDarzanoEnaCkalCibelmanCesbeCbottaDinaDeckCardBnortonDpekDozyCethenBmithhislerCeeCaniottoBlusarskiCoweDtnickCevaDighterCappeyBkyersCuttCorczDczylasCillicornDffingtonDbickiCerlDhanCallaBiwinskiCvleyCttlohEerlyDhDCseCrokyDlesDinEgnanoDenCnsabaughDksDisiEbaldiDgsonDdlingerCmpkinDinskiDcoeCfordCegertCdorDhomDdiqueEellCcotteDhtingDariDCanoBhufflebargerCramekCortnacyDllerEetteEdersDgrenDenbergerEmateDatCinodaEesDmshakDgleyCewardDtroneElarDrrettsEodDnkleDlyEtraEpmanElabargerEiteEdrickEburnDinbeinDbbyCawleyDtrauDrtleEifiDnkerDmiEelEburgEasDllowDffstallDdowensDckletonDakBeykoraDfertCvillanoDcikCubertDCtterCslerCrvatiusDrantFmoDlDiniDenilDapionCptCnsibaughEDichDgbuschDdraDateCmrauFdDperteguiDonsDkeClmaDlingerDigaCkelCilheimerDgfriedCesholtzDfeldDcharranCdrakyanCavyDrchDmsterDboldBcyocCulleyFawlCroghamCowDpaDntrasCiulliDolaDfresChweyenFringGdtfegerFimGkertFderFbelEartzwaldeDustermanEhmannEermanEchmanDrotenboerEeursDoppertIEolsEnemanElfieldEeppnerFnleberFmanFlDnurbuschEepelEaderDlarbFppiFngenFhtDiraldiEnkelEmizziEfoEesherDeyerEttlerEppkeGerEinostFdelEetsDatzmanErwathFpEarschmidtFckCarnatoHiEingiEciaEanoBbernaBawinaDerDayaEtzkyCvcedoCuserDmierDchezEemanCthreDawaCsalaCrtorisDeDchetDaccoCntulliEoryGelliFpietroDsingEeverinoDiatanDgiacomoEesDfratelloElippoDdonaEelinEateCmonaDmisDborDanoClvittiFettiFDumDsaDonekDmDlesEDeraEmoEeDakCkiharaDasegawaEguchiCgasteguiCeturnCdanCcayananCborioDeihaEdraDaghArzepeckiCasaByserCnerCdmanCcroftCbijBuyesCttanCssonDheDertEllCnnellsDdstromCmschlagCllmanCkaCilobaChCggsCfferCestDluasDgerDdigerCbinoffDendallBozmusCxburghCwlsCuschCthoveDelliCszelDkeEamDensteelFdoComeCmboughDashEnsonFelloFceClisonCgolDasCeseDhrsDgnerEerCdrguezDemanEbaughCckenbaughDconiCbletoDateauCartyDfBivenbergDaraEliCsseDbyCppergerCopelleCngroseDebargerCleCggenDanoCffDenbarkCeperDffenbergerDdmayerCdolfiDderhoffCckonEersFlsDhouxEensCbaoBhodarmerCeingansBeznikCveronCusCphCnkoCmmeDlingerDkeDilyCitanoDssigEherDnitzEholtzEesDgstadEhDchelderferChnertDagenCdlineDigerDhouseDepenningCclaDhkemmerCandoBazaviCysonDnaCxCvelingCuserEchenbergDpachDmDenCtulowskiDterreeDeringCpinCnnelsDeDdhawaCmusDsfieldEDroopDanoCjCinaDkesCgoneseCfanielloCetzEherDsideCdwanDmanDemakerDarCckiDhlinCbenaDassaEdanCadAquossCizonDtoDntelaDmetDltyEimacoDdleyCezaireCaveDrtoEantoDndelBiuBaziApyrdumConCeattBuzinskiCtnalCnterCmpheryEerEDmellDarejoClvermacherDtzDlyEensDkrabekECdlinskiCccettiBrzygockiEbyszewskiCushaDdenteDcnalCottsmanDschDdoehlDcellCinzivalliDmesCeyDsnarEhoDntisDislerFelCatkaEcherDssBozzuoliCwandaCundstoneCttersDraDestioEmpaCstlethwaitDasCrtrumElandEillaFeCpovitchDkenCnzioDtremoliEarelliCmboDainvilleClycarpeDlartDitowskiFanoEquinDczynskiCkojCitevintDssonnierCeppelDllotDhlmanFeinCdratzCciaskBlocherCineCessingerCautzDttenDssDgemanDckoBizzolaEellaCttsenbargerEnerDstickEchDneyDanielloCstoresiCrcCnskiDeraDcockEkleyEinceClieroDatCgueCetschmanDrpointEiniCconDkingDardiBhlegmCippinCetteplaceCarelBfundtClugerCeufferDfferleBezzuloEanoCvelerCtterssonDschDruskyHaFlisEossianGkeEiniDitteFoDelaDaccioCstoEkaEaDsoaCrunDrowEiconeDosDneyDlinDigoDellaDcleCppleCnzDttilaDsieroDigarDezDdrakDasCllowskiGEinDissierEniCkrulCeveyCdrajaCcherCaselBaymentCvoliniDiolitisCulsellEinaEeCtrumEoneEieEasDeraEkDaneCstranoEoraDsowEleyEarettiFntinoDkeCrtibleDsaDnesDlimanEatoDavatiEdowskiCpaleoEgniColettaCnzarinoDnunzioDisDditCluzziDominFakiDlanesFEDinoDfreymanDazziEnzaEgiCintonEChuluCganicoCethCdloDilliaDdyEickCciollaDholskiCapDAowolabiBvershownEockerEgaardBuchiBttosonBstryeDerlandClandFCickCenCdobaCbergBrzelCtmeierCrenCmerodCioCgeronCengoCbakerBpielaCdahlBnksBltroggeCnickCivarresDdeCeksyCayaBkrayConekCinakaBjimaCalaBinonenBhottoCanBgwinCbornBflahertyCfillBetkenCrtleChlertBdemsBconnelChaCarrollBbyClakCerstEmannCasBachsAnydeggerCboBuuanuCtileCseCriddinCngesserCberBoyCvingerCuriCrthanDseworthyDrodDmingtonDiDenbergDdineCpCoriCbletBivesCstDkalaClanCkolaiCglDhtengaleCcholeCBhekBgvyenBewvilleDsamDnhamDmeyerDlanDbertCuschwanderGDnCthkenEercuttCsserDkeCmanCltonDlesCkolaCilingCeserDllyCdvedCangBavejarGCuarroCthoEeDcherCserDbyCrlockCntonCillonFCguinDeleCftzgerCegleEeleDfCckeCbrittAmynhierCartBuzquizCttyCsolinoDheroCrtaughDieDesanDdoughDaCnuzDstermannEenFlleDiseDgleDerlynDcherClrooneyDleeDaneyFaxChlhauserEesteinCglestonDgDfordCckelDerinoBtBrotekCnakBozdzierzCylerCuryDlinEdingECttaiCstynDimannDholderDburgCrrisseauDonDiceDganteDetaDcosDascoEnteCoeCntoriEminyEeforteEanteGariDseesDdierEenDcktonEeDarchGaCmpointCllemaDinEmaDenDashCherCgleDannamCelDhnCdesittCbiliaCagBiyagawaCvshekCuCttmanElemanEelsteadtIaedtDschDhellCscioneCrbahaDabelliDCnonDnitiEerlyDgroneDerviniFdDarcinCmnaughClordDnorEikDlersDkowskiCkrotDlesCglorieCentkaCdthunDdlesworthCcklosFerDhettiFlliGetDallefBeynCullionCtteDoxenCssoreEanoDarosCrtelDrittsFonFlDmisDliniDkerDidithDgelDbaumCnteDsiDningerEenDloveDkenDezesEtteDdykEocaEivelFasDascoClloyEemaEardDisDdahlDbergCirickDnelDlerFDdlCerdinkECdusEnaDovichDineEcoFiBcvaighCtierCquirkCnightCmurreyFdoDorriesDilleonEckellFhealDeelCleeseFDawsEnahanEirdCkuskerDibbensDenleyFizeFdallEllopGipEirnanCinvaleCguffeeDrueEegoryEannDoeyDlinnDillicuddyGenDeachyDarrellEnnonElliardCfarlenCeversDrleanDnnisDlvanyGineCdonalDavittCcullickDroneEeadieDounEnchieFaughyGhyGghyEmseyEggleDlimansEeodFafEaffertyDattyErryEnceEmentEghrenCbreenCardellDbierBazellCyotteDbrierCvisCutoneCtuszekDtimoeEeyFrsonFnDsushimaFbaraDroneEasDoDierDheusCssucciEoniEareDlinDhawDeDcolaEiCrzeDvrayDusakDtowskiEinyFeEabanoDshaEchelEackGDohnicDkveEisFngEenDioniEchalarDgosianDettiDdesichDcussenEhessaultEeyDaldoEfiotiCnzaneroDwillDualDocchioDkoDistaEreEkowskiDganielloDettaDdyEinoEarinoDcinelliDasseEryElangCllingEahanDiskaDetEskiDdonaldoDaterreEneyEgarieEbeCksDinsterDarCitaDoloChleyCgosEDnottiEantDlottFriCeniusCdkinDarangEganCcrinaDquarrieDpheeDnealDmahonDlellanDkeenDiverDhkovichEanDewenEraFEachernDdonellDaskillCaskeAlysaghtCnumDemaCasButtonEmanDskyDhiDfyCpoeCndriganEervilleCkanCedemanCdkeCcoreDksingerFEnerDarellCbelskiCarcaDcesBozinskiCynesCwisCvornDerdeDaszCugheryCtzerCsitoDchiavoCrsungDquetDkowskiDinoDeyEnteEmanCpazCoftCnieDgmanEhoferEanCmascoloEckClagneCkaphoneCginsDginCfredoDflerCescherDndorfCcusDkyerEheartCbendahnDassoDBizanaCvshitsCtzauDtyEeerDseyDrentaDnerCszewskiDmanDboaCquetCptokCneweaverDdenpitzFlCmeCllywhiteCfeCevanoDblongFerCdeyCbuttiDorioDengoodBeysonDlandCwczykDarkCvinerDensteinCuenbergerCszczynskiDtageDkeCrwickDayCpkowskiConorCnyardDgerDdonCmarieEnClleCisnerEeyEchnerDmerDgersDfermanDbfriedChoullierDnorttCggetDatoFhEssieErretaCftridgeCewrightCdsomeCcroneDourtDkyDhmanCbsackDoufEnCazerDvinsDdbeaterBawwillDallCvoriniDieroDertueDalaisCutenbachDsierDritaFanoEangeDneyDgheadDfenbergDdermanDbhanCtunskiElasCstrapeEiriDonDkoskiDantaCrouxDizzaEveEshCquerreCppasDilioDadulaECnziEafameDtierDskiDinghamDgonEdaleDdronEeroEauerFcreCmportEingDottEndaDmiDbiaseCiteChayeCframboiseDoneDerteCegerCdieuDaboucheCchatCbonvilleDbeeDattEnAkynastonBwaterskiBuzniarCtheDerDcharCrtinDamotoCpstasDermanCnsCllmannDigowskiCkielkaCehlerCdrnaCbieDeraDasECaliiBrysinskiDderConbergerDftDenckeCistiansenDggerDeserCetschmanDntzEkeDmersDitnerEmerCayDwchukDvsDnichDmpitzDghEerBozuchDloskiDatekEkiewiczCvalskyFcikEckCteraDCszykDtelDmickiDhyCronaEmaDbaCopmannCnstantinidiClodzikHeskiDleDkmannEerDdaCkalyCffordCepperDingDhnenCdishDaniCcurDourekCbzaDleDackBnutzenCowsDltonDblauchCispelDeperCepshieldBlyceCunkDkaCostermannEinskiCishDntEnerEdtDmkoDckerCemanDinsorgeFfelderEerCasDmanBizzeeCttoDkaCrtdollDschtCntzerDstleDningFburghEettDkerFlaarDgsEhamEfisherCmmetCllingbeckDbergCkuchiDkertCesowDnitzCdnerDaDBhuuCatakDleckBezarCytonCtelhutCsleyDhishyanCrzmanDteszDslakeEcherDnesDinDCnimerDfieldCmpeDickDCitsockDskerCeryCblishDalkaCarnyEbyBaylerCvinCuerCttanDoaCssisDhubaEanCrtmanDryDpelDoDnoppDmazynDjalaDczDastiEgiannisCpoiDankeCnzDiewskiDemotoEholaniDdtCmpferDmannDlerDalClvigDmenEarDlstromEinEbrierCkaviatosErChahaneCgelCbatEnuckCasAjurczakDasinFCnkeDghansEenDdCliussonChnkeCettBollaCkinenDelaCffeCecksCchumsenCaBeziorskiCssemanEamyCrnejcicDgensonDdonCnsrudCllinekCdreyDeleCannetteBauronCthoCrrelCnuszewskiDskiDovsekDningDikowskiDeDdresCmaicaClonenCinlettChnsenDdeCgowDielskiCffrayCecksCcquotDowayEcksAiwamiBsadoreBrmegerCieCedaleBqbalBnscoeCklebargerCgemiBmmenCigCbergCamuraBlliesCacquaBjamsBhaBdenBbrahamCeyBalongoCfrateAhyzerCacintheBuyardCxmanCtchkissFingsonCssonEmanCrmCpkaCnyadiDstadCmpertDmonsCltzEonDesCisengaChtaCgueleyDheDglerCftonDfsticklerCddelstonCbaBrivnakBoysradtCworthDenstineCvdaCuraniDglumDchCtalenCsseCrwichDvitzDoschakDnorEbrookDitaCqueCpmanCovlerDpleDkfinCneysuckerFcutErkampCmyakDaClzwartEerlandDyokeDtryEermanDohanDlinshedGgtonEensheadDeyDderbyDakCkkanenChnerCgsedDlenDenDbergCflandDiusDfisEerberEarthDackerCekmanCdorCchstetterEnadelCbbinsCaBlavatyBittnerDsonCrtzDschiCnkesFDdleyDceClseDkeDfertyDdesheimCkesCgniteDmanCemerCddenCckinbothamBewattCtzDslerCssianCrshawDraDnanderDlockerCpperCnselerDriDnickEeckeDdriksonEerlightCllstromDdermanCitlandDstandEkellEingerEermanDnritzElyFenDmerdingerEbignerDdbrederCgwerCdeenCbrankDerleinCasletDrinBazleDelbushCyzlettDreDmansDengaDdukCwardCvnerCushalterDfCtkeDchelCssardDkovecDhmiCrvestEathDtillEeauDshfieldDrigillFetDosEldsonDmesonDlDkleyDistonEngtonEanDgusEensDdinaDaldsonEjlyCpkeDemanCnzDthornDryDnenEaschFmDifanDftDdonEfordDcherEeyCmpleDmrichEerstromDbricClwickDmaDlgrenEetEadaFDikDgasDconDbrooksCkelCirfieldDnesworthCggartyDenhoffEbuschDadoneCftDlettCefeleCddowCckbartCbererCassAgwinnerCathneyDrtneyButterrezDoskiDkinDherieDchesCstusEisonEavesonCrtnerDkinCmmoClliksenDkeDdinEenCitierezDleEdfordDdiceCgertyCffyCeningsmanCdgellDerjahnCastellaDrigliaEdiaBryniukCueserDdemCowdenDssettDpperDnDdinDchCismoreDpperDnvalskyDmaDffthDessCeynoldsDshDmingerDgoriaDenwadeFliefFierCayesDvellDssmyerDppeDntlandEdinFelFboisEahanDmhamDffeoDeterDdwellEelDboEanBoyCvoniDernaleGCutyDghnourDdeDbeauxCthCslineEeeDhenDewischCrzynskiDtmanEerDdinECosDdwineErickEleyCmbertCletzDdyEthwaiteKEizenDarCistCfmanDferCergesDltzDdickeEeckeCdnickCckeCadeBneiserBluthCovierDmskiDdoEenCenisterCawsonDsierDdyszEsteinBjertsenBiudiceCttoEelmanCrvinDolamoConfriddoCngellCmbleClhousenDboyEertiCgantinoCetzenDsekingCanikasBhosnEhBeymanCvaraCtsingerCssertCrritsForDisDhauserDetyCnzoneDuarioDtlesEilleEerDettiClleDfandDabertCkasCckCarinBdovinBaydoshCwithCveCuntlettDglerDdyDbCttenDhjeCsperiniDnerDcoEhoDbarroCrvisDraDnetteDingEckDdunioEonEemalFDczynskiDantCnusDtnierDisDgloffFerDerEmDdolfoCmppCllihughEettiFnsteinEarelloFDkaDaydaErneauEponCitoCglioneCdyDsenCchupinCbouryAfuttermanCschCrutaDthDberCneDaiCessBrutcheyDmkinDhlingCommerEdahlDehnerCizzleDendsEderichCeyreDilichDgiaDdianiEericoCaterDileBosteDselmanDnaughDburgCrtisEgangDstnerEonEethDkinDisterEnashCoterCntillasEenelleDescaClkerCgersonElquistBlyeCummerCothDroEineCiesCexerDssnerCatnessDnkEdDhiveDgerBiveashCtznerEkeDcheardCshermanEbeckCppsCorinoCnsterDkenDiganDgalDerClsaimeDlingimDipponiDaCesDbelkornCduciaCalloBetherstonGolfCsmireDenmyerCrroniEissFniFckEarisDnizaEadesDdigDandezColiCnningerEeyCmiCjesChlmanCgerCdeCboDbraioCaselDgleyBayadCvaloroCuerbachDbleCshehCrrantFDoDinacciDfagliaDellDbDaceCnjoyDgmannCmulareClsettaDlowsEertDeroDdynDconiEeCitDrburnDolaDellaChlsingCggettCfinskiCdnessCbrosDertAeveridgeCaristoBustacheBtzkornCierBstabilloCquiviasFrelClavaCcheteCauBrwayCtzbischoffConCnerCmitanoHioDertCieCdleyBquihuaBnzorCsingCnsCglekingDelkesCdlichEerBmryCmsDerlingCerichBllsburyDieCizarrarasDotEpoulosCeryDkCderidgeCbaumBkinsEBisleyCldertsCkleberryCgoDhmyCchelBhlyBgloffDandCgingtonDenbergerCarDnsBftekhariCfordBedsBdvalsonCinCgmanCemannDlmannCdensBcklDerleElmanBbrahimCerthEspacherCbighausenCaughBaslyDhAdzledzicByettCbaBworaczykButtryDhieCszynskiDoDhajDettDCrmanDkinsDickCplechainCnnivanDlowDivanCmarsEineClibaDanyCkaCftDraneDfekCellmanCckingCbourgBrzewieckiCuganCozdowskiFaDnetCillingDesengaCeyfussDvsDbenCaudtDleauDgosEhiBoyerCwlinCumaCtterweichEavioCroffDnonDlandCopCnndelingerDehooDateEdoCmmerDiniciDannClioDenceDandEkCersamErerDdeCckhamCbrichDoszDinDbratzBivlioDelCtzelCsalvatoreCotteCnnenDkinCmlerDiceliDeglioDascioEreClucaDsaverDlenDiberoDeCgioiaCfedeCefenbachDdrickCckmannEesEasonDapuaFrioCbrellDleyDattistaBeyonCvotieEidDalCtlefsenCstroEicheDpositoDolaDhotelsDcombesEhepperDautelEnoCroyEssetFbyEeckEcherDganceDenCptulaDreyDolisDnerDetroCnunzioDsfordDningtonDeDderDboCmuroDoranvilleDlingDersonElisEglioDboDattiaErinisClprincipeDoriaDnoceDmedicoDlowEesEavalleFmoraDguidiceEatoDfsDcourtFlleDbertDaportillaEhozEcuevaCischDkeCgroDoniaElladoFierDirolamoDenerEleEestEareCfinaDabioCeleyCcraeneDouErteDlercqDintiDhambeauCbuttsDroDlieckEasiDemCavilaDsesDngelesDhlBaymudeCvenCtilCrosDnickDienzoDdyCponteCnnhausEemanDielleEDgerFlDesEkasDdrowCmbroseClpeDesandroCitonDnelsDghChnkeDmeDlingCgataCckAczaplickiDchorowskiButtittaDaiaCstanceCrlessDieECpelliCmensDbassFCllarsGCkajCbitoCascutBrytzerDeCuzenDserDnkletonDmmettEblissCopleyDnquistEkiteEicDmbieDckwellCnkovichCitcherDstoFalesEantiDerCetsingerDstEonDliaDccoCazeDveiroDtchDppsDnDigmilesFerGDdyEicEdiethBowelsCveneyCurcyDlbourneCtsisDroneDneyDillaCstanedaFbileDselEaDCrteDsinoDriaDnogEelyDioEnoFgtonDesselDdoneDbisieroEelliCppsCovertDpwoodDnerDkmanCnzalesDverDtrattoDradyGiDnelFelyDmyCmunaleDberDansClvertDumboEccioDpDopDliniEegeDestockEbankDasanteGccoEpietroCkeleyCiaCcuzzaCalsonCBlowesCicheCevetteFnDricoDarwaterBivielloCulloCtroCroccoCoppaClekCeszynskiDriCcerchiaCaschiDniEchettiBhudyDcCrystDistodoulouGinFleyCokshiCmelaCkouriCiodiniEDmilioDlenFkEdreyDerDcasDaroEpponeGinelliEdoChomCesterfieldGenEhierDrrezEepDneDeversDckettDaneyCaykaDwlaDsinEenDrvatEDpotonDntosFlerFDdezEDcoDbezBerritoCppetelliCntanniClsoCderbergDarCcchettiBavelDanahEgnaCtusDtonEertonDramboneDherwoodGmanDaldiCstellanaJDseyDparisDillaDhdollarDaceliCrvanaDriedoEecterEaherFbineDpinelliDouthersDnovaleDmanyDlesDettoEagaDdosaEelliDbineDathersEkerEcciCpuchinDpellettiDistranDdevilleDarrosCnuteDteDizaresDelDcliniEinoCmpusEiseEenDmaranoDilliEcDeyClwellDveyEaryDloEinanEaisDizoExtoEstoEpEbusoCiraChillaneDalaneFCfferyEarelliDarelliCdlettCcciatoriCbebeAbyusCrnsideDerConeBuzaCttrumEelDremovicDandaCstinDsenDhlenEartCrtchellDrelDnardDlettDkeenDceCoteCnyanDtrockDckCmpasClleriCglioneDgeCeterDrkDngerDhrleDcheleCdrowDdenhagenCcoloDhenauDcoEinoCbarBruzasDtschDschkeDnotEgardEdDenderDcksEheyCozowskiDwndDthernDomheadDnwDmDgDdiganDckhausFelDadawayCletichCistonEsettDnesDllonFiantDghtbillEgesDelCescianiDntsDitmeyerFhauptEdenthalDdenFmeierDckinridgeEheisenGenDazealEmCazzelDwdyDveDshersDnzEyonEtzEnamEkovichEdleEchaudFaDmleyEanteFllDkemanDdbyBozzoDelleCyarskiCwlineDeyErizeDdonElerCutrosEenDrdierEasDffordCttexFmillerDhmanDcherCshersCrrisDnemannCnusDnotDifantDgiardinaDenbergerDaseraCllierDarCkmanDanovichCissonnaultDlesChrnDlkeCgenschutzElDdaCeversGDnderDhringerEneCdorDdaDakCckerFnkampDheBlydenCutoDdworthCoxsomDmstromDiseDebaumCierCeiweissDgenDacherCaumDszEingimEengameDndaDgmanDckstadFhamEheBixelCttersCsseggerDkerDhoffDardDCrtwellDleyDkenmeierGholzFlandDdseyEoEingroundCnnerClsboroughDlotFpsEinghamCgneyDgCenkowskiEekDlefeldFcCddieCckellDhlerCboCavaDgiEasBhayaniBezCyeneDdaCvelsCttnerEinsonDsonDoCssixFreCrtschyEozziFnciniEelsonFauDrongGesEingerFganDnsenDlingeriDkenEaDgesEdorfEaraFntFminiDenDdugoEineDberianCnvenutiDishEncaseDekEdithDdasDakECltrameDsheimDottiDlrichardEevilleDilesDgradeDcastroCkiusDhitCightolChelCetzCdsonCczeDkmeyerEeyFrsFlhimerDcueCberwykDberCamesderferDcomBazzleDilCynhamDhonanDasCwanyCvaCumgardtDerkemperDdryEinoCttkoEistiEaCssanoDkasDelerDantaCrtucciEronEholdEamianDsalouDrineauFgerEenecheDkieDichDdesDbanoDalEgarCqueCntherDomeDnowskyDkeDiagaDdleyDahanEagCmbaCltzerDsterDnisDkinDiDfeDerioEntDdygaEorEingerEassanoFcciDanoffEdoEbanEamCkesCjwaCischChnsenDlsEerDamondeCgdasarianDaoisanCfiaCeseCdolatoEDderCcurinDkersDhorCbeDbitDautaCadsgaardAazzaraCebedoBvrilCelloEineButhurCsbyCricchioCnaCkermanCckermanECbleBttersonDardBsweganCteDaCsafCpenCkenCifDeduChnerCelCchenbachBrvayEnCtusDleyCrolloCoyoDnovDminCnsworthEpigerDnCmantCingtonCgubrightCentzCcoraciCbuthnotDoBquilinaFeraBptCseyCpoloniaColloCanaBntistaCshutzConCnoDalaCklamCgoldDeloneFineFettiCdrenFadisDeraElmanFCctilDhorsCackerBmpyConsCiraultECezagaDighBlyeaCtvaterDigDermattCoCmengorEClvinDoccoDegriniCimentCgeeCexanianDrCdoCberoCaridBkionaCemonBjelloBitchesonCnleyCleyBhluwaliaDfDbrechtBgundezCroCinsCgarwalBfalavaBdrianoComaitisDlphusClamCieCeyCduciDlemanCamyanBcothleyCklenDertFlyCencioCcostaBbundizCediCbassiFiBanerudCkreCgaardAzwicklBuverCraskyCmboEaCckerwarDcarelliCbrisBouchaCrnsDcBitzowEloffCrklesCppeColaCnzDsmeisterDckeCeschangDrdtDnDmkeCdekCcklerBeunerCrbaDaCngerCltmannDleDinkaDekECinerDmetDdlerCcchiniCbleyBdanowiczBbellBaroDemskiDCniDcanellaDaCmbaranoCkarCdoroznyDerCccaroAysquierdoBoxallCustDngstromEDkerCssDhinaCnkeDemuraChannesCckBerhotCngoChleBanofskyCkerCguesCchCAxueAwyrosdickCgleDandBurzerDlCnderlinHeCerthBriterDghtenDchBoznyEeyCwkCutersCrmingtonDfColemDdrichEersonCnderCmeldorfClzDtmannDstenholmeDlmuthEeDfardDdridgeCjtanowskiDnerCitowitzCehlBittenburgFlDschiDaszekEkerCszynskiDwallDsDherDenbakerCresCnskyDfoughDdlerDcklerCmesCltbergerDmDlrichEobyEimonEenborgDdaDczewskiEockCggensDboldyCeslerEDnhoffDlgusDbersGCckizerDhrowskiCbbensBhyardColeyCitseyElingumFachDrryCarryEffDckBeymanDlerCthjeCstveerEmorlandEerholdDselmanDlohCryDmersDlingerDksmanCnzingerDingerDdelnGinDckCmberCltersDlandDchmanFelCitnauerDsslerDngerDmannDgertDdertChbyEeCckDhterCavingDtherDlDgleBdowiakBaynsDcottEhoffCterfallDcherDahomigieCsowskiDnerDhkoEingEellCrtenbergDsonDrenfeltzDpDmbrodtDhurstDdsworthCnzekDtaDsingDkelDgbergDbergCmackCltzerEhersEersonDsheDrondDlschlaegerEgrenDemaDdramEhauserEeckerDbyCkinDabayashiChCgyDgnerDenaarECffleCdzinskiDemanCckerlyDhsCbleAvredenburgCanaDbleBoyerCtoCsperDbergCrheesDanECnsteinDdoloskiCltinDpicelliDlandDentineDckoCjtkoCiceCgelerBizziniDenaCxCtkoCsteDorDcoCrockCnupDionDcenzoCllasFrtaGiDelloCgneCenerDlmasEhauerDhmanCdulichDinhaDeenCckersonGBertzDryDmeeschDhulstEoffEagenFegheDgoEeerDdinoCnusDtrellaEolaEerDnesFriDdittoClzyDillaEeDandiaCckerDellioCarBavrickaCutrinCtesCssallDmadjidesCrtyDrianoGleEatoDnedoeDillasDdamanDajasCqueroCnzylDvleetGckDsoestEkiverGkeDrulerDputtenDoyEusEortDliewEewDhulleEoozierFfwegenEaitsmaDecekDdrunenEixonFvierFfordEezandeFwegeFrzandenGwerffKGschelGgiessenFnbergheFheiFeDcheriDbramerClsinDliDidoDenzanoCjdaCillencourtCcheresseCAuzdyganByetakeBsiltonBruetaCsprungDiakCquillaFdiCferCetaCbancicCaBpwallCtegroveChausCadhyayaBnterburgerCchCavailableDngstBmphenourCbenhauerBlsethCatowskiBkosataBhyrekCrmacherClichBenoClmenBdohCeBchytilAtzengByphairBwelvesDhousBuxhornCryburyDroDneEblomDkusEsDbinEesCnickCmpkinCholskiCggieCfnellCbertiniDaughBsutsuiDhaDdaCinnieBruppEianoGDnerEdleDmmDllingerDellDccoCowersDverDsienDnnesDmpeterFDlioDendleDbaughCiskaDmarcoDfilettiDdleDcocheCesvantEtElerEcaDmontEayneDinenEchlerDgliaDamerCaxsonDughDsherDpassoDntEcosoDisterElorDgeserDficanteDcBoyaCwsonCvreaCtherowDeCrtorelliDriDnabeneDigianDelloCppaDorCothillDpCnsilCmsichDmieDlisonClmichDlnerEefsrudDedanoDayoCengesDfieldCckCbiaszDeryFtDanEckBjarksBiznadoCtlowCshlerCrabassiCppetCnkeyCmsonDpermanDmisEermansFDbermanCkkanenCetzeDrmanCberiBhuringerDlDCroCornwellDmlisonGnsonEassenCimmesDlkingDermanElemannDboutotEideauCeresaDardCavichithDutBezakCtzloffDoDlowCsslerEeymanDkeyDCrzianDwillegarDvoDronezDnaskyDminiDbossDamotoCpleyCnutaDenCllioEefsonDeckyCkellCfertillerCeceCdeskoErousCbeauCarDhanBazewellElaarCvanoCtsapaughDlockDarisCssinariFeCrvisDkeyDangeloCppaCnnaDikellaCmblynDaroClyorDlasDayumptewaEskaCjCgliariniDataCflingerCddonioCcderanCblangDisulaEcasDarAszwedCumskiEigalaCollosiCczesnyBypniewskiConClvanCalBworDopesDapCireDmmerDlerDdaCeezerEpEleyDdeDarengenEdnerCartzwelderDnhartBveenCayButyakDtenDlerCskiCrpriseCpernaultCozzoCnsDderCmneyDmarellDeraClzbachDfridgeCkhramDCitorCghroueDaharaCdlowDanEkCbidoBtyleCweartCurzEdyEchioDlceDkenborgDckemeyerCsauveurCrollEhmeierDisselEmpleDemmelEczywilkDawhornEtzFosGnEssnerEmaEdaCossDrtiDmbergDlzeEikerEerEbergEarikDhltonDfkoEfletFDesserEberDddenDbierskiEbsCjohnsCirrupEmanDnehelferDmmellEitsDggerDersEffDdamCewartsDvinsonEeyDrettEDppelloEnoskiDntzelEcilFelDmpienDketeeDinbrucknerGornEgmanEberDgentDffaniDermanEnkenFhardEdmanDckleyDaleyCayrookDvnesDussDshDryEeDntEfaEdfieldFberryFageEcoEageDmpeEdiferDlworthEmaDiresEnesGDhlbergDddenDbergFlBpurgersCruceDinkelFgmanEggleCorlederEcicDntakEholzDhrCittleDryDeceDcuzzaCerlichEduteEazzaDltsDaresEkesCarhawkDnielDarBoyarsCvernsCuthamDrDphomDnDlaCssamonDhDbyCrsbyDokaDicelliDgiDberaCplopCohooCnodaDnyEebornCmodiDmeseClmanDlieEaDinaEaniDeyEckiDagesChreCenksenCdemanCbiechDeranisBnobeckCerlingDiderCazaBmolicCigelEajDechowskiDdaCerkarDbyBlothowerEemakerDdyskoCivkaDmmerDghtDfkoCayterDwskiDusonDttenDinBkultetyCripCowyraDrupaEdahlDmskyDffClenarCeldonDesickDaCagenBjostrandBixtosCvyerDersonFlingDanECtzlerDherCskindEeCronDegarDbaughDakCptakCnstackEDiscalchiDgltonDdenDagraECmponDmoneauDlerDkuletDiDeonaEnsClverstoneGnessDsbeeDlasDeoDbertCkulaCglinEeyDafusCewDtsmaDrrasDmbidaDkerDdlikCdurDellDdowayCbilleFiaDbaldBhustaEkeyDrtsCryackDollCowellDveDularsDrtinoDppCmidtCiuDrarDnnersEglesEaberyDmkoDblesCertzerErinGlDllhamerHasEdrupEadiaDhabDffDckDarmanEffCauerDtswellDskeDrickDppardDllcrossEaDkleeEespearDfeDdyEwellDcklettBeymorCttlemireEingDherCsmaDareoCryakDvenDsDbusECppiDhusCntinellaDselDfDatoCmpekDideyDaskoClzDtzDmerDittoEmCiserDkelDgleDdCgouiaDnerDersonDalaCfcikCeholzerDgertCditaDenkoDarCcondoDkingerCbaldECahornDbrightBcottyEhornDrdatoDmaDbieCipioneDaraChwietermanEendemannFdeEartzbachGczFlenDutzmanEnemannElweisFEffertEckersDrullFbbeEeyerFckhiseFaderDoonhovenFlmanElEettmerFpfFnleGeckerEbertDnyerEokeEipperEeiterFeklothEappDmitsEelzleHFisserHerEahlDlotzhauerGtFssbergEipfFckerEeuderFimerEauchGFeferDiesserFlerFdFDeuvrontFmannErzEperleEnewerkEmmEllengerDauppFfFdelFEtzbergErrEppertGEmelEllhornEefersEdtFelEckowEbowskiFesGrtFEabCavottoDrverEsellaEbroDmpoliEmonDllonFeyEeDfuriDddenDccoBawchukCvianoDerchenkoElliDarinoCtskyDoeCrwinskiDtorioGelliDriaDoDnaDkinDiskyEoDazinECpiaCntmyerFierEillanaEannaFcroceDsouciDnesDezDdvigEinoEellaDburgCmyDmerDitClvucciEeyEatoriFntFgeDtsEonEarelliEDomeDladeDettaEhiEebyDamehFaEizEfiaCkryDoDashCittaChuDaraCguilDreraDlimbenDiDgioDenCfranekDkoCeliCdarCcreDcardiCboridoDinsDetDbahCaleArynneDdersClandsCkowskiBuzbasanCweCtiagaDhledgeDeckiCsuDslerCrupCozzoDtCnelsCmpholEelEcaClloCisiDcChleCffanerDerCetzDsinkDhleDdyCdenCbulcabaCaBoyaCwaldCvnerCuselleDraDlstonDgeauxCttyDheryDertCsslerDkowinskiDiakDhDenstockEliusDcignoDaroEdaCpertoFsCokwoodCngoDdinelliEaDchettiCmrellCllingerDaCkosChwerDrscheibDlfCgalEcionCeschleyDrsDmenDlofsDkleDhrichCdriguelDgesDeenDdeyEamCcquemoreDkersDciaCbishawEdaEchauDertshawGonGaFgDCaryBizzutiDalCverosCttenourCsperCppinEColaDgasCnnerDgusEhandDehardtDdererCgottiDhettiDgiEansDazioEttiCfenburgCeuDhmDglerDchDbauCdgelDensFerDdelCcknerDhardtDciardoneBhynardDanCoderickDCeinschmidtBezakCusingCttkowskiEerathEaCshidCppeDkeCosDmeCnsenEchlerDovaElletDisonEngerDgersFlDartEClihanCisenDnigerEdelDlDerChCggioDenerCekersDgerCdmannDdingerDcayCcklingCbertCateguiDginEenDdnourBazzanoCynoldsDerDbouldCwdonCvottaEDitzDertCthertDermanElCqueCpkoCnsoneEburgDgnowDdonDciferCmotarEnesGDireEnDeresCkoskiCjalaCithelDnieEgeEbowDgozaChmingCgazzoCdomskiDishEllaDenDdeCcanoCbineElDellDascaAquiterioDnziEkEciDlliamsFerDderCennevilleDlchDeleyDarCattroDstadDglieriApyscherBustCrtleEillDdinCortoCnjaCllemDferDeioCjiaCetzDhlerDblaBtomeyBrzewozmanCysockCuterDnierDessDdomDchnikCoveauxDphitDmiseDcknowDbyDCiveCeziosiEaDmDiteEsserDglerDcellaCazmaDtsEorDkashDhmDderBozniakCxonCwledgeCugeCttCstlewaiteEhumusDnickDleyDkeyCrroDedaCppemaDatCndexterDcianoCmpilioDmerCloskyDlomFEicaEaroDizioDekDackFekCirotCertnerCduskaCckrusDhintestaBluymDharDckCinerDmlCeseDasentCayleDskyDneDckBizaniCtzDtariDruzzelloCstoriusEilliDhaDelliDcoCrosEneElliDmanDklDieCqueCntadoDkeyDgreyEerDeloClsnerDleyDgreenDesDaCgnatelloCetigDrrottGnEceallEattDntaDkosDchotaCcquetDkarDernoEnoBhyfiherCorngCearsdorfCarmesEissBfuhlCenningBezzettiCvyCtzoldtDtreyEasFDrossFchelloEielloEelliDchCstoniEanoDickDaventoCrzanowskiDrienEenoudDqueDoffDlasDkersonDishoEchDfectDegrinoFoyDchCquenoCnzaDsisDquiteDistonGerDdolaEergraphClleDczarEhDaChlerCgodaCelleEingCdroniDlarDderCcorainoDkmanDhalCbsworthCasnallEantDdDcemakerBaytesDsenDnCvleticEatFsDeseCupDlisCtriceDockaDCstorinoDcocelloCrthemerDreiraDidoDettiDdunDchmentCpsteinDpsDettiDakostasCntoniDikDfilovGDaCmpuschEerinClmitessaEeroDlettDillaDeseFanoDangeCgenkopfCdonDmanabhanDinhaCckenDittoDchianaCbichAozaByabuBverdorfBuradaBtukoloCterbineDalaganoCoCherCanoBstingEguyDerholtCleyCcarsonCaileBrtzDolanoDeaEDagaCszulakDerCihuelaCejelCdoricaDingDalCbinCanskyBppelBnsgardCdrickBlsinClmannCivesCavarriaDnoDfsonBkunoEiewskiDharaCrentConiewskiCekeBhsCotnickyCnoClundDendorfCaireBgazDndoBffieldBdiorneBclairCkenfelsChockiCambDllahanBbletonCerlyEhelmanEbeckAnylinCdickBwachukwuButzmannCqueCnzClleCfferBottiDhumEnagelDahCssettDeDbischCrrixDlienDkinDdonEmeyerDatCoeCklebyCfzigerCensBivisonCuCttlerCssalkeDhikawaCnnessDCmonCfongCewieroskiDtzerDmelaCcoletteIaEDkolasElessFawDcoliCbbsBeylandCwmarkDeyDbauerCvwirthDermanCuserDmaierDfvilleCtzleyEelDtleCiswongerFenderDlanDdhardtCesmithCbgenBaviaCteCsutiDsoEimiDheDesCroDdoDasimhanCqviCnkaCmanChrstedtCguraDarajanCdileCboursDersAmysingerCnearBuzzarelliCthigCstianDkusEellyDiDhtaqDcaCrzynskiGDrilloDelloDdyDakawaCnsingerDnellDksEbergDdorfCmmeyCllickDkinDhollenDgrewDderigDacCehlCddimanCckermanFnthalerDhDcioloBruczekCazekBowatCureDldCttsCsureDsorEbergDlerDhaDcripEhettiDbargerCruaDssDronEallDoniDiokaEccaDgensenEansonDesheadElyDchDasErEnvilleElasEkEdelCothartDnenCnzingoDtpetitEjoyEeagudoDozDgrainEonDdejarDasEchinoCmplaisirDinDentClpusDonyDnerDledaDinskiFelliDfettaDendaDchanChseniCggCerkeDniusDhlmanCdugnoDiDestErCchCatBiyamuraCttlestadtEelstedtGmanDschelenDroDchanCstyDseyDenhimerCrraDjahDanteCosekCnteerDrodDningEeyFmaDiumEhaneEcucciDecciDcheyClotaDlsonEowayFnziEierEeyEamDilloDbrathCkowskiElaDlerChelicDailaCesenDrzejewskiCckelsDhienziEalkeCazgaBezydloDickCynardDlorCxicanoCtskerDrickDerCstadDkeCrtinsEaDsingerEchmanDnaDilaEdiethDgenDelCnzellaFDtnechDsonEickDnigDdilloCmosClroyDochickDlsEgrenDineEchDenaDchioriGngDahnCislerDnerdingDlleurDdlingerChnerCgrabyanDeeCeuwsenCdlarDickDemaCchlerEanicCadowcroftBcpikeDeakeCnellEaryCmutryDeekinDannusCluenDouthDerranEoudDaganCkoneDneelyDissicEnnellEllipsEbbonDentyFnanEemanDassonCinturfEernyChanCgurnEirlEeDrainDonnellDlumphyEauflinDinityEbboneyDeoughDauleyErvieCfatterCentegartEroeDlmuryEhinnyCdonnelFielEeDermondEarmonHanDayEnnaldEidCcurrenDroskyEaneFigDooeyFElpinFlochDlucasEesterFmentEamrochGmyFllenDarteEieEddonCanellyDlmondEaryBazziniEarinoGaFntiDurkDorCyerleEnscheinDardEnsCxedonCvromatisDinsDesCusserDlsbyCtyaDukeDtoElerEiaceDkowskiDhernDeroDchetteDayoshiErCstineDsingFmoEeriaFnbergEardDoudEttiDlakDeyEllaDcarenaFllCrzellaDyottDwickDuggDttEinisFanEhaDstallerEingillFcekDottoDketFgardFDinellaEenDgisonEheimEasonFrisGetDettEntesDcottFnEhenaEellinoCpstonCntioneEanonaDsouriDoiDkusEinsDinEkasDgieriDfrediniDeDdtEoliniEleyDcinaDasCltsbergerEaisDminDlisFcoatEeckEachDkowskiEaniDitoDensekDandraGerCkosDananiCilleEDdensEChowaldDalaEjanCgnottaDgioreDelCestosDrzDdcheCdiseEDesDdaloniDayagErasCcnairDkinlayEesyDhonEiaEeyFskyEacekDeyakDchioDbrideCbrayCaschAlyseskiCkkenBuzaniaCxenbergCtrellCpkesDinoDardusCnnonDghoferDdvallEbyForgClowCkmanDinDaszewskiEcsCgonesDerCederCdekeCcekDchettiGseBozowskiDaroCyerCwthertDdermilkCvitzEnggoodDenduskiCuraDngEderDksDghryDdermillCttaCstetterDkotDiewskiCrmanDenElliDangeCnsingerDginottiEhurstCmedicoClaChwasserDnDdenCgrassoDieCftmanEenDasoCewerDhrsCcyDonteDkermanGbyFnCbatonCatmanBlerasBizakCvingoodCtwilerDvinDtledaveDesCseeCpszycDpyConelloCnsdayDnearDklaterDgbeckDdieEenfelserGbergerDarezCmberClyCghtningCffickCetoDstmanDpinsDngDbrossCcciardiDavoliCbbeeBhuillierCommedieuBeyraCwmanCvreaultDitreEngsEckDeckeDangerElECutholdDenthalCtzeDterloughCskiCrwillDtoraCpplaCopoldoDnidesEardisCnoueEchDgerichCmontDmertDeryDaitreCllaCkoCithauserDsherEeEchDendeckerDberDalohaChtomakiDighCggsDateCflarDeberCezerCddenCcleirDhliterCbraneDarronCasonDpheartDdmanBazarteCwinCvoleDesqueErdureCutnerEhernDrilaEendeauDndervilleDmeyerCtinaCszloDsanCrzelereEazsDubbioDriuzDewEmontEdoDdizabalDanceCppaDollaDatraEgliaCntieriDnanEDgwithEolfElossGEholzFartEfittEendorfGbachEbehnDehartDdoniEherrEbergEazuriDceyCmusEnyonDpittFasiDmonEeDirandDbesDartaFraClimDandeCkyCitilaDdlerDchChueDtinenCgrasseFndDleDerstromFbergCferneyCcsonDhenauerCblueDeanDAkuzaraECyCtcheraCstraCrtykaDschnerDkaCnstlingerDkaDickiDdaCllingEaDbidaCkerCjathElaChtaDnerDleCfalkCennenECdleyCcharikDaCbicBrystEhCumenauerDczekCoschelDnkDellsCivakDstoffFinCeuzigerDitzEsbergEmanEghbaumDhDckCaszewskiEonDmmesDkeBozuskoDolaDikowskiEelskiCwisDalskeCttmanElerEenstetteCstelnickDmowskiDkaDinarEkDanovicFkeCrtgeDsakDnbauDdasDbyEelCppermanFnhaverDischkeDerElmanFDasCoserDrsEDneDgleCnzenDieczkaDdrackiEosCmatsuCloDarikEckiCkeshChrtEsCgelCfronDmanCewlerDttingDsDllnerFmannCczelaDonBnothDllmanDebelCknownCittleDphferDghtlyDffinCaphusDakBlothDnoskiDkeDerCinetobDgerDchCeymanDpchickDmishDenDbeCakowiczDftBithcartCsterDkerDhelEbaughCrtDouacDleyDklenEegaardDchenCpkaDferCnsingerDiryEkiniDgmaDderknechtDahanCmmesDakCllianyEeleaDkusDfoyleCflezghieDferCesewetterDnowDlerDblerCcksEerCbelEDbeeCangBhounthavongCatriDmsyuorauonEBeyeCupCtoDchCssCrthDoDnellDkvlietComanyGivongCnnemurFlEdeyDdiCmpterEinskiDnaCllanDiikoaDedjianCithanDselDbChsCdleyCayDrinBawulokDaiEaCvaCunistoDmoDahiCttnerDraCstelFinDsulkeEmanEingDhaniDchCrtyDstetterDrenbergDperDowDmoDhoffDdellEasDapetianCpperFnDichokCnisDeakuaDarisCmudaDirezDatCloudisDlbergEaherDkwarfEmanEDisekDehuaweheDchikDbfleischEererDalECkimotoCingDgleChillDanaoiCemmerlingCdriDleDingEDarCchmarEiroubasEelmeyerCaseAjuveCulCstingerCngwirthEmanEckClanderCenemannCbieBounCswickDsundECryCnnsonDgsmaClietChngrassCcoyBingCmerezDboBeudyCrowskiDnstromGadEbergCoffroyCntryDnieDgDayeCmersonCltemaCanpaulEmardBaxCveryCudonCsperseDmerCrredEarDgasDdotEellCquayCppaCnowerDkoskiDiseDdreyElCkubiakDobsonGenChnckeCgersCcobitzDkonAizardBvelBtzkowitzCaniBssacsComeCleDarCidroEoroCchBrvanCizaryCeneBpsonCBoeleBnterianoCsalacoCiestraCgargiolaBmpsonBllianoDerDaCardiBidaBhrkeBgneriCbalCartuaBfflandBdellBberraCaBanaconeAhysongCrkasBuzzardCttleCsselbeeFiniCpeCnzekerDnicutCmpreyDbirdDasonCgleCfanaCestisEingDllCdyDleyDasEllaEckCckfeldtCbkaDenthalCanteBsingBromekCitzCdlickaBowzellDlesDatCvarterCuyDslerEkaEealDlbergCstertDmanDcheidCrversDtinDnishEbeakEadayCppmanDferCotCntsDsbergerEDnenDbergerDahnieCmmaDesleyClyoakDwegerDubarDtzerEropEbergDppDmquestDlingheadDjeDgersonDabaughCittCffordEmasterEineEeltCesDllwarthDghEerlGCdrickDgkissDekCckeyCbdayBlavacekDdBitzemanFlDsmanCssongEamDcockCrzDshbergCpkinsCnschDkenDckleEhliffCmmonsEelwrightGspachDebaughClstDmesDlsgroveEestadGlandFgassDfigerDadoCghshawEersDginbothanDbieCeronymusCdyCckoryEernellCbmaDbetsBeximerCwgleyCutmakerDschkelDpelDmannGCtzerDhermanCstermanDpeCrtweckDsonDryEboldtDmsEosillaDlDbolsheimerEelDaCptinstallDplerEellCnslinEchenDningtonEagirDkhausEenDggelerCmpflingDmerlingDishDaClvestonDseyEcherDoDineDfinDderCitnerDpleDnzelmanEricherEesDmsnessDlerDdelburgDbergCgnerDlerCffermanFlbowerCebnerCdigerDdingCckbertCarnsbergerDivilinDgleDfnerBazelrigCythDozDduDbargerDaCversFfieldCuzeDgabrookDbCthcoatCsychakDsinEeyDenbergEkCrvatDutaDtvigsenEongEkeDreEadonDnischDmondEeningDlemDkraderElerodeDgittDdonEgraveEesterDbesonFnCnrathDdvilleEcockCmzaDsonDmingDicDbleyClphenEainDmesDlawayFuerDfDdimanDburCkkilaDimianCimesChsCgmannDglundDertEeCfemanCeberCddanDaCcknerEelDherCbischCarstadEeDkerAgygerBuzowskiDiDalakCyonDllCtzmerDtirezEDierrexIDCstisDhwaCrkeDevichCnyanCmzCisbertDreDntanillaDmaraesDllereaultDdosEeraCffinCererroDnthnerDdesCarenoEdianBrussingEkaDdzienCowcockDssenbacherEjeanEhansDndahlDllimundDeneveldGndykCinnanEdellHandDmaudDgorovDffardDersonDchDbbinsHCeverDtterDnnonEfellDmerDisingDenhowardCavitzFsFnoDubardDtesDnstromEnellEdtEatDmblingEajoDlakDiseDfeDdeEDcyBoycoDalCvindeisamiDertFoCurasDlbourneEarteDkerCtwaltDtshallFchCrumDdoEilsDbetConanDmbiDleyFsbyDdletFandCmazCltDombekFEjuchDightleyDdynEkampEfineEermannCffinetCetterEhalsDrdtDhlDdkenEeEdeDckelCdshallDleskiDinoFeDdenDarCckleyEelDhnourCblerCardBniewekCerreBluszekDntCotzbachDryCistaEanCendeDeDaveCausEDssingDdhillBizzoCulianCttinsCrvenDtDlingDardotCppCovanniniDnetCnsDolfiCmarClvinDliomFngEeceDioDdowDbergCeserDrischDlowDckCcaCbboneyCarraputoDnopoulosEnecchiniDmbrunoBhristCiloniBevingCttoCssfordDnerDickCrstenkornEbachDogeDlemanEDkinDdingDchakCorgiadesDffroyCntesDreDousDgeDeyDdusaEelCmmaDblerDaehlichCldmacherChrisCffrardEkenCansBavelDaldonCughranDdDcinEhCttusoDliffDherCstonguayDsenDiorCrziaDtzEleyDskiDramoneDonerGDnowDleyDibaiDguiloDfunkelDdleyEeckiDcilazoDbariniDanEfaloCniDdertCmpongDonsDmaDboneElerClvesDoDmDluccioEinariEentineEamoreDeottiEllaCjicaCisfordDettoChlmanECgliaCffkeCetzCdwahCbareeCarAfustCrutaniDnerEaceDgisonEesonCndisCllemEagarCjisawaCgitDhCemmelerDllingCdeBrusciCoschDnteraEekCitzmanDstoeEhkornDllingDggeDelsEheEdlineDdlingtonCezzoFaDstaDiseEmanEdhofEbergerDetageFEmyerDdinEenbergCayneDughtonDnzelEkieFensteinHbergEcherGFesconiFDizeDgminDbottBoxmanCutyDrnetDlcardDhyDgereCtopoulosCrsmarkDnellDmDlineDgusonCntusEanellaClknerCkCggieDelmanBlumerfeltDeggeFelDckCoeDccoCitschDrtDndersCetchenDchsigDbbeCathersEauDmerDhartyDdgerBittenDchpatrickCssoriEelDchlerCorittoFEentiniFllaCnnemoreDkelsonDgletonEerhutDazzoClmerDlipFnghamDipekDanCgurskiEeronFirasDleyCedorCckerEasBevigCutzCtnerCrtalDraioloDnslerEetEattDgusenEDacoCnnyDglerClstedDlnerEinEenzDknerEelDiuDeppaDdermanFCigelDckertDbuschCdorekFaDergreenDalenCckCbreCarnowDglerBavoritoDilleDaloraCulsDdreeCsuloDsinoCrsonDlinDetraEnbaughEllaDaoneEgozaCnucchiDtroyDnyDgmanCmigliettiCltusEinEDleyEdorfDickDaChrneyCggsCfardCesCdelyFCcchineCbionarAezaguiBvoyCilsizerDckCersollFmanEleyDloBuvrardCnBtkinChenBstrelaDebDainEcionCquerraCpostoDertCkraDinDenaziChomDenbrennerCeraCcobioDhiefEenbrennerBrschenClewineCdnerCckDegCbachBpolitoChriamBnwrightDallCtrikinEessDlerCstadCgwallDroffDlemannDelsonCderlinCamoradoBmmeClayCkeCertonCbertsonBlworthyDickDardCoyClysonDstromDingboeEamCifritzCgartCerickBitzenCsmannDentroutDcheidCrichCknerCckhorstBhrlerFBglintonCererDlhoffBdmunsonBcordCkrichDlandChevariaBbersoldEenzDnerCadiBalandCksCglestonFnDinAdyalsBwelleyBuyCvaCtterDkoCsterDkinDelCrrenbergerDkeDianCpayCntleyDsfordDdeeClembaCgiCfficyCensingEoDittCcloCbrockDitskyBrumgoCozdowiczDmgooleDbotCivasDnkwineCewingDssmanDessenCainvilleDgnaDffinBowgialloCveyCugherCttinCssousEieDeCronioDningDkoDionEnirlFgCornCnohooDnallyDkinDezErsonDdlingerDchezDawayEtienFhCmmelDineFEanoDhoffDekCllerDinskyDberryCkerCilDdgeChmanCedenCdridgeDgsonCbkowskiDieDesErtBiwanCtomassoCstaffenFdDpenzaDorboDkindDerensDcipioCricoDeDagoCprimaCnwoodieDnDkensDiusDgeldeinCmonDittFriadisClliardDickDauroElloGaChelCgilioCfonzoDeoCetzeElDsiEelDppaDnesDmertDgelDffenbacherDcCckhoffEensheetsCbonaventuraDbleeDartoloEccoBhondtBewerCvelbissDazierEraCuserDrDellCtzelDtlingDroCstineEefanisDorcyEmmaDlandesDistoEgaDhlerEawDgroseillieDaulniersCrwitschDrigDouchieDmadyDiderDfusDbesCpperschmidtDoysterDaulaCnseDninDiroEoDgelDeenCmpsyDmyEertDichelisDedeirosDbroskiEitzerDarseFanvilleEgistrisCluzDsonDrossiEieDossantoFDmolinoDlisEaroccoFnoFDisserElleDestonErmeEoneEhantyDbalsoDavinaEuterEshmitCkalbCguireDrossFoteEasseFngeFceDasperisCffibaughDaberCcrostaEistoforoDhertDelleDapuaFiteEndiaCbuseDrulerDlauwDellaEerBayritCvidianEckFhEaDersaFnDaultCutrichDschCtheCstrupDsowCrrasDnoldDksDgisEatzDbouzeCnnenfelserEardCmpfClzenDphonseDlugeDhoverCivsDnackCherCgleDhitaDdagCfonsecaDfernCehlerCdsonAczubaClapinskiCarnikDpBynovaBwiklinskiBuzcoCtnoCrtDbowCnninghanDisEnghamEcoClmerChelCestasDbasCcharesCbrBsizmadiaBrumpackerDellCousoreDstenEmanDokedDmuelEeyDckarellDanCisslerEpenEmonEeEcillisDppinDllyCestaDgarCagunBoyeCwingDerCverstoneFdellCutyEantDrtnageFeauDperDnteeDltasDghranCttewDlerDelesseCstenDsinDkreyDenDdenCrveraDtisDselloDrionFgeuxEeiroDoDnettaFilDleeDinDganDfmanDellDdoviEiaEasDcinoEheroDalCppolinoEernollFnsCoteDpersteinGriderCnterrasDsolazioEDninEerleyDkinDgressDcienneDaghanCmreyDinskyDellaEeEDbeClnDlumsEamoreDicchioDeeDdingEerDbensonDagiovanniCkelyCinCddeCbrinCakBluxtonDesmanCoustonDsserDppCiattCendennenDarmanCattenburgDrksDpsaddleBiusCraColliCnottiCmkoDaCenegaCcatelloEleCarlanteDnfriniEciulliBhurleyEchesDongDkesCristouGescuHFmonFlerCounDbotCisemDongDmeraDlaDccaDaritoChunEmDimCestangElerDrubinEnoskyEebinDpigaDllisFDdaDccaDaterGmCaulkEdhuriEcaDtchoDrtrawEpingEnleyEmElsonEbonneauxEanDppDngoEezEcerDmnanphonyDlepahDikenDddlesoneDconasDbaudBestiaDsorCrvettiFnyDiseDecerDasoliECntiniDciCmburaClliCderstromBdebacaBayoCwthronCviggiaDersEneyCusleyDghlinCthieDanElaCstrogiovannEletonEiloGlioEellawIriFjonDpersenDivantDhioDcioliFanoDamentoEdeiCrwinDvinDucciDtinEezDstonDrioFagaEetinoDotenutoEsielloElfiDnathanFllaFgeyDlillDinioEkerEdeDeDderoFnalDasquilloEbezCpwellDurroElongDpucciEettaEaDouchEraliEnigroDillaDataEnCnzoneriDtineEaranoDnellosEardFdaDlasDgeyDaanCmpoyEanyFinhaDbiEaDastroEnoClrkDlinEariDicuttDemineEbDdonEasCjasCdelinaCcalCbrialesDlesAbythewayClandCesCanBuzickEakDhardtCtzlaffDtolphEaDronDoracDaudEcCsuttilDqueDingDboomCrwoodDrightFEallDnessDlingtonGDkhamDickFhDgnerDdexFllFDbaColCndiClickDginCkovskyFacCjakCgettCffoCeschelDckersCdnikCckeyFlDhkoEinskiEanaFmanDekCbaBryansCustkernEselGauDntzEscheenEkenDmbachDessEckmanGDckenCozenaFkDwnleyEersDsmanEchDodyFDnzoEnDmwellEeEagenDllDfmanDekemeierDdiCixnerDsbanDnkmeierEghamDdgforthFetteCeznakDwbakerDitweiserFenFbarthDhautDedanEchEDdernitzDchnerFbielDashearsCazinskiFlleDtzEuEschDsDntingEninDmsenDilfordDgasDdneyGrEiganFcaEDbstonBozwellCysDnDarEnceCxtonCweringDarCurnazianEgueFoineEdageDlierEdsFingDchCttumEorfDeroCsslerEhardtEartDmanCrzilloDstadEosEellinoDrayoDowiakDioDgosElumEhoffDelandDdeleauDcheltCormanDleDkwalterEhartCnventreDucchiDnemaDgardDardiEdioCmstadDbaciClusDogneseDnickDebruchDdrinEerCjeChoDmkerCgoshDnarDinDatitusEertECehmkeECdwayDemannCckhorstDhnerDekCblittDbitCatfieldDstDrdleyCBlumhardtCowerDndellDemerDczynskiCintCendenFDmDiningerEleDhmDchmanDakCattlerFelEherwickEchleyDsingEenDndinDireDdDcklerBizzleCsonEgnoDkingDhoppDchkeEaroDarraCrtonDruetaEellDklidCnkerdDettiEgarDdrupCllerbeckDkaDeyEckiCglinCevenueDrwagenEnatDnvenueDlikDdrzyckiCdeauxDdingCckmanCberElCancardiDlyEkeEeckiBhattacharyaBezakCvilaquaCuthEerFlDclerCttiesEeridgeDschartDranDhleyDetaCswickDsmerEemerDherseDerraCrverDtuzziEkeEhelsenHetteEagnaDschDrioDnoskiEatowiczFrdyDlingEDgmeierElandEfieldEesenFmEantzelFmoDdeciaDardoGinoCquillardCnzingerDyaminDtzenDniceDkeDetEkerEdumFickDdDcosmeCmroseDillerDerClzungDmarezDlinaEendirFmareEantuonoGcaDkinDinskiDcourtCjaranChlCekerDghlyCdneyDkerDeauDdomeFeCcvarDcariaCazDushawElacDtleyDrdonDchemGlBazydloCydalCxiCusermanDdlerCtzliDtinoEeeDleyDesoleDcherCsurtoEDtianelliDsageDnerDhfordEerEaraFDeliceCrtosiewiczFlomucciEnickEholicFeEelsonDsuhnEonDriesFcelliEenaFdoEazFleDoldyDneDmettlerDjasDisDeisDdachDcroftEelloDbutoErickEoEishEariaDasEgonaCquetCnwellDowetzDdleCmbhroliaClthazarDsonDliettEestasDinDfanyDetteDdrigeEenegroEassaraGaroDcortaEkwellEitisDascoCkaCishDnumDlinEeChlmannDerCgoyoDgetteCffordCddleyDanguioEmoFeCczewskiDornElorDigalupiDhtoldEaCbickAazzanoCuaChocarByreCdtDlettBxsomBwadaBverbachDnosoBuzstonCyongCtauboCstadDCroraCltzDdsEridgeDCgeCelCdirschDainCchmoodyCbertineFBstryCquithCpChdownCenDlageCcensioCamDdBrtusoDingerCritolaDeDaiolECouriCnzenDtsonDsteinDoldyDhartDetCmentorElCganbrightEllEbrightCenstamCdingerCcuoCambuloFolesDbianBppeltFgrenCodocaCeBnzaiCttilaDoniouHttiFakosDellEeDayaCschutzCoCnonDeDarummoCickCgelovichCesCdroesEleEeoliFassenDerlCciraCastasiGcioDllaDBmunrudCparanCoryEesDdeiCdahlCazanBlwayCviraCuiseCtomonteDidorDadonnaCstottDinaDhouseCpizarCongeCmesticaDarasEndClwardtDumDgierDermanCkbshCierDanoCfsonDeroCexenderDssandroEciCdasEbaCcideCbyDeloDaresEirEchCaminDgnaBkunaCrightCimCesDnCbariCauBitkinsDaCrolaCnesCmoneCltsBhrentCneClmanDinBguireCorCnerCerterDCcaoiliBfzalCshariCfleckBduddellDColfoFCjeiChamCerholdtDnsDeCautoBcocellaCkroydDersEnDChterDeampongCeretCcorneroBbtsCruzzinoDechtDamovCoudDCesDdCbyBamotClbersAzwolenskyCienerCanzigBvorskyButterCrowskiCpferCnkerCmbachCbikEateBottolaCssCrmanCnkerCmerClloDezziBnidarsicBmijewskiDchBlatenBiskCnterDglerDdelCmlichCllmanEioxCgichCesemerDlonkaDbartCaBhuangBeyerCrkleCpfCnisekCmpelDaitisCltnerDlmanDascoCislerDnertDerCgarraCemanCdakerCcherCaglerBbindenBaunbrecherCrlengoCnninoFDgaraDettiEsDderigoDayedCmbitoCluskyCkutneyCissCharCgrodnikCeskeCdrogaDehCcekAyzaquirreBuroCpeCntCeBounsEgermanDkhanaCshizumiFyamaFkawaFharaCreCnedaChBepsenDizCntzerClinCdidDdoCboahCahBauckCttawCrrowDoshDnCnuariaDkoCmpolskyDinDagataCkowCegleCconoDkoAxayavongAwytheCrichCdevenCandtBurtzelDdemanCnnerClffraatCjcikBryCightonCeathCaightDggeBoznickCtenCrmuthCofterDdmoreEeCmeldorffClvinDmanDgastDfgrammCjtasDenskiChletzCetzelDlkeFDhrleBittlingerEkeEhuhnFoftEekindDkusDbeckCstDsingerDnoskiDleyDhardECpperfurthCnterlingGhollerGfeldDsmanDkenwerderDgersonDegardDdlandDchelClmottDlwerthEougbyEingerFmsFbyFanGmonEhelmEgingEensGbringEcottEardsonDhelmyDdsmithEonerEbergerCkholmCgnerDlesworthDgettDetDdorCemanDdDboldtCdenCckettEardDhtermanElandEerBhysongDmsCooperEleyCitverEmoyerEehorseFbearDshDppoCelerFhanDetleyElandHCatonameDlanBeygandtCxellCtheraldCstfahlEerholmHeideFnhaverGDsendorfDcomCrsteinEalDraDntzEickiEettDgerDberCnskoskiDkDdzelEelboeDcikerCmhoffClshansDdeDbyEurnCisfeldEenfelsDnreichDkertDgleinDdaCgweiserDleyCflenCelerCdoDinDgewoodDderspoonECbergCathingtonDrsDklyDferDberBazCxlerCveCusonDgamanCtererCsmuthDhmuthCrtersDsawDnsEkenEeyDinerDcholCnsitlerDlessDkerDdrieElerDczykCltmannEersdorfDsworthEethDpDnerDmerDlochEingerEettDkleyEingstickDentoskiEgaEDdockEenmyerFEbauerDchakCkayamaCiauCddickCcykAvreekenCbkaCadenburgBounasCtolatoCsquezDikaCrwaldDseDosDgasDelCorhesCncannonClstadDoDkmerDdenDbrechtCisardCetschEbergDltnerDgeliCckBlloaBivonaDinoDenzioCtucciDtitoeDiDeauxDatoeCscomeCrziDulaDreyDellaDaniCoxDlettaCnallCllatoraDcanCkCgenCethsDlmanCdraDotDalezCcentCbertDbardBethCsteringDhedskyCrsozaDrellDoevenDnolaEiaDjanDityEatoDhagueDduscoEerosaGameFllDchDbekeCntureDessErDdrickDcesCllucciEoneDkCghCdiaCcchiarelliBazzanaCuxDpelDdrainCtalaroCstanoDsoDiliouDherDconesDCruzzoDrelmanDnedoreDiDelCnwrightDvoorheesFlkinburgDtrumpDstratenFoneEiceEcoterGitDordEostenDnortwickEetteEattenDloonEiereDisDheseDgalderDelderenDdreEoverEinterEewalleFvanderFrroestGmayGlooHeeHaanGgraphGenFnbrinkHoomHergeFlFgriffEaleDbruggenEoerumEelleDaukerEstenErsdallCllerandEadaoDisEntineDenzianoFtiaFsuelaCismanChenaCglientyCcchianoAuzielByemuraBtslerBsieBrzuaCesteCbyDineCabeBptgraftBnterzuberDalanCgermanFlandCderlandFbergBmholtzCbrightBlwellingCstadCmenCcenaCanskiBhlenkottCerCasBglowDandBerkwitzBccelliniAtysarczykCronBwymonCoheyCisselmanDchellCetenBuzzoloFCtokyCslerCrnnerDjaDickEanoCnnicliffCmmonsDlisonDanengCderCczynskiDhmanCbvilleBsukiyamaCeleeBruxonElerDsslerElerEilloDdilloEeDchanCoweryDtochaudDpianoDnstadDlingerDcinskiCivenoDtesDpletDckEhellHCeveyDsterDischDgerDfzDdwellDbbeDakleCavillionIanEaglioDuschtEbeDpperDnumEiDinBowlsonEertonDeyCvmasyanCusleyDrtellotteEeDlsonCtinCstiDadoCrunoDrisiGEentEadoDnerDinoDellCpolanskyCozeDtCntarskiDnessenGonDesCmisinElsonDasettiClomeoDlmanDhurstDchinDbentCherCfftonCepelDlkesCdorovichDiscoCczekDkeyDhtermanCbiassonBlucekBitzerDmanCseCppetsCoCngwaldCmmelDbrookClmonCjerinoCgerinoDanoCekenDgsDfenbrunCchacekDaBhurmerDotteCramerCoroughmanEnockFdykeDngchanhDmenDeDdyCigpinDelemierDCerresCalDkurBewesCvesCsmerDlowEerCruelDronEisEeEasiFceDoDmanDeskaFiCppCoCnzerDnilleFesDczaDamoreCjadillaCcklenburgDhairaBayseCwwaterCvolacciDernerCurinoDlmanDbleeDarezCttershallDsutaFnoCschnerDbyCrratsFntsDoneDleyDaborelliCperCnniehillDksEardDgriDequodleCmporelloDerDburroFngaClimanEbDasCkalaEchCiwoDbiCghonDabanCdenaCcconeEettaCbatabaiAszyszkaCmalcCerszenCczepanikCarekDfraniecHDblewskiBytaCsynCndergaardCmanskiClvianCckBwymerCofferDagerCiggumDatCetnamDstkaDntzelDetwoodDdenburgDaringinCartzendrubeEmDntEceyBverchekDnsonButorDhoffEarCsongDkinCrraDanoCppleeDinoCndborgCmmonsEerourDersCltzerDouffDeckiChoskiDarCgerakDanumaCddothDberryDBtymiestCvrestilCuveDrrupEmerDmerDhlsatzDenkelDdierDczynskiDbboloCruebingEchenDozziEwderEhbehnEerEbridgeFeckDitmaterEkeEeterEcklingDeuEifelDaugterEtakosEsburgerEfaceEatmannCpetersCovelDudenmireDtskyEhartDrzEmesFanDppelDoksDnelakeFbrookDmbaughDltzmanEsigEpeDglinDffleDdgellDckeCirnaDpetichDnnerDmpertEerDlphenDkeleatherDfelDelyFauEgerDdmanDckrathFmanFelsCgerardCernbergerEgiosDpienEanskiDntEkampEehjemDmpelEmerDlbDiskalEnmullerGacherFhorstGausHrterHgenFburgEfleDfanickIhDeberCayDwarzDvropoulosEesDupEchEbsDthopoulosFisDrtzEowitzHczEkieEcicDnelyEdrodFahlEczakDmpleFkaEerDllinsEfordDhoskiDggerDderDackBrsicCeyBquitieriBpyresCuhlerCrouffskeEstyDinzlFgleCothCletzerCizerDtsbergEaleDroffEerDottaDnolaEglerDkeDerlingDcklerChonCettelDrleEkaEbergDltzCawDsianoDreDncakeDgnaBowerbyCvernCuvannasapDtherlyDsDrwineDltCtiriouDhmanDaCrtoreDleyDinDellsDatosCoseDngCnsinoDnabendDiaDgsterDdrolEergaardCltauDinskiFgerEdCjdaChnsCftleighDfelEaCdaroEnoECbranDczynskiBneedenCaterDirBmokerCithingellDnkDlesDalekCetakDjkalDckCaldoneBluyterCotDstadCingerlandDffeCemmerCawterDvinskiDgowskiDffBkuseDlskiCorniaDlfieldDgstadCinkleDdgelCeffingtonDetsEleCarupaEpholDareBjolanderCaardaBittsEerudECssellCprasoeuthDperDlaDkemaCnningDitiereDgleCmmensEDiskeyDeltonClverthorneGnaleEanDiadoDbaughCketErCgurdsonDnoreDersCffertCevingEerdingDtsemaDringDnickiDmsenEonsmaEeringDlskiDdleckiDbersCdburyCckmanEingerDilianCbleDilioDbleBhutlerDrgotDpingDldaEaCrievesDeinerEckengostGCowesFDupeEmakerDrteyGnErockEkeyDnesDckencyDatsCivelDpmenDnselEdledeckerEabargerDminskiDlohElingfordDgoDfmanDersDbuyaCewchukDttslineFerErawskiDffelDesleyEkeyEderDaresCaugerDrkoDnnaEkinEiEdleyEaaDmmoElinEbrookDdowDckleyBgambatiBferrazzaBeydelCwaldCvenbergenDaaetasiCumanuDellCttlerEerbergDeraCssoDayCrvossEinoDpeDmenoDlesDenaDapioCnskeCmmlerDinoleDelClvaggiDlaiDissenEngDegEdonDboDanCkuterskiElaCiwellDvertDseDnDlsDerDditaDberlingCherCgrovesDovianoDelEeCftickCesDkellDgobinDboldCdlackDbrookCctionDreaseDoreDklerCastrandDrgentDcristEhordDbrookeBcudieriCrimCozzafavaDttenDnceCircleDpioniDarrettaElloChwinglerHhammerHelFesowEeinfurthFdaFbkeEarzkopfFnderFllerHDutErkampEnterElderEenemannFEckmanFhartDroffDovilleErzmanFderEonerEnesEllerEfellEeweFningerGhalsGbeckFfieldEbergDnittkerEeidermannFcklothFblyEathorstFrrsFkenbergDmitzerFdbauerEeeckleFckpeperEandtFlzriedGDlinkerFepEetteFsierFigFhuberEarbaumFfferDkadeDisselEndeldeckeEmandleEermeierDeunemannErrmanEppEmmerElpEhrDayerEunamanFlandEtzelErrerFpingGfFnbergFmerFborElowEfEderEcterCelfoCarpelloEletEingeEduzioDmardoFnBbanoBaymanDleeCxenaCwdeyDadaCvitskyEckasFDaglioCuriolEetDloCtarCsportasCrvasDulloDsfieldDneDmentoDjentDellanoDdinCputoCnthesonEellanaEarsieroFgoDsaloneDosDnaDkoEerDghaniEalliDdvenEmannEhoffEeliusEallDchiousEedoFCmpognaEiloEayanFiaFgaDoDlalDelaEcDadClzbergDwayFsserDvesonFminiDusDqueroDowitzDizzoniEnaFEmiDgeroDemiDatoEssiEmachaEhubdinEdaCintignonFamandEesChlDaCgonaDedahlCffelCemenesCdowDlowDgerCcramentoDkalDhtlebenCbotaFDeDataEstianEdArzepkaByzinskiCtubaConCnesCkielDertDardCdolphDellBuzickiCtkoDenbarCstrianDinskiDhmoreEenbergGDchakCryCperCotoloCmmerfieldDerDboltClonDemanCfeCdoDkinDickCbinichEdouxDeroBoysCwmanCvereCusuDillierCttonDondiDhenbachCszellDsottoEmillerEeyDhannonDenfeldtDcioliDanderCrrerDexCpesDacCothDrdaCnsaniDneDgDfeldtDdyCmpDonDnessDmDeraEiroDbachDarEnskyEgnoliDClsonCjosChannaCgstadDillioDgDackiCffmanCethleFEcisoenderCdibaughDeriquesEnburgEmeyerDbergCckovichDherDcioCbeckEDayoErBizzardoCvieDalCtterbushDchkoFhartCstigDhtyCppsteinEelmeyerCosecoCngwaldEquistEhamDellaEerCmpleCllingECjoCihimakiCglosDgensDaudEliCetzEdorfDssenEgrafDnstraDkenaDdleEingerDbCckenbakerDhcreekEbourgDcelliCberdyDbBhodieCeomeDinhardtBezaiCynaldsDmanDezCwenkoCvilleDelloFezCulCsueDtucciaCplenskiConCntarDsbergerEDnakerDellCmsonCllDacionCkucDerCitlerDschlDntsEoehlEartDmundEoldDkowskyDgerDfmanDcksEhlerFhardtChlingCgosDinoDalbutoCffnerCentsEdersDksEDckCdmerDicanDdochEigFcksDbirdCctenwaldDekCbillardEchDeckCagonBazianoCymoreCvenelElCuseEchenbachDerDchwergerCtelleCsinskiDburyCrdonCpsonDkinCoofCnnellsDkeDgitschEasammyDdtDCmserEaroopFhaiDrezDpleyDirecDeshClbovskyCkoczyFiCjwaniDaratnamCidenChmaniCgnoDhunandanDasErCfuseCdvanyDosDmacherDickDeckiCczynskiDhellAqureshiCirinEeDntonaEnettEaltyDambaoCellaCatraroDrtararoDlleBinApytkoCerCanowskiBuzioCshcarCrvianceDtlebaughCpoClteDseDlomEingsEanoDkkinenDiaficoDfreyCjolsChalaCchallaDciarelliBrutzmanEtDneauDchaCovittDtinDseDcoDaCiskDolettiEdeDnkeyEciottaDchDbnowDalCeyerDstinoEsimoneEkittDliDisslerDhodaDdovichDciseCazenicaDwdzikDstBozzobonDosCwlesCvCullardDchCtucekCstertFnDsonDaCrtuondoEenDstDeeDaCqueCpiolekCotDckCngkhamsingDessaEDcioClumboDlutroEetFnDjakDemeniCkswinskiCiselCetteDlmanCdyDewilsDarasCciusCbanzBlymptonDCushDmeDffDesEConaCexicoDwDissElDasantonCattsmierEheDnkeyDhsDggeDckerEhaBiziraCwowarDetzCttelkowEaDhanDcherelloCsciottiCpilasCnteaEaDkstaffEosDcClotteDloChlCgnottiDgsCetrzykDrmontDczynskiEhowskiFCckersgillDettiDciutoFniniDarelloFdoEdoCantanidaEkaEBhothirathCippardDlmanEipsonEavanhCeltsCanorEcoBflughoeftGDigerCeisterEfleBeyreDattCttineEettDruEonioEickaEakDkoDittoDerssonCsnellDhekEDcadorCrzeDteetGEDschbacherDruzziEishFganFelloEDozoDlichDkingEesDfaterDceCpezConCnunuriEelDsoDnisiDkinsEalskiDdonCllonEissierDinoDCickCgueseDgsCfanisCetersDdinCdutoEllaDrozoFttiFncelliFgoEiEegonDerzaniDdeCcukonisDklerEaDhaDciCatmanDlsBazoCyeCwlusiakEitschekCvloskyFDeglioCulmanDkstisECttsEerDrissDneaudeCszekDwatersDtulaFchEelDsyEarellaDquinFalettiHDcuzziEeriCrviainenDralDoliniDmeleEaDlavecchioDfittDezDdieckEewEaDazEtCpayErelloEioannouColelloCnsiniDelliGDderDcholiDaroEgiotopoulClomarezDmroseEiscianoEeseDlottoEeschiDkDhegyiDenzuelaEaaeDczynskiDakikoEiaCithCgonisEDliucaFariDaniniCdovaniDfieldDamadanCcquetteDoDkwoodDheroEarDewiczCaschCAozolsCgaCenneBxmanBverpeckEbeekHBuletteBtsuCrembaCoolCarDnicarBsumiDchaCtrovDhoffDertagFgardDabaCpitalCoskieDfskyCisekChinskyBrzalliCwinCtweinDunoDsDellCpenCnelazCewilerDsCdonesBpunuiCpenlanderCoienCalkaBoleyBntkoCdreyBmuraCtiverosClandBlupCthoffCstenClilaCiviaDnskyEickCeksaDjarzCdakowskiBkoronkwoCinsBhmerClssonCerronEonCanianBganesianDldezBestChlenschlageCdekerkBdonCekirkBcranConorBbrzutDistEngerCornyClanderCiCerleyEerDngBatridgeCjacaAnypaverBuzziDbackCxollCssbaumerCrmiChnCgenCaraBquyenBozickaCxonCwickDaczykCvielliDembreGerDasCunCttoDowichCrzagarayDwayDthoverFcrossDemDdmannEensonCletCjiriChelCethigerCddBitzelDaCsbitCnaCkasCgonDlioDhswanderEbertCemietzDdzielskiEerkornGhausGerCcometoElaidesDkolichBguynBeyraDmeyerCwmonDgentDberyCvalaCuwegDhoffEauserDbeckerCttikEersCstingenDsporCradCnezCldonCizerDvesDlsDgerDdichDbertCgroniCemannDdleDbCdryDleyCasBazeDaroffCyesDarCttressDonabahCssrEeriFfDoCrkierDetDdiniEecchiaDagonCputiDieralaCnnyDkeCmdarCjiCidooChmDasCgelschmidtCesDgeliCcolDlerioDhorCboznyDarreteDAmyrlieCkinsBuzioCtoloDaCstoeEerDkeDchampEarelloDacchioCrzyckiDrufoDnanDaskiEnyFoCnzerDisEonCmbyEowerClrainDlinexHauxEennixEaheyCkhtarCinaChaCehlmanCccigrossoBrozoskiBozierCwCvaCustafaEserEeEaDritsenEadCttetFnDamediCstowyEafaviDimanDconeEickiDbruckerCrvaDtinezEelDseyDrinEenDoscoDledgeEaDiskyFhitaFeyDgiaDettaEraEnzDdueEhorstEauntDberDawaEvickErityCotyDserDckEhlerCntoureFothFnezEierthFcelloEeverdeFrranoFllaFcilloDsrudEmaEerratDrrealEoDettiDdokEellaDcionDaldiCltzDonDliconeEeDiternoEnereFaryDesworthChCgushDrenCellersDckCdertCckbeeDherFlDCberleyCanDllankampBiyoseDataEshitaEgiCtsudaCsumiDselDkellyDiaszekCrzadehDtoDschDlesColenCnzelDutilloEghDtzerDskeyDnaertDkoffDiardDgledorffDasEaiCllyEinorFeEerdFaDkeyDhamDfeldDehamDasErEkCkulskiCharaElekFchikFCgnotEanoDhtyCesseDrzwinskiCcthellDkusEolickEiewiczDhlinEelenaEaDcioDariBezzatestaCwbournCuseDrinCtzkerDtlingEingEersDropoulosDeviaCstethDkoDiDeroleCrvynDninDmelsteinDlingFDkowitzElinEersonDicaDendinoDcuryDayEntoFcioCnsikEeDoniDnieDgsteabDesDdDcyCmoloCltzDingDenDcerDamedCkeeCisteEeDnhardDerottoChokDargCginnesCenachCdicusEanoFDellEDdaughCconiDhCarseEdonDlorDdvilleDchenBcvicarCsparinCrorieEbbieCoyDwenCnortonDertneyDamerEilCmanamonEinClymanDelandCkirganDewEvittErcherEnsieEeganEaneDahanCintureEdoeDlvennyElwainDffCgwinDuffDrottyFneEantDooganDlonFinDiveronDheheyEayDavinEhenCfannCelwaineEduffDachronCdildaDermidDannoldEleCculoughEienDrumbEoreyEelessEavyDourtneyErrisonFkellFeyEnneyGaughhayEllesterDlurkanFerEoudyEenaghanEaveFrnonGinFneyGanFirDhristionDaskellErthaFlEmantElmontGanEineEhillEgueCbrownCananyDlvainBazzurcoDucDoDingoCwhorterCvroEaganisCutnerEinoDceliCtzingerDuriDturroElinEheisDsuokaFkiDroDlackDiceDhsonEeuFniaEDejkaFaDananeCsztalDtropaoloGmarinoGliaEelDsyEoudEiminoDlankaDiniDcioliCrzecDvierDuyamaEsarzEmDtorellaEireFnkusGasFezEheEeneyDschallDruffoEazzoDplesDohlDnDlboroughDkunasEiDjanDitnezEnkovicFeauDgaitisDentisEDcouEielFEhioriFelloIEelleGinDalesCpelCnzanarezDtiliaDsmithDonDnschreckEickDkiewiczEelDilaEfoldDhaDgrichEiapaneGmeleDeraDdesFllaGikEalonizEDcusiEineDaCmulaDmoccioClzhanEahnDsomDoonDnarDloneEinsonFeEekFDinoskiFconicoEcoatFdemDhiDfattiDandrinoEmudEkowskyCkovecDeyCjercikFDamayCisenbacherDneyDleyEanderChunaDomesEeDnkenDerasDaxayEnaEmCgniaFEantiDlianoGcaneEaughlinDistraleEerskiDginiDanoCfnasCdrenDorDeriosEnaDdronDanElinskiCcmanusDleadDkowskiEinawEessyFrlGDivorDholdEainDedonioDdiarmidDchiaroliDbeanDayanEriCbinDelAlyterCsterDneCnskeyDessDdakerCmasterCkkeCellBuxmoreCttmerDgenCsignanCpoldCngstromDfordDdebyCmbardCleCkaskiewiczCinstraCevandDrDkingDhrsDckingCdvigsonDgoodCcichDhettiCbmanDicBozitoCwhornDdCverichEmanDasEasCuvierDthenDryDkanisDghnerGaneDatoCtshawDherEamerDerCsinskiFgerDhekDeccoCrtieDinDentElloDasEhCpauCosenCntzDgpreEieDcaricCmbranaEaChreyDoffCggheDesCfsteadDftCertscherDperDbleinCdatoCchenCbbinsEanBizarragoCvigniDernashCukkoCttichEererEauDchmoreCsyDsyDhmanDchakCragCptowCnsDkhartEertDgrenEelbachGEadDetEgarEbrinkDdrothEelandEboeDardiGCgmanDgansCflandDfCeuallenDsveldEsDnhardDhrDdyEkeDbauCdtkeDstromCcanoCbraBeysDmeisterCwerkeDandCvociDitonEenDestonErenzGDangieCuyDkumaCttmanDranDlowDhcoDerskyCstrongeDsoEeyDhemCrudCpsConesioGCntoEeDnertzDiorDhardDfestDeDdrumCmpickiDonierDleDkauDingsDClliCkasCittenEheiserDnoEerFnbachDdyEichEDchChnhoffDCgumDoullonDeytDalleyEceCftonEhandDorgeFeDleurCerarDfDdCdlDdonDainCckieDatesCbeoufEnEckEauxDanCavertonDrmanEdiDmyBazareFczykCyssardEonDhewDelDchockCwernceCvzonDallaCuterbornEDsengGDrinoFEenzanoIDndryDmbachDingerDenrothCtzkeDulipeDtigDronicaDoufDkoDikerDhernDerzaDchawDaquinCsureDhombDellDassoCrteyDrivaDoDdnerEieriCprarieDpingDitanDeyrolerieDarCnzettaDtisDkaDiDgshawEmyerEinEermanFlandEbeinDdroFianEmesserFannEfairEesbergDciottiCmpreyEeyDosEraEineDfersDbkaDanceFaCliotisCjzaDaunieCinsonCherDarCgrottaEantFizeDneseCfraziaDountaineDlinDasoErgaCdageCcsamanaDrosseFneDhowskiCbruyereEakeDossiereDaCackAkyzarCnardBwekBuzminCttnerCsiakDerECrtzerGbornDpinskiDoharaEdaDnikDiharaDdzielDbanDasCpperDfererDecCnzelmanDklerDinDeshCmroDpfClonDkaCkuckaDChseDlsEoDarCerbitzDnziDhnemanCdronCczenskiDhleEenmeisterGbeckerDanCbuDschDiszewskiFhEczFkDaskaCarezBsiazekChywonisBrzykowskiDakCyslCuzewskiEanDmrineEinsDckerCoupaEghDtzDnstedtDmreyDgstadEmannDezeEtzDcCistiansonFenEerDpsDngasDeteCeuterDtschmannDshaDidelDggerDatsoulasCatochwilDsovecEeDpfDnawetterDjnikBozubalCyanagiCwalkowskiCvarovicElcinCuCtzenDnikCsteleckyFkFckiEalDseDlowskiDkieDickiDharDekCrtrightDpalDnhauserDmosDinekDgieDdsmeierEishDalCpsDpsEerudEangDferDetCokCnnoDikDekEfalCmmDisDerDarekClsrudDpDopajloDlmorgenDisDesnikFDdingChsDlhoffDatsuEraCetterDstlerDpselEpeDnigsmanDlewynDCdadekCciDhlerDabCbylinskiDrynDergBnowerDllenbergDckCizleyDssDesCezovichDsekDpelDhansDeskernCaustDpkeBmetBluzDkasCoskaDpfCinglesmithEekoleDmesFntEaszewskiCepferEackiGDmashDinkopfGnechtEmolaEboekerEDhnDginCavuhnDuerDsinskiGgDrrDpecDassEmeyerBjellandBiyunaCtchingCstleDsiDhiCrvinDtnerDovacDnonDkbyDitsyDchgeslerCppleyEingCnzigDsDnareFDgcadeDatyanCmmeDbrowFilClzerDtzDlmerEibrewEeagleDgerDesCevitDntzyDltyDkbuschDhneDfertBhouCievCatDreBeywanDtCvinElleDernCulerCtolaDelaarCrtisDsonDnenDkmanEerCoganCnwoodDneDaanCmplerEistyEferEenDmerlinClterDmanDlieDiihoomaluDemanCkiwiCiswetterEsDltyDdongCgelCetsDnethDfnerCdzierskiCbortCateEBazmorckDiDCwachiCushivaDkCtznerEmarkEenDsudaEDerEnCstingDsermanEayFbianDprowiczEerekDowskiDmirDkaDikDcakCrthDsnakEhnerFDmelDlstadEeyDinsEmiDcichEhDapetyanEkasCpsalisDpelerDkeDeronisDahuCnthakDskyEasDoyDnoEadyDdarianDaiEeEanCmphoefnerDmlerDinetzkyFakaEenskiDaunuEkeaECltefleiterDoustianEiDlmeyerDischEnskiEherDgrenDfasDesDafatisCgleCdishCchermeyerCbinaCawaDuaDtzAjuveraCtteCstenDkoCrigaDeCngquistEbluthDejaDcajClietChasCengerDllCceanCbinvilleBovichCrresDisDeCnhsonDesonDassenClissaintCinterChnnyDengenDarDCernCdwayCbsCanetteBirikDasekCpsonCnkersonFnsCminianDenoCauBevnikarCsselCrauldCphsonCntzenDkersonDistaEferCmmettClovichChlickaCffrisCdziniakCantetEclaudeBaymeCvorDauxCurigueEeguyCrvinenDockiCppCnszenEonsEDkauskasFDhunenDeczekDdrinDczewskiDackCmirCkuboskiFikFekChnelCgemanCenickeCcquemFayDonskiEbellisCblonAiyoBvancevicBuratoClianettiBtriBsslerClaCipChmonDizuCgriggCeriDliEeyCbrechtCassiDiahBrsikCiasBnzanaCtveldDrieriDerdonatoCstasiDchoCgwellDebretsenDaCdaCcleCabinettBmusCmordinoCbesiDachBllsleyDigDBgnowskiBdlerEburgCeueBbaraBanuzziDnielloCcovoneAhyterClesECkesCamsBuxleyCtchCsteadDcherCrtzDseDrenDetCotariCntressEingDstigerDkingCmpriesDblesDClveyDcyCizingaChmanDammadCftyCessoDftleDbschmanEertDCdmonCbermanDbarttDachBsuehBrycenkoCabalBoxitCwsareDmanDittDerterCultonDisCttmanDovecCstinDhallDfeldDchekCrwathDselyEburghDovitzDnstromEbargerDkleyEaDeyEthDdykDackCppinEelDfenspergerCoeyECnhartDgaDeckCmsDmellDlesDenEClznerEheimerEemDsoppleEmanDowellDliwayDiznaDesovskyDderbaumDbachDanCitDstChenbrinkCgerCfmansDheimerDfhinesDbauerCesingEchenDrterDpfnerDmannCdgemanCckersmithDhadelCbockDelBluskaCavacBisrichCrsbrunnerDparaDeCnnersDdbaughCmenezCllesFaryEanbrandGDdnerEingEerbrandtDandCghtreeEnoteEbergerDgasonDanedaCdingerCckockBeymannCusinkveldEelDringCttlerCsseltineGinkDfordCrthDskovitsEchellDomanDntonEeEandazDmezEanstorferDlingDkeDimannEfordDgenraderDforthDdesDcherEegDbickCntzeDnigerEeyFssFganDkesDeisenDdericksonDardCmrickGDptonEDmeDeonDbryFoughFeyClstadDmusDlingsEgrenDieDgertGmanGEasonDfinstineEgottEensteinDdrethDanderCitzmannDssererEingEelDnoldEisEemeyerDmarkDligerDdermanFnescherFbrinkChirCganCersinkDpCdquistCckfordCbetsErlyGeEnstreitCavilinDrtzDphyDnyBazerElgroveCynsworthDdockCweluCvnenDelyCussEamDmesserEanDlkEeyDbrickEnerCttmanDmanDherlyDchcockCstertDsenplugDkoDerElhuhnDberryDCrthorneFcockDriettDouffEotunianDkavyDellDdridgeEacreDborthDaguchiCptonstallDpennyCntmanDsesDnemannEayFfinDleDgartnerDdersonDbergCmzikDstraDmansDanoClsemaDonenDimDekEamauDamaCkeemCinleyCgleyDistEeDgbergEanDeleCfensteinEmeisterCdyDgesDefCckeyDhCbbyshawCagaDbAgysinBwirtzBuzzioEardoDmaCtzmannDtaDermuthGanEnbergerCrganiousDalCppyCnzalezDtertCmsDbCllottaEixsonFngEaceDerDbransenCitianDntaEassoDlboardDchardCgliottaFelminaDgenheimDelCetierrezEhleFDrridoDitsCdenkaufCcciardoCarneraDdagnoloBsellCchwendBrushDppDndmannEauDeningerDcaCoupeDtzingerEheerDssmeyerFeteteFackDmerDenkeFingEhlerEbnerDchmalDbyEesCitmanDswouldEsetDmeDffoDesingerCeuelDthDssmanDmelDiweEsElEfeEderDfrathEfDenmyerDanyCaziopleneDvlinEitoEertEDterDpDnzinEnumElundEdoDmmesEleyEboDlaDhlDdwohlEillasEertDcianaDbnerEinskiGgerEelDafBouzyDgerCttronEardoDhroCssoEiCrringeDneaultEDmlyDenfloDalCpenCoseyDdnoeEieEhileEfieldEardCnnevilleDgalezDdolaCmpfDmerCllehonDieDebiewskiDdingerEhaberEfederEbaumDaszewskiCjcajCgertyCettscheEheDsslCdsonDbeCchanourFBnauDtekBludCoriusEdanoDodtDdCinkaDmeCeimEcherCazewskiDyDsfordEcottDnzmanDhnDdishBjerdeBizinskiCtzenCrshDoteDmanCovinoEaniniDrginiCntyDskyDningsDguesEgEerDerCmmClruthDlundEenwatersDdayDcrestEherDaniCgstadCernothDngerCdaroCczewskiCbasCarratanoDntonioEnittiFettiDmpapaDcopelliFneFmelliBhermanEaCanBevorkyanCttigDchmanCsinskiCrundoDshensonDraroDnertDmundsonDloffDgelDdemanFlDaldoGesCorgopoulosFisFevicGsonCnzelDungDtzlerEiliDichClzinisCikenDdnerElChrerDoDlbachCedingCdyeCberthCathersDranDlyBazzolaDellaCwrychCvidiaCutamDmontDdenziDcherDbertCttasDleyDersDchalianCsselDmanDlinCrufiDriepyEellEandDntoEsEoDlingerDivayDhartDdinoDceaDbinDaventaFagliaEhanEfanoEciaCpenCnironEnoEmDgwishEeDesDdiaEezaCmlinDelinClwayDowDlobEishawFnaroFcchioEeseFroFgasDeotoEasDbrethEavyDavisEmCjateCirCgneyDelDarinCeteEaniCdbawCckCbryschDardiAfyksenButrelleCrlDchesDbeckCnnyeDicelloCmagalliCllfordDginitiDenwiderFaCglerCerstenbergeDntasCcilloCapauBrybergerCuscianteDehlingCombergDeschleDckCitzgeraldEcherDsbeyDhartDelingEdlerEDdellCeudenFDttDndDilingEjeEeEdmanEbertDgozoDehlingDdoElundFeyEeDbergCayreDunfelterDscellaDnssenEkowskiEcourGmFillonFeyDioliDcassaBostervoldDseyDhayDcueCrsellDristerEenDnicolaEesDgieDbsCppeCoreCntecchioDgeallazCllickDioCderBlyzikCuhmanDetCowDtoDrosEianoEenEanDerkeCitcroftDppDntroyCeschnerDnnerDetingCamioDggsFeBjesethBithenCssellDchmanCreCoranelliCnsethDocchiaroDertyEmanDchmanClyawDipovichDasCglerDgeCersEeckCdellCcorilliEDksEleCalkowskiBeyenCtzDskoCrulloDtittaDrimanEebeeEandFlesDneliusEbergDioliDgosonDencEiraCquiereCnnemaDelusFonEisCmriteCltenbergerDsenthalEDmetDgenhauerDarcaCiteiraDrerDnenDgenbaumChlingerCderleCckoCavelDtheringhamBayerCxonCurrietaDllCtoneDigateCsyDulaDsioECrwickDrillDquerDmwaldCntozziDoeleDnellDizzaDdrichClloEagoCistDnesFChrendorffCggardCesslerCdaleCbriziAeychanerBxonCilusBwigBvittsDngerCerheartFardtDlethFighBurbinBsworthyCtusDockDerbrookCslerCqueCpinaDalinCchenburgEbergerCbenshadeBrtleyCstadCpComanCnoCmatingerCkkilaDelaCiquezDnDcksCdahlCcolaniBquilsBppinetteBonBnterCkeCgleyFbrechtGergEarDelstadGmanFlantCceBmslieCpieCotoDnsCleyCileCblyEerCanuelsonDlBlzingaCwerCvisEngtonCshereCmquistCloutDifritzDerdFbuschCizandoFbethDckDasenCgertFCenaCbersBksteinCmarkBiserCnckCmersClertCdingerCckeBhsanCnBgletonCelBffnerBdnilaoDerCmonsDisterFonClowCholmCgemanDcombCellEbluteBclarinalCkroadChaveBbesuDrweinDidDCbingBastlundCryDpsAdzuroCiubanBysingerCnerCmekCllDCdellBwelleCanBuvernoisCtsonDroDchoverCskyEeyDikDhkinEaneCrraniDoseauDnfordDkDepoDanceauCpratDlechinDerryCnscombDklebergerDgDeganDdlowCmpsonEhyEertDesnilCllumDdulaoDarCkartChanCgdaleDatCffneyCesingDnowCceCbsonBrzewickiCuettaDbeCozdenkoDpDhanCiversDnskiDeverCewerDssenDhmerCaweDpkinDneyDhotaBowersDdallCvenbargerCusayDinDghanDcettFCrshimerEaintDriesDoskyDlDichDenfeldDcelusColCnosoDnickEelyDartEldsEgheyHCmingesDeboCllingsDejsiCggetteCellCckwillerEalCboshDisEeszBluhyBixonsCvinDenturaFereElbissCttrickDommasoCrosaDcksCogoDdonetCnningDinnoCmodicaDitroffEnnoDassimoCllieDanCgsbyDrandeDmannDirolomoEanFcintoCetzenElinEertDrsenDnstDffenbachCcorciaDkhautCberardinoCabBheinCarDmerBezanDCwispelaereDhirstCvonishDincenzoEllezDanyElcourtCublerCttoriDoneEmmasoFaCsueDtreeEephenDsoEelleDimoniDadierCrhamDflerDcoleDasmoCpughDorterElitoDaCninnoEDenbergDaroFdisCmryEoDmelFDielDeritteDarzioElineEineClucoDtonDsordoDosaEngisEisEffDmuroEoroFnacoEageDlenEaripaFmoreDhierroDfuenteDeppoEmosEaDcarmenDauraEnuezFgEmarterHeEgeEcuestaCkorteDenippDanyCinhardtDlyDerleinCgravelleDlowEerDiulioCfooreEnceDlorioDioreElippiCedCdekeEckerDajCcostDillisDhellisEaineDarrEprioCbutiacoDskiDryEuhlDouseDlaseDeyEnedettiDackerCangEdradeDdmondDcyBaykinDhuffDalCvionEdsenCutremontDghrityDbsCtwylerDkoCsmannCruszkaEgarDrochDoDkisDicekDasDCpozDintoCnuserDoffDkmeyerDesiFhEkerCmmenDienDbergerClmoroDlmierEerDkaDivaChlineEhauserCguerreDrellaEacaDesseECehnCdoCbbraccioDatoAczolbaCepielDlusniakDchowskiCarnyEDpskiBywinskiCranCpretBwiekBuzzortEiCttyDroneDhrellEillDbirthCsteauDhingberryCrveyDsonDrellDlyElDdyDcuruCpstidCocoClversonDnaneDliverGanEetonCddebackCcklerCbilloEasCaBryarCutsingerDsanDpeDmmieDiceDeaCowthersEersEdisDvoDsonEnoEdaleDnwellEonDcettiCnichCistalEsonEmondDghtonDdlandDckardCetenFllaDspinoDminsEersDehanEcyDdellCanneyEkerDkerDffeyBozzyCyazoCxumCwdinCvinoDenCurtenayEseEierEcheneDpDleyDchenourCtugnoDtongimEiDilloCstineEainDmoDlanDeCryeaDtwrightDsoroDrenteFlDnfordEeluisGiousFauFDkinsDippoDgiatDeilDdwellEovanoEillEanoDazzaEnCppessConradEfareDmberDksleyEisDdeyCntrinoEeeDsortiFleDorichEleDnolyEleyEingtonFeEessDlyDkrightDerDchasCmrieDpstonEagnoDnickDmiskeyEerDisoFhDdenClondresDlicaEeenFEaerDingerDfordDaoEneroChensCfresiCerverCckrielFanEerellCbhamDertFnEllBlunieDbsEbsCoutmanCiseDppingerCerkleyEDmmensEenDareEmonsCaycampDwgesDverieDrkstonEityDntzDkleyDinBizekCuffredaCtroneCracoCnottoDiDadrClentoDanoChonCganekCeslinskiCcoriaDcoCbulaCarrocchiDkDfardoniBhubbsCrzanDistophelJHforouGelGanDeeneDabaszczICowhanDulesDrneyEleyDlicoEewinskiEakyanDjnowskiClebekCittamDszarEamDrafisiDpreanDnettiDmesDeraDconDarelliFavalleEppettaCesnerEerEbroughDrubinoEretteEpakDlfDesebroughEneyElyDanEkCavanaDuvetteDttDsserEkeyDrriezDppieFelearFaroEekDnoineEdleyDllengerFbergFacombeEeunDineyDffeyBettaCrzaDvenakDtosimoDrutiDqueiraDnohousDeceresCovantesDCntrichEoreCllucciCglinskiCconiDilioDchinatoGBazorlaCyneDabyabCvillEcchiaDezEnerDasosEnessElcanteCulkDdelCttanoDrettDlowDellaDaquetElinoHeFanottoHattoECstenanosFloDsidayDparianDilloDewellDarrubiasElmanFCrvalnoDskadonDrusEisonFkerEazcoFtalaDpaniniDovskiEliDneDmellaDlisDfagnoDethersEllaDdoniaEnoEaDcieriEanoGaDboneauGDavantesEttiniEmanicaCpriolaDpellutiDosselaEniDeronFDatiCntvEoreEellEatoreFrellaFdoreDslorDonicoDnonierGeEavoFtellaDgianoCmpoliEelloneFanEanileDeraDcamDbelCltaDlsenEarmanDicottDhaunDegariDcoEianoDabrettaCkeCironeChelaCgliostroCflischDferkyCetanoCdiceDdleDaretteCckowskiDciaCbrenaDotajeErnDertoAbystromCndonBuzekCysseCxCttrickEaroDscherGDorDmanDeuxDcheeDCstardFDsyEonEingEaDiDemanDchnerEagliaCrttramEhDschDnsworthDlandDkowskiDglinEdorferDdmanDauEnEkowskiCquetConomoCntynDgoDcheDalCltDlinerEaroDkeleyDcaoDaCissonFerethCgniCetowDsgensCdziszewskiDinichDdingtonCchtelEliEertEarCbenBrzuchalskiCummellDllDdnickiDczEhmanDbachCownwoodEenFDssettEcoDokshearFfieldDnstadFkyEaughEDhawnDgnaDdzikEshoEowskiEnickiEellEDckneyDasEdrickCizDtschgiDntEichEgardEdamourEcatDmfieldDllantEhanteDhonDgnoniEhtfulEgmanDedDckleFelCezealeDwenDutzmanDtadoDsterEkoDnnonFamanEiserEdonDmsDischEdensteinDchtelDaCazingtonEenDyerDwerDvataDuneFbeckEeEchtDsethDntlyFerEskiEdlerDmhamDhneyDdacDckleyFeyGmyreEhBoyarskyCwlanDhallDdreCvieCuyeaDsteadDrgeaultDnthapanyaDltinghouseDillonDdrieEinotCttgenbachEariDosDhofEaCstenFlmannDsleyEickEenDquetDcioEheDaCrskiEhDowikEmDkeDgerdingEattiDdwineCoserDkbinderEardDckCnteDomiDningDitoEllasDduraCmbichCltinghouseDlozosEigerFeDkaDithoDdenowDchDayCissoneaultEjolieEclairDeChrmanDleyCglioliDhosianDgusEianoDdenCeyDsenhoferDrstEmaDnischDmigDbingerCdayEmerCcklageDchiniCbseineDianDergEkBlylerCumensteinCoyerDtterDreDmmeEdahlCiskeDnstonDekCessmanDggiDekerDdsawCauchDskovichDnkleyFenbergHDkelockDidaBjorgenBivenCtzelDtmanDontiCssenDomDherCrmanDkyEesCppusCntzEnerEliffDnieDksEiewiczDiendaDgleyClottoDlheimerEenFckFaudeauDinskiDelloDdChariCgdaCezDrwirthEleEbowerDnenstockDmerDlerEakCdleDdlemanEiscombeCckneseEertonFlhauptDhselCblesDianCaseDncuzzoFanielloDmonteDBhatnagarDrdwajDnBeyettCwigCuchatCtterDsillDheyDenbaughDanceEcourtCskeDendorferEmerDcoCryDtranElingEieDnsonEoskyFnEingerEesFckerEasconiFrdinDloEiewDkyDheEalterDgsjoEholmEenerFmanDaunCnwardDusaDseDnageDischekEonEnatoDgelDedekEDdzusElerEitEermanDberryDallieCmrichClyeaDtrainEerDlueEocchioEisleFpanniFonEessaEaviaDayCjjaniCisserDrigerDkDenChymerDrenwaldDannaCedDchumFnerCdnarikGekDenbaughCcwarDktonEomDhCboCatieEDrmanDnerDkleyDhanDchampBazziCymanDardoElaCwcumCvierCuswellDresDneDmgarterDltDgheyEatzDernfeindFleinDCtunDtistoneEeenDkoDistichDerDchellerDarseCstowDsukEolinoEelDonDiloneEchDcleEettaCrtushErumEletEhelmesEbergerEashDsoumEantiDrottFmEinerDnhurstEellDkleEesDillaroDgerstockEanierDemoreDdneyEaDbotEieDayugaEgerCntzDdulinDasiakClzariniDwinDtonDsigerDmosEirDlesteroFkDickEanDestraEnsiefenDdufDckburnDasaEfoutasCksiDowskiDlundDkoDeyDanauskasCjCioDnardDmaDlletDchChrmaselEkeDooraCgsbyDgerCdenaDdersCckfischDikDhlerGdaEhuberEertCbirackiCatzAazzaritoFellaCulayCoteaCeemByoobDlaClesCersmanCaiaBxthelmCBwtryBvrettCilarCeniDllinoBureliaCmendClettaCgustsonGaveDheCerswaldCbrechtBthaloneCanacioDmianBstrologoEellaCpinallCmanChlinDenfelterCchenbrenerFmanDenzoCanteDBrvayoCtmannDiceDCslanCrottEjoDizolaEanoDendellCpsConsteinEowEicaCntzDstDioDeCmengolDantroutCltCkadieCjuneCismendezDmasDesElCgandonaCflackCeolaDnalesCdmanCcigaEbaDhackiDaroEnoCbogustCauzDnasBquilDeroBpresaCpiahDertCostalDdaceCadocaBntrobusDoniukDioneEnarelliEchCslowDbroCnicchiaricoCglebergerDelsonFloCdruzziEoskyFlewiczEionFngaEackiFCceletCastasFDgnostBmsleyDdellDberryEaughCorusoDaCiciCesburyCbrosiaFgiCackBlviaDaroEnasCtroggeDomareDmireDenbachCsheimerCquisiraCoufDisiDeCmironClfordDexEryEnbachEgrucciCigDcubenCfisiDerezDandreDCexionDvrasDssandriniEiEcioDgreDaCdecoaCciniCbrittainEashiCawdiDBksamitCimaCelCahiBjoseCayiBivaoCuCngeClshireCdtCcklenBhujaCrColtBgleCamaoBffeldBeschbacherClingBdrianceCkinChamiCeyemoDsDlgrenCdicksCamitisDBcorCimovicCcomandoElaCamporaBbuaitaCshearCrantesEmovichEchinskyCilayCelleraEesCdulaDonCbedCatiDscalBavangCdlandAzylkaBwolakCingmanCerschkeCackBurinCppCmbrunnenCkoskiErDasCanichBoumisDlekDCrraDichCmorodiCltyDondekDnoskeDdesyEakCckleinBlotnikBiraldoCpfCnsliDiewiczDdellDCmmerebnerFlECllsEaDkaCetzElowDmskiDleschFrDglenEenbeinFlbauerGDchCckerDhermanEDcardiBgodaBeschkeCrkoDhusenCpkaCntsDiCmeDatisECllaDkinDenskiCilingerDdanCgarelliCanahBdonBbikowskiBazulaCveskyDaskyCrubaDrinehFlloEaluquiDlingDingDetskyEbskiCniniFDglDerDdCmpieriCltzDoudekDlDkDarCkowskiCjcChranDnenCgrobaDelDaraEmiCffutoCchmannEariadesDcagninoJiCborskiDloudilDarkesAyvonBusefCricicCillCengerCasaBsbrandBourshawDnkersEgdahlFblutDkersEanaaCrkeyCneyamaDamineCeckelCdisCciusDhamCbstBeubanksCttoCriganDbicCntschDnardCmchukBaxCunCsurekEiDkiewiczCntzerFDoskyDekDdleDceDagiCmbaoDakawaCgodaCekelCckerenDavoneEnoAximinesBaimoungkhounAwysockContCnottDansCldeCettCdnerBurzbacherClfingBruckCoeDbliskiEbelCightsCaspirDpeBoytowiczDCrthanDstelEfoldDrelDbingtonColsElenEemsDdmancyEhullEgateEfieldEcoxDckCnsikClvenDslegelDnyDmaDlyungEinEeyEanDkowEeDeverEslagleDanskyCjnickiChnerDlfahrtEerBlochBittlinEkoppEenbornFlsDhiamEfieldCszDselFhDlockiDcombeEhmeyerGanCrebaughCnzelbergDtersteinHmithGrothDrichDogradDlockEeyDkleyDgsDfredDebaughDdoverElyDarskiCmbsEerCltgenDlmschenEiverFnghurstFamstonEenbrockEarsFmsonDemanEczekDdenbergFmanDcuttEhDbyEersCkstromCgmanDleDelsworthCetzelDsneskiDnertFckeEandtDlochEgoszDdmannDckowskiEeDandCdmarDhalmDgeonDerskiDdowsFpEisonDbyDaBhyneDelDbrewCittmanFallElerEingerEewaterFscarverFmarshFcloudEDstlehuntDnneryDllockEeEbyCeldonDatcroftCaphamDiteBettlauferEererEachDselDhernCstrumElieEgaardEerhofGfeldEadDlyDberryCrringEeDnzDmterDkmeisterDbelowCntzlaffDigerDgreenDdolskiEelbergerCmpaCltzinEiEchDlnitzEensteinCkenmannCitzeEmanDsholzFarEbaumDnraubEbauerGchDdigEerholdChrweinEsElyDnesECggeCertsDmhoffDkeyCdmanDerCckmanEhorstCaklendBautersDerDdCttenbergFDlingCszkiewiczDmusDilkoDhorCrtchowDshauerGmDrenderDnstaffDmuthEingtonDdrupEhaughEallDchalDboysCntyDousDlassDgstadDekaDdlessEelEaCmserDhoffClvatneDtemeyerDsinghamDljasperEetFrichDklingEersDezakDdroffEhoffEallDbrightDatCkitaDaCisnerDkiDdenCgleDenblastCduskyDdenCclawskiDkenhutHeimDhalCananenDckAvyBukcevicBreugdenhilDemanCazelDnesFkBoytekCvesCrmelkerDachekCntungelnDniederhausEerDhagenDdrakEielingenDasekEllmenCltaireDlucciEickEenweiderDanteCitierCgtsCcuDiDciaBlietEmBizarroFdCttoriniDroDolasDitoeDeoCsnicDherDelDciaEeraDCrruetaDolaDenCnzDkeDgerDdDagreCltzDlwockEifanaFardEetasEasanaFrinFnteFcanaDeDcheckDardiCguerasDorenDnovichEauxFrathDierCewegDttiEorDgasDbrockCdalsCctorinDsikDicDensCapianoBetschDriCrtizDsluisDrilliEelliFcchiaDniEettiDmeerDlingEatoDklerEampDgheseDducciDantCnzeioDturellaEressEonDhorstDerableEmanDClvertonDunzaDmontesDlutiniEekampDetaDdkampDazquesCinoDgelCenemanBavroCutersCttesCszilyDtakisDiloffFauskasDconcelosCrsDosDnonDkeyDesEnhorstDdyDcoeCnwyeEoertEierenDvickleDtreeseDsyckleEtranderFeenburgHElanderDproosdyEouckeFppelenEattonDosdelDnelliDmiddlesworDlohEithDkotenDisouvongDhollandEekkenEarlingenFndelDgemertDeyckErtEpsEgdomDdesteeneFrschaegeGkamGheidenGgriendGarkFputteFnberghFgraaffFbogartEammeFlsenFgriffDcliefDbovenEecelaereDartsdalenEllerEkinEbelClrieEeyDottaDlangeonFdolidDaitisECirDdyaECgtDleAuyenoBsonCBrwinCtadoCsinoCryCquizaCpsCmenetaClaubCibazoChahnCeCchCbanicCataDnkarCBppinghouseBnthankClandCikelCgvarskyDerleiderFechtCderkofflerBmlaufCbdenstockBlrickCianoCdrichCchCbergBknownCenaCBhriCdeBdleyBboldiAtzeremesBysorCrusDolClCksinskiCcerCbergBwittCedenBuyCtonDerCstisonDchhoffCrsoDrigianoDowskiDnboFallDlichFEaDkinEeDiCongClkDipCgmanDglesCfanoCcknottDcilloCbeszewskiCasonBsuzukiDnodaCchannenBryttenDbalaCuskowskiDebaEaxDdenDcchiCottiDngoneDmbleGayDkeyDianiDglinDddenDccoliCitzEchDschittaGDppetEletteDncaDmmellDllingDegerCeworgyDvorrowEillionFgneEettDtterDstonDpagnierDntinellaEkleEhEbeathDmellingDiderEbDftzDdennickDcrociDbilCavesFrsaDtarDsterEportDnkDmpeEmerEeDchteBoyoshimaCwleyCviasCuvellDtDssantDrikisCtenCstenDicDchesCrtorielloHceDstrickEetDrijosFeEessFdEaDmaDkildsenCppiDorekEloskyDickDezErCncreyCmpsettEkinDoryDmolinoDjackDbsErelloDaszyckiFkiClzmannDstonDoskyDdnessCkuokaDihiroDayDCjoCintonChillCgniEazziniCdeschiCbolaDeckCalaDdvineBlloBkaczBitchenerFCssotDoCrriCpkaCntleDnebergDiusDelliDCmmreckEerbergDinskyEDchakCllberryDgnerCffCeszenDmeyerFnsDllDhenCdeyCckDasCboniDerioDbertBhyneCurtonEauDneCruneDeetsCorngrenFbrughEinDngdyDmmarsonDeneDbenDamsCixtonDstlethwaitDngvoldDesfeldEraufElbarEbeaultDaraCewsDophilusEdoratosDnhausDamCayDlmannDkeDdyBevlinDebaughCstenDseneerCrvortDriEeyFsEasasDneyDmeerDleckiDheggenEarkGDepkaDaultEndoCppoDlerDerCntDpasDnillEettDleyCmplerEeECltschikDschowDleCkippeCitsortEenbergDCgardenCffetellerDeraCesdaleDmerDkasinghCddickCbayErCatsDnoDguesDchmanDboBchakianBazzaraCyorCvornDiraDernaECutuiakiCttersDevosianCsseyDchereauCrziaDringFenEasDkentonDiqDdioDascioECppeinerCnnenDkerslyDiousDgrenGdiEertCmulisDburrinoEascoDargoEnahaCllutoCkiDeshitaEmuraDaokaCjiriCintorChuCgsDlieriCfelCdielloCcketCbordaEltDisolaEanDackAszymanskyCwejbkaEdaCufatDbinskiCerlongDkulaCczygielEepanekCalayDfrykByrekCphardCnanCmmondsCdnerBwirskyEesDetoniowskiDckheimerCetsElandDnkDetinCavelyDttEsworthFkiDrtzmillerGbeckHaughDnsenDlleyDisgoodElsDggertBvrcekCinthCetzElikButulovichDtellCssweinEexDorEevDichDanaCrwilloDanCnnDkelDdlingEholmCmsionDpDmarDlarDinskiEDasClzmanDtanaDlingerDeskiDcerDCkeforthCingCgliaDikiDgettCeltenfussCdersDarCcheckiEarzewskiFnekCblerDenDasicBtyborskiCvilCummeDlickDdyvinDbsonEleEitsEenrauchCryskoDuggsEdwickDowdEubEthEpkoEinskiDnadDitzkeGingerFtmaterEekerEckertDengthEmlowFelEjcekEitmatterFfEbEamsDawsEusbergEthyGmanFerEseskieEppEngerFdeEmielloEkbeinEchnCoyerEanoffDwmanEbridgeDveDuttFenburgEerEderDreDppkotteEaDltsEinskiEeckiFDjanovicDfskyEfregenFelsFaDeszDdolskiDckettCittsworthDpekDnettDllionGngerDelEhlEglerFDckrodEhtDbbinsCevenerDudemanDtzelDrrEnalEbackDphcoDnmanDmmermanGEarieDltingElingsDirEnlichtFigerFbrennerEdingerDhneyElyDfkaEfelEanovichDenoFeckFburghDcklineFelbergCazenskiDvisDumEffacherEderGDtzerDsinosDrwaltErsEnauldEekDplefordEfEelsDnsiferEojevicEickEdringGewFkeFfordEcleFielDmnosEisonDllonsFionFbaumerDileyEeEanoDhnkeEleDgemanDckenEheckiDblefordEbBramekBquinesBpurzemCrockDingateDengDatteEngEkeCotwoodClainCiwakDtznogleDritoEekDngolaEcicDllettDkaDgelmanDelmannCetterDrlDnardDilmanEgelEceDachCaughDtaforeIaDrDnskiEnausEishEfellnerDlingerDgnoliaDdeaEaforeFcciniDchtholzFEekBozziCwelsCulasinhDffrontDcierCtoloDerosGFCssamanDhnikCrrickDonEaDnsenDgenteDdahlCnzaDtheimerDstroemDoskiDnenfeldDderupCmaniFElskiClymaniDtonDoveichikDmonsonDlbergerDkowitzDiminiDemanDdersEaviniDankiChmCdekECcksEaloskyDhanCbiloCapesBnydersCowmanEdyCiffinCettingDllmanFenbergerHFbakerDathenGBmyrlCullColkoCithheartDhtCestadBluterDpeComkowskiFaEbaCizDppDmDghtamCeperDdzDchtaCaughterbeckGenhouptDightDdickEerBkyeCupskiCrochDipkoEneDeenDadskiCorskiEnikDkowskiEDcilichCinnenDllingtonCempCayDtteboDgerbergBiwikCvikCtarEcaCssionEacDneyCrutaDmonDkochDianoDacuseCplerDhoCnkovichEeyDistoreDgoDclaireCmunovichEelDrilDptonElicianoDosonEnisFciniDisterFonDenezDcoEheckClviEeriEanoDlettoEavanDesDbernagelCgwartDonaDnsEaigoDmondDarsCemekEDloffEigowskiDfkeDbeneckGbergCdermanFineDberryCciliaDhtaCbrelDellDayanBhyuCveyCuterDmskiDlundEteDkerDgarsDffordDbrickECouldiceDttonEkoskiDstDrtsleeveEetteDpenDntEerdFDminEerDllDgerCirtsEotaDnholsterEdleEaberryDmuraEskyEoDllingerFehDhadehDerlingCewbridgeDvitzDumakerDttleDrsErenEnElingFeEidonEdonDlterEmonElingEkoEineEhamerDkeyEarchiDinbergDhataDffoDbchukDaringEksCazierDyneDwneeEhanDudDstriDrrElinEkEitsEfEeDpskinskyEeDnklandDmesDlhoupDfticDdiackDckleDbalaBevickDedgeCurerCtteCrvanFDrettEandDiskyEngEeEanniDedaCquinCntiDoskDnoEerEaDerchiaDdroDcabaughCmonickDetaraDblerClvaggioDtzenDserDlekEbergDkingDibaDfeCkiCifarthDelstadChornDlCgurDraveCfcovicCetonDkDcharanDbergerCdmanDanoCcundaCburgDoldDastionCateDshoreDrdDngEeyDceDbertBczygielCurtiDllenCroggyDipterCowdenDrsoneDleriDccaCireDottiDeraDbiliaDabicaChwisowFerEeinertHbergGkerGgartGckertEassFrzenbachGtsGmFmbergerFlenbergFbenbauerGauerDuttlerFjerEringFeEppertEnerElthessGeisFleEhmacherEermannFpferFleDrottFpeEauderFndtDouvillerEnertFackElzenFnickEffstallEenthalGsteinGhutHardGemanFmerEborgDnickeEeidtmilleHersDmunkEoyerEeiderEaleDlottmanEitzerFppFnkFesserGperEesselmanFnskerFisGnFckEabaughDiverErpkeEndelEmlerEltzFlingsEffelbeinEebelEaffinoDettigFrompfEsslerErlerEppeFensEllmanGhammerEirmanFbelhutFEchEafferDattnerGErteEppellEndingFbacherFEmingFburekEefflerEdleFeggEbotFergEadtCerraEcyCattergoodDrsetErowFittEpaciElesEceDnlinDliceFDhillBazamaCysithidethDresDavongCwlivichDczyszynCvoDinaEllaDelaDastaCurelDpeDberanCtunasDtleyEerleyDiagoDchelCskaCrveyDoukosDnowskiFffDliEeyDelasDdiDconiDbacherDagusaEcenoDCppenfieldCnzottaDtyEorellaFpoloEinFestebanEhuffEellDsburnDpaoloDockiDnonEellaDlucasDjabiDgreyEiEhviFDfiorenzoDdrowiczEoualFraElianEiEholmCmuelsenEDpedroDoranoEkDideDberDainCltzgaberEonstallEernFDoniaDmondDlasDivaDerEkDdibarDabarriaCkonDelarisECjordaFChniCgoesDlimbeniDehornDayagaCfdeyeDaCdlonDburyDahiroCcheDavageErelloCblesDeanDatesFasoCagerDArzucidloCeszutkoBytherClantCksCherdDalCgalskiCbackiBvizBuysCuskaCttmanEingerDsDerDanaCstenDsnakDinkoEDhitiFaEdanDcettiDboldtCppenthalDkeCndahlECmmerEansDlerDinskiDfolaCllCiseCggleCescherDgseggerEgerCdzikDneyDisailFDduckCckyEdeschelCbinsDenzerBozoCxCwzeeDndDeyDcliffeCvinskyCupCttnerDhmillerEgeryEbartDenbergDandoCswickDuDsumEettoGerFlliDkosFpfDenholmFcranzFbrookEllaEbaughDboughDanCofeCnsonDhaarDesDchettoCmenoDbsDanoskiFiniGckClosonDlockEheiserEansDdDarkCkiskyCjaCikChaleyCgnstadCfkahrCethelDssnerFerDhrmanFenbeckDggeDfaroCdyDrigoFcksDinoEllasEaDenbaughEllEiguezDartaCckenbachCbleyDesErtelloElloGaDakCarxBivlinDiraDenaCtzertDellDchesonCskaDbergCpkeCnkelDikerDgmanEleinEelheimEbloomDdeDconesCmsonDarClifordChnDanekCgoniDgottCffonCevleyEeDsenweberDgDffDdellDchersDberFnFlingCdpathDlerDdockCcksonEmonEleyEieDhrdsonCbotDletBhymeConeyCedDadBezekCynvaanEozaDeCxwinkleCvordDenEalCutlingerDlandDerCtzlerDtkeEerbushDortDhCsureccionDtifoDnikoffCrkoCpsherDressDpellDinskiDenningCnzeDnixFngEeyFllDferDerDdinoDakerCmmenDenterFaricClkinCitermanDstEserElingEertFDoDnmillerEeDllDgnerDflerEelDdenbachChnquistDlerDfieldEeldtDbergerCglerDelEhrCfsellCenDmDherDchDberCdstoneDoDishDhageDenzEllDdrickEerCckleyGbenDineCbusiEldelaDeraEllFesCavleyDuDtherfordDneyDidDgansDdoBazingerDeyDaCysideDmosDgosaCwdingDCvensFhorstDCuzmanDtenbergDsinDnerDdebaughCttnerDleffDhmellEgebDermannDaczakCsherEdiEadaDberyCrangCposeDaCnsickDosDkhornDieroDgDdzinDcherEesEattiCmoutarDnaraseDlakhanDiroFizDezEriezDbusDaswamyEgosEdanovicHClkoDatCkelCjuDtarDaCirdonDmoDfDcheChejaEemDallCgusoCfananElkoCesCdzavichDuneElescuEenzDsekDomDellCckettDilisDhiEDedoCboldDnerDernEnsteinEloAquintasEliskEeEceyDlantangDckseyCeretoDletteCaresmaDnnDllDilsDasBadirApytlovanyCbusButaskiCrwinDterDpleDolDkissCmmelCltsEorakDlianEerDhamDetasiCidokasChuyaomaCffinburgerCeseyDloCddephattCcilloDBrzepioraCysCuzanskyDynDstEinskiEDetteCovisFneDueDtzDsonicDphettDntoEovostDkschEDiettoEaDenzaDbusCizziDvalskyDsockDntyDmozichDefertDdhamCeusDttnerDsterEselEkarDmerFauxDisingerFendorfDhmDgeantDedomCalleDgDdelDbhakarBoyserCupardCttersonFbaumDolskyEDesCstlethwaiteEinDpishilDkusDikCrtscheEoleseDriniDoDietisCppenhagenGFlCntonioEingDoCmposoFnioElunDoDeranzEllaDbergDaresCluchaDselliDnauDlinsEaraDiskyEoEczFarDchinskiDashekEkowskiEcoCitevinDsterDntonEsonFettCgarCetterCdmoreCczobutDketteDasangreCbreBlysCunketDmptonDemerCoverDetzEnseDcekCikerdCeetDasureCazzaDxicoDtkoEaniaDssmannDntierFengaEcarteDkkeDdsonBizzanoCvinCttsingerEmannDsenbargerDonyakDmonDfieldDekDassiCstulkaEoleDkeDhkoDegnaCrnieDkeyCppittCorkowskiCnnaDktonEsEermanDchbeckCmpareClloudEitteriDakowskiCkusElaDkarainenCjanowskiCgaoCetteErzykowskiFygaFopaoloDsDrsaulEiDpenbrinkDlochDfferCcucciDklEhardtDiniDerniDaroCatakDnaltoDcquadioBhounDnharathDmsoukhaEmasengCinazeeDllippyGansEavongCernettonDonixDnesBfotenhauerCleidererIDanzCiefferCeiffCautzBezzicaCvezEhouseCtrungerFlloFccoEsonEillaFdesEauskasDkusDietDgraveDerschickDawayCsnerDiriEnDaCrvineDtubalDschallDrucciDowEddyEchoDnoDloffDiaDgersonDeydaEriaEiroDdzockDchinskiDaroCquesCpitoCntekEarisDnisonEewellEacchioDingtonGerDgellyDegarDcekDaleEherreraCmbrookClyoDligraDeCkalaCineDghtalCersEboltCdaciDCctolDotEsErelliDhartCbblesCatryDrleEdDkesDchesBaywaDsingerDesCwelczykCvoniDlovicDelecDanCullusEdoCtutoDrunoDoineEckDkaDaCstivaFckDswaterEineauFDquinoFelFarelliDonDkertDhleyEiaCrtisFdoDsiDrillDolariDisioFerDentsDduhnEenDcelDboDayCpsonDpaDillionEkDarellaEiColettoCntoneDnhoffDkowskiDgelinaEalloDdaDcieraEhanaDasciErellaCltanavageDsgroveDovickEmaDmiottoFeroEertonGinDletFsenEazzoDittiEschakEottaEfkaDenikEcekDczewskiDasikEciousEChnkeDlsCguiriganDnozziDliariniCduanoDdisonDavanoCcubasDkinghamEebushDiusEDeyDasDAozolinsDgCminkowskiByuelaBwstonBvsanikCerlieEboDnCardBursoCderkirkBttisDerholtComoCleyBsuchCtlingFeDheimerDerstuckFdykEnsonFCsowskiECmonCleCkinsCendorfCburneCawaBrticDenzioCrantiaElaCoukeDneDfinoCkwisCizettiDsDnesCgovanDainCendorffFainDeDaCdnerDasCbeckCavecBprayChusCelaCatrnyDraBosterhofBnuskoCsteadCorataCitsukaDsheaCeelCdrusekBmundsonCoyosiCdahlBltzDonCrichCquinCpCmscheidDCivioEersonFnDsDneCexaDsnevichEkyDksiakCdaniCcusBksenColoDjieCerblomCajimaBhrenichCmsDannClandBguinnCibaCeenDCanyanBffenbackerBesterreichCrtherClschlagerBdoreDnalFhueCiaseCenwaldEsDarBctaveCkeyChwatDotorenaDiltreeDCejoCanoBbstfeldClenessCiesieCerlohEfellCannionBakleafDAnyswongerDethCBuvallieCsomDhCrnbergerCnziataDevCdelmanCcklosDeBovikCuryCtikDariCsisDelCrthcraftGoteDskogDridDquestDmannFDlundEeyDcottDbeckCononEeyCnakaClloraEmanDdaDauDCguerasDowskiEsekCftsgerCeldnerCcumDketDarCaksBiversonCttingerEerhouseDkowskiDenDchalsCssilaDhiguchiCppertFCnosDeCmocksDmerClsbyDlCkolasDirkCimiDCheuEiCggCforosCezgodaDvaDthamerDsmanDnowDdermayerFckenEDbylDCcoteraEletFaisenDkollsGElesonEelstonDhoisDewarnerEswanderDarryFBhepBgueynEnCovCheBewstedDnumDerDburgDallCvlandCuginDenfeldtDbyCstelDsethCrvisDpioCnningerCmzekDoedeDerClmarkDlemCithercuttDswanderEiusEhDhartDderhiserChmerCgrisorEetteCfzgerCeperDlonDdelsEamCalleyEenFighBayeeCwnCvoneDejasEdoDarCudCtielloDhooCssonDelliEDchkeCrezEsCppierDoletanoDihaaConeCnniniFeDiaDdaCmpelClepkaCjjarChassCeveDckerCdellAmyrumCintChrCerscoughButerspawDanaCszarDtafaaEDsendenGDhettDettiEmecheElDcaroCrrockEieEainDillaDelliDayamaEiCnzellDteanuEDshowerDlinDiDdingEaClvehillDryDlinerFceEalyChrDnCgicaCetherDhlbergerGachCcciaBrowkaDtzDchekCacekBoznettCyseCxhamCwrisCutouxDssetteEleyDnDlinosCstromEertDsesDkovitzDinskiDgroveDebachDchettoCrwayDthlandEaDsbachDreauDowskiElesDlasDgensteinDaschEndaElisEitisGesCoteDrcroftCntierGEesaFrosFfuscoFcalvoEazamiFyaDskyEegurDnetDjarasDiotDhollandDetEstineDdsEryEoEinoCmsenDayaClskiDlinsDitorisCkbelCistnerDlienChringEbacherCgroCermanDllmanCderoCczoDcoDarskiCbusBizukamiCyaresEharaEgishimaCttendorfFlstadtDsakosDhDaCsuraDslerDrahiDnickDemerDcovichEavageDasiCrichDavalleEsEmonCoduszewskiDCnsterDnierEeweatherFhanDkelDersEahDcherDatraFoEriFdoClushDtnerDsterDovichDmanDlraneyEotEisorFrenFmakiFchEandDkovichDitanoDetiEkDdrenEerDchDbertEauerDanowskiFeseCkuleckyFakDitaDelsenChlfeldDatschElkovicHCgnognaDlCessnerDrasCdcapCckleberryDhockiEelmanEalesHnkoCasBhoonBezzaDquitaDeraCyetteErhofferIerCuryDllerCttleEerFeEaDrokaDevierDaxasCstrovichDsaDidorDchinoCrymanDrettEbachDoneDklingDickelDcanteCoCnsingerDistEnoDhennettDgarelliDezEsezDdelowitzDclDCllorsFmEencampFkasDkonianDishDeskiEroDchinDbertDandezHrCiselsDghenChtalaDserleDolickDalicCgnaDinnisDgittEersDerCeterDskeDderCdowsDnickDichEateFnDezDberyDakCbusCasonDnorDgerBcwethyCveanCthuneCsweenyDpedonDharryCravinFenCquistionFlkinEaideFgeCpherrenDeckCnaneyCmindesElliamDenomyDarlinEhillCloyEoneDearDaughlanCkoanDerleyFchieEoneEnnieEllanDaigCinallyChendryCgwierDuirtEginDreadyEaffFdeDorryDlothianFryDaviskErrigleCeverDlmurryEhenyFattanCdariesFghCcumiskeyDredieEavenDoyleEppinEmbieDloughanEeveFntyGnanFesGrFarenDaskinErtinEmyFmackFanElopEffityCburrowsHughDradyCalphinEhaneyDboyBazikowskiDarCyzesDmonDeskiDcumberDalaCxinCuteDssDritzEeyDlinCtuszeskiFikFeskiDtuEierEhysEeucciDsuharaEenDrejekDlickDhewesEalDeyEsicErnaElicDareseElavageEaliiCstrocoviGbuonoEorisEeraFnbrookFllaDsagliaDlynEeyDinEclatDhiahEekDcotEhkeFioFCrzinskeDxenDvilleDushiaEngoEffoEcaDtinzGettoJiHaGcicFgDskeEhalseaEetteDroguinEeoDquenaDonaElaDmieDkstromFburyErofEovitzEevichFtteDiusEttEonneauxEnosFeseEcichDhoeferDgiottaDenEckiDconeFlineIaEhukEelynasEaidaDbusDazziFasEshioEnvilleFiFdiGerEdeCpaloCnzaDylathDvelyanDusyantsDtuanoEschEellEanoDsmannEhipDozcaDnieEesDliguisDigoldEatisFDgonEinelliFcavalloFaracinaEasFoangDfordDdiolaDchiniCmoranDmucariDerClysDvinEaezDuskyDtieEbieDphursDotteDlochDkasianDitEsEnskiFchalkEcoteFhDetzEskyErEkzadehEhEchDbaurnDaraEkanGiEfronteEdyCkleyDekauCjmundarDerskyCitenDnieroEelloDlesDgretChusayDargEnyCguetDowanEneDnallDlebyEayaDinnFElDgsEieDelssenDawErioEllanezCeweatherCduraDruenoDingerDhoDerasDdryDarisCczkoDugayDrowskiDombDnabDlaurinGchlanDkynenEsoudFEneyEintoshGderDiejFDhowskiFlEinskyEalekDchioneDallEfeeCbusDinsDaneCassenAlysenCnaughCkensBuvianCtteneggerDkinsDchmanDaoCskinEeyCngrenDdburgCmmClicDewiczCkaszewiczCisoChnowCggDardoCfseyCetmerDpkeCdtkeCczkowiakDkhardtEenbaughGDhenbillCbkeDellEDbockBozonDeDayaCyndCxleyCwthorpDekCviskaEgDgrenDerinkEnsheimerCunsberyDkotaDghnanFboroughDdenslagerCtsonDhspeichDanCssaDollaDierCrnaDimorEDettEnsEgEauxDandeauCqueCpusDrioreCotensDkadooCnnemanEDgiottiEhiniEendykeEbothamDdreEaginDabaughCmuDinyDboyDartireCllieCkkerCiaDCgronoDossoDgainsCflenDinkDgreenCewenthalDurmDrzelDppkeFDgeringCdholzCckeyEbaumDhteEanCburDanBlorcaDidCewlynCanezBiwanagCvernocheCtzenbergDanoCssardDkoDcioCpskarEcombeFhutzDphardtDinskyDaniConsCnnertzDksEowskiFDgafelterJDdzyEmanEertGsmithHGholmEburgEamanDcicomeDbergDamenCmkeClyquistDoiaDlpopEickGhDienCghterDginCftonDseyDfordDerCestDmCdkeDdiardCckDhtenwalnerHfeldEakDerioDausiGeCbmanDeraCawBeyaCwittDandoskiCvoyDitinEstonDenterFhagenEilleeECttreDscheCsiakDhinskyCricheECpriDpkeEingEDoConhardEelloEaDfskyCnsingDociDningtonFhanEDkiewiczDisDertzEhanDciDarzCmucchiDickClahEcheurCjenneCitmanEhoffDstikoDpertDbertFChnertzDenyDarEneCgorretaEffDleuDionsDgatFnsDaardCftCesmannDmasterFnsCdwigDlieDerhosCcorchickDlearEareDkmanEbeeCbrecqueDahnCavenworthDtherberryDmerDdyBazzeriDariniHeECyngCwsheDmanDerDareCvistaFEolaEnderDernEneElettDanwayFchyEletteFaEdieECutzenheiserEtDserDrimoreFdsenEeyFntiHeGitisFlliDkitisDdCttrellEnerEerellFnEariFnziDifCstufkaDswellEesonEaDloDkiDhuteEmetCrrieuGrFbeauDondaDneyDitaEcciaDginDezDdinDchCpusnakDreteFEaddDoreDinskyEdDerriereCosCnttoEaffDsonDoisDiusEniDguirandFellEstraatEreckEkabelEillEenessFfelsEaricaFgerDfrancoEearEairDdvatterEolfiEborgDaganCmpsonFhireDoreuxDbrukosFakisEorneEingDaxErchCllaveDkaCisDryDbenChrenDnDmersDCgoryCforrestDloreDkasDieldDayCducDererEllDakakosCcoyDkiDioEnskiDhowskyDerdaEDasaCbruzzoEeDoveDerpoolDbadiaDarbaEdyAkytleCmCBwasnickiDpniewskiDngBuzminskiDelCwaharaCtCskoDickCruvillaDtulusEisFchDkowskiEeyerianDitzDelkoDcabaDaltCprewiczDetzCntzmanDishigeDdtzClwickiDowDisChlmeyCfelCesDhnelCdrickDlacikDejCchelEanFCboushekDishtaElusDertEikaDasikCakiniBrzystonDeczkowskiCyzakDgierDCupskiEkeEanskyDmviedaEholzEbholzDdopCsticCoviousDmmesFDlakDesEningFerCitterDstyEmanDegeDdelCeulDtsingerElowDsalDjsaDinesEgDfftCauskopfDttDssowEneckyDnceDjcikDilDhamDckBozloffEakDeraEeCyamaCwalowskiFchukCvalovskyFcheckCutzCttsCstykFEohryzEiukFsFckDofskyDmanDinEerDenDcoEhnitzkiDbabDackCrzepDvinDtkampDnrumpfDfhageDdusDchnakCppingerDinskiDaldCoymanDpmansDnzDkerDchCnzalDyeDtogiannisDruffDowalEpnickiFackyIiDigEckiDecniDdelDakowitzCmlosDbeDatzClmDlmeyerEaschDinDdenDboDataEgaCkocinskiECinzanChrmanDnzCglerCetsDrwitzDpDneckeDhlyCcklerEaDiolekCbieBnudsuigCotenFkDleDchelDbbeCightstepEgeDfeDessDckelbeinCeislerDedlerDdlerCallDbleBlymCussmannDeverDdtCoudaDtzbachDsowskiDckarsCinkerEgshirnFelhoetsKferCenaDmpaEischEensGcicGDinhenzDchaDbanowHffCaveDngDmmerEetDersDcicBjarBivistoDelCtzrowEerowECszkaDtenmacherDickiDakCryloDsonEchkeDmerDakosyanCntonEDslandDlockDiDgsolverEdonDdschuhElimannFEbergDasEjCmberlClloyEetteFrEaryDgorDdooDborneEertDCjekCewietDverDszEslingDlarDhnBhosraviDlodivkerDCatibEcherianBeyworthDlorCwanwytewaCttmanElewellFEelleDhcartDayCslarDbyCrneDkDcyEhalDbelCnrickDnisFnEemuthFltyDkelCmmerlingDfortClstromDlowFmDkDiiholokaiDcourseCkuaCigerCglovicCeseckerDhneDdahCdingCavneyDnuDgyDffaberDdleBazemiDanowskiFjianFCweloCvanahCutzerDkolaDfusiEfeldCtowiczEsDhederDelyDaCstorElDsoufElerEamDkeyDimisDdonDchmitterFelCrrattiDpinenEenDmannDlovichEenDkutDinEgerDaffaCpsosDpsDnickCnoaDneyEasDduthCmpmanDimuraDensEmotoClvaitisDtenhauserDlochEerFnbergDiszukEnoskiFgerEchDfusEayanDertEnkoskiFEiwaheaEelDdasDaweEthasCkosCisermanEDliponiDghnChuhuDounDenDaleuaDCgyDerDariseCffkaCempferEmererDlkerCdyDnerDlubowskiDakiaCcynskiDicDhCbrickAjustmanEineCrinaEkDcikCniusCmalonClcaCiCganCartBoveCurneayDngDCsilowskyDephsenGpaulineCrdeCorCnteClieChnkeDanningmeieCergCchemsBilkCBhonstonBezCthvaEroCstDkoCrrelDichCntschDsvoldDnrichDiousDckCmenezClleDinskiDeniewskiFCffrieEordCdikCbbettBayesCvaroneCussECskolskiDionowskiEnCrzynkaDvaDuisDossDetCquessCnovichDnuschEDkinsDitzEckeDgulaCmonDmerDieDeelCkupcakEbczakDowichDemanCgneauxDherCekelCdinCcobowitzDkstadtEowiakEiewiczEelsCbourAizsakCarrarasBwasaDnyszynBuloDiucciBturbideCkinBsbyCamDlesDcksonBrizarriDbarrenCaniDchetaBottCliCdiceCannidisBntriagoDerranteFmillCscoCloesCgrimDlinEeseDalaCfieldCestrozaEonCdestCcorvaiaCacioBmparatoCmCfeldCaizumiBllescasBkutaBinoBgnasiakClerCelBffertBdrisCemaBchinotsuboGseBburgBarossiCnnacconeCmsCcovissiAhytrosDenCsingerClleDinskiBvizdosBuygheCusCtslerDchenCstusDoDniDlanderDkaDhDchleDaykoEniniCrtisEerDringtonFganDlDbanCntenDdemerCmerickhouseDbelClstineDmCitzacuaCghlettDerCeweDlsCdrickDekCckebyCbrightFcDelBsiBryniewichCovatDnickCibarBozempaCxworthCwrylaDisonEesonDdeshellCvingEDelsonFlCutenDstenEekeeperDpeEDmanDghlandEasCthanDchkinCsteDieDendoveEmanEckDchouerCrwoodDuathDtillosaEhDsfieldDniakEbyDmanderDiiDesDaneyElCpskinsDpeschCopengardnerDmanaDlihanDfCnzelDseDohanDgoEerholtCmolaDerdingDchickClyDveyDsingEhueDlenbergFmonEaDkaDifeildDetsDdtEnessEinessEaDceyDbeinCiumDslChstadtDowskiDCgyDstenEetteDginsCflerDfstotFchneiderEeeCevelDrnemannDperDnerFDkeDgDflichEfnerFligerDckerFDCdgenDanCckemaDhschildCbkirkBnatowBledikBjalmarsonBitzlerDtmanCsmanCrsteinEchhornGeDkalerDaokaEkiCpwellDpoCnseyDkeyDishDgstEleDdinDahonCmelsteinCllburgEaireDgertDdredEahlDcherCguerosDleDinbothamCeserichCdvegiDrogoCcktonEonbottomEertCblBeyveldDdelCvnerDesyErleyFinCusleyDbergerCttwerEDerCstersDsongEingEenthalerFllFeDbyCrzbergerDwoodDtingDscherHlDrlingEigFageEelFDpolsheimerDnandersDmosuraEieEensDklotzEertDbyEsterEisonEersFinCppeardCnrickEeyFttaDnebergEaginDingtonEfinDeyEseyEhanDdyEerosnGFeDbyDaireCmrichDmieEesDleppDinoverDauerClvyDsingDmyEstetlerEinkEcampDlarFmsDkerDgesenDfritzDenaECktnerCjlCitschmidtEgerDnzmannFenEingerEekenDmrichEbaughDermannChrCgreDmannCflerDflingerCeseDneyDmstraCdrichDgespethDemannEgoreDdlestenCckenbergCbigDdenEaCatlyEhershawDrsonDllyEanDdsBazletonDarikaCyhoeDdalDburnCwthroneDmanDkeyDfCviceDercroftCutamakiDskinsDlterDgrudDanCtzenbuhlerIehlerDtubEierEeyerDstatDhwayDawayCssickFanEelmanGbarthDperFlDkeDgillDenCrvistonFllaGiczEerDtzerEupEsoughFchElyFepGinEkopfEhunEfielEeryGtEageDseyDreyFttEalDoutunianDmeyerDloweFffDdymanEsErictEmonEigreeEenburgFllFbeckEamanFkerDceyDbickDajliCpperDgoodCnsteinEburyDoldEhanoEDnsEifanEesDkoDisDenkratEmannEkDdzelEwerkerIEsakerErickEelsmanEalDcinDburyDawayEhanCmsDmerlyGenEattFrlundDlingDissEelDelinckDbrechtCloDlingerFckDifaxDgrimsonDfmannDderEDburntEerstamDabyCkerEnCineCgosDmaierDensonFeFbrokGaughCfterDflingCegerFleCdeDderDcockCczynskiDkleDhigianEezCbrockDowskiDinaDerkampDbenDashCabyAgyatsoBwalthneyBuziecEakCysDnupCtzwillerDtmannEingEeridgeDerrezCszakDkyDcioraCrryEieriDitzCnstDdryEertClsvigDisanoEnsonCittarEardDstiEkiDntoFherEnipDlliamFeraultEfoilDjarroDdettiDberteauCgerCeveraDterslohDriniDllaDdeaDchoCdisCckinCbermanCardipeeDnioDgliardoBrzegorekCybelCunstElienEdmeierFhoeferEDmerEDhnDgerDdtCowneyDttsEonEelueschenEbergDsswilerDnowskiFskyEewaldFrtDholskiDetkenEschelEneDdeckiDcemanCiswellEetaDnkleyEieEbergDmmiusDemeCeytakDttDnkeEdaDinkeDevesGrEtEnlunGerFhamDbinCboyanCawburgDtteloDsshamDnvoldEthanEskyEdolfoFmaisonFchildEboisDmoliniEmaticaEcDjekDheDgsonEertFDfensteinDetzDcelyFffoDbarczykBouzalezDseDrdinDdelockECttlobEkeEhelfFardEerDscheGallCszDtonDsackDdinCrzDrillDntoEieDenbergElliDdinierDaCpinEeColmanEdenDdsiteEmansonElyEkinEielCnzolasDsiorEethDezDchoffDalesCmzalesDoraCllyEiharEhoferDkaDinskiDenEmbeskiGaDdwaterEstockEklangEbeckEaCjmeracCichChlkeCgerElDaCftonDfeCettingDserDrnerEkeEdelDppnerCdsmanDertElCbeliBnasBlucksmanCotzbeckerDecknerDcknerCishDcksonFenCewDssingDichmanCazenerDveDusierDtzelDssettEbrennerDduDbDabBizaCttlerGmanEingerHEhensCsselDcherCrstEchDonaDilloDeDaCovanettiDnestCnglesEeryECllstrapFonEottiEmorEissFgEertEcrestDgourFreDdingEermanDcreastCesemanFlmanDringerCckCangrossoGegorioDmbraFattistaBhibaudyDanniCelfiCazianiDnttFDemmaghamiBeyCtlerDchiusCsualdoDmondiCrweckFDulaDtsenDsheyGnEDritsenDdsenDczakDbatzFDacheCorglFiadisFelisFalasCnualdoDteryDnockEettDettDdernalikDasECmmenClstonDlmanDfoDenDbowitzCibigChlhausenCffreCesamanDlCdmanCcklesCbbieCarwarEldsBayneDfieldCwlasCuwainDfinDaniCstleyEelloDsowayDparinoDkeyDerDcotCrutiDringtonEehDnandDlitsDityFtyEetyEaEDetsonElikDdingDbDashaCnzerDtertDotisiDnerDisonEeDgellGDeshDdrudDasCmbyElesClyanDuskiDperDlwasEuzziFpsEosaEipeauEetFraniFglyEatyFspyFnderDiotoEcinaoDerDdonDardiEmayEbeasECitorCggDanCerlanCdleyCckeDiaDhCbrelcikDayErdAfylnnCdenkevezButterCseDcaldoCrstenbergDmanikDloneDiaDerDciDbishCntClkerCkanoCjinoChrmeisterCgoCermanBrymyerDlingContzEcekGDlichDioEdDehleCischmanDouEtDezeEszEmeringFanEdrickFleDcksonFelEhetteEanoDbleyCewingDverDudensteinDrkingDngerDisnerDgeauDedleDaseCazeyDsconeDnzmannFettiEkforterEcyFkowiakFiesFhetteDlinEeighDintDgozoDcchiaDbizzioBousekDrakerDcaultCssonEatiDnoughCrtsEhmanDstingFedtEhayGwGDroDnoDlivioDkoshEanDcelloDadoriCntaneDgerDeyDdyEowCltaDlinFardEeyDkenCilesChnCggsCeschDrtschDckingCdnessCatBlotDsiDrenzGsGcioFaEczakDdinDckeDCentroyEardDisnerDctherCaksDgstadEelBjetlandBixicoCumeCttererCsetteCrlitDesteinCotodimitrakFCnnerFfrockDgadoDelyDcelDauCmbrezCloteoDlpotEareDipskiFpoFovicFelliEmauaDhiolDgoDedsDbertCgueraDliolaDartCetsamDselmanDneDldhouseDbigCdelDaCckertCatoBevoldCuerbornCtchkoCshDerCrrusoEioloHaEenceEarFnFizDozEneDnstromGaedtEowDkovichDgenDdolageEinandsenDbracheCnnewaldDkDixDdlerDchelClskeDlingerDicettiDdpauschCighanDchterChrleEingerCgaroCenerDlerCdorchakDerowiczDdCautoDgenEanesBazzinaFCykoshDardCvuzzaDoliseCussetEkeEelEcettDlknenFenburgCticaCstlabenEicCrzanDstvedtDinDguharsonEnoliDfallaDeseErDaldoEjECnzoDtonDneyDizziEonDelleCltermanDsettiDloneDkiewiczDconioCkeCirleighChringerEenkrugCerberCdleyDeleyCcundoDkDeCbyDriziusDozziDiszewskiEnAezpeletaDarzaByrichCermanBwoldtCardsBvascoDnichEgeloBustaceCgleyCertzBtulainCchellsBssonDkewDeryElinkCpinolDenozaElienFandDadasClerCkeDaCcuriexDovarErtDhrichEetteFnEbaughDalonFeroCbrandtCaryBrtmanCohCnestoClenbuschECkeCichsenECholmCbsteinFBppolitoDihimerEchBntinCslingerEenCocksonCnengaCmanCglettFsonFrthEDholmDelkenHmierFhauptFbachCdriesDowDitoDerbyCcalladoBmziahCbtDsDeltonCardBlwongerCvsaasCumbaughCstnerDmoreDkampDhantCmbladClsonDiasDetsonEstadErtFmannFbrockEmanDarsEndCiezrieCdibDertCbeBkwallCholmCenBitnierGarCsenzimmerFstadtGmithElmanDbachDamanCkenCbellBhrkeDismannDenfeldClmanBgiziDttoCgemanBffronBdnieCelbrockCdeDBconomosCkolsDloffChegoyenBbiaCerlinCbersBasterbrookCrneyDleywineCnniCdensAdyronCkhoffCersCdaCbalaBwaneDileebeBuverneECsenDatkoEblonCrretteDpheyDninDkesDetteDdyDchDacherCprayDouxEnteDerclayDassErCnwiddieDsingDnavilleDcombEkleeDayEkinCmpeDesDdeiDayClkisCkichDasCinCgoCewallDmmelDlmDberCdmanDakCckhornDhschererDatEsCbykDillEanskyDaldiCaBspainBrzazgowskiCymonDlieCuvengaDschelDngoCozeDuseDttDsickDneburgDesslerFchDbnyCizinDppsDnkleyDllockDesbachCetzkaDsnerDntlawEonDhsEoblCdaCaxlerDthDpeauxDgulaDftsFBozerCxtaterDieCwstEonDntonDlenDeyEryCutyDghtryGeryCtzlerDtererDhardCsherDalCrsoEetteDoDnfeldDkinEaDgeDchyDameCplerDicoCoreDmsCnnieEelleyGDayreEtelloEchieCminiguezFgosGaFeyDengetCloresDlyhighEenEakDeacDchDbeareCkkaDesCireDngChringDogneDnalDanCerleEhoffDmeltDhringDggCdsworthDooDierCckendorfGCbrowskiEinDineDersteinBizerCxeyCvitaDenDalerioCturiDtonCsspainDparteDmoreDilvestroDhongEianDethDcenzaCrksonFeEerECpippoEntoEerroCnnocenzoDizioEsDgivanEfelderDcherCmucciDpsonEflDitrovDarzoClsDisioEbertoIiDesEonardoEnaCjulioCiulioCgiuseppeDaCfillippoDebboCengDkmanCdykDriksenCckusEowEesonDastroCbenedettiBhaliwalBezenzoCwyseDinterDatersEeleCvotoErEogdDivaEtisFDeyraEricksEnutoEjaDaughanCutschendorfDinkDbnerCtzlerDullioDoreDhlefsenIDambleCsrevisseauDotelEDmeulesEarisDilvioDhpandeDchambaultEampsDatnikEmitoElleEkCrwinDtingDrahDovenEssoEmerDmottDingerEcoDgaDflingerDezinskiDckDbacherDanickCpuydtEngDreeDpertDierreDhillipsCojayCnzinDtenFlDniesDinaDgerDekeEgreDboerDapoliCmskyEeyDottaDmonsEanDendoncaEesterDbowskiDarceEnEllieEireClwicheDphiaDoreDlenbaughEbringgeEarattaFportaGennaFcioppaDibertoIisDgenioDcuetoDaurieFderEtrinidadEshEetDCkreyCjoieCitersDmundCgrenierFEandDonDestonElbeckDaustEsparreCfreeceDenderferEeCekenCdonDinasEckeFCcristofaroDoudEsEntiDkersDioDenzoCbrouxFtEayDoefDiasioDettigniesEnedittisDbinsDaeckeCarsonEoEdonDquinoDcetisBayneDemCxCwoudCvittFoEdoffCutermanDghtertyEaardDdelinDbendiekCttilioDcherCsovichEDiluaDhemCrouDkeDginEaDcoEeyCpasCntosDsonDnyDielianDchetzDbyCmrowDoursDboiseEaklyFchDascoEnnCllmeyerEesandroDfonsoCkinsDesCireChillCguioDisCbdoubAczerkiesCarnotaDchorFBypressCnthiaClkowskiCfersBwiakalaBvetkovicBuzmanDickCttlerEDiDforthDchinsFallCshwaCroDbeamCnnickDeioDdickCmbaaClticeDlityFpFferCcvasDulichDinoCbetaBserBrupperDnkiltonDdenCoverDuterEghEchetDsthwaiteDonDnshawEenbergDmeEanDgnaleEanDasmunCistoforiFianoEanDngleEcoliDllDeghtonDdgeDblezCellinDgeenDeksDathEcyCazierDwmerEhornDtinDpserGDnmoreDmmEblitGetDginDcasBozzoneCycoCxeyCwperDettCvoneDillDertonCuncilmanDltrapEasDghenourFCttyDhermanGCstantiniDsellEanoDleyFttDkeyDgrayCrzaDviEanDsettiEcaddenEaDrowEiceEeroFaleFDnaDkeDidDelliDdonnierGaDakCpplerDelanCoreDnradtEesDkusCnvenienciaDtrerrasGnasEornoDstantiniKeauEolverDrathDnetFrlyDliffeDfortoDdaDcaDalesCmponoEauDmendatoreDingsDboyEassCltrinDpetzerDonelEmbiniEgieDlaDbethEaughDasuonnoEpintoEmarinoElucaEianniEfrancescoEceEbellaCggsdaleCffillCdispotiDellCcorosEpotiElaDkleyEeyDhronECbdenCatsworthDrseyEBlymoreCumpnerCougherDlingerCinkingbeardEemanCewesDmmentsCaypoleEburgFronFonDughtonDseDrenbachDnkscalesDmpettDessensDburnBitrinCsneyCrriCproDkowskiConeCnquantiDkCmianoCervoEsCcoraDioraFneDerelliDcoliniEaroneDarellaCarlettaDccioBhutaDstzDranDmblerDbaCruchDistlerGinsenIatGelloFpinFmerFlipFjohnDestmanCouteEghDrltonDmkaCmelicekCiulliDslomDrasDnziEneryEickDmDlversEoDarmonteFenzaEpettiChuonDourDeangCetramDssherDrrierEepyFnfantDnotDliDcaDathanErsCauvauxEdoinEarriaDttersElosFeyDseyDrvesEskyEaniaDplenGDnnerEderDmpeyGauDllenFEkleyEetEcraftDixDdickEbournDbanBesariCrvoniEinDtalichDniEeyDeoDceDavoloCparanoCntrellaEnerEanoDatClmerDenzaDadonCfarattiEloCdillosCciliaDhiniDalaCaseDrnsBazeauCysonDananCvallarioCuthronCttrellEersonDroneDoneEggioDerinoDchingDalaniCstrataroEoeElesEillanosEelloneseGhanoDsmanEiusFsseEemEaniGdraDolaDelliDconeDburnEeerEarroCrrinEekerFaFEauzaFnzoDpinelloDolinDmolliEenaFllEainDlyeEstenEoughFneDingiFeFDelaDdonoEleEinaliFEeraDbackCpuzziDracottaDpoElemanEarelliDoneraDlenerDannaCoiliFeCnzioDtoranEilloEaDonicaDningtonFffDgasDevazziEsElesDdidoEersDceDawayErteFioEnCmrenDpusanoEmanDmDinosDferdamDerenaEllDakEjClwayDvinoEettiEaniDtabianoDnimptewaFckEenDmeseDlanderFbrassDizEjaDgerDendineDderaraDcaraDamityCillerChoCguimbalCdoffDdickDaviecoCbosDiltesEbboDelleroDassoEllesEdingCalAbyraCodCnonDerDamCkerBuzziEeoCtzenDtzEerisDkiewiczDeauxCstadDsoneDmanDhmakerDcheCrwinkelDumDtlessDsiDrupEossEiesFchterEelliDonEDnsteinEaughFpDkdollDisEngtonDgunEieEhardFEasFrdtFDdessDcinEhfielFessDandtConannoFmiciCntjerDgertDdschuhCmpsDanClosanDlocksEieDarzEndCjarskiChmannGCgnaDlisiDgyCemiCdkeDerDdsEieCczakDkwaldEovitchEholtzFananDhettoEauerDciarelliEheriDaramCbisDashEkBrzostekDezowskiCytonCusuelasEsellEchiDndrettFinDmetDleyDkDgDestleDdnerDccoleriCozieDxtermanEDwyEnleEmEardDuwersEsardEghtDthersonEemarkleDssoitEciousDomsFhallEkshawFhouseDnchettiDksDidaDhlDglieDfftDermannEnnekeDdnexEkaEishDckelmeyerFbergEhEcoliDbeckDadstoneCittmanDslanEkEentineDnghurstEdelFaEcksDmeyerDhmDgnoloEliaEhiDentDdenbakerEdellDanteFsEgasCevoDuDttoFhauerDslauerEemannDntariEningEhaugEgetteyEekEdalEaghDilingEdenbaughDhantDgelDdewegFhoftDcedaCaylockDuseEningElioEkusEcherDtchettDsseurGrDnstutterGadFcombeEnickEdoliniFlyFenbergGisFalEciforteFheauFatiDmletteHDkhageDitmanEstedDdfuteDcksFetEciaDamBozzoneDenskiDardCysonDlstonCxwellCwlenDdleEichDardCviaDeyEnCuzaDwmanEkampDtietteDrsawEretEgoyneDnleutEdDmaDlerisGDghmanFamerDdoinEewynsCtwinickDtoneEinoFcelloEenEaroFlicoCstelDhesEardDellDcarelloCryDsariDokEdecDnmannDmuthEetDlingEaceDkinEenhagenDeenDdinDcherdingCoteDrasDdyCntonEempsDominiDinaEferDgartzDessEfontFieldDderFEanzaDaviaEmoEdurerCmkampClogniaDlichEackerDinskyDdosserFnEaDadoCkenDCisselleEenEChsDnenblustDligDincCgumilDieDgioniFDenschneideEmaEDdanskiGovichCettnerDsigerEelDnschDleDkenDhningElarCdwellDreauDovskyDaCczarDlairDkemehlDhenskiEatEDcioEhicchioEanfusoCbzienDsonDinoEerDeckDakCartsEdwineDldinDkyeDdyBlundenDmenstockCovinDuirDschichakDomeEdoughDnderDmmerDkDeserCinksFaEeDckemCeylDwsDssDnnerDimehlDckerDasdaleEkneyCatnickDskiDreDnzyEkumseeEcettDichDdaDckbumBjorsethElinBizzaroCvinCtettoCssoDkupEachDioEDhardDesiDacciaCrtcherDrittellaDkhimerEeyDingerDenDdetteDakCoCnkerEDglerEertEamonDdasClsonDlowFnFEeDisEchDerEkDdenDazzoECgusDgartGDaudCesheuvelDrnackiEleyGinDlefeldtDdermannFnbenderCddulphCckslerEesDekDaCbianoCangoneCBezzoDdicekCytDdlerCvelacquaCutherDckeCtzoldDtmanEinoEerleyDancourthCsselDkaDchornerCrwaldDumDtottiFrelliFldoGamiEleyEeottiEainaDstlerDniardEdsenEadetteDlinskiDkstresserFEovichFffEhimerEeryDgmarkEaDfieldDeznakEskyEngerFdzenGtDczelEhDbesDardinelliCppuCnzigerFeEangoDthallEancourtDsbergDnoEinEesDkenDikeEgniDestadDdtsenEisFgEettiFleDasherEckCmbenCltsDroseDnasDlusciEosoEizziFnghausenFardEettoHiereDkoDitzDfantiDdonCkisCjcekCitlerDserDneDleyDerschmittChrleEanDlmerEkeCguelinDhtolDerEalCezleyDsmerDrerFEbohmDnelDlbyDckenCdorDeDdowsGEiaCckyEiusEfieldEemDenaCavisDumonteFanEharnoisEdineDslyDlesCBazylewiczDnerDelCytosFnEDlockDirdDgentsCxaCwnerDdenCvelasCuskeDmbergerDlCttuelloEigEermanEaniFglinoDimonDhkeDersDchDasEraElaCstineDsaniFliDkindDemanEhoreDaraCrzeDwellDutEffaDtlomeEinEholFellEersDswellEhawDriganFaEasaFcoDnthouseFDmesDkhimerDiosFEnoEeEckDfussEknechtDerEfordDdisDcleyEhickEenaDburEorEinEenFllaEagliaDanskyEganCquiranCnzhafDterDkowskiDetDdtDaszekEnaClqueDowskiDlogEinaEenskyEatoDigaDdomeroEenFEassareDbontinEasDassiEndranCkkalaDhshianDervilleDalerCjajCitesDstenDramDlardDerlDchanDChrsCgozziDniEatoDlioneDgioEesenFnstossDanCesslerDrmanElocherCdgeroDdourDamiCculpoDioEgalupoDhtaEarDchiCbrowDonisDishEckeDeuCabAazzopardiCoreCenBykroidBxonCelradBwkardCenderBvonCirettCeritteEbeckDllanoCaryBuwaerterCtranoDeriCstgenDdemoreCrichCmenClerCgustyniakDlianoDhtmanCeCduongCcterBttianeseCilesChasBsturiasDrupDleyCsanteCpdenDacioCleyEsonCkvigDegrenDamChmenDauerCfourCchoffEimEanCalBrzoCvesenCrowEchaDisEbasCquittConeDcheCntDouxEldiDingDholtDdorferCmsonDentClottaDinghausEaCkemaCizagaDsumiEtideEDfDanoCguilezEdoDrowDiroDetsingerCfmanCenburgDdondoDaCdryDnerDizoneCcudiDizoElaDhillaEangelDegaCbucciCatoDnoEDganBpostolDlitoClandCkinCergesCalateguiDezBnzoraCtonsenElosFiniDmanDerCspaughDelmCnonioDichiaricoEbaleDarumoClikerCkrappDenmanChornCgtonDrisanoDonEloDletonFbrandtFaEadeDillettaDeronElottiFbeckFaCezCduezaDrulisEonisEeuFoniDertFlikCauoDstasiadesDniasEdBmusoCrichDCourDssDrosiDakoEhCmiratoDarCirianDotDdiCeduriCdersonCbuehlCassDnzaDdioBlwangFCvineDarranHcinEnezCuqdahCtshulerDonenDmillerDkenDieryDhiserDarasCstromEadDburyEerryCquijayCphaConzaDiaCnasCmericoEnarFClwoodDstottDridgeDevaEnsonFbaughEgrettaGaDbrittenDaraEmonCkenCizadehDrezFsDneDmCgireEerFnCfonsiCexyEnderDssandroniDrtDmanyDkseyCdertonFferDavaEpaCconcelCbornozDiniDergottiEnEaDangCarioDmillaDlemBkoniClesCandeDmineBjasinBiyerCharaBhrendesCernsCaroniBgunosDliarDillarDdoCorasCnorDiCersDlBeryDtsBdonCessaDrsonEmanDmaDlsbergEblueECdiegoCasDmcikBcquillaCkmannChterhofDaneBbuhlCrialDeauCoulahoudEdiClaoCilezCeteDrsonDlmanEardoDdelahCdulmateenCatoBasCrestadCnensonAzymowskiClaCbiaBwolskiCigartBuwkowskiCrovecDkuhlenCppaCnichCmpfeDaltClkowskiDferCggCerleinDhlsCckerbergDhelkowskiDchettoEaCbrowskiDizarretaBsadanyiBrakeBottiCselCltekDlaCgopoulosDbyBmekBitzmannEelbergerCrkerCnzowCmickDermanClkCgomalasCesmanDrnickiEkeFEenbergEdenDmsDgerDbertCcafooseDCbellCadaEBhenBetzerDinoCrpheyDcherDanCphyrClonisDlingerDkoDiffDeznikCkriaCidmanChrerEbachDerquistEnderCgarECchielDcardiCbrackiCavalaBbierskiBazaCyicekCwistowskiDaskyCvitzDerlDcedoDattieriEckyCuschCtorskiCrrabiDlingoDinElloDenCpelDateroCntowEDniniDggerDfardinoDardiDCmpellaDoroDboranoEelliClameaCjdelCisChourekDarekCgulskiDackiCdinaCczekDhterEariahDchiniCbenkoDboAyuskaDcakCrovicDekCnesCmasCkCdellBsaguirreBrayBozzoCvanCussefiEkoDnghansDmonDlaCtterCshiDephCrckCnoDeokaDashiroCmesCkelCestBnocencioBewellCtzerDskoCrtyDopoliDkaDginCnorCmCleyCaregoDkelBazzleEiDdaniCwsCsikaCrwoodDrisDochDmitskyDaCntziDnucciEayonFntuonoDkovskiGitchDdowDchikDagiharaGdaEcekCmanohaEkiClonCklinDeCivaDshChneCfusoDaieCculloDovoneEubAxyongBayasithAwyzeCrostekCnesCkerCgalCbengaBurzCngCesteCbnigDbenaGBrzesienCynnCightingtonDdeCeyfordBoytowichEekCsickCrkowskiDellDdlowDchesterCowardDlhiserDdlinEkaEbeckEalCndoloskiEerlingClsdorfDperDlertFnburgDineDfingEenspergerDbrechtCjnowskiDewodaDdakChlfeilEertCgeCelflCdickaCbserDbeBnukowskiCorowskiBmithBlodarekBizaCtuckiDtrupEnebelEhoeftEenbrinkEbrodtDkowskyCsnowskiDelyCrtzfeldDfsCpfliCnterbergDsletteEcottDnickiEenDikDgeierDdsheimerErowEhorstEfieldEauerDcapawDCmbrowEleClundDshusenEenDlockEmertEiesGmaeFamisGFEetoEbornDkusEsonEoffDdridgeDczakEutCklundCgganDandDCesemannIDrsteinerDnbergDlockEgaszDgardDdrichEerholtDbenCdjajaDeraECcklinEersheimCborgCatrowskiBhyCittumFinghillFenbeckEikerEeyFrFlightninEcomeDstedDrlowDlesEdenCetzellDlihanDeldonDaterCalteyBeynandDkerDdertCuveCtzsteinEellCstlerEermeierHarkInnGhoffEbrookeDkeDerCrstDremeyerDnsmanEexEDmeDlineDkDginDdlowEermanCntDsmanEkeDdorffClzelDthaDlinghoffDdingCitDssenbachEpfenningEmantleEbeckerDrauchDnzierlEribElandEfurterEburgDherDgDdowerDchtDbeChkingCglageDielCdigeCckwerthCatheringtonDselDntDlerDgraffDderBaytsDsonDmonDgoodDfordDchowskyCverlyCttignyDskyDryDesDahCsurickDsamDkomEinDhumEpunElerDerCrzybokDstlerDrilowEanDowayDntzEbergDmkaEbrodDlowFckDdeDCppCntuckDnlundEarkaDkoDdellClundDtosEhoDstrumDrodDperDnDlworkEoEmanEiserFeEenbrockEauDkaDizerDgrenDeyEnDdroopEeronDCkefordCitzDssEanenEDnkrantzChnDdanDbaCgnorDgyDemannDatsumaCffenschmidtCegnerCddupsElesDasCchtCasDgaAvuosoCkeljBriensCedeveldCbasCanicarBovakCtsmierCstalCrsburghDnesCpavaCnseegerEchriltzDholtDgsamphanhEkhamphanhIchanhDfeldenDerDdrasekGcekEerhaarGaheDbankClponeDmarDlmersEetteDinskyDekDbertCjnaCigtlanderCgelzangCeltzEkerdingCcelkaBljericCemingCchekBizziCxayackFCvyanDionCtranoDezEllaroCsounnarajDickDcosiCrostkoDgileEadamoDantCntilaFEClvenDtDlnaveEescazFEasisFplanaFoFnveuaIraGdryFmayorHrinFluzHazoFireFcrusisDegasDdosolaCkerCjilDayanCgneauDiloEanoCeuDtzkeDrkDngxayDauCdasEcaCcunaEeroaDentenoCasDrdDnoDleDfaraBezzaCveaCtterkindGickDoCssarDperasDleyCrwersDunzaDsoEageDrueEoneEastroDplanckDoneDnazzaDlindenGDkuilenDfaillieCnzorDturelliDskoskeDningEemanDeriDdigDceCltkampEhuisDovicDlerDkyDegaDardesCkslerCitingerChrenkampCgeranoCdovelliCasmanBbilesBautierDletCtterottCsudevanDosDekDalloCrquezGraDozEneDiscoEeurDandaCnzieDwyckEhyEeerdFchelDvurenEorstEeldhuizeDudenDtuyleFllDsteenhuyseIbergEonEiseEchoorHiackDrossumDosdolFErsouwEniDnuckDlindenFerEaereDinettiDhoveFutteFeckeEeusenEammeGDgordonDeekelenDdonselEevanterFsandeFrnootGjagtGietGhurstGbieEawalkerFeleDblaricumEeverenDamerongenFburghElstinCltasDmeDlowFttonEiantEegosEarFdoresDerinoGaniElaDdoDantEdoCjnarCisCgnierCdlamudiCctorDcarelloDarroAuzzoButelaBtzigBsetedBrtzDizEagaDeagaCquidesCmstonDosCbanyEezBptmorColeCholdBoyBnverzagtDarskyCterseherFmanCglesbeeCderdueCcapherBmehBlvenDanCshaferDamerCjevicCbrichtCabarroBjanoBimariChleinBgoliniClumBffordBeckertBdaniBchiyamaBblCaldoAtyrieCndalCmsClwalkCeryarBwilligearDdwellCardyBuzzioCtterowDajCrzianoEakDturaEleDriettaDnsEellFerEbillDelloDbacuskiCpajEcyupanquiComiEalaDheyCningCmoloDanCllarDinoCggersonCckersonFDhyDekDciaroneCamoheloaDiDBsuCironisDngDatsosCemetzisCcriousCauDsieDkonasBrypalukDggCuxellDverDssoEhEelloDocchioDncellitoDmpsFerEbleyDlliDheDgliaDfinDdnowskiEicsEgeonDcksFerCoyanoGiDuserDttyDnaasDmleyEburgDllerDjeckiEahnDikeEdlDgeDfholzDchessetCishDoDnkleyGEghamEdleDmnellDlliFDguroFerosDeceDderCexelDwinEhittDuterGlDttinFDsoDntonFiniEholmeDmelDllDganDcarichiCbovichCaverseDunfeldDpaneseDmpEmDjilloDhinEerDdupBoyneDamaCwnzenDberCussiantEomDrtelotteDmaDlminDhyCttinghamEerEDoszDiDaCstanoskiDoCryDresonFonFllEalvaDnoEgrenEeseDdsenDbitEeckCppinsEenEahDolinskiDlkEissFnDinkaEComsenDlsDfDCnicEattiEDgrenDcheDasCmsickEcheDopoulosDkowiczDaskoCliongcoDestonCkunagaDitaChonnieCgnettiCevsCdoraDahlDCcherDchioCbosaDiasonBjepkemaBizonCxierCwaldCttlCsueDingerDaCronaEDkDinoCotuicoCnneaDinCmoneDberCllemanFDeyCjingCggCffnerCetjensDgerCdringtonFckCbwellDollaDbitCangcoEBhyfaultCurstonsonDndercloudDmanCrunDillCorstenEnquistFerEminaFerEanDmsponDenyFnesEleDbyCilletDesseDbedeauCeunerDssingDrurerEoDoDmotEDinEmElingDesfeldDakerCanielDmphiaEmorongsaDlheimerDinDemertDckxtonFreyFeryBeylerCwmeyCvadaCtzDtehDroEeauCstmanDsnerDorieroDnowDauroCrsteegDrettFroFnceEallEDkelsenDbushDanishiCpperbergCntlerDorDharmselDgwallDerowiczEbrusoDdickDcerDCmoshenkaClmanDlinghuisenDegaDchikCjeiroCitelDchrowFmillerCgtmeierDenkampCetDplesEeCbowDbettsFCaseDchBayoDmonDlanDdusCvolarioDesCuteoliCtuDsakDnallDesCstoDseDhmanCrtarDsisDrisFconeEanDnerDborEetDasuikFchkeCpsDpisDioDatElesEhaComotoCnzoschEmanDweerDoueEriEnDnazzoDkerFDgoDenDdonEetzkeDcerCmminenDiyaDeronClladinoDiuluDburtEotiDatEmasCkiguchiDenakaDChirCglienteFalatelaDgeDamiCfuriDreshiCcderenDcarielloDataEdinaCbladaDetErskiDbaaCakeAszypowskiDnkowiczDmulaDchowskiCwarcCuszkiewiczDmnyEilasFeszDchDbaCnejkowskiCmidtClosekCigethyCenasiCczurekEesniakCalankiewiczFiEDflarskiByrstadDopCnowiecDakowskiCmoreEnCddallCbounheuanBwonkeCisshelmDllerCentonDllEeyDgerDffordDereEDdeenDazeyErngenCaynosDtloskiEekDryEtleyErEnEbEatDnzyEtnerFkoFeckEickDineDdlingBvobCensenButtDoDherburgCsmilchDlaDkoDanCrridgeEanDkamerConDminenCnesonDdmanCmstadDruldDeyDberaDaranCltaireDlyEowayDkowskiDcCkutEpDovichCihkonenCgaCffernCeyoshiDtDnnenDllentropDdaCddathCccopCbCalevaiBtylerCvictorCuzmanDsseDrwoldEinoFaleEdnantDpkeDmmEbDkelDfflebeanDeverEssyEdemannEckrathGDdwellDblerEbertCrzyzewskiEelczykDutynskiEckmannEberDowEpusFleEotEheckerDingEmelEghtEfflerEdironEcklanDemEllerEkasFEitzGenbergeEchEatDazzulloEwberryEtterFhmannEssellGbergEngstalienCoyanovDutenFamyerDtelmyerDskopfDrtonEbeckDppenbachDotErDnewallFfieldDlzenbergElsteimerDkelDhsErerDfferahnDermerEnEcklinDckhoffFburgerDakleyEClucienCitzEtgenEchDresDppichDnserEemetzEdeEarDmusDlinerEgenbauerDfflemireDckfortEherDbbCewardsonDvisonDubeDrnodEgerDptoreEpigEletonEhanskiHoEchinskiEanikHakDnslienIEgleFeleEdalDmpertEanDlmachDitzerEnworthGayFsFourFmillerFhouseIrFgerFdorfFauGckerDgmannDffEanskyDenslandFrodFlandEbyDchDalyEgellEdingsEchCawaszDvsvickEridesEishDthesEeDssinosFerEioEaDrzynskiErittGngEnoldEchmanGEaceDpeltonDnuszekEovichEkovicFeyEislawFforthFerEgaroneGnelliEdleeFerwickFbackEcombeFerFatoDmmelEboughDllonesDkelinDgnittoDfiejEfonFieriFenDdeDchniwHkEerDberFllEackDadtBpuntDelerCruitEelDigginsDatlenEinEfkaCortsmanGEleDerlFerClonskowskiDinterDaneCizzirriDnosoEkaEeyFEdolaFleEasDlskiDelmakerEgleCevacekDrreyEgerEdutiEanzaGdeoDnderEaDllaDithEsEdenGllDeseDcterDakeEgleCaunDraDntonEswickEnbauerEaDideDdlinBowashCveyDakCuvannavongIrithIkhiryDserDlekDkkhavongDcekCttosantiDlarDakCssongFDinskyDciaCrotzkinEkinDmanDgatzDenDavillaDCprychDataCorusDkooCnnenburgDkensDdriniEelskiCmsanaDmerdorfFllaClversonDtrenEesDonikaEmonsDlockEmanEeDimenoEeceDgovicDdowDasErzCkoraiElikCissonChrabiDoCgolDaCfkaCdomkaDachanhCchockiDciCbrowskiEinoDoleskiDeranoDbaDaniaCansBnufferCowdonFealDderlyDckCitkerEhDffCedegerDarlyCachezBmurthwaiteColskiCithmyerFenFbergerDsekDlyDglewskiDetanaDalowskiCeltzEkoDenkDdsrudCaydaDwDrshDltEarzBlutzkyDisCoupDtkinDsekDonDmskiDcombeEkbowerCiszDnskyDcerCeekCaymanDvisDtinDninaDgelDdkyEekBkybergCwaraCurskyGiEaCrobackiDetowiczCorepaDmoCnerskiCinsacosDllomFenDboshEiskyCewisDneEderCaleckiDfecBixonCviaDertCttoDaCssmanDnerozDkeyDchoCrwetDucekDrineDnioDianiDekCppialConesiniDmaCnkiewiczDingerDguefieldEsEhisenEeltaryEcoDerDdtEorfFniEelCmzerDunekDplotEeloDonettaIGavdDmelinkDlickDkowitzDinoDersFDcicDankClverwoodGhornDqueroDlittiEeryEaDkerDerioDagyFoCkorraDkilaDelDatEnderCgworthDnorinoDafoosCewersDvelDrzengaEerDpkerDnaEDgfreidEersDfkesEfermanDbelCdlesDeDdiqDaCckmeirEendickDhlerEenederFlCangcoDdBhymskeCutteEesDrkusDmayDkertDhiDgaDckhartCryerDoederDimplinEerDeflerDakeCoyerDwdenDutsDtoDntsDemanDddieCirillaEdEaiDpwashEletGrDntaniEneyEkoEdorfDmonishiEanukiDllerDibaDgemitsuGatsuDfleyEfletteDeverDdoEemantleFlDbaharaCeyDvenellDtzDskeyDrrattEifEfyEboDppDnbergerEassaDmperDltrownElumFnutFhornFgrenEenbergerDiveDasbyErierFhartCawlerEaikiDullEDttDrrattGiEpsteenFeyEleyEiffFatEarDpinDnskyEnonhouseEgrawDmmaaEapandeDlamDkerDhinianDginawEgyDftoEiDerEDdixEburnBferaCatcuBeymoureDCwesterCverynCutterDssDferCttecaseCspinosaCrveyEanoDumDtucheEDroEetFDmonEaniaDgoviaDemetDabiaDCphtonDCntaDsenbachDnekerDkDionDemounnaratEkerCmoDenickCltrechtDlarDiskiFEgmannEaDestewaEmEDcaDbertFCkerakCjkoraCizDverDrerDlhymerEeyDgerEartDftsEfertDdleEeDberlichCgotaEbiaCewaldDpersaudDnCdyDtalDotalDlerEachekCcretoDoraDkyEingtonCbestyenErsCarchwellGfieldFeyDnorEDmenDlanderDfordBcullionCrudatoDonceEbolaDibellitoCozzariDresbyDlnikDhDbleClaviCiutoDscoDglianoDeszkaErkaDbettaDavilloEriniEncaleporeChwuchowEoyerFererEienEetzFrtfagerFntkerHGdingerFmmFinerEarzenbergGtzerHenFnebeckGbeckFllieGdDuylemanEstrichErerEppenhauerEmuckerFansEilingEethEckertFhmannEbleFDroyFmenFeppelGdelEeurFimannFckerDouweilerFErnickFeplumEolingGFEntzFingerFeckGFaertsEmbergEllmeierEepflinFneggeHckFllerFbelDnitmanEetterFlzerFidmillerEairFblDmuffEoldtEiderEeerDlusselEisselEettFsnerGenerFpphorstHFchtenEaackDiveleyErmEmanskiElmoellerFleFawskiEffnerGertEedlerEcklerEappaDeuringFleEpkerEnzFkelbergEmbriHaEllhornGenbergeHEitlinFdeckerFbnerGlichEhlEfersEeEarerDaubertEttschneidErichFesFberEppachEnemanEmbergerEkEetzleFcherCerboDlbaCavonaDttonDrsdaleErEponeElataEianoDndurraHaFalisDmmahornDfutoEfeDchetteBayyedDkoDcoDasaneEphonCwneyDdoDatzkeEllichCvkoEaDittsEolaFEneEchDellsCulpaughEinoEerDgisDberDCturnioDtelDombaDerfieldDavaCssevilleDaharaCrzynskiDtoriusGeEellDsourFnDpDnoskyEiDlinasDkaDinskyFDdoEenDchettDaultEteEoEntakisEleguiCpperEahDinskiDardanisFaCnyaroDtwireErmireEoriellaGFmassimoEistebanFllanezEamarinaDsottaDpsonDnuttiDkohDgasyDfelixDdvillEusEstedeElingFandEhopEeenEblomEayFgerDcrantEkenEhiricoFerEesDbergDacoreCmynDulDrovEahDpereEangDlandDiiEentoDesDbrookEorskiEergDarooClzlDvioEatiFdgeDuanDtzbergEusEmanDstromDottiDmonsenDlmenEeEachDinesDeskyEmeEhaDdanoDbDazakEsarEdoEchCkumotoDamakiCjovicEusCinteEliereEatoDlsDkDevaDceCheDadyCgoCftDierDfoDerCetherDnsDlerFnsCdvaryDoskiErraElskyDinEkDeghiDatCcramedDhettiDchiEaCberiCarelaDdatDbatmandArzeczyckiByszCnkowskiDersonEerCmutDesDaszClaarsdamCkaczewskiCenDaCdinDelekFEenCbinskiBuvalcavaCtskiFeDmanDkinDhsEmanEersFfordDgersDenbergDarCsswurmEomanoInoEerFlloDhananDenDchmeyerDawCpnickDleyDinskiCopoliCmpsDbachClapaughCivoDterChoffDnDmanCggirelloCffellGCezgaDsgaDlarDhterElingFenDdasEDckCdoyDioDhDellDatEckCckeyFlEdaschelCbsamDieEckDertiEoEnfieldGeldDashElcaveBozzelleDonCyleCxburyCwlisonDelsDbothamCvellCuwDtzenFahnEteDssoEellEDnsvilleDlyEhacEetteFDhoffDghenDchCttinghousFerDruckDkowskiFveczDhfeldEerhamDchDanelliCsulDsieEenFelDkyDianDherDewallEumEthEnwinkelFtraterFlofFhagenFgrenFdorfGaleFbushEmoreEkEburDcupEaDborilDazzaEneCrabacherCpkaCofnerCnsiniDnieEfeldtEDeroFDayneEDCmpreyDmelfangerDkemaDiroDayEnowiczGvGffFiszynFekGCllfEagDfsonDackCkickiChrdanzDdenburgDalCgowiczDishEanDensDadoCessleinEingDrigDnigkDlleDhlerCdvoldDrigresEeguesDolphDkinDiquezEnaDeroFmanFiquezEnizerFboughEbushDdeCcleDhlitzEkesEefordCbynDustoDerstonDbieEertGsonDairCamDdruckEesFnEarmelBizzardiCviniusDerasElloGiDadullaCttingerFeFchierEhalerDmillerCskinDienDhorDattiCpsonCngoldEenDfretDeheartDdalDcanDauroEldisECmkusDiDelDbachClyDlieEerChnerDerdCgleyDhtmyerFhouseDgertGsDermanDasCfaiCesnerDnzoDmersmaDferCdgebearDesEllDallCcucciDleyDkerlDhemondFlieuGEardvilleDcitelliFardelliDardezCblettDarCaseDnBhymCuleDdeCondesDdehamelCimCeingoldDavesBeznickCyneroCvolorioDetteEloCuvenDsswigFerDhlDberCtteleDkaDersdorfCsseguieDperDnerDidesDhardDekEighCpaciCnzulloDuartDtfrowDnemeyerFkerDkesDierDdleDburgCmsburgDosDmieFckDlinDkusDfertDeyErezEdiesDalyClphDlihanEesDafordCkstenDasCitzesEenFmaDsinDnmannEickeEholdtFeimerEfeldEemanFkingEartzDmelDkDheDdlingFerDchenbergIackChoDnborgFergDartCgustersElusDlinDinalDesEnsburgFDasCeversGDterDdholmCdleDicDfearDdekoppCchelCbickDholzCazerDuishDthDsingerEDryDlmutoDgerDdenourBazzeCwickiDhoofCviDettiEnscraftDaCufDeloCtteeEayFnachaneHDhmannerEgeberEeEbumCsulDtogiEelliDsmanDmusonDelyDchkoFillaFeDanenCryDingEdonDeyCquelCppeneckerDelyeaCnsierEbergerDnalliDjelDfordDdollEklevCmyDundoEDsuerEtadEbottomDphalDnarineDmerDiscalDgelDesarEntoDbeauDalesClonDlisonCkichCithDolaDnwatersEbottDmundoEerEannDlingChlDamaCgusanoCflaDiqEDfoneFDailCelsonDhlDbelCdwayDueDonaDisovichEcsDemanEkeDderFnCckowDitanoEnaDharDanelloCbuckDkinDidouxDelloFDaraAqunnarathCirindongoDntelFanoElinEchiaFelDllingGanHmFensDhuizDettDcksallCestDrtaEidoDntDalyCayeDnteDmmeDliaDkerDglianoDderApytlewskiCoClvainenDandCchCBuyearCuleiCthiyamadamDalavageCrzyckiDkersonDcellaFCppeDaCllonEieDgarinDfordCjalsCiattiCgedaCffettFnbargerCertasCddyCcioDellaBtaszynskiBsomiadesCencikBrzybyszGcienDedwieckiCyzgodaCvittCuskowskiDghDdentEdenCovazekDtasewichFinDoDndzinskiDkesDhonicDgaczDescherDdanCivatskyGeerDoreDnzingGEtersDgmoreDeweErDbbenoCezziaDyorDwerDvettDuittDpotenteDnceDkkerDisachDcytheDbishDatoCchlikCazeresEakDunerDttellaEiEDsserEomsackDmlDbhakaranEelBoyneerCwroznikDalCuxDllionEiotteCttierEhastDocnikDiesDhsCstuciEalDsoDerCrtwineEuneEaroDrelloFcaEazzoDemskiEDcelloCppleEertDowskiEvecDkeDikEelarczykEckEDerElkaEcCortingaFeDniCnyahDtinCmeranceDarClyniceEakDverariDtorakDovoyDlmannEioFngerEaccoDivkaEanDeyestewaEraDdrackDcovichDakoffFisEdianCkorskiCiterCffenrothCetzschDschlGelDppleinFingDlingCdvinDsiadDraskyDlasDeDbielskiDanyCchibaDchiaCalinoDipuniBlymireDerCuvoiseDngyDidCoudeDskerDmmaDhrDcicaCilerCevinDssisEnarskiEhaDnskofskiDckerCatenburgEasDnsinisEaDmerDcencioBizzolatoDurCusDrkowskiCtuchDtilloDelDcakCszczatowskiDulaDhnerCrnerDilloCppertDeCnyanDsonnaultDntDkeltonDenaElaEaultDaultClottiDlipsDbinDatiCkeyChCguetDnaDlerDatCetzschErafesaEersDrzchalaErieEfaxEcefieldDdmontEigrossiEeDchoskiDarcyCdcockCcoletDkrenEingsDhtDcoCBhomphithakEmathethCliegerCippenDlpottsElipiEipponGoseEbenCersonEgusonCatdouangDnthauongEordBfirschCendlerCannensteinDhlertHBezzutoEimentiCxtonDsaCwoCvsnerCtzelDtsEnerEinellaFcrewFbonEesDrovFsyanFnFcelliGcoEizzoFsFnoFconeEalbaFkisFinDkoffDitjeanDgesDeuilEtErsdorfDchulisCstronkDkindDentiCrtsovskyDsonetteEiaEampieriFllEDreDperDoltaDngDlerDkoskiDishEllouxDeyEssiniDcontinoEiballiDalCppasDitoneCnzeroDticoEDskiEeDriceDoyerEvichDnimpedeFgtonGDissonDdlEillDcealDatacEsaEnegraClmanDligriniFcciaEantDkowskiDakCinDghtellCglerDelowCffersCetzDlmanDCdrinDlowDeltyEDdyCckinpaughEensDhtEinEeDciaDaCakerBazikDderskiDanCynoDendaCwlukEoskyDellCvlikowskiFdesDishEolCulickDkertCttumDrylakEonellaEichFarcoEawDiernoFntGceDenCstorinEernackEanoDsaroDqualinoDkoffEinFewiczDhelDeyDcherDayeEnenCrvisDtmannEhemoreDshotamEensDragaDontoEdaEbekDmannFleeDletFDkersDienteDeeDdeyFEallDbsEolDanadaEhEdoCppyEenheimDlowDkaDichEDalloColicelliCnzarellaDyikDtleEeraEaloneDsulloDoneEDnyEenbackerDkiewiczEhurstEeEauDganDessaDdolfiEianiDchikFakDakosFEgakosClubiakDsoDowodaDmucciEourEinoEerinoFDlinoEerinoDisiFanoFDazzolaEyEspasEmaraEdiniHCireDlletEetDderCguinDodaDlioneFalungaDeauDdangananCfundiCdiongDbergDarebonesEleckiCcolDilioDhterEewCbelickCaskeAozzellaBwocCcaBvitzCermannEleeEhulserFoltzerDnsCallButhierCrenCinonesBttumDomanielloDemanCsmanCingerBszustCtorgaElazaDerhouseFbergerDbergCoskiCmersFaCheyCequeraDnkowskiCchmannCbmentDeyCazuwaDyandeDkoBrzellCvinCtwineDmeyerDeltFliCstenDonCrillCpheyCndorfCloskiDichDanderGCkCjiCisonDellyGeyDCganekCeyDnderCdonaFDmanCazineDvetzDndelloDboneDCBquendaBpydCteyndtCokaCiolaDelskiCellDkaBnyeaguCezneCdeckCaBmsCmenCinelliCernikDliaBlyngerCwinCveyCufsonDbunmiCtenCshefskiDbyCoresCmaCliDechDarCivieraEarriDgschlaegerCheiserCginCeveraDrudDnskiEiusCdowDershawEnburgerCausenDesBkutsuCkenCitsuDeCesonDlberryEBjitoCanoBhyamaCrCnstadCmenClhauserDensehlenECashiDnleyBgzewallaCutuCstonCrodowiczCinskiDamienCerCarroBfsakClynnCfCerBelzeChmDlschlagerEBdomeDCmarkCilCgenCermottCairBczonCkmanDleberryDenChalEkovskyCenasekCchuizzoCanazBbreinDayCorneClinskiCinDerneCholzEfCerskiEmierEliesEgfellDnauerDidCbinkCakerBatneyDfieldAnyulassyBwagbaraButleyDhCrthenCntarayDnoDleeDerCmkenaChferCgalCessenCdingCcholsBoyeDaCwosielskiCvickisEDencidoElDadCujaimCtomaDiceDhDchDarnicolaCsworthyDackaCrumDthouseEesanoDstrandEingleDrieEDnDmoyleDiseDdstrandEmarkEesDalesCpachaiCordaDmanCnroeDemakerDamakerCmmayDanClletFDiCiceCerrCdlandCconDksEelsDellaEkBjieBizoCtchmanCstendirkDsanDlyDhitaniFoFnaCrschlDoDenbergCquetteCpCndorfDcehelsorCmzDuraClmeierCkulaDachDCghtwineFEmanEborCffeneggerCezDsporekDrDminenFeDdermeierGbergerCdoCcomeElozakesFiaFesFauDkodemElousEischEaDiCblerDbeBhatsavangBgounBeyerCwmyerDittDgardDenleDbraughEoundDandCvueDisonFDCujahrDferCtteDkowiczDhkinCsvigDticoDsnerEleinEetFlDhemDbethCrisDenbergFCpomucenoCmithClderCitzkeEaDnerDmeyerDgenfindDfordDdenbachChlsenCgretaEanaCenanCddenriepCchCborakDesnyBazarCwfelCvoDareteCussDmesDglerDerCtvigDalizioGeGaCstasiaDaireCruaezDrowDkeviciusDdozziEinoDainCpueDenasDComiDCnzDtwiDnenDgDfitoDesDCmsalyDeyErDauuEnworthClevankoDderCkaokaEmatsuEjimaEdaEahikiCimoliChmiasDhasCgtalonDelkirkDasawaCftelCdineDermanCchbarDciCbzdykDorDavianErowskyCaszAmyslimCreeClarCallBuziiCyresCwwakkilCttersDschelknausCsulinDtaroFcheDslewhiteEellEaDniDlimDkratEopfEettDitanoElliEelakDguireEravesDcottEhikFaweckCrschDrilEaDosDiDelDckoDakCphyCnteanDdzEingerEerCmaughClvilleDreninDnixDlenauxEahyDkernGinDchroneDatoCinosChlsteinCgnoloDgeoFCffettCenzenbergerDllerleileCdieCckelroyDcioBrvanCkvickaCawBozickDgaDakCxnessDeyCunkesEdCtonagaDhersheadDayneFenCstyEadDsbargerDkwaEopDenaFDcoffianCrylDvilloDtinFerDsbergerDreyEalesGDphyDockDlinoDkertFnDisseauFhitoEnvilleEciDganoGaDeschiEncoGeEllaDdeciDattoFhErioEndoEdianFaCotryDmeyCnvilleDtotoFreFneyEfortEeyFsiFrrubioFmbeauEayesFlbanFivoDsayDotEpoliDnerjahnDkowskiEaDjureDiosEngtonDgesDfilsDeyhunEauxDdtEozaElochEelliEaleDclovaEherDathEgasCmineeDaClzDstadEanDnauDluraEeurEaDandsCitozaDsaDneChrlockEeDomedDmedDairCgusCeuyDserDhrEleCdiqueDglingHDerskiCczulskiDcasinCayyadDtzBlodzianowskiCeczynskiBizwickiDutaniDiaDenkoCyatakiEnagaCvilleCtsdarfferDraniDmanDkowskiCsuracaDkinisFewiczEaDikDhulovinHuinEkinEarDentiDchoFnickCrisolaEcleFkDamontezEfuentesFloresCquelConeCnzyEenmayerGbergerDtkenEenDotErsDnDkowitzEinsDisterEcDhasDgioniEeeDertDchowEerDalgaCmozoClwardDsonDoschDlingsFckEareDkeDinazzoFEchDetteEDdrumEonDcherDbergerCkuszewskiDlitzDkoChaliosGckCethDrzwiakGaEowEezEauDlcarekDcznikowskiDarsCddlekauffCcucciDkelberryDhnoElichEieliEelsteinGiniEalicekGDcicheDalizziBguyenBezzinaEengaCydidCuselEaCttyEigEenburgDierDhDelkoCstemacherDsamoreDplayEeltDitiEnaDhyockDenbringDchkeCrzlakDrihDnerDkwanEleinEeyDingoloFeDgistEanthalerDcklingCnzerDsalvasDneckeFDjivaDgwasserEerDedezEalDckEiaEhenFavezClzerDveDsoDoanDmanDlisonEersonFndorfEbergDikianEanDgaardDeoDbyeEerCjaCixelbergerDtzEnerDssEchDnenEbergDgelDerhoferChringerEerDleDallCgahanECfferdCenanDchamCdvecDingerDdockDawarEriesCciasDannicCazellDsomDdenDchBcwhinnieHeyDellsCvinneyDenesCthigeEayCshawCroyalDenoldsDattCquilliamsEestenCphetridgeConnellCnoltyDeishDanyEmarCmullinsFenDenimenEllenDanuisFemyClernonDaurenEmoreCkusickDoskyDirryherEndraFDeverErninFlieEnnzieElvinFphinEagueDaughanCiwraithDlhinneyChardyCgurieDreveyFenDohanDlocklinEewEaunDibneyDhinnisDaughanEthyCferranEelyDattenCewinDndarferEanyDlvyEmarryDathronEddyCdugleDoulettDaneldCcullohGinGanHghEbreyDrobieEainGghtFckerFbbDowinEubreyEonEnomyFnicoFahayEmishEidDloudeEinseyEenicFeDierDathranEshErvyFrolGaherElpaneFebbFanahanEdeFamsCbroomeCaskillDrtorEeeBbonuBazzilloEettiDueraDowieskiDierskiDellaCyzeDwaltDherCwkCvrisCushardtDrasFcherDpinsCtysiakEeDuszFkaFiewiczElewiczDtockEingleyGaFckEanDskinDrosEiscianoDoneFakDlowDkovicDisonDhelierDelskiEiroCsunagaDtertonEalskiDsiniEenaFdEarelliFnelliDoDlenEakowskiDincupElkoDherEallDelloGDchmeyerFeckFakEariDarEkEitisCrxsenDuschakGakFEmotoDtyrEsolfEorelliElingEischnigFranoFnsonsGovHnHlliGetHllIGatFchEeyFllesIDsolaisEiliEhbanksFakEeillesEawDrierEettEapodiGeseDquitzDousekEngeEDmerchantDleneDkworthFardtEusonEouEakisDjenhoffDitatoEskaEacherDgotEisDflakEilDerDdirossianDcusenEonisEisakFlleEhionniFesiFalandEetFlliEaDbleyDashFcalcoEnteFgoniFdoCpuaDstoneDaCohuCnzurDweilerDuiaDtoEifelFaEeuffelFllaFcaDspeakerEbachDousEsoElisEcchiaDnheimEelloDlangitDinoEeriEcchioEarFciGeDglonaEisFaficoEhaneDeroElyEafaigaDdrilEolfoEerFlbergEalaDcoEillEherGDaughEssaFaresEnsalaEliliCmudoskiDmoEengaDarilEclayCluegDterEbiaEasDoolDlasFlieuFcaraDkiewiczDinovskyDewskiEttDdomadoDcomsonEikDavetGrEskyFEngoFaphyEchCkofskyEDlerDaCjusteDiedDeskeErowskiFaCixnerDstoDoccoDloEeDkoksoongChunikDrerEaunDolmesDlkeEiDfouzDeiaDalkoCgwireDpuriDounDnoneEettiDliuloFoloGccoDittDginsonEertDeraEdEDbitangDalongEhaCffittEeyCestriDnpaaEhoutEdelCdyDuroEDrayFsDockDlungEerDenfordEauDdalenoCcveanDuraDrumEostieDnaughtFmeeDmurrayEillenDlayDkleEimmieEedanzDiejkoEaszFkDhtleyEensDenteeEdaDdougaldDcauleyFrtneyDarenoFaigEpagalEhilasEdamiaCboneDaryCattaDloufAlysakCngeDadyCkamCerlaCchwalaBuzuriagaDinskiCxonCveneCtziDheCssDhbaughDcavageCreyCquinCpulEDkinDferCotoCndmanEieFEemoDcsfordCmukandaDppDmisDantasCloffCkavskyCitjensChringCgaCffyCelfDhringDdiDckenotteEhtDbanoCdvikDoviciDkowskiDermanDdyCcksomEritzEadooDionEDhessaGiDearDarioCbenCangsingothaBozziDoCystDedCwinDberCvichDenburyEhEcCuserDrisEenceFiroEasDndsDkidisEasDissantDerDchCtzeDthammerEerDerbauerEmpioCstraccoEonDsmanDonDkillEeDheCrzDionCpuzzoDilatoDeraCoseyDiDckCnswayEDguevilleEtonEknifeEinEfieldEcorDdnerCmpaDmelDgCllingFDiDarCkutaDkeDhmatorCjekCisDlChmeierCgeroCeweDssbergEchnerGeDhleinDckleDbsCducaDenseEiroCcsinDorriereDklierEetteDhotzkiEeDantoreGeCboscoDingierCatsDrcaBlyodCopisCarenasBjungquistBizerDardaCviDezeyEraniDasCuzzaCtzsingerEaDtlehaleEerDehiserEckyCskovecEiewiczEaiDiusEeckiDhernessDantiCpstoneEitzDpiDovskyDkindEeDitzDaContosCnzieDstromEsenEnerEayDneckeEanDkkilaDginfelterEbergEardoFoDeaDdwallEskogElineEesmithDcicumDahanCmthongDesandDauroErdoCllebergDjedahlFbergEaCkioCgonsCfshitzCeschDrleDnkeEemannDkhusDderbachGDchtiDbskindEhardtEeltDCddieDbomCcorEDknessEissEeyDhtigFenwalterGEsteinEoratElyterDcioneDalziCbrizziEeEandiDkeDertCanoEesBezonDerDakCynesCwtonDryDandowskyCvoDitesFchFasEsterEnskyDerentzEndoskyCutyEersDsinkDpoldDchsCtteneyFerDrentDourneauxEfskyDmanDkoDangElienCstelleDsinEenberryGEaDpierDkyDhureEkoDcavageCrmondDewContiEaggeoCnzaDtersDordDnyEertDixEngDgleEacherDerEaveDcioniCmpeDoneDinEchDertClisDeCkwaCjuneCitzeEemDstnerDpheimerDmkuehlerDdingEelEallDchtyGmanDbensteinEaChrianEfeldCgrowEantDoreDhornDelDalloCfewCemowDbrickCdyDukeDonDleyDecEbuhrCcoultreEneyDkingtonDhlakEelCbovicEurgeoisDermanDarioCavelleDsyDhDgjeldDfeDbowBazzarDerEnsonFberryCyherCweCvonDinaDetteErneFetteEeEarDatchCuwersEDtureEmanEersDrionEensGceauDntEelezDghbaumDermanDdatDbacherCtzkaEigDortueDhonEimDessaEllaDailleCsyoneDtovicaDselleDkDhutvaDernaDcodyDaintCrveDuffaDshDretaDkoDgayDeyDdydellEeDavieEteCquayCpuzDrairieDoraDianaCnzoniEillottiIEerEalottiDtonEeyDsdowneFenEangDquistDosgaFaDingaDgsdaleEoniElandsEhoutGrstEenheimFhennigDeveDducciEsberryEreyEolfoEkamerEhamEgrebeEefeldCmppEarskiDorgeseFellaDmieDielleDelaDbourneEinoEertoGFckDascoloErshEntagneEitreClumiereDloDibertyDataEnneFdCknerCityChrmanDmannDipCgroonDoaDinessDgeDatellaEssieEngaCfrancaDosseDfredoDertyFaDaverEuciCesserCdymanDtkowDitkaDeauDasCcouetteEstaEckDksEmanEieDhleyDassagneCbruneEodeEequeFcDogDkovskyDitaDbieDabitCakerAkylishChnBwiatCasnyDckBvilhaugBuznickiDmishEanicDemchakCttlerDellaDchinCszlykDumotoFaDtesDinskiDhlanEinerGDakCrzyniecDyDterDrieDpielDkjianEDisuCpresCokkanenCnzieEelDisEngDdrickElaEingerCllyEasDkarniDconaDakEczCksDlisDaCjaCizinasChtzDnleEenFmundFlDensDarikCfnerDeldtCenstlerDhnertCdzmaDasikCczkowskiDinskasDhtoEDelEkCbicaDeckaDanBszaszczBrzywickiEnowekDalCystalEiakECutschDssEenFmarkDpiakDmsiekElDlishFkFckiDethErElCowsDssenDlikowskiEczykDetchCiticosEesDsherDnkeDenkeEghDchbaumDbbsCetchmarDitzbenderFlerEnbringDbDamalmeyerEgerCawieczEetzDsleyDpflDnzeEendonkDmperGEmDlicekDjnovichEcerDinDckerBozinskiCwnackiEDingDallisGFcykGhickCvacicCurtEkoumellisDnterElavongEceDlaboutDaleskiCtzurDtsickEreEeDrysDowDhenbeutelDaraCstylaEichEenkoDsmannEinEakowskiFckDoffDmatkaDhiolDcielakEhoCrzenskiDtzEumEhauerDshakEenDolDnsEprobstEmanDmannDineckDfDetskyEnicDbalDalewskiCppelmannDisEakDeraDchickCokenCntogianisDonDnDieczkoEckFekDevalDdratowiczDcanDatCmsthoeftDosinskiDmerDinekDanClthoffDogyDnikDmetzDlingDkowskiEemeyerDiasDenEhmainenDbyEergDatCkoskaCistinenChnertDlmyerCfutuaDoidDlerDaCetzEjeDrperDpplDnningEigsteinHfeldDlleDgelDbleyCczeraDhmanskiDajDCblickDisEalkaDernickDakBnostDriDpinskiDepflerDcheCippingEfelDghterDefelEDckmanCezevicDwtsonDstrickEelDifelCavelDppeDckstedtBlusmeyerEDndECoosEckDiberDhrDepperDcekCisDngermanGnEesDmkowiczDeverEmCeypasDveneDppingerEarekFczDmencEanskiDinwolterinFsmithFkeFbergerEdonDespiesFeEkampDbanCaymanEDverDrmanEbergDpperichBjetlandBizewskiCyabuCviojaCttnerEelbergerCssikEerDhabaDchCrnerDkpatricDchhoferFgessnerFausenDbieDalCppesFrFlCntselEopDsethDrothDnionFnghamFerGDkinEellaDgshottEoreEenDersonDdermannDartEnEbrewCmbralClleanDcrestDbDarjianCffeCentzEingDlichDgerDftEfEelDBhumDCovDunborineFDoCensovanDlaCayDnsariEponaphanEoDmmixayDlifeGahDchatoorianBeynaCxelCwishCttmannDringDlerDchesideDCstleDsnerCrzerDssEkaEhbaumerDosDntkeDkelDiDgerDelukEchankoDcadoCppersCohaneCnnetFalyDelyEallyDdrewEerdineDagyEdyCmnerDmlerEeDererClzerDlonFEinEebrewEawayDiipioDderDashCitzerDgleyDcherCgerriesCensDmerCcklerCavenyDthDsleyDrsDnyEumDmoDlohanuiBazmiEerDinDeckDakosCyrouzDloCwataCvenyDadiasCuphusmanDneDllDbCtzbergDynskiDulaDtenDsbulasDnikDechisDcsmorakDanCstningEmanDsellEabaumDprakDicaDackCrvonenEisDpowichEiakDnishDmaDellEemDdashianDczewskiDayanEtzEdimasCpusniakDraunDpeEaDitulaDferDelkeDaCopuaCntarianFDozaDnardDishEeckiDevskyErDdraEaDatzarEbleCmphDnikDmesFrdienerDeradElamelaEalohaEDbCluznyEpaEnaDtvedEerDscheuerDmusEerDlandDimaEchmanDfaDbaughCkudjiCitzDnoaDleyDamaChrerDolaDanaCgayCfelCetzelDsemeyerDrDaCdukDisDerlikECcikDhikianDerskiCboosDbaCazDuamoAjuzaCstinoEasonCrsDischDgensmeierDdenDaCnglingClyeDukeDockDiasDenCferCedesCbicCariquiDireBozsaCulwanCstesFnDichEasDhlinDefyFCrskiDnDinscayDdaCnsDgelingFbloedDdleCllsChnshoyEicoDanekBirjisDanCmmisonCllBewelsCvticCttyCsmerDCroneDkoCnschkeDquinDninsEelleDisonDdrickCminezCllisCkotDelChlCbbCavonsDnneretEeEcharlesEbaptiseBaworowiczCvellanaCuriguiDchCstrzebskiDsDmineCrzembowskiDverDoshFcakDneskyDesEllDadatFCquinsCnulewiczDsingDrhettDowiczEsekDnettiFllDeczkoDdronDczunskiEikDacekCmwantDiliCkovacCgoeCffyCeschkeDnkeCcqueDobosDkovitzFlaEleyEaDcksonCblonskyDiroDaayCapAiyengarBwanowskiEejkoBvonCerslieCanovEcichBturraldeCtnerBsraelsenHCmayCleibCitaDordiaDngDdoreCbillCagawaDcsDacsenBrzykCizzaryDneoDmataCetonDstoneBozzoEiCpaBntrabartoloDiharCskoDanaCocenteCkChulsenCgoleCchesCafukuBmperatoreCgrundCbimboEerCainoBlseCluzziDianCicCasinDganBkerBhnatCmBgweCtanlocBfversenBeseCngDcoBdemotoBcardBborraCleCergCbetsonCaleBavaroneCtarolaCcovinoEpinoEbellisDhettaAhysomCmowitzEnDenClandsCchBuyCvalCtmacherCszarDtaceDsienDkinsonDfeltDenajDchCrtigEgenDoDneDlstonCpmanCorCnzelmanDspergerDneymanDcklerCmphrysFersDetewaEniukGkClstrandDlingsDittEckDandCitingCgronCfstedlerDfnerCezoDttmanDrecaDninkDlseDckmanCdgeonsDachCckstadtEleEabeyCbschmittDinDertusDbyEelDanCamanBsunCiangBrapskiBoznourCymanCwkinsDickDattCvorkaDickDanesianCunchellDfCttonEesDrumDellingDakiCstofferEermanFllerDpkinsEelhornDcheitFanderCrsteadDrisDnoffEbergEandezFckDmellDikoshiEganDgerCppinsEerstadDkoCotsellDpingarnerDkanoDghkirkDfardDckCnsingerDourDnetteFrlawDmaDkanenDgachDeycottDdorpDchellDasEnieCmsherDesteadClzeDtorfEhusDsterEonbackDomDlinrakeFdgeEermanFndonnerEbergDkDianDesEczFDdvogtCkutanDCinessDlmanChiuddenDenseeDaiaCgelinDattErtyCftiezerDfstatterEnagleEeditzEartCerlDfelCdosDnefieldCckinsEenbrockFDhardDateCblerDerEnEllDdenCagbergBnydaBlavkaDdikEekBitchenCslopeCrschbergDneiseEDlimanEemanDaoCppenstielCntsonEDleyDhDebaughDdsonEerbergerCmmelmannDangaDClstonFadEerFndagerGbeckEcherEabeckDpertDmanDlerudFbranoJdtEandDgersFmanDfikerDdagoFDbrandCkelCghbaughDgonsEenbottomCerscheEholcerDdemanCdayCckethierDhensCbbittBeyduckCwkoCvronCuwinkelDvelmannDsnerDngDettDckCttingaCsseyDpenDcockEhkeCrvigDtzelDstonFadEhkopFelmanEchelmanDrigesEesEarteDpichDnanezGadezGDmenauEanowiczDkstroeterEenrattDeraEndeenDaufCnstromEeDrityDnighFesEeberryDkeyDjesDglEenDflingDersonEinDdrikGcksenEesonFrsoGliteCmonDmannDkerDesathDaniClwegDversonDsethDquistDomDmstetterFingDlwegEmichDgagerFasDfenbeinDemsFDdeCitingEherDsdorfferDroEendtDnzigEigerEgartnerDmlicherEburgerDkenDdtmanErichEiEelbergerFbrechtDckDbultCholtCggoodCethDrsEnEkesCdtkeDspethDonDingerCckeDhingerCbeisenCathertonDrtsillDgneyDfeyDdlyFandGmEingtonEeBazyDimDaCynamDertzDdtCxbyCwseDkinberryDeCvlinDirDelkaCuxwellDtanDsrathDptmannDghnDerspergerCtzenbihlerDtleyEaDoriDhorneDchittFetDadaCstinEedtDsingEengerEaneinDkerFlDhawayDenfussGratzDcupDasCrtwigsenErumEquistEoryElenGbenEingerDsinDrittFageDphamDnosEistDlemanFeDkeDgersDdterEsockEnetteEineFEgesEermanFEanDcarDbaterDapatEngCqCnzlDsomeEmanEisFngDoaDninenEawayHltDmerDkisonDibleDenbergerEkeEbuttDdzlikEsomEkinsFeEinDbackDawaltEvanCmsikDondsDmetteFrmanEacherDletteDiltanEdiDffDettErslyGDdnEenDberryDaraEcherClykDtiwangerDstromEeDpertDnonDloEimanEemeyerEackDimaEckDdiDcottDbershtamDajianEasCkeyCitzDrellDmsDfaChnertCgginEertonGmakerDeyCfferkampDerkampCeuserDsslyEeDrterEingDderCdvabDsallDlerDestyDdenhamDallerCcopianDklEerottFnDhtingCboushDleDigEbiDerstrohEnichtCazDkenstadDgeAgyllenstenBwiltElimBuzonDewiczCyeCtzlerDtormsonDscheDjahrDgesellDenbergCstitusDsowDmarDhiEardCrwellDskeDreroDinDeckiCoanCnzelmanDyonDtharpDstreamDgorDdelachDawanCmprechtDaerClstonDnacDizioDbrandsenCitanoDmaresDllebeauFaryGmaEfoosDggeyEaDebDdreyDabCffantiCerriniFazziEeraDnthurDllDdjianCdmundssonCckerCbinDalaECaspDrrielloEnoEiniDncheDgentiBstohlBrzesikEbienCyszowkaDmesCuzDstasEeDntzEertFEbergDmneyEblingEanDlkeyDigerDeningFewaldDbyEenFlEbaCriffinCoysDwellDthausDsskreutzEkreutzEclaudeDotDnstalEquistElundEitzEbergEaDmollDhowskiEmanDetschDderDbmyerEergCivnoEettiDppenDneDmmeDllsDgoreasElenDffittFanDeshopGaberEpEffEblingDblinCevDubelDssmireEcoDnwayEskyEnayEkoEetDmoEmelsDgwareEusEgoryEanDepEnweigFsfelderFhalgeFgoFbackerEmDderDczkowskiDbnerEerDasonEmCavatDumanEelDssleEmickDppDnzellaEtoEsberryEquistEnemanEieriEesEdonFnerEaiDmmontEbleDleskiDineyFEchenDhovacDgedaEasDffneyFagninoEalsDdleyEiasEfordDbowskyFnskiElerEhornDapBozmanCyenDdaCweyDdaCvostesDiaCurDldmanFieDgisCttsEemoellerEdengerEaDshallCsvenerDtlinDsowFnElingEetDeyCrrindoDmanousFllyDiusDenaEllDdleyEeyDbeaConenDdmonCnzelasEalisDyouDsiewskiEarDeyCmoranEllCllopFbEierDikEdaEasFnFDecDdthorpeEhornFirshEfussFeldEererFnsteinGmanFDbinDacksonCicoecheaCffiganCerlichDpfarthEelDingDhringerCdboldtCchettEalDekCblirschBnozaCegyCabahBmernickiBlynCueckertCowackyDvinskyDstonEhenEDgowskiDecklerCimpseDdwellCesenerDitzDcklerDbockiEerCaznerEebrookDvesEanDsbyDdysiewskiEleEhartBjeltemaBivantCusDlioliCttCrresDbachDandCpCottoniniDrnoDntaDmbettiDffreDeCnzelDselDocchioDnisDardCmseClzowDtonDstadDomenDnerDlyEmingEionFchGeEeDibertoDhulyDganDdemeisterDcrisCggerCffithEeeECetzDselDraCbeautDalaCassonDrussoEranoDquintaDnnavolaEdomenicoEandreaDllorenzoDcherioGlliEchiBhebremicaelBezalyanCtzschmanElaffDtensFlmanCstetherDingDamondoCrzDwinDvelerDtsemaEhungEenFlFisenDstenbergerEhkovichDneyDmyEanaDichDdimanDckensDbigCorghiouDlyCntlemanEgesEeliaDselDiesseEaDeralaoCmmitiDlClnerDlingsHerDinoDharDfondDerterDderDbartCisinskyChrkiDmCenCdermanECarnDntBazzaraDitanoDdikCyaniloCwthorpCvitEgliaDettDanEganCusmanDkrogerDfusiDdierEettDciCtzowDtaDherightDesyFmanCsteloDchkeCrwinDterFnmayerGhausDsjoDroutteEettsonFanFDnhamEacheDmireEenDlettDkowDitoEngerDganDconCppCntzlerEvoortDsertFnDnsEettiDinEganCmotanDmondDerElloDbrillEoldEeeEardellaClvenEaniDuszkaEppoDmoreDlusserEodoroEingtonEetaFgozEaugherFrgoDkinDipoEnisEmbertiEcDbisoDatheEssiniEntiFoEgherCjeskiDardoCitersDlsEliardCfferDanhaCerCdewoltzEnCckleCbrialEenasDossiDlesEDhartDelineDbamonteAfylerCkesBusnerDilloDhimiDCrtakDblurCndoraEerbergCmeroClsDhamDcoCjimuraEkakeCgueroaDerDattCerstenauEbringerBrymoyerEierEarkCutigerDshourDmanDinDgoliDehaufCoydDstoDntisGeroEickEebergerDhbergDebeDbishCittzEchleyGeyDsingerEellDjaDehaufEdenthalEbelCeundlichDtDrichDnsDkerDiseisEmarkElinoEheitEermuthEdinDemantleEhEdlanderFersEburgerDdregillEeriqueDckletonFerCazzanoDuenfelderDttaliGErickEercangeloDssoEhureEchillaDnzmanFiniFaEtyEsiscoEptonEksonFlandFiewiczFartEgioneEchiniFesconeDlicDklinDirDgosaDdkinDcassoBoyerCxhovenCwlieEeyEarDerCuteDssellDquetteDndsDgnerCsmireDherDbrookCrtunDssEmannElinEeeDpahlDniliFerEaroDmichelliEaggioniDkumEellDiestDgraveDestaEjtEbackDcumEhtFioneFDbergEachCnuaDtenoGeauDgvongsaDdriestEawDckChlCglioCersterlingCddrellCckeBlugumDcasDaittCossDrendoEasDerDckhartFerziDanCinDgerDellerCeurilusDnordEikenEaughDmmonFDitesEschnerDcklesEhasCaudingDtterEoDnnerEeganDmmangDkneEerDgielloDdungDchsDaBiwckCtzrandolphEherbertEgerrelDsgeraldCsserDhellDchlFhaberFelEellaGCrpiDenzeCorilliFcaCnwallDklesteinDgersonGmanDeoutElloGDdlenDcoClthautDpusDoDlaDiDCgielDgeursDertCetekDstEerFlCckbohmDhtDchiCalhoEBeyhDereisenCussEierCtteCstiniEDkoCrtikDrusiEoneEioFngoFesGEettEatoFrioGaccioFntoEDouzDnetteEandersDkelDetErEnzCnrichDnimanFgDisonDdrickElasonEDbertClverDthamDoniaDlingEezsDizardoEoEcienGaFanoEbertyCistnerFerDntuchDldsDghnerDermanChrsCgueroaDlesDetteCerickDlaDhlyEeryCdorkoDieDezkoEwaErkeilCctoDhtigEerCatheroffDgansBazzariCycurryCwsonDlerCvuzziDroDianDazzaCuseyEDpelCttoreDoraDhyEreeEereeCssingerDkeCrugDsDneseDkusDinhaDenDaimoEhkhanEgherCntiEerEaziaFuzzoDsherDdinoDatiaCmagelttoClzonDlowEensteinDenckiDcioniFCileyEdeDgleyDdleyChrniElanderEentholdDningCgoDleDerquistFlundFaesCcelloAezzelleBytonCestoneBxtonCantusBvjenCilsizorCerttFsenEsmeyerEroadElineEetCarttDnskyEchoBullBttmanDienneDelCringerChBstronzaEemEadeDokDleDimableDessEllaDanislauCsixDencyCquinaldoCpiridionEnelDeronEnlaubEjelDarsenCmontFDayEiliCkinsFdChmonCfahaniCcoberDanlarBrzCseryCosCnsterClebachCiksDchsonCgerCediaCdosCcoleFanoCazmusDsoBpelBovaldiBnszDelCockCnesCisCgnathDferDelmeyerFbergDardCdrisEesonDorfDersbeECcinoBmshwillerCpasisCoreCmondCilianoCerlingDnahaCdeCberlingCanoBlwayCveyCtringhamDerCskenDheimerDaesserCrickDedaCpertCnickiCmesClsmoreDrodDoDinghuysenHamGburgDesEnbogenEbyDcessorDamarCkeCijahDgioDeffDckerDanEdesChadiCfenbeinCenbaasCdringhoffDCbieBkeCasBisnaugleDimingerDenhaverHrdtFbergerEleinCnwalterCghmeyCdemillerCckmeyerDhstedtEenbergEbergCbelBhrismanDenzellerCmanCliDCelerBgwuohuaClinDerCersdorfDlstonBfthimiouBelkemaBduCridgeClandCenholmDmBconomouCkmannDbladDardtChternachGBbrahimiCerstFhoffEheartCbettBayrsCveyCtoughCstlingEernGlinCrthlyDingCklesCglemanCchoCbyAdzwonkowskiCurnakEillaCiubaDnskiDewanowskiEkanByrstadCdoBvorskyBuyerCttingerDchessCstonDhCrwardDstelerDpeeDoughDniokEanDisseauFEgaDdaDborawDaCquaineCplessyEantiDesErreDaskiCosCnshieDpheDnellDkinsonEerleyEanDemannDdermanDcansDahoeCmouchelDmettDenyDbarDarClanCkettDCisCguetteDreCfrainDauchardCesterhausHbackDrstDnwaldCdzikDychaDenbostelDdenCcklowEeyDhnowskiEaneDemanCbovskyDlerDerElDbertBrutmanDmmeyEboreCoyDwDubayDrbaughDpinskiDnkoEickDggitisCisselEcolDnenDessenEdricCeuittDnningDlickDjkaDissDbesCatchDkulicEosDimeDgovichEichEgettFDbickiBoyscherCxbeckCwnyEhourDlandDkerDdsEaCuyetteDthettDghmanFartyEaDdnaCtoloCssmanDhCrsinvilleEayDrillDoshDnbrookDlandoDioEeDcasCportoDitaCorleyDnerCntonDoDnerbergEalleyDlyukDkleDilonEgerFanEelDcasterDatichEherFEghueEbyCmowiczDitrovichEnowskiFiakDeniceDbekDagalskiHlClsenDmajianDleyDinskiDhunDfiDecekCkovicDChrnCerksenDlgerDberlingCdyDimeadDgionCckumEertyDhtermanCbrzykowskiEynskiEushinEoskyEininDisonDbynEeBlugosBitucciDtusEmannDoDmarsCsotellErdaDharoonDchnerEalaDalviCrthDrDienzoCpolitoDilatoEetrantoniDanfiloConeffDmedeCnuzzoDtinoDsmoorEdaleDosEraDnendahlDkleDingerDgilloFeEellCmitryEccoDezzaDarzioFioGanoEncheCluccaDlisFnerGEashawDilloDgDellaCkerCgiouanniDeorgioCfronzoEanciscoCetterickDstlerEDrkesDkemaDderichsDballCdwayDonatisEmizioDioDatoCcosmoErpoEccoDlaudioDhiaroCbleEaseDiasiDbernCanoEiEgelisDmantopouloDcoBhruvaCeelCarasBezaliaCyakECwolffDickDeseDaterCvotEstDisElliersDeryEnyFnyEliceDasierEronaEnskiEiCusCttorreGDrolioEichDillionDesoErmannFlineFdingDchonDaeyeCstinaEefaniDruisseauxDormeauEniaDmoreDkoDimasDherEayesDcheneDantosFdoEmparoElvatoreCrxDuiterDosieEgatisDmanDkasDivanEngtonEenzoEanDeusEnziFtisDderianDastelEpsCquinzioCpratoDontDiroEerroDeysterConarineDcampoCnzineDwoodDosEoyerEmmeEiaDnigDjenDiscoEckDholmDfipDeuiEtclawFEryCmuzioDskeDpewolfDorrettFiziDnyDiterEltEkEenEanczykDetrakosErDbekDauroEseErtFinoCluzioElloEcianDtufoEoraDsoinEavioDrossDperdangEaggioDosierEngeFaisEgeDmendoDlwoEumEossoEiveneriEefaveEaroseFpentaFmonicaDgodaDektaEgadoDdonnoDcoEeDbeneDavergneEshmuttEpuenteForteEnaElloEhayEgolFadoEbarreCkruifDoningDeyzerCjosephDardinGenCisterDgadoDchmannIChmDlingerEDetreDaneyEasCgroodEassFndeDooyerDnimDlandonDenfelderFaroEarDagneCfrangFinDossetHEntDirDayetteCerdoffDlyCdricksonDnamDerichCcurtisDourtGceyEckDlerkDiusDhavezEDemberDarvalhoFmineEireEenCbrosseEetoFchtEaeDoreDienDenedictisDargeFdelabenEetsCasisDrsErudaFingEingerGEcosDnesDkyneBazziDiCyaoCwkinCvoltDiseEneEdsmeyerFowiczDazEriEnceCusterEeDlerioDghtersEereauDbneyCtamphayCsouzaDkalDhnoFeDenDchofskyFCrwichDvishEeauDtingEhardDronDonDnstaedtDmodyEientoDingtonEanoFDdenneDakjianCnyowDnisFelsFEellyHeyEattDielyDgelisDeseErDdoyDcoEaDasCmrellDoneDmsEeClportoDoisioDmataDlisonEamFgoDegowskiEckiCkuDingDenCjerDaniCidoneChlkaCgresDoDerCfonteCdaCczewitzDhAczyszCubakowskiCartoryskiDpiewskiByrnekDeeCgrymusBwiklaCalinskiButreraDherDchemberCshnerDenzaCrreriDlisDioEmaoEaDeyCnioCmolettiDberlanderClpitDlotonCffyEmanCddingtonCcutaEfateCbineDanoCadrasBsuhtaBrutisonEherDsinberryDmmellElyDffCozatDssmonEiarDokshankFesDnobleEerDmeansDlleyDfuttDcketteCivelliEaroDstinoFeEseyEalliDleyDbariCeweDseliousEcentiDppsDnwelgeDitzDginEgerDekbaumDdiDbsCayfordDvyEalhoDuswellDthersDskDppEeEanzanoDnsonFEnellEdalDigwellFmyleDfterDdlerBoxwellDenCwlinCvitzDentonCutreEinhoEermarshDrtonEseaultEregeEeyDlonEibalyDdenCtonCsteDsettDmanFDlowDicoDhowCrwellDvoDujoDtopassiEinezFjoDrioFngtonFherFdanEgaEelaDpingEeDonitiDnnEmesserEellaFilleDkronDfDeenDdieroEewFnasDcueraDbleyDayEhamCpsteadEeyDpingEesDneyCopperEeriderEageDnseDkerlyCnwrightDtrerazEinenzaEesDsueloEtineFanzoHtinHcioEentinoDradtDourEleyDneyFratDlogueDformeEaloneDewayDdroskiEinaFffFDchadoFEatelliDaughtyCmmerfordDissiongEnskiFottiDarClschenDpiEaDonyDlonsGEicottEeaEariDkerDierDesarEmenEcchiDcherFadoCklowDelChickCfoneDfinbergerEellGCdispotEllaCcroftDkerhanDhrenEenourCbettoDarCalterBlymanCuverDskyDnesDkiesCowerdDuatreDssinDosDkeyCinkinbeardDfftonDbonCevlandEerleyDscaDrcDmenzaDathEsbyElCavijoDterDrosDghornDcherDboBivilCttadiniDroniCsselDarCrellaDcelliCprianDcicCottaCnnamondDkanDcoDarCmorelliDineraClentiChakCeloszykCdreCcenDaliCbikCavardiniDnfraniEciolaDllellaDffoneBhyleDCurchfieldEapeDmaDllaDengDbicksCrystalDosniakDiswellFtopoulosGiGersonHnburyCowenhillEanskyDudharyDrDptonDlulaElettDinskiDcronEkleyEhrekDatesClebusCizDtrikDsmanDpheDolaEdiDnaultDmeEalDlsomEloDclesEharelloEalaceDarielloEppariChanEmCezDvisEertonGezDuDssmanDrubiniErinEokiEnyFichFeskyEanichitDeseboroDchDamCavoustieEiesDumontElklinDtampayaDssonFaniolDryEvetEryEiEarriaDppoFaEmondElikEenDnthaseneElerEcoDmulEpacoDlupaElinorFaEenderDknisEkalakalDistyDddickDboyaEerekEbezBeveraCrverizzoFntezEantszFDroniEiEelloDoneDnutoEotaDminaroDfDettiDceoDasuoloFoFiErEosCpinDasCntiDdanaGCllarDeyaCderCcotBazelDareeCwonDeinCvrakDenessDalarisEianiCuterucciDghornFellDazosCttsEanachDriniDozziDignaniDholicEersonGineFllDelloDchpoleDanzanoCsuscelliDtrosFeyEongvayEillionEelumGlsHionDslerEinoFlanoFanoEettyFnsFllsEavaughFgneFDolaryDmoreDleyDkaDisEniDhourEmerEettDementDciatoDavezEsolaErzFEnaElesCrvillEalloDtnerDrousalEizoEettaGhersEaoFnDpenDoselliEllaDnilloEegiaDminFckelDliniEandDknardDiosciaEnaEdeoDfreyDdinalliFffEazoneDbonellaEeryFeDavettaFatiEmeloHlaEigEbineECpristoFDpelliniDoriccioDicottoDestroEnerEkDasEccinoCoagdanCnwellDtellaEakisDsonEinoFbogDnistraroEerDezaEyEvaEttaEstraroDdozoElishEellDantElezDCmusDporaFbassoEbleEauFinDlinDisaDerinoFanoEnischElinGDbiaDarenoEnchoEckClvanDumagDtagironeDowellDlnanEingtonFhamFgaroEerEarFmFgyGherFdoDimanDdronEoronEareraDcaoDafCkmakCjulusDkaCivanoDresFDozzoDnsEneDmiCgnonFDanCffentzisDassoCezCddiganEelCcatianCbugosDonDarcasEnillasFelaEmAbywatersCstronDeCousCnunCczekCbelCalBuzzaDoDisCvinghausenCtzkeDtrossFayEkeEittaDenhoffCsscherDkDitzkyDhwellerErodEfieldDchurDaccaCrzlaffDvineDttsEschiEellDsikDrsEasDowsDnieEashDmsideEDlyEsonEileEazaFgeDkstrandElyFowEinDianDgsEoaEeyFesDfeindDdzelDchinalDbineDattiConassisiFiutoCntzEsEenbachDsonDdaCmpausDbaloFcaCllivantFnDiscoEkDeyDatCkowieckiCilesChrkeDligCghCffoneCenviajeDlerDhlmanCdzikDyDrovichDishEaoDhuDenDdyDCczkoDknorEmeonElessEettEalooDhwalterEmillerFeierEiteFnskyEeliEannFlDaroCbolzFtzDertBrzezickiEnkCysDngelsonDlaDingtonCuzewskiFkDstmannEserEcatoDnzelEkhardtEickEettaFczEaDmaghimDkerDinDglieraDffeeDeskeEggerEchertDckmeierCroksCozeskiDyleDwnlieEmanDudyDthenDskiEiDokskennedyFieDnstonEcheauDmmerDlaDitzmanDhnDglioFeyDersFingDdtmannEisFneEfuehrerEessGDckusFenberryEinerEhetDadnayCizenoDttsDnleyEkhausEiusFngerEgerEdzaFgerEarDlowskiDgnerEhtharpGerDenzaFenDdenbeckerDcksonCeznayEinkaDyersDvellDttmannEosDsserDntzEnickEingEdelandDmDiterEhanEdiganDdlowEinDckleyFensteinDbesDazEudEthEdyCazieDunwarthFbergerEmanEcksDthDsureEswellFeuxEkettEbyDntinghamEsfieldFeumEoEgersFEesEdstromForffGmFenburgerEckFaccioDmuchiElittEelEascoEDkkeEDgetEadoDfmanDdmonEickEeyEdDcklinFbillDbazonFndBozychDicCylDensDdeDasCwlickEeDcockCuyDviaDsumDrraineEgonEboisDquinDmthaveeDlgerEchEaisDghnEesDdleEjoukDcouvalasEaudCttrellEoniEellaDhnerDellioCswinkDtowEainDsonEierEeyDoldDletDhnackEellFersDefskiCrzaDyszewskiFewiczDsonEethDrotoEigoFelloEelloDowiczEvetzGcDgeltDdingerEasEDcukEherDbridgeCothmanDkhardtDcockCnwellDsalDnoittEifieldFckEelDkerDitaEngEfieldFaceDgleEivengoFoEeDettEbrightDdroffEocEaDcellaDaventureElumiEdonaEccorsoJiCmpianiDmerClvinDudaDorinEnDlomEettinoDkDiverEneEeuFkDeynDdulEeryDanteCkorDlundCjanowskiCisuertElardChrenDmannDlingerDartEmCgustDhDatayEnyCevingDshoreEenbergDrstlerFDnigDlscheEkeDkhoutEelmanDhnerDckmannCdwinDreyDmanDirogaDfordDensteinerFheimerDdorfEekerCckskopfDchiDageCbolaDkoDenCardwayFsBlyzesCumenkranzCoomgrenDngEdeauDmmelDisDemDcklingerCissetDmkaDlerDeseDceCeyerDtteDshDnderDmelDifusDchingerDattlerCazoskyDttiFeauEnikEchfordDnkshipGchanEdyFinoDkewayFboroughDhoDckstarFgoatEhlyFerFBizcassaDarroCvingsCtsuieGEkoCstodeauEerDonetteDhelDconerFchoEahallDbyDagnaCrtsDnellDklineEenheadDenbaumDckettFbichlerEhwoodCorkmanCmlerClousDlinghurstEeyFterFgasEardDkissDeDcikCgosDnallDioDgioDasCfferEarCesingerEchkeDrbrauerDnfangDhnDderwolfDberleFlCdonDnerDgoodDezErmanCcklemanGinEetFrEartDhelCardDlikEczykBeznerCyrerDlotteDerlCvlyCulahECtzelDtermanDsingerEchmanDitaDhurumEoneyECstonDsoEickDioDhearDarraCrvigDtusEranoEovichFlasioFgEinettiEelleGEchEagnoliDschauerEaminEDriEettiHaGDnuchoEtEstromEoEickGeEhagenEardoniFboDmersDloveEinghofDkhalterDishaDgsengEreenEholzEertDezEsnyakDdesDasCnzschawelEiDyaDwellDtyErupEeleDserDnisonFnkEersonGmanDitoneEquezEkDgelsdorfDellEduceEckeEarDdzansEyEtEorfFlphElageEersEavidDckDassiEriEgeEdomEbidesCmburyEoomEerryClyoussianDvealDseyDongieFeFEffDluominiEomaEmayEishGarioFnghamEflowerGeurEerdineFmyEazerDkowskiDichDfiglioDeyDdinDbackDardeEngiaDCkermanFDCiswangerDriseChunDningDmerDlenCgorDgCetleyDsDrmudezElingDckCdsaulDokaDnorzCcklundEerditeFndorfGbachDhtholdEmanEererCavinDuprezEmierElievEgardEfaitEdrieDtheDsmoreDrupEfieldDhnDdnellEellBazzelEanellaDelaisDataErteECyleDeteCwaCvzeeDardCusleyDnleuangDmgardEbuschDknightDghamDersFmeisterDblitzCttistiniFatoHaEersEagliniDhurstErickDelDalonaCsuaDturaEressEillaFdosFcEenFdoEainDsilEetDhinelliDbasCruthEfaldiDtyllaEsEropEoszGiakFlottoGetGdusEnettEloneEhenGlmanEenfieldEczakDsottiDrocasEileFeauEerFiraEangerGcaDqueraDnscaterEfieldEcastleEathanFrDlipDkinsEenhagenEalowDimahEdonDhydtDgarDffDdeenDcelonaDbyEiniFereEettaFrisHanEanDaschEnowGvicEjosEbyCptiesCnyasDtugEinFllanEayDsbachDkemperDisEckDeckerDdinEemerEanzaDceDalesCmmonDfieldDbacignoHClyeatDvanzDsanoDmoresDlreichEoonEmerEintynEeyFttaDhornDfordDezentisDdreyEiviezEerEassarreFcchinoDchunasEeiroDbinDazEskiEnciaEgtasCkstDkumDiosDeleyCjorekDdasCizerDtgDseDlonyElioFeDeraChunDCgneDiDhdasarianDeantDdonasCetzDringerCdgetDeauDdeleyCcyDkeyFnstoseGFEboneDcoucheFDarellaCbitschDenaDbinEelDatDAazzaroCoulayCimiCerBylsworthCarzaBxlineCelsenBwtreyBvolaCieCetisyanDrytDadoCanzatoDlaBuyerCxilienCwarterCrgesDesCpreyDperleCnkstCmichDentDavaeClbachCkesCgspurgerCffreyBttridgeDkissonDingerDaConDeCiyehChmannDayCchityCallahEaBstwoodDolfiFDersCpegrenCmaChpoleDfieldDelyCevedoCchmannCarDeliBrzilliCundelDjoDisoCturoDryDisonEnianCrizagaEazolaCpinoConsEhaltCnttDiotesDholtzDebergCmilleiEjosDClethEnDanCkinsCjesCizziEolaDyoshiDngDmotoDgoDettaEDdasDcasChelgerDartCguilloEellezDoteDenalCenosEivasHrEdzFseeDbelaCdizzoneEonDeryDdDanCcinoEllaDeaDauteEngelEdipaneCbryCaqueDminiEbuiaDgusFndiEoniEakiDdanasDbieFaCBpyuanCuzziCruzzeseCplewhaiteFburyDelingFgateClingCkingCelaCaroDBoayBnyanCtricanDonopoulosFisGchFaccioGElikDinoreDebyCslingerDbacherDaraCnetteCkersenCisDolDngalanDelloDchiniDbalCgvianoDlumEeyDererEloroGffGcciCestosDrtonDlliCdzulisDrussEianEeattaDonianFDeronEbeDaryCcyDellCasagastiDkaleaDgnostouBmyotteCtowerCsteinDingerEliCphyConetteDlschCistosoEanoDdeiCesquietoDrtDntoDlingEangCbrozFsoneEesDleDersonEauCatiDrgoDncioDillaDdiBlzugarayCvorezDerestEnDarengoElleEcadoCummoottilDkonisDCtwiesDumDringerDopDheimerDewErioCsmanDdonDbrooksDandorCrichDaisCmarioClorEccaDnuttDmandDhandsDgaeuerDessiEnbrandEmondEgreDcornDbonesDamongEbandCgeoECfredsDeraCexzanderEiouEakiFderDvedoDrteDknaDizarDgiEarDffDccaCdregeDiDarondoCcosibaEmbrightDeDaoaEideCbritonEekhtEachtDerthalFroFdaCattarDrDmpiEosDibillaDcanoBkuchieCramCinyooyeDereisenBimbezClstockBhyouCrenholtzConenCmauClstedtDeDbornCaronofGDlBguinoElleraFerDedaDalloCriosEestiEcolaDesteElaECneyECliamCertonBfoaClaloCfeltDagatoCanBemmerBdzhabakyanCyCsideCrovelDidConisClemanECjutantCessoDlsCdoCamiakBcronCkinsEesChzigerEetDekianECfalleCcetturoBbubakrCsonCramowskiCoytesDulissanClingFDangCkeCetraniDrnathaDlaDbCdinDelwahedFlaFdayenFCbinantiDayEdessaCayaDunzaDttiBasbyClandCbyAzysettBwingerCeierBuziakCsmanCroDkusDheideDawikCniegaCmotClligCkowskyEfDermanCclichDharaCbrzyckiDerbuhlerCazoBsoharCchocheBrimsekBoutteCtosCrziDoiwchakDensCquierCniaDeDdloCmoraDbroEoryFEergClmanDlarDinskiFasCellickFeDbischCdrowDaCbellBmiejkoBlotnickCatkinBiyadCterDaCsslerEerCrinDcherCpseDkinDayCnniDklCmitDbaDanClerDahiCkoChalCeskeEerDntaraEcinaDlonkoDkDhmDgoEenhagenDdanDboldCdzikCckuhrDariCbertElliCakDdieBezimaCyadehCtoDesCrzanDringDomDckDbelCntgrafDkerDerDbaverDaCmonDjanisDinskiClmarDlousEefrowDkindDenyFkoCisDmetzEantzDlmanChnpfennigDeCegersCckzerCbellFCalsBdrojkowskiBazozdorCxasCwadzkiCvatsonEdoskiCtkoCstawnyDpelCrzuelaDyckiDuckiDtDrielloDozinskiDnickDkinDitskyDellaCppoloEileEavignaDotickyDicoDatoFasCnuetaDterDolaDisDeskiDcoCmzamDperiniEariniFglioneDostnyDmielloEettiDbottiFrskyDClwskyCkarianCitunaElinDdelDcDbelChriEadkaFDorchakDarchukCgoracDenCffinaEalonCdraDowErDdCchariaGewiczCblonskiDkaDikEelskiDekAyuznCsteDiCrkaninDichDchiakCngclasEbluthDanCkiCehCchaBslavaBrigollenCaguiBpinaBozampCvinoDanovichCurnetDnkinsEgloveGasDketCskoDhimoriCrtonDnDkmanDioDgeyCqueletCnkoskeDgueEeDeyEmoriEkCkielDelyCdersCBngsdalBlonenBilmaCdiarisBezekCstramskiDsiosDkeyCrryDlyDbichCnzDneyFrDglinEichDdellCldonCkelCisleyDldingCggeCendDloyCaricksDmansDkleBdaraBbosCalleBavorskyCterCsutomiDinskiCrzabalDrellDishCnoffDnottiDkovitzDityDettaDduraDcikDanEiCmnitzDmineDkosumpaCkulisDlichDelChrausDnaDlCgoudaefDinDecicCftaliDeiDaiCblonskyAxanderAwzorekBykesCdryckDoDlerCcuffCbornyBurtsDglerColleCnderlyDClkanCitschickCestenbergDrzDllenweberCchererCblinDbelBrottenCinklesDedtCenneDedeCaggsBoyahnCulardDdenbergCskobojnikDherCrtingerDstellFDnerEDmelyDlowDkingsHerCotanDlhouseEeyhanEcottDdliffEertFndEburgEandCmenDboltClzenDthuisDstedEkyDoszczakDlerDkowskiGieckiDiverDhokDfsbergerEredEfeEertzDbeckCkwiczCjtowichEeckiDnaroskiDeikCiwodeChlwendiEschlegelErabEdCesterDrnleDlzleinEfleCdskowBlosinskiDdykaCazlowskiDchBizarCuffCtvoetDtstruckEryEliffEerstauterDsellDoskyDhyEerbeeFnshawDczakCstermanDnoskyEiowskiDkowskiEDingerDenorDchnerDbeyCrtjesDghtDfCpprechtCnzlerEenriedDtringhamEertonGfeldtGbottomDstedEDningerHEeyFwisserFrsFganDklepleckGblackEelpleckGjohnGbauerDingearEkoffDgstromDettEsickleFberryEkDdmeyerEhurstEamCmpeyDanCltsEjerEerdinkDlrettEourEmesFannEinskyGgtonFgarFamaEegalEcoxonEandFmeFbyDkowitzEersDisonFDgockiEingDfingerDebskiDdinEfongEersonFnthalerFisenEauerDcinskiDanskyEbayCkinsDertDCinikainenCggainsDenCetoDssEmanDrzbaEschenImDheDgerDderwaxGinFDciechEhertGcCdrigDowskiDmaierDlakDdoesCckusEettsFmeyerEaDinskyCbetoDberleyFnmeyerCatrakFDndBhymanCollyCittleyFikerFekerEsetEmyreFeyerEheldEesingerFmoreEackerDstleEkerEentonDppieFDldinDgumDbyCeltonDeingtonCanDlerEBeyhrauchCwerkaCtterauerDsellineDklowCstwaterEromFeEhouseEervoordeGgaardGbeckEcoteEawayDselinkGhoftDlowskiGDcovichCrthmanDsheyDriesDnliEingDmaDkingCnzellDtzloffEcellDstrandEkyDnerstenDmanDgrenDerEckDdyEteEerothEDclawiakEeCmarkCltmerDmsEanDlendorfDfelCitkampEhDszbrodEsmannFertGFbrodtEmillerEigerEenhornGfluhGdGbergEdorferEbergerDratherDnzingerGmerFetlEtzEandDkerEalEDgmanElebEartDdenheimerGDckumChringDausenCglinDhorstCethEerDnumDlborgDgarDberCdwickDnerDlowFckDiDgworthCckenborgDhselblattCbbsEinkCavilDtherleyHillDrrienElyDgelDdonBaymerDdeDbillCvraCughtelGalDchCtzkeDtsonDrsEalDneDerstonCszmerDylowFiszynDsermannFnbergGaarDkowEeyEaDhurnFpFkEnockEmanEinskiDemCrtmanDsmeEingEchawEagerDpoolDnekaEaschDmbierDleyDickDholicGaGDensEheimDdropEonEmanEinskyFanCppelCnvigDserEchekDlandDingerDdersCmpolClzierDvoordDtoEenbaughFmathDovenDmanDlyEravinEorEingaEesFntineGdaFckEbrownFergFankEandFkerFertFckDkinshawGgDickiDdropeEmannEenbergDczynskiEhliDbrechtCkulaDhamDenightElingCitkusDsmanEathDnmanChoskeDnerDlenmaierDidCgonDgamanDenheimDanerCfulaCeyaertDtzigDltiDckerlinCddoudsCckmanEerbarthDhsmuthCbashaAvyhnalButuroClgamottCkichBriasCanichDblicBotrawDerDauaCskowskyCrwallerDholtDacekCongCnwagonerDstadenEoostenDkrosigkDgxayEvivathEuntenEsakdaEalDfeldtDdohlenEerkellDbraunsbergDarxClpertGEaDminkDlmeringDkingEersFnsDinDeskyDckmannCjtaCitaDghtsCgtmanElinDlundEandDenthalerElpohlDdsCetmannDdischCdderCceBlkCasatyFkDhovichBizzaDueteCvoloCttumEekDorinoDkusDitowDeraDantonioFiemiCsvardisDsmanDovskyEskyEcskyDnoskyFckyDcarroDayaCrtsDklerDgiliFeEelDelliDamontasCorelCntinnerFmillaDselDiegraDckCllotEenasFmaretteFcusEaquiranFneFlouosFescusaDkoskiEamaDcaDaroFdoEndreCkenCgusEerieDoritoDarioCessmanFelmanEcaDrthalerEpsDntosEneauCdlerCctoricaDkeyDiosoDhidvongsaDcicaBeyseyCspiaDelicCrziDseleDobaDnetDlotteDiganDhaagDgaminiFDfailleDelaEDdineFguelEDbridgeEleEitFllaEascoCnturEriceFeEorsEhDoshDnariDkusDingaEbleDghausDetosEreEableDdelinCmuraClzeboerDtreEinDosoDesEDdCitzEenheimerDnDlletteCgherDetabileDarCerkampDnCcinoCbelCaterDderCBayonDnerCvricekCuterDlxDghnerDdreuilDbelCttikutiDhroderDchCstolaEardisDsureEilFeEeurFnDquizDaureCrvilDtanyanDronFDgisDeskoDdaDaneseEkutaEgonaCnzanteDyoDwyngaardenEassenhoveDvolkenburgEalenDtuylEilEaDstromElootenEicklinEcoikFhaickDruitenDostbergErsdolElindaEflenDnulandEoverFrsdellEielloFEerDmarterDleuvanEaarDkilsdonkEammenDhevelFukelemFeEauenFmlinGersveldDgyiEompelFffEerbigFlosDfossanDezEffenDdygriffFEuynhovenFnkEorienFnEiestEeweertFvortGereHbleFstreekHeegFrwykHoodHiltHegeIerdJlGtuigGstappenHchootGmoonGkaadenGhootGboomGauFnacreFmortelGanFlaareFbrakeDconantEleafDbogelenEenthuyseFckDasseltEprasertEndelCmpaClsecaDreeDotErieDlimontFeEentineFlongaEarioEDgrenDerEnzvelaFtynFsteinFcianaDderamoDcinEhoDakasCksmanDilDaCjgrtCissiereDnioDkoCghyEnCfiadisGesCezaDthCdasyCclavikDioEDheDcarinoDanteAuzunBxaBvallesBtvikCtleyBsticoCmanCinaChiodaEjimaCcioCackBrseCreyEtaDacaCnessClanzaCiostejueDkCenioCdianoCbietaBptegraftCpencampBnterkoflerCnoldDewehrCknCiackeCglaubCckBmnusCezawaCbelBltsehDrerasCsesClumCischDcnikEhCemanBkichCenBhrinDhammerClesEnhoppBgazDitafaBekiCbersaxBdinskyDciousBchaCcioCBbryCilesCertiniDnceAtyssensFlingCranceCnioClmanCdingsDemanBwohatchetCitoDllieDetEstCeetDddellCaitBvedtBuxburyCukanenCtuskaDoniDelaCshoskiCrvavilleDturoDrillFeDpianoDomshaEcyDnpaughEowEmyreEierDkmayEaszDinettiDesonDdoDcioDbinerFdeEerFDanskyCpyDpenDlanoCortoCnonDgetDbyDCmolilloDminiaDblestonCllisonDisEauCkuafaDisCjagueCiaCgadeCffinCesburgDrkEDngeCdrujDmanDiscoCccioDayCbermanBsurudaDchiuraGdaCistinasChudyCchirhartEacheCantakisBrzaskaCythallDninewskiCuontDmppDkaDioloDglioDeluckDdoDchonEchioDbeDanCoxilDwelDvingerDtzEtoDsenDostDnzoEtDmetterEbinoFaDllopeDkeDjanovichFkDhanovDgstadDeDcchioDbridgeEoughCnongCivaneDppelDmnalEisFnoDltElasGnaDgliaEilloDfoneEfoEeroDdentiDcoliEamoDbueElettCevithickFsoneGFllianEethanFsDusdellDtolaEinaEeraDsselDolaDntzFoFmanEorEnellEdEchardDmoreEilloEbinskiDllesDisterEneEbleDffDdinnickEerDbonEeschDarCavissDuxEtnerEschEmDttnerDssDphagenEeniEalisDnerDmontiDinhamEcoffDhernDffanstedtDchselEewellDboldEazoBozloskiCyotaDnCwseDnsandDelsCutonDssandDpeDneyDdleDchardDbyDartCtzkeDotzintleDinoFgCssieDcoEhCrtuEolanoEelliDruellasEosEionFlloFcoEeblancaEanoDongeauEmanidesDnincasaDeyEnDbusCquintoCpolewskiEianDnessDlistkyFffeDalEcioCothacreDmsDlsiramEanDkmanianCnziDtiDschockEallDreyDnesenEarDgateDettiElsonDderDaiCmsponEkiEhackDkusEaDidyEchekDeldanEhakDblesonDassonFicFhEnekClontinoDlinEerudFfsenDineCkleyDkesdalChenCgashiCfollaCepperweinDllerEkeDdebuschCdtDoroffFDescoCbozElskiCastonDBlumackiCatenchiFlpaDmkaBjandraBixCvisDarCtternessDoneDlerDhCsiDhDdelEalDchnerCpreDpeyDoldCnucciDtingerDnerelloEDlinDgerCmusDotheEnsFereFDenezDchulaDbrellDasErClzerDusDtDowDlouCetgeDngCchnellEiCborBhyCuryEnessElbyEbyDneyDmaDllCruthleyDossellDessElfallDappEmsEenCouvenelDrstensonFnessEoughgoodEnboroughEmaehlenEadeDnneyDmponEetzFczekEasesFeDburnEbsCivenerDmDlmonyDengthamElgesEklinDdphyDbautFdeauCewDuleEeninDpbanthaoDosDllEinEemaqueDinertDemanDdenDboCansamaiEosEgaveluEemEasoukGDmannGDllsFerFDdisonBewoldeDaCutebergCteakCstolinDsendorfEDmarDchlerCrweyDtinekDstageDroneEibleFanEezzaEaccianoDpDoganesyanDmilusDinoniEDhorstEerstDazesEvainenCqueCohDdoroCntionDoreEfskyDnDhoffEaeffDgbenDerovichFDdaDarioCmpeltonDoneyDanCllefsenDkampDgenDesDchDanderCkluCixeriaDssedreEbergChneyCgnerDanCeheeCderDdyCcuanhueyDhauDchioCakellDgerBaylarDanCwwabCvolieriDerabDarisEnaCuzinDtoloDschDlaDaliiCttrieDsuharaDonDgeDelCstetDsaDmaDkeyDhiroCruerEcDtsahDskiDrenisDnoffDmeyEanDlingDellaDdunoDboroEertDayEsCqueCpianDhousDaoanCnziDtumDnousDkxleyEeslyDhDgneyEermanEaroGiFbekyanDdusEeCmkinDiDburrelliGinoEorlaneDaiClvyDskyDleutEacksenDiferroEcskaDentinoDaroEmentezEgaCkoDerDaraEiCjudeenDimaCitagueDlleferEChonCgupaDlauerDalogGeFaEcaDCfitiDelskiCetzschDgelCdtDgersonDdioECcopinoDneauDketteFsFDhauerDasonCbuenaDionDattAszyshDmonikCwedeCulimowskiCpakCokaDckiCklarskiCitarCewcDsterniakDrmerEbinCczepkowskiFblewskiCachewiczDbatByzdekCrrakosDiaCpultDoltCnovicDerCmkowickDeonClneyDlaCktichCerBwopshireDlleyCithenbankDssDrczekDnglerFenEertonFaDlleDerengaFczynskiEcaDcordCerdloffDnceskiDltEgartDhlaDetsEmDdDatmonFfieldCatmanDrtzmanGellDntakEstonEcuttEayDmmEDitEneyDggartDbeEbBvobodnyCetlakDnnungsenDdineCatosDreDncaraBuydanCwannakinthoCvadaCttinEeeDkusDicDhersDcliffCszynskiDtarFireDkayDanyFinCryanarayanaDvisDprisDoDminecDguyEoineDesEnDbellaComelaCnyichDnigaDierCmrowDptionDmerlotDerixGskiCltaniDleyFnbergerDipizioEnEmaEkowskiDenticEjmanovskiCgaboCffieldCentenfussDhsCdekumDbrockCcreDhockiElaDgangDcarCbijanoEchDertFaCaavaBtuttgenDrnerEkEgulFhillDkowskiDesseErmerFEbeDdyvanceEnickiGarzEmireEdifordDckeDblaskiEbyFendeckCrzalkowskiDuzziFikEbelDozewskiEweEusEtzEmbeckEkerEhmayerEgenDizichEniFgariEmlingFbackEfeEdEcklindEbleyDevelsHlFaEtzEngeEmiEleckiEjanEitnatterEffFelerEetonEdDazisarEyhandHmEvinskiEuszGnerFhalFghEstersEnfordFdburgFahanEhinEdtnerEcquatanioFhmanEathofCpierrieCoviakEellDutengerEdymireFEchEallDttlarEkoEhardEesburyHerryDrtoEesEageDosDnichDlzenburgElyEebargerEcalsEarDklasaDgdenDffeyGranDeyEttEltzingFEkeEfflerEckertEbnerFerlDdomingoEderDckwinFonFiFebrandEcoDbieClouiseCivesDrnEeDpanukDngleEespringFhourFbuckEdtDmpleElerDlwagenEtzEnerElieDgsellDernEnsEhmEgmanFemeierEbDdstoneDcklinGenFfordCholeCfordDlorantCeuryDtzenbachEkeDrpkaEkerGnburgGlDphensenEanEDnzEnEdebackEbeckFackEDmmlerDlzlEtzerElpflugFfoxEkEeDinruckFmeizFkuehlerGirchnerGellnerFerkertGFbrinkGauerEkEghnerEertEchEbelDhnoDggemanDflEfordFaEanatosDepEnwykFhovenElmonEgEbDdronskyDczoEklairEhuchakFlinskiDberFDarnesHECdennyCchurCayterDwickiDvrosituDudenmeierDttelmanEiresFonEhosFasDsulisEsenEnyEerEchkeDrweatherEsEnaudEleyEkmanFenEichEghillEcevicDplinsEelmanDnzakEwayEowskiEkowitzFaitisEiecFaEgroomEesicFrtFartEdsForsFifurFevenFaertEcovenFliftFeyEbaughEaDmmlerEenovEbachEatopoulosFsDlbergerDkoeEleyEkelandEemannDinbachDgowskiEnoEmanElesEersDffeldDenglenEhlerDdtherFEnikEickDchurskiEeDbsEleyGBrygleyCinvasanBquarciaficoEirBpyrakosDiesDcherCurgerDlickDdisDckCrygadaDuiellEanceDowlsEulsEngEleDingeDewellEngelmeyerDawlsEuveEgleyCotornoDryszEmanEichDonemoreDletiDhnholzClittDettDattCiterDrouniasEkEeDnozaEnEettiFlloEarDlisFakosDgutzDelvogelDcknallFerCerierEawDnnicchiaEeDllaneDgalDeDckenDarowFmonCaydDrtinGchinoFEacinaDnnuthFerEicekEgerEeDkesDdardDchtEagnaBozioCykeCwlDdenDadaCvelCuvannakhilyDtoEhandDrlisDlliereDhradaDCtosDhenCsbeCrzanoDvigDtlandDokataEDlieDhaindoDellDdiaDaceCptickDpelandDhyDczakCoyDpDmarooDluaCnterreDstengDnefeldFeDkaDgyDdrupElesEheimerEermanGeggerCmvangDsyDrakDozaEgyeEDmonsEarDjiDilledaDerfieldDdahDayorClwoldDverudDtowEmannDowErsanoEnarEmenDlorsEittoFdayDitoEnasEmaEesFnEchEanDhjemDeraDdeoDazarErskiEitaEdineCkulDotowskiElskiFowichCjoCitoDroDferCftichDerCechtingCdiniDervickFsDawasserCckeyCbrioDierajDeskiEryFanesEnesEDanskiCapeBnowderDrdenDdeCetsingerCaplesDerDdersBmyrskiDntekDkowskiCutzlerEnyDlikDgalaDckColnickyEinskyCittyEheDlingEerDgielCerdonDjaDdesDathersCarraEDllmonFinGdgeBlytonCutskyDskiCovinskiDterDneckerDmerDgerisDbodnikDanesCipperDngluffGandEeyDmkoEanFkCessmanDpskiEpyDimanDafordCaugenhauptDrkDckmanDbodaBkyesCweresDarekCubikCrzypinskiDebesDabanekCovlundDtnickiDneEczewskiDldDienDczenDbiakCimehornDllpaFettFanEdumDbskiEoCevofilakasDppleCarzynskiEtvedtEDpuraDflenDerDboBjulstadCervenBizarCxtDsmithCwickiCvillsFayEeEckDayEliaFCurekDdaCttreEnerEmanEerdingDoskyDkiewiczCstekEaDomphouEfoDleyDkinDavathCrpillaDoskyElliEkaDnaDicoDhanDavoCprianoDpyDhanConaDkCnrichDgtonEharathEewaldFrmanDarathCmpleEerDorEnielloFettyHEkatEensDmondEesDitianEchDersonEnskyDcockClvestriniEaggioDuisDtmanDovichDlitoeDkensonDiezarDevinacEnceDbigerDaoDCkarskieCglowEarCfreDontesDersCevertsenGsonFDtzDrtEadskiEDlaffDjaDdnerEelDbenthalCdorowiczDleyDiDemanCcksEelEafooseDinskiCbounmaDgertDetoElDalCarDperasDmiDlanaBhyneDbutCwabCuttyFersDstermanDrrEakDptrineEertDmmonDlthessFEseElickEickEenbergerDffleburgDbovCryDigleyDenDawderCowenDulderDrthairDpbellDobridgeDngoDmanDllenbargerDjiDfestallDdunkeDberCivyDsilaDrvanianEakawaDppenEDnskyEnickEkelEgleurHdeckerEdelDmonEaokaDloElitoGngsfordEkuskiEiataEdneckDkumaEeDgetaFmiDfferdDderDbiCettleroeFerlyDrvilleErockFangeGdenElesEiefEbonDpperdsonDnkerEemanFDmpertEanDlvyEsyEkoffDkelsDirichEngoldEdlerDheeDfteFallDererFDakleyCbiCawberDtekDskyDryEplinFersonEabiDppenEouriEleighEinoEerDnnoEdroEbergDmsiEmahEirFlyDlwaniElaEineEhoubDkoorEinDhinfarGFmEbazDffrenFenDdfarEdingEazzDbenFlBguegliaCrignoliCammatoBeykoskiDbCwyerdDeallDadeCveriEneyDadjianCttlemyreHiresEinoFmoEerlandDonDlerDiasEDchellDaroCstosoDsinEerCrvilleFEedioFDravalliDmersheimDfossElingDeyEsEnsFeDcovichDbanDattiGEsioEndosEivaFlleCpvliedaDulbedaDtelkaDpeltEanenFCnzDstEorEmeierEingEeneyGbrennerFmanDiffDgvilayEunDethaviloukEsenesDderlingGDavanhCmsemDonisDinarioDberClzlerDvesterDusiDnesDlinEardsDkeyDicDgradeDesnickDakovicCitersEDslerDlDkalyDdenbeckerDbtEersDavitchCgretoDoniaDgermanDermanElhorstCferovicDcheckCeringDmerDkfordEampDgarDdorffEborgDbaumCdanosCcundoDondDkletstewaDhangCbranekDionDeroEniecherDasovichCarerEaDngerDjackDholtzDgersDforthDcrestEatDburnBdoiaBczbeckiCurciDllinDitoDderoDcchiCsarpisnatoCroDivenerEunerEppsEmsherEchfieldDenciDapeCoullerDttsFingDrgieDllanCiulloDtesDcutellaDalpiEcchitanoChyDwormEizerFsterFppsEertfegerGdtHFnzerGnekerGdemanFmmerFitzEarzloseGtFntdFdronDutzeFeEstedErkEmachorElterHnsFkinFistEitEeringGenFnemanFmannEchatEberFachDrumpfEootFenGdterEeuderFackeEayterFwderFugerGbFmeckFffFdleFbDowengerdtEssowEpmeyerFflinFEminFasGckerEltensFinEggenEessowFpferFnmakerGigFlmanGlkopfHFbenEderbekEckleyDnureEorbusFppFbrichEitzFckelFbbeEepfFlderFidmanFebergerEackelDmollingerFakEittouFotFlleFerGlGdeskampFdtkaGlinEertzGgeGerFlmerFidlerEautzGderFtzFndFlingDlundFmakerEotthauerHeGfeldtGeFssmanFemannEindweinFmmerFeterFchenmayeEeppyFngerFkerFibaumFhFcterEaefliFdweilerFbsDirrmacherFalliEnnellFkerFgeckFdewolfEmelElskyFkFderEfkoFfmannEerenbeckGbrockFlkeFfersteinHnEckedanzDeyEurenFersErschligtFmaFbringGelEnoFfeldEllsGinGermannEiernFdererEgetzEffrahnGertEchingerDavoneEuntFmannFbleGhutEtzleErmannFlerFbroughEpEnzenbachFtiniFgeFdelEmmelElligEffterGeldIFersmanEenEchterleGsieckEbbingCelzoEsiCavoEettaDturroEenatoDrpittoIaFatoHiFElatoEgallEfiDntlenEneuFapiecoEioEdrettFaliosEcarelloDmehornDlziElornFionEetDianoFDgliottiDceBboroCarraBaysongkhamEanaDloeCxingerDfieldCwtellDranskyDhillDatzkiEiaCvitchEnarEDenDasEriaEkisECuveurDsserDreyFdoDnasDlsberyDgerDerhageFbryDceDbyCtzDtlefieldDmaryDhirabootDchwellDCsuilleDhingtonDengbongDaoCrwarDrellEagaDoopDnesEackiDloDksEodieEDgisEetakisDettoGeEnsenDcinelliJaFaDasEnzakFitiGEfianFEcEbandoCporitaDnuDkoCousCnzenbacherDttiErizosEoscoyFmauroFlucitoEisFoFlukkaEalociFgataFellaDsedaDquenettiDotsEsyanDnDmarcoDlatteDkovichEeEaryGanDisloEpasiEgerDgrenEhezDeauxDdstedtEryEovarFsFneEnessElanEisonEersenEborgDchzFecEenDasithCmwayDuellDpselleEieriEairDoyoaEwitzDmutDiecEckDeleDbucettiDaraEnthaFlegoClversonEatureDutoEjaDtouridesEmarshEaDsbergDoumEsEomDlingsFesEahDisberryEmasDfelderDessesEnEadoDdvirEiEeenDcedaDazanGEyEndyCkshaugDovitchDkinenEasDiestewaEcDakeenyCisonEaDntfleurDdeDcedoChsmanDliEerEbergDagianCggioneDesEndorfCfronDarCetteurnDnphimmachaCdhuEraDenEeDdatCckosDhlebenEesEarDcucciDaneCbloneFckEeaDistonEniEDhaDellicoDajCaddAryunCsavyEnekClowiczDlCkenCgiewiczCdalchCchlickiCbowiakCalBuzyckiCyzCwetCtleyDhenbergCszalaDteikaFbergDsottoHiEmanEekFDleyDichDhworthEmanEforthDcittiFoEhmannFelDakCpertusCohoCnzlerDyonsDswickDfolaCmneyDmlerDfordDburdEoldDanClnickCjawitzChstorferDmannDlingGCggiereEeroEaDamaCffoloCetherDsswickDllCdnitskiFckyDishEcilDesEenCbowDloffDisonEnowDerteEnackerDartsEllosFBozgonyiEaDenbergDasEnceCytekCwsellDrayDoldDntreeDlinsGgDbackCveltoFlaDackCuzzoDtDssosDnklesEdabushDisseDgierDffDdybushDcouletDbekasCtsteinDhmannEhauptEfusEenburgerEbauerEacherDeringCszalesDsnagelEingnolHEelleDkovenskyFpDitanoEneEchDettieEntranceGhallFkoetterFheimFbargerEkransEbureFoomDcowFrlaDbozomDavioEckerCpiskiCnzoniDsDdellFDcskevitzCmulusDpfDjueDeneskoDbultEardoDaniakFdiaFchukEgClsethDlindEendDfsenEfDekCkusekChsDowetzDlackFCgugbakaaEemoreDoskyDinsonDgeroFnsackGbaumFmanCeverDtzlerEtgenDssingDrishDmhildDhlingDdeDberCdriuezFgeuzDnguezDisEnsonFeDemoyerEiguesEaDdickDarEmisElCckymoreEelmanEafellowDhoElinEenstireDasahCblowFdowskiDinzineFsonsHFaultElottoEchardDezaErtosFrtsonDbleeDanteCatsEchDooDnhorseDlDchoBizasCvordDerollFmanElCtzkeEieDumsDsonDchlinDariCstainoDsellEanenDlerDkallaDiusDhellEaDewickDdenDcheEenDbeckCquelmeCpollCozDfrioDbeCnnertDkusDingerDglandEhouseEelspaughDeboldDdlerEerleCmmClleraCiseDppiCghtnourFleyDgingsEerCffeeDenberyCexingerDslandEkeEingerDleyDkertDfDdlingerCdgnalEleEillDepElDdlebergerEersCculfyDkfordDhtersEmannElinEiusaEerdsEanDenbergDaudErdiCbsamenDronDieroDeroDbinkBhumpECorerDeDanEdCinersonCenBeznicekCynerFEaldoDeltsCwertsDakowskiCviraElsDeringFaElliDayCutelerDstEchelDdinkCtzloffDhmeierDekDchlessDamarCsselDpicioEesFrsDosDetarEnzEckerDCruchaCquarthCprogleDoffDlinDetowskiDaskyColaCnzoniFDyerDtoulisEieDoufEskyDigarDertDdlerECmondetDisEanDeleEderCllamaCkusDemeyerCivesDtterDstetterDnsvoldFfelderEowskiEierEgEenFcciusEdeauEboltDmnitzEmerDhlEingDglemanEhleyDdherdFaarDchowDbmanDalChseDmertDlanderDerDbockCgulskiEeiraDnDinaldoDelmanDarCfsalDazoCemerDferCdlonDkeyDinboEkerEgDemerDcrossDalCcuparoDksiekEersDidiviDhichiCburnDoldDikDarCavishEerFlyDshDollanoDgeyDdingerEdyBazonCyyanDshellDowEmeDhelDchardDamCwiDhouserDatCvizeeEeleDagoCutenstrauchDlinoEDheckerFDghtDcoEciCtzloffDtuEellEanasinhDsepDkovichDhrockEelEaiDanaCsualDtetterFgarDsetDpotnikEaDoolEleDleyDkeyDicoDavongDCrogalDdenCptisDplDkowiczDisuraDanotEloEckiCnweilerDsonetElerDniDmarDksDildiDdgaardEahlDchDaudoEhCmsyEourEhurEbyDrirezDpyEullaEadaratFDonezDlerEallDjhonEanDirelDettaElliFizeFbDdeoDcharranDaudarElEganoEchCkytaDusDestrowErsCjkDasEphoumyCisleyGrEinEDlesDkeDgosaChocheDmesDibDamanCgusElaEayDlowCfusDeyElDalaCethkeDmerDfDderCdziwonDwickEanskiDoslovichEnDmallDlinskiDieDerstorfEjDdleCczakDkoDitiEoppoDerCbuseDsattDjohnDitoDeyEneckEhlEckDbeDalAquivozEerDtuquaFguaEtnerFerEeroFdoDrkeEamFlteDntardGniaEnanElivanDlterElmanFanEindrinoDelDdasDchoDbodeauxCezergueEadDttantDrosEioEcioliDnzelEcerDllerDbralCatrevingtDshnockEdorfDrtuccioFieroIiFaroErellDnstrumDmmenDlheimDgliatoDdnauDBasbaCreCdeerApywellCsherCrosCfromDerCetteCchardoBuzonCtzerDtonDchaCskarichDhCrkhiserDfeerstDatyCotinenCntilloDihaoleDdsackDaClwerDlusEaraCitaChrmanEDlCffenbergerCertoDntCdenzCcketFrCblicBtaschinskiBsutyDikCilovikosBrzybylDenicznyCyeDbylskiCukopDessnerCovostyFrseEinsGoEenzoGtDtichEasDssEienskiEenickEciaEakDpheterDmiscoEerDkupEosDglDfetaFraEancikDcsalEiukEhakFEaccinoCizioDvadoDtzkerFelEcherHllDsocDoleanDnnEdivilleEcevalleDmosEaDggDegoFnitzDbleEishEbenowCevotEetDtzerGlEyDsumeEtleyFipinoEnalElipskyEiadoDndesDjsnarDistFsnerFnerDheimDfontaineDdomDcissiEhtelGCauseDttenEelyDnteEgDmukDleyDkothDchBozarCyntonCwskeyEeyDlenDellsCurvaseEnerEierEchotDncilDlisseEetDkDcheCtulskiDtkotterEichenEeigerDsanderDhovenDanovicEczalaCsustaDtoElesEiglioneEemskiDsingerFckEehlDpicilDkittEaDisCrtnoffEelloDrisEesDepEllDatCpularisDpoDadiukCoyoumaDschkeDrtDlhecoCnslerDiatowskiCmykalaDpiDillaEeckoDfretClzerDvinoDtrockEonEerDskiDoskeyDlotEnowDivickEsotoEntanEksFoffEcicchioFastriGreDetskiEeEdoreDaccoCkrzywaDallasCinteEelliChorillaDlsonCgozelskiErelcCellinetzCdwoskiDeszwaDCcklingtonDiengelDhatkoDekayDaiCagueBniewskiBluttDmbarEaCotzkerErowskiDskunakDennigsCimptonDenisCewinskiDttDskacEheEantDppoDggeCaylDvnikDterotiHsDstowEsmeyerGanDnerEceEaganEDmondinDinyDckettEinoEheckiEeresDasBjetrovicBizzuloEiniFcoCvecCtpitanDorakEccoDkaDchEairnDarresiCszczekDtelliDkelDicchioDerchioDcitelloCrrottaEelloFDozhkovElloDiedaCpperDiaCoskeDmbinoCnzinoDtelloDsonneaultGeaultDnDkenburgFDdellDchockEeCmpleDClusoDlonEarellaFdoDkeyDetteDchowskiCirtoChlajaCggieDanelliCetyErowiczGkFiniDscoDrtracciniEsiakErotEdonEannunzioDntkaDlowEaDkDgaroDferDcuchCdroCcotteDkmanEettsGpinFrellFnpaughDhoffEerDcuilloEirilliFnoneGichFlloEhettiCatzDoDcitelliEenzaBhyfeCurroughDongDmaDaphesCramanyCoubandithDmmajackEDCimsouthamEpradapsyDlmoreEliesGberEioEdorEabaumDCetsanghaneEphongsyDlpCaymanyDrmerEaoDnthavongsaBfrommerCoutzDrrCnisterClugradtIDeugerCingstenDferCeiffenbergeDfferkornCanstielEderDlmerDffingerBezleyDinaDezCyserCvahouseCtulaDtonEipasFjohnFgroveEayDrouitsFpulosFnzioGellaEilliFccioneGEeccaEaliaEDkaDignyDesicErsikEkDanickElcuCszynskiDsolanoEesDickaDchongDarchickEntesCrzaDteaDsynEtenEchDrotaGEiottFngFllouxEetteFlliHDnodEinFciaroEeskyDmannDlsonDkissDinaEeDencevichEdzDceyDahaCplauDkaDionCnzienEelDyaDwardenDticoffDskyEickEaDnelleDirdDhallurickFDgraDderelFgraftDcakCmeltonCluseDnarDlomEitteriFgrinoFetierFconeEetiuGEamDegCkasEraChowichDaCgeronCfflyEerkornCetoomDrzadaDchaCduzziDralbaDezEareCcinouskyDhairaDatosteErinaFaroCaryerDcyEhayBayseurDorDnaDantEmpsCxCwluchCvliskaDisDelskiFlaDCuzaDschDlshockFethEminoEicEauskisIasFsDkerDgschCtznerEkeDwellDuelDtyreEinsonEengaleDriquinFnFasGDolotDikDernitiEllisDchesGrDanellaEkiEjoCsvizacaDturesEoEianDserinoGDkowEetDinskiDhoEeaEalDcorellFalEanikFllDayaEnaCrutaDtyEmanEipiloEenopeFlowEDsygnatEhEellsDrottaFnEingtonGFeraEenoDquetteDpanDoneDninDmsEantierDkosEhouseDizekEpovichEnasEharDhanDgmanDdoeDayuelosEvanoEtoreEraCpranecDpajohnDonettiDittoEkeEernikDciakDantonioFikolasGaFEleDCongoDlaCnzicaEellaDykoDuccioDtosaFlianoEelakisDrellDowiczEraDkiwEakeDitzElaEasDequeElaEczkoDdolaDahonFEgouliasFisCluszynskiEkEckEDoukosEmbitDmiosDleyEantGschFforDisboDchettiDazolaEsEcoisCkonenCjerskiCillantChkCgniEelloDlioDaCfelCdolDgetteDekenDdioFllaEackDavichCcquinDkineauDiorDholecElinFaEDentaEkDapacEnaCbenCarmannDlanAozerCaneDineDetaCBystonCelletteBxtonCnamCenriderCboroughBwersCBvitCesenDrstromFhinerEmireEleyEkampEdickEboughCdenkCadillaBuyeCtzenCsdahlCryDthCnsyCelleteCdkerBtutahaDafiCtrixDogaryDinoEligeDenwessCizChoudtCexDgaBsvaldoCtwaldDrzyekiEumEootDerhautEndorffFbergDasiewiczCswaldDolaCowiczDrnoDlloECnoeCmusDanskiCiasChmanCentowskiCdenCcheCbeckBrttenburgerDolfEDgaCregoCpinCozeoDchenaDbonaDarkCnelosEdoECmCloveEskyEfDinskyHiFCizabalDtiDonDgerDeChenkowskiCfordDfCeskovichDllamaDilyDhekDbCdazzoEhlCcholskiDeCasBpulaCsteinCpligerDegardCichkaCherCetCalickiDkaBotonBnyeanusCwunliCukoguCisickDfadeCealeCdikEcDersmaBmullanCotoDClinECersaBlversonEiraEdoCoweDnaCnesCloquiDiverDhoffDendickCkowskiCividEersGesEarraDnghouseDgeeCgvinCfersCewinskiGeDvedaDskiewiczDjarskiDckiCdeCckhartCbrishCayDrteBkwuonaCuleyEaCorududuEenDliCiharaCersonDnBjardDnenBinesClvaresCedaBhrnsteinDenCmitEeClmacherDenbuschFCaverDrrollBgwynnCunyemiCramCiliveCenCbonnayaCasawaraDnsDmiBflahrityCfretBenClerChrleinGDmkeEigCftgerCderBdoughertyDrizziDmesCinDenChnerCessDnheimerBcusChsenbeinDinangEaiDalekCchinoCacioBbnegonClowDingerCianoCeryEsonEprillerEmullerFoellerEholzerFausEdierGckBaxacaCrAnysetherCkielCgaroCcumCahayBwankwoDkanmaDdioraDbekeBuzenskiCszCnneleeDmakerDizDeryClischCetzmanDssleEcaCckolesDcitelliFBozumDickCwzariDosadkoDleyDitzkeCvitskyHiHeEkoffEdaDetskyEllyGinoDaraCuthDlletDdCtwickDowitzDleyDisDhemEackerCstroDeffCrwellDthwoodFcutDstrudEethFEaganayDkoEaitisDiegoDgDeigaDdwallEsiekElingerEickEenstromDboCorigianEdamCnuDesEmanDdorfCltensmeierDletteDfeDazcoCkkenDeCiseuxDaCheCguedaEchiDodaDglesGrCftsierCeyDrenbergDgelCdurftDarseCckaiCbregasDisBkukuComoBjangoBiziolCxionDaCvarElaCtzschkeHeEkowskiDcherCswenderDleyDhimoriCrmaierCppsEleCnkeDiDhCmrodDoxDickClaCksichDodemEcevicDaidoCghtlingerDgemannCetfeldtDssEentEborellaDrerDmitzioFelEantsDdzwiedzkiKEensEbalecDbaumCcosonEliFausDkoleyElosFienEenberryEasDholasonEellEalsonDewongerCauDnBhamBguyanCinBezichDatCyaciCwsteadDnessDhookDesEnsDbellEallCvingerEllesFDerDarrezCuseDndorferDenswanderDdeckDbigEaumFcherCttleinghamDrosioDolickyDleyCstiDsmithDlusanEineEandDinCrlichCpaConakisCnniCmzinDunaitisDetsDardEniClmesDlumsEenbackDisseCjaimeECitherDswogerDperDldDdigerChrtDmeCglioDbeneborCedyCdmanDinaDerostekElmanDdoDbalekCbredDlockDesnikDarezCallEiousEerDhrBcnealBazziseEalDirDelrodDCysmithDmanCwwarDdaCveedDarrateFettaEppoEnjoCtwickDtiahDsisDiDhansDewaDaniElelloCstiDsieDrDersDalroadCrrDgiDdyCpieralskiCnthanongEanapibulDnaDikDasyFCmurDihiraDakaCltyDbachCkiDatsuEmoriCjarianCilerDfehDduChrwoldDlDariCgodeDindasDengastElhoutDaseCftzingerEaliCeherCdoffDeriElbachDdeoCcyDisseEonDhtriebEmiasEazelDarCborgDityDhanAmytychCslinskiGDakCrtleDmanDckCnttiDnerlynClottCkingCesCcroftBwayBuzykaDaczCyskensEenbergCtoneDnerDherspawEartFnaDartCstyEonDsmannEhornEeEDquizDolfDkthelEaDinskiEgdilokDchickFettFCrwinDtyDskoDnockDeDassoEroEnElliesEcoCnyerDshiDningDlDirEngerDhallDeyEtDdziakEschauEhenkEervilleDcilEhmeyerDazEClzerDvahillDryanEoneyEeadyDneixDlowneyEnerEisonEanyDichDaChtasebDlenkampEbachCggleyCeskeDnkelDllDhleisenCdrickDdaththirCczynskiDklowFeyEelvaneyDhortowBthimunyeBrazikBozzoneDoDleyDieDgalaDelakCyermanCwderDanCvlinCuzasDrinoDlhemCttilloEeshardFrsheadDamedCszDtollerEillerEeroFllaDsonEingFenEelDmeyerDkauDhosFDcovicEaritoloHelloGdelliCrosowEnoDneaultEaEDkveDiwakiEseEeraEcleEbayedDgretEnerEasFnsGdiDfeeDelenEidaEciEbDdinoGiEehayEaCotzEispawDsbruggerEaDnsommyFhowerDdispaughDberryCnzDtuoroErellaEijanoEgoneryEelleHEcalmEalgoDskeDrroyEowDnotDiakDgueEoloEioviDforeDdouxFneEellEaineDcrieffeJEierDasterioErqueEhamEgleCmperDeniCltrieDoneDlyEohanEiereEereFkerEbergDininiFgFeauxDettDdanDaviEisonCkriskiDiaoCjzisikDardinCiseyChorovichDinaniDauptEbeerCgollonDhadamCfleDfordCevaoDlterDdeCdrakDdejongeCcklerDhaCbilioBlenarBizziDnerDeeCyasakaEoCxdorfCtterEchellEagDhaniDchlerCsoveDmitDlukDkovichDhouDerendinoEkDcoeCrmowEanDkovichDaoEnCquelonCnucciDtreasEosFrDottiEckDnateeDiukEssaleEhanEcozziEDfordDetteEryEhanEconzoDdingallDchellaDarcikEcciCmakiClzDweeDtzDsapsDosevichDlsteadEottFraEianEhiserEerrEbrandFernHgDkentDiusEteDelrDdredEerbergerFnsteinDbrodtDareCkulecDovecEtaElonDhaielDezErDasaChovkErDaliakFcoFakCggoCesslerDrnikGckiDneDloszykEkieEczarekFarzDheCdgetDdoughEentsCcroniDkulskisEsEonisEenheimDhelloFalsonEavdFlczikBezzinniEanotteCysembourgDerowitzGttFmanFhoeferCvisDersCulerFmansDaCtzgaEelDtlenEilleDottEsDilEaDherellDevelisEnoskyEerDchikoffCstlerEanzaDsmanEeyFrvyFlEanDolorasDmerDionaEasDhewEankoDervyEcarDdaqCrzigDvineDtineDrillsEenDletteFsEainEDksamerDithewEsierEngElosEcalDharDetteEnoDdianDceirEandoDanteFaElesCnucciDtkowskiEgenDsoEenDkinDjesEaresDitzEettoFrDeusEfieldEesDdrinFalaElerEiazEesaDckeEhuFesDasCmsDoDmoCltznerEerDstromEheimerEerDodiaDlosEisFereGEeckerEageFdyDikyanDfordDeyEncampEenEarDchertDaunEroEdyCkonisCisenburgDrelesDnsenEershagenDlDhoferChrotraDlhaffDisDelichDdizadehFDarryElkoCgrawDownEDillEaDgisonEettFrsonCetzeDroffDmkenDhlederDdsCdureDoschEraDnisDlingEandDiousEnoFEllEerosEDhusDearisDanichElionCckelDciaDardoCasheawEeckDringEaDkinBcwilsonDardEltersEdeCvoyCtushDiernanDarnaghanCswigganDtayCritchieEllCquiddyEeenyCpharlaneFnDartlinCnuttyEhDicollHDevinEspeyEmeEllieDayrCminaDenamyDanigalCluckieDillyDeskeyEaranDauchlenEtchyEenCkrayDouenEonDissonEnnaFesEmmyFleyDewenErrowEnzyFtieEmieDaskleEnicCintydeEroyEnishDlwaineEtrotChalffeyCgurrenGEnnisHgleFagleEinnesGDrothaFganEaphDoonDlothernFsterFhonFcktonEawnDinnityFisterElberryEboneyDhinEaneyDeeneyEadyDartlandFraughEffeyHrtyHeCfeeleyDanCenenyDlwineEreavyEpraugEmeelDirathDadyCdunnDonnallDewittErmettEavittFrmontCcurineEnnEmbersHeEllorsHnHghHckEanDrateFDoulskeyErnackFmikFkindaleFisonEnnalEmackEleEilEardDlurkenEoddenGEimensEevelandFnninghamFllonEaughertyFtcherFrtyFmmaFimDhainDellandDastleErvillFtherFrFnsGFdEndrewGlissElvinFpinFmentFlunGoughEhanEffreeCbratneyCaveneyDuslandElyDrthunDnawDllBbamaluBazzeraFEawiFferroFcanoDuoDionDeyCywoodDshackDroseDouErcaEkaDnerichDloneDhoodDeshibaDdewCxiDellCwhinneyCvropoulosDleDaiCutteDsonEeyFthEbachDrusEizioEaDprediDngDltaschEeonDdCtyiDuszakFhevskyFekEckDtysEseyEioneFasEeisDsuEoukasDreyDotDlinDkowskyDiseDhwichEusEonyEeryGsonFnDenElichEjekDczakEhenDarritaEkonisFaEcaleCsuyamaEreEphaEdiDturzoErocolaFianoIniJaFelliDsicotteEettiFllaFiFeEaquoiDoodEmDlowskyFskiFnkaDkiEalyDiejczykDgalasDeroEntenDciantonioDayaEracchiaCrzocchiEiliFglianoDyeDusiakElloDturanoEosFrelloEinezeFlloFgnagoFarenaDstersEhalekEellFkFgliaDriotGnFngtonFettaEelloFelEableDquinaFeDozziEvicEttiEseDnettDmolejosDktEsonElundEewichDinoniFkoFasElEelloDguardtEreiterFafEelEaryanGitaFnDevkaEscoEroEntezEeDdiniDcotrigianoFguiseppEksEinkaEhizanoGttoGonyIeseFesseaultHkiHanoFallEeauxDbrayDatreFosEshiFciuloFEntzElloEgniFhEbellaCquisContesanoDbiCnzieEayDvelitoGDuellDtikEeleFgnaDsbridgeEanaresDoraElakisEkeyDnineEheimerEebachEchenDlitoDkoskiDivongDheimDgubatDfraDemannEckeDdryElerEiEapFhlDcosEielEherianGlEaDbyDattEkerCmoneDmanoClvernDtonDschDovichEuffEryEffEchaDmangerDlingerGakEegniEatDkoskiDinkyFakEchiDgieriDeszkaFEonadoEnkeEkanEhornEckDcomeDayEwyErkeyEnadoEmaEbeyCkuaDhijaDelDaremCjorgaEckaDicaFDeauCizesDrotDoneDnzElandEettiFroDmoneDfeldDersElloDdonadoDcusChungElaDrenholzEanDomlyDinDeDallFCgsbyEayoDroneEawFnnDpaliDouliotisErinaEbetDniniFficoFeEettDlioliDgitEDetteDdefrauEalenaDazinerEthanElskiFdiEdanCfuaCenoEagaDdkeCdziarDreDineFDhavanDgeDejaDdoyEisonFnEernDCcvicarDurdyDrenoDpartlandDorenoElaDnuttEevinDmullanDlainDkstutisEnairElemEillopEenthunFchnieEamanDioneFlekEarelloDhoverEleEiEelEakDduffeeDcutcheonFllochEordFnaghyFllElellanFairtyEiniEhiarellaFeyneEarterGinoIiDandogFasElmaEbeoCasenDrxAlytellCsonDherCngholmDchjDahCmeCkenCewCdeckerCbertFgerEckerCauBweisBuziDellCvianosDeraCtzeDkusDenCstyEbergCryeEDtzCquetteCpianiDacchinoCnterDstrumDgwitzEsfordDemannDdermanDchCminatiDbleyEaDadueClasCkowDianovDeshDanderECingDkartCgabihlCfboroughCetteDscherHnDrsenDnsmannEingDkerDdeckeDckenbachDbberingCdovicoDeraEkerEckeCczkiDoDkinbillDisEkEeEcDhterhandDcousDashCbergerDbertFnDawyEhnCangxayFrathFamathDgueBozeyCyborgDackCxtonEercampCwnsberyDlerDcksDaCvstadDisoneDfaldDetinskyFEroFdiElletteEberryCuwagieDrnesEiaEentzosEdesDkaDilDdermeltDchenDbierCttoDridgeDhringerGdgeDaDCszynskiDsiusDneckDethDavioErdoEnoEdoEccoECrrDonDinczEaDetzEntineDdiDaineCpzeDiccaloDeyErfidoEDataEsErcoCofbourrowCngwithEhiEenbergerEbineEakerFbaughCmonteDinoFackDenDbelEardinoDagoECkanCiaconaChryEkeEeCgoleoDgensDarboCfwallDtyEsEhusEeDstromDorteDmanDingDguistDfierEelbeinCerwaldDppkyDhrerEnerDckenCckshawEnaneEingtonEeryFmerDhricoCbregatDleyDelloGDalboEchBlanezaFtDmsBivleyDintonFgDersedgeFnoisFmonFanceEoakEcchiDasyCukkonenCtzenbergerDvakDtfinDmanowiczDchardCstiEenDkerDitanoDenaDbeyCpsieEDpoldtEittEerDomaDkovitchDiraDanCnzanFDsinEenmayerEdauDnertDmanDkonDgnerEleyEerfelterEbeekDeroDdorfEmeyerEinhaEerleafEauFburyDburgDakCmmelDleDbertDardiClybladeDlehaugCkarCivCgonisDlerDhthartDgetCftinDschitzCewaldDvsayEensDtzowDrzDglerDdbergEDbrechtEherrEergFnthalGowFckCdstoneDieDgeDderCcursiDkliderEfeltDhotaEensteinDeagaDckettoCbertiniDbertonBeytonDhDdeckerEaCxerCwiDarsCvreauEaDielleEanDetoErseeGFoneFanceEndoskiEeDatinoEnsFdofskyCuzeDtwilerEheDhringDgaDckelDasseurCttsomeEiereDscherDenderDchawDaCstrangeEourgeonFrFnDsnerEmannElyDpedesDoDneskiDkovarHcDeDcoEhesDaCrraDperDowEDmonCpretreFDpinkDkeDezEtichCopardiDnpacherEickEbergerDmitiCnyDskiDorudFtDnisEartFnDlingDkeDiganDhoffEarrDersDdtEorFDczykEhDbergCmoyneDmondsEingsDishDearDbckeDanskyGClligCkeyDbergDanDCjmanCitzingerEhiserDperDnwandDmkuhlerEbergerDlichDglandDchtenbergeDbertonChoDningEeisDmerDenbauerDbergerCgrotteFEaDatEllCfurgyDloresDfersFlmanDeldDaverCethamDsmanDkerDhanDberCdsingerDermannEnbachEeDCcznarDkbandDhleidnerEeltDatoErosEinCbrokeDoldDlaneDitskiEshDerteEdeffDbyDaughErgeCavigneEenDsorEherFDnzaEenDirdDhmanDdfordBazuskyErekDottDioEerEchDewskiDaresCyvaDellDcoxCwskyDrentzDisDfordDcewiczDbaughDaryElCvongsarDgleDezzoElliEDaniFderEgninoEderaCutieriEaretDsellEchusDroleEettaFnoFlesEanceDniereEdreeDigneDghonEenDdemanEadioDcknerEhaireDbyEersheimerCtusDourretteEsEnDhrumEerFDendresseEDassaEmDCstellaDsetterDkoskyHieDinEkDhleeEierDelleDchingerEaroDaneEgnaFeCruschDrosaEiviereEaldeEDoweEusseEttaEiaEeDmettEanDkanDgenaDeginaDdoneDcomEheDbieFDasonEnjoEgyEbyFellHCpuertaDpingaFDortDintaElaDerutaFeFEkDariElmeCorangeCnzeEarottaDtryEgenEelmeFigneDseyEbergDnierEenEaDksterDieDgrumEnessEmoElitzEiEholdtFansEgoodEankeDforDenEauxDduEruthFieFevilleGsEquistEolfEmarkEiniEevosFnbergerEanDczCmudioDpsasElEinenEhiearEelDoreeGauEoreEntagnaDmyEelDisonEngEeEaDedaDbuthEertusGmontDartinaEngoEackClindeEchDeCkowskiDhanCjoyeFCiosChneDamCguireDrenadeDoreEoEniaGDlieDganDesseErstedtFgrenDattaErdEntEmbaEdinosCfuzeDrateDoreyEonEntainDlamDferDevreEminaDantanoEceCessigDhnCdtDouceEnneEDikaEckDebaucheCczDuskyDovaraDkettEageDhinoFattoEariteDerenzaEkDauEtenaEilleCbovitchEuntaEmbarEissonnierEDitanEerDeotsDarriereFoFbaraCatschDsagaDkeAkysethCpurosDerCnerBwiloszBvzianCoeschenCetonDkDenCaternikBuzielCypersDkendollCwanaEdaCtzerDyDluDiDchieCszynskiDsmaulEelDnicEerDkyDhaneyCrzinskiDttiDshukDrDokawaDnsDetichDaszEntEDCpiheaDferbergDersmithDchinskyCnterDklemanDiyoshiEmitsuEchDdananiDauCmmerowDlanderDferDanElaaDClsethDbethEackiHCkuraDlerFnskiDauskasEhikoCjatCizDtuDckChryDlenschmidtCffaCepferDhnholdDchlerCdroEleCczmaDkensDiembaDhinskiEemCbleyFrDeshEckDaschDCanoniBrzewinskiEsinskiDanCystonFekDnickiDloCuzelDytDszewskiEorEkieEhanskyFDppenbacherEinskyDmroyEbeinFachDkielDizengaEsEboeschDebbeDckeCotineDstagDpffFelderDningerEauDmeDlickDkusDgDftaEftDesingDchmalDbathCnachCivanecDstoffersonHFanEsieEkovichFeEhunFnamurthyFmanDnovDekEgshauserCewerDutzbenderEschDtzingerDsslerFinGererEkyDppDnzkeEningEikDmpleEmelEenDjcikDisslerEnhagenDhelDeseCawitzDvetskyHFcDusseFmannEelDtowiczEchmanDsniciFanskyEkouskasEinskiDnwinkleEockDmarczykDllmanFisDkowiakEauerDinbucherEgEchelyDhulecEeEDgtDetschDbelEbenhoftDaschEckBozlovskyEikDiakDeyahDanCwitzDalkeFecCvesDalaskeEcikCutrasDssaEonsavathDnthongGapanyaEovskyEkelEickDlavongsaFlisCtykDurDtrabaElowskiEernaDschevarDonskiDlarDheimerDeyErbaFasDarskiEkiCsutaDtrzewaEivEersDseyFnEakDoskyErogEDlanDiorekDhiDcielniakDareffCrzyniowskiFbskiDyntaDwinEatchDtemeierDstEmeyerElundDochDnnEfieldEblattDkmasDitkoEntaEaDewditEsEnekDdysEowskiEiakDbinCpshoDpyDkeDinEckoEaszDerskiDayEtzEnCosmanDngDlmanECntyDowEpskiDmaDishiDgerDetchyEDderlaDczewskiDarikCmulaDinskiDadaEClwyckDupkeDtzEsDppaDocDlrossEosDkmanEhorstDikasEcDbuszDassaDCkubunDoszkaDkoDengeCitzschDnerChusDlesDelCguchiCfootCersDnitzerFngerFgsbergEerFmundDlbelDhringDckCdyDeraCczwaraDiedaDhkodinEenEanekCbylskiFarzHczykDoldBnyzewskiCupkeDdsvigCowitonEellDusDtowiczDrpDflicekDeppelFkeEllEchelDdelDckaertDblerCiolaDllEandsDeselDceleyCeuperDtschDserDrienDllingerDefeCazsDttDpkoEickEeEDkeBmiotekCentCatzDnBlynCuteDseDmphDkkenEanDemperDberCoskyDppenburgDnowskiDmpDhsEeDeppelEkerEfkornEckDbucarCjucaricCitznerEschDskeyDnskiEnertEichEgnerFenbergerFbergFamanDmoEaviciusDckmanFaCezDvjerDtteEschkaDssDppenDnovichDintopFsasserFfeldEfgenEdDftogiannisDefischDckDbesDarCawuhnEinskiDvonEetterDrinDppholzDndeEcnikEDmnEertDjaDichDfehnDbundeBjolsethCergaardDllsenFmanEdgaardBizziaDiorCvelaCttyEhikouneEelmanDelingerDcherGnmanDanikCsroDielewskiCryakozaDsoppEhmanDlinDknessElingEconnellDganDchmannFherrFbergGaumDbergerDacofeCppleDCousCntoppEighDsolvingEkyDlinEecheenyDgwoodEsonDdsEreganEermanFCmminauDbalClverDtieDstofteDoganDnessFrDmisterDlorenEiusDimnikEchowskiDdareCkoCjakCiliChlstromCetzerDsserDrzewskiDnbaumEastDkeDckDbalaCddleCckelDhlineCbblerCaniBhubbaCoraDkherCnClokCillingCensamphanhDmmanivongCazdozianEalehDuvDirallahBezeleCyonDlCwCvwitchDorkianDethElinDanCuperCtzlerDtingerEerlGinghamFnringDchersidCssansDeyEkCrtzmanEelsDstDperDnodleEighanEagisDmesDensDcheffEeDansCppnerDkeDaniCovongxayDghanDdalahDbaunleuangCnzieDsonDoyerEuoDnieEgottEaughDikDeyEkhamEalyDdzioraEalDagaCmpsterFEonEkensDmeriesDerlyClttDlywoodEishEemDiipaakauaDauCksCisackerEDnonenDlholzHtzDhlChresCetchEanEDserDnomDmanDhnerEanCdraDiaCcskesDkerCbedeEDaCatyEenDserDrseyEnBazunasDimiDarEbiECyatEsthaCwskiDellDczynskiDaiaeaCveDaneyCutDshalEchDoDmansDiDderDcherDaCtzmannEamanDterjohnEauraDsaounisDohDkeDisEnEeDhleenEelDaokaCsztonEinskiDulaEbaDtensDpariDmarekDkyDhnerDenEmeierEeDalCrzDwowskiDstensenDroachFEelsDpsteinEeDolyDnathFsDlinskyEgaardDduxDangelenEmchandaniEgiannesFeorgeEbinDCpsnerDpermanFlmannDlerDiloffDetanosCnzenbachDwarDtisEahDoshEonDniardEanDjirathingaDgleonDetaEkuniEaliiDdDakaresCmstraDradtDpnerDnaDmerzellEanDiyaEnskaDenskyDberCllhoffEfelzEeyFstadEalDistaDhornDenakDdahlDbergDandekFEmarasEfarskiFCkowskiDehDaniCjderDaCinesDktsianDdChookeleFhalphalaDleyDaoElehoeFEeCgimotoCewprasertDmingkCdowDelakCczkaDvinskyDprowskiDhmarskyCbzinskiDusDirEgtingDalaEcinskiEbikCarlelaDnanaEDkDiCAjuvenalCstianEeEakCrriesDneyDkovichDistEnDgenDayCnodDkersfeldDickCmboClsrudDitzEanaCkichCenglingEDlichCdieCbynaDranDehDackECanicoBoynsonEeCverCurnotCtoDbladCsicCrrischDdtEingCndrowDahCmeCllimoreDineFaDerCkiChntingEstonbaughEikinsGenDeDansingElCganicCergerDlsonDhnckCdyDhaCanisBirsaDakECngstBhingreeCansonBewsCstisDsicaDkieDiolowskiDenovecDchonCrmelandDkinDichoDgerFnDdingCpkoCnsDoveseDnkieDdererDabCmptyDmingsClomeDlingsDdenDardeCffryesEirsCdanCcmenekDklinECanquartEphilippeEnoelEetteEcyBaysuraCvisDersEdECussenDharCstremskiGbskiDmannDkolkaFEiewiczDicaDchCrriettDoskiDnutowskiDminDemkaFaElsEckeDdingEelCpakCnysekDwayDowiecFEfskyFfDniseEettDkoffDeiroDaCminetEDgochianDessonErElDasonClovelDkutCkubovDsicEchDielaCjiCiyesimiChoskyEdaDalyCgielloDgieCfekDariCeCdooCculinaDquinFelinDobsohnFovitsDksoFitsEosnEettDintheCbbieDautEliCardaAizakDguineBwaskoEhitaBvrinCenerDansCancicBuchsBtnyreBstoricoCimingerCgurDroCenbargerDmanDbrandCaksenDgbaDcsonDackBrrConhorseCigoyenCesonBpsenBossaBnzanoCtroiniCsogniaDerraCostrazaCnerstEllaDarelliEmoratoCkavesvanitcCgvolostadDuardsenDranFhmFffeaDletonDhemDersolDargioloCferreraCerCduddiDermuehleEckDalCcomstantiDeraDarnatoCbodyCabnitBmmingDermanEdiatoCholteCesonCbrugliaEockEialeEendaCamDdaBltzschClovskyDichDasErCiffeCgCarrazaEiaDlioBkzdaCkelaCenberryDmotoEireDardBhnenCenyenDmeBgusDinaCnoriaClesCbinosunBfieCftCeanyiCantidesBennacoBdrovoDissCiartBckertCardoBbricCdahCbotsonCasitasBarussiDaCnnaloCmiceliCcuzioDobucciFelliAhysquierdoDkeCdzikCbergerCatteBuysmanDnaCtyraDtmanEarDerCsulDtedtDsyEongEianDkiDhonDeinDainiCrtubiseEaDniDmeCpyDpenbauerCnzeDsonDerDdertmarkGlachCmstonDmertDinskiDerickDbardClzingDshoffDmesCkleCjerCitinkDrgsCgusEetDghisCffstutterCertoFesDnergardtDmmerDlleDhnDbschCdokDnutDlowEinDesDdyCckaboneGaaCbschDlDertzBtweBsyBryckoCnaCicDbalCckaCbacekCanchakDdeckyBoysockDneDltonDalCxsieCwlingwolfDettDarterCvnanianDardEntziFesCuzahDtkooperDsnerEemateDrihanDltbergDghtellingDeyDchardDbenCtterFnFllDekCsoiDnerDleDkynsEeyDhinoDfieldCrteinDsefordFDridgeDnshawFEleinEigEeffDmuthDimotoDescoEnsteinElickEDbertDabikCppenrathEaDfaufCosockDlDgheemEendoornDCnusDoldEkaupuDigsbergDgistoEevaDesEggerDdrosEelDchulFCmzaDseyDrighausDmerDiakDbyDansClznechtEmillerEhueterEboogDtmeierFannEhouseGffFamEgrefeDstadEhovserDquistDmersDlydayEoEnerEinghurstEeymanFttFrudGingFmbaekEarnFmonFckDihanEbaughDgersenDdyEgraferEcraftEbrookDcroftEhCkulaDettCjeijDczykCivikDsethDnackiChnsonEeyDmeierEDlsteinCgstrumDonDlanDenmillerDainsECfstraFadterDhineDfpavirCeserDrigEgerDlzelEterElerDkDhlDfflinFerCdosyDnickiDermarskyDdCckleyDhstineEfelderCbstetterDlitDinDerekDbBnotBlywaCastalaBjermstadBizkiyaCtzfelderDemanDchkoFinghamCssomDmithDkeCrteDschmannDoseDeziCpsleyDpleyDolCntergardtDokawaDelyDdsmanEmarshEerakerEallDcksonDajosaCmmelsbachGrightClyarDversDuDtunenEebeitelDsgenDovskyEDmerDlsethEeredFmanEbrantEabushFDkertEDdmanDbnerEigEDaCjaCgyDhtshoeDashidaCensDlscherCddeDakaCckleyEingbothamFeDianoCbbleEitsBeziakCynenDkoopDdenreichDbrockCvrinDessyCugelDangvilayCttesFnhausenDlingDjonkDhcoxGteDchmanFerCsterlyDsmanEelrodeGmanGbeinHachCrzbrunDyfordDweheDvolDtleEaDskovicEhnowitzFfieldEchaftEbergerDrudEnandezElichEittFonEandGDoutEthEnemusEDnyDmusDlineEeyDgenroederHeterDenaEmEkDcmanDalCquembourgCppertGlyFlEdingCnzlerDtrichEerDsleEdillEchkeDnighausenEardDkinDgesDediaDdsonFbeeEricsHkxDckenEhelGckCmsworthDryDperleyDmigEeterFrtFlgarnFkeDleyDeyerErlyDbreDansFesClwickDvikDphinstineFenstineDowiczDmertFnEbrightDliwellEeyFrmanFnbrandDfertyHCkmanCitmullerEbrinkDsseEnerDrDnzleFerlingEoEigEdlDmerlEbuchDlbrunGonDdtkeEmannCglundDginsEestadDenerDdahlCfterDfernenCeryDbshCdrixDlerDeirosEgaardDdlesonEinsCctDkleEersCbschDrardDererDblethwaiteCavilandDrtleyEstonDngEDmDganyDdlonEingBazouriDinskiDekampCywordDsbertDnDballCwkingsCvierDermannEkostCuswaldEteinGenEleinEherDrinDptlyDlbrookDkaasDgaardDffeDbenCtzellDtoEenbachDridgeDleeDhcoxDchetteGrsonDakeCssigEelvanderGkusDlingerDkampDhbargerEaDfjordDencampEloffDchkeDbniEellDakCrwinDvleyEilchuckFckDutunianDtzoFheimEjenEgravesJFerinkEensteinDsyDrisowFgtonEellsonEalsonGdFdineGenDounDnlyEesEarFnFckDlstonEorEestonDkenreaderEcomDjocheeDgestGDfertDensDdungEneyEinsonFganDbyEusEoughFttleFldDaryEmotoEderEbedianDCppneyEeDerECnvilleDuseyDtzaridesEulaDstineFeenEsonEroteEilDoharoEckDnulaEoEemFkenFganDmoreDiskoFcoEfyDhanDeganDdtEshawFchumakerErenElinEingEelandDaganGmiEfinFanEcekCmwayDponEerEarianDorEntreeElikDnonEDmetFrsteinIadGlundFdEangDeenDborskyEDalakEiClwoodDstonDpainyDonDmsteadEickDlsteadEowichEioFeEermanFenEczukEanDgrenDechkoDcomDbritterDalikyDCjdukiewiczCitDslettDrsterDnseyEdsDlesCgwellDonDhighiDgstromEisEenDenyElgansDartyCfenbrackCesslerFigDrrDnerEDckelCdsonDlandDianDdawayCckmeyerEethalFrdFnmillerGberyFEbornDhetteCbifDermannFernDbsCakinsonDgensenAgzymByurkoCllenbandCakiBwynesCennBuzmdnDiczekDCyottFDetCttenbergDschowDreuterFrrezDieresFnnezDhornEaryDerriezEnsonCssinDhueDaCrvineDtinDradDneDidiDecznyDalnickCnzenhauserDthropDkelmanDaganDCmphreyDmersallDbertClnickDlungEageDiniEkersDeyDdemondFDbraaDatiCittennezEreauEhEarDrgisDnleDltnerEstorfEloteFanEianelliEbeDffreDelDdaboniDaoEldoCevanaDsmanDrrouxoEinotEettaDnisonFnDmpelEmerDlpaEffEespeDdesseCdroeDatCckesDciardiCbserDitosiDernathDbinsCarracinoEinFglioDndiqueDmanDldoniDdalajaraBrzywinskiFaczEbDesiakCygielCuzinskyDtersDsenmeyerDpaDningerGEdonDhlkeDettEsbeckEllEberDdaDbmanEaCovierDthenDszkiewiczEsleyFklausFhansEkyEhekEenickEcostEbyDombridgeDnvallDmleyDllmanDhoskeDesserEberDcottDbsteinCixDvnaDtschEDstedeEsamEostomoFmEhanDpDnnerEmanEesEdelDmlieEardDlletteDggersEasFlonisGiunasDfinEfinsFesGlEeDesmeyerFiEmChamCgurevicCeyovichEdanusDvistonDtznerFEschEoDslEkoDngsDmlerDistFserFigerFerEberDgoroffGeskiEasDenroseFlowGeesFfelderFenFbushEbDbsEelDauxCdinaCavitEensteinFlinEaDulEghardEeDtDstorfEsanoEmuckEhotFaDppoEerDnvilEucciEtierEstaffErothEizoFeroGlaEelliEdosFmontDmzaEinskiEbergDhamsDgoDenEfeEDdleDcianiFDbowieckiEauskasBounderDgeonDdgeDchieDCttulaEleberEhardtDowkaDlibDimerDhierEeCswamiDtowskiDsinEerandFnDhowEiDdaDcheCrychkaDriDnikiewiczDlichDgoElioneDettiEnceElikEcznyDdisDczynskiDansCotzDsenDnezDlsbeeEiaDdvinEpastorEgineFerEerFnbergerEakerFcreCnzolezEalizDsaluesDesEDdranEaDazlezCmzalezDeyEDbergClumskiEbaDtryFaDpeDombeckiDlwitzerEoglyEinDkinEDdwareErupFichEhammerGhnEfischerGeldEemanEakDbergEaDanskiEbekCickCgochaDliaDinsCetzkeEtmanFigEjenDmanDldnerDkenDdenCdynDwynDownDfrayDerichEDdeDaCckerellDhnauerEieCbrechtDeynErnEaDboEiBnageyBluglaDckmanECowskiEkaEinskiEDssnerDffDeDdichCiwskiDuesDseDnkermanDmpDcherCennyDmbockiDissEchweitDghornCavianoDuserEeEbkeFermanDtharDsowEhenEglowDrsonDpionDndenDderFnDckenBjorvenDkajCesdalDltenBivlianiCtzlaffDtereDlewskiDchellCsslerDrielDlasonCrolamiDmazionDelliniDauardErdeauEdCoveDrianoDnsonDacchiniCnnettiFryDanniCllomEmerEeristFntineDhooleyDfoyDespieDdroyEoreDcoineDarskiChringCggieCessingerDrlingDlstraDhlDgerichDdlinDberFlCdwaniCckerCbesDbingsEardCanopulosFlaEnellEdeloneEcasproGrloEDmichaelDgniDcomazziFlettiEhinoBhrammCostenCiringhelliDorsoDlDaCezaDkiereDewalaCazviniEiEalDorDneEayemDmdiBfroererBeyetteCwinnerDantCvorkianDedonCuderCttingEenbergDschmanDachewCstesDselliCryolEchDtyEonEkenDsterEchDpheideDonimeFdaleEckDminaroEershausenGDlockEaDkingDgusonDesDbsEiDathyErdotCorgianaFalesDhaganDghanDffreyCnualdiDtisDnusaEariaGelliDinDgaEDeseoErousGsoFaDbergCmmelDbeEarowskiClzerDoDlisEespieEDineauDgerDdrichDbachCisterEselEenDmanDlsChrkingEiEettFdCfrohCerkenDlanCdrisDoCchasDanCbrayelDersCasleyDnopulosBdulaBburBazzilloEaDoDnesDdeckiCyosoEDmesCwlakCvulaDlesDiriaEnskiEganDesEllDalisCutschDronDntnerDlzettiCttieDskiDchDaCstelunGlumGDsonElerEeDquetDpariDienicaDeomaDchCrzoneDverickFDtheeDrodEissGhEaghtyDnetFssEderDlovskyDitiEchEbaldoFDganiDfiasEfEDesEnDdyEerDcelonFdDavelliElaEcciCnzeDtewoodDskaDnoeDjiEaDibeFanDguliEluffEadyalDeDdhyEarilliaDcioDaCmrathDewellElaDberiniGgFllEaianiClvanoFDustianDstonFianEonEDonEfaroDlipoEeryFnoFgherEanteFgosGaDjourDinooGlFEettiDhardoDfayanDettiGaEckiDauizEskaFhawEritaEngaEcioCilunEisDblerCgonEDliardottoCetkeDstelDkleCdueDesCcusanDadCbrelDouerDisiEnoDbettEayDCarslandAfylesBventesBusselmanDikEDhaDcaCruyamaEbottenDtonDrhDneEaDlotteEerDkinDfeyDeDchDayCpocyupanquiCnderbunkFnbergerClwilerDsomDlwilerEitonFngDekiDdaCkurokuDadaChriCglsangEeDahCestingDntsCdaczCcileDhserBrydmanEayCuustoDtozDllateDcheyCossardFEchheiserDozyDndutiForfEDmongEetaDilandDhweinEockDeligerDdshamCitzpatrickDstEinoEellaEchkornDnguelloFsDlingDkkenDetschEstEdstromFhaberFenbergGckDdalCeytasEdelDudigerDshleyDreDnnerEiereDmonEmingEeDlighDistuhlerFerElEfeldEdkinFetDhseDgusonDerksenElonFeyEhofferEdlandDdriksonGcElineEicksEdrickCawkinDuenkronDtiDnzeoEtzichEkinaFfordFenreiterHfeldEeoEdeenEculliFolinoGiseFisqueGosaIHneFeskiHchinaDmDineDgassiDcierEcolaDbottaEizioBouyerDxDtainDrreEacreDndDlesDchaCssoEerEaDburghCrwoodDtadoDstonFhofferEchnerGDnkohlEerodDmhalsEeyFntoEatoDlaniDgyEachDdonDcinoEellEadeDbishEerCntneauEelroyFboaEaniniDsecnDdellDCllieEerDkinsEensDgarCksCgusDoCerschlerDllDckeCderaroDdrillCcksBlumDgenceDetteFschEckCournayDtowEaDrkowskiEestalEanceDoreDerchingerDdmanDchCittonFDsterDntonEspachDerlCeverDurissaintFantinDtherDnnoyDitmanDglerDakCauttEmDsherDminioBixariCumefreddoCtzmierEgerladEenDtjeDserDchetteCsichellaDgerDchbeinFangEalDanickCroozbakhtDlikDkeyCorenziEaCnucanDtoDonaEcanDnleyEinFlaFEelFDlandDkenbinerDeyDdersClzenDyanDteauDonukDloEerupDkeyDippidesGelloDburnErardtEeyDaryFeckiEkCjalkowskiCgurelliDoneDlioliEarDaryFskyCermonteEgeDlyEdstadtDdtkouEorowiczDbichDCdskyDoCcenecBeylerCwlessCulnerDerbergCtuiDrowCsusDenbekCrugsonDsterDriseEattGellaFrottiGiniFoFndinoFllFcioliDonDndezEandzDmoEDlicDjerangDisDentzEdayDdinFcoEererDardEmiscoCntiDselDoglioEffEDniwaldDgerDceroyClzienDsonEherDlonEiEhauerEenbaumFmanEarsDksDipaElaEcoFioneDgerDdtmanEnerEkerEhakeDcianoEherCketyCindtEblattDlbachDklesDghDchtnerChribachDnelECgurgurDoCferCezorDryEstDlingDkesCduniewiczEcciaDorkaFiwFczykDelDdesFrlyCchtelDatCazelleDstDrhellerEenDmsterDlyBazzingaCwellCvillaEeriDaronGCustmanDrotEDlstickIhEkesGnburyEisiDbusCtCsterDhDenmyerDciDbenderCruoloDrinFaEautoDmsworthEarEDleeDielloEdDhaDdoDacoCntzDnerCmyDianoDCluDtzEoDsonDlieFckEaDknorEenthalDisDhaDgeDconeriEioneEhiDbDascoEhEckFcoCixDscaDryElyDgleDchtingerChrenwaldGbruckDnerDlstedtCgnoniDlieDalaCehnleCdriDeiCcendaCbusDroquezDelloEckDbozziAezernackEDchuCdebskiByubehCermannBxtineCposeBwelikeBvoraCistonCertzEsmannElethEingDlineEerCanskiEoskyHiEchykGalkButonCserCrtonDopeBttlDisonDersCollChelCchinsonBstyDeybarEvaneErsonFlingFgardElaDabanCshakiDepianElmanDaidEffCquiuelEerreFaCpositaDenscheidDarazaCoimemeCnardCkuchenDelsenEetsDaranEfChlermanCenweinCcorzaEeEbeoDhenbacherKEbornDarregaEletCbensenCannasonBrvineDayCteltCpenbachCoCnstromEpikerDandezCmogemousDitaDClweinDansonCixonDceCfertCethCdmunDeltCchulDekCbentrautCardDcleoBquiluzBppertFheimerEngerCifanoCersonBnzenauerCtziDrupDelCoteDcencioCnyDistDelsDacoCkerudCickCgwerDlebyDetEssorErmanDbretsonCfortCdsDresenDecottCcaladeBmukaCslanderDhoffCpleoDfieldDerorCoCmrichClinCigholzCfieldCeruDcheCdeeCberlinGeyFgerCayoDnusDmiBlvertCshairDensohnDburyDaCroyCquistCofsonCmaghrabiClworthsDifrittEesFmDerkampFbeckEnbeeFaEbrechtDdregeDansonCkoDayamCiszewskiEeoEDonChosniDassanEjEddadCgenDasErDCftmanDeringCewaDveldDfritzCbogenDertsonFsonDahtityCahiBkstrumClovCisBjideBissingerCrlsCnfeldtCltsDdersDbertFckCkmeierCflerCeslandCchstadtEenmillerGauerFlmannBhrCornCnisCmenCleiterCingerDginatorFatorBgvirreCureDizabalCoCidioCgenbergDartCetDrtsonCbeBfratiClinBerkesCBdwadsCsterCralinCmersonEierClestonDaoCithDsCelineDkerBconomusGidesDffeyCkroteDmeyerDleEarDisChemendiaDavezEureBbraniCoCilaneCesugawaDrtingEsolElineFDnsteinECbesenCachBasomDlickDkerDeyDdonCrmanDllEgyDenfightEhartClleyDickCgyCffordAdziurawiecDerzanowskiEgielewskiDduchDadekCamaByserDCresonCmkeCenBwyarCornikCellinghamBuxburyCwhiteCverneyElCtschmannDelECsakCrunDschDrwachterDousseauElDigDettEskyElliEeDalEkuCpouyDlinEesisEagaDatyConolaCnzelmanDtenEDsterDnahooDmeadDksEentellDemnDckerGlDahooCmmittDezDagClbergDatreCkhovnyDeshireHerCitscherEchChCgmoreDhiCffusEanyDerCesenbergDrksonFopDnkeDlCdlesonDikDerstadtDackCchowEesneyEatellierDceschiDayneFEtelliCbonnetDersteinEjEckEauDbinDanEllCartesBsaachsBrymanDbreadCumwrightEheiserEgoleDllardDeDdeDckhammerDCoughtDssosFmanEkiDngEesFnDegmillerDckCisdelleDnkallDmmerDgginsDeselEreCewskiDpsDkaDithDgrichEgsCawyEecDvlandDpeDmisDinerDgunEtEottaEajDftonEallDderDaBozoisDarCyanCxonCwsettCvenmuehlerCuyonDvierFaDthartDssanDradoDlaniDilletDgharityEallDetDCttoEeryDstryDoDieCswellDkocilDeckCrweilerDvillierEeeDtillaDsainvilDrianDpinghausEhDosanDnseifEhelmEellasFEbosDmanenHDieanDerDcentDatCpfCotsonDrnbosDneyCntenEasDotaEhveDningEellonFDmoreDkorEervoetDhoeDgoDelonDchatzDawaErCmnickDkowskiDioEnisGquezGcusHoFgusEanusDasClvenDliverDjacDiveiraDhonDgasDfayDcettoCkuchitzCinoDelCffingCerflingerDpnerDllingCdichDererCckrayEettFrDimoCbreEaszDmeierDeshDberfuhlEBmitrievBlobikCabajBjuricBizadareCventoDanCulioCttiEbrennerEaDollaDchfieldCstiloEanceDponetteEiritoDhingerDconDarufinoEbatoCruzzoDoseElloDadoCpperyConisopoulosEesCnunzioEcciDovoFiElaDhoDgsElasanEelDcoCmperioDoulakisEpoulosDmackDlingDitriouDesCltheyDoxDlworthEmoreEigardEeshawDgardDdaDcherFandCkkersDetEnsCgraziaDnessDiorgiEambattistDesareCfioraDfendalCewoldDtscheDstelEenDnDmozDlmanDgidioDdricksDbolCdlakeDamoCckunEsteinEirsonFnsDioccioEanoDhristopherDaroFaCbrinoDenedictCamicoDkDchenkoBhosaneBezellDayasCyetteDarmondGinCwyerDulfDitEnneDaratanawanCvreeseDittoEncenziEckDeyEneciaElCuschleGelDmanDermeyerCtzDurenneDtraEoreEmeringFannEerichDorresDlefsDjenDillierDhomasisDeringDarCsutterDtimeEephanoDrocherDquareDporteEarroisDortFmoFboElierDmariasDlogeEaurierDjardiwsDiyatnikovEslesElvoEatoDhaziorDforgesDerresDchompFinoFambeaultDautelleEntigoFCrusoEbeisDrisoFcottEerDoosEkoEinEestEblesDnierDmoDkachDizzioEtisEonEggiDgurahianDeuErEnzisFthalFsisFdalFbergerEmiahDaveniereEmoElphCpskyDrizioFnceEezEattDotteyDippoEnhoEetroDetrisErteEnaDaulisEsseEceConarianDdatoCnskiEieskiDoyellesEfrioDniEertEaDikenEerEceDhartogDchEeDburgerDafoCmyersDullingEizonDosthenesEneyGttDmonDichEanDetrisGeeErisDchokDboskyEinskiEerDauriEtosEstersErraisFiniFcFaClvinEeechioDusiaEneyEcciaDreDpianoDosanglelIelesEnDnegroDlosFnEingFboviEasciuccaGantaFpinaFjaconoFgattaFcaDisoEnoisElliGaEberatoDhommeDguercioEerEadiloDfiEelderDeyEvikEttreEssioEonardoEllisEhoyEgeaneDdeoDcineDbustoEruneFoccoEoDaskoFhawFanchaEremoreEplaneFenhaEnocheEllaEguilaFlioCkuyperDortFneDlerkDineCjoodeDesDarmeEgerECischerDrDghtonDdrickEaDbleChrerDombreDlerDghaniDanEemersCgunyaEiseDrellaEazioFndpreDoriElyerDlopperEanvilleDadoCfratesFncisHeschiDouwDigueroFlioEdeDariaCetersCdominicisEDierDekCculusDrooEeeDourleyEmoDlouetteEetEarkDkelmanDhartFmplainDasanovaErdoGenasEnnFeoCbritaFeEagaDnarDiewDesEnhamElloDarbaEckCarstyneEcoDnneEhardtDmerDgueroBaylongDaCwberDahoyaCvydovDtyanDosDirroEdekGDersEnsizerElDdaCuzartDrizioDilaDgheteeEeDfeldtDdierDbenmireCtyDuDteCstoliEeDsoDkamDingerDaliaCryanlDvileDsiEchDrupDnelDmDjeanDgenioDeyDdashtiFgnacDbroEeauDamolaCquipCpvaalaCnzaDtoniEesDoskiDnsEeckerDfieldDellaDczakEoesCmphousseDothEroDmrichEadDisDerellDbrozioDaCltorioDponteDombaDmidaEauDlenEaDitzEoDhartDeusEneEeDbeckDaqCirDmaruDllDchendtChoodDlstedtEeyFrCgnoneGEerDgyCerDCddsEeaEabboDCcresDhsEeletCberAczyrnikCwakielCuprynaDbiaCosekCernovskiGFikGakDkajCarnieckiBylerCchoszBuzzoCvaCtriDoneDiaDburthCsworthDtaDmanoDhwayEinberryEerFnEardDatisCrziDyloDriereEansFDpupozDlsEeyhairDellaEauDamengCpeCnninganEaneCmmiskyEerDleyDblidgeClottiDlinDajayCjasCezCddiheeDanCchiaraDcinelloEhiaroCartasEesmaDdroBsensichBruthirdsFersEchevGDmmedyoElishDizDeyElCoxfordEenDwinDutchEshornDtwellEherDslenDokstonDnholmEauerDmeensDgierDffieDcittoCitzmanEonEchelowDstofaroFelloIiEsingerEpoDquiDckenbergerCessellEencioDglowEgettDenanEleyDdoEilleDaseCawnDvenhoEattaDtionDntzDgarFnDcoliciEknellDawfordEnBozaddCyierCwserDnsDderCvottaDittElDarruviaHbioJaFECutinoDseyDrtoyFadEonEneyaEieEetEchineDntisEcellerCttillionEengimDroneoEeauDheranDeyEatDantCswellDteniveFllowoFiraEanziDsaboonImDiminiEerDcaDanoCrvelliDtiEesiDsillesEeyFriDronEidoniEettFoFnFauEaroDporonGalEenoDollaFisDnesFlsonFaEacchioDmicanFaDizEcEatyFnoDdermanFlFEascoDburnDalloEdiCponenDlesDierDaCopeyDnleyDmeyDlbrithFethEahanDkeyDgenDeyDchCnzeEalezDtrerosHesFasGrasEopoulosFfalskyEinoDsoliEigliDolyDnyerEinghanEetteFrtyEartonDlansDkriteDfreyEairDeysEllyEjoDdreayEinoEellGarioDciniFlioEhoEesFpionFicaoDableCmpresEisenoEeauGnEaroniFnieFgnaDolettiDmesFntDeauyClyottDumbresDschDpaertFckDorinaEpyEnneseFaEmyFbeGaDmerDlyEozoFvaFraEmeyerEacoDianDglazierDehourEbrookDdsmithEenDatoEsantiGmteErossiEnderEizzoFacovoEdonatoEconeEbreseCkinsChoeEDlmiaDaganCgenCfrancescoGCdeyEluppiCcranDozzaEranEmazziDkrinFehamEingDhisEerellDcoliCbioDaneCatleyEieDntDkerDchysBmielBlozzaDughlyDtheyDsovschiEeyDmanDffiDepfilCitesDnkerCeverlyFDsenDryEfDmsonEoEmonGFeyDarkCayterDveyFlleDuselEdEchertyDtonDrsonEendonEbourEDpDninEDmanEDesBivitelloDcciDatteEleCucciCtoCsnerozDloDewskiCrioniElliCpulloDpinaDoloneFloniConiCntraDkoskyDalliCmmiyottiDenoClvaDlsDientoEbrasiDfoneCesiolkaDrsezwskiEpkeEleyDlohaCcioDhoszFnskiDconiCbulskasCaramitaroDnoEciottaDmpanellaDlellaDcciaBhwierothDalekCvilicekCuyangherDrnerEchvilleDppaEikDkriDhDdzinskiGkEejCronesEmanDistofferGmauGleGaldiIFpenFcoeCownEenEanecDunlapaneElnardDttDpelasDmickiEaliDenDdorovCmelikCludzinskiCivaletteEDumentoDttomDsnallEchillyEariDrdonEaselloDppDottiEnchioEmaDnwezeEskeyEnisGEdlundDmenoDlinskasEdesDkkoDhakDffrillerDevesEngDavaroliEraEpettoEmintoChorEnDengDabraCeyneyEDvresDtelatEDstandEsorEmoreEickEanekDrwinskiEvinFenErieEnickFayEchioDonDneveyFtEaulsFilleDminEellDgwiddenDfferEaloDbretEahtahDasCavenEaydaDutinEhdreyEffeEdetDttersonEriandEonDstantEsEnoffDrsEnoskiEletonGEisseFfEfaurosEeunsriHrathEbonnelDppanElesGanEkoDobalDnthaumlsaHEofskyEelEdsawangbhFronnaitGasekharKaraFierEchuanEanieFdyDmpyFanyEleyEersEbleFerlianDlowFnerEitaEabanDjonDisEmElleEdyDgollanDfeDdseyEertonDbotteBezilCrseyDritelliDonskyFiDnanskyDenziaEghinoDdanDchiaDbantesDaoEnskiCntroneEorinoDskyCmanClyDuchDlupicaEioDaniCglaCdarsCasorDrlockBazzellDeaultDaCvezonDalliFeriEcoCutilloEhorneDlleyDghranDchonCtucciDtladgeEabrigaDilloDhersDenaccioGDaniElliEcunCsumpangEatDtrovinciGnovaEoralEiolaFnFlleroIjoEeraFllanozJetaGanEanioGadoFgnierDsisFonEelloFdayEaseFrubiasGdFdayDparyGDoriaDillesFeEdaDhingDgroveDemanEltonFloFdenDciaDarioFenoGllaEmayorEliggiFendaEgrandaEbonaCrzaDykDvettDthewGrGnsEayaFnDsnoEcallenDrubbaEocaEilFggFdineEelliEaturoIaFsFnsaFhanDpenteGitoDowayEtaEnnaElineDnoskeFhanEighanFeEahibaDmichelEelloDlsleyEingtonEeoDiveauEstoEllionHEdineEasoDdoniEishFnoGasEenosFjonFiroDcoDbalDavalhoEherEdonnaEcsoFciolaCpshawsDriceGciosoEaroDpaertDosoleDitaniEnpinEgaDezzutoEtlEstanyElsFlasDaroulaFelliElonganFdoCnuDtreEoralEfieldEabranaDoriDnuliDestroHiniErdayEllasHDdonDcerDatellaEkECmpolongoEagnoneHiniHeDonDmarnDinitaEdgeDbronneFicEeroDaronClzoneEadillaDverFntFloEarusoGesiDpinDonsagFneEcaDligyEezFoEaroDixtroEguireFariEcutDerDdersonEaroneDcheraEaginoDaycayEmarinoIHeCkanicCjuneEcomDeroCinionEglitDafaCgeyCfourekDfarelDarellaEgnoCdoyDmenDerEmartoriCckettDibaudaEDciolaCbrarDlaDiyaEdoDezaEllonEceiraDanesEgAbzhyanBytherCroDleyDdsongCndClundCantBvergerBuzzelleEancaCyesDakCvensCttinoFmerEariFccioDherDelCszakDtinzaDsomEkohlEinkGgerEertFlbergEaniDlDkohlDieDhieDeniusEckDcarinoDackerCrwickDtinDriesciEesonDnumEetFisenEamanDletteEandoDkiEerFlEaDigsayDhanuddinDgenEbacherDettaEssDdsallEisFEgDbanoDCquoContempoEadonnaCnzeyDyeaDtainDkersDgyEartDettaEsDdleyEetteCmmDbrayEaDatayClwinkleDtronDnesDloEmoreEerwellGtEaraFndDkinDgarellaDacanCkrimDowinskiCjolDaCikeChoveckeyDiteCgtongDlerDenhagenDayongErewiczCftonCettiDssDrstatteEgelGEDnaDglerEgensDcherCdzynaEDworthDesaDdleEenFmeyerCckridgeFeisEmillerEeDhserFbaumFEnaEheimEbergerDchinDananCbbicoCannoDlBrzyckiDostowskiCyumDngaEestadDarCuzewiczDynDunDtlagDsonEkiEeEcoFinoDnstingFkillEowEnemerEdermanEckhorstEbackDmbleyDhDgalDendermanEgmanDcieCozynaEellDwnsworthJdGbergerEleyDusEnsonEmleyDstoffEsmannEigEchinskyDomellEkshierFlynDnikowskiEdykeDmberekFachDkinsGgDjakowskiDichDgrenEglinDdhurstFagEeyDcklebankFieFellEhureFhausenEcoloCixiusDttsanEsEnellDsleyEboneDolaDntnallEgmanFasGntinoEckerhoffDguglioEgermanFEantinoDehlEgerDdsonEjmohanEgfordFetGnsEendolphGEdickDcknellFlesEhettoDareCezDvitzFlDutzmannEningDtlEhourEanaDsolinElawskiDntnallFanoEsnanFingerFelEowitzEnenstuhlEgleEdlingerFaFEceEamanDmsethEmeEanDljeDitungFenfeldtHbucherIergEnesElandDhonyDgonEeEantiniDfkaDemanEhlDdyEowEiceEahlDchbillDarleyCdarCazziElerDyeDverFnderEardDunsdorfGchweigeEghtEchlaDtekDskeyGtDnskeEotEineFffEganEenFckiEdsrudFmanFelandGFauerEcazioGntoEaughDmucciDkstadDisEmEgDhDgeDdtkeErickEonEicichDckelsbergEhmanFleEettyEaloniBozzellDovichDinovichCyengaCwringDletDgrenDersmithElsDcuttCvioDejaDainCutchyardDssonEquteEleyDrnsElierEgoisEffEekEdeauxFagesEbonnaisDndyDliourisDdrieauEinDchaertCtwinDtomlyFlfsonGeneEiggiEerbuschDrosEasDdorfCstelmanDsenbroekEardetDowskiDchultCryczDwigDuvkaDtignonDsaDromeoFlliEiesEetaFmansEasEDoznyEwiecEnatDnmanDmesDlinDguezEstedeEeseFrtGsFllaDellDdonEiEgesEenkircherFDbonDatkoCqueCppreCosalisDromDkterEmillerEamerCnzoDyaiDugliDsuEeyFllFeDowDnoElanderEinEenfantDjornoDiolDgoDettoEpartDdreDaventuraEttiEpartEgurioGidiCmzerDpaneDillaEaDbinoDasterCllensEbachEaertDinsFderEgEanDfaDeviceDdwynEuanEizsarEeCkalCitelDnDllotDdChonikDnkerEeyDlsenEmanEkenCgutDnudaDguessECfingerCeroEmEiEaDlkDhnkeDgeCdyfeltDonDisonDfishDerickEnhagenElsonDaryCcskorDkrathElundEhornEenstedtFlmannDhicchioEesFkDchieriEardCbsinDroskyDowiecDlakDetCaneDmahBlyzeCuteDshDnkallEdoDmkinEingEenscheinGkrantzGbergDelCoyeDttEskyDssomgameEfieldDomstromIandGburgDnskyEiganDmstrandDesEmkerEdelDchbergerCizardDnebryEdtDhovdeDdeDckerCeythingDvansDssettEofskyDilerEchnerGerDeckECazonEingFchDydonDxlandDuwEmanDszczykElEhakEenhauerDnscetEquetGartEnonEkoFenbeclerEgaEderDkstadDilockDfieldDeserGDdyEtDcockEkwallFmooreGarFingtonFbirdEioEhowskiBjornstromFCerknesFenDllaBizzardCvansCtzenhoferDarEhCssolEelEadaDphamDikirskiDchelEariDanzCrthwrightDsnerDonasDnerEbergDkmaierEenhagenDelyDdonCondaCnnDingerDetDderupDamCllusFeEottiEinsleyGgsbyFgmeierFetFarEesbachDchakDanskyCjanChlerECgusiakDonyDnellDgardCewaldDverDtschDsenthalFckerDrutEstedtFchbachFackEodElEkortteDnerDlserEkeEefieldDdekappCdstrupDellDdlecomeCcknaseEingDhoupanFffCbiloniCastockEottiDnchinBhullarCaskarDmaraniyamaDiroBezenekCyserDkeDeaDdounDaleFCvevinoCuttelEnagelEhinDseDrskensDkemaFlmanDerleDchlerCtznerElerEigDtleyDryDitDhuremEaDensonDakCstwickEineEeDsoneEingerEellieuDongDnerDkomDhoreDerEnEkeDaresEntFsonFconCrzunzaDulieDtrumEotFEmanEherFEellaEaoDshadskyEawDrospeFcalEayDnstockEotasFsEmenEitskyFeriFEheimEeriFllEbeckEaudoGFtchezFrducciHonFndFckiDlingoEeyEandyFcherDkovitchEenbileEbiglerDishajEngDgstedtFmanEouignanFldEmeyerEfalkEentyGstockGeEamineHDeyEsikEntzFschotEdaDduxEarFhlDczyEhielliFerEeirDbigEereiaCnzeeDwarcDulisDtzingerEremEhusenDstonDningsFghtEethEardFfieldDkoskyEerDjeDisekEntendiFgFatiEmadhoDezraEuentoDduEingEellDckendorfDbenekDantiEmatiEfieldEchFCmbiClwoodDveesDtramoDstadEkiEchnerGerDovsEussonGEnyFgerDluzEmoreEittiFstonFngtierGderEhouseEflowersEenFhumeurFfontaineEarFntoneFirFceDkenFDizEnaEeuEdorEardDhumeurDfyEortEiEastDezosDchiorDarminoEnichFcerCjilDgerDeranoDaCiswengerEselDlsteinEinsonEfussEeChnerDizadehEmerDernsDananElCgunEhlDoniaElliDnocheDenCeseDrleDmonDlarDdooElesEhamDckmanDboutCdreDocsDnarowiczDlionDillionDerEnfieldEeDawEtskyErCckorElinEesFlheimerCaureguardEparlantEDttleEsonEhDrdsFedDndoinDdyDchmanFellBayusDsdenDouthEnDnDaniCxtorCwksDerDcombeCvesCutisteEeDrerDmohlEliEkirchnerEiesterEgartelHnEfalkDchspiesEeCtzriDtistoEerFnhouseFigerDrichEaDlleEisFnerDkinDchellorCstickEardiDsitiDoreEneDkowDiniElaDhlineDeleyDcasCrvosaEickDusDtuskaFlaEosikGchFliEmesEletteEkusFiewiczEholomeuEeEchDsegyanEchdoorFewskiEamianDrymanEowmanFisEishFaultEeteFeEanDonneDningerEersFbeyEakFcleDlupEockEauFkDkenFmaDjenbruchDilloGEentosEaDgstadtEmannEeronDesiEraEndsDdosFnerEillEellDckEikEhusFackyDberrEazaFritoGeFlichFdilloDangaEhanaEdiFEchEbinCqueroCnwarthDsmerEeDowskiDnettDkosDguraDerjiEkDdykEuraEasakFrraDcourtFEksDburyCmforthDbasFceClzottiEarineFDwinskiDtruweitEazorDsisDoyEwEckEDmDluchEoweEmannEezFttoFsterousFnaFjosEarFnFgasDitasEshEgodEchDdwynEuzziEosEerreeFarenaEaDcosDaskoEngatanEkEdejoCkalarsCjkoDekCitnerDsonDroDottoDneyDlleuEadoDbakChriDdeDadueCgwillDuDronDnaschiCffaECeskensDrgDnzigerEaDllCdzinskiDruddinDlamDeyErtscherEnochDagliaccaCconeDmanDkhuusDinoDhmeyerEinskiEasFnDerraDayoCbsonDlakDinskiElonEkianEczDeyDbishCartsDckAazznaraCumaCorCatyanDpintoDharByyadCtesCsienCmarClockChensCeleCdinBxtmanCmanBwyieCBvonaCnerCisonCeniaDlesCarbuchDncenaButulloDovinoEbeeDherDerCstinoGeEerDlamCrrichioCnClsDderCfieroCdreyDibertDelhukCckleyDesCbelCalaBtzingerDhornCtwellDlesDilioEaDhoweDeburgCmoreDaClehCkissonChyDerholtDanasiouCengcoCamanczykBstilleroDafanCsumDisEngDenmacherDaloneEelCrariCpriDleyDerheimEllCnicarDerCkiewEaDeDChlyDkettleDingDbourneEachDafCenjoEgDltineCcolDhbacherCamoahBrztDabalaCviewDezDanitisECunachalamCtonDiesEbeeDhunDezErsCshamDeneaultCroydFanoEspideEchoDisolaEndelEgoneDellinEdlaDandFceCquellesCosemenaDlloDcaCntzenDsbergerDitzDerichDdellDaudetEoEldoCmyDoutEldEcidaDlinDisoDestoEnDadaCkontakyDingCistizabalEaDldsenDchabalaDailCgulewiczEdinDroDieDenzianoFtiCendashGllHeDlleanoDhanoCdsDeneauxEleanDalyCciolaEeriDhiopoliEdaleEbellCbonElidaDetmanErthaCauDshiroDneoEcibiaDldiDgonesEaoDbajianBquasBpthorpeCshireCrillEglianoCplonieEDiaDanaContaClingtonDeyCkerCelianCadacaBonoCBnzideoCwayCtronicaDoshEnovichFiakElakDilaEgnaniDhesDaoCsoateguiDloanCreozziCosDlickDeCnuzziDingDarinoElEbleFelCitokDnionDmashaunDdiCgociccoDlandDiolelliEleriGlloEerDermeierElozziGuFlottiFilloGcaDalichCeyDwaltDtsbergerDsiEhansleyDneDcelleCdrzejczykJakEuszkiewicEsonEodeEiopulosFnoFchEeolaFggFessenEangoFdezHsFchakDohDinaDerstFholmFeDaloraCcisoEcDelDarEladeCawatyFltBmysCstrongDpaughCousDttDrosEminoEielloEelloDeDdtCmondsDirataDerClinCithDstadiDllDgoCerioFcanDntlerDmiyaDlaDjoradoDdroEeoCburgyDroziakEisterDoreeEiseDertDagisCautyDtDsDrianEaDlongBlwinDazanCvirezDeroFadoCtyDstattEisiDmarkDimusDamirunoCsonDingDaqriCrodCquestaCpisDheausDerinCoyDstaDanCnoorCmsteadtIDosDgrenDarzaEjhoubClyneDsbrooksDonDingerEmanEanceDgireDevatoEshouseEruzzoFtonDderDcockDbertDansonEbaughCkinsDemaDanaCjemalCisauskasDmoEentoDeDcerDasChusseiniDameedFbraEddadCfredoDieroCeyandrezDxidorEandropoulHersFkisDsseEnaDpinDjandrezCdworthDrowEigeDonzaCcineDantasCbuDroughDorDeDarracinFaziCatosseDrconeDnkoEdDmiaEeidaEbarDiBkweiCsoyCoCleyCinrefonDmseuChavanEndCeryCawanzieDpoDmiroDlBjokuCaniBiutoDdiCrthCpperspachDorlaniEpoColaCniClsworthDlsDiffCevoliCdCavaBhyetCrenholzCnellCloDfieldDemeyerCimudDaCheeCausDltBgustinoHeDrsDmgaDeleCrestoEdaCpaoaCostiDroDnoyDffCgersCemyDboiCbisitBfurongCsharCfrontiDlickDeltrangerCableBeilloBduleCrionColpheEfsonCnerCloffDingCickesDbCelspergerEmundEizziCdeoCamsonisFenEowskiFsEecDljaBcostoDrsEdaDckClyCkahChinCevedaDrraEnoDitunoDeCcalaCalBbusufaitDgnDelCsalonCriolaDeyEllDamovitzGffFianEhamianCousalehDshihataDlafiaClemanCkemeierCingtonEaDgantusDdeCetaDrcombieCdulmuniemFazizDouDelmutiFazizGlCbingtonDatielloCajianEaBarsvoldDhusDdemaDantCnderudClundDderink"); + +// node_modules/@zxcvbn-ts/language-en/dist/wikipedia.json.mjs +var wikipedia = decompress("AtheAofAandAinAwasAisAforAasAonAwithAbyAheAatAfromAhisAanAwereAareAwhichAdocAhttpsAalsoAorAhasCdAfirstAoneAtheirAitsAafterAnewAwhoAtheyBwoAherAsheAbeenAotherAwhenAtimeAduringAintoAschoolAmoreBayAyearsAoverBnlyAyearAmostAwouldCrldAcityAsomeAwhereAbetweenAlaterAthreeAstateBuchAthenAnationalAusedAmadeAknownAunderAmanyAuniversityDtedAwhileApartAseasonAteamBheseAamericanAthanAfilmAsecondAbornAsouthAbecameAstatesAwarAthroughAbeingAincludingAbothBeforeAnorthAhighBoweverApeopleAfamilyAearlyAhistoryAalbumBreaAseriesAagainstAuntilAsinceAdistrictAcountyAnameAworkAlifeAgroupAmusicAfollowingAnumberAcompanyAseveralAfourAcalledAplayedAreleasedAcareerAleagueAgameBovernmentAhouseAeachAbasedAdayAsameAwonAuseAstationAclubAinternationalAtownAlocatedApopulationAgeneralAcollegeAeastAfoundAageAmarchAendAseptemberAbeganAhomeApublicAchurchAlineAjuneAriverAmemberAsystemAplaceAcenturyAbandAjulyAyorkAjanuaryAoctoberAsongAaugustAbestAformerAbritishApartyAnamedAheldAvillageAshowAlocalAnovemberAtookAserviceAdecemberAbuiltAanotherAmajorAwithinAalongAmembersAfiveAsingleAdueAalthoughAsmallAoldAleftAfinalAlargeAincludeAbuildingAservedApresidentAreceivedAgamesAdeathAfebruaryAmainAthirdAsetAchildrenAownBrderAspeciesAparkAlawAairApublishedAroadAdiedAbookAmenAwomenAarmyAoftenAaccordingAeducationAcentralBountryAdivisionAenglishAtopAincludedAdevelopmentAfrenchAcommunityAamongAwaterAplayAsideAlistAtimesAnearAlateAformAoriginalAdifferentAcenterApowerAledAstudentsAgermanAmovedAcourtAsixAlandAcouncilAislandAu.s.ArecordAmillionAresearchAartAestablishedAawardAstreetAmilitaryAtelevisionAgivenAregionAsupportAwesternAproductionAnonApoliticalCintAcupAperiodAbusinessAtitleAstartedAvariousAelectionAusingAenglandAroleAproducedAbecomeAprogramAworksAfieldAtotalAofficeAclassAwrittenAassociationAradioAunionAlevelAchampionshipAdirectorAfewBorceAcreatedAdepartmentAfoundedAservicesAmarriedAthoughAperAn'tAsiteAopenAactAshortBocietyAversionAroyalApresentAnorthernAworkedAprofessionalAfullAreturnedAjoinedAstoryAfranceAeuropeanAcurrentlyAlanguageAsocialAcaliforniaAindiaAdesignAst.AfurtherAroundAaustraliaAwroteAsanAprojectAcontrolAsouthernArailwayAboardApopularAcontinuedAfreeAbattleAconsideredAvideoAcommonApositionAlivingAhalfAplayingArecordedCdApostAdescribedAaverageArecordsAspecialAmodernAappearedBnnouncedBreasArockBeleaseAelectedAothersAexampleAtermAopenedAsimilarAformedArouteAcensusBurrentAschoolsAoriginallyAlakeAdevelopedAraceAhimselfAforcesAadditionAinformationAuponAprovinceAmatchAeventAsongsAresultAeventsAwinAeasternAtrackAleadAteamsAscienceAhumanAconstructionAministerAgermanyAawardsBvailableAthroughoutBrainingAstyleAbodyAmuseumAaustralianAhealthAsevenBignedAchiefAeventuallyAappointedAseaAcentreAdebutAtourApointsAmediaAlightArangeAcharacterAacrossAfeaturesBamiliesAlargestAindianAnetworkAlessAperformanceBlayersAreferAeuropeAsoldAfestivalAusuallyAtakenAdespiteDignedAcommitteeAprocessAreturnAofficialAepisodeAinstituteAstageAfollowedAperformedAjapaneseApersonalAthusAartsAspaceAlowAmonthsAincludesAchinaAstudyAmiddleBagazineAleadingAjapanAgroupsAaircraftAfeaturedCderalAcivilArightsAmodelAcoachBanadianAbooksAremainedAeightAtypeAindependentAcompletedBapitalAacademyAinsteadAkingdomAorganizationAcountriesAstudiesAcompetitionAsportsBizeAaboveAsectionAfinishedAgoldAinvolvedAreportedAmanagementAsystemsAindustryAdirectedAmarketAfourthAmovementAtechnologyAbankAgroundAcampaignAbaseAlowerAsentAratherAaddedAprovidedAcoastAgrandAhistoricAvalleyAconferenceAbridgeAwinningAapproximatelyAfilmsAchineseAawardedAdegreeArussianAshowsAnativeAfemaleAreplacedAmunicipalityAsquareBtudioAmedicalAdataAafricanAsuccessfulAmidAbayAattackApreviousAoperationsAspanishAtheatreAstudentArepublicAbeginningAprovideAshipAprimaryAownedAwritingAtournamentAcultureAintroducedAtexasArelatedAnaturalApartsAgovernorAreachedAirelandAunitsAseniorAdecidedAitalianAwhoseAhigherAafricaAstandardAincomeAprofessorBlacedAregionalAlosAbuildingsAchampionshipsAactiveAnovelAenergyAgenerallyAinterestAviaAeconomicApreviouslyAstatedAitselfAchannelAbelowAoperationAleaderAtraditionalEeAstructureAlimitedArunsApriorAregularAfamousAsaintAnavyAforeignAlistedAartistAcatholicAairportAresultsAparliamentAcollectionAunitAofficerAgoalAattendedAcommandAstaffAcommissionAlivedBocationAplaysAcommercialAplacesAfoundationAsignificantAolderAmedalAselfBcoredAcompaniesAhighwayAactivitiesAprogramsAwideAmusicalAnotableAlibraryAnumerousAparisAtowardsAindividualAallowedAplantBropertyAannualAcontractAwhomAhighestAinitiallyArequiredAearlierAassemblyBrtistsAruralAseatApracticeAdefeatedAendedAsovietAlengthAspentAmanagerApressAassociatedButhorAissuesAadditionalAcharactersAzealandApolicyAengineAtownshipAnotedAhistoricalAcompleteAfinancialAreligiousAmissionAcontainsAnineArecentCpresentedApennsylvaniaAadministrationAopeningAsecretaryAlinesAreportAexecutiveAyouthAclosedAtheoryAwriterAitalyAangelesBppearanceAfeatureAqueenAlaunchedBegalAtermsAenteredAissueAeditionAsingerAgreekAmajorityAbackgroundAsourceAantiAculturalBomplexBhangesArecordingAstadiumAislandsAoperatedAparticularlyAbasketballAmonthAusesAportAcastleAmostlyAnamesAfortAselectedAincreasedAstatusBubsequentlyApacificAcoverAvarietyAcertainAgoalsAremainsAupperAcongressAbecomingAstudiedAirishAnatureAparticularAlossAcausedBhartAforcedAcreateAeraAretiredAmaterialAreviewBateAsinglesAreferredAlargerAindividualsAshownAprovidesDductsAspeedAdemocraticApolandBarishAolympicsAcitiesAthemselvesBempleAwingAgenusAhouseholdsAservingAcostAwalesAstationsApassedAsupportedAviewAcasesAformsAactorAmaleCtchesClesAstarsAtracksAfemalesAadministrativeAmedianAeffectAbiographyAengineeringAcampAofferedAchairmanAhousesAmainlyA19thAsurfaceAthereforeAnearlyAscoreAancientAsubjectAprimeAseasonsAclaimedAexperienceAspecificAjewishAfailedAoverallAbelievedAplotAtroopsAgreaterAspainAconsistsAbroadcastAheavyAincreaseAraisedAseparateAcampusA1980sAappearsApresentedAliesAcomposedArecentlyAinfluenceAfifthAnationsAcreekAreferencesAelectionsAbritainAdoubleAcastAmeaningAearnedAcarriedAproducerAlatterAhousingAbrothersAattemptBrticleAresponseAborderAremainingAnearbyAdirectAshipsAvalueAworkersApoliticianAacademicAlabelA1970sAcommanderAruleAfellowAresidentsAauthorityAeditorAtransportAdutchAprojectsAresponsibleAcoveredAterritoryAflightAracesAdefenseAtowerAemperorAalbumsAfacilitiesAdailyAstoriesAassistantAmanagedAprimarilyAqualityAfunctionAproposedAdistributionAconditionsAprizeAjournalAcodeAviceAnewspaperAcorpsAhighlyAconstructedAmayorAcriticalAsecondaryAcorporationArugbyBegimentAohioAappearancesAserveAallowAnationAmultipleAdiscoveredCrectlyAsceneAlevelsAgrowthAelementsAacquiredA1990sAofficersAphysicalA20thAlatinAhostAjerseyAgraduatedAarrivedAissuedAliteratureAmetalAestateAvoteAimmediatelyAasianAcompetedAextendedAproduceAurbanA1960sApromotedAcontemporaryAglobalAformerlyAappearAindustrialAtypesAoperaAministryAsoldiersAcommonlyAmassAformationAsmallerAtypicallyAdramaAshortlyAdensityAsenateAeffectsAiranApolishBrominentAnavalAsettlementAdividedAbasisArepublicanAlanguagesAdistanceAtreatmentAcontinueAproductAmileAsourcesAfootballerCrmatAclubsAleadershipAinitialAoffersBperatingAavenueAofficiallyAcolumbiaAgradeAsquadronAfleetApercentAfarmAleadersAagreementAlikelyAequipmentAwebsiteAmountAgrewAmethodAtransferredAintendedArenamedAironAreserveAcapacityApoliticsAwidelyAactivityBdvancedArelationsAscottishAdedicatedAcrewAfounderAepisodesAlackAamountAbuildAeffortsAconceptAfollowsAorderedAleavesApositiveAeconomyBntertainmentAaffairsAmemorialAabilityAillinoisAcommunitiesClorAtextArailroadAscientificAfocusAcomedyAservesAexchangeBnvironmentAcarsAdirectionAorganizedAfirmAdescriptionAagencyBnalysisApurposeAdestroyedAreceptionAplannedArevealedAinfantryAarchitectureAgrowingAfeaturingAhouseholdAcandidateAremovedAsituatedAmodelsAknowledgeAsoloAtechnicalAorganizationsAassignedAconductedAparticipatedAlargelyApurchasedAregisterAgainedAcombinedAheadquartersAadoptedApotentialBrotectionAscaleAapproachAspreadAindependenceAmountainsAtitledAgeographyAappliedAsafetyAmixedAacceptedAcapturedArailAdefeatAprincipalArecognizedAmentionedAsemiAownerAjointAliberalAactressAtrafficAcreationAbasicAnotesAuniqueAsupremeAdeclaredAsimplyAplantsAsalesAmassachusettsAdesignatedApartiesAjazzAcomparedAbecomesAresourcesAtitlesAconcertAlearningAremainAteachingAversionsAcontentAalongsideArevolutionAsonsAblockApremierAimpactAchampionsAdistrictsAgenerationAestimatedAvolumeAimageAsitesAaccountArolesAsportAquarterAprovidingAzoneAyardAscoringAclassesApresenceBerformancesArepresentativesAhostedAsplitAtaughtAoriginBlympicAclaimsBriticsAfacilityAoccurredAsufferedAmunicipalAdamageBefinedAresultedDpectivelyAexpandedAplatformAdraftAoppositionAexpectedBducationalAontarioAclimateAreportsAatlanticAsurroundingAperformingAreducedBankedAallowsAbirthAnominatedAyoungerAnewlyAkongApositionsAtheaterAphiladelphiaAheritageAfinalsAdiseaseAsixthAlawsAreviewsAconstitutionAtraditionAswedishAthemeAfictionAromeAmedicineAtrainsAresultingAexistingAdeputyAenvironmentalAlabourAclassicalAdevelopAfansAgrantedAreceiveAalternativeAbeginsAnuclearAfameAburiedAconnectedAidentifiedApalaceAfallsAlettersAcombatAsciencesAeffortAvillagesAinspiredAregionsAtownsAconservativeBhosenAanimalsAlaborAattacksAmaterialsAyardsAsteelArepresentativeAorchestraApeakAentitledAofficialsAreturningCferenceAnorthwestAimperialAconventionAexamplesAoceanApublicationBaintingAsubsequentAfrequentlyAreligionAbrigadeAfullyAsidesAactsAcemeteryArelativelyAoldestAsuggestedCcceededAachievedBpplicationAprogrammeAcellsAvotesApromotionAgraduateAarmedAsupplyAflyingAcommunistAfiguresAliteraryAnetherlandsAkoreaAworldwideAcitizensA1950sAfacultyAdrawAstockBeatsAoccupiedAmethodsAunknownAarticlesAclaimAholdsAauthoritiesCdienceAswedenAinterviewAobtainedAcoversAsettledAtransferAmarkedAallowingAfundingAchallengeAsoutheastAunlikeAcrownAriseAportionAtransportationAsectorAphaseBropertiesAedgeAtropicalAstandardsAinstitutionsAphilosophyAlegislativeAhillsAbrandAfundAconflictAunableAfoundingArefusedAattemptsAmetresApermanentAstarringAapplicationsAcreatingAeffectiveAairedAextensiveBmployedBxpansionAbillboardArankAbattalionAmultiAvehicleAfoughtAallianceAcategoryAperformAfederationApoetryAbronzeBandsAentryAvehiclesAbureauAmaximumAbillionAtreesAintelligenceAgreatestAscreenArefersAcommissionedAgalleryAinjuryAconfirmedAsettingAtreatyAadultBmericansAbroadcastingAsupportingApilotAmobileAwritersAprogrammingAexistenceAsquadAminnesotaAcopiesAkoreanAprovincialAsetsAdefenceAofficesAagriculturalAinternalAcoreAnortheastAretirementAfactoryAactionsApreventAcommunicationsAendingAweeklyAcontainingAfunctionsAattemptedAinteriorAweightAbowlArecognitionAincorporatedDreasingAultimatelyAdocumentaryBerivedAattackedAlyricsAmexicanAexternalAchurchesBenturiesAmetropolitanAsellingAopposedApersonnelAmillAvisitedApresidentialAroadsApiecesAnorwegianAcontrolledA18thArearAinfluencedAwrestlingBeaponsAlaunchAcomposerAlocationsAdevelopingAcircuitAspecificallyBtudiosBharedAcanalAwisconsinApublishingAapprovedAdomesticAconsistedAdeterminedAcomicAestablishmentBxhibitionAsouthwestAfuelAelectronicAcapeBonvertedAeducatedAmelbourneAhitsAwinsAproducingAnorwayAslightlyAoccurAsurnameAidentityArepresentAconstituencyAfundsAprovedAlinksAstructuresAathleticAbirdsAcontestAusersApoetAinstitutionAdisplayAreceivingBareAcontainedAmotionApianoAtemperatureApublicationsBassengerAcontributedAtowardAcathedralAinhabitantsAarchitectAexistAathleticsAmuslimAcoursesAabandonedAsignalBuccessfullyAdisambiguationAtennesseeAdynastyAheavilyAmarylandAjewsArepresentingAbudgetAweatherAmissouriAintroductionAfacedApairAchapelAreformAheightAvietnamAoccursAmotorAcambridgeAlandsAfocusedAsoughtApatientsAshapeAinvasionAchemicalAimportanceAcommunicationAselectionAregardingAhomesAvoivodeshipAmaintainedAboroughAfailureAagedApassingAagricultureAoregonAteachersAflowAphilippinesAtrailAseventhAportugueseAresistanceCachingAnegativeAfashionAscheduledAdowntownAuniversitiesAtrainedAskillsBcenesAviewsAnotablyAtypicalAincidentAcandidatesAenginesAdecadesAcompositionDmuneBhainAinc.AaustriaAsaleAvaluesAemployeesAchamberAregardedAwinnersAregisteredAtaskAinvestmentAcolonialAswissAuserAentirelyAflagAstoresAcloselyAentranceAlaidAjournalistAcoalAequalAcausesAturkishAquebecAtechniquesApromoteAjunctionAeasilyAdatesAkentuckyAsingaporeAresidenceAviolenceAadvanceAsurveyAhumansAexpressedApassesAstreetsAdistinguishedAqualifiedAfolkAestablishBgyptAartilleryAvisualAimprovedAactualAfinishingAmediumAproteinAswitzerlandAproductionsAoperateApovertyAneighborhoodAorganisationAconsistingEecutiveAsectionsApartnershipAextensionAreactionAfactorAcostsAbodiesAdeviceAethnicAracialAflatAobjectsAchapterAimproveAmusiciansAcourtsCntroversyAmembershipCrgedAwarsAexpeditionAinterestsAarabAcomicsAgainAdescribesAminingAbachelorAcrisisAjoiningAdecadeA1930sAdistributedAhabitatAroutesAarenaAcycleAdivisionsAbrieflyAvocalsAdirectorsBegreesAobjectArecordingsAinstalledAadjacentAdemandAvotedAcausingAbusinessesAruledAgroundsAstarredAdrawnAoppositeAstandsAformalAoperatesApersonsAcountiesCmpeteAwaveAisraeliAncaaAresignedAbriefAgreeceAcombinationAdemographicsAhistorianAcontainCmmonwealthAmusicianAcollectedAarguedAlouisianaAsessionAcabinetAparliamentaryAelectoralAloanAprofitAregularlyAconservationAislamicApurchaseA17thAchartsAresidentialAearliestAdesignsApaintingsAsurvivedAmothAitemsAgoodsBreyAanniversaryAcriticismAimagesAdiscoveryAobservedAundergroundAprogressAadditionallyAparticipateAreduceAelementaryAownersAstatingAiraqAresolutionAcaptureAtankAroomsAhollywoodAfinanceAqueenslandAreignAmaintainAiowaAlandingAbroadAoutstandingAcircleApathAmanufacturingAassistanceAsequenceAgminaAcrossingAleadsAuniversalAshapedAkingsAattachedAmedievalAagesAmetroAcolonyAaffectedAscholarsAoklahomaAcoastalAsoundtrackApaintedAattendAdefinitionAmeanwhileApurposesAtrophyArequireAmarketingApopularityAcableAmathematicsBississippiArepresentsAschemeAappealAdistinctAfactorsAacidAsubjectsAroughlyAterminalAeconomicsAsenatorAdioceseAprixAcontrastAargentinaAczechAwingsAreliefAstagesAdutiesA16thAnovelsAaccusedAwhilstAequivalentAchargedAmeasureAdocumentsAcouplesArequestAdanishBefensiveAguideAdevicesAstatisticsAcreditedAtriesApassengersAalliedAframeApuertoBeninsulaAconcludedAinstrumentsAwoundedAdifferencesAassociateAforestsAafterwardsAreplaceCquirementsAaviationAsolutionAoffensiveBwnershipAinnerAlegislationAhungarianAcontributionsAactorsAtranslatedAdenmarkAsteamAdependingAaspectsCsumedAinjuredAsevereAadmittedAdetermineAshoreAtechniqueAarrivalAmeasuresAtranslationAdebutedCliveredAreturnsCjectedAseparatedAvisitorsAdamagedAstorageAaccompaniedAmarketsAindustriesAlossesAgulfAcharterAstrategyAcorporateAsocialistCmewhatBignificantlyAphysicsAmountedAsatelliteAexperiencedAconstantArelativeApatternArestoredAbelgiumAconnecticutApartnersAharvardAretainedAnetworksAprotectedAmodeAartisticAparallelAcollaborationAdebateAinvolvingAlinkedAsaltAauthorsAcomponentsCntextAoccupationArequiresAoccasionallyApoliciesAtamilAottomanArevolutionaryAhungaryApoemAversusAgardensAamongstBudioAmakeupAfrequencyAmetersAorthodoxAcontinuingAsuggestsAlegislatureAcoalitionAguitaristAeighthAclassificationApracticesAsoilAtokyoAinstanceAlimitAcoverageCnsiderableArankingAcollegesBavalryBentersAdaughtersAtwinAequippedAbroadwayAnarrowAhostsAratesAdomainAboundaryAarrangedA12thAwhereasAbrazilianAformingAratingAstrategicAcompetitionsAtradingAcoveringAbaltimoreAcommissionerAinfrastructureAoriginsAreplacementApraisedAdiscAcollectionsAexpressionAukraineAdrivenAeditedAaustrianAsolarAensureApremieredAsuccessorAwoodenAoperationalAhispanicAconcernsArapidAprisonersAchildhoodAmeetsAinfluentialAtunnelAemploymentAtribeAqualifyingAadaptedAtemporaryAcelebratedAappearingAincreasinglyAdepressionAadultsAcinemaAenteringAlaboratoryAscriptAflowsAromaniaAaccountsAfictionalApittsburghAachieveAmonasteryAfranchiseBormallyAtoolsAnewspapersArevivalAsponsoredAprocessesAviennaAspringsAmissionsAclassifiedA13thAannuallyAbranchesAlakesAgenderAmannerAadvertisingAnormallyAmaintenanceAaddingAcharacteristicsAintegratedAdeclineAmodifiedAstronglyAcriticAmalaysiaAarkansasAnaziArestorationApoweredAmonumentAhundredsAdepthA15thAcontroversialAadmiralAcriticizedAbrickAhonoraryAinitiativeAoutputAvisitingAbirminghamAprogressiveAexistedAcarbonA1920sAcreditsBolourArisingAhenceAdefeatingAsuperiorAfilmedAlistingAcolumnAsurroundedAorleansAprinciplesAterritoriesAstruckAparticipationAindonesiaAmovementsAindexAcommerceCnductDstitutionalAspiritualAambassadorAvocalAcompletionAedinburghAresidingAtourismAfinlandAbearsAmedalsAresidentAthemesAvisibleAindigenousCvolvementAbasinAelectricalAukrainianAconcertsAboatsAstylesAprocessingArivalAdrawingAvesselsAexperimentalAdeclinedAtouringAsupportersAcompilationCachingBitedAdatedArootsAstringAexplainedAtransitDditionallyApoemsAminimumArepresentationA14thAreleasesAeffectivelyAarchitecturalAtripleAindicatedAgreatlyAelevationAclinicalAprintedA10thAproposalBeakedBroducersAromanizedBapidlyAstreamAinningsAmeetingsAcounterAhouseholderCnourAlastedAagenciesAdocumentAexistsAsurvivingAexperiencesAhonorsAlandscapeAhurricaneBarborApanelAcompetingAprofileAvesselAfarmersAlistsArevenueAexceptionAcustomersA11thAparticipantsAwildlifeAutahAbibleAgraduallyApreservedAreplacingAsymphonyAbegunAlongestAsiegeAprovincesAmechanicalAgenreAtransmissionAagentsAexecutedAvideosAbenefitsAfundedAratedAinstrumentalAninthAsimilarlyAdominatedBestructionApassageAtechnologiesBhereafterAouterAfacingAaffiliatedAopportunitiesAinstrumentAgovernmentsAscholarAevolutionAchannelsAsharesBessionsAwidespreadAoccasionsAengineersAscientistsBigningAbatteryAcompetitiveAallegedAeliminatedAsuppliesAjudgesAhampshireAregimeAportrayedBenaltyAtaiwanAdeniedAsubmarineBcholarshipBubstantialAtransitionAvictorianAhttpAneverthelessAfiledAsupportsAcontinentalAtribesAratioAdoublesAusefulAhonoursAblocksAprincipleAretailAdepartureAranksApatrolAyorkshireAvancouverAinterAextentAafghanistanAstripArailwaysAcomponentAorganAsymbolAcategoriesAencouragedAabroadAcivilianAperiodsAtraveledAwritesAstruggleAimmediateArecommendedAadaptationAegyptianAgraduatingAassaultAdrumsAnominationAhistoricallyAvotingAalliesAdetailedAachievementApercentageAarabicBssistAfrequentAtouredAapplyBnd/orAintersectionAmaineAtouchdownBhroneAproducesAcontributionAemergedAobtainAarchbishopAseekAresearchersCmainderApopulationsAclanAfinnishAoverseasAfifaAlicensedAchemistryAfestivalsAmediterraneanAinjuriesAanimatedAseekingApublisherAvolumesAlimitsAvenueAjerusalemAgeneratedAtrialsAislamAyoungestArulingAglasgowBermansAsongwriterApersianAmunicipalitiesAdonatedAviewedAbelgianAcooperationApostedAtechAdualAvolunteerAsettlersAcommandedBlaimingAapprovalAdelhiAusageAterminusApartlyAelectricityAlocallyAeditionsApremiereAabsenceAbeliefAtraditionsAstatueAindicateAmanorAstableAattributedApossessionAmanagingAviewersAchileAoverviewAseedAregulationsAessentialAminorityAcargoAsegmentAendemicAforumAdeathsAmonthlyAplayoffsAerectedApracticalAmachinesAsuburbArelationAdescentAindoorAcontinuousBharacterizedAsolutionsAcaribbeanArebuiltAserbianBummaryAcontestedApsychologyBitchAattendingAmuhammadAtenureAdriversBiameterAassetsAventureApunkAairlinesAconcentrationAathletesAvolunteersApagesAminesAinfluencesAsculptureAprotestAferryAbehalfAdraftedAapparentAfurthermoreArangingBomanianAdemocracyAlankaAsignificanceAlinearAd.c.AcertifiedAvotersArecoveredAtoursAdemolishedAboundariesAassistedAidentifyAgradesAelsewhereAmechanismA1940sAreportedlyAaimedAconversionAsuspendedAphotographyAdepartmentsAbeijingAlocomotivesApubliclyAdisputeAmagazinesAresortAconventionalAplatformsAinternationallyAcapitaAsettlementsAderbyAestablishingAinvolvesAstatisticalAimplementationCmigrantsAexposedAdiverseAlayerAvastAceasedBonnectionsAbelongedAinterstateAuefaAorganisedAabuseAdeployedAcattleApartiallyAfilmingAmainstreamAreductionAautomaticArarelyAsubsidiaryAdecidesAmergerAcomprehensiveAdisplayedAamendmentAguineaAexclusivelyAmanhattanAconcerningCmmonsAradicalAserbiaAbaptistBusesAinitiatedAportraitAharbourAchoirBitizenAsoleAunsuccessfulAmanufacturedAenforcementAconnectingAincreasesApatternsAsacredAmuslimsAclothingAhinduAunincorporatedAsentencedAadvisoryAtanksAcampaignsAfledArepeatedCmoteCbellionAimplementedAtextsAfittedAtributeAwritingsAsufficientAministersA21stAdevotedAjurisdictionAcoachesAinterpretationApoleAbusinessmanAperuAsportingApricesAcubaArelocatedAopponentAarrangementAeliteAmanufacturerArespondedAsuitableAdistinctionAcalendarAdominantAtouristAearningAprefectureAtiesApreparationAangloApursueAworshipAarchaeologicalAchancellorAbangladeshAscoresAtradedAlowestAhorrorAoutdoorAbiologyAcommentedAspecializedAloopAarrivingAfarmingAhousedBistoriansA'theApatentBupilsAchristianityAopponentsAathensAnorthwesternAmapsApromotingArevealsAflightsAexclusiveAlionsAnorfolkAhebrewAextensivelyBldestAshopsAacquisitionAvirtualArenownedAmarginAongoingAessentiallyAiranianAalternateAsailedAreportingAconclusionAoriginatedAtemperaturesAexposureAsecuredAlandedArifleAframeworkAidenticalAmartialAfocusesAtopicsAballetAfightersAbelongingAwealthyAnegotiationsAevolvedAbasesAorientedAacresAdemocratAheightsArestrictedAvaryAgraduationAaftermathAchessAillnessAparticipatingAverticalAcollectiveAimmigrationAdemonstratedAleafAcompletingAorganicAmissileAleedsAeligibleAgrammarAconfederateAimprovementAcongressionalAwealthAcincinnatiAspacesAindicatesAcorrespondingAreachesCpairAisolatedAtaxesAcongregationAratingsAleaguesAdiplomaticAsubmittedAwindsAawarenessAphotographsAmaritimeAnigeriaAaccessibleBnimationArestaurantsAphilippineAinauguralAdismissedAarmenianAillustratedAreservoirAspeakersAprogrammesAresourceAgeneticAinterviewsAcampsAregulationAcomputersApreferredAtravelledAcomparisonAdistinctiveArecreationCquestedAsoutheasternAdependentAbrisbaneCeedingAplayoffAexpandAbonusAgaugeAdepartedAqualificationAinspirationAshippingBlavesAvariationsAshieldAtheoriesAmunichArecognisedAemphasisAfavourAvariableAseedsAundergraduateAterritorialAintellectualAqualifyAminiAbannedApointedAdemocratsAassessmentAjudicialAexaminationAattemptingAobjectiveApartialAcharacteristicAhardwareApradeshAexecutionAottawaAmetreAdrumAexhibitionsAwithdrewAattendanceAphraseAjournalismAlogoAmeasuredAerrorAchristiansAtrioAprotestantAtheologyArespectiveAatmosphereAbuddhistAsubstituteAcurriculumAfundamentalAoutbreakArabbiAintermediateAdesignationAglobeAliberationAsimultaneouslyAdiseasesAexperimentsAlocomotiveAdifficultiesAmainlandAnepalArelegatedAcontributingAdatabaseBevelopmentsAveteranAcarriesArangesAinstructionAlodgeAprotestsAobamaAnewcastleAexperimentAphysicianAdescribingAchallengesBorruptionAdelawareAadventuresAensembleAsuccessionArenaissanceAtenthAaltitudeAreceivesAapproachedAcrossesAsyriaAcroatiaAwarsawAprofessionalsAimprovementsAwornAairlineAcompoundApermittedBreservationAreducingAprintingAscientistAactivistAcomprisesAsizedBocietiesAentersArulerAgospelAearthquakeBxtendAautonomousAcroatianAserialAdecoratedArelevantAidealAgrowsCassAtierBowersAwiderBelfareAcolumnsAalumniAdescendantsAinterfaceAreservesAbankingAcoloniesAmanufacturersCgneticAclosureApitchedAvocalistApreserveAenrolledAcancelledAequationA2000sAnicknameAbulgariaAheroesAexileAmathematicalAdemandsAinputAstructuralAtubeAstemAapproachesBrgentineBxisAmanuscriptAinheritedAdepictedAtargetsAvisitsBeteransAregardCmovalAefficiencyAorganisationsAconceptsAlebanonAmangaApetersburgArallyAsuppliedAamountsAyaleAtournamentsAbroadcastsAsignalsApilotsAazerbaijanBrchitectsAenzymeAliteracyAdeclarationAplacingAbattingAincumbentAbulgarianAconsistentApollAdefendedAlandmarkAsouthwesternAraidBesignationAtravelsAcasualtiesAprestigiousAnamelyAaimsArecipientAwarfareAreadersAcollapseCachedCntrolsAvolleyballAcoupAlesserAverseApairsAexhibitedAproteinsAmolecularAabilitiesAintegrationAconsistAaspectBdvocateCministeredAgoverningAhospitalsAcommencedCinsAlordsAvariationAresumedAcantonAartificialAelevatedApalmAdifficultyAcivicAefficientAnortheasternAinductedAradiationAaffiliateAboardsAstakesAbyzantineAconsumptionAfreightAinteractionAoblastAnumberedAseminaryAcontractsAextinctApredecessorAbearingAculturesAfunctionalAneighboringArevisedAcylinderAgrantsAnarrativeAreformsAathleteAtalesAreflectApresidencyAcompositionsAspecialistAcricketerAfoundersAsequelAwidowAdisbandedAassociationsAbackedAtherebyApitcherAcommandingAboulevardAsingersAcropsAmilitiaAreviewedAcentresAwavesAconsequentlyAfortressAtributaryAportionsAbombingAexcellenceAnestApaymentAmarsAplazaAunityAvictoriesAscotiaAfarmsAnominationsAvariantAattackingAsuspensionAinstallationAgraphicsAestatesAcommentsAacousticAdestinationAvenuesAsurrenderAretreatAlibrariesAquarterbackAcustomsAberkeleyAcollaboratedAgatheredAsyndromeAdialogueArecruitedAshanghaiAneighbouringApsychologicalAsaudiAmoderateAexhibitAinnovationAdepotAbindingBrunswickAsituationsAcertificateAactivelyAshakespeareAeditorialApresentationBortsArelayAnationalistAmethodistAarchivesAexpertsAmaintainsAcollegiateAbishopsAmaintainingAtemporarilyAembassyBssexAwellingtonAconnectsAreformedAbengalArecalledAinchesAdoctrineBeemedAlegendaryAreconstructionAstatementsApalestinianAmeterAachievementsAridersAinterchangeAspotsAautoBccurateAchorusAdissolvedAmissionaryAthaiAoperatorsAe.g.AgenerationsAfailingAdelayedAcorkAnashvilleAperceivedAvenezuelaAcultAemergingAtombAabolishedAdocumentedAgainingAcanyonAepiscopalAstoredAassistsAcompiledAkeralaBilometersAmosqueAgrammyAtheoremAunionsAsegmentsAglacierAarrivesAtheatricalAcirculationBonferencesBhaptersAdisplaysAcircularAauthoredAconductorAfewerAdimensionalAnationwideAligaAyugoslaviaApeerAvietnameseAfellowshipAarmiesAregardlessClatingAdynamicApoliticiansAmixtureAserieBomersetAimprisonedApostsAbeliefsCtaAlayoutAindependentlyAelectronicsAprovisionsAfastestAlogicAheadquarteredAcreatesBhallengedAappealsAplainsBrotocolAgraphicAaccommodateAiraqiAmidfielderAspanAcommentaryAfreestyleAreflectedApalestineAlightingAburialAvirtuallyAbackingApragueAtribalAheirAidentificationAprototypeAcriteriaAdameAarchAtissueAfootageAextendingAproceduresCedominantlyAupdatedArhythmApreliminaryAcafeAdisorderApreventedAsuburbsAdiscontinuedAretiringAoralAfollowersAextendsAmassacreAjournalistsAconquestAlarvaeApronouncedAbehaviourAdiversityAsustainedAaddressedAgeographicArestrictionsAvoicedAmilwaukeeAdialectAquotedAgridAnationallyBearestArosterAtwentiethAseparationAindiesAmanagesAcitingAinterventionAguidanceAseverelyAmigrationAartworkAfocusingArivalsAtrusteesAvariedAenabledAcommitteesBenteredAskatingBlaveryAcardinalsAforcingAtasksAaucklandAyoutubeAarguesAcoloredAadvisorAmumbaiArequiringAtheologicalAregistrationCfugeesAnineteenthAsurvivorsArunnersAcolleaguesApriestsAcontributeAvariantsAworkshopAconcentratedBreatorAlecturesAtemplesAexplorationArequirementAinteractiveAnavigationAcompanionAperthAallegedlyAreleasingAcitizenshipAobservationAstationedAph.d.AbreedAdiscoversAencourageAkilometresAjournalsAperformersAisleAsaskatchewanAhybridBotelsAlancashireAdubbedAairfieldBnchorAsuburbanAtheoreticalAsussexAanglicanAstockholmApermanentlyAupcomingAprivatelyAreceiverAopticalAhighwaysAcongoCloursAaggregateButhorizedArepeatedlyAvariesAfluidAinnovativeAtransformedApraiseAconvoyAdemandedBiscographyAattractionAexportAaudiencesAordainedAenlistedAoccasionalAwestminsterAsyrianAheavyweightAbosniaAconsultantAeventualAimprovingAairesAwicketsAepicAreactionsAscandalAi.e.AdiscriminationAbuenosApatronAinvestorsAconjunctionAtestamentAconstructAencounteredAcelebrityAexpandingAgeorgianAbrandsAretainAunderwentAalgorithmAfoodsAprovisionAorbitAtransformationAassociatesAtacticalAcompactAvarietiesAstabilityArefugeAgatheringAmoreoverBanilaAconfigurationAgameplayAdisciplineAentityAcomprisingEosersAskillAmonitoringAruinsAmuseumsAsustainableAaerialBlteredAcodesAvoyageAfriedrichAconflictsAstorylineAtravellingAconductingAmeritAindicatingAreferendumAcurrencyAencounterAparticlesAautomobileAworkshopsAacclaimedAinhabitedAdoctorateAcubanAphenomenonAdomeAenrollmentAtobaccoAgovernanceAtrendAequallyAmanufactureAhydrogenAgrandeAcompensationAdownloadApianistAgrainAshiftedAneutralAevaluationAdefineAcyclingAseizedAarrayArelativesAmotorsAfirmsAvaryingAautomaticallyArestoreAnicknamedAfindingsAgovernedAinvestigateAmanitobaAadministratorAvitalAintegralCdonesianAconfusionApublishersAenableAgeographicalAinlandAnamingAciviliansAreconnaissanceAindianapolisAlecturerAdeerAtouristsAexteriorArhodeAbassistAsymbolsBcopeAammunitionAyuanApoetsBunjabAnursingAcentAdevelopersAestimatesApresbyterianAnasaAholdingsAgenerateArenewedAcomputingByprusAarabiaAdurationAcompoundsAgastropodApermitAvalidAtouchdownsAfacadeAinteractionsAmineralApracticedAallegationsAconsequenceAgoalkeeperAbaronetAcopyrightAuprisingAcarvedAtargetedAcompetitorsAmentionsAsanctuaryAfeesApursuedAtampaAchronicleBapabilitiesAspecifiedFmensAtollAaccountingAlimestoneAstagedAupgradedAphilosophicalAstreamsAguildArevoltBainfallAsupporterAprincetonAterrainAhometownAprobabilityAassembledApauloAsurreyAvoltageAdeveloperCstroyerAfloorsAlineupAcurveApreventionBotentiallyAonwardsAtripsAimposedAhostingAstrikingEctAadmissionBpartmentsAsolelyAutilityAproceededAobservationsAeuroAincidentsAvinylAprofessionAexpelledArivalryBunwayAtorpedoAzonesAshrineAdimensionsAinvestigationsAlithuaniaAidahoApursuitAcopenhagenCnsiderablyAlocalityAwirelessAdecreaseAgenesAthermalAdepositsAhindiBabitatsAwithdrawnAbiblicalAmonumentsAcastingAplateauAthesisAmanagersAfloodingAassassinationBcknowledgedAinterimCscriptionAguidedApastorAfinaleAinsectsAtransportedAactivistsAmarshalAintensityAairingAcardiffAproposalsAlifestyleApreyAheraldAcapitolAaboriginalAmeasuringAlastingAinterpretedAoccurringAdesiredBrawingsAhealthcareApanelsAeliminationAosloAghanaAblogAsabhaAintentAsuperintendentAgovernorsAbankruptcyAp.m.AequityAdiskAlayersAsloveniaAprussiaAquartetAmechanicsAgraduatesApoliticallyAmonksAscreenplayAnatoAabsorbedAtoppedApetitionAboldAmoroccoAexhibitsAcanterburyApublishArankingsAcraterAdominicanAenhancedAplanesAlutheranAgovernmentalAjoinsAcollectingAbrusselsAunifiedAstreakDategiesAflagshipAsurfacesAovalAarchiveAetymologyAimprisonmentBnstructorAnotingAremixAopposingArotationAwidthAtransAmakerAsynthesisAexcessAtacticsAsnailAltd.BighthouseAsequencesAcornwallAplantationAmythologyAperformsAfoundationsApopulatedAhorizontalAspeedwayAactivatedAperformerAdivingAconceivedAedmontonAsubtropicalAenvironmentsApromptedAsemifinalsAcapsAbulkAtreasuryArecreationalAtelegraphAcontinentAportraitsArelegationAcatholicsAgraphAvelocityArulersAendangeredAsecularAobserverAlearnsAinquiryBdolAdictionaryAcertificationAestimateAclusterAarmeniaAobservatoryArevivedAnaduAconsumersAhypothesisAmanuscriptsAcontentsAargumentsAeditingAtrailsAarcticAessaysAbelfastAacquireApromotionalAundertakenAcorridorAproceedingsAantarcticAmillenniumAlabelsAdelegatesAvegetationAacclaimAdirectingAsubstanceAoutcomeAdiplomaAphilosopherAmaltaAalbanianAvicinityAdegcAlegendsAregimentsAconsentAscatteredApresidentsAgravityAorientationAdeploymentBuchyArefusesAestoniaAcrownedAseparatelyArenovationBisesAwildernessAobjectivesAagreementsAempressAslopesAinclusionAequalityAdecreeAballotAcriticisedArochesterBecurringAstruggledAdisabledAhenriApolesBrussianAconvertAbacteriaApoorlyAsudanAgeologicalAwyomingAconsistentlyAminimalAwithdrawalAinterviewedAproximityArepairsAinitiativesApakistaniArepublicansApropagandaAviiiAabstractAcommerciallyAavailabilityAmechanismsAnaplesAdiscussionsAunderlyingAlensAproclaimedAadvisedAspellingAauxiliaryBttractAlithuanianAeditorsAo'brienAaccordanceAmeasurementAnovelistAussrAformatsAcouncilsCntestantsAindieAfacebookAparishesAbarrierCttalionsAsponsorAconsultingAterrorismAimplementAugandaAcrucialAunclearAnotionAdistinguishAcollectorAattractionsAfilipinoAecologyAinvestmentsAcapabilityArenovatedAicelandAalbaniaBccreditedAscoutsAarmorAsculptorAcognitiveAerrorsAgamingAcondemnedAsuccessiveAconsolidatedAbaroqueAentriesAregulatoryCservedAtreasurerAvariablesAaroseAtechnologicalAroundedAproviderArhineAagreesBccuracyAgeneraAdecreasedAfrankfurtAecuadorBdgesAparticleArenderedAcalculatedCreersAfactionAriflesAamericasAgaelicAportsmouthAresidesAmerchantsAfiscalApremisesAcoinAdrawsApresenterAacceptanceAceremoniesApollutionAconsensusAmembraneAbrigadierAnonethelessAgenresAsupervisionApredictedAmagnitudeAfiniteAdifferAancestryAvaleAdelegationAremovingAproceedsBlacementAemigratedAsiblingsAmoleculesApaymentsAconsidersAdemonstrationAproportionAnewerAvalveAachievingAconfederationDtinuouslyAluxuryAnotreAintroducingAcoordinatesBharitableAsquadronsAdisordersAgeometryAwinnipegAulsterAloansCngtimeAreceptorAprecedingAbelgradeAmandateAwrestlerAneighbourhoodAfactoriesAbuddhismAimportedAsectorsAprotagonistAsteepAelaborateAprohibitedAartifactsAprizesBupilAcooperativeAsovereignBubspeciesAcarriersAallmusicAnationalsAsettingsAautobiographyAneighborhoodsAanalogAfacilitateAvoluntaryAjointlyAnewfoundlandAorganizingAraidsAexercisesAnobelAmachineryAbalticAcropAgraniteAdenseAwebsitesAmandatoryAseeksBurrenderedAanthologyAcomedianAslotBynopsisAcriticallyAarcadeAmarkingAequationsAhallsAindoCauguratedAembarkedAspeedsAclauseAinventionApremiershipAlikewiseApresentingAdemonstrateCsignersAorganizeAexaminedAkm/hAbavariaAtroopArefereeAdetectionAzurichAprairieArapperAwingspanAeurovisionAluxembourgAslovakiaAinceptionAdisputedAmammalsAentrepreneurAmakersAevangelicalAyieldAclergyAtrademarkAdefunctAallocatedAdepictingAvolcanicAbattedAconqueredAsculpturesAprovidersAreflectsAarmouredAlocalsAwaltAherzegovinaAcontractedAentitiesAsponsorshipAprominenceAflowingAethiopiaAmarketedAcorporationsAwithdrawAcarnegieAinducedCvestigatedAportfolioAfloweringAopinionsAviewingAclassroomAdonationsAboundedAperceptionAleicesterAfruitsAcharlestonAacademicsAstatuteAcomplaintsAsmallestAdeceasedApetroleumAresolvedAcommandersAalgebraAsouthamptonAmodesAcultivationAtransmitterAspelledAobtainingAsizesAacreApageantAbatsAabbreviatedAcorrespondenceAbarracksAfeastAtacklesArajaAderivesAgeologyAdisputesAtranslationsAcountedCnstantinopleAseatingAmacedoniaApreventingAaccommodationAhomelandAexploredAinvadedAprovisionalAtransformAsphereAunsuccessfullyAmissionariesAconservativesAhighlightsAtracesAorganismsBpenlyAdancersAfossilsAabsentAmonarchyAcombiningAlanesAstintAdynamicsAchainsAmissilesAscreeningAmoduleAtribuneAgeneratingAminersAnottinghamAseoulAunofficialAowingAlinkingArehabilitationAcitationAlouisvilleAmolluskAdepictsBifferentialAzimbabweAkosovoArecommendationsCsponsesApotteryAscorerAaidedAexceptionsAdialectsAtelecommunicationsAdefinesAelderlyAlunarAcoupledAflownA25thAespnAformula_1AborderedAfragmentsAguidelinesBymnasiumAvaluedAcomplexityApapalBresumablyAmaternalAchallengingAreunitedAadvancingAcomprisedAuncertainAfavorableAtwelfthAcorrespondentAnobilityAlivestockAexpresswayAchileanAtideAresearcherAemissionsAprofitsAlengthsAaccompanyingAwitnessedAitunesAdrainageAslopeAreinforcedAfeministAsanskritAdevelopsAphysiciansAoutletsAisbnAcoordinatorAaveragedAtermedAoccupyAdiagnosedAyearlyAhumanitarianAprospectAspacecraftBtemsAenactedAlinuxAancestorsAkarnatakaAconstituteAimmigrantAthrillerAecclesiasticalAgeneralsAcelebrationsAenhanceAheatingAadvocatedAevidentAadvancesAbombardmentAwatershedAshuttleAwicketAtwitterAaddsAbrandedAteachesAschemesApensionAadvocacyAconservatoryBairoAvarsityAfreshwaterAprovidenceAseeminglyBhellsAcuisineAspeciallyApeaksAintensiveApublishesAtrilogyAskilledAnacionalAunemploymentAdestinationsAparametersAversesAtraffickingAdeterminationAinfiniteAsavingsAalignmentAlinguisticAcountrysideAdissolutionAmeasurementsAadvantagesAlicenceAsubfamilyAhighlandsAmodestAregentAalgeriaAcrestAteachingsAknockoutAbreweryAcombineCnventionsAdescendedAchassisAprimitiveAfijiAexplicitlyAcumberlandAuruguayAlaboratoriesAbypassAelectAinformalAprecededAholocaustAtackleAminneapolisAquantityAsecuritiesAconsoleAdoctoralAreligionsAcommissionersAexpertiseAunveiledApreciseAdiplomatAstandingsAinfantAdisciplinesAsicilyAendorsedAsystematicAchartedAarmoredAmildAlateralAtownshipsAhurlingAprolificAinvestedAwartimeAcompatibleAgalleriesAmoistAbattlefieldAdecorationAconventAtubesBerrestrialAnomineeArequestsAdelegateAleasedAdubaiApolarAapplyingBddressesAmunsterAsingsAcommercialsAteamedAdancesAeleventhAmidlandAcedarAfleeAsandstoneBnailsAinspectionAdivideAassetAthemedAcomparableAparamountAdairyAarchaeologyAintactCstitutesArectangularAinstancesAphasesAreflectingAsubstantiallyAappliesAvacantAlackedAcopaClouredAencountersAsponsorsAencodedApossessArevenuesAuclaAchairedAenablingAplaywrightAstokeBociologyAtibetanAframesAmottoAfinancingAillustrationsAgibraltarAchateauAboliviaAtransmittedAenclosedApersuadedAurgedAfoldedAsuffolkAregulatedAbros.AsubmarinesAmythAorientalAmalaysianAeffectivenessAnarrowlyAacuteAsunkArepliedAutilizedAtasmaniaAconsortiumAquantitiesAgainsAparkwayAenlargedAsidedAemployersAadequateBccordinglyBssumptionAballadAmascotAdistancesApeakingAsaxonyAprojectedAaffiliationAlimitationsAmetalsAguatemalaAscotsAtheatersAkindergartenAverbAemployerAdiffersCschargeAcontrollerAseasonalAmarchingAguruAcampusesAavoidedAvaticanAmaoriAexcessiveAcharteredAmodificationsAcavesAmonetaryAsacramentoAmixingAinstitutionalAcelebritiesAirrigationAshapesAbroadcasterAanthemBttributesAdemolitionAoffshoreAspecificationBurveysAyugoslavAcontributorAauditoriumAlebaneseAcapturingAairportsAclassroomsBhennaiApathsAtendencyAdeterminingAlackingAupgradeAsailorsAdetectedAkingdomsAsovereigntyAfreelyAdecorativeAmomentumAscholarlyAgeorgesBandhiAspeculationAtransactionsAundertookAinteractAsimilaritiesAcoveAteammateAconstitutedApaintersAtendsAmadagascarApartnershipsAafghanApersonalitiesAattainedAreboundsAmassesAsynagogueAreopenedAasylumAembeddedAimagingAcatalogueAdefendersAtaxonomyAfiberAafterwardBppealedAcommunistsAlisbonAjudaismAadviserAbatsmanAecologicalAcommandsAlgbtAcoolingAaccessedAwardsAshivaAemploysAthirdsAscenicAworcesterAtallestAcontestantAhumanitiesAeconomistAtextileAconstituenciesAmotorwayAtramApercussionAclothAleisureA1880sAbadenAflagsAresembleBiotsAcoinedAsitcomAcompositeAimpliesAdaytimeAtanzaniaApenaltiesAoptionalAcompetitorAexcludedAsteeringAreversedAautonomyAreviewerAbreakthroughAprofessionallyAdamagesApomeranianAdeputiesAvalleysBenturesAhighlightedAelectorateAmappingAshortenedAexecutivesAtertiaryAspecimenAlaunchingAbibliographyAsankApursuingAbinaryAdescendantAmarchedAnativesAideologyAturksAadolfBrchdioceseAtribunalAexceptionalAnigerianApreferenceAfailsAloadingAcomebackAvacuumAfavoredAalterAremnantsAconsecratedAspectatorsAtrendsApatriarchAfeedbackApavedAsentencesAcouncillorAastronomyBdvocatesAbroaderAcommentatorEissionsAidentifyingArevealingAtheatresAincompleteAenablesAconstituentAreformationAtractAhaitiAatmosphericAscreenedAexplosiveAczechoslovakiaAacidsAsymbolicBubdivisionAliberalsAincorporateAchallengerAerieAfilmmakerAlapsAkazakhstanAorganizationalAevolutionaryAchemicalsAdedicationAriversideAfaunaAmothsBaharashtraAannexedAgen.AresemblesAunderwaterAgarneredAtimelineAremakeAsuitedAeducatorAhectaresAautomotiveAfearedAlatviaAfinalistAportableAairwaysAplaqueAdesigningAvillagersAlicensingAflankAstatuesCrugglesAdeutscheAmigratedAcellularAjacksonvilleAwimbledonAdefiningAhighlightApreparatoryBlanetsAcologneAemployAfrequenciesAdetachmentAreadilyAlibyaAresignAhelicoptersAreefAlandmarksAcollaborativeAirregularAretainingAhelsinkiAfolkloreAweakenedAviscountAinterredAprofessorsAmemorableCgaArepertoireBowingAdorsalAalbeitAprogressedAoperativeAcoronationAlinerAteluguAdomainsAphilharmonicAdetectAbengaliAsyntheticAtensionsAatlasAdramaticallyAparalympicsAxboxAshireAkievAlengthyAsuedAnotoriousAseasBcreenwriterAtransfersAaquaticApioneersAunescoAradiusAabundantAtunnelsAsyndicatedAinventorAaccreditationAjaneiroAexeterAceremonialAomahaAcadetApredatorsAresidedAproseAslavicAprecisionAabbotAdeityAengagingAcambodiaAestonianAcomplianceAdemonstrationsAprotestersAreactorAcommodoreAsuccessesAchroniclesAmareAextantAlistingsAmineralsAtonnesAparodyAcultivatedAtradersApioneeringAsupplementBlovakApreparationsAcollisionApartneredAvocationalAatomsAmalayalamAwelcomedAdocumentationAcurvedAfunctioningApresentlyAformationsAincorporatesAnazisAbotanicalAnucleusAethicalAgreeksAmetricAautomatedAwherebyAstanceAeuropeansAduetBisabilityApurchasingAemailAtelescopeAdisplacedAsodiumAcomparativeAprocessorAinningAprecipitationAaestheticAimportAcoordinationAfeudAalternativelyAmobilityAtibetAregainedAsucceedingAhierarchyAapostolicAcatalogAreproductionAinscriptionsAvicarAclustersAposthumouslyAricanAlooselyAadditionsAphotographicAselectiveAderivativeAkeyboardsAguidesAcollectivelyAaffectingAcombinesAoperasAnetworkingAdecisiveAterminatedAcontinuityAfinishesAancestorAconsulAheatedAsimulationAleipzigAincorporatingAgeorgetownAformula_2AcircaAforestryAportrayalAcouncillorsAadvancementAcomplainedAforewingsAconfinedAtransactionAdefinitionsAreducesAtelevisedA1890sArapidsAphenomenaAbelarusAalpsAlandscapesAquarterlyAspecificationsAcommemorateCntinuationAisolationAantennaAdownstreamApatentsAensuingAtendedAsagaAlifelongAcolumnistAlabeledAgymnasticsApapuaAanticipatedAdemiseAencompassesAmadrasAantarcticaAintervalBconAramsAmidlandsAingredientsAprioryAstrengthenArougeAexplicitAgazaAagingAsecuringAanthropologyAlistenersAadaptationsAunderwayAvistaAmalayAfortifiedAlightweightAviolationsAconcertoAfinancedAjesuitAobserversAtrusteeAdescriptionsAnordicAresistantAoptedAacceptsAprohibitionAandhraAinflationAnegroAwhollyAimageryAspurAinstructedAgloucesterAcyclesAmiddlesexAdestroyersAstatewideAevacuatedAhyderabadApeasantsAmiceAshipyardAcoordinateApitchingAcolombianAexploringAnumberingAcompressionCuntessAhiatusAexceedAracedAarchipelagoAtraitsAsoilsAo'connorAvowelAandroidAfactoAangolaBminoAholdersAlogisticsAcircuitsAemergenceAkuwaitApartitionAemeritusAoutcomesAsubmissionApromotesAbarackAnegotiatedAloanedAstrippedA50thAexcavationsAtreatmentsAfierceAparticipantAexportsAdecommissionedAcameoAremarkedCsidencesAfuselageAmoundAundergoAquarryAnodeAmidwestAspecializingAoccupiesAetc.AshowcaseAmoleculeAoffsAmodulesAsalonAexpositionArevisionApeersBositionedAhuntersAcompetesAalgorithmsAresideAzagrebAcalciumAuraniumAsiliconAairsAcounterpartAoutletAcollectorsAsufficientlyAcanberraAinmatesAanatomyAensuringAcurvesAavivAfirearmsAbasqueAvolcanoAthrustAsheikhAextensionsAinstallationsAaluminumAdarkerAsackedAemphasizedAalignedBssertedApseudonymAspanningAdecorationsAeighteenthAorbitalAspatialBubdividedAnotationAdecayAmacedonianAamendedAdecliningAcyclistAfeatAunusuallyAcommuterAbirthplaceAlatitudeAactivationAoverheadA30thAfinalistsAwhitesAencyclopediaAtenorAqatarAsurvivesAcomplementCncentrationsAuncommonAastronomicalAbangaloreApiusAgenomeAmemoirArecruitAmodificationApairedAcontainerAbasilicaAarlingtonAdisplacementAgermanicAmongoliaAproportionalAdebatesAmatchedAcalcuttaArowsAtehranAaerospaceAprevalentAariseAlowlandA24thAspokesmanBupervisedAadvertisementsAclashAtunesArevelationAwanderersAquarterfinalsAfisheriesAsteadilyAmemoirsApastoralArenewableAconfluenceAacquiringAstripsBloganAupstreamAscoutingAanalystApractitionersAturbineAstrengthenedAheavierAprehistoricBluralAexcludingAislesApersecutionAturinArotatingAvillainAhemisphereAunawareAarabsAcorpusAreliedAsingularAunanimousAschoolingApassiveAanglesAdominanceAinstitutedAariaAoutskirtsAbalancedBeginningsAfinanciallyAstructuredAparachuteAviewerAattitudesAsubjectedAescapesAderbyshireAerosionAaddressingAstyledAdeclaringAoriginatingAcoltsAadjustedAstainedAoccurrenceAfortificationsAbaghdadAnitrogenAlocalitiesAyemenAgalwayAdebrisAlodzAvictoriousApharmaceuticalAsubstancesAunnamedAdwellingAatopAdevelopmentalAactivismAvoterArefugeeAforestedArelatesAoverlookingAgenocideAkannadaAinsufficientAoversawApartisanAdioxideArecipientsAfactionsAmortalityAcappedAexpeditionsAreceptorsCorganizedAprominentlyAatomAfloodedCuteAorchestralAscriptsAmathematicianAairplayAdetachedArebuildingAdwarfAbrotherhoodAsalvationAexpressionsAarabianAcameroonApoeticArecruitingAbundesligaAinsertedAscrappedAdisabilitiesAevacuationApashaAundefeatedAcraftsAritualsAaluminiumAnormApoolsAsubmergedAoccupyingApathwayAexamsAprosperityAwrestlersApromotionsAbasalApermitsAnationalismAtrimAmergeAgazetteAtributariesCanscriptionAcasteAportoAemergeAmodeledAadjoiningAcounterpartsAparaguayAredevelopmentCnewalAunreleasedAequilibriumAsimilarityAminoritiesAsovietsAcompriseAnodesAtaskedAunrelatedAexpiredAjohanAprecursorAexaminationsBlectronsAsocialismAexiledAadmiraltyAfloodsAwiganAnonprofitAlacksAbrigadesAscreensArepairedAhanoverAfascistAlabsAosakaAdelaysAjudgedAstatutoryAcoltD.AoffspringAsolvingAbredAassistingAretainsAsomaliaAgroupedAcorrespondsAtunisiaAchaplainAeminentAchordA22ndAspansAviralAinnovationsApossessionsAmikhailAkolkataAicelandicBmplicationsBntroducesAracismAworkforceAaltoAcompulsoryAadmitsAcensorshipAonsetAreluctantAinferiorBconicAprogressionAliabilityAturnoutAsatellitesAbehavioralAcoordinatedAexploitationAposteriorAaveragingAfringeAkrakowAmountainousAgreenwichAparaBlantationsAreinforcementsAofferingsAfamedAintervalsAconstraintsAindividuallyAnutritionA1870sAtaxationBhresholdBomatoesAfungiAcontractorAethiopianAapprenticeAdiabetesAwoolAgujaratAhondurasAnorseAbucharestA23rdAarguablyBccompanyAproneAteammatesAperennialAvacancyApolytechnicAdeficitAokinawaAfunctionalityAreminiscentAtoleranceBransferringAmyanmarAconcludesAneighboursAhydraulicAeconomicallyAslowerAplotsAcharitiesAsynodAinvestorAcatholicismAidentifiesAbronxAinterpretationsAadverseAjudiciaryAhereditaryAnominalAsensorBymmetryAcubicAtriangularBenantsAdivisionalAoutreachArepresentationsApassagesAundergoingAcartridgeAtestifiedAexceededAimpactsAlimitingArailroadsAdefeatsAregainCnderingAhumidAretreatedCliabilityAgovernorateAantwerpAinfamousBmpliedApackagingAlahoreAtradesAbilledAextinctionBcoleArejoinedCcognizesAprojectionAqualificationsAstripesAfortsAsociallyAlexingtonAaccuratelyAsexualityAwestwardBikipediaApilgrimageAabolitionAchoralAstuttgartAnestsAexpressingAstrikeoutsAassessedAmonasteriesAreconstructedAhumorousAmarxistAfertileAconsortAurduApatronageBeruvianAdevisedAlyricAbabaAnassauAcommunismAextractionApopularlyAmarkingsAinabilityAlitigationAaccountedAprocessedAemiratesAtempoAcadetsAeponymousAcontestsAbroadlyAoxideAcourtyardAfrigateAdirectoryAapexAoutlineAregencyAchieflyApatrolsAsecretariatAcliffsAresidencyAprivyAarmamentBustraliansAdorsetAgeometricCneticsAscholarshipsAfundraisingBlatsAdemographicAmultimediaAcaptainedAdocumentariesAupdatesAcanvasAblockadeAguerrillaAsongwritingAadministratorsAintakeAdroughtAimplementingAfractionAcannesArefusalAinscribedAmeditationAannouncingAexportedAballotsAformula_3AcuratorAbaselAarchesAflourAsubordinateAconfrontationAgravelAsimplifiedAberkshireApatrioticAtuitionAemployingAserversAcastileApostingAcombinationsAdischargedAminiatureButationsAconstellationAincarnationBdealsAnecessityAgrantingAancestralAcrowdsApioneeredAmormonBethodologyAramaAindirectAcomplexesAbavarianApatronsAuttarAskeletonAbollywoodAflemishAviableAblocBreedsAtriggeredAsustainabilityAtailedAreferencedAcomplyAtakeoverAlatvianAhomesteadAplatoonAcommunalAnationalityAexcavatedAtargetingAsundaysAposedBhysicistAturretAendowmentAmarginalAdispatchedAcommentatorsArenovationsAattachmentAcollaborationsAridgesAbarriersAobligationsAshareholdersAprof.AdefensesApresidedAriteAbackgroundsAarbitraryBffordableAgloucestershireAthirteenthAinletAminiseriesApossessesAdetainedApressuresAsubscriptionArealismAsolidarityAprotoBostgraduateAnounAburmeseAabundanceAhomageAreasoningAanteriorArobustAfencingAshiftingAvowelsAgardeAprofitableAlochAanchoredAcoastlineAsamoaAterminologyAprostitutionAmagistrateAvenezuelanAspeculatedAregulateAfixtureAcolonistsAdigitAinductionAmannedAexpeditionaryAcomputationalBentennialAprincipallyAveinApreservingAengineeredAnumericalAcancellationBonferredDtinuallyAborneAseededAadvertisementAunanimouslyAtreatiesAinfectionsBonsAsensorsAloweredAamphibiousAlavaAfourteenthAbahrainAniagaraCcaraguaAsquaresAcongregationsA26thAperiodicBroprietaryA1860sAcontributorsAsellerAoversAemissionAprocessionCesumedAillustratorAzincAgasesAtensAapplicableAstretchesAreproductiveAsixteenthAapparatusBccomplishmentsAcanoeAguamAopposeArecruitmentAaccumulatedAlimerickAnamibiaAstagingAremixesAordnanceAuncertaintyApedestrianAtemperateBreasonAdepositedAregistryAcerambycidaeAattractingAlankanAreprintedAshipbuildingAhomosexualityAneuronsAeliminatingA1900sAresumeAministriesAbeneficialBlackpoolAsurplusAnorthamptonAlicensesAconstructingAstandardizedAalternativesAtaipeiAinadequateAfailuresAyieldsAmedalistAtitularAobsoleteAtorahAburlingtonApredecessorsAlublinAretailersAcastlesAdepictionAissuingAgubernatorialApropulsionAtilesAdamascusBiscsAalternatingApomeraniaBeasantAtavernAredesignatedA27thAillustrationAfocalAmansAcodexAspecialistsAproductivityAantiquityAcontroversiesApromoterBitsAcompanionsAbehaviorsAlyricalAprestigeAcreativityAswanseaAdramasAapproximateAfeudalAtissuesAcrudeBampaignedAunprecedentedAchancelAamendmentsAsurroundingsAallegianceAexchangesAalignAfirmlyAoptimalAcommentingAreigningAlandingsAobscureA1850sAcontemporariesApaternalAenduranceAcommunesAincorporationAdenominationsAexchangedAroutingBesortsAamnestyAslenderAexploresAsuppressionAheatsApronunciationAcentredBoupeAstirlingAfreelanceAtreatiseAlinguisticsBaosAinformsAdiscoveringApillarsAencouragesAhaltedArobotsAdefinitiveAmaturityAtuberculosisAvenetianAsilesianAunchangedAoriginatesAmaliAlincolnshireAquotesAseniorsApremiseAcontingentAdistributeBanubeAgorgeAloggingAdamsAcurlingAseventeenthBpecializesAwetlandsAdeitiesAassessAthicknessArigidAculminatedAutilitiesAsubstrateAinsigniaAnileAassamAshriAcurrentsAsuffrageAcanadiansAmortarAasteroidAbosnianAdiscoveriesAenzymesAsanctionedAreplicaAhymnAinvestigatorsAtidalAdominateBerivativesAconvertingAleinsterAverbsAhonouredAcriticismsAdismissalDcreteAmasculineAreorganizationAunlimitedAwurttembergAsacksAallocationAbahnAjurisdictionsAparticipatesAlagoonAfamineAcommunionBulminatingAsurveyedBhortageAcablesAintersectsAcassetteAforemostAadoptingAsolicitorAoutrightAbiharAreissuedAfarmlandAdissertationAturnpikeAbatonAphotographedAchristchurchAkyotoAfinancesArailsAhistoriesAlinebackerAkilkennyAacceleratedAdispersedAhandicapAabsorptionAranchoAceramicBaptivityBitesAfontAweighedAmaterAutilizeAbraveryAextractAvalidityAslovenianBeminarsAdiscourseArangedAduelAironicallyAwarshipsAsegaAtemporalAsurpassedAprolongedArecruitsAnorthumberlandAgreenlandAcontributesApatentedAeligibilityAunificationAdiscussesAtranslatesAbeirutAreliesAtorqueAnorthwardAreviewersAmonasticAaccessionAneuralAtramwayAheirsAsikhBubscribersAamenitiesAtalibanAauditArotterdamAwagonsAkurdishAfavouredAcombustionAmeaningsApersiaAbrowserAdiagnosticAnigerAformula_4AdenominationBividingAparameterAbrandingBadmintonAleningradAsparkedAhurricanesAbeetlesApropellerAmozambiqueArefinedAdiagramAexhaustAvacatedAreadingsAmarkersAreconciliationAdeterminesAconcurrentAimprintAprimeraAorganismAdemonstratingAfilmmakersAvanderbiltAaffiliatesAtractionAevaluatedAdefendantsAmegachileAinvestigativeAzambiaAassassinatedArewardedAprobableAstaffordshireAforeignersAdirectorateAnomineesAconsolidationCmmandantAreddishAdifferingAunrestAdrillingAbohemiaAresemblingAinstrumentationAconsiderationsAhauteApromptlyAvariouslyAdwellingsAclansAtabletAenforcedAcockpitAsemifinalAhusseinAprisonsAceylonAemblemAmonumentalAphrasesAcorrespondBrossoverAoutlinedAcharacterisedAaccelerationAcaucusBrusadeAprotestedAcomposingArajasthanAhabsburgArhythmicAinterceptionCherentAcooledApondsAspokespersonAgradualAconsultationAkualaAgloballyAsuppressedAbuildersAavengersAsuffixAintegerAenforceAfibersAunionistAproclamationAuncoveredAinfraredAadaptAeisenhowerAutilizingAcaptainsAstretchedAobservingAassumesApreventsAanalysesAsaxophoneAcaucasusAnoticesAvillainsAdartmouthAmongolAhostilitiesAstretchingAveterinaryAlensesAtextureApromptingAoverthrowAexcavationAislandersAmasovianAbattleshipBiographerAreplayAdegradationCpartingAluftwaffeAfleeingAoversightAimmigratedAserbsAfishermenAstrengtheningArespiratoryAitaliansAdenotesAradialAescortedAmotifAwiltshireAexpressesAaccessoriesArevertedAestablishmentsAinequalityAprotocolsAchartingAfamouslyAsatiricalAentiretyAtrenchAfrictionAatleticoAsamplingBubsetAweekdayAupheldAsharplyAcorrelationAincorrectAmughalAtravelersAhasanAearningsAoffsetAevaluateAspecialisedArecognizingAflexibilityAnagarApostseasonAalgebraicAcapitalismBrystalsAmelodiesApolynomialAracecourseAdefencesAaustroAwembleyAattractsBnarchistAresurrectionCviewingAdecreasingAprefixAratifiedAmutationAdisplayingAseparatingArestoringAassembliesAordinanceApriesthoodAcruisersAappointAmoldovaAimportsAdirectiveAepidemicAmilitantAsenegalBignalingArestrictionAcritiqueAretrospectiveAnationalistsAundertakeAcanalsAalgerianAredesignedAphilanthropistAdepictAconceptualAturbinesAintellectualsAeastwardAapplicantsAcontractorsAvendorsAundergoneAnamesakeAensuredAtonesAsubstitutedAhindwingsAarrestsAtombsBransitionalAprincipalityAreelectionAtaiwaneseAcavityAmanifestoAbroadcastersAspawnedAthoroughbredAidentitiesAgeneratorsAproposesAhydroelectricAjohannesburgAcortexAscandinavianAkillingsAaggressionAboycottAcatalystAphysiologyAfifteenthAwaterfrontAchromosomeAorganistAcostlyBalculationBemeteriesAflourishedAjuniorsAmergingAdisciplesAashoreAworkplaceAenlightenmentAdiminishedBebatedAhailedApodiumAeducateAmandatedAdistributorAlitreAelectromagneticAflotillaAestuaryApeterboroughAstaircaseBelectionsAmelodicAconfrontsAwholesaleAintegrateErceptedAcataloniaAuniteAimmenseApalatinateAswitchesAearthquakesAoccupationalAsuccessorsApraisingAconcludingAfacultiesBirstlyAoverhaulAempiricalAmetacriticAinaugurationAevergreenAladenAwingedAphilosophersAamalgamatedAgeoffAcentimetersAnapoleonicAuprightAplantingAbrewingAfinedAsensoryAmigrantsAwhereinAinactiveAheadmasterAwarwickshireAsiberiaAterminalsAdenouncedAacademiaAdivinityAbilateralAcliveAomittedApeerageArelicsAapartheidAsyndicateAfearingBixturesAdesirableBismantledAethnicityAvalvesAbiodiversityAaquariumAideologicalAvisibilityAcreatorsAanalyzedAtenantAbalkanApostwarAsupplierBmithsonianArisenAmorphologyAdigitsAbohemianAwilmingtonAvishnuAdemonstratesAaforementionedAbiographicalAmappedAkhorasanAphosphateBresentationsAecosystemAprocessorsAcalculationsAmosaicAclashesApennedArecallsAcodingAangularAlatticeAmacauAaccountabilityAextractedApollenAtherapeuticAoverlapAviolinistAdeposedAcandidacyAinfantsAcovenantAbacterialArestructuringAdungeonsAordinationAconductsAbuildsAinvasiveAcustomaryBoncurrentlyArelocationAcelloAstatutesAborneoAentrepreneursAsanctionsApacketArockefellerApiedmontAcomparisonsAwaterfallAreceptionsAglacialAsurgeBignaturesAalterationsBdvertisedAenduringAsomaliAbotanistA100thAcanonicalAmotifsAlongitudeAcirculatedAalloyAindirectlyAmarginsApreservesAinternallyAbesiegedAshaleAperipheralAdrainedAbasemanAreassignedAtobagoAsoloistCcioAgrazingAcontextsAroofsAportrayingAottomansAshrewsburyAnoteworthyAlampsAsupplyingAbeamsAqualifierAportrayAgreenhouseAstrongholdAhitterAritesAcretaceousAurgingAderiveAnauticalAaimingAfortunesAverdeAdonorsArelianceAexceedingDlusionCercisedAsimultaneousAcontinentsAguidingApillarAgradientApoznanAeruptionAclinicsAmoroccanAindicatorAtramsApiersBarallelsAfragmentAteatroApotassiumAsatireAcompressedAbusinessmenAinfluxAseineAperspectivesAsheltersAdecreasesAmountingAformula_5AconfederacyAequestrianBxpulsionAmayorsAliberiaAresistedAaffinityAshrubAunexpectedlyAstimulusAamtrakAdeportedAperpendicularAstatesmanAwharfAstorylinesAromanesqueAweightsAsurfacedAinterceptionsAdhakaAcrambidaeAorchestrasArwandaAconcludeDstitutesAsubsidiariesAadmissionsAprospectiveAshearAbilingualAcampaigningApresidingAdominationAcommemorativeAtrailingAconfiscatedApetrolAacquisitionsApolymerAonlyincludeAchlorideAelevationsAresolutionsAhurdlesApledgedAlikelihoodAobjectedAerectBncodingAdatabasesAaristotleAhindusAmarshesAbowledAministerialAgrangeAacronymBnnexationAsquadsAambientApilgrimsAbotanyAsoflaAastronomerAplanetaryAdescendingAbestowedAceramicsAdiplomacyAmetabolismAcolonizationApotomacAafricansAengravedArecyclingAcommitmentsAresonanceAdisciplinaryAjamaicanAnarratedAspectralAtipperaryAwaterfordAstationaryAarbitrationAtransparencyBhreatensAcrossroadsAslalomAoverseeAcentenaryAincidenceAeconomiesAliveryAmoistureAnewsletterAautobiographicalAbhutanApropelledAdependenceAmoderatelyAadobeAbarrelsAsubdivisionsAoutlookAlabelledAstratfordAarisingAdiasporaAbaronyAautomobilesAornamentalAslatedAnormsAprimetimeAgeneralizedAanalystsAvectorsAlibyanAyieldedAcertificatesArootedAvernacularAbelarusianAmarketplaceApredictionAfairfaxAmalawiAvirusesAwoodedAdemosAmauritiusAprosperousAcoincidedAlibertiesAhuddersfieldAascentAwarningsAhinduismAglucoseApulitzerAunusedAfiltersAillegitimateAacquittedAprotestantsAcanopyAstapleApsychedelicAwindingAabbasApathwaysAcheltenhamAlagosAnicheAinvadersAproponentsAbarredAconverselyAdoncasterArecessionAembracedArematchAconcessionAemigrationAupgradesAbowlsAtabletsAremixedAloopsAkensingtonAshootoutAmonarchsAorganizersAharmfulApunjabiAbroadbandAexemptAneolithicAprofilesBortraysBarmaAcyrillicAquasiAattestedAregimentalCviveAtorpedoesAheidelbergArhythmsAsphericalAdenoteAhymnsAiconsAtheologianAqaedaAexceptionallyAreinstatedAcomuneAplayhouseAlobbyingAgrossingAviceroyAdeliversAvisuallyAarmisticeAutrechtAsyllableAverticesAanalogousCnexArefurbishedAentrantsAknightedAdiscipleArhetoricAdetailingAinactivatedAballadsAalgaeAintensifiedAfavourableAsanitationAreceiversApornographyAcommemoratedBannonsAentrustedAmanifoldAphotographersBuebloAtextilesAsteamerAmythsBarquessAonwardAliturgicalAromneyAuzbekistanAconsistencyAdenotedAhertfordshireAconvexAhearingsAsulfurAuniversidadApodcastAselectingAemperorsAarisesAjusticesA1840sAmongolianAexploitedAterminationAdigitallyAinfectiousAsedanBymmetricApenalAillustrateAformulationAattributeAproblematicAmodularAinverseAberthAsearchesArutgersAleicestershireAenthusiastsAlockheedAupwardsAtransverseAaccoladesAbackwardAarchaeologistsAcrusadersAnurembergAdefectsAferriesAvogueAcontainersAopeningsAtransportingAseparatesAlumpurApurchasesAattainAwichitaAtopologyAwoodlandsAdeletedAperiodicallyAsyntaxAoverturnedAmusicalsAcorp.AstrasbourgAinstabilityAnationaleAprevailingAcacheAmarathiAversaillesAunmarriedAgrainsAstraitsAantagonistAsegregationAassistantsAd'etatAcontentionAdictatorshipAunpopularAmotorcyclesAcriterionAanalyticalAsalzburgAmilitantsAworcestershireAemphasizeAparalympicAeruptedAconvincesAoffencesBxidationAnounsApopulaceAatariAspannedAhazardousAeducatorsAplayableAbirthsBaha'iApreseasonAgeneratesAinvitesAmeteorologicalAhandbookAfoothillsAenclosureAdiffusionAmirzaAconvergenceAgeelongAcoefficientCnnectorAformula_6AcylindricalAdisastersApleadedAknoxvilleAcontaminationCmposeAlibertarianAarrondissementAfranciscanAintercontinentalAsusceptibleAinitiationAmalariaAunbeatenAconsonantsAwaivedAsaloonApopularizedAestadioApseudoAinterdisciplinaryAtransportsFformersAcarriagesAbombingsArevolvesAcededBollaboratorBelestialAexemptionAcolchesterAmalteseAoceanicAligueAcreteAshareholderAroutedAdepictionsAriddenAadvisorsAcalculateAlendingAguangzhouAsimplicityAnewscastAschedulingBnoutAeliotAundertakingAarmeniansAnottinghamshireAwhitishAconsultedAdeficiencyAsalleAcinemasAsupersededArigorousAkermanAconvenedAlandownersAmodernizationAeveningsApitchesAconditionalAscandinaviaAdifferedAformulatedAcyclistsAswamiAguyanaAdunesAelectrifiedAappalachianBbdomenAscenariosAprototypesAsindhAconsonantAadaptiveAboroughsAwolverhamptonAmodellingAcylindersAamountedAminimizeAambassadorsAleninAsettlerAcoincideAapproximationAgroupingAmuralsAbullyingAregistersBumoursAengagementsCergeticAvertexAannalsAborderingAgeologicAyellowishArunoffAconvertsAalleghenyAfacilitatedAsaturdaysAcollieryAmonitoredArainforestAinterfacesAgeographicallyAimpairedAprevalenceAjoachimApaperbackAslowedBhankarAdistinguishingAseminalAcategorizedAauthorisedCspicesAbandwidthAassertsArebrandedAbalkansAsupplementedBeldomAweavingAcapsuleAapostlesApopulousAmonmouthApayloadAsymphonicAdenselyAshorelineAmanagerialCsonryAantiochBveragesAtextbooksAroyalistAcoliseumAtandemAbrewersAdiocesanAposthumousAwalledAincorrectlyAdistributionsAensuedAreasonablyAgraffitiApropagationAautomationAharmonicAaugmentedAmiddleweightAlimbsAelongatedAlandfallAcomparativelyAliteralAgrossedAkoppenAwavelengthA1830sAcerebralAboastsAcongestionAphysiologicalBractitionerAcoastsBartoonistAundisclosedAfrontalAlaunchesAburgundyAqualifiersAimposingAstadeAflankedAassyrianAraidedAmultiplayerBontaneAchesapeakeApathologyAdrainsAvineyardsAintercollegiateAsemiconductorAgrasslandAconveyBitationsApredominantArejectsAbenefitedAyahooAgraphsAbusiestAencompassingAhamletsAexplorersAsuppressAminorsAgraphicalAcalculusAsedimentAintendsAdivertedAmainlineAunopposedAcottagesAinitiateAalumnusAtowedAautismAforumsAdarlingtonAmodernistAoxfordshireAlecturedAcapitalistAsuppliersApanchayatAactressesAfoundryAsouthboundAcommodityAwesleyanAdividesApalestiniansAlutonAcaretakerAnoblemanAmutinyAorganizerApreferencesAnomenclatureAsplitsAunwillingAoffendersAtimorArelyingAhalftimeAsemiticAarithmeticAmilestoneAjesuitsAarctiidaeAretrievedAconsumingDtenderAedgedAplaguedAinclusiveAtransformingAkhmerAfederallyAinsurgentsAdistributingAamherstArenditionAprosecutorsAviaductAdisqualifiedAkabulAliturgyAprevailedAreelectedAinstructorsAswimmersAapertureAchurchyardAinterventionsAtotalsAdartsAmetropolisAfuelsBluentAnorthboundAcorrectionalAinflictedAbarristerArealmsAculturallyAaristocraticAcollaboratingAemphasizesAchoreographerAinputsAensemblesAhumboldtApractisedAendowedAstrainsAinfringementAarchaeologistAcongregationalAmagnaArelativityAefficientlyAproliferationAmixtapeAabruptlyAregenerationAcommissioningAyukonAarchaicAreluctantlyCtailerAnorthamptonshireAuniversallyAcrossingsAboilersAnickelodeonArevueAabbreviationAretaliationAscriptureAroutinelyAmedicinalAbenedictineAkenyanAretentionAdeterioratedAglaciersAapprenticeshipAcouplingAresearchedAtopographyAentrancesAanaheimApivotalAcompensateAarchedAmodifyAreinforceAdusseldorfAjourneysAmotorsportAconcededAsumatraBpaniardsAquantitativeAloireAcinematographyAdiscardedAbotswanaAmoraleAenginedAzionistAphilanthropyAsainteAfatalitiesAcypriotAmotorsportsAindicatorsApricingAinstitutAbethlehemAimplicatedAgravitationalAdifferentiationArotorAthrivingAprecedentAambiguousAconcessionsAforecastAconservedAfremantleAasphaltAlandslideAmiddlesbroughAformula_7AhumidityAoverseeingAchronologicalAdiariesAmultinationalAcrimeanAturnoverAimprovisedAyouthsAdeclaresAtasmanianAcanadiensAfumbleArefineryAweekdaysAunconstitutionalBpwardAguardiansAbrownishAimminentAhamasAendorsementAnaturalistAmartyrsAcaledoniaBhordsAyeshivaAreptilesAseverityAmitsubishiAfairsAinstallmentAsubstitutionArepertoryAkeyboardistAinterpreterAsilesiaAnoticeableArhinelandAtransmitAinconsistentAbookletAacademiesAepithetApertainingBrogressivelyAaquaticsAscrutinyAprefectAtoxicityAruggedAconsumeAo'donnellAevolveAuniquelyAcabaretAmediatedAlandownerAtransgenderApalazzoAcompilationsAalbuquerqueAinduceAsinaiAremasteredAefficacyAundersideAanalogueAspecifyApossessingAadvocatingAcompatibilityAliberatedAgreenvilleAmecklenburgAheaderAmemorialsAsewageArhodesiaA1800sAsalariesAatollAcoordinatingApartisansArepealedAamidstAsubjectiveAoptimizationAnectarAevolvingBxploitsAmadhyaAstylingAaccumulationAraionApostageArespondsAbuccaneersAfrontmanAbruneiAchoreographyBoatedAkineticAsampledAinflammatoryAcomplementaryAeclecticAnorteAvijayAa.k.aAmainzAcasualtyBonnectivityAlaureateAfranchisesAyiddishAreputedAunpublishedAeconomicalAperiodicalsAverticallyAbicyclesBrethrenAcapacitiesAunitaryAarcheologicalAtehsilAdomesdayAwehrmachtAjustificationAangeredAmysoreAfieldedAabusesAnutrientsAambitionsAtalukAbattleshipsAsymbolismBuperiorityAneglectAattendeesAcommentariesCllaboratorsApredictionsAyorkerAbreedersAinvestingAlibrettoAinformallyAcoefficientsAmemorandumApounderAcollingwoodAtightlyAenvisionedAarborAmistakenlyAcapturesAnestingAconflictingAenhancingAstreetcarAmanufacturesAbuckinghamshireArewardsAcommemoratingAstonyAexpenditureAtornadoesAsemanticArelocateAweimarAiberianAsightedAintendingAensignAbeveragesAexpectationAdifferentiateAcentroAutilizesAsaxophonistAcatchmentAtransylvaniaAecosystemsAshortestBedimentsBocialistsAineffectiveAkapoorAformidableAheroineAguantanamoApreparesAscatteringApamphletAverifiedAelectorAbaronsAtotalingAshrubsApyreneesAamalgamationAmutuallyAlongitudinalAcomteAnegativelyAmasonicAenvoyAsexesAakbarAmythicalAtongaAbishopricAassessmentsAmalayaAwarnsAinteriorsAreefsCflectionsAneutralityAmusicallyAnomadicAwaterwaysAprovenceAcollaborateAscaledAadulthoodAemergesAopticsAincentivesAoverlandAperiodicalAliegeAawardingArealizationAslangAaffirmedAschoonerAhokkaidoAczechoslovakAprotectorateAundraftedAdisagreedAcommencementAelectorsAspruceBwindonAfueledAequatorialAinventionsAsuitesBloveneAbackdropAadjunctAenergiesAremnantAinhabitAalliancesAsimulcastAreactorsAmosquesAtravellersAoutfielderAplumageAmigratoryAbeninAexperimentedAfibreAprojectingAdraftingAlaudeAevidencedAnorthernmostAindictedAdirectionalAreplicationAcroydonBomediesAjailedAorganizesAdevoteesAreservoirsAturretsAoriginateAeconomistsAsongwritersAjuntaAtrenchesAmoundsAproportionsAcomedicAapostleBzerbaijaniAfarmhouseAresembledAdisruptedAplaybackAmixesAdiagonalArelevanceAgovernAprogrammerAgdanskAmaizeAsoundtracksAtendenciesAmasteredAimpactedAbelieversAkilometreAinterveneAchairpersonAaerodromeAsailsBubsidiesAensuresAaestheticsAcongressesAratiosAsardiniaBouthernmostAfunctionedAcontrollersAdownwardArandomlyAdistortionAregentsApalatineAdisruptionAspiritualityAvidhanAtractsAcompilerAventilationAanchorageAsymposiumAassertApistolsAexcelledAavenuesAconvoysAmonikerAconstructionsAproponentBhasedAspinesAorganisingAschleswigApolicingAcampeonatoAminedAhourlyAcroixAlucrativeAauthenticityAhaitianAstimulationAburkinaAespionageAmidfieldBanuallyAstaffedAawakeningAmetabolicAbiographiesAentrepreneurshipAconspicuousAguangdongAprefaceAsubgroupAmythologicalAadjutantAfeminismAvilniusAoverseesAhonourableAtripoliAstylizedAkinaseAsocieteAnotorietyAaltitudesAconfigurationsAoutwardAtransmissionsAannouncesBuditorAethanolAclubeAnanjingAmeccaAhaifaAblogsApostmasterBaramilitaryAdepartApositioningCtentArecognizableAspireAbracketsAremembranceAoverlappingAturkicAarticulatedAscientologyAoperaticAdeployAreadinessAbiotechnologyArestrictAcinematographerAinvertedAsynonymousAadministrativelyAwestphaliaAcommoditiesAreplacesAdownloadsAcentralizedAmunitionsApreachedAsichuanAfashionableAimplementationsAmatricesAhiv/aidsAloyalistBuzonAcelebratesAhazardsBeiressAmercenariesAsynonymAcreoleAljubljanaAtechnicianAauditionedAtechniciansAviewpointAwetlandAmongolsAprincelyAsharifAcoatingAdynastiesAsouthwardAdoublingAformula_8AmayoralAharvestingAconjectureAgoaltenderAoceaniaAspokaneAwelterweightAbracketAgatheringsAweightedAnewscastsAmussoliniAaffiliationsAdisadvantageAvibrantAspheresBultanateAdistributorsDlikedAestablishesAmarchesAdrasticallyAyieldingAjewelleryAyokohamaAvascularAairliftAcanonsAsubcommitteeArepressionAstrengthsAgradedAoutspokenAfusedApembrokeAfilmographyAredundantAfatigueArepealAthreadsAreissueApennantAedibleAvaporAcorrectionsAstimuliAcommemorationAdictatorAanandAsecessionAamassedAorchardsApontificalAexperimentationAgreetedAbangorAforwardsAdecompositionAquranAtrolleyAchesterfieldAtraverseAsermonsAburialsAskierAclimbsBonsultantsApetitionedAreproduceApartedAilluminatedAkurdistanAreignedAoccupantsApackagedAgeometridaeAwovenAregulatingAprotagonistsAcraftedAaffluentAclergymanBonsolesAmigrantAsupremacyAattackersAcaliphAdefectAconvectionAralliesAhuronAresinAsegundaAquotaAwarshipAoverseenAcriticizingAshrinesAglamorganAloweringAbeauxAhamperedAinvasionsAconductorsCllectsAbluegrassAsurroundsCbstratesAperpetualAchronologyApulmonaryAexecutionsAcrimeaBompilingAnoctuidaeAbattledAtumorsAminskAnovgorodAservicedAyeastAcomputationAswampsAtheodorAbaronetcyAsalfordAuruguayanAshortagesAodishaAsiberianAnoveltyAcinematicAinvitationalAdecksBowagerAoppressionAappellateAstate-of-the-artAcladeApalacesAsignallingAgalaxiesAindustrialistAtensorAincurredAmagistratesAbindsAorbitsAciudadAwillingnessApeninsularAbasinsBiomedicalAshaftsAmarlboroughAbournemouthAwithstandAfitzroyAdunedinAvarianceAsteamshipAintegratingAmuscularAfinesAakronAbulbophyllumAmalmoAdisclosedAcornerstoneArunwaysAmedicinesAtwenty20AgettysburgAprogressesAfrigatesAbodiedAtransformationsJsAhelensAmodelledAversatileAregulatorApursuitsAlegitimacyAamplifierAscripturesAvoyagesAexaminesApresentersAoctagonalApoultryAformula_9AanatoliaAcomputedAmigrateAdirectorialAhybridsAlocalizedApreferringAguggenheimApersistedAgrassrootsAinflammationAfisheryAotagoAvigorousAprofessionsAinstructionalCexpensiveCsurgencyAlegislatorsAsequelsBurnamesAagrarianAstainlessAnairobiAminasAforerunnerAaristocracyAtransitionsAsicilianBhowcasedAdosesAhiroshimaAsummarizedAgearboxAemancipationAlimitationAnucleiAseismicAabandonmentAdominatingAappropriationsAoccupationsAelectrificationAhillyAcontractingAexaggeratedBntertainerAkazanAoriconAcartridgesBharacterizationAparcelAmaharajaAexceedsAaspiringAobituaryAflattenedAcontrastedAnarrationArepliesAobliqueButpostAfrontsAarrangerAtalmudAkeynesAdoctrinesAenduredAconfessesAfortificationAsupervisorsAkilometerAacademieAjammuAbathurstApiracyBrostitutesAnavarreAcumulativeBruisesAlifeboatAtwinnedAradicalsAinteractingAexpendituresAwexfordAlibreAfutsalAcuratedBlockwiseBolloquiallyAprocurementAimmaculateAlyricistAenhancementAporcelainAalzheimerAhighlightingAjudahAdisagreementsAstorytellingBhelteredAwroclawAvaudevilleAcontrastsAneoclassicalAcomparesCntrastingAdeciduousAfrancaiseAdescriptiveAcyclicAreactiveAantiquitiesAmeijiArepeatsAcreditorsAforciblyAnewmarketApicturesqueAimpendingAunevenAbisonAracewayAsolventAecumenicalAopticAprofessorshipAharvestedAwaterwayAbanjoApharaohAgeologistAscanningAdissentArecycledAunmannedAretreatingAgospelsAaqueductAbranchedAtallinnAgroundbreakingAsyllablesAhangarAdesignationsAproceduralAcratersBabinsAencryptionAanthropologistAmontevideoAoutgoingAinvernessAchattanoogaAfascismAcalaisBhapelsAgroundwaterAdownfallAmisleadingAroboticAtortricidaeApixelAhandelAprohibitAcreweArenamingCprisedAkickoffAleftistAspacedAintegersAcausewayApinesAauthorshipAorganiseAptolemyAaccessibilityAvirtuesAlesionsAiroquoisAqur'anAatheistAsynthesizedAbiennialAconfederatesAdietaryAskatersBtressesAtariffAkoreansAintercityArepublicsAquintetAbaronessAamplitudeAinsistenceAtbilisiAresiduesAgrammaticalAdiversifiedAegyptiansAaccompanimentAvibrationArepositoryAmandalAtopologicalAdistinctionsAcoherentAinvariantAbattersAnuevoAinternationalsBmplementsAfollowerAbahiaAwidenedAindependentsAcantoneseAtotaledAguadalajaraAwolverinesAbefriendedAmuzzleAsurveyingAhungariansAmediciAdeportationArayonAapproxArecountsAattendsAclericalAhellenicAfurnishedAallegingAsolubleBystemicAgallantryAbolshevikAintervenedAhostelAgunpowderAspecialisingBtimulateAleidenAremovesAthematicAfloralAbaftaAprintersAconglomerateAerodedAanalyticAsuccessivelyAlehighAthessalonikiAkildaAclausesAascendedAnehruAscriptedAtokugawaAcompetenceAdiplomatsAexcludeAconsecrationAfreedomsAassaultsArevisionsAblacksmithAtextualAsparseAconcacafAslainAuploadedAenragedAwhalingAguiseAstadiumsAdebutingBormitoryAcardiovascularAyunnanAdiocesesAconsultancyAnotionsAarchdeaconAcollidedAmedialAairfieldsAgarmentAwrestledAadriaticAreversalCfuelingAverificationAjakobAhorseshoeAintricateAveracruzAsarawakByndicationDthesizerAanthologiesAstatureAfeasibilityAguillaumeAnarrativesApublicizedAantrimAintermittentAconstituentsAgrimsbyAfilmmakingAdopingAunlawfulAnominallyAtransmittingAdocumentingAseaterAinternationaleAejectedAsteamboatAalsaceAboiseAineligibleAgearedAvassalAmusteredAvilleAinlineApairingAeurasianAkyrgyzstanAbarnsleyArepriseAstereotypesArushesAconformAfirefightersAdeportivoArevolutionariesBabbisAconcurrencyBhartersAsustainingAaspirationsBlgiersAchichesterAfalklandAmorphologicalAsystematicallyAvolcanoesAdesignateAartworksAreclaimedAjuristAangliaAresurrectedAchaoticAfeasibleAcirculatingAsimulatedAenvironmentallyAconfinementAadventistAharrisburgAlaborersAostensiblyAuniversiadeApensionsAinfluenzaAbratislavaAoctaveArefurbishmentAgothenburgAputinAbarangayAannapolisAbreaststrokeAillustratesAchoreographedApromoAemphasizingAstakeholdersAdescendsAexhibitingAintrinsicCvertebratesAevenlyAroundaboutAsaltsAformula_10AstrataAinhibitionAbranchingAstylisticArumoredBealisesAmitochondrialAcommutedAadherentsAlogosAbloombergAtelenovelaAguineasAcharcoalAengagesAwineryAreflectiveAsienaAcambridgeshireAventralAflashbackAinstallingAengravingAgrassesAtravellerArotatedAproprietorAnationalitiesAprecedenceAsourcedAtrainersAcambodianAreductionsAdepletedAsaharanAclassificationsAbiochemistryAplaintiffsAarboretumAhumanistAfictitiousAaleppoAclimatesAbazaarAhis/herBomogeneousAmultiplicationBoinesAindexedAlinguistAskeletalAfoliageAsocietalAdifferentiatedAinformingAmammalAinfancyAarchivalAcafesAmallsAgraemeAmuseeAschizophreniaAfargoApronounsAderivationCscendAascendingAterminatingAdeviationArecapturedAconfessionsAweakeningAtajikistanAbahadurApastureAb/hipAdonegalAsupervisingBikhsAthinkersAeuclideanAreinforcementAfriarsAportageAfuscousAlucknowAsynchronizedAassertionAchoirsAprivatizationAcorrosionAmultitudeAskyscraperAroyaltiesAligamentAusableAsporesAdirectsAclashedAstockportAfrontedAdependencyAcontiguousAbiologistBackstrokeApowerhouseAfrescoesAphylogeneticAweldingAkildareAgabonAconveyedAaugsburgAsevernAcontinuumAsahibAlilleAinjuringApasseriformesfamilyAsucceedsAtranslatingAunitarianAstartupAturbulentAoutlyingAphilanthropicAstanislawAidolsAclaremontBonicalAharyanaAarmaghAblendedAimplicitAconditionedAmodulationArochdaleAlabourersAcoinageAshortstopApotsdamAgearsAobesityAbestsellerAadvisersAboutsAcomediansAjozefAlausanneAtaxonomicAcorrelatedClumbianAindicationsApsychologistsAlibelAedictAbeaufortAdisadvantagesArenalAfinalizedAracehorseAunconventionalAdisturbancesAfalselyAzoologyAadornedAredesignAexecutingAnarrowerAcommendedAappliancesAstallsAresurgenceAsaskatoonAmiscellaneousApermittingAepochAformula_11AcumbriaAforefrontAvedicAeastendersAdisposedAsupermarketsArowerAinhibitorAmagnesiumAcolourfulAyusufAharrowAformulasAcentrallyAbalancingAionicAnocturnalAconsolidateAornateAraidingAcharismaticAaccelerateAnominateAresidualAdhabiAcommemoratesAattributionAuninhabitedAmindanaoAatrocitiesAgenealogicalAromaniAapplicantAenactmentAabstractionAtroughApulpitAminusculeCsconductAgrenadesAtimelyAsupplementsAmessagingAcurvatureBeasefireAtelanganaAsusquehannaAbrakingAredistributionAshreveportAneighbourhoodsAgregorianAwidowedAkhuzestanAempowermentAscholasticAevangelistApeptideAtopicalBheoristAhistoriaAthenceAsudaneseAmuseoAjurisprudenceAmasurianAfrankishAheadlinedArecountedAnetballApetitionsAtolerantAhectareAtruncatedAsouthendAmethaneAcaptivesAreignsAmassifAsubunitAacidicAweightliftingAfootballersAsabahAbritanniaAtunisianAsegregatedBawmillAwithdrawingAunpaidAweaponryAsommeAperceptionsAunicodeAalcoholismAdurbanAwroughtBaterfallsAjihadAauschwitzAuplandAeastboundAadjectiveBnhaltAevaluatingAregimesAguildfordAreproducedApamphletsAhierarchicalAmaneuversAhanoiAfabricatedArepetitionAenrichedAarterialAreplacementsAtidesAglobalizationAadequatelyAwestboundAsatisfactoryAfleetsAphosphorusAlastlyAneuroscienceAanchorsAxinjiangAmembranesAimprovisationAshipmentsAorthodoxyAsubmissionsAbolivianAmahmudArampsAleyteApasturesAoutlinesAfleesAtransmittersAfaresAsequentialBtimulatedAnoviceAalternatelyAsymmetricalAbreakawayAlayeredAbaronetsAlizardsAblackishAedouardAhorsepowerApenangBrincipalsAmercantileBaldivesAoverwhelminglyAhawkeAralliedAprostateAconscriptionAjuvenilesAmaccabiAcarvingsAstrikersBudburyBpurredAimprovesAlombardyAmacquarieAparisianAelasticAdistilleryAshetlandAhumaneAbrentfordAwrexhamBarehousesAroutinesAencompassedAintroductoryBsfahanBnstitutoApalaisArevolutionsAsporadicAimpoverishedAporticoAfellowshipsAspeculativeAenrollAdormantAadhereAfundamentallyAsculptedAmeritoriousAtemplateAupgradingAreformerCctoryAuncreditedAindicativeAcreeksAgalvestonAradicallyAhezbollahAfirearmAeducatingAprohibitsAtrondheimAlocusArefitAheadwatersAscreeningsAlowlandsAwaspsAcoarseAattainingAsedimentaryAperishedBitchforkAinternedAcerroAstagecoachAaeronauticalAliterAtransitionedAhaydnAinaccurateAlegislaturesAbromwichAknessetAspectroscopyAbutteAasiaticAdegradedAcatastrophicAlobesAwellnessApensacolaCripheryAhapoelAthetaAhorizontallyAfreiburgAliberalismApleasAdurableAwarmianAoffensesAmesopotamiaAshandongAunsuitableAhospitalizedAappropriatelyAphoneticAencompassAconversionsAobservesAillnessesAbreakoutAassignsAcrownsAinhibitorsAnightlyAmanifestationAfountainsAmaximizeAalphabeticalAsloopAexpandsAnewtownAwideningAgaddafiAcommencingBamouflageAfootprintAtyrolAbarangaysAuniversiteAhighlandersAbudgetsAqueryAlobbiedAwestchesterAequatorAstipulatedApointeAdistinguishesAallottedAembankmentAadvisesAstoringAloyalistsAfourierArehearsalsAstarvationAglandArihannaAtubularAexpressiveAbaccalaureateAintersectionsAreveredAcarbonateAeritreaAcraftsmenBosmopolitanAsequencingAcorridorsAshortlistedAbangladeshiApersiansAmimicAparadesArepetitiveCcommendsAflanksApromotersAincompatibleAteamingAammoniaAgreyhoundAsolosAimproperAlegislatorAnewsweekArecurrentAvitroAcavendishAeireannAcrisesAprophetsAmandirAstrategicallyAguerrillasAformula_12AghentAcontendersAequivalenceAsociologicalAhamidAcastesAstatehoodAalandAclinchedArelaunchedAtariffsAsimulationsAwilliamsburgArotateAmediationAsmallpoxAharmonicaAlodgesBavishArestrictiveAo'sullivanAdetaineesApolynomialsAechoesAintersectingAlearnersAelectsAcharlemagneAdefianceAepsomAlisztAfacilitatingAabsorbingArevelationsApaduaBieterCousBenultimateAmammalianBontenegrinAsupplementaryAwidowsAaromaticAcroatsAroanokeAtriesteAlegionsAsubdistrictAbabylonianAgrasslandsAvolgaBiolentlyAsparselyAoldiesAtelecommunicationArespondentsAquarriesAdownloadableAcommandosAtaxpayerAcatalyticAmalabarAaffordedAcopyingAdeclinesAnawabAjunctionsAassessingAfilteringAclassedAdisusedAcompliantBhristophAgottingenAcivilizationsAhermitageAcaledonianAwhereuponAethnicallyAspringsteenAmobilizationAterracesAindusAexcelAzoologicalAenrichmentAsimulateAguitaristsAregistrarAcappellaAinvokedAreusedAmanchuAconfiguredAuppsalaAgenealogyAmergersAcastsBurricularArebelledAsubcontinentAhorticulturalAparramattaAorchestratedAdockyardAclaudiusAdeccaAprohibitingAturkmenistanAbrahminAclandestineAobligatoryAelaboratedAparasiticAhelixAconstraintAspearheadedArotherhamAevictionAadaptingBlbansArescuesAsociologistAguianaAconvictsAoccurrencesAkamenAantennasBsturiasAwheeledAsanitaryAdeteriorationAtrierBheoristsAbaselineAannouncementsAvaleaAplannersAfactualAserializedGsAbilbaoAdemotedAfissionAjamestownAcholeraAalleviateCterationAindefiniteAsulfateApacedAclimaticAvaluationAartisansAproficiencyAaegeanAregulatorsAfledglingAsealingAinfluencingAservicemenAfrequentedAcancersAtambonAnarayanAbankersAclarifiedAembodiedBngraverAreorganisationAdissatisfiedCctatedAsupplementalAtemperanceAratificationApugetAnutrientApretoriaBapyrusAunitingAascribedAcoresCpticAschoolhouseAbarrioA1910sAarmoryAdefectedAtransatlanticAregulatesAportedAartefactsAspecifiesAboastedAscorersAmollusksAemittedAnavigableAquakersAprojectiveAdialoguesAreunificationAexponentialAvastlyAbannersAunsignedAdissipatedAhalvesAcoincidentallyAleasingApurportedAescortingCtimationAfoxesAlifespanAinflorescenceAassimilationAshowdownBtaunchAprologueAligandAsuperligaAtelescopesAnorthwardsAkeynoteAheaviestAtauntonAredevelopedAvocalistsApodlaskieAsoyuzArodentsAazoresAmoravianAoutsetAparenthesesAapparelAdomesticallyAauthoritativeApolymersAmonterreyAinhibitAlauncherAjordanianAfoldsAtaxisAmandatesAsingledAliechtensteinAsubsistenceAmarxismAoustedAgovernorshipAservicingAoffseasonAmodernismAprismAdevoutAtranslatorsAislamistAchromosomesApittedAbedfordshireAfabricationAauthoritarianAjavaneseAleafletsAtransientAsubstantiveApredatoryAsigismundAassassinateAdiagramsAarraysArediscoveredCclamationAspawningAfjordApeacekeepingAstrandsAfabricsAhighsAregularsAtiranaAultravioletAathenianAfillyAbarnetAnaacpBuevaAfavouritesAterminatesAshowcasesAclonesAinherentlyCterpretingAbjornAfinelyAlaudedAunspecifiedAcholaApleistoceneAinsulationAantillesAdonetskAfunnelAnutritionalAbiennaleAreactivatedAsouthportAprimateAcavaliersAaustriansAinterspersedArestartedAsurinameAamplifiersAwladyslawAblockbusterAsportsmanAminogueAbrightnessBenchesBridgeportAinitiatingBsraelisAorbitingAnewcomersAexternallyAscalingAtranscribedAimpairmentAluxuriousBongevityAimpetusAtemperamentAceilingsAtchaikovskyAspreadsApantheonAbureaucracyA1820sAheraldicAvillasAformula_13AgalicianAmeathAavoidanceAcorrespondedAheadliningAconnachtAseekersArappersAsolidsAmonographAscorelessAopoleAisotopesAhimalayasAparodiesAgarmentsAmicroscopicArepublishedAhavillandAorkneyAdemonstratorsApathogenAsaturatedAhellenisticAfacilitatesAaerodynamicArelocatingAindochinaAlavalAastronomersAbequeathedAadministrationsAextractsAnagoyaAtorquayAdemographyAmedicareAambiguityArenumberedApursuantAconcaveAsyriacAelectrodeAdispersalAhenanAbialystokAwalsallAcrystallineApueblaAjanataAilluminationAtianjinAenslavedAcolorationBhampionedAdefamationAgrilleAjohorArejoinAcaspianAfatallyAplanckAworkingsAappointingAinstitutionalizedAwessexAmodernizedAexemplifiedAregattaAjacobiteAparochialBrogrammersAblendingAeruptionsAinsurrectionAregressionAindicesAsitedAdentistryAmobilizedAfurnishingsAlevantAprimariesAardentAnagasakiAconquerorAdorchesterAopinedAheartlandAammanAmortallyAwellesleyAbowlersAoutputsAcovetedAorthographyAimmersionAdisrepairDadvantagedAcurateBhildlessBondensedCdice_1AremodeledCsultantAbolsheviksAsuperfamilyBaxonsA2010sAcontractualArivalriesAmalaccaAoaxacaAmagnateAvertebraeAquezonAolympiadAyucatanAtyresAmacroAspecializationAcommendationBaliphateAgunneryAexilesCcerptsAfraudulentAadjustableBramaicAinterceptorAdrummingAstandardizationAreciprocalAadolescentsAfederalistAaeronauticsAfavorablyAenforcingAreintroducedAzhejiangArefiningAbiplaneBanknotesAaccordionAintersectBllustratingAsummitsAclassmateAmilitiasAbiomassAmassacresAepidemiologyAreworkedAwrestlemaniaAnantesAauditoryAtaxonAellipticalAchemotherapyAassertingBvoidsAproficientAairmenAyellowstoneAmulticulturalAalloysAutilizationAseniorityAkuyavianAhuntsvilleAorthogonalAbloomingtonAcultivarsBasimirAinternmentArepulsedAimpedanceArevolvingAfermentationAparanaAshutoutApartneringAempoweredAislamabadApolledAclassifyAamphibiansAgreyishAobedienceA4x100AprojectileAkhyberAhalfbackArelationalAd'ivoireAsynonymsAendeavourApadmaAcustomizedAmasteryAdefencemanAberberApurgeAinterestinglyAcoventApromulgatedArestrictingAcondemnationAhillsboroughAwalkersAprivateerAintraAcaptaincyAnaturalizedAhuffingtonAdetectingAhintedAmigratingAbayouAcounterattackAanatomicalAforagingAunsafeAswiftlyAoutdatedAparaguayanAattireAmasjidAendeavorsAjerseysAtriassicAquechuaAgrowersAaxialBccumulateAwastewaterAcognitionAfungalAanimatorApagodaAkochiAuniformlyAantibodyAyerevanAhypothesesAcombatantsAitalianateAdrainingAfragmentationAsnowfallAformativeAinversionAkitchenerAidentifierAadditiveAluchaAselectsAashlandAcambrianAracetrackAtrappingAcongenitalAprimatesAwavelengthsAexpansionsAyeomanryAharcourtAwealthiestAawaitedApuntaAinterveningAaggressivelyAvichyApilotedAmidtownAtailoredAheydayAmetadataAguadalcanalAinorganicAhadithApulsesAfrancaisAtangentAscandalsAerroneouslyAtractorsApigmentAconstabularyAjiangsuAlandfillAmertonAbasaltAastorAforbadeAdebutsAcollisionsAexchequerAstadionAroofedAflavourAsculptorsAconservancyAdisseminationAelectricallyAundevelopedAexistentAsurpassingApentecostalAmanifestedAamendAformula_14AsuperhumanAbargesAtunisAanalyticsBrgyllAliquidsAmechanizedAdomesAmansionsAhimalayanAindexingAreutersAnonlinearApurificationAexitingAtimbersBrianglesAdecommissioningCpartmentalAcausalAfontsAamericanaAsept.CasonallyAincomesArazaviAshedsAmemorabiliaArotationalAterreAsutraAprotegeAyarmouthAgrandmasterAannumAlootedAimperialismAvariabilityAliquidationAbaptisedAisotopeAshowcasingAmillingArationaleAhammersmithAaustenAstreamlinedAacknowledgingAcontentiousAqalehAbreadthAturingArefereesAferalAtoulonAunofficiallyAidentifiableAstandoutAlabelingAdissatisfactionAjurgenAangrilyAfeatherweightAcantonsBonstrainedAdominatesAstandaloneArelinquishedAtheologiansAmarkedlyAitalicsAdownedAnitrateAlikenedAgulesAcraftsmanAsingaporeanApixelsAmandelaBorayAparityAdepartementAantigenBcademicallyAburghBrahmaAarrangesAwoundingAtriathlonAnouveauAvanuatuAbandedAacknowledgesAunearthedAstemmingAauthenticationAbyzantinesAconvergeAnepaliAcommonplaceAdeterioratingArecallingApaletteAmathematiciansAgreenishApictorialAahmedabadArouenAvalidationAu.s.a.A'bestAmalvernAarchersAconverterAundergoesAfluorescentAlogisticalAnotificationAtransvaalAillicitAsymphoniesBtabilizationAworsenedAfukuokaAdecreesAenthusiastAseychellesAbloggerAlouvreAdignitariesAburundiAwreckageAsignageApinyinAburstsAfedererApolarizationAurbanaAlazioAschismAnietzscheAvenerableAadministersAsetonAkilogramsAinvariablyAkathmanduAfarmedAdisqualificationAearldomAappropriatedAfluctuationsAkermanshahAdeploymentsCformationAwheelbaseAmarathaApsalmAbytesAmethylAengravingsAskirmishAvaccinesAideallyAastrologyAbreweriesBotanicAopposesAharmoniesAirregularitiesAcontendedAgaulleAprowessAconstantsAagroundAfilipinosBrescoAochreousAjaipurAwillametteAquercusAeastwardsAmortarsAchampaignAbrailleAreformingAhornedBunanAspaciousAagitationAdraughtAspecialtiesAflourishingAgreensboroAnecessitatedAswedesAelementalAwhorlsAhugelyAstructurallyApluralityAsynthesizersAembassiesAassadAcontradictoryAinferenceAdiscontentArecreatedAinspectorsAunicefAcommutersAembryoAmodifyingAstintsAnumeralsAcommunicatedAboostedAtrumpeterAbrightlyAadherenceAremadeAleasesArestrainedAeucalyptusAdwellersAplanarAgroovesBainesvilleAdaimlerAanzacAszczecinAcornerbackAprizedBekingAmauritaniaAkhalifaAmotorizedAlodgingAinstrumentalistAfortressesAcervicalAformula_15ApasserineAsectarianAresearchesAapprenticedAreliefsAdiscloseAglidingArepairingAqueueAkyushuAliterateAcanoeingAsacramentBeparatistAcalabriaAparklandAflowedAinvestigatesAstatisticallyAvisionaryAcommitsAdragoonsAscrollsApremieresArevisitedAsubduedAcensoredApatternedAelectiveAoutlawedBrphanedAleylandArichlyAfujianAminiaturesAheresyAplaquesAcounteredAnonfictionAexponentAmoraviaAdispersionAmaryleboneBidwesternAenclaveAithacaAfederatedAelectronicallyAhandheldAmicroscopyAtollsAarrivalsAclimbersBontinualCssacksAdesertsAubiquitousAgablesAforecastsAdeforestationAvertebratesAflankingAdrilledAsuperstructureAinspectedAconsultativeAbypassedBallastAsubsidyBocioeconomicArelicAgrenadaAjournalisticAadministeringBccommodatedAcollapsesAappropriationAreclassifiedAforewordAporteAassimilatedAobservanceAfragmentedAarundelAthuringiaAgonzagaAshenzhenCipyardsBectionalAayrshireAslopingAdependenciesApromenadeAecuadorianAmangroveAconstructsAgoalscorerAheroismAiterationAtransistorAomnibusAhampsteadAcochinAovershadowedAchieftainAscalarAfinishersAghanaianAabnormalitiesAmonoplaneAencyclopaediaAcharacterizeAtravancoreAbaronetageBearersBikingAdistributesApavingAchristenedAinspectionsAbancoAhumberAcorinthAquadraticAalbaniansAlineagesAmajoredAroadsideAinaccessibleCclinationAdarmstadtAepilepsyApropellersBapacyAmontaguAbhuttoAsugarcaneAoptimizedApilastersAcontendAbatsmenBrabantAhousematesAsligoAascotBquinasAsupervisoryAaccordedAgeraisAechoedAnunavutAconservatoireBarniolaAquartermasterAgminasAimpeachmentAaquitaineAreformersAquarterfinalAkarlsruheAacceleratorAcoeducationalAarchdukeAgelechiidaeAseaplaneAdissidentAfrenchmanApalauAdepotsAhardcoverAaachenAdarrehBenominationalAgroningenAparcelsAreluctanceAdraftsAellipticAcountersAdecreedAairshipAdevotionalAcontradictionAformula_16AundergraduatesAqualitativeAguatemalanAslavsBouthlandAblackhawksAdetrimentalAabolishAchechenAmanifestationsAarthritisAperchAfatedAhebeiApeshawarBalinAimmenselyAhavreAtotallingArampantAfernsAconcourseAtriplesAelitesAolympianAlarvaAherdsAlipidAkarabakhAdistalAmonotypicAvojvodinaAbataviaAmultipliedAspacingCellingsApedestriansBarchmentAglossyAindustrializationAdehydrogenaseApatriotismAabolitionistAmentoringAelizabethanAfigurativeAdysfunctionAabyssAconstantinAmiddletownAstigmaAmondaysAgambiaCiusAisraelitesArenouncedAnepaleseAovercomingAburenAsulphurAdivergenceApredationAlootingAiberiaAfuturisticAshelvedAanthropologicalAinnsbruckAescalatedAclermontAentrepreneurialAbenchmarkAmechanicallyAdetachmentsApopulistAapocalypticAexitedBmbryonicAstanzaAreadershipAchibaAlandlordsAexpansiveAbonifaceAtherapiesAperpetratorsAwhitehallAkasselAmastsAcarriagewayBlinchApathogensAmazandaranAundesirableAteutonicAmioceneAnagpurAjurisAcantataBompileAdiffuseBynasticAreopeningAcomptrollerAo'nealAflourishAelectingAscientificallyAdepartsAweldedAmodalAcosmologyAfukushimaAlibertadoresAchang'anAaseanAgeneralizationAlocalizationAafrikaansAcricketersAaccompaniesAemigrantsBsotericAsouthwardsBhutdownAprequelAfittingsAinnateAwronglyAequitableAdictionariesAsenatorialAbipolarAflashbacksAsemitismAwalkwayAlyricallyBegalityAsorbonneAvigorouslyAdurgaAsamoanAinterchangesApatnaAdeciderAregisteringAelectrodesAanarchistsAexcursionAoverthrownAgilanArecitedAadvertiserAkinshipAtabooAcessationAformula_17ApremiersAtraversedAmaduraiApoorestAtorneoAexertedAreplicateAspeltCoradicallyAhordeAlandscapingArazedAhinderedAesperantoAmanchuriaApropellantAjalanAbaha'isAsikkimAlinguistsApanditAraciallyAligandsAfrancophoneAescarpmentAbehestAmagdeburgCinstayAvilliersAyangtzeAgrupoAconspiratorsAmartyrdomAnoticeablyAlexicalAkazakhAunrestrictedBtilisedAsiredAinhabitsAproofsAjoseonAplinyAmintedAbuddhistsAcultivateAinterconnectedAreuseAviabilityAaustralasianAderelictAresolvingAoverlooksAmenonAstewardshipAplaywrightsAthwartedAfilmfareAdisarmamentAprotectionsAbundlesAsidelinedAhypothesizedAsinger/songwriterAforageAnettedAchanceryAtownshendArestructuredAquotationAhyperbolicAsuccumbedAparliamentsAshenandoahAapicalAkibbutzAstoreysApastorsAletteringAukrainiansAhardshipsAchihuahuaAavailBislesAtalukaAantisemitismBssentAventuredAbanksiaAseamenAhospiceAfaroeBearfulAworedaAoutfieldAchlorineAtransformerBatarApanoramicBendulumAhaarlemAstyriaAcorniceAimportingAcatalyzesAsubunitsAenamelAbakersfieldArealignmentAsortiesBubordinatesAdeaneryAtownlandAgunmenAtutelageAevaluationsAallahabadAthraceAvenetoAmennoniteAsubgenusBatisfiesApuritanAunequalAgastrointestinalAordinancesAbacteriumAhorticultureAargonautsBdjectivesBrableAduetsAvisualizationAwoolwichArevampedAeuroleagueAthoraxAcompletesAoriginalityAvascoAfreighterAsardarAoratoryAsectsAextremesAsignatoriesAexportingAarisenAexacerbatedAdeparturesAsaipanAfurlongsAd'italiaAgoringAdakarAconquestsAdockedAoffshootBkrugAreferencingAdisperseAnettingAsummedArewrittenAarticulationAhumanoidAspindleAcompetitivenessApreventiveAfacadesAwestinghouseBycombeAsynthaseAemulateAfosteringAabdelAhexagonalAmyriadAcatersAdismayAaxiomApsychotherapyAcolloquialCmplementedAmartiniqueAfracturesAculminationAerstwhileAatriumAelectronicaAanarchismAnadalAmontpellierAalgebrasAsubmittingAadoptsAstemmedAovercameAinternacionalAasymmetricAgallipoliBlidersAflushingAexterminationAhartlepoolAteslaAinterwarApatriarchalAhithertoAgangesAcombatantAmarredAphilologyAglastonburyAreversibleAisthmusAunderminedAsouthwarkAgatesheadAandalusiaAremediesAhastilyAoptimumAsmartphoneAevadeApatrolledAbeheadedAdopamineAwaiversAugandanAgujaratiAdensitiesApredictingAintestinalAtentativeAinterstellarAkoloniaAsoloistsApenetratedArebellionsAqeshlaqAprosperedAcolegioAdeficitsAkonigsbergAdeficientAaccessingArelaysAkurdsApolitburoAcodifiedAincarnationsAoccupancyAcossackAmetaphysicalAdeprivationAchopraApiccadillyAformula_18AmakeshiftAprotestantismAalaskanAfrontiersBaithsAtendonAdunkirkCrabilityAautobotsAbonusesAcoincidingAemailsAgunboatAstuccoAmagmaAneutronsAvizierAsubscriptionsAvisualsAenvisagedAcarpetsAsmokyBchemaAparliamentarianAimmersedAdomesticatedAparishionersAflindersAdiminutiveAmahabharataAballaratAfalmouthAvacanciesAgildedAtwigsAmasteringAclericsAdalmatiaAislingtonAslogansAcompressorAiconographyAcongoleseAsanctionAblendsBulgariansAmoderatorAoutflowAtexturesAsafeguardAtrafalgarDmwaysAskopjeAcolonialismBhimneysAjazeeraAorganisersAdenotingAmotivationsAgangaAlongstandingAdeficienciesAgwyneddApalladiumAholisticAfasciaApreachersAembargoAsidingsAbusanAignitedAartificiallyAclearwaterBementedAnortherlyAsalimAequivalentsAcrustaceansAoberligaAquadrangleAhistoriographyAromaniansAvaultsAfiercelyAincidentalApeacetimeAtonalAbhopalAoskarAradhaApesticidesAtimeslotAwesterlyAcathedralsAroadwaysAaldershotAconnectorsAbrahminsApalerAaqueousAgustaveAchromaticAlinkageBothianAspecialisesAaggregationAtributesAinsurgentAenactAhampdenAghulamAfederationsAinstigatedAlyceumAfredrikAchairmanshipAfloatedAconsequentAantagonistsAintimidationApatriarchateAwarblerAheraldryAentrenchedBxpectancyAhabitationApartitionsAwidestAlaunchersAnascentAethosAwurzburgAlyceeAchittagongAmahatmaBerseysideAasteroidsAyokosukaAcooperativesAquorumAredistrictingAbureaucraticAyachtsAdeployingArusticAphonologyAchoraleBellistAstochasticAcrucifixionAsurmountedAconfucianAportfoliosAgeothermalAcrestedBalibreAtropicsAdeferredAnasirAiqbalApersistenceAessayistAchengduAaboriginesAfayettevilleAbastionAinterchangeableAburlesqueAkilmarnockAspecificityAtankersAcolonelsAfijianAquotationsAenquiryAquitoApalmerstonAdelleAmultidisciplinaryApolynesianAiodineAantennaeAemphasisedAmanganeseAbaptistsAgalileeAjutlandAlatentAexcursionsAskepticismAtectonicAprecursorsAnegligibleAmusiqueBisuseAexpresslyAvenerationAsulawesiAfootedAmubarakAchongqingCemicallyAmiddayAravagedAfacetsAvarmaAyeovilAethnographicAdiscountedAphysicistsAattacheAdisbandingAessenAshogunateAcooperatedAwaikatoArealisingAmotherwellApharmacologyAsulfideAinwardAexpatriateAdevoidAcultivarAmondeAandeanAgroupingsBoranAunaffectedAmoldovanApostdoctoralAcoleophoraAdelegatedApronounAconductivityCleridgeAdisapprovalAreappearedAmicrobialAcampgroundAolsztynAfosteredAvaccinationArabbinicalAchamplainAmilestonesAviewershipAcaterpillarAeffectedBupitheciaAfinancierAinferredAuzbekAbundledBandarClochistanAmysticismAbiosphereAholotypeAsymbolizesAlovecraftAphotonsAabkhaziaAswazilandBubgroupsAmeasurableAfalkirkAvalparaisoAashokAdiscriminatoryArarityAtabernacleAflyweightAjaliscoAwesternmostAantiquarianAextracellularAmargraveAcolspan=9AmidsummerAdigestiveAreversingAburgeoningAsubstitutesAmedallistAkhrushchevAguerreAfolioAdetonatedApartidoBlentifulAaggregatorAmedallionAinfiltrationAshadedBantanderAfaredAauctionedApermianAramakrishnaAandorraAmentorsAdiffractionAbukitApotentialsAtranslucentAfeministsAtiersAprotractedAcoburgAwreathAguelphAadventurerAhe/sheAvertebrateApipelinesAcelsiusAoutbreaksAaustralasiaAdeccanAgaribaldiAunionistsAbuildupBiochemicalAreconstructAbouldersAstringentAbarbedAwordingAfurnacesApestsAbefriendsAorganisesApopesArizalAtentaclesAcadreAtallahasseeApunishmentsAoccidentalAformattedAmitigationArulingsCbensAcascadesAinducingAchoctawAvoltaAsynagoguesAmovableAaltarpieceAmitigateAintermittentlyAencounteringAmembershipsAearnsAsignifyAretractableAamountingApragmaticAwilfridAdissentingCvergentAkanjiAreconstitutedAdevonianAconstitutionsAleviedAhendrikAstarchAcostalAhonduranAditchesApolygonAeindhovenAsuperstarsBalientAargusApunitiveCranaAalluvialAflapsAinefficientAretractedAadvantageousAquangAanderssonAdanvilleAbinghamtonAsymbolizeAconclaveAshaanxiBilicaAinterpersonalAadeptAfransApavilionsAlubbockAequipAsunkenAlimburgAactivatesAprosecutionsAcorinthianAveneratedAshootingsAretreatsAparapetAorissaAriviereAanimationsAparodiedAofflineAmetaphysicsAbluffsAplumeBietyAfruitionAsubsidizedBteeplechaseBhanxiAeurasiaAangledAforecastingAsuffraganAashramAlarvalCbyrinthAchroniclerAsummariesAtrailedAmergesAthunderstormsAfilteredBormula_19AadvertisersBlpesAinformaticsApartiAconstitutingAundisputedAcertificationsAjavascriptAmoltenAsclerosisArumouredAboulogneAhmongAlewesAbreslauAnottsAbantuAducalAmessengersAradarsAnightclubsAbantamweightAcarnaticAkaunasAfraternalAtriggeringAcontroversiallyAlondonderryAvisasAscarcityAoffalyAuprisingsArepelledAcorinthiansApretextAkuomintangBielceAemptiesAmatriculatedApneumaticAexposAagileAtreatisesAmidpointAprehistoryAoncologyAsubsetsAhydraCpertensionAaxiomsAwabashAreiteratedAswappedAachievesApremioAageingAovertureAcurriculaBhallengersAsubicBelangorAlinersAfrontlineAvalidatedAnormalizedAentertainersAmolluscsBaharajAallegationAyoungstownAsynthAthoroughfareAregionallyApillaiAtranscontinentalApedagogicalAriemannAcoloniaAeasternmostAtentativelyAprofiledAherefordshireAnativityAmeuseAnucleotideAinhibitsAhuntingdonAthroughputArecordersAconcedingAdomedAhomeownersAcentricAgabledAcanoesAfringesAbreederAsubtitledAfluorideAhaplogroupAzionismAizmirAphylogenyAkharkivAromanticismAadhesionAusaafAdelegationsAlorestanAwhalersAbiathlonAvaultedAmathematicallyAskirmishesAheismanAkalamazooAgesellschaftAlauncestonAinteractsAquadrupleAkowloonApsychoanalysisAtoothedAideologiesAnavigationalAvalenceAinducesAlesothoAfriezeAriggingAundercarriageAexplorationsAspoofAeucharistAprofitabilityAvirtuosoArecitalsAsubterraneanBizeableAherodotusAsubscriberAhuxleyApivotAforewingAwarringAboleslawBharatiyaAsuffixesAtroisApercussionistAdownturnAgarrisonsAphilosophiesAchantsAmersinCntoredAdramatistAguildsAframeworksAthermodynamicAvenomousAmehmedAassemblingArabbinicAhegemonyAreplicasAenlargementAclaimantAretitledAuticaAdumfriesAmetisAdeterAassortmentAtubingAafflictedAweaversAruptureAornamentationAtranseptAsalvagedAupkeepAcallsignArajputAstevenageAtrimmedAintracellularAsynchronizationAconsularAunfavorableAroyalistsAgoldwynAfastingAhussarsAdopplerAobscurityAcurrenciesAamiensBcornAtagoreBownsvilleAgaussianAmigrationsAportaAanjouAgraphiteAseaportAmonographsAgladiatorsAmetricsAcalligraphyAsculpturalBwietokrzyskieAtolombehAeredivisieAshoalsAqueriesAcartsAexemptedAfiberglassAmirroredAbazarAprogenyAformalizedAmukherjeeAprofessedAamazon.comAcathodeAmoretonAremovableAmountaineersAnaganoAtransplantationAaugustinianAsteeplyAepilogueAadapterAdecisivelyAacceleratingAmediaevalAsubstitutingAtasmanAdevonshireAlitresAenhancementsAhimmlerAnephewsAbypassingAimperfectAargentinianAreimsAintegratesAsochiAasciiAlicencesAnichesAsurgeriesAfablesAversatilityAindraAfootpathAafonsoAcroreAevaporationBncodesAshellingAconformityAsimplifyAupdatingAquotientAovertAfirmwareAumpiresAarchitecturesAeoceneAconservatismAsecretionAembroideryAf.c..AtuvaluAmosaicsAshipwreckAprefecturalAcohortAgrievancesBarneringAcenterpieceAapoptosisAdjiboutiAbethesdaAformula_20AshonenArichlandAjustinianAdormitoriesAmeteoriteAreliablyAobtainsApedagogyAhardnessAcupolaAmanifoldsAamplificationAsteamersAfamilialAdumbartonAjerzyAgenitalAmaidstoneAsalinityAgrummanAsignifiesApresbyteryAmeteorologyAprocuredAaegisAstreamedAdeletionAnuestraAmountaineeringAaccordsAneuronalAkhanateAgrenobleAaxlesAdispatchesAtokensBurkuAauctionsApropositionsBlantersBroclaimingArecommissionedAstravinskyAobverseAbombardedAwagedAsaviourAmassacredAreformistApurportedlyAresettlementBavennaAembroiledAmindenArevitalizationAhikersAbridgingAtorpedoedAdepletionAnizamAaffectionatelyAlatitudesBubeckAsporeApolymeraseAaarhusAnazismA101stAbuyoutAgalerieAdietsAoverflowAmotivationalArenownAbrevetAderivingAmeleeAgoddessesAdemolishAamplifiedAtamworthAretakeAbrokerageBeneficiariesAhenceforthAreorganisedAsilhouetteAbrowsersApollutantsBeronAlichfieldAencircledAdefendsAbulgeAdubbingAflamencoAcoimbatoreArefinementAenshrinedAgrizzliesAcapacitorAusefulnessAevansvilleAinterscholasticArhodesianAbulletinsAdiamondbacksArockersAplattedAmedalistsAformosaAtransporterAslabsAguadeloupeAdisparateAconcertosAviolinsAregainingAmandibleAuntitledAagnosticAissuanceAhamiltonianAbramptonAsrpskaAhomologyAdowngradedAflorentineAepitaphAkanyeArallyingAanalysedAgrandstandAinfinitelyAantitrustAplunderedAmodernityAcolspan=3|totalAamphitheatreAdoricAmotoristsAyemeniAcarnivorousAprobabilitiesCelateAstrutsBcrappingAbydgoszczApancreaticAsigningsApredictsAcompendiumAombudsmanAaperturaCpointsArebbeAstereotypicalAvalladolidAclusteredAtoutedAplywoodAinertialAketteringAcurvingAd'honneurAhousewivesAgrenadierAvandalsAbarbarossaAneckedAwalthamAreputedlyAjharkhandAcistercianApursuesAviscosityAorganiserAcloisterAisletAstardomAmoorishAhimachalAstrivesBcrippsBtaggeredAblastsAwestwardsAmillimetersAangolanAhubeiAagilityBdmiralsAmordellistenaAcoincidesAplatteAvehicularAcordilleraAriffsAschoolteacherAcanaanAacousticsAtingedAreinforcingAconcentratesAdaleksAmonzaAselectivelyAmusikApolynesiaAexporterArevivingAmacclesfieldAbunkersBalletsAmanorsAcaudalAmicrobiologyAprimesAunbrokenAoutcryAflocksApakhtunkhwaAabelianAtoowoombaAluminousAmouldAappraisalAleuvenAexperimentallyAinteroperabilityAperakAspecifyingAknighthoodAvasilyAexcerptAcomputerizedAnielsBetworkedAbyzantiumAreaffirmedAgeographerAobscuredAfraternitiesAmixturesAallusionBccraAlengthenedAinquestApanhandleBigmentsArevoltsAbluetoothAconjugateAovertakenAforayAcoilsAbreechAstreaksAimpressionistAmendelssohnAintermediaryApannedAsuggestiveAnevisAupazilaArotundaAlinnaeusAanecdotesAgorbachevAvienneseAexhaustiveAmoldaviaAarcadesAirrespectiveAoratorAdiminishingApredictiveAcohesionApolarizedAmontageAavianBlienationAconusAjaffnaAurbanizationAseawaterAextremityBditorialsAscrollingAdreyfusAtraversesBopographicAgunboatsAextratropicalAnormansAcorrespondentsArecognisesAmillenniaAfiltrationAammoniumAvoicingAcompliedAprefixesAdiplomasAfigurinesAweaklyAgatedAoscillatorAlucerneAembroideredAoutpatientAairframeAfractionalAdisobedienceAquarterbacksAformula_21AshintoAchiapasAepistleAleakageApacifistAavignonApenrithArendersAmantuaAscreenplaysAgustafAtescoAalphabeticallyArationsAdischargesAheadlandAtapestryAmanipurAbooleanAmediatorAebenezerAsubchannelAfableAbestsellingAateneoAtrademarksArecurrenceAdwarfsAbritannicaAsignifyingAmediateAcondensationBensusesAverbandsgemeindeAcartesianAsprangBuratAbritonsAchelmsfordAstatisticAretinaAabortionsAliabilitiesAclosuresAmississaugaAskyscrapersBaginawAcompoundedAaristocratAmsnbcAstavangerBeptaAinterpretiveAhinderAvisiblyAseedingBhutoutsAirregularlyAquebecoisAfootbridgeAhydroxideAimplicitlyAlieutenantsAsimplexApersuadesAmidshipmanAheterogeneousAofficiatedAcrackdownAlendsAtartuAaltarsAfractionsAdissidentsAtaperedAmodernisationAscriptingAblazonAaquacultureAthermodynamicsAsistanAhasidicAbellatorApropagatedAtheorizedAbedouinAtransnationalAmekongAchronicledAdeclarationsAkickstarterAquotasAruntimeAduquesneAbroadenedAclarendonAbrownsvilleAsaturationAtatarsAelectoratesAmalayanAreplicatedAobservableAamphitheaterAendorsementsAreferralAallentownAmormonsApantomimeAeliminatesAtypefaceAallegoricalAvarnaAconductionAevokeAinterviewerAsubordinatedAuyghurAlandscapedAconventionallyAascendAedificeApostulatedAhanjaAwhitewaterAembarkingAmusicologistAtagalogAfrontageAparatroopersAhydrocarbonsAtransliteratedAnicolaeAviewpointsAsurrealistAashevilleAfalklandsAhaciendaAglideAoptingAzimbabweanAdiscalAmortgagesAnicaraguanAyadavAghoshAabstractedAcastilianBompositionalBartilageAintergovernmentalAforfeitedAimportationArappingAartesArepublikaAnarayanaAcondominiumAfrisianAbradmanAdualityAmarcheAextremistAphosphorylationAgenomesAallusionsAvalencianAhabeasAironworksAmultiplexAharpsichordAemigrateAalternatedAbredaAwaffenAsmartphonesAfamiliarityAregionalligaAherbaceousApipingAdilapidatedAcarboniferousAxviiiAcritiquesBarcinomaAsagarAchippewaApostmodernAneapolitanAexcludesAnotoriouslyAdistillationAtungstenArichnessAinstallmentsAmonoxideAchandAprivatisationAmoldedAprojectilesAluoyangAepirusAlemmaAconcentricAinclineAerroneousAsidelineAgazettedAleopardsAfibresArenovateAcorrugatedAunilateralArepatriationAorchestrationAsaeedArockinghamAloughboroughAformula_22AbandleaderAappellationAopennessAnanotechnologyAmassivelyAtonnageAdunfermlineAexposesAmooredAridershipAmotteAeurobasketAmajoringAfeatsAsillaAlaterallyAplaylistAdownwardsAmethodologiesAeastbourneAdaimyoAcelluloseAleytonAnorwalkAoblongAhibernianAopaqueAinsularAallegoryAcamogieAinactivationAfavoringAmasterpiecesArinpocheAserotoninAportrayalsAwaverleyAairlinerAlongfordAminimalistAoutsourcingAexciseAmeyrickAqasimAorganisationalAsynapticAfarmingtonAgorgesAscunthorpeAzonedAtohokuAlibrariansAdavaoBecorAtheatricallyAbrentwoodApomonaAacquiresAplanterAcapacitorsAsynchronousBkateboardingAcoatingsAturbochargedAephraimAcapitulationAscoreboardAhebridesAensuesAcerealsAailingAcounterpointAduplicationAantisemiticAcliqueAaichiAoppressiveAtranscendentalAincursionsArenameDumberingApowysAvestryAbitterlyAneurologyAsupplantedAaffineAsusceptibilityAorbiterAactivatingAoverlapsAecoregionAramanAcanoerAdarfurAmicroorganismsAprecipitatedCotrudingAtorunAanthropologistsArennesAkangaroosAparliamentariansAeditsAlittoralAarchivedAbegumArensselaerAmicrophonesAypresAempowerBtruscanAwisdenAmontfortAcalibrationAisomorphicAriotingAkingshipAverballyAsmyrnaAcohesiveBanyonsAfredericksburgArelativisticAmicropolitanBaroonsAindustrializedAhenchmenAupliftAearthworksAmahdiAdisparityAculturedAtransliterationAspinyAfragmentaryAextinguishedAatypicalAinventorsAbiosynthesisAheraldedAcuracaoAanomaliesBeroplaneAsuryaAmangaloreCastrichtAashkenaziAfusiliersAhangzhouAemittingAmonmouthshireAschwarzeneggerAramayanaApeptidesAthiruvananthapuramAalkaliAcoimbraAbuddingAreasonedAepithelialAharborsArudimentaryAclassicallyAparqueAealingAcrusadesArotationsBiparianApygmyAinertiaArevoltedAmicroprocessorAcalendarsAsolventsAkriegsmarineAaccademiaAcheshmehAyorubaAardabilAmitraAgenomicAnotablesApropagateAnarratesAunivisionAoutpostsApolioAbirkenheadAurinaryAcrocodilesApectoralAbarrymoreAdeadliestAchaimAprotonsAcomicalAastrophysicsAunifyingAformula_23AvassalsAcorticalAaudubonApedalsAtendersAresortedAgeophysicalAlendersArecognisingAtacklingAlanarkshireAdoctrinalAannanAcombatingAguangxiAestimatingAselectorsAtribunalsAchamberedAinhabitingAexemptionsAcurtailedAabbasidAkandaharAboronBissauA150thAcodenamedAwearerBhorlAadheredAsubversiveAfamerAsmeltingAinsertingAmogadishuAzoologistAmosulAstumpsAalmanacAolympiacosAstamensAparticipatoryAcultsAhoneycombAgeologistsAdividendArecursiveAskiersAreprintApandemicAliberApercentagesAadverselyAstoppageAchieftainsAtubingenAsoutherlyAovercrowdingAunorganizedAhangarsAfulfilAhailsAcantileverAwoodbridgeApinusAwiesbadenAfertilizationBluorescenceAenhancesAplenaryAtroublesomeAepisodicAthrissurAkickboxingAalleleAstaffingAgardaAtelevisionsAphilatelicAspacetimeAbullpenAoxidesAleninistAenrollingAinventiveAtruroAcompatriotAruskinAnormativeAassayAgothaAmuradAillawarraAgendarmerieAstrasseAmazraehAreboundedAfanfareAliaoningArembrandtAiraniansAemirateAgovernsAlatencyAwaterfowlAchairmenAkatowiceAaristocratsAeclipsedAsentientBonatasAinterplayAsackingAdecepticonsBynamicalAarbitrarilyAresonantApetarAvelocitiesAalludesAwastesAprefecturesAbellevilleAsensibilityBalvadoranAconsolidatingAmedicaidAtraineesAvivekanandaAmolarAporousAuploadAyoungsterAinfusedAdoctoratesAwuhanAannihilationAenthusiasticallyAgamespotAkanpurAaccumulatingAmonorailAoperettaAtilingAsapporoAfinnsAcalvinistAhydrocarbonAsparrowsAorienteeringAcornelisAminsterAvueltaAplebisciteAembracesApanchayatsAfocussedAremediationAbrahmanAolfactoryAreestablishedAuniquenessAnorthumbriaArwandanApredominatelyAabodeAghatsAbalancesAcalifornianAuptakeAbrugesAinertAwesternsAreprintsAcairnAyarraAresurfacedBossiniBegensburgAitalianaAfleshyAirrigatedAalertsAyahyaAvaranasiAmarginalizedAexpatriatesAcantonmentAnormandieAsahityaAdirectivesArounderAhullsAfictionalizedAconstablesAinsertsAhippedApotosiAnaviesAbiologistsAhusbandryAaugmentAfortnightAassameseAkampalaAo'keefeApaleolithicAbluishApromontoryAconsecutivelyAstrivingAniallAreunitingAdipoleAfriendliesAdisapprovedAthrivedAnetflixAliberianAdielectricAmedwayAstrategistBanktApickupsAhittersAencodeAreroutedAclaimantsAangleseyApartitionedAcavanAflutesArearedCpaintedAarmamentsAbowedAthoracicAballiolApieroAchaplainsAdehestanAsenderAjunkersAsindhiCckleAdividendsAmetallurgyAhonorificAberthsAnamcoAspringboardAresettledAgansuAcopyrightedBriticizesAutopianAbendigoAovarianAbinomialAspaceflightAoratorioAproprietorsAsupergroupAduplicatedAforegroundAstrongholdsArevolvedAoptimizeAlayoutsAwestlandAhurlerAanthropomorphicAexcelsiorAmerchandisingAreedsAvetoedAcryptographyAhollyoaksAmonashAflooringAionianAresilienceAjohnstownAresolvesAlawmakersAalegreAwildcardsAintoleranceAsubcultureBelectorBlumsAformulateAbayonetAistvanArestitutionAinterchangeablyAawakensArostockAserpentineAoscillationAreichstagAphenotypeArecessedApiotrAannotatedApreparednessAconsultationsBlausuraApreferentialAeuthanasiaAgenoeseAoutcropsAfreemasonryAgeometricalCneseeAisletsAprometheusBanamanianAthunderboltBerracedAstaraBhipwrecksAfutebolBaroeseAsharqiAaldermenAzeitungAunifyAformula_24AhumanismAsyntacticAearthenAblythAtaxedArescindedAsuleimanAcymruAdwindledAvitalityAsuperieureAresupplyAadolpheBrdennesArajivAprofilingAolympiqueAgestationAinterfaithAmilosevicAtaglineAfuneraryAdruzeAsilveryAploughAshrublandArelaunchAdisbandAnunatakAminimizingAexcessivelyAwanedAattachingAluminosityAbugleAencampmentBlectrostaticAminesweeperAdubrovnikArufousAgreenockAhochschuleAassyriansAextractingAmalnutritionAattainmentBnhuiAconnotationsApredicateAseabirdsAdeducedApseudonymsAgopalAplovdivArefineriesAimitatedAkwazuluAterracottaCnetsAdiscoursesAbrandeisAwhigsAdominionsApulmonateAlandslidesAtutorsAdeterminantArichelieuAfarmsteadAtuberclesBechnicolorAhegelAredundancyAgreenpeaceAshorteningAmulesAdistilledAxxiiiAfundamentalistAacrylicAoutbuildingsAlightedAcoralsAsignaledAtransistorsAcaviteAausterityA76ersAexposuresAdionysiusAoutliningAcommutativeApermissibleAknowledgeableAhowrahAassemblageAinhibitedAcrewmenAmbit/sApyramidalAaberdeenshireAberingArotatesAatheismAhowitzerAsaoneAlancetAfermentedAcontradictedAmaterielAofstedAnumericAuniformityAjosephusAnazareneAkuwaitiAnoblemenApedimentAemergentAcampaignerAakademiAmurciaAperugiaAgallenAallsvenskanAfinnedAcavitiesAmatriculationArostersAtwickenhamAsignatoryApropelAreadableAcontendsAartisanAflamboyantAreggioAitaloAfumblesAwidescreenArectangleAcentimetresBollaboratesAenvoysArijekaAphonologicalAthinlyArefractiveCductaseAcognateAdalhousieAmonticelloAlighthousesAjitsuAluneburgAsocialiteAfermiAcollectibleAoptionedAmarqueeAjokinglyAarchitecturallyAkabirAconcubineAnationalisationAwatercolorBicklowAacharyaAleibnizArajendraAnationalizedAstalemateAbloggersAglutamateAuplandsAshivajiAcarolingianAbucurestiAdashtAreappearsAmuscatAfunctionallyBormulationsAhingedBainanAcatechismAautosomalAincrementalAasahiAcoeurAdiversificationAmultilateralAfewestArecombinationAfinisherAharrogateCngulAfeastsAphotovoltaicBagetAliquidityAalludedAincubationAapplaudedAchorusesAmalagasyAhispanicsAbequestAunderpartsAcassavaAkazimierzAgastricAeradicationAmowtowrAtyrosineAarchbishopricAe9e9e9AunproductiveBxbridgeAhydrolysisBarboursAofficioAdeterministicCvonportAkanagawaAbreachesAfreetownArhinocerosAchandigarhAjanosAsanatoriumAliberatorAinequalitiesAagonistAhydrophobicAconstructorsAnagornoAsnowboardingAwelcomesAsubscribedAiloiloAresumingAcatalystsAstallionsAjawaharlalAharriersAdefinitivelyAroughridersAhertfordAinhibitingAelgarArandomizedAincumbentsAepiscopateArainforestsAyangonAimproperlyAkemalAinterpretersAdivergedAuttarakhandBmayyadAphnomBanathinaikosAshabbatAdiodeAjiangxiAforbiddingAnozzleAartistryAlicenseeAprocessionsAstaffsAdecimatedAexpressionismAshingleApalsyAontologyAmahayanaCriborAsunilAhostelsAedwardianAjettyAfreeholdAoverthrewAeukaryoticAschuylkillArawalpindiAsheathArecessiveAferencAmandiblesAberlusconiAconfessorDvergentAababaAsluggingArentalsAsephardicAequivalentlyAcollagenAmarkovAdynamicallyAhailingAdepressionsAsprawlingAfairgroundsAindistinguishableAplutarchBressurizedAbanffAcoldestAbraunschweigAmackintoshAsociedadAwittgensteinAtromsoAairbaseAlecturersAattachesApurifiedAcontemplatedAdreamworksAtelephonyApropheticArocklandAaylesburyAbiscayAcoherenceAaleksandarAjudokaApageantsAthesesAhomelessnessAsitcomsAhinterlandAfifthsAderwentAprivateersAenigmaticAnationalisticAinstructsAsuperimposedAconformationAtricycleAdusanAattributableAunbeknownstAlaptopsAetchingAarchbishopsByatollahAcranialAgharbiAinterpretsAlackawannaAabingdonAsaltwaterAtoriesAlenderAminajAancillaryAranchingApembrokeshireAtopographicalAplagiarismAmurongBarqueAchameleonAassertionsAinfiltratedAguildhallAreverenceAschenectadyAformula_25AkollamAnotaryAmexicanaAinitiatesAabdicationAbasraAtheoremsAionizationAdismantlingAearedAcensorsAbudgetaryAnumeralAverlagAexcommunicatedAdistinguishableAquarriedAcagliariAhindustanAsymbolizingAwatertownAdescartesArelayedAenclosuresAmilitarilyAsaultAdevolvedBalianBjokovicAfilamentsAstauntonAtumourAcuriaAvillainousAdecentralizedAgalapagosAmonctonAquartetsAonscreenAnecropolisAbrasileiroAmultipurposeAalamosAcomarcaAjorgenAconciseAmerciaAsaitamaAbilliardsAentomologistAmontserratAlindberghAcommutingAlethbridgeAphoenicianAdeviationsAanaerobicAdenouncingAredoubtAfachhochschuleAprincipalitiesAnegrosAannouncersAsecondedAparrotsAkonamiArevivalsAapprovingAdevoteeAriyadhAovertookAmorecambeAlichenAexpressionistAwaterlineAsilverstoneAgeffenAsternitesAaspirationAbehaviouralAgrenvilleAtripuraAmediumsAgendersApyotrAcharlottesvilleAsacramentsAprogrammableBs100AshackletonAgaronneAsumerianCrpassAauthorizingAinterlockingAlagoonsAvoicelessAadvertAsteepleAboycottedAalouettesAyosefAoxidativeAsassanidAbenefitingAsayyidAnauruApredeterminedAidealismAmaxillaryApolymerizationAsemestersAmunchenAconorAoutfittedAclaphamAprogenitorAgheorgheAobservationalArecognitionsAnumericallyAcolonizedAhazratAindoreAcontaminantsAfatalityAeradicateAassyriaAconvocationBameosAskillfulCodaAcorfuCnfuciusAovertlyAramadanAwollongongAplacementsAd.c..ApermutationAcontemporaneousAvoltagesAelegansAuniversitatAsamarAplunderAdwindlingAneuterAantoninAsinhalaAcampaniaAsolidifiedBtanzasAfibrousAmarburgBodernizeAsorceryAdeutscherAfloretsAthakurAdisruptiveAinfielderAdisintegrationAinternazionaleAvicariateAeffigyAtripartiteAcorrectiveAklamathAenvironsAleavenworthAsandhurstAworkmenAcompagnieAhoseynabadAstraboApalisadesAordovicianAsigurdAgrandsonsAdefectionAviacomAsinhaleseAinnovatorAuncontrolledAslavonicAindexesArefrigerationAaircrewAsuperbikeAresumptionAneustadtAconfrontationsAarrasAhindenburgAriponAembeddingAisomorphismAdwarvesAmatchupAunisonAloftyAargosAlouthAconstitutionallyAtransitiveAnewingtonAfaceliftAdegenerationAperceptualAaviatorsAenclosingAigneousAsymbolicallyAacademicianAconstitutionalityAiso/iecAsacrificialAmaturationAapprenticesAenzymologyAnaturalisticAhajjiAarthropodsBbbessAvistulaAscuttledAgradientsApentathlonAetudesAfreedmenAmelaleucaAthriceAconductiveAsackvilleAfranciscansAstricterAgoldsAkitesAworshipedAmonsignorAtriosAorallyAtieredAprimacyAbodyworkAcastlefordAepidemicsAalveolarAchapelleCemistsAhillsboroAsoulfulAwarlordsAngatiAhuguenotAdiurnalAremarkingAlugerAmotorwaysAgaussAjahanAcutoffAproximalAbandaiAcatchphraseAjonubiAossetiaAcodenameDice_2AthroatedAitinerantAchechnyaAriverfrontAevokedBntailedAzamboangaArejoiningAcircuitryAhaymarketAkhartoumAfeudsAbracedAmiyazakiCrrenAlubuszAcaricatureAbuttressesAattritionAcharacterizesAwidnesAevanstonAmaterialismAcontradictionsAmaristBidrashAgainsboroughAulithiAturkmenAvidyaAescuelaApatricianAinspirationsAreagentApremiershipsAhumanisticAeuphratesAtransitioningAbelfryAzedongAadaptionAkaliningradAlobosAepicsAwaiverAconiferousApolydorAinducteeArefittedAmoraineAunsatisfactoryAworseningApolygamyArajyaAnestedAsubgenreAbroadsideAstampedersAlinguaAincheonApretenderBelotonCrsuadingAexcitationAmultanApredatesAtonneAbrackishAautoimmuneAinsulatedApodcastsAiraqisAbodybuildingAcondominiumsAmidlothianAdelftCbtorAasymmetricalAlycaenidaeAforcefullyApathogenicAtamaulipasAandamanAintravenousAadvancementsAsenegaleseAchronologicallyArealignedAinquirerAeusebiusAdekalbAadditivesAshortlistAgoldwaterAhindustaniAauditingAcaterpillarsApesticideAnakhonAingestionAlansdowneAtraditionalistAnorthlandAthunderbirdsAjosipAnominatingAlocaleAventricularAanimatorsAverandahAepistlesAsurveyorsAanthemsAdreddAupheavalApassaicAanatolianAsvalbardAassociativeAfloodplainAtaranakiAestuariesAirreducibleAbeginnersAhammersteinAallocateAcourseworkAsecretedAcounteractAhandwrittenAfoundationalApassoverAdiscovererBecodingAwaresAbourgeoisieAplaygroundsAnazionaleAabbreviationsAseanadAgolanAmishraAgodavariArebrandingAattendancesAbackstoryAinterruptsAletteredAhasbroAultralightAhormozganAarmeeAmoderneAsubdueAdisuseAimprovisationalAenrolmentApersistsAmoderatedAcarinthiaAhatchbackAinhibitoryAcapitalizedAanatolyBbstractsBlbemarleAbergamoAinsolvencyAsentaiAcellarsAwalloonAjokedAkashmiriAdiracAmaterializedArenominationAhomologousAgustsAeighteensAcentrifugalAstoriedAbaluchestanAformula_26ApoincareAvettelAinfuriatedAgaugesAstreetcarsAvedantaAstatelyAliquidatedAgoguryeoAswiftsAaccountancyAleveeAacadianAhydropowerAeustaceAcominternAallotmentAdesignatingAtorsionAmoldingAirritationAaerobicAhalenAconcertedAplantingsAgarrisonedBramophoneAcytoplasmAonslaughtArequisitionedClievingAgenitiveAcentristAespanolaAdissolvingAchatterjeeAsparkingAconnaughtAvareseAarjunaAcarpathianAempoweringAmeteorologistAdecathlonAopioidAhohenzollernAfencedAibizaAavionicsAfootscrayAscrumAdiscountsAfilamentAdirectoriesAa.f.cAstiffnessAquaternaryAadventurersAtransmitsAharmoniousAtaizongAradiatingAgermantownAejectionAprojectorsAgaseousAnahuatlAvidyalayaAnightlifeAredefinedCfutedAdestituteAaristaApottersAdisseminatedDtancedAjamboreeAkaohsiungAtiltedAlakeshoreAgrainedAinflictingAkreisAnovelistsAdescendentsAmezzanineArecastAfatahAderegulationAac/dcBustralisAkohgiluyehAborealAgothsAauthoringAintoxicatedAnonpartisanAtheodosiusApyongyangAshreeAboyhoodAsanflAplenipotentiaryBhotosynthesisBresidiumAsinaloaAhonshuAtexanAavenidaAtransmembraneAmalaysAacropolisAcatalunyaAvasesAinconsistenciesAmethodistsAquellAsuisseAbanatAsimcoeAcercleAzealandersAdiscreditedAequineAsagesAparthianAfascistsAinterpolationAclassifyingAspinoffAyehudaAcruisedAgypsumAfoaledAwallachiaAsaraswatiAimperialistAseabedAfootnotesAnakajimaAlocalesAschoolmasterAdrosophilaAbridgeheadAimmanuelAcourtierAbooksellerAniccoloAstylisticallyAportmanteauAsuperleagueAkonkaniAmillimetresAarborealAthanjavurAemulationAsoundersAdecompressionAcommonersAinfusionAmethodologicalAosageArococoAanchoringAbayreuthAformula_27AabstractingAsymbolizedAbayonneAelectrolyteArowedAcorvettesAtraversingAeditorshipAsamplerApresidioAcurzonAadirondackAswahiliArearingAbladedAlemurApashtunAbehavioursBottlingAzaireArecognisableAsystematicsAleewardAformulaeAsubdistrictsBmithfieldAvijayaAbuoyancyBoostingAcantonalArishiAairflowAkamakuraAadanaAemblemsAaquiferAclusteringAhusaynAwoollyBineriesAmontessoriAturntableAexponentiallyAcavernsAespousedApianistsAvorpommernBicenzaAlatterlyAo'rourkeAwilliamstownAgeneraleAkosiceAduisburgAmarshyBismanagementBandalayAdagenhamAuniversesAchiralAradiatedAstewardsAcrankshaftAkyrgyzAamphibianAcymbalsAinfrequentlyAoffenbachAenvironmentalistArepatriatedApermutationsAmidshipmenAloudounArefereedAbambergAornamentedAnitricAselimAtranslationalAdorsumAannunciationAgippslandAreflectorAinformationalAregiaCactionaryAahmetAweatheringAerlewineAlegalizedAberneAoccupantAdivasAmanifestsAanalyzesAdisproportionateAmitochondriaAtotalitarianApaulistaAinterscopeAanarchoAcorrelateAbrookfieldAelongateAbrunelAordinalAprecinctsAvolatilityAequaliserAhittiteAsomalilandAticketingAmonochromeAubuntuAchhattisgarhAtitleholderAranchesBeferendumsAbloomsAaccommodatesAmerthyrAreligiouslyByukyuAtumultuousAcheckpointsAanodeAmi'kmaqAcannonballApunctuationAremodelledAassassinationsAcriminologyAalternatesAyongeApixarAnamibianApiraeusAtrondelagAhautesAlifeboatsAshoalAatelierAvehementlyAsadatApostcodeAjainismAlycomingAundisturbedAlutheransAgenomicsApopmattersAtabrizAisthmianAnotchedAautisticAhorshamAmitesAconseilAbloomsburyAcybertronAidrisAoverhauledAdisbandmentAidealizedAgoldfieldsAworshippersAlobbyistAailmentsApaganismAherbariumAatheniansAmesserschmittAfaradayAentangledA'olyaAuntreatedAcriticisingAhowitzersAparvatiAlobedAdebussyAatonementAtadeuszApermeabilityAmueangAsepalsAdegliAoptionallyAfuelledBolliesAasteriskApristinaAlewistonAcongestedAoverpassAaffixedApleadsAtelecastsAstanislausAcryptographicAfrieslandAhamstringAselkirkAantisubmarineAinundatedAoverlayAaggregatesAtrolleybusAsaganAibsenBnducteesAbeltwayAtiledAladdersAcadburyAlaplaceAasceticAmicronesiaAconveyingAbellinghamAcleftAbatchesAusaidAconjugationAmacedonAassisiAreappointedAbrineAjinnahAprairiesAscreenwritingAoxidizedAdespatchesAlinearlyAfertilizersAbraziliansAabsorbsAwaggaAmodernisedAscorseseAashrafAcharlestownAesqueAhabitableAnizhnyAlettresAtuscaloosaAesplanadeAcoalitionsBarbohydratesAlegateAvermilionAstandardisedAgalleriaApsychoanalyticArearrangementAsubstationAcompetencyAnationalisedAreshuffleCconstructionsAmehdiAbougainvilleAreceivershipAcontraceptionAenlistmentAconduciveAaberystwythAsolicitorsAdismissesAfibrosisAmontclairAhomeownerAsurrealismB.h.i.e.l.dAperegrineAcompilersA1790sAparentageClmasArzeszowAworldviewAeasedAsvenskaAhousemateAbundestagAoriginatorAenlistingAoutwardsAreciprocityAformula_28AcarbohydrateAdemocraticallyAfirefightingAromagnaAacknowledgementAkhomeiniAcarbideAquestsAvedasAcharacteristicallyAguwahatiAbrixtonAunintendedAbrothelsAparietalAnamurAsherbrookeAmoldavianAbaruchAmilieuAundulatingAlaurierAentreAdijonAethyleneAabileneAheraclesAparallelingAceresAdundalkAfalunAchisinauApolarityAforeclosureAtemplatesAojibweApunicAerikssonAbidenBachchanAglaciationAspitfiresAnorskCnviolentAheideggerAalgonquinAcapacitanceCssettesAbalconiesAallelesBirdateAconveysAreplaysAclassifiesAinfrequentAamineAcuttingsArarerAwokingAolomoucAamritsarArockabillyAillyrianAmaoistApoignantAtemporeAstalinistBegmentedAbandmateAmolluscBuhammedAtotalledAbyrdsAtenderedAendogenousAkottayamAaisneAoxidaseBverhearsAillustratorsAverveAcommercializationApurplishAdirectvAmouldedAlytteltonAbaptismalAcaptorsAsaracensAgeorgiosAshortenApolityAgridsAfitzwilliamAscullsAimpuritiesAconfederationsAakhtarAintangibleAoscillationsAparabolicAharlequinAmaulanaAovateAtanzanianAsingularityAconfiscationAqazvinAspeyerAphonemesAovergrownAvicarageAgurionAundocumentedAniigataAthronesApreambleAstaveAintermentAliigaAataturkBphroditeAgroupeAindenturedAhabsburgsAcaptionAutilitarianAozarkAslovenesAreproductionsAplasticityAserboAdulwichAcastelAbarbudaAsalonsAfeudingAlenapeAwikileaksAswamyAbreuningAsheddingAafieldAsuperficiallyAoperationallyAlamentedAokanaganAhamadanAaccoladeAfurtheringAadolphusAfyodorAabridgedAcartoonistsApinkishAsuhartoAcytochromeAmethylationAdebitAcolspan=9|ArefineAtaoistAsignalledAherdingAleavedAbayanAfatherlandArampartAsequencedAnegationAstorytellerAoccupiersAbarnabasApelicansAnadirAconscriptedArailcarsAprerequisiteAfurtheredAcolumbaBarolinasAmarkupAgwaliorAfrancheAchacoAeglintonArampartsCngoonAmetabolitesApollinationAcroatAtelevisaAholyokeAtestimonialAsetlistBafavidBendaiAgeorgiansAshakespeareanAgalleysAregenerativeAkrzysztofAovertonesAestadoAbarbaryAcherbourgAobispoAsayingsAcompositesAsainsburyAdeliberationAcosmologicalAmahallehAembellishedAascapAbialaApancrasAcalumetAgrandsAcanvasesAantigensAmarianasAdefensemanAapproximatedAseedlingsBorenBteleAnuncioAimmunologyAtestimoniesAglossaryArecollectionsAsuitabilityAtampereAvenousAcohomologyAmethanolAivanovichAwarmlyAsterilizationAimranAmultiplyingAwhitechapelAunderseaAxuanzongAtacitusAbayesianAroundhouseAcorrelationsAriotersAmoldsAfiorentinaAbandmatesAmezzoAthaniAguerillaA200thApremiumsAtamilsAdeepwaterAchimpanzeesAtribesmenAselwynAgloboAturnoversApunctuatedAerodeAnouvelleAbanburyAexponentsAabolishingAhelicalAmaimonidesAendothelialAgoteborgAinfieldAencroachmentAcottonwoodAmazowieckiAparableAsaarbruckenArelieverAepistemologyAartistesAenrichArationingAformula_29ApalmyraAsubfamiliesAkauaiAzoranAfieldworkAarousalAcreditorAfriuliAceltsBomorosAequatedBscalationAnegevAtalliedAinductiveAanionAnetanyahuAmesoamericanAlepidopteraAaspiratedAremitAwestmorlandAitalicAcrosseAvaclavAfuegoAowainAbalmainAvenetiansAethnicitiesAdeflectedAticinoAapuliaBustereAflycatcherAreprisingEessiveAhauptbahnhofAsubtypeAophthalmologyAsummarizesAeniwetokAcolonisationAsubspaceAnymphalidaeAearmarkedAtempeAburnetAcrestsAabbotsAnorwegiansAenlargeAashokaAfrankfortAlivornoAmalwareArentersAsinglyAiliadAmoresbyArookiesAgustavusAaffirmingBllegesAlegumeAchekhovAstuddedAabdicatedAsuzhouAisidoreAtownsiteArepaymentAquintusAyankovicAamorphousAnarrowingAindustrialistsAtanganyikaAcapitalizationBonnectiveAmughalsAraritiesAaerodynamicsAworthingAantalyaAdiagnosticsAshaftesburyAthracianAobstetricsAbenghaziAmultiplierAorbitalsAlivoniaAroscommonAintensifyAravelAoathsBverseerAlocomotionAnecessitiesAchickasawAstrathclydeAtrevisoAerfurtAaorticAcontemplationAaccringtonAmarkaziApredeceasedAhippocampusAwhitecapsAassemblymanAincursionAethnographyBxtraligaAreproducingAdirectorshipAbenzeneBywayAstupaAtaxableAscottsdaleAonondagaAfavourablyAcountermeasuresAlithuaniansAthatchedAdeflectionAtarsusAconsulsAannuityAparalleledAcontextualAanglianAklangAhoistedAmultilingualAenactingAsamajAtaoiseachAcarthaginianAapologisedAhydrologyAentrantAseamlessAinflorescencesAmugabeAwesternersAseminariesAwinteringApenzanceAmitreAsergeantsAunoccupiedAdelimitationBiscriminateAupriverAabortiveAnihonAbessarabiaAcalcareousAbuffaloesApatilAdaeguAstreamlineAberksAchaparralAlaityAconceptionsAtypifiedAkiribatiAthreadedAmattelAeccentricityAsignifiedApatagoniaAslavoniaAcertifyingAadnanBstleyAseditionAminimallyAenumeratedAnikosAgoallessAwalidAnarendraAcausaAmissoulaAcoolantAdalekAoutcropAhybridizationAschoolchildrenApeasantryAafghansAconfucianismAshahrAgallicAtajikAkierkegaardAsauvignonAcommissarApatriarchsAtuskegeeAprussiansAlaoisAricansAtalmudicAofficiatingAaestheticallyAbalochAantiochusAseparatistsBuzeraintyAarafatAshadingAu.s.cAchancellorsAinc..AtoolkitAnepenthesAerebidaeAsolicitedApratapAkabbalahAalchemistAcaltechAdarjeelingAbiopicAspillwayAkaiserslauternAnijmegenAbolsteredAneathApahlaviAeugenicsAbureausAretookAnorthfieldAinstantaneousAdeerfieldAhumankindAselectivityAputativeAboardersAcornhuskersAmarathasAraikkonenAaliabadAmangrovesAgaragesBulchAkarzaiApoitiersAchernobylAthaneAalexiosAbelgranoAscionBolubilityAurbanizedAexecutableAguizhouAnucleicAtripledAequalledAharareBouseguestsApotencyAghaziArepeaterAoverarchingAregroupedAbrowardAragtimeAd'artAnandiAregaliaAcampsitesAmamlukAplatingAwirralApresumptionAzenitAarchivistAemmerdaleAdecepticonAcarabidaeAkagoshimaAfranconiaAguaraniAformalismAdiagonallyAsubmarginalAwalkwaysApuntsAmetrolinkAhydrographicAdropletsAuppersideAmartyredAhummingbirdAantebellumAcuriouslyAmuftiAfriaryAchabadBzechsAshaykhAreactivityAberkleeAturbonillaBonganAsultansAwoodvilleAunlicensedAenmityAdominicansAoperculumAquarryingAwatercolourAcatalyzedAgatwickAmesozoicAauditorsAshizuokaAfootballingAhaldaneAtelemundoAappendedAdeductedBisseminateAo'sheaApskovAabrasiveAententeAgautengAcalicutAlemursAelasticityAsuffusedBcopulaBtainingAupholdingAexcessesAshostakovichAloanwordsAnaiduAchampionnatCromatographyAboastingAgoaltendersAengulfedAsalahAkilogramAmorristownAshinglesD'aAlabourerArenditionsAfrantisekAjekyllAzonalAnandaAsheriffsAeigenvaluesAdivisioneAendorsingAusheredAauvergneAcadresArepentanceAfreemasonsAutilisingAlaureatesAdiocletianAsemiconductorsAo'gradyAvladivostokAsarkozyAtrackageAmasculinityAhydroxylAmervynBusketsAspeculationsAgridironAopportunisticAmascotsAaleutianAfilliesAsewerageAexcommunicationAborrowersAcapillaryAtrendingAsydenhamCnthpopArajahAcagayanAdeportesAkedahAfaureAextremismAmichoacanAlevskiAculminatesAoccitanAbioinformaticsAunknowinglyAincitingAemulatedAfootpathsApiacenzaAdreadnoughtAviceroyaltyAoceanographicAscoutedAcombinatorialAornithologistAcannibalismAmujahideenAindependienteAciliciaAhindwingAminimizedAodeonAgyorgyArublesApurchaserAcollieriesAkickersAinterurbanAcoiledAlynchburgArespondentAplzenAdetractorsAetchingsAcenteringAintensificationAtomographyAranjitAwarblersAretellingCinstatementAcauchyAmodulusAredirectedAevaluatesAbeginnerAkalatehAperforatedAmanoeuvreAscrimmageAinternshipsAmegawattsBottledAhaakonAtunbridgeAkalyanAsummarisedCkarnoAquettaAcanonizedAhenrykAagglomerationAcoahuilaAdilutedAchiropracticAyogyakartaAtalladegaAsheikAcationAhaltingAreprisalsAsulfuricAmusharrafAsympathizersApublicisedAarlesAlectionaryAfracturingAstartupsBanghaAlatrobeArideauAligamentsAblockadingAcremonaAlichensAfabaceaeAmodulatedAevocativeBmbodiesAbatterseaAaltaiAsubsystemAacidityAsomaticAformula_30ArationalityAsortieAashlarApokalAcytoplasmicAvalourAbanglaAdisplacingAhijackingAspectrometryAwestmeathCillAcharingAgoiasArevolversAindividualizedAtenuredAnawazApiquetAchantedAdiscardAberndAphalanxAreworkingAunilaterallyAsubclassAyitzhakApilotingAcircumventAdisregardedAsemicircularAviscousAtibetansAendeavoursAretaliatedAcretanAvienneAworkhouseAsufficiencyAaurangzebAlegalizationBipidsAexpanseBintrachtAsanjakAmegasA125thAbahrainiAyakimaAeukaryotesAthwartAaffirmationApeloponneseAretailingAcarbonylBhairwomanAmacedoniansAdentateArockawayAcorrectnessAwealthierAmetamorphicAaragoneseAfermanaghApituitaryAschrodingerAevokesAspoilerAchariotsAakitaAgenitaliaAcombeCnfectioneryAdesegregationAexperientialAcommodoresApersepolisAviejoArestorationsAvirtualizationAhispaniaAprintmakingAstipendAyisraelAtheravadaAexpendedAradiumAtweetedApolygonalAlippeAcharenteAleveragedAcutaneousAfallacyBragrantAbypassesAelaboratelyArigidityAmajidDorcaAkongoAplasmodiumAskitsAaudiovisualAeersteAstaircasesApromptsAcoulthardAnorthwestwardAriverdaleAcopyrightsAprudentialAcommunicatesAmatedAobscenityAasynchronousBnalyseAhansaAsearchlightAfarnboroughApatrasAasquithAqarahAcontoursAfumbledApasteurAredistributedAsanctuariesAjewryAisraeliteAcliniciansAkoblenzAbookshopAaffectiveAgoulburnApanelistAsikorskyAcobhamAmimicsAringedAportraitureBrobabilisticAgirolamoAintelligibleAandalusianAjalalAathenaeumAeritreanAauxiliariesApittsburgAdevolutionAsangamAisolatingAanglersAcronullaAannihilatedAkidderminsterAsynthesizeApopularisedAtheophilusAbandstandAinnumerableAchagrinAretroactivelyAweserAmultiplesAbirdlifeAgoryeoApawneeAgrosserCapplingAtactileAahmadinejadAturbopropAerdoganAmatchdayAproletarianAadheringAcomplementsAaustronesianBdvertsAluminariesAarcheologyAimpressionismAconiferAsodomyAinterracialAplatoonsAlessenApostingsBejorativeAregistrationsAcookeryApersecutionsAmicrobesAauditsAidiosyncraticAsubspCspensionsArestrictsAcolouringAratifyAinstrumentalsAnucleotidesAsullaApositsAbibliothequeAdiametersAoceanographyAinstigationAsubsumedDmachineAacceptorAlegationAborrowsAsedgeAdiscriminatedAloavesAinsurersAhighgateAdetectableAabandonsAkilnsAsportscasterAharwichAiterationsApreaknessAarduousAtensileAprabhuAshortwaveAphilologistAshareholdingAvegetativeAcomplexitiesCuncilorsAdistinctivelyArevitalizeAautomatonBmassingAmontreuxAkhanhAsurabayaAnurnbergApernambucoAcuisinesBharterhouseAfirstsAterceraAinhabitantAhomophobiaAnaturalismAeinarApowerplantAcorunaAentertainmentsAwhedonArajputsCtonAdemocraciesAarunachalAoeuvreAwalloniaAjeddahAtrolleybusesAevangelismAvosgesAkiowaAminimiseAencirclementAundertakesAemigrantAbeaconsAdeepenedAgrammarsApubliusBreeminentAseyyedArepechageAcraftingAheadingleyAosteopathicAlithographyAhotlyAblighAinshoreAbetrothedAolympiansAformula_31AdissociationAtrivandrumAarranApetrovicAstettinAdisembarkedAsimplificationAbronzesAphiloAacrobaticAjonssonAconjecturedAsuperchargedAkantoAdetectsAcheesesBorrelatesAharmonicsAlifecycleAsudamericanaAreservistsAdecayedAelitserienAparametricA113thAduskyAhogarthAmoduloAsymbioticAmonopoliesAdiscontinuationAconvergesAsouthernersAtucumanAeclipsesBnclavesBmitsAfamicomAcaricaturesAartisticallyAlevelledAmusselsAerectingAmouthpartsAcunardAoctavesAcrucibleAguardiaAunusableAlagrangianAdroughtsAephemeralApashtoAcanisAtaperingAsaseboBilurianAmetallurgicalAoutscoredAevolvesAreissuesAsedentaryAhomotopyAgreyhawkAreagentsAinheritingAonshoreAtiltingArebuffedCusableAnaturalistsAbasingstokeAinsofarAoffensivesAdravidianAcuratorsAplanksArajanAisoformsAflagstaffApresideAglobularAegalitarianAlinkagesAbiographersAgoalscorersAmolybdenumAcentralisedAnordlandAjuristsAellesmereArosbergAhideyoshiArestructureAbiasesBorrowerAscathingAredressAtunnellingAworkflowAmagnatesChendraAdissentersAplethoraAtranscriptionsAhandicraftsAkeywordAxi'anApetrogradAunserAprokofievA90degAmadanAbataanAmaroniteAkearnyAcarmarthenAterminiAconsulatesAdisallowedArockvilleAboweryAfanzineAdocklandsAbestsAprohibitionsAyeltsinAselassieAnaturalizationArealisationAdispensaryAtribecaAabdulazizApocahontasAstagnationApamplonaAcuneiformApropagatingAsubsurfaceAchristgauAepitheliumAschwerinAlynchingAroutledgeAhanseaticAupanishadAglebeAyugoslavianAcomplicityAendowmentsAgironaAmynetworktvAentomologyAplinthAba'athAsupercupAtorusAakkadianAsaltedAenglewoodAcommanderyAbelgaumAprefixedAcolorlessAdartfordAenthronedAcaesareaAnominativeAsandownCfeguardsAhulledAformula_32AleamingtonAdieppeAspearheadAgeneralizationsAdemarcationAllanelliAmasqueAbrickworkArecountingAsufismBtrikinglyApetrochemicalAonslowAmonologuesAemigratingAanderlechtAsturtAhosseinAsakhalinBubductionAnovicesAdeptfordAzanjanAairstrikesAcoalfieldAreintroductionAtimbalandAhornbyAmessianicAstingingAuniversalistAsituationalAradiocarbonAstrongmanArowlingAsaloonsAtraffickersAoverranAfribourgAcambraiAgravesendAdiscretionaryAfinitelyAarchetypeBssessorApilipinasAexhumedAinvocationCteractedAdigitizedAtimisoaraAsmelterAtetonAsexismApreceptsAsrinagarApilsudskiAcarmeliteAhanauAscorelineAhernandoAtrekkingAbloggingAfanbaseAwieldedAvesiclesAnationalizationAbanjaAraftsAmotoringAluangAtakedaAgirderAstimulatesAhistoneAsundaAnanoparticlesAattainsAjumpersAcataloguedAalludingApontusAancientsAexaminersAshinkansenAribbentropBeimbursementApharmacologicalAramatAstringedAimposesAcheaplyAtransplantedBaipingAmizoramAloomsAwallabiesAsidemanAkootenayAencasedAsportsnetArevolutionizedAtangierAbenthicArunicApakistanisAheatseekersAshyamAmishnahApresbyteriansAstadtButrasBtraddlesAzoroastrianAinferAfuelingAgymnastsAofcomAgunfightAjourneymanAtracklistAoshawaAps500Ba'inAmackinacAxiongnuAmississippianAbreckinridgeAfreemasonAbightAautorouteAliberalizationAdistantlyAthrillersAsolomonsApresumptiveAromanizationAanecdotalAbohemiansAunpavedAmilderAconcurredAspinnersAalphabetsAstrenuousArivieresAkerrangAmistreatmentAdismountedAintensivelyAcarlistAdancehallAshuntingApluralismAtraffickedAbrokeredBonaventureBromideAneckarAdesignatesAmalianAreversesAsothebyCrghumBerineAenvironmentalistsAlanguedocAconsulshipAmeteringAbankstownAhandlersAmilitiamenAconformingAregularityApondicherryAarminAcapsizedBonsejoBapitalistsAdroghedaAgranularApurgedAacadiansAendocrineAintramuralAelicitAternsAorientationsAmiklosAomittingAapocryphalAslapstickAbreconAplioceneAaffordsAtypographyAemigreAtsaristBomaszAbesetAnishiBecessitatingAencyclicalAroleplayingAjourneyedAinflowAsprintsAprogressivesAnovosibirskAcameroonianAephesusAspeckledAkinshasaAfreiherrAburnabyAdalmatianAtorrentialArigorBenegadesAbhaktiAnurburgringAcosimoCnvincinglyArevertingAvisayasAlewishamAcharlottetownEadriiformesfamilyAtransferableAjodhpurAconvertersAdeepeningAcamshaftAunderdevelopedAproteaseBoloniaAuterineAquantifyAtobrukAdealershipsAnarasimhaAfortranAinactivityA1780sAvictorsAcategorisedAnaxosAworkstationAskinkBardinianAchaliceAprecedeAdammedAsondheimAphineasAtutoredAsourcingAuncompromisingAplacerAtynesideAcourtiersAproclaimsBharmaciesAhyogoAbooksellersAsengokuAkurskAspectrometerAcountywideAwielkopolskiAbobsleighAshettyAllywelynAconsistoryAhereticsAguineanAclichesAindividualismAmonolithicAimamsAusabilityAbursaAdeliberationsArailingsAtorchwoodAinconsistencyAbalearicAstabilizerAdemonstratorAfacetAradioactivityAoutboardAeducatesAd'oylyAhereticalBandoverAjurisdictionalAshockwaveAhispaniolaAconceptuallyAroutersAunaffiliatedAtrentinoAformula_33AcypriotsAintervenesAneuchatelAformulatingAmaggioreAdelistedAalcoholsAthessalyApotableAestimatorAsuborderAfluencyAmimicryAclergymenAinfrastructuresArivals.comAbarodaAsubplotAmajlisAplanoAclinchingBonnotationBarinaeAsavileAinterculturalAtranscriptionalAsandstonesAaileronsBnnotationsAimpresarioAheinkelAscripturalAintermodalAastrologicalAribbedAnortheastwardApositedAboersAutiliseAkalmarAphylumAbreakwaterAskypeAtexturedAguidelineAazeriAriminiAmassedAsubsidenceAanomalousAwolfsburgApolyphonicAaccreditingAvodacomAkirovAcaptainingAkelantanAlogieAferventAeamonAtaperAbundeswehrAdisproportionatelyCvinationAslobodanApunditsAhispanoAkineticsAreunitesAmakatiAceasingAstatisticianAamendingAchilternAeparchyAriverineAmelanomaAnarragansettApagansAragedAtoppledAbreachingAzadarAholbyAdacianAochreAvelodromeAdisparitiesAamphoeAsedansAwebpageBilliamsportAlachlanAgrotonAbaringAswastikaAheliportAunwillingnessArazorbacksAexhibitorsAfoodstuffsAimpactingAtitheAappendagesAdermotAsubtypesAnurseriesAbalineseAsimulatingBtaryAremakesAmundiAchautauquaAgeologicallyAstockadeAhakkaAdiluteAkalimantanApahangAoverlappedAfrederictonAbaha'u'llahAjahangirAdampingAbenefactorsAshomaliAtriumphalAcieszynAparadigmsAshieldedAreggaetonAmaharishiAzambianAshearingAgolestanAmirroringApartitioningAflyoverAsongbookAincandescentAmerrimackAhuguenotsAsangeetAvulnerabilitiesAtrademarkedAdrydockAtantricAhonorisAqueenstownAlabellingAiterativeAenlistsAstatesmenAanglicansAhergeAqinghaiAburgundianAislamiAdelineatedAzhugeAaggregatedAbanknoteAqatariAsuitablyAtapestriesAasymptoticAcharleroiAmajoritiesApyramidellidaeAleaningsAclimacticAtahirAramsarAsuppressorArevisionistAtrawlerAernakulamApenicilliumAcategorizationAslitsAentitlementAcollegiumAearthsAbeneficeApinochetBuritansAloudspeakerAstockhausenAeurocupAroskildeAaloisAjaroslavArhonddaAboutiquesAvigorAneurotransmitterAansarAmaldenAferdinandoAsportedArelentedAintercessionAcamberwellAwettestAthunderboltsApositionalAorielAcloverleafApenalizedAshoshoneArajkumarAcompletenessAsharjahAchromosomalAbelgiansAwoolenAultrasonicAsequentiallyAboleynAmordellaBicrosystemsAinitiatorAelachistaAmineralogyArhododendronAintegralsAcompostelaAhamzaAsawmillsBtadioAberliozAmaidensAstoneworkAyachtingAtappehAmyocardialAlaborerAworkstationsAcostumedAnicaeaAlanarkAroundtableAmashhadAnablusAalgonquianAstuyvesantBarkarAheroinesAdiwanAlamentsAintonationDriguesAalmatyAfeudedAgrandesAalgarveArehabilitateAmacrophagesAcruciateAdismayedAheuristicAeliezerAkozhikodeAcovalentAfinalisedAdimorphismAyaroslavlAovertakingAleverkusenAmiddleburyAfeedersAbrookingsAspeculatesAinsolubleAlodgingsAjozsefAcysteineAshenyangAhabilitationAspuriousAbrainchildAmtdnaAcomiqueAalbedoArecifeApartickAbroadeningAshahiAorientatedAhimalayaAswabiaApalmeAmennonitesAspokeswomanAconscriptsAsepulchreAchartresAeurozoneAscaffoldAinvertebrateAparishadAbaganAheianAwatercolorsAbasseAsupercomputerAcommencesAtarragonaAplainfieldAarthurianAfunctorAidenticallyAmurexAchroniclingApressingsAburrowingAhistoireAguayaquilBoalkeepingAdifferentiableAwarburgAmachiningAaeneasAkanawhaAholoceneAramessesBeprisalAqingdaoAavatarsAturkestanAcantatasAbesiegingArepudiatedAteamstersAequippingAhydrideAahmadiyyaAeustonAbottleneckAcomputationsAterengganuAkalingaAstelaArediscoveryAazharAstylisedAkareliaApolyethyleneAkansaiAmotorisedAloungesAnormalizationAcalculatorsA1700sAgoalkeepersAunfoldedAcommissaryBubismAvignettesAmultiverseAheatersAbritonAsparinglyAchildcareAthoriumAplockAriksdagAeunuchsAcatalysisAlimassolAperceAuncensoredAwhitlamAulmusBnitesAmesopotamianArefractionAbiodieselAforzaBuldaAunseatedAmountbattenAshahrakBeleniumAosijekAmimickingAantimicrobialBxonsAsimulcastingAdonizettiAswabianBportsmenAhafizAnearedAheracliusAlocatesAevadedAsubcarpathianAbhubaneswarAnegeriAjagannathAthaksinAaydinAoromoAlateranAgoldsmithsAmulticulturalismAciliaAmihaiAevangelistsAlorientAqajarApolygonsAvinodAmechanisedAanglophoneAprefabricatedAmossesAsupervillainAairlinersAbiofuelsAiodideBnnovatorsAvalaisAwilberforceAlogarithmAintelligentsiaAdissipationAsanctioningAduchiesAaymaraAporchesAsimulatorsAmostarAtelepathicAcoaxialBaithnessAburghsAfourthsAstratificationAjoaquimAscribesAmeteoritesBonarchistAgerminationAvriesAdesiringAreplenishmentAistriaAwinemakingAtammanyBroupesAhetmanAlanceolateApelagicAtriptychAprimeiraAscantAoutboundAhyphaeAdenserAbenthamBasieAnormaleAexecutesAladislausAkontinentalAheratAcruiserweightAactivisionAcustomizationAmanoeuvresAinglewoodAnorthwoodAwaveformAinvestitureCpatientAalignmentsAkiryatArabatAarchimedesAustadAmonsantoAarchetypalAkirkbyAsikhismAcorrespondinglyBatskillAoverlaidApetrelsAwidowersAunicameralAfederalistsAmetalcoreAgamerankingsAmusselAformula_34AlymphocytesAcysticAsouthgateAvestigesAimmortalsAkalamAstroveAamazonsApoconoAsociologistsCpwithAadheresAlaurensAcaregiversAinspectingAtransylvanianArebroadcastBhenishAmiserablesApyramsAbloisAnewtonianAcarapaceAredshirtAgotlandAnazirAunileverAdistortionsAlinebackersAfederalismAmombasaAlumenAbernoulliAfavouringAaligarhAdenounceAsteamboatsAdnieperAstratigraphicBynthsAberneseAumassAicebreakerAguanajuatoAheisenbergAboldlyAdiodesAladakhAdogmaticAscriptwriterAmaritimesAbattlestarAsymposiaAadaptableAtolucaAbhavanAnankingAieyasuApicardyAsoybeanAadalbertAbromptonAdeutschesAbrezhnevAglandularAlaotianAhispanicizedAibadanApersonificationAdalitAyamunaAregioAdispensedAyamagataAzweibruckenArevisingAfandomAstancesAparticipleAflavoursAkhitanAvertebralAmayaguezAdispensationAgunturAundefinedAharpercollinsAunionismAmeenaAlevelingArefractoryAtelstraAjudeaAattenuationApylonsAelaborationCegyBdgingAgracillariidaeAresidenciesAabsentiaAreflexiveAdeportationsBichotomyAstovesBanremoBhimonAmenachemAcornealCnifersAmordellidaeAfacsimileAdiagnosesAcowperBittaAviticultureAdivisiveAriverviewAfoalsAmysticsApolyhedronBlazasAairspeedAredgraveAimpedeAmultiplicityAbarrichelloAairshipsApharmacistsAharvesterAclaysApayloadsAdifferentiatingApopularizeAcaesarsAtunnelingAstagnantAcircadianAindemnityAsensibilitiesAmusicologyAprefectsAserfsAmetraAlillehammerAcarmarthenshireAkiosksAwellandAbarbicanAalkylAtillandsiaAgatherersAasociacionAshowingsAbharatiBrandywineAsubversionBcalableApfizerAdawlaAbariumAdardanellesAnsdapAkonigAayutthayaAhodgkinAsedimentationAcompletionsApurchasersAsponsorshipsAmaximizingAbankedAtaoismAminotAenrollsAfructoseAaspiredAcapuchinAoutagesAartoisAcarrolltonAtotalityAosceolaApawtucketAfontainebleauAconvergedAqueretaroAcompetenciesAbothaAallotmentsAsheafCastriAobliquelyAbandingAcatharinesAoutwardlyAmonchengladbachAdriestAcontemplativeBassiniArangaApunditAkenilworthAtiananmenAdisulfideAformula_35AtownlandsAcodice_3AloopingAcaravansArachmaninoffAsegmentationAfluorineAanglicisedAgnosticAdessauBiscernAreconfiguredAaltrinchamAreboundingAbattlecruiserAramblersA1770sAconvectiveAtriompheAmiyagiBournersAinstagramAaloftAbreastfeedingAcourtyardsAfolkestoneAchangshaAkumamotoAsaarlandAgrayishAprovisionallyAappomattoxAuncialAclassicismAmahindraAelapsedAsupremesAmonophyleticAcautionedAformula_36AnoblewomanAkernelsAsucreBwapsAbengaluruAgrenfellAepicenterArockhamptonAworshipfulAlicentiateAmetaphoricalBalankaraAamputatedAwattleApalawanAtankobonAnobunagaApolyhedraAtransductionAjilinAsyriansAaffinitiesAfluentlyAemanatingAanglicizedAsportscarAbotanistsAaltonaAdravidaAchorleyAallocationsAkunmingAluandaApremieringAoutlivedAmesoamericaAlingualAdissipatingAimpairmentsAattenboroughAbalustradeAemulatorAbakhshAcladdingAincrementsAascentsAworkingtonAqal'ehAwinlessAcategoricalApetrelAemphasiseAdormerAtorosAhijackersAtelescopicAsolidlyAjankovicAcessionAgurusAmadoffAnewryAsubsystemsAnorthsideAtalibAenglishmenAfarneseAholographicAelectivesAargonneAscrivenerApredatedAbruggeAnauvooAcatalysesAsoaredBiddeleyAgraphicallyApowerliftingAfunicularAsungaiAcoerciveAfusingAuncertaintiesAlocosAaceticAdivergeAwedgwoodAdressingsAtiebreakerAdidacticAvyacheslavAacreageAinterplanetaryAbattlecruisersAsunburyAalkaloidsAhairpinAautomataAwielkieAinterdictionApluginsAmonkeesAnudibranchAesporteAapproximationsAdisablingApoweringAcharacterisationAecologicallyAmartinsvilleAtermenAperpetuatedAlufthansaAascendancyAmotherboardAbolshoiAathanasiusAprunusAdilutionAinvestsAnonzeroAmendocinoAcharanAbanqueAshaheedAcountercultureAunitaAvoivodeAhospitalizationAvapourAsupermarineAresistorAsteppesAosnabruckAintermediatesAbenzodiazepinesAsunnysideAprivatizedAgeopoliticalApontaAbeershebaAkievanAembodyAtheoreticAsanghAcartographerAbligeArotorsAthruwayAbattlefieldsAdiscernibleBemobilizedAbroodmareAcolourationAsagasApolicymakersAserializationAaugmentationAhoareAfrankfurterAtransnistriaAkinasesAdetachableAgenerationalAconvergingAantiaircraftAkhakiAbimonthlyAcoadjutorAarkhangelskAkannurAbuffersAlivonianAnorthwichAenvelopedAcystsAyokozunaAherneAbeechingAenronAvirginianAwoollenAexceptingAcompetitivelyAouttakesArecombinantAhillcrestAclearancesApatheAcumbersomeAbrasovAu.s.aAlikudAchristianiaBruciformAhierarchiesAwandsworthAresinsAsitarAelectrochemicalAmediacorpAtyphusAgrenadiersAhepaticApompeiiAweightlifterAbosniakAoxidoreductaseAundersecretaryArescuersBanjiAseleucidAanalysingAexegesisAtenancyBoureAkristiansandA110thAcarillonAminesweepersApoitouAaccededApalladianAredevelopAnaismithArifledAproletariatAshojoAhackensackCrvestsAendpointAkubanArosenborgAstonehengeAauthorisationAjacobeanArevocationAcompatriotsCllidingAundeterminedAokayamaAacknowledgmentBngelouAfresnelAchaharAetherealAmg/kgAemmetAmobilisedAunfavourableAculturaBharacterizingAparsonageAskepticsAexpresswaysArabaulAmedeaAguardsmenAvisakhapatnamAcaddoAhomophobicAelmwoodBncirclingAcoexistenceCntendingAseljukAmycologistAinfertilityAmoliereAinsolventAcovenantsAunderpassAholmeAlandesligaAworkplacesAdelinquencyAmethamphetamineAcontrivedAtableauBithesAoverlyingAusurpedAcontingentsAsparesAoligoceneAmoldeAbeatificationAmordechaiAballotingApampangaAnavigatorsAfloweredAdebutantAcodecAorogenyAnewslettersAsolonAambivalentAubisoftAarchdeaconryAharpersAkirkusAjabalAcastingsAkazhagamAsylhetAyuwenAbarnstapleAamidshipsAcausativeAisuzuAwatchtowerAgranulesAcanaveralAremunerationAinsurerApayoutAhorizonteAintegrativeAattributingAkiwisAskanderbegAasymmetryAgannettAurbanismAdisassembledAunalteredAprecludedAmelodifestivalenAascendsApluginAgurkhaAbisonsAstakeholderAindustrialisationAabbotsfordAsextetAbustlingAuptempoAslaviaAchoreographersAmidwivesAharamAjavedAgazetteerAsubsectionAnativelyAweightingAlysineAredbridgeAmuchmusicAabruzzoBdjoinsAunsustainableAforestersAkbit/sAcosmopterigidaeAsecularismApoeticsAcausalityAphonographAestudiantesAceausescuAuniversitarioAadjointBpplicabilityAgastropodsAnagalandAkentishAmechelenAwoodpeckersAlombardsAgatineauAromanshAavrahamBcetylcholineAperturbationAgaloisAwenceslausAfuzhouAmeanderingAdendriticAsacristyAaccentedAtherapeuticsAperceivesAunskilledAgreenhousesAanaloguesAchaldeanAtimbreAslopedAvolodymyrAsadiqAmaghrebBonogramArearguardAcaucusesAmuresBetaboliteAuyezdAdeterminismAtheosophicalAcorbetAgaelsAdisruptionsAbicameralAribosomalAwolseleyAclarksvilleAwatershedsAtarsiAradonAmilaneseAdiscontinuousAaristotelianAwhistleblowerArepresentationalAhashimAmodestlyAlocalisedAatrialAhazaraAravanaAtroyesAappointeesArubusAmorningsideAaberdareAgangliaAwestsAzbigniewAaerobaticAdepopulatedAcorsicanAintrospectiveAtwinningAhardtopAshallowerAcataractAmesolithicAemblematicAgracedAlubricationArepublicanismAvoronezhAbastionsAmeissenAirkutskAoboesAhokkienAspritesAtenetAindividualistAcapitulatedAoakvilleAdysenteryAorientalistAhillsidesAkeywordsAelicitedAincisedAlaggingAapoelAlengtheningAattractivenessAmaraudersAsportswriterAdecentralizationAboltzmannAcontradictsAdraftsmanAprecipitateAsolihullAnorskeAconsortsAhauptmannAriflemenAadventistsAsyndromesAdemolishingAcustomizeBontinuoAperipheralsAseamlesslyAlinguisticallyAbhushanAorphanagesAparaulAlessenedAdevanagariAquartoArespondersApatronymicAriemannianAaltoonaAcanonizationAhonouringAgeodeticAexemplifiesArepublicaAenzymaticAportersAfairmountApampaAsufferersAkamchatkaAconjugatedCachellaAuthmanArepositoriesAcopiousAheadteacherAawamiAphonemeAhomomorphismAfranconianAmoorlandAdavosAquantifiedAkamloopsAquarksAmayoraltyAwealdApeacekeepersAvalerianAparticulateAinsidersAperthshireAcachesAguimaraesApipedAgrenadinesAkosciuszkoAtrombonistAartemisiaAcovarianceAintertidalAsoybeansAbeatifiedAellipseAfruitingAdeafnessBnipropetrovskAaccruedAzealousAmandalaAcausationAjuniusAkilowattAbakeriesAmontpelierAairdrieArectifiedAbungalowsAtolerationAdebianApylonAtrotskyistAposteriorlyAtwo-and-a-halfAherbivorousAislamistsApoeticalAdonneAwodehouseAfromeAalliumBssimilateAphonemicAminaretAunprofitableAdarpaAuntenableAleafletAbitcoinAzahirAthresholdsAargentinoAjacopoAbespokeAstratifiedAwellbeingAshiiteAbasalticAtimberwolvesAsecreteAtauntsAmarathonsAisomersAcarreBonsecratorsApenobscotBitcairnAsakhaAcrosstownAinclusionsBmpassableAfendersAindreAuscgcAjordiAretinueAlogarithmicApilgrimagesArailcarAcashelAblackrockAmacroscopicAaligningAtablaBrestleAcertifyAronsonApalpsAdissolvesAthickenedAsilicateAtamanAwalsinghamAhausaAlowestoftArondoAoleksandrAcuyahogaAretardationAcounteringBricketingAholbornAidentifiersAhellsAgeophysicsAinfightingAsculptingAbalajiAwebbedAirradiationArunestoneAtrussesAoriyaAsojournAforfeitureAcolonizeAexclaimedBucharisticAlacklusterAglazingAnorthridgeAgutenbergAstipulatesAmacroeconomicAprioriAoutermostAannularAudineseAinsulatingAheadlinerAgodelApolytopeAmegalithicAsalixBharapovaAderidedAmuskegonAbraintreeAplateausAconfersAautocraticAisomerBnterstitialAstampingAomitsAkirtlandAhatcheryAevidencesAintifadaA111thApodgoricaAcapuaAmotivatingAnuneatonAjakubAkorsakovAamitabhAmundialBonroviaAglutenApredictorAmarshallingAd'orleansAleversAtouchscreenAbrantfordAfricativeAbanishmentAdescendentAantagonismAludovicoBoudspeakersAformula_37AlivelihoodsAmanassasAsteamshipsAdewsburyAuppermostAhumayunAluresApinnaclesAdependentsAlecceAclumpsAobservatoriesApaleozoicAdedicatingAsamitiAdraughtsmanAgaulsAinciteCfringingAnepeanApythagoreanAconventsAtriumvirateAseigneurAgaimanAvagrantAfossaAbyproductAserratedArenfrewshireAshelteringAachaemenidAdukedomAcatchersAsampdoriaAplateletAbielefeldAfluctuatingAphenomenologyAstrikeoutAethnologyAprospectorsAwoodworkingAtatraAwildfiresAmeditationsAagrippaAfortescueAqureshiAwojciechAmethyltransferaseAaccusativeAsaatchiAamerindianAvolcanismAzeelandAtoyamaAvladimirovichAallegeApolygramAredoxAbudgetedAadvisoriesAnematodeAchipsetAstarscreamAtonbridgeAhardeningAshalesAaccompanistAparadedBhonographicAwhitefishAsportiveAaudiobookAkaliszAhibernationAlatifAduelsAps200AcoxeterAnayakAsafeguardingAcantabriaAminesweepingAzeissAdunamsAcatholicosAsawtoothAontologicalAnicobarAbridgendAunclassifiedAintrinsicallyAhanoverianArabbitohsAkensethAalcaldeAnorthumbrianAraritanAseptuagintApresseAsevresAorigenAdandenongApeachtreeAintersectedBmpededAusagesAhippodromeAnovaraAtrajectoriesAcustomarilyAyardageAinflectedAyanowAkalanAtavernsAliguriaCbrettistAintermarriageA1760sAcourantAgambierAinfantaAptolemaicAukuleleAhaganahAscepticalAmanchukuoAplexusAimplantationAhilalAintersexAefficienciesAarbroathAhagerstownAadelphiAdiarioAmaraisAlifesAcoiningAmodalitiesAbletchleyAconservingAivorianAmithridatesAgenerativeAstrikeforceAlaymenAtoponymyApogromAsatyaAmeticulouslyAagiosAdufferinAyaakovAfortnightlyAcargoesAdeterrenceAprefrontalCzemyslAmitterrandAcommemorationsBhatsworthAgurdwaraAabujaAchakrabortyAbadajozAgeometriesAartisteAdiatonicAganglionApresidesAmarymountAnanakAcytokinesAfeudalismAstorksArowersAwidensApoliticoAevangelicalsAassailantsApittsfieldAallowableAbijapurAtelenovelasAdichomerisAglenelgAherbivoresAkeitaAinkedAradomAfundraisersAconstantiusAbohemeAportabilityAkomnenosAcrystallographyAderridaAmoderatesAtavistockAfatehAspacexAdisjointAbristlesAcommercializedAinterwovenAempiricallyAregiusAbulacanAnewsdayAshowaAradicalismAyarrowApleuraAsayedBtructuringAcotesAreminiscencesAacetylAedictsBscalatorsAaomoriAencapsulatedAlegaciesAbunburyAplacingsBostscriptCwerfullyAkeighleyAhildesheimAamicusAcrevicesAdesertersAbeneluxAaurangabadAfreewareAioannisAcarpathiansBhiracAsecededAprepaidAlandlockedAnaturalisedAyanukovychAsoundscanAblotchAphenotypicAdeterminantsAtwenteAdictatorialAgiessenAcomposesArechercheApathophysiologyAinventoriesAayurvedaAelevatingAgravestoneAdegeneresAvilayetApopularizingAspartanburgAbloemfonteinApreviewedArenunciationAgenotypeAogilvyAtraceryAblacklistedAemissariesAdiploidCsclosuresAtupolevAshinjukuAantecedentsApennineAbraganzaBhattacharyaAcountableAspectroscopicAingolstadtAtheseusAcorroboratedCmpoundingAthrombosisAextremaduraAmedallionsAhasanabadAlambtonAperpetuityAglycolAbesanconApalaiologosCndeyAcaicosAantecedentAstratumAlaserdiscAnovitiateAcrowdfundingApalatalAsorceressAdassaultAtoughnessAcezanneAvientianeAtiogaAhanderAcrossbarAgisborneAcursorAinspectorateAserifApraiaAsphingidaeAnameplateApsalterAivanovicAsitkaAequalisedAmutineersAsergiusAoutgrowthAcreationismAharediArhizomesApredominateAundertakingsAvulgateAhydrothermalAabbevilleAgeodesicAkampungAphysiotherapyAunauthorisedAasteraceaeAconservationistAminoanAsupersportAmohammadabadAcranbrookAmentorshipAlegitimatelyAmarshlandAdatukAlouvainApotawatomiAcarnivoresAleviesByellAhymnalAregionalsAtintoAshikokuAconformalAwanganuiAbeiraAlleidaAstandstillAdeloitteAformula_40AcorbusierBhancelleryAmixtapesAairtimeAmuhlenbergAformula_39AbractsAthrashersAprodigiousAgirondeAchickamaugaAuyghursAsubstitutionsApescaraAbatangasAgregariousBijonApaleoAmathuraApumasBroportionallyAhawkesburyAyuccaAkristianiaAfunimationBlutedAeloquenceAmohunAaftermarketAchroniclersAfuturistAnonconformistAbrankoAmannerismsAlesnarAopenglAaltosAretainersAashfieldAshelbourneBulaimanAdivisieAgwentAlocarnoBiederAminkowskiAbivalveAredeployedAcartographyAseawayAbookingsAdecaysAostendAantiquariesApathogenesisAformula_38AchrysalisAesperanceAmotogpAhomelandsAbridgedBloorAghazalAvulgarisAbaekjeAprospectorAcalculatesAdebtorsAhesperiidaeAtitianAreturnerAlandgraveAfrontenacAkelownaApregameAcasteloCiusCnoeistAwatercoloursBinterthurAsuperintendentsAdissonanceBubstepAadornAmaticAsalihAhillelAflavouredAemitterAassaysAmonongahelaAdeededAbrazzavilleAsufferingsAbabyloniaAfecalAumbriaAastrologerAgentrificationAfrescosAphasingAzielonaAecozoneAcandidoAmanojAquadrilateralAgyulaAfalsettoAprewarBuntlandAinfinitiveAcontraceptiveAbakhtiariAohridAsocializationAtailplaneAevokingAhavelockAmacapagalAplunderingA104thAkeynesianAtemplarsAphrasingAmorphologicallyAczestochowaAhumorouslyAcatawbaAburgasAchiswickAellipsoidAkodanshaAinwardsAgautamaAkatangaAorthopaedicAheilongjiangAsiegesAoutsourcedAsubterminalAvijayawadaAharesAorationAleitrimAravinesAmanawatuAcryogenicAtracklistingAabout.comBmbedkarAdegeneratedAhastenedAventuringAlobbyistsAtypefacesAnorthcoteArugenA'goodAornithologyAasexualAhemispheresAunsupportedAglyphsAspoletoAepigeneticAmusicianshipAdoningtonBiogoAkangxiAbisectedApolymorphismAmegawattAsaltaAembossedAcheetahsBruzeiroAunhcrAaristideArayleighAmaturingAindonesiansAnoireAllanoAffffffAcamusApurgesAannalesAconvairAapostasyBlgolAphageAapachesAmarketersAaldehydeApompidouAkharkovAforgeriesApraetorianAdivestedAretrospectivelyAgornjiAscutellumAbitumenApausaniasAmagnificationAimitationsAnyasalandAgeographersAfloodlightsAathloneAhippolyteAexpositionsAclarinetistArazakAneutrinosArotaxAsheykhAplushAinterconnectAandalusAcladogramArudyardBesonatorAgranbyAblackfriarsAplacidoAwindscreenAsahelAminamotoAhaidaAcationsAemdenAblackheathAthematicallyAblacklistApawelAdisseminatingAacademicalAundamagedAraytheonAharsherApowhatanAramachandranAsaddlesApaderbornAcappingAzahraAprospectingAglycineAchromatinAprofaneAbanskaAhelmandAokinawanAdislocationAoscillatorsAinsectivorousAfoyleAgilgitAautonomicAtuaregAsluiceApollinatedAmultiplexedAgranaryAnarcissusAranchiAstainesAnitraAgoalscoringAmidwiferyApensionersAalgorithmicAmeetinghouseAbibliotecaBesarAnarvaAangkorApredateAlohanAcyclicalAdetaineeAoccipitalAeventingAfaisalabadAdartmoorAkublaiAcourtlyAresignsBadiiAmegachilidaeAcartelsAshortfallAxhosaAunregisteredAbenchmarksAdystopianAbulkheadAponsonbyAjovanovicAaccumulatesApapuanAbhutaneseAintuitivelyAgotalandAheadlinersArecursionAdejanAnovellasAdiphthongsAimbuedAwithstoodAanalgesicBmplifyApowertrainBrogramingAmaidanAalstomBffirmsAeradicatedAsummerslamAvideogameAmollaAseveringAfounderedAgalliumAatmospheresAdesalinationAshmuelAhowmehAcatolicaAbossierAreconstructingAisolatesAlyaseAtweetsAunconnectedAtidewaterAdivisibleAcohortsAorebroApresovAfurnishingBolkloristAsimplifyingAcentraleAnotationsAfactorizationAmonarchiesAdeepenAmacombAfacilitationAhennepinAdeclassifiedAredrawnAmicroprocessorsApreliminariesAenlargingAtimeframeAdeutschenAshipbuildersApatialaAferrousAaquariumsAgenealogiesAvieuxAunrecognizedAbridgwaterAtetrahedralBhuleAresignationsAgondwanaAregistriesAagderAdatasetAfelledAparvaAanalyzerAworsenAcoleraineDumellaAblockadedApolytechniqueAreassembledCentryAnarvikAgreysAnigraAknockoutsAboforsAgnieznoAslottedAhamasakiAferrersAconferringAthirdlyAdomesticationAphotojournalistAuniversalityAprecludeBontingAhalvedAthereuponAphotosyntheticAostravaAmismatchApangasinanAintermediariesAabolitionistsAtransitedAheadingsAustaseAradiologicalAinterconnectionAdabrowaAinvariantsAhonoriusApreferentiallyAchantillyAmarysvilleAdialecticalAantioquiaBbstainedAgogolAdirichletAmuricidaeAsymmetriesAreproducesAbrazosAfatwaAbacillusAketoneAparibasAchowkAmultiplicativeAdermatitisAmamluksAdevotesAadenosineAnewberyAmeditativeBinefieldsAinflectionAoxfamAconwyAbystricaAimprintsApandavasAinfinitesimalAconurbationAamphetamineAreestablishAfurthAedessaAinjusticesAfrankstonAserjeantA4x200AkhazarAsihanoukAlongchampAstagsApogromsAcoupsAupperpartsAendpointsAinfringedAnuancedAsummingAhumoristApacificationAciaranAjamaatAanteriorlyAroddickAspringboksAfacetedAhypoxiaArigorouslyAclevesAfatimidAayurvedicAtabledAratnaAsenhoraAmaricopaAseibuAgauguinAholomorphicAcampgroundsAamboyAcoordinatorsAponderosaAcasematesAouachitaAnanaimoAmindoroAzealanderArimskyAclunyAtomaszowAmeghalayaAcaetanoAtilakAroussillonAlandtagAgravitationAdystrophyAcephalopodsAtrombonesAglensAkillarneyAdenominatedAanthropogenicApssasAroubaixAcarcassesAmontmorencyAneotropicalAcommunicativeArabindranathAordinatedAseparableAoverridingAsurgedBagebrushAconciliationCdice_4AdurraniAphosphataseAqadirAvotiveArevitalizedAtaiyuanByrannosaurusAgrazeAslovaksAnematodesAenvironmentalismAblockhouseAilliteracyAschengenAecotourismAalternationAconicAwieldsAhounslowAblackfootAkwameAambulatoryAvolhyniaAhordalandAcrotonApiedrasAdravaAconceptualizedAbirlaAillustrativeAgurgaonAbarisalAtutsiAdezongAnasionalApoljeAchansonBlarinetsAkrasnoyarskAaleksandrovichAcosmonautAd'esteApalliativeAmidseasonAsilencingAwardensAdurerAgirdersAsalamandersAtorringtonAsupersonicsAlaudaAfaridAcircumnavigationAembankmentsAfunnelsAbajnoksagAlorriesAcappadociaAjainsAwarringahAretireesAburgessesAequalizationAcuscoAganesanAalgalBmazonianAlineupsAallocatingAconquerorsAusurperAmnemonicApredatingAbrahmaputraAahmadabadAmaidenheadAnumismaticAsubregionAencampedAreciprocatingAfreebsdAirgunAtortoisesAgovernoratesAzionistsAairfoilAcollatedAajmerAfiennesAetymologicalApolemicAchadianBlerestoryAnordiquesAfluctuatedAcalvadosAoxidizingAtrailheadAmassenaAquarrelsAdordogneAtirunelveliApyruvateBulsedAathabascaAsylarAappointeeAsererAjaponicaAandronikosAconferencingAnicolausAcheminAascertainedAincitedAwoodbineAhelicesBospitalisedAemplacementsAto/fromAorchestreAtyrannicalApannoniaAmethodismApop/rockAshibuyaAberbersAdespotAseawardAwestpacAseparatorAperpignanAalameinAjudeoApublicizeAquantizationAethnikiAgracilisAmenloAoffsideBscillatingAunregulatedAsuccumbingAfinnmarkAmetricalAsuleymanAraithAsovereignsAbundesstrasseAkartliAfiduciaryAdarshanAforamenAcurlerBoncubinesBalvinismAlaroucheAbukharaAsophomoresAmohanlalAlutheranismAmonomerAeamonnA'blackAuncontestedAimmersiveAtutorialsAbeachheadBindingsApermeableBostulatesAcomiteAtransformativeAindiscriminateAhofstraAassociacaoBmarnaAdermatologyAlaplandAaostaAbaburAunambiguousAformattingAschoolboysAgwangjuAsuperconductingAreplayedAadherentBureusAcompressorsAforcibleAspitsbergenAboulevardsBudgetingAnossaAannandaleAperumalAinterregnumAsassoonAkwajaleinAgreenbrierAcaldasAtriangulationAflaviusAincrementAshakhtarAnullifiedApinfallAnomenAmicrofinanceAdepreciationAcubistAsteeperBplendourAgruppeAeverymanAchasersBampaignersAbridleAmodalityApercussiveAdarklyAcapesAvelarApictonAtriennialAfactionalApadangAtoponymAbettermentAnorepinephrineA112thAestuarineAdiemenAwarehousingAmorphismAideologicallyApairingsAimmunizationAcrassusAexportersAseferAflockedAbulbousAdeseretAboomsAcalciteAboholAelvenApulauAcitigroupAwyethAmodernizingAlayeringApasticheAcompliesAprintmakerAcondenserAtheropodAcassinoAoxyrhynchusAakademieAtrainingsAlowercaseAcoxaeAparteAchetniksApentagonalAkeselowskiAmonocoqueCrsiAreticulumAmeiosisAclapboardArecoveriesAtingeAan/fpsArevistaAsidonAlivreAepidermisAconglomeratesAkampongAcongruentAharlequinsAtergumAsimplifiesAepidemiologicalAunderwritingAtcp/ipAexclusivityAmultidimensionalBysqlAcolumbineAecologistAhayatAsiciliesAleveesAhandsetAaesopAusenetApacquiaoAarchivingBlexandrianAcompensatoryAbroadsheetAannotationAbahamianAd'affairesAinterludesAphrayaAshamansAmarmaraAcustomizableAimmortalizedAambushesAchlorophyllAdieselsAemulsionArheumatoidAvoluminousAscreenwritersAtailoringAsedisAruncornAdemocratizationAbushehrAanacostiaCtiquaryAsixtusAradiateAadvaitaBntimonyBcumenAbarristersAreichsbahnBonstadtAsymbolistApasigAcursiveAsecessionistAafrikanerAmunnetraAinverselyAadsorptionAsyllabicAmoltkeAidiomsAmidlineAolimpicoAdiphosphateAcautionsAradziwillAmobilisationAcopelatusAtrawlersAunicronAbhaskarAfinanciersAminimalismAderailmentAmarxistsAoireachtasAabdicateAeigenvalueAzafarAvytautasAgangulyAchelyabinskAtellurideAsubordinationAferriedAdivedAvendeeApictishAdimitrovAexpiryAcarnationCyleyAmagnitudesAlismoreAsandwichedAunmaskedAsandomierzBwarthmoreAtetraAnanyangApevsnerAdehradunAmormonismArashiAcomplyingAseaplanesAningboAcooperatesAstrathconaAmorningtonBestizoAyuliaAedgbastonApalisadeAethnoApolytopesAespiritoAtymoshenkoApronunciationsBaradoxicalAtaichungAchipmunksAerhardAmaximiseAaccretionAkandaA`abdu'lAnarrowestAumpiringAmycenaeanAdivisorAgeneticistAceredigionAbarqueAhobbyistsAequatesAauxerreAspinoseAcheilAsweetwaterAguanoAcarboxylicAarchivAtanneryAcormorantAagonistsAfundacionAanbarAtunkuAhindranceAmeerutAconcordatAsecunderabadAkachinAachievableAmurfreesboroAcomprehensivelyAforgesAbroadestAsynchronisedBpeciationBcapaAaliyevAconmebolAtirelesslyAsubjugatedApillagedAudaipurAdefensivelyAstatelessAhaasanBeadlampsApatterningBodiumsClyphonyAmcmurdoBujerAvocallyAstoreyedAmucosaCltivariateAscopusAminimizesAformalisedAcertiorariAbourgesApopulateAoverhangingAgaietyAunreservedAborromeoAwoolworthsAisotopicAbasharApurifyAvertebraAmedanAjuxtapositionAearthworkBlongationAchaudharyAschematicApiastAsteepedAnanotubesAfoulsAachaeaAlegionnairesAabdurAqmjhlAembraerAhardbackAcentervilleAilocosAslovanAwhitehorseAmauritianBouldingBapucheAdonnedAprovisioningAgazpromAjonesboroAaudleyAlightestAcalyxBoldwaterAtrigonometricApetroglyphsBsychoanalystAcongregateAzambeziAfissureAsupervisesAbexleyAetobicokeAwairarapaAtectonicsAemphasisesAformula_41AdebuggingAlinfieldAspatiallyAionizingAungulatesAorinocoAcladesAerlangenAnews/talkAvols.AcearaAyakovlevAfinsburyAentanglementAfieldhouseAgrapheneAintensifyingAgrigoryAkeyongAzacatecasAninianAallgemeineAkeswickAsocietaBnorriAfemininityAnajibAmonoclonalAguyaneseApostulateAhuntlyAabbeysAmachinistAyunusAemphasisingAishaqAurmiaAbremertonApretendersAlumiereAthoroughfaresAchikaraAdramatizedAmetathoraxAtaikoBranscendenceAwycliffeAretrievesAumpiredAsteubenAracehorsesAtaylorsAkuznetsovAmontezumaAprecambrianAcanopiesAgaozongApropodeumAdisestablishedAretroactiveAshorehamArhizomeAdoubleheaderAclinicianAdiwaliAquartziteAshabaabAagassizAdespatchedAstormwaterAluxemburgAcallaoAuniversidadeAcourlandAskaneAglyphAdormersAwitwatersrandAcuracyAqualcommAnansenAentablatureAlauperAhausdorffAlusakaAruthenianA360degAcityscapeAdouaiAvaishnavaAsparsAvaultingArationalistAgygaxAsequestrationAtypologyApollinatesAacceleratorsAlebenAcolonialsBenotaphAimpartedAcarthaginiansAequaledArostrumAgobindAbodhisattvaAoberstAbicyclingAarabiAsangreAbiophysicsAhainautAvernalAlunenburgAapportionedAfinchesAlajosAnenadArepackagedAzayedAnikephorosAr.e.mAswaminarayanAgestaltAunplacedAcragsAgrohlAsialkotAunsaturatedAgwinnettAlinemenAforaysApalakkadAwritsAinstrumentalistsAaircrewsAbadgedAterrapinsA180degAonenessAcommissariatBhangiApupationAcircumscribedBontadorAisotropicAadministratedAfiefsAnimesAintrusionsAminoruAgeschichteAnadphAtainanAchangchunBarbondaleAfrisiaAswapoAeveshamAhawai'iAencyclopedicAtransportersAdysplasiaAformula_42AonsiteAjindalAguettaAjudgementsAnarbonneApermissionsBaleogeneArationalismAvilnaAisometricAsubtractedAchattahoocheeAlaminaAmissaAgrevilleApervezAlatticesApersistentlyAcrystallizationAtimberedAhawaiiansAfoulingAinterrelatedAmasoodAripeningAstasiAgamalAvisigothicAwarlikeAcyberneticsAtanjungAforfarAcyberneticAkarelianAbrooklandsBelfortAgreifswaldAcampecheAinexplicablyArefereeingAunderstoryCinterestedApriusAcollegiatelyAsefidBarsfieldAcategorizeAbiannualAelsevierBisteddfodAdeclensionAautonomaAprocuringAmisrepresentationAnovelizationAbibliographicAshamanismAvestmentsApotashAeastleighAionizedAturanAlavishlyAscillyAbalanchineAimportersAparlanceAkanyakumariAsynodsAmieszkoAcrossoversAserfdomAconformationalAlegislatedAexclaveAheathlandAsadarAdifferentiatesApropositionalAkonstantinosAphotoshopAmancheAvelloreAappalachiaAorestesAtaigaAexchangerAgroznyAinvalidatedAbaffinAspeziaBtaunchlyAeisenachArobustnessAvirtuosityAciphersAinletsAbolaghAunderstandingsAbosniaksAparserAtyphoonsAsinanAluzerneAwebcomicAsubtractionAjhelumAbusinessweekAceskeArefrainedAfireboxAmitigatedAhelmholtzAdilipAeslamabadAmetalworkAlucanAapportionmentAprovidentAgdyniaAschoonersAcasementAdanseAhajjiabadAbenazirButtressAanthraciteAnewsreelAwollastonAdispatchingAcadastralAriverboatAprovincetownAnantwichAmissalAirreverentAjuxtaposedAennobledBlectropopAstereoscopicAmaneuverabilityAlabanBuhanskAudineAcollectiblesAhaulageBolyroodAmateriallyAsuperchargerAgoriziaAshkoderAtownhousesApilateAlayoffsAfolkloricAdialecticAexuberantAmaturesCllaAceutaBitizenryBrewedBoupletAstopoverAtranspositionDdesmenAantioxidantBminesAutteranceAgrahameAlandlessAisereAdictionAappellantAsatiristAurbinoAintertotoAsubiacoAantonescuAnehemiahAubiquitinAemceeAstourbridgeAfencersA103rdAwranglersAmonteverdiAwatertightAexpoundedAxiamenAmanmohanApirieAthreefoldAantidepressantAsheboyganAgriegAcancerousAdivergingAberniniApolychromeAfundamentalismAbihariAcritiquedBholasAvillersAtendulkarAdafyddAvastraAfringedAevangelizationBpiscopalianAmalikiAsana'aAashburtonAtrianonAalleganyAheptathlonAinsufficientlyApanelistsAhexhamAamharicAfertilizedAplumesAcisternAstratigraphyAakershusAcatalansAkarooArupeeAminutemanAquantificationAwigmoreAleutnantAmetanotumAweeknightsAiridescentAextrasolarAbrechinAdeuteriumAkuchingAlyricismAastrakhanAbrookhavenAeuphorbiaAhradecAbhagatAvardarAaylmerApositronAamygdalaAspeculatorsAunaccompaniedAdebrecenAslurryAwindhoekAdisaffectedArapporteurAmellitusAblockersAfrondsAyatraAsportspersonAprecessionBhysiologistAweeknightApidginBharmaAcondemnsAstandardizeAzetianAtiborAglycoproteinAemporiaAcormorantsAaccessesAleonhardAdenbighshireAroaldA116thAwill.i.amAsymbiosisAprivatisedAmeandersAchemnitzAjabalpurAsecedeAludvigAkrajinaAhomegrownAsnippetsBasanianAeuripidesApederAcimarronAstreakedAgraubundenAkilimanjaroAmbekiBiddlewareAflensburgAbukovinaAlindwallAmarsalisAprofitedAabkhazApolisAcamouflagedAamyloidAmorgantownAovoidAbodleianAmorteAquashedAgamelanAjuventudAnatchitochesAstoryboardAfreeviewAenumerationAcieloApreludesAbulawayoA1600sAolympiadsAmulticastAfaunalAasuraAreinforcesApuranasAziegfeldAhandicraftAseamountAkheilAnocheAhallmarksAdermalAcolorectalAencircleAhessenAumbilicusAsunnisAlesteAunwinAdisclosingAsuperfundAmontmartreArefuellingAsubprimeAkolhapurAetiologyAbismuthAlaissezAvibrationalAmazarAalcoaArumsfeldBecurveAticonderogaAlionsgateAonlookersAhomesteadsAfilesystemAbarometricAkingswoodAbiofuelBellezaAmoshavAoccidentalisAasymptomaticAnortheasterlyAlevesonAhuygensAnumanAkingswayAprimogenitureAtoyotomiAyazooAlimpetsAgreenbeltAbooedAconcurrenceAdihedralAventritesAraipurAsibiuAplottersAkitabA109thAtrackbedAskilfulAberthedAeffendiAfairingAsephardiAmikhailovichAlockyerAwadhamAinvertibleApaperbacksAalphabeticAdeuteronomyAconstitutiveAleatheryAgreyhoundsAestorilAbeechcraftApoblacionAcossidaeAexcretedAflamingosAsinghaAolmecAneurotransmittersAascoliAnkrumahAforerunnersAdualismBisenchantedAbenefittedAcentrumAundesignatedAnoidaAo'donoghueAcollagesAegretsCmontAwuppertalAcleaveAmontgomerieApseudomonasAsrinivasaAlymphaticAstadiaAresoldAminimaAevacueesAconsumerismArondeAbiochemistAautomorphismAhollowsAsmutsAimprovisationsAvespasianAbreamApimlicoAeglinAcolneAmelancholicAberhadAoustingAsaaleAnotaulicesAouestAhunsletAtiberiasAabdominaAramsgateAstanislasAdonbassApontefractAsucroseAhaltsAdrammenAchelmAl'arcAtamingBrolleysAkoninAincertaeAlicenseesAscythianAgiorgosAdativeAtanglewoodAfarmlandsAo'keeffeAcaesiumAromsdalAamstradAcorteAoglethorpeAhuntingdonshireAmagnetizationAadaptsAzamoscAshootoAcuttackBentrepieceAstorehouseAwinehouseAmorbidityAwoodcutsAryazanAbuddlejaCoyantBodminAesteroAaustralAverifiableAperiyarAchristendomBurtailAshuraAkaifengAcotswoldAinvarianceAseafaringAgoricaAandrogenAusmanAseabirdAforecourtApekkaAjuridicalAaudaciousAyasserAcactiAqianlongApolemicalAd'amoreAespanyolAdistritoAcartographersApacifismAserpentsAbackaAnucleophilicAoverturningAduplicatesAmarksmanAorienteAvuittonAoberleutnantAgielgudBestaAswinburneAtransfigurationA1750sAretakenAceljeAfredrikstadAasukaAcroppingAmansardAdonatesAblacksmithsAvijayanagaraAanuradhapuraAgerminateAbetisAforeshoreAjalandharAbayonetsAdevaluationAfrazioneAablazeCidjanBpprovalsAhomeostasisAcorollaryAaudenAsuperfastAredcliffeAluxembourgishAdatumAgeraldtonAprintingsAludhianaAhonoreeAsynchrotronAinvercargillAhurriedlyA108thAthree-and-a-halfAcolonistAbexarAlimousinAbessemerAossetianAnunataksAbuddhasArebukedAthaisBilburgAverdictsAinterleukinAunprovenAdordrechtAsolentAacclamationAmuammarAdahomeyAoperettasA4x400AarrearsAnegotiatorsAwhitehavenAapparitionsBrmouryApsychoactiveAworshipersAsculpturedAelphinstoneAairshowAkjellAo'callaghanAshrankAprofessorshipsCedominanceAsubhashAcoulombAsekolahAretrofittedAsamosAoverthrowingAvibratoAresistorsApalearcticAdatasetsBoordarshanAsubcutaneousAcompilesAimmoralityApatchworkAtrinidadianAglycogenAprongedAzoharAvisigothsAfreresAakramAjustoAagoraAintakesAcraiovaAplaywritingAbukhariAmilitarismAiwateApetitionersAharunAwislaAinefficiencyAvendomeAledgesAschopenhauerAkashiAentombedAassessesAtenn.AnoumeaAbaguioAcarexAo'donovanAfilingsAhillsdaleAconjecturesAblotchesAannualsAlindisfarneAnegatedAvivekAangoulemeAtrincomaleeAcofactorAverkhovnaAbackfieldAtwofoldAautomakerArudraAfreightersAdarulAgharanaAbuswayAformula_43AplattsburghBortuguesaAshowrunnerAroadmapAvalenciennesAerdosAbiafraAspiritualismAtransactionalAmodifiesAcarneA107thAcocosAgcsesAtivertonAradiotherapyAmeadowlandsAgunmaAsrebrenicaAfoxtelAauthenticatedAenslavementAclassicistAklaipedaAminstrelsAsearchableAinfantrymenCcitementAshigaAnadp+AuralsAguildersAbanquetsAexteriorsAcounterattacksAvisualizedAdiacriticsApatrimonyAsvenssonAtranseptsAprizrenAtelegraphyAnajafAemblazonedAcoupesAeffluentAragamAomaniAgreensburgAtainoAflintshireAcd/dvdAlobbiesAcacaoAseafarersAbicolorAcollaborativelyAsurajAfloodlitAsacralApuppetryAtlingitAmalwaAloginAmotionlessAthienAoverseersAviharAgolemAspecializationsAbathhouseAprimingAoverdubsAwinningestAarchetypesAuniaoAaclandAcreameryAslovakianAlithographsAmaryboroughAconfidentlyAexcavatingAstillbornAramallahAaudienciaBlavaAternaryAhermitsArostamAbauxiteAgawainAlothairAgulfstreamAtimelinesArecededAmediatingApetainAbastiaArudbarAbiddersAdisclaimerAshrewsAtailingsBrilobitesAyuriyAjamilAdemotionAgynecologyArajinikanthAmadrigalsAghazniAflycatchersAvitebskAbizetAcomputationallyAkashgarArefinementsAfrankfordAheraldsAeurope/africaAlevanteAdisorderedAsandringhamAqueuesAransackedAtrebizondAverdesAcomedieAprimitivesAfigurineAorganistsAculminateAgosportAcoagulationAferryingAhoyasApolyurethaneBrohibitiveAmidfieldersAligaseAprogesteroneAdefectorsAsweetenedAbackcountryAdiodorusAwatersideAnieuportAkhwajaAjurongAdecriedAgorkhaAismailiA300thAoctahedralAkindergartensApaseoAcodificationAnotificationsAdisregardingArisqueBeconquistaAshortlandAatollsAtexarkanaApercevalAd'etudesAkanalAherbicidesAtikvaAnuovaAgathererAdissentedAsowetoAdexterityAenverAbacharachAplacekickerAcarnivalsAautomateAmaynoothAsymplecticAchetnikAmilitaireAupanishadsAdistributiveAstrafingAchampioningAmoietyBilibandAblackadderAenforceableAmaungAdimerAstadtbahnAdivergesAobstructionsAcoleophoridaeAdisposalsAshamrocksAauralAbancaChruAcoxedAgriersonAvanadiumAwatermillAradiativeAecoregionsAberetsAhaririAbicarbonateAevacuationsAmalleeAnairnArushdenAloggiaAslupskBatisfactorilyAmillisecondsAcaribooBycloApigmentationBostmodernismAaqueductsAvasariAbourgogneAdilemmasAliquefiedAfluminenseAalloaAibarakiAtenementsAkumasiAhumerusAlaboursAputschAsoundcloudAbodybuilderArakyatAdomitianApesaroAtranslocationAsembilanAhomericAenforcersAtombstonesAlectureshipArotoruaAsalamisAnikolaosAinferencesAsuperfortressAlithgowAsurmisedAundercardAtarnowAbarisanAstingraysAfederacionAcoldstreamAhaverfordAornithologicalAheerenveenAeleazarAmuraliAbamakoAriverbedAsubsidisedAthebanAconspicuouslyAvistasAconservatoriumAmadrasaAkingfishersAarnulfAcredentialAsyndicalistBheathedAdiscontinuityAprismsAtsushimaAcoastlinesAescapeesAvitisAoptimizingAmegapixelAovergroundAembattledAhalideAsprintersAbuoysAmpumalangaApeculiaritiesA106thAroamedAmenezesBacaoAprelatesBapyriAfreemenAdissertationsAirishmenApooledAsverreAreconquestAconveyanceAsubjectivityAasturianAcircassianAformula_45AcomdrAthicketsAunstressedAmonroApassivelyAharmoniumAmoveableAdinarAcarlssonAelyseesAchairingAb'naiAconfusinglyAkaoruAconvolutionAgodolphinAfacilitatorAsaxophonesAeelamAjebelAcopulationAanionsAlivresCcensureApontypriddAarakanAcontrollableAalessandriaApropellingAstellenboschAtiberAwolkaAliberatorsAyarnsAd'azurAtsinghuaAsemnanAamharaBblationAmeliesAtonalityAhistoriqueAbeestonAkahneAintricatelyAsonoranArobespierreAgyrusAboycottsAdefaultedAinfillAmaranhaoAemigresAframinghamAparaibaAwilhelmshavenAtritiumAskywayAlabialAsupplementationApossessorAunderservedAmotetsBaldivianCrrakechAquaysAwikimediaAturbojetAdemobilizationApetrarchAencroachingAsloopsAmastedAkarbalaAcorvallisAagribusinessAseafordBtenosisAhieronymusAiraniAsuperdraftAbaroniesAcortisolAnotabilityAveenaAponticAcyclinAarcheologistsAnewhamAculledBoncurringAaeolianAmanorialAshoulderedAfordsAphilanthropistsA105thAsiddharthAgotthardAhalimArajshahiAjurchenAdetritusApracticableAearthenwareAdiscardingAtravelogueAneuromuscularAelkhartAraederAzygmuntAmetastasisAinterneesA102ndAvigourAupmarketAsummarizingCbjunctiveAoffsetsAelizabethtownAudupiApardubiceArepeatersAinstitutingAarchaeaAsubstandardAtechnischeAlingaAanatomistAflourishesAvelikaAtenochtitlanAevangelisticAfitchburgAspringbokAcascadingAhydrostaticAavarsAoccasionedAfilipinaAperceivingAshimbunAafricanusAconsternationAtsingAopticallyAbeitarA45degAabutmentsArosevilleAmonomersAhuelvaAlotteriesAhypothalamusAinternationalistAelectromechanicalAhummingbirdsAfibreglassAsalariedAdramatistsAuncoversAinvokesAearnersBxcretionAgeldingAancienBeronauticaAhaverhillAstourAittihadAabramoffAyakovAayodhyaBcceleratesAindustriallyAaeroplanesAdeleteriousBweltAbelvoirAharpalusAatpaseAmalukuAalasdairAproportionalityAtaranAepistemologicalAinterferometerApolypeptideAadjudgedAvillagerAmetastaticBarshallsCdhavanAarchduchessAweizmannAkalgoorlieAbalanApredefinedAsessileBagaingAbrevityAinsecticideApsychosocialAafricanaAsteelworksAaetherBquifersAbelemAmineiroAalmagroAradiatorsAcenozoicAsoluteAturbochargerAinvictaAguestedAbuccaneerAidolatryAunmatchedApaducahAsinestroAdispossessedAconformsAresponsivenessAcyanobacteriaAflautistAprocuratorAcomplementingAsemifinalistArechargeableApermafrostAcytokineArefugesAboomedAgelderlandAfranchisedAjinanAburnieAdoubtlessArandomnessAcolspan=12AangraAginebraAfamersAnuestroAdeclarativeAroughnessAlauenburgAmotileArekhaAissuerApineyAinterceptorsAnapocaAformulaicH_44AviswanathanAebrahimAthessalonicaAgaleriaAmuskogeeAunsoldAhtml5AtaitoAmobutuAicannAcarnarvonAfairtradeAmorphismsAupsilonAnozzlesAfabiusAmeanderBuruganAstrontiumAepiscopacyAsandinistaAparasolAattenuatedAbhimaAprimevalBanayAordinatorAnegaraAosteoporosisAglossopAebookAparadoxicallyAgrevilleaAmodocAequatingAphoneticallyAlegumesAcovariantAdorjeAquatreAbruxellesApyroclasticAshipbuilderAzhaozongAobscuringAsverigesAtremoloAextensibleAbarrackAmultnomahAhakonAchaharmahalAparsingAvolumetricAastrophysicalAglottalAcombinatoricsAfreestandingAencoderAparalysedAcavalrymenAtaboosAheilbronnAorientalisAlockportAmarvelsAozawaAdispositionsAwadersAincurringAsaltireAmodulateApapilioBhenolAintermediaArappahannockAplasmidAfortifyAphenotypesAtransitingAcorrespondencesAleaguerBarnacaAincompatibilityAmcenroeAdeemingAendeavouredAaboriginalsAhelmedAsalarAarginineAwerkeAferrandAexpropriatedAdelimitedAcoupletsAphoeniciansBetiolesAousterAanschlussAprotectionistBlessisAurchinsAorquestaAcastletonAjuniataAbittorrentAfulaniAdonjiAmykolaArosemontAchandosAscepticismBignerAchalukyaAwicketkeeperAcoquitlamAprogrammaticAo'brianAcarteretAurologyAsteelheadApaleoceneAkonkanAbetteredAvenkateshAsurfacingAlongitudinallyAcenturionsApopularizationAyazidAdouroAwidthsApremiosAleonardsAgristmillAfallujahAarezzoAleftistsAeclipticAglycerolAinactionAdisenfranchisedAacrimoniousAdepositingAparashahAcockatooAmarechalAbolzanoAchiosBablevisionAimpartialityApouchesAthicklyAequitiesAbentinckAemotiveAbosonAashdownAconquistadorsAparsiAconservationistsAreductiveAnewlandsAcenterlineAornithologistsAwaveguideAniceneAphilologicalAhemelAsetantaAmasalaAaphidsAconveningBascoAmatrilinealAchalcedonAorthographicAhytheArepleteAdammingAbolivarianAadmixtureAembarksAborderlandsAconformedAnagarjunaAblennyAchaitanyaAsuwonBhigeruAtatarstanAlingayenArejoinsAgrodnoAmerovingianAhardwickeApuducherryBrototypingAlaxmiAupheavalsAheadquarterApollinatorsAbromineAtransomAplantagenetAarbuthnotAchidambaramAwoburnAosamuApanellingAcoauthoredAzhongshuAhyalineAomissionsAaspergillusAoffensivelyAelectrolyticAwoodcutAsodomAintensitiesAclydebankApiotrkowAsupplementingAquippedAfockeAharbingerApositivismBarklandsAwolfenbuttelAcaucaAtryptophanBaunusAcurraghAtsongaAremandAobscuraAashikagaAelthamAforelimbsAanalogsAtrnavaAobservancesAkailashAantithesisByumiBbyssiniaAdorsallyAtraleeApursuersAmisadventuresApadovaBerotAmahadevAtarimAgranthAlicencedAcompaniaApatuxentAbaronialAkordaAcochabambaCdicesAmemorializedAsemaphoreAplaylistsAmandibularAhalalAsivajiBcherzingerBtralsundAfoundriesAribosomeAmindfulnessAnikolayevichAparaphyleticAnewsreaderAcatalyzeAioanninaAthalamusAgbit/sApaymasterAsarabA500thAreplenishedAgameproAcracowAformula_46AgasconyAreburiedAlessingAeasementAtransposedAmeurtheAsatiresAprovisoAbalthasarAunboundAcuckoosAdurbarAlouisbourgAcowesAwholesalersAmanetAnaritaAxiaopingAmohamadAillusoryAcathalAreuptakeAalkaloidAtahrirAmmorpgAunderliesAanglicanismAreptonAaharonAexogenousAbuchenwaldAindigentAodostomiaAmilledAsantorumAtoungooAnevskyAsteyrAurbanisationAdarkseidAsubsonicAcanaaniteAakivaAegliseAdentitionAmediatorsAcirencesterApeloponnesianAmalmesburyAdurresAoerlikonAtabulatedAsaensAcanariaAischemicAesterhazyAringlingAcentralizationAwalthamstowAnalandaAligniteAtakhtAleninismAexpiringAcirceAphytoplanktonBromulgationAintegrableAbreechesAaaltoAmenomineeAborgoAscythiansBkrullAgalleonAreinvestmentBaglanBeachableAliberecAairframesAelectrolysisAgeospatialArubiaceaeAinterdependenceAsymmetricallyBimulcastsAkeenlyAmaunaAadiposeAzaidiAfairportAvestibularAactuatorsAmonochromaticAliteraturesAcongestiveAsacramentalAathollAskytrainAtychoBuningsAjamiaAmodifierBethuenAtapingsAinfiltratingAcolimaAgraftingAtaurangaAhalidesApontificateBhoneticsAkoperAhafezAgroovedAkintetsuAextrajudicialAlinkopingAcyberpunkArepetitionsAlaurentianAparnuAbrettonAdarkoAsverdlovskAforeshadowedAakhenatenArehnquistAgosfordAcovertsApragmatismAbroadleafAethiopiansAinstatedAmediatesAsodraAopulentAdescriptorAenuguAshimlaAleesburgAofficershipAgiffardArefectoryAlusitaniaAcybermenAfiumeAcorusAtydfilAlawrencevilleAocalaAleviticusAburghersAataxiaArichthofenAamicablyBcousticalAwatlingAinquiredAtiempoAmultiracialAparallelismAtrenchardBokyopopAgermaniumAusislAphilharmoniaAshapurAjacobitesAlatinizedAsophoclesAremittancesAo'farrellAadderAdimitriosApeshwaAdimitarAorlovButstretchedAmusumeAsatishAdimensionlessAserialisedAbaptismsApagasaAantiviralA1740sAquineAarapahoAbombardmentsAstratosphereAophthalmicAinjunctionsAcarbonatedAnonviolenceAasanteAcreolesAsybraAboilermakersAabingtonAbipartiteApermissiveAcardinalityAanheuserAcarcinogenicAhohenloheAsurinamBzegedAinfanticideAgenericallyAfloorballA'whiteAautomakersAcerebellarAhomozygousAremotenessAeffortlesslyAalludeA'greatAheadmastersAmintingBanchurianAkinabaluAwemyssAseditiousAwidgetsAmarbledAalmshousesAbardsAsubgenresAtetsuyaAfaultingAkickboxerAgaulishAhoseynAmaltonAfluvialAquestionnairesAmondaleAdownplayedAtraditionalistsAvercelliAsumatranAlandfillsAgamesradarAexertsAfranciszekAunlawfullyAhuescaAdiderotAlibertariansAprofessorialAlaaneApiecemealAconidaeAtaijiAcuratorialAperturbationsAabstractionsAszlachtaAwatercraftAmullahAzoroastrianismAsegmentalAkhabarovskArectorsAaffordabilityAscuolaAdiffusedAstenaAcyclonicAworkpieceAromfordA'littleAjhansiAstalagAzhongshanAskiptonAmaracaiboAbernadotteAthanetAgroeningAwatervilleAenclosesAsahrawiAnuffieldAmooringsAchantryAannenbergAislayAmarchersAtensesAwahidAsiegenAfurstenbergAbasquesAresuscitationAseminariansAtympanumAgentilesAvegetarianismAtuftedAvenkataAfantasticalApterophoridaeAmachinedAsuperpositionAglabrousAkaveriAchicaneAexecutorsAphyllonorycterAbidirectionalAjastaAundertonesAtouristicAmajapahitAnavratilovaAunpopularityAbarbadianAtinianAwebcastAhurdlerArigidlyAjarrahAstaphylococcusAignitingBrrawaddyAstabilisedAairstrikeAragasAwakayamaAenergeticallyBkstraklasaAminibusAlargemouthAcultivatorsAleveragingAwaitangiAcarnavalAweavesAturntablesAheydrichAsextusAexcavateAgovindAignazApedagogueAuriahAborrowingsAgemstonesAinfractionsAmycobacteriumAbatavianAmassingApraetorAsubalpineAmassoudApassersAgeostationaryAjalilAtrainsetsAbarbusAimpairAbudejoviceAdenbighApertainAhistoricityAfortalezaAnederlandseAlamentingAdoubsAgemaraAconductanceAploiestiAcetaceansBourthousesAbhagavadAmihailovicAocclusionAbremerhavenBulwarkAmoravaAkaineAdraperyAmaputoAconquistadorAkadunaAfamagustaBirst-past-the-postAeruditeAgaltonAundatedAtangentialAfilhoAdismemberedBashesAcriteriumAdarwenAmetabolizedAblurringAeverardArandwickAmohaveAimpurityAacuityBnsbachAchievoAsurchargeAplantainAalgomaAporosityAzirconiumAselvaCvenoaksAvenizelosAgolgiAimpartingAseparatismAcourtesanAidiopathicAgravestonesAhydroelectricityAbabarAorfordApurposefulAacutelyAshardAridgewoodAviterboAmanoharAexpropriationAplacenamesAbrevisAcosineAunrankedArichfieldAnewnhamArecoverableAflightlessAdispersingAclearfieldAabu'lAstranraerAkempeAstreamliningAgoswamiAepidermalApietaAconciliatoryAdistilleriesAelectrophoresisAbonneAtiagoAcuriositiesBandidatureApicnickingBerihelionAlintelApovoaAgulliesAconfigureAexcisionAfaciesAsignersA1730sAinsufficiencyAsemioticsBtreathamAdeactivationAentomologicalAskippersAalbaceteAparodyingAescherichiaAhonoreesAsingaporeansAcounterterrorismAtiruchirappalliAomnivorousAmetropoleAglobalisationAatholAunboundedAcodice_5AlandformsAclassifierAfarmhousesAreaffirmingCparationAyomiuriAtechnologistsAmitteBedicaAviewableAsteampunkAkonyaBshatriyaArepellingAedgewaterAlamiinaeAdevasApotteriesAllandaffAengenderedAsubmitsAvirulenceAupliftedAeducationistAmetropolitansAfrontrunnerAdunstableAforecastleBretsAmethodiusAexmouthAlinneanAbouchetArepulsionAcomputableAequallingAliceoAtephritidaeAagaveAhydrologicalAazarenkaAfairgroundAl'hommeAenforcesAxinhuaAcinematographersBooperstownAsa'idApaiuteAchristianizationAtemposAchippenhamAinsulatorAkotorAstereotypedAdelloAcoursAhishamAd'souzaAeliminationsAsupercarsApassauArebrandAnaturesAcooteApersephoneArededicatedAcleavedAplenumAblisteringAindiscriminatelyAcleeseAsafedArecursivelyAcompactedArevuesAhydrationAshillongAechelonsAgarhwalApedimentedAgrowerAzwolleAwildflowerAannexingAmethionineApetahAvalensAfamitsuApetioleAspecialitiesAnestorianAshahinAtokaidoAshearwaterAbarberiniAkinsmenAexperimenterAalumnaeAcloistersAaluminaApritzkerAhardinessAsoundgardenAjulichAps300AwatercourseAcementingAwordplayAolivetAdemesneAchasseursAamideAzapotecAgaozuAporphyryAabsorbersAindiumAanalogiesAdevotionsAengraversAlimestonesAcatapultedAsurryAbrickworksAgotraArodhamAlandlineApaleontologistsAshankaraAislipAraucousAtrollopeAarpadAembarkationAmorphemesArecitesApicardieAnakhchivanAtolerancesAformula_47AkhorramabadAnichirenAadrianopleAkirkukAassemblagesAcolliderAbikanerBushfiresArooflineAcoveringsAreredosAbibliothecaAmantrasAaccentuatedAcommediaArashtriyaAfluctuationAserhiyAreferentialAfittipaldiAvesicleAgeetaAiraklisBmmediacyAchulalongkornAhunsruckAbingenAdreadnoughtsAstonemasonAmeenakshiAlebesgueAundergrowthAbaltistanAparadoxesDlementAarticledAtiflisAdixielandAmeridenAtejanoAunderdogsAbarnstableAexemplifyAventerAtropesAwielkaAkankakeeAiskandarAzilinaApharyngealAspotifyAmaterialisedApictsAatlantiqueAtheodoricAprepositionsBaramilitariesBinellasAattleeBctuatedApiedmonteseAgraylingAthucydidesAmultifacetedAuneditedAautonomouslyAuniverselleBtriculariaAmootedApretoAincubatedAunderlieAbrasenoseAnootkaAbushlandAsensuAbenzodiazepineAesteghlalAseagoingAamenhotepBzusaAsappersAculpeperAsmokelessAthoroughbredsAdargahAgordaAalumnaAmankatoAzdrojAdeletingAculvertAformula_49ApuntingAwushuAhinderingAimmunoglobulinAstandardisationAbirgerAoilfieldAquadrangularAulamaArecruitersAnetanyaA1630sAcommunauteAistitutoAmaciejApathanAmeherAvikasAcharacterizationsAplaymakerAinteragencyFceptsAassemblesAhorthyAintrospectionAnaradaAmatraAtestesAradnickiAestoniansAcsiroAinstarAmitfordAadrenergicAcrewmembersAhaaretzAwasatchAlisburnArangefinderAordreAcondensateAreforestationAcorregidorAspvggAmodulatorBanneristAfaultedAaspiresAmaktoumAsquarepantsAaethelredApiezoelectricAmulattoAdacreAprogressionsAjagiellonianAnorgeAsukhoiAeffinghamAcoxlessAhermeticBumanistsAcentralityAlittersAstirlingshireAbeaconsfieldAsundaneseAgeometricallyAcaretakersAhabituallyAbandraApashtunsAbradentonAarequipaAlaminarAbrickyardAhitchinAsustainsBhipboardAploughingAtrechusAwheelersAbracketedAilyushinAsuboticaAd'hondtAreappearanceAbridgestoneAintermarriedAfulfilmentAaphasiaAbirkbeckAtransformationalAstrathmoreAhornbillAmillstoneAlacanAvoidsAsolothurnAgymnasiumsAlaconiaAviaductsApeduncleAteachtaAedgwareAshintyBupernovaeAwilfriedAexclaimAparthiaAmithunAflashpointAmokshaAcumbiaAmetternichAavalanchesAmilitancyBotoristArivadaviaAchancellorsvilleAfederalsAgenderedAboundingAfootyAgauriAcaliphsAlingamAwatchmakerAunrecordedAriverinaAunmodifiedAseafloorAdroitApfalzAchrysostomAgigabitAoverlordshipAbesiegeAespn2AoswestryAanachronisticAballymenaAreactivationAduchovnyAghaniAabacetusAdullerAlegioAwatercoursesAnord-pas-de-calaisAleiberAoptometryAswarmsAinstallerAsanctiAadverbsAiheartmediaAmeiningenAzeljkoAkakhetiAnotionalAcircusesApatrilinealAacrobaticsAinfrastructuralAshevaAoregonianAadjudicationBamirAwloclawekAoverfishingBbstructiveAsubtractingAaurobindoBrcheologistAnewgateAsecularizationAtehsilsAabscessAfingalAjanacekAelkhornAtrimsAkraftwerkAmandatingAirregularsAcongregationalistAsvetiAkasaiAmishapsAkennebecAprovinciallyAdurkheimAscottiesAaicteArapperswilAimphalAsurrendersAmorphsAninevehAhoxhaAcotabatoAthuringianAmetalworkingAretoldAshogakukanAanthersAproteasomeAtippeligaenAdisengagementAmockumentaryApalatialAeruptsAflumeAcorrientesAmastheadAjaroslawArereleasedAbhartiAlaborsAdistillingAtusksAvarzimArefoundedAenniskillenAmelkiteAsemifinalistsAvadodaraAbermudianAcapstoneAgrasseAoriginationApopulusAalesiBrrondissementsAsemigroupAvereinAopossumAmessrs.AportadownAbulbulAtirupatiAmulhouseAtetrahedronAroethlisbergerAnonverbalAconnexionAwarangalAdeprecatedAgneissAoctetAvukovarAheskethAchambreAdespatchAclaesAkargilAhideoAgravellyAtyndaleAaquileiaAtunersAdefensibleAtutteBheotokosAconstructivistAouvrageAduklaApolisarioAmonasticismAproscribedAcommutationAtestersAnipissingAcodonAmestoAolivineAconcomitantAexoskeletonApurportsAcoromandelAeyaletAdissensionAhippocratesApurebredAyaoundeAcompostingAoecophoridaeAprocopiusAo'dayAangiogenesisAsheernessAintelligencerAarticularAfelixstoweAaegonAendocrinologyAtrabzonAliciniusApagodasAzooplanktonAhooghlyAsatieAdriftersAsartheAmercianAneuillyAtumoursAcanal+AscheldtAinclinationsAcounteroffensiveAroadrunnersAtuzlaAshoreditchBurigaoApredicatesAcarnotAalgecirasAmilitariesAgeneralizeAbulkheadsAgawlerApollutantAceltaArundgrenAmicrornaAgewogAolimpijaAplacentalAlubelskiAroxburghAdiscernedAveranoAkikuchiAmusicaleAl'enfantAferocityAdimorphicAantigonusAerzurumAprebendaryArecitativeAdiscworldAcyrenaicaAstigmellaAtotnesAsuttaApachucaAulsanAdowntonAlandshutAcastellanApleuralAsiedlceDcleAcatamaranBottbusAutilisesAtrophicAfreeholdersAholyheadAu.s.sAchansonsAresponderAwaziristanAsuzukaAbirdingAshogiAaskerBcetoneAbeautificationAcytotoxicAdixitAhunterdonAcobblestoneAformula_48AkossuthAdevizesAsokotoAinterlacedAshutteredAkilowattsAassiniboineAisaakAsaltoAalderneyAsugarloafAfranchisingAaggressivenessAtoponymsAplaintextAheninAequidistantAsalivaryAbilingualismAmountingsAobligateAextirpatedAirenaeusAmisusedApastoralistsAaftabAimmigratingAwarpingAtyroleanAseaforthAteessideAsoundwaveAoligarchyAstelaeApairwiseAiupacAtezukaAposhtAorchestrationsAlandmassAironstoneAgalliaAhjalmarAcarmelitesAstraffordAelmhurstApalladioAfragilityAteleplayAgruffuddAyerbaApotokAespooAinductanceAmacaqueAnonprofitsAparetoArock'n'rollAspiritualistBhadowedBkateboarderAutterancesAgeneralityAcongruenceAprostrateAdeterredAyellowknifeAalbarnAmaldonAbattlementsAmohsenAinsecticidesAkhulnaAavellinoAmenstruationAglutathioneAspringdaleAparlophoneAconfraternityAkorpsAcountrywideAbosphorusApreexistingAdamodarAastrideBlexandrovichAsprintingAcrystallizedAbotevAleachingAinterstatesAveersAangevinAundauntedAyevgeniAnishapurBorthernersAalkmaarAbethnalAgrocersAsepiaAtornusAexemplarAtrobeAcharcotAgyeonggiAlarneAtournaiAvoidedAgenjiAenactmentsAmaxillaAadiabaticAeifelAnazimAtransducerBheloniousApyriteAdeportivaBialectalAbengtArosettesAlabemAsergeyevichBynopticAconservatorAstatuetteAbiweeklyAadhesivesAbifurcationArajapaksaAmammoottyArepubliqueAyusefAwasedaAmarshfieldAyekaterinburgAminnelliAfundyBenianAmatchupsAdungannonAsupremacistApanelledAdrentheAiyengarAfibulaAnarmadaAhomeportAoceansideApreceptAantibacterialBltarpiecesAswathAospreysAlillooetBegnicaBosslessAformula_50AgalvatronAiorgaAstormontArsfsrAloggersAkutnoAphenomenologicalAmedallistsAcuatroAsoissonsAhomeopathyAbituminousAinjuresAsyndicatesAtypesettingAdisplacementsBethronedAmakassarAluccheseAabergavennyAtarguAalborzBkb48AboldfaceAgastronomyAsacraAamenityBccumulatorAmyrtaceaeAcornicesAmourinhoAdenunciationAoxbowAdiddleyAaargauBrbitrageAbedchamberAgruffyddAzamindarAklagenfurtAcaernarfonAslowdownBtanstedAabrasionAtamakiAsuetoniusAdukakisAindividualisticAventrallyAhothamAperestroikaAketonesAfertilisationAsobriquetAcouplingsArenderingsAmisidentifiedArundfunkAsarcasticallyAbraniffAconcoursAdismissalsAelegantlyAmodifiersAcreditingBombosBruciallyAseafrontAlieutAischemiaAmanchusAderivationsAproteasesAaristophanesBdenauerAportingAhezekiahAsanteAtrulliAhornblowerAforeshadowingAypsilantiAdharwadAkhaniAhohenstaufenAdistillersAcosmodromeAintracranialAturkiAsalesianAgorzowAjihlavaAyushchenkoAleichhardtAvenablesAcassiaAeurogamerAairtelAcurativeAbestsellersAtimeformAsortiedAgrandviewAmassillonAcedingApilbaraAchillicotheAheredityAelblagArogalandCnneAmillennialAbatleyAoveruseAbharataAfilleAcampbelltownAabeyanceAcounterclockwiseA250ccAneurodegenerativeAconsignedAelectromagnetismAsunnahBahebAexonsAcoxswainAgleanedAbassoonsAworksopAprismaticAimmigrateApicketsAtakeoAbobsledderAstosurAfujimoriAmerchantmenAstiftungAforliAendorsesAtaskforceBhermallyAatmanAgurpsAfloodplainsAenthalpyBxtrinsicAsetubalAkennesawAgrandisAscalabilityAdurationsAshowroomsAprithviAoutroBverrunsAandaluciaBmanitaBbiturAhipperAmozambicanAsustainmentAarseneAcheshamApalaeolithicAreportageAcriminalityAknowsleyAhaploidAatacamaAshueishaAridgefieldAasternAgetafeAlinealAtimoreseArestyledAholliesAagincourtAunterAjustlyAtanninsAmataramAindustrialisedAtarnovoAmumtazCstaphaAstrettonBynthetaseAconditaAallroundAputraAstjepanAtroughsAaechmeaAspecialisationAwearableAkadokawaAuralicAaerosAmessiaenAexistentialismAjewellerAeffigiesAgametesAfjordaneAcochlearAinterdependentAdemonstrativeAunstructuredAemplacementAfaminesAspindlesAamplitudesBctuatorAtantalumApsilocybeAapneaAmonogatariAexpulsionsAseleucusAtsuenAhospitallerAkronstadtAeclipsingAolympiakosAclannBanadensisAinverterAhelioAegyptologistAsquamousAresonateAmunirAhistologyAtorbayAkhansAjcpenneyAveterinariansAaintreeAmicroscopesAcolonisedAreflectorsAphosphorylatedBristimantisAtulareAcorvinusAmultiplexingBidweekAdemosthenesAtransjordanAecijaAtengkuAvlachsAanamorphicAcounterweightAradnorAtrinitarianAarmidaleAmaughamAnjsiaaAfuturismAstairwaysAavicennaAmontebelloAbridgetownAwenatcheeAlyonnaisAamassAsurinameseBtreptococcusAm*a*s*hAhydrogenationAfrazioniAprosceniumAkalatApennsylvanianAhuracanAtallyingAkraloveAnucleolarAphrygianAseaportsAignaceAdonningAinstalmentAregnalAfondsAprawnAcarellAfolktalesAgoaltendingAbracknellAvmwareApatriarchyAmitsuiAkragujevacApythagorasAsoultAthapaAdisprovedAsuwalkiBecuresBomozaAl'ecoleAdiviziaAchromaAherdersAtechnologistAdeducesAmaasaiArampurAparaphraseAraimiAimagedAmagsaysayAivanoAturmericAformula_51AsubcommitteesAaxillaryAionosphereAorganicallyAindentedArefurbishingApequotAviolinistsAbearnAcolleCntraltoAsilvertonAmechanizationAetruscansAwittelsbachApasirAredshirtedAmarrakeshAscarpApleinAwafersAqarehAteotihuacanAfrobeniusAsinensisArehobothAbundabergAnewbridgeAhydrodynamicAtraoreAabubakarBdjustsAstorytellersAdynamosAverbandsligaAconcertmasterAexxonmobilAappreciableAsieradzAmarchionessAchaplaincyArechristenedAcunxuAoverpopulationAapoliticalAsequencerAbeakedAnemanjaAbinariesAintendantAabsorberAfilamentousAindebtednessAnusraBashikAreprisesApsychedeliaAabwehrAligurianAisoformAresistiveApillagingAmahathirAreformatoryAlusatiaAallertonBjaccioAtepalsAmaturinAnjcaaAabyssinianAobjectorAfissuresAsinuousAecclesiasticAdalitsAcachingAdeckersAphosphatesAwurlitzerAnavigatedAtrofeoAbereaApurefoodsAsolwayAunlockableAgrammysAkostromaAvocalizationsAbasilanArebukeAabbasiAdoualaAhelsingborgAambonAbakarArunestonesAcenelAtomislavApigmentedAnorthgateAexcisedAsecondaAkirkeAdeterminationsCdicatesAvilasApueblosAreversionAunexplodedAoverprintedAekitiAdeauvilleAmasatoAanaesthesiaAendoplasmicAtranspondersAaguascalientesAhindleyAcelluloidAaffordingAbayeuxApiagetArickshawsAeishockeyAcamarinesAzamalekAundersidesAhardwoodsBermitianAmutiniedBonotoneAblackmailsAaffixesAjpmorganAhabermasAmitrovicaApaleontologicalBolystyreneAthanaAmanasAconformistAturbofanAdecomposesAloganoAcastrationAmetamorphosesApatronessAherbicideAmikolajArapprochementAmacroeconomicsAbarranquillaAmatsudairaAlintelsAfeminaAhijabAspotsylvaniaAmorphemeAbitolaBaluchistanAkurukshetraAotwayAextrusionAwaukeshaAmenswearAhelderAtrungAbingleyAprotesterAboarsAoverhangAdifferentialsAexarchateAhejazAkumaraAunjustifiedAtimingsAsharpnessAnuovoAtaishoAsundarAetc..AjehanAunquestionablyAmuscovyAdaltreyAcanuteApaneledAamedeoAmetroplexAelaboratesAtelusCtrapodsAdragonfliesAepithetsAsaffirAparthenonArefittingApentateuchAhanshinAmontparnasseAlumberjacksAsanhedrinAerectileAodorsAgreenstoneAresurgentAleszekAamoryAsubstituentsAprototypicalAviewfinderAmonckAuniversiteitAjoffreArevivesAchatillonAseedlingBcherzoAmanukauAashdodAgympieAhomologAstalwartsAruinousAweiboAtochigiAwallenbergAgayatriAmundaAsatyagrahaBtorefrontsAheterogeneityAtollwayAsportswritersAbinocularAgendarmesAladysmithAtikalAortsgemeindeAja'farAosmoticAlinlithgowAbramleyAtelecomsApuginAreposeAsieurAmeniscusAgarmischAreintroduceA400thAshotenAponiatowskiAdromeAkazakhstaniAchangeoverAastronauticsAhusserlBerzlBypertextAkatakanaApolybiusAantananarivoAbreguetAreliquaryAutadaAaggregatingAliangshanAsivanAtonawandaAaudiobooksAshankillAcouleeAphenolicAbrocktonBookmakersAhandsetsAboatersAwyldeAcommonalityAmappingsAsilhouettesApenninesAmauryaApratchettAsingularitiesAeschewedApretensionsAvitreousAiberoAtotalitarianismApoulencAlingeredAdirectxBeputationAinterdictBllyriaAfeedstockAcounterbalanceAmuzikAbugandaAparachutedAviolistAhomogeneityAcomixAfjordsAcorsairsApuntedAverandahsAequilateralAlaoghaireAmagyarsA117thAalesundAtelevotingAmayotteAeateriesArefurbishAnswrlAyukioAcaragialeAzetasAdispelAcodecsAinoperableAoutperformedArejuvenationAelstreeAmoderniseAcontributoryApictouAtewkesburyAchechensAashinaApsionicArefutationAmedicoAoverdubbedAnebulaeAsandefjordApersonagesAeccellenzaAbusinesspersonAplacenameAabenakiAperryvilleAthreshingAreshapedAareciboAburslemAcolspan=3|turnoutArebadgedAlumiaAerinsboroughAinteractivityAbitmapAindefatigableAtheosophyAexcitatoryAgleizesAedselAbermondseyAkorceAsaarinenAwazirAdiyarbakirAcofounderAliberalisationAonsenAnighthawksAsitingAretirementsAsemyonAd'histoireA114thAredditchAvenetiaAprahaA'roundAvaldostaAhieroglyphicApostmedialAedirneAmiscellanyAsavonaAcockpitsAminimizationAcouplerAjacksonianAappeasementBrgentinesAsaurashtraAarkwrightAhesiodAfoliosBitzalanApublicaArivaledAcivitasAbeermenAconstructivismAribeiraAzeitschriftAsolanumAtodosAdeformitiesAchilliwackAverdeanAmeagreAbishopricsAgujratAyangzhouAreenteredAinboardAmythologiesAvirtusAunsurprisinglyArusticatedAmuseuAsymboliseAproportionateAthesabanAsymbianAaeneidAmitoticAvelikiAcompressiveBisternsAabiesAwinemakerAmassenetAbertoltAahmednagarAtriplemaniaAarmorialBdministracionAtenuresAsmokehouseAfuerzaAregattasAgennadyAkanazawaAmahmudabadAcrustalAasaphAvalentinianAilaiyaraajaAhoneyeaterAtrapezoidalAcooperativelyAunambiguouslyAmastodonAinhospitableAharnessesArivertonBenewablesAdjurgardensAhaitiansAairingsAhumanoidsAboatswainAshijiazhuangAfaintsAveeraApunjabisAsteepestAnarainAkarlovyAserreBulcusAcollectivesA1500mAarionAsubarcticAliberallyAapolloniusAostiaAdropletAheadstonesAnorraArobustaAmaquisAveroneseAimolaAprimersAluminanceAescadrilleAirreconcilableAstalybridgeAtemurAparaffinAstuccoedAparthiansAcounselsAfundamentalistsAvivendiApolymathAsugababesAmikkoAyonneAfermionsAvestfoldApastoralistAkigaliAunseededAglarusAcuspsAamasyaAnorthwesterlyAminorcaAastragalusAverneyAtrevelyanAantipathyAwollstonecraftAbivalvesBoulezAroyleAdivisaoAquranicAbareillyAcoronalAdeviatesAluleaAerectusApetronasAchandanAproxiesAaeroflotApostsynapticAmemoriamBoyneAgounodAkuznetsovaApallavaAordinatingAreigateA'firstAlewisburgAexploitativeAdanbyAacademicaAbailiwickBraheAinjectiveAstipulationsAaeschylusAcomputesAguldenAhydroxylaseAliveriesAsomalisAunderpinningsAmuscoviteAkongsbergAdomusAoverlainAsharewareAvariegatedAjalalabadAagenceAciphertextAinsectivoresAdengekiAmenuhinAcladisticAbaerumBetrothalAtokushimaAwaveletAexpansionistApottsvilleAsiyuanAprerequisitesAcarpiAnemzetiBazarAtrialledAeliminatorAirroratedAhomewardAredwoodsAundeterredAlutyensAmulticellularAaurelianAnotatedAlordshipsAalsatianAidentsAfoggiaAgarrosAchalukyasAlillestromApodlaskiBessimismAhsienAdemilitarizedAwhitewashedBillesdenAkirkcaldyAsanctorumAlamiaArelayingAescondidoApaediatricAcontemplatesAdemarcatedAbluestoneBetulaApenarolAcapitaliseAkreuznachBenoraA115thAhold'emAreichswehrAvaucluseAm.i.aAwindingsAboys/girlsAcajonAhisarApredictablyAflemingtonAysgolAmimickedAclivinaAgrahamstownAioniaAglyndebourneApatreseAaquariaAsleafordAdayalAsportscenterAmalappuramB.b.a.BanoaAcarbinesAsolvableAdesignatorAramanujanAlinearityAacademiciansAsayidAlancastrianAfactorialAstrindbergAvashemAdelosAcomynCndensingAsuperdomeAmeritedAintransitiveAbidefordAneuroimagingAduopolyAscorecardsAzigglerAheriotAboyarsAvirologyAmarbleheadBicrotubulesAwestphalianAanticipatesAhinghamAsearchersAharpistArapidesAmorriconeAconvalescentAmisesAnitrideAmetrorailBatterhornAbicolAdrivetrainAmarketerAsnippetAwinemakersAmubanAscavengersAhalberstadtBerkimerApetenAlaboriousAstoraAmontgomeryshireAbooklistAshamirAheraultAeurostarAanhydrousAspacewalkAecclesiaAcalliostomaAhighschoolAd'oroAsuffusionAimpartsAoverlordsAtagusArectifierAcounterinsurgencyAministeredAeileanAmilecastleAcontreAmicromolluskAokhotskAbartoliAmatroidAhasidimAthirunalBermeBarlacAlashkarApresqueAthameslinkAflybyAtroopshipArenouncingAfatihAmessrsAvexillumAbagrationAmagnetiteAbornholmAandrogynousAvehementAtouretteAphilosophicAgianfrancoAtuileriesAcodice_6AradiallyAflexionAhantsAreprocessingAsetaeAburneApalaeographicallyAinfantrymanAshorebirdsAtamarindAmodernaAthreadingAmilitaristicAcrohnAnorrkopingA125ccAstadtholderAtromsAklezmerAalphanumericAbromeAemmanuelleAtiwariAalchemicalAformula_52AonassisAbleriotBipedalAcolourlessAhermeneuticsBosniAprecipitatingAturnstilesAhallucinogenicApanhellenicAwyandotteAelucidatedAchitaAehimeAgeneralisedAhydrophilicAbiotaAniobiumArnzafAgandharaAlongueuilCgicsAsheetingAbielskoAcuvierAkagyuAtrefoilAdocentApancraseAstalinismAposturesAencephalopathyAmoncktonAimbalancesAepochsAleaguersAanzioAdiminishesApatakiAnitriteAamuroAnabilAmaybachAl'aquilaAbabblerCcolodAthutmoseAevoraAgaudiAbreakageArecurApreservativeA60degAmendipAfunctionariesAcolumnarAmaccabiahAchertAverdenAbromsgroveAclijstersAdengueApastorateBhuocBrincipiaAviareggioAkharagpurAscharnhorstAanyangAbosonsAl'artAcriticisesAennioAsemarangAbrownianAmirabilisAaspergerAcalibersAtypographicalAcartooningAminosAdisembarkAsupranationalAundescribedAetymologicallyAalappuzhaAvilhelmAlanaoApakenhamAbhagavataArakocziAclearingsAastrologersAmanitowocAbunuelAacetyleneAschedulerAdefamatoryAtrabzonsporAleadedAsciotoApentathleteAabrahamicAminigamesAaldehydesApeeragesAlegionaryA1640sAmasterworksAloudnessAbryanskAlikeableAgenocidalAvegetatedAtowpathAdeclinationApyrrhusAdivinelyAvocationsAroseberyAassociazioneAloadersAbiswasAoesteAtilingsAxianzongAbhojpuriAannuitiesArelatednessAidolatorApsersAconstrictionBhuvashCoristersAhanafiAfieldersAgrammarianAorpheumAasylumsAmillbrookAgyatsoBeldofAstabiliseAtableauxAdiaristAkalahariApaniniAcowdenbeathAmelaninA4x100mAresonancesApinarAatherosclerosisAsheringhamAcastlereaghAaoyamaAlarksApantographBrotrudeAnatakAgustafssonAmoribundAcerevisiaeBleanlyApolymericAholkarAcosmonautsAunderpinningAlithosphereAfiruzabadAlanguishedAmingledAcitrateAspadinaAlavasAdaejeonAfibrillationAporgyBinevilleBs1000AcobbledAemamzadehAmukhtarAdampersAindelibleAsalonikaAnanoscaleAtreblinkaAeilatApurportingAfluctuateAmesicAhagiographyAcutscenesAfondationAbarrensAcomicallyAaccrueAibroxAmakerereAdefectionsAhollandiaAskeneAgrossetoAredditAobjectorsAinoculationArowdiesAplayfairAcalligrapherAnamorAsibenikAabbottabadApropellantsAhydraulicallyAchloroplastsAtablelandsBecnicoAschistAklasseAshirvanAbashkortostanBullfightingAnorth/southApolskiAhannsAwoodblockAkilmoreAejectaAignacyAnanchangAdanubianAcommendationsAsnohomishBamaritansAargumentationAvasconcelosAhedgehogsAvajrayanaAbarentsAkulkarniCmbakonamAidentificationsAhillingdonAweirsAnayanarAbeauvoirAmesseAdivisorsAatlantiquesAbroodsAaffluenceAtegucigalpaAunsuitedAautodeskBkashAprincepsAculpritsAkingstownAunassumingAgooleAvisayanAasceticismAblagojevichAirisesApaphosAunsoundAmaurierApontchartrainAdesertificationAsinfoniettaAlatinsAespecialAlimpetAvalerengaAglialAbrainstemAmitralAparablesAsauropodAjudeanAiskconAsarcomaAvenloAjustificationsAzhuhaiAblavatskyAalleviatedAusafeAsteppenwolfAinversionsAjankoAchagallAsecretoryAbasildonAsaguenayApergamonAhemisphericalBarmonizedAreloadingAfranjoAdomaineAextravaganceArelativismAmetamorphosedAlabuanAbaloncestoAgmailAbyproductsAcalvinistsBounterattackedAvitusAbubonicA120thAstracheyArituallyAbrookwoodAselectableBavinjaAincontinenceAmeltwaterAjinjaA1720sAbrahmiAmorgenthauAsheavesBleevedBtratovolcanoAwielkiAutilisationAavocaAfluxusApanzergrenadierBhilatelyAdeflationApodlaskaBrerogativesAkurodaAtheophileAzhongzongAgascoyneAmagusAtakaoAarundellAfyldeAmerdekaAprithvirajAvenkateswaraAliepajaAdaigoBreamlandArefluxAsunnyvaleAcoalfieldsAseacrestBolderingAflexorAstructuralismAalnwickAoutweighedAunairedAmangeshkarAbatonsAglaadAbansheesAirradiatedAorganellesAbiathleteAcablingBhairliftAlollapaloozaAnewsnightAcapacitiveAsuccumbsAflatlyAmiramichiAburwoodAcomedienneBharterisAbioticAworkspaceAaficionadosAsokolkaAchateletAo'shaughnessyAprosthesisAneoliberalArefloatedAopplandAhatchlingsAeconometricsAloessAthieuAandroidsBppalachiansAjeninApterostichinaeAdownsizedAfoilsAchipsetsAstencilAdanzaAnarrateAmaginotAyemeniteAbisectsAcrustaceanAprescriptiveAmelodiousAalleviationAempowersAhanssonAautodromoAobasanjoBsmosisAdaugavaArheumatismAmoraesAleucineAetymologiesAchepstowAdelaunayAbramallBajajAflavoringAapproximatesAmarsupialsAincisiveAmicrocomputerAtacticallyAwaalsBilnoAfisichellaAursusAhindmarshAmazarinAlomzaAxenophobiaAlawlessnessAannecyAwingersAgornjaBnaeusAsuperieurAtlaxcalaAclaspsAsymbolisesBlatsArightistAeffectorAblightedApermanenceAdivanAprogenitorsAkunsthalleAanointingAexcellingAcoenzymeAindoctrinationAdniproAlandholdingsAadriaanAliturgiesAcartanAethmiaAattributionsAsanctusAtrichyAchroniconAtancredAaffinisAkampucheaAgantryApontypoolAmemberedAdistrustedAfissileAdairiesAhyposmocomaAcraigieAadarshAmartinsburgAtaxiwayA30degAgeraintAvellumAbencherAkhatamiAformula_53AzemunAteruelAendeavoredApalmaresCvementsAu.s..AinternationalizationAsatirizedAcarersAattainableAwraparoundAmuangAparkersburgAextinctionsAbirkenfeldAwildstormApayersAcohabitationAunitasAcullodenBapitalizingBlwydAdaoistAcampinasAemmylouAorchidaceaeAhalakhaAorientalesAfealtyAdomnallAchiefdomAnigeriansAladislavAdniesterAavowedAergonomicsAnewsmagazineAkitschAcantileveredAbenchmarkingAremarriageAalekhineAcoldfieldAtaupoAalmiranteAsubstationsAapprenticeshipsAseljuqAlevellingAeponymAsymbolisingBalyutAopioidsAunderscoreAethnologueAmoheganBarikinaAlibroAbassanoAparseAsemanticallyAdisjointedBugdaleApadraigAtulsiAmodulatingAxfinityAheadlandsAmstislavAearthwormsAbourchierAlgbtqAembellishmentsApennantsArowntreeAbetelAmotetBullaAcatenaryAwashoeAmordauntAdorkingAcolmarAgirardeauBlentoranBrammaticallyAsamadArecreationsAtechnionAstaccatoAmikoyanAspoilersAlyndhurstAvictimizationAchertseyAbelafonteAtondoDsbergAnarratorsAsubculturesAmalformationsAedinaAaugmentingBttestsAcabrioletAdisguisingA1650sAnavarreseAdemoralizedAcardiomyopathyAwelwynBallachianAsmoothnessAplanktonicAvolesAissuersAsardashtBurvivabilityAcuauhtemocAthetisAextrudedAsignetAraghavanAlombokAeliyahuAcrankcaseAdissonantAstolbergAtrencinAdesktopsAbursaryAcollectivizationBharlottenburgAtriathleteAcurvilinearAinvoluntarilyAmiredAwausauAinvadesAsundaramAdeletionsAbootstrapAabellioBxiomaticAnoguchiAsetupsAmalawianAvisaliaAmaterialistAkartuzyAwenzongAplotlineAyeshivasAparganasAtunicaAcitricBonspecificAidlibAsuperlativeAreoccupiedAblagoevgradAmastertonAimmunologicalAhattaAcourbetAvorticesAswallowtailAdelvesAharidwarAdipteraAbonehBahawalpurAangeringAmardinAequipmentsAdeployableAguanineAnormalityArimmedAartisanalAboxsetAchandrasekharAjoolsAchenarAtanakhAcarcassonneAbelatedlyAmillvilleAanorthosisAreintegrationAveldeAsurfactantAkanaanAbusoniAglyphipterixApersonasAfullnessArheimsAtiszaAstabilizersAbharathiAjoostAspinolaAmouldingsAperchingAesztergomAafzalBpostateAlustreAs.leagueAmotorboatCnotheisticAarmatureAbaratAasistenciaAbloomsburgAhippocampalAfictionalisedAdefaultsAbrochAhexadecimalAlusignanAryanairAboccaccioBreisgauAsouthbankAbskybAadjoinedAneurobiologyAaforesaidAsadhuAlangueAheadshipAwozniackiAhangingsAregulusAprioritizedAdynamismAallierAhannityAshiminAantoninusAgymnopilusAcaledonApreponderanceAmelayuAelectrodynamicsAsyncopatedAibisesAkrosnoAmechanisticBorpethAharboredAalbiniAmonotheismA'realAhyperactivityBaveliAwriter/directorAminatoAnimoyAcaerphillyBhitralAamirabadAfanshaweAl'orealBordeAmuktiAauthoritarianismAvaluingAspywareAhanburyArestartingAstatoAembedAsuizaAempiricismAstabilisationDriAcastlemaineAorbisAmanufactoryCuritanianAshojiAtaoyuanAprokaryotesAoromiaAambiguitiesAembodyingAslimsAfrenteAinnovateAojibwaApowderyAgaeltachtAargentinosAquatermassAdetergentsAfijiansAadaptorAtokaiAchileansAbulgarsAoxidoreductasesAbezirksligaAconceicaoAmyosinAnelloreA500ccAsupercomputersAapproximatingAglyndwrApolypropyleneAhaugesundAcockerellAtudmanAashbourneAhindemithAbloodlinesArigvedaAetruriaAromanosAsteynAoradeaAdecelerationAmanhunterAlaryngealAfraudulentlyAjanezAwendoverAhaplotypeAjanakiAnaokiAbelizeanAmellencampAcartographicAsadhanaAtricolourApseudoscienceAsataraAbytowAs.p.a.AjagdgeschwaderAarcotAomaghAsverdrupAmasterplanAsurteesAapocryphaBhvazAd'amatoAsocraticAleumitAunnumberedAwitoldAmarsupialAcoalescedAinterpolatedAgimnasiaAkaradzicBeratinAmamoruAaldeburghAspeculatorAescapementAirfanAkashyapAsatyajitAhaddingtonAsolverArothkoAashkelonAkickapooAyeomenAsuperblyAbloodiestAgreenlandicAlithicAautofocusAyardbirdsApoonaAkebleAjavanAsufisAexpandableAtumblrAswimwearAwinwoodAcounsellorsAaberrationsAmarginalisedAbefriendingAworkoutsApredestinationAvarietalAsiddharthaAdunkeldAjudaicAesquimaltAshababAajithAtelefonicaAstargardAhoysalaAradhakrishnanAsinusoidalBtradaAhiraganaAcebuanoAmonoidAindependenciaAfloodwatersAmilduraBudflatsAottokarAtranslitAradixAwignerAphilosophicallyAtephritidAsynthesizingAcastletownAinstallsAstirnerAresettleAbushfireAchoirmasterAkabbalisticAshiraziAlightshipArebusAcolonizersBentrifugeAleoneanAkristoffersonAthymusAclackamasAratnamBothesayAmunicipallyAcentraliaAthurrockAgulfportAbilinearAdesirabilityAmeriteApsoriasisAmacawAerigeronAmudstoneAdistortingAkarlheinzAtailwheelAvitorAreinsuranceAedificesAsuperannuationAdormancyAcontagionCbdenArendezvousedAprokaryoticAdeliberativeApatriciansAfeignedAdegradesAstarlingsBopotAviticulturalAbeavertonAoverflowedAconvenerAgarlandsAmichielAternopilAnaturelleAbiplanesBagotAgamespyAventspilsAdisembodiedAflatteningAprofesionalAlondonersAarushaAscapularAforestallApyridineAulemaAeurodanceAarunaAcallusAperiodontalAcoetzeeAimmobilizedAo'mearaAmaharaniAkatipunanAreactantsAzainabAmicrogravityAsaintesAbritpopAcarrefourBonstrainAadversarialAfirebirdsAbrahmoAkashimaAsimcaBuretyDplusesCperconductivityAgipuzkoaAcumansAtocantinsAobtainableAhumbersideAroostingA'kingAformula_54AminelayerAbesselAsulaymanAcycledAbiomarkersAannealingAshushaAbardaAcassationAdjingApolemicsAtupleAdirectoratesAindomitableAobsolescenceApembinaAbojanAtamboAdioeciousApensionerAmagnificatA1660sAestrellasAsoutheasterlyAimmunodeficiencyArailheadAsurreptitiouslyAcodeineAencoresAreligiosityAtemperaAcamberleyAefendiAboardingsAmalleableAhagiaAinput/outputAlucasfilmAujjainApolymorphismsAcreationistAbernersAmickiewiczAirvingtonAlinkedinAenduresAkinectAmunitionAapologeticsAfairlieApredicatedAreprintingAethnographerAvariancesAlevantineAmariinskyAjadidCrrowAasia/oceaniaAtrinamoolAwaveformsAbisexualityApreselectionBupaeAbucketheadAhieroglyphAlyricistsAmarionetteAdunbartonshireArestorerAmonarchicalApazarAkickoffsAcabildoAsavannasAglieseAdenchAspoonbillsAnoveletteAdilimanAhypersensitivityAauthorisingAmontefioreBladenAqu'appelleAtheisticAmarutiAlateriteAconestogaAsaareAcalifornicaAproboscisAcarrickfergusAimpreciseAhadassahAbaghdadiAjolgehAdeshmukhAamusementsAheliopolisAberleAadaptabilityApartenkirchenAseparationsAbaikonurAcardamomAsoutheastwardFfieldAmuzaffarAadequacyAmetropolitanaArajkotAkiyoshiAmetrobusAevictionsAreconcilesAlibrarianshipAupsurgeAknightleyAbadakhshanAproliferatedAspiritualsAburghleyAelectroacousticAprofessingAfeaturetteAreformistsAskylabAdescriptorsAoddityAgreyfriarsAinjectsAsalmondAlanzhouAdauntlessAsubgeneraAunderpoweredAtransposeAmahindaAgatosAaerobaticsAseaworldAblocsAwaratahsAjorisAgiggsAperfusionAkoszalinAmieczyslawAayyubidAecologistsAmodernistsAsant'angeloAquicktimeAhim/herAstavesBanyoAmelakaAacrocercopsAqigongAiteratedAgeneralizesArecuperationAviharaAcircassiansApsychicalAchavoAmemoiresAinfiltratesAnotariesApelecaniformesfamilyAstridentAchivalricApierrepontAalleviatingAbroadsidesAcentipedeAb.techAreinterpretedAsudetenlandAhussiteAcovenantersAradhikaAironcladsAgainsbourgAtestisApenarthBlantarAazadeganAbeanoAespn.comAleominsterAautobiographiesAnbcuniversalAeliadeAkhameneiAmontferratAundistinguishedAethnologicalAwenlockAfricativesApolymorphicAbiomeAjouleAsheathsAastrophysicistAsalveAneoclassicismAlovatAdownwindAbelisariusAformaAusurpationAfreieAdepopulationAbackbenchAascensoA'highAaagpblAgdanskiAzalmanAmouvementAencapsulationAbolshevismAstatnyAvoyageursAhywelAvizcayaAmazra'ehAnarthexAazerbaijanisAcerebrospinalAmauretaniaAfantailAclearinghouseAbolingbrokeApequenoAansettAremixingAmicrotubuleAwrensAjawaharApalembangAgambianAhillsongAfingerboardArepurposedAsundryAincipientAveoliaAtheologicallyAulaanbaatarAatsushiAfoundlingAresistivityAmyelomaAfactbookAmazowieckaAdiacriticAurumqiAclontarfAprovokesAintelsatAprofessesAmaterialiseAportobelloAbenedictinesApanioniosAintrovertedAreacquiredAbridportAmammaryAkripkeAoratoriosAvloreAstoningAworedasAunreportedAanttiAtogoleseAfanzinesAheuristicsAconservatoriesBarburetorsBlitheroeBofoundedAformula_57AeruptingAquinnipiacAbootleAghostfaceAsittingsAaspinallAsealiftAtransferaseAboldklubAsiskiyouApredominatedAfrancophonieBerruginousAcastrumAneogeneAsakyaAmadamaAprecipitousA'loveAposixAbithyniaAuttaraAavestanAthrushesAseijiAmemorablyAseptimiusAlibriAciberneticoAhyperinflationAdissuadedAcuddaloreApeculiarityAvasluiAgrojecAalbuminAthurlesAcasksAfastenersBluidityAbubleAcasalsAterekAgnosticismAcognatesAulnarAradwanskaAbabyloniansAmajuroAoxidizerAexcavatorsAliffeyAgorakhpurAeurydiceAunderscoredAarboreaAlumumbaAtuberAcatholiqueAgramaBalileiAscropeAcentrevilleAjacobinAbequestsAardecheApolygamousAmontaubanAteraiAweatherboardAreadabilityAattainderBcraeaAtransverselyArivetsAwinterbottomAreassuresAbacteriologyAvrieseaAcheraAandesiteAdedicationsAhomogenousAreconqueredAbandonAforrestalAukiyoAgurdjieffAtethysAsparcAmuscogeeAgrebesAbelchatowAmansaAblantyreApalliserAsokolowAfibroblastsAexmoorAsoundscapesAhousatonicAmiddelburgAconvenorAantipopeAhistidineAokeechobeeAalkenesAsombreAalkeneArubikAmacaquesAcalabarAtropheeApinchotA'freeAfruscianteAcheminsAfalaiseAvasterasAgrippedAschwarzenbergAcumannAkanchipuramAacousticallyAsilverbacksAfangioAinsetAplymptonAkurilAvaccinationsArecepAtheropodsAaxilsAstavropolAencroachedAapoptoticApapandreouAwailersAmoonstoneAassizesAmicrometersAhornchurchAtruncationAannapurnaAegyptologistsArheumaticApromiscuityAsatiricAflecheAcaloptiliaAanisotropyAquaternionsAgruppoAviscountsAawardeesBftershocksAsigintAconcordanceAoblastsAgaumontAstentAcommissarsAkestevenAhydroxyAvijayanagarAbelorussianAfabriciusAwatermarkAtearfullyAmametAleukaemiaAsorkhAmilepostAtattooingAvostaAabbasidsAuncompletedAhedongAwoodwindsAextinguishingAmalusBultiplexesAfrancoistApathetAresponsaAbassistsA'mostApostsecondaryAossoryAgrampianAsaakashviliAalitoAstrasbergAimpressionisticAvoladorAgelatinousAvignetteAunderwingAcampanianAabbasabadBlbertvilleAhopefulsAnieuweAtaxiwaysAreconvenedDumbentApathologistsAunionizedAfavershamAasymptoticallyAromuloAcullingAdonjaAconstrictedAannesleyAduomoAenschedeAlovechAsharpshooterAlanskyAdhammaApapillaeAalanineAmowatAdeliusAwrestAmcluhanApodkarpackieAimitatorsAbilaspurAstuntingApommelAcasemateAhandicapsAnagasAtestamentsAhemingsAnecessitateArearwardAlocativeAcillaAklitschkoAlindauAmerionAconsequentialAanticAsoongAcopulaAberthingAchevronsArostralAsympathizerAbudokanAranulfAberiaAstiltAreplyingAconflatedAalcibiadesApainstakingAyamanashiAcalif.AarvidActesiphonAxizongArajasAcaxtonAdownbeatAresurfacingBuddersAmiscegenationAdeathmatchAforegoingAarthropodBttestationAkartsAreapportionmentAharnessingAeastlakeAscholaAdosingApostcolonialAimtiazAformula_55AinsulatorsAgunungAaccumulationsApampasAllewelynAbahnhofAcytosolAgrosjeanAteaneckAbriarcliffAarsenioAcanaraAelaboratingApasschendaeleAsearchlightsAholywellAmohandasApreventableAgehryAmestizosAustinovAclichedA'nationalAheidfeldAtertullianAjihadistAtourerAmiletusAsemicircleAoutclassedAbouillonAcardinalateBlarifiesAdakshinaAbilayerApandyanAunrwaAchandraguptaAformula_56AportolaAsukumaranAlactationAislamiaAheikkiAcouplersAmisappropriationAcatsharkAmonttAploughsAcaribAstatorAleaderboardAkenrickAdendritesAscapeAtillamookAmolesworthBussorgskyBelanesiaArestatedAtroonAglycosideAtruckeeAheadwaterAmashupAsectoralAgangwonAdocudramaAskirtingApsychopathologyAdramatisedAostrolekaAinfestationsAthaboAdepolarizationAwideroeAeisenbahnAthomondAkumaonAupendraAforelandAacronymsAyaquiAretakingBaphaeliteAspecieAdupageAvillarsAlucasartsAchloroplastAwerribeeAbalsaAascribeAhavantAflavaAkhawajaAtyumenAsubtractAinterrogatorsAreshapingAbuzzcocksAeestiAcampanileApotemkinAaperturesAsnowboarderAregistrarsAhandbooksAboyarAcontaminantAdepositorsAproximateAjeunesseAzagoraApronouncementsAmistsAnihilismAdeifiedAmargraviateApietersenAmoderatorsAamalfiBdjectivalAcopepodsAmagnetosphereApalletsAclemenceauBastraAperforationAgraniticAtroilusAgrzegorzAluthierAdockyardsAantofagastaAffestiniogAsubroutineAafterwordAwaterwheelAdruceAnitinAundifferentiatedAemacsAreadmittedAbarneveldAtapersAhittitesAinfomercialsDirmAbraathensAheligolandAcarparkAgeomagneticAmusculoskeletalAnigerienAmachinimaAharmonizeArepealingAindecencyAmuskokaAveriteAsteubenvilleBuffixedAcytoskeletonAsurpassesAimeretiAventriclesAheterozygousAenvisionsAotsegoAecolesAwarrnamboolAburgenlandAseriaArawatAcapistranoAwelbyAkirinAenrollmentsAcaricomAdragonlanceAschaffhausenAexpansesAphotojournalismAbrienneAetudeAreferentAjamtlandAschemasAxianbeiAcleburneAbicesterAmaritimaAshorelinesAdiagonalsAbjelkeAnonpublicAaliasingAm.f.aAovalsAmaitreyaAskirmishingAgrothendieckAsukhothaiAangiotensinAbridlingtonAdurgapurAcontrasAgakuenAskagitArabbinateAtsunamisAhaphazardAtyldesleyAmicrocontrollerAdiscouragesAhialeahAcompressingAseptimusAlarvikAcondoleezzaApsilocybinBrotectionismAsongbirdsAclandestinelyAselectmenAwargameAcinemascopeAkhazarsAagronomyAmelzerAlatifahAcherokeesArecessesAassemblymenAbasescuCnarasBioavailabilityAsubchannelsAadenineAo'kellyAprabhakarAleoneseAdimethylAtestimonialsAgeoffroyAoxidantAuniversitiAgheorghiuAbohdanAreversalsAzamorinAherbivoreAjarreAsebastiaoAinfanterieAdolmenAteddingtonAradomskoAspaceshipsAcuzcoArecapitulationAmahoningAbainimaramaAmyelinAaykroydAdecalsAtokelauAnalgondaArajasthaniA121stAquelledAtambovAillyriansAhomiliesAilluminationsAhypertrophyAgrodziskAinundationCcapacityAequilibriaAcombatsAelihuAsteinitzAberengarAgowdaAcanwestAkhosrauAmaculataAhoutenAkandinskyAonsideAleatherheadAheritableAbelvidereAfederativeAchukchiAserlingAeruptiveApatanAentitlementsAsuffragetteAevolutionsAmigratesAdemobilisationAathleticismAtropeAsarpsborgAkensalAtranslinkAsquamishAconcertgebouwAenergonAtimestampAcompetencesAzalgirisAservicemanAcodice_7AspoofingAassangeAmahadevanAskienBuceavaAaugustanArevisionismAunconvincingAhollandeAdrinaAgottlobAlippiAbroglieAdarkeningAtilapiaAeagernessAnachtAkolmogorovAphotometricAleeuwardenAjrotcAhaemorrhageAalmanackAcavalliArepudiationAgalactoseAzwickauAcetinjeAhoubrakenBeavyweightsAgaboneseAordinalsAnoticiasAmuseveniAstericAcharaxesAamjadAresectionAjoinvilleAleczycaAanastasiusApurbeckAsubtribeAdallesAleadoffAmonoamineAjettisonedAanthologizedBlfretonAindicAbayezidAtottoriAcolonizingAassassinatingAunchangingAeusebianAd'estaingAtsingtaoBoshioBransferasesAperonistAmetrologyAequusAmirpurAlibertarianismAkovilAindoleA'greenAabstentionAquantitativelyAicebreakersAtribalsAmainstaysAdryandraAeyewearAnilgiriAchrysanthemumAinositolAfreneticAmerchantmanAhesarAphysiotherapistAtransceiverAdancefloorArankineAneisseAmarginalizationAlengthenAunaidedAreworkApageantryAsavioBtriatedAfunenAwittonAilluminatesAfrassAhydrolasesAakaliAbistritaAcopywriterAfiringsAhandballerAtachinidaeAdmytroAcoalesceAneretvaAmenemBorainesAcoatbridgeBrossrailAspoofedAdroseraAripenAprotourAkikuyuAboleslavAedwardesAtroubadoursAhaplogroupsAwrasseAeducationalistAsrodaAkhanehAdagbladetAapenninesAneuroscientistAdeploredAterjeAmaccabeesAdaventryAspaceportAlesseningAducatsAsinger/guitaristAchambersburgBonfigurableBeremoniallyAunrelentingAcaffeAgraafAdenizensAkingsportAingushApanhardAsynthesisedAtumulusAhomeschooledAbozorgAidiomaticAthanhouserAqueenswayAradekAhippolytusAinkingAbanovinaApeacocksBiauiAhandsworthApantomimesAabaloneAtheraAkurzweilAbanduraAaugustiniansAbocelliAferrolAjiroftAquadratureAcontraventionAsaussureArectificationAagrippinaBngelisAmatanzasAnidarosApalestrinaAlatiumAcoriolisBlostridiumAordainAutteringAlanchesterAproteolyticAayacuchoAmerseburgAholbeinAsambalpurAalgebraicallyAinchonAostfoldAsavoiaAcalatravaAlahiriAjudgeshipAammoniteAmasarykBeyerbeerAhemorrhagicAsuperspeedwayAningxiaApaniclesAencirclesAkhmelnytskyAprofusionAesherAbabolAinflationaryAanhydrideAgaspeAmossyAperiodicityAnacionAmeteorologistsAinterventionalAsarinAmoultAenderbyAmodellApalgraveAwarnersAmontcalmAsiddhaAfunctionalismArilkeApoliticizedAbroadmoorAkunsteAordenAbrasileiraAaranetaAeroticismAcolquhounAmambaAblacktownAtubercleAseagrassAmanoelAcamphorAneoregeliaAllandudnoAannexeAenplanementsAkamienAploversAstatisticiansAiturbideAmadrasahAnontrivialApublicanAlandholdersAmanamaAuninhabitableArevivalistAtrunklineAfriendlinessAgurudwaraArocketryAunidoAtriposAbesantBraqueAevolutionarilyAabkhazianAstaffelAratzingerAbrockvilleBohemondAintercutAdjurgardenAutilitarianismAdeploysAsastriAabsolutismAsubhasAasgharAfictionsAsepinwallAproportionatelyAtitleholdersBhereonAfoursquareAmachinegunAknightsbridgeAsiauliaiAaqabaAgearboxesAcastawaysAweakensAphallicAstrzelceAbuoyedArutheniaApharynxAintractableAneptunesAkoineAleakeyAnetherlandishApreemptedAvinayAterracingAinstigatingAalluviumAprostheticsAvorarlbergApolitiquesAjoineryAreduplicationAnebuchadnezzarAlenticularAbankaAseaborneApattinsonAhelplineAalephAbeckenhamAcaliforniansAnamgyalAfranziskaAaphidAbranaghAtranscribeAappropriatenessAsurakartaAtakingsApropagatesAjurajAb0d3fbBreraAarrayedAtailbackAfalsehoodAhazletonAprosodyAegyptologyApinnateAtablewareAratanAcamperdownAethnologistAtabariAclassifiersAbiogasA126thAkabilaAarbitronBpuestasAmembranousAkincardineAoceanaAgloriesAnatickApopulismAsynonymyAghalibAmobilesCtherboardsAstationersAgerminalApatronisedAformula_58AgaboroneAtortsAjeezyAinterleagueAnovayaAbatticaloaAoffshootsAwilbrahamAfilenameAnswrflAtrilobiteApythonsAoptimallyAscientologistsArhesusApilsenAbackdropsCtangAunionvilleAhermanosAshrikesAfarehamAoutlawingAdiscontinuingAboisterousAshamokinBcantyBouthwestwardAexchangersAunexpiredAmewarAh.m.sAsaldanhaApawanAcondorcetAturbidityAdonauAindulgencesAcoincidentBliquesAweekliesAbardhamanAviolatorsAkenaiAcaspaseAxperiaAkunalAfistulaAepistemicAcammellAnephiAdisestablishmentArotatorAgermaniawerftApyaarAchequeredAjigmeAperlisAanisotropicApopstarsAkapilAappendicesAberatAdefectingAshacksAwrangelApanchayathAgornaAsucklingAaerosolsAsponheimAtalalAboreholeAencodingsClaiAsubduingAagongAnadarAkitsapAsyrmiaAmajumdarApichilemuAcharlevilleAembryologyAbootingAliteratiAabuttingAbasaltsAjussiArepubblicaAhertogenboschAdigitizationArelentsAhillfortAwiesenthalAkircheAbhagwanBactrianAoasesAphylaAneutralizingAebooksAspearheadingAmargarineA'goldenAphosphorBiceaAstimulantsAoutliersAtimescaleAgynaecologyAintegratorAskyrocketedAbridgnorthAsenecioAramachandraAsuffragistAarrowheadsBswanAinadvertentAmicroelectronicsA118thAsoferAkubicaAmelanesianAtuankuAbalkhAvyborgAcrystallographicAinitiatorsAmetamorphismAginzburgAlootersAunimprovedAfinistereAnewburyportBorgesAimmunitiesAfranchiseesAasterismAkortrijkAcamorraAkomsomolAfleursAdraughtsApatagonianAvoraciousAartinAcollaborationistArevolucionDitalizingAxaverApurifyingAantipsychoticAdisjunctApompeiusAdreamwaveAjuvenalAbeinnAadiyamanBntitankBllamaAboletusAmelanogasterAdumitruAcaproniAalignsBthabaskanAstobartAphallusAveikkausliigaAhornseyAbufferingBourbonsAdobrujaAboraxAelectricsAgangnamAmotorcyclistAwhidbeyAdraconianAlodgerAgalileanAsanctificationAboldnessAunderbossAwheatlandAcantabrianAterceiraAmaumeeAredefiningAuppercaseAostrodaAcharacteriseAuniversalismAequalizedAsyndicalismAharingeyAmasoviaAdeleuzeAfunkadelicAconcealsAthuanAminskyApluralisticAludendorffAbeekeepingBonfiresAendoscopicAabutsAprebendAjonkopingAamamiAtribunesAyup'ikAawadhAgasificationApforzheimAreformaAantiwarAvaishnavismAmaryvilleAinextricablyAmargretheAempresaAneutrophilsAsanctifiedAponcaAelachistidaeAcuriaeAquartierAmannarAhyperplasiaAwimaxAbusingAneologismAflorinsAunderrepresentedAdigitisedAnieuwAcoochAhowardsAfregeAhughieApliedAswaleAkapellmeisterAvajpayeeAquadrupledAaeronautiqueAdushanbeAcustosAsaltilloAkisanAtigrayAmanausAepigramsAshamanicApepperedAfrostsApromotion/relegationAconcedesAzwingliAcharentesAwhangareiAspring/summerBobreAeretzAinitializationAsawaiAephemeraAgrandfatheredAarnaldoAcustomisedApermeatedBarapetsAgrowthsAvisegradAestudiosAaltamontAprovinciaAapologisesAstoppardAcarburettorAriftsAkinematicAzhengzhouAeschatologyAprakritAfolateAyvelinesAscapulaBtupasArishonBeconfigurationAflutistA1680sAapostolateAproudhonAlakshmanAarticulatingAstortfordAfaithfullAbitternsAupwellingAqur'anicAlidarAinterferometryAwaterloggedAkoiralaAdittonAwavefunctionAfazalAbabbageAantioxidantsAlembergAdeadlockedAtolledAramapoAmathematicaAleiriaAtopologiesAkhaliAphotonicAbaltiA1080pAcorrectsArecommencedApolyglotAfriezesAtiebreakAcopacabanaBholmondeleyAarmbandBbolishmentAsheamusAbuttesAglycolysisAcatalogedAwarrentonAsassariAkishanAfoodserviceAcryptanalysisAholmenkollenAcosplayAmachiAyousufAmangalAallyingAfertiliserAotomiAcharlevoixAmetallurgAparisiansAbottlenoseAoakleighAdebugAcidadeAaccedeAligationAmadhavaApillboxesAgatefoldAaveyronAsorinAthirskAimmemorialAmenelikChraAdomingosAunderpinnedAfleshedAharshnessAdiphthongAcrestwoodAmiskolcAdupriApyraustaAmuskingumAtuobaAprodiAincidencesAwaynesboroAmarquesasAheydarAartesianAcalinescuAnucleationAfundersAcovalentlyCmpactionAderbiesAseatersBodorAtabularAamadouApeckinpahAo'halloranAzechariahAlibyansAkartikAdaihatsuAchandranAerzhuAheresiesAsuperheatedAyarderAdordeAtanjoreAabusersAxuanwuAjuniperusAmoesiaAtrusteeshipAbirdwatchingBeatzAmoorcockAharbhajanAsangaAchoreographicAphotonicsAboylstonAamalgamateAelectrifyingAsarathAinaccuratelyApowerpointAchainingBpusaAadulterousAsaccharomycesAglogowAvfl/aflAsyncreticBimlaApersistingAfunctorsAallostericAeuphorbiaceaeAjuryoAmladaBoanaAgabalaAthornycroftAkumanovoAostrovskyAsitioAtutankhamunAsauropodsAkardzhaliAreinterpretationAsulpiceArosythAoriginatorsAhalesowenAdelineationAasesoriaBbatementAgardaiAelytraAtaillightsAoverlaysAmonsoonsAsandpipersAingmarAhenricoAinaccuracyBrwellAarenabowlAelcheApressburgAsignalmanAintervieweesAsinkholeApendleAecommerceAcellosAnebriaAorganometallicAsurrealisticApropagandistAinterlakenAcanandaiguaAaerialsAcoutinhoApascagoulaAtonopahAletterkennyAgropiusAcarbonsAhammocksAchildeApolitiesAhosieryAdonitzAsuppressesAdiaghilevAstroudsburgAbagramApistoiaAregeneratingAunitariansAtakeawayAoffstageAvidinAglorificationAbakuninAyavapaiAlutzowAsabercatsAwitneyAabrogatedAgorlitzAvalidatingAdodecahedronAstubbornlyAtelenorAglaxosmithklineAsolapurAundesiredAjellicoeAdramatizationAfour-and-a-halfAseawallAwaterparkAartaxerxesAvocalizationAtypographicAbyungAsachsenhausenBheppartonAkissimmeeBonnanAbelsenAdhawanAkhurdAmutagenesisAvejleAperrotAestradiolAformula_60AsarosAchiloeAmisionesAlampreyAterrainsAspekeAmiastoAeigenvectorsAhaydockAreservistAcorticosteroidsAsavitriBhinawatraAdevelopmentallyAyehudiAberatesAjanissariesArecapturingBancheriaAsubplotsAgresleyAnikkatsuAoryolAcosmasAboavistaAformula_59AplayfullyAsubsectionsAcommentatedAkathakaliAdoridAvilaineAseepageAhylidaeAkeijiBazakhsAtriphosphateA1620sAsupersedeAmonarchistsAfallaAmiyakoAnotchingAbhumibolApolarizingAsecularizedBhingledAbronislawAlockerbieAsoleymanAbundesbahnAlatakiaAredoubtsAboultAinwardlyCventsAondrejAminangkabauAnewquayApermanenteAalhajiAmadhavCliniAelliceAbookmakerAmankiewiczAetihadAo'deaAinterrogativeAmikawaAwallsendAcanisiusAbluesyAvitruviusAnoordAratifyingAmixtecAgujranwalaAsubprefectureAkeelungAgoianiaAshi'iteBemitoneAch'uanBomputerisedApertuanAcatapultsAnepomukAshrutiAmillstonesAbuskerudAacolytesAtredegarAsarumAarmiaAdell'arteCvisesAcustodiansAupturnedAgallaudetAdisembarkingAsagradaAmyeonAundeclaredAqumranAgaidenAtepcoAjanesvilleAshowgroundAcondenseBhalonAunstaffedApasayAundemocraticAhautsAviridisAuninjuredAescutcheonAgymkhanaApetalingAhammamAdislocationsAtallaghtArerumAshiasAindiosAguarantyAsimplicialAbenaresDedictionAtajiriAprolificallyAhuaweiAonerousAgranteeAferencvarosAotrantoAcarbonatesBonceitAdigipakAqadriAmasterclassesAswamijiAcradockAplunketAhelmsmanA119thAsalutesAtippecanoeAmurshidabadAintelligibilityAmittalAdiversifyingAbidarAasansolAcrowdsourcingArovereAkarakoramAgrindcoreAskylightsAtulagiAfurrowsAligneAstukaBumerCbgraphAregionalistAbulkeleyAteletextAglorifyAreadiedAlexicographerAsabadellApredictabilityAquilmesAphenylalanineAbandaranaikeApyrmontAmarksmenAquislingAviscountessAsociopoliticalAafoulApedimentsAswaziAmartyrologyAnullifyApanagiotisAsuperconductorsAveldenzAjujuyAl'isleAhematopoieticAshafiBubseaAhattiesburgAjyvaskylaAkebirAmyeloidAlandmineAderechoAamerindiansAbirkenauAscriabinAmilhaudBucosalAnikayaAfreikorpsAtheoreticianAproconsulAo'hanlonAclerkedAbactriaAhoumaAmacularAtopologicallyAshrubbyAaryehAghazaliAafferentAmagalhaesBoduliAashtabulaAvidarbhaAsecuritateAludwigsburgAadoorAvarunAshujaAkhatunAchengdeAbushelsAlascellesAprofessionnelleAelfmanArangpurAunpoweredAcitytvBhojniceAquaternionAstokowskiAaschaffenburgAcommutesAsubramaniamAmethyleneAsatrapAgharbAnamesakesArathoreAhelierAgestationalAheraklionAcolliersAgiannisApasturelandAevocationAkrefeldAmahadevaAchurchmenAegretAyilmazAgaleazzoApudukkottaiAartigasAgeneralitatAmudslidesAfrescoedAenfeoffedAaphorismsAmelillaBontaigneAgauligaAparkdaleAmauboyAliningsApremaAsapirAxylophoneAkushanArockneAsequoyahAvasylArectilinearAvidyasagarAmicrocosmAsan'aAcarcinogenAthicknessesAaleutAfarcicalAmoderatingAdetestedAhegemonicAinstalmentsAvaubanBerwaltungsgemeinschaftApicayuneArazorbackAmagellanicBoluccasApankhurstAexportationAwaldegraveAsuffererAbayswaterA1up.comArearmamentAorangutansAvarazdinAb.o.bAelucidateAharlingenAeruditionAbrankovicAlapisAslipwayAurracaAshindeAelwesBuboeaAcolwynAsrivijayaAgrandstandsAhortonsAgeneralleutnantAfluxesApeterheadAgandhianArealsAalauddinAmaximizedAfairhavenAendowAciechanowAperforationsAdartersApanellistAmanmadeAlitigantsAexhibitorAtirolAcaracallaBonformanceAhotelierAstabaekAhearthsAboracAfrisiansAidentAvelikoAemulatorsAschoharieAuzbeksAsamarraAprestwickAwadiaAuniversitaAtanahAbucculatrixApredominatesAgenotypesAdenouncesAroadsidesAganassiAkeokukAphilatelistAtomicAingotsAconduitsAsamplersAabdusAjoharAallegoriesAtimaruAwolfpacksAsecundaBmeatonBportivoAinvertingAcontraindicationsAwhispererAmoradabadAcalamitiesAbakufuAsoundscapeBmallholdersAnadeemAcrossroadAxenophobicAzakirAnationalligaAglazesAretroflexAschwyzAmoroderArubraAqurayshAtheodorosAendemolAkm/hrArepositionedAportraitistAlluisAanswerableBrgesAmindednessAcoarserAeyewallAteleportedAscoldsAupplandAvibraphoneAricohAisenburgAbricklayerAcuttlefishAabstentionsAcommunicableBephalopodAstockyardsAbaltoAkinstonAarmbarAbandiniAelphabaAmaximsAbedouinsAsachsenAfriedkinAtractateApamirAivanovoAmohiniAkovalainenAnambiarAmelvynAorthonormalAmatsuyamaAcuernavacaAvelosoAoverstatedAstreamerAdravidAinformersAanalyteAsympathizedBtreetscapeAgostaAthomasvilleAgrigoreAfutunaAdepletingAwhelksAkiedisAarmadaleAearnerAwynyardAdothanAanimatingAtridentineAsabriAimmovableArivoliAariegeAparleyAclinkerBirculatesAjunagadhAfraunhoferAcongregantsA180thAbuducnostAformula_62AolmertAdedekindAkarnakAbayernligaAmazesAsandpiperAecclestoneAyuvanAsmallmouthAdecolonizationAlemmyAadjudicatedAretiroAlegiaAbenueApositAacidificationAwahabAtaconicAfloatplaneAperchlorateAatriaAwisbechAdivestmentBallaraAphrygiaBalustrisAcybersecurityArebatesAfacieAmineralogicalAsubstituentAprotegesAfoweyAmayenneAsmoothboreAcherwellAschwarzschildAjuninAmurrumbidgeeAsmalltalkAd'orsayAemiratiAcalaverasAtitusvilleBhereminAvikramadityaAwampanoagAburraAplainesAoneginAemboldenedAwhampoaAlangaAsoderberghAarnazAsowerbyAarendalAgodunovApathanamthittaAdamselflyAbestowingAeurosportAiconoclasmAoutfittersAacquiescedAbadawiAhypotensionAebbsfleetAannulusAsohrabAthenceforthAchagataiAnecessitatesAaulusAodditiesAtoynbeeAuniontownAinnervationApopulaireAindivisibleArosselliniAminuetAcyreneAgyeongjuAchaniaBichlidsAharrodsA1690sAplungesAabdullahiAgurkhasAhomebuiltAsortableAbanguiArediffAincrementallyAdemetriosAmedailleAsportifBvendAguttenbergAtubulesAcarthusianApleiadesAtoriiAhoppusAphenylAhannoAconynghamAteschenAcronenbergAwordlessAmelatoninAdistinctivenessAautosAfreisingAxuanzangAdunwichAsatanismBweynApredragAcontractuallyApavlovicAmalaysiansBicrometresAexpertlyApannonianAabstainingAcapensisAsouthwesterlyAcatchphrasesBommercializeAfrankivskAnormantonAhibernateAversoAdeporteesBublinersAcodice_8CndorsAzagrosAglossesAleadvilleAconscriptAmorrisonsAusuryAossianBultonAvacciniumAcivetAaymanAcodringtonAhadronAnanometersAgeochemistryAextractorAgrigoriAtyrrhenianAneocollyrisAdroopingAfalsificationAwerftAcourtauldAbrigantineAorhanAchapultepecAsupercopaAfederalizedApragaAhaveringAencampmentsAinfallibilityAsardisApawarAundirectedAreconstructionistAardrossanAvarunaApastimesAarchdiocesanAfledgingAshenhuaAmoliseAsecondarilyBtagnatedAreplicatesAcienciasAduryodhanaAmaraudingAruislipAilyichBntermixedAravenswoodAshimazuAmycorrhizalAicosahedralAconsentsAdunblaneAfollicularApekinAsuffieldAmuromachiAkinsaleAgaucheAbusinesspeopleAtheretoAwataugaAexaltationAchelmnoAgorseAproliferateAdrainagesAburdwanAkangraAtransducersAinductorAduvalierAmaguindanaoBoslemAuncafAgivenchyAplantarumAliturgicsAtelegraphsAlukashenkoAchenangoAandanteAnovaeAironwoodAfaubourgAtormeAchinensisAambalaApietermaritzburgAvirginiansAlandformAbottlenecksAo'driscollAdarbhangaAbaptisteryAameerAneedleworkBapervilleAauditoriumsAmullingarAstarrerAanimatronicAtopsoilAmaduraAcannockAvernetAsanturceAcatocalaAozekiApontevedraAmultichannelAsundsvallBtrategistsAmedioA135thAhalilAafridiAtrelawnyAcaloricAghraibAallendaleAhameedAludwigshafenAspurnedApavloClmarAstrafedAcatamarcaAaveiroAharmonizationAsurahApredictorsAsolvayAmandeAomnipresentAparenthesisAecholocationBqualingBxperimentersAacyclicAlithographicAsepoysAkatarzynaAsrideviAimpoundmentAkhosrowAcaesareanAnacogdochesArockdaleAlawmakerAcaucasiansAbahmanAmiyanArubricAexuberanceAbombasticAductileAsnowdoniaAinlaysApinyonAanemonesAhurriesBospitallersAtayyipApulleysAtremeAphotovoltaicsAtestbedApoloniumAryszardAosgoodeAprofitingAironworkAunsurpassedAnepticulidaeAmakaiAlumbiniApreclassicAclarksburgAegremontAvideographyArehabilitatingApontyAsardonicAgeotechnicalAkhurasanAsolzhenitsynAphoeniciaArhyoliteAchateauxAretortedAtomarAdeflectionsArepressionsAharboroughArenanAbrumbiesAvandrossAstoriaAvodouAclerkenwellAdeckingAuniversoAsalon.comAimprisoningAsudwestAghaziabadAsubscribingApisgahAsukhumiAeconometricAclearestApindarAyildirimAiuliaAatlasesAcementsAremasterAdugoutsAcollapsibleAresurrectingAbatikAunreliabilityAthiersAconjunctionsClophonAmarcherAplaceholderAflagellaAwoldsAkibakiAviviparousAtwelverAscreenshotsAaroostookAkhadrAiconographicBtascaAjaumeAbastiApropoundedAvarroAbe'erAjeevanAexactedAshrublandsAcreditableAbrocadeBorasBitternAoneontaAattentionalAherzliyaAcomprehensibleAlakevilleAdiscardsAcaxiasAfranklandAcamerataAsatoruAmatlabAcommutatorAinterprovincialAyorkvilleAbeneficesAnizamiAedwardsvilleAamigaosAcannabinoidAindianolaAamateurligaAperniciousAubiquityAanarchicAnoveltiesApreconditionAzardariAsymingtonBargodhaAheadphoneAthermopylaeAmashonalandAzindagiAthalbergAloeweAsurfactantsAdobroAcrocodiliansAsamhitaAdiatomsAhaileyburyAberwickshireAsupercriticalBnornaBlatinaAintramolecularAagungAosteoarthritisBbstetricAteochewAvakhtangAconnemaraAdeformationsBiademAferruccioAmainichiAqualitativelyArefrigerantCrecordedAmethylatedAkarmapaBrasinskiArestatementBouvasAcubittAseacoastBchwarzkopfAhomonymousAshipownerAthiamineAapproachableAxiahouA160thAecumenismApolistesAinternazionaliAfouadAberarBiogeographyAinadequatelyA4kidsAhymenopteraAemplacedAcognomenAbellefonteAsupplantAmichaelmasAurielAtafsirAmorazanAschweinfurtAchoristerAps400AnscaaApetipaAresolutelyAouagadougouAmascareneAsupercellAkonstanzAbagratAharmonixAbergsonAresonatorsAvenetaAcamasAmynyddArumfordAgeneralmajorAkhayyamAweb.comApappusAhalfdanAtananaAsuomenAyutakaAbibliographicalAtraianAsilatAnoaillesAcontrapuntalAagaricusA'specialAminibusesA1670sAobadiahAdeepaArorschachAmalolosAlymingtonAvaluationsAimperialsAcaballerosAambroiseAjudicatureAelegiacAsedakaBhewaAchecksumAgosforthAlegionariesAcorneilleAmicroregionAfriedrichshafenAantonisAsurnamedAmyceliumAcantusAeducationsAtopmostAoutfittingAivicaAnankaiAgoudaAanthemicAiosifAsupercontinentAantifungalAbelarusiansAmudaliarBohawksAcavershamAglaciatedAbasemenAstevanAclonmelAloughtonAdeventerApositivistAmanipuriAtensorsApanipatAchangeupAimpermeableAdubboAelfsborgAmaritimoAregimensAbikramBromeliadAsubstratumAnorodomAgaultierAqueanbeyanApompeoAredactedAeurocopterAmothballedAcentaursAbornoAcopraAbemidjiA'homeAsopronAneuquenApassoAcineplexAalexandrovAwysokieAmammothsAyossiAsarcophagiAcongreveApetkovicAextraneousAwaterbirdsAslursAindiasAphaetonAdiscontentedAprefacedAabhayAprescotAinteroperableAnordiskAbicyclistsAvalidlyAsejongAlitovskAzanesvilleAkapitanleutnantBerchAchangeableAmcclatchyAcelebiAattestingAmaccollAsepahanAwayansAveinedAgaudensAmarktAdanskAsoaneAquantizedApetershamAforebearsAnayaritAfrenziedAqueuingAbygoneAludwikAtankaAhanssenAbrythonicAcornhillAprimorskyAstockpilesAconceptualizationAlampeterAhinsdaleAmesodermAbielskArosenheimAultronAjoffreyAstanwyckAkhaganAtiraspolApavelicAascendantAempoliAmetatarsalAdescentralizadoAmasadaAligierAhuseyinAramadiAwaratahAtampinesArutheniumAstatoilAmladostAligerAgrecianAmultipartyAdigraphAmaglevAreconsiderationBadiographyAcartilaginousAtaizuAwinteredAanabaptistApeterhouseAshoghiAassessorsAnumeratorApauletCinstakinglyAhalakhicArocroiAmotorcyclingAgimelAkryptonianAcheekedAdrawdownAlelouchAdaciansAbrahmanaAreminiscenceAdisinfectionAoptimizationsAgoldersAextensorAtsugaruAlimanAgulzarAunconvincedAcrataegusAoppositionalAdvinaApyrolysisAmandanAalexiusAprionAstressorsAloomedAmoatedAdhivehiArecyclableClictAnestlingsAsarandonAkosovarAsolversAczeslawAkentaAmaneuverableBiddensAberkhamstedAcomillaAfolkwaysAloxtonAbeziersBatumiApetrochemicalsAoptimisedAsirjanArabindraAmusicalityArationalisationAdrillersAsubspacesA'liveAbbwaaAoutfieldersAtsungAdanskeAvandalisedAnorristownAstriaeAkanataAgastroenterologyAsteadfastlyAequalisingAbootleggingAmannerheimAnotodontidaeAlagoaAcommentatingApeninsulasAchishtiAseismologyAmodiglianiApreceptorAcanonicallyAawardeeAboyacaAhsinchuAstiffenedAnacelleAbogorAdrynessAunobstructedAyaqubAscindiaApeetersAirritantAammonitesAferromagneticAspeechwriterAoxygenatedAwalesaAmillaisAcanarianAfaienceAcalvinisticAdiscriminantArashtAinkerAannexesAhowthAallocatesAconditionallyArousedBegionalismIbahnAfunctionaryAnitratesAbicentenaryArecreatesAsaboteursAkoshiAplasmidsAthinnedA124thAplainviewAkardashianAneuvilleAvictoriansAradiatesA127thAviequesAschoolmatesApetruAtokusatsuAkeyingAsunainaAflamethrowerAdemersalAhosokawaAcorelliAomniscientB'dohertyAniksicAreflectivityAtransdevAcavourAmetronomeAtemporallyAgabbaAnsaidsAgeertAmayportAhematiteAboeotiaAvaudreuilAtorshavnAsailplaneAmineralogistAeskisehirApractisesAgallifreyAuneaseAhedmarkApaulinusAailsaAwielkopolskaAfilmworksAadamantlyAvinayaAfaceliftedBranchiseeAaugustanaAtopplingAvelvetyAcrispaAstoningtonAhistologicalAgenealogistAtacticianBebowAbetjemanAnyingmaAoverwinterBberoiArampalAoverwintersApetalumaAlactariusAstanmoreAbalikpapanAvasantAinclinesAlaminateAmunshiAsociedadeArabbahAseptalAboybandAingrainedAfalteringAinhumansAnhtsaAaffixAl'ordreAkazukiArossendaleAmysimsAlatviansAslaveholdersAbasilicataAneuburgAassizeAmanzanilloAscrobipalpaAformula_61AbelgiqueApterosaursBrivateeringAvaasaBeriaAnorthportApressurisedAhobbyistAausterlitzAsahihAbhadraAsiliguriAbistricaBursariesAwyntonAcorotAlepidusBullyBiborDeraAolusegunAcholineAmannerismAlymphocyteAchagosAduxburyAparasitismAecowasAmorotaiAcancionBonistonAaggrievedAsputnikmusicAparleAammonianAcivilisationsAmalformationAcattaraugusAskyhawksAd'arcBemeraraAbronfmanAmidwinterApiscatawayAjogailaAthreonineAmatinsAkohlbergAhubliApentatonicAcamillusAnigamApotroAunchainedAchauvelAorangevilleAcisterciansAredeploymentAxanthiAmanjuAcarabinieriApakehaAnikolaevichAkantakouzenosAsesquicentennialAgunshipsAsymbolisedAteramoAballoAcrusadingAl'oeilAbharatpurAlazierAgabrovoAhysteresisArothbardAchaumontAroundelAma'munAsudhirAqueriedAnewtsAshimaneApresynapticBlayfieldAtaxonomistsAsensitivitiesAfrelengAburkinabeAorfeoAautoviaAproselytizingAbhangraApasokAjujutsuAheungApivotingAhominidAcommendingAformula_64AepworthAchristianizedAoresundAhantuchovaArajputanaAhilversumAmasoreticAdayakAbakriAassenAmagogCcromoleculesAwaheedAqaidaAspasskyArumpedAprotrudesCemingerAmisogynyAglencairnAsalafiAlacunaeAgrillesAracemesAarevaBlighieriAinariAepitomizedAphotoshootAone-of-a-kindAtringAmuralistAtinctureAbackwatersAweanedAyeastsAanalyticallyAsmalandAcaltransAvysocinaAjamunaAmauthausenA175thAnouvellesAcensoringAregginaAchristologyAgiladAamplifyingAmehmoodAjohnsonsAredirectsAeastgateAsacrumAmeteoricAriverbanksAguidebooksAascribesAscopariaAiconoclasticAtelegraphicAchineAmerahBisticoAlecternAsheungAaethelstanAcapablancaAanantAusptoAalbatrossesAmymensinghAantiretroviralAclonalBoorgAvaillantAliquidatorAgigasAyokaiAeradicatingAmotorcyclistsAwaitakereAtandonAnearsAmontenegrinsA250thAyassinAatheisticAsyncretismAnahumAberishaAtranscendedAowensboroAlakshmanaAabteilungAunadornedAnyackAoverflowsAharrisonburgAcomplainantAuematsuAfrictionalAworsensAsangguniangAabutmentAbulwerAsarmaAapollinaireAshippersAlyciaAalentejoAporpoisesAoptusAtrawlingAaugustowAblackwallAworkbenchBestmountAleapedAsikandarAconveniencesAstornowayAculvertsAzoroastriansAhristoAansgarBssistiveAreassertAfannedAcompassesAdelgadaAmaisonsAarimaAplonskAverlaineAstarstruckArakhineAbefellAspirallyAwyclefAexpendAcolloquiumAformula_63AalbertusAbellarmineAhandednessBolonAintronsAmovimientoAprofitablyAlohengrinAdiscoverersAawashAersteAphariseesAdwarkaAoghuzAhashingBeterodoxAuloomAvladikavkazAlinesmanArehiredAnucleophileAgermanicusBulshanAsongzAbayerischeAparalympianAcrumlinAenjoinedAkhanumAprahranBenitentAamersfoortAsaranacBemisimpleAvagrantsAcompositingAtualatinAoxalateAlavraAironiBlkestonAumpquaAcalumAstretfordAzakatAgueldersAhydrazineAbirkinAspurringAmodularityAaspartateAsodermanlandAhopitalAbellaryAlegazpiAclasicoBadfaelAhypersonicAvolleysApharmacokineticsAcaroteneAorientaleApausiniAbatailleAlungaAretailedAm.philBazowieckieAvijayanArawalAsublimationApromissoryAestimatorsAploughedAconflagrationApendaAsegregationistAotleyAamputeeAcoauthorAsopraApellewAwreckersAtollywoodAcircumscriptionApermittivityAstrabaneAlandwardAarticulatesAbeaverbrookArutherglenAcoterminousAwhistleblowersAcolloidalAsurbitonAoswiecimAbhasaAlampoonedAchanterAsaarcAlandkreisAtribulationBoleratesAdaiichiAhatunAcowriesAdyschiriusAabercrombyBttockBldwychAinflowsAabsolutistAl'histoireAcommitteemanAvanbrughAheadstockAwestbourneAappenzellAhoxtonAoculusAwestfalenAroundaboutsAnickelbackAtrovatoreAquenchingAsummarisesAconservatorsAtransmutationBalleyrandAbarzaniAunwillinglyAaxonalA'blueAopiningAenvelopingAfideszArafahAcolborneAflickrAlozengeAdulcimerAndebeleAswarajAoxidizeAgonvilleAresonatedAgilaniAsuperioreAendearedAjanakpurAsheppertonBolidifyingAmemorandaAsochauxAkurnoolArewariAemirsAkooningAbrufordAunavailabilityAkayseriAjudiciousAnegatingApterosaurAcytosolicBhernihivAvariationalAsabretoothBeawolvesAdevaluedAnandedAadverbAvolunteerismAsealersAnemoursAsmederevoAkashubianAbartinAanimaxAvicomteApolotskDderAarchiepiscopalBcceptabilityAquidditchAtussockAseminaireAimmolationAbelgeAcovesAwellingboroughAkhaganateAmckellenAnayakaAbregaAkabhiApontoonsAbasculeAnewsreelsAinjectorsAcobolAweblogAdiploAbiggarAwheatbeltAerythrocytesApedraAshowgroundsAbogdanovichAeclecticismAtolueneAelegiesAformalizeAandromedaeBirworthinessAspringvilleAmainframesAoverexpressionAmagadhaAbijeloAglutamineAaccentureAuhuruAmetairieAarabidopsisApatanjaliBeruviansAberezovskyAaccionBstrolabeAjayantiAearnestlyAsausalitoArecurvedA1500sAramlaAincinerationAgalleonsAlaplacianAshikiBmethwickAisomeraseAdordevicAjanowBeffersonvilleAinternationalismApenciledAstyreneAashurAnucleosideAperistomeAhorsemanshipAsedgesAbachataAmedesAkristallnachtAschneersonAreflectanceAinvalidedAstruttAdraupadiBestinoApartridgesAtejasAquadrennialAhalychAethnomusicologyAautonomistAradyoBiftingAshi'arAcrvenaAtelefilmAzawahiriAplanaAsultanatesAtheodorusAsubcontractorsApavleAseneschalAteleportsAchernivtsiAbuccalBrattleboroAstankovicBafarAdunhuangAelectrocutionAchastisedAergonomicA130thAzombaAnongovernmentalAescapistAlocalizeAxuzhouAkyrieAcarinthianAkarlovacAnisanAkramnikApilipinoAdigitisationAkhasiAandronicusAhighwaymanAmaiorBisspellingAsebastopolBoconArhaetianAarchimandriteApartwayBositivityAotakuAdingoesAtarskiAgeopoliticsAdisciplinarianAzulfikarAkenzoAgloboseAelectrophilicAmodeleAstorekeeperApohangAwheldonBashersAinterconnectingAdigraphsAintrastateAcampyAhelveticAfrontispieceBerrocarrilAanambraApetraeusAmidribAendometrialAdwarfismAmauryanAendocytosisAbrigsApercussionistsAfurtheranceAsynergisticAapocynaceaeAkronaAberthierAcircumventedBasalAsiltstoneAprecastAethnikosArealistsAgeodesyAzarzuelaAgreenbackAtripathiAperseveredAintermentsAneutralizationAolbermannAdepartementsAsupercomputingAdemobilisedAcassavetesAdunderAministeringAveszpremAbarbarismA'worldApieveAapologistAfrentzenAsulfidesAfirewallsApronotumAstaatsoperAhachetteAmakhachkalaAoberlandAphononAyoshihiroAinstarsApurnimaAwinsletAmutsuAergativeAsajidAnizamuddinAparaphrasedAardeidaeAkodaguAmonooxygenaseAskirmishersBportivaAo'byrneAmykolaivAophirAprietaAgyllenhaalAkantianAlecheAcopanAhereroAps250AgelsenkirchenAshalitBammarineseAchetwyndAwftdaAtravertineAwartaAsigmaringenAconcertiAnamespaceAostergotlandAbiomarkerAuniversalsAcollegioAembarcaderoAwimborneAfiddlersAlikeningAransomedAunabatedAkalakauaBhantyAgongsCodremAcountermeasureApublicizingAgeomorphologyAswedenborgAundefendedAcatastrophesAdivertsAstoryboardsAamesburyAcontactlessAplacentiaAfestivityAauthoriseAterraneBhalliumAstradivariusAantonineAconsortiaAestimationsAconsecrateAsupergiantAbelichickApendantsAbutylAgrozaAunivacAafireAkavalaAstudiAteletoonApaucityAgonbadAkoninklijkeA128thAstoichiometricAmultimodalAfacundoAanatomicAmelamineAcreuseAaltanAbrigandsAmcguintyAblomfieldAtsvangiraiAprotrusionAlurganAwarminsterAtenzinArussellvilleAdiscursiveBefinableAscotrailAligninAreincorporatedAo'dellButperformAredlandAmulticoloredAevaporatesAdimitrieAlimbicApatapscoAinterlinguaAsurrogacyAcuttyApotreroAmasudAcahiersAjintaoAardashirAcentaurusAplagiarizedAmineheadBusingsAstatuettesAlogarithmsAseaviewAprohibitivelyAdownforceArivingtonAtomorrowlandAmicrobiologistAferricAmoragAcapsidAkucinichAclairvauxAdemoticAseamanshipAcicadaApainterlyAcromartyBarbonicAtupouAoconeeAtehuantepecBypecastAanstrutherAinternalizedAunderwritersAtetrahedraAflagrantAquakesApathologiesAulrikAnahalAtarquiniAdongguanAparnassusAryokoAsenussiCleuciaAairasiaAeinerAsashesAd'amicoAmatriculatingAarabesqueAhonvedAbiophysicalAhardingeAkhersonAmommsenAdielsAicbmsAreshapeAbrasiliensisApalmachAnetajiAoblateAfunctionalitiesAgrigorAblacksburgArecoillessAmelanchthonArealesAastrodomeAhandcraftedAmemesAtheorizesAisma'ilAaartiApirinAmaatschappijAstabilizesAhoniaraAashburyAcoptsArootesAdefensedAqueirozAmantegnaAgalesburgAcoraciiformesfamilyBabrilloAtokioAantipsychoticsAkanonA173rdAapolloniaAfinialAlydianAhadamardArangiAdowlatabadAmonolingualAplatformerAsubclassesAchiranjeeviAmirabeauAnewsgroupAidmanyurduAkambojasAwalkoverAzamoyskiAgeneralistAkhediveAflangesAknowleAbandeA157thAalleynAreaffirmApininfarinaAzuckerbergAhakodateA131stAaditiAbellinzonaAvaulterAplankingAboscombeAcolombiansAlysisAtoppersAmeteredAnahyanAqueensrycheAminhoAnagercoilAfirebrandBoundressAbycatchAmendotaAfreeformAantenaAcapitalisationAmartinusAoverijsselApuristsAinterventionistAzgierzAburgundiansAhippolytaAtrompeAumatillaAmoroccansAdictionnaireAhydrographyAchangersCotaArimouskiAanilineAbylawAgrandnephewAneamtAlemnosAconnoisseursAtractiveArearrangementsAfetishismBinnicAapalachicolaAlandowningAcalligraphicBircumpolarAmansfeldAlegibleAorientalismAtannhauserAblameyAmaximizationAnoincludeAblackbirdsAangaraAostersundApancreatitisAglabraAaclerisAjuriedCngianAtriumphantlyAsingletAplasmasAsynesthesiaAyellowheadAunleashesAchoiseulAquanzhongAbrookvilleAkaskaskiaAigcseAskateparkAjatinBewellersAscaritinaeAtechcrunchClluriumAlachaiseAazumaAcodeshareAdimensionalityAunidirectionalAscolaireAmacdillAcamshaftsAunassistedAverbandAkahloAeliyaAprelatureAchiefdomsAsaddlebackBockersAiommiAcoloraturaAllangollenAbiosciencesAharshestAmaithiliAk'icheAplicalAmultifunctionalAandreuAtuskersAconfoundingAsambreAquarterdeckAasceticsAberdychAtransversalBuolumneAsagamiApetrobrasAbreckerAmenxiaAinstillingAstipulatingAoscillateAdeadpanAv/lineApyrotechnicAstonewareAprelimsAintracoastalAretrainingAilijaAberwynAencryptAachieversAzulfiqarAglycoproteinsAkhatibAfarmsteadsAoccultistAsamanAfionnAderuloAkhiljiAobrenovicAargosyAtoowongAdementievaAsocioculturalAiconostasisAfestschriftAtaifaAintercalatedAtanjongApentictonAsharadAmarxianAextrapolationAguisesAwettinAprabangAkostaAfamasAconakryAwanderingsA'aliabadAmacleayAexoplanetAbancorpBesiegersAsurmountingAcheckerboardArajabAvlietAoperableAwargamingAhaldimandAfukuyamaAuesugiAaggregationsAerbilAbrachiopodsAtokyuAanglaisAunfavorablyBjpestAescorialAarmagnacAnagaraAfunafutiAridgelineAo'gormanAcompactnessAretardantAkrajowaAbaruaAcokingAbestowsAthampiAchicagolandAvariablyAo'loughlinAminnowsAschwaBhaukatApolycarbonateAchlorinatedAgodalmingBramercyAdelvedAbanquetingAenlilAsaradaAprasannaAdomhnallBecadalAregressiveAlipoproteinAcollectableAsurendraAzaporizhiaAcyclisteAsuchetAoffsettingAformula_65ApudongAd'arteAblytonAquonsetAosmaniaAtientsinAmanoramaAproteomicsAbilleAjalpaiguriApertweeAbarnegatAinventivenessAgollanczAeuthanizedAhenricusAshortfallsAwuxiaAchloridesBerradoApolyvinylAfolktaleAstraddledAbioengineeringAeschewingArechargedAolaveAceyloneseAautocephalousApeacebuildingAwrightsAguyedAabitibiAbannockburnAgerontologyAscutariBounessBeagramAcodice_9A'openAxhtmlAtaguigApurposedAdarbarAorthopedicsAunpopulatedAkisumuAtarrytownAfeodorApolyhedralAmonadnockAgottorpApriamAredesigningAgasworksAelfinAurquizaAhomologationAfilipovicAbohunAmanninghamAgornikAsoundnessBhoreaAlanusAgelderAdarkeAsandgateAcriticalityAparanaenseA153rdAviejaAlithographAtrapezoidBiebreakersAconvalescenceAyan'anAactuariesAbaladAaltimeterAthermoelectricBrailblazerAprevinAtenryuAancasterAendoscopyAnicoletAdisclosesAfrackingAplaineAsaladoAamericanismAplacardsAabsurdistApropyleneAbrecciaAjirgaAdocumentaAismailisA161stAbrentanoAdallas/fortAembellishmentAcalipersAsubscribesAmahavidyalayaAwednesburyAbarnstormersAmiwokAschembechlerAminigameAunterbergerAdopaminergicAinacioAnizamabadAoverriddenAmonotypeAcavernousAstichtingBassafrasBothoAargentineanAmyrrhArapidityAflattsAgowrieAdejectedAkasaragodAcyprinidaeAinterlinkedAarcsecondsAdegeneracyAinfamouslyCcubateAsubstructureAtrigeminalAsectarianismAmarshlandsAhooliganismBurlersAisolationistAuraniaAburrardAswitchoverAleccoAwiltsAinterrogatorAstrivedAballooningAvolterraAraciborzBelegatingAgildingAcybeleAdolomitesAparachutistAlochaberAoratorsAraeburnAbackendBenaudArallycrossAfacingsAbangaAnuclidesAdefencemenAfuturityAemittersAyadkinAeudoniaAzambalesAmanassehAsirteAmeshesApeculiarlyAmcminnvilleAroundlyAbobanAdecryptAicelandersAsanamAchelanAjovianAgrudginglyApenalisedAsubscriptAgambrinusApoaceaeAinfringementsAmaleficentAruncimanA148thAsupersymmetryAgranitesAliskeardAelicitingAinvolutionAhallstattAkitzbuhelAshanklyBandhillsAinefficienciesAyishuvApsychotropicAnightjarsAwavellAsangamonAvaikundarAchoshuAretrospectivesApitestiAgiganteaAhashemiAbosnaAgakuinAsiochanaAarrangersAbaronetciesAnarayaniAtemeculaAcrestonAkoscierzynaAautochthonousAwyandotAannistonAigrejaAmobiliseAbuzauAdunsterAmusselburghAwenzhouAkhattakAdetoxificationCcarboxylaseAmanliusAcampbellsBoleopteraCpyistAsympathisersBuisunAeminescuAdefensorAtransshipmentBhurgauAsomertonAfluctuatesAambikaAweierstrassAlukowAgiambattistaAvolcanicsAromanticizedAinnovatedAmatabelelandAscotiabankAgarwolinApurineAd'auvergneAborderlandAmaozhenApricewaterhousecoopersAtestatorApalliumAscout.comAmv/piAnazcaAcuraciesAupjohnAsarasvatiAmonegasqueAketrzynAspikeletsAbiomechanicsAhaciendasArappedAdwarfedAstewsAnijinskyAsubjectionAmatsuAperceptibleAschwarzburgAmidsectionAentertainsAcircuitousAepiphyticAwonsanAalpiniAbluefieldAslothsAtransportableAbraunfelsAdictumAszczecinekAjukkaAwielunBejherowoAhucknallAgrameenAduodenumAriboseAdeshpandeAshaharAnexstarAinjuriousAderehamAlithographerAdhoniAstructuralistAprogresoAdeschutesAchristusApulteneyAquoinsAyitzchakAgyeongsangAbreviaryAmakkahAchiyodaAjuttingAvinelandAangiospermsAnecroticBovelisationAredistributeAtirumalaA140thAfeaturelessAmaficArivalingAtoylineA2/1stAmartiusAsaalfeldAmonthanAtexianAkathakAmelodramasBithilaAregierungsbezirkA509thAfermentingAschoolmateAvirtuosicAbriainAkokodaAheliocentricBandpickedAkilwinningAsonicallyAkasimAparkwaysAbogdanovAluxembourgianAhallandAavestaAbardicAdaugavpilsAexcavatorAqwestAfrustrateAphysiographicAmajorisA'ndranghetaAunrestrainedAfirmnessAmontalbanAabundancesApreservationistsAadareAexecutionersAguardsmanAbonnarooAneglectsBazrulApro12AhoornAabercornArefutingAkabudAcationicAparapsychologyAtroposphereAvenezuelansAmalignancyAkhojaAunhinderedAaccordionistAmedakAvisbyAejercitoAlaparoscopicAdinasAumayyadsAvalmikiAo'dowdAsaplingsBtrandingAincisionsBllusionistAavocetsAbuccleuchAamazoniaAfourfoldAturbopropsAroostsApriscusAturnstileAarealAcertifiesApocklingtonAspoofsAviseuAcommonalitiesAdabrowkaAannamAhomesteadersAdaredevilsAmondrianAnegotiatesAfiestasAperennialsAmaximizesAlubavitchAravindraAscrapersAfinialsAkintyreAviolasAsnoqualmieAwildersAopenbsdAmlawaAperitonealAdevarajanAcongkeAlesznoAmercurialAfakirAbognorAoverloadingAunbuiltAgurungAscuttleAtemperamentsAbautzenAjardimAtradesmanAvisitationsAbarbetAsagamoreAgraaffAforecastersAwilsonsAassisAl'airAshariahBochaczewArussaAdirgeAbiliaryAneuveAheartbreakersAstrathearnAjacobianAovergrazingAedrichAanticlineAparathyroidBetulaAlepantoAdeciusAchannelledAparvathiBuppeteersAcommunicatorsAfrancorchampsAkahaneAlongusApanjangAintronAtraiteAxxviiAmatsuriAamritAkatynAdisheartenedAcacakAomoniaAalexandrineApartakingAwranglingAadjuvantAhaskovoAtendrilsAgreensandAlammermoorAotherworldAvolusiaAstablingAone-and-a-halfAbressonAzapatistaAeotvosAps150AwebisodesAstepchildrenAmicroarrayAbragancaAquantaAdolneAsuperoxideAbellonaAdelineateArathaAlindenwoodAbruhlAcingulateAtalliesAbickertonAhelgiAbevinAtakomaBsukubaAstatusesAchangelingAalisterAbytomAdibrugarhAmagnesiaAduplicatingAoutlierAabatedAgoncaloAstrelitzBhikaiAmardanBusculatureAascomycotaAspringhillAtumuliAgabaaAodenwaldAreformattedAautocracyAtheresienstadtAsuplexAchattopadhyayAmenckenAcongratulatoryAweatherfieldAsystemaBolemnityAprojektAquanzhouAkreuzbergApostbellumAnobuoAmediaworksAfinisterreAmatchplayAbangladeshisAkothenAoocyteAhoveredAaromasBfsharAbrowedAteasesAchorltonAarshadAcesaroAbackbencherAiquiqueApadminiAunabridgedAcyclaseAdespoticAkirilenkoAachaeanAqueensberryAdebreAoctahedronAiphigeniaAcurbingAkarimnagarAsagarmathaBmeltersBurrealistsBanadaBhresthaAturridaeAleaseholdAjiedushiAeurythmicsAappropriatingAcorrezeAthimphuAameryAmusicomhAcyborgsAsandwellApushcartAretortsAameliorateAdeterioratesAstojanovicBplineAentrenchmentsAbourseAchancellorshipApasoliniAlendlApersonageAreformulatedApubescensAloiretAmetalurhAreinventionAnonhumanAeilemaAtarsalAcomplutenseAmagneAbroadviewAmetrodomeAouttakeAstouffvilleBeinenAbataillonAphosphoricAostensibleBpatowAaristidesAbeefheartAglorifyingAbantenAromseyAseamountsAfushimiAprophylaxisAranjithAgoslarAbalustradesAgeorgievAcairdAlafitteApeanoAcansoAbankuraAhalfpennyAsegregateAcaissonAbizerteAjamshedpurAeuromaidanAphilosophieAridgedAcheerfullyAreclassificationAaemiliusAvisionariesAsamoansAwokinghamAchemungAwolofAunbranchedAcinereaAbhosleAourenseAimmortalisedAcornerstonesAsourcebookAkhufuAarchimedeanAuniversitateaAintermolecularAfiscallyAsufficesAmetacometAadjudicatorAstablemateBpecksAglaceAinowroclawApatristicAmuharramAagitatingBshotAneurologicAdidcotAgamlaAilvesAputoutsAsirajAlaskiAcoalingAdiarmuidAratnagiriBotulorumAliquefactionAmorbihanAharelAaftershockAgruiformesfamilyAbonnierAfalconiformesfamilyAadornsAwikisAmaastrichtianAstauffenbergAbishopsgateAfakhrAsevenfoldApondersAquantifyingAcastielAopacityAdepredationsAlentenAgravitatedAo'mahonyAmodulatesAinuktitutApastonAkayfabeAvagusAlegalisedAbalkedAarianismAtenderingAsivasAbirthdateAawlakiAkhvajehAshahabBamtgemeindeAbridgetonAamalgamationsAbiogenesisArechargingAtsukasaAchamferedAenthronementAfreelancersAmaharanaAsutilAmessinesBonktonAokanoganAreinvigoratedAapoplexyAtanahashiAneuesAvaliantsAharappanArussesAcardingAvolkoffAfunchalAstatehouseAimitativeBntrepidityAmellotronAsamarasAturkanaAbestingAlongitudesAexarchAdiarrhoeaAtranscendingAzvonarevaAdarnaAramblinAdisconnectionA137thArefocusedAdiarmaitAagricoleAba'athistAturenneAcontrabassCmmunisAdaviessAfatimidsBrosinoneBittinglyApolyphyleticAqanatAtheocraticApreclinicalAabachaAtoorakAmarketplacesAconidiaAseiyaAcontraindicatedAretfordAbundesautobahnArebuildsAclimatologyAseaworthyBtarfighterAqamarAcategoriaAmalaiAhellinsiaAnewsteadAairworthyAcateninAavonmouthBrrhythmiasByyavazhiAdowngradeAashburnhamAejectorAkinematicsApetworthArspcaAfilmationAaccipitridaeAchhatrapatiAg/molAbacauAagamaAyudhoyonoAorchestratorAarbitratorsA138thApowerplantsAcumbernauldAalderleyAmisamisAhawai`iAcuandoAmeistriliigaAjermynAalansApedigreesAottavioAapprobationAomniumApuruliaBrioressArheinlandAlymphoidButskAoscilloscopeAballinaAiliacAmotorbikesCdernisingAuffiziAphylloxeraAkalevalaAbengalisAamravatiAsynthesesAinterviewersCflectionalAoutflankAmaryhillAunhurtAprofilerAnacellesAheseltineApersonalisedAguardaAherpetologistAairparkApigotAdinosApeleliuAbreakbeatAkastamonuAshaivismAdelamereAkingsvilleAepigramAkhlongAphospholipidsAjourneyingAlietuvosAcongregatedAdevianceAcelebesAsubsoilBtromaAkvitovaAlubricatingBayoffAalagoasAolafurAdoronAinteruniversityAraycomAagonopterixAuziceAnannaAspringvaleAraimundoAwrestedApupalAtalatAskinheadsAvestigeAunpaintedAhandanAodawaraAammarBttendeeAlappedAmyotisAciconiiformesfamilyAtraversalAsubfieldAvitaphoneAprensaAhasidismAinwoodAcarstairsAkropotkinAturgenevAdobraAremittanceApurimAtanninAadigeAtabulationAlethalityApachaAmicronesianAdhruvaBefensemenAtibetoAsiculusAradioisotopeAsodertaljeAphitsanulokAeuphoniumAoxytocinBverhangsAskinksAfabricaAreinterredAemulatesAbioscienceAparaglidingAraekwonAperigeeBlausibilityAfrolundaAerrollAaznarAvyasaAalbinusAtrevallyAconfederacionAterseAsixtiethA1530sAkendriyaAskateboardersAfrontieresAmuawiyahAeasementsAshehuAconservativelyAkeystonesBasemAbrutalistApeekskillAcowryAorcasAsyllabaryApaltzAdenticlesAhamperingAdolniAeidosAaarauAlermontovAyanktonAshahbazAbarragesAkongsvingerAreestablishmentAacetyltransferaseAzuliaAmrnasAslingsbyAeucalyptBfficaciousAweybridgeAgradationAcinemathequeAmalthusAbamptonAcoexistedBisseAhamdiAcupertinoAsaumarezAchionodesAlibertineAformersAsakharovApseudonymousAvol.1AgopalakrishnanAamberleyAjorhatAgrandmastersArudimentsAdwindleAparamAbukidnonAmenanderAamericanusAmultipliersApulawyAhomoeroticApillboxAcd+dvdAepigraphAaleksandrowAextrapolatedAhorseshoesAcontemporainAangiographyAhasseltAshawiniganAmemorizationAlegitimizedAcycladesAoutsoldArodolpheAkelisApowerballAdijkstraAanalyzersAincompressibleAsambarAorangeburgBstenAreauthorizationAadamawaAsphagnumAhypermarketAmillipedesAzoroasterAmadeaAossuaryAmurrayfieldApronominalAgauthamAresellersAethersAquarrelledAdolnaAstragglersAasamiAtangutApassosAeducacionAsharafAtexelAberioCthpageCzalelAmarfaAnoronhaA36ersAgenteelAavramAshiltonAcompensatesAsweetenerAreinstalledAdisablesAnoetherA1590sAbalakrishnanAkotaroAnorthallertonAcataclysmAgholamAcancellaraAschipholAcommendsAlonginusAalbinismAgemayelAhamamatsuAvolosAislamismAsiderealApecuniaryAdiggingsAtownsquareAneoshoAlushanAchittoorAakhilAdisputationBesiccationAcambodiansAthwartingAdeliberatedAellipsisAbahiniAsusumuBeparatorsAkohnehAplebeiansAkulturAogadenApissarroAtrypetaAlaturBiaodongAvettingAdatongAsohailAalchemistsAlengthwiseAunevenlyAmasterlyBicrocontrollersAoccupierAdeviatingAfarringdonAbaccalaureatAtheocracyAchebyshevAarchivistsAjayaramAineffectivenessAscandinaviansAjacobinsAencomiendaAnambuAg/cm3AcatesbyApaavoAheededArhodiumAidealisedA10degAinfectiveAmecyclothoraxAhalevyAshearedAminbariAaudaxAlusatianArebuffsAhitfixAfastenerAsubjugateAtarunAbinetAcompuserveAsynthesiserAkeisukeAamalricAligaturesAtadashiAignazioAabramovichAgroundnutAotomoAmaeveBortlakeAostrogothsAantilleanAtodorArectoAmillimetreAespousingAinaugurateAparacetamolAgalvanicAharpalinaeAjedrzejowAreassessmentAlanglandsAcivitaAmikanAstikineAbijarAimamateBstanaAkaiserlicheAerastusAfederaleAcytosineAexpansionismAhommesAnorrlandAsmritiBnapdragonAgulabAtalebAlossyAkhattabAurbanisedAsestoArekordAdiffuserBesamAmorganaticAsiltingApactsAextenderAbeauharnaisApurleyAbouchesAhalfpipeAdiscontinuitiesAhouthiAfarmvilleAanimismAhorniAsaadiAinterpretativeAblockadesAsymeonAbiogeographicAtranscaucasianAjettiesAlandrieuAastrocytesAconjuntoAstumpingsAweevilsAgeysersAreduxAarchingAromanusAtazehAmarcellinusAcaseinAopavaAmisrataAanareAsattarAdeclarerBreuxAoportoAventaBallisAicosahedronAcortonaAlachineAmohammedanAsandnesAzyngaAclarinAdiomedesAtsuyoshiApribramAgulbargaAchartistAsuperettanAboscawenAaltusAsubangAgatingAepistolaryAvizianagaramAogdensburgApannaAthyssenBarkovskyAdzogchenAbiographAserembanAunscientificAnightjarAlegcoAdeismAn.w.aAsudhaBiskelBassouAflintlockAjovialAmontbeliardApallidaAformula_66AtranquillityAniseiAadornmentA'peopleAyamhillAhockeyallsvenskanAadoptersBppianAlowiczAhaplotypesAsuccinctlyBtarogardApresidenciesAkheyrabadAsobiborAkinesiologyAcowichanAmilitumAcromwellianAleiningenAps1.5AconcoursesAdalarnaAgoldfieldAbrzegAfaecesAaquariiAmatchlessAharvestersA181stAnumismaticsAkorfballAsectionedAtranspiresAfacultativeAbrandishingAkieronAforagesAmenaiAglutinousAdebargeAheathfieldA1580sAmalangAphotoelectricAfroomeAsemioticAalwarAgrammophonAchiaroscuroAmentalistBaramuresAflaccoAliquorsAaleutiansAmarvellAsutlejApatnaikAqassamAflintoffAbayfieldAhaeckelAsuenoAaviciiAexoplanetsAannibaleAvojislavAhoneycombsAcelebrantArendsburgAveblenAquailsA141stAcarronadesAsavarAnarrationsAjeevaAontologiesAhedonisticAmarinetteAgodotAbessarabianAoutriggerAthameAgravelsAhoshinoAfalsifyingAstereochemistryAnacionalistaAmediallyAradulaAejectingAconservatorioAodileAceibaAjainaAessonneAisometryAallophonesArecidivismAivecoAgandaBrammariansAjaganAsignpostedAuncompressedAfacilitatorsAditkoApropulsiveAimpalingBnterbankAbotolphAamlaibAintergroupAsorbusAchekaAdebyeApracaAadorningApresbyteriesAdormitionAstrategosAqaraseApentecostalsAbeehivesAhashemiteAgoldustAeuronextBgressAarpanetAjurchensAslovenskaAcopseAkazimAappraisalsAmarischalBineolaAsharadaAcaricaturistAsturlusonAgalbaAfaizabadAoverwinteringAuyezdsAdidsburyAlibrevilleAablettAmicrostructureAanadoluAbelenensesAelocutionAcloaksAtimeslotsAhaldenArashidunAdisplacesAsympatricAgermanusAtuplesAceskaAequalizeAdisassemblyAkrautrockAbabangidaAmemelAdeildAgopalaAhematologyAunderclassAsangliAwawrinkaAassurAtoshackArefrainsAnicotinicAbhagalpurBadamiAracetracksApocatelloAwalgreensAnazarbayevAoccultationAspinnakerAgeneonAjosiasAhydrolyzedAdzongAcorregimientoAwaistcoatAthermoplasticAsolderedAanticancerAlactobacillusAshafi'iAcarabusAadjournmentAschlumbergerAtriceratopsAdespotateAmendicantAkrishnamurtiAbahasaAearthwormAlavoisierAnoetherianAkalkiAferventlyAbhawanAsaanichAcoquilleAgannetAmotaguaAkennelsAmineralizationAfitzherbertAsveinAbifurcatedAhairdressingAfelisAaboundedAdimersAfervourAhebdoAblufftonAaetnaAcorydonBlevedonBarneiroAsubjectivelyAdeutzAgastropodaAovershotAconcatenationAvarmanAcarollaAmaharshiBujibAinelasticAriverheadAinitializedAsafavidsArohiniAcaguasAbulgesAfotbollforbundAhefeiAspitheadAwestvilleAmaronitesAlythamAamericoAgediminasAstephanusAchalcolithicAhijraAgnu/linuxApredilectionArulershipAsterilityAhaidarAscarlattiBaprissaBviatoslavApointedlyAsunroofAguarantorAthevarAairstripsApultuskAstureA129thAdivinitiesBaizongBolichoderusAcobourgAmaoistsAswordsmanshipAupratedAbohmeAtashiAlargsAbluebeardAhouseholdersArichardsonianAdrepanidaeAantigonishAelbasanAoccultismAmarcaAhypergeometricAoiratAstiglitzAignitesAdzungarAmiquelonApritamAd'automneAulidiidAniameyAvallecanoAfondoAbillitonAincumbenciesAracemeAchamberyBadellAbarenakedAkagameAsummersideAhaussmannCtshepsutAapothecariesAcriolloAfeintAnasalsAtimuridAfelthamAplotinusAoxygenationAmarginataAofficinalisAsalatAparticipationsAisingAdowneAizumoAunguidedApretenceAcoursedAharunaAviscountcyAmainstageAjusticiaApowiatAtakaraAcapitolineAimplacableAfarbenAstopfordAcosmopterixAtuberousAkroneckerAgalatiansAkweliAdogmasAexhortedAtrebinjeAskandaAnewlynAablativeAbasidiaBhiwaniAencroachmentsAstranglersAregroupingAtubalAshoestringAwawelAanionicAmesenchymalAcreationistsApyrophosphateAmoshiAdespotismApowerbookAfatehpurArupiahAsegreAternateAjessoreAb.i.gAshevardnadzeAaboundsAgliwiceAdensestAmemoriaAsuborbitalAratepayersAkarunanidhiAtoolbarAdescentsArhymneyAexhortationAzahedanAcarcinomasAhyperbaricAbotvinnikBilletsAneuropsychologicalAtigranesAhoardsAchaterAbienniallyAthistlesAscotusAwataruAflotillasAhungamaAmonopolisticApayoutsAvetchAgeneralissimoAcariesAnaumburgApiranAblizzardsAescalatesAreactantAshinyaAtheorizeBransitwayAecclesiaeAstreptomycesAcantalAnisibisAsuperconductorAunworkableAthallusAroehamptonAscheckterAviceroysAmakuuchiAilkleyAsupersedingAtakuyaAklodzkoAborbonAraspberriesAoperandAw.a.k.oAsarabandeAfactionalismAegalitarianismAtemasekBorbatAunscriptedAjormaAwesternerAperfectiveAvrijeAunderlainAgoldfrappAblaenauAjomonAbarthesAdrivetimeAbassaCnnockAumagaAfengxiangAzulusAsreenivasanAfarcesAcodice_10AfreeholderApoddebiceAimperialistsAderegulatedAwingtipAo'haganApillaredAovertoneAhofstadterA149thAkitanoAsaybrookBtandardizingAaldgateAstaveleyAo'flahertyAhundredthsAsteerableBoltanAemptedAcruyffAintramurosAtaluksAcotonouAmaraeAkarurAfigueresAbarwonAlucullusAniobeAzemlyaAlathesAhomeportedAchauxAamyotrophicAopinesAexemplarsAbhamoAhomomorphismsAgauleiterAladinAmafiosiAairdrieoniansAb/soulAdecalAtranscaucasiaAsoltiAdefecationCaconessAnumidiaAsampradayaAnormalisedAwinglessAschwabenAalnusAcineramaAyakutskAketchikanAorvietoAunearnedAmonferratoArotemAaacsbAloongAdecodersAskerriesAcardiothoracicArepositioningApimpernelAyohannanAtenebrionoideaAnargisBouvelAcostliestAinterdenominationalAnoizeAredirectingAzitherAmorchaAradiometricAfrequentingAirtyshAgbagboAchakriAlitvinenkoAinfotainmentAravensbruckAharithAcorbelsAmaegashiraAjoustingAnatanBovusAfalcaoAminisArailedAdecileAraumaCmaswamyAcavitationAparanaqueAberchtesgadenAreanimatedAschombergApolysaccharidesAexclusionaryAcleonAanuragAravagingAdhanushAmitchellsAgranuleAcontemptuousAkeiseiArollestonAatlanteanAyorkistAdaraaAwappingAmicrometerAkeenelandAcomparablyAbaranjaAoranjeAschlafliAyogicAdinajpurAunimpressiveAmasashiArecreativoAalemannicApetersfieldAnaokoAvasudevaAautosportArajatAmarellaAbuskoAwethersfieldAssrisBoulcaliburAkobaniAwildlandArookeryAhoffenheimAkauriAaliphaticAbalaclavaAferriteApubliciseAvictoriasAtheismAquimperAchapbookAfunctionalistAroadbedAulyanovskAcupenApurpureaAcalthorpeAteofiloAmousaviAcochleaAlinotypeAdetmoldAellerslieAgakkaiAtelkomAsouthseaBubcontractorAinguinalAphilatelistsAzeebruggeApiaveAtrochidaeAdempoAsaharanpurAmihrabAparasympatheticAbarbarousAcharteringAantiquaAkatsinaAbugisAcategorizesAaltstadtAkandyanApambansaAoverpassesAmitersAassimilatingAfinlandiaAuneconomicAam/fmAharpsichordistAdresdnerAluminescenceAauthenticallyAoverpowersAmagmaticAcliftonvilleAoilfieldsAskirtedAcumanAoakhamAfrelimoAglockenspielAconfectionAsaxophonistsApiasecznoAmultilevelAantipaterAlevyingAmaltreatmentAvelhoAopocznoAharburgApedophiliaAunfundedApalettesBlasterworkAbreveAdharmendraAauchinleckAnonesuchAblackmunAlibrettiArabbaniA145thAhasselbeckAkinnockAmalateAvandenAcloverdaleAashgabatAnaresAradiansAsteelworkersBaborApossumsAcatterickAhemisphericAostraButpacedAdungenessAalmshouseApenrynAtexiansA1000mAfranchittiAincumbencyAtexcocoAnewarAtramcarsBoroidalAmeitetsuAspellboundAagronomistAviniferaAriataAbunkoApinasAba'alAgithubAvasilyevichAobsolescentAgeodesicsAancestriesAtujueAcapitalisedAunassignedAthrongAunpairedApsychometricAskegnessAexothermicAbufferedAkristiansundAtonguedAberengerBashoAalitaliaAprolongationAarchaeologicallyAfractionationAcyprinidAechinodermsAagriculturallyAjusticiarAsonamAiliumAbaitsAdanceableAgrazerAardahanAgrassedApreemptionAglassworksAhasinaAugricBmbraAwahhabiAvannesAtinnitusAcapitaineAtikritAlisieuxAscreeAhormuzAdespenserAjagiellonAmaisonneuveAgandakiAsantaremAbasilicasAlancingDdskronaAweilburgAfiresideAelysianAisleworthAkrishnamurthyAfiltonAcynonAtecmoAsubcostalBcalarsAtriglyceridesAhyperplaneAfarmingdaleAunioneAmeydanApilingsAmercosurAreactivateAakibaAfecundityAjatraAnatsumeAzarqawiApretaAmasaoApresbyterAoakenfoldArhodriAferranAruizongAcloyneAnelvanaAepiphaniusAbordeAscutesBtricturesAtroughtonAwhitestoneAsholomAtoyahAshingonAkutuzovAabelardApassantAlipnoAcafeteriasAresidualsAanabaptistsAparatransitAcriollosAplevenAradiataAdestabilizingAhadithsAbazaarsAmannoseAtaiyoAcrookesAwelbeckAbaodingAarchelausAnguessoAalberniAwingtipsAhertsAviasatAlankansAevreuxAwigramAfassbinderAryuichiAstortingAreducibleAolesnicaAznojmoAhyannisAtheophanesAflatironAmusteringArajahmundryAkadirAwayangApromeAlethargyAzubinAillegalityAconallAdramedyAbeerbohmAhipparchusAziaratAryujiAshugoAglenorchyAmicroarchitectureBorneAlewinskyAcauveryAbattenbergAhyksosAwayanadAhamilcarAbuhariBrazoDtianuAsolmsAaksarayAelamiteAchilcotinAbloodstockAsagaraAdolnyAreunifiedAumlautAproteaceaeAcamborneClabrianAdhanbadAvaxjoAcookwareApotezArediffusionAsemitonesAlamentationsAallgauAguernicaAsuntoryApleatedAstationingAurgellAgannetsAbertelsmannAentrywayAraphitomidaeAacetaldehydeAnephrologyAcategorizingAbeiyangApermeateAtourneyAgeosciencesAkhanaAmasayukiAcrucisAuniversitariaAslaskieAkhaimahAfinnoAadvaniBstonishinglyAtubulinAvampiricAjeollaAsocialeAcleethorpesAbadriAmuridaeAsuzongAdebaterCcimationAkenyansAmutualismApontifexAmiddlemenAinseeAhaleviAlamentationApsychopathyAbrasseyAwendersAkavyaAparabellumBrolactinAinescapableAapsesAmalignanciesArinzaiAstigmatizedAmenahemAcomoxAateliersAwelshpoolAsetifAcentimetreAtruthfulnessAdownfieldBrususAwodenAglycosylationAemanatedAagulhasAdalkeithAjaziraAunifilAjobimAoperonBryzomysAheroicallyAseancesBupernumeraryAbackhouseAhashanahAtatlerAimagoBnvertAhayatoAclockmakerAkingsmillAswiecieAanalogouslyAgolcondaAposteAtacitlyAdecentralisedAge'ezAdiplomaticallyAfossiliferousAlinseedAmahaviraApedestalsAarchpriestAbyelectionAdomiciledAjeffersonianAbombusAwinegrowingBaukeganAuncultivatedAhaverfordwestAsaumurAcommunallyAdisbursedAcleeveAzeljeznicarAspeciosaAvacationersAsigurAvaishaliAzlatkoAiftikharAcroplandAtranskeiAincompletenessAbohraAsubantarcticBlieveAphysiologicAsimilisAklerkAreplantedA'rightAchafeeAreproducibleAbayburtAregicideAmuzaffarpurApluralsAhanyuAorthologsAdioufAassailedAkamuiAtarikAdodecaneseAgorneAon/offA179thAshimogaAgranariesAcarlistsAvalarAtripolitaniaAsherdsBimmernAdissociatedAisambardApolytechnicalAyuvrajAbrabazonAantisenseApubmedAglansAminutelyBasaakiAraghavendraAsavouryApodcastingAtachiAbienvilleAgongsunAridgelyAdeformAyuichiAbindersAcannaCrcettiAllobregatAimploredAnjegosAintermingledAoffloadAathenryAmotherhouseAcorporaAkakinadaAdannebrogAimperioAprefacesAmusicologistsAaerospatialeAshiraiAnagapattinamAserviusAcristoforoApomfretAreviledAentebbeAstaneAeast/westAthermometersAmatriarchalAsigloAbodilAlegionnaireAze'evAtheorizingAsangeethaAhorticulturistAuncountableAlookalikeAanoxicAionosphericAgenealogistsAchicopeeAimprintingApopishAcrematoriaAdiamondbackAcyatheaAhanzhongAcameramenAhalogalandAnakloAwaclawAstorehousesAflexedAcomuniAfritsAglaucaAnilgirisAcompressesAnainitalAcontinuationsAalbayAhypoxicAsamajwadiAdunkerqueAnanticokeAsarwarAinterchangedAjubalAcorbaAjalgaonAderlethCathstrokeAmagnyAvinnytsiaAhyphenatedArimfireAsawanAboehnerAdisreputeAnormalizeAaromanianAdualisticAapproximantAchamaAkarimabadAbarnaclesAsanokBtipendsAdyfedArijksmuseumBeverberationAsuncorpAfungicidesAreverieAspectrographBtereophonicAniaziAordosAalcanAkaraiteAlautrecAtablelandAlamellarArietiAlangmuirArussulaAwebernAtweaksAhawickAsouthernerAmorphyAnaturalisationAenantiomerAmichinokuAbarbettesArelievesAcarburettorsAredruthAoblatesAvocabulariesAmogilevAbagmatiAgaliumAreassertedAextolledAsymonAeuroscepticAinflectionsAtirthaArecompenseAoruroAropingAgouverneurAparedAyayoiAwatermillsAretooledAleukocytesAjubilantAmazharAnicolauAmanheimAtouraineAbedserAhambledonAkohatApowerhousesAtlemcenAreuvenAsympatheticallyAafrikanersAinteresAhandcraftsAetcherAbaddeleyAwodongaAamauryA155thAvulgarityApompadourAautomorphismsA1540sAoppositionsAprekmurjeAderyniAfortifyingAarcuateAmahilaAbocageAnozzeAslashesAatlanticaAhadidArhizomatousAazerisAosmenaAlewisvilleAinnervatedAbandmasterAoutcroppingAparallelogramAdominicanaAtwangAingushetiaAextensionalAladinoAsastryAzinovievArelatableAnobilisAcbeebiesAhitlessAeulimaAsporangiaByngeAlonglistedAcriminalizedApenitentialAweydenAtubuleAvolynApriestessesAglenbrookAkibbutzimAwindshaftAcanadairAfalangeAzsoltAbonheurAmeineAarchangelsAsafeguardedAjamaicansAmalarialAteasersAbadgingAmerseyrailAoperandsApulsarsAgauchosAbiotinBambaraAnecaxaAegmondAtillageAcoppiAanxiolyticApreahAmausoleumsAplautusAferozAdebunkedA187thAbelediyesporAmujiburAwantageAcarboxylBhettiarAmurnauAvaguenessAracemicAbackstretchAcourtlandAmunicipioApalpatineAdezfulAhyperbolaAsreekumarAchalonsAaltayBrapahoeAtudorsAsapiehaAquilonAburdensomeAxxviiiArecensionAgenerisAsiphuncleArepressorAbitrateAmandalsBidhurstAdioxinBemocratiqueAupholdsArodezAcinematographicAepoqueAjinpingArabelaisAzhytomyrAglenviewArebootedAkhalidiAreticulataA122ndAmonnaieApassersbyAghazalsAeuropaeaAlippmannAearthboundAtadicAandorranBrtvinBngelicumAbanksyAepicentreAresemblancesAshuttledArathausAberntAstonemasonsAbalochiAsiangAtynemouthAcygniAbiosyntheticAprecipitatesAsharecroppersAd'annunzioAsoftbankBhijiAapeldoornApolycyclicAwenceslasBuchangAsamnitesAtamarackAsilmarillionAmadinahApalaeontologyAkirchbergAsculpinArohtakAaquabatsAoviparousAthynneAcaneyAblimpsAminimalisticAwhatcomApalatalizationAbardstownAdirect3dAparamagneticAkambojaBhashAglobemasterAlenguaAmatejAchernigovAswanageAarsenalsAcascadiaBundinamarcaAtusculumAleaversAorganicsAwarplanesA'threeAexertionsAarminiusAgandharvaAinquiresAcomercioAkuopioAchabaharAplotlinesAmersenneAanquetilAparalyticAbuckminsterAambitBcrolophusAquantifiersAclactonBiliaryAansaldoAferganaAegoismAthraciansAchicoutimiAnorthbrookAanalgesiaAbrotherhoodsAhunzaAadriaenAfluoridationAsnowfallsBoundboardAfangoriaAcannibalisticAorthogoniusAchukotkaAdindigulAmanzoniAchainzAmacromediaAbeltlineAmurugaAschisturaAprovableAlitexAinitioApneumoniaeAinfosysAceriumAboontonAcannonballsAd'uneAsolvencyAmandurahAhouthisAdolmensAapologistsAradioisotopesAblaxploitationAporoshenkoAstawellAcoosaAmaximilienAtempelhofAespouseAdeclaratoryAhambroAxalapaAoutmodedAmihielAbenefittingAdesirousAarcheparchyArepopulatedAtelescopingAcaptorAmackayeAdisparagedAramanathanAcrowneAtumbledBechnetiumAsiltedAchediAnievreAcartoonishAinterlockCfocomArediff.comAdioramasAtimekeepingAconcertinaAkutaisiAceskyAlubomirskiAunapologeticAepigraphicAstalactitesBnehaAbiofilmAfalconryAmirafloresAcatenaA'outstandingAprospektAapotheosisAo'odhamApacemakersAarabicaAgandhinagarAreminiscesAiroquoianAornetteAtillingAneoliberalismAchameleonsApandavaBrefontaineAhaiyanAgneisenauAutamaAbandoAreconstitutionAazariaAcanolaAparatroopsAayckbournAmanisteeAstourtonAmanifestosAlympneAdenouementAtractatusArakimAbellflowerAnanometerAsassanidsAturloughApresbyterianismAvarmlandA20degAphoolAnyerereAalmohadAmanipalAvlaanderenAquicknessAremovalsAmakowAcircumflexAeateryAmoraneAfondazioneAalkylationAunenforceableAgallianoAsilkwormAjunior/seniorAabductsAphloxAkonskieAlofotenAbuurenAglyphosateAfairedAnaturaeAcobblesAtaherAskrullsAdostoevskyAwalkoutCgnerianAorbitedAmethodicallyAdenzilAsaratAextraterritorialAkohimaAd'armorAbrinsleyArostropovichAfengtianAcomitatusAaravindAmocheAwrangellAgiscardAvantaaBiljandiAhakoahAseabeesAmuscatineAballadeAcamanachdAsothernAmullionedAduradAmargravesCvenAareteAchandniAgarifunaA142ndAreading/literatureAthickestBrygveAkhaldunAperinatalAasanaApowerlineAacetylationAnureyevAomiyaAmontesquieuAriverwalkAmarlyAcorrelatingAintermountainAbulgarAhammerheadsAunderscoresAwiretappingAquatrainAruisseauAnewsagentAtuticorinApolygynyAhemsworthApartisanshipAbannaAistrianAevaporatorAcabrini"); + +// node_modules/@zxcvbn-ts/language-en/dist/wordSequences.json.mjs +var wordSequences = { "cardinalNumbers-en": ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty"], "ordinalNumbers-en": ["first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth", "eleventh", "twelfth", "thirteenth", "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", "nineteenth", "twentieth"], "daysOfWeek-en": ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"], "months-en": ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"], "seasons-en": ["spring", "summer", "autumn", "winter"], "timePeriods-en": ["morning", "afternoon", "evening", "night", "midnight", "noon"], "rainbowColors-en": ["red", "orange", "yellow", "green", "blue", "indigo", "violet"], "directions-en": ["north", "south", "east", "west"], "intermediateDirections-en": ["northeast", "northwest", "southeast", "southwest"], "sizeProgression-en": ["tiny", "small", "medium", "large", "huge", "giant"], "militaryAlphabet-en": ["alpha", "bravo", "charlie", "delta", "echo", "foxtrot", "golf", "hotel", "india", "juliet", "kilo", "lima", "mike", "november", "oscar", "papa", "quebec", "romeo", "sierra", "tango", "uniform", "victor", "whiskey", "xray", "yankee", "zulu"], "planets-en": ["mercury", "venus", "earth", "mars", "jupiter", "saturn", "uranus", "neptune", "pluto"], "zodiacSigns-en": ["aries", "taurus", "gemini", "cancer", "leo", "virgo", "libra", "scorpio", "sagittarius", "capricorn", "aquarius", "pisces"], "chineseZodiac-en": ["rat", "ox", "tiger", "rabbit", "dragon", "snake", "horse", "goat", "monkey", "rooster", "dog", "pig"] }; + +// node_modules/@zxcvbn-ts/language-en/dist/index.mjs +var dictionary2 = { + "commonWords-en": commonWords, + "firstnames-en": firstnames, + "lastnames-en": lastnames, + "wikipedia-en": wikipedia, + ...wordSequences +}; + +// src/vault/password.ts +var MIN_PASSWORD_LENGTH = 12; +var MIN_PASSWORD_SCORE = 3; +var evaluator = null; +function getEvaluator() { + if (evaluator === null) { + evaluator = new ZxcvbnFactory({ + dictionary: { + ...dictionary, + ...dictionary2 + }, + graphs: adjacencyGraphs + }); + } + return evaluator; +} +function validatePassword(password, options) { + const codePointLength = [...password].length; + if (codePointLength < MIN_PASSWORD_LENGTH) { + return { ok: false, reason: "too_short" }; + } + if (password.trim().length === 0) { + return { ok: false, reason: "too_weak" }; + } + const userInputs = options?.userInputs ? [...options.userInputs] : []; + const result = getEvaluator().check(password, userInputs); + if (result.score < MIN_PASSWORD_SCORE) { + return { ok: false, reason: "too_weak" }; + } + return { ok: true }; +} +// src/vault/recovery-code.ts +var RECOVERY_CODE_BYTES = 32; +var CROCKFORD_ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"; +var DATA_CHAR_COUNT = 52; +var TOTAL_CHAR_COUNT = DATA_CHAR_COUNT + 1; +var GROUP_SIZE = 4; +var CROCKFORD_LOOKUP = new Int8Array(128).fill(-1); +for (let i = 0;i < CROCKFORD_ALPHABET.length; i++) { + CROCKFORD_LOOKUP[CROCKFORD_ALPHABET.charCodeAt(i)] = i; +} +CROCKFORD_LOOKUP[73] = 1; +CROCKFORD_LOOKUP[76] = 1; +CROCKFORD_LOOKUP[79] = 0; +var utf8Encoder = new TextEncoder; +var DOMAIN_RECOVERY_KEY = utf8Encoder.encode("tegra-vault-v1:recovery-key\x00"); +function computeCheckSymbol(symbols) { + let acc = 0; + for (let i = 0;i < symbols.length; i++) { + const sym = symbols[i] ?? 0; + const shifted = acc << 1; + acc = (shifted >= 32 ? shifted ^ 37 : shifted) ^ sym; + } + return acc & 31; +} +function generateRecoveryCodeBytes() { + return randomBytes(RECOVERY_CODE_BYTES); +} +function formatRecoveryCode(bytes) { + if (bytes.length !== RECOVERY_CODE_BYTES) { + throw new RangeError(`Recovery code must be ${RECOVERY_CODE_BYTES} bytes`); + } + const symbols = []; + let bitBuffer = 0; + let bitsLeft = 0; + for (let i = 0;i < bytes.length; i++) { + bitBuffer = bitBuffer << 8 | (bytes[i] ?? 0); + bitsLeft += 8; + while (bitsLeft >= 5) { + bitsLeft -= 5; + symbols.push(bitBuffer >>> bitsLeft & 31); + } + } + if (bitsLeft > 0) { + symbols.push(bitBuffer << 5 - bitsLeft & 31); + } + const check = computeCheckSymbol(symbols); + const groups = []; + for (let i = 0;i < symbols.length; i += GROUP_SIZE) { + let group = ""; + for (let j = i;j < i + GROUP_SIZE && j < symbols.length; j++) { + group += CROCKFORD_ALPHABET[symbols[j] ?? 0] ?? ""; + } + groups.push(group); + } + const checkChar = CROCKFORD_ALPHABET[check] ?? ""; + return `${groups.join("-")}-${checkChar}`; +} +function parseRecoveryCode(code) { + const cleaned = code.replace(/[\s-]+/g, "").toUpperCase(); + if (cleaned.length !== TOTAL_CHAR_COUNT) { + throw new VaultError("invalid_recovery_code", "Invalid recovery code format"); + } + const symbols = new Array(DATA_CHAR_COUNT); + for (let i = 0;i < DATA_CHAR_COUNT; i++) { + const charCode = cleaned.charCodeAt(i); + if (charCode >= 128) { + throw new VaultError("invalid_recovery_code", "Invalid recovery code character"); + } + const val = CROCKFORD_LOOKUP[charCode] ?? -1; + if (val < 0) { + throw new VaultError("invalid_recovery_code", "Invalid recovery code character"); + } + symbols[i] = val; + } + const checkCharCode = cleaned.charCodeAt(DATA_CHAR_COUNT); + if (checkCharCode >= 128) { + throw new VaultError("invalid_recovery_code", "Invalid recovery code check character"); + } + const providedCheck = CROCKFORD_LOOKUP[checkCharCode] ?? -1; + if (providedCheck < 0) { + throw new VaultError("invalid_recovery_code", "Invalid recovery code check character"); + } + if (computeCheckSymbol(symbols) !== providedCheck) { + throw new VaultError("invalid_recovery_code", "Recovery code verification failed"); + } + const out = new Uint8Array(RECOVERY_CODE_BYTES); + let bitBuffer = 0; + let bitsLeft = 0; + let outIdx = 0; + for (let i = 0;i < DATA_CHAR_COUNT; i++) { + bitBuffer = bitBuffer << 5 | (symbols[i] ?? 0); + bitsLeft += 5; + if (bitsLeft >= 8) { + bitsLeft -= 8; + if (outIdx < RECOVERY_CODE_BYTES) { + out[outIdx++] = bitBuffer >>> bitsLeft & 255; + } + } + } + const trailingMask = (1 << bitsLeft) - 1; + if ((bitBuffer & trailingMask) !== 0) { + throw new VaultError("invalid_recovery_code", "Non-canonical recovery code"); + } + return out; +} +function deriveRecoveryKey(codeBytes) { + if (codeBytes.length !== RECOVERY_CODE_BYTES) { + throw new RangeError(`Recovery code must be ${RECOVERY_CODE_BYTES} bytes`); + } + const input = new Uint8Array(DOMAIN_RECOVERY_KEY.length + codeBytes.length); + input.set(DOMAIN_RECOVERY_KEY, 0); + input.set(codeBytes, DOMAIN_RECOVERY_KEY.length); + try { + return hash(input); + } finally { + memzero(input); + } +} +// src/vault/session.ts +import { z as z2 } from "zod"; +var HOUR_MS = 60 * 60 * 1000; +var DAY_MS = 24 * HOUR_MS; +var SESSION_DURATION_MS = { + "24h": DAY_MS, + "7d": 7 * DAY_MS, + "30d": 30 * DAY_MS, + remember: 180 * DAY_MS +}; +var serializedSessionSchema = z2.object({ + v: z2.literal(1), + public_key: base64UrlSchema, + secret_key: base64UrlSchema, + certificate: sessionCertificateSchema +}); +function bytesEqual(a, b) { + if (a.length !== b.length) + return false; + let diff = 0; + for (let i = 0;i < a.length; i++) { + diff |= (a[i] ?? 0) ^ (b[i] ?? 0); + } + return diff === 0; +} +function issueSession(unlocked, options) { + const accountKeyPair = unlocked.keyPair; + const now = options.now ?? Date.now(); + if (!Number.isSafeInteger(now) || now < 0) { + throw new RangeError("Timestamp must be a non-negative safe integer"); + } + const durationMs = SESSION_DURATION_MS[options.duration]; + const keyPair = generateSigningKeyPair(); + try { + const certificate = signSessionCertificate({ + sessionPublicKey: keyPair.publicKey, + accountKeyPair, + notBefore: now, + notAfter: now + durationMs, + ...options.id !== undefined ? { id: options.id } : {} + }); + return { keyPair, certificate }; + } catch (err) { + memzero(keyPair.secretKey); + throw err; + } +} +function serializeSession(session) { + return JSON.stringify({ + v: 1, + public_key: toBase64Url(session.keyPair.publicKey), + secret_key: toBase64Url(session.keyPair.secretKey), + certificate: session.certificate + }); +} +function parseSession(text) { + let raw; + try { + raw = JSON.parse(text); + } catch { + throw new VaultError("invalid_session", "Malformed session JSON"); + } + const parsed = serializedSessionSchema.safeParse(raw); + if (!parsed.success) { + throw new VaultError("invalid_session", "Malformed serialized session"); + } + const { public_key, secret_key, certificate } = parsed.data; + if (certificate.not_after <= certificate.not_before) { + throw new VaultError("invalid_session", "Session certificate has invalid validity window"); + } + let publicKey; + let secretKey; + let certPublicKey; + try { + publicKey = fromBase64Url(public_key); + secretKey = fromBase64Url(secret_key); + certPublicKey = fromBase64Url(certificate.session_key); + } catch { + throw new VaultError("invalid_session", "Invalid base64url encoding in serialized session"); + } + if (publicKey.length !== SIGNING_PUBLIC_KEY_BYTES || secretKey.length !== SIGNING_SECRET_KEY_BYTES || certPublicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + memzero(secretKey); + throw new VaultError("invalid_session", "Invalid session key length"); + } + const seed = secretKey.slice(0, SIGNING_SEED_BYTES); + let derived; + try { + derived = signingKeyPairFromSeed(seed); + } finally { + memzero(seed); + } + const valid = bytesEqual(derived.publicKey, publicKey) && bytesEqual(derived.secretKey, secretKey) && bytesEqual(publicKey, certPublicKey); + memzero(secretKey); + if (!valid) { + memzero(derived.secretKey); + throw new VaultError("invalid_session", "Session keys do not match certificate"); + } + return { + keyPair: derived, + certificate + }; +} +function sessionExpiresAt(session) { + return session.certificate.not_after; +} +function isSessionExpired(session, now = Date.now()) { + return now >= session.certificate.not_after; +} +function createCommandFromSession(session, params) { + return createSignedCommand({ + type: params.type, + body: params.body, + agentPublicKey: params.agentPublicKey, + signer: session.keyPair, + session: session.certificate, + counter: params.counter, + now: params.now, + ...params.ttlMs !== undefined ? { ttlMs: params.ttlMs } : {}, + ...params.id !== undefined ? { id: params.id } : {} + }, params.registry); +} +function createSensitiveCommand(unlocked, params) { + const accountKeyPair = unlocked.keyPair; + return createSignedCommand({ + type: params.type, + body: params.body, + agentPublicKey: params.agentPublicKey, + signer: accountKeyPair, + counter: params.counter, + now: params.now, + ...params.ttlMs !== undefined ? { ttlMs: params.ttlMs } : {}, + ...params.id !== undefined ? { id: params.id } : {} + }, params.registry); +} +function signRevocation(unlocked, params) { + const accountKeyPair = unlocked.keyPair; + return signRevocationList({ + accountKeyPair, + issuedAt: params.now, + revoked: params.revoked + }); +} +// src/vault/vault.ts +class UnlockedVaultHandle { + #account; + #keyPair; + #locked = false; + constructor(account, keyPair) { + this.#account = account; + this.#keyPair = keyPair; + } + #assertOpen() { + if (this.#locked) { + throw new VaultError("locked", "Vault is locked"); + } + } + get account() { + this.#assertOpen(); + return this.#account; + } + get publicKey() { + this.#assertOpen(); + return this.#keyPair.publicKey; + } + get keyPair() { + this.#assertOpen(); + return this.#keyPair; + } + lock() { + if (this.#locked) + return; + memzero(this.#keyPair.secretKey); + this.#locked = true; + } +} +function bytesEqual2(a, b) { + if (a.length !== b.length) + return false; + let diff = 0; + for (let i = 0;i < a.length; i++) { + diff |= (a[i] ?? 0) ^ (b[i] ?? 0); + } + return diff === 0; +} +function assertValidTimestamp(now) { + if (!Number.isSafeInteger(now) || now < 0) { + throw new RangeError("Timestamp must be a non-negative safe integer"); + } +} +function assertValidPassword(password, userInputs) { + const result = validatePassword(password, userInputs !== undefined ? { userInputs } : undefined); + if (!result.ok) { + throw new VaultError("weak_password", "Password does not meet strength requirements"); + } +} +function wrapWithPassword(secretKey, password, meta, preset) { + const salt = generateSalt(); + const kdfParams = { + alg: preset.alg, + opslimit: preset.opslimit, + memlimit: preset.memlimit, + salt + }; + assertKdfParams(kdfParams); + const kdf = { + alg: kdfParams.alg, + opslimit: kdfParams.opslimit, + memlimit: kdfParams.memlimit, + salt: toBase64Url(salt) + }; + const aad = buildPasswordAad({ + v: meta.v, + account: meta.account, + public_key: meta.public_key, + kdf + }); + const derivedKey = deriveKeyFromPassword(password, kdfParams); + try { + const wrapped = aeadEncrypt(secretKey, derivedKey, aad); + return { + kdf, + wrapped_secret: toBase64Url(wrapped) + }; + } finally { + memzero(derivedKey); + } +} +function wrapWithRecovery(secretKey, meta) { + const codeBytes = generateRecoveryCodeBytes(); + try { + const recoveryCode = formatRecoveryCode(codeBytes); + const recoveryKey = deriveRecoveryKey(codeBytes); + try { + const aad = buildRecoveryAad(meta); + const wrapped = aeadEncrypt(secretKey, recoveryKey, aad); + return { + wrapped_secret: toBase64Url(wrapped), + recoveryCode + }; + } finally { + memzero(recoveryKey); + } + } finally { + memzero(codeBytes); + } +} +function verifyDecryptedSecretKey(rawSecretKey, expectedPublicKey, expectedAccount) { + if (rawSecretKey.length !== SIGNING_SECRET_KEY_BYTES) { + memzero(rawSecretKey); + throw new VaultError("invalid_blob", "Decrypted key has invalid length"); + } + const seed = rawSecretKey.slice(0, SIGNING_SEED_BYTES); + let derived; + try { + derived = signingKeyPairFromSeed(seed); + } finally { + memzero(seed); + } + const valid = bytesEqual2(derived.publicKey, expectedPublicKey) && bytesEqual2(derived.secretKey, rawSecretKey) && fingerprint(derived.publicKey) === expectedAccount; + memzero(rawSecretKey); + if (!valid) { + memzero(derived.secretKey); + throw new VaultError("invalid_blob", "Decrypted key does not match vault metadata"); + } + return new UnlockedVaultHandle(expectedAccount, derived); +} +function createVault(params) { + const now = params.now ?? Date.now(); + assertValidTimestamp(now); + assertValidPassword(params.password, params.userInputs); + const keyPair = generateSigningKeyPair(); + const account = fingerprint(keyPair.publicKey); + const publicKeyB64 = toBase64Url(keyPair.publicKey); + const meta = { + v: VAULT_VERSION, + account, + public_key: publicKeyB64 + }; + try { + const passwordSection = wrapWithPassword(keyPair.secretKey, params.password, meta, params.kdf ?? KDF_MODERATE); + const { wrapped_secret: recoveryWrappedSecret, recoveryCode } = wrapWithRecovery(keyPair.secretKey, meta); + const blob = { + v: VAULT_VERSION, + account, + public_key: publicKeyB64, + created_at: now, + password: passwordSection, + recovery: { + wrapped_secret: recoveryWrappedSecret + } + }; + const unlocked = new UnlockedVaultHandle(account, keyPair); + return { blob, recoveryCode, unlocked }; + } catch (err) { + memzero(keyPair.secretKey); + throw err; + } +} +function unlockVault(blob, password) { + const parsed = parseVaultBlob(blob); + const aad = buildPasswordAad({ + v: parsed.blob.v, + account: parsed.blob.account, + public_key: parsed.blob.public_key, + kdf: parsed.blob.password.kdf + }); + const derivedKey = deriveKeyFromPassword(password, parsed.kdfParams); + let rawSecretKey; + try { + rawSecretKey = aeadDecrypt(parsed.passwordWrapped, derivedKey, aad); + } catch { + throw new VaultError("unlock_failed", "Failed to unlock vault"); + } finally { + memzero(derivedKey); + } + return verifyDecryptedSecretKey(rawSecretKey, parsed.publicKeyBytes, parsed.blob.account); +} +function unlockVaultWithRecovery(blob, recoveryCode) { + const parsed = parseVaultBlob(blob); + const codeBytes = parseRecoveryCode(recoveryCode); + let recoveryKey; + try { + recoveryKey = deriveRecoveryKey(codeBytes); + } finally { + memzero(codeBytes); + } + const aad = buildRecoveryAad({ + v: parsed.blob.v, + account: parsed.blob.account, + public_key: parsed.blob.public_key + }); + let rawSecretKey; + try { + rawSecretKey = aeadDecrypt(parsed.recoveryWrapped, recoveryKey, aad); + } catch { + throw new VaultError("unlock_failed", "Failed to unlock vault with recovery code"); + } finally { + memzero(recoveryKey); + } + return verifyDecryptedSecretKey(rawSecretKey, parsed.publicKeyBytes, parsed.blob.account); +} +async function withUnlockedVault(blob, password, fn) { + const unlocked = unlockVault(blob, password); + try { + return await fn(unlocked); + } finally { + unlocked.lock(); + } +} +function changePassword(blob, oldPassword, newPassword, options) { + if (options?.now !== undefined) { + assertValidTimestamp(options.now); + } + assertValidPassword(newPassword, options?.userInputs); + const parsed = parseVaultBlob(blob); + const unlocked = unlockVault(parsed.blob, oldPassword); + try { + const passwordSection = wrapWithPassword(unlocked.keyPair.secretKey, newPassword, { + v: parsed.blob.v, + account: parsed.blob.account, + public_key: parsed.blob.public_key + }, options?.kdf ?? KDF_MODERATE); + return { + v: parsed.blob.v, + account: parsed.blob.account, + public_key: parsed.blob.public_key, + created_at: parsed.blob.created_at, + password: passwordSection, + recovery: { + wrapped_secret: parsed.blob.recovery.wrapped_secret + } + }; + } finally { + unlocked.lock(); + } +} +function rotateRecoveryCode(blob, password) { + const parsed = parseVaultBlob(blob); + const unlocked = unlockVault(parsed.blob, password); + try { + const { wrapped_secret, recoveryCode } = wrapWithRecovery(unlocked.keyPair.secretKey, { + v: parsed.blob.v, + account: parsed.blob.account, + public_key: parsed.blob.public_key + }); + const nextBlob = { + v: parsed.blob.v, + account: parsed.blob.account, + public_key: parsed.blob.public_key, + created_at: parsed.blob.created_at, + password: { + kdf: { ...parsed.blob.password.kdf }, + wrapped_secret: parsed.blob.password.wrapped_secret + }, + recovery: { + wrapped_secret + } + }; + return { blob: nextBlob, recoveryCode }; + } finally { + unlocked.lock(); + } +} +function resetPasswordWithRecovery(blob, recoveryCode, newPassword, options) { + if (options?.now !== undefined) { + assertValidTimestamp(options.now); + } + assertValidPassword(newPassword, options?.userInputs); + const parsed = parseVaultBlob(blob); + const unlocked = unlockVaultWithRecovery(parsed.blob, recoveryCode); + try { + const passwordSection = wrapWithPassword(unlocked.keyPair.secretKey, newPassword, { + v: parsed.blob.v, + account: parsed.blob.account, + public_key: parsed.blob.public_key + }, options?.kdf ?? KDF_MODERATE); + return { + v: parsed.blob.v, + account: parsed.blob.account, + public_key: parsed.blob.public_key, + created_at: parsed.blob.created_at, + password: passwordSection, + recovery: { + wrapped_secret: parsed.blob.recovery.wrapped_secret + } + }; + } finally { + unlocked.lock(); + } +} +export { + withUnlockedVault, + vaultKdfSchema, + vaultBlobSchema, + validatePassword, + unlockVaultWithRecovery, + unlockVault, + signRevocation, + sessionExpiresAt, + serializeSession, + rotateRecoveryCode, + resetPasswordWithRecovery, + parseVaultBlob, + parseSession, + parseRecoveryCode, + issueSession, + isSessionExpired, + generateRecoveryCodeBytes, + formatRecoveryCode, + deriveRecoveryKey, + createVault, + createSensitiveCommand, + createMemoryCounterStore, + createCommandFromSession, + changePassword, + buildRecoveryAad, + buildPasswordAad, + VaultError, + VAULT_VERSION, + SESSION_DURATION_MS, + RECOVERY_CODE_BYTES, + MIN_PASSWORD_SCORE, + MIN_PASSWORD_LENGTH +}; diff --git a/package.json b/package.json index 9f9a793..194eb73 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,21 @@ "author": "Antônio Miranda ", "type": "module", "exports": { - "./protocol": "./src/protocol/index.ts", - "./crypto": "./src/crypto/index.ts", - "./vault": "./src/vault/index.ts" + "./protocol": { + "types": "./lib/types/protocol/index.d.ts", + "import": "./lib/protocol/index.js", + "default": "./lib/protocol/index.js" + }, + "./crypto": { + "types": "./lib/types/crypto/index.d.ts", + "import": "./lib/crypto/index.js", + "default": "./lib/crypto/index.js" + }, + "./vault": { + "types": "./lib/types/vault/index.d.ts", + "import": "./lib/vault/index.js", + "default": "./lib/vault/index.js" + } }, "engines": { "bun": ">=1.3.0" @@ -20,7 +32,9 @@ "lint": "biome check . && bun scripts/check-headers.ts", "format": "biome check --write .", "typecheck": "tsc --noEmit", - "test": "bun test" + "test": "bun test", + "build:lib": "bun scripts/build-lib.ts", + "check:lib": "bun scripts/build-lib.ts && git diff --exit-code -- lib" }, "devDependencies": { "@biomejs/biome": "^2.6.8", @@ -35,5 +49,8 @@ "libsodium-wrappers-sumo": "^0.8.4", "uqr": "^0.1.3", "zod": "^4.6.7" - } + }, + "files": [ + "lib" + ] } diff --git a/scripts/build-lib.ts b/scripts/build-lib.ts new file mode 100644 index 0000000..43005c1 --- /dev/null +++ b/scripts/build-lib.ts @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { rm } from "node:fs/promises"; + +const OUT_DIR = "lib"; + +async function run(command: string[]): Promise { + const proc = Bun.spawn(command, { stdout: "inherit", stderr: "inherit" }); + const code = await proc.exited; + if (code !== 0) { + process.stderr.write(`Command failed (${code}): ${command.join(" ")}\n`); + process.exit(code); + } +} + +await rm(OUT_DIR, { recursive: true, force: true }); + +// One build with code splitting so crypto, protocol and vault share a single copy of the +// module-level state (for example the libsodium initialization flag). +const result = await Bun.build({ + entrypoints: ["src/crypto/index.ts", "src/protocol/index.ts", "src/vault/index.ts"], + outdir: OUT_DIR, + format: "esm", + target: "browser", + splitting: true, + minify: false, + external: ["libsodium-wrappers-sumo", "zod"], + naming: { entry: "[dir]/[name].js", chunk: "chunks/[name]-[hash].js" }, +}); + +if (!result.success) { + for (const log of result.logs) { + process.stderr.write(`${String(log)}\n`); + } + process.exit(1); +} + +await run(["bunx", "tsc", "-p", "tsconfig.lib.json"]); diff --git a/tsconfig.lib.json b/tsconfig.lib.json new file mode 100644 index 0000000..476afe0 --- /dev/null +++ b/tsconfig.lib.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "noEmit": false, + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "lib/types", + "rootDir": "src", + "lib": ["ESNext", "DOM"], + "types": [] + }, + "include": ["src/crypto", "src/protocol", "src/vault"], + "exclude": ["src/**/*.test.ts"] +} From cbc4602c95475a9b0a5bce157dac3b666739418b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Mon, 23 Nov 2026 00:11:25 -0300 Subject: [PATCH 21/59] ci: smoke-test the built library instead of diffing generated output --- package.json | 2 +- scripts/smoke-lib.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 scripts/smoke-lib.ts diff --git a/package.json b/package.json index 194eb73..c74df4b 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "typecheck": "tsc --noEmit", "test": "bun test", "build:lib": "bun scripts/build-lib.ts", - "check:lib": "bun scripts/build-lib.ts && git diff --exit-code -- lib" + "check:lib": "bun scripts/build-lib.ts && bun scripts/smoke-lib.ts" }, "devDependencies": { "@biomejs/biome": "^2.6.8", diff --git a/scripts/smoke-lib.ts b/scripts/smoke-lib.ts new file mode 100644 index 0000000..39b91f0 --- /dev/null +++ b/scripts/smoke-lib.ts @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +// Exercises the built library (lib/) the way a consumer would: crypto, protocol and vault must +// share one initialized libsodium instance. +import { ready } from "tegrad/crypto"; +import { createCoreRegistry, PROTOCOL_VERSION } from "tegrad/protocol"; +import { createVault, unlockVault } from "tegrad/vault"; + +await ready(); + +const password = "correct horse battery staple 7!"; +const { blob, unlocked } = createVault({ + password, + kdf: { alg: "argon2id13", opslimit: 3, memlimit: 128 * 1024 * 1024 }, +}); +const again = unlockVault(blob, password); + +if (PROTOCOL_VERSION !== 1 || again.account !== unlocked.account) { + process.stderr.write("lib smoke test failed: vault round trip\n"); + process.exit(1); +} +if (createCoreRegistry().get("agent.ping") === undefined) { + process.stderr.write("lib smoke test failed: core registry\n"); + process.exit(1); +} +process.stdout.write("lib smoke test ok\n"); From f1a07be14c7766b516c48c61cb2dce4388c87613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Mon, 23 Nov 2026 01:12:29 -0300 Subject: [PATCH 22/59] feat: reply_to, event envelope, subscriptions, agent auth, signed requests and team roles - command header carries a signed reply_to; replies and events are sealed to it - every event body is { in_reply_to, data }, wrapped once in the handler context - agent.subscribe/unsubscribe and server.status.changed events - hello/auth transport frames and the agent connection answering them - HTTP requests signed by the agent (pairing, backup upload URL) - role grants, members.json, min_role per command and role checks in openCommand - backup upload URL for the Tegra Cloud destination requested from the API --- .../{index-kcrag88y.js => index-7kn9bty2.js} | 6 +- .../{index-ztead7tp.js => index-8taagmjn.js} | 935 ++++++++++--- lib/crypto/index.js | 6 +- lib/protocol/index.js | 110 +- lib/types/crypto/hash.d.ts | 2 + lib/types/crypto/index.d.ts | 2 +- lib/types/protocol/agent-auth.d.ts | 61 + lib/types/protocol/agent-message.d.ts | 18 + lib/types/protocol/command.d.ts | 12 + lib/types/protocol/commands/agent.d.ts | 102 ++ lib/types/protocol/domains.d.ts | 3 + lib/types/protocol/errors.d.ts | 2 +- lib/types/protocol/index.d.ts | 11 +- lib/types/protocol/registry.d.ts | 3 + lib/types/protocol/roles.d.ts | 106 ++ lib/types/protocol/schemas.d.ts | 50 + lib/types/protocol/trust.d.ts | 15 +- lib/vault/index.js | 4 +- src/agent/api-client.ts | 255 ++++ src/agent/connection.test.ts | 6 +- src/agent/connection.ts | 137 +- src/agent/index.ts | 21 + src/agent/jobs.test.ts | 6 +- src/agent/jobs.ts | 239 +++- src/agent/members.ts | 132 ++ src/agent/pairing-api.ts | 52 +- src/agent/pairing.test.ts | 26 +- src/agent/pairing.ts | 1 + src/agent/paths.ts | 2 + src/agent/phase3.test.ts | 1189 +++++++++++++++++ src/agent/state.ts | 102 +- src/agent/test-events.ts | 18 + src/backup/backup.test.ts | 4 +- src/backup/cloud-upload-url.test.ts | 182 +++ src/backup/destinations/tegra-cloud.ts | 25 +- src/backup/manager.ts | 42 +- src/backup/types.ts | 2 + src/cli/e2e.test.ts | 116 +- src/cli/files-wiring.test.ts | 11 +- src/cli/run.ts | 55 +- src/crypto/hash.ts | 6 + src/crypto/index.ts | 2 +- src/files/adversarial.test.ts | 4 +- src/files/manager.test.ts | 11 +- src/protocol/agent-auth.ts | 237 ++++ src/protocol/agent-message.ts | 53 +- src/protocol/command.ts | 51 + src/protocol/commands/agent.ts | 84 ++ src/protocol/commands/backup.ts | 5 + src/protocol/commands/core.ts | 19 +- src/protocol/commands/files.ts | 19 + src/protocol/commands/pairing.ts | 1 + src/protocol/commands/server.ts | 8 + src/protocol/commands/state.ts | 7 + src/protocol/commands/tunnel.ts | 4 + src/protocol/domains.ts | 3 + src/protocol/errors.ts | 5 + src/protocol/index.ts | 79 ++ src/protocol/phase3.test.ts | 947 +++++++++++++ src/protocol/registry.ts | 4 + src/protocol/roles.ts | 305 +++++ src/protocol/schemas.ts | 34 + src/protocol/trust.ts | 38 +- src/server/index.ts | 9 + src/server/runtime.test.ts | 4 +- src/server/runtime.ts | 33 +- src/server/status-watcher.ts | 136 ++ src/state/state.test.ts | 14 +- src/tunnel/playit.test.ts | 4 +- 69 files changed, 5814 insertions(+), 383 deletions(-) rename lib/chunks/{index-kcrag88y.js => index-7kn9bty2.js} (98%) rename lib/chunks/{index-ztead7tp.js => index-8taagmjn.js} (56%) create mode 100644 lib/types/protocol/agent-auth.d.ts create mode 100644 lib/types/protocol/commands/agent.d.ts create mode 100644 lib/types/protocol/roles.d.ts create mode 100644 src/agent/api-client.ts create mode 100644 src/agent/members.ts create mode 100644 src/agent/phase3.test.ts create mode 100644 src/agent/test-events.ts create mode 100644 src/backup/cloud-upload-url.test.ts create mode 100644 src/protocol/agent-auth.ts create mode 100644 src/protocol/commands/agent.ts create mode 100644 src/protocol/phase3.test.ts create mode 100644 src/protocol/roles.ts create mode 100644 src/server/status-watcher.ts diff --git a/lib/chunks/index-kcrag88y.js b/lib/chunks/index-7kn9bty2.js similarity index 98% rename from lib/chunks/index-kcrag88y.js rename to lib/chunks/index-7kn9bty2.js index 2447c3c..cc0c084 100644 --- a/lib/chunks/index-kcrag88y.js +++ b/lib/chunks/index-7kn9bty2.js @@ -304,6 +304,10 @@ function hash(data, key) { } return s.crypto_generichash(HASH_BYTES, data, null); } +var SHA256_BYTES = 32; +function sha256(data) { + return getSodium().crypto_hash_sha256(data); +} // src/crypto/kdf.ts var KDF_ALG_ARGON2ID13 = "argon2id13"; var KDF_SALT_BYTES = 16; @@ -356,4 +360,4 @@ function deriveKeyFromPassword(password, params, keyLength = KDF_KEY_BYTES) { } } } -export { ready, randomBytes, memzero, SYMMETRIC_KEY_BYTES, AEAD_NONCE_BYTES, AEAD_TAG_BYTES, generateSymmetricKey, aeadEncrypt, aeadDecrypt, toBase64Url, fromBase64Url, toBase32, SIGNING_PUBLIC_KEY_BYTES, SIGNING_SECRET_KEY_BYTES, SIGNING_SEED_BYTES, SIGNATURE_BYTES, FINGERPRINT_HASH_BYTES, FINGERPRINT_TRUNCATED_BYTES, generateSigningKeyPair, signingKeyPairFromSeed, sign, verify, fingerprint, sealTo, openSealed, canonicalize, HASH_BYTES, hash, KDF_ALG_ARGON2ID13, KDF_SALT_BYTES, KDF_KEY_BYTES, KDF_FLOOR, KDF_MODERATE, generateSalt, assertKdfParams, deriveKeyFromPassword }; +export { ready, randomBytes, memzero, SYMMETRIC_KEY_BYTES, AEAD_NONCE_BYTES, AEAD_TAG_BYTES, generateSymmetricKey, aeadEncrypt, aeadDecrypt, toBase64Url, fromBase64Url, toBase32, SIGNING_PUBLIC_KEY_BYTES, SIGNING_SECRET_KEY_BYTES, SIGNING_SEED_BYTES, SIGNATURE_BYTES, FINGERPRINT_HASH_BYTES, FINGERPRINT_TRUNCATED_BYTES, generateSigningKeyPair, signingKeyPairFromSeed, sign, verify, fingerprint, sealTo, openSealed, canonicalize, HASH_BYTES, hash, SHA256_BYTES, sha256, KDF_ALG_ARGON2ID13, KDF_SALT_BYTES, KDF_KEY_BYTES, KDF_FLOOR, KDF_MODERATE, generateSalt, assertKdfParams, deriveKeyFromPassword }; diff --git a/lib/chunks/index-ztead7tp.js b/lib/chunks/index-8taagmjn.js similarity index 56% rename from lib/chunks/index-ztead7tp.js rename to lib/chunks/index-8taagmjn.js index 69f02e0..e867160 100644 --- a/lib/chunks/index-ztead7tp.js +++ b/lib/chunks/index-8taagmjn.js @@ -8,10 +8,11 @@ import { openSealed, randomBytes, sealTo, + sha256, sign, toBase64Url, verify -} from "./index-kcrag88y.js"; +} from "./index-7kn9bty2.js"; // src/protocol/errors.ts class ProtocolError extends Error { @@ -32,6 +33,9 @@ var DOMAIN_AGENT_MESSAGE = utf8Encoder.encode("tegrad/agent-message/v1\x00"); var DOMAIN_REVOCATION = utf8Encoder.encode("tegrad/revocation/v1\x00"); var DOMAIN_TRUST_GRANT = utf8Encoder.encode("tegrad/trust-grant/v1\x00"); var DOMAIN_PAIRING_PROOF = utf8Encoder.encode("tegrad/pairing-proof/v1\x00"); +var DOMAIN_AGENT_AUTH = utf8Encoder.encode("tegrad/agent-auth/v1\x00"); +var DOMAIN_AGENT_HTTP = utf8Encoder.encode("tegrad/agent-http/v1\x00"); +var DOMAIN_ROLE_GRANT = utf8Encoder.encode("tegrad/role-grant/v1\x00"); function concatBytes(...parts) { let total = 0; for (const part of parts) { @@ -75,7 +79,8 @@ var commandHeaderSchema = z.object({ signer: keyIdSchema, issued_at: z.number().int().nonnegative(), expires_at: z.number().int().nonnegative(), - counter: z.number().int().nonnegative() + counter: z.number().int().nonnegative(), + reply_to: base64UrlSchema.optional() }); var signedCommandSchema = z.object({ header: commandHeaderSchema, @@ -143,14 +148,181 @@ var transportPingFrameSchema = z.object({ ts: z.number().int().nonnegative() }) }); +var AGENT_NONCE_BYTES = 32; +var agentNonceSchema = z.string().regex(/^[A-Za-z0-9_-]{43}$/, "Invalid nonce (expected 32 bytes in base64url)"); +var transportHelloFrameSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + kind: z.literal("hello"), + route: z.object({ + agent: keyIdSchema + }), + body: z.object({ + nonce: agentNonceSchema, + server_time: z.number().int().nonnegative() + }) +}); +var transportAuthFrameSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + kind: z.literal("auth"), + route: z.object({ + agent: keyIdSchema + }), + body: z.object({ + nonce: agentNonceSchema, + ts: z.number().int().nonnegative(), + sig: base64UrlSchema + }) +}); var transportFrameSchema = z.discriminatedUnion("kind", [ + transportHelloFrameSchema, + transportAuthFrameSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema ]); +// src/protocol/agent-auth.ts +var AGENT_AUTH_MAX_SKEW_MS = 60000; +var AGENT_HTTP_MAX_SKEW_MS = 60000; +var AGENT_HTTP_HEADER_AGENT = "X-Tegra-Agent"; +var AGENT_HTTP_HEADER_TS = "X-Tegra-Ts"; +var AGENT_HTTP_HEADER_SIG = "X-Tegra-Sig"; +var utf8Encoder2 = new TextEncoder; +function toHex(bytes) { + let out = ""; + for (const byte of bytes) { + out += byte.toString(16).padStart(2, "0"); + } + return out; +} +function generateAgentNonce() { + return toBase64Url(randomBytes(AGENT_NONCE_BYTES)); +} +function createHelloFrame(params) { + return transportHelloFrameSchema.parse({ + v: PROTOCOL_VERSION, + kind: "hello", + route: { agent: params.agent }, + body: { nonce: params.nonce ?? generateAgentNonce(), server_time: params.serverTime } + }); +} +function authSigningInput(agent, nonce, ts) { + return concatBytes(DOMAIN_AGENT_AUTH, canonicalize({ agent, nonce, ts })); +} +function signAgentAuth(params) { + const parsed = transportHelloFrameSchema.safeParse(params.hello); + if (!parsed.success) { + throw new ProtocolError("invalid_format", "Malformed hello frame"); + } + const agent = fingerprint(params.agentKeyPair.publicKey); + if (parsed.data.route.agent !== agent) { + throw new ProtocolError("wrong_agent", "Hello frame is addressed to a different agent"); + } + const nonce = parsed.data.body.nonce; + const signature = sign(authSigningInput(agent, nonce, params.ts), params.agentKeyPair.secretKey); + return transportAuthFrameSchema.parse({ + v: PROTOCOL_VERSION, + kind: "auth", + route: { agent }, + body: { nonce, ts: params.ts, sig: toBase64Url(signature) } + }); +} +function verifyAgentAuth(frame, options) { + const parsed = transportAuthFrameSchema.safeParse(frame); + if (!parsed.success) { + throw new ProtocolError("invalid_format", "Malformed auth frame"); + } + const { route, body } = parsed.data; + const agent = fingerprint(options.agentPublicKey); + if (route.agent !== agent) { + throw new ProtocolError("wrong_agent", "Auth frame is addressed to a different agent"); + } + if (!agentNonceSchema.safeParse(options.expectedNonce).success) { + throw new ProtocolError("auth_invalid", "Invalid challenge nonce"); + } + if (body.nonce !== options.expectedNonce) { + throw new ProtocolError("auth_invalid", "Auth nonce does not match the challenge"); + } + if (options.usedNonces?.has(body.nonce)) { + throw new ProtocolError("replayed", "Auth nonce was already used"); + } + const maxSkew = options.maxSkewMs ?? AGENT_AUTH_MAX_SKEW_MS; + if (Math.abs(options.now - body.ts) > maxSkew) { + throw new ProtocolError("auth_invalid", "Auth timestamp is outside the allowed window"); + } + let signatureBytes; + try { + signatureBytes = fromBase64Url(body.sig); + } catch { + throw new ProtocolError("bad_signature", "Invalid auth signature encoding"); + } + if (!verify(authSigningInput(agent, body.nonce, body.ts), signatureBytes, options.agentPublicKey)) { + throw new ProtocolError("bad_signature", "Invalid auth signature"); + } + options.usedNonces?.add(body.nonce); + return parsed.data; +} +function bodyBytes(body) { + if (body === null || body === undefined) { + return new Uint8Array(0); + } + return typeof body === "string" ? utf8Encoder2.encode(body) : body; +} +function httpSigningInput(method, pathWithQuery, body, ts) { + const bodyHash = toHex(sha256(bodyBytes(body))); + return concatBytes(DOMAIN_AGENT_HTTP, utf8Encoder2.encode(`${method.toUpperCase()} +${pathWithQuery} +${bodyHash} +${ts}`)); +} +function signAgentRequest(params) { + if (!params.pathWithQuery.startsWith("/")) { + throw new RangeError("pathWithQuery must start with /"); + } + const signature = sign(httpSigningInput(params.method, params.pathWithQuery, params.body, params.ts), params.agentKeyPair.secretKey); + return { + [AGENT_HTTP_HEADER_AGENT]: fingerprint(params.agentKeyPair.publicKey), + [AGENT_HTTP_HEADER_TS]: String(params.ts), + [AGENT_HTTP_HEADER_SIG]: toBase64Url(signature) + }; +} +function verifyAgentRequest(params) { + const agentHeader = params.getHeader(AGENT_HTTP_HEADER_AGENT); + const tsHeader = params.getHeader(AGENT_HTTP_HEADER_TS); + const sigHeader = params.getHeader(AGENT_HTTP_HEADER_SIG); + if (!agentHeader || !tsHeader || !sigHeader) { + throw new ProtocolError("request_invalid", "Missing agent signature headers"); + } + const agent = keyIdSchema.safeParse(agentHeader); + if (!agent.success || agent.data !== fingerprint(params.agentPublicKey)) { + throw new ProtocolError("wrong_agent", "Request signed by a different agent"); + } + if (!/^\d{1,16}$/.test(tsHeader)) { + throw new ProtocolError("request_invalid", "Invalid request timestamp"); + } + const ts = Number(tsHeader); + const maxSkew = params.maxSkewMs ?? AGENT_HTTP_MAX_SKEW_MS; + if (ts < params.now - maxSkew) { + throw new ProtocolError("expired", "Request timestamp is too old"); + } + if (ts > params.now + maxSkew) { + throw new ProtocolError("not_yet_valid", "Request timestamp is in the future"); + } + let signatureBytes; + try { + signatureBytes = fromBase64Url(sigHeader); + } catch { + throw new ProtocolError("bad_signature", "Invalid request signature encoding"); + } + const input = httpSigningInput(params.method, params.pathWithQuery, params.body, ts); + if (!verify(input, signatureBytes, params.agentPublicKey)) { + throw new ProtocolError("bad_signature", "Invalid request signature"); + } + return { agent: agent.data }; +} // src/protocol/agent-message.ts +import { z as z2 } from "zod"; var utf8Decoder = new TextDecoder("utf-8", { fatal: true }); function sealAgentMessage(params) { const header = { @@ -216,6 +388,232 @@ function openAgentMessage(message, agentPublicKey, recipientKeyPair) { } return { header, body }; } +var agentEventBodySchema = z2.object({ + in_reply_to: base64UrlSchema.optional(), + data: z2.unknown() +}); +function wrapEventBody(inReplyTo, data) { + return { + ...inReplyTo !== undefined ? { in_reply_to: inReplyTo } : {}, + data + }; +} +function openAgentEvent(message, agentPublicKey, recipientKeyPair) { + const opened = openAgentMessage(message, agentPublicKey, recipientKeyPair); + const parsed = agentEventBodySchema.safeParse(opened.body); + if (!parsed.success || typeof opened.body !== "object" || opened.body === null) { + throw new ProtocolError("invalid_body", "Agent event body is malformed"); + } + if (!("data" in opened.body)) { + throw new ProtocolError("invalid_body", "Agent event body has no data"); + } + return { + header: opened.header, + inReplyTo: parsed.data.in_reply_to ?? null, + data: parsed.data.data + }; +} +// src/protocol/roles.ts +import { z as z3 } from "zod"; +var ROLES = ["viewer", "operator", "editor", "admin", "owner"]; +var roleSchema = z3.enum(ROLES); +var GRANTABLE_ROLES = ["viewer", "operator", "editor", "admin"]; +var grantableRoleSchema = z3.enum(GRANTABLE_ROLES); +var ROLE_LEVEL = { + viewer: 1, + operator: 2, + editor: 3, + admin: 4, + owner: 5 +}; +function roleAtLeast(role, minimum) { + return role !== null && role !== undefined && ROLE_LEVEL[role] >= ROLE_LEVEL[minimum]; +} +function maxRole(a, b) { + if (a === null) + return b; + if (b === null) + return a; + return ROLE_LEVEL[a] >= ROLE_LEVEL[b] ? a : b; +} +var ALL_SERVERS = "*"; +var MAX_GRANT_SERVERS = 256; +var MAX_MEMBERS = 64; +var grantServerIdSchema = z3.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/, "Invalid server id"); +var grantServersSchema = z3.union([ + z3.literal(ALL_SERVERS), + z3.array(grantServerIdSchema).min(1).max(MAX_GRANT_SERVERS) +]); +var roleGrantSchema = z3.object({ + v: z3.literal(PROTOCOL_VERSION), + kind: z3.literal("server-role"), + account_key: base64UrlSchema, + agent: keyIdSchema, + servers: grantServersSchema, + role: grantableRoleSchema, + issued_at: z3.number().int().nonnegative(), + expires_at: z3.number().int().nonnegative().optional(), + sig: base64UrlSchema +}).strict(); +var MAX_GRANT_CLOCK_SKEW_MS = 5 * 60 * 1000; +function signRoleGrant(params) { + if (params.accountPublicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new RangeError(`Account public key must be ${SIGNING_PUBLIC_KEY_BYTES} bytes`); + } + if (!Number.isSafeInteger(params.issuedAt) || params.issuedAt < 0) { + throw new RangeError("issuedAt must be a non-negative safe integer"); + } + if (params.expiresAt !== undefined && (!Number.isSafeInteger(params.expiresAt) || params.expiresAt <= params.issuedAt)) { + throw new RangeError("expiresAt must be a safe integer after issuedAt"); + } + const unsigned = { + v: PROTOCOL_VERSION, + kind: "server-role", + account_key: toBase64Url(params.accountPublicKey), + agent: params.agent, + servers: params.servers === ALL_SERVERS ? ALL_SERVERS : [...params.servers], + role: params.role, + issued_at: params.issuedAt, + ...params.expiresAt !== undefined ? { expires_at: params.expiresAt } : {} + }; + const signingInput = concatBytes(DOMAIN_ROLE_GRANT, canonicalize(unsigned)); + const signature = sign(signingInput, params.granter.secretKey); + return roleGrantSchema.parse({ ...unsigned, sig: toBase64Url(signature) }); +} +function verifyRoleGrant(grant, granterPublicKey, options) { + assertSupportedVersion(grant); + const parsed = roleGrantSchema.safeParse(grant); + if (!parsed.success) { + throw new ProtocolError("role_grant_invalid", "Malformed role grant"); + } + const data = parsed.data; + if (data.agent !== options.agent) { + throw new ProtocolError("role_grant_invalid", "Role grant is addressed to a different agent"); + } + if (data.issued_at > options.now + MAX_GRANT_CLOCK_SKEW_MS) { + throw new ProtocolError("role_grant_invalid", "Role grant issued_at is in the future"); + } + if (data.expires_at !== undefined && data.expires_at <= data.issued_at) { + throw new ProtocolError("role_grant_invalid", "Role grant expiry is not after issuance"); + } + if (data.expires_at !== undefined && options.now >= data.expires_at) { + throw new ProtocolError("role_grant_invalid", "Role grant has expired"); + } + if (data.servers !== ALL_SERVERS && new Set(data.servers).size !== data.servers.length) { + throw new ProtocolError("role_grant_invalid", "Role grant lists a server more than once"); + } + let accountPublicKey; + let signatureBytes; + try { + accountPublicKey = fromBase64Url(data.account_key); + signatureBytes = fromBase64Url(data.sig); + } catch { + throw new ProtocolError("role_grant_invalid", "Invalid base64url encoding in role grant"); + } + if (accountPublicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new ProtocolError("role_grant_invalid", "Invalid account key length in role grant"); + } + const { sig: _sig, ...unsigned } = data; + const signingInput = concatBytes(DOMAIN_ROLE_GRANT, canonicalize(unsigned)); + if (!verify(signingInput, signatureBytes, granterPublicKey)) { + throw new ProtocolError("role_grant_invalid", "Invalid role grant signature"); + } + return { grant: data, accountPublicKey, accountId: fingerprint(accountPublicKey) }; +} +var memberEntrySchema = z3.object({ + account_key: base64UrlSchema, + account: keyIdSchema, + granted_by: keyIdSchema, + role: grantableRoleSchema, + servers: grantServersSchema, + issued_at: z3.number().int().nonnegative(), + expires_at: z3.number().int().nonnegative().optional() +}).strict(); +function scopeKey(servers) { + return servers === ALL_SERVERS ? ALL_SERVERS : [...servers].sort().join(","); +} +function isActive(entry, now) { + return entry.expires_at === undefined || now < entry.expires_at; +} + +class RoleTable { + #entries; + constructor(entries = []) { + this.#entries = [...entries]; + } + entries() { + return [...this.#entries]; + } + accountCount() { + return new Set(this.#entries.map((entry) => entry.account)).size; + } + keyFor(account, now) { + for (const entry of this.#entries) { + if (entry.account === account && isActive(entry, now)) { + try { + return fromBase64Url(entry.account_key); + } catch { + return null; + } + } + } + return null; + } + roleFor(account, serverId, now) { + let best = null; + let anyActive = false; + for (const entry of this.#entries) { + if (entry.account !== account || !isActive(entry, now)) { + continue; + } + anyActive = true; + const covers = entry.servers === ALL_SERVERS || serverId !== ALL_SERVERS && entry.servers.includes(serverId); + if (covers) { + best = maxRole(best, entry.role); + } + } + if (best === null && serverId === ALL_SERVERS && anyActive) { + return "viewer"; + } + return best; + } + set(entry) { + const key = scopeKey(entry.servers); + const next = this.#entries.filter((existing) => !(existing.account === entry.account && scopeKey(existing.servers) === key)); + next.push(entry); + this.#entries = next; + } + revoke(account, servers) { + let changed = 0; + const next = []; + for (const entry of this.#entries) { + if (entry.account !== account) { + next.push(entry); + continue; + } + if (servers === undefined) { + changed++; + continue; + } + if (entry.servers === ALL_SERVERS) { + next.push(entry); + continue; + } + const remaining = entry.servers.filter((id) => !servers.includes(id)); + if (remaining.length === entry.servers.length) { + next.push(entry); + continue; + } + changed++; + if (remaining.length > 0) { + next.push({ ...entry, servers: remaining }); + } + } + this.#entries = next; + return changed; + } +} + // src/protocol/session.ts function signSessionCertificate(params) { if (params.sessionPublicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { @@ -295,6 +693,9 @@ function createSignedCommand(params, registry) { if (!parsedBody.success) { throw new ProtocolError("invalid_body", "Command body failed schema validation"); } + if (params.replyTo !== undefined && params.replyTo.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new RangeError(`replyTo must be ${SIGNING_PUBLIC_KEY_BYTES} bytes`); + } const ttlMs = params.ttlMs ?? DEFAULT_COMMAND_TTL_MS; const header = { v: PROTOCOL_VERSION, @@ -304,7 +705,8 @@ function createSignedCommand(params, registry) { signer: fingerprint(params.signer.publicKey), issued_at: params.now, expires_at: params.now + ttlMs, - counter: params.counter + counter: params.counter, + ...params.replyTo !== undefined ? { reply_to: toBase64Url(params.replyTo) } : {} }; const payloadBytes = sealTo(canonicalize(parsedBody.data), params.agentPublicKey); const signingInput = concatBytes(DOMAIN_COMMAND, canonicalize(header), payloadBytes); @@ -340,6 +742,17 @@ async function openCommand(command, trust, registry) { if (idBytes.length !== COMMAND_ID_BYTES) { throw new ProtocolError("invalid_format", "Invalid command id length"); } + let replyToKey; + if (header.reply_to !== undefined) { + try { + replyToKey = fromBase64Url(header.reply_to); + } catch { + throw new ProtocolError("invalid_format", "Invalid reply_to encoding"); + } + if (replyToKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new ProtocolError("invalid_format", "Invalid reply_to length"); + } + } const localAgentId = fingerprint(trust.agentKeyPair.publicKey); if (header.agent !== localAgentId) { throw new ProtocolError("wrong_agent", "Command is addressed to a different agent"); @@ -361,6 +774,7 @@ async function openCommand(command, trust, registry) { let signerType; let accountId; let sessionId; + let sessionNotAfter; if (session !== undefined) { const accountPublicKey = trust.isTrustedAccountKey(session.account); if (accountPublicKey === null) { @@ -373,10 +787,14 @@ async function openCommand(command, trust, registry) { if (fingerprint(verifiedSession.sessionPublicKey) !== header.signer) { throw new ProtocolError("session_invalid", "Session certificate key does not match command signer"); } + if (replyToKey !== undefined && fingerprint(replyToKey) !== header.signer) { + throw new ProtocolError("wrong_recipient", "reply_to must equal the session key"); + } signerPublicKey = verifiedSession.sessionPublicKey; signerType = "session"; accountId = session.account; sessionId = session.id; + sessionNotAfter = verifiedSession.certificate.not_after; } else { const accountPublicKey = trust.isTrustedAccountKey(header.signer); if (accountPublicKey === null) { @@ -428,22 +846,31 @@ async function openCommand(command, trust, registry) { if (definition.sensitive && signerType !== "account") { throw new ProtocolError("sensitive_requires_account_key", "Sensitive command must be signed directly by an account key"); } + const scope = typeof bodyResult.data === "object" && bodyResult.data !== null && "server_id" in bodyResult.data && typeof bodyResult.data.server_id === "string" ? bodyResult.data.server_id : "*"; + const role = trust.roleFor(accountId, scope); + if (role === null || !roleAtLeast(role, definition.minRole)) { + throw new ProtocolError("insufficient_role", "Account role is below the command's minimum"); + } return { header, body: bodyResult.data, signerType, accountId, - ...sessionId !== undefined ? { sessionId } : {} + role, + ...sessionId !== undefined ? { sessionId } : {}, + ...sessionNotAfter !== undefined ? { sessionNotAfter } : {}, + ...replyToKey !== undefined ? { replyTo: replyToKey } : {} }; } -// src/protocol/commands/backup.ts -import { z as z3 } from "zod"; +// src/protocol/commands/agent.ts +import { z as z5 } from "zod"; // src/protocol/registry.ts function defineCommand(definition) { return { type: definition.type, sensitive: definition.sensitive, + minRole: definition.minRole, body: definition.body }; } @@ -475,87 +902,95 @@ class CommandRegistry { } // src/protocol/commands/server.ts -import { z as z2 } from "zod"; +import { z as z4 } from "zod"; var SERVER_ID_REGEX = /^[a-z0-9][a-z0-9-]{0,62}$/; var DEFAULT_SERVER_PORT = 25565; var MAX_CONSOLE_LINE_LENGTH = 1024; var MIN_SERVER_MEMORY_MB = 512; var MAX_SERVER_MEMORY_MB = 1048576; var MAX_JVM_ARGS = 64; -var serverIdSchema = z2.string().regex(SERVER_ID_REGEX, "server_id must match ^[a-z0-9][a-z0-9-]{0,62}$"); -var serverLoaderSchema = z2.enum(["vanilla", "fabric", "forge", "neoforge", "quilt"]); -var serverPortSchema = z2.number().int().min(1024).max(65535); -var serverMemoryMbSchema = z2.number().int().min(MIN_SERVER_MEMORY_MB).max(MAX_SERVER_MEMORY_MB); -var consoleLineSchema = z2.string().min(1).max(MAX_CONSOLE_LINE_LENGTH).refine((value) => !/[\r\n\0]/.test(value), { +var serverIdSchema = z4.string().regex(SERVER_ID_REGEX, "server_id must match ^[a-z0-9][a-z0-9-]{0,62}$"); +var serverLoaderSchema = z4.enum(["vanilla", "fabric", "forge", "neoforge", "quilt"]); +var serverPortSchema = z4.number().int().min(1024).max(65535); +var serverMemoryMbSchema = z4.number().int().min(MIN_SERVER_MEMORY_MB).max(MAX_SERVER_MEMORY_MB); +var consoleLineSchema = z4.string().min(1).max(MAX_CONSOLE_LINE_LENGTH).refine((value) => !/[\r\n\0]/.test(value), { message: "Console line must not contain newline, carriage return, or NUL characters" }); -var strictServerIdBodySchema = z2.object({ +var strictServerIdBodySchema = z4.object({ server_id: serverIdSchema }).strict(); -var serverCreateBodySchema = z2.object({ +var serverCreateBodySchema = z4.object({ server_id: serverIdSchema, - name: z2.string().trim().min(1).max(128), - minecraft_version: z2.string().min(1).max(64), + name: z4.string().trim().min(1).max(128), + minecraft_version: z4.string().min(1).max(64), loader: serverLoaderSchema, - loader_version: z2.string().min(1).max(64).optional(), + loader_version: z4.string().min(1).max(64).optional(), memory_mb: serverMemoryMbSchema, - jvm_args: z2.array(z2.string()).max(MAX_JVM_ARGS).optional(), + jvm_args: z4.array(z4.string()).max(MAX_JVM_ARGS).optional(), port: serverPortSchema.optional(), - eula_accepted: z2.boolean() + eula_accepted: z4.boolean() }).strict(); -var serverUpdateSettingsBodySchema = z2.object({ +var serverUpdateSettingsBodySchema = z4.object({ server_id: serverIdSchema, memory_mb: serverMemoryMbSchema.optional(), - jvm_args: z2.array(z2.string()).max(MAX_JVM_ARGS).optional(), + jvm_args: z4.array(z4.string()).max(MAX_JVM_ARGS).optional(), port: serverPortSchema.optional(), - eula_accepted: z2.boolean().optional() + eula_accepted: z4.boolean().optional() }).strict(); -var serverConsoleSendBodySchema = z2.object({ +var serverConsoleSendBodySchema = z4.object({ server_id: serverIdSchema, line: consoleLineSchema }).strict(); -var serverConsoleSubscribeBodySchema = z2.object({ +var serverConsoleSubscribeBodySchema = z4.object({ server_id: serverIdSchema, - from_offset: z2.number().int().nonnegative().optional() + from_offset: z4.number().int().nonnegative().optional() }).strict(); var serverCreateCommand = defineCommand({ type: "server.create", sensitive: false, + minRole: "admin", body: serverCreateBodySchema }); var serverRestartCommand = defineCommand({ type: "server.restart", sensitive: false, + minRole: "operator", body: strictServerIdBodySchema }); var serverStatusCommand = defineCommand({ type: "server.status", sensitive: false, + minRole: "viewer", body: strictServerIdBodySchema }); var serverListCommand = defineCommand({ type: "server.list", sensitive: false, - body: z2.object({}).strict() + minRole: "viewer", + body: z4.object({}).strict() }); var serverUpdateSettingsCommand = defineCommand({ type: "server.update_settings", sensitive: false, + minRole: "editor", body: serverUpdateSettingsBodySchema }); var serverConsoleSendCommand = defineCommand({ type: "server.console.send", sensitive: false, + minRole: "operator", body: serverConsoleSendBodySchema }); var serverConsoleSubscribeCommand = defineCommand({ type: "server.console.subscribe", sensitive: false, + minRole: "viewer", body: serverConsoleSubscribeBodySchema }); var serverConsoleUnsubscribeCommand = defineCommand({ type: "server.console.unsubscribe", sensitive: false, + minRole: "viewer", body: strictServerIdBodySchema }); var SERVER_COMMANDS = [ @@ -572,100 +1007,159 @@ function registerServerCommands(registry) { return registry.registerAll(SERVER_COMMANDS); } +// src/protocol/commands/agent.ts +var SUBSCRIPTION_TOPICS = ["server.status"]; +var subscriptionTopicSchema = z5.enum(SUBSCRIPTION_TOPICS); +var SERVER_STATES = ["stopped", "starting", "running", "stopping", "crashed"]; +var serverStateSchema = z5.enum(SERVER_STATES); +var serverStatusChangedSchema = z5.object({ + server_id: serverIdSchema, + state: serverStateSchema, + at: z5.number().int().nonnegative() +}); +var agentSubscribeBodySchema = z5.object({ + topics: z5.array(subscriptionTopicSchema).min(1).max(SUBSCRIPTION_TOPICS.length) +}).strict(); +var agentMembersSetBodySchema = z5.object({ + grant: roleGrantSchema +}).strict(); +var agentMembersRevokeBodySchema = z5.object({ + account: keyIdSchema, + servers: z5.array(serverIdSchema).min(1).max(256).optional() +}).strict(); +var agentSubscribeCommand = defineCommand({ + type: "agent.subscribe", + sensitive: false, + minRole: "viewer", + body: agentSubscribeBodySchema +}); +var agentUnsubscribeCommand = defineCommand({ + type: "agent.unsubscribe", + sensitive: false, + minRole: "viewer", + body: agentSubscribeBodySchema +}); +var agentMembersSetCommand = defineCommand({ + type: "agent.members.set", + sensitive: true, + minRole: "admin", + body: agentMembersSetBodySchema +}); +var agentMembersRevokeCommand = defineCommand({ + type: "agent.members.revoke", + sensitive: true, + minRole: "admin", + body: agentMembersRevokeBodySchema +}); +var AGENT_COMMANDS = [ + agentSubscribeCommand, + agentUnsubscribeCommand, + agentMembersSetCommand, + agentMembersRevokeCommand +]; +function registerAgentCommands(registry) { + return registry.registerAll(AGENT_COMMANDS); +} // src/protocol/commands/backup.ts +import { z as z6 } from "zod"; var BACKUP_ID_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/; var MIN_BACKUP_INTERVAL_MINUTES = 5; var MAX_BACKUP_INTERVAL_MINUTES = 43200; var MIN_BACKUP_RETENTION_COUNT = 1; var MAX_BACKUP_RETENTION_COUNT = 1000; -var backupIdSchema = z3.string().regex(BACKUP_ID_REGEX, "backup_id must match ^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"); -var backupDestinationKindSchema = z3.enum(["local", "s3", "tegra_cloud"]); -var backupScheduleConfigSchema = z3.object({ - enabled: z3.boolean(), - interval_minutes: z3.number().int().min(MIN_BACKUP_INTERVAL_MINUTES).max(MAX_BACKUP_INTERVAL_MINUTES), - retention_count: z3.number().int().min(MIN_BACKUP_RETENTION_COUNT).max(MAX_BACKUP_RETENTION_COUNT) +var backupIdSchema = z6.string().regex(BACKUP_ID_REGEX, "backup_id must match ^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"); +var backupDestinationKindSchema = z6.enum(["local", "s3", "tegra_cloud"]); +var backupScheduleConfigSchema = z6.object({ + enabled: z6.boolean(), + interval_minutes: z6.number().int().min(MIN_BACKUP_INTERVAL_MINUTES).max(MAX_BACKUP_INTERVAL_MINUTES), + retention_count: z6.number().int().min(MIN_BACKUP_RETENTION_COUNT).max(MAX_BACKUP_RETENTION_COUNT) }).strict(); -var backupLocalConfigSchema = z3.object({ - enabled: z3.boolean(), - retention_count: z3.number().int().min(MIN_BACKUP_RETENTION_COUNT).max(MAX_BACKUP_RETENTION_COUNT).optional() +var backupLocalConfigSchema = z6.object({ + enabled: z6.boolean(), + retention_count: z6.number().int().min(MIN_BACKUP_RETENTION_COUNT).max(MAX_BACKUP_RETENTION_COUNT).optional() }).strict(); var S3_BUCKET_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,253}[a-zA-Z0-9]?$/; var S3_REGION_REGEX = /^[a-zA-Z0-9-]{1,64}$/; var CONTROL_CHAR_REGEX = /\p{Cc}/u; -var s3BucketSchema = z3.string().min(1).max(255).regex(S3_BUCKET_REGEX, "Invalid S3 bucket name").refine((value) => !value.includes(".."), { message: "S3 bucket name must not contain '..'" }); -var s3RegionSchema = z3.string().min(1).max(64).regex(S3_REGION_REGEX, "Invalid S3 region"); -var s3PrefixSchema = z3.string().max(256).refine((value) => { +var s3BucketSchema = z6.string().min(1).max(255).regex(S3_BUCKET_REGEX, "Invalid S3 bucket name").refine((value) => !value.includes(".."), { message: "S3 bucket name must not contain '..'" }); +var s3RegionSchema = z6.string().min(1).max(64).regex(S3_REGION_REGEX, "Invalid S3 region"); +var s3PrefixSchema = z6.string().max(256).refine((value) => { if (CONTROL_CHAR_REGEX.test(value) || value.includes("\\") || value.includes("?") || value.includes("#")) { return false; } return !value.split("/").some((segment) => segment === "." || segment === ".."); }, { message: "Invalid S3 prefix" }); -var backupS3ConfigSchema = z3.object({ - enabled: z3.boolean(), +var backupS3ConfigSchema = z6.object({ + enabled: z6.boolean(), bucket: s3BucketSchema.optional(), region: s3RegionSchema.optional(), - endpoint: z3.string().min(1).max(512).optional(), + endpoint: z6.string().min(1).max(512).optional(), prefix: s3PrefixSchema.optional(), - retention_count: z3.number().int().min(MIN_BACKUP_RETENTION_COUNT).max(MAX_BACKUP_RETENTION_COUNT).optional(), - access_key_id: z3.string().min(1).max(256).optional(), - secret_access_key: z3.string().min(1).max(256).optional(), - session_token: z3.string().min(1).max(2048).optional() + retention_count: z6.number().int().min(MIN_BACKUP_RETENTION_COUNT).max(MAX_BACKUP_RETENTION_COUNT).optional(), + access_key_id: z6.string().min(1).max(256).optional(), + secret_access_key: z6.string().min(1).max(256).optional(), + session_token: z6.string().min(1).max(2048).optional() }).strict(); -var backupTegraCloudConfigSchema = z3.object({ - enabled: z3.boolean(), - retention_count: z3.number().int().min(MIN_BACKUP_RETENTION_COUNT).max(MAX_BACKUP_RETENTION_COUNT).optional() +var backupTegraCloudConfigSchema = z6.object({ + enabled: z6.boolean(), + retention_count: z6.number().int().min(MIN_BACKUP_RETENTION_COUNT).max(MAX_BACKUP_RETENTION_COUNT).optional() }).strict(); -var serverBackupConfigSetBodySchema = z3.object({ +var serverBackupConfigSetBodySchema = z6.object({ server_id: serverIdSchema, - auto_before_change: z3.boolean().optional(), + auto_before_change: z6.boolean().optional(), schedule: backupScheduleConfigSchema.optional(), local: backupLocalConfigSchema.optional(), s3: backupS3ConfigSchema.optional(), tegra_cloud: backupTegraCloudConfigSchema.optional() }).strict(); -var serverBackupCreateBodySchema = z3.object({ +var serverBackupCreateBodySchema = z6.object({ server_id: serverIdSchema, - note: z3.string().max(256).optional(), - tegra_cloud_upload_url: z3.string().min(1).max(4096).optional() + note: z6.string().max(256).optional(), + tegra_cloud_upload_url: z6.string().min(1).max(4096).optional() }).strict(); -var serverBackupListBodySchema = z3.object({ +var serverBackupListBodySchema = z6.object({ server_id: serverIdSchema, destination: backupDestinationKindSchema.optional() }).strict(); -var serverBackupDeleteBodySchema = z3.object({ +var serverBackupDeleteBodySchema = z6.object({ server_id: serverIdSchema, backup_id: backupIdSchema, destination: backupDestinationKindSchema.optional() }).strict(); -var serverBackupRestoreBodySchema = z3.object({ +var serverBackupRestoreBodySchema = z6.object({ server_id: serverIdSchema, backup_id: backupIdSchema, destination: backupDestinationKindSchema.optional(), - tegra_cloud_download_url: z3.string().min(1).max(4096).optional() + tegra_cloud_download_url: z6.string().min(1).max(4096).optional() }).strict(); var serverBackupConfigSetCommand = defineCommand({ type: "server.backup.config.set", sensitive: false, + minRole: "editor", body: serverBackupConfigSetBodySchema }); var serverBackupCreateCommand = defineCommand({ type: "server.backup.create", sensitive: false, + minRole: "editor", body: serverBackupCreateBodySchema }); var serverBackupListCommand = defineCommand({ type: "server.backup.list", sensitive: false, + minRole: "viewer", body: serverBackupListBodySchema }); var serverBackupDeleteCommand = defineCommand({ type: "server.backup.delete", sensitive: true, + minRole: "admin", body: serverBackupDeleteBodySchema }); var serverBackupRestoreCommand = defineCommand({ type: "server.backup.restore", sensitive: true, + minRole: "admin", body: serverBackupRestoreBodySchema }); var BACKUP_COMMANDS = [ @@ -679,182 +1173,201 @@ function registerBackupCommands(registry) { return registry.registerAll(BACKUP_COMMANDS); } // src/protocol/commands/core.ts -import { z as z8 } from "zod"; +import { z as z11 } from "zod"; // src/protocol/commands/files.ts -import { z as z4 } from "zod"; +import { z as z7 } from "zod"; var SERVER_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,62}$/; var SHA256_HEX_PATTERN = /^[0-9a-f]{64}$/; -var fileEncodingSchema = z4.enum(["utf8", "base64"]); -var sha256HexSchema = z4.string().regex(SHA256_HEX_PATTERN, "Expected 64 lowercase hex characters"); +var fileEncodingSchema = z7.enum(["utf8", "base64"]); +var sha256HexSchema = z7.string().regex(SHA256_HEX_PATTERN, "Expected 64 lowercase hex characters"); var filesListCommand = defineCommand({ type: "files.list", sensitive: false, - body: z4.object({ + minRole: "viewer", + body: z7.object({ server_id: serverIdSchema, - path: z4.string().optional() + path: z7.string().optional() }).strict() }); var filesStatCommand = defineCommand({ type: "files.stat", sensitive: false, - body: z4.object({ + minRole: "viewer", + body: z7.object({ server_id: serverIdSchema, - path: z4.string() + path: z7.string() }).strict() }); var filesReadCommand = defineCommand({ type: "files.read", sensitive: false, - body: z4.object({ + minRole: "editor", + body: z7.object({ server_id: serverIdSchema, - path: z4.string().min(1), + path: z7.string().min(1), encoding: fileEncodingSchema.optional() }).strict() }); var filesWriteCommand = defineCommand({ type: "files.write", sensitive: false, - body: z4.object({ + minRole: "editor", + body: z7.object({ server_id: serverIdSchema, - path: z4.string().min(1), - content: z4.string(), + path: z7.string().min(1), + content: z7.string(), encoding: fileEncodingSchema.optional() }).strict() }); var filesMkdirCommand = defineCommand({ type: "files.mkdir", sensitive: false, - body: z4.object({ + minRole: "editor", + body: z7.object({ server_id: serverIdSchema, - path: z4.string().min(1) + path: z7.string().min(1) }).strict() }); var filesRenameCommand = defineCommand({ type: "files.rename", sensitive: false, - body: z4.object({ + minRole: "editor", + body: z7.object({ server_id: serverIdSchema, - path: z4.string().min(1), - new_name: z4.string().min(1) + path: z7.string().min(1), + new_name: z7.string().min(1) }).strict() }); var filesMoveCommand = defineCommand({ type: "files.move", sensitive: false, - body: z4.object({ + minRole: "editor", + body: z7.object({ server_id: serverIdSchema, - from_path: z4.string().min(1), - to_path: z4.string().min(1) + from_path: z7.string().min(1), + to_path: z7.string().min(1) }).strict() }); var filesCopyCommand = defineCommand({ type: "files.copy", sensitive: false, - body: z4.object({ + minRole: "editor", + body: z7.object({ server_id: serverIdSchema, - from_path: z4.string().min(1), - to_path: z4.string().min(1) + from_path: z7.string().min(1), + to_path: z7.string().min(1) }).strict() }); var filesDeleteCommand = defineCommand({ type: "files.delete", sensitive: true, - body: z4.object({ + minRole: "editor", + body: z7.object({ server_id: serverIdSchema, - path: z4.string().min(1), - recursive: z4.boolean().optional() + path: z7.string().min(1), + recursive: z7.boolean().optional() }).strict() }); var filesUploadBeginCommand = defineCommand({ type: "files.upload.begin", sensitive: false, - body: z4.object({ + minRole: "editor", + body: z7.object({ server_id: serverIdSchema, - path: z4.string().min(1), - total_size: z4.number().int().nonnegative(), + path: z7.string().min(1), + total_size: z7.number().int().nonnegative(), sha256: sha256HexSchema, - part_size: z4.number().int().positive().optional() + part_size: z7.number().int().positive().optional() }).strict() }); var filesUploadPartCommand = defineCommand({ type: "files.upload.part", sensitive: false, - body: z4.object({ + minRole: "editor", + body: z7.object({ server_id: serverIdSchema, - upload_id: z4.string().min(1), - part_index: z4.number().int().nonnegative(), - data_base64: z4.string() + upload_id: z7.string().min(1), + part_index: z7.number().int().nonnegative(), + data_base64: z7.string() }).strict() }); var filesUploadCommitCommand = defineCommand({ type: "files.upload.commit", sensitive: false, - body: z4.object({ + minRole: "editor", + body: z7.object({ server_id: serverIdSchema, - upload_id: z4.string().min(1) + upload_id: z7.string().min(1) }).strict() }); var filesUploadAbortCommand = defineCommand({ type: "files.upload.abort", sensitive: false, - body: z4.object({ + minRole: "editor", + body: z7.object({ server_id: serverIdSchema, - upload_id: z4.string().min(1) + upload_id: z7.string().min(1) }).strict() }); var filesDownloadBeginCommand = defineCommand({ type: "files.download.begin", sensitive: false, - body: z4.object({ + minRole: "editor", + body: z7.object({ server_id: serverIdSchema, - path: z4.string().min(1), - part_size: z4.number().int().positive().optional() + path: z7.string().min(1), + part_size: z7.number().int().positive().optional() }).strict() }); var filesDownloadPartCommand = defineCommand({ type: "files.download.part", sensitive: false, - body: z4.object({ + minRole: "editor", + body: z7.object({ server_id: serverIdSchema, - download_id: z4.string().min(1), - part_index: z4.number().int().nonnegative() + download_id: z7.string().min(1), + part_index: z7.number().int().nonnegative() }).strict() }); var filesDownloadCloseCommand = defineCommand({ type: "files.download.close", sensitive: false, - body: z4.object({ + minRole: "editor", + body: z7.object({ server_id: serverIdSchema, - download_id: z4.string().min(1) + download_id: z7.string().min(1) }).strict() }); var filesDownloadCommand = defineCommand({ type: "files.download", sensitive: false, - body: z4.object({ + minRole: "editor", + body: z7.object({ server_id: serverIdSchema, - path: z4.string().min(1), - offset: z4.number().int().nonnegative(), - length: z4.number().int().positive() + path: z7.string().min(1), + offset: z7.number().int().nonnegative(), + length: z7.number().int().positive() }).strict() }); var filesZipCommand = defineCommand({ type: "files.zip", sensitive: false, - body: z4.object({ + minRole: "editor", + body: z7.object({ server_id: serverIdSchema, - paths: z4.array(z4.string().min(1)).min(1), - dest_path: z4.string().min(1) + paths: z7.array(z7.string().min(1)).min(1), + dest_path: z7.string().min(1) }).strict() }); var filesUnzipCommand = defineCommand({ type: "files.unzip", sensitive: false, - body: z4.object({ + minRole: "editor", + body: z7.object({ server_id: serverIdSchema, - zip_path: z4.string().min(1), - dest_path: z4.string().optional() + zip_path: z7.string().min(1), + dest_path: z7.string().optional() }).strict() }); var FILES_COMMANDS = [ @@ -883,11 +1396,12 @@ function registerFilesCommands(registry) { } // src/protocol/commands/pairing.ts -import { z as z5 } from "zod"; +import { z as z8 } from "zod"; var agentRevocationsSetCommand = defineCommand({ type: "agent.revocations.set", sensitive: false, - body: z5.object({ + minRole: "admin", + body: z8.object({ list: revocationListSchema }) }); @@ -897,18 +1411,18 @@ function registerPairingCommands(registry) { } // src/protocol/commands/state.ts -import { z as z6 } from "zod"; +import { z as z9 } from "zod"; var SHA1_HEX_PATTERN = /^[0-9a-f]{40}$/i; var SHA512_HEX_PATTERN = /^[0-9a-f]{128}$/i; -var sha1HexSchema = z6.string().regex(SHA1_HEX_PATTERN, "Expected 40 hex characters").transform((v) => v.toLowerCase()); -var sha512HexSchema = z6.string().regex(SHA512_HEX_PATTERN, "Expected 128 hex characters").transform((v) => v.toLowerCase()); -var modSourceSchema = z6.enum(["modrinth", "curseforge", "tegra", "local"]); -var modLayerSchema = z6.enum(["origin", "user"]); +var sha1HexSchema = z9.string().regex(SHA1_HEX_PATTERN, "Expected 40 hex characters").transform((v) => v.toLowerCase()); +var sha512HexSchema = z9.string().regex(SHA512_HEX_PATTERN, "Expected 128 hex characters").transform((v) => v.toLowerCase()); +var modSourceSchema = z9.enum(["modrinth", "curseforge", "tegra", "local"]); +var modLayerSchema = z9.enum(["origin", "user"]); var MOD_UNSAFE_UNICODE_REGEX = /(?:\p{Cc}|\p{Cf}|\u034F|\u180E|\u2028|\u2029|\u3164|\uFFA0)/u; var MOD_ENCODED_TRAVERSAL_REGEX = /%(?:2f|5c|00)/i; var MOD_RESERVED_WINDOWS_REGEX = /^(?:CON|PRN|AUX|NUL|COM[1-9¹²³]|LPT[1-9¹²³]|CONIN\$|CONOUT\$|CLOCK\$)\s*(?:\.|$)/i; var MOD_FORBIDDEN_NAMES = new Set([".runtime", ".tegrad-uploads"]); -var modFileNameSchema = z6.string().min(1).max(255).refine((name) => { +var modFileNameSchema = z9.string().min(1).max(255).refine((name) => { if (name.includes("/") || name.includes("\\") || name.includes("\x00") || name.includes(":") || name === "." || name === ".." || name.endsWith(".") || name.endsWith(" ")) { return false; } @@ -924,103 +1438,103 @@ var modFileNameSchema = z6.string().min(1).max(255).refine((name) => { } return new TextEncoder().encode(name).byteLength <= 255; }, { message: "Mod filename must be a single safe filename" }); -var serverModEntrySchema = z6.object({ +var serverModEntrySchema = z9.object({ file: modFileNameSchema, source: modSourceSchema, - project_id: z6.string().min(1).max(128).optional(), - version_id: z6.string().min(1).max(128).optional(), + project_id: z9.string().min(1).max(128).optional(), + version_id: z9.string().min(1).max(128).optional(), sha1: sha1HexSchema.optional(), sha256: sha256HexSchema.optional(), sha512: sha512HexSchema.optional(), layer: modLayerSchema }).strict(); -var serverOriginSchema = z6.discriminatedUnion("kind", [ - z6.object({ - kind: z6.literal("modpack"), +var serverOriginSchema = z9.discriminatedUnion("kind", [ + z9.object({ + kind: z9.literal("modpack"), source: modSourceSchema, - modpack_id: z6.string().min(1).max(128), - version_id: z6.string().min(1).max(128) + modpack_id: z9.string().min(1).max(128), + version_id: z9.string().min(1).max(128) }).strict(), - z6.object({ - kind: z6.literal("local"), - note: z6.string().max(512).optional() + z9.object({ + kind: z9.literal("local"), + note: z9.string().max(512).optional() }).strict() ]).nullable(); -var serverOriginSyncStateSchema = z6.object({ - excluded_mod_keys: z6.array(z6.string().min(1).max(256)).max(4000), - synced_mod_keys: z6.array(z6.string().min(1).max(256)).max(4000), - removed_origin_files: z6.array(z6.string().min(1).max(1024)).max(5000).optional(), - synced_files: z6.array(z6.string().min(1).max(1024)).max(5000).optional(), - last_synced_at: z6.string().nullable().optional(), - last_synced_version_id: z6.string().min(1).max(128).nullable().optional() +var serverOriginSyncStateSchema = z9.object({ + excluded_mod_keys: z9.array(z9.string().min(1).max(256)).max(4000), + synced_mod_keys: z9.array(z9.string().min(1).max(256)).max(4000), + removed_origin_files: z9.array(z9.string().min(1).max(1024)).max(5000).optional(), + synced_files: z9.array(z9.string().min(1).max(1024)).max(5000).optional(), + last_synced_at: z9.string().nullable().optional(), + last_synced_version_id: z9.string().min(1).max(128).nullable().optional() }).strict(); -var modEnvironmentInfoSchema = z6.object({ - client: z6.enum(["required", "optional", "unsupported", "unknown"]).optional(), - server: z6.enum(["required", "optional", "unsupported", "unknown"]).optional() +var modEnvironmentInfoSchema = z9.object({ + client: z9.enum(["required", "optional", "unsupported", "unknown"]).optional(), + server: z9.enum(["required", "optional", "unsupported", "unknown"]).optional() }).strict(); -var originPlanModInputSchema = z6.object({ - key: z6.string().min(1).max(256), +var originPlanModInputSchema = z9.object({ + key: z9.string().min(1).max(256), file: modFileNameSchema, - name: z6.string().min(1).max(256).optional(), - enabled: z6.boolean().optional(), + name: z9.string().min(1).max(256).optional(), + enabled: z9.boolean().optional(), source: modSourceSchema.optional(), - project_id: z6.string().min(1).max(128).optional(), - version_id: z6.string().min(1).max(128).optional(), - url: z6.string().url().max(2048).optional(), + project_id: z9.string().min(1).max(128).optional(), + version_id: z9.string().min(1).max(128).optional(), + url: z9.string().url().max(2048).optional(), sha1: sha1HexSchema.optional(), sha256: sha256HexSchema.optional(), sha512: sha512HexSchema.optional(), environment: modEnvironmentInfoSchema.optional() }).strict(); -var originPlanFileInputSchema = z6.object({ - path: z6.string().min(1).max(1024), +var originPlanFileInputSchema = z9.object({ + path: z9.string().min(1).max(1024), sha1: sha1HexSchema, sha256: sha256HexSchema.optional(), - size_bytes: z6.number().int().nonnegative(), - url: z6.string().url().max(2048).optional(), - content_base64: z6.string().optional() + size_bytes: z9.number().int().nonnegative(), + url: z9.string().url().max(2048).optional(), + content_base64: z9.string().optional() }).strict(); -var serverModsListBodySchema = z6.object({ +var serverModsListBodySchema = z9.object({ server_id: serverIdSchema }).strict(); -var serverModsInstallBodySchema = z6.object({ +var serverModsInstallBodySchema = z9.object({ server_id: serverIdSchema, file: modFileNameSchema, - url: z6.string().url().max(2048), + url: z9.string().url().max(2048), source: modSourceSchema, - project_id: z6.string().min(1).max(128).optional(), - version_id: z6.string().min(1).max(128).optional(), + project_id: z9.string().min(1).max(128).optional(), + version_id: z9.string().min(1).max(128).optional(), sha1: sha1HexSchema.optional(), sha256: sha256HexSchema.optional(), sha512: sha512HexSchema.optional() }).strict(); -var serverModsRemoveBodySchema = z6.object({ +var serverModsRemoveBodySchema = z9.object({ server_id: serverIdSchema, file: modFileNameSchema }).strict(); -var serverOriginPlanBodySchema = z6.object({ +var serverOriginPlanBodySchema = z9.object({ server_id: serverIdSchema, - to_version_id: z6.string().min(1).max(128), + to_version_id: z9.string().min(1).max(128), source: modSourceSchema.optional(), - modpack_id: z6.string().min(1).max(128).optional(), - minecraft_version: z6.string().min(1).max(64).optional(), + modpack_id: z9.string().min(1).max(128).optional(), + minecraft_version: z9.string().min(1).max(64).optional(), loader: serverLoaderSchema.optional(), - loader_version: z6.string().min(1).max(64).nullable().optional(), - mods: z6.array(originPlanModInputSchema).max(2000), - files: z6.array(originPlanFileInputSchema).max(5000).optional() + loader_version: z9.string().min(1).max(64).nullable().optional(), + mods: z9.array(originPlanModInputSchema).max(2000), + files: z9.array(originPlanFileInputSchema).max(5000).optional() }).strict(); -var serverOriginApplyBodySchema = z6.object({ +var serverOriginApplyBodySchema = z9.object({ server_id: serverIdSchema, - plan_id: z6.string().min(1).max(128), - selected_mod_keys: z6.array(z6.string().min(1).max(256)).max(2000).optional(), - selected_file_paths: z6.array(z6.string().min(1).max(1024)).max(5000).optional() + plan_id: z9.string().min(1).max(128), + selected_mod_keys: z9.array(z9.string().min(1).max(256)).max(2000).optional(), + selected_file_paths: z9.array(z9.string().min(1).max(1024)).max(5000).optional() }).strict(); -var serverOriginUnlinkBodySchema = z6.object({ +var serverOriginUnlinkBodySchema = z9.object({ server_id: serverIdSchema }).strict(); -var serverDeployServerpackBodySchema = z6.object({ +var serverDeployServerpackBodySchema = z9.object({ server_id: serverIdSchema, - url: z6.string().url().max(2048), + url: z9.string().url().max(2048), sha256: sha256HexSchema.optional(), sha512: sha512HexSchema.optional(), sha1: sha1HexSchema.optional(), @@ -1029,36 +1543,43 @@ var serverDeployServerpackBodySchema = z6.object({ var serverModsListCommand = defineCommand({ type: "server.mods.list", sensitive: false, + minRole: "viewer", body: serverModsListBodySchema }); var serverModsInstallCommand = defineCommand({ type: "server.mods.install", sensitive: false, + minRole: "editor", body: serverModsInstallBodySchema }); var serverModsRemoveCommand = defineCommand({ type: "server.mods.remove", sensitive: false, + minRole: "editor", body: serverModsRemoveBodySchema }); var serverOriginPlanCommand = defineCommand({ type: "server.origin.plan", sensitive: false, + minRole: "editor", body: serverOriginPlanBodySchema }); var serverOriginApplyCommand = defineCommand({ type: "server.origin.apply", sensitive: true, + minRole: "editor", body: serverOriginApplyBodySchema }); var serverOriginUnlinkCommand = defineCommand({ type: "server.origin.unlink", sensitive: false, + minRole: "editor", body: serverOriginUnlinkBodySchema }); var serverDeployServerpackCommand = defineCommand({ type: "server.deploy.serverpack", sensitive: true, + minRole: "editor", body: serverDeployServerpackBodySchema }); var STATE_COMMANDS = [ @@ -1075,33 +1596,37 @@ function registerStateCommands(registry) { } // src/protocol/commands/tunnel.ts -import { z as z7 } from "zod"; +import { z as z10 } from "zod"; var PLAYIT_SECRET_KEY_REGEX = /^[0-9a-fA-F]{16,256}$/; -var playitSecretKeySchema = z7.string().trim().regex(PLAYIT_SECRET_KEY_REGEX, "secret_key must be a 16-256 character hexadecimal string").refine((value) => value.length % 2 === 0, { +var playitSecretKeySchema = z10.string().trim().regex(PLAYIT_SECRET_KEY_REGEX, "secret_key must be a 16-256 character hexadecimal string").refine((value) => value.length % 2 === 0, { message: "secret_key must have an even number of hexadecimal characters" }); -var tunnelPlayitSetKeyBodySchema = z7.object({ +var tunnelPlayitSetKeyBodySchema = z10.object({ secret_key: playitSecretKeySchema }).strict(); var tunnelPlayitSetKeyCommand = defineCommand({ type: "tunnel.playit.set_key", sensitive: true, + minRole: "admin", body: tunnelPlayitSetKeyBodySchema }); var tunnelPlayitStartCommand = defineCommand({ type: "tunnel.playit.start", sensitive: false, - body: z7.object({}).strict() + minRole: "admin", + body: z10.object({}).strict() }); var tunnelPlayitStopCommand = defineCommand({ type: "tunnel.playit.stop", sensitive: false, - body: z7.object({}).strict() + minRole: "admin", + body: z10.object({}).strict() }); var tunnelPlayitStatusCommand = defineCommand({ type: "tunnel.playit.status", sensitive: false, - body: z7.object({}).strict() + minRole: "viewer", + body: z10.object({}).strict() }); var TUNNEL_COMMANDS = [ tunnelPlayitSetKeyCommand, @@ -1114,30 +1639,34 @@ function registerTunnelCommands(registry) { } // src/protocol/commands/core.ts -var serverIdBodySchema = z8.object({ - server_id: z8.string().min(1) +var serverIdBodySchema = z11.object({ + server_id: z11.string().min(1) }); -var strictServerDeleteBodySchema = z8.object({ +var strictServerDeleteBodySchema = z11.object({ server_id: serverIdSchema }).strict(); var agentPingCommand = defineCommand({ type: "agent.ping", sensitive: false, - body: z8.object({}).strict() + minRole: "viewer", + body: z11.object({}).strict() }); var serverStartCommand = defineCommand({ type: "server.start", sensitive: false, + minRole: "operator", body: serverIdBodySchema }); var serverStopCommand = defineCommand({ type: "server.stop", sensitive: false, + minRole: "operator", body: serverIdBodySchema }); var serverDeleteCommand = defineCommand({ type: "server.delete", sensitive: true, + minRole: "admin", body: strictServerDeleteBodySchema }); var CORE_COMMANDS = [ @@ -1150,24 +1679,24 @@ function registerCoreCommands(registry) { return registry.registerAll(CORE_COMMANDS); } function createCoreRegistry() { - return registerTunnelCommands(registerBackupCommands(registerStateCommands(registerServerCommands(registerFilesCommands(registerPairingCommands(registerCoreCommands(new CommandRegistry))))))); + return registerAgentCommands(registerTunnelCommands(registerBackupCommands(registerStateCommands(registerServerCommands(registerFilesCommands(registerPairingCommands(registerCoreCommands(new CommandRegistry)))))))); } // src/protocol/pairing.ts -import { z as z9 } from "zod"; +import { z as z12 } from "zod"; var PAIRING_CODE_LENGTH = 10; var PAIRING_SECRET_BYTES = 16; var DEFAULT_TRUST_GRANT_TTL_MS = 10 * 60 * 1000; var MAX_TRUST_GRANT_TTL_MS = 15 * 60 * 1000; var CROCKFORD_ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"; var PAIRING_CODE_REGEX = /^[0-9A-HJKMNP-TV-Z]{10}$/; -var pairingCodeSchema = z9.string().regex(PAIRING_CODE_REGEX, "Invalid pairing code"); -var trustGrantSchema = z9.object({ - v: z9.literal(PROTOCOL_VERSION), - kind: z9.literal("agent-pairing"), +var pairingCodeSchema = z12.string().regex(PAIRING_CODE_REGEX, "Invalid pairing code"); +var trustGrantSchema = z12.object({ + v: z12.literal(PROTOCOL_VERSION), + kind: z12.literal("agent-pairing"), account_key: base64UrlSchema, agent: keyIdSchema, - issued_at: z9.number().int().nonnegative(), - expires_at: z9.number().int().nonnegative(), + issued_at: z12.number().int().nonnegative(), + expires_at: z12.number().int().nonnegative(), proof: base64UrlSchema.optional(), sig: base64UrlSchema }); @@ -1430,6 +1959,7 @@ function createInMemoryTrustContext(options) { for (const key of options.trustedAccountKeys) { trusted.set(fingerprint(key), key); } + const members = new RoleTable(options.members); const revoked = new Set(options.revokedSessionIds); const seenIds = new Set; const lastCounters = new Map; @@ -1437,7 +1967,22 @@ function createInMemoryTrustContext(options) { return { agentKeyPair: options.agentKeyPair, isTrustedAccountKey(id) { - return trusted.get(id) ?? null; + return trusted.get(id) ?? members.keyFor(id, clock()); + }, + roleFor(account, serverId) { + if (trusted.has(account)) { + return "owner"; + } + return members.roleFor(account, serverId, clock()); + }, + listMembers() { + return members.entries(); + }, + setMember(entry) { + members.set(entry); + }, + revokeMembers(account, servers) { + return members.revoke(account, servers); }, isSessionRevoked(certificateId) { return revoked.has(certificateId); @@ -1465,4 +2010,4 @@ function createInMemoryTrustContext(options) { } }; } -export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, transportFrameSchema, sealAgentMessage, openAgentMessage, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, serverCreateBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverCreateCommand, serverRestartCommand, serverStatusCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; +export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, serverCreateBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverCreateCommand, serverRestartCommand, serverStatusCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; diff --git a/lib/crypto/index.js b/lib/crypto/index.js index 48aba73..ede4c71 100644 --- a/lib/crypto/index.js +++ b/lib/crypto/index.js @@ -9,6 +9,7 @@ import { KDF_KEY_BYTES, KDF_MODERATE, KDF_SALT_BYTES, + SHA256_BYTES, SIGNATURE_BYTES, SIGNING_PUBLIC_KEY_BYTES, SIGNING_SECRET_KEY_BYTES, @@ -30,18 +31,20 @@ import { randomBytes, ready, sealTo, + sha256, sign, signingKeyPairFromSeed, toBase32, toBase64Url, verify -} from "../chunks/index-kcrag88y.js"; +} from "../chunks/index-7kn9bty2.js"; export { verify, toBase64Url, toBase32, signingKeyPairFromSeed, sign, + sha256, sealTo, ready, randomBytes, @@ -63,6 +66,7 @@ export { SIGNING_SECRET_KEY_BYTES, SIGNING_PUBLIC_KEY_BYTES, SIGNATURE_BYTES, + SHA256_BYTES, KDF_SALT_BYTES, KDF_MODERATE, KDF_KEY_BYTES, diff --git a/lib/protocol/index.js b/lib/protocol/index.js index 08bee31..17ce98a 100644 --- a/lib/protocol/index.js +++ b/lib/protocol/index.js @@ -1,4 +1,12 @@ import { + AGENT_AUTH_MAX_SKEW_MS, + AGENT_COMMANDS, + AGENT_HTTP_HEADER_AGENT, + AGENT_HTTP_HEADER_SIG, + AGENT_HTTP_HEADER_TS, + AGENT_HTTP_MAX_SKEW_MS, + AGENT_NONCE_BYTES, + ALL_SERVERS, BACKUP_COMMANDS, BACKUP_ID_REGEX, COMMAND_ID_BYTES, @@ -7,19 +15,26 @@ import { DEFAULT_COMMAND_TTL_MS, DEFAULT_SERVER_PORT, DEFAULT_TRUST_GRANT_TTL_MS, + DOMAIN_AGENT_AUTH, + DOMAIN_AGENT_HTTP, DOMAIN_AGENT_MESSAGE, DOMAIN_COMMAND, DOMAIN_PAIRING_PROOF, DOMAIN_REVOCATION, + DOMAIN_ROLE_GRANT, DOMAIN_SESSION, DOMAIN_TRUST_GRANT, FILES_COMMANDS, + GRANTABLE_ROLES, MAX_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_RETENTION_COUNT, MAX_CLOCK_SKEW_MS, MAX_COMMAND_TTL_MS, MAX_CONSOLE_LINE_LENGTH, + MAX_GRANT_CLOCK_SKEW_MS, + MAX_GRANT_SERVERS, MAX_JVM_ARGS, + MAX_MEMBERS, MAX_SERVER_MEMORY_MB, MAX_TRUST_GRANT_TTL_MS, MIN_BACKUP_INTERVAL_MINUTES, @@ -31,18 +46,32 @@ import { PLAYIT_SECRET_KEY_REGEX, PROTOCOL_VERSION, ProtocolError, + ROLES, + ROLE_LEVEL, + RoleTable, SERVER_COMMANDS, SERVER_ID_PATTERN, SERVER_ID_REGEX, + SERVER_STATES, SHA1_HEX_PATTERN, SHA256_HEX_PATTERN, SHA512_HEX_PATTERN, STATE_COMMANDS, + SUBSCRIPTION_TOPICS, TUNNEL_COMMANDS, + agentEventBodySchema, + agentMembersRevokeBodySchema, + agentMembersRevokeCommand, + agentMembersSetBodySchema, + agentMembersSetCommand, agentMessageHeaderSchema, agentMessageSchema, + agentNonceSchema, agentPingCommand, agentRevocationsSetCommand, + agentSubscribeBodySchema, + agentSubscribeCommand, + agentUnsubscribeCommand, backupDestinationKindSchema, backupIdSchema, backupLocalConfigSchema, @@ -54,6 +83,7 @@ import { commandHeaderSchema, consoleLineSchema, createCoreRegistry, + createHelloFrame, createInMemoryTrustContext, createSignedCommand, defineCommand, @@ -76,13 +106,18 @@ import { filesUploadPartCommand, filesWriteCommand, filesZipCommand, + generateAgentNonce, generatePairingCode, generatePairingSecret, + grantableRoleSchema, keyIdSchema, + maxRole, + memberEntrySchema, modEnvironmentInfoSchema, modFileNameSchema, modLayerSchema, modSourceSchema, + openAgentEvent, openAgentMessage, openCommand, originPlanFileInputSchema, @@ -90,6 +125,7 @@ import { pairingCodeSchema, parsePairingFragment, playitSecretKeySchema, + registerAgentCommands, registerBackupCommands, registerCoreCommands, registerFilesCommands, @@ -98,6 +134,9 @@ import { registerStateCommands, registerTunnelCommands, revocationListSchema, + roleAtLeast, + roleGrantSchema, + roleSchema, s3BucketSchema, s3PrefixSchema, s3RegionSchema, @@ -144,6 +183,8 @@ import { serverPortSchema, serverRestartCommand, serverStartCommand, + serverStateSchema, + serverStatusChangedSchema, serverStatusCommand, serverStopCommand, serverUpdateSettingsBodySchema, @@ -152,14 +193,20 @@ import { sha1HexSchema, sha256HexSchema, sha512HexSchema, + signAgentAuth, + signAgentRequest, signRevocationList, + signRoleGrant, signSessionCertificate, signTrustGrant, signedCommandSchema, + subscriptionTopicSchema, transportAckFrameSchema, + transportAuthFrameSchema, transportCommandFrameSchema, transportEventFrameSchema, transportFrameSchema, + transportHelloFrameSchema, transportPingFrameSchema, trustGrantSchema, tunnelPlayitSetKeyBodySchema, @@ -167,15 +214,23 @@ import { tunnelPlayitStartCommand, tunnelPlayitStatusCommand, tunnelPlayitStopCommand, + verifyAgentAuth, + verifyAgentRequest, verifyRevocationList, + verifyRoleGrant, verifySessionCertificate, - verifyTrustGrant -} from "../chunks/index-ztead7tp.js"; -import"../chunks/index-kcrag88y.js"; + verifyTrustGrant, + wrapEventBody +} from "../chunks/index-8taagmjn.js"; +import"../chunks/index-7kn9bty2.js"; export { + wrapEventBody, verifyTrustGrant, verifySessionCertificate, + verifyRoleGrant, verifyRevocationList, + verifyAgentRequest, + verifyAgentAuth, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, tunnelPlayitStartCommand, @@ -183,14 +238,20 @@ export { tunnelPlayitSetKeyBodySchema, trustGrantSchema, transportPingFrameSchema, + transportHelloFrameSchema, transportFrameSchema, transportEventFrameSchema, transportCommandFrameSchema, + transportAuthFrameSchema, transportAckFrameSchema, + subscriptionTopicSchema, signedCommandSchema, signTrustGrant, signSessionCertificate, + signRoleGrant, signRevocationList, + signAgentRequest, + signAgentAuth, sha512HexSchema, sha256HexSchema, sha1HexSchema, @@ -199,6 +260,8 @@ export { serverUpdateSettingsBodySchema, serverStopCommand, serverStatusCommand, + serverStatusChangedSchema, + serverStateSchema, serverStartCommand, serverRestartCommand, serverPortSchema, @@ -245,6 +308,9 @@ export { s3RegionSchema, s3PrefixSchema, s3BucketSchema, + roleSchema, + roleGrantSchema, + roleAtLeast, revocationListSchema, registerTunnelCommands, registerStateCommands, @@ -253,6 +319,7 @@ export { registerFilesCommands, registerCoreCommands, registerBackupCommands, + registerAgentCommands, playitSecretKeySchema, parsePairingFragment, pairingCodeSchema, @@ -260,13 +327,18 @@ export { originPlanFileInputSchema, openCommand, openAgentMessage, + openAgentEvent, modSourceSchema, modLayerSchema, modFileNameSchema, modEnvironmentInfoSchema, + memberEntrySchema, + maxRole, keyIdSchema, + grantableRoleSchema, generatePairingSecret, generatePairingCode, + generateAgentNonce, filesZipCommand, filesWriteCommand, filesUploadPartCommand, @@ -289,6 +361,7 @@ export { defineCommand, createSignedCommand, createInMemoryTrustContext, + createHelloFrame, createCoreRegistry, consoleLineSchema, commandHeaderSchema, @@ -300,18 +373,32 @@ export { backupLocalConfigSchema, backupIdSchema, backupDestinationKindSchema, + agentUnsubscribeCommand, + agentSubscribeCommand, + agentSubscribeBodySchema, agentRevocationsSetCommand, agentPingCommand, + agentNonceSchema, agentMessageSchema, agentMessageHeaderSchema, + agentMembersSetCommand, + agentMembersSetBodySchema, + agentMembersRevokeCommand, + agentMembersRevokeBodySchema, + agentEventBodySchema, TUNNEL_COMMANDS, + SUBSCRIPTION_TOPICS, STATE_COMMANDS, SHA512_HEX_PATTERN, SHA256_HEX_PATTERN, SHA1_HEX_PATTERN, + SERVER_STATES, SERVER_ID_REGEX, SERVER_ID_PATTERN, SERVER_COMMANDS, + RoleTable, + ROLE_LEVEL, + ROLES, ProtocolError, PROTOCOL_VERSION, PLAYIT_SECRET_KEY_REGEX, @@ -323,19 +410,26 @@ export { MIN_BACKUP_INTERVAL_MINUTES, MAX_TRUST_GRANT_TTL_MS, MAX_SERVER_MEMORY_MB, + MAX_MEMBERS, MAX_JVM_ARGS, + MAX_GRANT_SERVERS, + MAX_GRANT_CLOCK_SKEW_MS, MAX_CONSOLE_LINE_LENGTH, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, MAX_BACKUP_RETENTION_COUNT, MAX_BACKUP_INTERVAL_MINUTES, + GRANTABLE_ROLES, FILES_COMMANDS, DOMAIN_TRUST_GRANT, DOMAIN_SESSION, + DOMAIN_ROLE_GRANT, DOMAIN_REVOCATION, DOMAIN_PAIRING_PROOF, DOMAIN_COMMAND, DOMAIN_AGENT_MESSAGE, + DOMAIN_AGENT_HTTP, + DOMAIN_AGENT_AUTH, DEFAULT_TRUST_GRANT_TTL_MS, DEFAULT_SERVER_PORT, DEFAULT_COMMAND_TTL_MS, @@ -343,5 +437,13 @@ export { CORE_COMMANDS, COMMAND_ID_BYTES, BACKUP_ID_REGEX, - BACKUP_COMMANDS + BACKUP_COMMANDS, + ALL_SERVERS, + AGENT_NONCE_BYTES, + AGENT_HTTP_MAX_SKEW_MS, + AGENT_HTTP_HEADER_TS, + AGENT_HTTP_HEADER_SIG, + AGENT_HTTP_HEADER_AGENT, + AGENT_COMMANDS, + AGENT_AUTH_MAX_SKEW_MS }; diff --git a/lib/types/crypto/hash.d.ts b/lib/types/crypto/hash.d.ts index 8fdabeb..745da7f 100644 --- a/lib/types/crypto/hash.d.ts +++ b/lib/types/crypto/hash.d.ts @@ -1,2 +1,4 @@ export declare const HASH_BYTES = 32; export declare function hash(data: Uint8Array, key?: Uint8Array): Uint8Array; +export declare const SHA256_BYTES = 32; +export declare function sha256(data: Uint8Array): Uint8Array; diff --git a/lib/types/crypto/index.d.ts b/lib/types/crypto/index.d.ts index 033edcc..863a55a 100644 --- a/lib/types/crypto/index.d.ts +++ b/lib/types/crypto/index.d.ts @@ -2,7 +2,7 @@ export { AEAD_NONCE_BYTES, AEAD_TAG_BYTES, aeadDecrypt, aeadEncrypt, generateSym export { openSealed, sealTo } from "./box"; export { canonicalize } from "./canonical"; export { fromBase64Url, toBase32, toBase64Url } from "./encoding"; -export { HASH_BYTES, hash } from "./hash"; +export { HASH_BYTES, hash, SHA256_BYTES, sha256 } from "./hash"; export { assertKdfParams, deriveKeyFromPassword, generateSalt, KDF_ALG_ARGON2ID13, KDF_FLOOR, KDF_KEY_BYTES, KDF_MODERATE, KDF_SALT_BYTES, type KdfParams, type KdfPreset, } from "./kdf"; export { FINGERPRINT_HASH_BYTES, FINGERPRINT_TRUNCATED_BYTES, fingerprint, generateSigningKeyPair, type PublicKey, type SecretKey, SIGNATURE_BYTES, SIGNING_PUBLIC_KEY_BYTES, SIGNING_SECRET_KEY_BYTES, SIGNING_SEED_BYTES, type SigningKeyPair, sign, signingKeyPairFromSeed, verify, } from "./signing"; export { memzero, randomBytes, ready } from "./sodium"; diff --git a/lib/types/protocol/agent-auth.d.ts b/lib/types/protocol/agent-auth.d.ts new file mode 100644 index 0000000..a6bf88f --- /dev/null +++ b/lib/types/protocol/agent-auth.d.ts @@ -0,0 +1,61 @@ +import { type PublicKey, type SigningKeyPair } from "../crypto"; +import { type KeyId, type TransportFrame } from "./schemas"; +export declare const AGENT_AUTH_MAX_SKEW_MS = 60000; +export declare const AGENT_HTTP_MAX_SKEW_MS = 60000; +export declare const AGENT_HTTP_HEADER_AGENT = "X-Tegra-Agent"; +export declare const AGENT_HTTP_HEADER_TS = "X-Tegra-Ts"; +export declare const AGENT_HTTP_HEADER_SIG = "X-Tegra-Sig"; +export type HelloFrame = Extract; +export type AuthFrame = Extract; +/** Fresh nonce for a `hello` frame. */ +export declare function generateAgentNonce(): string; +export declare function createHelloFrame(params: { + readonly agent: KeyId; + readonly serverTime: number; + readonly nonce?: string; +}): HelloFrame; +/** Agent side: answers the API's `hello` challenge. */ +export declare function signAgentAuth(params: { + readonly agentKeyPair: SigningKeyPair; + readonly hello: unknown; + readonly ts: number; +}): AuthFrame; +export interface VerifyAgentAuthOptions { + readonly agentPublicKey: PublicKey; + /** The nonce the API sent in `hello` for this connection. */ + readonly expectedNonce: string; + readonly now: number; + readonly maxSkewMs?: number; + /** Nonces already accepted; a repeated nonce is refused and a new one is recorded. */ + readonly usedNonces?: Set; +} +/** API side: checks an `auth` frame against the challenge that was issued. */ +export declare function verifyAgentAuth(frame: unknown, options: VerifyAgentAuthOptions): AuthFrame; +export type AgentRequestBody = Uint8Array | string | null | undefined; +export interface SignAgentRequestParams { + readonly agentKeyPair: SigningKeyPair; + readonly method: string; + /** Request path including the query string, exactly as sent on the wire. */ + readonly pathWithQuery: string; + readonly body?: AgentRequestBody; + readonly ts: number; +} +/** Returns the `X-Tegra-Agent`, `X-Tegra-Ts` and `X-Tegra-Sig` headers. */ +export declare function signAgentRequest(params: SignAgentRequestParams): Record; +export interface VerifyAgentRequestParams { + /** Case-insensitive header lookup (e.g. `(name) => request.headers.get(name)`). */ + readonly getHeader: (name: string) => string | null | undefined; + readonly method: string; + readonly pathWithQuery: string; + readonly body?: AgentRequestBody; + readonly agentPublicKey: PublicKey; + readonly now: number; + readonly maxSkewMs?: number; +} +export declare function verifyAgentRequest(params: VerifyAgentRequestParams): { + readonly agent: KeyId; +}; diff --git a/lib/types/protocol/agent-message.d.ts b/lib/types/protocol/agent-message.d.ts index 6e5e1dc..5b4cba0 100644 --- a/lib/types/protocol/agent-message.d.ts +++ b/lib/types/protocol/agent-message.d.ts @@ -1,3 +1,4 @@ +import { z } from "zod"; import { type PublicKey, type SigningKeyPair } from "../crypto"; import { type AgentMessage, type AgentMessageHeader } from "./schemas"; export interface SealAgentMessageParams { @@ -15,3 +16,20 @@ export interface OpenedAgentMessage { } export declare function sealAgentMessage(params: SealAgentMessageParams): AgentMessage; export declare function openAgentMessage(message: unknown, agentPublicKey: PublicKey, recipientKeyPair: SigningKeyPair): OpenedAgentMessage; +export interface AgentEventBody { + readonly in_reply_to?: string; + readonly data: unknown; +} +export declare const agentEventBodySchema: z.ZodObject<{ + in_reply_to: z.ZodOptional; + data: z.ZodUnknown; +}, z.core.$strip>; +/** Builds the decrypted body every agent event carries: `{ in_reply_to?, data }`. */ +export declare function wrapEventBody(inReplyTo: string | undefined, data: unknown): AgentEventBody; +export interface OpenedAgentEvent { + readonly header: AgentMessageHeader; + readonly inReplyTo: string | null; + readonly data: unknown; +} +/** Opens an agent message and unwraps the `{ in_reply_to?, data }` event body. */ +export declare function openAgentEvent(message: unknown, agentPublicKey: PublicKey, recipientKeyPair: SigningKeyPair): OpenedAgentEvent; diff --git a/lib/types/protocol/command.d.ts b/lib/types/protocol/command.d.ts index a45abbe..76f5c22 100644 --- a/lib/types/protocol/command.d.ts +++ b/lib/types/protocol/command.d.ts @@ -1,5 +1,6 @@ import { type PublicKey, type SigningKeyPair } from "../crypto"; import type { CommandRegistry } from "./registry"; +import { type Role } from "./roles"; import { type CommandHeader, type KeyId, type SessionCertificate, type SignedCommand } from "./schemas"; import type { TrustContext } from "./trust"; export declare const COMMAND_ID_BYTES = 16; @@ -16,6 +17,11 @@ export interface CreateSignedCommandParams { readonly now: number; readonly ttlMs?: number; readonly id?: string; + /** + * Ed25519 public key that the agent's replies and events are sealed to. + * Defaults to the account key. A session signer must use its own key. + */ + readonly replyTo?: PublicKey; } export interface OpenedCommand { readonly header: CommandHeader; @@ -23,6 +29,12 @@ export interface OpenedCommand { readonly signerType: "account" | "session"; readonly accountId: KeyId; readonly sessionId?: string; + /** `not_after` of the signing session certificate, when the signer is a session. */ + readonly sessionNotAfter?: number; + /** Key from the command's `reply_to`, when present. Replies go here instead of the account key. */ + readonly replyTo?: PublicKey; + /** Role of the signing account on the command's server (`"*"` for agent commands). */ + readonly role: Role; } export declare function createSignedCommand(params: CreateSignedCommandParams, registry: CommandRegistry): SignedCommand; export declare function openCommand(command: unknown, trust: TrustContext, registry: CommandRegistry): Promise; diff --git a/lib/types/protocol/commands/agent.d.ts b/lib/types/protocol/commands/agent.d.ts new file mode 100644 index 0000000..9e35a36 --- /dev/null +++ b/lib/types/protocol/commands/agent.d.ts @@ -0,0 +1,102 @@ +import { z } from "zod"; +import { type CommandRegistry } from "../registry"; +export declare const SUBSCRIPTION_TOPICS: readonly ["server.status"]; +export declare const subscriptionTopicSchema: z.ZodEnum<{ + "server.status": "server.status"; +}>; +export type SubscriptionTopic = z.infer; +export declare const SERVER_STATES: readonly ["stopped", "starting", "running", "stopping", "crashed"]; +export declare const serverStateSchema: z.ZodEnum<{ + crashed: "crashed"; + running: "running"; + starting: "starting"; + stopped: "stopped"; + stopping: "stopping"; +}>; +export type ServerState = z.infer; +export declare const serverStatusChangedSchema: z.ZodObject<{ + server_id: z.ZodString; + state: z.ZodEnum<{ + crashed: "crashed"; + running: "running"; + starting: "starting"; + stopped: "stopped"; + stopping: "stopping"; + }>; + at: z.ZodNumber; +}, z.core.$strip>; +export type ServerStatusChanged = z.infer; +export declare const agentSubscribeBodySchema: z.ZodObject<{ + topics: z.ZodArray>; +}, z.core.$strict>; +export type AgentSubscribeBody = z.infer; +export declare const agentMembersSetBodySchema: z.ZodObject<{ + grant: z.ZodObject<{ + v: z.ZodLiteral<1>; + kind: z.ZodLiteral<"server-role">; + account_key: z.ZodString; + agent: z.ZodString; + servers: z.ZodUnion, z.ZodArray]>; + role: z.ZodEnum<{ + admin: "admin"; + editor: "editor"; + operator: "operator"; + viewer: "viewer"; + }>; + issued_at: z.ZodNumber; + expires_at: z.ZodOptional; + sig: z.ZodString; + }, z.core.$strict>; +}, z.core.$strict>; +export type AgentMembersSetBody = z.infer; +export declare const agentMembersRevokeBodySchema: z.ZodObject<{ + account: z.ZodString; + servers: z.ZodOptional>; +}, z.core.$strict>; +export type AgentMembersRevokeBody = z.infer; +export declare const agentSubscribeCommand: import("..").CommandDefinition<"agent.subscribe", { + topics: "server.status"[]; +}>; +export declare const agentUnsubscribeCommand: import("..").CommandDefinition<"agent.unsubscribe", { + topics: "server.status"[]; +}>; +export declare const agentMembersSetCommand: import("..").CommandDefinition<"agent.members.set", { + grant: { + v: 1; + kind: "server-role"; + account_key: string; + agent: string; + servers: "*" | string[]; + role: "admin" | "editor" | "operator" | "viewer"; + issued_at: number; + expires_at?: number | undefined; + sig: string; + }; +}>; +export declare const agentMembersRevokeCommand: import("..").CommandDefinition<"agent.members.revoke", { + account: string; + servers?: string[] | undefined; +}>; +export declare const AGENT_COMMANDS: readonly [import("..").CommandDefinition<"agent.subscribe", { + topics: "server.status"[]; +}>, import("..").CommandDefinition<"agent.unsubscribe", { + topics: "server.status"[]; +}>, import("..").CommandDefinition<"agent.members.set", { + grant: { + v: 1; + kind: "server-role"; + account_key: string; + agent: string; + servers: "*" | string[]; + role: "admin" | "editor" | "operator" | "viewer"; + issued_at: number; + expires_at?: number | undefined; + sig: string; + }; +}>, import("..").CommandDefinition<"agent.members.revoke", { + account: string; + servers?: string[] | undefined; +}>]; +export declare function registerAgentCommands(registry: CommandRegistry): CommandRegistry; diff --git a/lib/types/protocol/domains.d.ts b/lib/types/protocol/domains.d.ts index f9e66aa..6940532 100644 --- a/lib/types/protocol/domains.d.ts +++ b/lib/types/protocol/domains.d.ts @@ -5,5 +5,8 @@ export declare const DOMAIN_AGENT_MESSAGE: Uint8Array; export declare const DOMAIN_REVOCATION: Uint8Array; export declare const DOMAIN_TRUST_GRANT: Uint8Array; export declare const DOMAIN_PAIRING_PROOF: Uint8Array; +export declare const DOMAIN_AGENT_AUTH: Uint8Array; +export declare const DOMAIN_AGENT_HTTP: Uint8Array; +export declare const DOMAIN_ROLE_GRANT: Uint8Array; export declare function concatBytes(...parts: readonly Uint8Array[]): Uint8Array; export declare function assertSupportedVersion(value: unknown): void; diff --git a/lib/types/protocol/errors.d.ts b/lib/types/protocol/errors.d.ts index ef24847..3f54b77 100644 --- a/lib/types/protocol/errors.d.ts +++ b/lib/types/protocol/errors.d.ts @@ -1,4 +1,4 @@ -export type ProtocolErrorCode = "invalid_format" | "unsupported_version" | "wrong_agent" | "wrong_recipient" | "expired" | "not_yet_valid" | "ttl_too_long" | "untrusted_signer" | "bad_signature" | "session_invalid" | "session_revoked" | "replayed" | "unknown_command" | "invalid_body" | "sensitive_requires_account_key" | "decrypt_failed" | "grant_invalid" | "grant_wrong_agent" | "grant_expired" | "grant_bad_signature" | "grant_proof_required" | "grant_bad_proof" | "revocation_stale" | "revocation_not_superset" | "insufficient_memory" | "eula_not_accepted" | "server_not_found" | "server_already_exists" | "server_running" | "server_stopped" | "invalid_jvm_args" | "download_failed" | "hash_mismatch" | "systemd_error" | "origin_locked" | "plan_not_found" | "plan_expired" | "plan_stale" | "mod_not_found" | "mod_already_exists" | "backup_not_found" | "backup_failed" | "backup_config_invalid" | "tunnel_not_configured" | "tunnel_already_running" | "tunnel_not_running" | "tunnel_failed"; +export type ProtocolErrorCode = "invalid_format" | "unsupported_version" | "wrong_agent" | "wrong_recipient" | "expired" | "not_yet_valid" | "ttl_too_long" | "untrusted_signer" | "bad_signature" | "session_invalid" | "session_revoked" | "replayed" | "unknown_command" | "invalid_body" | "sensitive_requires_account_key" | "decrypt_failed" | "insufficient_role" | "too_many_subscribers" | "role_grant_invalid" | "auth_invalid" | "request_invalid" | "grant_invalid" | "grant_wrong_agent" | "grant_expired" | "grant_bad_signature" | "grant_proof_required" | "grant_bad_proof" | "revocation_stale" | "revocation_not_superset" | "insufficient_memory" | "eula_not_accepted" | "server_not_found" | "server_already_exists" | "server_running" | "server_stopped" | "invalid_jvm_args" | "download_failed" | "hash_mismatch" | "systemd_error" | "origin_locked" | "plan_not_found" | "plan_expired" | "plan_stale" | "mod_not_found" | "mod_already_exists" | "backup_not_found" | "backup_failed" | "backup_config_invalid" | "tunnel_not_configured" | "tunnel_already_running" | "tunnel_not_running" | "tunnel_failed"; export declare class ProtocolError extends Error { readonly code: ProtocolErrorCode; constructor(code: ProtocolErrorCode, message: string); diff --git a/lib/types/protocol/index.d.ts b/lib/types/protocol/index.d.ts index 0d5fe71..d5f7f22 100644 --- a/lib/types/protocol/index.d.ts +++ b/lib/types/protocol/index.d.ts @@ -1,5 +1,7 @@ -export { type OpenedAgentMessage, openAgentMessage, type SealAgentMessageParams, sealAgentMessage, } from "./agent-message"; +export { AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_SIG, AGENT_HTTP_HEADER_TS, AGENT_HTTP_MAX_SKEW_MS, type AgentRequestBody, type AuthFrame, createHelloFrame, generateAgentNonce, type HelloFrame, type SignAgentRequestParams, signAgentAuth, signAgentRequest, type VerifyAgentAuthOptions, type VerifyAgentRequestParams, verifyAgentAuth, verifyAgentRequest, } from "./agent-auth"; +export { type AgentEventBody, agentEventBodySchema, type OpenedAgentEvent, type OpenedAgentMessage, openAgentEvent, openAgentMessage, type SealAgentMessageParams, sealAgentMessage, wrapEventBody, } from "./agent-message"; export { COMMAND_ID_BYTES, type CreateSignedCommandParams, createSignedCommand, DEFAULT_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, MAX_COMMAND_TTL_MS, type OpenedCommand, openCommand, } from "./command"; +export { AGENT_COMMANDS, type AgentMembersRevokeBody, type AgentMembersSetBody, type AgentSubscribeBody, agentMembersRevokeBodySchema, agentMembersRevokeCommand, agentMembersSetBodySchema, agentMembersSetCommand, agentSubscribeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, registerAgentCommands, SERVER_STATES, type ServerState, type ServerStatusChanged, SUBSCRIPTION_TOPICS, type SubscriptionTopic, serverStateSchema, serverStatusChangedSchema, subscriptionTopicSchema, } from "./commands/agent"; export { BACKUP_COMMANDS, BACKUP_ID_REGEX, type BackupDestinationKind, type BackupLocalConfig, type BackupS3ConfigInput, type BackupScheduleConfig, type BackupTegraCloudConfig, backupDestinationKindSchema, backupIdSchema, backupLocalConfigSchema, backupS3ConfigSchema, backupScheduleConfigSchema, backupTegraCloudConfigSchema, MAX_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_RETENTION_COUNT, MIN_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, registerBackupCommands, type ServerBackupConfigSetBody, type ServerBackupCreateBody, type ServerBackupDeleteBody, type ServerBackupListBody, type ServerBackupRestoreBody, s3BucketSchema, s3PrefixSchema, s3RegionSchema, serverBackupConfigSetBodySchema, serverBackupConfigSetCommand, serverBackupCreateBodySchema, serverBackupCreateCommand, serverBackupDeleteBodySchema, serverBackupDeleteCommand, serverBackupListBodySchema, serverBackupListCommand, serverBackupRestoreBodySchema, serverBackupRestoreCommand, } from "./commands/backup"; export { agentPingCommand, CORE_COMMANDS, createCoreRegistry, registerCoreCommands, serverDeleteCommand, serverStartCommand, serverStopCommand, } from "./commands/core"; export { FILES_COMMANDS, fileEncodingSchema, filesCopyCommand, filesDeleteCommand, filesDownloadBeginCommand, filesDownloadCloseCommand, filesDownloadCommand, filesDownloadPartCommand, filesListCommand, filesMkdirCommand, filesReadCommand, filesRenameCommand, filesStatCommand, filesUnzipCommand, filesUploadAbortCommand, filesUploadBeginCommand, filesUploadCommitCommand, filesUploadPartCommand, filesWriteCommand, filesZipCommand, registerFilesCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, sha256HexSchema, } from "./commands/files"; @@ -7,11 +9,12 @@ export { agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, export { consoleLineSchema, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MAX_JVM_ARGS, MAX_SERVER_MEMORY_MB, MIN_SERVER_MEMORY_MB, registerServerCommands, SERVER_COMMANDS, SERVER_ID_REGEX, type ServerConsoleSendBody, type ServerConsoleSubscribeBody, type ServerCreateBody, type ServerLoader, type ServerUpdateSettingsBody, serverConsoleSendBodySchema, serverConsoleSendCommand, serverConsoleSubscribeBodySchema, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, serverCreateBodySchema, serverCreateCommand, serverIdSchema, serverListCommand, serverLoaderSchema, serverMemoryMbSchema, serverPortSchema, serverRestartCommand, serverStatusCommand, serverUpdateSettingsBodySchema, serverUpdateSettingsCommand, } from "./commands/server"; export { type ModEnvironmentInfo, type ModLayer, type ModSource, modEnvironmentInfoSchema, modFileNameSchema, modLayerSchema, modSourceSchema, type OriginPlanFileInput, type OriginPlanModInput, originPlanFileInputSchema, originPlanModInputSchema, registerStateCommands, type ServerDeployServerpackBody, type ServerModEntry, type ServerModsInstallBody, type ServerModsListBody, type ServerModsRemoveBody, type ServerOrigin, type ServerOriginApplyBody, type ServerOriginPlanBody, type ServerOriginSyncState, type ServerOriginUnlinkBody, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, STATE_COMMANDS, serverDeployServerpackBodySchema, serverDeployServerpackCommand, serverModEntrySchema, serverModsInstallBodySchema, serverModsInstallCommand, serverModsListBodySchema, serverModsListCommand, serverModsRemoveBodySchema, serverModsRemoveCommand, serverOriginApplyBodySchema, serverOriginApplyCommand, serverOriginPlanBodySchema, serverOriginPlanCommand, serverOriginSchema, serverOriginSyncStateSchema, serverOriginUnlinkBodySchema, serverOriginUnlinkCommand, sha1HexSchema, sha512HexSchema, } from "./commands/state"; export { PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, registerTunnelCommands, TUNNEL_COMMANDS, type TunnelPlayitSetKeyBody, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStatusCommand, tunnelPlayitStopCommand, } from "./commands/tunnel"; -export { DOMAIN_AGENT_MESSAGE, DOMAIN_COMMAND, DOMAIN_PAIRING_PROOF, DOMAIN_REVOCATION, DOMAIN_SESSION, DOMAIN_TRUST_GRANT, PROTOCOL_VERSION, } from "./domains"; +export { DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_AGENT_MESSAGE, DOMAIN_COMMAND, DOMAIN_PAIRING_PROOF, DOMAIN_REVOCATION, DOMAIN_ROLE_GRANT, DOMAIN_SESSION, DOMAIN_TRUST_GRANT, PROTOCOL_VERSION, } from "./domains"; export { ProtocolError, type ProtocolErrorCode } from "./errors"; export { type BuildPairingFragmentParams, buildPairingFragment, DEFAULT_TRUST_GRANT_TTL_MS, generatePairingCode, generatePairingSecret, MAX_TRUST_GRANT_TTL_MS, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, type PairingFragment, pairingCodeSchema, parsePairingFragment, type SignTrustGrantParams, signTrustGrant, type TrustGrant, trustGrantSchema, type VerifiedTrustGrant, type VerifyTrustGrantOptions, verifyTrustGrant, } from "./pairing"; export { type CommandDefinition, CommandRegistry, defineCommand } from "./registry"; export { type SignRevocationListParams, signRevocationList, verifyRevocationList, } from "./revocation"; -export { type AgentMessage, type AgentMessageHeader, agentMessageHeaderSchema, agentMessageSchema, base64UrlSchema, type CommandHeader, commandHeaderSchema, type KeyId, keyIdSchema, type RevocationList, revocationListSchema, type SessionCertificate, type SignedCommand, sessionCertificateSchema, signedCommandSchema, type TransportFrame, transportAckFrameSchema, transportCommandFrameSchema, transportEventFrameSchema, transportFrameSchema, transportPingFrameSchema, } from "./schemas"; +export { ALL_SERVERS, GRANTABLE_ROLES, type GrantableRole, grantableRoleSchema, MAX_GRANT_CLOCK_SKEW_MS, MAX_GRANT_SERVERS, MAX_MEMBERS, type MemberEntry, maxRole, memberEntrySchema, ROLE_LEVEL, ROLES, type Role, type RoleGrant, RoleTable, roleAtLeast, roleGrantSchema, roleSchema, type SignRoleGrantParams, signRoleGrant, type VerifiedRoleGrant, type VerifyRoleGrantOptions, verifyRoleGrant, } from "./roles"; +export { AGENT_NONCE_BYTES, type AgentMessage, type AgentMessageHeader, agentMessageHeaderSchema, agentMessageSchema, agentNonceSchema, base64UrlSchema, type CommandHeader, commandHeaderSchema, type KeyId, keyIdSchema, type RevocationList, revocationListSchema, type SessionCertificate, type SignedCommand, sessionCertificateSchema, signedCommandSchema, type TransportFrame, transportAckFrameSchema, transportAuthFrameSchema, transportCommandFrameSchema, transportEventFrameSchema, transportFrameSchema, transportHelloFrameSchema, transportPingFrameSchema, } from "./schemas"; export { type SignSessionCertificateParams, signSessionCertificate, type VerifiedSessionCertificate, verifySessionCertificate, } from "./session"; -export { createInMemoryTrustContext, type InMemoryTrustContext, type InMemoryTrustContextOptions, type TrustContext, } from "./trust"; +export { createInMemoryTrustContext, type InMemoryTrustContext, type InMemoryTrustContextOptions, type MemberStore, type TrustContext, } from "./trust"; diff --git a/lib/types/protocol/registry.d.ts b/lib/types/protocol/registry.d.ts index 3d67991..3e56958 100644 --- a/lib/types/protocol/registry.d.ts +++ b/lib/types/protocol/registry.d.ts @@ -1,12 +1,15 @@ import type { z } from "zod"; +import type { Role } from "./roles"; export interface CommandDefinition { readonly type: TType; readonly sensitive: boolean; + readonly minRole: Role; readonly body: z.ZodType; } export declare function defineCommand(definition: { readonly type: TType; readonly sensitive: boolean; + readonly minRole: Role; readonly body: z.ZodType; }): CommandDefinition; export declare class CommandRegistry { diff --git a/lib/types/protocol/roles.d.ts b/lib/types/protocol/roles.d.ts new file mode 100644 index 0000000..01d763d --- /dev/null +++ b/lib/types/protocol/roles.d.ts @@ -0,0 +1,106 @@ +import { z } from "zod"; +import { type PublicKey, type SigningKeyPair } from "../crypto"; +import { type KeyId } from "./schemas"; +export declare const ROLES: readonly ["viewer", "operator", "editor", "admin", "owner"]; +export type Role = (typeof ROLES)[number]; +export declare const roleSchema: z.ZodEnum<{ + admin: "admin"; + editor: "editor"; + operator: "operator"; + owner: "owner"; + viewer: "viewer"; +}>; +export declare const GRANTABLE_ROLES: readonly ["viewer", "operator", "editor", "admin"]; +export type GrantableRole = (typeof GRANTABLE_ROLES)[number]; +export declare const grantableRoleSchema: z.ZodEnum<{ + admin: "admin"; + editor: "editor"; + operator: "operator"; + viewer: "viewer"; +}>; +export declare const ROLE_LEVEL: Readonly>; +export declare function roleAtLeast(role: Role | null | undefined, minimum: Role): boolean; +export declare function maxRole(a: T | null, b: T | null): T | null; +export declare const ALL_SERVERS: "*"; +export declare const MAX_GRANT_SERVERS = 256; +export declare const MAX_MEMBERS = 64; +export declare const roleGrantSchema: z.ZodObject<{ + v: z.ZodLiteral<1>; + kind: z.ZodLiteral<"server-role">; + account_key: z.ZodString; + agent: z.ZodString; + servers: z.ZodUnion, z.ZodArray]>; + role: z.ZodEnum<{ + admin: "admin"; + editor: "editor"; + operator: "operator"; + viewer: "viewer"; + }>; + issued_at: z.ZodNumber; + expires_at: z.ZodOptional; + sig: z.ZodString; +}, z.core.$strict>; +export type RoleGrant = z.infer; +export declare const MAX_GRANT_CLOCK_SKEW_MS: number; +export interface SignRoleGrantParams { + readonly granter: SigningKeyPair; + readonly accountPublicKey: PublicKey; + readonly agent: KeyId; + readonly servers: readonly string[] | typeof ALL_SERVERS; + readonly role: GrantableRole; + readonly issuedAt: number; + readonly expiresAt?: number; +} +export declare function signRoleGrant(params: SignRoleGrantParams): RoleGrant; +export interface VerifyRoleGrantOptions { + readonly agent: KeyId; + readonly now: number; +} +export interface VerifiedRoleGrant { + readonly grant: RoleGrant; + readonly accountPublicKey: PublicKey; + readonly accountId: KeyId; +} +export declare function verifyRoleGrant(grant: unknown, granterPublicKey: PublicKey, options: VerifyRoleGrantOptions): VerifiedRoleGrant; +/** A role grant that an agent has accepted, as kept in its member table. */ +export declare const memberEntrySchema: z.ZodObject<{ + account_key: z.ZodString; + account: z.ZodString; + granted_by: z.ZodString; + role: z.ZodEnum<{ + admin: "admin"; + editor: "editor"; + operator: "operator"; + viewer: "viewer"; + }>; + servers: z.ZodUnion, z.ZodArray]>; + issued_at: z.ZodNumber; + expires_at: z.ZodOptional; +}, z.core.$strict>; +export type MemberEntry = z.infer; +/** + * Member-table logic shared by the in-memory and the file-backed trust + * contexts. Owners are not members: they come from the trust list. + */ +export declare class RoleTable { + #private; + constructor(entries?: readonly MemberEntry[]); + entries(): readonly MemberEntry[]; + accountCount(): number; + keyFor(account: KeyId, now: number): PublicKey | null; + /** + * Role of `account` on `serverId`. Agent-level scope (`"*"`) resolves to the + * highest role granted on all servers; an account that only has per-server + * grants gets `viewer` there, which allows agent-level reads (what they + * return is filtered per server). + */ + roleFor(account: KeyId, serverId: string, now: number): GrantableRole | null; + set(entry: MemberEntry): void; + /** + * Removes grants of `account`. Without `servers`, all of them. With + * `servers`, those ids are removed from per-server grants; a grant that + * covers all servers is only removed by a revoke without `servers`. + * Returns how many grants were changed or removed. + */ + revoke(account: KeyId, servers?: readonly string[]): number; +} diff --git a/lib/types/protocol/schemas.d.ts b/lib/types/protocol/schemas.d.ts index 8aeddb0..564e22e 100644 --- a/lib/types/protocol/schemas.d.ts +++ b/lib/types/protocol/schemas.d.ts @@ -21,6 +21,7 @@ export declare const commandHeaderSchema: z.ZodObject<{ issued_at: z.ZodNumber; expires_at: z.ZodNumber; counter: z.ZodNumber; + reply_to: z.ZodOptional; }, z.core.$strip>; export type CommandHeader = z.infer; export declare const signedCommandSchema: z.ZodObject<{ @@ -33,6 +34,7 @@ export declare const signedCommandSchema: z.ZodObject<{ issued_at: z.ZodNumber; expires_at: z.ZodNumber; counter: z.ZodNumber; + reply_to: z.ZodOptional; }, z.core.$strip>; payload: z.ZodString; session: z.ZodOptional; }, z.core.$strip>; payload: z.ZodString; session: z.ZodOptional; }, z.core.$strip>; +export declare const AGENT_NONCE_BYTES = 32; +export declare const agentNonceSchema: z.ZodString; +export declare const transportHelloFrameSchema: z.ZodObject<{ + v: z.ZodLiteral<1>; + kind: z.ZodLiteral<"hello">; + route: z.ZodObject<{ + agent: z.ZodString; + }, z.core.$strip>; + body: z.ZodObject<{ + nonce: z.ZodString; + server_time: z.ZodNumber; + }, z.core.$strip>; +}, z.core.$strip>; +export declare const transportAuthFrameSchema: z.ZodObject<{ + v: z.ZodLiteral<1>; + kind: z.ZodLiteral<"auth">; + route: z.ZodObject<{ + agent: z.ZodString; + }, z.core.$strip>; + body: z.ZodObject<{ + nonce: z.ZodString; + ts: z.ZodNumber; + sig: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>; export declare const transportFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ + v: z.ZodLiteral<1>; + kind: z.ZodLiteral<"hello">; + route: z.ZodObject<{ + agent: z.ZodString; + }, z.core.$strip>; + body: z.ZodObject<{ + nonce: z.ZodString; + server_time: z.ZodNumber; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + v: z.ZodLiteral<1>; + kind: z.ZodLiteral<"auth">; + route: z.ZodObject<{ + agent: z.ZodString; + }, z.core.$strip>; + body: z.ZodObject<{ + nonce: z.ZodString; + ts: z.ZodNumber; + sig: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ v: z.ZodLiteral<1>; kind: z.ZodLiteral<"command">; route: z.ZodObject<{ @@ -168,6 +217,7 @@ export declare const transportFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject< issued_at: z.ZodNumber; expires_at: z.ZodNumber; counter: z.ZodNumber; + reply_to: z.ZodOptional; }, z.core.$strip>; payload: z.ZodString; session: z.ZodOptional; + readonly members?: readonly MemberEntry[]; readonly now?: () => number; } -export interface InMemoryTrustContext extends TrustContext { +export interface MemberStore { + listMembers(): readonly MemberEntry[]; + setMember(entry: MemberEntry): void; + revokeMembers(account: KeyId, servers?: readonly string[]): number; +} +export interface InMemoryTrustContext extends TrustContext, MemberStore { revokeSession(certificateId: string): void; setNow(clock: () => number): void; } diff --git a/lib/vault/index.js b/lib/vault/index.js index 54bbb90..70bc547 100644 --- a/lib/vault/index.js +++ b/lib/vault/index.js @@ -5,7 +5,7 @@ import { sessionCertificateSchema, signRevocationList, signSessionCertificate -} from "../chunks/index-ztead7tp.js"; +} from "../chunks/index-8taagmjn.js"; import { KDF_ALG_ARGON2ID13, KDF_MODERATE, @@ -26,7 +26,7 @@ import { randomBytes, signingKeyPairFromSeed, toBase64Url -} from "../chunks/index-kcrag88y.js"; +} from "../chunks/index-7kn9bty2.js"; // src/vault/blob.ts import { z } from "zod"; diff --git a/src/agent/api-client.ts b/src/agent/api-client.ts new file mode 100644 index 0000000..04cad08 --- /dev/null +++ b/src/agent/api-client.ts @@ -0,0 +1,255 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; +import type { SigningKeyPair } from "../crypto"; +import { signAgentRequest } from "../protocol"; +import { validateApiUrl } from "./state"; + +export const AGENT_API_TIMEOUT_MS = 10_000; +export const AGENT_API_MAX_RESPONSE_BYTES = 64 * 1024; +/** Path prefix of the control API, appended to the configured `api_url`. */ +export const AGENT_API_PREFIX = "/v1"; + +export type FetchLike = (input: string | URL, init?: RequestInit) => Promise; + +export type AgentApiErrorCode = + | "network_error" + | "http_error" + | "quota_exceeded" + | "rate_limited" + | "response_too_large" + | "invalid_response" + | "aborted"; + +export class AgentApiError extends Error { + readonly code: AgentApiErrorCode; + readonly status: number | undefined; + + constructor(code: AgentApiErrorCode, message: string, status?: number) { + super(message); + this.name = "AgentApiError"; + this.code = code; + this.status = status; + } +} + +export interface SignedRequestOptions { + readonly agentKeyPair: SigningKeyPair; + readonly now: () => number; +} + +/** + * Headers that authenticate one request as coming from this agent. The + * signature covers the method, the path with query, the body and a timestamp, + * so the exact URL that is sent must be the one passed here. + */ +export function signedRequestHeaders( + options: SignedRequestOptions, + method: string, + url: string, + body: string | undefined, +): Record { + const parsed = new URL(url); + return signAgentRequest({ + agentKeyPair: options.agentKeyPair, + method, + pathWithQuery: `${parsed.pathname}${parsed.search}`, + ...(body !== undefined ? { body } : {}), + ts: options.now(), + }); +} + +export function buildApiUrl(baseApiUrl: string, pathSuffix: string): string { + const url = new URL(baseApiUrl); + const basePath = url.pathname.replace(/\/+$/, ""); + url.pathname = `${basePath}${AGENT_API_PREFIX}${pathSuffix}`; + url.search = ""; + url.hash = ""; + return url.toString(); +} + +export interface BackupUploadTarget { + readonly put_url: string; + readonly headers: Readonly>; + readonly expires_at: number; + readonly max_bytes: number; +} + +export interface BackupUploadUrlRequest { + readonly server_id: string; + readonly size_bytes: number; +} + +export interface AgentApiClient { + /** `POST /v1/agents/self/backup-upload-url`: where to `PUT` a backup of `size_bytes`. */ + requestBackupUploadUrl( + request: BackupUploadUrlRequest, + signal?: AbortSignal, + ): Promise; +} + +export interface AgentApiClientOptions { + readonly apiUrl: string; + readonly agentKeyPair: SigningKeyPair; + readonly allowInsecure?: boolean; + readonly fetch?: FetchLike; + readonly now?: () => number; + readonly timeoutMs?: number; + readonly maxResponseBytes?: number; +} + +const backupUploadTargetSchema = z.object({ + put_url: z.string().min(1).max(4096), + headers: z.record(z.string(), z.string()).default({}), + expires_at: z.number().int().nonnegative(), + max_bytes: z.number().int().positive(), +}); + +async function readBoundedText(response: Response, maxBytes: number): Promise { + const declared = Number(response.headers.get("content-length")); + if (Number.isFinite(declared) && declared > maxBytes) { + void response.body?.cancel().catch(() => {}); + throw new AgentApiError("response_too_large", "API response exceeds size limit"); + } + + if (response.body === null) { + const text = await response.text(); + if (new TextEncoder().encode(text).byteLength > maxBytes) { + throw new AgentApiError("response_too_large", "API response exceeds size limit"); + } + return text; + } + + const reader = response.body.getReader(); + const chunks: Uint8Array[] = []; + let total = 0; + try { + while (true) { + const { done, value } = await reader.read(); + if (done) { + break; + } + if (value !== undefined) { + total += value.byteLength; + if (total > maxBytes) { + await reader.cancel(); + throw new AgentApiError("response_too_large", "API response exceeds size limit"); + } + chunks.push(value); + } + } + } finally { + reader.releaseLock(); + } + + const combined = new Uint8Array(total); + let offset = 0; + for (const chunk of chunks) { + combined.set(chunk, offset); + offset += chunk.byteLength; + } + return new TextDecoder("utf-8", { fatal: true }).decode(combined); +} + +export function createAgentApiClient(options: AgentApiClientOptions): AgentApiClient { + const validatedUrl = validateApiUrl(options.apiUrl, options.allowInsecure ?? false); + const fetchFn: FetchLike = options.fetch ?? ((input, init) => fetch(input, init)); + const now = options.now ?? (() => Date.now()); + const timeoutMs = options.timeoutMs ?? AGENT_API_TIMEOUT_MS; + const maxResponseBytes = options.maxResponseBytes ?? AGENT_API_MAX_RESPONSE_BYTES; + + async function signedJson( + method: string, + pathSuffix: string, + payload: unknown, + externalSignal?: AbortSignal, + ): Promise { + if (externalSignal?.aborted) { + throw new AgentApiError("aborted", "API request aborted"); + } + const url = buildApiUrl(validatedUrl, pathSuffix); + const body = JSON.stringify(payload); + const headers = { + "content-type": "application/json", + accept: "application/json", + ...signedRequestHeaders({ agentKeyPair: options.agentKeyPair, now }, method, url, body), + }; + + const controller = new AbortController(); + let timedOut = false; + const onAbort = (): void => controller.abort(); + externalSignal?.addEventListener("abort", onAbort, { once: true }); + const timer = setTimeout(() => { + timedOut = true; + controller.abort(); + }, timeoutMs); + + try { + return await fetchFn(url, { + method, + headers, + body, + redirect: "error", + signal: controller.signal, + }); + } catch { + if (externalSignal?.aborted) { + throw new AgentApiError("aborted", "API request aborted"); + } + throw new AgentApiError( + "network_error", + timedOut ? "API request timed out" : "API network request failed", + ); + } finally { + clearTimeout(timer); + externalSignal?.removeEventListener("abort", onAbort); + } + } + + return { + async requestBackupUploadUrl( + request: BackupUploadUrlRequest, + signal?: AbortSignal, + ): Promise { + const response = await signedJson( + "POST", + "/agents/self/backup-upload-url", + { server_id: request.server_id, size_bytes: request.size_bytes }, + signal, + ); + + if (response.status === 413) { + void response.body?.cancel().catch(() => {}); + throw new AgentApiError("quota_exceeded", "Backup storage quota exceeded", 413); + } + if (response.status === 429) { + void response.body?.cancel().catch(() => {}); + throw new AgentApiError("rate_limited", "Backup upload URL request was rate limited", 429); + } + if (response.status !== 200 && response.status !== 201) { + void response.body?.cancel().catch(() => {}); + throw new AgentApiError( + "http_error", + `Backup upload URL request failed with HTTP ${response.status}`, + response.status, + ); + } + + let raw: unknown; + try { + raw = JSON.parse(await readBoundedText(response, maxResponseBytes)) as unknown; + } catch (err) { + if (err instanceof AgentApiError) { + throw err; + } + throw new AgentApiError("invalid_response", "API returned invalid JSON"); + } + const parsed = backupUploadTargetSchema.safeParse(raw); + if (!parsed.success) { + throw new AgentApiError("invalid_response", "API returned a malformed upload target"); + } + return parsed.data; + }, + }; +} diff --git a/src/agent/connection.test.ts b/src/agent/connection.test.ts index f0e8927..6e5d64d 100644 --- a/src/agent/connection.test.ts +++ b/src/agent/connection.test.ts @@ -179,10 +179,10 @@ async function flushMicrotasks(): Promise { describe("connection", () => { test("buildConnectUrl converts https/http to wss/ws with agent query param", () => { expect(buildConnectUrl("https://api.tegra.example", AGENT_ID)).toBe( - `wss://api.tegra.example/agents/connect?agent=${AGENT_ID}`, + `wss://api.tegra.example/v1/agents/connect?agent=${AGENT_ID}`, ); - expect(buildConnectUrl("http://127.0.0.1:8080/v1/", AGENT_ID)).toBe( - `ws://127.0.0.1:8080/v1/agents/connect?agent=${AGENT_ID}`, + expect(buildConnectUrl("http://127.0.0.1:8080/base/", AGENT_ID)).toBe( + `ws://127.0.0.1:8080/base/v1/agents/connect?agent=${AGENT_ID}`, ); }); diff --git a/src/agent/connection.ts b/src/agent/connection.ts index 2a84d67..d562a77 100644 --- a/src/agent/connection.ts +++ b/src/agent/connection.ts @@ -2,6 +2,7 @@ // Copyright (C) 2026 Antônio Miranda import { + type HelloFrame, type KeyId, PROTOCOL_VERSION, type TransportFrame, @@ -9,7 +10,7 @@ import { } from "../protocol"; import type { Logger } from "./logger"; -export const AGENT_CONNECT_PATH = "/agents/connect"; +export const AGENT_CONNECT_PATH = "/v1/agents/connect"; export const MAX_INBOUND_MESSAGE_BYTES = 1024 * 1024; export const MAX_OUTBOUND_QUEUE = 256; export const INITIAL_BACKOFF_MS = 1_000; @@ -17,6 +18,7 @@ export const MAX_BACKOFF_MS = 60_000; export const STABLE_CONNECTION_MS = 30_000; export const HEARTBEAT_INTERVAL_MS = 25_000; export const IDLE_TIMEOUT_MS = 75_000; +export const HELLO_TIMEOUT_MS = 10_000; export const WS_READY_STATE_CONNECTING = 0; export const WS_READY_STATE_OPEN = 1; @@ -126,6 +128,14 @@ export interface AgentConnectionOptions { readonly logger: Logger; readonly onFrame: (frame: TransportFrame) => void; readonly authenticate?: (socket: WebSocketLike) => void | Promise; + /** + * Answers the control server's `hello` challenge with a signed `auth` frame. + * When set, the connection only counts as authenticated (and only flushes + * queued frames) after the `auth` frame was sent; without a `hello` within + * `helloTimeoutMs` it reconnects. + */ + readonly answerHello?: (hello: HelloFrame) => TransportFrame | Promise; + readonly helloTimeoutMs?: number; readonly webSocketFactory?: WebSocketFactory; readonly timers?: TimerProvider; readonly random?: () => number; @@ -157,19 +167,26 @@ export function createAgentConnection(options: AgentConnectionOptions): AgentCon const idleTimeoutMs = options.idleTimeoutMs ?? IDLE_TIMEOUT_MS; const stableConnectionMs = options.stableConnectionMs ?? STABLE_CONNECTION_MS; const authenticate = options.authenticate ?? (() => {}); + const helloTimeoutMs = options.helloTimeoutMs ?? HELLO_TIMEOUT_MS; const outboundQueue: string[] = []; let running = false; let socket: WebSocketLike | null = null; let authenticated = false; + let awaitingHello = false; let reconnectAttempt = 0; let reconnectTimer: TimerHandle | null = null; let stableTimer: TimerHandle | null = null; let heartbeatTimer: TimerHandle | null = null; let idleTimer: TimerHandle | null = null; + let helloTimer: TimerHandle | null = null; function clearConnectionTimers(): void { + if (helloTimer !== null) { + timers.clearTimeout(helloTimer); + helloTimer = null; + } if (stableTimer !== null) { timers.clearTimeout(stableTimer); stableTimer = null; @@ -254,6 +271,7 @@ export function createAgentConnection(options: AgentConnectionOptions): AgentCon } socket = null; authenticated = false; + awaitingHello = false; clearConnectionTimers(); activeSocket.onopen = null; activeSocket.onmessage = null; @@ -306,6 +324,23 @@ export function createAgentConnection(options: AgentConnectionOptions): AgentCon resetIdleTimer(activeSocket); + if (parsed.data.kind === "hello") { + if (awaitingHello && options.answerHello !== undefined) { + void answerHello(activeSocket, parsed.data); + } else { + options.logger.warn("Discarding unexpected hello frame"); + } + return; + } + if (parsed.data.kind === "auth") { + options.logger.warn("Discarding unexpected auth frame"); + return; + } + if (awaitingHello) { + options.logger.warn("Discarding frame received before authentication"); + return; + } + try { options.onFrame(parsed.data); } catch (err) { @@ -315,6 +350,64 @@ export function createAgentConnection(options: AgentConnectionOptions): AgentCon } } + function markAuthenticated(ws: WebSocketLike): void { + awaitingHello = false; + authenticated = true; + options.logger.info("Connected to control server"); + + stableTimer = timers.setTimeout(() => { + if (running && socket === ws) { + reconnectAttempt = 0; + } + }, stableConnectionMs); + + resetIdleTimer(ws); + + heartbeatTimer = timers.setInterval(() => { + if (!running || socket !== ws || ws.readyState !== WS_READY_STATE_OPEN) { + return; + } + const pingFrame: TransportFrame = { + v: PROTOCOL_VERSION, + kind: "ping", + route: { agent: options.agentId }, + body: { ts: timers.now() }, + }; + try { + ws.send(JSON.stringify(pingFrame)); + } catch { + detachAndReconnect(ws, 1011, "ping_failed"); + } + }, heartbeatIntervalMs); + + flushQueue(ws); + } + + async function answerHello(ws: WebSocketLike, hello: HelloFrame): Promise { + if (options.answerHello === undefined) { + return; + } + awaitingHello = false; + if (helloTimer !== null) { + timers.clearTimeout(helloTimer); + helloTimer = null; + } + try { + const authFrame = await options.answerHello(hello); + if (!running || socket !== ws || ws.readyState !== WS_READY_STATE_OPEN) { + return; + } + ws.send(JSON.stringify(transportFrameSchema.parse(authFrame))); + } catch (err) { + options.logger.warn("Failed to answer hello challenge", { + errName: err instanceof Error ? err.name : "Error", + }); + detachAndReconnect(ws, 4001, "auth_failed"); + return; + } + markAuthenticated(ws); + } + function connect(): void { if (!running) { return; @@ -339,6 +432,16 @@ export function createAgentConnection(options: AgentConnectionOptions): AgentCon if (!running || socket !== ws) { return; } + if (options.answerHello !== undefined) { + awaitingHello = true; + resetIdleTimer(ws); + helloTimer = timers.setTimeout(() => { + if (running && socket === ws && awaitingHello) { + options.logger.warn("Control server did not send a hello challenge in time"); + detachAndReconnect(ws, 4002, "hello_timeout"); + } + }, helloTimeoutMs); + } void (async () => { try { await authenticate(ws); @@ -354,35 +457,9 @@ export function createAgentConnection(options: AgentConnectionOptions): AgentCon return; } - authenticated = true; - options.logger.info("Connected to control server"); - - stableTimer = timers.setTimeout(() => { - if (running && socket === ws) { - reconnectAttempt = 0; - } - }, stableConnectionMs); - - resetIdleTimer(ws); - - heartbeatTimer = timers.setInterval(() => { - if (!running || socket !== ws || ws.readyState !== WS_READY_STATE_OPEN) { - return; - } - const pingFrame: TransportFrame = { - v: PROTOCOL_VERSION, - kind: "ping", - route: { agent: options.agentId }, - body: { ts: timers.now() }, - }; - try { - ws.send(JSON.stringify(pingFrame)); - } catch { - detachAndReconnect(ws, 1011, "ping_failed"); - } - }, heartbeatIntervalMs); - - flushQueue(ws); + if (options.answerHello === undefined) { + markAuthenticated(ws); + } })(); }; diff --git a/src/agent/index.ts b/src/agent/index.ts index 166876f..df22691 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -1,6 +1,20 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda +export { + AGENT_API_MAX_RESPONSE_BYTES, + AGENT_API_PREFIX, + AGENT_API_TIMEOUT_MS, + type AgentApiClient, + type AgentApiClientOptions, + AgentApiError, + type AgentApiErrorCode, + type BackupUploadTarget, + type BackupUploadUrlRequest, + buildApiUrl, + createAgentApiClient, + signedRequestHeaders, +} from "./api-client"; export { AGENT_CONNECT_PATH, type AgentConnection, @@ -11,6 +25,7 @@ export { createDefaultWebSocket, defaultTimers, HEARTBEAT_INTERVAL_MS, + HELLO_TIMEOUT_MS, IDLE_TIMEOUT_MS, INITIAL_BACKOFF_MS, MAX_BACKOFF_MS, @@ -36,12 +51,15 @@ export { runFixed, } from "./exec"; export { + ACCOUNT_SUBSCRIPTION_TTL_MS, type CommandHandler, type CommandHandlerContext, type CommandQueue, type CommandQueueOptions, createCommandQueue, DEFAULT_MAX_IDEMPOTENCY_ENTRIES, + MAX_SUBSCRIBERS, + type PublishScope, type TransportAckFrame, type TransportCommandFrame, type TransportEventFrame, @@ -57,6 +75,7 @@ export { redactValue, resolveLogLevel, } from "./logger"; +export { applyMembersRevoke, applyMembersSet, type MembersContext } from "./members"; export { DEFAULT_LINK_URL, DEFAULT_PAIRING_TIMEOUT_MS, @@ -98,6 +117,7 @@ export { type LoadConfigOptions, loadConfig, loadIdentityIfExists, + loadMembers, loadOrCreateIdentity, loadRevocations, loadTrust, @@ -106,6 +126,7 @@ export { type RevocationsState, resetTrustState, StateError, + saveMembers, validateApiUrl, validateCdnHost, validateLinkUrl, diff --git a/src/agent/jobs.test.ts b/src/agent/jobs.test.ts index bf43cd0..36dcf15 100644 --- a/src/agent/jobs.test.ts +++ b/src/agent/jobs.test.ts @@ -7,13 +7,13 @@ import { createCoreRegistry, createInMemoryTrustContext, createSignedCommand, - openAgentMessage, PROTOCOL_VERSION, type SignedCommand, type TransportFrame, } from "../protocol"; import { createCommandQueue, type TransportCommandFrame } from "./jobs"; import { createLogger } from "./logger"; +import { openTestEvent } from "./test-events"; beforeAll(async () => { await ready(); @@ -77,7 +77,7 @@ describe("command queue", () => { expect(eventFrame?.kind).toBe("event"); if (eventFrame?.kind === "event") { - const opened = openAgentMessage(eventFrame.body, agent.publicKey, account); + const opened = openTestEvent(eventFrame.body, agent.publicKey, account); expect(opened.header.type).toBe("agent.pong"); expect(opened.header.seq).toBe(1); expect(opened.body).toEqual({ at: now }); @@ -107,7 +107,7 @@ describe("command queue", () => { const eventFrame2 = sent[2]; expect(eventFrame2?.kind).toBe("event"); if (eventFrame2?.kind === "event") { - const opened2 = openAgentMessage(eventFrame2.body, agent.publicKey, account); + const opened2 = openTestEvent(eventFrame2.body, agent.publicKey, account); expect(opened2.header.seq).toBe(2); expect(opened2.body).toEqual({ at: now }); } diff --git a/src/agent/jobs.ts b/src/agent/jobs.ts index 6576ac4..2e0f70e 100644 --- a/src/agent/jobs.ts +++ b/src/agent/jobs.ts @@ -1,30 +1,49 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import { fingerprint } from "../crypto"; +import { fingerprint, type PublicKey } from "../crypto"; import { + type AgentMembersRevokeBody, + type AgentMembersSetBody, + type AgentSubscribeBody, type CommandRegistry, type KeyId, + type MemberStore, type OpenedCommand, openCommand, PROTOCOL_VERSION, ProtocolError, type RevocationList, + type Role, + roleAtLeast, + type SubscriptionTopic, sealAgentMessage, type TransportFrame, type TrustContext, + wrapEventBody, } from "../protocol"; import type { Logger } from "./logger"; +import { applyMembersRevoke, applyMembersSet } from "./members"; export const DEFAULT_MAX_IDEMPOTENCY_ENTRIES = 4096; +export const MAX_SUBSCRIBERS = 16; +/** Subscription lifetime when the signer is an account key (no certificate to bound it). */ +export const ACCOUNT_SUBSCRIPTION_TTL_MS = 24 * 60 * 60 * 1000; export type TransportCommandFrame = Extract; export type TransportAckFrame = Extract; export type TransportEventFrame = Extract; export interface CommandHandlerContext { - sendEvent(type: string, body: unknown): void; + /** + * Sends an event for this command. The decrypted body is + * `{ in_reply_to: , data }`, sealed to the command's `reply_to` + * key (or the account key when absent). + */ + sendEvent(type: string, data: unknown): void; now(): number; + /** Role of the command's account on a server, or null without access. */ + roleFor(serverId: string): Role | null; readonly logger: Logger; } @@ -41,12 +60,32 @@ export interface CommandQueueOptions { readonly maxIdempotencyEntries?: number; } +export interface PublishScope { + readonly serverId?: string; +} + export interface CommandQueue { registerHandler(type: string, handler: CommandHandler): void; + /** + * Sends an event to every live subscriber of `topic` whose account may see + * the scope (viewer or better on `scope.serverId`). + */ + publish(topic: SubscriptionTopic, type: string, data: unknown, scope?: PublishScope): void; + subscriberCount(): number; enqueue(frame: TransportCommandFrame): Promise; drain(timeoutMs: number): Promise; } +interface Subscriber { + readonly key: PublicKey; + readonly keyId: KeyId; + readonly account: KeyId; + readonly sessionId: string | undefined; + readonly notAfter: number; + inReplyTo: string; + readonly topics: Set; +} + interface CompletedAckEntry { readonly sig: string; readonly ack: TransportAckFrame; @@ -59,6 +98,7 @@ export function createCommandQueue(options: CommandQueueOptions): CommandQueue { const handlers = new Map(); const completedAcks = new Map(); + const subscribers = new Map(); let nextEventSeq = 1; let tail: Promise = Promise.resolve(); let pendingCount = 0; @@ -93,6 +133,93 @@ export function createCommandQueue(options: CommandQueueOptions): CommandQueue { }; } + function resolveRecipientKey(opened: OpenedCommand): PublicKey | null { + return opened.replyTo ?? trust.isTrustedAccountKey(opened.accountId); + } + + /** + * Events can outlive their command (console streams). Before each one, check + * that the certificate has not expired, the session is not revoked and the + * account still holds the role the command needed. + */ + function stillAuthorized(opened: OpenedCommand): boolean { + if (opened.sessionNotAfter !== undefined && trust.now() >= opened.sessionNotAfter) { + return false; + } + if (opened.sessionId !== undefined && trust.isSessionRevoked(opened.sessionId)) { + return false; + } + if (trust.isTrustedAccountKey(opened.accountId) === null) { + return false; + } + const definition = registry.get(opened.header.type); + const body = opened.body; + const scope = + typeof body === "object" && + body !== null && + "server_id" in body && + typeof (body as { server_id: unknown }).server_id === "string" + ? (body as { server_id: string }).server_id + : "*"; + return roleAtLeast(trust.roleFor(opened.accountId, scope), definition?.minRole ?? "owner"); + } + + function sendSealedEvent(type: string, body: unknown, recipientPublicKey: PublicKey): void { + const sealed = sealAgentMessage({ + type, + body, + agentKeyPair: trust.agentKeyPair, + recipientPublicKey, + sentAt: trust.now(), + seq: nextEventSeq++, + }); + const eventFrame: TransportEventFrame = { + v: PROTOCOL_VERSION, + kind: "event", + route: { + agent: agentId, + recipient: sealed.header.recipient, + }, + body: sealed, + }; + sendFrame(eventFrame); + } + + function pruneSubscribers(): void { + const at = trust.now(); + for (const [keyId, sub] of subscribers) { + const revoked = sub.sessionId !== undefined && trust.isSessionRevoked(sub.sessionId); + if (at >= sub.notAfter || revoked || trust.isTrustedAccountKey(sub.account) === null) { + subscribers.delete(keyId); + } + } + } + + function publish( + topic: SubscriptionTopic, + type: string, + data: unknown, + scope?: PublishScope, + ): void { + pruneSubscribers(); + for (const sub of subscribers.values()) { + if (!sub.topics.has(topic)) { + continue; + } + if (!roleAtLeast(trust.roleFor(sub.account, scope?.serverId ?? "*"), "viewer")) { + continue; + } + try { + sendSealedEvent(type, wrapEventBody(sub.inReplyTo, data), sub.key); + } catch (err) { + logger.warn("Failed to publish event to subscriber", { + type, + errName: err instanceof Error ? err.name : "Error", + }); + } + } + } + async function processCommand(frame: TransportCommandFrame): Promise { const commandId = frame.body.header.id; let opened: OpenedCommand; @@ -136,34 +263,26 @@ export function createCommandQueue(options: CommandQueueOptions): CommandQueue { } const ctx: CommandHandlerContext = { - sendEvent(type: string, body: unknown): void { - const recipientPublicKey = trust.isTrustedAccountKey(opened.accountId); + sendEvent(type: string, data: unknown): void { + if (!stillAuthorized(opened)) { + logger.warn("Dropping event: authorization for the command no longer holds", { + commandId: opened.header.id, + type: opened.header.type, + }); + return; + } + const recipientPublicKey = resolveRecipientKey(opened); if (recipientPublicKey === null) { throw new Error("Trusted account key unavailable for event recipient"); } - const seq = nextEventSeq++; - const sealed = sealAgentMessage({ - type, - body, - agentKeyPair: trust.agentKeyPair, - recipientPublicKey, - sentAt: trust.now(), - seq, - }); - const eventFrame: TransportEventFrame = { - v: PROTOCOL_VERSION, - kind: "event", - route: { - agent: agentId, - recipient: opened.accountId, - }, - body: sealed, - }; - sendFrame(eventFrame); + sendSealedEvent(type, wrapEventBody(opened.header.id, data), recipientPublicKey); }, now(): number { return trust.now(); }, + roleFor(serverId: string): Role | null { + return trust.roleFor(opened.accountId, serverId); + }, logger, }; @@ -202,6 +321,75 @@ export function createCommandQueue(options: CommandQueueOptions): CommandQueue { ctx.sendEvent("agent.pong", { at: ctx.now() }); }); + registerHandler("agent.subscribe", (opened, ctx) => { + const body = opened.body as AgentSubscribeBody; + const key = resolveRecipientKey(opened); + if (key === null) { + throw new ProtocolError("untrusted_signer", "Subscriber key is not available"); + } + pruneSubscribers(); + const keyId = fingerprint(key); + const existing = subscribers.get(keyId); + if (existing === undefined && subscribers.size >= MAX_SUBSCRIBERS) { + throw new ProtocolError("too_many_subscribers", "Subscriber limit reached"); + } + const sub: Subscriber = existing ?? { + key, + keyId, + account: opened.accountId, + sessionId: opened.sessionId, + notAfter: opened.sessionNotAfter ?? trust.now() + ACCOUNT_SUBSCRIPTION_TTL_MS, + inReplyTo: opened.header.id, + topics: new Set(), + }; + sub.inReplyTo = opened.header.id; + for (const topic of body.topics) { + sub.topics.add(topic); + } + subscribers.set(keyId, sub); + ctx.sendEvent("agent.subscribed", { topics: [...sub.topics] }); + }); + + registerHandler("agent.unsubscribe", (opened, ctx) => { + const body = opened.body as AgentSubscribeBody; + const key = resolveRecipientKey(opened); + const sub = key === null ? undefined : subscribers.get(fingerprint(key)); + if (sub !== undefined) { + for (const topic of body.topics) { + sub.topics.delete(topic); + } + if (sub.topics.size === 0) { + subscribers.delete(sub.keyId); + } + } + ctx.sendEvent("agent.unsubscribed", { topics: [...body.topics] }); + }); + + const memberStore = trust as TrustContext & Partial; + if ( + typeof memberStore.listMembers === "function" && + typeof memberStore.setMember === "function" && + typeof memberStore.revokeMembers === "function" + ) { + const store = memberStore as MemberStore; + registerHandler("agent.members.set", (opened, ctx) => { + const body = opened.body as AgentMembersSetBody; + const entry = applyMembersSet(opened, body, { trust, store, agentId }, trust.now()); + ctx.sendEvent("agent.members.updated", { + account: entry.account, + role: entry.role, + servers: entry.servers, + ...(entry.expires_at !== undefined ? { expires_at: entry.expires_at } : {}), + }); + }); + + registerHandler("agent.members.revoke", (opened, ctx) => { + const body = opened.body as AgentMembersRevokeBody; + const count = applyMembersRevoke(opened, body, { trust, store, agentId }); + ctx.sendEvent("agent.members.revoked", { account: body.account, count }); + }); + } + const revocationAware = trust as TrustContext & { readonly applyRevocationList?: ( list: unknown, @@ -221,6 +409,11 @@ export function createCommandQueue(options: CommandQueueOptions): CommandQueue { return { registerHandler, + publish, + subscriberCount(): number { + pruneSubscribers(); + return subscribers.size; + }, enqueue(frame: TransportCommandFrame): Promise { pendingCount++; diff --git a/src/agent/members.ts b/src/agent/members.ts new file mode 100644 index 0000000..3aad279 --- /dev/null +++ b/src/agent/members.ts @@ -0,0 +1,132 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { + type AgentMembersRevokeBody, + type AgentMembersSetBody, + type GrantableRole, + type KeyId, + MAX_MEMBERS, + type MemberEntry, + type MemberStore, + type OpenedCommand, + ProtocolError, + ROLE_LEVEL, + type Role, + roleAtLeast, + type TrustContext, + verifyRoleGrant, +} from "../protocol"; + +export interface MembersContext { + readonly trust: TrustContext; + readonly store: MemberStore; + readonly agentId: KeyId; +} + +function highestMemberRole(store: MemberStore, account: KeyId): GrantableRole | null { + let best: GrantableRole | null = null; + for (const entry of store.listMembers()) { + if (entry.account !== account) { + continue; + } + if (best === null || ROLE_LEVEL[entry.role] > ROLE_LEVEL[best]) { + best = entry.role; + } + } + return best; +} + +function requireAccountSigner(opened: OpenedCommand): Role { + if (opened.signerType !== "account" || !roleAtLeast(opened.role, "admin")) { + throw new ProtocolError( + "sensitive_requires_account_key", + "Member changes must be signed directly by an admin or owner account key", + ); + } + return opened.role; +} + +/** + * Validates a signed role grant against the account that sent the command and + * records it. The command's signer is the granter: the grant must be signed + * by that same key, and the granter must outrank the role it hands out. + */ +export function applyMembersSet( + opened: OpenedCommand, + body: AgentMembersSetBody, + ctx: MembersContext, + now: number, +): MemberEntry { + const granterRole = requireAccountSigner(opened); + const granterKey = ctx.trust.isTrustedAccountKey(opened.accountId); + if (granterKey === null) { + throw new ProtocolError("untrusted_signer", "Granting account is not trusted"); + } + + const verified = verifyRoleGrant(body.grant, granterKey, { agent: ctx.agentId, now }); + const { grant } = verified; + + if (ROLE_LEVEL[grant.role] >= ROLE_LEVEL[granterRole]) { + throw new ProtocolError( + "role_grant_invalid", + "A role at or above the granting account's own role cannot be granted", + ); + } + if (verified.accountId === opened.accountId) { + throw new ProtocolError("role_grant_invalid", "An account cannot change its own role"); + } + if (ctx.trust.roleFor(verified.accountId, "*") === "owner") { + throw new ProtocolError("role_grant_invalid", "Owner accounts cannot be given a member role"); + } + + const existing = highestMemberRole(ctx.store, verified.accountId); + if (existing !== null && ROLE_LEVEL[existing] >= ROLE_LEVEL[granterRole]) { + throw new ProtocolError( + "role_grant_invalid", + "The account already holds a role at or above the granting account's own role", + ); + } + + const known = new Set(ctx.store.listMembers().map((entry) => entry.account)); + if (!known.has(verified.accountId) && known.size >= MAX_MEMBERS) { + throw new ProtocolError("role_grant_invalid", "Too many members"); + } + + const entry: MemberEntry = { + account_key: grant.account_key, + account: verified.accountId, + granted_by: opened.accountId, + role: grant.role, + servers: grant.servers, + issued_at: grant.issued_at, + ...(grant.expires_at !== undefined ? { expires_at: grant.expires_at } : {}), + }; + ctx.store.setMember(entry); + return entry; +} + +export function applyMembersRevoke( + opened: OpenedCommand, + body: AgentMembersRevokeBody, + ctx: MembersContext, +): number { + const revokerRole = requireAccountSigner(opened); + + if (ctx.trust.roleFor(body.account, "*") === "owner") { + throw new ProtocolError("role_grant_invalid", "Owner accounts cannot be revoked"); + } + const existing = highestMemberRole(ctx.store, body.account); + if ( + existing !== null && + revokerRole !== "owner" && + ROLE_LEVEL[existing] >= ROLE_LEVEL[revokerRole] + ) { + throw new ProtocolError( + "role_grant_invalid", + "The account holds a role at or above the revoking account's own role", + ); + } + + return ctx.store.revokeMembers(body.account, body.servers); +} diff --git a/src/agent/pairing-api.ts b/src/agent/pairing-api.ts index afc3b6c..e622257 100644 --- a/src/agent/pairing-api.ts +++ b/src/agent/pairing-api.ts @@ -2,13 +2,15 @@ // Copyright (C) 2026 Antônio Miranda import { z } from "zod"; +import type { SigningKeyPair } from "../crypto"; +import { buildApiUrl, type FetchLike, signedRequestHeaders } from "./api-client"; import { validateApiUrl } from "./state"; +export type { FetchLike }; + export const PAIRING_API_TIMEOUT_MS = 10_000; export const PAIRING_API_MAX_RESPONSE_BYTES = 64 * 1024; -export type FetchLike = (input: string | URL, init?: RequestInit) => Promise; - export type PairingApiErrorCode = | "network_error" | "http_error" @@ -43,6 +45,9 @@ export interface PairingApiClient { export interface PairingApiClientOptions { readonly apiUrl: string; + /** Signs every request; the control API checks it against the key sent at registration. */ + readonly agentKeyPair: SigningKeyPair; + readonly now?: () => number; readonly allowInsecure?: boolean; readonly fetch?: FetchLike; readonly timeoutMs?: number; @@ -53,15 +58,6 @@ const grantResponseSchema = z.object({ grant: z.unknown(), }); -function buildEndpointUrl(baseApiUrl: string, pathSuffix: string): string { - const url = new URL(baseApiUrl); - const basePath = url.pathname.replace(/\/+$/, ""); - url.pathname = `${basePath}${pathSuffix}`; - url.search = ""; - url.hash = ""; - return url.toString(); -} - async function readBoundedText(response: Response, maxBytes: number): Promise { const contentLengthHeader = response.headers.get("content-length"); if (contentLengthHeader !== null) { @@ -162,6 +158,11 @@ export function createPairingApiClient(options: PairingApiClientOptions): Pairin const fetchFn: FetchLike = options.fetch ?? ((input, init) => fetch(input, init)); const timeoutMs = options.timeoutMs ?? PAIRING_API_TIMEOUT_MS; const maxResponseBytes = options.maxResponseBytes ?? PAIRING_API_MAX_RESPONSE_BYTES; + const now = options.now ?? (() => Date.now()); + + function signed(method: string, url: string, body?: string): Record { + return signedRequestHeaders({ agentKeyPair: options.agentKeyPair, now }, method, url, body); + } return { async registerPairing( @@ -169,17 +170,18 @@ export function createPairingApiClient(options: PairingApiClientOptions): Pairin agentPublicKeyB64: string, signal?: AbortSignal, ): Promise<"created" | "conflict"> { - const url = buildEndpointUrl(validatedUrl, "/agents/pairing"); + const url = buildApiUrl(validatedUrl, "/agents/pairing"); + const requestBody = JSON.stringify({ + code, + agent_public_key: agentPublicKeyB64, + }); const response = await fetchWithTimeout( fetchFn, url, { method: "POST", - headers: { "content-type": "application/json" }, - body: JSON.stringify({ - code, - agent_public_key: agentPublicKeyB64, - }), + headers: { "content-type": "application/json", ...signed("POST", url, requestBody) }, + body: requestBody, }, timeoutMs, signal, @@ -198,16 +200,13 @@ export function createPairingApiClient(options: PairingApiClientOptions): Pairin }, async pollGrant(code: string, signal?: AbortSignal): Promise { - const url = buildEndpointUrl( - validatedUrl, - `/agents/pairing/${encodeURIComponent(code)}/grant`, - ); + const url = buildApiUrl(validatedUrl, `/agents/pairing/${encodeURIComponent(code)}/grant`); const response = await fetchWithTimeout( fetchFn, url, { method: "GET", - headers: { accept: "application/json" }, + headers: { accept: "application/json", ...signed("GET", url) }, }, timeoutMs, signal, @@ -240,9 +239,14 @@ export function createPairingApiClient(options: PairingApiClientOptions): Pairin }, async deletePairing(code: string): Promise { - const url = buildEndpointUrl(validatedUrl, `/agents/pairing/${encodeURIComponent(code)}`); + const url = buildApiUrl(validatedUrl, `/agents/pairing/${encodeURIComponent(code)}`); try { - await fetchWithTimeout(fetchFn, url, { method: "DELETE" }, timeoutMs); + await fetchWithTimeout( + fetchFn, + url, + { method: "DELETE", headers: signed("DELETE", url) }, + timeoutMs, + ); } catch { // Best-effort cleanup } diff --git a/src/agent/pairing.test.ts b/src/agent/pairing.test.ts index b0685bd..4d79d12 100644 --- a/src/agent/pairing.test.ts +++ b/src/agent/pairing.test.ts @@ -11,7 +11,6 @@ import { createCoreRegistry, createSignedCommand, generatePairingSecret, - openAgentMessage, PROTOCOL_VERSION, parsePairingFragment, signRevocationList, @@ -33,6 +32,7 @@ import { loadTrust, StateError, } from "./state"; +import { openTestEvent } from "./test-events"; const BASE_TIME = 1_700_000_000_000; const tempDirs: string[] = []; @@ -67,14 +67,25 @@ afterEach(() => { describe("pairing API client", () => { test("rejects non-https URLs unless allowInsecure is enabled for localhost", () => { - expect(() => createPairingApiClient({ apiUrl: "http://api.tegra.example" })).toThrow( - StateError, - ); expect(() => - createPairingApiClient({ apiUrl: "http://127.0.0.1:8080", allowInsecure: false }), + createPairingApiClient({ + agentKeyPair: generateSigningKeyPair(), + apiUrl: "http://api.tegra.example", + }), + ).toThrow(StateError); + expect(() => + createPairingApiClient({ + agentKeyPair: generateSigningKeyPair(), + apiUrl: "http://127.0.0.1:8080", + allowInsecure: false, + }), ).toThrow(StateError); expect(() => - createPairingApiClient({ apiUrl: "http://127.0.0.1:8080", allowInsecure: true }), + createPairingApiClient({ + agentKeyPair: generateSigningKeyPair(), + apiUrl: "http://127.0.0.1:8080", + allowInsecure: true, + }), ).not.toThrow(); }); @@ -87,6 +98,7 @@ describe("pairing API client", () => { }); const api = createPairingApiClient({ + agentKeyPair: generateSigningKeyPair(), apiUrl: "https://api.tegra.example", fetch: fakeFetch, }); @@ -615,7 +627,7 @@ describe("end-to-end revocation via command queue", () => { const ackFrame = sent.find((f) => f.kind === "ack"); expect(eventFrame).toBeDefined(); if (eventFrame?.kind === "event") { - const openedEvent = openAgentMessage(eventFrame.body, agent.publicKey, account); + const openedEvent = openTestEvent(eventFrame.body, agent.publicKey, account); expect(openedEvent.header.type).toBe("agent.revocations.applied"); expect(openedEvent.body).toEqual({ account: fingerprint(account.publicKey), diff --git a/src/agent/pairing.ts b/src/agent/pairing.ts index ac5287e..ed5e6b5 100644 --- a/src/agent/pairing.ts +++ b/src/agent/pairing.ts @@ -167,6 +167,7 @@ export async function runPairingFlow(options: RunPairingFlowOptions): Promise + +import { afterEach, beforeAll, describe, expect, test } from "bun:test"; +import { existsSync, mkdtempSync, rmSync, statSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { + fingerprint, + generateSigningKeyPair, + ready, + type SigningKeyPair, + toBase64Url, +} from "../crypto"; +import { + type CommandRegistry, + createCoreRegistry, + createHelloFrame, + createInMemoryTrustContext, + createSignedCommand, + type GrantableRole, + PROTOCOL_VERSION, + type RoleGrant, + type SessionCertificate, + type SignedCommand, + signRoleGrant, + signSessionCertificate, + type TransportFrame, + type TrustContext, + verifyAgentAuth, + verifyAgentRequest, +} from "../protocol"; +import { createServerStatusWatcher, mapUnitState } from "../server"; +import { AgentApiError, createAgentApiClient } from "./api-client"; +import { + createAgentConnection, + type WebSocketCloseEventLike, + type WebSocketLike, + type WebSocketMessageEventLike, +} from "./connection"; +import { + type CommandQueue, + createCommandQueue, + MAX_SUBSCRIBERS, + type TransportCommandFrame, +} from "./jobs"; +import { createLogger } from "./logger"; +import { createPairingApiClient } from "./pairing-api"; +import { getStatePaths } from "./paths"; +import { createFileTrustContext, loadMembers } from "./state"; +import { openTestEvent } from "./test-events"; + +const NOW = 1_700_000_000_000; +const tempDirs: string[] = []; + +beforeAll(async () => { + await ready(); +}); + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +function makeTempDir(): string { + const dir = mkdtempSync(join(tmpdir(), "tegrad-p3-")); + tempDirs.push(dir); + return dir; +} + +const silentLogger = createLogger({ level: "error", stdout: () => {}, stderr: () => {} }); + +interface Harness { + readonly agent: SigningKeyPair; + readonly agentId: string; + readonly owner: SigningKeyPair; + readonly registry: CommandRegistry; + readonly trust: TrustContext; + readonly queue: CommandQueue; + readonly sent: TransportFrame[]; + readonly clock: { now: number }; + send( + type: string, + body: unknown, + signer: SigningKeyPair, + options?: { session?: SessionCertificate; replyTo?: Uint8Array; counter?: number }, + ): Promise; +} + +function makeHarness( + trustOverride?: (agent: SigningKeyPair, owner: SigningKeyPair) => TrustContext, +): Harness { + const agent = generateSigningKeyPair(); + const owner = generateSigningKeyPair(); + const clock = { now: NOW }; + const trust = + trustOverride?.(agent, owner) ?? + createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [owner.publicKey], + now: () => clock.now, + }); + const registry = createCoreRegistry(); + const sent: TransportFrame[] = []; + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (frame) => sent.push(frame), + logger: silentLogger, + }); + const agentId = fingerprint(agent.publicKey); + const counters = new Map(); + + return { + agent, + agentId, + owner, + registry, + trust, + queue, + sent, + clock, + async send(type, body, signer, options = {}) { + const key = fingerprint(signer.publicKey); + const counter = options.counter ?? (counters.get(key) ?? 0) + 1; + counters.set(key, counter); + const command = createSignedCommand( + { + type, + body, + agentPublicKey: agent.publicKey, + signer, + counter, + now: clock.now, + ...(options.session !== undefined ? { session: options.session } : {}), + ...(options.replyTo !== undefined ? { replyTo: options.replyTo } : {}), + }, + registry, + ); + const frame: TransportCommandFrame = { + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: agentId }, + body: command, + }; + await queue.enqueue(frame); + return command; + }, + }; +} + +function lastAck(sent: readonly TransportFrame[]): { ok: boolean; code?: string } { + for (let i = sent.length - 1; i >= 0; i--) { + const frame = sent[i]; + if (frame?.kind === "ack") { + return frame.body.code !== undefined + ? { ok: frame.body.ok, code: frame.body.code } + : { ok: frame.body.ok }; + } + } + throw new Error("no ack"); +} + +function eventsFor( + sent: readonly TransportFrame[], + agent: SigningKeyPair, + recipient: SigningKeyPair, +) { + const out: { type: string; inReplyTo: string | null; data: unknown }[] = []; + for (const frame of sent) { + if (frame.kind === "event" && frame.route.recipient === fingerprint(recipient.publicKey)) { + const opened = openTestEvent(frame.body, agent.publicKey, recipient); + out.push({ type: opened.header.type, inReplyTo: opened.inReplyTo, data: opened.body }); + } + } + return out; +} + +function makeSession(account: SigningKeyPair, notAfter = NOW + 3_600_000) { + const key = generateSigningKeyPair(); + const certificate = signSessionCertificate({ + sessionPublicKey: key.publicKey, + accountKeyPair: account, + notBefore: NOW - 1000, + notAfter, + }); + return { key, certificate }; +} + +describe("event envelope and reply_to through the command queue", () => { + test("events carry in_reply_to and are sealed to the session key; the account key cannot read them", async () => { + const h = makeHarness(); + const session = makeSession(h.owner); + + const command = await h.send("agent.ping", {}, session.key, { + session: session.certificate, + replyTo: session.key.publicKey, + }); + + expect(lastAck(h.sent).ok).toBe(true); + const event = h.sent.find((f) => f.kind === "event"); + expect(event?.kind).toBe("event"); + if (event?.kind !== "event") return; + + expect(event.route.recipient).toBe(fingerprint(session.key.publicKey)); + const opened = openTestEvent(event.body, h.agent.publicKey, session.key); + expect(opened.header.type).toBe("agent.pong"); + expect(opened.inReplyTo).toBe(command.header.id); + expect(opened.body).toEqual({ at: NOW }); + + // Only the session can decrypt it: the account key is not the recipient. + expect(() => openTestEvent(event.body, h.agent.publicKey, h.owner)).toThrow(); + }); + + test("without reply_to the event is sealed to the account key (previous behaviour)", async () => { + const h = makeHarness(); + const command = await h.send("agent.ping", {}, h.owner); + const events = eventsFor(h.sent, h.agent, h.owner); + expect(events).toHaveLength(1); + expect(events[0]?.inReplyTo).toBe(command.header.id); + }); + + test("an account-signed command can direct replies to the active session key", async () => { + const h = makeHarness(); + const session = makeSession(h.owner); + await h.send("agent.ping", {}, h.owner, { replyTo: session.key.publicKey }); + expect(eventsFor(h.sent, h.agent, session.key)).toHaveLength(1); + expect(eventsFor(h.sent, h.agent, h.owner)).toHaveLength(0); + }); + + test("a session command whose reply_to is another key is rejected with an error ack", async () => { + const h = makeHarness(); + const session = makeSession(h.owner); + const other = generateSigningKeyPair(); + await h.send("agent.ping", {}, session.key, { + session: session.certificate, + replyTo: other.publicKey, + }); + expect(lastAck(h.sent)).toEqual({ ok: false, code: "wrong_recipient" }); + expect(h.sent.some((f) => f.kind === "event")).toBe(false); + }); +}); + +describe("agent.subscribe", () => { + test("registers the session key, acks with agent.subscribed and publishes status changes", async () => { + const h = makeHarness(); + const session = makeSession(h.owner); + + const subscribe = await h.send("agent.subscribe", { topics: ["server.status"] }, session.key, { + session: session.certificate, + replyTo: session.key.publicKey, + }); + expect(lastAck(h.sent).ok).toBe(true); + expect(h.queue.subscriberCount()).toBe(1); + const subscribed = eventsFor(h.sent, h.agent, session.key); + expect(subscribed[0]).toEqual({ + type: "agent.subscribed", + inReplyTo: subscribe.header.id, + data: { topics: ["server.status"] }, + }); + + h.queue.publish( + "server.status", + "server.status.changed", + { server_id: "survival", state: "running", at: NOW }, + { serverId: "survival" }, + ); + const events = eventsFor(h.sent, h.agent, session.key); + expect(events).toHaveLength(2); + expect(events[1]).toEqual({ + type: "server.status.changed", + inReplyTo: subscribe.header.id, + data: { server_id: "survival", state: "running", at: NOW }, + }); + // The account key never receives the session's subscription events. + expect(eventsFor(h.sent, h.agent, h.owner)).toHaveLength(0); + }); + + test("the subscription expires with the session certificate", async () => { + const h = makeHarness(); + const session = makeSession(h.owner, NOW + 60_000); + await h.send("agent.subscribe", { topics: ["server.status"] }, session.key, { + session: session.certificate, + replyTo: session.key.publicKey, + }); + + const change = { server_id: "survival", state: "stopped", at: NOW }; + h.queue.publish("server.status", "server.status.changed", change, { serverId: "survival" }); + expect(eventsFor(h.sent, h.agent, session.key)).toHaveLength(2); + + h.clock.now = NOW + 60_000; + h.queue.publish("server.status", "server.status.changed", change, { serverId: "survival" }); + expect(eventsFor(h.sent, h.agent, session.key)).toHaveLength(2); + expect(h.queue.subscriberCount()).toBe(0); + }); + + test("a revoked session stops receiving events", async () => { + const harness = makeHarness(); + const session = makeSession(harness.owner); + await harness.send("agent.subscribe", { topics: ["server.status"] }, session.key, { + session: session.certificate, + replyTo: session.key.publicKey, + }); + const trust = harness.trust as ReturnType; + trust.revokeSession(session.certificate.id); + harness.queue.publish( + "server.status", + "server.status.changed", + { server_id: "a", state: "running", at: NOW }, + { serverId: "a" }, + ); + expect(eventsFor(harness.sent, harness.agent, session.key)).toHaveLength(1); + }); + + test("unsubscribe stops the events", async () => { + const h = makeHarness(); + const session = makeSession(h.owner); + const options = { session: session.certificate, replyTo: session.key.publicKey }; + await h.send("agent.subscribe", { topics: ["server.status"] }, session.key, options); + await h.send("agent.unsubscribe", { topics: ["server.status"] }, session.key, options); + expect(lastAck(h.sent).ok).toBe(true); + expect(h.queue.subscriberCount()).toBe(0); + const before = eventsFor(h.sent, h.agent, session.key).length; + h.queue.publish( + "server.status", + "server.status.changed", + { server_id: "a", state: "running", at: NOW }, + { serverId: "a" }, + ); + expect(eventsFor(h.sent, h.agent, session.key)).toHaveLength(before); + }); + + test("limits subscribers to 16 per agent but lets an existing one renew", async () => { + const h = makeHarness(); + const sessions = Array.from({ length: MAX_SUBSCRIBERS + 1 }, () => makeSession(h.owner)); + for (const session of sessions.slice(0, MAX_SUBSCRIBERS)) { + await h.send("agent.subscribe", { topics: ["server.status"] }, session.key, { + session: session.certificate, + replyTo: session.key.publicKey, + }); + expect(lastAck(h.sent).ok).toBe(true); + } + expect(h.queue.subscriberCount()).toBe(MAX_SUBSCRIBERS); + + const extra = sessions[MAX_SUBSCRIBERS]; + if (!extra) throw new Error("missing session"); + await h.send("agent.subscribe", { topics: ["server.status"] }, extra.key, { + session: extra.certificate, + replyTo: extra.key.publicKey, + }); + expect(lastAck(h.sent)).toEqual({ ok: false, code: "too_many_subscribers" }); + + const first = sessions[0]; + if (!first) throw new Error("missing session"); + await h.send("agent.subscribe", { topics: ["server.status"] }, first.key, { + session: first.certificate, + replyTo: first.key.publicKey, + }); + expect(lastAck(h.sent).ok).toBe(true); + }); + + test("rejects unknown topics and extra fields", async () => { + const h = makeHarness(); + expect(() => + createSignedCommand( + { + type: "agent.subscribe", + body: { topics: ["server.console"] }, + agentPublicKey: h.agent.publicKey, + signer: h.owner, + counter: 1, + now: NOW, + }, + h.registry, + ), + ).toThrow(); + expect(() => + createSignedCommand( + { + type: "agent.subscribe", + body: { topics: [] }, + agentPublicKey: h.agent.publicKey, + signer: h.owner, + counter: 1, + now: NOW, + }, + h.registry, + ), + ).toThrow(); + }); +}); + +describe("team roles through the command queue", () => { + function memberHarness() { + const h = makeHarness(); + const member = generateSigningKeyPair(); + const memberSession = makeSession(member); + return { h, member, memberSession }; + } + + function grantFor( + h: Harness, + granter: SigningKeyPair, + member: SigningKeyPair, + role: GrantableRole, + servers: readonly string[] | "*", + extra: { agent?: string; issuedAt?: number; expiresAt?: number } = {}, + ): RoleGrant { + return signRoleGrant({ + granter, + accountPublicKey: member.publicKey, + agent: extra.agent ?? h.agentId, + servers, + role, + issuedAt: extra.issuedAt ?? NOW, + ...(extra.expiresAt !== undefined ? { expiresAt: extra.expiresAt } : {}), + }); + } + + test("an owner grants a role, the member can act within it and nowhere else", async () => { + const { h, member } = memberHarness(); + const grant = grantFor(h, h.owner, member, "operator", ["alpha"]); + await h.send("agent.members.set", { grant }, h.owner); + expect(lastAck(h.sent).ok).toBe(true); + const updated = eventsFor(h.sent, h.agent, h.owner).find( + (e) => e.type === "agent.members.updated", + ); + expect(updated?.data).toEqual({ + account: fingerprint(member.publicKey), + role: "operator", + servers: ["alpha"], + }); + + // A handler is only registered for some commands in this harness; a role rejection comes first. + await h.send("server.start", { server_id: "alpha" }, member); + expect(lastAck(h.sent)).toEqual({ ok: false, code: "no_handler" }); + await h.send("server.start", { server_id: "beta" }, member); + expect(lastAck(h.sent)).toEqual({ ok: false, code: "insufficient_role" }); + await h.send("files.read", { server_id: "alpha", path: "a" }, member); + expect(lastAck(h.sent)).toEqual({ ok: false, code: "insufficient_role" }); + }); + + test("a grant signed by someone other than the sender is refused", async () => { + const { h, member } = memberHarness(); + const forger = generateSigningKeyPair(); + const forged = grantFor(h, forger, member, "admin", "*"); + await h.send("agent.members.set", { grant: forged }, h.owner); + expect(lastAck(h.sent)).toEqual({ ok: false, code: "role_grant_invalid" }); + await h.send("server.start", { server_id: "alpha" }, member); + expect(lastAck(h.sent).code).toBe("untrusted_signer"); + }); + + test("a grant that is for another agent, expired, or tampered is refused", async () => { + const { h, member } = memberHarness(); + const otherAgent = fingerprint(generateSigningKeyPair().publicKey); + + await h.send( + "agent.members.set", + { grant: grantFor(h, h.owner, member, "viewer", "*", { agent: otherAgent }) }, + h.owner, + ); + expect(lastAck(h.sent).code).toBe("role_grant_invalid"); + + await h.send( + "agent.members.set", + { + grant: grantFor(h, h.owner, member, "viewer", "*", { + issuedAt: NOW - 10_000, + expiresAt: NOW - 1, + }), + }, + h.owner, + ); + expect(lastAck(h.sent).code).toBe("role_grant_invalid"); + + const good = grantFor(h, h.owner, member, "viewer", ["alpha"]); + await h.send("agent.members.set", { grant: { ...good, servers: "*" } }, h.owner); + expect(lastAck(h.sent).code).toBe("role_grant_invalid"); + await h.send("agent.members.set", { grant: { ...good, role: "admin" } }, h.owner); + expect(lastAck(h.sent).code).toBe("role_grant_invalid"); + + expect(h.trust.roleFor(fingerprint(member.publicKey), "alpha")).toBeNull(); + }); + + test("members.set and members.revoke are sensitive: a session signature is refused", async () => { + const h = makeHarness(); + const session = makeSession(h.owner); + const member = generateSigningKeyPair(); + await h.send( + "agent.members.set", + { grant: grantFor(h, h.owner, member, "viewer", "*") }, + session.key, + { session: session.certificate, replyTo: session.key.publicKey }, + ); + expect(lastAck(h.sent)).toEqual({ ok: false, code: "sensitive_requires_account_key" }); + + await h.send("agent.members.revoke", { account: fingerprint(member.publicKey) }, session.key, { + session: session.certificate, + replyTo: session.key.publicKey, + }); + expect(lastAck(h.sent)).toEqual({ ok: false, code: "sensitive_requires_account_key" }); + }); + + test("an admin can grant up to editor but not admin, and cannot touch owners or equal roles", async () => { + const h = makeHarness(); + const admin = generateSigningKeyPair(); + const peer = generateSigningKeyPair(); + const viewer = generateSigningKeyPair(); + await h.send( + "agent.members.set", + { grant: grantFor(h, h.owner, admin, "admin", "*") }, + h.owner, + ); + await h.send("agent.members.set", { grant: grantFor(h, h.owner, peer, "admin", "*") }, h.owner); + await h.send( + "agent.members.set", + { grant: grantFor(h, h.owner, viewer, "viewer", "*") }, + h.owner, + ); + expect(lastAck(h.sent).ok).toBe(true); + + const newcomer = generateSigningKeyPair(); + await h.send( + "agent.members.set", + { grant: grantFor(h, admin, newcomer, "editor", ["alpha"]) }, + admin, + ); + expect(lastAck(h.sent).ok).toBe(true); + expect(h.trust.roleFor(fingerprint(newcomer.publicKey), "alpha")).toBe("editor"); + + const another = generateSigningKeyPair(); + await h.send("agent.members.set", { grant: grantFor(h, admin, another, "admin", "*") }, admin); + expect(lastAck(h.sent).code).toBe("role_grant_invalid"); + + // Cannot demote/replace a peer admin or an owner. + await h.send("agent.members.set", { grant: grantFor(h, admin, peer, "viewer", "*") }, admin); + expect(lastAck(h.sent).code).toBe("role_grant_invalid"); + await h.send("agent.members.set", { grant: grantFor(h, admin, h.owner, "viewer", "*") }, admin); + expect(lastAck(h.sent).code).toBe("role_grant_invalid"); + await h.send("agent.members.revoke", { account: fingerprint(peer.publicKey) }, admin); + expect(lastAck(h.sent).code).toBe("role_grant_invalid"); + await h.send("agent.members.revoke", { account: fingerprint(h.owner.publicKey) }, admin); + expect(lastAck(h.sent).code).toBe("role_grant_invalid"); + + // A viewer cannot manage members at all. + await h.send( + "agent.members.set", + { grant: grantFor(h, viewer, another, "viewer", "*") }, + viewer, + ); + expect(lastAck(h.sent).code).toBe("insufficient_role"); + + // An admin cannot grant itself or turn a grant into something it could not give. + await h.send("agent.members.set", { grant: grantFor(h, admin, admin, "viewer", "*") }, admin); + expect(lastAck(h.sent).code).toBe("role_grant_invalid"); + }); + + test("revoke removes access, scoped or entirely", async () => { + const { h, member } = memberHarness(); + await h.send( + "agent.members.set", + { grant: grantFor(h, h.owner, member, "operator", ["a", "b"]) }, + h.owner, + ); + const id = fingerprint(member.publicKey); + expect(h.trust.roleFor(id, "a")).toBe("operator"); + + await h.send("agent.members.revoke", { account: id, servers: ["a"] }, h.owner); + expect(lastAck(h.sent).ok).toBe(true); + expect(h.trust.roleFor(id, "a")).toBeNull(); + expect(h.trust.roleFor(id, "b")).toBe("operator"); + + await h.send("agent.members.revoke", { account: id }, h.owner); + const revoked = eventsFor(h.sent, h.agent, h.owner).filter( + (e) => e.type === "agent.members.revoked", + ); + expect(revoked.at(-1)?.data).toEqual({ account: id, count: 1 }); + expect(h.trust.roleFor(id, "b")).toBeNull(); + await h.send("server.start", { server_id: "b" }, member); + expect(lastAck(h.sent).code).toBe("untrusted_signer"); + }); + + test("an expired role stops working", async () => { + const { h, member } = memberHarness(); + await h.send( + "agent.members.set", + { grant: grantFor(h, h.owner, member, "viewer", "*", { expiresAt: NOW + 5000 }) }, + h.owner, + ); + await h.send("agent.ping", {}, member); + expect(lastAck(h.sent).ok).toBe(true); + h.clock.now = NOW + 5000; + await h.send("agent.ping", {}, member); + expect(lastAck(h.sent).code).toBe("untrusted_signer"); + }); + + test("status events are only published to subscribers that may see the server", async () => { + const { h, member } = memberHarness(); + await h.send( + "agent.members.set", + { grant: grantFor(h, h.owner, member, "viewer", ["alpha"]) }, + h.owner, + ); + const memberSessionKey = makeSession(member); + await h.send("agent.subscribe", { topics: ["server.status"] }, memberSessionKey.key, { + session: memberSessionKey.certificate, + replyTo: memberSessionKey.key.publicKey, + }); + expect(lastAck(h.sent).ok).toBe(true); + + h.queue.publish( + "server.status", + "server.status.changed", + { server_id: "alpha", state: "running", at: NOW }, + { serverId: "alpha" }, + ); + h.queue.publish( + "server.status", + "server.status.changed", + { server_id: "beta", state: "running", at: NOW }, + { serverId: "beta" }, + ); + const events = eventsFor(h.sent, h.agent, memberSessionKey.key).filter( + (e) => e.type === "server.status.changed", + ); + expect(events.map((e) => (e.data as { server_id: string }).server_id)).toEqual(["alpha"]); + }); + + test("members persist in members.json with 0600 and survive a restart", async () => { + const dir = makeTempDir(); + const owner = generateSigningKeyPair(); + const agent = generateSigningKeyPair(); + const member = generateSigningKeyPair(); + const clock = { now: NOW }; + const build = () => { + const trust = createFileTrustContext({ + stateDir: dir, + agentKeyPair: agent, + trustedAccountKeys: [owner.publicKey], + now: () => clock.now, + }); + const registry = createCoreRegistry(); + const sent: TransportFrame[] = []; + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (f) => sent.push(f), + logger: silentLogger, + }); + return { trust, registry, sent, queue }; + }; + + const first = build(); + const grant = signRoleGrant({ + granter: owner, + accountPublicKey: member.publicKey, + agent: fingerprint(agent.publicKey), + servers: ["alpha"], + role: "editor", + issuedAt: NOW, + }); + const command = createSignedCommand( + { + type: "agent.members.set", + body: { grant }, + agentPublicKey: agent.publicKey, + signer: owner, + counter: 1, + now: NOW, + }, + first.registry, + ); + await first.queue.enqueue({ + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: fingerprint(agent.publicKey) }, + body: command, + }); + expect(lastAck(first.sent).ok).toBe(true); + + const { membersPath } = getStatePaths(dir); + expect(existsSync(membersPath)).toBe(true); + if (process.platform !== "win32") { + expect(statSync(membersPath).mode & 0o777).toBe(0o600); + } + expect(loadMembers(dir)).toHaveLength(1); + + const second = build(); + const id = fingerprint(member.publicKey); + expect(second.trust.roleFor(id, "alpha")).toBe("editor"); + expect(second.trust.roleFor(id, "beta")).toBeNull(); + expect(second.trust.roleFor(fingerprint(owner.publicKey), "beta")).toBe("owner"); + expect(second.trust.isTrustedAccountKey(id)).not.toBeNull(); + }); +}); + +describe("connection hello / auth", () => { + class FakeSocket implements WebSocketLike { + readyState = 0; + onopen: (() => void) | null = null; + onmessage: ((event: WebSocketMessageEventLike) => void) | null = null; + onclose: ((event: WebSocketCloseEventLike) => void) | null = null; + onerror: ((event: unknown) => void) | null = null; + readonly sent: string[] = []; + readonly closes: { code?: number; reason?: string }[] = []; + send(data: string): void { + this.sent.push(data); + } + close(code?: number, reason?: string): void { + this.closes.push({ + ...(code !== undefined ? { code } : {}), + ...(reason !== undefined ? { reason } : {}), + }); + this.readyState = 3; + this.onclose?.({ ...(code !== undefined ? { code } : {}) }); + } + open(): void { + this.readyState = 1; + this.onopen?.(); + } + receive(frame: unknown): void { + this.onmessage?.({ data: JSON.stringify(frame) }); + } + } + + const tick = () => new Promise((resolve) => setTimeout(resolve, 0)); + + test("queued frames wait for the auth frame; the API can verify it; commands arrive afterwards", async () => { + const agent = generateSigningKeyPair(); + const agentId = fingerprint(agent.publicKey); + const sockets: FakeSocket[] = []; + const received: TransportFrame[] = []; + const { signAgentAuth } = await import("../protocol"); + + const connection = createAgentConnection({ + apiUrl: "https://api.tegra.example", + agentId, + logger: silentLogger, + webSocketFactory: (url) => { + expect(url).toBe(`wss://api.tegra.example/v1/agents/connect?agent=${agentId}`); + const socket = new FakeSocket(); + sockets.push(socket); + return socket; + }, + answerHello: (hello) => signAgentAuth({ agentKeyPair: agent, hello, ts: NOW }), + onFrame: (frame) => received.push(frame), + }); + + connection.start(); + const socket = sockets[0]; + if (!socket) throw new Error("no socket"); + socket.open(); + await tick(); + + // Before the challenge there is nothing sent and the connection is not usable. + expect(connection.isConnected()).toBe(false); + const ping: TransportFrame = { + v: PROTOCOL_VERSION, + kind: "ping", + route: { agent: agentId }, + body: { ts: 1 }, + }; + expect(connection.send(ping)).toBe(false); + expect(socket.sent).toHaveLength(0); + + // Frames other than hello are dropped while waiting for it. + socket.receive(ping); + expect(received).toHaveLength(0); + + const hello = createHelloFrame({ agent: agentId, serverTime: NOW }); + socket.receive(hello); + await tick(); + + expect(socket.sent.length).toBeGreaterThanOrEqual(2); + const auth = JSON.parse(socket.sent[0] ?? "null"); + expect(auth.kind).toBe("auth"); + expect(() => + verifyAgentAuth(auth, { + agentPublicKey: agent.publicKey, + expectedNonce: hello.body.nonce, + now: NOW, + }), + ).not.toThrow(); + expect(JSON.parse(socket.sent[1] ?? "null").kind).toBe("ping"); + expect(connection.isConnected()).toBe(true); + + socket.receive(ping); + expect(received).toHaveLength(1); + + // A hello after authentication is not forwarded and does not trigger a second auth. + const sentBefore = socket.sent.length; + socket.receive(createHelloFrame({ agent: agentId, serverTime: NOW })); + await tick(); + expect(socket.sent).toHaveLength(sentBefore); + expect(received).toHaveLength(1); + connection.stop(); + }); + + test("reconnects when no hello arrives in time", async () => { + const agent = generateSigningKeyPair(); + const agentId = fingerprint(agent.publicKey); + const sockets: FakeSocket[] = []; + const { signAgentAuth } = await import("../protocol"); + const connection = createAgentConnection({ + apiUrl: "https://api.tegra.example", + agentId, + logger: silentLogger, + webSocketFactory: () => { + const socket = new FakeSocket(); + sockets.push(socket); + return socket; + }, + answerHello: (hello) => signAgentAuth({ agentKeyPair: agent, hello, ts: NOW }), + onFrame: () => {}, + helloTimeoutMs: 20, + }); + connection.start(); + sockets[0]?.open(); + await new Promise((resolve) => setTimeout(resolve, 60)); + expect(sockets[0]?.closes[0]?.code).toBe(4002); + expect(connection.isConnected()).toBe(false); + connection.stop(); + }); + + test("a hello for another agent makes the connection drop instead of authenticating", async () => { + const agent = generateSigningKeyPair(); + const agentId = fingerprint(agent.publicKey); + const sockets: FakeSocket[] = []; + const { signAgentAuth } = await import("../protocol"); + const connection = createAgentConnection({ + apiUrl: "https://api.tegra.example", + agentId, + logger: silentLogger, + webSocketFactory: () => { + const socket = new FakeSocket(); + sockets.push(socket); + return socket; + }, + answerHello: (hello) => signAgentAuth({ agentKeyPair: agent, hello, ts: NOW }), + onFrame: () => {}, + }); + connection.start(); + const socket = sockets[0]; + socket?.open(); + await tick(); + const stranger = fingerprint(generateSigningKeyPair().publicKey); + socket?.receive({ + v: PROTOCOL_VERSION, + kind: "hello", + route: { agent: stranger }, + body: { + nonce: createHelloFrame({ agent: stranger, serverTime: NOW }).body.nonce, + server_time: NOW, + }, + }); + await tick(); + expect(socket?.sent).toHaveLength(0); + expect(socket?.closes[0]?.code).toBe(4001); + connection.stop(); + }); +}); + +describe("agent API client", () => { + test("signs the backup upload URL request and parses the target", async () => { + const agent = generateSigningKeyPair(); + const seen: { url: string; method: string; body: string; headers: Headers }[] = []; + const client = createAgentApiClient({ + apiUrl: "https://api.tegra.example", + agentKeyPair: agent, + now: () => NOW, + fetch: async (input, init) => { + seen.push({ + url: String(input), + method: init?.method ?? "GET", + body: String(init?.body ?? ""), + headers: new Headers(init?.headers), + }); + return new Response( + JSON.stringify({ + put_url: "https://storage.tegra.example/put?sig=abc", + headers: { "x-amz-meta-a": "1" }, + expires_at: NOW + 60_000, + max_bytes: 1024, + }), + { status: 200 }, + ); + }, + }); + + const target = await client.requestBackupUploadUrl({ server_id: "survival", size_bytes: 10 }); + expect(target).toEqual({ + put_url: "https://storage.tegra.example/put?sig=abc", + headers: { "x-amz-meta-a": "1" }, + expires_at: NOW + 60_000, + max_bytes: 1024, + }); + const request = seen[0]; + if (!request) throw new Error("no request"); + expect(request.url).toBe("https://api.tegra.example/v1/agents/self/backup-upload-url"); + expect(request.method).toBe("POST"); + expect(JSON.parse(request.body)).toEqual({ server_id: "survival", size_bytes: 10 }); + + // The API can verify exactly what was signed. + const verify = () => + verifyAgentRequest({ + getHeader: (name) => request.headers.get(name), + method: request.method, + pathWithQuery: new URL(request.url).pathname, + body: request.body, + agentPublicKey: agent.publicKey, + now: NOW + 1000, + }); + expect(verify().agent).toBe(fingerprint(agent.publicKey)); + // ...and rejects it once the timestamp is stale. + expect(() => + verifyAgentRequest({ + getHeader: (name) => request.headers.get(name), + method: request.method, + pathWithQuery: new URL(request.url).pathname, + body: request.body, + agentPublicKey: agent.publicKey, + now: NOW + 120_000, + }), + ).toThrow(); + // ...or when the body was altered. + expect(() => + verifyAgentRequest({ + getHeader: (name) => request.headers.get(name), + method: request.method, + pathWithQuery: new URL(request.url).pathname, + body: request.body.replace("10", "99999"), + agentPublicKey: agent.publicKey, + now: NOW, + }), + ).toThrow(); + }); + + test("maps quota, rate limit, server errors and malformed bodies to stable codes", async () => { + const agent = generateSigningKeyPair(); + function clientFor(response: () => Response | Promise) { + return createAgentApiClient({ + apiUrl: "https://api.tegra.example", + agentKeyPair: agent, + now: () => NOW, + fetch: async () => response(), + }); + } + const request = { server_id: "survival", size_bytes: 10 }; + await expect( + clientFor(() => new Response("", { status: 413 })).requestBackupUploadUrl(request), + ).rejects.toMatchObject({ code: "quota_exceeded" }); + await expect( + clientFor(() => new Response("", { status: 429 })).requestBackupUploadUrl(request), + ).rejects.toMatchObject({ code: "rate_limited" }); + await expect( + clientFor(() => new Response("", { status: 500 })).requestBackupUploadUrl(request), + ).rejects.toMatchObject({ code: "http_error" }); + await expect( + clientFor(() => new Response("not json", { status: 200 })).requestBackupUploadUrl(request), + ).rejects.toMatchObject({ code: "invalid_response" }); + await expect( + clientFor( + () => new Response(JSON.stringify({ put_url: "x" }), { status: 200 }), + ).requestBackupUploadUrl(request), + ).rejects.toMatchObject({ code: "invalid_response" }); + await expect( + clientFor(() => { + throw new Error("boom"); + }).requestBackupUploadUrl(request), + ).rejects.toBeInstanceOf(AgentApiError); + await expect( + clientFor(() => new Response("x".repeat(70 * 1024), { status: 200 })).requestBackupUploadUrl( + request, + ), + ).rejects.toMatchObject({ code: "response_too_large" }); + }); + + test("refuses a non-https api_url", () => { + expect(() => + createAgentApiClient({ + apiUrl: "http://api.tegra.example", + agentKeyPair: generateSigningKeyPair(), + }), + ).toThrow(); + }); +}); + +describe("server status watcher", () => { + test("maps systemd states to client states", () => { + expect(mapUnitState("active")).toBe("running"); + expect(mapUnitState("activating")).toBe("starting"); + expect(mapUnitState("deactivating")).toBe("stopping"); + expect(mapUnitState("inactive")).toBe("stopped"); + expect(mapUnitState("failed")).toBe("crashed"); + expect(mapUnitState("maintenance")).toBeNull(); + }); + + test("polling sets a silent baseline and then emits every change once", async () => { + const states = new Map([ + ["a", "stopped"], + ["b", "running"], + ]); + const emitted: { server_id: string; state: string; at: number }[] = []; + const watcher = createServerStatusWatcher({ + listServerIds: () => [...states.keys()], + getState: async (id) => states.get(id) ?? null, + emit: (change) => emitted.push(change), + now: () => NOW, + }); + + await watcher.pollOnce(); + expect(emitted).toHaveLength(0); + + states.set("a", "starting"); + await watcher.pollOnce(); + await watcher.pollOnce(); + expect(emitted).toEqual([{ server_id: "a", state: "starting", at: NOW }]); + + states.set("a", "running"); + states.set("b", "crashed"); + await watcher.pollOnce(); + expect(emitted.map((e) => `${e.server_id}:${e.state}`)).toEqual([ + "a:starting", + "a:running", + "b:crashed", + ]); + }); + + test("refresh emits even without a baseline, forget clears it, and a failing read is ignored", async () => { + let state: "running" | "stopped" = "running"; + let fail = false; + const emitted: string[] = []; + const watcher = createServerStatusWatcher({ + listServerIds: () => ["a"], + getState: async () => { + if (fail) throw new Error("systemctl failed"); + return state; + }, + emit: (change) => emitted.push(change.state), + now: () => NOW, + }); + await watcher.refresh("a"); + await watcher.refresh("a"); + expect(emitted).toEqual(["running"]); + state = "stopped"; + fail = true; + await watcher.refresh("a"); + expect(emitted).toEqual(["running"]); + fail = false; + await watcher.refresh("a"); + expect(emitted).toEqual(["running", "stopped"]); + watcher.forget("a"); + await watcher.refresh("a"); + expect(emitted).toEqual(["running", "stopped", "stopped"]); + }); + + test("the timer only polls while shouldPoll says so", async () => { + const timer: { tick: (() => void) | null } = { tick: null }; + let polls = 0; + let wanted = false; + const watcher = createServerStatusWatcher({ + listServerIds: () => { + polls++; + return []; + }, + getState: async () => null, + emit: () => {}, + shouldPoll: () => wanted, + timers: { + setInterval: (fn) => { + timer.tick = fn; + return 1; + }, + clearInterval: () => { + timer.tick = null; + }, + }, + }); + watcher.start(); + timer.tick?.(); + await Promise.resolve(); + expect(polls).toBe(0); + wanted = true; + timer.tick?.(); + await Promise.resolve(); + expect(polls).toBe(1); + watcher.stop(); + expect(timer.tick).toBeNull(); + }); +}); + +describe("pairing API client signs its requests", () => { + test("register, poll and delete carry a signature the API can verify", async () => { + const agent = generateSigningKeyPair(); + const seen: { url: string; method: string; body: string | undefined; headers: Headers }[] = []; + const api = createPairingApiClient({ + apiUrl: "https://api.tegra.example", + agentKeyPair: agent, + now: () => NOW, + fetch: async (input, init) => { + seen.push({ + url: String(input), + method: init?.method ?? "GET", + body: typeof init?.body === "string" ? init.body : undefined, + headers: new Headers(init?.headers), + }); + return new Response(null, { status: init?.method === "POST" ? 201 : 202 }); + }, + }); + + await api.registerPairing("0123456789", toBase64Url(agent.publicKey)); + await api.pollGrant("0123456789"); + await api.deletePairing("0123456789"); + + expect(seen.map((r) => `${r.method} ${new URL(r.url).pathname}`)).toEqual([ + "POST /v1/agents/pairing", + "GET /v1/agents/pairing/0123456789/grant", + "DELETE /v1/agents/pairing/0123456789", + ]); + for (const request of seen) { + const verified = verifyAgentRequest({ + getHeader: (name) => request.headers.get(name), + method: request.method, + pathWithQuery: new URL(request.url).pathname, + body: request.body, + agentPublicKey: agent.publicKey, + now: NOW, + }); + expect(verified.agent).toBe(fingerprint(agent.publicKey)); + } + }); +}); + +describe("events that outlive their command", () => { + test("a held ctx stops delivering once the member's role is revoked or the certificate expires", async () => { + const h = makeHarness(); + const member = generateSigningKeyPair(); + const session = makeSession(member, NOW + 60_000); + await h.send( + "agent.members.set", + { + grant: signRoleGrant({ + granter: h.owner, + accountPublicKey: member.publicKey, + agent: h.agentId, + servers: ["alpha"], + role: "viewer", + issuedAt: NOW, + }), + }, + h.owner, + ); + const held: { ctx: { sendEvent(type: string, data: unknown): void } | null } = { ctx: null }; + h.queue.registerHandler("server.console.subscribe", (_opened, ctx) => { + held.ctx = ctx; + }); + const options = { session: session.certificate, replyTo: session.key.publicKey }; + await h.send("server.console.subscribe", { server_id: "alpha" }, session.key, options); + expect(lastAck(h.sent).ok).toBe(true); + + held.ctx?.sendEvent("server.console.lines", { n: 1 }); + expect(eventsFor(h.sent, h.agent, session.key)).toHaveLength(1); + + await h.send("agent.members.revoke", { account: fingerprint(member.publicKey) }, h.owner); + held.ctx?.sendEvent("server.console.lines", { n: 2 }); + expect(eventsFor(h.sent, h.agent, session.key)).toHaveLength(1); + }); + + test("an expired session certificate stops a held stream", async () => { + const h = makeHarness(); + const session = makeSession(h.owner, NOW + 60_000); + const held: { ctx: { sendEvent(type: string, data: unknown): void } | null } = { ctx: null }; + h.queue.registerHandler("server.console.subscribe", (_opened, ctx) => { + held.ctx = ctx; + }); + await h.send("server.console.subscribe", { server_id: "alpha" }, session.key, { + session: session.certificate, + replyTo: session.key.publicKey, + }); + held.ctx?.sendEvent("server.console.lines", { n: 1 }); + h.clock.now = NOW + 60_000; + held.ctx?.sendEvent("server.console.lines", { n: 2 }); + expect(eventsFor(h.sent, h.agent, session.key)).toHaveLength(1); + }); +}); diff --git a/src/agent/state.ts b/src/agent/state.ts index bf8a6dc..c127cfb 100644 --- a/src/agent/state.ts +++ b/src/agent/state.ts @@ -32,8 +32,13 @@ import { base64UrlSchema, type KeyId, keyIdSchema, + type MemberEntry, + type MemberStore, + memberEntrySchema, PROTOCOL_VERSION, ProtocolError, + type Role, + RoleTable, revocationListSchema, type TrustContext, verifyRevocationList, @@ -117,6 +122,11 @@ const revocationsFileSchema = z.object({ accounts: z.record(keyIdSchema, revocationAccountEntrySchema), }); +const membersFileSchema = z.object({ + v: z.literal(1), + members: z.array(memberEntrySchema), +}); + export interface RevocationAccountState { readonly issued_at: number; readonly revoked: readonly string[]; @@ -535,12 +545,37 @@ export function clearTrust(stateDir: string): void { } export function resetTrustState(stateDir: string): void { - const { trustPath, revocationsPath, replayPath } = getStatePaths(stateDir); + const { trustPath, revocationsPath, replayPath, membersPath } = getStatePaths(stateDir); unlinkIfExists(trustPath); + unlinkIfExists(membersPath); unlinkIfExists(revocationsPath); unlinkIfExists(replayPath); } +export function loadMembers(stateDir: string): MemberEntry[] { + const { membersPath } = getStatePaths(stateDir); + if (!existsSync(membersPath)) { + return []; + } + assertStrictPermissions(membersPath); + const raw = readJsonFile(membersPath, "members.json"); + const parsed = membersFileSchema.safeParse(raw); + if (!parsed.success) { + throw new StateError(`Invalid members.json at ${membersPath}`); + } + return parsed.data.members; +} + +export function saveMembers(stateDir: string, members: readonly MemberEntry[]): void { + const { membersPath } = getStatePaths(stateDir); + const content = `${JSON.stringify({ v: 1, members }, null, 2)} +`; + writeFileAtomic(membersPath, content, { + mode: SECRET_FILE_MODE, + dirMode: STATE_DIR_MODE, + }); +} + export function loadRevocations(stateDir: string): RevocationsState { const { revocationsPath } = getStatePaths(stateDir); if (!existsSync(revocationsPath)) { @@ -575,8 +610,11 @@ export async function applyRevocationList( } const trustedKeys = await loadTrust(stateDir); - const accountPublicKey = + let accountPublicKey = trustedKeys.find((key) => fingerprint(key) === parsed.data.account) ?? null; + if (accountPublicKey === null) { + accountPublicKey = new RoleTable(loadMembers(stateDir)).keyFor(parsed.data.account, Date.now()); + } if (accountPublicKey === null) { throw new ProtocolError("untrusted_signer", "Revocation list account is not trusted"); } @@ -700,7 +738,7 @@ export interface FileTrustContextOptions { readonly maxRecentIds?: number; } -export interface FileTrustContext extends TrustContext { +export interface FileTrustContext extends TrustContext, MemberStore { setRevokedSessionIds(ids: Iterable): void; applyRevocationList(list: unknown): Promise<{ readonly account: KeyId; readonly count: number }>; flush(): void; @@ -720,24 +758,58 @@ export function createFileTrustContext(options: FileTrustContextOptions): FileTr const clock = options.now ?? (() => Date.now()); const replay = loadReplayState(replayPath, maxRecentIds); + function ownerKey(id: KeyId): PublicKey | null { + if (existsSync(trustPath)) { + sawTrustFile = true; + const keys = loadTrustSync(trustPath); + for (const key of keys) { + if (fingerprint(key) === id) { + return key; + } + } + return null; + } + if (sawTrustFile) { + return null; + } + return fallbackTrusted.get(id) ?? null; + } + + function memberTable(): RoleTable { + return new RoleTable(loadMembers(options.stateDir)); + } + return { agentKeyPair: options.agentKeyPair, isTrustedAccountKey(id: KeyId): PublicKey | null { - if (existsSync(trustPath)) { - sawTrustFile = true; - const keys = loadTrustSync(trustPath); - for (const key of keys) { - if (fingerprint(key) === id) { - return key; - } - } - return null; + return ownerKey(id) ?? memberTable().keyFor(id, clock()); + }, + + roleFor(account: KeyId, serverId: string): Role | null { + if (ownerKey(account) !== null) { + return "owner"; } - if (sawTrustFile) { - return null; + return memberTable().roleFor(account, serverId, clock()); + }, + + listMembers(): readonly MemberEntry[] { + return loadMembers(options.stateDir); + }, + + setMember(entry: MemberEntry): void { + const table = memberTable(); + table.set(entry); + saveMembers(options.stateDir, table.entries()); + }, + + revokeMembers(account: KeyId, servers?: readonly string[]): number { + const table = memberTable(); + const changed = table.revoke(account, servers); + if (changed > 0) { + saveMembers(options.stateDir, table.entries()); } - return fallbackTrusted.get(id) ?? null; + return changed; }, isSessionRevoked(certificateId: string): boolean { diff --git a/src/agent/test-events.ts b/src/agent/test-events.ts new file mode 100644 index 0000000..540cd6c --- /dev/null +++ b/src/agent/test-events.ts @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import type { PublicKey, SigningKeyPair } from "../crypto"; +import { openAgentEvent } from "../protocol"; + +/** + * Test helper: opens an agent event and exposes the carried `data` as `body`, + * so assertions can ignore the `{ in_reply_to, data }` envelope. + */ +export function openTestEvent( + message: unknown, + agentPublicKey: PublicKey, + recipient: SigningKeyPair, +) { + const opened = openAgentEvent(message, agentPublicKey, recipient); + return { header: opened.header, inReplyTo: opened.inReplyTo, body: opened.data }; +} diff --git a/src/backup/backup.test.ts b/src/backup/backup.test.ts index 0527f0d..c25340b 100644 --- a/src/backup/backup.test.ts +++ b/src/backup/backup.test.ts @@ -17,13 +17,13 @@ import { tmpdir } from "node:os"; import { join } from "node:path"; import { createCommandQueue } from "../agent/jobs"; import { createLogger } from "../agent/logger"; +import { openTestEvent } from "../agent/test-events"; import { generateSigningKeyPair, ready, toBase64Url } from "../crypto"; import { createZipBuffer } from "../files"; import { createCoreRegistry, createInMemoryTrustContext, createSignedCommand, - openAgentMessage, openCommand, PROTOCOL_VERSION, ProtocolError, @@ -898,7 +898,7 @@ describe("Protocol commands, sensitivity, and server_id validation", () => { const events = frames .filter((f): f is Extract => f.kind === "event") - .map((f) => openAgentMessage(f.body, agentKeyPair.publicKey, accountKeyPair)); + .map((f) => openTestEvent(f.body, agentKeyPair.publicKey, accountKeyPair)); expect(events.map((e) => e.header.type)).toEqual([ "server.backup.config.updated", diff --git a/src/backup/cloud-upload-url.test.ts b/src/backup/cloud-upload-url.test.ts new file mode 100644 index 0000000..be6a1d9 --- /dev/null +++ b/src/backup/cloud-upload-url.test.ts @@ -0,0 +1,182 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, describe, expect, test } from "bun:test"; +import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { createBackupManager } from "./index"; +import type { CloudUploadTarget } from "./manager"; + +const tempDirs: string[] = []; + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir !== undefined) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +function setup() { + const root = mkdtempSync(join(tmpdir(), "tegrad-cloud-url-")); + tempDirs.push(root); + const serversDir = join(root, "servers"); + mkdirSync(join(serversDir, "cloudsrv", "world"), { recursive: true }); + writeFileSync(join(serversDir, "cloudsrv", "world", "level.dat"), "world-data", "utf8"); + return { root, serversDir }; +} + +function startStorage() { + const received: { method: string; headers: Headers; bytes: number }[] = []; + const server = Bun.serve({ + port: 0, + hostname: "127.0.0.1", + async fetch(req) { + received.push({ + method: req.method, + headers: req.headers, + bytes: (await req.arrayBuffer()).byteLength, + }); + return new Response(null, { status: 200 }); + }, + }); + return { server, received }; +} + +describe("Tegra Cloud upload URL from the control API", () => { + test("every upload asks the provider for a URL and sends the headers it returns", async () => { + const { root, serversDir } = setup(); + const { server, received } = startStorage(); + try { + const requests: { server_id: string; size_bytes: number }[] = []; + const manager = createBackupManager({ + stateDir: join(root, "state"), + serversBaseDir: serversDir, + localBackupsDir: join(root, "backups"), + allowInsecure: true, + cloudUploadUrlProvider: async (request): Promise => { + requests.push(request); + return { + put_url: `http://127.0.0.1:${server.port}/object?sig=secret-token`, + headers: { + "x-signed-header": "value-1", + "Content-Length": "1", + Host: "evil.example", + "bad header": "x", + }, + expires_at: Date.now() + 60_000, + max_bytes: 10 * 1024 * 1024, + }; + }, + }); + manager.setConfig({ + server_id: "cloudsrv", + local: { enabled: false }, + tegra_cloud: { enabled: true }, + }); + + const created = await manager.createBackup({ server_id: "cloudsrv" }); + expect(created.destinations[0]).toMatchObject({ destination: "tegra_cloud", ok: true }); + expect(requests).toEqual([{ server_id: "cloudsrv", size_bytes: created.size_bytes }]); + + const put = received[0]; + expect(put?.method).toBe("PUT"); + expect(put?.bytes).toBe(created.size_bytes); + expect(put?.headers.get("x-signed-header")).toBe("value-1"); + expect(put?.headers.get("x-tegra-backup-sha256")).toBe(created.sha256); + // Headers the transport owns cannot be overridden by the API response. + expect(put?.headers.get("content-length")).toBe(String(created.size_bytes)); + expect(put?.headers.get("host")).not.toBe("evil.example"); + + // A second (scheduled-style) backup asks again. + await manager.createBackup({ server_id: "cloudsrv", trigger: "scheduled" }); + expect(requests).toHaveLength(2); + } finally { + void server.stop(true); + } + }); + + test("the provider wins over a URL sent inside a command", async () => { + const { root, serversDir } = setup(); + const { server, received } = startStorage(); + const other = startStorage(); + try { + const manager = createBackupManager({ + stateDir: join(root, "state"), + serversBaseDir: serversDir, + localBackupsDir: join(root, "backups"), + allowInsecure: true, + cloudUploadUrlProvider: async () => ({ + put_url: `http://127.0.0.1:${server.port}/object`, + headers: {}, + expires_at: Date.now() + 60_000, + max_bytes: 10 * 1024 * 1024, + }), + }); + manager.setConfig({ + server_id: "cloudsrv", + local: { enabled: false }, + tegra_cloud: { enabled: true }, + }); + const created = await manager.createBackup({ + server_id: "cloudsrv", + tegra_cloud_upload_url: `http://127.0.0.1:${other.server.port}/elsewhere`, + }); + expect(created.destinations[0]?.ok).toBe(true); + expect(received).toHaveLength(1); + expect(other.received).toHaveLength(0); + } finally { + void server.stop(true); + void other.server.stop(true); + } + }); + + test("a backup larger than max_bytes is not uploaded and a provider failure only fails that destination", async () => { + const { root, serversDir } = setup(); + const { server, received } = startStorage(); + try { + let mode: "too_big" | "fail" = "too_big"; + const manager = createBackupManager({ + stateDir: join(root, "state"), + serversBaseDir: serversDir, + localBackupsDir: join(root, "backups"), + allowInsecure: true, + cloudUploadUrlProvider: async () => { + if (mode === "fail") { + throw new Error("request to https://api.tegra.example/x?sig=top-secret failed"); + } + return { + put_url: `http://127.0.0.1:${server.port}/object`, + headers: {}, + expires_at: Date.now() + 60_000, + max_bytes: 1, + }; + }, + }); + manager.setConfig({ + server_id: "cloudsrv", + local: { enabled: true }, + tegra_cloud: { enabled: true }, + }); + + const tooBig = await manager.createBackup({ server_id: "cloudsrv" }); + const cloud = tooBig.destinations.find((d) => d.destination === "tegra_cloud"); + const local = tooBig.destinations.find((d) => d.destination === "local"); + expect(cloud?.ok).toBe(false); + expect(local?.ok).toBe(true); + expect(received).toHaveLength(0); + + mode = "fail"; + const failed = await manager.createBackup({ server_id: "cloudsrv" }); + const failedCloud = failed.destinations.find((d) => d.destination === "tegra_cloud"); + expect(failedCloud?.ok).toBe(false); + expect(failed.destinations.find((d) => d.destination === "local")?.ok).toBe(true); + expect(JSON.stringify(failedCloud)).not.toContain("top-secret"); + expect(received).toHaveLength(0); + } finally { + void server.stop(true); + } + }); +}); diff --git a/src/backup/destinations/tegra-cloud.ts b/src/backup/destinations/tegra-cloud.ts index a7281b6..432bdac 100644 --- a/src/backup/destinations/tegra-cloud.ts +++ b/src/backup/destinations/tegra-cloud.ts @@ -137,6 +137,28 @@ async function readResponseBytesCapped(response: Response, maxBytes: number): Pr return out; } +const FORBIDDEN_UPLOAD_HEADERS = new Set(["content-length", "host", "transfer-encoding"]); +const HEADER_NAME_REGEX = /^[A-Za-z0-9-]{1,128}$/; + +/** Keeps the headers the control API asked for, minus those the transport sets itself. */ +function sanitizeUploadHeaders( + headers: Readonly> | undefined, +): Record { + const out: Record = {}; + for (const [name, value] of Object.entries(headers ?? {})) { + if ( + !HEADER_NAME_REGEX.test(name) || + FORBIDDEN_UPLOAD_HEADERS.has(name.toLowerCase()) || + /[\r\n\0]/.test(value) || + value.length > 2048 + ) { + continue; + } + out[name] = value; + } + return out; +} + export class TegraCloudBackupDestination implements BackupDestination { readonly kind = "tegra_cloud" as const; readonly indexPath: string; @@ -223,10 +245,11 @@ export class TegraCloudBackupDestination implements BackupDestination { method: "PUT", headers: { "Content-Type": "application/zip", - "Content-Length": String(archive.byteLength), "X-Tegra-Backup-Id": validBackupId, "X-Tegra-Server-Id": validServerId, "X-Tegra-Backup-Sha256": ctx.sha256, + ...sanitizeUploadHeaders(ctx.presignedUploadHeaders), + "Content-Length": String(archive.byteLength), }, body: archive, redirect: "manual", diff --git a/src/backup/manager.ts b/src/backup/manager.ts index 34bf4fb..222ff2c 100644 --- a/src/backup/manager.ts +++ b/src/backup/manager.ts @@ -66,6 +66,18 @@ export interface CreateBackupOptions { readonly tegra_cloud_upload_url?: string; } +export interface CloudUploadTarget { + readonly put_url: string; + readonly headers: Readonly>; + readonly expires_at: number; + readonly max_bytes: number; +} + +export type CloudUploadUrlProvider = (request: { + readonly server_id: string; + readonly size_bytes: number; +}) => Promise; + export interface BackupManagerOptions { readonly stateDir: string; readonly serversBaseDir?: string; @@ -79,6 +91,12 @@ export interface BackupManagerOptions { readonly cloudMaxBytes?: number; readonly cloudAllowedHosts?: ReadonlySet; readonly cloudFetchImpl?: CloudFetchLike; + /** + * Asks the control API where to upload a Tegra Cloud backup. When set it is + * used for every Tegra Cloud upload (manual and scheduled) and a URL sent + * inside a command is ignored. + */ + readonly cloudUploadUrlProvider?: CloudUploadUrlProvider; readonly s3MaxBytes?: number; readonly maxArchiveFiles?: number; readonly maxArchiveBytes?: number; @@ -187,6 +205,19 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage const outcomes: BackupDestinationOutcome[] = []; for (const dest of enabledDestinations) { try { + let cloudTarget: CloudUploadTarget | undefined; + if (dest.kind === "tegra_cloud" && options.cloudUploadUrlProvider !== undefined) { + cloudTarget = await options.cloudUploadUrlProvider({ + server_id: validServerId, + size_bytes: archiveResult.buffer.byteLength, + }); + if (archiveResult.buffer.byteLength > cloudTarget.max_bytes) { + throw new ProtocolError( + "backup_failed", + `Backup archive size (${archiveResult.buffer.byteLength}) exceeds the allowed upload size (${cloudTarget.max_bytes})`, + ); + } + } const meta = await dest.upload(archiveResult.buffer, { serverId: validServerId, backupId, @@ -197,9 +228,14 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage ...(params.retention_count !== undefined ? { retentionCount: params.retention_count } : {}), - ...(dest.kind === "tegra_cloud" && params.tegra_cloud_upload_url !== undefined - ? { presignedUploadUrl: params.tegra_cloud_upload_url } - : {}), + ...(cloudTarget !== undefined + ? { + presignedUploadUrl: cloudTarget.put_url, + presignedUploadHeaders: cloudTarget.headers, + } + : dest.kind === "tegra_cloud" && params.tegra_cloud_upload_url !== undefined + ? { presignedUploadUrl: params.tegra_cloud_upload_url } + : {}), }); outcomes.push({ destination: dest.kind, diff --git a/src/backup/types.ts b/src/backup/types.ts index 3c5eb20..589db5b 100644 --- a/src/backup/types.ts +++ b/src/backup/types.ts @@ -25,6 +25,8 @@ export interface BackupUploadContext { readonly note?: string; readonly retentionCount?: number; readonly presignedUploadUrl?: string; + /** Extra headers the upload URL was issued for (e.g. a signed content type). */ + readonly presignedUploadHeaders?: Readonly>; } export interface BackupDownloadOptions { diff --git a/src/cli/e2e.test.ts b/src/cli/e2e.test.ts index 3526de1..786f351 100644 --- a/src/cli/e2e.test.ts +++ b/src/cli/e2e.test.ts @@ -12,6 +12,7 @@ import { loadTrust, runPairingFlow, } from "../agent"; +import { openTestEvent } from "../agent/test-events"; import { fingerprint, fromBase64Url, @@ -22,13 +23,15 @@ import { } from "../crypto"; import { createCoreRegistry, + createHelloFrame, createSignedCommand, - openAgentMessage, PROTOCOL_VERSION, parsePairingFragment, signTrustGrant, type TransportFrame, transportFrameSchema, + verifyAgentAuth, + verifyAgentRequest, } from "../protocol"; import { createCommandFromSession, createVault, issueSession } from "../vault"; import { createAgentRuntime } from "./run"; @@ -81,12 +84,14 @@ describe("E2E local WebSocket ping/pong", () => { registry, ); + let helloNonce = ""; + let authVerified = false; const server = Bun.serve({ hostname: "127.0.0.1", port: 0, fetch(req, srv) { const url = new URL(req.url); - if (url.pathname === "/agents/connect" && url.searchParams.get("agent") === agentId) { + if (url.pathname === "/v1/agents/connect" && url.searchParams.get("agent") === agentId) { if (srv.upgrade(req)) { return; } @@ -95,17 +100,29 @@ describe("E2E local WebSocket ping/pong", () => { }, websocket: { open(ws) { - const commandFrame: TransportFrame = { - v: PROTOCOL_VERSION, - kind: "command", - route: { agent: agentId }, - body: signedPing, - }; - ws.send(JSON.stringify(commandFrame)); + const hello = createHelloFrame({ agent: agentId, serverTime: Date.now() }); + helloNonce = hello.body.nonce; + ws.send(JSON.stringify(hello)); }, - message(_ws, message) { + message(ws, message) { const text = typeof message === "string" ? message : new TextDecoder().decode(message); const frame = transportFrameSchema.parse(JSON.parse(text)); + if (frame.kind === "auth") { + verifyAgentAuth(frame, { + agentPublicKey: agent.publicKey, + expectedNonce: helloNonce, + now: Date.now(), + }); + authVerified = true; + const commandFrame: TransportFrame = { + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: agentId }, + body: signedPing, + }; + ws.send(JSON.stringify(commandFrame)); + return; + } receivedFrames.push(frame); const hasEvent = receivedFrames.some((f) => f.kind === "event"); const hasAck = receivedFrames.some((f) => f.kind === "ack"); @@ -144,12 +161,13 @@ describe("E2E local WebSocket ping/pong", () => { ), ]); + expect(authVerified).toBe(true); const eventFrame = receivedFrames.find((f) => f.kind === "event"); const ackFrame = receivedFrames.find((f) => f.kind === "ack"); expect(eventFrame).toBeDefined(); if (eventFrame?.kind === "event") { - const opened = openAgentMessage(eventFrame.body, agent.publicKey, account); + const opened = openTestEvent(eventFrame.body, agent.publicKey, account); expect(opened.header.type).toBe("agent.pong"); expect(opened.body).toEqual({ at: now }); } @@ -180,26 +198,43 @@ describe("E2E local WebSocket ping/pong", () => { resolveBoth = resolve; }); let commandToSend: ReturnType | null = null; + let helloNonce = ""; + let authVerified = false; + function agentPublicKeyFromPairing(): Uint8Array | null { + for (const entry of pairings.values()) { + return fromBase64Url(entry.agentPublicKeyB64); + } + return null; + } const server = Bun.serve({ hostname: "127.0.0.1", port: 0, async fetch(req, srv) { const url = new URL(req.url); - if (url.pathname === "/agents/connect" && url.searchParams.get("agent") === agentId) { + if (url.pathname === "/v1/agents/connect" && url.searchParams.get("agent") === agentId) { if (srv.upgrade(req)) { return; } } - if (req.method === "POST" && url.pathname === "/agents/pairing") { - const body = (await req.json()) as { code: string; agent_public_key: string }; + if (req.method === "POST" && url.pathname === "/v1/agents/pairing") { + const raw = await req.text(); + const body = JSON.parse(raw) as { code: string; agent_public_key: string }; + verifyAgentRequest({ + getHeader: (name) => req.headers.get(name), + method: req.method, + pathWithQuery: `${url.pathname}${url.search}`, + body: raw, + agentPublicKey: fromBase64Url(body.agent_public_key), + now: Date.now(), + }); if (pairings.has(body.code)) { return new Response(null, { status: 409 }); } pairings.set(body.code, { agentPublicKeyB64: body.agent_public_key }); return new Response(null, { status: 201 }); } - const grantMatch = url.pathname.match(/^\/agents\/pairing\/([^/]+)\/grant$/); + const grantMatch = url.pathname.match(/^\/v1\/agents\/pairing\/([^/]+)\/grant$/); if (grantMatch) { const code = decodeURIComponent(grantMatch[1] ?? ""); const entry = pairings.get(code); @@ -212,6 +247,13 @@ describe("E2E local WebSocket ping/pong", () => { return new Response(null, { status: 200 }); } if (req.method === "GET") { + verifyAgentRequest({ + getHeader: (name) => req.headers.get(name), + method: req.method, + pathWithQuery: `${url.pathname}${url.search}`, + agentPublicKey: fromBase64Url(entry.agentPublicKeyB64), + now: Date.now(), + }); if (entry.grant === undefined) { return new Response(null, { status: 202 }); } @@ -221,7 +263,7 @@ describe("E2E local WebSocket ping/pong", () => { }); } } - const pairingMatch = url.pathname.match(/^\/agents\/pairing\/([^/]+)$/); + const pairingMatch = url.pathname.match(/^\/v1\/agents\/pairing\/([^/]+)$/); if (pairingMatch) { const code = decodeURIComponent(pairingMatch[1] ?? ""); const entry = pairings.get(code); @@ -241,19 +283,34 @@ describe("E2E local WebSocket ping/pong", () => { }, websocket: { open(ws) { - if (commandToSend !== null) { - const frame: TransportFrame = { - v: PROTOCOL_VERSION, - kind: "command", - route: { agent: agentId }, - body: commandToSend, - }; - ws.send(JSON.stringify(frame)); - } + const hello = createHelloFrame({ agent: agentId, serverTime: Date.now() }); + helloNonce = hello.body.nonce; + ws.send(JSON.stringify(hello)); }, - message(_ws, message) { + message(ws, message) { const text = typeof message === "string" ? message : new TextDecoder().decode(message); const frame = transportFrameSchema.parse(JSON.parse(text)); + if (frame.kind === "auth") { + const agentPublicKey = pairings.size > 0 ? agentPublicKeyFromPairing() : null; + if (agentPublicKey !== null) { + verifyAgentAuth(frame, { + agentPublicKey, + expectedNonce: helloNonce, + now: Date.now(), + }); + } + authVerified = true; + if (commandToSend !== null) { + const out: TransportFrame = { + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: agentId }, + body: commandToSend, + }; + ws.send(JSON.stringify(out)); + } + return; + } receivedFrames.push(frame); const hasEvent = receivedFrames.some((f) => f.kind === "event"); const hasAck = receivedFrames.some((f) => f.kind === "ack"); @@ -291,7 +348,7 @@ describe("E2E local WebSocket ping/pong", () => { clientCompleted = true; const fragment = parsePairingFragment(new URL(match[1]).hash); void (async () => { - const res = await fetch(`${apiBase}/agents/pairing/${fragment.code}`); + const res = await fetch(`${apiBase}/v1/agents/pairing/${fragment.code}`); const data = (await res.json()) as { agent_public_key: string }; const fetchedAgentPub = fromBase64Url(data.agent_public_key); expect(fragment.agentFingerprint).toBeDefined(); @@ -303,7 +360,7 @@ describe("E2E local WebSocket ping/pong", () => { ...(fragment.secret !== undefined ? { secret: fragment.secret } : {}), issuedAt: now, }); - await fetch(`${apiBase}/agents/pairing/${fragment.code}/grant`, { + await fetch(`${apiBase}/v1/agents/pairing/${fragment.code}/grant`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ grant }), @@ -347,11 +404,12 @@ describe("E2E local WebSocket ping/pong", () => { ), ]); + expect(authVerified).toBe(true); const eventFrame = receivedFrames.find((f) => f.kind === "event"); const ackFrame = receivedFrames.find((f) => f.kind === "ack"); expect(eventFrame?.kind).toBe("event"); if (eventFrame?.kind === "event") { - const opened = openAgentMessage(eventFrame.body, agent.publicKey, vault.unlocked.keyPair); + const opened = openTestEvent(eventFrame.body, agent.publicKey, vault.unlocked.keyPair); expect(opened.header.type).toBe("agent.pong"); expect(opened.body).toEqual({ at: now }); } diff --git a/src/cli/files-wiring.test.ts b/src/cli/files-wiring.test.ts index 055d18f..e96f033 100644 --- a/src/cli/files-wiring.test.ts +++ b/src/cli/files-wiring.test.ts @@ -8,6 +8,7 @@ import { tmpdir } from "node:os"; import { join } from "node:path"; import { z } from "zod"; import { createLogger, getStatePaths, loadOrCreateIdentity } from "../agent"; +import { openTestEvent } from "../agent/test-events"; import { fingerprint, generateSigningKeyPair, @@ -18,10 +19,10 @@ import { import { CommandRegistry, createCoreRegistry, + createHelloFrame, createSignedCommand, defineCommand, FILES_COMMANDS, - openAgentMessage, PROTOCOL_VERSION, signSessionCertificate, type TransportFrame, @@ -115,12 +116,15 @@ async function createHarness(serverId = "srv-1"): Promise { }; queueMicrotask(() => { socket.onopen?.(); + socket.onmessage?.({ + data: JSON.stringify(createHelloFrame({ agent: agentId, serverTime: Date.now() })), + }); }); return socket; }, }); wsRuntime.start(); - await Promise.resolve(); + await new Promise((resolve) => setTimeout(resolve, 10)); const registry = createCoreRegistry(); let accountCounter = 1; @@ -168,7 +172,7 @@ async function createHarness(serverId = "srv-1"): Promise { const events = newFrames .filter((f): f is Extract => f.kind === "event") .map((f) => { - const opened = openAgentMessage(f.body, agent.publicKey, account); + const opened = openTestEvent(f.body, agent.publicKey, account); return { type: opened.header.type, body: opened.body }; }); @@ -449,6 +453,7 @@ describe("files.* runtime wiring", () => { defineCommand({ type: cmd.type, sensitive: cmd.sensitive, + minRole: cmd.minRole, body: z.unknown(), }), ); diff --git a/src/cli/run.ts b/src/cli/run.ts index 42c70fe..78159c3 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -5,12 +5,14 @@ import { z } from "zod"; import { type AgentConnection, type CommandQueue, + createAgentApiClient, createAgentConnection, createCommandQueue, createFileTrustContext, createLogger, type FetchLike, type FileTrustContext, + isInsecureAllowed, type Logger, loadConfig, loadOrCreateIdentity, @@ -21,8 +23,19 @@ import { import { type BackupManager, createBackupManager, registerBackupHandlers } from "../backup"; import { fingerprint } from "../crypto"; import { FileManager, registerFileCommandHandlers } from "../files"; -import { type CommandRegistry, createCoreRegistry, type TransportFrame } from "../protocol"; -import { createServerManager, registerServerHandlers, type ServerManager } from "../server"; +import { + type CommandRegistry, + createCoreRegistry, + signAgentAuth, + type TransportFrame, +} from "../protocol"; +import { + createServerManager, + createServerStatusWatcher, + registerServerHandlers, + type ServerManager, + type ServerStatusWatcher, +} from "../server"; import { createStateManager, registerStateHandlers, type StateManager } from "../state"; import { createPlayitTunnelManager, @@ -119,7 +132,39 @@ export async function createAgentRuntime( ...(configuredRunDir && configuredRunDir.length > 0 ? { runDir: configuredRunDir } : {}), ...(options.now !== undefined ? { now: options.now } : {}), }); - registerServerHandlers(queue, serverManager); + const statusWatcher: ServerStatusWatcher = createServerStatusWatcher({ + listServerIds: () => serverManager.listServers().map((server) => server.id), + getState: (serverId) => serverManager.getServerState(serverId), + emit: (change) => { + queue.publish("server.status", "server.status.changed", change, { + serverId: change.server_id, + }); + }, + shouldPoll: () => queue.subscriberCount() > 0, + ...(options.now !== undefined ? { now: options.now } : {}), + ...(options.timers !== undefined + ? { + timers: { + setInterval: (fn: () => void, ms: number) => options.timers?.setInterval(fn, ms), + clearInterval: (handle: unknown) => options.timers?.clearInterval(handle), + }, + } + : {}), + }); + registerServerHandlers(queue, serverManager, { + onStateChanged: (serverId) => { + void statusWatcher.refresh(serverId); + }, + onDeleted: (serverId) => statusWatcher.forget(serverId), + }); + + const apiClient = createAgentApiClient({ + apiUrl: config.apiUrl, + agentKeyPair, + allowInsecure: isInsecureAllowed(env), + ...(options.fetch !== undefined ? { fetch: options.fetch } : {}), + ...(options.now !== undefined ? { now: options.now } : {}), + }); const fileManager = new FileManager( configuredServersDir && configuredServersDir.length > 0 @@ -154,6 +199,7 @@ export async function createAgentRuntime( }, }, ...(options.fetch !== undefined ? { cloudFetchImpl: options.fetch } : {}), + cloudUploadUrlProvider: (request) => apiClient.requestBackupUploadUrl(request), ...(options.timers !== undefined ? { timers: { @@ -195,6 +241,7 @@ export async function createAgentRuntime( apiUrl: config.apiUrl, agentId, logger, + answerHello: (hello) => signAgentAuth({ agentKeyPair, hello, ts: (options.now ?? Date.now)() }), onFrame: (frame) => { if (frame.kind === "command") { void queue.enqueue(frame); @@ -238,6 +285,7 @@ export async function createAgentRuntime( start(): void { logger.info("Starting tegrad", { agentId }); connection.start(); + statusWatcher.start(); updater.start(); backupManager.start(); }, @@ -249,6 +297,7 @@ export async function createAgentRuntime( shutdownPromise = (async () => { logger.info("Shutting down tegrad"); updater.stop(); + statusWatcher.stop(); backupManager.close(); await tunnelManager.close(); serverManager?.close(); diff --git a/src/crypto/hash.ts b/src/crypto/hash.ts index 02568e4..79b16dc 100644 --- a/src/crypto/hash.ts +++ b/src/crypto/hash.ts @@ -20,3 +20,9 @@ export function hash(data: Uint8Array, key?: Uint8Array): Uint8Array { } return s.crypto_generichash(HASH_BYTES, data, null); } + +export const SHA256_BYTES = 32; + +export function sha256(data: Uint8Array): Uint8Array { + return getSodium().crypto_hash_sha256(data); +} diff --git a/src/crypto/index.ts b/src/crypto/index.ts index 62df0f2..c4e3b0b 100644 --- a/src/crypto/index.ts +++ b/src/crypto/index.ts @@ -12,7 +12,7 @@ export { export { openSealed, sealTo } from "./box"; export { canonicalize } from "./canonical"; export { fromBase64Url, toBase32, toBase64Url } from "./encoding"; -export { HASH_BYTES, hash } from "./hash"; +export { HASH_BYTES, hash, SHA256_BYTES, sha256 } from "./hash"; export { assertKdfParams, deriveKeyFromPassword, diff --git a/src/files/adversarial.test.ts b/src/files/adversarial.test.ts index dc095c9..5797caa 100644 --- a/src/files/adversarial.test.ts +++ b/src/files/adversarial.test.ts @@ -20,12 +20,12 @@ import { join } from "node:path"; import { deflateRawSync } from "node:zlib"; import { createCommandQueue, type TransportCommandFrame } from "../agent/jobs"; import { createLogger } from "../agent/logger"; +import { openTestEvent } from "../agent/test-events"; import { fingerprint, generateSigningKeyPair, ready } from "../crypto"; import { createCoreRegistry, createInMemoryTrustContext, createSignedCommand, - openAgentMessage, PROTOCOL_VERSION, type SignedCommand, signSessionCertificate, @@ -810,7 +810,7 @@ describe("adversarial file confinement and archive security", () => { const ack = sent[1]; expect(ev?.kind).toBe("event"); if (ev?.kind === "event") { - const opened = openAgentMessage(ev.body, agent.publicKey, account); + const opened = openTestEvent(ev.body, agent.publicKey, account); expect(opened.header.type).toBe("files.error"); expect((opened.body as { code: string }).code).toBe("invalid_encoding"); } diff --git a/src/files/manager.test.ts b/src/files/manager.test.ts index 5340b36..a9ef1ff 100644 --- a/src/files/manager.test.ts +++ b/src/files/manager.test.ts @@ -17,6 +17,7 @@ import { join } from "node:path"; import { z } from "zod"; import { createCommandQueue, type TransportCommandFrame } from "../agent/jobs"; import { createLogger } from "../agent/logger"; +import { openTestEvent } from "../agent/test-events"; import { fingerprint, generateSigningKeyPair, ready } from "../crypto"; import { CommandRegistry, @@ -25,7 +26,6 @@ import { createSignedCommand, defineCommand, FILES_COMMANDS, - openAgentMessage, openCommand, PROTOCOL_VERSION, ProtocolError, @@ -638,6 +638,7 @@ describe("protocol integration (CommandRegistry, openCommand, CommandQueue)", () defineCommand({ type: "files.list", sensitive: false, + minRole: "viewer", body: z.unknown(), }), ); @@ -711,7 +712,7 @@ describe("protocol integration (CommandRegistry, openCommand, CommandQueue)", () const writeAck = sent[1]; expect(writeEvent?.kind).toBe("event"); if (writeEvent?.kind === "event") { - const opened = openAgentMessage(writeEvent.body, agent.publicKey, account); + const opened = openTestEvent(writeEvent.body, agent.publicKey, account); expect(opened.header.type).toBe("files.write.result"); expect(opened.body).toEqual({ path: "eula.txt", size: 10 }); } @@ -735,7 +736,7 @@ describe("protocol integration (CommandRegistry, openCommand, CommandQueue)", () const readEvent = sent[2]; expect(readEvent?.kind).toBe("event"); if (readEvent?.kind === "event") { - const opened = openAgentMessage(readEvent.body, agent.publicKey, account); + const opened = openTestEvent(readEvent.body, agent.publicKey, account); expect(opened.header.type).toBe("files.read.result"); expect(opened.body).toEqual({ path: "eula.txt", @@ -763,7 +764,7 @@ describe("protocol integration (CommandRegistry, openCommand, CommandQueue)", () const errAck = sent[5]; expect(errEvent?.kind).toBe("event"); if (errEvent?.kind === "event") { - const opened = openAgentMessage(errEvent.body, agent.publicKey, account); + const opened = openTestEvent(errEvent.body, agent.publicKey, account); expect(opened.header.type).toBe("files.error"); expect((opened.body as { code: string }).code).toBe("path_traversal"); } @@ -789,7 +790,7 @@ describe("protocol integration (CommandRegistry, openCommand, CommandQueue)", () const deleteAck = sent[7]; expect(deleteEvent?.kind).toBe("event"); if (deleteEvent?.kind === "event") { - const opened = openAgentMessage(deleteEvent.body, agent.publicKey, account); + const opened = openTestEvent(deleteEvent.body, agent.publicKey, account); expect(opened.header.type).toBe("files.delete.result"); expect(opened.body).toEqual({ path: "eula.txt", deleted: true }); } diff --git a/src/protocol/agent-auth.ts b/src/protocol/agent-auth.ts new file mode 100644 index 0000000..18dd0c3 --- /dev/null +++ b/src/protocol/agent-auth.ts @@ -0,0 +1,237 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { + canonicalize, + fingerprint, + fromBase64Url, + type PublicKey, + randomBytes, + type SigningKeyPair, + sha256, + sign, + toBase64Url, + verify, +} from "../crypto"; +import { concatBytes, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, PROTOCOL_VERSION } from "./domains"; +import { ProtocolError } from "./errors"; +import { + AGENT_NONCE_BYTES, + agentNonceSchema, + type KeyId, + keyIdSchema, + type TransportFrame, + transportAuthFrameSchema, + transportHelloFrameSchema, +} from "./schemas"; + +export const AGENT_AUTH_MAX_SKEW_MS = 60_000; +export const AGENT_HTTP_MAX_SKEW_MS = 60_000; + +export const AGENT_HTTP_HEADER_AGENT = "X-Tegra-Agent"; +export const AGENT_HTTP_HEADER_TS = "X-Tegra-Ts"; +export const AGENT_HTTP_HEADER_SIG = "X-Tegra-Sig"; + +export type HelloFrame = Extract; +export type AuthFrame = Extract; + +const utf8Encoder = new TextEncoder(); + +function toHex(bytes: Uint8Array): string { + let out = ""; + for (const byte of bytes) { + out += byte.toString(16).padStart(2, "0"); + } + return out; +} + +/** Fresh nonce for a `hello` frame. */ +export function generateAgentNonce(): string { + return toBase64Url(randomBytes(AGENT_NONCE_BYTES)); +} + +export function createHelloFrame(params: { + readonly agent: KeyId; + readonly serverTime: number; + readonly nonce?: string; +}): HelloFrame { + return transportHelloFrameSchema.parse({ + v: PROTOCOL_VERSION, + kind: "hello", + route: { agent: params.agent }, + body: { nonce: params.nonce ?? generateAgentNonce(), server_time: params.serverTime }, + }); +} + +function authSigningInput(agent: KeyId, nonce: string, ts: number): Uint8Array { + return concatBytes(DOMAIN_AGENT_AUTH, canonicalize({ agent, nonce, ts })); +} + +/** Agent side: answers the API's `hello` challenge. */ +export function signAgentAuth(params: { + readonly agentKeyPair: SigningKeyPair; + readonly hello: unknown; + readonly ts: number; +}): AuthFrame { + const parsed = transportHelloFrameSchema.safeParse(params.hello); + if (!parsed.success) { + throw new ProtocolError("invalid_format", "Malformed hello frame"); + } + const agent = fingerprint(params.agentKeyPair.publicKey); + if (parsed.data.route.agent !== agent) { + throw new ProtocolError("wrong_agent", "Hello frame is addressed to a different agent"); + } + const nonce = parsed.data.body.nonce; + const signature = sign(authSigningInput(agent, nonce, params.ts), params.agentKeyPair.secretKey); + return transportAuthFrameSchema.parse({ + v: PROTOCOL_VERSION, + kind: "auth", + route: { agent }, + body: { nonce, ts: params.ts, sig: toBase64Url(signature) }, + }); +} + +export interface VerifyAgentAuthOptions { + readonly agentPublicKey: PublicKey; + /** The nonce the API sent in `hello` for this connection. */ + readonly expectedNonce: string; + readonly now: number; + readonly maxSkewMs?: number; + /** Nonces already accepted; a repeated nonce is refused and a new one is recorded. */ + readonly usedNonces?: Set; +} + +/** API side: checks an `auth` frame against the challenge that was issued. */ +export function verifyAgentAuth(frame: unknown, options: VerifyAgentAuthOptions): AuthFrame { + const parsed = transportAuthFrameSchema.safeParse(frame); + if (!parsed.success) { + throw new ProtocolError("invalid_format", "Malformed auth frame"); + } + const { route, body } = parsed.data; + const agent = fingerprint(options.agentPublicKey); + if (route.agent !== agent) { + throw new ProtocolError("wrong_agent", "Auth frame is addressed to a different agent"); + } + if (!agentNonceSchema.safeParse(options.expectedNonce).success) { + throw new ProtocolError("auth_invalid", "Invalid challenge nonce"); + } + if (body.nonce !== options.expectedNonce) { + throw new ProtocolError("auth_invalid", "Auth nonce does not match the challenge"); + } + if (options.usedNonces?.has(body.nonce)) { + throw new ProtocolError("replayed", "Auth nonce was already used"); + } + const maxSkew = options.maxSkewMs ?? AGENT_AUTH_MAX_SKEW_MS; + if (Math.abs(options.now - body.ts) > maxSkew) { + throw new ProtocolError("auth_invalid", "Auth timestamp is outside the allowed window"); + } + + let signatureBytes: Uint8Array; + try { + signatureBytes = fromBase64Url(body.sig); + } catch { + throw new ProtocolError("bad_signature", "Invalid auth signature encoding"); + } + if ( + !verify(authSigningInput(agent, body.nonce, body.ts), signatureBytes, options.agentPublicKey) + ) { + throw new ProtocolError("bad_signature", "Invalid auth signature"); + } + + options.usedNonces?.add(body.nonce); + return parsed.data; +} + +export type AgentRequestBody = Uint8Array | string | null | undefined; + +function bodyBytes(body: AgentRequestBody): Uint8Array { + if (body === null || body === undefined) { + return new Uint8Array(0); + } + return typeof body === "string" ? utf8Encoder.encode(body) : body; +} + +function httpSigningInput( + method: string, + pathWithQuery: string, + body: AgentRequestBody, + ts: number, +): Uint8Array { + const bodyHash = toHex(sha256(bodyBytes(body))); + return concatBytes( + DOMAIN_AGENT_HTTP, + utf8Encoder.encode(`${method.toUpperCase()}\n${pathWithQuery}\n${bodyHash}\n${ts}`), + ); +} + +export interface SignAgentRequestParams { + readonly agentKeyPair: SigningKeyPair; + readonly method: string; + /** Request path including the query string, exactly as sent on the wire. */ + readonly pathWithQuery: string; + readonly body?: AgentRequestBody; + readonly ts: number; +} + +/** Returns the `X-Tegra-Agent`, `X-Tegra-Ts` and `X-Tegra-Sig` headers. */ +export function signAgentRequest(params: SignAgentRequestParams): Record { + if (!params.pathWithQuery.startsWith("/")) { + throw new RangeError("pathWithQuery must start with /"); + } + const signature = sign( + httpSigningInput(params.method, params.pathWithQuery, params.body, params.ts), + params.agentKeyPair.secretKey, + ); + return { + [AGENT_HTTP_HEADER_AGENT]: fingerprint(params.agentKeyPair.publicKey), + [AGENT_HTTP_HEADER_TS]: String(params.ts), + [AGENT_HTTP_HEADER_SIG]: toBase64Url(signature), + }; +} + +export interface VerifyAgentRequestParams { + /** Case-insensitive header lookup (e.g. `(name) => request.headers.get(name)`). */ + readonly getHeader: (name: string) => string | null | undefined; + readonly method: string; + readonly pathWithQuery: string; + readonly body?: AgentRequestBody; + readonly agentPublicKey: PublicKey; + readonly now: number; + readonly maxSkewMs?: number; +} + +export function verifyAgentRequest(params: VerifyAgentRequestParams): { readonly agent: KeyId } { + const agentHeader = params.getHeader(AGENT_HTTP_HEADER_AGENT); + const tsHeader = params.getHeader(AGENT_HTTP_HEADER_TS); + const sigHeader = params.getHeader(AGENT_HTTP_HEADER_SIG); + if (!agentHeader || !tsHeader || !sigHeader) { + throw new ProtocolError("request_invalid", "Missing agent signature headers"); + } + const agent = keyIdSchema.safeParse(agentHeader); + if (!agent.success || agent.data !== fingerprint(params.agentPublicKey)) { + throw new ProtocolError("wrong_agent", "Request signed by a different agent"); + } + if (!/^\d{1,16}$/.test(tsHeader)) { + throw new ProtocolError("request_invalid", "Invalid request timestamp"); + } + const ts = Number(tsHeader); + const maxSkew = params.maxSkewMs ?? AGENT_HTTP_MAX_SKEW_MS; + if (ts < params.now - maxSkew) { + throw new ProtocolError("expired", "Request timestamp is too old"); + } + if (ts > params.now + maxSkew) { + throw new ProtocolError("not_yet_valid", "Request timestamp is in the future"); + } + + let signatureBytes: Uint8Array; + try { + signatureBytes = fromBase64Url(sigHeader); + } catch { + throw new ProtocolError("bad_signature", "Invalid request signature encoding"); + } + const input = httpSigningInput(params.method, params.pathWithQuery, params.body, ts); + if (!verify(input, signatureBytes, params.agentPublicKey)) { + throw new ProtocolError("bad_signature", "Invalid request signature"); + } + return { agent: agent.data }; +} diff --git a/src/protocol/agent-message.ts b/src/protocol/agent-message.ts index 66a4a7d..2f7517b 100644 --- a/src/protocol/agent-message.ts +++ b/src/protocol/agent-message.ts @@ -1,6 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda +import { z } from "zod"; import { canonicalize, fingerprint, @@ -21,7 +22,12 @@ import { PROTOCOL_VERSION, } from "./domains"; import { ProtocolError } from "./errors"; -import { type AgentMessage, type AgentMessageHeader, agentMessageSchema } from "./schemas"; +import { + type AgentMessage, + type AgentMessageHeader, + agentMessageSchema, + base64UrlSchema, +} from "./schemas"; const utf8Decoder = new TextDecoder("utf-8", { fatal: true }); @@ -121,3 +127,48 @@ export function openAgentMessage( return { header, body }; } + +export interface AgentEventBody { + readonly in_reply_to?: string; + readonly data: unknown; +} + +export const agentEventBodySchema = z.object({ + in_reply_to: base64UrlSchema.optional(), + data: z.unknown(), +}); + +/** Builds the decrypted body every agent event carries: `{ in_reply_to?, data }`. */ +export function wrapEventBody(inReplyTo: string | undefined, data: unknown): AgentEventBody { + return { + ...(inReplyTo !== undefined ? { in_reply_to: inReplyTo } : {}), + data, + }; +} + +export interface OpenedAgentEvent { + readonly header: AgentMessageHeader; + readonly inReplyTo: string | null; + readonly data: unknown; +} + +/** Opens an agent message and unwraps the `{ in_reply_to?, data }` event body. */ +export function openAgentEvent( + message: unknown, + agentPublicKey: PublicKey, + recipientKeyPair: SigningKeyPair, +): OpenedAgentEvent { + const opened = openAgentMessage(message, agentPublicKey, recipientKeyPair); + const parsed = agentEventBodySchema.safeParse(opened.body); + if (!parsed.success || typeof opened.body !== "object" || opened.body === null) { + throw new ProtocolError("invalid_body", "Agent event body is malformed"); + } + if (!("data" in opened.body)) { + throw new ProtocolError("invalid_body", "Agent event body has no data"); + } + return { + header: opened.header, + inReplyTo: parsed.data.in_reply_to ?? null, + data: parsed.data.data, + }; +} diff --git a/src/protocol/command.ts b/src/protocol/command.ts index 87ad411..3d97d43 100644 --- a/src/protocol/command.ts +++ b/src/protocol/command.ts @@ -8,6 +8,7 @@ import { openSealed, type PublicKey, randomBytes, + SIGNING_PUBLIC_KEY_BYTES, type SigningKeyPair, sealTo, sign, @@ -17,6 +18,7 @@ import { import { assertSupportedVersion, concatBytes, DOMAIN_COMMAND, PROTOCOL_VERSION } from "./domains"; import { ProtocolError } from "./errors"; import type { CommandRegistry } from "./registry"; +import { type Role, roleAtLeast } from "./roles"; import { type CommandHeader, type KeyId, @@ -44,6 +46,11 @@ export interface CreateSignedCommandParams { readonly now: number; readonly ttlMs?: number; readonly id?: string; + /** + * Ed25519 public key that the agent's replies and events are sealed to. + * Defaults to the account key. A session signer must use its own key. + */ + readonly replyTo?: PublicKey; } export interface OpenedCommand { @@ -52,6 +59,12 @@ export interface OpenedCommand { readonly signerType: "account" | "session"; readonly accountId: KeyId; readonly sessionId?: string; + /** `not_after` of the signing session certificate, when the signer is a session. */ + readonly sessionNotAfter?: number; + /** Key from the command's `reply_to`, when present. Replies go here instead of the account key. */ + readonly replyTo?: PublicKey; + /** Role of the signing account on the command's server (`"*"` for agent commands). */ + readonly role: Role; } export function createSignedCommand( @@ -68,6 +81,10 @@ export function createSignedCommand( throw new ProtocolError("invalid_body", "Command body failed schema validation"); } + if (params.replyTo !== undefined && params.replyTo.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new RangeError(`replyTo must be ${SIGNING_PUBLIC_KEY_BYTES} bytes`); + } + const ttlMs = params.ttlMs ?? DEFAULT_COMMAND_TTL_MS; const header: CommandHeader = { v: PROTOCOL_VERSION, @@ -78,6 +95,7 @@ export function createSignedCommand( issued_at: params.now, expires_at: params.now + ttlMs, counter: params.counter, + ...(params.replyTo !== undefined ? { reply_to: toBase64Url(params.replyTo) } : {}), }; const payloadBytes = sealTo(canonicalize(parsedBody.data), params.agentPublicKey); @@ -126,6 +144,18 @@ export async function openCommand( throw new ProtocolError("invalid_format", "Invalid command id length"); } + let replyToKey: PublicKey | undefined; + if (header.reply_to !== undefined) { + try { + replyToKey = fromBase64Url(header.reply_to); + } catch { + throw new ProtocolError("invalid_format", "Invalid reply_to encoding"); + } + if (replyToKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new ProtocolError("invalid_format", "Invalid reply_to length"); + } + } + // 2. Verify target agent const localAgentId = fingerprint(trust.agentKeyPair.publicKey); if (header.agent !== localAgentId) { @@ -152,6 +182,7 @@ export async function openCommand( let signerType: "account" | "session"; let accountId: KeyId; let sessionId: string | undefined; + let sessionNotAfter: number | undefined; if (session !== undefined) { const accountPublicKey = trust.isTrustedAccountKey(session.account); @@ -168,10 +199,14 @@ export async function openCommand( "Session certificate key does not match command signer", ); } + if (replyToKey !== undefined && fingerprint(replyToKey) !== header.signer) { + throw new ProtocolError("wrong_recipient", "reply_to must equal the session key"); + } signerPublicKey = verifiedSession.sessionPublicKey; signerType = "session"; accountId = session.account; sessionId = session.id; + sessionNotAfter = verifiedSession.certificate.not_after; } else { const accountPublicKey = trust.isTrustedAccountKey(header.signer); if (accountPublicKey === null) { @@ -241,11 +276,27 @@ export async function openCommand( ); } + // 10. Enforce the role the command needs on its server + const scope = + typeof bodyResult.data === "object" && + bodyResult.data !== null && + "server_id" in bodyResult.data && + typeof (bodyResult.data as { server_id: unknown }).server_id === "string" + ? (bodyResult.data as { server_id: string }).server_id + : "*"; + const role = trust.roleFor(accountId, scope); + if (role === null || !roleAtLeast(role, definition.minRole)) { + throw new ProtocolError("insufficient_role", "Account role is below the command's minimum"); + } + return { header, body: bodyResult.data, signerType, accountId, + role, ...(sessionId !== undefined ? { sessionId } : {}), + ...(sessionNotAfter !== undefined ? { sessionNotAfter } : {}), + ...(replyToKey !== undefined ? { replyTo: replyToKey } : {}), }; } diff --git a/src/protocol/commands/agent.ts b/src/protocol/commands/agent.ts new file mode 100644 index 0000000..a0d621a --- /dev/null +++ b/src/protocol/commands/agent.ts @@ -0,0 +1,84 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; +import { type CommandRegistry, defineCommand } from "../registry"; +import { roleGrantSchema } from "../roles"; +import { keyIdSchema } from "../schemas"; +import { serverIdSchema } from "./server"; + +export const SUBSCRIPTION_TOPICS = ["server.status"] as const; +export const subscriptionTopicSchema = z.enum(SUBSCRIPTION_TOPICS); +export type SubscriptionTopic = z.infer; + +export const SERVER_STATES = ["stopped", "starting", "running", "stopping", "crashed"] as const; +export const serverStateSchema = z.enum(SERVER_STATES); +export type ServerState = z.infer; + +export const serverStatusChangedSchema = z.object({ + server_id: serverIdSchema, + state: serverStateSchema, + at: z.number().int().nonnegative(), +}); +export type ServerStatusChanged = z.infer; + +export const agentSubscribeBodySchema = z + .object({ + topics: z.array(subscriptionTopicSchema).min(1).max(SUBSCRIPTION_TOPICS.length), + }) + .strict(); +export type AgentSubscribeBody = z.infer; + +export const agentMembersSetBodySchema = z + .object({ + grant: roleGrantSchema, + }) + .strict(); +export type AgentMembersSetBody = z.infer; + +export const agentMembersRevokeBodySchema = z + .object({ + account: keyIdSchema, + servers: z.array(serverIdSchema).min(1).max(256).optional(), + }) + .strict(); +export type AgentMembersRevokeBody = z.infer; + +export const agentSubscribeCommand = defineCommand({ + type: "agent.subscribe", + sensitive: false, + minRole: "viewer", + body: agentSubscribeBodySchema, +}); + +export const agentUnsubscribeCommand = defineCommand({ + type: "agent.unsubscribe", + sensitive: false, + minRole: "viewer", + body: agentSubscribeBodySchema, +}); + +export const agentMembersSetCommand = defineCommand({ + type: "agent.members.set", + sensitive: true, + minRole: "admin", + body: agentMembersSetBodySchema, +}); + +export const agentMembersRevokeCommand = defineCommand({ + type: "agent.members.revoke", + sensitive: true, + minRole: "admin", + body: agentMembersRevokeBodySchema, +}); + +export const AGENT_COMMANDS = [ + agentSubscribeCommand, + agentUnsubscribeCommand, + agentMembersSetCommand, + agentMembersRevokeCommand, +] as const; + +export function registerAgentCommands(registry: CommandRegistry): CommandRegistry { + return registry.registerAll(AGENT_COMMANDS); +} diff --git a/src/protocol/commands/backup.ts b/src/protocol/commands/backup.ts index cd98ae1..dafcb7b 100644 --- a/src/protocol/commands/backup.ts +++ b/src/protocol/commands/backup.ts @@ -164,30 +164,35 @@ export type ServerBackupRestoreBody = z.infer export { + AGENT_AUTH_MAX_SKEW_MS, + AGENT_HTTP_HEADER_AGENT, + AGENT_HTTP_HEADER_SIG, + AGENT_HTTP_HEADER_TS, + AGENT_HTTP_MAX_SKEW_MS, + type AgentRequestBody, + type AuthFrame, + createHelloFrame, + generateAgentNonce, + type HelloFrame, + type SignAgentRequestParams, + signAgentAuth, + signAgentRequest, + type VerifyAgentAuthOptions, + type VerifyAgentRequestParams, + verifyAgentAuth, + verifyAgentRequest, +} from "./agent-auth"; +export { + type AgentEventBody, + agentEventBodySchema, + type OpenedAgentEvent, type OpenedAgentMessage, + openAgentEvent, openAgentMessage, type SealAgentMessageParams, sealAgentMessage, + wrapEventBody, } from "./agent-message"; export { COMMAND_ID_BYTES, @@ -17,6 +41,28 @@ export { type OpenedCommand, openCommand, } from "./command"; +export { + AGENT_COMMANDS, + type AgentMembersRevokeBody, + type AgentMembersSetBody, + type AgentSubscribeBody, + agentMembersRevokeBodySchema, + agentMembersRevokeCommand, + agentMembersSetBodySchema, + agentMembersSetCommand, + agentSubscribeBodySchema, + agentSubscribeCommand, + agentUnsubscribeCommand, + registerAgentCommands, + SERVER_STATES, + type ServerState, + type ServerStatusChanged, + SUBSCRIPTION_TOPICS, + type SubscriptionTopic, + serverStateSchema, + serverStatusChangedSchema, + subscriptionTopicSchema, +} from "./commands/agent"; export { BACKUP_COMMANDS, BACKUP_ID_REGEX, @@ -186,10 +232,13 @@ export { tunnelPlayitStopCommand, } from "./commands/tunnel"; export { + DOMAIN_AGENT_AUTH, + DOMAIN_AGENT_HTTP, DOMAIN_AGENT_MESSAGE, DOMAIN_COMMAND, DOMAIN_PAIRING_PROOF, DOMAIN_REVOCATION, + DOMAIN_ROLE_GRANT, DOMAIN_SESSION, DOMAIN_TRUST_GRANT, PROTOCOL_VERSION, @@ -222,10 +271,37 @@ export { verifyRevocationList, } from "./revocation"; export { + ALL_SERVERS, + GRANTABLE_ROLES, + type GrantableRole, + grantableRoleSchema, + MAX_GRANT_CLOCK_SKEW_MS, + MAX_GRANT_SERVERS, + MAX_MEMBERS, + type MemberEntry, + maxRole, + memberEntrySchema, + ROLE_LEVEL, + ROLES, + type Role, + type RoleGrant, + RoleTable, + roleAtLeast, + roleGrantSchema, + roleSchema, + type SignRoleGrantParams, + signRoleGrant, + type VerifiedRoleGrant, + type VerifyRoleGrantOptions, + verifyRoleGrant, +} from "./roles"; +export { + AGENT_NONCE_BYTES, type AgentMessage, type AgentMessageHeader, agentMessageHeaderSchema, agentMessageSchema, + agentNonceSchema, base64UrlSchema, type CommandHeader, commandHeaderSchema, @@ -239,9 +315,11 @@ export { signedCommandSchema, type TransportFrame, transportAckFrameSchema, + transportAuthFrameSchema, transportCommandFrameSchema, transportEventFrameSchema, transportFrameSchema, + transportHelloFrameSchema, transportPingFrameSchema, } from "./schemas"; export { @@ -254,5 +332,6 @@ export { createInMemoryTrustContext, type InMemoryTrustContext, type InMemoryTrustContextOptions, + type MemberStore, type TrustContext, } from "./trust"; diff --git a/src/protocol/phase3.test.ts b/src/protocol/phase3.test.ts new file mode 100644 index 0000000..7185c8f --- /dev/null +++ b/src/protocol/phase3.test.ts @@ -0,0 +1,947 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { beforeAll, describe, expect, test } from "bun:test"; +import { fingerprint, generateSigningKeyPair, ready, toBase64Url } from "../crypto"; +import { + AGENT_HTTP_HEADER_SIG, + AGENT_HTTP_HEADER_TS, + type CommandRegistry, + createCoreRegistry, + createHelloFrame, + createInMemoryTrustContext, + createSignedCommand, + type GrantableRole, + generateAgentNonce, + type MemberEntry, + openAgentEvent, + openCommand, + ProtocolError, + type ProtocolErrorCode, + ROLE_LEVEL, + type Role, + RoleTable, + roleAtLeast, + sealAgentMessage, + signAgentAuth, + signAgentRequest, + signRoleGrant, + signSessionCertificate, + transportFrameSchema, + verifyAgentAuth, + verifyAgentRequest, + verifyRoleGrant, + wrapEventBody, +} from "./index"; + +const NOW = 1_700_000_000_000; + +beforeAll(async () => { + await ready(); +}); + +async function expectCode(promise: Promise, code: ProtocolErrorCode): Promise { + try { + await promise; + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe(code); + return; + } + throw new Error(`Expected ProtocolError ${code}`); +} + +function expectThrowCode(fn: () => unknown, code: ProtocolErrorCode): void { + try { + fn(); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe(code); + return; + } + throw new Error(`Expected ProtocolError ${code}`); +} + +describe("reply_to", () => { + function setup() { + const agent = generateSigningKeyPair(); + const account = generateSigningKeyPair(); + const session = generateSigningKeyPair(); + const registry = createCoreRegistry(); + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [account.publicKey], + now: () => NOW, + }); + const certificate = signSessionCertificate({ + sessionPublicKey: session.publicKey, + accountKeyPair: account, + notBefore: NOW - 1000, + notAfter: NOW + 3_600_000, + }); + return { agent, account, session, registry, trust, certificate }; + } + + test("is part of the signed header and round-trips through openCommand", async () => { + const { agent, session, registry, trust, certificate } = setup(); + const cmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: session, + session: certificate, + counter: 1, + now: NOW, + replyTo: session.publicKey, + }, + registry, + ); + expect(cmd.header.reply_to).toBe(toBase64Url(session.publicKey)); + const opened = await openCommand(cmd, trust, registry); + expect(opened.replyTo).toEqual(session.publicKey); + expect(opened.signerType).toBe("session"); + expect(opened.sessionNotAfter).toBe(certificate.not_after); + }); + + test("tampering with reply_to breaks the signature", async () => { + const { agent, session, registry, trust, certificate } = setup(); + const cmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: session, + session: certificate, + counter: 1, + now: NOW, + replyTo: session.publicKey, + }, + registry, + ); + const attacker = generateSigningKeyPair(); + const forged = { + ...cmd, + header: { ...cmd.header, reply_to: toBase64Url(attacker.publicKey) }, + }; + await expectCode(openCommand(forged, trust, registry), "wrong_recipient"); + + // Even when the attacker's key is a valid reply_to for an account signer, the signature covers it. + const accountCmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: setup().account, + counter: 1, + now: NOW, + }, + registry, + ); + await expectCode( + openCommand( + { + ...accountCmd, + header: { ...accountCmd.header, reply_to: toBase64Url(attacker.publicKey) }, + }, + trust, + registry, + ), + "untrusted_signer", + ); + }); + + test("a session signer must reply to its own session key", async () => { + const { agent, session, registry, trust, certificate } = setup(); + const other = generateSigningKeyPair(); + const cmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: session, + session: certificate, + counter: 1, + now: NOW, + replyTo: other.publicKey, + }, + registry, + ); + await expectCode(openCommand(cmd, trust, registry), "wrong_recipient"); + }); + + test("an account signer may point reply_to at the active session key", async () => { + const { agent, account, session, registry, trust } = setup(); + const cmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now: NOW, + replyTo: session.publicKey, + }, + registry, + ); + const opened = await openCommand(cmd, trust, registry); + expect(opened.signerType).toBe("account"); + expect(opened.replyTo).toEqual(session.publicKey); + }); + + test("rejects reply_to that is not a 32-byte key", async () => { + const { agent, account, registry, trust } = setup(); + expect(() => + createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now: NOW, + replyTo: new Uint8Array(8), + }, + registry, + ), + ).toThrow(RangeError); + + const cmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now: NOW, + }, + registry, + ); + const short = { ...cmd, header: { ...cmd.header, reply_to: toBase64Url(new Uint8Array(8)) } }; + await expectCode(openCommand(short, trust, registry), "invalid_format"); + }); + + test("a command without reply_to is still accepted (account key is the recipient)", async () => { + const { agent, account, registry, trust } = setup(); + const cmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now: NOW, + }, + registry, + ); + expect(cmd.header.reply_to).toBeUndefined(); + const opened = await openCommand(cmd, trust, registry); + expect(opened.replyTo).toBeUndefined(); + }); +}); + +describe("event envelope", () => { + test("openAgentEvent unwraps { in_reply_to, data } and only the recipient can open it", () => { + const agent = generateSigningKeyPair(); + const session = generateSigningKeyPair(); + const account = generateSigningKeyPair(); + const message = sealAgentMessage({ + type: "server.list.result", + body: wrapEventBody("abc", { servers: [] }), + agentKeyPair: agent, + recipientPublicKey: session.publicKey, + sentAt: NOW, + seq: 1, + }); + + const opened = openAgentEvent(message, agent.publicKey, session); + expect(opened.inReplyTo).toBe("abc"); + expect(opened.data).toEqual({ servers: [] }); + + // The account key is not the recipient and cannot decrypt it. + expectThrowCode(() => openAgentEvent(message, agent.publicKey, account), "wrong_recipient"); + expect(message.header.recipient).toBe(fingerprint(session.publicKey)); + }); + + test("in_reply_to is optional but data is required", () => { + const agent = generateSigningKeyPair(); + const account = generateSigningKeyPair(); + const noReply = sealAgentMessage({ + type: "x", + body: wrapEventBody(undefined, 1), + agentKeyPair: agent, + recipientPublicKey: account.publicKey, + sentAt: NOW, + seq: 1, + }); + expect(openAgentEvent(noReply, agent.publicKey, account).inReplyTo).toBeNull(); + + const legacy = sealAgentMessage({ + type: "x", + body: { at: 1 }, + agentKeyPair: agent, + recipientPublicKey: account.publicKey, + sentAt: NOW, + seq: 2, + }); + expectThrowCode(() => openAgentEvent(legacy, agent.publicKey, account), "invalid_body"); + }); +}); + +describe("hello / auth", () => { + test("round-trips and the nonce is single-use", () => { + const agent = generateSigningKeyPair(); + const agentId = fingerprint(agent.publicKey); + const hello = createHelloFrame({ agent: agentId, serverTime: NOW }); + expect(transportFrameSchema.safeParse(hello).success).toBe(true); + + const auth = signAgentAuth({ agentKeyPair: agent, hello, ts: NOW }); + expect(transportFrameSchema.safeParse(auth).success).toBe(true); + + const used = new Set(); + const verified = verifyAgentAuth(auth, { + agentPublicKey: agent.publicKey, + expectedNonce: hello.body.nonce, + now: NOW, + usedNonces: used, + }); + expect(verified.body.nonce).toBe(hello.body.nonce); + + // Replaying the same auth frame (same nonce) is refused. + expectThrowCode( + () => + verifyAgentAuth(auth, { + agentPublicKey: agent.publicKey, + expectedNonce: hello.body.nonce, + now: NOW, + usedNonces: used, + }), + "replayed", + ); + }); + + test("rejects a nonce that is not the one challenged, stale timestamps and bad signatures", () => { + const agent = generateSigningKeyPair(); + const agentId = fingerprint(agent.publicKey); + const hello = createHelloFrame({ agent: agentId, serverTime: NOW }); + const auth = signAgentAuth({ agentKeyPair: agent, hello, ts: NOW }); + + const base = { agentPublicKey: agent.publicKey, expectedNonce: hello.body.nonce, now: NOW }; + expectThrowCode( + () => verifyAgentAuth(auth, { ...base, expectedNonce: generateAgentNonce() }), + "auth_invalid", + ); + expectThrowCode(() => verifyAgentAuth(auth, { ...base, now: NOW + 61_000 }), "auth_invalid"); + expectThrowCode(() => verifyAgentAuth(auth, { ...base, now: NOW - 61_000 }), "auth_invalid"); + expect(() => verifyAgentAuth(auth, { ...base, now: NOW + 59_000 })).not.toThrow(); + + const tamperedTs = { ...auth, body: { ...auth.body, ts: NOW + 1 } }; + expectThrowCode(() => verifyAgentAuth(tamperedTs, base), "bad_signature"); + + const other = generateSigningKeyPair(); + expectThrowCode( + () => verifyAgentAuth(auth, { ...base, agentPublicKey: other.publicKey }), + "wrong_agent", + ); + expectThrowCode(() => verifyAgentAuth({ kind: "auth" }, base), "invalid_format"); + }); + + test("the agent refuses to answer a hello meant for another agent", () => { + const agent = generateSigningKeyPair(); + const other = generateSigningKeyPair(); + const hello = createHelloFrame({ agent: fingerprint(other.publicKey), serverTime: NOW }); + expectThrowCode(() => signAgentAuth({ agentKeyPair: agent, hello, ts: NOW }), "wrong_agent"); + }); + + test("hello nonce must be 32 bytes of base64url", () => { + const agentId = fingerprint(generateSigningKeyPair().publicKey); + expect(() => createHelloFrame({ agent: agentId, serverTime: NOW, nonce: "short" })).toThrow(); + }); +}); + +describe("signed agent HTTP requests", () => { + const body = JSON.stringify({ server_id: "survival", size_bytes: 10 }); + const path = "/v1/agents/self/backup-upload-url"; + + function headersOf(h: Record) { + return (name: string) => + h[Object.keys(h).find((k) => k.toLowerCase() === name.toLowerCase()) ?? ""]; + } + + test("verifies a correctly signed request", () => { + const agent = generateSigningKeyPair(); + const headers = signAgentRequest({ + agentKeyPair: agent, + method: "post", + pathWithQuery: path, + body, + ts: NOW, + }); + expect(headers["X-Tegra-Agent"]).toBe(fingerprint(agent.publicKey)); + expect(headers["X-Tegra-Ts"]).toBe(String(NOW)); + const result = verifyAgentRequest({ + getHeader: headersOf(headers), + method: "POST", + pathWithQuery: path, + body, + agentPublicKey: agent.publicKey, + now: NOW + 5_000, + }); + expect(result.agent).toBe(fingerprint(agent.publicKey)); + }); + + test("refuses a changed method, path, query or body", () => { + const agent = generateSigningKeyPair(); + const headers = signAgentRequest({ + agentKeyPair: agent, + method: "POST", + pathWithQuery: `${path}?a=1`, + body, + ts: NOW, + }); + const base = { + getHeader: headersOf(headers), + method: "POST", + pathWithQuery: `${path}?a=1`, + body, + agentPublicKey: agent.publicKey, + now: NOW, + }; + expect(() => verifyAgentRequest(base)).not.toThrow(); + expectThrowCode(() => verifyAgentRequest({ ...base, method: "PUT" }), "bad_signature"); + expectThrowCode( + () => verifyAgentRequest({ ...base, pathWithQuery: `${path}?a=2` }), + "bad_signature", + ); + expectThrowCode( + () => verifyAgentRequest({ ...base, pathWithQuery: "/v1/agents/pairing" }), + "bad_signature", + ); + expectThrowCode( + () => verifyAgentRequest({ ...base, body: body.replace("10", "11") }), + "bad_signature", + ); + expectThrowCode(() => verifyAgentRequest({ ...base, body: undefined }), "bad_signature"); + }); + + test("refuses a timestamp outside the window, a tampered ts, and a different agent", () => { + const agent = generateSigningKeyPair(); + const headers = signAgentRequest({ + agentKeyPair: agent, + method: "GET", + pathWithQuery: "/v1/agents/pairing/abc/grant", + ts: NOW, + }); + const base = { + getHeader: headersOf(headers), + method: "GET", + pathWithQuery: "/v1/agents/pairing/abc/grant", + agentPublicKey: agent.publicKey, + now: NOW, + }; + expect(() => verifyAgentRequest(base)).not.toThrow(); + expectThrowCode(() => verifyAgentRequest({ ...base, now: NOW + 61_000 }), "expired"); + expectThrowCode(() => verifyAgentRequest({ ...base, now: NOW - 61_000 }), "not_yet_valid"); + + const tampered = { ...headers, [AGENT_HTTP_HEADER_TS]: String(NOW + 1) }; + expectThrowCode( + () => verifyAgentRequest({ ...base, getHeader: headersOf(tampered) }), + "bad_signature", + ); + const garbage = { ...headers, [AGENT_HTTP_HEADER_TS]: "12abc" }; + expectThrowCode( + () => verifyAgentRequest({ ...base, getHeader: headersOf(garbage) }), + "request_invalid", + ); + + const other = generateSigningKeyPair(); + expectThrowCode( + () => verifyAgentRequest({ ...base, agentPublicKey: other.publicKey }), + "wrong_agent", + ); + }); + + test("refuses missing or malformed signature headers", () => { + const agent = generateSigningKeyPair(); + const headers = signAgentRequest({ + agentKeyPair: agent, + method: "GET", + pathWithQuery: "/x", + ts: NOW, + }); + const base = { + method: "GET", + pathWithQuery: "/x", + agentPublicKey: agent.publicKey, + now: NOW, + }; + const { [AGENT_HTTP_HEADER_SIG]: _sig, ...withoutSig } = headers; + expectThrowCode( + () => verifyAgentRequest({ ...base, getHeader: headersOf(withoutSig) }), + "request_invalid", + ); + expectThrowCode( + () => + verifyAgentRequest({ + ...base, + getHeader: headersOf({ ...headers, [AGENT_HTTP_HEADER_SIG]: "!!!" }), + }), + "bad_signature", + ); + expect(() => + signAgentRequest({ agentKeyPair: agent, method: "GET", pathWithQuery: "no-slash", ts: NOW }), + ).toThrow(RangeError); + }); +}); + +describe("role grants", () => { + const agentId = "a".repeat(32); + + test("sign and verify round-trip, including the account id", () => { + const owner = generateSigningKeyPair(); + const member = generateSigningKeyPair(); + const grant = signRoleGrant({ + granter: owner, + accountPublicKey: member.publicKey, + agent: agentId, + servers: ["survival"], + role: "operator", + issuedAt: NOW, + expiresAt: NOW + 60_000, + }); + const verified = verifyRoleGrant(grant, owner.publicKey, { agent: agentId, now: NOW }); + expect(verified.accountId).toBe(fingerprint(member.publicKey)); + expect(verified.grant.servers).toEqual(["survival"]); + }); + + test("refuses forged, tampered, expired and misaddressed grants", () => { + const owner = generateSigningKeyPair(); + const forger = generateSigningKeyPair(); + const member = generateSigningKeyPair(); + const common = { + accountPublicKey: member.publicKey, + agent: agentId, + servers: "*" as const, + role: "viewer" as const, + issuedAt: NOW, + }; + const options = { agent: agentId, now: NOW }; + + const forged = signRoleGrant({ ...common, granter: forger }); + expectThrowCode(() => verifyRoleGrant(forged, owner.publicKey, options), "role_grant_invalid"); + + const real = signRoleGrant({ ...common, granter: owner }); + expectThrowCode( + () => verifyRoleGrant({ ...real, role: "admin" }, owner.publicKey, options), + "role_grant_invalid", + ); + expectThrowCode( + () => verifyRoleGrant({ ...real, servers: ["x"] }, owner.publicKey, options), + "role_grant_invalid", + ); + expectThrowCode( + () => verifyRoleGrant({ ...real, role: "owner" }, owner.publicKey, options), + "role_grant_invalid", + ); + + expectThrowCode( + () => + verifyRoleGrant(real, owner.publicKey, { + agent: fingerprint(generateSigningKeyPair().publicKey), + now: NOW, + }), + "role_grant_invalid", + ); + + const expiring = signRoleGrant({ ...common, granter: owner, expiresAt: NOW + 1000 }); + expect(() => verifyRoleGrant(expiring, owner.publicKey, options)).not.toThrow(); + expectThrowCode( + () => verifyRoleGrant(expiring, owner.publicKey, { agent: agentId, now: NOW + 1000 }), + "role_grant_invalid", + ); + + const future = signRoleGrant({ ...common, granter: owner, issuedAt: NOW + 10 * 60_000 }); + expectThrowCode(() => verifyRoleGrant(future, owner.publicKey, options), "role_grant_invalid"); + + expectThrowCode( + () => verifyRoleGrant({ junk: true }, owner.publicKey, options), + "role_grant_invalid", + ); + }); + + test("domain separation: a role grant signature is not a valid trust or session signature", () => { + const owner = generateSigningKeyPair(); + const member = generateSigningKeyPair(); + const grant = signRoleGrant({ + granter: owner, + accountPublicKey: member.publicKey, + agent: agentId, + servers: "*", + role: "viewer", + issuedAt: NOW, + }); + // Reusing the same signature under another kind must fail the grant schema. + expectThrowCode( + () => + verifyRoleGrant({ ...grant, kind: "trust" }, owner.publicKey, { agent: agentId, now: NOW }), + "role_grant_invalid", + ); + }); +}); + +describe("RoleTable", () => { + const A = "b".repeat(32); + + function entry(over: Partial): MemberEntry { + return { + account_key: toBase64Url(generateSigningKeyPair().publicKey), + account: A, + granted_by: A, + role: "operator", + servers: ["a"], + issued_at: NOW, + ...over, + }; + } + + test("per-server and all-server grants resolve to the highest matching role", () => { + const table = new RoleTable([ + entry({ servers: ["a"], role: "operator" }), + entry({ servers: ["a", "b"], role: "viewer" }), + ]); + expect(table.roleFor(A, "a", NOW)).toBe("operator"); + expect(table.roleFor(A, "b", NOW)).toBe("viewer"); + expect(table.roleFor(A, "c", NOW)).toBeNull(); + + table.set(entry({ servers: "*", role: "editor" })); + expect(table.roleFor(A, "c", NOW)).toBe("editor"); + expect(table.roleFor(A, "*", NOW)).toBe("editor"); + }); + + test("agent scope: only per-server grants give the viewer floor, none gives null", () => { + const table = new RoleTable([entry({ servers: ["a"], role: "admin" })]); + expect(table.roleFor(A, "*", NOW)).toBe("viewer"); + expect(table.roleFor(fingerprint(generateSigningKeyPair().publicKey), "*", NOW)).toBeNull(); + }); + + test("expired grants give nothing and the account key is no longer known", () => { + const table = new RoleTable([entry({ servers: "*", expires_at: NOW + 1000 })]); + expect(table.roleFor(A, "a", NOW)).toBe("operator"); + expect(table.keyFor(A, NOW)).not.toBeNull(); + expect(table.roleFor(A, "a", NOW + 1000)).toBeNull(); + expect(table.keyFor(A, NOW + 1000)).toBeNull(); + }); + + test("revoke removes everything, or only the listed servers of per-server grants", () => { + const table = new RoleTable([entry({ servers: ["a", "b"] }), entry({ servers: ["c"] })]); + expect(table.revoke(A, ["b"])).toBe(1); + expect(table.roleFor(A, "a", NOW)).toBe("operator"); + expect(table.roleFor(A, "b", NOW)).toBeNull(); + expect(table.revoke(A)).toBe(2); + expect(table.roleFor(A, "a", NOW)).toBeNull(); + expect(table.accountCount()).toBe(0); + + const all = new RoleTable([entry({ servers: "*" })]); + expect(all.revoke(A, ["a"])).toBe(0); + expect(all.roleFor(A, "a", NOW)).toBe("operator"); + }); +}); + +// Minimum role per command, straight from the contract table. +const MIN_ROLE: Record = { + "agent.ping": "viewer", + "agent.subscribe": "viewer", + "agent.unsubscribe": "viewer", + "server.status": "viewer", + "server.list": "viewer", + "server.console.subscribe": "viewer", + "server.console.unsubscribe": "viewer", + "files.list": "viewer", + "files.stat": "viewer", + "server.mods.list": "viewer", + "server.backup.list": "viewer", + "tunnel.playit.status": "viewer", + "server.start": "operator", + "server.stop": "operator", + "server.restart": "operator", + "server.console.send": "operator", + "server.mods.install": "editor", + "server.mods.remove": "editor", + "server.origin.plan": "editor", + "server.origin.apply": "editor", + "server.origin.unlink": "editor", + "server.update_settings": "editor", + "server.backup.create": "editor", + "server.backup.config.set": "editor", + "server.deploy.serverpack": "editor", + "server.create": "admin", + "server.backup.delete": "admin", + "server.backup.restore": "admin", + "server.delete": "admin", + "agent.members.set": "admin", + "agent.members.revoke": "admin", + "agent.revocations.set": "admin", +}; + +describe("minimum roles", () => { + const registry = createCoreRegistry(); + + test("every registered command has the contract's minimum role", () => { + for (const type of registry.types()) { + const definition = registry.get(type); + const expected = + MIN_ROLE[type] ?? + (type.startsWith("files.") + ? "editor" + : type.startsWith("tunnel.playit.") + ? "admin" + : undefined); + expect(expected).toBeDefined(); + expect(definition?.minRole).toBe(expected as Role); + } + for (const type of Object.keys(MIN_ROLE)) { + expect(registry.has(type)).toBe(true); + } + }); + + test("destructive and sensitive commands need an admin and the direct account key", () => { + for (const type of [ + "server.backup.restore", + "server.delete", + "agent.members.set", + "agent.members.revoke", + ]) { + expect(registry.get(type)?.sensitive).toBe(true); + expect(registry.get(type)?.minRole).toBe("admin"); + } + }); + + // A concrete, valid body for every command type that can be sent with just a server id. + const SERVER = "survival"; + const BODIES: Record = { + "agent.ping": {}, + "server.start": { server_id: SERVER }, + "server.stop": { server_id: SERVER }, + "server.restart": { server_id: SERVER }, + "server.status": { server_id: SERVER }, + "server.list": {}, + "server.console.send": { server_id: SERVER, line: "list" }, + "server.console.subscribe": { server_id: SERVER }, + "server.console.unsubscribe": { server_id: SERVER }, + "server.update_settings": { server_id: SERVER, memory_mb: 2048 }, + "files.list": { server_id: SERVER }, + "files.stat": { server_id: SERVER, path: "a" }, + "files.read": { server_id: SERVER, path: "a" }, + "server.backup.list": { server_id: SERVER }, + "server.backup.create": { server_id: SERVER }, + "server.backup.config.set": { server_id: SERVER }, + "server.backup.delete": { server_id: SERVER, backup_id: "20260101T000000Z-abcdef" }, + }; + + async function attempt( + registryForSigning: CommandRegistry, + role: GrantableRole | "owner", + type: string, + body: unknown, + ): Promise<"ok" | "insufficient_role" | string> { + const agent = generateSigningKeyPair(); + const account = generateSigningKeyPair(); + const owner = generateSigningKeyPair(); + const accountId = fingerprint(account.publicKey); + const members: MemberEntry[] = + role === "owner" + ? [] + : [ + { + account_key: toBase64Url(account.publicKey), + account: accountId, + granted_by: fingerprint(owner.publicKey), + role, + servers: [SERVER], + issued_at: NOW, + }, + ]; + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: role === "owner" ? [account.publicKey] : [owner.publicKey], + members, + now: () => NOW, + }); + const cmd = createSignedCommand( + { type, body, agentPublicKey: agent.publicKey, signer: account, counter: 1, now: NOW }, + registryForSigning, + ); + try { + await openCommand(cmd, trust, registryForSigning); + return "ok"; + } catch (err) { + return err instanceof ProtocolError ? err.code : String(err); + } + } + + test("role x command matrix on a server the member is scoped to", async () => { + const permissive = createCoreRegistry(); + const roles: (GrantableRole | "owner")[] = ["viewer", "operator", "editor", "admin", "owner"]; + for (const [type, body] of Object.entries(BODIES)) { + const definition = registry.get(type); + expect(definition).toBeDefined(); + for (const role of roles) { + const result = await attempt(permissive, role, type, body); + const allowed = ROLE_LEVEL[role] >= ROLE_LEVEL[definition?.minRole ?? "owner"]; + if (allowed) { + expect(`${type} as ${role}: ${result}`).toBe(`${type} as ${role}: ok`); + } else { + expect(`${type} as ${role}: ${result}`).toBe(`${type} as ${role}: insufficient_role`); + } + } + } + }); + + test("a grant on one server gives nothing on another server", async () => { + const permissive = createCoreRegistry(); + const agent = generateSigningKeyPair(); + const account = generateSigningKeyPair(); + const owner = generateSigningKeyPair(); + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [owner.publicKey], + members: [ + { + account_key: toBase64Url(account.publicKey), + account: fingerprint(account.publicKey), + granted_by: fingerprint(owner.publicKey), + role: "editor", + servers: ["alpha"], + issued_at: NOW, + }, + ], + now: () => NOW, + }); + let counter = 0; + async function run(type: string, body: unknown): Promise { + const cmd = createSignedCommand( + { + type, + body, + agentPublicKey: agent.publicKey, + signer: account, + counter: ++counter, + now: NOW, + }, + permissive, + ); + try { + const opened = await openCommand(cmd, trust, permissive); + return `ok:${opened.role}`; + } catch (err) { + return err instanceof ProtocolError ? err.code : String(err); + } + } + expect(await run("server.start", { server_id: "alpha" })).toBe("ok:editor"); + expect(await run("server.start", { server_id: "beta" })).toBe("insufficient_role"); + // Agent-level scope: a scoped member only has the viewer floor there. + expect(await run("server.list", {})).toBe("ok:viewer"); + expect(await run("agent.ping", {})).toBe("ok:viewer"); + expect(await run("agent.members.revoke", { account: fingerprint(owner.publicKey) })).toBe( + "insufficient_role", + ); + }); + + test("a stranger and an expired member are not trusted at all", async () => { + const permissive = createCoreRegistry(); + const agent = generateSigningKeyPair(); + const account = generateSigningKeyPair(); + const owner = generateSigningKeyPair(); + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [owner.publicKey], + members: [ + { + account_key: toBase64Url(account.publicKey), + account: fingerprint(account.publicKey), + granted_by: fingerprint(owner.publicKey), + role: "viewer", + servers: "*", + issued_at: NOW - 10_000, + expires_at: NOW - 1, + }, + ], + now: () => NOW, + }); + const cmd = createSignedCommand( + { + type: "agent.ping", + body: {}, + agentPublicKey: agent.publicKey, + signer: account, + counter: 1, + now: NOW, + }, + permissive, + ); + await expectCode(openCommand(cmd, trust, permissive), "untrusted_signer"); + }); + + test("session-signed commands take the role of their account", async () => { + const permissive = createCoreRegistry(); + const agent = generateSigningKeyPair(); + const account = generateSigningKeyPair(); + const session = generateSigningKeyPair(); + const owner = generateSigningKeyPair(); + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [owner.publicKey], + members: [ + { + account_key: toBase64Url(account.publicKey), + account: fingerprint(account.publicKey), + granted_by: fingerprint(owner.publicKey), + role: "operator", + servers: ["alpha"], + issued_at: NOW, + }, + ], + now: () => NOW, + }); + const certificate = signSessionCertificate({ + sessionPublicKey: session.publicKey, + accountKeyPair: account, + notBefore: NOW - 1000, + notAfter: NOW + 1_000_000, + }); + const start = createSignedCommand( + { + type: "server.start", + body: { server_id: "alpha" }, + agentPublicKey: agent.publicKey, + signer: session, + session: certificate, + counter: 1, + now: NOW, + }, + permissive, + ); + expect((await openCommand(start, trust, permissive)).role).toBe("operator"); + + const files = createSignedCommand( + { + type: "files.read", + body: { server_id: "alpha", path: "a" }, + agentPublicKey: agent.publicKey, + signer: session, + session: certificate, + counter: 2, + now: NOW, + }, + permissive, + ); + await expectCode(openCommand(files, trust, permissive), "insufficient_role"); + }); + + test("roleAtLeast", () => { + expect(roleAtLeast("owner", "admin")).toBe(true); + expect(roleAtLeast("viewer", "operator")).toBe(false); + expect(roleAtLeast(null, "viewer")).toBe(false); + expect(roleAtLeast("editor", "editor")).toBe(true); + }); +}); diff --git a/src/protocol/registry.ts b/src/protocol/registry.ts index 63bc671..873d247 100644 --- a/src/protocol/registry.ts +++ b/src/protocol/registry.ts @@ -2,21 +2,25 @@ // Copyright (C) 2026 Antônio Miranda import type { z } from "zod"; +import type { Role } from "./roles"; export interface CommandDefinition { readonly type: TType; readonly sensitive: boolean; + readonly minRole: Role; readonly body: z.ZodType; } export function defineCommand(definition: { readonly type: TType; readonly sensitive: boolean; + readonly minRole: Role; readonly body: z.ZodType; }): CommandDefinition { return { type: definition.type, sensitive: definition.sensitive, + minRole: definition.minRole, body: definition.body, }; } diff --git a/src/protocol/roles.ts b/src/protocol/roles.ts new file mode 100644 index 0000000..77145bb --- /dev/null +++ b/src/protocol/roles.ts @@ -0,0 +1,305 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; +import { + canonicalize, + fingerprint, + fromBase64Url, + type PublicKey, + SIGNING_PUBLIC_KEY_BYTES, + type SigningKeyPair, + sign, + toBase64Url, + verify, +} from "../crypto"; +import { + assertSupportedVersion, + concatBytes, + DOMAIN_ROLE_GRANT, + PROTOCOL_VERSION, +} from "./domains"; +import { ProtocolError } from "./errors"; +import { base64UrlSchema, type KeyId, keyIdSchema } from "./schemas"; + +export const ROLES = ["viewer", "operator", "editor", "admin", "owner"] as const; +export type Role = (typeof ROLES)[number]; +export const roleSchema = z.enum(ROLES); + +export const GRANTABLE_ROLES = ["viewer", "operator", "editor", "admin"] as const; +export type GrantableRole = (typeof GRANTABLE_ROLES)[number]; +export const grantableRoleSchema = z.enum(GRANTABLE_ROLES); + +export const ROLE_LEVEL: Readonly> = { + viewer: 1, + operator: 2, + editor: 3, + admin: 4, + owner: 5, +}; + +export function roleAtLeast(role: Role | null | undefined, minimum: Role): boolean { + return role !== null && role !== undefined && ROLE_LEVEL[role] >= ROLE_LEVEL[minimum]; +} + +export function maxRole(a: T | null, b: T | null): T | null { + if (a === null) return b; + if (b === null) return a; + return ROLE_LEVEL[a] >= ROLE_LEVEL[b] ? a : b; +} + +export const ALL_SERVERS = "*" as const; +export const MAX_GRANT_SERVERS = 256; +export const MAX_MEMBERS = 64; + +const grantServerIdSchema = z.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/, "Invalid server id"); + +const grantServersSchema = z.union([ + z.literal(ALL_SERVERS), + z.array(grantServerIdSchema).min(1).max(MAX_GRANT_SERVERS), +]); + +export const roleGrantSchema = z + .object({ + v: z.literal(PROTOCOL_VERSION), + kind: z.literal("server-role"), + account_key: base64UrlSchema, + agent: keyIdSchema, + servers: grantServersSchema, + role: grantableRoleSchema, + issued_at: z.number().int().nonnegative(), + expires_at: z.number().int().nonnegative().optional(), + sig: base64UrlSchema, + }) + .strict(); +export type RoleGrant = z.infer; + +export const MAX_GRANT_CLOCK_SKEW_MS = 5 * 60 * 1000; + +export interface SignRoleGrantParams { + readonly granter: SigningKeyPair; + readonly accountPublicKey: PublicKey; + readonly agent: KeyId; + readonly servers: readonly string[] | typeof ALL_SERVERS; + readonly role: GrantableRole; + readonly issuedAt: number; + readonly expiresAt?: number; +} + +export function signRoleGrant(params: SignRoleGrantParams): RoleGrant { + if (params.accountPublicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new RangeError(`Account public key must be ${SIGNING_PUBLIC_KEY_BYTES} bytes`); + } + if (!Number.isSafeInteger(params.issuedAt) || params.issuedAt < 0) { + throw new RangeError("issuedAt must be a non-negative safe integer"); + } + if ( + params.expiresAt !== undefined && + (!Number.isSafeInteger(params.expiresAt) || params.expiresAt <= params.issuedAt) + ) { + throw new RangeError("expiresAt must be a safe integer after issuedAt"); + } + + const unsigned = { + v: PROTOCOL_VERSION, + kind: "server-role" as const, + account_key: toBase64Url(params.accountPublicKey), + agent: params.agent, + servers: params.servers === ALL_SERVERS ? ALL_SERVERS : [...params.servers], + role: params.role, + issued_at: params.issuedAt, + ...(params.expiresAt !== undefined ? { expires_at: params.expiresAt } : {}), + }; + + const signingInput = concatBytes(DOMAIN_ROLE_GRANT, canonicalize(unsigned)); + const signature = sign(signingInput, params.granter.secretKey); + return roleGrantSchema.parse({ ...unsigned, sig: toBase64Url(signature) }); +} + +export interface VerifyRoleGrantOptions { + readonly agent: KeyId; + readonly now: number; +} + +export interface VerifiedRoleGrant { + readonly grant: RoleGrant; + readonly accountPublicKey: PublicKey; + readonly accountId: KeyId; +} + +export function verifyRoleGrant( + grant: unknown, + granterPublicKey: PublicKey, + options: VerifyRoleGrantOptions, +): VerifiedRoleGrant { + assertSupportedVersion(grant); + + const parsed = roleGrantSchema.safeParse(grant); + if (!parsed.success) { + throw new ProtocolError("role_grant_invalid", "Malformed role grant"); + } + const data = parsed.data; + + if (data.agent !== options.agent) { + throw new ProtocolError("role_grant_invalid", "Role grant is addressed to a different agent"); + } + if (data.issued_at > options.now + MAX_GRANT_CLOCK_SKEW_MS) { + throw new ProtocolError("role_grant_invalid", "Role grant issued_at is in the future"); + } + if (data.expires_at !== undefined && data.expires_at <= data.issued_at) { + throw new ProtocolError("role_grant_invalid", "Role grant expiry is not after issuance"); + } + if (data.expires_at !== undefined && options.now >= data.expires_at) { + throw new ProtocolError("role_grant_invalid", "Role grant has expired"); + } + if (data.servers !== ALL_SERVERS && new Set(data.servers).size !== data.servers.length) { + throw new ProtocolError("role_grant_invalid", "Role grant lists a server more than once"); + } + + let accountPublicKey: Uint8Array; + let signatureBytes: Uint8Array; + try { + accountPublicKey = fromBase64Url(data.account_key); + signatureBytes = fromBase64Url(data.sig); + } catch { + throw new ProtocolError("role_grant_invalid", "Invalid base64url encoding in role grant"); + } + if (accountPublicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { + throw new ProtocolError("role_grant_invalid", "Invalid account key length in role grant"); + } + + const { sig: _sig, ...unsigned } = data; + const signingInput = concatBytes(DOMAIN_ROLE_GRANT, canonicalize(unsigned)); + if (!verify(signingInput, signatureBytes, granterPublicKey)) { + throw new ProtocolError("role_grant_invalid", "Invalid role grant signature"); + } + + return { grant: data, accountPublicKey, accountId: fingerprint(accountPublicKey) }; +} + +/** A role grant that an agent has accepted, as kept in its member table. */ +export const memberEntrySchema = z + .object({ + account_key: base64UrlSchema, + account: keyIdSchema, + granted_by: keyIdSchema, + role: grantableRoleSchema, + servers: grantServersSchema, + issued_at: z.number().int().nonnegative(), + expires_at: z.number().int().nonnegative().optional(), + }) + .strict(); +export type MemberEntry = z.infer; + +function scopeKey(servers: MemberEntry["servers"]): string { + return servers === ALL_SERVERS ? ALL_SERVERS : [...servers].sort().join(","); +} + +function isActive(entry: MemberEntry, now: number): boolean { + return entry.expires_at === undefined || now < entry.expires_at; +} + +/** + * Member-table logic shared by the in-memory and the file-backed trust + * contexts. Owners are not members: they come from the trust list. + */ +export class RoleTable { + #entries: MemberEntry[]; + + constructor(entries: readonly MemberEntry[] = []) { + this.#entries = [...entries]; + } + + entries(): readonly MemberEntry[] { + return [...this.#entries]; + } + + accountCount(): number { + return new Set(this.#entries.map((entry) => entry.account)).size; + } + + keyFor(account: KeyId, now: number): PublicKey | null { + for (const entry of this.#entries) { + if (entry.account === account && isActive(entry, now)) { + try { + return fromBase64Url(entry.account_key); + } catch { + return null; + } + } + } + return null; + } + + /** + * Role of `account` on `serverId`. Agent-level scope (`"*"`) resolves to the + * highest role granted on all servers; an account that only has per-server + * grants gets `viewer` there, which allows agent-level reads (what they + * return is filtered per server). + */ + roleFor(account: KeyId, serverId: string, now: number): GrantableRole | null { + let best: GrantableRole | null = null; + let anyActive = false; + for (const entry of this.#entries) { + if (entry.account !== account || !isActive(entry, now)) { + continue; + } + anyActive = true; + const covers = + entry.servers === ALL_SERVERS || + (serverId !== ALL_SERVERS && entry.servers.includes(serverId)); + if (covers) { + best = maxRole(best, entry.role); + } + } + if (best === null && serverId === ALL_SERVERS && anyActive) { + return "viewer"; + } + return best; + } + + set(entry: MemberEntry): void { + const key = scopeKey(entry.servers); + const next = this.#entries.filter( + (existing) => !(existing.account === entry.account && scopeKey(existing.servers) === key), + ); + next.push(entry); + this.#entries = next; + } + + /** + * Removes grants of `account`. Without `servers`, all of them. With + * `servers`, those ids are removed from per-server grants; a grant that + * covers all servers is only removed by a revoke without `servers`. + * Returns how many grants were changed or removed. + */ + revoke(account: KeyId, servers?: readonly string[]): number { + let changed = 0; + const next: MemberEntry[] = []; + for (const entry of this.#entries) { + if (entry.account !== account) { + next.push(entry); + continue; + } + if (servers === undefined) { + changed++; + continue; + } + if (entry.servers === ALL_SERVERS) { + next.push(entry); + continue; + } + const remaining = entry.servers.filter((id) => !servers.includes(id)); + if (remaining.length === entry.servers.length) { + next.push(entry); + continue; + } + changed++; + if (remaining.length > 0) { + next.push({ ...entry, servers: remaining }); + } + } + this.#entries = next; + return changed; + } +} diff --git a/src/protocol/schemas.ts b/src/protocol/schemas.ts index d39f467..9316c72 100644 --- a/src/protocol/schemas.ts +++ b/src/protocol/schemas.ts @@ -32,6 +32,7 @@ export const commandHeaderSchema = z.object({ issued_at: z.number().int().nonnegative(), expires_at: z.number().int().nonnegative(), counter: z.number().int().nonnegative(), + reply_to: base64UrlSchema.optional(), }); export type CommandHeader = z.infer; @@ -113,7 +114,40 @@ export const transportPingFrameSchema = z.object({ }), }); +export const AGENT_NONCE_BYTES = 32; + +export const agentNonceSchema = z + .string() + .regex(/^[A-Za-z0-9_-]{43}$/, "Invalid nonce (expected 32 bytes in base64url)"); + +export const transportHelloFrameSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + kind: z.literal("hello"), + route: z.object({ + agent: keyIdSchema, + }), + body: z.object({ + nonce: agentNonceSchema, + server_time: z.number().int().nonnegative(), + }), +}); + +export const transportAuthFrameSchema = z.object({ + v: z.literal(PROTOCOL_VERSION), + kind: z.literal("auth"), + route: z.object({ + agent: keyIdSchema, + }), + body: z.object({ + nonce: agentNonceSchema, + ts: z.number().int().nonnegative(), + sig: base64UrlSchema, + }), +}); + export const transportFrameSchema = z.discriminatedUnion("kind", [ + transportHelloFrameSchema, + transportAuthFrameSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, diff --git a/src/protocol/trust.ts b/src/protocol/trust.ts index 5f1ede5..0960af9 100644 --- a/src/protocol/trust.ts +++ b/src/protocol/trust.ts @@ -2,12 +2,19 @@ // Copyright (C) 2026 Antônio Miranda import { fingerprint, type PublicKey, type SigningKeyPair } from "../crypto"; +import { type MemberEntry, type Role, RoleTable } from "./roles"; import type { KeyId } from "./schemas"; export interface TrustContext { readonly agentKeyPair: SigningKeyPair; isTrustedAccountKey(id: KeyId): PublicKey | null; isSessionRevoked(certificateId: string): boolean; + /** + * Role of an account on a server (`"*"` for agent-level commands), or null + * when the account has no access. Owners come from the trust list; other + * roles come from accepted role grants. + */ + roleFor(account: KeyId, serverId: string): Role | null; now(): number; claimCommand(signer: KeyId, id: string, counter: number): boolean; } @@ -16,10 +23,17 @@ export interface InMemoryTrustContextOptions { readonly agentKeyPair: SigningKeyPair; readonly trustedAccountKeys: readonly PublicKey[]; readonly revokedSessionIds?: Iterable; + readonly members?: readonly MemberEntry[]; readonly now?: () => number; } -export interface InMemoryTrustContext extends TrustContext { +export interface MemberStore { + listMembers(): readonly MemberEntry[]; + setMember(entry: MemberEntry): void; + revokeMembers(account: KeyId, servers?: readonly string[]): number; +} + +export interface InMemoryTrustContext extends TrustContext, MemberStore { revokeSession(certificateId: string): void; setNow(clock: () => number): void; } @@ -32,6 +46,7 @@ export function createInMemoryTrustContext( trusted.set(fingerprint(key), key); } + const members = new RoleTable(options.members); const revoked = new Set(options.revokedSessionIds); const seenIds = new Set(); const lastCounters = new Map(); @@ -41,7 +56,26 @@ export function createInMemoryTrustContext( agentKeyPair: options.agentKeyPair, isTrustedAccountKey(id: KeyId): PublicKey | null { - return trusted.get(id) ?? null; + return trusted.get(id) ?? members.keyFor(id, clock()); + }, + + roleFor(account: KeyId, serverId: string): Role | null { + if (trusted.has(account)) { + return "owner"; + } + return members.roleFor(account, serverId, clock()); + }, + + listMembers(): readonly MemberEntry[] { + return members.entries(); + }, + + setMember(entry: MemberEntry): void { + members.set(entry); + }, + + revokeMembers(account: KeyId, servers?: readonly string[]): number { + return members.revoke(account, servers); }, isSessionRevoked(certificateId: string): boolean { diff --git a/src/server/index.ts b/src/server/index.ts index 6f7e8c1..a007214 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -96,6 +96,7 @@ export { export { createServerManager, registerServerHandlers, + type ServerHandlerHooks, type ServerManager, type ServerManagerOptions, type ServerStatusReport, @@ -113,6 +114,14 @@ export { validateSingleJvmArg, writeStartScript, } from "./start-script"; +export { + createServerStatusWatcher, + DEFAULT_STATUS_POLL_INTERVAL_MS, + mapUnitState, + type ServerStatusWatcher, + type StatusWatcherOptions, + type StatusWatcherTimers, +} from "./status-watcher"; export { computeMemoryMaxMb, DEFAULT_STOP_POLL_INTERVAL_MS, diff --git a/src/server/runtime.test.ts b/src/server/runtime.test.ts index 515d3ee..d9f0264 100644 --- a/src/server/runtime.test.ts +++ b/src/server/runtime.test.ts @@ -7,12 +7,12 @@ import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync import { tmpdir } from "node:os"; import { join } from "node:path"; import { createCommandQueue, createLogger, type TransportCommandFrame } from "../agent"; +import { openTestEvent } from "../agent/test-events"; import { fingerprint, generateSigningKeyPair, ready } from "../crypto"; import { createCoreRegistry, createInMemoryTrustContext, createSignedCommand, - openAgentMessage, openCommand, PROTOCOL_VERSION, ProtocolError, @@ -476,7 +476,7 @@ describe("ServerManager lifecycle and command integration", () => { // Verify sealed events emitted const events = frames .filter((f): f is Extract => f.kind === "event") - .map((f) => openAgentMessage(f.body, agent.publicKey, account)); + .map((f) => openTestEvent(f.body, agent.publicKey, account)); const listEvent = events.find((e) => e.header.type === "server.list.result"); if (!listEvent) { diff --git a/src/server/runtime.ts b/src/server/runtime.ts index 8c45f44..d16f4f3 100644 --- a/src/server/runtime.ts +++ b/src/server/runtime.ts @@ -8,9 +8,11 @@ import type { Logger } from "../agent/logger"; import { DEFAULT_SERVER_PORT, ProtocolError, + roleAtLeast, type ServerConsoleSendBody, type ServerConsoleSubscribeBody, type ServerCreateBody, + type ServerState, type ServerUpdateSettingsBody, serverCreateBodySchema, serverUpdateSettingsBodySchema, @@ -45,6 +47,7 @@ import { writeServerProperties, } from "./registry"; import { validateJvmArgs, writeStartScript } from "./start-script"; +import { mapUnitState } from "./status-watcher"; import { getUnitStatus, isUnitActive, @@ -116,6 +119,8 @@ export interface ServerManager { restartServer(serverId: string): Promise; deleteServer(serverId: string): Promise; getServerStatus(serverId: string): Promise; + /** Current state of a server's unit as clients see it, or null when unknown. */ + getServerState(serverId: string): Promise; listServers(): ServerMetadata[]; updateServerSettings(params: ServerUpdateSettingsBody): ServerMetadata; sendConsole(serverId: string, line: string): void; @@ -362,6 +367,12 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM }; } + async function getServerState(serverId: string): Promise { + const validId = assertValidServerId(serverId); + const status = await getUnitStatus(validId, options.runFixedImpl); + return mapUnitState(status.activeState); + } + function listServers(): ServerMetadata[] { return listServerMetadata(serversDir); } @@ -442,6 +453,7 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM restartServer, deleteServer, getServerStatus, + getServerState, listServers, updateServerSettings, sendConsole, @@ -454,7 +466,18 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM }; } -export function registerServerHandlers(queue: CommandQueue, manager: ServerManager): void { +export interface ServerHandlerHooks { + /** Called after a command changed a server's state (start, stop, restart). */ + readonly onStateChanged?: (serverId: string) => void; + /** Called after a server was deleted. */ + readonly onDeleted?: (serverId: string) => void; +} + +export function registerServerHandlers( + queue: CommandQueue, + manager: ServerManager, + hooks: ServerHandlerHooks = {}, +): void { queue.registerHandler("server.create", async (opened, ctx) => { const body = opened.body as ServerCreateBody; const server = await manager.createServer(body); @@ -465,24 +488,28 @@ export function registerServerHandlers(queue: CommandQueue, manager: ServerManag const body = opened.body as { readonly server_id: string }; await manager.startServer(body.server_id); ctx.sendEvent("server.started", { server_id: body.server_id }); + hooks.onStateChanged?.(body.server_id); }); queue.registerHandler("server.stop", async (opened, ctx) => { const body = opened.body as { readonly server_id: string }; await manager.stopServer(body.server_id); ctx.sendEvent("server.stopped", { server_id: body.server_id }); + hooks.onStateChanged?.(body.server_id); }); queue.registerHandler("server.restart", async (opened, ctx) => { const body = opened.body as { readonly server_id: string }; await manager.restartServer(body.server_id); ctx.sendEvent("server.restarted", { server_id: body.server_id }); + hooks.onStateChanged?.(body.server_id); }); queue.registerHandler("server.delete", async (opened, ctx) => { const body = opened.body as { readonly server_id: string }; await manager.deleteServer(body.server_id); ctx.sendEvent("server.deleted", { server_id: body.server_id }); + hooks.onDeleted?.(body.server_id); }); queue.registerHandler("server.status", async (opened, ctx) => { @@ -492,7 +519,9 @@ export function registerServerHandlers(queue: CommandQueue, manager: ServerManag }); queue.registerHandler("server.list", (_opened, ctx) => { - const servers = manager.listServers(); + const servers = manager + .listServers() + .filter((server) => roleAtLeast(ctx.roleFor(server.id), "viewer")); ctx.sendEvent("server.list.result", { servers }); }); diff --git a/src/server/status-watcher.ts b/src/server/status-watcher.ts new file mode 100644 index 0000000..6fd5606 --- /dev/null +++ b/src/server/status-watcher.ts @@ -0,0 +1,136 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import type { ServerState, ServerStatusChanged } from "../protocol"; + +export const DEFAULT_STATUS_POLL_INTERVAL_MS = 3_000; + +/** Maps a systemd `ActiveState` to the state clients see, or null when it is not meaningful. */ +export function mapUnitState(activeState: string): ServerState | null { + switch (activeState) { + case "active": + case "reloading": + return "running"; + case "activating": + return "starting"; + case "deactivating": + return "stopping"; + case "inactive": + return "stopped"; + case "failed": + return "crashed"; + default: + return null; + } +} + +export interface StatusWatcherTimers { + setInterval(fn: () => void, ms: number): unknown; + clearInterval(handle: unknown): void; +} + +export interface StatusWatcherOptions { + readonly listServerIds: () => readonly string[]; + readonly getState: (serverId: string) => Promise; + readonly emit: (change: ServerStatusChanged) => void; + /** Polling only runs while this returns true (e.g. while someone is subscribed). */ + readonly shouldPoll?: () => boolean; + readonly now?: () => number; + readonly intervalMs?: number; + readonly timers?: StatusWatcherTimers; +} + +export interface ServerStatusWatcher { + start(): void; + stop(): void; + /** Reads the server's state now and emits a change if it differs from the last one seen. */ + refresh(serverId: string): Promise; + /** Forgets a server that no longer exists. */ + forget(serverId: string): void; + pollOnce(): Promise; +} + +const defaultTimers: StatusWatcherTimers = { + setInterval: (fn, ms) => setInterval(fn, ms), + clearInterval: (handle) => clearInterval(handle as ReturnType), +}; + +export function createServerStatusWatcher(options: StatusWatcherOptions): ServerStatusWatcher { + const now = options.now ?? (() => Date.now()); + const timers = options.timers ?? defaultTimers; + const intervalMs = options.intervalMs ?? DEFAULT_STATUS_POLL_INTERVAL_MS; + const lastStates = new Map(); + let handle: unknown = null; + let polling = false; + + async function observe(serverId: string, emitFirst: boolean): Promise { + let state: ServerState | null; + try { + state = await options.getState(serverId); + } catch { + return; + } + if (state === null) { + return; + } + const previous = lastStates.get(serverId); + lastStates.set(serverId, state); + if (previous === state || (previous === undefined && !emitFirst)) { + return; + } + options.emit({ server_id: serverId, state, at: now() }); + } + + async function pollOnce(): Promise { + if (polling) { + return; + } + polling = true; + try { + const ids = options.listServerIds(); + const known = new Set(ids); + for (const id of lastStates.keys()) { + if (!known.has(id)) { + lastStates.delete(id); + } + } + for (const id of ids) { + await observe(id, false); + } + } finally { + polling = false; + } + } + + return { + start(): void { + if (handle !== null) { + return; + } + handle = timers.setInterval(() => { + if (options.shouldPoll !== undefined && !options.shouldPoll()) { + lastStates.clear(); + return; + } + void pollOnce(); + }, intervalMs); + }, + + stop(): void { + if (handle !== null) { + timers.clearInterval(handle); + handle = null; + } + }, + + refresh(serverId: string): Promise { + return observe(serverId, true); + }, + + forget(serverId: string): void { + lastStates.delete(serverId); + }, + + pollOnce, + }; +} diff --git a/src/state/state.test.ts b/src/state/state.test.ts index 12a5292..933ee05 100644 --- a/src/state/state.test.ts +++ b/src/state/state.test.ts @@ -13,13 +13,14 @@ import { loadOrCreateIdentity, validateCdnHost, } from "../agent"; +import { openTestEvent } from "../agent/test-events"; import { createAgentRuntime } from "../cli/run"; import { fingerprint, generateSigningKeyPair, ready, toBase64Url } from "../crypto"; import { createZipBuffer } from "../files"; import { createCoreRegistry, + createHelloFrame, createSignedCommand, - openAgentMessage, PROTOCOL_VERSION, ProtocolError, STATE_COMMANDS, @@ -732,12 +733,17 @@ describe("state commands protocol & runtime wiring", () => { socket.readyState = 3; }, }; - queueMicrotask(() => socket.onopen?.()); + queueMicrotask(() => { + socket.onopen?.(); + socket.onmessage?.({ + data: JSON.stringify(createHelloFrame({ agent: agentId, serverTime: Date.now() })), + }); + }); return socket; }, }); runtime.start(); - await Promise.resolve(); + await new Promise((resolve) => setTimeout(resolve, 10)); const registry = createCoreRegistry(); let accCounter = 1; @@ -770,7 +776,7 @@ describe("state commands protocol & runtime wiring", () => { const events = slice .filter((f): f is Extract => f.kind === "event") .map((f) => { - const opened = openAgentMessage(f.body, agent.publicKey, account); + const opened = openTestEvent(f.body, agent.publicKey, account); return { type: opened.header.type, body: opened.body }; }); return { ack, events }; diff --git a/src/tunnel/playit.test.ts b/src/tunnel/playit.test.ts index d5c016c..b09f996 100644 --- a/src/tunnel/playit.test.ts +++ b/src/tunnel/playit.test.ts @@ -16,12 +16,12 @@ import { tmpdir } from "node:os"; import { join } from "node:path"; import { createCommandQueue } from "../agent/jobs"; import { createLogger } from "../agent/logger"; +import { openTestEvent } from "../agent/test-events"; import { generateSigningKeyPair, ready, toBase64Url } from "../crypto"; import { createCoreRegistry, createInMemoryTrustContext, createSignedCommand, - openAgentMessage, openCommand, PROTOCOL_VERSION, ProtocolError, @@ -420,7 +420,7 @@ describe("Tunnel protocol commands and sensitivity enforcement", () => { const events = frames .filter((f): f is Extract => f.kind === "event") - .map((f) => openAgentMessage(f.body, agentKeyPair.publicKey, accountKeyPair)); + .map((f) => openTestEvent(f.body, agentKeyPair.publicKey, accountKeyPair)); expect(events.map((e) => e.header.type)).toEqual([ "tunnel.playit.key_updated", From 8577053ceb8bbd5d07be2c73aca478d825bcb1c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Mon, 23 Nov 2026 01:42:13 -0300 Subject: [PATCH 23/59] feat: chunked blob crypto, world import, encrypted serverpacks, backup config read; fix server file groups - tegrad/crypto: encryptBlobChunks/decryptBlobChunks (TGB1, 1 MiB XChaCha20-Poly1305 chunks bound to index and last) - server.world.import (editor): download, verify, decrypt, safe unzip, swap the world with a prior backup - server.deploy.serverpack accepts an optional key for TGB1 blobs - server.backup.config.get (viewer) answers with server.backup.config.result - server files and the shared Java runtime now get group tegrad-srv, setgid directories and group access - tegrad doctor checks server file groups and modes - child processes are spawned by absolute path resolved from the fixed PATH - handler_error logs include the error name and a sanitized message - repeated WebSocket errors drop to debug after three failed attempts --- .../{index-8taagmjn.js => index-98zvzvsw.js} | 49 ++- .../{index-7kn9bty2.js => index-g1frygvt.js} | 310 ++++++++++--- lib/crypto/index.js | 16 +- lib/protocol/index.js | 18 +- lib/types/crypto/blob-stream.d.ts | 30 ++ lib/types/crypto/index.d.ts | 1 + lib/types/protocol/commands/backup.d.ts | 5 + lib/types/protocol/commands/state.d.ts | 30 ++ lib/types/protocol/index.d.ts | 4 +- lib/vault/index.js | 4 +- src/agent/connection.ts | 9 +- src/agent/exec.ts | 31 +- src/agent/hardening.test.ts | 412 ++++++++++++++++++ src/agent/jobs.ts | 22 + src/backup/manager.ts | 5 + src/cli/doctor.test.ts | 23 + src/cli/doctor.ts | 76 +++- src/cli/run.ts | 8 + src/crypto/blob-stream.test.ts | 185 ++++++++ src/crypto/blob-stream.ts | 222 ++++++++++ src/crypto/index.ts | 10 + src/protocol/commands/backup.ts | 8 + src/protocol/commands/state.ts | 50 +++ src/protocol/index.ts | 8 + src/protocol/phase3.test.ts | 2 + src/server/java.ts | 57 +-- src/server/permissions.ts | 184 ++++++++ src/server/runtime.ts | 57 ++- src/state/manager.ts | 162 ++++++- src/state/state.test.ts | 16 + src/state/world-import.test.ts | 341 +++++++++++++++ 31 files changed, 2195 insertions(+), 160 deletions(-) rename lib/chunks/{index-8taagmjn.js => index-98zvzvsw.js} (95%) rename lib/chunks/{index-7kn9bty2.js => index-g1frygvt.js} (69%) create mode 100644 lib/types/crypto/blob-stream.d.ts create mode 100644 src/agent/hardening.test.ts create mode 100644 src/crypto/blob-stream.test.ts create mode 100644 src/crypto/blob-stream.ts create mode 100644 src/server/permissions.ts create mode 100644 src/state/world-import.test.ts diff --git a/lib/chunks/index-8taagmjn.js b/lib/chunks/index-98zvzvsw.js similarity index 95% rename from lib/chunks/index-8taagmjn.js rename to lib/chunks/index-98zvzvsw.js index e867160..7be7e68 100644 --- a/lib/chunks/index-8taagmjn.js +++ b/lib/chunks/index-98zvzvsw.js @@ -12,7 +12,7 @@ import { sign, toBase64Url, verify -} from "./index-7kn9bty2.js"; +} from "./index-g1frygvt.js"; // src/protocol/errors.ts class ProtocolError extends Error { @@ -1138,6 +1138,12 @@ var serverBackupConfigSetCommand = defineCommand({ minRole: "editor", body: serverBackupConfigSetBodySchema }); +var serverBackupConfigGetCommand = defineCommand({ + type: "server.backup.config.get", + sensitive: false, + minRole: "viewer", + body: z6.object({ server_id: serverIdSchema }).strict() +}); var serverBackupCreateCommand = defineCommand({ type: "server.backup.create", sensitive: false, @@ -1164,6 +1170,7 @@ var serverBackupRestoreCommand = defineCommand({ }); var BACKUP_COMMANDS = [ serverBackupConfigSetCommand, + serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, @@ -1532,13 +1539,40 @@ var serverOriginApplyBodySchema = z9.object({ var serverOriginUnlinkBodySchema = z9.object({ server_id: serverIdSchema }).strict(); +var blobKeySchema = z9.string().regex(/^[A-Za-z0-9_-]{43}$/, "Expected a 32-byte key in base64url"); +var WORLD_NAME_REGEX = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$/; +var RESERVED_WORLD_NAMES = new Set([ + "mods", + "config", + "defaultconfigs", + "logs", + "libraries", + "plugins", + "versions", + "crash-reports", + "resourcepacks", + "datapacks", + "kubejs", + "scripts" +]); +var worldNameSchema = z9.string().regex(WORLD_NAME_REGEX, "Invalid world name").refine((name) => !name.includes("..") && !RESERVED_WORLD_NAMES.has(name.toLowerCase()), { + message: "Reserved or unsafe world name" +}); +var serverWorldImportBodySchema = z9.object({ + server_id: serverIdSchema, + world_name: worldNameSchema, + url: z9.string().url().max(2048), + sha256: sha256HexSchema, + key: blobKeySchema +}).strict(); var serverDeployServerpackBodySchema = z9.object({ server_id: serverIdSchema, url: z9.string().url().max(2048), sha256: sha256HexSchema.optional(), sha512: sha512HexSchema.optional(), sha1: sha1HexSchema.optional(), - origin: serverOriginSchema.optional() + origin: serverOriginSchema.optional(), + key: blobKeySchema.optional() }).strict(); var serverModsListCommand = defineCommand({ type: "server.mods.list", @@ -1582,6 +1616,12 @@ var serverDeployServerpackCommand = defineCommand({ minRole: "editor", body: serverDeployServerpackBodySchema }); +var serverWorldImportCommand = defineCommand({ + type: "server.world.import", + sensitive: false, + minRole: "editor", + body: serverWorldImportBodySchema +}); var STATE_COMMANDS = [ serverModsListCommand, serverModsInstallCommand, @@ -1589,7 +1629,8 @@ var STATE_COMMANDS = [ serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, - serverDeployServerpackCommand + serverDeployServerpackCommand, + serverWorldImportCommand ]; function registerStateCommands(registry) { return registry.registerAll(STATE_COMMANDS); @@ -2010,4 +2051,4 @@ function createInMemoryTrustContext(options) { } }; } -export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, serverCreateBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverCreateCommand, serverRestartCommand, serverStatusCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; +export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, serverCreateBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverCreateCommand, serverRestartCommand, serverStatusCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; diff --git a/lib/chunks/index-7kn9bty2.js b/lib/chunks/index-g1frygvt.js similarity index 69% rename from lib/chunks/index-7kn9bty2.js rename to lib/chunks/index-g1frygvt.js index cc0c084..50c764f 100644 --- a/lib/chunks/index-7kn9bty2.js +++ b/lib/chunks/index-g1frygvt.js @@ -54,6 +54,246 @@ function aeadDecrypt(ciphertext, key, associatedData) { const body = ciphertext.subarray(AEAD_NONCE_BYTES); return s.crypto_aead_xchacha20poly1305_ietf_decrypt(null, body, associatedData ?? null, nonce, key); } +// src/crypto/canonical.ts +var utf8Encoder = new TextEncoder; +function compareCodeUnits(a, b) { + if (a < b) + return -1; + if (a > b) + return 1; + return 0; +} +function serializeCanonical(value, ancestors) { + if (value === null) + return "null"; + switch (typeof value) { + case "boolean": + return value ? "true" : "false"; + case "number": { + if (!Number.isFinite(value)) { + throw new TypeError("Cannot canonicalize non-finite number"); + } + return Object.is(value, -0) ? "0" : JSON.stringify(value); + } + case "string": + return JSON.stringify(value); + case "undefined": + case "function": + case "symbol": + case "bigint": + throw new TypeError(`Cannot canonicalize value of type ${typeof value}`); + case "object": { + if (ancestors.has(value)) { + throw new TypeError("Cannot canonicalize circular reference"); + } + if (Array.isArray(value)) { + ancestors.add(value); + try { + const items = []; + for (let i = 0;i < value.length; i++) { + items.push(serializeCanonical(value[i], ancestors)); + } + return `[${items.join(",")}]`; + } finally { + ancestors.delete(value); + } + } + const proto = Object.getPrototypeOf(value); + if (proto !== Object.prototype && proto !== null) { + throw new TypeError("Cannot canonicalize non-plain object"); + } + ancestors.add(value); + try { + const record = value; + const keys = Object.keys(record).filter((k) => record[k] !== undefined).sort(compareCodeUnits); + const entries = []; + for (const key of keys) { + entries.push(`${JSON.stringify(key)}:${serializeCanonical(record[key], ancestors)}`); + } + return `{${entries.join(",")}}`; + } finally { + ancestors.delete(value); + } + } + default: + throw new TypeError(`Cannot canonicalize value of type ${typeof value}`); + } +} +function canonicalize(value) { + return utf8Encoder.encode(serializeCanonical(value, new Set)); +} + +// src/crypto/blob-stream.ts +var BLOB_MAGIC = new Uint8Array([84, 71, 66, 49]); +var BLOB_CHUNK_BYTES = 1024 * 1024; +var BLOB_MAX_FRAME_BYTES = BLOB_CHUNK_BYTES + AEAD_NONCE_BYTES + AEAD_TAG_BYTES; +function chunkAad(index, last) { + return canonicalize({ v: 1, index, last }); +} +async function* iterate(input) { + if (input instanceof Uint8Array) { + yield input; + return; + } + for await (const part of input) { + yield part; + } +} +async function* slice(input, size) { + let pending = new Uint8Array(0); + for await (const part of iterate(input)) { + if (part.length === 0) { + continue; + } + let data = part; + if (pending.length > 0) { + const merged = new Uint8Array(pending.length + data.length); + merged.set(pending, 0); + merged.set(data, pending.length); + data = merged; + pending = new Uint8Array(0); + } + let offset = 0; + while (data.length - offset >= size) { + yield data.subarray(offset, offset + size); + offset += size; + } + pending = data.subarray(offset); + } + if (pending.length > 0) { + yield pending; + } +} +function u32le(value) { + const out = new Uint8Array(4); + new DataView(out.buffer).setUint32(0, value, true); + return out; +} +async function* encryptBlobChunks(plaintext, key) { + yield BLOB_MAGIC; + let index = 0; + let previous = null; + for await (const chunk of slice(plaintext, BLOB_CHUNK_BYTES)) { + if (previous !== null) { + const sealed2 = aeadEncrypt(previous, key, chunkAad(index, false)); + yield u32le(sealed2.length); + yield sealed2; + index++; + } + previous = chunk; + } + const sealed = aeadEncrypt(previous ?? new Uint8Array(0), key, chunkAad(index, true)); + yield u32le(sealed.length); + yield sealed; +} + +class ByteReader { + #iterator; + #buffer = new Uint8Array(0); + #done = false; + constructor(input) { + this.#iterator = iterate(input)[Symbol.asyncIterator](); + } + async read(length) { + while (this.#buffer.length < length && !this.#done) { + const next = await this.#iterator.next(); + if (next.done === true) { + this.#done = true; + break; + } + if (next.value.length === 0) { + continue; + } + if (this.#buffer.length === 0) { + this.#buffer = next.value; + } else { + const merged = new Uint8Array(this.#buffer.length + next.value.length); + merged.set(this.#buffer, 0); + merged.set(next.value, this.#buffer.length); + this.#buffer = merged; + } + } + const take = Math.min(length, this.#buffer.length); + const out = this.#buffer.subarray(0, take); + this.#buffer = this.#buffer.subarray(take); + return out; + } +} + +class BlobFormatError extends Error { + constructor(message) { + super(message); + this.name = "BlobFormatError"; + } +} +async function* decryptBlobChunks(ciphertext, key, options = {}) { + const reader = new ByteReader(ciphertext); + const magic = await reader.read(BLOB_MAGIC.length); + if (magic.length !== BLOB_MAGIC.length || !BLOB_MAGIC.every((byte, i) => magic[i] === byte)) { + throw new BlobFormatError("Not a TGB1 blob"); + } + let index = 0; + let total = 0; + while (true) { + const prefix = await reader.read(4); + if (prefix.length === 0) { + throw new BlobFormatError("Blob is truncated"); + } + if (prefix.length !== 4) { + throw new BlobFormatError("Blob frame header is truncated"); + } + const length = new DataView(prefix.buffer, prefix.byteOffset, 4).getUint32(0, true); + if (length < AEAD_NONCE_BYTES + AEAD_TAG_BYTES || length > BLOB_MAX_FRAME_BYTES) { + throw new BlobFormatError("Blob frame has an invalid length"); + } + const frame = await reader.read(length); + if (frame.length !== length) { + throw new BlobFormatError("Blob frame is truncated"); + } + let plain; + let last; + try { + plain = aeadDecrypt(frame, key, chunkAad(index, false)); + last = false; + } catch { + try { + plain = aeadDecrypt(frame, key, chunkAad(index, true)); + last = true; + } catch { + throw new BlobFormatError("Blob chunk failed authentication"); + } + } + total += plain.length; + if (options.maxPlaintextBytes !== undefined && total > options.maxPlaintextBytes) { + throw new BlobFormatError("Blob exceeds the maximum plaintext size"); + } + if (last) { + const rest = await reader.read(1); + if (rest.length !== 0) { + throw new BlobFormatError("Blob has data after the final chunk"); + } + yield plain; + return; + } + yield plain; + index++; + } +} +async function collectChunks(input) { + const parts = []; + let total = 0; + for await (const part of iterate(input)) { + parts.push(part); + total += part.length; + } + const out = new Uint8Array(total); + let offset = 0; + for (const part of parts) { + out.set(part, offset); + offset += part.length; + } + return out; +} // src/crypto/encoding.ts var BASE64URL_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; var BASE32_ALPHABET = "abcdefghijklmnopqrstuvwxyz234567"; @@ -224,74 +464,6 @@ function openSealed(ciphertext, recipientSigningKeyPair) { s.memzero(curveSk); } } -// src/crypto/canonical.ts -var utf8Encoder = new TextEncoder; -function compareCodeUnits(a, b) { - if (a < b) - return -1; - if (a > b) - return 1; - return 0; -} -function serializeCanonical(value, ancestors) { - if (value === null) - return "null"; - switch (typeof value) { - case "boolean": - return value ? "true" : "false"; - case "number": { - if (!Number.isFinite(value)) { - throw new TypeError("Cannot canonicalize non-finite number"); - } - return Object.is(value, -0) ? "0" : JSON.stringify(value); - } - case "string": - return JSON.stringify(value); - case "undefined": - case "function": - case "symbol": - case "bigint": - throw new TypeError(`Cannot canonicalize value of type ${typeof value}`); - case "object": { - if (ancestors.has(value)) { - throw new TypeError("Cannot canonicalize circular reference"); - } - if (Array.isArray(value)) { - ancestors.add(value); - try { - const items = []; - for (let i = 0;i < value.length; i++) { - items.push(serializeCanonical(value[i], ancestors)); - } - return `[${items.join(",")}]`; - } finally { - ancestors.delete(value); - } - } - const proto = Object.getPrototypeOf(value); - if (proto !== Object.prototype && proto !== null) { - throw new TypeError("Cannot canonicalize non-plain object"); - } - ancestors.add(value); - try { - const record = value; - const keys = Object.keys(record).filter((k) => record[k] !== undefined).sort(compareCodeUnits); - const entries = []; - for (const key of keys) { - entries.push(`${JSON.stringify(key)}:${serializeCanonical(record[key], ancestors)}`); - } - return `{${entries.join(",")}}`; - } finally { - ancestors.delete(value); - } - } - default: - throw new TypeError(`Cannot canonicalize value of type ${typeof value}`); - } -} -function canonicalize(value) { - return utf8Encoder.encode(serializeCanonical(value, new Set)); -} // src/crypto/hash.ts var HASH_BYTES = 32; function hash(data, key) { @@ -360,4 +532,4 @@ function deriveKeyFromPassword(password, params, keyLength = KDF_KEY_BYTES) { } } } -export { ready, randomBytes, memzero, SYMMETRIC_KEY_BYTES, AEAD_NONCE_BYTES, AEAD_TAG_BYTES, generateSymmetricKey, aeadEncrypt, aeadDecrypt, toBase64Url, fromBase64Url, toBase32, SIGNING_PUBLIC_KEY_BYTES, SIGNING_SECRET_KEY_BYTES, SIGNING_SEED_BYTES, SIGNATURE_BYTES, FINGERPRINT_HASH_BYTES, FINGERPRINT_TRUNCATED_BYTES, generateSigningKeyPair, signingKeyPairFromSeed, sign, verify, fingerprint, sealTo, openSealed, canonicalize, HASH_BYTES, hash, SHA256_BYTES, sha256, KDF_ALG_ARGON2ID13, KDF_SALT_BYTES, KDF_KEY_BYTES, KDF_FLOOR, KDF_MODERATE, generateSalt, assertKdfParams, deriveKeyFromPassword }; +export { ready, randomBytes, memzero, SYMMETRIC_KEY_BYTES, AEAD_NONCE_BYTES, AEAD_TAG_BYTES, generateSymmetricKey, aeadEncrypt, aeadDecrypt, canonicalize, BLOB_MAGIC, BLOB_CHUNK_BYTES, BLOB_MAX_FRAME_BYTES, encryptBlobChunks, BlobFormatError, decryptBlobChunks, collectChunks, toBase64Url, fromBase64Url, toBase32, SIGNING_PUBLIC_KEY_BYTES, SIGNING_SECRET_KEY_BYTES, SIGNING_SEED_BYTES, SIGNATURE_BYTES, FINGERPRINT_HASH_BYTES, FINGERPRINT_TRUNCATED_BYTES, generateSigningKeyPair, signingKeyPairFromSeed, sign, verify, fingerprint, sealTo, openSealed, HASH_BYTES, hash, SHA256_BYTES, sha256, KDF_ALG_ARGON2ID13, KDF_SALT_BYTES, KDF_KEY_BYTES, KDF_FLOOR, KDF_MODERATE, generateSalt, assertKdfParams, deriveKeyFromPassword }; diff --git a/lib/crypto/index.js b/lib/crypto/index.js index ede4c71..86cf513 100644 --- a/lib/crypto/index.js +++ b/lib/crypto/index.js @@ -1,6 +1,10 @@ import { AEAD_NONCE_BYTES, AEAD_TAG_BYTES, + BLOB_CHUNK_BYTES, + BLOB_MAGIC, + BLOB_MAX_FRAME_BYTES, + BlobFormatError, FINGERPRINT_HASH_BYTES, FINGERPRINT_TRUNCATED_BYTES, HASH_BYTES, @@ -19,7 +23,10 @@ import { aeadEncrypt, assertKdfParams, canonicalize, + collectChunks, + decryptBlobChunks, deriveKeyFromPassword, + encryptBlobChunks, fingerprint, fromBase64Url, generateSalt, @@ -37,7 +44,7 @@ import { toBase32, toBase64Url, verify -} from "../chunks/index-7kn9bty2.js"; +} from "../chunks/index-g1frygvt.js"; export { verify, toBase64Url, @@ -56,7 +63,10 @@ export { generateSalt, fromBase64Url, fingerprint, + encryptBlobChunks, deriveKeyFromPassword, + decryptBlobChunks, + collectChunks, canonicalize, assertKdfParams, aeadEncrypt, @@ -75,6 +85,10 @@ export { HASH_BYTES, FINGERPRINT_TRUNCATED_BYTES, FINGERPRINT_HASH_BYTES, + BlobFormatError, + BLOB_MAX_FRAME_BYTES, + BLOB_MAGIC, + BLOB_CHUNK_BYTES, AEAD_TAG_BYTES, AEAD_NONCE_BYTES }; diff --git a/lib/protocol/index.js b/lib/protocol/index.js index 17ce98a..cc678e1 100644 --- a/lib/protocol/index.js +++ b/lib/protocol/index.js @@ -46,6 +46,7 @@ import { PLAYIT_SECRET_KEY_REGEX, PROTOCOL_VERSION, ProtocolError, + RESERVED_WORLD_NAMES, ROLES, ROLE_LEVEL, RoleTable, @@ -59,6 +60,7 @@ import { STATE_COMMANDS, SUBSCRIPTION_TOPICS, TUNNEL_COMMANDS, + WORLD_NAME_REGEX, agentEventBodySchema, agentMembersRevokeBodySchema, agentMembersRevokeCommand, @@ -79,6 +81,7 @@ import { backupScheduleConfigSchema, backupTegraCloudConfigSchema, base64UrlSchema, + blobKeySchema, buildPairingFragment, commandHeaderSchema, consoleLineSchema, @@ -141,6 +144,7 @@ import { s3PrefixSchema, s3RegionSchema, sealAgentMessage, + serverBackupConfigGetCommand, serverBackupConfigSetBodySchema, serverBackupConfigSetCommand, serverBackupCreateBodySchema, @@ -189,6 +193,8 @@ import { serverStopCommand, serverUpdateSettingsBodySchema, serverUpdateSettingsCommand, + serverWorldImportBodySchema, + serverWorldImportCommand, sessionCertificateSchema, sha1HexSchema, sha256HexSchema, @@ -220,11 +226,13 @@ import { verifyRoleGrant, verifySessionCertificate, verifyTrustGrant, + worldNameSchema, wrapEventBody -} from "../chunks/index-8taagmjn.js"; -import"../chunks/index-7kn9bty2.js"; +} from "../chunks/index-98zvzvsw.js"; +import"../chunks/index-g1frygvt.js"; export { wrapEventBody, + worldNameSchema, verifyTrustGrant, verifySessionCertificate, verifyRoleGrant, @@ -256,6 +264,8 @@ export { sha256HexSchema, sha1HexSchema, sessionCertificateSchema, + serverWorldImportCommand, + serverWorldImportBodySchema, serverUpdateSettingsCommand, serverUpdateSettingsBodySchema, serverStopCommand, @@ -304,6 +314,7 @@ export { serverBackupCreateBodySchema, serverBackupConfigSetCommand, serverBackupConfigSetBodySchema, + serverBackupConfigGetCommand, sealAgentMessage, s3RegionSchema, s3PrefixSchema, @@ -366,6 +377,7 @@ export { consoleLineSchema, commandHeaderSchema, buildPairingFragment, + blobKeySchema, base64UrlSchema, backupTegraCloudConfigSchema, backupScheduleConfigSchema, @@ -386,6 +398,7 @@ export { agentMembersRevokeCommand, agentMembersRevokeBodySchema, agentEventBodySchema, + WORLD_NAME_REGEX, TUNNEL_COMMANDS, SUBSCRIPTION_TOPICS, STATE_COMMANDS, @@ -399,6 +412,7 @@ export { RoleTable, ROLE_LEVEL, ROLES, + RESERVED_WORLD_NAMES, ProtocolError, PROTOCOL_VERSION, PLAYIT_SECRET_KEY_REGEX, diff --git a/lib/types/crypto/blob-stream.d.ts b/lib/types/crypto/blob-stream.d.ts new file mode 100644 index 0000000..9878ef3 --- /dev/null +++ b/lib/types/crypto/blob-stream.d.ts @@ -0,0 +1,30 @@ +/** + * Chunked blob format ("TGB1"): + * + * "TGB1" | frame* + * frame = u32le(length) | aeadEncrypt(chunk, key, aad) // length = nonce + ciphertext + tag + * aad = canonicalize({ v: 1, index, last }) + * + * Chunks hold up to 1 MiB of plaintext. Binding the index and the `last` flag + * into the AAD makes reordering, repeating and truncating a blob detectable. + * The input is never required to fit in memory. + */ +export declare const BLOB_MAGIC: Uint8Array; +export declare const BLOB_CHUNK_BYTES: number; +export declare const BLOB_MAX_FRAME_BYTES: number; +export type BlobInput = Uint8Array | AsyncIterable | Iterable; +/** Encrypts a byte stream into TGB1 pieces. Yields the header first, then one frame per chunk. */ +export declare function encryptBlobChunks(plaintext: BlobInput, key: Uint8Array): AsyncGenerator; +export declare class BlobFormatError extends Error { + constructor(message: string); +} +/** + * Decrypts a TGB1 stream, yielding plaintext chunks as they are verified. + * Throws `BlobFormatError` on a bad header, oversized frame, truncation, trailing + * data, reordering or tampering. Nothing is yielded for a chunk that fails. + */ +export declare function decryptBlobChunks(ciphertext: BlobInput, key: Uint8Array, options?: { + readonly maxPlaintextBytes?: number; +}): AsyncGenerator; +/** Collects a stream of chunks into one buffer (for small blobs and tests). */ +export declare function collectChunks(input: BlobInput): Promise; diff --git a/lib/types/crypto/index.d.ts b/lib/types/crypto/index.d.ts index 863a55a..a2127d5 100644 --- a/lib/types/crypto/index.d.ts +++ b/lib/types/crypto/index.d.ts @@ -1,4 +1,5 @@ export { AEAD_NONCE_BYTES, AEAD_TAG_BYTES, aeadDecrypt, aeadEncrypt, generateSymmetricKey, SYMMETRIC_KEY_BYTES, } from "./aead"; +export { BLOB_CHUNK_BYTES, BLOB_MAGIC, BLOB_MAX_FRAME_BYTES, BlobFormatError, type BlobInput, collectChunks, decryptBlobChunks, encryptBlobChunks, } from "./blob-stream"; export { openSealed, sealTo } from "./box"; export { canonicalize } from "./canonical"; export { fromBase64Url, toBase32, toBase64Url } from "./encoding"; diff --git a/lib/types/protocol/commands/backup.d.ts b/lib/types/protocol/commands/backup.d.ts index 4da6662..b374487 100644 --- a/lib/types/protocol/commands/backup.d.ts +++ b/lib/types/protocol/commands/backup.d.ts @@ -136,6 +136,9 @@ export declare const serverBackupConfigSetCommand: import("..").CommandDefinitio retention_count?: number | undefined; } | undefined; }>; +export declare const serverBackupConfigGetCommand: import("..").CommandDefinition<"server.backup.config.get", { + server_id: string; +}>; export declare const serverBackupCreateCommand: import("..").CommandDefinition<"server.backup.create", { server_id: string; note?: string | undefined; @@ -183,6 +186,8 @@ export declare const BACKUP_COMMANDS: readonly [import("..").CommandDefinition<" enabled: boolean; retention_count?: number | undefined; } | undefined; +}>, import("..").CommandDefinition<"server.backup.config.get", { + server_id: string; }>, import("..").CommandDefinition<"server.backup.create", { server_id: string; note?: string | undefined; diff --git a/lib/types/protocol/commands/state.d.ts b/lib/types/protocol/commands/state.d.ts index a7b411d..4b58f29 100644 --- a/lib/types/protocol/commands/state.d.ts +++ b/lib/types/protocol/commands/state.d.ts @@ -209,6 +209,20 @@ export declare const serverOriginApplyBodySchema: z.ZodObject<{ export declare const serverOriginUnlinkBodySchema: z.ZodObject<{ server_id: z.ZodString; }, z.core.$strict>; +/** 32-byte symmetric key in base64url (no padding) for blobs in the chunked TGB1 format. */ +export declare const blobKeySchema: z.ZodString; +export declare const WORLD_NAME_REGEX: RegExp; +/** Folder names that hold server content other than a world. */ +export declare const RESERVED_WORLD_NAMES: ReadonlySet; +export declare const worldNameSchema: z.ZodString; +export declare const serverWorldImportBodySchema: z.ZodObject<{ + server_id: z.ZodString; + world_name: z.ZodString; + url: z.ZodString; + sha256: z.ZodString; + key: z.ZodString; +}, z.core.$strict>; +export type ServerWorldImportBody = z.infer; export declare const serverDeployServerpackBodySchema: z.ZodObject<{ server_id: z.ZodString; url: z.ZodString; @@ -229,6 +243,7 @@ export declare const serverDeployServerpackBodySchema: z.ZodObject<{ kind: z.ZodLiteral<"local">; note: z.ZodOptional; }, z.core.$strict>], "kind">>>; + key: z.ZodOptional; }, z.core.$strict>; export type ServerModsListBody = z.infer; export type ServerModsInstallBody = z.infer; @@ -313,6 +328,14 @@ export declare const serverDeployServerpackCommand: import("..").CommandDefiniti kind: "local"; note?: string | undefined; } | null | undefined; + key?: string | undefined; +}>; +export declare const serverWorldImportCommand: import("..").CommandDefinition<"server.world.import", { + server_id: string; + world_name: string; + url: string; + sha256: string; + key: string; }>; export declare const STATE_COMMANDS: readonly [import("..").CommandDefinition<"server.mods.list", { server_id: string; @@ -384,5 +407,12 @@ export declare const STATE_COMMANDS: readonly [import("..").CommandDefinition<"s kind: "local"; note?: string | undefined; } | null | undefined; + key?: string | undefined; +}>, import("..").CommandDefinition<"server.world.import", { + server_id: string; + world_name: string; + url: string; + sha256: string; + key: string; }>]; export declare function registerStateCommands(registry: CommandRegistry): CommandRegistry; diff --git a/lib/types/protocol/index.d.ts b/lib/types/protocol/index.d.ts index d5f7f22..788d018 100644 --- a/lib/types/protocol/index.d.ts +++ b/lib/types/protocol/index.d.ts @@ -2,12 +2,12 @@ export { AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_SIG, export { type AgentEventBody, agentEventBodySchema, type OpenedAgentEvent, type OpenedAgentMessage, openAgentEvent, openAgentMessage, type SealAgentMessageParams, sealAgentMessage, wrapEventBody, } from "./agent-message"; export { COMMAND_ID_BYTES, type CreateSignedCommandParams, createSignedCommand, DEFAULT_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, MAX_COMMAND_TTL_MS, type OpenedCommand, openCommand, } from "./command"; export { AGENT_COMMANDS, type AgentMembersRevokeBody, type AgentMembersSetBody, type AgentSubscribeBody, agentMembersRevokeBodySchema, agentMembersRevokeCommand, agentMembersSetBodySchema, agentMembersSetCommand, agentSubscribeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, registerAgentCommands, SERVER_STATES, type ServerState, type ServerStatusChanged, SUBSCRIPTION_TOPICS, type SubscriptionTopic, serverStateSchema, serverStatusChangedSchema, subscriptionTopicSchema, } from "./commands/agent"; -export { BACKUP_COMMANDS, BACKUP_ID_REGEX, type BackupDestinationKind, type BackupLocalConfig, type BackupS3ConfigInput, type BackupScheduleConfig, type BackupTegraCloudConfig, backupDestinationKindSchema, backupIdSchema, backupLocalConfigSchema, backupS3ConfigSchema, backupScheduleConfigSchema, backupTegraCloudConfigSchema, MAX_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_RETENTION_COUNT, MIN_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, registerBackupCommands, type ServerBackupConfigSetBody, type ServerBackupCreateBody, type ServerBackupDeleteBody, type ServerBackupListBody, type ServerBackupRestoreBody, s3BucketSchema, s3PrefixSchema, s3RegionSchema, serverBackupConfigSetBodySchema, serverBackupConfigSetCommand, serverBackupCreateBodySchema, serverBackupCreateCommand, serverBackupDeleteBodySchema, serverBackupDeleteCommand, serverBackupListBodySchema, serverBackupListCommand, serverBackupRestoreBodySchema, serverBackupRestoreCommand, } from "./commands/backup"; +export { BACKUP_COMMANDS, BACKUP_ID_REGEX, type BackupDestinationKind, type BackupLocalConfig, type BackupS3ConfigInput, type BackupScheduleConfig, type BackupTegraCloudConfig, backupDestinationKindSchema, backupIdSchema, backupLocalConfigSchema, backupS3ConfigSchema, backupScheduleConfigSchema, backupTegraCloudConfigSchema, MAX_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_RETENTION_COUNT, MIN_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, registerBackupCommands, type ServerBackupConfigSetBody, type ServerBackupCreateBody, type ServerBackupDeleteBody, type ServerBackupListBody, type ServerBackupRestoreBody, s3BucketSchema, s3PrefixSchema, s3RegionSchema, serverBackupConfigGetCommand, serverBackupConfigSetBodySchema, serverBackupConfigSetCommand, serverBackupCreateBodySchema, serverBackupCreateCommand, serverBackupDeleteBodySchema, serverBackupDeleteCommand, serverBackupListBodySchema, serverBackupListCommand, serverBackupRestoreBodySchema, serverBackupRestoreCommand, } from "./commands/backup"; export { agentPingCommand, CORE_COMMANDS, createCoreRegistry, registerCoreCommands, serverDeleteCommand, serverStartCommand, serverStopCommand, } from "./commands/core"; export { FILES_COMMANDS, fileEncodingSchema, filesCopyCommand, filesDeleteCommand, filesDownloadBeginCommand, filesDownloadCloseCommand, filesDownloadCommand, filesDownloadPartCommand, filesListCommand, filesMkdirCommand, filesReadCommand, filesRenameCommand, filesStatCommand, filesUnzipCommand, filesUploadAbortCommand, filesUploadBeginCommand, filesUploadCommitCommand, filesUploadPartCommand, filesWriteCommand, filesZipCommand, registerFilesCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, sha256HexSchema, } from "./commands/files"; export { agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, } from "./commands/pairing"; export { consoleLineSchema, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MAX_JVM_ARGS, MAX_SERVER_MEMORY_MB, MIN_SERVER_MEMORY_MB, registerServerCommands, SERVER_COMMANDS, SERVER_ID_REGEX, type ServerConsoleSendBody, type ServerConsoleSubscribeBody, type ServerCreateBody, type ServerLoader, type ServerUpdateSettingsBody, serverConsoleSendBodySchema, serverConsoleSendCommand, serverConsoleSubscribeBodySchema, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, serverCreateBodySchema, serverCreateCommand, serverIdSchema, serverListCommand, serverLoaderSchema, serverMemoryMbSchema, serverPortSchema, serverRestartCommand, serverStatusCommand, serverUpdateSettingsBodySchema, serverUpdateSettingsCommand, } from "./commands/server"; -export { type ModEnvironmentInfo, type ModLayer, type ModSource, modEnvironmentInfoSchema, modFileNameSchema, modLayerSchema, modSourceSchema, type OriginPlanFileInput, type OriginPlanModInput, originPlanFileInputSchema, originPlanModInputSchema, registerStateCommands, type ServerDeployServerpackBody, type ServerModEntry, type ServerModsInstallBody, type ServerModsListBody, type ServerModsRemoveBody, type ServerOrigin, type ServerOriginApplyBody, type ServerOriginPlanBody, type ServerOriginSyncState, type ServerOriginUnlinkBody, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, STATE_COMMANDS, serverDeployServerpackBodySchema, serverDeployServerpackCommand, serverModEntrySchema, serverModsInstallBodySchema, serverModsInstallCommand, serverModsListBodySchema, serverModsListCommand, serverModsRemoveBodySchema, serverModsRemoveCommand, serverOriginApplyBodySchema, serverOriginApplyCommand, serverOriginPlanBodySchema, serverOriginPlanCommand, serverOriginSchema, serverOriginSyncStateSchema, serverOriginUnlinkBodySchema, serverOriginUnlinkCommand, sha1HexSchema, sha512HexSchema, } from "./commands/state"; +export { blobKeySchema, type ModEnvironmentInfo, type ModLayer, type ModSource, modEnvironmentInfoSchema, modFileNameSchema, modLayerSchema, modSourceSchema, type OriginPlanFileInput, type OriginPlanModInput, originPlanFileInputSchema, originPlanModInputSchema, RESERVED_WORLD_NAMES, registerStateCommands, type ServerDeployServerpackBody, type ServerModEntry, type ServerModsInstallBody, type ServerModsListBody, type ServerModsRemoveBody, type ServerOrigin, type ServerOriginApplyBody, type ServerOriginPlanBody, type ServerOriginSyncState, type ServerOriginUnlinkBody, type ServerWorldImportBody, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, STATE_COMMANDS, serverDeployServerpackBodySchema, serverDeployServerpackCommand, serverModEntrySchema, serverModsInstallBodySchema, serverModsInstallCommand, serverModsListBodySchema, serverModsListCommand, serverModsRemoveBodySchema, serverModsRemoveCommand, serverOriginApplyBodySchema, serverOriginApplyCommand, serverOriginPlanBodySchema, serverOriginPlanCommand, serverOriginSchema, serverOriginSyncStateSchema, serverOriginUnlinkBodySchema, serverOriginUnlinkCommand, serverWorldImportBodySchema, serverWorldImportCommand, sha1HexSchema, sha512HexSchema, WORLD_NAME_REGEX, worldNameSchema, } from "./commands/state"; export { PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, registerTunnelCommands, TUNNEL_COMMANDS, type TunnelPlayitSetKeyBody, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStatusCommand, tunnelPlayitStopCommand, } from "./commands/tunnel"; export { DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_AGENT_MESSAGE, DOMAIN_COMMAND, DOMAIN_PAIRING_PROOF, DOMAIN_REVOCATION, DOMAIN_ROLE_GRANT, DOMAIN_SESSION, DOMAIN_TRUST_GRANT, PROTOCOL_VERSION, } from "./domains"; export { ProtocolError, type ProtocolErrorCode } from "./errors"; diff --git a/lib/vault/index.js b/lib/vault/index.js index 70bc547..47f2274 100644 --- a/lib/vault/index.js +++ b/lib/vault/index.js @@ -5,7 +5,7 @@ import { sessionCertificateSchema, signRevocationList, signSessionCertificate -} from "../chunks/index-8taagmjn.js"; +} from "../chunks/index-98zvzvsw.js"; import { KDF_ALG_ARGON2ID13, KDF_MODERATE, @@ -26,7 +26,7 @@ import { randomBytes, signingKeyPairFromSeed, toBase64Url -} from "../chunks/index-7kn9bty2.js"; +} from "../chunks/index-g1frygvt.js"; // src/vault/blob.ts import { z } from "zod"; diff --git a/src/agent/connection.ts b/src/agent/connection.ts index d562a77..94b3d22 100644 --- a/src/agent/connection.ts +++ b/src/agent/connection.ts @@ -19,6 +19,8 @@ export const STABLE_CONNECTION_MS = 30_000; export const HEARTBEAT_INTERVAL_MS = 25_000; export const IDLE_TIMEOUT_MS = 75_000; export const HELLO_TIMEOUT_MS = 10_000; +/** After this many failed attempts in a row, connection errors are logged at debug level. */ +export const QUIET_AFTER_FAILED_ATTEMPTS = 3; export const WS_READY_STATE_CONNECTING = 0; export const WS_READY_STATE_OPEN = 1; @@ -471,7 +473,12 @@ export function createAgentConnection(options: AgentConnectionOptions): AgentCon if (!running || socket !== ws) { return; } - options.logger.warn("WebSocket error occurred"); + // Repeated failures of the same outage are noise: warn for the first few, then debug. + if (reconnectAttempt < QUIET_AFTER_FAILED_ATTEMPTS) { + options.logger.warn("WebSocket error occurred"); + } else { + options.logger.debug("WebSocket error occurred", { attempt: reconnectAttempt }); + } }; ws.onclose = (event) => { diff --git a/src/agent/exec.ts b/src/agent/exec.ts index 4e6f00e..c42a2cf 100644 --- a/src/agent/exec.ts +++ b/src/agent/exec.ts @@ -1,6 +1,8 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda +import { accessSync, constants, statSync } from "node:fs"; +import { join } from "node:path"; import { z } from "zod"; export const DEFAULT_EXEC_TIMEOUT_MS = 10_000; @@ -46,6 +48,33 @@ function buildMinimalEnv(platform: NodeJS.Platform = process.platform): Record | null, maxBytes: number, @@ -117,7 +146,7 @@ export async function runFixed( const timeoutMs = validOptions.timeoutMs ?? DEFAULT_EXEC_TIMEOUT_MS; const maxOutputBytes = validOptions.maxOutputBytes ?? DEFAULT_EXEC_MAX_OUTPUT_BYTES; - const proc = Bun.spawn([validCommand, ...validArgs], { + const proc = Bun.spawn([resolveCommandPath(validCommand), ...validArgs], { stdin: "ignore", stdout: "pipe", stderr: "pipe", diff --git a/src/agent/hardening.test.ts b/src/agent/hardening.test.ts new file mode 100644 index 0000000..cb56dbb --- /dev/null +++ b/src/agent/hardening.test.ts @@ -0,0 +1,412 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeAll, describe, expect, test } from "bun:test"; +import { + chmodSync, + chownSync, + mkdirSync, + mkdtempSync, + rmSync, + statSync, + writeFileSync, +} from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { fingerprint, generateSigningKeyPair, ready } from "../crypto"; +import { + createCoreRegistry, + createInMemoryTrustContext, + createSignedCommand, + PROTOCOL_VERSION, + type TransportFrame, +} from "../protocol"; +import { + inspectTree, + resolveGroupId, + SERVER_TREE_PLAN, + SHARED_TREE_PLAN, + secureDirectory, + secureTree, +} from "../server/permissions"; +import { createAgentConnection, type TimerProvider, type WebSocketLike } from "./connection"; +import { resolveCommandPath } from "./exec"; +import { createCommandQueue, sanitizeErrorMessage } from "./jobs"; +import { createLogger } from "./logger"; + +const NOW = 1_700_000_000_000; +const tempDirs: string[] = []; +const posix = process.platform !== "win32"; + +beforeAll(async () => { + await ready(); +}); + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +function tempDir(): string { + const dir = mkdtempSync(join(tmpdir(), "tegrad-hard-")); + tempDirs.push(dir); + return dir; +} + +describe("resolveGroupId", () => { + test("reads the gid of a named group and returns null when absent", () => { + const dir = tempDir(); + const file = join(dir, "group"); + writeFileSync(file, "root:x:0:\ntegrad:x:991:\ntegrad-srv:x:992:tegrad\n"); + expect(resolveGroupId("tegrad-srv", file)).toBe(992); + expect(resolveGroupId("tegrad", file)).toBe(991); + expect(resolveGroupId("missing", file)).toBeNull(); + expect(resolveGroupId("tegrad-srv", join(dir, "nope"))).toBeNull(); + }); +}); + +describe.skipIf(!posix)("server file permissions", () => { + // Use the current gid so chown always succeeds without privileges. + const gid = posix ? (process.getgid?.() ?? 0) : 0; + + test("secureTree gives dirs setgid 2770, files 0660 and keeps executables executable for the group", () => { + const root = tempDir(); + const server = join(root, "srv"); + mkdirSync(join(server, "logs"), { recursive: true }); + writeFileSync(join(server, "server.jar"), "jar"); + writeFileSync(join(server, "eula.txt"), "eula=true"); + writeFileSync(join(server, "start.sh"), "#!/bin/sh\n"); + chmodSync(join(server, "start.sh"), 0o755); + writeFileSync(join(server, "logs", "console.log"), ""); + chmodSync(join(server, "eula.txt"), 0o644); + + secureTree(server, SERVER_TREE_PLAN, { gid }); + + expect(statSync(server).mode & 0o7777).toBe(0o2770); + expect(statSync(join(server, "logs")).mode & 0o7777).toBe(0o2770); + expect(statSync(join(server, "server.jar")).mode & 0o7777).toBe(0o660); + expect(statSync(join(server, "eula.txt")).mode & 0o7777).toBe(0o660); + expect(statSync(join(server, "start.sh")).mode & 0o7777).toBe(0o770); + expect(statSync(server).gid).toBe(gid); + expect(statSync(join(server, "start.sh")).gid).toBe(gid); + // Nothing is accessible to others. + for (const name of ["server.jar", "eula.txt", "start.sh"]) { + expect(statSync(join(server, name)).mode & 0o007).toBe(0); + } + }); + + test("an explicit chmod to 770 would drop setgid; secureDirectory keeps it", () => { + const dir = join(tempDir(), "srv"); + mkdirSync(dir); + secureDirectory(dir, 0o2770, { gid }); + expect(statSync(dir).mode & 0o2000).toBe(0o2000); + chmodSync(dir, 0o770); + expect(statSync(dir).mode & 0o2000).toBe(0); + secureDirectory(dir, 0o2770, { gid }); + expect(statSync(dir).mode & 0o2000).toBe(0o2000); + }); + + test("the shared runtime plan is read/execute only for the group", () => { + const root = tempDir(); + const java = join(root, ".runtime", "java", "21"); + mkdirSync(join(java, "bin"), { recursive: true }); + writeFileSync(join(java, "bin", "java"), "elf"); + chmodSync(join(java, "bin", "java"), 0o750); + writeFileSync(join(java, "release"), "x"); + chmodSync(join(java, "release"), 0o664); + + secureTree(join(root, ".runtime"), SHARED_TREE_PLAN, { gid }); + + expect(statSync(join(root, ".runtime")).mode & 0o7777).toBe(0o2750); + expect(statSync(join(java, "bin")).mode & 0o7777).toBe(0o2750); + expect(statSync(join(java, "bin", "java")).mode & 0o7777).toBe(0o750); + expect(statSync(join(java, "release")).mode & 0o7777).toBe(0o640); + }); + + test("symbolic links are not followed or changed", () => { + const root = tempDir(); + const outside = join(root, "outside.txt"); + writeFileSync(outside, "secret"); + chmodSync(outside, 0o600); + const server = join(root, "srv"); + mkdirSync(server); + require("node:fs").symlinkSync(outside, join(server, "link")); + secureTree(server, SERVER_TREE_PLAN, { gid }); + expect(statSync(outside).mode & 0o777).toBe(0o600); + }); + + test("inspectTree reports wrong group, missing setgid, lost group access and world access", () => { + const root = tempDir(); + const server = join(root, "srv"); + mkdirSync(server); + writeFileSync(join(server, "good.txt"), "x"); + writeFileSync(join(server, "world-readable.txt"), "x"); + writeFileSync(join(server, "no-group.txt"), "x"); + secureTree(server, SERVER_TREE_PLAN, { gid }); + expect(inspectTree(server, SERVER_TREE_PLAN, gid)).toEqual([]); + + chmodSync(join(server, "world-readable.txt"), 0o664 | 0o004); + chmodSync(join(server, "no-group.txt"), 0o600); + chmodSync(server, 0o770); + + const problems = inspectTree(server, SERVER_TREE_PLAN, gid).map( + (p) => `${p.path.slice(server.length)}: ${p.problem}`, + ); + expect(problems.some((p) => p.includes("missing the setgid bit"))).toBe(true); + expect( + problems.some((p) => p.includes("no-group.txt") && p.includes("group access missing")), + ).toBe(true); + expect(problems.some((p) => p.includes("world-readable.txt") && p.includes("others"))).toBe( + true, + ); + + // A different expected group is reported for every entry (capped by the limit). + const wrong = inspectTree(server, SERVER_TREE_PLAN, gid + 12345, 3); + expect(wrong).toHaveLength(3); + expect(wrong[0]?.problem).toContain("group is"); + }); + + test("a chown that is not permitted is reported, not thrown", () => { + const root = tempDir(); + const errors: string[] = []; + if (process.getuid?.() === 0) { + return; // root can always chown + } + secureTree(root, SERVER_TREE_PLAN, { + gid: 0, + onChownError: (path) => errors.push(path), + }); + expect(errors.length).toBeGreaterThan(0); + void chownSync; + }); +}); + +describe("resolveCommandPath", () => { + test("resolves bare names against the given search path and keeps explicit paths", () => { + if (!posix) { + expect(resolveCommandPath("systemctl", "win32")).toBe("systemctl"); + return; + } + const dir = tempDir(); + const tool = join(dir, "mytool"); + writeFileSync(tool, "#!/bin/sh\n"); + chmodSync(tool, 0o755); + const plain = join(dir, "plain"); + writeFileSync(plain, "x"); + chmodSync(plain, 0o644); + + expect(resolveCommandPath("mytool", "linux", `/nonexistent:${dir}`)).toBe(tool); + expect(resolveCommandPath("plain", "linux", dir)).toBe("plain"); + expect(resolveCommandPath("absent", "linux", dir)).toBe("absent"); + expect(resolveCommandPath("/usr/bin/systemctl", "linux", dir)).toBe("/usr/bin/systemctl"); + }); +}); + +describe("handler_error logging", () => { + test("sanitizeErrorMessage strips URL queries and control characters and caps length", () => { + const message = sanitizeErrorMessage( + new Error("PUT https://storage.example/a/b?sig=SECRET#frag failed\nwith\u0000nul"), + ); + expect(message).not.toContain("SECRET"); + expect(message).not.toContain("\n"); + expect(message).not.toContain("\u0000"); + expect(message).toContain("https://storage.example/a/b?"); + expect(sanitizeErrorMessage(new Error("x".repeat(1000))).length).toBeLessThan(310); + expect(sanitizeErrorMessage(42)).toBe("non-error value"); + }); + + test("a handler that throws is logged with the error name and sanitized message", async () => { + const agent = generateSigningKeyPair(); + const owner = generateSigningKeyPair(); + const lines: string[] = []; + const logger = createLogger({ + level: "debug", + stdout: (l) => lines.push(l), + stderr: (l) => lines.push(l), + }); + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [owner.publicKey], + now: () => NOW, + }); + const registry = createCoreRegistry(); + const sent: TransportFrame[] = []; + const queue = createCommandQueue({ trust, registry, sendFrame: (f) => sent.push(f), logger }); + queue.registerHandler("server.backup.create", () => { + throw new RangeError("archive failed at https://x.example/up?token=SECRET"); + }); + const command = createSignedCommand( + { + type: "server.backup.create", + body: { server_id: "srv" }, + agentPublicKey: agent.publicKey, + signer: owner, + counter: 1, + now: NOW, + }, + registry, + ); + await queue.enqueue({ + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: fingerprint(agent.publicKey) }, + body: command, + }); + + const ack = sent.find((f) => f.kind === "ack"); + expect(ack?.kind === "ack" && ack.body.code).toBe("handler_error"); + const logged = lines.find((l) => l.includes("handler_error")); + expect(logged).toBeDefined(); + expect(logged).toContain("RangeError"); + expect(logged).toContain("archive failed"); + expect(logged).not.toContain("SECRET"); + }); +}); + +describe("WebSocket error log level", () => { + test("warns for the first failed attempts, then drops to debug", () => { + const lines: string[] = []; + const logger = createLogger({ + level: "debug", + stdout: (l) => lines.push(l), + stderr: (l) => lines.push(l), + }); + const pending: (() => void)[] = []; + const timers: TimerProvider = { + setTimeout: (fn) => { + pending.push(fn); + return pending.length; + }, + clearTimeout: () => {}, + setInterval: () => 0, + clearInterval: () => {}, + now: () => NOW, + }; + const sockets: WebSocketLike[] = []; + const connection = createAgentConnection({ + apiUrl: "https://api.tegra.example", + agentId: "a".repeat(32), + logger, + timers, + webSocketFactory: () => { + const socket: WebSocketLike = { + readyState: 0, + onopen: null, + onmessage: null, + onclose: null, + onerror: null, + send() {}, + close() {}, + }; + sockets.push(socket); + return socket; + }, + onFrame: () => {}, + }); + connection.start(); + + for (let attempt = 0; attempt < 6; attempt++) { + const socket = sockets[attempt]; + socket?.onerror?.(new Error("down")); + socket?.onclose?.({ code: 1006 }); + const next = pending.shift(); + next?.(); + } + connection.stop(); + + const errors = lines.filter((l) => l.includes("WebSocket error occurred")); + expect(errors).toHaveLength(6); + expect( + errors.slice(0, 3).every((l) => l.includes('"level":"warn"') || l.includes("warn")), + ).toBe(true); + expect(errors.slice(3).every((l) => l.includes("debug"))).toBe(true); + }); +}); + +describe("server.backup.config.get", () => { + test("returns the current configuration without secrets and needs only viewer", async () => { + const { createBackupManager, registerBackupHandlers } = await import("../backup"); + const { openTestEvent } = await import("./test-events"); + const root = tempDir(); + const manager = createBackupManager({ + stateDir: join(root, "state"), + serversBaseDir: join(root, "servers"), + localBackupsDir: join(root, "backups"), + }); + manager.setConfig({ + server_id: "srv", + auto_before_change: false, + s3: { + enabled: true, + bucket: "b", + region: "us-east-1", + endpoint: "https://s3.example.com", + access_key_id: "AKIDEXAMPLE", + secret_access_key: "SECRETKEYEXAMPLE", + }, + }); + + const agent = generateSigningKeyPair(); + const owner = generateSigningKeyPair(); + const viewer = generateSigningKeyPair(); + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [owner.publicKey], + members: [ + { + account_key: Buffer.from(viewer.publicKey).toString("base64url"), + account: fingerprint(viewer.publicKey), + granted_by: fingerprint(owner.publicKey), + role: "viewer", + servers: ["srv"], + issued_at: NOW, + }, + ], + now: () => NOW, + }); + const registry = createCoreRegistry(); + const sent: TransportFrame[] = []; + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (f) => sent.push(f), + logger: createLogger({ level: "error", stdout: () => {}, stderr: () => {} }), + }); + registerBackupHandlers(queue, manager); + + const command = createSignedCommand( + { + type: "server.backup.config.get", + body: { server_id: "srv" }, + agentPublicKey: agent.publicKey, + signer: viewer, + counter: 1, + now: NOW, + }, + registry, + ); + await queue.enqueue({ + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: fingerprint(agent.publicKey) }, + body: command, + }); + + const event = sent.find((f) => f.kind === "event"); + expect(event?.kind).toBe("event"); + if (event?.kind !== "event") return; + const opened = openTestEvent(event.body, agent.publicKey, viewer); + expect(opened.header.type).toBe("server.backup.config.result"); + const config = ( + opened.body as { config: { auto_before_change: boolean; s3: Record } } + ).config; + expect(config.auto_before_change).toBe(false); + expect(config.s3.credentials_configured).toBe(true); + expect(JSON.stringify(opened.body)).not.toContain("SECRETKEYEXAMPLE"); + expect(JSON.stringify(opened.body)).not.toContain("AKIDEXAMPLE"); + }); +}); diff --git a/src/agent/jobs.ts b/src/agent/jobs.ts index 2e0f70e..5a63720 100644 --- a/src/agent/jobs.ts +++ b/src/agent/jobs.ts @@ -91,6 +91,27 @@ interface CompletedAckEntry { readonly ack: TransportAckFrame; } +const MAX_ERROR_MESSAGE_CHARS = 300; + +/** + * Error text that is safe to log: URL query strings and fragments are removed (they can + * carry signed tokens), control characters are stripped and the length is capped. + */ +export function sanitizeErrorMessage(err: unknown): string { + const raw = + err instanceof Error ? err.message : typeof err === "string" ? err : "non-error value"; + const redacted = raw.replace(/(https?:\/\/[^\s"'<>?#]+)[?#][^\s"'<>]*/gi, "$1?"); + let cleaned = ""; + for (const ch of redacted) { + const code = ch.charCodeAt(0); + cleaned += code < 0x20 || code === 0x7f ? " " : ch; + } + cleaned = cleaned.trim(); + return cleaned.length > MAX_ERROR_MESSAGE_CHARS + ? `${cleaned.slice(0, MAX_ERROR_MESSAGE_CHARS)}...` + : cleaned; +} + export function createCommandQueue(options: CommandQueueOptions): CommandQueue { const { trust, registry, sendFrame, logger } = options; const maxIdempotencyEntries = options.maxIdempotencyEntries ?? DEFAULT_MAX_IDEMPOTENCY_ENTRIES; @@ -303,6 +324,7 @@ export function createCommandQueue(options: CommandQueueOptions): CommandQueue { type: opened.header.type, code: "handler_error", errName: err instanceof Error ? err.name : "Error", + errMessage: sanitizeErrorMessage(err), }); sendFrame(makeAckError(opened.header.id, "handler_error")); return; diff --git a/src/backup/manager.ts b/src/backup/manager.ts index 222ff2c..56d225d 100644 --- a/src/backup/manager.ts +++ b/src/backup/manager.ts @@ -547,6 +547,11 @@ export function registerBackupHandlers(queue: CommandQueue, manager: BackupManag ctx.sendEvent("server.backup.config.updated", { config }); }); + queue.registerHandler("server.backup.config.get", (opened, ctx) => { + const body = opened.body as { readonly server_id: string }; + ctx.sendEvent("server.backup.config.result", { config: manager.getConfig(body.server_id) }); + }); + queue.registerHandler("server.backup.create", async (opened, ctx) => { const body = opened.body as ServerBackupCreateBody; const result = await manager.createBackup({ diff --git a/src/cli/doctor.test.ts b/src/cli/doctor.test.ts index 49e3988..dce70c2 100644 --- a/src/cli/doctor.test.ts +++ b/src/cli/doctor.test.ts @@ -35,6 +35,7 @@ function makeHealthyLinuxOptions(overrides: Partial = {}): { DEFAULT_DOCTOR_PATHS.tmpfilesPath, DEFAULT_DOCTOR_PATHS.polkitRulePath, DEFAULT_DOCTOR_PATHS.networkDropInPath, + "/srv/tegrad-servers", ]); const modes = new Map([ [stateDir, 0o40700], @@ -50,6 +51,8 @@ function makeHealthyLinuxOptions(overrides: Partial = {}): { const options: DoctorOptions = { platform: "linux", stateDir, + serversDir: "/srv/tegrad-servers", + inspectServers: () => [], geteuid: () => 991, exists: (p) => existingFiles.has(p), statMode: (p) => { @@ -103,6 +106,26 @@ describe("tegrad doctor", () => { expect(getOutput()).toContain("OK group_isolation:"); expect(getOutput()).toContain("OK group_membership:"); expect(getOutput()).toContain("OK systemd_service:"); + expect(getOutput()).toContain("OK server_permissions:"); + }); + + test("fails server_permissions and names the offending path when files are not usable by the server group", async () => { + const { options, getOutput } = makeHealthyLinuxOptions({ + inspectServers: () => [ + { path: "/srv/tegrad-servers/s1/start.sh", problem: "group is 990, expected 991" }, + ], + }); + const code = await runDoctor(options); + expect(code).toBe(1); + expect(getOutput()).toContain("FALHA server_permissions:"); + expect(getOutput()).toContain("/srv/tegrad-servers/s1/start.sh"); + }); + + test("fails server_permissions when the servers directory is missing", async () => { + const { options, getOutput } = makeHealthyLinuxOptions({ serversDir: "/nowhere" }); + const code = await runDoctor(options); + expect(code).toBe(1); + expect(getOutput()).toContain("FALHA server_permissions: /nowhere does not exist"); }); test("fails when running as root (euid 0)", async () => { diff --git a/src/cli/doctor.ts b/src/cli/doctor.ts index 8243d66..815baab 100644 --- a/src/cli/doctor.ts +++ b/src/cli/doctor.ts @@ -1,9 +1,17 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import { existsSync, readFileSync, statSync } from "node:fs"; +import { existsSync, readdirSync, readFileSync, statSync } from "node:fs"; +import { join } from "node:path"; import { getStatePaths, type RunFixedResult, resolveStateDir, runFixed } from "../agent"; import { NETWORK_DENY_RANGES } from "../install/units"; +import { + inspectTree, + type PermissionProblem, + SERVER_GROUP_NAME, + SERVER_TREE_PLAN, + SHARED_TREE_PLAN, +} from "../server/permissions"; export interface DoctorCheckResult { readonly name: string; @@ -51,6 +59,13 @@ export interface DoctorOptions { args: readonly string[], ) => Promise>; readonly stdout?: (text: string) => void; + /** Directory that holds the server folders (defaults to TEGRAD_SERVERS_DIR or /var/lib/tegrad-servers). */ + readonly serversDir?: string; + /** Replaces the file-system walk of the server-permission check (tests). */ + readonly inspectServers?: ( + serversDir: string, + serverGid: number | null, + ) => readonly PermissionProblem[]; } interface PasswdEntry { @@ -253,6 +268,7 @@ export async function runDoctor(options: DoctorOptions = {}): Promise { statePaths.trustPath, statePaths.revocationsPath, statePaths.replayPath, + statePaths.membersPath, ]; const badSecretFiles: string[] = []; let checkedSecretFiles = 0; @@ -406,6 +422,64 @@ export async function runDoctor(options: DoctorOptions = {}): Promise { }); } + // 8. Server files belong to the server group, with group access and setgid directories + const serversDir = + options.serversDir ?? env.TEGRAD_SERVERS_DIR?.trim() ?? "/var/lib/tegrad-servers"; + if (!exists(serversDir)) { + results.push({ + name: "server_permissions", + ok: false, + detail: `${serversDir} does not exist`, + }); + } else { + const serverGid = groupLoaded ? (groups.get(SERVER_GROUP_NAME)?.gid ?? null) : null; + try { + const inspect = + options.inspectServers ?? + ((dir: string, gid: number | null) => { + const found: PermissionProblem[] = []; + for (const entry of readdirSync(dir, { withFileTypes: true })) { + if (!entry.isDirectory()) continue; + const full = join(dir, entry.name); + const plan = entry.name === ".runtime" ? SHARED_TREE_PLAN : SERVER_TREE_PLAN; + found.push(...inspectTree(full, plan, gid, 5)); + if (found.length >= 10) break; + } + return found; + }); + const problems = inspect(serversDir, serverGid); + if (serverGid === null) { + results.push({ + name: "server_permissions", + ok: false, + detail: `group '${SERVER_GROUP_NAME}' not found; cannot check server files`, + }); + } else if (problems.length > 0) { + const shown = problems + .slice(0, 5) + .map((p) => `${p.path} (${p.problem})`) + .join("; "); + results.push({ + name: "server_permissions", + ok: false, + detail: `${problems.length} problem(s), e.g. ${shown}. The server user '${SERVER_GROUP_NAME}' may not be able to start servers`, + }); + } else { + results.push({ + name: "server_permissions", + ok: true, + detail: `server files use group '${SERVER_GROUP_NAME}' with group access and no access for others`, + }); + } + } catch (err) { + results.push({ + name: "server_permissions", + ok: false, + detail: `failed to inspect ${serversDir}: ${err instanceof Error ? err.message : String(err)}`, + }); + } + } + let allOk = true; for (const item of results) { const tag = item.ok ? "OK" : "FALHA"; diff --git a/src/cli/run.ts b/src/cli/run.ts index 78159c3..90a47dc 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -224,6 +224,14 @@ export async function createAgentRuntime( : {}), ...(configuredCdnHost !== undefined ? { cdnHost: configuredCdnHost } : {}), backupHook: backupManager.createBackupHook(), + isServerActive: async (serverId: string): Promise => { + try { + const state = await serverManager.getServerState(serverId); + return state !== "stopped" && state !== "crashed"; + } catch { + return true; + } + }, ...(options.fetch !== undefined ? { fetchImpl: options.fetch } : {}), ...(options.now !== undefined ? { now: options.now } : {}), }); diff --git a/src/crypto/blob-stream.test.ts b/src/crypto/blob-stream.test.ts new file mode 100644 index 0000000..ac7a609 --- /dev/null +++ b/src/crypto/blob-stream.test.ts @@ -0,0 +1,185 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { beforeAll, describe, expect, test } from "bun:test"; +import { + BLOB_CHUNK_BYTES, + BLOB_MAGIC, + BlobFormatError, + collectChunks, + decryptBlobChunks, + encryptBlobChunks, + generateSymmetricKey, + randomBytes, + ready, +} from "./index"; + +beforeAll(async () => { + await ready(); +}); + +async function seal(plain: Uint8Array, key: Uint8Array): Promise { + return collectChunks(encryptBlobChunks(plain, key)); +} + +async function* inPieces(data: Uint8Array, size: number): AsyncGenerator { + for (let i = 0; i < data.length; i += size) { + yield data.subarray(i, i + size); + } +} + +async function expectFormatError(promise: Promise): Promise { + try { + await promise; + } catch (err) { + expect(err).toBeInstanceOf(BlobFormatError); + return; + } + throw new Error("expected BlobFormatError"); +} + +function frames(blob: Uint8Array): Uint8Array[] { + const out: Uint8Array[] = []; + let offset = BLOB_MAGIC.length; + while (offset < blob.length) { + const length = new DataView(blob.buffer, blob.byteOffset + offset, 4).getUint32(0, true); + out.push(blob.subarray(offset, offset + 4 + length)); + offset += 4 + length; + } + return out; +} + +function join(parts: readonly Uint8Array[]): Uint8Array { + const total = parts.reduce((n, p) => n + p.length, 0); + const out = new Uint8Array(total); + let offset = 0; + for (const part of parts) { + out.set(part, offset); + offset += part.length; + } + return out; +} + +describe("chunked blob encryption (TGB1)", () => { + test("round-trips empty, small and multi-chunk data; header is TGB1", async () => { + const key = generateSymmetricKey(); + for (const size of [ + 0, + 1, + 1000, + BLOB_CHUNK_BYTES, + BLOB_CHUNK_BYTES + 1, + 2.5 * BLOB_CHUNK_BYTES, + ]) { + const plain = randomBytes(size); + const blob = await seal(plain, key); + expect(Array.from(blob.subarray(0, 4))).toEqual([0x54, 0x47, 0x42, 0x31]); + const back = await collectChunks(decryptBlobChunks(blob, key)); + expect(back).toEqual(plain); + } + }); + + test("accepts streams for both directions with arbitrary piece sizes", async () => { + const key = generateSymmetricKey(); + const plain = randomBytes(BLOB_CHUNK_BYTES * 2 + 12345); + const blob = await collectChunks(encryptBlobChunks(inPieces(plain, 7777), key)); + const back = await collectChunks(decryptBlobChunks(inPieces(blob, 513), key)); + expect(back).toEqual(plain); + }); + + test("uses chunks of at most 1 MiB and decrypts incrementally", async () => { + const key = generateSymmetricKey(); + const blob = await seal(randomBytes(BLOB_CHUNK_BYTES * 3), key); + const sizes: number[] = []; + for await (const chunk of decryptBlobChunks(blob, key)) { + sizes.push(chunk.length); + } + expect(sizes).toEqual([BLOB_CHUNK_BYTES, BLOB_CHUNK_BYTES, BLOB_CHUNK_BYTES]); + }); + + test("the wrong key fails", async () => { + const blob = await seal(randomBytes(100), generateSymmetricKey()); + await expectFormatError(collectChunks(decryptBlobChunks(blob, generateSymmetricKey()))); + }); + + test("a bad header fails", async () => { + const key = generateSymmetricKey(); + const blob = await seal(randomBytes(10), key); + const bad = blob.slice(); + bad[0] = 0x00; + await expectFormatError(collectChunks(decryptBlobChunks(bad, key))); + await expectFormatError(collectChunks(decryptBlobChunks(new Uint8Array(2), key))); + }); + + test("flipping any byte of a frame fails", async () => { + const key = generateSymmetricKey(); + const blob = await seal(randomBytes(5000), key); + const tampered = blob.slice(); + tampered[blob.length - 5] = (tampered[blob.length - 5] ?? 0) ^ 1; + await expectFormatError(collectChunks(decryptBlobChunks(tampered, key))); + }); + + test("truncation is detected, at a frame boundary and inside a frame", async () => { + const key = generateSymmetricKey(); + const blob = await seal(randomBytes(BLOB_CHUNK_BYTES * 2 + 10), key); + const all = frames(blob); + expect(all.length).toBe(3); + + // Dropping the last frame leaves a stream that never says "last". + const cutAtBoundary = join([BLOB_MAGIC, ...all.slice(0, 2)]); + await expectFormatError(collectChunks(decryptBlobChunks(cutAtBoundary, key))); + + // Cutting inside a frame. + await expectFormatError( + collectChunks(decryptBlobChunks(blob.subarray(0, blob.length - 3), key)), + ); + await expectFormatError(collectChunks(decryptBlobChunks(blob.subarray(0, 6), key))); + await expectFormatError(collectChunks(decryptBlobChunks(blob.subarray(0, 4), key))); + }); + + test("reordering and repeating chunks are detected", async () => { + const key = generateSymmetricKey(); + const blob = await seal(randomBytes(BLOB_CHUNK_BYTES * 2 + 10), key); + const [a, b, c] = frames(blob); + if (!a || !b || !c) throw new Error("frames"); + + await expectFormatError(collectChunks(decryptBlobChunks(join([BLOB_MAGIC, b, a, c]), key))); + await expectFormatError(collectChunks(decryptBlobChunks(join([BLOB_MAGIC, a, a, c]), key))); + await expectFormatError(collectChunks(decryptBlobChunks(join([BLOB_MAGIC, a, b, b, c]), key))); + }); + + test("data after the final chunk is refused, and so is a frame of absurd length", async () => { + const key = generateSymmetricKey(); + const blob = await seal(randomBytes(10), key); + await expectFormatError(collectChunks(decryptBlobChunks(join([blob, new Uint8Array(1)]), key))); + + const huge = new Uint8Array(4); + new DataView(huge.buffer).setUint32(0, 0xffffffff, true); + await expectFormatError(collectChunks(decryptBlobChunks(join([BLOB_MAGIC, huge]), key))); + }); + + test("a chunk from another blob cannot be spliced in", async () => { + const key = generateSymmetricKey(); + const one = frames(await seal(randomBytes(BLOB_CHUNK_BYTES + 10), key)); + const two = frames(await seal(randomBytes(BLOB_CHUNK_BYTES + 10), key)); + // Same key, same index and flags: this is valid by design (same key means same trust), + // but a first chunk marked as non-last cannot stand in for a last one. + const spliced = join([BLOB_MAGIC, one[0] as Uint8Array, one[0] as Uint8Array]); + await expectFormatError(collectChunks(decryptBlobChunks(spliced, key))); + expect(two.length).toBe(2); + }); + + test("maxPlaintextBytes stops oversized blobs", async () => { + const key = generateSymmetricKey(); + const blob = await seal(randomBytes(BLOB_CHUNK_BYTES * 2), key); + await expectFormatError( + collectChunks(decryptBlobChunks(blob, key, { maxPlaintextBytes: BLOB_CHUNK_BYTES })), + ); + }); + + test("rejects keys of the wrong size", async () => { + await expect( + collectChunks(encryptBlobChunks(randomBytes(4), new Uint8Array(5))), + ).rejects.toThrow(); + }); +}); diff --git a/src/crypto/blob-stream.ts b/src/crypto/blob-stream.ts new file mode 100644 index 0000000..c12ba26 --- /dev/null +++ b/src/crypto/blob-stream.ts @@ -0,0 +1,222 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { AEAD_NONCE_BYTES, AEAD_TAG_BYTES, aeadDecrypt, aeadEncrypt } from "./aead"; +import { canonicalize } from "./canonical"; + +/** + * Chunked blob format ("TGB1"): + * + * "TGB1" | frame* + * frame = u32le(length) | aeadEncrypt(chunk, key, aad) // length = nonce + ciphertext + tag + * aad = canonicalize({ v: 1, index, last }) + * + * Chunks hold up to 1 MiB of plaintext. Binding the index and the `last` flag + * into the AAD makes reordering, repeating and truncating a blob detectable. + * The input is never required to fit in memory. + */ +export const BLOB_MAGIC = new Uint8Array([0x54, 0x47, 0x42, 0x31]); // "TGB1" +export const BLOB_CHUNK_BYTES = 1024 * 1024; +export const BLOB_MAX_FRAME_BYTES = BLOB_CHUNK_BYTES + AEAD_NONCE_BYTES + AEAD_TAG_BYTES; + +export type BlobInput = Uint8Array | AsyncIterable | Iterable; + +function chunkAad(index: number, last: boolean): Uint8Array { + return canonicalize({ v: 1, index, last }); +} + +async function* iterate(input: BlobInput): AsyncGenerator { + if (input instanceof Uint8Array) { + yield input; + return; + } + for await (const part of input as AsyncIterable) { + yield part; + } +} + +/** Re-slices an arbitrary byte stream into fixed-size pieces (the last one may be shorter). */ +async function* slice(input: BlobInput, size: number): AsyncGenerator { + let pending: Uint8Array = new Uint8Array(0); + for await (const part of iterate(input)) { + if (part.length === 0) { + continue; + } + let data: Uint8Array = part; + if (pending.length > 0) { + const merged = new Uint8Array(pending.length + data.length); + merged.set(pending, 0); + merged.set(data, pending.length); + data = merged; + pending = new Uint8Array(0); + } + let offset = 0; + while (data.length - offset >= size) { + yield data.subarray(offset, offset + size); + offset += size; + } + pending = data.subarray(offset); + } + if (pending.length > 0) { + yield pending; + } +} + +function u32le(value: number): Uint8Array { + const out = new Uint8Array(4); + new DataView(out.buffer).setUint32(0, value, true); + return out; +} + +/** Encrypts a byte stream into TGB1 pieces. Yields the header first, then one frame per chunk. */ +export async function* encryptBlobChunks( + plaintext: BlobInput, + key: Uint8Array, +): AsyncGenerator { + yield BLOB_MAGIC; + + let index = 0; + let previous: Uint8Array | null = null; + for await (const chunk of slice(plaintext, BLOB_CHUNK_BYTES)) { + if (previous !== null) { + const sealed = aeadEncrypt(previous, key, chunkAad(index, false)); + yield u32le(sealed.length); + yield sealed; + index++; + } + previous = chunk; + } + + // The final chunk is always written, even for empty input, so a stream cannot end unmarked. + const sealed = aeadEncrypt(previous ?? new Uint8Array(0), key, chunkAad(index, true)); + yield u32le(sealed.length); + yield sealed; +} + +class ByteReader { + readonly #iterator: AsyncIterator; + #buffer: Uint8Array = new Uint8Array(0); + #done = false; + + constructor(input: BlobInput) { + this.#iterator = iterate(input)[Symbol.asyncIterator](); + } + + /** Reads exactly `length` bytes, or fewer only at end of input (returns what was left). */ + async read(length: number): Promise { + while (this.#buffer.length < length && !this.#done) { + const next = await this.#iterator.next(); + if (next.done === true) { + this.#done = true; + break; + } + if (next.value.length === 0) { + continue; + } + if (this.#buffer.length === 0) { + this.#buffer = next.value; + } else { + const merged = new Uint8Array(this.#buffer.length + next.value.length); + merged.set(this.#buffer, 0); + merged.set(next.value, this.#buffer.length); + this.#buffer = merged; + } + } + const take = Math.min(length, this.#buffer.length); + const out = this.#buffer.subarray(0, take); + this.#buffer = this.#buffer.subarray(take); + return out; + } +} + +export class BlobFormatError extends Error { + constructor(message: string) { + super(message); + this.name = "BlobFormatError"; + } +} + +/** + * Decrypts a TGB1 stream, yielding plaintext chunks as they are verified. + * Throws `BlobFormatError` on a bad header, oversized frame, truncation, trailing + * data, reordering or tampering. Nothing is yielded for a chunk that fails. + */ +export async function* decryptBlobChunks( + ciphertext: BlobInput, + key: Uint8Array, + options: { readonly maxPlaintextBytes?: number } = {}, +): AsyncGenerator { + const reader = new ByteReader(ciphertext); + const magic = await reader.read(BLOB_MAGIC.length); + if (magic.length !== BLOB_MAGIC.length || !BLOB_MAGIC.every((byte, i) => magic[i] === byte)) { + throw new BlobFormatError("Not a TGB1 blob"); + } + + let index = 0; + let total = 0; + while (true) { + const prefix = await reader.read(4); + if (prefix.length === 0) { + throw new BlobFormatError("Blob is truncated"); + } + if (prefix.length !== 4) { + throw new BlobFormatError("Blob frame header is truncated"); + } + const length = new DataView(prefix.buffer, prefix.byteOffset, 4).getUint32(0, true); + if (length < AEAD_NONCE_BYTES + AEAD_TAG_BYTES || length > BLOB_MAX_FRAME_BYTES) { + throw new BlobFormatError("Blob frame has an invalid length"); + } + const frame = await reader.read(length); + if (frame.length !== length) { + throw new BlobFormatError("Blob frame is truncated"); + } + + // A frame is the last one only if nothing follows it; try both readings of the AAD. + let plain: Uint8Array; + let last: boolean; + try { + plain = aeadDecrypt(frame, key, chunkAad(index, false)); + last = false; + } catch { + try { + plain = aeadDecrypt(frame, key, chunkAad(index, true)); + last = true; + } catch { + throw new BlobFormatError("Blob chunk failed authentication"); + } + } + + total += plain.length; + if (options.maxPlaintextBytes !== undefined && total > options.maxPlaintextBytes) { + throw new BlobFormatError("Blob exceeds the maximum plaintext size"); + } + + if (last) { + const rest = await reader.read(1); + if (rest.length !== 0) { + throw new BlobFormatError("Blob has data after the final chunk"); + } + yield plain; + return; + } + yield plain; + index++; + } +} + +/** Collects a stream of chunks into one buffer (for small blobs and tests). */ +export async function collectChunks(input: BlobInput): Promise { + const parts: Uint8Array[] = []; + let total = 0; + for await (const part of iterate(input)) { + parts.push(part); + total += part.length; + } + const out = new Uint8Array(total); + let offset = 0; + for (const part of parts) { + out.set(part, offset); + offset += part.length; + } + return out; +} diff --git a/src/crypto/index.ts b/src/crypto/index.ts index c4e3b0b..790d239 100644 --- a/src/crypto/index.ts +++ b/src/crypto/index.ts @@ -9,6 +9,16 @@ export { generateSymmetricKey, SYMMETRIC_KEY_BYTES, } from "./aead"; +export { + BLOB_CHUNK_BYTES, + BLOB_MAGIC, + BLOB_MAX_FRAME_BYTES, + BlobFormatError, + type BlobInput, + collectChunks, + decryptBlobChunks, + encryptBlobChunks, +} from "./blob-stream"; export { openSealed, sealTo } from "./box"; export { canonicalize } from "./canonical"; export { fromBase64Url, toBase32, toBase64Url } from "./encoding"; diff --git a/src/protocol/commands/backup.ts b/src/protocol/commands/backup.ts index dafcb7b..37ac626 100644 --- a/src/protocol/commands/backup.ts +++ b/src/protocol/commands/backup.ts @@ -168,6 +168,13 @@ export const serverBackupConfigSetCommand = defineCommand({ body: serverBackupConfigSetBodySchema, }); +export const serverBackupConfigGetCommand = defineCommand({ + type: "server.backup.config.get", + sensitive: false, + minRole: "viewer", + body: z.object({ server_id: serverIdSchema }).strict(), +}); + export const serverBackupCreateCommand = defineCommand({ type: "server.backup.create", sensitive: false, @@ -198,6 +205,7 @@ export const serverBackupRestoreCommand = defineCommand({ export const BACKUP_COMMANDS = [ serverBackupConfigSetCommand, + serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, diff --git a/src/protocol/commands/state.ts b/src/protocol/commands/state.ts index 1808ce1..5de6816 100644 --- a/src/protocol/commands/state.ts +++ b/src/protocol/commands/state.ts @@ -210,6 +210,46 @@ export const serverOriginUnlinkBodySchema = z }) .strict(); +/** 32-byte symmetric key in base64url (no padding) for blobs in the chunked TGB1 format. */ +export const blobKeySchema = z + .string() + .regex(/^[A-Za-z0-9_-]{43}$/, "Expected a 32-byte key in base64url"); + +export const WORLD_NAME_REGEX = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$/; +/** Folder names that hold server content other than a world. */ +export const RESERVED_WORLD_NAMES: ReadonlySet = new Set([ + "mods", + "config", + "defaultconfigs", + "logs", + "libraries", + "plugins", + "versions", + "crash-reports", + "resourcepacks", + "datapacks", + "kubejs", + "scripts", +]); + +export const worldNameSchema = z + .string() + .regex(WORLD_NAME_REGEX, "Invalid world name") + .refine((name) => !name.includes("..") && !RESERVED_WORLD_NAMES.has(name.toLowerCase()), { + message: "Reserved or unsafe world name", + }); + +export const serverWorldImportBodySchema = z + .object({ + server_id: serverIdSchema, + world_name: worldNameSchema, + url: z.string().url().max(2048), + sha256: sha256HexSchema, + key: blobKeySchema, + }) + .strict(); +export type ServerWorldImportBody = z.infer; + export const serverDeployServerpackBodySchema = z .object({ server_id: serverIdSchema, @@ -218,6 +258,8 @@ export const serverDeployServerpackBodySchema = z sha512: sha512HexSchema.optional(), sha1: sha1HexSchema.optional(), origin: serverOriginSchema.optional(), + /** When present, the downloaded blob is encrypted in the TGB1 chunked format with this key. */ + key: blobKeySchema.optional(), }) .strict(); @@ -278,6 +320,13 @@ export const serverDeployServerpackCommand = defineCommand({ body: serverDeployServerpackBodySchema, }); +export const serverWorldImportCommand = defineCommand({ + type: "server.world.import", + sensitive: false, + minRole: "editor", + body: serverWorldImportBodySchema, +}); + export const STATE_COMMANDS = [ serverModsListCommand, serverModsInstallCommand, @@ -286,6 +335,7 @@ export const STATE_COMMANDS = [ serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, + serverWorldImportCommand, ] as const; export function registerStateCommands(registry: CommandRegistry): CommandRegistry { diff --git a/src/protocol/index.ts b/src/protocol/index.ts index 4443e32..6d0b9f0 100644 --- a/src/protocol/index.ts +++ b/src/protocol/index.ts @@ -90,6 +90,7 @@ export { s3BucketSchema, s3PrefixSchema, s3RegionSchema, + serverBackupConfigGetCommand, serverBackupConfigSetBodySchema, serverBackupConfigSetCommand, serverBackupCreateBodySchema, @@ -174,6 +175,7 @@ export { serverUpdateSettingsCommand, } from "./commands/server"; export { + blobKeySchema, type ModEnvironmentInfo, type ModLayer, type ModSource, @@ -185,6 +187,7 @@ export { type OriginPlanModInput, originPlanFileInputSchema, originPlanModInputSchema, + RESERVED_WORLD_NAMES, registerStateCommands, type ServerDeployServerpackBody, type ServerModEntry, @@ -196,6 +199,7 @@ export { type ServerOriginPlanBody, type ServerOriginSyncState, type ServerOriginUnlinkBody, + type ServerWorldImportBody, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, STATE_COMMANDS, @@ -216,8 +220,12 @@ export { serverOriginSyncStateSchema, serverOriginUnlinkBodySchema, serverOriginUnlinkCommand, + serverWorldImportBodySchema, + serverWorldImportCommand, sha1HexSchema, sha512HexSchema, + WORLD_NAME_REGEX, + worldNameSchema, } from "./commands/state"; export { PLAYIT_SECRET_KEY_REGEX, diff --git a/src/protocol/phase3.test.ts b/src/protocol/phase3.test.ts index 7185c8f..a6c6aaf 100644 --- a/src/protocol/phase3.test.ts +++ b/src/protocol/phase3.test.ts @@ -660,6 +660,8 @@ const MIN_ROLE: Record = { "files.stat": "viewer", "server.mods.list": "viewer", "server.backup.list": "viewer", + "server.backup.config.get": "viewer", + "server.world.import": "editor", "tunnel.playit.status": "viewer", "server.start": "operator", "server.stop": "operator", diff --git a/src/server/java.ts b/src/server/java.ts index 54261e0..8cb99cf 100644 --- a/src/server/java.ts +++ b/src/server/java.ts @@ -2,15 +2,7 @@ // Copyright (C) 2026 Antônio Miranda import { randomBytes } from "node:crypto"; -import { - chmodSync, - existsSync, - mkdirSync, - readdirSync, - renameSync, - rmSync, - statSync, -} from "node:fs"; +import { existsSync, mkdirSync, readdirSync, renameSync, rmSync, statSync } from "node:fs"; import { join, resolve } from "node:path"; import { z } from "zod"; import { type RunFixedOptions, type RunFixedResult, runFixed } from "../agent/exec"; @@ -21,6 +13,13 @@ import { type FetchLike, fetchJsonWithAllowlist, } from "./download"; +import { + type PermissionContext, + SHARED_DIR_MODE, + SHARED_TREE_PLAN, + secureDirectory, + secureTree, +} from "./permissions"; export type JavaMajor = 8 | 16 | 17 | 21; @@ -38,8 +37,6 @@ export const ADOPTIUM_ALLOWED_HOSTS: ReadonlySet = new Set([ ]); const RUNTIME_DIR_MODE = 0o750; -const RUNTIME_BIN_MODE = 0o750; -const RUNTIME_FILE_MODE = 0o640; const adoptiumAssetSchema = z.object({ binary: z.object({ @@ -56,10 +53,6 @@ const adoptiumAssetsResponseSchema = z.array(adoptiumAssetSchema); const STANDARD_MC_VERSION_REGEX = /^(\d+)\.(\d+)(?:\.(\d+))?(?:[-+][A-Za-z0-9._-]+)?$/; const SNAPSHOT_MC_VERSION_REGEX = /^(\d{2})w(\d{2})[a-z]$/i; -function isPosix(platform: NodeJS.Platform = process.platform): boolean { - return platform !== "win32"; -} - export function selectJavaMajor(minecraftVersion: string): JavaMajor { const trimmed = minecraftVersion.trim(); if (trimmed.includes("..")) { @@ -154,35 +147,14 @@ function findExtractedJavaRoot(extractDir: string, binName: string): string | nu return null; } -function applyRuntimePermissions(dirPath: string, inBinDir: boolean = false): void { - if (!isPosix()) { - return; - } - chmodSync(dirPath, RUNTIME_DIR_MODE); - for (const entry of readdirSync(dirPath, { withFileTypes: true })) { - if (entry.isSymbolicLink()) { - continue; - } - const fullPath = join(dirPath, entry.name); - if (entry.isDirectory()) { - applyRuntimePermissions(fullPath, inBinDir || entry.name === "bin"); - } else if (entry.isFile()) { - const isExecutable = - inBinDir || - entry.name === "jspawnhelper" || - entry.name === "jexec" || - (statSync(fullPath).mode & 0o100) !== 0; - chmodSync(fullPath, isExecutable ? RUNTIME_BIN_MODE : RUNTIME_FILE_MODE); - } - } -} - export interface EnsureJavaRuntimeOptions { readonly serversDir: string; readonly minecraftVersion: string; readonly arch?: "x64" | "aarch64"; readonly fetchImpl?: FetchLike; readonly runFixedImpl?: RunFixedLike; + /** Group that must be able to read and run the runtime (the server user's group). */ + readonly permissions?: PermissionContext; readonly maxBytes?: number; readonly platform?: NodeJS.Platform; } @@ -245,10 +217,9 @@ export async function ensureJavaRuntime( const dotRuntimeDir = join(resolve(options.serversDir), ".runtime"); const runtimeRoot = join(dotRuntimeDir, "java"); mkdirSync(runtimeRoot, { recursive: true, mode: RUNTIME_DIR_MODE }); - if (isPosix(platform)) { - chmodSync(dotRuntimeDir, RUNTIME_DIR_MODE); - chmodSync(runtimeRoot, RUNTIME_DIR_MODE); - } + const permissions: PermissionContext = options.permissions ?? { gid: null, platform }; + secureDirectory(dotRuntimeDir, SHARED_DIR_MODE, permissions); + secureDirectory(runtimeRoot, SHARED_DIR_MODE, permissions); const suffix = randomBytes(8).toString("hex"); const archivePath = join(runtimeRoot, `.tmp-java-${major}-${suffix}.tar.gz`); @@ -293,7 +264,7 @@ export async function ensureJavaRuntime( rmSync(javaDir, { recursive: true, force: true }); } renameSync(extractedRoot, javaDir); - applyRuntimePermissions(javaDir); + secureTree(javaDir, SHARED_TREE_PLAN, permissions); return { major, javaDir, javaBin }; } finally { diff --git a/src/server/permissions.ts b/src/server/permissions.ts new file mode 100644 index 0000000..d6f6101 --- /dev/null +++ b/src/server/permissions.ts @@ -0,0 +1,184 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { chmodSync, chownSync, existsSync, lstatSync, readdirSync, readFileSync } from "node:fs"; +import { join } from "node:path"; + +/** Group that the Minecraft server processes run as. The agent is a member, not the owner. */ +export const SERVER_GROUP_NAME = "tegrad-srv"; +export const DEFAULT_GROUP_FILE = "/etc/group"; + +/** Server data: the server user reads and writes it, and new files inherit the group (setgid). */ +export const SERVER_DIR_MODE = 0o2770; +export const SERVER_FILE_MODE = 0o660; +export const SERVER_EXEC_MODE = 0o770; +/** Shared runtimes (Java): the server user may read and execute, never write. */ +export const SHARED_DIR_MODE = 0o2750; +export const SHARED_FILE_MODE = 0o640; +export const SHARED_EXEC_MODE = 0o750; + +export interface TreePermissionPlan { + readonly dirMode: number; + readonly fileMode: number; + readonly execMode: number; +} + +export const SERVER_TREE_PLAN: TreePermissionPlan = { + dirMode: SERVER_DIR_MODE, + fileMode: SERVER_FILE_MODE, + execMode: SERVER_EXEC_MODE, +}; + +export const SHARED_TREE_PLAN: TreePermissionPlan = { + dirMode: SHARED_DIR_MODE, + fileMode: SHARED_FILE_MODE, + execMode: SHARED_EXEC_MODE, +}; + +function isPosix(platform: NodeJS.Platform = process.platform): boolean { + return platform !== "win32"; +} + +/** Looks a group up in /etc/group. Returns null when the file or the group is missing. */ +export function resolveGroupId( + name: string = SERVER_GROUP_NAME, + groupFile: string = DEFAULT_GROUP_FILE, +): number | null { + let content: string; + try { + content = readFileSync(groupFile, "utf8"); + } catch { + return null; + } + for (const line of content.split("\n")) { + const parts = line.split(":"); + if (parts[0] === name && parts[2] !== undefined) { + const gid = Number(parts[2]); + return Number.isInteger(gid) && gid >= 0 ? gid : null; + } + } + return null; +} + +export interface PermissionContext { + /** Group to hand files to, or null to leave the group alone (development machines). */ + readonly gid: number | null; + readonly platform?: NodeJS.Platform; + /** Called when the group cannot be changed (e.g. the agent is not a member). */ + readonly onChownError?: (path: string, err: unknown) => void; +} + +function setGroup(path: string, ctx: PermissionContext): void { + if (ctx.gid === null) { + return; + } + try { + chownSync(path, -1, ctx.gid); + } catch (err) { + ctx.onChownError?.(path, err); + } +} + +/** Sets group and mode of one directory; the explicit chmod keeps the setgid bit. */ +export function secureDirectory(dirPath: string, mode: number, ctx: PermissionContext): void { + if (!isPosix(ctx.platform)) { + return; + } + setGroup(dirPath, ctx); + chmodSync(dirPath, mode); +} + +/** + * Walks a tree and applies the plan: group, directory mode (with setgid) and file + * mode. A file that is already executable by its owner stays executable by the + * group (start.sh, the Java launcher). Symbolic links are never followed or changed. + */ +export function secureTree(root: string, plan: TreePermissionPlan, ctx: PermissionContext): void { + if (!isPosix(ctx.platform)) { + return; + } + secureDirectory(root, plan.dirMode, ctx); + for (const entry of readdirSync(root, { withFileTypes: true })) { + const fullPath = join(root, entry.name); + if (entry.isSymbolicLink()) { + continue; + } + if (entry.isDirectory()) { + secureTree(fullPath, plan, ctx); + } else if (entry.isFile()) { + setGroup(fullPath, ctx); + const executable = (lstatSync(fullPath).mode & 0o100) !== 0; + chmodSync(fullPath, executable ? plan.execMode : plan.fileMode); + } + } +} + +export interface PermissionProblem { + readonly path: string; + readonly problem: string; +} + +/** + * Read-only check of a tree against the plan, for `tegrad doctor`. Reports what is + * not owned by the expected group or whose mode is looser or tighter than needed. + */ +export function inspectTree( + root: string, + _plan: TreePermissionPlan, + gid: number | null, + limit = 20, +): PermissionProblem[] { + const problems: PermissionProblem[] = []; + if (!existsSync(root)) { + return problems; + } + + function visit(path: string, isDir: boolean): void { + if (problems.length >= limit) { + return; + } + const stat = lstatSync(path); + const mode = stat.mode & 0o7777; + if (gid !== null && stat.gid !== gid) { + problems.push({ path, problem: `group is ${stat.gid}, expected ${gid}` }); + return; + } + if (isDir) { + if ((mode & 0o2000) === 0) { + problems.push({ path, problem: "missing the setgid bit" }); + } + if ((mode & 0o050) !== 0o050) { + problems.push({ path, problem: `group cannot enter it (mode ${mode.toString(8)})` }); + } + } else { + const needed = (mode & 0o100) !== 0 ? 0o050 : 0o040; + if ((mode & needed) !== needed) { + problems.push({ path, problem: `group access missing (mode ${mode.toString(8)})` }); + } + } + if ((mode & 0o007) !== 0) { + problems.push({ path, problem: "readable or writable by others" }); + } + } + + function walk(dir: string): void { + visit(dir, true); + for (const entry of readdirSync(dir, { withFileTypes: true })) { + if (problems.length >= limit) { + return; + } + const full = join(dir, entry.name); + if (entry.isSymbolicLink()) { + continue; + } + if (entry.isDirectory()) { + walk(full); + } else if (entry.isFile()) { + visit(full, false); + } + } + } + + walk(root); + return problems; +} diff --git a/src/server/runtime.ts b/src/server/runtime.ts index d16f4f3..cf654fc 100644 --- a/src/server/runtime.ts +++ b/src/server/runtime.ts @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import { chmodSync, existsSync, mkdirSync, readdirSync, rmSync } from "node:fs"; +import { existsSync, mkdirSync, rmSync } from "node:fs"; import { join } from "node:path"; import type { CommandQueue } from "../agent/jobs"; import type { Logger } from "../agent/logger"; @@ -36,6 +36,14 @@ import { RESERVED_SYSTEM_MEMORY_MB, readMeminfo, } from "./memory"; +import { + type PermissionContext, + resolveGroupId, + SERVER_DIR_MODE, + SERVER_TREE_PLAN, + secureDirectory, + secureTree, +} from "./permissions"; import { getEffectiveLaunchTarget, isEulaAccepted, @@ -57,31 +65,6 @@ import { stopServerUnit, } from "./systemd"; -const SERVER_DIR_MODE = 0o770; -const SERVER_DATA_FILE_MODE = 0o660; - -function isPosix(platform: NodeJS.Platform = process.platform): boolean { - return platform !== "win32"; -} - -function applyServerTreePermissions(dirPath: string, platform: NodeJS.Platform): void { - if (!isPosix(platform)) { - return; - } - chmodSync(dirPath, SERVER_DIR_MODE); - for (const entry of readdirSync(dirPath, { withFileTypes: true })) { - if (entry.isSymbolicLink()) { - continue; - } - const fullPath = join(dirPath, entry.name); - if (entry.isDirectory()) { - applyServerTreePermissions(fullPath, platform); - } else if (entry.isFile()) { - chmodSync(fullPath, SERVER_DATA_FILE_MODE); - } - } -} - export interface ServerStatusReport { readonly server: ServerMetadata; readonly eula_accepted: boolean; @@ -110,6 +93,8 @@ export interface ServerManagerOptions { readonly now?: () => number; readonly platform?: NodeJS.Platform; readonly logger?: Logger; + /** Group id of the server user's group; resolved from /etc/group when omitted, null to skip. */ + readonly serverGroupId?: number | null; } export interface ServerManager { @@ -140,6 +125,16 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM const meminfoPath = options.meminfoPath ?? DEFAULT_MEMINFO_PATH; const now = options.now ?? (() => Date.now()); const platform = options.platform ?? process.platform; + const permissionContext: PermissionContext = { + gid: options.serverGroupId !== undefined ? options.serverGroupId : resolveGroupId(), + platform, + onChownError: (path, err) => { + options.logger?.warn("Could not set the server group on a path", { + path, + errName: err instanceof Error ? err.name : "Error", + }); + }, + }; const consoleManager = createConsoleSubscriptionManager({ serversDir, @@ -191,10 +186,8 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM mkdirSync(serverDir, { recursive: true, mode: SERVER_DIR_MODE }); const logsDir = join(serverDir, "logs"); mkdirSync(logsDir, { recursive: true, mode: SERVER_DIR_MODE }); - if (isPosix(platform)) { - chmodSync(serverDir, SERVER_DIR_MODE); - chmodSync(logsDir, SERVER_DIR_MODE); - } + secureDirectory(serverDir, SERVER_DIR_MODE, permissionContext); + secureDirectory(logsDir, SERVER_DIR_MODE, permissionContext); try { const javaRuntime = await ensureJavaRuntime({ @@ -203,6 +196,7 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM platform, ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), ...(options.runFixedImpl !== undefined ? { runFixedImpl: options.runFixedImpl } : {}), + permissions: permissionContext, }); const loaderResult = await installServerLoader({ @@ -217,7 +211,6 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM ...(options.runFixedImpl !== undefined ? { runFixedImpl: options.runFixedImpl } : {}), }); - applyServerTreePermissions(serverDir, platform); writeEulaFile(serverDir, parsedParams.data.eula_accepted); writeServerProperties(serverDir, { port, forceOnlineMode: true }); writeStartScript(serverDir, { @@ -241,6 +234,7 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM launch_target: loaderResult.launchTarget, }; writeServerMetadata(serversDir, metadata); + secureTree(serverDir, SERVER_TREE_PLAN, permissionContext); options.logger?.info("Created Minecraft server", { serverId: validId, @@ -416,6 +410,7 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM } writeServerMetadata(serversDir, updated); + secureTree(serverDir, SERVER_TREE_PLAN, permissionContext); return updated; } diff --git a/src/state/manager.ts b/src/state/manager.ts index ff5a1f8..38c6537 100644 --- a/src/state/manager.ts +++ b/src/state/manager.ts @@ -2,10 +2,19 @@ // Copyright (C) 2026 Antônio Miranda import { createHash, randomBytes, timingSafeEqual } from "node:crypto"; -import { existsSync, lstatSync, readdirSync, readFileSync, unlinkSync } from "node:fs"; +import { + existsSync, + lstatSync, + readdirSync, + readFileSync, + renameSync, + rmSync, + unlinkSync, +} from "node:fs"; import { join } from "node:path"; import type { CommandQueue } from "../agent/jobs"; import type { Logger } from "../agent/logger"; +import { collectChunks, decryptBlobChunks, fromBase64Url } from "../crypto"; import { decodeStrictBase64, FileManagerError, @@ -25,14 +34,22 @@ import { type ServerOriginApplyBody, type ServerOriginPlanBody, type ServerOriginSyncState, + type ServerWorldImportBody, serverDeployServerpackBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverOriginApplyBodySchema, serverOriginPlanBodySchema, + serverWorldImportBodySchema, } from "../protocol"; import type { FetchLike } from "../server/download"; import { assertValidServerId, DEFAULT_SERVERS_DIR } from "../server/id"; +import { + type PermissionContext, + resolveGroupId, + SERVER_TREE_PLAN, + secureTree, +} from "../server/permissions"; import { readServerMetadata, type ServerMetadata, writeServerMetadata } from "../server/registry"; import { type BackupHook, noopBackupHook } from "./backup-hook"; import { @@ -73,6 +90,16 @@ export interface StateManagerOptions { readonly maxStoredPlans?: number; readonly now?: () => number; readonly logger?: Logger; + /** True when the server's unit is not stopped. Required to allow world imports. */ + readonly isServerActive?: (serverId: string) => Promise; + /** Group id of the server user's group; resolved from /etc/group when omitted, null to skip. */ + readonly serverGroupId?: number | null; + readonly maxWorldBytes?: number; +} + +export interface WorldImportResult { + readonly server_id: string; + readonly world_name: string; } export interface ModsListResult { @@ -159,6 +186,24 @@ export interface StateManager { planOriginSync(params: ServerOriginPlanBody): OriginPlanResult; applyOriginSync(params: ServerOriginApplyBody): Promise; deployServerPack(params: ServerDeployServerpackBody): Promise; + importWorld(params: ServerWorldImportBody): Promise; +} + +export const DEFAULT_MAX_WORLD_BYTES = 2 * 1024 * 1024 * 1024; // 2 GiB of ciphertext + +/** Decrypts a downloaded TGB1 blob chunk by chunk and returns the plaintext. */ +async function decryptDownloadedBlob( + data: Uint8Array, + keyB64: string, + maxPlaintextBytes: number, +): Promise { + try { + return await collectChunks( + decryptBlobChunks(data, fromBase64Url(keyB64), { maxPlaintextBytes }), + ); + } catch { + throw new ProtocolError("decrypt_failed", "Failed to decrypt the downloaded blob"); + } } const PROTECTED_SERVERPACK_PATHS: ReadonlySet = new Set(["start.sh", "tegrad-server.json"]); @@ -324,6 +369,16 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana const backupBeforeChange = options.backupBeforeChange ?? true; const maxModBytes = options.maxModBytes ?? DEFAULT_MAX_MOD_BYTES; const maxServerPackBytes = options.maxServerPackBytes ?? DEFAULT_MAX_SERVERPACK_BYTES; + const maxWorldBytes = options.maxWorldBytes ?? DEFAULT_MAX_WORLD_BYTES; + const permissionContext: PermissionContext = { + gid: options.serverGroupId !== undefined ? options.serverGroupId : resolveGroupId(), + onChownError: (path, err) => { + options.logger?.warn("Could not set the server group on a path", { + path, + errName: err instanceof Error ? err.name : "Error", + }); + }, + }; const planTtlMs = options.planTtlMs ?? DEFAULT_PLAN_TTL_MS; const maxStoredPlans = options.maxStoredPlans ?? DEFAULT_MAX_STORED_PLANS; const now = options.now ?? (() => Date.now()); @@ -963,7 +1018,7 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana if (!parsed.success) { throw new ProtocolError("invalid_body", "Invalid server.deploy.serverpack parameters"); } - const { server_id: serverId, url, sha1, sha256, sha512, origin } = parsed.data; + const { server_id: serverId, url, sha1, sha256, sha512, origin, key } = parsed.data; const meta = readServerMetadata(serversDir, serverId); // Download & verify hash BEFORE backup hook or extraction. @@ -977,6 +1032,12 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), }); + // With a key the blob is TGB1-encrypted: decrypt (and authenticate) before touching the server. + const packBytes = + key !== undefined + ? await decryptDownloadedBlob(downloaded.data, key, maxServerPackBytes * 4) + : downloaded.data; + if (backupBeforeChange) { await backupHook.beforeChange(serverId); } @@ -984,7 +1045,7 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana const unzipResult = safeUnzipBuffer({ serversBaseDir: serversDir, serverId, - buffer: downloaded.data, + buffer: packBytes, forbiddenPaths: PROTECTED_SERVERPACK_PATHS, }); @@ -1059,7 +1120,96 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana }; } + async function importWorld(params: ServerWorldImportBody): Promise { + const parsed = serverWorldImportBodySchema.safeParse(params); + if (!parsed.success) { + throw new ProtocolError("invalid_body", "Invalid server.world.import parameters"); + } + const { server_id: serverId, world_name: worldName, url, sha256, key } = parsed.data; + readServerMetadata(serversDir, serverId); + + if (options.isServerActive === undefined || (await options.isServerActive(serverId))) { + throw new ProtocolError("server_running", "The server must be stopped to import a world"); + } + + // Download and authenticate everything before anything on disk changes. + const downloaded = await downloadVerifiedBuffer({ + url, + allowedHosts, + expectedHashes: { sha256 }, + maxBytes: maxWorldBytes, + ...(options.maxRedirects !== undefined ? { maxRedirects: options.maxRedirects } : {}), + ...(options.downloadTimeoutMs !== undefined ? { timeoutMs: options.downloadTimeoutMs } : {}), + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + }); + const archive = await decryptDownloadedBlob(downloaded.data, key, maxWorldBytes * 2); + + const serverDir = join(serversDir, serverId); + const suffix = randomBytes(6).toString("hex"); + const stagingName = `.tegrad-import-${suffix}`; + const previousName = `.tegrad-previous-${suffix}`; + const stagingPath = join(serverDir, stagingName); + const previousPath = join(serverDir, previousName); + const worldPath = join(serverDir, worldName); + + // The safety backup runs before the staging folder exists so it is not archived with it. + if (backupBeforeChange) { + await backupHook.beforeChange(serverId); + } + + try { + let unzip: ReturnType; + try { + unzip = safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId, + buffer: archive, + destPath: stagingName, + }); + } catch (err) { + if (err instanceof FileManagerError) { + throw new ProtocolError("invalid_body", `World archive rejected: ${err.code}`); + } + throw err; + } + if (unzip.files.length === 0) { + throw new ProtocolError("invalid_body", "World archive has no files"); + } + + // A single top-level folder inside the archive is the world itself. + let source = stagingPath; + const top = readdirSync(stagingPath, { withFileTypes: true }); + const only = top[0]; + if (top.length === 1 && only !== undefined && only.isDirectory()) { + source = join(stagingPath, only.name); + } + + secureTree(source, SERVER_TREE_PLAN, permissionContext); + + const hadWorld = existsSync(worldPath); + if (hadWorld) { + renameSync(worldPath, previousPath); + } + try { + renameSync(source, worldPath); + } catch (err) { + if (hadWorld) { + renameSync(previousPath, worldPath); + } + throw err; + } + if (hadWorld) { + rmSync(previousPath, { recursive: true, force: true }); + } + options.logger?.info("Imported world", { serverId, worldName, entryCount: unzip.entryCount }); + return { server_id: serverId, world_name: worldName }; + } finally { + rmSync(stagingPath, { recursive: true, force: true }); + } + } + return { + importWorld, listMods, installMod, removeMod, @@ -1108,6 +1258,12 @@ export function registerStateHandlers(queue: CommandQueue, manager: StateManager ctx.sendEvent("server.origin.unlinked", result); }); + queue.registerHandler("server.world.import", async (opened, ctx) => { + const body = opened.body as ServerWorldImportBody; + const result = await manager.importWorld(body); + ctx.sendEvent("server.world.imported", result); + }); + queue.registerHandler("server.deploy.serverpack", async (opened, ctx) => { const body = opened.body as ServerDeployServerpackBody; const result = await manager.deployServerPack(body); diff --git a/src/state/state.test.ts b/src/state/state.test.ts index 933ee05..caba1fb 100644 --- a/src/state/state.test.ts +++ b/src/state/state.test.ts @@ -879,6 +879,22 @@ describe("state commands protocol & runtime wiring", () => { exercised.add("server.deploy.serverpack"); expect(deployAccount.ack?.body.ok).toBe(true); + // server.world.import reaches its handler; without a stopped server it is refused, never no_handler + const worldRes = await send( + "server.world.import", + { + server_id: "srv-rt", + world_name: "world", + url: "https://cdn.modrinth.com/w.bin", + sha256: "a".repeat(64), + key: toBase64Url(new Uint8Array(32)), + }, + true, + ); + exercised.add("server.world.import"); + expect(worldRes.ack?.body.ok).toBe(false); + expect(worldRes.ack?.body.code).not.toBe("no_handler"); + // Verify 100% coverage of STATE_COMMANDS expect([...exercised].sort()).toEqual(STATE_COMMANDS.map((c) => c.type).sort()); diff --git a/src/state/world-import.test.ts b/src/state/world-import.test.ts new file mode 100644 index 0000000..7e1c9fa --- /dev/null +++ b/src/state/world-import.test.ts @@ -0,0 +1,341 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeAll, describe, expect, test } from "bun:test"; +import { createHash } from "node:crypto"; +import { + existsSync, + mkdirSync, + mkdtempSync, + readdirSync, + readFileSync, + rmSync, + writeFileSync, +} from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { + collectChunks, + encryptBlobChunks, + generateSymmetricKey, + ready, + toBase64Url, +} from "../crypto"; +import { createZipBuffer } from "../files"; +import { serverWorldImportBodySchema } from "../protocol"; +import type { FetchLike } from "../server/download"; +import { type ServerMetadata, writeServerMetadata } from "../server/registry"; +import type { BackupHook } from "./backup-hook"; +import { createStateManager } from "./manager"; + +const tempDirs: string[] = []; +const text = (value: string) => new TextEncoder().encode(value); + +beforeAll(async () => { + await ready(); +}); + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +function sha256Hex(data: Uint8Array): string { + return createHash("sha256").update(data).digest("hex"); +} + +function makeServer(): { serversDir: string; serverDir: string } { + const serversDir = mkdtempSync(join(tmpdir(), "tegrad-world-")); + tempDirs.push(serversDir); + const serverDir = join(serversDir, "srv"); + mkdirSync(serverDir, { recursive: true }); + const meta: ServerMetadata = { + v: 1, + id: "srv", + name: "Test", + minecraft_version: "1.21.1", + loader: "fabric", + loader_version: "0.16.0", + memory_mb: 2048, + jvm_args: [], + port: 25565, + created_at: 1_700_000_000_000, + }; + writeServerMetadata(serversDir, meta); + return { serversDir, serverDir }; +} + +async function sealBlob(plain: Uint8Array, key: Uint8Array): Promise { + return collectChunks(encryptBlobChunks(plain, key)); +} + +function fetchOf(blobs: Record): FetchLike { + return async (input) => { + const blob = blobs[String(input)]; + return blob ? new Response(blob, { status: 200 }) : new Response("nope", { status: 404 }); + }; +} + +const URL_WORLD = "https://cdn.tegra.gg/blobs/world"; + +describe("server.world.import", () => { + const worldZip = createZipBuffer([ + { name: "level.dat", data: text("new-level") }, + { name: "region/r.0.0.mca", data: text("new-region") }, + ]); + + async function setup(options: { active?: boolean } = {}) { + const { serversDir, serverDir } = makeServer(); + const key = generateSymmetricKey(); + const blob = await sealBlob(worldZip, key); + const backups: string[] = []; + const hook: BackupHook = { + async beforeChange(id) { + backups.push(id); + }, + }; + const manager = createStateManager({ + serversDir, + cdnHost: "cdn.tegra.gg", + backupHook: hook, + fetchImpl: fetchOf({ [URL_WORLD]: blob }), + isServerActive: async () => options.active ?? false, + serverGroupId: null, + }); + const body = { + server_id: "srv", + world_name: "world", + url: URL_WORLD, + sha256: sha256Hex(blob), + key: toBase64Url(key), + }; + return { serversDir, serverDir, manager, backups, body, key, blob }; + } + + test("replaces the world after backing up the current one", async () => { + const { serverDir, manager, backups, body } = await setup(); + mkdirSync(join(serverDir, "world"), { recursive: true }); + writeFileSync(join(serverDir, "world", "level.dat"), "old-level"); + writeFileSync(join(serverDir, "world", "stale.txt"), "stale"); + + const result = await manager.importWorld(body); + expect(result).toEqual({ server_id: "srv", world_name: "world" }); + expect(backups).toEqual(["srv"]); + expect(readFileSync(join(serverDir, "world", "level.dat"), "utf8")).toBe("new-level"); + expect(readFileSync(join(serverDir, "world", "region", "r.0.0.mca"), "utf8")).toBe( + "new-region", + ); + expect(existsSync(join(serverDir, "world", "stale.txt"))).toBe(false); + // No staging or previous folders are left behind. + expect(readdirSync(serverDir).filter((n) => n.startsWith(".tegrad-"))).toEqual([]); + }); + + test("creates the world when there was none and unwraps a single top-level folder", async () => { + const { serversDir, serverDir } = makeServer(); + const key = generateSymmetricKey(); + const zip = createZipBuffer([ + { name: "MyWorld/level.dat", data: text("inner") }, + { name: "MyWorld/data/x.dat", data: text("x") }, + ]); + const blob = await sealBlob(zip, key); + const manager = createStateManager({ + serversDir, + cdnHost: "cdn.tegra.gg", + fetchImpl: fetchOf({ [URL_WORLD]: blob }), + isServerActive: async () => false, + serverGroupId: null, + }); + await manager.importWorld({ + server_id: "srv", + world_name: "imported", + url: URL_WORLD, + sha256: sha256Hex(blob), + key: toBase64Url(key), + }); + expect(readFileSync(join(serverDir, "imported", "level.dat"), "utf8")).toBe("inner"); + expect(readFileSync(join(serverDir, "imported", "data", "x.dat"), "utf8")).toBe("x"); + }); + + test("refuses while the server is running or when no liveness check is configured", async () => { + const running = await setup({ active: true }); + await expect(running.manager.importWorld(running.body)).rejects.toMatchObject({ + code: "server_running", + }); + expect(running.backups).toEqual([]); + + const { serversDir } = makeServer(); + const unchecked = createStateManager({ serversDir, cdnHost: "cdn.tegra.gg" }); + await expect(unchecked.importWorld(running.body)).rejects.toMatchObject({ + code: "server_running", + }); + }); + + test("a wrong sha256 or key changes nothing and takes no backup", async () => { + const { serverDir, manager, backups, body } = await setup(); + mkdirSync(join(serverDir, "world"), { recursive: true }); + writeFileSync(join(serverDir, "world", "level.dat"), "old-level"); + + await expect(manager.importWorld({ ...body, sha256: "a".repeat(64) })).rejects.toMatchObject({ + code: "hash_mismatch", + }); + await expect( + manager.importWorld({ ...body, key: toBase64Url(generateSymmetricKey()) }), + ).rejects.toMatchObject({ code: "decrypt_failed" }); + expect(backups).toEqual([]); + expect(readFileSync(join(serverDir, "world", "level.dat"), "utf8")).toBe("old-level"); + }); + + test("a tampered blob (hash still matches the tampered bytes) fails authentication", async () => { + const { serversDir, serverDir } = makeServer(); + const key = generateSymmetricKey(); + const blob = (await sealBlob(worldZip, key)).slice(); + blob[blob.length - 3] = (blob[blob.length - 3] ?? 0) ^ 1; + const manager = createStateManager({ + serversDir, + cdnHost: "cdn.tegra.gg", + fetchImpl: fetchOf({ [URL_WORLD]: blob }), + isServerActive: async () => false, + serverGroupId: null, + }); + await expect( + manager.importWorld({ + server_id: "srv", + world_name: "world", + url: URL_WORLD, + sha256: sha256Hex(blob), + key: toBase64Url(key), + }), + ).rejects.toMatchObject({ code: "decrypt_failed" }); + expect(existsSync(join(serverDir, "world"))).toBe(false); + }); + + test("a zip-slip archive is rejected and leaves the existing world alone", async () => { + const { serversDir, serverDir } = makeServer(); + mkdirSync(join(serverDir, "world"), { recursive: true }); + writeFileSync(join(serverDir, "world", "level.dat"), "old-level"); + const key = generateSymmetricKey(); + const blob = await sealBlob( + createZipBuffer([{ name: "../escaped.txt", data: text("pwned") }]), + key, + ); + const manager = createStateManager({ + serversDir, + cdnHost: "cdn.tegra.gg", + fetchImpl: fetchOf({ [URL_WORLD]: blob }), + isServerActive: async () => false, + serverGroupId: null, + }); + await expect( + manager.importWorld({ + server_id: "srv", + world_name: "world", + url: URL_WORLD, + sha256: sha256Hex(blob), + key: toBase64Url(key), + }), + ).rejects.toThrow(); + expect(existsSync(join(serversDir, "escaped.txt"))).toBe(false); + expect(readFileSync(join(serverDir, "world", "level.dat"), "utf8")).toBe("old-level"); + expect(readdirSync(serverDir).filter((n) => n.startsWith(".tegrad-"))).toEqual([]); + }); + + test("a download host outside the allow list is refused", async () => { + const { manager, body } = await setup(); + await expect( + manager.importWorld({ ...body, url: "https://evil.example/blobs/world" }), + ).rejects.toMatchObject({ code: "download_failed" }); + }); + + test("world_name cannot escape the server or hit reserved folders", () => { + const base = { + server_id: "srv", + url: URL_WORLD, + sha256: "a".repeat(64), + key: toBase64Url(generateSymmetricKey()), + }; + for (const bad of [ + "../x", + "a/b", + "..", + ".hidden", + "mods", + "Config", + "logs", + "", + "a b", + "x".repeat(65), + ]) { + expect(serverWorldImportBodySchema.safeParse({ ...base, world_name: bad }).success).toBe( + false, + ); + } + for (const good of ["world", "My_World-2", "world_nether", "a.b"]) { + expect(serverWorldImportBodySchema.safeParse({ ...base, world_name: good }).success).toBe( + true, + ); + } + expect( + serverWorldImportBodySchema.safeParse({ ...base, world_name: "w", key: "short" }).success, + ).toBe(false); + }); +}); + +describe("server.deploy.serverpack with an encrypted blob", () => { + test("decrypts with key and extracts; a wrong key fails before the backup hook", async () => { + const { serversDir, serverDir } = makeServer(); + const key = generateSymmetricKey(); + const zip = createZipBuffer([{ name: "config/a.toml", data: text("a=1\n") }]); + const blob = await sealBlob(zip, key); + const url = "https://cdn.tegra.gg/packs/enc.zip"; + const calls: string[] = []; + const manager = createStateManager({ + serversDir, + cdnHost: "cdn.tegra.gg", + backupHook: { + async beforeChange(id) { + calls.push(id); + }, + }, + fetchImpl: fetchOf({ [url]: blob }), + serverGroupId: null, + }); + + await expect( + manager.deployServerPack({ + server_id: "srv", + url, + sha256: sha256Hex(blob), + key: toBase64Url(generateSymmetricKey()), + }), + ).rejects.toMatchObject({ code: "decrypt_failed" }); + expect(calls).toEqual([]); + + const result = await manager.deployServerPack({ + server_id: "srv", + url, + sha256: sha256Hex(blob), + key: toBase64Url(key), + }); + expect(result.extracted_files).toEqual(["config/a.toml"]); + expect(readFileSync(join(serverDir, "config", "a.toml"), "utf8")).toBe("a=1\n"); + expect(calls).toEqual(["srv"]); + }); + + test("without key the blob is treated as a plain zip, as before", async () => { + const { serversDir, serverDir } = makeServer(); + const zip = createZipBuffer([{ name: "config/b.toml", data: text("b=1\n") }]); + const url = "https://cdn.tegra.gg/packs/plain.zip"; + const manager = createStateManager({ + serversDir, + cdnHost: "cdn.tegra.gg", + fetchImpl: fetchOf({ [url]: zip }), + serverGroupId: null, + }); + await manager.deployServerPack({ server_id: "srv", url, sha256: sha256Hex(zip) }); + expect(readFileSync(join(serverDir, "config", "b.toml"), "utf8")).toBe("b=1\n"); + }); +}); From 5d88c778db122e85d3f53c8e08951172f534c75c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Mon, 23 Nov 2026 12:29:09 -0300 Subject: [PATCH 24/59] feat: session commands reply to the session key by default and accept replyTo --- lib/types/vault/session.d.ts | 2 ++ lib/vault/index.js | 2 ++ src/vault/session.ts | 4 ++++ src/vault/vault.test.ts | 2 ++ 4 files changed, 10 insertions(+) diff --git a/lib/types/vault/session.d.ts b/lib/types/vault/session.d.ts index e7b8e9b..7b1680c 100644 --- a/lib/types/vault/session.d.ts +++ b/lib/types/vault/session.d.ts @@ -18,6 +18,8 @@ export interface IssueSessionOptions { readonly id?: string; } export interface VaultCommandParams { + /** Public key that receives the replies. Sessions default to their own key. */ + readonly replyTo?: PublicKey; readonly type: string; readonly body: unknown; readonly agentPublicKey: PublicKey; diff --git a/lib/vault/index.js b/lib/vault/index.js index 47f2274..ad85c06 100644 --- a/lib/vault/index.js +++ b/lib/vault/index.js @@ -3990,6 +3990,7 @@ function createCommandFromSession(session, params) { agentPublicKey: params.agentPublicKey, signer: session.keyPair, session: session.certificate, + replyTo: params.replyTo ?? session.keyPair.publicKey, counter: params.counter, now: params.now, ...params.ttlMs !== undefined ? { ttlMs: params.ttlMs } : {}, @@ -4003,6 +4004,7 @@ function createSensitiveCommand(unlocked, params) { body: params.body, agentPublicKey: params.agentPublicKey, signer: accountKeyPair, + ...params.replyTo !== undefined ? { replyTo: params.replyTo } : {}, counter: params.counter, now: params.now, ...params.ttlMs !== undefined ? { ttlMs: params.ttlMs } : {}, diff --git a/src/vault/session.ts b/src/vault/session.ts index e832c69..f7f9685 100644 --- a/src/vault/session.ts +++ b/src/vault/session.ts @@ -52,6 +52,8 @@ export interface IssueSessionOptions { } export interface VaultCommandParams { + /** Public key that receives the replies. Sessions default to their own key. */ + readonly replyTo?: PublicKey; readonly type: string; readonly body: unknown; readonly agentPublicKey: PublicKey; @@ -200,6 +202,7 @@ export function createCommandFromSession( agentPublicKey: params.agentPublicKey, signer: session.keyPair, session: session.certificate, + replyTo: params.replyTo ?? session.keyPair.publicKey, counter: params.counter, now: params.now, ...(params.ttlMs !== undefined ? { ttlMs: params.ttlMs } : {}), @@ -220,6 +223,7 @@ export function createSensitiveCommand( body: params.body, agentPublicKey: params.agentPublicKey, signer: accountKeyPair, + ...(params.replyTo !== undefined ? { replyTo: params.replyTo } : {}), counter: params.counter, now: params.now, ...(params.ttlMs !== undefined ? { ttlMs: params.ttlMs } : {}), diff --git a/src/vault/vault.test.ts b/src/vault/vault.test.ts index 5ab8585..2369c11 100644 --- a/src/vault/vault.test.ts +++ b/src/vault/vault.test.ts @@ -166,6 +166,8 @@ describe("vault lifecycle and protocol integration", () => { expect(opened.accountId).toBe(unlocked.account); expect(opened.sessionId).toBe(session.certificate.id); expect(opened.body).toEqual({ server_id: "srv-1" }); + // Replies to a session command are sealed for the session key by default. + expect(command.header.reply_to).toBe(toBase64Url(session.keyPair.publicKey)); unlocked.lock(); }); From d0ea320f1ce4cf92615f3897927c04029f3a2400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Mon, 23 Nov 2026 12:32:09 -0300 Subject: [PATCH 25/59] test: open session replies with the session key in the pairing e2e --- src/cli/e2e.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli/e2e.test.ts b/src/cli/e2e.test.ts index 786f351..8869376 100644 --- a/src/cli/e2e.test.ts +++ b/src/cli/e2e.test.ts @@ -409,7 +409,7 @@ describe("E2E local WebSocket ping/pong", () => { const ackFrame = receivedFrames.find((f) => f.kind === "ack"); expect(eventFrame?.kind).toBe("event"); if (eventFrame?.kind === "event") { - const opened = openTestEvent(eventFrame.body, agent.publicKey, vault.unlocked.keyPair); + const opened = openTestEvent(eventFrame.body, agent.publicKey, session.keyPair); expect(opened.header.type).toBe("agent.pong"); expect(opened.body).toEqual({ at: now }); } From e4788830f3c77a8d2e6975f8a2c7c89828200324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Mon, 23 Nov 2026 14:11:53 -0300 Subject: [PATCH 26/59] fix: server file permissions, installer service restart, exec cwd and reconnect log noise --- install/install.sh | 41 +++- src/agent/connection.ts | 42 +++- src/agent/exec.test.ts | 30 ++- src/agent/exec.ts | 13 ++ src/agent/hardening.test.ts | 382 +++++++++++++++++++++++++++++--- src/agent/state.ts | 7 +- src/backup/archive.ts | 3 + src/backup/manager.ts | 8 + src/cli/doctor.ts | 4 +- src/cli/run.ts | 9 +- src/files/confinement.ts | 19 +- src/files/manager.ts | 21 +- src/files/transfers.ts | 14 +- src/files/zip.ts | 15 +- src/install/units.test.ts | 64 ++++++ src/server/download.ts | 27 ++- src/server/java.ts | 9 +- src/server/permissions.ts | 422 ++++++++++++++++++++++++++++++++---- src/server/registry.ts | 33 ++- src/server/runtime.ts | 57 +++-- src/server/start-script.ts | 18 +- src/state/manager.ts | 45 ++-- 22 files changed, 1135 insertions(+), 148 deletions(-) diff --git a/install/install.sh b/install/install.sh index 1a896b0..221dbcc 100755 --- a/install/install.sh +++ b/install/install.sh @@ -766,6 +766,36 @@ EOF mv -f "$_wr_tmp" "$TEGRAD_WRAPPER" } +file_sha256() { + _fs_path="$1" + if [ ! -f "$_fs_path" ]; then + printf '' + return 0 + fi + if command -v sha256sum >/dev/null 2>&1; then + sha256sum "$_fs_path" | awk '{print $1}' + elif command -v shasum >/dev/null 2>&1; then + shasum -a 256 "$_fs_path" | awk '{print $1}' + else + cksum "$_fs_path" | awk '{print $1 "-" $2}' + fi +} + +sync_tegrad_service() { + _ss_old_hash="$1" + _ss_new_hash="$2" + _ss_was_active="$3" + + systemctl daemon-reload + systemctl enable --now tegrad.service + systemctl enable --now tegrad-update.path + + if [ "$_ss_was_active" -eq 1 ] && [ -n "$_ss_old_hash" ] && [ "$_ss_old_hash" != "$_ss_new_hash" ]; then + log_info "Binary updated; restarting tegrad.service..." + systemctl restart tegrad.service + fi +} + ensure_config() { _cfg_url="$1" _cfg_force="$2" @@ -996,10 +1026,17 @@ main() { log_info "Configuring directories..." ensure_directories + _old_bin_hash=$(file_sha256 "$TEGRAD_BIN") + _tegrad_was_active=0 + if systemctl is-active --quiet tegrad.service >/dev/null 2>&1; then + _tegrad_was_active=1 + fi + log_info "Installing tegrad binary and wrapper..." _bin_tmp="${TEGRAD_BIN}.tmp.$$" install -o root -g root -m 0755 "$BINARY_SRC" "$_bin_tmp" mv -f "$_bin_tmp" "$TEGRAD_BIN" + _new_bin_hash=$(file_sha256 "$TEGRAD_BIN") install_wrapper if [ -n "$OPT_API_URL" ]; then @@ -1032,9 +1069,7 @@ main() { mv -f "$_dropin_tmp" "$DROPIN_FILE" log_info "Reloading systemd and starting tegrad.service and tegrad-update.path..." - systemctl daemon-reload - systemctl enable --now tegrad.service - systemctl enable --now tegrad-update.path + sync_tegrad_service "$_old_bin_hash" "$_new_bin_hash" "$_tegrad_was_active" log_info "Pronto. Agora, para vincular este servidor, rode \`tegrad link\`." } diff --git a/src/agent/connection.ts b/src/agent/connection.ts index 94b3d22..d267595 100644 --- a/src/agent/connection.ts +++ b/src/agent/connection.ts @@ -21,6 +21,8 @@ export const IDLE_TIMEOUT_MS = 75_000; export const HELLO_TIMEOUT_MS = 10_000; /** After this many failed attempts in a row, connection errors are logged at debug level. */ export const QUIET_AFTER_FAILED_ATTEMPTS = 3; +/** While offline, emit a summary info log every N consecutive failed reconnect attempts. */ +export const RECONNECT_SUMMARY_EVERY = 10; export const WS_READY_STATE_CONNECTING = 0; export const WS_READY_STATE_OPEN = 1; @@ -177,6 +179,7 @@ export function createAgentConnection(options: AgentConnectionOptions): AgentCon let authenticated = false; let awaitingHello = false; let reconnectAttempt = 0; + let consecutiveFailures = 0; let reconnectTimer: TimerHandle | null = null; let stableTimer: TimerHandle | null = null; @@ -251,10 +254,23 @@ export function createAgentConnection(options: AgentConnectionOptions): AgentCon } const delayMs = computeBackoffDelayMs(reconnectAttempt, random); reconnectAttempt++; - options.logger.info("Scheduling reconnect", { - attempt: reconnectAttempt, - delayMs, - }); + consecutiveFailures++; + if (consecutiveFailures <= QUIET_AFTER_FAILED_ATTEMPTS) { + options.logger.info("Scheduling reconnect", { + attempt: reconnectAttempt, + delayMs, + }); + } else if (consecutiveFailures % RECONNECT_SUMMARY_EVERY === 0) { + options.logger.info("Still reconnecting", { + attempt: consecutiveFailures, + delayMs, + }); + } else { + options.logger.debug("Scheduling reconnect", { + attempt: reconnectAttempt, + delayMs, + }); + } reconnectTimer = timers.setTimeout(() => { reconnectTimer = null; if (running) { @@ -355,6 +371,7 @@ export function createAgentConnection(options: AgentConnectionOptions): AgentCon function markAuthenticated(ws: WebSocketLike): void { awaitingHello = false; authenticated = true; + consecutiveFailures = 0; options.logger.info("Connected to control server"); stableTimer = timers.setTimeout(() => { @@ -474,10 +491,10 @@ export function createAgentConnection(options: AgentConnectionOptions): AgentCon return; } // Repeated failures of the same outage are noise: warn for the first few, then debug. - if (reconnectAttempt < QUIET_AFTER_FAILED_ATTEMPTS) { + if (consecutiveFailures < QUIET_AFTER_FAILED_ATTEMPTS) { options.logger.warn("WebSocket error occurred"); } else { - options.logger.debug("WebSocket error occurred", { attempt: reconnectAttempt }); + options.logger.debug("WebSocket error occurred", { attempt: consecutiveFailures + 1 }); } }; @@ -485,9 +502,16 @@ export function createAgentConnection(options: AgentConnectionOptions): AgentCon if (socket !== ws) { return; } - options.logger.info("WebSocket closed", { - code: event.code ?? 0, - }); + if (consecutiveFailures < QUIET_AFTER_FAILED_ATTEMPTS) { + options.logger.info("WebSocket closed", { + code: event.code ?? 0, + }); + } else { + options.logger.debug("WebSocket closed", { + code: event.code ?? 0, + attempt: consecutiveFailures + 1, + }); + } detachAndReconnect(ws); }; } diff --git a/src/agent/exec.test.ts b/src/agent/exec.test.ts index 6bcfae5..9c78f9d 100644 --- a/src/agent/exec.test.ts +++ b/src/agent/exec.test.ts @@ -2,7 +2,9 @@ // Copyright (C) 2026 Antônio Miranda import { describe, expect, test } from "bun:test"; -import { runFixed } from "./exec"; +import { realpathSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { defaultExecCwd, runFixed } from "./exec"; describe("runFixed", () => { test("executes a portable command with argv array and returns stdout", async () => { @@ -51,4 +53,30 @@ describe("runFixed", () => { expect(res.timedOut).toBe(true); expect(res.code).toBe(-1); }); + + test("defaults cwd to '/' on POSIX and accepts an explicit cwd option", async () => { + expect(defaultExecCwd("linux")).toBe("/"); + expect(defaultExecCwd("darwin")).toBe("/"); + expect(defaultExecCwd("win32")).toBeUndefined(); + + const targetDir = realpathSync(tmpdir()); + const explicit = await runFixed( + process.execPath, + ["-e", "process.stdout.write(process.cwd())"], + { + cwd: targetDir, + }, + ); + expect(explicit.code).toBe(0); + expect(realpathSync(explicit.stdout.trim())).toBe(targetDir); + + if (process.platform !== "win32") { + const defaulted = await runFixed(process.execPath, [ + "-e", + "process.stdout.write(process.cwd())", + ]); + expect(defaulted.code).toBe(0); + expect(defaulted.stdout.trim()).toBe("/"); + } + }); }); diff --git a/src/agent/exec.ts b/src/agent/exec.ts index c42a2cf..33f6a92 100644 --- a/src/agent/exec.ts +++ b/src/agent/exec.ts @@ -11,6 +11,7 @@ export const DEFAULT_EXEC_MAX_OUTPUT_BYTES = 64 * 1024; export interface RunFixedOptions { readonly timeoutMs?: number; readonly maxOutputBytes?: number; + readonly cwd?: string; } export interface RunFixedResult { @@ -26,8 +27,18 @@ const argsSchema = z.array(z.string()); const optionsSchema = z.object({ timeoutMs: z.number().int().positive().optional(), maxOutputBytes: z.number().int().positive().optional(), + cwd: z.string().min(1).optional(), }); +/** + * Default working directory for spawned child processes. On POSIX this is "/" so + * posix_spawn does not fail with EACCES when the parent was launched from a directory + * the service user cannot enter (e.g. `sudo -u tegrad tegrad doctor` from `/root`). + */ +export function defaultExecCwd(platform: NodeJS.Platform = process.platform): string | undefined { + return platform === "win32" ? undefined : "/"; +} + function buildMinimalEnv(platform: NodeJS.Platform = process.platform): Record { if (platform === "win32") { const env: Record = {}; @@ -145,12 +156,14 @@ export async function runFixed( const timeoutMs = validOptions.timeoutMs ?? DEFAULT_EXEC_TIMEOUT_MS; const maxOutputBytes = validOptions.maxOutputBytes ?? DEFAULT_EXEC_MAX_OUTPUT_BYTES; + const cwd = validOptions.cwd ?? defaultExecCwd(); const proc = Bun.spawn([resolveCommandPath(validCommand), ...validArgs], { stdin: "ignore", stdout: "pipe", stderr: "pipe", env: buildMinimalEnv(), + ...(cwd !== undefined ? { cwd } : {}), }); let timedOut = false; diff --git a/src/agent/hardening.test.ts b/src/agent/hardening.test.ts index cb56dbb..12d49c4 100644 --- a/src/agent/hardening.test.ts +++ b/src/agent/hardening.test.ts @@ -22,8 +22,17 @@ import { type TransportFrame, } from "../protocol"; import { + assertServerPathsUsable, + createServerPermissionContext, + finalizeServerPath, + inspectServersRoot, inspectTree, + type PermissionDirentLike, + type PermissionFailure, + type PermissionFsOps, + type PermissionStatLike, resolveGroupId, + SERVER_DIR_MODE, SERVER_TREE_PLAN, SHARED_TREE_PLAN, secureDirectory, @@ -69,11 +78,317 @@ describe("resolveGroupId", () => { }); }); +describe("server file permissions (injected fs, cross-platform)", () => { + interface FakeNode { + kind: "dir" | "file" | "symlink"; + mode: number; + uid?: number; + gid: number; + children?: string[]; + } + + function makeFakeFs(nodes: Map, options?: { failOnPath?: string }) { + const chmodCalls: { path: string; mode: number }[] = []; + const chownCalls: { path: string; uid: number; gid: number }[] = []; + + const normalize = (p: string) => p.replace(/\\/g, "/"); + const getNode = (p: string): FakeNode => { + const node = nodes.get(normalize(p)); + if (!node) { + const err = new Error(`ENOENT: ${p}`) as Error & { code: string; errno: number }; + err.code = "ENOENT"; + err.errno = -2; + throw err; + } + return node; + }; + + const fs: PermissionFsOps = { + existsSync: (p) => nodes.has(normalize(p)), + lstatSync: (p): PermissionStatLike => { + const node = getNode(p); + return { + mode: node.mode, + uid: node.uid ?? 991, + gid: node.gid, + isSymbolicLink: () => node.kind === "symlink", + isDirectory: () => node.kind === "dir", + isFile: () => node.kind === "file", + }; + }, + chownSync: (p, uid, gid) => { + const np = normalize(p); + chownCalls.push({ path: np, uid, gid }); + // Simulate Bun 1.3.12: passing uid -1 (or any negative uid) throws EINVAL. + if (uid < 0) { + const err = new Error("EINVAL: invalid argument, chown") as Error & { + code: string; + errno: number; + }; + err.code = "EINVAL"; + err.errno = -22; + throw err; + } + if (options?.failOnPath === np) { + const err = new Error("Operation not permitted") as Error & { + code: string; + errno: number; + }; + err.code = "EPERM"; + err.errno = -1; + throw err; + } + getNode(p).gid = gid; + }, + chmodSync: (p, mode) => { + const np = normalize(p); + chmodCalls.push({ path: np, mode }); + // Simulate systemd RestrictSUIDSGID=yes: reject any SUID/SGID bit with EPERM. + if ((mode & 0o6000) !== 0) { + const err = new Error("Operation not permitted (RestrictSUIDSGID)") as Error & { + code: string; + }; + err.code = "EPERM"; + throw err; + } + if (options?.failOnPath === np) { + const err = new Error("Operation not permitted") as Error & { code: string }; + err.code = "EPERM"; + throw err; + } + const node = getNode(p); + // Simulate Linux chmod without setgid clearing any existing setgid bit. + node.mode = mode & 0o777; + }, + readdirSync: (p): readonly PermissionDirentLike[] => { + const np = normalize(p); + const node = getNode(p); + return (node.children ?? []).map((name) => { + const child = getNode(`${np}/${name}`); + return { + name, + isSymbolicLink: () => child.kind === "symlink", + isDirectory: () => child.kind === "dir", + isFile: () => child.kind === "file", + }; + }); + }, + }; + + return { fs, chmodCalls, chownCalls }; + } + + test("never calls chmod with setgid/setuid bits and preserves existing setgid when 9-bit mode matches", () => { + const nodes = new Map([ + ["/var/lib/tegrad-servers", { kind: "dir", mode: 0o2770, gid: 992, children: ["srv1"] }], + [ + "/var/lib/tegrad-servers/srv1", + { kind: "dir", mode: 0o2770, gid: 992, children: ["start.sh", "server.jar", "logs"] }, + ], + ["/var/lib/tegrad-servers/srv1/logs", { kind: "dir", mode: 0o2700, gid: 991, children: [] }], + ["/var/lib/tegrad-servers/srv1/start.sh", { kind: "file", mode: 0o700, gid: 991 }], + ["/var/lib/tegrad-servers/srv1/server.jar", { kind: "file", mode: 0o600, gid: 991 }], + ]); + const { fs, chmodCalls, chownCalls } = makeFakeFs(nodes); + + const failures = secureTree("/var/lib/tegrad-servers/srv1", SERVER_TREE_PLAN, { + gid: 992, + platform: "linux", + serversRoot: "/var/lib/tegrad-servers", + fs, + }); + + expect(failures).toEqual([]); + // Never passed any setgid/setuid bit to chmod + expect(chmodCalls.every((c) => (c.mode & 0o6000) === 0)).toBe(true); + // srv1 already had lower 9 bits 0o770 -> chmod was NOT called on it, preserving setgid 0o2770 + expect(chmodCalls.some((c) => c.path === "/var/lib/tegrad-servers/srv1")).toBe(false); + expect(nodes.get("/var/lib/tegrad-servers/srv1")?.mode).toBe(0o2770); + // logs, start.sh, server.jar got chowned to 992 and chmodded to 0o770 / 0o770 / 0o660 + expect(nodes.get("/var/lib/tegrad-servers/srv1/logs")).toMatchObject({ mode: 0o770, gid: 992 }); + expect(nodes.get("/var/lib/tegrad-servers/srv1/start.sh")).toMatchObject({ + mode: 0o770, + gid: 992, + }); + expect(nodes.get("/var/lib/tegrad-servers/srv1/server.jar")).toMatchObject({ + mode: 0o660, + gid: 992, + }); + expect(chownCalls.map((c) => c.path).sort()).toEqual([ + "/var/lib/tegrad-servers/srv1/logs", + "/var/lib/tegrad-servers/srv1/server.jar", + "/var/lib/tegrad-servers/srv1/start.sh", + ]); + // Never passes uid -1 (Bun 1.3.12 throws EINVAL); always passes the file's real uid. + expect(chownCalls.every((c) => c.uid === 991 && c.gid === 992)).toBe(true); + }); + + test("chown always passes the real file uid (never -1) and logs code, errno and sanitized message on failure", () => { + const nodes = new Map([ + ["/var/lib/tegrad-servers/srv1/ok.jar", { kind: "file", mode: 0o660, uid: 1005, gid: 991 }], + ["/var/lib/tegrad-servers/srv1/fail.jar", { kind: "file", mode: 0o660, uid: 1006, gid: 991 }], + ]); + const { fs, chownCalls } = makeFakeFs(nodes, { + failOnPath: "/var/lib/tegrad-servers/srv1/fail.jar", + }); + const logs: string[] = []; + const logger = createLogger({ + level: "debug", + stdout: (l) => logs.push(l), + stderr: (l) => logs.push(l), + }); + const ctx = createServerPermissionContext({ + serversRoot: "/var/lib/tegrad-servers", + serverGroupId: 992, + platform: "linux", + logger, + fs, + }); + + expect(finalizeServerPath("/var/lib/tegrad-servers/srv1/ok.jar", 0o660, ctx)).toEqual([]); + const failures = finalizeServerPath("/var/lib/tegrad-servers/srv1/fail.jar", 0o660, ctx); + + expect(chownCalls).toEqual([ + { path: "/var/lib/tegrad-servers/srv1/ok.jar", uid: 1005, gid: 992 }, + { path: "/var/lib/tegrad-servers/srv1/fail.jar", uid: 1006, gid: 992 }, + ]); + expect(chownCalls.some((c) => c.uid === -1)).toBe(false); + expect(failures).toHaveLength(1); + expect(failures[0]).toMatchObject({ + op: "chown", + code: "EPERM", + errno: -1, + }); + const warnLine = logs.find((l) => l.includes("Could not adjust server path permissions")); + expect(warnLine).toBeDefined(); + expect(warnLine).toContain('"code":"EPERM"'); + expect(warnLine).toContain('"errno":-1'); + expect(warnLine).toContain("Operation not permitted"); + }); + + test("a chown/chmod failure on one file does not stop other files from being adjusted", () => { + const nodes = new Map([ + [ + "/var/lib/tegrad-servers/srv1", + { kind: "dir", mode: 0o700, gid: 991, children: ["bad.txt", "start.sh", "server.jar"] }, + ], + ["/var/lib/tegrad-servers/srv1/bad.txt", { kind: "file", mode: 0o600, gid: 991 }], + ["/var/lib/tegrad-servers/srv1/start.sh", { kind: "file", mode: 0o700, gid: 991 }], + ["/var/lib/tegrad-servers/srv1/server.jar", { kind: "file", mode: 0o600, gid: 991 }], + ]); + const { fs } = makeFakeFs(nodes, { failOnPath: "/var/lib/tegrad-servers/srv1/bad.txt" }); + const reported: PermissionFailure[] = []; + + const failures = secureTree("/var/lib/tegrad-servers/srv1", SERVER_TREE_PLAN, { + gid: 992, + platform: "linux", + serversRoot: "/var/lib/tegrad-servers", + fs, + onError: (f) => reported.push(f), + }); + + expect(failures.length).toBe(2); // chown + chmod on bad.txt + expect(reported.every((f) => f.path.endsWith("bad.txt") && f.code === "EPERM")).toBe(true); + // Other files WERE adjusted despite the failure on bad.txt + expect(nodes.get("/var/lib/tegrad-servers/srv1/start.sh")).toMatchObject({ + mode: 0o770, + gid: 992, + }); + expect(nodes.get("/var/lib/tegrad-servers/srv1/server.jar")).toMatchObject({ + mode: 0o660, + gid: 992, + }); + }); + + test("never chmods or chowns the servers root directory itself", () => { + const nodes = new Map([ + ["/var/lib/tegrad-servers", { kind: "dir", mode: 0o2770, gid: 992, children: [] }], + ]); + const { fs, chmodCalls, chownCalls } = makeFakeFs(nodes); + + finalizeServerPath("/var/lib/tegrad-servers", SERVER_DIR_MODE, { + gid: 992, + platform: "linux", + serversRoot: "/var/lib/tegrad-servers", + fs, + }); + secureTree("/var/lib/tegrad-servers", SERVER_TREE_PLAN, { + gid: 992, + platform: "linux", + serversRoot: "/var/lib/tegrad-servers", + fs, + }); + + expect(chmodCalls).toEqual([]); + expect(chownCalls).toEqual([]); + }); + + test("assertServerPathsUsable throws a clear error when essential files lack group or permissions", () => { + const nodes = new Map([ + ["/srv/start.sh", { kind: "file", mode: 0o770, gid: 991 }], + ["/srv/server.jar", { kind: "file", mode: 0o660, gid: 992 }], + ]); + const { fs } = makeFakeFs(nodes); + + expect(() => + assertServerPathsUsable( + [ + { path: "/srv/start.sh", executable: true }, + { path: "/srv/server.jar", executable: false }, + ], + { gid: 992, platform: "linux", fs }, + ), + ).toThrow(/tegrad-srv.*start\.sh/i); + + // Fix group -> passes + const startNode = nodes.get("/srv/start.sh"); + if (startNode) startNode.gid = 992; + expect(() => + assertServerPathsUsable( + [ + { path: "/srv/start.sh", executable: true }, + { path: "/srv/server.jar", executable: false }, + ], + { gid: 992, platform: "linux", fs }, + ), + ).not.toThrow(); + }); + + test("inspectServersRoot requires setgid on root, while inspectTree does not require setgid on server subdirs", () => { + const nodes = new Map([ + ["/var/lib/tegrad-servers", { kind: "dir", mode: 0o2770, gid: 992, children: ["srv1"] }], + [ + "/var/lib/tegrad-servers/srv1", + { kind: "dir", mode: 0o770, gid: 992, children: ["start.sh", "server.jar"] }, + ], + ["/var/lib/tegrad-servers/srv1/start.sh", { kind: "file", mode: 0o770, gid: 992 }], + ["/var/lib/tegrad-servers/srv1/server.jar", { kind: "file", mode: 0o660, gid: 992 }], + ]); + const { fs } = makeFakeFs(nodes); + + expect(inspectServersRoot("/var/lib/tegrad-servers", 992, fs)).toEqual([]); + expect(inspectTree("/var/lib/tegrad-servers/srv1", SERVER_TREE_PLAN, 992, 20, fs)).toEqual([]); + + // Drop setgid on root -> reported + const rootNode = nodes.get("/var/lib/tegrad-servers"); + if (rootNode) rootNode.mode = 0o770; + expect(inspectServersRoot("/var/lib/tegrad-servers", 992, fs)[0]?.problem).toContain("setgid"); + + // Drop group exec on start.sh -> reported + const startNode = nodes.get("/var/lib/tegrad-servers/srv1/start.sh"); + if (startNode) startNode.mode = 0o660; + const problems = inspectTree("/var/lib/tegrad-servers/srv1", SERVER_TREE_PLAN, 992, 20, fs); + expect(problems.some((p) => p.path.endsWith("start.sh") && p.problem.includes("execute"))).toBe( + true, + ); + }); +}); + describe.skipIf(!posix)("server file permissions", () => { // Use the current gid so chown always succeeds without privileges. const gid = posix ? (process.getgid?.() ?? 0) : 0; - test("secureTree gives dirs setgid 2770, files 0660 and keeps executables executable for the group", () => { + test("secureTree gives dirs 0770 (no setgid), files 0660 and keeps executables executable for the group", () => { const root = tempDir(); const server = join(root, "srv"); mkdirSync(join(server, "logs"), { recursive: true }); @@ -84,10 +399,10 @@ describe.skipIf(!posix)("server file permissions", () => { writeFileSync(join(server, "logs", "console.log"), ""); chmodSync(join(server, "eula.txt"), 0o644); - secureTree(server, SERVER_TREE_PLAN, { gid }); + secureTree(server, SERVER_TREE_PLAN, { gid, serversRoot: root }); - expect(statSync(server).mode & 0o7777).toBe(0o2770); - expect(statSync(join(server, "logs")).mode & 0o7777).toBe(0o2770); + expect(statSync(server).mode & 0o777).toBe(0o770); + expect(statSync(join(server, "logs")).mode & 0o777).toBe(0o770); expect(statSync(join(server, "server.jar")).mode & 0o7777).toBe(0o660); expect(statSync(join(server, "eula.txt")).mode & 0o7777).toBe(0o660); expect(statSync(join(server, "start.sh")).mode & 0o7777).toBe(0o770); @@ -99,14 +414,12 @@ describe.skipIf(!posix)("server file permissions", () => { } }); - test("an explicit chmod to 770 would drop setgid; secureDirectory keeps it", () => { + test("secureDirectory preserves an existing setgid bit when the 9-bit mode already matches", () => { const dir = join(tempDir(), "srv"); mkdirSync(dir); - secureDirectory(dir, 0o2770, { gid }); + chmodSync(dir, 0o2770); expect(statSync(dir).mode & 0o2000).toBe(0o2000); - chmodSync(dir, 0o770); - expect(statSync(dir).mode & 0o2000).toBe(0); - secureDirectory(dir, 0o2770, { gid }); + secureDirectory(dir, SERVER_DIR_MODE, { gid }); expect(statSync(dir).mode & 0o2000).toBe(0o2000); }); @@ -119,10 +432,10 @@ describe.skipIf(!posix)("server file permissions", () => { writeFileSync(join(java, "release"), "x"); chmodSync(join(java, "release"), 0o664); - secureTree(join(root, ".runtime"), SHARED_TREE_PLAN, { gid }); + secureTree(join(root, ".runtime"), SHARED_TREE_PLAN, { gid, serversRoot: root }); - expect(statSync(join(root, ".runtime")).mode & 0o7777).toBe(0o2750); - expect(statSync(join(java, "bin")).mode & 0o7777).toBe(0o2750); + expect(statSync(join(root, ".runtime")).mode & 0o777).toBe(0o750); + expect(statSync(join(java, "bin")).mode & 0o777).toBe(0o750); expect(statSync(join(java, "bin", "java")).mode & 0o7777).toBe(0o750); expect(statSync(join(java, "release")).mode & 0o7777).toBe(0o640); }); @@ -135,28 +448,27 @@ describe.skipIf(!posix)("server file permissions", () => { const server = join(root, "srv"); mkdirSync(server); require("node:fs").symlinkSync(outside, join(server, "link")); - secureTree(server, SERVER_TREE_PLAN, { gid }); + secureTree(server, SERVER_TREE_PLAN, { gid, serversRoot: root }); expect(statSync(outside).mode & 0o777).toBe(0o600); }); - test("inspectTree reports wrong group, missing setgid, lost group access and world access", () => { + test("inspectTree reports wrong group, lost group access and world access without requiring setgid on subdirs", () => { const root = tempDir(); const server = join(root, "srv"); mkdirSync(server); writeFileSync(join(server, "good.txt"), "x"); writeFileSync(join(server, "world-readable.txt"), "x"); writeFileSync(join(server, "no-group.txt"), "x"); - secureTree(server, SERVER_TREE_PLAN, { gid }); + secureTree(server, SERVER_TREE_PLAN, { gid, serversRoot: root }); + chmodSync(server, 0o770); expect(inspectTree(server, SERVER_TREE_PLAN, gid)).toEqual([]); chmodSync(join(server, "world-readable.txt"), 0o664 | 0o004); chmodSync(join(server, "no-group.txt"), 0o600); - chmodSync(server, 0o770); const problems = inspectTree(server, SERVER_TREE_PLAN, gid).map( (p) => `${p.path.slice(server.length)}: ${p.problem}`, ); - expect(problems.some((p) => p.includes("missing the setgid bit"))).toBe(true); expect( problems.some((p) => p.includes("no-group.txt") && p.includes("group access missing")), ).toBe(true); @@ -268,7 +580,7 @@ describe("handler_error logging", () => { }); describe("WebSocket error log level", () => { - test("warns for the first failed attempts, then drops to debug", () => { + test("warns for the first 3 failed attempts, drops to debug, logs info summary every 10 attempts, and resets on connect", async () => { const lines: string[] = []; const logger = createLogger({ level: "debug", @@ -294,7 +606,7 @@ describe("WebSocket error log level", () => { timers, webSocketFactory: () => { const socket: WebSocketLike = { - readyState: 0, + readyState: 1, onopen: null, onmessage: null, onclose: null, @@ -309,21 +621,39 @@ describe("WebSocket error log level", () => { }); connection.start(); - for (let attempt = 0; attempt < 6; attempt++) { + for (let attempt = 0; attempt < 21; attempt++) { const socket = sockets[attempt]; socket?.onerror?.(new Error("down")); socket?.onclose?.({ code: 1006 }); const next = pending.shift(); next?.(); } - connection.stop(); const errors = lines.filter((l) => l.includes("WebSocket error occurred")); - expect(errors).toHaveLength(6); - expect( - errors.slice(0, 3).every((l) => l.includes('"level":"warn"') || l.includes("warn")), - ).toBe(true); - expect(errors.slice(3).every((l) => l.includes("debug"))).toBe(true); + expect(errors).toHaveLength(21); + expect(errors.slice(0, 3).every((l) => l.includes('"level":"warn"'))).toBe(true); + expect(errors.slice(3).every((l) => l.includes('"level":"debug"'))).toBe(true); + + const summaries = lines.filter((l) => l.includes("Still reconnecting")); + expect(summaries).toHaveLength(2); + expect(summaries[0]).toContain('"level":"info"'); + expect(summaries[0]).toContain('"attempt":10'); + expect(summaries[1]).toContain('"level":"info"'); + expect(summaries[1]).toContain('"attempt":20'); + + // Connect successfully -> consecutive failure counter resets so next error warns again + const activeSocket = sockets[sockets.length - 1]; + activeSocket?.onopen?.(); + await Promise.resolve(); + await Promise.resolve(); + const beforeNextErr = lines.length; + activeSocket?.onerror?.(new Error("new outage")); + const afterReconnectErr = lines + .slice(beforeNextErr) + .find((l) => l.includes("WebSocket error occurred")); + expect(afterReconnectErr).toContain('"level":"warn"'); + + connection.stop(); }); }); diff --git a/src/agent/state.ts b/src/agent/state.ts index c127cfb..191da69 100644 --- a/src/agent/state.ts +++ b/src/agent/state.ts @@ -148,9 +148,12 @@ function isPosix(platform: NodeJS.Platform = process.platform): boolean { } function ensureDir(dirPath: string, mode: number = STATE_DIR_MODE): void { - mkdirSync(dirPath, { recursive: true, mode }); + const desiredMode = mode & 0o777; + mkdirSync(dirPath, { recursive: true, mode: desiredMode }); if (isPosix()) { - chmodSync(dirPath, mode); + if ((statSync(dirPath).mode & 0o777) !== desiredMode) { + chmodSync(dirPath, desiredMode); + } } } diff --git a/src/backup/archive.ts b/src/backup/archive.ts index 632ca04..8b132d8 100644 --- a/src/backup/archive.ts +++ b/src/backup/archive.ts @@ -32,6 +32,7 @@ import { type ZipEntryInput, } from "../files"; import { ProtocolError } from "../protocol"; +import type { PermissionContext } from "../server/permissions"; import type { ServerRuntimeProvider } from "./types"; export const DEFAULT_SAVE_TIMEOUT_MS = 30_000; @@ -376,6 +377,7 @@ export interface RestoreServerArchiveOptions { readonly maxEntries?: number; readonly maxUncompressedBytes?: number; readonly maxEntryBytes?: number; + readonly permissions?: PermissionContext; } export function restoreServerArchive(options: RestoreServerArchiveOptions): SafeUnzipResult { @@ -388,6 +390,7 @@ export function restoreServerArchive(options: RestoreServerArchiveOptions): Safe buffer: options.archive, destPath: "", forbiddenPaths: PROTECTED_RESTORE_PATHS, + ...(options.permissions !== undefined ? { permissions: options.permissions } : {}), ...(options.maxEntries !== undefined ? { maxEntries: options.maxEntries } : {}), ...(options.maxUncompressedBytes !== undefined ? { maxUncompressedBytes: options.maxUncompressedBytes } diff --git a/src/backup/manager.ts b/src/backup/manager.ts index 56d225d..fc3bd2e 100644 --- a/src/backup/manager.ts +++ b/src/backup/manager.ts @@ -16,6 +16,7 @@ import { type ServerBackupRestoreBody, serverIdSchema, } from "../protocol"; +import { createServerPermissionContext, type PermissionContext } from "../server/permissions"; import { type ArchiveServerDirectoryOptions, createConsistentServerArchive, @@ -104,6 +105,7 @@ export interface BackupManagerOptions { readonly now?: () => number; readonly sleep?: (ms: number) => Promise; readonly logger?: Logger; + readonly serverGroupId?: number | null; readonly archiveImpl?: (options: ArchiveServerDirectoryOptions) => ServerArchiveResult; } @@ -129,6 +131,11 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage const serversBaseDir = options.serversBaseDir ?? DEFAULT_SERVERS_BASE_DIR; const allowInsecure = options.allowInsecure ?? false; const now = options.now ?? (() => Date.now()); + const permissionContext: PermissionContext = createServerPermissionContext({ + serversRoot: serversBaseDir, + ...(options.serverGroupId !== undefined ? { serverGroupId: options.serverGroupId } : {}), + ...(options.logger !== undefined ? { logger: options.logger } : {}), + }); const configStore = new BackupConfigStore({ stateDir: options.stateDir, @@ -472,6 +479,7 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage serversBaseDir, serverId: validServerId, archive, + permissions: permissionContext, }); return { diff --git a/src/cli/doctor.ts b/src/cli/doctor.ts index 815baab..0ccd59f 100644 --- a/src/cli/doctor.ts +++ b/src/cli/doctor.ts @@ -6,6 +6,7 @@ import { join } from "node:path"; import { getStatePaths, type RunFixedResult, resolveStateDir, runFixed } from "../agent"; import { NETWORK_DENY_RANGES } from "../install/units"; import { + inspectServersRoot, inspectTree, type PermissionProblem, SERVER_GROUP_NAME, @@ -422,7 +423,7 @@ export async function runDoctor(options: DoctorOptions = {}): Promise { }); } - // 8. Server files belong to the server group, with group access and setgid directories + // 8. Server files belong to the server group, with group access and setgid on the servers root const serversDir = options.serversDir ?? env.TEGRAD_SERVERS_DIR?.trim() ?? "/var/lib/tegrad-servers"; if (!exists(serversDir)) { @@ -438,6 +439,7 @@ export async function runDoctor(options: DoctorOptions = {}): Promise { options.inspectServers ?? ((dir: string, gid: number | null) => { const found: PermissionProblem[] = []; + found.push(...inspectServersRoot(dir, gid)); for (const entry of readdirSync(dir, { withFileTypes: true })) { if (!entry.isDirectory()) continue; const full = join(dir, entry.name); diff --git a/src/cli/run.ts b/src/cli/run.ts index 90a47dc..2611afa 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -166,11 +166,12 @@ export async function createAgentRuntime( ...(options.now !== undefined ? { now: options.now } : {}), }); - const fileManager = new FileManager( - configuredServersDir && configuredServersDir.length > 0 + const fileManager = new FileManager({ + logger, + ...(configuredServersDir && configuredServersDir.length > 0 ? { serversBaseDir: configuredServersDir } - : {}, - ); + : {}), + }); registerFileCommandHandlers(queue, fileManager); const configuredBackupsDir = options.backupsDir ?? env.TEGRAD_BACKUPS_DIR?.trim(); diff --git a/src/files/confinement.ts b/src/files/confinement.ts index 719d86f..9820ab7 100644 --- a/src/files/confinement.ts +++ b/src/files/confinement.ts @@ -19,6 +19,12 @@ import { } from "node:fs"; import { basename, dirname, join, resolve, sep } from "node:path"; import { SERVER_ID_PATTERN } from "../protocol"; +import { + finalizeServerPath, + type PermissionContext, + SERVER_DIR_MODE, + SERVER_FILE_MODE, +} from "../server/permissions"; import { FileManagerError } from "./errors"; export const DEFAULT_SERVERS_BASE_DIR = "/var/lib/tegrad-servers"; @@ -36,8 +42,8 @@ const ENCODED_TRAVERSAL_REGEX = /%(?:2f|5c|00)/i; // Blocks ASCII/C1 control characters (Cc), invisible format/bidi characters (Cf), // line/paragraph separators (U+2028/U+2029), and known invisible filler code points. const UNSAFE_UNICODE_CHAR_REGEX = /(?:\p{Cc}|\p{Cf}|\u034F|\u180E|\u2028|\u2029|\u3164|\uFFA0)/u; -const DEFAULT_FILE_MODE = 0o640; -const DEFAULT_DIR_MODE = 0o750; +const DEFAULT_FILE_MODE = SERVER_FILE_MODE; +const DEFAULT_DIR_MODE = SERVER_DIR_MODE; export interface ConfinedPath { readonly serverId: string; @@ -59,6 +65,7 @@ export interface AtomicWriteOptions { readonly mode?: number; readonly createParents?: boolean; readonly writeHook?: (fd: number, data: Uint8Array) => void; + readonly permissions?: PermissionContext; } export function isPosix(platform: NodeJS.Platform = process.platform): boolean { @@ -515,6 +522,7 @@ export function mkdirConfined(options: { readonly serverId: string; readonly relPath: string; readonly mode?: number; + readonly permissions?: PermissionContext; }): ConfinedPath { const mode = options.mode ?? DEFAULT_DIR_MODE; const resolved = resolveConfinedPath({ @@ -570,6 +578,9 @@ export function mkdirConfined(options: { if (!isStrictlyInsideOrEqual(resolved.realServerRoot, realCurrent, false)) { throw new FileManagerError("path_traversal", "Directory escaped server root"); } + if (options.permissions !== undefined) { + finalizeServerPath(current, mode, options.permissions); + } } return resolved; @@ -603,6 +614,7 @@ export function writeConfinedFileAtomic( serversBaseDir: dirname(resolved.serverRoot), serverId: resolved.serverId, relPath: parentSegments.join("/"), + ...(options.permissions !== undefined ? { permissions: options.permissions } : {}), }); } @@ -688,6 +700,9 @@ export function writeConfinedFileAtomic( renameSync(tmpPath, resolved.fullPath); renamed = true; + if (options.permissions !== undefined) { + finalizeServerPath(resolved.fullPath, mode, options.permissions); + } } catch (err) { if (fd !== undefined) { try { diff --git a/src/files/manager.ts b/src/files/manager.ts index 929afea..1e314f4 100644 --- a/src/files/manager.ts +++ b/src/files/manager.ts @@ -14,6 +14,8 @@ import { } from "node:fs"; import { dirname, join } from "node:path"; import type { CommandQueue } from "../agent/jobs"; +import type { Logger } from "../agent/logger"; +import { createServerPermissionContext, type PermissionContext } from "../server/permissions"; import { assertNoSymlinkPath, DEFAULT_SERVERS_BASE_DIR, @@ -109,6 +111,9 @@ export interface FileManagerOptions { readonly maxZipEntryBytes?: number; readonly maxZipCompressionRatio?: number; readonly zipRatioMinBytes?: number; + readonly serverGroupId?: number | null; + readonly logger?: Logger; + readonly permissions?: PermissionContext; } function validateFileEncoding(encoding: unknown): FileEncoding { @@ -274,6 +279,7 @@ export class FileManager { readonly #maxReadWriteBytes: number; readonly #maxCopyFiles: number; readonly #maxCopyBytes: number; + readonly #permissions: PermissionContext; readonly #transfers: TransferManager; readonly #zipOptions: { readonly maxEntries?: number; @@ -288,8 +294,16 @@ export class FileManager { this.#maxReadWriteBytes = options.maxReadWriteBytes ?? MAX_READ_WRITE_BYTES; this.#maxCopyFiles = options.maxCopyFiles ?? DEFAULT_MAX_COPY_FILES; this.#maxCopyBytes = options.maxCopyBytes ?? DEFAULT_MAX_COPY_BYTES; + this.#permissions = + options.permissions ?? + createServerPermissionContext({ + serversRoot: this.#serversBaseDir, + ...(options.serverGroupId !== undefined ? { serverGroupId: options.serverGroupId } : {}), + ...(options.logger !== undefined ? { logger: options.logger } : {}), + }); this.#transfers = new TransferManager({ serversBaseDir: this.#serversBaseDir, + permissions: this.#permissions, ...(options.maxUploadBytes !== undefined ? { maxUploadBytes: options.maxUploadBytes } : {}), ...(options.maxPartBytes !== undefined ? { maxPartBytes: options.maxPartBytes } : {}), ...(options.maxConcurrentUploads !== undefined @@ -503,7 +517,7 @@ export class FileManager { allowRoot: false, }); - writeConfinedFileAtomic(resolved, data); + writeConfinedFileAtomic(resolved, data, { permissions: this.#permissions }); return { path: resolved.relativePath, size: data.byteLength, @@ -515,6 +529,7 @@ export class FileManager { serversBaseDir: this.#serversBaseDir, serverId: params.server_id, relPath: params.path, + permissions: this.#permissions, }); return { path: resolved.relativePath }; } @@ -759,6 +774,7 @@ export class FileManager { serversBaseDir: this.#serversBaseDir, serverId: params.server_id, relPath: dstConfined.relativePath, + permissions: this.#permissions, }); let children: string[]; try { @@ -813,6 +829,7 @@ export class FileManager { } const remainingLimit = this.#maxCopyBytes - bytesCopied; writeConfinedFileAtomic(dstConfined, new Uint8Array(0), { + permissions: this.#permissions, writeHook(dstFd) { fileBytes = streamCopyWithLimit(fd, dstFd, remainingLimit); }, @@ -940,6 +957,7 @@ export class FileManager { serverId: params.server_id, paths: params.paths, destPath: params.dest_path, + permissions: this.#permissions, }); } @@ -953,6 +971,7 @@ export class FileManager { serverId: params.server_id, zipPath: params.zip_path, ...(params.dest_path !== undefined ? { destPath: params.dest_path } : {}), + permissions: this.#permissions, ...this.#zipOptions, }); } diff --git a/src/files/transfers.ts b/src/files/transfers.ts index 44464ea..879c536 100644 --- a/src/files/transfers.ts +++ b/src/files/transfers.ts @@ -19,6 +19,11 @@ import { } from "node:fs"; import { dirname, join } from "node:path"; import { SHA256_HEX_PATTERN } from "../protocol"; +import { + finalizeServerPath, + type PermissionContext, + SERVER_FILE_MODE, +} from "../server/permissions"; import { assertConfinedInternalDir, assertNoSymlinkPath, @@ -109,6 +114,7 @@ export interface TransferManagerOptions { readonly maxPartBytes?: number; readonly maxConcurrentUploads?: number; readonly maxConcurrentDownloads?: number; + readonly permissions?: PermissionContext; } export interface UploadBeginParams { @@ -226,6 +232,7 @@ export class TransferManager { readonly #maxPartBytes: number; readonly #maxConcurrentUploads: number; readonly #maxConcurrentDownloads: number; + readonly #permissions: PermissionContext | undefined; readonly #uploads = new Map(); readonly #downloads = new Map(); @@ -236,6 +243,7 @@ export class TransferManager { this.#maxConcurrentUploads = options.maxConcurrentUploads ?? DEFAULT_MAX_CONCURRENT_UPLOADS; this.#maxConcurrentDownloads = options.maxConcurrentDownloads ?? DEFAULT_MAX_CONCURRENT_DOWNLOADS; + this.#permissions = options.permissions; } #cleanupUpload(session: UploadSession, unlinkStaging: boolean): void { @@ -539,7 +547,7 @@ export class TransferManager { fsyncSync(session.fd); if (isPosix()) { - fchmodSync(session.fd, 0o640); + fchmodSync(session.fd, SERVER_FILE_MODE); } closeSync(session.fd); session.fd = undefined; @@ -550,6 +558,7 @@ export class TransferManager { serversBaseDir: this.#serversBaseDir, serverId: session.serverId, relPath: parentSegments.join("/"), + ...(this.#permissions !== undefined ? { permissions: this.#permissions } : {}), }); } @@ -602,6 +611,9 @@ export class TransferManager { renameSync(session.stagingPath, resolved.fullPath); renamed = true; + if (this.#permissions !== undefined) { + finalizeServerPath(resolved.fullPath, SERVER_FILE_MODE, this.#permissions); + } return { upload_id: session.uploadId, diff --git a/src/files/zip.ts b/src/files/zip.ts index 9e9b543..dca44c4 100644 --- a/src/files/zip.ts +++ b/src/files/zip.ts @@ -4,6 +4,7 @@ import { closeSync, lstatSync, readdirSync, readSync, type Stats } from "node:fs"; import { join } from "node:path"; import { deflateRawSync, inflateRawSync } from "node:zlib"; +import type { PermissionContext } from "../server/permissions"; import { DEFAULT_SERVERS_BASE_DIR, isErrnoCode, @@ -297,6 +298,7 @@ export interface SafeUnzipOptions { readonly maxCompressionRatio?: number; readonly ratioMinBytes?: number; readonly forbiddenPaths?: ReadonlySet; + readonly permissions?: PermissionContext; } export interface SafeUnzipBufferOptions extends SafeUnzipOptions { @@ -663,6 +665,7 @@ export function safeUnzipBuffer(options: SafeUnzipBufferOptions): SafeUnzipResul serversBaseDir, serverId: options.serverId, relPath: destResolved.relativePath, + ...(options.permissions !== undefined ? { permissions: options.permissions } : {}), }); } @@ -675,6 +678,7 @@ export function safeUnzipBuffer(options: SafeUnzipBufferOptions): SafeUnzipResul serversBaseDir, serverId: options.serverId, relPath: entry.targetRelPath, + ...(options.permissions !== undefined ? { permissions: options.permissions } : {}), }); continue; } @@ -761,7 +765,10 @@ export function safeUnzipBuffer(options: SafeUnzipBufferOptions): SafeUnzipResul relPath: entry.targetRelPath, allowRoot: false, }); - writeConfinedFileAtomic(targetResolved, plain, { createParents: true }); + writeConfinedFileAtomic(targetResolved, plain, { + createParents: true, + ...(options.permissions !== undefined ? { permissions: options.permissions } : {}), + }); extractedFiles.push(targetResolved.relativePath); } @@ -809,6 +816,7 @@ export function safeUnzipFile(options: SafeUnzipFileOptions): SafeUnzipResult { : {}), ...(options.ratioMinBytes !== undefined ? { ratioMinBytes: options.ratioMinBytes } : {}), ...(options.forbiddenPaths !== undefined ? { forbiddenPaths: options.forbiddenPaths } : {}), + ...(options.permissions !== undefined ? { permissions: options.permissions } : {}), }); } @@ -819,6 +827,7 @@ export interface SafeZipFilesOptions { readonly destPath: string; readonly maxFiles?: number; readonly maxTotalBytes?: number; + readonly permissions?: PermissionContext; } export interface SafeZipResult { @@ -979,7 +988,9 @@ export function safeZipFiles(options: SafeZipFilesOptions): SafeZipResult { } const archive = createZipBuffer(entries); - writeConfinedFileAtomic(destResolved, archive); + writeConfinedFileAtomic(destResolved, archive, { + ...(options.permissions !== undefined ? { permissions: options.permissions } : {}), + }); return { destPath: destResolved.relativePath, diff --git a/src/install/units.test.ts b/src/install/units.test.ts index 6839e57..a895856 100644 --- a/src/install/units.test.ts +++ b/src/install/units.test.ts @@ -567,4 +567,68 @@ describe("Security regression checks on install/ assets", () => { } }, ); + + const restartTest = shPath !== null ? test : test.skip; + + restartTest( + "install.sh restarts only tegrad.service when updating an active binary, and skips restart when unchanged or inactive", + async () => { + if (shPath === null) return; + const script = readInstallFile("install.sh"); + // Regression guard: main() must compare binary hash before/after install and invoke sync_tegrad_service + expect(script).toContain('_old_bin_hash=$(file_sha256 "$TEGRAD_BIN")'); + expect(script).toContain('_new_bin_hash=$(file_sha256 "$TEGRAD_BIN")'); + expect(script).toContain("systemctl is-active --quiet tegrad.service"); + expect(script).toContain( + 'sync_tegrad_service "$_old_bin_hash" "$_new_bin_hash" "$_tegrad_was_active"', + ); + + const scriptPath = join(INSTALL_DIR, "install.sh").replace(/\\/g, "/"); + const runSync = async (oldHash: string, newHash: string, wasActive: number) => { + const proc = Bun.spawn( + [ + shPath, + "-c", + [ + 'TEGRAD_INSTALL_SOURCE_ONLY=1 . "$1"', + 'systemctl() { printf "systemctl %s\\n" "$*"; }', + 'sync_tegrad_service "$2" "$3" "$4"', + ].join("\n"), + "--", + scriptPath, + oldHash, + newHash, + String(wasActive), + ], + { stdin: "ignore", stdout: "pipe", stderr: "pipe" }, + ); + const [stdout, stderr, code] = await Promise.all([ + new Response(proc.stdout).text(), + new Response(proc.stderr).text(), + proc.exited, + ]); + expect(stderr).toBe(""); + expect(code).toBe(0); + return stdout + .replace(/\r\n/g, "\n") + .split("\n") + .filter((l) => l.startsWith("systemctl ")); + }; + + // Active + binary changed -> must restart ONLY tegrad.service, never tegrad-server@* + const updatedActive = await runSync("aaaa", "bbbb", 1); + expect(updatedActive).toContain("systemctl restart tegrad.service"); + expect(updatedActive.some((l) => l.includes("tegrad-server@"))).toBe(false); + + // Active + binary unchanged -> must NOT restart + const unchangedActive = await runSync("aaaa", "aaaa", 1); + expect(unchangedActive).not.toContain("systemctl restart tegrad.service"); + expect(unchangedActive.some((l) => l.includes("restart"))).toBe(false); + + // Inactive (fresh install or stopped) + binary changed -> enable --now starts it, no restart + const freshInactive = await runSync("", "bbbb", 0); + expect(freshInactive).toContain("systemctl enable --now tegrad.service"); + expect(freshInactive.some((l) => l.includes("restart"))).toBe(false); + }, + ); }); diff --git a/src/server/download.ts b/src/server/download.ts index c91c748..f459d3d 100644 --- a/src/server/download.ts +++ b/src/server/download.ts @@ -10,12 +10,19 @@ import { mkdirSync, openSync, renameSync, + statSync, unlinkSync, writeSync, } from "node:fs"; import { basename, dirname, join } from "node:path"; import type { z } from "zod"; import { ProtocolError } from "../protocol"; +import { + finalizeServerPath, + type PermissionContext, + SERVER_DIR_MODE, + SERVER_FILE_MODE, +} from "./permissions"; export type FetchLike = (input: string | URL, init?: RequestInit) => Promise; export type HashAlgorithm = "sha256" | "sha1"; @@ -267,6 +274,7 @@ export interface DownloadVerifiedFileOptions extends FetchAllowlistOptions { readonly maxBytes?: number; readonly fileMode?: number; readonly dirMode?: number; + readonly permissions?: PermissionContext; } function writeAllSync(fd: number, buf: Uint8Array): void { @@ -284,8 +292,8 @@ export async function downloadVerifiedFile( options.expectedHash.hex, ); const maxBytes = options.maxBytes ?? DEFAULT_MAX_BINARY_BYTES; - const fileMode = options.fileMode ?? 0o640; - const dirMode = options.dirMode ?? 0o750; + const fileMode = options.fileMode ?? SERVER_FILE_MODE; + const dirMode = options.dirMode ?? SERVER_DIR_MODE; const response = await fetchWithAllowlist(options.url, options); @@ -298,9 +306,13 @@ export async function downloadVerifiedFile( } const dir = dirname(options.destPath); - mkdirSync(dir, { recursive: true, mode: dirMode }); - if (isPosix()) { - chmodSync(dir, dirMode); + const desiredDirMode = dirMode & 0o777; + const desiredFileMode = fileMode & 0o777; + mkdirSync(dir, { recursive: true, mode: desiredDirMode }); + if (options.permissions !== undefined) { + finalizeServerPath(dir, desiredDirMode, options.permissions); + } else if (isPosix() && (statSync(dir).mode & 0o777) !== desiredDirMode) { + chmodSync(dir, desiredDirMode); } const suffix = randomBytes(8).toString("hex"); @@ -359,10 +371,13 @@ export async function downloadVerifiedFile( } if (isPosix()) { - chmodSync(tmpPath, fileMode); + chmodSync(tmpPath, desiredFileMode); } renameSync(tmpPath, options.destPath); + if (options.permissions !== undefined) { + finalizeServerPath(options.destPath, desiredFileMode, options.permissions); + } return { bytes: totalBytes, hash: actualHex }; } catch (err) { if (fd !== undefined) { diff --git a/src/server/java.ts b/src/server/java.ts index 8cb99cf..d76788d 100644 --- a/src/server/java.ts +++ b/src/server/java.ts @@ -14,6 +14,7 @@ import { fetchJsonWithAllowlist, } from "./download"; import { + assertServerPathsUsable, type PermissionContext, SHARED_DIR_MODE, SHARED_TREE_PLAN, @@ -217,7 +218,12 @@ export async function ensureJavaRuntime( const dotRuntimeDir = join(resolve(options.serversDir), ".runtime"); const runtimeRoot = join(dotRuntimeDir, "java"); mkdirSync(runtimeRoot, { recursive: true, mode: RUNTIME_DIR_MODE }); - const permissions: PermissionContext = options.permissions ?? { gid: null, platform }; + const permissions: PermissionContext = { + gid: null, + platform, + serversRoot: options.serversDir, + ...options.permissions, + }; secureDirectory(dotRuntimeDir, SHARED_DIR_MODE, permissions); secureDirectory(runtimeRoot, SHARED_DIR_MODE, permissions); @@ -265,6 +271,7 @@ export async function ensureJavaRuntime( } renameSync(extractedRoot, javaDir); secureTree(javaDir, SHARED_TREE_PLAN, permissions); + assertServerPathsUsable([{ path: javaBin, executable: true }], permissions); return { major, javaDir, javaBin }; } finally { diff --git a/src/server/permissions.ts b/src/server/permissions.ts index d6f6101..1282ada 100644 --- a/src/server/permissions.ts +++ b/src/server/permissions.ts @@ -2,18 +2,24 @@ // Copyright (C) 2026 Antônio Miranda import { chmodSync, chownSync, existsSync, lstatSync, readdirSync, readFileSync } from "node:fs"; -import { join } from "node:path"; +import { basename, join, resolve } from "node:path"; +import { sanitizeErrorMessage } from "../agent/jobs"; +import type { Logger } from "../agent/logger"; /** Group that the Minecraft server processes run as. The agent is a member, not the owner. */ export const SERVER_GROUP_NAME = "tegrad-srv"; export const DEFAULT_GROUP_FILE = "/etc/group"; -/** Server data: the server user reads and writes it, and new files inherit the group (setgid). */ -export const SERVER_DIR_MODE = 0o2770; +/** + * Server data: the server user reads and writes it. + * Never include setgid/setuid bits here: tegrad.service runs with RestrictSUIDSGID=yes, + * which makes chmod with 0o2000/0o4000 fail with EPERM. + */ +export const SERVER_DIR_MODE = 0o770; export const SERVER_FILE_MODE = 0o660; export const SERVER_EXEC_MODE = 0o770; /** Shared runtimes (Java): the server user may read and execute, never write. */ -export const SHARED_DIR_MODE = 0o2750; +export const SHARED_DIR_MODE = 0o750; export const SHARED_FILE_MODE = 0o640; export const SHARED_EXEC_MODE = 0o750; @@ -35,10 +41,89 @@ export const SHARED_TREE_PLAN: TreePermissionPlan = { execMode: SHARED_EXEC_MODE, }; +export interface PermissionStatLike { + readonly mode: number; + readonly uid: number; + readonly gid: number; + isSymbolicLink(): boolean; + isDirectory(): boolean; + isFile(): boolean; +} + +export interface PermissionDirentLike { + readonly name: string; + isSymbolicLink(): boolean; + isDirectory(): boolean; + isFile(): boolean; +} + +export interface PermissionFsOps { + readonly lstatSync: (path: string) => PermissionStatLike; + readonly chownSync: (path: string, uid: number, gid: number) => void; + readonly chmodSync: (path: string, mode: number) => void; + readonly readdirSync: (path: string) => readonly PermissionDirentLike[]; + readonly existsSync: (path: string) => boolean; +} + +const DEFAULT_FS_OPS: PermissionFsOps = { + lstatSync: (p) => lstatSync(p), + chownSync: (p, uid, gid) => chownSync(p, uid, gid), + chmodSync: (p, mode) => chmodSync(p, mode), + readdirSync: (p) => readdirSync(p, { withFileTypes: true }), + existsSync: (p) => existsSync(p), +}; + +function resolveFsOps(overrides?: Partial): PermissionFsOps { + if (overrides === undefined) { + return DEFAULT_FS_OPS; + } + return { + lstatSync: overrides.lstatSync ?? DEFAULT_FS_OPS.lstatSync, + chownSync: overrides.chownSync ?? DEFAULT_FS_OPS.chownSync, + chmodSync: overrides.chmodSync ?? DEFAULT_FS_OPS.chmodSync, + readdirSync: overrides.readdirSync ?? DEFAULT_FS_OPS.readdirSync, + existsSync: overrides.existsSync ?? DEFAULT_FS_OPS.existsSync, + }; +} + function isPosix(platform: NodeJS.Platform = process.platform): boolean { return platform !== "win32"; } +function extractErrorCode(err: unknown): string { + if (typeof err === "object" && err !== null && "code" in err) { + const code = (err as { readonly code?: unknown }).code; + if (typeof code === "string" && code.length > 0) { + return code; + } + } + if (err instanceof Error && err.name.length > 0) { + return err.name; + } + return "UNKNOWN"; +} + +function extractErrno(err: unknown): number | undefined { + if (typeof err === "object" && err !== null && "errno" in err) { + const errno = (err as { readonly errno?: unknown }).errno; + if (typeof errno === "number" && Number.isInteger(errno)) { + return errno; + } + } + return undefined; +} + +function buildFailure(path: string, op: PermissionFailure["op"], err: unknown): PermissionFailure { + const errno = extractErrno(err); + return { + path, + op, + code: extractErrorCode(err), + ...(errno !== undefined ? { errno } : {}), + message: sanitizeErrorMessage(err), + }; +} + /** Looks a group up in /etc/group. Returns null when the file or the group is missing. */ export function resolveGroupId( name: string = SERVER_GROUP_NAME, @@ -60,57 +145,253 @@ export function resolveGroupId( return null; } +export interface PermissionFailure { + readonly path: string; + readonly op: "lstat" | "chown" | "chmod" | "readdir"; + readonly code: string; + readonly errno?: number; + readonly message: string; +} + export interface PermissionContext { /** Group to hand files to, or null to leave the group alone (development machines). */ readonly gid: number | null; readonly platform?: NodeJS.Platform; - /** Called when the group cannot be changed (e.g. the agent is not a member). */ + /** Absolute path to the servers root (/var/lib/tegrad-servers). Never chmod/chown this directory. */ + readonly serversRoot?: string; + /** Optional FS overrides for unit testing. */ + readonly fs?: Partial; + /** Called when a permission operation fails on a path. */ + readonly onError?: (failure: PermissionFailure) => void; + /** Legacy callback invoked when chown fails. */ readonly onChownError?: (path: string, err: unknown) => void; } -function setGroup(path: string, ctx: PermissionContext): void { - if (ctx.gid === null) { - return; +export interface CreateServerPermissionContextOptions { + readonly serversRoot?: string; + readonly serverGroupId?: number | null; + readonly platform?: NodeJS.Platform; + readonly logger?: Logger; + readonly fs?: Partial; +} + +/** Builds a standard PermissionContext that logs warnings with path and error code only. */ +export function createServerPermissionContext( + options: CreateServerPermissionContextOptions = {}, +): PermissionContext { + const gid = options.serverGroupId !== undefined ? options.serverGroupId : resolveGroupId(); + return { + gid, + ...(options.platform !== undefined ? { platform: options.platform } : {}), + ...(options.serversRoot !== undefined ? { serversRoot: options.serversRoot } : {}), + ...(options.fs !== undefined ? { fs: options.fs } : {}), + onError: (failure) => { + options.logger?.warn("Could not adjust server path permissions", { + path: failure.path, + op: failure.op, + code: failure.code, + ...(failure.errno !== undefined ? { errno: failure.errno } : {}), + message: failure.message, + }); + }, + }; +} + +function reportFailure(ctx: PermissionContext, failure: PermissionFailure, err: unknown): void { + ctx.onError?.(failure); + if (failure.op === "chown") { + ctx.onChownError?.(failure.path, err); + } +} + +function isServersRoot(targetPath: string, ctx: PermissionContext): boolean { + if (ctx.serversRoot === undefined) { + return false; } + return resolve(targetPath) === resolve(ctx.serversRoot); +} + +/** + * Single helper to finalize a path created or written by the agent: + * - Never touches the servers root directory itself (owned by the installer). + * - Never follows or modifies symbolic links. + * - Explicitly sets the server group via chown(stat.uid, gid) when the group differs + * (passing the real uid avoids EINVAL on Bun 1.3.12 where uid -1 is rejected). + * - Strips any SUID/SGID/sticky bits and only calls chmod when the lower 9 bits + * actually differ, avoiding EPERM under RestrictSUIDSGID=yes and preserving any + * inherited setgid bit when the mode already matches. + * - Never throws on chown/chmod/lstat errors; returns collected failures instead. + */ +export function finalizeServerPath( + targetPath: string, + mode: number, + ctx: PermissionContext, +): PermissionFailure[] { + if (!isPosix(ctx.platform)) { + return []; + } + if (isServersRoot(targetPath, ctx)) { + return []; + } + + const fsOps = resolveFsOps(ctx.fs); + const desiredMode = mode & 0o777; + const failures: PermissionFailure[] = []; + + let stat: PermissionStatLike; try { - chownSync(path, -1, ctx.gid); + stat = fsOps.lstatSync(targetPath); } catch (err) { - ctx.onChownError?.(path, err); + const failure = buildFailure(targetPath, "lstat", err); + reportFailure(ctx, failure, err); + return [failure]; } + + if (stat.isSymbolicLink()) { + return []; + } + + if (ctx.gid !== null && stat.gid !== ctx.gid) { + try { + fsOps.chownSync(targetPath, stat.uid, ctx.gid); + } catch (err) { + const failure = buildFailure(targetPath, "chown", err); + failures.push(failure); + reportFailure(ctx, failure, err); + } + } + + if ((stat.mode & 0o777) !== desiredMode) { + try { + fsOps.chmodSync(targetPath, desiredMode); + } catch (err) { + const failure = buildFailure(targetPath, "chmod", err); + failures.push(failure); + reportFailure(ctx, failure, err); + } + } + + return failures; } -/** Sets group and mode of one directory; the explicit chmod keeps the setgid bit. */ -export function secureDirectory(dirPath: string, mode: number, ctx: PermissionContext): void { +/** Finalizes group and mode of one directory via finalizeServerPath. */ +export function secureDirectory( + dirPath: string, + mode: number, + ctx: PermissionContext, +): PermissionFailure[] { + return finalizeServerPath(dirPath, mode, ctx); +} + +/** + * Walks a tree and applies the plan via finalizeServerPath: group, directory mode + * (without setgid) and file mode. A file that is already executable by its owner + * stays executable by the group (start.sh, the Java launcher). Symbolic links are + * never followed or changed. A failure on one path never aborts the rest of the walk. + */ +export function secureTree( + root: string, + plan: TreePermissionPlan, + ctx: PermissionContext, +): PermissionFailure[] { if (!isPosix(ctx.platform)) { - return; + return []; } - setGroup(dirPath, ctx); - chmodSync(dirPath, mode); + + const fsOps = resolveFsOps(ctx.fs); + const failures: PermissionFailure[] = []; + + function walk(dir: string): void { + failures.push(...finalizeServerPath(dir, plan.dirMode, ctx)); + + let entries: readonly PermissionDirentLike[]; + try { + entries = fsOps.readdirSync(dir); + } catch (err) { + const failure = buildFailure(dir, "readdir", err); + failures.push(failure); + reportFailure(ctx, failure, err); + return; + } + + for (const entry of entries) { + if (entry.isSymbolicLink()) { + continue; + } + const fullPath = join(dir, entry.name); + if (entry.isDirectory()) { + walk(fullPath); + } else if (entry.isFile()) { + let stat: PermissionStatLike; + try { + stat = fsOps.lstatSync(fullPath); + } catch (err) { + const failure = buildFailure(fullPath, "lstat", err); + failures.push(failure); + reportFailure(ctx, failure, err); + continue; + } + const executable = (stat.mode & 0o100) !== 0; + failures.push( + ...finalizeServerPath(fullPath, executable ? plan.execMode : plan.fileMode, ctx), + ); + } + } + } + + walk(root); + return failures; +} + +export interface EssentialPathCheck { + readonly path: string; + readonly executable?: boolean; } /** - * Walks a tree and applies the plan: group, directory mode (with setgid) and file - * mode. A file that is already executable by its owner stays executable by the - * group (start.sh, the Java launcher). Symbolic links are never followed or changed. + * Verifies that essential server paths (such as start.sh, server.jar, java) belong to + * the expected server group and have the required group access bits. Throws a clear + * error if any essential path cannot be used by the server user. */ -export function secureTree(root: string, plan: TreePermissionPlan, ctx: PermissionContext): void { - if (!isPosix(ctx.platform)) { +export function assertServerPathsUsable( + checks: readonly EssentialPathCheck[], + ctx: PermissionContext, +): void { + if (!isPosix(ctx.platform) || ctx.gid === null) { return; } - secureDirectory(root, plan.dirMode, ctx); - for (const entry of readdirSync(root, { withFileTypes: true })) { - const fullPath = join(root, entry.name); - if (entry.isSymbolicLink()) { + + const fsOps = resolveFsOps(ctx.fs); + const issues: string[] = []; + + for (const check of checks) { + let stat: PermissionStatLike; + try { + stat = fsOps.lstatSync(check.path); + } catch (err) { + issues.push(`${check.path} (unreadable: ${extractErrorCode(err)})`); + continue; + } + if (stat.gid !== ctx.gid) { + issues.push( + `${check.path} (group is ${stat.gid}, expected '${SERVER_GROUP_NAME}' gid ${ctx.gid})`, + ); continue; } - if (entry.isDirectory()) { - secureTree(fullPath, plan, ctx); - } else if (entry.isFile()) { - setGroup(fullPath, ctx); - const executable = (lstatSync(fullPath).mode & 0o100) !== 0; - chmodSync(fullPath, executable ? plan.execMode : plan.fileMode); + const mode = stat.mode & 0o777; + const needed = check.executable ? 0o050 : 0o040; + if ((mode & needed) !== needed) { + issues.push( + `${check.path} (mode ${mode.toString(8).padStart(3, "0")} lacks required group ${check.executable ? "read+exec" : "read"} permission)`, + ); } } + + if (issues.length > 0) { + throw new Error( + `Server files are not accessible to group '${SERVER_GROUP_NAME}': ${issues.join("; ")}`, + ); + } } export interface PermissionProblem { @@ -119,41 +400,94 @@ export interface PermissionProblem { } /** - * Read-only check of a tree against the plan, for `tegrad doctor`. Reports what is - * not owned by the expected group or whose mode is looser or tighter than needed. + * Read-only check of the servers root directory (/var/lib/tegrad-servers) for `tegrad doctor`. + * The root directory is owned by the installer and must carry the setgid bit so new + * subdirectories inherit the server group. + */ +export function inspectServersRoot( + serversDir: string, + gid: number | null, + fsOverrides?: Partial, +): PermissionProblem[] { + const fsOps = resolveFsOps(fsOverrides); + const problems: PermissionProblem[] = []; + if (!fsOps.existsSync(serversDir)) { + return problems; + } + + const stat = fsOps.lstatSync(serversDir); + const mode = stat.mode & 0o7777; + + if (gid !== null && stat.gid !== gid) { + problems.push({ path: serversDir, problem: `group is ${stat.gid}, expected ${gid}` }); + return problems; + } + if ((mode & 0o2000) === 0) { + problems.push({ path: serversDir, problem: "missing the setgid bit" }); + } + if ((mode & 0o070) !== 0o070) { + problems.push({ + path: serversDir, + problem: `group lacks rwx access (mode ${mode.toString(8)})`, + }); + } + if ((mode & 0o007) !== 0) { + problems.push({ path: serversDir, problem: "readable or writable by others" }); + } + return problems; +} + +/** + * Read-only check of a tree against the plan, for `tegrad doctor`. + * Does NOT require setgid on server subdirectories (only the root carries setgid). + * Checks: expected group, required group access bits from the plan (including group + * execute for start.sh, java, and owner-executable files), and no access for others. */ export function inspectTree( root: string, - _plan: TreePermissionPlan, + plan: TreePermissionPlan, gid: number | null, limit = 20, + fsOverrides?: Partial, ): PermissionProblem[] { + const fsOps = resolveFsOps(fsOverrides); const problems: PermissionProblem[] = []; - if (!existsSync(root)) { + if (!fsOps.existsSync(root)) { return problems; } + const requiredDirGroupBits = plan.dirMode & 0o070; + const requiredFileGroupBits = plan.fileMode & 0o070; + const requiredExecGroupBits = plan.execMode & 0o070; + function visit(path: string, isDir: boolean): void { if (problems.length >= limit) { return; } - const stat = lstatSync(path); + const stat = fsOps.lstatSync(path); const mode = stat.mode & 0o7777; if (gid !== null && stat.gid !== gid) { problems.push({ path, problem: `group is ${stat.gid}, expected ${gid}` }); return; } if (isDir) { - if ((mode & 0o2000) === 0) { - problems.push({ path, problem: "missing the setgid bit" }); - } - if ((mode & 0o050) !== 0o050) { - problems.push({ path, problem: `group cannot enter it (mode ${mode.toString(8)})` }); + if ((mode & requiredDirGroupBits) !== requiredDirGroupBits) { + problems.push({ + path, + problem: `group access missing (mode ${mode.toString(8)})`, + }); } } else { - const needed = (mode & 0o100) !== 0 ? 0o050 : 0o040; + const name = basename(path); + const needsExec = (mode & 0o100) !== 0 || name === "start.sh" || name === "java"; + const needed = needsExec ? requiredExecGroupBits : requiredFileGroupBits; if ((mode & needed) !== needed) { - problems.push({ path, problem: `group access missing (mode ${mode.toString(8)})` }); + problems.push({ + path, + problem: needsExec + ? `group execute/read access missing (mode ${mode.toString(8)})` + : `group access missing (mode ${mode.toString(8)})`, + }); } } if ((mode & 0o007) !== 0) { @@ -163,14 +497,14 @@ export function inspectTree( function walk(dir: string): void { visit(dir, true); - for (const entry of readdirSync(dir, { withFileTypes: true })) { + for (const entry of fsOps.readdirSync(dir)) { if (problems.length >= limit) { return; } - const full = join(dir, entry.name); if (entry.isSymbolicLink()) { continue; } + const full = join(dir, entry.name); if (entry.isDirectory()) { walk(full); } else if (entry.isFile()) { diff --git a/src/server/registry.ts b/src/server/registry.ts index 14ef7f2..8508407 100644 --- a/src/server/registry.ts +++ b/src/server/registry.ts @@ -17,15 +17,20 @@ import { serverPortSchema, } from "../protocol"; import { resolveServerDir, resolveServerSubpath } from "./id"; +import { + finalizeServerPath, + type PermissionContext, + SERVER_DIR_MODE, + SERVER_FILE_MODE, +} from "./permissions"; import { type ServerLaunchTarget, validateLaunchTarget } from "./start-script"; export const SERVER_METADATA_FILE = "tegrad-server.json"; export const EULA_FILE = "eula.txt"; export const SERVER_PROPERTIES_FILE = "server.properties"; -const SERVER_METADATA_MODE = 0o640; -const SERVER_DATA_FILE_MODE = 0o660; -const SERVER_DIR_MODE = 0o770; +const SERVER_METADATA_MODE = SERVER_FILE_MODE; +const SERVER_DATA_FILE_MODE = SERVER_FILE_MODE; export const serverLaunchTargetSchema = z .discriminatedUnion("kind", [ @@ -84,7 +89,11 @@ export function getEffectiveLaunchTarget(meta: ServerMetadata): ServerLaunchTarg ); } -export function writeServerMetadata(serversDir: string, metadata: ServerMetadata): void { +export function writeServerMetadata( + serversDir: string, + metadata: ServerMetadata, + permissions?: PermissionContext, +): void { const parsed = serverMetadataSchema.safeParse(metadata); if (!parsed.success) { throw new ProtocolError("invalid_body", "Invalid server metadata"); @@ -96,6 +105,9 @@ export function writeServerMetadata(serversDir: string, metadata: ServerMetadata mode: SERVER_METADATA_MODE, dirMode: SERVER_DIR_MODE, }); + if (permissions !== undefined) { + finalizeServerPath(metadataPath, SERVER_METADATA_MODE, permissions); + } } export function readServerMetadata(serversDir: string, id: string): ServerMetadata { @@ -151,13 +163,20 @@ export function listServerMetadata(serversDir: string): ServerMetadata[] { return result; } -export function writeEulaFile(serverDir: string, accepted: boolean): void { +export function writeEulaFile( + serverDir: string, + accepted: boolean, + permissions?: PermissionContext, +): void { const eulaPath = resolveServerSubpath(serverDir, EULA_FILE); const content = accepted ? "eula=true\n" : "eula=false\n"; writeFileAtomic(eulaPath, content, { mode: SERVER_DATA_FILE_MODE, dirMode: SERVER_DIR_MODE, }); + if (permissions !== undefined) { + finalizeServerPath(eulaPath, SERVER_DATA_FILE_MODE, permissions); + } } export function isEulaAccepted(serverDir: string): boolean { @@ -195,6 +214,7 @@ export function isEulaAccepted(serverDir: string): boolean { export interface UpdateServerPropertiesOptions { readonly port: number; readonly forceOnlineMode?: boolean; + readonly permissions?: PermissionContext; } export function writeServerProperties( @@ -275,4 +295,7 @@ export function writeServerProperties( mode: SERVER_DATA_FILE_MODE, dirMode: SERVER_DIR_MODE, }); + if (options.permissions !== undefined) { + finalizeServerPath(propsPath, SERVER_DATA_FILE_MODE, options.permissions); + } } diff --git a/src/server/runtime.ts b/src/server/runtime.ts index cf654fc..04b3938 100644 --- a/src/server/runtime.ts +++ b/src/server/runtime.ts @@ -37,8 +37,9 @@ import { readMeminfo, } from "./memory"; import { + assertServerPathsUsable, + createServerPermissionContext, type PermissionContext, - resolveGroupId, SERVER_DIR_MODE, SERVER_TREE_PLAN, secureDirectory, @@ -125,16 +126,12 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM const meminfoPath = options.meminfoPath ?? DEFAULT_MEMINFO_PATH; const now = options.now ?? (() => Date.now()); const platform = options.platform ?? process.platform; - const permissionContext: PermissionContext = { - gid: options.serverGroupId !== undefined ? options.serverGroupId : resolveGroupId(), + const permissionContext: PermissionContext = createServerPermissionContext({ + serversRoot: serversDir, platform, - onChownError: (path, err) => { - options.logger?.warn("Could not set the server group on a path", { - path, - errName: err instanceof Error ? err.name : "Error", - }); - }, - }; + ...(options.serverGroupId !== undefined ? { serverGroupId: options.serverGroupId } : {}), + ...(options.logger !== undefined ? { logger: options.logger } : {}), + }); const consoleManager = createConsoleSubscriptionManager({ serversDir, @@ -211,13 +208,18 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM ...(options.runFixedImpl !== undefined ? { runFixedImpl: options.runFixedImpl } : {}), }); - writeEulaFile(serverDir, parsedParams.data.eula_accepted); - writeServerProperties(serverDir, { port, forceOnlineMode: true }); - writeStartScript(serverDir, { + writeEulaFile(serverDir, parsedParams.data.eula_accepted, permissionContext); + writeServerProperties(serverDir, { + port, + forceOnlineMode: true, + permissions: permissionContext, + }); + const startScriptPath = writeStartScript(serverDir, { javaBin: javaRuntime.javaBin, memoryMb: parsedParams.data.memory_mb, jvmArgs, launchTarget: loaderResult.launchTarget, + permissions: permissionContext, }); const metadata: ServerMetadata = { @@ -233,9 +235,22 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM created_at: now(), launch_target: loaderResult.launchTarget, }; - writeServerMetadata(serversDir, metadata); + writeServerMetadata(serversDir, metadata, permissionContext); secureTree(serverDir, SERVER_TREE_PLAN, permissionContext); + const targetRelPath = + loaderResult.launchTarget.kind === "jar" + ? loaderResult.launchTarget.jar_relative_path + : loaderResult.launchTarget.args_file_relative_path; + assertServerPathsUsable( + [ + { path: startScriptPath, executable: true }, + { path: join(serverDir, targetRelPath), executable: false }, + { path: javaRuntime.javaBin, executable: true }, + ], + permissionContext, + ); + options.logger?.info("Created Minecraft server", { serverId: validId, loader: metadata.loader, @@ -396,21 +411,27 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM const javaMajor = selectJavaMajor(updated.minecraft_version); const javaBin = getJavaBinPath(serversDir, javaMajor, platform); - writeStartScript(serverDir, { + const startScriptPath = writeStartScript(serverDir, { javaBin, memoryMb: updated.memory_mb, jvmArgs: updated.jvm_args, launchTarget: getEffectiveLaunchTarget(updated), + permissions: permissionContext, }); - writeServerProperties(serverDir, { port: nextPort, forceOnlineMode: true }); + writeServerProperties(serverDir, { + port: nextPort, + forceOnlineMode: true, + permissions: permissionContext, + }); if (parsedParams.data.eula_accepted !== undefined) { - writeEulaFile(serverDir, parsedParams.data.eula_accepted); + writeEulaFile(serverDir, parsedParams.data.eula_accepted, permissionContext); } - writeServerMetadata(serversDir, updated); + writeServerMetadata(serversDir, updated, permissionContext); secureTree(serverDir, SERVER_TREE_PLAN, permissionContext); + assertServerPathsUsable([{ path: startScriptPath, executable: true }], permissionContext); return updated; } diff --git a/src/server/start-script.ts b/src/server/start-script.ts index 18251b6..1ef0c36 100644 --- a/src/server/start-script.ts +++ b/src/server/start-script.ts @@ -9,6 +9,12 @@ import { ProtocolError, } from "../protocol"; import { resolveServerSubpath } from "./id"; +import { + finalizeServerPath, + type PermissionContext, + SERVER_DIR_MODE, + SERVER_EXEC_MODE, +} from "./permissions"; export const MAX_JVM_ARG_LENGTH = 256; @@ -309,7 +315,10 @@ export function renderStartScript(params: RenderStartScriptParams): string { export function writeStartScript( serverDir: string, - params: Omit & { readonly scriptServerDir?: string }, + params: Omit & { + readonly scriptServerDir?: string; + readonly permissions?: PermissionContext; + }, ): string { const safeTarget = validateLaunchTarget(params.launchTarget); resolveServerSubpath( @@ -325,8 +334,11 @@ export function writeStartScript( }); const startScriptPath = resolveServerSubpath(serverDir, "start.sh"); writeFileAtomic(startScriptPath, script, { - mode: 0o750, - dirMode: 0o770, + mode: SERVER_EXEC_MODE, + dirMode: SERVER_DIR_MODE, }); + if (params.permissions !== undefined) { + finalizeServerPath(startScriptPath, SERVER_EXEC_MODE, params.permissions); + } return startScriptPath; } diff --git a/src/state/manager.ts b/src/state/manager.ts index 38c6537..657611e 100644 --- a/src/state/manager.ts +++ b/src/state/manager.ts @@ -45,8 +45,8 @@ import { import type { FetchLike } from "../server/download"; import { assertValidServerId, DEFAULT_SERVERS_DIR } from "../server/id"; import { + createServerPermissionContext, type PermissionContext, - resolveGroupId, SERVER_TREE_PLAN, secureTree, } from "../server/permissions"; @@ -370,15 +370,11 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana const maxModBytes = options.maxModBytes ?? DEFAULT_MAX_MOD_BYTES; const maxServerPackBytes = options.maxServerPackBytes ?? DEFAULT_MAX_SERVERPACK_BYTES; const maxWorldBytes = options.maxWorldBytes ?? DEFAULT_MAX_WORLD_BYTES; - const permissionContext: PermissionContext = { - gid: options.serverGroupId !== undefined ? options.serverGroupId : resolveGroupId(), - onChownError: (path, err) => { - options.logger?.warn("Could not set the server group on a path", { - path, - errName: err instanceof Error ? err.name : "Error", - }); - }, - }; + const permissionContext: PermissionContext = createServerPermissionContext({ + serversRoot: serversDir, + ...(options.serverGroupId !== undefined ? { serverGroupId: options.serverGroupId } : {}), + ...(options.logger !== undefined ? { logger: options.logger } : {}), + }); const planTtlMs = options.planTtlMs ?? DEFAULT_PLAN_TTL_MS; const maxStoredPlans = options.maxStoredPlans ?? DEFAULT_MAX_STORED_PLANS; const now = options.now ?? (() => Date.now()); @@ -447,7 +443,10 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana relPath: `${MODS_DIR}/${safeFile}`, allowRoot: false, }); - writeConfinedFileAtomic(targetResolved, downloaded.data, { createParents: true }); + writeConfinedFileAtomic(targetResolved, downloaded.data, { + createParents: true, + permissions: permissionContext, + }); const newEntry: ServerModEntry = { file: safeFile, @@ -465,7 +464,7 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana ...meta, mods: [...existingMods, newEntry].sort((a, b) => a.file.localeCompare(b.file)), }; - writeServerMetadata(serversDir, nextMeta); + writeServerMetadata(serversDir, nextMeta, permissionContext); options.logger?.info("Installed server mod", { serverId, file: safeFile, source }); @@ -521,7 +520,7 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana mods: nextMods, ...(nextOriginSync !== undefined ? { origin_sync: nextOriginSync } : {}), }; - writeServerMetadata(serversDir, nextMeta); + writeServerMetadata(serversDir, nextMeta, permissionContext); options.logger?.info("Removed server mod", { serverId, file: safeFile, trackedOriginRemoval }); @@ -547,7 +546,7 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana origin: null, mods: promotedMods, }; - writeServerMetadata(serversDir, nextMeta); + writeServerMetadata(serversDir, nextMeta, permissionContext); invalidatePlansForServer(validId); options.logger?.info("Unlinked server modpack origin", { serverId: validId }); @@ -572,7 +571,7 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana ...(params.loader !== undefined ? { loader: params.loader } : {}), ...(params.loader_version !== undefined ? { loader_version: params.loader_version } : {}), }; - writeServerMetadata(serversDir, nextMeta); + writeServerMetadata(serversDir, nextMeta, permissionContext); return nextMeta; } @@ -903,7 +902,10 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana relPath: `${MODS_DIR}/${downloaded.file}`, allowRoot: false, }); - writeConfinedFileAtomic(resolved, downloaded.data, { createParents: true }); + writeConfinedFileAtomic(resolved, downloaded.data, { + createParents: true, + permissions: permissionContext, + }); const entry: ServerModEntry = { file: downloaded.file, @@ -942,7 +944,10 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana relPath: change.path, allowRoot: false, }); - writeConfinedFileAtomic(resolved, fileData, { createParents: true }); + writeConfinedFileAtomic(resolved, fileData, { + createParents: true, + permissions: permissionContext, + }); filesWritten++; } } @@ -987,7 +992,7 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana mods: [...currentModsByFile.values()].sort((a, b) => a.file.localeCompare(b.file)), origin_sync: nextSync, }; - writeServerMetadata(serversDir, nextMeta); + writeServerMetadata(serversDir, nextMeta, permissionContext); options.logger?.info("Applied origin sync plan", { serverId, @@ -1047,6 +1052,7 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana serverId, buffer: packBytes, forbiddenPaths: PROTECTED_SERVERPACK_PATHS, + permissions: permissionContext, }); const nextOrigin: ServerOrigin = origin !== undefined ? origin : (meta.origin ?? null); @@ -1101,7 +1107,7 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana mods: [...modEntriesByFile.values()].sort((a, b) => a.file.localeCompare(b.file)), ...(nextSync !== undefined ? { origin_sync: nextSync } : {}), }; - writeServerMetadata(serversDir, nextMeta); + writeServerMetadata(serversDir, nextMeta, permissionContext); invalidatePlansForServer(serverId); options.logger?.info("Deployed server pack", { @@ -1165,6 +1171,7 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana serverId, buffer: archive, destPath: stagingName, + permissions: permissionContext, }); } catch (err) { if (err instanceof FileManagerError) { From 747aee4cfdfe4036d90353318e447f0b01042a2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Mon, 23 Nov 2026 14:22:47 -0300 Subject: [PATCH 27/59] fix: create the server console log as the agent so it stays readable; log the reason for rejected commands --- src/agent/jobs.ts | 1 + src/server/console-log.test.ts | 65 ++++++++++++++++++++++++++++++++++ src/server/console-log.ts | 61 +++++++++++++++++++++++++++++++ src/server/runtime.ts | 6 ++++ 4 files changed, 133 insertions(+) create mode 100644 src/server/console-log.test.ts create mode 100644 src/server/console-log.ts diff --git a/src/agent/jobs.ts b/src/agent/jobs.ts index 5a63720..47976c2 100644 --- a/src/agent/jobs.ts +++ b/src/agent/jobs.ts @@ -315,6 +315,7 @@ export function createCommandQueue(options: CommandQueueOptions): CommandQueue { commandId: opened.header.id, type: opened.header.type, code: err.code, + reason: err.message, }); sendFrame(makeAckError(opened.header.id, err.code)); return; diff --git a/src/server/console-log.test.ts b/src/server/console-log.test.ts new file mode 100644 index 0000000..45fa214 --- /dev/null +++ b/src/server/console-log.test.ts @@ -0,0 +1,65 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeEach, describe, expect, test } from "bun:test"; +import { + existsSync, + lstatSync, + mkdirSync, + mkdtempSync, + readdirSync, + readFileSync, + rmSync, + symlinkSync, + writeFileSync, +} from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { ensureConsoleLog } from "./console-log"; +import type { PermissionContext } from "./permissions"; + +const context: PermissionContext = { gid: null }; + +describe("ensureConsoleLog", () => { + let dir: string; + let logs: string; + + beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), "tegrad-console-")); + logs = join(dir, "logs"); + mkdirSync(logs); + }); + + afterEach(() => { + rmSync(dir, { recursive: true, force: true }); + }); + + test("creates the file when it is missing", () => { + ensureConsoleLog(dir, context); + expect(existsSync(join(logs, "console.log"))).toBe(true); + }); + + test("keeps an existing file and its content", () => { + writeFileSync(join(logs, "console.log"), "line\n"); + ensureConsoleLog(dir, context); + expect(readFileSync(join(logs, "console.log"), "utf8")).toBe("line\n"); + }); + + test("sets aside a file that belongs to another user and creates a fresh one", () => { + writeFileSync(join(logs, "console.log"), "old\n"); + const owner = lstatSync(join(logs, "console.log")).uid; + ensureConsoleLog(dir, context, { uid: owner + 1, now: () => 123 }); + expect(readFileSync(join(logs, "console.log"), "utf8")).toBe(""); + expect(readFileSync(join(logs, "console.123.log"), "utf8")).toBe("old\n"); + }); + + test.skipIf(process.platform === "win32")("replaces a planted symbolic link", () => { + const target = join(dir, "secret.txt"); + writeFileSync(target, "secret"); + symlinkSync(target, join(logs, "console.log")); + ensureConsoleLog(dir, context); + expect(lstatSync(join(logs, "console.log")).isSymbolicLink()).toBe(false); + expect(readFileSync(target, "utf8")).toBe("secret"); + expect(readdirSync(logs)).toEqual(["console.log"]); + }); +}); diff --git a/src/server/console-log.ts b/src/server/console-log.ts new file mode 100644 index 0000000..b62d981 --- /dev/null +++ b/src/server/console-log.ts @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { closeSync, lstatSync, openSync, renameSync, rmSync } from "node:fs"; +import { join } from "node:path"; +import { finalizeServerPath, type PermissionContext } from "./permissions"; + +export const CONSOLE_LOG_MODE = 0o660; + +export interface EnsureConsoleLogOptions { + /** Effective uid of the agent. Defaults to `process.getuid()` (absent on Windows). */ + readonly uid?: number | undefined; + readonly now?: () => number; +} + +/** + * The unit writes the server console to `logs/console.log` with `StandardOutput=append:`. + * systemd opens that file as root before dropping privileges, so when it does not exist yet + * it is created `root:root` and the agent can no longer read it (backups and the live + * console both read it). Creating the file up front, as the agent and with the server + * group, keeps it readable: systemd then only appends to the existing file. + */ +export function ensureConsoleLog( + serverDir: string, + permissions: PermissionContext, + options: EnsureConsoleLogOptions = {}, +): void { + const logPath = join(serverDir, "logs", "console.log"); + const uid = "uid" in options ? options.uid : currentUid(); + const now = options.now ?? Date.now; + + let stat: ReturnType | null; + try { + stat = lstatSync(logPath); + } catch { + stat = null; + } + + if (stat !== null && !stat.isFile()) { + // A link or anything else planted in the log folder is never followed. + rmSync(logPath, { force: true, recursive: false }); + stat = null; + } + + if (stat !== null && uid !== undefined && stat.uid !== uid) { + // Left over from a start that created it as root: keep it aside and replace it. + renameSync(logPath, join(serverDir, "logs", `console.${now()}.log`)); + stat = null; + } + + if (stat === null) { + const fd = openSync(logPath, "a", CONSOLE_LOG_MODE); + closeSync(fd); + } + + finalizeServerPath(logPath, CONSOLE_LOG_MODE, permissions); +} + +function currentUid(): number | undefined { + return typeof process.getuid === "function" ? process.getuid() : undefined; +} diff --git a/src/server/runtime.ts b/src/server/runtime.ts index 04b3938..8707e6e 100644 --- a/src/server/runtime.ts +++ b/src/server/runtime.ts @@ -25,6 +25,7 @@ import { type FifoWriter, sendConsoleLine, } from "./console"; +import { ensureConsoleLog } from "./console-log"; import type { FetchLike } from "./download"; import { assertValidServerId, DEFAULT_RUN_DIR, DEFAULT_SERVERS_DIR, resolveServerDir } from "./id"; import { ensureJavaRuntime, getJavaBinPath, type RunFixedLike, selectJavaMajor } from "./java"; @@ -185,6 +186,7 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM mkdirSync(logsDir, { recursive: true, mode: SERVER_DIR_MODE }); secureDirectory(serverDir, SERVER_DIR_MODE, permissionContext); secureDirectory(logsDir, SERVER_DIR_MODE, permissionContext); + ensureConsoleLog(serverDir, permissionContext); try { const javaRuntime = await ensureJavaRuntime({ @@ -278,6 +280,8 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM ); } + ensureConsoleLog(serverDir, permissionContext); + const currentStatus = await getUnitStatus(validId, options.runFixedImpl); if (isUnitActive(currentStatus)) { throw new ProtocolError("server_running", `Server is already running: ${validId}`); @@ -327,6 +331,8 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM ); } + ensureConsoleLog(serverDir, permissionContext); + const currentStatus = await getUnitStatus(validId, options.runFixedImpl); if (!isUnitStopped(currentStatus)) { await stopServer(validId); From 36cf1c3426760a4285c39564b957eb15a765b454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Mon, 23 Nov 2026 14:44:04 -0300 Subject: [PATCH 28/59] feat: add tegrad-perms@.service unit to make 0600 server files group-readable --- .github/workflows/ci.yml | 4 +- install/install.sh | 3 + install/polkit/50-tegrad.rules | 4 +- install/units/tegrad-perms@.service | 39 ++++++ lib/types/protocol/errors.d.ts | 2 +- src/backup/archive.ts | 9 ++ src/backup/backup.test.ts | 56 ++++++++ src/backup/manager.ts | 8 ++ src/cli/doctor.test.ts | 36 +++++ src/cli/doctor.ts | 56 ++++++++ src/files/adversarial.test.ts | 42 ++++-- src/files/confinement.ts | 34 ++++- src/files/errors.ts | 4 +- src/files/index.ts | 2 + src/files/manager.test.ts | 162 ++++++++++++++++++++--- src/files/manager.ts | 126 +++++++++++++----- src/files/transfers.ts | 34 ++++- src/files/zip.ts | 8 +- src/install/units.test.ts | 73 ++++++++++- src/protocol/errors.ts | 1 + src/server/id.ts | 5 + src/server/index.ts | 8 ++ src/server/readable.test.ts | 196 ++++++++++++++++++++++++++++ src/server/readable.ts | 168 ++++++++++++++++++++++++ 24 files changed, 996 insertions(+), 84 deletions(-) create mode 100644 install/units/tegrad-perms@.service create mode 100644 src/server/readable.test.ts create mode 100644 src/server/readable.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbd780f..e13d24c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: printf '#!/bin/sh\nexit 0\n' | sudo tee /opt/tegrad/bin/tegrad /var/lib/tegrad-servers/test/start.sh >/dev/null sudo chmod 0755 /opt/tegrad/bin/tegrad /var/lib/tegrad-servers/test/start.sh tmp_dir=$(mktemp -d) - for unit in tegrad.service tegrad-update.service tegrad-update.path tegrad-server@.service tegrad-server@.socket; do + for unit in tegrad.service tegrad-update.service tegrad-update.path tegrad-server@.service tegrad-server@.socket tegrad-perms@.service; do sed \ -e 's|@TEGRAD_BIN_DIR@|/opt/tegrad/bin|g' \ -e 's|@TEGRAD_BIN@|/opt/tegrad/bin/tegrad|g' \ @@ -50,4 +50,4 @@ jobs: -e 's|@TEGRAD_RUN_DIR@|/run/tegrad-server|g' \ "install/units/${unit}" > "${tmp_dir}/${unit}" done - sudo systemd-analyze verify "${tmp_dir}/tegrad.service" "${tmp_dir}/tegrad-update.service" "${tmp_dir}/tegrad-update.path" "${tmp_dir}/tegrad-server@test.service" "${tmp_dir}/tegrad-server@test.socket" + sudo systemd-analyze verify "${tmp_dir}/tegrad.service" "${tmp_dir}/tegrad-update.service" "${tmp_dir}/tegrad-update.path" "${tmp_dir}/tegrad-server@test.service" "${tmp_dir}/tegrad-server@test.socket" "${tmp_dir}/tegrad-perms@test.service" diff --git a/install/install.sh b/install/install.sh index 221dbcc..35e13cc 100755 --- a/install/install.sh +++ b/install/install.sh @@ -848,6 +848,7 @@ do_uninstall() { "${SYSTEMD_DIR}/tegrad-update.service" \ "${SYSTEMD_DIR}/tegrad-server@.service" \ "${SYSTEMD_DIR}/tegrad-server@.socket" \ + "${SYSTEMD_DIR}/tegrad-perms@.service" \ "${DROPIN_FILE}" \ "${POLKIT_RULE_FILE}" \ "${TMPFILES_FILE}" \ @@ -1006,6 +1007,7 @@ main() { "${SCRIPT_DIR}/units/tegrad-update.service" \ "${SCRIPT_DIR}/units/tegrad-server@.service" \ "${SCRIPT_DIR}/units/tegrad-server@.socket" \ + "${SCRIPT_DIR}/units/tegrad-perms@.service" \ "${SCRIPT_DIR}/tmpfiles/tegrad.conf" \ "${SCRIPT_DIR}/polkit/50-tegrad.rules"; do if [ ! -f "$_req_file" ]; then @@ -1051,6 +1053,7 @@ main() { render_template_file "${SCRIPT_DIR}/units/tegrad-update.service" "${SYSTEMD_DIR}/tegrad-update.service" 0644 render_template_file "${SCRIPT_DIR}/units/tegrad-server@.service" "${SYSTEMD_DIR}/tegrad-server@.service" 0644 render_template_file "${SCRIPT_DIR}/units/tegrad-server@.socket" "${SYSTEMD_DIR}/tegrad-server@.socket" 0644 + render_template_file "${SCRIPT_DIR}/units/tegrad-perms@.service" "${SYSTEMD_DIR}/tegrad-perms@.service" 0644 render_template_file "${SCRIPT_DIR}/tmpfiles/tegrad.conf" "${TMPFILES_FILE}" 0644 render_template_file "${SCRIPT_DIR}/polkit/50-tegrad.rules" "${POLKIT_RULE_FILE}" 0644 diff --git a/install/polkit/50-tegrad.rules b/install/polkit/50-tegrad.rules index 70e9548..9df6a67 100644 --- a/install/polkit/50-tegrad.rules +++ b/install/polkit/50-tegrad.rules @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -// Restrict tegrad to managing only Minecraft server template units. +// Restrict tegrad to managing only Minecraft server and permission-sync template units. // Granting org.freedesktop.systemd1.manage-units on arbitrary units // would allow manipulating privileged services and would be equivalent to root. polkit.addRule(function(action, subject) { @@ -12,7 +12,7 @@ polkit.addRule(function(action, subject) { var unit = action.lookup("unit"); if ( typeof unit === "string" && - /^tegrad-server@[a-z0-9][a-z0-9-]{0,62}\.(service|socket)$/.test(unit) + /^(tegrad-server@[a-z0-9][a-z0-9-]{0,62}\.(service|socket)|tegrad-perms@[a-z0-9][a-z0-9-]{0,62}\.service)$/.test(unit) ) { return polkit.Result.YES; } diff --git a/install/units/tegrad-perms@.service b/install/units/tegrad-perms@.service new file mode 100644 index 0000000..8b6d5f8 --- /dev/null +++ b/install/units/tegrad-perms@.service @@ -0,0 +1,39 @@ +# SPDX-License-Identifier: AGPL-3.0-only +# Copyright (C) 2026 Antônio Miranda + +[Unit] +Description=Make Tegra Minecraft Server files group-readable (%i) + +[Service] +Type=oneshot +User=tegrad-srv +Group=tegrad-srv +UMask=0007 +TimeoutStartSec=120 +ExecStart=/usr/bin/find -P @TEGRAD_SERVERS_DIR@/%i -xdev -user tegrad-srv -not -type l ( -type d -o -type f ) -exec /usr/bin/chmod g+rwX {} + + +# Sandbox: only traverses and adjusts group permissions on files owned by +# tegrad-srv inside this server's directory. No network, no capabilities, +# and symbolic links are never followed. +NoNewPrivileges=yes +ProtectSystem=strict +ReadWritePaths=@TEGRAD_SERVERS_DIR@/%i +ProtectHome=yes +PrivateTmp=yes +PrivateDevices=yes +ProtectKernelTunables=yes +ProtectKernelModules=yes +ProtectKernelLogs=yes +ProtectControlGroups=yes +ProtectProc=invisible +ProcSubset=pid +RestrictSUIDSGID=yes +RestrictNamespaces=yes +RestrictRealtime=yes +LockPersonality=yes +PrivateNetwork=yes +RestrictAddressFamilies=AF_UNIX +CapabilityBoundingSet= +SystemCallFilter=@system-service +SystemCallErrorNumber=EPERM +SystemCallArchitectures=native diff --git a/lib/types/protocol/errors.d.ts b/lib/types/protocol/errors.d.ts index 3f54b77..5348908 100644 --- a/lib/types/protocol/errors.d.ts +++ b/lib/types/protocol/errors.d.ts @@ -1,4 +1,4 @@ -export type ProtocolErrorCode = "invalid_format" | "unsupported_version" | "wrong_agent" | "wrong_recipient" | "expired" | "not_yet_valid" | "ttl_too_long" | "untrusted_signer" | "bad_signature" | "session_invalid" | "session_revoked" | "replayed" | "unknown_command" | "invalid_body" | "sensitive_requires_account_key" | "decrypt_failed" | "insufficient_role" | "too_many_subscribers" | "role_grant_invalid" | "auth_invalid" | "request_invalid" | "grant_invalid" | "grant_wrong_agent" | "grant_expired" | "grant_bad_signature" | "grant_proof_required" | "grant_bad_proof" | "revocation_stale" | "revocation_not_superset" | "insufficient_memory" | "eula_not_accepted" | "server_not_found" | "server_already_exists" | "server_running" | "server_stopped" | "invalid_jvm_args" | "download_failed" | "hash_mismatch" | "systemd_error" | "origin_locked" | "plan_not_found" | "plan_expired" | "plan_stale" | "mod_not_found" | "mod_already_exists" | "backup_not_found" | "backup_failed" | "backup_config_invalid" | "tunnel_not_configured" | "tunnel_already_running" | "tunnel_not_running" | "tunnel_failed"; +export type ProtocolErrorCode = "invalid_format" | "unsupported_version" | "wrong_agent" | "wrong_recipient" | "expired" | "not_yet_valid" | "ttl_too_long" | "untrusted_signer" | "bad_signature" | "session_invalid" | "session_revoked" | "replayed" | "unknown_command" | "invalid_body" | "sensitive_requires_account_key" | "decrypt_failed" | "insufficient_role" | "too_many_subscribers" | "role_grant_invalid" | "auth_invalid" | "request_invalid" | "grant_invalid" | "grant_wrong_agent" | "grant_expired" | "grant_bad_signature" | "grant_proof_required" | "grant_bad_proof" | "revocation_stale" | "revocation_not_superset" | "insufficient_memory" | "eula_not_accepted" | "server_not_found" | "server_already_exists" | "server_running" | "server_stopped" | "invalid_jvm_args" | "download_failed" | "hash_mismatch" | "systemd_error" | "perms_unavailable" | "origin_locked" | "plan_not_found" | "plan_expired" | "plan_stale" | "mod_not_found" | "mod_already_exists" | "backup_not_found" | "backup_failed" | "backup_config_invalid" | "tunnel_not_configured" | "tunnel_already_running" | "tunnel_not_running" | "tunnel_failed"; export declare class ProtocolError extends Error { readonly code: ProtocolErrorCode; constructor(code: ProtocolErrorCode, message: string); diff --git a/src/backup/archive.ts b/src/backup/archive.ts index 8b132d8..7f0ef4b 100644 --- a/src/backup/archive.ts +++ b/src/backup/archive.ts @@ -33,6 +33,7 @@ import { } from "../files"; import { ProtocolError } from "../protocol"; import type { PermissionContext } from "../server/permissions"; +import { type MakeServerReadableLike, makeServerReadable } from "../server/readable"; import type { ServerRuntimeProvider } from "./types"; export const DEFAULT_SAVE_TIMEOUT_MS = 30_000; @@ -305,6 +306,7 @@ export interface CreateConsistentArchiveOptions { readonly sleep?: (ms: number) => Promise; readonly logger?: Logger; readonly archiveImpl?: (options: ArchiveServerDirectoryOptions) => ServerArchiveResult; + readonly makeServerReadableImpl?: MakeServerReadableLike; } export async function createConsistentServerArchive( @@ -317,11 +319,15 @@ export async function createConsistentServerArchive( const now = options.now ?? (() => Date.now()); const sleep = options.sleep ?? ((ms: number) => new Promise((r) => setTimeout(r, ms))); const archiveFn = options.archiveImpl ?? archiveServerDirectory; + const makeReadable = options.makeServerReadableImpl ?? makeServerReadable; const isRunning = options.runtime !== undefined ? await options.runtime.isRunning(validId) : false; if (!isRunning || options.runtime === undefined) { + await makeReadable(validId, { + ...(options.logger !== undefined ? { logger: options.logger } : {}), + }); return archiveFn({ serversBaseDir, serverId: validId, @@ -351,6 +357,9 @@ export async function createConsistentServerArchive( now, sleep, }); + await makeReadable(validId, { + ...(options.logger !== undefined ? { logger: options.logger } : {}), + }); return archiveFn({ serversBaseDir, serverId: validId, diff --git a/src/backup/backup.test.ts b/src/backup/backup.test.ts index c25340b..7a91756 100644 --- a/src/backup/backup.test.ts +++ b/src/backup/backup.test.ts @@ -227,6 +227,62 @@ describe("Local backups, rotation, and independent destinations", () => { }); describe("World consistency (save-off / save-all flush / save-on)", () => { + test("calls makeServerReadable after save-all flush confirmation and before archiving", async () => { + const root = makeTempDir("tegrad-bkp-readable-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + const serverDir = createSampleServer(serversDir, "live-perms", { + "world/level.dat": "world-bytes", + "logs/console.log": "[12:00:00] [Server thread/INFO]: Done!\n", + }); + + const timeline: string[] = []; + const runtime: ServerRuntimeProvider = { + isRunning: async () => true, + sendConsole(_serverId, line) { + timeline.push(`console:${line}`); + if (line === "save-all flush") { + appendFileSync( + join(serverDir, "logs", "console.log"), + "[12:00:01] [Server thread/INFO]: Saved the game\n", + ); + } + }, + }; + + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + runtime, + makeServerReadableImpl: async (id) => { + timeline.push(`readable:${id}`); + return true; + }, + archiveImpl: (opts) => { + timeline.push(`archive:${opts.serverId}`); + return { + buffer: createZipBuffer([{ name: "world/level.dat", data: new Uint8Array([1, 2, 3]) }]), + sha256: "a".repeat(64), + entryCount: 1, + uncompressedBytes: 3, + }; + }, + }); + manager.setConfig({ server_id: "live-perms", local: { enabled: true } }); + + const res = await manager.createBackup({ server_id: "live-perms" }); + expect(res.destinations[0]?.ok).toBe(true); + expect(timeline).toEqual([ + "console:save-off", + "console:save-all flush", + "readable:live-perms", + "archive:live-perms", + "console:save-on", + ]); + }); + test("sends save-off, save-all flush, waits for confirmation, archives, and sends save-on when running", async () => { const root = makeTempDir("tegrad-bkp-running-"); const stateDir = join(root, "state"); diff --git a/src/backup/manager.ts b/src/backup/manager.ts index fc3bd2e..c0961eb 100644 --- a/src/backup/manager.ts +++ b/src/backup/manager.ts @@ -17,6 +17,7 @@ import { serverIdSchema, } from "../protocol"; import { createServerPermissionContext, type PermissionContext } from "../server/permissions"; +import type { MakeServerReadableLike } from "../server/readable"; import { type ArchiveServerDirectoryOptions, createConsistentServerArchive, @@ -107,6 +108,7 @@ export interface BackupManagerOptions { readonly logger?: Logger; readonly serverGroupId?: number | null; readonly archiveImpl?: (options: ArchiveServerDirectoryOptions) => ServerArchiveResult; + readonly makeServerReadableImpl?: MakeServerReadableLike; } export interface BackupManager { @@ -207,6 +209,9 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage ...(options.sleep !== undefined ? { sleep: options.sleep } : {}), ...(options.logger !== undefined ? { logger: options.logger } : {}), ...(options.archiveImpl !== undefined ? { archiveImpl: options.archiveImpl } : {}), + ...(options.makeServerReadableImpl !== undefined + ? { makeServerReadableImpl: options.makeServerReadableImpl } + : {}), }); const outcomes: BackupDestinationOutcome[] = []; @@ -455,6 +460,9 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage ...(options.sleep !== undefined ? { sleep: options.sleep } : {}), ...(options.logger !== undefined ? { logger: options.logger } : {}), ...(options.archiveImpl !== undefined ? { archiveImpl: options.archiveImpl } : {}), + ...(options.makeServerReadableImpl !== undefined + ? { makeServerReadableImpl: options.makeServerReadableImpl } + : {}), }); const meta = await localDest.upload(currentArchive.buffer, { serverId: validServerId, diff --git a/src/cli/doctor.test.ts b/src/cli/doctor.test.ts index dce70c2..9eeadd7 100644 --- a/src/cli/doctor.test.ts +++ b/src/cli/doctor.test.ts @@ -16,6 +16,18 @@ const VALID_GROUP = ["root:x:0:", "tegrad:x:991:", "tegrad-srv:x:992:tegrad"].jo const VALID_DROPIN = renderNetworkDropIn({ resolvers: ["127.0.0.53"] }); +const VALID_POLKIT_RULE = [ + "polkit.addRule(function(action, subject) {", + ' if (action.id === "org.freedesktop.systemd1.manage-units" && subject.user === "tegrad") {', + ' var unit = action.lookup("unit");', + ' if (typeof unit === "string" && /^(tegrad-server@[a-z0-9][a-z0-9-]{0,62}\\.(service|socket)|tegrad-perms@[a-z0-9][a-z0-9-]{0,62}\\.service)$/.test(unit)) {', + " return polkit.Result.YES;", + " }", + " }", + " return polkit.Result.NOT_HANDLED;", + "});", +].join("\n"); + function makeHealthyLinuxOptions(overrides: Partial = {}): { readonly options: DoctorOptions; readonly getOutput: () => string; @@ -32,6 +44,7 @@ function makeHealthyLinuxOptions(overrides: Partial = {}): { DEFAULT_DOCTOR_PATHS.updateServiceUnitPath, DEFAULT_DOCTOR_PATHS.serverServicePath, DEFAULT_DOCTOR_PATHS.serverSocketPath, + DEFAULT_DOCTOR_PATHS.permsServicePath, DEFAULT_DOCTOR_PATHS.tmpfilesPath, DEFAULT_DOCTOR_PATHS.polkitRulePath, DEFAULT_DOCTOR_PATHS.networkDropInPath, @@ -45,6 +58,7 @@ function makeHealthyLinuxOptions(overrides: Partial = {}): { const texts = new Map([ [DEFAULT_DOCTOR_PATHS.passwdPath, VALID_PASSWD], [DEFAULT_DOCTOR_PATHS.groupPath, VALID_GROUP], + [DEFAULT_DOCTOR_PATHS.polkitRulePath, VALID_POLKIT_RULE], [DEFAULT_DOCTOR_PATHS.networkDropInPath, VALID_DROPIN], ]); @@ -102,6 +116,8 @@ describe("tegrad doctor", () => { expect(getOutput()).toContain("OK user:"); expect(getOutput()).toContain("OK state_dir:"); expect(getOutput()).toContain("OK secret_permissions:"); + expect(getOutput()).toContain("OK unit_perms_service:"); + expect(getOutput()).toContain("OK polkit_perms_rule:"); expect(getOutput()).toContain("OK network_dropin:"); expect(getOutput()).toContain("OK group_isolation:"); expect(getOutput()).toContain("OK group_membership:"); @@ -162,6 +178,7 @@ describe("tegrad doctor", () => { readText: (p) => { if (p === DEFAULT_DOCTOR_PATHS.passwdPath) return VALID_PASSWD; if (p === DEFAULT_DOCTOR_PATHS.groupPath) return VALID_GROUP; + if (p === DEFAULT_DOCTOR_PATHS.polkitRulePath) return VALID_POLKIT_RULE; return "[Service]\nIPAddressDeny=10.0.0.0/8\n"; }, }); @@ -176,6 +193,7 @@ describe("tegrad doctor", () => { readText: (p) => { if (p === DEFAULT_DOCTOR_PATHS.passwdPath) return VALID_PASSWD; if (p === DEFAULT_DOCTOR_PATHS.groupPath) return badGroup; + if (p === DEFAULT_DOCTOR_PATHS.polkitRulePath) return VALID_POLKIT_RULE; return VALID_DROPIN; }, }); @@ -205,4 +223,22 @@ describe("tegrad doctor", () => { expect(getOutput()).toContain("FALHA unit_update_path:"); expect(getOutput()).toContain("FALHA unit_update_service:"); }); + + test("fails when tegrad-perms@.service is missing or polkit rule does not allow it", async () => { + const oldRule = + "polkit.addRule(function(a, s) { if (/^tegrad-server@[a-z0-9][a-z0-9-]{0,62}\\.(service|socket)$/.test(unit)) return polkit.Result.YES; });"; + const { options, getOutput } = makeHealthyLinuxOptions({ + exists: (p) => p !== DEFAULT_DOCTOR_PATHS.permsServicePath, + readText: (p) => { + if (p === DEFAULT_DOCTOR_PATHS.passwdPath) return VALID_PASSWD; + if (p === DEFAULT_DOCTOR_PATHS.groupPath) return VALID_GROUP; + if (p === DEFAULT_DOCTOR_PATHS.polkitRulePath) return oldRule; + return VALID_DROPIN; + }, + }); + const code = await runDoctor(options); + expect(code).toBe(1); + expect(getOutput()).toContain("FALHA unit_perms_service:"); + expect(getOutput()).toContain("FALHA polkit_perms_rule:"); + }); }); diff --git a/src/cli/doctor.ts b/src/cli/doctor.ts index 0ccd59f..63e6c1d 100644 --- a/src/cli/doctor.ts +++ b/src/cli/doctor.ts @@ -28,6 +28,7 @@ export interface DoctorPaths { readonly updateServiceUnitPath: string; readonly serverServicePath: string; readonly serverSocketPath: string; + readonly permsServicePath: string; readonly tmpfilesPath: string; readonly polkitRulePath: string; readonly networkDropInPath: string; @@ -41,6 +42,7 @@ export const DEFAULT_DOCTOR_PATHS: DoctorPaths = { updateServiceUnitPath: "/etc/systemd/system/tegrad-update.service", serverServicePath: "/etc/systemd/system/tegrad-server@.service", serverSocketPath: "/etc/systemd/system/tegrad-server@.socket", + permsServicePath: "/etc/systemd/system/tegrad-perms@.service", tmpfilesPath: "/etc/tmpfiles.d/tegrad.conf", polkitRulePath: "/etc/polkit-1/rules.d/50-tegrad.rules", networkDropInPath: "/etc/systemd/system/tegrad-server@.service.d/10-network.conf", @@ -141,6 +143,27 @@ function formatMode(mode: number): string { return (mode & 0o7777).toString(8).padStart(4, "0"); } +function polkitRuleAllowsPermsUnit(content: string): boolean { + const regexMatches = content.matchAll(/\/([^/\r\n]+)\/\.test\(/g); + for (const match of regexMatches) { + const pattern = match[1]; + if (pattern === undefined) continue; + try { + const re = new RegExp(pattern); + if ( + re.test("tegrad-perms@test.service") && + !re.test("tegrad-perms@test.socket") && + !re.test("sshd.service") + ) { + return true; + } + } catch { + // Ignore malformed regex literal + } + } + return false; +} + function extractIpAddressDenyTokens(content: string): Set { const tokens = new Set(); for (const rawLine of content.split(/\r?\n/)) { @@ -309,6 +332,7 @@ export async function runDoctor(options: DoctorOptions = {}): Promise { { label: "unit_update_service", path: paths.updateServiceUnitPath }, { label: "unit_server_service", path: paths.serverServicePath }, { label: "unit_server_socket", path: paths.serverSocketPath }, + { label: "unit_perms_service", path: paths.permsServicePath }, { label: "tmpfiles", path: paths.tmpfilesPath }, { label: "polkit_rule", path: paths.polkitRulePath }, ]; @@ -321,6 +345,38 @@ export async function runDoctor(options: DoctorOptions = {}): Promise { }); } + // 4b. Polkit rule permits tegrad-perms@.service + if (!exists(paths.polkitRulePath)) { + results.push({ + name: "polkit_perms_rule", + ok: false, + detail: `${paths.polkitRulePath} missing`, + }); + } else { + try { + const ruleContent = readText(paths.polkitRulePath); + if (polkitRuleAllowsPermsUnit(ruleContent)) { + results.push({ + name: "polkit_perms_rule", + ok: true, + detail: `${paths.polkitRulePath} allows tegrad-perms@.service`, + }); + } else { + results.push({ + name: "polkit_perms_rule", + ok: false, + detail: `${paths.polkitRulePath} does not allow tegrad-perms@.service`, + }); + } + } catch (err) { + results.push({ + name: "polkit_perms_rule", + ok: false, + detail: `failed to read ${paths.polkitRulePath}: ${err instanceof Error ? err.message : String(err)}`, + }); + } + } + // 5. Network drop-in exists and contains all expected IPAddressDeny ranges if (!exists(paths.networkDropInPath)) { results.push({ diff --git a/src/files/adversarial.test.ts b/src/files/adversarial.test.ts index 5797caa..d4bd4ed 100644 --- a/src/files/adversarial.test.ts +++ b/src/files/adversarial.test.ts @@ -51,6 +51,19 @@ function expectFileError(fn: () => unknown, code: FileErrorCode): void { } } +async function expectFileErrorAsync( + fn: () => Promise, + code: FileErrorCode, +): Promise { + try { + await fn(); + throw new Error(`Expected FileManagerError(${code}), but succeeded`); + } catch (err) { + expect(err).toBeInstanceOf(FileManagerError); + expect((err as FileManagerError).code).toBe(code); + } +} + function createDirLink(target: string, linkPath: string): void { if (process.platform === "win32") { symlinkSync(target, linkPath, "junction"); @@ -188,7 +201,7 @@ describe("adversarial file confinement and archive security", () => { rmSync(rootTmp, { recursive: true, force: true }); }); - test("upload staging directory cannot be listed, read, written, deleted, moved, zipped, or overwritten via FileManager", () => { + test("upload staging directory cannot be listed, read, written, deleted, moved, zipped, or overwritten via FileManager", async () => { const part0 = new TextEncoder().encode("authentic-part-0-"); const part1 = new TextEncoder().encode("authentic-part-1"); const full = new Uint8Array(part0.byteLength + part1.byteLength); @@ -224,7 +237,10 @@ describe("adversarial file confinement and archive security", () => { for (const target of forbiddenPaths) { expectFileError(() => manager.stat({ server_id: serverId, path: target }), "path_traversal"); - expectFileError(() => manager.read({ server_id: serverId, path: target }), "path_traversal"); + await expectFileErrorAsync( + () => manager.read({ server_id: serverId, path: target }), + "path_traversal", + ); expectFileError( () => manager.write({ server_id: serverId, path: target, content: "tampered!" }), "path_traversal", @@ -237,15 +253,15 @@ describe("adversarial file confinement and archive security", () => { () => manager.move({ server_id: serverId, from_path: target, to_path: "stolen.bin" }), "path_traversal", ); - expectFileError( + await expectFileErrorAsync( () => manager.copy({ server_id: serverId, from_path: target, to_path: "copied.bin" }), "path_traversal", ); - expectFileError( + await expectFileErrorAsync( () => manager.zip({ server_id: serverId, paths: [target], dest_path: "leak.zip" }), "path_traversal", ); - expectFileError( + await expectFileErrorAsync( () => manager.downloadBegin({ server_id: serverId, path: target }), "path_traversal", ); @@ -403,13 +419,13 @@ describe("adversarial file confinement and archive security", () => { } }); - test("rejects case-insensitive self-copy, self-move, and self-zip, and enforces copy limits atomically", () => { + test("rejects case-insensitive self-copy, self-move, and self-zip, and enforces copy limits atomically", async () => { manager.mkdir({ server_id: serverId, path: "World/region" }); manager.write({ server_id: serverId, path: "World/level.dat", content: "level" }); manager.write({ server_id: serverId, path: "World/region/a.mca", content: "region" }); if (process.platform === "win32" || process.platform === "darwin") { - expectFileError( + await expectFileErrorAsync( () => manager.copy({ server_id: serverId, from_path: "World", to_path: "world/backup" }), "invalid_path", ); @@ -436,7 +452,7 @@ describe("adversarial file confinement and archive security", () => { maxCopyBytes: 1000, }); try { - expectFileError( + await expectFileErrorAsync( () => limited.copy({ server_id: serverId, from_path: "World", to_path: "WorldCopy" }), "copy_limit_exceeded", ); @@ -446,7 +462,7 @@ describe("adversarial file confinement and archive security", () => { } }); - test("copy streams files larger than 2 MiB via chunked upload without hitting OOM", () => { + test("copy streams files larger than 2 MiB via chunked upload without hitting OOM", async () => { // 2.5 MiB binary pattern > MAX_READ_WRITE_BYTES (2 MiB) and > 64 KiB scratch buffer const totalSize = 2560 * 1024; const payload = new Uint8Array(totalSize); @@ -474,7 +490,7 @@ describe("adversarial file confinement and archive security", () => { } manager.uploadCommit({ server_id: serverId, upload_id: began.upload_id }); - const copied = manager.copy({ + const copied = await manager.copy({ server_id: serverId, from_path: "big.bin", to_path: "big-copy.bin", @@ -714,10 +730,10 @@ describe("adversarial file confinement and archive security", () => { expect(readFileSync(join(serverDir, "empty.txt"), "utf8")).toBe(""); }); - test("does not leak file descriptors across read/write/download/upload error paths", () => { + test("does not leak file descriptors across read/write/download/upload error paths", async () => { // 1. Oversized file read fails and releases fd immediately (file can be deleted on Windows). writeFileSync(join(serverDir, "huge.bin"), Buffer.alloc(MAX_READ_WRITE_BYTES + 1, 0x41)); - expectFileError( + await expectFileErrorAsync( () => manager.read({ server_id: serverId, path: "huge.bin" }), "file_too_large", ); @@ -737,7 +753,7 @@ describe("adversarial file confinement and archive security", () => { // 3. Download session errors release fd on close. manager.write({ server_id: serverId, path: "dl.txt", content: "download-me" }); - const dl = manager.downloadBegin({ server_id: serverId, path: "dl.txt", part_size: 4 }); + const dl = await manager.downloadBegin({ server_id: serverId, path: "dl.txt", part_size: 4 }); expectFileError( () => manager.downloadPart({ diff --git a/src/files/confinement.ts b/src/files/confinement.ts index 9820ab7..30c8273 100644 --- a/src/files/confinement.ts +++ b/src/files/confinement.ts @@ -81,6 +81,16 @@ export function isErrnoCode(err: unknown, code: string): boolean { ); } +export function isEaccesError(err: unknown): boolean { + if (isErrnoCode(err, "EACCES")) { + return true; + } + if (err instanceof FileManagerError && isErrnoCode(err.cause, "EACCES")) { + return true; + } + return false; +} + export function wrapIoError(err: unknown, context: string): FileManagerError { if (err instanceof FileManagerError) { return err; @@ -101,7 +111,7 @@ export function wrapIoError(err: unknown, context: string): FileManagerError { return new FileManagerError("is_a_directory", `${context}: path is a directory`); } const message = err instanceof Error ? err.message : String(err); - return new FileManagerError("io_error", `${context}: ${message}`); + return new FileManagerError("io_error", `${context}: ${message}`, { cause: err }); } function hasUnsafeChars(value: string): boolean { @@ -517,6 +527,28 @@ export function openConfinedFileForRead(resolved: ConfinedPath): { } } +export async function openConfinedFileForReadWithRetry( + resolved: ConfinedPath, + options: { + readonly onEacces?: () => Promise; + readonly openImpl?: typeof openConfinedFileForRead; + } = {}, +): Promise<{ + readonly fd: number; + readonly stats: Stats; +}> { + const openFn = options.openImpl ?? openConfinedFileForRead; + try { + return openFn(resolved); + } catch (err) { + if (options.onEacces === undefined || !isEaccesError(err)) { + throw err; + } + await options.onEacces(); + return openFn(resolved); + } +} + export function mkdirConfined(options: { readonly serversBaseDir?: string; readonly serverId: string; diff --git a/src/files/errors.ts b/src/files/errors.ts index f6a7801..ebb3b3b 100644 --- a/src/files/errors.ts +++ b/src/files/errors.ts @@ -39,8 +39,8 @@ export type FileErrorCode = export class FileManagerError extends Error { readonly code: FileErrorCode; - constructor(code: FileErrorCode, message: string) { - super(message); + constructor(code: FileErrorCode, message: string, options?: { readonly cause?: unknown }) { + super(message, options); this.name = "FileManagerError"; this.code = code; } diff --git a/src/files/index.ts b/src/files/index.ts index 6144a3b..f322cb7 100644 --- a/src/files/index.ts +++ b/src/files/index.ts @@ -9,11 +9,13 @@ export { type ConfinedPath, DEFAULT_SERVERS_BASE_DIR, ensureConfinedInternalDir, + isEaccesError, isSameOrSubpath, MAX_COMPONENT_BYTES, MAX_PATH_BYTES, mkdirConfined, openConfinedFileForRead, + openConfinedFileForReadWithRetry, parseAndValidateRelativePath, type ResolveConfinedPathOptions, RUNTIME_DIR_NAME, diff --git a/src/files/manager.test.ts b/src/files/manager.test.ts index a9ef1ff..e8ec09e 100644 --- a/src/files/manager.test.ts +++ b/src/files/manager.test.ts @@ -33,6 +33,7 @@ import { signSessionCertificate, type TransportFrame, } from "../protocol"; +import { openConfinedFileForRead, wrapIoError } from "./confinement"; import { type FileErrorCode, FileManagerError } from "./errors"; import { FileManager, MAX_READ_WRITE_BYTES, registerFileCommandHandlers } from "./manager"; import { sha256Hex } from "./transfers"; @@ -47,6 +48,19 @@ function expectFileError(fn: () => unknown, code: FileErrorCode): void { } } +async function expectFileErrorAsync( + fn: () => Promise, + code: FileErrorCode, +): Promise { + try { + await fn(); + throw new Error(`Expected FileManagerError(${code}), but succeeded`); + } catch (err) { + expect(err).toBeInstanceOf(FileManagerError); + expect((err as FileManagerError).code).toBe(code); + } +} + function createDirLink(target: string, linkPath: string): void { if (process.platform === "win32") { symlinkSync(target, linkPath, "junction"); @@ -116,7 +130,7 @@ describe("FileManager", () => { rmSync(rootTmp, { recursive: true, force: true }); }); - test("supports full CRUD, mkdir, rename, move, copy, delete, list, and stat", () => { + test("supports full CRUD, mkdir, rename, move, copy, delete, list, and stat", async () => { manager.mkdir({ server_id: serverId, path: "config/nested" }); manager.write({ server_id: serverId, @@ -124,11 +138,11 @@ describe("FileManager", () => { content: "difficulty: hard\n", }); - const readUtf8 = manager.read({ server_id: serverId, path: "config/nested/app.yml" }); + const readUtf8 = await manager.read({ server_id: serverId, path: "config/nested/app.yml" }); expect(readUtf8.content).toBe("difficulty: hard\n"); expect(readUtf8.size).toBe(17); - const readB64 = manager.read({ + const readB64 = await manager.read({ server_id: serverId, path: "config/nested/app.yml", encoding: "base64", @@ -153,7 +167,7 @@ describe("FileManager", () => { to_path: "config/nested/settings.yml", }); - const copied = manager.copy({ + const copied = await manager.copy({ server_id: serverId, from_path: "config", to_path: "config-backup", @@ -166,7 +180,7 @@ describe("FileManager", () => { from_path: "config-backup/nested/settings.yml", to_path: "moved.yml", }); - expect(manager.read({ server_id: serverId, path: "moved.yml" }).content).toBe( + expect((await manager.read({ server_id: serverId, path: "moved.yml" })).content).toBe( "difficulty: hard\n", ); @@ -187,7 +201,7 @@ describe("FileManager", () => { expect(manager.stat({ server_id: serverId, path: "config" }).exists).toBe(false); }); - test("enforces strict 2 MiB ceiling on read and write", () => { + test("enforces strict 2 MiB ceiling on read and write", async () => { const exactLimit = "A".repeat(MAX_READ_WRITE_BYTES); const overLimit = "A".repeat(MAX_READ_WRITE_BYTES + 1); @@ -199,7 +213,7 @@ describe("FileManager", () => { expect(wrote.size).toBe(MAX_READ_WRITE_BYTES); expect(readdirSync(serverDir).filter((n) => n.startsWith(".tmp-"))).toEqual([]); - const readBack = manager.read({ server_id: serverId, path: "exact-2mib.txt" }); + const readBack = await manager.read({ server_id: serverId, path: "exact-2mib.txt" }); expect(readBack.size).toBe(MAX_READ_WRITE_BYTES); // 2 MiB + 1 byte fails on write (utf8 and base64) @@ -220,7 +234,7 @@ describe("FileManager", () => { // Pre-existing file of 2 MiB + 1 byte fails on read writeFileSync(join(serverDir, "large-on-disk.bin"), Buffer.alloc(MAX_READ_WRITE_BYTES + 1)); - expectFileError( + await expectFileErrorAsync( () => manager.read({ server_id: serverId, path: "large-on-disk.bin" }), "file_too_large", ); @@ -244,7 +258,7 @@ describe("FileManager", () => { expect(existsSync(serverDir)).toBe(true); }); - test("refuses symlinks/junctions across all operations and hides them in list", () => { + test("refuses symlinks/junctions across all operations and hides them in list", async () => { createDirLink(outsideDir, join(serverDir, "escape-dir")); mkdirSync(join(serverDir, "normal")); createDirLink(outsideDir, join(serverDir, "normal", "nested-link")); @@ -259,7 +273,7 @@ describe("FileManager", () => { () => manager.stat({ server_id: serverId, path: "escape-dir" }), "symlink_forbidden", ); - expectFileError( + await expectFileErrorAsync( () => manager.read({ server_id: serverId, path: "escape-dir/host-secret.txt" }), "symlink_forbidden", ); @@ -280,7 +294,7 @@ describe("FileManager", () => { () => manager.delete({ server_id: serverId, path: "normal", recursive: true }), "symlink_forbidden", ); - expectFileError( + await expectFileErrorAsync( () => manager.copy({ server_id: serverId, @@ -302,7 +316,7 @@ describe("FileManager", () => { () => manager.mkdir({ server_id: serverId, path: "escape-dir/sub" }), "symlink_forbidden", ); - expectFileError( + await expectFileErrorAsync( () => manager.zip({ server_id: serverId, @@ -315,7 +329,7 @@ describe("FileManager", () => { // Also test file symlink if OS permits creating one const fileSymPath = join(serverDir, "secret-file-link.txt"); if (tryCreateFileSymlink(join(outsideDir, "host-secret.txt"), fileSymPath)) { - expectFileError( + await expectFileErrorAsync( () => manager.read({ server_id: serverId, path: "secret-file-link.txt" }), "symlink_forbidden", ); @@ -342,7 +356,7 @@ describe("FileManager", () => { expect(readFileSync(join(outsideDir, "host-secret.txt"), "utf8")).toBe("do-not-leak"); }); - test("copy enforces file count and byte limits and prevents self-nesting", () => { + test("copy enforces file count and byte limits and prevents self-nesting", async () => { const limited = new FileManager({ serversBaseDir: serversDir, maxCopyFiles: 2, @@ -352,11 +366,11 @@ describe("FileManager", () => { limited.write({ server_id: serverId, path: "src/a.txt", content: "a".repeat(60) }); limited.write({ server_id: serverId, path: "src/b.txt", content: "b".repeat(60) }); - expectFileError( + await expectFileErrorAsync( () => limited.copy({ server_id: serverId, from_path: "src", to_path: "src/sub" }), "invalid_path", ); - expectFileError( + await expectFileErrorAsync( () => limited.copy({ server_id: serverId, from_path: "src", to_path: "dst" }), "copy_limit_exceeded", ); @@ -515,11 +529,11 @@ describe("FileManager", () => { expect(readdirSync(serverDir).filter((n) => n.startsWith(".tmp-"))).toEqual([]); }); - test("chunked download and ranged download reconstruct file with SHA-256", () => { + test("chunked download and ranged download reconstruct file with SHA-256", async () => { const content = new TextEncoder().encode("0123456789abcdefghijKLMNO"); writeFileSync(join(serverDir, "world.bin"), content); - const began = manager.downloadBegin({ + const began = await manager.downloadBegin({ server_id: serverId, path: "world.bin", part_size: 10, @@ -543,7 +557,7 @@ describe("FileManager", () => { expect(new Uint8Array(Buffer.concat(chunks))).toEqual(content); // Direct ranged download - const range = manager.download({ + const range = await manager.download({ server_id: serverId, path: "world.bin", offset: 10, @@ -552,6 +566,116 @@ describe("FileManager", () => { expect(Buffer.from(range.data_base64, "base64").toString("utf8")).toBe("abcdefghij"); expect(range.eof).toBe(false); }); + + test("retries once via makeServerReadable on EACCES across read, download, copy, zip, and unzip", async () => { + mkdirSync(join(serverDir, "world"), { recursive: true }); + writeFileSync(join(serverDir, "world", "level.dat"), "nbt-payload"); + + const makeEacces = () => { + const err = new Error("EACCES: permission denied") as NodeJS.ErrnoException; + err.code = "EACCES"; + return wrapIoError(err, "Failed to open target file"); + }; + + const runScenario = async ( + op: (fm: FileManager) => Promise, + persistFailure: boolean, + ): Promise => { + const readableCalls: string[] = []; + let readableFixed = false; + const fm = new FileManager({ + serversBaseDir: serversDir, + makeServerReadableImpl: async (id) => { + readableCalls.push(id); + if (!persistFailure) { + readableFixed = true; + } + return true; + }, + openForReadImpl: (resolved) => { + if (!readableFixed) { + throw makeEacces(); + } + return openConfinedFileForRead(resolved); + }, + }); + try { + await op(fm); + } finally { + fm.dispose(); + } + return readableCalls; + }; + + // 1. files.read succeeds on single retry + const readCalls = await runScenario(async (fm) => { + const res = await fm.read({ server_id: serverId, path: "world/level.dat" }); + expect(res.content).toBe("nbt-payload"); + }, false); + expect(readCalls).toEqual([serverId]); + + // 2. files.download (ranged) succeeds on single retry + const dlRangeCalls = await runScenario(async (fm) => { + const res = await fm.download({ + server_id: serverId, + path: "world/level.dat", + offset: 0, + length: 11, + }); + expect(Buffer.from(res.data_base64, "base64").toString("utf8")).toBe("nbt-payload"); + }, false); + expect(dlRangeCalls).toEqual([serverId]); + + // 3. files.download.begin succeeds on single retry + const dlBeginCalls = await runScenario(async (fm) => { + const began = await fm.downloadBegin({ server_id: serverId, path: "world/level.dat" }); + expect(began.total_size).toBe(11); + fm.downloadClose({ server_id: serverId, download_id: began.download_id }); + }, false); + expect(dlBeginCalls).toEqual([serverId]); + + // 4. files.copy succeeds on single retry + const copyCalls = await runScenario(async (fm) => { + const res = await fm.copy({ + server_id: serverId, + from_path: "world/level.dat", + to_path: "world/level-copy.dat", + }); + expect(res.files_copied).toBe(1); + }, false); + expect(copyCalls).toEqual([serverId]); + + // 5. files.zip succeeds on single retry + const zipCalls = await runScenario(async (fm) => { + const res = await fm.zip({ + server_id: serverId, + paths: ["world/level.dat"], + dest_path: "world.zip", + }); + expect(res.entryCount).toBe(1); + }, false); + expect(zipCalls).toEqual([serverId]); + + // 6. files.unzip succeeds on single retry + const unzipCalls = await runScenario(async (fm) => { + const res = await fm.unzip({ + server_id: serverId, + zip_path: "world.zip", + dest_path: "extracted", + }); + expect(res.entryCount).toBe(1); + }, false); + expect(unzipCalls).toEqual([serverId]); + + // 7. Persistent EACCES calls makeServerReadable only once and returns the original io_error + const persistentCalls = await runScenario(async (fm) => { + await expectFileErrorAsync( + () => fm.read({ server_id: serverId, path: "world/level.dat" }), + "io_error", + ); + }, true); + expect(persistentCalls).toEqual([serverId]); + }); }); describe("protocol integration (CommandRegistry, openCommand, CommandQueue)", () => { diff --git a/src/files/manager.ts b/src/files/manager.ts index 1e314f4..0906083 100644 --- a/src/files/manager.ts +++ b/src/files/manager.ts @@ -16,13 +16,16 @@ import { dirname, join } from "node:path"; import type { CommandQueue } from "../agent/jobs"; import type { Logger } from "../agent/logger"; import { createServerPermissionContext, type PermissionContext } from "../server/permissions"; +import { type MakeServerReadableLike, makeServerReadable } from "../server/readable"; import { assertNoSymlinkPath, DEFAULT_SERVERS_BASE_DIR, + isEaccesError, isErrnoCode, isSameOrSubpath, mkdirConfined, - openConfinedFileForRead, + type openConfinedFileForRead, + openConfinedFileForReadWithRetry, RUNTIME_DIR_NAME, resolveConfinedPath, UPLOAD_STAGING_DIR_NAME, @@ -114,6 +117,8 @@ export interface FileManagerOptions { readonly serverGroupId?: number | null; readonly logger?: Logger; readonly permissions?: PermissionContext; + readonly makeServerReadableImpl?: MakeServerReadableLike; + readonly openForReadImpl?: typeof openConfinedFileForRead; } function validateFileEncoding(encoding: unknown): FileEncoding { @@ -280,6 +285,9 @@ export class FileManager { readonly #maxCopyFiles: number; readonly #maxCopyBytes: number; readonly #permissions: PermissionContext; + readonly #logger: Logger | undefined; + readonly #makeServerReadable: MakeServerReadableLike; + readonly #openForReadImpl: typeof openConfinedFileForRead | undefined; readonly #transfers: TransferManager; readonly #zipOptions: { readonly maxEntries?: number; @@ -294,6 +302,9 @@ export class FileManager { this.#maxReadWriteBytes = options.maxReadWriteBytes ?? MAX_READ_WRITE_BYTES; this.#maxCopyFiles = options.maxCopyFiles ?? DEFAULT_MAX_COPY_FILES; this.#maxCopyBytes = options.maxCopyBytes ?? DEFAULT_MAX_COPY_BYTES; + this.#logger = options.logger; + this.#makeServerReadable = options.makeServerReadableImpl ?? makeServerReadable; + this.#openForReadImpl = options.openForReadImpl; this.#permissions = options.permissions ?? createServerPermissionContext({ @@ -304,6 +315,9 @@ export class FileManager { this.#transfers = new TransferManager({ serversBaseDir: this.#serversBaseDir, permissions: this.#permissions, + makeServerReadableImpl: this.#makeServerReadable, + ...(this.#logger !== undefined ? { logger: this.#logger } : {}), + ...(this.#openForReadImpl !== undefined ? { openForReadImpl: this.#openForReadImpl } : {}), ...(options.maxUploadBytes !== undefined ? { maxUploadBytes: options.maxUploadBytes } : {}), ...(options.maxPartBytes !== undefined ? { maxPartBytes: options.maxPartBytes } : {}), ...(options.maxConcurrentUploads !== undefined @@ -442,11 +456,17 @@ export class FileManager { throw new FileManagerError("not_a_file", "Unsupported filesystem entry type"); } - read(params: { + async #ensureReadable(serverId: string): Promise { + await this.#makeServerReadable(serverId, { + ...(this.#logger !== undefined ? { logger: this.#logger } : {}), + }); + } + + async read(params: { readonly server_id: string; readonly path: string; readonly encoding?: FileEncoding | undefined; - }): FileReadResult { + }): Promise { const encoding = validateFileEncoding(params.encoding); const resolved = resolveConfinedPath({ serversBaseDir: this.#serversBaseDir, @@ -455,7 +475,10 @@ export class FileManager { allowRoot: false, }); - const { fd, stats } = openConfinedFileForRead(resolved); + const { fd, stats } = await openConfinedFileForReadWithRetry(resolved, { + onEacces: () => this.#ensureReadable(resolved.serverId), + ...(this.#openForReadImpl !== undefined ? { openImpl: this.#openForReadImpl } : {}), + }); let data: Uint8Array; try { if (stats.size > this.#maxReadWriteBytes) { @@ -635,11 +658,11 @@ export class FileManager { }; } - copy(params: { + async copy(params: { readonly server_id: string; readonly from_path: string; readonly to_path: string; - }): FileCopyResult { + }): Promise { const fromResolved = resolveConfinedPath({ serversBaseDir: this.#serversBaseDir, serverId: params.server_id, @@ -744,8 +767,9 @@ export class FileManager { let filesCopied = 0; let bytesCopied = 0; + let retriedReadable = false; - const copyRecursive = (srcRel: string, dstRel: string): void => { + const copyRecursive = async (srcRel: string, dstRel: string): Promise => { const srcConfined = resolveConfinedPath({ serversBaseDir: this.#serversBaseDir, serverId: params.server_id, @@ -799,7 +823,7 @@ export class FileManager { if (isInternalEntryName(child)) { continue; } - copyRecursive( + await copyRecursive( `${srcConfined.relativePath}/${child}`, `${dstConfined.relativePath}/${child}`, ); @@ -818,7 +842,17 @@ export class FileManager { ); } - const { fd, stats: fdStats } = openConfinedFileForRead(srcConfined); + const { fd, stats: fdStats } = await openConfinedFileForReadWithRetry(srcConfined, { + ...(!retriedReadable + ? { + onEacces: async () => { + retriedReadable = true; + await this.#ensureReadable(srcConfined.serverId); + }, + } + : {}), + ...(this.#openForReadImpl !== undefined ? { openImpl: this.#openForReadImpl } : {}), + }); let fileBytes = 0; try { if (bytesCopied + fdStats.size > this.#maxCopyBytes) { @@ -842,7 +876,7 @@ export class FileManager { bytesCopied += fileBytes; }; - copyRecursive(fromResolved.relativePath, toResolved.relativePath); + await copyRecursive(fromResolved.relativePath, toResolved.relativePath); return { from_path: fromResolved.relativePath, to_path: toResolved.relativePath, @@ -928,8 +962,8 @@ export class FileManager { return this.#transfers.abortUpload(params); } - downloadBegin(params: DownloadBeginParams): DownloadBeginResult { - return this.#transfers.beginDownload(params); + async downloadBegin(params: DownloadBeginParams): Promise { + return await this.#transfers.beginDownload(params); } downloadPart(params: DownloadPartParams): DownloadPartResult { @@ -943,37 +977,59 @@ export class FileManager { return this.#transfers.closeDownload(params); } - download(params: DownloadRangeParams): DownloadRangeResult { - return this.#transfers.downloadRange(params); + async download(params: DownloadRangeParams): Promise { + return await this.#transfers.downloadRange(params); } - zip(params: { + async zip(params: { readonly server_id: string; readonly paths: readonly string[]; readonly dest_path: string; - }): SafeZipResult { - return safeZipFiles({ - serversBaseDir: this.#serversBaseDir, - serverId: params.server_id, - paths: params.paths, - destPath: params.dest_path, - permissions: this.#permissions, - }); + }): Promise { + const runZip = () => + safeZipFiles({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + paths: params.paths, + destPath: params.dest_path, + permissions: this.#permissions, + ...(this.#openForReadImpl !== undefined ? { openForReadImpl: this.#openForReadImpl } : {}), + }); + try { + return runZip(); + } catch (err) { + if (!isEaccesError(err)) { + throw err; + } + await this.#ensureReadable(params.server_id); + return runZip(); + } } - unzip(params: { + async unzip(params: { readonly server_id: string; readonly zip_path: string; readonly dest_path?: string | undefined; - }): SafeUnzipResult { - return safeUnzipFile({ - serversBaseDir: this.#serversBaseDir, - serverId: params.server_id, - zipPath: params.zip_path, - ...(params.dest_path !== undefined ? { destPath: params.dest_path } : {}), - permissions: this.#permissions, - ...this.#zipOptions, - }); + }): Promise { + const runUnzip = () => + safeUnzipFile({ + serversBaseDir: this.#serversBaseDir, + serverId: params.server_id, + zipPath: params.zip_path, + ...(params.dest_path !== undefined ? { destPath: params.dest_path } : {}), + permissions: this.#permissions, + ...(this.#openForReadImpl !== undefined ? { openForReadImpl: this.#openForReadImpl } : {}), + ...this.#zipOptions, + }); + try { + return runUnzip(); + } catch (err) { + if (!isEaccesError(err)) { + throw err; + } + await this.#ensureReadable(params.server_id); + return runUnzip(); + } } dispose(): void { @@ -986,9 +1042,9 @@ export function registerFileCommandHandlers(queue: CommandQueue, manager: FileMa eventType: string, fn: (body: TBody) => unknown, ): Parameters[1] { - return (opened, ctx) => { + return async (opened, ctx) => { try { - const result = fn(opened.body as TBody); + const result = await fn(opened.body as TBody); ctx.sendEvent(eventType, result); } catch (err) { if (err instanceof FileManagerError) { diff --git a/src/files/transfers.ts b/src/files/transfers.ts index 879c536..9803472 100644 --- a/src/files/transfers.ts +++ b/src/files/transfers.ts @@ -18,12 +18,14 @@ import { writeSync, } from "node:fs"; import { dirname, join } from "node:path"; +import type { Logger } from "../agent/logger"; import { SHA256_HEX_PATTERN } from "../protocol"; import { finalizeServerPath, type PermissionContext, SERVER_FILE_MODE, } from "../server/permissions"; +import { type MakeServerReadableLike, makeServerReadable } from "../server/readable"; import { assertConfinedInternalDir, assertNoSymlinkPath, @@ -32,7 +34,8 @@ import { isErrnoCode, isPosix, mkdirConfined, - openConfinedFileForRead, + type openConfinedFileForRead, + openConfinedFileForReadWithRetry, resolveConfinedPath, UPLOAD_STAGING_DIR_NAME, wrapIoError, @@ -115,6 +118,9 @@ export interface TransferManagerOptions { readonly maxConcurrentUploads?: number; readonly maxConcurrentDownloads?: number; readonly permissions?: PermissionContext; + readonly logger?: Logger; + readonly makeServerReadableImpl?: MakeServerReadableLike; + readonly openForReadImpl?: typeof openConfinedFileForRead; } export interface UploadBeginParams { @@ -233,6 +239,9 @@ export class TransferManager { readonly #maxConcurrentUploads: number; readonly #maxConcurrentDownloads: number; readonly #permissions: PermissionContext | undefined; + readonly #logger: Logger | undefined; + readonly #makeServerReadable: MakeServerReadableLike; + readonly #openForReadImpl: typeof openConfinedFileForRead | undefined; readonly #uploads = new Map(); readonly #downloads = new Map(); @@ -244,6 +253,15 @@ export class TransferManager { this.#maxConcurrentDownloads = options.maxConcurrentDownloads ?? DEFAULT_MAX_CONCURRENT_DOWNLOADS; this.#permissions = options.permissions; + this.#logger = options.logger; + this.#makeServerReadable = options.makeServerReadableImpl ?? makeServerReadable; + this.#openForReadImpl = options.openForReadImpl; + } + + async #ensureReadable(serverId: string): Promise { + await this.#makeServerReadable(serverId, { + ...(this.#logger !== undefined ? { logger: this.#logger } : {}), + }); } #cleanupUpload(session: UploadSession, unlinkStaging: boolean): void { @@ -641,7 +659,7 @@ export class TransferManager { return { upload_id: session.uploadId, aborted: true }; } - beginDownload(params: DownloadBeginParams): DownloadBeginResult { + async beginDownload(params: DownloadBeginParams): Promise { const requestedPartSize = params.part_size ?? Math.min(DEFAULT_PART_BYTES, this.#maxPartBytes); if (!Number.isSafeInteger(requestedPartSize) || requestedPartSize <= 0) { throw new FileManagerError("part_too_large", "part_size must be a positive integer"); @@ -666,7 +684,10 @@ export class TransferManager { allowRoot: false, }); - const { fd, stats } = openConfinedFileForRead(resolved); + const { fd, stats } = await openConfinedFileForReadWithRetry(resolved, { + onEacces: () => this.#ensureReadable(resolved.serverId), + ...(this.#openForReadImpl !== undefined ? { openImpl: this.#openForReadImpl } : {}), + }); const downloadId = randomBytes(16).toString("hex"); const totalParts = stats.size === 0 ? 1 : Math.ceil(stats.size / requestedPartSize); @@ -748,7 +769,7 @@ export class TransferManager { return { download_id: session.downloadId, closed: true }; } - downloadRange(params: DownloadRangeParams): DownloadRangeResult { + async downloadRange(params: DownloadRangeParams): Promise { if (!Number.isSafeInteger(params.offset) || params.offset < 0) { throw new FileManagerError("invalid_path", "offset must be a non-negative integer"); } @@ -769,7 +790,10 @@ export class TransferManager { allowRoot: false, }); - const { fd, stats } = openConfinedFileForRead(resolved); + const { fd, stats } = await openConfinedFileForReadWithRetry(resolved, { + onEacces: () => this.#ensureReadable(resolved.serverId), + ...(this.#openForReadImpl !== undefined ? { openImpl: this.#openForReadImpl } : {}), + }); try { const remaining = Math.max(0, stats.size - params.offset); const toRead = Math.min(params.length, remaining); diff --git a/src/files/zip.ts b/src/files/zip.ts index dca44c4..5a271ac 100644 --- a/src/files/zip.ts +++ b/src/files/zip.ts @@ -308,6 +308,7 @@ export interface SafeUnzipBufferOptions extends SafeUnzipOptions { export interface SafeUnzipFileOptions extends SafeUnzipOptions { readonly zipPath: string; readonly maxZipFileBytes?: number; + readonly openForReadImpl?: typeof openConfinedFileForRead; } export interface SafeUnzipResult { @@ -790,7 +791,8 @@ export function safeUnzipFile(options: SafeUnzipFileOptions): SafeUnzipResult { allowRoot: false, }); - const { fd, stats } = openConfinedFileForRead(zipResolved); + const openForRead = options.openForReadImpl ?? openConfinedFileForRead; + const { fd, stats } = openForRead(zipResolved); let buffer: Uint8Array; try { if (stats.size > maxZipFileBytes) { @@ -828,6 +830,7 @@ export interface SafeZipFilesOptions { readonly maxFiles?: number; readonly maxTotalBytes?: number; readonly permissions?: PermissionContext; + readonly openForReadImpl?: typeof openConfinedFileForRead; } export interface SafeZipResult { @@ -962,7 +965,8 @@ export function safeZipFiles(options: SafeZipFilesOptions): SafeZipResult { throw new FileManagerError("zip_too_many_entries", "Archive file count limit exceeded"); } - const { fd, stats: fdStats } = openConfinedFileForRead(resolved); + const openForRead = options.openForReadImpl ?? openConfinedFileForRead; + const { fd, stats: fdStats } = openForRead(resolved); let data: Uint8Array; try { if (totalUncompressed + fdStats.size > maxTotalBytes) { diff --git a/src/install/units.test.ts b/src/install/units.test.ts index a895856..2872b82 100644 --- a/src/install/units.test.ts +++ b/src/install/units.test.ts @@ -400,14 +400,81 @@ describe("Security regression checks on install/ assets", () => { expect(tmpfilesContent).toContain("d @TEGRAD_RUN_DIR@ 0750 root tegrad -"); }); - test("polkit rule restricts tegrad strictly to tegrad-server@ units", () => { + test("tegrad-perms@.service enforces strict sandboxing, unprivileged tegrad-srv user, no network, and no capabilities", () => { + const content = readInstallFile("units/tegrad-perms@.service"); + const directives = parseIniDirectives(content); + + expect(directives.get("Type")).toEqual(["oneshot"]); + expect(directives.get("User")).toEqual(["tegrad-srv"]); + expect(directives.get("Group")).toEqual(["tegrad-srv"]); + expect(directives.get("UMask")).toEqual(["0007"]); + expect(directives.get("TimeoutStartSec")).toEqual(["120"]); + expect(directives.get("Restart")).toBeUndefined(); + + expect(directives.get("NoNewPrivileges")).toEqual(["yes"]); + expect(directives.get("ProtectSystem")).toEqual(["strict"]); + expect(directives.get("ProtectHome")).toEqual(["yes"]); + expect(directives.get("PrivateTmp")).toEqual(["yes"]); + expect(directives.get("PrivateDevices")).toEqual(["yes"]); + expect(directives.get("ProtectKernelTunables")).toEqual(["yes"]); + expect(directives.get("ProtectKernelModules")).toEqual(["yes"]); + expect(directives.get("ProtectKernelLogs")).toEqual(["yes"]); + expect(directives.get("ProtectControlGroups")).toEqual(["yes"]); + expect(directives.get("ProtectProc")).toEqual(["invisible"]); + expect(directives.get("ProcSubset")).toEqual(["pid"]); + expect(directives.get("RestrictSUIDSGID")).toEqual(["yes"]); + expect(directives.get("RestrictNamespaces")).toEqual(["yes"]); + expect(directives.get("RestrictRealtime")).toEqual(["yes"]); + expect(directives.get("LockPersonality")).toEqual(["yes"]); + expect(directives.get("PrivateNetwork")).toEqual(["yes"]); + expect(directives.get("RestrictAddressFamilies")).toEqual(["AF_UNIX"]); + expect(directives.get("CapabilityBoundingSet")).toEqual([""]); + expect(directives.get("SystemCallFilter")).toEqual(["@system-service"]); + expect(directives.get("SystemCallArchitectures")).toEqual(["native"]); + + // ReadWritePaths must be strictly scoped to this server's directory only + const rwTokens = (directives.get("ReadWritePaths") ?? []) + .flatMap((line) => line.split(/\s+/)) + .filter((t) => t.length > 0); + expect(rwTokens).toEqual(["@TEGRAD_SERVERS_DIR@/%i"]); + + // ExecStart must use find without following symlinks and chmod only group bits (never others) + const execStart = directives.get("ExecStart")?.[0] ?? ""; + expect(execStart).toContain("/usr/bin/find"); + expect(execStart).toContain("@TEGRAD_SERVERS_DIR@/%i"); + expect(execStart).toContain("-xdev"); + expect(execStart).toContain("-user tegrad-srv"); + expect(execStart).toContain("-not -type l"); + expect(execStart).toContain("/usr/bin/chmod g+rwX {} +"); + expect(execStart).not.toMatch(/\bo[+=]/); + }); + + test("polkit rule restricts tegrad strictly to tegrad-server@ (.service/.socket) and tegrad-perms@ (.service only)", () => { const rule = readInstallFile("polkit/50-tegrad.rules"); expect(rule).toContain('action.id === "org.freedesktop.systemd1.manage-units"'); expect(rule).toContain('subject.user === "tegrad"'); - expect(rule).toContain("/^tegrad-server@[a-z0-9][a-z0-9-]{0,62}\\.(service|socket)$/"); expect(rule).toContain("polkit.Result.YES"); expect(rule).toContain("polkit.Result.NOT_HANDLED"); + + const regexMatch = /\/([^/\r\n]+)\/\.test\(unit\)/.exec(rule); + expect(regexMatch).not.toBeNull(); + const re = new RegExp(regexMatch?.[1] ?? ""); + + // Allowed units + expect(re.test("tegrad-server@x.service")).toBe(true); + expect(re.test("tegrad-server@my-mc-1.socket")).toBe(true); + expect(re.test("tegrad-perms@x.service")).toBe(true); + expect(re.test("tegrad-perms@my-mc-1.service")).toBe(true); + + // Disallowed units + expect(re.test("tegrad-perms@x.socket")).toBe(false); + expect(re.test("tegrad-perms@-bad.service")).toBe(false); + expect(re.test("tegrad-perms@bad_id.service")).toBe(false); + expect(re.test(`tegrad-perms@${"a".repeat(64)}.service`)).toBe(false); + expect(re.test("tegrad.service")).toBe(false); + expect(re.test("tegrad-update.service")).toBe(false); + expect(re.test("sshd.service")).toBe(false); }); test("install.sh avoids eval, guards every rm -rf with parameter-expansion :?, uses set -eu, and verifies SHA256SUMS.sig", () => { @@ -422,6 +489,7 @@ describe("Security regression checks on install/ assets", () => { expect(script).toContain("verify-update"); expect(script).toContain("tegrad-update.path"); expect(script).toContain("tegrad-update.service"); + expect(script).toContain("tegrad-perms@.service"); // Embedded PEM key in install.sh must match RELEASE_PUBLIC_KEY_BASE64URL in src/update/release-key.ts const pemMatch = /-----BEGIN PUBLIC KEY-----[\s\S]*?-----END PUBLIC KEY-----/.exec(script); @@ -452,6 +520,7 @@ describe("Security regression checks on install/ assets", () => { "units/tegrad-update.path", "units/tegrad-server@.service", "units/tegrad-server@.socket", + "units/tegrad-perms@.service", "tmpfiles/tegrad.conf", "polkit/50-tegrad.rules", ] as const; diff --git a/src/protocol/errors.ts b/src/protocol/errors.ts index 5966b47..3003ea2 100644 --- a/src/protocol/errors.ts +++ b/src/protocol/errors.ts @@ -41,6 +41,7 @@ export type ProtocolErrorCode = | "download_failed" | "hash_mismatch" | "systemd_error" + | "perms_unavailable" | "origin_locked" | "plan_not_found" | "plan_expired" diff --git a/src/server/id.ts b/src/server/id.ts index 3df4eee..ece59ae 100644 --- a/src/server/id.ts +++ b/src/server/id.ts @@ -121,3 +121,8 @@ export function formatSocketUnit(id: string): string { const validId = assertValidServerId(id); return `tegrad-server@${validId}.socket`; } + +export function formatPermsUnit(id: string): string { + const validId = assertValidServerId(id); + return `tegrad-perms@${validId}.service`; +} diff --git a/src/server/index.ts b/src/server/index.ts index a007214..1d22bcc 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -42,6 +42,7 @@ export { assertValidServerId, DEFAULT_RUN_DIR, DEFAULT_SERVERS_DIR, + formatPermsUnit, formatServiceUnit, formatSocketUnit, resolveFifoPath, @@ -77,6 +78,13 @@ export { RESERVED_SYSTEM_MEMORY_MB, readMeminfo, } from "./memory"; +export { + DEFAULT_PERMS_TIMEOUT_MS, + DEFAULT_PERMS_UNIT_PATHS, + type MakeServerReadableLike, + type MakeServerReadableOptions, + makeServerReadable, +} from "./readable"; export { EULA_FILE, getEffectiveLaunchTarget, diff --git a/src/server/readable.test.ts b/src/server/readable.test.ts new file mode 100644 index 0000000..69e6afd --- /dev/null +++ b/src/server/readable.test.ts @@ -0,0 +1,196 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { describe, expect, test } from "bun:test"; +import { createLogger } from "../agent/logger"; +import { ProtocolError } from "../protocol"; +import { formatPermsUnit } from "./id"; +import type { RunFixedLike } from "./java"; +import { DEFAULT_PERMS_TIMEOUT_MS, makeServerReadable } from "./readable"; + +function createCaptureLogger() { + const warnings: string[] = []; + const logger = createLogger({ + level: "warn", + stdout: (line) => warnings.push(line), + stderr: (line) => warnings.push(line), + }); + return { logger, warnings }; +} + +describe("makeServerReadable", () => { + test("invokes systemctl start --wait with literal args and returns true on success", async () => { + const calls: { + readonly command: string; + readonly args: readonly string[]; + readonly timeoutMs: number | undefined; + }[] = []; + + const runFixedImpl: RunFixedLike = async (command, args, opts) => { + calls.push({ command, args: [...args], timeoutMs: opts?.timeoutMs }); + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + }; + + const ok = await makeServerReadable("survival-1", { runFixedImpl }); + expect(ok).toBe(true); + expect(calls).toEqual([ + { + command: "systemctl", + args: ["start", "--wait", "tegrad-perms@survival-1.service"], + timeoutMs: DEFAULT_PERMS_TIMEOUT_MS, + }, + ]); + expect(formatPermsUnit("survival-1")).toBe("tegrad-perms@survival-1.service"); + }); + + test("rejects invalid server IDs before running systemctl", async () => { + let called = false; + const runFixedImpl: RunFixedLike = async () => { + called = true; + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + }; + + for (const badId of ["", "-leading", "UPPER", "has_underscore", "../escape", "a".repeat(64)]) { + await expect(makeServerReadable(badId, { runFixedImpl })).rejects.toMatchObject({ + name: "ProtocolError", + code: "invalid_body", + }); + } + expect(called).toBe(false); + }); + + test("serializes concurrent calls for the same server and allows parallel calls across different servers", async () => { + const events: string[] = []; + let releaseFirst!: () => void; + const firstGate = new Promise((resolve) => { + releaseFirst = resolve; + }); + let firstStarted!: () => void; + const firstStartedPromise = new Promise((resolve) => { + firstStarted = resolve; + }); + + let srv1Count = 0; + const runFixedImpl: RunFixedLike = async (_command, args) => { + const unit = args[2] ?? ""; + if (unit === "tegrad-perms@srv-1.service") { + srv1Count += 1; + const idx = srv1Count; + events.push(`start:srv-1:${idx}`); + if (idx === 1) { + firstStarted(); + await firstGate; + } + events.push(`end:srv-1:${idx}`); + } else { + events.push(`start:${unit}`); + events.push(`end:${unit}`); + } + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + }; + + const p1 = makeServerReadable("srv-1", { runFixedImpl }); + await firstStartedPromise; + const p2 = makeServerReadable("srv-1", { runFixedImpl }); + const pOther = makeServerReadable("srv-2", { runFixedImpl }); + + // Different server completes while srv-1 call #1 is still running. + await pOther; + expect(events).toEqual([ + "start:srv-1:1", + "start:tegrad-perms@srv-2.service", + "end:tegrad-perms@srv-2.service", + ]); + + releaseFirst(); + await Promise.all([p1, p2]); + expect(events).toEqual([ + "start:srv-1:1", + "start:tegrad-perms@srv-2.service", + "end:tegrad-perms@srv-2.service", + "end:srv-1:1", + "start:srv-1:2", + "end:srv-1:2", + ]); + }); + + test("degrades with a warning instead of throwing when the unit or systemctl does not exist", async () => { + const { logger, warnings } = createCaptureLogger(); + + const notFoundByCode: RunFixedLike = async () => ({ + code: 5, + stdout: "", + stderr: "Failed to start tegrad-perms@dev.service: Unit tegrad-perms@dev.service not found.", + timedOut: false, + truncated: false, + }); + expect(await makeServerReadable("dev", { runFixedImpl: notFoundByCode, logger })).toBe(false); + + const notFoundByStderr: RunFixedLike = async () => ({ + code: 1, + stdout: "", + stderr: "Unit tegrad-perms@dev.service could not be found.", + timedOut: false, + truncated: false, + }); + expect(await makeServerReadable("dev", { runFixedImpl: notFoundByStderr, logger })).toBe(false); + + const enoentImpl: RunFixedLike = async () => { + const err = new Error("spawn systemctl ENOENT") as NodeJS.ErrnoException; + err.code = "ENOENT"; + throw err; + }; + expect(await makeServerReadable("dev", { runFixedImpl: enoentImpl, logger })).toBe(false); + + // Without runFixedImpl, missing unit file on Linux or non-Linux platform degrades with warning. + expect( + await makeServerReadable("dev", { platform: "linux", unitExists: () => false, logger }), + ).toBe(false); + expect(await makeServerReadable("dev", { platform: "win32", logger })).toBe(false); + + expect(warnings.length).toBeGreaterThanOrEqual(5); + }); + + test("throws ProtocolError(perms_unavailable) on non-not-found failure or timeout, without blocking queued calls", async () => { + let attempt = 0; + const runFixedImpl: RunFixedLike = async () => { + attempt += 1; + if (attempt === 1) { + return { + code: 1, + stdout: "", + stderr: "Access denied", + timedOut: false, + truncated: false, + }; + } + if (attempt === 2) { + return { + code: -1, + stdout: "", + stderr: "", + timedOut: true, + truncated: false, + }; + } + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + }; + + const p1 = makeServerReadable("srv-err", { runFixedImpl }); + const p2 = makeServerReadable("srv-err", { runFixedImpl }); + const p3 = makeServerReadable("srv-err", { runFixedImpl }); + + const [r1, r2, r3] = await Promise.allSettled([p1, p2, p3]); + expect(r1.status).toBe("rejected"); + if (r1.status === "rejected") { + expect(r1.reason).toBeInstanceOf(ProtocolError); + expect((r1.reason as ProtocolError).code).toBe("perms_unavailable"); + } + expect(r2.status).toBe("rejected"); + if (r2.status === "rejected") { + expect(r2.reason).toBeInstanceOf(ProtocolError); + expect((r2.reason as ProtocolError).code).toBe("perms_unavailable"); + } + expect(r3).toEqual({ status: "fulfilled", value: true }); + }); +}); diff --git a/src/server/readable.ts b/src/server/readable.ts new file mode 100644 index 0000000..f10c1ca --- /dev/null +++ b/src/server/readable.ts @@ -0,0 +1,168 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { existsSync } from "node:fs"; +import { runFixed } from "../agent/exec"; +import type { Logger } from "../agent/logger"; +import { ProtocolError } from "../protocol"; +import { assertValidServerId, formatPermsUnit } from "./id"; +import type { RunFixedLike } from "./java"; + +export const DEFAULT_PERMS_TIMEOUT_MS = 120_000; + +export const DEFAULT_PERMS_UNIT_PATHS: readonly string[] = [ + "/etc/systemd/system/tegrad-perms@.service", + "/lib/systemd/system/tegrad-perms@.service", + "/usr/lib/systemd/system/tegrad-perms@.service", +]; + +export interface MakeServerReadableOptions { + readonly runFixedImpl?: RunFixedLike; + readonly logger?: Logger; + readonly timeoutMs?: number; + readonly platform?: NodeJS.Platform; + readonly unitExists?: () => boolean; +} + +export type MakeServerReadableLike = ( + serverId: string, + options?: MakeServerReadableOptions, +) => Promise; + +const inFlightByServer = new Map>(); + +function defaultPermsUnitExists(): boolean { + return DEFAULT_PERMS_UNIT_PATHS.some((unitPath) => existsSync(unitPath)); +} + +function isUnitNotFoundFailure(code: number, stderr: string): boolean { + if (code === 5) { + return true; + } + const lower = stderr.toLowerCase(); + return ( + /unit\s+\S+\s+not found/.test(lower) || + lower.includes("could not be found") || + lower.includes("not-found") || + lower.includes("system has not been booted with systemd") + ); +} + +function isEnoentError(err: unknown): boolean { + return ( + typeof err === "object" && + err !== null && + "code" in err && + (err as { readonly code?: unknown }).code === "ENOENT" + ); +} + +async function runMakeServerReadableOnce( + validId: string, + options: MakeServerReadableOptions, +): Promise { + const permsUnit = formatPermsUnit(validId); + + if (options.runFixedImpl === undefined) { + const platform = options.platform ?? process.platform; + if (platform !== "linux") { + options.logger?.warn("Skipping tegrad-perms unit on non-Linux host", { + serverId: validId, + unit: permsUnit, + platform, + }); + return false; + } + + const checkUnitExists = options.unitExists ?? defaultPermsUnitExists; + if (!checkUnitExists()) { + options.logger?.warn( + "tegrad-perms@.service unit is not installed; skipping permission sync", + { + serverId: validId, + unit: permsUnit, + }, + ); + return false; + } + } + + const runCmd: RunFixedLike = options.runFixedImpl ?? runFixed; + const timeoutMs = options.timeoutMs ?? DEFAULT_PERMS_TIMEOUT_MS; + + let result: Awaited>; + try { + result = await runCmd("systemctl", ["start", "--wait", permsUnit], { timeoutMs }); + } catch (err) { + if (isEnoentError(err)) { + options.logger?.warn("systemctl is unavailable; skipping permission sync", { + serverId: validId, + unit: permsUnit, + }); + return false; + } + throw new ProtocolError( + "perms_unavailable", + `Failed to invoke ${permsUnit}: ${err instanceof Error ? err.message : String(err)}`, + ); + } + + if (result.timedOut) { + throw new ProtocolError("perms_unavailable", `Timed out waiting for ${permsUnit}`); + } + + if (result.code === 0) { + return true; + } + + if (isUnitNotFoundFailure(result.code, result.stderr)) { + options.logger?.warn("tegrad-perms unit is not available; continuing without permission sync", { + serverId: validId, + unit: permsUnit, + code: result.code, + }); + return false; + } + + const detail = result.stderr.trim(); + throw new ProtocolError( + "perms_unavailable", + detail.length > 0 + ? `Failed to run ${permsUnit} (exit ${result.code}): ${detail}` + : `Failed to run ${permsUnit} (exit ${result.code})`, + ); +} + +/** + * Triggers the unprivileged `tegrad-perms@.service` oneshot unit (running as + * `tegrad-srv`) so files created with explicit mode 0600 by the JVM become + * group-readable and group-writable by the `tegrad` agent. + * + * Calls for the same server are serialized; calls for different servers may run + * concurrently. Returns `true` when the unit ran successfully and `false` when + * degraded because the unit or systemd is unavailable (e.g. in development). + */ +export async function makeServerReadable( + serverId: string, + options: MakeServerReadableOptions = {}, +): Promise { + const validId = assertValidServerId(serverId); + const prev = inFlightByServer.get(validId) ?? Promise.resolve(); + + let release!: () => void; + const gate = new Promise((resolve) => { + release = resolve; + }); + const nextTail = prev.then(() => gate); + inFlightByServer.set(validId, nextTail); + + await prev; + try { + return await runMakeServerReadableOnce(validId, options); + } finally { + release(); + if (inFlightByServer.get(validId) === nextTail) { + inFlightByServer.delete(validId); + } + } +} From 5f6700180c5246a77ba31d2a244740fa47e4b202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Mon, 23 Nov 2026 15:03:41 -0300 Subject: [PATCH 29/59] feat: reject placeholder release key and add active network isolation self-test --- .github/workflows/release.yml | 38 ++++++ install/README.md | 14 +++ install/install.sh | 222 +++++++++++++++++++++++++++++++++- src/agent/paths.ts | 2 + src/cli/doctor.test.ts | 152 ++++++++++++++++++++++- src/cli/doctor.ts | 148 ++++++++++++++++++++++- src/cli/main.ts | 7 +- src/cli/run.ts | 1 + src/install/units.test.ts | 174 ++++++++++++++++++++++++++ src/update/apply.test.ts | 94 ++++++++++++++ src/update/apply.ts | 13 +- src/update/errors.ts | 1 + src/update/index.ts | 5 + src/update/manifest.test.ts | 153 +++++++++++++++++++---- src/update/manifest.ts | 19 ++- src/update/release-key.ts | 69 ++++++++++- src/update/updater.test.ts | 53 ++++++++ src/update/updater.ts | 13 +- 18 files changed, 1140 insertions(+), 38 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c881013..5bf7e8a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,6 +45,44 @@ jobs: printf 'version=%s\n' "$VERSION" >> "$GITHUB_OUTPUT" printf 'channel=%s\n' "$CHANNEL" >> "$GITHUB_OUTPUT" + - name: Verify production release key + env: + RELEASE_SIGNING_KEY: ${{ secrets.RELEASE_SIGNING_KEY }} + run: | + set -eu + bun -e ' + import { ready, toBase64Url } from "./src/crypto"; + import { + getReleasePublicKey, + isPlaceholderReleaseKey, + parseReleaseSigningKey, + } from "./src/update"; + + await ready(); + const embedded = getReleasePublicKey(); + if (isPlaceholderReleaseKey(embedded)) { + throw new Error( + "Refusing to publish release: src/update/release-key.ts still embeds the public test release key.", + ); + } + + const rawSecret = process.env.RELEASE_SIGNING_KEY; + if (!rawSecret || rawSecret.trim().length === 0) { + throw new Error("RELEASE_SIGNING_KEY secret is required for release builds."); + } + const derived = parseReleaseSigningKey(rawSecret); + if (isPlaceholderReleaseKey(derived.publicKey)) { + throw new Error( + "Refusing to publish release: RELEASE_SIGNING_KEY secret is the public test release key.", + ); + } + if (toBase64Url(derived.publicKey) !== toBase64Url(embedded)) { + throw new Error( + "Refusing to publish release: RELEASE_SIGNING_KEY public key does not match embedded RELEASE_PUBLIC_KEY_BASE64URL.", + ); + } + ' + - name: Build Linux release binaries env: RELEASE_VERSION: ${{ steps.meta.outputs.version }} diff --git a/install/README.md b/install/README.md index 21bcb73..a1fe859 100644 --- a/install/README.md +++ b/install/README.md @@ -28,6 +28,7 @@ Optional flags: - `--api-url https://...`: writes `api_url` to `/var/lib/tegrad/config.json` (otherwise created once with `https://api.tegramc.com` and preserved on updates). - `--allow-lan `: allows a private/LAN CIDR in the server network drop-in (can be repeated). +- `--require-network-isolation`: fail the installation with a non-zero exit code if the active `IPAddressDeny` self-test detects that cgroup BPF filtering is not enforced (or cannot run). The installer is idempotent: re-running it updates the binary, units (`tegrad.service`, `tegrad-update.path`, `tegrad-update.service`, `tegrad-server@.service`, `tegrad-server@.socket`), polkit rule, and network drop-in without resetting `/var/lib/tegrad`. @@ -39,6 +40,17 @@ The installer is idempotent: re-running it updates the binary, units (`tegrad.se 2. Re-verifies the Ed25519 manifest signature and SHA-256 hash on the root-owned copy (preventing TOCTOU tampering). 3. Backs up the existing binary to `/opt/tegrad/bin/tegrad.prev`, swaps the new binary atomically, restarts `tegrad.service`, and automatically rolls back if the service fails to become active. +### Replacing the release signing key (before public release) + +Development builds embed a well-known test public key (`TEST_RELEASE_PUBLIC_KEY_BASE64URL`). Auto-update, `verify-update`, and `apply-update` fail closed (`placeholder_release_key`) on test-key builds unless `TEGRAD_ALLOW_TEST_RELEASE_KEY=1` is set in the environment, and the release workflow blocks publishing with the test key. + +To switch to the production offline Ed25519 release key: + +1. Generate a 32-byte Ed25519 seed offline and store its base64url encoding in the `RELEASE_SIGNING_KEY` GitHub Actions secret. +2. Replace `RELEASE_PUBLIC_KEY_BASE64URL` in `src/update/release-key.ts` with the corresponding base64url public key (removing the `TODO(release-key)` comment). +3. Replace `RELEASE_PUBLIC_KEY_PEM` in `install/install.sh` with the matching Ed25519 SPKI PEM (you can format it with `ed25519PublicKeyToPem`). +4. Run `bun run test` to verify `install/install.sh` and `src/update/release-key.ts` match. + After installation, link the agent and verify the setup: ```sh @@ -50,6 +62,8 @@ tegrad doctor By default, `/etc/systemd/system/tegrad-server@.service.d/10-network.conf` denies private, link-local, CGNAT, and loopback address ranges (`IPAddressDeny`) on `tegrad-server@.service`, and only allows private/loopback DNS resolvers detected on the host. +- **Active self-test**: at the end of installation, `install.sh` opens a temporary local TCP listener on `127.0.0.1` and runs a transient `systemd-run` unit with `IPAddressDeny=any` to confirm the kernel enforces cgroup BPF IP filtering. On LXC containers or kernels without `CONFIG_CGROUP_BPF`, `IPAddressDeny` is silently ignored by systemd; `install.sh` prints a warning to stderr (or fails if `--require-network-isolation` was passed) and records the result in `/var/lib/tegrad/network-isolation.json` (`0600`, owned by `tegrad`). +- **`tegrad doctor` check**: `tegrad doctor` reads `/var/lib/tegrad/network-isolation.json` without root and reports `network_isolation` as `OK` (verified within the last 30 days), `FALHA` (not effective), or `INCONCLUSIVO` (never tested, skipped, or older than 30 days). Re-run `install.sh` to refresh the check. - **LAN players are blocked by default**: systemd's `IPAddressDeny` applies to both inbound and outbound traffic on the server's sockets. If players on your local network need to connect directly, pass `--allow-lan ` (for example `--allow-lan 192.168.1.0/24`). - **Changing DNS resolvers later**: if the host's DNS configuration changes after installation, re-run `install.sh` (with your previous flags) to regenerate `10-network.conf` and reload systemd. diff --git a/install/install.sh b/install/install.sh index 35e13cc..8f0a28c 100755 --- a/install/install.sh +++ b/install/install.sh @@ -16,6 +16,7 @@ TEGRAD_BIN="/opt/tegrad/bin/tegrad" TEGRAD_WRAPPER="/usr/local/bin/tegrad" TEGRAD_STATE_DIR="/var/lib/tegrad" TEGRAD_CONFIG_FILE="/var/lib/tegrad/config.json" +TEGRAD_NETWORK_ISOLATION_FILE="/var/lib/tegrad/network-isolation.json" TEGRAD_SERVERS_DIR="/var/lib/tegrad-servers" TEGRAD_BACKUPS_DIR="/var/lib/tegrad-backups" TEGRAD_RUN_DIR="/run/tegrad-server" @@ -64,7 +65,8 @@ Install or update tegrad (idempotent): --binary Install a local tegrad binary --version Download release binary and verify Ed25519 signature + SHA256SUMS --api-url Write api_url to /var/lib/tegrad/config.json (must be https://) - --allow-lan Allow a LAN CIDR in IPAddressAllow (repeatable) + --allow-lan Allow a LAN CIDR in IPAddressAllow (repeatable) + --require-network-isolation Fail installation if the active IPAddressDeny self-test fails Uninstall: --uninstall Stop services and remove units, polkit rule, wrapper, and binary @@ -813,6 +815,215 @@ ensure_config() { mv -f "$_cfg_tmp" "$TEGRAD_CONFIG_FILE" } +write_network_isolation_result() { + _wni_effective="$1" + _wni_file="${2:-$TEGRAD_NETWORK_ISOLATION_FILE}" + _wni_ts=$(date -u +%Y-%m-%dT%H:%M:%SZ) + _wni_tmp="${_wni_file}.tmp.$$" + + printf '{\n "checked_at": "%s",\n "effective": %s\n}\n' "$_wni_ts" "$_wni_effective" > "$_wni_tmp" + if [ "$(id -u)" -eq 0 ] && id -u "$TEGRAD_USER" >/dev/null 2>&1; then + chown "${TEGRAD_USER}:${TEGRAD_GROUP}" "$_wni_tmp" + fi + chmod 0600 "$_wni_tmp" + mv -f "$_wni_tmp" "$_wni_file" +} + +run_network_isolation_probe() { + _np_unit="$1" + _np_kind="$2" + _np_port="$3" + + case "$_np_kind" in + python3) + systemd-run \ + --wait \ + --collect \ + --pipe \ + --unit="$_np_unit" \ + -p IPAddressDeny=any \ + -p DynamicUser=yes \ + -- python3 -c 'import socket, sys; s = socket.create_connection(("127.0.0.1", int(sys.argv[1])), timeout=3); s.close()' "$_np_port" \ + >/dev/null 2>&1 + ;; + bash) + systemd-run \ + --wait \ + --collect \ + --pipe \ + --unit="$_np_unit" \ + -p IPAddressDeny=any \ + -p DynamicUser=yes \ + -- bash -c 'exec 3<>"/dev/tcp/127.0.0.1/$1"' -- "$_np_port" \ + >/dev/null 2>&1 + ;; + nc) + systemd-run \ + --wait \ + --collect \ + --pipe \ + --unit="$_np_unit" \ + -p IPAddressDeny=any \ + -p DynamicUser=yes \ + -- nc -z -w 3 127.0.0.1 "$_np_port" \ + >/dev/null 2>&1 + ;; + *) + return 2 + ;; + esac +} + +cleanup_network_isolation_selftest() { + _cni_pid="$1" + _cni_port_file="$2" + _cni_unit="$3" + + if [ -n "$_cni_pid" ]; then + kill "$_cni_pid" 2>/dev/null || true + wait "$_cni_pid" 2>/dev/null || true + fi + if [ -n "$_cni_port_file" ] && [ -f "$_cni_port_file" ]; then + rm -f -- "$_cni_port_file" + fi + if [ -n "$_cni_unit" ] && command -v systemctl >/dev/null 2>&1; then + systemctl stop "${_cni_unit}.service" >/dev/null 2>&1 || true + systemctl reset-failed "${_cni_unit}.service" >/dev/null 2>&1 || true + fi +} + +run_network_isolation_selftest() { + _ni_require="${1:-0}" + _ni_result_file="${2:-$TEGRAD_NETWORK_ISOLATION_FILE}" + _ni_pid="" + _ni_port="" + _ni_port_file="" + _ni_probe_kind="" + _ni_unit="tegrad-netcheck-$$" + + if ! command -v systemd-run >/dev/null 2>&1; then + log_info "Aviso: systemd-run não encontrado; pulando autoteste de isolamento de rede." + write_network_isolation_result "null" "$_ni_result_file" + if [ "$_ni_require" -eq 1 ]; then + die "Isolamento de rede obrigatório (--require-network-isolation), mas systemd-run não está disponível." + fi + return 0 + fi + + if command -v python3 >/dev/null 2>&1; then + _ni_port_file=$(mktemp) + python3 -c ' +import socket, sys +s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) +s.bind(("127.0.0.1", 0)) +s.listen(1) +with open(sys.argv[1], "w") as f: + f.write(str(s.getsockname()[1])) +s.settimeout(15) +try: + conn, _ = s.accept() + conn.close() +except Exception: + pass +finally: + s.close() +' "$_ni_port_file" >/dev/null 2>&1 & + _ni_pid=$! + + _ni_tries=0 + while [ "$_ni_tries" -lt 30 ]; do + if [ -s "$_ni_port_file" ]; then + break + fi + if ! kill -0 "$_ni_pid" 2>/dev/null; then + break + fi + sleep 0.1 2>/dev/null || sleep 1 + _ni_tries=$((_ni_tries + 1)) + done + + if [ -s "$_ni_port_file" ] && kill -0 "$_ni_pid" 2>/dev/null; then + _ni_port=$(tr -d '\r\n\t ' < "$_ni_port_file") + _ni_probe_kind="python3" + else + cleanup_network_isolation_selftest "$_ni_pid" "$_ni_port_file" "" + _ni_pid="" + _ni_port_file="" + _ni_port="" + fi + fi + + if [ -z "$_ni_port" ] && command -v nc >/dev/null 2>&1; then + _ni_cand_port=$((45000 + ($$ % 15000))) + nc -l 127.0.0.1 "$_ni_cand_port" >/dev/null 2>&1 & + _ni_pid=$! + sleep 0.2 2>/dev/null || sleep 1 + if kill -0 "$_ni_pid" 2>/dev/null; then + _ni_port="$_ni_cand_port" + if command -v bash >/dev/null 2>&1; then + _ni_probe_kind="bash" + else + _ni_probe_kind="nc" + fi + else + cleanup_network_isolation_selftest "$_ni_pid" "" "" + _ni_pid="" + fi + fi + + if [ -z "$_ni_port" ] || [ -z "$_ni_probe_kind" ]; then + cleanup_network_isolation_selftest "$_ni_pid" "$_ni_port_file" "" + log_info "Aviso: nenhuma ferramenta disponível (python3 ou nc) para o listener local; pulando autoteste de isolamento de rede." + write_network_isolation_result "null" "$_ni_result_file" + if [ "$_ni_require" -eq 1 ]; then + die "Isolamento de rede obrigatório (--require-network-isolation), mas não foi possível iniciar o autoteste." + fi + return 0 + fi + + _ni_connected=0 + if run_network_isolation_probe "$_ni_unit" "$_ni_probe_kind" "$_ni_port"; then + _ni_connected=1 + else + _ni_connected=0 + fi + + cleanup_network_isolation_selftest "$_ni_pid" "$_ni_port_file" "$_ni_unit" + + if [ "$_ni_connected" -eq 1 ]; then + write_network_isolation_result "false" "$_ni_result_file" + cat >&2 <<'EOF' + +=========================================================================== +AVISO: O isolamento de rede dos servidores NÃO está funcionando neste host! +=========================================================================== +O autoteste ativo com systemd-run (IPAddressDeny=any) conseguiu conectar em +127.0.0.1 mesmo com o filtro de IP ativado. Isso acontece normalmente em +contêineres LXC ou kernels sem suporte a BPF de cgroup (CONFIG_CGROUP_BPF). + +Neste ambiente, os servidores Minecraft podem alcançar a rede privada/local +(LAN) mesmo com IPAddressDeny configurado na unit do systemd. + +Sugestões: + - Execute o tegrad em uma VM ou host Linux com cgroup v2 e BPF de cgroup + habilitados; ou + - Caso precise usar LXC/contêiner, configure regras de firewall no host + para bloquear o acesso dos servidores às faixas privadas/LAN. +=========================================================================== + +EOF + if [ "$_ni_require" -eq 1 ]; then + die "Isolamento de rede não é efetivo neste host (--require-network-isolation)." + fi + return 0 + fi + + write_network_isolation_result "true" "$_ni_result_file" + log_info "Isolamento de rede verificado." + return 0 +} + do_uninstall() { _un_purge="$1" _un_yes="$2" @@ -891,6 +1102,7 @@ main() { OPT_VERSION="" OPT_API_URL="" OPT_ALLOW_LAN="" + OPT_REQUIRE_NETWORK_ISOLATION=0 OPT_UNINSTALL=0 OPT_PURGE=0 OPT_YES=0 @@ -921,6 +1133,10 @@ main() { OPT_ALLOW_LAN=$(append_unique_token "$OPT_ALLOW_LAN" "$2") shift 2 ;; + --require-network-isolation) + OPT_REQUIRE_NETWORK_ISOLATION=1 + shift + ;; --uninstall) OPT_UNINSTALL=1 shift @@ -989,6 +1205,7 @@ main() { for _lan_c in $OPT_ALLOW_LAN; do set -- "$@" --allow-lan "$_lan_c" done + [ "$OPT_REQUIRE_NETWORK_ISOLATION" -eq 1 ] && set -- "$@" --require-network-isolation [ "$OPT_UNINSTALL" -eq 1 ] && set -- "$@" --uninstall [ "$OPT_PURGE" -eq 1 ] && set -- "$@" --purge [ "$OPT_YES" -eq 1 ] && set -- "$@" --yes @@ -1074,6 +1291,9 @@ main() { log_info "Reloading systemd and starting tegrad.service and tegrad-update.path..." sync_tegrad_service "$_old_bin_hash" "$_new_bin_hash" "$_tegrad_was_active" + log_info "Running active network isolation self-test..." + run_network_isolation_selftest "$OPT_REQUIRE_NETWORK_ISOLATION" "$TEGRAD_NETWORK_ISOLATION_FILE" + log_info "Pronto. Agora, para vincular este servidor, rode \`tegrad link\`." } diff --git a/src/agent/paths.ts b/src/agent/paths.ts index 2811235..dfaae66 100644 --- a/src/agent/paths.ts +++ b/src/agent/paths.ts @@ -19,6 +19,7 @@ export interface StatePaths { readonly revocationsPath: string; readonly membersPath: string; readonly replayPath: string; + readonly networkIsolationPath: string; readonly updateDir: string; } @@ -51,6 +52,7 @@ export function getStatePaths(stateDir: string): StatePaths { revocationsPath: join(stateDir, "revocations.json"), membersPath: join(stateDir, "members.json"), replayPath: join(stateDir, "replay.json"), + networkIsolationPath: join(stateDir, "network-isolation.json"), updateDir: join(stateDir, "update"), }; } diff --git a/src/cli/doctor.test.ts b/src/cli/doctor.test.ts index 9eeadd7..1c5ff56 100644 --- a/src/cli/doctor.test.ts +++ b/src/cli/doctor.test.ts @@ -2,9 +2,26 @@ // Copyright (C) 2026 Antônio Miranda import { describe, expect, test } from "bun:test"; +import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; import { getStatePaths } from "../agent"; import { renderNetworkDropIn } from "../install/units"; -import { DEFAULT_DOCTOR_PATHS, type DoctorOptions, runDoctor } from "./doctor"; +import { getReleasePublicKey } from "../update"; +import { + checkNetworkIsolationStatus, + DEFAULT_DOCTOR_PATHS, + type DoctorOptions, + NETWORK_ISOLATION_MAX_AGE_MS, + runDoctor, +} from "./doctor"; + +const NON_PLACEHOLDER_RELEASE_KEY = new Uint8Array(32).fill(0x11); +const FIXED_NOW_MS = Date.parse("2026-11-23T12:00:00Z"); +const FRESH_NETWORK_ISOLATION_JSON = JSON.stringify({ + checked_at: "2026-11-20T12:00:00Z", + effective: true, +}); const VALID_PASSWD = [ "root:x:0:0:root:/root:/bin/bash", @@ -39,6 +56,7 @@ function makeHealthyLinuxOptions(overrides: Partial = {}): { stateDir, statePaths.identityPath, statePaths.configPath, + statePaths.networkIsolationPath, DEFAULT_DOCTOR_PATHS.tegradServicePath, DEFAULT_DOCTOR_PATHS.updatePathUnitPath, DEFAULT_DOCTOR_PATHS.updateServiceUnitPath, @@ -60,6 +78,7 @@ function makeHealthyLinuxOptions(overrides: Partial = {}): { [DEFAULT_DOCTOR_PATHS.groupPath, VALID_GROUP], [DEFAULT_DOCTOR_PATHS.polkitRulePath, VALID_POLKIT_RULE], [DEFAULT_DOCTOR_PATHS.networkDropInPath, VALID_DROPIN], + [statePaths.networkIsolationPath, FRESH_NETWORK_ISOLATION_JSON], ]); const options: DoctorOptions = { @@ -67,6 +86,8 @@ function makeHealthyLinuxOptions(overrides: Partial = {}): { stateDir, serversDir: "/srv/tegrad-servers", inspectServers: () => [], + releasePublicKey: NON_PLACEHOLDER_RELEASE_KEY, + now: () => FIXED_NOW_MS, geteuid: () => 991, exists: (p) => existingFiles.has(p), statMode: (p) => { @@ -123,6 +144,8 @@ describe("tegrad doctor", () => { expect(getOutput()).toContain("OK group_membership:"); expect(getOutput()).toContain("OK systemd_service:"); expect(getOutput()).toContain("OK server_permissions:"); + expect(getOutput()).toContain("OK network_isolation:"); + expect(getOutput()).toContain("OK release_key:"); }); test("fails server_permissions and names the offending path when files are not usable by the server group", async () => { @@ -241,4 +264,131 @@ describe("tegrad doctor", () => { expect(getOutput()).toContain("FALHA unit_perms_service:"); expect(getOutput()).toContain("FALHA polkit_perms_rule:"); }); + + test("warns on release_key when binary embeds the public test release key", async () => { + const { options, getOutput } = makeHealthyLinuxOptions({ + releasePublicKey: getReleasePublicKey(), + }); + const code = await runDoctor(options); + expect(code).toBe(0); + expect(getOutput()).toContain("WARN release_key:"); + expect(getOutput()).toContain("auto-update is disabled"); + }); + + test("reports network_isolation as FALHA when effective is false, and INCONCLUSIVO when missing, null, invalid, or older than 30 days", async () => { + const statePaths = getStatePaths("/var/lib/tegrad"); + + // 1. effective: false -> FALHA + exit 1 + const failCase = makeHealthyLinuxOptions({ + readText: (p) => { + if (p === DEFAULT_DOCTOR_PATHS.passwdPath) return VALID_PASSWD; + if (p === DEFAULT_DOCTOR_PATHS.groupPath) return VALID_GROUP; + if (p === DEFAULT_DOCTOR_PATHS.polkitRulePath) return VALID_POLKIT_RULE; + if (p === DEFAULT_DOCTOR_PATHS.networkDropInPath) return VALID_DROPIN; + if (p === statePaths.networkIsolationPath) { + return JSON.stringify({ checked_at: "2026-11-22T00:00:00Z", effective: false }); + } + throw new Error(`ENOENT: ${p}`); + }, + }); + expect(await runDoctor(failCase.options)).toBe(1); + expect(failCase.getOutput()).toContain("FALHA network_isolation:"); + + // 2. effective: null -> INCONCLUSIVO + exit 0 + const nullCase = makeHealthyLinuxOptions({ + readText: (p) => { + if (p === DEFAULT_DOCTOR_PATHS.passwdPath) return VALID_PASSWD; + if (p === DEFAULT_DOCTOR_PATHS.groupPath) return VALID_GROUP; + if (p === DEFAULT_DOCTOR_PATHS.polkitRulePath) return VALID_POLKIT_RULE; + if (p === DEFAULT_DOCTOR_PATHS.networkDropInPath) return VALID_DROPIN; + if (p === statePaths.networkIsolationPath) { + return JSON.stringify({ checked_at: "2026-11-22T00:00:00Z", effective: null }); + } + throw new Error(`ENOENT: ${p}`); + }, + }); + expect(await runDoctor(nullCase.options)).toBe(0); + expect(nullCase.getOutput()).toContain("INCONCLUSIVO network_isolation:"); + + // 3. missing file -> INCONCLUSIVO + const baseMissing = makeHealthyLinuxOptions(); + const baseExists = baseMissing.options.exists; + const missingCase = makeHealthyLinuxOptions({ + exists: (p) => p !== statePaths.networkIsolationPath && (baseExists?.(p) ?? false), + }); + expect(await runDoctor(missingCase.options)).toBe(0); + expect(missingCase.getOutput()).toContain("INCONCLUSIVO network_isolation:"); + + // 4. older than 30 days -> INCONCLUSIVO + const staleTimestamp = new Date( + FIXED_NOW_MS - NETWORK_ISOLATION_MAX_AGE_MS - 1000, + ).toISOString(); + const staleCase = makeHealthyLinuxOptions({ + readText: (p) => { + if (p === DEFAULT_DOCTOR_PATHS.passwdPath) return VALID_PASSWD; + if (p === DEFAULT_DOCTOR_PATHS.groupPath) return VALID_GROUP; + if (p === DEFAULT_DOCTOR_PATHS.polkitRulePath) return VALID_POLKIT_RULE; + if (p === DEFAULT_DOCTOR_PATHS.networkDropInPath) return VALID_DROPIN; + if (p === statePaths.networkIsolationPath) { + return JSON.stringify({ checked_at: staleTimestamp, effective: true }); + } + throw new Error(`ENOENT: ${p}`); + }, + }); + expect(await runDoctor(staleCase.options)).toBe(0); + expect(staleCase.getOutput()).toContain("INCONCLUSIVO network_isolation:"); + expect(staleCase.getOutput()).toContain("30 days"); + }); + + test("checkNetworkIsolationStatus reads and validates a real temporary file on disk", () => { + const dir = mkdtempSync(join(tmpdir(), "tegrad-doctor-netiso-")); + try { + const filePath = join(dir, "network-isolation.json"); + const exists = (p: string) => existsSync(p); + const readText = (p: string) => readFileSync(p, "utf8"); + + // Missing + expect(checkNetworkIsolationStatus(filePath, exists, readText, FIXED_NOW_MS).status).toBe( + "INCONCLUSIVO", + ); + + // Valid effective: true (ISO string) + writeFileSync( + filePath, + JSON.stringify({ checked_at: "2026-11-22T12:00:00Z", effective: true }), + "utf8", + ); + expect(checkNetworkIsolationStatus(filePath, exists, readText, FIXED_NOW_MS).status).toBe( + "OK", + ); + + // Valid effective: false (numeric epoch ms) + writeFileSync( + filePath, + JSON.stringify({ checked_at: FIXED_NOW_MS - 1000, effective: false }), + "utf8", + ); + expect(checkNetworkIsolationStatus(filePath, exists, readText, FIXED_NOW_MS).status).toBe( + "FALHA", + ); + + // Corrupt JSON + writeFileSync(filePath, "{not-valid-json", "utf8"); + expect(checkNetworkIsolationStatus(filePath, exists, readText, FIXED_NOW_MS).status).toBe( + "INCONCLUSIVO", + ); + + // Unexpected extra field (strict schema) + writeFileSync( + filePath, + JSON.stringify({ checked_at: "2026-11-22T12:00:00Z", effective: true, extra: 1 }), + "utf8", + ); + expect(checkNetworkIsolationStatus(filePath, exists, readText, FIXED_NOW_MS).status).toBe( + "INCONCLUSIVO", + ); + } finally { + rmSync(dir, { recursive: true, force: true }); + } + }); }); diff --git a/src/cli/doctor.ts b/src/cli/doctor.ts index 63e6c1d..961a5af 100644 --- a/src/cli/doctor.ts +++ b/src/cli/doctor.ts @@ -3,7 +3,9 @@ import { existsSync, readdirSync, readFileSync, statSync } from "node:fs"; import { join } from "node:path"; +import { z } from "zod"; import { getStatePaths, type RunFixedResult, resolveStateDir, runFixed } from "../agent"; +import type { PublicKey } from "../crypto"; import { NETWORK_DENY_RANGES } from "../install/units"; import { inspectServersRoot, @@ -13,10 +15,25 @@ import { SERVER_TREE_PLAN, SHARED_TREE_PLAN, } from "../server/permissions"; +import { getReleasePublicKey, isPlaceholderReleaseKey } from "../update"; + +export const NETWORK_ISOLATION_MAX_AGE_MS = 30 * 24 * 60 * 60 * 1000; + +export const networkIsolationRecordSchema = z + .object({ + checked_at: z.union([z.string().min(1), z.number().int().nonnegative()]), + effective: z.boolean().nullable(), + }) + .strict(); + +export type NetworkIsolationRecord = z.infer; + +export type DoctorCheckStatus = "OK" | "WARN" | "INCONCLUSIVO" | "FALHA"; export interface DoctorCheckResult { readonly name: string; readonly ok: boolean; + readonly status?: DoctorCheckStatus; readonly detail: string; } @@ -69,6 +86,10 @@ export interface DoctorOptions { serversDir: string, serverGid: number | null, ) => readonly PermissionProblem[]; + /** Override embedded release public key (tests). */ + readonly releasePublicKey?: PublicKey; + /** Override current timestamp in ms (tests). */ + readonly now?: () => number; } interface PasswdEntry { @@ -181,6 +202,99 @@ function extractIpAddressDenyTokens(content: string): Set { return tokens; } +function parseCheckedAtMs(value: string | number): number | null { + if (typeof value === "number") { + return Number.isSafeInteger(value) && value >= 0 ? value : null; + } + const parsed = Date.parse(value); + return Number.isFinite(parsed) && parsed >= 0 ? parsed : null; +} + +export function checkNetworkIsolationStatus( + filePath: string, + exists: (p: string) => boolean, + readText: (p: string) => string, + nowMs: number, +): DoctorCheckResult { + if (!exists(filePath)) { + return { + name: "network_isolation", + ok: false, + status: "INCONCLUSIVO", + detail: `${filePath} not found (never tested; run install.sh to verify cgroup BPF IPAddressDeny enforcement)`, + }; + } + + let rawJson: unknown; + try { + rawJson = JSON.parse(readText(filePath)) as unknown; + } catch { + return { + name: "network_isolation", + ok: false, + status: "INCONCLUSIVO", + detail: `${filePath} could not be read or is not valid JSON (re-run install.sh)`, + }; + } + + const parsed = networkIsolationRecordSchema.safeParse(rawJson); + if (!parsed.success) { + return { + name: "network_isolation", + ok: false, + status: "INCONCLUSIVO", + detail: `${filePath} has an unexpected format (re-run install.sh)`, + }; + } + + const checkedAtMs = parseCheckedAtMs(parsed.data.checked_at); + if (checkedAtMs === null) { + return { + name: "network_isolation", + ok: false, + status: "INCONCLUSIVO", + detail: `${filePath} has an invalid checked_at timestamp (re-run install.sh)`, + }; + } + + if (parsed.data.effective === null) { + return { + name: "network_isolation", + ok: false, + status: "INCONCLUSIVO", + detail: + "network isolation self-test was skipped during installation (re-run install.sh with python3 or nc available)", + }; + } + + const ageMs = nowMs - checkedAtMs; + if (ageMs > NETWORK_ISOLATION_MAX_AGE_MS) { + return { + name: "network_isolation", + ok: false, + status: "INCONCLUSIVO", + detail: `last network isolation check is older than 30 days (${new Date(checkedAtMs).toISOString()}); re-run install.sh to refresh`, + }; + } + + if (!parsed.data.effective) { + return { + name: "network_isolation", + ok: false, + status: "FALHA", + detail: + "systemd IPAddressDeny is NOT effective on this kernel/container (cgroup BPF unavailable, e.g. LXC); servers can reach private networks", + }; + } + + return { + name: "network_isolation", + ok: true, + status: "OK", + detail: `systemd IPAddressDeny verified effective (checked ${new Date(checkedAtMs).toISOString()})`, + }; +} + export async function runDoctor(options: DoctorOptions = {}): Promise { const platform = options.platform ?? process.platform; const stdout = options.stdout ?? ((text: string) => process.stdout.write(text)); @@ -538,12 +652,36 @@ export async function runDoctor(options: DoctorOptions = {}): Promise { } } - let allOk = true; + // 9. Active network isolation result recorded by install.sh + const now = options.now ?? (() => Date.now()); + results.push( + checkNetworkIsolationStatus(statePaths.networkIsolationPath, exists, readText, now()), + ); + + // 10. Embedded release signing key (warn if build uses the public test key) + const releaseKey = options.releasePublicKey ?? getReleasePublicKey(); + if (isPlaceholderReleaseKey(releaseKey)) { + results.push({ + name: "release_key", + ok: false, + status: "WARN", + detail: "binary embeds the public test release key; auto-update is disabled in this build", + }); + } else { + results.push({ + name: "release_key", + ok: true, + status: "OK", + detail: "production release public key embedded", + }); + } + + let hasFailure = false; for (const item of results) { - const tag = item.ok ? "OK" : "FALHA"; - if (!item.ok) allOk = false; - stdout(`${tag.padEnd(5)} ${item.name}: ${item.detail}\n`); + const status: DoctorCheckStatus = item.status ?? (item.ok ? "OK" : "FALHA"); + if (status === "FALHA") hasFailure = true; + stdout(`${status.padEnd(5)} ${item.name}: ${item.detail}\n`); } - return allOk ? 0 : 1; + return hasFailure ? 1 : 0; } diff --git a/src/cli/main.ts b/src/cli/main.ts index 47559bc..e223d42 100644 --- a/src/cli/main.ts +++ b/src/cli/main.ts @@ -32,7 +32,10 @@ export interface CliDependencies { readonly stderr?: (text: string) => void; readonly geteuid?: () => number; readonly doctorOptions?: Omit; - readonly verifyUpdateOptions?: Pick; + readonly verifyUpdateOptions?: Pick< + VerifyReleaseBinaryOptions, + "publicKey" | "arch" | "env" | "allowTestKey" + >; readonly applyUpdateOptions?: Omit; readonly runAgent?: ( stateDir: string, @@ -157,6 +160,7 @@ export async function runCli(argv: readonly string[], deps: CliDependencies = {} const result = await verifyReleaseBinary({ binaryPath: opts.binary, + env, ...(manifestContent !== undefined ? { manifestContent } : {}), ...(sha256SumsContent !== undefined ? { sha256SumsContent } : {}), ...(sha256SumsSig !== undefined ? { sha256SumsSig } : {}), @@ -183,6 +187,7 @@ export async function runCli(argv: readonly string[], deps: CliDependencies = {} const { updateDir } = getStatePaths(stateDir); const result = await applyStagedUpdate({ updateDir, + env, ...(deps.applyUpdateOptions ?? {}), allowDowngrade: parsed.options.allowDowngrade, }); diff --git a/src/cli/run.ts b/src/cli/run.ts index 2611afa..096059c 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -265,6 +265,7 @@ export async function createAgentRuntime( const updater = createAutoUpdater({ stateDir: options.stateDir, + env, logger, ...(config.update?.channel !== undefined ? { channel: config.update.channel } : {}), ...(config.update?.auto !== undefined ? { auto: config.update.auto } : {}), diff --git a/src/install/units.test.ts b/src/install/units.test.ts index 2872b82..51c1c63 100644 --- a/src/install/units.test.ts +++ b/src/install/units.test.ts @@ -700,4 +700,178 @@ describe("Security regression checks on install/ assets", () => { expect(freshInactive.some((l) => l.includes("restart"))).toBe(false); }, ); + + test("install.sh defines active network isolation self-test and --require-network-isolation flag", () => { + const script = readInstallFile("install.sh"); + expect(script).toContain( + 'TEGRAD_NETWORK_ISOLATION_FILE="/var/lib/tegrad/network-isolation.json"', + ); + expect(script).toContain("--require-network-isolation"); + expect(script).toContain("run_network_isolation_selftest"); + expect(script).toContain("IPAddressDeny=any"); + expect(script).toContain("DynamicUser=yes"); + expect(script).toContain("Isolamento de rede verificado."); + expect(script).toContain("LXC"); + expect(script).toContain("BPF de cgroup"); + }); + + const netIsolationTest = shPath !== null ? test : test.skip; + + netIsolationTest( + "install.sh run_network_isolation_selftest handles blocked, connected, --require-network-isolation, and skipped cases with stubbed systemd-run", + async () => { + if (shPath === null) return; + const tmpDir = mkdtempSync(join(tmpdir(), "tegrad-netiso-selftest-")); + try { + const stubBinDir = join(tmpDir, "bin"); + const minBinDir = join(tmpDir, "min-bin"); + const argsLogPath = join(tmpDir, "systemd-run.args"); + const resultFile = join(tmpDir, "network-isolation.json"); + const toShellPath = (p: string) => { + const posix = p.replace(/\\/g, "/"); + return process.platform === "win32" + ? posix.replace(/^([A-Za-z]):\//, (_m, drive: string) => `/${drive.toLowerCase()}/`) + : posix; + }; + const scriptPath = toShellPath(join(INSTALL_DIR, "install.sh")); + const stubBinPosix = toShellPath(stubBinDir); + const minBinPosix = toShellPath(minBinDir); + const argsLogPosix = toShellPath(argsLogPath); + const resultPosix = toShellPath(resultFile); + + // Create stub systemd-run and systemctl scripts + const { chmodSync, mkdirSync } = await import("node:fs"); + mkdirSync(stubBinDir, { recursive: true }); + mkdirSync(minBinDir, { recursive: true }); + const systemdRunStub = join(stubBinDir, "systemd-run"); + writeFileSync( + systemdRunStub, + [ + "#!/bin/sh", + 'printf "%s\\n" "$*" > "$STUB_ARGS_LOG"', + 'exit "$STUB_SYSTEMD_RUN_EXIT"', + "", + ].join("\n"), + "utf8", + ); + const systemctlStub = join(stubBinDir, "systemctl"); + writeFileSync(systemctlStub, "#!/bin/sh\nexit 0\n", "utf8"); + + if (process.platform !== "win32") { + chmodSync(systemdRunStub, 0o755); + chmodSync(systemctlStub, 0o755); + } + + const runSelftest = async (opts: { + readonly requireFlag: 0 | 1; + readonly systemdRunExit?: number; + readonly hideSystemdRun?: boolean; + }) => { + const setupPathLines = + opts.hideSystemdRun === true + ? [ + '_orig_path="$PATH"', + "for _tool in date chmod mv id rm; do", + ' _tpath=$(PATH="$_orig_path" command -v "$_tool" 2>/dev/null || true)', + ' if [ -n "$_tpath" ]; then', + ' printf \'#!/bin/sh\\nexec "%s" "$@"\\n\' "$_tpath" > "$4/$_tool"', + ' chmod 0755 "$4/$_tool"', + " fi", + "done", + 'PATH="$4"', + "export PATH", + ] + : [`PATH="${stubBinPosix}:$PATH"`, "export PATH"]; + + const proc = Bun.spawn( + [ + shPath, + "-c", + [ + ...setupPathLines, + 'TEGRAD_INSTALL_SOURCE_ONLY=1 . "$1"', + 'run_network_isolation_selftest "$2" "$3"', + ].join("\n"), + "--", + scriptPath, + String(opts.requireFlag), + resultPosix, + minBinPosix, + ], + { + stdin: "ignore", + stdout: "pipe", + stderr: "pipe", + env: { + ...process.env, + STUB_ARGS_LOG: argsLogPosix, + STUB_SYSTEMD_RUN_EXIT: String(opts.systemdRunExit ?? 1), + }, + }, + ); + const [stdout, stderr, code] = await Promise.all([ + new Response(proc.stdout).text(), + new Response(proc.stderr).text(), + proc.exited, + ]); + return { stdout, stderr, code }; + }; + + // Case 1: Blocked (systemd-run exits 1) -> verified effective: true + const blocked = await runSelftest({ requireFlag: 0, systemdRunExit: 1 }); + expect(blocked.code).toBe(0); + expect(blocked.stderr).toBe(""); + expect(blocked.stdout).toContain("Isolamento de rede verificado."); + const blockedJson = JSON.parse(readFileSync(resultFile, "utf8")) as { + checked_at: string; + effective: boolean | null; + }; + expect(blockedJson.effective).toBe(true); + expect(Number.isFinite(Date.parse(blockedJson.checked_at))).toBe(true); + const loggedArgs = readFileSync(argsLogPath, "utf8"); + expect(loggedArgs).toContain("--wait"); + expect(loggedArgs).toContain("--collect"); + expect(loggedArgs).toContain("--pipe"); + expect(loggedArgs).toContain("-p IPAddressDeny=any"); + expect(loggedArgs).toContain("-p DynamicUser=yes"); + + // Case 2: Connected (systemd-run exits 0) without --require-network-isolation -> warns on stderr, exits 0, effective: false + const connectedWarn = await runSelftest({ requireFlag: 0, systemdRunExit: 0 }); + expect(connectedWarn.code).toBe(0); + expect(connectedWarn.stderr).toContain("LXC"); + expect(connectedWarn.stderr).toContain("BPF de cgroup"); + const connectedJson = JSON.parse(readFileSync(resultFile, "utf8")) as { + checked_at: string; + effective: boolean | null; + }; + expect(connectedJson.effective).toBe(false); + + // Case 3: Connected (systemd-run exits 0) WITH --require-network-isolation -> warns and exits non-zero + const connectedFail = await runSelftest({ requireFlag: 1, systemdRunExit: 0 }); + expect(connectedFail.code).not.toBe(0); + expect(connectedFail.stderr).toContain("LXC"); + expect(connectedFail.stderr).toContain("--require-network-isolation"); + const connectedFailJson = JSON.parse(readFileSync(resultFile, "utf8")) as { + checked_at: string; + effective: boolean | null; + }; + expect(connectedFailJson.effective).toBe(false); + + // Case 4: Skipped (systemd-run unavailable) -> writes effective: null, exits 0 unless --require-network-isolation + const skipped = await runSelftest({ requireFlag: 0, hideSystemdRun: true }); + expect(skipped.code).toBe(0); + expect(skipped.stdout).toContain("pulando autoteste de isolamento de rede"); + const skippedJson = JSON.parse(readFileSync(resultFile, "utf8")) as { + checked_at: string; + effective: boolean | null; + }; + expect(skippedJson.effective).toBeNull(); + + const skippedReq = await runSelftest({ requireFlag: 1, hideSystemdRun: true }); + expect(skippedReq.code).not.toBe(0); + } finally { + rmSync(tmpDir, { recursive: true, force: true }); + } + }, + ); }); diff --git a/src/update/apply.test.ts b/src/update/apply.test.ts index 3ea1cd2..72285cf 100644 --- a/src/update/apply.test.ts +++ b/src/update/apply.test.ts @@ -33,6 +33,7 @@ import { } from "./index"; const TEST_RELEASE_SEED = new Uint8Array(32).fill(0x42); +const ALLOW_TEST_KEY_ENV = { TEGRAD_ALLOW_TEST_RELEASE_KEY: "1" } as const; const tempDirs: string[] = []; @@ -148,6 +149,7 @@ describe("applyStagedUpdate (TOCTOU defense, verification, atomic install, rollb currentVersion: "0.1.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, stabilizeMs: 0, sleep: async () => {}, afterCopyBeforeVerifyHook: ({ updateDir, rootBinaryPath }) => { @@ -213,6 +215,7 @@ describe("applyStagedUpdate (TOCTOU defense, verification, atomic install, rollb currentVersion: "0.1.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, runCommand: async () => { restartCalled = true; return { code: 0, stdout: "active\n", stderr: "" }; @@ -245,6 +248,7 @@ describe("applyStagedUpdate (TOCTOU defense, verification, atomic install, rollb currentVersion: "0.1.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), }), ).rejects.toMatchObject({ code: "hash_mismatch" }); @@ -274,6 +278,7 @@ describe("applyStagedUpdate (TOCTOU defense, verification, atomic install, rollb currentVersion: "0.3.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), }), ).rejects.toMatchObject({ code: "downgrade_blocked" }); @@ -305,6 +310,7 @@ describe("applyStagedUpdate (TOCTOU defense, verification, atomic install, rollb currentVersion: "0.1.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, sleep: async () => {}, runCommand: async (cmd, args) => { restartLog1.push(`${cmd} ${args.join(" ")}`); @@ -346,6 +352,7 @@ describe("applyStagedUpdate (TOCTOU defense, verification, atomic install, rollb currentVersion: "0.1.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, stabilizeMs: 10, sleep: async () => {}, runCommand: async (_cmd, args) => { @@ -404,6 +411,7 @@ describe("applyStagedUpdate (TOCTOU defense, verification, atomic install, rollb currentVersion: "0.1.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), }); throw new Error("Expected unsafe_path"); @@ -440,6 +448,7 @@ describe("applyStagedUpdate (TOCTOU defense, verification, atomic install, rollb currentVersion: "0.1.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, stabilizeMs: 0, sleep: async () => {}, runCommand: async (_cmd, args) => @@ -512,6 +521,7 @@ describe("applyStagedUpdate (TOCTOU defense, verification, atomic install, rollb currentVersion: tc.currentVersion, arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, runCommand: async () => { systemctlCalled = true; return { code: 0, stdout: "active\n", stderr: "" }; @@ -552,6 +562,7 @@ describe("applyStagedUpdate (TOCTOU defense, verification, atomic install, rollb currentVersion: "0.1.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), }), ).rejects.toMatchObject({ code: "size_limit_exceeded" }); @@ -579,6 +590,7 @@ describe("applyStagedUpdate (TOCTOU defense, verification, atomic install, rollb currentVersion: "0.1.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), }), ).rejects.toMatchObject({ code: "size_limit_exceeded" }); @@ -604,6 +616,7 @@ describe("applyStagedUpdate (TOCTOU defense, verification, atomic install, rollb currentVersion: "0.1.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), }), ).rejects.toMatchObject({ code: "apply_failed" }); @@ -639,6 +652,7 @@ describe("applyStagedUpdate (TOCTOU defense, verification, atomic install, rollb currentVersion: "0.1.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), }), ).rejects.toMatchObject({ code: "unsafe_path" }); @@ -688,6 +702,7 @@ describe("applyStagedUpdate (TOCTOU defense, verification, atomic install, rollb currentVersion: "0.1.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), }), ).rejects.toMatchObject({ code: "unsafe_path" }); @@ -720,6 +735,7 @@ describe("applyStagedUpdate (TOCTOU defense, verification, atomic install, rollb currentVersion: "0.1.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), }), ).rejects.toMatchObject({ code: "unsafe_path" }); @@ -749,6 +765,7 @@ describe("applyStagedUpdate (TOCTOU defense, verification, atomic install, rollb currentVersion: "0.1.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, runCommand: async () => ({ code: 1, stdout: "", stderr: "systemd bus error" }), }), ).rejects.toMatchObject({ code: "rollback_failed" }); @@ -756,4 +773,81 @@ describe("applyStagedUpdate (TOCTOU defense, verification, atomic install, rollb // Even when systemctl restart failed during rollback, the previous binary was restored on disk expect(Buffer.compare(readFileSync(fx.binPath), Buffer.from(oldBytes))).toBe(0); }); + + test("refuses placeholder test release key unless TEGRAD_ALLOW_TEST_RELEASE_KEY=1, while non-placeholder keys succeed without the env var", async () => { + const testKeyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const prodKeyPair = generateSigningKeyPair(); + const oldBytes = new TextEncoder().encode("old-v0.1.0"); + const newBytes = new TextEncoder().encode("new-v0.2.0"); + + // 1. Test key without env var -> fails closed with placeholder_release_key + const rootDir1 = makeTempDir(); + const fx1 = stageFixture({ + rootDir: rootDir1, + currentBinaryBytes: oldBytes, + stagedBinaryBytes: newBytes, + manifestVersion: "0.2.0", + signingSecretKey: testKeyPair.secretKey, + }); + + await expect( + applyStagedUpdate({ + updateDir: fx1.updateDir, + binPath: fx1.binPath, + currentVersion: "0.1.0", + arch: "linux-x64", + env: {}, + runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), + }), + ).rejects.toMatchObject({ code: "placeholder_release_key" }); + expect(Buffer.compare(readFileSync(fx1.binPath), Buffer.from(oldBytes))).toBe(0); + + // 2. CLI apply-update without env var -> returns 1 + let cliErr = ""; + const refusedCli = await runCli(["apply-update"], { + env: {}, + applyUpdateOptions: { + updateDir: fx1.updateDir, + binPath: fx1.binPath, + currentVersion: "0.1.0", + arch: "linux-x64", + stabilizeMs: 0, + sleep: async () => {}, + runCommand: async () => ({ code: 0, stdout: "active\n", stderr: "" }), + }, + stdout: () => {}, + stderr: (t) => { + cliErr += t; + }, + }); + expect(refusedCli).toBe(1); + expect(cliErr).toContain("TEGRAD_ALLOW_TEST_RELEASE_KEY=1"); + + // 3. Non-placeholder key works normally without TEGRAD_ALLOW_TEST_RELEASE_KEY=1 + const rootDir2 = makeTempDir(); + const fx2 = stageFixture({ + rootDir: rootDir2, + currentBinaryBytes: oldBytes, + stagedBinaryBytes: newBytes, + manifestVersion: "0.2.0", + signingSecretKey: prodKeyPair.secretKey, + }); + + const applied = await applyStagedUpdate({ + updateDir: fx2.updateDir, + binPath: fx2.binPath, + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: prodKeyPair.publicKey, + env: {}, + stabilizeMs: 0, + sleep: async () => {}, + runCommand: async (_cmd, args) => + args[0] === "is-active" + ? { code: 0, stdout: "active\n", stderr: "" } + : { code: 0, stdout: "", stderr: "" }, + }); + expect(applied.applied).toBe(true); + expect(Buffer.compare(readFileSync(fx2.binPath), Buffer.from(newBytes))).toBe(0); + }); }); diff --git a/src/update/apply.ts b/src/update/apply.ts index b08e216..81dc3ad 100644 --- a/src/update/apply.ts +++ b/src/update/apply.ts @@ -27,6 +27,7 @@ import { VERSION } from "../version"; import { shouldUpdate } from "./channels"; import { UpdateError } from "./errors"; import { type ReleaseArch, type ReleaseManifest, verifyReleaseBinary } from "./manifest"; +import { assertReleaseKeyAllowed, getReleasePublicKey } from "./release-key"; import { MAX_BINARY_BYTES, MAX_MANIFEST_BYTES, @@ -261,6 +262,8 @@ export interface ApplyUpdateOptions { readonly currentVersion?: string; readonly arch?: ReleaseArch; readonly publicKey?: PublicKey; + readonly env?: Readonly>; + readonly allowTestKey?: boolean; readonly allowDowngrade?: boolean; readonly maxManifestBytes?: number; readonly maxBinaryBytes?: number; @@ -342,6 +345,12 @@ export async function applyStagedUpdate( ): Promise { await ready(); + const publicKey = options.publicKey ?? getReleasePublicKey(); + assertReleaseKeyAllowed(publicKey, { + ...(options.env !== undefined ? { env: options.env } : {}), + ...(options.allowTestKey !== undefined ? { allowTestKey: options.allowTestKey } : {}), + }); + const updateDir = options.updateDir ?? DEFAULT_UPDATE_DIR; const binPath = options.binPath ?? DEFAULT_BIN_PATH; const binDir = dirname(binPath); @@ -424,8 +433,10 @@ export async function applyStagedUpdate( const verified = await verifyReleaseBinary({ binaryPath: rootBinaryPath, manifestContent, + publicKey, ...(options.arch !== undefined ? { arch: options.arch } : {}), - ...(options.publicKey !== undefined ? { publicKey: options.publicKey } : {}), + ...(options.env !== undefined ? { env: options.env } : {}), + ...(options.allowTestKey !== undefined ? { allowTestKey: options.allowTestKey } : {}), }); if (verified.mode !== "manifest") { diff --git a/src/update/errors.ts b/src/update/errors.ts index 5d5ee58..d049ec0 100644 --- a/src/update/errors.ts +++ b/src/update/errors.ts @@ -6,6 +6,7 @@ export type UpdateErrorCode = | "invalid_manifest" | "bad_manifest_signature" | "bad_sums_signature" + | "placeholder_release_key" | "channel_mismatch" | "unsupported_arch" | "invalid_url" diff --git a/src/update/index.ts b/src/update/index.ts index dd94ac2..ca24ce2 100644 --- a/src/update/index.ts +++ b/src/update/index.ts @@ -60,10 +60,15 @@ export { verifySha256Sums, } from "./manifest"; export { + type AssertReleaseKeyOptions, + assertReleaseKeyAllowed, ed25519PublicKeyFromPem, ed25519PublicKeyToPem, getReleasePublicKey, + isPlaceholderReleaseKey, + isTestReleaseKeyAllowed, RELEASE_PUBLIC_KEY_BASE64URL, + TEST_RELEASE_PUBLIC_KEY_BASE64URL, } from "./release-key"; export { type AutoUpdater, diff --git a/src/update/manifest.test.ts b/src/update/manifest.test.ts index cccbb1f..bdcc274 100644 --- a/src/update/manifest.test.ts +++ b/src/update/manifest.test.ts @@ -20,10 +20,12 @@ import { ed25519PublicKeyToPem, formatSha256Sums, getReleasePublicKey, + isPlaceholderReleaseKey, MANIFEST_SCHEMA_VERSION, parseReleaseSigningKey, signManifest, signSha256Sums, + TEST_RELEASE_PUBLIC_KEY_BASE64URL, type UnsignedReleaseManifest, UpdateError, verifyManifest, @@ -34,6 +36,7 @@ import { // Deterministic test-only seed matching placeholder RELEASE_PUBLIC_KEY_BASE64URL. // Never store production signing keys or seeds in source code. const TEST_RELEASE_SEED = new Uint8Array(32).fill(0x42); +const ALLOW_TEST_KEY_ENV = { TEGRAD_ALLOW_TEST_RELEASE_KEY: "1" } as const; const tempDirs: string[] = []; @@ -93,8 +96,14 @@ function flipFirstBitBase64Url(b64u: string): string { describe("release key and PEM encoding", () => { test("placeholder release public key matches test seed and round-trips through Ed25519 SPKI PEM", () => { const testKeyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const otherKeyPair = generateSigningKeyPair(); const embedded = getReleasePublicKey(); + expect(toBase64Url(embedded)).toBe(TEST_RELEASE_PUBLIC_KEY_BASE64URL); expect(toBase64Url(embedded)).toBe(toBase64Url(testKeyPair.publicKey)); + expect(isPlaceholderReleaseKey(embedded)).toBe(true); + expect(isPlaceholderReleaseKey(TEST_RELEASE_PUBLIC_KEY_BASE64URL)).toBe(true); + expect(isPlaceholderReleaseKey(otherKeyPair.publicKey)).toBe(false); + expect(isPlaceholderReleaseKey(toBase64Url(otherKeyPair.publicKey))).toBe(false); const pem = ed25519PublicKeyToPem(embedded); expect(pem).toContain("-----BEGIN PUBLIC KEY-----"); @@ -105,6 +114,82 @@ describe("release key and PEM encoding", () => { const fromSecret = parseReleaseSigningKey(toBase64Url(testKeyPair.secretKey)); expect(toBase64Url(fromSecret.publicKey)).toBe(toBase64Url(embedded)); }); + + test("verifyManifest and verifyReleaseBinary fail closed with placeholder_release_key unless TEGRAD_ALLOW_TEST_RELEASE_KEY=1, while non-placeholder keys succeed without the env var", async () => { + const dir = makeTempDir(); + const testKeyPair = signingKeyPairFromSeed(TEST_RELEASE_SEED); + const prodKeyPair = generateSigningKeyPair(); + const x64 = new TextEncoder().encode("x64-binary-payload"); + const arm64 = new TextEncoder().encode("arm64-binary-payload"); + const x64Path = join(dir, "tegrad-linux-x64"); + writeFileSync(x64Path, x64); + + const testSigned = signManifest(makeSampleUnsignedManifest(x64, arm64), testKeyPair.secretKey); + const prodSigned = signManifest(makeSampleUnsignedManifest(x64, arm64), prodKeyPair.secretKey); + + // Without TEGRAD_ALLOW_TEST_RELEASE_KEY=1, test key is refused + expect(() => verifyManifest(testSigned, { env: {} })).toThrow(UpdateError); + try { + verifyManifest(testSigned, { env: {} }); + throw new Error("Expected placeholder_release_key"); + } catch (err) { + expect(err).toBeInstanceOf(UpdateError); + expect((err as UpdateError).code).toBe("placeholder_release_key"); + } + + await expect( + verifyReleaseBinary({ + binaryPath: x64Path, + manifestContent: JSON.stringify(testSigned), + arch: "linux-x64", + env: {}, + }), + ).rejects.toMatchObject({ code: "placeholder_release_key" }); + + // CLI verify-update also refuses without TEGRAD_ALLOW_TEST_RELEASE_KEY=1 + const manifestPath = join(dir, "stable.json"); + writeFileSync(manifestPath, JSON.stringify(testSigned), "utf8"); + let refusedErr = ""; + const refusedCode = await runCli( + ["verify-update", "--binary", x64Path, "--manifest", manifestPath], + { + env: {}, + verifyUpdateOptions: { arch: "linux-x64" }, + stdout: () => {}, + stderr: (t) => { + refusedErr += t; + }, + }, + ); + expect(refusedCode).toBe(1); + expect(refusedErr).toContain("TEGRAD_ALLOW_TEST_RELEASE_KEY=1"); + + // With TEGRAD_ALLOW_TEST_RELEASE_KEY=1, test key is accepted + expect(verifyManifest(testSigned, { env: ALLOW_TEST_KEY_ENV }).version).toBe("0.2.0"); + const allowedCode = await runCli( + ["verify-update", "--binary", x64Path, "--manifest", manifestPath], + { + env: ALLOW_TEST_KEY_ENV, + verifyUpdateOptions: { arch: "linux-x64" }, + stdout: () => {}, + stderr: () => {}, + }, + ); + expect(allowedCode).toBe(0); + + // Non-placeholder key works normally without TEGRAD_ALLOW_TEST_RELEASE_KEY=1 + expect(verifyManifest(prodSigned, { publicKey: prodKeyPair.publicKey, env: {} }).version).toBe( + "0.2.0", + ); + const prodRes = await verifyReleaseBinary({ + binaryPath: x64Path, + manifestContent: JSON.stringify(prodSigned), + arch: "linux-x64", + publicKey: prodKeyPair.publicKey, + env: {}, + }); + expect(prodRes.ok).toBe(true); + }); }); describe("Ed25519 release manifest and SHA256SUMS signing/verification", () => { @@ -115,31 +200,37 @@ describe("Ed25519 release manifest and SHA256SUMS signing/verification", () => { const arm64 = new TextEncoder().encode("arm64-binary-payload"); const signed = signManifest(makeSampleUnsignedManifest(x64, arm64), keyPair.secretKey); - const verified = verifyManifest(signed, { expectedChannel: "stable" }); + const verified = verifyManifest(signed, { expectedChannel: "stable", env: ALLOW_TEST_KEY_ENV }); expect(verified.version).toBe("0.2.0"); // 1-bit flip in signature - expect(() => verifyManifest({ ...signed, sig: flipFirstBitBase64Url(signed.sig) })).toThrow( - UpdateError, - ); + expect(() => + verifyManifest( + { ...signed, sig: flipFirstBitBase64Url(signed.sig) }, + { env: ALLOW_TEST_KEY_ENV }, + ), + ).toThrow(UpdateError); // Tampered version - expect(() => verifyManifest({ ...signed, version: "0.2.1", tag: "v0.2.1" })).toThrow( - UpdateError, - ); + expect(() => + verifyManifest({ ...signed, version: "0.2.1", tag: "v0.2.1" }, { env: ALLOW_TEST_KEY_ENV }), + ).toThrow(UpdateError); // Tampered asset URL expect(() => - verifyManifest({ - ...signed, - assets: { - ...signed.assets, - "linux-x64": { - ...signed.assets["linux-x64"], - url: "https://evil.example/tegrad-linux-x64", + verifyManifest( + { + ...signed, + assets: { + ...signed.assets, + "linux-x64": { + ...signed.assets["linux-x64"], + url: "https://evil.example/tegrad-linux-x64", + }, }, }, - }), + { env: ALLOW_TEST_KEY_ENV }, + ), ).toThrow(UpdateError); // Tampered asset sha256 (1 nibble changed) @@ -147,22 +238,25 @@ describe("Ed25519 release manifest and SHA256SUMS signing/verification", () => { (signed.assets["linux-x64"].sha256.startsWith("0") ? "1" : "0") + signed.assets["linux-x64"].sha256.slice(1); expect(() => - verifyManifest({ - ...signed, - assets: { - ...signed.assets, - "linux-x64": { - ...signed.assets["linux-x64"], - sha256: badHash, + verifyManifest( + { + ...signed, + assets: { + ...signed.assets, + "linux-x64": { + ...signed.assets["linux-x64"], + sha256: badHash, + }, }, }, - }), + { env: ALLOW_TEST_KEY_ENV }, + ), ).toThrow(UpdateError); // Signed by attacker key const attackerSigned = signManifest(makeSampleUnsignedManifest(x64, arm64), attacker.secretKey); try { - verifyManifest(attackerSigned, { publicKey: keyPair.publicKey }); + verifyManifest(attackerSigned, { publicKey: keyPair.publicKey, env: ALLOW_TEST_KEY_ENV }); throw new Error("Expected bad_manifest_signature"); } catch (err) { expect(err).toBeInstanceOf(UpdateError); @@ -171,7 +265,11 @@ describe("Ed25519 release manifest and SHA256SUMS signing/verification", () => { // Channel mismatch fails closed try { - verifyManifest(signed, { publicKey: keyPair.publicKey, expectedChannel: "beta" }); + verifyManifest(signed, { + publicKey: keyPair.publicKey, + expectedChannel: "beta", + env: ALLOW_TEST_KEY_ENV, + }); throw new Error("Expected channel_mismatch"); } catch (err) { expect(err).toBeInstanceOf(UpdateError); @@ -229,6 +327,7 @@ describe("Ed25519 release manifest and SHA256SUMS signing/verification", () => { manifestContent: manifestText, arch: "linux-x64", expectedChannel: "beta", + env: ALLOW_TEST_KEY_ENV, }); expect(v1.ok).toBe(true); expect(v1.mode).toBe("manifest"); @@ -238,6 +337,7 @@ describe("Ed25519 release manifest and SHA256SUMS signing/verification", () => { sha256SumsContent: sumsText, sha256SumsSig: sigText, expectedAssetName: "tegrad-linux-arm64", + env: ALLOW_TEST_KEY_ENV, }); expect(v2.ok).toBe(true); expect(v2.mode).toBe("sums"); @@ -248,6 +348,7 @@ describe("Ed25519 release manifest and SHA256SUMS signing/verification", () => { const code1 = await runCli( ["verify-update", "--binary", x64Path, "--manifest", res.manifestPath, "--channel", "beta"], { + env: ALLOW_TEST_KEY_ENV, verifyUpdateOptions: { arch: "linux-x64" }, stdout: (t) => { cliOut += t; @@ -274,6 +375,7 @@ describe("Ed25519 release manifest and SHA256SUMS signing/verification", () => { "tegrad-linux-arm64", ], { + env: ALLOW_TEST_KEY_ENV, stdout: () => {}, stderr: () => {}, }, @@ -286,6 +388,7 @@ describe("Ed25519 release manifest and SHA256SUMS signing/verification", () => { const failCode = await runCli( ["verify-update", "--binary", x64Path, "--manifest", res.manifestPath], { + env: ALLOW_TEST_KEY_ENV, verifyUpdateOptions: { arch: "linux-x64" }, stdout: () => {}, stderr: (t) => { diff --git a/src/update/manifest.ts b/src/update/manifest.ts index d34f472..088a13b 100644 --- a/src/update/manifest.ts +++ b/src/update/manifest.ts @@ -29,7 +29,7 @@ import { releaseChannelSchema, } from "./channels"; import { UpdateError } from "./errors"; -import { getReleasePublicKey } from "./release-key"; +import { assertReleaseKeyAllowed, getReleasePublicKey } from "./release-key"; const utf8Encoder = new TextEncoder(); @@ -212,15 +212,22 @@ export function signManifest( export interface VerifyManifestOptions { readonly publicKey?: PublicKey; readonly expectedChannel?: ReleaseChannel; + readonly env?: Readonly>; + readonly allowTestKey?: boolean; } export function verifyManifest(raw: unknown, options: VerifyManifestOptions = {}): ReleaseManifest { + const publicKey = options.publicKey ?? getReleasePublicKey(); + assertReleaseKeyAllowed(publicKey, { + ...(options.env !== undefined ? { env: options.env } : {}), + ...(options.allowTestKey !== undefined ? { allowTestKey: options.allowTestKey } : {}), + }); + const parsed = releaseManifestSchema.safeParse(raw); if (!parsed.success) { throw new UpdateError("invalid_manifest", "Release manifest failed schema validation"); } - const publicKey = options.publicKey ?? getReleasePublicKey(); const { sig, ...unsigned } = parsed.data; let sigBytes: Uint8Array; @@ -345,6 +352,8 @@ export interface VerifyReleaseBinaryOptions { readonly sha256SumsSig?: string; readonly publicKey?: PublicKey; readonly expectedChannel?: ReleaseChannel; + readonly env?: Readonly>; + readonly allowTestKey?: boolean; } export type VerifyReleaseBinaryResult = @@ -369,6 +378,10 @@ export async function verifyReleaseBinary( ): Promise { await ready(); const publicKey = options.publicKey ?? getReleasePublicKey(); + assertReleaseKeyAllowed(publicKey, { + ...(options.env !== undefined ? { env: options.env } : {}), + ...(options.allowTestKey !== undefined ? { allowTestKey: options.allowTestKey } : {}), + }); if (options.manifestContent !== undefined) { let rawManifest: unknown; @@ -393,6 +406,8 @@ export async function verifyReleaseBinary( ...(options.expectedChannel !== undefined ? { expectedChannel: options.expectedChannel } : {}), + ...(options.env !== undefined ? { env: options.env } : {}), + ...(options.allowTestKey !== undefined ? { allowTestKey: options.allowTestKey } : {}), }); const archFromName = diff --git a/src/update/release-key.ts b/src/update/release-key.ts index 173f721..5d77a3c 100644 --- a/src/update/release-key.ts +++ b/src/update/release-key.ts @@ -1,11 +1,78 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda +import { z } from "zod"; import { fromBase64Url, type PublicKey, SIGNING_PUBLIC_KEY_BYTES } from "../crypto"; import { UpdateError } from "./errors"; +/** + * Public key derived from the well-known development seed (32 bytes of 0x42). + * Never trusted in production builds unless TEGRAD_ALLOW_TEST_RELEASE_KEY=1 is explicitly set. + */ +export const TEST_RELEASE_PUBLIC_KEY_BASE64URL = "IVL40Zt5HSRFMkLhXy6rbLfP-ntqXtMAl5YOBpiB2xI"; + // TODO(release-key): replace placeholder test public key with production offline Ed25519 release signing public key before first public release. -export const RELEASE_PUBLIC_KEY_BASE64URL = "IVL40Zt5HSRFMkLhXy6rbLfP-ntqXtMAl5YOBpiB2xI"; +export const RELEASE_PUBLIC_KEY_BASE64URL: string = "IVL40Zt5HSRFMkLhXy6rbLfP-ntqXtMAl5YOBpiB2xI"; + +const releaseKeyEnvSchema = z.object({ + TEGRAD_ALLOW_TEST_RELEASE_KEY: z.string().optional(), +}); + +let cachedTestReleasePublicKey: PublicKey | null = null; + +function getTestReleasePublicKeyBytes(): PublicKey { + if (cachedTestReleasePublicKey === null) { + cachedTestReleasePublicKey = fromBase64Url(TEST_RELEASE_PUBLIC_KEY_BASE64URL); + } + return cachedTestReleasePublicKey; +} + +export function isPlaceholderReleaseKey( + publicKey: PublicKey | string = RELEASE_PUBLIC_KEY_BASE64URL, +): boolean { + if (typeof publicKey === "string") { + return publicKey.trim() === TEST_RELEASE_PUBLIC_KEY_BASE64URL; + } + const testKey = getTestReleasePublicKeyBytes(); + if (publicKey.length !== testKey.length) { + return false; + } + let diff = 0; + for (let i = 0; i < testKey.length; i++) { + diff |= (publicKey[i] ?? 0) ^ (testKey[i] ?? 0); + } + return diff === 0; +} + +export function isTestReleaseKeyAllowed( + env: Readonly> = process.env, +): boolean { + const parsed = releaseKeyEnvSchema.parse({ + TEGRAD_ALLOW_TEST_RELEASE_KEY: env.TEGRAD_ALLOW_TEST_RELEASE_KEY, + }); + return parsed.TEGRAD_ALLOW_TEST_RELEASE_KEY === "1"; +} + +export interface AssertReleaseKeyOptions { + readonly env?: Readonly>; + readonly allowTestKey?: boolean; +} + +export function assertReleaseKeyAllowed( + publicKey: PublicKey, + options: AssertReleaseKeyOptions = {}, +): void { + if (!isPlaceholderReleaseKey(publicKey)) { + return; + } + if (options.allowTestKey === true || isTestReleaseKeyAllowed(options.env)) { + return; + } + throw new UpdateError( + "placeholder_release_key", + "Refusing update: this build embeds the public test release key; auto-update is disabled (set TEGRAD_ALLOW_TEST_RELEASE_KEY=1 for local development only)", + ); +} /** * Fixed 12-byte ASN.1 DER SubjectPublicKeyInfo prefix for Ed25519 (OID 1.3.101.112). diff --git a/src/update/updater.test.ts b/src/update/updater.test.ts index 6224934..289e268 100644 --- a/src/update/updater.test.ts +++ b/src/update/updater.test.ts @@ -33,6 +33,7 @@ import { } from "./index"; const TEST_RELEASE_SEED = new Uint8Array(32).fill(0x42); +const ALLOW_TEST_KEY_ENV = { TEGRAD_ALLOW_TEST_RELEASE_KEY: "1" } as const; const tempDirs: string[] = []; @@ -99,6 +100,7 @@ describe("updater (checkForUpdate and createAutoUpdater)", () => { currentVersion: "0.1.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, now: () => 1_795_300_123_000, fetch: async (input) => { const url = String(input); @@ -158,6 +160,7 @@ describe("updater (checkForUpdate and createAutoUpdater)", () => { channel: "stable", currentVersion: "0.1.0", arch: "linux-x64", + env: ALLOW_TEST_KEY_ENV, fetch: async (input) => { const url = String(input); fetchedUrls.push(url); @@ -192,6 +195,7 @@ describe("updater (checkForUpdate and createAutoUpdater)", () => { currentVersion: "0.1.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, fetch: async (input) => { const url = String(input); if (url.endsWith("/stable.json")) { @@ -223,6 +227,7 @@ describe("updater (checkForUpdate and createAutoUpdater)", () => { manifestBaseUrl: "http://github.com/codebyant/tegrad/releases/latest/download", currentVersion: "0.1.0", arch: "linux-x64", + env: ALLOW_TEST_KEY_ENV, fetch: async () => new Response("{}", { status: 200 }), }), ).rejects.toMatchObject({ code: "invalid_url" }); @@ -244,6 +249,7 @@ describe("updater (checkForUpdate and createAutoUpdater)", () => { currentVersion: "0.1.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, fetch: async (input) => { if (String(input).endsWith("/stable.json")) { return new Response(JSON.stringify(badHostManifest), { status: 200 }); @@ -278,6 +284,7 @@ describe("updater (checkForUpdate and createAutoUpdater)", () => { currentVersion: "0.2.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, fetch: fakeFetch, }); expect(resBlocked.status).toBe("up_to_date"); @@ -290,6 +297,7 @@ describe("updater (checkForUpdate and createAutoUpdater)", () => { allowDowngrade: true, arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, fetch: fakeFetch, }); expect(resAllowed.status).toBe("staged"); @@ -404,6 +412,7 @@ describe("updater (checkForUpdate and createAutoUpdater)", () => { currentVersion: "0.1.0", arch: "linux-x64", publicKey: keyPair.publicKey, + env: ALLOW_TEST_KEY_ENV, fetch: async (input) => { const url = String(input); if (url.endsWith("/stable.json")) { @@ -421,4 +430,48 @@ describe("updater (checkForUpdate and createAutoUpdater)", () => { const { updateDir } = getStatePaths(stateDir); expect(existsSync(join(updateDir, READY_FILE_NAME))).toBe(false); }); + + test("refuses placeholder test release key before fetching unless TEGRAD_ALLOW_TEST_RELEASE_KEY=1, while non-placeholder keys succeed without the env var", async () => { + const stateDir = makeTempDir(); + const prodKeyPair = generateSigningKeyPair(); + const binBytes = new TextEncoder().encode("prod-signed-binary"); + const prodManifest = buildSignedManifest("0.2.0", "stable", binBytes, prodKeyPair.secretKey); + + let fetchCalled = false; + await expect( + checkForUpdate({ + stateDir, + channel: "stable", + currentVersion: "0.1.0", + arch: "linux-x64", + env: {}, + fetch: async () => { + fetchCalled = true; + return new Response("{}", { status: 200 }); + }, + }), + ).rejects.toMatchObject({ code: "placeholder_release_key" }); + expect(fetchCalled).toBe(false); + + // Non-placeholder key works normally without TEGRAD_ALLOW_TEST_RELEASE_KEY=1 + const res = await checkForUpdate({ + stateDir, + channel: "stable", + currentVersion: "0.1.0", + arch: "linux-x64", + publicKey: prodKeyPair.publicKey, + env: {}, + fetch: async (input) => { + const url = String(input); + if (url.endsWith("/stable.json")) { + return new Response(JSON.stringify(prodManifest), { status: 200 }); + } + return new Response(binBytes, { + status: 200, + headers: { "content-length": String(binBytes.byteLength) }, + }); + }, + }); + expect(res.status).toBe("staged"); + }); }); diff --git a/src/update/updater.ts b/src/update/updater.ts index c257903..1cba33c 100644 --- a/src/update/updater.ts +++ b/src/update/updater.ts @@ -36,6 +36,7 @@ import { resolveReleaseArch, verifyManifest, } from "./manifest"; +import { assertReleaseKeyAllowed, getReleasePublicKey } from "./release-key"; export const DEFAULT_UPDATE_CHANNEL: ReleaseChannel = "stable"; export const DEFAULT_UPDATE_INTERVAL_MS = 6 * 60 * 60 * 1000; @@ -370,6 +371,8 @@ export interface CheckForUpdateOptions { readonly allowDowngrade?: boolean; readonly arch?: ReleaseArch; readonly publicKey?: PublicKey; + readonly env?: Readonly>; + readonly allowTestKey?: boolean; readonly allowedHosts?: readonly string[]; readonly maxManifestBytes?: number; readonly maxBinaryBytes?: number; @@ -406,6 +409,12 @@ export async function checkForUpdate( ): Promise { await ready(); + const publicKey = options.publicKey ?? getReleasePublicKey(); + assertReleaseKeyAllowed(publicKey, { + ...(options.env !== undefined ? { env: options.env } : {}), + ...(options.allowTestKey !== undefined ? { allowTestKey: options.allowTestKey } : {}), + }); + const channel = options.channel ?? DEFAULT_UPDATE_CHANNEL; const currentVersion = options.currentVersion ?? VERSION; const manifestBaseUrl = options.manifestBaseUrl ?? DEFAULT_MANIFEST_BASE_URL; @@ -449,7 +458,9 @@ export async function checkForUpdate( // 2. Verify Ed25519 signature BEFORE trusting any field in the manifest const manifest: ReleaseManifest = verifyManifest(rawManifest, { expectedChannel: channel, - ...(options.publicKey !== undefined ? { publicKey: options.publicKey } : {}), + publicKey, + ...(options.env !== undefined ? { env: options.env } : {}), + ...(options.allowTestKey !== undefined ? { allowTestKey: options.allowTestKey } : {}), }); // 3. Compare versions From ea2e4824d2da576a90c10fe5b3d490813013798b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Mon, 23 Nov 2026 15:05:30 -0300 Subject: [PATCH 30/59] fix: silence shellcheck SC2016 for intentional inner bash arg expansion --- install/install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install/install.sh b/install/install.sh index 8f0a28c..f60005b 100755 --- a/install/install.sh +++ b/install/install.sh @@ -847,6 +847,8 @@ run_network_isolation_probe() { >/dev/null 2>&1 ;; bash) + # $1 is intentionally expanded by the inner bash process, not this shell + # shellcheck disable=SC2016 systemd-run \ --wait \ --collect \ From 1103bc5195e7ce49e1108ae45b7d7632b5447e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Tue, 24 Nov 2026 00:54:16 -0300 Subject: [PATCH 31/59] feat: add host.info read command and export protocol schemas --- .../{index-98zvzvsw.js => index-3rwb7776.js} | 190 +++++---- lib/protocol/index.js | 12 +- lib/types/protocol/commands/host.d.ts | 14 + lib/types/protocol/index.d.ts | 1 + lib/vault/index.js | 2 +- scripts/smoke-lib.ts | 14 +- src/agent/host-info.test.ts | 371 ++++++++++++++++++ src/agent/host-info.ts | 35 ++ src/agent/index.ts | 1 + src/agent/jobs.ts | 9 + src/protocol/commands/core.ts | 17 +- src/protocol/commands/host.ts | 29 ++ src/protocol/index.ts | 9 + src/protocol/phase3.test.ts | 2 + 14 files changed, 611 insertions(+), 95 deletions(-) rename lib/chunks/{index-98zvzvsw.js => index-3rwb7776.js} (90%) create mode 100644 lib/types/protocol/commands/host.d.ts create mode 100644 src/agent/host-info.test.ts create mode 100644 src/agent/host-info.ts create mode 100644 src/protocol/commands/host.ts diff --git a/lib/chunks/index-98zvzvsw.js b/lib/chunks/index-3rwb7776.js similarity index 90% rename from lib/chunks/index-98zvzvsw.js rename to lib/chunks/index-3rwb7776.js index 7be7e68..3fdbdcd 100644 --- a/lib/chunks/index-98zvzvsw.js +++ b/lib/chunks/index-3rwb7776.js @@ -1180,7 +1180,7 @@ function registerBackupCommands(registry) { return registry.registerAll(BACKUP_COMMANDS); } // src/protocol/commands/core.ts -import { z as z11 } from "zod"; +import { z as z12 } from "zod"; // src/protocol/commands/files.ts import { z as z7 } from "zod"; @@ -1402,13 +1402,33 @@ function registerFilesCommands(registry) { return registry.registerAll(FILES_COMMANDS); } -// src/protocol/commands/pairing.ts +// src/protocol/commands/host.ts import { z as z8 } from "zod"; +var hostInfoBodySchema = z8.object({}).strict(); +var hostInfoResultSchema = z8.object({ + memory_total_mb: z8.number().int().nonnegative(), + memory_available_mb: z8.number().int().nonnegative(), + cpu_count: z8.number().int().positive(), + reserved_memory_mb: z8.number().int().nonnegative() +}); +var hostInfoCommand = defineCommand({ + type: "host.info", + sensitive: false, + minRole: "viewer", + body: hostInfoBodySchema +}); +var HOST_COMMANDS = [hostInfoCommand]; +function registerHostCommands(registry) { + return registry.registerAll(HOST_COMMANDS); +} + +// src/protocol/commands/pairing.ts +import { z as z9 } from "zod"; var agentRevocationsSetCommand = defineCommand({ type: "agent.revocations.set", sensitive: false, minRole: "admin", - body: z8.object({ + body: z9.object({ list: revocationListSchema }) }); @@ -1418,18 +1438,18 @@ function registerPairingCommands(registry) { } // src/protocol/commands/state.ts -import { z as z9 } from "zod"; +import { z as z10 } from "zod"; var SHA1_HEX_PATTERN = /^[0-9a-f]{40}$/i; var SHA512_HEX_PATTERN = /^[0-9a-f]{128}$/i; -var sha1HexSchema = z9.string().regex(SHA1_HEX_PATTERN, "Expected 40 hex characters").transform((v) => v.toLowerCase()); -var sha512HexSchema = z9.string().regex(SHA512_HEX_PATTERN, "Expected 128 hex characters").transform((v) => v.toLowerCase()); -var modSourceSchema = z9.enum(["modrinth", "curseforge", "tegra", "local"]); -var modLayerSchema = z9.enum(["origin", "user"]); +var sha1HexSchema = z10.string().regex(SHA1_HEX_PATTERN, "Expected 40 hex characters").transform((v) => v.toLowerCase()); +var sha512HexSchema = z10.string().regex(SHA512_HEX_PATTERN, "Expected 128 hex characters").transform((v) => v.toLowerCase()); +var modSourceSchema = z10.enum(["modrinth", "curseforge", "tegra", "local"]); +var modLayerSchema = z10.enum(["origin", "user"]); var MOD_UNSAFE_UNICODE_REGEX = /(?:\p{Cc}|\p{Cf}|\u034F|\u180E|\u2028|\u2029|\u3164|\uFFA0)/u; var MOD_ENCODED_TRAVERSAL_REGEX = /%(?:2f|5c|00)/i; var MOD_RESERVED_WINDOWS_REGEX = /^(?:CON|PRN|AUX|NUL|COM[1-9¹²³]|LPT[1-9¹²³]|CONIN\$|CONOUT\$|CLOCK\$)\s*(?:\.|$)/i; var MOD_FORBIDDEN_NAMES = new Set([".runtime", ".tegrad-uploads"]); -var modFileNameSchema = z9.string().min(1).max(255).refine((name) => { +var modFileNameSchema = z10.string().min(1).max(255).refine((name) => { if (name.includes("/") || name.includes("\\") || name.includes("\x00") || name.includes(":") || name === "." || name === ".." || name.endsWith(".") || name.endsWith(" ")) { return false; } @@ -1445,101 +1465,101 @@ var modFileNameSchema = z9.string().min(1).max(255).refine((name) => { } return new TextEncoder().encode(name).byteLength <= 255; }, { message: "Mod filename must be a single safe filename" }); -var serverModEntrySchema = z9.object({ +var serverModEntrySchema = z10.object({ file: modFileNameSchema, source: modSourceSchema, - project_id: z9.string().min(1).max(128).optional(), - version_id: z9.string().min(1).max(128).optional(), + project_id: z10.string().min(1).max(128).optional(), + version_id: z10.string().min(1).max(128).optional(), sha1: sha1HexSchema.optional(), sha256: sha256HexSchema.optional(), sha512: sha512HexSchema.optional(), layer: modLayerSchema }).strict(); -var serverOriginSchema = z9.discriminatedUnion("kind", [ - z9.object({ - kind: z9.literal("modpack"), +var serverOriginSchema = z10.discriminatedUnion("kind", [ + z10.object({ + kind: z10.literal("modpack"), source: modSourceSchema, - modpack_id: z9.string().min(1).max(128), - version_id: z9.string().min(1).max(128) + modpack_id: z10.string().min(1).max(128), + version_id: z10.string().min(1).max(128) }).strict(), - z9.object({ - kind: z9.literal("local"), - note: z9.string().max(512).optional() + z10.object({ + kind: z10.literal("local"), + note: z10.string().max(512).optional() }).strict() ]).nullable(); -var serverOriginSyncStateSchema = z9.object({ - excluded_mod_keys: z9.array(z9.string().min(1).max(256)).max(4000), - synced_mod_keys: z9.array(z9.string().min(1).max(256)).max(4000), - removed_origin_files: z9.array(z9.string().min(1).max(1024)).max(5000).optional(), - synced_files: z9.array(z9.string().min(1).max(1024)).max(5000).optional(), - last_synced_at: z9.string().nullable().optional(), - last_synced_version_id: z9.string().min(1).max(128).nullable().optional() +var serverOriginSyncStateSchema = z10.object({ + excluded_mod_keys: z10.array(z10.string().min(1).max(256)).max(4000), + synced_mod_keys: z10.array(z10.string().min(1).max(256)).max(4000), + removed_origin_files: z10.array(z10.string().min(1).max(1024)).max(5000).optional(), + synced_files: z10.array(z10.string().min(1).max(1024)).max(5000).optional(), + last_synced_at: z10.string().nullable().optional(), + last_synced_version_id: z10.string().min(1).max(128).nullable().optional() }).strict(); -var modEnvironmentInfoSchema = z9.object({ - client: z9.enum(["required", "optional", "unsupported", "unknown"]).optional(), - server: z9.enum(["required", "optional", "unsupported", "unknown"]).optional() +var modEnvironmentInfoSchema = z10.object({ + client: z10.enum(["required", "optional", "unsupported", "unknown"]).optional(), + server: z10.enum(["required", "optional", "unsupported", "unknown"]).optional() }).strict(); -var originPlanModInputSchema = z9.object({ - key: z9.string().min(1).max(256), +var originPlanModInputSchema = z10.object({ + key: z10.string().min(1).max(256), file: modFileNameSchema, - name: z9.string().min(1).max(256).optional(), - enabled: z9.boolean().optional(), + name: z10.string().min(1).max(256).optional(), + enabled: z10.boolean().optional(), source: modSourceSchema.optional(), - project_id: z9.string().min(1).max(128).optional(), - version_id: z9.string().min(1).max(128).optional(), - url: z9.string().url().max(2048).optional(), + project_id: z10.string().min(1).max(128).optional(), + version_id: z10.string().min(1).max(128).optional(), + url: z10.string().url().max(2048).optional(), sha1: sha1HexSchema.optional(), sha256: sha256HexSchema.optional(), sha512: sha512HexSchema.optional(), environment: modEnvironmentInfoSchema.optional() }).strict(); -var originPlanFileInputSchema = z9.object({ - path: z9.string().min(1).max(1024), +var originPlanFileInputSchema = z10.object({ + path: z10.string().min(1).max(1024), sha1: sha1HexSchema, sha256: sha256HexSchema.optional(), - size_bytes: z9.number().int().nonnegative(), - url: z9.string().url().max(2048).optional(), - content_base64: z9.string().optional() + size_bytes: z10.number().int().nonnegative(), + url: z10.string().url().max(2048).optional(), + content_base64: z10.string().optional() }).strict(); -var serverModsListBodySchema = z9.object({ +var serverModsListBodySchema = z10.object({ server_id: serverIdSchema }).strict(); -var serverModsInstallBodySchema = z9.object({ +var serverModsInstallBodySchema = z10.object({ server_id: serverIdSchema, file: modFileNameSchema, - url: z9.string().url().max(2048), + url: z10.string().url().max(2048), source: modSourceSchema, - project_id: z9.string().min(1).max(128).optional(), - version_id: z9.string().min(1).max(128).optional(), + project_id: z10.string().min(1).max(128).optional(), + version_id: z10.string().min(1).max(128).optional(), sha1: sha1HexSchema.optional(), sha256: sha256HexSchema.optional(), sha512: sha512HexSchema.optional() }).strict(); -var serverModsRemoveBodySchema = z9.object({ +var serverModsRemoveBodySchema = z10.object({ server_id: serverIdSchema, file: modFileNameSchema }).strict(); -var serverOriginPlanBodySchema = z9.object({ +var serverOriginPlanBodySchema = z10.object({ server_id: serverIdSchema, - to_version_id: z9.string().min(1).max(128), + to_version_id: z10.string().min(1).max(128), source: modSourceSchema.optional(), - modpack_id: z9.string().min(1).max(128).optional(), - minecraft_version: z9.string().min(1).max(64).optional(), + modpack_id: z10.string().min(1).max(128).optional(), + minecraft_version: z10.string().min(1).max(64).optional(), loader: serverLoaderSchema.optional(), - loader_version: z9.string().min(1).max(64).nullable().optional(), - mods: z9.array(originPlanModInputSchema).max(2000), - files: z9.array(originPlanFileInputSchema).max(5000).optional() + loader_version: z10.string().min(1).max(64).nullable().optional(), + mods: z10.array(originPlanModInputSchema).max(2000), + files: z10.array(originPlanFileInputSchema).max(5000).optional() }).strict(); -var serverOriginApplyBodySchema = z9.object({ +var serverOriginApplyBodySchema = z10.object({ server_id: serverIdSchema, - plan_id: z9.string().min(1).max(128), - selected_mod_keys: z9.array(z9.string().min(1).max(256)).max(2000).optional(), - selected_file_paths: z9.array(z9.string().min(1).max(1024)).max(5000).optional() + plan_id: z10.string().min(1).max(128), + selected_mod_keys: z10.array(z10.string().min(1).max(256)).max(2000).optional(), + selected_file_paths: z10.array(z10.string().min(1).max(1024)).max(5000).optional() }).strict(); -var serverOriginUnlinkBodySchema = z9.object({ +var serverOriginUnlinkBodySchema = z10.object({ server_id: serverIdSchema }).strict(); -var blobKeySchema = z9.string().regex(/^[A-Za-z0-9_-]{43}$/, "Expected a 32-byte key in base64url"); +var blobKeySchema = z10.string().regex(/^[A-Za-z0-9_-]{43}$/, "Expected a 32-byte key in base64url"); var WORLD_NAME_REGEX = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$/; var RESERVED_WORLD_NAMES = new Set([ "mods", @@ -1555,19 +1575,19 @@ var RESERVED_WORLD_NAMES = new Set([ "kubejs", "scripts" ]); -var worldNameSchema = z9.string().regex(WORLD_NAME_REGEX, "Invalid world name").refine((name) => !name.includes("..") && !RESERVED_WORLD_NAMES.has(name.toLowerCase()), { +var worldNameSchema = z10.string().regex(WORLD_NAME_REGEX, "Invalid world name").refine((name) => !name.includes("..") && !RESERVED_WORLD_NAMES.has(name.toLowerCase()), { message: "Reserved or unsafe world name" }); -var serverWorldImportBodySchema = z9.object({ +var serverWorldImportBodySchema = z10.object({ server_id: serverIdSchema, world_name: worldNameSchema, - url: z9.string().url().max(2048), + url: z10.string().url().max(2048), sha256: sha256HexSchema, key: blobKeySchema }).strict(); -var serverDeployServerpackBodySchema = z9.object({ +var serverDeployServerpackBodySchema = z10.object({ server_id: serverIdSchema, - url: z9.string().url().max(2048), + url: z10.string().url().max(2048), sha256: sha256HexSchema.optional(), sha512: sha512HexSchema.optional(), sha1: sha1HexSchema.optional(), @@ -1637,12 +1657,12 @@ function registerStateCommands(registry) { } // src/protocol/commands/tunnel.ts -import { z as z10 } from "zod"; +import { z as z11 } from "zod"; var PLAYIT_SECRET_KEY_REGEX = /^[0-9a-fA-F]{16,256}$/; -var playitSecretKeySchema = z10.string().trim().regex(PLAYIT_SECRET_KEY_REGEX, "secret_key must be a 16-256 character hexadecimal string").refine((value) => value.length % 2 === 0, { +var playitSecretKeySchema = z11.string().trim().regex(PLAYIT_SECRET_KEY_REGEX, "secret_key must be a 16-256 character hexadecimal string").refine((value) => value.length % 2 === 0, { message: "secret_key must have an even number of hexadecimal characters" }); -var tunnelPlayitSetKeyBodySchema = z10.object({ +var tunnelPlayitSetKeyBodySchema = z11.object({ secret_key: playitSecretKeySchema }).strict(); var tunnelPlayitSetKeyCommand = defineCommand({ @@ -1655,19 +1675,19 @@ var tunnelPlayitStartCommand = defineCommand({ type: "tunnel.playit.start", sensitive: false, minRole: "admin", - body: z10.object({}).strict() + body: z11.object({}).strict() }); var tunnelPlayitStopCommand = defineCommand({ type: "tunnel.playit.stop", sensitive: false, minRole: "admin", - body: z10.object({}).strict() + body: z11.object({}).strict() }); var tunnelPlayitStatusCommand = defineCommand({ type: "tunnel.playit.status", sensitive: false, minRole: "viewer", - body: z10.object({}).strict() + body: z11.object({}).strict() }); var TUNNEL_COMMANDS = [ tunnelPlayitSetKeyCommand, @@ -1680,17 +1700,17 @@ function registerTunnelCommands(registry) { } // src/protocol/commands/core.ts -var serverIdBodySchema = z11.object({ - server_id: z11.string().min(1) +var serverIdBodySchema = z12.object({ + server_id: z12.string().min(1) }); -var strictServerDeleteBodySchema = z11.object({ +var strictServerDeleteBodySchema = z12.object({ server_id: serverIdSchema }).strict(); var agentPingCommand = defineCommand({ type: "agent.ping", sensitive: false, minRole: "viewer", - body: z11.object({}).strict() + body: z12.object({}).strict() }); var serverStartCommand = defineCommand({ type: "server.start", @@ -1720,24 +1740,24 @@ function registerCoreCommands(registry) { return registry.registerAll(CORE_COMMANDS); } function createCoreRegistry() { - return registerAgentCommands(registerTunnelCommands(registerBackupCommands(registerStateCommands(registerServerCommands(registerFilesCommands(registerPairingCommands(registerCoreCommands(new CommandRegistry)))))))); + return registerHostCommands(registerAgentCommands(registerTunnelCommands(registerBackupCommands(registerStateCommands(registerServerCommands(registerFilesCommands(registerPairingCommands(registerCoreCommands(new CommandRegistry))))))))); } // src/protocol/pairing.ts -import { z as z12 } from "zod"; +import { z as z13 } from "zod"; var PAIRING_CODE_LENGTH = 10; var PAIRING_SECRET_BYTES = 16; var DEFAULT_TRUST_GRANT_TTL_MS = 10 * 60 * 1000; var MAX_TRUST_GRANT_TTL_MS = 15 * 60 * 1000; var CROCKFORD_ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"; var PAIRING_CODE_REGEX = /^[0-9A-HJKMNP-TV-Z]{10}$/; -var pairingCodeSchema = z12.string().regex(PAIRING_CODE_REGEX, "Invalid pairing code"); -var trustGrantSchema = z12.object({ - v: z12.literal(PROTOCOL_VERSION), - kind: z12.literal("agent-pairing"), +var pairingCodeSchema = z13.string().regex(PAIRING_CODE_REGEX, "Invalid pairing code"); +var trustGrantSchema = z13.object({ + v: z13.literal(PROTOCOL_VERSION), + kind: z13.literal("agent-pairing"), account_key: base64UrlSchema, agent: keyIdSchema, - issued_at: z12.number().int().nonnegative(), - expires_at: z12.number().int().nonnegative(), + issued_at: z13.number().int().nonnegative(), + expires_at: z13.number().int().nonnegative(), proof: base64UrlSchema.optional(), sig: base64UrlSchema }); @@ -2051,4 +2071,4 @@ function createInMemoryTrustContext(options) { } }; } -export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, serverCreateBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverCreateCommand, serverRestartCommand, serverStatusCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; +export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, serverCreateBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverCreateCommand, serverRestartCommand, serverStatusCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, hostInfoBodySchema, hostInfoResultSchema, hostInfoCommand, HOST_COMMANDS, registerHostCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; diff --git a/lib/protocol/index.js b/lib/protocol/index.js index cc678e1..05d79bf 100644 --- a/lib/protocol/index.js +++ b/lib/protocol/index.js @@ -26,6 +26,7 @@ import { DOMAIN_TRUST_GRANT, FILES_COMMANDS, GRANTABLE_ROLES, + HOST_COMMANDS, MAX_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_RETENTION_COUNT, MAX_CLOCK_SKEW_MS, @@ -113,6 +114,9 @@ import { generatePairingCode, generatePairingSecret, grantableRoleSchema, + hostInfoBodySchema, + hostInfoCommand, + hostInfoResultSchema, keyIdSchema, maxRole, memberEntrySchema, @@ -132,6 +136,7 @@ import { registerBackupCommands, registerCoreCommands, registerFilesCommands, + registerHostCommands, registerPairingCommands, registerServerCommands, registerStateCommands, @@ -228,7 +233,7 @@ import { verifyTrustGrant, worldNameSchema, wrapEventBody -} from "../chunks/index-98zvzvsw.js"; +} from "../chunks/index-3rwb7776.js"; import"../chunks/index-g1frygvt.js"; export { wrapEventBody, @@ -327,6 +332,7 @@ export { registerStateCommands, registerServerCommands, registerPairingCommands, + registerHostCommands, registerFilesCommands, registerCoreCommands, registerBackupCommands, @@ -346,6 +352,9 @@ export { memberEntrySchema, maxRole, keyIdSchema, + hostInfoResultSchema, + hostInfoCommand, + hostInfoBodySchema, grantableRoleSchema, generatePairingSecret, generatePairingCode, @@ -433,6 +442,7 @@ export { MAX_CLOCK_SKEW_MS, MAX_BACKUP_RETENTION_COUNT, MAX_BACKUP_INTERVAL_MINUTES, + HOST_COMMANDS, GRANTABLE_ROLES, FILES_COMMANDS, DOMAIN_TRUST_GRANT, diff --git a/lib/types/protocol/commands/host.d.ts b/lib/types/protocol/commands/host.d.ts new file mode 100644 index 0000000..f5d16c3 --- /dev/null +++ b/lib/types/protocol/commands/host.d.ts @@ -0,0 +1,14 @@ +import { z } from "zod"; +import { type CommandRegistry } from "../registry"; +export declare const hostInfoBodySchema: z.ZodObject<{}, z.core.$strict>; +export type HostInfoBody = z.infer; +export declare const hostInfoResultSchema: z.ZodObject<{ + memory_total_mb: z.ZodNumber; + memory_available_mb: z.ZodNumber; + cpu_count: z.ZodNumber; + reserved_memory_mb: z.ZodNumber; +}, z.core.$strip>; +export type HostInfoResult = z.infer; +export declare const hostInfoCommand: import("..").CommandDefinition<"host.info", Record>; +export declare const HOST_COMMANDS: readonly [import("..").CommandDefinition<"host.info", Record>]; +export declare function registerHostCommands(registry: CommandRegistry): CommandRegistry; diff --git a/lib/types/protocol/index.d.ts b/lib/types/protocol/index.d.ts index 788d018..45b4b72 100644 --- a/lib/types/protocol/index.d.ts +++ b/lib/types/protocol/index.d.ts @@ -5,6 +5,7 @@ export { AGENT_COMMANDS, type AgentMembersRevokeBody, type AgentMembersSetBody, export { BACKUP_COMMANDS, BACKUP_ID_REGEX, type BackupDestinationKind, type BackupLocalConfig, type BackupS3ConfigInput, type BackupScheduleConfig, type BackupTegraCloudConfig, backupDestinationKindSchema, backupIdSchema, backupLocalConfigSchema, backupS3ConfigSchema, backupScheduleConfigSchema, backupTegraCloudConfigSchema, MAX_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_RETENTION_COUNT, MIN_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, registerBackupCommands, type ServerBackupConfigSetBody, type ServerBackupCreateBody, type ServerBackupDeleteBody, type ServerBackupListBody, type ServerBackupRestoreBody, s3BucketSchema, s3PrefixSchema, s3RegionSchema, serverBackupConfigGetCommand, serverBackupConfigSetBodySchema, serverBackupConfigSetCommand, serverBackupCreateBodySchema, serverBackupCreateCommand, serverBackupDeleteBodySchema, serverBackupDeleteCommand, serverBackupListBodySchema, serverBackupListCommand, serverBackupRestoreBodySchema, serverBackupRestoreCommand, } from "./commands/backup"; export { agentPingCommand, CORE_COMMANDS, createCoreRegistry, registerCoreCommands, serverDeleteCommand, serverStartCommand, serverStopCommand, } from "./commands/core"; export { FILES_COMMANDS, fileEncodingSchema, filesCopyCommand, filesDeleteCommand, filesDownloadBeginCommand, filesDownloadCloseCommand, filesDownloadCommand, filesDownloadPartCommand, filesListCommand, filesMkdirCommand, filesReadCommand, filesRenameCommand, filesStatCommand, filesUnzipCommand, filesUploadAbortCommand, filesUploadBeginCommand, filesUploadCommitCommand, filesUploadPartCommand, filesWriteCommand, filesZipCommand, registerFilesCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, sha256HexSchema, } from "./commands/files"; +export { HOST_COMMANDS, type HostInfoBody, type HostInfoResult, hostInfoBodySchema, hostInfoCommand, hostInfoResultSchema, registerHostCommands, } from "./commands/host"; export { agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, } from "./commands/pairing"; export { consoleLineSchema, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MAX_JVM_ARGS, MAX_SERVER_MEMORY_MB, MIN_SERVER_MEMORY_MB, registerServerCommands, SERVER_COMMANDS, SERVER_ID_REGEX, type ServerConsoleSendBody, type ServerConsoleSubscribeBody, type ServerCreateBody, type ServerLoader, type ServerUpdateSettingsBody, serverConsoleSendBodySchema, serverConsoleSendCommand, serverConsoleSubscribeBodySchema, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, serverCreateBodySchema, serverCreateCommand, serverIdSchema, serverListCommand, serverLoaderSchema, serverMemoryMbSchema, serverPortSchema, serverRestartCommand, serverStatusCommand, serverUpdateSettingsBodySchema, serverUpdateSettingsCommand, } from "./commands/server"; export { blobKeySchema, type ModEnvironmentInfo, type ModLayer, type ModSource, modEnvironmentInfoSchema, modFileNameSchema, modLayerSchema, modSourceSchema, type OriginPlanFileInput, type OriginPlanModInput, originPlanFileInputSchema, originPlanModInputSchema, RESERVED_WORLD_NAMES, registerStateCommands, type ServerDeployServerpackBody, type ServerModEntry, type ServerModsInstallBody, type ServerModsListBody, type ServerModsRemoveBody, type ServerOrigin, type ServerOriginApplyBody, type ServerOriginPlanBody, type ServerOriginSyncState, type ServerOriginUnlinkBody, type ServerWorldImportBody, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, STATE_COMMANDS, serverDeployServerpackBodySchema, serverDeployServerpackCommand, serverModEntrySchema, serverModsInstallBodySchema, serverModsInstallCommand, serverModsListBodySchema, serverModsListCommand, serverModsRemoveBodySchema, serverModsRemoveCommand, serverOriginApplyBodySchema, serverOriginApplyCommand, serverOriginPlanBodySchema, serverOriginPlanCommand, serverOriginSchema, serverOriginSyncStateSchema, serverOriginUnlinkBodySchema, serverOriginUnlinkCommand, serverWorldImportBodySchema, serverWorldImportCommand, sha1HexSchema, sha512HexSchema, WORLD_NAME_REGEX, worldNameSchema, } from "./commands/state"; diff --git a/lib/vault/index.js b/lib/vault/index.js index ad85c06..b066515 100644 --- a/lib/vault/index.js +++ b/lib/vault/index.js @@ -5,7 +5,7 @@ import { sessionCertificateSchema, signRevocationList, signSessionCertificate -} from "../chunks/index-98zvzvsw.js"; +} from "../chunks/index-3rwb7776.js"; import { KDF_ALG_ARGON2ID13, KDF_MODERATE, diff --git a/scripts/smoke-lib.ts b/scripts/smoke-lib.ts index 39b91f0..3167a62 100644 --- a/scripts/smoke-lib.ts +++ b/scripts/smoke-lib.ts @@ -4,7 +4,7 @@ // Exercises the built library (lib/) the way a consumer would: crypto, protocol and vault must // share one initialized libsodium instance. import { ready } from "tegrad/crypto"; -import { createCoreRegistry, PROTOCOL_VERSION } from "tegrad/protocol"; +import { createCoreRegistry, hostInfoResultSchema, PROTOCOL_VERSION } from "tegrad/protocol"; import { createVault, unlockVault } from "tegrad/vault"; await ready(); @@ -24,4 +24,16 @@ if (createCoreRegistry().get("agent.ping") === undefined) { process.stderr.write("lib smoke test failed: core registry\n"); process.exit(1); } +if ( + createCoreRegistry().get("host.info") === undefined || + !hostInfoResultSchema.safeParse({ + memory_total_mb: 8192, + memory_available_mb: 6144, + cpu_count: 4, + reserved_memory_mb: 1024, + }).success +) { + process.stderr.write("lib smoke test failed: host.info\n"); + process.exit(1); +} process.stdout.write("lib smoke test ok\n"); diff --git a/src/agent/host-info.test.ts b/src/agent/host-info.test.ts new file mode 100644 index 0000000..1aa0c88 --- /dev/null +++ b/src/agent/host-info.test.ts @@ -0,0 +1,371 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeAll, describe, expect, test } from "bun:test"; +import { mkdtempSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { z } from "zod"; +import { + fingerprint, + generateSigningKeyPair, + ready, + type SigningKeyPair, + toBase64Url, +} from "../crypto"; +import { + CommandRegistry, + createCoreRegistry, + createInMemoryTrustContext, + createSignedCommand, + defineCommand, + hostInfoBodySchema, + hostInfoCommand, + hostInfoResultSchema, + PROTOCOL_VERSION, + ProtocolError, + signSessionCertificate, + type TransportFrame, +} from "../protocol"; +import { RESERVED_SYSTEM_MEMORY_MB } from "../server/memory"; +import { readHostInfo } from "./host-info"; +import { createCommandQueue, type TransportCommandFrame } from "./jobs"; +import { createLogger } from "./logger"; +import { openTestEvent } from "./test-events"; + +const NOW = 1_700_000_000_000; +const tempDirs: string[] = []; +const silentLogger = createLogger({ level: "error", stdout: () => {}, stderr: () => {} }); + +beforeAll(async () => { + await ready(); +}); + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +function makeTempDir(): string { + const dir = mkdtempSync(join(tmpdir(), "tegrad-host-info-")); + tempDirs.push(dir); + return dir; +} + +function makeSession(account: SigningKeyPair) { + const key = generateSigningKeyPair(); + const certificate = signSessionCertificate({ + sessionPublicKey: key.publicKey, + accountKeyPair: account, + notBefore: NOW - 1000, + notAfter: NOW + 3_600_000, + }); + return { key, certificate }; +} + +describe("host.info schema and command definition", () => { + test("is registered in the core registry as non-sensitive viewer command", () => { + const registry = createCoreRegistry(); + const def = registry.get("host.info"); + expect(def).toBe(hostInfoCommand); + expect(def?.sensitive).toBe(false); + expect(def?.minRole).toBe("viewer"); + }); + + test("hostInfoBodySchema accepts empty object and rejects extra parameters", () => { + expect(hostInfoBodySchema.safeParse({}).success).toBe(true); + expect(hostInfoBodySchema.safeParse({ extra: true }).success).toBe(false); + expect(hostInfoBodySchema.safeParse({ server_id: "survival" }).success).toBe(false); + expect(hostInfoBodySchema.safeParse(null).success).toBe(false); + }); + + test("hostInfoResultSchema validates memory, cpu and reserve fields", () => { + expect( + hostInfoResultSchema.safeParse({ + memory_total_mb: 16384, + memory_available_mb: 12288, + cpu_count: 8, + reserved_memory_mb: 1024, + }).success, + ).toBe(true); + + expect( + hostInfoResultSchema.safeParse({ + memory_total_mb: -1, + memory_available_mb: 1024, + cpu_count: 4, + reserved_memory_mb: 1024, + }).success, + ).toBe(false); + + expect( + hostInfoResultSchema.safeParse({ + memory_total_mb: 8192, + memory_available_mb: 4096, + cpu_count: 0, + reserved_memory_mb: 1024, + }).success, + ).toBe(false); + + expect( + hostInfoResultSchema.safeParse({ + memory_total_mb: 8192.5, + memory_available_mb: 4096, + cpu_count: 4, + reserved_memory_mb: 1024, + }).success, + ).toBe(false); + + expect( + hostInfoResultSchema.safeParse({ + memory_total_mb: 8192, + memory_available_mb: 4096, + cpu_count: 4, + }).success, + ).toBe(false); + }); +}); + +describe("readHostInfo", () => { + test("reads simulated /proc/meminfo, cpu_count and default reserved memory", () => { + const dir = makeTempDir(); + const meminfoPath = join(dir, "meminfo"); + writeFileSync( + meminfoPath, + [ + "MemTotal: 16777216 kB", // 16384 MB + "MemFree: 4194304 kB", + "MemAvailable: 12582912 kB", // 12288 MB + "Buffers: 262144 kB", + ].join("\n"), + ); + + const info = readHostInfo({ + meminfoPath, + availableParallelismImpl: () => 6, + }); + + expect(info).toEqual({ + memory_total_mb: 16384, + memory_available_mb: 12288, + cpu_count: 6, + reserved_memory_mb: RESERVED_SYSTEM_MEMORY_MB, + }); + expect(hostInfoResultSchema.safeParse(info).success).toBe(true); + }); + + test("throws ProtocolError when meminfo file cannot be read", () => { + const dir = makeTempDir(); + expect(() => readHostInfo({ meminfoPath: join(dir, "missing") })).toThrow(ProtocolError); + }); +}); + +describe("host.info command handler", () => { + test("viewer session receives encrypted host.info.result sealed to reply_to", async () => { + const dir = makeTempDir(); + const meminfoPath = join(dir, "meminfo"); + writeFileSync(meminfoPath, "MemTotal: 8388608 kB\nMemAvailable: 6291456 kB\n"); + + const agent = generateSigningKeyPair(); + const owner = generateSigningKeyPair(); + const viewer = generateSigningKeyPair(); + const viewerSession = makeSession(viewer); + const agentId = fingerprint(agent.publicKey); + const registry = createCoreRegistry(); + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [owner.publicKey], + members: [ + { + account_key: toBase64Url(viewer.publicKey), + account: fingerprint(viewer.publicKey), + granted_by: fingerprint(owner.publicKey), + role: "viewer", + servers: ["survival"], + issued_at: NOW, + }, + ], + now: () => NOW, + }); + + const sent: TransportFrame[] = []; + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (frame) => sent.push(frame), + logger: silentLogger, + readHostInfo: () => + readHostInfo({ + meminfoPath, + availableParallelismImpl: () => 4, + }), + }); + + const command = createSignedCommand( + { + type: "host.info", + body: {}, + agentPublicKey: agent.publicKey, + signer: viewerSession.key, + session: viewerSession.certificate, + replyTo: viewerSession.key.publicKey, + counter: 1, + now: NOW, + }, + registry, + ); + + const frame: TransportCommandFrame = { + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: agentId }, + body: command, + }; + await queue.enqueue(frame); + + const ack = sent.find((f) => f.kind === "ack"); + expect(ack?.kind).toBe("ack"); + if (ack?.kind === "ack") { + expect(ack.body).toEqual({ id: command.header.id, ok: true }); + } + + const event = sent.find((f) => f.kind === "event"); + expect(event?.kind).toBe("event"); + if (event?.kind !== "event") return; + + expect(event.route.recipient).toBe(fingerprint(viewerSession.key.publicKey)); + const opened = openTestEvent(event.body, agent.publicKey, viewerSession.key); + expect(opened.header.type).toBe("host.info.result"); + expect(opened.inReplyTo).toBe(command.header.id); + expect(hostInfoResultSchema.parse(opened.body)).toEqual({ + memory_total_mb: 8192, + memory_available_mb: 6144, + cpu_count: 4, + reserved_memory_mb: RESERVED_SYSTEM_MEMORY_MB, + }); + + // Account key cannot decrypt a reply sealed to the session key. + expect(() => openTestEvent(event.body, agent.publicKey, viewer)).toThrow(); + }); + + test("rejects untrusted accounts", async () => { + const agent = generateSigningKeyPair(); + const owner = generateSigningKeyPair(); + const stranger = generateSigningKeyPair(); + const registry = createCoreRegistry(); + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [owner.publicKey], + now: () => NOW, + }); + + const sent: TransportFrame[] = []; + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (frame) => sent.push(frame), + logger: silentLogger, + }); + + const command = createSignedCommand( + { + type: "host.info", + body: {}, + agentPublicKey: agent.publicKey, + signer: stranger, + counter: 1, + now: NOW, + }, + registry, + ); + + await queue.enqueue({ + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: fingerprint(agent.publicKey) }, + body: command, + }); + + const ack = sent.find((f) => f.kind === "ack"); + expect(ack?.kind === "ack" && ack.body).toEqual({ + id: command.header.id, + ok: false, + code: "untrusted_signer", + }); + expect(sent.some((f) => f.kind === "event")).toBe(false); + }); + + test("rejects extra parameters on host.info at openCommand", async () => { + const agent = generateSigningKeyPair(); + const owner = generateSigningKeyPair(); + const registry = createCoreRegistry(); + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [owner.publicKey], + now: () => NOW, + }); + + // Client-side validation rejects extra parameters before signing. + expect(() => + createSignedCommand( + { + type: "host.info", + body: { unexpected: 1 }, + agentPublicKey: agent.publicKey, + signer: owner, + counter: 1, + now: NOW, + }, + registry, + ), + ).toThrow(ProtocolError); + + // Server-side validation also rejects a command signed with extra parameters. + const permissiveRegistry = new CommandRegistry().register( + defineCommand({ + type: "host.info", + sensitive: false, + minRole: "viewer", + body: z.object({ unexpected: z.number() }), + }), + ); + const command = createSignedCommand( + { + type: "host.info", + body: { unexpected: 1 }, + agentPublicKey: agent.publicKey, + signer: owner, + counter: 1, + now: NOW, + }, + permissiveRegistry, + ); + + const sent: TransportFrame[] = []; + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (frame) => sent.push(frame), + logger: silentLogger, + }); + + await queue.enqueue({ + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: fingerprint(agent.publicKey) }, + body: command, + }); + + const ack = sent.find((f) => f.kind === "ack"); + expect(ack?.kind === "ack" && ack.body).toEqual({ + id: command.header.id, + ok: false, + code: "invalid_body", + }); + expect(sent.some((f) => f.kind === "event")).toBe(false); + }); +}); diff --git a/src/agent/host-info.ts b/src/agent/host-info.ts new file mode 100644 index 0000000..dccc750 --- /dev/null +++ b/src/agent/host-info.ts @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { availableParallelism } from "node:os"; +import type { HostInfoResult } from "../protocol"; +import { + DEFAULT_MEMINFO_PATH, + type Meminfo, + RESERVED_SYSTEM_MEMORY_MB, + readMeminfo, +} from "../server/memory"; + +export interface ReadHostInfoOptions { + readonly meminfoPath?: string; + readonly readMeminfoImpl?: () => Meminfo; + readonly availableParallelismImpl?: () => number; + readonly reservedMemoryMb?: number; +} + +export function readHostInfo(options: ReadHostInfoOptions = {}): HostInfoResult { + const meminfo = options.readMeminfoImpl + ? options.readMeminfoImpl() + : readMeminfo(options.meminfoPath ?? DEFAULT_MEMINFO_PATH); + const cpuCount = options.availableParallelismImpl + ? options.availableParallelismImpl() + : availableParallelism(); + const reservedMemoryMb = options.reservedMemoryMb ?? RESERVED_SYSTEM_MEMORY_MB; + + return { + memory_total_mb: meminfo.memTotalMb, + memory_available_mb: meminfo.memAvailableMb, + cpu_count: cpuCount, + reserved_memory_mb: reservedMemoryMb, + }; +} diff --git a/src/agent/index.ts b/src/agent/index.ts index df22691..8600d3c 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -50,6 +50,7 @@ export { type RunFixedResult, runFixed, } from "./exec"; +export { type ReadHostInfoOptions, readHostInfo } from "./host-info"; export { ACCOUNT_SUBSCRIPTION_TTL_MS, type CommandHandler, diff --git a/src/agent/jobs.ts b/src/agent/jobs.ts index 47976c2..f8a946c 100644 --- a/src/agent/jobs.ts +++ b/src/agent/jobs.ts @@ -7,6 +7,7 @@ import { type AgentMembersSetBody, type AgentSubscribeBody, type CommandRegistry, + type HostInfoResult, type KeyId, type MemberStore, type OpenedCommand, @@ -22,6 +23,7 @@ import { type TrustContext, wrapEventBody, } from "../protocol"; +import { readHostInfo } from "./host-info"; import type { Logger } from "./logger"; import { applyMembersRevoke, applyMembersSet } from "./members"; @@ -58,6 +60,7 @@ export interface CommandQueueOptions { readonly sendFrame: (frame: TransportFrame) => void; readonly logger: Logger; readonly maxIdempotencyEntries?: number; + readonly readHostInfo?: () => HostInfoResult; } export interface PublishScope { @@ -340,10 +343,16 @@ export function createCommandQueue(options: CommandQueueOptions): CommandQueue { handlers.set(type, handler); } + const getHostInfo = options.readHostInfo ?? (() => readHostInfo()); + registerHandler("agent.ping", (_opened, ctx) => { ctx.sendEvent("agent.pong", { at: ctx.now() }); }); + registerHandler("host.info", (_opened, ctx) => { + ctx.sendEvent("host.info.result", getHostInfo()); + }); + registerHandler("agent.subscribe", (opened, ctx) => { const body = opened.body as AgentSubscribeBody; const key = resolveRecipientKey(opened); diff --git a/src/protocol/commands/core.ts b/src/protocol/commands/core.ts index fb74ddb..bd9d882 100644 --- a/src/protocol/commands/core.ts +++ b/src/protocol/commands/core.ts @@ -6,6 +6,7 @@ import { CommandRegistry, defineCommand } from "../registry"; import { registerAgentCommands } from "./agent"; import { registerBackupCommands } from "./backup"; import { registerFilesCommands } from "./files"; +import { registerHostCommands } from "./host"; import { registerPairingCommands } from "./pairing"; import { registerServerCommands, serverIdSchema } from "./server"; import { registerStateCommands } from "./state"; @@ -61,13 +62,15 @@ export function registerCoreCommands(registry: CommandRegistry): CommandRegistry } export function createCoreRegistry(): CommandRegistry { - return registerAgentCommands( - registerTunnelCommands( - registerBackupCommands( - registerStateCommands( - registerServerCommands( - registerFilesCommands( - registerPairingCommands(registerCoreCommands(new CommandRegistry())), + return registerHostCommands( + registerAgentCommands( + registerTunnelCommands( + registerBackupCommands( + registerStateCommands( + registerServerCommands( + registerFilesCommands( + registerPairingCommands(registerCoreCommands(new CommandRegistry())), + ), ), ), ), diff --git a/src/protocol/commands/host.ts b/src/protocol/commands/host.ts new file mode 100644 index 0000000..80f81b1 --- /dev/null +++ b/src/protocol/commands/host.ts @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; +import { type CommandRegistry, defineCommand } from "../registry"; + +export const hostInfoBodySchema = z.object({}).strict(); +export type HostInfoBody = z.infer; + +export const hostInfoResultSchema = z.object({ + memory_total_mb: z.number().int().nonnegative(), + memory_available_mb: z.number().int().nonnegative(), + cpu_count: z.number().int().positive(), + reserved_memory_mb: z.number().int().nonnegative(), +}); +export type HostInfoResult = z.infer; + +export const hostInfoCommand = defineCommand({ + type: "host.info", + sensitive: false, + minRole: "viewer", + body: hostInfoBodySchema, +}); + +export const HOST_COMMANDS = [hostInfoCommand] as const; + +export function registerHostCommands(registry: CommandRegistry): CommandRegistry { + return registry.registerAll(HOST_COMMANDS); +} diff --git a/src/protocol/index.ts b/src/protocol/index.ts index 6d0b9f0..3ef6142 100644 --- a/src/protocol/index.ts +++ b/src/protocol/index.ts @@ -137,6 +137,15 @@ export { SHA256_HEX_PATTERN, sha256HexSchema, } from "./commands/files"; +export { + HOST_COMMANDS, + type HostInfoBody, + type HostInfoResult, + hostInfoBodySchema, + hostInfoCommand, + hostInfoResultSchema, + registerHostCommands, +} from "./commands/host"; export { agentRevocationsSetCommand, PAIRING_COMMANDS, diff --git a/src/protocol/phase3.test.ts b/src/protocol/phase3.test.ts index a6c6aaf..8cb9700 100644 --- a/src/protocol/phase3.test.ts +++ b/src/protocol/phase3.test.ts @@ -652,6 +652,7 @@ const MIN_ROLE: Record = { "agent.ping": "viewer", "agent.subscribe": "viewer", "agent.unsubscribe": "viewer", + "host.info": "viewer", "server.status": "viewer", "server.list": "viewer", "server.console.subscribe": "viewer", @@ -722,6 +723,7 @@ describe("minimum roles", () => { const SERVER = "survival"; const BODIES: Record = { "agent.ping": {}, + "host.info": {}, "server.start": { server_id: SERVER }, "server.stop": { server_id: SERVER }, "server.restart": { server_id: SERVER }, From 53960fd30dd313cbbb8aa0abc049ba4c242ca3ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Wed, 25 Nov 2026 23:14:23 -0300 Subject: [PATCH 32/59] feat: report the host's external IPv4 addresses in host.info --- .../{index-3rwb7776.js => index-z0bwfwg6.js} | 3 +- lib/protocol/index.js | 2 +- lib/types/protocol/commands/host.d.ts | 1 + lib/vault/index.js | 2 +- src/agent/host-info.test.ts | 30 +++++++++++++++++-- src/agent/host-info.ts | 21 ++++++++++++- src/protocol/commands/host.ts | 2 ++ 7 files changed, 55 insertions(+), 6 deletions(-) rename lib/chunks/{index-3rwb7776.js => index-z0bwfwg6.js} (99%) diff --git a/lib/chunks/index-3rwb7776.js b/lib/chunks/index-z0bwfwg6.js similarity index 99% rename from lib/chunks/index-3rwb7776.js rename to lib/chunks/index-z0bwfwg6.js index 3fdbdcd..04dbd13 100644 --- a/lib/chunks/index-3rwb7776.js +++ b/lib/chunks/index-z0bwfwg6.js @@ -1409,7 +1409,8 @@ var hostInfoResultSchema = z8.object({ memory_total_mb: z8.number().int().nonnegative(), memory_available_mb: z8.number().int().nonnegative(), cpu_count: z8.number().int().positive(), - reserved_memory_mb: z8.number().int().nonnegative() + reserved_memory_mb: z8.number().int().nonnegative(), + addresses: z8.array(z8.string().min(1).max(45)).max(16).optional() }); var hostInfoCommand = defineCommand({ type: "host.info", diff --git a/lib/protocol/index.js b/lib/protocol/index.js index 05d79bf..8575c90 100644 --- a/lib/protocol/index.js +++ b/lib/protocol/index.js @@ -233,7 +233,7 @@ import { verifyTrustGrant, worldNameSchema, wrapEventBody -} from "../chunks/index-3rwb7776.js"; +} from "../chunks/index-z0bwfwg6.js"; import"../chunks/index-g1frygvt.js"; export { wrapEventBody, diff --git a/lib/types/protocol/commands/host.d.ts b/lib/types/protocol/commands/host.d.ts index f5d16c3..be63348 100644 --- a/lib/types/protocol/commands/host.d.ts +++ b/lib/types/protocol/commands/host.d.ts @@ -7,6 +7,7 @@ export declare const hostInfoResultSchema: z.ZodObject<{ memory_available_mb: z.ZodNumber; cpu_count: z.ZodNumber; reserved_memory_mb: z.ZodNumber; + addresses: z.ZodOptional>; }, z.core.$strip>; export type HostInfoResult = z.infer; export declare const hostInfoCommand: import("..").CommandDefinition<"host.info", Record>; diff --git a/lib/vault/index.js b/lib/vault/index.js index b066515..a7eb5c7 100644 --- a/lib/vault/index.js +++ b/lib/vault/index.js @@ -5,7 +5,7 @@ import { sessionCertificateSchema, signRevocationList, signSessionCertificate -} from "../chunks/index-3rwb7776.js"; +} from "../chunks/index-z0bwfwg6.js"; import { KDF_ALG_ARGON2ID13, KDF_MODERATE, diff --git a/src/agent/host-info.test.ts b/src/agent/host-info.test.ts index 1aa0c88..05914b2 100644 --- a/src/agent/host-info.test.ts +++ b/src/agent/host-info.test.ts @@ -3,7 +3,7 @@ import { afterEach, beforeAll, describe, expect, test } from "bun:test"; import { mkdtempSync, rmSync, writeFileSync } from "node:fs"; -import { tmpdir } from "node:os"; +import { type NetworkInterfaceInfo, tmpdir } from "node:os"; import { join } from "node:path"; import { z } from "zod"; import { @@ -28,7 +28,7 @@ import { type TransportFrame, } from "../protocol"; import { RESERVED_SYSTEM_MEMORY_MB } from "../server/memory"; -import { readHostInfo } from "./host-info"; +import { readHostAddresses, readHostInfo } from "./host-info"; import { createCommandQueue, type TransportCommandFrame } from "./jobs"; import { createLogger } from "./logger"; import { openTestEvent } from "./test-events"; @@ -147,6 +147,7 @@ describe("readHostInfo", () => { const info = readHostInfo({ meminfoPath, availableParallelismImpl: () => 6, + networkInterfacesImpl: () => ({}), }); expect(info).toEqual({ @@ -154,10 +155,33 @@ describe("readHostInfo", () => { memory_available_mb: 12288, cpu_count: 6, reserved_memory_mb: RESERVED_SYSTEM_MEMORY_MB, + addresses: [], }); expect(hostInfoResultSchema.safeParse(info).success).toBe(true); }); + test("lists only external IPv4 addresses, once each and without link-local ones", () => { + const iface = (address: string, family: "IPv4" | "IPv6", internal = false) => + ({ + address, + netmask: "255.255.255.0", + family, + mac: "00:00:00:00:00:00", + internal, + cidr: null, + }) as NetworkInterfaceInfo; + const addresses = readHostAddresses({ + lo: [iface("127.0.0.1", "IPv4", true)], + eth0: [ + iface("192.168.2.201", "IPv4"), + iface("fe80::1", "IPv6"), + iface("169.254.10.2", "IPv4"), + ], + eth1: [iface("192.168.2.201", "IPv4"), iface("10.0.0.7", "IPv4")], + }); + expect(addresses).toEqual(["192.168.2.201", "10.0.0.7"]); + }); + test("throws ProtocolError when meminfo file cannot be read", () => { const dir = makeTempDir(); expect(() => readHostInfo({ meminfoPath: join(dir, "missing") })).toThrow(ProtocolError); @@ -202,6 +226,7 @@ describe("host.info command handler", () => { readHostInfo({ meminfoPath, availableParallelismImpl: () => 4, + networkInterfacesImpl: () => ({}), }), }); @@ -246,6 +271,7 @@ describe("host.info command handler", () => { memory_available_mb: 6144, cpu_count: 4, reserved_memory_mb: RESERVED_SYSTEM_MEMORY_MB, + addresses: [], }); // Account key cannot decrypt a reply sealed to the session key. diff --git a/src/agent/host-info.ts b/src/agent/host-info.ts index dccc750..6d305bf 100644 --- a/src/agent/host-info.ts +++ b/src/agent/host-info.ts @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import { availableParallelism } from "node:os"; +import { availableParallelism, networkInterfaces } from "node:os"; import type { HostInfoResult } from "../protocol"; import { DEFAULT_MEMINFO_PATH, @@ -15,6 +15,24 @@ export interface ReadHostInfoOptions { readonly readMeminfoImpl?: () => Meminfo; readonly availableParallelismImpl?: () => number; readonly reservedMemoryMb?: number; + readonly networkInterfacesImpl?: () => ReturnType; +} + +const MAX_ADDRESSES = 16; + +/** Non-internal IPv4 addresses, without link-local (169.254.x.x) ones. */ +export function readHostAddresses( + interfaces: ReturnType = networkInterfaces(), +): string[] { + const found: string[] = []; + for (const entries of Object.values(interfaces)) { + for (const entry of entries ?? []) { + if (entry.family !== "IPv4" || entry.internal) continue; + if (entry.address.startsWith("169.254.")) continue; + if (!found.includes(entry.address)) found.push(entry.address); + } + } + return found.slice(0, MAX_ADDRESSES); } export function readHostInfo(options: ReadHostInfoOptions = {}): HostInfoResult { @@ -31,5 +49,6 @@ export function readHostInfo(options: ReadHostInfoOptions = {}): HostInfoResult memory_available_mb: meminfo.memAvailableMb, cpu_count: cpuCount, reserved_memory_mb: reservedMemoryMb, + addresses: readHostAddresses(options.networkInterfacesImpl?.()), }; } diff --git a/src/protocol/commands/host.ts b/src/protocol/commands/host.ts index 80f81b1..d225dbf 100644 --- a/src/protocol/commands/host.ts +++ b/src/protocol/commands/host.ts @@ -12,6 +12,8 @@ export const hostInfoResultSchema = z.object({ memory_available_mb: z.number().int().nonnegative(), cpu_count: z.number().int().positive(), reserved_memory_mb: z.number().int().nonnegative(), + /** Non-internal IPv4 addresses of the host, so a player can find the server on the network. */ + addresses: z.array(z.string().min(1).max(45)).max(16).optional(), }); export type HostInfoResult = z.infer; From bf7e252ac1cb97e0cac7633c37284b70c1f28254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Thu, 26 Nov 2026 00:09:36 -0300 Subject: [PATCH 33/59] fix: read the host addresses from the routing table when the sandbox hides the interfaces --- src/agent/host-info.test.ts | 44 ++++++++++++++++++++++++++++++++++++- src/agent/host-info.ts | 39 +++++++++++++++++++++++++++++++- 2 files changed, 81 insertions(+), 2 deletions(-) diff --git a/src/agent/host-info.test.ts b/src/agent/host-info.test.ts index 05914b2..dffa0fa 100644 --- a/src/agent/host-info.test.ts +++ b/src/agent/host-info.test.ts @@ -28,7 +28,7 @@ import { type TransportFrame, } from "../protocol"; import { RESERVED_SYSTEM_MEMORY_MB } from "../server/memory"; -import { readHostAddresses, readHostInfo } from "./host-info"; +import { readAddressesFromFibTrie, readHostAddresses, readHostInfo } from "./host-info"; import { createCommandQueue, type TransportCommandFrame } from "./jobs"; import { createLogger } from "./logger"; import { openTestEvent } from "./test-events"; @@ -148,6 +148,7 @@ describe("readHostInfo", () => { meminfoPath, availableParallelismImpl: () => 6, networkInterfacesImpl: () => ({}), + fibTriePath: join(dir, "no-fib-trie"), }); expect(info).toEqual({ @@ -182,6 +183,46 @@ describe("readHostInfo", () => { expect(addresses).toEqual(["192.168.2.201", "10.0.0.7"]); }); + test("falls back to the kernel routing trie when the sandbox hides the interfaces", () => { + const dir = makeTempDir(); + const meminfoPath = join(dir, "meminfo"); + writeFileSync(meminfoPath, "MemTotal: 8388608 kB\nMemAvailable: 6291456 kB\n"); + const fibTriePath = join(dir, "fib_trie"); + const section = [ + " +-- 0.0.0.0/0 3 0 5", + " |-- 0.0.0.0", + " /0 universe UNICAST", + " +-- 127.0.0.0/8 2 0 2", + " +-- 127.0.0.0/31 1 0 0", + " |-- 127.0.0.0", + " /8 host LOCAL", + " |-- 127.0.0.1", + " /32 host LOCAL", + " |-- 127.255.255.255", + " /32 link BROADCAST", + " +-- 192.168.2.0/24 2 1 2", + " |-- 192.168.2.0", + " /24 link UNICAST", + " +-- 192.168.2.192/26 2 0 2", + " |-- 192.168.2.201", + " /32 host LOCAL", + " |-- 192.168.2.255", + " /32 link BROADCAST", + ].join("\n"); + writeFileSync(fibTriePath, `Main:\n${section}\nLocal:\n${section}\n`); + + expect(readAddressesFromFibTrie(fibTriePath)).toEqual(["192.168.2.201"]); + expect(readAddressesFromFibTrie(join(dir, "missing"))).toEqual([]); + + const info = readHostInfo({ + meminfoPath, + availableParallelismImpl: () => 2, + networkInterfacesImpl: () => ({}), + fibTriePath, + }); + expect(info.addresses).toEqual(["192.168.2.201"]); + }); + test("throws ProtocolError when meminfo file cannot be read", () => { const dir = makeTempDir(); expect(() => readHostInfo({ meminfoPath: join(dir, "missing") })).toThrow(ProtocolError); @@ -227,6 +268,7 @@ describe("host.info command handler", () => { meminfoPath, availableParallelismImpl: () => 4, networkInterfacesImpl: () => ({}), + fibTriePath: join(dir, "no-fib-trie"), }), }); diff --git a/src/agent/host-info.ts b/src/agent/host-info.ts index 6d305bf..78551de 100644 --- a/src/agent/host-info.ts +++ b/src/agent/host-info.ts @@ -1,6 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda +import { readFileSync } from "node:fs"; import { availableParallelism, networkInterfaces } from "node:os"; import type { HostInfoResult } from "../protocol"; import { @@ -16,9 +17,43 @@ export interface ReadHostInfoOptions { readonly availableParallelismImpl?: () => number; readonly reservedMemoryMb?: number; readonly networkInterfacesImpl?: () => ReturnType; + readonly fibTriePath?: string; } const MAX_ADDRESSES = 16; +const DEFAULT_FIB_TRIE_PATH = "/proc/net/fib_trie"; + +function isUsableIpv4(address: string): boolean { + return !address.startsWith("127.") && !address.startsWith("169.254.") && address !== "0.0.0.0"; +} + +/** + * Local IPv4 addresses from the kernel routing trie. The service sandbox only + * allows AF_INET, AF_INET6 and AF_UNIX sockets, which blocks the netlink call + * behind `os.networkInterfaces()`, so this plain file read is the fallback. + */ +export function readAddressesFromFibTrie(path: string = DEFAULT_FIB_TRIE_PATH): string[] { + let text: string; + try { + text = readFileSync(path, "utf8"); + } catch { + return []; + } + const found: string[] = []; + let lastAddress: string | null = null; + for (const line of text.split("\n")) { + const addressMatch = line.match(/\|--\s+(\d{1,3}(?:\.\d{1,3}){3})\s*$/); + if (addressMatch) { + lastAddress = addressMatch[1] ?? null; + continue; + } + if (lastAddress && /\/32 host LOCAL/.test(line)) { + if (isUsableIpv4(lastAddress) && !found.includes(lastAddress)) found.push(lastAddress); + lastAddress = null; + } + } + return found.slice(0, MAX_ADDRESSES); +} /** Non-internal IPv4 addresses, without link-local (169.254.x.x) ones. */ export function readHostAddresses( @@ -43,12 +78,14 @@ export function readHostInfo(options: ReadHostInfoOptions = {}): HostInfoResult ? options.availableParallelismImpl() : availableParallelism(); const reservedMemoryMb = options.reservedMemoryMb ?? RESERVED_SYSTEM_MEMORY_MB; + let addresses = readHostAddresses(options.networkInterfacesImpl?.()); + if (addresses.length === 0) addresses = readAddressesFromFibTrie(options.fibTriePath); return { memory_total_mb: meminfo.memTotalMb, memory_available_mb: meminfo.memAvailableMb, cpu_count: cpuCount, reserved_memory_mb: reservedMemoryMb, - addresses: readHostAddresses(options.networkInterfacesImpl?.()), + addresses, }; } From 2472544b26fc53b91cb0da5bacb5baf9f91eebc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Thu, 26 Nov 2026 00:36:49 -0300 Subject: [PATCH 34/59] fix: keep host.info working when the sandbox makes the interface lookup throw --- src/agent/host-info.test.ts | 26 ++++++++++++++++++++++++-- src/agent/host-info.ts | 13 ++++++++++--- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/agent/host-info.test.ts b/src/agent/host-info.test.ts index dffa0fa..841b5d8 100644 --- a/src/agent/host-info.test.ts +++ b/src/agent/host-info.test.ts @@ -171,7 +171,7 @@ describe("readHostInfo", () => { internal, cidr: null, }) as NetworkInterfaceInfo; - const addresses = readHostAddresses({ + const addresses = readHostAddresses(() => ({ lo: [iface("127.0.0.1", "IPv4", true)], eth0: [ iface("192.168.2.201", "IPv4"), @@ -179,10 +179,32 @@ describe("readHostInfo", () => { iface("169.254.10.2", "IPv4"), ], eth1: [iface("192.168.2.201", "IPv4"), iface("10.0.0.7", "IPv4")], - }); + })); expect(addresses).toEqual(["192.168.2.201", "10.0.0.7"]); }); + test("does not fail host.info when the interface lookup throws (sandboxed getifaddrs)", () => { + const dir = makeTempDir(); + const meminfoPath = join(dir, "meminfo"); + writeFileSync(meminfoPath, "MemTotal: 8388608 kB\nMemAvailable: 6291456 kB\n"); + expect( + readHostAddresses(() => { + throw new Error("A system error occurred: getifaddrs returned an error"); + }), + ).toEqual([]); + + const info = readHostInfo({ + meminfoPath, + availableParallelismImpl: () => 2, + networkInterfacesImpl: () => { + throw new Error("A system error occurred: getifaddrs returned an error"); + }, + fibTriePath: join(dir, "no-fib-trie"), + }); + expect(info.memory_total_mb).toBe(8192); + expect(info.addresses).toEqual([]); + }); + test("falls back to the kernel routing trie when the sandbox hides the interfaces", () => { const dir = makeTempDir(); const meminfoPath = join(dir, "meminfo"); diff --git a/src/agent/host-info.ts b/src/agent/host-info.ts index 78551de..9993f1a 100644 --- a/src/agent/host-info.ts +++ b/src/agent/host-info.ts @@ -57,10 +57,17 @@ export function readAddressesFromFibTrie(path: string = DEFAULT_FIB_TRIE_PATH): /** Non-internal IPv4 addresses, without link-local (169.254.x.x) ones. */ export function readHostAddresses( - interfaces: ReturnType = networkInterfaces(), + source: () => ReturnType = networkInterfaces, ): string[] { + let all: ReturnType; + try { + all = source(); + } catch { + // The service sandbox blocks the netlink call and getifaddrs throws. + return []; + } const found: string[] = []; - for (const entries of Object.values(interfaces)) { + for (const entries of Object.values(all)) { for (const entry of entries ?? []) { if (entry.family !== "IPv4" || entry.internal) continue; if (entry.address.startsWith("169.254.")) continue; @@ -78,7 +85,7 @@ export function readHostInfo(options: ReadHostInfoOptions = {}): HostInfoResult ? options.availableParallelismImpl() : availableParallelism(); const reservedMemoryMb = options.reservedMemoryMb ?? RESERVED_SYSTEM_MEMORY_MB; - let addresses = readHostAddresses(options.networkInterfacesImpl?.()); + let addresses = readHostAddresses(options.networkInterfacesImpl); if (addresses.length === 0) addresses = readAddressesFromFibTrie(options.fibTriePath); return { From 9701549d8dbcba11078666c32d109f1d076bc94b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Thu, 26 Nov 2026 01:11:39 -0300 Subject: [PATCH 35/59] feat: add the server.stats read command --- .../{index-z0bwfwg6.js => index-c8wyn5j3.js} | 19 +- lib/protocol/index.js | 8 +- lib/types/protocol/commands/server.d.ts | 19 + lib/types/protocol/index.d.ts | 2 +- lib/vault/index.js | 2 +- scripts/smoke-lib.ts | 22 +- src/protocol/commands/server.ts | 24 + src/protocol/index.ts | 5 + src/protocol/phase3.test.ts | 2 + src/server/index.ts | 9 + src/server/runtime.ts | 22 + src/server/stats.test.ts | 687 ++++++++++++++++++ src/server/stats.ts | 262 +++++++ src/server/systemd.ts | 2 +- 14 files changed, 1079 insertions(+), 6 deletions(-) rename lib/chunks/{index-z0bwfwg6.js => index-c8wyn5j3.js} (94%) create mode 100644 src/server/stats.test.ts create mode 100644 src/server/stats.ts diff --git a/lib/chunks/index-z0bwfwg6.js b/lib/chunks/index-c8wyn5j3.js similarity index 94% rename from lib/chunks/index-z0bwfwg6.js rename to lib/chunks/index-c8wyn5j3.js index 04dbd13..f6a565f 100644 --- a/lib/chunks/index-z0bwfwg6.js +++ b/lib/chunks/index-c8wyn5j3.js @@ -945,6 +945,16 @@ var serverConsoleSubscribeBodySchema = z4.object({ server_id: serverIdSchema, from_offset: z4.number().int().nonnegative().optional() }).strict(); +var serverStatsBodySchema = strictServerIdBodySchema; +var serverStatsResultSchema = z4.object({ + server_id: serverIdSchema, + running: z4.boolean(), + memory_used_mb: z4.number().int().nonnegative(), + memory_limit_mb: z4.number().int().nonnegative(), + cpu_percent: z4.number().finite().nonnegative(), + cpu_count: z4.number().int().positive(), + uptime_seconds: z4.number().int().nonnegative() +}).strict(); var serverCreateCommand = defineCommand({ type: "server.create", sensitive: false, @@ -963,6 +973,12 @@ var serverStatusCommand = defineCommand({ minRole: "viewer", body: strictServerIdBodySchema }); +var serverStatsCommand = defineCommand({ + type: "server.stats", + sensitive: false, + minRole: "viewer", + body: serverStatsBodySchema +}); var serverListCommand = defineCommand({ type: "server.list", sensitive: false, @@ -997,6 +1013,7 @@ var SERVER_COMMANDS = [ serverCreateCommand, serverRestartCommand, serverStatusCommand, + serverStatsCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, @@ -2072,4 +2089,4 @@ function createInMemoryTrustContext(options) { } }; } -export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, serverCreateBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverCreateCommand, serverRestartCommand, serverStatusCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, hostInfoBodySchema, hostInfoResultSchema, hostInfoCommand, HOST_COMMANDS, registerHostCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; +export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, serverCreateBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverStatsBodySchema, serverStatsResultSchema, serverCreateCommand, serverRestartCommand, serverStatusCommand, serverStatsCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, hostInfoBodySchema, hostInfoResultSchema, hostInfoCommand, HOST_COMMANDS, registerHostCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; diff --git a/lib/protocol/index.js b/lib/protocol/index.js index 8575c90..c97a887 100644 --- a/lib/protocol/index.js +++ b/lib/protocol/index.js @@ -193,6 +193,9 @@ import { serverRestartCommand, serverStartCommand, serverStateSchema, + serverStatsBodySchema, + serverStatsCommand, + serverStatsResultSchema, serverStatusChangedSchema, serverStatusCommand, serverStopCommand, @@ -233,7 +236,7 @@ import { verifyTrustGrant, worldNameSchema, wrapEventBody -} from "../chunks/index-z0bwfwg6.js"; +} from "../chunks/index-c8wyn5j3.js"; import"../chunks/index-g1frygvt.js"; export { wrapEventBody, @@ -276,6 +279,9 @@ export { serverStopCommand, serverStatusCommand, serverStatusChangedSchema, + serverStatsResultSchema, + serverStatsCommand, + serverStatsBodySchema, serverStateSchema, serverStartCommand, serverRestartCommand, diff --git a/lib/types/protocol/commands/server.d.ts b/lib/types/protocol/commands/server.d.ts index 71f306b..e076715 100644 --- a/lib/types/protocol/commands/server.d.ts +++ b/lib/types/protocol/commands/server.d.ts @@ -50,10 +50,24 @@ export declare const serverConsoleSubscribeBodySchema: z.ZodObject<{ server_id: z.ZodString; from_offset: z.ZodOptional; }, z.core.$strict>; +export declare const serverStatsBodySchema: z.ZodObject<{ + server_id: z.ZodString; +}, z.core.$strict>; +export declare const serverStatsResultSchema: z.ZodObject<{ + server_id: z.ZodString; + running: z.ZodBoolean; + memory_used_mb: z.ZodNumber; + memory_limit_mb: z.ZodNumber; + cpu_percent: z.ZodNumber; + cpu_count: z.ZodNumber; + uptime_seconds: z.ZodNumber; +}, z.core.$strict>; export type ServerCreateBody = z.infer; export type ServerUpdateSettingsBody = z.infer; export type ServerConsoleSendBody = z.infer; export type ServerConsoleSubscribeBody = z.infer; +export type ServerStatsBody = z.infer; +export type ServerStatsResult = z.infer; export declare const serverCreateCommand: import("..").CommandDefinition<"server.create", { server_id: string; name: string; @@ -71,6 +85,9 @@ export declare const serverRestartCommand: import("..").CommandDefinition<"serve export declare const serverStatusCommand: import("..").CommandDefinition<"server.status", { server_id: string; }>; +export declare const serverStatsCommand: import("..").CommandDefinition<"server.stats", { + server_id: string; +}>; export declare const serverListCommand: import("..").CommandDefinition<"server.list", Record>; export declare const serverUpdateSettingsCommand: import("..").CommandDefinition<"server.update_settings", { server_id: string; @@ -104,6 +121,8 @@ export declare const SERVER_COMMANDS: readonly [import("..").CommandDefinition<" server_id: string; }>, import("..").CommandDefinition<"server.status", { server_id: string; +}>, import("..").CommandDefinition<"server.stats", { + server_id: string; }>, import("..").CommandDefinition<"server.list", Record>, import("..").CommandDefinition<"server.update_settings", { server_id: string; memory_mb?: number | undefined; diff --git a/lib/types/protocol/index.d.ts b/lib/types/protocol/index.d.ts index 45b4b72..5066359 100644 --- a/lib/types/protocol/index.d.ts +++ b/lib/types/protocol/index.d.ts @@ -7,7 +7,7 @@ export { agentPingCommand, CORE_COMMANDS, createCoreRegistry, registerCoreComman export { FILES_COMMANDS, fileEncodingSchema, filesCopyCommand, filesDeleteCommand, filesDownloadBeginCommand, filesDownloadCloseCommand, filesDownloadCommand, filesDownloadPartCommand, filesListCommand, filesMkdirCommand, filesReadCommand, filesRenameCommand, filesStatCommand, filesUnzipCommand, filesUploadAbortCommand, filesUploadBeginCommand, filesUploadCommitCommand, filesUploadPartCommand, filesWriteCommand, filesZipCommand, registerFilesCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, sha256HexSchema, } from "./commands/files"; export { HOST_COMMANDS, type HostInfoBody, type HostInfoResult, hostInfoBodySchema, hostInfoCommand, hostInfoResultSchema, registerHostCommands, } from "./commands/host"; export { agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, } from "./commands/pairing"; -export { consoleLineSchema, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MAX_JVM_ARGS, MAX_SERVER_MEMORY_MB, MIN_SERVER_MEMORY_MB, registerServerCommands, SERVER_COMMANDS, SERVER_ID_REGEX, type ServerConsoleSendBody, type ServerConsoleSubscribeBody, type ServerCreateBody, type ServerLoader, type ServerUpdateSettingsBody, serverConsoleSendBodySchema, serverConsoleSendCommand, serverConsoleSubscribeBodySchema, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, serverCreateBodySchema, serverCreateCommand, serverIdSchema, serverListCommand, serverLoaderSchema, serverMemoryMbSchema, serverPortSchema, serverRestartCommand, serverStatusCommand, serverUpdateSettingsBodySchema, serverUpdateSettingsCommand, } from "./commands/server"; +export { consoleLineSchema, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MAX_JVM_ARGS, MAX_SERVER_MEMORY_MB, MIN_SERVER_MEMORY_MB, registerServerCommands, SERVER_COMMANDS, SERVER_ID_REGEX, type ServerConsoleSendBody, type ServerConsoleSubscribeBody, type ServerCreateBody, type ServerLoader, type ServerStatsBody, type ServerStatsResult, type ServerUpdateSettingsBody, serverConsoleSendBodySchema, serverConsoleSendCommand, serverConsoleSubscribeBodySchema, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, serverCreateBodySchema, serverCreateCommand, serverIdSchema, serverListCommand, serverLoaderSchema, serverMemoryMbSchema, serverPortSchema, serverRestartCommand, serverStatsBodySchema, serverStatsCommand, serverStatsResultSchema, serverStatusCommand, serverUpdateSettingsBodySchema, serverUpdateSettingsCommand, } from "./commands/server"; export { blobKeySchema, type ModEnvironmentInfo, type ModLayer, type ModSource, modEnvironmentInfoSchema, modFileNameSchema, modLayerSchema, modSourceSchema, type OriginPlanFileInput, type OriginPlanModInput, originPlanFileInputSchema, originPlanModInputSchema, RESERVED_WORLD_NAMES, registerStateCommands, type ServerDeployServerpackBody, type ServerModEntry, type ServerModsInstallBody, type ServerModsListBody, type ServerModsRemoveBody, type ServerOrigin, type ServerOriginApplyBody, type ServerOriginPlanBody, type ServerOriginSyncState, type ServerOriginUnlinkBody, type ServerWorldImportBody, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, STATE_COMMANDS, serverDeployServerpackBodySchema, serverDeployServerpackCommand, serverModEntrySchema, serverModsInstallBodySchema, serverModsInstallCommand, serverModsListBodySchema, serverModsListCommand, serverModsRemoveBodySchema, serverModsRemoveCommand, serverOriginApplyBodySchema, serverOriginApplyCommand, serverOriginPlanBodySchema, serverOriginPlanCommand, serverOriginSchema, serverOriginSyncStateSchema, serverOriginUnlinkBodySchema, serverOriginUnlinkCommand, serverWorldImportBodySchema, serverWorldImportCommand, sha1HexSchema, sha512HexSchema, WORLD_NAME_REGEX, worldNameSchema, } from "./commands/state"; export { PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, registerTunnelCommands, TUNNEL_COMMANDS, type TunnelPlayitSetKeyBody, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStatusCommand, tunnelPlayitStopCommand, } from "./commands/tunnel"; export { DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_AGENT_MESSAGE, DOMAIN_COMMAND, DOMAIN_PAIRING_PROOF, DOMAIN_REVOCATION, DOMAIN_ROLE_GRANT, DOMAIN_SESSION, DOMAIN_TRUST_GRANT, PROTOCOL_VERSION, } from "./domains"; diff --git a/lib/vault/index.js b/lib/vault/index.js index a7eb5c7..8ace112 100644 --- a/lib/vault/index.js +++ b/lib/vault/index.js @@ -5,7 +5,7 @@ import { sessionCertificateSchema, signRevocationList, signSessionCertificate -} from "../chunks/index-z0bwfwg6.js"; +} from "../chunks/index-c8wyn5j3.js"; import { KDF_ALG_ARGON2ID13, KDF_MODERATE, diff --git a/scripts/smoke-lib.ts b/scripts/smoke-lib.ts index 3167a62..91f42e2 100644 --- a/scripts/smoke-lib.ts +++ b/scripts/smoke-lib.ts @@ -4,7 +4,12 @@ // Exercises the built library (lib/) the way a consumer would: crypto, protocol and vault must // share one initialized libsodium instance. import { ready } from "tegrad/crypto"; -import { createCoreRegistry, hostInfoResultSchema, PROTOCOL_VERSION } from "tegrad/protocol"; +import { + createCoreRegistry, + hostInfoResultSchema, + PROTOCOL_VERSION, + serverStatsResultSchema, +} from "tegrad/protocol"; import { createVault, unlockVault } from "tegrad/vault"; await ready(); @@ -36,4 +41,19 @@ if ( process.stderr.write("lib smoke test failed: host.info\n"); process.exit(1); } +if ( + createCoreRegistry().get("server.stats") === undefined || + !serverStatsResultSchema.safeParse({ + server_id: "survival", + running: true, + memory_used_mb: 1024, + memory_limit_mb: 2048, + cpu_percent: 42.5, + cpu_count: 4, + uptime_seconds: 120, + }).success +) { + process.stderr.write("lib smoke test failed: server.stats\n"); + process.exit(1); +} process.stdout.write("lib smoke test ok\n"); diff --git a/src/protocol/commands/server.ts b/src/protocol/commands/server.ts index a4abefc..a502b8c 100644 --- a/src/protocol/commands/server.ts +++ b/src/protocol/commands/server.ts @@ -77,10 +77,26 @@ export const serverConsoleSubscribeBodySchema = z }) .strict(); +export const serverStatsBodySchema = strictServerIdBodySchema; + +export const serverStatsResultSchema = z + .object({ + server_id: serverIdSchema, + running: z.boolean(), + memory_used_mb: z.number().int().nonnegative(), + memory_limit_mb: z.number().int().nonnegative(), + cpu_percent: z.number().finite().nonnegative(), + cpu_count: z.number().int().positive(), + uptime_seconds: z.number().int().nonnegative(), + }) + .strict(); + export type ServerCreateBody = z.infer; export type ServerUpdateSettingsBody = z.infer; export type ServerConsoleSendBody = z.infer; export type ServerConsoleSubscribeBody = z.infer; +export type ServerStatsBody = z.infer; +export type ServerStatsResult = z.infer; export const serverCreateCommand = defineCommand({ type: "server.create", @@ -103,6 +119,13 @@ export const serverStatusCommand = defineCommand({ body: strictServerIdBodySchema, }); +export const serverStatsCommand = defineCommand({ + type: "server.stats", + sensitive: false, + minRole: "viewer", + body: serverStatsBodySchema, +}); + export const serverListCommand = defineCommand({ type: "server.list", sensitive: false, @@ -142,6 +165,7 @@ export const SERVER_COMMANDS = [ serverCreateCommand, serverRestartCommand, serverStatusCommand, + serverStatsCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, diff --git a/src/protocol/index.ts b/src/protocol/index.ts index 3ef6142..c743ae1 100644 --- a/src/protocol/index.ts +++ b/src/protocol/index.ts @@ -165,6 +165,8 @@ export { type ServerConsoleSubscribeBody, type ServerCreateBody, type ServerLoader, + type ServerStatsBody, + type ServerStatsResult, type ServerUpdateSettingsBody, serverConsoleSendBodySchema, serverConsoleSendCommand, @@ -179,6 +181,9 @@ export { serverMemoryMbSchema, serverPortSchema, serverRestartCommand, + serverStatsBodySchema, + serverStatsCommand, + serverStatsResultSchema, serverStatusCommand, serverUpdateSettingsBodySchema, serverUpdateSettingsCommand, diff --git a/src/protocol/phase3.test.ts b/src/protocol/phase3.test.ts index 8cb9700..c02c6a5 100644 --- a/src/protocol/phase3.test.ts +++ b/src/protocol/phase3.test.ts @@ -654,6 +654,7 @@ const MIN_ROLE: Record = { "agent.unsubscribe": "viewer", "host.info": "viewer", "server.status": "viewer", + "server.stats": "viewer", "server.list": "viewer", "server.console.subscribe": "viewer", "server.console.unsubscribe": "viewer", @@ -728,6 +729,7 @@ describe("minimum roles", () => { "server.stop": { server_id: SERVER }, "server.restart": { server_id: SERVER }, "server.status": { server_id: SERVER }, + "server.stats": { server_id: SERVER }, "server.list": {}, "server.console.send": { server_id: SERVER, line: "list" }, "server.console.subscribe": { server_id: SERVER }, diff --git a/src/server/index.ts b/src/server/index.ts index 1d22bcc..2664258 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -122,6 +122,15 @@ export { validateSingleJvmArg, writeStartScript, } from "./start-script"; +export { + createServerStatsCollector, + getUnitStats, + parseActiveEnterTimestampMs, + parseSystemdStatsOutput, + type ServerStatsCollector, + type ServerStatsCollectorOptions, + type SystemdUnitStats, +} from "./stats"; export { createServerStatusWatcher, DEFAULT_STATUS_POLL_INTERVAL_MS, diff --git a/src/server/runtime.ts b/src/server/runtime.ts index 8707e6e..424ad4e 100644 --- a/src/server/runtime.ts +++ b/src/server/runtime.ts @@ -13,6 +13,8 @@ import { type ServerConsoleSubscribeBody, type ServerCreateBody, type ServerState, + type ServerStatsBody, + type ServerStatsResult, type ServerUpdateSettingsBody, serverCreateBodySchema, serverUpdateSettingsBodySchema, @@ -57,6 +59,7 @@ import { writeServerProperties, } from "./registry"; import { validateJvmArgs, writeStartScript } from "./start-script"; +import { createServerStatsCollector } from "./stats"; import { mapUnitState } from "./status-watcher"; import { getUnitStatus, @@ -93,6 +96,7 @@ export interface ServerManagerOptions { readonly stopTimeoutMs?: number; readonly sleepImpl?: (ms: number) => Promise; readonly now?: () => number; + readonly availableParallelismImpl?: () => number; readonly platform?: NodeJS.Platform; readonly logger?: Logger; /** Group id of the server user's group; resolved from /etc/group when omitted, null to skip. */ @@ -106,6 +110,7 @@ export interface ServerManager { restartServer(serverId: string): Promise; deleteServer(serverId: string): Promise; getServerStatus(serverId: string): Promise; + getServerStats(serverId: string): Promise; /** Current state of a server's unit as clients see it, or null when unknown. */ getServerState(serverId: string): Promise; listServers(): ServerMetadata[]; @@ -143,6 +148,15 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM now, }); + const statsCollector = createServerStatsCollector({ + serversDir, + ...(options.runFixedImpl !== undefined ? { runFixedImpl: options.runFixedImpl } : {}), + ...(options.availableParallelismImpl !== undefined + ? { availableParallelismImpl: options.availableParallelismImpl } + : {}), + now, + }); + function readHostMeminfo(): Meminfo { if (options.readMeminfoImpl !== undefined) { return options.readMeminfoImpl(); @@ -346,6 +360,7 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM readServerMetadata(serversDir, validId); consoleManager.unsubscribe(validId); + statsCollector.forget(validId); const status = await getUnitStatus(validId, options.runFixedImpl); if (!isUnitStopped(status)) { @@ -475,6 +490,7 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM restartServer, deleteServer, getServerStatus, + getServerStats: (serverId: string) => statsCollector.readStats(serverId), getServerState, listServers, updateServerSettings, @@ -540,6 +556,12 @@ export function registerServerHandlers( ctx.sendEvent("server.status.result", status); }); + queue.registerHandler("server.stats", async (opened, ctx) => { + const body = opened.body as ServerStatsBody; + const stats = await manager.getServerStats(body.server_id); + ctx.sendEvent("server.stats.result", stats); + }); + queue.registerHandler("server.list", (_opened, ctx) => { const servers = manager .listServers() diff --git a/src/server/stats.test.ts b/src/server/stats.test.ts new file mode 100644 index 0000000..94cdffa --- /dev/null +++ b/src/server/stats.test.ts @@ -0,0 +1,687 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeAll, describe, expect, test } from "bun:test"; +import { mkdtempSync, rmSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { z } from "zod"; +import { createCommandQueue, createLogger, type TransportCommandFrame } from "../agent"; +import { openTestEvent } from "../agent/test-events"; +import { + fingerprint, + generateSigningKeyPair, + ready, + type SigningKeyPair, + toBase64Url, +} from "../crypto"; +import { + CommandRegistry, + createCoreRegistry, + createInMemoryTrustContext, + createSignedCommand, + defineCommand, + PROTOCOL_VERSION, + ProtocolError, + serverIdSchema, + serverStatsBodySchema, + serverStatsCommand, + serverStatsResultSchema, + signSessionCertificate, + type TransportFrame, +} from "../protocol"; +import { + createServerManager, + createServerStatsCollector, + getUnitStats, + parseActiveEnterTimestampMs, + parseSystemdStatsOutput, + type RunFixedLike, + registerServerHandlers, + type ServerMetadata, + writeServerMetadata, +} from "./index"; + +const NOW = 1_700_000_000_000; +const tempDirs: string[] = []; +const silentLogger = createLogger({ level: "error", stdout: () => {}, stderr: () => {} }); + +beforeAll(async () => { + await ready(); +}); + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +function makeTempDir(): string { + const dir = mkdtempSync(join(tmpdir(), "tegrad-server-stats-")); + tempDirs.push(dir); + return dir; +} + +function makeSession(account: SigningKeyPair) { + const key = generateSigningKeyPair(); + const certificate = signSessionCertificate({ + sessionPublicKey: key.publicKey, + accountKeyPair: account, + notBefore: NOW - 1000, + notAfter: NOW + 3_600_000, + }); + return { key, certificate }; +} + +function makeMetadata(id = "survival", memoryMb = 4096): ServerMetadata { + return { + v: 1, + id, + name: "Survival", + minecraft_version: "1.21.4", + loader: "vanilla", + loader_version: null, + memory_mb: memoryMb, + jvm_args: [], + port: 25565, + created_at: NOW, + }; +} + +describe("server.stats schema and command definition", () => { + test("is registered in the core registry as non-sensitive viewer command", () => { + const registry = createCoreRegistry(); + const def = registry.get("server.stats"); + expect(def).toBe(serverStatsCommand); + expect(def?.sensitive).toBe(false); + expect(def?.minRole).toBe("viewer"); + }); + + test("serverStatsBodySchema accepts valid server_id and rejects extra or invalid fields", () => { + expect(serverStatsBodySchema.safeParse({ server_id: "survival" }).success).toBe(true); + expect(serverStatsBodySchema.safeParse({ server_id: "survival", extra: true }).success).toBe( + false, + ); + expect(serverStatsBodySchema.safeParse({ server_id: "../bad" }).success).toBe(false); + expect(serverStatsBodySchema.safeParse({}).success).toBe(false); + expect(serverStatsBodySchema.safeParse(null).success).toBe(false); + }); + + test("serverStatsResultSchema validates fields and rejects extra or out-of-range values", () => { + const valid = { + server_id: "survival", + running: true, + memory_used_mb: 2048, + memory_limit_mb: 4096, + cpu_percent: 175.4, + cpu_count: 8, + uptime_seconds: 3600, + }; + expect(serverStatsResultSchema.safeParse(valid).success).toBe(true); + expect(serverStatsResultSchema.safeParse({ ...valid, extra: 1 }).success).toBe(false); + expect(serverStatsResultSchema.safeParse({ ...valid, memory_used_mb: -1 }).success).toBe(false); + expect(serverStatsResultSchema.safeParse({ ...valid, memory_used_mb: 12.5 }).success).toBe( + false, + ); + expect(serverStatsResultSchema.safeParse({ ...valid, cpu_percent: -0.1 }).success).toBe(false); + expect(serverStatsResultSchema.safeParse({ ...valid, cpu_percent: Number.NaN }).success).toBe( + false, + ); + expect( + serverStatsResultSchema.safeParse({ ...valid, cpu_percent: Number.POSITIVE_INFINITY }) + .success, + ).toBe(false); + expect(serverStatsResultSchema.safeParse({ ...valid, cpu_count: 0 }).success).toBe(false); + expect(serverStatsResultSchema.safeParse({ ...valid, uptime_seconds: -5 }).success).toBe(false); + expect(serverStatsResultSchema.safeParse({ ...valid, uptime_seconds: 1.5 }).success).toBe( + false, + ); + }); +}); + +describe("systemd stats parsing and getUnitStats", () => { + test("parses active unit output including @unix timestamp and large CPUUsageNSec", () => { + const parsed = parseSystemdStatsOutput( + [ + "ActiveState=active", + "MemoryCurrent=1073741824", + "CPUUsageNSec=9007199254740999", + "ActiveEnterTimestamp=@1700000000", + ].join("\n"), + ); + + expect(parsed).toEqual({ + activeState: "active", + memoryCurrentBytes: 1_073_741_824, + cpuUsageNs: 9_007_199_254_740_999n, + activeEnterTimestampMs: 1_700_000_000_000, + }); + }); + + test("degrades safely when accounting is disabled or values are invalid", () => { + const disabled = parseSystemdStatsOutput( + [ + "ActiveState=active", + "MemoryCurrent=[not set]", + "CPUUsageNSec=18446744073709551615", + "ActiveEnterTimestamp=n/a", + ].join("\n"), + ); + expect(disabled).toEqual({ + activeState: "active", + memoryCurrentBytes: null, + cpuUsageNs: null, + activeEnterTimestampMs: null, + }); + + const malformed = parseSystemdStatsOutput( + [ + "ActiveState=inactive", + "MemoryCurrent=infinity", + "CPUUsageNSec=-10", + "ActiveEnterTimestamp=not-a-timestamp", + "NoEqualsHere", + ].join("\n"), + ); + expect(malformed).toEqual({ + activeState: "inactive", + memoryCurrentBytes: null, + cpuUsageNs: null, + activeEnterTimestampMs: null, + }); + + expect(parseActiveEnterTimestampMs("@0")).toBeNull(); + expect(parseActiveEnterTimestampMs("0")).toBeNull(); + expect(parseActiveEnterTimestampMs("")).toBeNull(); + expect(parseActiveEnterTimestampMs("2026-01-01T00:00:00Z")).toBe( + Date.parse("2026-01-01T00:00:00Z"), + ); + }); + + test("getUnitStats validates server_id before calling systemctl and surfaces errors", async () => { + const calls: { cmd: string; args: readonly string[] }[] = []; + const runFixedImpl: RunFixedLike = async (cmd, args) => { + calls.push({ cmd, args }); + return { + code: 0, + stdout: "ActiveState=active\nMemoryCurrent=0\nCPUUsageNSec=0\nActiveEnterTimestamp=@100\n", + stderr: "", + timedOut: false, + truncated: false, + }; + }; + + try { + await getUnitStats("../bad", runFixedImpl); + throw new Error("Expected invalid_body"); + } catch (err) { + expect(err).toBeInstanceOf(ProtocolError); + expect((err as ProtocolError).code).toBe("invalid_body"); + } + expect(calls).toHaveLength(0); + + await getUnitStats("survival", runFixedImpl); + expect(calls).toEqual([ + { + cmd: "systemctl", + args: [ + "show", + "--timestamp=unix", + "-p", + "ActiveState,MemoryCurrent,CPUUsageNSec,ActiveEnterTimestamp", + "tegrad-server@survival.service", + ], + }, + ]); + + await expect( + getUnitStats("survival", async () => ({ + code: 1, + stdout: "", + stderr: "boom", + timedOut: false, + truncated: false, + })), + ).rejects.toThrow(ProtocolError); + }); +}); + +describe("createServerStatsCollector", () => { + test("returns zeros when stopped while preserving memory_limit_mb and cpu_count", async () => { + const dir = makeTempDir(); + writeServerMetadata(dir, makeMetadata("survival", 4096)); + + const collector = createServerStatsCollector({ + serversDir: dir, + availableParallelismImpl: () => 6, + now: () => NOW, + runFixedImpl: async () => ({ + code: 0, + stdout: + "ActiveState=inactive\nMemoryCurrent=[not set]\nCPUUsageNSec=[not set]\nActiveEnterTimestamp=n/a\n", + stderr: "", + timedOut: false, + truncated: false, + }), + }); + + const stats = await collector.readStats("survival"); + expect(stats).toEqual({ + server_id: "survival", + running: false, + memory_used_mb: 0, + memory_limit_mb: 4096, + cpu_percent: 0, + cpu_count: 6, + uptime_seconds: 0, + }); + expect(serverStatsResultSchema.safeParse(stats).success).toBe(true); + }); + + test("computes memory_used_mb, uptime_seconds, and cpu_percent across consecutive samples", async () => { + const dir = makeTempDir(); + writeServerMetadata(dir, makeMetadata("survival", 4096)); + + let currentNow = 1_700_000_120_000; + let activeEnterSec = 1_700_000_000; + let memoryBytes = 1536 * 1024 * 1024; + let cpuNs = 10_000_000_000n; + let activeState = "active"; + + const collector = createServerStatsCollector({ + serversDir: dir, + availableParallelismImpl: () => 4, + now: () => currentNow, + getUnitStatsImpl: async () => ({ + activeState, + memoryCurrentBytes: memoryBytes, + cpuUsageNs: cpuNs, + activeEnterTimestampMs: activeEnterSec * 1000, + }), + }); + + // First reading has no previous sample -> cpu_percent is 0. + const first = await collector.readStats("survival"); + expect(first).toEqual({ + server_id: "survival", + running: true, + memory_used_mb: 1536, + memory_limit_mb: 4096, + cpu_percent: 0, + cpu_count: 4, + uptime_seconds: 120, + }); + + // 2 seconds elapsed, 3 seconds of CPU time used across cores -> 150.0% of one core. + currentNow += 2000; + cpuNs += 3_000_000_000n; + memoryBytes = 1600 * 1024 * 1024; + const second = await collector.readStats("survival"); + expect(second).toEqual({ + server_id: "survival", + running: true, + memory_used_mb: 1600, + memory_limit_mb: 4096, + cpu_percent: 150, + cpu_count: 4, + uptime_seconds: 122, + }); + + // 4 seconds elapsed, 1 second of CPU time -> 25.0%. + currentNow += 4000; + cpuNs += 1_000_000_000n; + const third = await collector.readStats("survival"); + expect(third.cpu_percent).toBe(25); + + // If the unit restarts (ActiveEnterTimestamp changes), cpu_percent resets to 0. + currentNow += 2000; + activeEnterSec = 1_700_000_127; + cpuNs = 200_000_000n; + const afterRestart = await collector.readStats("survival"); + expect(afterRestart.cpu_percent).toBe(0); + + // Stopping clears the sample so starting again starts fresh at 0%. + activeState = "inactive"; + const stopped = await collector.readStats("survival"); + expect(stopped.running).toBe(false); + expect(stopped.cpu_percent).toBe(0); + expect(stopped.memory_used_mb).toBe(0); + expect(stopped.uptime_seconds).toBe(0); + + activeState = "active"; + currentNow += 1000; + cpuNs = 500_000_000n; + const restarted = await collector.readStats("survival"); + expect(restarted.cpu_percent).toBe(0); + }); + + test("returns 0 for disabled accounting and throws server_not_found for missing server", async () => { + const dir = makeTempDir(); + writeServerMetadata(dir, makeMetadata("survival", 2048)); + + let systemctlCalled = false; + const collector = createServerStatsCollector({ + serversDir: dir, + availableParallelismImpl: () => 2, + now: () => NOW + 5000, + runFixedImpl: async () => { + systemctlCalled = true; + return { + code: 0, + stdout: + "ActiveState=active\nMemoryCurrent=18446744073709551615\nCPUUsageNSec=[not set]\nActiveEnterTimestamp=@1700000000\n", + stderr: "", + timedOut: false, + truncated: false, + }; + }, + }); + + await expect(collector.readStats("missing")).rejects.toThrow(ProtocolError); + expect(systemctlCalled).toBe(false); + + const stats = await collector.readStats("survival"); + expect(systemctlCalled).toBe(true); + expect(stats).toEqual({ + server_id: "survival", + running: true, + memory_used_mb: 0, + memory_limit_mb: 2048, + cpu_percent: 0, + cpu_count: 2, + uptime_seconds: 5, + }); + }); +}); + +describe("server.stats command handler and authorization", () => { + function setupQueue(options?: { + readonly serversDir?: string; + readonly runFixedImpl?: RunFixedLike; + readonly nowMs?: () => number; + }) { + const serversDir = options?.serversDir ?? makeTempDir(); + const runDir = makeTempDir(); + const agent = generateSigningKeyPair(); + const owner = generateSigningKeyPair(); + const viewer = generateSigningKeyPair(); + const viewerSession = makeSession(viewer); + const registry = createCoreRegistry(); + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [owner.publicKey], + members: [ + { + account_key: toBase64Url(viewer.publicKey), + account: fingerprint(viewer.publicKey), + granted_by: fingerprint(owner.publicKey), + role: "viewer", + servers: ["survival"], + issued_at: NOW, + }, + ], + now: options?.nowMs ?? (() => NOW), + }); + + const sent: TransportFrame[] = []; + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (frame) => sent.push(frame), + logger: silentLogger, + }); + const manager = createServerManager({ + serversDir, + runDir, + platform: "linux", + availableParallelismImpl: () => 4, + ...(options?.runFixedImpl !== undefined ? { runFixedImpl: options.runFixedImpl } : {}), + ...(options?.nowMs !== undefined ? { now: options.nowMs } : {}), + }); + registerServerHandlers(queue, manager); + + return { + serversDir, + agent, + owner, + viewer, + viewerSession, + registry, + sent, + queue, + manager, + }; + } + + test("viewer session receives encrypted server.stats.result sealed to reply_to", async () => { + let nowMs = 1_700_000_010_000; + let callCount = 0; + const ctx = setupQueue({ + nowMs: () => nowMs, + runFixedImpl: async () => { + callCount++; + const cpuNs = callCount === 1 ? "1000000000" : "2000000000"; + return { + code: 0, + stdout: `ActiveState=active\nMemoryCurrent=536870912\nCPUUsageNSec=${cpuNs}\nActiveEnterTimestamp=@1700000000\n`, + stderr: "", + timedOut: false, + truncated: false, + }; + }, + }); + writeServerMetadata(ctx.serversDir, makeMetadata("survival", 2048)); + + const sendAsViewer = async (counter: number) => { + const cmd = createSignedCommand( + { + type: "server.stats", + body: { server_id: "survival" }, + agentPublicKey: ctx.agent.publicKey, + signer: ctx.viewerSession.key, + session: ctx.viewerSession.certificate, + replyTo: ctx.viewerSession.key.publicKey, + counter, + now: nowMs, + }, + ctx.registry, + ); + const frame: TransportCommandFrame = { + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: fingerprint(ctx.agent.publicKey) }, + body: cmd, + }; + await ctx.queue.enqueue(frame); + return cmd; + }; + + const cmd1 = await sendAsViewer(1); + nowMs += 2000; + const cmd2 = await sendAsViewer(2); + + const events = ctx.sent.filter( + (f): f is Extract => f.kind === "event", + ); + expect(events).toHaveLength(2); + const [firstEvent, secondEvent] = events; + if (!firstEvent || !secondEvent) { + throw new Error("Expected two server.stats.result events"); + } + expect(firstEvent.route.recipient).toBe(fingerprint(ctx.viewerSession.key.publicKey)); + + const firstOpened = openTestEvent(firstEvent.body, ctx.agent.publicKey, ctx.viewerSession.key); + expect(firstOpened.header.type).toBe("server.stats.result"); + expect(firstOpened.inReplyTo).toBe(cmd1.header.id); + expect(serverStatsResultSchema.parse(firstOpened.body)).toEqual({ + server_id: "survival", + running: true, + memory_used_mb: 512, + memory_limit_mb: 2048, + cpu_percent: 0, + cpu_count: 4, + uptime_seconds: 10, + }); + + const secondOpened = openTestEvent( + secondEvent.body, + ctx.agent.publicKey, + ctx.viewerSession.key, + ); + expect(secondOpened.inReplyTo).toBe(cmd2.header.id); + expect(serverStatsResultSchema.parse(secondOpened.body)).toEqual({ + server_id: "survival", + running: true, + memory_used_mb: 512, + memory_limit_mb: 2048, + cpu_percent: 50, + cpu_count: 4, + uptime_seconds: 12, + }); + + // Account key cannot decrypt a reply sealed to the session key. + expect(() => openTestEvent(firstEvent.body, ctx.agent.publicKey, ctx.viewer)).toThrow(); + ctx.manager.close(); + }); + + test("rejects untrusted accounts and viewers without access to the target server", async () => { + const ctx = setupQueue(); + writeServerMetadata(ctx.serversDir, makeMetadata("creative", 2048)); + const stranger = generateSigningKeyPair(); + + const strangerCmd = createSignedCommand( + { + type: "server.stats", + body: { server_id: "creative" }, + agentPublicKey: ctx.agent.publicKey, + signer: stranger, + counter: 1, + now: NOW, + }, + ctx.registry, + ); + await ctx.queue.enqueue({ + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: fingerprint(ctx.agent.publicKey) }, + body: strangerCmd, + }); + + const scopedViewerCmd = createSignedCommand( + { + type: "server.stats", + body: { server_id: "creative" }, + agentPublicKey: ctx.agent.publicKey, + signer: ctx.viewerSession.key, + session: ctx.viewerSession.certificate, + replyTo: ctx.viewerSession.key.publicKey, + counter: 1, + now: NOW, + }, + ctx.registry, + ); + await ctx.queue.enqueue({ + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: fingerprint(ctx.agent.publicKey) }, + body: scopedViewerCmd, + }); + + const acks = ctx.sent.filter( + (f): f is Extract => f.kind === "ack", + ); + expect(acks[0]?.body).toEqual({ + id: strangerCmd.header.id, + ok: false, + code: "untrusted_signer", + }); + expect(acks[1]?.body).toEqual({ + id: scopedViewerCmd.header.id, + ok: false, + code: "insufficient_role", + }); + expect(ctx.sent.some((f) => f.kind === "event")).toBe(false); + ctx.manager.close(); + }); + + test("rejects extra parameters on server.stats and returns server_not_found for missing server", async () => { + const ctx = setupQueue(); + + expect(() => + createSignedCommand( + { + type: "server.stats", + body: { server_id: "survival", unexpected: 1 }, + agentPublicKey: ctx.agent.publicKey, + signer: ctx.owner, + counter: 1, + now: NOW, + }, + ctx.registry, + ), + ).toThrow(ProtocolError); + + const permissiveRegistry = new CommandRegistry().register( + defineCommand({ + type: "server.stats", + sensitive: false, + minRole: "viewer", + body: z.object({ server_id: serverIdSchema, unexpected: z.number() }), + }), + ); + const extraCmd = createSignedCommand( + { + type: "server.stats", + body: { server_id: "survival", unexpected: 1 }, + agentPublicKey: ctx.agent.publicKey, + signer: ctx.owner, + counter: 1, + now: NOW, + }, + permissiveRegistry, + ); + await ctx.queue.enqueue({ + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: fingerprint(ctx.agent.publicKey) }, + body: extraCmd, + }); + + const missingCmd = createSignedCommand( + { + type: "server.stats", + body: { server_id: "survival" }, + agentPublicKey: ctx.agent.publicKey, + signer: ctx.owner, + counter: 2, + now: NOW, + }, + ctx.registry, + ); + await ctx.queue.enqueue({ + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: fingerprint(ctx.agent.publicKey) }, + body: missingCmd, + }); + + const acks = ctx.sent.filter( + (f): f is Extract => f.kind === "ack", + ); + expect(acks[0]?.body).toEqual({ + id: extraCmd.header.id, + ok: false, + code: "invalid_body", + }); + expect(acks[1]?.body).toEqual({ + id: missingCmd.header.id, + ok: false, + code: "server_not_found", + }); + expect(ctx.sent.some((f) => f.kind === "event")).toBe(false); + ctx.manager.close(); + }); +}); diff --git a/src/server/stats.ts b/src/server/stats.ts new file mode 100644 index 0000000..ed2cdb2 --- /dev/null +++ b/src/server/stats.ts @@ -0,0 +1,262 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { availableParallelism } from "node:os"; +import { runFixed } from "../agent/exec"; +import { ProtocolError, type ServerStatsResult } from "../protocol"; +import { assertValidServerId, DEFAULT_SERVERS_DIR, formatServiceUnit } from "./id"; +import type { RunFixedLike } from "./java"; +import { readServerMetadata, type ServerMetadata } from "./registry"; +import { isUnitActive } from "./systemd"; + +const UINT64_MAX = 18_446_744_073_709_551_615n; +const BYTES_PER_MIB = 1024 * 1024; +const NS_PER_MS = 1_000_000; + +export interface SystemdUnitStats { + readonly activeState: string; + readonly memoryCurrentBytes: number | null; + readonly cpuUsageNs: bigint | null; + readonly activeEnterTimestampMs: number | null; +} + +function parseUint64Property(value: string): bigint | null { + const trimmed = value.trim(); + if ( + trimmed.length === 0 || + trimmed === "[not set]" || + trimmed === "infinity" || + !/^\d+$/.test(trimmed) + ) { + return null; + } + const parsed = BigInt(trimmed); + return parsed < UINT64_MAX ? parsed : null; +} + +function parseMemoryBytesProperty(value: string): number | null { + const parsed = parseUint64Property(value); + if (parsed === null) { + return null; + } + const asNumber = Number(parsed); + return Number.isSafeInteger(asNumber) && asNumber >= 0 ? asNumber : null; +} + +export function parseActiveEnterTimestampMs(value: string): number | null { + const trimmed = value.trim(); + if ( + trimmed.length === 0 || + trimmed === "n/a" || + trimmed === "[not set]" || + trimmed === "0" || + trimmed === "@0" + ) { + return null; + } + if (trimmed.startsWith("@")) { + const rawSec = trimmed.slice(1); + if (!/^\d+(?:\.\d+)?$/.test(rawSec)) { + return null; + } + const sec = Number(rawSec); + if (!Number.isFinite(sec) || sec <= 0) { + return null; + } + return Math.floor(sec * 1000); + } + const parsed = Date.parse(trimmed); + return Number.isFinite(parsed) && parsed > 0 ? parsed : null; +} + +export function parseSystemdStatsOutput(stdout: string): SystemdUnitStats { + let activeState = "unknown"; + let memoryCurrentBytes: number | null = null; + let cpuUsageNs: bigint | null = null; + let activeEnterTimestampMs: number | null = null; + + for (const rawLine of stdout.split(/\r?\n/)) { + const trimmed = rawLine.trim(); + if (trimmed.length === 0) { + continue; + } + const eqIndex = trimmed.indexOf("="); + if (eqIndex === -1) { + continue; + } + const key = trimmed.slice(0, eqIndex); + const value = trimmed.slice(eqIndex + 1); + + if (key === "ActiveState") { + activeState = value; + } else if (key === "MemoryCurrent") { + memoryCurrentBytes = parseMemoryBytesProperty(value); + } else if (key === "CPUUsageNSec") { + cpuUsageNs = parseUint64Property(value); + } else if (key === "ActiveEnterTimestamp") { + activeEnterTimestampMs = parseActiveEnterTimestampMs(value); + } + } + + return { + activeState, + memoryCurrentBytes, + cpuUsageNs, + activeEnterTimestampMs, + }; +} + +/** + * Queries systemd unit accounting properties over D-Bus (`systemctl show`). + * The agent service runs with `ProtectControlGroups=yes`, empty `CapabilityBoundingSet=`, + * and `RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX`, so D-Bus via `AF_UNIX` works + * without widening the sandbox and avoids cgroup v1/v2 or slice path differences. + */ +export async function getUnitStats( + serverId: string, + runFixedImpl: RunFixedLike = runFixed, +): Promise { + const validId = assertValidServerId(serverId); + const serviceUnit = formatServiceUnit(validId); + const result = await runFixedImpl("systemctl", [ + "show", + "--timestamp=unix", + "-p", + "ActiveState,MemoryCurrent,CPUUsageNSec,ActiveEnterTimestamp", + serviceUnit, + ]); + if (result.timedOut || result.code !== 0) { + throw new ProtocolError( + "systemd_error", + `Failed to query systemd stats for ${serviceUnit} (exit ${result.code})`, + ); + } + return parseSystemdStatsOutput(result.stdout); +} + +export interface ServerStatsCollectorOptions { + readonly serversDir?: string; + readonly readServerMetadataImpl?: (serverId: string) => ServerMetadata; + readonly getUnitStatsImpl?: (serverId: string) => Promise; + readonly runFixedImpl?: RunFixedLike; + readonly availableParallelismImpl?: () => number; + readonly now?: () => number; +} + +export interface ServerStatsCollector { + readStats(serverId: string): Promise; + forget(serverId: string): void; +} + +interface CpuSample { + readonly cpuUsageNs: bigint; + readonly sampledAtMs: number; + readonly activeEnterTimestampMs: number | null; +} + +export function createServerStatsCollector( + options: ServerStatsCollectorOptions = {}, +): ServerStatsCollector { + const serversDir = options.serversDir ?? DEFAULT_SERVERS_DIR; + const readMeta = + options.readServerMetadataImpl ?? ((id: string) => readServerMetadata(serversDir, id)); + const queryUnit = + options.getUnitStatsImpl ?? ((id: string) => getUnitStats(id, options.runFixedImpl)); + const getCpuCount = options.availableParallelismImpl ?? availableParallelism; + const now = options.now ?? (() => Date.now()); + + const lastCpuSamples = new Map(); + + function computeCpuPercent( + serverId: string, + cpuUsageNs: bigint | null, + activeEnterTimestampMs: number | null, + sampledAtMs: number, + ): number { + if (cpuUsageNs === null) { + lastCpuSamples.delete(serverId); + return 0; + } + + const previous = lastCpuSamples.get(serverId); + lastCpuSamples.set(serverId, { + cpuUsageNs, + sampledAtMs, + activeEnterTimestampMs, + }); + + if (previous === undefined) { + return 0; + } + if ( + previous.activeEnterTimestampMs !== null && + activeEnterTimestampMs !== null && + previous.activeEnterTimestampMs !== activeEnterTimestampMs + ) { + return 0; + } + + const deltaMs = sampledAtMs - previous.sampledAtMs; + const deltaNs = cpuUsageNs - previous.cpuUsageNs; + if (deltaMs <= 0 || deltaNs < 0n) { + return 0; + } + + const rawPercent = (Number(deltaNs) / (deltaMs * NS_PER_MS)) * 100; + if (!Number.isFinite(rawPercent) || rawPercent < 0) { + return 0; + } + return Math.round(rawPercent * 10) / 10; + } + + return { + async readStats(serverId: string): Promise { + const validId = assertValidServerId(serverId); + const meta = readMeta(validId); + const unit = await queryUnit(validId); + const sampledAtMs = now(); + const cpuCount = Math.max(1, Math.trunc(getCpuCount())); + const running = isUnitActive(unit); + + if (!running) { + lastCpuSamples.delete(validId); + return { + server_id: validId, + running: false, + memory_used_mb: 0, + memory_limit_mb: meta.memory_mb, + cpu_percent: 0, + cpu_count: cpuCount, + uptime_seconds: 0, + }; + } + + const memoryUsedMb = + unit.memoryCurrentBytes !== null ? Math.round(unit.memoryCurrentBytes / BYTES_PER_MIB) : 0; + const uptimeSeconds = + unit.activeEnterTimestampMs !== null && sampledAtMs >= unit.activeEnterTimestampMs + ? Math.floor((sampledAtMs - unit.activeEnterTimestampMs) / 1000) + : 0; + const cpuPercent = computeCpuPercent( + validId, + unit.cpuUsageNs, + unit.activeEnterTimestampMs, + sampledAtMs, + ); + + return { + server_id: validId, + running: true, + memory_used_mb: memoryUsedMb, + memory_limit_mb: meta.memory_mb, + cpu_percent: cpuPercent, + cpu_count: cpuCount, + uptime_seconds: uptimeSeconds, + }; + }, + + forget(serverId: string): void { + lastCpuSamples.delete(serverId); + }, + }; +} diff --git a/src/server/systemd.ts b/src/server/systemd.ts index 19d0ab3..c6e35ea 100644 --- a/src/server/systemd.ts +++ b/src/server/systemd.ts @@ -66,7 +66,7 @@ export function parseSystemdShowOutput(stdout: string): SystemdUnitStatus { }; } -export function isUnitActive(status: SystemdUnitStatus): boolean { +export function isUnitActive(status: Pick): boolean { return ( status.activeState === "active" || status.activeState === "activating" || From 4a34dc5ad4bc5332f3df3ed0aac06a681a83c51c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Thu, 26 Nov 2026 13:11:58 -0300 Subject: [PATCH 36/59] feat: add server.change_runtime command to switch version and loader --- .../{index-c8wyn5j3.js => index-b755wnz0.js} | 22 +- lib/protocol/index.js | 10 +- lib/types/protocol/commands/server.d.ts | 29 + lib/types/protocol/index.d.ts | 2 +- lib/vault/index.js | 2 +- scripts/smoke-lib.ts | 12 + src/backup/index.ts | 1 + src/backup/manager.ts | 101 ++- src/cli/run.ts | 13 + src/protocol/commands/server.ts | 27 +- src/protocol/index.ts | 5 + src/protocol/phase3.test.ts | 6 + src/server/change-runtime.test.ts | 740 ++++++++++++++++++ src/server/change-runtime.ts | 307 ++++++++ src/server/index.ts | 4 + src/server/runtime.ts | 22 + 16 files changed, 1252 insertions(+), 51 deletions(-) rename lib/chunks/{index-c8wyn5j3.js => index-b755wnz0.js} (94%) create mode 100644 src/server/change-runtime.test.ts create mode 100644 src/server/change-runtime.ts diff --git a/lib/chunks/index-c8wyn5j3.js b/lib/chunks/index-b755wnz0.js similarity index 94% rename from lib/chunks/index-c8wyn5j3.js rename to lib/chunks/index-b755wnz0.js index f6a565f..815a649 100644 --- a/lib/chunks/index-c8wyn5j3.js +++ b/lib/chunks/index-b755wnz0.js @@ -919,17 +919,26 @@ var consoleLineSchema = z4.string().min(1).max(MAX_CONSOLE_LINE_LENGTH).refine(( var strictServerIdBodySchema = z4.object({ server_id: serverIdSchema }).strict(); +var minecraftVersionSchema = z4.string().min(1).max(64); +var loaderVersionSchema = z4.string().min(1).max(64); var serverCreateBodySchema = z4.object({ server_id: serverIdSchema, name: z4.string().trim().min(1).max(128), - minecraft_version: z4.string().min(1).max(64), + minecraft_version: minecraftVersionSchema, loader: serverLoaderSchema, - loader_version: z4.string().min(1).max(64).optional(), + loader_version: loaderVersionSchema.optional(), memory_mb: serverMemoryMbSchema, jvm_args: z4.array(z4.string()).max(MAX_JVM_ARGS).optional(), port: serverPortSchema.optional(), eula_accepted: z4.boolean() }).strict(); +var serverChangeRuntimeBodySchema = z4.object({ + server_id: serverIdSchema, + minecraft_version: minecraftVersionSchema, + loader: serverLoaderSchema, + loader_version: loaderVersionSchema.optional(), + backup_before: z4.boolean().optional() +}).strict(); var serverUpdateSettingsBodySchema = z4.object({ server_id: serverIdSchema, memory_mb: serverMemoryMbSchema.optional(), @@ -961,6 +970,12 @@ var serverCreateCommand = defineCommand({ minRole: "admin", body: serverCreateBodySchema }); +var serverChangeRuntimeCommand = defineCommand({ + type: "server.change_runtime", + sensitive: false, + minRole: "admin", + body: serverChangeRuntimeBodySchema +}); var serverRestartCommand = defineCommand({ type: "server.restart", sensitive: false, @@ -1011,6 +1026,7 @@ var serverConsoleUnsubscribeCommand = defineCommand({ }); var SERVER_COMMANDS = [ serverCreateCommand, + serverChangeRuntimeCommand, serverRestartCommand, serverStatusCommand, serverStatsCommand, @@ -2089,4 +2105,4 @@ function createInMemoryTrustContext(options) { } }; } -export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, serverCreateBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverStatsBodySchema, serverStatsResultSchema, serverCreateCommand, serverRestartCommand, serverStatusCommand, serverStatsCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, hostInfoBodySchema, hostInfoResultSchema, hostInfoCommand, HOST_COMMANDS, registerHostCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; +export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, minecraftVersionSchema, loaderVersionSchema, serverCreateBodySchema, serverChangeRuntimeBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverStatsBodySchema, serverStatsResultSchema, serverCreateCommand, serverChangeRuntimeCommand, serverRestartCommand, serverStatusCommand, serverStatsCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, hostInfoBodySchema, hostInfoResultSchema, hostInfoCommand, HOST_COMMANDS, registerHostCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; diff --git a/lib/protocol/index.js b/lib/protocol/index.js index c97a887..cfc938b 100644 --- a/lib/protocol/index.js +++ b/lib/protocol/index.js @@ -118,8 +118,10 @@ import { hostInfoCommand, hostInfoResultSchema, keyIdSchema, + loaderVersionSchema, maxRole, memberEntrySchema, + minecraftVersionSchema, modEnvironmentInfoSchema, modFileNameSchema, modLayerSchema, @@ -160,6 +162,8 @@ import { serverBackupListCommand, serverBackupRestoreBodySchema, serverBackupRestoreCommand, + serverChangeRuntimeBodySchema, + serverChangeRuntimeCommand, serverConsoleSendBodySchema, serverConsoleSendCommand, serverConsoleSubscribeBodySchema, @@ -236,7 +240,7 @@ import { verifyTrustGrant, worldNameSchema, wrapEventBody -} from "../chunks/index-c8wyn5j3.js"; +} from "../chunks/index-b755wnz0.js"; import"../chunks/index-g1frygvt.js"; export { wrapEventBody, @@ -315,6 +319,8 @@ export { serverConsoleSubscribeBodySchema, serverConsoleSendCommand, serverConsoleSendBodySchema, + serverChangeRuntimeCommand, + serverChangeRuntimeBodySchema, serverBackupRestoreCommand, serverBackupRestoreBodySchema, serverBackupListCommand, @@ -355,8 +361,10 @@ export { modLayerSchema, modFileNameSchema, modEnvironmentInfoSchema, + minecraftVersionSchema, memberEntrySchema, maxRole, + loaderVersionSchema, keyIdSchema, hostInfoResultSchema, hostInfoCommand, diff --git a/lib/types/protocol/commands/server.d.ts b/lib/types/protocol/commands/server.d.ts index e076715..4f211b8 100644 --- a/lib/types/protocol/commands/server.d.ts +++ b/lib/types/protocol/commands/server.d.ts @@ -18,6 +18,8 @@ export type ServerLoader = z.infer; export declare const serverPortSchema: z.ZodNumber; export declare const serverMemoryMbSchema: z.ZodNumber; export declare const consoleLineSchema: z.ZodString; +export declare const minecraftVersionSchema: z.ZodString; +export declare const loaderVersionSchema: z.ZodString; export declare const serverCreateBodySchema: z.ZodObject<{ server_id: z.ZodString; name: z.ZodString; @@ -35,6 +37,19 @@ export declare const serverCreateBodySchema: z.ZodObject<{ port: z.ZodOptional; eula_accepted: z.ZodBoolean; }, z.core.$strict>; +export declare const serverChangeRuntimeBodySchema: z.ZodObject<{ + server_id: z.ZodString; + minecraft_version: z.ZodString; + loader: z.ZodEnum<{ + fabric: "fabric"; + forge: "forge"; + neoforge: "neoforge"; + quilt: "quilt"; + vanilla: "vanilla"; + }>; + loader_version: z.ZodOptional; + backup_before: z.ZodOptional; +}, z.core.$strict>; export declare const serverUpdateSettingsBodySchema: z.ZodObject<{ server_id: z.ZodString; memory_mb: z.ZodOptional; @@ -63,6 +78,7 @@ export declare const serverStatsResultSchema: z.ZodObject<{ uptime_seconds: z.ZodNumber; }, z.core.$strict>; export type ServerCreateBody = z.infer; +export type ServerChangeRuntimeBody = z.infer; export type ServerUpdateSettingsBody = z.infer; export type ServerConsoleSendBody = z.infer; export type ServerConsoleSubscribeBody = z.infer; @@ -79,6 +95,13 @@ export declare const serverCreateCommand: import("..").CommandDefinition<"server port?: number | undefined; eula_accepted: boolean; }>; +export declare const serverChangeRuntimeCommand: import("..").CommandDefinition<"server.change_runtime", { + server_id: string; + minecraft_version: string; + loader: "fabric" | "forge" | "neoforge" | "quilt" | "vanilla"; + loader_version?: string | undefined; + backup_before?: boolean | undefined; +}>; export declare const serverRestartCommand: import("..").CommandDefinition<"server.restart", { server_id: string; }>; @@ -117,6 +140,12 @@ export declare const SERVER_COMMANDS: readonly [import("..").CommandDefinition<" jvm_args?: string[] | undefined; port?: number | undefined; eula_accepted: boolean; +}>, import("..").CommandDefinition<"server.change_runtime", { + server_id: string; + minecraft_version: string; + loader: "fabric" | "forge" | "neoforge" | "quilt" | "vanilla"; + loader_version?: string | undefined; + backup_before?: boolean | undefined; }>, import("..").CommandDefinition<"server.restart", { server_id: string; }>, import("..").CommandDefinition<"server.status", { diff --git a/lib/types/protocol/index.d.ts b/lib/types/protocol/index.d.ts index 5066359..5e0a408 100644 --- a/lib/types/protocol/index.d.ts +++ b/lib/types/protocol/index.d.ts @@ -7,7 +7,7 @@ export { agentPingCommand, CORE_COMMANDS, createCoreRegistry, registerCoreComman export { FILES_COMMANDS, fileEncodingSchema, filesCopyCommand, filesDeleteCommand, filesDownloadBeginCommand, filesDownloadCloseCommand, filesDownloadCommand, filesDownloadPartCommand, filesListCommand, filesMkdirCommand, filesReadCommand, filesRenameCommand, filesStatCommand, filesUnzipCommand, filesUploadAbortCommand, filesUploadBeginCommand, filesUploadCommitCommand, filesUploadPartCommand, filesWriteCommand, filesZipCommand, registerFilesCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, sha256HexSchema, } from "./commands/files"; export { HOST_COMMANDS, type HostInfoBody, type HostInfoResult, hostInfoBodySchema, hostInfoCommand, hostInfoResultSchema, registerHostCommands, } from "./commands/host"; export { agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, } from "./commands/pairing"; -export { consoleLineSchema, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MAX_JVM_ARGS, MAX_SERVER_MEMORY_MB, MIN_SERVER_MEMORY_MB, registerServerCommands, SERVER_COMMANDS, SERVER_ID_REGEX, type ServerConsoleSendBody, type ServerConsoleSubscribeBody, type ServerCreateBody, type ServerLoader, type ServerStatsBody, type ServerStatsResult, type ServerUpdateSettingsBody, serverConsoleSendBodySchema, serverConsoleSendCommand, serverConsoleSubscribeBodySchema, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, serverCreateBodySchema, serverCreateCommand, serverIdSchema, serverListCommand, serverLoaderSchema, serverMemoryMbSchema, serverPortSchema, serverRestartCommand, serverStatsBodySchema, serverStatsCommand, serverStatsResultSchema, serverStatusCommand, serverUpdateSettingsBodySchema, serverUpdateSettingsCommand, } from "./commands/server"; +export { consoleLineSchema, DEFAULT_SERVER_PORT, loaderVersionSchema, MAX_CONSOLE_LINE_LENGTH, MAX_JVM_ARGS, MAX_SERVER_MEMORY_MB, MIN_SERVER_MEMORY_MB, minecraftVersionSchema, registerServerCommands, SERVER_COMMANDS, SERVER_ID_REGEX, type ServerChangeRuntimeBody, type ServerConsoleSendBody, type ServerConsoleSubscribeBody, type ServerCreateBody, type ServerLoader, type ServerStatsBody, type ServerStatsResult, type ServerUpdateSettingsBody, serverChangeRuntimeBodySchema, serverChangeRuntimeCommand, serverConsoleSendBodySchema, serverConsoleSendCommand, serverConsoleSubscribeBodySchema, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, serverCreateBodySchema, serverCreateCommand, serverIdSchema, serverListCommand, serverLoaderSchema, serverMemoryMbSchema, serverPortSchema, serverRestartCommand, serverStatsBodySchema, serverStatsCommand, serverStatsResultSchema, serverStatusCommand, serverUpdateSettingsBodySchema, serverUpdateSettingsCommand, } from "./commands/server"; export { blobKeySchema, type ModEnvironmentInfo, type ModLayer, type ModSource, modEnvironmentInfoSchema, modFileNameSchema, modLayerSchema, modSourceSchema, type OriginPlanFileInput, type OriginPlanModInput, originPlanFileInputSchema, originPlanModInputSchema, RESERVED_WORLD_NAMES, registerStateCommands, type ServerDeployServerpackBody, type ServerModEntry, type ServerModsInstallBody, type ServerModsListBody, type ServerModsRemoveBody, type ServerOrigin, type ServerOriginApplyBody, type ServerOriginPlanBody, type ServerOriginSyncState, type ServerOriginUnlinkBody, type ServerWorldImportBody, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, STATE_COMMANDS, serverDeployServerpackBodySchema, serverDeployServerpackCommand, serverModEntrySchema, serverModsInstallBodySchema, serverModsInstallCommand, serverModsListBodySchema, serverModsListCommand, serverModsRemoveBodySchema, serverModsRemoveCommand, serverOriginApplyBodySchema, serverOriginApplyCommand, serverOriginPlanBodySchema, serverOriginPlanCommand, serverOriginSchema, serverOriginSyncStateSchema, serverOriginUnlinkBodySchema, serverOriginUnlinkCommand, serverWorldImportBodySchema, serverWorldImportCommand, sha1HexSchema, sha512HexSchema, WORLD_NAME_REGEX, worldNameSchema, } from "./commands/state"; export { PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, registerTunnelCommands, TUNNEL_COMMANDS, type TunnelPlayitSetKeyBody, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStatusCommand, tunnelPlayitStopCommand, } from "./commands/tunnel"; export { DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_AGENT_MESSAGE, DOMAIN_COMMAND, DOMAIN_PAIRING_PROOF, DOMAIN_REVOCATION, DOMAIN_ROLE_GRANT, DOMAIN_SESSION, DOMAIN_TRUST_GRANT, PROTOCOL_VERSION, } from "./domains"; diff --git a/lib/vault/index.js b/lib/vault/index.js index 8ace112..c2b52f3 100644 --- a/lib/vault/index.js +++ b/lib/vault/index.js @@ -5,7 +5,7 @@ import { sessionCertificateSchema, signRevocationList, signSessionCertificate -} from "../chunks/index-c8wyn5j3.js"; +} from "../chunks/index-b755wnz0.js"; import { KDF_ALG_ARGON2ID13, KDF_MODERATE, diff --git a/scripts/smoke-lib.ts b/scripts/smoke-lib.ts index 91f42e2..c855d83 100644 --- a/scripts/smoke-lib.ts +++ b/scripts/smoke-lib.ts @@ -8,6 +8,7 @@ import { createCoreRegistry, hostInfoResultSchema, PROTOCOL_VERSION, + serverChangeRuntimeBodySchema, serverStatsResultSchema, } from "tegrad/protocol"; import { createVault, unlockVault } from "tegrad/vault"; @@ -56,4 +57,15 @@ if ( process.stderr.write("lib smoke test failed: server.stats\n"); process.exit(1); } +if ( + createCoreRegistry().get("server.change_runtime") === undefined || + !serverChangeRuntimeBodySchema.safeParse({ + server_id: "survival", + minecraft_version: "1.21.4", + loader: "fabric", + }).success +) { + process.stderr.write("lib smoke test failed: server.change_runtime\n"); + process.exit(1); +} process.stdout.write("lib smoke test ok\n"); diff --git a/src/backup/index.ts b/src/backup/index.ts index b3cd06d..5564d25 100644 --- a/src/backup/index.ts +++ b/src/backup/index.ts @@ -43,6 +43,7 @@ export { type BackupManager, type BackupManagerOptions, type CreateBackupOptions, + type CreateLocalBackupOptions, createBackupHook, createBackupManager, registerBackupHandlers, diff --git a/src/backup/manager.ts b/src/backup/manager.ts index c0961eb..1b885cc 100644 --- a/src/backup/manager.ts +++ b/src/backup/manager.ts @@ -111,12 +111,19 @@ export interface BackupManagerOptions { readonly makeServerReadableImpl?: MakeServerReadableLike; } +export interface CreateLocalBackupOptions { + readonly server_id: string; + readonly trigger: BackupTrigger; + readonly note?: string; +} + export interface BackupManager { readonly configStore: BackupConfigStore; readonly scheduler: BackupScheduler; getConfig(serverId: string): ServerBackupConfig; setConfig(params: ServerBackupConfigSetBody): ServerBackupConfig; createBackup(params: CreateBackupOptions): Promise; + createLocalBackup(params: CreateLocalBackupOptions): Promise; listBackups(params: ServerBackupListBody): Promise<{ readonly server_id: string; readonly backups: readonly BackupMetadata[]; @@ -281,6 +288,54 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage }; } + async function createLocalBackup(params: CreateLocalBackupOptions): Promise { + const validServerId = serverIdSchema.parse(params.server_id); + const localDest = destinationMap.get("local"); + if (localDest === undefined) { + throw new ProtocolError("backup_failed", "Local backup destination is not available"); + } + + const createdAt = now(); + const backupId = formatBackupId(createdAt); + const archiveResult = await createConsistentServerArchive({ + serversBaseDir, + serverId: validServerId, + ...(options.runtime !== undefined ? { runtime: options.runtime } : {}), + ...(options.saveTimeoutMs !== undefined ? { saveTimeoutMs: options.saveTimeoutMs } : {}), + ...(options.savePollIntervalMs !== undefined + ? { savePollIntervalMs: options.savePollIntervalMs } + : {}), + ...(options.maxArchiveFiles !== undefined ? { maxFiles: options.maxArchiveFiles } : {}), + ...(options.maxArchiveBytes !== undefined ? { maxTotalBytes: options.maxArchiveBytes } : {}), + now, + ...(options.sleep !== undefined ? { sleep: options.sleep } : {}), + ...(options.logger !== undefined ? { logger: options.logger } : {}), + ...(options.archiveImpl !== undefined ? { archiveImpl: options.archiveImpl } : {}), + ...(options.makeServerReadableImpl !== undefined + ? { makeServerReadableImpl: options.makeServerReadableImpl } + : {}), + }); + + const meta = await localDest.upload(archiveResult.buffer, { + serverId: validServerId, + backupId, + createdAt, + sha256: archiveResult.sha256, + trigger: params.trigger, + ...(params.note !== undefined ? { note: params.note } : {}), + }); + + return { + backup_id: backupId, + server_id: validServerId, + created_at: createdAt, + size_bytes: archiveResult.buffer.byteLength, + sha256: archiveResult.sha256, + trigger: params.trigger, + destinations: [{ destination: "local", ok: true, backup: meta }], + }; + } + async function listBackups(params: ServerBackupListBody): Promise<{ readonly server_id: string; readonly backups: readonly BackupMetadata[]; @@ -435,52 +490,11 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage } if (safetyBackup === undefined) { - const createdAt = now(); - const safetyId = formatBackupId(createdAt); - const localDest = destinationMap.get("local"); - if (localDest === undefined) { - throw new ProtocolError( - "backup_failed", - "Failed to create pre-restore safety backup before restoring", - ); - } - const currentArchive = await createConsistentServerArchive({ - serversBaseDir, - serverId: validServerId, - ...(options.runtime !== undefined ? { runtime: options.runtime } : {}), - ...(options.saveTimeoutMs !== undefined ? { saveTimeoutMs: options.saveTimeoutMs } : {}), - ...(options.savePollIntervalMs !== undefined - ? { savePollIntervalMs: options.savePollIntervalMs } - : {}), - ...(options.maxArchiveFiles !== undefined ? { maxFiles: options.maxArchiveFiles } : {}), - ...(options.maxArchiveBytes !== undefined - ? { maxTotalBytes: options.maxArchiveBytes } - : {}), - now, - ...(options.sleep !== undefined ? { sleep: options.sleep } : {}), - ...(options.logger !== undefined ? { logger: options.logger } : {}), - ...(options.archiveImpl !== undefined ? { archiveImpl: options.archiveImpl } : {}), - ...(options.makeServerReadableImpl !== undefined - ? { makeServerReadableImpl: options.makeServerReadableImpl } - : {}), - }); - const meta = await localDest.upload(currentArchive.buffer, { - serverId: validServerId, - backupId: safetyId, - createdAt, - sha256: currentArchive.sha256, + safetyBackup = await createLocalBackup({ + server_id: validServerId, trigger: "pre_restore", note: `Safety backup before restoring ${validBackupId}`, }); - safetyBackup = { - backup_id: safetyId, - server_id: validServerId, - created_at: createdAt, - size_bytes: currentArchive.buffer.byteLength, - sha256: currentArchive.sha256, - trigger: "pre_restore", - destinations: [{ destination: "local", ok: true, backup: meta }], - }; } const extracted = restoreServerArchive({ @@ -525,6 +539,7 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage getConfig, setConfig, createBackup, + createLocalBackup, listBackups, deleteBackup, restoreBackup, diff --git a/src/cli/run.ts b/src/cli/run.ts index 096059c..bd14e5c 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -26,6 +26,7 @@ import { FileManager, registerFileCommandHandlers } from "../files"; import { type CommandRegistry, createCoreRegistry, + ProtocolError, signAgentAuth, type TransportFrame, } from "../protocol"; @@ -124,6 +125,7 @@ export async function createAgentRuntime( const configuredServersDir = options.serversDir ?? env.TEGRAD_SERVERS_DIR?.trim(); const configuredRunDir = options.runDir ?? env.TEGRAD_RUN_DIR?.trim(); + let backupManagerRef: BackupManager | null = null; const serverManager = createServerManager({ logger, ...(configuredServersDir && configuredServersDir.length > 0 @@ -131,6 +133,16 @@ export async function createAgentRuntime( : {}), ...(configuredRunDir && configuredRunDir.length > 0 ? { runDir: configuredRunDir } : {}), ...(options.now !== undefined ? { now: options.now } : {}), + backupBeforeChange: async (serverId: string) => { + if (backupManagerRef === null) { + throw new ProtocolError("backup_failed", "Backup manager is not ready"); + } + await backupManagerRef.createLocalBackup({ + server_id: serverId, + trigger: "before_change", + note: "Backup before changing server runtime", + }); + }, }); const statusWatcher: ServerStatusWatcher = createServerStatusWatcher({ listServerIds: () => serverManager.listServers().map((server) => server.id), @@ -215,6 +227,7 @@ export async function createAgentRuntime( : {}), ...(options.now !== undefined ? { now: options.now } : {}), }); + backupManagerRef = backupManager; registerBackupHandlers(queue, backupManager); const configuredCdnHost = config.tegraCdnHost ?? config.cdnHost; diff --git a/src/protocol/commands/server.ts b/src/protocol/commands/server.ts index a502b8c..5145abe 100644 --- a/src/protocol/commands/server.ts +++ b/src/protocol/commands/server.ts @@ -39,13 +39,16 @@ const strictServerIdBodySchema = z }) .strict(); +export const minecraftVersionSchema = z.string().min(1).max(64); +export const loaderVersionSchema = z.string().min(1).max(64); + export const serverCreateBodySchema = z .object({ server_id: serverIdSchema, name: z.string().trim().min(1).max(128), - minecraft_version: z.string().min(1).max(64), + minecraft_version: minecraftVersionSchema, loader: serverLoaderSchema, - loader_version: z.string().min(1).max(64).optional(), + loader_version: loaderVersionSchema.optional(), memory_mb: serverMemoryMbSchema, jvm_args: z.array(z.string()).max(MAX_JVM_ARGS).optional(), port: serverPortSchema.optional(), @@ -53,6 +56,16 @@ export const serverCreateBodySchema = z }) .strict(); +export const serverChangeRuntimeBodySchema = z + .object({ + server_id: serverIdSchema, + minecraft_version: minecraftVersionSchema, + loader: serverLoaderSchema, + loader_version: loaderVersionSchema.optional(), + backup_before: z.boolean().optional(), + }) + .strict(); + export const serverUpdateSettingsBodySchema = z .object({ server_id: serverIdSchema, @@ -92,6 +105,7 @@ export const serverStatsResultSchema = z .strict(); export type ServerCreateBody = z.infer; +export type ServerChangeRuntimeBody = z.infer; export type ServerUpdateSettingsBody = z.infer; export type ServerConsoleSendBody = z.infer; export type ServerConsoleSubscribeBody = z.infer; @@ -105,6 +119,14 @@ export const serverCreateCommand = defineCommand({ body: serverCreateBodySchema, }); +// Reinstalling the server runtime/loader modifies the server installation at the same level as server.create. +export const serverChangeRuntimeCommand = defineCommand({ + type: "server.change_runtime", + sensitive: false, + minRole: "admin", + body: serverChangeRuntimeBodySchema, +}); + export const serverRestartCommand = defineCommand({ type: "server.restart", sensitive: false, @@ -163,6 +185,7 @@ export const serverConsoleUnsubscribeCommand = defineCommand({ export const SERVER_COMMANDS = [ serverCreateCommand, + serverChangeRuntimeCommand, serverRestartCommand, serverStatusCommand, serverStatsCommand, diff --git a/src/protocol/index.ts b/src/protocol/index.ts index c743ae1..afbcad5 100644 --- a/src/protocol/index.ts +++ b/src/protocol/index.ts @@ -154,13 +154,16 @@ export { export { consoleLineSchema, DEFAULT_SERVER_PORT, + loaderVersionSchema, MAX_CONSOLE_LINE_LENGTH, MAX_JVM_ARGS, MAX_SERVER_MEMORY_MB, MIN_SERVER_MEMORY_MB, + minecraftVersionSchema, registerServerCommands, SERVER_COMMANDS, SERVER_ID_REGEX, + type ServerChangeRuntimeBody, type ServerConsoleSendBody, type ServerConsoleSubscribeBody, type ServerCreateBody, @@ -168,6 +171,8 @@ export { type ServerStatsBody, type ServerStatsResult, type ServerUpdateSettingsBody, + serverChangeRuntimeBodySchema, + serverChangeRuntimeCommand, serverConsoleSendBodySchema, serverConsoleSendCommand, serverConsoleSubscribeBodySchema, diff --git a/src/protocol/phase3.test.ts b/src/protocol/phase3.test.ts index c02c6a5..e115ede 100644 --- a/src/protocol/phase3.test.ts +++ b/src/protocol/phase3.test.ts @@ -679,6 +679,7 @@ const MIN_ROLE: Record = { "server.backup.config.set": "editor", "server.deploy.serverpack": "editor", "server.create": "admin", + "server.change_runtime": "admin", "server.backup.delete": "admin", "server.backup.restore": "admin", "server.delete": "admin", @@ -734,6 +735,11 @@ describe("minimum roles", () => { "server.console.send": { server_id: SERVER, line: "list" }, "server.console.subscribe": { server_id: SERVER }, "server.console.unsubscribe": { server_id: SERVER }, + "server.change_runtime": { + server_id: SERVER, + minecraft_version: "1.21.4", + loader: "vanilla", + }, "server.update_settings": { server_id: SERVER, memory_mb: 2048 }, "files.list": { server_id: SERVER }, "files.stat": { server_id: SERVER, path: "a" }, diff --git a/src/server/change-runtime.test.ts b/src/server/change-runtime.test.ts new file mode 100644 index 0000000..82f4694 --- /dev/null +++ b/src/server/change-runtime.test.ts @@ -0,0 +1,740 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeAll, describe, expect, test } from "bun:test"; +import { createHash } from "node:crypto"; +import { + existsSync, + mkdirSync, + mkdtempSync, + readdirSync, + readFileSync, + rmSync, + writeFileSync, +} from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { createCommandQueue, createLogger, type TransportCommandFrame } from "../agent"; +import { openTestEvent } from "../agent/test-events"; +import { createBackupManager } from "../backup"; +import { fingerprint, generateSigningKeyPair, ready, toBase64Url } from "../crypto"; +import { + createCoreRegistry, + createInMemoryTrustContext, + createSignedCommand, + openCommand, + PROTOCOL_VERSION, + ProtocolError, + type ServerChangeRuntimeBody, + serverChangeRuntimeBodySchema, + signRoleGrant, + signSessionCertificate, + type TransportFrame, +} from "../protocol"; +import { + createServerManager, + type FetchLike, + getJavaBinPath, + type RunFixedLike, + registerServerHandlers, +} from "./index"; + +const tempDirs: string[] = []; + +function makeTempDir(prefix: string): string { + const dir = mkdtempSync(join(tmpdir(), prefix)); + tempDirs.push(dir); + return dir; +} + +beforeAll(async () => { + await ready(); +}); + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +function sha256Hex(data: Uint8Array | string): string { + return createHash("sha256").update(data).digest("hex"); +} + +function sha1Hex(data: Uint8Array | string): string { + return createHash("sha1").update(data).digest("hex"); +} + +function makeSilentLogger() { + return createLogger({ level: "error", stdout: () => {}, stderr: () => {} }); +} + +function preinstallFakeJava(serversDir: string, major: 8 | 16 | 17 | 21): string { + const binPath = getJavaBinPath(serversDir, major, "linux"); + mkdirSync(join(binPath, ".."), { recursive: true }); + writeFileSync(binPath, "#!/bin/sh\n"); + return binPath; +} + +function makeFakeLoaderHarness(options?: { + readonly failFabricInstall?: boolean; + readonly failVanillaHash?: boolean; + readonly unitState?: "active" | "activating" | "inactive" | "failed"; +}) { + const vanilla1204Jar = new TextEncoder().encode("PK-vanilla-1.20.4"); + const vanilla1204Sha1 = sha1Hex(vanilla1204Jar); + const fabricInstallerJar = new TextEncoder().encode("PK-fabric-installer"); + const fabricInstallerSha256 = sha256Hex(fabricInstallerJar); + const fabricInstallerUrl = + "https://maven.fabricmc.net/net/fabricmc/fabric-installer/1.0.1/fabric-installer-1.0.1.jar"; + const forgeInstallerJar = new TextEncoder().encode("PK-forge-installer"); + const forgeInstallerSha256 = sha256Hex(forgeInstallerJar); + const forgeInstallerUrl = + "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.2.0/forge-1.20.1-47.2.0-installer.jar"; + + const installerRunDirs: string[] = []; + const commands: { cmd: string; args: readonly string[] }[] = []; + const unitState = options?.unitState ?? "inactive"; + + const fetchImpl: FetchLike = async (input) => { + const url = String(input); + if (url === "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json") { + return new Response( + JSON.stringify({ + versions: [ + { id: "1.20.4", url: "https://piston-meta.mojang.com/v1/packages/1.20.4.json" }, + ], + }), + { status: 200 }, + ); + } + if (url === "https://piston-meta.mojang.com/v1/packages/1.20.4.json") { + return new Response( + JSON.stringify({ + downloads: { + server: { + sha1: options?.failVanillaHash ? "0".repeat(40) : vanilla1204Sha1, + size: vanilla1204Jar.byteLength, + url: "https://piston-data.mojang.com/v1/objects/1.20.4/server.jar", + }, + }, + }), + { status: 200 }, + ); + } + if (url === "https://piston-data.mojang.com/v1/objects/1.20.4/server.jar") { + return new Response(vanilla1204Jar, { status: 200 }); + } + if (url === "https://meta.fabricmc.net/v2/versions/game") { + return new Response(JSON.stringify([{ version: "1.21.4", stable: true }]), { status: 200 }); + } + if (url === "https://meta.fabricmc.net/v2/versions/loader") { + return new Response( + JSON.stringify([ + { version: "0.16.10", stable: true }, + { version: "0.16.9", stable: true }, + ]), + { status: 200 }, + ); + } + if (url === "https://meta.fabricmc.net/v2/versions/installer") { + return new Response( + JSON.stringify([{ version: "1.0.1", url: fabricInstallerUrl, stable: true }]), + { status: 200 }, + ); + } + if (url === `${fabricInstallerUrl}.sha256`) { + return new Response(`${fabricInstallerSha256}\n`, { status: 200 }); + } + if (url === fabricInstallerUrl) { + return new Response(fabricInstallerJar, { status: 200 }); + } + if (url === "https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json") { + return new Response(JSON.stringify({ promos: { "1.20.1-recommended": "47.2.0" } }), { + status: 200, + }); + } + if (url === `${forgeInstallerUrl}.sha256`) { + return new Response(forgeInstallerSha256, { status: 200 }); + } + if (url === forgeInstallerUrl) { + return new Response(forgeInstallerJar, { status: 200 }); + } + return new Response("not found", { status: 404 }); + }; + + const runFixedImpl: RunFixedLike = async (cmd, args) => { + commands.push({ cmd, args }); + if (cmd === "systemctl" && args[0] === "show") { + const sub = + unitState === "active" ? "running" : unitState === "activating" ? "start" : "dead"; + return { + code: 0, + stdout: `ActiveState=${unitState}\nSubState=${sub}\nMainPID=0\nMemoryCurrent=[not set]\n`, + stderr: "", + timedOut: false, + truncated: false, + }; + } + + if (args.includes("-dir")) { + const dirIdx = args.indexOf("-dir"); + const targetDir = args[dirIdx + 1] ?? ""; + installerRunDirs.push(targetDir); + if (options?.failFabricInstall) { + return { code: 1, stdout: "", stderr: "fabric failed", timedOut: false, truncated: false }; + } + writeFileSync(join(targetDir, "fabric-server-launch.jar"), "PK-fabric-launch"); + writeFileSync(join(targetDir, "server.jar"), "PK-fabric-mc"); + mkdirSync(join(targetDir, "libraries", "net", "fabricmc"), { recursive: true }); + writeFileSync(join(targetDir, "libraries", "net", "fabricmc", "loader.jar"), "PK-fabric-lib"); + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + } + + if (args.includes("--installServer")) { + const idx = args.indexOf("--installServer"); + const targetDir = args[idx + 1] ?? ""; + installerRunDirs.push(targetDir); + const unixDir = join( + targetDir, + "libraries", + "net", + "minecraftforge", + "forge", + "1.20.1-47.2.0", + ); + mkdirSync(unixDir, { recursive: true }); + writeFileSync(join(unixDir, "unix_args.txt"), "-cp forge.jar\n"); + writeFileSync(join(targetDir, "run.sh"), "#!/bin/sh\n"); + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + } + + return { code: 0, stdout: "", stderr: "", timedOut: false, truncated: false }; + }; + + return { fetchImpl, runFixedImpl, installerRunDirs, commands }; +} + +describe("server.change_runtime", () => { + test("schema accepts valid payloads and rejects invalid or extra fields", () => { + expect( + serverChangeRuntimeBodySchema.safeParse({ + server_id: "survival-1", + minecraft_version: "1.21.4", + loader: "fabric", + loader_version: "0.16.10", + backup_before: true, + }).success, + ).toBe(true); + + expect( + serverChangeRuntimeBodySchema.safeParse({ + server_id: "survival-1", + minecraft_version: "1.21.4", + loader: "vanilla", + }).success, + ).toBe(true); + + expect( + serverChangeRuntimeBodySchema.safeParse({ + server_id: "../escape", + minecraft_version: "1.21.4", + loader: "vanilla", + }).success, + ).toBe(false); + + expect( + serverChangeRuntimeBodySchema.safeParse({ + server_id: "survival-1", + minecraft_version: "", + loader: "vanilla", + }).success, + ).toBe(false); + + expect( + serverChangeRuntimeBodySchema.safeParse({ + server_id: "survival-1", + minecraft_version: "1.21.4", + loader: "paper", + }).success, + ).toBe(false); + + expect( + serverChangeRuntimeBodySchema.safeParse({ + server_id: "survival-1", + minecraft_version: "1.21.4", + loader: "vanilla", + extra: true, + }).success, + ).toBe(false); + }); + + test("switches loader/version via staging dir, cleans old runtime, preserves user data, and updates start.sh + status", async () => { + const serversDir = makeTempDir("tegrad-chg-rt-"); + const runDir = makeTempDir("tegrad-chg-run-"); + preinstallFakeJava(serversDir, 17); + preinstallFakeJava(serversDir, 21); + + const harness = makeFakeLoaderHarness(); + const manager = createServerManager({ + serversDir, + runDir, + platform: "linux", + fetchImpl: harness.fetchImpl, + runFixedImpl: harness.runFixedImpl, + now: () => 1_700_000_000_000, + }); + + await manager.createServer({ + server_id: "smp", + name: "SMP", + minecraft_version: "1.20.4", + loader: "vanilla", + memory_mb: 4096, + jvm_args: ["-XX:+UseG1GC"], + port: 25577, + eula_accepted: true, + }); + + const srvDir = join(serversDir, "smp"); + mkdirSync(join(srvDir, "world", "region"), { recursive: true }); + writeFileSync(join(srvDir, "world", "level.dat"), "world-bytes"); + mkdirSync(join(srvDir, "mods"), { recursive: true }); + writeFileSync(join(srvDir, "mods", "keep-mod.jar"), "mod-bytes"); + mkdirSync(join(srvDir, "config"), { recursive: true }); + writeFileSync(join(srvDir, "config", "mod.toml"), "enabled = true\n"); + writeFileSync(join(srvDir, "whitelist.json"), '[{"name":"Alex"}]'); + writeFileSync(join(srvDir, "logs", "latest.log"), "boot ok\n"); + writeFileSync(join(srvDir, "forge-1.20.4-stale.jar"), "stale-jar"); + + const beforeStart = readFileSync(join(srvDir, "start.sh"), "utf8"); + expect(beforeStart).toContain(getJavaBinPath(serversDir, 17, "linux")); + expect(beforeStart).toContain("server.jar"); + + const updated = await manager.changeServerRuntime({ + server_id: "smp", + minecraft_version: "1.21.4", + loader: "fabric", + loader_version: "0.16.10", + }); + + expect(updated.minecraft_version).toBe("1.21.4"); + expect(updated.loader).toBe("fabric"); + expect(updated.loader_version).toBe("0.16.10"); + expect(updated.launch_target).toEqual({ + kind: "jar", + jar_relative_path: "fabric-server-launch.jar", + }); + expect(updated.memory_mb).toBe(4096); + expect(updated.jvm_args).toEqual(["-XX:+UseG1GC"]); + expect(updated.port).toBe(25577); + + // Installer ran in a temporary directory inside serverDir, never directly in serverDir + expect(harness.installerRunDirs.length).toBe(1); + expect(harness.installerRunDirs[0]).toContain(".tmp-runtime-"); + + // Stale runtime jar removed, new runtime installed, no temp dirs left behind + expect(existsSync(join(srvDir, "forge-1.20.4-stale.jar"))).toBe(false); + expect(existsSync(join(srvDir, "fabric-server-launch.jar"))).toBe(true); + expect(existsSync(join(srvDir, "libraries", "net", "fabricmc", "loader.jar"))).toBe(true); + expect(readdirSync(srvDir).some((n) => n.startsWith(".tmp-runtime"))).toBe(false); + + // User files untouched + expect(readFileSync(join(srvDir, "world", "level.dat"), "utf8")).toBe("world-bytes"); + expect(readFileSync(join(srvDir, "mods", "keep-mod.jar"), "utf8")).toBe("mod-bytes"); + expect(readFileSync(join(srvDir, "config", "mod.toml"), "utf8")).toBe("enabled = true\n"); + expect(readFileSync(join(srvDir, "whitelist.json"), "utf8")).toBe('[{"name":"Alex"}]'); + expect(readFileSync(join(srvDir, "logs", "latest.log"), "utf8")).toBe("boot ok\n"); + expect(readFileSync(join(srvDir, "eula.txt"), "utf8")).toBe("eula=true\n"); + expect(readFileSync(join(srvDir, "server.properties"), "utf8")).toContain("server-port=25577"); + + // start.sh regenerated with Java 21, preserved RAM/JVM args, new target + const afterStart = readFileSync(join(srvDir, "start.sh"), "utf8"); + expect(afterStart).toContain(getJavaBinPath(serversDir, 21, "linux")); + expect(afterStart).toContain("-Xms4096M -Xmx4096M"); + expect(afterStart).toContain("'-XX:+UseG1GC'"); + expect(afterStart).toContain("fabric-server-launch.jar"); + + // server.status reflects updated metadata + const status = await manager.getServerStatus("smp"); + expect(status.server.minecraft_version).toBe("1.21.4"); + expect(status.server.loader).toBe("fabric"); + expect(status.server.loader_version).toBe("0.16.10"); + + // Switch again to Forge 1.20.1 (Java 17 + args_file) and confirm old Fabric files are cleaned up + const forgeMeta = await manager.changeServerRuntime({ + server_id: "smp", + minecraft_version: "1.20.1", + loader: "forge", + }); + expect(forgeMeta.loader).toBe("forge"); + expect(forgeMeta.loader_version).toBe("47.2.0"); + expect(forgeMeta.launch_target).toEqual({ + kind: "args_file", + args_file_relative_path: "libraries/net/minecraftforge/forge/1.20.1-47.2.0/unix_args.txt", + }); + expect(existsSync(join(srvDir, "fabric-server-launch.jar"))).toBe(false); + expect(existsSync(join(srvDir, "libraries", "net", "fabricmc"))).toBe(false); + expect( + existsSync( + join( + srvDir, + "libraries", + "net", + "minecraftforge", + "forge", + "1.20.1-47.2.0", + "unix_args.txt", + ), + ), + ).toBe(true); + const forgeStart = readFileSync(join(srvDir, "start.sh"), "utf8"); + expect(forgeStart).toContain(getJavaBinPath(serversDir, 17, "linux")); + expect(forgeStart).toContain("unix_args.txt"); + + manager.close(); + }); + + test("failed loader installation leaves existing runtime, start.sh, and metadata completely intact", async () => { + const serversDir = makeTempDir("tegrad-chg-fail-"); + const runDir = makeTempDir("tegrad-chg-fail-run-"); + preinstallFakeJava(serversDir, 17); + preinstallFakeJava(serversDir, 21); + + const okHarness = makeFakeLoaderHarness(); + const setupManager = createServerManager({ + serversDir, + runDir, + platform: "linux", + fetchImpl: okHarness.fetchImpl, + runFixedImpl: okHarness.runFixedImpl, + now: () => 1_700_000_000_000, + }); + await setupManager.createServer({ + server_id: "smp", + name: "SMP", + minecraft_version: "1.20.4", + loader: "vanilla", + memory_mb: 2048, + eula_accepted: true, + }); + setupManager.close(); + + const srvDir = join(serversDir, "smp"); + const originalJar = readFileSync(join(srvDir, "server.jar"), "utf8"); + const originalStart = readFileSync(join(srvDir, "start.sh"), "utf8"); + const originalMeta = readFileSync(join(srvDir, "tegrad-server.json"), "utf8"); + + const failHarness = makeFakeLoaderHarness({ failFabricInstall: true }); + const failingManager = createServerManager({ + serversDir, + runDir, + platform: "linux", + fetchImpl: failHarness.fetchImpl, + runFixedImpl: failHarness.runFixedImpl, + now: () => 1_700_000_000_000, + }); + + await expect( + failingManager.changeServerRuntime({ + server_id: "smp", + minecraft_version: "1.21.4", + loader: "fabric", + }), + ).rejects.toMatchObject({ code: "download_failed" }); + + expect(readFileSync(join(srvDir, "server.jar"), "utf8")).toBe(originalJar); + expect(readFileSync(join(srvDir, "start.sh"), "utf8")).toBe(originalStart); + expect(readFileSync(join(srvDir, "tegrad-server.json"), "utf8")).toBe(originalMeta); + expect(readdirSync(srvDir).some((n) => n.startsWith(".tmp-runtime"))).toBe(false); + + failingManager.close(); + }); + + test("refuses running server with server_running before calling backup or downloader", async () => { + const serversDir = makeTempDir("tegrad-chg-running-"); + const runDir = makeTempDir("tegrad-chg-running-run-"); + preinstallFakeJava(serversDir, 17); + preinstallFakeJava(serversDir, 21); + + const setupHarness = makeFakeLoaderHarness(); + const setupManager = createServerManager({ + serversDir, + runDir, + platform: "linux", + fetchImpl: setupHarness.fetchImpl, + runFixedImpl: setupHarness.runFixedImpl, + }); + await setupManager.createServer({ + server_id: "smp", + name: "SMP", + minecraft_version: "1.20.4", + loader: "vanilla", + memory_mb: 2048, + eula_accepted: true, + }); + setupManager.close(); + + let backupCalled = false; + let fetchCalled = false; + const runningHarness = makeFakeLoaderHarness({ unitState: "active" }); + const manager = createServerManager({ + serversDir, + runDir, + platform: "linux", + fetchImpl: async (...args) => { + fetchCalled = true; + return runningHarness.fetchImpl(...args); + }, + runFixedImpl: runningHarness.runFixedImpl, + backupBeforeChange: async () => { + backupCalled = true; + }, + }); + + await expect( + manager.changeServerRuntime({ + server_id: "smp", + minecraft_version: "1.21.4", + loader: "fabric", + backup_before: true, + }), + ).rejects.toMatchObject({ code: "server_running" }); + + expect(backupCalled).toBe(false); + expect(fetchCalled).toBe(false); + manager.close(); + }); + + test("backup_before=true creates a local before_change backup and aborts runtime change if backup fails", async () => { + const root = makeTempDir("tegrad-chg-bkp-"); + const serversDir = join(root, "servers"); + const runDir = join(root, "run"); + const stateDir = join(root, "state"); + const backupsDir = join(root, "backups"); + mkdirSync(serversDir, { recursive: true }); + mkdirSync(runDir, { recursive: true }); + preinstallFakeJava(serversDir, 17); + preinstallFakeJava(serversDir, 21); + + const harness = makeFakeLoaderHarness(); + const backupManager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + now: () => 1_700_000_000_000, + }); + + const manager = createServerManager({ + serversDir, + runDir, + platform: "linux", + fetchImpl: harness.fetchImpl, + runFixedImpl: harness.runFixedImpl, + backupBeforeChange: async (serverId) => { + await backupManager.createLocalBackup({ + server_id: serverId, + trigger: "before_change", + note: "Before runtime change", + }); + }, + }); + + await manager.createServer({ + server_id: "smp", + name: "SMP", + minecraft_version: "1.20.4", + loader: "vanilla", + memory_mb: 2048, + eula_accepted: true, + }); + + await manager.changeServerRuntime({ + server_id: "smp", + minecraft_version: "1.21.4", + loader: "fabric", + backup_before: true, + }); + + const listed = await backupManager.listBackups({ server_id: "smp", destination: "local" }); + expect(listed.backups).toHaveLength(1); + expect(listed.backups[0]?.trigger).toBe("before_change"); + + // If backup fails, runtime change is cancelled before touching the server + const failingManager = createServerManager({ + serversDir, + runDir, + platform: "linux", + fetchImpl: harness.fetchImpl, + runFixedImpl: harness.runFixedImpl, + backupBeforeChange: async () => { + throw new ProtocolError("backup_failed", "Disk full"); + }, + }); + + await expect( + failingManager.changeServerRuntime({ + server_id: "smp", + minecraft_version: "1.20.4", + loader: "vanilla", + backup_before: true, + }), + ).rejects.toMatchObject({ code: "backup_failed" }); + + expect((await failingManager.getServerStatus("smp")).server.loader).toBe("fabric"); + + manager.close(); + failingManager.close(); + }); + + test("CommandQueue + RBAC enforces admin role and returns server.change_runtime.result", async () => { + const serversDir = makeTempDir("tegrad-chg-rbac-"); + const runDir = makeTempDir("tegrad-chg-rbac-run-"); + preinstallFakeJava(serversDir, 17); + preinstallFakeJava(serversDir, 21); + + const agent = generateSigningKeyPair(); + const owner = generateSigningKeyPair(); + const editor = generateSigningKeyPair(); + const admin = generateSigningKeyPair(); + const adminSession = generateSigningKeyPair(); + const now = 1_700_000_000_000; + + const adminCert = signSessionCertificate({ + sessionPublicKey: adminSession.publicKey, + accountKeyPair: admin, + notBefore: now - 1000, + notAfter: now + 3_600_000, + }); + + const registry = createCoreRegistry(); + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [owner.publicKey], + members: [ + { + account_key: toBase64Url(editor.publicKey), + account: fingerprint(editor.publicKey), + granted_by: fingerprint(owner.publicKey), + role: "editor", + servers: "*", + issued_at: now, + }, + { + account_key: toBase64Url(admin.publicKey), + account: fingerprint(admin.publicKey), + granted_by: fingerprint(owner.publicKey), + role: "admin", + servers: ["smp"], + issued_at: now, + }, + ], + now: () => now, + }); + + const frames: TransportFrame[] = []; + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (frame) => frames.push(frame), + logger: makeSilentLogger(), + }); + + const harness = makeFakeLoaderHarness(); + const manager = createServerManager({ + serversDir, + runDir, + platform: "linux", + fetchImpl: harness.fetchImpl, + runFixedImpl: harness.runFixedImpl, + now: () => now, + }); + registerServerHandlers(queue, manager); + + await manager.createServer({ + server_id: "smp", + name: "SMP", + minecraft_version: "1.20.4", + loader: "vanilla", + memory_mb: 2048, + eula_accepted: true, + }); + + const payload: ServerChangeRuntimeBody = { + server_id: "smp", + minecraft_version: "1.21.4", + loader: "fabric", + loader_version: "0.16.10", + }; + + const editorCmd = createSignedCommand( + { + type: "server.change_runtime", + body: payload, + agentPublicKey: agent.publicKey, + signer: editor, + counter: 1, + now, + }, + registry, + ); + await expect(openCommand(editorCmd, trust, registry)).rejects.toMatchObject({ + code: "insufficient_role", + }); + + const adminCmd = createSignedCommand( + { + type: "server.change_runtime", + body: payload, + agentPublicKey: agent.publicKey, + signer: adminSession, + session: adminCert, + replyTo: adminSession.publicKey, + counter: 1, + now, + }, + registry, + ); + const frame: TransportCommandFrame = { + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: fingerprint(agent.publicKey) }, + body: adminCmd, + }; + await queue.enqueue(frame); + + const ack = frames.find((f) => f.kind === "ack"); + expect(ack?.kind === "ack" && ack.body.ok).toBe(true); + + const events = frames + .filter((f): f is Extract => f.kind === "event") + .map((f) => openTestEvent(f.body, agent.publicKey, adminSession)); + expect(events).toHaveLength(1); + const firstEvent = events[0]; + if (firstEvent === undefined) { + throw new Error("Expected server.change_runtime.result event"); + } + expect(firstEvent.header.type).toBe("server.change_runtime.result"); + const resultServer = ( + firstEvent.body as { server: { minecraft_version: string; loader: string } } + ).server; + expect(resultServer.minecraft_version).toBe("1.21.4"); + expect(resultServer.loader).toBe("fabric"); + + // Verify role grant on another server does not grant access here + const otherGrant = signRoleGrant({ + granter: owner, + accountPublicKey: editor.publicKey, + agent: fingerprint(agent.publicKey), + servers: ["other"], + role: "admin", + issuedAt: now, + }); + expect(otherGrant.role).toBe("admin"); + + manager.close(); + }); +}); diff --git a/src/server/change-runtime.ts b/src/server/change-runtime.ts new file mode 100644 index 0000000..4acadd7 --- /dev/null +++ b/src/server/change-runtime.ts @@ -0,0 +1,307 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { randomBytes } from "node:crypto"; +import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync } from "node:fs"; +import { join } from "node:path"; +import type { Logger } from "../agent/logger"; +import { writeFileAtomic } from "../agent/state"; +import { + ProtocolError, + type ServerChangeRuntimeBody, + serverChangeRuntimeBodySchema, +} from "../protocol"; +import type { FetchLike } from "./download"; +import { assertValidServerId, resolveServerDir, resolveServerSubpath } from "./id"; +import { ensureJavaRuntime, type RunFixedLike, selectJavaMajor } from "./java"; +import { assertSafeVersionToken, installServerLoader } from "./loaders"; +import { + assertServerPathsUsable, + finalizeServerPath, + type PermissionContext, + SERVER_DIR_MODE, + SERVER_EXEC_MODE, + SERVER_FILE_MODE, + SERVER_TREE_PLAN, + secureTree, +} from "./permissions"; +import { + getEffectiveLaunchTarget, + readServerMetadata, + SERVER_METADATA_FILE, + type ServerMetadata, + writeServerMetadata, +} from "./registry"; +import { writeStartScript } from "./start-script"; +import { getUnitStatus, isUnitStopped } from "./systemd"; + +const PROTECTED_USER_PATHS: ReadonlySet = new Set([ + "mods", + "config", + "world", + "world_nether", + "world_the_end", + "logs", + "server.properties", + "eula.txt", + "tegrad-server.json", + "start.sh", + "whitelist.json", + "ops.json", + "banned-players.json", + "banned-ips.json", + "usercache.json", + "permissions.json", +]); + +const KNOWN_OLD_RUNTIME_NAMES: ReadonlySet = new Set([ + "libraries", + ".fabric", + ".quilt", + "server.jar", + "fabric-server-launch.jar", + "fabric-server-launcher.properties", + "quilt-server-launch.jar", + "run.sh", + "run.bat", + "user_jvm_args.txt", +]); + +const OLD_RUNTIME_JAR_PATTERNS: readonly RegExp[] = [ + /^(?:forge|neoforge)-.+\.jar$/i, + /^minecraft_server\..+\.jar$/i, +]; + +function isRemovableOldRuntimeEntry(name: string, previousJarTopSegment: string | null): boolean { + if (PROTECTED_USER_PATHS.has(name) || name.startsWith(".tmp-")) { + return false; + } + if (KNOWN_OLD_RUNTIME_NAMES.has(name) || name === previousJarTopSegment) { + return true; + } + return OLD_RUNTIME_JAR_PATTERNS.some((pattern) => pattern.test(name)); +} + +function collectPreviousJarInfo(existing: ServerMetadata): { + readonly topSegment: string | null; + readonly nestedRelPath: string | null; +} { + const target = getEffectiveLaunchTarget(existing); + if (target.kind !== "jar") { + return { topSegment: null, nestedRelPath: null }; + } + const rel = target.jar_relative_path; + if (!rel.includes("/")) { + return { topSegment: rel, nestedRelPath: null }; + } + const firstSegment = rel.split("/")[0] ?? ""; + if (firstSegment === "libraries" || PROTECTED_USER_PATHS.has(firstSegment)) { + return { topSegment: null, nestedRelPath: null }; + } + return { topSegment: null, nestedRelPath: rel }; +} + +export interface ChangeServerRuntimeDeps { + readonly serversDir: string; + readonly platform: NodeJS.Platform; + readonly permissionContext: PermissionContext; + readonly fetchImpl?: FetchLike; + readonly runFixedImpl?: RunFixedLike; + readonly backupBeforeChange?: (serverId: string) => Promise; + readonly logger?: Logger; +} + +export async function changeServerRuntime( + params: ServerChangeRuntimeBody, + deps: ChangeServerRuntimeDeps, +): Promise { + const validId = assertValidServerId(params.server_id); + const parsed = serverChangeRuntimeBodySchema.safeParse(params); + if (!parsed.success) { + throw new ProtocolError("invalid_body", "Invalid server.change_runtime parameters"); + } + + const existing = readServerMetadata(deps.serversDir, validId); + const serverDir = resolveServerDir(deps.serversDir, validId); + + // Validate version tokens and Java mapping before checking backup or staging. + selectJavaMajor(parsed.data.minecraft_version); + assertSafeVersionToken(parsed.data.minecraft_version, "Minecraft"); + if (parsed.data.loader_version !== undefined) { + assertSafeVersionToken(parsed.data.loader_version, "loader"); + } + + const status = await getUnitStatus(validId, deps.runFixedImpl); + if (!isUnitStopped(status)) { + throw new ProtocolError( + "server_running", + `Server must be stopped before changing runtime: ${validId}`, + ); + } + + if (parsed.data.backup_before === true) { + if (deps.backupBeforeChange === undefined) { + throw new ProtocolError("backup_failed", "Local backup hook is not configured"); + } + await deps.backupBeforeChange(validId); + } + + const javaRuntime = await ensureJavaRuntime({ + serversDir: deps.serversDir, + minecraftVersion: parsed.data.minecraft_version, + platform: deps.platform, + ...(deps.fetchImpl !== undefined ? { fetchImpl: deps.fetchImpl } : {}), + ...(deps.runFixedImpl !== undefined ? { runFixedImpl: deps.runFixedImpl } : {}), + permissions: deps.permissionContext, + }); + + const suffix = randomBytes(6).toString("hex"); + const stagingDir = join(serverDir, `.tmp-runtime-${suffix}`); + const oldRuntimeDir = join(serverDir, `.tmp-runtime-old-${suffix}`); + mkdirSync(stagingDir, { recursive: true, mode: SERVER_DIR_MODE }); + + try { + const loaderResult = await installServerLoader({ + serverDir: stagingDir, + minecraftVersion: parsed.data.minecraft_version, + loader: parsed.data.loader, + javaBin: javaRuntime.javaBin, + ...(parsed.data.loader_version !== undefined + ? { loaderVersion: parsed.data.loader_version } + : {}), + ...(deps.fetchImpl !== undefined ? { fetchImpl: deps.fetchImpl } : {}), + ...(deps.runFixedImpl !== undefined ? { runFixedImpl: deps.runFixedImpl } : {}), + }); + + const stagedNames = readdirSync(stagingDir).filter( + (name) => !name.startsWith(".tmp-") && !PROTECTED_USER_PATHS.has(name), + ); + const { topSegment: prevJarTopSegment, nestedRelPath: prevNestedJar } = + collectPreviousJarInfo(existing); + + const existingNames = readdirSync(serverDir); + const entriesToDisplace = new Set(); + for (const name of existingNames) { + if (stagedNames.includes(name) || isRemovableOldRuntimeEntry(name, prevJarTopSegment)) { + if (!PROTECTED_USER_PATHS.has(name) && !name.startsWith(".tmp-")) { + entriesToDisplace.add(name); + } + } + } + + mkdirSync(oldRuntimeDir, { recursive: true, mode: SERVER_DIR_MODE }); + const startScriptPath = resolveServerSubpath(serverDir, "start.sh"); + const metadataPath = resolveServerSubpath(serverDir, SERVER_METADATA_FILE); + const prevStartScript = existsSync(startScriptPath) + ? readFileSync(startScriptPath, "utf8") + : null; + const prevMetaRaw = readFileSync(metadataPath, "utf8"); + + const movedOld: string[] = []; + const movedNew: string[] = []; + let wroteStartScript = false; + let wroteMetadata = false; + + const updated: ServerMetadata = { + ...existing, + minecraft_version: loaderResult.minecraftVersion, + loader: loaderResult.loader, + loader_version: loaderResult.loaderVersion, + launch_target: loaderResult.launchTarget, + }; + + try { + for (const name of entriesToDisplace) { + const src = join(serverDir, name); + if (existsSync(src)) { + renameSync(src, join(oldRuntimeDir, name)); + movedOld.push(name); + } + } + + for (const name of stagedNames) { + renameSync(join(stagingDir, name), join(serverDir, name)); + movedNew.push(name); + } + + writeStartScript(serverDir, { + javaBin: javaRuntime.javaBin, + memoryMb: updated.memory_mb, + jvmArgs: updated.jvm_args, + launchTarget: loaderResult.launchTarget, + permissions: deps.permissionContext, + }); + wroteStartScript = true; + + writeServerMetadata(deps.serversDir, updated, deps.permissionContext); + wroteMetadata = true; + + secureTree(serverDir, SERVER_TREE_PLAN, deps.permissionContext); + + const targetRelPath = + loaderResult.launchTarget.kind === "jar" + ? loaderResult.launchTarget.jar_relative_path + : loaderResult.launchTarget.args_file_relative_path; + assertServerPathsUsable( + [ + { path: startScriptPath, executable: true }, + { path: join(serverDir, targetRelPath), executable: false }, + { path: javaRuntime.javaBin, executable: true }, + ], + deps.permissionContext, + ); + } catch (err) { + for (const name of movedNew) { + rmSync(join(serverDir, name), { recursive: true, force: true }); + } + for (const name of movedOld) { + const backupEntry = join(oldRuntimeDir, name); + if (existsSync(backupEntry)) { + renameSync(backupEntry, join(serverDir, name)); + } + } + if (wroteStartScript) { + if (prevStartScript !== null) { + writeFileAtomic(startScriptPath, prevStartScript, { + mode: SERVER_EXEC_MODE, + dirMode: SERVER_DIR_MODE, + }); + finalizeServerPath(startScriptPath, SERVER_EXEC_MODE, deps.permissionContext); + } else { + rmSync(startScriptPath, { force: true }); + } + } + if (wroteMetadata) { + writeFileAtomic(metadataPath, prevMetaRaw, { + mode: SERVER_FILE_MODE, + dirMode: SERVER_DIR_MODE, + }); + finalizeServerPath(metadataPath, SERVER_FILE_MODE, deps.permissionContext); + } + throw err; + } + + if ( + prevNestedJar !== null && + (loaderResult.launchTarget.kind !== "jar" || + loaderResult.launchTarget.jar_relative_path !== prevNestedJar) + ) { + const nestedAbs = resolveServerSubpath(serverDir, prevNestedJar); + if (existsSync(nestedAbs)) { + rmSync(nestedAbs, { force: true }); + } + } + + deps.logger?.info("Changed Minecraft server runtime", { + serverId: validId, + loader: updated.loader, + minecraftVersion: updated.minecraft_version, + loaderVersion: updated.loader_version, + }); + + return updated; + } finally { + rmSync(stagingDir, { recursive: true, force: true }); + rmSync(oldRuntimeDir, { recursive: true, force: true }); + } +} diff --git a/src/server/index.ts b/src/server/index.ts index 2664258..02955df 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -1,6 +1,10 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda +export { + type ChangeServerRuntimeDeps, + changeServerRuntime, +} from "./change-runtime"; export { type ConsoleEventEmitter, type ConsoleLinesEvent, diff --git a/src/server/runtime.ts b/src/server/runtime.ts index 424ad4e..c674dbe 100644 --- a/src/server/runtime.ts +++ b/src/server/runtime.ts @@ -9,6 +9,7 @@ import { DEFAULT_SERVER_PORT, ProtocolError, roleAtLeast, + type ServerChangeRuntimeBody, type ServerConsoleSendBody, type ServerConsoleSubscribeBody, type ServerCreateBody, @@ -19,6 +20,7 @@ import { serverCreateBodySchema, serverUpdateSettingsBodySchema, } from "../protocol"; +import { changeServerRuntime } from "./change-runtime"; import { type ConsoleEventEmitter, type ConsoleSubscriptionManager, @@ -101,10 +103,12 @@ export interface ServerManagerOptions { readonly logger?: Logger; /** Group id of the server user's group; resolved from /etc/group when omitted, null to skip. */ readonly serverGroupId?: number | null; + readonly backupBeforeChange?: (serverId: string) => Promise; } export interface ServerManager { createServer(params: ServerCreateBody): Promise; + changeServerRuntime(params: ServerChangeRuntimeBody): Promise; startServer(serverId: string): Promise; stopServer(serverId: string): Promise; restartServer(serverId: string): Promise; @@ -485,6 +489,18 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM return { createServer, + changeServerRuntime: (params: ServerChangeRuntimeBody) => + changeServerRuntime(params, { + serversDir, + platform, + permissionContext, + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + ...(options.runFixedImpl !== undefined ? { runFixedImpl: options.runFixedImpl } : {}), + ...(options.backupBeforeChange !== undefined + ? { backupBeforeChange: options.backupBeforeChange } + : {}), + ...(options.logger !== undefined ? { logger: options.logger } : {}), + }), startServer, stopServer, restartServer, @@ -522,6 +538,12 @@ export function registerServerHandlers( ctx.sendEvent("server.created", { server }); }); + queue.registerHandler("server.change_runtime", async (opened, ctx) => { + const body = opened.body as ServerChangeRuntimeBody; + const server = await manager.changeServerRuntime(body); + ctx.sendEvent("server.change_runtime.result", { server }); + }); + queue.registerHandler("server.start", async (opened, ctx) => { const body = opened.body as { readonly server_id: string }; await manager.startServer(body.server_id); From 62aeb07c913b54dbd1b55b7b806771a4b124173b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Thu, 26 Nov 2026 13:21:15 -0300 Subject: [PATCH 37/59] feat: upload secondary backups in background with progress events and confirmation --- .../{index-b755wnz0.js => index-d84531yv.js} | 22 +- lib/protocol/index.js | 10 +- lib/types/protocol/commands/agent.d.ts | 12 +- lib/types/protocol/commands/backup.d.ts | 44 ++ lib/types/protocol/index.d.ts | 2 +- lib/vault/index.js | 2 +- scripts/smoke-lib.ts | 16 + src/agent/api-client.ts | 103 +++- src/agent/index.ts | 1 + src/agent/phase3.test.ts | 137 +++++ src/backup/background-upload.test.ts | 495 ++++++++++++++++++ src/backup/backup.test.ts | 17 +- src/backup/cloud-upload-url.test.ts | 34 +- src/backup/destinations/tegra-cloud.ts | 35 +- src/backup/index.ts | 2 + src/backup/manager.ts | 414 +++++++++++++-- src/backup/types.ts | 6 +- src/cli/run.ts | 8 + src/protocol/commands/agent.ts | 2 +- src/protocol/commands/backup.ts | 28 + src/protocol/index.ts | 7 + 21 files changed, 1300 insertions(+), 97 deletions(-) rename lib/chunks/{index-b755wnz0.js => index-d84531yv.js} (95%) create mode 100644 src/backup/background-upload.test.ts diff --git a/lib/chunks/index-b755wnz0.js b/lib/chunks/index-d84531yv.js similarity index 95% rename from lib/chunks/index-b755wnz0.js rename to lib/chunks/index-d84531yv.js index 815a649..bec3d7a 100644 --- a/lib/chunks/index-b755wnz0.js +++ b/lib/chunks/index-d84531yv.js @@ -1041,7 +1041,7 @@ function registerServerCommands(registry) { } // src/protocol/commands/agent.ts -var SUBSCRIPTION_TOPICS = ["server.status"]; +var SUBSCRIPTION_TOPICS = ["server.status", "server.backup"]; var subscriptionTopicSchema = z5.enum(SUBSCRIPTION_TOPICS); var SERVER_STATES = ["stopped", "starting", "running", "stopping", "crashed"]; var serverStateSchema = z5.enum(SERVER_STATES); @@ -1102,6 +1102,24 @@ var MIN_BACKUP_RETENTION_COUNT = 1; var MAX_BACKUP_RETENTION_COUNT = 1000; var backupIdSchema = z6.string().regex(BACKUP_ID_REGEX, "backup_id must match ^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"); var backupDestinationKindSchema = z6.enum(["local", "s3", "tegra_cloud"]); +var BACKUP_UPLOAD_STATES = ["queued", "uploading", "done", "failed"]; +var backupUploadStateSchema = z6.enum(BACKUP_UPLOAD_STATES); +var serverBackupUploadEventSchema = z6.object({ + server_id: serverIdSchema, + backup_id: backupIdSchema, + destination: backupDestinationKindSchema, + state: backupUploadStateSchema, + sent_bytes: z6.number().int().nonnegative(), + total_bytes: z6.number().int().nonnegative(), + error: z6.string().min(1).max(128).optional() +}).strict(); +var pendingBackupUploadSchema = z6.object({ + destination: backupDestinationKindSchema, + state: backupUploadStateSchema, + sent_bytes: z6.number().int().nonnegative(), + total_bytes: z6.number().int().nonnegative(), + error: z6.string().min(1).max(128).optional() +}).strict(); var backupScheduleConfigSchema = z6.object({ enabled: z6.boolean(), interval_minutes: z6.number().int().min(MIN_BACKUP_INTERVAL_MINUTES).max(MAX_BACKUP_INTERVAL_MINUTES), @@ -2105,4 +2123,4 @@ function createInMemoryTrustContext(options) { } }; } -export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, minecraftVersionSchema, loaderVersionSchema, serverCreateBodySchema, serverChangeRuntimeBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverStatsBodySchema, serverStatsResultSchema, serverCreateCommand, serverChangeRuntimeCommand, serverRestartCommand, serverStatusCommand, serverStatsCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, hostInfoBodySchema, hostInfoResultSchema, hostInfoCommand, HOST_COMMANDS, registerHostCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; +export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, minecraftVersionSchema, loaderVersionSchema, serverCreateBodySchema, serverChangeRuntimeBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverStatsBodySchema, serverStatsResultSchema, serverCreateCommand, serverChangeRuntimeCommand, serverRestartCommand, serverStatusCommand, serverStatsCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, BACKUP_UPLOAD_STATES, backupUploadStateSchema, serverBackupUploadEventSchema, pendingBackupUploadSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, hostInfoBodySchema, hostInfoResultSchema, hostInfoCommand, HOST_COMMANDS, registerHostCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; diff --git a/lib/protocol/index.js b/lib/protocol/index.js index cfc938b..5d7d458 100644 --- a/lib/protocol/index.js +++ b/lib/protocol/index.js @@ -9,6 +9,7 @@ import { ALL_SERVERS, BACKUP_COMMANDS, BACKUP_ID_REGEX, + BACKUP_UPLOAD_STATES, COMMAND_ID_BYTES, CORE_COMMANDS, CommandRegistry, @@ -81,6 +82,7 @@ import { backupS3ConfigSchema, backupScheduleConfigSchema, backupTegraCloudConfigSchema, + backupUploadStateSchema, base64UrlSchema, blobKeySchema, buildPairingFragment, @@ -133,6 +135,7 @@ import { originPlanModInputSchema, pairingCodeSchema, parsePairingFragment, + pendingBackupUploadSchema, playitSecretKeySchema, registerAgentCommands, registerBackupCommands, @@ -162,6 +165,7 @@ import { serverBackupListCommand, serverBackupRestoreBodySchema, serverBackupRestoreCommand, + serverBackupUploadEventSchema, serverChangeRuntimeBodySchema, serverChangeRuntimeCommand, serverConsoleSendBodySchema, @@ -240,7 +244,7 @@ import { verifyTrustGrant, worldNameSchema, wrapEventBody -} from "../chunks/index-b755wnz0.js"; +} from "../chunks/index-d84531yv.js"; import"../chunks/index-g1frygvt.js"; export { wrapEventBody, @@ -321,6 +325,7 @@ export { serverConsoleSendBodySchema, serverChangeRuntimeCommand, serverChangeRuntimeBodySchema, + serverBackupUploadEventSchema, serverBackupRestoreCommand, serverBackupRestoreBodySchema, serverBackupListCommand, @@ -350,6 +355,7 @@ export { registerBackupCommands, registerAgentCommands, playitSecretKeySchema, + pendingBackupUploadSchema, parsePairingFragment, pairingCodeSchema, originPlanModInputSchema, @@ -402,6 +408,7 @@ export { buildPairingFragment, blobKeySchema, base64UrlSchema, + backupUploadStateSchema, backupTegraCloudConfigSchema, backupScheduleConfigSchema, backupS3ConfigSchema, @@ -474,6 +481,7 @@ export { CommandRegistry, CORE_COMMANDS, COMMAND_ID_BYTES, + BACKUP_UPLOAD_STATES, BACKUP_ID_REGEX, BACKUP_COMMANDS, ALL_SERVERS, diff --git a/lib/types/protocol/commands/agent.d.ts b/lib/types/protocol/commands/agent.d.ts index 9e35a36..a489a93 100644 --- a/lib/types/protocol/commands/agent.d.ts +++ b/lib/types/protocol/commands/agent.d.ts @@ -1,7 +1,8 @@ import { z } from "zod"; import { type CommandRegistry } from "../registry"; -export declare const SUBSCRIPTION_TOPICS: readonly ["server.status"]; +export declare const SUBSCRIPTION_TOPICS: readonly ["server.status", "server.backup"]; export declare const subscriptionTopicSchema: z.ZodEnum<{ + "server.backup": "server.backup"; "server.status": "server.status"; }>; export type SubscriptionTopic = z.infer; @@ -28,6 +29,7 @@ export declare const serverStatusChangedSchema: z.ZodObject<{ export type ServerStatusChanged = z.infer; export declare const agentSubscribeBodySchema: z.ZodObject<{ topics: z.ZodArray>; }, z.core.$strict>; @@ -57,10 +59,10 @@ export declare const agentMembersRevokeBodySchema: z.ZodObject<{ }, z.core.$strict>; export type AgentMembersRevokeBody = z.infer; export declare const agentSubscribeCommand: import("..").CommandDefinition<"agent.subscribe", { - topics: "server.status"[]; + topics: ("server.backup" | "server.status")[]; }>; export declare const agentUnsubscribeCommand: import("..").CommandDefinition<"agent.unsubscribe", { - topics: "server.status"[]; + topics: ("server.backup" | "server.status")[]; }>; export declare const agentMembersSetCommand: import("..").CommandDefinition<"agent.members.set", { grant: { @@ -80,9 +82,9 @@ export declare const agentMembersRevokeCommand: import("..").CommandDefinition<" servers?: string[] | undefined; }>; export declare const AGENT_COMMANDS: readonly [import("..").CommandDefinition<"agent.subscribe", { - topics: "server.status"[]; + topics: ("server.backup" | "server.status")[]; }>, import("..").CommandDefinition<"agent.unsubscribe", { - topics: "server.status"[]; + topics: ("server.backup" | "server.status")[]; }>, import("..").CommandDefinition<"agent.members.set", { grant: { v: 1; diff --git a/lib/types/protocol/commands/backup.d.ts b/lib/types/protocol/commands/backup.d.ts index b374487..24903c9 100644 --- a/lib/types/protocol/commands/backup.d.ts +++ b/lib/types/protocol/commands/backup.d.ts @@ -12,6 +12,50 @@ export declare const backupDestinationKindSchema: z.ZodEnum<{ tegra_cloud: "tegra_cloud"; }>; export type BackupDestinationKind = z.infer; +export declare const BACKUP_UPLOAD_STATES: readonly ["queued", "uploading", "done", "failed"]; +export declare const backupUploadStateSchema: z.ZodEnum<{ + done: "done"; + failed: "failed"; + queued: "queued"; + uploading: "uploading"; +}>; +export type BackupUploadState = z.infer; +export declare const serverBackupUploadEventSchema: z.ZodObject<{ + server_id: z.ZodString; + backup_id: z.ZodString; + destination: z.ZodEnum<{ + local: "local"; + s3: "s3"; + tegra_cloud: "tegra_cloud"; + }>; + state: z.ZodEnum<{ + done: "done"; + failed: "failed"; + queued: "queued"; + uploading: "uploading"; + }>; + sent_bytes: z.ZodNumber; + total_bytes: z.ZodNumber; + error: z.ZodOptional; +}, z.core.$strict>; +export type ServerBackupUploadEvent = z.infer; +export declare const pendingBackupUploadSchema: z.ZodObject<{ + destination: z.ZodEnum<{ + local: "local"; + s3: "s3"; + tegra_cloud: "tegra_cloud"; + }>; + state: z.ZodEnum<{ + done: "done"; + failed: "failed"; + queued: "queued"; + uploading: "uploading"; + }>; + sent_bytes: z.ZodNumber; + total_bytes: z.ZodNumber; + error: z.ZodOptional; +}, z.core.$strict>; +export type PendingBackupUpload = z.infer; export declare const backupScheduleConfigSchema: z.ZodObject<{ enabled: z.ZodBoolean; interval_minutes: z.ZodNumber; diff --git a/lib/types/protocol/index.d.ts b/lib/types/protocol/index.d.ts index 5e0a408..314a01d 100644 --- a/lib/types/protocol/index.d.ts +++ b/lib/types/protocol/index.d.ts @@ -2,7 +2,7 @@ export { AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_SIG, export { type AgentEventBody, agentEventBodySchema, type OpenedAgentEvent, type OpenedAgentMessage, openAgentEvent, openAgentMessage, type SealAgentMessageParams, sealAgentMessage, wrapEventBody, } from "./agent-message"; export { COMMAND_ID_BYTES, type CreateSignedCommandParams, createSignedCommand, DEFAULT_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, MAX_COMMAND_TTL_MS, type OpenedCommand, openCommand, } from "./command"; export { AGENT_COMMANDS, type AgentMembersRevokeBody, type AgentMembersSetBody, type AgentSubscribeBody, agentMembersRevokeBodySchema, agentMembersRevokeCommand, agentMembersSetBodySchema, agentMembersSetCommand, agentSubscribeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, registerAgentCommands, SERVER_STATES, type ServerState, type ServerStatusChanged, SUBSCRIPTION_TOPICS, type SubscriptionTopic, serverStateSchema, serverStatusChangedSchema, subscriptionTopicSchema, } from "./commands/agent"; -export { BACKUP_COMMANDS, BACKUP_ID_REGEX, type BackupDestinationKind, type BackupLocalConfig, type BackupS3ConfigInput, type BackupScheduleConfig, type BackupTegraCloudConfig, backupDestinationKindSchema, backupIdSchema, backupLocalConfigSchema, backupS3ConfigSchema, backupScheduleConfigSchema, backupTegraCloudConfigSchema, MAX_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_RETENTION_COUNT, MIN_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, registerBackupCommands, type ServerBackupConfigSetBody, type ServerBackupCreateBody, type ServerBackupDeleteBody, type ServerBackupListBody, type ServerBackupRestoreBody, s3BucketSchema, s3PrefixSchema, s3RegionSchema, serverBackupConfigGetCommand, serverBackupConfigSetBodySchema, serverBackupConfigSetCommand, serverBackupCreateBodySchema, serverBackupCreateCommand, serverBackupDeleteBodySchema, serverBackupDeleteCommand, serverBackupListBodySchema, serverBackupListCommand, serverBackupRestoreBodySchema, serverBackupRestoreCommand, } from "./commands/backup"; +export { BACKUP_COMMANDS, BACKUP_ID_REGEX, BACKUP_UPLOAD_STATES, type BackupDestinationKind, type BackupLocalConfig, type BackupS3ConfigInput, type BackupScheduleConfig, type BackupTegraCloudConfig, type BackupUploadState, backupDestinationKindSchema, backupIdSchema, backupLocalConfigSchema, backupS3ConfigSchema, backupScheduleConfigSchema, backupTegraCloudConfigSchema, backupUploadStateSchema, MAX_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_RETENTION_COUNT, MIN_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, type PendingBackupUpload, pendingBackupUploadSchema, registerBackupCommands, type ServerBackupConfigSetBody, type ServerBackupCreateBody, type ServerBackupDeleteBody, type ServerBackupListBody, type ServerBackupRestoreBody, type ServerBackupUploadEvent, s3BucketSchema, s3PrefixSchema, s3RegionSchema, serverBackupConfigGetCommand, serverBackupConfigSetBodySchema, serverBackupConfigSetCommand, serverBackupCreateBodySchema, serverBackupCreateCommand, serverBackupDeleteBodySchema, serverBackupDeleteCommand, serverBackupListBodySchema, serverBackupListCommand, serverBackupRestoreBodySchema, serverBackupRestoreCommand, serverBackupUploadEventSchema, } from "./commands/backup"; export { agentPingCommand, CORE_COMMANDS, createCoreRegistry, registerCoreCommands, serverDeleteCommand, serverStartCommand, serverStopCommand, } from "./commands/core"; export { FILES_COMMANDS, fileEncodingSchema, filesCopyCommand, filesDeleteCommand, filesDownloadBeginCommand, filesDownloadCloseCommand, filesDownloadCommand, filesDownloadPartCommand, filesListCommand, filesMkdirCommand, filesReadCommand, filesRenameCommand, filesStatCommand, filesUnzipCommand, filesUploadAbortCommand, filesUploadBeginCommand, filesUploadCommitCommand, filesUploadPartCommand, filesWriteCommand, filesZipCommand, registerFilesCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, sha256HexSchema, } from "./commands/files"; export { HOST_COMMANDS, type HostInfoBody, type HostInfoResult, hostInfoBodySchema, hostInfoCommand, hostInfoResultSchema, registerHostCommands, } from "./commands/host"; diff --git a/lib/vault/index.js b/lib/vault/index.js index c2b52f3..df6074a 100644 --- a/lib/vault/index.js +++ b/lib/vault/index.js @@ -5,7 +5,7 @@ import { sessionCertificateSchema, signRevocationList, signSessionCertificate -} from "../chunks/index-b755wnz0.js"; +} from "../chunks/index-d84531yv.js"; import { KDF_ALG_ARGON2ID13, KDF_MODERATE, diff --git a/scripts/smoke-lib.ts b/scripts/smoke-lib.ts index c855d83..a6a587f 100644 --- a/scripts/smoke-lib.ts +++ b/scripts/smoke-lib.ts @@ -8,8 +8,10 @@ import { createCoreRegistry, hostInfoResultSchema, PROTOCOL_VERSION, + serverBackupUploadEventSchema, serverChangeRuntimeBodySchema, serverStatsResultSchema, + subscriptionTopicSchema, } from "tegrad/protocol"; import { createVault, unlockVault } from "tegrad/vault"; @@ -68,4 +70,18 @@ if ( process.stderr.write("lib smoke test failed: server.change_runtime\n"); process.exit(1); } +if ( + !subscriptionTopicSchema.safeParse("server.backup").success || + !serverBackupUploadEventSchema.safeParse({ + server_id: "survival", + backup_id: "bkp-20261126-000000-abcd1234", + destination: "tegra_cloud", + state: "uploading", + sent_bytes: 512, + total_bytes: 1024, + }).success +) { + process.stderr.write("lib smoke test failed: server.backup\n"); + process.exit(1); +} process.stdout.write("lib smoke test ok\n"); diff --git a/src/agent/api-client.ts b/src/agent/api-client.ts index 04cad08..532b426 100644 --- a/src/agent/api-client.ts +++ b/src/agent/api-client.ts @@ -70,6 +70,7 @@ export function buildApiUrl(baseApiUrl: string, pathSuffix: string): string { } export interface BackupUploadTarget { + readonly id?: string | undefined; readonly put_url: string; readonly headers: Readonly>; readonly expires_at: number; @@ -81,12 +82,20 @@ export interface BackupUploadUrlRequest { readonly size_bytes: number; } +export interface BackupUploadConfirmResult { + readonly id: string; + readonly size_bytes: number; + readonly status: "stored"; +} + export interface AgentApiClient { /** `POST /v1/agents/self/backup-upload-url`: where to `PUT` a backup of `size_bytes`. */ requestBackupUploadUrl( request: BackupUploadUrlRequest, signal?: AbortSignal, ): Promise; + /** `POST /v1/agents/self/backups/:id/confirm`: confirms a completed cloud backup upload. */ + confirmBackupUpload(backupId: string, signal?: AbortSignal): Promise; } export interface AgentApiClientOptions { @@ -99,13 +108,22 @@ export interface AgentApiClientOptions { readonly maxResponseBytes?: number; } +const CLOUD_BACKUP_ID_REGEX = /^[A-Za-z0-9._-]{1,128}$/; + const backupUploadTargetSchema = z.object({ + id: z.string().min(1).max(128).optional(), put_url: z.string().min(1).max(4096), headers: z.record(z.string(), z.string()).default({}), expires_at: z.number().int().nonnegative(), max_bytes: z.number().int().positive(), }); +const backupUploadConfirmSchema = z.object({ + id: z.string().min(1).max(128), + size_bytes: z.number().int().nonnegative(), + status: z.literal("stored"), +}); + async function readBoundedText(response: Response, maxBytes: number): Promise { const declared = Number(response.headers.get("content-length")); if (Number.isFinite(declared) && declared > maxBytes) { @@ -159,20 +177,19 @@ export function createAgentApiClient(options: AgentApiClientOptions): AgentApiCl const timeoutMs = options.timeoutMs ?? AGENT_API_TIMEOUT_MS; const maxResponseBytes = options.maxResponseBytes ?? AGENT_API_MAX_RESPONSE_BYTES; - async function signedJson( + async function signedRequest( method: string, pathSuffix: string, - payload: unknown, + body: string | undefined, externalSignal?: AbortSignal, ): Promise { if (externalSignal?.aborted) { throw new AgentApiError("aborted", "API request aborted"); } const url = buildApiUrl(validatedUrl, pathSuffix); - const body = JSON.stringify(payload); - const headers = { - "content-type": "application/json", + const headers: Record = { accept: "application/json", + ...(body !== undefined ? { "content-type": "application/json" } : {}), ...signedRequestHeaders({ agentKeyPair: options.agentKeyPair, now }, method, url, body), }; @@ -189,7 +206,7 @@ export function createAgentApiClient(options: AgentApiClientOptions): AgentApiCl return await fetchFn(url, { method, headers, - body, + ...(body !== undefined ? { body } : {}), redirect: "error", signal: controller.signal, }); @@ -207,15 +224,26 @@ export function createAgentApiClient(options: AgentApiClientOptions): AgentApiCl } } + async function parseBoundedJson(response: Response): Promise { + try { + return JSON.parse(await readBoundedText(response, maxResponseBytes)) as unknown; + } catch (err) { + if (err instanceof AgentApiError) { + throw err; + } + throw new AgentApiError("invalid_response", "API returned invalid JSON"); + } + } + return { async requestBackupUploadUrl( request: BackupUploadUrlRequest, signal?: AbortSignal, ): Promise { - const response = await signedJson( + const response = await signedRequest( "POST", "/agents/self/backup-upload-url", - { server_id: request.server_id, size_bytes: request.size_bytes }, + JSON.stringify({ server_id: request.server_id, size_bytes: request.size_bytes }), signal, ); @@ -236,20 +264,61 @@ export function createAgentApiClient(options: AgentApiClientOptions): AgentApiCl ); } - let raw: unknown; - try { - raw = JSON.parse(await readBoundedText(response, maxResponseBytes)) as unknown; - } catch (err) { - if (err instanceof AgentApiError) { - throw err; - } - throw new AgentApiError("invalid_response", "API returned invalid JSON"); - } + const raw = await parseBoundedJson(response); const parsed = backupUploadTargetSchema.safeParse(raw); if (!parsed.success) { throw new AgentApiError("invalid_response", "API returned a malformed upload target"); } return parsed.data; }, + + async confirmBackupUpload( + backupId: string, + signal?: AbortSignal, + ): Promise { + if (!CLOUD_BACKUP_ID_REGEX.test(backupId)) { + throw new AgentApiError("invalid_response", "Invalid backup id for confirmation"); + } + + // The confirm endpoint signs an empty body (rawBody = ""). + const response = await signedRequest( + "POST", + `/agents/self/backups/${backupId}/confirm`, + undefined, + signal, + ); + + if (response.status === 413) { + void response.body?.cancel().catch(() => {}); + throw new AgentApiError("quota_exceeded", "Backup storage quota exceeded", 413); + } + if (response.status === 429) { + void response.body?.cancel().catch(() => {}); + throw new AgentApiError( + "rate_limited", + "Backup confirmation request was rate limited", + 429, + ); + } + if (response.status === 204) { + void response.body?.cancel().catch(() => {}); + return { id: backupId, size_bytes: 0, status: "stored" }; + } + if (response.status !== 200 && response.status !== 201) { + void response.body?.cancel().catch(() => {}); + throw new AgentApiError( + "http_error", + `Backup confirmation failed with HTTP ${response.status}`, + response.status, + ); + } + + const raw = await parseBoundedJson(response); + const parsed = backupUploadConfirmSchema.safeParse(raw); + if (!parsed.success) { + throw new AgentApiError("invalid_response", "API returned a malformed confirm response"); + } + return parsed.data; + }, }; } diff --git a/src/agent/index.ts b/src/agent/index.ts index 8600d3c..0880bed 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -9,6 +9,7 @@ export { type AgentApiClientOptions, AgentApiError, type AgentApiErrorCode, + type BackupUploadConfirmResult, type BackupUploadTarget, type BackupUploadUrlRequest, buildApiUrl, diff --git a/src/agent/phase3.test.ts b/src/agent/phase3.test.ts index eff303f..cc40382 100644 --- a/src/agent/phase3.test.ts +++ b/src/agent/phase3.test.ts @@ -987,6 +987,143 @@ describe("agent API client", () => { }), ).toThrow(); }); + + test("signs POST /v1/agents/self/backups/:id/confirm with an empty body and maps errors", async () => { + const agent = generateSigningKeyPair(); + const seen: { url: string; method: string; body: unknown; headers: Headers }[] = []; + const client = createAgentApiClient({ + apiUrl: "https://api.tegra.example", + agentKeyPair: agent, + now: () => NOW, + fetch: async (input, init) => { + seen.push({ + url: String(input), + method: init?.method ?? "GET", + body: init?.body, + headers: new Headers(init?.headers), + }); + return new Response( + JSON.stringify({ id: "bkp_cloud_1", size_bytes: 4096, status: "stored" }), + { status: 200 }, + ); + }, + }); + + const confirmed = await client.confirmBackupUpload("bkp_cloud_1"); + expect(confirmed).toEqual({ id: "bkp_cloud_1", size_bytes: 4096, status: "stored" }); + const req = seen[0]; + if (!req) throw new Error("no confirm request"); + expect(req.url).toBe("https://api.tegra.example/v1/agents/self/backups/bkp_cloud_1/confirm"); + expect(req.method).toBe("POST"); + expect(req.body).toBeUndefined(); + expect(req.headers.get("content-type")).toBeNull(); + expect( + verifyAgentRequest({ + getHeader: (name) => req.headers.get(name), + method: req.method, + pathWithQuery: new URL(req.url).pathname, + body: "", + agentPublicKey: agent.publicKey, + now: NOW, + }).agent, + ).toBe(fingerprint(agent.publicKey)); + + // Rejects invalid backup id locally without issuing a request + await expect(client.confirmBackupUpload("../bad")).rejects.toMatchObject({ + code: "invalid_response", + }); + expect(seen).toHaveLength(1); + + function clientFor(status: number, body = "") { + return createAgentApiClient({ + apiUrl: "https://api.tegra.example", + agentKeyPair: agent, + now: () => NOW, + fetch: async () => new Response(body, { status }), + }); + } + await expect(clientFor(413).confirmBackupUpload("b1")).rejects.toMatchObject({ + code: "quota_exceeded", + }); + await expect(clientFor(429).confirmBackupUpload("b1")).rejects.toMatchObject({ + code: "rate_limited", + }); + await expect(clientFor(409).confirmBackupUpload("b1")).rejects.toMatchObject({ + code: "http_error", + status: 409, + }); + await expect(clientFor(200, "not json").confirmBackupUpload("b1")).rejects.toMatchObject({ + code: "invalid_response", + }); + await expect(clientFor(204).confirmBackupUpload("b1")).resolves.toEqual({ + id: "b1", + size_bytes: 0, + status: "stored", + }); + }); +}); + +describe("agent.subscribe server.backup topic", () => { + test("publishes server.backup.upload only to authorized subscribers of server.backup", async () => { + const h = makeHarness(); + const member = generateSigningKeyPair(); + await h.send( + "agent.members.set", + { + grant: signRoleGrant({ + granter: h.owner, + accountPublicKey: member.publicKey, + agent: h.agentId, + servers: ["alpha"], + role: "viewer", + issuedAt: NOW, + }), + }, + h.owner, + ); + + const session = makeSession(member); + await h.send("agent.subscribe", { topics: ["server.backup"] }, session.key, { + session: session.certificate, + replyTo: session.key.publicKey, + }); + expect(lastAck(h.sent).ok).toBe(true); + + h.queue.publish( + "server.backup", + "server.backup.upload", + { + server_id: "alpha", + backup_id: "bkp-1", + destination: "tegra_cloud", + state: "uploading", + sent_bytes: 128, + total_bytes: 256, + }, + { serverId: "alpha" }, + ); + h.queue.publish( + "server.backup", + "server.backup.upload", + { + server_id: "beta", + backup_id: "bkp-2", + destination: "tegra_cloud", + state: "uploading", + sent_bytes: 128, + total_bytes: 256, + }, + { serverId: "beta" }, + ); + + const backupEvents = eventsFor(h.sent, h.agent, session.key).filter( + (e) => e.type === "server.backup.upload", + ); + expect(backupEvents).toHaveLength(1); + const firstBackupEvent = backupEvents[0]; + if (!firstBackupEvent) throw new Error("Expected server.backup.upload event"); + expect((firstBackupEvent.data as { server_id: string }).server_id).toBe("alpha"); + }); }); describe("server status watcher", () => { diff --git a/src/backup/background-upload.test.ts b/src/backup/background-upload.test.ts new file mode 100644 index 0000000..e59f4af --- /dev/null +++ b/src/backup/background-upload.test.ts @@ -0,0 +1,495 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeAll, describe, expect, test } from "bun:test"; +import { randomBytes } from "node:crypto"; +import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { + AgentApiError, + createAgentApiClient, + createCommandQueue, + createLogger, + type TransportCommandFrame, +} from "../agent"; +import { openTestEvent } from "../agent/test-events"; +import { fingerprint, generateSigningKeyPair, ready } from "../crypto"; +import { + createCoreRegistry, + createInMemoryTrustContext, + createSignedCommand, + PROTOCOL_VERSION, + type ServerBackupUploadEvent, + serverBackupUploadEventSchema, + signSessionCertificate, + type TransportFrame, +} from "../protocol"; +import { createBackupManager, registerBackupHandlers } from "./index"; +import type { BackupCreateResult, BackupListResult } from "./types"; + +const tempDirs: string[] = []; + +function makeTempDir(prefix: string): string { + const dir = mkdtempSync(join(tmpdir(), prefix)); + tempDirs.push(dir); + return dir; +} + +function createSampleServer( + serversDir: string, + serverId: string, + files: Readonly>, +): void { + const serverDir = join(serversDir, serverId); + mkdirSync(join(serverDir, "logs"), { recursive: true }); + for (const [relPath, content] of Object.entries(files)) { + const fullPath = join(serverDir, relPath); + mkdirSync(join(fullPath, ".."), { recursive: true }); + writeFileSync(fullPath, content); + } +} + +function deferred() { + let resolve!: (value: T) => void; + let reject!: (reason?: unknown) => void; + const promise = new Promise((res, rej) => { + resolve = res; + reject = rej; + }); + return { promise, resolve, reject }; +} + +beforeAll(async () => { + await ready(); +}); + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir !== undefined) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +describe("Background multi-destination backups and progress events", () => { + test("server.backup.create responds after local finishes while Tegra Cloud uploads and confirms in background", async () => { + const root = makeTempDir("tegrad-bkp-bg-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + createSampleServer(serversDir, "smp", { "world/level.dat": "cloud-bg-world-v1" }); + + const putStarted = deferred(); + const allowPutFinish = deferred(); + let uploadedBytes: Uint8Array | undefined; + const confirmCalls: string[] = []; + + let storagePort = 0; + const storageServer = Bun.serve({ + port: 0, + hostname: "127.0.0.1", + async fetch(req): Promise { + const url = new URL(req.url); + if (req.method === "PUT" && url.pathname === "/upload/object") { + uploadedBytes = new Uint8Array(await req.arrayBuffer()); + putStarted.resolve(); + await allowPutFinish.promise; + return new Response(null, { status: 200 }); + } + if (req.method === "POST" && url.pathname === "/v1/agents/self/backup-upload-url") { + return new Response( + JSON.stringify({ + id: "cloud-bkp-99", + put_url: `http://127.0.0.1:${storagePort}/upload/object?sig=secret-put-token`, + headers: { "content-type": "application/octet-stream" }, + expires_at: Date.now() + 60_000, + max_bytes: 10 * 1024 * 1024, + }), + { status: 200 }, + ); + } + if ( + req.method === "POST" && + url.pathname === "/v1/agents/self/backups/cloud-bkp-99/confirm" + ) { + confirmCalls.push(url.pathname); + return new Response( + JSON.stringify({ + id: "cloud-bkp-99", + size_bytes: uploadedBytes?.byteLength ?? 0, + status: "stored", + }), + { status: 200 }, + ); + } + return new Response("not found", { status: 404 }); + }, + }); + storagePort = storageServer.port ?? 0; + + try { + const agent = generateSigningKeyPair(); + const owner = generateSigningKeyPair(); + const session = generateSigningKeyPair(); + const nowMs = 1_700_000_000_000; + const cert = signSessionCertificate({ + sessionPublicKey: session.publicKey, + accountKeyPair: owner, + notBefore: nowMs - 1000, + notAfter: nowMs + 3_600_000, + }); + + const registry = createCoreRegistry(); + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [owner.publicKey], + now: () => nowMs, + }); + const frames: TransportFrame[] = []; + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (frame) => frames.push(frame), + logger: createLogger({ level: "error", stdout: () => {}, stderr: () => {} }), + }); + + const apiClient = createAgentApiClient({ + apiUrl: `http://127.0.0.1:${storageServer.port}`, + agentKeyPair: agent, + allowInsecure: true, + now: () => nowMs, + }); + + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + allowInsecure: true, + now: () => nowMs, + cloudUploadUrlProvider: (req) => apiClient.requestBackupUploadUrl(req), + cloudUploadConfirmer: async (id) => { + await apiClient.confirmBackupUpload(id); + }, + onUploadProgress: (event) => { + queue.publish("server.backup", "server.backup.upload", event, { + serverId: event.server_id, + }); + }, + }); + manager.setConfig({ + server_id: "smp", + local: { enabled: true }, + tegra_cloud: { enabled: true }, + }); + registerBackupHandlers(queue, manager); + + let counter = 1; + const sendSessionCmd = async (type: string, body: unknown) => { + const signed = createSignedCommand( + { + type, + body, + agentPublicKey: agent.publicKey, + signer: session, + session: cert, + replyTo: session.publicKey, + counter: counter++, + now: nowMs, + }, + registry, + ); + const frame: TransportCommandFrame = { + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: fingerprint(agent.publicKey) }, + body: signed, + }; + await queue.enqueue(frame); + }; + + await sendSessionCmd("agent.subscribe", { topics: ["server.backup"] }); + await sendSessionCmd("server.backup.create", { server_id: "smp", note: "bg-test" }); + + // Command already acked and server.backup.created already sent before cloud PUT finishes + const createdAck = frames.filter((f) => f.kind === "ack")[1]; + expect(createdAck?.kind === "ack" && createdAck.body.ok).toBe(true); + expect(confirmCalls).toHaveLength(0); + + const openedEvents = () => + frames + .filter((f): f is Extract => f.kind === "event") + .map((f) => openTestEvent(f.body, agent.publicKey, session)); + + const createdEvent = openedEvents().find((e) => e.header.type === "server.backup.created"); + if (!createdEvent) throw new Error("Expected server.backup.created event"); + const createdResult = createdEvent.body as BackupCreateResult; + expect(createdResult.destinations).toHaveLength(1); + expect(createdResult.destinations[0]).toMatchObject({ destination: "local", ok: true }); + expect(createdResult.pending_uploads).toEqual([ + { + destination: "tegra_cloud", + state: "queued", + sent_bytes: 0, + total_bytes: createdResult.size_bytes, + }, + ]); + + // Wait until cloud PUT has actually started and inspect server.backup.list while in flight + await putStarted.promise; + await sendSessionCmd("server.backup.list", { server_id: "smp" }); + const listInFlight = openedEvents() + .filter((e) => e.header.type === "server.backup.list.result") + .at(-1)?.body as BackupListResult; + expect(listInFlight.backups).toHaveLength(1); + expect(listInFlight.backups[0]?.destination).toBe("local"); + expect(listInFlight.backups[0]?.pending_uploads).toHaveLength(1); + expect(listInFlight.backups[0]?.pending_uploads?.[0]).toMatchObject({ + destination: "tegra_cloud", + state: "uploading", + total_bytes: createdResult.size_bytes, + }); + + // Let cloud upload + confirmation finish in the background + allowPutFinish.resolve(); + await manager.waitForPendingUploads(); + + expect(confirmCalls).toEqual(["/v1/agents/self/backups/cloud-bkp-99/confirm"]); + expect(uploadedBytes?.byteLength).toBe(createdResult.size_bytes); + + const uploadEvents = openedEvents() + .filter((e) => e.header.type === "server.backup.upload") + .map((e) => serverBackupUploadEventSchema.parse(e.body)); + expect(uploadEvents[0]?.state).toBe("queued"); + expect(uploadEvents.some((e) => e.state === "uploading")).toBe(true); + expect(uploadEvents.at(-1)).toEqual({ + server_id: "smp", + backup_id: createdResult.backup_id, + destination: "tegra_cloud", + state: "done", + sent_bytes: createdResult.size_bytes, + total_bytes: createdResult.size_bytes, + }); + + // After completion, pending_uploads is gone and both local + tegra_cloud appear in list + const listedDone = await manager.listBackups({ server_id: "smp" }); + expect(listedDone.backups.map((b) => b.destination).sort()).toEqual(["local", "tegra_cloud"]); + for (const b of listedDone.backups) { + expect(b.pending_uploads).toBeUndefined(); + } + + // Local restore continues working normally + writeFileSync(join(serversDir, "smp", "world", "level.dat"), "mutated", "utf8"); + await manager.restoreBackup({ + server_id: "smp", + backup_id: createdResult.backup_id, + destination: "local", + }); + expect(readFileSync(join(serversDir, "smp", "world", "level.dat"), "utf8")).toBe( + "cloud-bg-world-v1", + ); + } finally { + void storageServer.stop(true); + } + }); + + test("throttles uploading progress events to at most ~2/sec and always emits final state", async () => { + const root = makeTempDir("tegrad-bkp-throttle-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + // 320 KiB incompressible bytes -> >5 chunks of 64 KiB + const bigData = randomBytes(320 * 1024); + createSampleServer(serversDir, "big", { "world/region.bin": bigData }); + + let fakeNow = 1_700_000_000_000; + const events: ServerBackupUploadEvent[] = []; + const storageServer = Bun.serve({ + port: 0, + hostname: "127.0.0.1", + async fetch(req) { + await req.arrayBuffer(); + return new Response(null, { status: 200 }); + }, + }); + + try { + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + allowInsecure: true, + now: () => fakeNow, + uploadProgressThrottleMs: 500, + cloudFetchImpl: async (input, init) => { + // Advance fakeNow by 150 ms per 64 KiB chunk read so >500ms passes across 6 chunks + const body = init?.body; + if (body instanceof ReadableStream) { + const reader = body.getReader(); + while (true) { + const { done } = await reader.read(); + if (done) break; + fakeNow += 150; + } + } + return await fetch(input, { method: "PUT", body: new Uint8Array(0) }); + }, + cloudUploadUrlProvider: async () => ({ + put_url: `http://127.0.0.1:${storageServer.port}/obj`, + headers: {}, + expires_at: fakeNow + 60_000, + max_bytes: 50 * 1024 * 1024, + }), + onUploadProgress: (ev) => events.push(ev), + }); + manager.setConfig({ + server_id: "big", + local: { enabled: true }, + tegra_cloud: { enabled: true }, + }); + + await manager.createBackup({ server_id: "big" }); + await manager.waitForPendingUploads(); + + const uploadingEvents = events.filter((e) => e.state === "uploading"); + // Initial uploading (0 bytes) + throttled updates (~500ms apart over ~600ms) -> far fewer than chunk count + expect(uploadingEvents.length).toBeGreaterThanOrEqual(2); + expect(uploadingEvents.length).toBeLessThanOrEqual(3); + expect(events[0]?.state).toBe("queued"); + expect(events.at(-1)?.state).toBe("done"); + expect(events.at(-1)?.sent_bytes).toBe(events.at(-1)?.total_bytes); + } finally { + void storageServer.stop(true); + } + }); + + test("failed confirm or PUT leaves local backup intact, omits failed upload from cloud index, and exposes stable code", async () => { + const root = makeTempDir("tegrad-bkp-confirm-fail-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + createSampleServer(serversDir, "srv", { "world/level.dat": "keep-local" }); + + const storageServer = Bun.serve({ + port: 0, + hostname: "127.0.0.1", + async fetch(req) { + await req.arrayBuffer(); + return new Response(null, { status: 200 }); + }, + }); + + try { + const events: ServerBackupUploadEvent[] = []; + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + allowInsecure: true, + cloudUploadUrlProvider: async () => ({ + id: "cloud-bkp-fail", + put_url: `http://127.0.0.1:${storageServer.port}/obj?sig=SECRET_DO_NOT_LEAK`, + headers: {}, + expires_at: Date.now() + 60_000, + max_bytes: 10 * 1024 * 1024, + }), + cloudUploadConfirmer: async () => { + throw new AgentApiError("quota_exceeded", "Backup storage quota exceeded", 413); + }, + onUploadProgress: (ev) => events.push(ev), + }); + manager.setConfig({ + server_id: "srv", + local: { enabled: true }, + tegra_cloud: { enabled: true }, + }); + + const created = await manager.createBackup({ server_id: "srv" }); + expect(created.destinations[0]).toMatchObject({ destination: "local", ok: true }); + await manager.waitForPendingUploads(); + + expect(events.at(-1)).toMatchObject({ + server_id: "srv", + backup_id: created.backup_id, + destination: "tegra_cloud", + state: "failed", + error: "quota_exceeded", + }); + expect(JSON.stringify(events)).not.toContain("SECRET_DO_NOT_LEAK"); + + // Backup was NOT recorded in tegra_cloud index because confirm failed + const cloudList = await manager.listBackups({ server_id: "srv", destination: "tegra_cloud" }); + expect(cloudList.backups).toHaveLength(0); + + // Local backup remains valid and list shows pending_uploads failed entry + const allList = await manager.listBackups({ server_id: "srv" }); + expect(allList.backups).toHaveLength(1); + expect(allList.backups[0]?.destination).toBe("local"); + expect(allList.backups[0]?.pending_uploads).toEqual([ + { + destination: "tegra_cloud", + state: "failed", + sent_bytes: created.size_bytes, + total_bytes: created.size_bytes, + error: "quota_exceeded", + }, + ]); + } finally { + void storageServer.stop(true); + } + }); + + test("single destination (tegra_cloud only) preserves synchronous result and still runs confirm", async () => { + const root = makeTempDir("tegrad-bkp-single-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + createSampleServer(serversDir, "onlycloud", { "world/level.dat": "single" }); + + const confirmedIds: string[] = []; + const storageServer = Bun.serve({ + port: 0, + hostname: "127.0.0.1", + async fetch(req) { + await req.arrayBuffer(); + return new Response(null, { status: 200 }); + }, + }); + + try { + const events: ServerBackupUploadEvent[] = []; + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + allowInsecure: true, + cloudUploadUrlProvider: async () => ({ + id: "single-cloud-id", + put_url: `http://127.0.0.1:${storageServer.port}/obj`, + headers: {}, + expires_at: Date.now() + 60_000, + max_bytes: 10 * 1024 * 1024, + }), + cloudUploadConfirmer: async (id) => { + confirmedIds.push(id); + }, + onUploadProgress: (ev) => events.push(ev), + }); + manager.setConfig({ + server_id: "onlycloud", + local: { enabled: false }, + tegra_cloud: { enabled: true }, + }); + + const created = await manager.createBackup({ server_id: "onlycloud" }); + expect(created.destinations).toHaveLength(1); + expect(created.destinations[0]).toMatchObject({ destination: "tegra_cloud", ok: true }); + expect(created.pending_uploads).toBeUndefined(); + expect(confirmedIds).toEqual(["single-cloud-id"]); + expect(events).toHaveLength(0); + } finally { + void storageServer.stop(true); + } + }); +}); diff --git a/src/backup/backup.test.ts b/src/backup/backup.test.ts index 7a91756..41533a3 100644 --- a/src/backup/backup.test.ts +++ b/src/backup/backup.test.ts @@ -202,25 +202,30 @@ describe("Local backups, rotation, and independent destinations", () => { async delete() {}, }; + const progressEvents: { destination: string; state: string; error?: string | undefined }[] = []; const manager = createBackupManager({ stateDir, serversBaseDir: serversDir, destinations: [failingDest, goodDest], + onUploadProgress: (event) => progressEvents.push(event), }); const result = await manager.createBackup({ server_id: "smp" }); - expect(result.destinations).toHaveLength(2); + expect(result.destinations).toHaveLength(1); expect(result.destinations[0]).toMatchObject({ - destination: "s3", - ok: false, - error: "Simulated S3 outage", - }); - expect(result.destinations[1]).toMatchObject({ destination: "local", ok: true, }); + expect(result.pending_uploads).toHaveLength(1); + expect(result.pending_uploads?.[0]).toMatchObject({ + destination: "s3", + state: "queued", + }); expect(uploadedToGood).toEqual([result.backup_id]); + await manager.waitForPendingUploads(); + expect(progressEvents.some((e) => e.destination === "s3" && e.state === "failed")).toBe(true); + const listed = await manager.listBackups({ server_id: "smp" }); expect(listed.errors).toEqual([{ destination: "s3", error: "Simulated S3 list outage" }]); }); diff --git a/src/backup/cloud-upload-url.test.ts b/src/backup/cloud-upload-url.test.ts index be6a1d9..db534e9 100644 --- a/src/backup/cloud-upload-url.test.ts +++ b/src/backup/cloud-upload-url.test.ts @@ -138,11 +138,18 @@ describe("Tegra Cloud upload URL from the control API", () => { const { server, received } = startStorage(); try { let mode: "too_big" | "fail" = "too_big"; + const progressEvents: { + backup_id: string; + destination: string; + state: string; + error?: string | undefined; + }[] = []; const manager = createBackupManager({ stateDir: join(root, "state"), serversBaseDir: serversDir, localBackupsDir: join(root, "backups"), allowInsecure: true, + onUploadProgress: (event) => progressEvents.push(event), cloudUploadUrlProvider: async () => { if (mode === "fail") { throw new Error("request to https://api.tegra.example/x?sig=top-secret failed"); @@ -162,18 +169,35 @@ describe("Tegra Cloud upload URL from the control API", () => { }); const tooBig = await manager.createBackup({ server_id: "cloudsrv" }); - const cloud = tooBig.destinations.find((d) => d.destination === "tegra_cloud"); const local = tooBig.destinations.find((d) => d.destination === "local"); - expect(cloud?.ok).toBe(false); expect(local?.ok).toBe(true); + expect(tooBig.pending_uploads?.[0]).toMatchObject({ + destination: "tegra_cloud", + state: "queued", + }); + await manager.waitForPendingUploads(); + expect( + progressEvents.find( + (e) => + e.backup_id === tooBig.backup_id && + e.destination === "tegra_cloud" && + e.state === "failed", + ), + ).toMatchObject({ state: "failed", error: "backup_failed" }); expect(received).toHaveLength(0); mode = "fail"; const failed = await manager.createBackup({ server_id: "cloudsrv" }); - const failedCloud = failed.destinations.find((d) => d.destination === "tegra_cloud"); - expect(failedCloud?.ok).toBe(false); expect(failed.destinations.find((d) => d.destination === "local")?.ok).toBe(true); - expect(JSON.stringify(failedCloud)).not.toContain("top-secret"); + await manager.waitForPendingUploads(); + const failedEvent = progressEvents.find( + (e) => + e.backup_id === failed.backup_id && + e.destination === "tegra_cloud" && + e.state === "failed", + ); + expect(failedEvent).toMatchObject({ state: "failed", error: "backup_failed" }); + expect(JSON.stringify(progressEvents)).not.toContain("top-secret"); expect(received).toHaveLength(0); } finally { void server.stop(true); diff --git a/src/backup/destinations/tegra-cloud.ts b/src/backup/destinations/tegra-cloud.ts index 432bdac..76d0eb0 100644 --- a/src/backup/destinations/tegra-cloud.ts +++ b/src/backup/destinations/tegra-cloud.ts @@ -137,6 +137,30 @@ async function readResponseBytesCapped(response: Response, maxBytes: number): Pr return out; } +const UPLOAD_PROGRESS_CHUNK_BYTES = 64 * 1024; + +function createChunkedUploadBody( + archive: Uint8Array, + onProgress: (sentBytes: number, totalBytes: number) => void, +): ReadableStream { + const totalBytes = archive.byteLength; + let offset = 0; + + return new ReadableStream({ + pull(controller) { + if (offset >= totalBytes) { + controller.close(); + return; + } + const end = Math.min(offset + UPLOAD_PROGRESS_CHUNK_BYTES, totalBytes); + const chunk = archive.subarray(offset, end); + offset = end; + controller.enqueue(chunk); + onProgress(offset, totalBytes); + }, + }); +} + const FORBIDDEN_UPLOAD_HEADERS = new Set(["content-length", "host", "transfer-encoding"]); const HEADER_NAME_REGEX = /^[A-Za-z0-9-]{1,128}$/; @@ -237,6 +261,11 @@ export class TegraCloudBackupDestination implements BackupDestination { this.allowedHosts, ); + const body: Uint8Array | ReadableStream = + ctx.onProgress !== undefined && archive.byteLength > 0 + ? createChunkedUploadBody(archive, ctx.onProgress) + : archive; + const controller = new AbortController(); const timer = setTimeout(() => controller.abort(), this.timeoutMs); let response: Response; @@ -251,7 +280,7 @@ export class TegraCloudBackupDestination implements BackupDestination { ...sanitizeUploadHeaders(ctx.presignedUploadHeaders), "Content-Length": String(archive.byteLength), }, - body: archive, + body, redirect: "manual", signal: controller.signal, }); @@ -274,6 +303,10 @@ export class TegraCloudBackupDestination implements BackupDestination { ); } + if (ctx.confirmUpload !== undefined) { + await ctx.confirmUpload(); + } + const metadata: BackupMetadata = { id: validBackupId, server_id: validServerId, diff --git a/src/backup/index.ts b/src/backup/index.ts index 5564d25..a4e699a 100644 --- a/src/backup/index.ts +++ b/src/backup/index.ts @@ -42,6 +42,8 @@ export { export { type BackupManager, type BackupManagerOptions, + type CloudUploadTarget, + type CloudUploadUrlProvider, type CreateBackupOptions, type CreateLocalBackupOptions, createBackupHook, diff --git a/src/backup/manager.ts b/src/backup/manager.ts index 1b885cc..e3fd63c 100644 --- a/src/backup/manager.ts +++ b/src/backup/manager.ts @@ -2,18 +2,22 @@ // Copyright (C) 2026 Antônio Miranda import { randomBytes } from "node:crypto"; +import { AgentApiError } from "../agent/api-client"; import type { CommandQueue } from "../agent/jobs"; import type { Logger } from "../agent/logger"; import { DEFAULT_SERVERS_BASE_DIR } from "../files"; import { type BackupDestinationKind, + type BackupUploadState, backupIdSchema, + type PendingBackupUpload, ProtocolError, type ServerBackupConfigSetBody, type ServerBackupCreateBody, type ServerBackupDeleteBody, type ServerBackupListBody, type ServerBackupRestoreBody, + type ServerBackupUploadEvent, serverIdSchema, } from "../protocol"; import { createServerPermissionContext, type PermissionContext } from "../server/permissions"; @@ -69,6 +73,7 @@ export interface CreateBackupOptions { } export interface CloudUploadTarget { + readonly id?: string | undefined; readonly put_url: string; readonly headers: Readonly>; readonly expires_at: number; @@ -99,6 +104,12 @@ export interface BackupManagerOptions { * inside a command is ignored. */ readonly cloudUploadUrlProvider?: CloudUploadUrlProvider; + /** Confirms a completed Tegra Cloud backup upload with the control API. */ + readonly cloudUploadConfirmer?: (cloudBackupId: string) => Promise; + /** Emits throttled progress and terminal events for background uploads. */ + readonly onUploadProgress?: (event: ServerBackupUploadEvent) => void; + /** Minimum interval between `uploading` progress events per upload (default 500 ms). */ + readonly uploadProgressThrottleMs?: number; readonly s3MaxBytes?: number; readonly maxArchiveFiles?: number; readonly maxArchiveBytes?: number; @@ -131,11 +142,41 @@ export interface BackupManager { }>; deleteBackup(params: ServerBackupDeleteBody): Promise; restoreBackup(params: ServerBackupRestoreBody): Promise; + waitForPendingUploads(): Promise; createBackupHook(): BackupHook; start(): void; close(): void; } +const DEFAULT_UPLOAD_PROGRESS_THROTTLE_MS = 500; +const MAX_FAILED_UPLOAD_RECORDS = 128; + +interface PendingUploadRecord { + readonly server_id: string; + readonly backup_id: string; + readonly destination: BackupDestinationKind; + state: BackupUploadState; + sent_bytes: number; + readonly total_bytes: number; + error?: string; +} + +function toStableBackupUploadErrorCode(err: unknown): string { + if (err instanceof AgentApiError) { + if (err.code === "http_error") { + if (err.status === 413) return "quota_exceeded"; + if (err.status === 409) return "backup_not_ready"; + if (err.status === 404) return "backup_not_found"; + return "http_error"; + } + return err.code; + } + if (err instanceof ProtocolError) { + return err.code; + } + return "backup_failed"; +} + export function createBackupManager(options: BackupManagerOptions): BackupManager { const serversBaseDir = options.serversBaseDir ?? DEFAULT_SERVERS_BASE_DIR; const allowInsecure = options.allowInsecure ?? false; @@ -179,6 +220,218 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage destinationMap.set(dest.kind, dest); } + const uploadProgressThrottleMs = + options.uploadProgressThrottleMs ?? DEFAULT_UPLOAD_PROGRESS_THROTTLE_MS; + const pendingUploads = new Map(); + const activeBackgroundUploads = new Set>(); + + function uploadRecordKey( + serverId: string, + backupId: string, + destination: BackupDestinationKind, + ): string { + return `${serverId}\0${backupId}\0${destination}`; + } + + function emitUploadProgress(record: PendingUploadRecord): void { + if (options.onUploadProgress === undefined) { + return; + } + const event: ServerBackupUploadEvent = { + server_id: record.server_id, + backup_id: record.backup_id, + destination: record.destination, + state: record.state, + sent_bytes: record.sent_bytes, + total_bytes: record.total_bytes, + ...(record.error !== undefined ? { error: record.error } : {}), + }; + try { + options.onUploadProgress(event); + } catch { + // Progress listener failures must never interrupt background uploads. + } + } + + function pruneFailedUploadRecords(): void { + let failedCount = 0; + for (const record of pendingUploads.values()) { + if (record.state === "failed") { + failedCount++; + } + } + if (failedCount <= MAX_FAILED_UPLOAD_RECORDS) { + return; + } + let toRemove = failedCount - MAX_FAILED_UPLOAD_RECORDS; + for (const [key, record] of pendingUploads.entries()) { + if (toRemove <= 0) { + break; + } + if (record.state === "failed") { + pendingUploads.delete(key); + toRemove--; + } + } + } + + async function executeDestinationUpload( + dest: BackupDestination, + buffer: Uint8Array, + ctxParams: { + readonly serverId: string; + readonly backupId: string; + readonly createdAt: number; + readonly sha256: string; + readonly trigger: BackupTrigger; + readonly note?: string; + readonly retentionCount?: number; + readonly tegraCloudUploadUrl?: string; + readonly onProgress?: (sentBytes: number, totalBytes: number) => void; + }, + ): Promise { + let cloudTarget: CloudUploadTarget | undefined; + if (dest.kind === "tegra_cloud" && options.cloudUploadUrlProvider !== undefined) { + cloudTarget = await options.cloudUploadUrlProvider({ + server_id: ctxParams.serverId, + size_bytes: buffer.byteLength, + }); + if (buffer.byteLength > cloudTarget.max_bytes) { + throw new ProtocolError( + "backup_failed", + `Backup archive size (${buffer.byteLength}) exceeds the allowed upload size (${cloudTarget.max_bytes})`, + ); + } + } + const cloudId = cloudTarget?.id; + const confirmer = options.cloudUploadConfirmer; + const confirmUpload = + dest.kind === "tegra_cloud" && cloudId !== undefined && confirmer !== undefined + ? () => confirmer(cloudId) + : undefined; + + return await dest.upload(buffer, { + serverId: ctxParams.serverId, + backupId: ctxParams.backupId, + createdAt: ctxParams.createdAt, + sha256: ctxParams.sha256, + trigger: ctxParams.trigger, + ...(ctxParams.note !== undefined ? { note: ctxParams.note } : {}), + ...(ctxParams.retentionCount !== undefined + ? { retentionCount: ctxParams.retentionCount } + : {}), + ...(ctxParams.onProgress !== undefined ? { onProgress: ctxParams.onProgress } : {}), + ...(confirmUpload !== undefined ? { confirmUpload } : {}), + ...(cloudTarget !== undefined + ? { + presignedUploadUrl: cloudTarget.put_url, + presignedUploadHeaders: cloudTarget.headers, + } + : dest.kind === "tegra_cloud" && ctxParams.tegraCloudUploadUrl !== undefined + ? { presignedUploadUrl: ctxParams.tegraCloudUploadUrl } + : {}), + }); + } + + async function runInlineDestinationUpload( + dest: BackupDestination, + buffer: Uint8Array, + ctxParams: { + readonly serverId: string; + readonly backupId: string; + readonly createdAt: number; + readonly sha256: string; + readonly trigger: BackupTrigger; + readonly note?: string; + readonly retentionCount?: number; + readonly tegraCloudUploadUrl?: string; + }, + ): Promise { + try { + const meta = await executeDestinationUpload(dest, buffer, ctxParams); + return { + destination: dest.kind, + ok: true, + backup: meta, + }; + } catch (err) { + const message = redactUrlQueryStrings(err instanceof Error ? err.message : String(err)); + options.logger?.error("Backup destination upload failed", { + serverId: ctxParams.serverId, + backupId: ctxParams.backupId, + destination: dest.kind, + errName: err instanceof Error ? err.name : "Error", + }); + return { + destination: dest.kind, + ok: false, + error: message, + }; + } + } + + function startBackgroundUpload( + dest: BackupDestination, + buffer: Uint8Array, + record: PendingUploadRecord, + ctxParams: { + readonly serverId: string; + readonly backupId: string; + readonly createdAt: number; + readonly sha256: string; + readonly trigger: BackupTrigger; + readonly note?: string; + readonly retentionCount?: number; + readonly tegraCloudUploadUrl?: string; + }, + ): void { + const key = uploadRecordKey(record.server_id, record.backup_id, record.destination); + const task = (async () => { + // Yield a microtask so the caller receives the initial queued result before uploading starts. + await Promise.resolve(); + record.state = "uploading"; + record.sent_bytes = 0; + let lastEmitAt = now(); + emitUploadProgress(record); + + try { + await executeDestinationUpload(dest, buffer, { + ...ctxParams, + onProgress: (sentBytes, totalBytes) => { + const clamped = Math.max(0, Math.min(Math.trunc(sentBytes), totalBytes)); + record.sent_bytes = clamped; + const current = now(); + if (current - lastEmitAt >= uploadProgressThrottleMs) { + lastEmitAt = current; + emitUploadProgress(record); + } + }, + }); + pendingUploads.delete(key); + record.state = "done"; + record.sent_bytes = record.total_bytes; + delete record.error; + emitUploadProgress(record); + } catch (err) { + const errorCode = toStableBackupUploadErrorCode(err); + record.state = "failed"; + record.error = errorCode; + pruneFailedUploadRecords(); + options.logger?.error("Background backup destination upload failed", { + serverId: ctxParams.serverId, + backupId: ctxParams.backupId, + destination: dest.kind, + code: errorCode, + errName: err instanceof Error ? err.name : "Error", + }); + emitUploadProgress(record); + } + })().finally(() => { + activeBackgroundUploads.delete(task); + }); + activeBackgroundUploads.add(task); + } + function getConfig(serverId: string): ServerBackupConfig { return configStore.getServerConfig(serverId); } @@ -202,6 +455,12 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage }; } + const orderedDestinations = [...enabledDestinations].sort((a, b) => { + if (a.kind === "local" && b.kind !== "local") return -1; + if (b.kind === "local" && a.kind !== "local") return 1; + return 0; + }); + const archiveResult = await createConsistentServerArchive({ serversBaseDir, serverId: validServerId, @@ -221,60 +480,65 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage : {}), }); - const outcomes: BackupDestinationOutcome[] = []; - for (const dest of enabledDestinations) { - try { - let cloudTarget: CloudUploadTarget | undefined; - if (dest.kind === "tegra_cloud" && options.cloudUploadUrlProvider !== undefined) { - cloudTarget = await options.cloudUploadUrlProvider({ - server_id: validServerId, - size_bytes: archiveResult.buffer.byteLength, - }); - if (archiveResult.buffer.byteLength > cloudTarget.max_bytes) { - throw new ProtocolError( - "backup_failed", - `Backup archive size (${archiveResult.buffer.byteLength}) exceeds the allowed upload size (${cloudTarget.max_bytes})`, - ); - } - } - const meta = await dest.upload(archiveResult.buffer, { - serverId: validServerId, - backupId, - createdAt, - sha256: archiveResult.sha256, - trigger, - ...(params.note !== undefined ? { note: params.note } : {}), - ...(params.retention_count !== undefined - ? { retentionCount: params.retention_count } - : {}), - ...(cloudTarget !== undefined - ? { - presignedUploadUrl: cloudTarget.put_url, - presignedUploadHeaders: cloudTarget.headers, - } - : dest.kind === "tegra_cloud" && params.tegra_cloud_upload_url !== undefined - ? { presignedUploadUrl: params.tegra_cloud_upload_url } - : {}), - }); - outcomes.push({ - destination: dest.kind, - ok: true, - backup: meta, - }); - } catch (err) { - const message = redactUrlQueryStrings(err instanceof Error ? err.message : String(err)); - options.logger?.error("Backup destination upload failed", { - serverId: validServerId, - backupId, - destination: dest.kind, - errName: err instanceof Error ? err.name : "Error", - }); - outcomes.push({ - destination: dest.kind, - ok: false, - error: message, - }); - } + const baseCtx = { + serverId: validServerId, + backupId, + createdAt, + sha256: archiveResult.sha256, + trigger, + ...(params.note !== undefined ? { note: params.note } : {}), + ...(params.retention_count !== undefined ? { retentionCount: params.retention_count } : {}), + ...(params.tegra_cloud_upload_url !== undefined + ? { tegraCloudUploadUrl: params.tegra_cloud_upload_url } + : {}), + }; + + const [primary, ...secondary] = orderedDestinations; + if (primary === undefined) { + return { + backup_id: backupId, + server_id: validServerId, + created_at: createdAt, + size_bytes: archiveResult.buffer.byteLength, + sha256: archiveResult.sha256, + trigger, + destinations: [], + }; + } + + const primaryOutcome = await runInlineDestinationUpload(primary, archiveResult.buffer, baseCtx); + + if (secondary.length === 0) { + return { + backup_id: backupId, + server_id: validServerId, + created_at: createdAt, + size_bytes: archiveResult.buffer.byteLength, + sha256: archiveResult.sha256, + trigger, + destinations: [primaryOutcome], + }; + } + + const initialPending: PendingBackupUpload[] = []; + for (const dest of secondary) { + const record: PendingUploadRecord = { + server_id: validServerId, + backup_id: backupId, + destination: dest.kind, + state: "queued", + sent_bytes: 0, + total_bytes: archiveResult.buffer.byteLength, + }; + pendingUploads.set(uploadRecordKey(validServerId, backupId, dest.kind), record); + emitUploadProgress(record); + initialPending.push({ + destination: dest.kind, + state: "queued", + sent_bytes: 0, + total_bytes: archiveResult.buffer.byteLength, + }); + startBackgroundUpload(dest, archiveResult.buffer, record, baseCtx); } return { @@ -284,7 +548,8 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage size_bytes: archiveResult.buffer.byteLength, sha256: archiveResult.sha256, trigger, - destinations: outcomes, + destinations: [primaryOutcome], + pending_uploads: initialPending, }; } @@ -365,9 +630,36 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage } allBackups.sort((a, b) => b.created_at - a.created_at || b.id.localeCompare(a.id)); + + const pendingByBackupId = new Map(); + for (const record of pendingUploads.values()) { + if (record.server_id !== validServerId) { + continue; + } + if (params.destination !== undefined && record.destination !== params.destination) { + continue; + } + const list = pendingByBackupId.get(record.backup_id) ?? []; + list.push({ + destination: record.destination, + state: record.state, + sent_bytes: record.sent_bytes, + total_bytes: record.total_bytes, + ...(record.error !== undefined ? { error: record.error } : {}), + }); + pendingByBackupId.set(record.backup_id, list); + } + + const enrichedBackups = allBackups.map((backup) => { + const pending = (pendingByBackupId.get(backup.id) ?? []).filter( + (entry) => entry.destination !== backup.destination, + ); + return pending.length > 0 ? { ...backup, pending_uploads: pending } : backup; + }); + return { server_id: validServerId, - backups: allBackups, + backups: enrichedBackups, errors, }; } @@ -385,6 +677,7 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage ); } await dest.delete(validServerId, validBackupId); + pendingUploads.delete(uploadRecordKey(validServerId, validBackupId, dest.kind)); return { server_id: validServerId, backup_id: validBackupId, @@ -392,6 +685,10 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage }; } + for (const dest of destinations) { + pendingUploads.delete(uploadRecordKey(validServerId, validBackupId, dest.kind)); + } + const targets = destinations.filter((d) => d.isEnabled(validServerId)); const results: BackupDeleteDestinationResult[] = []; let allNotFound = targets.length > 0; @@ -543,6 +840,11 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage listBackups, deleteBackup, restoreBackup, + async waitForPendingUploads(): Promise { + while (activeBackgroundUploads.size > 0) { + await Promise.all([...activeBackgroundUploads]); + } + }, createBackupHook: () => createBackupHook(manager), start() { scheduler.start(); diff --git a/src/backup/types.ts b/src/backup/types.ts index 589db5b..21c6879 100644 --- a/src/backup/types.ts +++ b/src/backup/types.ts @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import type { BackupDestinationKind, BackupScheduleConfig } from "../protocol"; +import type { BackupDestinationKind, BackupScheduleConfig, PendingBackupUpload } from "../protocol"; export type BackupTrigger = "manual" | "scheduled" | "before_change" | "pre_restore"; @@ -14,6 +14,7 @@ export interface BackupMetadata { readonly trigger: BackupTrigger; readonly destination: BackupDestinationKind; readonly note?: string | undefined; + readonly pending_uploads?: readonly PendingBackupUpload[] | undefined; } export interface BackupUploadContext { @@ -27,6 +28,8 @@ export interface BackupUploadContext { readonly presignedUploadUrl?: string; /** Extra headers the upload URL was issued for (e.g. a signed content type). */ readonly presignedUploadHeaders?: Readonly>; + readonly onProgress?: (sentBytes: number, totalBytes: number) => void; + readonly confirmUpload?: () => Promise; } export interface BackupDownloadOptions { @@ -61,6 +64,7 @@ export interface BackupCreateResult { readonly sha256: string; readonly trigger: BackupTrigger; readonly destinations: readonly BackupDestinationOutcome[]; + readonly pending_uploads?: readonly PendingBackupUpload[] | undefined; } export interface BackupDestinationError { diff --git a/src/cli/run.ts b/src/cli/run.ts index bd14e5c..afe7ca4 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -213,6 +213,14 @@ export async function createAgentRuntime( }, ...(options.fetch !== undefined ? { cloudFetchImpl: options.fetch } : {}), cloudUploadUrlProvider: (request) => apiClient.requestBackupUploadUrl(request), + cloudUploadConfirmer: async (cloudBackupId: string) => { + await apiClient.confirmBackupUpload(cloudBackupId); + }, + onUploadProgress: (event) => { + queue.publish("server.backup", "server.backup.upload", event, { + serverId: event.server_id, + }); + }, ...(options.timers !== undefined ? { timers: { diff --git a/src/protocol/commands/agent.ts b/src/protocol/commands/agent.ts index a0d621a..1a87d11 100644 --- a/src/protocol/commands/agent.ts +++ b/src/protocol/commands/agent.ts @@ -7,7 +7,7 @@ import { roleGrantSchema } from "../roles"; import { keyIdSchema } from "../schemas"; import { serverIdSchema } from "./server"; -export const SUBSCRIPTION_TOPICS = ["server.status"] as const; +export const SUBSCRIPTION_TOPICS = ["server.status", "server.backup"] as const; export const subscriptionTopicSchema = z.enum(SUBSCRIPTION_TOPICS); export type SubscriptionTopic = z.infer; diff --git a/src/protocol/commands/backup.ts b/src/protocol/commands/backup.ts index 37ac626..3ab7150 100644 --- a/src/protocol/commands/backup.ts +++ b/src/protocol/commands/backup.ts @@ -18,6 +18,34 @@ export const backupIdSchema = z export const backupDestinationKindSchema = z.enum(["local", "s3", "tegra_cloud"]); export type BackupDestinationKind = z.infer; +export const BACKUP_UPLOAD_STATES = ["queued", "uploading", "done", "failed"] as const; +export const backupUploadStateSchema = z.enum(BACKUP_UPLOAD_STATES); +export type BackupUploadState = z.infer; + +export const serverBackupUploadEventSchema = z + .object({ + server_id: serverIdSchema, + backup_id: backupIdSchema, + destination: backupDestinationKindSchema, + state: backupUploadStateSchema, + sent_bytes: z.number().int().nonnegative(), + total_bytes: z.number().int().nonnegative(), + error: z.string().min(1).max(128).optional(), + }) + .strict(); +export type ServerBackupUploadEvent = z.infer; + +export const pendingBackupUploadSchema = z + .object({ + destination: backupDestinationKindSchema, + state: backupUploadStateSchema, + sent_bytes: z.number().int().nonnegative(), + total_bytes: z.number().int().nonnegative(), + error: z.string().min(1).max(128).optional(), + }) + .strict(); +export type PendingBackupUpload = z.infer; + export const backupScheduleConfigSchema = z .object({ enabled: z.boolean(), diff --git a/src/protocol/index.ts b/src/protocol/index.ts index afbcad5..e7a5a56 100644 --- a/src/protocol/index.ts +++ b/src/protocol/index.ts @@ -66,27 +66,33 @@ export { export { BACKUP_COMMANDS, BACKUP_ID_REGEX, + BACKUP_UPLOAD_STATES, type BackupDestinationKind, type BackupLocalConfig, type BackupS3ConfigInput, type BackupScheduleConfig, type BackupTegraCloudConfig, + type BackupUploadState, backupDestinationKindSchema, backupIdSchema, backupLocalConfigSchema, backupS3ConfigSchema, backupScheduleConfigSchema, backupTegraCloudConfigSchema, + backupUploadStateSchema, MAX_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_RETENTION_COUNT, MIN_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, + type PendingBackupUpload, + pendingBackupUploadSchema, registerBackupCommands, type ServerBackupConfigSetBody, type ServerBackupCreateBody, type ServerBackupDeleteBody, type ServerBackupListBody, type ServerBackupRestoreBody, + type ServerBackupUploadEvent, s3BucketSchema, s3PrefixSchema, s3RegionSchema, @@ -101,6 +107,7 @@ export { serverBackupListCommand, serverBackupRestoreBodySchema, serverBackupRestoreCommand, + serverBackupUploadEventSchema, } from "./commands/backup"; export { agentPingCommand, From faa64f627eb6340d71b4ca6b5acf96b64df011d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Thu, 26 Nov 2026 18:37:50 -0300 Subject: [PATCH 38/59] feat: add background server.install_modpack command with progress events and resume --- .../{index-d84531yv.js => index-7gzwrqzw.js} | 289 ++-- lib/protocol/index.js | 46 +- lib/types/protocol/commands/agent.d.ts | 12 +- lib/types/protocol/commands/modpack.d.ts | 238 +++ lib/types/protocol/commands/state.d.ts | 4 + lib/types/protocol/errors.d.ts | 2 +- lib/types/protocol/index.d.ts | 1 + lib/vault/index.js | 2 +- scripts/smoke-lib.ts | 33 + src/agent/api-client.ts | 169 ++- src/agent/index.ts | 8 + src/cli/run.ts | 54 +- src/files/index.ts | 4 + src/files/zip.ts | 527 +++++++ src/protocol/commands/agent.ts | 2 +- src/protocol/commands/core.ts | 19 +- src/protocol/commands/modpack.ts | 174 +++ src/protocol/commands/state.ts | 1 + src/protocol/errors.ts | 9 +- src/protocol/index.ts | 37 + src/protocol/phase3.test.ts | 11 + src/state/download.ts | 30 + src/state/index.ts | 10 + src/state/manager.ts | 104 +- src/state/modpack-installer.test.ts | 917 ++++++++++++ src/state/modpack-installer.ts | 1281 +++++++++++++++++ 26 files changed, 3832 insertions(+), 152 deletions(-) rename lib/chunks/{index-d84531yv.js => index-7gzwrqzw.js} (87%) create mode 100644 lib/types/protocol/commands/modpack.d.ts create mode 100644 src/protocol/commands/modpack.ts create mode 100644 src/state/modpack-installer.test.ts create mode 100644 src/state/modpack-installer.ts diff --git a/lib/chunks/index-d84531yv.js b/lib/chunks/index-7gzwrqzw.js similarity index 87% rename from lib/chunks/index-d84531yv.js rename to lib/chunks/index-7gzwrqzw.js index bec3d7a..47ce2f3 100644 --- a/lib/chunks/index-d84531yv.js +++ b/lib/chunks/index-7gzwrqzw.js @@ -1041,7 +1041,7 @@ function registerServerCommands(registry) { } // src/protocol/commands/agent.ts -var SUBSCRIPTION_TOPICS = ["server.status", "server.backup"]; +var SUBSCRIPTION_TOPICS = ["server.status", "server.backup", "server.modpack"]; var subscriptionTopicSchema = z5.enum(SUBSCRIPTION_TOPICS); var SERVER_STATES = ["stopped", "starting", "running", "stopping", "crashed"]; var serverStateSchema = z5.enum(SERVER_STATES); @@ -1231,7 +1231,7 @@ function registerBackupCommands(registry) { return registry.registerAll(BACKUP_COMMANDS); } // src/protocol/commands/core.ts -import { z as z12 } from "zod"; +import { z as z13 } from "zod"; // src/protocol/commands/files.ts import { z as z7 } from "zod"; @@ -1474,13 +1474,129 @@ function registerHostCommands(registry) { return registry.registerAll(HOST_COMMANDS); } -// src/protocol/commands/pairing.ts +// src/protocol/commands/modpack.ts import { z as z9 } from "zod"; +var MODPACK_SOURCES = ["tegra", "modrinth", "curseforge"]; +var modpackSourceSchema = z9.enum(MODPACK_SOURCES); +var MODPACK_INSTALL_PHASES = [ + "resolving", + "downloading", + "extracting", + "overrides", + "finalizing" +]; +var modpackInstallPhaseSchema = z9.enum(MODPACK_INSTALL_PHASES); +var MODPACK_INSTALL_JOB_STATES = ["running", "completed", "failed", "cancelled"]; +var modpackInstallJobStateSchema = z9.enum(MODPACK_INSTALL_JOB_STATES); +var MODPACK_INSTALL_ERROR_CODES = [ + "pack_unavailable", + "host_not_allowed", + "hash_mismatch", + "too_large", + "install_in_progress", + "server_running", + "api_unavailable", + "io_error", + "cancelled" +]; +var modpackInstallErrorCodeSchema = z9.enum(MODPACK_INSTALL_ERROR_CODES); +var modpackInstallSkippedItemSchema = z9.object({ + name: z9.string().min(1).max(256), + reason: z9.string().min(1).max(128) +}).strict(); +var serverInstallModpackBodySchema = z9.object({ + server_id: serverIdSchema, + source: modpackSourceSchema, + modpack_id: z9.string().min(1).max(128), + version_id: z9.string().min(1).max(128), + modpack_name: z9.string().min(1).max(256).optional(), + version_label: z9.string().min(1).max(128).optional() +}).strict(); +var serverInstallModpackStatusBodySchema = z9.object({ + server_id: serverIdSchema +}).strict(); +var serverInstallModpackCancelBodySchema = z9.object({ + server_id: serverIdSchema, + job_id: z9.string().min(1).max(128).optional() +}).strict(); +var serverInstallModpackAcceptedEventSchema = z9.object({ + job_id: z9.string().min(1).max(128), + server_id: serverIdSchema +}).strict(); +var serverInstallModpackProgressEventSchema = z9.object({ + job_id: z9.string().min(1).max(128), + server_id: serverIdSchema, + phase: modpackInstallPhaseSchema, + done: z9.number().int().nonnegative(), + total: z9.number().int().nonnegative(), + current: z9.string().min(1).max(256).optional() +}).strict(); +var serverInstallModpackResultEventSchema = z9.object({ + job_id: z9.string().min(1).max(128), + server_id: serverIdSchema, + ok: z9.boolean(), + installed: z9.number().int().nonnegative(), + skipped: z9.array(modpackInstallSkippedItemSchema).max(4000), + error_code: modpackInstallErrorCodeSchema.optional() +}).strict(); +var modpackInstallJobStatusSchema = z9.object({ + job_id: z9.string().min(1).max(128), + server_id: serverIdSchema, + source: modpackSourceSchema, + modpack_id: z9.string().min(1).max(128), + version_id: z9.string().min(1).max(128), + modpack_name: z9.string().min(1).max(256).optional(), + version_label: z9.string().min(1).max(128).optional(), + status: modpackInstallJobStateSchema, + phase: modpackInstallPhaseSchema, + done: z9.number().int().nonnegative(), + total: z9.number().int().nonnegative(), + current: z9.string().min(1).max(256).optional(), + installed: z9.number().int().nonnegative(), + skipped: z9.array(modpackInstallSkippedItemSchema).max(4000), + error_code: modpackInstallErrorCodeSchema.optional(), + started_at: z9.number().int().nonnegative(), + updated_at: z9.number().int().nonnegative(), + finished_at: z9.number().int().nonnegative().optional() +}).strict(); +var serverInstallModpackStatusResultSchema = z9.object({ + server_id: serverIdSchema, + job: modpackInstallJobStatusSchema.nullable() +}).strict(); +var serverInstallModpackCommand = defineCommand({ + type: "server.install_modpack", + sensitive: true, + minRole: "editor", + body: serverInstallModpackBodySchema +}); +var serverInstallModpackStatusCommand = defineCommand({ + type: "server.install_modpack.status", + sensitive: false, + minRole: "viewer", + body: serverInstallModpackStatusBodySchema +}); +var serverInstallModpackCancelCommand = defineCommand({ + type: "server.install_modpack.cancel", + sensitive: false, + minRole: "editor", + body: serverInstallModpackCancelBodySchema +}); +var MODPACK_COMMANDS = [ + serverInstallModpackCommand, + serverInstallModpackStatusCommand, + serverInstallModpackCancelCommand +]; +function registerModpackCommands(registry) { + return registry.registerAll(MODPACK_COMMANDS); +} + +// src/protocol/commands/pairing.ts +import { z as z10 } from "zod"; var agentRevocationsSetCommand = defineCommand({ type: "agent.revocations.set", sensitive: false, minRole: "admin", - body: z9.object({ + body: z10.object({ list: revocationListSchema }) }); @@ -1490,18 +1606,18 @@ function registerPairingCommands(registry) { } // src/protocol/commands/state.ts -import { z as z10 } from "zod"; +import { z as z11 } from "zod"; var SHA1_HEX_PATTERN = /^[0-9a-f]{40}$/i; var SHA512_HEX_PATTERN = /^[0-9a-f]{128}$/i; -var sha1HexSchema = z10.string().regex(SHA1_HEX_PATTERN, "Expected 40 hex characters").transform((v) => v.toLowerCase()); -var sha512HexSchema = z10.string().regex(SHA512_HEX_PATTERN, "Expected 128 hex characters").transform((v) => v.toLowerCase()); -var modSourceSchema = z10.enum(["modrinth", "curseforge", "tegra", "local"]); -var modLayerSchema = z10.enum(["origin", "user"]); +var sha1HexSchema = z11.string().regex(SHA1_HEX_PATTERN, "Expected 40 hex characters").transform((v) => v.toLowerCase()); +var sha512HexSchema = z11.string().regex(SHA512_HEX_PATTERN, "Expected 128 hex characters").transform((v) => v.toLowerCase()); +var modSourceSchema = z11.enum(["modrinth", "curseforge", "tegra", "local"]); +var modLayerSchema = z11.enum(["origin", "user"]); var MOD_UNSAFE_UNICODE_REGEX = /(?:\p{Cc}|\p{Cf}|\u034F|\u180E|\u2028|\u2029|\u3164|\uFFA0)/u; var MOD_ENCODED_TRAVERSAL_REGEX = /%(?:2f|5c|00)/i; var MOD_RESERVED_WINDOWS_REGEX = /^(?:CON|PRN|AUX|NUL|COM[1-9¹²³]|LPT[1-9¹²³]|CONIN\$|CONOUT\$|CLOCK\$)\s*(?:\.|$)/i; var MOD_FORBIDDEN_NAMES = new Set([".runtime", ".tegrad-uploads"]); -var modFileNameSchema = z10.string().min(1).max(255).refine((name) => { +var modFileNameSchema = z11.string().min(1).max(255).refine((name) => { if (name.includes("/") || name.includes("\\") || name.includes("\x00") || name.includes(":") || name === "." || name === ".." || name.endsWith(".") || name.endsWith(" ")) { return false; } @@ -1517,101 +1633,102 @@ var modFileNameSchema = z10.string().min(1).max(255).refine((name) => { } return new TextEncoder().encode(name).byteLength <= 255; }, { message: "Mod filename must be a single safe filename" }); -var serverModEntrySchema = z10.object({ +var serverModEntrySchema = z11.object({ file: modFileNameSchema, source: modSourceSchema, - project_id: z10.string().min(1).max(128).optional(), - version_id: z10.string().min(1).max(128).optional(), + project_id: z11.string().min(1).max(128).optional(), + version_id: z11.string().min(1).max(128).optional(), sha1: sha1HexSchema.optional(), sha256: sha256HexSchema.optional(), sha512: sha512HexSchema.optional(), layer: modLayerSchema }).strict(); -var serverOriginSchema = z10.discriminatedUnion("kind", [ - z10.object({ - kind: z10.literal("modpack"), +var serverOriginSchema = z11.discriminatedUnion("kind", [ + z11.object({ + kind: z11.literal("modpack"), source: modSourceSchema, - modpack_id: z10.string().min(1).max(128), - version_id: z10.string().min(1).max(128) + modpack_id: z11.string().min(1).max(128), + version_id: z11.string().min(1).max(128), + modpack_name: z11.string().min(1).max(256).optional() }).strict(), - z10.object({ - kind: z10.literal("local"), - note: z10.string().max(512).optional() + z11.object({ + kind: z11.literal("local"), + note: z11.string().max(512).optional() }).strict() ]).nullable(); -var serverOriginSyncStateSchema = z10.object({ - excluded_mod_keys: z10.array(z10.string().min(1).max(256)).max(4000), - synced_mod_keys: z10.array(z10.string().min(1).max(256)).max(4000), - removed_origin_files: z10.array(z10.string().min(1).max(1024)).max(5000).optional(), - synced_files: z10.array(z10.string().min(1).max(1024)).max(5000).optional(), - last_synced_at: z10.string().nullable().optional(), - last_synced_version_id: z10.string().min(1).max(128).nullable().optional() +var serverOriginSyncStateSchema = z11.object({ + excluded_mod_keys: z11.array(z11.string().min(1).max(256)).max(4000), + synced_mod_keys: z11.array(z11.string().min(1).max(256)).max(4000), + removed_origin_files: z11.array(z11.string().min(1).max(1024)).max(5000).optional(), + synced_files: z11.array(z11.string().min(1).max(1024)).max(5000).optional(), + last_synced_at: z11.string().nullable().optional(), + last_synced_version_id: z11.string().min(1).max(128).nullable().optional() }).strict(); -var modEnvironmentInfoSchema = z10.object({ - client: z10.enum(["required", "optional", "unsupported", "unknown"]).optional(), - server: z10.enum(["required", "optional", "unsupported", "unknown"]).optional() +var modEnvironmentInfoSchema = z11.object({ + client: z11.enum(["required", "optional", "unsupported", "unknown"]).optional(), + server: z11.enum(["required", "optional", "unsupported", "unknown"]).optional() }).strict(); -var originPlanModInputSchema = z10.object({ - key: z10.string().min(1).max(256), +var originPlanModInputSchema = z11.object({ + key: z11.string().min(1).max(256), file: modFileNameSchema, - name: z10.string().min(1).max(256).optional(), - enabled: z10.boolean().optional(), + name: z11.string().min(1).max(256).optional(), + enabled: z11.boolean().optional(), source: modSourceSchema.optional(), - project_id: z10.string().min(1).max(128).optional(), - version_id: z10.string().min(1).max(128).optional(), - url: z10.string().url().max(2048).optional(), + project_id: z11.string().min(1).max(128).optional(), + version_id: z11.string().min(1).max(128).optional(), + url: z11.string().url().max(2048).optional(), sha1: sha1HexSchema.optional(), sha256: sha256HexSchema.optional(), sha512: sha512HexSchema.optional(), environment: modEnvironmentInfoSchema.optional() }).strict(); -var originPlanFileInputSchema = z10.object({ - path: z10.string().min(1).max(1024), +var originPlanFileInputSchema = z11.object({ + path: z11.string().min(1).max(1024), sha1: sha1HexSchema, sha256: sha256HexSchema.optional(), - size_bytes: z10.number().int().nonnegative(), - url: z10.string().url().max(2048).optional(), - content_base64: z10.string().optional() + size_bytes: z11.number().int().nonnegative(), + url: z11.string().url().max(2048).optional(), + content_base64: z11.string().optional() }).strict(); -var serverModsListBodySchema = z10.object({ +var serverModsListBodySchema = z11.object({ server_id: serverIdSchema }).strict(); -var serverModsInstallBodySchema = z10.object({ +var serverModsInstallBodySchema = z11.object({ server_id: serverIdSchema, file: modFileNameSchema, - url: z10.string().url().max(2048), + url: z11.string().url().max(2048), source: modSourceSchema, - project_id: z10.string().min(1).max(128).optional(), - version_id: z10.string().min(1).max(128).optional(), + project_id: z11.string().min(1).max(128).optional(), + version_id: z11.string().min(1).max(128).optional(), sha1: sha1HexSchema.optional(), sha256: sha256HexSchema.optional(), sha512: sha512HexSchema.optional() }).strict(); -var serverModsRemoveBodySchema = z10.object({ +var serverModsRemoveBodySchema = z11.object({ server_id: serverIdSchema, file: modFileNameSchema }).strict(); -var serverOriginPlanBodySchema = z10.object({ +var serverOriginPlanBodySchema = z11.object({ server_id: serverIdSchema, - to_version_id: z10.string().min(1).max(128), + to_version_id: z11.string().min(1).max(128), source: modSourceSchema.optional(), - modpack_id: z10.string().min(1).max(128).optional(), - minecraft_version: z10.string().min(1).max(64).optional(), + modpack_id: z11.string().min(1).max(128).optional(), + minecraft_version: z11.string().min(1).max(64).optional(), loader: serverLoaderSchema.optional(), - loader_version: z10.string().min(1).max(64).nullable().optional(), - mods: z10.array(originPlanModInputSchema).max(2000), - files: z10.array(originPlanFileInputSchema).max(5000).optional() + loader_version: z11.string().min(1).max(64).nullable().optional(), + mods: z11.array(originPlanModInputSchema).max(2000), + files: z11.array(originPlanFileInputSchema).max(5000).optional() }).strict(); -var serverOriginApplyBodySchema = z10.object({ +var serverOriginApplyBodySchema = z11.object({ server_id: serverIdSchema, - plan_id: z10.string().min(1).max(128), - selected_mod_keys: z10.array(z10.string().min(1).max(256)).max(2000).optional(), - selected_file_paths: z10.array(z10.string().min(1).max(1024)).max(5000).optional() + plan_id: z11.string().min(1).max(128), + selected_mod_keys: z11.array(z11.string().min(1).max(256)).max(2000).optional(), + selected_file_paths: z11.array(z11.string().min(1).max(1024)).max(5000).optional() }).strict(); -var serverOriginUnlinkBodySchema = z10.object({ +var serverOriginUnlinkBodySchema = z11.object({ server_id: serverIdSchema }).strict(); -var blobKeySchema = z10.string().regex(/^[A-Za-z0-9_-]{43}$/, "Expected a 32-byte key in base64url"); +var blobKeySchema = z11.string().regex(/^[A-Za-z0-9_-]{43}$/, "Expected a 32-byte key in base64url"); var WORLD_NAME_REGEX = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$/; var RESERVED_WORLD_NAMES = new Set([ "mods", @@ -1627,19 +1744,19 @@ var RESERVED_WORLD_NAMES = new Set([ "kubejs", "scripts" ]); -var worldNameSchema = z10.string().regex(WORLD_NAME_REGEX, "Invalid world name").refine((name) => !name.includes("..") && !RESERVED_WORLD_NAMES.has(name.toLowerCase()), { +var worldNameSchema = z11.string().regex(WORLD_NAME_REGEX, "Invalid world name").refine((name) => !name.includes("..") && !RESERVED_WORLD_NAMES.has(name.toLowerCase()), { message: "Reserved or unsafe world name" }); -var serverWorldImportBodySchema = z10.object({ +var serverWorldImportBodySchema = z11.object({ server_id: serverIdSchema, world_name: worldNameSchema, - url: z10.string().url().max(2048), + url: z11.string().url().max(2048), sha256: sha256HexSchema, key: blobKeySchema }).strict(); -var serverDeployServerpackBodySchema = z10.object({ +var serverDeployServerpackBodySchema = z11.object({ server_id: serverIdSchema, - url: z10.string().url().max(2048), + url: z11.string().url().max(2048), sha256: sha256HexSchema.optional(), sha512: sha512HexSchema.optional(), sha1: sha1HexSchema.optional(), @@ -1709,12 +1826,12 @@ function registerStateCommands(registry) { } // src/protocol/commands/tunnel.ts -import { z as z11 } from "zod"; +import { z as z12 } from "zod"; var PLAYIT_SECRET_KEY_REGEX = /^[0-9a-fA-F]{16,256}$/; -var playitSecretKeySchema = z11.string().trim().regex(PLAYIT_SECRET_KEY_REGEX, "secret_key must be a 16-256 character hexadecimal string").refine((value) => value.length % 2 === 0, { +var playitSecretKeySchema = z12.string().trim().regex(PLAYIT_SECRET_KEY_REGEX, "secret_key must be a 16-256 character hexadecimal string").refine((value) => value.length % 2 === 0, { message: "secret_key must have an even number of hexadecimal characters" }); -var tunnelPlayitSetKeyBodySchema = z11.object({ +var tunnelPlayitSetKeyBodySchema = z12.object({ secret_key: playitSecretKeySchema }).strict(); var tunnelPlayitSetKeyCommand = defineCommand({ @@ -1727,19 +1844,19 @@ var tunnelPlayitStartCommand = defineCommand({ type: "tunnel.playit.start", sensitive: false, minRole: "admin", - body: z11.object({}).strict() + body: z12.object({}).strict() }); var tunnelPlayitStopCommand = defineCommand({ type: "tunnel.playit.stop", sensitive: false, minRole: "admin", - body: z11.object({}).strict() + body: z12.object({}).strict() }); var tunnelPlayitStatusCommand = defineCommand({ type: "tunnel.playit.status", sensitive: false, minRole: "viewer", - body: z11.object({}).strict() + body: z12.object({}).strict() }); var TUNNEL_COMMANDS = [ tunnelPlayitSetKeyCommand, @@ -1752,17 +1869,17 @@ function registerTunnelCommands(registry) { } // src/protocol/commands/core.ts -var serverIdBodySchema = z12.object({ - server_id: z12.string().min(1) +var serverIdBodySchema = z13.object({ + server_id: z13.string().min(1) }); -var strictServerDeleteBodySchema = z12.object({ +var strictServerDeleteBodySchema = z13.object({ server_id: serverIdSchema }).strict(); var agentPingCommand = defineCommand({ type: "agent.ping", sensitive: false, minRole: "viewer", - body: z12.object({}).strict() + body: z13.object({}).strict() }); var serverStartCommand = defineCommand({ type: "server.start", @@ -1792,24 +1909,24 @@ function registerCoreCommands(registry) { return registry.registerAll(CORE_COMMANDS); } function createCoreRegistry() { - return registerHostCommands(registerAgentCommands(registerTunnelCommands(registerBackupCommands(registerStateCommands(registerServerCommands(registerFilesCommands(registerPairingCommands(registerCoreCommands(new CommandRegistry))))))))); + return registerModpackCommands(registerHostCommands(registerAgentCommands(registerTunnelCommands(registerBackupCommands(registerStateCommands(registerServerCommands(registerFilesCommands(registerPairingCommands(registerCoreCommands(new CommandRegistry)))))))))); } // src/protocol/pairing.ts -import { z as z13 } from "zod"; +import { z as z14 } from "zod"; var PAIRING_CODE_LENGTH = 10; var PAIRING_SECRET_BYTES = 16; var DEFAULT_TRUST_GRANT_TTL_MS = 10 * 60 * 1000; var MAX_TRUST_GRANT_TTL_MS = 15 * 60 * 1000; var CROCKFORD_ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"; var PAIRING_CODE_REGEX = /^[0-9A-HJKMNP-TV-Z]{10}$/; -var pairingCodeSchema = z13.string().regex(PAIRING_CODE_REGEX, "Invalid pairing code"); -var trustGrantSchema = z13.object({ - v: z13.literal(PROTOCOL_VERSION), - kind: z13.literal("agent-pairing"), +var pairingCodeSchema = z14.string().regex(PAIRING_CODE_REGEX, "Invalid pairing code"); +var trustGrantSchema = z14.object({ + v: z14.literal(PROTOCOL_VERSION), + kind: z14.literal("agent-pairing"), account_key: base64UrlSchema, agent: keyIdSchema, - issued_at: z13.number().int().nonnegative(), - expires_at: z13.number().int().nonnegative(), + issued_at: z14.number().int().nonnegative(), + expires_at: z14.number().int().nonnegative(), proof: base64UrlSchema.optional(), sig: base64UrlSchema }); @@ -2123,4 +2240,4 @@ function createInMemoryTrustContext(options) { } }; } -export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, minecraftVersionSchema, loaderVersionSchema, serverCreateBodySchema, serverChangeRuntimeBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverStatsBodySchema, serverStatsResultSchema, serverCreateCommand, serverChangeRuntimeCommand, serverRestartCommand, serverStatusCommand, serverStatsCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, BACKUP_UPLOAD_STATES, backupUploadStateSchema, serverBackupUploadEventSchema, pendingBackupUploadSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, hostInfoBodySchema, hostInfoResultSchema, hostInfoCommand, HOST_COMMANDS, registerHostCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; +export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, minecraftVersionSchema, loaderVersionSchema, serverCreateBodySchema, serverChangeRuntimeBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverStatsBodySchema, serverStatsResultSchema, serverCreateCommand, serverChangeRuntimeCommand, serverRestartCommand, serverStatusCommand, serverStatsCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, BACKUP_UPLOAD_STATES, backupUploadStateSchema, serverBackupUploadEventSchema, pendingBackupUploadSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, hostInfoBodySchema, hostInfoResultSchema, hostInfoCommand, HOST_COMMANDS, registerHostCommands, MODPACK_SOURCES, modpackSourceSchema, MODPACK_INSTALL_PHASES, modpackInstallPhaseSchema, MODPACK_INSTALL_JOB_STATES, modpackInstallJobStateSchema, MODPACK_INSTALL_ERROR_CODES, modpackInstallErrorCodeSchema, modpackInstallSkippedItemSchema, serverInstallModpackBodySchema, serverInstallModpackStatusBodySchema, serverInstallModpackCancelBodySchema, serverInstallModpackAcceptedEventSchema, serverInstallModpackProgressEventSchema, serverInstallModpackResultEventSchema, modpackInstallJobStatusSchema, serverInstallModpackStatusResultSchema, serverInstallModpackCommand, serverInstallModpackStatusCommand, serverInstallModpackCancelCommand, MODPACK_COMMANDS, registerModpackCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; diff --git a/lib/protocol/index.js b/lib/protocol/index.js index 5d7d458..03099ca 100644 --- a/lib/protocol/index.js +++ b/lib/protocol/index.js @@ -42,6 +42,11 @@ import { MIN_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MIN_SERVER_MEMORY_MB, + MODPACK_COMMANDS, + MODPACK_INSTALL_ERROR_CODES, + MODPACK_INSTALL_JOB_STATES, + MODPACK_INSTALL_PHASES, + MODPACK_SOURCES, PAIRING_CODE_LENGTH, PAIRING_COMMANDS, PAIRING_SECRET_BYTES, @@ -128,6 +133,12 @@ import { modFileNameSchema, modLayerSchema, modSourceSchema, + modpackInstallErrorCodeSchema, + modpackInstallJobStateSchema, + modpackInstallJobStatusSchema, + modpackInstallPhaseSchema, + modpackInstallSkippedItemSchema, + modpackSourceSchema, openAgentEvent, openAgentMessage, openCommand, @@ -142,6 +153,7 @@ import { registerCoreCommands, registerFilesCommands, registerHostCommands, + registerModpackCommands, registerPairingCommands, registerServerCommands, registerStateCommands, @@ -179,6 +191,16 @@ import { serverDeployServerpackBodySchema, serverDeployServerpackCommand, serverIdSchema, + serverInstallModpackAcceptedEventSchema, + serverInstallModpackBodySchema, + serverInstallModpackCancelBodySchema, + serverInstallModpackCancelCommand, + serverInstallModpackCommand, + serverInstallModpackProgressEventSchema, + serverInstallModpackResultEventSchema, + serverInstallModpackStatusBodySchema, + serverInstallModpackStatusCommand, + serverInstallModpackStatusResultSchema, serverListCommand, serverLoaderSchema, serverMemoryMbSchema, @@ -244,7 +266,7 @@ import { verifyTrustGrant, worldNameSchema, wrapEventBody -} from "../chunks/index-d84531yv.js"; +} from "../chunks/index-7gzwrqzw.js"; import"../chunks/index-g1frygvt.js"; export { wrapEventBody, @@ -312,6 +334,16 @@ export { serverMemoryMbSchema, serverLoaderSchema, serverListCommand, + serverInstallModpackStatusResultSchema, + serverInstallModpackStatusCommand, + serverInstallModpackStatusBodySchema, + serverInstallModpackResultEventSchema, + serverInstallModpackProgressEventSchema, + serverInstallModpackCommand, + serverInstallModpackCancelCommand, + serverInstallModpackCancelBodySchema, + serverInstallModpackBodySchema, + serverInstallModpackAcceptedEventSchema, serverIdSchema, serverDeployServerpackCommand, serverDeployServerpackBodySchema, @@ -349,6 +381,7 @@ export { registerStateCommands, registerServerCommands, registerPairingCommands, + registerModpackCommands, registerHostCommands, registerFilesCommands, registerCoreCommands, @@ -363,6 +396,12 @@ export { openCommand, openAgentMessage, openAgentEvent, + modpackSourceSchema, + modpackInstallSkippedItemSchema, + modpackInstallPhaseSchema, + modpackInstallJobStatusSchema, + modpackInstallJobStateSchema, + modpackInstallErrorCodeSchema, modSourceSchema, modLayerSchema, modFileNameSchema, @@ -449,6 +488,11 @@ export { PAIRING_SECRET_BYTES, PAIRING_COMMANDS, PAIRING_CODE_LENGTH, + MODPACK_SOURCES, + MODPACK_INSTALL_PHASES, + MODPACK_INSTALL_JOB_STATES, + MODPACK_INSTALL_ERROR_CODES, + MODPACK_COMMANDS, MIN_SERVER_MEMORY_MB, MIN_BACKUP_RETENTION_COUNT, MIN_BACKUP_INTERVAL_MINUTES, diff --git a/lib/types/protocol/commands/agent.d.ts b/lib/types/protocol/commands/agent.d.ts index a489a93..c42bd8c 100644 --- a/lib/types/protocol/commands/agent.d.ts +++ b/lib/types/protocol/commands/agent.d.ts @@ -1,8 +1,9 @@ import { z } from "zod"; import { type CommandRegistry } from "../registry"; -export declare const SUBSCRIPTION_TOPICS: readonly ["server.status", "server.backup"]; +export declare const SUBSCRIPTION_TOPICS: readonly ["server.status", "server.backup", "server.modpack"]; export declare const subscriptionTopicSchema: z.ZodEnum<{ "server.backup": "server.backup"; + "server.modpack": "server.modpack"; "server.status": "server.status"; }>; export type SubscriptionTopic = z.infer; @@ -30,6 +31,7 @@ export type ServerStatusChanged = z.infer; export declare const agentSubscribeBodySchema: z.ZodObject<{ topics: z.ZodArray>; }, z.core.$strict>; @@ -59,10 +61,10 @@ export declare const agentMembersRevokeBodySchema: z.ZodObject<{ }, z.core.$strict>; export type AgentMembersRevokeBody = z.infer; export declare const agentSubscribeCommand: import("..").CommandDefinition<"agent.subscribe", { - topics: ("server.backup" | "server.status")[]; + topics: ("server.backup" | "server.modpack" | "server.status")[]; }>; export declare const agentUnsubscribeCommand: import("..").CommandDefinition<"agent.unsubscribe", { - topics: ("server.backup" | "server.status")[]; + topics: ("server.backup" | "server.modpack" | "server.status")[]; }>; export declare const agentMembersSetCommand: import("..").CommandDefinition<"agent.members.set", { grant: { @@ -82,9 +84,9 @@ export declare const agentMembersRevokeCommand: import("..").CommandDefinition<" servers?: string[] | undefined; }>; export declare const AGENT_COMMANDS: readonly [import("..").CommandDefinition<"agent.subscribe", { - topics: ("server.backup" | "server.status")[]; + topics: ("server.backup" | "server.modpack" | "server.status")[]; }>, import("..").CommandDefinition<"agent.unsubscribe", { - topics: ("server.backup" | "server.status")[]; + topics: ("server.backup" | "server.modpack" | "server.status")[]; }>, import("..").CommandDefinition<"agent.members.set", { grant: { v: 1; diff --git a/lib/types/protocol/commands/modpack.d.ts b/lib/types/protocol/commands/modpack.d.ts new file mode 100644 index 0000000..eb6c9f1 --- /dev/null +++ b/lib/types/protocol/commands/modpack.d.ts @@ -0,0 +1,238 @@ +import { z } from "zod"; +import { type CommandRegistry } from "../registry"; +export declare const MODPACK_SOURCES: readonly ["tegra", "modrinth", "curseforge"]; +export declare const modpackSourceSchema: z.ZodEnum<{ + curseforge: "curseforge"; + modrinth: "modrinth"; + tegra: "tegra"; +}>; +export type ModpackSource = z.infer; +export declare const MODPACK_INSTALL_PHASES: readonly ["resolving", "downloading", "extracting", "overrides", "finalizing"]; +export declare const modpackInstallPhaseSchema: z.ZodEnum<{ + downloading: "downloading"; + extracting: "extracting"; + finalizing: "finalizing"; + overrides: "overrides"; + resolving: "resolving"; +}>; +export type ModpackInstallPhase = z.infer; +export declare const MODPACK_INSTALL_JOB_STATES: readonly ["running", "completed", "failed", "cancelled"]; +export declare const modpackInstallJobStateSchema: z.ZodEnum<{ + cancelled: "cancelled"; + completed: "completed"; + failed: "failed"; + running: "running"; +}>; +export type ModpackInstallJobState = z.infer; +export declare const MODPACK_INSTALL_ERROR_CODES: readonly ["pack_unavailable", "host_not_allowed", "hash_mismatch", "too_large", "install_in_progress", "server_running", "api_unavailable", "io_error", "cancelled"]; +export declare const modpackInstallErrorCodeSchema: z.ZodEnum<{ + api_unavailable: "api_unavailable"; + cancelled: "cancelled"; + hash_mismatch: "hash_mismatch"; + host_not_allowed: "host_not_allowed"; + install_in_progress: "install_in_progress"; + io_error: "io_error"; + pack_unavailable: "pack_unavailable"; + server_running: "server_running"; + too_large: "too_large"; +}>; +export type ModpackInstallErrorCode = z.infer; +export declare const modpackInstallSkippedItemSchema: z.ZodObject<{ + name: z.ZodString; + reason: z.ZodString; +}, z.core.$strict>; +export type ModpackInstallSkippedItem = z.infer; +export declare const serverInstallModpackBodySchema: z.ZodObject<{ + server_id: z.ZodString; + source: z.ZodEnum<{ + curseforge: "curseforge"; + modrinth: "modrinth"; + tegra: "tegra"; + }>; + modpack_id: z.ZodString; + version_id: z.ZodString; + modpack_name: z.ZodOptional; + version_label: z.ZodOptional; +}, z.core.$strict>; +export type ServerInstallModpackBody = z.infer; +export declare const serverInstallModpackStatusBodySchema: z.ZodObject<{ + server_id: z.ZodString; +}, z.core.$strict>; +export type ServerInstallModpackStatusBody = z.infer; +export declare const serverInstallModpackCancelBodySchema: z.ZodObject<{ + server_id: z.ZodString; + job_id: z.ZodOptional; +}, z.core.$strict>; +export type ServerInstallModpackCancelBody = z.infer; +export declare const serverInstallModpackAcceptedEventSchema: z.ZodObject<{ + job_id: z.ZodString; + server_id: z.ZodString; +}, z.core.$strict>; +export type ServerInstallModpackAcceptedEvent = z.infer; +export declare const serverInstallModpackProgressEventSchema: z.ZodObject<{ + job_id: z.ZodString; + server_id: z.ZodString; + phase: z.ZodEnum<{ + downloading: "downloading"; + extracting: "extracting"; + finalizing: "finalizing"; + overrides: "overrides"; + resolving: "resolving"; + }>; + done: z.ZodNumber; + total: z.ZodNumber; + current: z.ZodOptional; +}, z.core.$strict>; +export type ServerInstallModpackProgressEvent = z.infer; +export declare const serverInstallModpackResultEventSchema: z.ZodObject<{ + job_id: z.ZodString; + server_id: z.ZodString; + ok: z.ZodBoolean; + installed: z.ZodNumber; + skipped: z.ZodArray>; + error_code: z.ZodOptional>; +}, z.core.$strict>; +export type ServerInstallModpackResultEvent = z.infer; +export declare const modpackInstallJobStatusSchema: z.ZodObject<{ + job_id: z.ZodString; + server_id: z.ZodString; + source: z.ZodEnum<{ + curseforge: "curseforge"; + modrinth: "modrinth"; + tegra: "tegra"; + }>; + modpack_id: z.ZodString; + version_id: z.ZodString; + modpack_name: z.ZodOptional; + version_label: z.ZodOptional; + status: z.ZodEnum<{ + cancelled: "cancelled"; + completed: "completed"; + failed: "failed"; + running: "running"; + }>; + phase: z.ZodEnum<{ + downloading: "downloading"; + extracting: "extracting"; + finalizing: "finalizing"; + overrides: "overrides"; + resolving: "resolving"; + }>; + done: z.ZodNumber; + total: z.ZodNumber; + current: z.ZodOptional; + installed: z.ZodNumber; + skipped: z.ZodArray>; + error_code: z.ZodOptional>; + started_at: z.ZodNumber; + updated_at: z.ZodNumber; + finished_at: z.ZodOptional; +}, z.core.$strict>; +export type ModpackInstallJobStatus = z.infer; +export declare const serverInstallModpackStatusResultSchema: z.ZodObject<{ + server_id: z.ZodString; + job: z.ZodNullable; + modpack_id: z.ZodString; + version_id: z.ZodString; + modpack_name: z.ZodOptional; + version_label: z.ZodOptional; + status: z.ZodEnum<{ + cancelled: "cancelled"; + completed: "completed"; + failed: "failed"; + running: "running"; + }>; + phase: z.ZodEnum<{ + downloading: "downloading"; + extracting: "extracting"; + finalizing: "finalizing"; + overrides: "overrides"; + resolving: "resolving"; + }>; + done: z.ZodNumber; + total: z.ZodNumber; + current: z.ZodOptional; + installed: z.ZodNumber; + skipped: z.ZodArray>; + error_code: z.ZodOptional>; + started_at: z.ZodNumber; + updated_at: z.ZodNumber; + finished_at: z.ZodOptional; + }, z.core.$strict>>; +}, z.core.$strict>; +export type ServerInstallModpackStatusResult = z.infer; +export declare const serverInstallModpackCommand: import("..").CommandDefinition<"server.install_modpack", { + server_id: string; + source: "curseforge" | "modrinth" | "tegra"; + modpack_id: string; + version_id: string; + modpack_name?: string | undefined; + version_label?: string | undefined; +}>; +export declare const serverInstallModpackStatusCommand: import("..").CommandDefinition<"server.install_modpack.status", { + server_id: string; +}>; +export declare const serverInstallModpackCancelCommand: import("..").CommandDefinition<"server.install_modpack.cancel", { + server_id: string; + job_id?: string | undefined; +}>; +export declare const MODPACK_COMMANDS: readonly [import("..").CommandDefinition<"server.install_modpack", { + server_id: string; + source: "curseforge" | "modrinth" | "tegra"; + modpack_id: string; + version_id: string; + modpack_name?: string | undefined; + version_label?: string | undefined; +}>, import("..").CommandDefinition<"server.install_modpack.status", { + server_id: string; +}>, import("..").CommandDefinition<"server.install_modpack.cancel", { + server_id: string; + job_id?: string | undefined; +}>]; +export declare function registerModpackCommands(registry: CommandRegistry): CommandRegistry; diff --git a/lib/types/protocol/commands/state.d.ts b/lib/types/protocol/commands/state.d.ts index 4b58f29..0110c49 100644 --- a/lib/types/protocol/commands/state.d.ts +++ b/lib/types/protocol/commands/state.d.ts @@ -46,6 +46,7 @@ export declare const serverOriginSchema: z.ZodNullable; modpack_id: z.ZodString; version_id: z.ZodString; + modpack_name: z.ZodOptional; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"local">; note: z.ZodOptional; @@ -239,6 +240,7 @@ export declare const serverDeployServerpackBodySchema: z.ZodObject<{ }>; modpack_id: z.ZodString; version_id: z.ZodString; + modpack_name: z.ZodOptional; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"local">; note: z.ZodOptional; @@ -324,6 +326,7 @@ export declare const serverDeployServerpackCommand: import("..").CommandDefiniti source: "curseforge" | "local" | "modrinth" | "tegra"; modpack_id: string; version_id: string; + modpack_name?: string | undefined; } | { kind: "local"; note?: string | undefined; @@ -403,6 +406,7 @@ export declare const STATE_COMMANDS: readonly [import("..").CommandDefinition<"s source: "curseforge" | "local" | "modrinth" | "tegra"; modpack_id: string; version_id: string; + modpack_name?: string | undefined; } | { kind: "local"; note?: string | undefined; diff --git a/lib/types/protocol/errors.d.ts b/lib/types/protocol/errors.d.ts index 5348908..fc61943 100644 --- a/lib/types/protocol/errors.d.ts +++ b/lib/types/protocol/errors.d.ts @@ -1,4 +1,4 @@ -export type ProtocolErrorCode = "invalid_format" | "unsupported_version" | "wrong_agent" | "wrong_recipient" | "expired" | "not_yet_valid" | "ttl_too_long" | "untrusted_signer" | "bad_signature" | "session_invalid" | "session_revoked" | "replayed" | "unknown_command" | "invalid_body" | "sensitive_requires_account_key" | "decrypt_failed" | "insufficient_role" | "too_many_subscribers" | "role_grant_invalid" | "auth_invalid" | "request_invalid" | "grant_invalid" | "grant_wrong_agent" | "grant_expired" | "grant_bad_signature" | "grant_proof_required" | "grant_bad_proof" | "revocation_stale" | "revocation_not_superset" | "insufficient_memory" | "eula_not_accepted" | "server_not_found" | "server_already_exists" | "server_running" | "server_stopped" | "invalid_jvm_args" | "download_failed" | "hash_mismatch" | "systemd_error" | "perms_unavailable" | "origin_locked" | "plan_not_found" | "plan_expired" | "plan_stale" | "mod_not_found" | "mod_already_exists" | "backup_not_found" | "backup_failed" | "backup_config_invalid" | "tunnel_not_configured" | "tunnel_already_running" | "tunnel_not_running" | "tunnel_failed"; +export type ProtocolErrorCode = "invalid_format" | "unsupported_version" | "wrong_agent" | "wrong_recipient" | "expired" | "not_yet_valid" | "ttl_too_long" | "untrusted_signer" | "bad_signature" | "session_invalid" | "session_revoked" | "replayed" | "unknown_command" | "invalid_body" | "sensitive_requires_account_key" | "decrypt_failed" | "insufficient_role" | "too_many_subscribers" | "role_grant_invalid" | "auth_invalid" | "request_invalid" | "grant_invalid" | "grant_wrong_agent" | "grant_expired" | "grant_bad_signature" | "grant_proof_required" | "grant_bad_proof" | "revocation_stale" | "revocation_not_superset" | "insufficient_memory" | "eula_not_accepted" | "server_not_found" | "server_already_exists" | "server_running" | "server_stopped" | "invalid_jvm_args" | "download_failed" | "hash_mismatch" | "systemd_error" | "perms_unavailable" | "origin_locked" | "plan_not_found" | "plan_expired" | "plan_stale" | "mod_not_found" | "mod_already_exists" | "backup_not_found" | "backup_failed" | "backup_config_invalid" | "tunnel_not_configured" | "tunnel_already_running" | "tunnel_not_running" | "tunnel_failed" | "pack_unavailable" | "host_not_allowed" | "too_large" | "install_in_progress" | "api_unavailable" | "io_error" | "cancelled"; export declare class ProtocolError extends Error { readonly code: ProtocolErrorCode; constructor(code: ProtocolErrorCode, message: string); diff --git a/lib/types/protocol/index.d.ts b/lib/types/protocol/index.d.ts index 314a01d..6c9e9c5 100644 --- a/lib/types/protocol/index.d.ts +++ b/lib/types/protocol/index.d.ts @@ -6,6 +6,7 @@ export { BACKUP_COMMANDS, BACKUP_ID_REGEX, BACKUP_UPLOAD_STATES, type BackupDest export { agentPingCommand, CORE_COMMANDS, createCoreRegistry, registerCoreCommands, serverDeleteCommand, serverStartCommand, serverStopCommand, } from "./commands/core"; export { FILES_COMMANDS, fileEncodingSchema, filesCopyCommand, filesDeleteCommand, filesDownloadBeginCommand, filesDownloadCloseCommand, filesDownloadCommand, filesDownloadPartCommand, filesListCommand, filesMkdirCommand, filesReadCommand, filesRenameCommand, filesStatCommand, filesUnzipCommand, filesUploadAbortCommand, filesUploadBeginCommand, filesUploadCommitCommand, filesUploadPartCommand, filesWriteCommand, filesZipCommand, registerFilesCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, sha256HexSchema, } from "./commands/files"; export { HOST_COMMANDS, type HostInfoBody, type HostInfoResult, hostInfoBodySchema, hostInfoCommand, hostInfoResultSchema, registerHostCommands, } from "./commands/host"; +export { MODPACK_COMMANDS, MODPACK_INSTALL_ERROR_CODES, MODPACK_INSTALL_JOB_STATES, MODPACK_INSTALL_PHASES, MODPACK_SOURCES, type ModpackInstallErrorCode, type ModpackInstallJobState, type ModpackInstallJobStatus, type ModpackInstallPhase, type ModpackInstallSkippedItem, type ModpackSource, modpackInstallErrorCodeSchema, modpackInstallJobStateSchema, modpackInstallJobStatusSchema, modpackInstallPhaseSchema, modpackInstallSkippedItemSchema, modpackSourceSchema, registerModpackCommands, type ServerInstallModpackAcceptedEvent, type ServerInstallModpackBody, type ServerInstallModpackCancelBody, type ServerInstallModpackProgressEvent, type ServerInstallModpackResultEvent, type ServerInstallModpackStatusBody, type ServerInstallModpackStatusResult, serverInstallModpackAcceptedEventSchema, serverInstallModpackBodySchema, serverInstallModpackCancelBodySchema, serverInstallModpackCancelCommand, serverInstallModpackCommand, serverInstallModpackProgressEventSchema, serverInstallModpackResultEventSchema, serverInstallModpackStatusBodySchema, serverInstallModpackStatusCommand, serverInstallModpackStatusResultSchema, } from "./commands/modpack"; export { agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, } from "./commands/pairing"; export { consoleLineSchema, DEFAULT_SERVER_PORT, loaderVersionSchema, MAX_CONSOLE_LINE_LENGTH, MAX_JVM_ARGS, MAX_SERVER_MEMORY_MB, MIN_SERVER_MEMORY_MB, minecraftVersionSchema, registerServerCommands, SERVER_COMMANDS, SERVER_ID_REGEX, type ServerChangeRuntimeBody, type ServerConsoleSendBody, type ServerConsoleSubscribeBody, type ServerCreateBody, type ServerLoader, type ServerStatsBody, type ServerStatsResult, type ServerUpdateSettingsBody, serverChangeRuntimeBodySchema, serverChangeRuntimeCommand, serverConsoleSendBodySchema, serverConsoleSendCommand, serverConsoleSubscribeBodySchema, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, serverCreateBodySchema, serverCreateCommand, serverIdSchema, serverListCommand, serverLoaderSchema, serverMemoryMbSchema, serverPortSchema, serverRestartCommand, serverStatsBodySchema, serverStatsCommand, serverStatsResultSchema, serverStatusCommand, serverUpdateSettingsBodySchema, serverUpdateSettingsCommand, } from "./commands/server"; export { blobKeySchema, type ModEnvironmentInfo, type ModLayer, type ModSource, modEnvironmentInfoSchema, modFileNameSchema, modLayerSchema, modSourceSchema, type OriginPlanFileInput, type OriginPlanModInput, originPlanFileInputSchema, originPlanModInputSchema, RESERVED_WORLD_NAMES, registerStateCommands, type ServerDeployServerpackBody, type ServerModEntry, type ServerModsInstallBody, type ServerModsListBody, type ServerModsRemoveBody, type ServerOrigin, type ServerOriginApplyBody, type ServerOriginPlanBody, type ServerOriginSyncState, type ServerOriginUnlinkBody, type ServerWorldImportBody, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, STATE_COMMANDS, serverDeployServerpackBodySchema, serverDeployServerpackCommand, serverModEntrySchema, serverModsInstallBodySchema, serverModsInstallCommand, serverModsListBodySchema, serverModsListCommand, serverModsRemoveBodySchema, serverModsRemoveCommand, serverOriginApplyBodySchema, serverOriginApplyCommand, serverOriginPlanBodySchema, serverOriginPlanCommand, serverOriginSchema, serverOriginSyncStateSchema, serverOriginUnlinkBodySchema, serverOriginUnlinkCommand, serverWorldImportBodySchema, serverWorldImportCommand, sha1HexSchema, sha512HexSchema, WORLD_NAME_REGEX, worldNameSchema, } from "./commands/state"; diff --git a/lib/vault/index.js b/lib/vault/index.js index df6074a..31e6bdf 100644 --- a/lib/vault/index.js +++ b/lib/vault/index.js @@ -5,7 +5,7 @@ import { sessionCertificateSchema, signRevocationList, signSessionCertificate -} from "../chunks/index-d84531yv.js"; +} from "../chunks/index-7gzwrqzw.js"; import { KDF_ALG_ARGON2ID13, KDF_MODERATE, diff --git a/scripts/smoke-lib.ts b/scripts/smoke-lib.ts index a6a587f..38a4fe8 100644 --- a/scripts/smoke-lib.ts +++ b/scripts/smoke-lib.ts @@ -10,6 +10,9 @@ import { PROTOCOL_VERSION, serverBackupUploadEventSchema, serverChangeRuntimeBodySchema, + serverInstallModpackBodySchema, + serverInstallModpackProgressEventSchema, + serverInstallModpackResultEventSchema, serverStatsResultSchema, subscriptionTopicSchema, } from "tegrad/protocol"; @@ -84,4 +87,34 @@ if ( process.stderr.write("lib smoke test failed: server.backup\n"); process.exit(1); } +if ( + createCoreRegistry().get("server.install_modpack") === undefined || + createCoreRegistry().get("server.install_modpack.status") === undefined || + createCoreRegistry().get("server.install_modpack.cancel") === undefined || + !subscriptionTopicSchema.safeParse("server.modpack").success || + !serverInstallModpackBodySchema.safeParse({ + server_id: "survival", + source: "curseforge", + modpack_id: "12345", + version_id: "67890", + }).success || + !serverInstallModpackProgressEventSchema.safeParse({ + job_id: "mpi-1", + server_id: "survival", + phase: "downloading", + done: 1, + total: 10, + current: "jei.jar", + }).success || + !serverInstallModpackResultEventSchema.safeParse({ + job_id: "mpi-1", + server_id: "survival", + ok: true, + installed: 10, + skipped: [], + }).success +) { + process.stderr.write("lib smoke test failed: server.install_modpack\n"); + process.exit(1); +} process.stdout.write("lib smoke test ok\n"); diff --git a/src/agent/api-client.ts b/src/agent/api-client.ts index 532b426..faf5432 100644 --- a/src/agent/api-client.ts +++ b/src/agent/api-client.ts @@ -3,11 +3,13 @@ import { z } from "zod"; import type { SigningKeyPair } from "../crypto"; -import { signAgentRequest } from "../protocol"; +import { type ModpackSource, modpackSourceSchema, signAgentRequest } from "../protocol"; import { validateApiUrl } from "./state"; export const AGENT_API_TIMEOUT_MS = 10_000; export const AGENT_API_MAX_RESPONSE_BYTES = 64 * 1024; +export const AGENT_API_MODPACK_RESOLVE_TIMEOUT_MS = 30_000; +export const AGENT_API_MODPACK_RESOLVE_MAX_BYTES = 4 * 1024 * 1024; /** Path prefix of the control API, appended to the configured `api_url`. */ export const AGENT_API_PREFIX = "/v1"; @@ -88,6 +90,60 @@ export interface BackupUploadConfirmResult { readonly status: "stored"; } +export interface ResolveModpackRequest { + readonly source: ModpackSource; + readonly modpack_id: string; + readonly version_id: string; +} + +export interface ResolvedModpackServerPack { + readonly url: string; + readonly sha1?: string | undefined; + readonly sha256?: string | undefined; + readonly sha512?: string | undefined; + readonly name: string; + readonly size?: number | undefined; +} + +export interface ResolvedModpackFileEnvironment { + readonly client?: "required" | "optional" | "unsupported" | "unknown" | undefined; + readonly server?: "required" | "optional" | "unsupported" | "unknown" | undefined; +} + +export interface ResolvedModpackFile { + readonly name: string; + readonly path?: string | undefined; + readonly url?: string | undefined; + readonly sha1?: string | undefined; + readonly sha256?: string | undefined; + readonly sha512?: string | undefined; + readonly size?: number | undefined; + readonly environment?: ResolvedModpackFileEnvironment | undefined; + readonly project_id?: string | undefined; + readonly version_id?: string | undefined; + readonly blocked?: boolean | undefined; + readonly blocked_reason?: string | undefined; +} + +export interface ResolvedModpackOverrides { + readonly url: string; + readonly sha1?: string | undefined; + readonly sha256?: string | undefined; + readonly sha512?: string | undefined; + readonly size?: number | undefined; + readonly prefix?: string | undefined; + readonly format?: "mrpack" | "zip" | undefined; +} + +export interface ResolvedModpack { + readonly server_pack?: ResolvedModpackServerPack | undefined; + readonly files: readonly ResolvedModpackFile[]; + readonly overrides?: ResolvedModpackOverrides | undefined; + readonly minecraft_version: string; + readonly loader: string; + readonly loader_version?: string | undefined; +} + export interface AgentApiClient { /** `POST /v1/agents/self/backup-upload-url`: where to `PUT` a backup of `size_bytes`. */ requestBackupUploadUrl( @@ -96,6 +152,8 @@ export interface AgentApiClient { ): Promise; /** `POST /v1/agents/self/backups/:id/confirm`: confirms a completed cloud backup upload. */ confirmBackupUpload(backupId: string, signal?: AbortSignal): Promise; + /** `POST /v1/agents/self/modpacks/resolve`: resolves modpack files and/or server pack URLs. */ + resolveModpack(request: ResolveModpackRequest, signal?: AbortSignal): Promise; } export interface AgentApiClientOptions { @@ -124,6 +182,58 @@ const backupUploadConfirmSchema = z.object({ status: z.literal("stored"), }); +const envSupportSchema = z.enum(["required", "optional", "unsupported", "unknown"]); + +const resolvedModpackSchema = z.object({ + server_pack: z + .object({ + url: z.string().min(1).max(2048), + sha1: z.string().optional(), + sha256: z.string().optional(), + sha512: z.string().optional(), + name: z.string().min(1).max(512), + size: z.number().int().nonnegative().optional(), + }) + .optional(), + files: z + .array( + z.object({ + name: z.string().min(1).max(512), + path: z.string().min(1).max(1024).optional(), + url: z.string().min(1).max(2048).optional(), + sha1: z.string().optional(), + sha256: z.string().optional(), + sha512: z.string().optional(), + size: z.number().int().nonnegative().optional(), + environment: z + .object({ + client: envSupportSchema.optional(), + server: envSupportSchema.optional(), + }) + .optional(), + project_id: z.string().min(1).max(128).optional(), + version_id: z.string().min(1).max(128).optional(), + blocked: z.boolean().optional(), + blocked_reason: z.string().min(1).max(128).optional(), + }), + ) + .default([]), + overrides: z + .object({ + url: z.string().min(1).max(2048), + sha1: z.string().optional(), + sha256: z.string().optional(), + sha512: z.string().optional(), + size: z.number().int().nonnegative().optional(), + prefix: z.string().min(1).max(256).optional(), + format: z.enum(["mrpack", "zip"]).optional(), + }) + .optional(), + minecraft_version: z.string().min(1).max(64), + loader: z.string().min(1).max(64), + loader_version: z.string().min(1).max(64).optional(), +}); + async function readBoundedText(response: Response, maxBytes: number): Promise { const declared = Number(response.headers.get("content-length")); if (Number.isFinite(declared) && declared > maxBytes) { @@ -182,6 +292,7 @@ export function createAgentApiClient(options: AgentApiClientOptions): AgentApiCl pathSuffix: string, body: string | undefined, externalSignal?: AbortSignal, + requestTimeoutMs: number = timeoutMs, ): Promise { if (externalSignal?.aborted) { throw new AgentApiError("aborted", "API request aborted"); @@ -200,7 +311,7 @@ export function createAgentApiClient(options: AgentApiClientOptions): AgentApiCl const timer = setTimeout(() => { timedOut = true; controller.abort(); - }, timeoutMs); + }, requestTimeoutMs); try { return await fetchFn(url, { @@ -224,9 +335,12 @@ export function createAgentApiClient(options: AgentApiClientOptions): AgentApiCl } } - async function parseBoundedJson(response: Response): Promise { + async function parseBoundedJson( + response: Response, + limitBytes: number = maxResponseBytes, + ): Promise { try { - return JSON.parse(await readBoundedText(response, maxResponseBytes)) as unknown; + return JSON.parse(await readBoundedText(response, limitBytes)) as unknown; } catch (err) { if (err instanceof AgentApiError) { throw err; @@ -320,5 +434,52 @@ export function createAgentApiClient(options: AgentApiClientOptions): AgentApiCl } return parsed.data; }, + + async resolveModpack( + request: ResolveModpackRequest, + signal?: AbortSignal, + ): Promise { + const sourceParsed = modpackSourceSchema.safeParse(request.source); + if ( + !sourceParsed.success || + request.modpack_id.trim().length === 0 || + request.version_id.trim().length === 0 + ) { + throw new AgentApiError("invalid_response", "Invalid modpack resolution request"); + } + + const response = await signedRequest( + "POST", + "/agents/self/modpacks/resolve", + JSON.stringify({ + source: sourceParsed.data, + modpack_id: request.modpack_id, + version_id: request.version_id, + }), + signal, + Math.max(timeoutMs, AGENT_API_MODPACK_RESOLVE_TIMEOUT_MS), + ); + + if (response.status === 429) { + void response.body?.cancel().catch(() => {}); + throw new AgentApiError("rate_limited", "Modpack resolution request was rate limited", 429); + } + if (response.status !== 200) { + void response.body?.cancel().catch(() => {}); + throw new AgentApiError( + "http_error", + `Modpack resolution failed with HTTP ${response.status}`, + response.status, + ); + } + + const resolveLimit = Math.max(maxResponseBytes, AGENT_API_MODPACK_RESOLVE_MAX_BYTES); + const raw = await parseBoundedJson(response, resolveLimit); + const parsed = resolvedModpackSchema.safeParse(raw); + if (!parsed.success) { + throw new AgentApiError("invalid_response", "API returned a malformed modpack resolution"); + } + return parsed.data; + }, }; } diff --git a/src/agent/index.ts b/src/agent/index.ts index 0880bed..878b416 100644 --- a/src/agent/index.ts +++ b/src/agent/index.ts @@ -3,6 +3,8 @@ export { AGENT_API_MAX_RESPONSE_BYTES, + AGENT_API_MODPACK_RESOLVE_MAX_BYTES, + AGENT_API_MODPACK_RESOLVE_TIMEOUT_MS, AGENT_API_PREFIX, AGENT_API_TIMEOUT_MS, type AgentApiClient, @@ -14,6 +16,12 @@ export { type BackupUploadUrlRequest, buildApiUrl, createAgentApiClient, + type ResolvedModpack, + type ResolvedModpackFile, + type ResolvedModpackFileEnvironment, + type ResolvedModpackOverrides, + type ResolvedModpackServerPack, + type ResolveModpackRequest, signedRequestHeaders, } from "./api-client"; export { diff --git a/src/cli/run.ts b/src/cli/run.ts index afe7ca4..298cb5f 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -37,7 +37,14 @@ import { type ServerManager, type ServerStatusWatcher, } from "../server"; -import { createStateManager, registerStateHandlers, type StateManager } from "../state"; +import { + createModpackInstaller, + createStateManager, + type ModpackInstaller, + registerModpackHandlers, + registerStateHandlers, + type StateManager, +} from "../state"; import { createPlayitTunnelManager, type PlayitTunnelManager, @@ -73,6 +80,7 @@ export interface AgentRuntime { readonly serverManager?: ServerManager; readonly fileManager: FileManager; readonly stateManager: StateManager; + readonly modpackInstaller: ModpackInstaller; readonly backupManager: BackupManager; readonly tunnelManager: PlayitTunnelManager; start(): void; @@ -239,6 +247,14 @@ export async function createAgentRuntime( registerBackupHandlers(queue, backupManager); const configuredCdnHost = config.tegraCdnHost ?? config.cdnHost; + const isServerActive = async (serverId: string): Promise => { + try { + const state = await serverManager.getServerState(serverId); + return state !== "stopped" && state !== "crashed"; + } catch { + return true; + } + }; const stateManager = createStateManager({ logger, ...(configuredServersDir && configuredServersDir.length > 0 @@ -246,19 +262,36 @@ export async function createAgentRuntime( : {}), ...(configuredCdnHost !== undefined ? { cdnHost: configuredCdnHost } : {}), backupHook: backupManager.createBackupHook(), - isServerActive: async (serverId: string): Promise => { - try { - const state = await serverManager.getServerState(serverId); - return state !== "stopped" && state !== "crashed"; - } catch { - return true; - } - }, + isServerActive, ...(options.fetch !== undefined ? { fetchImpl: options.fetch } : {}), ...(options.now !== undefined ? { now: options.now } : {}), }); registerStateHandlers(queue, stateManager); + const modpackInstaller = createModpackInstaller({ + stateDir: options.stateDir, + logger, + ...(configuredServersDir && configuredServersDir.length > 0 + ? { serversDir: configuredServersDir } + : {}), + ...(configuredCdnHost !== undefined ? { cdnHost: configuredCdnHost } : {}), + isServerActive, + resolveModpack: (req, signal) => apiClient.resolveModpack(req, signal), + onProgress: (event) => { + queue.publish("server.modpack", "server.install_modpack.progress", event, { + serverId: event.server_id, + }); + }, + onResult: (event) => { + queue.publish("server.modpack", "server.install_modpack.result", event, { + serverId: event.server_id, + }); + }, + ...(options.fetch !== undefined ? { fetchImpl: options.fetch } : {}), + ...(options.now !== undefined ? { now: options.now } : {}), + }); + registerModpackHandlers(queue, modpackInstaller); + const tunnelManager = createPlayitTunnelManager({ stateDir: options.stateDir, logger, @@ -310,6 +343,7 @@ export async function createAgentRuntime( ...(serverManager !== undefined ? { serverManager } : {}), fileManager, stateManager, + modpackInstaller, backupManager, tunnelManager, @@ -319,6 +353,7 @@ export async function createAgentRuntime( statusWatcher.start(); updater.start(); backupManager.start(); + modpackInstaller.start(); }, shutdown(drainTimeoutMs: number = SHUTDOWN_DRAIN_TIMEOUT_MS): Promise { @@ -330,6 +365,7 @@ export async function createAgentRuntime( updater.stop(); statusWatcher.stop(); backupManager.close(); + await modpackInstaller.close(); await tunnelManager.close(); serverManager?.close(); connection.stop(); diff --git a/src/files/index.ts b/src/files/index.ts index f322cb7..908d0eb 100644 --- a/src/files/index.ts +++ b/src/files/index.ts @@ -79,14 +79,18 @@ export { MAX_ZIP_ENTRIES, MAX_ZIP_ENTRY_BYTES, MAX_ZIP_UNCOMPRESSED_BYTES, + type ReadZipEntryOptions, + readZipEntryFromBuffer, type SafeUnzipBufferOptions, type SafeUnzipFileOptions, type SafeUnzipOptions, + type SafeUnzipPrefixesOptions, type SafeUnzipResult, type SafeZipFilesOptions, type SafeZipResult, safeUnzipBuffer, safeUnzipFile, + safeUnzipPrefixesFromBuffer, safeZipFiles, type ZipEntryInput, } from "./zip"; diff --git a/src/files/zip.ts b/src/files/zip.ts index 5a271ac..260e95b 100644 --- a/src/files/zip.ts +++ b/src/files/zip.ts @@ -781,6 +781,533 @@ export function safeUnzipBuffer(options: SafeUnzipBufferOptions): SafeUnzipResul }; } +function inflateValidatedZipEntry( + buf: Uint8Array, + entry: ParsedCentralEntry, + remainingTotalBudget: number, + maxEntryBytes: number, + maxCompressionRatio: number, + ratioMinBytes: number, +): Uint8Array { + const compressedData = buf.subarray(entry.dataStart, entry.dataEnd); + let plain: Uint8Array; + + if (entry.method === METHOD_STORE) { + if (compressedData.byteLength > remainingTotalBudget) { + throw new FileManagerError("zip_too_large", "ZIP total uncompressed byte limit exceeded"); + } + if (compressedData.byteLength > maxEntryBytes) { + throw new FileManagerError("zip_entry_too_large", "ZIP entry exceeds maximum byte limit"); + } + plain = compressedData; + } else { + const ratioBudget = Math.max( + ratioMinBytes, + Math.max(1, entry.compressedSize) * maxCompressionRatio, + ); + const maxOutputLength = Math.min(remainingTotalBudget, maxEntryBytes, ratioBudget); + const boundedMaxOutput = Math.min(MAX_ZLIB_OUTPUT_BYTES, Math.max(1, maxOutputLength)); + + try { + const inflated = inflateRawSync(compressedData, { maxOutputLength: boundedMaxOutput }); + plain = new Uint8Array(inflated.buffer, inflated.byteOffset, inflated.byteLength); + } catch (err) { + if (isBufferTooLargeError(err)) { + if (remainingTotalBudget <= maxEntryBytes && remainingTotalBudget <= ratioBudget) { + throw new FileManagerError( + "zip_too_large", + "Decompressed archive exceeded total uncompressed size budget", + ); + } + if (maxEntryBytes <= ratioBudget) { + throw new FileManagerError( + "zip_entry_too_large", + "Decompressed entry exceeded maximum entry size", + ); + } + throw new FileManagerError( + "zip_compression_ratio_exceeded", + "Decompressed entry exceeded maximum compression ratio", + ); + } + throw new FileManagerError( + "zip_invalid", + `Failed to decompress ZIP entry "${entry.rawName}"`, + ); + } + + if (plain.byteLength > remainingTotalBudget) { + throw new FileManagerError("zip_too_large", "ZIP total uncompressed byte limit exceeded"); + } + } + + if (plain.byteLength !== entry.uncompressedSize) { + throw new FileManagerError( + "zip_invalid", + `Actual uncompressed size (${plain.byteLength}) does not match header (${entry.uncompressedSize})`, + ); + } + + if (crc32(plain) !== entry.crc32) { + throw new FileManagerError( + "zip_crc_mismatch", + `CRC-32 mismatch for ZIP entry "${entry.rawName}"`, + ); + } + + return plain; +} + +function parseZipRawNameSafety(rawName: string): void { + if (rawName.length === 0) { + throw new FileManagerError("zip_invalid", "ZIP entry has empty filename"); + } + if (rawName.includes("\0")) { + throw new FileManagerError("zip_slip", "ZIP entry contains NUL byte"); + } + if (rawName.includes("\\")) { + throw new FileManagerError("zip_slip", "ZIP entry contains backslash"); + } + if (rawName.startsWith("/") || /^[A-Za-z]:/.test(rawName)) { + throw new FileManagerError("zip_slip", "ZIP entry uses absolute path"); + } + const trimmed = rawName.endsWith("/") ? rawName.slice(0, -1) : rawName; + if (trimmed.length === 0 || trimmed.endsWith("/")) { + throw new FileManagerError("zip_slip", `Invalid ZIP entry path "${rawName}"`); + } + for (const segment of trimmed.split("/")) { + if (segment === "" || segment === "." || segment === "..") { + throw new FileManagerError("zip_slip", `Unsafe ZIP entry "${rawName}"`); + } + } +} + +function parseRawCentralDirectory( + buf: Uint8Array, + maxEntries: number, + maxUncompressedBytes: number, + maxEntryBytes: number, + maxCompressionRatio: number, + ratioMinBytes: number, +): ParsedCentralEntry[] { + const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength); + const decoder = new TextDecoder("utf-8", { fatal: true }); + + const eocdOffset = findEocdOffset(view, buf.byteLength); + const diskNumber = view.getUint16(eocdOffset + 4, true); + const cdStartDisk = view.getUint16(eocdOffset + 6, true); + const entriesOnDisk = view.getUint16(eocdOffset + 8, true); + const totalEntries = view.getUint16(eocdOffset + 10, true); + const cdSize = view.getUint32(eocdOffset + 12, true); + const cdOffset = view.getUint32(eocdOffset + 16, true); + + if (diskNumber !== 0 || cdStartDisk !== 0 || entriesOnDisk !== totalEntries) { + throw new FileManagerError("zip_invalid", "Multi-disk ZIP archives are not supported"); + } + if (totalEntries === 0xffff || cdSize === 0xffffffff || cdOffset === 0xffffffff) { + throw new FileManagerError("zip_invalid", "ZIP64 archives are not supported"); + } + if (totalEntries > maxEntries) { + throw new FileManagerError( + "zip_too_many_entries", + `ZIP entry count ${totalEntries} exceeds limit ${maxEntries}`, + ); + } + if (cdOffset + cdSize > eocdOffset) { + throw new FileManagerError("zip_invalid", "Central Directory exceeds archive bounds"); + } + + const entries: ParsedCentralEntry[] = []; + let declaredTotalUncompressed = 0; + let pos = cdOffset; + const cdEnd = cdOffset + cdSize; + + for (let i = 0; i < totalEntries; i++) { + if (pos + 46 > cdEnd) { + throw new FileManagerError("zip_invalid", "Truncated Central Directory header"); + } + if (view.getUint32(pos, true) !== SIG_CENTRAL_DIR_HEADER) { + throw new FileManagerError("zip_invalid", "Invalid Central Directory header signature"); + } + + const flags = view.getUint16(pos + 8, true); + const method = view.getUint16(pos + 10, true); + const entryCrc = view.getUint32(pos + 16, true); + const compressedSize = view.getUint32(pos + 20, true); + const uncompressedSize = view.getUint32(pos + 24, true); + const nameLen = view.getUint16(pos + 28, true); + const extraLen = view.getUint16(pos + 30, true); + const commentLen = view.getUint16(pos + 32, true); + const externalAttr = view.getUint32(pos + 38, true); + const localHeaderOffset = view.getUint32(pos + 42, true); + + const nextPos = pos + 46 + nameLen + extraLen + commentLen; + if (nextPos > cdEnd) { + throw new FileManagerError("zip_invalid", "Central Directory entry extends past CD end"); + } + if ((flags & (FLAG_ENCRYPTED | FLAG_STRONG_ENCRYPTED)) !== 0) { + throw new FileManagerError("zip_unsupported_method", "Encrypted ZIP entries are forbidden"); + } + if (method !== METHOD_STORE && method !== METHOD_DEFLATE) { + throw new FileManagerError( + "zip_unsupported_method", + `Unsupported ZIP compression method: ${method}`, + ); + } + + const unixType = (externalAttr >>> 16) & UNIX_MODE_MASK; + if (unixType === UNIX_MODE_SYMLINK) { + throw new FileManagerError( + "zip_symlink_entry", + "Symbolic link entries inside ZIP archives are forbidden", + ); + } + if (unixType !== 0 && unixType !== UNIX_MODE_REGULAR && unixType !== UNIX_MODE_DIRECTORY) { + throw new FileManagerError( + "zip_invalid", + "Special UNIX device/FIFO/socket entries are forbidden", + ); + } + + let rawName: string; + try { + rawName = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen)); + } catch { + throw new FileManagerError("zip_invalid", "ZIP entry name is not valid UTF-8"); + } + parseZipRawNameSafety(rawName); + const isDirectory = unixType === UNIX_MODE_DIRECTORY || rawName.endsWith("/"); + const targetRelPath = isDirectory ? rawName.slice(0, -1).replace(/\/+$/, "") : rawName; + + if (isDirectory) { + if (compressedSize !== 0 || uncompressedSize !== 0) { + throw new FileManagerError("zip_invalid", "Directory entry must have zero size"); + } + } else { + if (uncompressedSize > maxEntryBytes) { + throw new FileManagerError( + "zip_entry_too_large", + `ZIP entry "${rawName}" declared size ${uncompressedSize} exceeds limit ${maxEntryBytes}`, + ); + } + declaredTotalUncompressed += uncompressedSize; + if (declaredTotalUncompressed > maxUncompressedBytes) { + throw new FileManagerError( + "zip_too_large", + `ZIP total declared size exceeds limit ${maxUncompressedBytes}`, + ); + } + if (method === METHOD_DEFLATE) { + if (compressedSize === 0) { + throw new FileManagerError( + "zip_invalid", + `Deflated ZIP entry "${rawName}" has zero compressed size`, + ); + } + const ratioLimit = Math.max( + ratioMinBytes, + Math.max(1, compressedSize) * maxCompressionRatio, + ); + if (uncompressedSize > ratioLimit) { + throw new FileManagerError( + "zip_compression_ratio_exceeded", + `ZIP entry "${rawName}" exceeds maximum compression ratio`, + ); + } + } else if (compressedSize !== uncompressedSize) { + throw new FileManagerError( + "zip_invalid", + `Stored ZIP entry "${rawName}" has mismatched compressed/uncompressed sizes`, + ); + } + } + + if (localHeaderOffset + 30 > cdOffset) { + throw new FileManagerError("zip_invalid", "Local File Header offset out of bounds"); + } + if (view.getUint32(localHeaderOffset, true) !== SIG_LOCAL_FILE_HEADER) { + throw new FileManagerError("zip_invalid", "Invalid Local File Header signature"); + } + + const lfhFlags = view.getUint16(localHeaderOffset + 6, true); + const lfhMethod = view.getUint16(localHeaderOffset + 8, true); + const lfhCrc = view.getUint32(localHeaderOffset + 14, true); + const lfhCompressedSize = view.getUint32(localHeaderOffset + 18, true); + const lfhUncompressedSize = view.getUint32(localHeaderOffset + 22, true); + const lfhNameLen = view.getUint16(localHeaderOffset + 26, true); + const lfhExtraLen = view.getUint16(localHeaderOffset + 28, true); + + if ((lfhFlags & (FLAG_ENCRYPTED | FLAG_STRONG_ENCRYPTED)) !== 0) { + throw new FileManagerError("zip_unsupported_method", "Encrypted ZIP entries are forbidden"); + } + if (lfhMethod !== method) { + throw new FileManagerError("zip_invalid", "Local and Central header compression mismatch"); + } + + const dataStart = localHeaderOffset + 30 + lfhNameLen + lfhExtraLen; + const dataEnd = dataStart + compressedSize; + if (dataEnd > cdOffset) { + throw new FileManagerError("zip_invalid", "Local File Header data exceeds archive bounds"); + } + + let lfhName: string; + try { + lfhName = decoder.decode( + buf.subarray(localHeaderOffset + 30, localHeaderOffset + 30 + lfhNameLen), + ); + } catch { + throw new FileManagerError("zip_invalid", "Local header filename is not valid UTF-8"); + } + if (lfhName !== rawName) { + throw new FileManagerError("zip_invalid", "Local and Central header filename mismatch"); + } + if ( + (lfhFlags & FLAG_DATA_DESCRIPTOR) === 0 && + (lfhCrc !== entryCrc || + lfhCompressedSize !== compressedSize || + lfhUncompressedSize !== uncompressedSize) + ) { + throw new FileManagerError("zip_invalid", "Local and Central header metadata mismatch"); + } + + entries.push({ + rawName, + targetRelPath, + isDirectory, + flags, + method, + crc32: entryCrc, + compressedSize, + uncompressedSize, + localHeaderOffset, + dataStart, + dataEnd, + }); + pos = nextPos; + } + + if (pos !== cdEnd) { + throw new FileManagerError("zip_invalid", "Central Directory size does not match entries"); + } + + const sortedRanges = [...entries].sort((a, b) => a.localHeaderOffset - b.localHeaderOffset); + for (let i = 1; i < sortedRanges.length; i++) { + const prev = sortedRanges[i - 1]; + const curr = sortedRanges[i]; + if (prev !== undefined && curr !== undefined && prev.dataEnd > curr.localHeaderOffset) { + throw new FileManagerError("zip_invalid", "Overlapping ZIP entry offsets are forbidden"); + } + } + + return entries; +} + +export interface ReadZipEntryOptions { + readonly buffer: Uint8Array; + readonly entryName: string; + readonly maxEntries?: number; + readonly maxUncompressedBytes?: number; + readonly maxEntryBytes?: number; + readonly maxCompressionRatio?: number; + readonly ratioMinBytes?: number; +} + +export function readZipEntryFromBuffer(options: ReadZipEntryOptions): Uint8Array | null { + const maxEntries = options.maxEntries ?? MAX_ZIP_ENTRIES; + const maxUncompressedBytes = options.maxUncompressedBytes ?? MAX_ZIP_UNCOMPRESSED_BYTES; + const maxEntryBytes = options.maxEntryBytes ?? MAX_ZIP_ENTRY_BYTES; + const maxCompressionRatio = options.maxCompressionRatio ?? MAX_ZIP_COMPRESSION_RATIO; + const ratioMinBytes = options.ratioMinBytes ?? DEFAULT_ZIP_RATIO_MIN_BYTES; + + const entries = parseRawCentralDirectory( + options.buffer, + maxEntries, + maxUncompressedBytes, + maxEntryBytes, + maxCompressionRatio, + ratioMinBytes, + ); + const match = entries.find((entry) => !entry.isDirectory && entry.rawName === options.entryName); + if (match === undefined) { + return null; + } + return inflateValidatedZipEntry( + options.buffer, + match, + maxEntryBytes, + maxEntryBytes, + maxCompressionRatio, + ratioMinBytes, + ); +} + +export interface SafeUnzipPrefixesOptions extends SafeUnzipBufferOptions { + readonly prefixes: readonly string[]; + readonly excludePrefixes?: readonly string[]; + readonly skipPaths?: ReadonlySet; +} + +/** + * Safely extracts only entries matching `prefixes` (in order, so later prefixes + * like `server-overrides/` override earlier ones like `overrides/`) after + * validating every entry in the archive for traversal, symlinks, and zip bombs. + */ +export function safeUnzipPrefixesFromBuffer(options: SafeUnzipPrefixesOptions): SafeUnzipResult { + const serversBaseDir = options.serversBaseDir ?? DEFAULT_SERVERS_BASE_DIR; + const maxEntries = options.maxEntries ?? MAX_ZIP_ENTRIES; + const maxUncompressedBytes = options.maxUncompressedBytes ?? MAX_ZIP_UNCOMPRESSED_BYTES; + const maxEntryBytes = options.maxEntryBytes ?? MAX_ZIP_ENTRY_BYTES; + const maxCompressionRatio = options.maxCompressionRatio ?? MAX_ZIP_COMPRESSION_RATIO; + const ratioMinBytes = options.ratioMinBytes ?? DEFAULT_ZIP_RATIO_MIN_BYTES; + const skipPathsLower = new Set( + [...(options.skipPaths ?? [])].map((p) => p.replace(/^\/+/, "").toLowerCase()), + ); + const forbiddenPathsLower = new Set( + [...(options.forbiddenPaths ?? [])].map((p) => p.replace(/^\/+/, "").toLowerCase()), + ); + + const normalizedPrefixes = options.prefixes.map((p) => { + const clean = p.replace(/^\/+/, "").replace(/\/+$/, ""); + return clean.length > 0 ? `${clean}/` : ""; + }); + const normalizedExcludes = (options.excludePrefixes ?? []).map((p) => { + const clean = p.replace(/^\/+/, "").replace(/\/+$/, ""); + return clean.length > 0 ? `${clean}/` : ""; + }); + + const destResolved = resolveConfinedPath({ + serversBaseDir, + serverId: options.serverId, + relPath: options.destPath ?? "", + allowRoot: true, + }); + + const rawEntries = parseRawCentralDirectory( + options.buffer, + maxEntries, + maxUncompressedBytes, + maxEntryBytes, + maxCompressionRatio, + ratioMinBytes, + ); + + interface SelectedEntry { + readonly raw: ParsedCentralEntry; + readonly prefixIndex: number; + readonly targetRelPath: string; + } + + const selected: SelectedEntry[] = []; + for (const entry of rawEntries) { + if (normalizedExcludes.some((ex) => ex.length > 0 && entry.rawName.startsWith(ex))) { + continue; + } + + let matchedPrefixIndex = -1; + let stripped = ""; + for (let idx = 0; idx < normalizedPrefixes.length; idx++) { + const prefix = normalizedPrefixes[idx]; + if (prefix === undefined || prefix.length === 0) { + continue; + } + if (entry.rawName.startsWith(prefix)) { + matchedPrefixIndex = idx; + stripped = entry.rawName.slice(prefix.length); + break; + } + } + if (matchedPrefixIndex < 0) { + continue; + } + const trimmed = stripped.endsWith("/") ? stripped.slice(0, -1) : stripped; + if (trimmed.length === 0) { + continue; + } + + const validated = validateZipEntryName( + entry.isDirectory ? `${trimmed}/` : trimmed, + destResolved.relativePath, + serversBaseDir, + options.serverId, + entry.isDirectory, + ); + const lowerTarget = validated.targetRelPath.toLowerCase(); + if (forbiddenPathsLower.has(lowerTarget)) { + throw new FileManagerError( + "zip_slip", + `Refusing to extract protected path "${entry.rawName}"`, + ); + } + if (skipPathsLower.has(lowerTarget)) { + continue; + } + + selected.push({ + raw: entry, + prefixIndex: matchedPrefixIndex, + targetRelPath: validated.targetRelPath, + }); + } + + // Apply prefixes in caller order so server-overrides/ overrides overrides/. + selected.sort((a, b) => a.prefixIndex - b.prefixIndex); + + let actualTotalBytes = 0; + const extractedFiles: string[] = []; + + for (const item of selected) { + if (item.raw.isDirectory) { + mkdirConfined({ + serversBaseDir, + serverId: options.serverId, + relPath: item.targetRelPath, + ...(options.permissions !== undefined ? { permissions: options.permissions } : {}), + }); + continue; + } + + const remainingTotalBudget = maxUncompressedBytes - actualTotalBytes; + if (remainingTotalBudget < 0) { + throw new FileManagerError("zip_too_large", "ZIP total uncompressed byte limit exceeded"); + } + + const plain = inflateValidatedZipEntry( + options.buffer, + item.raw, + remainingTotalBudget, + maxEntryBytes, + maxCompressionRatio, + ratioMinBytes, + ); + + actualTotalBytes += plain.byteLength; + if (actualTotalBytes > maxUncompressedBytes) { + throw new FileManagerError("zip_too_large", "ZIP total uncompressed byte limit exceeded"); + } + + const targetResolved = resolveConfinedPath({ + serversBaseDir, + serverId: options.serverId, + relPath: item.targetRelPath, + allowRoot: false, + }); + writeConfinedFileAtomic(targetResolved, plain, { + createParents: true, + ...(options.permissions !== undefined ? { permissions: options.permissions } : {}), + }); + if (!extractedFiles.includes(targetResolved.relativePath)) { + extractedFiles.push(targetResolved.relativePath); + } + } + + return { + destPath: destResolved.relativePath, + entryCount: selected.length, + totalBytes: actualTotalBytes, + files: extractedFiles, + }; +} + export function safeUnzipFile(options: SafeUnzipFileOptions): SafeUnzipResult { const serversBaseDir = options.serversBaseDir ?? DEFAULT_SERVERS_BASE_DIR; const maxZipFileBytes = options.maxZipFileBytes ?? DEFAULT_MAX_ZIP_FILE_BYTES; diff --git a/src/protocol/commands/agent.ts b/src/protocol/commands/agent.ts index 1a87d11..52570c0 100644 --- a/src/protocol/commands/agent.ts +++ b/src/protocol/commands/agent.ts @@ -7,7 +7,7 @@ import { roleGrantSchema } from "../roles"; import { keyIdSchema } from "../schemas"; import { serverIdSchema } from "./server"; -export const SUBSCRIPTION_TOPICS = ["server.status", "server.backup"] as const; +export const SUBSCRIPTION_TOPICS = ["server.status", "server.backup", "server.modpack"] as const; export const subscriptionTopicSchema = z.enum(SUBSCRIPTION_TOPICS); export type SubscriptionTopic = z.infer; diff --git a/src/protocol/commands/core.ts b/src/protocol/commands/core.ts index bd9d882..97dac69 100644 --- a/src/protocol/commands/core.ts +++ b/src/protocol/commands/core.ts @@ -7,6 +7,7 @@ import { registerAgentCommands } from "./agent"; import { registerBackupCommands } from "./backup"; import { registerFilesCommands } from "./files"; import { registerHostCommands } from "./host"; +import { registerModpackCommands } from "./modpack"; import { registerPairingCommands } from "./pairing"; import { registerServerCommands, serverIdSchema } from "./server"; import { registerStateCommands } from "./state"; @@ -62,14 +63,16 @@ export function registerCoreCommands(registry: CommandRegistry): CommandRegistry } export function createCoreRegistry(): CommandRegistry { - return registerHostCommands( - registerAgentCommands( - registerTunnelCommands( - registerBackupCommands( - registerStateCommands( - registerServerCommands( - registerFilesCommands( - registerPairingCommands(registerCoreCommands(new CommandRegistry())), + return registerModpackCommands( + registerHostCommands( + registerAgentCommands( + registerTunnelCommands( + registerBackupCommands( + registerStateCommands( + registerServerCommands( + registerFilesCommands( + registerPairingCommands(registerCoreCommands(new CommandRegistry())), + ), ), ), ), diff --git a/src/protocol/commands/modpack.ts b/src/protocol/commands/modpack.ts new file mode 100644 index 0000000..e22379a --- /dev/null +++ b/src/protocol/commands/modpack.ts @@ -0,0 +1,174 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { z } from "zod"; +import { type CommandRegistry, defineCommand } from "../registry"; +import { serverIdSchema } from "./server"; + +export const MODPACK_SOURCES = ["tegra", "modrinth", "curseforge"] as const; +export const modpackSourceSchema = z.enum(MODPACK_SOURCES); +export type ModpackSource = z.infer; + +export const MODPACK_INSTALL_PHASES = [ + "resolving", + "downloading", + "extracting", + "overrides", + "finalizing", +] as const; +export const modpackInstallPhaseSchema = z.enum(MODPACK_INSTALL_PHASES); +export type ModpackInstallPhase = z.infer; + +export const MODPACK_INSTALL_JOB_STATES = ["running", "completed", "failed", "cancelled"] as const; +export const modpackInstallJobStateSchema = z.enum(MODPACK_INSTALL_JOB_STATES); +export type ModpackInstallJobState = z.infer; + +export const MODPACK_INSTALL_ERROR_CODES = [ + "pack_unavailable", + "host_not_allowed", + "hash_mismatch", + "too_large", + "install_in_progress", + "server_running", + "api_unavailable", + "io_error", + "cancelled", +] as const; +export const modpackInstallErrorCodeSchema = z.enum(MODPACK_INSTALL_ERROR_CODES); +export type ModpackInstallErrorCode = z.infer; + +export const modpackInstallSkippedItemSchema = z + .object({ + name: z.string().min(1).max(256), + reason: z.string().min(1).max(128), + }) + .strict(); +export type ModpackInstallSkippedItem = z.infer; + +export const serverInstallModpackBodySchema = z + .object({ + server_id: serverIdSchema, + source: modpackSourceSchema, + modpack_id: z.string().min(1).max(128), + version_id: z.string().min(1).max(128), + modpack_name: z.string().min(1).max(256).optional(), + version_label: z.string().min(1).max(128).optional(), + }) + .strict(); +export type ServerInstallModpackBody = z.infer; + +export const serverInstallModpackStatusBodySchema = z + .object({ + server_id: serverIdSchema, + }) + .strict(); +export type ServerInstallModpackStatusBody = z.infer; + +export const serverInstallModpackCancelBodySchema = z + .object({ + server_id: serverIdSchema, + job_id: z.string().min(1).max(128).optional(), + }) + .strict(); +export type ServerInstallModpackCancelBody = z.infer; + +export const serverInstallModpackAcceptedEventSchema = z + .object({ + job_id: z.string().min(1).max(128), + server_id: serverIdSchema, + }) + .strict(); +export type ServerInstallModpackAcceptedEvent = z.infer< + typeof serverInstallModpackAcceptedEventSchema +>; + +export const serverInstallModpackProgressEventSchema = z + .object({ + job_id: z.string().min(1).max(128), + server_id: serverIdSchema, + phase: modpackInstallPhaseSchema, + done: z.number().int().nonnegative(), + total: z.number().int().nonnegative(), + current: z.string().min(1).max(256).optional(), + }) + .strict(); +export type ServerInstallModpackProgressEvent = z.infer< + typeof serverInstallModpackProgressEventSchema +>; + +export const serverInstallModpackResultEventSchema = z + .object({ + job_id: z.string().min(1).max(128), + server_id: serverIdSchema, + ok: z.boolean(), + installed: z.number().int().nonnegative(), + skipped: z.array(modpackInstallSkippedItemSchema).max(4000), + error_code: modpackInstallErrorCodeSchema.optional(), + }) + .strict(); +export type ServerInstallModpackResultEvent = z.infer; + +export const modpackInstallJobStatusSchema = z + .object({ + job_id: z.string().min(1).max(128), + server_id: serverIdSchema, + source: modpackSourceSchema, + modpack_id: z.string().min(1).max(128), + version_id: z.string().min(1).max(128), + modpack_name: z.string().min(1).max(256).optional(), + version_label: z.string().min(1).max(128).optional(), + status: modpackInstallJobStateSchema, + phase: modpackInstallPhaseSchema, + done: z.number().int().nonnegative(), + total: z.number().int().nonnegative(), + current: z.string().min(1).max(256).optional(), + installed: z.number().int().nonnegative(), + skipped: z.array(modpackInstallSkippedItemSchema).max(4000), + error_code: modpackInstallErrorCodeSchema.optional(), + started_at: z.number().int().nonnegative(), + updated_at: z.number().int().nonnegative(), + finished_at: z.number().int().nonnegative().optional(), + }) + .strict(); +export type ModpackInstallJobStatus = z.infer; + +export const serverInstallModpackStatusResultSchema = z + .object({ + server_id: serverIdSchema, + job: modpackInstallJobStatusSchema.nullable(), + }) + .strict(); +export type ServerInstallModpackStatusResult = z.infer< + typeof serverInstallModpackStatusResultSchema +>; + +export const serverInstallModpackCommand = defineCommand({ + type: "server.install_modpack", + sensitive: true, + minRole: "editor", + body: serverInstallModpackBodySchema, +}); + +export const serverInstallModpackStatusCommand = defineCommand({ + type: "server.install_modpack.status", + sensitive: false, + minRole: "viewer", + body: serverInstallModpackStatusBodySchema, +}); + +export const serverInstallModpackCancelCommand = defineCommand({ + type: "server.install_modpack.cancel", + sensitive: false, + minRole: "editor", + body: serverInstallModpackCancelBodySchema, +}); + +export const MODPACK_COMMANDS = [ + serverInstallModpackCommand, + serverInstallModpackStatusCommand, + serverInstallModpackCancelCommand, +] as const; + +export function registerModpackCommands(registry: CommandRegistry): CommandRegistry { + return registry.registerAll(MODPACK_COMMANDS); +} diff --git a/src/protocol/commands/state.ts b/src/protocol/commands/state.ts index 5de6816..a34e883 100644 --- a/src/protocol/commands/state.ts +++ b/src/protocol/commands/state.ts @@ -87,6 +87,7 @@ export const serverOriginSchema = z source: modSourceSchema, modpack_id: z.string().min(1).max(128), version_id: z.string().min(1).max(128), + modpack_name: z.string().min(1).max(256).optional(), }) .strict(), z diff --git a/src/protocol/errors.ts b/src/protocol/errors.ts index 3003ea2..bb653da 100644 --- a/src/protocol/errors.ts +++ b/src/protocol/errors.ts @@ -54,7 +54,14 @@ export type ProtocolErrorCode = | "tunnel_not_configured" | "tunnel_already_running" | "tunnel_not_running" - | "tunnel_failed"; + | "tunnel_failed" + | "pack_unavailable" + | "host_not_allowed" + | "too_large" + | "install_in_progress" + | "api_unavailable" + | "io_error" + | "cancelled"; export class ProtocolError extends Error { readonly code: ProtocolErrorCode; diff --git a/src/protocol/index.ts b/src/protocol/index.ts index e7a5a56..bd3d0a9 100644 --- a/src/protocol/index.ts +++ b/src/protocol/index.ts @@ -153,6 +153,43 @@ export { hostInfoResultSchema, registerHostCommands, } from "./commands/host"; +export { + MODPACK_COMMANDS, + MODPACK_INSTALL_ERROR_CODES, + MODPACK_INSTALL_JOB_STATES, + MODPACK_INSTALL_PHASES, + MODPACK_SOURCES, + type ModpackInstallErrorCode, + type ModpackInstallJobState, + type ModpackInstallJobStatus, + type ModpackInstallPhase, + type ModpackInstallSkippedItem, + type ModpackSource, + modpackInstallErrorCodeSchema, + modpackInstallJobStateSchema, + modpackInstallJobStatusSchema, + modpackInstallPhaseSchema, + modpackInstallSkippedItemSchema, + modpackSourceSchema, + registerModpackCommands, + type ServerInstallModpackAcceptedEvent, + type ServerInstallModpackBody, + type ServerInstallModpackCancelBody, + type ServerInstallModpackProgressEvent, + type ServerInstallModpackResultEvent, + type ServerInstallModpackStatusBody, + type ServerInstallModpackStatusResult, + serverInstallModpackAcceptedEventSchema, + serverInstallModpackBodySchema, + serverInstallModpackCancelBodySchema, + serverInstallModpackCancelCommand, + serverInstallModpackCommand, + serverInstallModpackProgressEventSchema, + serverInstallModpackResultEventSchema, + serverInstallModpackStatusBodySchema, + serverInstallModpackStatusCommand, + serverInstallModpackStatusResultSchema, +} from "./commands/modpack"; export { agentRevocationsSetCommand, PAIRING_COMMANDS, diff --git a/src/protocol/phase3.test.ts b/src/protocol/phase3.test.ts index e115ede..471767c 100644 --- a/src/protocol/phase3.test.ts +++ b/src/protocol/phase3.test.ts @@ -678,6 +678,9 @@ const MIN_ROLE: Record = { "server.backup.create": "editor", "server.backup.config.set": "editor", "server.deploy.serverpack": "editor", + "server.install_modpack": "editor", + "server.install_modpack.status": "viewer", + "server.install_modpack.cancel": "editor", "server.create": "admin", "server.change_runtime": "admin", "server.backup.delete": "admin", @@ -748,6 +751,14 @@ describe("minimum roles", () => { "server.backup.create": { server_id: SERVER }, "server.backup.config.set": { server_id: SERVER }, "server.backup.delete": { server_id: SERVER, backup_id: "20260101T000000Z-abcdef" }, + "server.install_modpack": { + server_id: SERVER, + source: "modrinth", + modpack_id: "p1", + version_id: "v1", + }, + "server.install_modpack.status": { server_id: SERVER }, + "server.install_modpack.cancel": { server_id: SERVER }, }; async function attempt( diff --git a/src/state/download.ts b/src/state/download.ts index d875587..a0fd318 100644 --- a/src/state/download.ts +++ b/src/state/download.ts @@ -43,6 +43,24 @@ export interface DownloadVerifiedBufferOptions { readonly maxRedirects?: number; readonly timeoutMs?: number; readonly fetchImpl?: FetchLike; + readonly signal?: AbortSignal; +} + +export function isUrlHostAllowed( + rawUrl: string, + allowedHosts: ReadonlySet, +): + | { readonly ok: true; readonly url: URL } + | { readonly ok: false; readonly reason: "host_not_allowed" | "invalid_url" } { + try { + const url = validateStateDownloadUrl(rawUrl, allowedHosts); + return { ok: true, url }; + } catch (err) { + if (err instanceof ProtocolError && err.message.includes("not allowed")) { + return { ok: false, reason: "host_not_allowed" }; + } + return { ok: false, reason: "invalid_url" }; + } } export function buildAllowedDownloadHosts( @@ -186,7 +204,12 @@ export async function downloadVerifiedBuffer( let data: Uint8Array | null = null; for (let hop = 0; hop <= maxRedirects; hop++) { + if (options.signal?.aborted) { + throw new ProtocolError("cancelled", "Download aborted"); + } const controller = new AbortController(); + const onAbort = (): void => controller.abort(); + options.signal?.addEventListener("abort", onAbort, { once: true }); const timer = setTimeout(() => controller.abort(), timeoutMs); try { @@ -198,6 +221,9 @@ export async function downloadVerifiedBuffer( signal: controller.signal, }); } catch { + if (options.signal?.aborted) { + throw new ProtocolError("cancelled", "Download aborted"); + } throw new ProtocolError("download_failed", `Failed to fetch ${currentUrl.hostname}`); } @@ -237,6 +263,9 @@ export async function downloadVerifiedBuffer( try { data = await readCappedBytes(response, maxBytes); } catch (err) { + if (options.signal?.aborted) { + throw new ProtocolError("cancelled", "Download aborted"); + } if (err instanceof ProtocolError) { throw err; } @@ -248,6 +277,7 @@ export async function downloadVerifiedBuffer( break; } finally { clearTimeout(timer); + options.signal?.removeEventListener("abort", onAbort); } } diff --git a/src/state/index.ts b/src/state/index.ts index c5c4b45..950e177 100644 --- a/src/state/index.ts +++ b/src/state/index.ts @@ -20,18 +20,28 @@ export { createStateManager, DEFAULT_MAX_STORED_PLANS, DEFAULT_PLAN_TTL_MS, + indexExtractedServerPackFiles, type ModInstallResult, type ModRemoveResult, type ModsListResult, type OriginApplyResult, type OriginPlanResult, type OriginUnlinkResult, + PROTECTED_SERVERPACK_PATHS, registerStateHandlers, type ServerPackDeployResult, type StateManager, type StateManagerOptions, type UpdateVersionLoaderParams, } from "./manager"; +export { + type CancelModpackInstallResult, + createModpackInstaller, + type ModpackInstaller, + type ModpackInstallerOptions, + registerModpackHandlers, + type StartModpackInstallResult, +} from "./modpack-installer"; export { buildOriginSyncChanges, emptyOriginSyncState, diff --git a/src/state/manager.ts b/src/state/manager.ts index 657611e..e5ad031 100644 --- a/src/state/manager.ts +++ b/src/state/manager.ts @@ -206,7 +206,64 @@ async function decryptDownloadedBlob( } } -const PROTECTED_SERVERPACK_PATHS: ReadonlySet = new Set(["start.sh", "tegrad-server.json"]); +export const PROTECTED_SERVERPACK_PATHS: ReadonlySet = new Set([ + "start.sh", + "tegrad-server.json", +]); + +export function indexExtractedServerPackFiles(options: { + readonly serversDir: string; + readonly serverId: string; + readonly extractedFiles: readonly string[]; + readonly existingMods: readonly ServerModEntry[]; + readonly originSource: ServerModEntry["source"]; + readonly layer: ServerModEntry["layer"]; +}): { + readonly mods: ServerModEntry[]; + readonly syncedFiles: string[]; + readonly syncedModKeys: string[]; + readonly addedModsCount: number; +} { + const modEntriesByFile = new Map( + options.existingMods.map((m) => [m.file, m]), + ); + const extractedSyncedFiles: string[] = []; + const extractedModKeys: string[] = []; + let addedModsCount = 0; + + for (const relPath of options.extractedFiles) { + if (relPath.startsWith(`${MODS_DIR}/`) && !relPath.slice(MODS_DIR.length + 1).includes("/")) { + const fileName = validateSingleFileName(relPath.slice(MODS_DIR.length + 1)); + const resolved = resolveConfinedPath({ + serversBaseDir: options.serversDir, + serverId: options.serverId, + relPath, + allowRoot: false, + }); + const fileSha1 = hashFileSha1(resolved.fullPath); + const fileSha256 = hashFileSha256(resolved.fullPath); + const entry: ServerModEntry = { + file: fileName, + source: options.originSource, + sha1: fileSha1, + sha256: fileSha256, + layer: options.layer, + }; + modEntriesByFile.set(fileName, entry); + extractedModKeys.push(modKeyFromMetadataEntry(entry)); + addedModsCount++; + } else if (isServerContentPath(relPath)) { + extractedSyncedFiles.push(relPath); + } + } + + return { + mods: [...modEntriesByFile.values()].sort((a, b) => a.file.localeCompare(b.file)), + syncedFiles: [...new Set(extractedSyncedFiles)].sort(), + syncedModKeys: [...new Set(extractedModKeys)].sort(), + addedModsCount, + }; +} function hexDigestsEqual(actualHex: string, expectedHex: string): boolean { const a = Buffer.from(actualHex.toLowerCase(), "hex"); @@ -1056,46 +1113,23 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana }); const nextOrigin: ServerOrigin = origin !== undefined ? origin : (meta.origin ?? null); - const modEntriesByFile = new Map( - (meta.mods ?? []).map((m) => [m.file, m]), - ); const originSource = nextOrigin?.kind === "modpack" ? nextOrigin.source : "local"; - - const extractedSyncedFiles: string[] = []; - const extractedModKeys: string[] = []; - - for (const relPath of unzipResult.files) { - if (relPath.startsWith(`${MODS_DIR}/`) && !relPath.slice(MODS_DIR.length + 1).includes("/")) { - const fileName = validateSingleFileName(relPath.slice(MODS_DIR.length + 1)); - const resolved = resolveConfinedPath({ - serversBaseDir: serversDir, - serverId, - relPath, - allowRoot: false, - }); - const fileSha1 = hashFileSha1(resolved.fullPath); - const fileSha256 = hashFileSha256(resolved.fullPath); - const entry: ServerModEntry = { - file: fileName, - source: originSource, - sha1: fileSha1, - sha256: fileSha256, - layer: nextOrigin?.kind === "modpack" ? "origin" : "user", - }; - modEntriesByFile.set(fileName, entry); - extractedModKeys.push(modKeyFromMetadataEntry(entry)); - } else if (isServerContentPath(relPath)) { - extractedSyncedFiles.push(relPath); - } - } + const indexed = indexExtractedServerPackFiles({ + serversDir, + serverId, + extractedFiles: unzipResult.files, + existingMods: meta.mods ?? [], + originSource, + layer: nextOrigin?.kind === "modpack" ? "origin" : "user", + }); const nextSync: ServerOriginSyncState | undefined = nextOrigin?.kind === "modpack" ? { excluded_mod_keys: [], - synced_mod_keys: [...new Set(extractedModKeys)].sort(), + synced_mod_keys: indexed.syncedModKeys, removed_origin_files: [], - synced_files: [...new Set(extractedSyncedFiles)].sort(), + synced_files: indexed.syncedFiles, last_synced_at: new Date(now()).toISOString(), last_synced_version_id: nextOrigin.version_id, } @@ -1104,7 +1138,7 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana const nextMeta: ServerMetadata = { ...meta, origin: nextOrigin, - mods: [...modEntriesByFile.values()].sort((a, b) => a.file.localeCompare(b.file)), + mods: indexed.mods, ...(nextSync !== undefined ? { origin_sync: nextSync } : {}), }; writeServerMetadata(serversDir, nextMeta, permissionContext); diff --git a/src/state/modpack-installer.test.ts b/src/state/modpack-installer.test.ts new file mode 100644 index 0000000..a4837a0 --- /dev/null +++ b/src/state/modpack-installer.test.ts @@ -0,0 +1,917 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, beforeAll, describe, expect, test } from "bun:test"; +import { createHash } from "node:crypto"; +import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { + createAgentApiClient, + createCommandQueue, + createLogger, + type TransportCommandFrame, +} from "../agent"; +import { openTestEvent } from "../agent/test-events"; +import { fingerprint, generateSigningKeyPair, ready } from "../crypto"; +import { createZipBuffer } from "../files"; +import { + createCoreRegistry, + createInMemoryTrustContext, + createSignedCommand, + PROTOCOL_VERSION, + ProtocolError, + type ServerInstallModpackAcceptedEvent, + type ServerInstallModpackProgressEvent, + type ServerInstallModpackResultEvent, + type ServerInstallModpackStatusResult, + serverInstallModpackProgressEventSchema, + serverInstallModpackResultEventSchema, + signRoleGrant, + signSessionCertificate, + type TransportFrame, +} from "../protocol"; +import type { FetchLike } from "../server/download"; +import { readServerMetadata, type ServerMetadata, writeServerMetadata } from "../server/registry"; +import { createModpackInstaller, registerModpackHandlers } from "./modpack-installer"; + +const tempDirs: string[] = []; + +function makeTempDir(prefix: string): string { + const dir = mkdtempSync(join(tmpdir(), prefix)); + tempDirs.push(dir); + return dir; +} + +function sha1Hex(data: Uint8Array): string { + return createHash("sha1").update(data).digest("hex"); +} + +function sha256Hex(data: Uint8Array): string { + return createHash("sha256").update(data).digest("hex"); +} + +function sha512Hex(data: Uint8Array): string { + return createHash("sha512").update(data).digest("hex"); +} + +function createTestServer( + serversDir: string, + serverId: string, + overrides: Partial = {}, +): ServerMetadata { + const serverDir = join(serversDir, serverId); + mkdirSync(serverDir, { recursive: true }); + writeFileSync(join(serverDir, "start.sh"), "#!/bin/sh\necho original\n", "utf8"); + const meta: ServerMetadata = { + v: 1, + id: serverId, + name: "Modpack Server", + minecraft_version: "1.21.1", + loader: "fabric", + loader_version: "0.16.5", + memory_mb: 4096, + jvm_args: [], + port: 25565, + created_at: 1_700_000_000_000, + ...overrides, + }; + writeServerMetadata(serversDir, meta); + return meta; +} + +function makeMockFetch( + routes: Readonly Response | Promise>>, +): FetchLike { + return async (input) => { + const url = typeof input === "string" ? input : input.toString(); + const handler = routes[url]; + if (!handler) { + return new Response("Not Found", { status: 404 }); + } + return await handler(); + }; +} + +function deferred() { + let resolve!: (value: T) => void; + let reject!: (reason?: unknown) => void; + const promise = new Promise((res, rej) => { + resolve = res; + reject = rej; + }); + return { promise, resolve, reject }; +} + +beforeAll(async () => { + await ready(); +}); + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir !== undefined) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +describe("Background server.install_modpack", () => { + test("happy path with official server pack: downloads, verifies hash, preserves protected files, records origin", async () => { + const root = makeTempDir("tegrad-mpi-sp-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + createTestServer(serversDir, "smp"); + + const modJar = new Uint8Array(Buffer.from("official-server-mod")); + const packZip = createZipBuffer([ + { name: "mods/lithium.jar", data: modJar }, + { name: "config/lithium.properties", data: new Uint8Array(Buffer.from("enabled=true\n")) }, + ]); + const packSha256 = sha256Hex(packZip); + + const progressEvents: ServerInstallModpackProgressEvent[] = []; + const resultEvents: ServerInstallModpackResultEvent[] = []; + + const installer = createModpackInstaller({ + stateDir, + serversDir, + isServerActive: async () => false, + fetchImpl: makeMockFetch({ + "https://edge.forgecdn.net/files/1/2/serverpack.zip": () => + new Response(new Uint8Array(packZip), { status: 200 }), + }), + resolveModpack: async () => ({ + server_pack: { + url: "https://edge.forgecdn.net/files/1/2/serverpack.zip", + sha256: packSha256, + name: "serverpack.zip", + size: packZip.byteLength, + }, + files: [], + minecraft_version: "1.21.1", + loader: "fabric", + loader_version: "0.16.5", + }), + onProgress: (ev) => progressEvents.push(serverInstallModpackProgressEventSchema.parse(ev)), + onResult: (ev) => resultEvents.push(serverInstallModpackResultEventSchema.parse(ev)), + }); + + const accepted = await installer.startInstall({ + server_id: "smp", + source: "curseforge", + modpack_id: "555", + version_id: "999", + modpack_name: "Better MC", + version_label: "v42", + }); + expect(accepted.server_id).toBe("smp"); + expect(accepted.job_id.startsWith("mpi-")).toBe(true); + + await installer.waitForActiveJobs(); + + expect(resultEvents).toHaveLength(1); + expect(resultEvents[0]).toEqual({ + job_id: accepted.job_id, + server_id: "smp", + ok: true, + installed: 1, + skipped: [], + }); + expect(progressEvents.map((e) => e.phase)).toContain("resolving"); + expect(progressEvents.map((e) => e.phase)).toContain("downloading"); + expect(progressEvents.map((e) => e.phase)).toContain("extracting"); + expect(progressEvents.map((e) => e.phase)).toContain("finalizing"); + + expect(readFileSync(join(serversDir, "smp", "mods", "lithium.jar"))).toEqual( + Buffer.from(modJar), + ); + expect(readFileSync(join(serversDir, "smp", "config", "lithium.properties"), "utf8")).toBe( + "enabled=true\n", + ); + expect(readFileSync(join(serversDir, "smp", "start.sh"), "utf8")).toBe( + "#!/bin/sh\necho original\n", + ); + + const meta = readServerMetadata(serversDir, "smp"); + expect(meta.origin).toEqual({ + kind: "modpack", + source: "curseforge", + modpack_id: "555", + version_id: "999", + modpack_name: "Better MC", + }); + expect(meta.mods).toHaveLength(1); + expect(meta.mods?.[0]?.file).toBe("lithium.jar"); + expect(meta.mods?.[0]?.layer).toBe("origin"); + + const status = installer.getStatus("smp"); + expect(status.job?.status).toBe("completed"); + expect(status.job?.installed).toBe(1); + }); + + test("happy path with mod list: filters client-only mods, keeps unknown env, applies server overrides only", async () => { + const root = makeTempDir("tegrad-mpi-mods-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + createTestServer(serversDir, "smp"); + + const serverMod = new Uint8Array(Buffer.from("server-mod-bytes")); + const unknownEnvMod = new Uint8Array(Buffer.from("unknown-env-mod-bytes")); + const overridesZip = createZipBuffer([ + { name: "overrides/config/common.toml", data: new Uint8Array(Buffer.from("base=1\n")) }, + { name: "overrides/config/shared.toml", data: new Uint8Array(Buffer.from("from=base\n")) }, + { + name: "server-overrides/config/shared.toml", + data: new Uint8Array(Buffer.from("from=server\n")), + }, + { name: "client-overrides/options.txt", data: new Uint8Array(Buffer.from("fov:100\n")) }, + { name: "overrides/start.sh", data: new Uint8Array(Buffer.from("rm -rf /\n")) }, + { name: "overrides/tegrad-server.json", data: new Uint8Array(Buffer.from("{}\n")) }, + ]); + + const fetchedUrls: string[] = []; + const resultEvents: ServerInstallModpackResultEvent[] = []; + + const installer = createModpackInstaller({ + stateDir, + serversDir, + isServerActive: async () => false, + fetchImpl: makeMockFetch({ + "https://edge.forgecdn.net/files/10/1/server-mod.jar": () => { + fetchedUrls.push("server-mod"); + return new Response(new Uint8Array(serverMod), { status: 200 }); + }, + "https://edge.forgecdn.net/files/10/2/unknown-mod.jar": () => { + fetchedUrls.push("unknown-mod"); + return new Response(new Uint8Array(unknownEnvMod), { status: 200 }); + }, + "https://edge.forgecdn.net/files/10/3/client-only.jar": () => { + fetchedUrls.push("client-only"); + return new Response(new Uint8Array(Buffer.from("nope")), { status: 200 }); + }, + "https://edge.forgecdn.net/files/10/99/pack.zip": () => + new Response(new Uint8Array(overridesZip), { status: 200 }), + }), + resolveModpack: async () => ({ + files: [ + { + name: "server-mod.jar", + url: "https://edge.forgecdn.net/files/10/1/server-mod.jar", + sha1: sha1Hex(serverMod), + environment: { client: "required", server: "required" }, + project_id: "101", + version_id: "201", + }, + { + name: "unknown-mod.jar", + url: "https://edge.forgecdn.net/files/10/2/unknown-mod.jar", + sha1: sha1Hex(unknownEnvMod), + environment: { client: "unknown", server: "unknown" }, + project_id: "102", + version_id: "202", + }, + { + name: "client-only.jar", + url: "https://edge.forgecdn.net/files/10/3/client-only.jar", + environment: { client: "required", server: "unsupported" }, + project_id: "103", + version_id: "203", + }, + ], + overrides: { + url: "https://edge.forgecdn.net/files/10/99/pack.zip", + sha1: sha1Hex(overridesZip), + prefix: "overrides", + format: "zip", + }, + minecraft_version: "1.21.1", + loader: "fabric", + }), + onResult: (ev) => resultEvents.push(ev), + }); + + await installer.startInstall({ + server_id: "smp", + source: "curseforge", + modpack_id: "444", + version_id: "888", + modpack_name: "Pack With Mods", + }); + await installer.waitForActiveJobs(); + + expect(resultEvents[0]).toMatchObject({ ok: true, installed: 2, skipped: [] }); + expect(fetchedUrls.sort()).toEqual(["server-mod", "unknown-mod"]); + expect(existsSync(join(serversDir, "smp", "mods", "client-only.jar"))).toBe(false); + expect(existsSync(join(serversDir, "smp", "options.txt"))).toBe(false); + expect(readFileSync(join(serversDir, "smp", "config", "common.toml"), "utf8")).toBe("base=1\n"); + expect(readFileSync(join(serversDir, "smp", "config", "shared.toml"), "utf8")).toBe( + "from=server\n", + ); + expect(readFileSync(join(serversDir, "smp", "start.sh"), "utf8")).toBe( + "#!/bin/sh\necho original\n", + ); + }); + + test("happy path with Modrinth .mrpack: reads modrinth.index.json and installs mods + overrides", async () => { + const root = makeTempDir("tegrad-mpi-mrpack-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + createTestServer(serversDir, "smp"); + + const modBytes = new Uint8Array(Buffer.from("fabric-api-jar")); + const indexJson = JSON.stringify({ + formatVersion: 1, + game: "minecraft", + files: [ + { + path: "mods/fabric-api.jar", + hashes: { sha1: sha1Hex(modBytes), sha512: sha512Hex(modBytes) }, + env: { client: "required", server: "required" }, + downloads: ["https://cdn.modrinth.com/data/P7dR8mSH/versions/1/fabric-api.jar"], + fileSize: modBytes.byteLength, + }, + { + path: "mods/iris.jar", + hashes: { sha1: sha1Hex(new Uint8Array(Buffer.from("iris"))) }, + env: { client: "required", server: "unsupported" }, + downloads: ["https://cdn.modrinth.com/data/YL57xq9U/versions/1/iris.jar"], + }, + ], + dependencies: { minecraft: "1.21.1", "fabric-loader": "0.16.5" }, + }); + const mrpackZip = createZipBuffer([ + { name: "modrinth.index.json", data: new Uint8Array(Buffer.from(indexJson)) }, + { name: "overrides/config/fabric.json", data: new Uint8Array(Buffer.from('{"ok":true}')) }, + ]); + + const resultEvents: ServerInstallModpackResultEvent[] = []; + const installer = createModpackInstaller({ + stateDir, + serversDir, + isServerActive: async () => false, + fetchImpl: makeMockFetch({ + "https://cdn.modrinth.com/data/pack/versions/1/pack.mrpack": () => + new Response(new Uint8Array(mrpackZip), { status: 200 }), + "https://cdn.modrinth.com/data/P7dR8mSH/versions/1/fabric-api.jar": () => + new Response(new Uint8Array(modBytes), { status: 200 }), + }), + resolveModpack: async () => ({ + files: [], + overrides: { + url: "https://cdn.modrinth.com/data/pack/versions/1/pack.mrpack", + sha1: sha1Hex(mrpackZip), + format: "mrpack", + }, + minecraft_version: "1.21.1", + loader: "fabric", + }), + onResult: (ev) => resultEvents.push(ev), + }); + + await installer.startInstall({ + server_id: "smp", + source: "modrinth", + modpack_id: "sop", + version_id: "v1", + }); + await installer.waitForActiveJobs(); + + expect(resultEvents[0]).toMatchObject({ ok: true, installed: 1, skipped: [] }); + expect(existsSync(join(serversDir, "smp", "mods", "fabric-api.jar"))).toBe(true); + expect(existsSync(join(serversDir, "smp", "mods", "iris.jar"))).toBe(false); + expect(readFileSync(join(serversDir, "smp", "config", "fabric.json"), "utf8")).toBe( + '{"ok":true}', + ); + }); + + test("disallowed host and blocked files become skipped with reasons while valid mods install", async () => { + const root = makeTempDir("tegrad-mpi-skip-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + createTestServer(serversDir, "smp"); + + const okMod = new Uint8Array(Buffer.from("valid-mod")); + const resultEvents: ServerInstallModpackResultEvent[] = []; + + const installer = createModpackInstaller({ + stateDir, + serversDir, + isServerActive: async () => false, + fetchImpl: makeMockFetch({ + "https://cdn.modrinth.com/ok.jar": () => + new Response(new Uint8Array(okMod), { status: 200 }), + }), + resolveModpack: async () => ({ + files: [ + { + name: "ok.jar", + url: "https://cdn.modrinth.com/ok.jar", + sha256: sha256Hex(okMod), + }, + { + name: "evil-host.jar", + url: "https://evil.example.org/evil-host.jar", + }, + { + name: "restricted.jar", + blocked: true, + blocked_reason: "distribution_disabled", + }, + ], + minecraft_version: "1.21.1", + loader: "fabric", + }), + onResult: (ev) => resultEvents.push(ev), + }); + + await installer.startInstall({ + server_id: "smp", + source: "curseforge", + modpack_id: "123", + version_id: "456", + }); + await installer.waitForActiveJobs(); + + expect(resultEvents[0]?.ok).toBe(true); + expect(resultEvents[0]?.installed).toBe(1); + expect(resultEvents[0]?.skipped).toEqual([ + { name: "evil-host.jar", reason: "host_not_allowed" }, + { name: "restricted.jar", reason: "distribution_disabled" }, + ]); + }); + + test("hash mismatch aborts with cleanup of written files and leaves metadata untouched", async () => { + const root = makeTempDir("tegrad-mpi-hash-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + createTestServer(serversDir, "smp"); + + const firstMod = new Uint8Array(Buffer.from("first-mod")); + const corruptMod = new Uint8Array(Buffer.from("corrupted-bytes")); + const resultEvents: ServerInstallModpackResultEvent[] = []; + + const installer = createModpackInstaller({ + stateDir, + serversDir, + concurrency: 1, + isServerActive: async () => false, + fetchImpl: makeMockFetch({ + "https://cdn.modrinth.com/a.jar": () => + new Response(new Uint8Array(firstMod), { status: 200 }), + "https://cdn.modrinth.com/b.jar": () => + new Response(new Uint8Array(corruptMod), { status: 200 }), + }), + resolveModpack: async () => ({ + files: [ + { name: "a.jar", url: "https://cdn.modrinth.com/a.jar", sha256: sha256Hex(firstMod) }, + { name: "b.jar", url: "https://cdn.modrinth.com/b.jar", sha256: "0".repeat(64) }, + ], + minecraft_version: "1.21.1", + loader: "fabric", + }), + onResult: (ev) => resultEvents.push(ev), + }); + + await installer.startInstall({ + server_id: "smp", + source: "modrinth", + modpack_id: "p1", + version_id: "v1", + }); + await installer.waitForActiveJobs(); + + expect(resultEvents[0]).toMatchObject({ + ok: false, + installed: 0, + error_code: "hash_mismatch", + }); + expect(existsSync(join(serversDir, "smp", "mods", "a.jar"))).toBe(false); + expect(existsSync(join(serversDir, "smp", "mods", "b.jar"))).toBe(false); + const meta = readServerMetadata(serversDir, "smp"); + expect(meta.origin).toBeUndefined(); + expect(meta.mods).toBeUndefined(); + }); + + test("resumes after restart, only downloading remaining files without re-resolving API", async () => { + const root = makeTempDir("tegrad-mpi-resume-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + createTestServer(serversDir, "smp"); + + const mod1 = new Uint8Array(Buffer.from("mod-one")); + const mod2 = new Uint8Array(Buffer.from("mod-two")); + const mod2Started = deferred(); + const mod2Hold = deferred(); + + let resolveCalls = 0; + const mod1Downloads: number[] = []; + + const installer1 = createModpackInstaller({ + stateDir, + serversDir, + concurrency: 1, + isServerActive: async () => false, + fetchImpl: makeMockFetch({ + "https://cdn.modrinth.com/mod1.jar": () => { + mod1Downloads.push(1); + return new Response(new Uint8Array(mod1), { status: 200 }); + }, + "https://cdn.modrinth.com/mod2.jar": async () => { + mod2Started.resolve(); + return await mod2Hold.promise; + }, + }), + resolveModpack: async () => { + resolveCalls++; + return { + files: [ + { name: "mod1.jar", url: "https://cdn.modrinth.com/mod1.jar", sha256: sha256Hex(mod1) }, + { name: "mod2.jar", url: "https://cdn.modrinth.com/mod2.jar", sha256: sha256Hex(mod2) }, + ], + minecraft_version: "1.21.1", + loader: "fabric", + }; + }, + }); + + await installer1.startInstall({ + server_id: "smp", + source: "modrinth", + modpack_id: "pack", + version_id: "v1", + }); + await mod2Started.promise; + + // Simulate abrupt shutdown while mod2 is in flight. + mod2Hold.reject(new Error("aborted")); + await installer1.close(); + + expect(existsSync(join(serversDir, "smp", "mods", "mod1.jar"))).toBe(true); + expect(mod1Downloads).toHaveLength(1); + expect(resolveCalls).toBe(1); + + const results2: ServerInstallModpackResultEvent[] = []; + const installer2 = createModpackInstaller({ + stateDir, + serversDir, + concurrency: 1, + isServerActive: async () => false, + fetchImpl: makeMockFetch({ + "https://cdn.modrinth.com/mod1.jar": () => { + mod1Downloads.push(2); + return new Response(new Uint8Array(mod1), { status: 200 }); + }, + "https://cdn.modrinth.com/mod2.jar": () => + new Response(new Uint8Array(mod2), { status: 200 }), + }), + resolveModpack: async () => { + resolveCalls++; + throw new Error("Should not re-resolve API after resume"); + }, + onResult: (ev) => results2.push(ev), + }); + + installer2.start(); + await installer2.waitForActiveJobs(); + + expect(resolveCalls).toBe(1); + expect(mod1Downloads).toHaveLength(1); + expect(results2[0]).toMatchObject({ ok: true, installed: 2, skipped: [] }); + expect(existsSync(join(serversDir, "smp", "mods", "mod2.jar"))).toBe(true); + }); + + test("rejects second concurrent request with install_in_progress and rejects running server with server_running", async () => { + const root = makeTempDir("tegrad-mpi-guards-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + createTestServer(serversDir, "smp"); + createTestServer(serversDir, "active-srv"); + + const gate = deferred(); + const installer = createModpackInstaller({ + stateDir, + serversDir, + isServerActive: async (id) => id === "active-srv", + resolveModpack: async () => { + await gate.promise; + return { files: [], minecraft_version: "1.21.1", loader: "fabric" }; + }, + }); + + // Running server refused + await expect( + installer.startInstall({ + server_id: "active-srv", + source: "tegra", + modpack_id: "p", + version_id: "v", + }), + ).rejects.toMatchObject({ code: "server_running" }); + + // Start first job and hold resolving + await installer.startInstall({ + server_id: "smp", + source: "tegra", + modpack_id: "p", + version_id: "v", + }); + + // Second request for same server refused + await expect( + installer.startInstall({ + server_id: "smp", + source: "tegra", + modpack_id: "p", + version_id: "v", + }), + ).rejects.toMatchObject({ code: "install_in_progress" }); + + gate.resolve(); + await installer.waitForActiveJobs(); + }); + + test("rejects path traversal in overrides ZIP with cleanup", async () => { + const root = makeTempDir("tegrad-mpi-zipslip-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + createTestServer(serversDir, "smp"); + + const mod = new Uint8Array(Buffer.from("mod-ok")); + const evilZip = createZipBuffer([ + { name: "overrides/../../etc/passwd", data: new Uint8Array(Buffer.from("pwned")) }, + ]); + + const resultEvents: ServerInstallModpackResultEvent[] = []; + const installer = createModpackInstaller({ + stateDir, + serversDir, + isServerActive: async () => false, + fetchImpl: makeMockFetch({ + "https://cdn.modrinth.com/mod.jar": () => + new Response(new Uint8Array(mod), { status: 200 }), + "https://cdn.modrinth.com/evil.zip": () => + new Response(new Uint8Array(evilZip), { status: 200 }), + }), + resolveModpack: async () => ({ + files: [ + { name: "mod.jar", url: "https://cdn.modrinth.com/mod.jar", sha256: sha256Hex(mod) }, + ], + overrides: { + url: "https://cdn.modrinth.com/evil.zip", + sha256: sha256Hex(evilZip), + format: "zip", + }, + minecraft_version: "1.21.1", + loader: "fabric", + }), + onResult: (ev) => resultEvents.push(ev), + }); + + await installer.startInstall({ + server_id: "smp", + source: "curseforge", + modpack_id: "1", + version_id: "2", + }); + await installer.waitForActiveJobs(); + + expect(resultEvents[0]?.ok).toBe(false); + expect(resultEvents[0]?.error_code).toBe("pack_unavailable"); + expect(existsSync(join(serversDir, "smp", "mods", "mod.jar"))).toBe(false); + }); + + test("enforces editor role and account key sensitivity on CommandQueue and supports status + cancel", async () => { + const root = makeTempDir("tegrad-mpi-queue-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + createTestServer(serversDir, "smp"); + + const agent = generateSigningKeyPair(); + const owner = generateSigningKeyPair(); + const viewer = generateSigningKeyPair(); + const session = generateSigningKeyPair(); + const nowMs = 1_700_000_000_000; + + const ownerCert = signSessionCertificate({ + sessionPublicKey: session.publicKey, + accountKeyPair: owner, + notBefore: nowMs - 1000, + notAfter: nowMs + 3_600_000, + }); + + const viewerGrant = signRoleGrant({ + granter: owner, + accountPublicKey: viewer.publicKey, + agent: fingerprint(agent.publicKey), + role: "viewer", + servers: "*", + issuedAt: nowMs - 1000, + expiresAt: nowMs + 3_600_000, + }); + + const registry = createCoreRegistry(); + const trust = createInMemoryTrustContext({ + agentKeyPair: agent, + trustedAccountKeys: [owner.publicKey], + now: () => nowMs, + }); + + const frames: TransportFrame[] = []; + const queue = createCommandQueue({ + trust, + registry, + sendFrame: (f) => frames.push(f), + logger: createLogger({ level: "error", stdout: () => {}, stderr: () => {} }), + }); + + const holdResolve = deferred(); + const installer = createModpackInstaller({ + stateDir, + serversDir, + now: () => nowMs, + isServerActive: async () => false, + resolveModpack: async (_req, signal) => { + await new Promise((resolve, reject) => { + if (signal?.aborted) { + reject(new ProtocolError("cancelled", "aborted")); + return; + } + signal?.addEventListener( + "abort", + () => reject(new ProtocolError("cancelled", "aborted")), + { + once: true, + }, + ); + void holdResolve.promise.then(resolve); + }); + return { files: [], minecraft_version: "1.21.1", loader: "fabric" }; + }, + onProgress: (ev) => { + queue.publish("server.modpack", "server.install_modpack.progress", ev, { + serverId: ev.server_id, + }); + }, + onResult: (ev) => { + queue.publish("server.modpack", "server.install_modpack.result", ev, { + serverId: ev.server_id, + }); + }, + }); + registerModpackHandlers(queue, installer); + + let counter = 1; + const sendCmd = async ( + type: string, + body: unknown, + opts: { signer: typeof owner; session?: typeof ownerCert; replyTo?: typeof owner.publicKey }, + ) => { + const signed = createSignedCommand( + { + type, + body, + agentPublicKey: agent.publicKey, + signer: opts.signer, + ...(opts.session !== undefined ? { session: opts.session } : {}), + ...(opts.replyTo !== undefined ? { replyTo: opts.replyTo } : {}), + counter: counter++, + now: nowMs, + }, + registry, + ); + const frame: TransportCommandFrame = { + v: PROTOCOL_VERSION, + kind: "command", + route: { agent: fingerprint(agent.publicKey) }, + body: signed, + }; + await queue.enqueue(frame); + return frames.filter((f) => f.kind === "ack").at(-1); + }; + + // Grant viewer role via signed role grant + const grantAck = await sendCmd( + "agent.members.set", + { grant: viewerGrant }, + { signer: owner, replyTo: session.publicKey }, + ); + expect(grantAck?.kind === "ack" && grantAck.body.ok).toBe(true); + + // 1. Viewer denied + const viewerAck = await sendCmd( + "server.install_modpack", + { server_id: "smp", source: "tegra", modpack_id: "a", version_id: "b" }, + { signer: viewer }, + ); + expect(viewerAck?.kind === "ack" && viewerAck.body.ok === false && viewerAck.body.code).toBe( + "insufficient_role", + ); + + // 2. Session key (without account key) denied for sensitive command + const sessionAck = await sendCmd( + "server.install_modpack", + { server_id: "smp", source: "tegra", modpack_id: "a", version_id: "b" }, + { signer: session, session: ownerCert, replyTo: session.publicKey }, + ); + expect(sessionAck?.kind === "ack" && sessionAck.body.ok === false && sessionAck.body.code).toBe( + "sensitive_requires_account_key", + ); + + // Subscribe via session to receive pubsub events + await sendCmd( + "agent.subscribe", + { topics: ["server.modpack"] }, + { signer: session, session: ownerCert, replyTo: session.publicKey }, + ); + + // 3. Owner account key accepted immediately + const ownerAck = await sendCmd( + "server.install_modpack", + { server_id: "smp", source: "tegra", modpack_id: "a", version_id: "b" }, + { signer: owner, replyTo: session.publicKey }, + ); + expect(ownerAck?.kind === "ack" && ownerAck.body.ok).toBe(true); + + const acceptedEvent = frames + .filter((f): f is Extract => f.kind === "event") + .map((f) => openTestEvent(f.body, agent.publicKey, session)) + .find((e) => e.header.type === "server.install_modpack.accepted"); + expect(acceptedEvent).toBeDefined(); + const acceptedBody = acceptedEvent?.body as ServerInstallModpackAcceptedEvent; + expect(acceptedBody.server_id).toBe("smp"); + + // 4. Status query while running + await sendCmd( + "server.install_modpack.status", + { server_id: "smp" }, + { signer: session, session: ownerCert, replyTo: session.publicKey }, + ); + const statusEvent = frames + .filter((f): f is Extract => f.kind === "event") + .map((f) => openTestEvent(f.body, agent.publicKey, session)) + .filter((e) => e.header.type === "server.install_modpack.status.result") + .at(-1)?.body as ServerInstallModpackStatusResult; + expect(statusEvent.job?.status).toBe("running"); + + // 5. Cancel command aborts running job and emits cancelled result + await sendCmd( + "server.install_modpack.cancel", + { server_id: "smp", job_id: acceptedBody.job_id }, + { signer: session, session: ownerCert, replyTo: session.publicKey }, + ); + await installer.waitForActiveJobs(); + + const resultEvent = frames + .filter((f): f is Extract => f.kind === "event") + .map((f) => openTestEvent(f.body, agent.publicKey, session)) + .find((e) => e.header.type === "server.install_modpack.result")?.body as + | ServerInstallModpackResultEvent + | undefined; + expect(resultEvent).toEqual({ + job_id: acceptedBody.job_id, + server_id: "smp", + ok: false, + installed: 0, + skipped: [], + error_code: "cancelled", + }); + + // Also verify createAgentApiClient.resolveModpack integration against local Bun server + const server = Bun.serve({ + port: 0, + hostname: "127.0.0.1", + fetch: async (req) => { + const url = new URL(req.url); + if (req.method === "POST" && url.pathname === "/v1/agents/self/modpacks/resolve") { + return new Response( + JSON.stringify({ + files: [{ name: "a.jar", url: "https://cdn.modrinth.com/a.jar" }], + minecraft_version: "1.21.1", + loader: "fabric", + }), + { status: 200 }, + ); + } + return new Response("not found", { status: 404 }); + }, + }); + try { + const apiClient = createAgentApiClient({ + apiUrl: `http://127.0.0.1:${server.port}`, + agentKeyPair: agent, + allowInsecure: true, + now: () => nowMs, + }); + const resolved = await apiClient.resolveModpack({ + source: "modrinth", + modpack_id: "p1", + version_id: "v1", + }); + expect(resolved.minecraft_version).toBe("1.21.1"); + expect(resolved.files).toHaveLength(1); + } finally { + void server.stop(true); + } + }); +}); diff --git a/src/state/modpack-installer.ts b/src/state/modpack-installer.ts new file mode 100644 index 0000000..31c68f5 --- /dev/null +++ b/src/state/modpack-installer.ts @@ -0,0 +1,1281 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { createHash, randomBytes, timingSafeEqual } from "node:crypto"; +import { existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, unlinkSync } from "node:fs"; +import { basename, join } from "node:path"; +import { z } from "zod"; +import { + AgentApiError, + type ResolvedModpack, + type ResolvedModpackFile, + type ResolveModpackRequest, +} from "../agent/api-client"; +import type { CommandQueue } from "../agent/jobs"; +import type { Logger } from "../agent/logger"; +import { writeFileAtomic } from "../agent/state"; +import { redactUrlQueryStrings } from "../backup/config"; +import { + FileManagerError, + readZipEntryFromBuffer, + resolveConfinedPath, + safeUnzipBuffer, + safeUnzipPrefixesFromBuffer, + validateSingleFileName, + writeConfinedFileAtomic, +} from "../files"; +import { + type ModpackInstallErrorCode, + type ModpackInstallJobState, + type ModpackInstallJobStatus, + type ModpackInstallPhase, + type ModpackInstallSkippedItem, + type ModpackSource, + modpackInstallErrorCodeSchema, + modpackInstallJobStateSchema, + modpackInstallPhaseSchema, + modpackInstallSkippedItemSchema, + modpackSourceSchema, + ProtocolError, + type ServerInstallModpackBody, + type ServerInstallModpackCancelBody, + type ServerInstallModpackProgressEvent, + type ServerInstallModpackResultEvent, + type ServerInstallModpackStatusResult, + type ServerModEntry, + type ServerOrigin, + type ServerOriginSyncState, + serverInstallModpackBodySchema, + serverInstallModpackCancelBodySchema, + serverModEntrySchema, +} from "../protocol"; +import type { FetchLike } from "../server/download"; +import { assertValidServerId, DEFAULT_SERVERS_DIR } from "../server/id"; +import { createServerPermissionContext, type PermissionContext } from "../server/permissions"; +import { readServerMetadata, type ServerMetadata, writeServerMetadata } from "../server/registry"; +import { + buildAllowedDownloadHosts, + DEFAULT_MAX_MOD_BYTES, + DEFAULT_MAX_SERVERPACK_BYTES, + downloadVerifiedBuffer, + isUrlHostAllowed, +} from "./download"; +import { indexExtractedServerPackFiles, PROTECTED_SERVERPACK_PATHS } from "./manager"; +import { + isClientOnly, + isServerContentPath, + modIdentityKey, + normalizeRelativePath, +} from "./sync-plan"; + +const MODS_DIR = "mods"; +const JOBS_SUBDIR = "modpack-installs"; +const DEFAULT_CONCURRENCY = 4; + +export interface ModpackInstallerOptions { + readonly stateDir: string; + readonly serversDir?: string; + readonly cdnHost?: string; + readonly extraAllowedHosts?: readonly string[]; + readonly fetchImpl?: FetchLike; + readonly maxModBytes?: number; + readonly maxServerPackBytes?: number; + readonly maxRedirects?: number; + readonly downloadTimeoutMs?: number; + readonly concurrency?: number; + readonly now?: () => number; + readonly logger?: Logger; + readonly serverGroupId?: number | null; + readonly isServerActive: (serverId: string) => Promise; + readonly resolveModpack: ( + request: ResolveModpackRequest, + signal?: AbortSignal, + ) => Promise; + readonly onProgress?: (event: ServerInstallModpackProgressEvent) => void; + readonly onResult?: (event: ServerInstallModpackResultEvent) => void; +} + +export interface StartModpackInstallResult { + readonly job_id: string; + readonly server_id: string; +} + +export interface CancelModpackInstallResult { + readonly server_id: string; + readonly job_id?: string | undefined; + readonly cancelled: boolean; +} + +export interface ModpackInstaller { + startInstall(params: ServerInstallModpackBody): Promise; + getStatus(serverId: string): ServerInstallModpackStatusResult; + cancelInstall(params: ServerInstallModpackCancelBody): CancelModpackInstallResult; + start(): void; + waitForActiveJobs(): Promise; + close(): Promise; +} + +const persistedResolvedSchema = z.object({ + server_pack: z + .object({ + url: z.string(), + sha1: z.string().optional(), + sha256: z.string().optional(), + sha512: z.string().optional(), + name: z.string(), + size: z.number().int().nonnegative().optional(), + }) + .optional(), + files: z.array( + z.object({ + name: z.string(), + path: z.string().optional(), + url: z.string().optional(), + sha1: z.string().optional(), + sha256: z.string().optional(), + sha512: z.string().optional(), + size: z.number().int().nonnegative().optional(), + environment: z + .object({ + client: z.enum(["required", "optional", "unsupported", "unknown"]).optional(), + server: z.enum(["required", "optional", "unsupported", "unknown"]).optional(), + }) + .optional(), + project_id: z.string().optional(), + version_id: z.string().optional(), + blocked: z.boolean().optional(), + blocked_reason: z.string().optional(), + }), + ), + overrides: z + .object({ + url: z.string(), + sha1: z.string().optional(), + sha256: z.string().optional(), + sha512: z.string().optional(), + size: z.number().int().nonnegative().optional(), + prefix: z.string().optional(), + format: z.enum(["mrpack", "zip"]).optional(), + }) + .optional(), + minecraft_version: z.string(), + loader: z.string(), + loader_version: z.string().optional(), +}); + +const persistedJobSchema = z.object({ + v: z.literal(1), + job_id: z.string().min(1), + server_id: z.string().min(1), + source: modpackSourceSchema, + modpack_id: z.string().min(1), + version_id: z.string().min(1), + modpack_name: z.string().optional(), + version_label: z.string().optional(), + status: modpackInstallJobStateSchema, + phase: modpackInstallPhaseSchema, + done: z.number().int().nonnegative(), + total: z.number().int().nonnegative(), + current: z.string().optional(), + installed: z.number().int().nonnegative(), + skipped: z.array(modpackInstallSkippedItemSchema), + error_code: modpackInstallErrorCodeSchema.optional(), + started_at: z.number().int().nonnegative(), + updated_at: z.number().int().nonnegative(), + finished_at: z.number().int().nonnegative().optional(), + resolved: persistedResolvedSchema.optional(), + server_pack_extracted: z.boolean().optional(), + overrides_extracted: z.boolean().optional(), + completed_files: z.array(z.string()).default([]), + written_paths: z.array(z.string()).default([]), + installed_mods: z.array(serverModEntrySchema).default([]), + synced_files: z.array(z.string()).default([]), +}); + +interface PersistedJobRecord { + readonly v: 1; + readonly job_id: string; + readonly server_id: string; + readonly source: ModpackSource; + readonly modpack_id: string; + readonly version_id: string; + readonly modpack_name?: string | undefined; + readonly version_label?: string | undefined; + status: ModpackInstallJobState; + phase: ModpackInstallPhase; + done: number; + total: number; + current?: string | undefined; + installed: number; + skipped: ModpackInstallSkippedItem[]; + error_code?: ModpackInstallErrorCode | undefined; + readonly started_at: number; + updated_at: number; + finished_at?: number | undefined; + resolved?: ResolvedModpack | undefined; + server_pack_extracted?: boolean | undefined; + overrides_extracted?: boolean | undefined; + completed_files: string[]; + written_paths: string[]; + installed_mods: ServerModEntry[]; + synced_files: string[]; +} + +const mrpackIndexSchema = z.object({ + files: z.array( + z.object({ + path: z.string().min(1), + hashes: z + .object({ + sha1: z.string().optional(), + sha512: z.string().optional(), + }) + .optional(), + env: z + .object({ + client: z.enum(["required", "optional", "unsupported", "unknown"]).optional(), + server: z.enum(["required", "optional", "unsupported", "unknown"]).optional(), + }) + .optional(), + downloads: z.array(z.string()).default([]), + fileSize: z.number().int().nonnegative().optional(), + }), + ), +}); + +function toJobStatusSnapshot(record: PersistedJobRecord): ModpackInstallJobStatus { + return { + job_id: record.job_id, + server_id: record.server_id, + source: record.source, + modpack_id: record.modpack_id, + version_id: record.version_id, + ...(record.modpack_name !== undefined ? { modpack_name: record.modpack_name } : {}), + ...(record.version_label !== undefined ? { version_label: record.version_label } : {}), + status: record.status, + phase: record.phase, + done: record.done, + total: record.total, + ...(record.current !== undefined ? { current: record.current } : {}), + installed: record.installed, + skipped: [...record.skipped], + ...(record.error_code !== undefined ? { error_code: record.error_code } : {}), + started_at: record.started_at, + updated_at: record.updated_at, + ...(record.finished_at !== undefined ? { finished_at: record.finished_at } : {}), + }; +} + +function classifyInstallError(err: unknown): ModpackInstallErrorCode { + if (err instanceof AgentApiError) { + if (err.code === "aborted") { + return "cancelled"; + } + if (err.code === "http_error" && err.status === 404) { + return "pack_unavailable"; + } + return "api_unavailable"; + } + + if (err instanceof FileManagerError) { + switch (err.code) { + case "zip_too_large": + case "zip_entry_too_large": + case "zip_compression_ratio_exceeded": + case "file_too_large": + return "too_large"; + case "zip_slip": + case "path_traversal": + case "zip_symlink_entry": + case "zip_invalid": + case "zip_crc_mismatch": + case "zip_unsupported_method": + case "zip_too_many_entries": + return "pack_unavailable"; + default: + return "io_error"; + } + } + + if (err instanceof ProtocolError) { + switch (err.code) { + case "hash_mismatch": + return "hash_mismatch"; + case "cancelled": + return "cancelled"; + case "host_not_allowed": + return "host_not_allowed"; + case "too_large": + return "too_large"; + case "server_running": + return "server_running"; + case "install_in_progress": + return "install_in_progress"; + case "api_unavailable": + return "api_unavailable"; + case "io_error": + return "io_error"; + case "pack_unavailable": + return "pack_unavailable"; + case "download_failed": { + const msg = err.message.toLowerCase(); + if (msg.includes("not allowed")) { + return "host_not_allowed"; + } + if (msg.includes("maximum allowed size")) { + return "too_large"; + } + return "pack_unavailable"; + } + default: + return "pack_unavailable"; + } + } + + if (typeof err === "object" && err !== null && "code" in err) { + const code = (err as { readonly code?: unknown }).code; + if (typeof code === "string" && /^[A-Z]/.test(code)) { + return "io_error"; + } + } + return "pack_unavailable"; +} + +function digestsEqual(actualHex: string, expectedHex: string): boolean { + const a = Buffer.from(actualHex.toLowerCase(), "hex"); + const b = Buffer.from(expectedHex.toLowerCase(), "hex"); + if (a.byteLength === 0 || a.byteLength !== b.byteLength) { + return false; + } + return timingSafeEqual(a, b); +} + +function fileMatchesExpectedHashes( + fullPath: string, + file: Pick, +): boolean { + const buf = readFileSync(fullPath); + if (file.sha1 !== undefined) { + const actual = createHash("sha1").update(buf).digest("hex"); + if (!digestsEqual(actual, file.sha1)) return false; + } + if (file.sha256 !== undefined) { + const actual = createHash("sha256").update(buf).digest("hex"); + if (!digestsEqual(actual, file.sha256)) return false; + } + if (file.sha512 !== undefined) { + const actual = createHash("sha512").update(buf).digest("hex"); + if (!digestsEqual(actual, file.sha512)) return false; + } + return true; +} + +function resolveModTargetRelPath(file: ResolvedModpackFile): string | null { + if (file.path !== undefined && file.path.trim().length > 0) { + const norm = normalizeRelativePath(file.path); + if (PROTECTED_SERVERPACK_PATHS.has(norm.toLowerCase())) { + return null; + } + if (norm.startsWith(`${MODS_DIR}/`) && !norm.slice(MODS_DIR.length + 1).includes("/")) { + const safeName = validateSingleFileName(norm.slice(MODS_DIR.length + 1)); + return `${MODS_DIR}/${safeName}`; + } + if (isServerContentPath(norm)) { + return norm; + } + return null; + } + + const safeName = validateSingleFileName(file.name); + return `${MODS_DIR}/${safeName}`; +} + +export function createModpackInstaller(options: ModpackInstallerOptions): ModpackInstaller { + const serversDir = options.serversDir ?? DEFAULT_SERVERS_DIR; + const jobsDir = join(options.stateDir, JOBS_SUBDIR); + const allowedHosts = buildAllowedDownloadHosts([ + options.cdnHost, + ...(options.extraAllowedHosts ?? []), + ]); + const maxModBytes = options.maxModBytes ?? DEFAULT_MAX_MOD_BYTES; + const maxServerPackBytes = options.maxServerPackBytes ?? DEFAULT_MAX_SERVERPACK_BYTES; + const concurrency = Math.max(1, options.concurrency ?? DEFAULT_CONCURRENCY); + const now = options.now ?? (() => Date.now()); + const permissionContext: PermissionContext = createServerPermissionContext({ + serversRoot: serversDir, + ...(options.serverGroupId !== undefined ? { serverGroupId: options.serverGroupId } : {}), + ...(options.logger !== undefined ? { logger: options.logger } : {}), + }); + + const activeRuns = new Map< + string, + { + readonly jobId: string; + readonly controller: AbortController; + readonly promise: Promise; + } + >(); + const startupChecks = new Set>(); + let closing = false; + + function jobFilePath(serverId: string): string { + return join(jobsDir, `${serverId}.json`); + } + + function persistJob(record: PersistedJobRecord): void { + mkdirSync(jobsDir, { recursive: true, mode: 0o700 }); + record.updated_at = now(); + writeFileAtomic(jobFilePath(record.server_id), `${JSON.stringify(record, null, 2)}\n`, { + mode: 0o600, + dirMode: 0o700, + }); + } + + function loadJob(serverId: string): PersistedJobRecord | null { + const path = jobFilePath(serverId); + if (!existsSync(path)) { + return null; + } + try { + const raw = JSON.parse(readFileSync(path, "utf8")) as unknown; + const parsed = persistedJobSchema.safeParse(raw); + return parsed.success ? parsed.data : null; + } catch { + return null; + } + } + + function emitProgress(record: PersistedJobRecord): void { + if (options.onProgress === undefined) { + return; + } + const event: ServerInstallModpackProgressEvent = { + job_id: record.job_id, + server_id: record.server_id, + phase: record.phase, + done: record.done, + total: record.total, + ...(record.current !== undefined ? { current: record.current } : {}), + }; + try { + options.onProgress(event); + } catch { + // Progress listener failures must never interrupt background installs. + } + } + + function emitResult(record: PersistedJobRecord): void { + if (options.onResult === undefined) { + return; + } + const event: ServerInstallModpackResultEvent = { + job_id: record.job_id, + server_id: record.server_id, + ok: record.status === "completed", + installed: record.installed, + skipped: [...record.skipped], + ...(record.error_code !== undefined ? { error_code: record.error_code } : {}), + }; + try { + options.onResult(event); + } catch { + // Result listener failures must never interrupt cleanup. + } + } + + function cleanupWrittenFiles(serverId: string, writtenPaths: readonly string[]): void { + for (const relPath of writtenPaths) { + if (PROTECTED_SERVERPACK_PATHS.has(relPath.toLowerCase())) { + continue; + } + try { + const resolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath, + allowRoot: false, + }); + if (!existsSync(resolved.fullPath)) { + continue; + } + const st = lstatSync(resolved.fullPath); + if (st.isFile() && !st.isSymbolicLink()) { + unlinkSync(resolved.fullPath); + } + } catch { + // Best-effort cleanup of partial artifacts. + } + } + } + + function addSkippedUnique(record: PersistedJobRecord, name: string, reason: string): void { + if (!record.skipped.some((item) => item.name === name && item.reason === reason)) { + record.skipped.push({ + name: name.slice(0, 256), + reason: reason.slice(0, 128), + }); + } + } + + function addWrittenPathUnique(record: PersistedJobRecord, relPath: string): void { + if (!record.written_paths.includes(relPath)) { + record.written_paths.push(relPath); + } + } + + async function downloadWithPolicy( + url: string, + expectedHashes: { + readonly sha1?: string | undefined; + readonly sha256?: string | undefined; + readonly sha512?: string | undefined; + }, + maxBytes: number, + signal: AbortSignal, + ) { + const check = isUrlHostAllowed(url, allowedHosts); + if (!check.ok) { + throw new ProtocolError( + check.reason === "host_not_allowed" ? "host_not_allowed" : "pack_unavailable", + check.reason === "host_not_allowed" + ? "Download host is not allowed" + : "Invalid download URL", + ); + } + return await downloadVerifiedBuffer({ + url, + allowedHosts, + expectedHashes, + maxBytes, + signal, + ...(options.maxRedirects !== undefined ? { maxRedirects: options.maxRedirects } : {}), + ...(options.downloadTimeoutMs !== undefined ? { timeoutMs: options.downloadTimeoutMs } : {}), + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + }); + } + + async function runJob(record: PersistedJobRecord, controller: AbortController): Promise { + const signal = controller.signal; + + const assertNotCancelled = (): void => { + if (signal.aborted) { + throw new ProtocolError("cancelled", "Modpack installation cancelled"); + } + }; + + try { + // Yield a microtask so the caller finishes returning `accepted` before events start flowing. + await Promise.resolve(); + assertNotCancelled(); + + // 1. Resolve modpack manifest/server pack if not already persisted from a prior attempt. + if (record.resolved === undefined) { + record.phase = "resolving"; + record.done = 0; + record.total = 1; + delete record.current; + persistJob(record); + emitProgress(record); + + const resolved = await options.resolveModpack( + { + source: record.source, + modpack_id: record.modpack_id, + version_id: record.version_id, + }, + signal, + ); + assertNotCancelled(); + record.resolved = resolved; + persistJob(record); + } + + let resolved = record.resolved; + let cachedMrpackBuffer: Uint8Array | null = null; + + if (resolved.server_pack !== undefined) { + // 2a. Official server pack flow (reusing serverpack extraction and indexing). + const pack = resolved.server_pack; + const hostCheck = isUrlHostAllowed(pack.url, allowedHosts); + if (!hostCheck.ok) { + throw new ProtocolError( + hostCheck.reason === "host_not_allowed" ? "host_not_allowed" : "pack_unavailable", + "Server pack download host is not allowed", + ); + } + + if (!record.server_pack_extracted) { + record.phase = "downloading"; + record.done = 0; + record.total = 1; + record.current = pack.name.slice(0, 256); + persistJob(record); + emitProgress(record); + + const downloaded = await downloadWithPolicy( + pack.url, + { sha1: pack.sha1, sha256: pack.sha256, sha512: pack.sha512 }, + maxServerPackBytes, + signal, + ); + assertNotCancelled(); + + record.phase = "extracting"; + record.done = 0; + record.total = 1; + record.current = pack.name.slice(0, 256); + persistJob(record); + emitProgress(record); + + const unzipResult = safeUnzipBuffer({ + serversBaseDir: serversDir, + serverId: record.server_id, + buffer: downloaded.data, + forbiddenPaths: PROTECTED_SERVERPACK_PATHS, + permissions: permissionContext, + }); + for (const rel of unzipResult.files) { + addWrittenPathUnique(record, rel); + } + + const indexed = indexExtractedServerPackFiles({ + serversDir, + serverId: record.server_id, + extractedFiles: unzipResult.files, + existingMods: [], + originSource: record.source, + layer: "origin", + }); + record.installed_mods = [...indexed.mods]; + record.synced_files = [...indexed.syncedFiles]; + record.server_pack_extracted = true; + record.done = 1; + record.total = 1; + persistJob(record); + emitProgress(record); + } + } else { + // 2b. Mod list + optional .mrpack parsing + overrides flow. + if (resolved.overrides?.format === "mrpack" && resolved.files.length === 0) { + record.phase = "resolving"; + record.done = 0; + record.total = 1; + delete record.current; + persistJob(record); + emitProgress(record); + + const downloadedPack = await downloadWithPolicy( + resolved.overrides.url, + { + sha1: resolved.overrides.sha1, + sha256: resolved.overrides.sha256, + sha512: resolved.overrides.sha512, + }, + maxServerPackBytes, + signal, + ); + assertNotCancelled(); + cachedMrpackBuffer = downloadedPack.data; + + const indexBytes = readZipEntryFromBuffer({ + buffer: downloadedPack.data, + entryName: "modrinth.index.json", + }); + if (indexBytes === null) { + throw new ProtocolError( + "pack_unavailable", + "Missing modrinth.index.json in modpack archive", + ); + } + + let parsedIndex: z.infer; + try { + const rawJson = JSON.parse( + new TextDecoder("utf-8", { fatal: true }).decode(indexBytes), + ) as unknown; + parsedIndex = mrpackIndexSchema.parse(rawJson); + } catch { + throw new ProtocolError("pack_unavailable", "Malformed modrinth.index.json"); + } + + const mappedFiles: ResolvedModpackFile[] = parsedIndex.files.map((entry) => ({ + name: basename(normalizeRelativePath(entry.path)), + path: normalizeRelativePath(entry.path), + ...(entry.downloads[0] !== undefined ? { url: entry.downloads[0] } : {}), + ...(entry.hashes?.sha1 !== undefined ? { sha1: entry.hashes.sha1 } : {}), + ...(entry.hashes?.sha512 !== undefined ? { sha512: entry.hashes.sha512 } : {}), + ...(entry.fileSize !== undefined ? { size: entry.fileSize } : {}), + ...(entry.env !== undefined ? { environment: entry.env } : {}), + })); + resolved = { ...resolved, files: mappedFiles }; + record.resolved = resolved; + persistJob(record); + } + + // Exclude client-only mods (`environment.server === "unsupported"`). Unknown environment is included. + const serverFiles = resolved.files.filter((file) => !isClientOnly(file.environment)); + const completedSet = new Set(record.completed_files); + const modByFile = new Map(record.installed_mods.map((m) => [m.file, m])); + const syncedFileSet = new Set(record.synced_files); + + record.phase = "downloading"; + record.total = serverFiles.length; + record.done = 0; + + // Pre-count already completed files on resume so progress starts at the right offset. + const pendingFiles: Array<{ + readonly file: ResolvedModpackFile; + readonly relPath: string; + }> = []; + for (const file of serverFiles) { + const relPath = resolveModTargetRelPath(file); + if (relPath === null) { + record.done++; + continue; + } + if (completedSet.has(relPath)) { + const resolvedDisk = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId: record.server_id, + relPath, + allowRoot: false, + }); + if ( + existsSync(resolvedDisk.fullPath) && + fileMatchesExpectedHashes(resolvedDisk.fullPath, file) + ) { + record.done++; + continue; + } + completedSet.delete(relPath); + } + pendingFiles.push({ file, relPath }); + } + + persistJob(record); + emitProgress(record); + + let nextIndex = 0; + let fatalError: unknown = null; + + const worker = async (): Promise => { + while (fatalError === null) { + assertNotCancelled(); + const idx = nextIndex++; + const item = pendingFiles[idx]; + if (item === undefined) { + break; + } + + const { file, relPath } = item; + if (file.blocked === true || file.url === undefined || file.url.trim().length === 0) { + addSkippedUnique(record, file.name, file.blocked_reason ?? "distribution_disabled"); + completedSet.add(relPath); + record.completed_files = [...completedSet]; + record.done++; + record.current = file.name.slice(0, 256); + persistJob(record); + emitProgress(record); + continue; + } + + const hostCheck = isUrlHostAllowed(file.url, allowedHosts); + if (!hostCheck.ok) { + addSkippedUnique( + record, + file.name, + hostCheck.reason === "host_not_allowed" ? "host_not_allowed" : "unavailable", + ); + completedSet.add(relPath); + record.completed_files = [...completedSet]; + record.done++; + record.current = file.name.slice(0, 256); + persistJob(record); + emitProgress(record); + continue; + } + + let downloaded: Awaited>; + try { + downloaded = await downloadVerifiedBuffer({ + url: file.url, + allowedHosts, + expectedHashes: { + sha1: file.sha1, + sha256: file.sha256, + sha512: file.sha512, + }, + maxBytes: maxModBytes, + signal, + ...(options.maxRedirects !== undefined + ? { maxRedirects: options.maxRedirects } + : {}), + ...(options.downloadTimeoutMs !== undefined + ? { timeoutMs: options.downloadTimeoutMs } + : {}), + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + }); + } catch (err) { + if (signal.aborted || (err instanceof ProtocolError && err.code === "cancelled")) { + fatalError = err; + controller.abort(); + break; + } + if (err instanceof ProtocolError && err.code === "hash_mismatch") { + fatalError = err; + controller.abort(); + break; + } + if ( + err instanceof ProtocolError && + err.code === "download_failed" && + err.message.toLowerCase().includes("maximum allowed size") + ) { + fatalError = err; + controller.abort(); + break; + } + if ( + err instanceof ProtocolError && + err.code === "download_failed" && + err.message.toLowerCase().includes("not allowed") + ) { + addSkippedUnique(record, file.name, "host_not_allowed"); + completedSet.add(relPath); + record.completed_files = [...completedSet]; + record.done++; + record.current = file.name.slice(0, 256); + persistJob(record); + emitProgress(record); + continue; + } + fatalError = err; + controller.abort(); + break; + } + + assertNotCancelled(); + const targetResolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId: record.server_id, + relPath, + allowRoot: false, + }); + writeConfinedFileAtomic(targetResolved, downloaded.data, { + createParents: true, + permissions: permissionContext, + }); + addWrittenPathUnique(record, targetResolved.relativePath); + completedSet.add(targetResolved.relativePath); + record.completed_files = [...completedSet]; + + if (targetResolved.relativePath.startsWith(`${MODS_DIR}/`)) { + const modFile = validateSingleFileName( + targetResolved.relativePath.slice(MODS_DIR.length + 1), + ); + const entry: ServerModEntry = { + file: modFile, + source: record.source, + ...(file.project_id !== undefined ? { project_id: file.project_id } : {}), + ...(file.version_id !== undefined ? { version_id: file.version_id } : {}), + sha1: downloaded.sha1, + sha256: downloaded.sha256, + sha512: downloaded.sha512, + layer: "origin", + }; + modByFile.set(modFile, entry); + record.installed_mods = [...modByFile.values()]; + } else { + syncedFileSet.add(targetResolved.relativePath); + record.synced_files = [...syncedFileSet]; + } + + record.done++; + record.current = file.name.slice(0, 256); + persistJob(record); + emitProgress(record); + } + }; + + await Promise.all( + Array.from({ length: Math.min(concurrency, Math.max(1, pendingFiles.length)) }, () => + worker(), + ), + ); + + if (fatalError !== null) { + throw fatalError; + } + assertNotCancelled(); + + // 3. Extract server-only overrides (`overrides/` and `server-overrides/`). + if (resolved.overrides !== undefined && !record.overrides_extracted) { + record.phase = "overrides"; + record.done = 0; + record.total = 1; + delete record.current; + persistJob(record); + emitProgress(record); + + let archiveBuffer = cachedMrpackBuffer; + if (archiveBuffer === null) { + const downloadedOverrides = await downloadWithPolicy( + resolved.overrides.url, + { + sha1: resolved.overrides.sha1, + sha256: resolved.overrides.sha256, + sha512: resolved.overrides.sha512, + }, + maxServerPackBytes, + signal, + ); + assertNotCancelled(); + archiveBuffer = downloadedOverrides.data; + } + + const customPrefix = resolved.overrides.prefix?.replace(/^\/+|\/+$/g, ""); + const prefixes: string[] = []; + if (customPrefix !== undefined && customPrefix.length > 0) { + prefixes.push(customPrefix); + } else { + prefixes.push("overrides"); + } + if (!prefixes.includes("server-overrides")) { + prefixes.push("server-overrides"); + } + + const unzipOverrides = safeUnzipPrefixesFromBuffer({ + serversBaseDir: serversDir, + serverId: record.server_id, + buffer: archiveBuffer, + prefixes, + excludePrefixes: ["client-overrides"], + skipPaths: PROTECTED_SERVERPACK_PATHS, + permissions: permissionContext, + }); + + for (const rel of unzipOverrides.files) { + addWrittenPathUnique(record, rel); + if (isServerContentPath(rel)) { + syncedFileSet.add(rel); + } + } + record.synced_files = [...syncedFileSet]; + record.overrides_extracted = true; + record.done = 1; + record.total = 1; + persistJob(record); + emitProgress(record); + } + } + + assertNotCancelled(); + + // 4. Finalizing: update tegrad-server.json origin, mods, and origin_sync. + record.phase = "finalizing"; + record.done = 0; + record.total = 1; + delete record.current; + persistJob(record); + emitProgress(record); + + const meta = readServerMetadata(serversDir, record.server_id); + const mergedMods = new Map((meta.mods ?? []).map((m) => [m.file, m])); + for (const modEntry of record.installed_mods) { + mergedMods.set(modEntry.file, modEntry); + } + + const nextOrigin: ServerOrigin = { + kind: "modpack", + source: record.source, + modpack_id: record.modpack_id, + version_id: record.version_id, + ...(record.modpack_name !== undefined ? { modpack_name: record.modpack_name } : {}), + }; + + const syncedModKeys = [ + ...new Set( + record.installed_mods.map((entry) => + modIdentityKey({ + filename: entry.file, + modInfo: entry.project_id !== undefined ? { modId: entry.project_id } : null, + }), + ), + ), + ].sort(); + + const nextSync: ServerOriginSyncState = { + excluded_mod_keys: [], + synced_mod_keys: syncedModKeys, + removed_origin_files: [], + synced_files: [...new Set(record.synced_files)].sort(), + last_synced_at: new Date(now()).toISOString(), + last_synced_version_id: record.version_id, + }; + + const nextMeta: ServerMetadata = { + ...meta, + origin: nextOrigin, + mods: [...mergedMods.values()].sort((a, b) => a.file.localeCompare(b.file)), + origin_sync: nextSync, + }; + writeServerMetadata(serversDir, nextMeta, permissionContext); + + record.status = "completed"; + record.done = 1; + record.total = 1; + record.installed = record.installed_mods.length; + record.finished_at = now(); + persistJob(record); + emitProgress(record); + emitResult(record); + + options.logger?.info("Installed modpack on server", { + serverId: record.server_id, + jobId: record.job_id, + source: record.source, + installed: record.installed, + skippedCount: record.skipped.length, + }); + } catch (err) { + const errorCode = classifyInstallError(err); + // Graceful shutdown aborts active I/O without failing or cleaning up the job so it resumes on restart. + if (closing && errorCode === "cancelled") { + options.logger?.info("Paused modpack install for agent shutdown", { + serverId: record.server_id, + jobId: record.job_id, + phase: record.phase, + }); + return; + } + + cleanupWrittenFiles(record.server_id, record.written_paths); + record.status = errorCode === "cancelled" ? "cancelled" : "failed"; + record.error_code = errorCode; + record.installed = 0; + record.finished_at = now(); + persistJob(record); + emitResult(record); + + options.logger?.warn("Modpack install did not complete", { + serverId: record.server_id, + jobId: record.job_id, + phase: record.phase, + errorCode, + reason: redactUrlQueryStrings(err instanceof Error ? err.message : String(err)), + }); + } finally { + const active = activeRuns.get(record.server_id); + if (active !== undefined && active.jobId === record.job_id) { + activeRuns.delete(record.server_id); + } + } + } + + function launchJob(record: PersistedJobRecord): void { + const controller = new AbortController(); + const promise = runJob(record, controller); + activeRuns.set(record.server_id, { + jobId: record.job_id, + controller, + promise, + }); + } + + return { + async startInstall(params: ServerInstallModpackBody): Promise { + const parsed = serverInstallModpackBodySchema.safeParse(params); + if (!parsed.success) { + throw new ProtocolError("invalid_body", "Invalid server.install_modpack parameters"); + } + const input = parsed.data; + readServerMetadata(serversDir, input.server_id); + + if (await options.isServerActive(input.server_id)) { + throw new ProtocolError( + "server_running", + "The server must be stopped before installing a modpack", + ); + } + + if (activeRuns.has(input.server_id)) { + throw new ProtocolError( + "install_in_progress", + "A modpack installation is already running for this server", + ); + } + const existing = loadJob(input.server_id); + if (existing !== null && existing.status === "running") { + throw new ProtocolError( + "install_in_progress", + "A modpack installation is already running for this server", + ); + } + + const timestamp = now(); + const jobId = `mpi-${randomBytes(8).toString("hex")}`; + const record: PersistedJobRecord = { + v: 1, + job_id: jobId, + server_id: input.server_id, + source: input.source, + modpack_id: input.modpack_id, + version_id: input.version_id, + ...(input.modpack_name !== undefined ? { modpack_name: input.modpack_name } : {}), + ...(input.version_label !== undefined ? { version_label: input.version_label } : {}), + status: "running", + phase: "resolving", + done: 0, + total: 1, + installed: 0, + skipped: [], + started_at: timestamp, + updated_at: timestamp, + completed_files: [], + written_paths: [], + installed_mods: [], + synced_files: [], + }; + persistJob(record); + launchJob(record); + + return { job_id: jobId, server_id: input.server_id }; + }, + + getStatus(serverId: string): ServerInstallModpackStatusResult { + const validId = assertValidServerId(serverId); + readServerMetadata(serversDir, validId); + const record = loadJob(validId); + return { + server_id: validId, + job: record !== null ? toJobStatusSnapshot(record) : null, + }; + }, + + cancelInstall(params: ServerInstallModpackCancelBody): CancelModpackInstallResult { + const parsed = serverInstallModpackCancelBodySchema.safeParse(params); + if (!parsed.success) { + throw new ProtocolError("invalid_body", "Invalid server.install_modpack.cancel parameters"); + } + const { server_id: serverId, job_id: jobId } = parsed.data; + readServerMetadata(serversDir, serverId); + + const active = activeRuns.get(serverId); + if (active !== undefined) { + if (jobId !== undefined && active.jobId !== jobId) { + return { server_id: serverId, cancelled: false }; + } + active.controller.abort(); + return { server_id: serverId, job_id: active.jobId, cancelled: true }; + } + + const persisted = loadJob(serverId); + if ( + persisted !== null && + persisted.status === "running" && + (jobId === undefined || persisted.job_id === jobId) + ) { + cleanupWrittenFiles(serverId, persisted.written_paths); + persisted.status = "cancelled"; + persisted.error_code = "cancelled"; + persisted.installed = 0; + persisted.finished_at = now(); + persistJob(persisted); + emitResult(persisted); + return { server_id: serverId, job_id: persisted.job_id, cancelled: true }; + } + + return { server_id: serverId, cancelled: false }; + }, + + start(): void { + if (!existsSync(jobsDir)) { + return; + } + let entries: string[]; + try { + entries = readdirSync(jobsDir).filter((name) => name.endsWith(".json")); + } catch { + return; + } + + for (const file of entries) { + const serverId = file.slice(0, -".json".length); + let record: PersistedJobRecord | null; + try { + assertValidServerId(serverId); + record = loadJob(serverId); + } catch { + continue; + } + if (record === null || record.status !== "running" || activeRuns.has(serverId)) { + continue; + } + try { + readServerMetadata(serversDir, serverId); + } catch { + continue; + } + const checkPromise = (async () => { + const active = await options.isServerActive(serverId).catch(() => true); + if (closing) { + return; + } + if (active) { + record.status = "failed"; + record.error_code = "server_running"; + record.finished_at = now(); + persistJob(record); + emitResult(record); + return; + } + launchJob(record); + })(); + startupChecks.add(checkPromise); + void checkPromise.finally(() => { + startupChecks.delete(checkPromise); + }); + } + }, + + async waitForActiveJobs(): Promise { + while (startupChecks.size > 0 || activeRuns.size > 0) { + if (startupChecks.size > 0) { + await Promise.allSettled([...startupChecks]); + } + if (activeRuns.size > 0) { + const promises = [...activeRuns.values()].map((entry) => entry.promise); + await Promise.allSettled(promises); + } + } + }, + + async close(): Promise { + closing = true; + for (const entry of activeRuns.values()) { + entry.controller.abort(); + } + await Promise.allSettled([...activeRuns.values()].map((entry) => entry.promise)); + }, + }; +} + +export function registerModpackHandlers(queue: CommandQueue, installer: ModpackInstaller): void { + queue.registerHandler("server.install_modpack", async (opened, ctx) => { + const body = opened.body as ServerInstallModpackBody; + const accepted = await installer.startInstall(body); + ctx.sendEvent("server.install_modpack.accepted", accepted); + }); + + queue.registerHandler("server.install_modpack.status", (opened, ctx) => { + const body = opened.body as { readonly server_id: string }; + const status = installer.getStatus(body.server_id); + ctx.sendEvent("server.install_modpack.status.result", status); + }); + + queue.registerHandler("server.install_modpack.cancel", (opened, ctx) => { + const body = opened.body as ServerInstallModpackCancelBody; + const result = installer.cancelInstall(body); + ctx.sendEvent("server.install_modpack.cancelled", result); + }); +} From e325167a7b5cf410ff61dbc2bfe104bf35a47351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Fri, 27 Nov 2026 02:05:34 -0300 Subject: [PATCH 39/59] fix: refuse a modpack built for another Minecraft version or loader than the server --- .../{index-7gzwrqzw.js => index-df9ww65b.js} | 3 +- lib/protocol/index.js | 2 +- lib/types/protocol/commands/modpack.d.ts | 6 +- lib/types/protocol/errors.d.ts | 2 +- lib/vault/index.js | 2 +- src/protocol/commands/modpack.ts | 1 + src/protocol/errors.ts | 1 + src/state/modpack-installer.test.ts | 64 ++++++++++++++++++- src/state/modpack-installer.ts | 25 ++++++++ 9 files changed, 100 insertions(+), 6 deletions(-) rename lib/chunks/{index-7gzwrqzw.js => index-df9ww65b.js} (99%) diff --git a/lib/chunks/index-7gzwrqzw.js b/lib/chunks/index-df9ww65b.js similarity index 99% rename from lib/chunks/index-7gzwrqzw.js rename to lib/chunks/index-df9ww65b.js index 47ce2f3..9073228 100644 --- a/lib/chunks/index-7gzwrqzw.js +++ b/lib/chunks/index-df9ww65b.js @@ -1497,7 +1497,8 @@ var MODPACK_INSTALL_ERROR_CODES = [ "server_running", "api_unavailable", "io_error", - "cancelled" + "cancelled", + "runtime_mismatch" ]; var modpackInstallErrorCodeSchema = z9.enum(MODPACK_INSTALL_ERROR_CODES); var modpackInstallSkippedItemSchema = z9.object({ diff --git a/lib/protocol/index.js b/lib/protocol/index.js index 03099ca..a1ec92f 100644 --- a/lib/protocol/index.js +++ b/lib/protocol/index.js @@ -266,7 +266,7 @@ import { verifyTrustGrant, worldNameSchema, wrapEventBody -} from "../chunks/index-7gzwrqzw.js"; +} from "../chunks/index-df9ww65b.js"; import"../chunks/index-g1frygvt.js"; export { wrapEventBody, diff --git a/lib/types/protocol/commands/modpack.d.ts b/lib/types/protocol/commands/modpack.d.ts index eb6c9f1..eac221e 100644 --- a/lib/types/protocol/commands/modpack.d.ts +++ b/lib/types/protocol/commands/modpack.d.ts @@ -24,7 +24,7 @@ export declare const modpackInstallJobStateSchema: z.ZodEnum<{ running: "running"; }>; export type ModpackInstallJobState = z.infer; -export declare const MODPACK_INSTALL_ERROR_CODES: readonly ["pack_unavailable", "host_not_allowed", "hash_mismatch", "too_large", "install_in_progress", "server_running", "api_unavailable", "io_error", "cancelled"]; +export declare const MODPACK_INSTALL_ERROR_CODES: readonly ["pack_unavailable", "host_not_allowed", "hash_mismatch", "too_large", "install_in_progress", "server_running", "api_unavailable", "io_error", "cancelled", "runtime_mismatch"]; export declare const modpackInstallErrorCodeSchema: z.ZodEnum<{ api_unavailable: "api_unavailable"; cancelled: "cancelled"; @@ -33,6 +33,7 @@ export declare const modpackInstallErrorCodeSchema: z.ZodEnum<{ install_in_progress: "install_in_progress"; io_error: "io_error"; pack_unavailable: "pack_unavailable"; + runtime_mismatch: "runtime_mismatch"; server_running: "server_running"; too_large: "too_large"; }>; @@ -101,6 +102,7 @@ export declare const serverInstallModpackResultEventSchema: z.ZodObject<{ install_in_progress: "install_in_progress"; io_error: "io_error"; pack_unavailable: "pack_unavailable"; + runtime_mismatch: "runtime_mismatch"; server_running: "server_running"; too_large: "too_large"; }>>; @@ -147,6 +149,7 @@ export declare const modpackInstallJobStatusSchema: z.ZodObject<{ install_in_progress: "install_in_progress"; io_error: "io_error"; pack_unavailable: "pack_unavailable"; + runtime_mismatch: "runtime_mismatch"; server_running: "server_running"; too_large: "too_large"; }>>; @@ -198,6 +201,7 @@ export declare const serverInstallModpackStatusResultSchema: z.ZodObject<{ install_in_progress: "install_in_progress"; io_error: "io_error"; pack_unavailable: "pack_unavailable"; + runtime_mismatch: "runtime_mismatch"; server_running: "server_running"; too_large: "too_large"; }>>; diff --git a/lib/types/protocol/errors.d.ts b/lib/types/protocol/errors.d.ts index fc61943..93b4fd0 100644 --- a/lib/types/protocol/errors.d.ts +++ b/lib/types/protocol/errors.d.ts @@ -1,4 +1,4 @@ -export type ProtocolErrorCode = "invalid_format" | "unsupported_version" | "wrong_agent" | "wrong_recipient" | "expired" | "not_yet_valid" | "ttl_too_long" | "untrusted_signer" | "bad_signature" | "session_invalid" | "session_revoked" | "replayed" | "unknown_command" | "invalid_body" | "sensitive_requires_account_key" | "decrypt_failed" | "insufficient_role" | "too_many_subscribers" | "role_grant_invalid" | "auth_invalid" | "request_invalid" | "grant_invalid" | "grant_wrong_agent" | "grant_expired" | "grant_bad_signature" | "grant_proof_required" | "grant_bad_proof" | "revocation_stale" | "revocation_not_superset" | "insufficient_memory" | "eula_not_accepted" | "server_not_found" | "server_already_exists" | "server_running" | "server_stopped" | "invalid_jvm_args" | "download_failed" | "hash_mismatch" | "systemd_error" | "perms_unavailable" | "origin_locked" | "plan_not_found" | "plan_expired" | "plan_stale" | "mod_not_found" | "mod_already_exists" | "backup_not_found" | "backup_failed" | "backup_config_invalid" | "tunnel_not_configured" | "tunnel_already_running" | "tunnel_not_running" | "tunnel_failed" | "pack_unavailable" | "host_not_allowed" | "too_large" | "install_in_progress" | "api_unavailable" | "io_error" | "cancelled"; +export type ProtocolErrorCode = "invalid_format" | "unsupported_version" | "wrong_agent" | "wrong_recipient" | "expired" | "not_yet_valid" | "ttl_too_long" | "untrusted_signer" | "bad_signature" | "session_invalid" | "session_revoked" | "replayed" | "unknown_command" | "invalid_body" | "sensitive_requires_account_key" | "decrypt_failed" | "insufficient_role" | "too_many_subscribers" | "role_grant_invalid" | "auth_invalid" | "request_invalid" | "grant_invalid" | "grant_wrong_agent" | "grant_expired" | "grant_bad_signature" | "grant_proof_required" | "grant_bad_proof" | "revocation_stale" | "revocation_not_superset" | "insufficient_memory" | "eula_not_accepted" | "server_not_found" | "server_already_exists" | "server_running" | "server_stopped" | "invalid_jvm_args" | "download_failed" | "hash_mismatch" | "systemd_error" | "perms_unavailable" | "origin_locked" | "plan_not_found" | "plan_expired" | "plan_stale" | "mod_not_found" | "mod_already_exists" | "backup_not_found" | "backup_failed" | "backup_config_invalid" | "tunnel_not_configured" | "tunnel_already_running" | "tunnel_not_running" | "tunnel_failed" | "pack_unavailable" | "runtime_mismatch" | "host_not_allowed" | "too_large" | "install_in_progress" | "api_unavailable" | "io_error" | "cancelled"; export declare class ProtocolError extends Error { readonly code: ProtocolErrorCode; constructor(code: ProtocolErrorCode, message: string); diff --git a/lib/vault/index.js b/lib/vault/index.js index 31e6bdf..2813c5e 100644 --- a/lib/vault/index.js +++ b/lib/vault/index.js @@ -5,7 +5,7 @@ import { sessionCertificateSchema, signRevocationList, signSessionCertificate -} from "../chunks/index-7gzwrqzw.js"; +} from "../chunks/index-df9ww65b.js"; import { KDF_ALG_ARGON2ID13, KDF_MODERATE, diff --git a/src/protocol/commands/modpack.ts b/src/protocol/commands/modpack.ts index e22379a..ce356a1 100644 --- a/src/protocol/commands/modpack.ts +++ b/src/protocol/commands/modpack.ts @@ -33,6 +33,7 @@ export const MODPACK_INSTALL_ERROR_CODES = [ "api_unavailable", "io_error", "cancelled", + "runtime_mismatch", ] as const; export const modpackInstallErrorCodeSchema = z.enum(MODPACK_INSTALL_ERROR_CODES); export type ModpackInstallErrorCode = z.infer; diff --git a/src/protocol/errors.ts b/src/protocol/errors.ts index bb653da..abd9d6e 100644 --- a/src/protocol/errors.ts +++ b/src/protocol/errors.ts @@ -56,6 +56,7 @@ export type ProtocolErrorCode = | "tunnel_not_running" | "tunnel_failed" | "pack_unavailable" + | "runtime_mismatch" | "host_not_allowed" | "too_large" | "install_in_progress" diff --git a/src/state/modpack-installer.test.ts b/src/state/modpack-installer.test.ts index a4837a0..f923e5a 100644 --- a/src/state/modpack-installer.test.ts +++ b/src/state/modpack-installer.test.ts @@ -33,7 +33,11 @@ import { } from "../protocol"; import type { FetchLike } from "../server/download"; import { readServerMetadata, type ServerMetadata, writeServerMetadata } from "../server/registry"; -import { createModpackInstaller, registerModpackHandlers } from "./modpack-installer"; +import { + assertRuntimeMatches, + createModpackInstaller, + registerModpackHandlers, +} from "./modpack-installer"; const tempDirs: string[] = []; @@ -493,6 +497,64 @@ describe("Background server.install_modpack", () => { expect(meta.mods).toBeUndefined(); }); + test("refuses a pack built for another Minecraft version or loader before downloading anything", async () => { + const root = makeTempDir("tegrad-mpi-runtime-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + createTestServer(serversDir, "smp"); + + let downloads = 0; + const resultEvents: ServerInstallModpackResultEvent[] = []; + const installer = createModpackInstaller({ + stateDir, + serversDir, + isServerActive: async () => false, + fetchImpl: async () => { + downloads += 1; + return new Response(new Uint8Array(Buffer.from("mod")), { status: 200 }); + }, + resolveModpack: async () => ({ + files: [{ name: "a.jar", url: "https://cdn.modrinth.com/a.jar" }], + minecraft_version: "1.20.1", + loader: "forge", + }), + onResult: (ev) => resultEvents.push(ev), + }); + + await installer.startInstall({ + server_id: "smp", + source: "curseforge", + modpack_id: "p1", + version_id: "v1", + }); + await installer.waitForActiveJobs(); + + expect(resultEvents[0]).toMatchObject({ + ok: false, + installed: 0, + error_code: "runtime_mismatch", + }); + expect(downloads).toBe(0); + expect(existsSync(join(serversDir, "smp", "mods", "a.jar"))).toBe(false); + expect(readServerMetadata(serversDir, "smp").origin).toBeUndefined(); + }); + + test("runtime check accepts a pack that names no version or a vanilla loader", () => { + const meta = { minecraft_version: "1.21.1", loader: "fabric" } as const; + expect(() => + assertRuntimeMatches(meta, { minecraft_version: "1.21.1", loader: "Fabric" }), + ).not.toThrow(); + expect(() => + assertRuntimeMatches(meta, { minecraft_version: "", loader: "vanilla" }), + ).not.toThrow(); + expect(() => + assertRuntimeMatches(meta, { minecraft_version: "1.21.1", loader: "neoforge" }), + ).toThrow(ProtocolError); + expect(() => + assertRuntimeMatches(meta, { minecraft_version: "1.20.1", loader: "fabric" }), + ).toThrow(ProtocolError); + }); + test("resumes after restart, only downloading remaining files without re-resolving API", async () => { const root = makeTempDir("tegrad-mpi-resume-"); const stateDir = join(root, "state"); diff --git a/src/state/modpack-installer.ts b/src/state/modpack-installer.ts index 31c68f5..89d9f3a 100644 --- a/src/state/modpack-installer.ts +++ b/src/state/modpack-installer.ts @@ -317,6 +317,8 @@ function classifyInstallError(err: unknown): ModpackInstallErrorCode { return "io_error"; case "pack_unavailable": return "pack_unavailable"; + case "runtime_mismatch": + return "runtime_mismatch"; case "download_failed": { const msg = err.message.toLowerCase(); if (msg.includes("not allowed")) { @@ -341,6 +343,28 @@ function classifyInstallError(err: unknown): ModpackInstallErrorCode { return "pack_unavailable"; } +/** + * Refuses a modpack built for another game version or loader than the server runs, so the + * server never ends up with mods it cannot load. An empty version or a vanilla loader in the + * resolved pack means the provider did not say, and is not treated as a mismatch. + */ +export function assertRuntimeMatches( + meta: Pick, + resolved: { readonly minecraft_version: string; readonly loader: string }, +): void { + const packVersion = resolved.minecraft_version.trim(); + const packLoader = resolved.loader.trim().toLowerCase(); + const versionDiffers = packVersion.length > 0 && packVersion !== meta.minecraft_version; + const loaderDiffers = + packLoader.length > 0 && packLoader !== "vanilla" && packLoader !== meta.loader; + if (versionDiffers || loaderDiffers) { + throw new ProtocolError( + "runtime_mismatch", + "Modpack targets a different Minecraft version or loader than the server", + ); + } +} + function digestsEqual(actualHex: string, expectedHex: string): boolean { const a = Buffer.from(actualHex.toLowerCase(), "hex"); const b = Buffer.from(expectedHex.toLowerCase(), "hex"); @@ -591,6 +615,7 @@ export function createModpackInstaller(options: ModpackInstallerOptions): Modpac } let resolved = record.resolved; + assertRuntimeMatches(readServerMetadata(serversDir, record.server_id), resolved); let cachedMrpackBuffer: Uint8Array | null = null; if (resolved.server_pack !== undefined) { From 09531c69f773f096ae9c7050cc7c285a548484d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Fri, 27 Nov 2026 14:48:32 -0300 Subject: [PATCH 40/59] fix: install modpacks without losing what already landed, take Tegra packs from the archive root and stream large server packs to disk --- src/files/index.ts | 2 + src/files/zip.ts | 42 +++- src/state/download.ts | 134 +++++++++-- src/state/modpack-installer.test.ts | 133 +++++++++-- src/state/modpack-installer.ts | 329 +++++++++++++++++----------- src/state/state.test.ts | 53 ++++- 6 files changed, 532 insertions(+), 161 deletions(-) diff --git a/src/files/index.ts b/src/files/index.ts index 908d0eb..03236bc 100644 --- a/src/files/index.ts +++ b/src/files/index.ts @@ -73,6 +73,8 @@ export { createZipBuffer, DEFAULT_MAX_ZIP_FILE_BYTES, DEFAULT_ZIP_RATIO_MIN_BYTES, + findServerPackRoot, + listZipEntryNames, MAX_ZIP_COMPRESSION_RATIO, MAX_ZIP_CREATE_BYTES, MAX_ZIP_CREATE_FILES, diff --git a/src/files/zip.ts b/src/files/zip.ts index 260e95b..fd4b218 100644 --- a/src/files/zip.ts +++ b/src/files/zip.ts @@ -1112,6 +1112,45 @@ export interface ReadZipEntryOptions { readonly ratioMinBytes?: number; } +/** + * Lists the entry names of an archive (Central Directory only, same limits as extraction), + * so callers can decide what to extract before writing anything. + */ +export function listZipEntryNames(buffer: Uint8Array): string[] { + return parseRawCentralDirectory( + buffer, + MAX_ZIP_ENTRIES, + MAX_ZIP_UNCOMPRESSED_BYTES, + MAX_ZIP_ENTRY_BYTES, + MAX_ZIP_COMPRESSION_RATIO, + DEFAULT_ZIP_RATIO_MIN_BYTES, + ).map((entry) => entry.rawName); +} + +/** + * Finds the folder a server pack keeps its files in: the archive root when it holds server + * content there, or the single top-level folder every entry sits under (packs zipped from + * their parent directory, such as `MyPack-Server/mods/...`). Returns "" for the root. + */ +export function findServerPackRoot(names: readonly string[]): string { + const topLevel = new Set(); + let hasRootFile = false; + for (const name of names) { + const slash = name.indexOf("/"); + if (slash < 0) { + hasRootFile = true; + continue; + } + topLevel.add(name.slice(0, slash)); + } + const serverDirs = ["mods", "config", "libraries", "world", "kubejs", "defaultconfigs"]; + if (hasRootFile || serverDirs.some((dir) => topLevel.has(dir)) || topLevel.size !== 1) { + return ""; + } + const [only] = [...topLevel]; + return only ?? ""; +} + export function readZipEntryFromBuffer(options: ReadZipEntryOptions): Uint8Array | null { const maxEntries = options.maxEntries ?? MAX_ZIP_ENTRIES; const maxUncompressedBytes = options.maxUncompressedBytes ?? MAX_ZIP_UNCOMPRESSED_BYTES; @@ -1207,9 +1246,10 @@ export function safeUnzipPrefixesFromBuffer(options: SafeUnzipPrefixesOptions): let stripped = ""; for (let idx = 0; idx < normalizedPrefixes.length; idx++) { const prefix = normalizedPrefixes[idx]; - if (prefix === undefined || prefix.length === 0) { + if (prefix === undefined) { continue; } + // An empty prefix selects the whole archive (files kept at its root). if (entry.rawName.startsWith(prefix)) { matchedPrefixIndex = idx; stripped = entry.rawName.slice(prefix.length); diff --git a/src/state/download.ts b/src/state/download.ts index a0fd318..02ffb66 100644 --- a/src/state/download.ts +++ b/src/state/download.ts @@ -2,6 +2,7 @@ // Copyright (C) 2026 Antônio Miranda import { createHash, timingSafeEqual } from "node:crypto"; +import { closeSync, openSync, unlinkSync, writeSync } from "node:fs"; import { validateCdnHost } from "../agent/state"; import { ProtocolError } from "../protocol"; import type { FetchLike } from "../server/download"; @@ -10,6 +11,8 @@ export const DEFAULT_MOD_ALLOWED_HOSTS: ReadonlySet = new Set([ "cdn.modrinth.com", "edge.forgecdn.net", "mediafilez.forgecdn.net", + // Tegra's own CDN, where Tegra modpack archives, manifests and server packs live. + "cdn2.seijin.com.br", ]); export const DEFAULT_MAX_MOD_BYTES = 256 * 1024 * 1024; // 256 MiB @@ -179,9 +182,10 @@ async function readCappedBytes(response: Response, maxBytes: number): Promise( options: DownloadVerifiedBufferOptions, -): Promise { + readBody: (response: Response, maxBytes: number) => Promise, +): Promise<{ readonly body: T; readonly expected: ExpectedHashDigests }> { const expectedSha1 = options.expectedHashes?.sha1 !== undefined ? normalizeHash("sha1", options.expectedHashes.sha1) @@ -201,7 +205,7 @@ export async function downloadVerifiedBuffer( const timeoutMs = options.timeoutMs ?? DEFAULT_STATE_DOWNLOAD_TIMEOUT_MS; let currentUrl = validateStateDownloadUrl(options.url, options.allowedHosts); - let data: Uint8Array | null = null; + let data: T | null = null; for (let hop = 0; hop <= maxRedirects; hop++) { if (options.signal?.aborted) { @@ -261,7 +265,7 @@ export async function downloadVerifiedBuffer( } try { - data = await readCappedBytes(response, maxBytes); + data = await readBody(response, maxBytes); } catch (err) { if (options.signal?.aborted) { throw new ProtocolError("cancelled", "Download aborted"); @@ -284,25 +288,123 @@ export async function downloadVerifiedBuffer( if (data === null) { throw new ProtocolError("download_failed", "Exceeded maximum redirect hops"); } - const sha1 = createHash("sha1").update(data).digest("hex"); - const sha256 = createHash("sha256").update(data).digest("hex"); - const sha512 = createHash("sha512").update(data).digest("hex"); + return { + body: data, + expected: { sha1: expectedSha1, sha256: expectedSha256, sha512: expectedSha512 }, + }; +} - if (expectedSha1 !== undefined && !digestsEqual(sha1, expectedSha1)) { +interface ExpectedHashDigests { + readonly sha1: string | undefined; + readonly sha256: string | undefined; + readonly sha512: string | undefined; +} + +function assertDigests( + actual: { readonly sha1: string; readonly sha256: string; readonly sha512: string }, + expected: ExpectedHashDigests, +): void { + if (expected.sha1 !== undefined && !digestsEqual(actual.sha1, expected.sha1)) { throw new ProtocolError("hash_mismatch", "Downloaded artifact SHA-1 checksum mismatch"); } - if (expectedSha256 !== undefined && !digestsEqual(sha256, expectedSha256)) { + if (expected.sha256 !== undefined && !digestsEqual(actual.sha256, expected.sha256)) { throw new ProtocolError("hash_mismatch", "Downloaded artifact SHA-256 checksum mismatch"); } - if (expectedSha512 !== undefined && !digestsEqual(sha512, expectedSha512)) { + if (expected.sha512 !== undefined && !digestsEqual(actual.sha512, expected.sha512)) { throw new ProtocolError("hash_mismatch", "Downloaded artifact SHA-512 checksum mismatch"); } +} - return { - data, - bytes: data.byteLength, - sha1, - sha256, - sha512, +export async function downloadVerifiedBuffer( + options: DownloadVerifiedBufferOptions, +): Promise { + const { body: data, expected } = await fetchFollowingRedirects(options, readCappedBytes); + const sha1 = createHash("sha1").update(data).digest("hex"); + const sha256 = createHash("sha256").update(data).digest("hex"); + const sha512 = createHash("sha512").update(data).digest("hex"); + assertDigests({ sha1, sha256, sha512 }, expected); + return { data, bytes: data.byteLength, sha1, sha256, sha512 }; +} + +export interface VerifiedFileDownloadResult { + readonly path: string; + readonly bytes: number; + readonly sha1: string; + readonly sha256: string; + readonly sha512: string; +} + +/** + * Streams a download straight to `destPath`, hashing as it goes, so archives of hundreds of + * megabytes never sit in memory. The file is removed when the download or the hash check fails. + */ +export async function downloadVerifiedToFile( + options: DownloadVerifiedBufferOptions & { readonly destPath: string }, +): Promise { + const writeBody = async (response: Response, maxBytes: number) => { + const declared = Number(response.headers.get("content-length")); + if (Number.isFinite(declared) && declared > maxBytes) { + throw new ProtocolError("download_failed", "Download exceeds maximum allowed size"); + } + const hashes = { + sha1: createHash("sha1"), + sha256: createHash("sha256"), + sha512: createHash("sha512"), + }; + const fd = openSync(options.destPath, "w", 0o600); + let total = 0; + try { + const write = (chunk: Uint8Array): void => { + total += chunk.byteLength; + if (total > maxBytes) { + throw new ProtocolError("download_failed", "Download exceeds maximum allowed size"); + } + hashes.sha1.update(chunk); + hashes.sha256.update(chunk); + hashes.sha512.update(chunk); + let offset = 0; + while (offset < chunk.byteLength) { + offset += writeSync(fd, chunk, offset, chunk.byteLength - offset); + } + }; + if (response.body === null) { + write(new Uint8Array(await response.arrayBuffer())); + } else { + const reader = response.body.getReader(); + try { + while (true) { + const { value, done } = await reader.read(); + if (done) break; + if (value !== undefined && value.byteLength > 0) write(value); + } + } catch (err) { + await reader.cancel().catch(() => {}); + throw err; + } finally { + reader.releaseLock(); + } + } + } finally { + closeSync(fd); + } + return { + bytes: total, + sha1: hashes.sha1.digest("hex"), + sha256: hashes.sha256.digest("hex"), + sha512: hashes.sha512.digest("hex"), + }; }; + + try { + const { body, expected } = await fetchFollowingRedirects(options, writeBody); + assertDigests(body, expected); + return { path: options.destPath, ...body }; + } catch (err) { + try { + unlinkSync(options.destPath); + } catch { + // Nothing was written or it is already gone. + } + throw err; + } } diff --git a/src/state/modpack-installer.test.ts b/src/state/modpack-installer.test.ts index f923e5a..444c926 100644 --- a/src/state/modpack-installer.test.ts +++ b/src/state/modpack-installer.test.ts @@ -14,7 +14,7 @@ import { } from "../agent"; import { openTestEvent } from "../agent/test-events"; import { fingerprint, generateSigningKeyPair, ready } from "../crypto"; -import { createZipBuffer } from "../files"; +import { createZipBuffer, findServerPackRoot } from "../files"; import { createCoreRegistry, createInMemoryTrustContext, @@ -445,7 +445,7 @@ describe("Background server.install_modpack", () => { ]); }); - test("hash mismatch aborts with cleanup of written files and leaves metadata untouched", async () => { + test("a file with the wrong hash is skipped and the rest of the pack still installs", async () => { const root = makeTempDir("tegrad-mpi-hash-"); const stateDir = join(root, "state"); const serversDir = join(root, "servers"); @@ -485,16 +485,120 @@ describe("Background server.install_modpack", () => { }); await installer.waitForActiveJobs(); - expect(resultEvents[0]).toMatchObject({ - ok: false, - installed: 0, - error_code: "hash_mismatch", - }); - expect(existsSync(join(serversDir, "smp", "mods", "a.jar"))).toBe(false); + expect(resultEvents[0]).toMatchObject({ ok: true, installed: 1 }); + expect(resultEvents[0]?.skipped).toEqual([{ name: "b.jar", reason: "hash_mismatch" }]); + expect(existsSync(join(serversDir, "smp", "mods", "a.jar"))).toBe(true); expect(existsSync(join(serversDir, "smp", "mods", "b.jar"))).toBe(false); const meta = readServerMetadata(serversDir, "smp"); - expect(meta.origin).toBeUndefined(); - expect(meta.mods).toBeUndefined(); + expect(meta.origin?.kind).toBe("modpack"); + expect(meta.mods?.map((m) => m.file)).toEqual(["a.jar"]); + }); + + test("files listed without a link are taken from the pack archive instead of being reported", async () => { + const root = makeTempDir("tegrad-mpi-archive-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + createTestServer(serversDir, "smp"); + + const mod = new Uint8Array(Buffer.from("mod-ok")); + const archive = createZipBuffer([ + { name: "config/example-common.toml", data: new Uint8Array(Buffer.from("a=1")) }, + { name: "shaderpacks/pretty.zip", data: new Uint8Array(Buffer.from("x")) }, + ]); + const resultEvents: ServerInstallModpackResultEvent[] = []; + const installer = createModpackInstaller({ + stateDir, + serversDir, + isServerActive: async () => false, + fetchImpl: makeMockFetch({ + "https://cdn.modrinth.com/mod.jar": () => + new Response(new Uint8Array(mod), { status: 200 }), + "https://cdn2.seijin.com.br/pack.zip": () => + new Response(new Uint8Array(archive), { status: 200 }), + }), + resolveModpack: async () => ({ + files: [ + { name: "mod.jar", url: "https://cdn.modrinth.com/mod.jar", sha256: sha256Hex(mod) }, + { name: "example-common.toml", path: "config/example-common.toml" }, + ], + overrides: { url: "https://cdn2.seijin.com.br/pack.zip", prefix: ".", format: "zip" }, + minecraft_version: "1.21.1", + loader: "fabric", + }), + onResult: (ev) => resultEvents.push(ev), + }); + + await installer.startInstall({ + server_id: "smp", + source: "tegra", + modpack_id: "p", + version_id: "v", + }); + await installer.waitForActiveJobs(); + + expect(resultEvents[0]).toMatchObject({ ok: true, installed: 1, skipped: [] }); + expect(readFileSync(join(serversDir, "smp", "config", "example-common.toml"), "utf8")).toBe( + "a=1", + ); + }); + + test("server pack zipped inside a folder with its own start script installs and keeps the agent's script", async () => { + const root = makeTempDir("tegrad-mpi-nested-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + createTestServer(serversDir, "smp"); + + const packZip = createZipBuffer([ + { name: "Pack-Server/mods/create.jar", data: new Uint8Array(Buffer.from("create")) }, + { name: "Pack-Server/config/create.toml", data: new Uint8Array(Buffer.from("a=1")) }, + { + name: "Pack-Server/start.sh", + data: new Uint8Array(Buffer.from("#!/bin/sh" + String.fromCharCode(10) + "echo pack")), + }, + ]); + const resultEvents: ServerInstallModpackResultEvent[] = []; + const installer = createModpackInstaller({ + stateDir, + serversDir, + isServerActive: async () => false, + fetchImpl: makeMockFetch({ + "https://edge.forgecdn.net/files/3/4/pack.zip": () => + new Response(new Uint8Array(packZip), { status: 200 }), + }), + resolveModpack: async () => ({ + server_pack: { + url: "https://edge.forgecdn.net/files/3/4/pack.zip", + sha256: sha256Hex(packZip), + name: "pack.zip", + }, + files: [], + minecraft_version: "1.21.1", + loader: "fabric", + }), + onResult: (ev) => resultEvents.push(ev), + }); + + await installer.startInstall({ + server_id: "smp", + source: "curseforge", + modpack_id: "1", + version_id: "2", + }); + await installer.waitForActiveJobs(); + + expect(resultEvents[0]).toMatchObject({ ok: true, installed: 1 }); + expect(existsSync(join(serversDir, "smp", "mods", "create.jar"))).toBe(true); + expect(readFileSync(join(serversDir, "smp", "config", "create.toml"), "utf8")).toBe("a=1"); + expect(readFileSync(join(serversDir, "smp", "start.sh"), "utf8")).toContain("echo original"); + expect(existsSync(join(serversDir, "smp", "Pack-Server"))).toBe(false); + expect(existsSync(join(stateDir, "modpack-installs", "smp.serverpack.zip"))).toBe(false); + }); + + test("server pack root is the archive root unless every entry sits in one folder", () => { + expect(findServerPackRoot(["mods/a.jar", "start.sh"])).toBe(""); + expect(findServerPackRoot(["Pack/mods/a.jar", "Pack/config/b.toml"])).toBe("Pack"); + expect(findServerPackRoot(["A/x", "B/y"])).toBe(""); + expect(findServerPackRoot(["config/a.toml"])).toBe(""); }); test("refuses a pack built for another Minecraft version or loader before downloading anything", async () => { @@ -693,7 +797,7 @@ describe("Background server.install_modpack", () => { await installer.waitForActiveJobs(); }); - test("rejects path traversal in overrides ZIP with cleanup", async () => { + test("refuses path traversal in overrides, reports it and keeps the installed mods", async () => { const root = makeTempDir("tegrad-mpi-zipslip-"); const stateDir = join(root, "state"); const serversDir = join(root, "servers"); @@ -738,9 +842,10 @@ describe("Background server.install_modpack", () => { }); await installer.waitForActiveJobs(); - expect(resultEvents[0]?.ok).toBe(false); - expect(resultEvents[0]?.error_code).toBe("pack_unavailable"); - expect(existsSync(join(serversDir, "smp", "mods", "mod.jar"))).toBe(false); + expect(resultEvents[0]).toMatchObject({ ok: true, installed: 1 }); + expect(resultEvents[0]?.skipped).toEqual([{ name: "overrides", reason: "pack_unavailable" }]); + expect(existsSync(join(serversDir, "smp", "mods", "mod.jar"))).toBe(true); + expect(existsSync(join(root, "etc", "passwd"))).toBe(false); }); test("enforces editor role and account key sensitivity on CommandQueue and supports status + cancel", async () => { diff --git a/src/state/modpack-installer.ts b/src/state/modpack-installer.ts index 89d9f3a..0c31aaf 100644 --- a/src/state/modpack-installer.ts +++ b/src/state/modpack-installer.ts @@ -17,9 +17,10 @@ import { writeFileAtomic } from "../agent/state"; import { redactUrlQueryStrings } from "../backup/config"; import { FileManagerError, + findServerPackRoot, + listZipEntryNames, readZipEntryFromBuffer, resolveConfinedPath, - safeUnzipBuffer, safeUnzipPrefixesFromBuffer, validateSingleFileName, writeConfinedFileAtomic, @@ -56,8 +57,8 @@ import { readServerMetadata, type ServerMetadata, writeServerMetadata } from ".. import { buildAllowedDownloadHosts, DEFAULT_MAX_MOD_BYTES, - DEFAULT_MAX_SERVERPACK_BYTES, downloadVerifiedBuffer, + downloadVerifiedToFile, isUrlHostAllowed, } from "./download"; import { indexExtractedServerPackFiles, PROTECTED_SERVERPACK_PATHS } from "./manager"; @@ -71,6 +72,9 @@ import { const MODS_DIR = "mods"; const JOBS_SUBDIR = "modpack-installs"; const DEFAULT_CONCURRENCY = 4; +/** Official server packs commonly reach 500-800 MB; the archive is streamed to disk. */ +export const DEFAULT_MAX_MODPACK_SERVER_PACK_BYTES = 2 * 1024 * 1024 * 1024; +const SERVER_PACK_DOWNLOAD_TIMEOUT_MS = 30 * 60 * 1000; export interface ModpackInstallerOptions { readonly stateDir: string; @@ -365,6 +369,21 @@ export function assertRuntimeMatches( } } +/** + * Maps the archive into memory (file-backed pages the kernel can drop under pressure) where the + * platform supports it, and reads it normally otherwise (Windows development builds). + */ +function mapArchive(path: string): Uint8Array { + if (process.platform !== "win32") { + try { + return Bun.mmap(path, { shared: false }); + } catch { + // Fall back to a plain read below. + } + } + return new Uint8Array(readFileSync(path)); +} + function digestsEqual(actualHex: string, expectedHex: string): boolean { const a = Buffer.from(actualHex.toLowerCase(), "hex"); const b = Buffer.from(expectedHex.toLowerCase(), "hex"); @@ -422,7 +441,7 @@ export function createModpackInstaller(options: ModpackInstallerOptions): Modpac ...(options.extraAllowedHosts ?? []), ]); const maxModBytes = options.maxModBytes ?? DEFAULT_MAX_MOD_BYTES; - const maxServerPackBytes = options.maxServerPackBytes ?? DEFAULT_MAX_SERVERPACK_BYTES; + const maxServerPackBytes = options.maxServerPackBytes ?? DEFAULT_MAX_MODPACK_SERVER_PACK_BYTES; const concurrency = Math.max(1, options.concurrency ?? DEFAULT_CONCURRENCY); const now = options.now ?? (() => Date.now()); const permissionContext: PermissionContext = createServerPermissionContext({ @@ -507,6 +526,50 @@ export function createModpackInstaller(options: ModpackInstallerOptions): Modpac } } + function writeOriginMetadata(record: PersistedJobRecord): void { + const meta = readServerMetadata(serversDir, record.server_id); + const mergedMods = new Map((meta.mods ?? []).map((m) => [m.file, m])); + for (const modEntry of record.installed_mods) { + mergedMods.set(modEntry.file, modEntry); + } + + const nextOrigin: ServerOrigin = { + kind: "modpack", + source: record.source, + modpack_id: record.modpack_id, + version_id: record.version_id, + ...(record.modpack_name !== undefined ? { modpack_name: record.modpack_name } : {}), + }; + + const syncedModKeys = [ + ...new Set( + record.installed_mods.map((entry) => + modIdentityKey({ + filename: entry.file, + modInfo: entry.project_id !== undefined ? { modId: entry.project_id } : null, + }), + ), + ), + ].sort(); + + const nextSync: ServerOriginSyncState = { + excluded_mod_keys: [], + synced_mod_keys: syncedModKeys, + removed_origin_files: [], + synced_files: [...new Set(record.synced_files)].sort(), + last_synced_at: new Date(now()).toISOString(), + last_synced_version_id: record.version_id, + }; + + const nextMeta: ServerMetadata = { + ...meta, + origin: nextOrigin, + mods: [...mergedMods.values()].sort((a, b) => a.file.localeCompare(b.file)), + origin_sync: nextSync, + }; + writeServerMetadata(serversDir, nextMeta, permissionContext); + } + function cleanupWrittenFiles(serverId: string, writtenPaths: readonly string[]): void { for (const relPath of writtenPaths) { if (PROTECTED_SERVERPACK_PATHS.has(relPath.toLowerCase())) { @@ -637,12 +700,20 @@ export function createModpackInstaller(options: ModpackInstallerOptions): Modpac persistJob(record); emitProgress(record); - const downloaded = await downloadWithPolicy( - pack.url, - { sha1: pack.sha1, sha256: pack.sha256, sha512: pack.sha512 }, - maxServerPackBytes, + // Server packs run to hundreds of megabytes: stream them to disk and read the + // archive through a memory map instead of holding it in the process heap. + const packPath = join(jobsDir, `${record.server_id}.serverpack.zip`); + await downloadVerifiedToFile({ + url: pack.url, + destPath: packPath, + allowedHosts, + expectedHashes: { sha1: pack.sha1, sha256: pack.sha256, sha512: pack.sha512 }, + maxBytes: maxServerPackBytes, signal, - ); + timeoutMs: options.downloadTimeoutMs ?? SERVER_PACK_DOWNLOAD_TIMEOUT_MS, + ...(options.maxRedirects !== undefined ? { maxRedirects: options.maxRedirects } : {}), + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + }); assertNotCancelled(); record.phase = "extracting"; @@ -652,13 +723,26 @@ export function createModpackInstaller(options: ModpackInstallerOptions): Modpac persistJob(record); emitProgress(record); - const unzipResult = safeUnzipBuffer({ - serversBaseDir: serversDir, - serverId: record.server_id, - buffer: downloaded.data, - forbiddenPaths: PROTECTED_SERVERPACK_PATHS, - permissions: permissionContext, - }); + let unzipResult: ReturnType; + try { + const archive = mapArchive(packPath); + // The pack's own start scripts and the agent's metadata are left as the agent + // wrote them; everything else in the pack is installed. + unzipResult = safeUnzipPrefixesFromBuffer({ + serversBaseDir: serversDir, + serverId: record.server_id, + buffer: archive, + prefixes: [findServerPackRoot(listZipEntryNames(archive))], + skipPaths: PROTECTED_SERVERPACK_PATHS, + permissions: permissionContext, + }); + } finally { + try { + unlinkSync(packPath); + } catch { + // Already removed. + } + } for (const rel of unzipResult.files) { addWrittenPathUnique(record, rel); } @@ -793,7 +877,17 @@ export function createModpackInstaller(options: ModpackInstallerOptions): Modpac } const { file, relPath } = item; - if (file.blocked === true || file.url === undefined || file.url.trim().length === 0) { + const hasUrl = file.url !== undefined && file.url.trim().length > 0; + if (!hasUrl && file.blocked !== true && resolved.overrides !== undefined) { + // Listed without a download link: the file ships inside the pack archive and is + // written with the overrides, so there is nothing to fetch and nothing to report. + completedSet.add(relPath); + record.completed_files = [...completedSet]; + record.done++; + persistJob(record); + continue; + } + if (file.blocked === true || !hasUrl || file.url === undefined) { addSkippedUnique(record, file.name, file.blocked_reason ?? "distribution_disabled"); completedSet.add(relPath); record.completed_files = [...completedSet]; @@ -846,37 +940,16 @@ export function createModpackInstaller(options: ModpackInstallerOptions): Modpac controller.abort(); break; } - if (err instanceof ProtocolError && err.code === "hash_mismatch") { - fatalError = err; - controller.abort(); - break; - } - if ( - err instanceof ProtocolError && - err.code === "download_failed" && - err.message.toLowerCase().includes("maximum allowed size") - ) { - fatalError = err; - controller.abort(); - break; - } - if ( - err instanceof ProtocolError && - err.code === "download_failed" && - err.message.toLowerCase().includes("not allowed") - ) { - addSkippedUnique(record, file.name, "host_not_allowed"); - completedSet.add(relPath); - record.completed_files = [...completedSet]; - record.done++; - record.current = file.name.slice(0, 256); - persistJob(record); - emitProgress(record); - continue; - } - fatalError = err; - controller.abort(); - break; + // One file that cannot be fetched never sinks the whole install: it is reported + // as skipped with the reason and the rest of the pack keeps going. + addSkippedUnique(record, file.name, classifyInstallError(err)); + completedSet.add(relPath); + record.completed_files = [...completedSet]; + record.done++; + record.current = file.name.slice(0, 256); + persistJob(record); + emitProgress(record); + continue; } assertNotCancelled(); @@ -942,50 +1015,71 @@ export function createModpackInstaller(options: ModpackInstallerOptions): Modpac persistJob(record); emitProgress(record); - let archiveBuffer = cachedMrpackBuffer; - if (archiveBuffer === null) { - const downloadedOverrides = await downloadWithPolicy( - resolved.overrides.url, - { - sha1: resolved.overrides.sha1, - sha256: resolved.overrides.sha256, - sha512: resolved.overrides.sha512, - }, - maxServerPackBytes, - signal, - ); - assertNotCancelled(); - archiveBuffer = downloadedOverrides.data; - } + try { + let archiveBuffer = cachedMrpackBuffer; + if (archiveBuffer === null) { + const downloadedOverrides = await downloadWithPolicy( + resolved.overrides.url, + { + sha1: resolved.overrides.sha1, + sha256: resolved.overrides.sha256, + sha512: resolved.overrides.sha512, + }, + maxServerPackBytes, + signal, + ); + assertNotCancelled(); + archiveBuffer = downloadedOverrides.data; + } - const customPrefix = resolved.overrides.prefix?.replace(/^\/+|\/+$/g, ""); - const prefixes: string[] = []; - if (customPrefix !== undefined && customPrefix.length > 0) { - prefixes.push(customPrefix); - } else { - prefixes.push("overrides"); - } - if (!prefixes.includes("server-overrides")) { - prefixes.push("server-overrides"); - } + // "." means the pack keeps its server files at the archive root (Tegra packs); + // otherwise the named folder, defaulting to `overrides/`, plus `server-overrides/`. + const rawPrefix = resolved.overrides.prefix?.trim(); + const atRoot = rawPrefix === "." || rawPrefix === "./"; + const customPrefix = atRoot ? "" : rawPrefix?.replace(/^\/+|\/+$/g, ""); + const prefixes: string[] = atRoot + ? [""] + : [ + customPrefix !== undefined && customPrefix.length > 0 + ? customPrefix + : "overrides", + ]; + if (!atRoot && !prefixes.includes("server-overrides")) { + prefixes.push("server-overrides"); + } - const unzipOverrides = safeUnzipPrefixesFromBuffer({ - serversBaseDir: serversDir, - serverId: record.server_id, - buffer: archiveBuffer, - prefixes, - excludePrefixes: ["client-overrides"], - skipPaths: PROTECTED_SERVERPACK_PATHS, - permissions: permissionContext, - }); + const unzipOverrides = safeUnzipPrefixesFromBuffer({ + serversBaseDir: serversDir, + serverId: record.server_id, + buffer: archiveBuffer, + prefixes, + excludePrefixes: atRoot + ? ["client-overrides", "shaderpacks", "mods"] + : ["client-overrides"], + skipPaths: PROTECTED_SERVERPACK_PATHS, + permissions: permissionContext, + }); - for (const rel of unzipOverrides.files) { - addWrittenPathUnique(record, rel); - if (isServerContentPath(rel)) { - syncedFileSet.add(rel); + for (const rel of unzipOverrides.files) { + addWrittenPathUnique(record, rel); + if (isServerContentPath(rel)) { + syncedFileSet.add(rel); + } } + record.synced_files = [...syncedFileSet]; + } catch (err) { + const code = classifyInstallError(err); + if (code === "cancelled") throw err; + // Configs and scripts that could not be applied are reported; the mods already + // installed stay on the server. + addSkippedUnique(record, "overrides", code); + options.logger?.warn("Modpack overrides were not applied", { + serverId: record.server_id, + jobId: record.job_id, + errorCode: code, + reason: redactUrlQueryStrings(err instanceof Error ? err.message : String(err)), + }); } - record.synced_files = [...syncedFileSet]; record.overrides_extracted = true; record.done = 1; record.total = 1; @@ -1004,47 +1098,7 @@ export function createModpackInstaller(options: ModpackInstallerOptions): Modpac persistJob(record); emitProgress(record); - const meta = readServerMetadata(serversDir, record.server_id); - const mergedMods = new Map((meta.mods ?? []).map((m) => [m.file, m])); - for (const modEntry of record.installed_mods) { - mergedMods.set(modEntry.file, modEntry); - } - - const nextOrigin: ServerOrigin = { - kind: "modpack", - source: record.source, - modpack_id: record.modpack_id, - version_id: record.version_id, - ...(record.modpack_name !== undefined ? { modpack_name: record.modpack_name } : {}), - }; - - const syncedModKeys = [ - ...new Set( - record.installed_mods.map((entry) => - modIdentityKey({ - filename: entry.file, - modInfo: entry.project_id !== undefined ? { modId: entry.project_id } : null, - }), - ), - ), - ].sort(); - - const nextSync: ServerOriginSyncState = { - excluded_mod_keys: [], - synced_mod_keys: syncedModKeys, - removed_origin_files: [], - synced_files: [...new Set(record.synced_files)].sort(), - last_synced_at: new Date(now()).toISOString(), - last_synced_version_id: record.version_id, - }; - - const nextMeta: ServerMetadata = { - ...meta, - origin: nextOrigin, - mods: [...mergedMods.values()].sort((a, b) => a.file.localeCompare(b.file)), - origin_sync: nextSync, - }; - writeServerMetadata(serversDir, nextMeta, permissionContext); + writeOriginMetadata(record); record.status = "completed"; record.done = 1; @@ -1074,10 +1128,27 @@ export function createModpackInstaller(options: ModpackInstallerOptions): Modpac return; } - cleanupWrittenFiles(record.server_id, record.written_paths); + if (errorCode === "cancelled") { + cleanupWrittenFiles(record.server_id, record.written_paths); + record.installed = 0; + } else { + // Keep every file that already landed and record it, so the server is never left + // with fewer mods than the install managed to put on it. + try { + if (record.installed_mods.length > 0 || record.synced_files.length > 0) { + writeOriginMetadata(record); + } + } catch (metaErr) { + options.logger?.warn("Could not record the partial modpack install", { + serverId: record.server_id, + jobId: record.job_id, + reason: metaErr instanceof Error ? metaErr.message : String(metaErr), + }); + } + record.installed = record.installed_mods.length; + } record.status = errorCode === "cancelled" ? "cancelled" : "failed"; record.error_code = errorCode; - record.installed = 0; record.finished_at = now(); persistJob(record); emitResult(record); diff --git a/src/state/state.test.ts b/src/state/state.test.ts index caba1fb..c6327e9 100644 --- a/src/state/state.test.ts +++ b/src/state/state.test.ts @@ -30,7 +30,11 @@ import { import type { FetchLike } from "../server/download"; import { readServerMetadata, type ServerMetadata, writeServerMetadata } from "../server/registry"; import type { BackupHook } from "./backup-hook"; -import { buildAllowedDownloadHosts, downloadVerifiedBuffer } from "./download"; +import { + buildAllowedDownloadHosts, + downloadVerifiedBuffer, + downloadVerifiedToFile, +} from "./download"; import { isVersionLoaderLocked } from "./lock"; import { createStateManager } from "./manager"; @@ -290,6 +294,53 @@ describe("safe downloads (host allowlist, redirects, size cap, hashes)", () => { }); }); +describe("streamed downloads to disk", () => { + test("writes the body to the file, returns its hashes and removes the file on a bad hash", async () => { + const dir = mkdtempSync(join(tmpdir(), "tegrad-dl-file-")); + try { + const body = new Uint8Array(Buffer.from("server-pack-bytes")); + const sha1 = createHash("sha1").update(body).digest("hex"); + const fetchImpl: FetchLike = async () => new Response(new Uint8Array(body), { status: 200 }); + const allowedHosts = buildAllowedDownloadHosts(); + + const ok = await downloadVerifiedToFile({ + url: "https://edge.forgecdn.net/files/1/2/pack.zip", + destPath: join(dir, "ok.zip"), + allowedHosts, + expectedHashes: { sha1 }, + fetchImpl, + }); + expect(ok.bytes).toBe(body.byteLength); + expect(ok.sha1).toBe(sha1); + expect(readFileSync(join(dir, "ok.zip"))).toEqual(Buffer.from(body)); + + await expect( + downloadVerifiedToFile({ + url: "https://edge.forgecdn.net/files/1/2/pack.zip", + destPath: join(dir, "bad.zip"), + allowedHosts, + expectedHashes: { sha1: "0".repeat(40) }, + fetchImpl, + }), + ).rejects.toMatchObject({ code: "hash_mismatch" }); + expect(existsSync(join(dir, "bad.zip"))).toBe(false); + + await expect( + downloadVerifiedToFile({ + url: "https://edge.forgecdn.net/files/1/2/pack.zip", + destPath: join(dir, "big.zip"), + allowedHosts, + maxBytes: 4, + fetchImpl, + }), + ).rejects.toMatchObject({ code: "download_failed" }); + expect(existsSync(join(dir, "big.zip"))).toBe(false); + } finally { + rmSync(dir, { recursive: true, force: true }); + } + }); +}); + describe("StateManager: mods, version/loader lock, origin sync, and server pack deploy", () => { test("installs and removes mods safely, rejects bad hashes and path traversal", async () => { const serversDir = makeTempDir("tegrad-state-mods-"); From c2a0b9c89c382d1fab6985423430f3fb800d3f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Fri, 27 Nov 2026 22:05:01 -0300 Subject: [PATCH 41/59] fix(security): keep permission changes inside the server folder The Minecraft process can swap any folder in its directory for a symbolic link. finalizeServerPath and secureTree checked with lstat and then changed group and mode by path, so a swap in that window could make the agent chown and chmod its own state for the server group. - Resolve every component through directory descriptors (/proc/self/fd, same guarantee as openat2 RESOLVE_BENEATH) and apply fchown/fchmod on the opened descriptor; links are refused at any depth. - Server units no longer see the agent state, the backups or other server folders (InaccessiblePaths, TemporaryFileSystem + BindPaths). --- install/units/tegrad-server@.service | 8 ++ src/install/units.test.ts | 12 ++ src/server/open-beneath.test.ts | 89 +++++++++++++++ src/server/open-beneath.ts | 68 +++++++++++ src/server/permissions.ts | 162 ++++++++++++++++++++++++++- 5 files changed, 338 insertions(+), 1 deletion(-) create mode 100644 src/server/open-beneath.test.ts create mode 100644 src/server/open-beneath.ts diff --git a/install/units/tegrad-server@.service b/install/units/tegrad-server@.service index a2755b2..fe4336c 100644 --- a/install/units/tegrad-server@.service +++ b/install/units/tegrad-server@.service @@ -28,6 +28,14 @@ StandardError=append:@TEGRAD_SERVERS_DIR@/%i/logs/console.log # executable memory mappings. PrivateNetwork is intentionally omitted because # the server needs network access; LAN isolation is applied via 10-network.conf. # Per-server CPU and memory limits are applied dynamically via systemctl set-property. +# Defense in depth on top of the ownership rules: the agent's state, the backups and +# every other server folder are not even mounted in this server's view. Only its own +# folder (read-write) and the shared Java runtimes (read-only) exist under the servers +# root, so a permission mistake elsewhere can never expose them to mod code. +InaccessiblePaths=-@TEGRAD_STATE_DIR@ -@TEGRAD_BACKUPS_DIR@ +TemporaryFileSystem=@TEGRAD_SERVERS_DIR@:ro +BindPaths=@TEGRAD_SERVERS_DIR@/%i +BindReadOnlyPaths=@TEGRAD_SERVERS_DIR@/.runtime NoNewPrivileges=yes ProtectSystem=strict ReadWritePaths=@TEGRAD_SERVERS_DIR@/%i diff --git a/src/install/units.test.ts b/src/install/units.test.ts index 51c1c63..85c7db8 100644 --- a/src/install/units.test.ts +++ b/src/install/units.test.ts @@ -307,6 +307,18 @@ describe("Security regression checks on install/ assets", () => { } }); + test("server units hide the agent state, backups and other servers from mod code", () => { + const directives = parseIniDirectives(readInstallFile("units/tegrad-server@.service")); + const inaccessible = (directives.get("InaccessiblePaths") ?? []).flatMap((line) => + line.split(/\s+/), + ); + expect(inaccessible).toContain("-@TEGRAD_STATE_DIR@"); + expect(inaccessible).toContain("-@TEGRAD_BACKUPS_DIR@"); + expect(directives.get("TemporaryFileSystem")).toEqual(["@TEGRAD_SERVERS_DIR@:ro"]); + expect(directives.get("BindPaths")).toEqual(["@TEGRAD_SERVERS_DIR@/%i"]); + expect(directives.get("BindReadOnlyPaths")).toEqual(["@TEGRAD_SERVERS_DIR@/.runtime"]); + }); + test("tegrad-update.path and tegrad-update.service enforce strict sandboxing and confined ExecStart", () => { const pathContent = readInstallFile("units/tegrad-update.path"); const pathDirectives = parseIniDirectives(pathContent); diff --git a/src/server/open-beneath.test.ts b/src/server/open-beneath.test.ts new file mode 100644 index 0000000..dfb7145 --- /dev/null +++ b/src/server/open-beneath.test.ts @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, describe, expect, test } from "bun:test"; +import { + chmodSync, + closeSync, + constants as fsConstants, + mkdirSync, + mkdtempSync, + rmSync, + statSync, + symlinkSync, + writeFileSync, +} from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { isLinkRefusal, openBeneath } from "./open-beneath"; +import { finalizeServerPath, SERVER_TREE_PLAN, secureTree } from "./permissions"; + +const linux = process.platform === "linux"; +const dirs: string[] = []; + +function layout(): { root: string; server: string; secret: string } { + const base = mkdtempSync(join(tmpdir(), "tegrad-beneath-")); + dirs.push(base); + const root = join(base, "servers"); + const server = join(root, "srv"); + const secret = join(base, "state"); + mkdirSync(join(server, "real"), { recursive: true }); + mkdirSync(secret); + writeFileSync(join(secret, "identity.json"), "secret"); + chmodSync(join(secret, "identity.json"), 0o600); + writeFileSync(join(secret, "console.log"), "secret"); + chmodSync(join(secret, "console.log"), 0o600); + // The server swapped its logs folder for a link to the agent's state. + symlinkSync(secret, join(server, "logs")); + return { root, server, secret }; +} + +afterEach(() => { + for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true }); +}); + +describe.skipIf(!linux)("openBeneath", () => { + test("refuses a link in an intermediate folder", () => { + const { root, server } = layout(); + let error: unknown; + try { + closeSync(openBeneath(root, join(server, "logs", "console.log"), fsConstants.O_RDONLY)); + } catch (err) { + error = err; + } + expect(isLinkRefusal(error)).toBe(true); + }); + + test("opens a regular path under the root", () => { + const { root, server } = layout(); + writeFileSync(join(server, "real", "a.txt"), "a"); + closeSync(openBeneath(root, join(server, "real", "a.txt"), fsConstants.O_RDONLY)); + }); +}); + +describe.skipIf(!linux)("permission changes never leave the server folder", () => { + const gid = process.getgid?.() ?? 0; + + test("finalizeServerPath ignores a target reached through a linked folder", () => { + const { root, server, secret } = layout(); + finalizeServerPath(join(server, "logs", "console.log"), 0o660, { gid, serversRoot: root }); + expect(statSync(join(secret, "console.log")).mode & 0o777).toBe(0o600); + }); + + test("secureTree does not walk into a linked folder", () => { + const { root, server, secret } = layout(); + writeFileSync(join(server, "real", "a.txt"), "a"); + chmodSync(join(server, "real", "a.txt"), 0o600); + secureTree(server, SERVER_TREE_PLAN, { gid, serversRoot: root }); + expect(statSync(join(server, "real", "a.txt")).mode & 0o777).toBe(0o660); + expect(statSync(join(secret, "identity.json")).mode & 0o777).toBe(0o600); + expect(statSync(join(secret, "console.log")).mode & 0o777).toBe(0o600); + }); + + test("secureTree on a path whose parent is a link changes nothing", () => { + const { root, server, secret } = layout(); + secureTree(join(server, "logs"), SERVER_TREE_PLAN, { gid, serversRoot: root }); + expect(statSync(secret).mode & 0o777).not.toBe(0o770); + expect(statSync(join(secret, "identity.json")).mode & 0o777).toBe(0o600); + }); +}); diff --git a/src/server/open-beneath.ts b/src/server/open-beneath.ts new file mode 100644 index 0000000..5a39299 --- /dev/null +++ b/src/server/open-beneath.ts @@ -0,0 +1,68 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { closeSync, constants as fsConstants, openSync } from "node:fs"; +import { isAbsolute, relative, sep } from "node:path"; + +const O_NOFOLLOW = fsConstants.O_NOFOLLOW ?? 0; +const O_DIRECTORY = fsConstants.O_DIRECTORY ?? 0; +const DIR_FLAGS = fsConstants.O_RDONLY | O_DIRECTORY | O_NOFOLLOW; + +/** + * Server folders are writable by the Minecraft process, which runs untrusted mod code + * and can swap any file or folder for a symbolic link at any moment. A plain + * `lstat` then `open(path)` leaves a window where an intermediate folder becomes a + * link to the agent's own state, so every path is resolved one component at a time + * from directory descriptors instead. + */ +export function procFdPathSupported(platform: NodeJS.Platform = process.platform): boolean { + return platform === "linux"; +} + +/** Path that the kernel resolves through an open descriptor, never through the folder names. */ +export function fdPath(fd: number, name?: string): string { + return name === undefined ? `/proc/self/fd/${fd}` : `/proc/self/fd/${fd}/${name}`; +} + +/** + * Opens `target`, which must live under `root`, without following a symbolic link at + * any component below `root`. On Linux each folder is opened through the descriptor of + * its parent (`/proc/self/fd/N/name`, the same guarantee as `openat2` with + * `RESOLVE_BENEATH | RESOLVE_NO_SYMLINKS`). Elsewhere, or when `target` is not under + * `root`, only the last component is protected (`O_NOFOLLOW`). + * + * Throws the raw errno error (`ELOOP` or `ENOTDIR` when a link was met). + */ +export function openBeneath(root: string | undefined, target: string, flags: number): number { + const rel = root === undefined ? undefined : relative(root, target); + const beneath = + rel !== undefined && + rel !== "" && + !rel.startsWith(`..${sep}`) && + rel !== ".." && + !isAbsolute(rel); + if (!beneath || root === undefined || rel === undefined || !procFdPathSupported()) { + return openSync(target, flags | O_NOFOLLOW); + } + + const segments = rel.split(sep).filter((segment) => segment.length > 0); + let dirFd = openSync(root, fsConstants.O_RDONLY | O_DIRECTORY); + try { + for (let i = 0; i < segments.length - 1; i++) { + const next = openSync(fdPath(dirFd, segments[i]), DIR_FLAGS); + closeSync(dirFd); + dirFd = next; + } + const last = segments[segments.length - 1] ?? ""; + return openSync(fdPath(dirFd, last), flags | O_NOFOLLOW); + } finally { + closeSync(dirFd); + } +} + +/** True when an open failed because a symbolic link was in the way. */ +export function isLinkRefusal(err: unknown): boolean { + if (typeof err !== "object" || err === null || !("code" in err)) return false; + const code = (err as { readonly code?: unknown }).code; + return code === "ELOOP" || code === "ENOTDIR" || code === "EMLINK"; +} diff --git a/src/server/permissions.ts b/src/server/permissions.ts index 1282ada..85dd3cb 100644 --- a/src/server/permissions.ts +++ b/src/server/permissions.ts @@ -1,10 +1,25 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import { chmodSync, chownSync, existsSync, lstatSync, readdirSync, readFileSync } from "node:fs"; +import { + chmodSync, + chownSync, + closeSync, + type Dirent, + existsSync, + fchmodSync, + fchownSync, + constants as fsConstants, + fstatSync, + lstatSync, + readdirSync, + readFileSync, + type Stats, +} from "node:fs"; import { basename, join, resolve } from "node:path"; import { sanitizeErrorMessage } from "../agent/jobs"; import type { Logger } from "../agent/logger"; +import { fdPath, isLinkRefusal, openBeneath, procFdPathSupported } from "./open-beneath"; /** Group that the Minecraft server processes run as. The agent is a member, not the owner. */ export const SERVER_GROUP_NAME = "tegrad-srv"; @@ -234,6 +249,23 @@ export function finalizeServerPath( return []; } + if (ctx.fs === undefined) { + let fd: number; + try { + fd = openBeneath(ctx.serversRoot, targetPath, NODE_RDONLY_NONBLOCK); + } catch (err) { + if (isLinkRefusal(err)) return []; + const failure = buildFailure(targetPath, "lstat", err); + reportFailure(ctx, failure, err); + return [failure]; + } + try { + return finalizeOpenFd(fd, targetPath, mode, ctx); + } finally { + closeSync(fd); + } + } + const fsOps = resolveFsOps(ctx.fs); const desiredMode = mode & 0o777; const failures: PermissionFailure[] = []; @@ -274,6 +306,131 @@ export function finalizeServerPath( return failures; } +const NODE_RDONLY_NONBLOCK = fsConstants.O_RDONLY | (fsConstants.O_NONBLOCK ?? 0); + +/** + * Applies group and mode through an already opened descriptor, so a link swapped in + * after the open can never redirect the change to another file. Only regular files and + * folders are touched. + */ +function finalizeOpenFd( + fd: number, + displayPath: string, + mode: number, + ctx: PermissionContext, +): PermissionFailure[] { + const desiredMode = mode & 0o777; + const failures: PermissionFailure[] = []; + let stat: Stats; + try { + stat = fstatSync(fd); + } catch (err) { + const failure = buildFailure(displayPath, "lstat", err); + reportFailure(ctx, failure, err); + return [failure]; + } + if (!stat.isFile() && !stat.isDirectory()) { + return []; + } + if (ctx.gid !== null && stat.gid !== ctx.gid) { + try { + fchownSync(fd, stat.uid, ctx.gid); + } catch (err) { + const failure = buildFailure(displayPath, "chown", err); + failures.push(failure); + reportFailure(ctx, failure, err); + } + } + if ((stat.mode & 0o777) !== desiredMode) { + try { + fchmodSync(fd, desiredMode); + } catch (err) { + const failure = buildFailure(displayPath, "chmod", err); + failures.push(failure); + reportFailure(ctx, failure, err); + } + } + return failures; +} + +/** + * Descriptor-based tree walk: every child is reached through its parent's descriptor, + * so swapping a folder for a link mid-walk cannot steer the walk outside the tree. + */ +function secureTreeByFd( + root: string, + plan: TreePermissionPlan, + ctx: PermissionContext, +): PermissionFailure[] { + const failures: PermissionFailure[] = []; + const dirFlags = fsConstants.O_RDONLY | (fsConstants.O_DIRECTORY ?? 0); + + function walk(openDir: () => number, displayPath: string): void { + let dirFd: number; + try { + dirFd = openDir(); + } catch (err) { + if (isLinkRefusal(err)) return; + const failure = buildFailure(displayPath, "lstat", err); + failures.push(failure); + reportFailure(ctx, failure, err); + return; + } + try { + if (!isServersRoot(displayPath, ctx)) { + failures.push(...finalizeOpenFd(dirFd, displayPath, plan.dirMode, ctx)); + } + let entries: Dirent[]; + try { + entries = readdirSync(procFdPathSupported() ? fdPath(dirFd) : displayPath, { + withFileTypes: true, + }); + } catch (err) { + const failure = buildFailure(displayPath, "readdir", err); + failures.push(failure); + reportFailure(ctx, failure, err); + return; + } + for (const entry of entries) { + if (entry.isSymbolicLink()) continue; + const childDisplay = join(displayPath, entry.name); + const childPath = procFdPathSupported() ? fdPath(dirFd, entry.name) : childDisplay; + if (entry.isDirectory()) { + walk(() => openBeneath(undefined, childPath, dirFlags), childDisplay); + } else if (entry.isFile()) { + let fd: number; + try { + fd = openBeneath(undefined, childPath, NODE_RDONLY_NONBLOCK); + } catch (err) { + if (isLinkRefusal(err)) continue; + const failure = buildFailure(childDisplay, "lstat", err); + failures.push(failure); + reportFailure(ctx, failure, err); + continue; + } + try { + const executable = (fstatSync(fd).mode & 0o100) !== 0; + failures.push( + ...finalizeOpenFd(fd, childDisplay, executable ? plan.execMode : plan.fileMode, ctx), + ); + } catch (err) { + const failure = buildFailure(childDisplay, "lstat", err); + failures.push(failure); + reportFailure(ctx, failure, err); + } finally { + closeSync(fd); + } + } + } + } finally { + closeSync(dirFd); + } + } + + walk(() => openBeneath(ctx.serversRoot, root, dirFlags), root); + return failures; +} + /** Finalizes group and mode of one directory via finalizeServerPath. */ export function secureDirectory( dirPath: string, @@ -297,6 +454,9 @@ export function secureTree( if (!isPosix(ctx.platform)) { return []; } + if (ctx.fs === undefined) { + return secureTreeByFd(root, plan, ctx); + } const fsOps = resolveFsOps(ctx.fs); const failures: PermissionFailure[] = []; From 43f8313d3063062ee8bf58f57d94611b0a55062b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Fri, 27 Nov 2026 23:50:21 -0300 Subject: [PATCH 42/59] fix(files): reach server folders only through open descriptors Mod code can swap any folder in the server directory for a symbolic link in the middle of an agent operation. Backups, recursive delete, move, copy, write, upload, read and listing used plain paths after an lstat check, so a swap at the right moment made the agent pack, delete, write or read its own state. Folders are now opened one component at a time with O_NOFOLLOW and every child is reached through /proc/self/fd/N/name (DirHandle), so a swap after opening has no effect. Race tests swap a folder in a separate process while the agent repeats each operation; all six fail on the old code and pass on the new one. --- src/backup/archive.ts | 161 +++++++------ src/files/confinement.ts | 244 +++++++++++++------- src/files/index.ts | 4 + src/files/manager.ts | 458 +++++++++++++++++-------------------- src/files/race.test.ts | 231 +++++++++++++++++++ src/files/transfers.ts | 134 ++++++----- src/files/zip.ts | 55 +++-- src/server/open-beneath.ts | 142 +++++++++++- 8 files changed, 939 insertions(+), 490 deletions(-) create mode 100644 src/files/race.test.ts diff --git a/src/backup/archive.ts b/src/backup/archive.ts index 7f0ef4b..81801b6 100644 --- a/src/backup/archive.ts +++ b/src/backup/archive.ts @@ -1,25 +1,15 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import { - closeSync, - constants, - existsSync, - fstatSync, - lstatSync, - openSync, - readdirSync, - readSync, - type Stats, -} from "node:fs"; -import { join } from "node:path"; +import { closeSync, constants, existsSync, fstatSync, readSync, type Stats } from "node:fs"; import type { Logger } from "../agent/logger"; import { createZipBuffer, DEFAULT_SERVERS_BASE_DIR, MAX_ZIP_CREATE_BYTES, MAX_ZIP_CREATE_FILES, - openConfinedFileForRead, + openConfinedDirAt, + openFileInDirForRead, RUNTIME_DIR_NAME, resolveConfinedPath, resolveServerRoot, @@ -29,9 +19,11 @@ import { UPLOAD_STAGING_DIR_NAME, UPLOAD_STAGING_FILE_PREFIX, validateServerId, + withConfinedParent, type ZipEntryInput, } from "../files"; import { ProtocolError } from "../protocol"; +import { type DirHandle, isLinkRefusal } from "../server/open-beneath"; import type { PermissionContext } from "../server/permissions"; import { type MakeServerReadableLike, makeServerReadable } from "../server/readable"; import type { ServerRuntimeProvider } from "./types"; @@ -71,43 +63,53 @@ function readAllFromFd(fd: number, maxBytes: number): Uint8Array { return out; } -function getConsoleLogSize(logPath: string): number { - const lstat = lstatSync(logPath, { throwIfNoEntry: false }); - if (lstat === undefined || lstat.isSymbolicLink() || !lstat.isFile()) { +type ConsoleLogRef = Parameters[0]; + +function openConsoleLog(log: ConsoleLogRef): number | undefined { + try { + return withConfinedParent(log, (dir, name) => dir.openFile(name, constants.O_RDONLY)); + } catch { + return undefined; + } +} + +function getConsoleLogSize(log: ConsoleLogRef): number { + const fd = openConsoleLog(log); + if (fd === undefined) { return 0; } - return lstat.size; + try { + const st = fstatSync(fd); + return st.isFile() ? st.size : 0; + } finally { + closeSync(fd); + } } function readLogTailText( - logPath: string, + log: ConsoleLogRef, fromOffset: number, ): { readonly text: string; readonly nextOffset: number; } { - const lstat = lstatSync(logPath, { throwIfNoEntry: false }); - if (lstat === undefined || lstat.isSymbolicLink() || !lstat.isFile()) { + const fd = openConsoleLog(log); + if (fd === undefined) { return { text: "", nextOffset: fromOffset }; } - - const size = lstat.size; - const effectiveOffset = size < fromOffset ? 0 : fromOffset; - const available = size - effectiveOffset; - if (available <= 0) { - return { text: "", nextOffset: effectiveOffset }; - } - - const toRead = Math.min(available, 256 * 1024); - const buf = Buffer.allocUnsafe(toRead); - const openFlags = constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0); - let fd: number | undefined; try { - fd = openSync(logPath, openFlags); const fdStat = fstatSync(fd); if (!fdStat.isFile()) { + return { text: "", nextOffset: fromOffset }; + } + const size = fdStat.size; + const effectiveOffset = size < fromOffset ? 0 : fromOffset; + const available = size - effectiveOffset; + if (available <= 0) { return { text: "", nextOffset: effectiveOffset }; } + const toRead = Math.min(available, 256 * 1024); + const buf = Buffer.allocUnsafe(toRead); const bytesRead = readSync(fd, buf, 0, toRead, effectiveOffset); if (bytesRead <= 0) { return { text: "", nextOffset: effectiveOffset }; @@ -117,20 +119,18 @@ function readLogTailText( nextOffset: effectiveOffset + bytesRead, }; } catch { - return { text: "", nextOffset: effectiveOffset }; + return { text: "", nextOffset: fromOffset }; } finally { - if (fd !== undefined) { - try { - closeSync(fd); - } catch { - // ignore close failure - } + try { + closeSync(fd); + } catch { + // ignore close failure } } } export interface WaitForSaveOptions { - readonly logPath: string; + readonly log: ConsoleLogRef; readonly startOffset: number; readonly timeoutMs: number; readonly pollIntervalMs: number; @@ -144,7 +144,7 @@ export async function waitForSaveConfirmation(options: WaitForSaveOptions): Prom let buffer = ""; while (true) { - const chunk = readLogTailText(options.logPath, offset); + const chunk = readLogTailText(options.log, offset); offset = chunk.nextOffset; if (chunk.text.length > 0) { buffer += chunk.text; @@ -192,7 +192,7 @@ export function archiveServerDirectory( const maxFiles = options.maxFiles ?? MAX_ZIP_CREATE_FILES; const maxTotalBytes = options.maxTotalBytes ?? MAX_ZIP_CREATE_BYTES; - const { realServerRoot } = resolveServerRoot(validId, serversBaseDir); + const { serverRoot, realServerRoot } = resolveServerRoot(validId, serversBaseDir); if (!existsSync(realServerRoot)) { throw new ProtocolError("server_not_found", `Server directory not found: ${validId}`); } @@ -200,15 +200,11 @@ export function archiveServerDirectory( const entries: ZipEntryInput[] = []; let totalUncompressed = 0; - function walkDir(relDir: string): void { - const resolvedDir = resolveConfinedPath({ - serversBaseDir, - serverId: validId, - relPath: relDir, - allowRoot: true, - }); - - const children = readdirSync(resolvedDir.fullPath).sort(); + // Each folder is held open and its children are reached through it: mod code can + // swap a folder for a symbolic link mid-walk (backups run with the server on), and + // following it would pack the agent's own keys into the archive. + function walkDir(dir: DirHandle, relDir: string): void { + const children = dir.list().sort(); for (const child of children) { if ( child === RUNTIME_DIR_NAME || @@ -221,8 +217,10 @@ export function archiveServerDirectory( } const childRel = relDir.length > 0 ? `${relDir}/${child}` : child; - const childFull = join(resolvedDir.fullPath, child); - const stats: Stats = lstatSync(childFull); + const stats: Stats | undefined = dir.lstatChild(child); + if (stats === undefined) { + continue; + } if (stats.isSymbolicLink()) { options.logger?.warn("Skipping symbolic link while archiving server backup", { @@ -233,16 +231,33 @@ export function archiveServerDirectory( } if (stats.isDirectory()) { - if (entries.length >= maxFiles) { - throw new ProtocolError("backup_failed", "Backup archive entry count limit exceeded"); + let sub: DirHandle; + try { + sub = dir.openDir(child); + } catch (err) { + if (!isLinkRefusal(err)) { + throw err; + } + options.logger?.warn("Skipping symbolic link while archiving server backup", { + serverId: validId, + path: childRel, + }); + continue; + } + try { + if (entries.length >= maxFiles) { + throw new ProtocolError("backup_failed", "Backup archive entry count limit exceeded"); + } + entries.push({ + name: `${childRel}/`, + data: new Uint8Array(0), + isDirectory: true, + mtime: stats.mtime, + }); + walkDir(sub, childRel); + } finally { + sub.close(); } - entries.push({ - name: `${childRel}/`, - data: new Uint8Array(0), - isDirectory: true, - mtime: stats.mtime, - }); - walkDir(childRel); continue; } @@ -254,13 +269,7 @@ export function archiveServerDirectory( throw new ProtocolError("backup_failed", "Backup archive entry count limit exceeded"); } - const confinedFile = resolveConfinedPath({ - serversBaseDir, - serverId: validId, - relPath: childRel, - allowRoot: false, - }); - const { fd, stats: fdStats } = openConfinedFileForRead(confinedFile); + const { fd, stats: fdStats } = openFileInDirForRead(dir, child); let data: Uint8Array; try { if (totalUncompressed + fdStats.size > maxTotalBytes) { @@ -281,7 +290,12 @@ export function archiveServerDirectory( } } - walkDir(""); + const rootDir = openConfinedDirAt({ serverRoot }, []); + try { + walkDir(rootDir, ""); + } finally { + rootDir.close(); + } const buffer = createZipBuffer(entries); const sha256 = sha256Hex(buffer); @@ -343,14 +357,13 @@ export async function createConsistentServerArchive( relPath: "logs/console.log", allowRoot: false, }); - const logPath = logResolved.fullPath; - const startOffset = getConsoleLogSize(logPath); + const startOffset = getConsoleLogSize(logResolved); await options.runtime.sendConsole(validId, "save-off"); try { await options.runtime.sendConsole(validId, "save-all flush"); await waitForSaveConfirmation({ - logPath, + log: logResolved, startOffset, timeoutMs: saveTimeoutMs, pollIntervalMs: savePollIntervalMs, diff --git a/src/files/confinement.ts b/src/files/confinement.ts index 30c8273..49d9a17 100644 --- a/src/files/confinement.ts +++ b/src/files/confinement.ts @@ -10,15 +10,15 @@ import { fsyncSync, lstatSync, mkdirSync, - openSync, realpathSync, renameSync, type Stats, unlinkSync, writeSync, } from "node:fs"; -import { basename, dirname, join, resolve, sep } from "node:path"; +import { dirname, join, resolve, sep } from "node:path"; import { SERVER_ID_PATTERN } from "../protocol"; +import { type DirHandle, openDirBeneath } from "../server/open-beneath"; import { finalizeServerPath, type PermissionContext, @@ -380,6 +380,75 @@ export function assertNoSymlinkPath(resolved: ConfinedPath): void { assertNoSymlinkSegments(resolved.serverRoot, resolved.realServerRoot, resolved.segments); } +/** + * Opens the folder at `segments` (relative to the server root) without following a + * symbolic link at any level, from the servers base folder down. Mod code can swap a + * folder for a link at any moment, so every operation that touches a server folder + * goes through the returned handle instead of `fullPath`. + */ +export function openConfinedDirAt( + resolved: Pick, + segments: readonly string[], +): DirHandle { + try { + return openDirBeneath(dirname(resolved.serverRoot), join(resolved.serverRoot, ...segments)); + } catch (err) { + throw wrapIoError(err, "Failed to open directory"); + } +} + +/** Runs `fn` with the folder that is `resolved` itself (the server root when empty). */ +export function withConfinedDir(resolved: ConfinedPath, fn: (dir: DirHandle) => T): T { + const dir = openConfinedDirAt(resolved, resolved.segments); + try { + return fn(dir); + } finally { + dir.close(); + } +} + +function finalName(resolved: ConfinedPath): string { + const name = resolved.segments[resolved.segments.length - 1]; + if (name === undefined) { + throw new FileManagerError( + "root_operation_forbidden", + "Operation is not permitted on the server root", + ); + } + return name; +} + +/** + * Runs `fn` with the parent folder of `resolved` held open and the final name. Use + * `dir.child(name)` for `lstat`, `unlink`, `rmdir`, `mkdir`, `rename` and `O_NOFOLLOW` + * opens: none of them follow the final name, and the parent can no longer be swapped. + */ +export function withConfinedParent( + resolved: ConfinedPath, + fn: (dir: DirHandle, name: string) => T, +): T { + const name = finalName(resolved); + const dir = openConfinedDirAt(resolved, resolved.segments.slice(0, -1)); + try { + return fn(dir, name); + } finally { + dir.close(); + } +} + +export async function withConfinedParentAsync( + resolved: ConfinedPath, + fn: (dir: DirHandle, name: string) => Promise, +): Promise { + const name = finalName(resolved); + const dir = openConfinedDirAt(resolved, resolved.segments.slice(0, -1)); + try { + return await fn(dir, name); + } finally { + dir.close(); + } +} + export function ensureConfinedInternalDir( serverRoot: string, realServerRoot: string, @@ -482,13 +551,23 @@ export function openConfinedFileForRead(resolved: ConfinedPath): { } assertNoSymlinkPath(resolved); - let preStat: Stats; + return withConfinedParent(resolved, (dir, name) => openFileInDirForRead(dir, name)); +} + +/** Opens a regular file inside an already opened folder, refusing links and swaps. */ +export function openFileInDirForRead( + dir: DirHandle, + name: string, +): { readonly fd: number; readonly stats: Stats } { + let preStat: Stats | undefined; try { - preStat = lstatSync(resolved.fullPath); + preStat = dir.lstatChild(name); } catch (err) { throw wrapIoError(err, "Failed to stat target file"); } - + if (preStat === undefined) { + throw new FileManagerError("not_found", "Failed to stat target file: path does not exist"); + } if (preStat.isSymbolicLink()) { throw new FileManagerError("symlink_forbidden", "Target file is a symbolic link"); } @@ -499,11 +578,10 @@ export function openConfinedFileForRead(resolved: ConfinedPath): { throw new FileManagerError("not_a_file", "Target path is not a regular file"); } - const noFollow = fsConstants.O_NOFOLLOW ?? 0; const nonBlock = isPosix() ? (fsConstants.O_NONBLOCK ?? 0) : 0; let fd: number; try { - fd = openSync(resolved.fullPath, fsConstants.O_RDONLY | noFollow | nonBlock); + fd = dir.openFile(name, fsConstants.O_RDONLY | nonBlock); } catch (err) { throw wrapIoError(err, "Failed to open target file"); } @@ -564,55 +642,63 @@ export function mkdirConfined(options: { allowRoot: false, }); - let current = resolved.serverRoot; - for (const seg of resolved.segments) { - current = join(current, seg); - let stats: Stats | undefined; - try { - stats = lstatSync(current); - } catch (err) { - if (!isErrnoCode(err, "ENOENT")) { + let dir = openConfinedDirAt(resolved, []); + try { + for (const seg of resolved.segments) { + let stats: Stats | undefined; + try { + stats = dir.lstatChild(seg); + } catch (err) { throw wrapIoError(err, "Failed to inspect directory component"); } - } - if (stats === undefined) { - try { - mkdirSync(current, { mode }); - } catch (err) { - if (!isErrnoCode(err, "EEXIST")) { - throw wrapIoError(err, "Failed to create directory"); + if (stats === undefined) { + try { + mkdirSync(dir.child(seg), { mode }); + } catch (err) { + if (!isErrnoCode(err, "EEXIST")) { + throw wrapIoError(err, "Failed to create directory"); + } + } + try { + stats = dir.lstatChild(seg); + } catch (err) { + throw wrapIoError(err, "Failed to verify created directory"); } + if (stats === undefined) { + throw new FileManagerError("not_found", "Failed to verify created directory"); + } + } + + if (stats.isSymbolicLink()) { + throw new FileManagerError( + "symlink_forbidden", + `Symbolic link encountered at segment "${seg}"`, + ); + } + if (!stats.isDirectory()) { + throw new FileManagerError("not_a_directory", `Path component "${seg}" is not a directory`); } + + let next: DirHandle; try { - stats = lstatSync(current); + next = dir.openDir(seg); } catch (err) { - throw wrapIoError(err, "Failed to verify created directory"); + throw wrapIoError(err, `Failed to open directory component "${seg}"`); } + if (options.permissions !== undefined) { + try { + finalizeServerPath(dir.child(seg), mode, options.permissions); + } catch (err) { + next.close(); + throw err; + } + } + dir.close(); + dir = next; } - - if (stats.isSymbolicLink()) { - throw new FileManagerError( - "symlink_forbidden", - `Symbolic link encountered at segment "${seg}"`, - ); - } - if (!stats.isDirectory()) { - throw new FileManagerError("not_a_directory", `Path component "${seg}" is not a directory`); - } - - let realCurrent: string; - try { - realCurrent = realpathSync(current); - } catch (err) { - throw wrapIoError(err, "Failed to resolve directory path"); - } - if (!isStrictlyInsideOrEqual(resolved.realServerRoot, realCurrent, false)) { - throw new FileManagerError("path_traversal", "Directory escaped server root"); - } - if (options.permissions !== undefined) { - finalizeServerPath(current, mode, options.permissions); - } + } finally { + dir.close(); } return resolved; @@ -652,28 +738,28 @@ export function writeConfinedFileAtomic( assertNoSymlinkPath(resolved); - const parentDir = dirname(resolved.fullPath); - let parentStats: Stats; - try { - parentStats = lstatSync(parentDir); - } catch (err) { - throw wrapIoError(err, "Parent directory does not exist"); - } - if (parentStats.isSymbolicLink()) { - throw new FileManagerError("symlink_forbidden", "Parent directory must not be a symbolic link"); - } - if (!parentStats.isDirectory()) { - throw new FileManagerError("not_a_directory", "Parent path is not a directory"); - } + withConfinedParent(resolved, (dir, name) => { + writeFileAtomicInDir(dir, name, data, mode, options); + }); +} - let existingTarget: Stats | undefined; - try { - existingTarget = lstatSync(resolved.fullPath); - } catch (err) { - if (!isErrnoCode(err, "ENOENT")) { - throw wrapIoError(err, "Failed to inspect target path"); +/** Atomic write of `name` inside an already opened folder (temp file + rename). */ +export function writeFileAtomicInDir( + dir: DirHandle, + name: string, + data: Uint8Array, + mode: number, + options: Pick = {}, +): void { + const inspectTarget = (context: string): Stats | undefined => { + try { + return dir.lstatChild(name); + } catch (err) { + throw wrapIoError(err, context); } - } + }; + + const existingTarget = inspectTarget("Failed to inspect target path"); if (existingTarget !== undefined) { if (existingTarget.isSymbolicLink()) { throw new FileManagerError("symlink_forbidden", "Refusing to overwrite symbolic link"); @@ -687,15 +773,14 @@ export function writeConfinedFileAtomic( } const suffix = randomBytes(8).toString("hex"); - const tmpPath = join(parentDir, `.tmp-${basename(resolved.fullPath)}-${process.pid}-${suffix}`); - const noFollow = fsConstants.O_NOFOLLOW ?? 0; - const flags = fsConstants.O_CREAT | fsConstants.O_EXCL | fsConstants.O_WRONLY | noFollow; + const tmpName = `.tmp-${name}-${process.pid}-${suffix}`; + const flags = fsConstants.O_CREAT | fsConstants.O_EXCL | fsConstants.O_WRONLY; let fd: number | undefined; let renamed = false; try { - fd = openSync(tmpPath, flags, mode); + fd = dir.openFile(tmpName, flags, mode); if (options.writeHook !== undefined) { options.writeHook(fd, data); } else { @@ -708,16 +793,7 @@ export function writeConfinedFileAtomic( closeSync(fd); fd = undefined; - // Re-validate full path right before atomic rename to mitigate TOCTOU. - assertNoSymlinkPath(resolved); - let preRenameTarget: Stats | undefined; - try { - preRenameTarget = lstatSync(resolved.fullPath); - } catch (err) { - if (!isErrnoCode(err, "ENOENT")) { - throw wrapIoError(err, "Failed to re-validate target before rename"); - } - } + const preRenameTarget = inspectTarget("Failed to re-validate target before rename"); if (preRenameTarget !== undefined) { if (preRenameTarget.isSymbolicLink()) { throw new FileManagerError("symlink_forbidden", "Target became a symbolic link"); @@ -730,10 +806,10 @@ export function writeConfinedFileAtomic( } } - renameSync(tmpPath, resolved.fullPath); + renameSync(dir.child(tmpName), dir.child(name)); renamed = true; if (options.permissions !== undefined) { - finalizeServerPath(resolved.fullPath, mode, options.permissions); + finalizeServerPath(dir.child(name), mode, options.permissions); } } catch (err) { if (fd !== undefined) { @@ -745,7 +821,7 @@ export function writeConfinedFileAtomic( } if (!renamed) { try { - unlinkSync(tmpPath); + unlinkSync(dir.child(tmpName)); } catch { // ignore cleanup unlink error } diff --git a/src/files/index.ts b/src/files/index.ts index 03236bc..39b161d 100644 --- a/src/files/index.ts +++ b/src/files/index.ts @@ -14,8 +14,10 @@ export { MAX_COMPONENT_BYTES, MAX_PATH_BYTES, mkdirConfined, + openConfinedDirAt, openConfinedFileForRead, openConfinedFileForReadWithRetry, + openFileInDirForRead, parseAndValidateRelativePath, type ResolveConfinedPathOptions, RUNTIME_DIR_NAME, @@ -25,6 +27,8 @@ export { UPLOAD_STAGING_FILE_PREFIX, validateServerId, validateSingleFileName, + withConfinedDir, + withConfinedParent, writeConfinedFileAtomic, } from "./confinement"; export { type FileErrorCode, FileManagerError } from "./errors"; diff --git a/src/files/manager.ts b/src/files/manager.ts index 0906083..d8d8f48 100644 --- a/src/files/manager.ts +++ b/src/files/manager.ts @@ -3,8 +3,6 @@ import { closeSync, - lstatSync, - readdirSync, readSync, renameSync, rmdirSync, @@ -12,13 +10,12 @@ import { unlinkSync, writeSync, } from "node:fs"; -import { dirname, join } from "node:path"; import type { CommandQueue } from "../agent/jobs"; import type { Logger } from "../agent/logger"; +import type { DirHandle } from "../server/open-beneath"; import { createServerPermissionContext, type PermissionContext } from "../server/permissions"; import { type MakeServerReadableLike, makeServerReadable } from "../server/readable"; import { - assertNoSymlinkPath, DEFAULT_SERVERS_BASE_DIR, isEaccesError, isErrnoCode, @@ -31,6 +28,8 @@ import { UPLOAD_STAGING_DIR_NAME, UPLOAD_STAGING_FILE_PREFIX, validateSingleFileName, + withConfinedDir, + withConfinedParent, wrapIoError, writeConfinedFileAtomic, } from "./confinement"; @@ -214,66 +213,87 @@ function streamCopyWithLimit(srcFd: number, dstFd: number, maxRemainingBytes: nu return copied; } -function ensureSubtreeHasNoSymlinks(dirFullPath: string): void { - let names: string[]; +function isNotFoundError(err: unknown): boolean { + return err instanceof FileManagerError && err.code === "not_found"; +} + +function lstatChildOrThrow(dir: DirHandle, name: string, context: string): Stats { + let stats: Stats | undefined; try { - names = readdirSync(dirFullPath); + stats = dir.lstatChild(name); } catch (err) { - throw wrapIoError(err, "Failed to read directory"); + throw wrapIoError(err, context); } - for (const name of names) { - const childPath = join(dirFullPath, name); - let stats: Stats; - try { - stats = lstatSync(childPath); - } catch (err) { - throw wrapIoError(err, `Failed to inspect "${name}"`); - } - if (stats.isSymbolicLink()) { - throw new FileManagerError( - "symlink_forbidden", - `Refusing recursive operation containing symbolic link "${name}"`, - ); - } - if (stats.isDirectory()) { - ensureSubtreeHasNoSymlinks(childPath); - } + if (stats === undefined) { + throw new FileManagerError("not_found", `${context}: path does not exist`); } + return stats; } -function deleteSubtreeSafely(dirFullPath: string): void { - let names: string[]; +function openChildDir(dir: DirHandle, name: string, context: string): DirHandle { try { - names = readdirSync(dirFullPath); + return dir.openDir(name); } catch (err) { - throw wrapIoError(err, "Failed to read directory during delete"); + throw wrapIoError(err, context); } - for (const name of names) { - const childPath = join(dirFullPath, name); - let stats: Stats; - try { - stats = lstatSync(childPath); - } catch (err) { - throw wrapIoError(err, `Failed to inspect "${name}" during delete`); - } - if (stats.isSymbolicLink()) { - throw new FileManagerError( - "symlink_forbidden", - `Symbolic link encountered during delete at "${name}"`, - ); +} + +function listDir(dir: DirHandle, context: string): string[] { + try { + return dir.list(); + } catch (err) { + throw wrapIoError(err, context); + } +} + +// Recursive walks hold each folder open and reach children through it, so mod code +// swapping a folder for a symbolic link mid-walk cannot redirect the agent elsewhere. +function ensureSubtreeHasNoSymlinks(parent: DirHandle, dirName: string): void { + const dir = openChildDir(parent, dirName, "Failed to read directory"); + try { + for (const name of listDir(dir, "Failed to read directory")) { + const stats = lstatChildOrThrow(dir, name, `Failed to inspect "${name}"`); + if (stats.isSymbolicLink()) { + throw new FileManagerError( + "symlink_forbidden", + `Refusing recursive operation containing symbolic link "${name}"`, + ); + } + if (stats.isDirectory()) { + ensureSubtreeHasNoSymlinks(dir, name); + } } - if (stats.isDirectory()) { - deleteSubtreeSafely(childPath); - } else { - try { - unlinkSync(childPath); - } catch (err) { - throw wrapIoError(err, `Failed to unlink "${name}"`); + } finally { + dir.close(); + } +} + +function deleteSubtreeSafely(parent: DirHandle, dirName: string): void { + const dir = openChildDir(parent, dirName, "Failed to read directory during delete"); + try { + for (const name of listDir(dir, "Failed to read directory during delete")) { + const stats = lstatChildOrThrow(dir, name, `Failed to inspect "${name}" during delete`); + if (stats.isSymbolicLink()) { + throw new FileManagerError( + "symlink_forbidden", + `Symbolic link encountered during delete at "${name}"`, + ); + } + if (stats.isDirectory()) { + deleteSubtreeSafely(dir, name); + } else { + try { + unlinkSync(dir.child(name)); + } catch (err) { + throw wrapIoError(err, `Failed to unlink "${name}"`); + } } } + } finally { + dir.close(); } try { - rmdirSync(dirFullPath); + rmdirSync(parent.child(dirName)); } catch (err) { throw wrapIoError(err, "Failed to remove directory"); } @@ -352,60 +372,41 @@ export class FileManager { allowRoot: true, }); - let dirStats: Stats; - try { - dirStats = lstatSync(resolved.fullPath); - } catch (err) { - throw wrapIoError(err, "Failed to stat directory"); - } - - if (dirStats.isSymbolicLink()) { - throw new FileManagerError("symlink_forbidden", "Target directory is a symbolic link"); - } - if (!dirStats.isDirectory()) { - throw new FileManagerError("not_a_directory", "Target path is not a directory"); - } - - let rawNames: string[]; - try { - rawNames = readdirSync(resolved.fullPath).sort(); - } catch (err) { - throw wrapIoError(err, "Failed to list directory"); - } - const entries: FileListEntry[] = []; - - for (const name of rawNames) { - if (isInternalEntryName(name)) { - continue; - } - const entryPath = join(resolved.fullPath, name); - let entryStats: Stats; - try { - entryStats = lstatSync(entryPath); - } catch { - continue; - } - - if (entryStats.isSymbolicLink()) { - // Ignore symlinks without following them. - continue; - } - if (entryStats.isDirectory()) { - entries.push({ - name, - type: "directory", - size: 0, - mtime_ms: Math.floor(entryStats.mtimeMs), - }); - } else if (entryStats.isFile()) { - entries.push({ - name, - type: "file", - size: entryStats.size, - mtime_ms: Math.floor(entryStats.mtimeMs), - }); + const entries: FileListEntry[] = withConfinedDir(resolved, (dir) => { + const rawNames = listDir(dir, "Failed to list directory").sort(); + const out: FileListEntry[] = []; + for (const name of rawNames) { + if (isInternalEntryName(name)) { + continue; + } + let entryStats: Stats | undefined; + try { + entryStats = dir.lstatChild(name); + } catch { + continue; + } + if (entryStats === undefined || entryStats.isSymbolicLink()) { + // Ignore symlinks without following them. + continue; + } + if (entryStats.isDirectory()) { + out.push({ + name, + type: "directory", + size: 0, + mtime_ms: Math.floor(entryStats.mtimeMs), + }); + } else if (entryStats.isFile()) { + out.push({ + name, + type: "file", + size: entryStats.size, + mtime_ms: Math.floor(entryStats.mtimeMs), + }); + } } - } + return out; + }); return { path: resolved.relativePath, @@ -421,15 +422,21 @@ export class FileManager { allowRoot: true, }); - let stats: Stats; + let stats: Stats | undefined; try { - stats = lstatSync(resolved.fullPath); + stats = + resolved.segments.length === 0 + ? withConfinedDir(resolved, (dir) => dir.stat()) + : withConfinedParent(resolved, (dir, name) => dir.lstatChild(name)); } catch (err) { - if (isErrnoCode(err, "ENOENT")) { + if (isErrnoCode(err, "ENOENT") || isNotFoundError(err)) { return { path: resolved.relativePath, exists: false }; } throw wrapIoError(err, "Failed to stat path"); } + if (stats === undefined) { + return { path: resolved.relativePath, exists: false }; + } if (stats.isSymbolicLink()) { throw new FileManagerError("symlink_forbidden", "Target path is a symbolic link"); @@ -604,53 +611,33 @@ export class FileManager { ); } - let fromStats: Stats; - try { - fromStats = lstatSync(fromResolved.fullPath); - } catch (err) { - throw wrapIoError(err, "Source path does not exist"); - } - if (fromStats.isSymbolicLink()) { - throw new FileManagerError("symlink_forbidden", "Cannot move a symbolic link"); - } - - let toStats: Stats | undefined; - try { - toStats = lstatSync(toResolved.fullPath); - } catch (err) { - if (!isErrnoCode(err, "ENOENT")) { - throw wrapIoError(err, "Failed to inspect destination path"); - } - } - if (toStats !== undefined) { - if (toStats.isSymbolicLink()) { - throw new FileManagerError("symlink_forbidden", "Destination is a symbolic link"); - } - throw new FileManagerError("already_exists", "Destination path already exists"); - } - - const destParent = dirname(toResolved.fullPath); - let destParentStats: Stats; - try { - destParentStats = lstatSync(destParent); - } catch (err) { - throw wrapIoError(err, "Destination parent directory does not exist"); - } - if (destParentStats.isSymbolicLink()) { - throw new FileManagerError("symlink_forbidden", "Destination parent is a symbolic link"); - } - if (!destParentStats.isDirectory()) { - throw new FileManagerError("not_a_directory", "Destination parent is not a directory"); - } + withConfinedParent(fromResolved, (fromDir, fromName) => { + withConfinedParent(toResolved, (toDir, toName) => { + const fromStats = lstatChildOrThrow(fromDir, fromName, "Source path does not exist"); + if (fromStats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Cannot move a symbolic link"); + } - assertNoSymlinkPath(fromResolved); - assertNoSymlinkPath(toResolved); + let toStats: Stats | undefined; + try { + toStats = toDir.lstatChild(toName); + } catch (err) { + throw wrapIoError(err, "Failed to inspect destination path"); + } + if (toStats !== undefined) { + if (toStats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Destination is a symbolic link"); + } + throw new FileManagerError("already_exists", "Destination path already exists"); + } - try { - renameSync(fromResolved.fullPath, toResolved.fullPath); - } catch (err) { - throw wrapIoError(err, "Failed to move path"); - } + try { + renameSync(fromDir.child(fromName), toDir.child(toName)); + } catch (err) { + throw wrapIoError(err, "Failed to move path"); + } + }); + }); return { from_path: fromResolved.relativePath, @@ -683,21 +670,18 @@ export class FileManager { ); } - let fromStats: Stats; - try { - fromStats = lstatSync(fromResolved.fullPath); - } catch (err) { - throw wrapIoError(err, "Source path does not exist"); - } + const fromStats = withConfinedParent(fromResolved, (dir, name) => + lstatChildOrThrow(dir, name, "Source path does not exist"), + ); if (fromStats.isSymbolicLink()) { throw new FileManagerError("symlink_forbidden", "Cannot copy a symbolic link"); } let toStats: Stats | undefined; try { - toStats = lstatSync(toResolved.fullPath); + toStats = withConfinedParent(toResolved, (dir, name) => dir.lstatChild(name)); } catch (err) { - if (!isErrnoCode(err, "ENOENT")) { + if (!isNotFoundError(err)) { throw wrapIoError(err, "Failed to inspect destination path"); } } @@ -712,35 +696,33 @@ export class FileManager { // before creating destination directories or files. let scannedFiles = 0; let scannedBytes = 0; - const preScan = (fullPath: string, stats: Stats, label: string): void => { + const preScan = (dir: DirHandle, name: string, stats: Stats, label: string): void => { if (stats.isSymbolicLink()) { throw new FileManagerError("symlink_forbidden", `Cannot copy symbolic link "${label}"`); } if (stats.isDirectory()) { - let children: string[]; + const sub = openChildDir(dir, name, `Failed to read directory "${label}"`); try { - children = readdirSync(fullPath).sort(); - } catch (err) { - throw wrapIoError(err, `Failed to read directory "${label}"`); - } - for (const child of children) { - const childFull = join(fullPath, child); - let childStats: Stats; - try { - childStats = lstatSync(childFull); - } catch (err) { - throw wrapIoError(err, `Failed to inspect "${label}/${child}"`); - } - if (childStats.isSymbolicLink()) { - throw new FileManagerError( - "symlink_forbidden", - `Cannot copy symbolic link "${label}/${child}"`, + const children = listDir(sub, `Failed to read directory "${label}"`).sort(); + for (const child of children) { + const childStats = lstatChildOrThrow( + sub, + child, + `Failed to inspect "${label}/${child}"`, ); + if (childStats.isSymbolicLink()) { + throw new FileManagerError( + "symlink_forbidden", + `Cannot copy symbolic link "${label}/${child}"`, + ); + } + if (isInternalEntryName(child)) { + continue; + } + preScan(sub, child, childStats, `${label}/${child}`); } - if (isInternalEntryName(child)) { - continue; - } - preScan(childFull, childStats, `${label}/${child}`); + } finally { + sub.close(); } return; } @@ -763,7 +745,9 @@ export class FileManager { } }; - preScan(fromResolved.fullPath, fromStats, fromResolved.relativePath); + withConfinedParent(fromResolved, (dir, name) => + preScan(dir, name, fromStats, fromResolved.relativePath), + ); let filesCopied = 0; let bytesCopied = 0; @@ -783,12 +767,9 @@ export class FileManager { allowRoot: false, }); - let stats: Stats; - try { - stats = lstatSync(srcConfined.fullPath); - } catch (err) { - throw wrapIoError(err, `Failed to inspect "${srcRel}"`); - } + const stats = withConfinedParent(srcConfined, (dir, name) => + lstatChildOrThrow(dir, name, `Failed to inspect "${srcRel}"`), + ); if (stats.isSymbolicLink()) { throw new FileManagerError("symlink_forbidden", `Cannot copy symbolic link "${srcRel}"`); } @@ -800,26 +781,24 @@ export class FileManager { relPath: dstConfined.relativePath, permissions: this.#permissions, }); - let children: string[]; - try { - children = readdirSync(srcConfined.fullPath).sort(); - } catch (err) { - throw wrapIoError(err, `Failed to read directory "${srcRel}"`); - } - for (const child of children) { - const childFull = join(srcConfined.fullPath, child); - let childStats: Stats; - try { - childStats = lstatSync(childFull); - } catch (err) { - throw wrapIoError(err, `Failed to inspect "${srcRel}/${child}"`); - } - if (childStats.isSymbolicLink()) { - throw new FileManagerError( - "symlink_forbidden", - `Cannot copy symbolic link "${srcRel}/${child}"`, + const children = withConfinedDir(srcConfined, (dir) => { + const names = listDir(dir, `Failed to read directory "${srcRel}"`).sort(); + for (const child of names) { + const childStats = lstatChildOrThrow( + dir, + child, + `Failed to inspect "${srcRel}/${child}"`, ); + if (childStats.isSymbolicLink()) { + throw new FileManagerError( + "symlink_forbidden", + `Cannot copy symbolic link "${srcRel}/${child}"`, + ); + } } + return names; + }); + for (const child of children) { if (isInternalEntryName(child)) { continue; } @@ -897,50 +876,41 @@ export class FileManager { allowRoot: false, }); - let stats: Stats; - try { - stats = lstatSync(resolved.fullPath); - } catch (err) { - throw wrapIoError(err, "Target path does not exist"); - } + return withConfinedParent(resolved, (dir, name) => { + const stats = lstatChildOrThrow(dir, name, "Target path does not exist"); - if (stats.isSymbolicLink()) { - throw new FileManagerError("symlink_forbidden", "Refusing to operate on a symbolic link"); - } + if (stats.isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", "Refusing to operate on a symbolic link"); + } + + if (stats.isDirectory()) { + const recursive = params.recursive ?? false; + if (!recursive) { + try { + rmdirSync(dir.child(name)); + } catch (err) { + if (isErrnoCode(err, "ENOTEMPTY") || isErrnoCode(err, "EEXIST")) { + throw new FileManagerError( + "is_a_directory", + "Directory is not empty; pass recursive: true to delete", + ); + } + throw wrapIoError(err, "Failed to remove directory"); + } + return { path: resolved.relativePath, deleted: true }; + } + ensureSubtreeHasNoSymlinks(dir, name); + deleteSubtreeSafely(dir, name); + return { path: resolved.relativePath, deleted: true }; + } - if (stats.isDirectory()) { - const recursive = params.recursive ?? false; - let children: string[]; try { - children = readdirSync(resolved.fullPath); + unlinkSync(dir.child(name)); } catch (err) { - throw wrapIoError(err, "Failed to inspect directory"); - } - if (children.length > 0 && !recursive) { - throw new FileManagerError( - "is_a_directory", - "Directory is not empty; pass recursive: true to delete", - ); - } - if (recursive) { - ensureSubtreeHasNoSymlinks(resolved.fullPath); - deleteSubtreeSafely(resolved.fullPath); - } else { - try { - rmdirSync(resolved.fullPath); - } catch (err) { - throw wrapIoError(err, "Failed to remove directory"); - } + throw wrapIoError(err, "Failed to delete file"); } return { path: resolved.relativePath, deleted: true }; - } - - try { - unlinkSync(resolved.fullPath); - } catch (err) { - throw wrapIoError(err, "Failed to delete file"); - } - return { path: resolved.relativePath, deleted: true }; + }); } uploadBegin(params: UploadBeginParams): UploadBeginResult { diff --git a/src/files/race.test.ts b/src/files/race.test.ts new file mode 100644 index 0000000..8984c53 --- /dev/null +++ b/src/files/race.test.ts @@ -0,0 +1,231 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, describe, expect, test } from "bun:test"; +import { + existsSync, + lstatSync, + mkdirSync, + mkdtempSync, + readdirSync, + renameSync, + rmSync, + symlinkSync, + unlinkSync, + writeFileSync, +} from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { archiveServerDirectory } from "../backup/archive"; +import { openDirBeneath } from "../server/open-beneath"; +import { FileManager } from "./manager"; +import { readZipEntryFromBuffer } from "./zip"; + +// Mod code runs inside the server folder and can swap any folder for a symbolic link +// at any moment, including in the middle of an agent operation. These tests run a +// separate process that keeps swapping a folder for a link to a fake agent state and +// back, while the agent repeats the operation. The state must never be read, listed, +// written or deleted. + +const linux = process.platform === "linux"; +const SERVER_ID = "srv-race"; +const SECRET = "agent-identity-secret"; +const RACE_MS = 1_500; +const roots: string[] = []; + +interface Layout { + readonly serversDir: string; + readonly serverDir: string; + readonly stateDir: string; +} + +function layout(): Layout { + const base = mkdtempSync(join(tmpdir(), "tegrad-race-")); + roots.push(base); + const serversDir = join(base, "servers"); + const serverDir = join(serversDir, SERVER_ID); + const stateDir = join(base, "state"); + mkdirSync(serverDir, { recursive: true }); + mkdirSync(stateDir); + writeFileSync(join(stateDir, "identity.json"), SECRET); + return { serversDir, serverDir, stateDir }; +} + +const SWAPPER = ` +const fs = require("node:fs"); +const p = process.env.SW_PATH, real = p + ".real", target = process.env.SW_TARGET; +const end = Date.now() + Number(process.env.SW_MS); +while (Date.now() < end) { + try { fs.renameSync(p, real); } catch {} + try { fs.symlinkSync(target, p); } catch {} + // Hold each state for a varying moment so some swaps span two agent calls. + const hold = Math.random() * 40; + for (let i = 0; i < hold; i++) fs.statSync(target); + try { fs.unlinkSync(p); } catch {} + try { fs.renameSync(real, p); } catch {} + for (let i = 0; i < hold; i++) fs.statSync(target); +} +`; + +/** Keeps swapping `path` (a folder) for a link to `target` until stopped. */ +function startSwapper(path: string, target: string): { stop(): Promise } { + const proc = Bun.spawn([process.execPath, "-e", SWAPPER], { + env: { ...process.env, SW_PATH: path, SW_TARGET: target, SW_MS: String(RACE_MS * 4) }, + stdout: "ignore", + stderr: "ignore", + }); + return { + async stop() { + proc.kill(); + await proc.exited; + const st = lstatSync(path, { throwIfNoEntry: false }); + if (st?.isSymbolicLink()) unlinkSync(path); + if (existsSync(`${path}.real`) && !existsSync(path)) renameSync(`${path}.real`, path); + }, + }; +} + +async function race( + swapPath: string, + target: string, + attempt: () => void | Promise, +): Promise { + const swapper = startSwapper(swapPath, target); + let attempts = 0; + try { + const end = Date.now() + RACE_MS; + while (Date.now() < end) { + attempts++; + try { + await attempt(); + } catch { + // Failures (folder missing, link refused) are expected while swapping. + } + } + } finally { + await swapper.stop(); + } + return attempts; +} + +function stateUntouched(stateDir: string): void { + expect(readdirSync(stateDir).sort()).toEqual(["identity.json"]); +} + +afterEach(() => { + for (const dir of roots.splice(0)) rmSync(dir, { recursive: true, force: true }); +}); + +describe.skipIf(!linux)("an open folder keeps pointing at the original folder", () => { + test("listing through the handle ignores a swap made after opening", () => { + const { serversDir, serverDir, stateDir } = layout(); + mkdirSync(join(serverDir, "logs")); + writeFileSync(join(serverDir, "logs", "latest.log"), "log"); + + const dir = openDirBeneath(serversDir, join(serverDir, "logs")); + try { + renameSync(join(serverDir, "logs"), join(serverDir, "logs.moved")); + symlinkSync(stateDir, join(serverDir, "logs")); + expect(dir.list()).toEqual(["latest.log"]); + expect(dir.lstatChild("identity.json")).toBeUndefined(); + } finally { + dir.close(); + } + }); + + test("opening refuses a link at any level", () => { + const { serversDir, serverDir, stateDir } = layout(); + symlinkSync(stateDir, join(serverDir, "logs")); + expect(() => openDirBeneath(serversDir, join(serverDir, "logs"))).toThrow(); + }); +}); + +describe.skipIf(!linux)("agent operations under a live folder swap", () => { + test("A: a backup never packs the agent state", async () => { + const { serversDir, serverDir, stateDir } = layout(); + mkdirSync(join(serverDir, "logs")); + // Same name as the agent's file, so a single swap at the wrong moment is enough. + writeFileSync(join(serverDir, "logs", "identity.json"), "server copy"); + let leaked = false; + const attempts = await race(join(serverDir, "logs"), stateDir, () => { + const result = archiveServerDirectory({ serversBaseDir: serversDir, serverId: SERVER_ID }); + const data = readZipEntryFromBuffer({ + buffer: result.buffer, + entryName: "logs/identity.json", + }); + if (data !== null && Buffer.from(data).toString("utf8").includes(SECRET)) leaked = true; + }); + expect(attempts).toBeGreaterThan(10); + expect(leaked).toBe(false); + }); + + test("B: a recursive delete never removes the agent state", async () => { + const { serversDir, serverDir, stateDir } = layout(); + const manager = new FileManager({ serversBaseDir: serversDir, serverGroupId: null }); + const victim = join(serverDir, "victim"); + const attempts = await race(join(victim, "inner"), stateDir, () => { + // Built through the agent itself: plain writes here would follow the swap too. + manager.mkdir({ server_id: SERVER_ID, path: "victim/inner" }); + manager.write({ server_id: SERVER_ID, path: "victim/inner/a.txt", content: "a" }); + manager.delete({ server_id: SERVER_ID, path: "victim", recursive: true }); + }); + manager.dispose(); + expect(attempts).toBeGreaterThan(10); + stateUntouched(stateDir); + }); + + test("B: a move never takes the agent state", async () => { + const { serversDir, serverDir, stateDir } = layout(); + const manager = new FileManager({ serversBaseDir: serversDir, serverGroupId: null }); + mkdirSync(join(serverDir, "box")); + const attempts = await race(join(serverDir, "box"), stateDir, () => { + manager.write({ server_id: SERVER_ID, path: "box/identity.json", content: "mine" }); + manager.move({ server_id: SERVER_ID, from_path: "box/identity.json", to_path: "moved.json" }); + rmSync(join(serverDir, "moved.json"), { force: true }); + }); + manager.dispose(); + expect(attempts).toBeGreaterThan(10); + stateUntouched(stateDir); + }); + + test("C: a write never lands in the agent state", async () => { + const { serversDir, serverDir, stateDir } = layout(); + const manager = new FileManager({ serversBaseDir: serversDir, serverGroupId: null }); + mkdirSync(join(serverDir, "config")); + const attempts = await race(join(serverDir, "config"), stateDir, () => { + manager.write({ server_id: SERVER_ID, path: "config/planted.txt", content: "x" }); + }); + manager.dispose(); + expect(attempts).toBeGreaterThan(10); + stateUntouched(stateDir); + }); + + test("D: a read never returns the agent state", async () => { + const { serversDir, serverDir, stateDir } = layout(); + const manager = new FileManager({ serversBaseDir: serversDir, serverGroupId: null }); + mkdirSync(join(serverDir, "logs")); + writeFileSync(join(serverDir, "logs", "identity.json"), "server copy"); + let leaked = false; + const attempts = await race(join(serverDir, "logs"), stateDir, async () => { + const result = await manager.read({ server_id: SERVER_ID, path: "logs/identity.json" }); + if (result.content.includes(SECRET)) leaked = true; + }); + manager.dispose(); + expect(attempts).toBeGreaterThan(10); + expect(leaked).toBe(false); + }); + + test("D: a listing never shows the agent state", async () => { + const { serversDir, serverDir, stateDir } = layout(); + const manager = new FileManager({ serversBaseDir: serversDir, serverGroupId: null }); + mkdirSync(join(serverDir, "logs")); + let leaked = false; + const attempts = await race(join(serverDir, "logs"), stateDir, () => { + const result = manager.list({ server_id: SERVER_ID, path: "logs" }); + if (result.entries.some((entry) => entry.name === "identity.json")) leaked = true; + }); + manager.dispose(); + expect(attempts).toBeGreaterThan(10); + expect(leaked).toBe(false); + }); +}); diff --git a/src/files/transfers.ts b/src/files/transfers.ts index 9803472..2867d42 100644 --- a/src/files/transfers.ts +++ b/src/files/transfers.ts @@ -8,8 +8,6 @@ import { constants as fsConstants, fstatSync, fsyncSync, - lstatSync, - openSync, readSync, renameSync, rmdirSync, @@ -17,9 +15,9 @@ import { unlinkSync, writeSync, } from "node:fs"; -import { dirname, join } from "node:path"; import type { Logger } from "../agent/logger"; import { SHA256_HEX_PATTERN } from "../protocol"; +import type { DirHandle } from "../server/open-beneath"; import { finalizeServerPath, type PermissionContext, @@ -31,13 +29,14 @@ import { assertNoSymlinkPath, DEFAULT_SERVERS_BASE_DIR, ensureConfinedInternalDir, - isErrnoCode, isPosix, mkdirConfined, + openConfinedDirAt, type openConfinedFileForRead, openConfinedFileForReadWithRetry, resolveConfinedPath, UPLOAD_STAGING_DIR_NAME, + withConfinedParent, wrapIoError, } from "./confinement"; import { FileManagerError } from "./errors"; @@ -88,8 +87,9 @@ interface UploadSession { readonly uploadId: string; readonly serverId: string; readonly targetRelPath: string; + readonly serverRoot: string; readonly stagingDir: string; - readonly stagingPath: string; + readonly stagingName: string; readonly stagingDev: number; readonly stagingIno: number; readonly totalSize: number; @@ -232,6 +232,17 @@ function writeAllAt(fd: number, data: Uint8Array, position: number): void { } } +// The staging folder lives inside the server folder, where mod code can swap it for a +// symbolic link, so it is always reached through an open descriptor. +function withStagingDir(serverRoot: string, fn: (dir: DirHandle) => T): T { + const dir = openConfinedDirAt({ serverRoot }, [UPLOAD_STAGING_DIR_NAME]); + try { + return fn(dir); + } finally { + dir.close(); + } +} + export class TransferManager { readonly #serversBaseDir: string; readonly #maxUploadBytes: number; @@ -275,7 +286,7 @@ export class TransferManager { } if (unlinkStaging) { try { - unlinkSync(session.stagingPath); + withStagingDir(session.serverRoot, (dir) => unlinkSync(dir.child(session.stagingName))); } catch { // ignore unlink failure on cleanup } @@ -339,9 +350,10 @@ export class TransferManager { let existingTarget: Stats | undefined; try { - existingTarget = lstatSync(resolved.fullPath); + existingTarget = withConfinedParent(resolved, (dir, name) => dir.lstatChild(name)); } catch (err) { - if (!isErrnoCode(err, "ENOENT")) { + // A missing parent folder is created on commit. + if (!(err instanceof FileManagerError && err.code === "not_found")) { throw wrapIoError(err, "Failed to inspect upload target"); } } @@ -364,13 +376,14 @@ export class TransferManager { 0o700, ); const uploadId = randomBytes(16).toString("hex"); - const stagingPath = join(stagingDir, uploadId); - const noFollow = fsConstants.O_NOFOLLOW ?? 0; - const flags = fsConstants.O_CREAT | fsConstants.O_EXCL | fsConstants.O_RDWR | noFollow; + const flags = fsConstants.O_CREAT | fsConstants.O_EXCL | fsConstants.O_RDWR; + const unlinkStaging = (): void => { + withStagingDir(resolved.serverRoot, (dir) => unlinkSync(dir.child(uploadId))); + }; let fd: number; try { - fd = openSync(stagingPath, flags, 0o600); + fd = withStagingDir(resolved.serverRoot, (dir) => dir.openFile(uploadId, flags, 0o600)); } catch (err) { try { rmdirSync(stagingDir); @@ -393,7 +406,7 @@ export class TransferManager { // ignore cleanup close error } try { - unlinkSync(stagingPath); + unlinkStaging(); } catch { // ignore cleanup unlink error } @@ -409,8 +422,9 @@ export class TransferManager { uploadId, serverId: resolved.serverId, targetRelPath: resolved.relativePath, + serverRoot: resolved.serverRoot, stagingDir, - stagingPath, + stagingName: uploadId, stagingDev: stagingStats.dev, stagingIno: stagingStats.ino, totalSize: params.total_size, @@ -548,7 +562,12 @@ export class TransferManager { ); } - const stagingPathStat = lstatSync(session.stagingPath); + const stagingPathStat = withStagingDir(session.serverRoot, (dir) => + dir.lstatChild(session.stagingName), + ); + if (stagingPathStat === undefined) { + throw new FileManagerError("toctou_detected", "Upload staging file disappeared"); + } if (stagingPathStat.isSymbolicLink()) { throw new FileManagerError("symlink_forbidden", "Upload staging path became a symlink"); } @@ -582,56 +601,49 @@ export class TransferManager { assertNoSymlinkPath(resolved); - const parentDir = dirname(resolved.fullPath); - const parentStats = lstatSync(parentDir); - if (parentStats.isSymbolicLink()) { - throw new FileManagerError("symlink_forbidden", "Invalid upload destination parent"); - } - if (!parentStats.isDirectory()) { - throw new FileManagerError( - "not_a_directory", - "Upload destination parent is not a directory", - ); - } - - let destStats: Stats | undefined; - try { - destStats = lstatSync(resolved.fullPath); - } catch (err) { - if (!isErrnoCode(err, "ENOENT")) { + withConfinedParent(resolved, (dir, name) => { + let destStats: Stats | undefined; + try { + destStats = dir.lstatChild(name); + } catch (err) { throw wrapIoError(err, "Failed to inspect upload destination"); } - } - if (destStats !== undefined) { - if (destStats.isSymbolicLink()) { - throw new FileManagerError("symlink_forbidden", "Upload destination is a symbolic link"); - } - if (destStats.isDirectory()) { - throw new FileManagerError("is_a_directory", "Upload destination is a directory"); - } - if (!destStats.isFile()) { - throw new FileManagerError("not_a_file", "Upload destination is not a regular file"); + if (destStats !== undefined) { + if (destStats.isSymbolicLink()) { + throw new FileManagerError( + "symlink_forbidden", + "Upload destination is a symbolic link", + ); + } + if (destStats.isDirectory()) { + throw new FileManagerError("is_a_directory", "Upload destination is a directory"); + } + if (!destStats.isFile()) { + throw new FileManagerError("not_a_file", "Upload destination is not a regular file"); + } } - } - - const preRenameStagingStat = lstatSync(session.stagingPath); - if ( - preRenameStagingStat.isSymbolicLink() || - !preRenameStagingStat.isFile() || - preRenameStagingStat.dev !== session.stagingDev || - preRenameStagingStat.ino !== session.stagingIno - ) { - throw new FileManagerError( - "toctou_detected", - "Upload staging path changed before atomic rename", - ); - } - renameSync(session.stagingPath, resolved.fullPath); - renamed = true; - if (this.#permissions !== undefined) { - finalizeServerPath(resolved.fullPath, SERVER_FILE_MODE, this.#permissions); - } + withStagingDir(session.serverRoot, (staging) => { + const preRenameStagingStat = staging.lstatChild(session.stagingName); + if ( + preRenameStagingStat === undefined || + preRenameStagingStat.isSymbolicLink() || + !preRenameStagingStat.isFile() || + preRenameStagingStat.dev !== session.stagingDev || + preRenameStagingStat.ino !== session.stagingIno + ) { + throw new FileManagerError( + "toctou_detected", + "Upload staging path changed before atomic rename", + ); + } + renameSync(staging.child(session.stagingName), dir.child(name)); + }); + renamed = true; + if (this.#permissions !== undefined) { + finalizeServerPath(dir.child(name), SERVER_FILE_MODE, this.#permissions); + } + }); return { upload_id: session.uploadId, diff --git a/src/files/zip.ts b/src/files/zip.ts index fd4b218..6285d80 100644 --- a/src/files/zip.ts +++ b/src/files/zip.ts @@ -1,13 +1,11 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import { closeSync, lstatSync, readdirSync, readSync, type Stats } from "node:fs"; -import { join } from "node:path"; +import { closeSync, readSync, type Stats } from "node:fs"; import { deflateRawSync, inflateRawSync } from "node:zlib"; import type { PermissionContext } from "../server/permissions"; import { DEFAULT_SERVERS_BASE_DIR, - isErrnoCode, isSameOrSubpath, mkdirConfined, openConfinedFileForRead, @@ -15,6 +13,8 @@ import { resolveConfinedPath, UPLOAD_STAGING_DIR_NAME, UPLOAD_STAGING_FILE_PREFIX, + withConfinedDir, + withConfinedParent, wrapIoError, writeConfinedFileAtomic, } from "./confinement"; @@ -1425,11 +1425,9 @@ export function safeZipFiles(options: SafeZipFilesOptions): SafeZipResult { let destStats: Stats | undefined; try { - destStats = lstatSync(destResolved.fullPath); + destStats = withConfinedParent(destResolved, (dir, name) => dir.lstatChild(name)); } catch (err) { - if (!isErrnoCode(err, "ENOENT")) { - throw wrapIoError(err, "Failed to inspect ZIP destination"); - } + throw wrapIoError(err, "Failed to inspect ZIP destination"); } if (destStats !== undefined) { if (destStats.isSymbolicLink()) { @@ -1455,12 +1453,15 @@ export function safeZipFiles(options: SafeZipFilesOptions): SafeZipResult { allowRoot: false, }); - let stats: Stats; + let stats: Stats | undefined; try { - stats = lstatSync(resolved.fullPath); + stats = withConfinedParent(resolved, (dir, name) => dir.lstatChild(name)); } catch (err) { throw wrapIoError(err, `Failed to stat "${relPath}"`); } + if (stats === undefined) { + throw new FileManagerError("not_found", `Failed to stat "${relPath}": path does not exist`); + } if (stats.isSymbolicLink()) { throw new FileManagerError("symlink_forbidden", `Cannot archive symbolic link "${relPath}"`); @@ -1488,26 +1489,30 @@ export function safeZipFiles(options: SafeZipFilesOptions): SafeZipResult { }); } - let children: string[]; - try { - children = readdirSync(resolved.fullPath).sort(); - } catch (err) { - throw wrapIoError(err, `Failed to read directory "${relPath}"`); - } - for (const child of children) { - const childFull = join(resolved.fullPath, child); - let childStats: Stats; + const children = withConfinedDir(resolved, (dir) => { + let names: string[]; try { - childStats = lstatSync(childFull); + names = dir.list().sort(); } catch (err) { - throw wrapIoError(err, `Failed to inspect "${resolved.relativePath}/${child}"`); + throw wrapIoError(err, `Failed to read directory "${relPath}"`); } - if (childStats.isSymbolicLink()) { - throw new FileManagerError( - "symlink_forbidden", - `Cannot archive symbolic link "${resolved.relativePath}/${child}"`, - ); + for (const child of names) { + let childStats: Stats | undefined; + try { + childStats = dir.lstatChild(child); + } catch (err) { + throw wrapIoError(err, `Failed to inspect "${resolved.relativePath}/${child}"`); + } + if (childStats?.isSymbolicLink()) { + throw new FileManagerError( + "symlink_forbidden", + `Cannot archive symbolic link "${resolved.relativePath}/${child}"`, + ); + } } + return names; + }); + for (const child of children) { if ( child === RUNTIME_DIR_NAME || child === UPLOAD_STAGING_DIR_NAME || diff --git a/src/server/open-beneath.ts b/src/server/open-beneath.ts index 5a39299..0ee3ec0 100644 --- a/src/server/open-beneath.ts +++ b/src/server/open-beneath.ts @@ -1,8 +1,16 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import { closeSync, constants as fsConstants, openSync } from "node:fs"; -import { isAbsolute, relative, sep } from "node:path"; +import { + closeSync, + constants as fsConstants, + fstatSync, + lstatSync, + openSync, + readdirSync, + type Stats, +} from "node:fs"; +import { isAbsolute, join, relative, sep } from "node:path"; const O_NOFOLLOW = fsConstants.O_NOFOLLOW ?? 0; const O_DIRECTORY = fsConstants.O_DIRECTORY ?? 0; @@ -66,3 +74,133 @@ export function isLinkRefusal(err: unknown): boolean { const code = (err as { readonly code?: unknown }).code; return code === "ELOOP" || code === "ENOTDIR" || code === "EMLINK"; } + +/** + * An open folder that every child operation goes through. On Linux the folder is held + * by a descriptor and children are reached as `/proc/self/fd/N/name`, so swapping the + * folder (or any folder above it) for a symbolic link after it was opened has no + * effect. Elsewhere it falls back to plain paths, which is enough for development. + * + * `child(name)` is safe to hand to calls that never follow the last component + * (`lstat`, `unlink`, `rmdir`, `mkdir`, `rename`, and `open` with `O_NOFOLLOW`). Never + * hand it to `readdir` or other calls that follow it: open the child with + * `openDir` instead. + */ +export interface DirHandle { + /** Display path for logs and errors; never used to reach the folder on Linux. */ + readonly path: string; + child(name: string): string; + list(): string[]; + lstatChild(name: string): Stats | undefined; + /** Opens a child folder, refusing a symbolic link (`ELOOP`/`ENOTDIR`). */ + openDir(name: string): DirHandle; + /** Opens a child file; `O_NOFOLLOW` is always added. */ + openFile(name: string, flags: number, mode?: number): number; + stat(): Stats; + close(): void; +} + +class FdDirHandle implements DirHandle { + readonly path: string; + readonly #fd: number; + #closed = false; + + constructor(path: string, fd: number) { + this.path = path; + this.#fd = fd; + } + + child(name: string): string { + return fdPath(this.#fd, name); + } + + list(): string[] { + return readdirSync(fdPath(this.#fd)); + } + + lstatChild(name: string): Stats | undefined { + return lstatSync(fdPath(this.#fd, name), { throwIfNoEntry: false }); + } + + openDir(name: string): DirHandle { + return new FdDirHandle(join(this.path, name), openSync(fdPath(this.#fd, name), DIR_FLAGS)); + } + + openFile(name: string, flags: number, mode?: number): number { + return openSync(fdPath(this.#fd, name), flags | O_NOFOLLOW, mode); + } + + stat(): Stats { + return fstatSync(this.#fd); + } + + close(): void { + if (this.#closed) return; + this.#closed = true; + closeSync(this.#fd); + } +} + +class PathDirHandle implements DirHandle { + readonly path: string; + + constructor(path: string) { + this.path = path; + } + + child(name: string): string { + return join(this.path, name); + } + + list(): string[] { + return readdirSync(this.path); + } + + lstatChild(name: string): Stats | undefined { + return lstatSync(join(this.path, name), { throwIfNoEntry: false }); + } + + openDir(name: string): DirHandle { + return openPathDir(join(this.path, name)); + } + + openFile(name: string, flags: number, mode?: number): number { + return openSync(join(this.path, name), flags | O_NOFOLLOW, mode); + } + + stat(): Stats { + return lstatSync(this.path); + } + + close(): void {} +} + +function openPathDir(path: string): DirHandle { + const st = lstatSync(path); + if (st.isSymbolicLink()) { + throw Object.assign(new Error(`ELOOP: symbolic link, open '${path}'`), { code: "ELOOP" }); + } + if (!st.isDirectory()) { + throw Object.assign(new Error(`ENOTDIR: not a directory, open '${path}'`), { + code: "ENOTDIR", + }); + } + return new PathDirHandle(path); +} + +/** Opens the folder `target` under `root` with no symbolic link followed below `root`. */ +export function openDirBeneath(root: string, target: string): DirHandle { + if (!procFdPathSupported()) { + return openPathDir(target); + } + return new FdDirHandle(target, openBeneath(root, target, DIR_FLAGS)); +} + +export function withDirBeneath(root: string, target: string, fn: (dir: DirHandle) => T): T { + const dir = openDirBeneath(root, target); + try { + return fn(dir); + } finally { + dir.close(); + } +} From d1e7c3659080710da64b6e8fde2969e6d00cdffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sat, 28 Nov 2026 00:09:26 -0300 Subject: [PATCH 43/59] feat(protocol): signing levels and the elevated session Commands now declare a level instead of a sensitive flag, split by the sandbox boundary: - session: everything that stays inside the server folder (files, mods, modpack install, server pack, origin, settings, backups create) - sudo: what leaves the folder (backup restore, server delete, playit key); needs an elevated session or the account key - account: backup delete and members; the account key only An elevated session is a session certificate with scope "elevated" inside the signed part, so older agents fail to verify it and refuse it. The agent refuses elevated certificates valid for more than 1 hour; the launcher closes the window earlier and drops the key. New errors elevation_required, elevation_invalid and account_key_required replace sensitive_requires_account_key. definition.sensitive stays as level !== "session" for launchers that only know the flag, which keep signing those commands with the account key. --- src/agent/host-info.test.ts | 2 +- src/agent/members.ts | 2 +- src/agent/phase3.test.ts | 4 +- src/backup/backup.test.ts | 8 +- src/cli/files-wiring.test.ts | 17 +-- src/files/manager.test.ts | 17 ++- src/protocol/command.ts | 19 +++- src/protocol/commands/agent.ts | 8 +- src/protocol/commands/backup.ts | 12 +-- src/protocol/commands/core.ts | 8 +- src/protocol/commands/files.ts | 38 +++---- src/protocol/commands/host.ts | 2 +- src/protocol/commands/modpack.ts | 6 +- src/protocol/commands/pairing.ts | 2 +- src/protocol/commands/server.ts | 20 ++-- src/protocol/commands/state.ts | 16 +-- src/protocol/commands/tunnel.ts | 8 +- src/protocol/errors.ts | 4 +- src/protocol/index.ts | 8 +- src/protocol/phase3.test.ts | 15 +-- src/protocol/protocol.test.ts | 2 +- src/protocol/registry.ts | 16 ++- src/protocol/schemas.ts | 6 ++ src/protocol/session.ts | 22 ++++ src/server/stats.test.ts | 2 +- src/state/modpack-installer.test.ts | 10 -- src/state/state.test.ts | 28 +---- src/tunnel/playit.test.ts | 4 +- src/vault/index.ts | 3 + src/vault/session.ts | 51 +++++++++ src/vault/vault.test.ts | 160 +++++++++++++++++++++++++++- 31 files changed, 375 insertions(+), 145 deletions(-) diff --git a/src/agent/host-info.test.ts b/src/agent/host-info.test.ts index 841b5d8..c776a1a 100644 --- a/src/agent/host-info.test.ts +++ b/src/agent/host-info.test.ts @@ -418,7 +418,7 @@ describe("host.info command handler", () => { const permissiveRegistry = new CommandRegistry().register( defineCommand({ type: "host.info", - sensitive: false, + level: "session", minRole: "viewer", body: z.object({ unexpected: z.number() }), }), diff --git a/src/agent/members.ts b/src/agent/members.ts index 3aad279..4d9024c 100644 --- a/src/agent/members.ts +++ b/src/agent/members.ts @@ -40,7 +40,7 @@ function highestMemberRole(store: MemberStore, account: KeyId): GrantableRole | function requireAccountSigner(opened: OpenedCommand): Role { if (opened.signerType !== "account" || !roleAtLeast(opened.role, "admin")) { throw new ProtocolError( - "sensitive_requires_account_key", + "account_key_required", "Member changes must be signed directly by an admin or owner account key", ); } diff --git a/src/agent/phase3.test.ts b/src/agent/phase3.test.ts index cc40382..5b60697 100644 --- a/src/agent/phase3.test.ts +++ b/src/agent/phase3.test.ts @@ -496,13 +496,13 @@ describe("team roles through the command queue", () => { session.key, { session: session.certificate, replyTo: session.key.publicKey }, ); - expect(lastAck(h.sent)).toEqual({ ok: false, code: "sensitive_requires_account_key" }); + expect(lastAck(h.sent)).toEqual({ ok: false, code: "account_key_required" }); await h.send("agent.members.revoke", { account: fingerprint(member.publicKey) }, session.key, { session: session.certificate, replyTo: session.key.publicKey, }); - expect(lastAck(h.sent)).toEqual({ ok: false, code: "sensitive_requires_account_key" }); + expect(lastAck(h.sent)).toEqual({ ok: false, code: "account_key_required" }); }); test("an admin can grant up to editor but not admin, and cannot touch owners or equal roles", async () => { diff --git a/src/backup/backup.test.ts b/src/backup/backup.test.ts index 41533a3..3f2667b 100644 --- a/src/backup/backup.test.ts +++ b/src/backup/backup.test.ts @@ -838,9 +838,9 @@ describe("Protocol commands, sensitivity, and server_id validation", () => { ); try { await openCommand(restoreWithSession, trust, registry); - expect.unreachable("Expected sensitive_requires_account_key"); + expect.unreachable("Expected elevation_required"); } catch (err) { - expect(err instanceof ProtocolError && err.code).toBe("sensitive_requires_account_key"); + expect(err instanceof ProtocolError && err.code).toBe("elevation_required"); } // Session key rejected for server.backup.delete @@ -858,9 +858,9 @@ describe("Protocol commands, sensitivity, and server_id validation", () => { ); try { await openCommand(deleteWithSession, trust, registry); - expect.unreachable("Expected sensitive_requires_account_key"); + expect.unreachable("Expected account_key_required"); } catch (err) { - expect(err instanceof ProtocolError && err.code).toBe("sensitive_requires_account_key"); + expect(err instanceof ProtocolError && err.code).toBe("account_key_required"); } // Direct account key accepted for server.backup.restore diff --git a/src/cli/files-wiring.test.ts b/src/cli/files-wiring.test.ts index e96f033..de12510 100644 --- a/src/cli/files-wiring.test.ts +++ b/src/cli/files-wiring.test.ts @@ -404,7 +404,7 @@ describe("files.* runtime wiring", () => { } }); - test("files.delete rejects session-key signatures and accepts direct account signatures", async () => { + test("files.delete accepts session-key signatures and direct account signatures", async () => { const serverId = "srv-1"; const h = await createHarness(serverId); @@ -417,16 +417,19 @@ describe("files.* runtime wiring", () => { ); expect(writeRes.ack.body.ok).toBe(true); - // files.delete with session key MUST be rejected + // files.delete stays inside the server folder, so a session key is enough const delWithSession = await h.sendCommand( "files.delete", { server_id: serverId, path: "keep.txt" }, { useSession: true }, ); - expect(delWithSession.ack.body.ok).toBe(false); - if (!delWithSession.ack.body.ok) { - expect(delWithSession.ack.body.code).toBe("sensitive_requires_account_key"); - } + expect(delWithSession.ack.body.ok).toBe(true); + const rewrite = await h.sendCommand( + "files.write", + { server_id: serverId, path: "keep.txt", content: "data" }, + { useSession: true }, + ); + expect(rewrite.ack.body.ok).toBe(true); // files.delete with direct account key succeeds const delWithAccount = await h.sendCommand( @@ -452,7 +455,7 @@ describe("files.* runtime wiring", () => { permissive.register( defineCommand({ type: cmd.type, - sensitive: cmd.sensitive, + level: cmd.level, minRole: cmd.minRole, body: z.unknown(), }), diff --git a/src/files/manager.test.ts b/src/files/manager.test.ts index e8ec09e..693af6c 100644 --- a/src/files/manager.test.ts +++ b/src/files/manager.test.ts @@ -693,12 +693,12 @@ describe("protocol integration (CommandRegistry, openCommand, CommandQueue)", () rmSync(rootTmp, { recursive: true, force: true }); }); - test("registers all FILES_COMMANDS in createCoreRegistry and enforces files.delete as sensitive", async () => { + test("registers all FILES_COMMANDS in createCoreRegistry and lets a session key run files.delete", async () => { const registry = createCoreRegistry(); for (const def of FILES_COMMANDS) { expect(registry.has(def.type)).toBe(true); } - expect(registry.get("files.delete")?.sensitive).toBe(true); + expect(registry.get("files.delete")?.level).toBe("session"); expect(registry.get("files.read")?.sensitive).toBe(false); expect(registry.get("files.write")?.sensitive).toBe(false); @@ -719,7 +719,7 @@ describe("protocol integration (CommandRegistry, openCommand, CommandQueue)", () now: () => now, }); - // Session key CANNOT execute files.delete (sensitive: true) + // files.delete stays inside the server folder: a session key can run it const sessionDeleteCmd = createSignedCommand( { type: "files.delete", @@ -733,13 +733,8 @@ describe("protocol integration (CommandRegistry, openCommand, CommandQueue)", () registry, ); - try { - await openCommand(sessionDeleteCmd, trust, registry); - throw new Error("Expected sensitive_requires_account_key"); - } catch (err) { - expect(err).toBeInstanceOf(ProtocolError); - expect((err as ProtocolError).code).toBe("sensitive_requires_account_key"); - } + const openedBySession = await openCommand(sessionDeleteCmd, trust, registry); + expect(openedBySession.signerType).toBe("session"); // Account key CAN execute files.delete const accountDeleteCmd = createSignedCommand( @@ -761,7 +756,7 @@ describe("protocol integration (CommandRegistry, openCommand, CommandQueue)", () const permissiveRegistry = new CommandRegistry().register( defineCommand({ type: "files.list", - sensitive: false, + level: "session", minRole: "viewer", body: z.unknown(), }), diff --git a/src/protocol/command.ts b/src/protocol/command.ts index 3d97d43..817ac4d 100644 --- a/src/protocol/command.ts +++ b/src/protocol/command.ts @@ -57,6 +57,8 @@ export interface OpenedCommand { readonly header: CommandHeader; readonly body: TBody; readonly signerType: "account" | "session"; + /** True when the signer is a session with an elevated certificate. */ + readonly elevated: boolean; readonly accountId: KeyId; readonly sessionId?: string; /** `not_after` of the signing session certificate, when the signer is a session. */ @@ -183,6 +185,7 @@ export async function openCommand( let accountId: KeyId; let sessionId: string | undefined; let sessionNotAfter: number | undefined; + let elevated = false; if (session !== undefined) { const accountPublicKey = trust.isTrustedAccountKey(session.account); @@ -207,6 +210,7 @@ export async function openCommand( accountId = session.account; sessionId = session.id; sessionNotAfter = verifiedSession.certificate.not_after; + elevated = verifiedSession.elevated; } else { const accountPublicKey = trust.isTrustedAccountKey(header.signer); if (accountPublicKey === null) { @@ -268,11 +272,17 @@ export async function openCommand( throw new ProtocolError("invalid_body", "Command body failed schema validation"); } - // 9. Enforce sensitive command policy - if (definition.sensitive && signerType !== "account") { + // 9. Enforce the signer level the command needs + if (definition.level === "account" && signerType !== "account") { throw new ProtocolError( - "sensitive_requires_account_key", - "Sensitive command must be signed directly by an account key", + "account_key_required", + "This command must be signed directly by the account key", + ); + } + if (definition.level === "sudo" && signerType !== "account" && !elevated) { + throw new ProtocolError( + "elevation_required", + "This command needs an elevated session or the account key", ); } @@ -293,6 +303,7 @@ export async function openCommand( header, body: bodyResult.data, signerType, + elevated, accountId, role, ...(sessionId !== undefined ? { sessionId } : {}), diff --git a/src/protocol/commands/agent.ts b/src/protocol/commands/agent.ts index 52570c0..ceb1e53 100644 --- a/src/protocol/commands/agent.ts +++ b/src/protocol/commands/agent.ts @@ -46,28 +46,28 @@ export type AgentMembersRevokeBody = z.infer; export const hostInfoCommand = defineCommand({ type: "host.info", - sensitive: false, + level: "session", minRole: "viewer", body: hostInfoBodySchema, }); diff --git a/src/protocol/commands/modpack.ts b/src/protocol/commands/modpack.ts index ce356a1..53a3c24 100644 --- a/src/protocol/commands/modpack.ts +++ b/src/protocol/commands/modpack.ts @@ -145,21 +145,21 @@ export type ServerInstallModpackStatusResult = z.infer< export const serverInstallModpackCommand = defineCommand({ type: "server.install_modpack", - sensitive: true, + level: "session", minRole: "editor", body: serverInstallModpackBodySchema, }); export const serverInstallModpackStatusCommand = defineCommand({ type: "server.install_modpack.status", - sensitive: false, + level: "session", minRole: "viewer", body: serverInstallModpackStatusBodySchema, }); export const serverInstallModpackCancelCommand = defineCommand({ type: "server.install_modpack.cancel", - sensitive: false, + level: "session", minRole: "editor", body: serverInstallModpackCancelBodySchema, }); diff --git a/src/protocol/commands/pairing.ts b/src/protocol/commands/pairing.ts index e8671ef..3561b24 100644 --- a/src/protocol/commands/pairing.ts +++ b/src/protocol/commands/pairing.ts @@ -7,7 +7,7 @@ import { revocationListSchema } from "../schemas"; export const agentRevocationsSetCommand = defineCommand({ type: "agent.revocations.set", - sensitive: false, + level: "session", minRole: "admin", body: z.object({ list: revocationListSchema, diff --git a/src/protocol/commands/server.ts b/src/protocol/commands/server.ts index 5145abe..3b99a7d 100644 --- a/src/protocol/commands/server.ts +++ b/src/protocol/commands/server.ts @@ -114,7 +114,7 @@ export type ServerStatsResult = z.infer; export const serverCreateCommand = defineCommand({ type: "server.create", - sensitive: false, + level: "session", minRole: "admin", body: serverCreateBodySchema, }); @@ -122,63 +122,63 @@ export const serverCreateCommand = defineCommand({ // Reinstalling the server runtime/loader modifies the server installation at the same level as server.create. export const serverChangeRuntimeCommand = defineCommand({ type: "server.change_runtime", - sensitive: false, + level: "session", minRole: "admin", body: serverChangeRuntimeBodySchema, }); export const serverRestartCommand = defineCommand({ type: "server.restart", - sensitive: false, + level: "session", minRole: "operator", body: strictServerIdBodySchema, }); export const serverStatusCommand = defineCommand({ type: "server.status", - sensitive: false, + level: "session", minRole: "viewer", body: strictServerIdBodySchema, }); export const serverStatsCommand = defineCommand({ type: "server.stats", - sensitive: false, + level: "session", minRole: "viewer", body: serverStatsBodySchema, }); export const serverListCommand = defineCommand({ type: "server.list", - sensitive: false, + level: "session", minRole: "viewer", body: z.object({}).strict(), }); export const serverUpdateSettingsCommand = defineCommand({ type: "server.update_settings", - sensitive: false, + level: "session", minRole: "editor", body: serverUpdateSettingsBodySchema, }); export const serverConsoleSendCommand = defineCommand({ type: "server.console.send", - sensitive: false, + level: "session", minRole: "operator", body: serverConsoleSendBodySchema, }); export const serverConsoleSubscribeCommand = defineCommand({ type: "server.console.subscribe", - sensitive: false, + level: "session", minRole: "viewer", body: serverConsoleSubscribeBodySchema, }); export const serverConsoleUnsubscribeCommand = defineCommand({ type: "server.console.unsubscribe", - sensitive: false, + level: "session", minRole: "viewer", body: strictServerIdBodySchema, }); diff --git a/src/protocol/commands/state.ts b/src/protocol/commands/state.ts index a34e883..630560f 100644 --- a/src/protocol/commands/state.ts +++ b/src/protocol/commands/state.ts @@ -274,56 +274,56 @@ export type ServerDeployServerpackBody = z.infer { } }); - test("destructive and sensitive commands need an admin and the direct account key", () => { - for (const type of [ - "server.backup.restore", - "server.delete", - "agent.members.set", - "agent.members.revoke", - ]) { + test("destructive commands need an admin and a sudo or account signer", () => { + for (const [type, level] of [ + ["server.backup.restore", "sudo"], + ["server.delete", "sudo"], + ["agent.members.set", "account"], + ["agent.members.revoke", "account"], + ] as const) { + expect(registry.get(type)?.level).toBe(level); expect(registry.get(type)?.sensitive).toBe(true); expect(registry.get(type)?.minRole).toBe("admin"); } diff --git a/src/protocol/protocol.test.ts b/src/protocol/protocol.test.ts index c1e2120..ee2bc5b 100644 --- a/src/protocol/protocol.test.ts +++ b/src/protocol/protocol.test.ts @@ -610,7 +610,7 @@ describe("rejections", () => { }, registry, ); - await expectProtocolError(openCommand(cmd, trust, registry), "sensitive_requires_account_key"); + await expectProtocolError(openCommand(cmd, trust, registry), "elevation_required"); }); test("rejects decryption failure when payload is sealed for wrong key", async () => { diff --git a/src/protocol/registry.ts b/src/protocol/registry.ts index 873d247..a0bb006 100644 --- a/src/protocol/registry.ts +++ b/src/protocol/registry.ts @@ -4,8 +4,19 @@ import type { z } from "zod"; import type { Role } from "./roles"; +/** + * What a command needs from its signer, split by the sandbox boundary: + * - `session`: stays inside the server folder; any valid session key. + * - `sudo`: leaves the folder (restore a backup, delete a server, tunnel keys); an + * elevated session (short lived, see `MAX_ELEVATED_SESSION_MS`) or the account key. + * - `account`: recovery and access (delete a backup, members); the account key only. + */ +export type CommandLevel = "session" | "sudo" | "account"; + export interface CommandDefinition { readonly type: TType; + readonly level: CommandLevel; + /** `level !== "session"`. Kept for launchers that only know this flag. */ readonly sensitive: boolean; readonly minRole: Role; readonly body: z.ZodType; @@ -13,13 +24,14 @@ export interface CommandDefinition(definition: { readonly type: TType; - readonly sensitive: boolean; + readonly level: CommandLevel; readonly minRole: Role; readonly body: z.ZodType; }): CommandDefinition { return { type: definition.type, - sensitive: definition.sensitive, + level: definition.level, + sensitive: definition.level !== "session", minRole: definition.minRole, body: definition.body, }; diff --git a/src/protocol/schemas.ts b/src/protocol/schemas.ts index 9316c72..1c2cc9b 100644 --- a/src/protocol/schemas.ts +++ b/src/protocol/schemas.ts @@ -19,6 +19,12 @@ export const sessionCertificateSchema = z.object({ not_before: z.number().int().nonnegative(), not_after: z.number().int().nonnegative(), id: base64UrlSchema, + /** + * `"elevated"` marks a short-lived certificate that may sign `sudo` commands. It is + * inside the signed part, so an agent that does not know the field fails to verify + * the signature and refuses the certificate. + */ + scope: z.literal("elevated").optional(), sig: base64UrlSchema, }); export type SessionCertificate = z.infer; diff --git a/src/protocol/session.ts b/src/protocol/session.ts index c609c74..07feb06 100644 --- a/src/protocol/session.ts +++ b/src/protocol/session.ts @@ -17,17 +17,26 @@ import { assertSupportedVersion, concatBytes, DOMAIN_SESSION, PROTOCOL_VERSION } import { ProtocolError } from "./errors"; import { type SessionCertificate, sessionCertificateSchema } from "./schemas"; +/** + * Longest validity the agent accepts for an elevated certificate. The launcher closes + * the sudo window after a shorter idle time and drops the key; this cap is what holds + * even against a client that keeps the key around. + */ +export const MAX_ELEVATED_SESSION_MS = 60 * 60 * 1000; + export interface SignSessionCertificateParams { readonly sessionPublicKey: PublicKey; readonly accountKeyPair: SigningKeyPair; readonly notBefore: number; readonly notAfter: number; readonly id?: string; + readonly elevated?: boolean; } export interface VerifiedSessionCertificate { readonly certificate: SessionCertificate; readonly sessionPublicKey: PublicKey; + readonly elevated: boolean; } export function signSessionCertificate(params: SignSessionCertificateParams): SessionCertificate { @@ -40,6 +49,9 @@ export function signSessionCertificate(params: SignSessionCertificateParams): Se if (params.notBefore < 0 || params.notAfter <= params.notBefore) { throw new RangeError("Invalid session certificate validity window"); } + if (params.elevated === true && params.notAfter - params.notBefore > MAX_ELEVATED_SESSION_MS) { + throw new RangeError("Elevated session certificate exceeds the maximum validity"); + } const unsigned = { v: PROTOCOL_VERSION, @@ -48,6 +60,7 @@ export function signSessionCertificate(params: SignSessionCertificateParams): Se not_before: params.notBefore, not_after: params.notAfter, id: params.id ?? toBase64Url(randomBytes(16)), + ...(params.elevated === true ? { scope: "elevated" as const } : {}), }; const signingInput = concatBytes(DOMAIN_SESSION, canonicalize(unsigned)); @@ -80,6 +93,14 @@ export function verifySessionCertificate( throw new ProtocolError("session_invalid", "Session certificate has invalid validity window"); } + const elevated = cert.scope === "elevated"; + if (elevated && cert.not_after - cert.not_before > MAX_ELEVATED_SESSION_MS) { + throw new ProtocolError( + "elevation_invalid", + "Elevated session certificate exceeds the maximum validity", + ); + } + if (atTime !== undefined && (atTime < cert.not_before || atTime >= cert.not_after)) { throw new ProtocolError("session_invalid", "Session certificate is not valid at this time"); } @@ -106,5 +127,6 @@ export function verifySessionCertificate( return { certificate: cert, sessionPublicKey, + elevated, }; } diff --git a/src/server/stats.test.ts b/src/server/stats.test.ts index 94cdffa..41d576a 100644 --- a/src/server/stats.test.ts +++ b/src/server/stats.test.ts @@ -627,7 +627,7 @@ describe("server.stats command handler and authorization", () => { const permissiveRegistry = new CommandRegistry().register( defineCommand({ type: "server.stats", - sensitive: false, + level: "session", minRole: "viewer", body: z.object({ server_id: serverIdSchema, unexpected: z.number() }), }), diff --git a/src/state/modpack-installer.test.ts b/src/state/modpack-installer.test.ts index 444c926..c9f16df 100644 --- a/src/state/modpack-installer.test.ts +++ b/src/state/modpack-installer.test.ts @@ -975,16 +975,6 @@ describe("Background server.install_modpack", () => { "insufficient_role", ); - // 2. Session key (without account key) denied for sensitive command - const sessionAck = await sendCmd( - "server.install_modpack", - { server_id: "smp", source: "tegra", modpack_id: "a", version_id: "b" }, - { signer: session, session: ownerCert, replyTo: session.publicKey }, - ); - expect(sessionAck?.kind === "ack" && sessionAck.body.ok === false && sessionAck.body.code).toBe( - "sensitive_requires_account_key", - ); - // Subscribe via session to receive pubsub events await sendCmd( "agent.subscribe", diff --git a/src/state/state.test.ts b/src/state/state.test.ts index c6327e9..1dd51bc 100644 --- a/src/state/state.test.ts +++ b/src/state/state.test.ts @@ -879,17 +879,7 @@ describe("state commands protocol & runtime wiring", () => { expect(planId).toBeDefined(); if (!planId) throw new Error("Missing plan_id"); - // Sensitive: server.origin.apply rejects session key, accepts account key - const applySession = await send( - "server.origin.apply", - { server_id: "srv-rt", plan_id: planId }, - true, - ); - expect(applySession.ack?.body.ok).toBe(false); - if (applySession.ack && !applySession.ack.body.ok) { - expect(applySession.ack.body.code).toBe("sensitive_requires_account_key"); - } - + // server.origin.apply stays inside the server folder (session level) const applyAccount = await send( "server.origin.apply", { server_id: "srv-rt", plan_id: planId }, @@ -903,21 +893,7 @@ describe("state commands protocol & runtime wiring", () => { exercised.add("server.origin.unlink"); expect(unlinkRes.ack?.body.ok).toBe(true); - // Sensitive: server.deploy.serverpack rejects session key, accepts account key - const deploySession = await send( - "server.deploy.serverpack", - { - server_id: "srv-rt", - url: "https://cdn.tegra.gg/pack.zip", - sha256: sha256Hex(packZip), - }, - true, - ); - expect(deploySession.ack?.body.ok).toBe(false); - if (deploySession.ack && !deploySession.ack.body.ok) { - expect(deploySession.ack.body.code).toBe("sensitive_requires_account_key"); - } - + // server.deploy.serverpack stays inside the server folder (session level) const deployAccount = await send( "server.deploy.serverpack", { diff --git a/src/tunnel/playit.test.ts b/src/tunnel/playit.test.ts index b09f996..e3a8b0c 100644 --- a/src/tunnel/playit.test.ts +++ b/src/tunnel/playit.test.ts @@ -303,9 +303,9 @@ describe("Tunnel protocol commands and sensitivity enforcement", () => { ); try { await openCommand(setKeyWithSession, trust, registry); - expect.unreachable("Expected sensitive_requires_account_key"); + expect.unreachable("Expected elevation_required"); } catch (err) { - expect(err instanceof ProtocolError && err.code).toBe("sensitive_requires_account_key"); + expect(err instanceof ProtocolError && err.code).toBe("elevation_required"); } // Session key accepted for tunnel.playit.status diff --git a/src/vault/index.ts b/src/vault/index.ts index c9bd6a9..92ba692 100644 --- a/src/vault/index.ts +++ b/src/vault/index.ts @@ -31,8 +31,11 @@ export { export { createCommandFromSession, createSensitiveCommand, + type IssueElevatedSessionOptions, type IssueSessionOptions, + isElevatedSession, isSessionExpired, + issueElevatedSession, issueSession, parseSession, SESSION_DURATION_MS, diff --git a/src/vault/session.ts b/src/vault/session.ts index f7f9685..0bb984e 100644 --- a/src/vault/session.ts +++ b/src/vault/session.ts @@ -18,6 +18,7 @@ import { base64UrlSchema, type CommandRegistry, createSignedCommand, + MAX_ELEVATED_SESSION_MS, type RevocationList, type SessionCertificate, type SignedCommand, @@ -110,6 +111,56 @@ export function issueSession(unlocked: UnlockedVault, options: IssueSessionOptio } } +export interface IssueElevatedSessionOptions { + readonly now?: number; + readonly id?: string; + /** Validity of the certificate; defaults to and may not exceed the agent's 1 h cap. */ + readonly validityMs?: number; +} + +/** + * Issues the key for the sudo window. Keep it in memory only and drop it when the + * window closes (the launcher closes it after 15 minutes without a sudo command); the + * agent refuses it after its certificate expires, at most 1 h after issue. + */ +export function issueElevatedSession( + unlocked: UnlockedVault, + options: IssueElevatedSessionOptions = {}, +): Session { + const now = options.now ?? Date.now(); + if (!Number.isSafeInteger(now) || now < 0) { + throw new RangeError("Timestamp must be a non-negative safe integer"); + } + const validityMs = options.validityMs ?? MAX_ELEVATED_SESSION_MS; + if ( + !Number.isSafeInteger(validityMs) || + validityMs <= 0 || + validityMs > MAX_ELEVATED_SESSION_MS + ) { + throw new RangeError("Elevated session validity must be positive and at most 1 hour"); + } + + const keyPair = generateSigningKeyPair(); + try { + const certificate = signSessionCertificate({ + sessionPublicKey: keyPair.publicKey, + accountKeyPair: unlocked.keyPair, + notBefore: now, + notAfter: now + validityMs, + elevated: true, + ...(options.id !== undefined ? { id: options.id } : {}), + }); + return { keyPair, certificate }; + } catch (err) { + memzero(keyPair.secretKey); + throw err; + } +} + +export function isElevatedSession(session: Session): boolean { + return session.certificate.scope === "elevated"; +} + export function serializeSession(session: Session): string { return JSON.stringify({ v: 1, diff --git a/src/vault/vault.test.ts b/src/vault/vault.test.ts index 2369c11..6f3423e 100644 --- a/src/vault/vault.test.ts +++ b/src/vault/vault.test.ts @@ -13,8 +13,10 @@ import { import { createCoreRegistry, createInMemoryTrustContext, + MAX_ELEVATED_SESSION_MS, openCommand, ProtocolError, + signSessionCertificate, verifyRevocationList, verifySessionCertificate, } from "../protocol"; @@ -24,7 +26,9 @@ import { createMemoryCounterStore, createSensitiveCommand, createVault, + isElevatedSession, isSessionExpired, + issueElevatedSession, issueSession, parseRecoveryCode, parseSession, @@ -193,10 +197,7 @@ describe("vault lifecycle and protocol integration", () => { registry, }); - await expectProtocolError( - openCommand(sessionCmd, trust, registry), - "sensitive_requires_account_key", - ); + await expectProtocolError(openCommand(sessionCmd, trust, registry), "elevation_required"); const accountCmd = createSensitiveCommand(unlocked, { type: "server.delete", @@ -591,3 +592,154 @@ describe("sessions, revocation, counter, and locking", () => { expectVaultError(() => errCaptured.handle?.keyPair, "locked"); }); }); + +describe("signing levels: session, sudo window, account", () => { + function setup() { + const registry = createCoreRegistry(); + const agentKeyPair = generateSigningKeyPair(); + const { unlocked } = createVault({ password: STRONG_PW_1, now: BASE_TIME, kdf: KDF_FLOOR }); + const trust = createInMemoryTrustContext({ + agentKeyPair, + trustedAccountKeys: [unlocked.publicKey], + now: () => BASE_TIME + 1000, + }); + let counter = 0; + const send = ( + signer: Parameters[0] | "account", + type: string, + body: unknown, + ) => { + const params = { + type, + body, + agentPublicKey: agentKeyPair.publicKey, + counter: ++counter, + now: BASE_TIME + 500, + registry, + }; + const command = + signer === "account" + ? createSensitiveCommand(unlocked, params) + : createCommandFromSession(signer, params); + return openCommand(command, trust, registry); + }; + return { unlocked, registry, send }; + } + + test("a plain session runs everything inside the server folder", async () => { + const { unlocked, send } = setup(); + const session = issueSession(unlocked, { duration: "7d", now: BASE_TIME }); + for (const [type, body] of [ + ["files.delete", { server_id: "srv", path: "a.txt" }], + [ + "server.install_modpack", + { server_id: "srv", source: "tegra", modpack_id: "a", version_id: "b" }, + ], + ["server.backup.create", { server_id: "srv" }], + ] as const) { + const opened = await send(session, type, body); + expect(opened.elevated).toBe(false); + } + unlocked.lock(); + }); + + test("sudo commands need the elevated session; account commands need the account key", async () => { + const { unlocked, send } = setup(); + const session = issueSession(unlocked, { duration: "7d", now: BASE_TIME }); + const elevated = issueElevatedSession(unlocked, { now: BASE_TIME }); + expect(isElevatedSession(elevated)).toBe(true); + expect(isElevatedSession(session)).toBe(false); + + await expectProtocolError( + send(session, "server.delete", { server_id: "srv" }), + "elevation_required", + ); + const opened = await send(elevated, "server.delete", { server_id: "srv" }); + expect(opened.signerType).toBe("session"); + expect(opened.elevated).toBe(true); + + const del = { server_id: "srv", backup_id: "bkp-1" }; + await expectProtocolError(send(elevated, "server.backup.delete", del), "account_key_required"); + await expectProtocolError(send(session, "server.backup.delete", del), "account_key_required"); + expect((await send("account", "server.backup.delete", del)).signerType).toBe("account"); + expect((await send("account", "server.delete", { server_id: "srv" })).signerType).toBe( + "account", + ); + unlocked.lock(); + }); + + test("the elevated certificate is capped at 1 hour, by the signer and by the agent", async () => { + const { unlocked, send } = setup(); + expect(() => + issueElevatedSession(unlocked, { now: BASE_TIME, validityMs: MAX_ELEVATED_SESSION_MS + 1 }), + ).toThrow(RangeError); + + // A hand-built certificate over the cap is refused by the agent. + const long = issueElevatedSession(unlocked, { now: BASE_TIME }); + const forged = { + ...long, + certificate: { ...long.certificate, not_after: BASE_TIME + MAX_ELEVATED_SESSION_MS + 1 }, + }; + await expectProtocolError( + send(forged, "server.delete", { server_id: "srv" }), + "elevation_invalid", + ); + + // The window closes when the certificate expires. + const short = issueElevatedSession(unlocked, { now: BASE_TIME - 2000, validityMs: 1000 }); + await expectProtocolError( + send(short, "server.delete", { server_id: "srv" }), + "session_invalid", + ); + unlocked.lock(); + }); + + test("stripping or adding the elevated scope breaks the certificate signature", async () => { + const { unlocked, send } = setup(); + const elevated = issueElevatedSession(unlocked, { now: BASE_TIME }); + const { scope: _scope, ...stripped } = elevated.certificate; + await expectProtocolError( + send({ ...elevated, certificate: stripped }, "files.read", { server_id: "srv", path: "a" }), + "session_invalid", + ); + + // A plain certificate short enough to pass the cap, promoted by hand. + const plain = generateSigningKeyPair(); + const plainCert = signSessionCertificate({ + sessionPublicKey: plain.publicKey, + accountKeyPair: unlocked.keyPair, + notBefore: BASE_TIME, + notAfter: BASE_TIME + 30 * 60 * 1000, + }); + const promoted = { + keyPair: plain, + certificate: { ...plainCert, scope: "elevated" as const }, + }; + await expectProtocolError( + send(promoted, "server.delete", { server_id: "srv" }), + "session_invalid", + ); + + // A long session promoted by hand is over the cap before its signature is even checked. + const session = issueSession(unlocked, { duration: "24h", now: BASE_TIME }); + const promotedLong = { + ...session, + certificate: { ...session.certificate, scope: "elevated" as const }, + }; + await expectProtocolError( + send(promotedLong, "server.delete", { server_id: "srv" }), + "elevation_invalid", + ); + + expect(() => + signSessionCertificate({ + sessionPublicKey: elevated.keyPair.publicKey, + accountKeyPair: generateSigningKeyPair(), + notBefore: BASE_TIME, + notAfter: BASE_TIME + MAX_ELEVATED_SESSION_MS + 1, + elevated: true, + }), + ).toThrow(RangeError); + unlocked.lock(); + }); +}); From b772990be23e47b09d5f39692567e2e4f68b2236 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sat, 28 Nov 2026 00:09:59 -0300 Subject: [PATCH 44/59] build(lib): rebuild for signing levels --- .../{index-df9ww65b.js => index-k66kvjnc.js} | 150 ++++++++++-------- lib/protocol/index.js | 4 +- lib/types/protocol/command.d.ts | 2 + lib/types/protocol/errors.d.ts | 2 +- lib/types/protocol/index.d.ts | 4 +- lib/types/protocol/registry.d.ts | 12 +- lib/types/protocol/schemas.d.ts | 4 + lib/types/protocol/session.d.ts | 8 + lib/types/vault/index.d.ts | 2 +- lib/types/vault/session.d.ts | 13 ++ lib/vault/index.js | 33 +++- 11 files changed, 161 insertions(+), 73 deletions(-) rename lib/chunks/{index-df9ww65b.js => index-k66kvjnc.js} (91%) diff --git a/lib/chunks/index-df9ww65b.js b/lib/chunks/index-k66kvjnc.js similarity index 91% rename from lib/chunks/index-df9ww65b.js rename to lib/chunks/index-k66kvjnc.js index 9073228..aac9ccb 100644 --- a/lib/chunks/index-df9ww65b.js +++ b/lib/chunks/index-k66kvjnc.js @@ -69,6 +69,7 @@ var sessionCertificateSchema = z.object({ not_before: z.number().int().nonnegative(), not_after: z.number().int().nonnegative(), id: base64UrlSchema, + scope: z.literal("elevated").optional(), sig: base64UrlSchema }); var commandHeaderSchema = z.object({ @@ -615,6 +616,7 @@ class RoleTable { } // src/protocol/session.ts +var MAX_ELEVATED_SESSION_MS = 60 * 60 * 1000; function signSessionCertificate(params) { if (params.sessionPublicKey.length !== SIGNING_PUBLIC_KEY_BYTES) { throw new RangeError(`Session public key must be ${SIGNING_PUBLIC_KEY_BYTES} bytes`); @@ -625,13 +627,17 @@ function signSessionCertificate(params) { if (params.notBefore < 0 || params.notAfter <= params.notBefore) { throw new RangeError("Invalid session certificate validity window"); } + if (params.elevated === true && params.notAfter - params.notBefore > MAX_ELEVATED_SESSION_MS) { + throw new RangeError("Elevated session certificate exceeds the maximum validity"); + } const unsigned = { v: PROTOCOL_VERSION, session_key: toBase64Url(params.sessionPublicKey), account: fingerprint(params.accountKeyPair.publicKey), not_before: params.notBefore, not_after: params.notAfter, - id: params.id ?? toBase64Url(randomBytes(16)) + id: params.id ?? toBase64Url(randomBytes(16)), + ...params.elevated === true ? { scope: "elevated" } : {} }; const signingInput = concatBytes(DOMAIN_SESSION, canonicalize(unsigned)); const signature = sign(signingInput, params.accountKeyPair.secretKey); @@ -653,6 +659,10 @@ function verifySessionCertificate(certificate, accountPublicKey, atTime) { if (cert.not_after <= cert.not_before) { throw new ProtocolError("session_invalid", "Session certificate has invalid validity window"); } + const elevated = cert.scope === "elevated"; + if (elevated && cert.not_after - cert.not_before > MAX_ELEVATED_SESSION_MS) { + throw new ProtocolError("elevation_invalid", "Elevated session certificate exceeds the maximum validity"); + } if (atTime !== undefined && (atTime < cert.not_before || atTime >= cert.not_after)) { throw new ProtocolError("session_invalid", "Session certificate is not valid at this time"); } @@ -674,7 +684,8 @@ function verifySessionCertificate(certificate, accountPublicKey, atTime) { } return { certificate: cert, - sessionPublicKey + sessionPublicKey, + elevated }; } @@ -775,6 +786,7 @@ async function openCommand(command, trust, registry) { let accountId; let sessionId; let sessionNotAfter; + let elevated = false; if (session !== undefined) { const accountPublicKey = trust.isTrustedAccountKey(session.account); if (accountPublicKey === null) { @@ -795,6 +807,7 @@ async function openCommand(command, trust, registry) { accountId = session.account; sessionId = session.id; sessionNotAfter = verifiedSession.certificate.not_after; + elevated = verifiedSession.elevated; } else { const accountPublicKey = trust.isTrustedAccountKey(header.signer); if (accountPublicKey === null) { @@ -843,8 +856,11 @@ async function openCommand(command, trust, registry) { if (!bodyResult.success) { throw new ProtocolError("invalid_body", "Command body failed schema validation"); } - if (definition.sensitive && signerType !== "account") { - throw new ProtocolError("sensitive_requires_account_key", "Sensitive command must be signed directly by an account key"); + if (definition.level === "account" && signerType !== "account") { + throw new ProtocolError("account_key_required", "This command must be signed directly by the account key"); + } + if (definition.level === "sudo" && signerType !== "account" && !elevated) { + throw new ProtocolError("elevation_required", "This command needs an elevated session or the account key"); } const scope = typeof bodyResult.data === "object" && bodyResult.data !== null && "server_id" in bodyResult.data && typeof bodyResult.data.server_id === "string" ? bodyResult.data.server_id : "*"; const role = trust.roleFor(accountId, scope); @@ -855,6 +871,7 @@ async function openCommand(command, trust, registry) { header, body: bodyResult.data, signerType, + elevated, accountId, role, ...sessionId !== undefined ? { sessionId } : {}, @@ -869,7 +886,8 @@ import { z as z5 } from "zod"; function defineCommand(definition) { return { type: definition.type, - sensitive: definition.sensitive, + level: definition.level, + sensitive: definition.level !== "session", minRole: definition.minRole, body: definition.body }; @@ -966,61 +984,61 @@ var serverStatsResultSchema = z4.object({ }).strict(); var serverCreateCommand = defineCommand({ type: "server.create", - sensitive: false, + level: "session", minRole: "admin", body: serverCreateBodySchema }); var serverChangeRuntimeCommand = defineCommand({ type: "server.change_runtime", - sensitive: false, + level: "session", minRole: "admin", body: serverChangeRuntimeBodySchema }); var serverRestartCommand = defineCommand({ type: "server.restart", - sensitive: false, + level: "session", minRole: "operator", body: strictServerIdBodySchema }); var serverStatusCommand = defineCommand({ type: "server.status", - sensitive: false, + level: "session", minRole: "viewer", body: strictServerIdBodySchema }); var serverStatsCommand = defineCommand({ type: "server.stats", - sensitive: false, + level: "session", minRole: "viewer", body: serverStatsBodySchema }); var serverListCommand = defineCommand({ type: "server.list", - sensitive: false, + level: "session", minRole: "viewer", body: z4.object({}).strict() }); var serverUpdateSettingsCommand = defineCommand({ type: "server.update_settings", - sensitive: false, + level: "session", minRole: "editor", body: serverUpdateSettingsBodySchema }); var serverConsoleSendCommand = defineCommand({ type: "server.console.send", - sensitive: false, + level: "session", minRole: "operator", body: serverConsoleSendBodySchema }); var serverConsoleSubscribeCommand = defineCommand({ type: "server.console.subscribe", - sensitive: false, + level: "session", minRole: "viewer", body: serverConsoleSubscribeBodySchema }); var serverConsoleUnsubscribeCommand = defineCommand({ type: "server.console.unsubscribe", - sensitive: false, + level: "session", minRole: "viewer", body: strictServerIdBodySchema }); @@ -1062,25 +1080,25 @@ var agentMembersRevokeBodySchema = z5.object({ }).strict(); var agentSubscribeCommand = defineCommand({ type: "agent.subscribe", - sensitive: false, + level: "session", minRole: "viewer", body: agentSubscribeBodySchema }); var agentUnsubscribeCommand = defineCommand({ type: "agent.unsubscribe", - sensitive: false, + level: "session", minRole: "viewer", body: agentSubscribeBodySchema }); var agentMembersSetCommand = defineCommand({ type: "agent.members.set", - sensitive: true, + level: "account", minRole: "admin", body: agentMembersSetBodySchema }); var agentMembersRevokeCommand = defineCommand({ type: "agent.members.revoke", - sensitive: true, + level: "account", minRole: "admin", body: agentMembersRevokeBodySchema }); @@ -1185,37 +1203,37 @@ var serverBackupRestoreBodySchema = z6.object({ }).strict(); var serverBackupConfigSetCommand = defineCommand({ type: "server.backup.config.set", - sensitive: false, + level: "session", minRole: "editor", body: serverBackupConfigSetBodySchema }); var serverBackupConfigGetCommand = defineCommand({ type: "server.backup.config.get", - sensitive: false, + level: "session", minRole: "viewer", body: z6.object({ server_id: serverIdSchema }).strict() }); var serverBackupCreateCommand = defineCommand({ type: "server.backup.create", - sensitive: false, + level: "session", minRole: "editor", body: serverBackupCreateBodySchema }); var serverBackupListCommand = defineCommand({ type: "server.backup.list", - sensitive: false, + level: "session", minRole: "viewer", body: serverBackupListBodySchema }); var serverBackupDeleteCommand = defineCommand({ type: "server.backup.delete", - sensitive: true, + level: "account", minRole: "admin", body: serverBackupDeleteBodySchema }); var serverBackupRestoreCommand = defineCommand({ type: "server.backup.restore", - sensitive: true, + level: "sudo", minRole: "admin", body: serverBackupRestoreBodySchema }); @@ -1241,7 +1259,7 @@ var fileEncodingSchema = z7.enum(["utf8", "base64"]); var sha256HexSchema = z7.string().regex(SHA256_HEX_PATTERN, "Expected 64 lowercase hex characters"); var filesListCommand = defineCommand({ type: "files.list", - sensitive: false, + level: "session", minRole: "viewer", body: z7.object({ server_id: serverIdSchema, @@ -1250,7 +1268,7 @@ var filesListCommand = defineCommand({ }); var filesStatCommand = defineCommand({ type: "files.stat", - sensitive: false, + level: "session", minRole: "viewer", body: z7.object({ server_id: serverIdSchema, @@ -1259,7 +1277,7 @@ var filesStatCommand = defineCommand({ }); var filesReadCommand = defineCommand({ type: "files.read", - sensitive: false, + level: "session", minRole: "editor", body: z7.object({ server_id: serverIdSchema, @@ -1269,7 +1287,7 @@ var filesReadCommand = defineCommand({ }); var filesWriteCommand = defineCommand({ type: "files.write", - sensitive: false, + level: "session", minRole: "editor", body: z7.object({ server_id: serverIdSchema, @@ -1280,7 +1298,7 @@ var filesWriteCommand = defineCommand({ }); var filesMkdirCommand = defineCommand({ type: "files.mkdir", - sensitive: false, + level: "session", minRole: "editor", body: z7.object({ server_id: serverIdSchema, @@ -1289,7 +1307,7 @@ var filesMkdirCommand = defineCommand({ }); var filesRenameCommand = defineCommand({ type: "files.rename", - sensitive: false, + level: "session", minRole: "editor", body: z7.object({ server_id: serverIdSchema, @@ -1299,7 +1317,7 @@ var filesRenameCommand = defineCommand({ }); var filesMoveCommand = defineCommand({ type: "files.move", - sensitive: false, + level: "session", minRole: "editor", body: z7.object({ server_id: serverIdSchema, @@ -1309,7 +1327,7 @@ var filesMoveCommand = defineCommand({ }); var filesCopyCommand = defineCommand({ type: "files.copy", - sensitive: false, + level: "session", minRole: "editor", body: z7.object({ server_id: serverIdSchema, @@ -1319,7 +1337,7 @@ var filesCopyCommand = defineCommand({ }); var filesDeleteCommand = defineCommand({ type: "files.delete", - sensitive: true, + level: "session", minRole: "editor", body: z7.object({ server_id: serverIdSchema, @@ -1329,7 +1347,7 @@ var filesDeleteCommand = defineCommand({ }); var filesUploadBeginCommand = defineCommand({ type: "files.upload.begin", - sensitive: false, + level: "session", minRole: "editor", body: z7.object({ server_id: serverIdSchema, @@ -1341,7 +1359,7 @@ var filesUploadBeginCommand = defineCommand({ }); var filesUploadPartCommand = defineCommand({ type: "files.upload.part", - sensitive: false, + level: "session", minRole: "editor", body: z7.object({ server_id: serverIdSchema, @@ -1352,7 +1370,7 @@ var filesUploadPartCommand = defineCommand({ }); var filesUploadCommitCommand = defineCommand({ type: "files.upload.commit", - sensitive: false, + level: "session", minRole: "editor", body: z7.object({ server_id: serverIdSchema, @@ -1361,7 +1379,7 @@ var filesUploadCommitCommand = defineCommand({ }); var filesUploadAbortCommand = defineCommand({ type: "files.upload.abort", - sensitive: false, + level: "session", minRole: "editor", body: z7.object({ server_id: serverIdSchema, @@ -1370,7 +1388,7 @@ var filesUploadAbortCommand = defineCommand({ }); var filesDownloadBeginCommand = defineCommand({ type: "files.download.begin", - sensitive: false, + level: "session", minRole: "editor", body: z7.object({ server_id: serverIdSchema, @@ -1380,7 +1398,7 @@ var filesDownloadBeginCommand = defineCommand({ }); var filesDownloadPartCommand = defineCommand({ type: "files.download.part", - sensitive: false, + level: "session", minRole: "editor", body: z7.object({ server_id: serverIdSchema, @@ -1390,7 +1408,7 @@ var filesDownloadPartCommand = defineCommand({ }); var filesDownloadCloseCommand = defineCommand({ type: "files.download.close", - sensitive: false, + level: "session", minRole: "editor", body: z7.object({ server_id: serverIdSchema, @@ -1399,7 +1417,7 @@ var filesDownloadCloseCommand = defineCommand({ }); var filesDownloadCommand = defineCommand({ type: "files.download", - sensitive: false, + level: "session", minRole: "editor", body: z7.object({ server_id: serverIdSchema, @@ -1410,7 +1428,7 @@ var filesDownloadCommand = defineCommand({ }); var filesZipCommand = defineCommand({ type: "files.zip", - sensitive: false, + level: "session", minRole: "editor", body: z7.object({ server_id: serverIdSchema, @@ -1420,7 +1438,7 @@ var filesZipCommand = defineCommand({ }); var filesUnzipCommand = defineCommand({ type: "files.unzip", - sensitive: false, + level: "session", minRole: "editor", body: z7.object({ server_id: serverIdSchema, @@ -1465,7 +1483,7 @@ var hostInfoResultSchema = z8.object({ }); var hostInfoCommand = defineCommand({ type: "host.info", - sensitive: false, + level: "session", minRole: "viewer", body: hostInfoBodySchema }); @@ -1566,19 +1584,19 @@ var serverInstallModpackStatusResultSchema = z9.object({ }).strict(); var serverInstallModpackCommand = defineCommand({ type: "server.install_modpack", - sensitive: true, + level: "session", minRole: "editor", body: serverInstallModpackBodySchema }); var serverInstallModpackStatusCommand = defineCommand({ type: "server.install_modpack.status", - sensitive: false, + level: "session", minRole: "viewer", body: serverInstallModpackStatusBodySchema }); var serverInstallModpackCancelCommand = defineCommand({ type: "server.install_modpack.cancel", - sensitive: false, + level: "session", minRole: "editor", body: serverInstallModpackCancelBodySchema }); @@ -1595,7 +1613,7 @@ function registerModpackCommands(registry) { import { z as z10 } from "zod"; var agentRevocationsSetCommand = defineCommand({ type: "agent.revocations.set", - sensitive: false, + level: "session", minRole: "admin", body: z10.object({ list: revocationListSchema @@ -1766,49 +1784,49 @@ var serverDeployServerpackBodySchema = z11.object({ }).strict(); var serverModsListCommand = defineCommand({ type: "server.mods.list", - sensitive: false, + level: "session", minRole: "viewer", body: serverModsListBodySchema }); var serverModsInstallCommand = defineCommand({ type: "server.mods.install", - sensitive: false, + level: "session", minRole: "editor", body: serverModsInstallBodySchema }); var serverModsRemoveCommand = defineCommand({ type: "server.mods.remove", - sensitive: false, + level: "session", minRole: "editor", body: serverModsRemoveBodySchema }); var serverOriginPlanCommand = defineCommand({ type: "server.origin.plan", - sensitive: false, + level: "session", minRole: "editor", body: serverOriginPlanBodySchema }); var serverOriginApplyCommand = defineCommand({ type: "server.origin.apply", - sensitive: true, + level: "session", minRole: "editor", body: serverOriginApplyBodySchema }); var serverOriginUnlinkCommand = defineCommand({ type: "server.origin.unlink", - sensitive: false, + level: "session", minRole: "editor", body: serverOriginUnlinkBodySchema }); var serverDeployServerpackCommand = defineCommand({ type: "server.deploy.serverpack", - sensitive: true, + level: "session", minRole: "editor", body: serverDeployServerpackBodySchema }); var serverWorldImportCommand = defineCommand({ type: "server.world.import", - sensitive: false, + level: "session", minRole: "editor", body: serverWorldImportBodySchema }); @@ -1837,25 +1855,25 @@ var tunnelPlayitSetKeyBodySchema = z12.object({ }).strict(); var tunnelPlayitSetKeyCommand = defineCommand({ type: "tunnel.playit.set_key", - sensitive: true, + level: "sudo", minRole: "admin", body: tunnelPlayitSetKeyBodySchema }); var tunnelPlayitStartCommand = defineCommand({ type: "tunnel.playit.start", - sensitive: false, + level: "session", minRole: "admin", body: z12.object({}).strict() }); var tunnelPlayitStopCommand = defineCommand({ type: "tunnel.playit.stop", - sensitive: false, + level: "session", minRole: "admin", body: z12.object({}).strict() }); var tunnelPlayitStatusCommand = defineCommand({ type: "tunnel.playit.status", - sensitive: false, + level: "session", minRole: "viewer", body: z12.object({}).strict() }); @@ -1878,25 +1896,25 @@ var strictServerDeleteBodySchema = z13.object({ }).strict(); var agentPingCommand = defineCommand({ type: "agent.ping", - sensitive: false, + level: "session", minRole: "viewer", body: z13.object({}).strict() }); var serverStartCommand = defineCommand({ type: "server.start", - sensitive: false, + level: "session", minRole: "operator", body: serverIdBodySchema }); var serverStopCommand = defineCommand({ type: "server.stop", - sensitive: false, + level: "session", minRole: "operator", body: serverIdBodySchema }); var serverDeleteCommand = defineCommand({ type: "server.delete", - sensitive: true, + level: "sudo", minRole: "admin", body: strictServerDeleteBodySchema }); @@ -2241,4 +2259,4 @@ function createInMemoryTrustContext(options) { } }; } -export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, minecraftVersionSchema, loaderVersionSchema, serverCreateBodySchema, serverChangeRuntimeBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverStatsBodySchema, serverStatsResultSchema, serverCreateCommand, serverChangeRuntimeCommand, serverRestartCommand, serverStatusCommand, serverStatsCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, BACKUP_UPLOAD_STATES, backupUploadStateSchema, serverBackupUploadEventSchema, pendingBackupUploadSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, hostInfoBodySchema, hostInfoResultSchema, hostInfoCommand, HOST_COMMANDS, registerHostCommands, MODPACK_SOURCES, modpackSourceSchema, MODPACK_INSTALL_PHASES, modpackInstallPhaseSchema, MODPACK_INSTALL_JOB_STATES, modpackInstallJobStateSchema, MODPACK_INSTALL_ERROR_CODES, modpackInstallErrorCodeSchema, modpackInstallSkippedItemSchema, serverInstallModpackBodySchema, serverInstallModpackStatusBodySchema, serverInstallModpackCancelBodySchema, serverInstallModpackAcceptedEventSchema, serverInstallModpackProgressEventSchema, serverInstallModpackResultEventSchema, modpackInstallJobStatusSchema, serverInstallModpackStatusResultSchema, serverInstallModpackCommand, serverInstallModpackStatusCommand, serverInstallModpackCancelCommand, MODPACK_COMMANDS, registerModpackCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; +export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, MAX_ELEVATED_SESSION_MS, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, minecraftVersionSchema, loaderVersionSchema, serverCreateBodySchema, serverChangeRuntimeBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverStatsBodySchema, serverStatsResultSchema, serverCreateCommand, serverChangeRuntimeCommand, serverRestartCommand, serverStatusCommand, serverStatsCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, BACKUP_UPLOAD_STATES, backupUploadStateSchema, serverBackupUploadEventSchema, pendingBackupUploadSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, hostInfoBodySchema, hostInfoResultSchema, hostInfoCommand, HOST_COMMANDS, registerHostCommands, MODPACK_SOURCES, modpackSourceSchema, MODPACK_INSTALL_PHASES, modpackInstallPhaseSchema, MODPACK_INSTALL_JOB_STATES, modpackInstallJobStateSchema, MODPACK_INSTALL_ERROR_CODES, modpackInstallErrorCodeSchema, modpackInstallSkippedItemSchema, serverInstallModpackBodySchema, serverInstallModpackStatusBodySchema, serverInstallModpackCancelBodySchema, serverInstallModpackAcceptedEventSchema, serverInstallModpackProgressEventSchema, serverInstallModpackResultEventSchema, modpackInstallJobStatusSchema, serverInstallModpackStatusResultSchema, serverInstallModpackCommand, serverInstallModpackStatusCommand, serverInstallModpackCancelCommand, MODPACK_COMMANDS, registerModpackCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; diff --git a/lib/protocol/index.js b/lib/protocol/index.js index a1ec92f..7ade345 100644 --- a/lib/protocol/index.js +++ b/lib/protocol/index.js @@ -33,6 +33,7 @@ import { MAX_CLOCK_SKEW_MS, MAX_COMMAND_TTL_MS, MAX_CONSOLE_LINE_LENGTH, + MAX_ELEVATED_SESSION_MS, MAX_GRANT_CLOCK_SKEW_MS, MAX_GRANT_SERVERS, MAX_JVM_ARGS, @@ -266,7 +267,7 @@ import { verifyTrustGrant, worldNameSchema, wrapEventBody -} from "../chunks/index-df9ww65b.js"; +} from "../chunks/index-k66kvjnc.js"; import"../chunks/index-g1frygvt.js"; export { wrapEventBody, @@ -502,6 +503,7 @@ export { MAX_JVM_ARGS, MAX_GRANT_SERVERS, MAX_GRANT_CLOCK_SKEW_MS, + MAX_ELEVATED_SESSION_MS, MAX_CONSOLE_LINE_LENGTH, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, diff --git a/lib/types/protocol/command.d.ts b/lib/types/protocol/command.d.ts index 76f5c22..684eeda 100644 --- a/lib/types/protocol/command.d.ts +++ b/lib/types/protocol/command.d.ts @@ -27,6 +27,8 @@ export interface OpenedCommand { readonly header: CommandHeader; readonly body: TBody; readonly signerType: "account" | "session"; + /** True when the signer is a session with an elevated certificate. */ + readonly elevated: boolean; readonly accountId: KeyId; readonly sessionId?: string; /** `not_after` of the signing session certificate, when the signer is a session. */ diff --git a/lib/types/protocol/errors.d.ts b/lib/types/protocol/errors.d.ts index 93b4fd0..14c4693 100644 --- a/lib/types/protocol/errors.d.ts +++ b/lib/types/protocol/errors.d.ts @@ -1,4 +1,4 @@ -export type ProtocolErrorCode = "invalid_format" | "unsupported_version" | "wrong_agent" | "wrong_recipient" | "expired" | "not_yet_valid" | "ttl_too_long" | "untrusted_signer" | "bad_signature" | "session_invalid" | "session_revoked" | "replayed" | "unknown_command" | "invalid_body" | "sensitive_requires_account_key" | "decrypt_failed" | "insufficient_role" | "too_many_subscribers" | "role_grant_invalid" | "auth_invalid" | "request_invalid" | "grant_invalid" | "grant_wrong_agent" | "grant_expired" | "grant_bad_signature" | "grant_proof_required" | "grant_bad_proof" | "revocation_stale" | "revocation_not_superset" | "insufficient_memory" | "eula_not_accepted" | "server_not_found" | "server_already_exists" | "server_running" | "server_stopped" | "invalid_jvm_args" | "download_failed" | "hash_mismatch" | "systemd_error" | "perms_unavailable" | "origin_locked" | "plan_not_found" | "plan_expired" | "plan_stale" | "mod_not_found" | "mod_already_exists" | "backup_not_found" | "backup_failed" | "backup_config_invalid" | "tunnel_not_configured" | "tunnel_already_running" | "tunnel_not_running" | "tunnel_failed" | "pack_unavailable" | "runtime_mismatch" | "host_not_allowed" | "too_large" | "install_in_progress" | "api_unavailable" | "io_error" | "cancelled"; +export type ProtocolErrorCode = "invalid_format" | "unsupported_version" | "wrong_agent" | "wrong_recipient" | "expired" | "not_yet_valid" | "ttl_too_long" | "untrusted_signer" | "bad_signature" | "session_invalid" | "session_revoked" | "replayed" | "unknown_command" | "invalid_body" | "elevation_required" | "elevation_invalid" | "account_key_required" | "decrypt_failed" | "insufficient_role" | "too_many_subscribers" | "role_grant_invalid" | "auth_invalid" | "request_invalid" | "grant_invalid" | "grant_wrong_agent" | "grant_expired" | "grant_bad_signature" | "grant_proof_required" | "grant_bad_proof" | "revocation_stale" | "revocation_not_superset" | "insufficient_memory" | "eula_not_accepted" | "server_not_found" | "server_already_exists" | "server_running" | "server_stopped" | "invalid_jvm_args" | "download_failed" | "hash_mismatch" | "systemd_error" | "perms_unavailable" | "origin_locked" | "plan_not_found" | "plan_expired" | "plan_stale" | "mod_not_found" | "mod_already_exists" | "backup_not_found" | "backup_failed" | "backup_config_invalid" | "tunnel_not_configured" | "tunnel_already_running" | "tunnel_not_running" | "tunnel_failed" | "pack_unavailable" | "runtime_mismatch" | "host_not_allowed" | "too_large" | "install_in_progress" | "api_unavailable" | "io_error" | "cancelled"; export declare class ProtocolError extends Error { readonly code: ProtocolErrorCode; constructor(code: ProtocolErrorCode, message: string); diff --git a/lib/types/protocol/index.d.ts b/lib/types/protocol/index.d.ts index 6c9e9c5..cefc63f 100644 --- a/lib/types/protocol/index.d.ts +++ b/lib/types/protocol/index.d.ts @@ -14,9 +14,9 @@ export { PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, registerTunnelCommands, export { DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_AGENT_MESSAGE, DOMAIN_COMMAND, DOMAIN_PAIRING_PROOF, DOMAIN_REVOCATION, DOMAIN_ROLE_GRANT, DOMAIN_SESSION, DOMAIN_TRUST_GRANT, PROTOCOL_VERSION, } from "./domains"; export { ProtocolError, type ProtocolErrorCode } from "./errors"; export { type BuildPairingFragmentParams, buildPairingFragment, DEFAULT_TRUST_GRANT_TTL_MS, generatePairingCode, generatePairingSecret, MAX_TRUST_GRANT_TTL_MS, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, type PairingFragment, pairingCodeSchema, parsePairingFragment, type SignTrustGrantParams, signTrustGrant, type TrustGrant, trustGrantSchema, type VerifiedTrustGrant, type VerifyTrustGrantOptions, verifyTrustGrant, } from "./pairing"; -export { type CommandDefinition, CommandRegistry, defineCommand } from "./registry"; +export { type CommandDefinition, type CommandLevel, CommandRegistry, defineCommand, } from "./registry"; export { type SignRevocationListParams, signRevocationList, verifyRevocationList, } from "./revocation"; export { ALL_SERVERS, GRANTABLE_ROLES, type GrantableRole, grantableRoleSchema, MAX_GRANT_CLOCK_SKEW_MS, MAX_GRANT_SERVERS, MAX_MEMBERS, type MemberEntry, maxRole, memberEntrySchema, ROLE_LEVEL, ROLES, type Role, type RoleGrant, RoleTable, roleAtLeast, roleGrantSchema, roleSchema, type SignRoleGrantParams, signRoleGrant, type VerifiedRoleGrant, type VerifyRoleGrantOptions, verifyRoleGrant, } from "./roles"; export { AGENT_NONCE_BYTES, type AgentMessage, type AgentMessageHeader, agentMessageHeaderSchema, agentMessageSchema, agentNonceSchema, base64UrlSchema, type CommandHeader, commandHeaderSchema, type KeyId, keyIdSchema, type RevocationList, revocationListSchema, type SessionCertificate, type SignedCommand, sessionCertificateSchema, signedCommandSchema, type TransportFrame, transportAckFrameSchema, transportAuthFrameSchema, transportCommandFrameSchema, transportEventFrameSchema, transportFrameSchema, transportHelloFrameSchema, transportPingFrameSchema, } from "./schemas"; -export { type SignSessionCertificateParams, signSessionCertificate, type VerifiedSessionCertificate, verifySessionCertificate, } from "./session"; +export { MAX_ELEVATED_SESSION_MS, type SignSessionCertificateParams, signSessionCertificate, type VerifiedSessionCertificate, verifySessionCertificate, } from "./session"; export { createInMemoryTrustContext, type InMemoryTrustContext, type InMemoryTrustContextOptions, type MemberStore, type TrustContext, } from "./trust"; diff --git a/lib/types/protocol/registry.d.ts b/lib/types/protocol/registry.d.ts index 3e56958..ee48284 100644 --- a/lib/types/protocol/registry.d.ts +++ b/lib/types/protocol/registry.d.ts @@ -1,14 +1,24 @@ import type { z } from "zod"; import type { Role } from "./roles"; +/** + * What a command needs from its signer, split by the sandbox boundary: + * - `session`: stays inside the server folder; any valid session key. + * - `sudo`: leaves the folder (restore a backup, delete a server, tunnel keys); an + * elevated session (short lived, see `MAX_ELEVATED_SESSION_MS`) or the account key. + * - `account`: recovery and access (delete a backup, members); the account key only. + */ +export type CommandLevel = "session" | "sudo" | "account"; export interface CommandDefinition { readonly type: TType; + readonly level: CommandLevel; + /** `level !== "session"`. Kept for launchers that only know this flag. */ readonly sensitive: boolean; readonly minRole: Role; readonly body: z.ZodType; } export declare function defineCommand(definition: { readonly type: TType; - readonly sensitive: boolean; + readonly level: CommandLevel; readonly minRole: Role; readonly body: z.ZodType; }): CommandDefinition; diff --git a/lib/types/protocol/schemas.d.ts b/lib/types/protocol/schemas.d.ts index 564e22e..4ea3282 100644 --- a/lib/types/protocol/schemas.d.ts +++ b/lib/types/protocol/schemas.d.ts @@ -9,6 +9,7 @@ export declare const sessionCertificateSchema: z.ZodObject<{ not_before: z.ZodNumber; not_after: z.ZodNumber; id: z.ZodString; + scope: z.ZodOptional>; sig: z.ZodString; }, z.core.$strip>; export type SessionCertificate = z.infer; @@ -44,6 +45,7 @@ export declare const signedCommandSchema: z.ZodObject<{ not_before: z.ZodNumber; not_after: z.ZodNumber; id: z.ZodString; + scope: z.ZodOptional>; sig: z.ZodString; }, z.core.$strip>>; sig: z.ZodString; @@ -107,6 +109,7 @@ export declare const transportCommandFrameSchema: z.ZodObject<{ not_before: z.ZodNumber; not_after: z.ZodNumber; id: z.ZodString; + scope: z.ZodOptional>; sig: z.ZodString; }, z.core.$strip>>; sig: z.ZodString; @@ -227,6 +230,7 @@ export declare const transportFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject< not_before: z.ZodNumber; not_after: z.ZodNumber; id: z.ZodString; + scope: z.ZodOptional>; sig: z.ZodString; }, z.core.$strip>>; sig: z.ZodString; diff --git a/lib/types/protocol/session.d.ts b/lib/types/protocol/session.d.ts index 4ff053e..0142cf2 100644 --- a/lib/types/protocol/session.d.ts +++ b/lib/types/protocol/session.d.ts @@ -1,15 +1,23 @@ import { type PublicKey, type SigningKeyPair } from "../crypto"; import { type SessionCertificate } from "./schemas"; +/** + * Longest validity the agent accepts for an elevated certificate. The launcher closes + * the sudo window after a shorter idle time and drops the key; this cap is what holds + * even against a client that keeps the key around. + */ +export declare const MAX_ELEVATED_SESSION_MS: number; export interface SignSessionCertificateParams { readonly sessionPublicKey: PublicKey; readonly accountKeyPair: SigningKeyPair; readonly notBefore: number; readonly notAfter: number; readonly id?: string; + readonly elevated?: boolean; } export interface VerifiedSessionCertificate { readonly certificate: SessionCertificate; readonly sessionPublicKey: PublicKey; + readonly elevated: boolean; } export declare function signSessionCertificate(params: SignSessionCertificateParams): SessionCertificate; export declare function verifySessionCertificate(certificate: unknown, accountPublicKey: PublicKey, atTime?: number): VerifiedSessionCertificate; diff --git a/lib/types/vault/index.d.ts b/lib/types/vault/index.d.ts index 00c2645..023cd07 100644 --- a/lib/types/vault/index.d.ts +++ b/lib/types/vault/index.d.ts @@ -3,5 +3,5 @@ export { type CounterStore, createMemoryCounterStore } from "./counter"; export { VaultError, type VaultErrorCode } from "./errors"; export { MIN_PASSWORD_LENGTH, MIN_PASSWORD_SCORE, type PasswordValidationResult, type ValidatePasswordOptions, validatePassword, } from "./password"; export { deriveRecoveryKey, formatRecoveryCode, generateRecoveryCodeBytes, parseRecoveryCode, RECOVERY_CODE_BYTES, } from "./recovery-code"; -export { createCommandFromSession, createSensitiveCommand, type IssueSessionOptions, isSessionExpired, issueSession, parseSession, SESSION_DURATION_MS, type Session, type SessionDuration, type SignRevocationParams, serializeSession, sessionExpiresAt, signRevocation, type VaultCommandParams, } from "./session"; +export { createCommandFromSession, createSensitiveCommand, type IssueElevatedSessionOptions, type IssueSessionOptions, isElevatedSession, isSessionExpired, issueElevatedSession, issueSession, parseSession, SESSION_DURATION_MS, type Session, type SessionDuration, type SignRevocationParams, serializeSession, sessionExpiresAt, signRevocation, type VaultCommandParams, } from "./session"; export { type ChangePasswordOptions, type CreateVaultParams, type CreateVaultResult, changePassword, createVault, type RotateRecoveryCodeResult, resetPasswordWithRecovery, rotateRecoveryCode, type UnlockedVault, unlockVault, unlockVaultWithRecovery, withUnlockedVault, } from "./vault"; diff --git a/lib/types/vault/session.d.ts b/lib/types/vault/session.d.ts index 7b1680c..93f782a 100644 --- a/lib/types/vault/session.d.ts +++ b/lib/types/vault/session.d.ts @@ -34,6 +34,19 @@ export interface SignRevocationParams { readonly now: number; } export declare function issueSession(unlocked: UnlockedVault, options: IssueSessionOptions): Session; +export interface IssueElevatedSessionOptions { + readonly now?: number; + readonly id?: string; + /** Validity of the certificate; defaults to and may not exceed the agent's 1 h cap. */ + readonly validityMs?: number; +} +/** + * Issues the key for the sudo window. Keep it in memory only and drop it when the + * window closes (the launcher closes it after 15 minutes without a sudo command); the + * agent refuses it after its certificate expires, at most 1 h after issue. + */ +export declare function issueElevatedSession(unlocked: UnlockedVault, options?: IssueElevatedSessionOptions): Session; +export declare function isElevatedSession(session: Session): boolean; export declare function serializeSession(session: Session): string; export declare function parseSession(text: string): Session; export declare function sessionExpiresAt(session: Session): number; diff --git a/lib/vault/index.js b/lib/vault/index.js index 2813c5e..73f0d67 100644 --- a/lib/vault/index.js +++ b/lib/vault/index.js @@ -1,11 +1,12 @@ import { + MAX_ELEVATED_SESSION_MS, base64UrlSchema, createSignedCommand, keyIdSchema, sessionCertificateSchema, signRevocationList, signSessionCertificate -} from "../chunks/index-df9ww65b.js"; +} from "../chunks/index-k66kvjnc.js"; import { KDF_ALG_ARGON2ID13, KDF_MODERATE, @@ -3922,6 +3923,34 @@ function issueSession(unlocked, options) { throw err; } } +function issueElevatedSession(unlocked, options = {}) { + const now = options.now ?? Date.now(); + if (!Number.isSafeInteger(now) || now < 0) { + throw new RangeError("Timestamp must be a non-negative safe integer"); + } + const validityMs = options.validityMs ?? MAX_ELEVATED_SESSION_MS; + if (!Number.isSafeInteger(validityMs) || validityMs <= 0 || validityMs > MAX_ELEVATED_SESSION_MS) { + throw new RangeError("Elevated session validity must be positive and at most 1 hour"); + } + const keyPair = generateSigningKeyPair(); + try { + const certificate = signSessionCertificate({ + sessionPublicKey: keyPair.publicKey, + accountKeyPair: unlocked.keyPair, + notBefore: now, + notAfter: now + validityMs, + elevated: true, + ...options.id !== undefined ? { id: options.id } : {} + }); + return { keyPair, certificate }; + } catch (err) { + memzero(keyPair.secretKey); + throw err; + } +} +function isElevatedSession(session) { + return session.certificate.scope === "elevated"; +} function serializeSession(session) { return JSON.stringify({ v: 1, @@ -4323,7 +4352,9 @@ export { parseSession, parseRecoveryCode, issueSession, + issueElevatedSession, isSessionExpired, + isElevatedSession, generateRecoveryCodeBytes, formatRecoveryCode, deriveRecoveryKey, From ad2d54d954948f013178c5898f75b06a3409c31d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sat, 28 Nov 2026 18:13:37 -0300 Subject: [PATCH 45/59] feat(agent): run commands per server lane so one slow task no longer blocks the agent Commands were handled one at a time across the whole agent, so a loader change waiting on the Forge installer stopped every other request (server list, console, other servers) until it ended. Verification still runs in arrival order; reads now run right away and changes queue only behind changes to the same server (or the agent itself). Also: log the installer's own reason when Forge/NeoForge fail, and retry a background cloud upload that failed on the network (5 s, 30 s, 2 min). --- src/agent/jobs.test.ts | 110 +++++++++++++++++---------- src/agent/jobs.ts | 105 +++++++++++++++++++++---- src/backup/background-upload.test.ts | 57 ++++++++++++++ src/backup/manager.ts | 36 ++++++++- src/server/java-and-loaders.test.ts | 20 +++++ src/server/loaders.ts | 29 ++++++- 6 files changed, 298 insertions(+), 59 deletions(-) diff --git a/src/agent/jobs.test.ts b/src/agent/jobs.test.ts index 36dcf15..f8b4ec4 100644 --- a/src/agent/jobs.test.ts +++ b/src/agent/jobs.test.ts @@ -367,12 +367,11 @@ describe("command queue", () => { }); }); - test("executes simultaneous commands strictly serially", async () => { + function laneHarness() { const agent = generateSigningKeyPair(); const account = generateSigningKeyPair(); const agentId = fingerprint(agent.publicKey); const now = 1_700_000_000_000; - const trust = createInMemoryTrustContext({ agentKeyPair: agent, trustedAccountKeys: [account.publicKey], @@ -386,56 +385,89 @@ describe("command queue", () => { sendFrame: (frame) => sent.push(frame), logger: makeSilentLogger(), }); + let counter = 0; + const send = (type: string, body: unknown) => + queue.enqueue( + wrapCommand( + agentId, + createSignedCommand( + { + type, + body, + agentPublicKey: agent.publicKey, + signer: account, + counter: ++counter, + now, + }, + registry, + ), + ), + ); + return { queue, send, sent }; + } + + async function settle(): Promise { + for (let i = 0; i < 20; i++) { + await Promise.resolve(); + } + } + test("runs commands that change the same server one at a time", async () => { + const { queue, send } = laneHarness(); const events: string[] = []; let releaseFirst: (() => void) | undefined; const firstGate = new Promise((resolve) => { releaseFirst = resolve; }); - - queue.registerHandler("server.start", async (opened) => { - const body = opened.body as { server_id: string }; - events.push(`start:${body.server_id}`); - if (body.server_id === "first") { + let calls = 0; + queue.registerHandler("server.start", async () => { + const n = ++calls; + events.push(`start:${n}`); + if (n === 1) { await firstGate; } - events.push(`end:${body.server_id}`); + events.push(`end:${n}`); }); - const cmd1 = createSignedCommand( - { - type: "server.start", - body: { server_id: "first" }, - agentPublicKey: agent.publicKey, - signer: account, - counter: 1, - now, - }, - registry, - ); - const cmd2 = createSignedCommand( - { - type: "server.start", - body: { server_id: "second" }, - agentPublicKey: agent.publicKey, - signer: account, - counter: 2, - now, - }, - registry, - ); - - const p1 = queue.enqueue(wrapCommand(agentId, cmd1)); - const p2 = queue.enqueue(wrapCommand(agentId, cmd2)); - - // Allow microtasks to run so first command enters handler - await Promise.resolve(); - await Promise.resolve(); - expect(events).toEqual(["start:first"]); + const p1 = send("server.start", { server_id: "aged" }); + const p2 = send("server.start", { server_id: "aged" }); + await settle(); + expect(events).toEqual(["start:1"]); releaseFirst?.(); await Promise.all([p1, p2]); + expect(events).toEqual(["start:1", "end:1", "start:2", "end:2"]); + }); + + test("a slow command on one server does not hold other servers or reads", async () => { + const { queue, send } = laneHarness(); + const events: string[] = []; + let release: (() => void) | undefined; + const gate = new Promise((resolve) => { + release = resolve; + }); + queue.registerHandler("server.start", async (opened) => { + const id = (opened.body as { server_id: string }).server_id; + events.push(`start:${id}`); + if (id === "slow") { + await gate; + } + events.push(`end:${id}`); + }); + queue.registerHandler("server.status", (opened) => { + events.push(`status:${(opened.body as { server_id: string }).server_id}`); + }); - expect(events).toEqual(["start:first", "end:first", "start:second", "end:second"]); + const slow = send("server.start", { server_id: "slow" }); + const other = send("server.start", { server_id: "other" }); + const read = send("server.status", { server_id: "slow" }); + await Promise.all([other, read]); + expect(events).toEqual(["start:slow", "start:other", "end:other", "status:slow"]); + expect(await queue.drain(0)).toBe(false); + + release?.(); + await slow; + expect(events[events.length - 1]).toBe("end:slow"); + expect(await queue.drain(1000)).toBe(true); }); }); diff --git a/src/agent/jobs.ts b/src/agent/jobs.ts index f8a946c..3645855 100644 --- a/src/agent/jobs.ts +++ b/src/agent/jobs.ts @@ -124,8 +124,14 @@ export function createCommandQueue(options: CommandQueueOptions): CommandQueue { const subscribers = new Map(); let nextEventSeq = 1; - let tail: Promise = Promise.resolve(); + /** Verification runs in arrival order (counters, replay cache); handlers do not wait on it. */ + let verifyTail: Promise = Promise.resolve(); let pendingCount = 0; + /** Tail of each lane: commands that change the same server (or the agent) run one at a time. */ + const lanes = new Map>(); + const inflight = new Set>(); + /** Command ids being handled, so a resent frame is not reported as a replay. */ + const running = new Set(); function recordCompletedAck(id: string, sig: string, ack: TransportAckFrame): void { if (completedAcks.has(id)) { @@ -244,19 +250,42 @@ export function createCommandQueue(options: CommandQueueOptions): CommandQueue { } } - async function processCommand(frame: TransportCommandFrame): Promise { - const commandId = frame.body.header.id; - let opened: OpenedCommand; + /** + * Which lane a command runs in, or null to run it right away. Reads (viewer commands) + * never wait, so a long install or loader change on one server does not stop anyone + * from listing servers, reading the console or working on another server. + */ + function laneFor(opened: OpenedCommand): string | null { + const definition = registry.get(opened.header.type); + if (definition === undefined || definition.minRole === "viewer") { + return null; + } + const body = opened.body; + const serverId = + typeof body === "object" && + body !== null && + "server_id" in body && + typeof (body as { server_id: unknown }).server_id === "string" + ? (body as { server_id: string }).server_id + : null; + return serverId === null ? "agent" : `server:${serverId}`; + } + async function verifyCommand(frame: TransportCommandFrame): Promise { + const commandId = frame.body.header.id; try { - opened = await openCommand(frame.body, trust, registry); + return await openCommand(frame.body, trust, registry); } catch (err) { if (err instanceof ProtocolError) { if (err.code === "replayed") { const cached = completedAcks.get(commandId); if (cached !== undefined && cached.sig === frame.body.sig) { sendFrame(cached.ack); - return; + return null; + } + if (running.has(commandId)) { + // Still running: its ack goes out when it finishes. + return null; } } logger.warn("Command rejected by protocol verification", { @@ -264,7 +293,7 @@ export function createCommandQueue(options: CommandQueueOptions): CommandQueue { code: err.code, }); sendFrame(makeAckError(commandId, err.code)); - return; + return null; } logger.error("Unexpected error while opening command", { @@ -272,9 +301,11 @@ export function createCommandQueue(options: CommandQueueOptions): CommandQueue { errName: err instanceof Error ? err.name : "Error", }); sendFrame(makeAckError(commandId, "invalid_format")); - return; + return null; } + } + async function runCommand(frame: TransportCommandFrame, opened: OpenedCommand): Promise { const handler = handlers.get(opened.header.type); if (!handler) { logger.warn("No handler registered for command", { @@ -449,14 +480,51 @@ export function createCommandQueue(options: CommandQueueOptions): CommandQueue { enqueue(frame: TransportCommandFrame): Promise { pendingCount++; - const run = tail.then(async () => { - try { - await processCommand(frame); - } finally { + const verified = verifyTail.then(() => verifyCommand(frame)); + verifyTail = verified.then( + () => undefined, + () => undefined, + ); + const run = verified + .then(async (opened) => { + if (opened === null) { + return; + } + const id = opened.header.id; + running.add(id); + const lane = laneFor(opened); + try { + if (lane === null) { + await runCommand(frame, opened); + return; + } + const previous = lanes.get(lane) ?? Promise.resolve(); + const current = previous.then(() => runCommand(frame, opened)); + const settled = current.then( + () => undefined, + () => undefined, + ); + lanes.set(lane, settled); + try { + await current; + } finally { + if (lanes.get(lane) === settled) { + lanes.delete(lane); + } + } + } finally { + running.delete(id); + } + }) + .finally(() => { pendingCount--; - } - }); - tail = run.catch(() => {}); + }); + const tracked = run.then( + () => undefined, + () => undefined, + ); + inflight.add(tracked); + void tracked.then(() => inflight.delete(tracked)); return run; }, @@ -465,9 +533,14 @@ export function createCommandQueue(options: CommandQueueOptions): CommandQueue { return true; } let timer: ReturnType | undefined; + const settleAll = async (): Promise => { + while (inflight.size > 0) { + await Promise.all([...inflight]); + } + }; try { return await Promise.race([ - tail.then(() => true), + settleAll().then(() => true), new Promise((resolve) => { timer = setTimeout(() => resolve(false), timeoutMs); }), diff --git a/src/backup/background-upload.test.ts b/src/backup/background-upload.test.ts index e59f4af..99a5374 100644 --- a/src/backup/background-upload.test.ts +++ b/src/backup/background-upload.test.ts @@ -440,6 +440,63 @@ describe("Background multi-destination backups and progress events", () => { } }); + test("retries a background cloud upload that failed on the network", async () => { + const root = makeTempDir("tegrad-bkp-retry-"); + const stateDir = join(root, "state"); + const serversDir = join(root, "servers"); + const backupsDir = join(root, "backups"); + createSampleServer(serversDir, "srv", { "world/level.dat": "retry" }); + + const storageServer = Bun.serve({ + port: 0, + hostname: "127.0.0.1", + async fetch(req) { + await req.arrayBuffer(); + return new Response(null, { status: 200 }); + }, + }); + + try { + let urlRequests = 0; + const events: ServerBackupUploadEvent[] = []; + const manager = createBackupManager({ + stateDir, + serversBaseDir: serversDir, + localBackupsDir: backupsDir, + allowInsecure: true, + uploadRetryDelaysMs: [0, 0], + cloudUploadUrlProvider: async () => { + urlRequests++; + if (urlRequests === 1) { + throw new AgentApiError("network_error", "API network request failed"); + } + return { + id: "cloud-bkp-retry", + put_url: `http://127.0.0.1:${storageServer.port}/obj`, + headers: {}, + expires_at: Date.now() + 60_000, + max_bytes: 10 * 1024 * 1024, + }; + }, + cloudUploadConfirmer: async () => undefined, + onUploadProgress: (ev) => events.push(ev), + }); + manager.setConfig({ + server_id: "srv", + local: { enabled: true }, + tegra_cloud: { enabled: true }, + }); + + await manager.createBackup({ server_id: "srv" }); + await manager.waitForPendingUploads(); + + expect(urlRequests).toBe(2); + expect(events.at(-1)).toMatchObject({ destination: "tegra_cloud", state: "done" }); + } finally { + void storageServer.stop(true); + } + }); + test("single destination (tegra_cloud only) preserves synchronous result and still runs confirm", async () => { const root = makeTempDir("tegrad-bkp-single-"); const stateDir = join(root, "state"); diff --git a/src/backup/manager.ts b/src/backup/manager.ts index e3fd63c..a48b78e 100644 --- a/src/backup/manager.ts +++ b/src/backup/manager.ts @@ -110,6 +110,8 @@ export interface BackupManagerOptions { readonly onUploadProgress?: (event: ServerBackupUploadEvent) => void; /** Minimum interval between `uploading` progress events per upload (default 500 ms). */ readonly uploadProgressThrottleMs?: number; + /** Waits before retrying a background upload that failed on the network (one per retry). */ + readonly uploadRetryDelaysMs?: readonly number[]; readonly s3MaxBytes?: number; readonly maxArchiveFiles?: number; readonly maxArchiveBytes?: number; @@ -161,6 +163,10 @@ interface PendingUploadRecord { error?: string; } +/** A flaky connection (slow DNS, dropped packets) should not lose an upload on the first try. */ +const DEFAULT_UPLOAD_RETRY_DELAYS_MS: readonly number[] = [5_000, 30_000, 120_000]; +const RETRYABLE_UPLOAD_CODES = new Set(["network_error", "rate_limited"]); + function toStableBackupUploadErrorCode(err: unknown): string { if (err instanceof AgentApiError) { if (err.code === "http_error") { @@ -222,6 +228,7 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage const uploadProgressThrottleMs = options.uploadProgressThrottleMs ?? DEFAULT_UPLOAD_PROGRESS_THROTTLE_MS; + const uploadRetryDelaysMs = options.uploadRetryDelaysMs ?? DEFAULT_UPLOAD_RETRY_DELAYS_MS; const pendingUploads = new Map(); const activeBackgroundUploads = new Set>(); @@ -394,8 +401,8 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage let lastEmitAt = now(); emitUploadProgress(record); - try { - await executeDestinationUpload(dest, buffer, { + const upload = () => + executeDestinationUpload(dest, buffer, { ...ctxParams, onProgress: (sentBytes, totalBytes) => { const clamped = Math.max(0, Math.min(Math.trunc(sentBytes), totalBytes)); @@ -407,6 +414,31 @@ export function createBackupManager(options: BackupManagerOptions): BackupManage } }, }); + + try { + for (let attempt = 0; ; attempt++) { + try { + await upload(); + break; + } catch (err) { + const code = toStableBackupUploadErrorCode(err); + const delay = uploadRetryDelaysMs[attempt]; + if (!RETRYABLE_UPLOAD_CODES.has(code) || delay === undefined) { + throw err; + } + options.logger?.warn("Background backup upload failed, retrying", { + serverId: ctxParams.serverId, + backupId: ctxParams.backupId, + destination: dest.kind, + code, + attempt: attempt + 1, + retryInMs: delay, + }); + await new Promise((resolve) => setTimeout(resolve, delay)); + record.sent_bytes = 0; + emitUploadProgress(record); + } + } pendingUploads.delete(key); record.state = "done"; record.sent_bytes = record.total_bytes; diff --git a/src/server/java-and-loaders.test.ts b/src/server/java-and-loaders.test.ts index 5953504..0d986af 100644 --- a/src/server/java-and-loaders.test.ts +++ b/src/server/java-and-loaders.test.ts @@ -573,3 +573,23 @@ describe("installServerLoader", () => { }); }); }); + +describe("installerFailureHint", () => { + test("keeps the installer's own reason and skips stack frames", async () => { + const { installerFailureHint } = await import("./loaders"); + const hint = installerFailureHint({ + stdout: [ + "Downloading library from https://maven.example/x.jar", + "java.net.SocketTimeoutException: Connect timed out", + "\tat java.base/sun.net.www.http.HttpClient.openServer(Unknown Source)", + "Failed to download version manifest, can not find server jar URL.", + "There was an error during installation", + ].join("\n"), + stderr: "", + }); + expect(hint).toBe( + ": Failed to download version manifest, can not find server jar URL. | There was an error during installation", + ); + expect(installerFailureHint({ stdout: "", stderr: "" })).toBe(""); + }); +}); diff --git a/src/server/loaders.ts b/src/server/loaders.ts index c8cab6e..fea329b 100644 --- a/src/server/loaders.ts +++ b/src/server/loaders.ts @@ -510,7 +510,7 @@ async function installForge(options: InstallLoaderOptions): Promise line.trim()) + .filter((line) => line.length > 0 && !line.startsWith("at ")); + const reasons = lines.filter((line) => /error|fail|exception|timed out|refused/i.test(line)); + const picked = (reasons.length > 0 ? reasons : lines).slice(-2).join(" | "); + if (picked.length === 0) { + return ""; + } + let clean = ""; + for (const ch of picked) { + const code = ch.charCodeAt(0); + clean += code < 0x20 || code === 0x7f ? " " : ch; + } + return `: ${clean.length > 240 ? `${clean.slice(0, 240)}...` : clean}`; +} + export async function installServerLoader( options: InstallLoaderOptions, ): Promise { From 6d8b924de4fbbe5f90fa25f7b3c4d40cd11b936c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sat, 28 Nov 2026 19:36:26 -0300 Subject: [PATCH 46/59] feat(state): read the server mods folder into a Tegra mods manifest, toggle mods and change their version server.mods.list now lists what is really in mods/: mods Tegra recorded, jars put there by hand, disabled jars and recorded mods whose file is gone. Each jar's name, version, authors and loader come from fabric.mod.json, quilt.mod.json, mods.toml or mcmod.info and are cached in .tegra/mods-manifest.json, so only new or changed jars are opened, one at a time. server.mods.toggle renames a jar to .disabled and back. server.mods.replace downloads another version of a mod, keeps it disabled if it was, and keeps a modpack mod in the modpack layer so the next modpack update still lists it. --- src/protocol/commands/state.ts | 41 +++ src/protocol/errors.ts | 1 + src/protocol/index.ts | 6 + src/protocol/phase3.test.ts | 2 + src/state/manager.ts | 217 ++++++++++++++- src/state/mod-manifest.test.ts | 311 +++++++++++++++++++++ src/state/mod-manifest.ts | 496 +++++++++++++++++++++++++++++++++ src/state/state.test.ts | 33 ++- 8 files changed, 1095 insertions(+), 12 deletions(-) create mode 100644 src/state/mod-manifest.test.ts create mode 100644 src/state/mod-manifest.ts diff --git a/src/protocol/commands/state.ts b/src/protocol/commands/state.ts index 630560f..53e4ee4 100644 --- a/src/protocol/commands/state.ts +++ b/src/protocol/commands/state.ts @@ -182,6 +182,29 @@ export const serverModsRemoveBodySchema = z }) .strict(); +export const serverModsToggleBodySchema = z + .object({ + server_id: serverIdSchema, + file: modFileNameSchema, + enabled: z.boolean(), + }) + .strict(); + +export const serverModsReplaceBodySchema = z + .object({ + server_id: serverIdSchema, + old_file: modFileNameSchema, + file: modFileNameSchema, + url: z.string().url().max(2048), + source: modSourceSchema, + project_id: z.string().min(1).max(128).optional(), + version_id: z.string().min(1).max(128).optional(), + sha1: sha1HexSchema.optional(), + sha256: sha256HexSchema.optional(), + sha512: sha512HexSchema.optional(), + }) + .strict(); + export const serverOriginPlanBodySchema = z .object({ server_id: serverIdSchema, @@ -267,6 +290,8 @@ export const serverDeployServerpackBodySchema = z export type ServerModsListBody = z.infer; export type ServerModsInstallBody = z.infer; export type ServerModsRemoveBody = z.infer; +export type ServerModsToggleBody = z.infer; +export type ServerModsReplaceBody = z.infer; export type ServerOriginPlanBody = z.infer; export type ServerOriginApplyBody = z.infer; export type ServerOriginUnlinkBody = z.infer; @@ -293,6 +318,20 @@ export const serverModsRemoveCommand = defineCommand({ body: serverModsRemoveBodySchema, }); +export const serverModsToggleCommand = defineCommand({ + type: "server.mods.toggle", + level: "session", + minRole: "editor", + body: serverModsToggleBodySchema, +}); + +export const serverModsReplaceCommand = defineCommand({ + type: "server.mods.replace", + level: "session", + minRole: "editor", + body: serverModsReplaceBodySchema, +}); + export const serverOriginPlanCommand = defineCommand({ type: "server.origin.plan", level: "session", @@ -332,6 +371,8 @@ export const STATE_COMMANDS = [ serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, + serverModsToggleCommand, + serverModsReplaceCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, diff --git a/src/protocol/errors.ts b/src/protocol/errors.ts index febefe5..421e214 100644 --- a/src/protocol/errors.ts +++ b/src/protocol/errors.ts @@ -49,6 +49,7 @@ export type ProtocolErrorCode = | "plan_expired" | "plan_stale" | "mod_not_found" + | "mod_conflict" | "mod_already_exists" | "backup_not_found" | "backup_failed" diff --git a/src/protocol/index.ts b/src/protocol/index.ts index 5da98ff..0c8e1d0 100644 --- a/src/protocol/index.ts +++ b/src/protocol/index.ts @@ -257,6 +257,8 @@ export { type ServerModsInstallBody, type ServerModsListBody, type ServerModsRemoveBody, + type ServerModsReplaceBody, + type ServerModsToggleBody, type ServerOrigin, type ServerOriginApplyBody, type ServerOriginPlanBody, @@ -275,6 +277,10 @@ export { serverModsListCommand, serverModsRemoveBodySchema, serverModsRemoveCommand, + serverModsReplaceBodySchema, + serverModsReplaceCommand, + serverModsToggleBodySchema, + serverModsToggleCommand, serverOriginApplyBodySchema, serverOriginApplyCommand, serverOriginPlanBodySchema, diff --git a/src/protocol/phase3.test.ts b/src/protocol/phase3.test.ts index 428e4a1..a15e393 100644 --- a/src/protocol/phase3.test.ts +++ b/src/protocol/phase3.test.ts @@ -671,6 +671,8 @@ const MIN_ROLE: Record = { "server.console.send": "operator", "server.mods.install": "editor", "server.mods.remove": "editor", + "server.mods.toggle": "editor", + "server.mods.replace": "editor", "server.origin.plan": "editor", "server.origin.apply": "editor", "server.origin.unlink": "editor", diff --git a/src/state/manager.ts b/src/state/manager.ts index e5ad031..b25b0ab 100644 --- a/src/state/manager.ts +++ b/src/state/manager.ts @@ -30,6 +30,8 @@ import { type ServerModEntry, type ServerModsInstallBody, type ServerModsRemoveBody, + type ServerModsReplaceBody, + type ServerModsToggleBody, type ServerOrigin, type ServerOriginApplyBody, type ServerOriginPlanBody, @@ -38,6 +40,8 @@ import { serverDeployServerpackBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, + serverModsReplaceBodySchema, + serverModsToggleBodySchema, serverOriginApplyBodySchema, serverOriginPlanBodySchema, serverWorldImportBodySchema, @@ -59,6 +63,7 @@ import { downloadVerifiedBuffer, } from "./download"; import { assertVersionLoaderUnlocked, isVersionLoaderLocked } from "./lock"; +import { DISABLED_SUFFIX, type ServerModView, scanServerMods } from "./mod-manifest"; import { buildOriginSyncChanges, emptyOriginSyncState, @@ -106,7 +111,21 @@ export interface ModsListResult { readonly server_id: string; readonly origin: ServerOrigin; readonly version_loader_locked: boolean; - readonly mods: readonly ServerModEntry[]; + readonly mods: readonly ServerModView[]; +} + +export interface ModToggleResult { + readonly server_id: string; + readonly file: string; + readonly enabled: boolean; +} + +export interface ModReplaceResult { + readonly server_id: string; + readonly old_file: string; + readonly mod: ServerModEntry; + readonly enabled: boolean; + readonly bytes: number; } export interface ModInstallResult { @@ -178,9 +197,11 @@ interface StoredOriginPlan { } export interface StateManager { - listMods(serverId: string): ModsListResult; + listMods(serverId: string): Promise; installMod(params: ServerModsInstallBody): Promise; removeMod(params: ServerModsRemoveBody): ModRemoveResult; + toggleMod(params: ServerModsToggleBody): ModToggleResult; + replaceMod(params: ServerModsReplaceBody): Promise; unlinkOrigin(serverId: string): OriginUnlinkResult; updateVersionLoader(params: UpdateVersionLoaderParams): ServerMetadata; planOriginSync(params: ServerOriginPlanBody): OriginPlanResult; @@ -455,14 +476,176 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana } } - function listMods(serverId: string): ModsListResult { + async function listMods(serverId: string): Promise { const validId = assertValidServerId(serverId); const meta = readServerMetadata(serversDir, validId); + const mods = await scanServerMods({ + serversDir, + serverId: validId, + meta, + permissions: permissionContext, + ...(options.logger !== undefined ? { logger: options.logger } : {}), + now, + }); return { server_id: validId, origin: meta.origin ?? null, version_loader_locked: isVersionLoaderLocked(meta), - mods: meta.mods ?? [], + mods, + }; + } + + function modExists(serverId: string, relPath: string): boolean { + const resolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath, + allowRoot: false, + }); + return existsSync(resolved.fullPath); + } + + /** Where a recorded mod sits on disk: its own name, or the `.disabled` copy. */ + function locateModFile( + serverId: string, + file: string, + ): { readonly relPath: string; readonly enabled: boolean } | null { + const enabledPath = `${MODS_DIR}/${file}`; + if (modExists(serverId, enabledPath)) { + return { relPath: enabledPath, enabled: true }; + } + const disabledPath = `${MODS_DIR}/${file}${DISABLED_SUFFIX}`; + if (modExists(serverId, disabledPath)) { + return { relPath: disabledPath, enabled: false }; + } + return null; + } + + function toggleMod(params: ServerModsToggleBody): ModToggleResult { + const parsed = serverModsToggleBodySchema.safeParse(params); + if (!parsed.success) { + throw new ProtocolError("invalid_body", "Invalid server.mods.toggle parameters"); + } + const { server_id: serverId, enabled } = parsed.data; + const safeFile = validateSingleFileName(parsed.data.file); + const located = locateModFile(serverId, safeFile); + if (located === null) { + throw new ProtocolError("mod_not_found", `Mod "${safeFile}" not found on server ${serverId}`); + } + if (located.enabled !== enabled) { + const fromResolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: located.relPath, + allowRoot: false, + }); + const toResolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: enabled ? `${MODS_DIR}/${safeFile}` : `${MODS_DIR}/${safeFile}${DISABLED_SUFFIX}`, + allowRoot: false, + }); + if (lstatSync(fromResolved.fullPath).isSymbolicLink()) { + throw new FileManagerError("symlink_forbidden", `Refusing to rename symlink "${safeFile}"`); + } + if (existsSync(toResolved.fullPath)) { + throw new ProtocolError( + "mod_conflict", + `Both "${safeFile}" and its disabled copy exist on server ${serverId}`, + ); + } + renameSync(fromResolved.fullPath, toResolved.fullPath); + } + options.logger?.info("Toggled server mod", { serverId, file: safeFile, enabled }); + return { server_id: serverId, file: safeFile, enabled }; + } + + async function replaceMod(params: ServerModsReplaceBody): Promise { + const parsed = serverModsReplaceBodySchema.safeParse(params); + if (!parsed.success) { + throw new ProtocolError("invalid_body", "Invalid server.mods.replace parameters"); + } + const { + server_id: serverId, + url, + source, + project_id, + version_id, + sha1, + sha256, + sha512, + } = parsed.data; + const oldFile = validateSingleFileName(parsed.data.old_file); + const safeFile = validateSingleFileName(parsed.data.file); + const located = locateModFile(serverId, oldFile); + if (located === null) { + throw new ProtocolError("mod_not_found", `Mod "${oldFile}" not found on server ${serverId}`); + } + + const downloaded = await downloadVerifiedBuffer({ + url, + allowedHosts, + expectedHashes: { sha1, sha256, sha512 }, + maxBytes: maxModBytes, + ...(options.maxRedirects !== undefined ? { maxRedirects: options.maxRedirects } : {}), + ...(options.downloadTimeoutMs !== undefined ? { timeoutMs: options.downloadTimeoutMs } : {}), + ...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}), + }); + + // A disabled mod stays disabled after its version changes. + const targetRel = located.enabled + ? `${MODS_DIR}/${safeFile}` + : `${MODS_DIR}/${safeFile}${DISABLED_SUFFIX}`; + const targetResolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: targetRel, + allowRoot: false, + }); + writeConfinedFileAtomic(targetResolved, downloaded.data, { + createParents: true, + permissions: permissionContext, + }); + if (located.relPath !== targetRel) { + removeConfinedFileIfExists(serversDir, serverId, located.relPath); + } + + // Read after the download so the entry list is the current one. + const meta = readServerMetadata(serversDir, serverId); + const previous = (meta.mods ?? []).find((m) => m.file === oldFile); + const newEntry: ServerModEntry = { + file: safeFile, + source, + ...(project_id !== undefined ? { project_id } : {}), + ...(version_id !== undefined ? { version_id } : {}), + sha1: downloaded.sha1, + sha256: downloaded.sha256, + sha512: downloaded.sha512, + // A modpack mod keeps its layer, so the next modpack update still lists it. + layer: previous?.layer ?? "user", + }; + const keptMods = (meta.mods ?? []).filter((m) => m.file !== oldFile && m.file !== safeFile); + writeServerMetadata( + serversDir, + { + ...meta, + mods: [...keptMods, newEntry].sort((a, b) => a.file.localeCompare(b.file)), + }, + permissionContext, + ); + + options.logger?.info("Replaced server mod", { + serverId, + oldFile, + file: safeFile, + layer: newEntry.layer, + }); + return { + server_id: serverId, + old_file: oldFile, + mod: newEntry, + enabled: located.enabled, + bytes: downloaded.bytes, }; } @@ -543,11 +726,17 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana const existingMods = meta.mods ?? []; const targetEntry = existingMods.find((m) => m.file === safeFile); - const removedFromDisk = removeConfinedFileIfExists( + const removedEnabled = removeConfinedFileIfExists( serversDir, serverId, `${MODS_DIR}/${safeFile}`, ); + const removedDisabled = removeConfinedFileIfExists( + serversDir, + serverId, + `${MODS_DIR}/${safeFile}${DISABLED_SUFFIX}`, + ); + const removedFromDisk = removedEnabled || removedDisabled; if (!removedFromDisk && targetEntry === undefined) { throw new ProtocolError("mod_not_found", `Mod "${safeFile}" not found on server ${serverId}`); @@ -1254,6 +1443,8 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana listMods, installMod, removeMod, + toggleMod, + replaceMod, unlinkOrigin, updateVersionLoader, planOriginSync, @@ -1263,9 +1454,9 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana } export function registerStateHandlers(queue: CommandQueue, manager: StateManager): void { - queue.registerHandler("server.mods.list", (opened, ctx) => { + queue.registerHandler("server.mods.list", async (opened, ctx) => { const body = opened.body as { readonly server_id: string }; - const result = manager.listMods(body.server_id); + const result = await manager.listMods(body.server_id); ctx.sendEvent("server.mods.list.result", result); }); @@ -1281,6 +1472,18 @@ export function registerStateHandlers(queue: CommandQueue, manager: StateManager ctx.sendEvent("server.mods.removed", result); }); + queue.registerHandler("server.mods.toggle", (opened, ctx) => { + const body = opened.body as ServerModsToggleBody; + const result = manager.toggleMod(body); + ctx.sendEvent("server.mods.toggled", result); + }); + + queue.registerHandler("server.mods.replace", async (opened, ctx) => { + const body = opened.body as ServerModsReplaceBody; + const result = await manager.replaceMod(body); + ctx.sendEvent("server.mods.replaced", result); + }); + queue.registerHandler("server.origin.plan", (opened, ctx) => { const body = opened.body as ServerOriginPlanBody; const result = manager.planOriginSync(body); diff --git a/src/state/mod-manifest.test.ts b/src/state/mod-manifest.test.ts new file mode 100644 index 0000000..947d169 --- /dev/null +++ b/src/state/mod-manifest.test.ts @@ -0,0 +1,311 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, describe, expect, test } from "bun:test"; +import { createHash } from "node:crypto"; +import { + existsSync, + mkdirSync, + mkdtempSync, + readFileSync, + rmSync, + utimesSync, + writeFileSync, +} from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { createZipBuffer } from "../files"; +import type { FetchLike } from "../server/download"; +import { type ServerMetadata, writeServerMetadata } from "../server/registry"; +import { createStateManager } from "./manager"; +import { MODS_MANIFEST_PATH, parseModsToml, readJarMetadata } from "./mod-manifest"; + +const tempDirs: string[] = []; +const encode = (text: string) => new TextEncoder().encode(text); + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) { + rmSync(dir, { recursive: true, force: true }); + } + } +}); + +function makeServer(overrides: Partial = {}): string { + const serversDir = mkdtempSync(join(tmpdir(), "tegrad-mods-")); + tempDirs.push(serversDir); + mkdirSync(join(serversDir, "srv", "mods"), { recursive: true }); + writeServerMetadata(serversDir, { + v: 1, + id: "srv", + name: "Test", + minecraft_version: "1.21.1", + loader: "neoforge", + loader_version: "21.1.0", + memory_mb: 2048, + jvm_args: [], + port: 25565, + created_at: 1_700_000_000_000, + ...overrides, + }); + return serversDir; +} + +function fabricJar(id: string, version: string): Uint8Array { + return createZipBuffer([ + { + name: "fabric.mod.json", + data: encode( + JSON.stringify({ id, name: `${id} mod`, version, authors: ["Ana", { name: "Bia" }] }), + ), + }, + ]); +} + +const sha1 = (data: Uint8Array) => createHash("sha1").update(data).digest("hex"); +const sha256 = (data: Uint8Array) => createHash("sha256").update(data).digest("hex"); + +describe("jar metadata", () => { + test("reads fabric.mod.json", () => { + expect(readJarMetadata(fabricJar("sodium", "0.6.0"))).toEqual({ + mod_id: "sodium", + name: "sodium mod", + version: "0.6.0", + authors: ["Ana", "Bia"], + loader: "fabric", + }); + }); + + test("reads neoforge.mods.toml and takes a jarVersion placeholder from the manifest", () => { + const jar = createZipBuffer([ + { + name: "META-INF/neoforge.mods.toml", + data: encode( + [ + 'modLoader="javafml"', + "[[mods]]", + 'modId="create"', + 'version="$' + '{file.jarVersion}"', + 'displayName="Create"', + 'authors="simibubi, Tropheus Jay"', + "description='''", + "Building tools", + "and contraptions'''", + "[[dependencies.create]]", + 'modId="neoforge"', + ].join("\n"), + ), + }, + { + name: "META-INF/MANIFEST.MF", + data: encode("Manifest-Version: 1.0\r\nImplementation-Version: 6.0.4\r\n"), + }, + ]); + expect(readJarMetadata(jar)).toEqual({ + mod_id: "create", + name: "Create", + version: "6.0.4", + authors: ["simibubi", "Tropheus Jay"], + description: "Building tools and contraptions", + loader: "neoforge", + }); + }); + + test("keeps the first [[mods]] table only", () => { + expect(parseModsToml('[[mods]]\nmodId="a"\n[[mods]]\nmodId="b"\n').modId).toBe("a"); + }); + + test("a file that is not a zip has no metadata", () => { + expect(readJarMetadata(encode("not a jar"))).toEqual({}); + }); +}); + +describe("server mods list", () => { + test("shows recorded, hand-placed, disabled and missing mods and writes the manifest", async () => { + const serversDir = makeServer({ + mods: [ + { + file: "tracked.jar", + source: "modrinth", + project_id: "p1", + version_id: "v1", + layer: "origin", + }, + { file: "gone.jar", source: "curseforge", project_id: "2", layer: "user" }, + ], + }); + const mods = join(serversDir, "srv", "mods"); + writeFileSync(join(mods, "tracked.jar"), fabricJar("tracked", "1.0")); + writeFileSync(join(mods, "manual.jar.disabled"), fabricJar("manual", "2.0")); + writeFileSync(join(mods, "notes.txt"), "ignored"); + + const mgr = createStateManager({ serversDir }); + const list = await mgr.listMods("srv"); + const byFile = new Map(list.mods.map((m) => [m.file, m])); + + expect([...byFile.keys()]).toEqual(["gone.jar", "manual.jar", "tracked.jar"]); + expect(byFile.get("tracked.jar")).toMatchObject({ + layer: "origin", + project_id: "p1", + name: "tracked mod", + version: "1.0", + enabled: true, + present: true, + tracked: true, + }); + expect(byFile.get("manual.jar")).toMatchObject({ + source: "local", + layer: "user", + name: "manual mod", + enabled: false, + present: true, + tracked: false, + }); + expect(byFile.get("gone.jar")).toMatchObject({ present: false, tracked: true }); + + const manifest = JSON.parse(readFileSync(join(serversDir, "srv", MODS_MANIFEST_PATH), "utf8")); + expect(manifest.schema_version).toBe(1); + expect(manifest.mods.map((m: { disk_file: string }) => m.disk_file)).toEqual([ + "manual.jar.disabled", + "tracked.jar", + ]); + }); + + test("reuses the manifest for jars that did not change", async () => { + const serversDir = makeServer(); + const jarPath = join(serversDir, "srv", "mods", "a.jar"); + writeFileSync(jarPath, fabricJar("a", "1.0")); + const mgr = createStateManager({ serversDir }); + await mgr.listMods("srv"); + + // Same size and time, different content: the cached details stay. + const stamp = new Date(1_700_000_000_000); + utimesSync(jarPath, stamp, stamp); + await mgr.listMods("srv"); + writeFileSync(jarPath, fabricJar("b", "1.0")); + utimesSync(jarPath, stamp, stamp); + expect((await mgr.listMods("srv")).mods[0]?.mod_id).toBe("a"); + + utimesSync(jarPath, new Date(), new Date()); + expect((await mgr.listMods("srv")).mods[0]?.mod_id).toBe("b"); + }); +}); + +describe("server mods toggle and replace", () => { + function fetchFor(url: string, data: Uint8Array): FetchLike { + return async (input) => + (typeof input === "string" ? input : input.toString()) === url + ? new Response(data, { status: 200 }) + : new Response("Not Found", { status: 404 }); + } + + test("disables and enables a mod by renaming it", async () => { + const serversDir = makeServer(); + const mods = join(serversDir, "srv", "mods"); + writeFileSync(join(mods, "a.jar"), fabricJar("a", "1.0")); + const mgr = createStateManager({ serversDir }); + + expect(mgr.toggleMod({ server_id: "srv", file: "a.jar", enabled: false }).enabled).toBe(false); + expect(existsSync(join(mods, "a.jar"))).toBe(false); + expect(existsSync(join(mods, "a.jar.disabled"))).toBe(true); + + mgr.toggleMod({ server_id: "srv", file: "a.jar", enabled: true }); + expect(existsSync(join(mods, "a.jar"))).toBe(true); + + expect(() => mgr.toggleMod({ server_id: "srv", file: "missing.jar", enabled: true })).toThrow( + expect.objectContaining({ code: "mod_not_found" }), + ); + }); + + test("refuses to toggle when both copies exist", () => { + const serversDir = makeServer(); + const mods = join(serversDir, "srv", "mods"); + writeFileSync(join(mods, "a.jar"), "x"); + writeFileSync(join(mods, "a.jar.disabled"), "y"); + const mgr = createStateManager({ serversDir }); + expect(() => mgr.toggleMod({ server_id: "srv", file: "a.jar", enabled: false })).toThrow( + expect.objectContaining({ code: "mod_conflict" }), + ); + }); + + test("changes the version of a modpack mod, keeping its layer and its disabled state", async () => { + const serversDir = makeServer({ + origin: { kind: "modpack", source: "modrinth", modpack_id: "pack", version_id: "1" }, + mods: [ + { + file: "a-1.0.jar", + source: "modrinth", + project_id: "pa", + version_id: "v1", + layer: "origin", + }, + ], + }); + const mods = join(serversDir, "srv", "mods"); + writeFileSync(join(mods, "a-1.0.jar.disabled"), fabricJar("a", "1.0")); + const next = fabricJar("a", "2.0"); + const url = "https://cdn.modrinth.com/a-2.0.jar"; + const mgr = createStateManager({ serversDir, fetchImpl: fetchFor(url, next) }); + + const result = await mgr.replaceMod({ + server_id: "srv", + old_file: "a-1.0.jar", + file: "a-2.0.jar", + url, + source: "modrinth", + project_id: "pa", + version_id: "v2", + sha256: sha256(next), + }); + + expect(result.mod).toMatchObject({ + file: "a-2.0.jar", + version_id: "v2", + layer: "origin", + sha1: sha1(next), + }); + expect(result.enabled).toBe(false); + expect(existsSync(join(mods, "a-1.0.jar.disabled"))).toBe(false); + expect(existsSync(join(mods, "a-2.0.jar.disabled"))).toBe(true); + + const list = await mgr.listMods("srv"); + expect(list.mods).toHaveLength(1); + expect(list.mods[0]).toMatchObject({ file: "a-2.0.jar", version: "2.0", enabled: false }); + }); + + test("keeps the old file when the new download fails", async () => { + const serversDir = makeServer(); + const mods = join(serversDir, "srv", "mods"); + writeFileSync(join(mods, "a.jar"), "old"); + const mgr = createStateManager({ + serversDir, + fetchImpl: fetchFor("https://x.invalid/", encode("")), + }); + + await expect( + mgr.replaceMod({ + server_id: "srv", + old_file: "a.jar", + file: "b.jar", + url: "https://cdn.modrinth.com/b.jar", + source: "modrinth", + sha256: "0".repeat(64), + }), + ).rejects.toBeDefined(); + expect(readFileSync(join(mods, "a.jar"), "utf8")).toBe("old"); + expect(existsSync(join(mods, "b.jar"))).toBe(false); + }); + + test("removing a disabled mod deletes its disabled copy", async () => { + const serversDir = makeServer({ + mods: [{ file: "a.jar", source: "local", layer: "user" }], + }); + const mods = join(serversDir, "srv", "mods"); + writeFileSync(join(mods, "a.jar.disabled"), "x"); + const mgr = createStateManager({ serversDir }); + expect(mgr.removeMod({ server_id: "srv", file: "a.jar" }).removed).toBe(true); + expect(existsSync(join(mods, "a.jar.disabled"))).toBe(false); + expect((await mgr.listMods("srv")).mods).toEqual([]); + }); +}); diff --git a/src/state/mod-manifest.ts b/src/state/mod-manifest.ts new file mode 100644 index 0000000..e725883 --- /dev/null +++ b/src/state/mod-manifest.ts @@ -0,0 +1,496 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { createHash } from "node:crypto"; +import { existsSync, lstatSync, readdirSync, readFileSync } from "node:fs"; +import { z } from "zod"; +import type { Logger } from "../agent/logger"; +import { + listZipEntryNames, + readZipEntryFromBuffer, + resolveConfinedPath, + writeConfinedFileAtomic, +} from "../files"; +import type { ServerModEntry } from "../protocol"; +import type { PermissionContext } from "../server/permissions"; +import type { ServerMetadata } from "../server/registry"; + +/** The Tegra mods manifest of a server, kept next to the other Tegra files. */ +export const MODS_MANIFEST_PATH = ".tegra/mods-manifest.json"; +export const DISABLED_SUFFIX = ".disabled"; +const MODS_DIR = "mods"; +const MANIFEST_SCHEMA_VERSION = 1; +/** Jars bigger than this keep their file details but are not opened to read metadata. */ +const MAX_METADATA_JAR_BYTES = 256 * 1024 * 1024; + +export type ModLoaderKind = "fabric" | "quilt" | "forge" | "neoforge"; + +export interface JarMetadata { + readonly mod_id?: string; + readonly name?: string; + readonly version?: string; + readonly authors?: string[]; + readonly description?: string; + readonly loader?: ModLoaderKind; +} + +const manifestEntrySchema = z.object({ + disk_file: z.string().min(1).max(300), + size_bytes: z.number().int().nonnegative(), + mtime_ms: z.number().nonnegative(), + sha1: z.string().regex(/^[0-9a-f]{40}$/), + mod_id: z.string().max(128).optional(), + name: z.string().max(256).optional(), + version: z.string().max(128).optional(), + authors: z.array(z.string().max(128)).max(16).optional(), + description: z.string().max(512).optional(), + loader: z.enum(["fabric", "quilt", "forge", "neoforge"]).optional(), +}); + +const manifestSchema = z.object({ + schema_version: z.literal(MANIFEST_SCHEMA_VERSION), + updated_at: z.number(), + mods: z.array(manifestEntrySchema).max(4000), +}); + +type ManifestEntry = z.infer; + +/** A mod as the panel shows it: what Tegra recorded plus what is in the mods folder. */ +export interface ServerModView extends ServerModEntry { + /** False when the jar is renamed to `.disabled`, so the loader skips it. */ + readonly enabled: boolean; + /** False when Tegra recorded the mod but the file is no longer in the mods folder. */ + readonly present: boolean; + /** False for a jar someone put in the folder by hand. */ + readonly tracked: boolean; + readonly size_bytes?: number; + readonly mod_id?: string; + readonly name?: string; + readonly version?: string; + readonly authors?: string[]; + readonly description?: string; + readonly loader?: ModLoaderKind; +} + +function clip(value: unknown, max: number): string | undefined { + if (typeof value !== "string") { + return undefined; + } + let clean = ""; + for (const ch of value.trim()) { + const code = ch.charCodeAt(0); + clean += code < 0x20 || code === 0x7f ? " " : ch; + } + clean = clean.replace(/\s+/g, " ").trim(); + if (clean.length === 0) { + return undefined; + } + return clean.length > max ? clean.slice(0, max) : clean; +} + +function clipAuthors(values: readonly unknown[]): string[] | undefined { + const out: string[] = []; + for (const value of values) { + const name = + typeof value === "string" + ? clip(value, 128) + : value !== null && typeof value === "object" + ? clip((value as { name?: unknown }).name, 128) + : undefined; + if (name !== undefined && !out.includes(name)) { + out.push(name); + } + if (out.length >= 16) { + break; + } + } + return out.length > 0 ? out : undefined; +} + +function compact(meta: Record): JarMetadata { + const out: Record = {}; + for (const [key, value] of Object.entries(meta)) { + if (value !== undefined) { + out[key] = value; + } + } + return out as JarMetadata; +} + +function parseJson(bytes: Uint8Array | null): unknown { + if (bytes === null) { + return undefined; + } + try { + return JSON.parse(new TextDecoder().decode(bytes)); + } catch { + return undefined; + } +} + +/** Reads the first `[[mods]]` table of a Forge or NeoForge `mods.toml`, plus top-level keys. */ +export function parseModsToml(text: string): Record { + const top: Record = {}; + const mod: Record = {}; + let section: "top" | "mod" | "other" = "top"; + let seenMod = false; + const lines = text.split(/\r?\n/); + for (let i = 0; i < lines.length; i++) { + const line = (lines[i] ?? "").trim(); + if (line.length === 0 || line.startsWith("#")) { + continue; + } + if (line.startsWith("[")) { + if (line === "[[mods]]" && !seenMod) { + section = "mod"; + seenMod = true; + } else { + section = "other"; + } + continue; + } + const match = /^([A-Za-z0-9_]+)\s*=\s*(.*)$/.exec(line); + if (match === null) { + continue; + } + const key = match[1] ?? ""; + let raw = (match[2] ?? "").trim(); + let value: string | undefined; + const triple = raw.startsWith("'''") ? "'''" : raw.startsWith('"""') ? '"""' : null; + if (triple !== null) { + raw = raw.slice(3); + const parts: string[] = []; + let end = raw.indexOf(triple); + while (end < 0 && i + 1 < lines.length) { + parts.push(raw); + i++; + raw = lines[i] ?? ""; + end = raw.indexOf(triple); + } + parts.push(end >= 0 ? raw.slice(0, end) : raw); + value = parts.join("\n"); + } else if (raw.startsWith('"')) { + const end = raw.indexOf('"', 1); + value = end > 0 ? raw.slice(1, end) : undefined; + } else if (raw.startsWith("'")) { + const end = raw.indexOf("'", 1); + value = end > 0 ? raw.slice(1, end) : undefined; + } + if (value === undefined) { + continue; + } + if (section === "mod" && !(key in mod)) { + mod[key] = value; + } else if (section === "top" && !(key in top)) { + top[key] = value; + } + } + return { ...top, ...mod }; +} + +function manifestVersion(bytes: Uint8Array | null): string | undefined { + if (bytes === null) { + return undefined; + } + const text = new TextDecoder().decode(bytes); + const match = /^Implementation-Version:\s*(.+)$/im.exec(text); + return match ? clip(match[1], 128) : undefined; +} + +/** Name, version and authors a mod declares inside its jar, for every loader Tegra supports. */ +export function readJarMetadata(buffer: Uint8Array): JarMetadata { + let names: Set; + try { + names = new Set(listZipEntryNames(buffer)); + } catch { + return {}; + } + const read = (entryName: string): Uint8Array | null => { + if (!names.has(entryName)) { + return null; + } + try { + return readZipEntryFromBuffer({ buffer, entryName, maxEntryBytes: 4 * 1024 * 1024 }); + } catch { + return null; + } + }; + + const fabric = parseJson(read("fabric.mod.json")) as Record | undefined; + if (fabric && typeof fabric === "object") { + return compact({ + mod_id: clip(fabric.id, 128), + name: clip(fabric.name, 256), + version: clip(fabric.version, 128), + authors: Array.isArray(fabric.authors) ? clipAuthors(fabric.authors) : undefined, + description: clip(fabric.description, 512), + loader: "fabric", + }); + } + + const quilt = parseJson(read("quilt.mod.json")) as + | { quilt_loader?: Record } + | undefined; + if (quilt?.quilt_loader && typeof quilt.quilt_loader === "object") { + const loader = quilt.quilt_loader; + const metadata = (loader.metadata ?? {}) as Record; + const contributors = + metadata.contributors && typeof metadata.contributors === "object" + ? Object.keys(metadata.contributors as object) + : []; + return compact({ + mod_id: clip(loader.id, 128), + name: clip(metadata.name, 256), + version: clip(loader.version, 128), + authors: clipAuthors(contributors), + description: clip(metadata.description, 512), + loader: "quilt", + }); + } + + for (const [entry, loader] of [ + ["META-INF/neoforge.mods.toml", "neoforge"], + ["META-INF/mods.toml", "forge"], + ] as const) { + const bytes = read(entry); + if (bytes === null) { + continue; + } + const toml = parseModsToml(new TextDecoder().decode(bytes)); + let version = toml.version; + if (version === undefined || version.includes("${")) { + version = manifestVersion(read("META-INF/MANIFEST.MF")); + } + return compact({ + mod_id: clip(toml.modId, 128), + name: clip(toml.displayName, 256), + version: clip(version, 128), + authors: toml.authors !== undefined ? clipAuthors(toml.authors.split(/,\s*/)) : undefined, + description: clip(toml.description, 512), + loader, + }); + } + + const legacy = parseJson(read("mcmod.info")); + const first = ( + Array.isArray(legacy) + ? legacy[0] + : (legacy as { modList?: unknown[] } | undefined)?.modList?.[0] + ) as Record | undefined; + if (first && typeof first === "object") { + return compact({ + mod_id: clip(first.modid, 128), + name: clip(first.name, 256), + version: clip(first.version, 128), + authors: Array.isArray(first.authorList) ? clipAuthors(first.authorList) : undefined, + description: clip(first.description, 512), + loader: "forge", + }); + } + return {}; +} + +/** The name Tegra records for a jar, without the `.disabled` suffix. */ +export function baseModFileName(diskName: string): string { + return diskName.toLowerCase().endsWith(DISABLED_SUFFIX) + ? diskName.slice(0, -DISABLED_SUFFIX.length) + : diskName; +} + +function isModFile(name: string): boolean { + const lower = name.toLowerCase(); + return lower.endsWith(".jar") || lower.endsWith(`.jar${DISABLED_SUFFIX}`); +} + +function readManifest(serversDir: string, serverId: string): Map { + try { + const resolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: MODS_MANIFEST_PATH, + }); + if (!existsSync(resolved.fullPath)) { + return new Map(); + } + const parsed = manifestSchema.safeParse(JSON.parse(readFileSync(resolved.fullPath, "utf8"))); + if (!parsed.success) { + return new Map(); + } + return new Map(parsed.data.mods.map((entry) => [entry.disk_file, entry])); + } catch { + return new Map(); + } +} + +function writeManifest( + serversDir: string, + serverId: string, + entries: readonly ManifestEntry[], + now: number, + permissions: PermissionContext | undefined, +): void { + const resolved = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: MODS_MANIFEST_PATH, + }); + const body = { + schema_version: MANIFEST_SCHEMA_VERSION, + updated_at: now, + mods: [...entries].sort((a, b) => a.disk_file.localeCompare(b.disk_file)), + }; + writeConfinedFileAtomic( + resolved, + new TextEncoder().encode(`${JSON.stringify(body, null, 2)}\n`), + { + createParents: true, + ...(permissions !== undefined ? { permissions } : {}), + }, + ); +} + +function yieldToEventLoop(): Promise { + return new Promise((resolve) => setImmediate(resolve)); +} + +export interface ScanServerModsOptions { + readonly serversDir: string; + readonly serverId: string; + readonly meta: ServerMetadata; + readonly permissions?: PermissionContext; + readonly logger?: Logger; + readonly now?: () => number; +} + +/** + * Lists the mods folder against what Tegra recorded and refreshes the mods manifest. Jars are + * opened only when they are new or changed since the last scan, one at a time with a pause in + * between, so a big modpack does not hold the agent while it is read. + */ +export async function scanServerMods(options: ScanServerModsOptions): Promise { + const { serversDir, serverId, meta } = options; + const recorded = meta.mods ?? []; + const modsDir = resolveConfinedPath({ + serversBaseDir: serversDir, + serverId, + relPath: MODS_DIR, + }); + + const diskNames: string[] = []; + if (existsSync(modsDir.fullPath)) { + for (const entry of readdirSync(modsDir.fullPath, { withFileTypes: true })) { + if (entry.isFile() && isModFile(entry.name)) { + diskNames.push(entry.name); + } + } + } + diskNames.sort((a, b) => a.localeCompare(b)); + + const cached = readManifest(serversDir, serverId); + const fresh: ManifestEntry[] = []; + let changed = cached.size !== diskNames.length; + + for (const diskName of diskNames) { + const fullPath = `${modsDir.fullPath}/${diskName}`; + let stats: ReturnType; + try { + stats = lstatSync(fullPath); + } catch { + continue; + } + if (!stats.isFile() || stats.isSymbolicLink()) { + continue; + } + const previous = cached.get(diskName); + if ( + previous !== undefined && + previous.size_bytes === stats.size && + previous.mtime_ms === Math.floor(stats.mtimeMs) + ) { + fresh.push(previous); + continue; + } + changed = true; + await yieldToEventLoop(); + let entry: ManifestEntry; + try { + const data = new Uint8Array(await Bun.file(fullPath).arrayBuffer()); + const metadata = stats.size <= MAX_METADATA_JAR_BYTES ? readJarMetadata(data) : {}; + entry = { + disk_file: diskName, + size_bytes: stats.size, + mtime_ms: Math.floor(stats.mtimeMs), + sha1: createHash("sha1").update(data).digest("hex"), + ...metadata, + }; + } catch (err) { + options.logger?.warn("Could not read a server mod", { + serverId, + file: diskName, + error: err instanceof Error ? err.message : String(err), + }); + continue; + } + fresh.push(entry); + } + + if (changed) { + try { + writeManifest(serversDir, serverId, fresh, (options.now ?? Date.now)(), options.permissions); + } catch (err) { + options.logger?.warn("Could not save the server mods manifest", { + serverId, + error: err instanceof Error ? err.message : String(err), + }); + } + } + + const byBase = new Map(); + for (const entry of fresh) { + const base = baseModFileName(entry.disk_file); + const existing = byBase.get(base); + // When both `x.jar` and `x.jar.disabled` exist, the enabled one is what the loader reads. + if (existing === undefined || existing.disk_file.endsWith(DISABLED_SUFFIX)) { + byBase.set(base, entry); + } + } + + const describe = (entry: ManifestEntry | undefined) => { + if (entry === undefined) { + return {}; + } + const { disk_file: _disk, mtime_ms: _mtime, sha1: _sha1, ...rest } = entry; + return rest; + }; + + const views: ServerModView[] = []; + const seen = new Set(); + for (const mod of recorded) { + const disk = byBase.get(mod.file); + seen.add(mod.file); + views.push({ + ...mod, + ...describe(disk), + ...(mod.sha1 === undefined && disk !== undefined ? { sha1: disk.sha1 } : {}), + enabled: disk === undefined || !disk.disk_file.endsWith(DISABLED_SUFFIX), + present: disk !== undefined, + tracked: true, + }); + } + for (const [base, disk] of byBase) { + if (seen.has(base)) { + continue; + } + views.push({ + file: base, + source: "local", + layer: "user", + sha1: disk.sha1, + ...describe(disk), + enabled: !disk.disk_file.endsWith(DISABLED_SUFFIX), + present: true, + tracked: false, + }); + } + return views.sort((a, b) => a.file.localeCompare(b.file)); +} diff --git a/src/state/state.test.ts b/src/state/state.test.ts index 1dd51bc..df11a6e 100644 --- a/src/state/state.test.ts +++ b/src/state/state.test.ts @@ -107,7 +107,7 @@ afterEach(() => { }); describe("metadata backwards compatibility and config cdn_host", () => { - test("reads legacy v1 tegrad-server.json without mods/origin/origin_sync", () => { + test("reads legacy v1 tegrad-server.json without mods/origin/origin_sync", async () => { const serversDir = makeTempDir("tegrad-state-compat-"); const serverDir = join(serversDir, "legacy-1"); mkdirSync(serverDir, { recursive: true }); @@ -134,7 +134,7 @@ describe("metadata backwards compatibility and config cdn_host", () => { expect(isVersionLoaderLocked(meta)).toBe(false); const mgr = createStateManager({ serversDir }); - const list = mgr.listMods("legacy-1"); + const list = await mgr.listMods("legacy-1"); expect(list.mods).toEqual([]); expect(list.origin).toBeNull(); expect(list.version_loader_locked).toBe(false); @@ -390,7 +390,7 @@ describe("StateManager: mods, version/loader lock, origin sync, and server pack Buffer.from(modBytes), ); - const listed = mgr.listMods("srv-1"); + const listed = await mgr.listMods("srv-1"); expect(listed.mods.length).toBe(1); expect(listed.mods[0]?.file).toBe("fabric-api.jar"); @@ -400,7 +400,7 @@ describe("StateManager: mods, version/loader lock, origin sync, and server pack expect(existsSync(join(serversDir, "srv-1", "mods", "fabric-api.jar"))).toBe(false); }); - test("version/loader lock enforced when linked to modpack and unlocked by server.origin.unlink", () => { + test("version/loader lock enforced when linked to modpack and unlocked by server.origin.unlink", async () => { const serversDir = makeTempDir("tegrad-state-lock-"); createTestServer(serversDir, "srv-lock", { origin: { @@ -420,7 +420,7 @@ describe("StateManager: mods, version/loader lock, origin sync, and server pack }); const mgr = createStateManager({ serversDir }); - expect(mgr.listMods("srv-lock").version_loader_locked).toBe(true); + expect((await mgr.listMods("srv-lock")).version_loader_locked).toBe(true); expect(() => mgr.updateVersionLoader({ @@ -854,6 +854,29 @@ describe("state commands protocol & runtime wiring", () => { exercised.add("server.mods.install"); expect(installRes.ack?.body.ok).toBe(true); + const toggleRes = await send( + "server.mods.toggle", + { server_id: "srv-rt", file: "m.jar", enabled: false }, + true, + ); + exercised.add("server.mods.toggle"); + expect(toggleRes.ack?.body.ok).toBe(true); + + const replaceRes = await send( + "server.mods.replace", + { + server_id: "srv-rt", + old_file: "m.jar", + file: "m.jar", + url: "https://cdn.modrinth.com/m.jar", + source: "modrinth", + sha256: sha256Hex(modBytes), + }, + true, + ); + exercised.add("server.mods.replace"); + expect(replaceRes.ack?.body.ok).toBe(true); + const removeRes = await send( "server.mods.remove", { server_id: "srv-rt", file: "m.jar" }, From 3dbddb3e75fdbed0888a00b0b0c3c437bd9bdcde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sat, 28 Nov 2026 19:48:52 -0300 Subject: [PATCH 47/59] fix(state): read mod metadata from real jars Jars built by Gradle carry directory entries with a size, which the extraction parser rightly refuses, so no metadata was found. Metadata now comes from a small in-memory reader with capped reads that writes nothing to disk. A [[mods]] header followed by a comment is now recognized too. --- src/state/jar-reader.ts | 112 +++++++++++++++++++++++++++++++++ src/state/mod-manifest.test.ts | 32 ++++++++++ src/state/mod-manifest.ts | 28 +++------ 3 files changed, 151 insertions(+), 21 deletions(-) create mode 100644 src/state/jar-reader.ts diff --git a/src/state/jar-reader.ts b/src/state/jar-reader.ts new file mode 100644 index 0000000..1ca89fa --- /dev/null +++ b/src/state/jar-reader.ts @@ -0,0 +1,112 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { inflateRawSync } from "node:zlib"; + +/** + * Reads a few small files out of a jar held in memory. Nothing is written to disk, so this + * accepts the quirks real jars have (directory entries with a size, extra data after the + * archive) that the extraction code rightly refuses. Every read is capped. + */ +export interface JarReader { + has(name: string): boolean; + read(name: string): Uint8Array | null; +} + +const EOCD_SIGNATURE = 0x06054b50; +const CENTRAL_SIGNATURE = 0x02014b50; +const LOCAL_SIGNATURE = 0x04034b50; +const MAX_COMMENT_BYTES = 0xffff; +const MAX_ENTRIES = 100_000; + +interface Entry { + readonly method: number; + readonly compressedSize: number; + readonly uncompressedSize: number; + readonly localOffset: number; +} + +function findEndOfCentralDirectory(view: DataView): number { + const min = Math.max(0, view.byteLength - 22 - MAX_COMMENT_BYTES); + for (let at = view.byteLength - 22; at >= min; at--) { + if (view.getUint32(at, true) === EOCD_SIGNATURE) { + return at; + } + } + return -1; +} + +export function openJar(buffer: Uint8Array, maxEntryBytes = 4 * 1024 * 1024): JarReader | null { + if (buffer.byteLength < 22) { + return null; + } + const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength); + const eocd = findEndOfCentralDirectory(view); + if (eocd < 0) { + return null; + } + const count = view.getUint16(eocd + 10, true); + const cdSize = view.getUint32(eocd + 12, true); + const cdOffset = view.getUint32(eocd + 16, true); + if (count > MAX_ENTRIES || cdOffset + cdSize > buffer.byteLength) { + return null; + } + + const decoder = new TextDecoder(); + const entries = new Map(); + let at = cdOffset; + for (let i = 0; i < count; i++) { + if (at + 46 > buffer.byteLength || view.getUint32(at, true) !== CENTRAL_SIGNATURE) { + break; + } + const method = view.getUint16(at + 10, true); + const compressedSize = view.getUint32(at + 20, true); + const uncompressedSize = view.getUint32(at + 24, true); + const nameLength = view.getUint16(at + 28, true); + const extraLength = view.getUint16(at + 30, true); + const commentLength = view.getUint16(at + 32, true); + const localOffset = view.getUint32(at + 42, true); + const nameEnd = at + 46 + nameLength; + if (nameEnd > buffer.byteLength) { + break; + } + const name = decoder.decode(buffer.subarray(at + 46, nameEnd)); + if (!name.endsWith("/") && !entries.has(name)) { + entries.set(name, { method, compressedSize, uncompressedSize, localOffset }); + } + at = nameEnd + extraLength + commentLength; + } + + return { + has: (name) => entries.has(name), + read(name) { + const entry = entries.get(name); + if (entry === undefined || entry.uncompressedSize > maxEntryBytes) { + return null; + } + const local = entry.localOffset; + if (local + 30 > buffer.byteLength || view.getUint32(local, true) !== LOCAL_SIGNATURE) { + return null; + } + const start = + local + 30 + view.getUint16(local + 26, true) + view.getUint16(local + 28, true); + const end = start + entry.compressedSize; + if (end > buffer.byteLength) { + return null; + } + const raw = buffer.subarray(start, end); + try { + if (entry.method === 0) { + return raw.byteLength <= maxEntryBytes ? raw : null; + } + if (entry.method === 8) { + const out = inflateRawSync(raw, { maxOutputLength: maxEntryBytes }); + return new Uint8Array(out.buffer, out.byteOffset, out.byteLength); + } + } catch { + return null; + } + return null; + }, + }; +} diff --git a/src/state/mod-manifest.test.ts b/src/state/mod-manifest.test.ts index 947d169..f0fc279 100644 --- a/src/state/mod-manifest.test.ts +++ b/src/state/mod-manifest.test.ts @@ -112,6 +112,38 @@ describe("jar metadata", () => { }); }); + test("reads a [[mods]] header followed by a comment", () => { + const toml = [ + 'modLoader="javafml" #mandatory', + "[[mods]] #mandatory", + 'modId="cleanswing" #mandatory', + ]; + expect(parseModsToml(toml.join("\n")).modId).toBe("cleanswing"); + }); + + test("reads a real jar with directory entries that have a size", () => { + const jar = createZipBuffer([ + { name: "META-INF/", data: new Uint8Array() }, + { + name: "META-INF/neoforge.mods.toml", + data: encode(["[[mods]]", 'modId="clumps"', 'version="19.0.0.1"'].join("\n")), + }, + ]); + // Same quirk as jars built by Gradle: the directory entry claims two compressed bytes. + const view = new DataView(jar.buffer, jar.byteOffset, jar.byteLength); + for (let at = jar.byteLength - 22; at >= 0; at--) { + if ( + view.getUint32(at, true) === 0x02014b50 && + view.getUint16(at + 28, true) === 9 && + new TextDecoder().decode(jar.subarray(at + 46, at + 46 + 9)) === "META-INF/" + ) { + view.setUint32(at + 20, 2, true); + break; + } + } + expect(readJarMetadata(jar)).toMatchObject({ mod_id: "clumps", version: "19.0.0.1" }); + }); + test("keeps the first [[mods]] table only", () => { expect(parseModsToml('[[mods]]\nmodId="a"\n[[mods]]\nmodId="b"\n').modId).toBe("a"); }); diff --git a/src/state/mod-manifest.ts b/src/state/mod-manifest.ts index e725883..c822526 100644 --- a/src/state/mod-manifest.ts +++ b/src/state/mod-manifest.ts @@ -5,15 +5,11 @@ import { createHash } from "node:crypto"; import { existsSync, lstatSync, readdirSync, readFileSync } from "node:fs"; import { z } from "zod"; import type { Logger } from "../agent/logger"; -import { - listZipEntryNames, - readZipEntryFromBuffer, - resolveConfinedPath, - writeConfinedFileAtomic, -} from "../files"; +import { resolveConfinedPath, writeConfinedFileAtomic } from "../files"; import type { ServerModEntry } from "../protocol"; import type { PermissionContext } from "../server/permissions"; import type { ServerMetadata } from "../server/registry"; +import { openJar } from "./jar-reader"; /** The Tegra mods manifest of a server, kept next to the other Tegra files. */ export const MODS_MANIFEST_PATH = ".tegra/mods-manifest.json"; @@ -141,7 +137,8 @@ export function parseModsToml(text: string): Record { continue; } if (line.startsWith("[")) { - if (line === "[[mods]]" && !seenMod) { + const header = line.replace(/\s*#.*$/, "").replace(/\s+/g, ""); + if (header === "[[mods]]" && !seenMod) { section = "mod"; seenMod = true; } else { @@ -199,22 +196,11 @@ function manifestVersion(bytes: Uint8Array | null): string | undefined { /** Name, version and authors a mod declares inside its jar, for every loader Tegra supports. */ export function readJarMetadata(buffer: Uint8Array): JarMetadata { - let names: Set; - try { - names = new Set(listZipEntryNames(buffer)); - } catch { + const jar = openJar(buffer); + if (jar === null) { return {}; } - const read = (entryName: string): Uint8Array | null => { - if (!names.has(entryName)) { - return null; - } - try { - return readZipEntryFromBuffer({ buffer, entryName, maxEntryBytes: 4 * 1024 * 1024 }); - } catch { - return null; - } - }; + const read = (entryName: string): Uint8Array | null => jar.read(entryName); const fabric = parseJson(read("fabric.mod.json")) as Record | undefined; if (fabric && typeof fabric === "object") { From d3c93700e117f97f6f74e1233d60e85dc3ef4258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sat, 28 Nov 2026 20:34:51 -0300 Subject: [PATCH 48/59] feat(state): identify server mods by hash and record their project The mods manifest now keeps each jar's CurseForge fingerprint next to its SHA-1, so mods with no project recorded (server pack contents, jars added by hand) can be looked up on CurseForge and Modrinth. server.mods.identify records the project and version found for them; a project already recorded is never replaced. --- src/protocol/commands/state.ts | 28 +++++++++++++++ src/protocol/index.ts | 3 ++ src/protocol/phase3.test.ts | 1 + src/state/manager.ts | 61 ++++++++++++++++++++++++++++++++ src/state/mod-manifest.test.ts | 64 +++++++++++++++++++++++++++++++++- src/state/mod-manifest.ts | 47 ++++++++++++++++++++++++- src/state/state.test.ts | 8 +++++ 7 files changed, 210 insertions(+), 2 deletions(-) diff --git a/src/protocol/commands/state.ts b/src/protocol/commands/state.ts index 53e4ee4..a24ba2e 100644 --- a/src/protocol/commands/state.ts +++ b/src/protocol/commands/state.ts @@ -205,6 +205,25 @@ export const serverModsReplaceBodySchema = z }) .strict(); +export const serverModsIdentifyBodySchema = z + .object({ + server_id: serverIdSchema, + mods: z + .array( + z + .object({ + file: modFileNameSchema, + source: z.enum(["modrinth", "curseforge", "tegra"]), + project_id: z.string().min(1).max(128), + version_id: z.string().min(1).max(128).optional(), + }) + .strict(), + ) + .min(1) + .max(4000), + }) + .strict(); + export const serverOriginPlanBodySchema = z .object({ server_id: serverIdSchema, @@ -292,6 +311,7 @@ export type ServerModsInstallBody = z.infer; export type ServerModsRemoveBody = z.infer; export type ServerModsToggleBody = z.infer; export type ServerModsReplaceBody = z.infer; +export type ServerModsIdentifyBody = z.infer; export type ServerOriginPlanBody = z.infer; export type ServerOriginApplyBody = z.infer; export type ServerOriginUnlinkBody = z.infer; @@ -332,6 +352,13 @@ export const serverModsReplaceCommand = defineCommand({ body: serverModsReplaceBodySchema, }); +export const serverModsIdentifyCommand = defineCommand({ + type: "server.mods.identify", + level: "session", + minRole: "editor", + body: serverModsIdentifyBodySchema, +}); + export const serverOriginPlanCommand = defineCommand({ type: "server.origin.plan", level: "session", @@ -373,6 +400,7 @@ export const STATE_COMMANDS = [ serverModsRemoveCommand, serverModsToggleCommand, serverModsReplaceCommand, + serverModsIdentifyCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, diff --git a/src/protocol/index.ts b/src/protocol/index.ts index 0c8e1d0..1984d62 100644 --- a/src/protocol/index.ts +++ b/src/protocol/index.ts @@ -254,6 +254,7 @@ export { registerStateCommands, type ServerDeployServerpackBody, type ServerModEntry, + type ServerModsIdentifyBody, type ServerModsInstallBody, type ServerModsListBody, type ServerModsRemoveBody, @@ -271,6 +272,8 @@ export { serverDeployServerpackBodySchema, serverDeployServerpackCommand, serverModEntrySchema, + serverModsIdentifyBodySchema, + serverModsIdentifyCommand, serverModsInstallBodySchema, serverModsInstallCommand, serverModsListBodySchema, diff --git a/src/protocol/phase3.test.ts b/src/protocol/phase3.test.ts index a15e393..f6f2332 100644 --- a/src/protocol/phase3.test.ts +++ b/src/protocol/phase3.test.ts @@ -673,6 +673,7 @@ const MIN_ROLE: Record = { "server.mods.remove": "editor", "server.mods.toggle": "editor", "server.mods.replace": "editor", + "server.mods.identify": "editor", "server.origin.plan": "editor", "server.origin.apply": "editor", "server.origin.unlink": "editor", diff --git a/src/state/manager.ts b/src/state/manager.ts index b25b0ab..0bdb91e 100644 --- a/src/state/manager.ts +++ b/src/state/manager.ts @@ -28,6 +28,7 @@ import { type ServerDeployServerpackBody, type ServerLoader, type ServerModEntry, + type ServerModsIdentifyBody, type ServerModsInstallBody, type ServerModsRemoveBody, type ServerModsReplaceBody, @@ -38,6 +39,7 @@ import { type ServerOriginSyncState, type ServerWorldImportBody, serverDeployServerpackBodySchema, + serverModsIdentifyBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverModsReplaceBodySchema, @@ -128,6 +130,11 @@ export interface ModReplaceResult { readonly bytes: number; } +export interface ModIdentifyResult { + readonly server_id: string; + readonly updated: number; +} + export interface ModInstallResult { readonly server_id: string; readonly mod: ServerModEntry; @@ -202,6 +209,7 @@ export interface StateManager { removeMod(params: ServerModsRemoveBody): ModRemoveResult; toggleMod(params: ServerModsToggleBody): ModToggleResult; replaceMod(params: ServerModsReplaceBody): Promise; + identifyMods(params: ServerModsIdentifyBody): ModIdentifyResult; unlinkOrigin(serverId: string): OriginUnlinkResult; updateVersionLoader(params: UpdateVersionLoaderParams): ServerMetadata; planOriginSync(params: ServerOriginPlanBody): OriginPlanResult; @@ -560,6 +568,52 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana return { server_id: serverId, file: safeFile, enabled }; } + /** + * Records which project a mod comes from, for mods Tegra could not tell yet (server pack + * contents, jars put in the folder by hand). A project already recorded is never replaced. + */ + function identifyMods(params: ServerModsIdentifyBody): ModIdentifyResult { + const parsed = serverModsIdentifyBodySchema.safeParse(params); + if (!parsed.success) { + throw new ProtocolError("invalid_body", "Invalid server.mods.identify parameters"); + } + const serverId = parsed.data.server_id; + const meta = readServerMetadata(serversDir, serverId); + const byFile = new Map((meta.mods ?? []).map((mod) => [mod.file, mod])); + let updated = 0; + for (const item of parsed.data.mods) { + const file = validateSingleFileName(item.file); + const link = { + source: item.source, + project_id: item.project_id, + ...(item.version_id !== undefined ? { version_id: item.version_id } : {}), + }; + const existing = byFile.get(file); + if (existing !== undefined) { + if (existing.project_id !== undefined) { + continue; + } + byFile.set(file, { ...existing, ...link }); + updated++; + continue; + } + if (locateModFile(serverId, file) === null) { + continue; + } + byFile.set(file, { file, ...link, layer: "user" }); + updated++; + } + if (updated > 0) { + writeServerMetadata( + serversDir, + { ...meta, mods: [...byFile.values()].sort((a, b) => a.file.localeCompare(b.file)) }, + permissionContext, + ); + options.logger?.info("Identified server mods", { serverId, updated }); + } + return { server_id: serverId, updated }; + } + async function replaceMod(params: ServerModsReplaceBody): Promise { const parsed = serverModsReplaceBodySchema.safeParse(params); if (!parsed.success) { @@ -1445,6 +1499,7 @@ export function createStateManager(options: StateManagerOptions = {}): StateMana removeMod, toggleMod, replaceMod, + identifyMods, unlinkOrigin, updateVersionLoader, planOriginSync, @@ -1478,6 +1533,12 @@ export function registerStateHandlers(queue: CommandQueue, manager: StateManager ctx.sendEvent("server.mods.toggled", result); }); + queue.registerHandler("server.mods.identify", (opened, ctx) => { + const body = opened.body as ServerModsIdentifyBody; + const result = manager.identifyMods(body); + ctx.sendEvent("server.mods.identified", result); + }); + queue.registerHandler("server.mods.replace", async (opened, ctx) => { const body = opened.body as ServerModsReplaceBody; const result = await manager.replaceMod(body); diff --git a/src/state/mod-manifest.test.ts b/src/state/mod-manifest.test.ts index f0fc279..7d31130 100644 --- a/src/state/mod-manifest.test.ts +++ b/src/state/mod-manifest.test.ts @@ -18,7 +18,12 @@ import { createZipBuffer } from "../files"; import type { FetchLike } from "../server/download"; import { type ServerMetadata, writeServerMetadata } from "../server/registry"; import { createStateManager } from "./manager"; -import { MODS_MANIFEST_PATH, parseModsToml, readJarMetadata } from "./mod-manifest"; +import { + curseforgeFingerprint, + MODS_MANIFEST_PATH, + parseModsToml, + readJarMetadata, +} from "./mod-manifest"; const tempDirs: string[] = []; const encode = (text: string) => new TextEncoder().encode(text); @@ -341,3 +346,60 @@ describe("server mods toggle and replace", () => { expect((await mgr.listMods("srv")).mods).toEqual([]); }); }); + +describe("curseforge fingerprint", () => { + test("leaves whitespace bytes out", () => { + expect(curseforgeFingerprint(encode("a b\tc\r\nd"))).toBe( + curseforgeFingerprint(encode("abcd")), + ); + }); + + test("covers every tail length", () => { + const seen = new Set( + ["", "a", "ab", "abc", "abcd", "abcde"].map((s) => curseforgeFingerprint(encode(s))), + ); + expect(seen.size).toBe(6); + }); +}); + +describe("server mods identify", () => { + test("links mods with no project and keeps projects already recorded", async () => { + const serversDir = makeServer({ + mods: [ + { file: "pack.jar", source: "curseforge", layer: "origin" }, + { file: "known.jar", source: "modrinth", project_id: "keep", layer: "user" }, + ], + }); + const mods = join(serversDir, "srv", "mods"); + writeFileSync(join(mods, "pack.jar"), "a"); + writeFileSync(join(mods, "known.jar"), "b"); + writeFileSync(join(mods, "hand.jar.disabled"), "c"); + const mgr = createStateManager({ serversDir }); + + const result = mgr.identifyMods({ + server_id: "srv", + mods: [ + { file: "pack.jar", source: "curseforge", project_id: "238222", version_id: "5101366" }, + { file: "known.jar", source: "modrinth", project_id: "other" }, + { file: "hand.jar", source: "modrinth", project_id: "P7dR8mSH", version_id: "v9" }, + { file: "ghost.jar", source: "modrinth", project_id: "x" }, + ], + }); + expect(result.updated).toBe(2); + + const byFile = new Map((await mgr.listMods("srv")).mods.map((m) => [m.file, m])); + expect(byFile.get("pack.jar")).toMatchObject({ + project_id: "238222", + version_id: "5101366", + layer: "origin", + }); + expect(byFile.get("known.jar")?.project_id).toBe("keep"); + expect(byFile.get("hand.jar")).toMatchObject({ + project_id: "P7dR8mSH", + tracked: true, + enabled: false, + }); + expect(byFile.has("ghost.jar")).toBe(false); + expect(byFile.get("pack.jar")?.cf_fingerprint).toBe(curseforgeFingerprint(encode("a"))); + }); +}); diff --git a/src/state/mod-manifest.ts b/src/state/mod-manifest.ts index c822526..a26628b 100644 --- a/src/state/mod-manifest.ts +++ b/src/state/mod-manifest.ts @@ -35,6 +35,7 @@ const manifestEntrySchema = z.object({ size_bytes: z.number().int().nonnegative(), mtime_ms: z.number().nonnegative(), sha1: z.string().regex(/^[0-9a-f]{40}$/), + cf_fingerprint: z.number().int().nonnegative().max(0xffffffff).optional(), mod_id: z.string().max(128).optional(), name: z.string().max(256).optional(), version: z.string().max(128).optional(), @@ -60,6 +61,8 @@ export interface ServerModView extends ServerModEntry { /** False for a jar someone put in the folder by hand. */ readonly tracked: boolean; readonly size_bytes?: number; + /** CurseForge fingerprint of the jar, used to find mods that have no project recorded. */ + readonly cf_fingerprint?: number; readonly mod_id?: string; readonly name?: string; readonly version?: string; @@ -276,6 +279,46 @@ export function readJarMetadata(buffer: Uint8Array): JarMetadata { return {}; } +/** + * The fingerprint CurseForge indexes files by: 32-bit MurmurHash2 with seed 1 over the + * file's bytes, leaving out tabs, line feeds, carriage returns and spaces. + */ +export function curseforgeFingerprint(data: Uint8Array): number { + const kept = new Uint8Array(data.byteLength); + let length = 0; + for (const byte of data) { + if (byte !== 9 && byte !== 10 && byte !== 13 && byte !== 32) { + kept[length++] = byte; + } + } + const m = 0x5bd1e995; + let h = (1 ^ length) >>> 0; + let i = 0; + while (length - i >= 4) { + let k = + (kept[i] ?? 0) | + ((kept[i + 1] ?? 0) << 8) | + ((kept[i + 2] ?? 0) << 16) | + ((kept[i + 3] ?? 0) << 24); + k = Math.imul(k, m); + k ^= k >>> 24; + k = Math.imul(k, m); + h = Math.imul(h, m) ^ k; + i += 4; + } + const rest = length - i; + if (rest === 3) h ^= (kept[i + 2] ?? 0) << 16; + if (rest >= 2) h ^= (kept[i + 1] ?? 0) << 8; + if (rest >= 1) { + h ^= kept[i] ?? 0; + h = Math.imul(h, m); + } + h ^= h >>> 13; + h = Math.imul(h, m); + h ^= h >>> 15; + return h >>> 0; +} + /** The name Tegra records for a jar, without the `.disabled` suffix. */ export function baseModFileName(diskName: string): string { return diskName.toLowerCase().endsWith(DISABLED_SUFFIX) @@ -391,7 +434,8 @@ export async function scanServerMods(options: ScanServerModsOptions): Promise { exercised.add("server.mods.replace"); expect(replaceRes.ack?.body.ok).toBe(true); + const identifyRes = await send( + "server.mods.identify", + { server_id: "srv-rt", mods: [{ file: "m.jar", source: "modrinth", project_id: "p-rt" }] }, + true, + ); + exercised.add("server.mods.identify"); + expect(identifyRes.ack?.body.ok).toBe(true); + const removeRes = await send( "server.mods.remove", { server_id: "srv-rt", file: "m.jar" }, From 5e28a6bc77047d21a042ae45c847fc950c649c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sat, 28 Nov 2026 20:34:53 -0300 Subject: [PATCH 49/59] build(lib): rebuild for server mods toggle, replace and identify --- .../{index-k66kvjnc.js => index-jbj4v5jg.js} | 49 ++++++++++- lib/protocol/index.js | 14 ++- lib/types/protocol/commands/state.d.ts | 87 +++++++++++++++++++ lib/types/protocol/errors.d.ts | 2 +- lib/types/protocol/index.d.ts | 2 +- lib/vault/index.js | 2 +- 6 files changed, 151 insertions(+), 5 deletions(-) rename lib/chunks/{index-k66kvjnc.js => index-jbj4v5jg.js} (96%) diff --git a/lib/chunks/index-k66kvjnc.js b/lib/chunks/index-jbj4v5jg.js similarity index 96% rename from lib/chunks/index-k66kvjnc.js rename to lib/chunks/index-jbj4v5jg.js index aac9ccb..982842e 100644 --- a/lib/chunks/index-k66kvjnc.js +++ b/lib/chunks/index-jbj4v5jg.js @@ -1727,6 +1727,32 @@ var serverModsRemoveBodySchema = z11.object({ server_id: serverIdSchema, file: modFileNameSchema }).strict(); +var serverModsToggleBodySchema = z11.object({ + server_id: serverIdSchema, + file: modFileNameSchema, + enabled: z11.boolean() +}).strict(); +var serverModsReplaceBodySchema = z11.object({ + server_id: serverIdSchema, + old_file: modFileNameSchema, + file: modFileNameSchema, + url: z11.string().url().max(2048), + source: modSourceSchema, + project_id: z11.string().min(1).max(128).optional(), + version_id: z11.string().min(1).max(128).optional(), + sha1: sha1HexSchema.optional(), + sha256: sha256HexSchema.optional(), + sha512: sha512HexSchema.optional() +}).strict(); +var serverModsIdentifyBodySchema = z11.object({ + server_id: serverIdSchema, + mods: z11.array(z11.object({ + file: modFileNameSchema, + source: z11.enum(["modrinth", "curseforge", "tegra"]), + project_id: z11.string().min(1).max(128), + version_id: z11.string().min(1).max(128).optional() + }).strict()).min(1).max(4000) +}).strict(); var serverOriginPlanBodySchema = z11.object({ server_id: serverIdSchema, to_version_id: z11.string().min(1).max(128), @@ -1800,6 +1826,24 @@ var serverModsRemoveCommand = defineCommand({ minRole: "editor", body: serverModsRemoveBodySchema }); +var serverModsToggleCommand = defineCommand({ + type: "server.mods.toggle", + level: "session", + minRole: "editor", + body: serverModsToggleBodySchema +}); +var serverModsReplaceCommand = defineCommand({ + type: "server.mods.replace", + level: "session", + minRole: "editor", + body: serverModsReplaceBodySchema +}); +var serverModsIdentifyCommand = defineCommand({ + type: "server.mods.identify", + level: "session", + minRole: "editor", + body: serverModsIdentifyBodySchema +}); var serverOriginPlanCommand = defineCommand({ type: "server.origin.plan", level: "session", @@ -1834,6 +1878,9 @@ var STATE_COMMANDS = [ serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, + serverModsToggleCommand, + serverModsReplaceCommand, + serverModsIdentifyCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, @@ -2259,4 +2306,4 @@ function createInMemoryTrustContext(options) { } }; } -export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, MAX_ELEVATED_SESSION_MS, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, minecraftVersionSchema, loaderVersionSchema, serverCreateBodySchema, serverChangeRuntimeBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverStatsBodySchema, serverStatsResultSchema, serverCreateCommand, serverChangeRuntimeCommand, serverRestartCommand, serverStatusCommand, serverStatsCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, BACKUP_UPLOAD_STATES, backupUploadStateSchema, serverBackupUploadEventSchema, pendingBackupUploadSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, hostInfoBodySchema, hostInfoResultSchema, hostInfoCommand, HOST_COMMANDS, registerHostCommands, MODPACK_SOURCES, modpackSourceSchema, MODPACK_INSTALL_PHASES, modpackInstallPhaseSchema, MODPACK_INSTALL_JOB_STATES, modpackInstallJobStateSchema, MODPACK_INSTALL_ERROR_CODES, modpackInstallErrorCodeSchema, modpackInstallSkippedItemSchema, serverInstallModpackBodySchema, serverInstallModpackStatusBodySchema, serverInstallModpackCancelBodySchema, serverInstallModpackAcceptedEventSchema, serverInstallModpackProgressEventSchema, serverInstallModpackResultEventSchema, modpackInstallJobStatusSchema, serverInstallModpackStatusResultSchema, serverInstallModpackCommand, serverInstallModpackStatusCommand, serverInstallModpackCancelCommand, MODPACK_COMMANDS, registerModpackCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; +export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, MAX_ELEVATED_SESSION_MS, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, minecraftVersionSchema, loaderVersionSchema, serverCreateBodySchema, serverChangeRuntimeBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverStatsBodySchema, serverStatsResultSchema, serverCreateCommand, serverChangeRuntimeCommand, serverRestartCommand, serverStatusCommand, serverStatsCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, BACKUP_UPLOAD_STATES, backupUploadStateSchema, serverBackupUploadEventSchema, pendingBackupUploadSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, hostInfoBodySchema, hostInfoResultSchema, hostInfoCommand, HOST_COMMANDS, registerHostCommands, MODPACK_SOURCES, modpackSourceSchema, MODPACK_INSTALL_PHASES, modpackInstallPhaseSchema, MODPACK_INSTALL_JOB_STATES, modpackInstallJobStateSchema, MODPACK_INSTALL_ERROR_CODES, modpackInstallErrorCodeSchema, modpackInstallSkippedItemSchema, serverInstallModpackBodySchema, serverInstallModpackStatusBodySchema, serverInstallModpackCancelBodySchema, serverInstallModpackAcceptedEventSchema, serverInstallModpackProgressEventSchema, serverInstallModpackResultEventSchema, modpackInstallJobStatusSchema, serverInstallModpackStatusResultSchema, serverInstallModpackCommand, serverInstallModpackStatusCommand, serverInstallModpackCancelCommand, MODPACK_COMMANDS, registerModpackCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverModsToggleBodySchema, serverModsReplaceBodySchema, serverModsIdentifyBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverModsToggleCommand, serverModsReplaceCommand, serverModsIdentifyCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; diff --git a/lib/protocol/index.js b/lib/protocol/index.js index 7ade345..076c5dd 100644 --- a/lib/protocol/index.js +++ b/lib/protocol/index.js @@ -206,12 +206,18 @@ import { serverLoaderSchema, serverMemoryMbSchema, serverModEntrySchema, + serverModsIdentifyBodySchema, + serverModsIdentifyCommand, serverModsInstallBodySchema, serverModsInstallCommand, serverModsListBodySchema, serverModsListCommand, serverModsRemoveBodySchema, serverModsRemoveCommand, + serverModsReplaceBodySchema, + serverModsReplaceCommand, + serverModsToggleBodySchema, + serverModsToggleCommand, serverOriginApplyBodySchema, serverOriginApplyCommand, serverOriginPlanBodySchema, @@ -267,7 +273,7 @@ import { verifyTrustGrant, worldNameSchema, wrapEventBody -} from "../chunks/index-k66kvjnc.js"; +} from "../chunks/index-jbj4v5jg.js"; import"../chunks/index-g1frygvt.js"; export { wrapEventBody, @@ -325,12 +331,18 @@ export { serverOriginPlanBodySchema, serverOriginApplyCommand, serverOriginApplyBodySchema, + serverModsToggleCommand, + serverModsToggleBodySchema, + serverModsReplaceCommand, + serverModsReplaceBodySchema, serverModsRemoveCommand, serverModsRemoveBodySchema, serverModsListCommand, serverModsListBodySchema, serverModsInstallCommand, serverModsInstallBodySchema, + serverModsIdentifyCommand, + serverModsIdentifyBodySchema, serverModEntrySchema, serverMemoryMbSchema, serverLoaderSchema, diff --git a/lib/types/protocol/commands/state.d.ts b/lib/types/protocol/commands/state.d.ts index 0110c49..dd6d318 100644 --- a/lib/types/protocol/commands/state.d.ts +++ b/lib/types/protocol/commands/state.d.ts @@ -141,6 +141,41 @@ export declare const serverModsRemoveBodySchema: z.ZodObject<{ server_id: z.ZodString; file: z.ZodString; }, z.core.$strict>; +export declare const serverModsToggleBodySchema: z.ZodObject<{ + server_id: z.ZodString; + file: z.ZodString; + enabled: z.ZodBoolean; +}, z.core.$strict>; +export declare const serverModsReplaceBodySchema: z.ZodObject<{ + server_id: z.ZodString; + old_file: z.ZodString; + file: z.ZodString; + url: z.ZodString; + source: z.ZodEnum<{ + curseforge: "curseforge"; + local: "local"; + modrinth: "modrinth"; + tegra: "tegra"; + }>; + project_id: z.ZodOptional; + version_id: z.ZodOptional; + sha1: z.ZodOptional>>; + sha256: z.ZodOptional; + sha512: z.ZodOptional>>; +}, z.core.$strict>; +export declare const serverModsIdentifyBodySchema: z.ZodObject<{ + server_id: z.ZodString; + mods: z.ZodArray; + project_id: z.ZodString; + version_id: z.ZodOptional; + }, z.core.$strict>>; +}, z.core.$strict>; export declare const serverOriginPlanBodySchema: z.ZodObject<{ server_id: z.ZodString; to_version_id: z.ZodString; @@ -250,6 +285,9 @@ export declare const serverDeployServerpackBodySchema: z.ZodObject<{ export type ServerModsListBody = z.infer; export type ServerModsInstallBody = z.infer; export type ServerModsRemoveBody = z.infer; +export type ServerModsToggleBody = z.infer; +export type ServerModsReplaceBody = z.infer; +export type ServerModsIdentifyBody = z.infer; export type ServerOriginPlanBody = z.infer; export type ServerOriginApplyBody = z.infer; export type ServerOriginUnlinkBody = z.infer; @@ -272,6 +310,32 @@ export declare const serverModsRemoveCommand: import("..").CommandDefinition<"se server_id: string; file: string; }>; +export declare const serverModsToggleCommand: import("..").CommandDefinition<"server.mods.toggle", { + server_id: string; + file: string; + enabled: boolean; +}>; +export declare const serverModsReplaceCommand: import("..").CommandDefinition<"server.mods.replace", { + server_id: string; + old_file: string; + file: string; + url: string; + source: "curseforge" | "local" | "modrinth" | "tegra"; + project_id?: string | undefined; + version_id?: string | undefined; + sha1?: string | undefined; + sha256?: string | undefined; + sha512?: string | undefined; +}>; +export declare const serverModsIdentifyCommand: import("..").CommandDefinition<"server.mods.identify", { + server_id: string; + mods: { + file: string; + source: "curseforge" | "modrinth" | "tegra"; + project_id: string; + version_id?: string | undefined; + }[]; +}>; export declare const serverOriginPlanCommand: import("..").CommandDefinition<"server.origin.plan", { server_id: string; to_version_id: string; @@ -355,6 +419,29 @@ export declare const STATE_COMMANDS: readonly [import("..").CommandDefinition<"s }>, import("..").CommandDefinition<"server.mods.remove", { server_id: string; file: string; +}>, import("..").CommandDefinition<"server.mods.toggle", { + server_id: string; + file: string; + enabled: boolean; +}>, import("..").CommandDefinition<"server.mods.replace", { + server_id: string; + old_file: string; + file: string; + url: string; + source: "curseforge" | "local" | "modrinth" | "tegra"; + project_id?: string | undefined; + version_id?: string | undefined; + sha1?: string | undefined; + sha256?: string | undefined; + sha512?: string | undefined; +}>, import("..").CommandDefinition<"server.mods.identify", { + server_id: string; + mods: { + file: string; + source: "curseforge" | "modrinth" | "tegra"; + project_id: string; + version_id?: string | undefined; + }[]; }>, import("..").CommandDefinition<"server.origin.plan", { server_id: string; to_version_id: string; diff --git a/lib/types/protocol/errors.d.ts b/lib/types/protocol/errors.d.ts index 14c4693..d9db0a6 100644 --- a/lib/types/protocol/errors.d.ts +++ b/lib/types/protocol/errors.d.ts @@ -1,4 +1,4 @@ -export type ProtocolErrorCode = "invalid_format" | "unsupported_version" | "wrong_agent" | "wrong_recipient" | "expired" | "not_yet_valid" | "ttl_too_long" | "untrusted_signer" | "bad_signature" | "session_invalid" | "session_revoked" | "replayed" | "unknown_command" | "invalid_body" | "elevation_required" | "elevation_invalid" | "account_key_required" | "decrypt_failed" | "insufficient_role" | "too_many_subscribers" | "role_grant_invalid" | "auth_invalid" | "request_invalid" | "grant_invalid" | "grant_wrong_agent" | "grant_expired" | "grant_bad_signature" | "grant_proof_required" | "grant_bad_proof" | "revocation_stale" | "revocation_not_superset" | "insufficient_memory" | "eula_not_accepted" | "server_not_found" | "server_already_exists" | "server_running" | "server_stopped" | "invalid_jvm_args" | "download_failed" | "hash_mismatch" | "systemd_error" | "perms_unavailable" | "origin_locked" | "plan_not_found" | "plan_expired" | "plan_stale" | "mod_not_found" | "mod_already_exists" | "backup_not_found" | "backup_failed" | "backup_config_invalid" | "tunnel_not_configured" | "tunnel_already_running" | "tunnel_not_running" | "tunnel_failed" | "pack_unavailable" | "runtime_mismatch" | "host_not_allowed" | "too_large" | "install_in_progress" | "api_unavailable" | "io_error" | "cancelled"; +export type ProtocolErrorCode = "invalid_format" | "unsupported_version" | "wrong_agent" | "wrong_recipient" | "expired" | "not_yet_valid" | "ttl_too_long" | "untrusted_signer" | "bad_signature" | "session_invalid" | "session_revoked" | "replayed" | "unknown_command" | "invalid_body" | "elevation_required" | "elevation_invalid" | "account_key_required" | "decrypt_failed" | "insufficient_role" | "too_many_subscribers" | "role_grant_invalid" | "auth_invalid" | "request_invalid" | "grant_invalid" | "grant_wrong_agent" | "grant_expired" | "grant_bad_signature" | "grant_proof_required" | "grant_bad_proof" | "revocation_stale" | "revocation_not_superset" | "insufficient_memory" | "eula_not_accepted" | "server_not_found" | "server_already_exists" | "server_running" | "server_stopped" | "invalid_jvm_args" | "download_failed" | "hash_mismatch" | "systemd_error" | "perms_unavailable" | "origin_locked" | "plan_not_found" | "plan_expired" | "plan_stale" | "mod_not_found" | "mod_conflict" | "mod_already_exists" | "backup_not_found" | "backup_failed" | "backup_config_invalid" | "tunnel_not_configured" | "tunnel_already_running" | "tunnel_not_running" | "tunnel_failed" | "pack_unavailable" | "runtime_mismatch" | "host_not_allowed" | "too_large" | "install_in_progress" | "api_unavailable" | "io_error" | "cancelled"; export declare class ProtocolError extends Error { readonly code: ProtocolErrorCode; constructor(code: ProtocolErrorCode, message: string); diff --git a/lib/types/protocol/index.d.ts b/lib/types/protocol/index.d.ts index cefc63f..8521e8d 100644 --- a/lib/types/protocol/index.d.ts +++ b/lib/types/protocol/index.d.ts @@ -9,7 +9,7 @@ export { HOST_COMMANDS, type HostInfoBody, type HostInfoResult, hostInfoBodySche export { MODPACK_COMMANDS, MODPACK_INSTALL_ERROR_CODES, MODPACK_INSTALL_JOB_STATES, MODPACK_INSTALL_PHASES, MODPACK_SOURCES, type ModpackInstallErrorCode, type ModpackInstallJobState, type ModpackInstallJobStatus, type ModpackInstallPhase, type ModpackInstallSkippedItem, type ModpackSource, modpackInstallErrorCodeSchema, modpackInstallJobStateSchema, modpackInstallJobStatusSchema, modpackInstallPhaseSchema, modpackInstallSkippedItemSchema, modpackSourceSchema, registerModpackCommands, type ServerInstallModpackAcceptedEvent, type ServerInstallModpackBody, type ServerInstallModpackCancelBody, type ServerInstallModpackProgressEvent, type ServerInstallModpackResultEvent, type ServerInstallModpackStatusBody, type ServerInstallModpackStatusResult, serverInstallModpackAcceptedEventSchema, serverInstallModpackBodySchema, serverInstallModpackCancelBodySchema, serverInstallModpackCancelCommand, serverInstallModpackCommand, serverInstallModpackProgressEventSchema, serverInstallModpackResultEventSchema, serverInstallModpackStatusBodySchema, serverInstallModpackStatusCommand, serverInstallModpackStatusResultSchema, } from "./commands/modpack"; export { agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, } from "./commands/pairing"; export { consoleLineSchema, DEFAULT_SERVER_PORT, loaderVersionSchema, MAX_CONSOLE_LINE_LENGTH, MAX_JVM_ARGS, MAX_SERVER_MEMORY_MB, MIN_SERVER_MEMORY_MB, minecraftVersionSchema, registerServerCommands, SERVER_COMMANDS, SERVER_ID_REGEX, type ServerChangeRuntimeBody, type ServerConsoleSendBody, type ServerConsoleSubscribeBody, type ServerCreateBody, type ServerLoader, type ServerStatsBody, type ServerStatsResult, type ServerUpdateSettingsBody, serverChangeRuntimeBodySchema, serverChangeRuntimeCommand, serverConsoleSendBodySchema, serverConsoleSendCommand, serverConsoleSubscribeBodySchema, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, serverCreateBodySchema, serverCreateCommand, serverIdSchema, serverListCommand, serverLoaderSchema, serverMemoryMbSchema, serverPortSchema, serverRestartCommand, serverStatsBodySchema, serverStatsCommand, serverStatsResultSchema, serverStatusCommand, serverUpdateSettingsBodySchema, serverUpdateSettingsCommand, } from "./commands/server"; -export { blobKeySchema, type ModEnvironmentInfo, type ModLayer, type ModSource, modEnvironmentInfoSchema, modFileNameSchema, modLayerSchema, modSourceSchema, type OriginPlanFileInput, type OriginPlanModInput, originPlanFileInputSchema, originPlanModInputSchema, RESERVED_WORLD_NAMES, registerStateCommands, type ServerDeployServerpackBody, type ServerModEntry, type ServerModsInstallBody, type ServerModsListBody, type ServerModsRemoveBody, type ServerOrigin, type ServerOriginApplyBody, type ServerOriginPlanBody, type ServerOriginSyncState, type ServerOriginUnlinkBody, type ServerWorldImportBody, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, STATE_COMMANDS, serverDeployServerpackBodySchema, serverDeployServerpackCommand, serverModEntrySchema, serverModsInstallBodySchema, serverModsInstallCommand, serverModsListBodySchema, serverModsListCommand, serverModsRemoveBodySchema, serverModsRemoveCommand, serverOriginApplyBodySchema, serverOriginApplyCommand, serverOriginPlanBodySchema, serverOriginPlanCommand, serverOriginSchema, serverOriginSyncStateSchema, serverOriginUnlinkBodySchema, serverOriginUnlinkCommand, serverWorldImportBodySchema, serverWorldImportCommand, sha1HexSchema, sha512HexSchema, WORLD_NAME_REGEX, worldNameSchema, } from "./commands/state"; +export { blobKeySchema, type ModEnvironmentInfo, type ModLayer, type ModSource, modEnvironmentInfoSchema, modFileNameSchema, modLayerSchema, modSourceSchema, type OriginPlanFileInput, type OriginPlanModInput, originPlanFileInputSchema, originPlanModInputSchema, RESERVED_WORLD_NAMES, registerStateCommands, type ServerDeployServerpackBody, type ServerModEntry, type ServerModsIdentifyBody, type ServerModsInstallBody, type ServerModsListBody, type ServerModsRemoveBody, type ServerModsReplaceBody, type ServerModsToggleBody, type ServerOrigin, type ServerOriginApplyBody, type ServerOriginPlanBody, type ServerOriginSyncState, type ServerOriginUnlinkBody, type ServerWorldImportBody, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, STATE_COMMANDS, serverDeployServerpackBodySchema, serverDeployServerpackCommand, serverModEntrySchema, serverModsIdentifyBodySchema, serverModsIdentifyCommand, serverModsInstallBodySchema, serverModsInstallCommand, serverModsListBodySchema, serverModsListCommand, serverModsRemoveBodySchema, serverModsRemoveCommand, serverModsReplaceBodySchema, serverModsReplaceCommand, serverModsToggleBodySchema, serverModsToggleCommand, serverOriginApplyBodySchema, serverOriginApplyCommand, serverOriginPlanBodySchema, serverOriginPlanCommand, serverOriginSchema, serverOriginSyncStateSchema, serverOriginUnlinkBodySchema, serverOriginUnlinkCommand, serverWorldImportBodySchema, serverWorldImportCommand, sha1HexSchema, sha512HexSchema, WORLD_NAME_REGEX, worldNameSchema, } from "./commands/state"; export { PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, registerTunnelCommands, TUNNEL_COMMANDS, type TunnelPlayitSetKeyBody, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStatusCommand, tunnelPlayitStopCommand, } from "./commands/tunnel"; export { DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_AGENT_MESSAGE, DOMAIN_COMMAND, DOMAIN_PAIRING_PROOF, DOMAIN_REVOCATION, DOMAIN_ROLE_GRANT, DOMAIN_SESSION, DOMAIN_TRUST_GRANT, PROTOCOL_VERSION, } from "./domains"; export { ProtocolError, type ProtocolErrorCode } from "./errors"; diff --git a/lib/vault/index.js b/lib/vault/index.js index 73f0d67..14ed352 100644 --- a/lib/vault/index.js +++ b/lib/vault/index.js @@ -6,7 +6,7 @@ import { sessionCertificateSchema, signRevocationList, signSessionCertificate -} from "../chunks/index-k66kvjnc.js"; +} from "../chunks/index-jbj4v5jg.js"; import { KDF_ALG_ARGON2ID13, KDF_MODERATE, From dd69a3e18bbd838e5cddb562898a2f92db6a08f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 29 Nov 2026 01:55:07 -0300 Subject: [PATCH 50/59] feat(tunnel): start playit on key save and resume it at boot Saving the secret key now brings the tunnel up (or restarts it on the new key) instead of leaving it stopped, and tegrad starts it again at boot when a key is saved. A user stop is remembered in playit.disabled so a restart leaves the tunnel down until started again. --- src/cli/run.ts | 1 + src/tunnel/index.ts | 1 + src/tunnel/playit.test.ts | 18 ++++++++++-- src/tunnel/playit.ts | 58 +++++++++++++++++++++++++++++++++++---- 4 files changed, 70 insertions(+), 8 deletions(-) diff --git a/src/cli/run.ts b/src/cli/run.ts index 298cb5f..95365bb 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -354,6 +354,7 @@ export async function createAgentRuntime( updater.start(); backupManager.start(); modpackInstaller.start(); + void tunnelManager.resume(); }, shutdown(drainTimeoutMs: number = SHUTDOWN_DRAIN_TIMEOUT_MS): Promise { diff --git a/src/tunnel/index.ts b/src/tunnel/index.ts index c2f867c..469bec5 100644 --- a/src/tunnel/index.ts +++ b/src/tunnel/index.ts @@ -27,6 +27,7 @@ export { buildPlayitSpawnSpec, createPlayitTunnelManager, DEFAULT_TUNNEL_STOP_TIMEOUT_MS, + PLAYIT_DISABLED_FILENAME, type PlayitSpawnSpec, type PlayitTunnelManager, type PlayitTunnelManagerOptions, diff --git a/src/tunnel/playit.test.ts b/src/tunnel/playit.test.ts index e3a8b0c..32fd10e 100644 --- a/src/tunnel/playit.test.ts +++ b/src/tunnel/playit.test.ts @@ -37,6 +37,7 @@ import { getPlayitBinaryPath, getPlayitKeyPath, type PinnedPlayitAsset, + PLAYIT_DISABLED_FILENAME, PLAYIT_RELEASE_ASSETS, PLAYIT_VERSION, registerTunnelHandlers, @@ -413,9 +414,18 @@ describe("Tunnel protocol commands and sensitivity enforcement", () => { }); }; + const disabledPath = join(stateDir, PLAYIT_DISABLED_FILENAME); + + // Saving the key brings the tunnel up with it. await sendCmd("tunnel.playit.set_key", { secret_key: VALID_HEX_KEY }); - await sendCmd("tunnel.playit.start", {}); + expect(manager.status().running).toBe(true); await sendCmd("tunnel.playit.status", {}); + // A stop is remembered, so a restart of tegrad leaves the tunnel down. + await sendCmd("tunnel.playit.stop", {}); + expect(existsSync(disabledPath)).toBe(true); + expect((await manager.resume()).running).toBe(false); + await sendCmd("tunnel.playit.start", {}); + expect(existsSync(disabledPath)).toBe(false); await sendCmd("tunnel.playit.stop", {}); const events = frames @@ -424,15 +434,17 @@ describe("Tunnel protocol commands and sensitivity enforcement", () => { expect(events.map((e) => e.header.type)).toEqual([ "tunnel.playit.key_updated", - "tunnel.playit.started", "tunnel.playit.status.result", "tunnel.playit.stopped", + "tunnel.playit.started", + "tunnel.playit.stopped", ]); + expect((events[0]?.body as { running?: boolean } | undefined)?.running).toBe(true); const acks = frames.filter( (f): f is Extract => f.kind === "ack", ); - expect(acks).toHaveLength(4); + expect(acks).toHaveLength(5); expect(acks.every((a) => a.body.ok)).toBe(true); }); }); diff --git a/src/tunnel/playit.ts b/src/tunnel/playit.ts index 285bccf..fba7acd 100644 --- a/src/tunnel/playit.ts +++ b/src/tunnel/playit.ts @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Antônio Miranda -import { chmodSync, lstatSync, mkdirSync } from "node:fs"; +import { chmodSync, existsSync, lstatSync, mkdirSync, rmSync, writeFileSync } from "node:fs"; import { join } from "node:path"; import type { CommandQueue } from "../agent/jobs"; import type { Logger } from "../agent/logger"; @@ -16,6 +16,9 @@ import { assertPlayitSecretKey, hasPlayitSecretKey, savePlayitSecretKey } from " export const DEFAULT_TUNNEL_STOP_TIMEOUT_MS = 5_000; +/** Present while the user has stopped the tunnel, so a restart of tegrad leaves it stopped. */ +export const PLAYIT_DISABLED_FILENAME = "playit.disabled"; + export interface PlayitSpawnSpec { readonly binaryPath: string; readonly args: readonly string[]; @@ -66,6 +69,12 @@ export interface PlayitTunnelManager { start(): Promise; stop(): Promise; status(): PlayitTunnelStatus; + /** Stops a running tunnel, then starts it with the saved key. Failures land in `last_error`. */ + apply(): Promise; + /** Starts the tunnel at boot when a key is saved and the user has not stopped it. */ + resume(): Promise; + /** Remembers whether the user wants the tunnel running across restarts of tegrad. */ + setEnabled(enabled: boolean): void; close(): Promise; } @@ -320,6 +329,39 @@ export function createPlayitTunnelManager( return status(); } + const disabledPath = join(options.stateDir, PLAYIT_DISABLED_FILENAME); + + function setEnabled(enabled: boolean): void { + if (enabled) { + rmSync(disabledPath, { force: true }); + return; + } + mkdirSync(options.stateDir, { recursive: true, mode: 0o700 }); + writeFileSync(disabledPath, "", { mode: 0o600 }); + } + + async function startCatching(): Promise { + try { + return await start(); + } catch (error) { + lastError = error instanceof Error ? error.message : String(error); + options.logger?.warn("Could not start the playit tunnel", { error: lastError }); + return status(); + } + } + + async function apply(): Promise { + setEnabled(true); + if (activeProc !== null) await stop(); + return startCatching(); + } + + async function resume(): Promise { + if (activeProc !== null || starting) return status(); + if (!hasPlayitSecretKey(options.stateDir) || existsSync(disabledPath)) return status(); + return startCatching(); + } + async function close(): Promise { if (activeProc !== null) { try { @@ -335,25 +377,31 @@ export function createPlayitTunnelManager( start, stop, status, + apply, + resume, + setEnabled, close, }; } export function registerTunnelHandlers(queue: CommandQueue, manager: PlayitTunnelManager): void { - queue.registerHandler("tunnel.playit.set_key", (opened, ctx) => { + // Saving a key brings the tunnel up with it (or restarts it on the new key); a start + // failure does not undo the save, it shows in `last_error`. + queue.registerHandler("tunnel.playit.set_key", async (opened, ctx) => { const body = opened.body as TunnelPlayitSetKeyBody; manager.setKey(body.secret_key); - ctx.sendEvent("tunnel.playit.key_updated", { - configured: true, - }); + const current = await manager.apply(); + ctx.sendEvent("tunnel.playit.key_updated", current); }); queue.registerHandler("tunnel.playit.start", async (_opened, ctx) => { + manager.setEnabled(true); const current = await manager.start(); ctx.sendEvent("tunnel.playit.started", current); }); queue.registerHandler("tunnel.playit.stop", async (_opened, ctx) => { + manager.setEnabled(false); const current = await manager.stop(); ctx.sendEvent("tunnel.playit.stopped", current); }); From fe6f4711e6c507d61f4ddb18e7a1e99010a023fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 29 Nov 2026 02:42:35 -0300 Subject: [PATCH 51/59] feat(tunnel): link playit by claim and create server tunnels - tunnel.playit.claim.begin/status/cancel: tegrad generates a claim code, the user approves it on playit.gg, and tegrad trades it for the key of a self-managed agent, then starts the tunnel. No key is copied. - server.tunnel.get/create: a self-managed agent creates the server's Minecraft Java tunnel to 127.0.0.1: itself and reports its public address; a port change is applied to the existing tunnel. - The playit status adds managed, key_hint and the current claim. A key pasted by hand drops the self-managed state, since its agent type is unknown. --- src/cli/run.ts | 21 ++- src/protocol/commands/tunnel.ts | 46 +++++ src/protocol/errors.ts | 2 + src/protocol/index.ts | 6 + src/protocol/phase3.test.ts | 2 + src/tunnel/index.ts | 18 ++ src/tunnel/key.ts | 6 + src/tunnel/playit-account.test.ts | 268 ++++++++++++++++++++++++++++ src/tunnel/playit-account.ts | 284 ++++++++++++++++++++++++++++++ src/tunnel/playit-api.ts | 169 ++++++++++++++++++ src/tunnel/playit.ts | 55 +++++- 11 files changed, 871 insertions(+), 6 deletions(-) create mode 100644 src/tunnel/playit-account.test.ts create mode 100644 src/tunnel/playit-account.ts create mode 100644 src/tunnel/playit-api.ts diff --git a/src/cli/run.ts b/src/cli/run.ts index 95365bb..959505f 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -33,6 +33,8 @@ import { import { createServerManager, createServerStatusWatcher, + DEFAULT_SERVERS_DIR, + readServerMetadata, registerServerHandlers, type ServerManager, type ServerStatusWatcher, @@ -46,6 +48,8 @@ import { type StateManager, } from "../state"; import { + createPlayitAccount, + createPlayitApi, createPlayitTunnelManager, type PlayitTunnelManager, registerTunnelHandlers, @@ -298,7 +302,22 @@ export async function createAgentRuntime( ...(options.fetch !== undefined ? { fetchImpl: options.fetch } : {}), ...(options.now !== undefined ? { now: options.now } : {}), }); - registerTunnelHandlers(queue, tunnelManager); + const tunnelServersDir = + configuredServersDir && configuredServersDir.length > 0 + ? configuredServersDir + : DEFAULT_SERVERS_DIR; + const playitAccount = createPlayitAccount({ + stateDir: options.stateDir, + api: createPlayitApi(options.fetch !== undefined ? { fetchImpl: options.fetch } : {}), + tunnel: tunnelManager, + resolveServer: (serverId) => { + const meta = readServerMetadata(tunnelServersDir, serverId); + return { name: meta.name, port: meta.port }; + }, + logger, + ...(options.now !== undefined ? { now: options.now } : {}), + }); + registerTunnelHandlers(queue, tunnelManager, playitAccount); const connection = createAgentConnection({ apiUrl: config.apiUrl, diff --git a/src/protocol/commands/tunnel.ts b/src/protocol/commands/tunnel.ts index 0f0846d..a25f2d0 100644 --- a/src/protocol/commands/tunnel.ts +++ b/src/protocol/commands/tunnel.ts @@ -3,6 +3,7 @@ import { z } from "zod"; import { type CommandRegistry, defineCommand } from "../registry"; +import { serverIdSchema } from "./server"; export const PLAYIT_SECRET_KEY_REGEX = /^[0-9a-fA-F]{16,256}$/; @@ -50,11 +51,56 @@ export const tunnelPlayitStatusCommand = defineCommand({ body: z.object({}).strict(), }); +/** Links the agent to playit.gg through the browser, without copying a key: tegrad gets a self-managed agent. */ +export const tunnelPlayitClaimBeginCommand = defineCommand({ + type: "tunnel.playit.claim.begin", + level: "sudo", + minRole: "admin", + body: z.object({}).strict(), +}); + +export const tunnelPlayitClaimStatusCommand = defineCommand({ + type: "tunnel.playit.claim.status", + level: "session", + minRole: "admin", + body: z.object({}).strict(), +}); + +export const tunnelPlayitClaimCancelCommand = defineCommand({ + type: "tunnel.playit.claim.cancel", + level: "session", + minRole: "admin", + body: z.object({}).strict(), +}); + +export const serverTunnelBodySchema = z.object({ server_id: serverIdSchema }).strict(); + +/** The server's playit tunnel and its public address, when the agent manages its own tunnels. */ +export const serverTunnelGetCommand = defineCommand({ + type: "server.tunnel.get", + level: "session", + minRole: "viewer", + body: serverTunnelBodySchema, +}); + +/** Creates the server's Minecraft Java tunnel on playit (or points it at the server's current port). */ +export const serverTunnelCreateCommand = defineCommand({ + type: "server.tunnel.create", + level: "session", + minRole: "admin", + body: serverTunnelBodySchema, +}); + export const TUNNEL_COMMANDS = [ tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, + tunnelPlayitClaimBeginCommand, + tunnelPlayitClaimStatusCommand, + tunnelPlayitClaimCancelCommand, + serverTunnelGetCommand, + serverTunnelCreateCommand, ] as const; export function registerTunnelCommands(registry: CommandRegistry): CommandRegistry { diff --git a/src/protocol/errors.ts b/src/protocol/errors.ts index 421e214..e489c0a 100644 --- a/src/protocol/errors.ts +++ b/src/protocol/errors.ts @@ -58,6 +58,8 @@ export type ProtocolErrorCode = | "tunnel_already_running" | "tunnel_not_running" | "tunnel_failed" + | "tunnel_not_managed" + | "tunnel_api_failed" | "pack_unavailable" | "runtime_mismatch" | "host_not_allowed" diff --git a/src/protocol/index.ts b/src/protocol/index.ts index 1984d62..0364dc4 100644 --- a/src/protocol/index.ts +++ b/src/protocol/index.ts @@ -303,8 +303,14 @@ export { PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, registerTunnelCommands, + serverTunnelBodySchema, + serverTunnelCreateCommand, + serverTunnelGetCommand, TUNNEL_COMMANDS, type TunnelPlayitSetKeyBody, + tunnelPlayitClaimBeginCommand, + tunnelPlayitClaimCancelCommand, + tunnelPlayitClaimStatusCommand, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, diff --git a/src/protocol/phase3.test.ts b/src/protocol/phase3.test.ts index f6f2332..46fa251 100644 --- a/src/protocol/phase3.test.ts +++ b/src/protocol/phase3.test.ts @@ -665,6 +665,8 @@ const MIN_ROLE: Record = { "server.backup.config.get": "viewer", "server.world.import": "editor", "tunnel.playit.status": "viewer", + "server.tunnel.get": "viewer", + "server.tunnel.create": "admin", "server.start": "operator", "server.stop": "operator", "server.restart": "operator", diff --git a/src/tunnel/index.ts b/src/tunnel/index.ts index 469bec5..865ae8b 100644 --- a/src/tunnel/index.ts +++ b/src/tunnel/index.ts @@ -21,6 +21,7 @@ export { getPlayitKeyPath, hasPlayitSecretKey, PLAYIT_KEY_FILENAME, + readPlayitSecretKey, savePlayitSecretKey, } from "./key"; export { @@ -36,3 +37,20 @@ export { type SpawnedTunnelProcess, type TunnelSpawnLike, } from "./playit"; +export { + createPlayitAccount, + PLAYIT_ACCOUNT_FILENAME, + type PlayitAccount, + type PlayitClaimView, + type PlayitServerTunnelView, + tunnelName, +} from "./playit-account"; +export { + createPlayitApi, + PLAYIT_API_BASE, + type PlayitAccountTunnel, + type PlayitApi, + PlayitApiFail, + pickConnectAddress, + playitClaimUrl, +} from "./playit-api"; diff --git a/src/tunnel/key.ts b/src/tunnel/key.ts index e923ec2..161bd1c 100644 --- a/src/tunnel/key.ts +++ b/src/tunnel/key.ts @@ -77,3 +77,9 @@ export function hasPlayitSecretKey(stateDir: string): boolean { return false; } } + +/** Reads the saved key, after the same checks as {@link assertPlayitSecretKey}. Never log it. */ +export function readPlayitSecretKey(stateDir: string): string { + const keyPath = assertPlayitSecretKey(stateDir); + return readFileSync(keyPath, "utf8").trim(); +} diff --git a/src/tunnel/playit-account.test.ts b/src/tunnel/playit-account.test.ts new file mode 100644 index 0000000..c217048 --- /dev/null +++ b/src/tunnel/playit-account.test.ts @@ -0,0 +1,268 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, describe, expect, test } from "bun:test"; +import { existsSync, mkdtempSync, rmSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { ProtocolError } from "../protocol"; +import { savePlayitSecretKey } from "./key"; +import type { PlayitTunnelManager } from "./playit"; +import { createPlayitAccount, PLAYIT_ACCOUNT_FILENAME, tunnelName } from "./playit-account"; +import { + type PlayitAccountTunnel, + type PlayitApi, + PlayitApiFail, + pickConnectAddress, +} from "./playit-api"; + +const KEY = "ab".repeat(32); +const dirs: string[] = []; + +afterEach(() => { + for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true }); +}); + +function stateDir(): string { + const dir = mkdtempSync(join(tmpdir(), "tegrad-playit-account-")); + dirs.push(dir); + return dir; +} + +function fakeTunnel(dir: string) { + const calls: string[] = []; + const manager = { + setKey(key: string) { + calls.push("setKey"); + savePlayitSecretKey(dir, key); + }, + async apply() { + calls.push("apply"); + return manager.status(); + }, + status: () => ({ + configured: true, + running: true, + pid: 1, + version: "test", + started_at: 0, + last_exit_code: null, + last_error: null, + }), + } as unknown as PlayitTunnelManager; + return { manager, calls }; +} + +function tunnel(id: string, port: number, address = "fun-cat.gl.joinmc.link"): PlayitAccountTunnel { + return { + id, + name: "Tegra Aged", + user_enabled: true, + offline_reasons: null, + tunnel_type: "minecraft-java", + origin: { + type: "agent", + details: { + agent_id: "agent-1", + config_data: { + fields: [ + { name: "local_ip", value: "127.0.0.1" }, + { name: "local_port", value: String(port) }, + ], + }, + }, + }, + connect_addresses: [{ type: "auto", value: { address } }], + }; +} + +async function until(check: () => boolean): Promise { + for (let i = 0; i < 200 && !check(); i++) await new Promise((resolve) => setTimeout(resolve, 1)); +} + +describe("playit claim", () => { + test("waits for approval, trades the code for a key, and starts the tunnel as self-managed", async () => { + const dir = stateDir(); + const { manager, calls } = fakeTunnel(dir); + const setup = ["WaitingForUserVisit", "WaitingForUser", "UserAccepted"]; + let exchanges = 0; + const seen: Array<{ code: string; type: string }> = []; + const api = { + async claimSetup(code: string, type: string) { + seen.push({ code, type }); + return setup.shift(); + }, + async claimExchange() { + exchanges++; + if (exchanges === 1) throw new PlayitApiFail("NotAccepted"); + return { secret_key: KEY }; + }, + } as unknown as PlayitApi; + const account = createPlayitAccount({ + stateDir: dir, + api, + tunnel: manager, + resolveServer: () => ({ name: "Aged", port: 25565 }), + sleep: async () => {}, + randomCode: () => "0a1b2c3d4e", + }); + + const started = account.beginClaim(); + expect(started).toMatchObject({ + code: "0a1b2c3d4e", + url: "https://playit.gg/claim/0a1b2c3d4e", + status: "waiting", + }); + await until(() => account.claimView()?.status !== "waiting"); + + expect(account.claimView()?.status).toBe("approved"); + expect(seen[0]).toEqual({ code: "0a1b2c3d4e", type: "self-managed" }); + expect(calls).toEqual(["setKey", "apply"]); + expect(account.isManaged()).toBe(true); + expect(account.keyHint()).toBe(KEY.slice(-4)); + }); + + test("a rejected claim saves nothing", async () => { + const dir = stateDir(); + const { manager, calls } = fakeTunnel(dir); + const api = { claimSetup: async () => "UserRejected" } as unknown as PlayitApi; + const account = createPlayitAccount({ + stateDir: dir, + api, + tunnel: manager, + resolveServer: () => ({ name: "Aged", port: 25565 }), + sleep: async () => {}, + }); + account.beginClaim(); + await until(() => account.claimView()?.status !== "waiting"); + expect(account.claimView()?.status).toBe("rejected"); + expect(calls).toEqual([]); + expect(existsSync(join(dir, PLAYIT_ACCOUNT_FILENAME))).toBe(false); + }); + + test("a cancelled claim stops polling", async () => { + const dir = stateDir(); + const { manager, calls } = fakeTunnel(dir); + const api = { claimSetup: async () => "WaitingForUser" } as unknown as PlayitApi; + const account = createPlayitAccount({ + stateDir: dir, + api, + tunnel: manager, + resolveServer: () => ({ name: "Aged", port: 25565 }), + sleep: () => new Promise((resolve) => setTimeout(resolve, 1)), + }); + account.beginClaim(); + expect(account.cancelClaim()?.status).toBe("cancelled"); + await new Promise((resolve) => setTimeout(resolve, 10)); + expect(account.claimView()?.status).toBe("cancelled"); + expect(calls).toEqual([]); + }); +}); + +describe("server tunnels", () => { + async function linkedAccount(api: Partial, getPort: () => number = () => 25565) { + const dir = stateDir(); + const { manager } = fakeTunnel(dir); + const account = createPlayitAccount({ + stateDir: dir, + api: { + claimSetup: async () => "UserAccepted", + claimExchange: async () => ({ secret_key: KEY }), + ...api, + } as PlayitApi, + tunnel: manager, + resolveServer: () => ({ name: "Aged 🌿", port: getPort() }), + sleep: async () => {}, + }); + account.beginClaim(); + await until(() => account.claimView()?.status === "approved"); + return account; + } + + test("creates the Minecraft tunnel once and reports its address", async () => { + const tunnels: PlayitAccountTunnel[] = []; + const created: Array<{ name: string; port: number; key: string }> = []; + const account = await linkedAccount({ + listTunnels: async () => ({ tunnels }), + createMinecraftTunnel: async (key, name, port) => { + created.push({ key, name, port }); + tunnels.push(tunnel("t-1", port)); + return { id: "t-1" }; + }, + }); + + expect(await account.getServerTunnel("aged")).toEqual({ managed: true, tunnel: null }); + const result = await account.createServerTunnel("aged"); + expect(created).toEqual([{ key: KEY, name: "Tegra Aged", port: 25565 }]); + expect(result.tunnel).toMatchObject({ + id: "t-1", + address: "fun-cat.gl.joinmc.link", + port_matches: true, + }); + + await account.createServerTunnel("aged"); + expect(created).toHaveLength(1); + }); + + test("points an existing tunnel at the server's new port", async () => { + const tunnels: PlayitAccountTunnel[] = []; + const moved: number[] = []; + let port = 25565; + const account = await linkedAccount( + { + listTunnels: async () => ({ tunnels }), + createMinecraftTunnel: async (_key, _name, at) => { + tunnels.push(tunnel("t-1", at)); + return { id: "t-1" }; + }, + setTunnelPort: async (_key, _id, next) => { + moved.push(next); + tunnels[0] = tunnel("t-1", next); + return null; + }, + }, + () => port, + ); + await account.createServerTunnel("aged"); + port = 25570; + expect((await account.getServerTunnel("aged")).tunnel?.port_matches).toBe(false); + const fixed = await account.createServerTunnel("aged"); + expect(moved).toEqual([25570]); + expect(fixed.tunnel?.port_matches).toBe(true); + }); + + test("a pasted key leaves tunnels to playit.gg", async () => { + const dir = stateDir(); + const { manager } = fakeTunnel(dir); + savePlayitSecretKey(dir, KEY); + const account = createPlayitAccount({ + stateDir: dir, + api: {} as PlayitApi, + tunnel: manager, + resolveServer: () => ({ name: "Aged", port: 25565 }), + }); + expect(await account.getServerTunnel("aged")).toEqual({ managed: false, tunnel: null }); + await expect(account.createServerTunnel("aged")).rejects.toBeInstanceOf(ProtocolError); + }); +}); + +describe("helpers", () => { + test("tunnel names are short ASCII", () => { + expect(tunnelName("Aged 🌿")).toBe("Tegra Aged"); + expect(tunnelName("Ação")).toBe("Tegra Acao"); + expect(tunnelName("x".repeat(80)).length).toBeLessThanOrEqual(32); + }); + + test("connect address prefers a domain, then the automatic name, then an IP", () => { + expect( + pickConnectAddress([ + { type: "ip4", value: { address: "1.2.3.4", default_port: 1234 } }, + { type: "auto", value: { address: "fun-cat.gl.joinmc.link" } }, + ]), + ).toBe("fun-cat.gl.joinmc.link"); + expect( + pickConnectAddress([{ type: "ip4", value: { address: "1.2.3.4", default_port: 1234 } }]), + ).toBe("1.2.3.4:1234"); + expect(pickConnectAddress([])).toBeNull(); + }); +}); diff --git a/src/tunnel/playit-account.ts b/src/tunnel/playit-account.ts new file mode 100644 index 0000000..51da052 --- /dev/null +++ b/src/tunnel/playit-account.ts @@ -0,0 +1,284 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { randomBytes } from "node:crypto"; +import { existsSync, readFileSync, rmSync } from "node:fs"; +import { join } from "node:path"; +import type { Logger } from "../agent/logger"; +import { writeFileAtomic } from "../agent/state"; +import { ProtocolError } from "../protocol"; +import { hasPlayitSecretKey, readPlayitSecretKey } from "./key"; +import type { PlayitTunnelManager } from "./playit"; +import { + type PlayitAccountTunnel, + type PlayitApi, + PlayitApiFail, + pickConnectAddress, + playitClaimUrl, + tunnelLocalPort, +} from "./playit-api"; + +/** Written when the key came from a claim, which makes the agent self-managed: it can create its own tunnels. */ +export const PLAYIT_ACCOUNT_FILENAME = "playit-account.json"; +const CLAIM_DEADLINE_MS = 10 * 60 * 1000; +const CLAIM_POLL_MS = 2_000; +const CLAIM_VERSION_TEXT = "Tegra Agent"; + +export type PlayitClaimStatus = + | "waiting" + | "approved" + | "rejected" + | "expired" + | "failed" + | "cancelled"; + +export interface PlayitClaimView { + readonly code: string; + readonly url: string; + readonly status: PlayitClaimStatus; + readonly error: string | null; + readonly started_at: number; +} + +export interface PlayitServerTunnelView { + readonly id: string; + readonly name: string | null; + readonly address: string | null; + readonly enabled: boolean; + readonly offline_reasons: readonly string[]; + readonly local_port: number | null; + /** False when the server's port changed after the tunnel was made; creating again fixes it. */ + readonly port_matches: boolean; +} + +interface AccountFile { + readonly v: 1; + readonly agent_type: "self-managed"; + readonly claimed_at: number; + /** server_id → playit tunnel id, so renaming a server never loses its tunnel. */ + readonly tunnels: Record; +} + +export interface PlayitAccountOptions { + readonly stateDir: string; + readonly api: PlayitApi; + readonly tunnel: PlayitTunnelManager; + readonly resolveServer: (serverId: string) => { readonly name: string; readonly port: number }; + readonly logger?: Logger; + readonly now?: () => number; + readonly sleep?: (ms: number) => Promise; + readonly randomCode?: () => string; +} + +export function createPlayitAccount(options: PlayitAccountOptions) { + const now = options.now ?? (() => Date.now()); + const sleep = + options.sleep ?? ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); + const randomCode = options.randomCode ?? (() => randomBytes(5).toString("hex")); + const accountPath = join(options.stateDir, PLAYIT_ACCOUNT_FILENAME); + + let claim: { view: PlayitClaimView; run: number } | null = null; + let claimRun = 0; + + function readAccount(): AccountFile | null { + if (!existsSync(accountPath)) return null; + try { + const parsed = JSON.parse(readFileSync(accountPath, "utf8")) as AccountFile; + return parsed.agent_type === "self-managed" + ? { ...parsed, tunnels: parsed.tunnels ?? {} } + : null; + } catch { + return null; + } + } + + function writeAccount(account: AccountFile): void { + writeFileAtomic(accountPath, `${JSON.stringify(account, null, 2)}\n`, { + mode: 0o600, + dirMode: 0o700, + }); + } + + /** A key pasted by hand may belong to any kind of agent, so tunnels go back to being made on playit.gg. */ + function forgetAccount(): void { + rmSync(accountPath, { force: true }); + } + + function isManaged(): boolean { + return readAccount() !== null && hasPlayitSecretKey(options.stateDir); + } + + function setClaim(run: number, patch: Partial): void { + if (claim === null || claim.run !== run) return; + claim = { run, view: { ...claim.view, ...patch } }; + } + + async function runClaim(run: number, code: string): Promise { + const deadline = now() + CLAIM_DEADLINE_MS; + const active = () => claim !== null && claim.run === run && claim.view.status === "waiting"; + try { + // 1. Wait for the user to approve the program on playit.gg. + for (;;) { + if (!active()) return; + if (now() > deadline) return setClaim(run, { status: "expired" }); + let state: string; + try { + state = await options.api.claimSetup(code, "self-managed", CLAIM_VERSION_TEXT); + } catch (error) { + if (error instanceof PlayitApiFail) { + const detail = String(error.detail); + return setClaim(run, { + status: detail === "CodeExpired" ? "expired" : "failed", + error: detail, + }); + } + throw error; + } + if (state === "UserAccepted") break; + if (state === "UserRejected") return setClaim(run, { status: "rejected" }); + await sleep(CLAIM_POLL_MS); + } + // 2. Trade the approved code for the agent's secret key. + let secretKey: string | null = null; + while (secretKey === null) { + if (!active()) return; + if (now() > deadline) return setClaim(run, { status: "expired" }); + try { + secretKey = (await options.api.claimExchange(code)).secret_key; + } catch (error) { + if (!(error instanceof PlayitApiFail)) throw error; + const detail = String(error.detail); + if (detail === "UserRejected") return setClaim(run, { status: "rejected" }); + if (detail === "CodeExpired" || detail === "CodeNotFound") + return setClaim(run, { status: "expired", error: detail }); + await sleep(CLAIM_POLL_MS); + } + } + if (!active()) return; + options.tunnel.setKey(secretKey); + writeAccount({ v: 1, agent_type: "self-managed", claimed_at: now(), tunnels: {} }); + setClaim(run, { status: "approved" }); + options.logger?.info("Linked the playit agent through a claim"); + await options.tunnel.apply(); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + options.logger?.warn("playit claim failed", { error: message }); + setClaim(run, { status: "failed", error: message }); + } + } + + function beginClaim(): PlayitClaimView { + const run = ++claimRun; + const code = randomCode(); + claim = { + run, + view: { code, url: playitClaimUrl(code), status: "waiting", error: null, started_at: now() }, + }; + void runClaim(run, code); + return claim.view; + } + + function cancelClaim(): PlayitClaimView | null { + if (claim !== null && claim.view.status === "waiting") { + claim = { ...claim, view: { ...claim.view, status: "cancelled" } }; + } + return claim?.view ?? null; + } + + function requireManaged(): { account: AccountFile; key: string } { + const account = readAccount(); + if (account === null || !hasPlayitSecretKey(options.stateDir)) { + throw new ProtocolError( + "tunnel_not_managed", + "This agent was linked with a pasted key; create the tunnel on playit.gg", + ); + } + return { account, key: readPlayitSecretKey(options.stateDir) }; + } + + function toView(tunnel: PlayitAccountTunnel, serverPort: number): PlayitServerTunnelView { + const localPort = tunnelLocalPort(tunnel); + return { + id: tunnel.id, + name: tunnel.name, + address: pickConnectAddress(tunnel.connect_addresses ?? []), + enabled: tunnel.user_enabled, + offline_reasons: tunnel.offline_reasons ?? [], + local_port: localPort, + port_matches: localPort === serverPort, + }; + } + + async function findServerTunnel(key: string, account: AccountFile, serverId: string) { + const tunnelId = account.tunnels[serverId]; + if (tunnelId === undefined) return null; + const { tunnels } = await options.api.listTunnels(key); + return tunnels.find((tunnel) => tunnel.id === tunnelId) ?? null; + } + + async function getServerTunnel(serverId: string) { + const server = options.resolveServer(serverId); + if (!isManaged()) return { managed: false, tunnel: null }; + const { account, key } = requireManaged(); + const found = await findServerTunnel(key, account, serverId); + return { managed: true, tunnel: found ? toView(found, server.port) : null }; + } + + async function createServerTunnel(serverId: string) { + const server = options.resolveServer(serverId); + const { account, key } = requireManaged(); + const existing = await findServerTunnel(key, account, serverId); + if (existing !== null) { + if (tunnelLocalPort(existing) !== server.port) { + await options.api.setTunnelPort(key, existing.id, server.port); + } + } else { + let created: { id: string }; + try { + created = await options.api.createMinecraftTunnel( + key, + tunnelName(server.name), + server.port, + ); + } catch (error) { + if (error instanceof PlayitApiFail) { + throw new ProtocolError( + "tunnel_api_failed", + `playit refused the tunnel: ${String(error.detail)}`, + ); + } + throw error; + } + writeAccount({ ...account, tunnels: { ...account.tunnels, [serverId]: created.id } }); + } + return getServerTunnel(serverId); + } + + function keyHint(): string | null { + if (!hasPlayitSecretKey(options.stateDir)) return null; + return readPlayitSecretKey(options.stateDir).slice(-4); + } + + return { + beginClaim, + cancelClaim, + claimView: () => claim?.view ?? null, + isManaged, + keyHint, + forgetAccount, + getServerTunnel, + createServerTunnel, + }; +} + +export type PlayitAccount = ReturnType; + +/** playit only takes short ASCII names. */ +export function tunnelName(serverName: string): string { + const ascii = serverName + .normalize("NFKD") + .replace(/[^\x20-\x7e]/g, "") + .replace(/\s+/g, " ") + .trim(); + return `Tegra ${ascii || "server"}`.slice(0, 32).trim(); +} diff --git a/src/tunnel/playit-api.ts b/src/tunnel/playit-api.ts new file mode 100644 index 0000000..28d0e05 --- /dev/null +++ b/src/tunnel/playit-api.ts @@ -0,0 +1,169 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { ProtocolError } from "../protocol"; +import type { TunnelFetchLike } from "./binary"; + +/** + * A small client for the playit.gg control API, the one the official agent talks to + * (see packages/api_client in playit-cloud/playit-agent). Every call is a JSON POST that + * answers `{status: "success" | "fail" | "error", data}`. + */ +export const PLAYIT_API_BASE = "https://api.playit.gg"; +export const PLAYIT_CLAIM_URL_BASE = "https://playit.gg/claim/"; +const DEFAULT_TIMEOUT_MS = 15_000; + +export type PlayitClaimAgentType = "assignable" | "self-managed"; +export type PlayitClaimSetupState = + | "WaitingForUserVisit" + | "WaitingForUser" + | "UserAccepted" + | "UserRejected"; + +export interface PlayitAgentTunnelAttr { + readonly name: string; + readonly value: string; +} + +export interface PlayitConnectAddress { + readonly type: string; + readonly value: { + readonly address?: string; + readonly default_port?: number; + readonly domain?: string; + }; +} + +export interface PlayitAccountTunnel { + readonly id: string; + readonly name: string | null; + readonly user_enabled: boolean; + readonly offline_reasons: readonly string[] | null; + readonly tunnel_type: string | null; + readonly origin: + | { + readonly type: "agent"; + readonly details: { + readonly agent_id: string; + readonly config_data: { readonly fields: readonly PlayitAgentTunnelAttr[] }; + }; + } + | { readonly type: "not-set"; readonly details: unknown }; + readonly connect_addresses: readonly PlayitConnectAddress[]; +} + +export interface PlayitApiOptions { + readonly fetchImpl?: TunnelFetchLike; + readonly baseUrl?: string; + readonly timeoutMs?: number; +} + +/** A "fail" answer: an expected refusal such as a claim that is not approved yet. */ +export class PlayitApiFail extends Error { + constructor(readonly detail: unknown) { + super(`playit refused the request: ${JSON.stringify(detail)}`); + this.name = "PlayitApiFail"; + } +} + +export function playitClaimUrl(code: string): string { + return `${PLAYIT_CLAIM_URL_BASE}${code}`; +} + +export function createPlayitApi(options: PlayitApiOptions = {}) { + const fetchImpl = options.fetchImpl ?? (fetch as unknown as TunnelFetchLike); + const baseUrl = options.baseUrl ?? PLAYIT_API_BASE; + const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS; + + async function call(path: string, body: unknown, secretKey?: string): Promise { + const headers: Record = { "content-type": "application/json" }; + if (secretKey !== undefined) headers.authorization = `Agent-Key ${secretKey.trim()}`; + let response: Response; + try { + response = await fetchImpl(`${baseUrl}${path}`, { + method: "POST", + headers, + body: JSON.stringify(body), + signal: AbortSignal.timeout(timeoutMs), + }); + } catch { + throw new ProtocolError("tunnel_api_failed", "Could not reach playit.gg"); + } + let payload: { status?: string; data?: unknown }; + try { + payload = (await response.json()) as { status?: string; data?: unknown }; + } catch { + throw new ProtocolError( + "tunnel_api_failed", + `playit.gg answered ${response.status} without JSON`, + ); + } + if (payload.status === "success") return payload.data as T; + if (payload.status === "fail") throw new PlayitApiFail(payload.data); + throw new ProtocolError( + "tunnel_api_failed", + `playit.gg error: ${JSON.stringify(payload.data ?? response.status)}`, + ); + } + + return { + claimSetup: (code: string, agentType: PlayitClaimAgentType, version: string) => + call("/claim/setup", { code, agent_type: agentType, version }), + claimExchange: (code: string) => call<{ secret_key: string }>("/claim/exchange", { code }), + listTunnels: (secretKey: string) => + call<{ tunnels: PlayitAccountTunnel[] }>("/v1/tunnels/list", {}, secretKey), + createMinecraftTunnel: (secretKey: string, name: string, localPort: number) => + call<{ id: string }>( + "/v1/tunnels/create", + { + ports: { type: "tunnel-type", details: "minecraft-java" }, + origin: { + type: "agent", + data: { agent_id: null, config: { fields: localFields(localPort) } }, + }, + enabled: true, + alloc: null, + name, + firewall_id: null, + }, + secretKey, + ), + setTunnelPort: (secretKey: string, tunnelId: string, localPort: number) => + call( + "/v1/tunnels/config", + { tunnel_id: tunnelId, new_agent_id: null, new_config: { fields: localFields(localPort) } }, + secretKey, + ), + }; +} + +export type PlayitApi = ReturnType; + +function localFields(localPort: number): PlayitAgentTunnelAttr[] { + return [ + { name: "local_ip", value: "127.0.0.1" }, + { name: "local_port", value: String(localPort) }, + ]; +} + +/** The address players type: a domain first, then the automatic name, then a raw IP. */ +export function pickConnectAddress(addresses: readonly PlayitConnectAddress[]): string | null { + const order = ["domain", "auto", "addr4", "ip4", "addr6", "ip6"]; + for (const type of order) { + const found = addresses.find((entry) => entry.type === type); + if (!found) continue; + if (type === "ip4" || type === "ip6") { + const port = found.value.default_port; + return port ? `${found.value.address}:${port}` : (found.value.address ?? null); + } + if (found.value.address) return found.value.address; + } + return null; +} + +export function tunnelLocalPort(tunnel: PlayitAccountTunnel): number | null { + if (tunnel.origin.type !== "agent") return null; + const field = tunnel.origin.details.config_data.fields.find((attr) => attr.name === "local_port"); + const port = field ? Number.parseInt(field.value, 10) : Number.NaN; + return Number.isInteger(port) ? port : null; +} diff --git a/src/tunnel/playit.ts b/src/tunnel/playit.ts index fba7acd..c708255 100644 --- a/src/tunnel/playit.ts +++ b/src/tunnel/playit.ts @@ -13,6 +13,7 @@ import { type TunnelFetchLike, } from "./binary"; import { assertPlayitSecretKey, hasPlayitSecretKey, savePlayitSecretKey } from "./key"; +import type { PlayitAccount } from "./playit-account"; export const DEFAULT_TUNNEL_STOP_TIMEOUT_MS = 5_000; @@ -384,14 +385,26 @@ export function createPlayitTunnelManager( }; } -export function registerTunnelHandlers(queue: CommandQueue, manager: PlayitTunnelManager): void { +export function registerTunnelHandlers( + queue: CommandQueue, + manager: PlayitTunnelManager, + account?: PlayitAccount, +): void { + const statusView = () => ({ + ...manager.status(), + managed: account?.isManaged() ?? false, + key_hint: account?.keyHint() ?? null, + claim: account?.claimView() ?? null, + }); + // Saving a key brings the tunnel up with it (or restarts it on the new key); a start // failure does not undo the save, it shows in `last_error`. queue.registerHandler("tunnel.playit.set_key", async (opened, ctx) => { const body = opened.body as TunnelPlayitSetKeyBody; manager.setKey(body.secret_key); - const current = await manager.apply(); - ctx.sendEvent("tunnel.playit.key_updated", current); + account?.forgetAccount(); + await manager.apply(); + ctx.sendEvent("tunnel.playit.key_updated", statusView()); }); queue.registerHandler("tunnel.playit.start", async (_opened, ctx) => { @@ -407,7 +420,39 @@ export function registerTunnelHandlers(queue: CommandQueue, manager: PlayitTunne }); queue.registerHandler("tunnel.playit.status", (_opened, ctx) => { - const current = manager.status(); - ctx.sendEvent("tunnel.playit.status.result", current); + ctx.sendEvent("tunnel.playit.status.result", statusView()); + }); + + if (account === undefined) return; + + queue.registerHandler("tunnel.playit.claim.begin", (_opened, ctx) => { + ctx.sendEvent("tunnel.playit.claim.started", account.beginClaim()); + }); + + queue.registerHandler("tunnel.playit.claim.status", (_opened, ctx) => { + ctx.sendEvent("tunnel.playit.claim.status.result", { + claim: account.claimView(), + status: statusView(), + }); + }); + + queue.registerHandler("tunnel.playit.claim.cancel", (_opened, ctx) => { + ctx.sendEvent("tunnel.playit.claim.cancelled", { claim: account.cancelClaim() }); + }); + + queue.registerHandler("server.tunnel.get", async (opened, ctx) => { + const body = opened.body as { server_id: string }; + ctx.sendEvent("server.tunnel.result", { + server_id: body.server_id, + ...(await account.getServerTunnel(body.server_id)), + }); + }); + + queue.registerHandler("server.tunnel.create", async (opened, ctx) => { + const body = opened.body as { server_id: string }; + ctx.sendEvent("server.tunnel.created", { + server_id: body.server_id, + ...(await account.createServerTunnel(body.server_id)), + }); }); } From e610f44a510cb04c42ddeac09ceb61f4327bd066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 29 Nov 2026 02:42:37 -0300 Subject: [PATCH 52/59] build(lib): rebuild for playit claim and server tunnels --- .../{index-jbj4v5jg.js => index-mcj62q8t.js} | 40 ++++++++++++++++++- lib/protocol/index.js | 14 ++++++- lib/types/protocol/commands/tunnel.d.ts | 21 +++++++++- lib/types/protocol/errors.d.ts | 2 +- lib/types/protocol/index.d.ts | 2 +- lib/vault/index.js | 2 +- 6 files changed, 74 insertions(+), 7 deletions(-) rename lib/chunks/{index-jbj4v5jg.js => index-mcj62q8t.js} (97%) diff --git a/lib/chunks/index-jbj4v5jg.js b/lib/chunks/index-mcj62q8t.js similarity index 97% rename from lib/chunks/index-jbj4v5jg.js rename to lib/chunks/index-mcj62q8t.js index 982842e..e8df29f 100644 --- a/lib/chunks/index-jbj4v5jg.js +++ b/lib/chunks/index-mcj62q8t.js @@ -1924,11 +1924,47 @@ var tunnelPlayitStatusCommand = defineCommand({ minRole: "viewer", body: z12.object({}).strict() }); +var tunnelPlayitClaimBeginCommand = defineCommand({ + type: "tunnel.playit.claim.begin", + level: "sudo", + minRole: "admin", + body: z12.object({}).strict() +}); +var tunnelPlayitClaimStatusCommand = defineCommand({ + type: "tunnel.playit.claim.status", + level: "session", + minRole: "admin", + body: z12.object({}).strict() +}); +var tunnelPlayitClaimCancelCommand = defineCommand({ + type: "tunnel.playit.claim.cancel", + level: "session", + minRole: "admin", + body: z12.object({}).strict() +}); +var serverTunnelBodySchema = z12.object({ server_id: serverIdSchema }).strict(); +var serverTunnelGetCommand = defineCommand({ + type: "server.tunnel.get", + level: "session", + minRole: "viewer", + body: serverTunnelBodySchema +}); +var serverTunnelCreateCommand = defineCommand({ + type: "server.tunnel.create", + level: "session", + minRole: "admin", + body: serverTunnelBodySchema +}); var TUNNEL_COMMANDS = [ tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, - tunnelPlayitStatusCommand + tunnelPlayitStatusCommand, + tunnelPlayitClaimBeginCommand, + tunnelPlayitClaimStatusCommand, + tunnelPlayitClaimCancelCommand, + serverTunnelGetCommand, + serverTunnelCreateCommand ]; function registerTunnelCommands(registry) { return registry.registerAll(TUNNEL_COMMANDS); @@ -2306,4 +2342,4 @@ function createInMemoryTrustContext(options) { } }; } -export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, MAX_ELEVATED_SESSION_MS, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, minecraftVersionSchema, loaderVersionSchema, serverCreateBodySchema, serverChangeRuntimeBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverStatsBodySchema, serverStatsResultSchema, serverCreateCommand, serverChangeRuntimeCommand, serverRestartCommand, serverStatusCommand, serverStatsCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, BACKUP_UPLOAD_STATES, backupUploadStateSchema, serverBackupUploadEventSchema, pendingBackupUploadSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, hostInfoBodySchema, hostInfoResultSchema, hostInfoCommand, HOST_COMMANDS, registerHostCommands, MODPACK_SOURCES, modpackSourceSchema, MODPACK_INSTALL_PHASES, modpackInstallPhaseSchema, MODPACK_INSTALL_JOB_STATES, modpackInstallJobStateSchema, MODPACK_INSTALL_ERROR_CODES, modpackInstallErrorCodeSchema, modpackInstallSkippedItemSchema, serverInstallModpackBodySchema, serverInstallModpackStatusBodySchema, serverInstallModpackCancelBodySchema, serverInstallModpackAcceptedEventSchema, serverInstallModpackProgressEventSchema, serverInstallModpackResultEventSchema, modpackInstallJobStatusSchema, serverInstallModpackStatusResultSchema, serverInstallModpackCommand, serverInstallModpackStatusCommand, serverInstallModpackCancelCommand, MODPACK_COMMANDS, registerModpackCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverModsToggleBodySchema, serverModsReplaceBodySchema, serverModsIdentifyBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverModsToggleCommand, serverModsReplaceCommand, serverModsIdentifyCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; +export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, MAX_ELEVATED_SESSION_MS, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, minecraftVersionSchema, loaderVersionSchema, serverCreateBodySchema, serverChangeRuntimeBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverStatsBodySchema, serverStatsResultSchema, serverCreateCommand, serverChangeRuntimeCommand, serverRestartCommand, serverStatusCommand, serverStatsCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, BACKUP_UPLOAD_STATES, backupUploadStateSchema, serverBackupUploadEventSchema, pendingBackupUploadSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, hostInfoBodySchema, hostInfoResultSchema, hostInfoCommand, HOST_COMMANDS, registerHostCommands, MODPACK_SOURCES, modpackSourceSchema, MODPACK_INSTALL_PHASES, modpackInstallPhaseSchema, MODPACK_INSTALL_JOB_STATES, modpackInstallJobStateSchema, MODPACK_INSTALL_ERROR_CODES, modpackInstallErrorCodeSchema, modpackInstallSkippedItemSchema, serverInstallModpackBodySchema, serverInstallModpackStatusBodySchema, serverInstallModpackCancelBodySchema, serverInstallModpackAcceptedEventSchema, serverInstallModpackProgressEventSchema, serverInstallModpackResultEventSchema, modpackInstallJobStatusSchema, serverInstallModpackStatusResultSchema, serverInstallModpackCommand, serverInstallModpackStatusCommand, serverInstallModpackCancelCommand, MODPACK_COMMANDS, registerModpackCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverModsToggleBodySchema, serverModsReplaceBodySchema, serverModsIdentifyBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverModsToggleCommand, serverModsReplaceCommand, serverModsIdentifyCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, tunnelPlayitClaimBeginCommand, tunnelPlayitClaimStatusCommand, tunnelPlayitClaimCancelCommand, serverTunnelBodySchema, serverTunnelGetCommand, serverTunnelCreateCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; diff --git a/lib/protocol/index.js b/lib/protocol/index.js index 076c5dd..85c453b 100644 --- a/lib/protocol/index.js +++ b/lib/protocol/index.js @@ -236,6 +236,9 @@ import { serverStatusChangedSchema, serverStatusCommand, serverStopCommand, + serverTunnelBodySchema, + serverTunnelCreateCommand, + serverTunnelGetCommand, serverUpdateSettingsBodySchema, serverUpdateSettingsCommand, serverWorldImportBodySchema, @@ -260,6 +263,9 @@ import { transportHelloFrameSchema, transportPingFrameSchema, trustGrantSchema, + tunnelPlayitClaimBeginCommand, + tunnelPlayitClaimCancelCommand, + tunnelPlayitClaimStatusCommand, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, @@ -273,7 +279,7 @@ import { verifyTrustGrant, worldNameSchema, wrapEventBody -} from "../chunks/index-jbj4v5jg.js"; +} from "../chunks/index-mcj62q8t.js"; import"../chunks/index-g1frygvt.js"; export { wrapEventBody, @@ -289,6 +295,9 @@ export { tunnelPlayitStartCommand, tunnelPlayitSetKeyCommand, tunnelPlayitSetKeyBodySchema, + tunnelPlayitClaimStatusCommand, + tunnelPlayitClaimCancelCommand, + tunnelPlayitClaimBeginCommand, trustGrantSchema, transportPingFrameSchema, transportHelloFrameSchema, @@ -313,6 +322,9 @@ export { serverWorldImportBodySchema, serverUpdateSettingsCommand, serverUpdateSettingsBodySchema, + serverTunnelGetCommand, + serverTunnelCreateCommand, + serverTunnelBodySchema, serverStopCommand, serverStatusCommand, serverStatusChangedSchema, diff --git a/lib/types/protocol/commands/tunnel.d.ts b/lib/types/protocol/commands/tunnel.d.ts index 5fb1fe8..4caca96 100644 --- a/lib/types/protocol/commands/tunnel.d.ts +++ b/lib/types/protocol/commands/tunnel.d.ts @@ -12,7 +12,26 @@ export declare const tunnelPlayitSetKeyCommand: import("..").CommandDefinition<" export declare const tunnelPlayitStartCommand: import("..").CommandDefinition<"tunnel.playit.start", Record>; export declare const tunnelPlayitStopCommand: import("..").CommandDefinition<"tunnel.playit.stop", Record>; export declare const tunnelPlayitStatusCommand: import("..").CommandDefinition<"tunnel.playit.status", Record>; +/** Links the agent to playit.gg through the browser, without copying a key: tegrad gets a self-managed agent. */ +export declare const tunnelPlayitClaimBeginCommand: import("..").CommandDefinition<"tunnel.playit.claim.begin", Record>; +export declare const tunnelPlayitClaimStatusCommand: import("..").CommandDefinition<"tunnel.playit.claim.status", Record>; +export declare const tunnelPlayitClaimCancelCommand: import("..").CommandDefinition<"tunnel.playit.claim.cancel", Record>; +export declare const serverTunnelBodySchema: z.ZodObject<{ + server_id: z.ZodString; +}, z.core.$strict>; +/** The server's playit tunnel and its public address, when the agent manages its own tunnels. */ +export declare const serverTunnelGetCommand: import("..").CommandDefinition<"server.tunnel.get", { + server_id: string; +}>; +/** Creates the server's Minecraft Java tunnel on playit (or points it at the server's current port). */ +export declare const serverTunnelCreateCommand: import("..").CommandDefinition<"server.tunnel.create", { + server_id: string; +}>; export declare const TUNNEL_COMMANDS: readonly [import("..").CommandDefinition<"tunnel.playit.set_key", { secret_key: string; -}>, import("..").CommandDefinition<"tunnel.playit.start", Record>, import("..").CommandDefinition<"tunnel.playit.stop", Record>, import("..").CommandDefinition<"tunnel.playit.status", Record>]; +}>, import("..").CommandDefinition<"tunnel.playit.start", Record>, import("..").CommandDefinition<"tunnel.playit.stop", Record>, import("..").CommandDefinition<"tunnel.playit.status", Record>, import("..").CommandDefinition<"tunnel.playit.claim.begin", Record>, import("..").CommandDefinition<"tunnel.playit.claim.status", Record>, import("..").CommandDefinition<"tunnel.playit.claim.cancel", Record>, import("..").CommandDefinition<"server.tunnel.get", { + server_id: string; +}>, import("..").CommandDefinition<"server.tunnel.create", { + server_id: string; +}>]; export declare function registerTunnelCommands(registry: CommandRegistry): CommandRegistry; diff --git a/lib/types/protocol/errors.d.ts b/lib/types/protocol/errors.d.ts index d9db0a6..2f59f6b 100644 --- a/lib/types/protocol/errors.d.ts +++ b/lib/types/protocol/errors.d.ts @@ -1,4 +1,4 @@ -export type ProtocolErrorCode = "invalid_format" | "unsupported_version" | "wrong_agent" | "wrong_recipient" | "expired" | "not_yet_valid" | "ttl_too_long" | "untrusted_signer" | "bad_signature" | "session_invalid" | "session_revoked" | "replayed" | "unknown_command" | "invalid_body" | "elevation_required" | "elevation_invalid" | "account_key_required" | "decrypt_failed" | "insufficient_role" | "too_many_subscribers" | "role_grant_invalid" | "auth_invalid" | "request_invalid" | "grant_invalid" | "grant_wrong_agent" | "grant_expired" | "grant_bad_signature" | "grant_proof_required" | "grant_bad_proof" | "revocation_stale" | "revocation_not_superset" | "insufficient_memory" | "eula_not_accepted" | "server_not_found" | "server_already_exists" | "server_running" | "server_stopped" | "invalid_jvm_args" | "download_failed" | "hash_mismatch" | "systemd_error" | "perms_unavailable" | "origin_locked" | "plan_not_found" | "plan_expired" | "plan_stale" | "mod_not_found" | "mod_conflict" | "mod_already_exists" | "backup_not_found" | "backup_failed" | "backup_config_invalid" | "tunnel_not_configured" | "tunnel_already_running" | "tunnel_not_running" | "tunnel_failed" | "pack_unavailable" | "runtime_mismatch" | "host_not_allowed" | "too_large" | "install_in_progress" | "api_unavailable" | "io_error" | "cancelled"; +export type ProtocolErrorCode = "invalid_format" | "unsupported_version" | "wrong_agent" | "wrong_recipient" | "expired" | "not_yet_valid" | "ttl_too_long" | "untrusted_signer" | "bad_signature" | "session_invalid" | "session_revoked" | "replayed" | "unknown_command" | "invalid_body" | "elevation_required" | "elevation_invalid" | "account_key_required" | "decrypt_failed" | "insufficient_role" | "too_many_subscribers" | "role_grant_invalid" | "auth_invalid" | "request_invalid" | "grant_invalid" | "grant_wrong_agent" | "grant_expired" | "grant_bad_signature" | "grant_proof_required" | "grant_bad_proof" | "revocation_stale" | "revocation_not_superset" | "insufficient_memory" | "eula_not_accepted" | "server_not_found" | "server_already_exists" | "server_running" | "server_stopped" | "invalid_jvm_args" | "download_failed" | "hash_mismatch" | "systemd_error" | "perms_unavailable" | "origin_locked" | "plan_not_found" | "plan_expired" | "plan_stale" | "mod_not_found" | "mod_conflict" | "mod_already_exists" | "backup_not_found" | "backup_failed" | "backup_config_invalid" | "tunnel_not_configured" | "tunnel_already_running" | "tunnel_not_running" | "tunnel_failed" | "tunnel_not_managed" | "tunnel_api_failed" | "pack_unavailable" | "runtime_mismatch" | "host_not_allowed" | "too_large" | "install_in_progress" | "api_unavailable" | "io_error" | "cancelled"; export declare class ProtocolError extends Error { readonly code: ProtocolErrorCode; constructor(code: ProtocolErrorCode, message: string); diff --git a/lib/types/protocol/index.d.ts b/lib/types/protocol/index.d.ts index 8521e8d..7ebc916 100644 --- a/lib/types/protocol/index.d.ts +++ b/lib/types/protocol/index.d.ts @@ -10,7 +10,7 @@ export { MODPACK_COMMANDS, MODPACK_INSTALL_ERROR_CODES, MODPACK_INSTALL_JOB_STAT export { agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, } from "./commands/pairing"; export { consoleLineSchema, DEFAULT_SERVER_PORT, loaderVersionSchema, MAX_CONSOLE_LINE_LENGTH, MAX_JVM_ARGS, MAX_SERVER_MEMORY_MB, MIN_SERVER_MEMORY_MB, minecraftVersionSchema, registerServerCommands, SERVER_COMMANDS, SERVER_ID_REGEX, type ServerChangeRuntimeBody, type ServerConsoleSendBody, type ServerConsoleSubscribeBody, type ServerCreateBody, type ServerLoader, type ServerStatsBody, type ServerStatsResult, type ServerUpdateSettingsBody, serverChangeRuntimeBodySchema, serverChangeRuntimeCommand, serverConsoleSendBodySchema, serverConsoleSendCommand, serverConsoleSubscribeBodySchema, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, serverCreateBodySchema, serverCreateCommand, serverIdSchema, serverListCommand, serverLoaderSchema, serverMemoryMbSchema, serverPortSchema, serverRestartCommand, serverStatsBodySchema, serverStatsCommand, serverStatsResultSchema, serverStatusCommand, serverUpdateSettingsBodySchema, serverUpdateSettingsCommand, } from "./commands/server"; export { blobKeySchema, type ModEnvironmentInfo, type ModLayer, type ModSource, modEnvironmentInfoSchema, modFileNameSchema, modLayerSchema, modSourceSchema, type OriginPlanFileInput, type OriginPlanModInput, originPlanFileInputSchema, originPlanModInputSchema, RESERVED_WORLD_NAMES, registerStateCommands, type ServerDeployServerpackBody, type ServerModEntry, type ServerModsIdentifyBody, type ServerModsInstallBody, type ServerModsListBody, type ServerModsRemoveBody, type ServerModsReplaceBody, type ServerModsToggleBody, type ServerOrigin, type ServerOriginApplyBody, type ServerOriginPlanBody, type ServerOriginSyncState, type ServerOriginUnlinkBody, type ServerWorldImportBody, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, STATE_COMMANDS, serverDeployServerpackBodySchema, serverDeployServerpackCommand, serverModEntrySchema, serverModsIdentifyBodySchema, serverModsIdentifyCommand, serverModsInstallBodySchema, serverModsInstallCommand, serverModsListBodySchema, serverModsListCommand, serverModsRemoveBodySchema, serverModsRemoveCommand, serverModsReplaceBodySchema, serverModsReplaceCommand, serverModsToggleBodySchema, serverModsToggleCommand, serverOriginApplyBodySchema, serverOriginApplyCommand, serverOriginPlanBodySchema, serverOriginPlanCommand, serverOriginSchema, serverOriginSyncStateSchema, serverOriginUnlinkBodySchema, serverOriginUnlinkCommand, serverWorldImportBodySchema, serverWorldImportCommand, sha1HexSchema, sha512HexSchema, WORLD_NAME_REGEX, worldNameSchema, } from "./commands/state"; -export { PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, registerTunnelCommands, TUNNEL_COMMANDS, type TunnelPlayitSetKeyBody, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStatusCommand, tunnelPlayitStopCommand, } from "./commands/tunnel"; +export { PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, registerTunnelCommands, serverTunnelBodySchema, serverTunnelCreateCommand, serverTunnelGetCommand, TUNNEL_COMMANDS, type TunnelPlayitSetKeyBody, tunnelPlayitClaimBeginCommand, tunnelPlayitClaimCancelCommand, tunnelPlayitClaimStatusCommand, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStatusCommand, tunnelPlayitStopCommand, } from "./commands/tunnel"; export { DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_AGENT_MESSAGE, DOMAIN_COMMAND, DOMAIN_PAIRING_PROOF, DOMAIN_REVOCATION, DOMAIN_ROLE_GRANT, DOMAIN_SESSION, DOMAIN_TRUST_GRANT, PROTOCOL_VERSION, } from "./domains"; export { ProtocolError, type ProtocolErrorCode } from "./errors"; export { type BuildPairingFragmentParams, buildPairingFragment, DEFAULT_TRUST_GRANT_TTL_MS, generatePairingCode, generatePairingSecret, MAX_TRUST_GRANT_TTL_MS, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, type PairingFragment, pairingCodeSchema, parsePairingFragment, type SignTrustGrantParams, signTrustGrant, type TrustGrant, trustGrantSchema, type VerifiedTrustGrant, type VerifyTrustGrantOptions, verifyTrustGrant, } from "./pairing"; diff --git a/lib/vault/index.js b/lib/vault/index.js index 14ed352..3c32a86 100644 --- a/lib/vault/index.js +++ b/lib/vault/index.js @@ -6,7 +6,7 @@ import { sessionCertificateSchema, signRevocationList, signSessionCertificate -} from "../chunks/index-jbj4v5jg.js"; +} from "../chunks/index-mcj62q8t.js"; import { KDF_ALG_ARGON2ID13, KDF_MODERATE, From 1c4f2ac698bd830df9a172f86ae921e8be83b80a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 29 Nov 2026 03:22:26 -0300 Subject: [PATCH 53/59] fix(tunnel): create playit tunnels with the current API; console tail and history - /v1/tunnels/create takes name, protocol, origin with the agent id and an endpoint (shared global region), as playit's own Minecraft plugin sends; the older ports/alloc body was refused as unparsable. The agent id is read from /v1/agents/rundata, stored, and reported as agent_id_hint. - A Minecraft tunnel of the agent already aimed at the server port is adopted instead of creating a second one. - server.console.subscribe takes tail_lines to start near the end of the log, lines events carry from_offset, and server.console.history returns the lines before an offset so the console can page back on scroll. --- src/protocol/commands/server.ts | 19 +++++++ src/protocol/index.ts | 2 + src/protocol/phase3.test.ts | 1 + src/server/console-history.test.ts | 46 +++++++++++++++ src/server/console.ts | 90 +++++++++++++++++++++++++++++- src/server/runtime.ts | 48 +++++++++++++++- src/tunnel/playit-account.test.ts | 33 +++++++++-- src/tunnel/playit-account.ts | 40 ++++++++++++- src/tunnel/playit-api.ts | 18 ++++-- src/tunnel/playit.ts | 1 + 10 files changed, 283 insertions(+), 15 deletions(-) create mode 100644 src/server/console-history.test.ts diff --git a/src/protocol/commands/server.ts b/src/protocol/commands/server.ts index 3b99a7d..5a7db9f 100644 --- a/src/protocol/commands/server.ts +++ b/src/protocol/commands/server.ts @@ -87,6 +87,16 @@ export const serverConsoleSubscribeBodySchema = z .object({ server_id: serverIdSchema, from_offset: z.number().int().nonnegative().optional(), + /** Without from_offset: start this many lines before the end, not at the top of the log. */ + tail_lines: z.number().int().min(1).max(5000).optional(), + }) + .strict(); + +export const serverConsoleHistoryBodySchema = z + .object({ + server_id: serverIdSchema, + before_offset: z.number().int().nonnegative(), + max_lines: z.number().int().min(1).max(1000), }) .strict(); @@ -176,6 +186,14 @@ export const serverConsoleSubscribeCommand = defineCommand({ body: serverConsoleSubscribeBodySchema, }); +/** Lines that come before an offset, so the console can load older output while scrolling up. */ +export const serverConsoleHistoryCommand = defineCommand({ + type: "server.console.history", + level: "session", + minRole: "viewer", + body: serverConsoleHistoryBodySchema, +}); + export const serverConsoleUnsubscribeCommand = defineCommand({ type: "server.console.unsubscribe", level: "session", @@ -194,6 +212,7 @@ export const SERVER_COMMANDS = [ serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, + serverConsoleHistoryCommand, ] as const; export function registerServerCommands(registry: CommandRegistry): CommandRegistry { diff --git a/src/protocol/index.ts b/src/protocol/index.ts index 0364dc4..e419cdc 100644 --- a/src/protocol/index.ts +++ b/src/protocol/index.ts @@ -217,6 +217,8 @@ export { type ServerUpdateSettingsBody, serverChangeRuntimeBodySchema, serverChangeRuntimeCommand, + serverConsoleHistoryBodySchema, + serverConsoleHistoryCommand, serverConsoleSendBodySchema, serverConsoleSendCommand, serverConsoleSubscribeBodySchema, diff --git a/src/protocol/phase3.test.ts b/src/protocol/phase3.test.ts index 46fa251..160fdd5 100644 --- a/src/protocol/phase3.test.ts +++ b/src/protocol/phase3.test.ts @@ -658,6 +658,7 @@ const MIN_ROLE: Record = { "server.list": "viewer", "server.console.subscribe": "viewer", "server.console.unsubscribe": "viewer", + "server.console.history": "viewer", "files.list": "viewer", "files.stat": "viewer", "server.mods.list": "viewer", diff --git a/src/server/console-history.test.ts b/src/server/console-history.test.ts new file mode 100644 index 0000000..ff2f928 --- /dev/null +++ b/src/server/console-history.test.ts @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, describe, expect, test } from "bun:test"; +import { mkdtempSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { findLinesStart, readConsoleHistory } from "./console"; + +const dirs: string[] = []; +afterEach(() => { + for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true }); +}); + +function log(lines: number): string { + const dir = mkdtempSync(join(tmpdir(), "tegrad-console-history-")); + dirs.push(dir); + const path = join(dir, "console.log"); + writeFileSync(path, Array.from({ length: lines }, (_, i) => `line ${i + 1}\n`).join("")); + return path; +} + +describe("console tail and history", () => { + test("finds where the last lines start", () => { + const path = log(10); + const start = findLinesStart(path, Number.POSITIVE_INFINITY, 3); + expect(readConsoleHistory(path, Number.POSITIVE_INFINITY, 3)).toEqual({ + lines: ["line 8", "line 9", "line 10"], + start_offset: start, + }); + }); + + test("pages back from an offset until the top of the log", () => { + const path = log(10); + const first = readConsoleHistory(path, Number.POSITIVE_INFINITY, 4); + const older = readConsoleHistory(path, first.start_offset, 4); + expect(older.lines).toEqual(["line 3", "line 4", "line 5", "line 6"]); + const oldest = readConsoleHistory(path, older.start_offset, 4); + expect(oldest).toEqual({ lines: ["line 1", "line 2"], start_offset: 0 }); + }); + + test("asking for more lines than exist starts at the top", () => { + const path = log(2); + expect(findLinesStart(path, Number.POSITIVE_INFINITY, 50)).toBe(0); + }); +}); diff --git a/src/server/console.ts b/src/server/console.ts index 1751368..f68f7e1 100644 --- a/src/server/console.ts +++ b/src/server/console.ts @@ -100,9 +100,89 @@ export function sendConsoleLine(options: SendConsoleLineOptions): void { writer(fifoPath, `${parsedLine.data}\n`); } +const BACK_SCAN_CHUNK = 64 * 1024; +const BACK_SCAN_LIMIT = 4 * 1024 * 1024; +const MAX_HISTORY_BYTES = 512 * 1024; + +function openLog(logPath: string): number | null { + const lstat = lstatSync(logPath, { throwIfNoEntry: false }); + if (lstat === undefined || lstat.isSymbolicLink() || !lstat.isFile()) return null; + try { + return openSync(logPath, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0)); + } catch { + return null; + } +} + +/** + * The offset where the last `maxLines` complete lines before `endOffset` begin. Reads the log + * backwards in chunks and gives up after a few MiB, so a log of huge lines stays cheap. + */ +export function findLinesStart(logPath: string, endOffset: number, maxLines: number): number { + const fd = openLog(logPath); + if (fd === null) return 0; + try { + const end = Math.min(endOffset, statSync(logPath).size); + // The newline that ends the last line is not a boundary between lines. + let pos = end; + let found = 0; + const buffer = Buffer.allocUnsafe(BACK_SCAN_CHUNK); + while (pos > 0 && end - pos < BACK_SCAN_LIMIT) { + const size = Math.min(BACK_SCAN_CHUNK, pos); + const start = pos - size; + const read = readSync(fd, buffer, 0, size, start); + for (let i = read - 1; i >= 0; i--) { + const at = start + i; + if (buffer[i] !== 0x0a || at === end - 1) continue; + found++; + if (found === maxLines) return at + 1; + } + pos = start; + } + return pos; + } catch { + return 0; + } finally { + closeSync(fd); + } +} + +export interface ConsoleHistory { + readonly lines: string[]; + readonly start_offset: number; +} + +/** Up to `maxLines` lines that come right before `beforeOffset`, for scrolling back. */ +export function readConsoleHistory( + logPath: string, + beforeOffset: number, + maxLines: number, +): ConsoleHistory { + let start = findLinesStart(logPath, beforeOffset, maxLines); + const fd = openLog(logPath); + if (fd === null) return { lines: [], start_offset: 0 }; + try { + const end = Math.min(beforeOffset, statSync(logPath).size); + if (end - start > MAX_HISTORY_BYTES) start = end - MAX_HISTORY_BYTES; + if (end <= start) return { lines: [], start_offset: start }; + const buffer = Buffer.allocUnsafe(end - start); + const read = readSync(fd, buffer, 0, end - start, start); + const text = buffer.subarray(0, read).toString("utf8"); + const lines = text.split("\n"); + if (lines[lines.length - 1] === "") lines.pop(); + return { lines: lines.map((line) => line.replace(/\r$/, "")), start_offset: start }; + } catch { + return { lines: [], start_offset: start }; + } finally { + closeSync(fd); + } +} + export interface ConsoleLinesEvent { readonly server_id: string; readonly lines: readonly string[]; + /** Where these lines start in the log, so a reader can ask for what came before. */ + readonly from_offset?: number; readonly next_offset: number; readonly reset?: true; readonly truncated?: true; @@ -136,6 +216,8 @@ export interface ConsoleSubscriptionManager { subscribe(params: { readonly serverId: string; readonly fromOffset?: number; + /** Without an offset, start this many lines before the end instead of at the top of the log. */ + readonly tailLines?: number; readonly sendEvent: ConsoleEventEmitter; }): void; unsubscribe(serverId: string): void; @@ -267,6 +349,7 @@ export function createConsoleSubscriptionManager( return; } + const fromOffset = sub.offset; sub.offset += consumedBytes; sub.windowLineCount += lines.length; sub.pendingReset = false; @@ -274,6 +357,7 @@ export function createConsoleSubscriptionManager( const event: ConsoleLinesEvent = { server_id: sub.serverId, lines, + from_offset: fromOffset, next_offset: sub.offset, ...(reset ? { reset: true as const } : {}), ...(truncated ? { truncated: true as const } : {}), @@ -306,7 +390,11 @@ export function createConsoleSubscriptionManager( serverDir, logPath, sendEvent: params.sendEvent, - offset: params.fromOffset ?? 0, + offset: + params.fromOffset ?? + (params.tailLines !== undefined + ? findLinesStart(logPath, Number.POSITIVE_INFINITY, params.tailLines) + : 0), pendingReset: false, windowStartMs: now(), windowLineCount: 0, diff --git a/src/server/runtime.ts b/src/server/runtime.ts index c674dbe..f602668 100644 --- a/src/server/runtime.ts +++ b/src/server/runtime.ts @@ -23,15 +23,23 @@ import { import { changeServerRuntime } from "./change-runtime"; import { type ConsoleEventEmitter, + type ConsoleHistory, type ConsoleSubscriptionManager, type ConsoleTimerProvider, createConsoleSubscriptionManager, type FifoWriter, + readConsoleHistory, sendConsoleLine, } from "./console"; import { ensureConsoleLog } from "./console-log"; import type { FetchLike } from "./download"; -import { assertValidServerId, DEFAULT_RUN_DIR, DEFAULT_SERVERS_DIR, resolveServerDir } from "./id"; +import { + assertValidServerId, + DEFAULT_RUN_DIR, + DEFAULT_SERVERS_DIR, + resolveServerDir, + resolveServerSubpath, +} from "./id"; import { ensureJavaRuntime, getJavaBinPath, type RunFixedLike, selectJavaMajor } from "./java"; import { installServerLoader } from "./loaders"; import { @@ -124,7 +132,9 @@ export interface ServerManager { serverId: string, fromOffset: number | undefined, sendEvent: ConsoleEventEmitter, + tailLines?: number, ): void; + consoleHistory(serverId: string, beforeOffset: number, maxLines: number): ConsoleHistory; unsubscribeConsole(serverId: string): void; readonly consoleManager: ConsoleSubscriptionManager; close(): void; @@ -475,14 +485,32 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM serverId: string, fromOffset: number | undefined, sendEvent: ConsoleEventEmitter, + tailLines?: number, ): void { consoleManager.subscribe({ serverId, sendEvent, ...(fromOffset !== undefined ? { fromOffset } : {}), + ...(tailLines !== undefined ? { tailLines } : {}), }); } + function consoleHistory( + serverId: string, + beforeOffset: number, + maxLines: number, + ): ConsoleHistory { + const serverDir = resolveServerDir(serversDir, assertValidServerId(serverId)); + if (!existsSync(serverDir)) { + throw new ProtocolError("server_not_found", `Server not found: ${serverId}`); + } + return readConsoleHistory( + resolveServerSubpath(serverDir, "logs/console.log"), + beforeOffset, + maxLines, + ); + } + function unsubscribeConsole(serverId: string): void { consoleManager.unsubscribe(serverId); } @@ -512,6 +540,7 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM updateServerSettings, sendConsole, subscribeConsole, + consoleHistory, unsubscribeConsole, consoleManager, close(): void { @@ -604,8 +633,21 @@ export function registerServerHandlers( queue.registerHandler("server.console.subscribe", (opened, ctx) => { const body = opened.body as ServerConsoleSubscribeBody; - manager.subscribeConsole(body.server_id, body.from_offset, (type, eventBody) => { - ctx.sendEvent(type, eventBody); + manager.subscribeConsole( + body.server_id, + body.from_offset, + (type, eventBody) => { + ctx.sendEvent(type, eventBody); + }, + body.tail_lines, + ); + }); + + queue.registerHandler("server.console.history", (opened, ctx) => { + const body = opened.body as { server_id: string; before_offset: number; max_lines: number }; + ctx.sendEvent("server.console.history.result", { + server_id: body.server_id, + ...manager.consoleHistory(body.server_id, body.before_offset, body.max_lines), }); }); diff --git a/src/tunnel/playit-account.test.ts b/src/tunnel/playit-account.test.ts index c217048..724a0b2 100644 --- a/src/tunnel/playit-account.test.ts +++ b/src/tunnel/playit-account.test.ts @@ -168,6 +168,7 @@ describe("server tunnels", () => { api: { claimSetup: async () => "UserAccepted", claimExchange: async () => ({ secret_key: KEY }), + agentRunData: async () => ({ agent_id: "92eb9b09-cc13-4023-a4b7-1150ccc467bd" }), ...api, } as PlayitApi, tunnel: manager, @@ -181,11 +182,11 @@ describe("server tunnels", () => { test("creates the Minecraft tunnel once and reports its address", async () => { const tunnels: PlayitAccountTunnel[] = []; - const created: Array<{ name: string; port: number; key: string }> = []; + const created: Array<{ name: string; port: number; key: string; agentId: string }> = []; const account = await linkedAccount({ listTunnels: async () => ({ tunnels }), - createMinecraftTunnel: async (key, name, port) => { - created.push({ key, name, port }); + createMinecraftTunnel: async (key, agentId, name, port) => { + created.push({ key, agentId, name, port }); tunnels.push(tunnel("t-1", port)); return { id: "t-1" }; }, @@ -193,7 +194,15 @@ describe("server tunnels", () => { expect(await account.getServerTunnel("aged")).toEqual({ managed: true, tunnel: null }); const result = await account.createServerTunnel("aged"); - expect(created).toEqual([{ key: KEY, name: "Tegra Aged", port: 25565 }]); + expect(created).toEqual([ + { + key: KEY, + agentId: "92eb9b09-cc13-4023-a4b7-1150ccc467bd", + name: "Tegra Aged", + port: 25565, + }, + ]); + expect(account.agentIdHint()).toBe("67bd"); expect(result.tunnel).toMatchObject({ id: "t-1", address: "fun-cat.gl.joinmc.link", @@ -211,7 +220,7 @@ describe("server tunnels", () => { const account = await linkedAccount( { listTunnels: async () => ({ tunnels }), - createMinecraftTunnel: async (_key, _name, at) => { + createMinecraftTunnel: async (_key, _agentId, _name, at) => { tunnels.push(tunnel("t-1", at)); return { id: "t-1" }; }, @@ -231,6 +240,20 @@ describe("server tunnels", () => { expect(fixed.tunnel?.port_matches).toBe(true); }); + test("adopts a Minecraft tunnel already aimed at the server's port", async () => { + let creates = 0; + const account = await linkedAccount({ + listTunnels: async () => ({ tunnels: [tunnel("t-old", 25565)] }), + createMinecraftTunnel: async () => { + creates++; + return { id: "t-new" }; + }, + }); + const result = await account.createServerTunnel("aged"); + expect(creates).toBe(0); + expect(result.tunnel?.id).toBe("t-old"); + }); + test("a pasted key leaves tunnels to playit.gg", async () => { const dir = stateDir(); const { manager } = fakeTunnel(dir); diff --git a/src/tunnel/playit-account.ts b/src/tunnel/playit-account.ts index 51da052..45cf2a6 100644 --- a/src/tunnel/playit-account.ts +++ b/src/tunnel/playit-account.ts @@ -55,6 +55,8 @@ interface AccountFile { readonly v: 1; readonly agent_type: "self-managed"; readonly claimed_at: number; + /** playit's id for this agent, the one shown on playit.gg. Tunnels are created for it. */ + readonly agent_id?: string; /** server_id → playit tunnel id, so renaming a server never loses its tunnel. */ readonly tunnels: Record; } @@ -157,6 +159,7 @@ export function createPlayitAccount(options: PlayitAccountOptions) { if (!active()) return; options.tunnel.setKey(secretKey); writeAccount({ v: 1, agent_type: "self-managed", claimed_at: now(), tunnels: {} }); + await learnAgentId(secretKey).catch(() => null); setClaim(run, { status: "approved" }); options.logger?.info("Linked the playit agent through a claim"); await options.tunnel.apply(); @@ -196,6 +199,15 @@ export function createPlayitAccount(options: PlayitAccountOptions) { return { account, key: readPlayitSecretKey(options.stateDir) }; } + /** playit's id for the agent, asked once and kept in the account file. */ + async function learnAgentId(key: string): Promise { + const account = readAccount(); + if (account?.agent_id) return account.agent_id; + const { agent_id } = await options.api.agentRunData(key); + if (account !== null) writeAccount({ ...account, agent_id }); + return agent_id; + } + function toView(tunnel: PlayitAccountTunnel, serverPort: number): PlayitServerTunnelView { const localPort = tunnelLocalPort(tunnel); return { @@ -216,10 +228,21 @@ export function createPlayitAccount(options: PlayitAccountOptions) { return tunnels.find((tunnel) => tunnel.id === tunnelId) ?? null; } + /** A Minecraft tunnel of this agent already aimed at the port, made earlier or by hand. */ + async function findTunnelOnPort(key: string, port: number) { + const { tunnels } = await options.api.listTunnels(key); + return ( + tunnels.find( + (tunnel) => tunnel.tunnel_type === "minecraft-java" && tunnelLocalPort(tunnel) === port, + ) ?? null + ); + } + async function getServerTunnel(serverId: string) { const server = options.resolveServer(serverId); if (!isManaged()) return { managed: false, tunnel: null }; const { account, key } = requireManaged(); + if (!account.agent_id) await learnAgentId(key).catch(() => null); const found = await findServerTunnel(key, account, serverId); return { managed: true, tunnel: found ? toView(found, server.port) : null }; } @@ -233,10 +256,17 @@ export function createPlayitAccount(options: PlayitAccountOptions) { await options.api.setTunnelPort(key, existing.id, server.port); } } else { + const adopted = await findTunnelOnPort(key, server.port); + if (adopted !== null) { + writeAccount({ ...account, tunnels: { ...account.tunnels, [serverId]: adopted.id } }); + return getServerTunnel(serverId); + } + const agentId = await learnAgentId(key); let created: { id: string }; try { created = await options.api.createMinecraftTunnel( key, + agentId, tunnelName(server.name), server.port, ); @@ -249,7 +279,8 @@ export function createPlayitAccount(options: PlayitAccountOptions) { } throw error; } - writeAccount({ ...account, tunnels: { ...account.tunnels, [serverId]: created.id } }); + const latest = readAccount() ?? account; + writeAccount({ ...latest, tunnels: { ...latest.tunnels, [serverId]: created.id } }); } return getServerTunnel(serverId); } @@ -259,7 +290,14 @@ export function createPlayitAccount(options: PlayitAccountOptions) { return readPlayitSecretKey(options.stateDir).slice(-4); } + /** Last characters of playit's agent id, matching what playit.gg shows. */ + function agentIdHint(): string | null { + const id = readAccount()?.agent_id; + return id ? id.slice(-4) : null; + } + return { + agentIdHint, beginClaim, cancelClaim, claimView: () => claim?.view ?? null, diff --git a/src/tunnel/playit-api.ts b/src/tunnel/playit-api.ts index 28d0e05..d401fe1 100644 --- a/src/tunnel/playit-api.ts +++ b/src/tunnel/playit-api.ts @@ -112,18 +112,26 @@ export function createPlayitApi(options: PlayitApiOptions = {}) { claimExchange: (code: string) => call<{ secret_key: string }>("/claim/exchange", { code }), listTunnels: (secretKey: string) => call<{ tunnels: PlayitAccountTunnel[] }>("/v1/tunnels/list", {}, secretKey), - createMinecraftTunnel: (secretKey: string, name: string, localPort: number) => + agentRunData: (secretKey: string) => + call<{ agent_id: string; permissions?: { is_self_managed?: boolean } }>( + "/v1/agents/rundata", + {}, + secretKey, + ), + // Same request as playit's own Minecraft plugin (agentkey_schema.ts in + // playit-cloud/playit-minecraft-plugin): the shared global endpoint works on free accounts. + createMinecraftTunnel: (secretKey: string, agentId: string, name: string, localPort: number) => call<{ id: string }>( "/v1/tunnels/create", { - ports: { type: "tunnel-type", details: "minecraft-java" }, + name, + protocol: { type: "tunnel-type", details: "minecraft-java" }, origin: { type: "agent", - data: { agent_id: null, config: { fields: localFields(localPort) } }, + data: { agent_id: agentId, config: { fields: localFields(localPort) } }, }, + endpoint: { type: "region", details: { region: "global", port: null } }, enabled: true, - alloc: null, - name, firewall_id: null, }, secretKey, diff --git a/src/tunnel/playit.ts b/src/tunnel/playit.ts index c708255..823cfdb 100644 --- a/src/tunnel/playit.ts +++ b/src/tunnel/playit.ts @@ -394,6 +394,7 @@ export function registerTunnelHandlers( ...manager.status(), managed: account?.isManaged() ?? false, key_hint: account?.keyHint() ?? null, + agent_id_hint: account?.agentIdHint() ?? null, claim: account?.claimView() ?? null, }); From 835b883a165528d50b0ec46f3744fdcf1b09aabd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 29 Nov 2026 03:22:28 -0300 Subject: [PATCH 54/59] build(lib): rebuild for playit tunnel fix and console history --- .../{index-mcj62q8t.js => index-yfmvvt5g.js} | 19 ++++++++++++++++--- lib/protocol/index.js | 6 +++++- lib/types/protocol/commands/server.d.ts | 18 ++++++++++++++++++ lib/types/protocol/index.d.ts | 2 +- lib/vault/index.js | 2 +- 5 files changed, 41 insertions(+), 6 deletions(-) rename lib/chunks/{index-mcj62q8t.js => index-yfmvvt5g.js} (93%) diff --git a/lib/chunks/index-mcj62q8t.js b/lib/chunks/index-yfmvvt5g.js similarity index 93% rename from lib/chunks/index-mcj62q8t.js rename to lib/chunks/index-yfmvvt5g.js index e8df29f..e3b1c0d 100644 --- a/lib/chunks/index-mcj62q8t.js +++ b/lib/chunks/index-yfmvvt5g.js @@ -970,7 +970,13 @@ var serverConsoleSendBodySchema = z4.object({ }).strict(); var serverConsoleSubscribeBodySchema = z4.object({ server_id: serverIdSchema, - from_offset: z4.number().int().nonnegative().optional() + from_offset: z4.number().int().nonnegative().optional(), + tail_lines: z4.number().int().min(1).max(5000).optional() +}).strict(); +var serverConsoleHistoryBodySchema = z4.object({ + server_id: serverIdSchema, + before_offset: z4.number().int().nonnegative(), + max_lines: z4.number().int().min(1).max(1000) }).strict(); var serverStatsBodySchema = strictServerIdBodySchema; var serverStatsResultSchema = z4.object({ @@ -1036,6 +1042,12 @@ var serverConsoleSubscribeCommand = defineCommand({ minRole: "viewer", body: serverConsoleSubscribeBodySchema }); +var serverConsoleHistoryCommand = defineCommand({ + type: "server.console.history", + level: "session", + minRole: "viewer", + body: serverConsoleHistoryBodySchema +}); var serverConsoleUnsubscribeCommand = defineCommand({ type: "server.console.unsubscribe", level: "session", @@ -1052,7 +1064,8 @@ var SERVER_COMMANDS = [ serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, - serverConsoleUnsubscribeCommand + serverConsoleUnsubscribeCommand, + serverConsoleHistoryCommand ]; function registerServerCommands(registry) { return registry.registerAll(SERVER_COMMANDS); @@ -2342,4 +2355,4 @@ function createInMemoryTrustContext(options) { } }; } -export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, MAX_ELEVATED_SESSION_MS, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, minecraftVersionSchema, loaderVersionSchema, serverCreateBodySchema, serverChangeRuntimeBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverStatsBodySchema, serverStatsResultSchema, serverCreateCommand, serverChangeRuntimeCommand, serverRestartCommand, serverStatusCommand, serverStatsCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, BACKUP_UPLOAD_STATES, backupUploadStateSchema, serverBackupUploadEventSchema, pendingBackupUploadSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, hostInfoBodySchema, hostInfoResultSchema, hostInfoCommand, HOST_COMMANDS, registerHostCommands, MODPACK_SOURCES, modpackSourceSchema, MODPACK_INSTALL_PHASES, modpackInstallPhaseSchema, MODPACK_INSTALL_JOB_STATES, modpackInstallJobStateSchema, MODPACK_INSTALL_ERROR_CODES, modpackInstallErrorCodeSchema, modpackInstallSkippedItemSchema, serverInstallModpackBodySchema, serverInstallModpackStatusBodySchema, serverInstallModpackCancelBodySchema, serverInstallModpackAcceptedEventSchema, serverInstallModpackProgressEventSchema, serverInstallModpackResultEventSchema, modpackInstallJobStatusSchema, serverInstallModpackStatusResultSchema, serverInstallModpackCommand, serverInstallModpackStatusCommand, serverInstallModpackCancelCommand, MODPACK_COMMANDS, registerModpackCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverModsToggleBodySchema, serverModsReplaceBodySchema, serverModsIdentifyBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverModsToggleCommand, serverModsReplaceCommand, serverModsIdentifyCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, tunnelPlayitClaimBeginCommand, tunnelPlayitClaimStatusCommand, tunnelPlayitClaimCancelCommand, serverTunnelBodySchema, serverTunnelGetCommand, serverTunnelCreateCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; +export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, MAX_ELEVATED_SESSION_MS, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, minecraftVersionSchema, loaderVersionSchema, serverCreateBodySchema, serverChangeRuntimeBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverConsoleHistoryBodySchema, serverStatsBodySchema, serverStatsResultSchema, serverCreateCommand, serverChangeRuntimeCommand, serverRestartCommand, serverStatusCommand, serverStatsCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleHistoryCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, BACKUP_UPLOAD_STATES, backupUploadStateSchema, serverBackupUploadEventSchema, pendingBackupUploadSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, hostInfoBodySchema, hostInfoResultSchema, hostInfoCommand, HOST_COMMANDS, registerHostCommands, MODPACK_SOURCES, modpackSourceSchema, MODPACK_INSTALL_PHASES, modpackInstallPhaseSchema, MODPACK_INSTALL_JOB_STATES, modpackInstallJobStateSchema, MODPACK_INSTALL_ERROR_CODES, modpackInstallErrorCodeSchema, modpackInstallSkippedItemSchema, serverInstallModpackBodySchema, serverInstallModpackStatusBodySchema, serverInstallModpackCancelBodySchema, serverInstallModpackAcceptedEventSchema, serverInstallModpackProgressEventSchema, serverInstallModpackResultEventSchema, modpackInstallJobStatusSchema, serverInstallModpackStatusResultSchema, serverInstallModpackCommand, serverInstallModpackStatusCommand, serverInstallModpackCancelCommand, MODPACK_COMMANDS, registerModpackCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverModsToggleBodySchema, serverModsReplaceBodySchema, serverModsIdentifyBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverModsToggleCommand, serverModsReplaceCommand, serverModsIdentifyCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, tunnelPlayitClaimBeginCommand, tunnelPlayitClaimStatusCommand, tunnelPlayitClaimCancelCommand, serverTunnelBodySchema, serverTunnelGetCommand, serverTunnelCreateCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; diff --git a/lib/protocol/index.js b/lib/protocol/index.js index 85c453b..1eaa145 100644 --- a/lib/protocol/index.js +++ b/lib/protocol/index.js @@ -181,6 +181,8 @@ import { serverBackupUploadEventSchema, serverChangeRuntimeBodySchema, serverChangeRuntimeCommand, + serverConsoleHistoryBodySchema, + serverConsoleHistoryCommand, serverConsoleSendBodySchema, serverConsoleSendCommand, serverConsoleSubscribeBodySchema, @@ -279,7 +281,7 @@ import { verifyTrustGrant, worldNameSchema, wrapEventBody -} from "../chunks/index-mcj62q8t.js"; +} from "../chunks/index-yfmvvt5g.js"; import"../chunks/index-g1frygvt.js"; export { wrapEventBody, @@ -380,6 +382,8 @@ export { serverConsoleSubscribeBodySchema, serverConsoleSendCommand, serverConsoleSendBodySchema, + serverConsoleHistoryCommand, + serverConsoleHistoryBodySchema, serverChangeRuntimeCommand, serverChangeRuntimeBodySchema, serverBackupUploadEventSchema, diff --git a/lib/types/protocol/commands/server.d.ts b/lib/types/protocol/commands/server.d.ts index 4f211b8..4c20513 100644 --- a/lib/types/protocol/commands/server.d.ts +++ b/lib/types/protocol/commands/server.d.ts @@ -64,6 +64,12 @@ export declare const serverConsoleSendBodySchema: z.ZodObject<{ export declare const serverConsoleSubscribeBodySchema: z.ZodObject<{ server_id: z.ZodString; from_offset: z.ZodOptional; + tail_lines: z.ZodOptional; +}, z.core.$strict>; +export declare const serverConsoleHistoryBodySchema: z.ZodObject<{ + server_id: z.ZodString; + before_offset: z.ZodNumber; + max_lines: z.ZodNumber; }, z.core.$strict>; export declare const serverStatsBodySchema: z.ZodObject<{ server_id: z.ZodString; @@ -126,6 +132,13 @@ export declare const serverConsoleSendCommand: import("..").CommandDefinition<"s export declare const serverConsoleSubscribeCommand: import("..").CommandDefinition<"server.console.subscribe", { server_id: string; from_offset?: number | undefined; + tail_lines?: number | undefined; +}>; +/** Lines that come before an offset, so the console can load older output while scrolling up. */ +export declare const serverConsoleHistoryCommand: import("..").CommandDefinition<"server.console.history", { + server_id: string; + before_offset: number; + max_lines: number; }>; export declare const serverConsoleUnsubscribeCommand: import("..").CommandDefinition<"server.console.unsubscribe", { server_id: string; @@ -164,7 +177,12 @@ export declare const SERVER_COMMANDS: readonly [import("..").CommandDefinition<" }>, import("..").CommandDefinition<"server.console.subscribe", { server_id: string; from_offset?: number | undefined; + tail_lines?: number | undefined; }>, import("..").CommandDefinition<"server.console.unsubscribe", { server_id: string; +}>, import("..").CommandDefinition<"server.console.history", { + server_id: string; + before_offset: number; + max_lines: number; }>]; export declare function registerServerCommands(registry: CommandRegistry): CommandRegistry; diff --git a/lib/types/protocol/index.d.ts b/lib/types/protocol/index.d.ts index 7ebc916..96d8aa2 100644 --- a/lib/types/protocol/index.d.ts +++ b/lib/types/protocol/index.d.ts @@ -8,7 +8,7 @@ export { FILES_COMMANDS, fileEncodingSchema, filesCopyCommand, filesDeleteComman export { HOST_COMMANDS, type HostInfoBody, type HostInfoResult, hostInfoBodySchema, hostInfoCommand, hostInfoResultSchema, registerHostCommands, } from "./commands/host"; export { MODPACK_COMMANDS, MODPACK_INSTALL_ERROR_CODES, MODPACK_INSTALL_JOB_STATES, MODPACK_INSTALL_PHASES, MODPACK_SOURCES, type ModpackInstallErrorCode, type ModpackInstallJobState, type ModpackInstallJobStatus, type ModpackInstallPhase, type ModpackInstallSkippedItem, type ModpackSource, modpackInstallErrorCodeSchema, modpackInstallJobStateSchema, modpackInstallJobStatusSchema, modpackInstallPhaseSchema, modpackInstallSkippedItemSchema, modpackSourceSchema, registerModpackCommands, type ServerInstallModpackAcceptedEvent, type ServerInstallModpackBody, type ServerInstallModpackCancelBody, type ServerInstallModpackProgressEvent, type ServerInstallModpackResultEvent, type ServerInstallModpackStatusBody, type ServerInstallModpackStatusResult, serverInstallModpackAcceptedEventSchema, serverInstallModpackBodySchema, serverInstallModpackCancelBodySchema, serverInstallModpackCancelCommand, serverInstallModpackCommand, serverInstallModpackProgressEventSchema, serverInstallModpackResultEventSchema, serverInstallModpackStatusBodySchema, serverInstallModpackStatusCommand, serverInstallModpackStatusResultSchema, } from "./commands/modpack"; export { agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, } from "./commands/pairing"; -export { consoleLineSchema, DEFAULT_SERVER_PORT, loaderVersionSchema, MAX_CONSOLE_LINE_LENGTH, MAX_JVM_ARGS, MAX_SERVER_MEMORY_MB, MIN_SERVER_MEMORY_MB, minecraftVersionSchema, registerServerCommands, SERVER_COMMANDS, SERVER_ID_REGEX, type ServerChangeRuntimeBody, type ServerConsoleSendBody, type ServerConsoleSubscribeBody, type ServerCreateBody, type ServerLoader, type ServerStatsBody, type ServerStatsResult, type ServerUpdateSettingsBody, serverChangeRuntimeBodySchema, serverChangeRuntimeCommand, serverConsoleSendBodySchema, serverConsoleSendCommand, serverConsoleSubscribeBodySchema, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, serverCreateBodySchema, serverCreateCommand, serverIdSchema, serverListCommand, serverLoaderSchema, serverMemoryMbSchema, serverPortSchema, serverRestartCommand, serverStatsBodySchema, serverStatsCommand, serverStatsResultSchema, serverStatusCommand, serverUpdateSettingsBodySchema, serverUpdateSettingsCommand, } from "./commands/server"; +export { consoleLineSchema, DEFAULT_SERVER_PORT, loaderVersionSchema, MAX_CONSOLE_LINE_LENGTH, MAX_JVM_ARGS, MAX_SERVER_MEMORY_MB, MIN_SERVER_MEMORY_MB, minecraftVersionSchema, registerServerCommands, SERVER_COMMANDS, SERVER_ID_REGEX, type ServerChangeRuntimeBody, type ServerConsoleSendBody, type ServerConsoleSubscribeBody, type ServerCreateBody, type ServerLoader, type ServerStatsBody, type ServerStatsResult, type ServerUpdateSettingsBody, serverChangeRuntimeBodySchema, serverChangeRuntimeCommand, serverConsoleHistoryBodySchema, serverConsoleHistoryCommand, serverConsoleSendBodySchema, serverConsoleSendCommand, serverConsoleSubscribeBodySchema, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, serverCreateBodySchema, serverCreateCommand, serverIdSchema, serverListCommand, serverLoaderSchema, serverMemoryMbSchema, serverPortSchema, serverRestartCommand, serverStatsBodySchema, serverStatsCommand, serverStatsResultSchema, serverStatusCommand, serverUpdateSettingsBodySchema, serverUpdateSettingsCommand, } from "./commands/server"; export { blobKeySchema, type ModEnvironmentInfo, type ModLayer, type ModSource, modEnvironmentInfoSchema, modFileNameSchema, modLayerSchema, modSourceSchema, type OriginPlanFileInput, type OriginPlanModInput, originPlanFileInputSchema, originPlanModInputSchema, RESERVED_WORLD_NAMES, registerStateCommands, type ServerDeployServerpackBody, type ServerModEntry, type ServerModsIdentifyBody, type ServerModsInstallBody, type ServerModsListBody, type ServerModsRemoveBody, type ServerModsReplaceBody, type ServerModsToggleBody, type ServerOrigin, type ServerOriginApplyBody, type ServerOriginPlanBody, type ServerOriginSyncState, type ServerOriginUnlinkBody, type ServerWorldImportBody, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, STATE_COMMANDS, serverDeployServerpackBodySchema, serverDeployServerpackCommand, serverModEntrySchema, serverModsIdentifyBodySchema, serverModsIdentifyCommand, serverModsInstallBodySchema, serverModsInstallCommand, serverModsListBodySchema, serverModsListCommand, serverModsRemoveBodySchema, serverModsRemoveCommand, serverModsReplaceBodySchema, serverModsReplaceCommand, serverModsToggleBodySchema, serverModsToggleCommand, serverOriginApplyBodySchema, serverOriginApplyCommand, serverOriginPlanBodySchema, serverOriginPlanCommand, serverOriginSchema, serverOriginSyncStateSchema, serverOriginUnlinkBodySchema, serverOriginUnlinkCommand, serverWorldImportBodySchema, serverWorldImportCommand, sha1HexSchema, sha512HexSchema, WORLD_NAME_REGEX, worldNameSchema, } from "./commands/state"; export { PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, registerTunnelCommands, serverTunnelBodySchema, serverTunnelCreateCommand, serverTunnelGetCommand, TUNNEL_COMMANDS, type TunnelPlayitSetKeyBody, tunnelPlayitClaimBeginCommand, tunnelPlayitClaimCancelCommand, tunnelPlayitClaimStatusCommand, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStatusCommand, tunnelPlayitStopCommand, } from "./commands/tunnel"; export { DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_AGENT_MESSAGE, DOMAIN_COMMAND, DOMAIN_PAIRING_PROOF, DOMAIN_REVOCATION, DOMAIN_ROLE_GRANT, DOMAIN_SESSION, DOMAIN_TRUST_GRANT, PROTOCOL_VERSION, } from "./domains"; diff --git a/lib/vault/index.js b/lib/vault/index.js index 3c32a86..d4c2439 100644 --- a/lib/vault/index.js +++ b/lib/vault/index.js @@ -6,7 +6,7 @@ import { sessionCertificateSchema, signRevocationList, signSessionCertificate -} from "../chunks/index-mcj62q8t.js"; +} from "../chunks/index-yfmvvt5g.js"; import { KDF_ALG_ARGON2ID13, KDF_MODERATE, From 09c407e7524e1519c7ff60c63bbe18b1f00b2396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 29 Nov 2026 13:13:01 -0300 Subject: [PATCH 55/59] fix(tunnel): give each server its own playit tunnel when ports are shared Servers on one agent often share a port, since only one runs at a time. Adopting an existing Minecraft tunnel by port picked the tunnel another server already owned, so a second server showed the first one's address. Adoption now skips tunnels another server owns, and a server recorded with another server's tunnel (from that bug) is treated as having none, so creating it again makes its own tunnel. --- src/tunnel/playit-account.test.ts | 44 +++++++++++++++++++++++++++++-- src/tunnel/playit-account.ts | 25 ++++++++++++++---- 2 files changed, 62 insertions(+), 7 deletions(-) diff --git a/src/tunnel/playit-account.test.ts b/src/tunnel/playit-account.test.ts index 724a0b2..cba56a7 100644 --- a/src/tunnel/playit-account.test.ts +++ b/src/tunnel/playit-account.test.ts @@ -2,7 +2,7 @@ // Copyright (C) 2026 Antônio Miranda import { afterEach, describe, expect, test } from "bun:test"; -import { existsSync, mkdtempSync, rmSync } from "node:fs"; +import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; import { ProtocolError } from "../protocol"; @@ -177,7 +177,7 @@ describe("server tunnels", () => { }); account.beginClaim(); await until(() => account.claimView()?.status === "approved"); - return account; + return Object.assign(account, { stateDirForTests: dir }); } test("creates the Minecraft tunnel once and reports its address", async () => { @@ -240,6 +240,46 @@ describe("server tunnels", () => { expect(fixed.tunnel?.port_matches).toBe(true); }); + test("servers sharing a port each get their own tunnel", async () => { + const tunnels: PlayitAccountTunnel[] = []; + let next = 0; + const account = await linkedAccount({ + listTunnels: async () => ({ tunnels }), + createMinecraftTunnel: async (_key, _agentId, _name, port) => { + const id = `t-${++next}`; + tunnels.push(tunnel(id, port, `${id}.joinmc.link`)); + return { id }; + }, + }); + const aged = await account.createServerTunnel("aged"); + const atmons = await account.createServerTunnel("atmons"); + expect(aged.tunnel?.id).toBe("t-1"); + expect(atmons.tunnel?.id).toBe("t-2"); + expect(atmons.tunnel?.address).toBe("t-2.joinmc.link"); + }); + + test("a server recorded with another server's tunnel gets its own", async () => { + const tunnels = [tunnel("t-1", 25565)]; + const account = await linkedAccount({ + listTunnels: async () => ({ tunnels }), + createMinecraftTunnel: async (_key, _agentId, _name, port) => { + tunnels.push(tunnel("t-2", port, "t-2.joinmc.link")); + return { id: "t-2" }; + }, + }); + await account.createServerTunnel("aged"); + // The older bug: the second server was recorded with the first server's tunnel. + const file = join(account.stateDirForTests, PLAYIT_ACCOUNT_FILENAME); + const stored = JSON.parse(readFileSync(file, "utf8")); + writeFileSync( + file, + JSON.stringify({ ...stored, tunnels: { ...stored.tunnels, atmons: "t-1" } }), + ); + expect((await account.getServerTunnel("atmons")).tunnel).toBeNull(); + expect((await account.createServerTunnel("atmons")).tunnel?.id).toBe("t-2"); + expect((await account.getServerTunnel("aged")).tunnel?.id).toBe("t-1"); + }); + test("adopts a Minecraft tunnel already aimed at the server's port", async () => { let creates = 0; const account = await linkedAccount({ diff --git a/src/tunnel/playit-account.ts b/src/tunnel/playit-account.ts index 45cf2a6..d6c5455 100644 --- a/src/tunnel/playit-account.ts +++ b/src/tunnel/playit-account.ts @@ -221,19 +221,34 @@ export function createPlayitAccount(options: PlayitAccountOptions) { }; } + /** + * The server a tunnel belongs to: the first one that recorded it. A tunnel is never + * shared, so a later server pointing at the same id (an older bug) counts as having none. + */ + function ownerOf(account: AccountFile, tunnelId: string): string | undefined { + return Object.entries(account.tunnels).find(([, id]) => id === tunnelId)?.[0]; + } + async function findServerTunnel(key: string, account: AccountFile, serverId: string) { const tunnelId = account.tunnels[serverId]; - if (tunnelId === undefined) return null; + if (tunnelId === undefined || ownerOf(account, tunnelId) !== serverId) return null; const { tunnels } = await options.api.listTunnels(key); return tunnels.find((tunnel) => tunnel.id === tunnelId) ?? null; } - /** A Minecraft tunnel of this agent already aimed at the port, made earlier or by hand. */ - async function findTunnelOnPort(key: string, port: number) { + /** + * A Minecraft tunnel of this agent aimed at the port that no other server owns, made + * earlier or by hand. Servers often share a port (only one runs at a time), and each + * still gets its own tunnel. + */ + async function findTunnelOnPort(key: string, account: AccountFile, port: number) { const { tunnels } = await options.api.listTunnels(key); return ( tunnels.find( - (tunnel) => tunnel.tunnel_type === "minecraft-java" && tunnelLocalPort(tunnel) === port, + (tunnel) => + tunnel.tunnel_type === "minecraft-java" && + tunnelLocalPort(tunnel) === port && + ownerOf(account, tunnel.id) === undefined, ) ?? null ); } @@ -256,7 +271,7 @@ export function createPlayitAccount(options: PlayitAccountOptions) { await options.api.setTunnelPort(key, existing.id, server.port); } } else { - const adopted = await findTunnelOnPort(key, server.port); + const adopted = await findTunnelOnPort(key, account, server.port); if (adopted !== null) { writeAccount({ ...account, tunnels: { ...account.tunnels, [serverId]: adopted.id } }); return getServerTunnel(serverId); From ac1174c24bb3ea18770e66f217aa21178fed2681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 29 Nov 2026 13:18:02 -0300 Subject: [PATCH 56/59] feat(server): pick a free port for new servers, name the clash on start - server.create without a port takes the first one from 25565 up that no other server of the agent is set to and nothing on the machine listens on (read from /proc/net/tcp, so src/server still never opens a socket). - Starting a server whose port another running server holds fails with port_in_use and names that server, instead of Minecraft crashing on bind. --- src/protocol/errors.ts | 1 + src/server/index.ts | 6 +++++ src/server/ports.ts | 52 ++++++++++++++++++++++++++++++++++++++ src/server/runtime.test.ts | 48 +++++++++++++++++++++++++++++++++++ src/server/runtime.ts | 23 +++++++++++++++-- 5 files changed, 128 insertions(+), 2 deletions(-) create mode 100644 src/server/ports.ts diff --git a/src/protocol/errors.ts b/src/protocol/errors.ts index e489c0a..0243799 100644 --- a/src/protocol/errors.ts +++ b/src/protocol/errors.ts @@ -60,6 +60,7 @@ export type ProtocolErrorCode = | "tunnel_failed" | "tunnel_not_managed" | "tunnel_api_failed" + | "port_in_use" | "pack_unavailable" | "runtime_mismatch" | "host_not_allowed" diff --git a/src/server/index.ts b/src/server/index.ts index 02955df..7efe3df 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -82,6 +82,12 @@ export { RESERVED_SYSTEM_MEMORY_MB, readMeminfo, } from "./memory"; +export { + type ListeningPorts, + nextFreeServerPort, + PORT_SEARCH_LIMIT, + readListeningTcpPorts, +} from "./ports"; export { DEFAULT_PERMS_TIMEOUT_MS, DEFAULT_PERMS_UNIT_PATHS, diff --git a/src/server/ports.ts b/src/server/ports.ts new file mode 100644 index 0000000..45b2d4d --- /dev/null +++ b/src/server/ports.ts @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { readFileSync } from "node:fs"; +import { DEFAULT_SERVER_PORT } from "../protocol"; + +/** How many ports past the default to try before giving up and using the default. */ +export const PORT_SEARCH_LIMIT = 200; + +/** TCP state "LISTEN" in /proc/net/tcp. */ +const TCP_LISTEN = "0A"; + +export type ListeningPorts = () => ReadonlySet; + +/** + * TCP ports something on this machine listens on, read from /proc/net/tcp{,6}. tegrad never + * opens a socket to find out (src/server must not listen); off Linux it knows of none. + */ +export const readListeningTcpPorts: ListeningPorts = () => { + const ports = new Set(); + for (const file of ["/proc/net/tcp", "/proc/net/tcp6"]) { + let text: string; + try { + text = readFileSync(file, "utf8"); + } catch { + continue; + } + for (const line of text.split("\n").slice(1)) { + const fields = line.trim().split(/\s+/); + const local = fields[1]; + if (!local || fields[3] !== TCP_LISTEN) continue; + const port = Number.parseInt(local.slice(local.lastIndexOf(":") + 1), 16); + if (Number.isInteger(port)) ports.add(port); + } + } + return ports; +}; + +/** + * The first port from 25565 up that no other server of this agent is set to, and that + * nothing else on the machine listens on. Servers can then run at the same time. + */ +export function nextFreeServerPort( + takenByServers: ReadonlySet, + listening: ListeningPorts = readListeningTcpPorts, +): number { + const busy = listening(); + for (let port = DEFAULT_SERVER_PORT; port < DEFAULT_SERVER_PORT + PORT_SEARCH_LIMIT; port++) { + if (!takenByServers.has(port) && !busy.has(port)) return port; + } + return DEFAULT_SERVER_PORT; +} diff --git a/src/server/runtime.test.ts b/src/server/runtime.test.ts index d9f0264..ac5f769 100644 --- a/src/server/runtime.test.ts +++ b/src/server/runtime.test.ts @@ -497,3 +497,51 @@ describe("ServerManager lifecycle and command integration", () => { manager.close(); }); }); + +describe("server ports", () => { + function managerFor(listening: number[] = []) { + const serversDir = makeTempDir("tegrad-rt-ports-"); + const runDir = makeTempDir("tegrad-rt-ports-run-"); + preinstallFakeJava(serversDir, 21); + const sysd = makeSystemdFake(); + const manager = createServerManager({ + serversDir, + runDir, + platform: "linux", + fetchImpl: makeFakeVanillaFetch(), + runFixedImpl: sysd.runFixedImpl, + readMeminfoImpl: () => ({ memTotalMb: 16384, memAvailableMb: 12000 }), + now: () => 1_700_000_000_000, + listeningPorts: () => new Set(listening), + }); + return { manager, sysd }; + } + + const base = { + name: "Server", + minecraft_version: "1.21.4", + loader: "vanilla" as const, + memory_mb: 1024, + jvm_args: [], + eula_accepted: true, + }; + + test("a new server takes the next port no other server or program uses", async () => { + const { manager } = managerFor([25567]); + expect((await manager.createServer({ ...base, server_id: "a" })).port).toBe(25565); + expect((await manager.createServer({ ...base, server_id: "b" })).port).toBe(25566); + expect((await manager.createServer({ ...base, server_id: "c" })).port).toBe(25568); + expect((await manager.createServer({ ...base, server_id: "d", port: 30000 })).port).toBe(30000); + }); + + test("starting a server whose port another running server holds names that server", async () => { + const { manager, sysd } = managerFor(); + await manager.createServer({ ...base, server_id: "a", name: "Aged", port: 25565 }); + await manager.createServer({ ...base, server_id: "b", port: 25565 }); + await manager.startServer("a"); + await expect(manager.startServer("b")).rejects.toMatchObject({ code: "port_in_use" }); + // Once the first one is off, the second starts. + sysd.states.clear(); + await manager.startServer("b"); + }); +}); diff --git a/src/server/runtime.ts b/src/server/runtime.ts index f602668..ace173d 100644 --- a/src/server/runtime.ts +++ b/src/server/runtime.ts @@ -6,7 +6,6 @@ import { join } from "node:path"; import type { CommandQueue } from "../agent/jobs"; import type { Logger } from "../agent/logger"; import { - DEFAULT_SERVER_PORT, ProtocolError, roleAtLeast, type ServerChangeRuntimeBody, @@ -58,6 +57,7 @@ import { secureDirectory, secureTree, } from "./permissions"; +import { type ListeningPorts, nextFreeServerPort } from "./ports"; import { getEffectiveLaunchTarget, isEulaAccepted, @@ -112,6 +112,8 @@ export interface ServerManagerOptions { /** Group id of the server user's group; resolved from /etc/group when omitted, null to skip. */ readonly serverGroupId?: number | null; readonly backupBeforeChange?: (serverId: string) => Promise; + /** Ports already listened on by this machine; tests replace it. */ + readonly listeningPorts?: ListeningPorts; } export interface ServerManager { @@ -202,7 +204,13 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM if (!parsedParams.success) { throw new ProtocolError("invalid_body", "Invalid server.create parameters"); } - const port = parsedParams.data.port ?? DEFAULT_SERVER_PORT; + // Without a port, take the next one no other server uses, so servers can run together. + const port = + parsedParams.data.port ?? + nextFreeServerPort( + new Set(listServerMetadata(serversDir).map((server) => server.port)), + options.listeningPorts, + ); const serverDir = resolveServerDir(serversDir, validId); if (existsSync(serverDir)) { @@ -315,6 +323,17 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM throw new ProtocolError("server_running", `Server is already running: ${validId}`); } + // Minecraft cannot bind a port another running server holds; say which one instead of crashing. + for (const other of listServerMetadata(serversDir)) { + if (other.id === validId || other.port !== meta.port) continue; + if (isUnitActive(await getUnitStatus(other.id, options.runFixedImpl))) { + throw new ProtocolError( + "port_in_use", + `Port ${meta.port} is used by the running server ${other.name} (${other.id})`, + ); + } + } + const runningServersMemoryMb = await computeRunningServersMemoryMb(validId); const meminfo = readHostMeminfo(); checkMemoryForServer({ From 6d2b528ddd7a364db9bcf15e3416b8275498aa88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 29 Nov 2026 13:18:03 -0300 Subject: [PATCH 57/59] build(lib): rebuild for port_in_use --- lib/types/protocol/errors.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/types/protocol/errors.d.ts b/lib/types/protocol/errors.d.ts index 2f59f6b..5ac30b9 100644 --- a/lib/types/protocol/errors.d.ts +++ b/lib/types/protocol/errors.d.ts @@ -1,4 +1,4 @@ -export type ProtocolErrorCode = "invalid_format" | "unsupported_version" | "wrong_agent" | "wrong_recipient" | "expired" | "not_yet_valid" | "ttl_too_long" | "untrusted_signer" | "bad_signature" | "session_invalid" | "session_revoked" | "replayed" | "unknown_command" | "invalid_body" | "elevation_required" | "elevation_invalid" | "account_key_required" | "decrypt_failed" | "insufficient_role" | "too_many_subscribers" | "role_grant_invalid" | "auth_invalid" | "request_invalid" | "grant_invalid" | "grant_wrong_agent" | "grant_expired" | "grant_bad_signature" | "grant_proof_required" | "grant_bad_proof" | "revocation_stale" | "revocation_not_superset" | "insufficient_memory" | "eula_not_accepted" | "server_not_found" | "server_already_exists" | "server_running" | "server_stopped" | "invalid_jvm_args" | "download_failed" | "hash_mismatch" | "systemd_error" | "perms_unavailable" | "origin_locked" | "plan_not_found" | "plan_expired" | "plan_stale" | "mod_not_found" | "mod_conflict" | "mod_already_exists" | "backup_not_found" | "backup_failed" | "backup_config_invalid" | "tunnel_not_configured" | "tunnel_already_running" | "tunnel_not_running" | "tunnel_failed" | "tunnel_not_managed" | "tunnel_api_failed" | "pack_unavailable" | "runtime_mismatch" | "host_not_allowed" | "too_large" | "install_in_progress" | "api_unavailable" | "io_error" | "cancelled"; +export type ProtocolErrorCode = "invalid_format" | "unsupported_version" | "wrong_agent" | "wrong_recipient" | "expired" | "not_yet_valid" | "ttl_too_long" | "untrusted_signer" | "bad_signature" | "session_invalid" | "session_revoked" | "replayed" | "unknown_command" | "invalid_body" | "elevation_required" | "elevation_invalid" | "account_key_required" | "decrypt_failed" | "insufficient_role" | "too_many_subscribers" | "role_grant_invalid" | "auth_invalid" | "request_invalid" | "grant_invalid" | "grant_wrong_agent" | "grant_expired" | "grant_bad_signature" | "grant_proof_required" | "grant_bad_proof" | "revocation_stale" | "revocation_not_superset" | "insufficient_memory" | "eula_not_accepted" | "server_not_found" | "server_already_exists" | "server_running" | "server_stopped" | "invalid_jvm_args" | "download_failed" | "hash_mismatch" | "systemd_error" | "perms_unavailable" | "origin_locked" | "plan_not_found" | "plan_expired" | "plan_stale" | "mod_not_found" | "mod_conflict" | "mod_already_exists" | "backup_not_found" | "backup_failed" | "backup_config_invalid" | "tunnel_not_configured" | "tunnel_already_running" | "tunnel_not_running" | "tunnel_failed" | "tunnel_not_managed" | "tunnel_api_failed" | "port_in_use" | "pack_unavailable" | "runtime_mismatch" | "host_not_allowed" | "too_large" | "install_in_progress" | "api_unavailable" | "io_error" | "cancelled"; export declare class ProtocolError extends Error { readonly code: ProtocolErrorCode; constructor(code: ProtocolErrorCode, message: string); From f161af9c7b67d57f6ac6b5e566d8901b07738857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Sun, 29 Nov 2026 22:40:37 -0300 Subject: [PATCH 58/59] feat(server): start servers with the machine (on, off, or as they were) and let a server replace its playit tunnel --- .../{index-yfmvvt5g.js => index-3yjqz9zv.js} | 11 ++- lib/protocol/index.js | 8 +- lib/types/protocol/commands/server.d.ts | 18 ++++ lib/types/protocol/commands/tunnel.d.ts | 6 ++ lib/types/protocol/index.d.ts | 4 +- lib/vault/index.js | 2 +- src/cli/run.ts | 14 +++ src/protocol/commands/server.ts | 9 ++ src/protocol/commands/tunnel.ts | 10 +- src/protocol/index.ts | 4 + src/server/index.ts | 7 ++ src/server/registry.ts | 4 + src/server/runtime.ts | 22 ++++- src/server/start-on-boot.test.ts | 95 +++++++++++++++++++ src/server/start-on-boot.ts | 83 ++++++++++++++++ src/state/modpack-installer.test.ts | 2 +- src/tunnel/playit-account.test.ts | 50 ++++++++++ src/tunnel/playit-account.ts | 32 ++++++- src/tunnel/playit-api.ts | 3 + src/tunnel/playit.ts | 4 +- 20 files changed, 373 insertions(+), 15 deletions(-) rename lib/chunks/{index-yfmvvt5g.js => index-3yjqz9zv.js} (93%) create mode 100644 src/server/start-on-boot.test.ts create mode 100644 src/server/start-on-boot.ts diff --git a/lib/chunks/index-yfmvvt5g.js b/lib/chunks/index-3yjqz9zv.js similarity index 93% rename from lib/chunks/index-yfmvvt5g.js rename to lib/chunks/index-3yjqz9zv.js index e3b1c0d..89424ae 100644 --- a/lib/chunks/index-yfmvvt5g.js +++ b/lib/chunks/index-3yjqz9zv.js @@ -930,6 +930,8 @@ var MAX_JVM_ARGS = 64; var serverIdSchema = z4.string().regex(SERVER_ID_REGEX, "server_id must match ^[a-z0-9][a-z0-9-]{0,62}$"); var serverLoaderSchema = z4.enum(["vanilla", "fabric", "forge", "neoforge", "quilt"]); var serverPortSchema = z4.number().int().min(1024).max(65535); +var serverStartOnBootSchema = z4.enum(["on", "off", "previous"]); +var DEFAULT_START_ON_BOOT = "previous"; var serverMemoryMbSchema = z4.number().int().min(MIN_SERVER_MEMORY_MB).max(MAX_SERVER_MEMORY_MB); var consoleLineSchema = z4.string().min(1).max(MAX_CONSOLE_LINE_LENGTH).refine((value) => !/[\r\n\0]/.test(value), { message: "Console line must not contain newline, carriage return, or NUL characters" @@ -962,6 +964,7 @@ var serverUpdateSettingsBodySchema = z4.object({ memory_mb: serverMemoryMbSchema.optional(), jvm_args: z4.array(z4.string()).max(MAX_JVM_ARGS).optional(), port: serverPortSchema.optional(), + start_on_boot: serverStartOnBootSchema.optional(), eula_accepted: z4.boolean().optional() }).strict(); var serverConsoleSendBodySchema = z4.object({ @@ -1956,6 +1959,10 @@ var tunnelPlayitClaimCancelCommand = defineCommand({ body: z12.object({}).strict() }); var serverTunnelBodySchema = z12.object({ server_id: serverIdSchema }).strict(); +var serverTunnelCreateBodySchema = z12.object({ + server_id: serverIdSchema, + replace: z12.boolean().optional() +}).strict(); var serverTunnelGetCommand = defineCommand({ type: "server.tunnel.get", level: "session", @@ -1966,7 +1973,7 @@ var serverTunnelCreateCommand = defineCommand({ type: "server.tunnel.create", level: "session", minRole: "admin", - body: serverTunnelBodySchema + body: serverTunnelCreateBodySchema }); var TUNNEL_COMMANDS = [ tunnelPlayitSetKeyCommand, @@ -2355,4 +2362,4 @@ function createInMemoryTrustContext(options) { } }; } -export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, MAX_ELEVATED_SESSION_MS, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverMemoryMbSchema, consoleLineSchema, minecraftVersionSchema, loaderVersionSchema, serverCreateBodySchema, serverChangeRuntimeBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverConsoleHistoryBodySchema, serverStatsBodySchema, serverStatsResultSchema, serverCreateCommand, serverChangeRuntimeCommand, serverRestartCommand, serverStatusCommand, serverStatsCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleHistoryCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, BACKUP_UPLOAD_STATES, backupUploadStateSchema, serverBackupUploadEventSchema, pendingBackupUploadSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, hostInfoBodySchema, hostInfoResultSchema, hostInfoCommand, HOST_COMMANDS, registerHostCommands, MODPACK_SOURCES, modpackSourceSchema, MODPACK_INSTALL_PHASES, modpackInstallPhaseSchema, MODPACK_INSTALL_JOB_STATES, modpackInstallJobStateSchema, MODPACK_INSTALL_ERROR_CODES, modpackInstallErrorCodeSchema, modpackInstallSkippedItemSchema, serverInstallModpackBodySchema, serverInstallModpackStatusBodySchema, serverInstallModpackCancelBodySchema, serverInstallModpackAcceptedEventSchema, serverInstallModpackProgressEventSchema, serverInstallModpackResultEventSchema, modpackInstallJobStatusSchema, serverInstallModpackStatusResultSchema, serverInstallModpackCommand, serverInstallModpackStatusCommand, serverInstallModpackCancelCommand, MODPACK_COMMANDS, registerModpackCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverModsToggleBodySchema, serverModsReplaceBodySchema, serverModsIdentifyBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverModsToggleCommand, serverModsReplaceCommand, serverModsIdentifyCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, tunnelPlayitClaimBeginCommand, tunnelPlayitClaimStatusCommand, tunnelPlayitClaimCancelCommand, serverTunnelBodySchema, serverTunnelGetCommand, serverTunnelCreateCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; +export { ProtocolError, PROTOCOL_VERSION, DOMAIN_COMMAND, DOMAIN_SESSION, DOMAIN_AGENT_MESSAGE, DOMAIN_REVOCATION, DOMAIN_TRUST_GRANT, DOMAIN_PAIRING_PROOF, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_ROLE_GRANT, keyIdSchema, base64UrlSchema, sessionCertificateSchema, commandHeaderSchema, signedCommandSchema, agentMessageHeaderSchema, agentMessageSchema, revocationListSchema, transportCommandFrameSchema, transportEventFrameSchema, transportAckFrameSchema, transportPingFrameSchema, AGENT_NONCE_BYTES, agentNonceSchema, transportHelloFrameSchema, transportAuthFrameSchema, transportFrameSchema, AGENT_AUTH_MAX_SKEW_MS, AGENT_HTTP_MAX_SKEW_MS, AGENT_HTTP_HEADER_AGENT, AGENT_HTTP_HEADER_TS, AGENT_HTTP_HEADER_SIG, generateAgentNonce, createHelloFrame, signAgentAuth, verifyAgentAuth, signAgentRequest, verifyAgentRequest, sealAgentMessage, openAgentMessage, agentEventBodySchema, wrapEventBody, openAgentEvent, ROLES, roleSchema, GRANTABLE_ROLES, grantableRoleSchema, ROLE_LEVEL, roleAtLeast, maxRole, ALL_SERVERS, MAX_GRANT_SERVERS, MAX_MEMBERS, roleGrantSchema, MAX_GRANT_CLOCK_SKEW_MS, signRoleGrant, verifyRoleGrant, memberEntrySchema, RoleTable, MAX_ELEVATED_SESSION_MS, signSessionCertificate, verifySessionCertificate, COMMAND_ID_BYTES, DEFAULT_COMMAND_TTL_MS, MAX_COMMAND_TTL_MS, MAX_CLOCK_SKEW_MS, createSignedCommand, openCommand, defineCommand, CommandRegistry, SERVER_ID_REGEX, DEFAULT_SERVER_PORT, MAX_CONSOLE_LINE_LENGTH, MIN_SERVER_MEMORY_MB, MAX_SERVER_MEMORY_MB, MAX_JVM_ARGS, serverIdSchema, serverLoaderSchema, serverPortSchema, serverStartOnBootSchema, DEFAULT_START_ON_BOOT, serverMemoryMbSchema, consoleLineSchema, minecraftVersionSchema, loaderVersionSchema, serverCreateBodySchema, serverChangeRuntimeBodySchema, serverUpdateSettingsBodySchema, serverConsoleSendBodySchema, serverConsoleSubscribeBodySchema, serverConsoleHistoryBodySchema, serverStatsBodySchema, serverStatsResultSchema, serverCreateCommand, serverChangeRuntimeCommand, serverRestartCommand, serverStatusCommand, serverStatsCommand, serverListCommand, serverUpdateSettingsCommand, serverConsoleSendCommand, serverConsoleSubscribeCommand, serverConsoleHistoryCommand, serverConsoleUnsubscribeCommand, SERVER_COMMANDS, registerServerCommands, SUBSCRIPTION_TOPICS, subscriptionTopicSchema, SERVER_STATES, serverStateSchema, serverStatusChangedSchema, agentSubscribeBodySchema, agentMembersSetBodySchema, agentMembersRevokeBodySchema, agentSubscribeCommand, agentUnsubscribeCommand, agentMembersSetCommand, agentMembersRevokeCommand, AGENT_COMMANDS, registerAgentCommands, BACKUP_ID_REGEX, MIN_BACKUP_INTERVAL_MINUTES, MAX_BACKUP_INTERVAL_MINUTES, MIN_BACKUP_RETENTION_COUNT, MAX_BACKUP_RETENTION_COUNT, backupIdSchema, backupDestinationKindSchema, BACKUP_UPLOAD_STATES, backupUploadStateSchema, serverBackupUploadEventSchema, pendingBackupUploadSchema, backupScheduleConfigSchema, backupLocalConfigSchema, s3BucketSchema, s3RegionSchema, s3PrefixSchema, backupS3ConfigSchema, backupTegraCloudConfigSchema, serverBackupConfigSetBodySchema, serverBackupCreateBodySchema, serverBackupListBodySchema, serverBackupDeleteBodySchema, serverBackupRestoreBodySchema, serverBackupConfigSetCommand, serverBackupConfigGetCommand, serverBackupCreateCommand, serverBackupListCommand, serverBackupDeleteCommand, serverBackupRestoreCommand, BACKUP_COMMANDS, registerBackupCommands, SERVER_ID_PATTERN, SHA256_HEX_PATTERN, fileEncodingSchema, sha256HexSchema, filesListCommand, filesStatCommand, filesReadCommand, filesWriteCommand, filesMkdirCommand, filesRenameCommand, filesCopyCommand, filesDeleteCommand, filesUploadBeginCommand, filesUploadPartCommand, filesUploadCommitCommand, filesUploadAbortCommand, filesDownloadBeginCommand, filesDownloadPartCommand, filesDownloadCloseCommand, filesDownloadCommand, filesZipCommand, filesUnzipCommand, FILES_COMMANDS, registerFilesCommands, hostInfoBodySchema, hostInfoResultSchema, hostInfoCommand, HOST_COMMANDS, registerHostCommands, MODPACK_SOURCES, modpackSourceSchema, MODPACK_INSTALL_PHASES, modpackInstallPhaseSchema, MODPACK_INSTALL_JOB_STATES, modpackInstallJobStateSchema, MODPACK_INSTALL_ERROR_CODES, modpackInstallErrorCodeSchema, modpackInstallSkippedItemSchema, serverInstallModpackBodySchema, serverInstallModpackStatusBodySchema, serverInstallModpackCancelBodySchema, serverInstallModpackAcceptedEventSchema, serverInstallModpackProgressEventSchema, serverInstallModpackResultEventSchema, modpackInstallJobStatusSchema, serverInstallModpackStatusResultSchema, serverInstallModpackCommand, serverInstallModpackStatusCommand, serverInstallModpackCancelCommand, MODPACK_COMMANDS, registerModpackCommands, agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, sha1HexSchema, sha512HexSchema, modSourceSchema, modLayerSchema, modFileNameSchema, serverModEntrySchema, serverOriginSchema, serverOriginSyncStateSchema, modEnvironmentInfoSchema, originPlanModInputSchema, originPlanFileInputSchema, serverModsListBodySchema, serverModsInstallBodySchema, serverModsRemoveBodySchema, serverModsToggleBodySchema, serverModsReplaceBodySchema, serverModsIdentifyBodySchema, serverOriginPlanBodySchema, serverOriginApplyBodySchema, serverOriginUnlinkBodySchema, blobKeySchema, WORLD_NAME_REGEX, RESERVED_WORLD_NAMES, worldNameSchema, serverWorldImportBodySchema, serverDeployServerpackBodySchema, serverModsListCommand, serverModsInstallCommand, serverModsRemoveCommand, serverModsToggleCommand, serverModsReplaceCommand, serverModsIdentifyCommand, serverOriginPlanCommand, serverOriginApplyCommand, serverOriginUnlinkCommand, serverDeployServerpackCommand, serverWorldImportCommand, STATE_COMMANDS, registerStateCommands, PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStopCommand, tunnelPlayitStatusCommand, tunnelPlayitClaimBeginCommand, tunnelPlayitClaimStatusCommand, tunnelPlayitClaimCancelCommand, serverTunnelBodySchema, serverTunnelCreateBodySchema, serverTunnelGetCommand, serverTunnelCreateCommand, TUNNEL_COMMANDS, registerTunnelCommands, agentPingCommand, serverStartCommand, serverStopCommand, serverDeleteCommand, CORE_COMMANDS, registerCoreCommands, createCoreRegistry, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, DEFAULT_TRUST_GRANT_TTL_MS, MAX_TRUST_GRANT_TTL_MS, pairingCodeSchema, trustGrantSchema, generatePairingCode, generatePairingSecret, buildPairingFragment, parsePairingFragment, signTrustGrant, verifyTrustGrant, signRevocationList, verifyRevocationList, createInMemoryTrustContext }; diff --git a/lib/protocol/index.js b/lib/protocol/index.js index 1eaa145..f78548d 100644 --- a/lib/protocol/index.js +++ b/lib/protocol/index.js @@ -15,6 +15,7 @@ import { CommandRegistry, DEFAULT_COMMAND_TTL_MS, DEFAULT_SERVER_PORT, + DEFAULT_START_ON_BOOT, DEFAULT_TRUST_GRANT_TTL_MS, DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, @@ -231,6 +232,7 @@ import { serverPortSchema, serverRestartCommand, serverStartCommand, + serverStartOnBootSchema, serverStateSchema, serverStatsBodySchema, serverStatsCommand, @@ -239,6 +241,7 @@ import { serverStatusCommand, serverStopCommand, serverTunnelBodySchema, + serverTunnelCreateBodySchema, serverTunnelCreateCommand, serverTunnelGetCommand, serverUpdateSettingsBodySchema, @@ -281,7 +284,7 @@ import { verifyTrustGrant, worldNameSchema, wrapEventBody -} from "../chunks/index-yfmvvt5g.js"; +} from "../chunks/index-3yjqz9zv.js"; import"../chunks/index-g1frygvt.js"; export { wrapEventBody, @@ -326,6 +329,7 @@ export { serverUpdateSettingsBodySchema, serverTunnelGetCommand, serverTunnelCreateCommand, + serverTunnelCreateBodySchema, serverTunnelBodySchema, serverStopCommand, serverStatusCommand, @@ -334,6 +338,7 @@ export { serverStatsCommand, serverStatsBodySchema, serverStateSchema, + serverStartOnBootSchema, serverStartCommand, serverRestartCommand, serverPortSchema, @@ -550,6 +555,7 @@ export { DOMAIN_AGENT_HTTP, DOMAIN_AGENT_AUTH, DEFAULT_TRUST_GRANT_TTL_MS, + DEFAULT_START_ON_BOOT, DEFAULT_SERVER_PORT, DEFAULT_COMMAND_TTL_MS, CommandRegistry, diff --git a/lib/types/protocol/commands/server.d.ts b/lib/types/protocol/commands/server.d.ts index 4c20513..f7cdc6c 100644 --- a/lib/types/protocol/commands/server.d.ts +++ b/lib/types/protocol/commands/server.d.ts @@ -16,6 +16,17 @@ export declare const serverLoaderSchema: z.ZodEnum<{ }>; export type ServerLoader = z.infer; export declare const serverPortSchema: z.ZodNumber; +/** + * What a server does when the machine boots: always start, stay off, or come back the way + * it was (running if it was running when the machine went down). + */ +export declare const serverStartOnBootSchema: z.ZodEnum<{ + off: "off"; + on: "on"; + previous: "previous"; +}>; +export type ServerStartOnBoot = z.infer; +export declare const DEFAULT_START_ON_BOOT: ServerStartOnBoot; export declare const serverMemoryMbSchema: z.ZodNumber; export declare const consoleLineSchema: z.ZodString; export declare const minecraftVersionSchema: z.ZodString; @@ -55,6 +66,11 @@ export declare const serverUpdateSettingsBodySchema: z.ZodObject<{ memory_mb: z.ZodOptional; jvm_args: z.ZodOptional>; port: z.ZodOptional; + start_on_boot: z.ZodOptional>; eula_accepted: z.ZodOptional; }, z.core.$strict>; export declare const serverConsoleSendBodySchema: z.ZodObject<{ @@ -123,6 +139,7 @@ export declare const serverUpdateSettingsCommand: import("..").CommandDefinition memory_mb?: number | undefined; jvm_args?: string[] | undefined; port?: number | undefined; + start_on_boot?: "off" | "on" | "previous" | undefined; eula_accepted?: boolean | undefined; }>; export declare const serverConsoleSendCommand: import("..").CommandDefinition<"server.console.send", { @@ -170,6 +187,7 @@ export declare const SERVER_COMMANDS: readonly [import("..").CommandDefinition<" memory_mb?: number | undefined; jvm_args?: string[] | undefined; port?: number | undefined; + start_on_boot?: "off" | "on" | "previous" | undefined; eula_accepted?: boolean | undefined; }>, import("..").CommandDefinition<"server.console.send", { server_id: string; diff --git a/lib/types/protocol/commands/tunnel.d.ts b/lib/types/protocol/commands/tunnel.d.ts index 4caca96..b2309f3 100644 --- a/lib/types/protocol/commands/tunnel.d.ts +++ b/lib/types/protocol/commands/tunnel.d.ts @@ -19,6 +19,10 @@ export declare const tunnelPlayitClaimCancelCommand: import("..").CommandDefinit export declare const serverTunnelBodySchema: z.ZodObject<{ server_id: z.ZodString; }, z.core.$strict>; +export declare const serverTunnelCreateBodySchema: z.ZodObject<{ + server_id: z.ZodString; + replace: z.ZodOptional; +}, z.core.$strict>; /** The server's playit tunnel and its public address, when the agent manages its own tunnels. */ export declare const serverTunnelGetCommand: import("..").CommandDefinition<"server.tunnel.get", { server_id: string; @@ -26,6 +30,7 @@ export declare const serverTunnelGetCommand: import("..").CommandDefinition<"ser /** Creates the server's Minecraft Java tunnel on playit (or points it at the server's current port). */ export declare const serverTunnelCreateCommand: import("..").CommandDefinition<"server.tunnel.create", { server_id: string; + replace?: boolean | undefined; }>; export declare const TUNNEL_COMMANDS: readonly [import("..").CommandDefinition<"tunnel.playit.set_key", { secret_key: string; @@ -33,5 +38,6 @@ export declare const TUNNEL_COMMANDS: readonly [import("..").CommandDefinition<" server_id: string; }>, import("..").CommandDefinition<"server.tunnel.create", { server_id: string; + replace?: boolean | undefined; }>]; export declare function registerTunnelCommands(registry: CommandRegistry): CommandRegistry; diff --git a/lib/types/protocol/index.d.ts b/lib/types/protocol/index.d.ts index 96d8aa2..1393618 100644 --- a/lib/types/protocol/index.d.ts +++ b/lib/types/protocol/index.d.ts @@ -8,9 +8,9 @@ export { FILES_COMMANDS, fileEncodingSchema, filesCopyCommand, filesDeleteComman export { HOST_COMMANDS, type HostInfoBody, type HostInfoResult, hostInfoBodySchema, hostInfoCommand, hostInfoResultSchema, registerHostCommands, } from "./commands/host"; export { MODPACK_COMMANDS, MODPACK_INSTALL_ERROR_CODES, MODPACK_INSTALL_JOB_STATES, MODPACK_INSTALL_PHASES, MODPACK_SOURCES, type ModpackInstallErrorCode, type ModpackInstallJobState, type ModpackInstallJobStatus, type ModpackInstallPhase, type ModpackInstallSkippedItem, type ModpackSource, modpackInstallErrorCodeSchema, modpackInstallJobStateSchema, modpackInstallJobStatusSchema, modpackInstallPhaseSchema, modpackInstallSkippedItemSchema, modpackSourceSchema, registerModpackCommands, type ServerInstallModpackAcceptedEvent, type ServerInstallModpackBody, type ServerInstallModpackCancelBody, type ServerInstallModpackProgressEvent, type ServerInstallModpackResultEvent, type ServerInstallModpackStatusBody, type ServerInstallModpackStatusResult, serverInstallModpackAcceptedEventSchema, serverInstallModpackBodySchema, serverInstallModpackCancelBodySchema, serverInstallModpackCancelCommand, serverInstallModpackCommand, serverInstallModpackProgressEventSchema, serverInstallModpackResultEventSchema, serverInstallModpackStatusBodySchema, serverInstallModpackStatusCommand, serverInstallModpackStatusResultSchema, } from "./commands/modpack"; export { agentRevocationsSetCommand, PAIRING_COMMANDS, registerPairingCommands, } from "./commands/pairing"; -export { consoleLineSchema, DEFAULT_SERVER_PORT, loaderVersionSchema, MAX_CONSOLE_LINE_LENGTH, MAX_JVM_ARGS, MAX_SERVER_MEMORY_MB, MIN_SERVER_MEMORY_MB, minecraftVersionSchema, registerServerCommands, SERVER_COMMANDS, SERVER_ID_REGEX, type ServerChangeRuntimeBody, type ServerConsoleSendBody, type ServerConsoleSubscribeBody, type ServerCreateBody, type ServerLoader, type ServerStatsBody, type ServerStatsResult, type ServerUpdateSettingsBody, serverChangeRuntimeBodySchema, serverChangeRuntimeCommand, serverConsoleHistoryBodySchema, serverConsoleHistoryCommand, serverConsoleSendBodySchema, serverConsoleSendCommand, serverConsoleSubscribeBodySchema, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, serverCreateBodySchema, serverCreateCommand, serverIdSchema, serverListCommand, serverLoaderSchema, serverMemoryMbSchema, serverPortSchema, serverRestartCommand, serverStatsBodySchema, serverStatsCommand, serverStatsResultSchema, serverStatusCommand, serverUpdateSettingsBodySchema, serverUpdateSettingsCommand, } from "./commands/server"; +export { consoleLineSchema, DEFAULT_SERVER_PORT, DEFAULT_START_ON_BOOT, loaderVersionSchema, MAX_CONSOLE_LINE_LENGTH, MAX_JVM_ARGS, MAX_SERVER_MEMORY_MB, MIN_SERVER_MEMORY_MB, minecraftVersionSchema, registerServerCommands, SERVER_COMMANDS, SERVER_ID_REGEX, type ServerChangeRuntimeBody, type ServerConsoleSendBody, type ServerConsoleSubscribeBody, type ServerCreateBody, type ServerLoader, type ServerStartOnBoot, type ServerStatsBody, type ServerStatsResult, type ServerUpdateSettingsBody, serverChangeRuntimeBodySchema, serverChangeRuntimeCommand, serverConsoleHistoryBodySchema, serverConsoleHistoryCommand, serverConsoleSendBodySchema, serverConsoleSendCommand, serverConsoleSubscribeBodySchema, serverConsoleSubscribeCommand, serverConsoleUnsubscribeCommand, serverCreateBodySchema, serverCreateCommand, serverIdSchema, serverListCommand, serverLoaderSchema, serverMemoryMbSchema, serverPortSchema, serverRestartCommand, serverStartOnBootSchema, serverStatsBodySchema, serverStatsCommand, serverStatsResultSchema, serverStatusCommand, serverUpdateSettingsBodySchema, serverUpdateSettingsCommand, } from "./commands/server"; export { blobKeySchema, type ModEnvironmentInfo, type ModLayer, type ModSource, modEnvironmentInfoSchema, modFileNameSchema, modLayerSchema, modSourceSchema, type OriginPlanFileInput, type OriginPlanModInput, originPlanFileInputSchema, originPlanModInputSchema, RESERVED_WORLD_NAMES, registerStateCommands, type ServerDeployServerpackBody, type ServerModEntry, type ServerModsIdentifyBody, type ServerModsInstallBody, type ServerModsListBody, type ServerModsRemoveBody, type ServerModsReplaceBody, type ServerModsToggleBody, type ServerOrigin, type ServerOriginApplyBody, type ServerOriginPlanBody, type ServerOriginSyncState, type ServerOriginUnlinkBody, type ServerWorldImportBody, SHA1_HEX_PATTERN, SHA512_HEX_PATTERN, STATE_COMMANDS, serverDeployServerpackBodySchema, serverDeployServerpackCommand, serverModEntrySchema, serverModsIdentifyBodySchema, serverModsIdentifyCommand, serverModsInstallBodySchema, serverModsInstallCommand, serverModsListBodySchema, serverModsListCommand, serverModsRemoveBodySchema, serverModsRemoveCommand, serverModsReplaceBodySchema, serverModsReplaceCommand, serverModsToggleBodySchema, serverModsToggleCommand, serverOriginApplyBodySchema, serverOriginApplyCommand, serverOriginPlanBodySchema, serverOriginPlanCommand, serverOriginSchema, serverOriginSyncStateSchema, serverOriginUnlinkBodySchema, serverOriginUnlinkCommand, serverWorldImportBodySchema, serverWorldImportCommand, sha1HexSchema, sha512HexSchema, WORLD_NAME_REGEX, worldNameSchema, } from "./commands/state"; -export { PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, registerTunnelCommands, serverTunnelBodySchema, serverTunnelCreateCommand, serverTunnelGetCommand, TUNNEL_COMMANDS, type TunnelPlayitSetKeyBody, tunnelPlayitClaimBeginCommand, tunnelPlayitClaimCancelCommand, tunnelPlayitClaimStatusCommand, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStatusCommand, tunnelPlayitStopCommand, } from "./commands/tunnel"; +export { PLAYIT_SECRET_KEY_REGEX, playitSecretKeySchema, registerTunnelCommands, serverTunnelBodySchema, serverTunnelCreateBodySchema, serverTunnelCreateCommand, serverTunnelGetCommand, TUNNEL_COMMANDS, type TunnelPlayitSetKeyBody, tunnelPlayitClaimBeginCommand, tunnelPlayitClaimCancelCommand, tunnelPlayitClaimStatusCommand, tunnelPlayitSetKeyBodySchema, tunnelPlayitSetKeyCommand, tunnelPlayitStartCommand, tunnelPlayitStatusCommand, tunnelPlayitStopCommand, } from "./commands/tunnel"; export { DOMAIN_AGENT_AUTH, DOMAIN_AGENT_HTTP, DOMAIN_AGENT_MESSAGE, DOMAIN_COMMAND, DOMAIN_PAIRING_PROOF, DOMAIN_REVOCATION, DOMAIN_ROLE_GRANT, DOMAIN_SESSION, DOMAIN_TRUST_GRANT, PROTOCOL_VERSION, } from "./domains"; export { ProtocolError, type ProtocolErrorCode } from "./errors"; export { type BuildPairingFragmentParams, buildPairingFragment, DEFAULT_TRUST_GRANT_TTL_MS, generatePairingCode, generatePairingSecret, MAX_TRUST_GRANT_TTL_MS, PAIRING_CODE_LENGTH, PAIRING_SECRET_BYTES, type PairingFragment, pairingCodeSchema, parsePairingFragment, type SignTrustGrantParams, signTrustGrant, type TrustGrant, trustGrantSchema, type VerifiedTrustGrant, type VerifyTrustGrantOptions, verifyTrustGrant, } from "./pairing"; diff --git a/lib/vault/index.js b/lib/vault/index.js index d4c2439..8cf6ce5 100644 --- a/lib/vault/index.js +++ b/lib/vault/index.js @@ -6,7 +6,7 @@ import { sessionCertificateSchema, signRevocationList, signSessionCertificate -} from "../chunks/index-yfmvvt5g.js"; +} from "../chunks/index-3yjqz9zv.js"; import { KDF_ALG_ARGON2ID13, KDF_MODERATE, diff --git a/src/cli/run.ts b/src/cli/run.ts index 959505f..501905d 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -31,6 +31,7 @@ import { type TransportFrame, } from "../protocol"; import { + applyStartOnBoot, createServerManager, createServerStatusWatcher, DEFAULT_SERVERS_DIR, @@ -374,6 +375,19 @@ export async function createAgentRuntime( backupManager.start(); modpackInstaller.start(); void tunnelManager.resume(); + if (serverManager !== undefined) { + const manager = serverManager; + void applyStartOnBoot({ + stateDir: options.stateDir, + listServers: () => manager.listServers(), + startServer: (serverId) => manager.startServer(serverId), + logger, + }).catch((error: unknown) => { + logger.warn("Starting servers with the machine failed", { + error: error instanceof Error ? error.message : String(error), + }); + }); + } }, shutdown(drainTimeoutMs: number = SHUTDOWN_DRAIN_TIMEOUT_MS): Promise { diff --git a/src/protocol/commands/server.ts b/src/protocol/commands/server.ts index 5a7db9f..9347217 100644 --- a/src/protocol/commands/server.ts +++ b/src/protocol/commands/server.ts @@ -19,6 +19,14 @@ export const serverLoaderSchema = z.enum(["vanilla", "fabric", "forge", "neoforg export type ServerLoader = z.infer; export const serverPortSchema = z.number().int().min(1024).max(65535); + +/** + * What a server does when the machine boots: always start, stay off, or come back the way + * it was (running if it was running when the machine went down). + */ +export const serverStartOnBootSchema = z.enum(["on", "off", "previous"]); +export type ServerStartOnBoot = z.infer; +export const DEFAULT_START_ON_BOOT: ServerStartOnBoot = "previous"; export const serverMemoryMbSchema = z .number() .int() @@ -72,6 +80,7 @@ export const serverUpdateSettingsBodySchema = z memory_mb: serverMemoryMbSchema.optional(), jvm_args: z.array(z.string()).max(MAX_JVM_ARGS).optional(), port: serverPortSchema.optional(), + start_on_boot: serverStartOnBootSchema.optional(), eula_accepted: z.boolean().optional(), }) .strict(); diff --git a/src/protocol/commands/tunnel.ts b/src/protocol/commands/tunnel.ts index a25f2d0..15b6b6a 100644 --- a/src/protocol/commands/tunnel.ts +++ b/src/protocol/commands/tunnel.ts @@ -75,6 +75,14 @@ export const tunnelPlayitClaimCancelCommand = defineCommand({ export const serverTunnelBodySchema = z.object({ server_id: serverIdSchema }).strict(); +export const serverTunnelCreateBodySchema = z + .object({ + server_id: serverIdSchema, + /** Drop the server's current tunnel and make a fresh one (new address) on its current port. */ + replace: z.boolean().optional(), + }) + .strict(); + /** The server's playit tunnel and its public address, when the agent manages its own tunnels. */ export const serverTunnelGetCommand = defineCommand({ type: "server.tunnel.get", @@ -88,7 +96,7 @@ export const serverTunnelCreateCommand = defineCommand({ type: "server.tunnel.create", level: "session", minRole: "admin", - body: serverTunnelBodySchema, + body: serverTunnelCreateBodySchema, }); export const TUNNEL_COMMANDS = [ diff --git a/src/protocol/index.ts b/src/protocol/index.ts index e419cdc..a91ff62 100644 --- a/src/protocol/index.ts +++ b/src/protocol/index.ts @@ -198,6 +198,7 @@ export { export { consoleLineSchema, DEFAULT_SERVER_PORT, + DEFAULT_START_ON_BOOT, loaderVersionSchema, MAX_CONSOLE_LINE_LENGTH, MAX_JVM_ARGS, @@ -212,6 +213,7 @@ export { type ServerConsoleSubscribeBody, type ServerCreateBody, type ServerLoader, + type ServerStartOnBoot, type ServerStatsBody, type ServerStatsResult, type ServerUpdateSettingsBody, @@ -232,6 +234,7 @@ export { serverMemoryMbSchema, serverPortSchema, serverRestartCommand, + serverStartOnBootSchema, serverStatsBodySchema, serverStatsCommand, serverStatsResultSchema, @@ -306,6 +309,7 @@ export { playitSecretKeySchema, registerTunnelCommands, serverTunnelBodySchema, + serverTunnelCreateBodySchema, serverTunnelCreateCommand, serverTunnelGetCommand, TUNNEL_COMMANDS, diff --git a/src/server/index.ts b/src/server/index.ts index 7efe3df..ea0a529 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -119,6 +119,13 @@ export { type ServerManagerOptions, type ServerStatusReport, } from "./runtime"; +export { + applyStartOnBoot, + readLinuxBootId, + START_ON_BOOT_FILENAME, + type StartOnBootOptions, + shouldStartOnBoot, +} from "./start-on-boot"; export { ALLOWED_XX_BOOLEAN_FLAGS, ALLOWED_XX_VALUE_KEYS, diff --git a/src/server/registry.ts b/src/server/registry.ts index 8508407..19ca3e5 100644 --- a/src/server/registry.ts +++ b/src/server/registry.ts @@ -15,6 +15,7 @@ import { serverOriginSchema, serverOriginSyncStateSchema, serverPortSchema, + serverStartOnBootSchema, } from "../protocol"; import { resolveServerDir, resolveServerSubpath } from "./id"; import { @@ -75,6 +76,9 @@ export const serverMetadataSchema = z mods: z.array(serverModEntrySchema).max(4000).optional(), origin: serverOriginSchema.optional(), origin_sync: serverOriginSyncStateSchema.optional(), + start_on_boot: serverStartOnBootSchema.optional(), + /** Whether the server was left running by the last start or stop, for start_on_boot "previous". */ + last_running: z.boolean().optional(), }) .strict(); diff --git a/src/server/runtime.ts b/src/server/runtime.ts index ace173d..a427b67 100644 --- a/src/server/runtime.ts +++ b/src/server/runtime.ts @@ -347,13 +347,28 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM ...(options.runFixedImpl !== undefined ? { runFixedImpl: options.runFixedImpl } : {}), ...(options.logger !== undefined ? { logger: options.logger } : {}), }); + rememberRunning(validId, true); + } + + /** Kept for start_on_boot "previous"; a failure here never fails the start or stop itself. */ + function rememberRunning(serverId: string, running: boolean): void { + try { + const current = readServerMetadata(serversDir, serverId); + if (current.last_running === running) return; + writeServerMetadata(serversDir, { ...current, last_running: running }, permissionContext); + } catch (error) { + options.logger?.warn("Could not record the server's running state", { + serverId, + error: error instanceof Error ? error.message : String(error), + }); + } } async function stopServer(serverId: string): Promise { const validId = assertValidServerId(serverId); readServerMetadata(serversDir, validId); - return stopServerUnit(validId, { + const status = await stopServerUnit(validId, { runDir, now, ...(options.runFixedImpl !== undefined ? { runFixedImpl: options.runFixedImpl } : {}), @@ -364,6 +379,8 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM ...(options.stopTimeoutMs !== undefined ? { stopTimeoutMs: options.stopTimeoutMs } : {}), ...(options.sleepImpl !== undefined ? { sleepImpl: options.sleepImpl } : {}), }); + rememberRunning(validId, false); + return status; } async function restartServer(serverId: string): Promise { @@ -461,6 +478,9 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM memory_mb: nextMemoryMb, jvm_args: nextJvmArgs, port: nextPort, + ...(parsedParams.data.start_on_boot !== undefined + ? { start_on_boot: parsedParams.data.start_on_boot } + : {}), }; const javaMajor = selectJavaMajor(updated.minecraft_version); diff --git a/src/server/start-on-boot.test.ts b/src/server/start-on-boot.test.ts new file mode 100644 index 0000000..ec1a2f4 --- /dev/null +++ b/src/server/start-on-boot.test.ts @@ -0,0 +1,95 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { afterEach, describe, expect, test } from "bun:test"; +import { mkdtempSync, rmSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { ProtocolError } from "../protocol"; +import type { ServerMetadata } from "./registry"; +import { applyStartOnBoot, shouldStartOnBoot } from "./start-on-boot"; + +const dirs: string[] = []; +afterEach(() => { + for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true }); +}); + +function stateDir(): string { + const dir = mkdtempSync(join(tmpdir(), "tegrad-start-on-boot-")); + dirs.push(dir); + return dir; +} + +function server(id: string, patch: Partial = {}): ServerMetadata { + return { + v: 1, + id, + name: id, + minecraft_version: "1.21.1", + loader: "fabric", + loader_version: null, + memory_mb: 2048, + jvm_args: [], + port: 25565, + created_at: 0, + ...patch, + }; +} + +describe("start on boot", () => { + test("on always starts, off never, previous follows the last start or stop", () => { + expect(shouldStartOnBoot(server("a", { start_on_boot: "on" }))).toBe(true); + expect(shouldStartOnBoot(server("a", { start_on_boot: "off", last_running: true }))).toBe( + false, + ); + expect(shouldStartOnBoot(server("a", { start_on_boot: "previous", last_running: true }))).toBe( + true, + ); + expect(shouldStartOnBoot(server("a", { last_running: true }))).toBe(true); + expect(shouldStartOnBoot(server("a"))).toBe(false); + }); + + test("starts the chosen servers once per boot and keeps going past failures", async () => { + const dir = stateDir(); + const started: string[] = []; + const servers = [ + server("on", { start_on_boot: "on" }), + server("off", { start_on_boot: "off", last_running: true }), + server("was-running", { last_running: true }), + server("clash", { start_on_boot: "on" }), + server("already", { start_on_boot: "on" }), + ]; + let bootId = "boot-1"; + const run = () => + applyStartOnBoot({ + stateDir: dir, + listServers: () => servers, + readBootId: () => bootId, + startServer: async (id) => { + if (id === "clash") throw new ProtocolError("port_in_use", "taken"); + if (id === "already") throw new ProtocolError("server_running", "running"); + started.push(id); + }, + }); + + expect(await run()).toEqual(["on", "was-running"]); + // tegrad restarted on the same boot: nothing starts again. + expect(await run()).toEqual([]); + bootId = "boot-2"; + expect(await run()).toEqual(["on", "was-running"]); + expect(started).toEqual(["on", "was-running", "on", "was-running"]); + }); + + test("does nothing when the boot cannot be told", async () => { + const started: string[] = []; + await applyStartOnBoot({ + stateDir: stateDir(), + listServers: () => [server("on", { start_on_boot: "on" })], + readBootId: () => null, + startServer: async (id) => { + started.push(id); + }, + }); + expect(started).toEqual([]); + }); +}); diff --git a/src/server/start-on-boot.ts b/src/server/start-on-boot.ts new file mode 100644 index 0000000..25e2ba4 --- /dev/null +++ b/src/server/start-on-boot.ts @@ -0,0 +1,83 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright (C) 2026 Antônio Miranda + +import { existsSync, readFileSync } from "node:fs"; +import { join } from "node:path"; +import type { Logger } from "../agent/logger"; +import { writeFileAtomic } from "../agent/state"; +import { DEFAULT_START_ON_BOOT, ProtocolError } from "../protocol"; +import type { ServerMetadata } from "./registry"; + +/** Remembers the boot the servers were last brought up for, so a tegrad restart starts nothing. */ +export const START_ON_BOOT_FILENAME = "start-on-boot.json"; +const BOOT_ID_PATH = "/proc/sys/kernel/random/boot_id"; + +export interface StartOnBootOptions { + readonly stateDir: string; + readonly listServers: () => readonly ServerMetadata[]; + readonly startServer: (serverId: string) => Promise; + readonly logger?: Logger; + /** The machine's current boot, or null when it cannot be told (then servers are never started). */ + readonly readBootId?: () => string | null; +} + +export function readLinuxBootId(): string | null { + try { + const id = readFileSync(BOOT_ID_PATH, "utf8").trim(); + return id.length > 0 ? id : null; + } catch { + return null; + } +} + +/** Whether a server comes up on this boot, from its start_on_boot choice. */ +export function shouldStartOnBoot(meta: ServerMetadata): boolean { + const mode = meta.start_on_boot ?? DEFAULT_START_ON_BOOT; + if (mode === "on") return true; + if (mode === "off") return false; + return meta.last_running === true; +} + +/** + * Starts the servers set to come up with the machine, once per boot. Restarting tegrad + * (an update, a crash) on the same boot leaves servers as they are. + */ +export async function applyStartOnBoot(options: StartOnBootOptions): Promise { + const bootId = (options.readBootId ?? readLinuxBootId)(); + if (bootId === null) return []; + const markerPath = join(options.stateDir, START_ON_BOOT_FILENAME); + if (readMarker(markerPath) === bootId) return []; + // Written first: a server that brings tegrad down must not be started again on its restart. + writeFileAtomic(markerPath, `${JSON.stringify({ boot_id: bootId })}\n`, { + mode: 0o600, + dirMode: 0o700, + }); + + const started: string[] = []; + for (const server of options.listServers()) { + if (!shouldStartOnBoot(server)) continue; + try { + await options.startServer(server.id); + started.push(server.id); + options.logger?.info("Started server with the machine", { serverId: server.id }); + } catch (error) { + // Already running is fine; anything else (a port another server took, no memory) is logged. + if (error instanceof ProtocolError && error.code === "server_running") continue; + options.logger?.warn("Could not start server with the machine", { + serverId: server.id, + error: error instanceof Error ? error.message : String(error), + }); + } + } + return started; +} + +function readMarker(path: string): string | null { + if (!existsSync(path)) return null; + try { + const parsed = JSON.parse(readFileSync(path, "utf8")) as { boot_id?: unknown }; + return typeof parsed.boot_id === "string" ? parsed.boot_id : null; + } catch { + return null; + } +} diff --git a/src/state/modpack-installer.test.ts b/src/state/modpack-installer.test.ts index c9f16df..86e9645 100644 --- a/src/state/modpack-installer.test.ts +++ b/src/state/modpack-installer.test.ts @@ -553,7 +553,7 @@ describe("Background server.install_modpack", () => { { name: "Pack-Server/config/create.toml", data: new Uint8Array(Buffer.from("a=1")) }, { name: "Pack-Server/start.sh", - data: new Uint8Array(Buffer.from("#!/bin/sh" + String.fromCharCode(10) + "echo pack")), + data: new Uint8Array(Buffer.from(`#!/bin/sh${String.fromCharCode(10)}echo pack`)), }, ]); const resultEvents: ServerInstallModpackResultEvent[] = []; diff --git a/src/tunnel/playit-account.test.ts b/src/tunnel/playit-account.test.ts index cba56a7..77a5af4 100644 --- a/src/tunnel/playit-account.test.ts +++ b/src/tunnel/playit-account.test.ts @@ -294,6 +294,56 @@ describe("server tunnels", () => { expect(result.tunnel?.id).toBe("t-old"); }); + test("replace drops the server's tunnel and makes a fresh one, never adopting", async () => { + const tunnels: PlayitAccountTunnel[] = [tunnel("t-stray", 25566)]; + const deleted: string[] = []; + let next = 0; + let port = 25565; + const account = await linkedAccount( + { + listTunnels: async () => ({ tunnels }), + createMinecraftTunnel: async (_key, _agentId, _name, at) => { + const id = `t-${++next}`; + tunnels.push(tunnel(id, at, `${id}.joinmc.link`)); + return { id }; + }, + deleteTunnel: async (_key, id) => { + deleted.push(id); + tunnels.splice( + tunnels.findIndex((entry) => entry.id === id), + 1, + ); + return null; + }, + }, + () => port, + ); + await account.createServerTunnel("aged"); + port = 25566; + const fresh = await account.createServerTunnel("aged", { replace: true }); + expect(deleted).toEqual(["t-1"]); + expect(fresh.tunnel).toMatchObject({ id: "t-2", local_port: 25566, port_matches: true }); + expect(tunnels.map((entry) => entry.id)).toEqual(["t-stray", "t-2"]); + }); + + test("replace goes on when playit already removed the tunnel", async () => { + const tunnels: PlayitAccountTunnel[] = []; + let next = 0; + const account = await linkedAccount({ + listTunnels: async () => ({ tunnels }), + createMinecraftTunnel: async (_key, _agentId, _name, at) => { + const id = `t-${++next}`; + tunnels.push(tunnel(id, at)); + return { id }; + }, + deleteTunnel: async () => { + throw new PlayitApiFail("TunnelNotFound"); + }, + }); + await account.createServerTunnel("aged"); + expect((await account.createServerTunnel("aged", { replace: true })).tunnel?.id).toBe("t-2"); + }); + test("a pasted key leaves tunnels to playit.gg", async () => { const dir = stateDir(); const { manager } = fakeTunnel(dir); diff --git a/src/tunnel/playit-account.ts b/src/tunnel/playit-account.ts index d6c5455..a024977 100644 --- a/src/tunnel/playit-account.ts +++ b/src/tunnel/playit-account.ts @@ -262,16 +262,40 @@ export function createPlayitAccount(options: PlayitAccountOptions) { return { managed: true, tunnel: found ? toView(found, server.port) : null }; } - async function createServerTunnel(serverId: string) { + async function createServerTunnel(serverId: string, opts: { replace?: boolean } = {}) { const server = options.resolveServer(serverId); - const { account, key } = requireManaged(); - const existing = await findServerTunnel(key, account, serverId); + const managed = requireManaged(); + const { key } = managed; + let account = managed.account; + let existing = await findServerTunnel(key, account, serverId); + if (opts.replace === true) { + if (existing !== null) { + try { + await options.api.deleteTunnel(key, existing.id); + } catch (error) { + // Already gone on playit.gg is what we wanted anyway. + if (!(error instanceof PlayitApiFail && String(error.detail) === "TunnelNotFound")) { + throw error instanceof PlayitApiFail + ? new ProtocolError( + "tunnel_api_failed", + `playit refused to remove the tunnel: ${String(error.detail)}`, + ) + : error; + } + } + } + const { [serverId]: _dropped, ...rest } = account.tunnels; + account = { ...account, tunnels: rest }; + writeAccount(account); + existing = null; + } if (existing !== null) { if (tunnelLocalPort(existing) !== server.port) { await options.api.setTunnelPort(key, existing.id, server.port); } } else { - const adopted = await findTunnelOnPort(key, account, server.port); + const adopted = + opts.replace === true ? null : await findTunnelOnPort(key, account, server.port); if (adopted !== null) { writeAccount({ ...account, tunnels: { ...account.tunnels, [serverId]: adopted.id } }); return getServerTunnel(serverId); diff --git a/src/tunnel/playit-api.ts b/src/tunnel/playit-api.ts index d401fe1..77023ee 100644 --- a/src/tunnel/playit-api.ts +++ b/src/tunnel/playit-api.ts @@ -136,6 +136,9 @@ export function createPlayitApi(options: PlayitApiOptions = {}) { }, secretKey, ), + // playit has no /v1 delete; its own clients still call the older path. + deleteTunnel: (secretKey: string, tunnelId: string) => + call("/tunnels/delete", { tunnel_id: tunnelId }, secretKey), setTunnelPort: (secretKey: string, tunnelId: string, localPort: number) => call( "/v1/tunnels/config", diff --git a/src/tunnel/playit.ts b/src/tunnel/playit.ts index 823cfdb..69851e1 100644 --- a/src/tunnel/playit.ts +++ b/src/tunnel/playit.ts @@ -450,10 +450,10 @@ export function registerTunnelHandlers( }); queue.registerHandler("server.tunnel.create", async (opened, ctx) => { - const body = opened.body as { server_id: string }; + const body = opened.body as { server_id: string; replace?: boolean }; ctx.sendEvent("server.tunnel.created", { server_id: body.server_id, - ...(await account.createServerTunnel(body.server_id)), + ...(await account.createServerTunnel(body.server_id, { replace: body.replace === true })), }); }); } From 2529b14cc84b4ed5e3d977e287effe764f226003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B4nio=20Miranda?= Date: Mon, 30 Nov 2026 00:08:03 -0300 Subject: [PATCH 59/59] feat(tunnel): give a server its own port before its tunnel and report playit allocation errors --- src/cli/run.ts | 1 + src/server/index.ts | 1 + src/server/runtime.test.ts | 24 ++++++++++ src/server/runtime.ts | 48 +++++++++++++++++++ src/tunnel/playit-account.test.ts | 76 ++++++++++++++++++++++++++++++- src/tunnel/playit-account.ts | 57 +++++++++++++++++++++-- src/tunnel/playit-api.ts | 2 + 7 files changed, 204 insertions(+), 5 deletions(-) diff --git a/src/cli/run.ts b/src/cli/run.ts index 501905d..bd088eb 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -315,6 +315,7 @@ export async function createAgentRuntime( const meta = readServerMetadata(tunnelServersDir, serverId); return { name: meta.name, port: meta.port }; }, + ensureUniquePort: (serverId) => serverManager.ensureUniquePort(serverId), logger, ...(options.now !== undefined ? { now: options.now } : {}), }); diff --git a/src/server/index.ts b/src/server/index.ts index ea0a529..2b7069d 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -113,6 +113,7 @@ export { } from "./registry"; export { createServerManager, + type PortMove, registerServerHandlers, type ServerHandlerHooks, type ServerManager, diff --git a/src/server/runtime.test.ts b/src/server/runtime.test.ts index ac5f769..6cddbef 100644 --- a/src/server/runtime.test.ts +++ b/src/server/runtime.test.ts @@ -544,4 +544,28 @@ describe("server ports", () => { sysd.states.clear(); await manager.startServer("b"); }); + + test("a stopped server sharing a port moves to one of its own", async () => { + const { manager } = managerFor(); + await manager.createServer({ ...base, server_id: "a", port: 25565 }); + await manager.createServer({ ...base, server_id: "b", port: 25565 }); + expect(await manager.ensureUniquePort("b")).toEqual([ + { server_id: "b", from: 25565, to: 25566 }, + ]); + expect(manager.listServers().find((s) => s.id === "b")?.port).toBe(25566); + expect(await manager.ensureUniquePort("b")).toEqual([]); + }); + + test("a running server keeps its port and the stopped ones sharing it move", async () => { + const { manager } = managerFor(); + await manager.createServer({ ...base, server_id: "a", port: 25565 }); + await manager.createServer({ ...base, server_id: "b", port: 25565 }); + await manager.createServer({ ...base, server_id: "c", port: 25565 }); + await manager.startServer("a"); + expect(await manager.ensureUniquePort("a")).toEqual([ + { server_id: "b", from: 25565, to: 25566 }, + { server_id: "c", from: 25565, to: 25567 }, + ]); + expect(manager.listServers().find((s) => s.id === "a")?.port).toBe(25565); + }); }); diff --git a/src/server/runtime.ts b/src/server/runtime.ts index a427b67..9d1753e 100644 --- a/src/server/runtime.ts +++ b/src/server/runtime.ts @@ -116,6 +116,12 @@ export interface ServerManagerOptions { readonly listeningPorts?: ListeningPorts; } +export interface PortMove { + readonly server_id: string; + readonly from: number; + readonly to: number; +} + export interface ServerManager { createServer(params: ServerCreateBody): Promise; changeServerRuntime(params: ServerChangeRuntimeBody): Promise; @@ -129,6 +135,12 @@ export interface ServerManager { getServerState(serverId: string): Promise; listServers(): ServerMetadata[]; updateServerSettings(params: ServerUpdateSettingsBody): ServerMetadata; + /** + * Gives a server a port no other server of this agent uses. A stopped server moves to the next + * free port; a running one keeps its port and the stopped servers sharing it move instead. + * Returns the servers whose port changed. + */ + ensureUniquePort(serverId: string): Promise; sendConsole(serverId: string, line: string): void; subscribeConsole( serverId: string, @@ -510,6 +522,41 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM return updated; } + async function ensureUniquePort(serverId: string): Promise { + const validId = assertValidServerId(serverId); + const servers = listServerMetadata(serversDir); + const target = servers.find((server) => server.id === validId); + if (target === undefined) return []; + const sharing = servers.filter( + (server) => server.id !== validId && server.port === target.port, + ); + if (sharing.length === 0) return []; + + const taken = new Set(servers.map((server) => server.port)); + const moveOne = (server: ServerMetadata): PortMove => { + const to = nextFreeServerPort(taken, options.listeningPorts); + taken.add(to); + updateServerSettings({ server_id: server.id, port: to }); + options.logger?.info("Moved server to a port of its own", { + serverId: server.id, + from: server.port, + to, + }); + return { server_id: server.id, from: server.port, to }; + }; + + if (!isUnitActive(await getUnitStatus(validId, options.runFixedImpl))) { + return [moveOne(target)]; + } + // Only one server binds a port at a time, so the others sharing it are stopped. + const moves: PortMove[] = []; + for (const other of sharing) { + if (isUnitActive(await getUnitStatus(other.id, options.runFixedImpl))) continue; + moves.push(moveOne(other)); + } + return moves; + } + function sendConsole(serverId: string, line: string): void { const validId = assertValidServerId(serverId); sendConsoleLine({ @@ -577,6 +624,7 @@ export function createServerManager(options: ServerManagerOptions = {}): ServerM getServerState, listServers, updateServerSettings, + ensureUniquePort, sendConsole, subscribeConsole, consoleHistory, diff --git a/src/tunnel/playit-account.test.ts b/src/tunnel/playit-account.test.ts index 77a5af4..806ae85 100644 --- a/src/tunnel/playit-account.test.ts +++ b/src/tunnel/playit-account.test.ts @@ -8,7 +8,13 @@ import { join } from "node:path"; import { ProtocolError } from "../protocol"; import { savePlayitSecretKey } from "./key"; import type { PlayitTunnelManager } from "./playit"; -import { createPlayitAccount, PLAYIT_ACCOUNT_FILENAME, tunnelName } from "./playit-account"; +import { + createPlayitAccount, + PLAYIT_ACCOUNT_FILENAME, + type PlayitAccountOptions, + type PlayitPortMove, + tunnelName, +} from "./playit-account"; import { type PlayitAccountTunnel, type PlayitApi, @@ -160,7 +166,11 @@ describe("playit claim", () => { }); describe("server tunnels", () => { - async function linkedAccount(api: Partial, getPort: () => number = () => 25565) { + async function linkedAccount( + api: Partial, + getPort: () => number = () => 25565, + extra: Partial = {}, + ) { const dir = stateDir(); const { manager } = fakeTunnel(dir); const account = createPlayitAccount({ @@ -174,6 +184,7 @@ describe("server tunnels", () => { tunnel: manager, resolveServer: () => ({ name: "Aged 🌿", port: getPort() }), sleep: async () => {}, + ...extra, }); account.beginClaim(); await until(() => account.claimView()?.status === "approved"); @@ -258,6 +269,67 @@ describe("server tunnels", () => { expect(atmons.tunnel?.address).toBe("t-2.joinmc.link"); }); + test("a shared port moves to one of its own first, and moved servers keep their tunnels", async () => { + const tunnels: PlayitAccountTunnel[] = []; + const repointed: Array<{ id: string; port: number }> = []; + let port = 25565; + let next = 0; + let moves: PlayitPortMove[] = []; + const account = await linkedAccount( + { + listTunnels: async () => ({ tunnels }), + createMinecraftTunnel: async (_key, _agentId, _name, at) => { + const id = `t-${++next}`; + tunnels.push(tunnel(id, at)); + return { id }; + }, + setTunnelPort: async (_key, id, at) => { + repointed.push({ id, port: at }); + return null; + }, + }, + () => port, + { + ensureUniquePort: async () => { + const result = moves; + for (const move of result) if (move.server_id === "atmons") port = move.to; + return result; + }, + }, + ); + await account.createServerTunnel("aged"); + + // atmons is stopped and shares 25565: it moves, its tunnel is made on the new port. + moves = [{ server_id: "atmons", from: 25565, to: 25566 }]; + const atmons = await account.createServerTunnel("atmons"); + expect(atmons.port_moves).toEqual(moves); + expect(atmons.tunnel?.id).toBe("t-2"); + expect(atmons.tunnel?.local_port).toBe(25566); + + // A running server keeps its port; the stopped one with a tunnel moves and its tunnel follows. + moves = [{ server_id: "aged", from: 25565, to: 25567 }]; + await account.createServerTunnel("atmons"); + expect(repointed).toEqual([{ id: "t-1", port: 25567 }]); + }); + + test("reports why playit holds back the public address", async () => { + const stuck: PlayitAccountTunnel = { + ...tunnel("t-1", 25565), + connect_addresses: [], + offline_reasons: ["PublicAllocationPending"], + port_allocation_requests: [{ status: "AccountPortLimitReached" }], + }; + const account = await linkedAccount({ + listTunnels: async () => ({ tunnels: [stuck] }), + createMinecraftTunnel: async () => ({ id: "t-1" }), + }); + const result = await account.createServerTunnel("aged"); + expect(result.tunnel).toMatchObject({ + address: null, + allocation_error: "AccountPortLimitReached", + }); + }); + test("a server recorded with another server's tunnel gets its own", async () => { const tunnels = [tunnel("t-1", 25565)]; const account = await linkedAccount({ diff --git a/src/tunnel/playit-account.ts b/src/tunnel/playit-account.ts index a024977..50be3fc 100644 --- a/src/tunnel/playit-account.ts +++ b/src/tunnel/playit-account.ts @@ -46,6 +46,11 @@ export interface PlayitServerTunnelView { readonly address: string | null; readonly enabled: boolean; readonly offline_reasons: readonly string[]; + /** + * Why playit has not given the tunnel a public address yet, as playit words it (for example + * "AccountPortLimitReached"), or null when nothing is holding it back. + */ + readonly allocation_error: string | null; readonly local_port: number | null; /** False when the server's port changed after the tunnel was made; creating again fixes it. */ readonly port_matches: boolean; @@ -61,11 +66,22 @@ interface AccountFile { readonly tunnels: Record; } +export interface PlayitPortMove { + readonly server_id: string; + readonly from: number; + readonly to: number; +} + export interface PlayitAccountOptions { readonly stateDir: string; readonly api: PlayitApi; readonly tunnel: PlayitTunnelManager; readonly resolveServer: (serverId: string) => { readonly name: string; readonly port: number }; + /** + * Gives the server a port no other server uses before its tunnel is made, so two servers never + * end up behind one address. Returns the servers whose port changed. + */ + readonly ensureUniquePort?: (serverId: string) => Promise; readonly logger?: Logger; readonly now?: () => number; readonly sleep?: (ms: number) => Promise; @@ -216,6 +232,7 @@ export function createPlayitAccount(options: PlayitAccountOptions) { address: pickConnectAddress(tunnel.connect_addresses ?? []), enabled: tunnel.user_enabled, offline_reasons: tunnel.offline_reasons ?? [], + allocation_error: allocationError(tunnel), local_port: localPort, port_matches: localPort === serverPort, }; @@ -263,8 +280,9 @@ export function createPlayitAccount(options: PlayitAccountOptions) { } async function createServerTunnel(serverId: string, opts: { replace?: boolean } = {}) { - const server = options.resolveServer(serverId); const managed = requireManaged(); + const portMoves = (await options.ensureUniquePort?.(serverId)) ?? []; + const server = options.resolveServer(serverId); const { key } = managed; let account = managed.account; let existing = await findServerTunnel(key, account, serverId); @@ -298,7 +316,8 @@ export function createPlayitAccount(options: PlayitAccountOptions) { opts.replace === true ? null : await findTunnelOnPort(key, account, server.port); if (adopted !== null) { writeAccount({ ...account, tunnels: { ...account.tunnels, [serverId]: adopted.id } }); - return getServerTunnel(serverId); + await followMovedServers(key, serverId, portMoves); + return { ...(await getServerTunnel(serverId)), port_moves: portMoves }; } const agentId = await learnAgentId(key); let created: { id: string }; @@ -321,7 +340,31 @@ export function createPlayitAccount(options: PlayitAccountOptions) { const latest = readAccount() ?? account; writeAccount({ ...latest, tunnels: { ...latest.tunnels, [serverId]: created.id } }); } - return getServerTunnel(serverId); + await followMovedServers(key, serverId, portMoves); + return { ...(await getServerTunnel(serverId)), port_moves: portMoves }; + } + + /** Other servers that moved to a port of their own keep their tunnels working. */ + async function followMovedServers( + key: string, + serverId: string, + moves: readonly PlayitPortMove[], + ): Promise { + const account = readAccount(); + if (account === null) return; + for (const move of moves) { + if (move.server_id === serverId) continue; + const tunnelId = account.tunnels[move.server_id]; + if (tunnelId === undefined || ownerOf(account, tunnelId) !== move.server_id) continue; + try { + await options.api.setTunnelPort(key, tunnelId, move.to); + } catch (error) { + options.logger?.warn("Could not point a moved server's tunnel at its new port", { + serverId: move.server_id, + error: error instanceof Error ? error.message : String(error), + }); + } + } } function keyHint(): string | null { @@ -351,6 +394,14 @@ export function createPlayitAccount(options: PlayitAccountOptions) { export type PlayitAccount = ReturnType; /** playit only takes short ASCII names. */ +/** playit's reason for holding back the public address, from the tunnel's pending requests. */ +function allocationError(tunnel: PlayitAccountTunnel): string | null { + for (const request of tunnel.port_allocation_requests ?? []) { + if (typeof request.status === "string" && request.status !== "Pending") return request.status; + } + return null; +} + export function tunnelName(serverName: string): string { const ascii = serverName .normalize("NFKD") diff --git a/src/tunnel/playit-api.ts b/src/tunnel/playit-api.ts index 77023ee..5aaaf73 100644 --- a/src/tunnel/playit-api.ts +++ b/src/tunnel/playit-api.ts @@ -50,6 +50,8 @@ export interface PlayitAccountTunnel { } | { readonly type: "not-set"; readonly details: unknown }; readonly connect_addresses: readonly PlayitConnectAddress[]; + /** Addresses playit is still trying to hand out, with why one is stuck (a plan limit, say). */ + readonly port_allocation_requests?: readonly { readonly status?: string }[] | null; } export interface PlayitApiOptions {