Last Updated: 3/8/2026
Security Best Practices
Overview
LinkAce is designed with security in mind, but proper configuration and deployment practices are essential for maintaining a secure installation.
Authentication & Authorization
Password Security
Strong Password Requirements:
- Minimum 8 characters (configurable)
- Mix of uppercase, lowercase, numbers, and symbols recommended
- Passwords are hashed using bcrypt with a cost factor of 10
Best Practices:
# In .env file
BCRYPT_ROUNDS=12 # Increase for stronger hashing (slower)Multi-User Access Control
- Each user has isolated data by default
- Sharing is explicit (opt-in per link/list/tag)
- Admin users have full system access
User Roles:
- Regular User: Can manage own links, tags, lists
- Admin: Full system access, user management, system settings
API Token Security
Token Generation:
- Tokens are randomly generated (64 characters)
- Hashed before storage (SHA-256)
- Only shown once during creation
Best Practices:
- Rotate tokens regularly: Delete and recreate periodically
- Limit scope: Use separate tokens for different integrations
- Monitor usage: Check
last_used_attimestamp - Revoke unused tokens: Delete tokens no longer needed
Rate Limiting:
# In .env file
API_RATE_LIMIT=60 # Requests per minute per tokenSingle Sign-On (SSO)
LinkAce supports OAuth 2.0 and OIDC for enterprise authentication:
Supported Providers:
- Generic OAuth 2.0
- Generic OIDC (OpenID Connect)
- Custom providers (Keycloak, Authentik, etc.)
Configuration: See SSO Configuration Guide
Security Considerations:
- Validate redirect URIs
- Use HTTPS for OAuth callbacks
- Verify token signatures
- Implement token refresh
Application Security
HTTPS/TLS
Always use HTTPS in production:
# In .env file
APP_URL=https://your-domain.com
SESSION_SECURE_COOKIE=trueTLS Configuration:
- Use TLS 1.2 or higher
- Strong cipher suites only
- Enable HSTS (HTTP Strict Transport Security)
Nginx Example:
server {
listen 443 ssl http2;
server_name your-domain.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
# ... rest of configuration
}Session Security
Session Configuration:
# In .env file
SESSION_DRIVER=database # Or redis for better security
SESSION_LIFETIME=120 # Minutes
SESSION_SECURE_COOKIE=true # HTTPS only
SESSION_HTTP_ONLY=true # Prevent JavaScript access
SESSION_SAME_SITE=lax # CSRF protectionSession Timeout:
- Default: 120 minutes (2 hours)
- Adjust based on security requirements
- Shorter timeouts = better security, worse UX
CSRF Protection
LinkAce uses Laravel’s built-in CSRF protection:
- All POST, PUT, PATCH, DELETE requests require CSRF token
- Tokens are automatically included in forms
- API endpoints use token authentication instead
Verification:
// Automatically verified by middleware
// No additional configuration neededXSS Prevention
Output Escaping:
- Blade templates escape by default:
{{ $variable }} - Raw output only when necessary:
{!! $trustedHtml !!} - User input is sanitized before storage
Content Security Policy (CSP):
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';" always;SQL Injection Prevention
- All database queries use Eloquent ORM or query builder
- Parameterized queries prevent SQL injection
- Never use raw queries with user input
Safe Query Example:
// Safe - uses parameter binding
$links = Link::where('user_id', $userId)->get();
// Unsafe - never do this
$links = DB::select("SELECT * FROM links WHERE user_id = $userId");Infrastructure Security
Docker Security
Best Practices:
-
Run as non-root user:
USER www-data -
Limit container capabilities:
# docker-compose.yml services: app: cap_drop: - ALL cap_add: - CHOWN - SETGID - SETUID -
Use read-only root filesystem:
services: app: read_only: true tmpfs: - /tmp - /var/run -
Scan images for vulnerabilities:
docker scan linkace/linkace:latest
Database Security
MySQL/PostgreSQL:
-
Use strong passwords:
DB_PASSWORD=<strong-random-password> -
Limit network access:
- Bind to localhost only
- Use firewall rules
- Docker network isolation
-
Regular backups:
- Automated daily backups
- Test restore procedures
- Encrypt backup files
-
Keep database updated:
- Apply security patches promptly
- Monitor security advisories
Redis Security
Configuration:
# redis.conf
requirepass your-strong-password
bind 127.0.0.1
protected-mode yesEnvironment:
REDIS_PASSWORD=your-strong-passwordFile Upload Security
LinkAce doesn’t currently support direct file uploads, but if extended:
- Validate file types: Whitelist allowed extensions
- Scan for malware: Use antivirus scanning
- Limit file size: Prevent DoS attacks
- Store outside webroot: Serve via application
- Randomize filenames: Prevent directory traversal
Environment Security
Environment Variables
Protect .env file:
# Set proper permissions
chmod 600 .env
chown www-data:www-data .envNever commit .env to version control:
.env
.env.local
.env.*.localRequired Security Settings:
APP_ENV=production
APP_DEBUG=false
APP_KEY=<32-character-random-key>
APP_URL=https://your-domain.com
SESSION_SECURE_COOKIE=true
SESSION_HTTP_ONLY=true
SESSION_SAME_SITE=laxDebug Mode
NEVER enable debug mode in production:
APP_DEBUG=false # Always false in productionDebug mode exposes:
- Stack traces with code snippets
- Environment variables
- Database queries
- File paths
Application Key
Generate a strong application key:
php artisan key:generateRotate periodically:
- Invalidates all sessions
- Requires all users to log in again
- Recommended after security incidents
Monitoring & Logging
Security Logging
Log Important Events:
- Failed login attempts
- API token usage
- Admin actions
- Permission changes
Log Locations:
# Application logs
storage/logs/laravel.log
# Web server logs
/var/log/nginx/access.log
/var/log/nginx/error.logFailed Login Monitoring
Laravel tracks failed login attempts:
- Rate limiting after multiple failures
- Temporary account lockout
- Log suspicious activity
Intrusion Detection
Recommended Tools:
- Fail2ban: Block IPs with repeated failed attempts
- OSSEC: Host-based intrusion detection
- ModSecurity: Web application firewall
Fail2ban Example:
# /etc/fail2ban/jail.local
[linkace]
enabled = true
port = http,https
filter = linkace
logpath = /var/www/linkace/storage/logs/laravel.log
maxretry = 5
bantime = 3600Update & Patch Management
Keep LinkAce Updated
-
Subscribe to security announcements:
- Watch GitHub repository
- Follow @LinkAceApp
-
Test updates in staging:
- Never update production directly
- Verify compatibility
- Test critical workflows
-
Apply security patches promptly:
- Review changelog
- Backup before updating
- Follow upgrade guide
Dependency Updates
Check for vulnerabilities:
# PHP dependencies
composer audit
# JavaScript dependencies
npm auditUpdate dependencies:
composer update
npm updateBackup & Disaster Recovery
Backup Strategy
- Automated daily backups
- Offsite storage (S3, Backblaze B2)
- Encrypted backups
- Test restore procedures monthly
Configuration: See Application Backups
Disaster Recovery Plan
- Document recovery procedures
- Maintain offsite backups
- Test recovery process
- Define RTO/RPO targets
Security Checklist
Pre-Production
- HTTPS/TLS configured with valid certificate
-
APP_DEBUG=falsein.env -
APP_ENV=productionin.env - Strong
APP_KEYgenerated - Secure session configuration
- Strong database passwords
- Firewall configured
-
.envfile permissions set to 600 - File permissions properly set
- Security headers configured
Post-Production
- Automated backups configured
- Backup restore tested
- Monitoring and alerting set up
- Log rotation configured
- Update schedule established
- Security audit performed
- Intrusion detection configured
- Rate limiting tested
Ongoing Maintenance
- Review logs weekly
- Update dependencies monthly
- Test backups monthly
- Review user access quarterly
- Security audit annually
- Rotate API tokens annually
Reporting Security Issues
If you discover a security vulnerability:
- DO NOT open a public GitHub issue
- Email security details to the maintainer privately
- See SECURITY.md for contact info
- Allow time for patch before public disclosure