Skip to content

Commit

Permalink
fix(policy): skip validate approver for arbitrary appeal values (#100)
Browse files Browse the repository at this point in the history
- skip validate approver step in case the expression uses arbitrary appeal values which are only available at the time of appeal creation.
  • Loading branch information
bsushmith authored Oct 25, 2023
1 parent c7e407c commit fce526c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/policy/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,14 @@ func (s *Service) validateApprover(expr string) error {
return nil
}

// skip validation if expression is accessing arbitrary value
// skip validate approver step in case the expression uses arbitrary appeal values
// which are only available at the time of appeal creation.
if strings.Contains(expr, "$appeal.resource") ||
strings.Contains(expr, "$appeal.creator") {
strings.Contains(expr, "$appeal.creator") ||
strings.Contains(expr, "$appeal.role") ||
strings.Contains(expr, "$appeal.permissions") ||
strings.Contains(expr, "$appeal.details") ||
strings.Contains(expr, "$appeal.labels") {
return nil
}

Expand Down

0 comments on commit fce526c

Please sign in to comment.