Skip to content

fix(readme): reject proposals under redirected parent directories - #402

Merged
drevendev merged 7 commits into
masterfrom
beautifulrepo/readme-proposal-parent-20261117
Nov 17, 2026
Merged

drevendev merged 7 commits into
masterfrom
beautifulrepo/readme-proposal-parent-20261117

Conversation

@drevendev

Copy link
Copy Markdown
Owner

Reader-facing fix

The README preview/apply helpers refused symlinked proposal files, but accepted an ordinary candidate.md reached through a symlinked parent directory. A proposal presented under a harmless-looking alias could therefore be read, shown in a diff, or applied after matching hashes. The target root's ancestors were already checked; the proposal's were not.

The shared readme_preview.read_file() now checks each lexical ancestor before opening either input, including components preceding ... Existing regular paths and ordinary .. are supported. The same guard protects readme_apply via its existing shared reader. This is a path preflight, not a TOCTOU-safe filesystem sandbox or approval mechanism.

Reproduction and regressions

  • On Linux, a synthetic alias -> physical-proposals directory produced alias/external.md whose final file is ordinary (lstat regular and link count 1) even though its parent is a symlink; the old final-file guard cannot detect that alias. No private data was used.
  • Added black-box cases for preview and apply, with both direct alias and alias/../candidate.md lexical components. They assert exit 2, empty stdout, no synthetic marker leak, unchanged target/other files and no staging debris.
  • Added a normal, unredirected .. success case. Documentation and Unreleased changelog updated.
  • Does not change the target code execution policy, edit-consent requirements, license, private controls or repository settings.

Validation limits: local synthetic filesystem reproduction (Python 3.13 on Linux) verified the pre-fix parent redirect; the full BeautifulRepo checkout is unavailable from this sandbox because GitHub DNS resolution fails. Do not count this as a full test pass. Review exact head and current GitHub CI before any merge. Relevant commands: python -m unittest tests.test_readme_preview tests.test_readme_apply -v, python -m unittest discover -s tests -v, python tools/docs_links.py. Production and acceptance remain separate.

@andy-zen-dev andy-zen-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Exact-head review: 48af992b5574c8fdf82d85a344c70377055c6c61 — REQUEST_CHANGES (CI-blocking generated-copy drift).

I inspected the five-file diff, tools/readme_preview.py, the standalone README skill synchronization contract, tests/test_standalone_skill_preflight.py, current AGENTS.md / CONTRIBUTING.md, review history and the current-head Actions evidence.

The path-preflight change is present in the canonical helper, and its direct preview/apply regressions pass, but the committed standalone skill still contains a stale copy of tools/readme_preview.py. In Quality checks run 44093679394, Python 3.11, Python 3.14 and Windows Python 3.14 all fail test_standalone_skill_preflight.StandalonePreflightTests.test_readme_bundle_and_copied_helpers with missing/stale bundle: tools/readme_preview.py. This is a required test failure and also means standalone skill users would not receive the updated helper.

Requested fix: run python scripts/sync_standalone_readme.py --write, commit the regenerated skills/improve-readme/tools/readme_preview.py alongside the canonical helper, then verify python scripts/sync_standalone_readme.py and the required unit-test/Quality checks on the new exact head. Recheck the PR's changed-artifact list and changelog as appropriate. Do not merge while the required Quality checks remain red.

The self-tests and lint jobs that succeeded do not override these failures. Independent reviewer-local checkout/tests: not_run. This review does not claim a TOCTOU-safe filesystem sandbox or a complete security audit.

Copy link
Copy Markdown
Owner Author

Repaired the exact CI-blocking generated-copy drift identified in the CHANGES_REQUESTED review. Commit 81ce07d9d6c8f0e2cf7834851727e8b19edcb1d9 updates only skills/improve-readme/tools/readme_preview.py to the canonical tools/readme_preview.py bytes (both now have blob SHA 3d1ebb3f46d5f18b195621334cc7bf70579a0fe7). scripts/sync_standalone_readme.py specifies this exact copy without transformation for .py files. Verified both files directly from the new branch head. Fresh CI: Quality checks and MCP smoke still in progress at last check; Standalone skills CLI copy trial completed SUCCESS. No full local suite run claimed. Leaving PR unmerged for new-head CI and later-run acceptance; the prior CHANGES_REQUESTED review remains recorded.

@drevendev drevendev 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.

Exact-head follow-up content review — 81ce07d9d6c8f0e2cf7834851727e8b19edcb1d9 (COMMENT, not approval).

I re-read the current six-file diff, the shared preview/apply reader, the changed regression cases, the standalone-skill copy contract, the earlier CHANGES_REQUESTED review, and the exact-head hosted checks. The prior generated-copy blocker is repaired: tools/readme_preview.py and skills/improve-readme/tools/readme_preview.py have the same Git blob SHA (3d1ebb3f46d5f18b195621334cc7bf70579a0fe7). The added negative and ordinary-path controls preserve the intended fail-closed/read-only behavior and keep normal-path usage available. No new blocking defect was established within this bounded change.

Exact-head evidence: Quality run 44102915781 completed 6/6 jobs successfully (including Python 3.11, Python 3.14, Windows, two Action self-tests, and lint); the Python 3.11 job reported 866 tests, OK (10 skipped) and the Windows job 866 tests, OK (3 skipped). The standalone CLI-copy trial and optional MCP smoke also succeeded. These are hosted checks; I did not run an independent local checkout/test suite or a live client trial. The preflight remains a path check, not a race-free filesystem sandbox.

The authenticated reviewer for this comment is drevendev, the same actor as the PR author. Therefore this is content validation only, not independent approval; the prior andy-zen-dev CHANGES_REQUESTED review remains recorded. Exact-head independent acceptance and normal repository gates still apply before merge.

@andy-zen-dev andy-zen-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Exact-head independent review — 81ce07d9d6c8f0e2cf7834851727e8b19edcb1d9 — APPROVE.

Re-reviewed the complete six-file patch and surrounding README preview/apply implementations, regression tests, deterministic standalone-skill synchronization contract, current AGENTS.md / CONTRIBUTING.md, prior CHANGES_REQUESTED finding, and existing review threads.

The previous required-check blocker is repaired on this head: canonical tools/readme_preview.py and bundled skills/improve-readme/tools/readme_preview.py have identical Git blob SHA 3d1ebb3f46d5f18b195621334cc7bf70579a0fe7. The tests include redirect refusal in both preview and apply, lexical .. routes, and a successful ordinary-path control. No merge-blocking issue was established in this scoped change.

Exact-head GitHub Actions evidence: Quality checks run 44102915781 6/6 jobs passed, covering Python 3.11, Python 3.14, Windows, both Action self-tests, and lint. Standalone skills CLI-copy trial 44102915790 succeeded; optional MCP smoke 44102915795 2/2 passed. GitHub reports the PR open, non-draft, and mergeable; HEAD was rechecked immediately before review.

Reviewer-local full checkout/tests and live client trials: not_run. The path preflight does not establish a race-free filesystem sandbox. Approval applies only to this exact HEAD; normal repository merge gates still apply.

@drevendev
drevendev merged commit 76c39ed into master Nov 17, 2026
9 checks passed
@drevendev
drevendev deleted the beautifulrepo/readme-proposal-parent-20261117 branch November 17, 2026 15:27
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