Skip to content

Commit

Permalink
docs: update output document of Envoy plugin.
Browse files Browse the repository at this point in the history
A new attribute `query_parameters_to_remove` has been added.

Ref open-policy-agent/opa-envoy-plugin#621

Signed-off-by: Anthony Regeda <regedaster@gmail.com>
  • Loading branch information
regeda authored and anderseknert committed Jan 3, 2025
1 parent 444dbcf commit 5e4594a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/content/envoy-primer.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ When Envoy receives a policy decision, it expects a JSON object with the followi
* `http_status` (optional): a number representing the HTTP status code
* `body` (optional): the response body
* `dynamic_metadata` (optional): an object representing dynamic metadata to be consumed by the next Envoy filter.
* `query_parameters_to_remove` (optional): is an array containing the names of string query parameters to be removed.

To construct that output object using the policies demonstrated in the last section, you can use the following Rego snippet. Notice that we are using partial object rules so that any variables with undefined values simply have no key in the `result` object.

Expand All @@ -218,6 +219,7 @@ result["request_headers_to_remove"] := request_headers_to_remove
result["body"] := body
result["http_status"] := status_code
result["dynamic_metadata"] := dynamic_metadata
result["query_parameters_to_remove"] := query_parameters_to_remove
```

For a single user, including this snippet in your normal policy is fine, but when you have multiple teams writing policies, you will typically pull this bit of boilerplate into a wrapper package, so your teams can focus on writing the policies shown in the previous sections.
Expand Down

0 comments on commit 5e4594a

Please sign in to comment.