-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Archive handler error: matching $format: read /tmp/tmp_archive123456: is a directory
#2426
Comments
@ahrav @bugbaba The "is a directory" error is surprisingly convoluted, but I think I've narrowed down the cause. #2178 didn't fix the root cause, only reduced the likelihood of it happening.
What does all this mean?I don't know. I understand how this happens, but not why nor what the proper fix is. The obvious solution is to throw in another It seems to me that the core design issue is that trufflehog/pkg/handlers/handlers.go Lines 74 to 77 in b69e2c6
|
I think we are planning on re-working the archive handler in general. There is too much recursion for my liking 😅 Also as you alluded to certain archive types that aren't .deb get un-archived correctly but then our logic to try and pass the unarchived directory to the regular archive handler fails, since it only works with files. |
Tbh, I'm not sure how you would handle directories without recursion. The logic could definitely be cleaner.
Perhaps this is a naive suggestion, but would modifying |
Please review the Community Note before submitting
TruffleHog Version
3.67.5
Trace Output
Expected Behavior
The archive handler should not call
archive.Identify
on directories.Actual Behavior
Frequent errors like
matching bz2: read /tmp/tmp_archive3933205369: is a directory
are printed to the console.Steps to Reproduce
Scan https://github.com/Mzack9999/subnet.git.
Environment
N/A
Additional Context
The error comes from the underlying mbolt/archiver library, specifically the
Indentify
function.So far I have only encountered this with
.a
files. I haven't seen it with.rpm
files, but I also haven't explicitly tested it with those either. This may be a slightly different problem from #2071 or the fix was incomplete. I am far too sick to properly investigate at the moment (sorry).Edit: I've also encountered it with
.rlib
and.rpm
files.Edit2: stack trace from inserting a manual panic
References
unable to determine MIME type of nested filename
error #2071The text was updated successfully, but these errors were encountered: