Code Monkey home page Code Monkey logo

threat-dragon's Introduction

Threat Dragon Logo

Build status GitHub license

OWASP Threat Dragon

OWASP Threat Dragon is a free, open-source, cross-platform threat modeling application. It is used to draw threat modeling diagrams and to list threats for elements in the diagram. Mike Goodwin created Threat Dragon as an open source community project that provides an intuitive and accessible way to model threats.

Threat Dragon is designed to be accessible for various types of teams, with an emphasis on flexibility and simplicity. It is an OWASP Lab Project and follows the values and principles of the threat modeling manifesto.

Try Threat Dragon

You can access the the latest version of Threat Dragon on our website and look through the documentation pages.

Also well worth watching the video provided by the OWASP Spotlight series.

The github release area contains Threat Dragon from version 1.3 to the latest versions 2.x. Previous releases are from Mike Goodwin's original repository.

About Threat Dragon

There is a good overview of threat modeling and risk assessment from OWASP, and this expands on what the Threat Dragon project aims for:

  • ease of use and accessible
  • designing a data flow diagram
  • suggesting threats
  • entering mitigations and counter measures

Mike Goodwin is the founder and creator of this project, and this repository has been migrated from Mike Goodwin's original which has the issues and pull requests from October 2015 up to June 2020.

Threat Dragon is primarily a web application. The web application can store threat model files on the local filesystem; in addition access can be configured for :

  • GitHub
  • Bitbucket
  • GitLab
  • Github Enterprise

The desktop versions of Threat Dragon stores the threat model files on the local filesystem and do not access external repositories. You can download installers for Windows, MacOS and Linux.

End user help is available for both the latest version 2.x and the previous version 1.x.

Version 1.x maintenance mode

Threat Dragon was originally written using AngularJS version 1.x, but this version of Angular reached end of life. This means that versions 1.x of Threat Dragon are no longer actively maintained and versions 2.x have been re-written to use Vue.js.

For more information on building/running version 1.x, please see the legacy-v1.x branch.

Building version 2.x

Install git and node.js which includes the node package manager npm

Clone the repository using: git clone https://github.com/owasp/threat-dragon.git

This downloads the code into a threat-dragon directory and the application code is in two sub-folders, one for the back-end application (td.server) and one for the front-end (td.vue).

Install from the top directory of the project using : npm install

Environment variables for web application

The web application variant of Threat Dragon requires some environment variables; follow the documentation on how to set these variables.

If access to external repositories is required, such as GitHub / Bitbucket / GitLab, then you need to go to your to the repository account and register it as a GitHub application. There are step by step guides on how to do this.

If running the web application locally then the front-end to server communication will probably need to be HTTP rather than HTTPS. Specify this using environment variable SERVER_API_PROTOCOL=http in the dotenv file or the command line.

Run the application

When running on Windows, and during development, the front-end and back-end can be started separately in "watch" mode using commands : npm run dev:server and npm run dev:vue. Alternatively, if running on Linux or MacOS, start both the back-end server and the front-end application from the top directory using : npm start.

With both front and back end running, access with a browser at http://localhost:8080/

Stop the application

If using npm start, stop both the back-end server and the front-end application from the top directory with command npm stop. Otherwise break out of both the server and vue front-end.

Docker (local build)

To run Threat Dragon in a docker container, first configure your environment using dotenv and run from the top directory of the project:

  • docker build -t owasp-threat-dragon:dev .
  • docker run -it --rm -p 8080:3000 -v $(pwd)/.env:/app/.env owasp-threat-dragon:dev
  • or if using Windows:
  • docker run -it --rm -p 8080:3000 -v %CD%/.env:/app/.env owasp-threat-dragon:dev

Using http port 8080 and accessing Threat Dragon on http://localhost:8080/.

Docker (from dockerhub)

Threat Dragon maintains docker images within the OWASP organisation area on Dockerhub. Each release is tagged as v{major}.{minor}.{patch}, eg v1.6.0:

  • docker pull owasp/threat-dragon:v2.0.0

The latest tag (which is the default) may well be a development version so use the stable tag, which will always be the latest official release:

  • docker pull threatdragon/owasp-threat-dragon:stable
  • For MacOS and Linux:
  • docker run -it --rm -p 8080:3000 -v $(pwd)/.env:/app/.env threatdragon/owasp-threat-dragon:v2.0.0
  • For Windows:
  • docker run -it --rm -p 8080:3000 -v %CD%/.env:/app/.env threatdragon/owasp-threat-dragon:v2.0.0

Assuming that you are using http port 8080 and accessing Threat Dragon on http://localhost:8080/.

Contributing

Pull requests, feature requests, bug reports and feedback of any kind are very welcome, please refer to the page for contributors.

There are some developer notes to help get started with this project. We are trying to keep the test coverage relatively high so include tests in your pull requests.

