Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/shutdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const DISABLED_VALUES = new Set(["0", "false", "off", "no"]);

function parseShutdownFlag(value: string | undefined): boolean {
if (!value) {
return true;
return false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Defaulting shutdown to false introduces fail-open behavior and inconsistent gating.

Line 5 flips missing/undefined env handling to live mode. That enables traffic in paths using PROJECT_SHUTDOWN_ENABLED (proxy.ts, app/page.tsx), while next.config.ts still treats missing as shutdown by default, creating split behavior across modules.

Please either keep fail-closed default (true) or update all shutdown checks together with an explicit migration plan.

Suggested fix (restore fail-closed default)
 function parseShutdownFlag(value: string | undefined): boolean {
   if (!value) {
-    return false;
+    return true;
   }

   return !DISABLED_VALUES.has(value.trim().toLowerCase());
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return false;
function parseShutdownFlag(value: string | undefined): boolean {
if (!value) {
return true;
}
return !DISABLED_VALUES.has(value.trim().toLowerCase());
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/shutdown.ts` at line 5, Restore the fail-closed default by changing the
return in lib/shutdown.ts from false back to true so that missing/undefined
PROJECT_SHUTDOWN_ENABLED results in shutdown enabled; update any code that reads
PROJECT_SHUTDOWN_ENABLED (see references in proxy.ts and app/page.ts) to rely on
this centralized behavior, and ensure next.config.ts remains consistent with the
same default; keep the constant/variable name PROJECT_SHUTDOWN_ENABLED and the
existing function in lib/shutdown.ts (the one returning the boolean) as the
single source of truth for this gating change.

}

return !DISABLED_VALUES.has(value.trim().toLowerCase());
Expand Down