Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

RuleSet

A RuleSet is a group of rules that evaluate events from CI/CD job runtime. RuleSets are written under the top-level rule_sets: key.

Minimal RuleSet

rule_sets:
  - ruleset_id: acme/basic
    rules:
      - rule_id: curl_exec
        rule_name: "curl executed"
        event_type: process_exec
        condition: process.exec_path.endsWith("/curl")
        action: detect
        tags:
          severity: medium
          category: execution

condition is written in CEL. See CEL conditions for details.

Rule identity

ruleset_id must be unique across all sources. rule_id must be unique within the same RuleSet.

Correlation rules reference rules as rule.<rule_id>.total_count, so rule_id must be valid as a CEL identifier.

Allowed characters:

  • ASCII letters.
  • Digits.
  • Underscore.

rule_id cannot start with a digit and cannot contain hyphens, spaces, or non-ASCII characters. Use rule_name for the display name.

Rule types

Normal rules evaluate runtime events directly. Set event_type and condition; when an event matches the condition, the configured action is emitted.

- rule_id: curl_exec
  event_type: process_exec
  condition: process.exec_path.endsWith("/curl")
  action: detect

Use a correlation rule when you want to combine multiple rule hits. See Correlation for details.

- rule_id: network_tool_and_credential
  type: correlation
  condition: |
    rule.suspicious_network_tool.total_count >= 1 &&
    rule.credential_file_read.total_count >= 1
  action: detect

Event rule fields

FieldRequiredDescription
rule_idyesID unique within the RuleSet
rule_namenoDisplay name shown in reports and logs
event_typeyesEvent type to evaluate, such as process_exec, network_connect, or file_open
conditionyesCEL expression that returns bool
actionyesdetect, collect, or terminate
tagsnoMetadata such as severity or category
targetnoRepository / project where the rule applies
max_alertsnoMaximum entries emitted to the Detection Log per job / rule

Actions

actionMeaningDetection Log
detectRecord as a detectionemitted
collectRecord as a signal for investigation or correlationemitted
terminateAttempt to stop the jobemitted

When monitor_mode is enabled, terminate rules are treated as detect.

Today, the difference between detect and collect is how they are displayed in reports and logs. Both are emitted to the Detection Log.

A useful pattern is to mark broad primitive signals as collect, then use a correlation rule to emit detect only when multiple conditions appear together. This separates investigative signals from stronger alerts. Future notification or alert-delivery features may give detect and collect different behavior.

Target

target is used by the manager to control rule scope per repository when managing rules for multiple repositories centrally.

It can express rules that apply only to a specific repository, or organization-wide rules that exclude specific repositories.

target:
  include:
    - provider_host: github.com
      path: acme/prod
  exclude:
    - path: acme/prod-legacy

When include is set, the rule applies only to matching repositories. When include is omitted, all repositories are included.

path uses prefix matching. If both include and exclude match, exclude wins.

max_alerts

max_alerts limits how many entries a rule can emit to the Detection Log per job / rule. Use it to prevent noisy rules from filling the log.

max_alerts: 10

When omitted, the system default 10 is used.