Skip to content

Commit

Permalink
Test for http2 headers.
Browse files Browse the repository at this point in the history
Signed-off-by: Pushpalanka Jayawardhana <[email protected]>
  • Loading branch information
Pushpalanka committed Nov 25, 2024
1 parent 3d2bfe9 commit 2ce01cb
Showing 1 changed file with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,10 @@ func TestAuthorizeRequestFilterOnRequestURL(t *testing.T) {
removeHeaders: make(http.Header),
},
{
msg: "Allow Requests with an empty query string and fragment",
msg: "Allow Requests with fragment",
filterName: "opaAuthorizeRequest",
bundleName: "somebundle.tar.gz",
regoQuery: "envoy/authz/allow_with_path_having_fragment_empty_query",
regoQuery: "envoy/authz/allow_with_path_having_fragment",
requestPath: "/path-with-empty-query#fragment?",
requestMethod: "GET",
contextExtensions: "",
Expand Down Expand Up @@ -481,8 +481,8 @@ func TestAuthorizeRequestFilterOnRequestURL(t *testing.T) {
input.parsed_query == {}
}
allow_with_path_having_fragment_empty_query {
input.attributes.request.http.headers.[":path"] == "/path-with-empty-query#fragment"
allow_with_path_having_fragment {
input.parsed_path == "/path-with-empty-query#fragment"
}
allow {
Expand Down Expand Up @@ -610,6 +610,23 @@ func TestAuthorizeRequestFilterOnHeaders(t *testing.T) {
backendHeaders: make(http.Header),
removeHeaders: make(http.Header),
},
{
msg: "Handle HTTP2 headers",
filterName: "opaAuthorizeRequest",
bundleName: "somebundle.tar.gz",
regoQuery: "envoy/authz/allow_http2_headers",
requestPath: "/allow-http2",
requestMethod: "GET",
requestHeaders: http.Header{
":path": []string{"/some-path"},
":authority": []string{"example-app"}},
contextExtensions: "",
expectedStatus: http.StatusInternalServerError,
expectedBody: "",
expectedHeaders: make(http.Header),
backendHeaders: make(http.Header),
removeHeaders: make(http.Header),
},
{
msg: "Wrong Header Data Type",
filterName: "opaAuthorizeRequest",
Expand Down Expand Up @@ -669,12 +686,6 @@ func TestAuthorizeRequestFilterOnHeaders(t *testing.T) {
allow_object_invalid_headers := {
"allowed": true,
"headers": "bogus string instead of object"
}
default allow_body = false
allow_body {
input.parsed_body.target_id == "123456"
}
decision_id := input.attributes.metadataContext.filterMetadata.open_policy_agent.decision_id
Expand Down

0 comments on commit 2ce01cb

Please sign in to comment.