{"record":{"id":"44ca3267d47be7f8","repo":"ginuerzh/gost","slug":"action-list-must-look-like-connect-bind-given-s","errorCode":null,"errorMessage":"action list must look like connect,bind given: %s","messagePattern":"action list must look like connect,bind given: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"permissions.go","lineNumber":153,"sourceCode":"// ParsePermissions parses the s to a Permissions.\nfunc ParsePermissions(s string) (*Permissions, error) {\n\tps := &Permissions{}\n\n\tif s == \"\" {\n\t\treturn &Permissions{}, nil\n\t}\n\n\tperms := strings.Split(s, \" \")\n\n\tfor _, perm := range perms {\n\t\tparts := strings.Split(perm, \":\")\n\n\t\tswitch len(parts) {\n\t\tcase 3:\n\t\t\tactions, err := ParseStringSet(parts[0])\n\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"action list must look like connect,bind given: %s\", parts[0])\n\t\t\t}\n\n\t\t\thosts, err := ParseStringSet(parts[1])\n\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"hosts list must look like google.pl,*.google.com given: %s\", parts[1])\n\t\t\t}\n\n\t\t\tports, err := ParsePortSet(parts[2])\n\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"ports list must look like 80,8000-9000, given: %s\", parts[2])\n\t\t\t}\n\n\t\t\tpermission := Permission{Actions: *actions, Hosts: *hosts, Ports: *ports}\n\n\t\t\t*ps = append(*ps, permission)\n\t\tdefault:","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/ginuerzh/gost/blob/a33fdbf4c98034f4bfeeaea9868909822b9c526d/permissions.go#L135-L171","documentation":"ParsePermissions expects each permission rule to have three dash-separated parts: actions, hosts, and ports. When the first part fails ParseStringSet (empty or malformed action list), the parser returns this error telling you the actions field must look like a comma-separated list such as connect,bind.","triggerScenarios":"Calling ParsePermissions with a rule like \"connect * *\" where parts[0] is empty (leading dash, e.g. \"-host:80\"), contains invalid characters for the string-set parser, or the whole rule is malformed so parts[0] is not a valid action list.","commonSituations":"Malformed permission strings in gost config (missing action field, wrong separator, extra/missing dashes); hand-edited permission lines; whitespace or unicode dashes instead of ASCII '-'.","solutions":["Format each rule as actions-hosts-ports, e.g. \"connect,bind *.example.com 443\".","Ensure the actions field is a non-empty comma-separated list of known actions (connect, bind).","Check for stray/leading dashes or smart quotes introduced by editors; rewrite the rule in plain ASCII.","Pre-validate with ParseStringSet(parts[0]) in tests before shipping configs."],"exampleFix":"// before\npermissions = \"-*.google.com 80,443\"\n// after\npermissions = \"connect,bind *.google.com 80,443\"","handlingStrategy":"validation","validationCode":"parts := strings.Split(rule, \"-\")\nif len(parts) != 3 {\n    return fmt.Errorf(\"rule must be actions-hosts-ports, got %q\", rule)\n}\nif _, err := ParseStringSet(parts[0]); err != nil {\n    return fmt.Errorf(\"invalid action list %q\", parts[0])\n}","typeGuard":null,"tryCatchPattern":"perms, err := ParsePermissions(rules)\nif err != nil {\n    return fmt.Errorf(\"bad permissions %q: %w\", rules, err)\n}","preventionTips":["Follow the actions-hosts-ports format exactly","Use ASCII '-' separators; avoid editor smart quotes","Validate rules with ParsePermissions in CI"],"tags":["validation","permissions","config"],"backgroundTag":"invalid-permission-rule","analyzedSha":"a33fdbf4c98034f4bfeeaea9868909822b9c526d","analyzedAt":"2026-09-02T22:15:54.506Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}