From d46bd45e03c9fe6ce67bd48ccb9c74c1c910c3d5 Mon Sep 17 00:00:00 2001
From: Keshav Prasad <keshavprasadms@gmail.com>
Date: Mon, 16 May 2022 14:05:48 +0530
Subject: [PATCH] fix: SB-29941 allow GET methods on public key retrieval API
 (#3334)

---
 kubernetes/opa/registry/policies.rego      |  2 +-
 kubernetes/opa/registry/policies_test.rego | 17 +++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/kubernetes/opa/registry/policies.rego b/kubernetes/opa/registry/policies.rego
index 00beec49d..1a3a96267 100644
--- a/kubernetes/opa/registry/policies.rego
+++ b/kubernetes/opa/registry/policies.rego
@@ -54,5 +54,5 @@ searchRCCertificate {
 
 # Retrieve public key API
 getRCPublicKey {
-  http_request.method == "POST"
+  http_request.method in ["POST", "GET"]
 }
\ No newline at end of file
diff --git a/kubernetes/opa/registry/policies_test.rego b/kubernetes/opa/registry/policies_test.rego
index f8d88d5e6..01bd3c7a3 100644
--- a/kubernetes/opa/registry/policies_test.rego
+++ b/kubernetes/opa/registry/policies_test.rego
@@ -218,4 +218,21 @@ test_rc_certificate_search_public_key {
         "filter": {}
       }
     }
+}
+
+test_rc_certificate_get_public_key {
+    data.main.allow.allowed
+    with data.common.current_time as current_time
+    with data.common.iss as iss
+    with input as
+    {
+      "attributes": {
+        "request": {
+          "http": {
+            "path": "/api/v1/PublicKey/search/1-ab8bb63e-d4f2-11ec-9a7d-07cc64ac49c1",
+            "method": "GET"
+          }
+        }
+      }
+    }
 }
\ No newline at end of file
-- 
GitLab