backend fixes
This commit is contained in:
88
SECURITY.md
Normal file
88
SECURITY.md
Normal file
@@ -0,0 +1,88 @@
|
||||
# Security Considerations
|
||||
|
||||
## Current Security Status
|
||||
|
||||
### Known Issues
|
||||
The application currently shows some npm security warnings during build. These are primarily related to:
|
||||
|
||||
1. **Development Dependencies**: Most vulnerabilities are in dev/build tools, not runtime dependencies
|
||||
2. **Transitive Dependencies**: Some warnings come from nested dependencies in React ecosystem
|
||||
3. **Deprecated Packages**: Some packages have newer alternatives but are still functional
|
||||
|
||||
### Risk Assessment
|
||||
- **Runtime Risk**: LOW - vulnerabilities are mostly in build tools
|
||||
- **Production Impact**: MINIMAL - app runs in containerized environment
|
||||
- **Data Security**: SECURE - database isolated, HTTPS enforced
|
||||
|
||||
### Mitigation Strategies
|
||||
|
||||
#### Immediate (Already Implemented)
|
||||
- ✅ Database isolated on internal Docker network
|
||||
- ✅ HTTPS/TLS enforced via Traefik
|
||||
- ✅ JWT token-based authentication
|
||||
- ✅ Input validation and sanitization
|
||||
- ✅ Rate limiting on API endpoints
|
||||
- ✅ Security headers (CSP, HSTS, etc.)
|
||||
|
||||
#### Ongoing Maintenance
|
||||
- 🔄 Regular dependency updates
|
||||
- 🔄 Security audit monitoring
|
||||
- 🔄 Container image updates
|
||||
|
||||
## Production Deployment Security
|
||||
|
||||
### Required Actions
|
||||
1. **Generate Secure JWT Secret**:
|
||||
```bash
|
||||
openssl rand -base64 64
|
||||
```
|
||||
|
||||
2. **Use Strong Database Password**:
|
||||
```bash
|
||||
openssl rand -base64 32
|
||||
```
|
||||
|
||||
3. **Environment Security**:
|
||||
- Never commit `.env` files
|
||||
- Use Docker secrets in production
|
||||
- Rotate secrets regularly
|
||||
|
||||
### Monitoring
|
||||
- Monitor application logs
|
||||
- Set up security alerts for failed authentication attempts
|
||||
- Regular security updates for base Docker images
|
||||
|
||||
## Reporting Security Issues
|
||||
|
||||
If you discover a security vulnerability, please:
|
||||
|
||||
1. **Do not** open a public issue
|
||||
2. Email security concerns privately
|
||||
3. Provide detailed reproduction steps
|
||||
4. Allow time for investigation and patching
|
||||
|
||||
## Security Updates
|
||||
|
||||
This application follows semantic versioning with security patches:
|
||||
- **Patch releases** (x.x.X): Security fixes, safe to update immediately
|
||||
- **Minor releases** (x.X.x): New features, review before updating
|
||||
- **Major releases** (X.x.x): Breaking changes, test thoroughly
|
||||
|
||||
## Best Practices
|
||||
|
||||
### For Administrators
|
||||
- Keep base system updated
|
||||
- Monitor Docker security advisories
|
||||
- Use fail2ban for SSH protection
|
||||
- Regular backup testing
|
||||
|
||||
### For Users
|
||||
- Use strong passwords
|
||||
- Enable 2FA when available
|
||||
- Report suspicious activity
|
||||
- Keep browsers updated
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: August 2024
|
||||
**Next Review**: October 2024
|
||||
18
backend/.dockerignore
Normal file
18
backend/.dockerignore
Normal file
@@ -0,0 +1,18 @@
|
||||
node_modules
|
||||
.git
|
||||
.gitignore
|
||||
README.md
|
||||
.env
|
||||
.nyc_output
|
||||
coverage
|
||||
.coverage
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.DS_Store
|
||||
.vscode
|
||||
.idea
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
5
backend/.npmrc
Normal file
5
backend/.npmrc
Normal file
@@ -0,0 +1,5 @@
|
||||
# Suppress funding messages
|
||||
fund=false
|
||||
|
||||
# Suppress audit warnings during install (still run manually with npm audit)
|
||||
audit=false
|
||||
@@ -7,7 +7,7 @@ WORKDIR /app
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install --only=production
|
||||
RUN npm install --only=production --silent
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
@@ -15,7 +15,7 @@ const applicationRoutes = require('./routes/applications');
|
||||
const weatherRoutes = require('./routes/weather');
|
||||
const adminRoutes = require('./routes/admin');
|
||||
|
||||
const errorHandler = require('./middleware/errorHandler');
|
||||
const { errorHandler } = require('./middleware/errorHandler');
|
||||
const { authenticateToken } = require('./middleware/auth');
|
||||
|
||||
const app = express();
|
||||
|
||||
18
frontend/.dockerignore
Normal file
18
frontend/.dockerignore
Normal file
@@ -0,0 +1,18 @@
|
||||
node_modules
|
||||
.git
|
||||
.gitignore
|
||||
README.md
|
||||
.env
|
||||
.nyc_output
|
||||
coverage
|
||||
.coverage
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.DS_Store
|
||||
.vscode
|
||||
.idea
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
8
frontend/.npmrc
Normal file
8
frontend/.npmrc
Normal file
@@ -0,0 +1,8 @@
|
||||
# Suppress funding messages
|
||||
fund=false
|
||||
|
||||
# Suppress audit warnings during install (still run manually with npm audit)
|
||||
audit=false
|
||||
|
||||
# Use legacy peer deps to avoid conflicts
|
||||
legacy-peer-deps=true
|
||||
@@ -7,7 +7,7 @@ WORKDIR /app
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
RUN npm install --silent
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
"@testing-library/jest-dom": "^5.17.0",
|
||||
"@testing-library/react": "^13.4.0",
|
||||
"@testing-library/user-event": "^14.5.1",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-scripts": "5.0.1",
|
||||
"react-router-dom": "^6.8.1",
|
||||
"axios": "^1.6.2",
|
||||
@@ -19,6 +19,9 @@
|
||||
"react-hook-form": "^7.48.2",
|
||||
"react-query": "^3.39.3",
|
||||
"tailwindcss": "^3.3.6",
|
||||
"@tailwindcss/forms": "^0.5.7",
|
||||
"@tailwindcss/typography": "^0.5.10",
|
||||
"@tailwindcss/aspect-ratio": "^0.4.2",
|
||||
"autoprefixer": "^10.4.16",
|
||||
"postcss": "^8.4.32",
|
||||
"react-hot-toast": "^2.4.1",
|
||||
|
||||
Reference in New Issue
Block a user