You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/home/ggasparb/workspace/github/content-test-filtering/content_test_filtering.py", line 45, in <module>
diff_structure = diff_analysis.analyse_file(file_record)
File "/home/ggasparb/workspace/github/content-test-filtering/ctf/diff_analysis.py", line 54, in analyse_file
return file_analyzer.process_analysis()
File "/home/ggasparb/workspace/github/content-test-filtering/ctf/analysis/BashAnalysis.py", line 123, in process_analysis
self.analyse_bash()
File "/home/ggasparb/workspace/github/content-test-filtering/ctf/analysis/BashAnalysis.py", line 91, in analyse_bash
token_before = tokens_before.get_token()
File "/usr/lib64/python3.9/shlex.py", line 109, in get_token
raw = self.read_token()
File "/usr/lib64/python3.9/shlex.py", line 191, in read_token
raise ValueError("No closing quotation")
ValueError: No closing quotation
I don't know if we can circumvent this here or if this is a legitimate problem with the content. Either way we could catch the ValueError exception so the it doesn't crash.
The text was updated successfully, but these errors were encountered:
token_before:
"s/[\"
token_after:"s/[\"
The problem is the backslash that escapes the double quotes. The bash content that is being parsed is this one:
https://github.com/ComplianceAsCode/content/blob/fc6bdac51301debae58900bac597183cd7039620/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_permissions/bash/shared.sh#L39
CLEANED_PATHS=$(sed -e "s/[\"')]//g; /\\/etc.*\.conf/d; /\\/dev\\//d" <<< "${FILTERED_PATHS}")
CTF identifies partially the token probably because this crazy sed command construction.
Reproducer:
python3 content_test_filtering.py pr --rule --output json 7715
I don't know if we can circumvent this here or if this is a legitimate problem with the content. Either way we could catch the ValueError exception so the it doesn't crash.
The text was updated successfully, but these errors were encountered: