diff --git a/.codeclimate.yml b/.codeclimate.yml index c81eb7960..9b1220682 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -1,18 +1,19 @@ version: "2" exclude_patterns: + - components/ - config/ - - "**/db/" - dist/ - features/ - - "**/node_modules/" - script/ + - Tests/ + - "**/*.d.ts" + - "**/*_test.go" + - "**/db/" + - "**/node_modules/" - "**/spec/" - "**/test/" - "**/tests/" - - Tests/ - "**/vendor/" - - "**/*_test.go" - - "**/*.d.ts" plugins: csslint: enabled: true diff --git a/.devcontainer/chefs_local/local.json.sample b/.devcontainer/chefs_local/local.json.sample index 676f2edd9..345c3b721 100644 --- a/.devcontainer/chefs_local/local.json.sample +++ b/.devcontainer/chefs_local/local.json.sample @@ -53,8 +53,9 @@ "port": "8080", "rateLimit" : { "public": { - "windowMs": "900000", - "max": "100" + "limitApiKey": "120", + "limitFrontend": "500", + "windowMs": "60000", } }, "encryption": { diff --git a/.github/actions/deploy-to-environment/action.yaml b/.github/actions/deploy-to-environment/action.yaml index e2bdd6ad9..6d83f3348 100644 --- a/.github/actions/deploy-to-environment/action.yaml +++ b/.github/actions/deploy-to-environment/action.yaml @@ -43,6 +43,10 @@ inputs: runs: using: composite steps: + - name: Install OpenShift CLI tools + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4.14" - name: Checkout repository from pull request uses: actions/checkout@v4 with: diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index ddef99018..b25b4f0aa 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,14 +1,25 @@ - + # Description - - - + -## Types of changes +## Type of Change - + @@ -18,6 +29,7 @@ + @@ -27,8 +39,10 @@ This is a breaking change because ... ## Checklist - - + - [ ] I have read the [CONTRIBUTING](/bcgov/common-hosted-form-service/blob/main/CONTRIBUTING.md) doc - [ ] I have checked that unit tests pass locally with my changes @@ -39,4 +53,8 @@ This is a breaking change because ... ## Further comments - + diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index 9e03ebfea..407a63a58 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -142,5 +142,5 @@ jobs: CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} with: coverageLocations: | - ${{ github.workspace }}/**/lcov.info:lcov + ${{ github.workspace }}/**/clover.xml:clover prefix: ${{ github.workplace }} diff --git a/app/app.js b/app/app.js index 7a787470c..c9f41e61a 100644 --- a/app/app.js +++ b/app/app.js @@ -8,6 +8,7 @@ const querystring = require('querystring'); const log = require('./src/components/log')(module.filename); const httpLogger = require('./src/components/log').httpLogger; const middleware = require('./src/forms/common/middleware'); +const rateLimiter = require('./src/forms/common/middleware').apiKeyRateLimiter; const v1Router = require('./src/routes/v1'); const DataConnection = require('./src/db/dataConnection'); @@ -52,6 +53,8 @@ app.use((_req, res, next) => { } }); +app.use(config.get('server.basePath') + config.get('server.apiPath'), rateLimiter); + // Frontend configuration endpoint apiRouter.use('/config', (_req, res, next) => { try { diff --git a/app/config/default.json b/app/config/default.json index 931c2592b..d2f8eb24f 100644 --- a/app/config/default.json +++ b/app/config/default.json @@ -53,8 +53,9 @@ "port": "8080", "rateLimit": { "public": { - "windowMs": "60000", - "max": "120" + "limitApiKey": "120", + "limitFrontend": "500", + "windowMs": "60000" } }, "encryption": { diff --git a/app/frontend/package-lock.json b/app/frontend/package-lock.json index 250dd02a3..897cfee5a 100644 --- a/app/frontend/package-lock.json +++ b/app/frontend/package-lock.json @@ -14,6 +14,7 @@ "@fortawesome/fontawesome-svg-core": "^6.4.2", "@fortawesome/free-solid-svg-icons": "^6.4.2", "@fortawesome/vue-fontawesome": "^3.0.3", + "@vueuse/core": "^11.1.0", "axios": "^1.4.0", "bootstrap-scss": "^5.3.1", "crypto-js": "^4.1.1", @@ -1084,6 +1085,12 @@ "integrity": "sha512-EhcH/wvidPy1WeML3TtYFGR83UzjxeWRen9V402T8aUGYsCHOmfoisV3ZSg03gAFIbLq8TnWOJ0f4cALtnSEUg==", "devOptional": true }, + "node_modules/@types/web-bluetooth": { + "version": "0.0.20", + "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.20.tgz", + "integrity": "sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==", + "license": "MIT" + }, "node_modules/@vitejs/plugin-vue": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.0.4.tgz", @@ -1356,6 +1363,94 @@ "vuetify": "^3.0.0" } }, + "node_modules/@vueuse/core": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-11.1.0.tgz", + "integrity": "sha512-P6dk79QYA6sKQnghrUz/1tHi0n9mrb/iO1WTMk/ElLmTyNqgDeSZ3wcDf6fRBGzRJbeG1dxzEOvLENMjr+E3fg==", + "license": "MIT", + "dependencies": { + "@types/web-bluetooth": "^0.0.20", + "@vueuse/metadata": "11.1.0", + "@vueuse/shared": "11.1.0", + "vue-demi": ">=0.14.10" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@vueuse/core/node_modules/vue-demi": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz", + "integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==", + "hasInstallScript": true, + "license": "MIT", + "bin": { + "vue-demi-fix": "bin/vue-demi-fix.js", + "vue-demi-switch": "bin/vue-demi-switch.js" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@vue/composition-api": "^1.0.0-rc.1", + "vue": "^3.0.0-0 || ^2.6.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + } + } + }, + "node_modules/@vueuse/metadata": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-11.1.0.tgz", + "integrity": "sha512-l9Q502TBTaPYGanl1G+hPgd3QX5s4CGnpXriVBR5fEZ/goI6fvDaVmIl3Td8oKFurOxTmbXvBPSsgrd6eu6HYg==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@vueuse/shared": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-11.1.0.tgz", + "integrity": "sha512-YUtIpY122q7osj+zsNMFAfMTubGz0sn5QzE5gPzAIiCmtt2ha3uQUY1+JPyL4gRCTsLPX82Y9brNbo/aqlA91w==", + "license": "MIT", + "dependencies": { + "vue-demi": ">=0.14.10" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@vueuse/shared/node_modules/vue-demi": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz", + "integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==", + "hasInstallScript": true, + "license": "MIT", + "bin": { + "vue-demi-fix": "bin/vue-demi-fix.js", + "vue-demi-switch": "bin/vue-demi-switch.js" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@vue/composition-api": "^1.0.0-rc.1", + "vue": "^3.0.0-0 || ^2.6.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + } + } + }, "node_modules/abab": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", @@ -1532,11 +1627,11 @@ } }, "node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.5.tgz", + "integrity": "sha512-fZu86yCo+svH3uqJ/yTdQ0QHpQu5oL+/QE+QPSv6BZSkDAoky9vytxp7u5qk83OJFS3kEBcesWni9WTZAv3tSw==", "dependencies": { - "follow-redirects": "^1.15.0", + "follow-redirects": "^1.15.6", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } diff --git a/app/frontend/package.json b/app/frontend/package.json index fc3590af6..72078a176 100644 --- a/app/frontend/package.json +++ b/app/frontend/package.json @@ -35,6 +35,7 @@ "@fortawesome/fontawesome-svg-core": "^6.4.2", "@fortawesome/free-solid-svg-icons": "^6.4.2", "@fortawesome/vue-fontawesome": "^3.0.3", + "@vueuse/core": "^11.1.0", "axios": "^1.4.0", "bootstrap-scss": "^5.3.1", "crypto-js": "^4.1.1", diff --git a/app/frontend/src/components/admin/AddOwner.vue b/app/frontend/src/components/admin/AddOwner.vue index 9ef72925e..1d4260f03 100644 --- a/app/frontend/src/components/admin/AddOwner.vue +++ b/app/frontend/src/components/admin/AddOwner.vue @@ -1,48 +1,40 @@ -