{
  "schemaVersion": 5,
  "edition": {
    "edition": "2026-Q4",
    "reviewedAt": "2026-10-11",
    "nextReview": "2027-01-15"
  },
  "license": "CC-BY-4.0",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ghtier.com/data/cloud-trust.schema.json",
  "title": "ghtier cloud trust file",
  "description": "Cloud identities that trust GitHub Actions through OIDC and what each can do. Written by skills/ghtier-assess/azure.mjs; read by assess.mjs --cloud.",
  "type": "object",
  "required": [
    "provider",
    "version",
    "tenantId",
    "collectedAt",
    "identities",
    "assignments"
  ],
  "properties": {
    "provider": {
      "enum": [
        "azure"
      ],
      "description": "azure today; aws and gcp can use the same shape later."
    },
    "version": {
      "const": 1
    },
    "tenantId": {
      "type": "string"
    },
    "collectedAt": {
      "type": "string",
      "format": "date-time"
    },
    "collector": {
      "type": "string"
    },
    "githubOrg": {
      "type": "string",
      "description": "Set when only identities trusting this organization were kept."
    },
    "subscriptions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        }
      }
    },
    "identities": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "kind",
          "name",
          "federatedCredentials"
        ],
        "properties": {
          "kind": {
            "enum": [
              "app-registration",
              "managed-identity"
            ]
          },
          "name": {
            "type": "string"
          },
          "appId": {
            "type": "string"
          },
          "applicationId": {
            "type": "string"
          },
          "resourceId": {
            "type": "string"
          },
          "principalId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The service principal's object ID; null when it could not be read."
          },
          "federatedCredentials": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "issuer"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "issuer": {
                  "type": "string"
                },
                "subject": {
                  "type": "string"
                },
                "claimsMatchingExpression": {
                  "type": "string",
                  "description": "A flexible credential's expression, for example claims['sub'] matches 'repo:org/*:pull_request'."
                },
                "audiences": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "assignments": {
      "type": "array",
      "description": "Azure role assignments of the identities, at every level, including through groups.",
      "items": {
        "type": "object",
        "required": [
          "principalId",
          "roleName",
          "scope",
          "scopeType"
        ],
        "properties": {
          "principalId": {
            "type": "string"
          },
          "viaGroup": {
            "type": "string"
          },
          "roleName": {
            "type": "string"
          },
          "roleDefinitionId": {
            "type": "string"
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "notActions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "dataActions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "notDataActions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "scope": {
            "type": "string"
          },
          "scopeType": {
            "enum": [
              "root",
              "managementGroup",
              "subscription",
              "resourceGroup",
              "resource"
            ]
          }
        }
      }
    },
    "keyVaultPolicies": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "principalId": {
            "type": "string"
          },
          "vault": {
            "type": "string"
          },
          "secrets": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "keys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "certificates": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    },
    "directoryRoles": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "principalId": {
            "type": "string"
          },
          "roleName": {
            "type": "string"
          },
          "roleDefinitionId": {
            "type": "string"
          },
          "isPrivileged": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "directoryScopeId": {
            "type": "string"
          }
        }
      }
    },
    "appPermissions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "principalId": {
            "type": "string"
          },
          "resource": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        }
      }
    },
    "scopeIdentities": {
      "type": "array",
      "description": "Managed identities in resource groups and resources where an identity can do more than read, with their own assignments (D8.2).",
      "items": {
        "type": "object",
        "properties": {
          "scope": {
            "type": "string"
          },
          "identities": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      }
    },
    "notRead": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "what": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          }
        }
      }
    }
  }
}
