Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/server/repository/ahb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,17 @@ export default class AHBRepository {
);
}
if (value.contains !== undefined) {
queryBuilder.andWhere(`LOWER(al.${columnName}) LIKE :${paramBase}_contains`, {
queryBuilder.andWhere(`al.${columnName} COLLATE NOCASE LIKE :${paramBase}_contains`, {
[`${paramBase}_contains`]: `%${value.contains.toLowerCase()}%`,
Comment on lines +159 to 160
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The columnName variable is interpolated directly into the SQL string without sanitization, creating a potential SQL injection vulnerability. Consider using a whitelist of allowed column names or TypeORM's column metadata to validate the column name before interpolation.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was like this before. out of scope for this PR

});
}
if (value.startsWith !== undefined) {
queryBuilder.andWhere(`LOWER(al.${columnName}) LIKE :${paramBase}_starts`, {
queryBuilder.andWhere(`al.${columnName} COLLATE NOCASE LIKE :${paramBase}_starts`, {
[`${paramBase}_starts`]: `${value.startsWith.toLowerCase()}%`,
});
}
if (value.endsWith !== undefined) {
queryBuilder.andWhere(`LOWER(al.${columnName}) LIKE :${paramBase}_ends`, {
queryBuilder.andWhere(`al.${columnName} COLLATE NOCASE LIKE :${paramBase}_ends`, {
[`${paramBase}_ends`]: `%${value.endsWith.toLowerCase()}`,
});
}
Expand Down