Authentication Methods
Snipe-IT supports multiple authentication methods:- Local Authentication - Built-in username/password authentication
- LDAP/Active Directory - Integration with directory services
- SAML 2.0 - Single Sign-On with enterprise identity providers
- Two-Factor Authentication (2FA) - TOTP-based second factor
Local Authentication
Users are authenticated against theusers table using Laravel’s built-in authentication system (configured in config/auth.php:16-19):
.env
Increasing
BCRYPT_ROUNDS makes password hashing more computationally expensive, providing better protection against brute-force attacks at the cost of slower authentication..env
Login Throttling
Protect against brute-force attacks with login throttling:.env
Number of failed login attempts before the account is temporarily locked.
Duration in seconds that the account remains locked after exceeding max attempts.
Enable browser autocomplete on the login form. Set to
false for security compliance.config/auth.php:101-104:
Password Reset Security
.env
How many minutes before a password reset link expires (default: 15 minutes).
How many seconds before requiring password re-confirmation for sensitive actions (default: 3 hours).
Rate limit for password reset requests per minute.
Two-Factor Authentication (2FA)
Snipe-IT implements TOTP (Time-based One-Time Password) 2FA using the Google2FA package.Enabling 2FA
Two-factor authentication can be:- Optionally enabled by individual users
- Enforced globally for all users (via Settings > Security)
- Enforced for specific users (via user edit)
2FA Configuration
Configure 2FA settings in.env:
.env
config/google2fa.php:8-75.
Master switch for 2FA functionality. Set to
false to completely disable 2FA.How long (in minutes) before users must re-enter their 2FA code.
0 means eternal - users only authenticate once per session.Renew the 2FA session lifetime on each request. When
true, users stay authenticated as long as they’re active.Setting Up 2FA as a User
- Click on your name in the top-right corner
- Select Account Settings
- Go to the Security tab
- Click Enable Two-Factor Authentication
- Scan the QR code with an authenticator app (Google Authenticator, Authy, 1Password, etc.)
- Enter the 6-digit code to confirm
- Save your recovery codes in a secure location
Enforcing 2FA for All Users
As an administrator:- Navigate to Settings > Security
- Enable Require Two-Factor Authentication
- Save settings
2FA Implementation Details
The 2FA workflow is implemented inapp/Http/Controllers/Auth/LoginController.php:398-437:
Resetting User 2FA
Administrators can reset a user’s 2FA if they lose access to their authenticator:- Navigate to People > Users
- Edit the user
- Click Reset Two-Factor Authentication
- Confirm the reset
app/Http/Controllers/Api/UsersController.php:828).
2FA Permissions
Users need theself.two_factor permission to manage their own 2FA settings (config/permissions.php:452-453):
API Authentication
Snipe-IT uses Laravel Passport for OAuth2-based API authentication.API Token Expiration
.env
How many years before API personal access tokens expire.
config/passport.php:16:
Generating API Tokens
Users can generate personal API tokens:- Go to Account Settings
- Click the API Tokens tab
- Click Create New Token
- Give the token a name (e.g., “Mobile App”, “Automation Script”)
- Copy the token immediately - it won’t be shown again
Using API Tokens
Include the token in theAuthorization header:
API Rate Limiting
Protect your API from abuse with rate limiting:.env
Maximum API requests allowed per minute per IP address.
429 Too Many Requests response.
API Token Permissions
Theself.api permission controls whether users can create their own API tokens (config/permissions.php:457-459):
CSRF Protection
Cross-Site Request Forgery (CSRF) protection is enabled by default for all POST, PUT, PATCH, and DELETE requests.CSRF Configuration
TheVerifyCsrfToken middleware is automatically applied to all web routes (app/Http/Middleware/VerifyCsrfToken.php).
API routes (under
/api/*) are exempt from CSRF protection as they use token-based authentication.CSRF Token in Forms
Blade templates automatically include CSRF tokens:Content Security Policy (CSP)
Enable CSP to mitigate XSS attacks:.env
Enable Content Security Policy headers. Test thoroughly before enabling in production.
Comma-separated list of additional URLs to whitelist in the CSP policy (e.g., CDNs, external fonts).
Security Headers
Configure additional security headers:.env
Allow Snipe-IT to be embedded in iframes. Keep
false to prevent clickjacking attacks.Controls how much referrer information is sent with requests. Options:
no-referrer, same-origin, strict-origin, etc.Enable HTTP Strict Transport Security, forcing browsers to only use HTTPS.Only enable if you have a valid SSL certificate and all traffic is HTTPS.
Comma-separated list of trusted proxy IP addresses (load balancers, reverse proxies).Required for correct IP detection when behind a proxy.
Comma-separated list of origins allowed to make cross-origin requests to your API.
Session Security
Configure secure session handling:.env
Where to store session data. Options:
file, database, redis, memcached.Use redis or memcached for multi-server deployments.Session lifetime in minutes (12000 = ~8 days).
Only transmit cookies over HTTPS. Enable this in production with SSL.
Encrypted Custom Fields
Sensitive custom field data can be encrypted at rest: When creating a custom field, enable the Encrypt Field option. The data is encrypted using yourAPP_KEY.
Encryption is handled in app/Models/CustomField.php:389-396:
assets.view.encrypted_custom_fields controls who can view encrypted field values.
Permission System
Snipe-IT uses a granular permission system defined inconfig/permissions.php.
Permission Structure
Permissions follow the pattern:{resource}.{action}
Examples:
assets.view- View assetsassets.create- Create assetsassets.edit- Edit assetsassets.delete- Delete assetsassets.checkout- Checkout assetsassets.checkin- Checkin assets
Role Hierarchy
- Superuser - Full access to everything, bypasses all permission checks
- Admin - Administrative access to most features
- Custom Roles - Granular permission assignments
Managing Roles and Permissions
- Navigate to People > Permissions
- Click Create New to create a custom role
- Select the specific permissions to grant
- Assign users to the role
- Go to People > Users
- Edit the user
- Select their Permission Group
- Save
Security Best Practices
Enable 2FA for all admins - Require two-factor authentication for all users with administrative permissions.
Use strong APP_KEY - Generate a secure random key using
php artisan key:generate. Never share or commit your .env file.Enable HTTPS - Always use SSL/TLS in production. Set
SECURE_COOKIES=true and APP_FORCE_TLS=true.Limit API access - Only grant API token permissions to users who need it. Use service accounts with minimal permissions for integrations.
Regular security updates - Keep Snipe-IT updated to the latest version to receive security patches.
Audit user permissions - Regularly review user roles and permissions to ensure least privilege access.
Monitor login attempts - Review failed login attempts in the activity log to detect potential attacks.
Backup encryption keys - Include
.env in your backup strategy (stored securely!) to ensure you can recover encrypted data.SAML Authentication
For enterprise Single Sign-On:.env
When enabled, all users must authenticate via SAML. Local authentication is disabled.
Application Security
Force TLS/HTTPS
.env
Redirect all HTTP requests to HTTPS. Only enable if SSL is properly configured.
Allow insecure SSL connections (self-signed certificates). Never enable in production.
Application Lock
.env
true, the application is locked and shows a maintenance page to all users except super admins.
Troubleshooting
”CSRF Token Mismatch” Error
Causes:- Session expired
- Session driver misconfigured
- Proxy/load balancer not forwarding headers correctly
- Add proxy IPs to
APP_TRUSTED_PROXIES - Check session configuration
- Clear browser cookies
Users Can’t Enable 2FA
Check:OTP_ENABLED=truein.env- User has
self.two_factorpermission - Server time is synchronized (TOTP is time-based)
API Returns 401 Unauthorized
Verify:- Token is included in
Authorization: Bearer {token}header - Token hasn’t expired
- User account is active and not locked
Next Steps
Configuration
Configure environment and application settings
Backups
Set up secure backup procedures
Users
Manage users and permissions
API Documentation
Secure API integration guide
