Skip to content

train 1124m: #5388 + #5391 + #5366 (overnight S77, stacked on #5398) - #5402

Closed
Daniel Meppiel (danielmeppiel) wants to merge 70 commits into
mainfrom
cimq/train-1124m
Closed

Daniel Meppiel (danielmeppiel) wants to merge 70 commits into
mainfrom
cimq/train-1124m

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

Overnight train 1124m (S77 layered by overlap; admin lapsed 22:24 CET). It is STACKED on train 1124l (#5398, head 3de743c) because #5388 shares src/apm_cli/install/deploy_snapshot.py and src/apm_cli/install/journal_modes.py with #5385 (both auto-merged, no manual resolution). Lands after #5398; retarget to main then. Each car is a --no-ff merge of the member's exact head, with no glue.

Order PR Head Gate
1 #5388 (install: replay keeps a journaled path) e96a575 QL v2 H8 signed (desk row 323), W3d ACCEPT, Copilot at head, 0 threads
2 #5391 (auth: GHE Cloud and GHES TLS inherit) 366f006 QL v2 H8 signed (desk row 324), W3d ACCEPT, Copilot at head, 0 threads
3 #5366 (perf: in-process git-path checkout/verify) a32ef51 QL v2 H8 signed (desk row 325), W3d ACCEPT, Copilot at head, 0 threads

Integration on this head covers train 1 plus train 2. A red member is ejected, never fixed in the train. Known inherited flake #5395 (fault-injection interrupted install) may take one rerun per QL v2.

Type of change

  • Landing train (no new code)

Testing

CI, Integration and codescan run once on the train head (BURST: CI only, no local runs). QL v2 range-diffs H8 on the head.

Changelog

No new fragment. Each member brings its own changelog.d fragment.

…ng hot resolves

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ck in process, all-or-nothing per package) + lever C (pinned worktree from the bare's pack after clone --no-checkout; one-shot verify via the B1 manifest)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…re discard to git (C8), C11 differential + tamper cells

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…s are inert without an attribute)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…es read like APM_NO_INPROCESS_FETCH

The pack-served verify gives git's verdict on clean, tampered, planted,
deleted and exec-bit shapes with no cat-file spawn; a loose object or a
replace ref sends the whole package to git; every flipped pack byte gives
git's verdict or a refusal; an index that names the wrong bytes is refused
only by the re-hash (negative control). APM_NO_INPROCESS_VERIFY/CHECKOUT
turn the feature off only for 1, true, yes or on. pack_objects.py joins the
checkout-commit-verification owner. Refs #4939

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…nder tests/integration

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
portable_relpaths resolves through resolve_path only when the kernel form is
active (Linux); elsewhere it calls Path.resolve() directly, as before.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…cell names its bare by --git-dir

safe.bareRepository=explicit refuses bare discovery, so the cell failed in its
own setup on such hosts before reaching product code.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
tree-N-ghe puts every package on GHE Cloud and tree-N-gitlab on GitLab, both
served by the offline mirror. Installs then take the git path, never the
github.com-only in-process fetch or ref listing, which isolates git-path
levers on an enterprise-style host.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ed_path_entry; skip resolving skill roots that hold no kept copy

- record() passes the file and project root it resolved into
  deployed_path_entry (same call); the arch guard's pinned literal is
  updated in place.
- report_stale_kept_copies resolves an inactive skill root only when the
  root holds the skill it would report, instead of every root per skill.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…the tree; switches honor the command env

