Skip to content

Commit dc5b0fb

Browse files
authored
Merge pull request #195 from CodeYourFuture/chore/1102-form-data-security-fix
[master] Chore/1102 form data security fix
2 parents 206df96 + 735e4a9 commit dc5b0fb

34 files changed

+3169
-9625
lines changed

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,23 +70,23 @@ jobs:
7070
environment:
7171
BUILD_PATH: 'qa'
7272
GENERATE_SOURCEMAP: 'false'
73-
REACT_APP_NODE_ENV: 'QA'
73+
VITE_NODE_ENV: 'QA'
7474
- run:
7575
name: build staging
7676
command: yarn build
7777
environment:
7878
BUILD_PATH: 'staging'
7979
GENERATE_SOURCEMAP: 'false'
80-
REACT_APP_NODE_ENV: 'STAGING'
80+
VITE_NODE_ENV: 'STAGING'
8181
- run:
8282
name: build production
8383
command: yarn build
8484
environment:
8585
BUILD_PATH: 'production'
8686
GENERATE_SOURCEMAP: 'false'
87-
REACT_APP_NODE_ENV: 'PRODUCTION'
87+
VITE_NODE_ENV: 'PRODUCTION'
8888
- persist_to_workspace:
89-
root: .
89+
root: build
9090
paths:
9191
- qa
9292
- staging

.husky/pre-commit

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
3-
41
yarn lint-staged

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ In the project directory, you can run:
2424
### `yarn start`
2525

