-
Notifications
You must be signed in to change notification settings - Fork 82
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
Metadata form 7: Access control and deletion behaviour #1540
Metadata form 7: Access control and deletion behaviour #1540
Conversation
…and their children are deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did initial review before testing functionality - requesting some changes
backend/dataall/core/permissions/services/resource_policy_service.py
Outdated
Show resolved
Hide resolved
backend/dataall/core/organizations/services/organization_service.py
Outdated
Show resolved
Hide resolved
backend/dataall/core/environment/services/environment_service.py
Outdated
Show resolved
Hide resolved
backend/dataall/modules/metadata_forms/services/metadata_form_service.py
Outdated
Show resolved
Hide resolved
backend/dataall/modules/redshift_datasets/services/redshift_dataset_service.py
Outdated
Show resolved
Hide resolved
backend/dataall/modules/metadata_forms/services/attached_metadata_form_service.py
Outdated
Show resolved
Hide resolved
backend/dataall/modules/metadata_forms/services/attached_metadata_form_service.py
Outdated
Show resolved
Hide resolved
backend/dataall/modules/metadata_forms/services/metadata_form_permissions.py
Outdated
Show resolved
Hide resolved
backend/migrations/versions/427db8f31999_backfill_MF_resource_permissions.py
Outdated
Show resolved
Hide resolved
backend/dataall/modules/metadata_forms/services/metadata_form_service.py
Outdated
Show resolved
Hide resolved
backend/dataall/modules/metadata_forms/db/metadata_form_repository.py
Outdated
Show resolved
Hide resolved
With the new way of handling deletes of metadata forms with deletes of resources a couple things come to mind:
What if we had a generic EventSystem class (in core or base?):
And then each MF Form resource could publish on delete:
And then MetadataFromService and AttachedMetadataFormService could import event system and subscribe:
And lastly
Not sure if this pub/sub approach is best but this way we can have multiple publishers and multiple subscribers (similar to EnvironmentResourceManager but not dedicated to just Environments and more flexible) Just thinking out loud here - not sure if this is the right approach for the ask |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments - after some minor fixes testing and functionality look good
Left a big comment on design of the delete triggers but on second thought it may not be worth the effort to implement it the way I propose unless we really see a need for future work on MF forms or elsewhere
Triggers seem easy enough to create / delete so easily reversible too if needed
backend/dataall/modules/metadata_forms/db/metadata_form_repository.py
Outdated
Show resolved
Hide resolved
backend/migrations/versions/427db8f31999_backfill_MF_resource_permissions.py
Outdated
Show resolved
Hide resolved
backend/dataall/modules/metadata_forms/services/attached_metadata_form_service.py
Outdated
Show resolved
Hide resolved
Finally, regarding @noah-paige pub/sub model vs current db triggers; db triggers are good enough for MF now. We should revisit the decision:
|
@noah-paige @dlpzx |
One additional bug found during testing (thanks to @rbernotas) - when a user a part of the admin group tries to view a Metadata Tab for a resource, for instance a data.all Organization, the use receives an error
in |
backend/dataall/modules/metadata_forms/db/metadata_form_repository.py
Outdated
Show resolved
Hide resolved
backend/migrations/versions/427db8f31999_backfill_MF_resource_permissions.py
Outdated
Show resolved
Hide resolved
Thanks for the latest changes @SofiaSazonova. 3 pending items I am seeing that I think need to be resolved for this PR:
++ 1 Afterwards I can re-test and think should be good for this PR Additionally - there are some additional enhancements or fixes that we may want to pick up for MF Forms. I will add to the open issue #1553 |
|
@SofiaSazonova - latest testing
|
@noah-paige I hope, this is the last one and I haven't missed smth now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these changes look good - tested the migration script upgrade/downgrade and UI functionality on AWS Deployment
thanks @SofiaSazonova
…1601) ### Feature or Bugfix - Bugfix ### Detail In `backend/migrations/versions/075d344ae2cc_mf_triggers.py` the database routines do not specify the database schema. As a result, when the routines are executed they fail to find the table. In this PR we read the schema name that matches the environment variable ENVNAME when defining the database triggers. ### Relates - #1540 ### Security Please answer the questions below briefly where applicable, or write `N/A`. Based on [OWASP 10](https://owasp.org/Top10/en/). - Does this PR introduce or modify any input fields or queries - this includes fetching data from storage outside the application (e.g. a database, an S3 bucket)? - Is the input sanitized? - What precautions are you taking before deserializing the data you consume? - Is injection prevented by parametrizing queries? - Have you ensured no `eval` or similar functions are used? - Does this PR introduce any functionality or component that requires authorization? - How have you ensured it respects the existing AuthN/AuthZ mechanisms? - Are you logging failed auth attempts? - Are you using or adding any cryptographic features? - Do you use a standard proven implementations? - Are the used keys controlled by the customer? Where are they stored? - Are you introducing any new policies/roles/users? - Have you used the least-privilege principle? How? By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Feature or Bugfix
Detail
Relates
Security
Please answer the questions below briefly where applicable, or write
N/A
. Based onOWASP 10.
fetching data from storage outside the application (e.g. a database, an S3 bucket)?
eval
or similar functions are used?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.