{ "name": "Production - Daily CVE Security Digest", "nodes": [ { "parameters": {"rule": {"interval": [{"field": "cronExpression", "expression": "0 8 * * *"}]}}, "id": "14ae45a7-c57e-4d2d-99ec-cve000000001", "name": "Every Morning", "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.2, "position": [-720, 200] }, { "parameters": {"mode": "raw", "jsonOutput": "{\n \"lookback_hours\": 24,\n \"minimum_cvss\": 7,\n \"max_items\": 8,\n \"alert_webhook_url\": \"https://discord.com/api/webhooks/REPLACE_ME\"\n}", "options": {}}, "id": "14ae45a7-c57e-4d2d-99ec-cve000000002", "name": "Config", "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [-500, 200] }, { "parameters": {"jsCode": "const cfg = $('Config').first().json;\nconst end = new Date();\nconst start = new Date(end.getTime() - Number(cfg.lookback_hours || 24) * 3600000);\nreturn [{ json: { pubStartDate: start.toISOString(), pubEndDate: end.toISOString() } }];"}, "id": "14ae45a7-c57e-4d2d-99ec-cve000000003", "name": "Build UTC Window", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [-280, 200] }, { "parameters": {"url": "https://services.nvd.nist.gov/rest/json/cves/2.0", "sendQuery": true, "queryParameters": {"parameters": [{"name": "pubStartDate", "value": "={{ $json.pubStartDate }}"}, {"name": "pubEndDate", "value": "={{ $json.pubEndDate }}"}]}, "options": {"timeout": 30000}}, "id": "14ae45a7-c57e-4d2d-99ec-cve000000004", "name": "Fetch NVD CVEs", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.3, "position": [-40, 200], "retryOnFail": true, "maxTries": 3, "waitBetweenTries": 2000 }, { "parameters": {"jsCode": "const cfg = $('Config').first().json;\nconst rows = Array.isArray($json.vulnerabilities) ? $json.vulnerabilities : [];\nconst scoreOf = c => {\n const m = c.metrics || {};\n for (const key of ['cvssMetricV40','cvssMetricV31','cvssMetricV30','cvssMetricV2']) {\n const score = m[key]?.[0]?.cvssData?.baseScore;\n if (Number.isFinite(score)) return score;\n }\n return 0;\n};\nconst items = rows.map(v => {\n const c = v.cve || {};\n const desc = (c.descriptions || []).find(d => d.lang === 'en')?.value || 'No English description.';\n return { id: c.id, score: scoreOf(c), description: desc.replace(/\\s+/g, ' ').trim() };\n}).filter(x => x.id && x.score >= Number(cfg.minimum_cvss || 7)).sort((a,b) => b.score - a.score);\nconst shown = items.slice(0, Number(cfg.max_items || 8));\nconst lines = shown.map(x => `**${x.id}** · CVSS ${x.score}\\n${x.description.slice(0, 220)}\\nhttps://nvd.nist.gov/vuln/detail/${x.id}`);\nconst more = items.length > shown.length ? `\\n\\n…and ${items.length - shown.length} more.` : '';\nreturn [{ json: { should_alert: items.length > 0, count: items.length, content: `## Daily CVE digest\\n${lines.join('\\n\\n')}${more}`.slice(0, 1950) } }];"}, "id": "14ae45a7-c57e-4d2d-99ec-cve000000005", "name": "Filter and Format", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [200, 200] }, { "parameters": {"conditions": {"options": {"caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 2}, "conditions": [{"id": "cve-condition", "leftValue": "={{ $json.should_alert }}", "rightValue": "", "operator": {"type": "boolean", "operation": "true", "singleValue": true}}], "combinator": "and"}, "options": {}}, "id": "14ae45a7-c57e-4d2d-99ec-cve000000006", "name": "Any High Severity CVEs?", "type": "n8n-nodes-base.if", "typeVersion": 2.2, "position": [440, 200] }, { "parameters": {"method": "POST", "url": "={{ $('Config').first().json.alert_webhook_url }}", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ { content: $json.content } }}", "options": {"timeout": 15000}}, "id": "14ae45a7-c57e-4d2d-99ec-cve000000007", "name": "Send Digest", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.3, "position": [680, 100], "retryOnFail": true, "maxTries": 3, "waitBetweenTries": 2000 } ], "connections": { "Every Morning": {"main": [[{"node": "Config", "type": "main", "index": 0}]]}, "Config": {"main": [[{"node": "Build UTC Window", "type": "main", "index": 0}]]}, "Build UTC Window": {"main": [[{"node": "Fetch NVD CVEs", "type": "main", "index": 0}]]}, "Fetch NVD CVEs": {"main": [[{"node": "Filter and Format", "type": "main", "index": 0}]]}, "Filter and Format": {"main": [[{"node": "Any High Severity CVEs?", "type": "main", "index": 0}]]}, "Any High Severity CVEs?": {"main": [[{"node": "Send Digest", "type": "main", "index": 0}], []]} }, "pinData": {}, "settings": {"executionOrder": "v1", "timezone": "UTC"} }