Skip to content

Modify when exceeding the max. url length #144

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

Merged
merged 1 commit into from
May 25, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ py-tlsh
pytz
XlsxWriter
PyYAML
fosslight_util>=2.1.10
fosslight_util>=2.1.13
dependency-check
17 changes: 8 additions & 9 deletions src/fosslight_binary/_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ def set_oss_items(self, new_oss_list, exclude=False, exclude_msg=""):
# Append New input OSS
self.oss_items.extend(new_oss_list)

def get_vulnerability_items(self):
nvd_url = [urllib.parse.unquote(vul_item.nvd_url) for vul_item in self.vulnerability_items]
return ", ".join(nvd_url).strip()
def get_vulnerability_items(self, oss):
nvd_url = set([urllib.parse.unquote(vul_item.nvd_url) for vul_item in self.vulnerability_items])
nvd_url = ", ".join(nvd_url).strip()

if nvd_url and len(nvd_url) > MAX_EXCEL_URL_LENGTH:
oss.comment += f"\nExceeded the maximum vulnerability URL length of {MAX_EXCEL_URL_LENGTH} characters."
return nvd_url

def get_print_binary_only(self):
return (self.source_name_or_path + "\t" + self.checksum + "\t" + self.tlsh)
Expand All @@ -62,12 +66,7 @@ def get_print_array(self):
for oss in self.oss_items:
lic = ",".join(oss.license)
exclude = EXCLUDE_TRUE_VALUE if (self.exclude or oss.exclude) else ""
nvd_url = self.get_vulnerability_items()
if nvd_url and len(nvd_url) > MAX_EXCEL_URL_LENGTH:
logger.info(f"self.source_name_or_path: {self.source_name_or_path}")
logger.info(f"oss name: {oss.name}")
logger.info(f"length_url:{len(nvd_url)}, nvd_url: {nvd_url}")
nvd_url = nvd_url[:242] + '...(truncated)'
nvd_url = self.get_vulnerability_items(oss)
items.append([self.source_name_or_path, oss.name, oss.version,
lic, oss.download_location, oss.homepage,
oss.copyright, exclude, oss.comment,
Expand Down