fix(node-client-sdk): better handling for bad filesystem states - #1799
fix(node-client-sdk): better handling for bad filesystem states#1799joker23 wants to merge 1 commit into
Conversation
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/js-client-sdk size report |
|
@launchdarkly/js-client-sdk-common size report |
|
@launchdarkly/browser size report |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit ced01fd. Configure here.
- refuse to load from symlinks - fallsback to inmemory store if filesystem loading fails - additionally, exposing `ConnectionMode` type for downstream reference
ced01fd to
eca6fe6
Compare
ConnectionModetype for downstream referenceNote
Medium Risk
Changes local persistence and symlink handling for the flag cache, which affects security and whether flags survive restarts when the filesystem is misconfigured.
Overview
NodeStorage no longer treats a broken or unsafe local cache as a hard failure. After init problems it keeps serving get/set/clear from an in-memory map, logs a single warn about the fallback (flags won’t persist across restarts), and skips disk flushes when persistence is disabled.
Security / integrity: Init now rejects a symlinked storage directory (
lstataftermkdir) and refuses to load the cache unlessldcache.jsonis a regular file (symlinks or other node types are discarded like malformed JSON, without following links into arbitrary files).API:
ConnectionModeis re-exported fromLDCommonfor downstream typing.Tests were expanded for symlinked dirs/files, a file at the storage path, uncreateable paths, and failed rewrite after discarding bad cache; platform tests expect warn on init failure instead of per-operation error logs.
Reviewed by Cursor Bugbot for commit eca6fe6. Bugbot is set up for automated code reviews on this repo. Configure here.