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

cyclic symlinks put dependency check into a loop. #285

Closed
blaksec opened this issue Jul 21, 2015 · 6 comments
Closed

cyclic symlinks put dependency check into a loop. #285

blaksec opened this issue Jul 21, 2015 · 6 comments

Comments

@blaksec
Copy link

blaksec commented Jul 21, 2015

Stumbled upon an issue with cyclic symlink which puts dependency check into a loop

Scanning /usr/local/apache which has the following inside

/usr/local/apache/lib_php/
/usr/local/apache/lib_php/php -> ../lib_php

My command line looks like this
./bin/dependencycheck-cli.sh -a MyPrj -s /usr/local/apache/ -l MyPrj.log

Once it hits the "lib_php" it goes into a loop, writing continuously to the log file something like
"FINE: Path passed to scanFile(File) is not a file: /usr/local/apache/lib_php/php/lib_php/php......"

if I change the scan path to "/usr/local/apache/*/.jar" it stops writing to the log file but instead writes to the terminal: "Skipping symbolic link /usr/local/apache/lib_php/php/lib_php/php......" eventually running out of memory here DirectoryScanner.java:notFollowedSymlinks.add(file.getAbsolutePath());

I know killing the horse does not fix the leg but could there be a way to detect cyclic symlinks? or ignore symlinks all together? or have an ignore list where I can specify a path to ignore for during recursive scans?

@jeremylong
Copy link
Owner

I added an option to the CLI 1.2.12-SNAPSHOT so that you can specify the depth that symbolic links will be followed. Currently, the default value is 0 indicating symbolic links will not be followed.

More testing of this patch are needed before I will close this issue.

--Jeremy

@blaksec
Copy link
Author

blaksec commented Jul 22, 2015

Thank you. I'll test it tomorrow and update with results.

Quick thing I noticed while scanning the code:
throw new ParseException("Symbolic Link Depth (symLink) must be greater then zero."); <= "than zero"?

jeremylong added a commit that referenced this issue Jul 23, 2015
@blaksec
Copy link
Author

blaksec commented Jul 23, 2015

Manually merged the changes from 5b8d3de, 7b092f7.

"--symLink" appears in the list of options, passed 0 to it to ignore symlinks.

When I pass the files as "-s /my/path/*/.jar". In the console I get
"Skipping symbolic link.. " but no issues, no more OOM even on large directory structures.

When I pass the files as "-s /my/path/**" or "-s /my/path/" it seems to go into the loop again, continuously writing to the log file "FINE: Path passed to scanFile(File) is not a file: /usr/local/apache/lib_php/php/lib_php/php......"

jeremylong added a commit that referenced this issue Jul 25, 2015
@jeremylong
Copy link
Owner

Realized my mistake in the first patch; this should be fixed now. I'll test on my linux box in the next day or two.

jeremylong added a commit that referenced this issue Jul 27, 2015
jeremylong added a commit that referenced this issue Jul 28, 2015
@jeremylong
Copy link
Owner

Thanks for reporting the bug. I have made one final tweak to the patch and have tested the patch.

--Jeremy

@lock
Copy link

lock bot commented Sep 28, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Sep 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants