{{ message }}
Repository navigation
fix(history): sanitize query input to prevent FTS5 search syntax errors (#1026) - #1132
Open
Pcmhacker-piro wants to merge 4 commits into
Open
Pcmhacker-piro wants to merge 4 commits into
Pcmhacker-piro wants to merge 4 commits into
Conversation
Contributor
Author
imDarshanGK
requested changes
Jun 27, 2026
imDarshanGK
left a comment
Owner
There was a problem hiding this comment.
@Pcmhacker-piro resolve conflicts
# Conflicts: # docs/CHANGELOG.md
Contributor
Author
|
heyy @imDarshanGK |
Owner
|
@Pcmhacker-piro resolve conflicts |
…nd resolve conflicts - database.py: keep PR's sanitization logic (includes q[:200] truncation) - test_history.py: keep both test_search_history_syntax_injection (PR) and test_search_history_max_length (upstream) - CHANGELOG.md: keep both changelog entries
Contributor
Author
|
Hey @imDarshanGK, conflicts have been resolved. Here is what was done:
The PR should now be mergeable. Please take a look! |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Sanitizes the
qquery parameter in the/history/searchendpoint to prevent SQLite FTS5 query syntax errors. Double-quote characters are removed, and search terms are individually wrapped in double quotes. This prevents syntax injection errors (e.g. from single double-quotes or dangling operators likeAND,OR,*,(,)) which previously returned500 Internal Server Errorand leaked implementation details.Related Issue
Fixes #1026
Type of change
Checklist
mainpytest -vand all tests pass (Note: Local machine is running Python 3.9, which raises runtime TypeErrors on Python 3.10's newer|Union pipe syntax. Confirmed changes syntactically and added tests; validation will run in GitHub Actions CI).feat/fix/docs/test: short descriptionScreenshots (if frontend change)
N/A
Test evidence
GitHub Actions CI