opentide

Models

Pydantic models for rules, objectives, and threats — key fields, delegation methods, results, and errors.

Core objects are Pydantic v2 models with explicit schema identifiers. This page is the Python-side field reference; the full normative field contract lives in the specifications.

Core objects

ModelSchema IDModuleSpec
DetectionRulerule::1.0opentide.models.rulerule-1.0
DetectionObjectiveobjective::1.0opentide.models.objectiveobjective-1.0
ThreatVectorthreat::1.0opentide.models.threatthreat-1.0
from opentide.models.rule import DetectionRule
DetectionRule.__schema_identifier__  # "rule::1.0"

DetectionRule — key fields

AttributeTypeNotes
namestrDisplay name
metadataObjectMetadataIdentity, schema, version, tlp
descriptionstrRule narrative
statusstrDeployment status (default STAGING)
severitystrSeverity vocabulary (default Informational)
techniqueslist[str]ATT&CK technique IDs
configurationsRuleConfigurationsTyped per-platform blocks (preferred)
platformsdictLegacy flat platform dict
detection_modelstr | NoneObjective UUID this rule implements
responseRuleResponse | NoneAlert + response playbook

The YAML you author maps one-to-one onto these attributes:

rule = OpenTide.Rules["00000000-0000-4000-8003-000000000001"]
rule.name                       # "Sentinel KQL Rule"
rule.metadata.schema            # "rule::1.0"
rule.detection_model            # objective UUID
rule.configurations.sentinel.query

DetectionObjective — key fields

AttributeTypeNotes
namestrDisplay name
metadataObjectMetadataShared metadata
compositionObjectiveCompositionTop-level strategy (mirrors objective.composition)
objectiveObjectiveBodyBody: priority, type, signals, threats, …
obj = OpenTide.Objectives["00000000-0000-4000-8002-000000000001"]
obj.objective.threats           # ["…8001…"]  (threat UUIDs)
[s.name for s in obj.objective.signals]

ThreatVector — key fields

AttributeTypeNotes
namestrDisplay name
criticalitystrCriticality vocabulary
metadataObjectMetadataShared metadata
threatThreatBodyBody: severity, impact, terrain, surface, att&ck, …
threat = OpenTide.Threats["00000000-0000-4000-8001-000000000001"]
threat.threat.att_ck            # ["T1059"]  (YAML `att&ck`, aliased att_ck)
threat.threat.terrain           # free-form prose
threat.threat.surface           # vocabulary list, e.g. ["Windows::Desktop"]

Delegation methods

Rules loaded through the registry are bound to it and expose operations directly:

rule = OpenTide.Rules[uuid]

rule.validate() -> ValidationResult                      # schema + cross-object checks
rule.validate_query(platform) -> ValidationResult        # query syntax (supported platforms)
rule.deploy(platform, dry_run=False) -> DeploymentResult
rule.document() -> str                                   # or OpenTide.render_rule(rule)

validate_query runs the platform's query validator when one exists (Sentinel, Defender, Splunk, SentinelOne, Carbon Black); for CrowdStrike/HarfangLab it reports unsupported rather than faking a pass. See Validation → query validation.

Results

Delegation methods return small Pydantic result models (opentide.models.results):

class ValidationResult(BaseModel):
    ok: bool
    errors: list[str] = []
    warnings: list[str] = []

class DeploymentResult(BaseModel):
    platform: str
    uuids: list[str]
    dry_run: bool = False
    message: str = ""
result = rule.validate()
if not result.ok:
    for err in result.errors:
        print(err)

Errors

Exceptions live under opentide.core.errors.Errors (aliased TideErrors). Catch the specific type you expect:

ExceptionRaised when
Errors.TideDataModelErrorsMalformed Tide object (bad structure)
Errors.TideMDRDataModelErrorsInvalid MDR (rule) data structure
Errors.TideQueryValidationErrorA rule query fails validation
Errors.TideDeploymentErrorsAny failure during deployment
Errors.TenantConnectionErrorCannot connect to the target tenant
Errors.DetectionRuleCreationFailed / …UpdateFailed / …DeletionFailedPlatform API operation failed
Errors.TideConfigurationErrorsInvalid OpenTide configuration files
Errors.TenantNonExistingDeploymentPlanA tenant references a missing deployment plan
from opentide.core.errors import Errors

try:
    rule.deploy("sentinel")
except Errors.TenantConnectionError:
    ...  # credentials / connectivity
except Errors.TideDeploymentErrors:
    ...  # deployment failure

Note the difference between results (returned for expected pass/fail outcomes like validation) and errors (raised for exceptional failures like a broken connection).

Loading without the registry

from opentide.loading.rule_loader import load_rule_from_dict
from opentide.loading.object_loader import load_object_for_validation

Prefer registry access for interactive work; these loaders are used internally by validation and indexing.

Source

src/opentide/models/, src/opentide/models/results.py, src/opentide/core/errors.py

On this page