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

Allow origins conf changes #1486

Merged
merged 29 commits into from
Sep 3, 2024

Conversation

mourya-33
Copy link
Contributor

Feature or Bugfix

  • Feature

Detail

This PR is to remove wildcards from origins as reported in #1000 by using a configuration parameter from cdk.json. This will allow the users to set a custom origin (default is *)

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 N/A
    fetching data from storage outside the application (e.g. a database, an S3 bucket)? N/A
    • Is the input sanitized? N/A
    • What precautions are you taking before deserializing the data you consume? N/A
    • Is injection prevented by parametrizing queries? N/A
    • Have you ensured no eval or similar functions are used? N/A
  • Does this PR introduce any functionality or component that requires authorization? N/A
    • How have you ensured it respects the existing AuthN/AuthZ mechanisms? N/A
    • Are you logging failed auth attempts? N/A
  • Are you using or adding any cryptographic features? N/A
    • Do you use a standard proven implementations? N/A
    • Are the used keys controlled by the customer? Where are they stored? N/A
  • Are you introducing any new policies/roles/users? N/A
    • Have you used the least-privilege principle? How? N/A

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@mourya-33
Copy link
Contributor Author

Hi @noah-paige here is the initial PR for allow-origins config driven change

@noah-paige
Copy link
Contributor

@mourya-33 can you run ruff format . on the repo - looks like the GH workflows is failing

backend/api_handler.py Outdated Show resolved Hide resolved
@mourya-33
Copy link
Contributor Author

@mourya-33 can you run ruff format . on the repo - looks like the GH workflows is failing

Fixed the formatting Noah

@@ -96,6 +97,7 @@ def __init__(
reauth_apis=reauth_config.get('reauth_apis', None) if reauth_config else None,
prod_sizing=prod_sizing,
tooling_account_id=tooling_account_id,
allowed_origins=allowed_origins,
Copy link
Contributor

@noah-paige noah-paige Aug 29, 2024

Choose a reason for hiding this comment

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

don't need to pass this param anymore to ParamStoreStack - to remove

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@@ -25,6 +25,7 @@ def __init__(
reauth_apis=None,
prod_sizing=False,
tooling_account_id='',
allowed_origins='*',
Copy link
Contributor

Choose a reason for hiding this comment

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

to remove

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

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.

looks good - approving thanks @mourya-33

@noah-paige noah-paige merged commit 0e1dc90 into data-dot-all:main Sep 3, 2024
10 checks passed
noah-paige added a commit that referenced this pull request Sep 17, 2024
### Feature or Bugfix
<!-- please choose -->
- Documentation



### Detail
- Add docs on configurable CloudWatch log retention
- Add docs on allowed origin configuration
- Update docs on cdkproxy code walkthrough


### Relates
- #1527
- #1486

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

Remove wildcard from Access-Control-Allow-Origin header
2 participants