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

build: release v5.3.0 #1430

Merged
merged 37 commits into from Mar 23, 2021
Merged

build: release v5.3.0 #1430

merged 37 commits into from Mar 23, 2021

Conversation

karrui
Copy link
Contributor

@karrui karrui commented Mar 23, 2021

Release v5.3.0

Features

  • feat: create new PATCH endpoint for updating form settings #1383
  • feat: rename /admin/form endpoint to /admin/forms, correct dir structure of /api/v3 routes #1425
  • feat: show error Toastr for intranet users on SPCP forms #1397
  • feat: switch to CorpPass Cloud for test form #1392

Improvements

  • fix: add rows attr to email confirmation email body textarea 941b6bf
  • refactor: convert mail and sms services into neverthrown variants #1344
  • refactor: Add handler for encrypted submissions controller #1362
  • refactor: convert analytics module to TypeScript/fp-ts, remove statistics animation on landing page #1361
  • refactor: migrate yesno validator to typescript, with tests #1372
  • refactor: rename type to AnalyticStatsDto #1393
  • refactor: return custom HashingError from utils when bcrypt fails #1426
  • build: automate dependency upgrades using mergify #1424
  • chore: change verified sms modal copy #1403

Dependency upgrades

  • fix(deps): bump @sentry/integrations from 6.2.2 to 6.2.3 #1419
  • fix(deps): bump aws-sdk from 2.863.0 to 2.864.0 #1388
  • fix(deps): bump aws-sdk from 2.864.0 to 2.866.0 #1404
  • fix(deps): bump celebrate from 13.0.4 to 14.0.0 #1423
  • fix(deps): bump convict from 6.0.0 to 6.0.1 #1395
  • fix(deps): bump libphonenumber-js from 1.9.13 to 1.9.14 #1417
  • fix(deps): bump neverthrow from 4.1.1 to 4.2.0 #1379
  • fix(deps): bump neverthrow from 4.2.0 to 4.2.1 #1416
  • fix(deps): bump opossum from 5.1.3 to 6.0.0 #1412
  • fix(deps): bump twilio from 3.57.0 to 3.58.0 #1394
  • chore(deps-dev): bump @opengovsg/mockpass from 2.6.6 to 2.6.7 #1387
  • chore(deps-dev): bump @types/express-serve-static-core #1390
  • chore(deps-dev): bump @types/jest from 26.0.20 to 26.0.21 #1402
  • chore(deps-dev): bump @types/mongodb from 3.6.9 to 3.6.10 #1377
  • chore(deps-dev): bump @types/node from 14.14.34 to 14.14.35 #1378
  • chore(deps-dev): bump @typescript-eslint/eslint-plugin #1380
  • chore(deps-dev): bump @typescript-eslint/parser from 4.17.0 to 4.18.0 #1386
  • chore(deps-dev): bump eslint-plugin-jest from 24.3.1 to 24.3.2 #1400
  • chore(deps-dev): bump jasmine from 3.6.4 to 3.7.0 #1413
  • chore(deps-dev): bump jasmine-core from 3.6.0 to 3.7.1 #1415
  • chore(deps-dev): bump ts-jest from 26.5.3 to 26.5.4 #1399
  • chore(deps): update spcp-auth-client, mockpass #1406

