Skip to content
Discussion options

You must be logged in to vote

Since the purpose of the default keyword is to provide a fallback in case of an undefined value, it would be pretty bad if also the fallback was allowed to be undefined. In your case, you could use an else condition, and a default value for the path to make sure something is always returned, even when no input is provided with the request.

package envoy.authz

import input.attributes.request.http as http_request

default request_path = ""
request_path = http_request.path

allow = response {
    input.attributes.request.http.method == "GET"
    response := {
        "allowed": true,
        "headers": {"x-ext-auth-allow": "yes"}
    }
} else = {
    "allowed": false,
    "headers": {"x-ext…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by anderseknert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants