Skip to content

R06: bind update-health reads and artifact hashing to opened descriptors - #257

Open
Oleksii-debug wants to merge 5 commits into
r06-updater-self-identity-0929-solfrom
r06-health-receipt-readback-hardening-0929-sol
Open

Oleksii-debug wants to merge 5 commits into
r06-updater-self-identity-0929-solfrom
r06-health-receipt-readback-hardening-0929-sol

Conversation

@Oleksii-debug

@Oleksii-debug Oleksii-debug commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Scope

Security/reliability successor to #252. Closes fixed-path TOCTOU/read-amplification seams in post-update health authority without changing update authority, cleanup ordering, browser transport, content, grading, source provenance or package identity.

Exact lineage — 2026-09-29

  • parent: r06-updater-self-identity-0929-sol@89bab26df4e5c9644178505649bcb2b32b434a03 (R06: bind updater direct invocation to its signed app sibling #252);
  • candidate: r06-health-receipt-readback-hardening-0929-sol@3b250b75b2f32cea5fda9f9694102f8b807256ad;
  • direct parent → candidate: AHEAD 4 / BEHIND 0; exact parent is merge-base;
  • lasting diff: exactly 2 paths:
    • runtime_engine/scripture_archive_runtime/application_update_health.py
    • runtime_engine/tests/test_application_update_health.py.

Root causes closed

  1. The fixed update-health.json path was checked with lstat() and then read later with a separate path-based read. A same-user/local pathname replacement between those operations could make validation parse another inode. The 4096-byte bound was also enforced only after full-file read.
  2. Installed-application and rollback files were checked as regular non-symlink paths and then hashed through a later path open. A pathname replacement between the type check / pre-hash metadata and open could detach the health proof from the inode that was inspected, even if replacement bytes were identical.

Repair

Receipt readback now:

  • rejects oversized receipts from pre-open metadata;
  • binds pre-open lstat identity to opened-handle fstat;
  • requires a regular opened file;
  • performs bounded read at MAX + 1;
  • re-checks descriptor identity after read and pathname identity after close;
  • requires byte count to match the exact pre-open size before strict JSON parsing.

Health artifact hashing now:

  • revalidates regular/non-symlink metadata immediately before hashing;
  • binds pre-open (device,inode,size,mtime_ns) to the opened descriptor;
  • rechecks descriptor identity after the complete hash read;
  • rechecks pathname identity after close;
  • fails closed on before-open or during-read replacement instead of accepting hash-equivalent replacement inodes.

Regression coverage

  • receipt pathname swap immediately before open fails with changed before readback, even for semantically identical replacement bytes;
  • 4097-byte receipt is rejected before Path.open;
  • installed-target pathname swap immediately before hash-open fails closed even when replacement bytes are byte-identical;
  • rollback pathname swap immediately before hash-open fails closed even when replacement bytes are byte-identical;
  • inherited publish/inspect/tamper/commit/disarm behavior remains covered.

Hosted qualification state

DEV05 run 36619001147 is terminal SUCCESS and executed 590 runtime tests, including both new descriptor-identity regressions; DEV06 36619001187 is also terminal SUCCESS. However log readback proves the then-current DEV05/DEV06 pull_request workflows checked GitHub's synthetic PR merge ref rather than literal candidate head 3b250b75.... These results are therefore PR-merge regression PASS, not exact-head qualification.

PR #260 repairs the active DEV03/DEV05/DEV06/DEV10 gates so pull requests explicitly check out ${{ github.event.pull_request.head.sha || github.sha }} and assert the resulting HEAD before tests. Literal-head hosted qualification must be rerun under that repaired authority before #257 can be called exact-head qualified.

RUNTIME_PR_MERGE_REGRESSION=PASS
EXACT_HEAD_RUNTIME_QUALIFICATION=NOT_PROVEN
READY_FOR_INTEGRATION=NO pending repaired literal-head hosted qualification and independent changed-head review.

Non-claims: no production signing, physical Windows 11/WebView2 E2E, HUMAN_NVDA, source/theological final acceptance, or final release acceptance.

@Oleksii-debug Oleksii-debug changed the title R06: bind update-health receipt reads to opened descriptor R06: bind update-health reads and artifact hashing to opened descriptors Sep 29, 2026

Oleksii-debug commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner Author

HOSTED PR-MERGE REGRESSION CHECKPOINT / CORRECTION — candidate 3b250b75b2f32cea5fda9f9694102f8b807256ad

DEV05 runtime grading run 36619001147 is terminal SUCCESS and its runtime job executed the full python -m unittest discover -s tests -v: 590 tests, OK. The log explicitly includes PASS for both new descriptor-identity regressions (test_installed_path_swap_before_hash_fails_closed_even_for_identical_bytes, test_rollback_path_swap_before_hash_fails_closed_even_for_identical_bytes) plus receipt path-swap/oversize and inherited health/update regressions. DEV06 run 36619001187 is also terminal SUCCESS.

Correction to the earlier wording: the DEV05 checkout log proves GitHub fetched refs/remotes/pull/257/merge and checked synthetic PR merge commit 430df907451ec9afc2171817f8d24ec6eed2ea4b, whose candidate parent is 3b250b75.... Therefore this is valid PR-merge regression evidence, not literal exact-head evidence for 3b250b75.... DEV05/DEV06 currently use bare pull-request checkout semantics. PR #260 repairs those canonical gates by explicitly checking out ${{ github.event.pull_request.head.sha || github.sha }} and asserting git rev-parse HEAD == EXPECTED_HEAD before tests.

DEV1 36619001015 and DEV10 36619001262 remained queued at the last readback.

RUNTIME_PR_MERGE_REGRESSION=PASS
EXACT_HEAD_RUNTIME_QUALIFICATION=NOT_PROVEN
READY_FOR_INTEGRATION=NO — literal exact-head hosted qualification plus independent changed-head review remain required.

Adopt the already integrated #260 DEV05/DEV06/DEV10 checkout authority so hosted updater-health evidence is bound to this exact candidate SHA. Product/runtime bytes are unchanged.

Copy link
Copy Markdown
Owner Author

HEAD_CHANGED / EXACT-HEAD QUALIFICATION AUTHORITY REPAIRED — 8605b8b7c4b81e7dc663474e4ad1f8677b2da959

The #257 product delta is unchanged. This fast-forward adds only the already integrated #260 literal-head qualification authority to the three workflows that qualify this runtime surface:

  • DEV05 workflow blob f862fc743e2561c22b75a8d04234938c9ab2a546;
  • DEV06 workflow blob e0f521f040102a7edcc9ee914be97982764a5a1f;
  • DEV10 workflow blob 81748b357f1eba0461c322835edeca051876ff68.

Each now checks out the pull-request head SHA (falling back to the workflow SHA outside PR context) and asserts the resulting HEAD before tests. These bytes are copied from current packaged qualification authority; no criterion is weakened.

Product byte readback is exact versus prior #257 head 3b250b75...:

  • application_update_health.py = 7f0f22b8b1e6e361671a0a7431ba70d25ee5550a;
  • test_application_update_health.py = 3f656b8f7acd1c57fb46f276ef419c4174c8df3b.

Direct compare to stacked parent #252 remains BEHIND 0 with exact parent merge-base. Fresh exact-head hosted runs are required; previous green runs are provenance only.

PRODUCT_BYTES_UNCHANGED=PASS
LITERAL_HEAD_QUALIFICATION_AUTHORITY=INSTALLED
READY_FOR_INTEGRATION=NO pending terminal exact-head hosted qualification and independent changed-head review.

@Oleksii-debug Oleksii-debug left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FRESH EXACT-HEAD SECURITY/TOCTOU REVIEW — 8605b8b7c4b81e7dc663474e4ad1f8677b2da959

Reviewed the #257 two-file product delta plus the three qualification-only workflow bytes added to bind hosted evidence to the literal PR head.

Product findings:

  • receipt parsing now binds the pre-read path identity to the opened descriptor using fstat, reads from that held descriptor with an explicit size bound, re-checks the descriptor after read, and finally revalidates the pathname identity;
  • application and rollback hashing similarly bind pre-open identity to the held descriptor, hash from the descriptor, re-check descriptor identity after streaming, then revalidate the pathname;
  • symlink/non-regular inputs fail closed before acceptance;
  • same-byte pathname replacement is not accepted merely because content hashes match; dedicated regressions replace installed, rollback, and receipt pathnames between metadata lookup and open and require rejection;
  • receipt shape/schema/version/executable-name/SHA identities remain fail-closed;
  • failed health proof still preserves pending authority, receipt, and rollback evidence; successful commit ordering remains pending journal → receipt → rollback, so a cleanup crash cannot leave a live health receipt after rollback evidence is gone.

Qualification findings:

  • DEV05/DEV06/DEV10 workflows now use the already integrated #260 literal-head checkout/assertion bytes;
  • updater-health product/test blobs are byte-identical to the pre-workflow-repair #257 head; no runtime behavior changed in the qualification repair.

No blocking defect found in the changed surface. This does not claim a post-health watchdog, production signing, physical Windows updater E2E, or HUMAN_NVDA evidence.

EXACT_HEAD_SECURITY_REVIEW=PASS
PRODUCT_BYTES_UNCHANGED_BY_CI_REPAIR=PASS
READY_FOR_INTEGRATION=NO pending terminal fresh exact-head hosted qualification.

Copy link
Copy Markdown
Owner Author

CI_TERMINAL / CANDIDATE_QUALIFIED — exact head 8605b8b7c4b81e7dc663474e4ad1f8677b2da959

Fresh literal-head hosted qualification is terminal SUCCESS:

  • DEV05 runtime grading 36631857767;
  • DEV06 memory persistence 36631857303;
  • DEV10 Integration CI 36631857316;
  • DEV1 Platform CI 36631857298 (Linux + Windows).

Fresh exact-head security/TOCTOU review 5358568294 is PASS. Product/test blobs are unchanged from the pre-CI-repair #257 head.

The candidate itself is therefore exactly qualified. Integration ordering remains fail-closed: #257 is stacked on #252, whose current head still requires its own fresh literal-head qualification before parent-first intake or an explicit governed reconvergence.

CANDIDATE_QUALIFIED=YES
READY_FOR_INTEGRATION=NO pending canonical parent #252 readiness/integration order.
MAIN_MERGE_AUTHORIZATION=NO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant