Potential fix for code scanning alert no. 10: Resource exhaustion#12
Draft
noisyloop wants to merge 1 commit into
Draft
Potential fix for code scanning alert no. 10: Resource exhaustion#12noisyloop wants to merge 1 commit into
noisyloop wants to merge 1 commit into
Conversation
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
| setTimeout(() => reject(new Error(`Node timeout: ${timeout}ms`)), timeout) | ||
| setTimeout( | ||
| () => reject(new Error(`Node timeout: ${safeTimeout}ms`)), | ||
| safeTimeout |
Check failure
Code scanning / CodeQL
Resource exhaustion High
Copilot Autofix
AI 4 months ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
noisyloop
pushed a commit
that referenced
this pull request
Mar 10, 2026
- Bump tar to 7.5.11 and minimatch to 3.1.5 (dependabot PRs #16, #17) - Fix resource exhaustion (alert #10): add 1MB body size limit in API server parseBody and 10MB line buffer cap in MCP stdio transport - Fix unvalidated dynamic method call (alert #12): validate plugin/action identifiers against allowlist pattern before dynamic dispatch - Add input schema validation in PluginRegistry.execute - Add command allowlist to MCPStdioTransport to prevent arbitrary spawns - Fix symlink sandbox escape in file-ops by resolving real paths - Block internal event types from external API emission https://claude.ai/code/session_019XKgAhVu9mEc6NuLMMb5Wn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Potential fix for https://github.com/m0rs3c0d3/EverythingOS/security/code-scanning/10
In general, the problem is that a user‑controlled value (
node.timeout) is being passed directly tosetTimeoutas a delay in milliseconds. To fix this in a robust way, we need to validate and constrain any timeout value before it is used: ensure it is a finite integer within a reasonable range (for example between0and some maximum like30_000or60_000milliseconds). If the value is invalid or exceeds the maximum, we should either reject it (throw an error / fail the node), or fall back to a safe default.The single best fix with minimal functional impact is to enforce bounds in
WorkflowEngine.executeWithTimeout, because that is the single choke point where timeouts are applied for all nodes, regardless of how the workflow was created or wheretimeoutcame from. We can:timeoutto a number (e.g.,Number(timeout)),MAX_NODE_TIMEOUT_MS, andsetTimeout.If the sanitized timeout ends up as
0(due to invalid input), we can treat it as "no timeout" and simply call the handler directly to preserve existing behavior where no timeout was intended. This avoids having to modify the API server or the registry logic and keeps all changes localized toWorkflowEngine.ts. No new external dependencies are required; we can rely on built‑in JS/TS functionality.Concretely, in
src/core/workflow/WorkflowEngine.ts, we will modifyexecuteWithTimeoutto:safeTimeoutfrom the inputtimeout:timeoutis not a finite number or is negative, treat it as0(no timeout).safeTimeoutis0, callhandler(node, context)directly.safeTimeoutinsetTimeoutand in the error message instead of the rawtimeout.This directly prevents attackers from creating arbitrarily long timers while maintaining current functionality for sane timeout values.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.