Fix loophole where any user could load all screen and layout definitions via app package call
This commit is contained in:
parent
ca032aa6fe
commit
54fe305031
|
@ -164,7 +164,15 @@ exports.fetchAppDefinition = async function (ctx) {
|
|||
exports.fetchAppPackage = async function (ctx) {
|
||||
const db = new CouchDB(ctx.params.appId)
|
||||
const application = await db.get(DocumentTypes.APP_METADATA)
|
||||
const [layouts, screens] = await Promise.all([getLayouts(db), getScreens(db)])
|
||||
const layouts = await getLayouts(db)
|
||||
let screens = await getScreens(db)
|
||||
|
||||
// Only filter screens if the user is not a builder
|
||||
if (!ctx.user.builder?.global) {
|
||||
const userRoleId = getUserRoleId(ctx)
|
||||
const accessController = new AccessController(ctx.params.appId)
|
||||
screens = await accessController.checkScreensAccess(screens, userRoleId)
|
||||
}
|
||||
|
||||
ctx.body = {
|
||||
application,
|
||||
|
|
Loading…
Reference in New Issue