Merge pull request #3121 from web-engineer/fix/3120-data-leak
3120 remove URL's from data when they are supposed to be disabled
This commit is contained in:
8 files changed
+33
-28
No files matched your search
@@ -129,7 +129,7 @@ export const initializeServices = async ({
|
||||
// Create DB
|
||||
const checkModule = new CheckModule({ logger, Monitor, User });
|
||||
const inviteModule = new InviteModule({ InviteToken, crypto, stringService });
|
||||
const statusPageModule = new StatusPageModule({ StatusPage, NormalizeData, stringService });
|
||||
const statusPageModule = new StatusPageModule({ StatusPage, NormalizeData, stringService, AppSettings });
|
||||
const userModule = new UserModule({ User, Team, GenerateAvatarImage, ParseBoolean, stringService });
|
||||
const maintenanceWindowModule = new MaintenanceWindowModule({ MaintenanceWindow });
|
||||
const notificationModule = new NotificationModule({ Notification, Monitor });
|
||||
|
||||
@@ -55,6 +55,10 @@ const AppSettingsSchema = mongoose.Schema(
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
showURL: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
singleton: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// import StatusPage from "../../models/StatusPage.js";
|
||||
// import { NormalizeData } from "../../../utils/dataUtils.js";
|
||||
// import ServiceRegistry from "../../../service/system/serviceRegistry.js";
|
||||
// import StringService from "../../../service/system/stringService.js";
|
||||
@@ -6,10 +5,11 @@
|
||||
const SERVICE_NAME = "statusPageModule";
|
||||
|
||||
class StatusPageModule {
|
||||
constructor({ StatusPage, NormalizeData, stringService }) {
|
||||
constructor({ StatusPage, NormalizeData, stringService, AppSettings }) {
|
||||
this.StatusPage = StatusPage;
|
||||
this.NormalizeData = NormalizeData;
|
||||
this.stringService = stringService;
|
||||
this.AppSettings = AppSettings;
|
||||
}
|
||||
|
||||
createStatusPage = async ({ statusPageData, image, userId, teamId }) => {
|
||||
@@ -260,11 +260,16 @@ class StatusPageModule {
|
||||
|
||||
const { statusPage, monitors } = statusPageQuery[0];
|
||||
|
||||
const appSettings = await this.AppSettings.findOne({ singleton: true }).lean();
|
||||
const showURL = appSettings?.showURL === true;
|
||||
|
||||
const normalizedMonitors = monitors.map((monitor) => {
|
||||
return {
|
||||
...monitor,
|
||||
checks: this.NormalizeData(monitor.checks, 10, 100),
|
||||
};
|
||||
const normalizedChecks = this.NormalizeData(monitor.checks, 10, 100);
|
||||
if (!showURL) {
|
||||
const { url, port, secret, notifications, ...rest } = monitor;
|
||||
return { ...rest, checks: normalizedChecks };
|
||||
}
|
||||
return { ...monitor, checks: normalizedChecks };
|
||||
});
|
||||
|
||||
return { statusPage, monitors: normalizedMonitors };
|
||||
|
||||
@@ -60,6 +60,7 @@ class SettingsService {
|
||||
await this.AppSettings.create({});
|
||||
settings = await this.AppSettings.findOne({ singleton: true }).select("-__v -_id -createdAt -updatedAt -singleton").lean();
|
||||
}
|
||||
|
||||
return settings;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,7 +413,7 @@ const updateAppSettingsBodyValidation = joi.object({
|
||||
pagespeedApiKey: joi.string().allow(""),
|
||||
language: joi.string().allow(""),
|
||||
timezone: joi.string().allow(""),
|
||||
// showURL: joi.bool().required(),
|
||||
showURL: joi.bool().optional(),
|
||||
systemEmailHost: joi.string().allow(""),
|
||||
systemEmailPort: joi.number().allow(""),
|
||||
systemEmailAddress: joi.string().allow(""),
|
||||
|
||||
Reference in new issue
Block a user