Skip to content

Commit

Permalink
Added Sentry logging for email link clicks w/ bad member uuid (#21821)
Browse files Browse the repository at this point in the history
no ref

I've discovered email link checkers appear to be using
falsified/scrambled uuids when testing links for a given site. It's
difficult to check against all sites, so instead we'll log to Sentry to
confirm this is the case.

I've put this behind config because I believe it will create a LOT of
entries, and may burden an already burdened workflow during peak
traffic.
  • Loading branch information
9larsons authored Dec 6, 2024
1 parent becfc50 commit a5d6b65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const {LinkClick} = require('@tryghost/link-tracking');
const ObjectID = require('bson-objectid').default;
const sentry = require('../../../shared/sentry');
const config = require('../../../shared/config');

module.exports = class LinkClickRepository {
/** @type {Object} */
Expand Down Expand Up @@ -52,6 +54,9 @@ module.exports = class LinkClickRepository {
// Convert uuid to id
const member = await this.#Member.findOne({uuid: linkClick.member_uuid});
if (!member) {
if (config.get('captureLinkClickBadMemberUuid')) {
sentry.captureMessage('LinkClickTrackingService > Member not found', {extra: {member_uuid: linkClick.member_uuid}});
}
return;
}

Expand Down
3 changes: 2 additions & 1 deletion ghost/core/core/shared/config/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@
"minDaysSinceLastEmail": 14
},
"bulkEmail": {
"batchSize": 1000
"batchSize": 1000,
"captureLinkClickBadMemberUuid": false
},
"disableJSBackups": false
}

0 comments on commit a5d6b65

Please sign in to comment.