fix: use file mode to distinguish executable binaries from non-executable ones#256
Merged
fix: use file mode to distinguish executable binaries from non-executable ones#256
Conversation
…able ones Fixes #255 ## What Added the Mode field from GitHub's GraphQL TreeEntry to the repo tree struct and updated the binary check to use Unix execute permission bits (mode & 0111) to determine if a binary file is actually executable. ## Why OSPS-QA-05.01 targets "generated executable artifacts," not all binary files. Non-executable binaries like PNGs and PDFs were being incorrectly flagged, causing false failures for documentation-heavy repositories. ## Notes - The bitwise check (`mode & 0111`) is used instead of exact mode comparison (`== 33261`) for robustness against non-standard Git implementations, though standard Git only uses 100755 for executables. - This changes behavior for the `checkViaPartialFetch` fallback path: when `isBinaryPtr` is nil and the file is fetched via HTTP, the mode check is NOT applied. That path lacks the GraphQL mode data, so it retains the existing MIME-based heuristic. Reviewers should consider whether this is acceptable. Signed-off-by: jmeridth <jmeridth@gmail.com>
eddie-knight
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #255
What
Added the Mode field from GitHub's GraphQL TreeEntry to the repo tree struct and updated the binary check to use Unix execute permission bits (mode & 0111) to determine if a binary file is actually executable.
Why
OSPS-QA-05.01 targets "generated executable artifacts," not all binary files. Non-executable binaries like PNGs and PDFs were being incorrectly flagged, causing false failures for documentation-heavy repositories.
Notes
mode & 0111) is used instead of exact mode comparison (== 33261) for robustness against non-standard Git implementations, though standard Git only uses 100755 for executables.checkViaPartialFetchfallback path: whenisBinaryPtris nil and the file is fetched via HTTP, the mode check is NOT applied. That path lacks the GraphQL mode data, so it retains the existing MIME-based heuristic. Reviewers should consider whether this is acceptable.