- Added
.gitignoreto prevent sensitive files from being committed - Created
.env.exampletemplate for new developers - Updated
application.propertiesto use environment variables - Added
dotenv-javadependency for .env file support
cp .env.example .envnano .env # or use your preferred editorThe .env file is automatically ignored by git and contains your real credentials.
| Variable | Description | Example |
|---|---|---|
NEON_DB_URL |
Neon PostgreSQL connection URL | jdbc:postgresql://... |
NEON_DB_USERNAME |
Database username | your_username |
NEON_DB_PASSWORD |
Database password | your_password |
JWT_SECRET |
JWT signing secret (256-bit) | openssl rand -hex 32 |
JWT_EXPIRATION_TIME |
Token expiration (milliseconds) | 86400000 (24 hours) |
SPRING_SECURITY_USERNAME |
Admin username | admin |
SPRING_SECURITY_PASSWORD |
Admin password | secure_password |
- Use strong, unique passwords
- Generate secure JWT secrets:
openssl rand -hex 32 - Use different credentials for development/production
- Regularly rotate JWT secrets
- Use HTTPS in production
- Enable database SSL (sslmode=require)
- Commit
.envfiles to git - Share credentials in chat/email
- Use default passwords in production
- Store secrets in code comments
- Use weak JWT secrets
-
Database Credentials:
- Generate new password in Neon console
- Update
.envfile - Restart application
-
JWT Secret:
openssl rand -hex 32 # Copy output to JWT_SECRET in .env -
Application Restart:
# Kill current application pkill -f "java.*smsystem" # Rebuild and restart cd smsystem-backend mvn clean package -DskipTests java -jar target/smsystem-0.0.1-SNAPSHOT.jar
.env- Environment variables*.env- All environment filesapplication-prod.properties- Production configsapplication-local.properties- Local configstarget/- Maven build artifactsnode_modules/- NPM dependencies*.log- Log files- IDE files (
.idea/,.vscode/)
-
Server Environment Variables:
export NEON_DB_URL="your_production_url" export NEON_DB_USERNAME="your_production_user" export NEON_DB_PASSWORD="your_production_password" export JWT_SECRET="your_256_bit_secret"
-
Docker Environment:
ENV NEON_DB_URL=${NEON_DB_URL} ENV NEON_DB_USERNAME=${NEON_DB_USERNAME} ENV NEON_DB_PASSWORD=${NEON_DB_PASSWORD} ENV JWT_SECRET=${JWT_SECRET}
-
Cloud Deployment:
- AWS: Use Parameter Store or Secrets Manager
- Heroku: Use Config Vars
- Azure: Use Key Vault
- Google Cloud: Use Secret Manager
- Immediately change all passwords
- Generate new JWT secret
- Revoke all existing JWT tokens
- Review access logs
- Update .env file
- Restart application
- Remove file from git history:
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch .env' --prune-empty --tag-name-filter cat -- --all - Change all credentials immediately
- Force push to remote repository
For security concerns or credential reset requests, contact:
- System Administrator: admin@school.com
- IT Security: security@school.com
Remember: Security is everyone's responsibility! π‘οΈ