업데이트로 돌아가기
New releaseJul 14, 2026

threatcl v0.6.1

자신의 위협 모델을 HCL로 문서화하기

공유

threatcl

HCL을 사용한 위협 모델링

hcltm은 어떻게 되었나요?

hcltm이 threatcl로 이름이 변경되었습니다. 환영합니다!

개요

[!TIP] 새 문서를 읽고 싶으신가요? threatcl.dev를 방문하세요.

위협 모델을 문서화하는 방법은 다양합니다. 간단한 텍스트 파일부터 더 상세한 워드 문서, 완전히 계측된 중앙 집중식 솔루션까지 여러 형태가 있습니다. 위협 모델의 가장 가치 있는 두 가지 속성은 위협을 명확하게 문서화하고 가치 있는 변화를 이끌어낼 수 있는 능력입니다.

threatcl은 다음 목표에 중점을 두어 시스템 위협 모델을 문서화하는 DevOps 우선 접근 방식을 제공하는 것을 목표로 합니다:

  • 간단한 텍스트 파일 형식
  • 간단한 CLI 기반 사용자 경험
  • 버전 관리 시스템(VCS) 통합

이 저장소는 threatcl CLI 소프트웨어의 홈입니다. threatcl 명세는 "인간이 읽고 쓰기에 편리하며, 기계가 생성하고 구문 분석하기 쉬운 JSON 기반 변형"을 목표로 하는 HCL2, HashiCorp의 Configuration Language를 기반으로 합니다. threatcl 명세는 github.com/threatcl/spec에 있습니다. threatcl CLI 소프트웨어와 threatcl 명세를 결합하면 실무자가 HCL로 시스템 위협 모델을 정의할 수 있습니다. 예를 들어:```hcl threatmodel "Tower of London" { description = "A historic castle" author = "@xntrik"

attributes { new_initiative = "true" internet_facing = "true" initiative_size = "Small" }

information_asset "crown jewels" { description = "including the imperial state crown" information_classification = "Confidential" }

usecase { description = "The Queen can fetch the crown" }

third_party_dependency "community watch" { description = "The community watch helps guard the premise" uptime_dependency = "degraded" }

threat "Crown theft" { description = "Someone who isn't the Queen steals the crown" impacts = ["Confidentiality"]

control "Guards" {
  description = "Trained guards patrol tower"
  risk_reduction = 75
}

}

data_flow_diagram_v2 "dfd name" { // ... see below for more information }

}

데이터 흐름 다이어그램을 자동으로 PNG로 변환할 수 있도록 구성하는 방법에 대한 자세한 내용은 [데이터 흐름 다이어그램](#data-flow-diagram)을 참조하세요.

[OWASP Proactive Controls](https://owasp.org/www-project-proactive-controls/) 및 [AWS Security Checklist](https://d1.awsstatic.com/whitepapers/Security/AWS_Security_Checklist.pdf)에 대한 사전 정의된 제어 라이브러리를 참조하는 방법의 예는 [examples/tm3.hcl](https://github.com/threatcl/threatcl/blob/HEAD/examples/tm3.hcl)을 참조하세요. 또한 [MITRE ATT&CK Controls](https://attack.mitre.org/mitigations/enterprise/)가 [여기](https://github.com/threatcl/threatcl/blob/HEAD/examples/MITRE_ATTACK_controls.hcl)에 있습니다.

외부 위협 모델을 자신의 위협 모델에 포함시켜 모든 정보를 참조하고 사용할 수도 있습니다. 예시는 [examples/including-example/corp-app.hcl](https://github.com/threatcl/threatcl/blob/HEAD/examples/including-example/corp-app.hcl)을 참조하세요.

사양의 전체 설명을 보려면 [여기](https://github.com/threatcl/threatcl/blob/HEAD/spec.hcl)를 참조하거나 다음을 실행하세요:```bash
threatcl generate boilerplate

