Security
Reporting vulnerabilities
Section titled “Reporting vulnerabilities”If you believe you have found a security vulnerability in SpartanAuth, please do not open a public GitHub issue.
Send a message to security@masonitestudios.com with:
- A description of the vulnerability
- Steps to reproduce
- Potential impact
- Any suggested mitigations (optional)
We will acknowledge receipt promptly and work with you to understand and resolve the issue before any public disclosure.
Security model
Section titled “Security model”JWT signing
Section titled “JWT signing”SpartanAuth signs JWTs with an RSA private key. Verification uses the corresponding public key. As long as your private key is kept secret, tokens cannot be forged.
Tokens include an expiry (exp) claim. Expired tokens are rejected by the introspection endpoint. Each sector chooses that lifetime in its security settings, from 1 second through 7 days. The dashboard asks for whole hours. Saving those settings applies the lifetime to the sector you are viewing. On the tenant root, Apply to all sectors writes the same lifetime to every sector in the organization. An unset sector uses the platform default, 4 hours. SpartanAuth cannot end a token early. A copied token keeps working until it expires. Deleting the account makes introspection fail. Changing the password does not. Tokens already issued keep the expiry they were given.
Authenticator secrets
Section titled “Authenticator secrets”TOTP shared secrets and recovery-code hashes are stored in the tenant database with the user’s other credentials. They are not written to the platform catalog. Enrollment returns the shared secret once. Later list calls return the display name only. Recovery codes are returned only the first time the user has none. Rotating the RSA signing key does not erase these enrollments.
Sign-in lockout
Section titled “Sign-in lockout”Each sign-in factor has its own counter: password, email or SMS code, authenticator (including recovery codes and enrollment confirmation), and passkey. Email and SMS share one counter. A correct code clears that factor. Consecutive failures count, and at the limit the factor stays locked until the unlock time. A later check during the lock is rejected and does not move the unlock time. After the lock expires, the next check starts again at zero.
The platform default is 5 failures and 15 minutes. A sector can set 3 to 100 failures and 5 to 30 minutes. Zero on the sector uses the platform value. A completed password reset clears the password lock and the reset-code counter. It leaves the other factors locked. Guessing reset codes uses the same limits and does not lock sign-in.
Breached passwords
Section titled “Breached passwords”SpartanAuth records whether each current password appears in the Have I Been Pwned Pwned Passwords list. Only the first five characters of the SHA-1 hash are sent. The password and the email address are not. A failed guess is not checked. The result is not placed on the access token, introspection, or the OIDC profile.
Both sector controls default to off, so you can read the risk on Home and in the user list before anyone is blocked. Reject breached passwords refuses a new password that is in the list. Require reset of breached passwords stops password sign-in after a correct password that is already known to be breached, and returns challenge type pwned_password with no token. That attempt cannot be finished with a second factor. The user sets a new password through the usual email reset. Passkey and email-code sign-in continue. A signed-in password change always refuses a breached replacement.
If the breach list does not answer when a password would be refused, the password is not saved and an invite or reset code is not consumed. At sign-in, a password already recorded as breached still cannot finish sign-in while the reset requirement is on. A password with no stored result is allowed through.
See Breached passwords for how to turn the settings on and for the administrator and end-user experience. Use a login widget that understands pwned_password before requiring a reset.
Sector isolation
Section titled “Sector isolation”Each sector is an isolated namespace. Users, credentials, and settings in one sector have no access to or visibility into another sector. Tenant root admins can administer every app sector in their organization; app-sector admins and API keys cannot. End-user tokens are always bound to a single sector — the app sector the widget used, not the tenant root.
Server-side verification
Section titled “Server-side verification”JWTs must always be verified server-side via the introspection endpoint before making authorization decisions. Client-side JWT decoding is for display purposes only.
Soft deletes
Section titled “Soft deletes”When a profile is deleted, its PII (email, name, etc.) is cleared immediately, but the sub identifier is retained for referential integrity. This prevents your application database from having orphaned records if it uses sub as a foreign key.
Integration best practices
Section titled “Integration best practices”| Practice | Why |
|---|---|
| Store your sector ID in an environment variable | Avoid hardcoding it; makes environment-switching trivial |
| Store API keys in a secrets manager, not source code | API keys grant admin access to their sector (tenant-root keys can administer every app sector) |
| Store service secrets in a secrets manager, and cache the one-hour token | The secret lets that program call your other programs. It cannot administer SpartanAuth. Minting on every request will hit the hourly limit |
| Always verify tokens server-side | Client-side JWT decoding is not verification |
Use sub (not email) as the foreign key in your database | Emails can change; sub is stable and permanent |
| Configure Allowed Origins before testing the login widget | Without a matching origin, all browser-based login attempts are blocked — this is intentional and a security feature |
| Remove development CORS origins before going to production | localhost:5173 should not be an allowed origin in prod |
| Rotate RSA keys if the private key is ever exposed | Existing tokens become forgeable with a compromised key |
| Disable self sign-up for internal or B2B applications | Only allow the user population you control |
Why allowed origins are required
Section titled “Why allowed origins are required”SpartanAuth enforces per-sector origin validation on all authentication endpoints (password, OTP, WebAuthn, OAuth). This prevents a phishing attack where a malicious actor registers their own sector, whitelists an attacker-controlled site, and points the login widget at your sector’s ID to intercept your users’ credentials.
The consequence is that any browser-based login attempt from an origin not listed in your sector’s Domain or Allowed Origins will receive a 403 Forbidden response. This is by design — configure your origins and the widget will work immediately.