-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Limit Binary Artifact file reads to first 1024 bytes #3923
🐛 Limit Binary Artifact file reads to first 1024 bytes #3923
Conversation
Signed-off-by: Spencer Schrock <sschrock@google.com>
Signed-off-by: Spencer Schrock <sschrock@google.com>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3923 +/- ##
==========================================
- Coverage 75.11% 68.58% -6.53%
==========================================
Files 234 234
Lines 15859 15877 +18
==========================================
- Hits 11912 10890 -1022
- Misses 3187 4294 +1107
+ Partials 760 693 -67 |
/scdiff generate Binary-Artifact |
This is already a big improvement, but why 1024 bytes? From what I understood (described in #3831), h2non/filetype (the package Scorecard uses to determine the filetype) only needs the first 262 bytes. |
Getting the file type is just one part, we also check some of the file for false positives. You can read a bit more here: #2412. |
* add OnMatchingFileReaderDo Signed-off-by: Spencer Schrock <sschrock@google.com> * switch binary artifact to using reader Signed-off-by: Spencer Schrock <sschrock@google.com> --------- Signed-off-by: Spencer Schrock <sschrock@google.com>
What kind of change does this PR introduce?
bug fix
What is the current behavior?
The whole file is read, even though we only use 1024 bytes when determining if a file is text or binary
What is the new behavior (if this is a feature change)?**
Only up to the first 1024 bytes are read.
Which issue(s) this PR fixes
Part 1 of 2 to address #3831
Special notes for your reviewer
Does this PR introduce a user-facing change?
For user-facing changes, please add a concise, human-readable release note to
the
release-note
(In particular, describe what changes users might need to make in their
application as a result of this pull request.)