Skip to main content

Threat model

This is a STRIDE threat model of an Idenplane deployment: the server (src/), the admin console (admin-ui/), the hosted login and account pages (themes/), and what they talk to. It is written from the code as of 0.10.0 and updated for 0.11.0 (admin console MFA). Each mitigation names the file or feature that implements it; each residual risk is what is left after it.

It complements the OWASP ASVS self-assessment, which goes requirement by requirement, and the secure defaults.

Scope and assumptions​

In scope: the Idenplane server and its admin, OAuth/OIDC, SAML IdP, SCIM, account and hosted-login endpoints; the admin console; the official Docker image and Helm chart; the integrations Idenplane initiates (SMTP and email APIs, SMS providers, LDAP, external IdPs, webhooks, audit streams, back-channel logout).

Assumptions. The model relies on these. If one does not hold, the matching threats get worse.

  1. TLS terminates at a reverse proxy or ingress in front of the server (the app listens on plain HTTP). The proxy redirects HTTP to HTTPS and forwards only to Idenplane. The optional mTLS listener is the one place the server terminates TLS itself.
  2. TRUSTED_PROXIES names only that proxy. The client IP used by rate limits, lockout records and audit events comes from X-Forwarded-For only when the peer is trusted (src/common/utils/proxy-ip.util.ts). TRUSTED_PROXIES=* trusts everyone.
  3. PostgreSQL and Redis are on a private network reachable only by Idenplane, with their own credentials.
  4. The host is trusted. Whoever controls the container, the Kubernetes namespace or the environment variables controls Idenplane: they hold the encryption key, the database credentials and the admin API key.
  5. Plugins are trusted code. A plugin runs in the server process with its full privileges (src/plugins/plugin-loader.service.ts).
  6. Operators keep secrets secret: ENCRYPTION_KEY/WEBHOOK_SECRET_KEY, ADMIN_API_KEY, ADMIN_PASSWORD, DATABASE_URL, provider API keys.

Out of scope: the security of relying-party applications themselves, of external IdPs and LDAP directories, of SMTP and SMS providers, of the browser and the user's device; physical and social-engineering attacks; denial of service by volume (that is the proxy's or the platform's job); vulnerabilities in third-party dependencies not yet disclosed upstream.

Assets​

AssetWhere it livesWhy it matters
User credentials: password hashes, TOTP secrets, recovery codes, passkey public keys, phone numbersPostgreSQL (users, user_credentials, recovery_codes, webauthn_credentials)Account takeover, credential stuffing elsewhere. Passwords are argon2id; TOTP secrets and phone numbers are encrypted at rest.
Tokens: access, ID, refresh and offline tokens, authorization codes, device codes, magic-link and reset tokensAccess and ID tokens are signed JWTs held by clients; refresh tokens, codes and one-time tokens are stored as SHA-256 hashesSession hijacking, impersonation of users towards relying parties.
Signing keys (per realm, RSA)realm_signing_keys, private key encrypted at restForging any token for any user of the realm, until the key is retired: an admin can rotate it and retire the old one at once (POST /admin/realms/{realm}/keys/rotate with retirePrevious).
Encryption keys (AES-256-GCM key ring)Environment (ENCRYPTION_KEY or WEBHOOK_SECRET_KEY, previous key for rotation)Decrypting every secret stored at rest.
Sessions: SSO sessions, OAuth sessions, admin sessionslogin_sessions, sessions (hashed tokens); browser cookies; admin access token in console memory, refresh in an HttpOnly cookieActing as the user or admin without credentials.
Admin access: super-admin, realm-admin, view-only accounts; ADMIN_API_KEYMaster realm users; environmentFull control of every realm.
Realm configuration: clients and secrets, redirect URIs, IdP and LDAP settings, SMTP/SMS provider secrets, flows, themesPostgreSQL; secrets encrypted at rest (src/crypto/stored-secrets.ts, src/secrets-at-rest/)A changed redirect URI, IdP or flow is a takeover of every user of the realm.
PII: names, emails, phone numbers, IP addresses, user agents, login history, custom attributesPostgreSQL; logs; events; outbound email and SMSPrivacy and regulatory exposure.
Audit trail: login and admin events, NHI audit logs, upgrade auditPostgreSQL; optional audit streamsDetection and forensics; an attacker wants to erase it.

