Skip to content

Never crash: Read and delete imported profiles only inside Profiles/ (#2565) - #3466

Draft
endthestart wants to merge 1 commit into
storytold:mainfrom
endthestart:fix/2565-lut-profile-paths
Draft

endthestart wants to merge 1 commit into
storytold:mainfrom
endthestart:fix/2565-lut-profile-paths

Conversation

@endthestart

Copy link
Copy Markdown
Contributor

The library trusted the LUT path saved in prefs.json for each imported profile. On open it read whatever that path named with no size limit, and Delete Imported Profile only did a lexical starts_with check, so Profiles/../outside.cube passed and the file outside got deleted.

Now both look only at the file of that name directly in the library's Profiles folder, and only when it's a regular file. Reads stop at 512 MB, which is above what a 256³ cube takes. Registration also gets the folder passed in, since it runs before the session's library is set.

I added a test that points a profile at Profiles/../outside.cube, reopens the library and deletes the profile. Before the change the outside LUT was registered and the file was removed. Now neither happens, and the existing import tests still pass.

Let me know if you'd rather fix it another way. Thank you.

Fixes #2565

@coderabbitai

coderabbitai Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@wanikhawar

Copy link
Copy Markdown
Contributor

The hole is still on main: register_all reads the saved path uncapped and profile.deleteImported only does a lexical starts_with. The fix is wanted and the test covers both paths.

This branch has not been deployed

No deployments
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.

prefs.json LUT profile paths are trusted: read unbounded on every library open; Delete Imported Profile's path check is lexical

2 participants