Security

Data protection

What Ulexid stores, what it never stores, how it is encrypted at rest and in transit, retention windows, PHI minimisation, multi-region replication, and how to export or delete a tenant's data.

#The data Ulexid holds

ClassExamplesStored as
Identityuser.email, names, job_title, department, external_idencrypted at rest by DynamoDB under KMS CMKs
Credentialsclient secrets, SCIM tokens, webhook secrets, TOTP seeds, LDAP bind passwordsenvelope-encrypted (AES-256-GCM) or hashed, never returned after creation
Behavioursessions, grants, refresh tokens, auth attemptshashed or opaque, with TTLs
Accountabilityaudit events, auth_attempt records, delivery recordsappend-only, hash-chained
Configurationapplications, organizations, connections, policiesencrypted at rest; *_encrypted fields only for secrets
Telemetryip_hash, actor_hash, user_agentsalted SHA-256 / HMAC, never raw

#The data Ulexid never holds

This is a design position, not a limitation to work around.

Never storedWhy
Plaintext passwordsPasswords are hashed with scrypt (N=2^17, r=8, p=1) and a per-tenant salt; upstream SSO / LDAP connections verify against the customer IdP with encrypted credentials
WebAuthn private keysThey do not exist outside the authenticator. Ulexid stores a credential id, a public key, and a signature counter
Raw phone numbersmfa_factor.target_hint is a SHA-256 of the destination. Raw numbers are discarded
Raw email addresses in the audit logactor_hash is a salted SHA-256. The audit log is a security record, not a contact list
Raw IP addresses in the audit logip_hash, salted per tenant, on every audit event and auth_attempt
Raw assertion bodies or tokens in logsscrubbed before the log line is written, not after
SAML assertions after consumptiononly the assertion id, for replay detection
Authorization codesonly code_hash, a SHA-256
Refresh tokensonly token_hash
Webhook payloads in delivery logsthe delivery record holds status and a 2,000-character truncated response body, not the request

#Encryption at rest

#Envelope encryption for secrets

text
plaintext
  → KMS GenerateDataKey(CMK)        → data key wrapped under environment KMS CMK
  → AES-256-GCM with AAD             → ciphertext + IV + auth tag
  → stored in the DynamoDB attribute

The hosted control plane uses a dedicated regional AWS KMS customer-managed key (CMK) with annual automatic rotation enabled, and AES-256-GCM envelope encryption binds each ciphertext with Additional Authenticated Data (ulex:v1:<tenant_id>:<purpose>). Plaintext data keys never leave memory, are never written to disk, and are never logged.

Secret fieldAlgorithmAAD
config.oidc.client_secret_encryptedAES-256-GCMulex:v1:<tenant_id>:<purpose>
config.scim.token_encryptedAES-256-GCMulex:v1:<tenant_id>:<purpose>
directory.scim_token_encryptedAES-256-GCMulex:v1:<tenant_id>:<purpose>
directory.inbound_scim_token_encryptedAES-256-GCMulex:v1:<tenant_id>:<purpose>
api_key.hashscrypt, N=2^17per-tenant salt
refresh_token.token_hashSHA-256—
session.token_hashSHA-256—
grant.code_hashSHA-256—
mfa_factor.secret_encryptedAES-256-GCMulex:v1:<tenant_id>:<purpose>
config.password.ldap.bind_password_encryptedAES-256-GCMulex:v1:<tenant_id>:<purpose>

Because AAD binds ciphertext to its tenant and purpose, a ciphertext copied from one tenant's row into another's fails decryption.

#DynamoDB, S3, and logs

StoreEncryption
Ulexid DynamoDB Global TablesCustomer-managed KMS keys in both us-east-2 and us-west-2 with kms:Decrypt scoped to service roles
S3 audit exportsCustomer-managed KMS key, plus Object Lock (COMPLIANCE mode)
CloudWatch log groupsPre-write secret and PII scrubbing before logs are emitted

#Encryption in transit

HopProtocol
Client → CloudFrontTLS 1.3 preferred, 1.2 minimum (TLSv1.2_2021), HSTS max-age=63072000; includeSubDomains; preload
CloudFront → API Gateway / MCP OriginTLS 1.3 / 1.2+ (HTTPS_ONLY), Host allow-listed in-app
API Gateway → LambdaAWS-internal TLS
Lambda → DynamoDB / KMS / SQS / S3TLS 1.2+ via AWS SDK regional endpoints
Lambda → upstream IdP / webhook targetsTLS 1.2+ with certificate validation, no insecure override
SAML bindingsHTTP-Redirect and HTTP-POST over TLS

TLS 1.0 and 1.1 are refused at the edge and across service hops. Plaintext HTTP callbacks are rejected for webhooks and non-loopback OAuth redirect URIs.

#Hashing, per purpose

Different purposes need different primitives, and using one for all of them is a mistake.

PurposePrimitiveWhy
Password verificationscrypt, N=2^17, r=8, p=1, per-tenant saltdeliberately slow; ~80 ms per verification
API key lookupscrypt over the suffix, hex prefix in cleartextthe prefix allows a cheap index lookup before the expensive check
Session tokenSHA-256high-entropy random; no guessing is possible, so slowness buys nothing
Refresh tokenSHA-256same
Authorization codeSHA-256same
Webhook signatureHMAC-SHA256needs a keyed MAC over raw bytes
Audit chainSHA-256, chainedtamper evidence
actor_hash, ip_hashSHA-256 / HMAC, salted per tenantpseudonymisation; prevents cross-tenant correlation
PKCE challengeSHA-256 then base64urlper RFC 7636 (S256 mandatory)

