CS5331 Assignment 1 Project Reference Repository
The objective is to implement a web application that provides the endpoints specified here: https://cs5331-assignments.github.io/rest-api-development/.
- User Sign-up.
- User Log-in.
- View public diary entries.
- View user's public and private entries. (Toggle permission and delete entries)
- Create new diary entry.
- View user profile.
- Luis Vazquez Diaz
- Divya Kamal Maddi
- Anusha Anandan
- Kowshik Sundararajan
Answer: Our tech stacks consists of:
- Backend: NoSQL database (MongoDB)
- Server: Node.js with Express framework and Mongoose wrapper for MongoDB
- Front-end: HTML, CSS, JavaScript, jQuery, Bootstrap4
Answer: We considered the following security measures (have not implemented them):
- XSS defenses by input/output sanitization and escaping.
- CSRF defenses by using tokens and checking origin header.
- Implementing CSP to prevent general injection attacks.
- Password requirements (length, special characters, etc)
We have implemented the following:
- NoSQL injection defenses (implemented by using Mongoose prepared statements).
Question 3: Are there any improvements you would make to the API specification to improve the security of the web application?
Answer: Since the token is sent in cleartext, session hijacking can take place.
Answer: We have implemented the following features:
- Password security: Using a combination of hashing and salts.
- We implemented a whitelist such that only http://localhost:80 can make requests to the API.
Question 5: Is your web application vulnerable? If yes, how and why? If not, what measures did you take to secure it?
Answer: Yes, the web application is vulnerable to the following types of attacks:
- XSS: inputs and outputs are not sanitized, html and urls are not escaped.
- CSP: No implementation of CSP directives allows for injection of malicious scripts.
- Lack of auto expiry of auth token can leave the app vulnerable if an attacker gains access - CSRF.
- Unencrypted traffic - opens the gate for MiTM attacks.
Answer: There are inconsistencies with the API documentation. /diary/delete
should be implemented using DELETE
verb and /diary/permission
should be implemented using PUT
.
Appreciate the flexibility in choosing our own tech stack, however with lack of experience in Docker, it has been quite difficult.
-
Luis Vazquez Diaz
- Implemented Docker
-
Divya Kamal Maddi
- Front-end
- Documentation
-
Anusha Anandan
- Server-side
- Database
- Front-end
-
Kowshik Sundararajan
- Server-side
- Database
- Front-end
- Documentation