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

Fix pattern_matcher.py logic problem #45

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions libsast/core_matcher/pattern_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,18 @@ def pattern_matcher(self, file_path):
results = []
try:
data = file_path.read_text('utf-8', 'ignore')
if file_path.suffix.lower() in ('.html', '.xml'):
tmp_data = strip_comments2(data)
else:
tmp_data = strip_comments(data)
for rule in self.scan_rules:
case = rule.get('input_case')
if case == 'lower':
tmp_data = data.lower()
fmt_data = tmp_data.lower()
elif case == 'upper':
tmp_data = data.upper()
fmt_data = tmp_data.upper()
else:
tmp_data = data
if file_path.suffix.lower() in ('.html', '.xml'):
fmt_data = strip_comments2(tmp_data)
else:
fmt_data = strip_comments(tmp_data)
fmt_data = tmp_data
matches = self.matcher._find_match(
rule['type'],
fmt_data,
Expand Down