fsanyoto commited on
Commit
7e9780d
Β·
verified Β·
1 Parent(s): b170807

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
RELEASES.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "current": "5a3e53380f59 (5a3e53380f59)",
3
  "releases": [
4
  {
5
  "version": "v83",
 
1
  {
2
+ "current": "dcc41725b463 (dcc41725b463)",
3
  "releases": [
4
  {
5
  "version": "v83",
VERSION CHANGED
@@ -1 +1 @@
1
- 5a3e53380f59 (5a3e53380f59)
 
1
+ dcc41725b463 (dcc41725b463)
api/deps.py CHANGED
@@ -1560,6 +1560,16 @@ _ACTIVE_MAX_TRACKED = 4096
1560
  #: red). `verify_wiring.py` pins both spellings for that reason.
1561
  _TENANT_HEADER = "X-AIOS-Tenant"
1562
 
 
 
 
 
 
 
 
 
 
 
1563
 
1564
  def note_active(uname, when=None):
1565
  """Record that `uname` was just seen β€” WITHOUT writing. The login path calls this because it
@@ -1629,6 +1639,7 @@ def require_session(request: Request, response: Response) -> Session:
1629
  # ⚠ The value is `claims["t"]`, the tenant the cookie was VERIFIED for β€” never
1630
  # `session.tenant` read back from something the request could influence.
1631
  response.headers[_TENANT_HEADER] = str(claims["t"])
 
1632
  # R4: last AFTER the session is fully resolved β€” a stamp is only true of a request that was
1633
  # actually admitted, and putting it here means no failed-auth path can ever write one.
1634
  # qa-runner has no global account record. Never let the normal activity telemetry create or
 
1560
  #: red). `verify_wiring.py` pins both spellings for that reason.
1561
  _TENANT_HEADER = "X-AIOS-Tenant"
1562
 
1563
+ #: MUST MATCH `web/src/apiContract.ts::PRINCIPAL_HEADER`. One cookie per origin means a sign-in
1564
+ #: as another person in any tab repoints this tab too; the client reloads when this value moves.
1565
+ _PRINCIPAL_HEADER = "X-AIOS-Principal"
1566
+
1567
+
1568
+ def _principal(tenant, username):
1569
+ """An opaque fingerprint of the signed-in person; it names no one."""
1570
+ import hashlib
1571
+ return hashlib.sha256(f"{tenant}\n{str(username).strip().lower()}".encode()).hexdigest()[:16]
1572
+
1573
 
1574
  def note_active(uname, when=None):
1575
  """Record that `uname` was just seen β€” WITHOUT writing. The login path calls this because it
 
1639
  # ⚠ The value is `claims["t"]`, the tenant the cookie was VERIFIED for β€” never
1640
  # `session.tenant` read back from something the request could influence.
1641
  response.headers[_TENANT_HEADER] = str(claims["t"])
1642
+ response.headers[_PRINCIPAL_HEADER] = _principal(claims["t"], user["username"])
1643
  # R4: last AFTER the session is fully resolved β€” a stamp is only true of a request that was
1644
  # actually admitted, and putting it here means no failed-auth path can ever write one.
1645
  # qa-runner has no global account record. Never let the normal activity telemetry create or
web/public/AIOS_DEPLOY_RECEIPT CHANGED
@@ -1 +1 @@
1
- 37d432d140cdd437d7215e992efb2bbe154af782d7202e71f19aabc15857ddc6
 
1
+ 2dcea8b5389fc55fa58b10312a30dc5e1566e11621c407b26d43e969fd6b2c00
web/src/apiContract.ts CHANGED
@@ -68,14 +68,21 @@ export const UNAUTHORIZED_EVENT = "aios:unauthorized";
68
  */
69
  export const TENANT_HEADER = "X-AIOS-Tenant";
70
 
 
 
 
 
 
71
  /** The tenant this frame BOOTED for; `null` until the first authenticated
72
  * answer names one. Module-level on purpose β€” it must outlive every component
73
  * that could be unmounted by the very reset it triggers. */
74
  let bootTenant: string | null = null;
 
75
 
76
  /** Test seam ONLY β€” `verify_login.py` drives the comparator without a browser. */
77
  export function _resetTenantGuard(): void {
78
  bootTenant = null;
 
79
  }
80
 
81
  export function currentTenant(): string | null {
@@ -98,18 +105,18 @@ export function currentTenant(): string | null {
98
  */
99
  export function checkTenant(res: { headers: { get(name: string): string | null } }): boolean {
100
  let seen: string | null = null;
 
101
  try {
102
  seen = res.headers.get(TENANT_HEADER);
 
103
  } catch {
104
  return false;
105
  }
106
- if (!seen) return false;
107
- if (bootTenant === null) {
108
- bootTenant = seen;
109
- return false;
110
- }
111
- if (bootTenant === seen) return false;
112
- bootTenant = seen;
113
  try {
114
  if (typeof window !== "undefined" && window.location) window.location.reload();
115
  } catch {
 
68
  */
69
  export const TENANT_HEADER = "X-AIOS-Tenant";
70
 
71
+ /** The same guard at the PERSON boundary (2026-10-22: a tab painted "QA Member" while the
72
+ * server answered as an administrator, because a sign-in elsewhere repointed the one cookie).
73
+ * An opaque per-person fingerprint; must match `api/deps.py::_PRINCIPAL_HEADER`. */
74
+ export const PRINCIPAL_HEADER = "X-AIOS-Principal";
75
+
76
  /** The tenant this frame BOOTED for; `null` until the first authenticated
77
  * answer names one. Module-level on purpose β€” it must outlive every component
78
  * that could be unmounted by the very reset it triggers. */
79
  let bootTenant: string | null = null;
80
+ let bootPrincipal: string | null = null;
81
 
82
  /** Test seam ONLY β€” `verify_login.py` drives the comparator without a browser. */
83
  export function _resetTenantGuard(): void {
84
  bootTenant = null;
85
+ bootPrincipal = null;
86
  }
87
 
88
  export function currentTenant(): string | null {
 
105
  */
106
  export function checkTenant(res: { headers: { get(name: string): string | null } }): boolean {
107
  let seen: string | null = null;
108
+ let who: string | null = null;
109
  try {
110
  seen = res.headers.get(TENANT_HEADER);
111
+ who = res.headers.get(PRINCIPAL_HEADER);
112
  } catch {
113
  return false;
114
  }
115
+ const tenantSwap = !!seen && bootTenant !== null && bootTenant !== seen;
116
+ const personSwap = !!who && bootPrincipal !== null && bootPrincipal !== who;
117
+ if (seen) bootTenant = seen;
118
+ if (who) bootPrincipal = who;
119
+ if (!tenantSwap && !personSwap) return false;
 
 
120
  try {
121
  if (typeof window !== "undefined" && window.location) window.location.reload();
122
  } catch {