mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:55:52 +01:00
[PR #384] pe_inspect: refuse aliased JSON/Markdown report outputs (PE-REPORT-OUTPUT-ALIAS) #435
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#435
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/384
Author: @tahffo68hk-hash
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:fix/pe-report-output-alias📝 Commits (1)
56354fape_inspect: refuse aliased JSON/Markdown and prior report outputs (PE-REPORT-OUTPUT-ALIAS)📊 Changes
2 files changed (+65 additions, -0 deletions)
View changed files
📝
tests/test_pe_inspect.py(+46 -0)📝
tools/pe_inspect.py(+19 -0)📄 Description
Claimed in the coordination issue as:
PE-REPORT-OUTPUT-ALIASProblem
tools/pe_inspect.pycheckssame_output_path()between each report output (.json/.md) and every input image, but did not check:json_pathandmd_pathrefer to the same underlying file (e.g., via hard link or symlink). Writing.jsonand then.mdsilently truncated and overwrote the JSON report with Markdown while still returning exit code0.Fix
same_output_path(json_path, md_path)before writing either report; refuse and return exit code1without modifying the aliased file.written_outputsacross the run and refuse if a subsequent image's.jsonor.mdaliases an earlier report.tests/test_pe_inspect.pycovering both hard-linked.json/.mdoutputs and cross-image report aliasing.Verification
python -I tests/test_pe_inspect.pyos.symlinkprivilege on Windows), 0 failed.中文翻译
在协调帖 #14 中认领的 ID:
PE-REPORT-OUTPUT-ALIAS问题描述
tools/pe_inspect.py检查了输出报告(.json/.md)与输入文件是否指向同一路径,但未检查:json_path与md_path彼此是否指向同一底层文件(例如硬链接或符号链接),导致后写入的 Markdown 静默截断并覆盖 JSON 报告,且程序仍返回退出码0。修复方案
same_output_path(json_path, md_path),若互为别名则拒绝写入并返回退出码1,不破坏原文件。written_outputs,拒绝后续镜像的报告覆盖先前已写入的报告。tests/test_pe_inspect.py中补充合成回归测试,覆盖同镜像.json/.md硬链接别名与跨镜像报告别名两种场景。验证结果
python -I tests/test_pe_inspect.pyos.symlink权限限制),0 失败。🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.