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(sl): warn ops regarding CAA records #1076

Merged
merged 2 commits into from
Dec 28, 2023

Conversation

kishore03109
Copy link
Contributor

@kishore03109 kishore03109 commented Dec 22, 2023

Problem

Prevent this from occurring by warning the agency and ops beforehand regarding a possible site launch failure route.

Solution

Check for existence of CAA records, and if found, check if they 'trust' Amazon, else ask them to add DNS records that specifically allow for this.

Breaking Changes

  • Yes - this PR contains breaking changes
    • Details ...
  • No - this PR is backwards compatible with ALL of the following feature flags in this doc

Tests

set export MOCK_AMPLIFY_DOMAIN_ASSOCIATION_CALLS="true" and add this in server.js

const formResponses = [
  {
    submissionId: "",
    requesterEmail: "[email protected]",
    repoName: "kishore-test",
    primaryDomain: "isomer.gov.sg",
    redirectionDomain: "www.isomer.gov.sg",
    agencyEmail: "[email protected]",
  },
  {
    submissionId: "",
    requesterEmail: "[email protected]",
    repoName: "kishore-test-dev-gh",
    primaryDomain: "guide.isomer.gov.sg",
    redirectionDomain: "www.guide.isomer.gov.sg",
    agencyEmail: "[email protected]",
  },
  {
    submissionId: "",
    requesterEmail: "[email protected]",
    repoName: "ogp-jiachen",
    primaryDomain: "nushigh.edu.sg",
    redirectionDomain: "www.nushigh.edu.sg",
    agencyEmail: "[email protected]",
  },
  {
    submissionId: "",
    requesterEmail: "[email protected]",
    repoName: "kishore-test-dev-emil",
    primaryDomain: "asean-ifce.com",
    redirectionDomain: "www.asean-ifce.com",
    agencyEmail: "[email protected]",
  },
]

formsgSiteLaunchRouter.handleSiteLaunchResults(formResponses, "test")

the email (in the logs) should be out like this:
Screenshot 2023-12-22 at 9 47 51 AM

@kishore03109 kishore03109 requested a review from a team December 22, 2023 01:27
* 1. check if they have whitelisted Amazon CAA
* 2. if not, send email to inform them to whitelist Amazon CAA
*/
const hasAmazonCAAWhitelisted = caaRecords.some((record) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

the assumption we're making here is that if there's only one CAA record, it's the whitelisted amazon one right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not really, the condition to check here is: if it has any CAA record, at least one has to be the amazon one
in the case where there is no CAA record, actually all this is ok already

if (caaRecords.length > 1 && !hasAmazonCAAWhitelisted) {
successResult.addCAARecord = true
} else {
successResult.addCAARecord = false
Copy link
Contributor

Choose a reason for hiding this comment

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

don't we need the else if asAmazonCAAWhitelisted check here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh my conidtion is wrong i think that caused the confusion ps

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed, hopefully this clearer

Comment on lines +378 to +381
if (caaRecords.length > 0 && !hasAmazonCAAWhitelisted) {
successResult.addCAARecord = true
} else {
successResult.addCAARecord = false
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (caaRecords.length > 0 && !hasAmazonCAAWhitelisted) {
successResult.addCAARecord = true
} else {
successResult.addCAARecord = false
successResult.addCAARecord = caaRecords.length > 0 && !hasAmazonCAAWhitelisted

@kishore03109 kishore03109 merged commit 6dc3db9 into develop Dec 28, 2023
10 checks passed
@mergify mergify bot deleted the feat/siteLaunchCAARecords branch December 28, 2023 10:48
alexanderleegs pushed a commit that referenced this pull request Jan 4, 2024
* fix(sl): warn ops regarding CAA records

* fix(site launch): wrong condition
This was referenced Jan 10, 2024
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