threatcl은 JSON 파일도 처리할 수 있지만, 유일한 단점은 가져오기 모듈과 변수가 작동하지 않는다는 것입니다. 예를 들어 examples/tm1.json을 참조하세요.

왜 HCL인가?

HCL은 HashiCorp 제품에서 사용되는 기본 구성 언어이며, 특히 그들의 오픈소스 Infrastructure-as-Code 소프트웨어인 Terraform에서 사용됩니다. 저는 HashiCorp에서 잠시 근무했는데 그 언어가 정말 마음에 들었습니다. 게다가 DevOps 및 소프트웨어 엔지니어들이 이 언어를 사용하고 있다면, 위협 모델을 문서화하는 방식을 간소화하는 것은 threatcl의 목표와 일치합니다.

threatcl을 JSON과 함께 사용할 수 있지만, 일부 기능이 손실됩니다. 자세한 내용은 examples/ 폴더를 참조하세요.

왜 MD로 문서화하지 않나요?

프로그래밍 방식으로 상호작용할 수 있는 형식을 사용하는 아이디어가 마음에 들었습니다.

감사의 말 및 참고 자료

threatcl의 기능 중 하나는 HCL 파일로부터 데이터 흐름 다이어그램을 자동 생성하는 것입니다. 이는 Marqeta와 Blake Hitchcockgo-dfd 패키지를 활용합니다. DevOps 속도의 위협 모델에 대한 블로그 게시물을 꼭 확인해보세요.

또한 HashiCorp의 Jamie FinniganTalha Tariq에게 감사드립니다. HashiCorp를 떠난 후에도 이 오픈소스 도구를 계속 개발할 수 있도록 허락해 주셨습니다.

또한 OpenThreatModel 명세를 제공한 IriusRisk 팀에게도 감사드립니다.

threatcl cli

설치

릴리즈 페이지에서 최신 버전을 다운로드하고 threatcl 바이너리를 PATH에 추가하세요.

Homebrew로 설치

Homebrew를 사용하여 threatcl을 설치하세요 — 해당 포뮬러는 homebrew-core에 있습니다:```bash brew install threatcl

## Docker로 실행하기```bash
docker run --rm -it ghcr.io/threatcl/threatcl:latest

릴리스 검증 (빌드 출처)

모든 태그된 릴리스는 SLSA 빌드 출처를 제공합니다 — Sigstore 서명, 키리스 증명서는 GitHub Actions 릴리스 파이프라인에 의해 생성됩니다 (GitHub OIDC → Fulcio, 서명 키 없음). GitHub CLI를 사용하여 이진 파일이나 컨테이너 이미지가 이 저장소의 릴리스 워크플로우에서 실제로 빌드되었는지 확인할 수 있습니다 (gh attestation verify — 추가 도구나 신뢰할 수 있는 키를 관리할 필요 없음).

다운로드한 아카이브 (또는 SHA256SUMS 파일)를 검증합니다:```bash gh attestation verify threatcl_.tar.gz --repo threatcl/threatcl

컨테이너 이미지를 확인하세요 (태그는 자동으로 다이제스트로 해석됩니다):```bash
gh attestation verify oci://ghcr.io/threatcl/threatcl:<version> --repo threatcl/threatcl

실행 중인 정확한 이미지를 고정하려면 직접 다이제스트를 확인하고 다이제스트로 검증(및 풀)하십시오:```bash digest=$(docker buildx imagetools inspect ghcr.io/threatcl/threatcl: --format '{{ .Manifest.Digest }}') gh attestation verify oci://ghcr.io/threatcl/threatcl@${digest} --repo threatcl/threatcl

전체 공급망 상태에 대해서는 [docs/SLSA.md](https://github.com/threatcl/threatcl/blob/HEAD/docs/SLSA.md)를 참조하세요.

## GitHub Actions로 실행하기

`threatcl`은 https://github.com/threatcl/threatcl-action을 사용하여 GitHub 리포지토리에 직접 통합할 수 있습니다. 이는 위협 모델을 관리하는 이상적인 방법 중 하나이며, 버전 관리 시스템에 통합하려는 목표를 달성하는 데 도움이 됩니다.

## 소스에서 빌드하기

1. 이 리포지토리를 클론합니다.
2. `threatcl` 디렉토리로 이동합니다.
3. `make bootstrap`
4. `make build`

`threatcl`에 기여하는 방법에 대한 자세한 내용은 [CHANGELOG.md](https://github.com/threatcl/threatcl/blob/HEAD/CHANGELOG.md)를 참조하세요.

## 사용법

모든 하위 명령어에 대한 도움말은 `-h` 플래그를 사용하세요.```bash
$ threatcl
Usage: threatcl [--version] [--help] <command> [<args>]

Available commands are:
    cloud        Interact with ThreatCL Cloud services
    dashboard    Generate markdown files from existing HCL threatmodel file(s)
    dfd          Generate Data Flow Diagram PNG or DOT files from existing HCL threatmodel file(s)
    export       Export threat models into other formats
    generate     Generate an HCL Threat Model
    list         List Threatmodels found in HCL file(s)
    mcp          Model Context Protocol (MCP) server for threatcl
    mermaid      Output raw mermaid source from 'mermaid' blocks in existing HCL threatmodel file(s)
    query        Execute GraphQL queries against threat model data
    server       Start a GraphQL API server for threat models
    terraform    Parse output from 'terraform show -json'
    validate     Validate existing HCL Threatmodel file(s)
    view         View existing HCL Threatmodel file(s)

(선택 사항) 설정 파일

대부분의 threatcl 명령어에는 config.hcl 파일을 지정할 수 있는 -config 플래그가 있습니다. 이 파일 내의 HCL을 사용하여 threatcl의 일부 기본 속성을 재정의할 수 있습니다. 다음은 그 목록입니다:

  • 이니셔티브 크기 - 기본값: "Undefined", "Small", "Medium", "Large"
  • 기본 이니셔티브 크기 - 기본값: "Undefined"
  • 정보 분류 - 기본값: "Restricted", "Confidential", "Public"
  • 기본 정보 분류 - 기본값: "Confidential"
  • 영향 유형 - 기본값: "Confidentiality", "Integrity", "Availability"
  • STRIDE 요소 - 기본값: "Spoofing", "Tampering", "Info Disclosure", "Denial Of Service", "Elevation Of Privilege"
  • 가동 시간 종속성 분류 - 기본값: "none", "degraded", "hard", "operational"
  • 기본 가동 시간 종속성 분류 - 기본값: "none"

