{"record":{"id":"58947c945a4005a4","repo":"FlowiseAI/Flowise","slug":"argument-arg-contains-flag-flag-that-is","errorCode":null,"errorMessage":"Argument '${arg}' contains flag '${flag}' that is not allowed for command '${command}'.","messagePattern":"Argument '(.+?)' contains flag '(.+?)' that is not allowed for command '(.+?)'\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/tools/MCP/core.ts","lineNumber":389,"sourceCode":"\n    const dangerousFlags = dangerousFlagsByCommand[command] || []\n\n    // Collect single-char dangerous flags (e.g. '-c' -> 'c') for combined flag detection\n    const dangerousShortChars = new Set(dangerousFlags.filter((f) => /^-[a-zA-Z]$/.test(f)).map((f) => f[1].toLowerCase()))\n\n    for (const arg of args) {\n        if (typeof arg !== 'string') continue\n\n        const normalizedArg = arg.toLowerCase().trim()\n\n        // Check for dangerous flags in various forms (exact, =value, space-separated value)\n        for (const flag of dangerousFlags) {\n            const lowerCaseFlag = flag.toLowerCase()\n            if (normalizedArg === lowerCaseFlag) {\n                throw new Error(`Argument '${arg}' is not allowed for command '${command}'.`)\n            }\n            if (normalizedArg.startsWith(lowerCaseFlag + '=')) {\n                throw new Error(`Argument '${arg}' contains flag '${flag}' that is not allowed for command '${command}'.`)\n            }\n            if (flag.startsWith('-') && normalizedArg.startsWith(lowerCaseFlag + ' ')) {\n                throw new Error(`Argument '${arg}' contains flag '${flag}' that is not allowed for command '${command}'.`)\n            }\n        }\n\n        // Check for combined short flags (e.g. \"-yc\" = \"-y\" + \"-c\")\n        // A combined flag starts with a single '-', is not a long flag '--', and has multiple characters after '-'\n        if (/^-[a-zA-Z]{2,}/.test(normalizedArg)) {\n            const flagChars = normalizedArg.slice(1) // strip leading '-'\n            for (const ch of flagChars) {\n                if (dangerousShortChars.has(ch)) {\n                    throw new Error(`Argument '${arg}' contains dangerous flag '-${ch}' for command '${command}'.`)\n                }\n            }\n        }\n    }\n}","sourceCodeStart":371,"sourceCodeEnd":407,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/tools/MCP/core.ts#L371-L407","documentation":"Thrown by validateCommandFlags when an arg starts with '<lowerCaseFlag>=' — the =-value form of a dangerous flag (e.g. '--node-options=...', '--env-file=...', '--volume=...', '--require=./evil'). The message names both the offending arg and the matched flag so the operator can see which entry in dangerousFlagsByCommand matched.","triggerScenarios":"validateCommandFlags processes an arg like '--env-file=/etc/passwd' for node, or '--volume=/:/x' for docker, and lowerCaseFlag + '=' matches a dangerous flag prefix.","commonSituations":"Operator tries to pass configuration via flag=value syntax to avoid the exact-match guard; docker --mount/--volume/--env-file; node --require/--loader with =.","solutions":["Drop the dangerous flag entirely (do not pass --env-file/--volume/--require).","Pass the data through allow-listed env vars instead of file-loading flags.","If a mount is genuinely needed, run the MCP server outside the validated command path."],"exampleFix":"// before\n{ command: 'docker', args: ['run', '--volume=/host:/c', 'img'] }\n\n// after\n{ command: 'docker', args: ['run', 'img'] } // no host mount","handlingStrategy":"validation","validationCode":"const flags = (dangerousFlagsByCommand[command] ?? []).map(f => f.toLowerCase())\nif (args.some(a => typeof a === 'string' && flags.some(f => a.toLowerCase().trim().startsWith(f + '=')))) {\n  throw new Error(`Arg uses =value form of a dangerous flag for ${command}`)\n}","typeGuard":"const argsHaveNoDangerousEqValueFlags = (command: string, args: string[]): boolean => {\n  const flags = (dangerousFlagsByCommand[command] ?? []).map(f => f.toLowerCase())\n  return !args.some(a => typeof a === 'string' && flags.some(f => a.toLowerCase().trim().startsWith(f + '=')))\n}","tryCatchPattern":"try {\n  validateCommandFlags(command, args)\n} catch (e) {\n  if (e.message.includes(\"contains flag '\") && e.message.includes(\"that is not allowed\")) {\n    // drop the offending flag=value token\n  }\n  throw e\n}","preventionTips":["Do not pass file-loading or mount flags via flag=value syntax.","Move configuration into allow-listed env vars rather than file-loading flags.","Lint args for any entry matching /^--(env-file|require|loader|volume|mount)=/."],"tags":["mcp","security","command-flags","injection"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}