Cryptographic inventory​

PurposeAlgorithm and parametersCode
Password hashingargon2id, 64 MiB, t=3, p=4; passwords up to 1024 characters; concurrency cappedsrc/crypto/crypto.service.ts
Imported legacy hashesbcrypt, PBKDF2 and others, verified once then rehashed to argon2idsrc/migration/password-migration.service.ts
Token signingRS256, one RSA 2048 key pair per realm (key id in the header)src/crypto/jwk.service.ts
Secrets at restAES-256-GCM, random 96-bit IV, key id bound as AAD; key derived with scrypt; previous key kept for rotationsrc/crypto/key-ring.ts
Opaque tokens (refresh, session, codes, reset, magic link)256- to 512-bit values from crypto.randomBytes, stored as SHA-256src/crypto/crypto.service.ts
OTP codescrypto.randomInt, 6+ digits; SMS codes bound to the flow with HMAC-SHA256src/sms/sms-otp.service.ts, src/auth-flow/email-otp.service.ts
TOTPRFC 6238, HMAC-SHA1 (authenticator-app compatibility), 160-bit secretsrc/mfa/mfa.service.ts
Recovery codes120-bit random (base32), SHA-256 with an rc2$ prefix; codes from before 0.11.0 rewrapped as Argon2id(old SHA-256)src/mfa/recovery-codes.ts, src/mfa/recovery-code-rewrap.service.ts
Webhook signaturesHMAC-SHA256src/webhooks/
SAMLAssertions and responses signed with XML-DSig RSA-SHA256. AuthnRequests verified with RSA-SHA256 or RSA-SHA512 (SHA-256/512 digests); SHA-1 refusedsrc/saml/saml-idp.service.ts, src/saml/saml-request-verifier.ts
mTLSX.509 path validation per realm, x5t#S256 thumbprints, TLS 1.2+ on the listenersrc/client-auth/, src/mtls/

Trust boundaries and data flows​

The main flows:

Admin flow: the console signs in at POST /admin/auth/login against the master realm (lockout checked first). An admin with a second factor answers it at /admin/auth/login/mfa or /login/passkey (0.11.0); then the console gets a one-hour admin JWT (typ: admin, with amr, acr and auth_time) and an HttpOnly refresh cookie. Every admin request goes through AdminApiKeyGuard (authentication) and AdminAuthorizationGuard (role and realm scope, read from the database on each request).

Threats by boundary​

Each table lists the STRIDE category (S spoofing, T tampering, R repudiation, I information disclosure, D denial of service, E elevation of privilege), the threat, the mitigation in the code, and the residual risk.

ThreatMitigationResidual risk
SOnline password guessing and credential stuffingBrute-force lockout, on by default for new realms, checked before any credential check (src/brute-force/, src/login/login.service.ts, src/realms/realm-security-defaults.ts); optional per-IP and per-user rate limits (src/rate-limit/), CAPTCHA, MFA, passkeysRealms created before 0.10.0 may still have lockout off; rate limits are opt-in; no breached-password check
SA locked account used as a password oracleThe lock is checked before the password, LDAP bind or device approval; same answer for right and wrong passwords (test/secure-realm-defaults.e2e-spec.ts)The "locked" message reveals that the account exists
DLockout used to keep a user outTemporary 5-minute lock, no permanent lockout by default, admin unlock, events and log on every lockoutA known username can be kept locked by an attacker who keeps trying
TCSRF on login, consent, account and MFA formsDouble-submit CSRF tokens (src/common/csrf/), SameSite cookiesAccount-console logout is a GET (ASVS V3.5.3)
TXSS in themed pagesHandlebars auto-escaping, nonce-based CSP, frame-ancestors 'none' (src/theme/theme-render.service.ts)Admin-supplied custom CSS is filtered by blocklist; request values in inline JS are HTML-escaped only
SSession fixation and theftNew session token at sign-in, token stored hashed, HttpOnly; Secure; SameSite=Lax cookie scoped to the realm path (src/login/session-issuer.service.ts)The SSO idle timeout (ssoSessionIdleTimeout, 0.12.0) is off by default; no __Host- prefix
IAccount enumeration through reset and registrationGeneric answers on forgot-password; rate limitsTiming differs between known and unknown usernames (ASVS L3)
SOld sessions survive a credential changeA password reset or change, an admin password set and an admin MFA reset end every session, offline ones included, and revoke refresh tokens; the account console keeps only the session that made the change (src/sessions/sessions.service.ts, 0.12.0)Access tokens already issued stay valid until they expire (5 minutes by default)
ESecond-factor bypassServer-side pending-action state, single-use challenges, TOTP replay protection (src/mfa/, test/totp-replay.e2e-spec.ts); 120-bit recovery codes (0.11.0)—

