{"record":{"id":"6a87c8e43eb40355","repo":"Yeachan-Heo/oh-my-codex","slug":"sendtoworker-injection-marker-is-not-allowed","errorCode":null,"errorMessage":"sendToWorker: injection marker is not allowed","messagePattern":"sendToWorker: injection marker is not allowed","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/tmux-session.ts","lineNumber":3744,"sourceCode":"\nexport const normalizeTmuxCapture = sharedNormalizeTmuxCapture;\n\nfunction normalizeWorkerTriggerForDraftMatch(value: string | null | undefined): string {\n  // Codex/tmux can wrap long path-like trigger text after a hyphen, e.g.\n  // `worker-\\n  1/inbox.md`. Treat those visual wraps as the original token so\n  // delivery verification does not mistake an unsent draft for consumed input.\n  return normalizeTmuxCapture(value ?? '').replace(/-\\s+/g, '-');\n}\n\nfunction assertWorkerTriggerText(text: string): void {\n  if (text.length >= 200) {\n    throw new Error('sendToWorker: text must be < 200 characters');\n  }\n  if (text.trim().length === 0) {\n    throw new Error('sendToWorker: text must be non-empty');\n  }\n  if (text.includes(INJECTION_MARKER)) {\n    throw new Error('sendToWorker: injection marker is not allowed');\n  }\n}\n\nexport function sendToWorkerStdin(\n  stdin: Pick<NodeJS.WritableStream, 'write' | 'writable'> | null | undefined,\n  text: string,\n): void {\n  assertWorkerTriggerText(text);\n  if (!stdin || !stdin.writable) {\n    throw new Error('sendToWorkerStdin: stdin is not writable');\n  }\n  stdin.write(`${text}\\n`);\n}\n\n// Send SHORT text (<200 chars) to worker via tmux send-keys\n// Validates: text < 200 chars, no injection marker\n// Throws on violation\nexport async function sendToWorker(","sourceCodeStart":3726,"sourceCodeEnd":3762,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/tmux-session.ts#L3726-L3762","documentation":"Guard inside assertWorkerTriggerText: the trigger text must not contain the library's INJECTION_MARKER constant. The marker is used internally to verify that submitted text was consumed by the worker pane; embedding it in user text would break the delivery-verification heuristic and could be used to spoof verification.","triggerScenarios":"Passing text that includes the INJECTION_MARKER substring to sendToWorker / sendToWorkerStdin — usually because the text was built by echoing captured pane output that already contains the marker back into a send call.","commonSituations":"Echoing pane captures back into send-keys; tests that reuse fixture strings containing the marker; copy-pasting from logs where the marker appears.","solutions":["Strip or replace the marker from text before sending","Do not feed captured pane output back as trigger text; construct triggers from your own constants","If you need the literal marker for debugging, use a dedicated debug path rather than sendToWorker"],"exampleFix":"// before\nsendToWorkerStdin(worker.stdin, capturedText); // contains INJECTION_MARKER\n\n// after\nconst safe = capturedText.split(INJECTION_MARKER).join('[marker]');\nsendToWorkerStdin(worker.stdin, safe);","handlingStrategy":"validation","validationCode":"if (text.includes(INJECTION_MARKER)) text = text.split(INJECTION_MARKER).join('');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never echo pane captures back as trigger text","Keep trigger strings as hardcoded constants you own"],"tags":["validation","injection","tmux","send-keys"],"backgroundTag":"input-validation-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}