Node.js based forum software built for the modern web
fix(security): close post-queue existence oracle and bodyless DELETE crash
Julian Lam251e7bfab04c
diff --git a/src/api/posts.js b/src/api/posts.jsindex fcdef1ce1e..7c1e8c8653 100644--- a/src/api/posts.js+++ b/src/api/posts.js@@ -627,12 +627,11 @@ async function canEditQueue(uid, data, action) {posts.canEditQueue(uid, data, action),posts.getFromQueue(data.id),]);- if (!queuedPost) {+ if (!queuedPost || !canEditQueue) {+ // Respond 404 (not 403) for both missing and restricted items so+ // unauthenticated callers cannot distinguish the two (existence oracle)throw new Error('[[error:no-post]]');}- if (!canEditQueue) {- throw new Error('[[error:no-privileges]]');- }}async function logQueueEvent(caller, result, type) {diff --git a/src/controllers/write/posts.js b/src/controllers/write/posts.jsindex b9ff4d8f37..4c6a7aa8f4 100644--- a/src/controllers/write/posts.js+++ b/src/controllers/write/posts.js@@ -189,7 +189,7 @@ Posts.acceptQueuedPost = async (req, res) => {Posts.removeQueuedPost = async (req, res) => {await api.posts.removeQueuedPost(req, {id: req.params.id,- message: req.query.message || req.body.message,+ message: req.query.message || req.body?.message,});helpers.formatApiResponse(200, res);};