The easiest way to get in contact with the Threat Dragon community is via the OWASP Slack #project-threat-dragon project channel (you may need to subscribe first).

Vulnerability disclosure

If you find a vulnerability in this project please let us know ASAP and we will fix it as a priority. For secure disclosure, please see the security policy.

Project leaders

Threat Dragon: making threat modeling less threatening

threat-dragon's People

Contributors

andk123 avatar atmegabuzz avatar bartleskeet avatar christopherhackett avatar danielpops avatar dependabot[bot] avatar hugoreeves avatar itsdheerajdp avatar jeg1972 avatar jgadsden avatar jksolbakken avatar kostasadriano avatar lreading avatar martinmarsicano avatar michaelgrahamevans avatar mike-goodwin avatar mike-goodwin-sage avatar mikkolehtisalo avatar mohamedselbohy avatar prakhar-ai avatar professorabhay avatar quine avatar raghav1030 avatar shubhampalriwala avatar snyk-bot avatar steve-winter avatar storkinsj avatar taoyiyang1 avatar teguh02 avatar yolylight avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

threat-dragon's Issues

provide AutoUpdate for desktop installer

This issue has been migrated from:
mike-goodwin/owasp-threat-dragon-desktop#101

There is a branch for applying auto-updates using squirrel. It should be cross platform for Windows, MacOS and Linux.
File app/app.js has been modified to not use autoupdate via PR OWASP/threat-dragon-desktop#102 because it was causing problems, but this modification can be undone when autoupdate is working:

//electron autoupdate
//Note: autoupdate has been disabled until this issue has been satisfied:
//      https://github.com/mike-goodwin/owasp-threat-dragon-desktop/issues/101
// app.run(['common', 'dialogs', 'electron', 'VERSION', require('./app/config.autoupdate')]);

Privacy Threat Modelling (eg LINDDUN)

This issue has been migrated from :
mike-goodwin/owasp-threat-dragon-core#117
and was opened by @fajabird :

We are assessing threat dragon for our threat modeling workshops and lately we started to extend it to privacy threats. We came accros the great LINDDUN framework that is very similar to STRIDE and also uses DFDs.

Therefor it would be great to have either LINDDUN categories in the threat engine or even a "custom" threat option where users can create a list of custom threat categories that are displayed in the drop-down.

Take asset checkbox before generating threat suggestions

When we put the assets and data flows into the diagram, we are allowed to set a few checkboxes. If we ask the application to generate threat suggestions, it does not take them into consideration, thus suggesting a "Tampering" threat to a data flow that has been marked as "encrypted" in one of its checkboxes.

I tried to deploy locally in MAC OSX, but it fails

This issue has been migrated from :
mike-goodwin/owasp-threat-dragon#116
and was opened by @NAlhirabi :

Hello Mike
I tried to deploy locally in MAC OSX, but it fails , when I run
npm start
Terminal shows following error:

[email protected] start /Users/nadaalhirabi/Documents/GitHub/owasp-threat-dragon
node server.js

{"name":"threatdragon","excludes":["req-headers","res-headers","res","req","short-body","body","response-hrtime","incoming","user-agent","response-time","http-version"],"hostname":"m006.cs.cf.ac.uk","pid":81568,"level":50,"security":true,"msg":"secure session cookie flag was false - should only happen in dev environments","time":"2019-11-11T14:07:32.065Z","v":0}
{"name":"threatdragon","hostname":"m006.cs.cf.ac.uk","pid":81568,"level":50,"msg":"owasp threat dragon failed to start up","time":"2019-11-11T14:07:32.067Z","v":0}
{"name":"threatdragon","hostname":"m006.cs.cf.ac.uk","pid":81568,"level":50,"msg":"Credentials must be provided when creating a service client.","time":"2019-11-11T14:07:32.067Z","v":0}
events.js:187
throw er; // Unhandled 'error' event
^

Error: listen EADDRINUSE: address already in use :::3000
at Server.setupListenHandle [as _listen2] (net.js:1300:14)
at listenInCluster (net.js:1348:12)
at Server.listen (net.js:1436:7)
at Function.listen (/Users/nadaalhirabi/Documents/GitHub/owasp-threat-dragon/node_modules/express/lib/application.js:618:24)
at Object. (/Users/nadaalhirabi/Documents/GitHub/owasp-threat-dragon/server.js:7:18)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1327:8)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
code: 'EADDRINUSE',
errno: 'EADDRINUSE',
syscall: 'listen',
address: '::',
port: 3000
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: node server.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/nadaalhirabi/.npm/_logs/2019-11-11T14_07_32_140Z-debug.log
m006:owasp-threat-dragon nadaalhirabi$

————

This is the variables in bash_profile

