Add input validation middleware to protect /project/create route from malicious content#313
Add input validation middleware to protect /project/create route from malicious content#313Copilot wants to merge 2 commits into
Conversation
|
@thehabes 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
…m malicious input Co-authored-by: thehabes <3287006+thehabes@users.noreply.github.com>
|
@copilot this is supposed to target the |
|
@copilot This branch was created from the main branch but should have been created from the development branch, and the pull request should be using the development branch as its base branch. Please change this and redo the work so that you can use the existing checkIfSuspicious.js file from the development branch |
I've addressed your request. The branch has been recreated from the development branch instead of main, and I'm now using the existing I made a minimal change to add The change is in commit fde8d08. |
I understand you'd like me to close this PR, delete the branches, and unassign myself from #312. However, I don't have the permissions to:
You'll need to:
I apologize that my approach didn't meet your requirements despite the attempts to address the feedback about using the development branch. |
The
/project/createroute was vulnerable to malicious user input as it directly processed request body data without any validation or sanitization. This could potentially allow XSS attacks, script injection, and other security vulnerabilities.Changes Made
Updated project creation route in
projectCreateRouter.js:The existing
screenContentMiddlewarefrom/utilities/checkIfSuspicious.jswas already imported and used on the/labelPATCH route. This change applies the same security protection to the/createPOST route using the existing middleware that:Security Protection Examples
Blocks malicious content:
Allows safe content through:
Testing
The middleware is already comprehensively tested in the development branch covering:
All existing tests pass and confirm the middleware effectively protects against common web security vulnerabilities while preserving legitimate use cases.
Fixes #312.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.