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

TypeError: 'NoneType' object is not iterable #333

Open
Mr-Li-Chang opened this issue Nov 7, 2024 · 3 comments
Open

TypeError: 'NoneType' object is not iterable #333

Mr-Li-Chang opened this issue Nov 7, 2024 · 3 comments

Comments

@Mr-Li-Chang
Copy link

Hi Colleagues,

When I use CLI command "scan_snapshot" to scan my master branch, it raised error as below, could you please check?

INFO:credentialdigger.cli.cli:Database in use: Sqlite
INFO:credentialdigger.cli.scan_snapshot:Scan snapshot at branch/commit master
Traceback (most recent call last):
  File "/usr/local/bin/credentialdigger", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/credentialdigger/__main__.py", line 7, in main
    cli.main(sys.argv)
  File "/usr/local/lib/python3.10/site-packages/credentialdigger/cli/cli.py", line 152, in main
    args.func(client, args)
  File "/usr/local/lib/python3.10/site-packages/credentialdigger/cli/scan_snapshot.py", line 129, in run
    discoveries = client.scan_snapshot(
  File "/usr/local/lib/python3.10/site-packages/credentialdigger/client.py", line 869, in scan_snapshot
    return self._scan(
  File "/usr/local/lib/python3.10/site-packages/credentialdigger/client.py", line 1195, in _scan
    raise e
  File "/usr/local/lib/python3.10/site-packages/credentialdigger/client.py", line 1187, in _scan
    new_discoveries = scanner.scan(repo_url,
  File "/usr/local/lib/python3.10/site-packages/credentialdigger/scanners/git_file_scanner.py", line 121, in scan
    discoveries = self._scan(
  File "/usr/local/lib/python3.10/site-packages/credentialdigger/scanners/git_file_scanner.py", line 166, in _scan
    self._prune(rel_dir_root, dirs, files,
  File "/usr/local/lib/python3.10/site-packages/credentialdigger/scanners/file_scanner.py", line 210, in _prune
    if any([fnmatch(dir_path, pattern) for pattern in ignore_list]):
TypeError: 'NoneType' object is not iterable

The command I'm using is "/usr/local/bin/credentialdigger scan_snapshot $REPO_URL --sqlite /credential-digger-ui/data.db --snapshot master --dotenv /credential-digger-ui/.env --similarity --models PathModel PasswordModel --git_token $TOKEN".

The thing is, I can do the full scan by using "scan" command, and the result is correct in UI. But when I use scan_snapshot, it raised error during script running, and the result can't be displayed in UI. I tried with new db (recreate the data.db), it's same as well.

@Mr-Li-Chang
Copy link
Author

Hi @marcorosa ,
I found the issue at

'--ignore_list', default=None, nargs='+',
, as the parameter "ignore_list" is a list, and it's optional, it should have a default value of empty list, instead of "None".

@Mr-Li-Chang
Copy link
Author

And the document https://github.com/SAP/credential-digger/wiki/CLI:--Command-Line-Interface also should be updated.

@marcorosa
Copy link
Member

Hi @Mr-Li-Chang thanks for solving the issue. Feel free to open a pull request to speed up the patching, I am currently out of office and will have time to fix this in the next days

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

No branches or pull requests

2 participants