Skip to content

fix: protect qdocco source files - #41

Merged
tiye merged 2 commits into
feat/program-fingerprintfrom
fix/qdocco-source-overwrite
Aug 23, 2026
Merged

fix: protect qdocco source files#41
tiye merged 2 commits into
feat/program-fingerprintfrom
fix/qdocco-source-overwrite

Conversation

@tiye

@tiye tiye commented Aug 22, 2026

Copy link
Copy Markdown
Member

Summary

  • reject qdocco output paths that resolve to the input source
  • protect against accidental overwrite through symlinks as well as identical paths
  • add a CLI regression test and document the RFC 0083 safety contract

Validation

  • make check
  • focused qdocco regression test
  • git diff --check

This PR is chained after PR #40 and is intentionally not merged automatically.

Copilot AI lite review requested due to automatic review settings August 22, 2026 15:04

Copilot AI 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.

Pull request overview

This PR hardens the qdocco CLI against accidentally overwriting its input source by rejecting output paths that resolve to the same file (including via symlinks), and codifies the safety contract in both tests and RFC documentation.

Changes:

  • Add a same_path() guard in qdocco to reject output paths that match the input source after canonicalization (exit code 2).
  • Add a CLI regression test covering the “output equals input” overwrite scenario.
  • Document the safety contract in RFC 0083.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/cli_tools.rs Adds a regression test to ensure qdocco -o cannot overwrite the input source file.
src/bin/qdocco.rs Introduces a canonicalized path equality check to prevent input source overwrites.
RFCs/0083-qdocco-markdown.md Documents the “output must differ from input (incl. symlink)” contract as part of the CLI spec.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/cli_tools.rs
@tiye
tiye force-pushed the perf/core-rfc0100-workload branch from 0c1c326 to 5facc10 Compare August 23, 2026 04:50
Base automatically changed from perf/core-rfc0100-workload to feat/program-fingerprint August 23, 2026 04:51
@tiye
tiye force-pushed the fix/qdocco-source-overwrite branch from b063f9f to 75e5189 Compare August 23, 2026 04:53
@tiye
tiye merged commit 7798142 into feat/program-fingerprint Aug 23, 2026
2 checks passed
@tiye
tiye deleted the fix/qdocco-source-overwrite branch August 23, 2026 04:54
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