fix: address PR #4180 review - security, typing, and test coverage
- Apply mcp_env_allowlist to plugin hooks: intersect HTTP allowedEnvVars with MCP allowlist, set command allowedEnvVars to full MCP allowlist - Scrub process.env in executeHookCommand when allowedEnvVars provided - Add PluginHooksState class with per-directory Map storage - Add PluginHooksConfig interface for typed boundary layer - Pass directory context through hook-config-handler - Add 16 tests across 4 files (40 assertions) covering allowlist filtering, env scrubbing, directory isolation, and edge cases - Remove unnecessary 'as' type assertions, use discriminated union narrowing instead
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { OhMyOpenCodeConfig } from "../config";
|
||||
import { loadAllPluginComponents } from "../features/claude-code-plugin-loader";
|
||||
import type { PluginHooksConfig } from "../hooks/claude-code-hooks/types";
|
||||
import { addConfigLoadError, log } from "../shared";
|
||||
|
||||
export type PluginComponents = {
|
||||
@@ -7,7 +8,7 @@ export type PluginComponents = {
|
||||
skills: Record<string, unknown>;
|
||||
agents: Record<string, unknown>;
|
||||
mcpServers: Record<string, unknown>;
|
||||
hooksConfigs: Array<{ hooks?: Record<string, unknown> }>;
|
||||
hooksConfigs: PluginHooksConfig[];
|
||||
plugins: Array<{ name: string; version: string }>;
|
||||
errors: Array<{ pluginKey: string; installPath: string; error: string }>;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user