fsanyoto commited on
Commit
9d191ce
·
verified ·
1 Parent(s): 0d75bcb

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
RELEASES.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "current": "8d3eee3",
3
  "releases": [
4
  {
5
  "version": "v75",
 
1
  {
2
+ "current": "46f6449",
3
  "releases": [
4
  {
5
  "version": "v75",
VERSION CHANGED
@@ -1 +1 @@
1
- 8d3eee3
 
1
+ 46f6449
api/routes_external.py CHANGED
@@ -10,7 +10,7 @@ import inspect
10
  import json
11
  import time
12
  import uuid
13
- from urllib.parse import parse_qs, quote, urlencode, urlsplit, urlunsplit
14
 
15
  from fastapi import APIRouter, Body, Depends, Header, HTTPException, Request, Response
16
  from fastapi.responses import JSONResponse, RedirectResponse
@@ -1591,9 +1591,21 @@ def _oauth_token_error(code: str):
1591
  @router.post("/oauth/token")
1592
  async def oauth_token(request: Request):
1593
  """Cookie-free authorization-code exchange and rotating refresh-token endpoint."""
 
1594
  try:
1595
  body = await _oauth_token_body(request)
1596
  grant_type = body.get("grant_type")
 
 
 
 
 
 
 
 
 
 
 
1597
  audience = _require_oauth_resource(request, body.get("resource"))
1598
  if grant_type == "authorization_code":
1599
  result = external_oauth.exchange_code(
@@ -1617,6 +1629,9 @@ async def oauth_token(request: Request):
1617
  else:
1618
  raise external_oauth.ExternalOAuthError("oauth_request_invalid")
1619
  except external_access.ExternalAccessError as exc:
 
 
 
1620
  return _oauth_token_error(exc.code)
1621
  response = JSONResponse(result)
1622
  response.headers.update({"Cache-Control": "no-store", "Pragma": "no-cache"})
 
10
  import json
11
  import time
12
  import uuid
13
+ from urllib.parse import parse_qs, quote, unquote, urlencode, urlsplit, urlunsplit
14
 
15
  from fastapi import APIRouter, Body, Depends, Header, HTTPException, Request, Response
16
  from fastapi.responses import JSONResponse, RedirectResponse
 
1591
  @router.post("/oauth/token")
1592
  async def oauth_token(request: Request):
1593
  """Cookie-free authorization-code exchange and rotating refresh-token endpoint."""
1594
+ body: dict = {}
1595
  try:
1596
  body = await _oauth_token_body(request)
1597
  grant_type = body.get("grant_type")
1598
+ # HOTFIX 2026-09-24: ChatGPT's refresh answered 400 on staging while the same refresh
1599
+ # passes here. A client may name itself in HTTP Basic (RFC 6749 2.3.1) rather than the
1600
+ # body; read it from there too. The refresh token stays the credential.
1601
+ if not body.get("client_id"):
1602
+ basic = request.headers.get("authorization", "")
1603
+ if basic[:6].lower() == "basic ":
1604
+ try:
1605
+ decoded = base64.b64decode(basic[6:].strip()).decode("utf-8")
1606
+ body = {**body, "client_id": unquote(decoded.split(":", 1)[0])}
1607
+ except (ValueError, UnicodeError):
1608
+ pass
1609
  audience = _require_oauth_resource(request, body.get("resource"))
1610
  if grant_type == "authorization_code":
1611
  result = external_oauth.exchange_code(
 
1629
  else:
1630
  raise external_oauth.ExternalOAuthError("oauth_request_invalid")
1631
  except external_access.ExternalAccessError as exc:
1632
+ # Names only: which grant, which refusal and which keys arrived, never a value.
1633
+ print(f"oauth/token refused: grant_type={body.get('grant_type')} code={exc.code} "
1634
+ f"keys={sorted(body)}", flush=True)
1635
  return _oauth_token_error(exc.code)
1636
  response = JSONResponse(result)
1637
  response.headers.update({"Cache-Control": "no-store", "Pragma": "no-cache"})
platform/core/external_oauth.py CHANGED
@@ -545,10 +545,13 @@ def refresh(refresh_token, *, client_id, resource, runtime_resolver, now=None) -
545
  book["grants"] = grants
546
  result["error"] = "oauth_refresh_replayed"
547
  return book
548
- client = book["clients"].get(client_id)
 
 
 
549
  if (not current_ok or not current_match or not isinstance(row, dict)
550
  or row.get("disconnected_at") or row.get("tenant") != tenant_key
551
- or row.get("client_id") != client_id
552
  or row.get("resource") != audience
553
  or float(row.get("refresh_expires_at") or 0) < issued_at
554
  or not isinstance(client, dict) or client.get("revoked_at")
 
545
  book["grants"] = grants
546
  result["error"] = "oauth_refresh_replayed"
547
  return book
548
+ # HOTFIX 2026-09-24: a public client that omits client_id on refresh is the client the
549
+ # grant was issued to; the refresh token, matched below, is the credential.
550
+ named = client_id or (row.get("client_id") if isinstance(row, dict) else None)
551
+ client = book["clients"].get(named)
552
  if (not current_ok or not current_match or not isinstance(row, dict)
553
  or row.get("disconnected_at") or row.get("tenant") != tenant_key
554
+ or row.get("client_id") != named
555
  or row.get("resource") != audience
556
  or float(row.get("refresh_expires_at") or 0) < issued_at
557
  or not isinstance(client, dict) or client.get("revoked_at")
web/public/AIOS_DEPLOY_RECEIPT CHANGED
@@ -1 +1 @@
1
- 4859488edf1fcb12841f5feeb2e5e3a086f89498efd892953a4a4f8636545249
 
1
+ 34b75851f08e271b2ad04956cc6bda3b190f9a3162f7a5808c75c25231803159