Refactor all references to computer to Superbrain
release gate / check (push) Failing after 6m55s

This commit is contained in:
Andrew S Erwin
2026-10-22 00:33:44 -05:00
parent 45aa3c80aa
commit d870eece1e
84 changed files with 438 additions and 381 deletions
+9 -9
View File
@@ -33,9 +33,9 @@ export const forwardedClientHeaders = (source: Headers): Record<string, string>
if (!ip) return {}
const { ts, sig } = signClientIP(ip)
return {
'x-computer-client-ip': ip,
'x-computer-client-ts': ts,
'x-computer-client-sig': sig,
'x-superbrain-client-ip': ip,
'x-superbrain-client-ts': ts,
'x-superbrain-client-sig': sig,
}
}
@@ -54,7 +54,7 @@ export async function backendFetch(path: string, init: RequestInit = {}) {
if (session?.user?.id) {
if (!secret) throw new Error('Missing authentication secret')
headers.set('Authorization', `Bearer ${jwt.sign({ uid: session.user.id, ver: session.user.ver, typ: 'assertion' }, secret, {
algorithm: 'HS256', issuer: 'computer', expiresIn: '60s',
algorithm: 'HS256', issuer: 'superbrain', expiresIn: '60s',
})}`)
}
// Review AUTH-RATE/SEC-2: attest the browser IP for Go's login/signup
@@ -62,14 +62,14 @@ export async function backendFetch(path: string, init: RequestInit = {}) {
// bucket. The timestamped HMAC keeps the header unforgeable and
// short-lived; Go falls back to the direct peer when it is missing or
// invalid.
const clientIP = headers.get('x-computer-client-ip')
const clientIP = headers.get('x-superbrain-client-ip')
if (clientIP && secret) {
const { ts, sig } = signClientIP(clientIP)
headers.set('x-computer-client-ts', ts)
headers.set('x-computer-client-sig', sig)
headers.set('x-superbrain-client-ts', ts)
headers.set('x-superbrain-client-sig', sig)
}
const viewAs = (await cookies()).get('computer_view_as')?.value
if (viewAs) headers.set('Cookie', `computer_view_as=${encodeURIComponent(viewAs)}`)
const viewAs = (await cookies()).get('superbrain_view_as')?.value
if (viewAs) headers.set('Cookie', `superbrain_view_as=${encodeURIComponent(viewAs)}`)
// Review M-7: bound server-side calls so a hung or blackholed backend
// cannot stall a route/server component until the platform timeout.
// Callers may provide their own signal to override this default.