From 93263fa7bed179f8984e7609a998ab70b801d292 Mon Sep 17 00:00:00 2001 From: Fabien O'Carroll Date: Tue, 27 Feb 2024 16:17:06 -0500 Subject: [PATCH] Ensured that endpoint header config is not modified in future refs https://linear.app/tryghost/issue/ENG-674/ This will cause errors to be thrown if developers attempt to modify the shared header config in future. --- ghost/api-framework/lib/pipeline.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ghost/api-framework/lib/pipeline.js b/ghost/api-framework/lib/pipeline.js index c4e164cdbe..8d4a4b1e15 100644 --- a/ghost/api-framework/lib/pipeline.js +++ b/ghost/api-framework/lib/pipeline.js @@ -188,6 +188,8 @@ const pipeline = (apiController, apiUtils, apiType) => { return keys.reduce((obj, method) => { const apiImpl = _.cloneDeep(apiController)[method]; + Object.freeze(apiImpl.headers); + obj[method] = async function wrapper() { const apiConfig = {docName, method}; let options;