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

Set model storage path via env var #959

Merged
merged 2 commits into from
May 18, 2024

Conversation

jason-meredith-rewind
Copy link
Collaborator

Summary:
As per the documentation found here: https://owasp.org/www-project-threat-dragon/docs-2/getting-started#opening-an-existing-model

Note that Threat Dragon is fairly strict on where the threat models can be stored. The threat models must be under a parent directory called ‘ThreatDragonModels’ and the JSON file must then be stored in a sub-directory with the same name as the model.
As an example, shown is a directory containing two models ‘test-reports’ and ‘New Threat Model’ under the directory ‘ThreatDragonModels’. This directory structure has been carried over from Threat Dragon versions 1.x, and in future it may become less strict.

I was hoping there would be a way of configuring where saved models are stored on a repo (ie in a /doc directory), and seeing this thought to add the functionality myself.

With this change, if no changes are made to the environment variables nothing changes in the directory structure - it is entirely opt-in and backwards compatible. If you would like to customize where models are stored, you can now set the REPO_ROOT_DIRECTORY environment variable. You can also override it per platform, ie GITHUB_REPO_ROOT_DIRECTORY, BITBUCKET_REPO_ROOT_DIRECTORY, etc.

Description for the changelog:

Customizable model storage path

@jgadsden
Copy link
Collaborator

jgadsden commented May 16, 2024

many thanks for this @jason-meredith-rewind and ignore one of the broken tests (Desktop e2e) as this is a known issue
Could you have a look at the server unit tests? These should run OK so I guess the changes need some fixups in the unit tests
You can run the server unit tests by themselves with npm run test:server

@jason-meredith-rewind
Copy link
Collaborator Author

@jgadsden Yes for sure, I will take a look and fix those. Thanks!

Copy link
Collaborator

@jgadsden jgadsden left a comment

Choose a reason for hiding this comment

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

many thanks for this @jason-meredith-rewind
all good to merge

@jgadsden jgadsden merged commit f6c371c into OWASP:main May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request version-2.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants