Skip to content
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

CICD Integration tests: new shares for pre-existing datasets #1611

Merged
merged 11 commits into from
Dec 23, 2024

Conversation

SofiaSazonova
Copy link
Contributor

@SofiaSazonova SofiaSazonova commented Oct 4, 2024

Feature or Bugfix

  • Feature

Detail

For group share and consumption role shares perform

  • Create Share request
  • Submit request without Items (not allowed)
  • Add items to request
  • Submit request
  • Change request purpose
  • Reject request
  • Change reject purpose
  • Approve request
  • Request succeeded
  • Item health verification
  • Folder sharing validation (cal list objects via s3 accesspoint)
  • Bucket sharing validation (cal list objects in s3 bucket )
  • Table sharing validation (cal perform athena query: select * from db.table )
  • Revoke items
  • Folder sharing validation (no more access)
  • Bucket sharing validation (no more access)
  • Table sharing validation (no more access)
  • Delete share

Tests are the same as for new shares for new datasets
Fixtures are parametrised

Relates

Security

Please answer the questions below briefly where applicable, or write N/A. Based on
OWASP 10.

  • 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.

@SofiaSazonova SofiaSazonova marked this pull request as ready for review October 4, 2024 15:02
Comment on lines 204 to 206
if list_organizations(client6).count == 0:
invite_team_to_organization(client5, persistent_cross_acc_env_1.organization.organizationUri, group6)
if list_environments(client6).count == 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if org/env have non-zero count because of some other change (i.e a manual change or some other test changing it) group6 will end up not invited.
I think it would be better if you invite_to_org/invite_to_env and then catch the errors if any (i.e already part of the env/group)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added an explicit check by uri



@pytest.fixture(scope='session')
def session_consumption_role_2(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps create a contextmanager and reuse it for all consumption_roles?

tests_new/integration_tests/modules/share_base/conftest.py Outdated Show resolved Hide resolved
Copy link
Contributor

@petrkalos petrkalos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, let's wait a bit till we merge it

return group_workgroup
elif env_workgroup:
return env_workgroup
return default_workgroup
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If here we are returning the workgroup for groups (not for consumption roles) we should throw an error instead of returning the primary if no group_workgroup or env_workgroup is found

Copy link
Contributor

@dlpzx dlpzx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one minor comment

@@ -697,7 +697,7 @@ def create_integration_tests_role(self):
],
effect=iam.Effect.ALLOW,
resources=[
f'arn:aws:iam::{self.account}:role/dataall-test-*',
f'arn:aws:iam::{self.account}:role/dataall-test*',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was made, so the int test role could ListPolicies for role dataall-testgroup-*

@dlpzx dlpzx merged commit 59ce9ae into data-dot-all:main Dec 23, 2024
9 checks passed
dlpzx pushed a commit that referenced this pull request Dec 26, 2024
<!-- please choose -->
- Feature

For group share and consumption role shares perform

- [x] Create Share request
- [x] Submit request without Items (not allowed)
- [x] Add items to request
- [x] Submit request
- [x] Change request purpose
- [x] Reject request
- [x] Change reject purpose
- [x] Approve request
- [x] Request succeeded
- [x] Item health verification
- [x] Folder sharing validation (cal list objects via s3 accesspoint)
- [x] Bucket sharing validation (cal list objects in s3 bucket )
- [x] Table sharing validation (cal perform athena query: select * from
db.table )
- [x] Revoke items
- [x] Folder sharing validation (no more access)
- [x] Bucket sharing validation (no more access)
- [x] Table sharing validation (no more access)
- [x] Delete share

Tests are the same as for new shares for new datasets
Fixtures are parametrised

- #1376

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.

---------

Co-authored-by: Sofia Sazonova <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants