Skip to content

Potential fix for code scanning alert no. 12: Unvalidated dynamic method call#10

Open
noisyloop wants to merge 1 commit into
mainfrom
alert-autofix-12
Open

Potential fix for code scanning alert no. 12: Unvalidated dynamic method call#10
noisyloop wants to merge 1 commit into
mainfrom
alert-autofix-12

Conversation

@noisyloop

Copy link
Copy Markdown
Owner

Potential fix for https://github.com/m0rs3c0d3/EverythingOS/security/code-scanning/12

General approach: Ensure that any dynamically selected handler is validated before invocation. That means confirming we actually have a function conforming to NodeHandler before calling it in executeWithTimeout, and centralizing any additional type checks there. Even though getHandler already ensures either a registered handler or undefined, adding a runtime typeof check at the call site addresses the static tool’s concern and guards against accidental misuse (e.g., someone storing a non-function in handlers in future changes).

Best concrete fix in this code:

  1. Harden executeWithTimeout in src/core/workflow/WorkflowEngine.ts so that it:
    • Verifies handler is a function (typeof handler === 'function').
    • Throws a clear error if not.
    • This is done before any call, both in the “no timeout” path and the Promise.race path.
  2. This does not change externally visible behavior as long as handler is a proper function (as is currently assumed), but it converts any future accidental misuse into a predictable error with a clear message, and satisfies the static analysis tool’s requirement to validate the dynamically called target.

No other files need code changes; we just adjust the implementation of executeWithTimeout where the flagged call occurs. No new imports or types are required.


Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…hod call

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@noisyloop noisyloop marked this pull request as ready for review February 21, 2026 22:43
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant