Skip to content

fix(readme): refuse external hard-link aliases in preview and apply - #380

Merged
drevendev merged 5 commits into
masterfrom
beautifulrepo/readme-hardlink-boundary-20261115
Nov 15, 2026
Merged

drevendev merged 5 commits into
masterfrom
beautifulrepo/readme-hardlink-boundary-20261115

Conversation

@drevendev

@drevendev drevendev commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

What changes

  • Refuse a hard-linked target README.md or proposed README before displaying a diff or applying an explicitly approved edit. On POSIX and Windows, a hard link is a regular file with st_nlink > 1; a symlink-only preflight misses that alias.
  • Check link count on both the initial path metadata and the opened file descriptor, so a replacement between those two reads cannot silently bypass the stable-file test.
  • Keep the standalone skills/improve-readme/tools/readme_preview.py bundle byte-identical to the root helper, so copied skill installations inherit the same guard.
  • Add black-box regressions for both target and proposal in readme_preview.py and readme_apply.py, including no secret marker in stdout/stderr, unchanged external synthetic data, and no unapproved target mutation.
  • Record the scope in the public changelog.

Verification and limits

  • Locally reproduced that a hard-linked synthetic outside file is a regular file with link count 2; this establishes the original preflight gap, not a full-suite PASS.
  • Five changed public product files; no private controls or scheduler state.
  • Initial Quality CI found a stale standalone skill bundle (test_readme_bundle_and_copied_helpers, Python 3.11/3.14). Fixed on the same branch by synchronizing the bundled helper in commit 6370e22; recheck fresh CI on the new head. Windows hard-link availability remains bounded by actual runner results.
  • This is a stable-file alias defense, not a race-resistant sandbox or permission to read private targets.

Related: #70 (README-improvement skill), #74 (evidence boundaries).

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

Later-run maintainer acceptance review on exact head 6370e2205a8f922314399bd3d9f4197e39eec29c: the change stays within the README preview/apply hard-link alias boundary; both root and standalone skill copies match, and failures are explicit before rendering or applying approved bytes. Current Quality CI 6/6, optional MCP CI 2/2 and standalone copied-skill CI 1/1 are successful. I inspected the actual Ubuntu and Windows unit-test logs: test_approved_hardlinked_readme_or_proposal_is_refused and test_hardlinked_target_or_proposal_refuses_external_document both ran and passed on each platform (not skipped). No unresolved inline threads or material blocker found. Limit: this does not guarantee protection against concurrent path swaps, and local full-suite testing was not repeated. COMMENT is same-account review evidence, not independent approval or a required provider gate.

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