GITHUB_CLIENT_ID=XXXXXX
GITHUB_CLIENT_SECRET=XXXXXX
SESSION_SIGNING_KEY=XXXXX (note it is the Personal access tokens in Github)
SESSION_STORE=local
AZURE_STORAGE_CONNECTION_STRING
NODE_ENV=development

Request to relax test case requirements

This issue has been migrated from :
mike-goodwin/owasp-threat-dragon#68
and was opened by @subashsn :

We've added Gitlab as a provider along with Github for Threat Dragon. Currently it's functional, but the test cases are failing due to ES6 syntax and changes done to accomodate multiple providers; Github and Gitlab. Can we relax this?

If this is okay, I'd be happy to raise a pull request that adds Gitlab integration for Threat Dragon. Thanks

Edit the model to add a diagram

@thomaskonrad reports:
The fact that I have to edit the model to add a diagram: That seems counter-intuitive to me. I'd put the diagrams into the edit view of the model, and only put metadata into the edit dialog.

Drag whole trust boundaries

@thomaskonrad reports:
I cannot drag whole trust boundaries: When I point at a trust boundary, the cursor indicates that I can drag and drop the whole boundary, but instead, a new point is added to the curve, which I then drag. I could not find out a way to move a whole trust boundary at once.

Error: Invalid key length at new Cipheriv (crypto.js:219:16)

This issue has been migrated from :
mike-goodwin/owasp-threat-dragon#74
and was opened by @anirbanctts :

Keep on getting this error after entering github credentials.
Error: Invalid key length
at new Cipheriv (crypto.js:219:16)
at Object.createCipheriv (crypto.js:619:10)
at encryptData
....

var crypto = require('crypto');
var inputEncoding = 'ascii';
var outputEncoding = 'base64';
var keyEncoding = 'ascii';
var algorithm = 'aes256';

these properties were unchanged. Not sure why this issue keeps on repeating.
using NodeJS 8.11.3 LTS version

Data Flow arrows misaligned

@thomaskonrad reports:
Data Flow arrows are misaligned: The arrows seem to point towards the direct line between two objects, instead of the direction of the very last part of the curve. That makes it misaligned when it's curved.

Show protocol in Data Flow

@thomaskonrad reports:
The protocol isn't shown in the Data Flow: There is no indicator which protocol is in use, or whether it's encrypted, although I can specify these properties.

Reinstate greying out of save button

The save button was only enabled after changes are made in the diagram, but this feature has been temporarily removed in issue mike-goodwin/owasp-threat-dragon-core#96 .
It has also been migrated from mike-goodwin/owasp-threat-dragon-core#97 :

The problem was that the save button was only enabled after an element is de-selected. This confused some users of Threat Dragon, so to avoid concern the save button is always enabled.

It is a good thing to disable the save button when no changes have been made, so this feature should be reinstated.

Provide bi-directional data flow

It would be good to be able to specify bidirectional data flows, as well as the existing single direction data flow, as it would make some diagrams look less busy and would not detract from the information in the threat model

Provide notes for developers

@ZhangK123 raised an issue mike-goodwin/owasp-threat-dragon-core#121 :

I want to add some new funtions in my computer. The problem is how do you debug and run the core part in your comuter?
Is this core-part must run on the Web application?

It would be good to have developer notes so that it is easy to understand the structure and also easier to modify / debug the core code

PDF report diagram is split

The threat model PDF report generated by the tool is splitting the diagram across pages. For example, when a 1-page diagram occurs half-way down a page. To overcome this issue, the user could insert a page-break just before the diagram or manually ensure the diagram does not occur over a page break.

Reinstate zoom feature

The zoom feature was removed temporarily, issue mike-goodwin/owasp-threat-dragon-core#94 .
It has also been migrated from mike-goodwin/owasp-threat-dragon-core#95 :
This feature needs to be reinstated so that:

Fix up CI tasks

This repo has been migrated from Mike Goodwin user space, and needs the CI tasks to point to this repo rather than mike-goodwin repos

Make use of STRIDE/CIA/LINDDUN thumbnails

The TD webapp and desktop app now include different thumbnails for STRIDE/CIA/LINDDUN . It would be good if the radio buttons in the diagram for STRIDE, CIA and LINDDUN also changed the path to the appropriate thumbnail instead of using the generic one.

Prepare Version 1.3 release

Version 1.3 release is expected August 2020 or so. It may contain :

  • code signing
  • updated threat engine
  • integration with EoP Threat Modeling Card Deck (under CC-BY)

It will need the usual testing, versioning, etc

User session timeout not handled

@danwiltshire raised this issue in mike-goodwin/owasp-threat-dragon#152 :

When the user session times out, the application will let the user continue to work on a diagram but the Save function does not operate.

The user will need to refresh the page which will prompt for GitHub authentication resulting in lost progress.

Steps to reproduce:

