Skip to content

Add CWE v4.19.1 per-domain security audit taxonomies - #230

Merged
Alan Jowett (Alan-Jowett) merged 1 commit into
microsoft:mainfrom
Alan-Jowett:cwe-taxonomy-ingestion
Apr 8, 2026
Merged

Alan Jowett (Alan-Jowett) merged 1 commit into
microsoft:mainfrom
Alan-Jowett:cwe-taxonomy-ingestion

Conversation

@Alan-Jowett

Copy link
Copy Markdown
Contributor

Summary

Ingests the MITRE CWE v4.19.1 corpus and generates 13 per-domain security audit taxonomy files for PromptKit. This enables domain-scoped security audits that only consider CWE classes relevant to the target software domain.

What's included

  • scripts/ingest-cwe.py — Standalone, reusable ingestion script. Re-run with any future CWE XML release: python scripts/ingest-cwe.py
  • data/cwe/4.19.1/ — Normalized CWE data, domain mappings, unmapped CWEs, and metadata (version, SHA-256, generation timestamp)
  • ** axonomies/cwe-*.md** (x13) — Per-domain taxonomy files following PromptKit conventions
  • manifest.yaml — Updated with all 13 new taxonomy entries
  • .gitignore — Updated to exclude raw CWE XML downloads

Domain coverage

Domain CWEs Domain CWEs
web-backend 423 crypto-protocols 63
web-js-ts 265 cli-tools 65
firmware-embedded 226 mobile-app 23
native-user-mode-c-cpp 172 iac 8
kernel-mode-c-cpp 113 container-k8s 5
cloud-service 113 data-processing 69
managed-dotnet 92

Total: 626 unique CWEs mapped out of 944 active (318 unmapped — mostly abstract Pillar-level CWEs without domain-specific applicability).

Mapping algorithm

4-priority system applied per CWE:

  1. View membership — CWE views 658 (C), 659 (C++), 660 (Java), 919 (Mobile), 1194 (Hardware), 1450 (OWASP Top 10)
  2. Platform match — \Applicable_Platforms\ language/technology/OS fields
  3. Context analysis — Keyword matching against weakness descriptions for domain assignment
  4. Override rules — Kernel-only exclusion, XSS family restriction, container-specific terms, supply chain adjacency

Verification

All sanity checks pass:

  • Domain exclusion tests (kernel has no XSS/SQLi, IAC has no buffer overflows, .NET has no malloc CWEs, etc.)
  • Consistency checks (all mapped IDs exist in normalized data, no empty domains, all 13 domains present)
  • CI validation (\ ests/validate-manifest.py) passes

Next steps

Template integration (adding \domain\ parameter to \investigate-security,
eview-code, \�xhaustive-bug-hunt) is tracked separately in #228.

Notes

  • Three domains flagged for size review (>200 CWEs): web-backend, web-js-ts, firmware-embedded. This is expected — web and firmware domains are naturally broad.
  • The ingestion script is fully deterministic and reproducible for future CWE versions.

Copilot AI review requested due to automatic review settings April 8, 2026 15:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a version-pinned ingestion pipeline for the MITRE CWE v4.19.1 corpus and commits the generated, per-domain CWE taxonomy artifacts so PromptKit security-audit templates can scope audits to domain-relevant weakness classes.

Changes:

  • Adds a standalone scripts/ingest-cwe.py pipeline to parse CWE XML, map CWEs into 13 audit domains, generate taxonomy Markdown files, and emit normalized JSON artifacts.
  • Adds 13 new taxonomies/cwe-*.md files (one per audit domain) plus versioned data outputs under data/cwe/4.19.1/.
  • Registers the new taxonomies in manifest.yaml and updates .gitignore to avoid committing raw CWE XML downloads.

Reviewed changes

Copilot reviewed 16 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scripts/ingest-cwe.py Implements CWE XML parsing, domain mapping, taxonomy generation, meta/diff output, and sanity checks.
manifest.yaml Adds 13 taxonomy entries for the new CWE per-domain taxonomies.
.gitignore Ignores raw CWE XML downloads to keep large upstream artifacts out of the repo.
.github/skills/ingest-cwe-taxonomies/SKILL.md Adds a Copilot skill wrapper describing how to run the ingestion workflow.
.github/prompts/ingest-cwe-taxonomies.prompt.md Adds a Copilot prompt file defining the end-to-end CWE ingestion workflow and validation rules.
data/cwe/4.19.1/meta.json Captures version metadata, source hash, and generation timestamp for CWE v4.19.1.
data/cwe/4.19.1/cwe-normalized.json Stores normalized CWE weakness records extracted from the XML corpus.
data/cwe/4.19.1/domain-mappings.json Stores per-domain CWE assignments with mapping rationale.
data/cwe/4.19.1/unmapped.json Stores CWEs that were not mapped to any domain (with reasons).
taxonomies/cwe-cli-tools.md New CWE taxonomy scoped to CLI tools.
taxonomies/cwe-cloud-service.md New CWE taxonomy scoped to cloud-hosted services/APIs.
taxonomies/cwe-container-k8s.md New CWE taxonomy scoped to containers/Kubernetes.
taxonomies/cwe-crypto-protocols.md New CWE taxonomy scoped to cryptographic protocols.
taxonomies/cwe-data-processing.md New CWE taxonomy scoped to data pipelines/ETL/batch processing.
taxonomies/cwe-firmware-embedded.md New CWE taxonomy scoped to firmware/embedded systems.
taxonomies/cwe-iac.md New CWE taxonomy scoped to Infrastructure-as-Code.
taxonomies/cwe-kernel-mode-c-cpp.md New CWE taxonomy scoped to kernel-mode C/C++.
taxonomies/cwe-managed-dotnet.md New CWE taxonomy scoped to managed .NET.
taxonomies/cwe-mobile-app.md New CWE taxonomy scoped to mobile apps.
taxonomies/cwe-native-user-mode-c-cpp.md New CWE taxonomy scoped to native user-mode C/C++.
taxonomies/cwe-web-backend.md New CWE taxonomy scoped to web backends.
taxonomies/cwe-web-js-ts.md New CWE taxonomy scoped to web JS/TS frontends.

Comment thread scripts/ingest-cwe.py Resolved
Comment thread scripts/ingest-cwe.py Resolved
Comment thread scripts/ingest-cwe.py Resolved
Ingest the MITRE CWE v4.19.1 corpus (969 weaknesses, 944 active) and
generate 13 per-domain taxonomy files for PromptKit security audits.

Artifacts:
- scripts/ingest-cwe.py: standalone, reusable ingestion script
- data/cwe/4.19.1/: normalized data, domain mappings, metadata
- taxonomies/cwe-*.md: 13 domain taxonomy files (626 mapped CWEs)

Domains: kernel-mode-c-cpp (113), native-user-mode-c-cpp (172),
managed-dotnet (92), web-js-ts (265), web-backend (423),
cloud-service (113), iac (8), firmware-embedded (226),
crypto-protocols (63), data-processing (69), cli-tools (65),
mobile-app (23), container-k8s (5).

Mapping uses 4-priority algorithm: CWE view membership, platform
match, context/keyword analysis, and override rules. All domain
exclusion and consistency checks pass.

Template integration (domain parameter support) tracked in Issue microsoft#228.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Alan-Jowett
Alan Jowett (Alan-Jowett) merged commit 601ce23 into microsoft:main Apr 8, 2026
4 checks passed
@Alan-Jowett
Alan Jowett (Alan-Jowett) deleted the cwe-taxonomy-ingestion branch April 8, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants