Security
Configure security policies, monitor audit logs, and manage security-related settings in SPEAR.
Security Overview
Section titled “Security Overview”Access the security dashboard at Admin > Security for:
- Security event summary
- Recent authentication activity
- Active session count
- Security alert status
Audit Logging
Section titled “Audit Logging”Logged Events
Section titled “Logged Events”SPEAR maintains comprehensive audit logs for security-relevant events:
| Category | Events |
|---|---|
| Authentication | Login, logout, failed attempts, password changes |
| Authorization | Permission changes, role assignments |
| Data Access | Report exports, portal access, data downloads |
| Administration | User creation, settings changes, backup operations |
| Security | Session terminations, API key operations |
Audit Log Fields
Section titled “Audit Log Fields”Each audit entry includes:
| Field | Description |
|---|---|
| Timestamp | When the event occurred |
| User | User who performed the action |
| Action | What action was performed |
| Resource | What was affected |
| IP Address | Source IP address |
| User Agent | Browser/client information |
| Details | Additional context |
Viewing Audit Logs
Section titled “Viewing Audit Logs”- Navigate to Admin > Security > Audit Log
- Use filters:
- Date range
- User
- Action type
- Resource type
- Click entries for details
- Export for analysis
Audit Log Retention
Section titled “Audit Log Retention”| Setting | Default | Range |
|---|---|---|
| Retention Period | 365 days | 90-730 days |
| Archive Destination | Local | Local/S3 |
Configure at Admin > Security > Audit Settings.
Session Management
Section titled “Session Management”Active Sessions
Section titled “Active Sessions”View and manage all active sessions:
- Navigate to Admin > Security > Sessions
- View session list with:
- User
- IP Address
- Device/Browser
- Last Activity
- Session Start
Session Actions
Section titled “Session Actions”| Action | Effect |
|---|---|
| View Details | See full session information |
| Revoke | End the session immediately |
| Revoke All (User) | End all sessions for a user |
| Revoke All (System) | End all sessions (emergency) |
Session Policies
Section titled “Session Policies”Configure session behavior:
| Policy | Description | Default |
|---|---|---|
| Session Timeout | Inactive timeout | 24 hours |
| Absolute Timeout | Maximum session duration | 7 days |
| Concurrent Sessions | Max sessions per user | Unlimited |
| IP Binding | Lock session to IP | Disabled |
Access Control
Section titled “Access Control”Permission Verification
Section titled “Permission Verification”SPEAR verifies permissions at multiple levels:
flowchart TD
A[Request] --> B{Authenticated?}
B -->|No| C[401 Unauthorized]
B -->|Yes| D{Has Permission?}
D -->|No| E[403 Forbidden]
D -->|Yes| F{Resource Access?}
F -->|No| G[404 Not Found]
F -->|Yes| H[Process Request]
API Security
Section titled “API Security”| Protection | Description |
|---|---|
| Bearer Token | Token-based authentication |
| Rate Limiting | Request throttling |
| CORS | Cross-origin restrictions |
| Input Validation | Request sanitization |
Permission Escalation Prevention
Section titled “Permission Escalation Prevention”SPEAR prevents privilege escalation:
- Users cannot create users with higher privileges
- Users cannot modify their own permission level
- Group role assignments validated against modifier’s level
Security Alerts
Section titled “Security Alerts”Alert Types
Section titled “Alert Types”| Alert | Trigger | Severity |
|---|---|---|
| Failed Logins | Multiple failures from same IP | Medium |
| Unusual Access | Access from new location/device | Low |
| Permission Change | Admin permission granted | High |
| Data Export | Bulk data export | Medium |
| Session Anomaly | Multiple concurrent sessions | Low |
Alert Configuration
Section titled “Alert Configuration”- Navigate to Admin > Security > Alerts
- Enable/disable alert types
- Set thresholds:
- Failed login attempts
- Time windows
- Geographic sensitivity
- Configure notifications
Alert Actions
Section titled “Alert Actions”For triggered alerts:
- Review alert details
- Investigate the activity
- Take action if needed:
- Lock user account
- Revoke sessions
- Block IP address
- Mark as resolved
IP Management
Section titled “IP Management”IP Allowlist
Section titled “IP Allowlist”Restrict access to specific IPs:
- Navigate to Admin > Security > IP Rules
- Click Add Allowlist Entry
- Enter IP or CIDR range
- Add description
- Enable allowlist mode
IP Blocklist
Section titled “IP Blocklist”Block malicious IPs:
- Navigate to Admin > Security > IP Rules
- Click Add Blocklist Entry
- Enter IP or CIDR range
- Add reason
- Save
Automatic Blocking
Section titled “Automatic Blocking”Configure automatic IP blocking:
| Setting | Description |
|---|---|
| Failed Login Threshold | Block after X failures |
| Block Duration | How long to block |
| Whitelist | IPs exempt from blocking |
Data Protection
Section titled “Data Protection”Encryption
Section titled “Encryption”SPEAR encrypts sensitive data:
| Data Type | Encryption |
|---|---|
| Passwords | bcrypt hashing |
| Sensitive Fields | AES-256 (using SPEAR_ENCRYPTION_KEY) |
| Session Tokens | Cryptographically random |
| API Tokens | Secure random generation |
Data Access Controls
Section titled “Data Access Controls”| Control | Implementation |
|---|---|
| Row-Level Security | PocketBase rules |
| Field-Level Access | Schema permissions |
| Export Controls | Permission-based |
Security Headers
Section titled “Security Headers”SPEAR applies security headers:
| Header | Value | Purpose |
|---|---|---|
| X-Content-Type-Options | nosniff | Prevent MIME sniffing |
| X-Frame-Options | DENY | Prevent clickjacking |
| X-XSS-Protection | 1; mode=block | XSS filter |
| Strict-Transport-Security | max-age=31536000 | Force HTTPS |
| Content-Security-Policy | Configured | Script/style restrictions |
CSP Configuration
Section titled “CSP Configuration”Configure Content Security Policy:
- Navigate to Admin > Security > Headers
- Modify CSP directives
- Test in report-only mode
- Enable enforcement
Vulnerability Reporting
Section titled “Vulnerability Reporting”Security Contact
Section titled “Security Contact”Report security vulnerabilities:
- Email: security@mwgroup.io
- Include:
- Description of vulnerability
- Steps to reproduce
- Potential impact
- Your contact information
Responsible Disclosure
Section titled “Responsible Disclosure”SPEAR follows responsible disclosure:
- Report received and acknowledged
- Issue investigated and verified
- Fix developed and tested
- Update released
- Credit given (if desired)
Security Checklist
Section titled “Security Checklist”Initial Setup
Section titled “Initial Setup”- Set strong SPEAR_ENCRYPTION_KEY
- Enable HTTPS (Traefik SSL)
- Create admin account with strong password
- Configure session timeout
- Set up backup encryption
Ongoing
Section titled “Ongoing”- Review audit logs weekly
- Monitor security alerts
- Update to latest version
- Review user permissions quarterly
- Test backup restoration
- Rotate API keys annually
Hardening
Section titled “Hardening”- Enable IP allowlist (if applicable)
- Configure failed login blocking
- Set strict session policies
- Enable MFA (when available)
- Review CSP configuration
Compliance
Section titled “Compliance”Data Handling
Section titled “Data Handling”SPEAR supports compliance requirements:
| Requirement | Support |
|---|---|
| Audit Logging | Comprehensive event logging |
| Access Control | RBAC with granular permissions |
| Data Encryption | At-rest and in-transit |
| Data Retention | Configurable retention periods |
| Data Export | Full data export capability |
Reports
Section titled “Reports”Generate compliance reports:
- Navigate to Admin > Security > Reports
- Select report type:
- Access Report
- Audit Summary
- Permission Matrix
- Set date range
- Generate and download
Troubleshooting
Section titled “Troubleshooting”Account Locked
Section titled “Account Locked”- Check audit log for failed attempts
- Clear blocklist entry if IP blocked
- Reset password if needed
- Investigate source of failed attempts
Permission Issues
Section titled “Permission Issues”- Verify user’s group membership
- Check group’s assigned roles
- Review permission level requirements
- Check audit log for changes
Session Problems
Section titled “Session Problems”- Check session timeout settings
- Verify secure cookie settings
- Check for IP changes (VPN)
- Clear browser cookies and retry