Skip to content

Commit

Permalink
Clean-up for v2.1 (#843)
Browse files Browse the repository at this point in the history
### Feature or Bugfix
- Bugfix

### Detail
- Clean up prints and show better exception message when custom_domain
is not provided for SES

### Relates
- v2.1.0

### 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
dlpzx authored Oct 30, 2023
1 parent fb7b61b commit b51da2c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion backend/api_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def handler(event, context):
'engine': ENGINE,
'username': username,
'groups': groups,
'schema': SCHEMA
'schema': SCHEMA,
}

# Determine if there are any Operations that Require ReAuth From SSM Parameter
Expand Down
6 changes: 1 addition & 5 deletions backend/dataall/base/cdkproxy/cdk_cli_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,13 @@ def aws_configure(profile_name='default'):
print(' Running configure ')
print('..............................................')
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI = os.getenv('AWS_CONTAINER_CREDENTIALS_RELATIVE_URI')
print(f"AWS_CONTAINER_CREDENTIALS_RELATIVE_URI: {AWS_CONTAINER_CREDENTIALS_RELATIVE_URI}")
cmd = ['curl', f'169.254.170.2{AWS_CONTAINER_CREDENTIALS_RELATIVE_URI}']
process = subprocess.run(cmd, text=True, shell=False, encoding='utf-8', capture_output=True)
creds = None
if process.returncode == 0:
creds = ast.literal_eval(process.stdout)
print(f"Successfully curled credentials: {str(process.stdout)}, credentials = {creds}")
else:
print(
f'Failed clean curl credentials due to {str(process.stderr)}'
)
logger.error(f'Failed clean curl credentials due to {str(process.stderr)}')

return creds

Expand Down
2 changes: 1 addition & 1 deletion deploy/stacks/backend_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def __init__(

@run_if(["modules.datasets.features.share_notifications.email.active"])
def create_ses_stack(self, custom_domain, envname, kwargs, resource_prefix):
if None in [custom_domain, custom_domain.get('hosted_zone_name'), custom_domain.get('hosted_zone_id')]:
if custom_domain is None or None in [custom_domain.get('hosted_zone_name', None), custom_domain.get('hosted_zone_id', None)]:
raise Exception("Cannot Create SES Stack For email notification as Custom Domain is not present or is missing hosted_zone_id or name. Either Disable Email Notification Config or add Custom Domain")

return SesStack(
Expand Down

0 comments on commit b51da2c

Please sign in to comment.