Skip to content

Node.js based forum software built for the modern web

fix(activitypub): anchor actor/uid passthrough regexes to prevent inbox bypass

Julian Lam6fcc3448209b
diff --git a/src/middleware/activitypub.js b/src/middleware/activitypub.js
index ee2a1b91ee..84cd19bcfb 100644
--- a/src/middleware/activitypub.js
+++ b/src/middleware/activitypub.js
@@ -41,7 +41,7 @@ middleware.assertS2S = async function (req, res, next) {
middleware.verify = async function (req, res, next) {
// Verifies the HTTP Signature if present (required for POST)
- const passthrough = [/\/actor/, /\/uid\/\d+/];
+ const passthrough = [/\/actor(?:\/$|\/)/, /\/uid\/\d+(?:\/$|\/)/];
if (passthrough.some(regex => regex.test(req.path))) {
return next();
}