-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(root): budapest #7762
base: next
Are you sure you want to change the base?
feat(root): budapest #7762
Conversation
✅ Deploy Preview for dev-web-novu ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
❌ Deploy Preview for dashboard-v2-novu-staging failed. Why did it fail? →
|
let data: mongoose.Document<unknown, {}, EnvironmentDBModel> | null = null; | ||
|
||
if (identifierOrPublishableKey.startsWith('pk_')) { | ||
data = await this.MongooseModel.findOne({ publishableKey: identifierOrPublishableKey }).read( |
Check failure
Code scanning / CodeQL
Database query built from user-controlled sources High
user-provided value
This query object depends on a
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 18 days ago
To fix the problem, we need to ensure that the user input is properly sanitized or validated before being used in the MongoDB query. The best way to fix this issue is to use the $eq
operator to ensure that the user input is interpreted as a literal value and not as a query object. This approach prevents NoSQL injection attacks by treating the input as a simple value.
-
Copy modified line R21 -
Copy modified line R25
@@ -20,3 +20,3 @@ | ||
if (identifierOrPublishableKey.startsWith('pk_')) { | ||
data = await this.MongooseModel.findOne({ publishableKey: identifierOrPublishableKey }).read( | ||
data = await this.MongooseModel.findOne({ publishableKey: { $eq: identifierOrPublishableKey } }).read( | ||
'secondaryPreferred' | ||
@@ -24,3 +24,3 @@ | ||
} else { | ||
data = await this.MongooseModel.findOne({ identifier: identifierOrPublishableKey }).read('secondaryPreferred'); | ||
data = await this.MongooseModel.findOne({ identifier: { $eq: identifierOrPublishableKey } }).read('secondaryPreferred'); | ||
} |
'secondaryPreferred' | ||
); | ||
} else { | ||
data = await this.MongooseModel.findOne({ identifier: identifierOrPublishableKey }).read('secondaryPreferred'); |
Check failure
Code scanning / CodeQL
Database query built from user-controlled sources High
user-provided value
This query object depends on a
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 18 days ago
To fix the problem, we need to ensure that the user-provided identifierOrPublishableKey
is treated as a literal value in the MongoDB query. This can be achieved by using the $eq
operator, which ensures that the value is interpreted as a literal and not as a query object. This approach will prevent NoSQL injection attacks.
-
Copy modified line R21 -
Copy modified line R25
@@ -20,3 +20,3 @@ | ||
if (identifierOrPublishableKey.startsWith('pk_')) { | ||
data = await this.MongooseModel.findOne({ publishableKey: identifierOrPublishableKey }).read( | ||
data = await this.MongooseModel.findOne({ publishableKey: { $eq: identifierOrPublishableKey } }).read( | ||
'secondaryPreferred' | ||
@@ -24,3 +24,3 @@ | ||
} else { | ||
data = await this.MongooseModel.findOne({ identifier: identifierOrPublishableKey }).read('secondaryPreferred'); | ||
data = await this.MongooseModel.findOne({ identifier: { $eq: identifierOrPublishableKey } }).read('secondaryPreferred'); | ||
} |
What changed? Why was the change needed?
Screenshots
Expand for optional sections
Related enterprise PR
Special notes for your reviewer