Core Security Features
The application provides enterprise-grade security through several key mechanisms:Domain Restriction
Limit access to users from specific email domains using OAuth authentication
Address Validation
Comprehensive validation prevents dangerous or invalid network addresses
Ownership Controls
Users can only modify resources they created, with admin override
API Token Security
Secure storage and handling of NetBird API credentials
Authentication & Authorization
OAuth Integration
NetBird Selfservice uses OAuth 2.0 for secure authentication:- Google Workspace Integration: Primary authentication method via Google OAuth
- Domain Restriction: Optional enforcement of allowed email domains
- Stateless Sessions: Secure session management with Laravel Sanctum
- Automatic User Provisioning: Users are created on first successful login
The OAuth implementation is extensible and supports any Laravel Socialite provider, not just Google.
Role-Based Access Control
The application implements a simple but effective permission model: Regular Users:- View their own resources
- Create new resource requests (requires approval)
- Edit and delete their own resources
- Cancel pending requests
- All regular user permissions
- Approve or deny resource requests
- Manage all resources regardless of owner
- Access activity logs
- Direct resource creation (no approval needed)
Address Validation & Blocking
Blocked Address Ranges
To protect your network infrastructure, the following address ranges are automatically blocked:Validation Rules
Every resource address must pass validation:- Format Validation: Must be a valid IPv4, IPv6, CIDR notation, or domain name
- Blocked Range Check: Compared against the blocked CIDR list
- Wildcard Prevention: Overly broad wildcards like
*or*.*are rejected - Domain Validation: Domain names must follow RFC standards (max 253 chars, labels max 63 chars)
Example validation code
Example validation code
Session Security
Session Management
NetBird Selfservice uses Laravel’s robust session management:- Database Storage: Sessions stored in database for scalability
- 120-minute Default Lifetime: Configurable via
SESSION_LIFETIME - HTTP-Only Cookies: Prevents XSS attacks by blocking JavaScript access
- SameSite Protection: Default
laxsetting mitigates CSRF attacks - Session Regeneration: Token regenerated on logout to prevent fixation attacks
For production environments, enable
SESSION_SECURE_COOKIE=true to ensure cookies are only transmitted over HTTPS.API Token Protection
NetBird API Token
TheNETBIRD_API_TOKEN is the most sensitive credential in the application:
- Full Network Access: Has complete control over your NetBird network
- Environment Variable Storage: Never committed to version control
- Server-Side Only: Token is never exposed to client-side code
- Encrypted at Rest: Laravel encrypts sensitive environment variables
Generic Error Messages
To prevent information disclosure, the application implements generic error messaging:- Internal Logging: Detailed errors logged server-side via
report() - Generic User Messages: Users see friendly, non-technical error messages
- No Stack Traces: Production mode hides detailed error information
Activity Logging
All resource operations are logged for audit purposes:- Comprehensive Tracking: Create, update, delete, approve, deny actions
- User Attribution: Every action links to the performing user
- Resource Details: Full details of what changed and when
- Tamper-Resistant: Logs are append-only database records
Domain Restriction Enforcement
WhenNETBIRD_ALLOWED_DOMAIN is configured, the application enforces strict domain checking:
- Case-Insensitive Matching: Prevents bypass via case variation
- Post-OAuth Check: Validates after successful OAuth but before account creation
- Rejection Message: Clear feedback to unauthorized users
Domain restriction is optional but strongly recommended for production deployments to prevent unauthorized access.
Production Security Checklist
Before deploying to production:- Set
APP_ENV=production - Set
APP_DEBUG=false - Configure
NETBIRD_ALLOWED_DOMAIN - Use HTTPS exclusively (
APP_URLwith https://) - Enable
SESSION_SECURE_COOKIE=true - Rotate
APP_KEYfrom default - Secure
NETBIRD_API_TOKENwith proper permissions - Set strong database credentials
- Configure proper firewall rules
- Enable log monitoring and alerting
- Set up regular database backups
- Review and test OAuth callback URLs
Next Steps
Configuration
Learn how to configure security settings
Best Practices
Discover security best practices and recommendations