mirror of
https://github.com/juanfont/headscale.git
synced 2026-04-24 01:28:49 +02:00
policy/v2: fix grant-only policies returning FilterAllowAll
compileFilterRules checked only pol.ACLs == nil to decide whether to return FilterAllowAll (permit-any). Policies that use only Grants (no ACLs) had nil ACLs, so the function short-circuited before compiling any CapGrant rules. This meant cap/relay, cap/drive, and any other App-based grant capabilities were silently ignored. Check both ACLs and Grants are empty before returning FilterAllowAll. Updates #2180
This commit is contained in:
@@ -137,7 +137,7 @@ func (pol *Policy) compileFilterRules(
|
|||||||
users types.Users,
|
users types.Users,
|
||||||
nodes views.Slice[types.NodeView],
|
nodes views.Slice[types.NodeView],
|
||||||
) ([]tailcfg.FilterRule, error) {
|
) ([]tailcfg.FilterRule, error) {
|
||||||
if pol == nil || pol.ACLs == nil {
|
if pol == nil || (pol.ACLs == nil && len(pol.Grants) == 0) {
|
||||||
return tailcfg.FilterAllowAll, nil
|
return tailcfg.FilterAllowAll, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user