-
Notifications
You must be signed in to change notification settings - Fork 8
fix: Mustache.escape fix #85
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -113,10 +113,10 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (event.eventTypeId == EVENT_TYPE.ScoopNotification){ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const date = moment(event.eventTime); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| event.payload.scoopNotificationConfig.data.interceptedAt = date.unix(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jsons = Mustache.render(Mustache.escape(template), event.payload.scoopNotificationConfig.data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jsons = Mustache.render(template, event.payload.scoopNotificationConfig.data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let parsedEvent = this.mh.parseEventForWebhook(event as Event); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jsons = Mustache.render(Mustache.escape(template), parsedEvent); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jsons = Mustache.render(template, parsedEvent); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Check failureCode scanning / CodeQL Code injection Critical
Template, which may contain code, depends on a
user-provided value Error loading related location Loading
Copilot AutofixAI about 1 year ago To fix the problem, we need to ensure that the
Suggested changeset
2
src/destination/destinationHandlers/webhookHandler.ts
package.json
Outside changed files
This fix introduces these dependencies
Copilot is powered by AI and may make mistakes. Always verify output.
Positive FeedbackNegative Feedback
Refresh and try again.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let j = JSON.parse(jsons); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Check failure
Code scanning / CodeQL
Code injection Critical
Copilot Autofix
AI about 1 year ago
To fix the problem, we need to ensure that the
templateused inMustache.renderis sanitized and validated before rendering. This can be achieved by:templateto ensure it does not contain any malicious code.The best way to fix this without changing existing functionality is to use context-specific escaping and validation for the
templatebefore rendering it withMustache.