Skip to content

Commit 6523e37

Browse files
Potential fix for code scanning alert no. 343: Database query built from user-controlled sources
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent e158d79 commit 6523e37

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

server/copilot/copilot-session.service.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,18 @@ export class CopilotSessionService {
3535
userId: string,
3636
claimReviewDataHash: string
3737
): Promise<CopilotSessionDocument | null> {
38+
// Ensure claimReviewDataHash is treated as a literal value and not a query object
39+
if (typeof claimReviewDataHash !== "string") {
40+
this.logger.warn(
41+
`Invalid claimReviewDataHash type in getActiveSession: ${typeof claimReviewDataHash}`
42+
);
43+
return null;
44+
}
45+
3846
return this.copilotSessionModel
3947
.findOne({
4048
userId,
41-
claimReviewDataHash,
49+
claimReviewDataHash: { $eq: claimReviewDataHash },
4250
isActive: true,
4351
})
4452
.sort({ createdAt: -1 })

0 commit comments

Comments
 (0)