Skip to content

Commit 164691e

Browse files
authored
docs(code_security): document the secrets configuration file (DataDog#39313)
Adds the secrets.global-config fields to the Secret Scanning page and schema-version v1.5 to the Code Security configuration reference. Refs: K9CODESEC-4729
1 parent 6d0cb8a commit 164691e

3 files changed

Lines changed: 51 additions & 6 deletions

File tree

hugo/config/_default/menus/main.en.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8077,7 +8077,7 @@ menu:
80778077
url: /security/code_security/secret_scanning/generic_ci_providers/
80788078
parent: sec_secret_scanning
80798079
weight: 2
8080-
- name: Rule Configuration
8080+
- name: Configuration
80818081
identifier: sec_secret_scanning_configuration
80828082
url: /security/code_security/secret_scanning/configuration/
80838083
parent: sec_secret_scanning

hugo/content/en/security/code_security/guides/configuration.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ further_reading:
1212
- link: /security/code_security/iac_security/configuration/
1313
tag: Documentation
1414
text: Infrastructure as Code (IaC) Security Configuration
15+
- link: /security/code_security/secret_scanning/configuration/
16+
tag: Documentation
17+
text: Secret Scanning Configuration
1518
---
1619

1720
Datadog Code Security can be configured in Datadog, in a file at the root of your repository, or in both locations.
@@ -27,22 +30,25 @@ The configuration file must begin with a `schema-version` key, followed by top-l
2730
| `v1.2` | SAST, SCA, IaC Security |
2831
| `v1.3` | SAST, SCA, IaC Security |
2932
| `v1.4` | SAST, SCA, IaC Security |
33+
| `v1.5` | SAST, SCA, IaC Security, Secret Scanning |
3034

31-
Use `schema-version: v1.4` for all new configurations. It supports the same products as `v1.3` and adds per-rule `arguments` for IaC rules. Version `v1.3` added IaC configuration options such as per-rule path scoping, per-rule severity overrides, and platform filters. See [Infrastructure as Code (IaC) Security Configuration][3] for IaC-specific fields.
35+
Use `schema-version: v1.5` for all new configurations. It supports the same products as `v1.4` and adds Secret Scanning. Version `v1.4` added per-rule `arguments` for IaC rules, and `v1.3` added IaC configuration options such as per-rule path scoping, per-rule severity overrides, and platform filters. See [Infrastructure as Code (IaC) Security Configuration][3] for IaC-specific fields and [Secret Scanning Configuration][4] for secrets-specific fields.
3236

3337
The following example shows the top-level structure:
3438

3539
```yaml
36-
schema-version: v1.4
40+
schema-version: v1.5
3741
sast:
3842
# Static Code Analysis (SAST) configuration
3943
sca:
4044
# Software Composition Analysis (SCA) configuration
4145
iac:
4246
# Infrastructure as Code (IaC) Security configuration
47+
secrets:
48+
# Secret Scanning configuration
4349
```
4450

45-
The `sast`, `sca`, and `iac` sections are optional. Any configuration location, including the org level, repository level, or repository file, can include one or more sections. The `sast` section also controls AI-native SAST rulesets for Datadog-hosted scans. For the full schema for each section and AI-native SAST ruleset names, see [Static Code Analysis (SAST) Configuration][1], [Software Composition Analysis (SCA) Configuration][2], and [Infrastructure as Code (IaC) Security Configuration][3].
51+
The `sast`, `sca`, `iac`, and `secrets` sections are optional. Any configuration location, including the org level, repository level, or repository file, can include one or more sections. The `sast` section also controls AI-native SAST rulesets for Datadog-hosted scans. The `secrets` section controls which files are scanned for secrets; the rules themselves are configured in Datadog. For the full schema for each section, see [Static Code Analysis (SAST) Configuration][1], [Software Composition Analysis (SCA) Configuration][2], [Infrastructure as Code (IaC) Security Configuration][3], and [Secret Scanning Configuration][4]. The SAST page also lists the AI-native SAST ruleset names.
4652

4753
## Where to define configurations
4854

@@ -195,3 +201,4 @@ The example demonstrates each merge rule from the table above:
195201
[1]: /security/code_security/static_analysis/configuration/
196202
[2]: /security/code_security/software_composition_analysis/configuration/
197203
[3]: /security/code_security/iac_security/configuration/
204+
[4]: /security/code_security/secret_scanning/configuration/

hugo/content/en/security/code_security/secret_scanning/configuration.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
---
2-
title: Rule Configuration
2+
title: Configuration
33
algolia:
44
tags: ['static analysis', 'ci pipeline', 'SAST', 'secret scanning']
5-
description: Configure rules for Datadog Secret Scanning, including managed default rules and custom regex rules.
5+
description: Configure Datadog Secret Scanning rules and the files that are scanned.
66
---
77

88
By default, Datadog Secret Scanning scans enabled repositories with all [rules in the Secrets & Credentials category of Sensitive Data Scanner][1]. You can customize which rules run, modify default rules, and create custom rules on the [{{< ui >}}Code{{< /ui >}} configuration page][2] in SDS.
9+
10+
The rules, scanning groups, and custom rules described on this page are configured in Datadog. A configuration file in your repository adds separate control over which files are scanned. See [File configuration](#file-configuration).
911
## Scanning groups
1012
There are two scanning groups that configure Secret Scanning rules.
1113
### Managed scanning group
@@ -44,6 +46,42 @@ Disable a rule by clicking the blue toggle on the right.
4446

4547
<div class="alert alert-info">After a specific rule is disabled, existing findings from that rule are auto-closed in Secret Scanning on the next commit.</div>
4648

49+
## File configuration
50+
51+
Rules are configured in Datadog as described in the [Configuring rules](#configuring-rules) section. Which files Secret Scanning reads is configured under the `secrets` key in the Code Security configuration. Define it in Datadog, or in a `code-security.datadog.yaml` file at the root of your repository.
52+
53+
For information on configuration locations, precedence, and merging, see [Code Security Configuration Reference][4].
54+
55+
The configuration must begin with `schema-version: v1.5`, followed by a `secrets` key containing a `global-config` object. The `global-config` object controls repository-wide settings:
56+
57+
| **Property** | **Type** | **Description** | **Default** |
58+
| --- | --- | --- | --- |
59+
| `only-paths` | Array | File paths or glob patterns. Only matching files are analyzed. | None |
60+
| `ignore-paths` | Array | File paths or glob patterns to exclude. Matching files are not analyzed. | None |
61+
| `use-gitignore` | Boolean | Whether to include entries from the `.gitignore` file in `ignore-paths`. | `true` |
62+
| `ignore-generated-files` | Boolean | Whether to include common generated file patterns in `ignore-paths`. | `true` |
63+
| `max-file-size-kb` | Number | Maximum file size (in kB) to analyze. Larger files are ignored. | `10240` |
64+
65+
### Example configuration
66+
67+
{{< code-block lang="yaml" >}}
68+
schema-version: v1.5
69+
secrets:
70+
global-config:
71+
# Only analyze the following paths/files
72+
only-paths:
73+
- "src"
74+
- "**/*.py"
75+
# Do not analyze the following paths/files
76+
ignore-paths:
77+
- "tests"
78+
- "**/*.lock"
79+
use-gitignore: true
80+
ignore-generated-files: true
81+
max-file-size-kb: 10240
82+
{{< /code-block >}}
83+
4784
[1]: /security/sensitive_data_scanner/scanning_rules/library_rules/?category=Secrets+and+credentials
4885
[2]: https://app.datadoghq.com/sensitive-data-scanner/configuration/code
4986
[3]: /security/sensitive_data_scanner/scanning_rules/custom_rules/
87+
[4]: /security/code_security/guides/configuration/

0 commit comments

Comments
 (0)