feat(recovery): execute time-bounded physical basebackup tar - #235
Draft
seonghobae wants to merge 56 commits into
Draft
feat(recovery): execute time-bounded physical basebackup tar#235seonghobae wants to merge 56 commits into
seonghobae wants to merge 56 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Aug 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ACTIVE Draft — bounded physical basebackup execution
Protected
main@b84f0c94154043a3473939c01bb6471de5a129aeremains unchanged. This branch is an explicit child offix/recovery-evidence-weakref-coverage-b84f0c9@5951b7a4d779903b8924abaef2a387cae50b7f54(#233). Current exact head isd85107f4b74ffedd0ce3003ddb8b81f51e09bbf0; GitHub reports this Draft mechanically mergeable against that unchanged predecessor. Fresh targeted branch inventory finds onlyfeat/postgres-physical-basebackup-b84f0c9on this named source lane. Protected main was not mutated.Branch-only capability boundary
This Draft executes one time- and byte-bounded
pg_basebackup --pgdata=- --format=tar --wal-method=fetchthrough retained package authority. It requires a private empty writable regular output file, rejects caller read-only capability widening, retains/revalidates the selected output inode, reopens it through/proc/self/fdfor an independent package output offset, retains a root-owned non-set-idpg_basebackupexecutable inode, restricts inherited libpq environment, copies provider stdout through a finite pipe/byte budget, durably invalidates partial output on ordinary failures, and revalidates final file identity/mode/link/size.Success remains narrow. It does not prove continuous WAL archive integrity, timeline ancestry, WAL replay/PITR, restore/catalog/RLS/application usability, external key/TLS/provider/host recovery, target lifecycle, or deployment RPO/RTO/HA/DR.
Latest RED → GREEN: blocking executable token before the timeout boundary
After the final-symlink repair, fresh source review found that retained executable authority was still opened with blocking
O_RDONLYbefore regular-file validation and before the subprocess timeout began. A caller-selected absolute path namedpg_basebackupcan be a FIFO or another blocking special-file token; a FIFO with no writer could therefore stall the package before it reached the existingfstat()rejection.75f455fec095094735f275ccc2bf94c1582a3e09addstest_pg_basebackup_fifo_open_is_nonblocking_and_rejected. The deterministic guard models the POSIX FIFO-open boundary without timing dependence: the exact preceding source attempts the selected token withoutO_NONBLOCK, reaching the RED assertion before any child process can run.d85107f4b74ffedd0ce3003ddb8b81f51e09bbf0addsos.O_NONBLOCKto the retained executable open and updates the public authority contract. The existingfstat()regular-file check still rejects the FIFO, so the change removes the pre-validation availability hazard without broadening accepted executable types.O_NOFOLLOWandO_NONBLOCKand then rejected through the fixed content-freePostgreSQL physical base-backup executable is unsafeboundary.+11/-7); no adjacent recovery source changed. Issue fix(recovery): harden pg_basebackup executable authority #283 tracks this executable-authority hardening until protected-main integration.Earlier executable hardening: final-symlink substitution
Fresh review of the earlier branch had found that the caller path basename was validated as
pg_basebackupwhile the retained open followed its final symlink. That separated pathname identity from executable identity: a caller-controlledpg_basebackupsymlink could resolve to a different root-owned executable and still satisfy the owner/mode/inode checks.a4e019cfeb04793fb72f56c4c32fdc282236f347addstest_symlink_pg_basebackup_is_rejected_before_execution; focused reconstruction retained the substitute symlink target.32349566801and Release Acceptance32349566824were cancelled after the branch advanced; cancelled evidence is non-passing and does not transfer.2795f8642770ef2000658edefcdba297c30d75b6addedos.O_NOFOLLOWwhile preserving descriptor-pinned execution, root ownership, regular-file/execute-bit checks, group/other-write rejection, set-id rejection, fixed diagnostics, and pathname-replacement resistance. That repair is retained by the current head.Other hardened boundaries retained
The branch retains prior reviewed repairs for caller numeric-FD substitution; independent output open-file-description authority; effective-user ownership/private-mode/single-link checks; rejection of read-only capability widening; executable pathname replacement after retention; finite provider-output byte authority; pipe/thread construction and short-write failure; durable partial-output invalidation; and process-control/read-descriptor ownership races.
The earlier hosted deterministic pump-descriptor RED remains
133f04a9dcd23ecad03d4d6574fda6f49843a922, where CI32318905830/ Python 3.10 job96276917723checked out that exact head and reported1 failed, 1400 passed. Its refined fix is retained by current ancestry; that predecessor evidence does not substitute for current-head gates.Exact current-head validation
Fresh commit-scoped evidence for unchanged exact
d85107f4b74ffedd0ce3003ddb8b81f51e09bbf0is currently non-passing as a set:32350477525: completed / success;32350477497: completed / success;The exact-head CI/Release successes prove their own current checkout only. Absent Security/SAST and absent formal review remain non-passing evidence; no predecessor, cancelled, stale, status-only, author-only, or other-head evidence transfers.
Integration boundary
#233 is the exact predecessor and must integrate first. Its repository-local exact-head checks are green, but its current same-head independent-review state remains non-passing through the read-only central coverage/review control plane tracked in #244. This pg writer does not mutate
ContextualWisdomLab/.github, copy a central workaround, churn #233 to manufacture an event, self-approve, or weaken gates.Keep this PR Draft until the current GREEN head proves every then-required exact-head/current-base quality/security/coverage/package/provenance/release gate, #233 integrates through live governance, this branch is reconciled to resulting protected main, zero valid findings/threads remain, and any qualifying non-author current-last-push approval required by then-live policy exists.
Refs #204, #233, #244, #257, #283.