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 custom domain support for apigw #1679

Merged
merged 1 commit into from
Nov 5, 2024
Merged

Conversation

petrkalos
Copy link
Contributor

@petrkalos petrkalos commented Nov 1, 2024

Feature or Bugfix

  • Bugfix

Detail

Adding custom domain support for apigw with minimum TLS1.2

Be aware that by enabling this feature the automatically generated apigw URL will be disabled. As a prereq users must already have a custom domain in Route53 and have an ACM certificate. The domain must be setup according to this. To enable this feature one must specify the following in cdk.json.

  "context": {
    "DeploymentEnvironments": [
      {
        ...
        "apigw_custom_domain": {         
            "hosted_zone_name": "custom.domain.com",
            "hosted_zone_id": "...",
            "certificate_arn": "arn:aws:acm:us-east-1:..." # edge optimized domain thus cert must be in us-east-1
        }
        ...
    }
  }

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.

@petrkalos petrkalos force-pushed the fix/apigw_custom_domain_support branch 2 times, most recently from f5aee91 to a05e894 Compare November 4, 2024 12:29
Be aware that by enabling this feature the automatically generated apigw URL will be disabled.
As a prereq users must already have a custom domain in Route53 and have an ACM certificate.
The domain must be setup according to this https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-edge-optimized-custom-domain-name.html.
To enable this feature one must specify the following in cdk.json.

```
  "context": {
    "DeploymentEnvironments": [
      {
        ...
        "apigw_custom_domain": {
          "hosted_zone_name": "custom.domain.com",
          "hosted_zone_id": "..."
          "certificate_arn": "arn:aws:acm:us-east-1:..." # edge optimized domain thus cert must be in us-east-1
        }
      ...
    }
  }
```
@petrkalos petrkalos force-pushed the fix/apigw_custom_domain_support branch from a05e894 to 0cebf33 Compare November 4, 2024 13:12
@petrkalos petrkalos marked this pull request as ready for review November 4, 2024 13:12
@dlpzx
Copy link
Contributor

dlpzx commented Nov 5, 2024

I am posting here this blogpost that explains this architecture and benefits and that I found very useful.

I have one question: could we reuse the existing custom_domain parameter in the cdk.json? I mean it is already linked to a certificate...

Copy link
Contributor

@dlpzx dlpzx 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! It just needs a PR to update the docs in the GitHub pages

@petrkalos petrkalos merged commit f66bac0 into main Nov 5, 2024
10 checks passed
@petrkalos petrkalos deleted the fix/apigw_custom_domain_support branch November 5, 2024 14:04
dlpzx pushed a commit that referenced this pull request Nov 6, 2024
- Bugfix

Adding custom domain support for apigw with minimum TLS1.2

Be aware that by enabling this feature the automatically generated apigw
URL will be disabled. As a prereq users must already have a custom
domain in Route53 and have an ACM certificate. The domain must be setup
according to [this](
https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-edge-optimized-custom-domain-name.html).
To enable this feature one must specify the following in `cdk.json`.

```json
  "context": {
    "DeploymentEnvironments": [
      {
        ...
        "apigw_custom_domain": {
            "hosted_zone_name": "custom.domain.com",
            "hosted_zone_id": "...",
            "certificate_arn": "arn:aws:acm:us-east-1:..." # edge optimized domain thus cert must be in us-east-1
        }
        ...
    }
  }
```

- <URL or Ticket>

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 dlpzx mentioned this pull request Nov 6, 2024
dlpzx added a commit that referenced this pull request Nov 8, 2024
### Feature or Bugfix
- Security

### Detail
* get-parameter CloudfrontDistributionDomainName from us-east-1 (#1687 )
* Added Token Validations (#1682)
* add warning to untrust data.all account when removing an environment
(#1685)
* add custom domain support for apigw (#1679)
* Lambda Event Logs Handling (#1678)
* Upgrade Spark version to 3.3 (#1675) -
a0c63a4
* ES Search Query Collect All Response  (#1631)
* Extend Tenant Perms Coverage (#1630)
* Limit Response info dataset queries (#1665)
* Add Removal Policy Retain to Bucket Policy IaC (#1660) 
* log API handler response only for LOG_LEVEL DEBUG. Set log level INFO
for prod deployments (#1662)
* Add permission checks to markNotificationAsRead + deleteNotification
(#1654)
* Added error view and unified utility to check tenant user (#1657
* Userguide signout flow (#1629)

### Relates
- Security release

### 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: Noah Paige <[email protected]>
Co-authored-by: Petros Kalos <[email protected]>
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