AI Engineering Workspace
PartialChat, files, terminal and preview in one place. Chat sessions run on a durable Postgres-backed queue (chat only: no tools or shell). Live models need an API key; the terminal is unavailable.
Project files
read-only- ..
- baseline-v0.1.4-access-desktop.png
- baseline-v0.1.4-access-mobile.png
- baseline-v0.1.4-dashboard-desktop.png
- baseline-v0.1.4-dashboard-mobile.png
- baseline-v0.1.4-deployments-desktop.png
- baseline-v0.1.4-deployments-mobile.png
- baseline-v0.1.4-design-studio-desktop.png
- baseline-v0.1.4-design-studio-mobile.png
- baseline-v0.1.4-domains-desktop.png
- baseline-v0.1.4-domains-mobile.png
- baseline-v0.1.4-files-desktop.png
- baseline-v0.1.4-files-mobile.png
- baseline-v0.1.4-infrastructure-desktop.png
- baseline-v0.1.4-infrastructure-mobile.png
- baseline-v0.1.4-integrations-desktop.png
- baseline-v0.1.4-integrations-mobile.png
- baseline-v0.1.4-login-desktop.png
- baseline-v0.1.4-login-mobile.png
- baseline-v0.1.4-monitoring-desktop.png
- baseline-v0.1.4-monitoring-mobile.png
- baseline-v0.1.4-progress-desktop.png
- baseline-v0.1.4-progress-mobile.png
- baseline-v0.1.4-projects-desktop.png
- baseline-v0.1.4-projects-mobile.png
- baseline-v0.1.4-settings-desktop.png
- baseline-v0.1.4-settings-mobile.png
- baseline-v0.1.4-terminal-desktop.png
- baseline-v0.1.4-terminal-mobile.png
- baseline-v0.1.4-wizard-desktop.png
- baseline-v0.1.4-wizard-mobile.png
- baseline-v0.1.4-workspace-desktop.png
- baseline-v0.1.4-workspace-mobile.png
app/qa/oidc-core.mjs
1// Controlled OIDC tests: forged/tampered/misdirected tokens must be refused. A live Zoo IAM tenant is NOT involved (no client credentials exist yet).2import crypto from "node:crypto"; import fs from "node:fs";3import * as O from "../src/lib/oidc-core.mjs";4const results = []; const rec = (n, ok, d = "") => { results.push({ name: n, ok: !!ok }); console.log((ok ? "PASS " : "FAIL ") + n + (ok ? "" : " -> " + d)); };5const throws = (fn, re) => { try { fn(); return false; } catch (e) { return re ? re.test(e.message) : true; } };6const ISS = "https://iam.example.test/realms/zoo"; const now = 1_800_000_000;7const rsa = crypto.generateKeyPairSync("rsa", { modulusLength: 2048 }), ec = crypto.generateKeyPairSync("ec", { namedCurve: "P-256" }), other = crypto.generateKeyPairSync("rsa", { modulusLength: 2048 });8const jwk = (k, kid, extra = {}) => ({ ...k.publicKey.export({ format: "jwk" }), kid, use: "sig", ...extra }); const jwks = { keys: [jwk(rsa, "k1", { alg: "RS256" }), jwk(ec, "k2")] };9const b = o => Buffer.from(JSON.stringify(o)).toString("base64url");10const sign = (claims, { key = rsa.privateKey, alg = "RS256", kid = "k1", header = {} } = {}) => { const h = b({ alg, kid, typ: "JWT", ...header }), p = b(claims), si = h + "." + p; const sig = alg === "ES256" ? crypto.sign("sha256", Buffer.from(si), { key, dsaEncoding: "ieee-p1363" }) : alg === "HS256" ? crypto.createHmac("sha256", key).update(si).digest() : crypto.sign("sha256", Buffer.from(si), key); return si + "." + sig.toString("base64url"); };11const base = { iss: ISS, aud: "zoo-cloud-studio", sub: "user-123", exp: now + 300, iat: now - 5, nonce: "N1", sid: "S1", email: "a@b.test", email_verified: false };12const opt = { issuer: ISS, nonce: "N1", now };13// PKCE: RFC 7636 appendix B vector14rec("PKCE S256 matches the RFC 7636 test vector", O.pkceChallenge("dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk") === "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM");15const p = O.newPkce(); rec("generated verifier is high entropy and challenge derives from it", p.verifier.length >= 43 && O.pkceChallenge(p.verifier) === p.challenge && O.newPkce().verifier !== p.verifier);16const url = new URL(O.authorizationUrl({ authorization_endpoint: ISS + "/protocol/openid-connect/auth" }, { redirectUri: "https://cloud.zoobd.com/auth/callback", state: "S", nonce: "N", challenge: "C" }));17rec("authorization request: code flow, S256, client zoo-cloud-studio, openid profile email only, state+nonce", url.searchParams.get("response_type") === "code" && url.searchParams.get("code_challenge_method") === "S256" && url.searchParams.get("client_id") === "zoo-cloud-studio" && url.searchParams.get("scope") === "openid profile email" && url.searchParams.get("state") === "S" && url.searchParams.get("nonce") === "N");18// discovery19const disc = { issuer: ISS, authorization_endpoint: ISS + "/a", token_endpoint: ISS + "/t", jwks_uri: ISS + "/j", code_challenge_methods_supported: ["S256"] };20rec("discovery accepted for the exact issuer", !throws(() => O.validateDiscovery(disc, ISS)));21rec("discovery with a different issuer is refused (mix-up defence)", throws(() => O.validateDiscovery({ ...disc, issuer: "https://evil.test/realms/zoo" }, ISS), /issuer/));22rec("discovery with plain-http endpoints is refused", throws(() => O.validateDiscovery({ ...disc, token_endpoint: "http://iam.example.test/t" }, ISS), /https/));23rec("IdP without PKCE S256 is refused", throws(() => O.validateDiscovery({ ...disc, code_challenge_methods_supported: ["plain"] }, ISS), /PKCE/));24// positive25const ok = O.verifyIdToken(sign(base), jwks, opt); rec("valid RS256 ID token accepted; identity = (iss, sub)", ok.iss === ISS && ok.sub === "user-123" && O.identityKey(ok.iss, ok.sub) === ISS + "\0user-123");26rec("valid ES256 ID token accepted", O.verifyIdToken(sign(base, { key: ec.privateKey, alg: "ES256", kid: "k2" }), jwks, opt).sub === "user-123");27rec("e-mail is returned only as display data with its verified flag", ok.email === "a@b.test" && ok.emailVerified === false);28// negative29const no = (name, tok, o = opt, re) => rec(name, throws(() => O.verifyIdToken(tok, jwks, o), re));30no("tampered payload (signature no longer matches) refused", (() => { const t = sign(base).split("."); t[1] = b({ ...base, sub: "admin" }); return t.join("."); })(), opt, /signature/);31no("token signed by a different key refused", sign(base, { key: other.privateKey }), opt, /signature/);32no("alg=none refused", b({ alg: "none", typ: "JWT" }) + "." + b(base) + ".AAAA", opt, /alg/);33no("HS256 signed with the public key (key confusion) refused", sign(base, { key: Buffer.from(JSON.stringify(jwks)), alg: "HS256" }), opt, /alg/);34no("unknown kid refused", sign(base, { kid: "nope" }), opt, /key/);35no("wrong issuer refused", sign({ ...base, iss: "https://evil.test/realms/zoo" }), opt, /issuer/);36no("wrong audience (another Zoo client's token) refused", sign({ ...base, aud: "zoo-connect" }), opt, /audience/);37no("multi-audience without matching azp refused", sign({ ...base, aud: ["zoo-cloud-studio", "zoo-connect"], azp: "zoo-connect" }), opt, /azp/);38no("expired token refused", sign({ ...base, exp: now - 500 }), opt, /expired/);39no("not-yet-valid token refused", sign({ ...base, nbf: now + 1000 }), opt, /not yet/);40no("replayed/mismatched nonce refused", sign(base), { ...opt, nonce: "OTHER" }, /nonce/);41no("missing nonce expectation refused", sign(base), { ...opt, nonce: "" }, /nonce/);42no("missing sub refused", sign({ ...base, sub: undefined }), opt, /sub/);43no("MFA/acr requirement enforced when configured", sign(base), { ...opt, requireAcr: "mfa" }, /MFA/);44rec("acr requirement satisfied when the IdP asserts it", O.verifyIdToken(sign({ ...base, acr: "mfa" }), jwks, { ...opt, requireAcr: "mfa" }).acr === "mfa");45no("garbage / two-part tokens refused", "abc.def", opt, /malformed/);46// back-channel logout47const L = { iss: ISS, aud: "zoo-cloud-studio", iat: now, jti: "j1", sid: "S1", events: { "http://schemas.openid.net/event/backchannel-logout": {} } };48rec("valid back-channel logout token accepted", O.verifyLogoutToken(sign(L), jwks, { issuer: ISS, now }).sid === "S1");49rec("logout token with a nonce refused", throws(() => O.verifyLogoutToken(sign({ ...L, nonce: "x" }), jwks, { issuer: ISS, now })));50rec("logout token without the logout event refused (an ID token cannot be replayed as one)", throws(() => O.verifyLogoutToken(sign(base), jwks, { issuer: ISS, now })));51rec("forged logout token refused", throws(() => O.verifyLogoutToken(sign(L, { key: other.privateKey }), jwks, { issuer: ISS, now })));52rec("stale logout token refused", throws(() => O.verifyLogoutToken(sign({ ...L, iat: now - 4000 }), jwks, { issuer: ISS, now })));53const f = results.filter(r => !r.ok); console.log(`\n${results.length - f.length}/${results.length} OIDC core checks passed`);54fs.mkdirSync("../design/verification", { recursive: true }); fs.writeFileSync("../design/verification/oidc-core.json", JSON.stringify({ at: new Date().toISOString(), live_iam: "BLOCKED: no client credentials; controlled forged-token tests only", total: results.length, passed: results.length - f.length, results }, null, 1));55process.exit(f.length ? 1 : 0);56
Conversation
PartialSign in to start AI sessions.
Task checklist
- Application shell deployed
- Persistent projects
- Agent runtime
- Sandboxed terminal
Execution activity
No agent sessions. Git HEAD fb22adb on master.
Approval requests
None pending.