From 66e6a8857d22fd9d15a6afa8edd9c640ebb372df Mon Sep 17 00:00:00 2001 From: Gothwad Tech Date: Thu, 26 Nov 2026 01:22:02 +0000 Subject: [PATCH] chore(gitplus): rebrand to Bansify - 26 files: Gothwad Tech is Bansify, Gothwad Accounts is Bansify Accounts, every gothwadtech.com reference is bansify.com (zero left) - preserved: the X-Gothwad-Authuser header, the session cookies, the GothwadAccount type the shared accounts client exposes, and the GothwadAccountMenu global --- index.html | 2 +- server/accountsSession.ts | 20 +++++----- server/githubOAuth.ts | 2 +- shared/accounts.ts | 6 +-- shared/brand.ts | 12 +++--- shared/githubOAuthErrors.ts | 6 +-- src/components/AuthScreen.tsx | 8 ++-- src/components/Header.tsx | 2 +- src/components/accounts/AccountsBar.tsx | 20 +++++----- src/components/accounts/AccountsGate.tsx | 12 +++--- src/components/fullscreen/SettingsView.tsx | 4 +- src/components/modals/CreateRepoModal.tsx | 2 +- src/context/ThemeContext.tsx | 2 +- src/services/accounts/sessionClient.ts | 4 +- src/services/githubOAuth.ts | 2 +- src/utils/tokenStorage.ts | 6 +-- tests/account-widget.test.ts | 4 +- tests/accounts-client.test.ts | 4 +- tests/accounts-server.test.ts | 30 +++++++------- tests/browser/accounts.spec.ts | 40 +++++++++---------- tests/fixtures/account-widget/README.md | 4 +- .../account-widget/account-menu-template.js | 8 ++-- tests/fixtures/account-widget/account-menu.js | 6 +-- tests/github-oauth.test.ts | 24 +++++------ tests/github.test.ts | 4 +- tests/tokenStorage.test.ts | 12 +++--- 26 files changed, 123 insertions(+), 123 deletions(-) diff --git a/index.html b/index.html index 0bd384d..22599fc 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ GitPlus - + diff --git a/server/accountsSession.ts b/server/accountsSession.ts index e95445b..4545445 100644 --- a/server/accountsSession.ts +++ b/server/accountsSession.ts @@ -2,7 +2,7 @@ import { BRAND } from '../shared/brand'; import { firstPartyOrigin, publicIdentity, record, validSelector, type AccountSession } from '../shared/accounts'; export interface SessionEnv { GITPLUS_ORIGIN?: string; ACCOUNTS_API_ORIGIN?: string } -const COOKIE_NAME = /^gothwad_(?:at|rt|sid|active|accounts|sess_[a-f])$/; +const COOKIE_NAME = /^bansify_(?:at|rt|sid|active|accounts|sess_[a-f])$/; export function accountCookies(header: string): string { return header.split(';').map((pair) => pair.trim()).filter((pair) => COOKIE_NAME.test(pair.split('=')[0])).join('; '); @@ -39,15 +39,15 @@ export async function handleSession(request: Request, env: SessionEnv, fetcher: const url = new URL(request.url); const origin = firstPartyOrigin(env.GITPLUS_ORIGIN || BRAND.productionOrigin); const apiOrigin = firstPartyOrigin(env.ACCOUNTS_API_ORIGIN || BRAND.accountsApiOrigin); - if (!origin || !apiOrigin || apiOrigin === origin) return unavailable('invalid_configuration', 'Configure distinct HTTPS GitPlus and Accounts API origins under gothwadtech.com.'); + if (!origin || !apiOrigin || apiOrigin === origin) return unavailable('invalid_configuration', 'Configure distinct HTTPS GitPlus and Accounts API origins under bansify.com.'); if (request.headers.get('Sec-Fetch-Site') === 'cross-site' || (request.headers.has('Origin') && request.headers.get('Origin') !== url.origin)) { return sessionJson({ error: 'origin_not_allowed' }, 403); } - if (url.origin !== origin) return sessionJson({ status: 'unsupported', code: 'first_party_domain_required', message: 'Automatic Gothwad Accounts sign-in requires the configured Gothwad Tech custom domain. Shared cookies are not available on pages.dev, localhost or Arena previews.', productionOrigin: origin }); + if (url.origin !== origin) return sessionJson({ status: 'unsupported', code: 'first_party_domain_required', message: 'Automatic Bansify Accounts sign-in requires the configured Bansify custom domain. Shared cookies are not available on pages.dev, localhost or Arena previews.', productionOrigin: origin }); const selector = url.searchParams.get('authuser'); if (selector !== null && !validSelector(selector)) return sessionJson({ error: 'invalid_authuser' }, 400); const cookie = accountCookies(request.headers.get('Cookie') || ''); - if (!cookie) return sessionJson({ status: 'anonymous', code: 'signed_out', message: 'Sign in with Gothwad Accounts to continue to GitPlus.' }, 401); + if (!cookie) return sessionJson({ status: 'anonymous', code: 'signed_out', message: 'Sign in with Bansify Accounts to continue to GitPlus.' }, 401); const headers = new Headers({ Accept: 'application/json', Cookie: cookie }); if (selector !== null) headers.set('X-Gothwad-Authuser', selector); // No incoming Authorization header, arbitrary URL, password, or GitHub token is forwarded. @@ -60,7 +60,7 @@ export async function handleSession(request: Request, env: SessionEnv, fetcher: if (response.status === 401 || response.status === 403) { // Accounts currently clears every slot on a failed /me. Do not propagate global sign-out // from a read-only GitPlus probe (especially when a selected slot disappears). - return sessionJson({ status: 'anonymous', code: 'signed_out', message: 'The selected Gothwad session has expired. Sign in again.' }, 401); + return sessionJson({ status: 'anonymous', code: 'signed_out', message: 'The selected Bansify session has expired. Sign in again.' }, 401); } if (response.status === 429) { const reply = unavailable('accounts_rate_limited', 'Accounts is rate-limited. Wait before retrying.', 429); @@ -68,21 +68,21 @@ export async function handleSession(request: Request, env: SessionEnv, fetcher: if (retry && /^\d{1,5}$/.test(retry)) reply.headers.set('Retry-After', retry); return reply; } - if (!response.ok) return unavailable('accounts_unavailable', 'Gothwad Accounts is temporarily unavailable. Retry without signing out.'); + if (!response.ok) return unavailable('accounts_unavailable', 'Bansify Accounts is temporarily unavailable. Retry without signing out.'); if (!response.headers.get('Content-Type')?.toLowerCase().includes('application/json')) return unavailable('accounts_not_json', 'Accounts returned a non-JSON page. Verify the API Worker route.'); const raw: unknown = await response.json(); // Only secure allowlisted cookies from the fixed Accounts endpoint can reach the browser. cookies = rotationCookies(response.headers); - if (record(raw)?.authenticated === false) return sessionJson({ status: 'anonymous', code: 'signed_out', message: 'Sign in with Gothwad Accounts to continue.' }, 401); + if (record(raw)?.authenticated === false) return sessionJson({ status: 'anonymous', code: 'signed_out', message: 'Sign in with Bansify Accounts to continue.' }, 401); const identity = publicIdentity(raw); - if (!identity) return unavailable('accounts_invalid_identity', 'Accounts returned an incomplete identity. Retry or contact Gothwad Tech support.', 503, cookies); + if (!identity) return unavailable('accounts_invalid_identity', 'Accounts returned an incomplete identity. Retry or contact Bansify support.', 503, cookies); // Accounts currently falls back to slots[0] for a missing explicit selector. Reject that // fallback rather than silently attaching another person's GitHub credentials. if (selector !== null && (/^[a-f]$/.test(selector) ? identity.activeSlot !== selector : identity.authuser !== Number(selector))) { - return sessionJson({ status: 'anonymous', code: 'account_selection_changed', message: 'The selected account is no longer available. Choose a Gothwad account again.' }, 409, cookies); + return sessionJson({ status: 'anonymous', code: 'account_selection_changed', message: 'The selected account is no longer available. Choose a Bansify account again.' }, 409, cookies); } return sessionJson(identity, 200, cookies); } catch { - return unavailable('accounts_network_error', 'Could not verify Gothwad Accounts within the time limit. Check the connection and retry.', 503, cookies); + return unavailable('accounts_network_error', 'Could not verify Bansify Accounts within the time limit. Check the connection and retry.', 503, cookies); } finally { clearTimeout(timer); } } diff --git a/server/githubOAuth.ts b/server/githubOAuth.ts index ef70f4d..60efef3 100644 --- a/server/githubOAuth.ts +++ b/server/githubOAuth.ts @@ -109,7 +109,7 @@ async function oauthRequest(request: Request, env: GitHubOAuthEnv, fetcher: type const account = await verifiedAccount(request, env, txn.selector, fetcher); if (!account.ok) { account.response.headers.append('Set-Cookie', clearOAuthCookie()); return account.response; } const cookies = [...account.cookies, ...cleared]; - if (account.session.user.id !== txn.owner) return jsonResponse({ error: 'account_changed', message: 'Your Gothwad account changed. Start the GitHub connection again.' }, 409, cookies); + if (account.session.user.id !== txn.owner) return jsonResponse({ error: 'account_changed', message: 'Your Bansify account changed. Start the GitHub connection again.' }, 409, cookies); const controller = new AbortController(); const timer = setTimeout(() => controller.abort(), 10_000); try { diff --git a/shared/accounts.ts b/shared/accounts.ts index 5ba71d7..152429d 100644 --- a/shared/accounts.ts +++ b/shared/accounts.ts @@ -1,6 +1,6 @@ import { BRAND } from './brand'; -export interface GothwadUser { +export interface BansifyUser { id: string; username: string; name: string; @@ -14,7 +14,7 @@ export interface GothwadAccount { } export interface AuthenticatedSession { status: 'authenticated'; - user: GothwadUser; + user: BansifyUser; activeSlot: string | null; authuser: number; accounts: GothwadAccount[]; @@ -79,7 +79,7 @@ export function firstPartyOrigin(value: string): string | null { } export function signInUrl(origin: string, selector: string | null = null, choose = false): string { const safeOrigin = firstPartyOrigin(origin); - if (!safeOrigin) throw new Error('Gothwad SSO requires a configured Gothwad Tech HTTPS domain.'); + if (!safeOrigin) throw new Error('Bansify SSO requires a configured Bansify HTTPS domain.'); const next = new URL('/', safeOrigin); next.searchParams.set(RETURN_MARKER, '1'); if (selector && validSelector(selector)) next.searchParams.set('authuser', selector); diff --git a/shared/brand.ts b/shared/brand.ts index 182990b..8279883 100644 --- a/shared/brand.ts +++ b/shared/brand.ts @@ -1,10 +1,10 @@ -/** GitPlus is a Gothwad Tech product. Keep public product identity consistent. */ +/** GitPlus is a Bansify product. Keep public product identity consistent. */ export const BRAND = { name: 'GitPlus', - company: 'Gothwad Tech', + company: 'Bansify', version: '0.2.0', - domain: 'gothwadtech.com', - accountsWebOrigin: 'https://accounts.gothwadtech.com', - accountsApiOrigin: 'https://api.gothwadtech.com', - productionOrigin: 'https://gitplus.gothwadtech.com', + domain: 'bansify.com', + accountsWebOrigin: 'https://accounts.bansify.com', + accountsApiOrigin: 'https://api.bansify.com', + productionOrigin: 'https://gitplus.bansify.com', } as const; diff --git a/shared/githubOAuthErrors.ts b/shared/githubOAuthErrors.ts index 65469aa..5127a20 100644 --- a/shared/githubOAuthErrors.ts +++ b/shared/githubOAuthErrors.ts @@ -6,7 +6,7 @@ export const OAUTH_ERRORS = { github_exchange_failed: 'An older GitPlus backend reported a GitHub token-exchange failure without a specific reason. Check that the custom domain is serving the latest Pages Functions deployment; do not assume the secret is wrong.', oauth_response_unrecognized: 'The OAuth endpoint returned JSON that does not match the expected GitPlus error contract. Check the API deployment and any proxy/Worker route on this domain. This response does not establish that the OAuth credentials are wrong.', oauth_not_configured: 'The deployed Pages Function is missing OAuth configuration. Set the two credentials in Pages Settings → Variables and secrets, then redeploy.', - first_party_domain_required: 'Open GitPlus on its configured Gothwad Tech custom domain before connecting GitHub.', + first_party_domain_required: 'Open GitPlus on its configured Bansify custom domain before connecting GitHub.', origin_not_allowed: 'GitPlus rejected the request origin. Open the custom domain directly in the same browser tab and start again.', method_not_allowed: 'The OAuth request reached an endpoint with an unsupported method. Check the deployed Functions routing.', json_required: 'The OAuth endpoint did not receive the expected JSON request.', @@ -15,8 +15,8 @@ export const OAUTH_ERRORS = { invalid_state: 'The GitHub callback cookie/state could not be validated. The attempt may have expired or been replaced. Start again in the same browser tab.', invalid_callback: 'GitHub returned without a usable authorization code. Start a new connection attempt.', denied: 'GitHub authorization was cancelled. Try again or connect with a PAT.', - account_changed: 'Your Gothwad account changed during GitHub authorization. Start again.', - account_unavailable: 'Your Gothwad session could not be verified during authorization. Retry your connection.', + account_changed: 'Your Bansify account changed during GitHub authorization. Start again.', + account_unavailable: 'Your Bansify session could not be verified during authorization. Retry your connection.', github_client_credentials: 'GitHub rejected the OAuth App Client ID / Client Secret pair. Check that the deployed Pages secrets belong to the same OAuth App, then redeploy.', github_redirect_mismatch: 'GitHub rejected the callback URL. The OAuth App callback must exactly match the GitPlus custom-domain /api/github/callback URL.', github_bad_code: 'GitHub rejected an expired, already-used or invalid authorization code. Start a fresh connection; do not reload the callback.', diff --git a/src/components/AuthScreen.tsx b/src/components/AuthScreen.tsx index b3f8ffa..47bd7d9 100644 --- a/src/components/AuthScreen.tsx +++ b/src/components/AuthScreen.tsx @@ -160,7 +160,7 @@ export const AuthScreen: React.FC = ({ onSuccess, initialError GitPlus

- A Gothwad Tech product · Connect GitHub to browse repositories, edit code and sync ZIP files. + A Bansify product · Connect GitHub to browse repositories, edit code and sync ZIP files.

@@ -168,7 +168,7 @@ export const AuthScreen: React.FC = ({ onSuccess, initialError {/* Auth Card */}

- You are signed in with Gothwad Accounts. GitHub access is a separate connection; your Gothwad password is never requested here. + You are signed in with Bansify Accounts. GitHub access is a separate connection; your Bansify password is never requested here.

{error && (

- GitPlus is a Gothwad Tech product: a GitHub mobile and web workspace. Provides instantaneous atomic ZIP code synchronization, commit time-travel diffing, Actions CI/CD workflows, releases publisher, issues manager, and gists engine. + GitPlus is a Bansify product: a GitHub mobile and web workspace. Provides instantaneous atomic ZIP code synchronization, commit time-travel diffing, Actions CI/CD workflows, releases publisher, issues manager, and gists engine.

- GitPlus · Gothwad Tech + GitPlus · Bansify REST API v3 / 2022-11-28
diff --git a/src/components/modals/CreateRepoModal.tsx b/src/components/modals/CreateRepoModal.tsx index 71f0929..814bcfe 100644 --- a/src/components/modals/CreateRepoModal.tsx +++ b/src/components/modals/CreateRepoModal.tsx @@ -93,7 +93,7 @@ export const CreateRepoModal: React.FC = ({ required value={name} onChange={(e) => setName(e.target.value)} - placeholder="e.g. gothwad-web-app" + placeholder="e.g. bansify-web-app" className="w-full px-3.5 py-2.5 bg-[#f8f9fa] dark:bg-[#202124] border border-[#dadce0] dark:border-[#3c4043] rounded-xl text-xs sm:text-sm text-[#202124] dark:text-[#e8eaed] placeholder:text-[#80868b] focus:outline-none focus:border-[#0494f4]" /> diff --git a/src/context/ThemeContext.tsx b/src/context/ThemeContext.tsx index 25f2d35..d3f16b0 100644 --- a/src/context/ThemeContext.tsx +++ b/src/context/ThemeContext.tsx @@ -12,7 +12,7 @@ interface ThemeContextType { const ThemeContext = createContext(undefined); -const THEME_STORAGE_KEY = 'gothwad_github_theme'; +const THEME_STORAGE_KEY = 'bansify_github_theme'; const applyThemeToDOM = (isDarkMode: boolean) => { if (typeof document === 'undefined') return; diff --git a/src/services/accounts/sessionClient.ts b/src/services/accounts/sessionClient.ts index 0ca60e0..28869f1 100644 --- a/src/services/accounts/sessionClient.ts +++ b/src/services/accounts/sessionClient.ts @@ -21,9 +21,9 @@ export function createSessionClient(fetcher: typeof fetch = fetch) { accounts: Array.isArray(body.accounts) ? body.accounts.map((a) => ({ ...record(a), id: record(a)?.slot })) : [] }); return normalized || failure('session_invalid', 'GitPlus could not verify the returned account identity.'); } - if ((response.status === 401 || response.status === 409) && body.status === 'anonymous') return { status: 'anonymous', code: String(body.code || 'signed_out'), message: String(body.message || 'Sign in with Gothwad Accounts.') }; + if ((response.status === 401 || response.status === 409) && body.status === 'anonymous') return { status: 'anonymous', code: String(body.code || 'signed_out'), message: String(body.message || 'Sign in with Bansify Accounts.') }; if (response.ok && body.status === 'unsupported' && typeof body.productionOrigin === 'string' && firstPartyOrigin(body.productionOrigin)) return { status: 'unsupported', code: 'first_party_domain_required', message: String(body.message), productionOrigin: body.productionOrigin }; - return failure(typeof body.code === 'string' ? body.code : 'session_unavailable', typeof body.message === 'string' ? body.message : 'Gothwad Accounts could not be verified. Please retry.'); + return failure(typeof body.code === 'string' ? body.code : 'session_unavailable', typeof body.message === 'string' ? body.message : 'Bansify Accounts could not be verified. Please retry.'); } catch { return failure('session_network_error', 'Session verification failed or timed out. Check your connection and retry.'); } finally { clearTimeout(timer); } diff --git a/src/services/githubOAuth.ts b/src/services/githubOAuth.ts index 7cea4b0..b349e56 100644 --- a/src/services/githubOAuth.ts +++ b/src/services/githubOAuth.ts @@ -62,7 +62,7 @@ export function completeGitHubOAuth(ownerId: string, returned: { status: string; if (returned.status !== 'complete') throw new Error(oauthFailure('callback', returned.error)); let pending: Pending | null = null; try { pending = JSON.parse(sessionStorage.getItem(OAUTH_PENDING_KEY) || 'null'); } catch { /* Invalid/missing state is rejected. */ } - if (!pending || pending.ownerId !== ownerId || pending.expires <= Date.now() || !validProof(pending.verifier) || !validProof(pending.state)) throw new Error('GitHub authorization must finish in the same tab and Gothwad account where it started. Please connect again.'); + if (!pending || pending.ownerId !== ownerId || pending.expires <= Date.now() || !validProof(pending.verifier) || !validProof(pending.state)) throw new Error('GitHub authorization must finish in the same tab and Bansify account where it started. Please connect again.'); currentAttempt(ownerId, epoch); const result = await api('/api/github/complete', { state: pending.state, verifier: pending.verifier }); currentAttempt(ownerId, epoch); diff --git a/src/utils/tokenStorage.ts b/src/utils/tokenStorage.ts index 9f0b0cc..0b5a6ac 100644 --- a/src/utils/tokenStorage.ts +++ b/src/utils/tokenStorage.ts @@ -1,6 +1,6 @@ -// Only the GitHub connection lives here. Gothwad identity is always verified by Accounts. +// Only the GitHub connection lives here. Bansify identity is always verified by Accounts. const KEY = 'gitplus_github_connection'; -const LEGACY = 'gothwad_github_pat'; +const LEGACY = 'bansify_github_pat'; let owner: string | null = null; let memoryToken = ''; @@ -33,7 +33,7 @@ export const tokenStorage = { }, set(token: string) { discardLegacy(); - if (token && !owner) throw new Error('Verify your Gothwad account before connecting GitHub.'); + if (token && !owner) throw new Error('Verify your Bansify account before connecting GitHub.'); memoryToken = token; try { if (token) window.sessionStorage.setItem(KEY, JSON.stringify({ ownerId: owner, token })); diff --git a/tests/account-widget.test.ts b/tests/account-widget.test.ts index c8917fd..e302007 100644 --- a/tests/account-widget.test.ts +++ b/tests/account-widget.test.ts @@ -9,7 +9,7 @@ test('widget loader shares the real module import and validates the exported con const [a, b] = await Promise.all([loader.load(), loader.load()]); assert.equal(a, menu); assert.equal(b, menu); assert.equal(calls, 1); assert.equal(await loader.load(), menu); assert.equal(calls, 1); - assert.equal(WIDGET_URL, 'https://accounts.gothwadtech.com/widget/account-menu.js'); + assert.equal(WIDGET_URL, 'https://accounts.bansify.com/widget/account-menu.js'); }); test('missing or broken widget fails safely and can be retried without a cloned fallback menu', async () => { @@ -22,7 +22,7 @@ test('missing or broken widget fails safely and can be retried without a cloned }); test('widget data maps stable slot IDs and only sanitized public identity', () => { - const session = { status: 'authenticated' as const, user: { id: 'user-id', username: 'alice', name: 'Alice', email: 'alice@gothwadtech.com' }, activeSlot: 'b', authuser: 0, accounts: [{ slot: 'b', authuser: 0, username: 'alice', name: 'Alice' }] }; + const session = { status: 'authenticated' as const, user: { id: 'user-id', username: 'alice', name: 'Alice', email: 'alice@bansify.com' }, activeSlot: 'b', authuser: 0, accounts: [{ slot: 'b', authuser: 0, username: 'alice', name: 'Alice' }] }; const result = widgetState(session); assert.equal(result.activeId, 'b'); assert.equal(result.accounts[0].id, 'b'); diff --git a/tests/accounts-client.test.ts b/tests/accounts-client.test.ts index 858a16a..bdb3529 100644 --- a/tests/accounts-client.test.ts +++ b/tests/accounts-client.test.ts @@ -2,7 +2,7 @@ import { test } from 'node:test'; import assert from 'node:assert/strict'; import { createSessionClient } from '../src/services/accounts/sessionClient'; -const session = (id = 'alice-id') => ({ status: 'authenticated', user: { id, username: 'alice', name: 'Alice', email: 'alice@gothwadtech.com' }, activeSlot: 'a', authuser: 0, accounts: [{ slot: 'a', authuser: 0, username: 'alice', name: 'Alice' }] }); +const session = (id = 'alice-id') => ({ status: 'authenticated', user: { id, username: 'alice', name: 'Alice', email: 'alice@bansify.com' }, activeSlot: 'a', authuser: 0, accounts: [{ slot: 'a', authuser: 0, username: 'alice', name: 'Alice' }] }); const json = (body: unknown, status = 200) => new Response(JSON.stringify(body), { status, headers: { 'Content-Type': 'application/json' } }); test('session checks share in-flight work by selector and do not persist a completed identity', async () => { @@ -68,7 +68,7 @@ test('malformed JSON, SPA HTML, malformed identity and forbidden responses are e test('anonymous and unsupported are explicit states; foreign production links are rejected', async () => { const cases: [Response, string][] = [ [json({ status: 'anonymous', code: 'signed_out', message: 'Sign in' }, 401), 'anonymous'], - [json({ status: 'unsupported', productionOrigin: 'https://gitplus.gothwadtech.com', message: 'Custom domain required' }), 'unsupported'], + [json({ status: 'unsupported', productionOrigin: 'https://gitplus.bansify.com', message: 'Custom domain required' }), 'unsupported'], [json({ status: 'unsupported', productionOrigin: 'https://evil.example', message: 'Go here' }), 'unavailable'], [json({ status: 'unavailable', code: 'accounts_rate_limited', message: 'Wait' }, 429), 'unavailable'], ]; diff --git a/tests/accounts-server.test.ts b/tests/accounts-server.test.ts index c800c84..d32326a 100644 --- a/tests/accounts-server.test.ts +++ b/tests/accounts-server.test.ts @@ -4,12 +4,12 @@ import { handleSession, accountCookies, rotationCookies } from '../server/accoun import { onRequest } from '../functions/api/[[path]]'; import { firstPartyOrigin, publicIdentity, signInUrl, RETURN_MARKER } from '../shared/accounts'; -const base = 'https://gitplus.gothwadtech.com'; -const request = (query = '', headers: HeadersInit = { Cookie: 'gothwad_sess_a=test-session' }) => new Request(`${base}/api/session${query}`, { headers }); +const base = 'https://gitplus.bansify.com'; +const request = (query = '', headers: HeadersInit = { Cookie: 'bansify_sess_a=test-session' }) => new Request(`${base}/api/session${query}`, { headers }); const identity = () => ({ authenticated: true, activeId: 'a', authuser: 0, user: { id: 'user-alice', username: 'alice', first_name: 'Alice', last_name: 'Example', recovery_email: 'private@example.test', phone_number: 'private-phone' }, accounts: [{ id: 'a', authuser: 0, username: 'alice', name: 'Alice Example' }], access_token: 'do-not-expose-access', refresh_token: 'do-not-expose-refresh' }); const json = (data: unknown, status = 200, headers?: HeadersInit) => new Response(JSON.stringify(data), { status, headers: { 'Content-Type': 'application/json', ...headers } }); const fetchResult = (response: Response) => (async () => response) as typeof fetch; -const cookie = 'gothwad_sess_a=rotated; Path=/; HttpOnly; Secure; SameSite=Lax; Domain=.gothwadtech.com'; +const cookie = 'bansify_sess_a=rotated; Path=/; HttpOnly; Secure; SameSite=Lax; Domain=.bansify.com'; test('anonymous requests do not call Accounts or forward unrelated cookies', async () => { let calls = 0; @@ -20,11 +20,11 @@ test('anonymous requests do not call Accounts or forward unrelated cookies', asy }); test('verified SSO response projects public identity, forwards only Accounts cookies, and relays secure rotations', async () => { - const res = await handleSession(request('?authuser=a', { Cookie: 'gothwad_sess_a=valid; analytics=private; gothwad_evil=no', Authorization: 'Bearer github-pat-must-not-forward' }), {}, (async (url, init) => { - assert.equal(url, 'https://api.gothwadtech.com/api/auth/me'); + const res = await handleSession(request('?authuser=a', { Cookie: 'bansify_sess_a=valid; analytics=private; bansify_evil=no', Authorization: 'Bearer github-pat-must-not-forward' }), {}, (async (url, init) => { + assert.equal(url, 'https://api.bansify.com/api/auth/me'); assert.equal(init?.redirect, 'manual'); const headers = new Headers(init?.headers); - assert.equal(headers.get('Cookie'), 'gothwad_sess_a=valid'); + assert.equal(headers.get('Cookie'), 'bansify_sess_a=valid'); assert.equal(headers.get('Authorization'), null); assert.equal(headers.get('X-Gothwad-Authuser'), 'a'); const res = json(identity()); @@ -37,7 +37,7 @@ test('verified SSO response projects public identity, forwards only Accounts coo assert.deepEqual(res.headers.getSetCookie(), [cookie]); const body = await res.json(); assert.equal(body.user.id, 'user-alice'); - assert.equal(body.user.email, 'alice@gothwadtech.com'); + assert.equal(body.user.email, 'alice@bansify.com'); const serialized = JSON.stringify(body); for (const secret of ['access_token', 'refresh_token', 'recovery_email', 'phone_number', 'do-not-expose', 'private-phone']) assert.ok(!serialized.includes(secret)); }); @@ -68,16 +68,16 @@ test('unavailable network does not clear cookies and a rate limit remains a 429' assert.equal(limited.headers.get('Retry-After'), '60'); }); -test('Accounts 401 is anonymous but never globally logs out other Gothwad products', async () => { - const upstream = json({ authenticated: false }, 401, { 'Set-Cookie': 'gothwad_sess_b=; Max-Age=0; Path=/; HttpOnly; Secure; SameSite=Lax; Domain=.gothwadtech.com' }); +test('Accounts 401 is anonymous but never globally logs out other Bansify products', async () => { + const upstream = json({ authenticated: false }, 401, { 'Set-Cookie': 'bansify_sess_b=; Max-Age=0; Path=/; HttpOnly; Secure; SameSite=Lax; Domain=.bansify.com' }); const response = await handleSession(request(), {}, fetchResult(upstream)); assert.equal(response.status, 401); assert.equal(response.headers.get('Set-Cookie'), null); }); -test('unrelated preview hosts cannot forward Gothwad credentials; no fake login bypass', async () => { +test('unrelated preview hosts cannot forward Bansify credentials; no fake login bypass', async () => { let calls = 0; - const res = await handleSession(new Request('https://gitplus.pages.dev/api/session', { headers: { Cookie: 'gothwad_sess_a=fake' } }), {}, (async () => { calls++; return json(identity()); }) as typeof fetch); + const res = await handleSession(new Request('https://gitplus.pages.dev/api/session', { headers: { Cookie: 'bansify_sess_a=fake' } }), {}, (async () => { calls++; return json(identity()); }) as typeof fetch); assert.equal((await res.json()).status, 'unsupported'); assert.equal(calls, 0); }); @@ -97,21 +97,21 @@ test('API catchall returns no-store JSON 404, not the SPA', async () => { }); test('cookie filtering rejects insecure, foreign-domain and unrelated rotations', () => { - assert.equal(accountCookies('gothwad_at=at; other=secret; gothwad_sess_f=f; gothwad_sess_z=z'), 'gothwad_at=at; gothwad_sess_f=f'); + assert.equal(accountCookies('bansify_at=at; other=secret; bansify_sess_f=f; bansify_sess_z=z'), 'bansify_at=at; bansify_sess_f=f'); const headers = new Headers(); - for (const value of [cookie, cookie.replace('Secure;', ''), cookie.replace('HttpOnly;', ''), cookie.replace('.gothwadtech.com', '.evil.example'), cookie.replace('gothwad_sess_a', 'arbitrary')]) headers.append('Set-Cookie', value); + for (const value of [cookie, cookie.replace('Secure;', ''), cookie.replace('HttpOnly;', ''), cookie.replace('.bansify.com', '.evil.example'), cookie.replace('bansify_sess_a', 'arbitrary')]) headers.append('Set-Cookie', value); assert.deepEqual(rotationCookies(headers), [cookie]); }); test('login URLs use validated return origins, encode selectors and mark a one-time handoff', () => { const url = new URL(signInUrl(base, 'a', true)); - assert.equal(url.origin, 'https://accounts.gothwadtech.com'); + assert.equal(url.origin, 'https://accounts.bansify.com'); assert.equal(url.searchParams.get('choose'), '1'); const next = new URL(url.searchParams.get('next')!); assert.equal(next.origin, base); assert.equal(next.searchParams.get(RETURN_MARKER), '1'); assert.equal(next.searchParams.get('authuser'), 'a'); - for (const unsafe of ['https://gothwadtech.com.evil.example', '//evil.example', 'javascript:alert(1)', 'https://user:pass@gitplus.gothwadtech.com', 'http://gitplus.gothwadtech.com', 'https://gitplus.gothwadtech.com/redirect']) { + for (const unsafe of ['https://bansify.com.evil.example', '//evil.example', 'javascript:alert(1)', 'https://user:pass@gitplus.bansify.com', 'http://gitplus.bansify.com', 'https://gitplus.bansify.com/redirect']) { assert.equal(firstPartyOrigin(unsafe), null); assert.throws(() => signInUrl(unsafe)); } diff --git a/tests/browser/accounts.spec.ts b/tests/browser/accounts.spec.ts index 96694d0..9bb57a0 100644 --- a/tests/browser/accounts.spec.ts +++ b/tests/browser/accounts.spec.ts @@ -2,10 +2,10 @@ import { readFile } from 'node:fs/promises'; import { createHash } from 'node:crypto'; import { test, expect, type Page } from '@playwright/test'; -const ORIGIN = 'https://gitplus.gothwadtech.com'; +const ORIGIN = 'https://gitplus.bansify.com'; const account = (which: 'alice' | 'bob') => ({ status: 'authenticated', - user: { id: `${which}-id`, username: which, name: which === 'alice' ? 'Alice Example' : 'Bob Example', email: `${which}@gothwadtech.com` }, + user: { id: `${which}-id`, username: which, name: which === 'alice' ? 'Alice Example' : 'Bob Example', email: `${which}@bansify.com` }, activeSlot: which === 'alice' ? 'a' : 'b', authuser: which === 'alice' ? 0 : 1, accounts: [{ slot: 'a', authuser: 0, username: 'alice', name: 'Alice' }, { slot: 'b', authuser: 1, username: 'bob', name: 'Bob' }], }); @@ -16,7 +16,7 @@ async function mockApp(page: Page, session: (url: URL) => { status: number; body page.on('dialog', (dialog) => dialog.accept()); await page.route('https://fonts.googleapis.com/**', (route) => route.abort()); await page.route('https://fonts.gstatic.com/**', (route) => route.abort()); - await page.route('https://accounts.gothwadtech.com/widget/**', async (route) => { + await page.route('https://accounts.bansify.com/widget/**', async (route) => { const filename = new URL(route.request().url()).pathname.split('/').pop()!; if (!['account-menu.js', 'account-menu-template.js', 'account-menu-styles.js'].includes(filename)) return route.abort(); await route.fulfill({ contentType: 'text/javascript', headers: { 'Access-Control-Allow-Origin': '*' }, body: await readFile(`tests/fixtures/account-widget/${filename}`, 'utf8') }); @@ -49,21 +49,21 @@ test('existing Accounts session automatically opens Connect GitHub, isolates swi const errors = await mockApp(page, (url) => { checks++; return { status: 200, body: account(url.searchParams.get('authuser') === 'b' ? 'bob' : 'alice') }; }); await page.goto(ORIGIN); await expect(page.locator('#pat-input')).toBeVisible(); - await expect(page.locator('#gothwad-account-bar')).toContainText('alice@gothwadtech.com'); + await expect(page.locator('#bansify-account-bar')).toContainText('alice@bansify.com'); await expect(page).toHaveTitle('GitPlus'); expect(checks).toBe(1); expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)).toBe(true); - expect(await page.evaluate(() => sessionStorage.getItem('gothwad_github_pat'))).toBeNull(); + expect(await page.evaluate(() => sessionStorage.getItem('bansify_github_pat'))).toBeNull(); await page.locator('#pat-input').fill('dummy-github-token-for-browser-test'); await page.locator('#connect-github-btn').click(); await expect(page.locator('#mobile-bottom-navigation')).toBeVisible(); expect(JSON.parse((await page.evaluate(() => sessionStorage.getItem('gitplus_github_connection')))!).ownerId).toBe('alice-id'); - await page.locator('#gothwad-account-menu').click(); + await page.locator('#bansify-account-menu').click(); await page.locator('[data-gw-switch="b"]').click(); - await expect(page.locator('#gothwad-account-bar')).toContainText('bob@gothwadtech.com'); + await expect(page.locator('#bansify-account-bar')).toContainText('bob@bansify.com'); await expect(page.locator('#pat-input')).toBeVisible(); expect(await page.evaluate(() => sessionStorage.getItem('gitplus_github_connection'))).toBeNull(); - await page.locator('#gothwad-account-menu').click(); + await page.locator('#bansify-account-menu').click(); await page.getByRole('button', { name: 'Sign out of GitPlus (this tab)', exact: true }).click(); await expect(page.getByRole('heading', { name: 'Signed out of GitPlus' })).toBeVisible(); const beforeReload = checks; @@ -77,18 +77,18 @@ test('existing Accounts session automatically opens Connect GitHub, isolates swi test('return without a session never redirects in a loop; service errors offer retry, not false login', async ({ page }) => { let unavailable = false; - const errors = await mockApp(page, () => unavailable ? { status: 503, body: { status: 'unavailable', code: 'accounts_not_json', message: 'Accounts routing error. Please retry.' } } : { status: 401, body: { status: 'anonymous', code: 'signed_out', message: 'Sign in with Gothwad Accounts.' } }); + const errors = await mockApp(page, () => unavailable ? { status: 503, body: { status: 'unavailable', code: 'accounts_not_json', message: 'Accounts routing error. Please retry.' } } : { status: 401, body: { status: 'anonymous', code: 'signed_out', message: 'Sign in with Bansify Accounts.' } }); await page.goto(`${ORIGIN}/?__gitplus_auth_return=1`); await expect(page.getByText('Accounts returned without a usable session.', { exact: false })).toBeVisible(); - await expect(page.locator('#gothwad-signin-link')).toBeVisible(); + await expect(page.locator('#bansify-signin-link')).toBeVisible(); expect(page.url()).not.toContain('__gitplus_auth_return'); expect(page.url()).toContain(ORIGIN); - const link = new URL((await page.locator('#gothwad-signin-link').getAttribute('href'))!); - expect(link.origin).toBe('https://accounts.gothwadtech.com'); + const link = new URL((await page.locator('#bansify-signin-link').getAttribute('href'))!); + expect(link.origin).toBe('https://accounts.bansify.com'); unavailable = true; await page.locator('#accounts-retry').click(); await expect(page.getByRole('heading', { name: 'Account verification unavailable' })).toBeVisible(); - await expect(page.locator('#gothwad-signin-link')).toHaveCount(0); + await expect(page.locator('#bansify-signin-link')).toHaveCount(0); await expect(page.locator('#pat-input')).toHaveCount(0); expect(errors).toEqual([]); }); @@ -171,7 +171,7 @@ test('universal widget sign-out uses the same-origin protected action, while loa await route.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); }); await page.goto(ORIGIN); - await page.locator('#gothwad-account-menu').click(); + await page.locator('#bansify-account-menu').click(); await page.locator('[data-gw-signout-slot="a"]').click(); await expect(page.getByRole('heading', { name: 'Signed out of GitPlus' })).toBeVisible(); expect(called).toBe(true); @@ -180,15 +180,15 @@ test('universal widget sign-out uses the same-origin protected action, while loa test('blocked universal widget shows a management link instead of a duplicate menu', async ({ page }) => { const errors = await mockApp(page, () => ({ status: 200, body: account('alice') })); - await page.route('https://accounts.gothwadtech.com/widget/**', (route) => route.abort()); + await page.route('https://accounts.bansify.com/widget/**', (route) => route.abort()); await page.goto(ORIGIN); - await page.locator('#gothwad-account-menu').click(); + await page.locator('#bansify-account-menu').click(); await expect(page.getByText('The universal Accounts menu could not load.', { exact: false })).toBeVisible(); - await expect(page.getByRole('link', { name: 'Manage Gothwad Account', exact: true })).toBeVisible(); + await expect(page.getByRole('link', { name: 'Manage Bansify Account', exact: true })).toBeVisible(); expect(errors).toEqual([]); }); -test('late OAuth completion cannot replace a newly selected Gothwad user connection', async ({ page }) => { +test('late OAuth completion cannot replace a newly selected Bansify user connection', async ({ page }) => { const errors = await mockApp(page, (url) => ({ status: 200, body: account(url.searchParams.get('authuser') === 'b' ? 'bob' : 'alice') })); await page.addInitScript(() => sessionStorage.setItem('gitplus_github_oauth_pending', JSON.stringify({ ownerId: 'alice-id', state: 'a'.repeat(43), verifier: 'b'.repeat(43), expires: Date.now() + 600000 }))); let release!: () => void; @@ -200,9 +200,9 @@ test('late OAuth completion cannot replace a newly selected Gothwad user connect }); await page.goto(`${ORIGIN}/?github_oauth=complete&authuser=a`); await requested; - await page.locator('#gothwad-account-menu').click(); + await page.locator('#bansify-account-menu').click(); await page.locator('[data-gw-switch="b"]').click(); - await expect(page.locator('#gothwad-account-bar')).toContainText('bob@gothwadtech.com'); + await expect(page.locator('#bansify-account-bar')).toContainText('bob@bansify.com'); await page.locator('#pat-input').fill('bob-test-only-token'); await page.locator('#connect-github-btn').click(); await expect(page.locator('#mobile-bottom-navigation')).toBeVisible(); diff --git a/tests/fixtures/account-widget/README.md b/tests/fixtures/account-widget/README.md index cb14b38..cd296a9 100644 --- a/tests/fixtures/account-widget/README.md +++ b/tests/fixtures/account-widget/README.md @@ -1,10 +1,10 @@ # Shared Accounts widget test fixture -Unmodified browser module/template/styles from GothwadTech/accounts commit +Unmodified browser module/template/styles from BansifyTech/accounts commit `507eb25b24b2a9fd3d4e99a76579026057a4e761`, `web/widget/`. These fixtures let Playwright exercise the real universal menu contract without network access. They are **not** bundled or served by the production app. Production imports the canonical -`https://accounts.gothwadtech.com/widget/account-menu.js` ES module. +`https://accounts.bansify.com/widget/account-menu.js` ES module. Update these fixtures only alongside review of the Accounts widget contract. diff --git a/tests/fixtures/account-widget/account-menu-template.js b/tests/fixtures/account-widget/account-menu-template.js index 0dfaba2..80427c7 100644 --- a/tests/fixtures/account-widget/account-menu-template.js +++ b/tests/fixtures/account-widget/account-menu-template.js @@ -56,11 +56,11 @@ export function resolveEndpoints(opts = {}) { try { const host = new URL(accountsWebOrigin).hostname.toLowerCase(); if (host === 'localhost' || host === '127.0.0.1' || host.endsWith('.e2b.app')) { - return 'gothwadtech.com'; + return 'bansify.com'; } return host.startsWith('accounts.') ? host.slice('accounts.'.length) : host; } catch { - return locHost || 'gothwadtech.com'; + return locHost || 'bansify.com'; } })(); @@ -68,11 +68,11 @@ export function resolveEndpoints(opts = {}) { opts.accountsApiOrigin || `${accountsWebOrigin}/api` ).replace(/\/+$/, ''); - const ecosystemName = String(opts.ecosystemName || 'Gothwad').trim() || 'Gothwad'; + const ecosystemName = String(opts.ecosystemName || 'Bansify').trim() || 'Bansify'; return { appDomain: inferredDomain, accountsWebOrigin, accountsApiOrigin, ecosystemName }; } -export function normalizeMenuAccount(raw, idx = 0, appDomain = 'gothwadtech.com') { +export function normalizeMenuAccount(raw, idx = 0, appDomain = 'bansify.com') { const username = String(raw?.username || '').trim().toLowerCase(); const firstName = String(raw?.firstName ?? raw?.first_name ?? '').trim(); const lastName = String(raw?.lastName ?? raw?.last_name ?? '').trim(); diff --git a/tests/fixtures/account-widget/account-menu.js b/tests/fixtures/account-widget/account-menu.js index 4a868a5..486ec39 100644 --- a/tests/fixtures/account-widget/account-menu.js +++ b/tests/fixtures/account-widget/account-menu.js @@ -65,7 +65,7 @@ class SheetOverlayController { ensureMounted() { if (this.hostEl || !globalThis.document?.body) return; this.hostEl = document.createElement('div'); - this.hostEl.setAttribute('data-gothwad-account-overlay', '1'); + this.hostEl.setAttribute('data-bansify-account-overlay', '1'); if (typeof this.hostEl.attachShadow === 'function') { this.shadow = this.hostEl.attachShadow({ mode: 'open' }); } else { @@ -225,7 +225,7 @@ if (globalThis.window) { globalThis.window.GothwadAccountMenu = GothwadAccountMenu; } -if (typeof globalThis.HTMLElement !== 'undefined' && globalThis.customElements && !globalThis.customElements.get('gothwad-account-menu')) { +if (typeof globalThis.HTMLElement !== 'undefined' && globalThis.customElements && !globalThis.customElements.get('bansify-account-menu')) { class GothwadAccountMenuElement extends globalThis.HTMLElement { constructor() { super(); @@ -259,7 +259,7 @@ if (typeof globalThis.HTMLElement !== 'undefined' && globalThis.customElements & this._session = { authenticated: false, user: null, accounts: [], activeId: null, authuser: 0 }; } this.renderButton(); - this.dispatchEvent(new CustomEvent('gothwad-session', { detail: this._session, bubbles: true })); + this.dispatchEvent(new CustomEvent('bansify-session', { detail: this._session, bubbles: true })); return this._session; } diff --git a/tests/github-oauth.test.ts b/tests/github-oauth.test.ts index a858bf6..302fc73 100644 --- a/tests/github-oauth.test.ts +++ b/tests/github-oauth.test.ts @@ -4,13 +4,13 @@ import { handleGitHubOAuth, TRANSACTION_COOKIE, type GitHubOAuthEnv } from '../s import { handleAccountAction } from '../server/accountActions'; import { challengeFor, randomProof, OAUTH_PROTOCOL, OAUTH_PROTOCOL_HEADER, OAUTH_DEPLOYMENT_HEADER } from '../shared/githubOAuth'; -const origin = 'https://gitplus.gothwadtech.com'; +const origin = 'https://gitplus.bansify.com'; const env: GitHubOAuthEnv = { GITPLUS_ORIGIN: origin, GITHUB_CLIENT_ID: 'test-client-id', GITHUB_CLIENT_SECRET: 'test-only-secret-not-a-real-github-secret' }; const identity = (id = 'alice-id') => ({ authenticated: true, user: { id, username: 'alice', first_name: 'Alice' }, activeId: 'a', authuser: 0, accounts: [{ id: 'a', authuser: 0, username: 'alice', name: 'Alice' }, { id: 'b', authuser: 1, username: 'bobby', name: 'Bob' }] }); const json = (body: unknown, status = 200) => new Response(JSON.stringify(body), { status, headers: { 'Content-Type': 'application/json' } }); const makeRequest = (path: string, body?: unknown, txnCookie = '', extraHeaders: Record = {}) => new Request(origin + path, { method: body === undefined ? 'GET' : 'POST', - headers: { Cookie: `gothwad_sess_a=account-cookie${txnCookie ? '; ' + txnCookie : ''}`, ...(body !== undefined ? { Origin: origin, 'Content-Type': 'application/json' } : {}), ...extraHeaders }, + headers: { Cookie: `bansify_sess_a=account-cookie${txnCookie ? '; ' + txnCookie : ''}`, ...(body !== undefined ? { Origin: origin, 'Content-Type': 'application/json' } : {}), ...extraHeaders }, ...(body === undefined ? {} : { body: JSON.stringify(body) }), }); const readCookie = (res: Response) => res.headers.getSetCookie().find((v) => v.startsWith(TRANSACTION_COOKIE + '='))!.split(';')[0]; @@ -19,7 +19,7 @@ function provider(owner = 'alice-id') { const requests: { url: string; init?: RequestInit }[] = []; const fetcher: typeof fetch = async (input, init) => { const url = String(input); requests.push({ url, init }); - if (url === 'https://api.gothwadtech.com/api/auth/me') { + if (url === 'https://api.bansify.com/api/auth/me') { assert.ok(!new Headers(init?.headers).get('Cookie')?.includes(TRANSACTION_COOKIE)); return json(identity(owner)); } @@ -49,7 +49,7 @@ test('unconfigured OAuth reports unavailable without exposing secrets or disabli assert.equal((await handleGitHubOAuth(new Request('https://gitplus.pages.dev/api/github/config'), env)).status, 403); }); -test('start is CSRF-protected, verifies Gothwad identity and requests explicit PKCE/scopes', async () => { +test('start is CSRF-protected, verifies Bansify identity and requests explicit PKCE/scopes', async () => { for (const originHeader of ['', 'https://evil.example']) { const res = await handleGitHubOAuth(makeRequest('/api/github/start', {}, '', { Origin: originHeader }), env); assert.equal(res.status, 403); @@ -78,7 +78,7 @@ test('start rejects anonymous Accounts and oversized input before GitHub authori assert.equal((await handleGitHubOAuth(makeRequest('/api/github/start', { challenge: 'x'.repeat(5000) }), env, anonymous)).status, 400); }); -test('callback rejects state tampering, modified cookie, denied consent and changed Gothwad owner', async () => { +test('callback rejects state tampering, modified cookie, denied consent and changed Bansify owner', async () => { const s = await start(); for (const query of [`state=${randomProof()}&code=abc`, `state=${s.body.state}&state=${s.body.state}&code=abc`, `state=${s.body.state}&error=access_denied`]) { const res = await handleGitHubOAuth(makeRequest('/api/github/callback?' + query, undefined, s.cookie), env, provider().fetcher); @@ -128,7 +128,7 @@ test('completion requires originating tab PKCE and same verified owner; token ne test('failed exchange is generic, clears the transaction and never reflects provider secrets/errors', async () => { const p = provider(); const s = await start(p.fetcher); const cb = await callback(s, p.fetcher); - const failure: typeof fetch = async (url, options) => String(url).includes('api.gothwadtech.com') ? p.fetcher(url, options) : json({ error: 'bad_code', error_description: env.GITHUB_CLIENT_SECRET }, 500); + const failure: typeof fetch = async (url, options) => String(url).includes('api.bansify.com') ? p.fetcher(url, options) : json({ error: 'bad_code', error_description: env.GITHUB_CLIENT_SECRET }, 500); const response = await handleGitHubOAuth(makeRequest('/api/github/complete', { state: s.body.state, verifier: s.verifier }, readCookie(cb)), env, failure); assert.equal(response.status, 502); assert.ok(!(await response.text()).includes(env.GITHUB_CLIENT_SECRET!)); @@ -141,15 +141,15 @@ test('universal-menu sign-out validates origin/slot and relays only approved coo const p = provider(); const response = await handleAccountAction(makeRequest('/api/accounts/signout', { selector: 'a', slot: 'b' }), env, async (url, init) => { if (String(url).endsWith('/api/auth/me')) return p.fetcher(url, init); - assert.equal(url, 'https://api.gothwadtech.com/api/auth/accounts/b/signout'); + assert.equal(url, 'https://api.bansify.com/api/auth/accounts/b/signout'); assert.equal(init?.method, 'POST'); assert.equal(new Headers(init?.headers).get('Origin'), origin); const res = json({ ok: true, access_token: 'must-not-expose' }); - res.headers.append('Set-Cookie', 'gothwad_sess_b=; Path=/; HttpOnly; Secure; SameSite=Lax; Domain=.gothwadtech.com; Max-Age=0'); + res.headers.append('Set-Cookie', 'bansify_sess_b=; Path=/; HttpOnly; Secure; SameSite=Lax; Domain=.bansify.com; Max-Age=0'); return res; }); assert.deepEqual(await response.json(), { ok: true }); - assert.ok(response.headers.getSetCookie().some((c) => c.startsWith('gothwad_sess_b='))); + assert.ok(response.headers.getSetCookie().some((c) => c.startsWith('bansify_sess_b='))); }); test('global sign-out uses only the fixed Accounts endpoint; failed mutations do not claim logout', async () => { @@ -157,7 +157,7 @@ test('global sign-out uses only the fixed Accounts endpoint; failed mutations do for (const success of [true, false]) { const response = await handleAccountAction(makeRequest('/api/accounts/signout-all', { selector: 'a' }), env, async (url, init) => { if (String(url).endsWith('/api/auth/me')) return p.fetcher(url, init); - assert.equal(url, 'https://api.gothwadtech.com/api/auth/signout'); + assert.equal(url, 'https://api.bansify.com/api/auth/signout'); assert.equal(init?.redirect, 'error'); assert.equal(init?.body, '{}'); return json({ ok: success }); @@ -183,7 +183,7 @@ test('token-exchange diagnostics distinguish allowlisted GitHub failures without for (const scenario of cases) { const p = provider(); const s = await start(p.fetcher); const cb = await callback(s, p.fetcher); const response = await handleGitHubOAuth(makeRequest('/api/github/complete', { state: s.body.state, verifier: s.verifier }, readCookie(cb)), env, async (url, init) => { - if (String(url).includes('api.gothwadtech.com')) return p.fetcher(url, init); + if (String(url).includes('api.bansify.com')) return p.fetcher(url, init); return json({ ...scenario.body, error_description: env.GITHUB_CLIENT_SECRET, error_uri: 'https://example.invalid/?code=private-code', refresh_token: 'private-refresh-token' }, scenario.status); }); assert.equal(response.status, scenario.reply); @@ -201,7 +201,7 @@ test('HTML, malformed JSON and transport failures during exchange have safe dist for (const mode of ['html', 'json', 'network'] as const) { const p = provider(); const s = await start(p.fetcher); const cb = await callback(s, p.fetcher); const response = await handleGitHubOAuth(makeRequest('/api/github/complete', { state: s.body.state, verifier: s.verifier }, readCookie(cb)), env, async (url, init) => { - if (String(url).includes('api.gothwadtech.com')) return p.fetcher(url, init); + if (String(url).includes('api.bansify.com')) return p.fetcher(url, init); if (mode === 'network') throw new Error('private-network-detail'); return new Response('private-invalid-body', { headers: { 'Content-Type': mode === 'html' ? 'text/html' : 'application/json' } }); }); diff --git a/tests/github.test.ts b/tests/github.test.ts index 91bf0f9..b6b7896 100644 --- a/tests/github.test.ts +++ b/tests/github.test.ts @@ -97,7 +97,7 @@ test('partial blob failure aborts before creating a tree, commit or deletion', a assert.ok(writes.every((path) => path.endsWith('/git/blobs'))); }); -test('verified Gothwad account changes abort pending GitHub reads and clear the old PAT', async (t) => { +test('verified Bansify account changes abort pending GitHub reads and clear the old PAT', async (t) => { const service = new GitHubService(); service.bindAccount('alice'); service.setToken('test-alice-token'); @@ -116,7 +116,7 @@ test('verified Gothwad account changes abort pending GitHub reads and clear the service.bindAccount(null); }); -test('a batch interrupted by Gothwad account switching cannot continue under the new GitHub token', async (t) => { +test('a batch interrupted by Bansify account switching cannot continue under the new GitHub token', async (t) => { const service = new GitHubService(); service.bindAccount('alice'); service.setToken('test-alice-token'); diff --git a/tests/tokenStorage.test.ts b/tests/tokenStorage.test.ts index c9223ae..cce579a 100644 --- a/tests/tokenStorage.test.ts +++ b/tests/tokenStorage.test.ts @@ -7,17 +7,17 @@ function storage() { return { getItem: (key: string) => values.get(key) ?? null, setItem: (key: string, value: string) => values.set(key, value), removeItem: (key: string) => values.delete(key) }; } -test('tokens are session-only, Gothwad-owner bound, and legacy copies are deleted', () => { +test('tokens are session-only, Bansify-owner bound, and legacy copies are deleted', () => { const localStorage = storage(); const sessionStorage = storage(); Object.defineProperty(globalThis, 'window', { value: { localStorage, sessionStorage }, configurable: true }); try { - localStorage.setItem('gothwad_github_pat', 'legacy-test-value'); - sessionStorage.setItem('gothwad_github_pat', 'unbound-legacy-value'); + localStorage.setItem('bansify_github_pat', 'legacy-test-value'); + sessionStorage.setItem('bansify_github_pat', 'unbound-legacy-value'); tokenStorage.bindOwner('alice-id'); assert.equal(tokenStorage.get(), ''); - assert.equal(localStorage.getItem('gothwad_github_pat'), null); - assert.equal(sessionStorage.getItem('gothwad_github_pat'), null); + assert.equal(localStorage.getItem('bansify_github_pat'), null); + assert.equal(sessionStorage.getItem('bansify_github_pat'), null); tokenStorage.set('session-test-value'); assert.equal(localStorage.getItem('gitplus_github_connection'), null); assert.deepEqual(JSON.parse(sessionStorage.getItem('gitplus_github_connection')!), { ownerId: 'alice-id', token: 'session-test-value' }); @@ -41,5 +41,5 @@ test('blocked storage uses memory and owner changes wipe it', () => { tokenStorage.bindOwner('bob'); assert.equal(tokenStorage.get(), ''); tokenStorage.bindOwner(null); - assert.throws(() => tokenStorage.set('no-owner-token'), /Verify your Gothwad/); + assert.throws(() => tokenStorage.set('no-owner-token'), /Verify your Bansify/); });