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
| Class | Examples | Stored as |
|---|---|---|
| Identity | user.email, names, job_title, department, external_id | encrypted at rest by DynamoDB under KMS CMKs |
| Credentials | client secrets, SCIM tokens, webhook secrets, TOTP seeds, LDAP bind passwords | envelope-encrypted (AES-256-GCM) or hashed, never returned after creation |
| Behaviour | sessions, grants, refresh tokens, auth attempts | hashed or opaque, with TTLs |
| Accountability | audit events, auth_attempt records, delivery records | append-only, hash-chained |
| Configuration | applications, organizations, connections, policies | encrypted at rest; *_encrypted fields only for secrets |
| Telemetry | ip_hash, actor_hash, user_agent | salted SHA-256 / HMAC, never raw |
#The data Ulexid never holds
This is a design position, not a limitation to work around.
| Never stored | Why |
|---|---|
| Plaintext passwords | Passwords 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 keys | They do not exist outside the authenticator. Ulexid stores a credential id, a public key, and a signature counter |
| Raw phone numbers | mfa_factor.target_hint is a SHA-256 of the destination. Raw numbers are discarded |
| Raw email addresses in the audit log | actor_hash is a salted SHA-256. The audit log is a security record, not a contact list |
| Raw IP addresses in the audit log | ip_hash, salted per tenant, on every audit event and auth_attempt |
| Raw assertion bodies or tokens in logs | scrubbed before the log line is written, not after |
| SAML assertions after consumption | only the assertion id, for replay detection |
| Authorization codes | only code_hash, a SHA-256 |
| Refresh tokens | only token_hash |
| Webhook payloads in delivery logs | the delivery record holds status and a 2,000-character truncated response body, not the request |
#Encryption at rest
#Envelope encryption for secrets
plaintext
→ KMS GenerateDataKey(CMK) → data key wrapped under environment KMS CMK
→ AES-256-GCM with AAD → ciphertext + IV + auth tag
→ stored in the DynamoDB attributeThe 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 field | Algorithm | AAD |
|---|---|---|
config.oidc.client_secret_encrypted | AES-256-GCM | ulex:v1:<tenant_id>:<purpose> |
config.scim.token_encrypted | AES-256-GCM | ulex:v1:<tenant_id>:<purpose> |
directory.scim_token_encrypted | AES-256-GCM | ulex:v1:<tenant_id>:<purpose> |
directory.inbound_scim_token_encrypted | AES-256-GCM | ulex:v1:<tenant_id>:<purpose> |
api_key.hash | scrypt, N=2^17 | per-tenant salt |
refresh_token.token_hash | SHA-256 | — |
session.token_hash | SHA-256 | — |
grant.code_hash | SHA-256 | — |
mfa_factor.secret_encrypted | AES-256-GCM | ulex:v1:<tenant_id>:<purpose> |
config.password.ldap.bind_password_encrypted | AES-256-GCM | ulex: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
| Store | Encryption |
|---|---|
| Ulexid DynamoDB Global Tables | Customer-managed KMS keys in both us-east-2 and us-west-2 with kms:Decrypt scoped to service roles |
| S3 audit exports | Customer-managed KMS key, plus Object Lock (COMPLIANCE mode) |
| CloudWatch log groups | Pre-write secret and PII scrubbing before logs are emitted |
#Encryption in transit
| Hop | Protocol |
|---|---|
| Client → CloudFront | TLS 1.3 preferred, 1.2 minimum (TLSv1.2_2021), HSTS max-age=63072000; includeSubDomains; preload |
| CloudFront → API Gateway / MCP Origin | TLS 1.3 / 1.2+ (HTTPS_ONLY), Host allow-listed in-app |
| API Gateway → Lambda | AWS-internal TLS |
| Lambda → DynamoDB / KMS / SQS / S3 | TLS 1.2+ via AWS SDK regional endpoints |
| Lambda → upstream IdP / webhook targets | TLS 1.2+ with certificate validation, no insecure override |
| SAML bindings | HTTP-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.
| Purpose | Primitive | Why |
|---|---|---|
| Password verification | scrypt, N=2^17, r=8, p=1, per-tenant salt | deliberately slow; ~80 ms per verification |
| API key lookup | scrypt over the suffix, hex prefix in cleartext | the prefix allows a cheap index lookup before the expensive check |
| Session token | SHA-256 | high-entropy random; no guessing is possible, so slowness buys nothing |
| Refresh token | SHA-256 | same |
| Authorization code | SHA-256 | same |
| Webhook signature | HMAC-SHA256 | needs a keyed MAC over raw bytes |
| Audit chain | SHA-256, chained | tamper evidence |
actor_hash, ip_hash | SHA-256 / HMAC, salted per tenant | pseudonymisation; prevents cross-tenant correlation |
| PKCE challenge | SHA-256 then base64url | per 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
| Data | Default | Minimum | Enforced by |
|---|---|---|---|
| Audit events | 2,555 days (7 years) | 365 | never deleted via API; archived to S3 Object Lock (COMPLIANCE in prod) |
| Webhook deliveries | 30 days | 1 | DynamoDB TTL |
| Sessions | 30 days past expiry | 1 | DynamoDB TTL |
| Grants | 5 minutes past expiry | — | DynamoDB TTL |
| Refresh tokens | at expiry | — | DynamoDB TTL |
| Idempotency records | 24 hours | — | DynamoDB TTL |
| Route and JWKS cache | 900 seconds | — | DynamoDB TTL |
| Soft-deleted resources | 30 days | — | scheduled retention policy (note: background sweep status is tracked in Capability status) |
| Inactive applications | 730 days | 1 | configured in tenant retention |
| Deployment records | 400 days | — | configured in tenant retention |
auth_attempt records | 400 days | — | configured in tenant retention |
Override on the tenant:
{
"retention": {
"audit_log_days": 2555,
"webhook_delivery_days": 30,
"session_days": 30,
"application_inactive_days": 730
}
}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:
| Role | AWS Region | Purpose |
|---|---|---|
| Primary serving region | us-east-2 (Ohio) | Primary compute, DynamoDB Global Table, primary conditional write coordination (audit chain appends & MFA challenge budgets) |
| Secondary serving region | us-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-2andus-west-2using 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) on5xxor 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:
# 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.ndjsonExports are 200-row pages for API resources and 100,000-event windows for the audit log. Larger windows return 413.
#Deletion
# 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| Class | On tenant deletion |
|---|---|
| Users, organizations, groups, connections, directories, applications, webhooks, sessions, grants, tokens | hard-deleted immediately |
user.scim sub-attributes and metadata | deleted with the user |
| Passwords and TOTP seeds | the ciphertext is deleted; KMS CMK deletion is a separate 30-day break-glass procedure |
| Audit events | retained for the retention window and archived to S3 under Object Lock (COMPLIANCE mode) |
| Webhook deliveries | deleted |
Aggregates in usage | reset to zero |
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
| Pattern | Action |
|---|---|
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 addresses | pseudonymised ([EMAIL_…]) |
| IPv4 / IPv6 addresses | pseudonymised ([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.