Enhance DFD generation from system descriptions - #91
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds support for generating threat models directly from natural-language system descriptions, allowing users to create Data Flow Diagrams (DFDs) without needing an existing architecture diagram. It introduces new CLI flags, updates documentation, and implements the backend logic for parsing LLM-generated DFDs into Threat Thinker's native Graph IR. The documentation and tutorials are also updated to reflect this new workflow.
Major new feature: Description-to-DFD workflow
Adds
business_context.py, which implements utilities and dataclasses to parse LLM-generated DFD JSON payloads into native Graph IR, including confidence levels, assumptions, and clarifying questions.Introduces new constants (
DFD_SYSTEM,DFD_INSTRUCTIONS) to instruct the LLM on how to generate DFDs from descriptions, and adds a corresponding JSON schema for validation. [1] [2]Updates the inference module to support DFD generation from descriptions, including a new token budget for this flow. [1] [2]
CLI and documentation updates
Adds
--description,--description-file, and--context-fileflags to the CLI, clarifies their usage, and documents how to run Threat Thinker from a system description or file. [1] [2]Updates the README and CLI docs to explain the new workflow, and adds a new tutorial for starting from a system description. [1] [2] [3] [4] [5]
These changes make it possible to perform automated threat modeling even when no diagram exists, lowering the barrier for early-stage or less-documented projects.