Skip to content

Conversation

@aryangupta060407-web
Copy link

Summary

This PR adds a JSON template and an examples folder to simplify the initial creation of threat models in pytm.

Motivation

Issue #12 mentions that creating a threat model requires a lot of manual typing.
Providing a ready-to-use JSON template helps users quickly bootstrap their threat models with minimal effort.

Changes

  • Added examples/template_tm.json as a starter template for threat models.
  • Updated README with instructions for using the JSON template.

Related Issue

Addresses #12

@aryangupta060407-web
Copy link
Author

This template complements the existing JSON import functionality by providing an easy starting point for new users.

@aryangupta060407-web
Copy link
Author

If useful, I can also add a CLI command (e.g., pytm init) to auto-generate this template

@izar
Copy link
Collaborator

izar commented Jan 28, 2026

The JSON file seems to be empty, also, how is this supposed to be used?

@aryangupta060407-web
Copy link
Author

The JSON file seems to be empty, also, how is this supposed to be used?

Thanks for the feedback!
I’ve updated the JSON template with a concrete example and added documentation explaining how it can be used with pytm’s JSON import functionality (TM.load()).

The goal of this template is to provide a simple starting point so users don’t need to write the full Python code when creating an initial threat model.

Please let me know if you’d like me to adjust the format or add more examples.

@izar
Copy link
Collaborator

izar commented Jan 28, 2026

This is a great idea, thanks - but would it be possible for you to use the existing tm.py as the example for the JSON ? It would make things more consistent by offering two views of the same system.

Also, be advised: we may be deprecating the JSON functionality in favor of the CycloneDX TMBOM quite soon.

@aryangupta060407-web
Copy link
Author

This is a great idea, thanks - but would it be possible for you to use the existing tm.py as the example for the JSON ? It would make things more consistent by offering two views of the same system.

Also, be advised: we may be deprecating the JSON functionality in favor of the CycloneDX TMBOM quite soon.

Thanks a lot for the suggestion, that makes a lot of sense.

Yes, I can update the JSON template to mirror the existing tm.py example so that both represent the same system. That should definitely make the usage clearer and more consistent.

Thanks also for the heads-up about the potential deprecation of JSON in favor of CycloneDX TMBOM. I’ll keep that in mind while updating the example and try to keep the structure as aligned and future-proof as possible.

I’ll push an updated version shortly and would love to get your feedback on it.

@aryangupta060407-web
Copy link
Author

This is a great idea, thanks - but would it be possible for you to use the existing tm.py as the example for the JSON ? It would make things more consistent by offering two views of the same system.

Also, be advised: we may be deprecating the JSON functionality in favor of the CycloneDX TMBOM quite soon.

Thanks for the suggestion!

I’ve updated the JSON template to mirror the existing tm.py example so that both represent the same system. I kept the JSON version simplified but aligned with the core components and flows from tm.py.

Please let me know if you’d like me to include more details from tm.py or adjust the structure further.

@izar
Copy link
Collaborator

izar commented Jan 28, 2026

Are you sure your addition mirrors the tm.py file ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants