{
  "nodes": [
    {
      "parameters": {},
      "id": "47bb3af2-bc3c-4153-85f8-c44330d1b798",
      "name": "Execute Workflow Trigger",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1,
      "position": [
        -624,
        48
      ]
    },
    {
      "parameters": {
        "jsCode": "const out = $input.first();\nconst str = out.json.query.cve;\nconst regex = /\\bCVE-\\d{4}-\\d{4,7}\\b/i;\nconst match = str.match(regex);\n\nif (match) {\n  return {\"cve\":match[0]};\n} else {\n  return {\"cve\":\"No CVE found\"};\n}"
      },
      "id": "c2b6d457-03eb-492c-a879-95ed5751711d",
      "name": "Extract CVE ID",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -336,
        48
      ]
    },
    {
      "parameters": {
        "url": "=https://vulnerability.circl.lu/api/cve/{{ $json.cve }}",
        "options": {}
      },
      "id": "087d2acd-b728-497a-b668-59eae3669110",
      "name": "Vulnerability Lookup",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        112,
        -112
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 1
          },
          "conditions": [
            {
              "id": "a8e26dc5-a171-4b3e-b343-261b7e96a72a",
              "leftValue": "={{ $json.cve }}",
              "rightValue": "=No CVE found",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "9043153a-70c7-4223-9595-abaa3022aa80",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        -144,
        48
      ]
    },
    {
      "parameters": {
        "html": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <title>Report</title>\n    <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/bulma@1.0.1/css/bulma.min.css\">\n    <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/bulma-prefers-dark@0.1.0/css/bulma-prefers-dark.min.css\">\n    <style>\n      @media (prefers-color-scheme: dark) {\n        html, body {\n          background-color: hsl(0, 0%, 21%);\n        }\n      }\n    </style>\n  </head>\n  <body>\n    <section class=\"hero is-fullheight\">\n        <div class=\"hero-body\">\n            <div class=\"container is-fluid\">\n              <p class=\"title is-2 is-spaced\">\n                Report\n              </p> \n              <p>\n                No CVE Found\n              </p>\n            </div>\n        </div>\n        <div class=\"hero-foot\">\n            <footer class=\"footer\">\n                <div class=\"content has-text-centered\">\n                  <p>\n                    ArkCybr SOC\n                  </p>\n                </div>\n            </footer>\n        </div>\n    </section>\n  </body>\n</html>"
      },
      "id": "fbb2109c-fea9-483d-b520-14f9f3374d13",
      "name": "HTML No CVE Found",
      "type": "n8n-nodes-base.html",
      "typeVersion": 1.2,
      "position": [
        112,
        176
      ]
    },
    {
      "parameters": {
        "html": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <title>Report</title>\n    <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/bulma@1.0.1/css/bulma.min.css\">\n    <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/bulma-prefers-dark@0.1.0/css/bulma-prefers-dark.min.css\">\n    <style>\n      @media (prefers-color-scheme: dark) {\n        html, body {\n          background-color: hsl(0, 0%, 21%);\n        }\n      }\n    </style>\n  </head>\n  <body>\n    <section class=\"hero is-fullheight\">\n        <div class=\"hero-body\">\n            <div class=\"container is-fluid\">\n              <p class=\"title is-2 is-spaced\">\n                Report - Info on {{ $json.cveId }}\n              </p> \n              <p>\n                <strong>CVE ID</strong> {{ $json.cveId }}<br>\n                <strong>Title</strong> {{ $json.title }}<br>\n                <strong>State</strong> {{ $json.state }}<br>\n                <strong>Date published</strong> {{ $json.datePublished }}<br>\n                <strong>Date updated</strong> {{ $json.dateUpdated }}<br>\n                <strong>Description</strong> {{ $json.description }}<br>\n                <strong>CVSS v4.0 base score</strong> {{ $json.cvssV40Score }}<br>\n                <strong>CVSS v3.1 base score</strong> {{ $json.cvssV31Score }}<br>\n                <strong>CVSS v3.1 severity</strong> {{ $json.cvssV31Severity }}<br>\n                <strong>CVSS v3.1 vector</strong> {{ $json.cvssV31Vector }}<br>\n                <strong>More info</strong> <a href=\"https://nvd.nist.gov/vuln/detail/{{ $json.cveId }}\" target=\"_blank\">https://nvd.nist.gov/vuln/detail/{{ $json.cveId }}</a><br>\n                <strong>Data based on</strong> <a href=\"https://vulnerability.circl.lu/vuln/{{ $json.cveId }}\" target=\"_blank\">https://vulnerability.circl.lu/vuln/{{ $json.cveId }}</a>\n              </p>\n            </div>\n        </div>\n        <div class=\"hero-foot\">\n            <footer class=\"footer\">\n                <div class=\"content has-text-centered\">\n                  <p>\n                    ArkCybr SOC\n                  </p>\n                </div>\n            </footer>\n        </div>\n    </section>\n  </body>\n</html>"
      },
      "id": "abf6b8b5-0df0-40ca-a0eb-e760ed8befbd",
      "name": "HTML CVE found",
      "type": "n8n-nodes-base.html",
      "typeVersion": 1.2,
      "position": [
        624,
        -112
      ]
    },
    {
      "parameters": {
        "jsCode": "// Get the raw API response - handle both array and object responses\nconst raw = Array.isArray($input.first().json) \n  ? $input.first().json[0] \n  : $input.first().json;\n\nconst esc = (s) => String(s == null ? '' : s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/\"/g,'&quot;').replace(/'/g,'&#x27;');\n\n// Basic fields from cveMetadata and CNA container\nconst cveId = raw.cveMetadata?.cveId || 'Unknown';\nconst state = raw.cveMetadata?.state || 'Unknown';\nconst datePublished = raw.cveMetadata?.datePublished || 'Unknown';\nconst dateUpdated = raw.cveMetadata?.dateUpdated || 'Unknown';\nconst title = raw.containers?.cna?.title || 'No title available';\nconst description = raw.containers?.cna?.descriptions?.[0]?.value || 'No description available';\n\nlet cvssV31Score = null;\nlet cvssV31Severity = null;\nlet cvssV31Vector = null;\nlet cvssV40Score = null;\nlet cvssV40Severity = null;\nlet cvssV40Vector = null;\n\nfunction extractCvss(metrics) {\n  if (!Array.isArray(metrics)) return;\n  for (const m of metrics) {\n    if (m.cvssV3_1 && !cvssV31Score) {\n      cvssV31Score = m.cvssV3_1.baseScore;\n      cvssV31Severity = m.cvssV3_1.baseSeverity;\n      cvssV31Vector = m.cvssV3_1.vectorString;\n    }\n    if (m.cvssV4_0 && !cvssV40Score) {\n      cvssV40Score = m.cvssV4_0.baseScore;\n      cvssV40Severity = m.cvssV4_0.baseSeverity;\n      cvssV40Vector = m.cvssV4_0.vectorString;\n    }\n  }\n}\n\nif (raw.containers?.cna?.metrics) {\n  extractCvss(raw.containers.cna.metrics);\n}\n\nif (Array.isArray(raw.containers?.adp)) {\n  for (const adp of raw.containers.adp) {\n    if (adp.metrics) {\n      extractCvss(adp.metrics);\n    }\n  }\n}\n\nreturn [{\n  json: {\n    cveId: esc(cveId),\n    title: esc(title),\n    state: esc(state),\n    datePublished: esc(datePublished),\n    dateUpdated: esc(dateUpdated),\n    description: esc(description),\n    cvssV31Score: cvssV31Score ?? 'Information not found',\n    cvssV31Severity: esc(cvssV31Severity ?? 'Information not found'),\n    cvssV31Vector: esc(cvssV31Vector ?? 'Information not found'),\n    cvssV40Score: cvssV40Score ?? 'Information not found',\n    cvssV40Severity: esc(cvssV40Severity ?? 'Information not found'),\n    cvssV40Vector: esc(cvssV40Vector ?? 'Information not found')\n  }\n}];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        352,
        -112
      ],
      "id": "45b2f40c-568f-430e-86d9-3e39042803da",
      "name": "Fields Extraction"
    }
  ],
  "connections": {
    "Execute Workflow Trigger": {
      "main": [
        [
          {
            "node": "Extract CVE ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract CVE ID": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Vulnerability Lookup": {
      "main": [
        [
          {
            "node": "Fields Extraction",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Vulnerability Lookup",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTML No CVE Found",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fields Extraction": {
      "main": [
        [
          {
            "node": "HTML CVE found",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "name": "CVE Info (Hardened)"
}