Repository navigation
Conversation
… owns the event An event's reminder entries record the email or messaging handle each verification reminder went to, and a proposal's delivery entries the address its review mail went to. logField's read lock admitted every manager, and atlas-manager reads events and proposals project-wide, so any of them read the contact details of managers in other regions. logField gains an opt-in `addresses` option naming the entry types and keys that hold an address. An entry whose address the reader may not see comes back without those keys; the rest of the entry stays. A reader sees it as an admin, as the recipient the entry names, or when isEventInScope holds (the event's region is in their owned subtree, or they manage the event) — the predicate atlas-manager's event writes already pass, now shared with them. A user-submission is placed by its target event, else the region intake routed it to. Paths that skip an afterRead projection are closed alongside it: - the lock answers a read with no row in hand (a where/sort path, through a join or a relationship hop, a distinct read) for admins only, so a filter cannot test a guessed address; - a write restores addresses a redacted read removed, so the admin form and applyReview do not erase them on save; - a duplicate starts with no log; - previewEvent's override read of the target event excludes activityLog. Closes #1047 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🚅 Deployed to the SahajCloud-pr-1054 environment in sahajcloud
1 service not affected by this PR
|
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The narrowing is right, and isEventInScope is the best thing in the diff: one predicate now answers "may write this event" and "may read its contacts", instead of a second rule nothing else uses, identical to the branch it replaced. Scope is option A plus the maintainer's widening, nothing more.
My one real doubt is the aggregate. logField grows five pieces — the addresses option, the afterRead, a doc-less read lock, a write-back restore, a duplicate hook — to protect a value the entry may not need to store at all. Each piece is forced by the approach; the approach is the question.
The user-submissions half contradicts the ticket's criterion "renders exactly as it does today" — correctly, since cells.sentTo really is an address, but the body should say it overrides that criterion.
Findings
- should-fix — the address need not be stored;
manager.id+channelalready identify it (src/fields/logField.ts:330). - should-fix — a subscribe delivery's
sentTois a list id, redacted against what the body claims (src/collections/UserSubmissions/fields.ts:606).
What was checked
- Ticket #1047 against the diff. No
payload-types.tsorresponseTypes.tschange, so no consumer repo is involved. buildReminderEntrywrites bothkindandtype: 'reminder'(lib/eventVerification/log.ts:148), so thetypesmatch hits.- The same log's other
sentTowriters (SendSessionReminders.ts:250,SendPostEventFollowUps.ts:137) record a registrant's email and stay out oftypes.senderEmailFieldcarries no lock, so that address is readable on the row regardless — a deliberate exclusion, not a gap. regionHintis in acollapsible(no data level), soroutingColumns' key check andselectname real keys.- Preview serves 200; not signed in — a fresh one has one admin, no events.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
|
Both adversarial-review threads answered. Nothing to commit, and the branch already sits on Rebutted — why the address is stored. A submissions delivery entry carries no Rebutted — a subscribe The body also records that this PR overrides #1047's criterion "renders exactly as it does today". 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
…r-field-locks Stacks #1045 on #1054, whose isEventInScope the region widening reuses. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Folded into #1045 by the maintainer's decision to ship the two contact-detail fixes as one PR. #1045's branch carries every commit from this one, merged in at 🤖 Generated with Claude Code |
…r-field-locks Stacks #1045 on #1054, whose isEventInScope the region widening reuses. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
Events.activityLogreminders (destination,cells.delivery) anduser-submissions.activityLogdeliveries (cells.sentTo).afterReadprojection are closed with it:where/sortfiltering, write-back of a redacted log,duplicate, andpreviewEvent's override read.The decision this implements, from the maintainer, Ardnived (2026-10-30), overriding the ticket's options A/B/C:
Change outline
Contract — what a manager reads off a log entry
GET /api/events/:id as an atlas-manager outside the event's region subtree activityLog[]: { kind: 'reminder', at, stage, level, role, region, channel, manager: { id, name }, cells: { activity, who } } - destination: '[email protected]' - cells.delivery: { label: 'email', text: '[email protected]' } activityLog[]: { kind: 'verification', …, cells: { delivery: 'Saved' } } # untouched — a method, not an address GET /api/user-submissions/:id as the same manager, a proposal from elsewhere activityLog[]: { type: 'delivery', at, ok, cells: { activity: 'Delivered' } } - cells.sentTo: '[email protected]'Deleted, not blanked, which is the projection a denied field lock makes.
LogTablerenders an empty cell, and the row's JSON drawer shows no address.Behaviour — who sees an address
Where each document is placed:
region/manager, loaded withselectwhen the read omitted them (eventAddressScope).submissionRoutingRegionId, the chaindeliverProposalmails up (UserSubmissions/logAddressScope.ts).Flow — the opt-in, per collection
logField({ …, addresses?: { types, keys, visibility } }) src/fields/logField.ts no `addresses` → exactly as before; every log keeps today's default + afterRead redact, unless overrideAccess === true # the read the field lock also exempts + read lock no row in hand (`doc` undefined) → admin only # a query, a distinct read, /api/access + beforeChange restore any entry that is exactly a stored one minus its addresses + beforeDuplicate → [] Events.activityLog types: ['reminder'], keys: ['destination', 'cells.delivery'] user-submissions.activityLog types: ['delivery'], keys: ['cells.sentTo']Joined — the copy an override read carried
loadTargetEvent(req, id) src/collections/UserSubmissions/hooks/computeReviewFields.ts findByID events, overrideAccess: true + select: { activityLog: false } → previewEvent # read by every manager, so the target event's whole log rode alongPreview
Railway builds this PR at a host keyed on its number. A fresh preview carries one admin and no events, so it shows the "admin sees everything" half only.
/admin/collections/events) is unchanged for an admin.Data: not seeded. The narrowing needs an event with reminder entries in two regions, plus an
atlas-managersession in each; a preview has no way to provision either. The integration specs cover that half instead.Test results
event-verification(48, 12 new)user-submissions-access(19, 11 new)managers-access(12)user-submissions-review-lifecycle(37)log-field(15, 6 new)src/reverted, 5 event cases and 4 submission cases fail: the outsider reads (full,select-narrowed, REST, depth-1 populated), the own-address-only case, thepreviewEventcopy, and the filter refusal. The visible-to cases cannot fail against old code, so each was mutation-checked against the fix instead:Manual verification
atlas-managerwho manages neither region of a reminded event.channeland nodestination./api/events?where[activityLog.destination][like]=a. It answers 400,The following path cannot be queried.Sent to.Notes for reviewer
Event's own manager → sees the escalated region managers' addresses. I went this way because the reminder escalates about their event to those region managers. "They need to be able to contact these users" reads in both directions on that chain, and region managers already receive the event manager's contact card in the escalation email. It also makes visibility exactly
isEventInScope, the predicate that already decides who may write the event. One test of "has business with this event" now serves both. The alternative (event manager sees only their own address) would need a second, narrower predicate that nothing else uses.This overrides #1047's criterion "
user-submissions.activityLogrenders exactly as it does today." The ticket read that log as carrying no contact detail, citing the review entries, which store amanagerIdonly.DeliverSubmissionsalso writescells.sentTo, and on a proposal that is the address the review mail went to — so that log narrows too, and an outsider'sSent tocell on a proposal is now empty.This closes the exposure only together with #1045. On
maintoday, every narrowed entry still carriesmanager.id, and an atlas-manager can readGET /api/managers/<id>for that row's email andcontactDetails(#908). #1045 closes that. The two branches merge cleanly (git merge-treeagainstclaude/fix-908-manager-field-locks): this PR adds no code tostripLockedFieldsOnSelfReadoradminOnly.ts, and its docs edits sit outside #1045's hunks. Once both land, a region manager reads a sub-region manager's address in the log but not off theirmanagersrow. That is the maintainer's rule applied to the log only. Wideningmanagersto match is a separate decision.whereon the JSON column: a manager could filter by its contents. Before this, as an outsider,where[activityLog.destination][equals]and[like]both matched.likeis a substring match, so an address could be read out a prefix at a time. The whole-column[activityLog][like]hit a raw SQL error instead.The fix lives in the lock, not in a hook. Payload builds the field policies for query validation with no document (
getEntityPermissions,fetchData: false), so a narrowed log answers that question for admins only. Payload's own validator then refuses every path shape, including the three the adversarial review found my firstbeforeOperationguard missed:OR/AND;regions.events,managers.managedEvents,users.submissions);user-submissions?where[event.activityLog…]).sortandfindDistinctare refused the same way. Every read of a row passesdoc; the admin edit view'sdocAccessOperationpasses the fetched row. A case pins that the Verification tab still renders for a non-admin.The write-back was a real data-loss bug, not a hypothetical. An outsider can update proposals (
managerSubmissionScopecovers every proposal). The admin form posts back the redacted log it rendered, andapplyReviewappends to the redacteddocits own update's afterRead left. Either path erasedsentTofrom storage.restoreLogAddressesputs back only an entry that is exactly a stored entry minus its addresses, so a writer gets nothing that was not already stored. Events have no equivalent exposure: their updaters are exactly the readersisEventInScopeadmits. The hook covers them anyway.Adversarial review (fresh subagent, handed the diff only). Its findings, and how each was handled:
OR/AND, joins, relationship hops). Replaced the guard with the doc-less lock above.duplicatecopying the source's whole log into a draft the caller re-homes to their own region. AddedbeforeDuplicate: [() => []]. The case uses an unmanaged event, whichsyncVerificationOnSaveleaves alone, so only the hook empties it.cells.delivery('Saved','Email link') were being stripped. Addedtypes, so only reminder and delivery entries narrow.contactDetailsand confirm whose it was. "Own" now uses the entry'smanager.id, and email only where an entry names nobody.trash: trueon the routing load.data.parentversions branch: Payload hands the hook the version snapshot itself. Removed.resolveOwnedRegionIds(req)joining a write's transaction inside afterRead. The same memoized call already runs inside every atlas-manager write's access check, and it only reads. The two gate loads that are new here take noreq.readVersionsis already update-scoped, so this cannot leak. Aselect-narrowed version read falls back to own-only.sentTois'<provider> list <id>'— a mailing list, not a person — andtypesdoes not reach it, sinceDeliverSubmissionslogs every intake's outcome as the onedeliverytype. No carve-out, becausemanagerSubmissionScopegives no non-admin a subscribe or registration row at all (accessConfigs.ts:92, pinned atuser-submissions-access.int.spec.ts:211), and an admin sees every address. Widening that scope would need one here.cells.activityof a failed delivery.required, andExpireEventsno longer falls back to the address.Detail
Every read path checked:
find/findByID, as each readerselect[activityLog]=true: noregion/manageron the row, so the decision loads them with a two-columnselectgetDocumentDatawithoverrideAccess: false, and its field permissionsLogTableandVerificationStageField, which read form state onlypreviewEvent/proposedChanges, now selecting the log outwhere/sort/joins/relationship hops/findDistinct, all refusedwhere, refusedduplicate, emptiedImportResultsField, SEO/sitemap and geojson: allselectwithoutactivityLog, or are client-only/distinctis not routed in Payload 3.90.2Jobs keep the address.
ExpireEvents,DeliverSubmissions,ScreenSubmissionsandSendSessionRemindersread at the local API's defaultoverrideAccess: true, where the hook stands down. The update operation readsoriginalDocthe same way, which is what the restore compares against.No migration, no type change.
custom,hooksandaccesschange no column;payload-types.tsis unchanged.Review passes run: the adversarial subagent above, over the whole diff.
/simplify,/code-reviewand/security-reviewwere not run separately.Closes #1047
🤖 Generated with Claude Code