Add input validation to prevent Solr injection in query construction#27
Closed
Copilot wants to merge 3 commits intoindex_creatorsfrom
Closed
Add input validation to prevent Solr injection in query construction#27Copilot wants to merge 3 commits intoindex_creatorsfrom
Copilot wants to merge 3 commits intoindex_creatorsfrom
Conversation
Co-authored-by: alexdryden <47127862+alexdryden@users.noreply.github.com>
Co-authored-by: alexdryden <47127862+alexdryden@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update Creator Record Generation and Automatic Indexing PR
Add input validation to prevent Solr injection in query construction
Feb 26, 2026
Contributor
|
This isn't a real issue since we are only ever passing in params defined in the code. |
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.
The
_execute_solr_querymethod constructs Solr queries by directly joining query parts without validation. While current usage only passes internal strings, this pattern creates injection risk if user-controlled data is added later.Changes
Added
_validate_solr_query_part(): Validates query parts against shell injection patterns (;,${...}, backticks, command chaining) and Solr-specific attacks (LocalParams{!...}, XSS vectors)Added
_validate_solr_field_name(): Restricts field names to[a-zA-Z0-9_-]+to prevent injection through field parametersModified
_execute_solr_query(): Validates all query parts and field names before query construction, returns empty list on validation failureAll existing queries pass validation. Defense-in-depth approach protects against future modifications.
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.