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 v6.141.0 #7592

Merged
merged 10 commits into from
Aug 14, 2024
Merged

build: release v6.141.0 #7592

merged 10 commits into from
Aug 14, 2024

Conversation

KenLSM
Copy link
Contributor

@KenLSM KenLSM commented Aug 13, 2024

New

  • build: merge release v6.140.0 to develop #7591
  • feat: support nric whitelisting #7534
  • fix: add nonce to script-src directive #7578
  • chore: remove unused props #7585
  • feat(admin-form): implement drag and drop functionality #7372
  • fix: settings page resets position glitch #7582
  • chore: move label to tab #7581
  • build: release v6.140.0 #7580

Dependencies

  • fix(deps): bump type-fest from 4.23.0 to 4.24.0 in /shared #7583

Dev-Dependencies

  • chore(deps-dev): bump @babel/preset-env from 7.22.5 to 7.25.3 #7586

Tests

feat: support nric whitelisting #7534

TC1: Admin can upload a valid whitelisted NRIC list

@KenLSM

  • Create a new storage mode form
  • Go to settings -> singpass -> enable singpass settings and set to any singpass mode
  • Click on the 'download a sample csv file'
  • Modify the 3 sample nric in the csv to 'S9812379B', 'F1612351W', 'S9912370B' and '53342803C'
  • Upload the csv file
  • Set the form to public mode
  • Respond to the form using only the 'S9812379B' mockpass login 2 times, make sure it is allowed for multiple submissions
  • Try to respond to the form using any NRIC/FIN not in the whitelist, it should be blocked
  • Verify in the admin form results page that the responses for the whitelisted NRIC are received.
  • Go back to the singpass settings page, note that the singpass settings should be greyed out due to form is public.
  • Try click on delete button of form, it should be disabled.
TC2: Admin can download whitelist settings
  • Click on the download button of whitelist setting, a modal should pop up to request secret key.
  • Close the modal, it should work
  • Press download button again, input secret key and click download
  • Verify csv file is downloaded with 'Respondent' header and correct whitelist submitterId entries ie, 'S9812379B', 'S9912370B', 'F1612351W' and '53342803C'.
TC3: Admin can whitelist and use single submission enabled
  • Continuing from the form in TC1, set form to private and turn on the limit to single submission toggle in settings -> singpass
  • Set form to public
  • Try to respond with previous 'S9812379B' mockpass login, it should be disallowed since it has submitted previously.
  • Try to submit 'F1612351W' mockpass login, it should be allowed.
  • Try to submit for a second time with 'F1612351W' mockpass login, it should be disallowed since it has submitted previously.
  • Try to submit with a non whitelisted NRIC, it should be disallowed due to not in whitelist.
TC4: Admin can remove whitelist
  • Make form private
  • Go back to form singpass settings, click delete button. Verify whitelist file is deleted even after refresh.
  • Try to respond with 'F1612351W' mockpass login, it should still be disallowed due to single submission.
  • Try to respond with S9912370B, it should be allowed.
  • Try to respond with a mockpass login not previously whitelisted, it should be allowed.
TC5: Admin sees appropriate error messages when uploading invalid CSV files
  • Clone and modify the csv file from step 1 by removing the respondent header. Upload it to whitelist setting, we should see the respondent header not present error.
  • Clone and modify the csv file from step 1 by removing all submitterIds, leaving just the respondents header. Upload it to whitelist setting, we should see the body cannot be empty error.
  • Clone and modify the csv file from step 1 by adding duplicate valid submitterIds. Upload it to whitelist setting, we should see the duplicate present error.
  • Clone and modify the csv file from step 1 by adding an empty row to middle of the csv file rows. Upload it to whitelist setting, we should see the no empty rows error.
  • Clone and modify the csv file from step 1 by adding some invalid submitter id such as 'S1234567A'. Upload it to whitelist setting, we should see the invalid id present error with correct example.
  • Upload a csv file that does not have a single column with the header Respondent. we should see a invalid format csv error message
TC6: Admin can input file with empty last row without reject.
  • Add an empty last row to the csv from step 1 using notepad/excel etc. Upload it to whitelist setting. It should not be rejected.
TC7: Admin can whitelist for payment form
  • Create a new storage mode form with payments connected and payment question.
  • Go to settings -> singpass -> enable singpass settings and set to any singpass mode
  • Upload the valid csv file from step 1
  • Set the form to public mode
  • Respond to the form using only the 'S9812379B' mockpass login and make payment, it should be successful
  • Respond to form using any mockpass login not in whitelist, it should not allow them to enter the form.
  • Verify in the admin form results page that the responses for the whitelisted NRIC are received.
TC8: Admin cannot upload whitelist above 20mb
  • upload a whitelist that is >20MB, it should fail

Deploy Notes

New Env:

  • DOWNLOAD_FORM_WHITELIST_RATE_LIMIT
  • UPLOAD_FORM_WHITELIST_RATE_LIMIT