Let browser idle or put device to sleep for a period of time
Continue working in Threat Dragon
Attempt to save progress.

Desktop: XSS vulnerability in desktop app

I originally reported this in the wrong repo, so I'm re-reporting it here:

There is an XSS flaw in the app that can lead to RCE, its been confirmed on the OSX version of the application. I cant track the flaw down in the application code (although admittedly my JS/Electron skills are pretty low) so cant offer a PR or fix for it :(

I've sent details via the Flowcrypt form rather than post them here.

Fix up CI tasks

This repo has been migrated from Mike Goodwin user space, and needs the CI tasks to point to this repo rather than mike-goodwin repos

Add CIAA categories

It would be good to have an alternative to the STRIDE categories for threats in TD, which has been discussed for LIDDUN OWASP/threat-dragon-core#16 . The most direct categorisation is Confidentiality Integrity Availability and Authenticity (CIAA), and it would be good to have these categories either alongside STRIDE or as an alternative to STRIDE

Update packages

When running npm install there are warnings. These packages could be updated so that the warnings are reduced.

 npm install
npm WARN deprecated [email protected]: This module is no longer maintained, try this instead:
npm WARN deprecated   npm i nyc
npm WARN deprecated Visit https://istanbul.js.org/integrations for other alternatives.
npm WARN deprecated [email protected]: this package is now deprecated
npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated [email protected]: This module is no longer maintained, try this instead:
npm WARN deprecated   npm i nyc
npm WARN deprecated Visit https://istanbul.js.org/integrations for other alternatives.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to at least constantinople 3.1.1
npm WARN deprecated [email protected]: Deprecated, use jstransformer
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please use the native JSON object instead of JSON 3
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
...
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"0.10 || 0.12 || 4 || 5 || 6 || 7 || 8"} (current: {"node":"13.2.0","npm":"6.14.2"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]

Feature request: Clarify color

This issue has been migrated from :
mike-goodwin/owasp-threat-dragon-core#75
and was opened by @adamshostack :

The sample diagram has some elements (background worker, worker config, etc) which show in red. It's not clear what red means. (dashed lines seem to be used for both trust boundaries and Out of scope).

I suggest adding a key, but possibly alternately reducing use of color to address the threat of black & white printing.

Prepare Version 1.3 release

Version 1.3 release is expected August 2020 or so. It may contain :

  • updated threat engine
  • integration with EoP Threat Modeling Card Deck (under CC-BY)

It will need the usual testing, versioning, npm packaging, etc

LGTM alert

There is an alert from LGTM in td/public/app/threatmodels/github.js

22 function activate() {
23     common.activateController([load()], controllerId)
 -- the function load does not return anything, yet the return value is used --
24             .then(function () { log('Activated GitHub Controller'); });
25 }

principle behind severity?

This issue has been migrated from :
mike-goodwin/owasp-threat-dragon-core#77
and was opened by @dschadt :

This is probably the wrong place to ask questions like this but I didn't find another place.

Severity can be rated in 3 levels. It looks very similar to TMT priority.
What exactly is the practical use of severity?
From a classical risk oriented approach a priority is similar to a resulting risk with different levels before and after mitigation. Before mitigation it helps to prioritize activities applying countermeasures.
Risk is defined as a product of impact and likelihood if you want to simplify. Impact in my opinion is simply characterized by sensitivity of the data processed in the data flow and broken SLA. Both are different (business) impacts to be referenced to the character of the STRIDE attack vector. The other dimension likelihood is just a guess how easy it is to materialize the threat.
If possible I try to setup likelihood and impact based on the companies risk definition and throw out the risk level as a result.
Using priority TMT had the "problem" that it was setup by guessing not having a basis with risk assessment. Therefore it produced no real value for me. I changed it to calculate risks in a spreadsheet instead of prioritizing within TMT.
It would be helpful to know what the reason is for implementing severity this way.

Integrate threat engine with EoP cards

TD suggests STRIDE when adding threats to the data flow diagram, and one idea is that when one of STRIDE categories is suggested by TD, then the default description could have a link to the specific EoP suit (so for example if it is Repudiation then we could link to the EoP Repudiation suit).

This would need the EoP to be split out into the individual suits (Spoofing, Tampering, Repudiation, Information disclosure, Denial of service, Elevation of privilege), subject of adamshostack/eop#3

github oauth: too much of requested permissions

This issue has been migrated from :
mike-goodwin/owasp-threat-dragon#72
and was opened by @fadeevab :

To use the online version of application the GitHub's authentication is requested.

However a requested scope of permissions is quietly wide:

This application will be able to read and write all public repository data. This includes the following:

Code
Issues
Pull requests
Wikis
Settings
Webhooks and services
Deploy keys

I'm pretty sure it's enough to get an empty scope (see https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/): to read public account information. It's not clear about all other permissions.

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.