Cline rules
.clinerules/SECOPS_YARAL_STYLE_GUIDE.mdCline rules
Quality
61/100
Scores the file, not the repository.Length
1,760 words
19 headings · 9 code blocksRepository
2
— · pushed 178 days agoLast changed
3 days ago
First indexed 3 days ago.1# Style Guide for Community Rules23Detection rules for Google Security Operations are written in the4[YARA-L](https://cloud.google.com/chronicle/docs/detection/yara-l-2-0-overview)5language.67This style guide establishes baseline standards of quality, completeness,8readability, and extensibility for community rules in this project. This guide9also sets an example for what high quality rules look like and what components10detection engineers should include in their own rules.1112## Characteristics of quality community detection rules1314Detection rules in this project should:1516- Provide value out of the box, even if users must tweak them to provide the17most value. A rule should solve a real problem, meet a specific use case, or18address a contemporary threat.19- Serve as a jumping off point or inspiration for detection engineers to create20their own detections.21- Highlight capabilities that exist within Google SecOps's detection engine.22- Be optimized for performance wherever possible.2324## Rule file format2526Each rule file should have a short, descriptive name and a `.yaral` extension.27Example: `entra_id_add_user_to_admin_role.yaral`.2829The following license must be included at the beginning of each rule file.3031```32/*33 * Copyright 2025 Google LLC34 *35 * Licensed under the Apache License, Version 2.0 (the "License");36 * you may not use this file except in compliance with the License.37 * You may obtain a copy of the License at38 *39 * https://www.apache.org/licenses/LICENSE-2.040 *41 * Unless required by applicable law or agreed to in writing, software42 * distributed under the License is distributed on an "AS IS" BASIS,43 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.44 * See the License for the specific language governing permissions and45 * limitations under the License.46 */47```4849Ensure that there are no tabs or trailing whitespaces in your rule.5051## YARA-L rule sections5253### `meta` section5455Guidance on the `meta` section of a rule.5657#### General information5859All rules should have:6061- An author of `Google Cloud Security` or the name of the original author of the62rule.63- A description that explains what behavior the rule detects.64- A `rule_id` that is unique to the rule. The value for this field must be a65 UUIDv4 value that is unique to the rule with a prefix of `mr_`66 (e.g. `mr_069a282b-a605-4572-921e-f466b93d0123`)67- A `rule_name` that is unique to the rule and provides a human friendly,68 short description for the rule.69- A severity defined (`Info`, `Low`, `Medium`, `High`, or `Critical`).70- A priority defined (`Info`, `Low`, `Medium`, `High`, or `Critical`).7172Values that would be helpful in providing additional context around the rule73include the following and are considered optional:7475- `platform` - The platform(s) that this rule focuses on.76 - It is possible to specify multiple platforms. For example, a Windows based77 EDR event that is correlated with events from Google Cloud.78 - Not all rules will have this field/value, as some rules can be79 platform-agnostic.80 - Example: `platform = "Windows, GCP"`8182- `type` - The rule type. Examples include `alert` or `hunt`.83 - `alert` is used for higher fidelity rules that are candidates for deployment84 while `hunt` might cause false positives but provide results that could be85 used as part of a threat hunt.86 - Example: `type = "hunt"`8788- `data_source` - What data sources were used for testing the rule, i.e., what89 logs should the rule run against.90 - While it may not be possible to validate every data source, by providing91 representative data source(s), authors can provide some level of92 understanding on the approach being taken in the rule.93 - Example: `data_source = "microsoft sysmon, custom misp parser"`9495- `assumptions` - What are the things that the author took into account when96 writing the rule that someone deploying the rule should be aware of.97 - Example: `assumption = "While it should work for any EDR systems and98 ingested threat intel, the metadata.product_name for MISP should be99 modified or commented out based upon event source."`100101- `reference` - If a website has a write-up on this attack technique or the rule102 is ported from another platform's reference site, it should be cited here.103 - Example: `reference = "https://mysource.for.this.rule/if-applicable"`104105- `tags` - Used to denote ways to group rules using specific functionality.106 Example: `tags = “whois, vt”`. Additional107 example values include:108 - `asset enrichment`109 - `threat indicators`110 - `asset entity`111 - `safe browsing`112 - `user enrichment`113 - `prevalence`114 - `resource entity`115 - `benign binaries`116 - `vt enrichment`117 - `first last seen`118 - `user entity`119 - `tor`120 - `geoip enrichment`121 - `list`122 - `vt`123 - `whois`124 - `rat`125126#### MITRE ATT&CK mapping127128All rules that map to129[MITRE ATT&CK](https://attack.mitre.org/matrices/enterprise/) should include the130following fields in the meta section:131 - Tactic132 - Technique: Sub-Technique (if applicable)133134Example MITRE ATT&CK mapping in the `meta` section of a rule:135136```137meta:138 author = "Google Cloud Security"139 description = "Detects the use of net use for SMB/Windows admin shares"140 rule_id = "mr_069a282b-a605-4572-921e-f466b93d0123"141 rule_name = "net use usage for SMB/Windows admin shares"142 tactic = "TA0008"143 technique = "T1021.002"144 type = "alert"145 data_source = "microsoft sysmon, microsoft windows events"146 severity = "Low"147 priority = "Low"148```149150### `events` section151152Guidance on the `events` section of a rule.153154#### Variables155156All event variables should be descriptive to ensure readability, preferably not157`$event` and definitely not `$e1`.158159All placeholder variables should be descriptive enough to understand and if it160concatenates multiple words together should be separated with underscores, i.e.,161`$my_variable_for_hostname`.162163- A placeholder like `$hostname` is perfectly fine particularly when joining164 disparate nouns together.165- Using the same variable name with a different capitalization should be avoided166 if possible, i.e., `$Host` and `$host`.167168Joins between events and entities should be represented with a placeholder169variable in each line where possible to ensure readability and ease of170understanding.171172Joins on full field names are possible and will work, but using placeholder173variables is preferred and can be used in outcomes fields as well.174175Additional fields and values that improve the performance of the rules should176be used whenever possible. Examples of this include:177178- Adding a `<hash> != "hash_value"` to narrow down process launch or file179 creation events except if the field is being used as a match variable (see180 the `match` section of this guide below).181- Using `metadata.entity_type` for all entity based rules.182- Using `metadata.source_type` for all entity based rules.183- Using `metadata.event_type` where possible for UDM events.184185### `match` section186187Guidance on the `match` section of a rule.188189Most rules should have a `match` section, so that related alerts are grouped190together into a single detection.191192Match variables automatically exclude `NULL` values (`""` and `0` for strings193and integers, respectively), unless the194[`allow_zero_values`](https://cloud.google.com/chronicle/docs/detection/yara-l-2-0-syntax#options_section_syntax)195option is set. Unless that option is set, do not add conditions in the events196section that duplicate this logic. The following is NOT correct:197198```199events:200 $e.target.ip = "1.1.1.1"201 $hostname = $e.principal.hostname202 $e.principal.hostname != "" // unnecessary203204match:205 $hostname206```207208### `outcome` section209210Guidance on the `outcome` section of a rule.211212The `outcome` section can contain up to 20 outcome variables and should be213populated with the below fields where possible.214215Outcome variables and associated names may find their way into 3rd party216integrations, so descriptive names including the noun are preferred and should217be separated with underscores, i.e., `$target_process_command_line`.218219- `risk_score`220 - In the absence of a specific risk score, applying a value that aligns with221 the rule's severity (specified in the `meta` section) is reasonable.222223 | severity | risk_score |224 |----------|------------|225 | Info | 10 |226 | Low | 35 |227 | Medium | 65 |228 | High | 85 |229 | Critical | 95 |230231 - Specific criteria do not need to be applied unless the rule author has232 something in mind. Organizations have different risk scoring metrics and233 Google SecOps continues to evolve with the introduction of new234 capabilities.235236- `event_count` - for single-event variable rules.237 - Example: `$event_count = count_distinct($e.metadata.id)`238- Any hardcoded values in the condition section, greater than 1.239 - Given a condition of `#failed_logons > 100`, define a variable of240 `$failed_logon_threshold = 100`241242- Consider adding the descriptive fields from the noun families:243 `principal`, `target`, and `src`.244 - Within these families, the a subset of the following fields are always a good starting point245 - hostname246 - ip247 - mac248 - asset.hostname249 - asset.ip250 - asset.mac251 - user.userid252 - user.windows_sid253 - user.email_addresses254 - user.employee_id255 - process.command_line256 - process.file.full_path257 - process.product_specific_process_id258 - process.parent_process.product_specific_process_id259 - process.pid260 - process.file.sha256261 - process.file.sha1262 - process.file.md5263 - file.full_path264 - file.sha256265 - file.sha1266 - file.md5267 - resource.name268 - url269 - artifact.ip270 - domain.name271272 - The names for these outcome variables should be descriptive. Example:273 `$impacted_host = array_distinct($event.principal.hostname)` or274 `$impacted_user = array_distinct($event.principal.user.userid)` or275276- Any additional summary values or fields of interest based upon the rule should277 also be included in the outcome section.278279## Appendix280281### Example outcome variables for use with the alert graph282283These are based on a limited set of data sources during testing. These serve as284a reference set of fields that will populate the alert graph for additional285context based upon the `metadata.event_type` in the rule.286287#### Example outcome variables for event type `NETWORK_CONNECTION`288289```290$principal_ip = array_distinct($network.principal.ip)291$target_ip = array_distinct($network.target.ip)292$principal_process_pid = array_distinct($network.principal.process.pid)293$principal_process_command_line = array_distinct($network.principal.process.command_line)294$principal_process_file_sha256 = array_distinct($network.principal.process.file.sha256)295$principal_process_file_full_path = array_distinct($network.principal.process.file.full_path)296$principal_process_product_specific_process_id = array_distinct($network.principal.process.product_specific_process_id)297$principal_process_parent_process_product_specific_process_id = array_distinct($network.principal.process.parent_process.product_specific_process_id)298$target_process_pid = array_distinct($network.target.process.pid)299$target_process_command_line = array_distinct($network.target.process.command_line)300$target_process_file_sha256 = array_distinct($network.target.process.file.sha256)301$target_process_file_full_path = array_distinct($network.target.process.file.full_path)302$target_process_product_specific_process_id = array_distinct($network.target.process.product_specific_process_id)303$target_process_parent_process_product_specific_process_id = array_distinct($network.target.process.parent_process.product_specific_process_id)304$principal_user_userid = array_distinct($network.principal.user.userid)305$target_user_userid = array_distinct($network.target.user.userid)306```307308#### Example outcome variables for event type `NETWORK_HTTP`309310```311$principal_hostname = array_distinct($network.principal.hostname)312$target_hostname = array_distinct($network.target.hostname)313$principal_user_userid = array_distinct($network.principal.user.userid)314$target_url = array_distinct($network.target.url)315```316317#### Example outcome variables for event type `USER_LOGIN`318319```320$principal_hostname = array_distinct($login.principal.hostname)321$principal_ip = array_distinct($login.principal.ip)322$target_hostname = array_distinct($login.target.hostname)323$target_ip = array_distinct($login.target.ip)324$principal_user_userid = array_distinct($login.principal.user.userid)325$target_user_userid = array_distinct($login.target.user.userid)326$principal_resource_name = array_distinct($login.principal.resource.name)327$target_resource_name = array_distinct($login.target.resource.name)328$target_url = array_distinct($login.target.url)329```330331#### Example outcome variables for event type `PROCESS_LAUNCH`332333```334$principal_hostname = array_distinct($execution.principal.hostname)335$principal_process_pid = array_distinct($execution.principal.process.pid)336$principal_process_command_line = array_distinct($execution.principal.process.command_line)337$principal_process_file_sha256 = array_distinct($execution.principal.process.file.sha256)338$principal_process_file_full_path = array_distinct($execution.principal.process.file.full_path)339$principal_process_product_specific_process_id = array_distinct($execution.principal.process.product_specific_process_id)340$principal_process_parent_process_product_specific_process_id = array_distinct($execution.principal.process.parent_process.product_specific_process_id)341$target_process_pid = array_distinct($execution.target.process.pid)342$target_process_command_line = array_distinct($execution.target.process.command_line)343$target_process_file_sha256 = array_distinct($execution.target.process.file.sha256)344$target_process_file_full_path = array_distinct($execution.target.process.file.full_path)345$target_process_product_specific_process_id = array_distinct($execution.target.process.product_specific_process_id)346$principal_user_userid = array_distinct($execution.principal.user.userid)347```348349#### Example outcome variables for event type `FILE_CREATION`350351```352$principal_hostname = array_distinct($execution.principal.hostname)353$principal_process_pid = array_distinct($execution.principal.process.pid)354$principal_process_command_line = array_distinct($execution.principal.process.command_line)355$principal_process_file_sha256 = array_distinct($execution.principal.process.file.sha256)356$principal_process_file_full_path = array_distinct($execution.principal.process.file.full_path)357$principal_process_product_specific_process_id = array_distinct($execution.principal.process.product_specific_process_id)358$principal_process_parent_process_product_specific_process_id = array_distinct($execution.principal.process.parent_process.product_specific_process_id)359$target_process_pid = array_distinct($execution.target.process.pid)360$target_process_command_line = array_distinct($execution.target.process.command_line)361$target_process_file_sha256 = array_distinct($execution.target.process.file.sha256)362$target_process_file_full_path = array_distinct($execution.target.process.file.full_path)363$target_process_product_specific_process_id = array_distinct($execution.target.process.product_specific_process_id)364$principal_user_userid = array_distinct($execution.principal.user.userid)365$target_file_sha256 = array_distinct($execution.target.file.sha256)366$target_file_full_path = array_distinct($execution.target.file.full_path)367```368369#### Example outcome variables for event type `NETWORK_DNS`370371```372$principal_ip = array_distinct($dns.principal.ip)373$target_ip = array_distinct($dns.target.ip)374$principal_process_pid = array_distinct($dns.principal.process.pid)375$principal_process_file_full_path = array_distinct($dns.principal.process.file.full_path)376$principal_process_product_specific_process_id = array_distinct($dns.principal.process.product_specific_process_id)377$principal_user_userid = array_distinct($dns.principal.user.userid)378$principal_process_command_line = array_distinct($dns.principal.process.command_line)379$principal_process_file_sha256 = array_distinct($dns.principal.process.file.sha256)380$principal_process_parent_process_product_specific_process_id = array_distinct($dns.principal.process.parent_process.product_specific_process_id)381$network_dns_questions_name = array_distinct($dns.network.dns.questions.name)382$network_dns_answers_data = array_distinct($dns.network.dns.answers.data)383```384
Also in repulsivityy/elevate_2025
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| repulsivityy/elevate_2025.clinerules/OVERVIEW_OF_YARAL_LANGUAGE.md · 2 | Cline rules | archdo-not | 45/100 | 3 days ago | |
| repulsivityy/elevate_2025.clinerules/YARA_RULES_STYLE_GUIDE.md · 2 | Cline rules | buildstylearchtypes | 46/100 | 3 days ago | |
| repulsivityy/elevate_2025ai-runbooks-elevate25/.clinerules/suggested_mcp_tools.md · 2 | Cline rules | no sections | 34/100 | 3 days ago | |
| repulsivityy/elevate_2025.clinerules/YARAL_SYNTAX.md · 2 | Cline rules | archtypesdo-notdocs | 45/100 | 3 days ago | |
| repulsivityy/elevate_2025.clinerules/coding_conventions.md · 2 | Cline rules | styledocs | 34/100 | 3 days ago | |
| repulsivityy/elevate_2025.clinerules/project_plan.md · 2 | Cline rules | agent-behaviour | 26/100 | 3 days ago | |
| repulsivityy/elevate_2025.clinerules/readme.md · 2 | Cline rules | setuparch | 52/100 | 3 days ago | |
| repulsivityy/elevate_2025.clinerules/reporting_templates.md · 2 | Cline rules | typessecurity | 44/100 | 3 days ago | |
| repulsivityy/elevate_2025.clinerules/suggested_mcp_tools.md · 2 | Cline rules | no sections | 34/100 | 3 days ago | |
| repulsivityy/elevate_2025ai-runbooks-elevate25/.clinerules/coding_conventions.md · 2 | Cline rules | styledocs | 34/100 | 3 days ago | |
| repulsivityy/elevate_2025ai-runbooks-elevate25/.clinerules/project_plan.md · 2 | Cline rules | agent-behaviour | 26/100 | 3 days ago | |
| repulsivityy/elevate_2025ai-runbooks-elevate25/.clinerules/readme.md · 2 | Cline rules | setuparch | 52/100 | 3 days ago | |
| repulsivityy/elevate_2025ai-runbooks-elevate25/.clinerules/reporting_templates.md · 2 | Cline rules | typessecurity | 44/100 | 3 days ago |
Diff against .clinerules/OVERVIEW_OF_YARAL_LANGUAGE.md Diff against .clinerules/YARA_RULES_STYLE_GUIDE.md Diff against ai-runbooks-elevate25/.clinerules/suggested_mcp_tools.md Diff against .clinerules/YARAL_SYNTAX.md Diff against .clinerules/coding_conventions.md Diff against .clinerules/project_plan.md Diff against .clinerules/readme.md Diff against .clinerules/reporting_templates.md Diff against .clinerules/suggested_mcp_tools.md Diff against ai-runbooks-elevate25/.clinerules/coding_conventions.md Diff against ai-runbooks-elevate25/.clinerules/project_plan.md Diff against ai-runbooks-elevate25/.clinerules/readme.md Diff against ai-runbooks-elevate25/.clinerules/reporting_templates.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| bashdeban/fastmind.clinerules/.project-consistency-keeper2.md · 5 | Cline rules | setupbuildtestlint-format+11 | 100/100 | 3 days ago | |
| JCodesMore/ai-website-cloner-template.clinerules · 31k | Cline rules | buildlint-formatstylearch+3 | 97/100 | 2 days ago | |
| BryaanF/LiantPortfolio.clinerules/project-guidelines.md · 0 | Cline rules | buildstylearchgit+2 | 96/100 | 3 days ago | |
| u9401066/zotero-keeper.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| u9401066/zotero-keepervscode-extension/resources/repo-assets/pubmed-search-mcp/.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| u9401066/pubmed-search-mcp.clinerules/50-pubmed-project.md · 23 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| HerringtonDarkholme/megarepo.clinerules/02-development.md · 17 | Cline rules | setupbuildteststyle+3 | 92/100 | 3 days ago | |
| blendsdk/codeops-mcp.clinerules/project.md · 0 | Cline rules | buildteststylearch+7 | 91/100 | 3 days ago |
