{"record":{"id":"3c048df564c91657","repo":"chenhg5/cc-connect","slug":"config-s-run-as-env-must-not-include-dangerous-v","errorCode":null,"errorMessage":"config: %s.run_as_env must not include dangerous variable %q","messagePattern":"config: (.+?)\\.run_as_env must not include dangerous variable %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/config.go","lineNumber":58,"sourceCode":"\nvar dangerousEnvVars = map[string]bool{\n\t\"LD_PRELOAD\":            true,\n\t\"LD_LIBRARY_PATH\":       true,\n\t\"DYLD_INSERT_LIBRARIES\": true,\n\t\"DYLD_LIBRARY_PATH\":     true,\n\t\"PATH\":                  true,\n\t\"HOME\":                  true,\n\t\"USER\":                  true,\n\t\"SHELL\":                 true,\n\t\"SUDO_USER\":             true,\n\t\"SUDO_COMMAND\":          true,\n}\n\nfunc validateRunAsEnv(prefix string, envVars []string) error {\n\tfor _, v := range envVars {\n\t\tname := strings.TrimSpace(v)\n\t\tif dangerousEnvVars[strings.ToUpper(name)] {\n\t\t\treturn fmt.Errorf(\"config: %s.run_as_env must not include dangerous variable %q\", prefix, name)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc validateRunAsUser(prefix, name string) error {\n\tif name == \"\" {\n\t\treturn nil\n\t}\n\tif runtime.GOOS == \"windows\" {\n\t\treturn fmt.Errorf(\"config: %s.run_as_user is only supported on Linux/macOS\", prefix)\n\t}\n\tif name == \"root\" || name == \"0\" {\n\t\treturn fmt.Errorf(\"config: %s.run_as_user must not be root\", prefix)\n\t}\n\tif !isValidRunAsUserName(name) {\n\t\treturn fmt.Errorf(\"config: %s.run_as_user %q contains invalid characters (allowed: a-z, A-Z, 0-9, -, _, .; must start with a letter or underscore)\", prefix, name)\n\t}","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/config/config.go#L40-L76","documentation":"A config validation error from validateRunAsEnv: the run_as_env allowlist contains a variable name on the dangerous list (PATH, HOME, LD_PRELOAD, etc.). Passing these through runuser/sudo wrappers is unsafe (privilege-escape and injection vectors), so config load aborts with the offending name quoted.","triggerScenarios":"Thrown at config/config.go:58 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the flagged variable from run_as_env in config.toml","Pass non-sensitive, task-specific variables only","Set unavoidable environment via the agent's own config files instead"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}