Bound the project search parameters instead of concatenating them - #9
Merged
Merged
Conversation
* ProjectsSearcher built its WHERE clause by string concatenation, so a search word containing an apostrophe closed the literal. Searching for Parkinson's threw a syntax error on the live site, and the error page returned the query fragment * Search words, project types and both dates now go through bind parameters * The ten columns a search word is matched against were written out twice. They are now one array and one tokenConstraint helper * setEndDate built its date without separators, giving 2026911 rather than 2026-9-11. Nothing calls it, so nothing was broken, but the hand-built string is gone * SearchProjectsAction and SortProjectSearchAction now require the administrators group. The link is on the ADMIN menu but neither action checked, so any logged-in user could reach the search by posting to it directly Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The parameter ordering, query construction, date handling, and authorization checks are consistent and complete.
Pull request overview
Secures administrative project search by parameterizing SQL inputs and enforcing administrator access.
Changes:
- Binds project types, search tokens, IDs, and date constraints.
- Consolidates token matching across searchable columns.
- Adds administrator checks to search and sorting actions.
File summaries
| File | Description |
|---|---|
ProjectsSearcher.java |
Replaces SQL concatenation with bind parameters. |
SearchProjectsAction.java |
Restricts searches to administrators. |
SortProjectSearchAction.java |
Restricts result sorting to administrators. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Summary
apostrophe closed the string literal
Parkinson'sthrew a syntax error on the live site, and the error pagereturned the query fragment
rather than being written out twice
Test plan
Parkinson'sreturns 3 projects,O'KEEFEreturns none, neither errorsHDLrestricted to Billed Projects returns 16, matching the databaseHDL diabetesreturns 3 billed and 5 supported, so words are ANDed310matches on project IDCo-Authored-By: Claude noreply@anthropic.com