liangyuanruo and others added 30 commits March 16, 2021 10:34
Bumps [neverthrow](https://github.com/supermacro/neverthrow) from 4.1.1 to 4.2.0.
- [Release notes](https://github.com/supermacro/neverthrow/releases)
- [Commits](supermacro/neverthrow@v4.1.1...v4.2.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [@types/mongodb](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mongodb) from 3.6.9 to 3.6.10.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mongodb)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
added rows attribute to email confirmation textarea to increase height to something reasonable for email
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.14.34 to 14.14.35.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
chore: merge 5.2.0 into develop
Bumps [aws-sdk](https://github.com/aws/aws-sdk-js) from 2.863.0 to 2.864.0.
- [Release notes](https://github.com/aws/aws-sdk-js/releases)
- [Changelog](https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md)
- [Commits](aws/aws-sdk-js@v2.863.0...v2.864.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [@opengovsg/mockpass](https://github.com/opengovsg/mockpass) from 2.6.6 to 2.6.7.
- [Release notes](https://github.com/opengovsg/mockpass/releases)
- [Commits](opengovsg/mockpass@v2.6.6...v2.6.7)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [@types/express-serve-static-core](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/express-serve-static-core) from 4.17.18 to 4.17.19.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/express-serve-static-core)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [convict](https://github.com/mozilla/node-convict) from 6.0.0 to 6.0.1.
- [Release notes](https://github.com/mozilla/node-convict/releases)
- [Changelog](https://github.com/mozilla/node-convict/blob/master/CHANGELOG.md)
- [Commits](mozilla/node-convict@v6.0.0...v6.0.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [twilio](https://github.com/twilio/twilio-node) from 3.57.0 to 3.58.0.
- [Release notes](https://github.com/twilio/twilio-node/releases)
- [Changelog](https://github.com/twilio/twilio-node/blob/main/CHANGES.md)
- [Commits](twilio/twilio-node@3.57.0...3.58.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* ref: convert MailService functions to neverthrown variant

* test(MailService): fix tests due to refactoring functions

* wip(SmsService): update send fn to neverthrown variant w cleaner errs

* ref(SmsService): update sendVerificationOtp fn to neverthrown variant

* ref(SmsService): update remaining fns to use neverthrown send fn

* feat: store original thrown twilio error in SmsSendError for logging

* feat(SmsFactory): add passthrough errAsyncs and update tests

* test(SmsService): update tests for neverthrown functions

* fix(BounceSvc): update sms-related fns in service to allow for new fns

* feat(VfnSvc): use new neverthrown fns from mail and sms services

also update tests

* feat(user): handle MissingFeatureError and InvalidNumberError

* feat: show sms/mail error message itself in default case

* feat(EmailSubmissionSvc): remove redundant sendSubmissionToAdmin fn

Directly use refactored function from MailService

* test(EmailSubmissionRoutes): make jest spy promise

test was failing due to old code using await syntax (and thus does not need a resolved value), and the new code uses neverthrow#andThen, which requires a promise to continue

* ref: extract mail send retry into its own private function

* test(MailService): update tests to check for logging of original error

* feat: add additional logging meta to error in twilio send callback

* test: update old jasmine tests to mock with neverthrow

* feat(VfnSvc): return ApplicationError w const str and fieldType meta

* feat: use getMongoErrorMessage util for DatabaseError message

* ref(SmsService): extract renderVerificationSms to smsUtils

* ref(SmsService): rename send to sendSms for clarity
* feat: add new CP cloud env vars with defaults

* feat: allow service user to specify useCpCloud

* feat: use CP cloud for test form

* test: update tests with new useCpCloud arg

* chore: log cloud env vars

* fix: convert _id to string

* ref: remove check for isEnabled
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.20 to 26.0.21.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Pick up the latest versions of spcp-auth-client and mockpass,
both of which carry xmldom@0.5.0, which addresses a vulnerability
involving malicious XML input (CVE-2021-21366)
Bumps [aws-sdk](https://github.com/aws/aws-sdk-js) from 2.864.0 to 2.866.0.
- [Release notes](https://github.com/aws/aws-sdk-js/releases)
- [Changelog](https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md)
- [Commits](aws/aws-sdk-js@v2.864.0...v2.866.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 24.3.1 to 24.3.2.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md)
- [Commits](jest-community/eslint-plugin-jest@v24.3.1...v24.3.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [ts-jest](https://github.com/kulshekhar/ts-jest) from 26.5.3 to 26.5.4.
- [Release notes](https://github.com/kulshekhar/ts-jest/releases)
- [Changelog](https://github.com/kulshekhar/ts-jest/blob/master/CHANGELOG.md)
- [Commits](kulshekhar/ts-jest@v26.5.3...v26.5.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [opossum](https://github.com/nodeshift/opossum) from 5.1.3 to 6.0.0.
- [Release notes](https://github.com/nodeshift/opossum/releases)
- [Changelog](https://github.com/nodeshift/opossum/blob/main/CHANGELOG.md)
- [Commits](nodeshift/opossum@v5.1.3...v6.0.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [jasmine](https://github.com/jasmine/jasmine-npm) from 3.6.4 to 3.7.0.
- [Release notes](https://github.com/jasmine/jasmine-npm/releases)
- [Commits](jasmine/jasmine-npm@v3.6.4...v3.7.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [jasmine-core](https://github.com/jasmine/jasmine) from 3.6.0 to 3.7.1.
- [Release notes](https://github.com/jasmine/jasmine/releases)
- [Changelog](https://github.com/jasmine/jasmine/blob/main/RELEASE.md)
- [Commits](jasmine/jasmine@v3.6.0...v3.7.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [neverthrow](https://github.com/supermacro/neverthrow) from 4.2.0 to 4.2.1.
- [Release notes](https://github.com/supermacro/neverthrow/releases)
- [Commits](supermacro/neverthrow@v4.2.0...v4.2.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [@sentry/integrations](https://github.com/getsentry/sentry-javascript) from 6.2.2 to 6.2.3.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md)
- [Commits](getsentry/sentry-javascript@6.2.2...6.2.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
karrui and others added 7 commits March 22, 2021 15:34
* feat: create new ApiRouter accessed via '/api/v1'

* feat(AdminFormSvc): add updateFormSettings fn

* feat(AdminFormCtl): add handleUpdateSettings controller handler fn

* feat(AdminFormRoutes): add PATCH settings route and validator

* feat: use new AdminRouter in ApiRouter /api/v1/admin route

* fix: update SettingsUpdateBody to correct setting keys

* feat(AdminFormService): add client service for form settings update

* ref: use new updateFormSettings fn to update settings in client

* feat: create FormSettings type and SettingsUpdateDto type

* ref: use new FormSettings and SettingsUpdateDto types

* feat(FormModel): add & use new getSettings form model instance method

* ref: update comment on returning just settings on successful update

* feat: update API_ROOT_ROUTE to '/api/v3'

* test(FormModel): add tests for getSettings instance method

* test(AdminFormSvc): add tests for updateFormSettings fn

* test(AdminFormCtl): add tests for handleUpdateSettings

* feat: prevent empty settings patch, min 1 key

* ref: return accumulatedForm directly in switch statement

this removes the need for a fromThrowable function, and the UnreachableCaseError class since the return type will not be consistent if a case is missed

* ref: move and add correct hierarchy for new /api/v3 routes

* ref(AdminFormClientCtl): use Object.assign instead of lodash merge

* ref(AdminFormCtl): rename updatedForm to updatedSettings for clarity

* feat(AdminFormClientCtl): add refresh error message on conflict status

* ref(FormModel): extract form setting keys to constant

* feat: remove duplicate admin-form.routes.ts

use the one in `routes` directory instead

* feat(AdminFormSvc): return err if email is updated for encrypt form

* feat(AdminFormRoutes): strengthen joi validator for emails update

* test: add integration tests for PATCH /admin/form/:formId/settings

* test(FormModel): use FORM_SETTING_FIELDS constant in test

* ref: move shared/typings to types/api

* ref: move isEmailModeForm util fn out of types/form to form.utils

types folder should only contain types and not util functions

* feat: set logger key from originalFormId to formId for consistency

* test(AdminFormRoute): use full path in test description

* feat: add dotify-object util fn to generate mongoose update query

* feat: call model findByIdAndUpdate directly

* test(AdminForm): update tests for new update settings flow

* feat: remove error when updating emails for encrypt mode forms

* feat(FormSvc): retrieve form model with only response mode

* feat: remove exported route constants and set route in caller
* build: prevent auto-merge for major version changes
Bumps [libphonenumber-js](https://gitlab.com/catamphetamine/libphonenumber-js) from 1.9.13 to 1.9.14.
- [Release notes](https://gitlab.com/catamphetamine/libphonenumber-js/tags)
- [Changelog](https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/CHANGELOG.md)
- [Commits](https://gitlab.com/catamphetamine/libphonenumber-js/compare/v1.9.13...v1.9.14)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [celebrate](https://github.com/arb/celebrate) from 13.0.4 to 14.0.0.
- [Release notes](https://github.com/arb/celebrate/releases)
- [Commits](arb/celebrate@v13.0.4...v14.0.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@karrui
Copy link
Contributor Author

karrui commented Mar 23, 2021

@mantariksh

Tests

PATCH Settings

  • Update form settings for an email mode form. All possible updates should work:
    • Activate/deactivate form
    • Toggle submission limit, change limit number
    • Set inactive form message
    • Authentication types, esrvcId, etc.
    • Toggle on/off captcha
    • Update form name
    • Update emails
  • Update form settings for a storage mode form. All possible updates should work:
    • Activate/deactivate form
    • Toggle submission limit, change limit number
    • Set inactive form message
    • Authentication types, esrvcId, etc.
    • Toggle on/off captcha
    • Update form name
    • Update webhook URL
  • For any mode form, try with random keys to update settings. Should return 400 error

@karrui
Copy link
Contributor Author

karrui commented Mar 23, 2021

@karrui

GSIB/Intranet/IE11 Tests

Intranet IPs Toast

  • List of intranet IPs has been SFTPed into production, and INTRANET_IP_LIST_PATH env var has been added in production
  • SingPass, CorpPass and MyInfo forms on intranet show the error Toastr
  • Non-authenticated forms on intranet do not show the error Toastr
  • SingPass, CorpPass, MyInfo and non-authenticated forms on internet do not show the error Toastr

General runthrough

  • Create email mode form with all fields and custom start/end page. Activate and submit form. Check that you can receive responses in your intranet inbox.
  • Collaborators can be added in email mode.
  • Create storage mode form with all fields and custom start/end page. Activate and submit form.
  • Response CSV can be downloaded for storage mode.
  • Responses can be viewed in Data tab in storage mode.
  • Attachments for individual fields can be downloaded from Data tab in storage mode.
  • Attachment ZIP for submission can be downloaded from Data tab in storage mode.
  • Submission IDs can be filtered in storage mode.
  • Collaborators can be added and their collaborating rights edited in storage mode.

@karrui
Copy link
Contributor Author

karrui commented Mar 23, 2021

Tests

@tshuli

Corppass cert change

  • Create, activate and submit a new CorpPass form. Should be able to log in and submit successfully.
  • Log out of this new CorpPass form and deactivate it. Change the CP_CLOUD_FORM_ID env var to the ID of the new CorpPass form. Should still be able to activate the form, but should see "There was an unexpected error with your log in" after attempting to log in using CorpPass.
  • Delete the CP_CLOUD_CERT_PATH, CP_CLOUD_ENDPOINT and CP_CLOUD_FORM_ID env vars from staging. You should now be able to log in and submit the new CorpPass form again.

@karrui
Copy link
Contributor Author

karrui commented Mar 23, 2021

@karrui

Tests

UI/Copy changes

  • In admin build tab, go to email field > email confirmation > email body text area. The textarea should be larger than 2 rows:

  • Go to admin build tab and create a verified mobile field. The verified sms modal copy that appears should have the updated copy:
Under 10,000 form responses: Free verified SMS
<br><br>
Above 10,000 form responses: <b>$0.0395 per SMS - 
  <a href=${$scope.supportFormLink} target="_blank" class="">contact us</a> for billing</b>. 
Forms exceeding the free tier without billing will be deactivated.

@karrui
Copy link
Contributor Author

karrui commented Mar 23, 2021

@mantariksh

Tests

neverthrown mail and sms services

For mail service

  • Create an email form, and add an email field with email verification and confirmation.
    1. Enter your email into the email form and verify your email. The email should be sent to the given email and the OTP should validate successfully.
    2. Submit the form. You (as form admin) should receive the usual form submission email with the correct answers. You (as the form filler) should also receive an acknowledgement email.

@tshuli
For sms service

  • Create verified sms field. Go to form and check if sms is received
    • Give invalid OTP. Correct invalid otp error should be shown.
    • Turn off data in Chrome console and submit OTP. Correct unknown error should be shown.
    • Enter correct OTP. Should be verified correctly.
  • Update emergency contact number
    • Give invalid OTP. Correct invalid otp error should be shown.
    • Turn off data in Chrome console and submit OTP. Correct unknown error should be shown.
    • Enter correct OTP. Should be verified correctly.

@karrui
Copy link
Contributor Author

karrui commented Mar 23, 2021

@mantariksh

Tests

encrypt submission middleware merge

  • Submit an storage mode form submission. Should submit with no errors.
  • Should also be able to successfully retrieve the response of the above submission

@karrui
Copy link
Contributor Author

karrui commented Mar 23, 2021

@karrui

Tests

Analytics endpoint refactor

  • On the landing page, all statistics should show correctly.

@karrui
Copy link
Contributor Author

karrui commented Mar 23, 2021

@mantariksh

Tests

YesNo field refactor

  • Create two required yesno fields. Hide one of them behind logic. Check that normal submission using frontend succeeds for both visible and hidden field.
  • Check that following validation works when submitting programatically
  • Answer cannot be empty for required field
  • Invalid answer (e.g. 'abc') is rejected

@karrui karrui merged commit 7e92d74 into release Mar 23, 2021
@karrui karrui deleted the release-v5.3.0 branch April 21, 2021 02:16
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.

None yet

7 participants