GitHub
ESC

cwe.cr

A Crystal library that embeds the full MITRE CWE catalog at compile time and exposes lookup, search, relationship traversal, and JSON serialization. No network access. No sidecar data files.

Entity Count Source
Weaknesses 944 MITRE CSV (view 1000, Research)
Categories 422 MITRE XML (<Category> entries)
Views 59 MITRE XML (<View> entries)

Highlights

Installation

Add the dependency to your shard.yml:

dependencies:
  cwe:
    github: hahwul/cwe.cr

Then run:

shards install

Quick Example

require "cwe"

w = CWE.find!("CWE-79")
w.name        # => "Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"
w.abstraction # => CWE::Abstraction::Base
w.status      # => CWE::Status::Stable
w.url         # => "https://cwe.mitre.org/data/definitions/79.html"

w.common_consequences.first.scope # => "Confidentiality"
w.parent_relations.map(&.cwe_id).uniq # => [74]
CWE.pillar_of(79).try(&.cwe_id)       # => "CWE-707"