feat: Add Parse Server option allowPublicExplain to allow Parse.Query.explain without master key (#9890)

This commit is contained in:
Lucas Coratger
2025-11-08 17:02:13 +01:00
committed by GitHub
parent 15c8b1abed
commit 4456b02280
12 changed files with 180 additions and 14 deletions

View File

@@ -35,6 +35,17 @@ async function runFindTriggers(
) {
const { isGet } = options;
if (restOptions && restOptions.explain && !auth.isMaster) {
const allowPublicExplain = config.databaseOptions?.allowPublicExplain ?? true;
if (!allowPublicExplain) {
throw new Parse.Error(
Parse.Error.INVALID_QUERY,
'Using the explain query parameter requires the master key'
);
}
}
// Run beforeFind trigger - may modify query or return objects directly
const result = await triggers.maybeRunQueryTrigger(
triggers.Types.beforeFind,