tightened network defaults, squashed bugs
Security:
- Bind HTTP gateway to 127.0.0.1 by default; add --bind for LAN opt-in
- Restrict Reticulum mesh surface to GET /api/sites only (CSRF cannot
authenticate mesh callers, so gate by whitelist)
- Cap request body size at 16 MiB to prevent memory DoS
- Redact /bookmark query strings from request logs so the bookmark token
and URLs do not land in stdout / docker / journal logs
- Tighten FTS5 sanitizer: strip colon, drop AND/OR/NOT/NEAR operator words
- Expand .dockerignore; document trust model in README
Features:
- Add sharing mode toggle (share everything except private vs share only
public-tagged) with /share/preview so users can see what subscribers
would receive before enabling sharing
Bugs:
- handle_export() crashed on every call (missing query kwarg)
- Dead float16 decompression branch in embeddings.py silently corrupted
the HNSW index when compress_embeddings was on
- GATEWAY_PORT staleness: --port and find_available_port had no effect
on the actual bind
- semantic_search default mismatched between db.py ("1") and the rest of
the app ("0"), causing embeddings to be generated when the UI said off
- Connection pool returned connections with uncommitted transactions to
the next consumer
- Gateway POST body decode 502'd on non-UTF-8 input
- ensure_rns_config clobbered user-edited ~/.reticulum/config; now only
rewrites files it authored (sentinel-tagged)
This commit is contained in:
parent
e3aadf3947
commit
8205db9bc3
8 changed files with 266 additions and 56 deletions
|
|
@ -261,6 +261,13 @@ def _decompress(embeddings):
|
|||
return embeddings
|
||||
|
||||
|
||||
def _blob_to_vec(buf):
|
||||
"""Decode a stored embedding blob to a float32 vector, inferring dtype from length."""
|
||||
if len(buf) == DIMS * 2:
|
||||
return np.frombuffer(buf, dtype=np.float16).astype(np.float32)
|
||||
return np.frombuffer(buf, dtype=np.float32)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# HNSW index management
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
@ -294,9 +301,7 @@ def build_index(db=None):
|
|||
(BATCH_SIZE, offset),
|
||||
).fetchall()
|
||||
for r in rows:
|
||||
emb = np.frombuffer(r["embedding"], dtype=np.float32)
|
||||
if emb.dtype == np.float16:
|
||||
emb = emb.astype(np.float32)
|
||||
emb = _blob_to_vec(r["embedding"])
|
||||
all_ids.append(r["id"])
|
||||
all_embeddings.append(emb)
|
||||
finally:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue