Skip to content

Conversation

mitchellwong
Copy link
Contributor

@mitchellwong mitchellwong commented Aug 6, 2025

Summary:
Saving via keyboard shortcut doesn't apply the current diagram to the threatmodel state, so when the model saves, it saves whatever was already in it, which is what's currently on the disk. This is probably the cause of #1254. Saving via the File menu or the Save icon work correctly by applying the diagram to the threatmodel state first, so just replicate that.

Description for the changelog:
Dispatch THREATMODEL_DIAGRAM_APPLIED before dispatching THREATMODEL_SAVE when saving via keyboard shortcut.

Declaration:

  • appropriate unit tests have been created / modified
  • functional tests created / modified for changes in functionality
  • any use of AI has been declared in this pull request

Other info:
Steps to reproduce:

  1. Open a diagram.
  2. Make a trivial change (add a new process).
  3. Save via ctrl+s.

Expected:
Output json file contains expected changes.

Actual:
Output json file is identical to what was already on the disk.

I don't know what unit or functional tests would be added for this since the existing tests clearly didn't catch it and I'm not familiar with this code base enough to confidently write any.

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.

very elegant fix, thanks @mitchellwong
I will add to the unit tests in PR #1330

@jgadsden jgadsden merged commit 3276bc3 into OWASP:main Aug 7, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working version-2.5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants