-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Policy API: Enable admins to perform unsafe mutations on data in their platform #115
Comments
Suggesting we add the following rpc's, which are also dangerous if a deactivation was intentional and restoration could give new access where it had previously been blocked (see discussion in 108)
They will intentionally not bubble up or cascade down to avoid unintended consequences. In other words, restoring a deactivated namespace will not restore any of its deactivated child attributes, and restoring an attribute will not restore any of its deactivated values. |
Along with those:
Any of these should be prevented and/or removed if currently implemented and reserved for specific calls by the unsafe service:
|
For future discussionScenario: Questions:
The goal is to prevent data loss and prevent a blocking experience via user error, but these flows probably need to be considered. |
…efinitions, attribute values #96 #108 (#191) This work encompasses the following (including multiple breaking changes): 1. Tables `namespaces`, `attribute_definitions`, `attribute_values` updated via migration to add `active` boolean state 2. cascading deactivation from namespace -> attr -> values (in DB implementation via SQL trigger function provided in migration up/down) 3. integration tests: - cascading behavior ns -> attr -> val - integration tests proving no deactivation bubbling up behavior val -> attr -> ns 4. protos: - updated to provide a state enum back on all 3 resources (with helpful comments about defaults) - new example grpcurl requests/responses with these updates - all three LIST rpc's filterable by state as a common Message type (including an ANY enum option that returns both active TRUE and FALSE rows) and defaulting to ACTIVE if not specified 5. preservation of DB delete functionality/tests which will be exposed in newly separate rpc's This PR does _not_ include: 1. Unsafe RPCs for actual deletion: #115 2. Unsafe RPCs for dangerous mutations (same issue) 3. Prevention of update mutation of INACTIVE namespaces/attributes/attributeValues 4. Prevention of creation of new attributes/values on a prior created then deactivated namespace 5. Provision of parent or child state in GET responses beyond that of the resource requested (i.e. namespace & value state are not given in a GET for an attribute, even though the attribute's state is given) --------- Co-authored-by: Ryan Schumacher <jschumacher@virtru.com>
With this work, we will need to see how to remain DRY in our DB funcs. The unsafe properties were removed in the update funcs for the time being. |
Unsafe updates should also include:
|
Moved back to |
…efinitions, attribute values #96 #108 (#191) This work encompasses the following (including multiple breaking changes): 1. Tables `namespaces`, `attribute_definitions`, `attribute_values` updated via migration to add `active` boolean state 2. cascading deactivation from namespace -> attr -> values (in DB implementation via SQL trigger function provided in migration up/down) 3. integration tests: - cascading behavior ns -> attr -> val - integration tests proving no deactivation bubbling up behavior val -> attr -> ns 4. protos: - updated to provide a state enum back on all 3 resources (with helpful comments about defaults) - new example grpcurl requests/responses with these updates - all three LIST rpc's filterable by state as a common Message type (including an ANY enum option that returns both active TRUE and FALSE rows) and defaulting to ACTIVE if not specified 5. preservation of DB delete functionality/tests which will be exposed in newly separate rpc's This PR does _not_ include: 1. Unsafe RPCs for actual deletion: opentdf/platform#115 2. Unsafe RPCs for dangerous mutations (same issue) 3. Prevention of update mutation of INACTIVE namespaces/attributes/attributeValues 4. Prevention of creation of new attributes/values on a prior created then deactivated namespace 5. Provision of parent or child state in GET responses beyond that of the resource requested (i.e. namespace & value state are not given in a GET for an attribute, even though the attribute's state is given) --------- Co-authored-by: Ryan Schumacher <jschumacher@virtru.com>
…efinitions, attribute values #96 #108 (#191) This work encompasses the following (including multiple breaking changes): 1. Tables `namespaces`, `attribute_definitions`, `attribute_values` updated via migration to add `active` boolean state 2. cascading deactivation from namespace -> attr -> values (in DB implementation via SQL trigger function provided in migration up/down) 3. integration tests: - cascading behavior ns -> attr -> val - integration tests proving no deactivation bubbling up behavior val -> attr -> ns 4. protos: - updated to provide a state enum back on all 3 resources (with helpful comments about defaults) - new example grpcurl requests/responses with these updates - all three LIST rpc's filterable by state as a common Message type (including an ANY enum option that returns both active TRUE and FALSE rows) and defaulting to ACTIVE if not specified 5. preservation of DB delete functionality/tests which will be exposed in newly separate rpc's This PR does _not_ include: 1. Unsafe RPCs for actual deletion: opentdf/platform#115 2. Unsafe RPCs for dangerous mutations (same issue) 3. Prevention of update mutation of INACTIVE namespaces/attributes/attributeValues 4. Prevention of creation of new attributes/values on a prior created then deactivated namespace 5. Provision of parent or child state in GET responses beyond that of the resource requested (i.e. namespace & value state are not given in a GET for an attribute, even though the attribute's state is given) --------- Co-authored-by: Ryan Schumacher <jschumacher@virtru.com>
Namespaces
Definitions
Values
|
Out of scope: audit events for unsafe policy events, which will be handled in a separate issue to follow. |
3rd PR for #115 - [x] reactivate (no cascade down) - [x] update definition name (and upsert fqn) - [x] upsert name fqn changes from namespaces down and from attribute definition down to values - [X] update rule (changes access) - [x] reorder of values (changes hierarchy) - [x] delete (cascading)
PR Number 4 related to #115
…on (#1067) 5th PR for #115 Makes all RPC names on the unsafe services also start with Update to drive the casbin action definition matching logic: [main/service/internal/auth/authn.go#L289-L290](https://github.com/opentdf/platform/blob/main/service/internal/auth/authn.go?rgh-link-date=2024-07-02T00%3A18%3A56Z#L289-L290) Splitting out from #1066 due to the need to publish `/protocol/go` module dependency for consumption upstream in `service` and `sdk` modules. --------- Co-authored-by: David Mihalcik <dmihalcik@virtru.com>
Relates to #115 Closes #115 Drives authorization with existing casbin action definition matching logic: https://github.com/opentdf/platform/blob/main/service/internal/auth/authn.go#L289-L290 Middleware casbin tests (with local `test-admin` client given the `admin` role for validation): ```shell time=2024-07-01T17:16:31.618-07:00 level=INFO msg="enforcing policy" subject=role:admin resource=policy.unsafe.UnsafeService/UnsafeUpdateNamespace action=unsafe time=2024-07-01T17:16:31.618-07:00 level=WARN msg="permission denied" azp=b007dc27-e9a5-493b-8d2d-b26a92a6752c error="permission denied" ``` ```shell time=2024-07-01T17:18:08.028-07:00 level=INFO msg="enforcing policy" subject=role:standard resource=policy.unsafe.UnsafeService/UnsafeUpdateNamespace action=unsafe time=2024-07-01T17:18:08.028-07:00 level=WARN msg="permission denied" azp=d8949062-977b-498a-a640-61865d633121 error="permission denied" ``` ```shell time=2024-07-01T17:18:30.518-07:00 level=INFO msg="enforcing policy" subject=role:org-admin resource=policy.unsafe.UnsafeService/UnsafeUpdateNamespace action=unsafe time=2024-07-01T17:18:30.519-07:00 level=DEBUG msg=sql sql="SELECT opentdf_policy.attribute_namespaces.id, opentdf_policy.attribute_namespaces.name, opentdf_policy.attribute_namespaces.active, JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', metadata->'labels', 'created_at', created_at, 'updated_at', updated_at)) AS metadata, opentdf_policy.attribute_fqns.fqn FROM opentdf_policy ..... ```
Relates to #115 Closes #115 Drives authorization with existing casbin action definition matching logic: https://github.com/opentdf/platform/blob/main/service/internal/auth/authn.go#L289-L290 Middleware casbin tests (with local `test-admin` client given the `admin` role for validation): ```shell time=2024-07-01T17:16:31.618-07:00 level=INFO msg="enforcing policy" subject=role:admin resource=policy.unsafe.UnsafeService/UnsafeUpdateNamespace action=unsafe time=2024-07-01T17:16:31.618-07:00 level=WARN msg="permission denied" azp=b007dc27-e9a5-493b-8d2d-b26a92a6752c error="permission denied" ``` ```shell time=2024-07-01T17:18:08.028-07:00 level=INFO msg="enforcing policy" subject=role:standard resource=policy.unsafe.UnsafeService/UnsafeUpdateNamespace action=unsafe time=2024-07-01T17:18:08.028-07:00 level=WARN msg="permission denied" azp=d8949062-977b-498a-a640-61865d633121 error="permission denied" ``` ```shell time=2024-07-01T17:18:30.518-07:00 level=INFO msg="enforcing policy" subject=role:org-admin resource=policy.unsafe.UnsafeService/UnsafeUpdateNamespace action=unsafe time=2024-07-01T17:18:30.519-07:00 level=DEBUG msg=sql sql="SELECT opentdf_policy.attribute_namespaces.id, opentdf_policy.attribute_namespaces.name, opentdf_policy.attribute_namespaces.active, JSON_STRIP_NULLS(JSON_BUILD_OBJECT('labels', metadata->'labels', 'created_at', created_at, 'updated_at', updated_at)) AS metadata, opentdf_policy.attribute_fqns.fqn FROM opentdf_policy ..... ```
Implement the unsafe mutation RPCs so that admins can have an audit trail when they need to make unsafe changes to their platform
Depends on
Acceptance Criteria
UnsafeService.UnsafeUpdateAttributeName()
UnsafeService.UnsafeDeleteAttribute()
The text was updated successfully, but these errors were encountered: