Repository navigation
Description
Title
One-pass CWE ingestion → generate per-domain CWE taxonomies for PromptKit security audits
Problem / Motivation
PromptKit security audits risk being domain-incorrect unless we constrain what “classes of bugs” the model looks for. Example: it’s wasted effort to check for XSS during a kernel audit, or to check IRQL-level hazards when auditing JavaScript. We want audits to be domain-scoped, not generic, to reduce noise and increase yield.
PromptKit already describes a Layer 4 — Taxonomy in the composition stack intended for “domain classification.”
Also, we have evidence that structured PromptKit-driven security audits can produce materially better results when the LLM is guided with tighter methodology and structure. [PromptKit-Intro | PowerPoint], [promptkit-...our - Copy | PowerPoint] [MSRC style...PromptKit | Outlook], [IO Fabrics...Recording | Video], [eBPF & Cil...Transcript | Video]
Goal
Implement a pipeline that:
- Ingests the official CWE corpus (versioned) from MITRE. [cwe.mitre.org], [cwe.mitre.org]
- In a single run, generates per-domain CWE taxonomies (domain → relevant CWE subset + metadata) suitable for PromptKit templates/protocols.
- Updates PromptKit security audit prompts to:
- Select the correct taxonomy by
domain - Provide the LLM only the applicable CWE subset
- Drive evidence-backed pattern matching (include CWE ID + evidence + confidence)
- Select the correct taxonomy by
Non-Goals
- Replace SAST tooling or build a full static analyzer.
- Claim exploitability/proof automatically.
- Fork/maintain a separate “proprietary CWE”; we should track upstream versions.
External References (authoritative sources)
- CWE official downloads include XML and CSV bundles suitable for ingestion. [cwe.mitre.org]
- CWE provides schema documentation for robust parsing/version tolerance. [cwe.mitre.org], [cwe.mitre.org]
Proposed Design (single pass → many outputs)
A) CWE ingestion (versioned, reproducible)
Add an ingestion tool/workflow that:
- Accepts CWE XML/CSV (downloaded from MITRE or provided locally) and records:
- CWE release/version (from filename or metadata)
- Hash of the source artifact(s)
- Parses into a normalized internal representation:
cwe_id,name,abstraction,statusdescription/ short summary fields as available- platform/language/technology applicability fields when present (from CWE schema)
- relationships graph: parents/children, related weaknesses
- Emits artifacts under a versioned directory, e.g.:
data/cwe/<version>/cwe.jsondata/cwe/<version>/edges.jsondata/cwe/<version>/meta.json(version + hashes + generation info)
(Exact artifact shape is an implementation decision; the key requirement is version pinning and deterministic regeneration.)
B) Domain model (defined once, emitted for all domains)
Define a PromptKit “audit domain” list (the taxonomy keys). The goal is “all of them,” but it still must be a finite registry. The pipeline will generate outputs for every registered domain each run.
Example domain registry (strawman; edit as needed):
kernel-mode-c-cppnative-user-mode-c-cppmanaged-dotnetweb-js-tsweb-backendcloud-serviceiacfirmware-embeddedcrypto-protocolsdata-processingcli-toolsmobile-appcontainer-k8s
C) One-pass taxonomy generation algorithm
In the same run as ingestion, generate:
taxonomies/cwe-domains/<version>/domains.json- domain definitions (name, description, selection rules)
taxonomies/cwe-domains/<version>/domain_to_cwe.json- for each domain: list of CWEs + minimal metadata (id, short name, optional detection hints)
taxonomies/cwe-domains/<version>/diff/(optional)- machine-readable diffs between versions to review mapping churn
Selection rules should be (in priority order):
- Use CWE-provided structuring where available (e.g., “helpful views” or language-specific views are explicitly listed as downloadable options). [cwe.mitre.org]
- Use schema-exposed applicability data (
Applicable_Platforms, language/technology hints) when present. [cwe.mitre.org], [cwe.mitre.org] - Allow PromptKit-maintained override/curation (“domain overrides”) to patch gaps or handle ambiguous areas.
D) PromptKit integration: taxonomy layer becomes real
Update security audit templates/protocols so YAML frontmatter can specify:
domain: kernel-mode-c-cpp(required, default none)
At composition time, PromptKit loads:
- CWE dataset version pinned by the PromptKit release (or by a config)
- The generated mapping for the requested domain
And injects into the audit prompt:
- “Only consider CWE IDs in this domain subset.”
- “If you find something plausible outside the subset, record it as
out-of-scope candidate(don’t expand scope).”
This fits PromptKit’s stated “taxonomy layer” concept in its composition stack.
It also aligns with ongoing work to reduce ambiguity and make behavior more deterministic in PromptKit components (including discussions touching CWE assignment behavior). [PromptKit-Intro | PowerPoint], [promptkit-...our - Copy | PowerPoint] [Re: [micro...components | Outlook]
Acceptance Criteria
1) One-pass completeness
- A single command/run produces taxonomy outputs for every registered domain (not a “pick one domain” workflow).
- Outputs are versioned and reproducible from the same input CWE bundle.
2) Domain relevance sanity checks
- Kernel domain mappings do not include web-only classes by default (e.g., XSS-style items).
- Web JS/TS mappings do not include kernel-only defect classes by default (e.g., IRQL-level hazards).
(Implementation should include explicit regression tests on a few known “should-not-appear” examples.)
3) Prompt behavior
- Security audit prompts can be parameterized with
domain, and they incorporate only that domain’s CWE subset. - Output format includes CWE ID + evidence pointer + confidence (template decision), consistent with the structured security audit direction already being used in practice. [MSRC style...PromptKit | Outlook], [eBPF & Cil...Transcript | Video]
4) Maintenance
- Updating to a new CWE release is: run ingestion → regenerate all domains → review diff.
Implementation Tasks
- Add CWE ingestion tool / workflow (XML+CSV input, normalized output). [cwe.mitre.org], [cwe.mitre.org]
- Create domain registry (authoritative list of domains PromptKit supports).
- Implement mapping rules using CWE downloadable structuring + schema applicability + overrides. [cwe.mitre.org], [cwe.mitre.org], [cwe.mitre.org]
- Emit per-domain taxonomy artifacts for all domains in one run.
- Integrate taxonomy selection into PromptKit composition (Layer 4). [PromptKit-Intro | PowerPoint], [promptkit-...our - Copy | PowerPoint]
- Update security audit template(s) to require
domainand to scope findings accordingly. - Add unit/regression tests:
- domain mapping sanity checks (negative sets)
- determinism: same input → same mapping output
- Documentation: how to choose
domain, how to override/extend mappings.
Nice-to-have (but not required for v1)
- Diff report that highlights:
- CWEs added/removed per domain between CWE releases
- Overrides that are now redundant because upstream improved applicability tagging
Activity
Alan-Jowett commentedon Apr 8, 2026
Design Notes: Why this is a single‑pass ingestion pipeline (not on‑demand filtering)
This feature should be implemented as:
—not as runtime filtering or per‑audit selection logic.
Rationale
1. PromptKit already separates classification from reasoning
PromptKit’s architecture explicitly composes prompts from:
Where the taxonomy layer exists to classify findings and attach contextual metadata that informs downstream reasoning and output structure. [github.com], [PromptKit_Intro | PowerPoint]
Taxonomy is therefore:
So domain selection (e.g., kernel vs web) belongs at:
If we instead defer CWE selection to the prompt runtime:
That is directly at odds with PromptKit’s goal of treating prompts as engineered, version‑controlled artifacts rather than ad‑hoc runtime behavior. [github.com]
2. CWE already ships domain‑relevant structural “views”
The CWE dataset is not a flat list — MITRE publishes:
Example:
And the CWE catalog explicitly includes:
These are already:
✅ machine‑derivable domain subsets
✅ maintained upstream
✅ versioned by CWE release
Which makes them ideal raw inputs for a build‑time taxonomy generator.
3. PromptKit treats prompts as compiled artifacts
PromptKit does not store full prompts.
Instead, it stores:
As described internally:
The assembled prompt is effectively:
Domain‑scoped CWE taxonomies should therefore be:
This keeps:
4. Runtime filtering breaks determinism guarantees
If CWE subsets are selected at runtime:
PromptKit’s manifest is intended to be the:
So CWE domain mappings must live there (or in derived artifacts),
not be recomputed by the model mid‑audit.
Resulting Build Model
Each ingestion run should:
Security audit templates then simply declare:
No filtering.
No inference.
No runtime heuristics.
The taxonomy layer becomes:
TL;DR
We are not teaching the LLM:
We are compiling:
and giving the LLM:
Add CWE ingestion prompt and skill for per-domain taxonomy generation
Add CWE v4.19.1 per-domain security audit taxonomies
Add CWE v4.19.1 per-domain security audit taxonomies
Add CWE v4.19.1 per-domain security audit taxonomies
Add CWE v4.19.1 per-domain security audit taxonomies (#230)
Add CWE ingestion prompt and skill for per-domain taxonomy generation
Add CWE ingestion prompt and skill for per-domain taxonomy generation (…
Integrate CWE domain taxonomies into bootstrap composition flow
Integrate CWE domain taxonomies into bootstrap composition flow (#232)