aboutsummaryrefslogtreecommitdiffstats
path: root/security/vuxml/files/mitre_provider.sh
diff options
context:
space:
mode:
authorLexi Winter <ivy@FreeBSD.org>2025-12-01 03:19:41 +0000
committerLexi Winter <ivy@FreeBSD.org>2025-12-01 03:19:41 +0000
commit2e80774d0b20d167bc0a9e2b63dafbfb171c0d22 (patch)
tree25f0138e1af8902b92dacc8cce09b267447c17db /security/vuxml/files/mitre_provider.sh
parentf85f2b2d6e5b7ed869376eb4b180c3a74a5c5da9 (diff)
parent1a30da80670973368b399f2b01fe9c04b91a1273 (diff)
Merge remote-tracking branch 'freebsd/main' into lf/mainlf/main
Diffstat (limited to 'security/vuxml/files/mitre_provider.sh')
-rw-r--r--security/vuxml/files/mitre_provider.sh61
1 files changed, 61 insertions, 0 deletions
diff --git a/security/vuxml/files/mitre_provider.sh b/security/vuxml/files/mitre_provider.sh
new file mode 100644
index 000000000000..c2b1f8ffa73e
--- /dev/null
+++ b/security/vuxml/files/mitre_provider.sh
@@ -0,0 +1,61 @@
+# Provider for MITRE
+# https://www.mitre.org/
+
+tmp_mitre=""
+
+init_mitre()
+{
+ tmp_mitre=$(mktemp "${TMPDIR:-/tmp}"/mitre.XXXXXXXXXX) || exit 1
+ fetch -q -o "${tmp_mitre}" https://cveawg.mitre.org/api/cve/"${CVE_ID}"
+}
+
+cleanup_mitre()
+{
+ rm "${tmp_mitre}" 2>/dev/null
+}
+
+get_cvename_from_mitre()
+{
+ cvename="${CVE_ID}"
+ echo "${cvename}"
+}
+
+get_cveurl_from_mitre() {
+ echo https://cveawg.mitre.org/api/cve/"${CVE_ID}"
+}
+
+get_details_from_mitre() {
+ jq -r '.containers?.cna?.descriptions[0]?.value' "${tmp_mitre}" | fmt -p -s
+}
+
+get_discovery_date_from_mitre() {
+ jq -r '.cveMetadata?.datePublished?' "${tmp_mitre}" | cut -f1 -dT
+}
+
+get_entry_date_from_mitre() {
+ echo "${entry_date}"
+}
+
+get_product_name_from_mitre() {
+ jq -r '.containers?.cna?.affected[]?.product' "${tmp_mitre}"
+}
+
+get_product_range_from_mitre() {
+ jq -r '.containers?.cna?.affected[]??.versions[0]?.lessThan' "${tmp_mitre}"
+}
+
+get_package_name_from_mitre() {
+ jq -r '.containers?.cna?.affected[0]?.product' "${tmp_mitre}"
+}
+
+get_references_from_mitre() {
+ jq -r '.containers?.cna?.references[0]?.url' "${tmp_mitre}" | fmt -p -s
+}
+
+get_source_from_mitre() {
+ jq -r '.containers?.cna?.references[0]?.url' "${tmp_mitre}"
+}
+
+get_topic_from_mitre() {
+ jq -r ".containers?.cna?.problemTypes[0]?.descriptions[0]?.description" "${tmp_mitre}"
+}