Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Flow Diagram (a la STRIDE Threat Model) #1893

Closed
pbnj opened this issue Feb 14, 2021 · 2 comments · Fixed by #2389
Closed

Data Flow Diagram (a la STRIDE Threat Model) #1893

pbnj opened this issue Feb 14, 2021 · 2 comments · Fixed by #2389
Labels
Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request

Comments

@pbnj
Copy link

pbnj commented Feb 14, 2021

Is your feature request related to a problem? Please describe.

I am curious if there is a way to generate a Data Flow Diagram using Mermaid (see example screenshot below).

Data Flow Diagrams are common in software Threat Modelling, especially the STRIDE threat model methodology.

Describe the solution you'd like

A a flow graph or stateDiagram are very similar in concept. In fact, if there is a way to use custom shapes and denote the type of node, then it may very well be possible to achieve this today.

For example, the following Mermaid code would generate the screenshot below:

graph
    DataStore[|Database|] -->|input| Process((System)) -->|output| Entity[Customer]

Where:

  • A node surrounded by [| |] denotes a Data Store
  • A node surrounded by (( )) denotes a Process or Function
  • A node surrounded by [ ] denotes an External Entity
  • Arrows, -->|label| denotes a Data Flow labeled as label

Besides a few shapes that are missing (e.g. Data Store represented by horizontal parallel lines), all shapes would also need to be available in solid lines and dashed/dotted lines, which denotes being out-of-scope.

Additional context

Simple Data Flow Diagram:

data flow diagram example

@pbnj pbnj added Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request labels Feb 14, 2021
@pbnj pbnj changed the title STRIDE Threat Model Diagram Data Flow Diagram (a la STRIDE Threat Model) Feb 14, 2021
@maiermic
Copy link
Contributor

maiermic commented Oct 9, 2021

You can use graph TD as a hacky solution by using

style DataStoreNode height width

where height and width refer to the rendered DataStoreNode. In your example, this would be

graph LR
    DataStore[Database] -->|input| Process((System)) -->|output| Entity[Customer]
    style DataStore stroke-dasharray: 88.5 44

which is rendered by the Mermaid Live Editor

image

if image is copied to clipboard as PNG. However, if you copy it as markdown, the height (and width?) are somehow different 🤔

It seems that height has to be 39 if you copy it as markdown

graph LR
    DataStore[Database] -->|input| Process((System)) -->|output| Entity[Customer]
    style DataStore stroke-dasharray: 88.5 39

As I said in the beginning, this is a hacky solution 😉 😅

maiermic pushed a commit to maiermic/mermaid that referenced this issue Oct 9, 2021
maiermic pushed a commit to maiermic/mermaid that referenced this issue Oct 9, 2021
maiermic pushed a commit to maiermic/mermaid that referenced this issue Oct 9, 2021
@knsv knsv closed this as completed in #2389 Dec 1, 2021
@fguisso
Copy link

fguisso commented Oct 16, 2023

Just one more example if anyone needs.

flowchart LR
    user(user)
    mobile((mobile\napplication))
    proxy((reverse\nproxy))
    api((API))
    db[|borders:tb|database]

    subgraph external [Internet]
        user--personal data-->mobile
        mobile-->proxy
    end
    subgraph dmz [Internal Network]
        proxy-->api
        db-->api
        api-->db
    end
    classDef boundary fill:none,stroke-dasharray: 5 5
    dmz:::boundary
    external:::boundary
flowchart LR
    user(user)
    mobile((mobile\napplication))
    proxy((reverse\nproxy))
    api((API))
    db[|borders:tb|database]

    subgraph external [Internet]
        user--personal data-->mobile
        mobile-->proxy
    end
    subgraph dmz [Internal Network]
        proxy-->api
        db-->api
        api-->db
    end
    classDef boundary fill:none,stroke-dasharray: 5 5
    dmz:::boundary
    external:::boundary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants