progress generators can overwrite reports through output aliases #12055

Closed
opened 2026-10-27 17:48:49 +00:00 by malekaifa · 0 comments
malekaifa commented 2026-10-27 17:48:49 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by malekaifa on 2026-10-27T17:48:49Z.


What happens

The progress generators write several named reports into the same output directory without checking whether two of those paths already refer to the same filesystem object.

On current main, if (for example) progress.json and progress.html are hardlinks to the same file, tools/progress.py::write_site() writes each path in sequence and the later HTML write silently overwrites the JSON through the alias. The same behavior exists in tools/progress_history.py for history.json / history.svg / history.html.

I reproduced both cases on current main with real hardlinks: after generation, the aliased JSON path contains the HTML payload instead of JSON.

Expected behavior

Before writing any generated report, reject an output set in which two report paths already refer to the same existing filesystem object. Preserve all existing report bytes unchanged on that failure.

The existing progress_history --cache guard is outside this bug and should retain its current behavior.

Proposed fix

  • Add a small generated-output identity helper: exact normalized spelling catches the same path without case-folding; samefile() catches existing filesystem aliases/hardlinks.
  • Validate the generated progress output set before any write.
  • Validate the generated history output set before collection/write.
  • Leave the existing history cache/output guard unchanged.
  • Add real-hardlink regressions asserting every pre-existing report remains unchanged when rejected.
  • Add a regression proving the helper does not reject case-distinct paths merely because Windows Path equality normally case-folds them.

I can take this. Candidate branch: malekaifa/AnyPS5:fix/progress-history-output-aliases, being qualified against current main before PR submission.

Overlap check: AnyPS5's tools/pr_overlap.py reported no overlap with open pull requests for this branch at reservation time.

AI-assisted: yes (OpenAI Codex).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6064694663 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/12055). Originally posted by [malekaifa](https://github.com/malekaifa) on 2026-10-27T17:48:49Z. --- ### What happens The progress generators write several named reports into the same output directory without checking whether two of those paths already refer to the same filesystem object. On current `main`, if (for example) `progress.json` and `progress.html` are hardlinks to the same file, `tools/progress.py::write_site()` writes each path in sequence and the later HTML write silently overwrites the JSON through the alias. The same behavior exists in `tools/progress_history.py` for `history.json` / `history.svg` / `history.html`. I reproduced both cases on current main with real hardlinks: after generation, the aliased JSON path contains the HTML payload instead of JSON. ### Expected behavior Before writing any generated report, reject an output set in which two report paths already refer to the same existing filesystem object. Preserve all existing report bytes unchanged on that failure. The existing `progress_history --cache` guard is outside this bug and should retain its current behavior. ### Proposed fix - Add a small generated-output identity helper: exact normalized spelling catches the same path without case-folding; `samefile()` catches existing filesystem aliases/hardlinks. - Validate the generated progress output set before any write. - Validate the generated history output set before collection/write. - Leave the existing history cache/output guard unchanged. - Add real-hardlink regressions asserting every pre-existing report remains unchanged when rejected. - Add a regression proving the helper does not reject case-distinct paths merely because Windows `Path` equality normally case-folds them. I can take this. Candidate branch: `malekaifa/AnyPS5:fix/progress-history-output-aliases`, being qualified against current `main` before PR submission. Overlap check: AnyPS5's `tools/pr_overlap.py` reported no overlap with open pull requests for this branch at reservation time. AI-assisted: yes (OpenAI Codex).
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#12055
No description provided.