Password hashes are never migrated to a weaker algorithm. Raising the cost factor re-hashes existing passwords on the next successful login.

#Retention

DataDefaultMinimumEnforced by
Audit events2,555 days (7 years)365never deleted via API; archived to S3 Object Lock (COMPLIANCE in prod)
Webhook deliveries30 days1DynamoDB TTL
Sessions30 days past expiry1DynamoDB TTL
Grants5 minutes past expiry—DynamoDB TTL
Refresh tokensat expiry—DynamoDB TTL
Idempotency records24 hours—DynamoDB TTL
Route and JWKS cache900 seconds—DynamoDB TTL
Soft-deleted resources30 days—scheduled retention policy (note: background sweep status is tracked in Capability status)
Inactive applications730 days1configured in tenant retention
Deployment records400 days—configured in tenant retention
auth_attempt records400 days—configured in tenant retention

Override on the tenant:

json
{
  "retention": {
    "audit_log_days": 2555,
    "webhook_delivery_days": 30,
    "session_days": 30,
    "application_inactive_days": 730
  }
}
Warning

Deleting an audit event is impossible through the API, by any scope, including ulex:admin. There is no update or delete endpoint.

#Multi-region architecture and data residency

The hosted control plane (https://ulexid.com) operates active-active across two US regions:

RoleAWS RegionPurpose
Primary serving regionus-east-2 (Ohio)Primary compute, DynamoDB Global Table, primary conditional write coordination (audit chain appends & MFA challenge budgets)
Secondary serving regionus-west-2 (Oregon)Active compute, DynamoDB Global Table replica with regional KMS CMK, automatic read-path failover
  • Replication & failover: DynamoDB Global Tables asynchronously replicate items between us-east-2 and us-west-2 using per-region customer-managed KMS keys. Route 53 latency routing directs callers to the nearer healthy region, and CloudFront performs automatic edge origin failover on read paths (GET, HEAD, OPTIONS) on 5xx or timeout. Write paths coordinate against the primary region so single-use authorization codes and hash-chained audit heads remain linearisable, with regional endpoints available for client retry.
  • Tenant region field: tenant.region (GET /me) records the tenant's configured residency hint (us-east-2 / US multi-region in hosted deployments). Single-jurisdiction EU or APAC hosted deployments are not provisioned automatically by self-service tenants.

#Export

Everything except audit alteration is exportable through the API:

bash
# One resource type
curl -sS -G "$BASE/users" -H "$AUTH" --data-urlencode 'limit=200' | jq -c '.data[]'

# Everything, by cursor
: > /tmp/export.ndjson
cursor=""
while :; do
  page=$(curl -sS -G "$BASE/users" -H "$AUTH" --data-urlencode 'limit=200' ${cursor:+--data-urlencode "starting_after=$cursor"})
  jq -c '.data[]' <<<"$page" >> /tmp/export.ndjson
  [ "$(jq -r .has_more <<<"$page")" = "true" ] || break
  cursor=$(jq -r .next_cursor <<<"$page")
done

# The audit log
curl -sS -G "$BASE/audit-events/export" -H "$AUTH" -H "Accept: application/x-ndjson" \
  --data-urlencode 'format=ndjson' \
  --data-urlencode 'since=2026-01-01T00:00:00.000Z' \
  --data-urlencode 'until=2026-10-01T00:00:00.000Z' \
  -o /tmp/audit.ndjson

Exports are 200-row pages for API resources and 100,000-event windows for the audit log. Larger windows return 413.

#Deletion

bash
# One resource: soft delete, reversible for 30 days
curl -sS -X DELETE "$BASE/users/$USER_ID" -H "$AUTH"

# A whole tenant (when allow_mocks: true or in local in-memory mode), keeping API keys
ulex simulator reset --confirm --keep-api-keys
ClassOn tenant deletion
Users, organizations, groups, connections, directories, applications, webhooks, sessions, grants, tokenshard-deleted immediately
user.scim sub-attributes and metadatadeleted with the user
Passwords and TOTP seedsthe ciphertext is deleted; KMS CMK deletion is a separate 30-day break-glass procedure
Audit eventsretained for the retention window and archived to S3 under Object Lock (COMPLIANCE mode)
Webhook deliveriesdeleted
Aggregates in usagereset to zero
Warning

The audit log survives a tenant deletion. The immutable record of authentication and administrative mutations outlives the identity records it observed, as stated in our privacy terms and DPA.

#Log scrubbing

PatternAction
ulex_sk_live_…, ulex_sk_test_…[REDACTED_key]
cs_…[REDACTED_client_secret]
scim_…[REDACTED_scim_token]
whsec_…[REDACTED_webhook_secret]
rt_…, dc_…, ac_…[REDACTED_token]
eyJ… (three-segment JWT)[REDACTED_jwt]
-----BEGIN … PRIVATE KEY-----[REDACTED_private_key]
authorization: <anything>[REDACTED_authorization]
Email addressespseudonymised ([EMAIL_…])
IPv4 / IPv6 addressespseudonymised ([IP_…])

Scrubbing runs before the log line or audit record is written, in the same code path (createRedactingAuditSink and the logger scrubber), not as an asynchronous post-hoc filter.

#Reference