Skip to content

fix(install): a linked governed directory never proves a no-op - #5442

Merged
Daniel Meppiel (danielmeppiel) merged 7 commits into
mainfrom
danielmeppiel-fix-5438-linked-target-roots
Nov 25, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 7 commits into
mainfrom
danielmeppiel-fix-5438-linked-target-roots

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Description

The verified-state no-op checks shipped in train #5406 (the record replay and the attested hit, #5383) keyed governed target directories by content only. They did not key each directory level by its filesystem kind, which the engine's full fast path does check. This PR makes both checks use the same kind rule as the engine.

  • verdict_inputs._kind, the one lstat owner of these inputs, now classifies Windows name-surrogate reparse points the way path_security._is_link does.
  • verdict_inputs.walk_governed walks a governed root and keys every level by kind. A level the engine would refuse raises ValueError, which means no record and a miss. target:<dir> is keyed by kind.
  • _deployed_intact applies the same kind rule to each deployed file's parent chain below the project root.

Cost: one lstat per governed directory level per no-op check. Parents already seen are not checked again.

Issue and approved scope

Issue: Fixes #5438

Human scope-approval comment: v0.39.0 red-team finding, filed into QL v2's red-team ledger (E2-1); the CEO order is that every bug found in the red team is fixed.

This completes the issue.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

Red before the fix: red-first cells on the RC (4287880) failed for the replay and the attested hit, and passed the engine control [CI run 45565008442].

New cells in tests/integration/test_verdict_record.py: directory-kind changes miss the replay and the attested hit (with a positive control), are never recorded, and match the engine's own refusal. Windows coverage uses a junction.

Local runs are paused on the host per the CEO load order; this PR's CI is the validation.

Changelog

  • One fragment per section, changelog.d/<pr>.<section>.md, holding
    one line: user-visible effect first, 25 words or fewer, ending with
    (#PR); breaking changes only under upgrade notes; no Highlights; no
    new lines under ## [Unreleased]. See changelog.d/README.md and
    .github/instructions/changelog.instructions.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated
    (new/changed <a id="req-XXX"></a> anchor + prose + Appendix C
    row).
  • Manifest edit: docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.yml
    updated.
  • Test edit: a @pytest.mark.req("req-XXX") test under
    tests/spec_conformance/ added or extended.
  • CONFORMANCE.{md,json} regenerated via
    uv run --extra dev python -m tests.spec_conformance.gen_statement
    and committed.
  • N/A -- this PR does not change OpenAPM-observable behaviour.

apm-spec-waiver: no-op fast-path input keying fix; install outcomes are unchanged

The verified-state replay and the attested hit keyed a governed target
root by os.path.isdir and walked through it, so a root (or subdirectory)
swapped for a symlink or junction to an identical copy still hit, while the
engine's fast path refuses any link in a deployed path. verdict_inputs._kind
now treats a junction as a link; walk_governed refuses any linked governed
level (no record, a miss) and _deployed_intact refuses a linked parent of a
deployed file. One lstat per governed directory level.

Fixes #5438

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 25, 2026 07:12
Refs #5438

apm-spec-waiver: no-op fast-path input keying fix; install outcomes are unchanged

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

apm-spec-waiver: no-op fast-path input keying fix; install outcomes are unchanged

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
apm-spec-waiver: no-op fast-path input keying fix; install outcomes are unchanged

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

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

Directory symlinks can still be recorded and reused when they should force a miss, and the new regression tests lack the marker needed to run in the Windows gate.

3 open issues
What changed in this PR

This PR addresses #5438 by tightening install no-op verification so linked governed directories cannot be treated as verified state, aligning replay and attested-hit checks with the engine’s path-safety rules.

Changes:

  • Adds junction-aware path classification and governed-directory checks.
  • Checks deployed-file parent directories before accepting cached state.
  • Adds regression tests and a user-facing changelog entry.
File Description
tests/​integration/​test_verdict_record.py Adds linked-directory regression tests for replay, attestation, recording, and engine refusal.
src/​apm_cli/​install/​verdict_record.py Keys target roots by kind and checks deployed-file parents.
src/​apm_cli/​install/​verdict_inputs.py Adds junction detection, governed traversal checks, and cached parent checks.
changelog.d/​5442.fixed.md Documents the install no-op verification fix.

Review effort: Balanced

Comment thread src/apm_cli/install/verdict_inputs.py Resolved
Comment thread src/apm_cli/install/verdict_inputs.py Resolved
…wner (#5438)

Route the verdict's link predicate and deployed-parent check through
path_security (is_link_stat, has_symlink_component), the owner
diff_apply._within uses, and guard the routing statically. Refuse a
governed link that is not a link to a regular file (POSIX lists a
directory link among the files). Mark the new cells windows_compat.

apm-spec-waiver: no-op fast-path input keying fix; install outcomes are unchanged

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

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.

🔵 Needs a closer look

Security-sensitive no-op verification changes require final-revision Windows CI evidence because junction classification depends on Windows lstat/scandir behavior, and the supplied red-first RC run does not validate the fix.

No open issues 🎉

3 resolved since last review

Review effort: Balanced

… module

Keeps transport_auth_platform.py under the 2100-line cap; same rule id
(transport-platform-url-path-security), same checks, same MutationCase.

apm-spec-waiver: no-op fast-path input keying fix; install outcomes are unchanged

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

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.

🟢 Approval recommended

No active review issues are recorded for the changes tightening linked-directory checks before verified-state reuse.

No open issues 🎉

Review effort: Balanced

@danielmeppiel Daniel Meppiel (danielmeppiel) added the full-integration Run the full integration suite (ci-integration.yml) on this PR before merge label Nov 25, 2026
…d-root refusal

apm-spec-waiver: no-op fast-path input keying fix; install outcomes are unchanged

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

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.

🟢 Approval recommended

No active review issues are reported for the directory-link verification changes.

No open issues 🎉

Review effort: Balanced

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 853b4cd into main Nov 25, 2026
58 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-fix-5438-linked-target-roots branch November 25, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-integration Run the full integration suite (ci-integration.yml) on this PR before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No-op verification does not check the kind of governed target directories

2 participants