Skip to content

Commit d2497ca

Browse files
author
Prabhu Subramanian
committed
More alias
1 parent 15410f1 commit d2497ca

File tree

5 files changed

+35
-5
lines changed

5 files changed

+35
-5
lines changed

depscan/cli.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,13 @@ def main():
254254
".json", "-risk.{}.json".format(project_type)
255255
)
256256
LOG.info("=" * 80)
257-
bom_file = os.path.join(reports_dir, "bom-" + project_type + ".json")
258-
creation_status = create_bom(project_type, bom_file, src_dir)
257+
creation_status = False
258+
if args.bom and os.path.exists(args.bom):
259+
bom_file = args.bom
260+
creation_status = True
261+
else:
262+
bom_file = os.path.join(reports_dir, "bom-" + project_type + ".json")
263+
creation_status = create_bom(project_type, bom_file, src_dir)
259264
if not creation_status:
260265
LOG.debug("Bom file {} was not created successfully".format(bom_file))
261266
continue

depscan/lib/config.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
# CPE Vendor aliases
1414
vendor_alias = {
15+
"org.apache.tomcat.embed": "apache",
1516
"org.apache.tomcat": "apache_tomcat",
1617
"org.apache.commons.io": "commons-io",
1718
"org.apache.logging.log4j": "log4j",
@@ -41,6 +42,7 @@
4142
"ca.uhn.hapi.fhir": "fhir",
4243
"tensorflow": "google",
4344
"ansible": "redhat",
45+
"io.springfox": "smartbear",
4446
}
4547

4648
# Package aliases
@@ -53,7 +55,9 @@
5355
"tomcat_native": "tomcat",
5456
"tomcat_connectors": "tomcat",
5557
"tomcat_jk_connector": "tomcat",
58+
"tomcat-embed-core": "tomcat",
5659
"spring-security-core": "spring_security",
60+
"spring-security-crypto": "spring_security",
5761
"asciidoctorj": "asciidoctor",
5862
"postgresql": "postgresql_jdbc_driver",
5963
"itextpdf": "itext",
@@ -98,6 +102,11 @@
98102
"hawkbit-boot-starter": "hawkbit",
99103
"software_development_kit": "splunk-sdk",
100104
"jira_software_data_center": "jira",
105+
"springfox-swagger2": "swagger_ui",
106+
"spring-web": "spring_framework",
107+
"springfox-swagger-ui": "swagger_ui",
108+
"hibernate-core": "hibernate_orm",
109+
"json-smart": "json-smart-v2"
101110
}
102111

103112
# Default ignore list

depscan/lib/normalize.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def create_pkg_variations(pkg_dict):
5050
):
5151
tmpA = vendor.split(".")
5252
# Automatically add short vendor forms
53-
if len(tmpA) > 2 and len(tmpA[1]) > 3:
53+
if len(tmpA) > 1 and len(tmpA[1]) > 3:
5454
if tmpA[1] != name:
5555
vendor_aliases.add(tmpA[1])
5656
# Add some common vendor aliases
@@ -97,7 +97,7 @@ def create_pkg_variations(pkg_dict):
9797
if name.endswith(suffix):
9898
name_aliases.add(name.replace(suffix, ""))
9999
for k, v in config.package_alias.items():
100-
if name.startswith(k) or k.startswith(name):
100+
if name.startswith(k) or k.startswith(name) or v.startswith(name):
101101
name_aliases.add(k)
102102
name_aliases.add(v)
103103
if len(vendor_aliases):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="appthreat-depscan",
8-
version="1.11.3",
8+
version="1.11.4",
99
author="Team AppThreat",
1010
author_email="[email protected]",
1111
description="Fully open-source security audit for project dependencies based on known vulnerabilities and advisories.",

test/test_norm.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,19 @@ def test_pkg_variations():
8686
}
8787
)
8888
assert len(pkg_list) > 1
89+
pkg_list = create_pkg_variations(
90+
{
91+
"vendor": "org.hibernate",
92+
"name": "hibernate-core",
93+
"version": "5.4.18.Final",
94+
}
95+
)
96+
assert len(pkg_list) > 1
97+
pkg_list = create_pkg_variations(
98+
{
99+
"vendor": "org.springframework.security",
100+
"name": "spring-security-crypto",
101+
"version": "5.3.3.RELEASE",
102+
}
103+
)
104+
assert len(pkg_list) > 1

0 commit comments

Comments
 (0)