Skip to content

Commit 18dc40d

Browse files
fix(home): address readiness review — JSDoc, JWT check, mail sanitization
- Add proper JSDoc with @returns on logConfiguration - Fix isSet JSDoc to match implementation (non-empty string check) - JWT check now catches missing/empty secret, not just default value - Remove mail provider name from response to avoid leaking placeholders
1 parent 7fe3865 commit 18dc40d

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

lib/app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ const bootstrap = async () => {
8787
};
8888

8989
/**
90-
* log server configuration
90+
* @desc Log server configuration and SaaS readiness summary to console.
91+
* @returns {Promise<void>}
9192
*/
9293
const logConfiguration = async () => {
9394
// Create server URL

modules/home/services/home.service.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import mailer from '../../../lib/helpers/mailer/index.js';
1414
import HomeRepository from '../repositories/home.repository.js';
1515

1616
/**
17-
* @desc Check whether a config value is meaningfully set (truthy, non-empty, not a DEVKIT placeholder).
17+
* @desc Check whether a config value is meaningfully set (non-empty string, not a DEVKIT placeholder).
1818
* @param {*} value - Config value to check
19-
* @returns {boolean} true if set and not a placeholder
19+
* @returns {boolean} true if value is a non-empty string and not a DEVKIT_NODE_ placeholder
2020
*/
2121
const isSet = (value) => !!(value && typeof value === 'string' && value.trim() !== '' && !value.startsWith('DEVKIT_NODE_'));
2222

@@ -126,11 +126,12 @@ const getReadinessStatus = () => {
126126
});
127127

128128
// security — JWT secret
129-
const jwtDefault = config.jwt?.secret === 'WaosSecretKeyExampleToChnageAbsolutely';
129+
const jwtSecret = config.jwt?.secret;
130+
const jwtInsecure = !jwtSecret || jwtSecret.trim() === '' || jwtSecret === 'WaosSecretKeyExampleToChnageAbsolutely';
130131
checks.push({
131132
category: 'security',
132-
status: jwtDefault ? 'warning' : 'ok',
133-
message: jwtDefault ? 'JWT secret is default — change it before production' : 'JWT secret is custom',
133+
status: jwtInsecure ? 'warning' : 'ok',
134+
message: jwtInsecure ? 'JWT secret is missing or default — change it before production' : 'JWT secret is custom',
134135
});
135136

136137
// auth — OAuth providers
@@ -143,13 +144,12 @@ const getReadinessStatus = () => {
143144
message: oAuthProviders.length > 0 ? `OAuth configured (${oAuthProviders.join(', ')})` : 'No OAuth provider configured',
144145
});
145146

146-
// mail — mailer from
147+
// mail — mailer
147148
const mailConfigured = mailer.isConfigured();
148-
const mailProvider = config.mailer?.provider || 'nodemailer';
149149
checks.push({
150150
category: 'mail',
151151
status: mailConfigured ? 'ok' : 'warning',
152-
message: mailConfigured ? `Mail configured (${mailProvider})` : 'No mail provider configured',
152+
message: mailConfigured ? 'Mail provider configured' : 'No mail provider configured',
153153
});
154154

155155
// billing — Stripe

0 commit comments

Comments
 (0)