Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .changeset/activity-reference-title-reader-scope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
'@objectstack/plugin-audit': patch
---

fix(plugin-audit): an activity text that names a referenced record by its title is served only to a reader served that title field and admitted to its object

Clause-②: no
Metadata-protocol: none

**The rule.** An activity row names a referenced record by its title in three places: the record label of an object whose `nameField` is a lookup or `user` field, a tracked reference field's change, and a fired milestone's reference token. Each such text is served to a reader only when both of these hold for the object every such reference points at, the two answers `$expand` judges a target's title by at that level:

- the reader is served the target object's title field (its ADR-0079 `nameField`) unmasked, by the security service's field answer, which also withholds a formula title computed from a field the reader may not read; and
- the security service admits the reader to the target object. A reference field that declares `referenceNameVisible` lifts this object-level admission and never the field-level rule, as it does on `$expand`.

Otherwise the text is served the way any activity text composed from a field the reader is not served already is: the row keeps its `record_id`, and the label or summary is left out of the row. A reader served each referenced title field and admitted to each referenced object, and every system read, are served the row as before.

A target's declared API exposure (ADR-0049) is decided where its title is read: the mirror titles a reference only when the target's exposure serves `get`, and names every other referenced record by its stored id, so one sentence can title one reference and name another by its id. Such a sentence is judged by the two answers above for every reference it names, whatever the target's exposure.

The judgement is made at read time from the security service's answers, once per referenced object per read; no row is read for it, and rows already written are judged the same way.
12 changes: 12 additions & 0 deletions packages/core/src/security/second-object-read-exposure.pin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,18 @@ const CALLERS: Record<string, Classification> = {
wiring: { file: 'packages/plugins/plugin-audit/src/audit-writers.ts', call: 'servesSummaryTitleTarget(objectName' },
pin: 'packages/plugins/plugin-audit/src/audit-lookup-summary.test.ts',
},
'packages/plugins/plugin-audit/src/activity-field-redaction.ts': {
kind: 'executes',
read:
"the activity timeline's read redaction, serving per reader the referenced records' titles the mirror's " +
'`resolveLookupTitles` wrote (`referenceTitlesPerRead` judges each reader against the title field and the object ' +
'of every reference a text names)',
decidedIn: 'packages/plugins/plugin-audit/src/audit-writers.ts',
also:
'reads no record of the target and no title: `referenceTargetOf` names the object whose title field and read ' +
'admission a reader is judged against; the title was read at write time, only from a target whose exposure ' +
'serves `get` (`servesSummaryTitleTarget`). Pinned in `activity-field-redaction.test.ts`',
},
// The engine's relation group join: an analytics cross-object dimension as one `LEFT JOIN … GROUP BY`.
'packages/objectql/src/relation-group-join.ts': {
kind: 'decided',
Expand Down
Loading
Loading