Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shared Car System — Backend

Backend for the Shared Car System.

Docs

Security

🔐 Security

The Shared Car System backend is designed with a security-first, zero-trust approach, where all enforcement occurs server-side and the frontend is treated as untrusted.

Authentication

All protected endpoints require JWT Bearer authentication

Tokens are verified on every request using centralized middleware

Invalid, expired, or missing tokens are rejected with appropriate HTTP status codes

WebSocket connections use the same authentication model

Authorization & Access Control

The system enforces invite-only access — there is no public signup or group discovery

All data access is strictly group-scoped

Users may only access resources belonging to groups they are members of

Role-based permissions are enforced server-side (Owner vs Member)

Invite Security

Group membership is granted exclusively through secure, single-use invite tokens

Invite tokens are:

High-entropy and non-guessable

Time-limited

Invalidated immediately after acceptance

Token reuse or enumeration attempts are rejected

Data Isolation & Integrity

The backend never trusts client-provided identifiers

All resource access is validated against the authenticated user’s group membership

Business rules such as reservation conflict prevention and valid state transitions are enforced in the service layer

Real-Time Security

Real-time events are delivered via authenticated WebSocket connections

Events are emitted only to group-scoped rooms

No global or public real-time broadcasts exist

Auditability

The system records a lightweight audit trail for critical actions, including:

Reservation creation and cancellation

Car returns

Pickup request actions

Invite acceptance

Payment updates

This supports accountability and dispute resolution without excessive logging

Abuse Prevention

Sensitive endpoints (authentication, invites) are designed to support rate limiting

The attack surface is intentionally minimized through strict scope control

Explicit Non-Goals

To reduce risk and scope creep, the following are intentionally out of scope for the current version:

Public access or discovery

Automatic payment processing

External OAuth providers

Live GPS tracking or location sharing

Security Summary

The Shared Car System prioritizes access isolation, correctness, and real-world constraint enforcement. Security is achieved through architecture and authorization rather than client-side controls or heavy tooling.

About

A full-stack shared vehicle management platform with authentication, reservations, role-based access control, and real-time updates. Built with Node.js, Express, PostgreSQL, Prisma, and JWT.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages