A simple Pastebin-like application built with React, TypeScript, and Express. This application is intentionally built with minimal security measures for educational purposes in security courses.
- Code snippet creation and editing
- Support for multiple programming languages:
- TypeScript
- JavaScript
- Python
- Java
- C++
- Syntax highlighting using CodeMirror
- File upload functionality
- Basic user authentication
- Unique URLs for each saved snippet
- SQLite database with Sequelize ORM
This application is deliberately built WITHOUT security measures for educational purposes. It contains various vulnerabilities including but not limited to:
- SQL Injection possibilities
- No input validation
- Weak authentication
- No CSRF protection
- Potential XSS vulnerabilities
DO NOT USE THIS IN PRODUCTION!
- Node.js (v14 or higher)
- npm (Node Package Manager)
- Clone the repository:
git clone [repository-url]
cd learn_paste-bin
- Install dependencies:
npm install
- Start the backend and frontend development server:
npm run dev:all
-
Access the application at
http://localhost:3000
-
Login with default credentials:
- Username:
admin
- Password:
admin
- Username:
-
Create new snippets:
- Enter a title
- Select a programming language
- Write or paste your code
- Click "Save" to generate a unique URL
-
Upload files:
- Click the file upload button
- Select a text file
- The content will be automatically loaded into the editor
-
Access saved snippets:
- Use the generated URL (format:
/snippet/:id
) - Edit and save changes as needed
- Use the generated URL (format:
src/
├── server/
│ ├── models/
│ │ ├── index.ts
│ │ ├── Snippet.ts
│ │ └── User.ts
│ └── index.ts
├── components/
│ ├── Editor.tsx
│ └── Login.tsx
├── types.ts
├── App.tsx
└── main.tsx
POST /api/login
- User authenticationPOST /api/snippets
- Create/update snippetsGET /api/snippets/:id
- Retrieve a specific snippet
Both backend and frontend run on port 3000:
npm run dev:all
This is a demo application for educational purposes. If you find any bugs or want to suggest improvements, please open an issue or submit a pull request.