{"version":3,"file":"is-development-mode.mjs","sources":["../../../server/src/middlewares/is-development-mode.ts"],"sourcesContent":["import type { Context, Next } from 'koa';\nimport { errors } from '@strapi/utils';\n\n/**\n * Middleware to ensure Content-Type Builder modifications only happen in development mode\n * This prevents SQL injection vulnerabilities in production by blocking schema modifications\n * when autoReload is disabled.\n */\nexport default async (ctx: Context, next: Next) => {\n const autoReload = strapi.config.get('autoReload');\n\n if (autoReload !== true) {\n // Using a PolicyError to throw a publicly visible message in the API\n throw new errors.PolicyError(\n 'Content-Type Builder modifications are disabled in production mode. Schema changes can only be made when running with autoReload enabled (strapi develop).'\n );\n }\n\n await next();\n};\n"],"names":["ctx","next","autoReload","strapi","config","get","errors","PolicyError"],"mappings":";;AAGA;;;;IAKA,wBAAe,CAAA,OAAOA,GAAAA,EAAcC,IAAAA,GAAAA;AAClC,IAAA,MAAMC,UAAAA,GAAaC,MAAAA,CAAOC,MAAM,CAACC,GAAG,CAAC,YAAA,CAAA;AAErC,IAAA,IAAIH,eAAe,IAAA,EAAM;;QAEvB,MAAM,IAAII,MAAAA,CAAOC,WAAW,CAC1B,4JAAA,CAAA;AAEJ,IAAA;IAEA,MAAMN,IAAAA,EAAAA;AACR,CAAA;;;;"}