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

Integration tests executed on a real deployment as part of the CICD - Shares #1376

Open
dlpzx opened this issue Jul 1, 2024 · 6 comments
Open

Comments

@dlpzx
Copy link
Contributor

dlpzx commented Jul 1, 2024

Same as for #1220.

This issue is to track the progress for the Shares modules.
It has its own dedicated issue because of the challenge of validating the shares

@dlpzx
Copy link
Contributor Author

dlpzx commented Jul 1, 2024

Required tests for basic coverage

For fresh deployments

For each of the following API calls we need to test authorized and unauthorized scenarios as well as all possible configurations (e.g. autoapproval...)

  • Add items to request
  • Reject request
  • Approve request*
    • Folder sharing validation
    • Bucket sharing validation
    • Table sharing validation
  • Create Share request
  • Revoke items*
    • Folder sharing validation
    • Bucket sharing validation
    • Table sharing validation
  • Delete share
    *if times allows implement team roles as well as consumption roles. If it is not possible implement consumption roles and leave team roles as next steps

For backwards compatibility

For updated Dataset stacks with existing shares validate:

  • Folder sharing validation
  • Bucket sharing validation
  • Table sharing validation

Full coverage [WIP]

For fresh deployments

  • Edit share request purpose
  • Email notifications
  • Auto-approval datasets

For backwards compatibility

For updated Dataset stacks:

  • Approve request
    • Folder sharing validation
    • Bucket sharing validation
    • Table sharing validation
  • Revoke items
    • Folder sharing validation
    • Bucket sharing validation
    • Table sharing validation

@SofiaSazonova
Copy link
Contributor

SofiaSazonova commented Sep 23, 2024

Current progress
Happy path
shares

@SofiaSazonova
Copy link
Contributor

SofiaSazonova commented Sep 23, 2024

Happy path tests:

New Shares:

  • Create Share request
  • Submit request without Items (not allowed)
  • Add items to request
  • Submit request without autoapproval (status -- Submitted)
  • Change request purpose
  • Submit request with autoapproval (status -- Approved)
  • Reject request
  • Change reject purpose
  • Approve request
  • Request succeeded
  • Item health verification
  • Folder sharing validation (cal list objects via s3 accesspoint , for same account check write|modify)
  • Bucket sharing validation (cal list objects in s3 bucket , for same account check write|modify)
  • Table sharing validation (cal perform athena query: select * from db.table , for same account check write|modify)
  • Revoke items
  • Folder sharing validation (no more access)
  • Bucket sharing validation (no more access)
  • Table sharing validation (no more access)
  • Delete share
  • Check, that resources, involved in shares, can not be deleted from data.all, while share is active.

Persistent Shares:

  • Update persistent envs and datasets used for shares (made in fixtures)
  • Share verification test
  • Check item access test
  • Revoke share test
  • Check no access left
  • Add all items back to share
  • Share approved/processed successfully
  • Share verification test
  • Check item access test (no more access)

@SofiaSazonova
Copy link
Contributor

SofiaSazonova commented Sep 23, 2024

Share 'breaks' tests:

  1. S3 bucket policy is manually changed
    1.a. Permissions are insufficient
    1.b. More permissions are granted
  2. IAM role policy is manually changed
    1.a. Permissions are insufficient
    1.b. More permissions are granted
  • Share verification job finished
  • Items are Unhealthy, the Reason is relevant
  • Share reapplied successfully
  • Access to folders/bucket/tables is restored
  • For same account shares: separate checks for Read/Write/Modify

@SofiaSazonova
Copy link
Contributor

SofiaSazonova commented Sep 23, 2024

Resource are missing test:

  1. Share principal IAM role is deleted
  2. S3 bucket/ AccessPoint/Folder/Table/DB is deleted
  • Share verification job finished
  • Items are Unhealthy, the Reason is relevant
  • Unhealthy Items can be revoked
  • Share can be deleted

@SofiaSazonova
Copy link
Contributor

User Managed policy test:
Share principal - consumption role without data.all managed policies

  • Share can not be created, if required policies are not attached and the flag "attach missing policies" is False
  • Share can be created, when the policies are attached
  • Share is created and policies are attached, when required policies are not attached and the flag "attach missing policies" is True

SofiaSazonova added a commit that referenced this issue Sep 25, 2024
### Feature or Bugfix
- Tests

### Detail
- module `share_base`
- bugfix `delete_env` requires `env_object` not `envUri`
- TEMPORARY: hardcoded dataset_uri --> I wait for dataset module

### Relates
- #1376 

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

---------

Co-authored-by: dlpzx <[email protected]>
Co-authored-by: Noah Paige <[email protected]>
Co-authored-by: Sofia Sazonova <[email protected]>
@github-project-automation github-project-automation bot moved this to Nominated in v2.7.0 Sep 25, 2024
@SofiaSazonova SofiaSazonova moved this from Nominated to Backlog in v2.7.0 Sep 25, 2024
SofiaSazonova added a commit that referenced this issue Oct 2, 2024
### Feature or Bugfix
- Feature


### Detail
- test for persistent shares
- common test functions are places in separate file
- updated envs/dataset fixtures

### Relates
- #1376

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

---------

Co-authored-by: dlpzx <[email protected]>
Co-authored-by: Noah Paige <[email protected]>
Co-authored-by: Sofia Sazonova <[email protected]>
petrkalos added a commit that referenced this issue Oct 30, 2024
### Feature or Bugfix
- Feature

### Detail

New tests
* deliberately break shares (by removing permissions
* run the verifier to assert that are unhealthy
* run the reapplier to assert that they can be fixed

Imrpovements
* Drop updated_persistent env and always update the persitent_env on
get_or_create_env()
* Use contextmanagers to create environments and handle their lifecycle
in one place
* Make redshift tests optional based on configuration

### Relates
Solves parts of #1376 

### 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.
dlpzx pushed a commit that referenced this issue Dec 23, 2024
### Feature or Bugfix
<!-- please choose -->
- Feature

### Detail
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

### Relates
- #1376 

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

---------

Co-authored-by: Sofia Sazonova <[email protected]>
dlpzx pushed a commit that referenced this issue 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
Projects
Status: In progress
Development

No branches or pull requests

3 participants