-
Notifications
You must be signed in to change notification settings - Fork 3
Security
Neodyme includes multiple layers of security to protect the server and player data.
- Passwords hashed with bcrypt (configurable work factor, default 12 rounds)
- Minimum password length enforcement (default 8 characters)
- Timing-safe authentication responses (configurable delay 50-200ms) to prevent timing attacks
bcryptWorkFactor=12
passwordMinLength=8
authTimingDelayMin=50
authTimingDelayMax=200Neodyme uses multiple token types:
| Token Type | Default Expiry | Purpose |
|---|---|---|
| Access Token | 8 hours | API authentication |
| Exchange Token | 5 minutes | Token swapping between services |
| Refresh Token | 30 days | Obtain new access tokens |
| Web Access Token | 8 hours | Web interface authentication |
| Web Refresh Token | 30 days | Web interface session renewal |
| CSRF Token | 60 minutes | Cross-site request forgery protection |
accessTokenExpiryHours=8
exchangeTokenExpiryMinutes=5
refreshTokenExpiryDays=30
webAccessTokenExpiryHours=8
webRefreshTokenExpiryDays=30
csrfTokenExpiryMinutes=60Tokens can be encrypted at rest in JSON storage:
tokenEncryptionEnabled=falseAll web interface forms are protected with CSRF tokens:
csrfTokenExpiryMinutes=60
csrfSessionExpiryHours=24
csrfCleanupIntervalMinutes=60Three tiers of rate limiting protect against abuse:
Applies to all API endpoints:
rateLimiting=true
maxRequestsPerMinute=125
rateLimitWindowMinutes=1Stricter limits on login and registration:
authMaxAttempts=5
authWindowMinutes=15
authSkipSuccessfulRequests=falseThis means: maximum 5 login attempts per IP address within a 15-minute window.
For resource-intensive endpoints (search, bulk operations):
expensiveMaxRequests=10
expensiveWindowMinutes=5Security headers that protect against common web vulnerabilities (XSS, clickjacking, MIME sniffing):
helmetEnable=trueCross-Origin Resource Sharing control:
corsEnable=trueResponse compression to reduce bandwidth:
compressionEnable=truePrevent memory exhaustion attacks:
limitBodySize=50mb # File uploads
limitRequestSize=1mb # Regular API callsWhen running behind nginx, Apache, or Cloudflare:
trustProxy=trueprotocol=https
sslCertPath=config/ssl/cert.pem
sslKeyPath=config/ssl/key.pem- Set
protocol=httpsinserver.properties - Place your SSL certificate and private key in
config/ssl/ - Restart the server
- The server creates an HTTPS server and automatically enables secure cookies
When HTTPS is enabled, cookies are automatically configured with secure: true, meaning they are only sent over encrypted connections:
secureCookies=false # Auto-enabled when protocol=https- PEM format files
- Certificate file:
cert.pem - Private key file:
key.pem - If files are missing or invalid, the server will exit with a clear error message
All administrative actions are logged to the audit system:
| Action | Description |
|---|---|
ban_user |
User banned |
unban_user |
User unbanned |
change_role |
User role changed |
close_ticket |
Ticket closed |
delete_ticket |
Ticket deleted |
assign_ticket |
Ticket assigned |
approve_code |
Creator code approved |
reject_code |
Creator code rejected |
delete_code |
Creator code deleted |
toggle_code |
Creator code status toggled |
update_config |
Configuration value changed |
update_config_file |
Configuration file updated |
force_shop_rotation |
Manual shop rotation |
toggle_maintenance |
Maintenance mode toggled |
Each log entry contains:
- Action type
- Who performed the action (account ID + display name)
- Target type and ID
- Detailed changes (old/new values)
- Timestamp
- IP address
- Web Interface: Admin Panel > Audit Log
-
API:
GET /api/admin/audit-log - Supports filtering by action, user, date range, and search
/ban add "PlayerName" "Reason" "7d" # 7-day ban
/ban add "PlayerName" "Reason" "24h" # 24-hour ban/ban add "PlayerName" "Reason" # No duration = permanent-
h- Hours (e.g.,2h,24h) -
d- Days (e.g.,7d,30d) -
m- Months (e.g.,1m,6m)
/ban info "PlayerName" # View ban details
/ban remove "PlayerName" # Unban player
/ban list # List all bansBans can also be managed through the web interface (Moderator Panel > Player Management).
| Role | Level | Permissions |
|---|---|---|
| Player | 0 | Basic gameplay and web dashboard |
| Founder | 1 | Same as Player + founder badge |
| Helper | 4 | Same as Player + helper badge |
| Moderator | 3 | Player management, bans, tickets, creator codes |
| Admin | 2 | All moderator + user roles, audit log, advanced settings |
| Developer | 5 | Full access to all features including configuration |
/admin set "PlayerName" admin # Set as Admin
/admin set "PlayerName" moderator # Set as Moderator
/admin set "PlayerName" helper # Set as Helper
/admin set "PlayerName" founder # Set as Founder
/admin set "PlayerName" 0 # Remove role (regular player)-
Change default secrets: Always change
jwtSecretandgameServerSecretin production -
Enable HTTPS: Use
protocol=httpswith valid SSL certificates -
Use rate limiting: Keep
rateLimiting=trueto prevent abuse - Keep bcrypt factor high: 12-14 rounds provides good security
-
Enable Helmet: Keep
helmetEnable=truefor security headers -
Regular backups: Enable automatic backups with
databaseBackup=true - Review audit logs: Regularly check the audit log for suspicious activity
- Minimal permissions: Only give users the minimum role they need