Files
awoooi/docs/schemas/telegram_canonical_routing_registry_v1.schema.json

310 lines
10 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://awoooi.wooo.work/schemas/telegram_canonical_routing_registry_v1.schema.json",
"title": "Telegram Canonical Routing Registry v1",
"type": "object",
"additionalProperties": false,
"required": [
"schema_version",
"generated_at",
"status",
"mode",
"supersedes",
"policy",
"destination_roles",
"products",
"routes",
"rollups",
"execution_boundaries"
],
"properties": {
"schema_version": {
"const": "telegram_canonical_routing_registry_v1"
},
"generated_at": {"type": "string", "format": "date-time"},
"status": {"const": "source_policy_ready_runtime_not_applied"},
"mode": {"const": "source_only_no_secret_no_telegram_send_no_route_change"},
"supersedes": {
"type": "object",
"additionalProperties": false,
"required": [
"policy_ref",
"superseded_behavior",
"superseded_by",
"owner",
"expiry",
"replacement",
"verifier"
],
"properties": {
"policy_ref": {"type": "string", "minLength": 1},
"superseded_behavior": {"type": "string", "minLength": 1},
"superseded_by": {"const": "global_product_governance_v2"},
"owner": {"type": "string", "minLength": 1},
"expiry": {"type": "string", "format": "date-time"},
"replacement": {"type": "string", "minLength": 1},
"verifier": {"type": "string", "minLength": 1}
}
},
"policy": {
"type": "object",
"additionalProperties": false,
"required": [
"default_decision",
"unknown_product_decision",
"unknown_signal_family_decision",
"unknown_severity_decision",
"unknown_destination_decision",
"legacy_runtime_resolver",
"legacy_shared_sre_allowed_types",
"legacy_shared_sre_blocked_types",
"raw_chat_id_allowed",
"shared_sre_rule",
"shared_sre_forbidden"
],
"properties": {
"default_decision": {"const": "block"},
"unknown_product_decision": {"const": "block"},
"unknown_signal_family_decision": {"const": "block"},
"unknown_severity_decision": {"const": "block"},
"unknown_destination_decision": {"const": "block"},
"legacy_runtime_resolver": {"type": "string", "minLength": 1},
"legacy_shared_sre_allowed_types": {
"type": "array",
"minItems": 7,
"maxItems": 7,
"uniqueItems": true,
"items": {
"enum": ["TYPE-2", "TYPE-3", "TYPE-4", "TYPE-4D", "TYPE-5S", "TYPE-7E", "TYPE-8M"]
}
},
"legacy_shared_sre_blocked_types": {
"type": "array",
"minItems": 3,
"maxItems": 3,
"uniqueItems": true,
"items": {"enum": ["TYPE-1", "TYPE-6B", "UNKNOWN"]}
},
"raw_chat_id_allowed": {"const": false},
"shared_sre_rule": {"type": "string", "minLength": 1},
"shared_sre_forbidden": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {"type": "string", "minLength": 1}
}
}
},
"destination_roles": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"propertyNames": {
"not": {
"pattern": "(?:[Cc][Hh][Aa][Tt][_-]?[Ii][Dd]|[Tt][Oo][Kk][Ee][Nn]|[Ss][Ee][Cc][Rr][Ee][Tt]|[Aa][Uu][Tt][Hh][Oo][Rr][Ii][Zz][Aa][Tt][Ii][Oo][Nn]|[Ww][Ee][Bb][Hh][Oo][Oo][Kk])"
}
},
"required": [
"visible_label",
"proven_runtime_alias",
"runtime_alias_evidence",
"chat_alias",
"bot_alias",
"bot_owner",
"monitoring_owner",
"role",
"monitoring_egress_policy",
"runtime_identifier_in_registry"
],
"properties": {
"visible_label": {
"type": "string",
"minLength": 1,
"pattern": "^(?!-?[0-9]{8,}$).+$"
},
"proven_runtime_alias": {
"type": "string",
"pattern": "^(?!-?[0-9]{8,}$)[a-z0-9_]+$"
},
"runtime_alias_evidence": {
"enum": [
"proven_runtime_receipt",
"source_config_only",
"configured_unreachable",
"visible_label_only"
]
},
"chat_alias": {
"type": "string",
"pattern": "^(?!-?[0-9]{8,}$)[a-z0-9_]+$"
},
"bot_alias": {
"type": "string",
"pattern": "^(?!-?[0-9]{8,}$)[a-z0-9_]+$"
},
"bot_owner": {"type": "string", "minLength": 1},
"monitoring_owner": {"type": "boolean"},
"role": {"type": "string", "minLength": 1},
"monitoring_egress_policy": {"type": "string", "minLength": 1},
"runtime_identifier_in_registry": {"const": false}
}
}
},
"products": {
"type": "array",
"minItems": 11,
"maxItems": 11,
"items": {
"type": "object",
"additionalProperties": false,
"propertyNames": {
"not": {
"pattern": "(?:[Cc][Hh][Aa][Tt][_-]?[Ii][Dd]|[Tt][Oo][Kk][Ee][Nn]|[Ss][Ee][Cc][Rr][Ee][Tt]|[Aa][Uu][Tt][Hh][Oo][Rr][Ii][Zz][Aa][Tt][Ii][Oo][Nn]|[Ww][Ee][Bb][Hh][Oo][Oo][Kk])"
}
},
"required": [
"product_id",
"display_name",
"owner",
"source_audit_status",
"egress_status"
],
"properties": {
"product_id": {"type": "string", "minLength": 1},
"display_name": {"type": "string", "minLength": 1},
"owner": {"type": "string", "minLength": 1},
"source_audit_status": {"type": "string", "minLength": 1},
"egress_status": {
"enum": ["allowed", "blocked", "disabled", "not_implemented"]
}
}
}
},
"routes": {
"type": "array",
"minItems": 11,
"items": {
"type": "object",
"additionalProperties": false,
"propertyNames": {
"not": {
"pattern": "(?:[Cc][Hh][Aa][Tt][_-]?[Ii][Dd]|[Tt][Oo][Kk][Ee][Nn]|[Ss][Ee][Cc][Rr][Ee][Tt]|[Aa][Uu][Tt][Hh][Oo][Rr][Ii][Zz][Aa][Tt][Ii][Oo][Nn]|[Ww][Ee][Bb][Hh][Oo][Oo][Kk])"
}
},
"required": [
"route_id",
"product_id",
"signal_family",
"severity",
"scope",
"bot_alias",
"chat_alias",
"allowed_destination",
"receipt_backend",
"owner",
"egress_status"
],
"properties": {
"route_id": {"type": "string", "minLength": 1},
"product_id": {"type": "string", "minLength": 1},
"signal_family": {"type": "string", "minLength": 1},
"severity": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {"enum": ["P0", "P1", "P2", "P3"]}
},
"scope": {"enum": ["shared", "product"]},
"bot_alias": {
"type": "string",
"pattern": "^(?!-?[0-9]{8,}$)[a-z0-9_]+$"
},
"chat_alias": {
"type": "string",
"pattern": "^(?!-?[0-9]{8,}$)[a-z0-9_]+$"
},
"allowed_destination": {
"type": "string",
"pattern": "^(?:blocked|telegram_chat_alias:[a-z0-9_]+)$"
},
"receipt_backend": {
"type": "string",
"minLength": 1,
"pattern": "^(?!-?[0-9]{8,}$).+$"
},
"owner": {"type": "string", "minLength": 1},
"egress_status": {
"enum": ["allowed", "blocked", "disabled", "not_implemented"]
},
"blocked_reason": {"type": "string", "minLength": 1}
},
"allOf": [
{
"if": {"properties": {"egress_status": {"const": "allowed"}}},
"then": {
"properties": {
"allowed_destination": {
"pattern": "^telegram_chat_alias:[a-z0-9_]+$"
}
}
},
"else": {
"required": ["blocked_reason"],
"properties": {"allowed_destination": {"const": "blocked"}}
}
}
]
}
},
"rollups": {
"type": "object",
"additionalProperties": false,
"required": [
"product_count",
"route_count",
"allowed_route_count",
"blocked_route_count",
"disabled_route_count",
"not_implemented_route_count",
"shared_sre_allowed_route_count",
"raw_numeric_destination_count",
"runtime_route_change_count",
"telegram_send_count"
],
"properties": {
"product_count": {"const": 11},
"route_count": {"type": "integer", "minimum": 11},
"allowed_route_count": {"type": "integer", "minimum": 0},
"blocked_route_count": {"type": "integer", "minimum": 0},
"disabled_route_count": {"type": "integer", "minimum": 0},
"not_implemented_route_count": {"type": "integer", "minimum": 0},
"shared_sre_allowed_route_count": {"type": "integer", "minimum": 0},
"raw_numeric_destination_count": {"const": 0},
"runtime_route_change_count": {"const": 0},
"telegram_send_count": {"const": 0}
}
},
"execution_boundaries": {
"type": "object",
"additionalProperties": false,
"required": [
"telegram_send_allowed",
"bot_api_call_allowed",
"secret_value_read_allowed",
"raw_chat_id_storage_allowed",
"runtime_route_change_allowed",
"production_deploy_allowed"
],
"properties": {
"telegram_send_allowed": {"const": false},
"bot_api_call_allowed": {"const": false},
"secret_value_read_allowed": {"const": false},
"raw_chat_id_storage_allowed": {"const": false},
"runtime_route_change_allowed": {"const": false},
"production_deploy_allowed": {"const": false}
}
}
}
}