Sensitive and encrypted fields: model, API and enforcement
Section titled “Sensitive and encrypted fields: model, API and enforcement”This page is for integrators, security reviewers and platform engineers. It documents how sensitive and encrypted fields are stored, granted, masked, revealed and enforced, the endpoints involved, and the exact refusals a client must handle.
Since 1.8 — the sensitive-fields feature (marking, masking, and per-user access control of individual field values) landed as one change in the 1.8 release line. Since 1.10 — Encrypted fields, Decrypt, the three-purpose step-up mechanism and the sensitive-data access policy.
Some fields hold information that only a few people should ever see — salaries, national IDs, bank accounts, and the like. OSOS lets a data-entity designer mark such a field as sensitive. Once a field is sensitive, OSOS masks its value for every user who has not been explicitly granted access to it — both on live entries and in audit history — and only users who hold an explicit sensitive-field grant can read the real value.
This is a separate dimension from ordinary permissions. A user can have full access to an entity and its records and still see a masked value in a sensitive field until they are granted access to that specific field. Access is controlled by per-field, per-user/group grants stored in the access_right collection — not by the entity’s own view/row permissions, and not bypassed by administrator roles.
Since 1.10 A field can instead be marked Encrypted, which is a different mechanism resting on the same grant model: the value is stored as ciphertext in the database rather than masked on the way out, and it is revealed one field on one entry at a time through a dedicated Decrypt call — which, Since 1.10, additionally requires its own single-use step-up verification alongside the grant. A field is Sensitive or Encrypted — never both. See Encrypted fields.
Two things changed shape late in the 1.8 line and are worth reading before anything else on this page. First, a grant alone no longer reveals a value: the holder must also open a re-authenticated step-up unmask session, and that session now belongs to the specific sign-in session that opened it, not just the account. Second, write-side protection was meant to move from a round-trippable sentinel to permission-enforced preservation — but as verified against the current source, that enforcement has no active call site, so the sentinel-echo safeguard is, in practice, the only thing protecting a masked field on write today. See Masks and Write path for both, including why the second point is flagged for review rather than presented as settled behavior.
Concept and terminology
Section titled “Concept and terminology”- Sensitive field — a
DataEntityFieldwhoseoptions.sensitive === true. Only scalar-type fields qualify; reference (Entity) and Block container fields are rejected (see Constraints). - Scope — the canonical string identifying one sensitive field across the space, built by
buildSensitiveFieldScope(moduleNn, entityNn, fieldFullNn). See Sensitive field scopes. - Grant — an
AccessRightrecord of permission typeSENSITIVE_FIELD(PermissionTypeEnum.SensitiveField = 'SENSITIVE_FIELD') whosevalue.scopeequals a field scope, entitling one user or group to read that field. - Direct grant vs. inherited grant — a grant on the field’s own exact scope is direct; a grant on a wildcard scope that covers it is inherited. See Direct and inherited grants.
- Mask — the value substituted for a value the requesting user may not read. A live read substitutes an unguessable 26-character sentinel (
SENSITIVE_DISPLAY_MASK), not the plain****an earlier version of this page described — see Masks for why that distinction matters. Audit payloads use a separate, simpler***sentinel. - Unmask session — a short-lived, re-authenticated (“step-up”) session that additionally gates whether a granted value is actually revealed on read.
- Encrypted field
Since 1.10— aDataEntityFieldwhoseoptions.encrypt === true. Its value is stored as ciphertext (AES-256-GCM), not merely masked on read, and it is mutually exclusive withsensitiveon the same field. See Encrypted fields. - Decrypt
Since 1.10— the single reveal path for an Encrypted field: one call, one field, one entry, gated on the field grant and a single-use step-up proof (Since 1.10). See Decrypting a value. StepUpPurposeSince 1.10— the three-way discriminator (Unmask/Decrypt/WorkflowAction) fixed at step-up challenge time; the three purposes share endpoints but a proof or session minted for one can never satisfy another. See Step-up unmask, Decrypt, and WorkflowAction.- Sensitive-data access policy
Since 1.10— a per-element setting on a reaction, an export template, or a summary that decides what that element may disclose when it runs, independently of who reads its output. See Sensitive-data access policy.
Sensitive field scopes
Section titled “Sensitive field scopes”Every sensitive field is identified across the whole space by a single canonical
scope string. A scope is built from normalized (machine) names, separated by /:
<module>/<entity>/<field>For a field that sits inside a block, the last segment is the dotted
block.subfield normalized name — for example hr/employee/payroll.iban.
A grant carries a scope and a field carries a scope, and the two are compared
segment by segment. Both must have the same number of /-separated segments to
match at all. Any segment may be the wildcard *, which matches whatever sits in
that position:
| Grant scope | What it covers |
|---|---|
hr/employee/salary | Exactly that one field — a direct grant. |
hr/employee/payroll.iban | The iban sub-field of the payroll block on employee. |
hr/employee/* | Every sensitive field on the employee entity — an entity-wildcard grant. |
hr/*/* | Every sensitive field anywhere in the hr module — a module-wildcard grant. |
hr/*/salary | The salary field on every entity in the hr module. |
A grant whose scope names a field exactly is a direct grant on that field; a grant that reaches the field through a wildcard segment is an inherited grant. Both confer exactly the same read access — the difference is where the grant lives, and therefore where you go to change or revoke it.
Scopes are not typed by hand. The scope picker presents the space as a module → entity → field tree: selecting a leaf field authors the concrete three-segment scope, while selecting an entity or a module node authors the corresponding wildcard scope covering everything beneath it.
Segment-wise matching is implemented by matchesSensitiveScope (libs/sensitive-field.ts), which every runtime check goes through.
Marking a field: field-definition endpoints
Section titled “Marking a field: field-definition endpoints”There is no dedicated endpoint for toggling a field sensitive — marking is done through the normal field/entity definition editors and APIs.
Note: Sensitive fields are supported for top-level fields and for sub-fields inside repeatable blocks. The Block container field itself cannot be marked sensitive (see Constraints).
On the field controller (data-entity-fields.controller.ts), the definition endpoints carry the sensitive logic:
| Method | Path | Behavior for sensitive fields |
|---|---|---|
POST | /v1/entities/{entity}/fields | validateAndNormalizeSensitive; if options.sensitive, syncSensitiveFieldAccess(scope, users, groups) else removeSensitiveFieldAccess(scope); then delete field.sensitiveAccess before persist. |
PATCH | /v1/entities/{entity}/fields/{fieldId} | Same sync/clear + strip logic. |
DELETE | /v1/entities/{entity}/fields/{fieldId} | removeSensitiveFieldAccess(scope) for the deleted field. |
GET | /v1/entities/{entity}/fields and /fields/{fieldId} | attachSensitiveFieldsAccess repopulates each sensitive field’s sensitiveAccess from access_right before returning. |
Granting access to a sensitive field
Section titled “Granting access to a sensitive field”Sensitive-field access is granted per scope, independently of the ordinary permission levels. It is a distinct grant type, so giving a user Edit on the entity does not give them access to its sensitive fields.
There are two write paths onto the same AccessRight records:
- The field editor — open the entity, and in the field’s access/options panel select the users or groups that should be able to read the field’s real value. Under the hood, send the field with
options.sensitive = trueand the desiredsensitiveAccess.users/sensitiveAccess.groupsreference arrays. The set is declarative:syncSensitiveFieldAccessdiffs the desired principals against existing Active grants for the scope, deletes stale ones, and creates missing ones, then publishes anAccessRightChangedEvent. Sending an empty selection revokes all grants for that field, and grants created this way carry noexpiry. - The grants-management API —
/v1/sensitive-field-grants*, added in 1.8, which backs the admin Sensitive Permissions page and the per-user / per-group tabs. It can author wildcard scopes and validity windows, which the field editor cannot. See Sensitive-field grants API, and Sensitive Permissions for the administrator-facing procedure.
The declarative sync also runs at the whole-entity level via DataEntityService.syncSensitiveFieldsAccess (used by the create/update data-entity command handlers), which additionally tears down grants for fields that stopped being sensitive or were removed entirely (using the previous entity snapshot), so no orphaned grants are left behind.
Direct and inherited grants Since 1.8
Section titled “Direct and inherited grants Since 1.8”A grant whose scope is the field’s exact module/entity/field path is direct. A grant scoped to module/entity/* or module/*/* is inherited: it covers every sensitive field under that entity or module, including fields created after the grant was written.
This is a different axis from how a user acquired the grant. GET /v1/sensitive-field-grants/by-user/{userId} reports the acquisition route separately as assignmentType (Direct or group), so a single grant can be direct-scoped and group-acquired at the same time. The two axes answer different questions:
| Axis | Question | Where it is reported |
|---|---|---|
| Scope shape (direct vs. inherited) | How wide is this grant? | The scope string itself; inherited-holders lists wildcard holders for one field. |
Assignment type (Direct vs. group) | Whose grant is it? | UserSensitiveFieldGrantDto.assignmentType / acquiredThrough. |
Both are flattened to plain scope strings by the time enforcement runs — canAccessSensitiveField sees only permissions.sensitiveFields and cannot tell a direct grant from an inherited one.
Sensitive-field grants API Since 1.8
Section titled “Sensitive-field grants API Since 1.8”SensitiveFieldGrantsController (controllers/sensitive-field-grants.controller.ts) is a thin delegation layer over AccessRightsService. It introduces no new storage — AccessRight remains the single source of truth, and these routes are new read/write shapes over the same records the field-editor sync path writes.
Auth (every route): @authorize({voters: [systemAdminVoterFactory()]}), which votes by HTTP verb — GET requires system Viewer access or above; POST/PATCH/DELETE require isSystemDeveloper() (system Developer, Editor, or Admin). The admin page itself is gated tighter on the frontend, to system Admin only.
| Method | Path | Returns |
|---|---|---|
GET | /v1/sensitive-field-grants | SensitiveFieldGrantDto[] — every Active grant, space-wide. |
GET | /v1/sensitive-field-grants/by-user/{userId} | UserSensitiveFieldGrantDto[] — a user’s direct + group-inherited grants. |
GET | /v1/sensitive-field-grants/by-group/{groupId} | SensitiveFieldGrantDto[] — a group’s own (direct) grants. |
GET | /v1/sensitive-field-grants/inherited-holders | InheritedSensitiveFieldHoldersDto — principals holding a wildcard grant covering one field. |
POST | /v1/sensitive-field-grants | CreateSensitiveFieldGrantsResultDto — created grants + skipped duplicates. |
PATCH | /v1/sensitive-field-grants/{id} | SensitiveFieldGrantDto — expiry-only update. |
DELETE | /v1/sensitive-field-grants/{id} | 204, hard delete. |
PATCH | /v1/sensitive-field-grants/{id}/archive | 204, soft archive. |
GET /v1/sensitive-field-grants lists every Active (non-archived) grant across the space. A single aggregation matches SENSITIVE_FIELD grants, $lookups the entitled user/group to resolve a display label, and enriches each row with localized scopeLabels. It is deliberately not expiry-window-filtered — a future-start grant must stay visible so a manager can see and edit it. SensitiveFieldGrantScopeLabelsDto resolves each scope segment independently: a * segment, or a normalized name absent from the catalogue (a since-deleted field, say), resolves to null for that segment rather than failing the whole list.
GET .../by-user/{userId} returns every active grant that effectively covers the user — direct grants plus those inherited from every group they belong to. There is no de-duplication: a scope held both ways yields two rows, distinguished by assignmentType (UserPermissionAssignmentTypeEnum.Direct = 0 / .group = 1). For an indirect row, acquiredThrough (resolved group reference) and acquiredThroughGroupType (GroupTypeEnum) identify the acquiring group; both are null for a direct grant.
GET .../by-group/{groupId} returns a group’s own direct grants only — a group cannot inherit from another group — and so reuses the plain SensitiveFieldGrantDto with no assignment-type metadata.
GET .../inherited-holders?moduleNn=&entityNn=&fieldNn= lists the users/groups that can read one field through a wildcard grant, as opposed to a grant on the field’s own exact scope (that set is the field’s own sensitiveAccess selector and is deliberately excluded here).
- All three query params are required. An earlier version let an omitted param build a scope like
undefined/employee/*, which matched nothing and returned200 {holders: []}— read by the dialog as “nobody inherits this field” instead of failing with400. fieldNnis accepted for contract clarity but is not matched on: onlybuildSensitiveFieldScope(moduleNn, entityNn, '*')andbuildSensitiveFieldScope(moduleNn, '*', '*')are queried.- Only effective grants contribute (
state != Archived, inside the active expiry window). A principal covered by both wildcard scopes is de-duplicated to one row. - Each
InheritedSensitiveFieldHolderDtocarriestype(USER/GROUP),id, a resolvedname, and — users only —emailandavatar.
Since 1.8 The field designer’s Inherited Permissions dialog (opened from a sensitive field’s advanced settings, next to the Sensitive toggle) is built on this endpoint. Each holder row it lists is now clickable and opens a second, read-only panel showing that holder’s resolved grant for this specific field — re-querying GET .../by-user/{userId} or GET .../by-group/{groupId} and, when the holder qualifies at more than one scope, preferring an entity-scope match over a module-wildcard one (after first discarding any grant whose expiry has passed). The panel stays read-only, same as the dialog itself; changing the grant still means editing it at its actual entity- or module-wildcard scope. Full admin-page detail — the deep link to the holder’s own Sensitive Fields tab, the empty/error states — is on Sensitive Permissions, not duplicated here.
POST /v1/sensitive-field-grants creates one AccessRight per user and per group in dto.users/dto.groups, all for the same dto.scope.
dto.scopeis validated non-blank up front (400otherwise); a wildcard segment is valid — only “non-blank” is enforced.dto.expiryis optional. Absent or[]means open-ended. Otherwise it must be exactly[start, end], each elementnull(open bound) orDate.parse-able;startmust not be afterend; and a presentendmust be in the future — a grant cannot be created already expired. Every violation is a400.- A principal that already holds an Active, in-window grant for the scope is skipped, not duplicated, and reported back in
skippedDuplicates. - One
AccessRightChangedEventis published for the whole call, and only when at least one grant was actually created.
PATCH /v1/sensitive-field-grants/{id} edits only the expiry window. The scope and entitled entity are immutable — re-pointing a grant at a different principal could silently create a second Active grant for the same scope. 404 if the record does not exist or is not a SENSITIVE_FIELD grant.
dto.expiry | Effect |
|---|---|
| absent (key not sent) | Unchanged. |
[] | Clear the window — the key is deleted from value. |
[start, end] | Replace the window as-is. |
The key must be deleted rather than set to undefined: the MongoDB connector has no ignoreUndefined configured and would serialize undefined to a stored null. Every read path treats a missing key and an explicit null identically, so the two are interchangeable on read — but a top-level null is not accepted at the schema level, so a client clearing a window must send [].
DELETE /v1/sensitive-field-grants/{id} is a permanent hard delete (404 if not found or not a SENSITIVE_FIELD grant), publishing AccessRightChangedEvent.
PATCH /v1/sensitive-field-grants/{id}/archive soft-archives the record (state → Archived) through the same ArchiveDataEntryCommand path the expiry auto-archive reaction uses. Archived grants are excluded from every read path exactly as a hard delete would be — access is lost immediately — but the record survives for audit purposes and the (scope, principal) pair is free again for a fresh grant. Both removal paths remain available; which one a given screen calls is a client decision (see Sensitive Permissions).
Option exclusion: excludeForUserId / excludeForGroupId
Section titled “Option exclusion: excludeForUserId / excludeForGroupId”SensitiveFieldSelectorComponentFetcher, which backs the scope selector’s reference-data endpoint, reads an excludeForUserId or excludeForGroupId parameter from the request body’s parameters bag. When present, it resolves the target principal’s currently-held scopes and excludes them from the returned catalogue, so an “Add grant” dialog for a fixed user or group does not offer fields they already hold. excludeForUserId wins if both are somehow present.
The exclusion is gated behind system-viewer. The fetcher is reachable from the generic POST /v2/entities/{entity}/fields/{field}/data endpoint, which is gated only by canViewEntity — a broader audience than the dedicated grants endpoints. Revealing which scopes a specific target already holds is therefore honored only when the caller is at least isSystemViewer(); for anyone else the exclusion is silently skipped and the full, unfiltered catalogue is returned. It never errors and never leaks the target’s grants to an unprivileged caller.
How masking behaves
Section titled “How masking behaves”For a user without the grant — or with the grant but no active unmask session — the sensitive value is replaced with **** consistently across the product:
| Where | Behavior for a user who cannot currently read the field |
|---|---|
| List views | The column shows the mask. |
| Record (detail) view | The field shows the mask. |
| Editing | The field can still be edited “blind”: the user types a new value into a masked field without ever seeing the current one. Whether what they submit is kept or discarded depends on the write-side protection described under Write path. |
| After-save confirmations | Any echoed value stays masked; the value the client gets back is masked on a copy, so the authoritative entry and its events keep the real value. |
| History | Changes to a sensitive field are shown only if the user has access to that field; otherwise the before/after values are masked. |
| Audit trail | The audit record masks sensitive values independently (shown as ***). |
| Reports and exports | Reports (available on the web only) and exports (XLSX or PDF) read values through the same masked path, so an unauthorized user’s report or export carries the masked value, not the real one. |
Masking is applied when data is read, so it follows the value into every one of these surfaces automatically.
Under the hood:
DataEntryService.sensitiveMaskApplies(dataEntity, user)gates whether masking does anything at all for a read: there must be an entity, it must declare at least one sensitive field, and the reader must not be an internal (system) service call.DataEntryService.applyCallerSensitiveMask(entries, dataEntity, user)is the presentation-side entry point, called fromhandleResolvedValuesAfterAggregationunlessdisableHideSensitiveFieldswas passed. It resolves the entity’s module normalized name, reads the caller’s active unmask scopes, callsmaskSensitiveFields, and — if anything was actually revealed — publishes one batchedSensitiveDataUnmaskedEventfor the request.DataEntryService.maskSensitiveFields(entries, dataEntity, moduleNn, permissions, unmaskScopes?)replaces each unreadable field withSENSITIVE_DISPLAY_MASKin place, descending into block sub-fields inside repeatable blocks. A field is revealed only when bothcanAccessSensitiveField(permissions, scope)is true and an active unmask scope matches. Itspermissionsparameter is narrowed toPick<IAllUserPermissions, 'sensitiveFields'>, so a fail-closed caller can honestly pass{sensitiveFields: []}instead of a cast.- Fail closed on a module-lookup failure.
applyCallerSensitiveMaskresolves the module throughdataModuleRepository.findById, inside a caller whosecatchanswers any exception by returning the raw aggregation output. That lookup failure is therefore caught locally and masks every sensitive field with an empty grant list, rather than letting the exception propagate and silently return unmasked data. - Fail closed on an unmask-session lookup failure. Reading the caller’s active scopes is wrapped the same way: any error (a cache outage, say) is logged and treated as “no active session”, so everything stays masked.
Masking cannot be bypassed by administrators
Section titled “Masking cannot be bypassed by administrators”Sensitive-field masking is not overridden by system-administrator or Edit access. Even a full administrator sees the mask unless they hold the sensitive-field grant for that field and an active unmask session. The only exception is internal service/system calls that run with authorization skipped (or when masking is explicitly disabled via disableHideSensitiveFields) — used by trusted backend integrations, not by interactive users.
The client is told which fields are masked separately, via the entity definition’s sensitiveMaskedFields (computed per-request by computeSensitiveMaskedFields / resolveSensitiveMaskedFields), rather than by inspecting the returned value. Because the mask sentinel is designed to be indistinguishable from a value a user could legitimately have typed, this list is the only reliable signal. It is per-request and must never be cached with the base entity definition; an absent user yields all sensitive fields masked.
Since 1.8, that signal is actually two disjoint lists, so the client can tell “no grant at all” apart from “grant held, but not currently unmasked”: sensitiveMaskedFields covers a field the user has no grant for at all; sensitiveMaskedFieldsWithUserAccess covers a field the user does hold a grant for, but no active unmask session currently covers it. A field revealed by an active session appears in neither list. This is what lets the UI render a plain lock for a field the user can never see, versus an unmask (“eye”) affordance for a field they hold a grant for but haven’t stepped up on yet.
Since 1.10 Both lists now also cover encrypt-only fields (encrypt: true, sensitive: false), which previously appeared in neither — so the client had no per-viewer signal for them at all and always drew the reveal affordance, whether or not the viewer actually held a grant. An Encrypted field never participates in an unmask session, so it is either in sensitiveMaskedFields (no grant → the client draws a lock) or, whenever a grant is held, in sensitiveMaskedFieldsWithUserAccess (→ the eye that triggers Decrypt) — never in neither list the way a session-revealed sensitive field is. The consequence a user sees is that the lock icon now also appears on an Encrypted field they cannot decrypt: the affordance is suppressed rather than offered and then refused with a 403. Mobile draws the same three-way distinction with three icons — an encryption glyph for Encrypted, a crossed-out eye for sensitive-and-revealable, a padlock for sensitive-with-no-grant — and the mask now propagates to card, kanban and calendar text surfaces too. Inline edit of an Encrypted field is blanked unconditionally, grant or no grant, because an encrypted value is opaque client-side either way; without that, the editor pre-filled the masked placeholder as if it were real content.
Client rendering of a masked value Since 1.8
Section titled “Client rendering of a masked value Since 1.8”sensitiveMaskedFields rides on the entry-details response. A plain entries-list response carries no such per-user list — there, the only signal a client has is the mask sentinel substituted into the field’s own value. A client rendering a list must therefore infer masking from the value itself, gated on the field’s own options.sensitive flag so that a non-sensitive field legitimately holding a string that happens to match the sentinel is never mistaken for a restricted one.
Two consequences, both now honoured by the mobile client as well as the web one:
- A read-restricted field renders its mask, not an empty placeholder. A masked value that cannot parse into the field’s own type (a number, a date) used to degrade to “no value” on list and table surfaces, so a protected field looked identical to an unfilled one. Both the empty and non-empty rendering branches now go through the same masked-value component, so which case applies is never leaked by an empty-value glyph.
- A masked field is inline-editable from both the details view and the list. That matches the server contract in Write path, which never depended on the caller being able to read the field it writes — the blind write is safe because the server discards whatever an unauthorized caller submits, not because the client hid the control. The inline-edit gate also resolves the workflow requirement the same three-way way the full edit form does, so a caller holding admin edit rights on the view is no longer refused inline edit on an entry whose active step they do not personally own.
Masking is suppressed only inside the inline-edit control itself and on create, where an empty editable input is what the blind write needs.
Step-up unmask session Since 1.8
Section titled “Step-up unmask session Since 1.8”Holding a grant is necessary but not sufficient to see a live value. A granted field is still masked by default, and is revealed only while the requesting user has an active, time-boxed unmask session opened by re-authenticating. This sits on top of the grant model, not instead of it.
sequenceDiagram
participant U as User
participant C as Client
participant Users as users-service
participant Cache as Redis
participant Data as data-service
U->>C: Open Unmask, choose a duration
C->>Users: POST /identity/mfa/step-up/challenge
Users->>Users: resolveEffectiveMethod (totp / sms / email / password)
Users-->>C: method, codeLength, destinationHint
U->>C: Enter the code (or confirm password)
C->>Users: POST /identity/mfa/step-up/verify
Users->>Cache: write StepUpUnmaskSession (EX durationSeconds)
Users-->>C: session active until expiresAt
C->>Data: read entries
Data->>Cache: getActiveScopes(userId)
Data-->>C: values revealed where grant AND scope match
Session lifecycle
Section titled “Session lifecycle”step-up-router.ts mounts four routes under /identity/mfa/step-up (JSON body parsing, domain resolution, and access-token auth applied to all): POST /challenge, POST /verify, POST /disable, GET /status. The implementation is step-up-unmask.service.ts.
challengeUnmask(accountId, {durationSeconds, scope?, method?}, domain?)picks and prepares the factor.durationSecondsmust be one of the allow-listedSTEP_UP_UNMASK_DURATIONS_SECONDSvalues — 120 / 300 / 600 / 1800 / 3600 / 10800 / 14400 / 21600 / 28800 (2 / 5 / 10 / 30 / 60 minutes, or 3 / 4 / 6 / 8 hours) — elseStepUpError('INVALID_DURATION'). This list superseded an earlier 15/30/45/60/120-minute allow-list; the web and mobile duration pickers are both sourced from the same constant so they cannot drift from it.USER_NOT_FOUNDandEXTERNAL_USER_FORBIDDENare rejected outright: external/SSO users cannot step up at all.resolveEffectiveMethod(available, preferred, requested?)takes the requested method if usable, else the user’s preferred one, else the first of['totp', 'sms', 'email'].passkeyis explicitly not usable for this code-entry step-up and is skipped even if requested.- Password fallback. If no MFA method is usable (
MFA_NO_METHOD), the domain hasallowPasswordStepUp === true(opt-in, defaultfalse), and the user has a local password, the method falls back to'password'instead of throwing. External/SSO users were already rejected, so this only ever applies to local accounts.allowPasswordStepUpis a Domain core-entity field on the data-service side, synced into the users-serviceDomainprojection by the data-entry created/updated handlers. sendablemethods (sms,email) are throttled byotpRateLimiterbefore the OTP is sent (MFA_RATE_LIMITED,429), separately from the per-verify limit — otherwise an authenticated caller could loop/challengeand bomb the user’s inbox.- A pending context (method, duration, scope) is stashed keyed
step-up-pending:<accountId>with the OTP expiry as TTL. - Returns
{method, sendable, codeLength, resendAfterSeconds, destinationHint?, availableMethods}.codeLengthis0for password and6for TOTP;destinationHintis the masked email/phone and is present only whensendable.
verifyUnmask(accountId, {code?, password?, method?})verifies the pending challenge under its own rate limit. The password fallback re-verifies viaPasswordHelper.isSameand returnsINVALID_PASSWORDon mismatch; an MFA method delegates to its registered verifier. Duration and scope are read back from the pending context, not from the verify request, so a client cannot escalate the window or the scope at verify time. On success it writes the session, destroys the pending context, resets the verify rate limit, and publishesSensitiveDataUnmaskEnabledEvent.disableUnmask(accountId)atomicallyGETDELs the session key, so two concurrent disables cannot both observe an active session and double-publish.SensitiveDataUnmaskDisabledEventis published only when a session was actually removed; an already-expired or double-submitted disable is a silent no-op.getUnmaskStatus(accountId)returns{active, scopes?, expiresAt?}for the top-bar toggle and its countdown.
Session storage (cross-service contract)
Section titled “Session storage (cross-service contract)”The session is a JSON StepUpUnmaskSession (@osos/shared/step-up-unmask.ts) — {scopes: string[], enabledAt: ISOstring, expiresAt: ISOstring} — written under stepUpUnmaskRedisKey(envPrefix, userId). The key is deliberately clean (no oidc: namespace segment) because users-service writes it through the raw client rather than the namespacing adapter. scopes is either the caller-provided scope from the challenge, or STEP_UP_UNMASK_ALL_SCOPE ('*/*/*', matching every field through the standard wildcard matcher) when none was given.
users-service writes on a dedicated duplicated connection pinned to stepUpSessionDb() (CACHE_REDIS_DB ?? 1): its default client may sit on a different logical DB (the OIDC session/token store), and writing there would put the session somewhere data-service never looks. The key is written with EX ttlSeconds = durationSeconds, so it self-expires — there is no cleanup job.
data-service’s UnmaskSessionService (SINGLETON) is the reader. getActiveScopes(userId) reads the same key byte-for-byte (no re-prefixing), JSON-parses it, and returns session?.scopes or undefined if absent or expired.
Session-scoped unmask sessions Since 1.8
Section titled “Session-scoped unmask sessions Since 1.8”An unmask session now belongs to the sign-in session that opened it, not to the account as a whole. Logging out and back in, or opening a second concurrent session for the same user (a different browser, a second device), starts masked again in that new session — it does not inherit an unmask window opened elsewhere.
This closes a real leak: previously the session was keyed by account id alone, so any session of that account — including one opened later by anyone who could authenticate as that user, or a browser profile the original user forgot to sign out of — inherited whatever unmask window was still open, without that session ever stepping up itself.
Under the hood, both the session key and the pending-challenge key are now scoped by (userId, sessionId), and every reader of the active-scopes lookup passes the caller’s session id through explicitly — there is deliberately no fallback to the old account-wide key on a miss: an absent or wrong session id means “no active session,” full stop. The one exception is a session-less caller (a service-to-service token has no session to scope to), which still falls back to the account-wide key rather than being denied outright. OTP send-rate and verify-rate limiting stay keyed by account only, on purpose — the phone/inbox/brute-force surface being protected belongs to the account, so opening extra sessions must not multiply the allowance.
Step-up keys are tenant-segmented Since 1.10
Section titled “Step-up keys are tenant-segmented Since 1.10”The unmask grant and the single-use step-up proof are written by the identity service and read by data-service through Redis. They used to carry no tenant, so in a multi-tenant deployment a grant or proof earned under one tenant was readable under another, and no offboarding sweep could find it. Both keys are now composed with the tenancy mode:
| Mode | Unmask grant | Proof |
|---|---|---|
| single-tenant | <ENV prefix>step-up:unmask:<uid>[:sid:<sid>] (unchanged) | <ENV prefix>step-up:proof:<id> (unchanged) |
| multi-tenant | <ENV prefix>app:<appId>:step-up:unmask:… | <ENV prefix>app:<appId>:step-up:proof:<id> |
A grant or proof is visible only under the tenant that issued it; with no tenant in scope in a multi-tenant deployment both sides refuse before touching Redis; and offboarding a tenant removes them. The proof keeps its atomic single-use read. Single-tenant installations see no change, so no unmask sessions are lost on upgrade, and nothing changes in the entity builder or the reveal wizard.
Audited events
Section titled “Audited events”Three events, each with a matching audit-service handler that persists an audit entry:
| Event | Published by | Details persisted |
|---|---|---|
SensitiveDataUnmaskEnabledEvent(userId) | users-service, on a successful verify | — (enable action only) |
SensitiveDataUnmaskDisabledEvent(userId) | users-service, on an actual disable (not a no-op) | — (disable action only) |
SensitiveDataUnmaskedEvent(userId, …) | data-service, when maskSensitiveFields actually reveals at least one field | {module, entity, fields, entryIds} |
SensitiveDataUnmaskedEvent is published once per request, batching every field revealed across every entry in that response (entryIds unioned across fields) rather than once per field. The publish is fire-and-forget and error-safe: a failure logs a warning and never blocks or fails the read.
Querying and filtering on sensitive fields
Section titled “Querying and filtering on sensitive fields”To prevent a user from inferring a masked value by filtering on it, a user-supplied query that references a sensitive field the user cannot read is rejected (a deliberate design decision: reject, do not silently drop). A user cannot build a condition such as “salary greater than X” against a field they are not allowed to read. This closes the side-channel where a value could be leaked through search results even while the value itself stays masked on screen.
The rejection throws SensitiveFieldQueryNotAllowedException (error code SENSITIVE_FIELD_QUERY_NOT_ALLOWED, with a {field} detail). Two enforcement paths mirror the two filter syntaxes:
assertUserCanQueryCriteria— reusesQueryEngineService.parseCriteriawith a sensitive context so nestedAnd/Or/ElemMatchbranches are walked exactly as they execute.assertUserCanQueryWhere— walks a loopbackwheretree, strips a leadingvalue.prefix and numeric array-index segments, and matches a field either exactly or as the parent of a suffixed path.
Both are no-ops when there is no user, no criteria/where, or the entity has no sensitive fields. Admin-defined view / quick-filter criteria are treated as trusted system context and are not enforced here — only the user’s ad-hoc criteria are checked. This check is grant-based only: it is not additionally gated by an unmask session, so a grant holder can filter on a field whose value is still masked on screen.
Since 1.10 Naming a protected field is no longer the same right as reading it. In the Administration area, a system editor may now name a sensitive field in a query, a filter, or a reaction condition without holding a read grant for it. Before this, a masked field was dropped from the field picker unconditionally, everywhere — so a manager with no grant of their own saw none of an entity’s sensitive fields when designing a query, even in the admin screens where they were designing the query for other people. Three things did not change:
- An ordinary end user still needs the grant to reference the field; the end-user query builder keeps the old rule.
- Nothing about which values anyone sees changes. The masking path, both masked-field lists, the step-up session, and every element policy are untouched — this widens only who may reference a field in criteria.
- An Encrypted field stays rejected either way, in both areas, ahead of this check entirely — see What an encrypted field refuses.
What decides “admin context” is the area the request came through, not the caller’s role: a system editor browsing the end-user side (through a data view, say) is refused exactly what an ordinary end user is refused for the same query. That is what lets the client’s own field list and the server guard agree without either restating the other’s rule, and it fails closed — an unbound authorizer, absent permissions, or any thrown error all resolve to “not admin”.
Time-bounded (expiring) grants
Section titled “Time-bounded (expiring) grants”A sensitive-field grant can carry a time-bounded validity window instead of lasting until it is manually revoked. When granting access, you can set a start date and/or an end date:
- Leaving both dates empty makes the grant never expire (the default).
- Setting only an end date makes the grant effective from now until that date.
- Setting both defines the full validity window; before the start date the grant exists but confers nothing.
When a grant reaches its end date, OSOS automatically archives the grant record via a pre-configured timer reaction, and the revocation takes effect immediately: the user-permission cache is cleared, the field’s “restricted” state is recomputed, and the archived grant is excluded from every subsequent permission query — so the user loses access the moment it expires, with no manual step.
A grant can also be archived or deleted manually at any point before its expiry; both have the same immediate effect on access. Re-adding a principal whose grant was archived or expired creates a fresh Active record rather than being a silent no-op.
Data model
Section titled “Data model”Field flag: options.sensitive
Section titled “Field flag: options.sensitive”Defined on FieldOptions (field-options.model.ts):
| Field | Type | Default | Meaning |
|---|---|---|---|
sensitive | boolean | false | When true, read access to this field’s value is restricted to users/groups holding a matching grant. |
Transient selection: sensitiveAccess
Section titled “Transient selection: sensitiveAccess”DataEntityField.sensitiveAccess is a SensitiveFieldAccess (sensitive-field-access.model.ts):
class SensitiveFieldAccess { users: ReferenceProperty[]; // users granted read access groups: ReferenceProperty[]; // groups granted read access}This selection is request-only. It is never stored on the entity document:
- On write (create/update field or entity), it is synced into the
access_rightcollection and then stripped from the field before persistence. - On read (fetch field/entity definition), it is recomputed from
access_rightand re-attached on the fly.
Grant storage: the access_right collection
Section titled “Grant storage: the access_right collection”Each granted (user|group, scope) pair is one AccessRight document with:
value.permission_type.id=SENSITIVE_FIELDvalue.scope= the scope stringvalue.entitled_entity={dataEntity: USER|GROUP, dataEntry: <principalId>}value.expiry= optional[startIso, endIso]validity window;nullor absent means the grant never expiresstate=Active, plus standard creation/update info andstore = PUBLIC.
The write path pins two configuration constants when it persists a grant: the record’s store is the PUBLIC_STORE reference (id 'PUBLIC'), and the accompanying AccessRightChangedEvent is published under the root space, ROOT_SPACE_ID ('ROOT'), so the grant and its cache-invalidation event are always scoped to the public store at the space root rather than to a tenant sub-space.
Reads of grants ignore records that are Archived or outside their expiry window, so re-adding a principal whose grant was archived or expired creates a fresh Active record rather than silently doing nothing. Grant queries are backed by a compound index on (value.permission_type.id, value.scope) (migration 1.8.0-a25) and use an ^-anchored regex for index-friendly prefix matching.
A later idempotent migration, 1.8.0-a31, re-asserts the cumulative AccessRight structure (permission_type / scope / expiry) in a single read-modify-send. Its two predecessors persisted their entity change with a fire-and-forget bus send, so an environment that ran them without a data-service consuming the queue recorded the migrations as applied while access_right never gained the scope/expiry structure — leaving the scope picker permanently empty with no self-healing. a31 carries a higher version so it runs on the next migrate, and is a no-op on an already-converged database.
Resolved permissions: sensitiveFields
Section titled “Resolved permissions: sensitiveFields”When a user’s permissions are resolved (access-rights.service.ts), all SENSITIVE_FIELD grant scopes reachable through the user’s own + group grants are flattened, de-duplicated, and exposed as a string array IAllUserPermissions.sensitiveFields. Every runtime access check reads only this array — see Access checks. Holding a matching scope here is necessary but no longer sufficient to see a live value; the step-up unmask session is the second gate.
Four constants live in libs/sensitive-field.ts, three of them still in use:
| Constant | Value | Used for | Since |
|---|---|---|---|
SENSITIVE_DISPLAY_MASK | ****__DISPLAY_SENSITIVE__**** | The value actually substituted into a masked field’s value on read. Not the plain **** an earlier version of this page described. | 1.8 |
SENSITIVE_STARS | **** | What a masked value looks like to a human — substituted only when a value is rendered into prose (an after-save message, a button-confirmation dialog, a redirect URL), never into the entry’s own value payload. | 1.8 |
AUDIT_SENSITIVE_MASK | *** | Permanent mask in audit/history payloads. | 1.8 |
SENSITIVE_MASK (legacy) | ****__MAKE_SENSITIVE__**** | Never emitted on read. Retained only as a detector for data poisoned while it was still in use. | 1.8 |
The read path deliberately returns an unguessable sentinel rather than a value a user could plausibly type by hand, so the write path can tell an untouched masked field a client echoed back apart from a value the client actually changed — see Write path. Because the sentinel is 26 characters, not four asterisks, any code path that substitutes a masked field’s value into human-facing text rather than the JSON value payload has to translate it back to plain stars first; renderSensitiveMaskAsStars does that translation, called centrally from TokenService.replaceTokenInText so every text-substitution site (after-save messages, button-confirmation dialogs, redirect URLs) is covered in one place.
Historical note. Earlier in the 1.8 line, a masked field read back the internal sentinel SENSITIVE_MASK verbatim, and the only write-side protection was the validator restoring the old value when it saw that exact string echoed back — write safety depended entirely on a client behaving. That sentinel was replaced by SENSITIVE_DISPLAY_MASK above; a validator restore still fires on either string, so a client still round-tripping the old sentinel remains protected.
Write-side protection. The 1.8 hardening was designed to replace that sentinel-echo dependency outright with permission-enforced preservation (DataEntryService.preserveSensitiveFieldsOnWrite — discards or restores whatever a user without read access submitted, regardless of the literal value). As currently verified in source, the call that wires that guard into a write has no active call site — see Write path for the detail and for why this is flagged as a probable regression pending confirmation rather than documented as current behavior. Until that is resolved, the validator’s sentinel-echo restore below is the protection actually active for a masked field.
The legacy sentinel survives in the source for two narrow reasons, never as a value the system produces on read:
data-entry-validator.service.tsrestores the stored value if it seesvalue === SENSITIVE_MASKorvalue === SENSITIVE_DISPLAY_MASK— this is the branch that actually protects a masked field on write today (see Write path).- It is used as a poison-data detector: migration
1.8.0-a34and the indexing-servicecontainsLegacySensitiveMaskguard both match the legacy string to find or reject data that leaked while the old sentinel was live. Neither matches the currentSENSITIVE_DISPLAY_MASK, which is distinctive and unguessable enough to be safe as a detector on its own if a future migration needs one.
The index-poisoning bug and its fix
Section titled “The index-poisoning bug and its fix”Worth knowing when reading this code: DataEntryWriterService used to re-read a just-saved entry through the masked read path and publish that masked object as DataEntryCreatedEvent/DataEntryUpdatedEvent. Since indexing-service derives DataEntryIndex.meta.mainTitle from that payload, saving an entry whose title field is sensitive, as a user without the grant, persisted the mask into the shared index — and because a relation resolves its label straight from that index (which cannot be re-masked per reader), the mask came back to every reader, including grant holders. The fix has three parts:
DataEntryWriterService.resolveSavedEntryUnmasked()— every after-save re-read (create, update, patch, upgrade, virtual refresh, post-transaction resolution, batch create with related entries) resolves withdisabledStages.hideSensitiveFields, so event payloads and derived writes always carry authoritative values.DataEntryService.maskEntryForResponse()— masks a deep copy of the saved entry for the HTTP response, leaving the event-payload entry untouched. Masking is a per-reader presentation concern and must only ever be applied on the way out to that specific reader.- Migration
1.8.0-a34repairs rows that already drifted: it synchronously nulls everyDataEntryIndex.meta.mainTitlematching the legacy sentinel pattern, then asynchronously publishes aDataEntityFieldMetaUpdatedEventper affected entity so indexing-service rebuilds the real title. Step 2 is best-effort and unconfirmed from the migration itself — affected entity ids are logged individually so a rebuild can be re-triggered.
Access checks
Section titled “Access checks”SensitiveFieldsService (the primary source) provides pure static helpers plus one instance method:
canAccessSensitiveField(permissions, fieldScope): boolean
Section titled “canAccessSensitiveField(permissions, fieldScope): boolean”Binary check, no admin bypass: returns true iff at least one grant in permissions.sensitiveFields matches fieldScope via matchesSensitiveScope (wildcard-aware). A user with no sensitiveFields array (or an unauthenticated request) is treated as having no grants and therefore no access.
This is the grant check only. A live entry read needs an additional active-unmask-session check on top of it; canAccessSensitiveField alone still governs the write guard and the query guard, neither of which is session-gated. Reading audit history is the exception — Since 1.8 it requires both the grant and an active session, the same as a live read; see Reading audit history.
filterQueryableFieldsForUser(fields, permissions, moduleNn, entityNn)
Section titled “filterQueryableFieldsForUser(fields, permissions, moduleNn, entityNn)”Filters a flat field list, dropping sensitive fields the user cannot access; non-sensitive fields always pass. Intended for the query-builder field-list so the UI only offers fields the user may filter on. (Verified as an exported static helper; no production caller of it was found — see Known gaps.)
getSensitiveFieldOptions(search?, excludeScopes?) — the option catalogue
Section titled “getSensitiveFieldOptions(search?, excludeScopes?) — the option catalogue”Instance method returning one SensitiveFieldOptionDto per sensitive field across the whole space (all entities/modules), for the scope selector. It runs a Mongo aggregation over DataEntity that:
$lookups the parentDataModulefor localized module context.- Collects top-level sensitive fields (excluding Block container fields).
- Collects block sub-fields marked sensitive, emitting a dotted
block.subfieldnormalized name; orphaned block sub-fields (no Block field references the internal entity) are skipped, mirroringgetAllFields(). - Optionally filters by
searchagainst field names across all registered language codes. The term is regex-escaped (\\$&) before interpolation to prevent invalid-regex crashes and ReDoS. - Optionally excludes any scope in
excludeScopes, used by the “Add grant” dialogs to hide fields a target user or group already effectively holds — see Option exclusion.Since 1.8
Each SensitiveFieldOptionDto carries id, fieldName/fieldNormalizedName, entityName/entityNormalizedName, and moduleName/moduleNormalizedName (localized names are LocalizedValue).
The DTO is served through the generic reference-field-data endpoint via SensitiveFieldSelectorComponentFetcher (component name SensitiveFieldSelectorComponent), bound to the scope field of the AccessRight entity (migration 1.8.0-a24). The fetcher returns the flat catalogue verbatim; the search term comes from the request body.
Reading audit history
Section titled “Reading audit history”DataEntryHistoryService.maskSensitiveHistoryFields(history, dataEntity, user) replaces the old/new values of sensitive fields in each Update history record’s additionalData with AUDIT_SENSITIVE_MASK. Since 1.8, this reveals a field only when both the grant (canAccessSensitiveField) and an active unmask session cover it — the same grant-and-session rule a live read applies. An earlier rule here was grant-only, which meant anyone holding a grant could read a field’s past values in its history without ever opening an unmask session — a way around the live-read rule, since the value stayed hidden on the entry itself but was exposed one screen over, in its history. It only replaces old/new when the property is actually present, so a first-write record (only new) does not gain a spurious masked old. A fast path returns unchanged history when the entity has no sensitive fields.
Separately, in audit-service, audit-base-handler.ts masks sensitive values before persisting the audit record (using its own local AUDIT_SENSITIVE_MASK = '***'), and fails closed: if sensitive-field metadata cannot be loaded, every value in the payload is masked rather than risk leaking a sensitive value into the immutable audit log.
Write path (permission-enforced preservation) Since 1.8
Section titled “Write path (permission-enforced preservation) Since 1.8”Because an unreadable field reads back as a mask sentinel, a naive write-back would let a user echo it and unintentionally overwrite the real value, or seed an arbitrary one. The design for closing that gap is enforced by permission, not by client behavior:
DataEntryService.preserveSensitiveFieldsOnWrite(newValue, oldValue, dataEntity, permissions)— for every sensitive field the caller cannot read, discards whatever was submitted and restores the stored value. On create (nooldValue) the field is dropped entirely rather than seeded.- For a sensitive sub-field inside a repeatable block: on create the sub-field is stripped from every submitted row; on update, values are restored by array index, because rows carry no stable id. If the submitted row count differs from the stored count — an insert or delete that a caller without the grant cannot safely be reconciled against — the write is rejected with
SensitiveFieldWriteNotAllowedException({field}detail) rather than risk dropping or misattaching a protected value. An equal-length reorder is undetectable without a row id, but it is a data-integrity edge, never a disclosure. - Deliberately no admin bypass was ever part of the design. Sensitive-field access is grant-based and the read mask does not exempt admins either, so exempting writes would reopen the hole the guard exists to close. Unconditional system writes are meant to go through internal service calls instead.
Flagged for reviewer confirmation — not a documented behavior change. Verified against the current source: the call site that used to invoke this guard before every create, update, patch, and batchCreate write (DataEntryWriterService.enforceSensitiveFieldWriteAccess) has been removed, while preserveSensitiveFieldsOnWrite itself, its exception type, and its unit tests all remain in place — a full search of the codebase turns up no remaining production caller. Nothing in the surrounding history frames this as an intentional removal, and a code comment on the batch-write path still describes the guard as active. Until a backend engineer confirms whether this is deliberate, treat it as a probable regression, not settled behavior:
- The only write-side protection actually active for a masked field right now is the validator’s legacy sentinel-echo restore described in Masks — it protects a client that echoes the mask sentinel back unchanged, but does not stop a client from submitting a different value for a field it cannot read.
- Batch-diff sanitization is affected too.
batchCreate’sDataEntryCreatedEvent.valueDiffis meant to be recomputed from a sanitized entry — one the guard above has already stripped of unauthorized sensitive-field values — rather than from the raw client payload, so an unenforced diff can’t carry a value the caller was never allowed to set. With the guard’s call site gone, that recompute now runs against an entry that was never actually sanitized by it.
If your integration relies on this guard, verify current behavior against your own deployed backend rather than this description; this page will be updated once the status above is confirmed.
Constraints (what can be marked sensitive)
Section titled “Constraints (what can be marked sensitive)”FieldService.validateAndNormalizeSensitive enforces, when options.sensitive === true:
- Rejected on reference fields (
DataTypeEnum.Entity) and Block container fields (DataTypeEnum.Block) → throwsSensitiveFieldNotAllowedException(error codeSENSITIVE_FIELD_NOT_ALLOWED). - Forced off:
options.searchable = falseandoptions.showAsTitle = false(a sensitive value must not be indexed for search nor used as the entry title).
Block sub-fields may still be marked sensitive individually — only the Block container field itself cannot be.
The entity’s main title field cannot be marked Sensitive Since 1.8
Section titled “The entity’s main title field cannot be marked Sensitive Since 1.8”Since 1.8 The two directions are now both closed:
- Marking a field sensitive forces
options.showAsTitleoff, as above. A field cannot be sensitive and the entry title. - The entity’s View Options → Main Title picker now excludes every field whose
options.sensitiveis true, block sub-fields included — the exclusion filter is tree-aware. Before this, the picker only excluded the configured sub-title field (and anything nested under it) and did not consider sensitivity at all, so an already-sensitive field could still be selected as the main title even though the backend rule intended otherwise.
The reason is disclosure, not tidiness: the main title is rendered unmasked across list and detail surfaces, because it is what row labels and reference labels display. A sensitive field used as the title would therefore leak its value to every user who can see the entry in a list.
The sub title, by contrast, is allowed to be sensitive Since 1.8
Section titled “The sub title, by contrast, is allowed to be sensitive Since 1.8”This is easy to get backwards, so read the behavior itself rather than assuming it mirrors the main-title rule above: a sensitive field may be the sub title. Earlier in the 1.8 line this was rejected in both directions, mirroring the main-title restriction exactly — picking an already-sensitive field as sub title, or marking the configured sub-title field sensitive, both failed, on the reasoning that the card, badge, calendar, mini-card, and tree faces all render a sub title as plain text too. That restriction was removed before this line shipped: those surfaces now mask a sensitive sub title themselves (the same **** treatment every other field renderer already applies to a sensitive value), instead of the field being barred from the role. If you find an older description asserting sub titles are barred, it reflects that intermediate, no-longer-current state — not what the platform enforces today.
Mapped fields inherit sensitivity Since 1.8
Section titled “Mapped fields inherit sensitivity Since 1.8”A mapped field — a field on one entity configured to mirror a field on another entity through a relation (mapping.enabled, mapping.sourceFieldId) — automatically carries the source field’s sensitivity and grant holders with it. Marking the source field sensitive, or changing who can read it, propagates onto every field mapped from it, so a mapped field ends up masked and granted by the same machinery as any other sensitive field, rather than needing special-casing on read.
Propagation runs in both directions, because either side can change first:
- When the mapping entity itself is saved, its mapped fields’ sensitivity and grant holders are re-derived from their source fields before the save completes.
- When the source field changes without the mapping entity being touched, the change is pushed out to every entity that maps from it — chained through multi-hop mappings (if entity
CmirrorsB, which itself mirrorsA, updatingBin the same pass makes it the source for the next hop ontoC), with a cycle guard so a mapping loop cannot spin forever. Deleting a field that other entities mapped from also runs the propagation, so a mapped field whose source no longer exists stops being sensitive and its mirrored grants are torn down.
A propagation failure is logged and swallowed rather than failing the edit that triggered it, and is recoverable by re-saving either entity.
Encrypted fields Since 1.10
Section titled “Encrypted fields Since 1.10”Marking a field Sensitive changes what a reader is shown — the stored value stays plaintext in the database. Encrypt is a second, separate option that changes what is stored: the value is written as ciphertext (AES-256-GCM), and it stays ciphertext even for a caller running with authorization skipped. There is no “system bypass” of encryption the way there is of a permission check.
Encrypt is its own option, and the two are mutually exclusive
Section titled “Encrypt is its own option, and the two are mutually exclusive”options.encrypt sits beside options.sensitive on the field, and in the field editor the Encrypt toggle is Sensitive’s own sibling block — rendered immediately after Sensitive and before Searchable, not nested inside it. A field may carry at most one of the two. FieldService.validateAndNormalizeEncrypt rejects {sensitive: true, encrypt: true} with SensitiveAndEncryptMutuallyExclusiveException (code SENSITIVE_AND_ENCRYPT_MUTUALLY_EXCLUSIVE, message “A field cannot have both sensitive and encrypt enabled at the same time.”, detail {field}).
Two practical notes on that rule:
- The error code has no localized copy — it is absent from the error dictionary, so on the rare path where it does reach a user, it arrives untranslated.
- In the editor the rule is a silent, symmetric auto-untoggle, not a validation error. Turning Sensitive on switches Encrypt off; turning Encrypt on switches Sensitive off; whichever the designer just switched on wins. Neither toggle is ever disabled because of the other, and there is no client-side validator or message for the rule at all — the server’s untranslated message is the only feedback if a client somehow submits both. A legacy field stored with both flags true resolves to Sensitive when the editor loads it.
Turning Encrypt on also clears Searchable — the server force-sets options.searchable = false on save, keeping ciphertext out of the shared full-text index — and empties the inherited-holders selector.
Grants are not a second mechanism. An Encrypted field is authorized through the same transient sensitiveAccess selector and the same SENSITIVE_FIELD grant records described above, on the same module/entity/field scope. The field editor’s user/group picker is simply duplicated under the Encrypt toggle so grants stay reachable when Encrypt is on without Sensitive; it writes the same grant, not a second one. The admin-side consequence — an encrypt-only field now being offered in the Add-grant dialogs at all — is on Sensitive Permissions.
Which field types can be encrypted
Section titled “Which field types can be encrypted”Four kinds can never be encrypted. The server does not reject them — it silently normalizes encrypt back to false:
| Cannot be Encrypted | How it is recognized |
|---|---|
| Reference / relation field | dataType === DataTypeEnum.Entity |
| Block container | dataType === DataTypeEnum.Block |
| Switch | dataType === Json with a SwitchComponent edit component |
| Category | dataType === Json with a CategoryComponent edit component |
Everything else is encryptable: text, number, date, time, date-time, boolean, blob (files and images), icon, localized JSON, GeoJSON, plain JSON, object JSON, and SVG icon.
The two exclusion lists are deliberately different shapes — in both directions:
sensitiveexcludes only reference and Block fields. A Switch or a Category field can therefore be marked Sensitive but never Encrypted.- In the field editor, a Mapped field is hidden from the Sensitive toggle but not from the Encrypt toggle. That asymmetry is intentional and is called out as such in the component; the backend has no mapped-field rule for Encrypt either. What it does have is a narrower conflict rule: a continuously-syncing mapped field (
ParentOnly/TwoWay) may not be mapped from an Encrypted or mid-transition source (FIELD_MAPPED_FROM_ENCRYPTED_SOURCE).
Because the normalization above runs before the mutual-exclusion check, one of those four kinds submitted with both flags true is normalized, never rejected — its encrypt is already false by the time the check runs, so the exception never fires for them.
Two adjacent constraints mirror the Sensitive ones: an Encrypted or mid-transition field cannot be the entity’s main title (ENCRYPTED_FIELD_CANNOT_BE_MAIN_TITLE — unlike the mutual-exclusion code, this one is localized), while the sub title is still allowed to be Encrypted, because the faces that render a sub title mask it themselves. The main-title check reads the persisted transition state, not whatever the request body claims.
How the encryption works
Section titled “How the encryption works”Enough detail to plan a deployment and to recognize a stored value — not a cryptography specification:
- Cipher: AES-256-GCM. Each value is encrypted under a fresh 12-byte IV with a 16-byte authentication tag; the envelope is
iv:authTag:ciphertext, each segment hex, joined by:. Decryption rejects any envelope that is not exactly three parts, whose IV is not 12 bytes, or whose tag is not 16 bytes, and pins the tag length explicitly — a deliberate hardening against a short, and therefore forgeable, tag being accepted. - Two layers, and no KDF. The master key is read straight from the
FIELD_ENCRYPTION_MASTER_KEYenvironment variable — 64 hex characters, or base64, decoding to exactly 32 bytes. There is no PBKDF2 / HKDF / scrypt step: the environment value is the master key. It wraps a randomly generated 32-byte data-encryption key (DEK), and the DEK is what encrypts field values. - One active key per data-service database; one master key per deployment (
localprovider). The active key is the single document flaggedisDefault: truein theEncryptionKeyscollection (an index-enforced flag,Since 1.10— it replaced an earlier “the document literally nameddefault” convention) — never the raw key material, only a wrapped DEK or, indirectmode, no DEK at all. There is no per-tenant, per-entity, per-field or per-user key, and general key rotation within the same provider is still out of scope. WhatSince 1.10adds is a different capability — the ability to switch which provider/mode is active — see Encryption providers below; that is not rotation, and it does not re-encrypt anything already stored. A missing default key is a loud failure (DEFAULT_ENCRYPTION_KEY_NOT_FOUND) rather than a silent write of an unencrypted value that merely looks encrypted, and the provider is resolved from the key’s own record, so a key created under one provider can never be processed by another. Retiring a key never makes its data unreadable — decryption resolves keys by id from the ciphertext itself, so a retired (non-default) key must never be deleted while it still has surviving ciphertext. - A missing master key is a hard failure at startup or first use — unless both
NODE_ENV=developmentandALLOW_INSECURE_FIELD_ENCRYPTION_KEY=trueare set, in which case an all-zero development key is used. That fallback is never reachable in production. - At rest, a value is
<keyId>:<iv>:<tag>:<ciphertext>— four colon-separated segments, the key id being everything before the first colon. A multi-value field is encrypted element-wise: one composed string per array element, not one ciphertext for the whole array. A malformed stored value raisesMALFORMED_ENCRYPTED_VALUE, whose payload carries only the raw length — never the raw string. - Nothing ever detects ciphertext by looking at it. Whether a given entry’s stored value already reflects the field’s current
encryptsetting is a plain integer comparison —entry.entityVersion >= options.encryptTransitionVersion— so a string, an array and a block sub-field all behave identically, and a plaintext value can never be coincidentally misread as ciphertext. A write-path guard additionally stops an already-encrypted value being encrypted a second time when an unchanged entry is re-saved.
What an encrypted field refuses
Section titled “What an encrypted field refuses”An encrypted value is opaque to the database, so every operation that would need to read into it is refused outright rather than silently producing nonsense:
| Operation | On an Encrypted field |
|---|---|
| Full-text search | Off — searchable is forced off when Encrypt is saved. |
Filter / query criteria, and loopback where | Rejected unconditionally (SENSITIVE_FIELD_QUERY_NOT_ALLOWED), ahead of any grant or admin-area check. Holding the grant does not help. |
| Reaction conditions and criteria | Rejected, under their own code ENCRYPTED_FIELD_NOT_ALLOWED — “This field is Encrypted and cannot be used in a reaction condition.” Encrypted fields are also filtered out of every reaction picker, top-level and internal-entity alike. |
| Aggregates on a summary | Refused outright — the aggregate does not appear at all, not even masked: an aggregate over ciphertext is meaningless rather than secret. The aggregate picker hides Encrypted fields for the same reason. |
| Entity main title | Not allowed (ENCRYPTED_FIELD_CANNOT_BE_MAIN_TITLE). |
| Reports | Stripped from both the report field catalogue and the export column set. |
| Notification and email tokens | A field, expression, or pointer token resolving to an Encrypted field resolves to an empty string instead. (A Fixed token is literal text and is unaffected.) |
| Document export templates, and mapped-field data copies | Masked unconditionally, before any expression is evaluated or anything is rendered. |
| Grouping | Does not fail — it collapses. See below. |
Grouping is the one that behaves differently, and deliberately so. A view grouped on a field that later becomes Encrypted (or Sensitive) does not break: the level collapses into one group headed ****, carrying the correct total count and every matched entry. There is no per-viewer variant — a grant holder with an active unmask session sees the same single group as an anonymous visitor — because a saved grouping level is shared configuration, not a per-request choice, and grouping by a protected value is useful to nobody. The masked group key carries no field path at all, so no pipeline stage can unwind, look up, convert, or order by it. This replaced an earlier design that returned a 400 naming the field as sensitive — which disclosed more than a single **** bucket does, and which the user could do nothing about. For the same reason the grouping picker no longer filters sensitive fields out at all.
Decrypting a value
Section titled “Decrypting a value”An Encrypted field is never revealed through the classic masking path — maskSensitiveFields refuses it outright, grant and session notwithstanding. It has exactly one reveal mechanism:
POST /v2/entities/{entity}/entries/{entryId}/fields/{field}/decryptBody: { "stepUpProof"?: string, "rowIndex"?: number }200 → { "value": <decrypted value> }There is no request body requirement beyond the proof. It is a POST-as-read: a method-level voter replaces the class-level edit gate and checks canViewEntity, not canEditEntity, because the call fetches and reveals a value — it never writes one.
The handler runs in this order:
-
Resolve the entity and the field —
EntityFieldNotExistExceptionif absent. -
Check the caller may read this specific entry (
ForbiddenToReadEntryException); the class-level voter alone would let a system-wide viewer read any entity’s data. -
Refuse a repeatable field unless
rowIndexis given —DecryptNotSupportedForRepeatableFieldException/DECRYPT_NOT_SUPPORTED_FOR_REPEATABLE_FIELD. -
Refuse a password-rendered field before the entry is even fetched —
DecryptNotSupportedForPasswordFieldException(Since 1.10) — a password field’s stored value is a one-way hash, so there is nothing to decrypt. -
Refuse a field with nothing to decrypt —
FIELD_NOT_ENCRYPTED. A field mid a toggle-off whose entry has not yet been upgraded deliberately stays reachable: that is the documented recovery path, see Toggling Encrypt. -
The field grant.
canAccessSensitiveFieldagainst the field’s ownmodule/entity/fieldscope; failure is a403(SensitiveFieldDecryptForbiddenException/SENSITIVE_FIELD_DECRYPT_FORBIDDEN, “Permission denied. You do not have access to decrypt this field.”). -
Since 1.10— a fresh, correctly-bound, single-use step-up proof.StepUpProofService.consumeDecrypt(body?.stepUpProof, {userId, sessionId, entityId, entryId, fieldId, rowIndex})atomically redeems the proof (RedisGETDEL) and re-compares every bound field. A missing, expired, already-spent, or mismatched proof throwsSensitiveFieldDecryptStepUpRequiredException— the same exception whether the proof was never supplied or was wrong, so the response never distinguishes “you forgot to verify” from “your verification didn’t match this exact request.” See Step-up unmask, Decrypt, and WorkflowAction below for how the proof is minted. -
Decrypt via
readEncryptedFieldValue. Anull/undefinedvalue, or one that doesn’t parse cleanly, passes through the same way every other Encrypted field type does — decryption never invents a value. -
Publish
SensitiveDataDecryptedEvent.
The grant and the proof are both required — neither alone is enough, and there is no admin exemption: unlike WorkflowAction (below), which skips step-up entirely for an admin execution, Decrypt applies the check to every caller, precisely so a grant holder is never contradicted by letting an admin bypass it silently. A denied caller (no grant) may retry the identical request indefinitely and always gets the same 403 — there is nothing to guess there, so no lockout applies to the grant check itself. A caller who has the grant but keeps failing the step-up challenge (wrong code/password) hits the same account-scoped OTP/MFA rate limit the classic Unmask flow shares — see Step-up unmask session above.
Every successful decrypt is audited under its own event name — not as an extra unmask record — carrying who did it, the module, entity and fields, and the entries involved. The decrypted value itself is never recorded. This is a separate audit record from the step-up identity check itself, which is recorded too — see Step-up unmask, Decrypt, and WorkflowAction below. See Monitoring: Logs & Audit and the step-up-verify record for what the administrator sees, and Account Security & Sensitive Data Reveal for what the person clicking the icon experiences.
Step-up unmask, Decrypt, and WorkflowAction: three purposes, one mechanism Since 1.10
Section titled “Step-up unmask, Decrypt, and WorkflowAction: three purposes, one mechanism Since 1.10”Since 1.10 the platform generalized what had been a two-purpose step-up mechanism (Unmask, pre-existing since 1.8; WorkflowAction, added in the same release — see Workflow model and API reference: step-up verification before executing an action) into three, by adding Decrypt. All three are members of one StepUpPurpose enum (packages/osos-shared/src/step-up-proof.ts; see also core-reference-enums.md), share the same four users-service endpoints (POST /identity/mfa/step-up/{challenge,verify,disable}, GET .../status) and the same pending-challenge Redis slot keyed by account + OIDC session — but purpose is fixed at challenge time and the three are never interchangeable: verifyUnmask branches on pending.purpose, and a proof or session minted for one purpose can never satisfy another.
| Purpose | Status | Mechanism | Binding | TTL |
|---|---|---|---|---|
Unmask ('unmask') | Pre-existing, Since 1.8 | A reusable session in Redis, opened for a caller-chosen duration, scope wildcard-matchable up to global */*/* | Account + OIDC session + scope | Caller-chosen, from the allow-list in Reveal durations |
| Decrypt ('decrypt') | New, Since 1.10 | A single-use proof — exactly one field reveal, then destroyed on redemption | {entityId, entryId, fieldId, rowIndex?} — every field re-compared on redemption | 120 seconds |
| WorkflowAction ('workflow-action') | New, Since 1.10 | A single-use proof per entry — batchable: one factor check can mint a proofs: {entryId: proof} map covering a whole selection | {entityId, entryId, actionId} × N, one binding per entry | Same 120 seconds, per proof |
Design details that hold across all three purposes:
- The proof is the secret. For
Decrypt/WorkflowAction, minting generates acrypto.randomUUID()and stores it, with its binding, at a proof-scoped Redis key. Redemption usesGETDEL— atomic, so exactly one caller can ever win — and a mismatched presentation still burns the proof rather than leaving it available to retry. - Minting refuses a session-less caller. A
client_credentials/ROPC caller (no OIDC session) is refused aDecryptorWorkflowActionchallenge outright — such a proof could never be redeemed safely or audited.Unmaskcarries no such restriction, since a session-less caller there simply falls back to an account-wide grant. Decryptuniquely always offers the password fallback, independent of the tenant’sallowPasswordStepUpdomain setting.UnmaskandWorkflowActiononly fall back to the account password when the caller has no usable MFA method and the domain has explicitly opted in.Decryptignores that setting and always allows the fallback (still gated on the user having no usable MFA method and holding a local password) — a grant holder must never be left with literally no way to ever reveal a field they hold a grant for, on a default-configured domain that never enabled the MFA-less fallback for anything else.- A
WorkflowActionchallenge may batch;Decryptnever does. AWorkflowActionbatch is capped at 100 bindings, every binding sharing the sameentityId/actionId(one action, many entries — never a mixed batch), with no duplicateentryId; the batch’s effective expiry is the first proof’sexpiresAt, since the batch is only usable while its earliest member still is.Decryptaccepts only a single binding — one reveal per proof, every time. - Audit. Both new purposes record their identity-check outcome on the existing MFA audit trail via dedicated helpers, distinct from, and in addition to, the data-entry audit event a successful reveal or workflow-action execution separately produces. See Monitoring: Logs & Audit.
Recovery-code regenerate/view is a fourth, separate, simpler mechanism — not a StepUpPurpose. POST /identity/mfa/totp/recovery-codes/regenerate takes a code or password directly in the request body and verifies inline, the same pattern the pre-existing TOTP-disable endpoint uses. It shares no Redis session, no single-use proof, and no StepUpPurpose value with the three purposes above — do not describe it using step-up vocabulary. See Account Security & Sensitive Data Reveal for the user-facing flow.
Full workflow-action detail — the stepUp config property on a workflow action, the endpoints, the bulk batching contract end to end, and the refusal shape — is in Workflow model and API reference: step-up verification before executing an action. The comparison below covers Decrypt specifically, against the classic Unmask session:
| Sensitive: step-up unmask | Encrypted: Decrypt Since 1.10 | |
|---|---|---|
| Precondition | grant and an active step-up session covering the scope | grant and a fresh, unspent, correctly-bound single-use proof |
| Step-up (OTP/MFA/password) | Yes — opens a session | Yes, Since 1.10 — mints a proof good for exactly one reveal |
| Session vs. proof | Redis session, caller-chosen duration, scoped to the OIDC session, reusable for every matching field until it expires | Redis single-use proof, 120s TTL, bound to one exact {entity, entry, field, rowIndex?}, destroyed on first use whether or not it matched |
| Reach of one reveal | every scope the session covers, in practice all of them (wildcard-matchable up to global) | exactly one field, on one entry (+ row, for a block-repeatable field) |
| How the value arrives | the next read comes back unmasked | returned inline by the call itself |
| Repeatable fields | supported | rejected unless rowIndex is given |
| Audit event | SENSITIVE_DATA_UNMASKED; no separate step-up-verify row for this purpose | SENSITIVE_DATA_DECRYPTED and a Decrypt-tagged step-up-verify row (MFA audit trail) |
| Admin exemption | N/A — Unmask is the per-user session | None. Unlike WorkflowAction, which skips step-up for an admin execution, Decrypt applies to every caller. |
What the client does, Since 1.10. Both web and mobile now open a step-up prompt before calling decrypt, on every tap — not just the first. Web puts the Decrypt and WorkflowAction prompts on one shared dialog shell but deliberately does not route Decrypt through the same helper WorkflowAction uses, because that helper applies the admin exemption — which must never apply to Decrypt. Mobile opens the same generalized verification prompt the workflow-action gate uses. Neither client offers the reveal affordance at all for a password-rendered field — the permanent lock shows instead, matching the backend guard in step 4 above.
Toggling Encrypt: a versioned breaking change
Section titled “Toggling Encrypt: a versioned breaking change”There is no data-backfill migration behind the Encrypt toggle. Turning it on — or off — is treated as a versioned breaking schema change and resolved through the ordinary Upgrade Records flow:
- Changing
encryptadds aField encryption changedreason to the new entity version’s breaking-change list. It is added even when another reason already applies (a type change, say), so the stamping in step 2 always happens. - Every affected field is stamped with
encryptTransitionVersion(the new entity version) andpendingEncryptUpgrade = true. Neither is admin-facing, and both are re-stamped from the persisted field on every field update regardless of what the request body sends — so a client that omits them cannot silently erase a transition in progress. - Entries below that version become Obsolete, and the administrator resolves them through Upgrade Records as usual. For the whole window the field is excluded from every builder surface.
- After each successful upgrade the platform counts the entries still below the transition version — ignoring archived entries, which would otherwise stop the count ever reaching zero and leave the flag stuck forever — and clears
pendingEncryptUpgradewhen none are left. - Auto Repair is refused when the toggle is being turned OFF.
SYSTEM_BEHAVIOR_NOT_ALLOWED_FOR_ENCRYPTION_TOGGLE_OFF: “Auto Repair cannot be used to resolve this field while its Encrypt toggle-off is still in progress. Choose Fixed, Expression, Dynamic, or Not Set instead.” The stored value is still real ciphertext, and onceencryptisfalsenothing downstream re-encrypts or masks it — Auto Repair would promote the raw ciphertext to the entry’s real value going forward. The documented recovery is to call Decrypt on the entry — which stays reachable precisely for this case — and supply the plaintext as the dialog’sFixedresolution. Auto Repair remains available in the toggle-on direction, which is the intended “just encrypt it” choice.
Re-toggling Encrypt while a transition is still pending is allowed: an earlier guard that rejected it was removed after launch.
Encryption providers and keys Since 1.10
Section titled “Encryption providers and keys Since 1.10”Which key service enciphers field values (local, HashiCorp Vault Transit or Azure
Key Vault), the wrap and direct key modes, provider configuration, activation,
adopting a provider change on a running install, and the chart wiring are
operator concerns, documented in
Field encryption keys and providers. Nothing
on this page changes with the provider: grants, masking, Decrypt and the refusals
behave the same.
Sensitive-data access policy Since 1.10
Section titled “Sensitive-data access policy Since 1.10”A grant answers “may this reader see this field?”. But some things run, or are generated, on someone’s behalf — a reaction, an export template, a summary — and there the question is different: “what should this element be allowed to disclose when it runs?”. That is a separate, element-level setting: the Sensitive Data Access Policy.
| Policy | What it means |
|---|---|
| Prohibited | Never reveal, whoever executes, opens, or generates the element. |
| Privileged | Always reveal, independently of the executor’s own grants. The default. |
| User-Based | Decide per execution, from the actual executor’s own sensitive-field grants. |
| Auto | A system run behaves as Privileged; a user-triggered run behaves as User-Based. |
It is stored as sensitiveDataAccessPolicy on the element. An absent value resolves as Privileged, so every reaction, template and summary that predates the feature keeps exactly the behavior it had before the setting existed — nothing pre-existing changed, and no backfill migration was needed. An unrecognized stored value resolves to mask: the resolver fails closed.
Where it applies — and where it deliberately does not:
| Element | Policy available? |
|---|---|
| Reaction | Yes — all four values. |
| Document export template | Yes — all four values. |
| Summary (dashboard tile / statistic query) | Yes, except Auto — a summary has no automatic or scheduled run distinct from its live rendering, so the option is not offered at all. |
| Report | Deliberately not. A report keeps following each viewer’s own sensitive-field permission instead. |
| Views, plain queries, entry lists | Not part of this policy at all. |
The control appears on the reaction, template and summary forms only when the entity actually declares at least one sensitive field (block sub-fields included); when it is hidden it is disabled rather than left silently blocking Save.
Three rules are enforced when the element is saved or run:
Autoon a summary is rejected — “The ‘Auto’ option is not available on a summary”.User-Basedtogether with an automatic reaction trigger — a system executor, a timer, or an SLA-exceeded event — is rejected: “The ‘User-Based’ policy cannot be selected with an automatic trigger type”. There is no human executor whose grants could be consulted.- A reaction whose policy masks a value it then needs to act on fails (
SENSITIVE_DATA_ACCESS_PROHIBITED) rather than persisting****. Only the five rendering actions — send notification, send email, send SMS, generate file from template, announce event — tolerate a masked value passing through them.
A summary the policy denies is hidden entirely, not masked. There is no chart, no card, and no ****: the request is a 403 and the dashboard renders “You do not have permission to view this summary” in the tile’s place. Under User-Based the executor must hold a grant for every sensitive field the summary reads — a partially-revealed aggregate is still a leak — and that now includes the fields the summary’s own source query filters on, not only the aggregated and grouped ones. (Contrast the per-field rule for an ordinary aggregate a reader simply has no grant for: that one stays present under its display name showing ****, because a vanished aggregate was itself a disclosure.)
End-to-end flow summary
Section titled “End-to-end flow summary”- A designer marks a field
sensitiveand picks users/groups in the field editor, or an admin grants access later through the grants API. The scope ismodule/entity/field, or a wildcard scope for an inherited grant. - On save,
syncSensitiveFieldAccess(field editor) orcreateSensitiveFieldGrants(admin API) writesSENSITIVE_FIELDAccessRightrecords for the scope and publishesAccessRightChangedEvent. - When permissions are resolved, matching grant scopes flow into
permissions.sensitiveFields. - To actually see a value, the user must additionally open a step-up unmask session covering the scope; that session belongs to their specific sign-in session, not just their account.
- On entry read,
maskSensitiveFieldsreveals a field only when both the grant and an active unmask scope match; otherwise it substitutes the mask sentinel. Revealed fields publish a batchedSensitiveDataUnmaskedEventfor audit. The entity definition reports masked field names insensitiveMaskedFields(no grant) andsensitiveMaskedFieldsWithUserAccess(grant held, session not covering it). - On query, unreadable sensitive fields in user criteria/where cause a
SensitiveFieldQueryNotAllowedException(grant-only check, no session gate). - On entry write,
preserveSensitiveFieldsOnWriteis designed to discard or restore whatever was submitted for a field the writer cannot read — but as currently verified in source it has no active call site (see Write path); the validator’s sentinel-echo restore is the protection actually active today. - On audit read, sensitive
old/newvalues are replaced with***, now requiring both the grant and an active unmask session covering the scope; the audit writer masks, fail-closed, before persisting. - If the field mirrors another entity’s field (a mapped field), its sensitivity and grant holders are kept in step with the source field automatically, in both directions — see Mapped fields inherit sensitivity.
Since 1.10If the field is Encrypted rather than Sensitive, steps 4–6 do not apply at all: the value is ciphertext at rest, every builder surface refuses it (grouping collapses instead), and the only way to see it is a per-entry Decrypt call gated on the grant and a fresh single-use step-up proof (Since 1.10) — no reusable session, but no longer verification-free either — audited under its own event name plus a separate step-up-verify record.Since 1.10A reaction, an export template, or a summary additionally carries its own sensitive-data access policy, deciding what that element may disclose when it runs. The default,Privileged, is exactly what all three did before the setting existed.Since 1.10The Decrypt reveal and a gatedWorkflowActionexecution both go through the same generalized three-purpose step-up mechanism — see Step-up unmask, Decrypt, and WorkflowAction.
Reference: key symbols
Section titled “Reference: key symbols”| Symbol | File | Role | Since |
|---|---|---|---|
buildSensitiveFieldScope | libs/sensitive-field.ts | Build a module/entity/field scope. | 1.8 |
matchesSensitiveScope | libs/sensitive-field.ts | Wildcard segment match. | 1.8 |
SENSITIVE_DISPLAY_MASK | libs/sensitive-field.ts | The 26-character sentinel actually returned on read. | 1.8 |
SENSITIVE_STARS / renderSensitiveMaskAsStars | libs/sensitive-field.ts | Human-facing **** and the text-substitution sanitizer that produces it. | 1.8 |
SENSITIVE_MASK (legacy) / AUDIT_SENSITIVE_MASK | libs/sensitive-field.ts | Legacy sentinel detector / audit mask. | 1.8 |
SensitiveFieldsService.canAccessSensitiveField | services/sensitive-fields.service.ts | Binary grant check (no admin bypass). | 1.8 |
SensitiveFieldsService.filterQueryableFieldsForUser | services/sensitive-fields.service.ts | Drop inaccessible sensitive fields from a list. | 1.8 |
SensitiveFieldsService.getSensitiveFieldOptions | services/sensitive-fields.service.ts | Space-wide catalogue (optional excludeScopes). | 1.8 |
AccessRightsService.syncSensitiveFieldAccess | services/access-rights.service.ts | Declarative grant diff + event (field-editor path). | 1.8 |
AccessRightsService.listSensitiveFieldGrants | services/access-rights.service.ts | Space-wide Active grants list. | 1.8 |
AccessRightsService.listUserSensitiveFieldGrants | services/access-rights.service.ts | A user’s direct + group-inherited grants. | 1.8 |
AccessRightsService.listGroupSensitiveFieldGrants | services/access-rights.service.ts | A group’s direct grants. | 1.8 |
AccessRightsService.getInheritedSensitiveFieldHolders | services/access-rights.service.ts | Wildcard-scope holders for one field. | 1.8 |
AccessRightsService.createSensitiveFieldGrants / updateSensitiveFieldGrant / deleteSensitiveFieldGrant / archiveSensitiveFieldGrant | services/access-rights.service.ts | Grants-management API mutations. | 1.8 |
AccessRightsService.getSensitiveFieldGrants | services/access-rights.service.ts | Read grants under an entity scope prefix. | 1.8 |
AccessRightsService.removeSensitiveFieldAccess | services/access-rights.service.ts | Tear down grants at or under a scope. | 1.8 |
DataEntityService.attachSensitiveFieldsAccess | services/data-entity.service.ts | Repopulate sensitiveAccess on read. | 1.8 |
DataEntityService.computeSensitiveMaskedFields | services/data-entity.service.ts | Per-request masked field-name lists (sensitiveMaskedFields + sensitiveMaskedFieldsWithUserAccess). | 1.8 |
DataEntityService.propagateMappedFieldSensitivity / propagateSensitivityToDependentMappedFields | services/data-entity.service.ts | Mapped-field sensitivity inheritance, both directions. | 1.8 |
DataEntryService.maskSensitiveFields / applyCallerSensitiveMask / maskEntryForResponse | services/data-entry.service.ts | Grant + session read-side masking. | 1.8 |
DataEntryService.preserveSensitiveFieldsOnWrite | services/data-entry.service.ts | Permission-enforced write preservation — defined but not currently called in production, see Write path. | 1.8 |
DataEntryWriterService.resolveSavedEntryUnmasked | services/data-entry-writer.service.ts | Unmasked after-save re-read. | 1.8 |
UnmaskSessionService.getActiveScopes | services/unmask-session.service.ts | Read a user’s active, session-scoped step-up scopes (fails closed). | 1.8 |
challengeUnmask / verifyUnmask / disableUnmask / getUnmaskStatus | users-service/src/services/step-up-unmask.service.ts | Step-up session lifecycle. | 1.8 |
stepUpUnmaskRedisKey(envPrefix, userId, sessionId) / StepUpUnmaskSession / STEP_UP_UNMASK_ALL_SCOPE / STEP_UP_UNMASK_DURATIONS_SECONDS | packages/osos-shared/src/step-up-unmask.ts | Cross-service session contract; session-scoped keying and the current duration set are both this release. | 1.8 |
PermissionTypeEnum.SensitiveField | packages/osos-shared/src/models/enums.ts | 'SENSITIVE_FIELD'. | 1.8 |
FieldService.validateAndNormalizeEncrypt | services/field.service.ts | Normalize the four excluded kinds, reject sensitive + encrypt, force searchable = false. | 1.10 |
options.encrypt / encryptTransitionVersion / pendingEncryptUpgrade | models/data-entity/field-options.model.ts | The Encrypt toggle and its two server-owned transition companions. | 1.10 |
aesGcmEncrypt / aesGcmDecrypt | libs/aes-gcm.ts | AES-256-GCM envelope (iv:tag:ciphertext), 16-byte tag pinned; shared with TOTP secrets. | 1.10 |
getFieldEncryptionMasterKey | libs/field-encryption-master-key.ts | Read and validate FIELD_ENCRYPTION_MASTER_KEY (32 bytes, hex or base64). | 1.10 |
writeEncryptedFieldValue / readEncryptedFieldValue / isFieldValueMigrated | libs/encrypted-field-value.ts | At-rest <keyId>:<iv>:<tag>:<ciphertext> composition and the version-compare migration test. | 1.10 |
DataEntriesController.decryptField | controllers/data-entries.controller.ts | POST …/fields/{field}/decrypt — grant and single-use step-up proof, one field, one entry. | 1.10 |
SensitiveDataDecryptedEvent | packages/osos-shared/src/messages/events/sensitive-data/ | The dedicated decrypt audit event; never carries the value. | 1.10 |
DataEntity.getFieldsExcludedFromBuilders | models/data-entity/data-entity.model.ts | encrypt || pendingEncryptUpgrade — the one definition nearly every refusal traces back to. | 1.10 |
SensitiveDataAccessPolicyEnum / resolveSensitiveDataAccessDecision | packages/osos-shared/src/sensitive-data-access-policy.ts | The four policies, the default Privileged, and the fail-closed resolver. | 1.10 |
SensitiveFieldsService.canQuerySensitiveField | services/sensitive-fields.service.ts | Query capability = admin area or grant; deliberately weaker than the read rule. | 1.10 |
StepUpPurpose (Unmask/Decrypt/WorkflowAction) | packages/osos-shared/src/step-up-proof.ts | Discriminates the three step-up purposes; fixed at challenge time, never interchangeable. | 1.10 |
mintDecryptProof / mintWorkflowActionProof(s) / auditDecryptStepUp / auditWorkflowActionStepUp | users-service/src/services/step-up-unmask.service.ts | Single-use proof minting + MFA-audit-trail recording per purpose. | 1.10 |
stepUpProofRedisKey / stepUpProofMatchesBinding / validateStepUpBatch / STEP_UP_PROOF_TTL_SECONDS / STEP_UP_PROOF_MAX_BATCH | packages/osos-shared/src/step-up-proof.ts | Cross-service single-use-proof contract; 120s TTL, 100-entry batch cap. | 1.10 |
StepUpProofService.consume / consumeDecrypt | data-service/src/services/step-up-proof.service.ts | Atomic GETDEL proof redemption + binding comparison. | 1.10 |
DecryptNotSupportedForPasswordFieldException | data-service/src/exceptions/ | Rejects Decrypt for a password-rendered field before the entry is fetched. | 1.10 |
VaultEncryptionProvider / AzureKeyVaultProvider | data-service/src/encryption-providers/ | HashiCorp Vault Transit / Azure Key Vault providers, wrap and direct modes. | 1.10 |
Known gaps
Section titled “Known gaps”SensitiveFieldsService.filterQueryableFieldsForUseris documented by its own JSDoc as feeding the query-builder field-list endpoint, but it is referenced only from withinsensitive-fields.service.tsand its unit tests. It is a verified, exported helper; it has no production caller.- The sensitive-field selector’s data endpoint is described in the fetcher’s JSDoc
as
POST /v2/entities/{entity}/fields/{field}/data. - No sort guard for Encrypted fields exists in data-service or in the web app, though every other builder surface is guarded and the mobile app excludes them from its sort-by picker. See the observed gap.
- A scope picker selection of a module or entity node authors the corresponding wildcard scope (see Sensitive field scopes).
Related pages
Section titled “Related pages”- Protect a field — the builder’s guide to marking fields Sensitive or Encrypted.
- Sensitive Permissions — the administrator-facing procedure for granting, editing, and revoking these grants.
- Permissions & Access Control — the object-level permission ladder this dimension sits beside.
- Entity model and API reference — entity and field definitions.
- Workflow model and API reference — the
WorkflowActionstep-up purpose, batching, and refusal shape. - Reference: Enums — the
StepUpPurposeenum definition. - Monitoring: Logs & Audit — what an administrator sees for a Decrypt reveal and its step-up identity check.
- Field encryption keys and providers and Configuration Reference — encryption keys and environment variables.
- Account Security & Sensitive Data Reveal — the end-user-facing description of the reveal wizard and the Decrypt prompt.
Platform 1.10.0 · Backend 1.11.0-alpha.11 · Frontend 1.11.0-alpha.6 · Mobile 1.10.2 · Chart 1.11.8 · Gateway 2.6.11 · MCP 0.2.0 · Grafana DS 1.2.0Docs build 2026-11-27