maintain-database command manages the Hedis fingerprint database, including React Native baseline generation, package processing across multiple RN versions, and security advisory synchronization.
Usage
Flags
Database Operations
Create or update React Native version baselines. Generates fingerprints for empty React Native applications to filter out framework functions during analysis.Scans
pipeline/react-natives/ directory for rn069, rn070, etc. folders and creates baseline entries in the baselines_v3 collection.Process packages and generate fingerprints across all React Native versions. This is the main fingerprinting pipeline that:
- Installs packages in each RN environment
- Compiles with version-specific Hermes compilers
- Generates function fingerprints
- Stores hashes in the database
- Supports resume capability via
pipeline_progress.json
Update security advisories for packages listed in
react-native-directory-packages.json.Queries GitHub Security Advisory API for known vulnerabilities affecting React Native packages.Download all GitHub Security Advisories and create package entries in the database.This is a comprehensive sync that fetches the entire GitHub Security Advisory database for npm ecosystem.
Configuration Flags
Enable verbose output for detailed logging during database operations.
Change the database collection used for package processing. When enabled, uses
security-advisories-packages.json instead of react-native-directory-packages.json and writes to the hashes_ghsa collection.Examples
Generate React Native Baselines
Create baseline fingerprints for all React Native versions:- Scans
pipeline/react-natives/forrn069throughrn079directories - For each version without an existing baseline:
- Compiles an empty React Native app
- Extracts function fingerprints
- Stores in
baselines_v3collection with version and Hermes bytecode version
Process Packages Pipeline
Run the full package fingerprinting pipeline:- Reads package list from
react-native-directory-packages.json - Loads progress from
pipeline_progress.json(if exists) - Processes each pending RN version in parallel (max 4 concurrent)
- For each package in each RN version:
npm install <package>- Metro bundle
- Hermes compile
- Disassemble and hash
- Store in database
- Clean up node_modules
- Saves progress after each RN version completes
Process Vulnerable Packages Only
Use the--change-collection flag to process only vulnerable packages:
security-advisories-packages.json and stores hashes in the hashes_ghsa collection.
Update Security Advisories
Sync GitHub Security Advisories for React Native packages:- Reads package names from
react-native-directory-packages.json - Queries GitHub Security Advisory GraphQL API
- Stores advisories in the database with:
- Advisory ID (GHSA-xxxx-xxxx-xxxx)
- Severity (LOW, MODERATE, HIGH, CRITICAL)
- Affected versions
- Patched versions
- Published and updated dates
Download All GitHub Advisories
Fetch the complete GitHub Security Advisory database:Combined Operations
Run multiple operations in sequence:- Generate baselines
- Update security advisories
- Process packages
Database Collections
baselines_v3
Stores React Native framework function fingerprints:hashes / hashes_ghsa
Stores package function fingerprints:packages
Stores package metadata and vulnerabilities:Pipeline Resume Capability
The--packages pipeline creates pipeline_progress.json to track progress:
Environment Variables
MongoDB connection URI for database access.
Database name to use. Defaults to
hedis.Platform-specific Hermes compiler binary:
osx-binfor macOSlinux64-binfor Linux
GitHub Personal Access Token for Security Advisory API queries. Requires
security_events scope.Directory Structure Requirements
The pipeline expects this directory layout:Performance Tips
Parallel RN Version Processing
The pipeline processes up to 4 React Native versions in parallel using a semaphore. Adjust concurrency inmaintainDatabase.go:188:
Database Batch Writes
Hashes are written in batches of 100 to improve performance. Larger batches reduce database round trips but increase memory usage.Package Filtering
To process a subset of packages, edit the JSON package list file before running--packages.
Common Issues
”Failed to get working directory”
Ensure you run the command fromgo/hermes-decompiler/ directory:
“Cannot parse version”
React Native directory names must follow the formatrn069, rn070, etc.