Skip to content

CWE Go LibraryCommon Weakness Enumeration for Go

A comprehensive Go library for working with CWE data, featuring API clients, rate limiting, and tree operations

CWE Go Library

Quick Start

Install the library:

bash
go get github.com/scagogogo/cwe

Basic usage:

go
package main

import (
    "fmt"
    "log"
    
    "github.com/scagogogo/cwe"
)

func main() {
    // Create a new API client
    client := cwe.NewAPIClient()
    
    // Get CWE version information
    version, err := client.GetVersion()
    if err != nil {
        log.Fatalf("Failed to get CWE version: %v", err)
    }
    
    fmt.Printf("Current CWE version: %s, Release date: %s\n", 
        version.Version, version.ReleaseDate)
    
    // Fetch a specific weakness
    weakness, err := client.GetWeakness("79")
    if err != nil {
        log.Fatalf("Failed to get weakness: %v", err)
    }
    
    fmt.Printf("CWE-79: %s\n", weakness.Name)
}

Features

🎯 Core Components

  • API Client: Complete REST API client for CWE data
  • Data Fetcher: High-level interface for fetching and converting CWE data
  • Registry: Collection management for CWE entries
  • HTTP Client: Rate-limited HTTP client with retry logic
  • Tree Operations: Build and traverse CWE hierarchies

📈 Advanced Features

  • Rate Limiting: Configurable request rate limiting
  • Auto Retry: Automatic retry on failed requests
  • Concurrent Safe: Thread-safe design for concurrent usage
  • Export/Import: JSON and XML serialization support
  • Search: Flexible search and filtering capabilities

Documentation

License

This project is licensed under the MIT License.

Released under the MIT License.