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

Add dependency of SSM to cognito url trigger #1395

Merged
merged 1 commit into from
Jul 10, 2024
Merged

Conversation

dlpzx
Copy link
Contributor

@dlpzx dlpzx commented Jul 10, 2024

Feature or Bugfix

  • Bugfix

Detail

When deploying an internet facing deployment for the first time, It fails to deploy in the frontend stage -in the cognito url custom resource trigger:

[ERROR] ParameterNotFound: An error occurred (ParameterNotFound) when calling the GetParameter operation:
Traceback (most recent call last):
File "/var/task/cognito_urls.py", line 77, in handler
setup_cognito(
File "/var/task/cognito_urls.py", line 27, in setup_cognito
user_guide_link = ssm.get_parameter(
File "/var/runtime/botocore/client.py", line 553, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/var/runtime/botocore/client.py", line 1009, in _make_api_call
raise error_class(parsed_response, operation_name)

The issue is that the SSM parameters that is trying to access do not exist yet in the first deployment because they are deployed as part of the frontend stack.

In this PR we add a dependency of the SSM parameters needed to run the trigger

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
Copy link
Contributor Author

dlpzx commented Jul 10, 2024

Currently being tested in AWS

@SofiaSazonova
Copy link
Contributor

Update: after that there is another error
Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied;

Reason:
Input artifact | Synth_Output -- link to eu-west-2 (deployment region), but the bucket is in us-east-1

@dlpzx dlpzx requested a review from SofiaSazonova July 10, 2024 12:41
Copy link
Contributor

@SofiaSazonova SofiaSazonova left a comment

Choose a reason for hiding this comment

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

Solve the original problem

@dlpzx dlpzx merged commit f4020bc into main Jul 10, 2024
10 checks passed
@dlpzx dlpzx deleted the fix/cognito-url-ssm branch July 17, 2024 12:25
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