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
- refuse to load from symlinks - fallsback to inmemory store if filesystem loading fails - additionally, exposing `ConnectionMode` type for downstream reference
|
@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.
ConnectionModetype for downstream referenceNote
Medium Risk
Changes filesystem trust boundaries and persistence behavior for the local flag cache; misconfigured hosts may silently lose cross-restart persistence, but runtime flag access should remain available.
Overview
Hardens
NodeStoragelocal flag cache initialization so unsafe or broken filesystem layouts no longer redirect reads/writes or leave the SDK unusable.If the storage directory is a symlink, the cache file is not a regular file, or init otherwise fails (including when fixing a malformed cache cannot be written), persistence is disabled and the SDK warns once and keeps serving flags from an in-memory map.
get/set/clearno longer log errors on init failure; disk flushes are skipped when persistence is off. Symlinkedldcache.jsonpaths are treated as malformed and discarded without loading symlink targets.Also re-exports
ConnectionModefromLDCommonfor downstream typing. Tests were expanded for symlink, file-at-path, and fallback scenarios; platform tests expect the init-fallback warn instead of storage errors.Reviewed by Cursor Bugbot for commit ced01fd. Bugbot is set up for automated code reviews on this repo. Configure here.