Skip to content

Commit 678ae05

Browse files
committed
CM-53944-Fixed issue when docker file is ignored because it has no extension
1 parent 2c65f0f commit 678ae05

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

cycode/cli/consts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
IAC_SCAN_SUPPORTED_FILE_EXTENSIONS = ('.tf', '.tf.json', '.json', '.yaml', '.yml', '.dockerfile', '.containerfile')
1818
IAC_SCAN_SUPPORTED_FILE_PREFIXES = ('dockerfile', 'containerfile')
1919

20+
DOCKER_FILE_NAME = 'dockerfile'
21+
2022
SECRET_SCAN_FILE_EXTENSIONS_TO_IGNORE = (
2123
'.DS_Store',
2224
'.bmp',

cycode/cli/files_collector/file_excluder.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,17 @@ def apply_scan_config(self, scan_type: str, scan_config: 'models.ScanConfigurati
6969
if scan_config.scannable_extensions:
7070
self._scannable_extensions[scan_type] = tuple(scan_config.scannable_extensions)
7171

72+
@staticmethod
73+
def check_if_docker_file(file_path: str) -> bool:
74+
path = Path(file_path)
75+
file = path.name
76+
if file == consts.DOCKER_FILE_NAME:
77+
return True
78+
7279
def _is_file_extension_supported(self, scan_type: str, filename: str) -> bool:
7380
filename = filename.lower()
74-
81+
if self.check_if_docker_file(filename):
82+
return True
7583
scannable_extensions = self._scannable_extensions.get(scan_type)
7684
if scannable_extensions:
7785
return filename.endswith(scannable_extensions)

0 commit comments

Comments
 (0)