2626
Runs the app in the development mode.<br>
27-
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
27+
Open [http://localhost:3002](http://localhost:3002) to view it in the browser.
2828

2929
The page will reload if you make edits.<br>
3030
You will also see any lint errors in the console.
@@ -46,8 +46,8 @@ Your app is ready to be deployed!
4646

4747
Runs the [Cypress] end-to-end tests, which means:
4848

49-
- Starting a mock for the backend server on port 3100
50-
- Starting the forms app in LOCAL mode on port 3000
49+
- Starting a mock for the backend server on port 3001
50+
- Starting the forms app in LOCAL mode on port 3002
5151
- Waiting for the app to start then running the tests
5252

5353
[cypress]: https://www.cypress.io/

cypress.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { defineConfig } = require('cypress')
22

33
module.exports = defineConfig({
44
e2e: {
5-
baseUrl: 'http://localhost:3000',
5+
baseUrl: 'http://localhost:3002',
66
specPattern: 'e2e/integration/*.test.js',
77
supportFile: 'e2e/support/index.js'
88
},

eslint.config.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import prettier from 'eslint-plugin-prettier'
2+
3+
export default [
4+
{
5+
plugins: { prettier: prettier },
6+
rules: {
7+
'import/no-anonymous-default-export': 'off',
8+
'prettier/prettier': [
9+
'error',
10+
{
11+
arrowParens: 'avoid'
12+
}
13+
]
14+
}
15+
}
16+
]

public/index.html renamed to index.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
content="width=device-width, initial-scale=1, shrink-to-fit=no"
88
/>
99
<meta name="theme-color" content="#000000" />
10-
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
11-
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
10+
<link rel="manifest" href="/manifest.json" />
11+
<link rel="shortcut icon" href="/favicon.ico" />
1212
<title>CYF - Volunteer form</title>
1313
<link
1414
rel="stylesheet"
@@ -61,5 +61,7 @@
6161
crossorigin="anonymous"
6262
></script>
6363
<script src="https://kit.fontawesome.com/5571a1d5bc.js"></script>
64+
65+
<script type="module" src="/src/index.jsx"></script>
6466
</body>
6567
</html>

package.json

Lines changed: 40 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -3,59 +3,41 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"axios": "^1.8.2",
7-
"moment": "^2.23.0",
8-
"react": "^18.2.0",
9-
"react-dom": "^18.2.0",
6+
"@reduxjs/toolkit": "^2.9.0",
7+
"axios": "^1.12.2",
8+
"moment": "^2.30.1",
9+
"react": "^18",
10+
"react-dom": "^18",
1011
"react-ga": "^3.3.1",
11-
"react-phone-number-input": "^3.2.11",
12-
"react-redux": "^8.0.4",
13-
"react-router-dom": "^6.4.2",
14-
"react-scripts": "5.0.1",
15-
"react-select": "^5.7.0",
16-
"reactstrap": "^8.0.1",
17-
"redux": "^4.0.4",
18-
"redux-thunk": "^2.3.0"
12+
"react-phone-number-input": "^3.4.12",
13+
"react-redux": "^9.2.0",
14+
"react-router-dom": "^7.9.3",
15+
"react-select": "^5.10.2",
16+
"reactstrap": "^9.2.3",
17+
"redux": "^5.0.1",
18+
"redux-thunk": "^3.1.0"
1919
},
2020
"scripts": {
21-
"build": "react-scripts build",
21+
"build": "vite build --outDir build/$BUILD_PATH",
2222
"e2e": "concurrently -k -s first -n \"app,e2e\" \"BROWSER=none yarn start\" \"yarn e2e:run\"",
2323
"e2e:dev": "concurrently -k -n \"app,e2e\" \"yarn start\" \"cypress open --e2e\"",
2424
"e2e:prod": "concurrently -k -s first -n \"app,e2e\" \"yarn serve\" \"yarn e2e:run\"",
25-
"e2e:run": "wait-on -l http-get://localhost:3000 && cypress run",
26-
"eject": "react-scripts eject",
25+
"e2e:run": "wait-on -l http-get://localhost:3002 && cypress run",
2726
"lint": "yarn lint:eslint && yarn lint:prettier --check",
2827
"lint:eslint": "eslint e2e src --max-warnings 0",
2928
"lint:prettier": "prettier --config .prettierrc 'e2e/**/*.js' 'src/**/*.js'",
3029
"lint:fix": "yarn lint:eslint --fix",
31-
"prepare": "husky install",
30+
"prepare": "husky",
3231
"prettier": "yarn lint:prettier --write",
33-
"preserve": "REACT_APP_NODE_ENV=LOCAL yarn build",
34-
"serve": "serve --cors --debug -p 3000 --single build",
35-
"start": "REACT_APP_NODE_ENV=LOCAL react-scripts start",
36-
"test": "react-scripts test --env=jsdom"
32+
"preserve": "VITE_NODE_ENV=LOCAL yarn build",
33+
"serve": "serve --cors --debug -p 3002 --single build",
34+
"start": "VITE_NODE_ENV=LOCAL vite --port 3002",
35+
"test": "vitest",
36+
"ci": "rm -rf node_modules && yarn install --frozen-lockfile"
3737
},
3838
"engines": {
3939
"node": "^22.13"
4040
},
41-
"eslintConfig": {
42-
"extends": [
43-
"react-app",
44-
"prettier"
45-
],
46-
"plugins": [
47-
"prettier"
48-
],
49-
"rules": {
50-
"import/no-anonymous-default-export": "off",
51-
"prettier/prettier": [
52-
"error",
53-
{
54-
"arrowParens": "avoid"
55-
}
56-
]
57-
}
58-
},
5941
"lint-staged": {
6042
"*.js": [
6143
"pretty-quick --staged",
@@ -64,28 +46,27 @@
6446
]
6547
},
6648
"devDependencies": {
67-
"@testing-library/cypress": "^8.0.3",
68-
"@testing-library/jest-dom": "^5.16.5",
69-
"@testing-library/react": "^13.4.0",
70-
"@testing-library/user-event": "^14.4.3",
71-
"concurrently": "^7.4.0",
72-
"cypress": "^10.9.0",
73-
"eslint-config-prettier": "^8.5.0",
74-
"eslint-plugin-cypress": "^2.12.1",
75-
"eslint-plugin-prettier": "^4.2.1",
76-
"husky": "^8.0.0",
77-
"lint-staged": "^13.0.3",
78-
"prettier": "^2.7.1",
79-
"pretty-quick": "^3.1.3",
49+
"@testing-library/cypress": "^10.1.0",
50+
"@testing-library/jest-dom": "^6.9.1",
51+
"@testing-library/react": "^16.3.0",
52+
"@testing-library/user-event": "^14.6.1",
53+
"@vitejs/plugin-react": "^5.0.4",
54+
"concurrently": "^9.2.1",
55+
"cypress": "^14.3.3",
56+
"eslint": "^9.36.0",
57+
"eslint-config-prettier": "^10.1.5",
58+
"eslint-plugin-cypress": "^5.2.0",
59+
"eslint-plugin-prettier": "^5.4.0",
60+
"husky": "^9.1.7",
61+
"jsdom": "^26.1.0",
62+
"lint-staged": "^16.2.3",
63+
"prettier": "^3.5.3",
64+
"pretty-quick": "^4.1.1",
8065
"react-select-event": "^5.5.1",
81-
"serve": "^14.0.1",
82-
"wait-on": "^6.0.1"
83-
},
84-
"resolutions": {
85-
"**/psl": "^1.10",
86-
"**/tr46": "^4.0.0",
87-
"**/whatwg-url": "^9.0.0",
88-
"uri-js": "npm:uri-js-replace"
66+
"serve": "^14.2.5",
67+
"vite": "^7.1.8",
68+
"vitest": "^3.1.3",
69+
"wait-on": "^8.0.3"
8970
},
9071
"browserslist": [
9172
">0.2%",

src/.prettierrc

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/App.js renamed to src/App.jsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
import React from 'react'
22
import { Provider } from 'react-redux'
33
import { BrowserRouter as Router } from 'react-router-dom'
4-
import { applyMiddleware, compose, createStore } from 'redux'
5-
import ReduxThunk from 'redux-thunk'
4+
import { configureStore } from '@reduxjs/toolkit'
65
import './App.css'
76
import Footer from './Components/Footer'
87
import Navbar from './Components/Navbar'
98
import reducers from './Redux/Reducer'
109
import Routes from './Routes'
1110

12-
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
13-
const store = createStore(
14-
reducers,
15-
composeEnhancers(applyMiddleware(ReduxThunk))
16-
)
11+
const store = configureStore({
12+
reducer: reducers
13+
})
1714

1815
const App = () => (
1916
<Provider store={store}>
File renamed without changes.

0 commit comments

Comments
 (0)