# Security Setup Guide

## ⚠️ Important: Credentials Management

### Setting Env Configuration
The file `Setting-Env-DEPRECATED.txt` contains sensitive database credentials and **should NOT be stored in version control**.

### Proper Setup

1. **Create `.env` file from template:**
   ```bash
   cp .env.example .env
   ```

2. **Update credentials in `.env`:**
   Replace placeholder values with actual database credentials:
   ```env
   DB_CONNECTION=mysql
   DB_HOST=your_actual_host
   DB_PORT=3306
   DB_DATABASE=your_actual_database
   DB_USERNAME=your_actual_username
   DB_PASSWORD=your_actual_password
   
   # Database connections
   DB_PROD_CONNECTION=mysql
   DB_PROD_HOST=your_product_db_host
   DB_PROD_DATABASE=your_product_database
   DB_PROD_USERNAME=your_product_username
   DB_PROD_PASSWORD=your_product_password
   
   DB_KAT_CONNECTION=mysql
   DB_KAT_HOST=your_category_db_host
   DB_KAT_DATABASE=your_category_database
   DB_KAT_USERNAME=your_category_username
   DB_KAT_PASSWORD=your_category_password
   ```

3. **Ensure `.env` is in `.gitignore`:**
   ```bash
   # Check .gitignore contains:
   .env
   .env.local
   .env.*.local
   ```

4. **Generate application key:**
   ```bash
   php artisan key:generate
   ```

### Important Notes
- ✅ `.env.example` - Safe to commit (has placeholder values)
- ❌ `.env` - Never commit (contains real credentials)
- ❌ `Setting-Env-DEPRECATED.txt` - Contains real credentials, delete after migrating to `.env`

### Rotate Database Password
If credentials in `Setting-Env-DEPRECATED.txt` were exposed:
1. Contact your database administrator to rotate the password
2. Update credentials in `.env`
3. Delete `Setting-Env-DEPRECATED.txt`

## Security Checklist
- [x] XSS vulnerabilities fixed in views (replaced `{!!` with `{{`)
- [x] Mass assignment protection added to models
- [x] Sensitive file removed from tracking
- [ ] Database password rotated (if exposed)
- [ ] `.env` configured with actual credentials
- [ ] Review authorization on admin routes
