CONTEXT
Defines a Node.js Puppeteer scraper that extracts CVE IDs, metadata, and additional resource links from the Wiz vulnerability database into structured JSON.
What this file does
Defines a Node.js Puppeteer scraper that extracts CVE IDs, metadata, and additional resource links from the Wiz vulnerability database into structured JSON.
When to use it
- Building a web scraper for a paginated, infinite-scroll CVE database
- Extracting structured vulnerability data from Wiz's search page
- Automating collection of CVE details and associated resource URLs
- Creating a reusable scraping template with concurrency and error handling
Assumes this stack
1. Project Overview
Build a robust Node.js web‑scraping tool using Puppeteer to extract CVE data from the Wiz vulnerability database. The app should:
- Navigate to the CVE search page
- Handle infinite scroll / “Load more” pagination
- Scrape CVE IDs and metadata
- Visit each CVE's detail page
- Extract "Additional resources" links
- Output structured JSON data
2. Core Requirements
- Target URL:
https://www.wiz.io/vulnerability-database/cve/search - Infinite‑scroll handling: Auto-click the “Load more” button until all entries are loaded
- Data extraction: Scrape CVE IDs, severity, score, technologies, component, publish date
- Detail‑page navigation: Click into each CVE detail page for extra info
- Additional resources: Extract titles + URLs from each CVE’s "Additional resources" section
- JSON output: Return a structured JSON, e.g.:
{
"scrapeDate": "2025-07-07T00:32:00.000Z",
"totalCVEs": 140558,
"cveData": [
{
"cveId": "CVE-2025-6926",
"severity": "HIGH",
"score": 8.8,
"technologies": ["Linux","Debian"],
"component": "mediawiki",
"publishedDate": "Jul 03, 2025",
"detailUrl": "...",
"additionalResources": [
{ "title": "NVD CVE", "url": "..." },
{ "title": "Wordfence Analysis", "url": "..." }
]
}
]
}
3. Technical Implementation
3.1. Project Setup
mkdir wiz-cve-scraper
cd wiz-cve-scraper
npm init -y
npm install puppeteer fs-extra
3.2. Dependencies
- puppeteer: Browser automation + scraping
- fs‑extra: JSON read/write utilities
- Headless browser setup with viewport config and user‑agent
3.3. Core Code Structure (e.g. app.js)
const puppeteer = require('puppeteer');
const fs = require('fs-extra');
class WizCVEScraper {
constructor(){ this.browser = null; this.page = null; this.cveData = []; }
async initialize(){
this.browser = await puppeteer.launch({
headless: false,
args: ['--no-sandbox','--disable-setuid-sandbox'],
defaultViewport: { width: 1920, height: 1080 }
});
this.page = await this.browser.newPage();
await this.page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64)');
}
async scrapeAllCVEs(){
await this.page.goto('https://www.wiz.io/vulnerability-database/cve/search', {
waitUntil: 'networkidle2', timeout: 30000
});
await this.loadAllCVEs();
const cveList = await this.extractCVEList();
for(const c of cveList){
const details = await this.processCVEDetails(c);
this.cveData.push(details);
}
return this.cveData;
}
async loadAllCVEs(){
// Repeatedly click “Load more” until no more to load
}
async extractCVEList(){
// Scrape table rows → CVE IDs, scores, metadata + URLs
}
async processCVEDetails(cve){
// Open CVE detail page, extract links from “Additional resources”
}
}
4. Handle Infinite Scroll
- Detect “Load more” button via CSS selectors
- Click until disabled or hidden
- Wait for new entries to render (e.g.
networkidle, DOM changes) - Retry logic + timeouts
5. Data Extraction Strategy
5.1. CVE Table
- Use
page.$$eval()to collect rows - Extract fields: ID, severity, score, technologies, component, publish date, URL
5.2. CVE Detail Pages
- Visit each CVE URL
- Query "Additional resources" section
- Return list of link titles + URLs
6. JSON Output Structure
Top-level JSON should include:
scrapeDate(ISO timestamp)totalCVEs(count)cveData(array of detailed objects, each with fields as above)
7. Error Handling & Robustness
- Use
try/catchfor all navigation & scraping steps - Retry on network failures or timeouts
- Respect rate limiting: use delays (e.g.
await page.waitForTimeout(...)) - Gracefully log errors; skip problematic entries
8. Performance Optimizations
- Fetch detail pages concurrently (with a concurrency cap)
- Use a pool of browser pages
- Cache processed CVEs to avoid duplicates
- Optimize DOM queries (minimal selectors)
- Show progress (e.g. via console logs or a progress bar)
9. Configuration / Customization
- Accept config options: max concurrency, delay between loads, filters (date range, severity)
- Support resume functionality via checkpoints
- Allow output filename customization
10. Testing & Validation
- Unit tests for helper functions (e.g. extractors)
- Validate output JSON schema
- Include sample run results
- Monitor performance (time, memory)
11. Bonus Features
- API Endpoint: Use Express.js to trigger scraping
- Scheduler: Cron-based triggering
- Analytics: Generate stats & trends
✅ Deliverables Checklist
- Fully functional Node.js app as per specs
-
README.mdwith installation, usage & troubleshooting -
package.jsonwith scripts (e.g.start,test) - Example JSON output files
- Logging and robust error handling
- (Optional) Bonus features if implemented
References
- Wiz CVE search:
https://www.wiz.io/vulnerability-database/cve/search - Puppeteer infinite scroll patterns, etc.
- JSON parsing & storage guides
What's inside
11 sections covering project overview, requirements, code structure, infinite scroll, data extraction, JSON output, error handling, performance, config, testing, and bonus features
Change this for your project
- Replace
https://www.wiz.io/vulnerability-database/cve/searchwith your target URL - Replace CSS selectors for "Load more" button and table rows with your site's selectors
- Replace
mediawikiand other hardcoded technology names with your expected values
Where it goes
Keep it in your repository where the agent or team that needs it will read it.
Worth borrowing
- Concurrent detail-page fetching with a capped concurrency pool
- Checkpoint-based resume logic to avoid re-scraping already processed CVEs
Related Documents
GoFast CLI (`gof`) Context
Documents the architecture, commands, test strategy, and marker system for a Go code generation CLI that scaffolds full-stack applications.
Context
Teaches how to use Go's context package to cancel long-running processes when a request is cancelled, with TDD.
context
Teaches Go's context package for cancellation, timeout, value passing, and goroutine lifecycle management with runnable examples.