libsast 3.1.2__tar.gz → 3.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {libsast-3.1.2 → libsast-3.1.4}/PKG-INFO +5 -3
- {libsast-3.1.2 → libsast-3.1.4}/README.md +4 -1
- {libsast-3.1.2 → libsast-3.1.4}/libsast/__init__.py +1 -1
- {libsast-3.1.2 → libsast-3.1.4}/libsast/core_matcher/choice_matcher.py +10 -4
- {libsast-3.1.2 → libsast-3.1.4}/libsast/core_matcher/pattern_matcher.py +9 -4
- {libsast-3.1.2 → libsast-3.1.4}/libsast/scanner.py +4 -4
- {libsast-3.1.2 → libsast-3.1.4}/pyproject.toml +7 -2
- {libsast-3.1.2 → libsast-3.1.4}/LICENSE +0 -0
- {libsast-3.1.2 → libsast-3.1.4}/libsast/__main__.py +0 -0
- {libsast-3.1.2 → libsast-3.1.4}/libsast/common.py +0 -0
- {libsast-3.1.2 → libsast-3.1.4}/libsast/core_matcher/__init__.py +0 -0
- {libsast-3.1.2 → libsast-3.1.4}/libsast/core_matcher/helpers.py +0 -0
- {libsast-3.1.2 → libsast-3.1.4}/libsast/core_matcher/matchers.py +0 -0
- {libsast-3.1.2 → libsast-3.1.4}/libsast/core_sgrep/__init__.py +0 -0
- {libsast-3.1.2 → libsast-3.1.4}/libsast/core_sgrep/helpers.py +0 -0
- {libsast-3.1.2 → libsast-3.1.4}/libsast/core_sgrep/semantic_sgrep.py +0 -0
- {libsast-3.1.2 → libsast-3.1.4}/libsast/exceptions.py +0 -0
- {libsast-3.1.2 → libsast-3.1.4}/libsast/standards/cwe.yaml +0 -0
- {libsast-3.1.2 → libsast-3.1.4}/libsast/standards/owasp_masvs.yaml +0 -0
- {libsast-3.1.2 → libsast-3.1.4}/libsast/standards/owasp_mobile_top10_2016.yaml +0 -0
- {libsast-3.1.2 → libsast-3.1.4}/libsast/standards/owasp_mobile_top10_2024.yaml +0 -0
- {libsast-3.1.2 → libsast-3.1.4}/libsast/standards/owasp_web_top10_2017.yaml +0 -0
- {libsast-3.1.2 → libsast-3.1.4}/libsast/standards.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: libsast
|
|
3
|
-
Version: 3.1.
|
|
3
|
+
Version: 3.1.4
|
|
4
4
|
Summary: A generic SAST library built on top of semgrep and regex
|
|
5
5
|
Home-page: https://github.com/ajinabraham/libsast
|
|
6
6
|
License: LGPL-3.0-or-later
|
|
@@ -23,7 +23,6 @@ Classifier: Topic :: Software Development :: Quality Assurance
|
|
|
23
23
|
Requires-Dist: billiard (>=4.2.1,<5.0.0)
|
|
24
24
|
Requires-Dist: pyyaml (>=6.0)
|
|
25
25
|
Requires-Dist: requests
|
|
26
|
-
Requires-Dist: semgrep (==1.86.0) ; sys_platform != "win32"
|
|
27
26
|
Project-URL: Bug Tracker, https://github.com/ajinabraham/libsast/issues
|
|
28
27
|
Project-URL: Documentation, https://github.com/ajinabraham/libsast/blob/master/README.md
|
|
29
28
|
Project-URL: Repository, https://github.com/ajinabraham/libsast
|
|
@@ -48,7 +47,10 @@ Made with .year)
|
|
|
12
12
|
__title__ = 'libsast'
|
|
13
13
|
__authors__ = 'Ajin Abraham'
|
|
14
14
|
__copyright__ = f'Copyright {year} Ajin Abraham, opensecurity.in'
|
|
15
|
-
__version__ = '3.1.
|
|
15
|
+
__version__ = '3.1.4'
|
|
16
16
|
__version_info__ = tuple(int(i) for i in __version__.split('.'))
|
|
17
17
|
__all__ = [
|
|
18
18
|
'Scanner',
|
|
@@ -41,9 +41,9 @@ class ChoiceMatcher:
|
|
|
41
41
|
|
|
42
42
|
def read_file_contents(self, paths: list) -> list:
|
|
43
43
|
"""Load file(s) content."""
|
|
44
|
-
if not
|
|
45
|
-
return
|
|
46
|
-
|
|
44
|
+
if not paths:
|
|
45
|
+
return []
|
|
46
|
+
|
|
47
47
|
choice_args = []
|
|
48
48
|
for rule in self.scan_rules:
|
|
49
49
|
scan_paths = paths
|
|
@@ -64,8 +64,14 @@ class ChoiceMatcher:
|
|
|
64
64
|
futures.append(future)
|
|
65
65
|
return [future.result() for future in futures]
|
|
66
66
|
|
|
67
|
-
def regex_scan(self, file_contents) ->
|
|
67
|
+
def regex_scan(self, file_contents: list, rules=None) -> dict:
|
|
68
68
|
"""Process regex matches on the file contents."""
|
|
69
|
+
if rules:
|
|
70
|
+
self.scan_rules = get_rules(rules)
|
|
71
|
+
if not (self.scan_rules and file_contents):
|
|
72
|
+
return {}
|
|
73
|
+
self.validate_rules()
|
|
74
|
+
|
|
69
75
|
if self.queue:
|
|
70
76
|
# Use billiard's pool for regex (support queues)
|
|
71
77
|
from billiard import Pool
|
|
@@ -41,9 +41,8 @@ class PatternMatcher:
|
|
|
41
41
|
|
|
42
42
|
def read_file_contents(self, paths: list) -> list:
|
|
43
43
|
"""Load file(s) content."""
|
|
44
|
-
if not
|
|
45
|
-
return
|
|
46
|
-
self.validate_rules()
|
|
44
|
+
if not paths:
|
|
45
|
+
return []
|
|
47
46
|
|
|
48
47
|
# Filter files by extension and size, prepare list for processing
|
|
49
48
|
files_to_scan = {
|
|
@@ -61,8 +60,14 @@ class PatternMatcher:
|
|
|
61
60
|
self._read_file_content, files_to_scan))
|
|
62
61
|
return file_contents
|
|
63
62
|
|
|
64
|
-
def regex_scan(self, file_contents: list) -> dict:
|
|
63
|
+
def regex_scan(self, file_contents: list, rules=None) -> dict:
|
|
65
64
|
"""Scan file(s) content."""
|
|
65
|
+
if rules:
|
|
66
|
+
self.scan_rules = get_rules(rules)
|
|
67
|
+
if not (self.scan_rules and file_contents):
|
|
68
|
+
return {}
|
|
69
|
+
self.validate_rules()
|
|
70
|
+
|
|
66
71
|
if self.queue:
|
|
67
72
|
# Use billiard's pool for CPU-bound regex (support queues)
|
|
68
73
|
from billiard import Pool
|
|
@@ -54,7 +54,7 @@ class Scanner:
|
|
|
54
54
|
def scan(self) -> dict:
|
|
55
55
|
"""Start Scan."""
|
|
56
56
|
results = {}
|
|
57
|
-
valid_paths = self.get_scan_files(
|
|
57
|
+
valid_paths = self.get_scan_files()
|
|
58
58
|
|
|
59
59
|
if not valid_paths:
|
|
60
60
|
return {}
|
|
@@ -68,13 +68,13 @@ class Scanner:
|
|
|
68
68
|
|
|
69
69
|
return results
|
|
70
70
|
|
|
71
|
-
def get_scan_files(self
|
|
71
|
+
def get_scan_files(self):
|
|
72
72
|
"""Get files valid for scanning."""
|
|
73
|
-
if not isinstance(paths, list):
|
|
73
|
+
if not isinstance(self.paths, list):
|
|
74
74
|
raise InvalidPathError('Path should be a list')
|
|
75
75
|
|
|
76
76
|
all_files = set()
|
|
77
|
-
for path in paths:
|
|
77
|
+
for path in self.paths:
|
|
78
78
|
pobj = Path(path)
|
|
79
79
|
if pobj.is_dir():
|
|
80
80
|
all_files.update({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "libsast"
|
|
3
|
-
version = "3.1.
|
|
3
|
+
version = "3.1.4"
|
|
4
4
|
description = "A generic SAST library built on top of semgrep and regex"
|
|
5
5
|
keywords = ["libsast", "SAST", "Python SAST", "SAST API", "Regex SAST", "Pattern Matcher"]
|
|
6
6
|
authors = ["Ajin Abraham <ajin@opensecurity.in>"]
|
|
@@ -26,9 +26,14 @@ libsast = "libsast.__main__:main"
|
|
|
26
26
|
python = "^3.8"
|
|
27
27
|
requests = "*"
|
|
28
28
|
pyyaml = ">=6.0"
|
|
29
|
-
semgrep = {version = "1.86.0", markers = "sys_platform != 'win32'"}
|
|
30
29
|
billiard = "^4.2.1"
|
|
31
30
|
|
|
31
|
+
[tool.poetry.group.semgrep]
|
|
32
|
+
optional = true
|
|
33
|
+
|
|
34
|
+
[tool.poetry.group.semgrep.dependencies]
|
|
35
|
+
semgrep = {version = "1.86.0", markers = "sys_platform != 'win32'"}
|
|
36
|
+
|
|
32
37
|
[tool.poetry.group.dev.dependencies]
|
|
33
38
|
bandit = "*"
|
|
34
39
|
pytest = "*"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|