simonec73 / threatsmanager

Threats Manager Platform Core libraries and SDK
MIT License
69 stars 13 forks source link

threat model get cluttered on opening #53

Closed rsrinivasanhome closed 1 year ago

rsrinivasanhome commented 1 year ago

Describe the bug I am able to create a diagram of my threat mode it look fine l . However when I try opening it becomes very cluttered and unreadable. Is there any setting I am missing ?

simonec73 commented 1 year ago

That's a known bug triggered by the adoption of different DPIs monitors. I will fix this with the next version. Thank you for noticing it.

rsrinivasanhome commented 1 year ago

Is there any work around for this issue ? Will keeping the number of components in threat model low help ? Any guideline to reduce occurrence of this issue ?

simonec73 commented 1 year ago

Yes, there is.

  1. Save the file as JSON (TMJ).
  2. Open it with an editor (for example, VS CODE).
  3. Go to the Diagrams node and then open the Properties of the first diagram. You will see there a property that is of type PropertyDecimal. The value corresponds to the original HiDPI scale. If the diagram looks too small, the value may be too big: make it smaller to adjust. Instead, if the diagram seems too big, then reduce the value.
  4. Repeat point 3 for every diagram in the threat model.

If you know the DPI scale adopted on the computer that created the diagrams, that would be the correct value to use.

I hope it helps.

rsrinivasanhome commented 1 year ago

I am facing this issue recently. I think previously i was using only my laptop . Will be be updating the threat model sometimes with extended monitor cause this issue. Is there any resolution which will reduce the number of times this issue occurs.

simonec73 commented 1 year ago

Not for now, no. I'm working on version 2.0, which revamps diagrams and addresses this issue, but for now there is nothing else to do.

rsrinivasanhome commented 1 year ago

This is the values I am seeing for my group box. Should I play with the pos attribute or size attribute ? For me the boxes are becoming much bigger

 "$type": "ThreatsManager.Engine.ObjectModel.Diagrams.GroupShape, ThreatsManager.Engine",
              "id": "c1b7ee5e-e2e4-4a77-ac05-352a94468857",
              "pos": {
                "$type": "System.Drawing.PointF, System.Drawing",
                "IsEmpty": false,
                "X": 2080.0,
                "Y": 2100.0
              },
              "size": "767.3091, 714.4446",
              "modelId": "f07ae48f-8b8b-4e20-904b-03047d27c74f",
              "properties": null
simonec73 commented 1 year ago

I would not go that route. It's easier to use the process I proposed above.

rsrinivasanhome commented 1 year ago

For this point 3 "Go to the Diagrams node and then open the Properties of the first diagram. You will see there a property that is of type PropertyDecimal. The value corresponds to the original HiDPI scale. If the diagram looks too small, the value may be too big: make it smaller to adjust. Instead, if the diagram seems too big, then reduce the value."

Is this the tag mentioned ?

"$type": "ThreatsManager.Engine.ObjectModel.Properties.PropertyDecimal, ThreatsManager.Engine",
              **"value": 2.5,**
              "modelId": "f07ae48f-8b8b-4e20-904b-03047d27c74f",
              "id": "3c07f229-903d-4767-91ca-36798c8337d2",
              "propertyTypeId": "34c45750-ff55-447d-b10e-50113ce88f5a",
              "readOnly": false
simonec73 commented 1 year ago

Sure, no problem. Look at the following example: image

The property you can see at the bottom is where you should look. As you can see, the value of the said property is 1.0. If your diagram looks too big, you should simply change the value from 1.0 to something bigger, like 1.5 or 2.0. Vice versa if it is too small. Then save the file and open it again in TMS.

rsrinivasanhome commented 1 year ago

It does help to some extent . I have created a multi diagram threat model . What I see is that the boundary sizes some time increase and distort the diagram. not sure of the reason. If I use the same boundary in two diagrams will it effect the size. ?

rsrinivasanhome commented 1 year ago

After playing a little longer understood your approach is the best.

simonec73 commented 1 year ago

It does help to some extent . I have created a multi diagram threat model . What I see is that the boundary sizes some time increase and distort the diagram. not sure of the reason. If I use the same boundary in two diagrams will it effect the size. ?

Trust boundary location and size is defined per diagram. Therefore, no what you set for one does not affect the other.

simonec73 commented 1 year ago

After playing a little longer understood your approach is the best.

Glad to hear. I'm actively working on the next version. It will address the issues you are facing in multiple ways, including executing the remediation activities without requiring that workaround.

rsrinivasanhome commented 1 year ago

Thank you very much . Keep us informed when the next version will be available .