fix(hook-message-injector): add validation to prevent empty message injection and improve logging
- Add content validation in injectHookMessage() to prevent empty hook content injection - Add logging to claude-code-hooks and keyword-detector for better debugging - Document timing issues in empty-message-sanitizer comments - Update README with improved setup instructions 🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -71,6 +71,16 @@ export function injectHookMessage(
|
||||
hookContent: string,
|
||||
originalMessage: OriginalMessageContext
|
||||
): boolean {
|
||||
// Validate hook content to prevent empty message injection
|
||||
if (!hookContent || hookContent.trim().length === 0) {
|
||||
console.warn("[hook-message-injector] Attempted to inject empty hook content, skipping injection", {
|
||||
sessionID,
|
||||
hasAgent: !!originalMessage.agent,
|
||||
hasModel: !!(originalMessage.model?.providerID && originalMessage.model?.modelID)
|
||||
})
|
||||
return false
|
||||
}
|
||||
|
||||
const messageDir = getOrCreateMessageDir(sessionID)
|
||||
|
||||
const needsFallback =
|
||||
|
||||
Reference in New Issue
Block a user