Skip to content

Commit

Permalink
feat: Adds Open Threat Modeling (OTM) support
Browse files Browse the repository at this point in the history
- Enhances the web application interface to allow for the import and export of threat models in the OTM format.
- resolves OWASP#440
  • Loading branch information
matthew.mcdonald committed Nov 15, 2023
1 parent fc95b8f commit bdf3cc3
Show file tree
Hide file tree
Showing 11 changed files with 528 additions and 25 deletions.
11 changes: 10 additions & 1 deletion td.vue/src/components/Graph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,18 @@ export default {
threatSelected(threatId) {
this.$refs.threatEditDialog.editThreat(threatId);
},
saved() {
savedtd() {
const updated = Object.assign({}, this.diagram);
updated.cells = this.graph.toJSON().cells;
updated.format = "td";
this.$store.dispatch(tmActions.diagramUpdated, updated);
this.$store.dispatch(tmActions.save);
this.$store.dispatch(tmActions.unmodified);
},
savedotm() {
const updated = Object.assign({}, this.diagram);
updated.cells = this.graph.toJSON().cells;
updated.format = "otm";
this.$store.dispatch(tmActions.diagramUpdated, updated);
this.$store.dispatch(tmActions.save);
this.$store.dispatch(tmActions.unmodified);
Expand Down
16 changes: 9 additions & 7 deletions td.vue/src/components/GraphButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,10 @@
icon="times"
:text="$t('forms.close')" />

<td-form-button
:isPrimary="true"
:onBtnClick="save"
icon="save"
:text="$t('forms.save')" />
<b-dropdown right :isPrimary="true" icon="save" :text="$t('forms.save')">
<b-dropdown-item-button :text="$t('forms.savetd')" icon="savetd" @click="savetd">{{$t('forms.savetd')}}</b-dropdown-item-button>
<b-dropdown-item-button :text="$t('forms.saveotm')" icon="saveotm" @click="saveotm">{{$t('forms.saveotm')}}</b-dropdown-item-button>
</b-dropdown>

</b-btn-group>
</template>
Expand All @@ -76,8 +75,11 @@ export default {
}
},
methods: {
save() {
this.$emit('saved');
savetd() {
this.$emit('savedtd');
},
saveotm() {
this.$emit('savedotm');
},
async closeDiagram() {
this.$emit('closed');
Expand Down
2 changes: 2 additions & 0 deletions td.vue/src/i18n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ const eng = {
remove: 'Remove',
report: 'Report',
save: 'Save',
savetd: 'Threat Dragon Format',
saveotm: 'OTM Format',
saveAs: 'Save As',
saveHtml: 'Save HTML',
saveModel: 'Save Model',
Expand Down
Loading

0 comments on commit bdf3cc3

Please sign in to comment.