/** * Agentic QE v3 - OSV API Client * Client for querying Open Source Vulnerabilities (OSV) database * * OSV provides vulnerability information for npm, PyPI, Go, Maven, and more. * API Documentation: https://google.github.io/osv.dev/api/ */ /** * OSV query request */ export interface OSVQueryRequest { /** Package name */ package?: { name: string; ecosystem: OSVEcosystem; version?: string; }; /** Git commit hash */ commit?: string; /** Package lock file version (for version ranges) */ version?: string; } /** * Supported ecosystems */ export type OSVEcosystem = 'npm' | 'PyPI' | 'Go' | 'Maven' | 'crates.io' | 'NuGet' | 'Packagist' | 'RubyGems' | 'Hex' | 'Pub'; /** * OSV vulnerability record */ export interface OSVVulnerability { id: string; summary: string; details?: string; aliases?: string[]; modified: string; published?: string; withdrawn?: string; severity?: OSVSeverity[]; affected: OSVAffected[]; references?: OSVReference[]; database_specific?: Record; } /** * OSV severity rating */ export interface OSVSeverity { type: 'CVSS_V2' | 'CVSS_V3'; score: string; } /** * OSV affected package information */ export interface OSVAffected { package: { name: string; ecosystem: string; purl?: string; }; ranges?: OSVRange[]; versions?: string[]; ecosystem_specific?: Record; database_specific?: Record; } /** * OSV version range */ export interface OSVRange { type: 'SEMVER' | 'ECOSYSTEM' | 'GIT'; repo?: string; events: Array<{ introduced?: string; fixed?: string; last_affected?: string; limit?: string; }>; } /** * OSV reference link */ export interface OSVReference { type: 'ADVISORY' | 'ARTICLE' | 'DETECTION' | 'DISCUSSION' | 'REPORT' | 'FIX' | 'GIT' | 'PACKAGE' | 'EVIDENCE' | 'WEB'; url: string; } /** * OSV query response */ export interface OSVQueryResponse { vulns: OSVVulnerability[]; } /** * OSV batch query request */ export interface OSVBatchQueryRequest { queries: OSVQueryRequest[]; } /** * OSV batch query response */ export interface OSVBatchQueryResponse { results: Array<{ vulns?: OSVVulnerability[]; }>; } /** * Parsed vulnerability for easier consumption */ export interface ParsedVulnerability { id: string; cveIds: string[]; summary: string; details: string; severity: 'critical' | 'high' | 'medium' | 'low' | 'unknown'; cvssScore: number | null; affectedPackage: string; affectedVersions: string[]; fixedVersions: string[]; publishedDate: Date | null; references: string[]; } /** * OSV API Client Configuration */ export interface OSVClientConfig { /** API base URL (default: https://api.osv.dev) */ baseUrl?: string; /** Request timeout in ms (default: 30000) */ timeout?: number; /** Enable response caching (default: true) */ enableCache?: boolean; /** Cache TTL in ms (default: 1 hour) */ cacheTtl?: number; } /** * OSV API Client * Queries the Open Source Vulnerabilities database for dependency vulnerabilities */ export declare class OSVClient { private readonly config; private readonly http; private readonly cache; constructor(config?: OSVClientConfig); /** * Query OSV for vulnerabilities affecting a package */ queryPackage(packageName: string, ecosystem: OSVEcosystem, version?: string): Promise; /** * Batch query multiple packages */ queryBatch(packages: Array<{ name: string; ecosystem: OSVEcosystem; version?: string; }>): Promise>; /** * Query vulnerabilities by CVE ID */ queryByCVE(cveId: string): Promise; /** * Parse npm package.json dependencies for vulnerabilities */ scanNpmDependencies(dependencies: Record): Promise; /** * Scan a Python requirements.txt file content */ scanPythonRequirements(requirements: string): Promise; /** * Parse vulnerabilities into a more usable format */ private parseVulnerabilities; /** * Extract CVSS score from severity array */ private extractCVSSScore; /** * Convert CVSS score to severity level */ private scoreSeverity; /** * Extract fixed versions from affected ranges */ private extractFixedVersions; /** * Clean version string (remove ^ ~ etc.) */ private cleanVersion; /** * Clear the cache */ clearCache(): void; } //# sourceMappingURL=osv-client.d.ts.map