New dependencies:

  • tweetnacl: installed on frontend. used for invoking /shared directory decryption method.
  • papaparse: installed on frontend. used for client csv file processing to string. chosen due to good maintenance effort/docs. fastest parser available with fast mode.
  • multer: installed on backend. used for multipart/form-data request body handling for large csv string streaming. express docs recommended package.

New dev dependencies:

  • @types/papaparse
  • @types/multer

KenLSM and others added 10 commits August 8, 2024 20:59
Bumps [type-fest](https://github.com/sindresorhus/type-fest) from 4.23.0 to 4.24.0.
- [Release notes](https://github.com/sindresorhus/type-fest/releases)
- [Commits](sindresorhus/type-fest@v4.23.0...v4.24.0)

---
updated-dependencies:
- dependency-name: type-fest
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* fix: add sticky to settings page Box component

* fix: change sticky to relative since we dont want the settings page to stay on the screen when scrolled away but still relative to the sibling component

* chore: add comments to signpost a workaround

---------

Co-authored-by: Ken <[email protected]>
* feat(admin-form): implement drag and drop functionality

Admins can now drag and drop their secret key files
to activate their forms

* remove unneccessary comment

* feat(secret-key): set drag and drop handlers on Input

* feat(secret-key): update placeholder text

* test(e2e): reflect change in upload btn text

---------

Co-authored-by: LoneRifle <[email protected]>
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.22.5 to 7.25.3.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.25.3/packages/babel-preset-env)

---
updated-dependencies:
- dependency-name: "@babel/preset-env"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* fix: add nonce to script-src directive

* test: ensure nonce is generated before usage
* feat(frontend): add whitelist csv attachment field to singpass settings page

* feat(frontend): add sample whitelist csv link to go.gov.sg

* feat(frontend): add secret key modal when download csv button clicked

* feat(frontend): add disable functionality to attachment file info and limit upload type to csv

* chore: remove unused csv-parse library

* feat(frontend): implement fetch and update logic for whitelist setting

* feat: set up preliminary FE BE API communication, add multer for multipart

* feat: add BE validation for form, change Web API Readable stream to string payload for simplicity

* feat: add FE error rendering when file validation fails

* feat: implement upload whitelist and remove whitelist logic

* chore: remove console.log in the mutations

* feat: implement csv file download

* feat: add toast message and close modal once whitelist file downloaded successfully

* feat: refactor DTO to support errorCodes instead of per error field

* feat: add encrypt string functionality

* feat: refactor handle update whitelist controller to remove middleware for business logic, change mongodb whitelist schema to store single nonce and publickey per message

* feat: add checking of whitelist when get public form

* fix: remove async from getWhitelistSubmitterIds

* feat: remove file size indicator

* feat: add app-level rate limiting for upload and download

* feat: add joi validation to protect handleUpdateWhitelistSetting

* feat: make submitterIds case insentive by setting to upper on whitelist save and lookup

* feat: update copy and enable validation for csv header

* feat: support edge case where admin changes whitelist before re-opening form and user submits, instantiate errors for dd log error code

* feat: set up lazy loading for whitelisted submitter ids by splitting into new collection

* fix: ensure whitelist download response only contains necessary fields

* fix: fix db fail to retrieve whitelist when duplicate

* fix: handle rate limit exceed error and reflect failure reason in toast

* fix: remove todo

* fix: fix PR comments related to syntactic issues for more concise code

* fix: remove unused imports

* feat: add error message when uploading csv without body

* feat: add duplicate test and fix failing tests

* feat: make copy changes for additional clarity for users

* feat: add storybook UI TC for nric whitelist

* feat: add TC for public form get and encrypt form w submit

* feat: add TC for ensuring setting for whitelist only includes isWhitelistEnabled flag

* feat: add tests for whitelist setting routes, reduce regression failure rate of tc by removing hardcoded strings, ensure uppercase of submitterId during lookup and test for that

* feat: update sitewide copy for mistake to further assistance

* chore: fix lint errors

* fix: update import to shared dir to use relative path so it can be resolved

* chore: update err message format for consistency

* feat: support last row empty to reduce potential support requests

* feat: refactor secret key modals to use same hook and common secret key form modal component for easier drag drop implementation

* fix: support mixed newline char in csv

* fix: remove optional chaining

* fix: justify attachment field content to center

* fix: pr comments

* chore: add rate limit env config

* fix: use optional chaining for isWhitelistEnabled to make it more terse

---------

Co-authored-by: Ken <[email protected]>
build: merge release v6.140.0 to develop
@KenLSM KenLSM merged commit 1e55cd6 into release-al2 Aug 14, 2024
82 of 84 checks passed
@KenLSM KenLSM deleted the release_v6.141.0 branch August 14, 2024 02:18
@KenLSM KenLSM mentioned this pull request Aug 15, 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.

3 participants