From 30c0319e09656b529db751f33b58e6ee349fba12 Mon Sep 17 00:00:00 2001 From: windmgc Date: Tue, 9 Aug 2022 16:11:54 +0800 Subject: [PATCH 1/3] [FT-2788]fix opa documents undefined return --- app/_hub/kong-inc/opa/_index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/_hub/kong-inc/opa/_index.md b/app/_hub/kong-inc/opa/_index.md index 9d918d059d2e..4adc0e5edb02 100644 --- a/app/_hub/kong-inc/opa/_index.md +++ b/app/_hub/kong-inc/opa/_index.md @@ -95,7 +95,9 @@ Create an `example.rego` file with the following content: ```rego package example -default allow = false +default allowBoolean = false +default allowDetailed = false + allowBoolean { header_present From 7d58dc76f131ff2dceb4c8610465bf912da67c59 Mon Sep 17 00:00:00 2001 From: windmgc Date: Tue, 9 Aug 2022 20:46:02 +0800 Subject: [PATCH 2/3] add missing config params --- app/_hub/kong-inc/opa/_index.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/_hub/kong-inc/opa/_index.md b/app/_hub/kong-inc/opa/_index.md index 4adc0e5edb02..c745db05e092 100644 --- a/app/_hub/kong-inc/opa/_index.md +++ b/app/_hub/kong-inc/opa/_index.md @@ -79,6 +79,18 @@ params: default: false description: | If set to true, the Kong Gateway Consumer object in use for the current request (if any) is included as input to OPA. + - name: include_body_in_opa_input + required: false + datatype: boolean + default: false + description: | + If set to true, the plain request body in the current request is included as input to OPA. + - name: include_parsed_json_body_in_opa_input + required: false + datatype: boolean + default: false + description: | + If set to true and the `Content-Type` header of the current request is `application/json`, the request body will be json decoded and the decoded struct is included as input to OPA. --- ## Usage From 2c8ee988132a1b2bc26d1dbb165e65185d887113 Mon Sep 17 00:00:00 2001 From: angel Date: Tue, 9 Aug 2022 09:33:36 -0400 Subject: [PATCH 3/3] copy edit + vale --- app/_hub/kong-inc/opa/_index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/_hub/kong-inc/opa/_index.md b/app/_hub/kong-inc/opa/_index.md index c745db05e092..08553a866a8e 100644 --- a/app/_hub/kong-inc/opa/_index.md +++ b/app/_hub/kong-inc/opa/_index.md @@ -84,13 +84,13 @@ params: datatype: boolean default: false description: | - If set to true, the plain request body in the current request is included as input to OPA. + If set to true, the current requests' request body is included as input to OPA. - name: include_parsed_json_body_in_opa_input required: false datatype: boolean default: false description: | - If set to true and the `Content-Type` header of the current request is `application/json`, the request body will be json decoded and the decoded struct is included as input to OPA. + If set to true and the `Content-Type` header of the current request is `application/json`, the request body will be JSON decoded and the decoded struct is included as input to OPA. --- ## Usage @@ -154,7 +154,7 @@ curl -XPUT localhost:8181/v1/policies/example --data-binary @example.rego The above command uses OPA's default port 8181. It could be different for your setup. -### Set up Kong Gateway +### Set up {{site.base_gateway}} Set up a Route and Service in {{site.base_gateway}} and then enable the plugin: