Skip to content

feat(import): add TM7 file import from Microsoft TMT#30

Merged
exitzerolabs-admin merged 2 commits into
mainfrom
feat/import-tm7
Mar 7, 2026
Merged

feat(import): add TM7 file import from Microsoft TMT#30
exitzerolabs-admin merged 2 commits into
mainfrom
feat/import-tm7

Conversation

@exitzerolabs-admin

Copy link
Copy Markdown
Contributor

Summary

  • Add TM7 (Microsoft Threat Modeling Tool) XML import, converting .tm7 files to ThreatForge's native .thf YAML format
  • Preserves elements, data flows, trust boundaries, threats, canvas positions, and STRIDE categories
  • Full import flow: native menu → command palette → file dialog → Rust parser → canvas

What's Included

Rust Backend

  • TM7 XML parser (src-tauri/src/importers/tm7.rs) — ~1000 lines of parser + 14 unit tests
    • Handles all TM7 element types: StencilRectangle (external entity), StencilEllipse (process), StencilParallelLines (data store), BorderBoundary, LineBoundary, Connector
    • STRIDE category mapping from UserThreatCategory with TypeId prefix fallback
    • Containment detection using actual TM7 element dimensions
    • Out-of-scope element exclusion, duplicate name handling, orphaned reference resilience
  • Import command (import_commands.rs) — extensible format dispatch ("tm7" → parser)

Frontend

  • FileAdapter.importThreatModel() — interface + Tauri/Browser implementations
  • useFileOperations.importModel — dirty-state guard, error handling, layout setup, store clearing
  • Native menu "Import…" item + command palette file:import command
  • File path set to null after import (forces Save As to create .thf)

Tests (14 Rust, 1 Frontend)

  • Minimal TM7, empty TM7, unique IDs, STRIDE categories, severity, mitigation status
  • Out-of-scope exclusion, orphaned flow GUIDs, duplicate names, line boundaries
  • Malformed XML error handling, self-loop flows, NeedsInvestigation mapping, unknown TypeId fallback
  • Command registry wiring test

Docs Updated

  • README.md — new "Import from Microsoft TMT" feature section, updated Contributing
  • CONTRIBUTING.md — TM7 import marked as done
  • architecture.md, overview.md, product-design.md — importers module documented
  • releasing-a-version.md — TM7 import in smoke test checklist

Test plan

  • cargo clippy — clean
  • cargo fmt — clean
  • cargo test — 73 tests pass (14 new)
  • npx biome check — clean
  • npx vitest --run — 417 tests pass (1 new)
  • npm run ci:local — all checks pass
  • Manual test: import a real .tm7 file from Microsoft TMT

🤖 Generated with Claude Code

exitzerolabs-admin and others added 2 commits March 7, 2026 09:34
Import .tm7 XML files and convert to native .thf format, preserving elements,
data flows, trust boundaries, threats, positions, and STRIDE categories.

- Rust: TM7 XML parser (quick-xml) with 14 unit tests covering happy path,
  edge cases (empty files, duplicates, out-of-scope, orphaned refs, self-loops,
  line boundaries, malformed XML), and all helper functions
- Rust: import_threat_model Tauri command with format dispatch
- Frontend: FileAdapter.importThreatModel + Tauri/Browser implementations
- Frontend: importModel hook with dirty-state guard, error handling, layout setup
- Native menu "Import…" item + command palette file:import command
- Docs: README, CONTRIBUTING, architecture, overview, product-design, runbook

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Mar 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
threat-forge Ready Ready Preview, Comment Mar 7, 2026 2:35pm

Request Review

@exitzerolabs-admin exitzerolabs-admin added the enhancement New feature or request label Mar 7, 2026
@exitzerolabs-admin exitzerolabs-admin linked an issue Mar 7, 2026 that may be closed by this pull request
@exitzerolabs-admin exitzerolabs-admin merged commit 9350ce6 into main Mar 7, 2026
8 checks passed
@exitzerolabs-admin exitzerolabs-admin deleted the feat/import-tm7 branch March 7, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add TM7 Import support

1 participant