Skip to content

Commit

Permalink
Add QS Validation on Submit Share (#873)
Browse files Browse the repository at this point in the history
### Feature or Bugfix
<!-- please choose -->
- Bugfix

### Detail
- Add QS Validation on the requestor's environment in a share and ensure
Quicksight account is set up if tables are being shared before
submitting a new share request

### Relates
- [Issue #801](#801)


### 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.
  • Loading branch information
noah-paige committed Nov 20, 2023
1 parent a9bc139 commit 4e75085
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from dataall.core.permissions.permission_checker import has_resource_permission
from dataall.core.tasks.db.task_models import Task
from dataall.base.db import utils
from dataall.base.aws.quicksight import QuicksightClient
from dataall.base.db.exceptions import UnauthorizedOperation
from dataall.modules.dataset_sharing.db.enums import ShareObjectActions, ShareableType, ShareItemStatus, \
ShareObjectStatus, PrincipalType
Expand Down Expand Up @@ -179,6 +180,13 @@ def submit_share_object(cls, uri: str):
message='The request is empty of pending items. Add items to share request.',
)

env = EnvironmentService.get_environment_by_uri(session, share.environmentUri)
dashboard_enabled = EnvironmentService.get_boolean_env_param(session, env, "dashboardsEnabled")
if dashboard_enabled:
share_table_items = ShareObjectRepository.find_all_share_items(session, uri, ShareableType.Table.value)
if share_table_items:
QuicksightClient.check_quicksight_enterprise_subscription(AwsAccountId=env.AwsAccountId)

cls._run_transitions(session, share, states, ShareObjectActions.Submit)

ShareNotificationService(
Expand Down

0 comments on commit 4e75085

Please sign in to comment.