Spaces:
Running

fsanyoto commited on
Commit
a58d3a0
·
verified ·
1 Parent(s): 323bccf

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
RELEASES.json CHANGED
@@ -1,4 +1,4 @@
1
  {
2
- "current": "7963aa0fae",
3
  "releases": []
4
  }
 
1
  {
2
+ "current": "bb5a64ccb7",
3
  "releases": []
4
  }
VERSION CHANGED
@@ -1 +1 @@
1
- 7963aa0fae
 
1
+ bb5a64ccb7
platform/core/keychain.py CHANGED
@@ -77,13 +77,28 @@ ENTRY_TYPES = {'odoo', 'generic', 'stripe', 'shopify', 'meta_ads', 'amazon_sp',
77
  #: yields the same blank.
78
  _PREVIEW_FIELDS = ('api_key', 'access_token', 'value', 'password', 'token', 'refresh_token', 'bot_token')
79
  MAX_ENTRIES = 40
80
- MAX_FIELD_LEN = 500
 
81
 
82
 
83
  class KeychainLocked(Exception):
84
  """A required encryption key or stored ciphertext is unavailable to the reader."""
85
 
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  class KeychainEnvelopeError(ValueError):
88
  """A stored credential envelope is malformed or unsupported."""
89
 
@@ -369,7 +384,7 @@ def add_entry(rt, label, etype, fields, username, *, scope=None, write_scope=Non
369
  if etype == 'amazon_sp' and k == AMAZON_ROTATION_DEADLINE_FIELD:
370
  continue
371
  if k and isinstance(v, (str, int, float, bool)):
372
- clean[k] = str(v)[:MAX_FIELD_LEN]
373
  if etype in AMAZON_CREDENTIAL_FIELDS:
374
  missing = [key for key in AMAZON_CREDENTIAL_FIELDS[etype]
375
  if not isinstance(fields.get(key), str) or not clean.get(key, '').strip()]
@@ -849,7 +864,7 @@ def put_user_secret(rt, username, provider, fields):
849
  for k, v in list(fields.items())[:16]:
850
  k = str(k).strip()[:40]
851
  if k and isinstance(v, (str, int, float, bool)):
852
- clean[k] = str(v)[:2000] # a Google refresh token is ~100 chars; JWTs more
853
  if not clean:
854
  raise ValueError('no usable fields')
855
  row = {**seal_fields(_tenant(rt), _user_secret_id(username, provider), clean),
 
77
  #: yields the same blank.
78
  _PREVIEW_FIELDS = ('api_key', 'access_token', 'value', 'password', 'token', 'refresh_token', 'bot_token')
79
  MAX_ENTRIES = 40
80
+ #: ⛔ A field over the cap is REFUSED by `_field_text`, never sliced: a cut token stores fine and fails sign in.
81
+ MAX_FIELD_LEN = 8192
82
 
83
 
84
  class KeychainLocked(Exception):
85
  """A required encryption key or stored ciphertext is unavailable to the reader."""
86
 
87
 
88
+ class KeychainFieldTooLong(ValueError):
89
+ """A credential field is longer than `MAX_FIELD_LEN`, so nothing is stored."""
90
+
91
+
92
+ def _field_text(key, value):
93
+ """The stored text of one credential field, refusing a value over `MAX_FIELD_LEN`."""
94
+ text = str(value)
95
+ if len(text) > MAX_FIELD_LEN:
96
+ raise KeychainFieldTooLong(
97
+ f'The {key} field is {len(text)} characters, over the {MAX_FIELD_LEN} character '
98
+ 'limit. Nothing was saved.')
99
+ return text
100
+
101
+
102
  class KeychainEnvelopeError(ValueError):
103
  """A stored credential envelope is malformed or unsupported."""
104
 
 
384
  if etype == 'amazon_sp' and k == AMAZON_ROTATION_DEADLINE_FIELD:
385
  continue
386
  if k and isinstance(v, (str, int, float, bool)):
387
+ clean[k] = _field_text(k, v)
388
  if etype in AMAZON_CREDENTIAL_FIELDS:
389
  missing = [key for key in AMAZON_CREDENTIAL_FIELDS[etype]
390
  if not isinstance(fields.get(key), str) or not clean.get(key, '').strip()]
 
864
  for k, v in list(fields.items())[:16]:
865
  k = str(k).strip()[:40]
866
  if k and isinstance(v, (str, int, float, bool)):
867
+ clean[k] = _field_text(k, v)
868
  if not clean:
869
  raise ValueError('no usable fields')
870
  row = {**seal_fields(_tenant(rt), _user_secret_id(username, provider), clean),
web/public/AIOS_DEPLOY_RECEIPT CHANGED
@@ -1 +1 @@
1
- 9b9d2450f955faa86bd44b4f7308c9b53aeb1c9d28a9a38dfae5886c282211b7
 
1
+ 762ee494f820120ff273bf95fc00fbee465f91afefd97755e83e9aa3881648f5