Skip to content

Commit efbe47c

Browse files
committed
feat: improve security configuration with mandatory secret generation
- Removed insecure default values for JWT_SECRET, admin credentials, and LOGIN_ATTEMPT_SALT to prevent accidental production use - Enhanced documentation with clearer secret generation commands and security best practices - Added new configuration options for proxy trust settings and comment author display names
1 parent 08c1db6 commit efbe47c

2 files changed

Lines changed: 24 additions & 15 deletions

File tree

.env.docker.example

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
# JWT Configuration
66
# CRITICAL: Must be at least 32 characters long!
77
# Generate with: openssl rand -base64 48
8+
# Generate all secrets before starting containers.
9+
# Example: openssl rand -base64 48 | tr -d '\n'
810
JWT_SECRET=
911

1012
# Admin Credentials
1113
# IMPORTANT: Password must be at least 12 characters long!
12-
ADMIN_USERNAME=admin
13-
ADMIN_PASSWORD=
14+
# ADMIN_USERNAME=
15+
# ADMIN_PASSWORD=
1416

1517
# Login Security Configuration
1618
# Required: high-entropy salt used to hash login attempt identifiers (protects rate limiting)

.env.example

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
# Database Configuration
22
# Path to SQLite database file
3-
# In Docker: sqlite:/data/database.db
4-
# In Development: sqlite:./database.db
5-
DATABASE_URL=sqlite:./database.db
3+
# Strongly recommended: store SQLite files outside the project directory to avoid unintended exposure.
4+
# Example (Linux/macOS): DATABASE_URL=sqlite:/var/lib/linux-tutorial/database.db
5+
# Example (Windows): DATABASE_URL=sqlite:C:/linux-tutorial/data/database.db
6+
# DATABASE_URL=
67

78
# JWT Configuration
89
# Secret key for JWT token signing and verification
9-
# CRITICAL: Must be at least 32 characters long!
10-
# Generate with: openssl rand -base64 48
11-
# Example: JWT_SECRET=$(openssl rand -base64 48)
12-
# For testing only: use a strong random string in production!
13-
JWT_SECRET=your-super-secret-jwt-key-min-32-chars-change-me-in-production
10+
# CRITICAL: Must be at least 43 characters of high-entropy data (≈256 bits)
11+
# Generate with: openssl rand -base64 48 > secret.txt && tr -d '\n' < secret.txt
12+
# JWT_SECRET=
1413

1514
# Cookie Security
1615
# Set to false if using CDN with SSL termination (BunnyCDN, Cloudflare, etc.)
@@ -25,14 +24,22 @@ FRONTEND_ORIGINS=http://localhost:5173,http://localhost:3000
2524

2625
# Admin Credentials (used to bootstrap default admin user)
2726
# IMPORTANT: Password must be at least 12 characters long (NIST recommendation)!
28-
# Change these values for production use!
29-
ADMIN_USERNAME=admin
30-
ADMIN_PASSWORD=change-me-min-12-chars
27+
# You must supply installation-specific credentials before running the backend.
28+
# ADMIN_USERNAME=
29+
# ADMIN_PASSWORD=
3130

3231
# Login Security Configuration
3332
# Required: high-entropy salt used to hash login attempt identifiers (protects rate limiting)
34-
#openssl rand -base64 48
35-
LOGIN_ATTEMPT_SALT=generate-a-random-64-byte-string
33+
# Generate with: openssl rand -base64 64 | tr -d '\n'
34+
# LOGIN_ATTEMPT_SALT=
35+
36+
# Proxy / Network Security
37+
# Set to true only when running behind a trusted reverse proxy that sets X-Forwarded-* headers.
38+
# TRUST_PROXY_IP_HEADERS=false
39+
40+
# Comment Display Configuration
41+
# Optional: override the public author name used for admin-generated comments.
42+
# COMMENT_AUTHOR_DISPLAY_NAME=Administrator
3643

3744
# Logging Configuration
3845
# Rust log level (trace, debug, info, warn, error)

0 commit comments

Comments
 (0)