Yelp/detect-secrets

detect-secrets scan --all-files returns ValueError: year 0 is out of range

franzramadhan opened this issue · 0 comments

Versions

~ git --version
git version 2.37.1
➜  ~ python --version
Python 3.10.5
➜  ~ detect-secrets --version
1.2.0

Details

I am trying to run detect-secrets scan --all-files . in my existing git repository but got following error.

multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.10/3.10.5/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/core/secrets_collection.py", line 313, in _scan_file_and_serialize
    return list(scan.scan_file(filename))
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/core/scan.py", line 150, in scan_file
    for lines in _get_lines_from_file(filename):
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/core/scan.py", line 254, in _get_lines_from_file
    lines = get_transformed_file(cast(NamedIO, f))
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/transformers/__init__.py", line 31, in get_transformed_file
    return transformer.parse_file(file)
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/transformers/yaml.py", line 36, in parse_file
    items = sorted(YAMLFileParser(file), key=lambda x: x.line_number)
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/transformers/yaml.py", line 170, in __iter__
    to_search = deque([self.json()])
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/transformers/yaml.py", line 161, in json
    return cast(Dict[str, Any], self.loader.get_single_data())
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/yaml/constructor.py", line 51, in get_single_data
    return self.construct_document(node)
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/yaml/constructor.py", line 60, in construct_document
    for dummy in generator:
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/yaml/constructor.py", line 218, in construct_mapping
    return super().construct_mapping(node, deep=deep)
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/yaml/constructor.py", line 143, in construct_mapping
    value = self.construct_object(value_node, deep=deep)
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/yaml/constructor.py", line 100, in construct_object
    data = constructor(self, node)
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/yaml/constructor.py", line 330, in construct_yaml_timestamp
    return datetime.date(year, month, day)
ValueError: year 0 is out of range
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/homebrew/bin/detect-secrets", line 33, in <module>
    sys.exit(load_entry_point('detect-secrets==1.2.0', 'console_scripts', 'detect-secrets')())
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/main.py", line 30, in main
    handle_scan_action(args)
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/main.py", line 70, in handle_scan_action
    secrets = baseline.create(
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/core/baseline.py", line 34, in create
    secrets.scan_files(
  File "/opt/homebrew/Cellar/detect-secrets/1.2.0/libexec/lib/python3.10/site-packages/detect_secrets/core/secrets_collection.py", line 67, in scan_files
    for secrets in p.imap_unordered(
  File "/opt/homebrew/Cellar/python@3.10/3.10.5/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/pool.py", line 870, in next
    raise value
ValueError: year 0 is out of range

Please let me know if you need further info or logs