{"record":{"id":"0eaedfc252bd8b4f","repo":"juanfont/headscale","slug":"tags-in-ssh-source-cannot-access-autogroup-member","errorCode":null,"errorMessage":"tags in SSH source cannot access autogroup:member (user-owned devices)","messagePattern":"tags in SSH source cannot access autogroup:member \\(user-owned devices\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hscontrol/policy/v2/types.go","lineNumber":45,"sourceCode":"// Global JSON options for consistent parsing across all struct unmarshaling.\nvar policyJSONOpts = []json.Options{\n\tjson.DefaultOptionsV2(),\n\tjson.MatchCaseInsensitiveNames(true),\n\tjson.RejectUnknownMembers(true),\n}\n\nconst Wildcard = Asterix(0)\n\nvar ErrAutogroupSelfRequiresPerNodeResolution = errors.New(\"autogroup:self requires per-node resolution and cannot be resolved in this context\")\n\nvar ErrUndefinedTagReference = errors.New(\"references undefined tag\")\n\n// SSH validation errors.\nvar (\n\tErrSSHTagSourceToUserDest             = errors.New(\"tags in SSH source cannot access user-owned devices\")\n\tErrSSHUserDestRequiresSameUser        = errors.New(\"user destination requires source to contain only that same user\")\n\tErrSSHAutogroupSelfRequiresUserSource = errors.New(\"autogroup:self destination requires source to contain only users or groups, not tags or autogroup:tagged\")\n\tErrSSHTagSourceToAutogroupMember      = errors.New(\"tags in SSH source cannot access autogroup:member (user-owned devices)\")\n\tErrSSHWildcardDestination             = errors.New(\"wildcard (*) is not supported as SSH destination\")\n\tErrSSHCheckPeriodAboveMax             = errors.New(\"is above the max (168h)\")\n\tErrSSHCheckPeriodNegative             = errors.New(\"must be a positive duration\")\n\tErrSSHCheckPeriodOnNonCheck           = errors.New(\"checkPeriod is only valid with action \\\"check\\\"\")\n\tErrInvalidLocalpart                   = errors.New(\"invalid localpart format, must be localpart:*@<domain>\")\n\tErrSSHUsersMustBeSpecified            = errors.New(\"users must be specified\")\n\tErrSSHUserInvalid                     = errors.New(\"is not valid\")\n\tErrSSHAcceptEnvEmpty                  = errors.New(\"acceptEnv values cannot be empty\")\n\tErrSSHActionMustBeSpecified           = errors.New(\"action must be specified\")\n\tErrSSHActionInvalid                   = errors.New(\"is not a valid action\")\n\tErrSSHDestinationHostAlias            = errors.New(\"invalid dst\")\n\tErrTagNameMustStartWithLetter         = errors.New(\"tag names must start with a letter, after 'tag:'\")\n\tErrGroupMembersCannotBeRecursive      = errors.New(\"group members cannot be recursive\")\n)\n\n// SSH check period constants per Tailscale docs:\n// https://tailscale.com/docs/features/tailscale-ssh#checkperiod\n// SaaS imposes no minimum (0s is accepted) so headscale matches.","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/hscontrol/policy/v2/types.go#L27-L63","documentation":"SSH validation error (hscontrol/policy/v2/types.go:2190): an SSH rule combines a tagged src with autogroup:member in dst. autogroup:member expands to all user-owned devices, and tag-owned sources may not SSH into user-owned devices — the tagged counterpart of ErrSSHTagSourceToUserDest at the autogroup level.","triggerScenarios":"{\"src\": [\"tag:ci\"], \"dst\": [\"autogroup:member\"], \"users\": [\"deploy\"], \"action\": \"accept\"} — any tag/autogroup:tagged in src with autogroup:member in dst.","commonSituations":"Automation node meant to deploy everywhere; replacing a deprecated * dst with autogroup:member while keeping a tagged src; policy migration from v1-style broad SSH rules.","solutions":["Switch dst to autogroup:tagged or specific tags so the rule stays tag-to-tag","Or drop the tag from src and use a user/group that owns the deployment targets","Expose automation via the network grants layer instead of SSH rules"],"exampleFix":"// before\n{\"src\": [\"tag:ci\"], \"dst\": [\"autogroup:member\"], \"users\": [\"deploy\"], \"action\": \"accept\"}\n\n// after\n{\"src\": [\"tag:ci\"], \"dst\": [\"autogroup:tagged\"], \"users\": [\"deploy\"], \"action\": \"accept\"}","handlingStrategy":"validation","validationCode":"func sshTagSrcRuleValid(dst []string) bool { return !slices.Contains(dst, \"autogroup:member\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair tagged sources only with tagged or autogroup:tagged destinations","Use autogroup:member dsts exclusively with user/group sources"],"tags":["policy","ssh","autogroup","validation","headscale"],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}