You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG]: Invalid MCP timeout configurations cause immediate session expiration or cleanup hot loops #281
An audit of the MCP integration's configuration parsing logic reveals that environment variable timeouts are evaluated without lower-bound validation. This absence of boundary checks exposes the runtime to potential resource exhaustion and state corruption.
Expected Behavior
When parsing environment variables like SESSION_TIMEOUT_MS or CLEANUP_INTERVAL_MS, the system should verify that the parsed value is a strictly positive integer. If a deployment environment is provisioned with zero or negative values, the system should either fall back to a safe default or throw a fatal initialization error to prevent silent logical failures.
Current Behavior
In mcp.ts, time-based configuration values are parsed using Number() or parseInt() without verifying positive integer constraints. If a user or deployment script provides an invalid configuration, the system exhibits severe degradation:
SESSION_TIMEOUT_MS = -1: Results in all sessions being evaluated as instantaneously expired.
CLEANUP_INTERVAL_MS = 0: Forces the cleanup interval to execute continuously (setInterval(..., 0)), effectively blocking the Node.js event loop and exhausting CPU resources.
Possible Solution
Implement a strict parsing utility for time-based environment variables that enforces safe, strictly positive integers before assignment.
Steps to Reproduce
Configure the environment with CLEANUP_INTERVAL_MS=0.
Start the MCP server.
Observe the cleanup interval firing continuously without delay, causing a severe CPU spike and event loop block.
Context (Environment)
Impact: Misconfigurations currently cause silent logical failures (dropped sessions) or resource exhaustion (DoS) rather than failing loudly during startup validation.
Desktop
OS: Windows 11
Browser: Brave
Version: Latest
Detailed Description
N/A - See Current Behavior for technical mechanism.
Possible Implementation
Here is a defensive utility function that could safely replace standard parsing to protect the runtime:
constparseEnvMs=(val: string|undefined,defaultValue: number): number=>{if(val===undefined||val.trim()==='')returndefaultValue;constparsed=Number(val);if(!Number.isSafeInteger(parsed)||parsed<=0){thrownewError('MCP timeout configuration must be a positive integer.');}returnparsed;};
Activity
mira-accord-project commentedon Nov 13, 2026
Thanks for the report. PR #282 (boundary validation for MCP timeout configurations) appears to address this, and it is open and waiting for review.
Drafted by an Accord Project agent, reviewed by a maintainer.