Skip to content

Commit be0c589

Browse files
Potential fix for code scanning alert no. 89: 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 9c160da commit be0c589

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/db/mongo/pushes.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ const writeAudit = async (action) => {
5757
const options = { upsert: true };
5858
const collection = await connect(cnName);
5959
delete data._id;
60+
if (typeof data.id !== 'string') {
61+
throw new Error('Invalid id');
62+
}
6063
await collection.updateOne({ id: { $eq: data.id } }, { $set: data }, options);
6164
return action;
6265
};

0 commit comments

Comments
 (0)