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

Fix: ensure valid environments for share request and other objects creation #781

Merged
merged 7 commits into from
Oct 12, 2023

Conversation

dlpzx
Copy link
Contributor

@dlpzx dlpzx commented Oct 5, 2023

Feature or Bugfix

  • Feature
  • Bugfix

Detail

The different alternatives considered are discussed in #556

This PR introduces a new query listValidEnvironments that replaces the query listEnvironments for certain operations.
listEnvironments - lists all environments independently of their CloudFormation stack statys with a lot of additional details
listValidEnvironments - lists only "CloudFormation" stable and successful environments. Retrieves only basic info about the environment.

Operations such as opening a share request or creation a Dataset/Notebook/etc require the selection of an environment. The environment options are now retrieved from listValidEnvironments ensuring that only valid environments are selectable. Moreover, this query is more light and does not need to query and obtain as many fields as the original listEnvironments, improving the efficiency of the code.

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.

@dlpzx dlpzx changed the base branch from main to v2m1m0 October 10, 2023 08:08
@dlpzx dlpzx changed the base branch from v2m1m0 to main October 10, 2023 08:12
@dlpzx dlpzx changed the base branch from main to v2m1m0 October 10, 2023 08:13
@dlpzx dlpzx marked this pull request as ready for review October 10, 2023 08:15
@dlpzx
Copy link
Contributor Author

dlpzx commented Oct 10, 2023

Testing

Local testing:

  • ListEnvironments in environment view --> all environments appear
  • listEnvironment options in dataset create, import, notebook create, ML Studio create, pipeline create, pipeline edit, worksheetview, dashboard import --> valid environments appear, invalid environments don't
  • successful creation of dataset

image

AWS testing:

  • CICD pipeline suceeds
  • ListEnvironments in environment view --> all environments appear
  • listEnvironment options in dataset create, import, notebook create, ML Studio create, pipeline create, pipeline edit, worksheetview, dashboard import --> valid environments appear, invalid environments don't
  • successful creation of dataset

@dlpzx dlpzx marked this pull request as draft October 10, 2023 08:38
@dlpzx dlpzx marked this pull request as ready for review October 10, 2023 15:12
@dlpzx dlpzx requested a review from noah-paige October 10, 2023 15:13
@@ -0,0 +1,24 @@
import gql from 'graphql-tag';
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor Comment - could we change this import and for listEnvironment to be import { gql } from 'apollo-boost'; (similar to how we do for all other queries/mutations)

apollo-boost comes with graphql-tag package and want to keep imports consistent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Strangely listEnvironment query also imported gql from graphql-tag. I just changed both in my last commit. There are no more imports using graphql-tag

Copy link
Contributor

@noah-paige noah-paige left a comment

Choose a reason for hiding this comment

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

lgtm

@dlpzx dlpzx merged commit 7d9122d into v2m1m0 Oct 12, 2023
@dlpzx dlpzx mentioned this pull request Oct 30, 2023
dlpzx added a commit that referenced this pull request Nov 8, 2023
### Feature or Bugfix
- Feature
- Bugfix
- Refactoring

### Detail

#### Features
* Limit pivot role S3 permissions by @dlpzx in
#780
* Limit pivot role KMS permissions by @dlpzx in
#830
* Add configurable session timeout to IDP by @manjulaK in
#786
* Allow to submit a share when you are both an approver and a requester
by @zsaltys in #793
* Redirect upon creating a share request by @zsaltys in
#799
* Handle Pre-filtering of tables by @anushka-singh in
#811
* Email Notification on Share Workflow - Issue - 734 by @TejasRGitHub in
#818
* Refactor notifications from core to modules by @dlpzx in
#822
* Add frontend and backend feature flags by @zsaltys in
#817
* Make hosted_zone_id optional by @lorchda in
#812

#### Fixes
* Add Additional Error Messages for KMS Key lookup on imported dataset
by @noah-paige in #748
* Handle Environment Import of IAM service roles by @noah-paige in
#749
* Build Compliant Names for Opensearch Resources by @noah-paige in
#750
* Update Lambda runtime by @nikpodsh in
#782
* Ensure valid environments for share request and other objects creation
by @dlpzx in #781
* Fix shell true semgrep by @dlpzx in
#760
* Add condition when there are no public subnets by @lorchda in
#794
* Remove unused variable by @zsaltys in
#815
* Check other share exists before clean up by @noah-paige in
#769


### Relates
- v2.1.0 minor release

## New Contributors
* @manjulaK made their first contribution in
#786
* @zsaltys made their first contribution in
#793
* @anushka-singh made their first contribution in
#811
* @TejasRGitHub made their first contribution in
#818

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

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Noah Paige <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: jaidisido <[email protected]>
Co-authored-by: mourya-33 <[email protected]>
Co-authored-by: nikpodsh <[email protected]>
Co-authored-by: MK <[email protected]>
Co-authored-by: Zilvinas Saltys <[email protected]>
Co-authored-by: Daniel Lorch <[email protected]>
Co-authored-by: Anushka Singh <[email protected]>
Co-authored-by: trajopadhye <[email protected]>
@dlpzx dlpzx deleted the fix/share-ensure-valida-environment branch November 8, 2023 08:35
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.

2 participants