The attributes/config gate (a git config spawn) now runs after the in-process
tree walk and still before the first write, so a pack-shape refusal costs no
spawn. APM_NO_INPROCESS_CHECKOUT/VERIFY are read from the command's git env as
well as the process env, like APM_NO_INPROCESS_FETCH. The Windows-world
reference arm turns off both in-process paths so it stays pure git.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
R1: one inflate budget covers the whole materialize_tree call (every blob is
held until written), not a fresh cap per read.
R2: the gate checks the attributes git's own checkout would read, through
_require_inert_checkout_attributes(env) (the checkout env, the #5351 fold-2
class).
R3: a C8 seal before the index: the staged tree must hold exactly the made
directories (same dev and inode) and written files, with no link; otherwise
it is discarded and git checks out.
N1: grafts are refused at $GIT_DIR/info/grafts as well.
Cells: a half-tree budget refuses, the isolated-config XDG eol=crlf refuses,
and a parent swapped mid-write leaves only .git. Refs #4939

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…RESOLVE_NO_SYMLINKS)

On Linux 5.6+, one openat2(O_PATH, RESOLVE_NO_SYMLINKS) proves no component
of a normalized absolute path is a link, so the path is its own realpath:
one open and one close, no /proc name lookup. A link anywhere (ELOOP), an
unsupported kernel or seccomp, or any other error keeps the /proc form, then
Path.resolve(). Nothing is cached.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… the staged root

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… and fallback cells

Folds W3d O1-O6: absolute, normalized, NUL-free text only; close in
finally; differential cells for links (intermediate, final, dangling, /proc
magic), missing tail, ENOTDIR, EACCES, '//', NUL and a non-UTF-8 name, and a
forced ENOSYS that turns the form off.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The pack reader opens only what git opens (at least 32 bytes, PACK, version 2
or 3), and the byte-flip cell now covers the version bytes. The index write
loops until every byte is written and fails on no progress, so a short write
discards and falls back to git. Shared blobs are read once, so the whole-tree
inflate budget counts what is held. The changelog line names only the spawns
avoided.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… TLS (schannel)

Every OS-level number comes from that OS's default install config. On
Windows the offline mirror now runs git with the runner's own system TLS
config (schannel on default Git for Windows): the mirror CA goes into the
machine Root store for the world's lifetime, and the proxy's leaf names a
CRL distribution point served on loopback, so schannel's default revocation
check passes with no config change. The previous OpenSSL setup stays as a
secondary cell behind an '-openssl' fixture suffix. The modeled TLS config is
recorded in the fixture stats (git_tls).

The shared certificate minting gains an optional crl_url (default None, no
change for lifecycle tests).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
#5178)

journal_modes.carries_acl read Linux extended attributes only. On
Windows it now reads the DACL through ctypes (GetNamedSecurityInfoW,
GetSecurityDescriptorControl, GetAce) and reports a path whose DACL is
protected or holds an ACE without INHERITED_ACE. A DACL that cannot be
read is reported too (fail closed). Links and junctions carry no ACL of
their own, as on Linux. The keep reason on Windows is "it carries a
Windows ACL".

