π SecureScholar β Secure Academic File Sharing System
SRS-compliant implementation for the Software Requirements Specification by Development Team (16-02-2026)
SRS Requirement
Implementation
FR: SAML/OAuth login
JWT auth with bcrypt password hashing
FR: 5-attempt account lockout
users.failed_attempts + locked_until
FR: 30-min session timeout
Auto-expiring sessions in DB
FR: AES-256 file encryption
utils/encryption.js β per-file key, master-key-wrapped
FR: Malware scan hook
Pre-upload scan step (plug in your API key)
FR: Reference Mode viewing
PDF/image iframe with copy/print disabled
FR: Dynamic watermarking
SVG overlay with user name, email, IP, timestamp
FR: Audit logging (7-year)
audit_logs table, all actions tracked
FR: Role-based access control
admin / faculty / student roles
FR: Version control
document_versions table
FR: File sharing & permissions
permissions table with view/edit/admin levels
NFR: 500MB max upload
Multer limits.fileSize
NFR: TLS encryption
Configure reverse proxy (Nginx/Caddy) with TLS
NFR: SQL injection prevention
Parameterized queries throughout
NFR: GDPR right to erasure
Soft delete + archiving route
NFR: FERPA compliance
Configurable data residency, audit trails
NFR: 99.5% uptime
Deploy behind PM2 + health check endpoint
NFR: UTF-8 support
SQLite WAL mode, UTF-8 throughout
securescholar/
βββ backend/ # Node.js + Express API
β βββ server.js # Entry point, middleware, routes
β βββ db.js # SQLite database + schema + seeding
β βββ middleware/
β β βββ auth.js # JWT auth, RBAC, document permission checks
β β βββ audit.js # Audit logging middleware
β βββ routes/
β β βββ auth.js # Login, logout, change-password
β β βββ files.js # Upload, view, permissions, versions
β β βββ audit.js # Audit log API + CSV export
β β βββ users.js # User management
β βββ utils/
β βββ encryption.js # AES-256-CBC encrypt/decrypt
β βββ watermark.js # Dynamic SVG watermark generator
β
βββ frontend/ # React + Vite
βββ src/
βββ App.jsx # Router + protected routes
βββ index.css # Full design system
βββ components/
β βββ AuthContext.jsx # Auth state provider
β βββ Sidebar.jsx # Navigation sidebar
βββ pages/
β βββ Login.jsx # Institutional login page
β βββ Dashboard.jsx # Stats + recent activity
β βββ FilesList.jsx # Grid/table document browser
β βββ FileDetail.jsx # Reference viewer + permissions
β βββ Upload.jsx # Drag-drop file upload
β βββ AuditLogs.jsx # Full audit trail browser
β βββ Users.jsx # User management (admin)
β βββ ChangePassword.jsx
βββ services/
βββ api.js # Axios client + all API calls
Node.js v18 or higher
npm v9 or higher
git clone < repo-url>
cd securescholar
cd backend
# Install dependencies
npm install
# Copy and configure environment
cp .env.example .env
# (Edit .env if needed β defaults work for local dev)
# Start the server
npm start
# Or for development with auto-reload:
npm run dev
The backend starts at http://localhost:5000
On first run, demo accounts are created automatically:
# In a new terminal
cd frontend
# Install dependencies
npm install
# Start dev server
npm run dev
The frontend starts at http://localhost:3000
Method
Endpoint
Description
POST
/api/auth/login
Login with email + password
POST
/api/auth/logout
Invalidate session
GET
/api/auth/me
Get current user
PUT
/api/auth/change-password
Change password
Method
Endpoint
Description
GET
/api/files
List accessible documents
POST
/api/files/upload
Upload + encrypt file (multipart)
GET
/api/files/:id
Get document metadata + permissions
GET
/api/files/:id/view
Reference mode β returns decrypted content
GET
/api/files/:id/watermark
Get watermark data for viewer
POST
/api/files/:id/permissions
Grant permission to user
DELETE
/api/files/:id/permissions/:userId
Revoke permission
GET
/api/files/:id/versions
Version history
DELETE
/api/files/:id
Soft-delete document
Method
Endpoint
Description
GET
/api/audit
List audit logs (admin/faculty)
GET
/api/audit/stats
Dashboard statistics
GET
/api/audit/export
Export logs as CSV
Method
Endpoint
Description
GET
/api/users
List all users
POST
/api/users
Create user (admin)
DELETE
/api/users/:id/lock
Unlock account (admin)
GET
/api/users/search?q=
Search users
π Security Implementation Details
File Encryption (AES-256-CBC)
A unique 256-bit key is generated per file
The file is encrypted using AES-256-CBC with a random IV
The file key is itself encrypted with the master key
Only the encrypted key and IV are stored in the database
Original file is deleted after encryption
JWT tokens expire after 30 minutes
Sessions stored server-side (DB) for revocability
Account locked after 5 failed attempts (15-minute lockout)
Password changes invalidate all other sessions
Documents served as inline content (not downloadable)
Content-Disposition: inline prevents save dialogs
Copy/paste disabled via CSS user-select: none
Dynamic watermark overlay with user identity + timestamp + IP
Cache-Control: no-store prevents browser caching
All these actions are logged with user, IP, timestamp, success/failure:
LOGIN_SUCCESS, LOGIN_FAILED, FILE_UPLOAD, FILE_VIEW_REFERENCE_MODE, FILE_ACCESS, FILE_DELETED, PERMISSION_GRANTED, PERMISSION_REVOKED, PASSWORD_CHANGED, LOGOUT, USER_CREATED, ACCOUNT_UNLOCKED
π Production Deployment
cd backend
npm install -g pm2
pm2 start server.js --name securescholar-api
pm2 save
cd frontend
npm run build
# Serve dist/ folder via Nginx
server {
listen 443 ssl ;
server_name yourdomain.edu;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
ssl_protocols TLSv1.3;
# Serve React app
location / {
root /path/to/frontend/dist;
try_files $uri $uri / /index .html;
}
# Proxy API
location /api {
proxy_pass http ://localhost:5000 ;
proxy_set_header X-Real-IP $remote_addr ;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
}
}
π TBD Items from SRS Appendix C
TBD
Status
Action Needed
TBD-1: Cloud provider
SQLite (local) β swap for PostgreSQL + AWS S3
Configure DATABASE_URL and AWS SDK
TBD-2: Antivirus API
Hook in routes/files.js upload handler
Add ClamAV or VirusTotal API call
TBD-3: Retention period
Configurable, defaults 7 years
Set in .env
TBD-4: Max concurrent users
1000+ (add Redis for sessions at scale)
Replace SQLite sessions with Redis
TBD-5: Mobile app
API-first design ready
Build React Native app using same /api
TBD-6: Multi-language
UTF-8 throughout, i18n hooks needed
Add react-i18next
π¨βπ» Development Team
Shayan Fatarpekar (24CSB0B69)
Shreyas Prakash Lohia (24CSB0B70)
Siddanth Sarath (24CSB0B71)
SecureScholar v1.0 β 16-02-2026