-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FR] Add Env Var DR_CLI_MAX_WIDTH and DaC Docs Updates #4518
base: main
Are you sure you want to change the base?
Changes from all commits
372dec8
f9a8f87
00b799f
c0e9653
39cd627
703b4e6
c191787
8bb33f8
d76828e
a781f4f
3a76d13
c2fd4de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ This repository was first announced on Elastic's blog post, [Elastic Security op | |
- [Overview of this repository](#overview-of-this-repository) | ||
- [Getting started](#getting-started) | ||
- [How to contribute](#how-to-contribute) | ||
- [Detections as Code (DaC)](#detections-as-code-dac) | ||
- [RTAs](#rtas) | ||
- [Licensing](#licensing) | ||
- [Questions? Problems? Suggestions?](#questions-problems-suggestions) | ||
|
@@ -133,11 +134,16 @@ For more advanced command line interface (CLI) usage, refer to the [CLI guide](C | |
|
||
We welcome your contributions to Detection Rules! Before contributing, please familiarize yourself with this repository, its [directory structure](#overview-of-this-repository), and our [philosophy](PHILOSOPHY.md) about rule creation. When you're ready to contribute, read the [contribution guide](CONTRIBUTING.md) to learn how we turn detection ideas into production rules and validate with testing. | ||
|
||
## Detections as Code (DaC) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add it to the table like in @traut Cortado PR There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call! Updated |
||
|
||
The Detection Rules repo includes a number of commands to help one manage rules with an "as code" philosophy. We recommend starting with our [DaC Specific Documentation](https://dac-reference.readthedocs.io/en/latest/) for strategies and recommended setup information. However, if you would prefer to jump right in, please see our [custom rules documentation](docs/custom-rules.md) for information on how to configure this repo for use with custom rules followed by our [CLI documentation](CLI.md) for information on our commands to import and export rules. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you want to change the custom-rules page name to more related to dac? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would renaming it to Or perhaps something like Alternatively, I we could change the name to Thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @eric-forte-elastic for the detailed discussion yesterday, let's call this page custom-rules-management.md, and mention dac on the page itself. |
||
## RTAs | ||
|
||
Red Team Automations (RTAs) used to emulate attacker techniques and verify the rules can be found in dedicated | ||
repository - [Cortado](https://github.com/elastic/cortado). | ||
|
||
|
||
## Licensing | ||
|
||
Everything in this repository — rules, code, etc. — is licensed under the [Elastic License v2](LICENSE.txt). These rules are designed to be used in the context of the Detection Engine within the Elastic Security application. If you’re using our [Elastic Cloud managed service](https://www.elastic.co/cloud/) or the default distribution of the Elastic Stack software that includes the [full set of free features](https://www.elastic.co/subscriptions), you’ll get the latest rules the first time you navigate to the detection engine. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Detection as Code (DaC) Components in Detection-Rules Repo | ||
|
||
The **detection-rules** repository contains features for **Detections as Code (DaC)**. These components, including CLI options and workflows, provide methods to help apply DaC principles in practice. The specific DaC architecture should be carefully considered before implementation, for more conceptual ideas and details about DaC, refer to the [DaC Documentation](https://dac-reference.readthedocs.io/en/latest/). Reference implementation is shared to facilitate experimentation and community contributions. | ||
|
||
> [!NOTE] | ||
> This guidance outlines the support scope and best practices for using DaC components within the detection-rules repo. Users should take full responsibility for their usage of this repo, thoroughly test these tools in their environments, and verify functionality before using them. | ||
|
||
--- | ||
|
||
## Support and Scope | ||
|
||
Supported DaC components that interact with the Elastic Security Solution: | ||
- kibana export-rules ([link](https://github.com/elastic/detection-rules/blob/main/CLI.md#exporting-rules)) | ||
- kibana import-rules ([link](https://github.com/elastic/detection-rules/blob/main/CLI.md#using-import-rules)) | ||
- import-rules-to-repo ([link](https://github.com/elastic/detection-rules/blob/main/CLI.md#import-rules-to-repo)) | ||
- export-rules-from-repo ([link](https://github.com/elastic/detection-rules/blob/main/CLI.md#uploading-rules-to-kibana)) | ||
|
||
We welcome general questions, feature requests, and bug reports through the following channels: | ||
- **GitHub Issues**: For raising general questions, bugs, and feature requests related to the detection-rules repo. | ||
[GitHub Issues](https://github.com/elastic/detection-rules/issues) | ||
- **Community Slack**: For informal discussions or questions (note that message history is limited to 30 days). | ||
[Elastic Security Community Slack](https://elasticstack.slack.com/archives/C06TE19EP09) | ||
|
||
Support tickets related to this DaC reference implementation can be opened with Elastic, however since the logic is just a wrapper of the underlying product API's, we will not be able to treat DaC related support requests as a Severity-1 (Immedediate time frame). Urgent DaC issues can be resolved via direct interaction with the underlying Kibana API or Elastic Security Solution UI. We will ask customers to resort to these methods to resolve downtime or urgent issues. | ||
|
||
> [!TIP] | ||
> Questions about Kibana API usage should be directed to the Kibana repository: | ||
> [Kibana Issues](https://github.com/elastic/kibana/issues) | ||
|
||
--- | ||
|
||
## Feature Requests | ||
|
||
Feature requests for the DaC components that interact with the Elastic Security Solution (`kibana export-rules`, `kibana import-rules`, `import-rules-to-repo`, and `export-rules-from-repo`) in this repository will be handled similarly to the rest of the detection-rules repo: | ||
- **Prioritization**: Feature requests will be prioritized along with other development work in the repository. | ||
- **Schema Updates**: If there are breaking schema changes in Kibana that affect importing/exporting detection rules, those changes will be prioritized. | ||
- **Rule Engine API**: Current CLI tools leverage the rules engine API, and improvements to this will be treated as part of the ongoing development. | ||
--- | ||
|
||
## Reference Implementation of DaC Components | ||
|
||
DaC is not a single tool. Detection as Code (DaC) is a modern security approach that applies software development best practices to the creation, management, and deployment of security rules. Here is a short summary of several components that extend upon Elastic's rule management capabilities (e.g. query validation, schema validation, unit tests, etc.) provided to help fast track users ability to implement custom DaC implementations in their private environments. If you are new to these concepts, please refer to the [DaC Documentation](https://dac-reference.readthedocs.io/en/latest/), which also provides a quickstart guide and example end-to-end CI/CD workflows. These components are configurable by using the [custom-rules](docs-dev/custom-rules.md) setup. | ||
|
||
- Kibana's Rule Versioning Mechanism ([link](https://dac-reference.readthedocs.io/en/latest/internals_of_the_detection_rules_repo.html#option-2-defer-to-elastic-security)) | ||
- Local rule management (e.g. autoschema generation, actions and exceptions) ([link](https://dac-reference.readthedocs.io/en/latest/internals_of_the_detection_rules_repo.html#option-1-using-the-built-in-configuration)) | ||
|
||
--- | ||
|
||
## Best Practices for Using DaC Components | ||
|
||
When implementing DaC in your production environment, follow these best practices: | ||
|
||
- **Design and Test Rigorously**: Since every DaC implementation will be user-specific, remember to diligently design, and thoroughly test the tools before deploying them in a production environment. | ||
- **Version Compatibility**: Before upgrading the detection-rules repo version, ensure that you test compatibility with your environment. For more information, see our [Versioning Documentation](https://github.com/elastic/ia-trade-team/issues/471%23issuecomment-2423259800). | ||
- **Limited Backward Compatibility**: We do not guarantee backward compatibility across versions for rule schemas. While we aim to make new fields optional where feasible, there may be minimum version requirements for Elastic Stack and are subject to Kibana's rule schema definitions. | ||
- **Schema Parity**: Not all fields in the schema defined in Kibana are fully supported. Some fields in the detection-rules repo are generalized (e.g., `field = dict()`), while others are more strictly defined. This is due to the complexity of the schemas and the prioritization of Elastic's internal use cases. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add sub-header to highlight this command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to move the upload-rule command below and make it more clear not to use it? Is it removed in 9.0?