model-writtenrun 4301 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
Mar - Jun 2023 ยท 21 entries
- Robert Haas proposed executing replicated table operations as the table owner to prevent subscriber-side code from stealing subscription-owner privileges, requiring SET ROLE permission and applying security restrictions except where reciprocal role access already existed #1.
- Jelte Fennema-Nio explained that Citus needed this protection to replace its awkward subscription-per-owner arrangement, which required temporary privileged accounts and multiple replication slots #2.
- Discussion resumed with Jeff Davis questioning mandatory SET ROLE privileges, Jelte requesting tests of security restrictions, and Mark Dilger warning that the proposal weakened protection against malicious publishers by replacing per-table permission boundaries with owner-based boundaries #5 #7 #9 #13.
- Noah Misch explained that SECURITY_RESTRICTED_OPERATION could break deferred triggers and temporary-table creation, while Robert argued that separate subscriptions also cost repeated WAL decoding and lose transactional consistency across owners #17 #18.
- Jelte supplied a variant that switched to the table owner when permitted but otherwise retained subscription-owner execution, preserving the existing low-privilege permission tests #24.
- Robert preferred an explicit configuration option because silent fallback would be difficult to understand and troubleshoot, and Jelte accepted that alternative #28 #30.
- Jeff demonstrated that replication already used an empty search_path, narrowing one proposed attack scenario; Robert nevertheless retained SET ROLE as the conservative permission boundary and deferred finer-grained replication privileges to future work #25 #29 #31.
- Robert returned to his original table-owner implementation and added a separate run_as_owner option that restored legacy execution, replacing Jelte's automatic fallback design #32.
- Jeff questioned both the option name and the exception to security restrictions, while Robert defended the exception as allowing trusted owners to operate without exposing the subscription to other owners; Jelte approved the code and requested tests and documentation #33 #34 #35 #38.
- Robert completed documentation and placed the option's tests in a separate file, choosing that organization instead of incorporating Jelte's expanded combined test directly #36.
- Noah supported SET ROLE as protection against impersonation through audit triggers and reported wording errors, Amit endorsed the run_as_owner name, and Jeff ultimately agreed that the patches should proceed #42 #43 #47.
- Robert committed both components of #36: table-owner execution as 1e10d49b65 and the opt-out option as 482675987b, with only rebasing, wording corrections, and the required catalog-version bump before announcing completion #49.
- Noriyoshi Shinoda found that the pg_subscription documentation omitted subrunasowner and subpasswordrequired, supplied their descriptions, and Robert committed the patch unchanged as bc25d6c54a #50 #51.
- Amit later noticed that initial synchronization did not appear to honor run_as_owner, Robert confirmed that this would be a bug, and Masahiko Sawada isolated the failure to COPY rather than subsequent catch-up #52 #53 #54.
- Ajin Cherian reproduced unauthorized trigger access during initial COPY and supplied a patch that switched identities around the copy operation #56 #57.
- Masahiko and Jelte requested regression coverage, Ajin added a trigger-based test, and Robert considered a separate documentation clarification unnecessary because initial synchronization already amounted to inserts #58 #59 #64 #63.
- Masahiko revised the fix to switch before ACL checks and replaced the trigger test with a simpler privilege-based test, which Ajin endorsed #65 #67.
- Amit questioned doing replication-origin catalog work as the table owner and identified unnecessary test grants, prompting Masahiko to pass an explicit owner to ACL and RLS checks while postponing the actual identity switch until COPY #66 #68 #69 #70.
- Amit then noted that those checks preceded verification that the subscription owner could assume the table owner's identity, so Masahiko moved the checks after the identity switch immediately before COPY; Amit approved that final arrangement #71 #72 #73.
- Masahiko committed the final table-sync patch from #72 as a83edeaf68 with only whitespace changes and announced the push in the last message, completing all submitted series #74.
- The thread ended without a pending attached patch, although Jelte's renewed request for explicit tests of SECURITY_RESTRICTED_OPERATION behavior was not visibly addressed by the final privilege-based COPY test #60 #72.