Skip to content

Limit background diff preload to bounded radius - #18

Merged
svenbuild merged 1 commit into
mainfrom
codex/fix-vulnerability-in-background-preload
Mar 31, 2026
Merged

svenbuild merged 1 commit into
mainfrom
codex/fix-vulnerability-in-background-preload

Conversation

@svenbuild

Copy link
Copy Markdown
Owner

Motivation

  • The background preload previously enqueued diffs for every entry in a directory, enabling unbounded CPU/memory use on large folders and creating a local availability risk.
  • The intent of this change is to bound background preload work while preserving the prioritization around the currently selected entry.

Description

  • Add a constant BACKGROUND_PRELOAD_RADIUS = 20 and use it to cap the number of entries enqueued for background preload.
  • When the selected center entry is not found, only the first BACKGROUND_PRELOAD_RADIUS + 1 entries are returned instead of the full list.
  • When the center is present, the neighbor-prioritization loop stops once relativePaths.length reaches BACKGROUND_PRELOAD_RADIUS + 1, preserving ordering but preventing full-directory scans.
  • The change is implemented in src/lib/app/diff-cache.ts and is minimal to avoid behavioral regressions.

Testing

  • Ran npm run check (which runs svelte-check and tsc) and it completed successfully with svelte-check reporting 0 errors and 0 warnings.

Codex Task

@svenbuild
svenbuild merged commit b1ff1a2 into main Mar 31, 2026
1 check passed
@svenbuild
svenbuild deleted the codex/fix-vulnerability-in-background-preload branch March 31, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant