Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- api/deps.py +11 -0
- web/public/AIOS_DEPLOY_RECEIPT +1 -1
- web/src/apiContract.ts +14 -7
RELEASES.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": [
|
| 4 |
{
|
| 5 |
"version": "v83",
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "dcc41725b463",
|
| 3 |
"releases": [
|
| 4 |
{
|
| 5 |
"version": "v83",
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
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 |
-
|
|
|
|
| 1 |
+
ceb39b9a5c3d8bd4f1cde8ec2374930fda3345f363f11fcc52bcbcf1beaf2ab3
|
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 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 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 {
|