fix(node-client-sdk): better handling for bad filesystem states - #1799
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
🤖 I have created a release *beep* *boop* --- <details><summary>node-client-sdk: 4.0.2</summary> ## [4.0.2](node-client-sdk-v4.0.1...node-client-sdk-v4.0.2) (2026-08-13) ### Bug Fixes * **node-client-sdk:** better handling for bad filesystem states ([#1799](#1799)) ([8f58b35](8f58b35)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Release Please** bumps `@launchdarkly/node-client-sdk` from **4.0.1** to **4.0.2** across the manifest, package metadata, `NodeInfo` SDK version, hello example dependency, and changelog entry. > > The published **4.0.2** release documents the bug fix from [#1799](#1799): improved handling when the local filesystem is in a bad state (e.g. persistent cache paths). No additional source changes appear in this diff beyond versioning and release notes. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c677b6a. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.