Skip to content

Commit fa1d391

Browse files
committed
fix(plugin-audit): cite the summary-code read site on the system-context page; type the new tests' engine options
Claude-Session: https://claude.ai/code/session_01UBPXQdapfjkjYdQck9dtTa Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0a6e0b2 commit fa1d391

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎content/docs/permissions/system-context.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ One of the largest consumers of the flag;
171171
| 42 | Delegation write guard bypassed | plugin-approvals | Get: service / seed / import may write delegation rows naming another delegator | `packages/plugins/plugin-approvals/src/lifecycle-hooks.ts#bindDelegationWriteGuard` |
172172
| 43 | Approval actor / submitter / pending-approver checks bypassed (8 sites) | plugin-approvals | Get: approve, reject, recall, reassign without being a pending approver or the submitter | `packages/plugins/plugin-approvals/src/approval-service.ts#isOverrideActor`, `#resolveActor`, `#sendBack`, `#resubmit`, `#reassign`, `#remind`, `#requestInfo`, `#comment` |
173173
| 44 | Attachment access hooks return early (insert + update + delete, and the read AST) | service-storage | Lose: attachment visibility scoping | `packages/services/service-storage/src/attachment-access-hooks.ts#installAttachmentAccessHooks`, `#installAttachmentReadVisibility` |
174-
| 45 | Comment access hooks return early (insert + update + delete, and the read AST), and so do the activity and audit-log read gates (their read AST), the activity field redaction and the audit-log field redaction (the rows a read serves), and the query guard over both objects' value-bearing columns (the read AST) | plugin-audit | Get: the whole activity row and the whole `sys_audit_log` row, its before/after snapshots included, on `find` / `findOne` — the audit writer, each read gate's bounded probe and the activity backfill — and a filter, sort or grouping by those columns. Lose: comment visibility scoping, the narrowing of `sys_activity` and of `sys_audit_log` to rows whose parent record the caller can read, the redaction of a parent field's value from an activity row's text and recorded change and from a ledger row's before/after snapshots, the withholding of an activity row recording an update whose every changed field the reader is withheld, of a fired milestone row whose watched fields it is not all served, and of an unstamped row (on `count` and `aggregate` too, so a total agrees with the rows), and the refusal of a query over those columns for a reader withheld a field of the objects it can reach | `packages/plugins/plugin-audit/src/comment-access-hooks.ts#installCommentAccessHooks`, `#installCommentReadVisibility`, `packages/plugins/plugin-audit/src/activity-read-visibility.ts#installActivityReadVisibility`, `packages/plugins/plugin-audit/src/audit-log-read-visibility.ts#installAuditLogReadVisibility`, `packages/plugins/plugin-audit/src/activity-field-redaction.ts#installActivityFieldRedaction`, `packages/plugins/plugin-audit/src/audit-log-field-redaction.ts#installAuditLogFieldRedaction`, `packages/plugins/plugin-audit/src/parent-field-query-guard.ts#installParentFieldQueryGuard` |
174+
| 45 | Comment access hooks return early (insert + update + delete, and the read AST), and so do the activity and audit-log read gates (their read AST), the activity field redaction and the audit-log field redaction (the rows a read serves), the activity summary's message code (the rows a read serves), and the query guard over both objects' value-bearing columns (the read AST) | plugin-audit | Get: the whole activity row and the whole `sys_audit_log` row, its before/after snapshots included, and the activity row's stored summary code (`metadata.summary_message`), on `find` / `findOne` — the audit writer, each read gate's bounded probe and the activity backfill — and a filter, sort or grouping by those columns. Lose: comment visibility scoping, the narrowing of `sys_activity` and of `sys_audit_log` to rows whose parent record the caller can read, the redaction of a parent field's value from an activity row's text and recorded change and from a ledger row's before/after snapshots, the withholding of an activity row recording an update whose every changed field the reader is withheld, of a fired milestone row whose watched fields it is not all served, and of an unstamped row (on `count` and `aggregate` too, so a total agrees with the rows), the removal of that summary code from the activity row's `metadata` (its params are field values), and the refusal of a query over those columns for a reader withheld a field of the objects it can reach | `packages/plugins/plugin-audit/src/comment-access-hooks.ts#installCommentAccessHooks`, `#installCommentReadVisibility`, `packages/plugins/plugin-audit/src/activity-read-visibility.ts#installActivityReadVisibility`, `packages/plugins/plugin-audit/src/audit-log-read-visibility.ts#installAuditLogReadVisibility`, `packages/plugins/plugin-audit/src/activity-field-redaction.ts#installActivityFieldRedaction`, `packages/plugins/plugin-audit/src/audit-log-field-redaction.ts#installAuditLogFieldRedaction`, `packages/plugins/plugin-audit/src/activity-summary-message.ts#installActivitySummaryLocale`, `packages/plugins/plugin-audit/src/parent-field-query-guard.ts#installParentFieldQueryGuard` |
175175
| 46 | Knowledge search returns hits unfiltered | service-knowledge | Lose: the permission filter over search results | `packages/services/service-knowledge/src/knowledge-service.ts#applyPermissionFilter` |
176176
| 47 | The inbound-mail read gates return early (the read AST) | service-mailbox | Get: every `sys_mail_message` and `sys_mail_association` row on `find` / `findOne` — the ingest writer and each gate's own pre-scan, which read the association and mailbox rows a decision needs. Lose: the narrowing of a message to callers who can read a record it is associated with or who own its mailbox (so the unassociated pool is restricted), and of an association to callers who can read the record it names (on `count` and `aggregate` too, so a total agrees with the rows) | `packages/services/service-mailbox/src/mail-read-visibility.ts#gateMiddleware` |
177177
| 47b | The inbound-mail ingest seam: `ingest` admits the system context ALONE, and `rematch` admits it without the organization, owner or `manage_mailboxes` check | service-mailbox | Get: a mail source hands a mailbox its messages, and server code re-matches any mailbox. Lose: nothing a user held — every other caller of `ingest` is refused (`PERMISSION_DENIED`), because an ingested message is shown on every record its correspondents' addresses match and a user who could hand the seam a message could write one in a correspondent's name; every other caller of `rematch` must be in the mailbox's organization and own the mailbox or hold `manage_mailboxes` | `packages/services/service-mailbox/src/ingest/mail-ingest-service.ts#ingest`, `#authorizeRematch` |