2. Relying-party apps to OAuth, OIDC and SAML endpoints​

ThreatMitigationResidual risk
SCode interception or injectionCodes live 60 s and are single-use (atomic update, replay revokes the session); PKCE S256 required for public clients (src/oauth/oauth.service.ts, src/auth/auth.service.ts)PKCE is optional for confidential clients
SOpen redirect via redirect_uriExact string matching of registered URIs since 0.11.0, loopback port excepted (RFC 8252); fragments refused (src/common/redirect-uri.utils.ts)Clients upgraded with allowInsecureWildcardRedirectUris still match any path below a /* entry until an admin turns it off; /admin/upgrade/health lists them
SRefresh token theftRotation on every use; reuse revokes the session; tokens bound to the client and optionally to a client certificate (RFC 8705); the session's absolute expiry is checked at every refresh (src/sessions/session-lifetime.ts)An offline token is valid for offlineTokenLifespan (30 days by default) from sign-in, with no idle timeout; RP-initiated logout and the admin and reset paths end it, but a stolen one is usable until then
EToken confusion: ID, logout or admin tokens used as access tokensuserinfo, introspection and the WebSocket accept only typ: Bearer (src/tokens/access-token-type.ts); admin API requires typ: adminNo audience or issuer check at verification (ASVS V9.2.3)
SClient impersonationSecrets hashed; one auth method per request; tls_client_auth / self_signed_tls_client_auth with per-realm trust anchors (src/client-auth/)The password grant can still be enabled per client
TSAML request tampering, XML attacks, signature wrappingWhen the SP has a certificate, every AuthnRequest must be signed. HTTP-POST: one signature, on the root, referencing the root's ID, and every field read from the signed bytes; HTTP-Redirect: signature over the raw query bytes. No DTD, comments, processing instructions or duplicate IDs; SHA-1 refused; size limit before and during inflation (src/saml/saml-request-verifier.ts, src/saml/saml-request-hardening.spec.ts)SPs without a certificate send unsigned requests, which anyone can forge (the response still goes only to a registered ACS URL)
SReplay of a captured AuthnRequestIssueInstant at most 5 minutes old (plus 3 minutes of skew); Destination checked; each request ID accepted once per SP, by a unique row in PostgreSQL shared by every replica and worker (saml_request_ids, test/saml-request-replay.e2e-spec.ts)ForceAuthn and IsPassive are not acted on; SAML logout is not implemented
RDenying a sign-in or token issuanceLogin events on by default for new realms (src/events/)Older realms may have events off
IForced logout via RP-initiated logoutpost_logout_redirect_uri checkedGET logout without id_token_hint needs no confirmation (ASVS V10.6.2)

3. Admin console and admin API​

ThreatMitigationResidual risk
SAdmin password guessing or a stolen admin passwordMaster realm lockout on by default, per-IP admin login limit (src/admin-auth/admin-auth.service.ts), random initial password, weak passwords refused in production (src/admin-auth/admin-seed.service.ts). Since 0.11.0 a second factor at console sign-in (TOTP, passkey or recovery code) once the admin has one; wrong codes count towards the lockout. A server-wide requirement, on for new installs, confines an admin without a factor to enrolment (src/admin-mfa/, src/common/guards/admin-authorization.guard.ts, Admin console MFA)Off after an upgrade until a super-admin or ADMIN_MFA_REQUIRED turns it on (/admin/upgrade/health warns). While required, someone with the password of an admin who has no factor yet can enrol their own
EA realm-admin or view-only admin reaching other realms or the master realmGlobal AdminAuthorizationGuard, roles and realm assignments read from the database per request, master never in a realm-admin scope, DB trigger on assignments, child ids confined to the path realm (src/admin-rbac/, test/admin-rbac.e2e-spec.ts)—
SLeaked ADMIN_API_KEYPlaceholder keys refused in production; per-IP limits on API-key use; end-user MFA resets and unlocks refuse the key. Its admin MFA reset (break-glass) is always recorded as an admin eventThe key is static and grants super-admin, including resetting an admin's MFA
EStolen admin session used for sensitive changesRemoving a factor, new recovery codes, resetting another admin's MFA, turning the MFA requirement off, end-user MFA resets and unlocks need a second factor checked in the last 15 minutes (step-up, 0.11.0); the requirement can be pinned with ADMIN_MFA_REQUIRED=trueAn admin MFA reset does not end that admin's open sessions; they expire within an hour
TChanging a client, IdP or flow to take over a realmRole checks; admin events on by default for new realms; clearing events is super-admin onlyA compromised super-admin can do anything
ISecrets read back through the APIGETs mask secrets; export with secrets is super-admin only—
TAdmin XSSReact rendering; theme preview iframe sandboxed without same originConsole shares an origin with realm pages

4. Database (PostgreSQL)​

ThreatMitigationResidual risk
IDatabase dump or backup leaksPasswords argon2id; tokens and codes hashed (recovery codes 120-bit since 0.11.0, older ones rewrapped in Argon2id); signing keys, TOTP secrets, phone numbers and provider secrets encrypted with AES-256-GCM; encryption key not in the databaseEmails and other PII are plaintext
TSQL injectionPrisma throughout; raw SQL only with constants—
TRace conditions on counters and single-use valuesSerializable transactions with retry for lockout counting (test/brute-force-concurrency.e2e-spec.ts); atomic used=false updates for codesRegistration and password reset are not one transaction
EOver-privileged database role—One role runs migrations and the app

5. Redis​

ThreatMitigationResidual risk
TPoisoned cache (realm or client config)Redis is optional; cache entries are invalidated through the cache bus; authorization decisions read the databaseAnyone who can write to Redis can change cached config until it expires; production compose runs Redis without a password
DRedis downFalls back to the database and an in-memory token blacklist (src/tokens/token-blacklist.service.ts)A revoked token may pass on another instance until the database check

6. SMTP and SMS providers​

ThreatMitigationResidual risk
ICodes or links read in transitShort lifetimes, single use, flow bindingSMTP STARTTLS is opportunistic unless smtpSecure; SMS is weak by nature
TEmail HTML injectionTemplates escape values; the lockout email escapes username and realm name—
DSMS pumping and cost abusePer-user send limits and windows (src/sms/sms-otp.service.ts)—
IRecipients in logs—Provider adapters log email addresses and phone numbers at info level (ASVS V16.2.5)

7. External IdPs (brokering)​

ThreatMitigationResidual risk
SAccount linking to the wrong local userLinks keyed on (IdP, subject); email auto-link only with trustEmail and a verified email (src/broker/broker.service.ts)—
SLogin CSRF on the callbackPer-IdP callback; signed state; flow-path state bound to the browser transactionThe legacy path's state is not bound to the browser, and no PKCE is sent upstream
SForged upstream identityIdentity comes from the IdP's userinfo endpoint over TLS with the IdP's access tokenThe upstream ID token is not verified; upstream acr/amr ignored

8. LDAP​

ThreatMitigationResidual risk
TLDAP injectionFilter values escaped (src/user-federation/ldap.client.ts)Base filter is admin config
SPassword guessing through LDAPFailed binds count towards the lockout; a locked account is refused before the bind (0.10.0)—
IBind credentials or passwords in transitldaps/StartTLS with certificate verification; bind password encrypted at restPlain ldap:// is allowed if configured

9. mTLS proxy and listener​

ThreatMitigationResidual risk
SForged client-certificate headerHeader accepted only from MTLS_TRUSTED_PROXY_CIDRS matched against the socket peer; * refused; untrusted headers rejected or stripped; startup exits on bad config (src/mtls/, src/main.ts)Depends on the proxy stripping the header from clients
SCertificate accepted without a trusted pathHandshake proves possession only; trust decided per realm per request (CA flags, EKU, path length, deny-list)No CRL/OCSP yet (per-realm deny-list only)
EStolen bound token used without the keycnf x5t#S256 checked at userinfo, WebSocket and admin JWT auth—
DCertificate auth brute forcePer-(realm, thumbprint) failure budget—

10. Plugins, webhooks, audit streams and back-channel logout​

ThreatMitigationResidual risk
EMalicious pluginPlugins load only from the local plugins/ directory and installed packages; admin plugin routes are super-admin onlyA plugin runs with full server privileges; there is no sandbox
SSSRF through admin- or client-configured URLsWebhooks and the SMS webhook use safe-http-client (DNS pinning, private ranges blocked); back-channel logout and audit streams no longer follow redirects. Back-channel logout (0.13.0) refuses link-local and cloud-metadata targets, by literal and by every resolved address (assertNotLinkLocalTarget; opt-in BACKCHANNEL_LOGOUT_ALLOW_LINK_LOCAL). It deliberately allows private and loopback addresses: an admin-registered RP on the operator's network is legitimateBack-channel logout deliberately reaches private and loopback hosts. Version 0.13.1 pins its connection to a validated address and never follows redirects, closing the DNS-rebinding gap in 0.13.0. The explicit link-local override permits metadata access. Audit streams and broker calls do not use the SSRF guard
TForged webhook deliveriesHMAC-SHA256 signatures; secrets encrypted at rest—
IEvent data to third partiesAdmin-event redaction of sensitive fieldsReceivers get PII by design
IUser IPs to a geo-IP serviceOff unless adaptive auth or continuous verification is onSent over plain HTTP to ip-api.com

11. Container and Kubernetes host​

ThreatMitigationResidual risk
EContainer escape or privilege useNon-root user, allowPrivilegeEscalation: false, all capabilities dropped (Helm)Root filesystem is writable
ISecrets in environment variablesHelm existingSecret support; placeholders refused in productionEvery secret is visible to the whole process and to anyone who can read the pod spec
IDebug and documentation endpointsStack traces hidden in production; /health/ready gives no error detail; there is no GraphQL endpointSwagger UI (/api) is public by design
TTampered imageMulti-stage build, npm ci --omit=devNo SBOM or signature published

Residual risk summary​

The highest residual risks, all tracked in the ASVS assessment:

  1. Installs upgraded to 0.11.0 that have not turned on the admin MFA requirement. /admin/upgrade/health warns and names the admins without a second factor.
  2. Clients still on the legacy wildcard redirect URI opt-in (allowInsecureWildcardRedirectUris, set by the 0.11.0 upgrade on clients that had /* entries). /admin/upgrade/health lists them.
  3. Realms created before 0.10.0 with brute-force protection or events still off. /admin/upgrade/health lists them.
  4. Identity providers stored before 0.12.0 with a type the broker does not use, and SAML providers stored before 0.13.0 without a SAML configuration. /admin/upgrade/health lists them (identity_provider_types); an enabled one shows a login button that cannot complete a sign-in.
  5. SSRF guard not applied to every outbound call; geo-IP over plain HTTP.
  6. The SSO idle timeout is off by default (ssoSessionIdleTimeout, since 0.12.0), and offline sessions have none: an offline token lives for offlineTokenLifespan from sign-in.