|
1 | | - |
2 | 1 | # Secure File System (SFS) |
3 | 2 |
|
4 | | -This repository contains a Django + DRF backend for a Secure File System and a minimal frontend using Bootstrap and Axios. |
| 3 | +A Django + Django REST Framework backend for encrypted file storage, with a |
| 4 | +small template-based frontend (Bootstrap + Axios) served by Django. Users |
| 5 | +register, log in with JWT, and upload files that are encrypted at rest; |
| 6 | +each operation is recorded in an activity log. The repository also contains |
| 7 | +an experimental React/Vite client prototype at the root (`App.tsx`, |
| 8 | +`services/`), which is separate from the Django app. |
5 | 9 |
|
6 | 10 | ## Features |
7 | 11 |
|
8 | | -- User registration + JWT authentication (djangorestframework-simplejwt) |
9 | | -- AES-256 encrypted files, RSA-2048 per-user key pairs, HMAC-SHA256 integrity |
10 | | -- Upload / download / delete files |
11 | | -- Local, Firebase and S3 storage options (local implemented) |
12 | | -- Activity logs |
| 12 | +- User registration and JWT authentication (djangorestframework-simplejwt) |
| 13 | +- AES-256 file encryption, RSA-2048 per-user key pairs, HMAC-SHA256 integrity checks |
| 14 | +- Upload, download, and delete endpoints (`/api/files/`) |
| 15 | +- Local storage implemented; Firebase and S3 hooks included but not wired up |
| 16 | +- Activity logging of file and auth operations |
13 | 17 |
|
14 | | -## Quick setup (development) |
| 18 | +## Setup |
15 | 19 |
|
16 | | -1. Create virtual environment and activate |
| 20 | +Requires Python 3. From the repository root: |
17 | 21 |
|
18 | | -```powershell |
| 22 | +```bash |
19 | 23 | python -m venv venv |
20 | | -.\venv\Scripts\Activate.ps1 |
21 | | -``` |
22 | | - |
23 | | -2. Install backend dependencies |
24 | | - |
25 | | -```powershell |
| 24 | +source venv/bin/activate # Windows: .\venv\Scripts\Activate.ps1 |
26 | 25 | pip install -r backend/requirements.txt |
27 | 26 | ``` |
28 | 27 |
|
29 | | -3. Setup env |
| 28 | +Configuration is read from environment variables (optionally via a `.env` |
| 29 | +file next to `manage.py`): `DJANGO_SECRET_KEY`, `DJANGO_DEBUG`, |
| 30 | +`DJANGO_ALLOWED_HOSTS`, and `POSTGRES_*` for PostgreSQL. Defaults use |
| 31 | +SQLite with debug on, so no configuration is needed for development. |
30 | 32 |
|
31 | | -```powershell |
32 | | -copy backend/sfs_backend/.env.example backend/sfs_backend/.env |
33 | | -# edit .env if needed |
34 | | -``` |
35 | | - |
36 | | -4. Apply migrations and create superuser |
37 | | - |
38 | | -```powershell |
39 | | -cd backend/sfs_backend |
| 33 | +```bash |
| 34 | +cd backend/backend/sfs_backend |
40 | 35 | python manage.py migrate |
41 | 36 | python manage.py createsuperuser |
42 | | -``` |
43 | | - |
44 | | -5. Run server |
45 | | - |
46 | | -```powershell |
47 | 37 | python manage.py runserver |
48 | 38 | ``` |
49 | 39 |
|
50 | | -Access: |
| 40 | +Then open: |
51 | 41 |
|
52 | 42 | - API root: http://127.0.0.1:8000/api/ |
53 | 43 | - Frontend: http://127.0.0.1:8000/login.html |
54 | 44 | - Admin: http://127.0.0.1:8000/admin/ |
55 | 45 |
|
56 | | -## Production notes |
57 | | - |
58 | | -- Set `DJANGO_DEBUG=False` and configure `POSTGRES_*` env vars for PostgreSQL |
59 | | -- Use a secure `DJANGO_SECRET_KEY` and handle FILE master key |
60 | | -- Configure proper CORS origins |
61 | | -- Serve static files with WhiteNoise or from a CDN |
62 | | - |
63 | | -## Project layout |
64 | | - |
65 | | -(see project description in your IDE) |
66 | | - |
67 | 46 | ## Tests |
68 | 47 |
|
69 | | -Run tests with |
70 | | - |
71 | | -```powershell |
72 | | -cd backend/sfs_backend |
| 48 | +```bash |
| 49 | +cd backend/backend/sfs_backend |
73 | 50 | python manage.py test |
74 | 51 | ``` |
75 | 52 |
|
| 53 | +## Production notes |
76 | 54 |
|
77 | | -### Information Security Project – 3rd Semester |
78 | | -**Under the supervision of Sir Khalid Mehmood** |
79 | | - |
80 | | ---- |
81 | | - |
82 | | -## 👥 Project Team |
83 | | -- **Moavia Amir** |
84 | | -- **Mirza Muhammad Dawood** |
85 | | -- **Arslan Nasir** |
86 | | -- **Ali Raza** |
87 | | - |
88 | | ---- |
89 | | - |
90 | | -## 📌 Project Overview |
91 | | - |
92 | | -**SFS (Secure File System)** is a professional-grade, zero-knowledge encrypted file storage and sharing platform developed as part of the **Information Security course (3rd Semester)**. |
93 | | - |
94 | | -The system utilizes the browser’s native **WebCrypto API** to perform **client-side encryption**, ensuring that all data is encrypted before being transmitted or stored. At no point are plaintext files or private cryptographic keys exposed to the server. |
95 | | - |
96 | | ---- |
97 | | - |
98 | | -## 🚀 Deployment Guide |
99 | | - |
100 | | -### 1. Prepare GitHub Repository |
101 | | -- Initialize the repository: |
102 | | - ```bash |
103 | | - git init |
104 | | - ``` |
105 | | - |
106 | | -### 2. Vercel Deployment (Recommended) |
107 | | -- Connect the GitHub repository to **Vercel** |
108 | | -- Set the environment variable `API_KEY` with your **Google AI Studio API key** |
109 | | -- The project auto-configures using the included `vercel.json` |
110 | | - |
111 | | -### 3. Netlify Deployment |
112 | | -- Connect the GitHub repository to **Netlify** |
113 | | -- Set the `API_KEY` in **Site Settings → Environment Variables** |
114 | | -- Routing and security headers are managed using `netlify.toml` and `_redirects` |
115 | | - |
116 | | ---- |
117 | | - |
118 | | -## 🛡️ Security Specifications |
119 | | -- **Symmetric Encryption**: AES-256-GCM (file content encryption) |
120 | | -- **Asymmetric Encryption**: RSA-2048-OAEP (secure key wrapping) |
121 | | -- **Hash Algorithm**: SHA-256 (data integrity verification) |
122 | | -- **Zero-Knowledge Architecture**: |
123 | | - - No plaintext files stored |
124 | | - - No private keys transmitted |
125 | | - - No sensitive data exposed on the server |
126 | | - |
127 | | ---- |
128 | | - |
129 | | -## 🛠️ Key Features |
130 | | -- **Identity Provisioning**: Automatic RSA key-pair generation during user registration |
131 | | -- **Secure File Sharing**: RSA-based key re-encryption for authorized recipients |
132 | | -- **Neural Security Logic**: Gemini-3-Flash integration for cryptographic analysis |
133 | | -- **Immutable Audit Logging**: Real-time logging of security-sensitive operations |
134 | | - |
135 | | ---- |
136 | | - |
| 55 | +- Set `DJANGO_DEBUG=False` and the `POSTGRES_*` variables for PostgreSQL |
| 56 | +- Use a strong `DJANGO_SECRET_KEY` and protect the file master key |
| 57 | +- Restrict CORS origins and serve static files with WhiteNoise or a CDN |
137 | 58 |
|
138 | | -© 2025 **Coding Moves – Engineering Branch** |
139 | | -Developed for academic purposes under the **Information Security curriculum**. |
| 59 | +## Credits |
140 | 60 |
|
| 61 | +Information Security course project, 3rd semester, under the supervision of |
| 62 | +Sir Khalid Mehmood. Team: Moavia Amir, Mirza Muhammad Dawood, Arslan Nasir, |
| 63 | +Ali Raza. Coding Moves, Engineering Branch, 2025. |
0 commit comments