‎packages/plugins/plugin-audit/src/activity-summary-reader-locale.integration.test.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ describe('sys_activity summary — rendered in the reader\'s language (#26167)',
6666
where: { object_name: CONTRACT, record_id: recordId },
6767
...extra,
6868
...opts,
69-
} as any)) as Row[];
69+
})) as Row[];
7070
}
7171
/** The three mirror rows' summaries — created, the tracked change, the named-field update — as `opts` reads them. */
7272
async function summaries(opts: Record<string, unknown>): Promise<Array<string | undefined>> {
@@ -122,10 +122,10 @@ describe('sys_activity summary — rendered in the reader\'s language (#26167)',
122122
});
123123

124124
// Written as the system: the workspace locale is the default, `en`.
125-
const created = (await engine.insert(CONTRACT, { name: 'NDA', stage: 'draft' }, SYS as any)) as Row;
125+
const created = (await engine.insert(CONTRACT, { name: 'NDA', stage: 'draft' }, SYS)) as Row;
126126
recordId = String(created.id);
127-
await engine.update(CONTRACT, { stage: 'signed' }, { where: { id: recordId }, ...SYS } as any);
128-
await engine.update(CONTRACT, { note: 'countersigned' }, { where: { id: recordId }, ...SYS } as any);
127+
await engine.update(CONTRACT, { stage: 'signed' }, { where: { id: recordId }, ...SYS });
128+
await engine.update(CONTRACT, { note: 'countersigned' }, { where: { id: recordId }, ...SYS });
129129
const atRest = await read(SYS);
130130
expect(atRest).toHaveLength(3);
131131
for (const row of atRest) {
@@ -200,7 +200,7 @@ describe('sys_activity summary — rendered in the reader\'s language (#26167)',
200200
record_label: 'NDA',
201201
metadata: JSON.stringify({ old: null, new: { name: 'NDA' } }),
202202
},
203-
SYS as any,
203+
SYS,
204204
);
205205
const legacy = (await read(reader('zh-CN'))).filter((r) => r.timestamp === '2020-01-01T00:00:00.000Z');
206206
expect(legacy.map((r) => r.summary)).toEqual(['Created Contract "NDA"']);

‎packages/plugins/plugin-audit/src/audit-write-locale-settings-seam.integration.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ describe('audit writers — a localization change reaches the very next @mention
9898
let comments = 0;
9999
/** Mention one user in a comment on the task, as the admin; answer the title the mention was given. */
100100
async function mentionTitle(): Promise<string> {
101-
if (!taskId) taskId = String(((await engine.insert('biz_task', { name: 'thread' }, asAdmin as any)) as any).id);
101+
if (!taskId) taskId = String(((await engine.insert('biz_task', { name: 'thread' }, asAdmin)) as any).id);
102102
comments += 1;
103103
const before = mentionTitles.length;
104104
await engine.insert(
@@ -110,7 +110,7 @@ describe('audit writers — a localization change reaches the very next @mention
110110
body: `note ${comments}`,
111111
mentions: '["u_bob"]',
112112
},
113-
asAdmin as any,
113+
asAdmin,
114114
);
115115
expect(mentionTitles.length - before).toBe(1);
116116
return mentionTitles[mentionTitles.length - 1];

0 commit comments

Comments
 (0)