github_repository_visibility_changed_to_public


Description

Detects when the visibility for a GitHub repository is changed to public.

Query · yara_l

events:
    // If internal/private GitHub repositories are often made public by your organization, consider filtering events based on
    // what behavior is considered normal, e.g., is a specific GitHub account used to make repos public?
    $github.metadata.vendor_name = "GITHUB" nocase
    $github.metadata.product_name = "GITHUB"
    $github.metadata.product_event_type = "repo.access"
    $github.extracted.fields["previous_visibility"] = "internal"
    $github.extracted.fields["public_repo"] = "true"
    $github.principal.user.userid = $user_id
    $github.target.resource.name = $github_repo_name

  match:
    $user_id, $github_repo_name over 30m

  outcome:
    $risk_score = max(85)
    $event_count = count_distinct($github.metadata.id)
    $principal_ip = array_distinct($github.principal.ip)
    $principal_user_userid = array_distinct($github.principal.user.userid)
    $principal_ip_country = array_distinct($github.principal.ip_geo_artifact.location.country_or_region)
    $principal_ip_state = array_distinct($github.principal.ip_geo_artifact.location.state)
    $principal_ip_city = array_distinct($github.principal.location.city)
    $security_result_summary = array_distinct($github.security_result.summary)

  condition:
    $github
Raw source github_repository_visibility_changed_to_public · YARA-L
Esc
Published by chronicle/detection-rules ↗, licensed under Apache 2.0 ↗. Reproduced here unmodified.
rule github_repository_visibility_changed_to_public {

  meta:
    author = "Google Cloud Security"
    description = "Detects when the visibility for a GitHub repository is changed to public."
    rule_id = "mr_0f64f779-e61b-4827-9797-9eca5a825780"
    rule_name = "GitHub Repository Visibility Changed To Public"
    assumption = "Your GitHub enterprise audit log settings are configured to log the source IP address for events. Reference: https://docs.github.com/en/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/displaying-ip-addresses-in-the-audit-log-for-your-organization"
    type = "alert"
    // Customize the severity and priority values depending on how normal this behavior is for your organization
    severity = "High"
    priority = "High"
    platform = "GitHub"
    data_source = "github"
    reference = "https://docs.github.com/en/enterprise-cloud@latest/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise"

  events:
    // If internal/private GitHub repositories are often made public by your organization, consider filtering events based on
    // what behavior is considered normal, e.g., is a specific GitHub account used to make repos public?
    $github.metadata.vendor_name = "GITHUB" nocase
    $github.metadata.product_name = "GITHUB"
    $github.metadata.product_event_type = "repo.access"
    $github.extracted.fields["previous_visibility"] = "internal"
    $github.extracted.fields["public_repo"] = "true"
    $github.principal.user.userid = $user_id
    $github.target.resource.name = $github_repo_name

  match:
    $user_id, $github_repo_name over 30m

  outcome:
    $risk_score = max(85)
    $event_count = count_distinct($github.metadata.id)
    $principal_ip = array_distinct($github.principal.ip)
    $principal_user_userid = array_distinct($github.principal.user.userid)
    $principal_ip_country = array_distinct($github.principal.ip_geo_artifact.location.country_or_region)
    $principal_ip_state = array_distinct($github.principal.ip_geo_artifact.location.state)
    $principal_ip_city = array_distinct($github.principal.location.city)
    $security_result_summary = array_distinct($github.security_result.summary)

  condition:
    $github
}

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.