예를 들어:```hcl initiative_sizes = ["S", "M", "L"] default_initiative_size = "M" info_classifications = ["1", "2"] default_info_classification = "1" impact_types = ["big", "small"] strides = ["S", "T"] uptime_dep_classifications = ["N", "D"] default_uptime_dep_classification = "N"

이러한 속성을 수정하는 경우, 다른 작업을 위해 설정 파일을 제공해야 함을 기억해야 합니다. 이는 유효성 검사 또는 대시보드 생성에 영향을 줄 수 있습니다.

## Cloud 명령어

자세한 내용은 https://threatcl.dev/cloud/overview/에서 `cloud` 하위 명령어에 대해 읽어보세요.

## 목록 및 보기

`threatcl list` 및 `threatcl view` 명령어는 `threatcl` 사양 HCL 파일의 데이터를 나열하고 확인하는 데 사용할 수 있습니다.```bash
$ threatcl list examples/*
#  File              Threatmodel      Author
1  examples/tm1.hcl  Tower of London  @xntrik
2  examples/tm1.hcl  Fort Knox        @xntrik
3  examples/tm2.hcl  Modelly model    @xntrik

검증

threatcl validate 명령은 threatcl 스펙 HCL 파일을 검증하는 데 사용됩니다.```bash $ threatcl validate examples/* Validated 3 threatmodels in 3 files

### 불변 조건

`threatcl validate`는 또한 조직 전체의 불변 조건을 강제할 수 있습니다 — 기계 검사 규칙, 예를 들어 "공개 엔드포인트는 인증되지 않아야 한다" 또는 "모든 인터넷 연결 기능은 감사 로깅을 문서화해야 한다" — 검증된 모든 위협 모델에 대해:```bash
$ threatcl validate -invariants=invariants.hcl ./models/
Validated 4 threatmodels in 3 files
Invariant violation [error] 'threats_have_implemented_controls': threat 'Credential theft' in threatmodel 'Payments' (models/payments.hcl): Every threat must have at least one implemented control
Checked 3 invariants against 4 threatmodels: 1 errors, 0 warnings, 1 exemptions

불변성은 자체 HCL 파일에 존재하며, 특정 컬렉션(위협, 통제, DFD 프로세스, 흐름 등)을 대상으로 하고, 조건을 네이티브 HCL 표현식으로 표현합니다. error/warning 심각도와 모델별 예외(근거 포함)를 지원합니다. 자세한 내용은 docs/invariants.md를 참조하세요.

Export

threatcl export 명령은 threatcl 위협 모델(들)을 기본 JSON 표현(기본값)으로 내보내거나, OTM json 표현으로 내보내거나, 심지어 다시 hcl로 내보내는 데 사용됩니다(동적 위협 모델에서 새로운 HCL을 출력하는 데 유용함). -output 플래그를 사용하여 파일에 직접 저장할 수도 있습니다.```bash $ threatcl export -format=otm examples/tm1.hcl [{"assets":[{"description":"including the imperial state crown","id":"crown-jewels","name":"crown jewels","risk":{"availability":0,"confidentiality":0,"integrity":0}}],"mitigations":[{"attributes":{"implementation_notes":"They are trained to be guards as well","implemented":true},"description":"Lots of guards patrol the area","id":"lots-of-guards","name":"Lots of Guards","riskReduction":80}],"otmVersion":"0.2.0","project":{"attributes":{"initiative_size":"Small","internet_facing":true,"network_segment":"dmz","new_initiative":true},"description":"A historic castle","id":"tower-of-london","name":"Tower of London","owner":"@xntrik"},"threats":[{"categories":["Confidentiality"],"description":"Someone who isn't the Queen steals the crown","id":"threat-1","name":"Threat 1","risk":{"impact":0,"likelihood":null}}]},{"assets":[{"description":"Lots of gold","id":"gold","name":"Gold","risk":{"availability":0,"confidentiality":0,"integrity":0}}],"mitigations":[{"attributes":{"implemented":true},"description":"A large wall surrounds the fort","id":"big-wall","name":"Big Wall","riskReduction":80}],"otmVersion":"0.2.0","project":{"attributes":{"initiative_size":"Small","internet_facing":true,"new_initiative":false},"description":"A .. fort?","id":"fort-knox","name":"Fort Knox","owner":"@xntrik"},"threats":[{"categories":["Confidentiality"],"description":"Someone steals the gold","id":"threat-1","name":"Threat 1","risk":{"impact":0,"likelihood":null}}]}]

## 생성

`threatcl generate` 명령어는 일반적인 `boilerplate` `threatcl` 스펙 HCL 파일을 출력하거나, 대화형으로 사용자에게 질문을 한 후 `threatcl` 스펙 HCL 파일을 출력하는 데 사용됩니다.

### 대화형 생성

다음 예시를 참조하십시오:```bash
threatcl generate interactive

대화형 편집기 생성

$EDITOR에서 직접 작업하려면 다음을 실행하세요:```bash threatcl generate interactive editor

이렇게 하면 기본 HCL 위협 모델이 포함된 편집기가 열립니다. 생성 후 모델의 유효성을 검사하려면 `-validate` 플래그를 사용하세요.

## MCP

`threatcl mcp` 명령어는 로컬 [MCP](https://modelcontextprotocol.io/introduction) 서버를 노출하여 MCP 호스트(예: [Claude Desktop](https://claude.ai/download), [Cursor](https://www.cursor.com/) 등 AI/LLM 애플리케이션 또는 MCP를 지원하는 다른 애플리케이션)를 통해 threatcl hcl 파일과 상호작용할 수 있게 해줍니다.

이 명령어는 `-dir=<path>`라는 선택적 인수를 하나 받으며, 이 인수를 사용하면 추가 MCP 도구가 해당 경로 내의 파일과 상호작용할 수 있습니다. 이 설정이 없으면 MCP 도구는 문자열과 상호작용할 수 있지만, 기본 파일 시스템과 상호작용하려면 MCP 호스트 내의 다른 메커니즘에 의존하게 됩니다.

이 기능은 현재 상당히 베타 단계라고 말할 수 있습니다.

## LSP (Language Server)

`threatcl lsp` 명령어는 stdio를 통해 [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) 서버를 실행하여, LSP를 지원하는 편집기에 threatcl HCL 위협 모델에 대한 실시간 진단, 자동 완성, 호버, 문서 기호 및 서식 지정을 제공합니다.

이 명령어는 수동으로 실행하는 것이 아니라 편집기의 LSP 클라이언트에 의해 실행됩니다. threatcl 파일은 Terraform 및 기타 HCL 방언과 `.hcl` 확장자를 공유하므로, `*.tm.hcl`에 매칭하거나 (클라이언트의 범위를 위협 모델 워크스페이스로 지정)하면 Terraform 언어 서버와 충돌하는 것을 피할 수 있습니다.

편집기 설정(Neovim, Helix, VS Code, Zed) 및 현재 제한 사항에 대해서는 [docs/lsp.md](https://github.com/threatcl/threatcl/blob/HEAD/docs/lsp.md)를 참조하세요.

## Server (GraphQL API)

`threatcl server` 명령어는 GraphQL API 서버를 시작하여 위협 모델을 HTTP를 통해 노출하여 프로그래밍 방식의 쿼리 및 통합을 가능하게 합니다.

### Basic Usage```bash
# Start the server
$ threatcl server -dir ./examples

# With file watching for auto-reload
$ threatcl server -dir ./examples -watch

# Custom port
$ threatcl server -dir ./examples -port 3000

http://localhost:8080로 이동하여 대화형 GraphQL Playground에 액세스하세요.

예제 쿼리```graphql

query { stats { totalThreatModels totalThreats implementedControls }

threatModels(filter: { internetFacing: true }) { name threats { description controls { name implemented } } } }

### 문서

완전한 API 문서, 스키마 참조, 고급 쿼리 및 통합 예제는 다음을 참조하세요:
- **전체 API 문서**: [docs/graphql-api.md](https://github.com/threatcl/threatcl/blob/HEAD/docs/graphql-api.md)
- **쿼리 예제**: [examples/graphql-queries.md](https://github.com/threatcl/threatcl/blob/HEAD/examples/graphql-queries.md)

## 쿼리 (GraphQL CLI)

`threatcl query` 명령어는 서버를 시작하지 않고 명령줄에서 직접 GraphQL 쿼리를 실행합니다. 이는 자동화, CI/CD 파이프라인 및 쉘 스크립팅에 이상적입니다.

### 기본 사용법```bash
# Get statistics
$ threatcl query -dir ./examples -query '{ stats { totalThreats } }'

# Query from file
$ threatcl query -dir ./examples -file queries/get-stats.graphql

# Use in scripts
$ THREATS=$(threatcl query -dir ./examples \
    -query '{ stats { totalThreats } }' \
    -output compact | jq -r '.data.stats.totalThreats')
$ echo "Found $THREATS threats"

출력 형식

  • pretty (기본값): 들여쓰기된 포맷 JSON
  • json: pretty와 동일
  • compact: 스크립팅용 한 줄 JSON

변수를 사용한 쿼리```bash

$ threatcl query -dir ./examples
-query 'query($author: String) { threatModels(filter: {author: $author}) { name } }'
-vars '{"author": "John Doe"}'

### CI/CD 예제```bash
#!/bin/bash
# Check if all controls are implemented before deployment

UNIMPLEMENTED=$(threatcl query -dir ./threatmodels \
  -query '{ stats { totalControls implementedControls } }' \
  -output compact | jq -r '.data.stats.totalControls - .data.stats.implementedControls')

if [ "$UNIMPLEMENTED" -gt 0 ]; then
  echo "ERROR: $UNIMPLEMENTED controls are not yet implemented"
  exit 1
fi

echo "All controls implemented, proceeding with deployment"

사용 가능한 쿼리 및 GraphQL 스키마는 docs/graphql-api.md를 참조하세요.

대시보드

threatcl dashboard 명령은 threatcl 사양 HCL 파일을 가져와 여러 markdown 및 png 파일을 생성하여 선택한 폴더에 저장합니다.```bash $ threatcl dashboard -overwrite -outdir=dashboard-example examples/* Created the 'dashboard-example' directory Writing dashboard markdown files to 'dashboard-example' and overwriting existing files Successfully wrote to 'dashboard-example/tm1-toweroflondon.md' Successfully wrote to 'dashboard-example/tm1-fortknox.md' Successfully wrote to 'dashboard-example/tm2-modellymodel.png' Successfully wrote to 'dashboard-example/tm2-modellymodel.md' Successfully wrote to 'dashboard-example/dashboard.md'

### 사용자 정의 마크다운 템플릿

`threatcl dashboard` 명령은 선택적 플래그를 사용하여 사용자 정의 템플릿을 지정할 수도 있습니다 (Golang의 [text/template](https://pkg.go.dev/text/template) 참조).

대시보드 템플릿 파일을 지정하려면 `-dashboard-template` 플래그를 사용하세요. 예제는 [dashboard-template.tpl](https://github.com/threatcl/threatcl/blob/HEAD/examples/dashboard-template.tpl)을 참조하세요.

위협 모델 템플릿 파일을 지정하려면 `-threatmodel-template` 플래그를 사용하세요. 예제는 [threatmodel-template.tpl](https://github.com/threatcl/threatcl/blob/HEAD/examples/threatmodel-template.tpl)을 참조하세요.

### 대시보드 인덱스 파일의 사용자 정의 파일명

`threatcl dashboard` 명령은 선택적 플래그를 사용하여 생성된 "index" 대시보드 파일의 파일명을 지정할 수도 있습니다. 기본적으로 이 파일은 `dashboard.md`입니다. 확장자 없이 `-dashboard-filename` 플래그를 사용하여 이 파일명을 변경하세요.

## 데이터 흐름 다이어그램

[spec](https://github.com/threatcl/threatcl/blob/HEAD/spec.hcl)에 따라 `threatmodel`은 `data_flow_diagram_v2` 블록을 포함할 수 있습니다. 간단한 DFD의 예제는 [여기](https://github.com/threatcl/threatcl/blob/HEAD/examples/tm2.hcl)에서 확인할 수 있습니다. 이전의 단일 사용 블록 `data_flow_diagram`은 언젠가 더 이상 사용되지 않을 예정이므로, `data_flow_diagram_v2` 명명된 블록을 사용하는 것이 좋습니다. 그러면 여러 개의 관련 DFD를 가질 수 있습니다.

`threatcl dfd` 명령은 `threatcl` 사양 HCL 파일을 받아 여러 png 파일을 생성하고 선택한 폴더에 저장합니다.

HCL 파일에 `data_flow_diagram` 또는 `data_flow_diagram_v2` 블록이 있는 `threatmodel` 블록이 포함되지 않으면 아무것도 출력되지 않습니다.

명령 자체는 Dashboard 명령과 매우 유사합니다.```bash
$ threatcl dfd -overwrite -outdir testout examples/*
Successfully created 'testout/tm2-modellymodel.png'

만약 threatmodeldiagram_link를 포함하지 않고 data_flow_diagram을 포함하는 경우, threatcl dashboard 실행 시 이 또한 렌더링됩니다.

Mermaid

spec에 따르면, threatmodel은 자유 형식의 mermaid 블록을 포함할 수도 있습니다. (threatcl이 자동으로 렌더링하는) data_flow_diagram_v2와 달리, mermaid 블록은 원시 mermaid 소스를 있는 그대로 포함합니다. mermaid는 콘텐츠의 첫 줄로부터 다이어그램 유형(순서도, 상태도, 플로우차트 등)을 추론합니다.

threatcl mermaid 명령은 해당 원시 소스를 추출하여 다른 렌더링 도구로 파이프할 수 있도록 합니다. 자체적으로 이미지를 렌더링하지는 않습니다.

기본적으로 소스는 STDOUT으로 출력됩니다:```bash $ threatcl mermaid examples/tm2.hcl sequenceDiagram User->>App: credentials App->>Auth: verify Auth-->>App: token

이것은 [mermaid-cli](https://github.com/mermaid-js/mermaid-cli)와 같은 렌더러로 파이프하기 쉽게 만듭니다:```bash
$ threatcl mermaid model.hcl | mmdc -o diagram.svg -i -

여러 개의 mermaid 블록이 있는 경우, -index=n을 사용하여 하나를 선택하거나, -outdir을 사용하여 모두 디렉토리에 쓸 수 있습니다(블록당 하나의 .mmd 파일). 또한 -out을 사용하여 하나의 블록을 파일에 쓸 수 있습니다.```bash $ threatcl mermaid -outdir testout model.hcl Successfully created 'testout/model-mymodelloginsequence.mmd'

## Terraform

`threatcl terraform` 명령은 `terraform show -json` [문서](https://www.terraform.io/docs/cli/commands/show.html)의 출력에서 플랜 파일 또는 활성 상태 파일의 데이터 리소스를 추출하고, 이를 초안 `information_asset` 블록으로 변환하여 `threatcl` 파일에 포함시킬 수 있습니다.

만약 기존 상태가 있는 폴더에 있다면, 다음을 실행할 수 있습니다:```bash
terraform show -json | threatcl terraform -stdin

이것은 다음과 유사한 출력을 생성합니다:```bash information_asset "aws_rds_cluster default" { description = "cluster_identifier: aurora-cluster-demo, database_name: mydb" information_classification = "" source = "terraform state" } information_asset "aws_s3_bucket example" { description = "bucket: terraform-20211107232017071500000001" information_classification = "" source = "terraform state" }

또한 Terraform으로 아직 적용되지 않은 계획 파일에서 유사한 출력을 다음을 실행하여 확인할 수 있습니다:```bash
terraform show -json <plan-file> | threatcl terraform -stdin

기존 threatcl 위협 모델 파일("threatmodel.hcl")을 업데이트하려면 다음을 사용할 수 있습니다:```bash terraform show -json | threatcl terraform -stdin -add-to-existing=threatmodel.hcl > new-threatmodel.hcl

`-add-to-existing` 플래그를 사용하면, 소스 파일에 여러 위협 모델이 있을 경우 특정 위협 모델을 지정하기 위해 `-tm-name=<string>`을 함께 지정할 수 있습니다. 또한 `-default-classification=Confidential` 플래그를 사용하여 기본 분류를 적용할 수 있습니다.

이 명령들은 파일을 입력으로 받을 수도 있습니다. 이 경우에는 `-stdin` 플래그를 생략합니다.

`threatcl`이 인식하는 terraform 리소스는 [pkg/terraform/terraform.go](https://github.com/threatcl/threatcl/blob/HEAD/pkg/terraform/terraform.go)에 하드코딩되어 있습니다. `threatcl terraform` 명령이 거기에 없는 다른 `information_asset` 리소스를 출력하도록 하려면 `-tf-collection=<json file>` 플래그를 통해 사용자 정의 버전의 json을 제공할 수 있습니다.

카테고리