Skip to content

Commit 56e22b3

Browse files
committed
fix(API): use truthy check for READ_ONLY in /diagnostics handler
The diagnostics route handler used strict === true while the rest of middleware uses truthy checks (|| false). A non-boolean truthy config value (e.g. 1, "true") would bypass the read-only protection and serve the full response with sensitive fields.
1 parent 45f2d92 commit 56e22b3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/middleware.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ app.get('/diagnostics', async (req, res) => {
532532
try {
533533
const configV1 = getConfig();
534534
const configV2 = getConfigV2();
535-
const readOnly = configV2.READ_ONLY === true || configV1.READ_ONLY === true;
535+
const readOnly = !!(configV2.READ_ONLY || configV1.READ_ONLY);
536536
const { getDiagnosticsResponse } = await import('./routes/diagnostics.js');
537537
const result = await getDiagnosticsResponse({ readOnly });
538538
return res.status(200).json(result);

0 commit comments

Comments
 (0)