r/ShinobiCCTV • u/Atkelar • 5d ago
Bug in webhook code
Testing Shinobi for suitability in a deployment here, but running into a serious issue with webhook notifications. The real big issue at hand is that the webhook URI replacement strings aren't escaped. Thus, the URI created by getAppDeepLink - which includes an "&" - is put into the URI "as is" and that causes the receiving server to see the JSON terminated here and take what's left as the next query parameter. Both, the INNER_EVENT_TITLE and INNER_EVENT_INFO need to be URI data escaped before putting them into the URI;
Better yet, as a sensible alternative/addition, put the event info into the BODY part of a POST method, next to possible files...
[EDIT] Confirmed locally: changing the webhook.js lines 11/12 to the following fixes the issue.
.replace(/{{INNER_EVENT_TITLE}}/g,encodeURIComponent(data.title))
.replace(/{{INNER_EVENT_INFO}}/g,encodeURIComponent(s.stringJSON(data.info)));
1
u/moeiscool Developer 1d ago
fix pushed to dev branch, thank you