Skip to content

rego_parse_error when using "every" keyword. #546

Closed Answered by srenatus
robhafner asked this question in OPA and Rego
Discussion options

You must be logged in to vote

Your playground example read

deny if {
	every group in claims.authorities
	group != "ProhibitedGroup"
}

Try adding { ... }:

deny if {
	every group in claims.authorities {
		group != "ProhibitedGroup"
	}
}

every only applies to the expressing within its { ... } block. That is because it's not ever valid to do something like this:

# invalid
deny contains group if {
	every group in claims.authorities
	group != "ProhibitedGroup"
}

Since every is true when the domain (claims.authorities) is empty, we wouldn't have any group to use, although the expression is true.

Note that you can drop the outermost { .. }, and go with this here:

deny if every group in claims.authorities {
	group != "Prohibit…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@robhafner
Comment options

Answer selected by robhafner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants