Skip to content
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

ScannerFacade#getFilename not working properly on Windows #75

Open
GunoH opened this issue Aug 16, 2022 · 2 comments
Open

ScannerFacade#getFilename not working properly on Windows #75

GunoH opened this issue Aug 16, 2022 · 2 comments
Labels

Comments

@GunoH
Copy link

GunoH commented Aug 16, 2022

The ScannerFacade#getFilename method uses a hard-coded '/' as path separator, causing the method not to work properly on Windows, as windows uses backslashes as path separator.

private static String getFilename(String path) {
    int lastSlash = path.lastIndexOf('/');
    if(lastSlash < 0) lastSlash = 0;
    return path.substring(lastSlash+1);
}

In this code, the lastSlash variable will always be 0, as a Windows path (or filename) cannot contain forward slashes.

It probably should use something like File.pathSeparator instead of the hard-coded '/'.

@h3xstream h3xstream added the bug label Aug 18, 2022
@h3xstream
Copy link
Owner

In which context (Burp, ZAP or Maven) are you getting the bug ? I assume it must be with the Maven integration.

@GunoH
Copy link
Author

GunoH commented Jun 1, 2023

@h3xstream Sorry for taking that long to respond; only seeing your question now.

This happens to me when I run the DependencyCheck Gradle plugin on my project. Retirejs is unable to parse the filename/version number for one of my dependencies correctly because of this, leading to a false positive.

To be more specific: when com.h3xstream.retirejs.repo.ScannerFacade#getFilename is handed a path like c:\a\b\123\myapp\libs\somelib.min.js, it returns :\a\b\123\myapp\libs\somelib.min.js,. Subsequently VulnerabilitiesRepository#findByFileName wrongfully assumes the library version is 123.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants