mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 16:59:22 +02:00
ppl: fix empty/no-op allow block added in some cases to converted PPL policies (#5289)
Fix empty/no-op allow block added in some cases to converted PPL policies
This commit is contained in:
parent
6171c09596
commit
d06a101f79
2 changed files with 76 additions and 2 deletions
|
@ -77,10 +77,14 @@ func (p *Policy) ToPPL() *parser.Policy {
|
|||
},
|
||||
})
|
||||
}
|
||||
ppl.Rules = append(ppl.Rules, allowRule)
|
||||
|
||||
hasEmbeddedPolicy := (p.Policy != nil && p.Policy.Policy != nil)
|
||||
// omit the default allow rule if it is empty and there is an embedded policy
|
||||
if len(allowRule.Or) > 0 || !hasEmbeddedPolicy {
|
||||
ppl.Rules = append(ppl.Rules, allowRule)
|
||||
}
|
||||
// append embedded PPL policy rules
|
||||
if p.Policy != nil && p.Policy.Policy != nil {
|
||||
if hasEmbeddedPolicy {
|
||||
ppl.Rules = append(ppl.Rules, p.Policy.Policy.Rules...)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue