diff --git a/privacy-profile-composer/pkg/envoyfilter/inbound_filter.go b/privacy-profile-composer/pkg/envoyfilter/inbound_filter.go index 02e394f4..3a982672 100644 --- a/privacy-profile-composer/pkg/envoyfilter/inbound_filter.go +++ b/privacy-profile-composer/pkg/envoyfilter/inbound_filter.go @@ -12,7 +12,6 @@ import ( "net/url" "github.com/envoyproxy/envoy/contrib/golang/common/go/api" - "github.com/open-policy-agent/opa/sdk" "github.com/openzipkin/zipkin-go" "github.com/openzipkin/zipkin-go/model" "google.golang.org/grpc" @@ -59,54 +58,6 @@ func (f *inboundFilter) DecodeHeaders(header api.RequestHeaderMap, endStream boo common.LogDecodeHeaderData(header) - ctx := context.Background() - // Replace url with http://prose-server.prose-system.svc.cluster.local:8080 - // Remove the leading /bundles/ in the resource // bundles.default.resource=bundle.tar.gz - opa_config := []byte(`{ - "services": { - "bundles": { - "url": "http://prose-server.prose-system.svc.cluster.local:8080" - } - }, - "bundles": { - "default": { - "resource": "/bundles/bundle.tar.gz", - "polling": { - "min_delay_seconds": 120, - "max_delay_seconds": 3600, - } - } - }, - "decision_logs": { - "console": true - } - }`) - - log.Printf("about to instantiate a new opaObj sdk object\n") - // create an instance of the OPA object - opaObj, err := sdk.New(ctx, sdk.Options{ - ID: "opaObj-test-1", - Config: bytes.NewReader(opa_config), - }) - log.Printf("got a response from sdk.New\n") - - if err != nil { - log.Printf("could not initialize an OPA object --- this means that the data plane cannot evaluate the target privacy policy ----- %s\n", err) - return api.Continue - } - - defer opaObj.Stop(ctx) - log.Printf("initialized an OPA object\n") - - // get the named policy decision for the specified input - if result, err := opaObj.Decision(ctx, sdk.DecisionOptions{Path: "/authz/allow", Input: map[string]interface{}{"hello": "world"}}); err != nil { - log.Printf("had an error evaluating the policy: %s\n", err) - } else if decision, ok := result.Result.(bool); !ok || !decision { - log.Printf("result: descision: %v, ok: %v\n", decision, ok) - } else { - log.Printf("policy accepted the input data \n") - } - return api.Continue }