Skip to Content
Inventory

Annotate Assets

Tag assets with custom key-value metadata to group them into workspaces and tell Mondoo how critical and exposed each asset is.

A Mondoo annotation is a key-value pair you attach to an asset. Annotations let you record the things Mondoo can't discover on its own, such as owner, team, project, ticket number, or physical asset tag, so you can group assets by that context later.

Common examples:

KeyValue
ownercosmo@lunalectric.com
team01research
buildterraform
asset-tagluna000262

Some keys you'll use the same value for across many assets (build: terraform). Others get a unique value per asset (asset-tag: luna000262).

Annotations show up on the asset page in the Mondoo App and get included when you export data. You can also use them to group assets: a workspace can select assets by annotation.

Some annotation keys also feed Mondoo's risk dimensions. For example, mondoo.com/business-priority: business-critical raises the risk score of every finding on the asset, while mondoo.com/business-priority: test lowers it. The asset's Edit asset dialog has pickers for business priority, attack surface, blast radius, and CIA rating, so you don't need to remember the exact values.

To mark an asset as internet exposed when Mondoo can't detect it, add the key mondoo.com/internet-exposed with the value true to its annotations list. Mondoo picks up the annotation on the asset's next scan. The Edit asset dialog has no picker for this key. Choosing Internet-facing in its Attack surface picker changes the asset's attack surface, but it doesn't give the asset the Internet Exposed risk factor. To learn more, read How Mondoo detects internet exposure.

An owner annotation like the one above doesn't make anyone an owner of the asset in Mondoo. To make teams and people the asset's owners in Mondoo, use the mondoo.com/owners annotation instead. To learn how, read Set asset owners with an annotation.

Most annotations are metadata you add in Mondoo. They aren't the same as AWS tags, Kubernetes labels, or other metadata Mondoo collects from the asset itself. Those show up separately, in the Tags list on the asset page.

Annotations Mondoo sets for you

Mondoo adds some annotations to assets itself:

  • mondoo.com/aws-account-id: the 12-digit ID of the AWS account an asset belongs to. Mondoo sets it on the AWS account asset, its AWS resources, and its EC2 instances. ECR images that the AWS serverless integration scans carry it too. So do a Kubernetes cluster that runs in AWS and everything discovered in it, when Mondoo can detect the cluster's AWS account.
  • mondoo.com/aws-org-id: the ID of the AWS organization the account belongs to (it starts with o-). The AWS serverless integration sets it on the assets it scans when the account is in an organization it can read.

Use them to build a workspace for one AWS account or organization. For example, a workspace with an Annotations CONTAINS condition with the key mondoo.com/aws-account-id and the value 123456789012 includes the assets that carry that account ID. To learn more, read Group assets by AWS account or vSphere tag.

Add or edit annotations in the Mondoo App

To change annotations, you need the Editor or Owner role, or another role with this permission. To see every role, read Roles and permissions.

  1. In the Mondoo App, navigate to the asset you want to annotate.

  2. At the top of the asset page, select the pencil button next to SHARE to open the Edit asset dialog.

    The Edit asset dialog for a Mondoo asset, with Business priority, Blast radius, and CIA rating not set and only the automatically detected attack surface annotation

  3. To set a risk dimension, choose a value from its picker:

    PickerAnnotation keyValues
    Business prioritymondoo.com/business-priorityBusiness-critical, Development system, Test environment
    Attack surfacemondoo.com/user-attack-surfaceInternet-facing, Network-accessible, Localhost only, System-local, Not exposed
    Blast radiusmondoo.com/blast-radiusDatabases & data stores, Identity & auth systems, LLM agent, Open network connections, Kubernetes orchestration, Cryptographic key access
    CIA ratingmondoo.com/cia0 (public information) through 3 (critical data, strict CIA requirements)

    Mondoo saves your choice as the matching annotation. The value stays in its picker instead of appearing in the annotations list, and you can clear it by choosing Not set. To learn how each value changes the risk score, read Risk Dimensions.

    The Attack surface picker saves to its own key, mondoo.com/user-attack-surface, so a scan can't overwrite your pick. Mondoo uses the first attack surface it finds in this order: your pick in Edit asset, then a mondoo.com/attack-surface annotation from a scan, the asset's annotations list, the space, or the organization, then the attack surface Mondoo detected. While you haven't picked a value, the picker's first option shows the attack surface that applies, followed by (automatic), or Not set if none applies. To clear your pick, choose the first option. A mondoo.com/attack-surface key you add to the annotations list stays in the list. It sets the attack surface only while you haven't picked one, and a later scan that sends the same key replaces it.

  4. To add any other annotation, select Add annotation (or the + button if the asset already has annotations), enter a key and value, then select the check mark.

    Adding an asset-tag annotation with the value luna000262 in the Edit asset dialog

  5. To change an annotation, select it to make the key and value editable. Edit either field and confirm with the check mark, or select the trash can to delete the annotation. You can also remove an annotation directly by selecting the x on it.

    Editing an existing business-priority annotation in the Edit asset dialog

  6. Select SAVE CHANGES. Nothing changes on the asset until you save, and CANCEL discards your edits. Your annotations then appear on the asset's Overview tab: in the Annotations section of the overview card for an operating system, or in the Mondoo Annotations list at the bottom of the Configuration section for other assets.

Add annotations when scanning with cnspec

If you're scanning assets with cnspec from a CI/CD pipeline, a workstation, or a server, you can set annotations at scan time instead of clicking through the UI.

From the command line

Pass --annotation key=value to cnspec scan:

cnspec scan local --annotation asset-tag=luna000264

You can pass the flag multiple times to add multiple annotations.

From the local Mondoo configuration

Add an annotations block to the local mondoo.yml config on the asset. Every scan from that asset picks up the annotations.

On Linux, the file lives at:

  • /etc/opt/mondoo/mondoo.yml (applies to every user on the host)
  • ~/.config/mondoo/mondoo.yml (applies to one user)

On macOS:

  • /Library/Mondoo/etc/mondoo.yml (applies to every user on the host)
  • ~/.config/mondoo/mondoo.yml (applies to one user)

On Windows:

  • C:\ProgramData\Mondoo\mondoo.yml (applies to every user)
  • C:\Users\{username}\.config\mondoo\mondoo.yml (applies to one user)
annotations:
  team: research
  owner: cosmo@lunalectric.com

From a cnspec inventory file or template

A cnspec inventory file lists the assets to scan. You can attach annotations to each asset in that file:

spec:
  assets:
    - name: web-prod-1
      connections:
        - type: local
      annotations:
        project: mars-rover

For CI/CD pipelines, an inventory template lets you pull values from environment variables so one file works for many runs:

spec:
  assets:
    - name: '{{ getenv "ASSET_NAME" }}'
      connections:
        - type: local
          discover:
            targets:
              - auto
      annotations:
        project: '{{ getenv "PROJECT" }}'

Run the scan with the variables set:

ASSET_NAME="web-prod-1" PROJECT="mars-rover" cnspec scan --inventory-template template.yaml

Next steps

Last updated on

On this page