Skip to content

Threatmodel block

Each threatcl hcl file has to include one more unique threatmodel blocks.

threatmodel attributes

AttributeTypeReq’dDescription
NAMElabel string Specifies the name of the threat model
authorstring Specifies the author of the threat model
descriptionstringDescribes the threat model
linkstringAn href to other documentation
diagram_linkstringAn href to a diagram. (see diagram_link)
created_atintegerCreation UNIX timestamp
updated_atintegerUpdated UNIX timestamp
attributesblockSee attributes
additional_attributesblockSee additional_attributes
usecaseblockSee usecase
exclusionblockSee exclusion
third_party_dependencyblockSee third_party_dependency
information_assetblockSee information_asset
threatblockSee threat
includingstringSee including
importsarray [string]See imports

If it ends in .jpg or .png then it will be embedded in the resultant dashboard. If this isn’t set, but there is a data flow diagram, this will be automatically generated and included when running threatcl dashboard

attributes

The attributes block is optional, but recommended. It includes the following attributes.

AttributeTypeRequiredDescription
new_initiativeboolean Whether this is a new project
internet_facingboolean Whether this system is exposed to the Internet
initiative_sizestring Undefined, Small, Medium, Large

additional_attributes

Your threatmodel may include multiple additional_attributes blocks, with unique labels. It includes the following attributes.

AttributeTypeRequiredDescription
NAMElabel string The name of the attribute
valuestring The value of the attribute

usecase

Your threatmodel may include multiple usecase blocks. These don’t have labels or identifiers. It includes the following attribute.

AttributeTypeRequiredDescription
descriptionstring A description of the system’s use case

exclusion

Your threatmodel may include multiple exclusion blocks. These don’t have labels or identifiers. It includes the following attribute.

AttributeTypeRequiredDescription
descriptionstring Define of out-of-scope exclusions of the threatmodel

third_party_dependency

Your threatmodel may include multiple third_party_dependency blocks, with unique labels. It includes the following attributes.

AttributeTypeRequiredDescription
NAMElabel string The name of the 3rd party dep
descriptionstring A description of the 3rd party dep
uptime_dependencystring none, degraded, hard, operational
saasbooleanIs this a SaaS dep?
paying_customerbooleanAre we paying for it?
open_sourcebooleanIs this OSS?
infrastructurebooleanIs this Infra?
uptime_notesstringNotes about what happens if unavailable

information_asset

Your threatmodel may include multiple information_asset blocks, with unique labels. It includes the following attributes.

AttributeTypeRequiredDescription
NAMElabel string The name of the asset
descriptionstringDescribe the asset
information_classificationstring Public, Confidential, Restricted
sourcestringWhere was block sourced from
i.e. terraform

threat

Your threatmodel may include multiple threat blocks. These don’t have labels or identifiers. It includes the following attributes.

AttributeTypeRequiredDescription
descriptionstring Describe the threat
impactsarray [string]Confidentiality, Integrity, Availability
stridearray [string]Spoofing,
Tampering,
Repudiation,
Info Disclosure,
Denial of Service,
Elevation of Privilege
information_asset_refsarray [string]Refer to information_asset blocks by their label
expanded_controlblockSee expanded_control

expanded_control

Your threat blocks may include multiple expanded_control blocks, with unique labels. It includes the following attributes.

AttributeTypeRequiredDescription
NAMElabel string The name of the control
descriptionstring Describe the control
implementedbooleanIs it implemented?
implementation_notesstringDescribe the implementation
risk_reducationintegerHow much this control reduces risk
attributeblockSee attribute

attribute

Your expanded_control blocks may include multiple attribute blocks, with unique labels. It includes the following attribute.

AttributeTypeRequiredDescription
NAMElabel string The name of the attribute
valuestring The value of the attribute

data_flow_diagram_v2

Your threatmodel may include multiple data_flow_diagram_v2 blocks, with unique labels. It includes the following attributes.

Unlike other blocks, when you define a process, data_store, or external_element they must have a globally unique label, for that particular dfd. For example, you can’t have a process and data_store called “foo”.

AttributeTypeRequiredDescription
NAMElabel string dfd name
processblockSee process
data_storeblockSee data_store
external_elementblockSee external_element
trust_zoneblockSee trust_zone
flowblockSee flow

process

Your data_flow_diagram_v2 block may include multiple process blocks, with unique labels. It includes the following attributes.

AttributeTypeRequiredDescription
NAMElabel string process name
trust_zonestringdefines a trust boundary / zone

data_store

Your data_flow_diagram_v2 block may include multiple data_store blocks, with unique labels. It includes the following attributes.

AttributeTypeRequiredDescription
NAMElabel string data store name
trust_zonestringdefines a trust boundary / zone
information_assetstringrefers back to a previous information_asset block ref

external_element

Your data_flow_diagram_v2 block may include multiple external_element blocks, with unique labels. It includes the following attributes.

AttributeTypeRequiredDescription
NAMElabel string external element name
trust_zonestringdefines a trust boundary / zone

trust_zone

Your data_flow_diagram_v2 block may include multiple trust_zone blocks, with unique labels. It includes the following attributes.

AttributeTypeRequiredDescription
NAMElabel string trust zone name
processblocksee process
data_storeblocksee data_store
external_elementblocksee external_element

flow

Your data_flow_diagram_v2 block may include multiple flow blocks. A flow must have a label, but it doesn’t have to be unique. But, the from and to attributes must be unique. It includes the following attributes.

AttributeTypeRequiredDescription
NAMElabel string flow title
fromstring refer to a process, external_element or data_store
tostring refer to a process, external_element or data_store

including

Each threatmodel may optionally include an including attribute string that refers to a single other threatcl hcl file.

In this file must be a single, valid threatmodel block.

This included threatmodel will form the base of this new threatmodel. Any duplicate fields in the parent threat model will overwrite those from the included.

See External HCL Files for more information on how to refer to external files.

imports

Each threatmodel may optionally include an imports attribute with an array of string values that refer to other hcl files.

These files are used to centrally define various attributes that you can then refer to in your threatmodel. Currently we only support the definition of “controls”.

An example import file may look like:

controls.hcl
component "control" "control_name" {
description = "A control that can be used in multiple places"
}

To use these imports, you reference to the string value like this:

threatmodel.hcl
threatmodel "tm" {
author = "@xntrik"
description = "A threat model"
imports = ["controls.hcl"]
threat {
description = "Something bad"
expanded_control "control" {
description = import.control.control_name.description
}
}
}

Technically you can use these import values similar to Variables

See External HCL Files for more information on how to refer to external files.