Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

About

No description, website, or topics provided.

Resources

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Post-It Web Application

post-it-branding (3)

ci

Description

The Post-It Web Application is a social media platform inspired by sites like Twitter and Reddit, where users write posts and vote on each other's. It began as a team project for the Web App Development course at Ontario Tech University, built on the MEVN stack (MongoDB, Express, Vue, Node).

Security audit and v2 fixes

I went back to this project years later and reviewed it the way I'd review a client's app. Here's what I found and fixed:

Finding (v1) Risk Fix (v2) Test
DELETE /posts/:id and voting had no auth check Anyone could delete any post (broken access control / IDOR) Session-based requireAuth, plus an ownership check on delete users cannot delete other people's posts
POST /posts trusted userid and author from the request body Post as any other user Owner and author taken from the server session only posts are owned by the session user
GET /users returned full user documents Exposed every user's bcrypt hash and email Public fields only; owners see their own email user listings never expose password hashes or emails
Session secret hardcoded in source, cookies not HttpOnly Session forgery if the repo is public; cookies readable by scripts SESSION_SECRET from the environment (required in production), HttpOnly + SameSite + Secure in production session cookie is HttpOnly
Login said "not registered" vs "password incorrect" Account enumeration One generic error; session ID regenerated on login same test
Unlimited votes per user; the vote endpoint never responded Vote stuffing; hung requests One vote per user per post (switchable); proper responses one vote per user
No rate limiting, no security headers, permissive CORS Credential stuffing, clickjacking, XSS blast radius express-rate-limit on login/register, Helmet with a strict CSP, CORS removed (same origin) security headers are set
jQuery latest and a personal Font Awesome kit loaded from CDNs Unpinned third-party scripts jQuery removed (unused); Font Awesome and Bulma bundled from npm CSP blocks any stray script
23 npm advisories in server deps (2 critical); axios 0.26 and an unmaintained Vue CLI toolchain in the client Known CVEs in Express, Mongoose, axios and webpack Unused packages removed, rest upgraded, client moved to Vite: 0 advisories across server and client npm audit in CI

All the security tests (15 now) live in server/test/api.test.js and run against a real MongoDB in CI on every push.

Table of Contents

About Post-It

Post-It is designed to provide users with a platform for free speech and sharing moments that matter. Users can sign up for free, create posts, and engage with a community of like-minded individuals.

Stack

  • Front-end: Vue.js
  • Back-end: Node.js, Express
  • Database: MongoDB
  • Node Version: 18+ (tested on 22)

Installation

Quick start with Docker (recommended)

git clone https://github.com/Kaathihan/Web-App-Development.git
cd Web-App-Development
./scripts/make-env.sh        # random secrets into .env (mode 600)
docker compose up --build

Open http://localhost:3000. MongoDB runs in its own container with authentication on, no published port, and a persistent volume; the app connects as a readWrite user scoped to its own database.

Without Docker

Prerequisites: Node.js 18+ and a MongoDB (local mongod or a free Atlas cluster).

(cd client && npm ci && npm run build)
cd server && npm ci
cp .env.example .env        # set MONGO_URI and SESSION_SECRET
npm start                   # http://localhost:3000

Run the security tests

cd server
MONGO_URI=mongodb://localhost:27017/postit-test npm test

Usage

Sign up for an account on the landing page, then create and browse posts. (The test@test.com demo account existed only on the original course database.)

Demo

Watch the demo video to see the application in action: Demo Video

Deployment

The original course version ran on a DigitalOcean Droplet. v2 ships as a Docker image (docker compose up); put it behind a TLS-terminating reverse proxy and set NODE_ENV=production so cookies are marked Secure.

Project Structure

Web-App-Development/
├── Dockerfile / docker-compose.yml
├── client/            Vue 3 front end built with Vite (Vue Router, Vuex, ApexCharts, D3)
│   └── src/
│       ├── apis/
│       ├── components/
│       ├── router/
│       ├── store/
│       └── views/
└── server/            Express API + static host for client/dist
    ├── auth/          Passport local strategy
    ├── controllers/
    ├── database/      Mongoose connection (reads URI_KEY)
    ├── model/
    ├── test/          Security regression tests (node:test + supertest)
    ├── .env.example
    └── server.js

Technologies Used

  • Front-end: Vue.js
  • Back-end: Node.js, Express
  • Database: MongoDB
  • Deployment: DigitalOcean

Contributors

  • Preet Panchal
  • Eihab Syed
  • Fahad Bhatti
  • Kaathihan Luxmachandran
  • Sukhpreet Bansal

Contributing

Contributions are welcome:

  1. Fork the repository.
  2. Create a branch: git checkout -b feature/YourFeature
  3. Commit your changes: git commit -m "Add some feature"
  4. Push the branch: git push origin feature/YourFeature
  5. Open a pull request.

Security

How this project is secured, its known limits, and how to report a vulnerability privately: SECURITY.md.

About

No description, website, or topics provided.

Resources

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages