diff --git a/server/src/middleware/csrfProtection.js b/server/src/middleware/csrfProtection.js new file mode 100644 index 0000000..566dde6 --- /dev/null +++ b/server/src/middleware/csrfProtection.js @@ -0,0 +1,11 @@ +import csrf from 'csurf' +const CSRF = csrf({ cookie: true }) +function csrfProtection(req, res, next) { + if (req.method === 'POST') { + CSRF(req, res, next) + } else { + next() + } +} + +export default csrfProtection diff --git a/tests/cypress/screenshots/UItests.cy.js/example helloworld app -- Game Play -- Typing in Terminal (failed).png b/tests/cypress/screenshots/UItests.cy.js/example helloworld app -- Game Play -- Typing in Terminal (failed).png new file mode 100644 index 0000000..2558927 Binary files /dev/null and b/tests/cypress/screenshots/UItests.cy.js/example helloworld app -- Game Play -- Typing in Terminal (failed).png differ diff --git a/tests/cypress/screenshots/UItests.cy.js/example helloworld app -- Game Start Page UI -- Check Header (failed).png b/tests/cypress/screenshots/UItests.cy.js/example helloworld app -- Game Start Page UI -- Check Header (failed).png new file mode 100644 index 0000000..d0c281c Binary files /dev/null and b/tests/cypress/screenshots/UItests.cy.js/example helloworld app -- Game Start Page UI -- Check Header (failed).png differ