Fix chmod check and relax mail

This commit is contained in:
Alice Gaudon 2020-07-15 15:39:08 +02:00
parent 583a5a92de
commit e9a20c82ed
3 changed files with 9 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{
"name": "wms-core",
"version": "0.16.1",
"version": "0.16.3",
"description": "Node web framework",
"repository": "git@gitlab.com:ArisuOngaku/wms-core.git",
"author": "Alice Gaudon <alice@gaudon.pro>",

View File

@ -186,9 +186,11 @@ export default abstract class Application {
const fullPath = path.resolve(configDir, file);
const stats = fs.lstatSync(fullPath);
if (stats.uid !== process.getuid())
throw new SecurityError(fullPath + ' is not owned by this process (' + process.getuid() + ').');
if (stats.mode !== 400)
throw new SecurityError(fullPath + ' is not chmod 400.');
throw new SecurityError(`${fullPath} is not owned by this process (${process.getuid()}).`);
const mode = (stats.mode & parseInt('777', 8)).toString(8);
if (mode !== '400')
throw new SecurityError(`${fullPath} is ${mode}; should be 400.`);
}
// Check security fields

View File

@ -8,9 +8,9 @@ export default class MailComponent extends ApplicationComponent<void> {
public async checkSecuritySettings(): Promise<void> {
if (!config.get<boolean>('mail.secure')) {
throw new SecurityError('Cannot set mail.secure to false');
}
// if (!config.get<boolean>('mail.secure')) {
// throw new SecurityError('Cannot set mail.secure to false');
// }
if (config.get<boolean>('mail.allow_invalid_tls')) {
throw new SecurityError('Cannot set mail.allow_invalid_tls to true');
}