Skip to content

Prevent path traversal in sqlite file name#929

Open
benthecarman wants to merge 1 commit into
lightningdevkit:mainfrom
benthecarman:sqlite-path-traviseral
Open

Prevent path traversal in sqlite file name#929
benthecarman wants to merge 1 commit into
lightningdevkit:mainfrom
benthecarman:sqlite-path-traviseral

Conversation

@benthecarman

Copy link
Copy Markdown
Contributor

Previously someone could set their db file name to something like ../ldk-node.sqlite and we would accept this as a file path and write the databse in the parent directory. This can cause issues so we now only allow for normal file names. This still does allow for sub dirs, ie setting your db name to mysubdir/ldk-node.sqlite and it'll go into the sub directory mysubdir. I didn't want to disallow this people may be using this today and doesn't seem explicity bad like the parent dir traversal.

Issue found by project-loupe.

Codex was used to help write this.

Previously someone could set their db file name to something like
`../ldk-node.sqlite` and we would accept this as a file path and write
the databse in the parent directory. This can cause issues so we now
only allow for normal file names. This still does allow for sub dirs, ie
setting your db name to `mysubdir/ldk-node.sqlite` and it'll go into the sub
directory `mysubdir`. I didn't want to disallow this people may be using
this today and doesn't seem explicity bad like the parent dir traversal.

Issue found by project-loupe.

Codex was used to help write this.
@ldk-reviews-bot

ldk-reviews-bot commented Jun 10, 2026

Copy link
Copy Markdown

I've assigned @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@ldk-reviews-bot ldk-reviews-bot requested a review from tnull June 10, 2026 19:33
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