Staged restore directories are no longer created with mode 0o700 on
Windows: since Python 3.12.4 that mode gives the directory an explicit,
protected DACL, which the check would report, and Windows modes carry
nothing else.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
…rol fails (#5178)

The no-ACL control now reports the icacls listing of the project's
ancestors, of the directory before replay and of the staged directory
just before its rename, with the Python version, so a restored directory
that carries explicit ACEs shows where they came from.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
…the Root store

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… after (#5178)

The Windows gate showed that the restored directory carries exactly the
ACL it had before the kill. Under pytest's tmp_path, which Python 3.12.4+
creates with a protected DACL for mode 0o700, icacls lists the inherited
entries without the (I) marker, so the control's "(I)" oracle failed on a
correct restore. The control now asserts the restored directory's icacls
listing equals its listing before replay. A staged directory with a DACL
of its own is still refused, which the restored == 1 assertion catches.

apm-spec-waiver: Windows ACL detection in local crash-journal replay is internal install safety, not OpenAPM-observable

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
An isolated Git env (no system config, empty global) dropped http.sslBackend,
http.sslCAInfo and http.sslCAPath for every GitHub-class host but
github.com. On Windows a user with sslBackend=openssl plus a corporate CA in
~/.gitconfig then reached *.ghe.com or GHES through schannel and failed with
SEC_E_UNTRUSTED_ROOT. real_git_tls_config is host-agnostic and skips
repository scope, exactly what a plain git clone of that host reads, so the
inheritance now covers github.com, GHE Cloud and GHES; ADO, GitLab and
generic hosts are unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…tion

Merge-only. The one conflict, in install/journal_modes.py, takes both
sides: main's append_held/close_held/_close_quietly and this branch's
HomeGroupWritable and require_private_store(allow_group_home). The PR's
diff against main equals its diff against the old base b03b32c.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
… a shell

The unit module may not spawn processes (test taxonomy). The cell now
asserts that the printed recovery command splits, as a POSIX shell reads
it, into exactly chmod, g-w and the APM_HOME path with its space.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Replay treats a DACL it cannot read as an ACL (fail closed). The new
Windows cell makes GetNamedSecurityInfoW return ERROR_ACCESS_DENIED at
the ctypes boundary and asserts that replay keeps and reports the unit,
leaves its bytes as they are and retains the recovery copy.

apm-spec-waiver: Windows ACL detection in local crash-journal replay is internal install safety, not OpenAPM-observable

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
…utside links

The skill-bundle cell now patches ensure_path_within_resolved (the helper
_validate_skill_bundle calls), and two unpatched cells prove a SKILL.md
symlink and a skills/<name> dir symlink to outside still fail validation.
The openat2 readlink-count cell skips when openat2 cannot prove a plain
path link-free (seccomp or kernel).

Refs #4939

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…hored writes, includeIf, atomic HEAD

- A pack is served only when its object count and trailing checksum match
  its index, as git requires; the byte-flip cell covers bytes 4-11 and the
  trailer.
- On POSIX every directory and file is created through a directory fd this
  call opened no-follow, so a parent swapped for a link is never followed out
  of the stage (Windows keeps path writes plus the C8 seal); the swap cell
  asserts the link's outside target stays empty.
- When the effective config holds a conditional include, the attributes git's
  checkout reads are re-read from the stage itself; free otherwise.
- HEAD is replaced atomically, so a failed write leaves the clone's HEAD valid.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…so no extra spawn per checkout

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…heckout

# Conflicts:
#	tests/perf/count_budgets.json

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Critical flaws allow altered checkouts to bypass verification, Windows staging writes to escape their root, and journal recovery to lose explicit Windows ACLs.

3 open issues
What changed in this PR

This stacked landing train combines install-recovery hardening, enterprise Git TLS fixes, and checkout-performance improvements, including inherited changes from #5398.

Changes:

  • Adds Windows ACL checks and stricter account-source validation for interrupted-install recovery.
  • Extends Git TLS inheritance to enterprise GitHub hosts and introduces in-process pack checkout and verification.
  • Reduces path-resolution overhead and expands offline fixtures and regression coverage.
File Description
tests/​utils/​local_scripted_https_proxy.py Passes optional CRL URLs to certificate generation.
tests/​utils/​local_github_https_fixture.py Generates certificate revocation data for Windows TLS fixtures.
tests/​unit/​utils/​test_realpath.py Covers fast-path resolution and fallback behavior.
tests/​unit/​test_deployment_materialization_receipts.py Counts resolutions through the new fast path.
tests/​unit/​install/​test_deploy_snapshot.py Tests account enumeration, deferred replay, and recovery guidance.
tests/​unit/​core/​test_github_auth_first_optout.py Tests enterprise GitHub TLS inheritance.
tests/​lifecycle/​world/​services.py Supports CRL-enabled proxy certificates.
tests/​integration/​test_validation_rules.py Tests skill-link containment with resolved roots.
tests/​integration/​test_realpath_fork.py Tests process-proof reset and fork-lock safety.
tests/​integration/​test_pack_verify_cells.py Compares pack verification with Git.
tests/​integration/​test_pack_checkout_world.py Compares installed state across checkout implementations.
tests/​integration/​test_pack_checkout_cells.py Tests checkout parity, refusal, and resource limits.
tests/​integration/​test_journal_replay_windows_acl.py Tests Windows ACL retention and unreadable-ACL handling.
tests/​integration/​test_inprocess_fetch_windows_world.py Forces Git checkout in the reference case.
tests/​integration/​test_architecture_materialization_receipts.py Updates the receipt-routing guard fixture.
tests/​integration/​test_abandoned_deploy_journal_replay_lifecycle.py Tests replay deferral followed by permission repair.
tests/​fixtures/​perf/​recipes.py Adds GHE-only and GitLab-only benchmark trees.
tests/​fixtures/​perf/​offline.py Models Windows system TLS with temporary CA trust.
tests/​fixtures/​lifecycle_bug_ledger/​bugs/​5371.json Records the account-enumeration regression.
tests/​fixtures/​lifecycle_bug_ledger/​bugs/​5178.json Records the Windows ACL regression.
tests/​benchmarks/​journeys.py Adds TLS fixture variants and reporting.
src/​apm_cli/​utils/​realpath.py Adds link-free kernel resolution and process-scoped proofs.
src/​apm_cli/​utils/​paths.py Preserves instance resolution in batched path handling.
src/​apm_cli/​utils/​name_service.py Reads name-service database configuration.
src/​apm_cli/​models/​validation.py Reuses the resolved skill-containment root.
src/​apm_cli/​integration/​skill_preflight.py Uses the shared fast path resolver.
src/​apm_cli/​integration/​skill_adoption.py Avoids resolving irrelevant inactive skill roots.
src/​apm_cli/​integration/​instruction_integrator.py Uses fast resolution for prepared-plan keys.
src/​apm_cli/​integration/​base_integrator.py Routes containment and identity checks through shared resolution.
src/​apm_cli/​install/​transaction.py Reports group-write recovery steps.
src/​apm_cli/​install/​journal_modes.py Adds Windows ACL detection and stricter group-privacy checks.
src/​apm_cli/​install/​deployed_paths.py Accepts previously resolved paths and roots.
src/​apm_cli/​install/​deploy_snapshot.py Defers group-writable-home replay and reports platform ACLs.
src/​apm_cli/​install/​deploy_replay_state.py Extracts existing replay-state classification logic.
src/​apm_cli/​core/​deployment_ledger.py Reuses resolved paths during receipt recording.
src/​apm_cli/​core/​auth.py Extends TLS inheritance to enterprise GitHub hosts.
src/​apm_cli/​cache/​pack_objects.py Implements pack reading and in-process checkout materialization.
src/​apm_cli/​cache/​git_cache.py Integrates pack checkout with Git fallback.
src/​apm_cli/​cache/​checkout_verify.py Adds pack-backed object verification with Git fallback.
scripts/​architecture_linter/​checks/​install_base_integrator_and_contraction.py Updates the expected receipt-owner call shape.
packages/​apm-guide/​.apm/​skills/​apm-usage/​authentication.md Documents enterprise TLS inheritance.
docs/​src/​content/​docs/​reference/​environment-variables.md Clarifies GitHub-host TLS configuration inheritance.
changelog.d/​5391.fixed.md Notes the enterprise TLS fix.
changelog.d/​5388.fixed.md Notes Windows ACL-aware replay.
changelog.d/​5385.fixed.md Notes stricter group-privacy validation.
changelog.d/​5372.changed.md Notes path-resolution performance improvements.
changelog.d/​5366.changed.md Notes pack-based checkout and verification.
.apm/​architecture/​owners/​transport-auth-platform.json Registers pack code under checkout verification ownership.
.apm/​architecture/​owners/​install-deployment.json Registers replay-state and name-service modules.

Review effort: Balanced

Comment thread src/apm_cli/cache/pack_objects.py Resolved
Comment thread src/apm_cli/cache/pack_objects.py Resolved
Comment thread src/apm_cli/install/journal_modes.py Resolved
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

Superseded: cars landed as singles and in #5406

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.

2 participants