Skip to content

Commit

Permalink
Merge pull request #108 from Cray-HPE/CASMCMS-8971-1.6
Browse files Browse the repository at this point in the history
CASMCMS-8971: Multi-Tenancy OPA policy: Allow tenant admins to list their BOSv2 sessions
  • Loading branch information
mharding-hpe authored Apr 24, 2024
2 parents aa80eea + e5a6021 commit 377723b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion kubernetes/cray-opa/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#
apiVersion: v2
name: cray-opa
version: 1.34.1
version: 1.34.2
description: Cray Open Policy Agent
keywords:
- opa
Expand Down
3 changes: 2 additions & 1 deletion kubernetes/cray-opa/templates/policies/keycloak-admin.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- /*
Copyright 2021-2023 Hewlett Packard Enterprise Development LP
Copyright 2021-2024 Hewlett Packard Enterprise Development LP
*/ -}}
{{- range $name, $options := .Values.ingresses }}
{{- if $options.policies.keycloak.admin }}
Expand Down Expand Up @@ -167,6 +167,7 @@ data:
{"method": "GET", "path": `^/apis/bos/v2/components$`}, # GET allows a listing of all active components states
{"method": "GET", "path": `^/apis/bos/v2/components/.*$`}, # GET information on an individual component
{"method": "GET", "path": `^/apis/bos/v2/healthz$`}, # Allow tenant admins to know the overall health of the deployment
{"method": "GET", "path": `^/apis/bos/v2/sessions$`}, # GET BOSv2 Sessions (list all)
{"method": "POST", "path": `^/apis/bos/v2/sessions$`}, # POST Creates a new BOSv2 Session
{"method": "GET", "path": `^/apis/bos/v2/sessions/.*$`}, # GET allows monitoring status of individual sessions
{"method": "GET", "path": `^/apis/bos/v2/sessions/.*?/status$`}, # Obtain more detailed status information for an individual session
Expand Down
3 changes: 2 additions & 1 deletion kubernetes/cray-opa/tests/opa/keycloak-admin_test.rego.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021-2023 Hewlett Packard Enterprise Development LP
# Copyright 2021-2024 Hewlett Packard Enterprise Development LP

package istio.authz
## HOW TO DO UNIT TESTING
Expand Down Expand Up @@ -188,6 +188,7 @@ test_tenant_admin {
not allow.http_status with input as {"attributes": {"request": {"http": {"method": "GET", "path": "/apis/bos/v2/components", "headers": {"authorization": "Bearer {{ .tenantAdminToken }}", "cray-tenant-name": "vcluster-blue"}}}}}
not allow.http_status with input as {"attributes": {"request": {"http": {"method": "GET", "path": "/apis/bos/v2/components/foo", "headers": {"authorization": "Bearer {{ .tenantAdminToken }}", "cray-tenant-name": "vcluster-blue"}}}}}
not allow.http_status with input as {"attributes": {"request": {"http": {"method": "GET", "path": "/apis/bos/v2/healthz", "headers": {"authorization": "Bearer {{ .tenantAdminToken }}", "cray-tenant-name": "vcluster-blue"}}}}}
not allow.http_status with input as {"attributes": {"request": {"http": {"method": "GET", "path": "/apis/bos/v2/sessions", "headers": {"authorization": "Bearer {{ .tenantAdminToken }}", "cray-tenant-name": "vcluster-blue"}}}}}
not allow.http_status with input as {"attributes": {"request": {"http": {"method": "POST", "path": "/apis/bos/v2/sessions", "headers": {"authorization": "Bearer {{ .tenantAdminToken }}", "cray-tenant-name": "vcluster-blue"}}}}}
not allow.http_status with input as {"attributes": {"request": {"http": {"method": "GET", "path": "/apis/bos/v2/sessions/foo", "headers": {"authorization": "Bearer {{ .tenantAdminToken }}", "cray-tenant-name": "vcluster-blue"}}}}}
not allow.http_status with input as {"attributes": {"request": {"http": {"method": "GET", "path": "/apis/bos/v2/sessions/foo/status", "headers": {"authorization": "Bearer {{ .tenantAdminToken }}", "cray-tenant-name": "vcluster-blue"}}}}}
Expand Down

0 comments on commit 377723b

Please sign in to comment.