Skip to content

fix(node-client-sdk): better handling for bad filesystem states - #1799

Open
joker23 wants to merge 1 commit into
mainfrom
skz/SDK-2661/electron-sdk-next-node-storage-self-heal
Open

fix(node-client-sdk): better handling for bad filesystem states#1799
joker23 wants to merge 1 commit into
mainfrom
skz/SDK-2661/electron-sdk-next-node-storage-self-heal

Conversation

@joker23

@joker23 joker23 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
  • make sdk refuse to load persistent cache from symlinks (as a security measure)
  • fallsback to inmemory store if filesystem loading fails (instead of throwing)
  • additionally, exposing ConnectionMode type for downstream reference

Note

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 (lstat after mkdir) and refuses to load the cache unless ldcache.json is a regular file (symlinks or other node types are discarded like malformed JSON, without following links into arbitrary files).

API: ConnectionMode is re-exported from LDCommon for 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.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 26360 bytes
Compressed size limit: 29000
Uncompressed size: 129188 bytes

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 32077 bytes
Compressed size limit: 34000
Uncompressed size: 114525 bytes

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 39108 bytes
Compressed size limit: 39300
Uncompressed size: 213642 bytes

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 179691 bytes
Compressed size limit: 200000
Uncompressed size: 831704 bytes

@joker23

joker23 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.

@joker23
joker23 marked this pull request as ready for review July 8, 2026 18:48
@joker23
joker23 requested a review from a team as a code owner July 8, 2026 18:48

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

Comment thread packages/sdk/node-client/src/platform/NodeStorage.ts
- refuse to load from symlinks
- fallsback to inmemory store if filesystem loading fails
- additionally, exposing `ConnectionMode` type for downstream reference
@joker23
joker23 force-pushed the skz/SDK-2661/electron-sdk-next-node-storage-self-heal branch from ced01fd to eca6fe6 Compare August 3, 2026 14:31
@joker23
joker23 requested a review from kinyoklion August 3, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants