Drop Once

A secure one-time file sharing service where uploaded files are automatically deleted after the first download. Features cryptographically secure 64-character share tokens, user authentication with email/password and Google OAuth, CSRF protection, and a clean Bootstrap 5 interface.
Technology
🔒 Drop Once -- Secure One-Time File Sharing
Long-Form Project Summary for KNWS Showcase
Drop Once is a secure, self-hosted file sharing platform where uploaded files can be downloaded exactly once before being automatically and permanently deleted from the server. It provides a simple workflow: upload a file, receive a shareable URL containing a 64-character cryptographic token, and send that link to your recipient. The moment they download the file, it is erased -- no copies remain, no second chances.
Built with Python/Flask and backed by MySQL, the application includes user authentication (email/password and Google OAuth), CSRF protection, secure filename sanitisation, and per-user storage isolation. It is designed for scenarios where sensitive documents need to be transferred with confidence that they will not persist on an intermediate server.
URL: https://droponce.knws.co.uk GitHub: github.com/datagram1/droponce
🚀 Project Goals
- Provide truly ephemeral file sharing -- files exist on the server only until the first download.
- Generate cryptographically secure share links using 64-character random tokens that are practically unguessable.
- Enforce strict security -- CSRF protection, secure filename handling, and user isolation.
- Support multiple authentication methods -- traditional email/password registration and Google OAuth for convenience.
- Limit file types and sizes to prevent abuse -- 100MB maximum with a whitelist of 10 allowed extensions.
- Organise storage per user -- each authenticated user has their own isolated upload directory.
- Deploy cleanly on KNWS infrastructure with minimal dependencies.
🧠 Core Features
1. One-Time Download Mechanism
The core functionality:
- User uploads a file through the web interface
- Server generates a unique 64-character cryptographic token using Python's
secretsmodule - A shareable URL is constructed:
https://droponce.knws.co.uk/download/<token> - The file metadata (original filename, storage path, token, uploader, timestamp) is stored in MySQL
- When a recipient visits the URL:
- The file is streamed to them as a download
- The physical file is immediately deleted from the server filesystem
- The database record is marked as consumed
- Any subsequent visit to the same URL returns a "file no longer available" message
There is no recovery mechanism by design. Once downloaded, the file is gone.
2. Cryptographic Token Generation
Security of the sharing mechanism:
- Tokens are generated using
secrets.token_urlsafe(48), producing 64-character base64url strings - The token space is vast enough (approximately 2^288 possibilities) to make brute-force enumeration infeasible
- Tokens are stored hashed in the database -- even a database breach does not reveal valid download URLs
- No sequential or predictable patterns in token generation
3. User Authentication
Dual authentication support:
- Email/Password -- standard registration and login with password hashing (Werkzeug security)
- Google OAuth 2.0 -- sign in with Google for frictionless access
- Session management via Flask-Login
- Remember-me functionality with secure cookies
- Password reset capability
4. File Security & Validation
Multiple layers of protection:
- Maximum file size: 100MB enforced at both client and server level
- Allowed extensions: 10 whitelisted file types to prevent executable uploads
- Filename sanitisation: Werkzeug's
secure_filename()strips dangerous characters and path traversal attempts - Per-user directories: Each user's uploads are stored in an isolated directory named by their user ID
- CSRF protection: Flask-WTF CSRF tokens on all forms
- No directory listing: Upload directories are not browsable
5. User Dashboard
Authenticated users see:
- List of their active (not yet downloaded) shared files
- Upload date and file size for each
- Shareable link with one-click copy
- Ability to manually delete a file before it is downloaded
- Download status indicator (pending / consumed)
6. Clean, Responsive UI
The frontend is built with Bootstrap 5:
- Simple drag-and-drop or click-to-upload interface
- Progress bar during upload
- Instant link display after successful upload
- Copy-to-clipboard button for the share URL
- Mobile-friendly responsive layout
- Clear visual feedback for file status and errors
🛠 Technical Architecture
Backend
- Language: Python 3.x
- Framework: Flask
- ORM: SQLAlchemy with MySQL backend
- Authentication: Flask-Login + Flask-OAuthlib (Google OAuth)
- Forms: Flask-WTF with CSRF protection
- File Storage: Server filesystem with per-user directory isolation
- Token Generation: Python
secretsmodule - File Handling: Werkzeug
secure_filename, size validation, extension whitelist
Database Schema
- Users -- id, email, password hash, OAuth provider, created timestamp
- Files -- id, user_id, original_filename, storage_path, token_hash, file_size, uploaded_at, downloaded_at, status
Frontend
- CSS Framework: Bootstrap 5
- Templates: Jinja2
- JavaScript: Vanilla JS for upload progress, clipboard API, drag-and-drop
Infrastructure
- Hosted on KNWS web server (
192.168.10.10) - MySQL on the dedicated database server
- Apache with WSGI for Flask deployment
- Virtual host configured (pending activation)
🔧 Pipeline & Workflow
- User signs up or logs in via email or Google OAuth.
- User uploads a file through the web interface.
- Server validates file type, size, and filename.
- Server stores the file in the user's isolated directory and generates a cryptographic token.
- User copies the shareable URL and sends it to the recipient.
- Recipient clicks the link -- file downloads and is immediately deleted from the server.
- Link becomes invalid -- any future access returns a gone message.
📈 Outcome & Impact
Drop Once demonstrates:
- Security-first design -- cryptographic tokens, CSRF protection, filename sanitisation, and automatic file deletion
- OAuth integration -- Google sign-in alongside traditional authentication
- Flask full-stack development -- backend API, database ORM, template rendering, and file handling
- Privacy engineering -- files are truly ephemeral with no server-side retention
- Practical utility -- a genuinely useful tool for sharing sensitive documents, credentials, or one-time access files
- Clean architecture -- well-separated concerns with SQLAlchemy models, Flask blueprints, and template inheritance
The project addresses a real need for secure file transfer where the sender wants assurance that shared content does not persist beyond its intended recipient.